Skip to content

Instantly share code, notes, and snippets.

@liborvanek
Created April 14, 2021 07:39
Show Gist options
  • Save liborvanek/cb88e94265d7979d36acedf6edaf3cde to your computer and use it in GitHub Desktop.
Save liborvanek/cb88e94265d7979d36acedf6edaf3cde 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: 'fetch',
initial: 'Waiting',
states: {
// Loading: {},
Waiting: {
on: {
INSTALL_AUTO_BY_USER: 'InstallingSecoByUser',
INSTALL_AUTO_BY_ADMIN: 'InstallingSecoByAdmin',
INSTALL_MANUALLY: 'InstallingManually',
},
},
// First installation initiated by user
// – from Coda's Instant delivery
// – from public web upon successful payment
FirstInstallSecoByUser: {
on: {
DELIVER: 'On',
AUTOINSTALL_FAIL: '',
},
},
// Automatic installation (via Seco) initiated by user with ADMIN role (sales/support/TTC)
// – from Coda's Instant delivery using ROLE_ADMIN
// – from Dapa (in the future)
FirstInstallSecoByAdmin: {
on: {
DELIVER: 'On',
},
},
// Installation performed traditionally by TTC, Seco not involved at all
FirstInstallManually: {
on: {
DELIVER: 'On',
CANCEL: 'On',
},
},
// Automatic reinstallation intiated by user, performed by Seco
// – from Coda
ReinstallSecoByUser: {
on: {
DELIVER: 'On',
CANCEL: 'On',
},
},
// Automatic reinstallation intiated by ADMIN role, performed by Seco
// – from Coda
// – from Dapa (in the future) after Coda Reinstall request
ReinstallSecoByAdmin: {
on: {
DELIVER: 'On',
CANCEL: 'On',
},
},
// Installation started via Seco, but could not proceed for various reasons
// Falls back to TTC intervention
SecoFailFallback: {
on: {
DELIVER: 'On',
CANCEL: 'On',
},
},
On: {},
Off: {},
Rebooting: {},
ShuttingDown: {},
PoweringOn: {},
InMaintenance: {},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment