@@ -122,6 +122,7 @@ go.app = function() {
122122 var utils = require ( "seed-jsbox-utils" ) . utils ;
123123 var App = vumigo . App ;
124124 var Choice = vumigo . states . Choice ;
125+ var ChoiceState = vumigo . states . ChoiceState ;
125126 var EndState = vumigo . states . EndState ;
126127 var JsonApi = vumigo . http . api . JsonApi ;
127128 var MenuState = vumigo . states . MenuState ;
@@ -220,46 +221,54 @@ go.app = function() {
220221 self . add ( "state_customer_satisfaction" , function ( name ) {
221222 var wa_pulse_survey_started = "Yes" ;
222223 self . im . user . set_answer ( 'wa_pulse_survey_started' , wa_pulse_survey_started ) ;
223- return new MenuState ( name , {
224+ return new ChoiceState ( name , {
224225 question : $ (
225226 "How satisfied are you with MomConnect service? Reply with: "
226227 ) ,
227228 error : $ ( [
228229 "Sorry, we don't understand. Please try again."
229230 ] . join ( "\n" ) ) ,
230231 choices : [
231- new Choice ( "state_csat_lower" , $ ( "Very dissatisfied" ) ) ,
232- new Choice ( "state_csat_lower" , $ ( "Dissatisfied" ) ) ,
233- new Choice ( "state_csat_lower" , $ ( "Neutral" ) ) ,
234- new Choice ( "state_tas" , $ ( "Satisfied" ) ) ,
235- new Choice ( "state_tas" , $ ( "Very satisfied" ) ) ,
236- ]
232+ new Choice ( "very_dissatisfied" , $ ( "Very dissatisfied" ) ) ,
233+ new Choice ( "dissatisfied" , $ ( "Dissatisfied" ) ) ,
234+ new Choice ( "neutral" , $ ( "Neutral" ) ) ,
235+ new Choice ( "satisfied" , $ ( "Satisfied" ) ) ,
236+ new Choice ( "very_satisfied" , $ ( "Very satisfied" ) ) ,
237+ ] ,
238+ next : function ( choice ) {
239+ if ( choice . value === "very_dissatisfied" || choice . value === "dissatisfied" || choice . value === "neutral" ) {
240+ return "state_csat_lower" ;
241+ } else {
242+ return "state_tas" ;
243+ }
244+ }
237245 } ) ;
238246 } ) ;
239247
240248 self . add ( "state_csat_lower" , function ( name ) {
241- return new MenuState ( name , {
249+ return new ChoiceState ( name , {
242250 question : $ (
243251 "Sorry to hear that. Tell us why:"
244252 ) ,
245253 error : $ ( [
246254 "Sorry, we don't understand. Please try again."
247255 ] . join ( "\n" ) ) ,
248256 choices : [
249- new Choice ( "state_tas" , $ ( "Info not useful" ) ) ,
250- new Choice ( "state_tas" , $ ( "Too many messages" ) ) ,
251- new Choice ( "state_tas" , $ ( "Slow replies" ) ) ,
252- new Choice ( "state_tas" , $ ( "Boring" ) ) ,
253- new Choice ( "state_tas" , $ ( "Too many questions" ) ) ,
254- new Choice ( "state_tas" , $ ( "Confusing" ) ) ,
255- new Choice ( "state_tas" , $ ( "Disrespect" ) ) ,
256- new Choice ( "state_tas" , $ ( "Other" ) ) ,
257- ]
257+ new Choice ( "info_not_useful" , $ ( "Info not useful" ) ) ,
258+ new Choice ( "too_many_messages" , $ ( "Too many messages" ) ) ,
259+ new Choice ( "slow_replies" , $ ( "Slow replies" ) ) ,
260+ new Choice ( "boring" , $ ( "Boring" ) ) ,
261+ new Choice ( "too_many_questions" , $ ( "Too many questions" ) ) ,
262+ new Choice ( "confusing" , $ ( "Confusing" ) ) ,
263+ new Choice ( "disrespect" , $ ( "Disrespect" ) ) ,
264+ new Choice ( "other" , $ ( "Other" ) ) ,
265+ ] ,
266+ next : "state_tas"
258267 } ) ;
259268 } ) ;
260269
261270 self . add ( "state_tas" , function ( name ) {
262- return new MenuState ( name , {
271+ return new ChoiceState ( name , {
263272 question : $ (
264273 "Show much do you agree or disagree: " +
265274 "I trust the information from MomConnect"
@@ -268,17 +277,24 @@ go.app = function() {
268277 "Sorry, we don't understand. Please try again."
269278 ] . join ( "\n" ) ) ,
270279 choices : [
271- new Choice ( "state_tas_lower" , $ ( "Strongly Disagree" ) ) ,
272- new Choice ( "state_tas_lower" , $ ( "Disagree" ) ) ,
273- new Choice ( "state_tas_lower" , $ ( "Neutral" ) ) ,
274- new Choice ( "state_sentiment" , $ ( "Agree" ) ) ,
275- new Choice ( "state_sentiment" , $ ( "Strongly Agree" ) )
276- ]
280+ new Choice ( "strongly_disagree" , $ ( "Strongly Disagree" ) ) ,
281+ new Choice ( "disagree" , $ ( "Disagree" ) ) ,
282+ new Choice ( "neutral" , $ ( "Neutral" ) ) ,
283+ new Choice ( "agree" , $ ( "Agree" ) ) ,
284+ new Choice ( "strongly_agree" , $ ( "Strongly Agree" ) )
285+ ] ,
286+ next : function ( choice ) {
287+ if ( choice . value === "strongly_disagree" || choice . value === "disagree" || choice . value === "neutral" ) {
288+ return "state_tas_lower" ;
289+ } else {
290+ return "state_sentiment" ;
291+ }
292+ }
277293 } ) ;
278294 } ) ;
279295
280296 self . add ( "state_tas_lower" , function ( name ) {
281- return new MenuState ( name , {
297+ return new ChoiceState ( name , {
282298 question : $ (
283299 "Sorry you feel you can't trust the service. " +
284300 "Can you tell us why?"
@@ -287,16 +303,17 @@ go.app = function() {
287303 "Sorry, we don't understand. Please try again."
288304 ] . join ( "\n" ) ) ,
289305 choices : [
290- new Choice ( "state_sentiment" , $ ( "Worried about privacy" ) ) ,
291- new Choice ( "state_sentiment" , $ ( "Info is wrong" ) ) ,
292- new Choice ( "state_sentiment" , $ ( "No sources shown" ) ) ,
293- new Choice ( "state_sentiment" , $ ( "Other" ) )
294- ]
306+ new Choice ( "worried_about_privacy" , $ ( "Worried about privacy" ) ) ,
307+ new Choice ( "info_is_wrong" , $ ( "Info is wrong" ) ) ,
308+ new Choice ( "no_sources_shown" , $ ( "No sources shown" ) ) ,
309+ new Choice ( "other" , $ ( "Other" ) )
310+ ] ,
311+ next : "state_sentiment"
295312 } ) ;
296313 } ) ;
297314
298315 self . add ( "state_sentiment" , function ( name ) {
299- return new MenuState ( name , {
316+ return new ChoiceState ( name , {
300317 question : $ (
301318 "How does using this MomConnect service " +
302319 "make you feel?"
@@ -305,17 +322,18 @@ go.app = function() {
305322 "Sorry, we don't understand. Please try again."
306323 ] . join ( "\n" ) ) ,
307324 choices : [
308- new Choice ( "state_nps" , $ ( "Frustrated" ) ) ,
309- new Choice ( "state_nps" , $ ( "Confused" ) ) ,
310- new Choice ( "state_nps" , $ ( "Neutral" ) ) ,
311- new Choice ( "state_nps" , $ ( "Confident" ) ) ,
312- new Choice ( "state_nps" , $ ( "Empowered" ) )
313- ]
325+ new Choice ( "frustrated" , $ ( "Frustrated" ) ) ,
326+ new Choice ( "confused" , $ ( "Confused" ) ) ,
327+ new Choice ( "neutral" , $ ( "Neutral" ) ) ,
328+ new Choice ( "confident" , $ ( "Confident" ) ) ,
329+ new Choice ( "empowered" , $ ( "Empowered" ) )
330+ ] ,
331+ next : "state_nps"
314332 } ) ;
315333 } ) ;
316334
317335 self . add ( "state_nps" , function ( name ) {
318- return new MenuState ( name , {
336+ return new ChoiceState ( name , {
319337 question : $ (
320338 "How likely are you to recommend " +
321339 "MomConnect?"
@@ -324,17 +342,24 @@ go.app = function() {
324342 "Sorry, we don't understand. Please try again."
325343 ] . join ( "\n" ) ) ,
326344 choices : [
327- new Choice ( "state_nps_lower" , $ ( "Not at all likely" ) ) ,
328- new Choice ( "state_nps_lower" , $ ( "Unlikely" ) ) ,
329- new Choice ( "state_nps_lower" , $ ( "Neutral" ) ) ,
330- new Choice ( "state_trigger_rapidpro_flow" , $ ( "Likely" ) ) ,
331- new Choice ( "state_trigger_rapidpro_flow" , $ ( "Extremely likely" ) )
332- ]
345+ new Choice ( "not_at_all_likely" , $ ( "Not at all likely" ) ) ,
346+ new Choice ( "unlikely" , $ ( "Unlikely" ) ) ,
347+ new Choice ( "neutral" , $ ( "Neutral" ) ) ,
348+ new Choice ( "likely" , $ ( "Likely" ) ) ,
349+ new Choice ( "extremely_likely" , $ ( "Extremely likely" ) )
350+ ] ,
351+ next : function ( choice ) {
352+ if ( choice . value === "not_at_all_likely" || choice . value === "unlikely" || choice . value === "neutral" ) {
353+ return "state_nps_lower" ;
354+ } else {
355+ return "state_trigger_rapidpro_flow" ;
356+ }
357+ }
333358 } ) ;
334359 } ) ;
335360
336361 self . add ( "state_nps_lower" , function ( name ) {
337- return new MenuState ( name , {
362+ return new ChoiceState ( name , {
338363 question : $ (
339364 "Sorry to hear that. " +
340365 "What was the issue?"
@@ -343,12 +368,13 @@ go.app = function() {
343368 "Sorry, we don't understand. Please try again."
344369 ] . join ( "\n" ) ) ,
345370 choices : [
346- new Choice ( "state_trigger_rapidpro_flow" , $ ( "Info not helpful" ) ) ,
347- new Choice ( "state_trigger_rapidpro_flow" , $ ( "Too many msgs" ) ) ,
348- new Choice ( "state_trigger_rapidpro_flow" , $ ( "Confusing" ) ) ,
349- new Choice ( "state_trigger_rapidpro_flow" , $ ( "Slow replies" ) ) ,
350- new Choice ( "state_trigger_rapidpro_flow" , $ ( "Other" ) )
351- ]
371+ new Choice ( "info_not_helpful" , $ ( "Info not helpful" ) ) ,
372+ new Choice ( "too_many_msgs" , $ ( "Too many msgs" ) ) ,
373+ new Choice ( "confusing" , $ ( "Confusing" ) ) ,
374+ new Choice ( "slow_replies" , $ ( "Slow replies" ) ) ,
375+ new Choice ( "other" , $ ( "Other" ) )
376+ ] ,
377+ next : "state_trigger_rapidpro_flow"
352378 } ) ;
353379 } ) ;
354380
0 commit comments