Loyalty
Dashboard: every screen, state and flow in Loyalty.
15 screens and overlays, 60 states, 1 flows. Frames show a real screenshot where one was captured and a wireframe card where the state needs data or conditions a device run cannot produce.
Flows
Loyalty campaign setup and operation
Create Campaign
Draft autosave
Draft restored from localStorage with an info toast
Not captured yet
Award Bonus Stamps
Writes to Shopify
A reward or special position creates a real voucher and a live Shopify discount code
Not captured yet
Branches and edge cases
Create Campaign
Tier probabilities
Tiers must total 100% and be VOUCHER or MISS
Not captured yet
Create Campaign
Bad draft cleared
Previous draft contained errors and was cleared
Needs data: Needs specific backend rows, a role, or a submitted write on a disposable record
Delete Campaign
Admin downgraded
Campaign deactivated (permanent delete requires super admin)
Needs data: Needs specific backend rows, a role, or a submitted write on a disposable record
Delete Campaign
Participants block hard delete
Cannot delete: N user(s) have participated in this campaign
Needs data: Needs specific backend rows, a role, or a submitted write on a disposable record
Delete Campaign
Single sends hardDelete true
Bulk delete sends false, so it only deactivates
Needs data: Needs specific backend rows, a role, or a submitted write on a disposable record
Delete Voucher
Writes to Shopify
Cancels the voucher and deletes its discount code from Shopify when it was active
Needs data: Needs specific backend rows, a role, or a submitted write on a disposable record
Flow diagram
Screens and states
Loyalty Dashboard
/dashboard/loyaltyLoyalty Dashboard
Loyalty hub with stats, quick actions, audit and realtime tabs.
src/app/dashboard/loyalty/page.tsxEntry
- Sidebar Loyalty
Exits
- Campaigns → /loyalty/campaigns
- New Campaign → /campaigns/new
- Quick actions → users, audit, pools
- Audit tab → /loyalty/audit
- Export → Export dialog
States · 4
src/app/dashboard/loyalty/loading.tsxsrc/features/loyalty/components/views/loyalty-dashboard-view.tsx:271src/features/loyalty/components/views/loyalty-dashboard-view.tsxsrc/features/loyalty/components/views/loyalty-dashboard-view.tsx:534Campaigns
/dashboard/loyalty/campaignsCampaigns
List stamp campaigns with bulk actions.
src/app/dashboard/loyalty/campaigns/page.tsxEntry
- Sidebar
- Loyalty dashboard
Exits
- New Campaign → /campaigns/new
- View → /campaigns/[id]
- Edit → /campaigns/[id]/edit
- Pause or Activate
- Delete → confirm dialog
- Bulk Activate, Pause, Delete
States · 6
src/features/loyalty/components/views/campaign-management-view.tsxsrc/features/loyalty/components/views/campaign-management-view.tsxsrc/features/loyalty/components/campaigns/campaign-columns.tsx:204src/features/loyalty/components/campaigns/campaign-table.tsx:107src/features/loyalty/components/campaigns/campaign-table.tsxpackages/backend/convex/gamificationLoyalty/mutations.tsDelete Campaign
LoyaltyCampaignDeleteDialogDelete Campaign
Confirm deleting one or many campaigns.
src/features/loyalty/components/campaigns/campaign-table.tsxEntry
- Row menu Delete
- Bulk bar Delete
Exits
- Confirm → delete or deactivate
- Cancel → closes
States · 3
src/features/loyalty/components/campaigns/campaign-table.tsx:95packages/backend/convex/gamificationLoyalty/mutations.tspackages/backend/convex/gamificationLoyalty/mutations.tsCreate Campaign
/dashboard/loyalty/campaigns/newCreate Campaign
Set up a new loyalty stamp campaign.
src/app/dashboard/loyalty/campaigns/new/page.tsxEntry
- New Campaign buttons
- Template Use in Campaign
Exits
- Back or Cancel → unsaved dialog
- Submit → /loyalty/campaigns
States · 10
src/features/loyalty/components/campaigns/forms/campaign-form.tsx:505src/features/loyalty/components/campaigns/forms/campaign-form.tsx:505src/features/loyalty/components/campaigns/forms/campaign-form.tsx:237src/features/loyalty/components/campaigns/forms/campaign-form.tsx:342packages/backend/convex/gamificationLoyalty/mutations.ts:55src/features/loyalty/components/campaigns/forms/special-positions-manager.tsxsrc/features/loyalty/components/campaigns/forms/campaign-form.tsx:66src/features/loyalty/components/campaigns/forms/special-positions-manager.tsxsrc/features/loyalty/components/campaigns/forms/campaign-form.tsx:304src/features/loyalty/components/campaigns/forms/campaign-form.tsx:430Campaign detail
/dashboard/loyalty/campaigns/[id]Campaign detail
Campaign detail with analytics, rewards and realtime tabs.
src/app/dashboard/loyalty/campaigns/[id]/page.tsxEntry
- List View
- Users page campaign filter
Exits
- Back to campaigns
- Edit → /[id]/edit
- View all → /loyalty/users?campaign=
- Export → Export dialog (admin)
States · 6
src/app/dashboard/loyalty/campaigns/[id]/campaign-detail-client.tsxsrc/app/dashboard/loyalty/campaigns/[id]/campaign-detail-client.tsx:108src/app/dashboard/loyalty/campaigns/[id]/campaign-detail-client.tsxsrc/app/dashboard/loyalty/campaigns/[id]/campaign-detail-client.tsxsrc/app/dashboard/loyalty/campaigns/[id]/campaign-detail-client.tsxsrc/app/dashboard/loyalty/campaigns/[id]/campaign-detail-client.tsxEdit Campaign
/dashboard/loyalty/campaigns/[id]/editEdit Campaign
Modify campaign settings.
src/app/dashboard/loyalty/campaigns/[id]/edit/page.tsxEntry
- Edit links
Exits
- Back or Cancel → unsaved dialog
- Save Changes → /loyalty/campaigns
States · 3
src/features/loyalty/components/campaigns/forms/campaign-form.tsxsrc/features/loyalty/components/campaigns/forms/campaign-form.tsxsrc/features/loyalty/components/campaigns/forms/campaign-form.tsxUser Management
/dashboard/loyalty/usersUser Management
Per-user stamp progress, manual awards and resets.
src/app/dashboard/loyalty/users/page.tsxEntry
- Sidebar
- Dashboard quick actions
- Campaign View all
Exits
- View user → /users/[userId]
- Award stamps → dialog
- Reset progress → dialog
- View history
- Export data
States · 4
src/features/loyalty/components/views/user-management-view.tsxsrc/features/loyalty/components/views/user-management-view.tsx:505src/features/loyalty/components/views/user-management-view.tsxsrc/features/loyalty/components/views/user-management-view.tsx:859Award Bonus Stamps
AwardBonusStampsDialogAward Bonus Stamps
Award stamps to a user through the real collect-stamp path.
src/features/loyalty/components/views/user-management-view.tsxEntry
- Row menu Award stamps
Exits
- Award → toast with positions
- Cancel → closes
States · 4
src/features/loyalty/components/views/user-management-view.tsxsrc/features/loyalty/components/views/user-management-view.tsxpackages/backend/convex/gamificationLoyalty/mutations.ts:294src/features/loyalty/components/views/user-management-view.tsxAward stamps popover
TestStampAwardPopoverAward stamps popover
Quick award of 1 to 5 stamps for the selected campaign.
src/features/loyalty/components/views/test-stamp-award-popover.tsxEntry
- Row actions menu when a campaign is selected
Exits
- Award → toast
- Close
States · 2
src/features/loyalty/components/views/test-stamp-award-popover.tsx:205src/features/loyalty/components/views/test-stamp-award-popover.tsx:205Reset User Progress
ResetUserProgressDialogReset User Progress
Delete a user's stamp history for a campaign.
src/features/loyalty/components/views/user-management-view.tsxEntry
- Row menu Reset progress
Exits
- Reset → toast
- Cancel → closes
States · 3
src/features/loyalty/components/views/user-management-view.tsxpackages/backend/convex/gamificationLoyalty/mutations.ts:2080packages/backend/convex/gamificationLoyalty/mutations.ts:2080User loyalty profile
/dashboard/loyalty/users/[id]User loyalty profile
One user's loyalty profile with vouchers, history and campaigns.
src/app/dashboard/loyalty/users/[id]/page.tsxEntry
- Users table View
Exits
- Tabs → overview, vouchers, history, campaigns
- Copy voucher code
- Delete voucher → confirm
States · 4
src/app/dashboard/loyalty/users/[id]/user-detail-client.tsxsrc/app/dashboard/loyalty/users/[id]/user-detail-client.tsx:118src/app/dashboard/loyalty/users/[id]/user-detail-client.tsx:64src/app/dashboard/loyalty/users/[id]/user-detail-client.tsx:625Delete Voucher
Delete Voucher
Needs data: Needs a user holding a voucher
DeleteUserVoucherDialogDelete Voucher
Cancel a user's voucher and remove its code from Shopify.
src/app/dashboard/loyalty/users/[id]/user-detail-client.tsxEntry
- Voucher row Delete
Exits
- Delete → toast
- Cancel → closes
States · 4
packages/backend/convex/gamificationLoyalty/mutations.ts:1908packages/backend/convex/gamificationLoyalty/mutations.ts:1908src/app/dashboard/loyalty/users/[id]/user-detail-client.tsx:96src/app/dashboard/loyalty/users/[id]/user-detail-client.tsxAudit & Compliance
/dashboard/loyalty/auditAudit & Compliance
Stamp activity log and per-user summaries.
src/app/dashboard/loyalty/audit/page.tsxEntry
- Sidebar
- Dashboard Audit tab
Exits
- Export (admin) → Export dialog
- Filters → sheet
- Entry Details → row action
- User links
States · 5
src/features/loyalty/components/audit/audit-combined-view.tsxsrc/features/loyalty/components/audit/audit-combined-view.tsxsrc/features/loyalty/components/audit/audit-combined-view.tsxsrc/features/loyalty/components/audit/audit-combined-view.tsx:333src/features/loyalty/components/audit/audit-combined-view.tsxAudit filters
AuditFiltersSheetAudit filters
Filter by activity type, source, campaign and date range.
src/features/loyalty/components/audit/audit-filters.tsxEntry
- Filters button on audit
Exits
- Apply
- Clear
States · 1
src/features/loyalty/components/audit/audit-filters.tsxLegacy voucher templates
/dashboard/loyalty/voucher-templatesLegacy voucher templates
Four legacy routes redirect into /vouchers/templates.
src/app/dashboard/loyalty/voucher-templates/page.tsxEntry
- Old bookmarks
Exits
- Redirect → /vouchers/templates (and /new, /[id], /[id]/edit)
States · 1
src/lib/access-control.ts:326














