Skip to content

Instantly share code, notes, and snippets.

@HipsterBrown
Created January 26, 2021 20:48
Show Gist options
  • Save HipsterBrown/d3e5b4a36aebe3516fdc36bcf7af0a6a to your computer and use it in GitHub Desktop.
Save HipsterBrown/d3e5b4a36aebe3516fdc36bcf7af0a6a 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 plaidMachine = Machine({
id: 'plaid-link',
initial: 'loadingToken',
context: {
token: null
},
states: {
loadingToken: {
invoke: {
src: 'createPlaidLinkToken',
onDone: {
target: 'displayingWidget',
actions: assign({ token: (_context, event) => event.data })
},
onError: raise()
}
},
displayingWidget: {
on: {
LINK_SUCCESS: 'linkSuccessful',
LINK_ERROR: 'linkErrored'
}
},
linkSuccessful: {
on: {
LINK_COMPLETE: 'linkCompleted'
}
},
linkErrored: {
},
linkCompleted: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment