Skip to content

Instantly share code, notes, and snippets.

@matthewlehner
Last active February 16, 2021 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewlehner/4bf505dc07af6f670fdd714b6212cf07 to your computer and use it in GitHub Desktop.
Save matthewlehner/4bf505dc07af6f670fdd714b6212cf07 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 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