Created
August 10, 2020 16:07
-
-
Save kiurchv/3af917528b282e1c9d6ba82bbff5abcc to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const landingMachine = Machine({ | |
id: "Landing", | |
initial: "Welcome", | |
// TODO: Describe context | |
context: {}, | |
states: { | |
Welcome: { | |
on: { | |
FORWARD: "ProductInfo" | |
} | |
}, | |
ProductInfo: { | |
on: { | |
FORWARD: "LoanSimulator" | |
} | |
}, | |
LoanSimulator: { | |
on: { | |
FORWARD: { | |
target: "CreateAccount", | |
actions: "saveLoanData" | |
} | |
} | |
}, | |
CreateAccount: { | |
initial: "Start", | |
states: { | |
Start: { | |
on: { | |
FORWARD: "#Landing.PersonalData" | |
} | |
}, | |
ProfileCreated: { | |
on: { | |
FORWARD: "#Landing.EnterPhoneNumber" | |
} | |
}, | |
ProfileSecured: { | |
on: { | |
FORWARD: "#Landing.LoanApplication" | |
} | |
}, | |
LoanProposalReceived: { | |
on: { | |
FORWARD: "#Landing.IdentityVerification" | |
} | |
}, | |
IdentityVerified: {}, | |
IncomeProofProvided: {}, | |
ContractSigned: {} | |
} | |
}, | |
PersonalData: { | |
on: { | |
FORWARD: { | |
target: "Approvals", | |
actions: "savePersonalData" | |
}, | |
} | |
}, | |
Approvals: { | |
on: { | |
FORWARD: { | |
target: "CreateAccount.ProfileCreated", | |
actions: "saveApprovalsData" | |
} | |
} | |
}, | |
// Maybe this should be nested states? | |
// TermsAndConditions: {}, | |
// MarketingConsent: {}, | |
EnterPhoneNumber: { | |
on: { | |
FORWARD: { | |
target: "EnterPin", | |
actions: "savePhoneNumberData" | |
} | |
} | |
}, | |
EnterPin: { | |
initial: "InitialInput", | |
states: { | |
InitialInput: { | |
on: { | |
FORWARD: "ConfirmInput" | |
} | |
}, | |
ConfirmInput: { | |
on: { | |
FORWARD: { | |
target: "#Landing.ActualCreateAccount", | |
actions: "savePinData" | |
}, | |
} | |
} | |
} | |
}, | |
ActualCreateAccount: { | |
invoke: { | |
src: "createAccountOnCognito", | |
onDone: "ConfirmRegistration" | |
} | |
}, | |
ConfirmRegistration: { | |
on: { | |
// TODO: Simplified, describe actual flow | |
FORWARD: { | |
target: "CreateAccountSuccess" | |
} | |
} | |
}, | |
CreateAccountSuccess: { | |
on: { | |
FORWARD: { | |
target: "CreateAccount.ProfileSecured" | |
} | |
} | |
}, | |
LoanApplication: { | |
on: { | |
FORWARD: { | |
target: "CreditBureauApproval", | |
actions: "saveLoanApplicationData" | |
} | |
} | |
}, | |
CreditBureauApproval: { | |
on: { | |
// TODO: add missing steps | |
FORWARD: { | |
target: "CreateAccount.LoanProposalReceived" | |
} | |
} | |
}, | |
IdentityVerification: { | |
invoke: { | |
src: "verifyIdentity", | |
onDone: "IdentityVerificationSuccess" | |
} | |
}, | |
IdentityVerificationSuccess: { | |
on: { | |
FORWARD: "CreateAccount.IdentityVerified" | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment