Store onramp user country selection#115
Merged
ishantiw merged 9 commits intoDec 11, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds cookie persistence for user country/region selection in the onramp flow, allowing users' country preferences to be remembered across sessions. The implementation uses the react-cookie library and introduces shared cookie configuration.
- Added
react-cookiedependency and created centralized cookie configuration - Wrapped
AccountDialogwithCookiesProviderto enable cookie access - Updated country selection logic to read from and write to
panna_user_countrycookie
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Added react-cookie@8.0.1 dependency and its type definitions |
| packages/panna-sdk/package.json | Added react-cookie to package dependencies |
| packages/panna-sdk/src/react/consts/cookies.ts | Created shared cookie configuration with secure defaults |
| packages/panna-sdk/src/react/components/buy/select-buy-region-step.tsx | Integrated cookie storage for country selection with priority logic |
| packages/panna-sdk/src/react/components/buy/select-buy-region-step.test.tsx | Added unit tests for cookie helper logic |
| packages/panna-sdk/src/react/components/auth/connect-button.tsx | Wrapped AccountDialog with CookiesProvider for cookie access |
| packages/panna-sdk/src/core/auth/siwe-auth.ts | Refactored to use shared cookie configuration |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
matjazv
reviewed
Dec 8, 2025
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ishantiw
approved these changes
Dec 10, 2025
matjazv
approved these changes
Dec 11, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the onramp flow by persisting the user's country/region selection in a cookie. When users return to the buy flow, their previously selected country is automatically restored, improving user experience.
Rationale
Users who frequently use the onramp feature shouldn't need to re-select their country each time they initiate a purchase. By storing the selection in a cookie, we provide a smoother, more personalized experience that remembers user preferences across sessions.
Changes
react-cookiedependency and created shared cookie configuration (defaultCookieOptions)AccountDialogwithCookiesProviderinConnectButtoncomponentSelectBuyRegionStepto:panna_user_countrycookie on mount (prioritized over browser detection)siwe-auth.tsto use shared cookie optionsImpact
Testing
select-buy-region-step.test.tsxshouldSetCookie: determining when to set/update cookiegetInitialCountry: priority order for initial country selectionScreenshots/Video
N/A - Cookie storage is not visible in UI, but behavior can be verified by:
Checklist
Code follows the project's coding standards
Unit tests covering the new feature have been added
All existing tests pass
The documentation has been updated to reflect the new feature
Additional Notes
Cookie name:
panna_user_countryCookie options:
{ path: '/', secure: true, sameSite: 'strict' }