Skip to content

Instantly share code, notes, and snippets.

@sseletskyy
Last active June 21, 2021 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sseletskyy/e67072b4b529f135a170bbc78fa6ec36 to your computer and use it in GitHub Desktop.
Save sseletskyy/e67072b4b529f135a170bbc78fa6ec36 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'investor',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
A_SYS_SENDS_EMAIL_VERIFICATION: 'a_email_pending'
}
},
a_email_pending: {
on: {
A_B_INV_CONFIRMS_EMAIL: 'b_payment_pending',
}
},
b_payment_pending: {
on: {
B_C_INV_RESERVES_LOTS: 'c_lots_reserved',
B_K_INV_BECOMES_PASSIVE: 'k_passive_investor',
B_O_SYS_INITS_GLOBAL_INVESTMENT_STOP: 'o_payment_cancelled_before_global_stop'
}
},
c_lots_reserved: {
on: {
C_B_INV_CANCELS_LOT_RESERVATION: 'b_payment_pending',
C_B_MAN_CANCELS_LOT_RESERVATION: 'b_payment_pending',
C_D_INV_INITS_PAYMENT: 'd_payment_initialized',
C_O_SYS_INITS_GLOBAL_INVESTMENT_STOP: 'o_payment_cancelled_before_global_stop'
}
},
d_payment_initialized: {
on: {
D_B_INV_CANCELS_LOT_RESERVATION: 'b_payment_pending',
D_B_MAN_CANCELS_LOT_RESERVATION: 'b_payment_pending',
D_E_PPL_APPROVES_PAYMENT: 'e_payment_active',
D_O_SYS_INITS_GLOBAL_INVESTMENT_STOP: 'o_payment_cancelled_before_global_stop'
}
},
e_payment_active: {
on: {
E_F_PPL_SUSPENDS_PAYMENT: 'f_payment_suspended',
E_G_PPL_CANCELS_PAYMENT: 'g_payment_cancelled',
E_H_PPL_EXPIRES_PAYMENT: 'h_payment_expired',
E_M_SYS_INITS_GLOBAL_INVESTMENT_STOP:
'm_payment_active_before_global_stop'
}
},
f_payment_suspended: {
on: {
F_E_PPL_ACTIVATES_PAYMENT: 'e_payment_active',
F_G_PPL_CANCELS_PAYMENT: 'g_payment_cancelled',
F_N_SYS_INITS_GLOBAL_INVESTMENT_STOP: 'n_payment_cancelled_by_global_stop'
}
},
g_payment_cancelled: {
on: {
G_B_INV_REQUESTS_REINVESTING: 'b_payment_pending',
G_I_INV_REQUESTS_INVESTMENTS_RETURN: 'i_investments_return_pending',
G_K_INV_RETURNS_LOTS: 'k_passive_investor',
G_O_SYS_INITS_GLOBAL_INVESTMENT_STOP: 'o_payment_cancelled_before_global_stop'
}
},
h_payment_expired: {
type: 'final'
},
i_investments_return_pending: {
on: {
I_J_MAN_CONFIRMS_INVESTMENTS_RETURN: 'j_disabled_investor',
I_K_MAN_CANCELS_INVESTMENTS_RETURN: 'k_passive_investor'
}
},
j_disabled_investor: {
type: 'final'
},
k_passive_investor: {
on: {
K_B_INV_REQUESTS_LOTS: 'b_payment_pending',
K_O_SYS_INITS_GLOBAL_INVESTMENT_STOP: 'o_payment_cancelled_before_global_stop'
},
},
l_vip_investor: {
type: 'final'
},
m_payment_active_before_global_stop: {
on: {
M_N_PPL_CANCELS_PAYMENT: 'n_payment_cancelled_by_global_stop',
}
},
n_payment_cancelled_by_global_stop: {
on: {
N_L_SYS_FINALIZE_INVESTMENTS: 'l_vip_investor'
}
},
o_payment_cancelled_before_global_stop: {
on: {
O_P_SYS_FINALIZE_INVESTMENTS: 'p_non_vip_investor'
}
},
p_non_vip_investor: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment