Skip to content

Instantly share code, notes, and snippets.

@maxarias-io
Created March 24, 2022 17:34
Show Gist options
  • Save maxarias-io/f9c8a68911e2be6d399a875a90b674ea to your computer and use it in GitHub Desktop.
Save maxarias-io/f9c8a68911e2be6d399a875a90b674ea to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
"id": "Smart Banner Machine",
"initial": "idle",
"states": {
"idle": {
"entry": "Close all views",
"on": {
"new tab event": [
{
"cond": "should show first touch banner",
"target": "First Touch Banner"
},
{
"cond": "should show SMV",
"target": "Single Merchant View"
},
{
"target": "Home View"
}
],
"Click extension button": [
{
"cond": "recognized merchant",
"target": "Single Merchant View"
},
{
"target": "Home View"
}
]
}
},
"Home View": {
"entry": "navigate to Home",
"on": {
"Close": {
"target": "idle"
}
}
},
"Single Merchant View": {
"entry": "navigateto SMV view",
"on": {
"Close": [
{
"cond": "Should show FAB",
"target": "idle"
},
{
"target": "Floating Action Button"
}
]
}
},
"First Touch Banner": {
"entry": "navigate to FTB",
"on": {
"Close": {
"target": "idle"
}
}
},
"Floating Action Button": {
"entry": "Show the FAB view",
"on": {
"Show Codes": {
"target": "Single Merchant View"
},
"Close": {
"target": "idle"
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment