Skip to content

Launch web search feature for Pro+ users#300

Closed
AnthonyRonning wants to merge 3 commits intomasterfrom
launch-web-search-feature
Closed

Launch web search feature for Pro+ users#300
AnthonyRonning wants to merge 3 commits intomasterfrom
launch-web-search-feature

Conversation

@AnthonyRonning
Copy link
Contributor

@AnthonyRonning AnthonyRonning commented Nov 6, 2025

Changes

This PR launches the web search feature that has been tested via easter egg, making it available to all Pro+ users with a proper upsell flow for free/starter users.

What Changed

  • Made web search toggle visible to all users - Globe icon now permanently displayed
  • 🎨 Repositioned Globe icon - Now to the left of the '+' attachment button for better UX
  • 🔒 Added billing gate - Only Pro/Max/Team users can use web search
  • 💎 Custom upsell dialog - Free/starter users see upgrade prompt with feature benefits:
    • Live web search powered by Brave
    • Real-time information from the internet
    • Privacy messaging: queries sent to Brave but not linked to user identity
    • Results processed privately and securely
  • 🥚 Preserved easter egg - 7-tap logo handler remains for future features (just logs to console now)

Files Modified

  • frontend/src/components/UnifiedChat.tsx - Globe icon visibility, billing check, easter egg preservation
  • frontend/src/components/UpgradePromptDialog.tsx - Added websearch feature with custom messaging

Testing

  • ✅ Formatting and linting passed
  • ✅ Pre-commit hooks passed
  • ✅ Build successful

The feature has been thoroughly tested via the easter egg flow and is ready for launch! 🚀

Summary by CodeRabbit

  • New Features

    • Live Web Search added as a Pro feature with integrated upgrade prompts.
    • Consistently visible web search toggle in the chat UI, gated by permission and tied to upgrade handling.
    • First-time users see a Web Search info dialog explaining benefits; confirming it enables the feature.
    • Upgrade prompt now includes Live Web Search details and required plan information.
  • Documentation

    • UI labels and upgrade messaging updated to describe Live Web Search access.

@coderabbitai
Copy link

coderabbitai bot commented Nov 6, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a "websearch" upgrade feature, introduces a Pro-gated canUseWebSearch flag, makes a visible web-search toggle guarded by permissions/upgrade flow, integrates a first-time WebSearchInfoDialog, and updates the upgrade prompt to include "Live Web Search".

Changes

Cohort / File(s) Summary
Chat component
frontend/src/components/UnifiedChat.tsx
Extended upgradeFeature union to include "websearch"; added canUseWebSearch derived from hasProAccess; replaced previous hidden/unlock logic with an always-visible web-search toggle gated by permission (upsell when not allowed); added webSearchInfoDialogOpen state and flow to show WebSearchInfoDialog; integrated dialog open/confirm handling; minor scaffold comments.
Upgrade dialog
frontend/src/components/UpgradePromptDialog.tsx
Extended UpgradePromptDialogProps feature union to include "websearch"; added getFeatureInfo("websearch") returning Globe icon, title "Live Web Search", description, requiredPlan: "Pro", and benefits list; imported Globe from lucide-react.
WebSearch info dialog (new)
frontend/src/components/WebSearchInfoDialog.tsx
New controlled WebSearchInfoDialog component and WebSearchInfoDialogProps; renders dialog with globe icon, title, descriptive text, benefits list with check icons, and full-width "Got it" button; accepts open, onOpenChange, and onConfirm props and calls onConfirm on acknowledge.

Sequence Diagram

sequenceDiagram
    actor User
    participant Chat as UnifiedChat
    participant Info as WebSearchInfoDialog
    participant Upgrade as UpgradePromptDialog

    User->>Chat: Click web-search toggle
    alt canUseWebSearch (has Pro access)
        alt first-time use
            Chat->>Info: open WebSearchInfoDialog
            Info->>User: show benefits + "Got it"
            User->>Info: confirm
            Info->>Chat: onConfirm (enable web search)
        else returning user
            Chat->>Chat: toggle web search state
            Chat->>User: reflect enabled/disabled
        end
    else lacks Pro access
        Chat->>Upgrade: open upgrade prompt (feature: "websearch")
        Upgrade->>User: show "Live Web Search" Pro offer
        User->>Upgrade: accept or dismiss
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Check upgradeFeature union updates across usages/imports.
  • Verify canUseWebSearch correctly gates UI and feature state transitions.
  • Review WebSearchInfoDialog accessibility, focus trap, and that onConfirm reliably enables web search.
  • Confirm UpgradePromptDialog copy, icon usage, and requiredPlan correctness.

Poem

🐰 I found a globe and gave it a hop,
A toggle now shines — no secret stop.
First-time tips twinkle, Pro gates politely,
A "Got it" hop, then the web answers brightly.
— your update-rabbit 🥕🔎

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: launching the web search feature for Pro+ users, which aligns with the primary objective of making the web search feature visible and gated to Pro+ users.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch launch-web-search-feature

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 6, 2025

Deploying maple with  Cloudflare Pages  Cloudflare Pages

Latest commit: d17efac
Status: ✅  Deploy successful!
Preview URL: https://97962f33.maple-ca8.pages.dev
Branch Preview URL: https://launch-web-search-feature.maple-ca8.pages.dev

View logs

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

Launches web search feature for Pro+ users by making the Globe toggle visible to all users while gating actual usage behind billing checks.

Key Changes:

  • Removed easter egg unlock mechanism (isWebSearchUnlocked state and localStorage persistence)
  • Made Globe icon always visible, positioned before the '+' attachment button in both desktop and mobile views
  • Added canUseWebSearch billing check that requires Pro/Max/Team tier
  • Clicking Globe button without Pro+ access triggers upsell dialog with custom "websearch" feature type
  • Preserved easter egg handler (7-tap logo) for future features - now just logs to console
  • Added comprehensive websearch upsell messaging highlighting Brave search, privacy, and real-time information benefits

The implementation follows existing patterns for other premium features (images, documents, voice) and properly integrates the web search toggle state into the message sending flow where it adds tools: [{ type: "web_search" }] to API calls.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - it's a well-contained feature launch with proper billing gates and follows existing patterns
  • Score reflects solid implementation following existing premium feature patterns, proper billing checks, and thorough testing via easter egg. One minor consideration: the web search toggle state doesn't persist across page refreshes, which may slightly affect UX but is not a critical issue
  • No files require special attention - both changes follow established patterns and are straightforward

Important Files Changed

File Analysis

Filename Score Overview
frontend/src/components/UnifiedChat.tsx 4/5 Made web search toggle visible to all users with billing gate, repositioned Globe icon before '+' button, preserved easter egg functionality - well-structured with proper access control
frontend/src/components/UpgradePromptDialog.tsx 5/5 Added websearch feature type with custom upsell messaging including Brave-powered search benefits and privacy details - clean implementation following existing pattern

Sequence Diagram

sequenceDiagram
    participant User
    participant UnifiedChat
    participant BillingCheck
    participant UpgradeDialog
    participant API

    User->>UnifiedChat: Click Globe icon
    UnifiedChat->>BillingCheck: Check canUseWebSearch (hasProAccess)
    
    alt Free/Starter User
        BillingCheck-->>UnifiedChat: false
        UnifiedChat->>UpgradeDialog: Show "websearch" upsell
        UpgradeDialog-->>User: Display Brave search benefits & pricing
        User->>UpgradeDialog: Click "Upgrade to Pro"
        UpgradeDialog->>User: Navigate to /pricing
    else Pro+ User
        BillingCheck-->>UnifiedChat: true
        UnifiedChat->>UnifiedChat: Toggle isWebSearchEnabled
        User->>UnifiedChat: Send message
        UnifiedChat->>API: POST with tools: [{type: "web_search"}]
        API-->>UnifiedChat: Stream response with web results
        UnifiedChat-->>User: Display AI response with web data
    end
Loading

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
frontend/src/components/UnifiedChat.tsx (1)

2471-2494: Consider extracting the web search toggle button to reduce duplication.

The web search toggle button logic is correctly implemented and properly gated by canUseWebSearch. However, the same button implementation appears twice (lines 2471-2494 and 2683-2706). While this follows the existing pattern in the codebase for other buttons, consider extracting it into a shared component to improve maintainability.

That said, the current implementation is functional and consistent with the codebase patterns. The button correctly:

  • Shows an upgrade dialog for non-Pro users
  • Toggles web search for Pro+ users
  • Provides proper accessibility with aria-label
  • Uses appropriate visual feedback (blue when enabled)

Also applies to: 2683-2706

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57c0e84 and fe619b7.

📒 Files selected for processing (2)
  • frontend/src/components/UnifiedChat.tsx (8 hunks)
  • frontend/src/components/UpgradePromptDialog.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Use 2-space indentation, double quotes, and a 100-character line limit for formatting
Use camelCase for variable and function names
Use try/catch with specific error types for error handling

Files:

  • frontend/src/components/UpgradePromptDialog.tsx
  • frontend/src/components/UnifiedChat.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use strict TypeScript typing and avoid any when possible

Files:

  • frontend/src/components/UpgradePromptDialog.tsx
  • frontend/src/components/UnifiedChat.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-macos (universal-apple-darwin)
  • GitHub Check: build-android
  • GitHub Check: build-linux
  • GitHub Check: build-ios
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (10)
frontend/src/components/UpgradePromptDialog.tsx (3)

19-20: LGTM!

The Globe icon import is properly added for the web search feature.


28-28: LGTM!

The "websearch" feature type is properly added to the union type.


69-83: LGTM!

The websearch feature info is well-structured with clear privacy messaging and comprehensive benefits. The "Pro" plan requirement aligns with the PR objectives for Pro/Max/Team user access.

frontend/src/components/UnifiedChat.tsx (7)

38-38: LGTM!

Globe icon import is properly added for the web search toggle button.


648-650: LGTM!

The upgradeFeature state type correctly includes "websearch" alongside existing features.


661-664: LGTM!

Web search state is properly initialized, and the easter egg state is preserved as intended by the PR objectives.


1288-1312: LGTM!

The 7-tap easter egg handler is preserved with clear documentation that it's reserved for future features. The console log confirms it's still functional.


1314-1325: LGTM!

The billing gate for web search is correctly implemented, restricting access to Pro/Max/Team users as specified in the PR objectives.


1976-1987: LGTM!

The web search tools parameter is correctly integrated into the API call, conditionally added only when isWebSearchEnabled is true.


2812-2828: LGTM!

The upgrade dialog correctly maps the "websearch" feature to trigger the appropriate upsell flow for non-Pro users.

- Make web search toggle visible to all users (Globe icon)
- Position Globe icon to the left of '+' attachment button
- Add billing check: only Pro/Max/Team users can use web search
- Show upsell dialog for free/starter users with custom messaging
- Preserve easter egg handler for future features (no longer unlocks web search)
- Update UpgradePromptDialog to support websearch feature with Brave branding

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@AnthonyRonning AnthonyRonning force-pushed the launch-web-search-feature branch from fe619b7 to e3fdec8 Compare November 6, 2025 02:19
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR launches the web search feature for Pro+ users by removing the easter egg unlock mechanism and making the Globe icon permanently visible. The implementation adds proper billing gates that show an upsell dialog for free/starter users while allowing Pro/Max/Team users to toggle web search.

Key Changes:

  • Removed isWebSearchUnlocked state and localStorage persistence
  • Made web search toggle always visible (repositioned before attachment button)
  • Added canUseWebSearch billing check tied to hasProAccess
  • Created custom upsell dialog for websearch feature with privacy messaging
  • Preserved easter egg handler for future features (currently just logs to console)

Security Note:

  • Verify backend API validates Pro+ access for the web_search tool parameter, as frontend billing checks alone can be bypassed

Confidence Score: 4/5

  • This PR is safe to merge with one important verification needed
  • Clean implementation with proper frontend billing gates and UX flow. Score reflects need to verify backend validates web_search tool access, since frontend checks can be bypassed
  • Verify backend API validates Pro+ access for web_search tool parameter at frontend/src/components/UnifiedChat.tsx:1973

Important Files Changed

File Analysis

Filename Score Overview
frontend/src/components/UnifiedChat.tsx 4/5 Removed easter egg unlock logic, made web search visible to all users, added Pro+ billing gate with upsell dialog
frontend/src/components/UpgradePromptDialog.tsx 5/5 Added websearch feature type with custom messaging including privacy and Brave integration details

Sequence Diagram

sequenceDiagram
    participant User
    participant UnifiedChat
    participant BillingCheck
    participant UpgradeDialog
    participant OpenAI_API
    
    User->>UnifiedChat: Click Globe icon
    UnifiedChat->>BillingCheck: Check canUseWebSearch
    
    alt User has Pro+ access
        BillingCheck-->>UnifiedChat: hasProAccess = true
        UnifiedChat->>UnifiedChat: Toggle isWebSearchEnabled
        Note over UnifiedChat: Globe icon changes color
    else User is Free/Starter
        BillingCheck-->>UnifiedChat: hasProAccess = false
        UnifiedChat->>UpgradeDialog: Show with feature="websearch"
        UpgradeDialog-->>User: Display Pro upgrade prompt
    end
    
    User->>UnifiedChat: Send message with web search ON
    UnifiedChat->>OpenAI_API: POST with tools: [{type: "web_search"}]
    Note over OpenAI_API: Backend should validate<br/>user's billing tier
    OpenAI_API-->>UnifiedChat: Stream response with web results
Loading

Additional Comments (1)

  1. frontend/src/components/UnifiedChat.tsx, line 1973 (link)

    style: Verify backend enforces Pro+ access for web_search tool - frontend checks can be bypassed by modifying request or using API directly

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

- Create WebSearchInfoDialog component for first-time paid users
- Add 3-step flow: check access → show info (first time) → toggle
- Store 'hasSeenWebSearchInfo' in localStorage to track first use
- Dialog marks as seen when closed any way (not just on confirm)
- Clicking 'Got it' enables web search automatically
- Clarify that AI automatically searches when toggled on
- Update both Globe button handlers (centered and bottom input)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR successfully launches the web search feature for Pro+ users, transitioning it from easter egg to production-ready feature with proper billing gates and user education.

Key Changes:

  • Made web search toggle (Globe icon) permanently visible and positioned before attachment button
  • Added billing check: only Pro/Max/Team users can toggle web search
  • Free/Starter users see upsell dialog with feature benefits and Brave branding
  • First-time Pro+ users see one-time info dialog explaining privacy and features
  • Preserved easter egg handler for future features (now just logs to console)
  • Web search state properly passed to API via tools: [{ type: "web_search" }]

Issues Found:

  • One critical UX issue: dismissing the info dialog (ESC/outside click) still enables web search - should only enable on explicit confirmation
  • Code duplication: web search button logic duplicated for mobile/desktop views

Confidence Score: 4/5

  • Safe to merge with one UX issue that should be addressed
  • Implementation is solid with proper billing gates, state management, and API integration. The critical issue is that dismissing the info dialog inadvertently enables web search, which may confuse users who dismiss without reading. Code duplication is a minor maintainability concern but doesn't affect functionality.
  • Pay close attention to frontend/src/components/UnifiedChat.tsx lines 2929-2935 for the dialog dismissal behavior

Important Files Changed

File Analysis

Filename Score Overview
frontend/src/components/UnifiedChat.tsx 4/5 Made web search toggle visible to all users, added Pro+ billing gate, preserved easter egg for future features, and integrated info dialog for first-time users
frontend/src/components/WebSearchInfoDialog.tsx 5/5 New dialog component explaining web search feature with privacy messaging and feature benefits

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as UnifiedChat UI
    participant LS as LocalStorage
    participant Dialog as WebSearchInfoDialog
    participant Upsell as UpgradePromptDialog
    participant API as Chat API

    User->>UI: Click Globe icon
    
    alt User is Free/Starter
        UI->>UI: Check canUseWebSearch (false)
        UI->>Upsell: Show upgrade prompt
        Upsell->>User: Display "Live Web Search" feature
        User->>Upsell: Click "Upgrade" or dismiss
    else User is Pro/Max/Team
        UI->>UI: Check canUseWebSearch (true)
        UI->>LS: Check hasSeenWebSearchInfo
        
        alt First time user
            LS-->>UI: Not seen (false)
            UI->>Dialog: Show info dialog
            Dialog->>User: Display feature info & privacy
            User->>Dialog: Click "Got it" or dismiss
            Dialog->>LS: Set hasSeenWebSearchInfo=true
            Dialog->>UI: Enable web search
            UI->>UI: setIsWebSearchEnabled(true)
        else Returning user
            LS-->>UI: Already seen (true)
            UI->>UI: Toggle isWebSearchEnabled
        end
        
        Note over UI: Globe icon shows blue when enabled
    end

    User->>UI: Send message
    alt isWebSearchEnabled=true
        UI->>API: Send with tools: [web_search]
        API-->>UI: Response with web results
    else isWebSearchEnabled=false
        UI->>API: Send without tools
        API-->>UI: Regular response
    end
Loading

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/components/UnifiedChat.tsx (1)

2496-2530: Extract duplicated web search toggle logic into a shared handler.

The web search toggle button implementation is duplicated in two places (centered and bottom input areas) with identical onClick logic. This violates the DRY principle and makes maintenance more difficult.

Consider extracting the shared logic into a handler function:

+  const handleWebSearchToggle = useCallback(() => {
+    // Step 1: Check if user has access (free/starter users see upsell)
+    if (!canUseWebSearch) {
+      setUpgradeFeature("websearch");
+      setUpgradeDialogOpen(true);
+      return;
+    }
+
+    // Step 2: Check if this is their first time (show info dialog)
+    const hasSeenWebSearchInfo =
+      localStorage.getItem("hasSeenWebSearchInfo") === "true";
+    if (!hasSeenWebSearchInfo) {
+      setWebSearchInfoDialogOpen(true);
+      return;
+    }
+
+    // Step 3: Toggle web search directly
+    setIsWebSearchEnabled(!isWebSearchEnabled);
+  }, [canUseWebSearch, isWebSearchEnabled]);

Then use it in both buttons:

 <Button
   type="button"
   variant="ghost"
   size="sm"
   className="h-8 w-8 p-0"
-  onClick={() => {
-    // Step 1: Check if user has access (free/starter users see upsell)
-    if (!canUseWebSearch) {
-      setUpgradeFeature("websearch");
-      setUpgradeDialogOpen(true);
-      return;
-    }
-
-    // Step 2: Check if this is their first time (show info dialog)
-    const hasSeenWebSearchInfo =
-      localStorage.getItem("hasSeenWebSearchInfo") === "true";
-    if (!hasSeenWebSearchInfo) {
-      setWebSearchInfoDialogOpen(true);
-      return;
-    }
-
-    // Step 3: Toggle web search directly
-    setIsWebSearchEnabled(!isWebSearchEnabled);
-  }}
+  onClick={handleWebSearchToggle}
   aria-label={
     isWebSearchEnabled ? "Disable web search" : "Enable web search"
   }
 >

Also applies to: 2753-2787

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3fdec8 and 53e011c.

📒 Files selected for processing (2)
  • frontend/src/components/UnifiedChat.tsx (10 hunks)
  • frontend/src/components/WebSearchInfoDialog.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Use 2-space indentation, double quotes, and a 100-character line limit for formatting
Use camelCase for variable and function names
Use try/catch with specific error types for error handling

Files:

  • frontend/src/components/WebSearchInfoDialog.tsx
  • frontend/src/components/UnifiedChat.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use strict TypeScript typing and avoid any when possible

Files:

  • frontend/src/components/WebSearchInfoDialog.tsx
  • frontend/src/components/UnifiedChat.tsx
🧬 Code graph analysis (2)
frontend/src/components/WebSearchInfoDialog.tsx (2)
frontend/src/components/ui/dialog.tsx (6)
  • Dialog (92-92)
  • DialogContent (97-97)
  • DialogHeader (98-98)
  • DialogTitle (100-100)
  • DialogDescription (101-101)
  • DialogFooter (99-99)
frontend/src/components/ui/button.tsx (1)
  • Button (62-62)
frontend/src/components/UnifiedChat.tsx (1)
frontend/src/components/WebSearchInfoDialog.tsx (1)
  • WebSearchInfoDialog (18-77)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-android
  • GitHub Check: build-macos (universal-apple-darwin)
  • GitHub Check: build-ios
  • GitHub Check: build-linux
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
frontend/src/components/WebSearchInfoDialog.tsx (1)

18-77: LGTM! Clean, well-structured informational dialog.

The component follows React best practices with proper TypeScript typing, controlled component patterns, and clear privacy messaging. The UI clearly communicates the web search feature benefits and privacy considerations to users.

frontend/src/components/UnifiedChat.tsx (3)

1291-1314: Easter egg scaffold properly preserved.

The 7-tap logo easter egg handler is correctly preserved with console logging and a TODO comment for future features, as specified in the PR objectives.


1328-1328: Web search capability correctly gated to Pro+ users.

The canUseWebSearch flag properly restricts the feature to Pro/Max/Team users as specified in the PR objectives.


1975-1975: Web search API integration correctly implemented.

The conditional inclusion of the web_search tool based on isWebSearchEnabled state is properly implemented in both the initial request and retry paths.

Also applies to: 2135-2135

@AnthonyRonning
Copy link
Contributor Author

@TestFlight build

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

🚀 TestFlight deployment triggered! Check the Actions tab for progress.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

✅ TestFlight deployment completed successfully!

@AnthonyRonning
Copy link
Contributor Author

@claude it's weird, on ios clicking the globe for the first time and then clicking the "got it" button doesn't result in the globe being set and clicking it again still pops up the dialog.

Whether it's on the new chat view or existing chat, and no matter if it is minimized via okay, esc, or outside dialog click, it must behave exactly the same. Set the flag and have the toggle on.

In fact go ahead and set the flag and toggle when the user clicks the globe for the first time as a pro+ user. We shouldn't wait for any type of confirmation. This will make it much more simple and consistent.

@claude
Copy link
Contributor

claude bot commented Nov 6, 2025

Claude finished @AnthonyRonning's task —— View job


Completed: Web search toggle simplification

Changes Made

  1. Modified both web search toggle buttons (desktop and mobile in UnifiedChat.tsx:2513-2519 and 2774-2780):

    • Now immediately set the hasSeenWebSearchInfo localStorage flag
    • Enable web search (setIsWebSearchEnabled(true))
    • Show info dialog purely for informational purposes
  2. Simplified the dialog handler (UnifiedChat.tsx:2936-2940):

    • Removed all enable/flag logic from onOpenChange and onConfirm
    • Dialog now just closes without any side effects
  3. Result:

    • All dismissal methods (clicking "Got it", ESC, or clicking outside) now behave identically
    • Toggle is enabled immediately when Pro+ user clicks globe for first time
    • Dialog is purely informational and doesn't affect the toggle state
    • Fixes iOS inconsistency where toggle wasn't being enabled on first click

Build Verification

  • ✅ Format: All files unchanged (already properly formatted)
  • ✅ Lint: 10 warnings (pre-existing, no new issues introduced)
  • ✅ Build: Successful in 8.18s
  • ✅ Pre-commit hooks: All checks passed

Git

  • Commit: d17efac
  • Pushed to: launch-web-search-feature

The behavior is now much simpler and consistent across all platforms and dismissal methods!

--- | Branch: launch-web-search-feature

- Enable web search and set localStorage flag immediately when Pro+ user clicks globe
- Show info dialog purely for informational purposes (no confirmation required)
- All dismissal methods (Got it/ESC/outside click) now behave identically
- Fixes iOS inconsistency where toggle wasn't being enabled on first click

Co-authored-by: Anthony <AnthonyRonning@users.noreply.github.com>
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR successfully launches the web search feature for Pro+ users by making the Globe icon permanently visible and adding proper billing gates. The implementation includes a three-tier access control: free/starter users see an upsell dialog, first-time Pro+ users see an informational dialog while web search is enabled, and returning Pro+ users can toggle freely.

Key changes:

  • Removed easter egg requirement (isWebSearchUnlocked state) and made Globe icon always visible
  • Added canUseWebSearch billing check restricting feature to Pro/Max/Team users
  • Implemented WebSearchInfoDialog for first-time Pro+ users with privacy and feature messaging
  • Updated UpgradePromptDialog to include websearch feature with Brave-powered benefits
  • Repositioned Globe icon to the left of attachment dropdown for better UX
  • Preserved easter egg handler for future features (currently logs to console)

Observations:

  • The web search button code is duplicated in two locations (around lines 2496 and 2753) - both instances handle the same three-step flow identically
  • The first-time user flow enables web search immediately before showing the info dialog, which is intentional as the dialog is informational rather than confirmatory

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - solid billing gates and user flows are in place
  • The implementation is straightforward and well-tested via the easter egg flow. The billing checks properly gate the feature, and the UX flow is clear. One point deducted for code duplication of the web search button logic that should be extracted into a shared function or component to maintain consistency and reduce maintenance burden
  • No files require special attention - the duplication is a style issue rather than a functional concern

Important Files Changed

File Analysis

Filename Score Overview
frontend/src/components/UnifiedChat.tsx 4/5 Launches web search for Pro+ users with billing gate, info dialog, and upsell flow. Code duplication exists but logic is sound.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as UnifiedChat UI
    participant LS as LocalStorage
    participant Billing as BillingStatus
    participant Dialog as Dialogs

    User->>UI: Clicks Globe icon
    UI->>Billing: Check canUseWebSearch
    
    alt Free/Starter User
        Billing-->>UI: No Pro access
        UI->>Dialog: Show UpgradePromptDialog
        Dialog-->>User: Display upgrade options
    else Pro+ User (First Time)
        Billing-->>UI: Has Pro access
        UI->>LS: Check hasSeenWebSearchInfo
        LS-->>UI: false
        UI->>LS: Set hasSeenWebSearchInfo=true
        UI->>UI: Enable web search
        UI->>Dialog: Show WebSearchInfoDialog
        Dialog-->>User: Display info (already enabled)
    else Pro+ User (Returning)
        Billing-->>UI: Has Pro access
        UI->>LS: Check hasSeenWebSearchInfo
        LS-->>UI: true
        UI->>UI: Toggle web search on/off
        UI-->>User: Update Globe icon color
    end
Loading

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
frontend/src/components/UnifiedChat.tsx (1)

2496-2534: Extract duplicated web search button into shared component or function.

This web search button code is duplicated at lines 2757-2795. Extract it to eliminate duplication and ensure consistency.

Consider extracting the logic into a reusable component:

const WebSearchButton = ({ isEnabled, onToggle }: { 
  isEnabled: boolean; 
  onToggle: (enabled: boolean) => void;
}) => {
  const handleClick = () => {
    if (!canUseWebSearch) {
      setUpgradeFeature("websearch");
      setUpgradeDialogOpen(true);
      return;
    }

    const hasSeenWebSearchInfo = localStorage.getItem("hasSeenWebSearchInfo") === "true";
    if (!hasSeenWebSearchInfo) {
      localStorage.setItem("hasSeenWebSearchInfo", "true");
      onToggle(true);
      setWebSearchInfoDialogOpen(true);
      return;
    }

    onToggle(!isEnabled);
  };

  return (
    <Button
      type="button"
      variant="ghost"
      size="sm"
      className="h-8 w-8 p-0"
      onClick={handleClick}
      aria-label={isEnabled ? "Disable web search" : "Enable web search"}
    >
      <Globe
        className={`h-4 w-4 ${
          isEnabled ? "text-blue-500" : "text-muted-foreground"
        }`}
      />
    </Button>
  );
};
🧹 Nitpick comments (1)
frontend/src/components/UnifiedChat.tsx (1)

666-668: Clarify easter egg comments.

The comments state the easter egg is "reserved for future features" and "currently unused," but the code actively logs to console at line 1308. Per the PR objectives, this feature is preserved and functional (logging), so the comments are misleading.

Consider updating the comments to accurately reflect the current behavior:

-// Easter egg state (for future features)
+// Easter egg state - currently logs to console on 7 taps
 const [logoTapCount, setLogoTapCount] = useState(0);
-  // Handle logo tap for easter egg (reserved for future features)
+  // Handle logo tap for easter egg
   const handleLogoTap = useCallback(() => {
-    // Easter egg trigger at 7 taps (currently unused, reserved for future features)
+    // Easter egg trigger at 7 taps
     if (newCount >= 7) {
       console.log("Easter egg activated! 🥚");

Also applies to: 1291-1315

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53e011c and d17efac.

📒 Files selected for processing (1)
  • frontend/src/components/UnifiedChat.tsx (10 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Use 2-space indentation, double quotes, and a 100-character line limit for formatting
Use camelCase for variable and function names
Use try/catch with specific error types for error handling

Files:

  • frontend/src/components/UnifiedChat.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Use strict TypeScript typing and avoid any when possible

Files:

  • frontend/src/components/UnifiedChat.tsx
🧬 Code graph analysis (1)
frontend/src/components/UnifiedChat.tsx (1)
frontend/src/components/WebSearchInfoDialog.tsx (1)
  • WebSearchInfoDialog (18-77)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: build-android
  • GitHub Check: build-linux
  • GitHub Check: build-macos (universal-apple-darwin)
  • GitHub Check: build-ios
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (6)
frontend/src/components/UnifiedChat.tsx (6)

651-651: LGTM: upgradeFeature type correctly extended.

The union type now includes "websearch" to support the new web search upsell flow.


655-655: LGTM: webSearchInfoDialogOpen state added.

State properly manages the visibility of the first-time info dialog.


664-664: LGTM: isWebSearchEnabled state added.

State correctly tracks the web search toggle for Pro+ users.


1328-1328: LGTM: canUseWebSearch capability flag correctly implemented.

The flag properly gates web search to Pro/Max/Team users, consistent with other Pro-gated features.


2934-2941: LGTM: WebSearchInfoDialog correctly integrated.

The dialog is purely informational and shown after web search is already enabled (lines 2515-2516, 2776-2777). This correctly implements the PR objective: "set the feature flag and enable the toggle immediately when the user clicks the globe for the first time — do not wait for any confirmation."


2913-2915: LGTM: Upgrade dialog correctly handles websearch feature.

The ternary chain properly maps the "websearch" feature type to the UpgradePromptDialog component.

@AnthonyRonning
Copy link
Contributor Author

@TestFlight build

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

🚀 TestFlight deployment triggered! Check the Actions tab for progress.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

✅ TestFlight deployment completed successfully!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant