Skip to content

Instantly share code, notes, and snippets.

@RafalFilipek
Last active March 30, 2020 14:08
Show Gist options
  • Save RafalFilipek/7f843c6dd2def59466584ac4f247d793 to your computer and use it in GitHub Desktop.
Save RafalFilipek/7f843c6dd2def59466584ac4f247d793 to your computer and use it in GitHub Desktop.
# Wyrazy rozpoczynające się od małej litery są stanami.
# 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
offerGroups
SELECT_OFFER_GROUP -> offers
offers
_entry - isMaintenance? -> maintenance
_entry - isSingleOfferInGroup? -> offerActionResolver
SELECT_OFFER -> offerActionResolver
offerActionResolver
_entry - isFix? -> fix
_entry -> mobile
fix
_entry_fix - isLoggedIn? -> adresses
_entry_fix - isExistingCustomer? -> authorization
_entry_fix -> localization
mobile
_entry_mobile -> procedures
procedures
# selectProcedure
_entry - validaNumberOfProcedures 1 -> procedureActionResolver
SELECT_PROCEDURE -> procedureActionResolver
procedureActionResolver
_entry - isRetentionProcedure? -> retention
_entry -> other
retention
_entry_retention - isNotLoggedIn? -> authorization
_entry_retention -> numbersList
other
_entry_other - isActivationProcedure? -> contracts
_entry_other -> authorization
adresses
_entry validAddressesCount? 0 -> localization
_entry validServicesCount? 0 -> error
SELECT_ADDRESS -> migration
SELECT_NEW_ADDRESS -> localization
localization
SELECT_LOCALIZATION -> contracts
migration
SELECT_PROCEDURE -> contracts
authorization
SUCCESS isFix? -> adresses
SUCCESS -> contracts
FAIL -> error
verification
SUCCESS -> contracts
FAIL -> error
contracts
love
CALL_ME_BACK -> final
other_contracts
ADD_DEVICE -> redirect
CONTINUE
mobile_contracts
isNotLoggedIn_withDiscounts? -> verification
voice
isRetention -> summary
isLogged? -> accounts
isNotLoggedIn? -> summary
# addToCart
other -> redirect
# addToCart
fix_contracts -> redirect
numbersList
_entry validNumberOfContracts? 0 -> error
#selectNumber
_entry validNumberOfContracts? 1 -> contracts
NUMBER_SELECT -> contracts
accounts
# addToCart
SELECT_ACCOUNT -> redirect
# addToCart
CREATE_NEW_ACCOUNT -> redirect
summary
ADD_CONTRACT -> procedures
SHOW_CART -> redirect
maintenance
error
redirect
final
function render(model){
let current_state_name = model.active_states[0].name;
return $("h1",
{style: {color: "darkBlue"}},
`The current state is: ${current_state_name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment