[v5] chore(web): Ask upsell gating#1224
Conversation
WalkthroughThis PR expands the ChangesEntitlements and Identity Provider System
Sidebar Entitlement Gating and Upgrade UI
License Checkout Return and Activation Flow
Chat Submission Login and Upgrade Gating
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 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 docstrings
🧪 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 |
|
@brendan-kellam your pull request is missing a changelog! |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
packages/web/src/features/chat/useCreateNewChatThread.ts (1)
27-30: ⚡ Quick winAdd braces around the
storedguard.Line 29 violates the repo rule requiring braces on every
if, so this will keep failing style expectations in follow-up changes.As per coding guidelines, "Always use curly braces for `if` statements, with the body on a new line — even for single-line bodies."Proposed fix
try { const stored = window.localStorage.getItem(SELECTED_SEARCH_SCOPES_LOCAL_STORAGE_KEY); - if (stored) storedScopes = JSON.parse(stored) as SearchScope[]; + if (stored) { + storedScopes = JSON.parse(stored) as SearchScope[]; + } } catch { /* fall through to [] */ }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/web/src/features/chat/useCreateNewChatThread.ts` around lines 27 - 30, The guard "if (stored)" in useCreateNewChatThread.ts lacks braces; update the block around retrieving parsed scopes (SELECTED_SEARCH_SCOPES_LOCAL_STORAGE_KEY, stored, storedScopes) to use explicit curly braces with the body on a new line per style rules — i.e., wrap the JSON.parse assignment inside a braced if block so the code becomes an if (stored) { storedScopes = JSON.parse(stored) as SearchScope[]; } within the try block.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/web/src/app/`(app)/askgh/[owner]/[repo]/components/landingPage.tsx:
- Around line 79-80: The component currently hardcodes isLoginWallEnabled={true}
in landingPage.tsx which forces the login wall; change the call site to receive
and pass a runtime/config value instead: add or use an existing boolean (e.g.,
isLoginWallEnabled or featureFlags.isLoginWallEnabled) from the route props,
page loader, or config and pass that variable into the component instead of the
literal true so rollout/feature-flag control works (locate the prop usage of
isLoginWallEnabled in landingPage.tsx and the parent that renders it and thread
the boolean through).
In `@packages/web/src/app/`(app)/chat/[id]/page.tsx:
- Line 163: The isLoginWallEnabled prop is being set with a string comparison
that always fails because env.EXPERIMENT_ASK_GH_ENABLED is already a boolean;
update the assignment in the ChatThreadPanel instantiation so it passes the
boolean directly (use env.EXPERIMENT_ASK_GH_ENABLED or
Boolean(env.EXPERIMENT_ASK_GH_ENABLED)) instead of comparing to the string
'true' to ensure ChatThreadPanel receives true when the flag is enabled.
In `@packages/web/src/app/`(app)/chat/chatLandingPage.tsx:
- Line 72: The landing page currently sets isLoginWallEnabled using a string
comparison which prevents the boolean feature flag from working; update the prop
assignment in chatLandingPage.tsx to pass the boolean experiment flag directly
(use env.EXPERIMENT_ASK_GH_ENABLED) instead of comparing it to the string 'true'
so that isLoginWallEnabled receives the actual boolean value.
In `@packages/web/src/ee/features/lighthouse/checkoutReturnHandler.tsx`:
- Around line 15-23: The handler currently shows LicenseActivactionDialog
whenever a session_id query param exists; restrict it to only run for Stripe
success redirects by checking both searchParams.get("session_id") and
searchParams.get("checkout") === "success" before returning the dialog. Update
the logic in the component that calls useSearchParams (referencing searchParams
and sessionId) to require the checkout="success" value, and only then render
<LicenseActivactionDialog userEmail={userEmail} />; otherwise return null.
In `@packages/web/src/ee/features/lighthouse/upsellDialog.tsx`:
- Around line 219-226: The Switch control rendering in upsellDialog.tsx (the
Switch using checked={billingInterval === "year"} and onCheckedChange={(checked)
=> setBillingInterval(checked ? "year" : "month")}) lacks an accessible label;
update the Switch to include an accessible name by either adding an aria-label
(e.g., aria-label="Billing interval") or linking it to the visible text via
aria-labelledby (create an id for the <span> "Annual billing" and set
aria-labelledby on the Switch) so screen readers announce the control; ensure
the chosen approach is applied to the Switch instance and preserves the existing
checked/onCheckedChange behavior.
In `@packages/web/src/ee/features/lighthouse/useClaimActivationCode.ts`:
- Around line 35-39: The shared cancelledRef allows older polling loops to
continue after a new start() is invoked; change the cancellation to be
run-scoped by introducing a per-run token (e.g., a currentRunId or an
AbortController instance) stored in a ref (like currentRunRef) and have start()
create a new token and assign it before launching the poll loop; inside the loop
check the token specific to that run (compare runId or token.signal.aborted) so
only the matching run can be cancelled, and update cancel() to abort/mark only
the currentRunRef token rather than toggling a global cancelledRef; update any
references in useClaimActivationCode.ts (cancelledRef, cancel, start) to use the
new run-scoped token.
In `@packages/web/src/features/chat/components/chatBox/chatBox.tsx`:
- Around line 188-203: The pending chat payload saved under
PENDING_CHAT_SUBMISSION_SESSION_STORAGE_KEY currently only stores pathname and
editor.children, so restored drafts lose the user's selectedSearchScopes and run
against the wrong context after login/upgrade; update the save calls (the two
blocks that set sessionStorage) to include the draft scopes (e.g.,
selectedSearchScopes or however scopes are represented) alongside pathname and
children, then update the submit flow so _onSubmit (and callers in ChatThread
and LandingPageChatBox) accepts and honors restored scopes instead of falling
back to current state—ensure ChatThreadPanel rehydrates scopes from the pending
payload and that the restored scopes are threaded through the submit contract to
replay the original intent exactly.
---
Nitpick comments:
In `@packages/web/src/features/chat/useCreateNewChatThread.ts`:
- Around line 27-30: The guard "if (stored)" in useCreateNewChatThread.ts lacks
braces; update the block around retrieving parsed scopes
(SELECTED_SEARCH_SCOPES_LOCAL_STORAGE_KEY, stored, storedScopes) to use explicit
curly braces with the body on a new line per style rules — i.e., wrap the
JSON.parse assignment inside a braced if block so the code becomes an if
(stored) { storedScopes = JSON.parse(stored) as SearchScope[]; } within the try
block.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 36781576-5fab-4be5-944b-bade818ec8dc
📒 Files selected for processing (39)
packages/shared/src/entitlements.tspackages/web/src/app/(app)/@sidebar/components/defaultSidebar/nav.tsxpackages/web/src/app/(app)/@sidebar/components/settingsSidebar/nav.tsxpackages/web/src/app/(app)/@sidebar/components/sidebarBase.tsxpackages/web/src/app/(app)/@sidebar/components/upgradeBadge.tsxpackages/web/src/app/(app)/@sidebar/components/upgradeButton.tsxpackages/web/src/app/(app)/@sidebar/components/upsellDialog.tsxpackages/web/src/app/(app)/askgh/[owner]/[repo]/components/landingPage.tsxpackages/web/src/app/(app)/chat/[id]/components/chatThreadPanel.tsxpackages/web/src/app/(app)/chat/[id]/page.tsxpackages/web/src/app/(app)/chat/chatLandingPage.tsxpackages/web/src/app/(app)/chat/components/landingPageChatBox.tsxpackages/web/src/app/(app)/layout.tsxpackages/web/src/app/(app)/settings/layout.tsxpackages/web/src/app/(app)/settings/license/checkoutSuccessModal.tsxpackages/web/src/app/(app)/settings/license/page.tsxpackages/web/src/app/components/authMethodSelector.tsxpackages/web/src/app/invite/page.tsxpackages/web/src/app/layout.tsxpackages/web/src/app/login/components/loginForm.tsxpackages/web/src/app/login/page.tsxpackages/web/src/app/onboard/page.tsxpackages/web/src/app/signup/page.tsxpackages/web/src/ee/features/lighthouse/actions.tspackages/web/src/ee/features/lighthouse/checkoutReturnHandler.tsxpackages/web/src/ee/features/lighthouse/client.tspackages/web/src/ee/features/lighthouse/licenseActivactionDialog.tsxpackages/web/src/ee/features/lighthouse/types.tspackages/web/src/ee/features/lighthouse/upsellDialog.tsxpackages/web/src/ee/features/lighthouse/useClaimActivationCode.tspackages/web/src/features/auth/identityProvidersProvider.tsxpackages/web/src/features/auth/useIdentityProviders.tspackages/web/src/features/chat/actions.tspackages/web/src/features/chat/components/chatBox/chatBox.tsxpackages/web/src/features/chat/components/chatBox/loginDialog.tsxpackages/web/src/features/chat/components/chatThread/chatThread.tsxpackages/web/src/features/chat/constants.tspackages/web/src/features/chat/useCreateNewChatThread.tspackages/web/src/features/entitlements/useEntitlements.ts
💤 Files with no reviewable changes (6)
- packages/web/src/app/(app)/settings/license/checkoutSuccessModal.tsx
- packages/web/src/app/login/page.tsx
- packages/web/src/app/(app)/@sidebar/components/upsellDialog.tsx
- packages/web/src/app/signup/page.tsx
- packages/web/src/features/chat/actions.ts
- packages/web/src/app/onboard/page.tsx
Summary by CodeRabbit
Release Notes
New Features
Improvements