Skip to content

Instantly share code, notes, and snippets.

@ajayullal
Last active January 27, 2021 13:51
Show Gist options
  • Save ajayullal/1ff37a368739a7b61914ab7efe0945f0 to your computer and use it in GitHub Desktop.
Save ajayullal/1ff37a368739a7b61914ab7efe0945f0 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: 'Create SSL Quote',
initial: 'Home',
states: {
Home: {
on: {
'Create SSL Quote Button Click': 'Opportunities'
}
},
Opportunities: {
on: {
'Search account': 'Opportunities.Display accounts list',
'Click on next': 'Contract'
},
initial: 'Display Selected Account',
states: {
'Display accounts list': {
entry: ['fetch accounts'],
on: {
'Select Account': 'Display Selected Account',
'Clear selected account': 'Disable next button'
}
},
'Display Selected Account': {
entry: ['Display placeholder text if no account is selected',
'List account opportunities'
]
},
'List account opportunities': {
entry: ['fetch account opportunities'],
on: {
'Select': 'Enable next button'
}
},
'Enable next button': {
},
'Disable next button': {}
}
},
Contract: {
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment