Last active
January 31, 2020 22:58
-
-
Save davidlav/24e7e532eda52e2448571b5fd0fa118c 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
Machine({ | |
id: 'registrationStateMachine', | |
initial: 'newRegistrationForm', | |
context: { | |
certified: false, | |
}, | |
states: { | |
newRegistrationForm: { | |
on: { | |
REGISTRATION_FORM_SUBMITTED: { | |
target: 'awaitingSponsorApproval', | |
actions: 'sendComplianceCertificationForm', | |
}, | |
}, | |
}, | |
awaitingSponsorApproval: { | |
entry: 'emailSponsor', | |
on: { | |
SPONSOR_DISAPPROVES: { | |
target: 'newRegistrationCanceled', | |
}, | |
SPONSOR_APPROVES: 'awaitingSysopsApproval', | |
}, | |
}, | |
awaitingSysopsApproval: { | |
entry: 'emailSysops', | |
on: { | |
SYSOPS_DISAPPROVES: { | |
target: 'newRegistrationCanceled', | |
}, | |
SYSOPS_APPROVES: 'awaitingCertification', | |
}, | |
}, | |
awaitingCertification: { | |
on: { | |
'': { | |
target: 'generateIPAAccount', | |
cond: 'certified' | |
} | |
} | |
}, | |
newRegistrationCanceled: { | |
type: 'final', | |
}, | |
generateIPAAccount: { | |
type: 'final', | |
entry: [ | |
'emailNewUserInfo', | |
'send2FASMS', | |
], | |
}, | |
}, | |
on: { | |
COMPLIANCE_CERTIFIED: { | |
actions: assign({ | |
certified: ctx => ctx.certified = true | |
}) | |
} | |
} | |
}, { | |
guards: { | |
certified: ctx => ctx.certified === true | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment