feat(rewards): geo-restriction guard for campaign opt-in and RWA tokens [RWDS-1077]#27676
Conversation
…okens - Extract ONDO_RESTRICTED_COUNTRIES into shared util (ondoGeoRestrictions.ts) so the list is a single source of truth used by both the RWA token hook and the campaign opt-in sheet - Add selectGeolocationStatus selector to read the GeolocationController status slice (idle / loading / complete) - Block opt-in CTA with "Checking region…" text while geo is still loading (idle or loading status) to avoid a flash of the restriction banner - Show a "Not available in your region" info banner and disable the CTA for users in restricted countries on ONDO_HOLDING campaigns - Add unit tests for ondoGeoRestrictions, geolocationController selectors, and geo-loading / geo-restriction paths in CampaignOptInSheet RWDS-1077 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
…onController selector tests Replace recursive DeepPartial<RootState> return type with an explicit shallow object type to prevent TypeScript from hitting its type instantiation depth limit (TS2589) on the large RootState tree. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…check Mirrors the __DEV__ bypass already present in useRwaTokens. In dev builds geo-restriction is always disabled so developers can test the opt-in flow without needing to use a VPN or mock geolocation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
E2E Test Impact:
Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #27676 +/- ##
========================================
Coverage 82.34% 82.35%
========================================
Files 4787 4795 +8
Lines 123646 123774 +128
Branches 27511 27549 +38
========================================
+ Hits 101822 101932 +110
- Misses 14779 14785 +6
- Partials 7045 7057 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|




Summary
ONDO_RESTRICTED_COUNTRIESfromuseRwaTokensintoapp/util/ondoGeoRestrictions.ts— a single source of truth consumed by both the RWA token hook and the campaign opt-in sheet.selectGeolocationStatusto thegeolocationControllerselector module so components can observe theidle / loading / completelifecycle.CampaignOptInSheetnow reads geolocation and blocks the opt-in CTA while geo is still resolving (shows "Checking region…"), then shows an info banner and disables the CTA once the user is confirmed to be in a restricted country.ONDO_RESTRICTED_COUNTRIES, the new selector, and all geo-loading / geo-restriction paths inCampaignOptInSheet.Changelog
CHANGELOG entry: Added geo-restriction guard to campaign opt-in sheet, disabling opt-in for users in restricted regions
Related issues
Fixes:
UI — geo-restriction banner
Manual testing steps
US) → banner shown, CTA disabledAU) → no banner, CTA enabledyarn jest ondoGeoRestrictions geolocationController/index CampaignOptInSheetScreenshots/Recordings
Before
After
See UI — geo-restriction banner section above.
Pre-merge author checklist
Pre-merge reviewer checklist
🤖 Generated with Claude Code
Note
Medium Risk
Adds gating logic that can disable campaign opt-in based on geolocation state/country, which directly affects user eligibility and conversion. Risk is mitigated by DEV bypass and expanded unit test coverage for loading/restricted/allowed scenarios.
Overview
Adds a geo-restriction guard to
CampaignOptInSheet: the CTA now shows Checking region… and is disabled while geolocation isidle/loading, and shows aRewardsInfoBanner+ disables opt-in when the user is in a restricted region (includingONDO_HOLDINGusing the shared Ondo restricted list, with__DEV__bypass).Extracts
ONDO_RESTRICTED_COUNTRIESintoapp/util/ondoGeoRestrictions.ts(consumed by bothuseRwaTokensand campaign opt-in), addsselectGeolocationStatus, and updates translations/tests to cover the new selector, shared list, and geo-loading/restriction behaviors.Written by Cursor Bugbot for commit 3c269bd. This will update automatically on new commits. Configure here.