Skip to content

Instantly share code, notes, and snippets.

@awinograd

awinograd/machine.js

Created May 25, 2020
Embed
What would you like to do?
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": "welcome",
"initial": "Intro_explainAviva",
"context": {},
"states": {
"Intro_explainAviva": {
"meta": {
"text": [
"Hi. This app is called Aviva which is also my name.",
"I'm a chat based guide to help you through this app. I'm not a real human.",
"Before we begin, has anyone explained why you have been offered this app?"
]
},
"on": {
"": "MUX$Intro_whyOfferedInputs"
}
},
"MUX$Intro_whyOfferedInputs": {
"on": {
"": "Intro_whyOfferedInputs"
}
},
"Intro_whyOfferedInputs": {
"meta": {
"max": 1,
"min": 1,
"variant": "button",
"label": {
"0": "Yes",
"1": "No"
}
},
"on": {
"[\"Yes\"]": "SEQ$Intro_whyOffer_yes",
"[\"No\"]": "SEQ$Intro_whyOffer_no"
}
},
"SEQ$Intro_whyOffer_yes": {
"on": {
"": "Intro_whyOffer_yes"
}
},
"Intro_whyOffer_yes": {
"meta": {
"text": [
"That's great."
]
},
"on": {
"": "Intro_appPurpose"
}
},
"SEQ$Intro_whyOffer_no": {
"on": {
"": "Intro_whyOffer_no"
}
},
"Intro_whyOffer_no": {
"meta": {
"text": [
"Ok, let me explain.",
"This app is offered to people who have had thoughts about killing themselves or have tried to end their own life."
]
},
"on": {
"": "Intro_appPurpose"
}
},
"Intro_appPurpose": {
"meta": {
"text": [
"The main purpose of this app is to improve how you feel.",
"Doing sessions like the ones in this app has helped others feel better.",
"Has anyone described the app’s 10 sessions and how it works?"
]
},
"on": {
"": "MUX$Intro_appPurpose_MCQ"
}
},
"MUX$Intro_appPurpose_MCQ": {
"on": {
"": "Intro_appPurpose_MCQ"
}
},
"Intro_appPurpose_MCQ": {
"meta": {
"max": 1,
"min": 1,
"variant": "button",
"label": {
"0": "Yes",
"1": "No"
}
},
"on": {
"[\"Yes\"]": "SEQ$Intro_appPurpose_MCQ_Yes",
"[\"No\"]": "SEQ$Intro_sessionStructure"
}
},
"SEQ$Intro_appPurpose_MCQ_Yes": {
"on": {
"": "Intro_appPurpose_MCQ_Yes"
}
},
"Intro_appPurpose_MCQ_Yes": {
"meta": {
"text": [
"That's good.",
"To make things easy, we'll use the same format for every session.",
"Let's look at the three things we'll do in every session."
]
},
"on": {
"": "Intro_continueTo3Parts"
}
},
"SEQ$Intro_sessionStructure": {
"on": {
"": "Intro_sessionStructure"
}
},
"Intro_sessionStructure": {
"meta": {
"text": [
"Each session has the same structure so you’ll know what to expect.",
"My goal is to make it easy for you to learn new skills.",
"Each session we'll do the same three things. Ready to learn more about each thing?"
]
},
"on": {
"": "Intro_continueTo3Parts"
}
},
"Intro_continueTo3Parts": {
"meta": {
"min": 1,
"max": 1,
"variant": "button",
"label": {
"0": "Let's do it"
}
},
"on": {}
},
"Intro_sessionThreeParts": {
"meta": {
"text": [
"First, I’ll ask about your mood and review key parts of the prior session.",
"Second, we’ll learn a new skill.",
"Third, you’ll write down what you learned and plan to practice the new skill.",
"Ready to continue?"
]
},
"on": {
"": "Intro_continue"
}
},
"Intro_continue": {
"meta": {
"min": 1,
"max": 1,
"variant": "button",
"label": {
"0": "Continue"
}
},
"on": {}
},
"Intro_setup": {
"meta": {
"text": [
"We just have two more things to cover - confidentiality & contacts."
]
},
"on": {
"": "confidentiality"
}
},
"confidentiality": {
"meta": {
"text": [
"First, we want to discuss confidentiality."
]
},
"on": {
"": "confidentiality_cont"
}
},
"confidentiality_cont": {
"meta": {
"min": 1,
"max": 1,
"variant": "button",
"label": {
"0": "Got it"
}
},
"on": {}
},
"confidentiality_a": {
"meta": {
"text": [
"What we talk about on the app is confidential unless you say it's ok to share."
]
},
"on": {
"": "confidentiality_a_cont"
}
},
"confidentiality_a_cont": {
"meta": {
"min": 1,
"max": 1,
"variant": "button",
"label": {
"0": "Sounds good"
}
},
"on": {}
},
"confidentiality_b": {
"meta": {
"text": [
"Everything you enter is kept private."
]
},
"on": {
"": "confidentiality_b_cont"
}
},
"confidentiality_b_cont": {
"meta": {
"min": 1,
"max": 1,
"variant": "button",
"label": {
"0": "Makes sense"
}
},
"on": {}
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment