feat(support): surface live verification state to Crisp agents - #2487
feat(support): surface live verification state to Crisp agents#2487innolope-dev wants to merge 2 commits into
Conversation
Support agents had no visibility into where a user was stuck in verification, so they resorted to guessing. Derive a support-facing snapshot from the capability + identity read-models already on the /get-user response and push it into Crisp session:data (agent sidebar): identity status, email-on-file, per-operation gate kinds, the stuck rail's failure reason + technical details, and pending next-actions. Threaded through all Crisp sinks (web widget, proxy iframe, native Capacitor). The user's own message is never modified. Closes #2360
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (7)
📝 WalkthroughWalkthroughThe PR derives live verification context, propagates it through Crisp user data and proxy URLs, and sends it to web and native Crisp support sessions. ChangesCrisp verification context
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant useCrispUserData
participant useCrispProxyUrl
participant Crisp
useCrispUserData->>useCrispProxyUrl: derived verification fields
useCrispProxyUrl->>Crisp: session_data metadata
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: dependency version conflict. Check your lock file or package.json. Comment |
Code-analysis diffPainscore total: 6247.08 → 6256.4 (+9.32) 🆕 New findings (22)
…and 2 more. ✅ Resolved (19)
📈 Painscore deltas (top movers)
|
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/Global/SupportDrawer/index.tsx`:
- Around line 84-99: Update the CapacitorCrisp metadata handling in the support
drawer so verification_gates, failure_reason, and pending_actions are always
written, using an empty string when their corresponding userData values are
absent. Preserve the existing values when present and align this native behavior
with the web/proxy paths.
In `@src/utils/support-verification.ts`:
- Around line 41-42: Update the gate summary construction around
SUMMARY_OPERATIONS, deriveGate, and gates to include the rail selected by the
same gate-resolution ordering alongside each operation and kind. Preserve
existing formatting for other fields, ensure pending and waiting-on-provider
gates expose the selected rail even without a failureReason, and add coverage
for this stuck-gate state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5b8f84b8-8bb1-4adc-a88a-1653f31c537d
📒 Files selected for processing (7)
src/app/crisp-proxy/page.tsxsrc/components/Global/SupportDrawer/index.tsxsrc/hooks/useCrispProxyUrl.tssrc/hooks/useCrispUserData.tssrc/utils/__tests__/support-verification.test.tssrc/utils/crisp.tssrc/utils/support-verification.ts
…tive fields Address CodeRabbit review on #2487: - add verification_rails (each non-enabled rail as id:status(code)) so agents can identify WHICH rail is stuck even for pending/waiting gates, where there is no failure reason to fall back on. - native Capacitor path now always writes the verification fields (empty string when absent), matching the web/proxy sinks so a prior user's values can't linger on the device-local Crisp session.
kushagrasarathe
left a comment
There was a problem hiding this comment.
Reviewed — SAFE. Approving.
No raw PII crosses to Crisp — the payload is status enums, gate tokens, backend-controlled failure/reason strings, and a yes/no email_on_file boolean (not the address itself). The surfaced set is minimized and gated. Gives support the verification state they need without leaking user data.
No blocking issues.
|
@innolope-dev some merge conflicts |
Problem
Support agents have no visibility into a user's live verification state. In a recent case, three agents took turns guessing what state a user was in because none of it reaches Crisp — today we only send username, email, wallet, Bridge and PostHog links, nothing about where the user is stuck.
Closes #2360.
What this does
Adds a support-facing verification snapshot to the Crisp agent sidebar (
session:data). Everything is derived from the two backend read-models already on the/get-userresponse (capabilities,identityVerification) — no backend change, no new provider-state interpretation on the client. New fields visible to agents:identity_statusidentityVerification.statusemail_on_fileverification_gatesderiveGate, e.g.pay:ready deposit:provide-email withdraw:blocked-rejectionfailure_reasonreason.code+ technicaldetailspending_actionscapabilities.nextActionsaskind(purpose)It's threaded through all three Crisp sinks: web widget (
setCrispUserData), proxy iframe (useCrispProxyUrl→crisp-proxy), and native Capacitor (SupportDrawer).Design notes
message:textpopulates the user-visible composer, which would expose internal codes/rail-ids to the user. Dropped in favour of the agent-only sidebar, which already carries the full state.buildSupportVerificationSummary()(reusesderiveGate/railVerdict— no duplicated state-machine logic).Out of scope (filed separately)
mantecaUserId"while here" needs the backend to expose a provider-account id first (the capability model is deliberately provider-blind) — can't be done FE-only.Testing
support-verification.test.ts(5 cases: gates, stuck-rail failure reason, pending actions, graceful degrade, identity status).tsc --noEmitclean, existingSupportDrawersuite green, prettier clean.Summary by CodeRabbit