Skip to content

Instantly share code, notes, and snippets.

@xentek
Last active January 24, 2020 18:05
Show Gist options
  • Save xentek/b311b0247bb13f7ea578d3f761ee4f66 to your computer and use it in GitHub Desktop.
Save xentek/b311b0247bb13f7ea578d3f761ee4f66 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 contactMachine = Machine({
id: 'contact',
initial: 'new',
states: {
"new": {
on: {
INVITE: 'invited'
}
},
"import": {
on: {
INVITE: 'invited'
}
},
"invited": {
on: {
CONFIRM: "awaitingActivation"
},
},
"awaitingActivation": {
on: {
CONFIRM: "active"
},
},
"denied": {
on: {
APPROVE: "approved",
HOLD: "onHold"
}
},
"approved": {
on: {
PROCESS_APPROVAL: "awaitingActivation"
}
},
"onHold": {
on: {
DENY: 'denied',
APPROVE: 'approved'
}
},
active: {
on: {
DEACTIVATE: "inactive"
}
},
inactive: {
on: {
DELETE: "deleted",
ACTIVATE: "active"
}
},
pending: {
on: {
APPROVE: 'approved',
DENY: 'denied',
HOLD: 'onHold'
}
},
deleted: {
type: "final"
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment