feat: deposit receipt reset (#1049), developer usage dashboard (#1043), onboarding drip campaign (#1044) - #1177
Merged
Conversation
- vjuliaife#1049: the DepositWizard receipt step gains 'Make another deposit' (resets step/xlm/txHash to the amount step, clearing the prior txHash) and 'Done' actions, so it is no longer a reload-only dead end. - vjuliaife#1043: per-API-key request metering. A global, non-gating middleware meters traffic carrying a recognised X-Api-Key into minute buckets (api_key_usage, 30-day retention via a daily prune job). New GET /developer/usage, /developer/keys, /developer/keys/:id/usage return volume per hour/day, an endpoint-category breakdown, and current-minute count vs the optional per-key rate_limit_per_min with an 'approaching limit' flag. New /developer page renders a usage chart, remaining-quota bar, and warning banner. - vjuliaife#1044: onboarding drip campaign. Signup enrols importers (onboarding_drip_enrollments); a 15-minute scheduler walks the admin-editable onboarding_drip_steps sequence, sending each due step as an in-app notification or skipping it when the importer has already done the action (KYC / first deposit / tariff upload), and marks the enrollment complete when the sequence is exhausted. Importers can unsubscribe (POST /onboarding/drip/unsubscribe) without touching transactional notifications; admins edit content/timing via PUT /onboarding/drip/steps/:stepKey. Migration 0008 adds api_key_usage, the api_keys.rate_limit_per_min column, and the three onboarding_drip_* tables (with the default 3-step sequence seeded). Not built or tested locally.
|
@bade2brazy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1049 — Deposit receipt is no longer a dead end
DepositWizard's receipt step gains two actions:resetWizard()returnsstep/xlm/txHash/busyto the amount step, clearing the previoustxHashso the next receipt can't show a stale hash.handleCancel()(resets + fires the optionalonCancel).The receipt stays rendered until the user picks one of these — nothing auto-navigates away.
#1043 — Developer dashboard: API usage & rate-limit status
There is no API-key auth gate in front of the REST API today, so this meters rather than enforces.
apiKeyUsageMeter) records requests that carry a recognisedX-Api-Keyinto per-(key, endpoint category, minute)buckets in the newapi_key_usagetable.rate_limit_per_minis a new nullable column onapi_keys(NULL = no configured limit → volume only, no quota indicator).startApiKeyUsagePruneSchedulersweeps buckets older than 30 days daily.authMiddleware+ privacy/ToS gates):GET /developer/keys— the caller's keys (metadata only)GET /developer/keys/:id/usage— rollup for one keyGET /developer/usage— rollup across all the caller's active keysremaining, andapproachingLimit(≥80% of the configured limit)./developerpage renders an inline-SVG hourly bar chart, a remaining-quota bar, the category breakdown, and a warning banner when approaching the limit.#1044 — Onboarding drip campaign
The platform's delivery primitive is the in-app
notificationstable (seeservices/upgrade-notifications.ts), so drip "sends" arecreateNotificationcalls, not SMTP.onboarding_drip_enrollments(best-effort — never fails signup).startOnboardingDripScheduler(15 min) walksonboarding_drip_stepsby position: when a step comes due (enrolled_at + delay_hours), it is sent, or skipped if the importer already did the action it nudges toward —kyc(importers.kyc_status='approved'),deposit(a depositcontract_eventsrow),tariff(atariff_uploadsrow). One step per enrollment per pass. When every active step has a send row the enrollment is markedcompleted_atand no longer processed.POST /onboarding/drip/unsubscribe— importer opt-out, independent of transactional notifications.GET /onboarding/drip— enrollment status + send log.GET /onboarding/drip/steps,PUT /onboarding/drip/steps/:stepKey—surety_adminedits subject/body/delay_hours/is_active.Migration 0008 adds
api_key_usage,api_keys.rate_limit_per_min, andonboarding_drip_steps/_enrollments/_sends, seeding the default 3-step sequence.maincurrently has two0006_migrations —0006_importers_and_events_perf_indexes.tsand0006_stakeholder_subscriptions_annotations_sla.ts— whichrunner.tsrejects with "Duplicate migration version detected: 6". This PR's migration is numbered0008and runs cleanly once that collision is resolved (renumber one of the0006s); it is not fixed here to avoid touching another issue's migration.Notes
Not built or tested locally. No API-key auth/enforcement is added —
#1043is scoped to visibility. Drip emails are delivered as in-app notifications to match the existing notification infrastructure.Closes #1049
Closes #1043
Closes #1044