Skip to content

Instantly share code, notes, and snippets.

@pinhopro
Last active August 14, 2021 03:52
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 pinhopro/fdb5e379cdd8b2723876993ee2929ab2 to your computer and use it in GitHub Desktop.
Save pinhopro/fdb5e379cdd8b2723876993ee2929ab2 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'fetch',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
CRIA_LINK_EXCLUSIVO_DE_CADASTRO: 'aguardando_preenchimento_cadastro',
CLIENTE_PREENCHE_LINK_GENERICO: 'em_analise'
}
},
aguardando_preenchimento_cadastro: {
on: {
PRAZO_PREENCHIMENTO_EXPIRA: 'link_exclusivo_expirado',
RECUSA_PREENCHIMENTO: 'recusado_preenchimento_pelo_cliente',
CLIENTE_PREENCHE_LINK_EXCLUSIVO: 'em_analise',
CANCELAR_LINK_EXCLUSIVO:
'link_exclusivo_cancelado'
}
},
link_exclusivo_cancelado: {
on: {
DENUCIA: 'link_exclusivo_cancelado',
REATIVAR_LINK_EXCLUSIVO: 'aguardando_preenchimento_cadastro'
}
},
link_exclusivo_expirado: {
on: {
DENUCIA: 'link_exclusivo_expirado',
RECUSA_PREENCHIMENTO: 'recusado_preenchimento_pelo_cliente',
CLIENTE_PREENCHE_LINK_EXCLUSIVO: 'em_analise',
CANCELAR_LINK_EXCLUSIVO:
'link_exclusivo_cancelado'
}
},
recusado_preenchimento_pelo_cliente: {
on: {
DENUCIA: 'recusado_preenchimento_pelo_cliente',
CLIENTE_PREENCHE_LINK_EXCLUSIVO: 'em_analise',
CANCELAR_LINK_EXCLUSIVO:
'link_exclusivo_cancelado'
}
},
em_analise: {
on:{
ADICIONA_COMO_CLIENTE: 'aceito',
DENUCIA: 'em_analise',
BLOQUEIA: 'bloqueado'
}
},
bloqueado: {
on: {
DESBLOQUEIA: 'em_analise',
DENUCIA: 'bloqueado'
}
},
aceito: {
on: {
DENUCIA: 'aceito',
BLOQUEIA: 'bloqueado'
}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment