Skip to content

Instantly share code, notes, and snippets.

@camwest
Created August 26, 2020 20:28
Show Gist options
  • Save camwest/2e3928b8a89da6ae7f70470df6f641ee to your computer and use it in GitHub Desktop.
Save camwest/2e3928b8a89da6ae7f70470df6f641ee 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": "#Logged In",
},
},
"Create Account": {
id: "Create Account",
states: {
"Validate Email": {
id: "Validate Email",
states: {},
on: { "enter correct token": "#Logged In" },
},
},
initial: "Validate Email",
},
"Logged In": {
id: "Logged In",
states: {
"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",
type: "parallel",
states: {
"Data Commitments": {
id: "Data Commitments",
initial: "Commitments Available?",
states: {
"Commitments Available?": {
id: "Commitments Available?",
states: {},
on: {
no: "#No Commitments Available",
yes: "#Commitments Available",
},
},
"Commitments Available": {
id: "Commitments Available",
states: {},
on: {
"connect app": "#Connect App",
},
},
"No Commitments Available": {
id: "No Commitments Available",
states: {},
},
"Connect App": {
id: "Connect App",
states: {},
on: { done: "#Commitments Available?" },
},
},
},
"Grace Period": {
id: "Grace Period",
initial: "Active?",
states: {
"Active?": {
id: "Active?",
on: {
"No Grace Period": "#Inactive",
"In Grace Period": "#Active",
},
},
Inactive: {
id: "Inactive",
},
Active: {
id: "Active",
},
},
},
},
},
Profile: {
id: "Profile",
initial: "Index",
on: {
Back: "#Index",
},
states: {
Index: {
id: "Index",
on: {
Fees: "Fees",
},
},
Fees: {
id: "fees",
},
},
},
},
initial: "Data Vault",
on: {
"data vault": "#Data Vault",
investing: "#Investing Screen",
profile: "#Profile",
},
},
},
initial: "Core App",
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: "Investment Automatically Rebalances",
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