Skip to content

Instantly share code, notes, and snippets.

@grabcode
Created June 13, 2020 07:42
Show Gist options
  • Save grabcode/193e720863e108e77778534975544e0a to your computer and use it in GitHub Desktop.
Save grabcode/193e720863e108e77778534975544e0a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const splitA = {
id: 'splitA',
initial: 'qualifStep',
states: {
qualifStep: {
on: {
NEXT: 'emailStep'
},
},
emailStep: {
on: {
NEXT: 'thanksStep'
},
},
thanksStep: {
type: 'final'
},
}
};
const cfoLink = {
id: 'cfoLink',
initial: 'demoStep',
states: {
demoStep: {
on: {
NEXT: 'followupStep'
},
},
followupStep: {
on: {
NEXT: 'thanksStep'
},
},
thanksStep: {
type: 'final'
},
}
};
const nonCfoLink = {
id: 'nonCfoLink',
initial: 'qualifStep',
states: {
qualifStep: {
on: {
NEXT: 'demoStep'
},
},
demoStep: {
on: {
NEXT: 'followupStep'
},
},
followupStep: {
on: {
NEXT: 'thanksStep'
},
},
thanksStep: {
type: 'final'
},
}
};
const splitB = {
id: 'splitB',
initial: 'utm',
states: {
utm: {
'': 'cfoLink'
},
cfoLink,
nonCfoLink
}
};
const fsm = Machine({
id: 'Complex',
initial: 'a/b test',
states: {
'a/b test': {
'': splitA
},
splitA,
splitB
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment