Skip to content

Instantly share code, notes, and snippets.

@harunsmrkovic
Last active May 21, 2021 14:32
Show Gist options
  • Save harunsmrkovic/b3edc6aa0f7ff0470832b248b2a128cb to your computer and use it in GitHub Desktop.
Save harunsmrkovic/b3edc6aa0f7ff0470832b248b2a128cb 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: 'instantwin',
initial: 'visualVerificationSelfie',
states: {
visualVerificationSelfie: {
on: {
VERIFY: 'instantWinSelfieStart',
REJECT: 'manualVerifySelfieQuery'
}
},
visualVerificationReceipt: {
on: {
VERIFY: 'instantWinStart',
REJECT: 'manualVerifyReceiptQuery'
}
},
manualVerifySelfieQuery: {
on: {
REQUEST_MANUAL: 'manualVerifySelfieRequested',
GIVE_UP: 'ineligibleEntry'
}
},
manualVerifyReceiptQuery: {
on: {
REQUEST_MANUAL: 'manualVerifyReceiptRequested',
GIVE_UP: 'ineligibleEntry'
}
},
manualVerifySelfieRequested: {
on: {
VERIFY: 'instantWinSelfieStart',
REJECT: 'ineligibleEntry'
}
},
manualVerifyReceiptRequested: {
on: {
VERIFY: 'instantWinStart',
REJECT: 'ineligibleEntry'
}
},
instantWinSelfieStart: {
on: {
WON: 'operatorWinVerify',
LOSE: 'visualVerificationReceipt'
}
},
instantWinStart: {
on: {
WON: 'operatorWinVerify',
LOSE: 'lost'
}
},
operatorWinVerify: {
on: {
VERIFY: 'userDataVerify',
REJECT: 'ineligibleEntry'
}
},
userDataVerify: {
on: {
VERIFY: 'won',
REJECT: 'ineligibleEntry'
}
},
ineligibleEntry: {
type: 'final'
},
lost: {
type: 'final'
},
won: {
type: 'final'
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment