Skip to content

Instantly share code, notes, and snippets.

@tav
Created January 24, 2021 21:24
Show Gist options
  • Save tav/a96d2595dde10b97004d443329930896 to your computer and use it in GitHub Desktop.
Save tav/a96d2595dde10b97004d443329930896 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
"id": "root",
"states": {
"Propit Platform": {
"id": "Propit Platform",
"states": {
"Authenticated?": {
"id": "Authenticated?",
"states": {},
"on": {
"no?": "#Anonymous Visitor",
"yes?": "#Authenticated User"
}
},
"Anonymous Visitor": {
"id": "Anonymous Visitor",
"states": {},
"on": {
"login": "#Login",
"signup": "#Signup"
}
},
"Authenticated User": {
"id": "Authenticated User",
"states": {
"Products List": {
"id": "Products List",
"states": {},
"on": {
"view product": "#Product Page"
}
},
"Product Page": {
"id": "Product Page",
"states": {
"Product Info": {
"id": "Product Info",
"states": {},
"on": {
"invest": "#Check Funds?",
"view updates": "#Product Updates"
}
},
"Check Funds?": {
"id": "Check Funds?",
"states": {},
"on": {
"available?": "#Confirm Investment",
"unavailable?": "#Add Funds"
}
},
"Confirm Investment": {
"id": "Confirm Investment",
"states": {},
"on": {
"cancel": "#Product Info",
"confirm": "#Investment Info"
}
},
"Product Updates": {
"id": "Product Updates",
"states": {},
"on": {
"view product": "#Product Info"
}
}
},
"initial": "Product Info",
"on": {}
},
"Investor Dashboard": {
"id": "Investor Dashboard",
"states": {
"PayIn Bank Details": {
"id": "PayIn Bank Details",
"states": {}
},
"Auto Invest Settings": {
"id": "Auto Invest Settings",
"states": {},
"on": {
"confirm": "#Overview",
"disable": "#Overview"
}
},
"Self-Certify": {
"id": "Self-Certify",
"states": {},
"on": {
"cancel": "#Overview",
"confirm": "#Questionnaire"
}
},
"Overview": {
"id": "Overview",
"states": {}
},
"KYC Status?": {
"id": "KYC Status?",
"states": {},
"on": {
"failed?": "#Customer Support",
"info needed?": "#KYC",
"info provided?": "#Wait for Verification"
}
},
"Withdraw Funds": {
"id": "Withdraw Funds",
"states": {},
"on": {
"cancel": "#Investor Dashboard",
"confirm details": "#Investor Dashboard"
}
},
"Legal Documents": {
"id": "Legal Documents",
"states": {},
"on": {
"view investment": "#Investment Info"
}
},
"Investments": {
"id": "Investments",
"states": {},
"on": {
"view investment": "#Investment Info"
}
},
"Tested?": {
"id": "Tested?",
"states": {},
"on": {
"failed?": "#Overview",
"not tested?": "#Questionnaire",
"passed?": "#KYC Status?"
}
},
"Investment Info": {
"id": "Investment Info",
"states": {},
"on": {
"view legals": "#Legal Documents"
}
},
"Questionnaire": {
"id": "Questionnaire",
"states": {},
"on": {
"answer correctly": "#KYC",
"answer incorrectly": "#Overview"
}
},
"Add Funds": {
"id": "Add Funds",
"states": {},
"on": {
"unverified?": "#Verify Investor?",
"verified?": "#PayIn Bank Details"
}
},
"Wait for Verification": {
"id": "Wait for Verification",
"states": {},
"on": {
"failed verification": "#Customer Support",
"need more info": "#KYC",
"pending": "#Wait for Verification",
"verified": "#Add Funds"
}
},
"KYC": {
"id": "KYC",
"states": {},
"on": {
"cancel": "#Overview",
"provide kyc and aml details": "#Wait for Verification"
}
},
"Verify Investor?": {
"id": "Verify Investor?",
"states": {},
"on": {
"not self-certified?": "#Self-Certify",
"self-certified?": "#Tested?"
}
}
},
"initial": "Overview",
"on": {
"add funds": "#Add Funds",
"configure auto invest": "#Auto Invest Settings",
"view investments": "#Investments",
"withdraw funds": "#Withdraw Funds"
}
}
},
"initial": "Products List",
"on": {
"logout": "#Anonymous Visitor",
"view dashboard": "#Investor Dashboard",
"view products": "#Products List"
}
},
"Customer Support": {
"id": "Customer Support",
"states": {},
"on": {
"need kyc details": "#KYC"
}
},
"Info Page": {
"id": "Info Page",
"states": {}
},
"Login": {
"id": "Login",
"states": {},
"on": {
"fail?": "#Anonymous Visitor",
"success?": "#Authenticated User"
}
},
"Signup": {
"id": "Signup",
"states": {},
"on": {
"fail?": "#Anonymous Visitor",
"success?": "#Authenticated User"
}
}
},
"initial": "Authenticated?",
"on": {
"authenticated?": "#Authenticated?",
"view customer support": "#Customer Support",
"view info page": "#Info Page"
}
}
},
"initial": "Propit Platform",
"on": {}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment