Move billing flows to web dashboard#956
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughReplaces in-app billing navigation and UI with an external dashboard flow: a new Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant UI as App Component
participant Utils as openUrl helper
participant Browser as External Dashboard
rect rgba(200,200,255,0.5)
User->>UI: Click billing CTA
UI->>Utils: openUrl(BILLING_DASHBOARD_URL)
Utils->>Browser: Open external URL
Browser-->>User: Dashboard opens
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/src/pages/Conversations.tsx (1)
1295-1297: Optional: extract a sharedopenBillingDashboardhandler.The same click body is duplicated across billing CTAs, which makes future telemetry/error-handling tweaks easier to miss.
♻️ Suggested cleanup
+ const openBillingDashboard = () => { + void openUrl(BILLING_DASHBOARD_URL); + }; ... - onCtaClick={() => { - void openUrl(BILLING_DASHBOARD_URL); - }} + onCtaClick={openBillingDashboard} ... - onClick={() => { - void openUrl(BILLING_DASHBOARD_URL); - }} + onClick={openBillingDashboard}Also applies to: 1328-1330
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/src/pages/Conversations.tsx` around lines 1295 - 1297, Duplicate inline handlers calling openUrl(BILLING_DASHBOARD_URL) should be extracted into a single named handler (e.g., openBillingDashboard) so telemetry, error handling, or URL changes are centralized; create a function openBillingDashboard that calls openUrl(BILLING_DASHBOARD_URL) (and wraps try/catch/telemetry as needed), then replace the inline onCtaClick={() => { void openUrl(BILLING_DASHBOARD_URL); }} usages with onCtaClick={openBillingDashboard} (apply to the occurrences currently using openUrl(BILLING_DASHBOARD_URL), including the handler used for billing CTAs referenced in this diff and the other occurrence you noted).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/src/utils/desktopDeepLinkListener.ts`:
- Around line 106-107: The current flow awaits openUrl(BILLING_DASHBOARD_URL) so
if that promise rejects the subsequent navigation (window.location.hash =
'/home') is skipped; modify the handler in desktopDeepLinkListener so
post-payment navigation is unconditional: either call openUrl without awaiting
it or wrap the await openUrl(...) in a try/catch and always execute
window.location.hash = '/home' in a finally (or after the try/catch). Ensure you
update both places where openUrl(...) and window.location.hash are used (the
checkout/confirm and cancel handlers) so failures opening the external URL
cannot block client-side navigation.
---
Nitpick comments:
In `@app/src/pages/Conversations.tsx`:
- Around line 1295-1297: Duplicate inline handlers calling
openUrl(BILLING_DASHBOARD_URL) should be extracted into a single named handler
(e.g., openBillingDashboard) so telemetry, error handling, or URL changes are
centralized; create a function openBillingDashboard that calls
openUrl(BILLING_DASHBOARD_URL) (and wraps try/catch/telemetry as needed), then
replace the inline onCtaClick={() => { void openUrl(BILLING_DASHBOARD_URL); }}
usages with onCtaClick={openBillingDashboard} (apply to the occurrences
currently using openUrl(BILLING_DASHBOARD_URL), including the handler used for
billing CTAs referenced in this diff and the other occurrence you noted).
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 7baa10f1-95b2-4c67-992d-49bee8090fe0
📒 Files selected for processing (10)
app/src/components/OpenhumanLinkModal.tsxapp/src/components/chat/TokenUsagePill.tsxapp/src/components/home/HomeBanners.tsxapp/src/components/settings/SettingsHome.tsxapp/src/components/settings/panels/BillingPanel.tsxapp/src/components/upsell/GlobalUpsellBanner.tsxapp/src/components/upsell/UsageLimitModal.tsxapp/src/pages/Conversations.tsxapp/src/utils/desktopDeepLinkListener.tsapp/src/utils/links.ts
💤 Files with no reviewable changes (1)
- app/src/components/settings/SettingsHome.tsx
| await openUrl(BILLING_DASHBOARD_URL); | ||
| window.location.hash = '/home'; |
There was a problem hiding this comment.
Don’t gate post-payment navigation on external URL open success.
At Line 106 and Line 111, a failure from openUrl(...) can prevent window.location.hash = '/home', leaving users stuck in an unintended state after checkout/cancel handling.
🛠️ Suggested fix
+const openBillingDashboardAndReturnHome = async () => {
+ try {
+ await openUrl(BILLING_DASHBOARD_URL);
+ } catch (error) {
+ console.warn('[DeepLink] Could not open billing dashboard', error);
+ } finally {
+ window.location.hash = '/home';
+ }
+};
...
- await openUrl(BILLING_DASHBOARD_URL);
- window.location.hash = '/home';
+ await openBillingDashboardAndReturnHome();
...
- await openUrl(BILLING_DASHBOARD_URL);
- window.location.hash = '/home';
+ await openBillingDashboardAndReturnHome();Also applies to: 111-112
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@app/src/utils/desktopDeepLinkListener.ts` around lines 106 - 107, The current
flow awaits openUrl(BILLING_DASHBOARD_URL) so if that promise rejects the
subsequent navigation (window.location.hash = '/home') is skipped; modify the
handler in desktopDeepLinkListener so post-payment navigation is unconditional:
either call openUrl without awaiting it or wrap the await openUrl(...) in a
try/catch and always execute window.location.hash = '/home' in a finally (or
after the try/catch). Ensure you update both places where openUrl(...) and
window.location.hash are used (the checkout/confirm and cancel handlers) so
failures opening the external URL cannot block client-side navigation.
Summary
https://tinyhumans.ai/dashboardinstead of the in-app billing settings page/settings/billinglinks still land safelyapp/src/utils/links.tsProblem
/settings/billingstill needed a safe fallback instead of a dead-end or broken panel.Solution
openUrl(BILLING_DASHBOARD_URL)across the usage pill, upsell surfaces, conversation limit banners, and deep-link payment completion handling.BillingPanelinto a redirect-oriented fallback view that auto-opens the dashboard and provides a manual retry button if the browser does not open./settings/billingroute in place as a compatibility shim rather than removing the route entirely.Submission Checklist
app/) and/orcargo test(core) for logic you add or changeapp/test/e2e, mock backend,tests/json_rpc_e2e.rsas appropriate)//////!(Rust), JSDoc or brief file/module headers (TS) on public APIs and non-obvious modules(Any feature related checklist can go in here)
Impact
Related
Summary by CodeRabbit
New Features
Refactor