Skip to content

Instantly share code, notes, and snippets.

@jesstelford
Last active August 27, 2019 05:27
Show Gist options
  • Save jesstelford/4d21a54a9bac2dcfe560d0b17ded4ac1 to your computer and use it in GitHub Desktop.
Save jesstelford/4d21a54a9bac2dcfe560d0b17ded4ac1 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Partial representation of old `publishStatus` & `reviewStatus` states in Legacy Vocal.
// See https://xstate.js.org/viz/?gist=6a25309b09bd2a70a9a678ca9ee7fa2b for the latest Replatform version.
const machineId = 'publishing';
const publishMachine = Machine({
id: machineId,
initial: 'draft',
states: {
draft: {
on: {
SUBMIT: 'submitted',
ARCHIVE: 'archived',
}
},
submitted: {
on: {
ARCHIVE: 'archived',
},
initial: 'needs_review',
states: {
needs_review: {
on: {
REVIEWING: 'in_review'
}
},
in_review: {
on: {
APPROVE: 'approved',
REJECT: 'not_approved'
}
},
approved: {
on: {
'': `#${machineId}.published`,
}
},
not_approved: {
on: {
'': `#${machineId}.draft`,
}
},
},
},
published: {
on: {
EDIT: 'draft',
ARCHIVE: 'archived',
}
},
archived: {
on: {
RESTORE: 'draft',
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment