Skip to content

feat: add idempotent upsell trigger logic#60

Open
1275321348 wants to merge 2 commits into
Nexussyn:mainfrom
1275321348:money-radar/upsell-trigger-3
Open

feat: add idempotent upsell trigger logic#60
1275321348 wants to merge 2 commits into
Nexussyn:mainfrom
1275321348:money-radar/upsell-trigger-3

Conversation

@1275321348

Copy link
Copy Markdown

Closes #3

Summary

  • Adds an idempotent upsell trigger module for the 5th free call threshold.
  • Returns X-Upsell-Prompt: true and threshold metadata when the trigger fires.
  • Generates deterministic prompt variants for A/B-test-ready messaging.
  • Adds Deno tests for threshold detection, no double-trigger behavior, headers, trigger record shape, and deterministic prompt selection.

Validation

  • Ran git diff --check.
  • Deno is not installed in this workspace, so deno test tests/upsell.test.ts could not be executed locally.

Notes

The existing migration for upsell_triggers is already present in the repository, so this PR focuses on the expected TypeScript middleware/helper layer and tests.

@1275321348

Copy link
Copy Markdown
Author

Extra implementation note: this PR keeps the upsell trigger logic isolated in a small helper layer and adds coverage for the main behavior: 5th-call threshold detection, duplicate prevention, response header output, trigger record shape, and deterministic prompt variant selection. It should be easy to review or move into a different integration point if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AGENT-TASK] Auto-upsell trigger after 5th free call — +25% revenue

1 participant