Skip to content

Instantly share code, notes, and snippets.

@kojinkai
Last active August 6, 2019 09:24
Show Gist options
  • Save kojinkai/0b594fa62472bc9cbc6f68f2384ec218 to your computer and use it in GitHub Desktop.
Save kojinkai/0b594fa62472bc9cbc6f68f2384ec218 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 fetchMachine = Machine({
id: 'consultation',
initial: 'greeter',
states: {
greeter: {
on: {
NEXT: {
target: 'insuranceTypeBinary',
},
},
meta: {
component: 'greeter',
},
},
insuranceTypeBinary: {
on: {
CREDIT: {
target: 'creditSliders',
},
FAMILY: {
target: 'familySizeRadio',
},
},
meta: {
component: 'radio',
},
},
creditSliders: {
on: {
SHOWADDON: {
target: 'familyAddon',
},
NEXT: {
target: 'insuranceRequirementsInput',
},
},
meta: {
component: 'inputSlider',
},
},
familyAddon: {
on: {
ACCEPT: {
target: 'familySizeRadio',
},
DENY: {
target: 'insuranceRequirementsInput',
},
},
meta: {
component: 'binarySelect',
},
},
creditAddon: {
on: {
ACCEPT: {
target: 'creditSliders',
},
DENY: {
target: 'insuranceRequirementsInput',
},
},
meta: {
component: 'binarySelect',
},
},
familySizeRadio: {
on: {
NEXT: {
target: 'familySliders',
},
},
meta: {
component: 'radio',
},
},
familySliders: {
on: {
SHOWADDON: {
target: 'creditAddon',
},
NEXT: {
target: 'insuranceRequirementsInput',
},
},
meta: {
component: 'inputSlider',
},
},
insuranceRequirementsInput: {
type: 'final',
meta: {
component: 'dualIconInput',
},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment