import{createMachine,assign}from"@xstate/fsm";export const checkoutMachine=createMachine({id:"fetch",initial:"draft",context:{retries:3},states:{draft:{on:{PAID:"confirming",FINALIZE:"finalizing",FETCH:"updating",REJECT:"draft",LOCK:"locked"}},updating:{on:{RESOLVE:"draft",EXPIRE:"expired",REJECT:"draft",LOCK:"locked"}},finalizing:{on:{PAYING:"paying",REJECT:"draft",PAID:"confirming",TEST_MODE_RESTRICTED:"test_mode_restricted"}},paying:{on:{PAID:"confirming",REJECT:"draft"}},confirming:{on:{CONFIRMED:"confirmed"}},paid:{on:{CONFIRMED:"confirmed",REDIRECT:"redirecting",REJECT:"draft"}},expired:{},locked:{},confirmed:{on:{REDIRECT:"redirecting"}},test_mode_restricted:{},redirecting:{},failure:{on:{RETRY:{target:"updating",actions:assign({retries:e=>e.retries+1})}}}}});export default checkoutMachine;