Repository navigation
feat(ai): offer new installs one AI title suggestion after their first analysis - #92
Merged
Merged
Conversation
…t analysis Dismissing onboarding marks an install as fresh (chrome.storage.local "first_run_ai_try" = "pending"); installs that were past onboarding before this shipped never get the prompt. The first completed analysis spends the mark: on the free tier the score page shows one dismissible card, "Try one AI suggestion for this page's title". One click sends the same hosted /ai/generate title request as the Meta Tags breakdown, counted against the 25 free calls as today, and the result shows inline in the usual box with its copy button. Pro, or an allowance already used up, spends the mark without a prompt. The paywall and quota behavior are unchanged. Part of #80. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part B of #80: give new installs a reason to try the AI. Independent of #91 (the usage counts): the two share no files, and merged together locally they pass 595 unit tests and the 26 e2e tests.
What changed
app/src/lib/first-run-ai-try.ts): dismissing onboarding storesfirst_run_ai_try: "pending". The issue says "onboarding not yet dismissed", but the onboarding overlay covers the setup screen, so it is always dismissed before the first analysis can run. The flag carries "this install just went through onboarding" forward to that analysis. Installs that were past onboarding before this ships never get the flag, so existing users never see the prompt."done") whether or not the prompt shows. Pro, or a free allowance that is already used up, spends it without a prompt, and the prompt also hides if the install becomes Pro while it is showing. The decision waits for the entitlement to load, so a Pro install is never mistaken for a free one.app/src/components/FirstRunAiTry.tsx, on the score page between the score and the breakdown) reads "Try one AI suggestion for this page's title" with "Powered by Claude (Anthropic). Uses one of your 25 free AI recommendations this month.", a "Suggest a title" button and a dismiss X. The click callsgenerateRecommendation("title-keyword", keyword, pageData.title, advancedOptions), the call the Meta Tags breakdown makes. So it goes through/ai/generate, counts against the 25 free calls and shows the same error messages. The result appears inline in the usualEditableRecommendationbox with its copy button, and stays while you move between the score and its sections.docs/free-vs-pro-gating.mdgains a row for the prompt.Verification
first-run-ai-try.test.ts: never for an install that was already past onboarding, once for a fresh one, no re-arming, overlapping calls share one claim (StrictMode runs effects twice), and Pro or a used-up allowance spends the flag without a prompt.FirstRunAiTry.test.tsx: appears once and only on a fresh install, waits for the entitlement, sends the exact title request, shows the result inline with the copy button, keeps it after leaving the score page, shows the quota error inline and as a toast, and dismisses.Onboarding.test.tsx(both ways of dismissing set the flag; an install that already dismissed onboarding gets nothing), twoScorePagecases, and an assertion in the freemium e2e test that Get Started stores the flag in the built extension.POST /ai/generate(200, free quota 25 → 24). A second analysis showed no prompt. Checked light and dark at side-panel width.🤖 Generated with Claude Code