feat(signup): post-signup welcome wizard + auto-login (PRD §4) - #8
Merged
Conversation
Implements the onboarding wizard described in docs/tasks/onboarding-prd.md
without rewriting the existing /sign-up form (which is 431 lines of
turnstile / WeChat / OAuth / email verification integrations we don't
want to risk breaking).
Architecture (hybrid):
- Step 1 = existing /sign-up form, untouched
- Backend Register handler now auto-creates the session (set cookie)
and returns the one-time default token + trial quota + suggested
landing route
- Signup form navigates to new /welcome route with the response stashed
in sessionStorage
- /welcome renders Welcome banner (trial credit + default token) +
Step 2/3/4 inline (persona / brand / client) + Continue → calls
/api/user/setting and lands on the chosen route
Backend (controller/user.go):
- New RegisterRequest DTO with Persona/BrandPreference/PreferredClient/
AcquisitionChannel/Timezone fields (all optional, all in setting JSON)
- Register handler refactored: builds dto.UserSetting from request,
stamps OnboardingCompletedAt only if user picked persona AND client
- Default token (already auto-created) now binds SimpleBrand from the
wizard so "deeprouter" virtual model resolves to the right provider
from day 1
- Auto sign-in: same session.Set/Save calls as Login. Skips the
/sign-in detour entirely.
- Response includes default_token (one-time reveal) + trial_quota +
next route hint based on preferred_client
Shared types (dto/user_settings.go):
- 9 new optional fields on UserSetting JSON. Zero schema migration
(all in existing `setting` column). Frontend types mirror.
Frontend:
- New features/welcome/ feature + /welcome route (TanStack Router)
- New auth/lib/storage helpers: setWelcomeHandoff / takeWelcomeHandoff
(sessionStorage one-shot for register response) + captureAcquisition
Meta / readAcquisitionMeta (utm + referrer snapshot)
- Sign-up form: replaces redirectToLogin() with navigate({to: '/welcome'})
after register. Acquisition meta captured on mount, included in
register payload.
Compatibility:
- Wizard fully skippable: "Skip — set this later" link → setting saved
with persona='dev' (legacy default), lands on /dashboard
- Skipping any single step keeps persona='unset' / brand='' / client=''
→ dashboard picker (PR #3) fallback still triggers as designed
- /welcome accessed directly (no handoff): redirect to /sign-in or
/dashboard depending on session state
- All existing OAuth / WeChat / email-verification flows untouched
i18n: 31 new en + zh keys.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This was referenced May 16, 2026
10 tasks
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.
Summary
实现 `docs/tasks/onboarding-prd.md` 里的注册 wizard,不动现有 431 行 sign-up 表单(turnstile / WeChat / OAuth / 邮箱验证一大堆集成不动)。
混合架构
关键点
Backend (`controller/user.go`):
Setting JSON (`dto/user_settings.go`):
Frontend:
兼容性
文件
Backend:
Frontend 新增:
Frontend 修改:
Test plan
🤖 Generated with Claude Code