Skip to content

Instantly share code, notes, and snippets.

@runeh
Created July 20, 2020 15:11
Show Gist options
  • Save runeh/e6c2dfa6addc04a139e1cd42eef20885 to your computer and use it in GitHub Desktop.
Save runeh/e6c2dfa6addc04a139e1cd42eef20885 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const stiftemaskinenMachine = Machine({
id: 'stiftemaskinen',
initial: 'pristine',
states: {
pristine: {
on: {
TOUCH_FORM: {
target: 'open',
},
},
exit: 'assignFoundingId',
},
reopened: {
on: {
'': {
target: 'open',
actions: ['resetSignatures', 'deleteDocuments'],
},
},
},
open: {
on: {
CONFIRM: { target: 'confirmed', cond: 'foundingIsComplete' },
SAVE: 'saving',
},
},
saving: {
on: {
'': 'open',
},
},
confirmed: {
entry: ['createDocuments'],
on: {
REOPEN: 'reopened',
FOUNDER_SIGNED: {
target: 'awaitingSignatures',
actions: ['addSignatureToFounding'],
},
},
},
awaitingSignatures: {
on: {
REOPEN_BY_SUPPORT: 'reopened',
SIGN: {
target: '',
actions: ['addSignatureToFounding'],
},
ALL_SIGNED: 'signed',
},
},
signed: {
on: {
REOPEN_BY_SUPPORT: 'reopened',
CREATE_FOLIO_ACCOUNT: 'folioOnbarding',
USE_OTHER_BANK: 'awaitingBankReceipt',
},
},
awaitingBankReceipt: {
on: {
REOPEN_BY_SUPPORT: 'reopened',
REQUEST_FOLIO_ACCOUNT: 'folioOnbarding',
UPLOAD_RECEIPT: 'awaitingAltinnSignature',
},
},
awaitingAltinnSignature: {
on: {
APPROVED_BY_BRREG: 'founded',
},
},
founded: { type: 'final' },
folioOnbarding: { type: 'final' },
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment