Last active
December 28, 2020 15:34
-
-
Save trabianmatt/3fa6c9d7ee5914e6a1a4cf60631c9f44 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: 'reconcilingAccounts', | |
NOT_PRESENT: 'checkingEnrollment', | |
}, | |
}, | |
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