Skip to content

Instantly share code, notes, and snippets.

@harsilspatel
Last active August 26, 2021 04:50
Show Gist options
  • Save harsilspatel/e06a1d89290d3da04488c265a1bb9147 to your computer and use it in GitHub Desktop.
Save harsilspatel/e06a1d89290d3da04488c265a1bb9147 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: 'order-status',
initial: 'PENDING',
context: {
retries: 0,
},
states: {
PENDING: {
on: {
x: 'PENDING_PACKED',
y: 'PENDING_PICKED',
'Ready for Pickup': 'READY',
},
},
PENDING_PACKED: {
on: {
'Ready for Pickup': 'READY',
},
},
PENDING_PICKED: {
on: {
'Ready for Pickup': 'READY',
},
},
READY: {
on: {
'Customer Check-in': 'UNASSIGNED',
},
},
UNASSIGNED: {
on: {
'Attendant Acknowledged': 'ASSIGNED',
},
},
ASSIGNED: {
on: {
Complete: 'COMPLETE',
'Failed Complete': 'FAILEDCOMPLETE',
},
},
FAILEDCOMPLETE: {
on: {
Reset: 'PENDING',
},
},
HANDOVER: {
on: {},
},
COMPLETE: {
type: 'final',
},
CANCELLED: {
on: {},
},
STOCK_IN: {
on: {},
},
RETURNED: {
on: {},
},
PENDING_ALLOCATED: {
on: {},
},
READY_ALLOCATED: {
on: {},
},
DISPATCH: {
on: {},
},
ARRIVING: {
on: {},
},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment