Skip to content

Instantly share code, notes, and snippets.

@harunsmrkovic
Created July 16, 2021 12:16
Show Gist options
  • Save harunsmrkovic/ccb79fa486295a066514b75e96c58480 to your computer and use it in GitHub Desktop.
Save harunsmrkovic/ccb79fa486295a066514b75e96c58480 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: "contestEntry",
initial: "visualVerificationReceipt",
states: {
visualVerificationSelfie: {
on: {
VERIFY: "instantWinSelfieStart",
REJECT: "manualVerifySelfieQuery"
}
},
visualVerificationReceipt: {
on: {
VERIFY: "instantWinStart",
REJECT: "manualVerifyReceiptQuery"
}
},
manualVerifySelfieQuery: {
on: {
REQUEST_MANUAL: "manualVerifySelfieRequested",
GIVE_UP: "ineligibleEntry",
RETRY: "visualVerificationSelfie"
}
},
manualVerifyReceiptQuery: {
on: {
REQUEST_MANUAL: "manualVerifyReceiptRequested",
GIVE_UP: "ineligibleEntry",
RETRY: "visualVerificationReceipt"
}
},
manualVerifySelfieRequested: {
on: {
VERIFY: "instantWinSelfieStart",
REJECT: "ineligibleEntry"
}
},
manualVerifyReceiptRequested: {
on: {
VERIFY: "instantWinStart",
REJECT: "ineligibleEntry"
}
},
instantWinSelfieStart: {
on: {
VALID: "userDataEntry",
LOSE: "visualVerificationReceipt"
}
},
instantWinStart: {
on: {
VALID: "userDataEntry",
LOSE: "lost"
}
},
operatorWinVerify: {
on: {
VERIFY: "won",
REJECT: "ineligibleEntry"
}
},
userDataEntry: {
on: {
VERIFY: "operatorWinVerify",
REJECT: "ineligibleEntry"
}
},
ineligibleEntry: {
type: "final"
},
lost: {
on: {
RETRY: "instantWinStart"
}
},
won: {
on: {
RETRY: "instantWinStart"
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment