Created
December 4, 2019 17:06
-
-
Save adamkl/7d330c85851afd990632f31c95318dc8 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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 | |
// - XState (all XState exports) | |
const fetchMachine = Machine({ | |
id: "hiring_pipeline", | |
context: { | |
phone_screen_score: null, | |
hacker_rank_score: null, | |
fit_score: null, | |
codepair_score: null | |
}, | |
initial: "new", | |
states: { | |
new: { | |
on: { | |
START: "phone_screen_pending" | |
} | |
}, | |
phone_screen_pending: { | |
on: { | |
PHONE_SCREEN_COMPLETE: [ | |
{ | |
target: "no_hire", | |
cond: (_, { score }) => score < 60 | |
}, | |
{ | |
target: "hacker_rank_pending", | |
actions: assign((_, { score }) => ({ phone_screen_score: score })) | |
} | |
] | |
} | |
}, | |
hacker_rank_pending: { | |
on: { | |
HACKER_RANK_COMPLETE: [ | |
{ | |
target: "no_hire", | |
cond: (_, { score }) => score < 60 | |
}, | |
{ | |
target: "in_person_pending", | |
actions: assign((_, { score }) => ({ hacker_rank_score: score })) | |
} | |
] | |
} | |
}, | |
in_person_pending: { | |
type: "parallel", | |
onDone: "hire", | |
states: { | |
fit_interview: { | |
initial: "pending", | |
states: { | |
pending: { | |
on: { | |
FIT_INTERVIEW_COMPLETE: [ | |
{ | |
target: "#hiring_pipeline.no_hire", | |
cond: (_, { score }) => score < 60 | |
}, | |
{ | |
target: "complete", | |
actions: assign((_, { score }) => ({ | |
fit_score: score | |
})) | |
} | |
] | |
} | |
}, | |
complete: { | |
type: "final" | |
} | |
} | |
}, | |
codepair_interview: { | |
initial: "pending", | |
states: { | |
pending: { | |
on: { | |
CODEPAIR_COMPLETE: [ | |
{ | |
target: "#hiring_pipeline.no_hire", | |
cond: (_, { score }) => score < 60 | |
}, | |
{ | |
target: "complete", | |
actions: assign((_, { score }) => ({ | |
codepair_score: score | |
})) | |
} | |
] | |
} | |
}, | |
complete: { | |
type: "final" | |
} | |
} | |
} | |
} | |
}, | |
hire: { | |
type: "final" | |
}, | |
no_hire: { | |
type: "final" | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment