Last active
January 11, 2021 23:42
-
-
Save trabianmatt/5d2a5d5ada02ae86b375d8ed7349e210 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
const fetchMachine = Machine({ | |
id: 'fetch', | |
initial: 'idle', | |
context: { | |
retries: 0, | |
}, | |
states: { | |
idle: { | |
on: { | |
OPEN: 'gettingUserIdFromDatabase', | |
}, | |
}, | |
gettingUserIdFromDatabase: { | |
on: { | |
PRESENT: 'checkingEnrollment', | |
NOT_PRESENT: 'enrollment', | |
}, | |
}, | |
checkingEnrollment: { | |
on: { | |
ENROLLED: 'reconcilingAccounts', | |
NOT_ENROLLED: 'enrollment', | |
}, | |
}, | |
reconcilingAccounts: { | |
initial: 'fetchingFundingSources', | |
onDone: 'sso', | |
states: { | |
fetchingFundingSources: { | |
onDone: 'comparingFundingSources', | |
}, | |
comparingFundingSources: { | |
on: { | |
MATCH: 'complete', | |
NO_MATCH: 'addingMissingFundingSources', | |
}, | |
}, | |
addingMissingFundingSources: { | |
on: { | |
COMPLETE: 'complete', | |
}, | |
}, | |
complete: { | |
type: 'final', | |
}, | |
}, | |
}, | |
sso: { | |
initial: 'fetchingSSO', | |
states: { | |
fetchingSSO: { | |
onDone: 'presentingSSO', | |
}, | |
presentingSSO: {}, | |
}, | |
}, | |
enrollment: { | |
onDone: 'sso', | |
initial: 'presentingTermsAndConditions', | |
states: { | |
presentingTermsAndConditions: { | |
on: { | |
ACCEPT: 'savingTermsAndConditions', | |
}, | |
}, | |
savingTermsAndConditions: { | |
onDone: 'addingConsumer', | |
}, | |
addingConsumer: { | |
onDone: 'addingFundingProfile', | |
}, | |
addingFundingProfile: { | |
onDone: 'complete', | |
}, | |
complete: { | |
type: 'final', | |
}, | |
}, | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment