feat: self-serve signup Phase 2 (frontend cutover) (#162)
Co-authored-by: Michael Chihlas <michael@resolutionflow.com> Co-committed-by: Michael Chihlas <michael@resolutionflow.com>
This commit was merged in pull request #162.
This commit is contained in:
@@ -4,11 +4,15 @@ export interface OnboardingStatus {
|
||||
created_flow: boolean
|
||||
ran_session: boolean
|
||||
exported_session: boolean
|
||||
/** @deprecated Phase 2 — kept for backward-compat. New UI no longer branches on this. */
|
||||
tried_ai_assistant: boolean
|
||||
invited_teammate: boolean
|
||||
connected_psa: boolean
|
||||
is_team_user: boolean
|
||||
dismissed: boolean
|
||||
// Phase 2 (Task 41) — drive the unified next-step card + checklist.
|
||||
email_verified: boolean
|
||||
shop_setup_done: boolean
|
||||
}
|
||||
|
||||
export async function getOnboardingStatus(): Promise<OnboardingStatus> {
|
||||
@@ -19,3 +23,51 @@ export async function getOnboardingStatus(): Promise<OnboardingStatus> {
|
||||
export async function dismissOnboarding(): Promise<void> {
|
||||
await apiClient.post('/users/onboarding-status/dismiss')
|
||||
}
|
||||
|
||||
// --- Welcome wizard (Phase 2) ---------------------------------------------
|
||||
|
||||
export type WizardStep = 1 | 2 | 3
|
||||
export type WizardAction = 'complete' | 'skip'
|
||||
export type TeamSizeBucket = '1-2' | '3-5' | '6-10' | '11-25' | '26+'
|
||||
export type RoleAtSignup = 'owner' | 'lead_tech' | 'tech' | 'other'
|
||||
export type PrimaryPsa = 'connectwise' | 'autotask' | 'halopsa' | 'none'
|
||||
|
||||
export interface OnboardingStepData {
|
||||
// Step 1
|
||||
company_name?: string
|
||||
team_size_bucket?: TeamSizeBucket
|
||||
role_at_signup?: RoleAtSignup
|
||||
// Step 2
|
||||
primary_psa?: PrimaryPsa
|
||||
}
|
||||
|
||||
export interface OnboardingStepRequest {
|
||||
step: WizardStep
|
||||
action: WizardAction
|
||||
data?: OnboardingStepData
|
||||
}
|
||||
|
||||
export interface OnboardingStepResponse {
|
||||
onboarding_step_completed: number | null
|
||||
onboarding_dismissed: boolean
|
||||
}
|
||||
|
||||
export const onboardingApi = {
|
||||
getStatus: getOnboardingStatus,
|
||||
dismiss: dismissOnboarding,
|
||||
/** Persist welcome-wizard progress for the current user. */
|
||||
async updateStep(payload: OnboardingStepRequest): Promise<OnboardingStepResponse> {
|
||||
const response = await apiClient.patch<OnboardingStepResponse>(
|
||||
'/users/me/onboarding-step',
|
||||
payload,
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
/** Skip the rest of the welcome wizard — sets users.onboarding_dismissed=TRUE. */
|
||||
async dismissRest(): Promise<OnboardingStepResponse> {
|
||||
const response = await apiClient.post<OnboardingStepResponse>(
|
||||
'/users/me/onboarding-dismiss-rest',
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user