Last active
October 28, 2021 19:28
-
-
Save robertpenner/fd4032a17dd423aa92a60eacb90908b7 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
const machine = Machine({ | |
id: "PGA Onboarding & Login", | |
initial: "splash screen", | |
states: { | |
"splash screen": { | |
after: { | |
2000: "onboard or sign in", | |
}, | |
}, | |
"onboard or sign in": { | |
// TODO: copy auto-changes between 4 messages | |
on: { | |
"GET STARTED": "onboarding", | |
"SIGN IN": "signing in", | |
}, | |
}, | |
onboarding: { | |
initial: "continue or skip", | |
states: { | |
"continue or skip": { | |
on: { | |
CONTINUE: "choosing a favorite tour", | |
SKIP: "", | |
}, | |
}, | |
"choosing a favorite tour": { | |
initial: "none", | |
states: { | |
none: { | |
on: { "SELECT FAVORITE TOUR": "tour selected" }, | |
}, | |
"tour selected": { | |
on: { CONTINUE: "#choosing favorite players" }, | |
}, | |
}, | |
on: { SKIP: "choosing favorite players" }, | |
}, | |
"choosing favorite players": { | |
id: "choosing favorite players", | |
initial: "none", | |
states: { | |
// TODO: searching players | |
none: { | |
on: { "SELECT FAVORITE PLAYER": "player selected" }, | |
}, | |
"player selected": { | |
on: { | |
"SELECT FAVORITE PLAYER": "player selected", | |
CONTINUE: "#allowing notifications", | |
}, | |
}, | |
}, | |
on: { SKIP: "#allowing notifications" }, | |
}, | |
"allowing notifications": { | |
id: "allowing notifications", | |
initial: "not allowed", | |
states: { | |
"not allowed": { | |
on: { "SHOW PROMPT": "notifications prompt" }, | |
}, | |
"notifications prompt": { | |
on: { | |
"DON'T ALLOW": "#allowing location", | |
ALLOW: "#allowing location", | |
}, | |
}, | |
}, | |
on: { SKIP: "#allowing location" }, | |
}, | |
"allowing location": { | |
id: "allowing location", | |
initial: "not allowed", | |
states: { | |
"not allowed": { | |
on: { "SHOW PROMPT": "location prompt" }, | |
}, | |
"location prompt": { | |
on: { | |
"ONLY WHILE USING THE APP": "#creating account", | |
"ALWAYS ALLOW": "#creating account", | |
"DON'T ALLOW": "#creating account", | |
}, | |
}, | |
}, | |
on: { SKIP: "#creating account" }, | |
}, | |
"creating account": { | |
id: "creating account", | |
initial: "entering credentials", | |
states: { | |
"entering credentials": { | |
on: { "COMPLETE FORM": "form complete" }, | |
}, | |
"form complete": {}, | |
}, | |
}, | |
}, | |
// "after onboarding": {}, | |
}, | |
"signing in": { | |
initial: "entering credentials", | |
states: { | |
"entering credentials": { | |
on: { | |
"COMPLETE FORM": "form complete", | |
"FORGOT PASSWORD": "#resetting password", | |
}, | |
}, | |
"form complete": {}, | |
}, | |
}, | |
"resetting password": { | |
id: "resetting password", | |
// onDone: 'login', | |
on: { | |
// BACK: 'login.history', | |
}, | |
initial: "entering email", | |
states: { | |
"entering email": { | |
onDone: "email sent", | |
initial: "editing email", | |
states: { | |
"editing email": { | |
on: { | |
"SUBMIT EMAIL": "sending recovery email", | |
}, | |
}, | |
"sending recovery email": { | |
invoke: { | |
src: "send recovery email", | |
onDone: { | |
target: "done entering email", | |
actions: "clear recovery email error", | |
}, | |
onError: { | |
target: "editing email", | |
actions: "assign recovery email error", | |
}, | |
}, | |
}, | |
"done entering email": { type: "final" }, | |
}, | |
}, | |
"email sent": { | |
on: { | |
"RESEND EMAIL": "entering email.sending recovery email", | |
"BACK TO LOGIN": "done resetting password", | |
}, | |
}, | |
"done resetting password": { type: "final" }, | |
}, | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment