Last active
February 16, 2021 20:18
-
-
Save matthewlehner/4bf505dc07af6f670fdd714b6212cf07 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const applicantInfoStates = { | |
id: "applicantInfo", | |
initial: 'empty', | |
states: { | |
empty: { | |
on: { | |
START_NEW_APPLICATION: 'personalInfoForm' | |
} | |
}, | |
personalInfoForm: { | |
on: { | |
SUBMIT_PERSONAL_INFO: 'homeAddressForm', | |
} | |
}, | |
homeAddressForm: { | |
on: { | |
SUBMIT_HOME_ADDRESS: 'mailingAddressForm' | |
} | |
}, | |
mailingAddressForm: { | |
on: { | |
SUBMIT_MAILING_ADDRESS: 'identityPhotoUploadForm' | |
} | |
}, | |
identityPhotoUploadForm: { | |
on: { | |
SAVE_IDENTITY_PHOTOS: 'passportPhotoUploadForm' | |
} | |
}, | |
passportPhotoUploadForm: { | |
on: { | |
SAVE_PASSPORT_PHOTO: 'signatureCaptureForm' | |
} | |
}, | |
signatureCaptureForm: { | |
on: { | |
SIGN_DECLARATION: '#statusCardApplication.officeVerification.unverified', | |
} | |
} | |
} | |
}; | |
const applicationVerificationStates = { | |
initial: 'unverified', | |
states: { | |
unverified: { | |
on: { | |
REQUIRE_CHANGES: '#applicantInfo.personalInfoForm' | |
} | |
} | |
} | |
} | |
const statusCardApplicationMachine = Machine({ | |
id: "statusCardApplication", | |
initial: 'applicationLandingPage', | |
states: { | |
applicationLandingPage: { | |
on: { | |
NEW_APPLICATION: 'applicantInfo' | |
} | |
}, | |
applicantInfo: { | |
...applicantInfoStates | |
}, | |
officeVerification: { | |
...applicationVerificationStates | |
} | |
} | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment