Skip to content

Instantly share code, notes, and snippets.

@camwest
Last active August 20, 2020 21:15
Show Gist options
  • Save camwest/b3fe25e702e60014594fe34b1775352e to your computer and use it in GitHub Desktop.
Save camwest/b3fe25e702e60014594fe34b1775352e to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: "root",
states: {
Delphia: {
id: "Delphia",
states: {
"iOS App": {
id: "iOS App",
states: {
"Logged Out": {
id: "Logged Out",
states: {},
on: {
"create account": "#Create Account",
login: "#Logged In",
"sign in with apple": "#Accept Terms",
},
},
"Create Account": {
id: "Create Account",
states: {
"Validate Email": {
id: "Validate Email",
states: {},
on: { "enter correct token": "#Accept Terms" },
},
"Accept Terms": {
id: "Accept Terms",
states: {},
on: { accept: "#Logged In" },
},
},
initial: "Validate Email",
on: { "enter credentials": "#Validate Email" },
},
"Logged In": {
id: "Logged In",
states: {
"First Launch?": {
id: "First Launch?",
states: {},
on: { no: "#Core App", yes: "#Onboarding" },
},
Onboarding: {
id: "Onboarding",
states: {},
on: { done: "#Core App" },
},
"Core App": {
id: "Core App",
states: {
"Investing Screen": {
id: "Investing Screen",
states: {
"iOS Has Investment Account?": {
id: "iOS Has Investment Account?",
states: {},
on: {
no: "#No Investing Account",
yes: "#Native Coming Soon",
},
},
"Native Coming Soon": {
id: "Native Coming Soon",
states: {},
on: { "login to web": "#Web Application" },
},
"No Investing Account": {
id: "No Investing Account",
states: {},
on: { "open account": "#Web Application" },
},
},
initial: "iOS Has Investment Account?",
on: {},
},
"Data Vault": {
id: "Data Vault",
states: {
"Connections Available?": {
id: "Connections Available?",
states: {},
on: {
no: "#No Connections Available",
yes: "#Connections Available",
},
},
"Connections Available": {
id: "Connections Available",
states: {},
on: {
"connect bank": "#Connect App",
"connect email": "#Connect App",
"connect twitter": "#Connect App",
},
},
"No Connections Available": {
id: "No Connections Available",
states: {},
},
"Point Transactions": {
id: "Point Transactions",
states: {},
on: { close: "#Data Vault" },
},
"Data Dividends": {
id: "Data Dividends",
states: {},
on: { close: "#Data Vault" },
},
"Connect App": {
id: "Connect App",
states: {},
on: { done: "#Connections Available?" },
},
},
initial: "Connections Available?",
on: {
"view data dividends": "#Data Dividends",
"view point transactions": "#Point Transactions",
},
},
Profile: { id: "Profile", states: {} },
},
initial: "Investing Screen",
on: {
"data vault": "#Data Vault",
investing: "#Investing Screen",
profile: "#Profile",
},
},
},
initial: "First Launch?",
on: { "log out": "#Logged Out" },
},
},
initial: "Logged Out",
on: {},
},
},
initial: "iOS App",
on: {},
},
"Web Application": {
id: "Web Application",
states: {
"Web Has Investment Account?": {
id: "Web Has Investment Account?",
states: {},
on: {
funded: "#Account Funded",
no: "#No Custodian Account",
"not funded": "#No Funds",
},
},
"No Custodian Account": {
id: "No Custodian Account",
states: {},
on: { "open account": "#Active Custodian Account" },
},
"Active Custodian Account": {
id: "Active Custodian Account",
states: {
"CIP Approval": {
id: "CIP Approval",
states: {},
on: { approved: "#Link Bank" },
},
"Link Bank": {
id: "Link Bank",
states: {},
on: { "choose bank": "#No Funds" },
},
"No Funds": { id: "No Funds", states: {} },
"Account Funded": {
id: "Account Funded",
states: {
"Liquidation Pending": {
id: "Liquidation Pending",
states: {},
on: { "liquidation complete": "#Web Application" },
},
"Investment Automatically Rebalances": {
id: "Investment Automatically Rebalances",
states: {},
},
},
initial: "Liquidation Pending",
on: { "liquidate funds": "#Liquidation Pending" },
},
"Deposit Pending": {
id: "Deposit Pending",
states: {},
on: {
"deposit complete": "#Investment Automatically Rebalances",
},
},
},
initial: "CIP Approval",
on: {
"close account": "#No Custodian Account",
"create deposit": "#Deposit Pending",
},
},
},
initial: "Web Has Investment Account?",
on: {},
},
},
initial: "Delphia",
on: {},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment