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
Machine({ | |
strict: true, | |
id: "suflerMachine", | |
context: { | |
config: { | |
shouldLoadUserTransactions: false, | |
market: "B2C" | |
}, | |
user: { | |
isLoggedIn: true, |
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
const m = Machine({ | |
initial: "initializing", | |
context: { | |
processing: false, | |
}, | |
states: { | |
initializing: { | |
invoke: { | |
src: "fetchAccounts", | |
onDone: { target: "ready" }, |
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 |
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
const m = Machine({ | |
initial: 'initializing', | |
context: { | |
processing: false | |
}, | |
states: { | |
initializing: { | |
invoke: { | |
src: 'fetchAccounts', |
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 |
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
const m = Machine({ | |
initial: "initializing", | |
states: { | |
initializing: { | |
invoke: { | |
src: "fetch", | |
onDone: "ready", | |
}, | |
}, | |
ready: { |
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
const auth = Machine({ | |
id: 'auth', | |
initial: 'idle', | |
context: { | |
strategy: 'phone', | |
availableStrategies: ['phone', 'email'] | |
}, | |
states: { | |
idle: { |
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
const m = Machine({ | |
id: 'offerActionResolver', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
'': [ | |
{ target: 'fix', cond: 'isFix'}, | |
{ target: "procedures"} | |
] |
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
import { createMachine, assign } from "xstate"; | |
type Context = { | |
groups: number[], | |
group: number | |
} | |
type Event = | |
| { type: "SELECT_OFFER_GROUP"; data: number } | |
| { type: "SET_GROUPS"; data: number[] }; |
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
# Wyrazy rozpoczynające się od małej litery są stanami. | |
# Wyrazy pisane wielkimi literami są akcjami. | |
# | |
# `_entry` - akcja wykonyana na wejściu do danego stanu | |
# `_entry_[suffix]` - akcja w wykonywana na wejściu do danego podstanu. Sufix jest niezbędny aby uniknąć kolizji nazw | |
# `_entry - condition? [value]` -> akcja wykonywana tylko gdy `condition [value]` jest spełniona | |
Sufler | |
Resolve* | |
_entry -> offerGroups |