jsfe 1.96.0 → 1.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,7 @@ const PARTS = [{ key: 'zip', label: 'ZIP code', label_es: 'Código postal', phra
42
42
  const declined = C('collect-geocoded-address-declined', 'Ask which part of the declined address is wrong, re-ask only that part, or start a fresh pass.', [
43
43
  S('address_retry_owner', 'parent_form', 'cargo.forms[form_instance].parent'), S('address_retry_input', 'result_input', 'cargo.forms[form_instance].result_input'),
44
44
  S('address_retry_part_q', 'part_question', "'Which part is wrong: 1 the zip code, 2 the city, 3 the street, or 4 the apartment? Or '+channelVerb('en',cargo)+' ALL to start over.'"), S('address_retry_part_q_es', 'part_question_es', "'¿Qué parte está mal: 1 el código postal, 2 la ciudad, 3 la calle, o 4 el apartamento? O '+channelVerb('es',cargo)+' TODO para empezar de nuevo.'"),
45
- F('address_retry_part_ask', 'ask-choice', { question: '{{part_question}}', question_es: '{{part_question_es}}', choices: '{{parts}}' }),
45
+ F('address_retry_part_ask', 'ask-choice', { question: '{{part_question}}', question_es: '{{part_question_es}}', choices: '{{parts}}', rank: 'insist' }),
46
46
  S('address_retry_part', 'part', "['zip','city','street','unit','all'].indexOf(cargo.choice)>=0 ? cargo.choice : 'all'"),
47
47
  S('address_retry_clear', 'noop', "(part==='all' ? (resetFormInputs(cargo,form_instance,['zip','city','city_state','street','unit']),cargo.forms[form_instance].data={retry:true,need_city:false}) : resetFormInputs(cargo,form_instance,[part==='city' ? (cargo.forms[form_instance].data.city_choice ? 'city' : 'city_state') : part]),true)"),
48
48
  F('address_retry', 'collect-geocoded-address', { form_instance: '{{form_instance}}', parent_form: '{{parent_form}}', result_input: '{{result_input}}' }, 'replace')
@@ -1,5 +1,5 @@
1
1
  /** Shared platform choice transport, moved into JSFE so all hosts use one implementation. */
2
- export const FLOWS: {
2
+ export const FLOWS: ({
3
3
  id: string;
4
4
  name: string;
5
5
  version: string;
@@ -90,6 +90,26 @@ export const FLOWS: {
90
90
  parametersFrom: string;
91
91
  };
92
92
  };
93
+ ac_rank: {
94
+ type: string;
95
+ value: string;
96
+ };
97
+ ac_ranked_key: {
98
+ type: string;
99
+ value: string;
100
+ };
101
+ ac_insist: {
102
+ type: string;
103
+ value: boolean;
104
+ };
105
+ ac_firm: {
106
+ type: string;
107
+ value: boolean;
108
+ };
109
+ rc_asked?: undefined;
110
+ rc_ranked?: undefined;
111
+ rc_stay?: undefined;
112
+ reply?: undefined;
93
113
  };
94
114
  steps: ({
95
115
  id: string;
@@ -133,8 +153,10 @@ export const FLOWS: {
133
153
  "condition: /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
134
154
  "condition: typeof answer_precheck !== 'undefined' && answer_precheck && String(ac_answer || '').trim()"?: undefined;
135
155
  "condition: ac_key === '' && typeof answer_validator !== 'undefined' && answer_validator && String(ac_answer || '').trim()"?: undefined;
156
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
136
157
  "condition: ac_missed"?: undefined;
137
158
  "condition: ac_missed && /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
159
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
138
160
  "condition: ac_key === '__switch'"?: undefined;
139
161
  "condition: ac_key === '__agent'"?: undefined;
140
162
  "condition: ac_key === '__exit'"?: undefined;
@@ -142,6 +164,7 @@ export const FLOWS: {
142
164
  "condition: ac_key === '__amount'"?: undefined;
143
165
  "condition: ac_key === '__elsewhere'"?: undefined;
144
166
  "condition: ac_key === '' && ac_other"?: undefined;
167
+ "condition: ac_key === '' && ac_rank === 'insist'"?: undefined;
145
168
  "condition: ac_key === ''"?: undefined;
146
169
  };
147
170
  variable?: undefined;
@@ -171,8 +194,10 @@ export const FLOWS: {
171
194
  "condition: ac_late"?: undefined;
172
195
  "condition: typeof answer_precheck !== 'undefined' && answer_precheck && String(ac_answer || '').trim()"?: undefined;
173
196
  "condition: ac_key === '' && typeof answer_validator !== 'undefined' && answer_validator && String(ac_answer || '').trim()"?: undefined;
197
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
174
198
  "condition: ac_missed"?: undefined;
175
199
  "condition: ac_missed && /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
200
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
176
201
  "condition: ac_key === '__switch'"?: undefined;
177
202
  "condition: ac_key === '__agent'"?: undefined;
178
203
  "condition: ac_key === '__exit'"?: undefined;
@@ -180,6 +205,7 @@ export const FLOWS: {
180
205
  "condition: ac_key === '__amount'"?: undefined;
181
206
  "condition: ac_key === '__elsewhere'"?: undefined;
182
207
  "condition: ac_key === '' && ac_other"?: undefined;
208
+ "condition: ac_key === '' && ac_rank === 'insist'"?: undefined;
183
209
  "condition: ac_key === ''"?: undefined;
184
210
  };
185
211
  variable?: undefined;
@@ -209,8 +235,10 @@ export const FLOWS: {
209
235
  "condition: ac_late"?: undefined;
210
236
  "condition: /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
211
237
  "condition: ac_key === '' && typeof answer_validator !== 'undefined' && answer_validator && String(ac_answer || '').trim()"?: undefined;
238
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
212
239
  "condition: ac_missed"?: undefined;
213
240
  "condition: ac_missed && /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
241
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
214
242
  "condition: ac_key === '__switch'"?: undefined;
215
243
  "condition: ac_key === '__agent'"?: undefined;
216
244
  "condition: ac_key === '__exit'"?: undefined;
@@ -218,6 +246,7 @@ export const FLOWS: {
218
246
  "condition: ac_key === '__amount'"?: undefined;
219
247
  "condition: ac_key === '__elsewhere'"?: undefined;
220
248
  "condition: ac_key === '' && ac_other"?: undefined;
249
+ "condition: ac_key === '' && ac_rank === 'insist'"?: undefined;
221
250
  "condition: ac_key === ''"?: undefined;
222
251
  };
223
252
  variable?: undefined;
@@ -247,8 +276,55 @@ export const FLOWS: {
247
276
  "condition: ac_late"?: undefined;
248
277
  "condition: /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
249
278
  "condition: typeof answer_precheck !== 'undefined' && answer_precheck && String(ac_answer || '').trim()"?: undefined;
279
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
280
+ "condition: ac_missed"?: undefined;
281
+ "condition: ac_missed && /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
282
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
283
+ "condition: ac_key === '__switch'"?: undefined;
284
+ "condition: ac_key === '__agent'"?: undefined;
285
+ "condition: ac_key === '__exit'"?: undefined;
286
+ "condition: ac_key === '__text'"?: undefined;
287
+ "condition: ac_key === '__amount'"?: undefined;
288
+ "condition: ac_key === '__elsewhere'"?: undefined;
289
+ "condition: ac_key === '' && ac_other"?: undefined;
290
+ "condition: ac_key === '' && ac_rank === 'insist'"?: undefined;
291
+ "condition: ac_key === ''"?: undefined;
292
+ };
293
+ variable?: undefined;
294
+ value?: undefined;
295
+ asSpoken?: undefined;
296
+ value_es?: undefined;
297
+ pii?: undefined;
298
+ } | {
299
+ id: string;
300
+ type: string;
301
+ branches: {
302
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''": {
303
+ id: string;
304
+ type: string;
305
+ value: string;
306
+ callType: string;
307
+ parameters: {
308
+ question: string;
309
+ question_es: string;
310
+ choices: string;
311
+ insist: string;
312
+ firm: string;
313
+ };
314
+ };
315
+ default: {
316
+ id: string;
317
+ type: string;
318
+ variable: string;
319
+ value: string;
320
+ };
321
+ "condition: ac_late"?: undefined;
322
+ "condition: /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
323
+ "condition: typeof answer_precheck !== 'undefined' && answer_precheck && String(ac_answer || '').trim()"?: undefined;
324
+ "condition: ac_key === '' && typeof answer_validator !== 'undefined' && answer_validator && String(ac_answer || '').trim()"?: undefined;
250
325
  "condition: ac_missed"?: undefined;
251
326
  "condition: ac_missed && /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
327
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
252
328
  "condition: ac_key === '__switch'"?: undefined;
253
329
  "condition: ac_key === '__agent'"?: undefined;
254
330
  "condition: ac_key === '__exit'"?: undefined;
@@ -256,6 +332,7 @@ export const FLOWS: {
256
332
  "condition: ac_key === '__amount'"?: undefined;
257
333
  "condition: ac_key === '__elsewhere'"?: undefined;
258
334
  "condition: ac_key === '' && ac_other"?: undefined;
335
+ "condition: ac_key === '' && ac_rank === 'insist'"?: undefined;
259
336
  "condition: ac_key === ''"?: undefined;
260
337
  };
261
338
  variable?: undefined;
@@ -286,7 +363,9 @@ export const FLOWS: {
286
363
  "condition: /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
287
364
  "condition: typeof answer_precheck !== 'undefined' && answer_precheck && String(ac_answer || '').trim()"?: undefined;
288
365
  "condition: ac_key === '' && typeof answer_validator !== 'undefined' && answer_validator && String(ac_answer || '').trim()"?: undefined;
366
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
289
367
  "condition: ac_missed && /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
368
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
290
369
  "condition: ac_key === '__switch'"?: undefined;
291
370
  "condition: ac_key === '__agent'"?: undefined;
292
371
  "condition: ac_key === '__exit'"?: undefined;
@@ -294,6 +373,7 @@ export const FLOWS: {
294
373
  "condition: ac_key === '__amount'"?: undefined;
295
374
  "condition: ac_key === '__elsewhere'"?: undefined;
296
375
  "condition: ac_key === '' && ac_other"?: undefined;
376
+ "condition: ac_key === '' && ac_rank === 'insist'"?: undefined;
297
377
  "condition: ac_key === ''"?: undefined;
298
378
  };
299
379
  variable?: undefined;
@@ -324,7 +404,54 @@ export const FLOWS: {
324
404
  "condition: /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
325
405
  "condition: typeof answer_precheck !== 'undefined' && answer_precheck && String(ac_answer || '').trim()"?: undefined;
326
406
  "condition: ac_key === '' && typeof answer_validator !== 'undefined' && answer_validator && String(ac_answer || '').trim()"?: undefined;
407
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
408
+ "condition: ac_missed"?: undefined;
409
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
410
+ "condition: ac_key === '__switch'"?: undefined;
411
+ "condition: ac_key === '__agent'"?: undefined;
412
+ "condition: ac_key === '__exit'"?: undefined;
413
+ "condition: ac_key === '__text'"?: undefined;
414
+ "condition: ac_key === '__amount'"?: undefined;
415
+ "condition: ac_key === '__elsewhere'"?: undefined;
416
+ "condition: ac_key === '' && ac_other"?: undefined;
417
+ "condition: ac_key === '' && ac_rank === 'insist'"?: undefined;
418
+ "condition: ac_key === ''"?: undefined;
419
+ };
420
+ variable?: undefined;
421
+ value?: undefined;
422
+ asSpoken?: undefined;
423
+ value_es?: undefined;
424
+ pii?: undefined;
425
+ } | {
426
+ id: string;
427
+ type: string;
428
+ branches: {
429
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''": {
430
+ id: string;
431
+ type: string;
432
+ value: string;
433
+ callType: string;
434
+ parameters: {
435
+ question: string;
436
+ question_es: string;
437
+ choices: string;
438
+ insist: string;
439
+ firm: string;
440
+ };
441
+ };
442
+ default: {
443
+ id: string;
444
+ type: string;
445
+ variable: string;
446
+ value: string;
447
+ };
448
+ "condition: ac_late"?: undefined;
449
+ "condition: /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
450
+ "condition: typeof answer_precheck !== 'undefined' && answer_precheck && String(ac_answer || '').trim()"?: undefined;
451
+ "condition: ac_key === '' && typeof answer_validator !== 'undefined' && answer_validator && String(ac_answer || '').trim()"?: undefined;
452
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
327
453
  "condition: ac_missed"?: undefined;
454
+ "condition: ac_missed && /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
328
455
  "condition: ac_key === '__switch'"?: undefined;
329
456
  "condition: ac_key === '__agent'"?: undefined;
330
457
  "condition: ac_key === '__exit'"?: undefined;
@@ -332,6 +459,7 @@ export const FLOWS: {
332
459
  "condition: ac_key === '__amount'"?: undefined;
333
460
  "condition: ac_key === '__elsewhere'"?: undefined;
334
461
  "condition: ac_key === '' && ac_other"?: undefined;
462
+ "condition: ac_key === '' && ac_rank === 'insist'"?: undefined;
335
463
  "condition: ac_key === ''"?: undefined;
336
464
  };
337
465
  variable?: undefined;
@@ -388,6 +516,12 @@ export const FLOWS: {
388
516
  variable: string;
389
517
  value: string;
390
518
  };
519
+ "condition: ac_key === '' && ac_rank === 'insist'": {
520
+ id: string;
521
+ type: string;
522
+ variable: string;
523
+ value: string;
524
+ };
391
525
  "condition: ac_key === ''": {
392
526
  id: string;
393
527
  type: string;
@@ -402,8 +536,10 @@ export const FLOWS: {
402
536
  "condition: /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
403
537
  "condition: typeof answer_precheck !== 'undefined' && answer_precheck && String(ac_answer || '').trim()"?: undefined;
404
538
  "condition: ac_key === '' && typeof answer_validator !== 'undefined' && answer_validator && String(ac_answer || '').trim()"?: undefined;
539
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
405
540
  "condition: ac_missed"?: undefined;
406
541
  "condition: ac_missed && /^[\\s\u00BF\u00A1]*(?:(?:por favor|please|a|que|me lo|me|lo|puede|can you|could you)\\s+)*(?:repetir|repite|rep[i\u00ED]t[ae](?:lo|la|me|melo|nos)?|rep[i\u00ED]tamelo|otra vez|de nuevo|repeat(?:\\s+(?:that|it))?|say (?:that|it) again|again|one more time)(?:\\s+(?:por favor|please|la pregunta|las opciones|eso|that|it))*[\\s.!?\u00BF,]*$/i.test(String(ac_answer || '')) && pickChoice(ac_answer, choices, ac_other) === ''"?: undefined;
542
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''"?: undefined;
407
543
  };
408
544
  variable?: undefined;
409
545
  value?: undefined;
@@ -412,5 +548,84 @@ export const FLOWS: {
412
548
  pii?: undefined;
413
549
  })[];
414
550
  scope: string;
415
- }[];
551
+ } | {
552
+ id: string;
553
+ name: string;
554
+ version: string;
555
+ scope: string;
556
+ description: string;
557
+ parameters: {
558
+ name: string;
559
+ type: string;
560
+ description: string;
561
+ }[];
562
+ variables: {
563
+ rc_asked: {
564
+ type: string;
565
+ value: string;
566
+ };
567
+ rc_ranked: {
568
+ type: string;
569
+ value: never[];
570
+ };
571
+ rc_stay: {
572
+ type: string;
573
+ value: boolean;
574
+ };
575
+ reply: {
576
+ type: string;
577
+ value: null;
578
+ };
579
+ contract: {
580
+ type: string;
581
+ value: {
582
+ version: number;
583
+ role: string;
584
+ summary: string;
585
+ parametersFrom: string;
586
+ };
587
+ };
588
+ ac_answer?: undefined;
589
+ ac_key?: undefined;
590
+ ac_other?: undefined;
591
+ ac_q_es?: undefined;
592
+ ac_retry?: undefined;
593
+ ac_retry_es?: undefined;
594
+ ac_exit_ctx?: undefined;
595
+ ac_exit_ctx_es?: undefined;
596
+ ac_missed?: undefined;
597
+ answer_key?: undefined;
598
+ ac_offer?: undefined;
599
+ ac_q?: undefined;
600
+ ac_code?: undefined;
601
+ ac_late?: undefined;
602
+ ac_marked?: undefined;
603
+ as_spoken?: undefined;
604
+ ac_rank?: undefined;
605
+ ac_ranked_key?: undefined;
606
+ ac_insist?: undefined;
607
+ ac_firm?: undefined;
608
+ };
609
+ steps: ({
610
+ id: string;
611
+ type: string;
612
+ variable: string;
613
+ value: string;
614
+ onResponse?: undefined;
615
+ responseContext?: undefined;
616
+ responseChoices?: undefined;
617
+ responseVariable?: undefined;
618
+ responseStay?: undefined;
619
+ } | {
620
+ id: string;
621
+ type: string;
622
+ onResponse: string;
623
+ responseContext: string;
624
+ responseChoices: string;
625
+ responseVariable: string;
626
+ responseStay: string;
627
+ variable?: undefined;
628
+ value?: undefined;
629
+ })[];
630
+ })[];
416
631
  //# sourceMappingURL=choice-flow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"choice-flow.d.ts","sourceRoot":"","sources":["../../src/forms/choice-flow.js"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0sBE"}
1
+ {"version":3,"file":"choice-flow.d.ts","sourceRoot":"","sources":["../../src/forms/choice-flow.js"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAo8BE"}
@@ -3,10 +3,14 @@ export const FLOWS = [
3
3
  {
4
4
  "id": "ask-choice",
5
5
  "name": "AskChoice",
6
- "version": "1.22.0",
7
- "description": "Worker: ask one question and return cargo.choice plus the original cargo.choiceText. Declared choices, precheck keys and typed answer-validator keys keep priority across both read passes. Exact negative choices accept only their own declared words and keys. With amount, an unowned legacy payment question accepts a complete USD monetary answer or a simple payment instruction through readMoneyAmount; uncertain prose yields to DISPATCH without declaring an action failure. A lone digit keeps the question's keypad policy; amount:'marked' still requires marked money. An owning FORM supplies form_context and performs its own field, correction, provider-question and confirmation matching before deciding to retry or yield, retaining its draft and safety guards. Optional answer_precheck runs before choices; answer_validator runs only when no choice matched. AGENT/0 requests a person; EXIT/* leaves the request; a consumed switch offer routes its declared flow. Params include question(_es), choices [{key,phrases,exact?,negative?,neutral?}], retry(_es), accept_other, expect, amount, digits, exit_context(_es), pii and form_context.",
6
+ "version": "1.23.0",
7
+ "description": "Worker: ask one question and return cargo.choice plus the original cargo.choiceText. Declared choices, precheck keys and typed answer-validator keys keep priority across both read passes. Exact negative choices accept only their own declared words and keys. With amount, an unowned legacy payment question accepts a complete USD monetary answer or a simple payment instruction through readMoneyAmount; uncertain prose yields to DISPATCH without declaring an action failure. A lone digit keeps the question's keypad policy; amount:'marked' still requires marked money. An owning FORM supplies form_context and performs its own field, correction, provider-question and confirmation matching before deciding to retry or yield, retaining its draft and safety guards. Optional answer_precheck runs before choices; answer_validator runs only when no choice matched. AGENT/0 requests a person; EXIT/* leaves the request; a consumed switch offer routes its declared flow. Params include question(_es), choices [{key,phrases,exact?,negative?,neutral?}], retry(_es), accept_other, expect, amount, digits, exit_context(_es), pii and form_context. With rank ('insist' or 'open'), any non-empty answer no reader matched goes to the reply ranker (rank-choice-reply) before it is asked again: insist offers only the declared choices (a withdrawal still ends the flows; a new request is not taken) and, after the second miss, returns cargo.choice '' instead of DISPATCH; open also offers a person and lets a new request leave.",
8
8
  "parameters": [
9
- { "name": "form_context", "type": "object", "description": "Optional declared FORM reader context {form,current,names,questions}; valid field readings take precedence over stale verification-code echoes." },
9
+ {
10
+ "name": "form_context",
11
+ "type": "object",
12
+ "description": "Optional declared FORM reader context {form,current,names,questions}; valid field readings take precedence over stale verification-code echoes."
13
+ },
10
14
  {
11
15
  "name": "question",
12
16
  "type": "string",
@@ -97,6 +101,18 @@ export const FLOWS = [
97
101
  "name": "as_spoken",
98
102
  "type": "boolean",
99
103
  "description": "Keep exact speech independently of numeric or amount semantics"
104
+ },
105
+ {
106
+ "name": "rank",
107
+ "type": "string",
108
+ "description": "'insist' or 'open': an answer no reader matched, of any kind as long as it is not empty, is read by the reply ranker over the declared choices. insist: only those choices (EXIT and a withdrawal still leave), never a new request; the second miss returns cargo.choice '' (no DISPATCH). open: a person is offered too and a new request leaves. Absent: unchanged (a short answer is asked again, a long one DISPATCHed).",
109
+ "required": false
110
+ },
111
+ {
112
+ "name": "firm",
113
+ "type": "boolean",
114
+ "description": "With rank: the ranker is never offered the 'yes' choice (a confirmation that authorizes an action is confirmed only by the caller's own words).",
115
+ "required": false
100
116
  }
101
117
  ],
102
118
  "variables": {
@@ -173,6 +189,22 @@ export const FLOWS = [
173
189
  "summary": "Shared channel input transport and platform choice handling",
174
190
  "parametersFrom": "parameters"
175
191
  }
192
+ },
193
+ "ac_rank": {
194
+ "type": "string",
195
+ "value": ""
196
+ },
197
+ "ac_ranked_key": {
198
+ "type": "string",
199
+ "value": ""
200
+ },
201
+ "ac_insist": {
202
+ "type": "boolean",
203
+ "value": false
204
+ },
205
+ "ac_firm": {
206
+ "type": "boolean",
207
+ "value": false
176
208
  }
177
209
  },
178
210
  "steps": [
@@ -188,6 +220,24 @@ export const FLOWS = [
188
220
  "variable": "ac_other",
189
221
  "value": "typeof accept_other !== 'undefined' && (accept_other === true || accept_other === 'true')"
190
222
  },
223
+ {
224
+ "id": "ac_rank_mode",
225
+ "type": "SET",
226
+ "variable": "ac_rank",
227
+ "value": "typeof rank !== 'undefined' && (rank === 'insist' || rank === 'open') ? rank : ''"
228
+ },
229
+ {
230
+ "id": "ac_rank_insist",
231
+ "type": "SET",
232
+ "variable": "ac_insist",
233
+ "value": "ac_rank === 'insist'"
234
+ },
235
+ {
236
+ "id": "ac_rank_firm",
237
+ "type": "SET",
238
+ "variable": "ac_firm",
239
+ "value": "typeof firm !== 'undefined' && (firm === true || firm === 'true')"
240
+ },
191
241
  {
192
242
  "id": "ac_takes_amount",
193
243
  "type": "SET",
@@ -466,11 +516,54 @@ export const FLOWS = [
466
516
  "variable": "assignment_side_effect",
467
517
  "value": "(cargo.digits = typeof digits !== 'undefined' && digits && typeof digits === 'object' ? digits : undefined, true)"
468
518
  },
519
+ {
520
+ "id": "ac_rank_clear",
521
+ "type": "SET",
522
+ "variable": "assignment_side_effect",
523
+ "value": "(delete cargo.rankedChoice, true)"
524
+ },
525
+ {
526
+ "id": "ac_rank_first",
527
+ "type": "CASE",
528
+ "branches": {
529
+ "condition: ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''": {
530
+ "id": "ac_rank_first_call",
531
+ "type": "FLOW",
532
+ "value": "rank-choice-reply",
533
+ "callType": "call",
534
+ "parameters": {
535
+ "question": "{{question}}",
536
+ "question_es": "{{ac_q_es}}",
537
+ "choices": "{{choices}}",
538
+ "insist": "{{ac_insist}}",
539
+ "firm": "{{ac_firm}}"
540
+ }
541
+ },
542
+ "default": {
543
+ "id": "ac_rank_first_skip",
544
+ "type": "SET",
545
+ "variable": "noop",
546
+ "value": "true"
547
+ }
548
+ }
549
+ },
550
+ {
551
+ "id": "ac_rank_first_pick",
552
+ "type": "SET",
553
+ "variable": "ac_ranked_key",
554
+ "value": "typeof cargo.rankedChoice === 'string' ? cargo.rankedChoice : ''"
555
+ },
556
+ {
557
+ "id": "ac_rank_first_take",
558
+ "type": "SET",
559
+ "variable": "ac_key",
560
+ "value": "ac_key === '' && !ac_other && ac_rank !== '' && typeof cargo.rankedChoice === 'string' && cargo.rankedChoice ? (delete cargo.rankedChoice, ac_ranked_key) : ac_key"
561
+ },
469
562
  {
470
563
  "id": "ac_missed_once",
471
564
  "type": "SET",
472
565
  "variable": "ac_missed",
473
- "value": "ac_key === '' && !ac_other && (String(ac_answer || '').split(/\\s+/).filter(function(w) { return /[a-záéíóúüñ]/i.test(w); }).length < 3 || (typeof reask_long !== 'undefined' && (reask_long === true || reask_long === 'true')))"
566
+ "value": "ac_key === '' && !ac_other && (ac_rank !== '' || String(ac_answer || '').split(/\\s+/).filter(function(w) { return /[a-záéíóúüñ]/i.test(w); }).length < 3 || (typeof reask_long !== 'undefined' && (reask_long === true || reask_long === 'true')))"
474
567
  },
475
568
  {
476
569
  "id": "ac_reask_on_miss",
@@ -643,6 +736,49 @@ export const FLOWS = [
643
736
  "variable": "ac_key",
644
737
  "value": "ac_key === '' && !ac_other && !ac_amount && cargo.voice && String(ac_answer || '').trim().replace(/[.,!?;:]+$/, '') === '9' && !!callerTextNumber(cargo) ? '__text' : ac_key"
645
738
  },
739
+ {
740
+ "id": "ac_rank_clear_again",
741
+ "type": "SET",
742
+ "variable": "assignment_side_effect",
743
+ "value": "(delete cargo.rankedChoice, true)"
744
+ },
745
+ {
746
+ "id": "ac_rank_again",
747
+ "type": "CASE",
748
+ "branches": {
749
+ "condition: ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && String(ac_answer || '').trim() !== ''": {
750
+ "id": "ac_rank_again_call",
751
+ "type": "FLOW",
752
+ "value": "rank-choice-reply",
753
+ "callType": "call",
754
+ "parameters": {
755
+ "question": "{{question}}",
756
+ "question_es": "{{ac_q_es}}",
757
+ "choices": "{{choices}}",
758
+ "insist": "{{ac_insist}}",
759
+ "firm": "{{ac_firm}}"
760
+ }
761
+ },
762
+ "default": {
763
+ "id": "ac_rank_again_skip",
764
+ "type": "SET",
765
+ "variable": "noop",
766
+ "value": "true"
767
+ }
768
+ }
769
+ },
770
+ {
771
+ "id": "ac_rank_again_pick",
772
+ "type": "SET",
773
+ "variable": "ac_ranked_key",
774
+ "value": "typeof cargo.rankedChoice === 'string' ? cargo.rankedChoice : ''"
775
+ },
776
+ {
777
+ "id": "ac_rank_again_take",
778
+ "type": "SET",
779
+ "variable": "ac_key",
780
+ "value": "ac_missed && ac_key === '' && !ac_other && ac_rank !== '' && typeof cargo.rankedChoice === 'string' && cargo.rankedChoice ? (delete cargo.rankedChoice, ac_ranked_key) : ac_key"
781
+ },
646
782
  {
647
783
  "id": "ac_keypad_done",
648
784
  "type": "SET",
@@ -698,6 +834,12 @@ export const FLOWS = [
698
834
  "variable": "assignment_side_effect",
699
835
  "value": "cargo.choice = 'other', cargo.choiceText = String(ac_answer || '')"
700
836
  },
837
+ "condition: ac_key === '' && ac_rank === 'insist'": {
838
+ "id": "ac_insist_none",
839
+ "type": "SET",
840
+ "variable": "assignment_side_effect",
841
+ "value": "cargo.choice = '', cargo.choiceText = String(ac_answer || '')"
842
+ },
701
843
  "condition: ac_key === ''": {
702
844
  "id": "ac_other_request",
703
845
  "type": "DISPATCH"
@@ -712,5 +854,113 @@ export const FLOWS = [
712
854
  }
713
855
  ],
714
856
  "scope": "isolated"
857
+ },
858
+ {
859
+ "id": "rank-choice-reply",
860
+ "name": "RankChoiceReply",
861
+ "version": "1.0.0",
862
+ "scope": "isolated",
863
+ "description": "Worker: rank an answer no reader matched over a question's declared choices and return the pick as cargo.rankedChoice ('' when none). insist: only the declared choices are offered and a new request is not taken (a withdrawal still ends the flows); otherwise a person is offered too and a new request leaves. firm: the 'yes' choice is never offered.",
864
+ "parameters": [
865
+ {
866
+ "name": "question",
867
+ "type": "string",
868
+ "description": "The question (English)"
869
+ },
870
+ {
871
+ "name": "question_es",
872
+ "type": "string",
873
+ "description": "The question (Spanish)"
874
+ },
875
+ {
876
+ "name": "choices",
877
+ "type": "array",
878
+ "description": "[{key, label?, phrases}] as ask-choice takes them"
879
+ },
880
+ {
881
+ "name": "insist",
882
+ "type": "boolean",
883
+ "description": "Only the declared choices; a new request stays"
884
+ },
885
+ {
886
+ "name": "firm",
887
+ "type": "boolean",
888
+ "description": "Never offer 'yes'"
889
+ }
890
+ ],
891
+ "variables": {
892
+ "rc_asked": {
893
+ "type": "string",
894
+ "value": ""
895
+ },
896
+ "rc_ranked": {
897
+ "type": "array",
898
+ "value": []
899
+ },
900
+ "rc_stay": {
901
+ "type": "boolean",
902
+ "value": false
903
+ },
904
+ "reply": {
905
+ "type": "object",
906
+ "value": null
907
+ },
908
+ "contract": {
909
+ "type": "object",
910
+ "value": {
911
+ "version": 1,
912
+ "role": "collector",
913
+ "summary": "The reply ranker over one question's declared choices",
914
+ "parametersFrom": "parameters"
915
+ }
916
+ }
917
+ },
918
+ "steps": [
919
+ {
920
+ "id": "rc_reset",
921
+ "type": "SET",
922
+ "variable": "assignment_side_effect",
923
+ "value": "cargo.rankedChoice = ''"
924
+ },
925
+ {
926
+ "id": "rc_question",
927
+ "type": "SET",
928
+ "variable": "rc_asked",
929
+ "value": "language === 'es' && typeof question_es !== 'undefined' && question_es ? question_es : question"
930
+ },
931
+ {
932
+ "id": "rc_insist",
933
+ "type": "SET",
934
+ "variable": "rc_stay",
935
+ "value": "typeof insist !== 'undefined' && (insist === true || insist === 'true')"
936
+ },
937
+ {
938
+ "id": "rc_choices",
939
+ "type": "SET",
940
+ "variable": "rc_ranked",
941
+ "value": "(Array.isArray(choices) ? choices : []).filter(function(c,i,all){return c && c.key !== undefined && !((firm === true || firm === 'true') && String(c.key) === 'yes') && all.findIndex(function(o){return o && String(o.key) === String(c.key);}) === i;}).map(function(c){var said=(Array.isArray(c.phrases) ? c.phrases : []).map(String).filter(function(p){return /[a-zà-ÿ]/i.test(p) && p !== String(c.key);}).slice(0,6);return {key:String(c.key),label:String(c.label || (said.length ? c.key+' ('+said.join(', ')+')' : c.key))};}).concat(rc_stay ? [] : [{key:'__agent',label:'speak with a person (a live agent)'}])"
942
+ },
943
+ {
944
+ "id": "rc_clear",
945
+ "type": "SET",
946
+ "variable": "reply",
947
+ "value": "null"
948
+ },
949
+ {
950
+ "id": "rc_dispatch",
951
+ "type": "DISPATCH",
952
+ "onResponse": "continue",
953
+ "responseContext": "Current question: {{rc_asked}}",
954
+ "responseChoices": "rc_ranked",
955
+ "responseVariable": "reply",
956
+ "responseStay": "rc_stay"
957
+ },
958
+ {
959
+ "id": "rc_take",
960
+ "type": "SET",
961
+ "variable": "assignment_side_effect",
962
+ "value": "cargo.rankedChoice = reply && reply.key !== undefined && rc_ranked.some(function(c){return c.key === String(reply.key);}) ? String(reply.key) : ''"
963
+ }
964
+ ]
715
965
  }
716
966
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AAqIA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAsGD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EC;AACD;;;GAGG;AACH;;;;;;EAGC;AA0nBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AA38BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2J9G,4CAEqI;AA2gCrI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
1
+ {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AAqIA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAsGD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EC;AACD;;;GAGG;AACH;;;;;;EAGC;AAioBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAl9BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2J9G,4CAEqI;AAkhCrI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
@@ -438,7 +438,7 @@ const collectInput = {
438
438
  id: 'collect-input', name: 'CollectInput', version: '1.0.0', scope: 'isolated',
439
439
  description: "Worker: ask the form's current input once and file the answer wherever it belongs in the form chain (matchInputs, decided by scope; a declared confirm_against pair is asked). One reading → collect-input-accept; ambiguous → disambiguate-input; a question about the form's data → provide-data; an answer with words that fits nothing → the reply ranker (read-form-choice); an answer without words → counted as a miss, asked again, and the fourth (max_misses) → DISPATCH. Params: form, current, questions, provides, exit_context(_es).",
440
440
  parameters: ['form', 'current', 'questions', 'provides', 'exit_context', 'exit_context_es'].map((n) => ({ name: n, type: ['questions'].includes(n) ? 'array' : n === 'provides' ? 'object' : 'string', description: n })),
441
- variables: vars({ ci_clarify: null, ci_partial: '', ci_no_owner: '', ci_no_flow: '', ci_no_up: false, ci_reply_reader: '', ci_exhaustion: null, ci_d: {}, ci_pre: '', ci_val: '', ci_routed: '', ci_names: [], ci_chain: [], ci_spec: null, ci_choices: [], ci_q: '', ci_q_es: '', ci_missed: 0, ci_max: 3, ci_misses: 0, ci_miss_limit: 4, ci_must: false, ci_m: null, ci_qkey: '', ci_skip_gate: '', ci_words: 0, ci_digits: null, ci_amount: false, ci_as_spoken: false, ci_reader: {}, ci_pii: false, ci_ctx: '', ci_ctx_es: '' }),
441
+ variables: vars({ ci_clarify: null, ci_partial: '', ci_no_owner: '', ci_no_flow: '', ci_no_up: false, ci_reply_reader: '', ci_exhaustion: null, ci_d: {}, ci_pre: '', ci_val: '', ci_routed: '', ci_names: [], ci_chain: [], ci_spec: null, ci_choices: [], ci_q: '', ci_q_es: '', ci_missed: 0, ci_max: 3, ci_misses: 0, ci_miss_limit: 4, ci_must: false, ci_m: null, ci_qkey: '', ci_skip_gate: '', ci_said: false, ci_digits: null, ci_amount: false, ci_as_spoken: false, ci_reader: {}, ci_pii: false, ci_ctx: '', ci_ctx_es: '' }),
442
442
  steps: [
443
443
  SET('ci_find_spec', 'ci_spec', "(function () { var s = ((cargo.forms[form] || {}).specs || []).filter(function (s) { return s.name === current; })[0]; return s ? (Array.isArray(s.any_of) ? Object.assign({}, s, { profile: { kind: 'group' } }) : s) : null; })()"),
444
444
  SET('ci_current_names', 'ci_names', "Array.isArray(ci_spec && ci_spec.any_of) ? ci_spec.any_of.map(function (m) { return m.name; }) : [current]"),
@@ -509,7 +509,9 @@ const collectInput = {
509
509
  SET('ci_enrich', 'ci_m', 'enrichFormMatches(ci_m, ci_chain, form, ci_names, current)'),
510
510
  SET('ci_question_key', 'ci_qkey', "ci_m.questions.length ? ci_m.questions[0] : !ci_m.hits.length && !ci_m.ambiguous.length && Array.isArray(questions) && questions.length && provides ? pickChoice(cargo.choiceText, questions.map(function(question){return Object.assign({},question,{exact:true});}), false) : ''"),
511
511
  WHEN('ci_understood', 'ci_m.hits.length || ci_m.ambiguous.length || ci_m.questions.length || ci_qkey && ci_qkey.indexOf("__") !== 0', SIDE('ci_clear_misses', 'clearFormMisses(cargo,form,current)')),
512
- SET('ci_count_words', 'ci_words', "String(cargo.choiceText || '').split(/\\s+/).filter(function (w) { return /[a-záéíóúüñ]/i.test(w); }).length"),
512
+ // Any answer no reader matched goes to the reply ranker, whatever it holds, as long as it is not empty (owner 2026-11-28:
513
+ // a price said alone, "479.", was asked again unread because it had no letter).
514
+ SET('ci_said_anything', 'ci_said', "String(cargo.choiceText || '').trim() !== ''"),
513
515
  // Independent field clauses are committed before a provider can suspend on its gate.
514
516
  WHEN('ci_question_ambiguity', 'ci_m.questions.length > 0 && ci_m.ambiguous.length > 0', FLOW('ci_question_clarify', 'disambiguate-input', 'call', { readings: '{{ci_m.ambiguous}}', hits: '{{ci_m.hits}}', remaining: '{{ci_m.remaining}}' })),
515
517
  WHEN('ci_question_fields', 'ci_m.questions.length > 0 && !ci_m.ambiguous.length && ci_m.hits.length > 0', FLOW('ci_question_accept_fields', 'collect-input-accept', 'call', { hits: '{{ci_m.hits}}' })),
@@ -527,7 +529,7 @@ const collectInput = {
527
529
  'condition: ci_m.hits.length > 0': FLOW('ci_accept', 'collect-input-accept', 'call', { hits: '{{ci_m.hits}}' }),
528
530
  "condition: ci_m.questions.length > 0": END('ci_question_handled'),
529
531
  "condition: ci_qkey && ci_qkey.indexOf('__') !== 0": FLOW('ci_question_asked', 'provide-data', 'call', { form: '{{form}}', provides: '{{provides}}', asked: '{{ci_qkey}}', no_menu: 'true', no_gate: '{{ci_skip_gate}}' }),
530
- "condition: ci_words > 0": FLOW('ci_elsewhere', '{{ci_reply_reader}}', 'call', { form: '{{form}}', input: '{{current}}', question: '{{ci_q}}', question_es: '{{ci_q_es}}', choices: '{{ci_choices}}', firm: '{{ci_spec.confirmation}}' }),
532
+ "condition: ci_said": FLOW('ci_elsewhere', '{{ci_reply_reader}}', 'call', { form: '{{form}}', input: '{{current}}', question: '{{ci_q}}', question_es: '{{ci_q_es}}', choices: '{{ci_choices}}', firm: '{{ci_spec.confirmation}}' }),
531
533
  default: SIDE('ci_miss', "(missFormInput(cargo,form,current),true)")
532
534
  } },
533
535
  ],
@@ -611,6 +613,8 @@ const readFormResponse = {
611
613
  // reaches the ranker, which is offered every choice the chain's reader would accept. A clear withdrawal (`abort`) ends every
612
614
  // flow, as anywhere; any other verdict that picks none of them, a new request included, stays: "I understand, first let's {first_task}." and the question again. It uses no
613
615
  // attempt: only a value the field rejected does (its contract: an unreadable answer is never handed away).
616
+ // The answer holds a word (a run with a letter).
617
+ const HAS_WORD_JS = "(String(cargo.choiceText || '').split(/\\s+/).some(function(w){return /[a-záéíóúüñ]/i.test(w);}))";
614
618
  const rankedMiss = (id) => SIDE(id, "(formMustComplete(cargo,form,input) ? (missFormInput(cargo,form,input),cargo.forms[form].feedback[input]='first') : (cargo.forms[form].attempts=cargo.forms[form].attempts || {},cargo.forms[form].attempts[input]=Number(cargo.forms[form].attempts[input] || 0)+1,cargo.forms[form].feedback=cargo.forms[form].feedback || {},cargo.forms[form].feedback[input]='miss'),true)");
615
619
  // The ranker is offered only a person. Text is never offered: its label matched "continuar", "texto" and "enlace", and a
616
620
  // call moved to text hangs up (prod 2026-10-28: 7 of 7 such picks were wrong). TEXTO and keypad 9 are read before it.
@@ -693,7 +697,10 @@ const readFormChoice = {
693
697
  WHEN('choice_args_done', '!picked && args.hits.length', END('choice_args_end')),
694
698
  WHEN('choice_args_ambiguous', '!picked && args.ambiguous.length', FLOW('choice_args_clarify', 'disambiguate-input', 'call', { readings: '{{args.ambiguous}}', hits: [], remaining: [] })),
695
699
  WHEN('choice_args_ambiguous_done', '!picked && args.ambiguous.length', END('choice_args_ambiguous_end')),
696
- WHEN('choice_none', '!picked', rankedMiss('choice_miss')),
700
+ // An answer with no word in it that the ranker did not pick keeps the miss it always cost (max_misses), never an attempt:
701
+ // only the ranker's pick is new for it (owner 2026-11-28).
702
+ WHEN('choice_none', '!picked && ' + HAS_WORD_JS, rankedMiss('choice_miss')),
703
+ WHEN('choice_none_wordless', '!picked && !' + HAS_WORD_JS, SIDE('choice_wordless_miss', '(missFormInput(cargo,form,input),true)')),
697
704
  WHEN('choice_none_end', '!picked', END('choice_none_done')),
698
705
  SIDE('choice_take', "(cargo.choice=picked,cargo.choiceText=picked,true)"),
699
706
  SET('choice_read', 'reading', "owner ? enrichFormMatches(readFormAnswer(picked, chain, owner, picked, []), chain, form, [owner.name], owner.name) : enrichFormMatches(readFormAnswer(picked, chain, { form: form, name: input }, picked, []), chain, form, [input], input)"),
@@ -1078,7 +1085,7 @@ const provideData = {
1078
1085
  SET('pd_menu_keys', 'pd_mkeys', `${KEYS_JS}(pd_menu.length)`),
1079
1086
  SET('pd_menu_q', 'pd_q', "'What would you like to know? ' + pd_menu.map(function (m, i) { return (cargo.voice ? 'Press ' + pd_mkeys[i] + ' or say ' : 'Say ') + String(m.label || m.key).toUpperCase(); }).join(', ') + '.'"),
1080
1087
  SET('pd_menu_q_es', 'pd_q_es', "'¿Qué le gustaría saber? ' + pd_menu.map(function (m, i) { return (cargo.voice ? 'Presione ' + pd_mkeys[i] + ' o diga ' : 'Diga ') + String(m.label_es || m.label || m.key).toUpperCase(); }).join(', ') + '.'"),
1081
- WHEN('pd_ask_which', '!pd_keys.length', FLOW('pd_ask', 'ask-choice', 'call', { question: '{{pd_q}}', question_es: '{{pd_q_es}}', choices: '{{pd_menu_choices}}', digits: { min: 1, max: 1 } })),
1088
+ WHEN('pd_ask_which', '!pd_keys.length', FLOW('pd_ask', 'ask-choice', 'call', { question: '{{pd_q}}', question_es: '{{pd_q_es}}', choices: '{{pd_menu_choices}}', digits: { min: 1, max: 1 }, rank: 'open' })),
1082
1089
  SET('pd_from_menu', 'pd_keys', "pd_keys.length ? pd_keys : (function (k) { var s = (provides.sets || []).filter(function (x) { return x.key === k; })[0]; return s ? s.facts.slice() : provides.facts.some(function (f) { return f.key === k; }) ? [k] : []; })(String(cargo.choice || ''))"),
1083
1090
  WHEN('pd_nothing', '!pd_keys.length', END('pd_nothing_end')),
1084
1091
  SET('pd_needs_gate', 'pd_gated', "!!provides.gate && pd_keys.some(function (k) { var f = provides.facts.filter(function (x) { return x.key === k; })[0]; return !f || f.public !== true; })"),
@@ -1 +1 @@
1
- {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAkDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,0CAWC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAYC;AAED;;kGAEkG;AAClG,0FASC;AAED;kIACkI;AAClI;;;;SAUC;AA8HD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAkKD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AAjRD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAoSzC,0BAAsK"}
1
+ {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAkDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,0CAWC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAYC;AAED;;kGAEkG;AAClG,0FASC;AAED;kIACkI;AAClI;;;;SAUC;AAiID,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAkKD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAYD,oGAOC;AAlRD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAqSzC,0BAAsK"}
@@ -103,7 +103,7 @@ export function contactPrompt(cargo, options, callerAllowed, partial = false, es
103
103
  return (lead ? lead + ' ' : '') + question + (es ? ` Para salir en cualquier momento, puede ${cargo.voice ? 'presionar la tecla de asterisco o decir' : 'escribir'} SALIR.` : ` To exit anytime you can ${cargo.voice ? 'press the asterisk key or ' : ''}${verb} EXIT.`);
104
104
  }
105
105
  const contactParams = [param('retry_flow', 'Retry destination'), param('cancel_flow', 'Exit destination'), param('cell_number', 'Phone already supplied'), param('email', 'Email already supplied'), param('acct_number', 'Account identifier already supplied'), param('account_pattern', 'Tenant account identifier pattern'), param('account_name', 'English account identifier label'), param('account_name_es', 'Spanish account identifier label'), param('account_shape', 'Tenant keypad identifier shapes', 'array'), param('intro', 'English introduction'), param('intro_es', 'Spanish introduction'), param('caller_on_file', 'yes, no or unknown caller-ID eligibility'), param('retry_call_type', 'Retry destination invocation policy'), param('validate_flow', 'Contact existence validator'), param('merge_partials', 'Allow split account identifiers', 'boolean'), param('parent_form', 'Owning task FORM instance'), param('contact_options', 'Internal options across protocol transitions', 'object'), param('retrying', 'Retry-menu continuation', 'boolean'), param('gce_partial', 'Internal split identifier continuation', 'boolean'), param('gce_rejected', 'Internal rejected contact continuation', 'boolean'), param('gce_missed', 'Internal misread contact continuation', 'boolean'), param('gce_alternative', 'Internal: another contact from the same answer, tried after one not on file', 'boolean')];
106
- const contactDefaults = { retry_flow: 'authenticate-user', cancel_flow: 'contact-support', cell_number: '', email: '', acct_number: '', account_pattern: '', account_name: '', account_name_es: '', account_shape: [], intro: '', intro_es: '', caller_on_file: '', retry_call_type: 'reboot', validate_flow: '', merge_partials: false, parent_form: '', contact_options: null, retrying: false, gce_partial: false, gce_rejected: false, gce_missed: false, gce_alternative: false, contact_next: null, contact_alt_cell: '', contact_alt_mail: '', contact_allowed: false, contact_prefill: '', contact_partial: false, contact_text: '', contact_digits: '', contact_mail: '', contact_phone: '', contact_id: null, contact_profiles: [], contact_keypad: null, contact_question: '', contact_question_es: '', contact_check_key: '', contact_error: '', contact_error_es: '', contact_kind: '' };
106
+ const contactDefaults = { retry_flow: 'authenticate-user', cancel_flow: 'contact-support', cell_number: '', email: '', acct_number: '', account_pattern: '', account_name: '', account_name_es: '', account_shape: [], intro: '', intro_es: '', caller_on_file: '', retry_call_type: 'reboot', validate_flow: '', merge_partials: false, parent_form: '', contact_options: null, retrying: false, gce_partial: false, gce_rejected: false, gce_missed: false, gce_alternative: false, contact_pending_index: -1, contact_next: null, contact_alt_cell: '', contact_alt_mail: '', contact_allowed: false, contact_prefill: '', contact_partial: false, contact_text: '', contact_digits: '', contact_mail: '', contact_phone: '', contact_id: null, contact_profiles: [], contact_keypad: null, contact_question: '', contact_question_es: '', contact_check_key: '', contact_error: '', contact_error_es: '', contact_kind: '' };
107
107
  const contactProfiles = [{ name: 'phone', label: 'phone number', label_es: 'número de teléfono', profile: { kind: 'phone' } }, { name: 'email_address', label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' } }, { name: 'account', label: 'account number', label_es: 'número de cuenta', profile: { kind: 'identifier' } }, { ...raw, form_client: false }];
108
108
  const contactReplay = (id, extra = {}) => call(id, 'get-cell-or-email', { contact_options: '{{contact_options}}', cell_number: '', email: '', acct_number: '', ...extra }, 'replace');
109
109
  // One answer that is no contact never ends the question (owner 2026-11-11): it is asked again, led by why, and only the
@@ -116,7 +116,7 @@ export function rankedContactLine(kind, options, cargo, es = false) {
116
116
  const account = options.account_pattern ? (es ? options.account_name_es || options.account_name : options.account_name) : '';
117
117
  if (kind === 'other_contact')
118
118
  return es ? `Claro, ${verb} ese teléfono o correo electrónico.` : `Sure, ${verb} that phone number or email.`;
119
- return es ? `No hay problema. Sirve cualquier teléfono o correo electrónico de su cuenta${account ? ', o ' + account : ''}. Si no tiene ninguno, ${verb} AGENTE para hablar con una persona.` : `No problem. Any phone number or email on your account works${account ? ', or ' + account : ''}. If you don't have any of them, ${verb} AGENT to speak with a person.`;
119
+ return es ? `No hay problema. Sirve cualquier teléfono o correo electrónico de su cuenta${account ? ', o ' + account : ''}.` : `No problem. Any phone number or email on your account works${account ? ', or ' + account : ''}.`;
120
120
  }
121
121
  export function contactError(kind, options, es = false) {
122
122
  const account = options.account_pattern ? (es ? options.account_name_es || options.account_name : options.account_name) : '';
@@ -248,7 +248,10 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
248
248
  set('identity_contact_number', 'acct_number', "contact_kind === 'account' ? String(contact_id.value) : ''"),
249
249
  set('identity_contact_cell', 'cell_number', "contact_kind === 'caller' ? String(cargo.callerId) : contact_kind === 'phone' ? contact_phone : ''"), set('identity_contact_mail', 'email', "contact_kind === 'email' ? contact_mail : ''"),
250
250
  effect('identity_contact_record', "(cargo.contactKind=acct_number?'account':email?'email':String(cell_number).replace(/\\D/g,'').slice(-10)===String(cargo.callerId || '').replace(/\\D/g,'').slice(-10)?'caller':'phone',cargo.contactValue=String(acct_number || email || cell_number),cargo.contactAlternatives=cargo.serviceAnswer.values,true)"),
251
- effect('identity_contact_alternatives', "(gce_alternative === true || gce_alternative === 'true' ? true : (cargo.gceAlternatives=['account','phone','email'].includes(contact_kind) ? " + expression(contactAlternatives, 'cargo.serviceAnswer', 'contact_kind', 'contact_phone', 'contact_mail') + " : [],cargo.gceTried=[]),true)"),
251
+ // a contact handed back from the pending list (the tenant's lookup of the same answer's account number found nothing) is
252
+ // that answer's next try: the rest of the list stays
253
+ set('identity_contact_pending', 'contact_pending_index', "(function () {var key=contact_kind === 'email' ? String(contact_mail).toLowerCase() : ['phone','caller'].includes(contact_kind) ? String(contact_phone || cell_number).replace(/\\D/g,'').slice(-10) : '';return contact_prefill && key ? (cargo.gceAlternatives || []).findIndex(function (a) {return a.key === key;}) : -1;})()"),
254
+ effect('identity_contact_alternatives', "(gce_alternative === true || gce_alternative === 'true' ? true : contact_pending_index >= 0 ? (cargo.gceAlternatives=cargo.gceAlternatives.filter(function (a,i) {return i !== contact_pending_index;})) : (cargo.gceAlternatives=['account','phone','email'].includes(contact_kind) ? " + expression(contactAlternatives, 'cargo.serviceAnswer', 'contact_kind', 'contact_phone', 'contact_mail') + " : [],cargo.gceTried=[]),true)"),
252
255
  set('identity_contact_check_key', 'contact_check_key', "contact_options.validate_flow && !acct_number && !cargo.callerPreselected ? contact_options.validate_flow+'|'+(email?'email:'+email.toLowerCase():'phone:'+String(cell_number).replace(/\\D/g,'').slice(-10)) : ''"),
253
256
  effect('identity_contact_check_reset', "(cargo.contactCheck=contact_check_key && cargo.gceChecks && cargo.gceChecks[contact_check_key] || '',true)"),
254
257
  when('identity_contact_validate', 'contact_check_key && !cargo.contactCheck', call('identity_contact_validation', '{{contact_options.validate_flow}}')),
@@ -258,8 +261,8 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
258
261
  set('identity_contact_alt_cell', 'contact_alt_cell', "contact_next && contact_next.kind === 'phone' ? contact_next.value : ''"), set('identity_contact_alt_mail', 'contact_alt_mail', "contact_next && contact_next.kind === 'email' ? contact_next.value : ''"),
259
262
  when('identity_contact_alternative_uncounted', '!!contact_next', effect('identity_contact_alternative_uncount', '(cargo.gceRejects=Math.max(0,Number(cargo.gceRejects || 0)-1),true)')),
260
263
  when('identity_contact_alternative', '!!contact_next', contactReplay('identity_contact_try_alternative', { cell_number: '{{contact_alt_cell}}', email: '{{contact_alt_mail}}', gce_alternative: true, gce_rejected: true })),
261
- set('identity_contact_rejected_message', 'contact_error', "(cargo.gceTried || []).length > 1 ? 'I could not find an account with that phone number or that email.' : cargo.contactKind === 'email' ? 'I could not find an account with that email.' : cargo.contactKind === 'caller' ? 'I could not find an account with the number you are calling from.' : 'I could not find an account with that phone number.'"),
262
- set('identity_contact_rejected_message_es', 'contact_error_es', "(cargo.gceTried || []).length > 1 ? 'No encontré una cuenta con ese número de teléfono ni con ese correo.' : cargo.contactKind === 'email' ? 'No encontré una cuenta con ese correo.' : cargo.contactKind === 'caller' ? 'No encontré una cuenta con el número desde el que llama.' : 'No encontré una cuenta con ese número de teléfono.'"),
264
+ set('identity_contact_rejected_message', 'contact_error', "(cargo.gceTried || []).length > 1 ? 'I could not find an account with that phone number or that email.' : cargo.contactKind === 'email' ? 'I could not find an account with that email.' : 'I could not find an account with that phone number.'"),
265
+ set('identity_contact_rejected_message_es', 'contact_error_es', "(cargo.gceTried || []).length > 1 ? 'No encontré una cuenta con ese número de teléfono ni con ese correo.' : cargo.contactKind === 'email' ? 'No encontré una cuenta con ese correo.' : 'No encontré una cuenta con ese número de teléfono.'"),
263
266
  when('identity_contact_reject', 'cargo.contactCheck === "none"', call('identity_contact_rejection', 'contact-not-on-file', { contact_options: '{{contact_options}}', error_message: '{{contact_error}}', error_message_es: '{{contact_error_es}}' }, 'replace'))
264
267
  ]
265
268
  });
@@ -398,13 +401,13 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
398
401
  "condition: isAnswer(user_choice,'text')": call('otp_text', 'switch-to-text', undefined, 'reboot'),
399
402
  'condition: matchesChoice(user_choice,otp_phrases.resend)': call('otp_resend', 'resend-otp-code', { resend_reason: 'requested' }),
400
403
  'condition: matchesChoice(user_choice,otp_phrases.cannot_find)': say('otp_cannot_find', '{{otp_where}}', '{{otp_where_es}}'),
401
- 'condition: matchesChoice(user_choice,otp_phrases.another_way)': say('otp_no_other_way', '{{otp_where}} To reach a person, {{cargo.verb}} AGENT.', '{{otp_where_es}} Para hablar con una persona, {{cargo.verb_es}} AGENTE.'),
404
+ 'condition: matchesChoice(user_choice,otp_phrases.another_way)': say('otp_no_other_way', '{{otp_where}}', '{{otp_where_es}}'),
402
405
  'condition: matchesChoice(user_choice,otp_phrases.later)': say('otp_later', "No problem. Say TEXT and I'll continue with you by message so you can do this when you are free, or {{cargo.verb}} the code whenever you are ready.", 'No hay problema. Diga TEXTO y sigo con usted por mensaje para que lo haga cuando esté libre, o {{cargo.verb_es}} el código cuando pueda.'),
403
406
  // code_validator said why this answer is not taken (answer_key 'code_notice'): the question is asked again; it counts as a format miss.
404
407
  "condition: answer_key === 'code_notice'": effect('otp_tenant_notice_said', 'true'),
405
408
  'condition: normalized_otp_code.length > 0 && Number(cargo.otpFormatMisses || 0)<2': say('otp_bad_format', "I was expecting a 6-digit code. Let's try again.", "Esperaba un código de 6 dígitos. Intentemos de nuevo."),
406
409
  'condition: normalized_otp_code.length > 0': effect('otp_format_cap_next', 'true'),
407
- ['condition: matchesChoice(user_choice,otp_phrases.noPhone) || ' + expression(otpPhoneUnavailable, 'user_choice')]: otpMenu('otp_no_phone', "No problem. Then the code can't reach you there. You can use the email on your account instead, or {{cargo.verb}} AGENT to reach a person.", 'No hay problema. Entonces el código no le puede llegar ahí. Puede usar el correo electrónico de su cuenta, o {{cargo.verb_es}} AGENTE para hablar con una persona.', false),
410
+ ['condition: matchesChoice(user_choice,otp_phrases.noPhone) || ' + expression(otpPhoneUnavailable, 'user_choice')]: otpMenu('otp_no_phone', "No problem. Then the code can't reach you there. You can use the email on your account instead.", 'No hay problema. Entonces el código no le puede llegar ahí. Puede usar el correo electrónico de su cuenta.', false),
408
411
  default: set('otp_words_missing', 'no_code_given', 'true')
409
412
  }),
410
413
  // An answer none of the above reads goes to the reply ranker (owner 2026-10-29: prod 10-28, 128 of 238 such replies were
@@ -430,10 +433,10 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
430
433
  "condition: !no_code_given && otp_reply && otp_reply.key === 'email'": toParent(call('otp_ranked_email', 'authenticate-user', { cell_number: '', email: '', retrying: true, declined_caller: true }, 'replace')),
431
434
  "condition: !no_code_given && otp_reply && otp_reply.key === 'another_account'": toParent(call('otp_ranked_account', 'authenticate-user', { cell_number: '', email: '', retrying: true, declined_caller: true }, 'replace')),
432
435
  "condition: !no_code_given && otp_reply && (otp_reply.key === 'where' || otp_reply.key === 'cannot_find')": say('otp_ranked_where', '{{otp_where}}', '{{otp_where_es}}'),
433
- "condition: !no_code_given && otp_reply && otp_reply.key === 'another_way'": say('otp_ranked_no_other_way', '{{otp_where}} To reach a person, {{cargo.verb}} AGENT.', '{{otp_where_es}} Para hablar con una persona, {{cargo.verb_es}} AGENTE.'),
436
+ "condition: !no_code_given && otp_reply && otp_reply.key === 'another_way'": say('otp_ranked_no_other_way', '{{otp_where}}', '{{otp_where_es}}'),
434
437
  "condition: !no_code_given && otp_reply && otp_reply.key === 'has_code'": say('otp_ranked_has_code', 'Go ahead. Read me the six digits when you have them.', 'Adelante. Dígame los seis dígitos cuando los tenga.'),
435
438
  "condition: !no_code_given && otp_reply && otp_reply.key === 'resend'": call('otp_ranked_resend', 'resend-otp-code', { resend_reason: 'requested' }),
436
- "condition: !no_code_given && otp_reply && otp_reply.key === 'no_phone'": otpMenu('otp_ranked_no_phone', "No problem. Then the code can't reach you there. You can use the email on your account instead, or {{cargo.verb}} AGENT to reach a person.", 'No hay problema. Entonces el código no le puede llegar ahí. Puede usar el correo electrónico de su cuenta, o {{cargo.verb_es}} AGENTE para hablar con una persona.', false),
439
+ "condition: !no_code_given && otp_reply && otp_reply.key === 'no_phone'": otpMenu('otp_ranked_no_phone', "No problem. Then the code can't reach you there. You can use the email on your account instead.", 'No hay problema. Entonces el código no le puede llegar ahí. Puede usar el correo electrónico de su cuenta.', false),
437
440
  "condition: !no_code_given && otp_reply && otp_reply.key === 'no_other_account'": say('otp_ranked_no_other_account', 'I understand. We still need to secure access to your account.', 'Entiendo. Aún necesitamos asegurar el acceso a su cuenta.'),
438
441
  "condition: !no_code_given && otp_reply && otp_reply.key === '__agent'": call('otp_ranked_agent', 'live-agent-requested', undefined, 'reboot'),
439
442
  default: effect('otp_reply_route_none', 'true')
@@ -441,8 +444,8 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
441
444
  effect('otp_word_count', '(cargo.otpWordMisses=Number(cargo.otpWordMisses || 0)+(no_code_given?1:0),true)'),
442
445
  when('otp_word_cap', 'no_code_given && cargo.otpWordMisses >= 3', verificationEnd('otp_word_end')),
443
446
  // a reason for the call authentication serves is acknowledged: verification comes first
444
- when('otp_usecase_ack', "no_code_given && otp_reply && String(otp_reply.key || '').indexOf('usecase:') === 0", say('otp_usecase_explain', 'Understood. First we need to finish verifying your identity. I sent you a message with a six-digit code in it. Read those six digits back to me. You can also {{cargo.verb}} AGENT to reach a person, or EXIT to cancel.', "Entendido. Primero necesitamos completar la verificación de su identidad. Le envié un mensaje con un código de seis dígitos. Dígame esos seis dígitos. También puede {{cargo.voice ? 'decir' : 'escribir'}} AGENTE para hablar con una persona, o SALIR para cancelar.")),
445
- when('otp_explanation', "no_code_given && !(no_code_given && otp_reply && String(otp_reply.key || '').indexOf('usecase:') === 0)", say('otp_explain', 'Let me explain. I sent you a message with a six-digit code in it. Read those six digits back to me. You can also {{cargo.verb}} AGENT to reach a person, or EXIT to cancel.', "Le explico. Le envié un mensaje con un código de seis dígitos. Dígame esos seis dígitos. También puede {{cargo.voice ? 'decir' : 'escribir'}} AGENTE para hablar con una persona, o SALIR para cancelar.")),
447
+ when('otp_usecase_ack', "no_code_given && otp_reply && String(otp_reply.key || '').indexOf('usecase:') === 0", say('otp_usecase_explain', 'Understood. First we need to finish verifying your identity. I sent you a message with a six-digit code in it. Read those six digits back to me. You can also {{cargo.verb}} EXIT to cancel.', "Entendido. Primero necesitamos completar la verificación de su identidad. Le envié un mensaje con un código de seis dígitos. Dígame esos seis dígitos. También puede {{cargo.voice ? 'decir' : 'escribir'}} SALIR para cancelar.")),
448
+ when('otp_explanation', "no_code_given && !(no_code_given && otp_reply && String(otp_reply.key || '').indexOf('usecase:') === 0)", say('otp_explain', 'Let me explain. I sent you a message with a six-digit code in it. Read those six digits back to me. You can also {{cargo.verb}} EXIT to cancel.', "Le explico. Le envié un mensaje con un código de seis dígitos. Dígame esos seis dígitos. También puede {{cargo.voice ? 'decir' : 'escribir'}} SALIR para cancelar.")),
446
449
  effect('otp_format_count', '(cargo.otpFormatMisses=Number(cargo.otpFormatMisses || 0)+(normalized_otp_code.length > 0 && normalized_otp_code.length !== 6?1:0),true)'),
447
450
  when('otp_format_cap', 'normalized_otp_code.length !== 6 && cargo.otpFormatMisses >= 3', verificationEnd('otp_format_end')),
448
451
  when('otp_format_retry', 'normalized_otp_code.length !== 6', call('otp_collect_again', 'get-and-validate-otp-code', undefined, 'replace')),
@@ -551,11 +554,12 @@ const resume = worker('resume-identity-caller', 'ResumeIdentityCaller', 'Resume
551
554
  });
552
555
  // The closing a verification out of attempts says: the task it was for (authenticate-user's task), and that the caller can try
553
556
  // again once the code can reach them (owner wording 2026-10-30); part 'agent' is its last sentence, said after the tenant's
554
- // failed_flow. An unknown action result keeps its hold notice, with no agent sentence.
557
+ // failed_flow. An unknown action result keeps its hold notice, with no agent sentence; so does a channel where the host says
558
+ // no person can be reached (cargo.agentReachable false; owner 2026-11-28: offer only a person someone can take).
555
559
  export function verificationFailedText(cargo, ended, es = false, part = '') {
556
560
  const hold = !!(ended && ended.recovery && ended.recovery.mode === 'hold');
557
561
  if (part === 'agent')
558
- return hold ? '' : es ? 'Para hablar con una persona, ' + cargo.verb_es + ' AGENTE.' : 'To reach a person, ' + cargo.verb + ' AGENT.';
562
+ return hold || cargo.agentReachable === false ? '' : es ? 'Para hablar con una persona, ' + cargo.verb_es + ' AGENTE.' : 'To reach a person, ' + cargo.verb + ' AGENT.';
559
563
  if (hold)
560
564
  return es ? 'El resultado de su solicitud anterior sigue sin confirmarse. Nuestro equipo debe revisarlo antes de otro intento.' : 'The result of your earlier request is still unknown. Our team needs to check it before another attempt.';
561
565
  const task = String((cargo.authOptions && (es ? cargo.authOptions.task_es : cargo.authOptions.task)) || '');
@@ -1 +1 @@
1
- {"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"AAwMA,0BAAgC"}
1
+ {"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"AAwOA,0BAAmD"}
@@ -30,17 +30,20 @@ const when = (id, condition, step) => ({ id, type: 'CASE', branches: { [`conditi
30
30
  const say = (id, value, value_es) => ({ id, type: 'SAY', value, value_es });
31
31
  const end = (id, extra = {}) => ({ id, type: 'END', ...extra });
32
32
  const call = (id, value, parameters) => ({ id, type: 'FLOW', value, callType: 'call', ...(parameters ? { parameters } : {}) });
33
- const ANYTHING_ELSE = ' Is there anything else I can help you with?';
34
- const ANYTHING_ELSE_ES = ' ¿Hay algo más en lo que le pueda ayudar?';
33
+ // The closing question, unless the calling flow continues the conversation itself (no_closing; owner 2026-11-28).
34
+ const ANYTHING_ELSE = "{{typeof no_closing !== 'undefined' && (no_closing === true || no_closing === 'true') ? '' : ' Is there anything else I can help you with?'}}";
35
+ const ANYTHING_ELSE_ES = "{{typeof no_closing !== 'undefined' && (no_closing === true || no_closing === 'true') ? '' : ' ¿Hay algo más en lo que le pueda ayudar?'}}";
35
36
  const TEXT_WORDS = ['1', 'text', 'texto', 'sms', 'message', 'text message', 'mensaje', 'mensaje de texto'];
36
37
  // A text message is one message: Twilio rejects a body over 1,600 characters (error 21617), so longer content goes by email.
37
38
  const TEXT_MAX = 1600;
39
+ // The first email address in a text, without trailing punctuation ('' when none).
40
+ const EMAIL_IN_JS = "(function (t) { return (String(t || '').match(/[^\\s@]+@[^\\s@]+\\.[^\\s@]+/) || [''])[0].replace(/[.,;:]+$/, ''); })";
38
41
  const EMAIL_WORDS = ['2', 'email', 'e-mail', 'mail', 'correo', 'correo electrónico', 'correo electronico', 'email address'];
39
42
  const sendCopy = defineWorker({
40
43
  contract: { role: 'router', summary: 'Sends a reply, registered document, the whole conversation or a link to continue it on the web, as the caller picks, by text or email, through the system send workers or the document\'s sender flow' },
41
44
  id: 'send-copy',
42
45
  name: 'SendCopy',
43
- version: '1.2.0',
46
+ version: '1.3.0',
44
47
  primary: true,
45
48
  prompt: 'Send a copy',
46
49
  prompt_es: 'Enviar una copia',
@@ -49,6 +52,7 @@ const sendCopy = defineWorker({
49
52
  { name: 'item', type: 'string', enum_from: 'sendables', description: "What the user asks to have sent: the reply or document they name or point to. 'That', 'it', 'this', 'eso' or 'lo que me dijo' is the latest reply; the whole chat, conversation or transcript ('toda la conversación') is the whole conversation; continuing on the web, a computer or another device is the link to continue on the web." },
50
53
  { name: 'medium', type: 'string', enum: ['text', 'email'], description: "How the user asks to have it sent: text for a text message or SMS ('mensaje', 'texto'), email for an email ('correo')." },
51
54
  { name: 'destination', type: 'string', description: 'The phone number or email address the user gave to send it to, as given.' },
55
+ { name: 'no_closing', type: 'boolean', internal: true, description: 'Internal: true when the calling flow continues the conversation itself, so no closing question is asked.' },
52
56
  { name: 'other_destination', type: 'boolean', description: "true when the user asks to send it to a different, new or other phone number or email than their own, without saying what it is ('another number', 'a different email', 'otro número', 'a mi otro correo'); false when they give the number or email, or name none." },
53
57
  ],
54
58
  variables: vars({
@@ -76,12 +80,13 @@ const sendCopy = defineWorker({
76
80
  question_es: '{{sc_offer_q_es}}',
77
81
  choices: [{ key: 'yes', phrases: ['1'] }, { key: 'no', phrases: ['2'] }],
78
82
  digits: { min: 1, max: 1 },
83
+ rank: 'insist',
79
84
  })),
80
85
  when('sc_offer_read', '!sc_item', set('sc_offer_pick', 'sc_item', "cargo.choice === 'yes' ? sc_last : null")),
81
86
  when('sc_offer_no', '!sc_item', say('sc_offer_no_say', "Okay. Tell me what you'd like me to send, for example: text me my balance.", 'De acuerdo. Dígame qué quiere que le envíe, por ejemplo: envíeme mi saldo por mensaje.')),
82
87
  when('sc_offer_no_end', '!sc_item', end('sc_offer_no_done')),
83
88
  // the medium: the one asked for, else the destination's shape, else asked; text needs the tenant's sender
84
- set('sc_email', 'sc_email', "(String(typeof destination === 'string' ? destination : '').match(/[^\\s@]+@[^\\s@]+\\.[^\\s@]+/) || [''])[0].replace(/[.,;:]+$/, '')"),
89
+ set('sc_email', 'sc_email', `${EMAIL_IN_JS}(typeof destination === 'string' ? destination : '')`),
85
90
  set('sc_phone', 'sc_phone', "readPhone(typeof destination === 'string' ? destination : '')"),
86
91
  set('sc_medium', 'sc_medium', "typeof medium === 'string' && (medium === 'text' || medium === 'email') ? medium : sc_email ? 'email' : sc_phone ? 'text' : ''"),
87
92
  // the web chat link: texted to the caller's number when nothing was named, else emailed to the email on file
@@ -109,9 +114,15 @@ const sendCopy = defineWorker({
109
114
  question_es: '{{sc_medium_q_es}}',
110
115
  choices: [{ key: 'text', phrases: TEXT_WORDS }, { key: 'email', phrases: EMAIL_WORDS }],
111
116
  digits: { min: 1, max: 1 },
117
+ rank: 'insist',
118
+ answer_precheck: 'send-copy-destination-answer',
112
119
  })),
113
120
  when('sc_ask_medium_read', '!sc_medium', set('sc_medium_pick', 'sc_medium', "cargo.choice === 'text' || cargo.choice === 'email' ? cargo.choice : ''")),
114
- when('sc_no_medium_end', '!sc_medium', end('sc_no_medium_done')),
121
+ // an email address or a phone number answers the question and is where it goes (owner 2026-11-28)
122
+ when('sc_medium_email', "sc_medium === 'email' && !sc_email", set('sc_medium_email_set', 'sc_email', `${EMAIL_IN_JS}(cargo.choiceText)`)),
123
+ when('sc_medium_phone', "sc_medium === 'text' && !sc_phone", set('sc_medium_phone_set', 'sc_phone', "readPhone(String(cargo.choiceText || ''))")),
124
+ when('sc_no_medium_say', '!sc_medium', say('sc_no_medium_line', "Okay, I didn't send it." + ANYTHING_ELSE, 'De acuerdo, no lo envié.' + ANYTHING_ELSE_ES)),
125
+ when('sc_no_medium_end', '!sc_medium', end('sc_no_medium_done', { outcome: 'unresolved', reason: 'no_medium' })),
115
126
  // another number or email, not given (prod 2026-11-19 14:57: "Can you text it to another number?" was texted to the
116
127
  // number on file again): asked here, before any sender or the number on file is used
117
128
  set('sc_other', 'sc_other', "typeof other_destination !== 'undefined' && other_destination === true && !(sc_medium === 'email' ? sc_email : sc_phone)"),
@@ -172,7 +183,14 @@ const sendCopy = defineWorker({
172
183
  question_es: '{{sc_confirm_q_es}}',
173
184
  choices: [{ key: 'yes', phrases: ['1'] }, { key: 'no', phrases: ['2'] }],
174
185
  digits: { min: 1, max: 1 },
186
+ rank: 'insist',
187
+ firm: true,
188
+ answer_precheck: 'send-copy-destination-answer',
175
189
  })),
190
+ // another email address or phone number: SendCopy again with it, so it is read back in its turn
191
+ when('sc_corrected', "!sc_trusted && (cargo.choice === 'email' || cargo.choice === 'text')", set('sc_corrected_set', 'sc_given', `cargo.choice === 'email' ? ${EMAIL_IN_JS}(cargo.choiceText) : readPhone(String(cargo.choiceText || ''))`)),
192
+ when('sc_corrected_medium', "!sc_trusted && (cargo.choice === 'email' || cargo.choice === 'text')", set('sc_corrected_medium_set', 'sc_medium', 'cargo.choice')),
193
+ when('sc_corrected_again', "!sc_trusted && !!sc_given && (sc_medium === 'email' || sc_medium === 'text') && (cargo.choice === 'email' || cargo.choice === 'text')", { id: 'sc_corrected_again_flow', type: 'FLOW', value: 'send-copy', callType: 'replace', parameters: { item: '{{sc_item.key}}', medium: '{{sc_medium}}', destination: '{{sc_given}}', no_closing: '{{no_closing}}' } }),
176
194
  when('sc_confirm_no', "!sc_trusted && cargo.choice !== 'yes'", say('sc_confirm_no_say', "Okay, I didn't send it." + ANYTHING_ELSE, 'De acuerdo, no lo envié.' + ANYTHING_ELSE_ES)),
177
195
  when('sc_confirm_no_end', "!sc_trusted && cargo.choice !== 'yes'", end('sc_confirm_no_done', { outcome: 'unresolved', reason: 'declined' })),
178
196
  // send: a sender item runs its flow (it tells the caller); content goes as is
@@ -186,4 +204,17 @@ const sendCopy = defineWorker({
186
204
  when('sc_failed_end', '!sc_sent', end('sc_failed_done', { outcome: 'unresolved', reason: 'send_failed' })),
187
205
  ],
188
206
  });
189
- export const FLOWS = [sendCopy];
207
+ // An email address or a phone number answers SendCopy's text-or-email question and its read-back (owner 2026-11-28): the key
208
+ // is the medium it goes by.
209
+ const destinationAnswer = defineWorker({
210
+ contract: { role: 'collector', summary: 'Reads an email address or a phone number as the medium it is sent by' },
211
+ id: 'send-copy-destination-answer',
212
+ scope: 'shared',
213
+ name: 'SendCopyDestinationAnswer',
214
+ version: '1.0.0',
215
+ description: "Worker: answer_key 'email' when the answer holds an email address, 'text' when it is a phone number, else nothing.",
216
+ parameters: [{ name: 'answer', type: 'string', description: 'The answer' }],
217
+ variables: vars({ noop: false }),
218
+ steps: [set('scd_key', 'answer_key', `${EMAIL_IN_JS}(answer) ? 'email' : readPhone(String(answer || '')) ? 'text' : ''`)],
219
+ });
220
+ export const FLOWS = [sendCopy, destinationAnswer];
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:cbfba80c58b7f8835aeae06100d5191d33a9381cdf44c63c000d9e34fc912321";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:d1f8989aad34c35e6f702f20a3147e925822d08b66e210250d47a929bacca55e";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.96.0",
3
+ "version": "1.98.0",
4
4
  "description": "TypeScript workflow engine for conversational/automation apps: multi-flow orchestration, interrupt/resume, stack-based control, robust errors, and flexible tool/REST integration.",
5
5
  "license": "MIT",
6
6
  "author": "Ron Pinkas",