feat(kyc): show a region screen instead of a support dead end - #2778
feat(kyc): show a region screen instead of a support dead end#2778innolope-dev wants to merge 3 commits into
Conversation
A user whose ID was rejected for its jurisdiction hits one of four endings today, and none of them is honest. Two offer a retry that can never pass (the drawer's "Retry verification"; the identity-verification page's "Let's try that again"), and two route to support over a block support cannot lift (the home card; the bank gates' "We couldn't unlock this"). Replace all four with one screen that explains the block, names no country, offers no retry, offers no support link, and hands the user the part of the app that still works. The CTA is the design decision. With retry and support both gone, the button's only remaining job is to point at a capability the user keeps — so it routes to send/request rather than dismissing. That is also the promise the copy makes, so peer-to-peer must stay open for this cohort; this change does not gate anything, but it does depend on that. Enforced at the choke point, not per call site. Six gates open InitiateKycModal, and each computes its variant from a rail gate that cannot see WHY identity failed — a region-restricted user reads as `needs-identity` and would be offered "Unlock now" straight back into the Sumsub SDK. Short-circuiting inside the shared component makes that impossible for a future call site to miss. Also marks the two region reject labels terminal, so no surviving surface can contradict the new screen with a retry button. That fixes a pre-existing bug beyond this cohort: UnlockedRegions hardcodes isTerminalRejection's three inputs to null (a documented casualty of the capabilities migration), so EVERY terminal rejection — fraud, sanctions, age — currently renders "Let's try that again" there. Copy names no country in any of the four locales, so a change to the Sumsub list needs no re-translation and no deploy. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EEmE861AXBaoE1y31ChW6e
The InitiateKycModal short-circuit re-implemented KycRegionRestrictedModal inline — same title, icon, content and CTA, ~30 lines of it. Call the component instead. Duplication was the point, not the line count: the whole change rests on every surface telling a region-restricted user the same thing, and two independent definitions of that screen are two things that can drift. Now there is one. Caught by the code-analysis bot flagging InitiateKycModal's MDD jump (41.5 → 55.5) on the first push. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EEmE861AXBaoE1y31ChW6e
Every terminal rejection — fraud, sanctions, age, forgery — currently
shows "Let's try that again" on /profile/identity-verification, and a
"Retry verification" button in the identity drawer. Neither can pass.
Root cause: UnlockedRegions hardcoded all three of isTerminalRejection's
inputs to null/undefined during the capabilities migration, because the
capability model carries no per-verification Sumsub history. The check
therefore always returned "retryable" and the terminal branch never
rendered. The drawer never had a terminal branch at all.
The history was never the right source. The backend already folds the
decision (Sumsub RETRY → ACTION_REQUIRED, FINAL → REJECTED) and now says
outright whether a retry is worth offering, so read that instead of
reconstructing it from raw labels and attempt counts.
These get a DIFFERENT ending from region-restricted, deliberately:
region-restricted explain fully, no support link — support cannot
lift a jurisdictional block
terminal explain nothing, offer support — naming fraud or
sanctions carries compliance exposure and tips off
the people it describes, and a human CAN review a
misclassification
Both are terminal, so neither offers a retry.
Also guards the home card banner on isRegionRestricted: that branch
returns before reading `step`, so the region card was silently replaced
by a CTA routing to /shhhhh.
KycFailed takes onContactSupport as a prop rather than reading
ModalsContext, keeping it presentational like its siblings — reading the
context directly broke an unrelated suite that renders it bare.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EEmE861AXBaoE1y31ChW6e
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Code-analysis diffPainscore total: 7313.46 → 7336.49 (+23.03) 🆕 New findings (50)
…and 30 more. ✅ Resolved (40)
…and 20 more. 📈 Painscore deltas (top movers)
|
🧪 UI test report — ✅ all greenSuites
📊 Coverage (unit)
⏱ 10 slowest test cases
|
The regions rework: regions survive as presentational groups, but every
row is a concrete product with a live status chip, and the unlock verb
attaches to products ("SEPA transfers · Unlock"), never to abstract
regions.
- Everywhere group leads: Peanut-to-Peanut payments (Always on) and the
Peanut card as its own row routing to /card. The card is a global
product gated by residence eligibility, not a regional rail — which
removes the old screen's Europe-tap → /card hijack by construction
(a bank-method tap can only start bank KYC; pinned by test).
- Region groups follow the rail's real geography: Brazil (PIX & bank
transfers), Argentina (QR & transfers), United States (ACH & Wire),
Mexico (SPEI), Europe (SEPA). LATAM never appears — it stays what it
is, an internal KYC-level bucket. Rest-of-world's provider-less dead
end is gone; the Everywhere group carries that meaning honestly.
- Merged rows split automatically when statuses diverge: a Bridge-only
user sees "PIX QR payments · Active" + "Bank transfers · Unlock".
- Residence anchor row (declared/verified from the new /users/me
residence block) explains why the list looks the way it does, and
the user's own region floats to the top under Everywhere.
- Residence restrictions render as quiet honesty: restricted rows say
Not available and stop being tappable; the always-on row survives.
- All KYC modal machinery (unlock/processing/action-required/rejected/
provider-rejection, multi-phase flow) is carried over unchanged from
UnlockedRegions.view, which stays in place untouched to avoid
conflicting with PR #2778.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GxUXJzMPSyKow6xpEYH8MA
|
Closing: all three commits from this PR are merged unchanged into #2790, the joint onboarding PR targeting Generated by Claude Code |
Same branch as #2775, targeting
devinstead ofmain. Merge one, close the other — they are the identical three commits.Backend: peanutprotocol/peanut-api-ts#1381.
What this does
A user whose ID is rejected for its jurisdiction currently hits one of four endings, none of them honest:
/profile/identity-verificationAll four are replaced by one screen: explains the block, names no country, offers no retry, offers no support link, and hands the user the part of the app that still works.
Two different endings, deliberately
The third commit fixes a separate pre-existing bug found while building this, and the two cases are deliberately handled differently:
The pre-existing bug:
UnlockedRegions.view.tsxhardcoded all three ofisTerminalRejection's inputs tonull/undefinedduring the capabilities migration, so the check always returned "retryable". Every terminal rejection — fraud, sanctions, age — has been showing "Let's try that again" on that page. The drawer never had a terminal branch at all. Both now read the backend's verdict instead of reconstructing it from raw labels and attempt counts.Enforced at the choke point
Six gates open
InitiateKycModal, each computing its variant from a rail gate that cannot see why identity failed — a region-restricted user reads asneeds-identityand would be offered "Unlock now" straight back into the Sumsub SDK. The short-circuit lives inside the shared component, so a future call site cannot miss it. Tested against all five variants.Deploy-order safety
isRegionRestrictedrequiresidentityVerification.reason, which only the backend PR emits. If this ships first, the region screen simply never renders — every region path stays exactly as it is today. Nothing breaks.The terminal fix is different and does take effect immediately, by design:
isTerminalFailuretreats a missingcanRetryas terminal (fail-closed), on the grounds that offering a retry which cannot pass is worse than a support link that wasn't strictly needed. So the fraud/sanctions retry loop is fixed on FE deploy regardless of backend timing. The only cost in that window is the smallreviewAnswer: ERRORcohort losing their (legitimate) retry until the backend ships. Say the word if you'd rather default the other way — it's one operator inuseIdentityVerification.Verification
describe.each, so drawer and modal can't drift), 8 on the hook, 3 on the home card.src/components,src/hooks,src/utils,src/i18n: 2835 passed. One pre-existing failure inInvites/badge-campaign-context.test.ts— fails identically onmain, and passes in CI.mainPR: 3404 unit tests, 0 failed; typecheck, eslint, format, e2e all green.Review focus
/sendthe right destination, or would/homebe safer for a cohort likely holding no balance?canRetrydefault described above.Generated by Claude Code