Last active
June 13, 2020 12:02
-
-
Save egluhbegovic/c55455155fb0262c1e20ee7b7dfa4941 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 renewalMachine = Machine({ | |
id: 'renewalActivity', | |
initial: 'idle', | |
states: { | |
// Blue Sky States | |
idle: { | |
on: { | |
REQUEST: 'requested' | |
} | |
}, | |
requested: { | |
on: { | |
APPROVE: 'initiated', | |
REJECT: 'userActionRequired' | |
} | |
}, | |
initiated: { | |
on: { | |
RECEIVED: 'received', | |
REJECT: 'userActionRequired' | |
} | |
}, | |
received: { | |
on: { | |
DELIVER: 'inDelivery', | |
} | |
}, | |
inDelivery: { | |
on: { | |
DONE: 'delivered', | |
FAIL: 'adminToReaction' | |
} | |
}, | |
delivered: { | |
on: { | |
UPDATE_LICENSE: 'licenseUpdated', | |
} | |
}, | |
licenseUpdated: { | |
type: 'final' | |
}, | |
// Error States | |
adminToReaction: { | |
on: { | |
ACTION: 'initiated', | |
RESUME_DELIVERY: 'inDelivery', | |
RECIEVE: 'received', | |
CANCEL: 'cancelled', | |
DELIVER: 'delivered', | |
REQUIRE_ACTION: 'userActionRequired', | |
} | |
}, | |
userActionRequired: { | |
on: { | |
RESOLVE: 'adminToReaction', | |
CANCEL: 'cancelled', | |
} | |
}, | |
cancelled: { | |
type: 'final' | |
}, | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment