Skip to content

Instantly share code, notes, and snippets.

@gurdasnijor
Last active January 13, 2021 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gurdasnijor/4a3b6f79d297120240fc3323504416be to your computer and use it in GitHub Desktop.
Save gurdasnijor/4a3b6f79d297120240fc3323504416be to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine( {
initial: 'viewed_homepage',
states: {
viewed_homepage: {
meta: {
type: 'audience',
audience_ast: { }
},
after:[
{
delay: 1000,
target:
'viewed_tops_without_buy',
cond: () => true
},
{
delay: 1000,
target:
'viewed_pants_without_buy',
cond: () => false
}
]
},
viewed_tops_without_buy: {
on: {
"": [
{
target: 'viewed_tops_still_didnt_buy',
cond: () => true
},
{
target: 'finally_purchases_tops',
cond: () => false
}
]
}
},
viewed_pants_without_buy: {
on: {
"": [
{
target: 'viewed_pants_still_didnt_buy',
cond: () => true
},
{
target: 'finally_purchases_pants',
cond: () => false
}
]
}
},
viewed_tops_still_didnt_buy: {
},
finally_purchases_tops: {
},
viewed_pants_still_didnt_buy: {
},
finally_purchases_pants: {
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment