Overview
This release adds account-level sales rep assignment with two assignment sources (brand template and geo-search by ZIP), an audit trail for quote changes via quote_revisions, and a simplified quote form with inline auth for guests.
Sales Rep Assignment — Account-Level Persistence
Account Migration
Migration 20260220010840_account_sales_rep_assignment.sql adds columns to public.accounts for storing assigned sales rep data:
| Column | Purpose |
|---|---|
assigned_rep_id | Game One rep_id |
assigned_rep_name | Full name |
assigned_rep_email | |
assigned_rep_phone | Phone (optional) |
assigned_rep_headshot_url | Headshot image URL |
assigned_rep_source | 'brand_template' or 'geo_search' |
assigned_rep_at | Timestamp of assignment |
Server Actions
| Action | Purpose |
|---|---|
assignSalesRepFromTemplate | Persists rep from applied brand template to the user's personal account. Fire-and-forget on confirm. |
assignSalesRepByZip | Looks up nearest sales rep via Game One geo-search by US ZIP; assigns to account. For standalone sign-up callback. |
Game One API Client
game-one-api.ts exposes fetchNearestSalesRep(zip) — calls Game One /salesreps/geo-search with JWT auth. Returns the closest rep by distance, or null when none found.
Environment: GAMEONE_API_BASE_URL, GAMEONE_API_JWT_TOKEN
Integration Points
- Brand Template panel — calls
assignSalesRepFromTemplatewhen user confirms applying a brand - Quote Auth Gate — assigns rep when guest signs up with valid ZIP (geo-search preview) or brand template applied
Quote Revisions — Audit Trail
Migration
20260220120000_quote_revisions.sql creates public.quote_revisions:
| Column | Purpose |
|---|---|
change_type | status_change, customization_update, cancellation |
change_summary | JSONB field-level diffs |
previous_snapshot | Full customization JSONB (for design updates) |
Security-Definer RPCs
| Function | Purpose |
|---|---|
update_quote_status(uuid, text) | Validates access, records revision, updates quote status. Bypasses restrictive RLS. |
cancel_quote(uuid) | Validates state (no cancel of ordered), records cancellation revision. |
create_quote_revision(uuid, jsonb, jsonb) | Records customization updates on quote re-submit from builder. |
Quote Detail View
Status dropdown and Cancel button now use these RPCs. Revision history is displayed in the timeline.
Quote Form Refactor
QuoteFinalStep
New component with special instructions textarea and submit button. Shown directly for authenticated users.
Simplified Flow
- Guest → Auth gate (sign-in / sign-up with MFA and email OTP)
- Authenticated → Single final step (notes + submit)
The auth gate collects profile (name, ZIP, etc.) for guests and supports geo-search rep preview.
Submit Quote — Edit Mode
When editingQuoteId is provided:
- Fetches existing quote and computes
change_summary(colors, roster count, design, text, graphics) - Records revision via
create_quote_revisionRPC - Updates quote in-place; preserves
quote_number,status,submitted_at - Saves previous snapshot to
builder_shared_configsfor 3D diff view
Sign-Up Flow — ZIP for Geo-Assignment
- Password sign-up schema — ZIP code now mandatory (USA format, 5-digit validated via
zipcodes) - user_metadata —
zipstored for post-sign-up assignment hooks - assignSalesRepByZip — Server action ready for standalone sign-up callback when session is established
Database Summary
| Migration | Description |
|---|---|
20260220010840_account_sales_rep_assignment | Sales rep columns on accounts |
20260220120000_quote_revisions | quote_revisions table, RPCs for status/cancel/revision |