Created
October 28, 2019 19:03
-
-
Save gustavo-depaula/8695016837366df77321bf8bcfbae405 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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 signatureMachine = Machine({ | |
id: 'signature', | |
initial: 'init', | |
context: { | |
signature: null, | |
isExpectedRecipient: null | |
}, | |
states: { | |
init: { | |
on: { | |
NEXT: 'signature', | |
BACK: { | |
actions: [ | |
sendParent('BACK') | |
] | |
} | |
} | |
}, | |
signature: { | |
on: { | |
BACK: 'init', | |
SAVE_SIGNATURE: { | |
target: 'confirmation', | |
actions: assign({ | |
signature: (_, { signature }) => signature | |
}) | |
} | |
} | |
}, | |
confirmation: { | |
on: { | |
BACK: 'signature', | |
CONFIRM_RECIPIENT: { | |
actions: [ | |
assign({ | |
isExpectedRecipient: (_, { isExpectedRecipient }) => | |
isExpectedRecipient | |
}), | |
sendParent('SIGNATURE.INFO',) | |
] | |
} | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment