feat: Add returnUrl parameter to Customer Portal session#66
feat: Add returnUrl parameter to Customer Portal session#66empz wants to merge 1 commit intoget-convex:mainfrom
Conversation
📝 WalkthroughWalkthroughUpdates add an optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/client/index.ts (1)
188-210:⚠️ Potential issue | 🟡 MinorThe
returnUrlparameter is correctly supported by Polar SDK'scustomerSessionsCreate.The implementation properly forwards the optional
returnUrlto the Polar SDK, which accepts it as an optional absolute URI (1–2083 characters). The portal will display a "Back" button when provided, returning the customer to that URL.Minor style improvement:
returnUrl?: string | undefinedis redundant—the?already indicates the property can be undefined, so usereturnUrl?: stringinstead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/client/index.ts` around lines 188 - 210, The createCustomerPortalSession method currently types the parameter as `{ userId: string, returnUrl?: string | undefined }`; remove the redundant `| undefined` by changing the param type to `{ userId: string, returnUrl?: string }` in the createCustomerPortalSession signature to keep the optional typing concise (update the function declaration that accepts `userId` and `returnUrl`).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/client/index.ts`:
- Around line 188-210: The createCustomerPortalSession method currently types
the parameter as `{ userId: string, returnUrl?: string | undefined }`; remove
the redundant `| undefined` by changing the param type to `{ userId: string,
returnUrl?: string }` in the createCustomerPortalSession signature to keep the
optional typing concise (update the function declaration that accepts `userId`
and `returnUrl`).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: e0dfbf27-e346-4db7-88dd-b1e1fb119cd4
📒 Files selected for processing (3)
src/client/index.tssrc/react/index.tsxtsconfig.json
Summary
allowing callers to specify where Polar should redirect the customer after they leave the portal.
window.location.hrefso users are returned to the page they came from.
Changes
createCustomerPortalSessionand thegenerateCustomerPortalUrlaction handler.returnUrlprop toCustomerPortalLink, default to current page URL.process.env.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Summary by CodeRabbit
returnUrlparameter in the customer portal flow, allowing users to specify a custom redirect destination after accessing the portal.