Skip to content

Instantly share code, notes, and snippets.

@tmikeschu
Last active May 3, 2021 20:06
Show Gist options
  • Save tmikeschu/c207e01e8c06d254a7b10b74d0a54eb5 to your computer and use it in GitHub Desktop.
Save tmikeschu/c207e01e8c06d254a7b10b74d0a54eb5 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: 'workflow-limits',
initial: 'userIsFree',
context: {
retries: 0
},
states: {
userIsFree: {
on: {
YES: "freeContactAdmin",
NO: "proOrEnterprise"
}
},
freeContactAdmin: {
type: "final"
},
proOrEnterprise: {
on: {
YES: "continue",
NO: "isFreeTrial"
}
},
continue: {
type: "final"
},
isFreeTrial: {
on: {
YES: "continue",
NO: "atWorkflowLimit"
}
},
atWorkflowLimit: {
on: {
YES: "modify",
NO: "continue"
}
},
modify: {
on: {
EDIT: "workflowIsFirst5",
CREATE: "isFullMember",
UNARCHIVE: "isFullMember",
}
},
workflowIsFirst5: {
on: {
YES: "continue",
NO: "isFullMember",
}
},
isFullMember: {
on: {
YES: "fullContactAdmin",
NO: "adminPaywall"
}
},
fullContactAdmin: {
type: "final"
},
adminPaywall: {
type: "final",
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment