Skip to content

Instantly share code, notes, and snippets.

@Swizec
Last active Jul 31, 2020
Embed
What would you like to do?
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const insuranceVerificationMachine = Machine({
id: 'step3uiSwitchingMachine',
initial: 'initial',
states: {
initial: {
on: {
YES: 'eligible',
NO: 'ineligible',
TENTATIVE: 'tentative'
},
meta: {
showForm: true,
showVerifiedWidget: false,
showPaymentWidgets: false,
insuranceVerified: false
}
},
eligible: {
on: {
YES_INSURANCE: 'usingInsurance',
NO_INSURANCE: 'notUsingInsurance'
},
meta: {
showForm: true,
showVerifiedWidget: false,
showPaymentWidgets: false,
insuranceVerified: false
}
},
ineligible: {
meta: {
showForm: false,
showVerifiedWidget: false,
showPaymentWidgets: true,
insuranceVerified: false
}
},
tentative: {
on: {
YES_INSURANCE: 'usingInsurance',
NO_INSURANCE: 'notUsingInsurance'
},
meta: {
showForm: true,
showVerifiedWidget: false,
showPaymentWidgets: false,
insuranceVerified: false
}
},
usingInsurance: {
on: {
VERIFIED: 'insuranceVerified',
NO_INSURANCE: 'notUsingInsurance'
},
meta: {
showForm: true,
showVerifiedWidget: false,
showPaymentWidgets: false,
insuranceVerified: false
}
},
notUsingInsurance: {
on: {
YES_INSURANCE: 'usingInsurance'
},
meta: {
showForm: false,
showVerifiedWidget: false,
showPaymentWidgets: true,
insuranceVerified: false
}
},
insuranceVerified: {
on: {
NO_INSURANCE: 'notUsingInsurance'
},
meta: {
showForm: true,
showVerifiedWidget: true,
showPaymentWidgets: true,
insuranceVerified: true
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment