Skip to content

Instantly share code, notes, and snippets.

@luninr
Last active September 6, 2021 10:39
Show Gist options
  • Save luninr/27ab323126ff889b714b673acf491eb7 to your computer and use it in GitHub Desktop.
Save luninr/27ab323126ff889b714b673acf491eb7 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const consentMachine = Machine({
id: 'consent',
initial: 'init',
context: {
organizationId: 'orgId',
emailOrPhone: 'email@orphone.se',
},
states: {
init: {
on: {
FREELY_GIVEN: 'optIn',
LEGITIMATE_INTEREST: 'optIn',
UNSUBSCRIBE: 'optOut',
},
},
optIn: {
on: {
FREELY_GIVEN: 'optIn',
LEGITIMATE_INTEREST: 'optIn',
UNSUBSCRIBE: 'optOut',
}
},
optOut: {
on: {
FREELY_GIVEN: 'optIn',
LEGITIMATE_INTEREST: 'optOut',
UNSUBSCRIBE: 'optOut',
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment