Last active
January 14, 2020 21:49
-
-
Save pckilgore/d7af9fdc4103f28e8256af2cf205460c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions | |
// - XState (all XState exports) | |
const contactMachine = Machine({ | |
id: 'contact', | |
initial: 'pending', | |
states: { | |
// AKA "Organic signup." | |
"new": { | |
on: { | |
INVITE: 'invited' | |
} | |
}, | |
"import": { | |
on: { | |
INVITE: 'invited' | |
} | |
}, | |
"invited": { | |
on: { | |
ACTIVATE: "active" | |
} | |
}, | |
"denied": { | |
on: { | |
APPROVE: "approved", | |
HOLD: "onHold" | |
} | |
}, | |
"approved": { | |
on: { | |
ACTIVATE: "active" | |
} | |
}, | |
"onHold": { | |
on: { | |
DENY: 'denied', | |
APPROVE: 'approved' | |
} | |
}, | |
active: { | |
on: { | |
DEACTIVATE: "inactive" | |
} | |
}, | |
inactive: { | |
on: { | |
DELETE: "deleted", | |
ACTIVATE: "active" | |
} | |
}, | |
pending: { | |
on: { | |
APPROVE: 'approved', | |
DENY: 'denied', | |
HOLD: 'onHold' | |
} | |
}, | |
deleted: { | |
type: "final" | |
} | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment