Skip to content

Instantly share code, notes, and snippets.

@halostatue
Last active September 24, 2020 22:24
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 halostatue/52ec37cf025ba5093bc4de8b745051fa to your computer and use it in GitHub Desktop.
Save halostatue/52ec37cf025ba5093bc4de8b745051fa to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const agentInfo = {
offline: {
on: {
ONLINE: 'online',
GROUP: 'group'
}
},
group: {
on: {
ONLINE: 'online',
OFFLINE: 'offline'
}
},
online: {
on: {
GROUP: 'group',
OFFLINE: 'offline'
}
}
};
const chatPrompt = Machine({
id: 'chatPrompt',
initial: 'visible',
context: {
},
states: {
visible: {
type: 'compound',
initial: 'offline',
states: {
...agentInfo
/* online: {
type: 'compound',
initial: 'unavailable',
states: {
...agentInfo,
unavailable: {
on: {
AVAILABLE: 'available',
}
},
available: {
on: {
UNAVAILABLE: 'unavailable'
}
}
},
on: {
OFFLINE: 'offline'
}
},
offline: {
on: {
ONLINE: 'online'
}
}*/
},
on: {
CLOSE: 'hidden'
}
},
hidden: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment