Skip to content

Instantly share code, notes, and snippets.

@egluhbegovic
Last active June 13, 2020 12:02
Show Gist options
  • Save egluhbegovic/c55455155fb0262c1e20ee7b7dfa4941 to your computer and use it in GitHub Desktop.
Save egluhbegovic/c55455155fb0262c1e20ee7b7dfa4941 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 renewalMachine = Machine({
id: 'renewalActivity',
initial: 'idle',
states: {
// Blue Sky States
idle: {
on: {
REQUEST: 'requested'
}
},
requested: {
on: {
APPROVE: 'initiated',
REJECT: 'userActionRequired'
}
},
initiated: {
on: {
RECEIVED: 'received',
REJECT: 'userActionRequired'
}
},
received: {
on: {
DELIVER: 'inDelivery',
}
},
inDelivery: {
on: {
DONE: 'delivered',
FAIL: 'adminToReaction'
}
},
delivered: {
on: {
UPDATE_LICENSE: 'licenseUpdated',
}
},
licenseUpdated: {
type: 'final'
},
// Error States
adminToReaction: {
on: {
ACTION: 'initiated',
RESUME_DELIVERY: 'inDelivery',
RECIEVE: 'received',
CANCEL: 'cancelled',
DELIVER: 'delivered',
REQUIRE_ACTION: 'userActionRequired',
}
},
userActionRequired: {
on: {
RESOLVE: 'adminToReaction',
CANCEL: 'cancelled',
}
},
cancelled: {
type: 'final'
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment