Last active
August 30, 2021 16:38
-
-
Save niquepa/44bfed1d68e1032958dd9d1a09a32f3c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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