Skip to content

Instantly share code, notes, and snippets.

@niquepa
Last active August 30, 2021 16:38
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 niquepa/44bfed1d68e1032958dd9d1a09a32f3c to your computer and use it in GitHub Desktop.
Save niquepa/44bfed1d68e1032958dd9d1a09a32f3c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const contractMachine = Machine({
id: 'contracts',
initial: 'created',
context: {},
states: {
created: {
on: {
SAVE: 'created',
SUBMIT: 'estimated',
DELETE: 'created',
DEACTIVATE: 'inactive'
}
},
estimated: {
on: {
SAVE: 'created',
SUBMIT: 'draft',
DELETE: 'estimated',
DEACTIVATE: 'inactive'
}
},
draft: {
on: {
SAVE: 'draft',
REGISTER: 'active',
DELETE: 'draft',
DEACTIVATE: 'inactive'
}
},
active: {
on: {
EXTEND: 'extended',
RENEW: 'renewed',
COMPLETE: 'completed',
CANCEL: 'cancelled'
}
},
inactive: {
on: {
REACTIVATE: 'draft'
}
},
extended: {
on: {
SAVE: 'extended',
COMPLETE: 'completed',
CANCEL: 'cancelled'
}
},
renewed: {
on: {
SAVE: 'renewed',
COMPLETE: 'completed',
CANCEL: 'cancelled'
}
},
completed: {
type: 'final'
},
cancelled: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment