Created
September 29, 2020 16:23
-
-
Save ksm/6b94ed614747c3508a5c448406d232b5 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const signUpMachine = Machine({ | |
id: 'sign-up-flow', | |
initial: 'invite_code', | |
context: { | |
invite_code: null, | |
phone_number: null, | |
email: null | |
}, | |
states: { | |
invite_code: { | |
on: { | |
ENTER_CODE: 'phone_number', | |
NO_CODE: 'waitlist' | |
} | |
}, | |
phone_number: { | |
on: { | |
ENTER_PHONE: 'email', | |
} | |
}, | |
email: { | |
on: { | |
ENTER_EMAIL: 'password', | |
// now if email exists or not depends | |
} | |
}, | |
password: { | |
on: { | |
ENTER_PASSWORD: 'logged_in_home' | |
} | |
}, | |
logged_in_home: { | |
type: 'final' | |
}, | |
waitlist: { | |
on: { | |
ENTER_EMAIL: 'waitlist_success' | |
} | |
}, | |
waitlist_success: {} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment