Skip to content

Instantly share code, notes, and snippets.

@harunsmrkovic
Last active July 29, 2021 17:07
Show Gist options
  • Save harunsmrkovic/cce74686a0aecd792b6d748da1c09fdf to your computer and use it in GitHub Desktop.
Save harunsmrkovic/cce74686a0aecd792b6d748da1c09fdf 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: "visualVerificationSmile",
states: {
// Visual verifications
visualVerificationSmile: {
on: {
VERIFY: "instantWinStart",
REJECT: "manualVerifySmileQuery"
}
},
visualVerificationReceipt: {
on: {
VERIFY: "instantWinStart",
REJECT: "manualVerifyReceiptQuery"
}
},
// Manual Query
manualVerifySmileQuery: {
on: {
REQUEST_MANUAL: "manualVerifySmileRequested",
RETRY: "visualVerificationSmile"
}
},
manualVerifyReceiptQuery: {
on: {
REQUEST_MANUAL: "manualVerifyReceiptRequested",
RETRY: "visualVerificationReceipt"
}
},
// Manual Query Requested
manualVerifySmileRequested: {
on: {
VERIFY: "instantWinStart",
REJECT: "ineligibleEntry"
}
},
manualVerifyReceiptRequested: {
on: {
VERIFY: "instantWinStart",
REJECT: "ineligibleEntry"
}
},
// Instant Win
instantWinStart: {
on: {
VALID: "userDataEntry",
LOSE: "lost"
}
},
operatorWinVerify: {
on: {
VERIFY: "won",
REJECT: "ineligibleEntry"
}
},
userDataEntry: {
on: {
VERIFY: "operatorWinVerify"
}
},
ineligibleEntry: {
type: "final"
},
lost: {
on: {
RETRY: "visualVerificationReceipt",
RETRY_IW: "instantWinStart"
}
},
won: {
on: {
RETRY: "visualVerificationReceipt"
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment