Skip to content

Instantly share code, notes, and snippets.

@epan
Last active June 18, 2020 17:26
Show Gist options
  • Save epan/76721b01d5f25154f5bbf36489566483 to your computer and use it in GitHub Desktop.
Save epan/76721b01d5f25154f5bbf36489566483 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// V4
// Transitions, assuming hasPrompts, no cancel, no fails, no loading (V4)
const simplifiedPromptsMachine = Machine({
id: 'simplifiedPrompts',
initial: 'closed',
states: {
closed: {
on: {
OPEN: 'addressList'
}
},
addressList: {
on: {
SELECT_EXISTING: 'consumerPromptSelect',
EDIT_EXISTING: 'consumerPromptEdit',
SELECT_NEW: 'consumerPromptNew'
}
},
addressEditNew: {
on: {
SAVE: 'closed',
ADJUST_PIN: 'changePinLocationNew'
}
},
addressEditExisting: {
on: {
SAVE: 'addressList',
ADJUST_PIN: 'changePinLocationNew'
}
},
changePinLocationNew: {
on: {
SAVE: 'addressEditNew'
}
},
changePinLocationExisting: {
on: {
SAVE: 'addressEditExisting'
}
},
changePinLocationSelect: {
on: {
SAVE: 'closed'
}
},
consumerPromptNew: {
on: {
AGREE: 'changePinLocationNew',
DECLINE: 'addressEditNew'
}
},
consumerPromptSelect: {
on: {
AGREE: 'changePinLocationSelect',
DECLINE: 'closed'
}
},
consumerPromptEdit: {
on: {
AGREE: 'changePinLocationExisting',
DECLINE: 'addressEditExisting'
}
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment