start onboarding only for new account creations
parent
bcef7400db
commit
8f0f3be8fb
|
@ -14,7 +14,7 @@ type OnboardingStep =
|
||||||
const OnboardingStepsArray = Object.values(OnboardingScreenSteps)
|
const OnboardingStepsArray = Object.values(OnboardingScreenSteps)
|
||||||
export class OnboardingModel {
|
export class OnboardingModel {
|
||||||
// state
|
// state
|
||||||
step: OnboardingStep = 'Welcome'
|
step: OnboardingStep = 'Home'
|
||||||
|
|
||||||
constructor(public rootStore: RootStoreModel) {
|
constructor(public rootStore: RootStoreModel) {
|
||||||
makeAutoObservable(this, {
|
makeAutoObservable(this, {
|
||||||
|
@ -25,7 +25,6 @@ export class OnboardingModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
serialize(): unknown {
|
serialize(): unknown {
|
||||||
console.log('serializing onboarding', this.step)
|
|
||||||
return {
|
return {
|
||||||
step: this.step,
|
step: this.step,
|
||||||
}
|
}
|
||||||
|
@ -38,7 +37,6 @@ export class OnboardingModel {
|
||||||
typeof v.step === 'string' &&
|
typeof v.step === 'string' &&
|
||||||
OnboardingStepsArray.includes(v.step as OnboardingStep)
|
OnboardingStepsArray.includes(v.step as OnboardingStep)
|
||||||
) {
|
) {
|
||||||
console.log('hydrating onboarding', v.step)
|
|
||||||
this.step = v.step as OnboardingStep
|
this.step = v.step as OnboardingStep
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -53,16 +51,12 @@ export class OnboardingModel {
|
||||||
* @returns name of next screen in the onboarding process
|
* @returns name of next screen in the onboarding process
|
||||||
*/
|
*/
|
||||||
next(currentScreenName?: OnboardingStep) {
|
next(currentScreenName?: OnboardingStep) {
|
||||||
if (currentScreenName === 'Welcome' || this.step === 'Welcome') {
|
currentScreenName = currentScreenName || this.step
|
||||||
track('Onboarding:Begin')
|
if (currentScreenName === 'Welcome') {
|
||||||
this.step = 'RecommendedFeeds'
|
this.step = 'RecommendedFeeds'
|
||||||
return this.step
|
return this.step
|
||||||
} else if (
|
} else if (this.step === 'RecommendedFeeds') {
|
||||||
this.step === 'RecommendedFeeds' ||
|
this.finish()
|
||||||
currentScreenName === 'RecommendedFeeds'
|
|
||||||
) {
|
|
||||||
track('Onboarding:Complete')
|
|
||||||
this.step = 'Home'
|
|
||||||
return this.step
|
return this.step
|
||||||
} else {
|
} else {
|
||||||
// if we get here, we're in an invalid state, let's just go Home
|
// if we get here, we're in an invalid state, let's just go Home
|
||||||
|
@ -70,6 +64,16 @@ export class OnboardingModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
this.step = 'Welcome'
|
||||||
|
track('Onboarding:Begin')
|
||||||
|
}
|
||||||
|
|
||||||
|
finish() {
|
||||||
|
this.step = 'Home'
|
||||||
|
track('Onboarding:Complete')
|
||||||
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
this.step = 'Welcome'
|
this.step = 'Welcome'
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,10 +109,10 @@ export class CreateAccountModel {
|
||||||
this.setError('')
|
this.setError('')
|
||||||
this.setIsProcessing(true)
|
this.setIsProcessing(true)
|
||||||
|
|
||||||
// open the onboarding modal after the session is created
|
// open the onboarding screens after the session is created
|
||||||
const sessionReadySub = this.rootStore.onSessionReady(() => {
|
const sessionReadySub = this.rootStore.onSessionReady(() => {
|
||||||
sessionReadySub.remove()
|
sessionReadySub.remove()
|
||||||
this.rootStore.shell.openModal({name: 'onboarding'})
|
this.rootStore.onboarding.start()
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -140,10 +140,6 @@ export interface PreferencesHomeFeed {
|
||||||
name: 'preferences-home-feed'
|
name: 'preferences-home-feed'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OnboardingModal {
|
|
||||||
name: 'onboarding'
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Modal =
|
export type Modal =
|
||||||
// Account
|
// Account
|
||||||
| AddAppPasswordModal
|
| AddAppPasswordModal
|
||||||
|
@ -176,9 +172,6 @@ export type Modal =
|
||||||
| WaitlistModal
|
| WaitlistModal
|
||||||
| InviteCodesModal
|
| InviteCodesModal
|
||||||
|
|
||||||
// Onboarding
|
|
||||||
| OnboardingModal
|
|
||||||
|
|
||||||
// Generic
|
// Generic
|
||||||
| ConfirmModal
|
| ConfirmModal
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue