Skip to content

Instantly share code, notes, and snippets.

@meetbryce
Last active June 16, 2020 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meetbryce/4c66763d47af23e907c83a804a2b85f6 to your computer and use it in GitHub Desktop.
Save meetbryce/4c66763d47af23e907c83a804a2b85f6 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id:'newOrder',
initial: 'DoesNotExist',
states: {
DoesNotExist: {
on: {
MB_create_order: 'UNSENT',
}
},
UNSENT: {
on: {
MB_send_order: 'QUEUED'
}
},
QUEUED: {
on: {
mailgun_started: 'SENDING'
}
},
SENDING: {
on: {
fail: 'SEND_FAILURE',
success_new_order: 'SENT',
success_revise_order: 'PENDING_REVISION',
success_cancel_order: 'PENDING_CANCELLATION',
}
},
SEND_FAILURE: {
type: 'final'
},
SENT: {
on: {
MB_send_revision: 'QUEUED',
// email_opened_by_non_tatari: 'SEEN',
PUB_approves: 'ACCEPTED',
}
},
// SEEN: {
// on: {
// MB_send_revision: 'QUEUED',
// PUB_approves_new_order: 'ACCEPTED',
// }
// },
ACCEPTED: {
on: {
MB_send_revision: 'QUEUED',
}
},
PENDING_REVISION: {
on: {
PUB_approves: 'ACCEPTED'
}
},
PENDING_CANCELLATION: {
on: {
PUB_approves: 'CANCELED'
}
},
CANCELED: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment