Skip to content

Instantly share code, notes, and snippets.

@jonathanstiansen
Last active January 30, 2021 22:54
Show Gist options
  • Save jonathanstiansen/e5c502d9ec6554200923698b6a5921b4 to your computer and use it in GitHub Desktop.
Save jonathanstiansen/e5c502d9ec6554200923698b6a5921b4 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const component = Machine({
id: 'fill-component',
initial: 'captureMedia',
context: {
retries: 0
},
states: {
captureMedia: {
on: {
SET_RATING: 'description'
}
},
description: {
on: {
NEXT: 'attention',
}
},
attention: {
on: {NEXT: 'issues'}
},
issues: {
on: {NEXT: 'insuranceFields'}
},
insuranceFields: {
on: {HAS_REQUIRED: 'insuranceFieldName', NOT_REQUIRED: 'additionalFields'}
},
insuranceFieldName: { on: {NEXT: 'insuranceFieldDescription'}
},
insuranceFieldDescription: { on: {NEXT: 'insuranceFieldDescription'}
},
additionalFields: {
on: {
HAS_REQUIRED: 'additionalFieldsName', NOT_REQUIRED: 'additionalNotes'
}
},
additionalFieldsName: { on: {NEXT: 'additionalFieldsDescription'}
},
additionalFieldsDescription: { on: {NEXT: 'additionalNotes'}
},
additionalNotes: { on: {NEXT: 'complete'}
},
complete: {
state: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment