jsfe 1.75.0 → 1.76.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.
@@ -375,7 +375,7 @@ export function formSubmissionReaders(submission, getSession) {
375
375
  const read = profile.kind === 'choice'
376
376
  ? (profile.choices || []).some(choice => String(choice.key) === raw && (!choice.current_only || hit.form === current.form && (hit.name === current.name || current.names?.includes(hit.name)))) ? { value: raw }
377
377
  // A combobox's own text: a choice that takes other text keeps it (with a letter when the profile asks for one).
378
- : profile.accept_other === true && raw.trim() && (!profile.other_needs_letter || /\p{L}/u.test(raw)) ? { value: raw.trim() } : null
378
+ : profile.accept_other === true && raw.trim() && (!profile.other_needs_letter || /\p{L}/u.test(raw)) && (!profile.other_needs_digit || /\d/.test(raw)) ? { value: raw.trim() } : null
379
379
  : readInputProfile({ ...profile, marked: false }, raw, true);
380
380
  const valid = read && Object.hasOwn(read, 'value') && read.value !== '' && read.refused !== true && !read.incompleteMoney;
381
381
  return { ...hit, value: valid ? read.value : raw, invalid: !valid, origin: 'form_submission', current: false, utterance: '' };
@@ -4,6 +4,8 @@ export function setTaskGate(cargo: any, form: any, gate: any, active: any): bool
4
4
  export function serviceDigits(text: any): string;
5
5
  export function otpDigits(text: any): string;
6
6
  export function contactPrompt(cargo: any, options: any, callerAllowed: any, partial?: boolean, es?: boolean): string;
7
+ /** The line a ranked pick at the contact question is answered with, before the question again (owner 2026-11-18). */
8
+ export function rankedContactLine(kind: any, options: any, cargo: any, es?: boolean): string;
7
9
  export function contactError(kind: any, options: any, es?: boolean): string;
8
10
  export function otpWhere(cargo: any, es?: boolean): string;
9
11
  export function otpPrompt(cargo: any, es?: boolean): string;
@@ -1 +1 @@
1
- {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAgDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AASD,4EAMC;AAkGD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAyJD,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AApQD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAuRzC,0BAAsK"}
1
+ {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAgDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAiBC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAMC;AAkHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AA0JD,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AArQD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAwRzC,0BAAsK"}
@@ -81,7 +81,22 @@ export function otpDigits(text) {
81
81
  const filler = new Set(['el', 'mi', 'es', 'codigo', 'code', 'is', 'my', 'the', 'numero', 'number', 'a', 'ver']);
82
82
  const tokens = String(text || '').toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').split(/[\s,.;:!?-]+/).filter(t => t && !filler.has(t));
83
83
  const spoken = tokens.length && tokens.some(t => Object.hasOwn(map, t)) && tokens.every(t => /^\d+$/.test(t) || Object.hasOwn(map, t)) ? tokens.map(t => map[t] ?? t).join('') : '';
84
- return spoken.length === 6 ? spoken : String(text || '').replace(/\D/g, '');
84
+ if (spoken.length === 6)
85
+ return spoken;
86
+ // A caller who restarts the code ("57. 57, 21, 80.") or says it twice gives the code last (owner 2026-11-18). Only an answer
87
+ // that is nothing but digits: the same six twice, or a restart that ends at a pause the transcript marks (a period or
88
+ // comma) and is how the last six begin. A number said digit by digit, a single run, or one with other words is left as it was.
89
+ if (tokens.length && tokens.every(t => /^\d+$/.test(t) || Object.hasOwn(map, t))) {
90
+ const all = tokens.map(t => map[t] ?? t).join(''), cut = all.length - 6, head = all.slice(0, cut), tail = all.slice(cut);
91
+ const marked = String(text || '').toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').split(/[.,;]/).map(p => p.split(/\s+/).filter(t => t && !filler.has(t)).map(t => map[t] ?? t).join('')).filter(Boolean);
92
+ let at = 0;
93
+ const pauses = new Set(marked.map(p => (at += p.length)));
94
+ const twice = cut === 6 && head === tail && tokens.length >= 2, restart = cut > 0 && cut < 6 && pauses.has(cut) && tail.startsWith(head);
95
+ if (twice || restart)
96
+ return tail;
97
+ }
98
+ else { /* other words: read as before */ }
99
+ return String(text || '').replace(/\D/g, '');
85
100
  }
86
101
  export function contactPrompt(cargo, options, callerAllowed, partial = false, es = false) {
87
102
  if (partial)
@@ -102,6 +117,14 @@ const contactReplay = (id, extra = {}) => call(id, 'get-cell-or-email', { contac
102
117
  // third miss in a row offers the retry menu.
103
118
  const contactMiss = id => call(id, 'contact-misread', { contact_options: '{{contact_options}}', error_message: '{{contact_error}}', error_message_es: '{{contact_error_es}}' }, 'replace');
104
119
  const contactMenu = id => call(id, 'generic-retry-with-options', { error_message: '{{contact_error}}', error_message_es: '{{contact_error_es}}', retry_flow: '{{contact_options.retry_flow}}', cancel_flow: '{{contact_options.cancel_flow}}', capture_patterns: '{{cargo.authCapture}}', retry_call_type: '{{contact_options.retry_call_type}}', parent_form: '{{contact_options.parent_form}}', contact_options: '{{contact_options}}', gce_menu: true }, 'replace');
120
+ /** The line a ranked pick at the contact question is answered with, before the question again (owner 2026-11-18). */
121
+ export function rankedContactLine(kind, options, cargo, es = false) {
122
+ const verb = es ? cargo.verb_es : cargo.verb;
123
+ const account = options.account_pattern ? (es ? options.account_name_es || options.account_name : options.account_name) : '';
124
+ if (kind === 'other_contact')
125
+ return es ? `Claro, ${verb} ese teléfono o correo electrónico.` : `Sure, ${verb} that phone number or email.`;
126
+ 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.`;
127
+ }
105
128
  export function contactError(kind, options, es = false) {
106
129
  const account = options.account_pattern ? (es ? options.account_name_es || options.account_name : options.account_name) : '';
107
130
  if (kind === 'international')
@@ -113,14 +136,14 @@ export function contactError(kind, options, es = false) {
113
136
  return es ? 'Lo siento, necesito el teléfono o correo electrónico asociado con su cuenta' + (account ? ', o ' + account : '') + ' para continuar.' : 'Sorry, I do need the phone or email associated with your account' + (account ? ', or ' + account : '') + ' to proceed.';
114
137
  }
115
138
  const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a supplied contact or account number; collect missing data through a FORM, with caller-ID eligibility and bounded contact validation.', {
116
- parameters: contactParams, variables: vars({ ...contactDefaults, contact_profiles_base: contactProfiles, contact_named_options: null, contact_names_account: ['número de cuenta', 'numero de cuenta', 'mi número de cuenta', 'mi numero de cuenta', 'con mi número de cuenta', 'con mi numero de cuenta', 'con el número de cuenta', 'con el numero de cuenta', 'account number', 'my account number', 'with my account number', 'with the account number'] }), contract: { role: 'collector', summary: 'Contact identification with FORM ancestry', result: { paths: ['cell_number', 'email', 'acct_number', 'cargo.contactKind', 'cargo.contactValue'], type: 'object' } },
139
+ parameters: contactParams, variables: vars({ ...contactDefaults, contact_profiles_base: contactProfiles, contact_named_options: null, contact_rank_asked: '', contact_rank_offers: [], contact_rank_reply: null, contact_rank_kind: '', contact_rank_options: null, contact_rank_first: false, contact_names_account: ['número de cuenta', 'numero de cuenta', 'mi número de cuenta', 'mi numero de cuenta', 'con mi número de cuenta', 'con mi numero de cuenta', 'con el número de cuenta', 'con el numero de cuenta', 'account number', 'my account number', 'with my account number', 'with the account number'] }), contract: { role: 'collector', summary: 'Contact identification with FORM ancestry', result: { paths: ['cell_number', 'email', 'acct_number', 'cargo.contactKind', 'cargo.contactValue'], type: 'object' } },
117
140
  steps: [
118
141
  set('identity_contact_options', 'contact_options', "contact_options || (retrying && cargo.contactOptions ? Object.assign({},cargo.contactOptions,{fromMenu:true,intro:'',intro_es:''}) : {retry_flow:retry_flow || 'authenticate-user',cancel_flow:cancel_flow || 'contact-support',account_pattern:account_pattern,account_name:account_name,account_name_es:account_name_es,account_shape:account_shape,intro:intro,intro_es:intro_es,caller_on_file:caller_on_file,retry_call_type:retry_call_type || 'reboot',validate_flow:validate_flow,merge_partials:merge_partials === true || merge_partials === 'true',parent_form:parent_form})"),
119
142
  // options carried from an earlier verification may name a task the caller has since closed; opening under it fails
120
143
  set('identity_contact_live_parent', 'contact_options', "contact_options.parent_form && !(cargo.forms && cargo.forms[contact_options.parent_form]) ? Object.assign({},contact_options,{parent_form:''}) : contact_options"),
121
144
  effect('identity_contact_remember', '(cargo.contactOptions=contact_options,cargo.authCapture=[{variable:"cell_number",reader:"phone"},{variable:"email",reader:"email"}].concat(contact_options.account_pattern?[{variable:"acct_number",regex:contact_options.account_pattern,normalizer:"[^0-9]"}]:[]),true)'),
122
145
  when('identity_contact_new_rejection_series', '!gce_rejected', effect('identity_contact_rejections_reset', '(cargo.gceRejects=0,true)')),
123
- when('identity_contact_new_miss_series', '!gce_missed', effect('identity_contact_misses_reset', '(cargo.gceMisses=0,true)')),
146
+ when('identity_contact_new_miss_series', '!gce_missed', effect('identity_contact_misses_reset', '(cargo.gceMisses=0,cargo.gceRanked=false,true)')),
124
147
  set('identity_contact_partial', 'contact_partial', "!!(contact_options.merge_partials && gce_partial && cargo.gcePartial)"),
125
148
  when('identity_contact_partial_reset', '!contact_partial', effect('identity_contact_partial_forget', "(cargo.gcePartial='',true)")),
126
149
  set('identity_contact_allowed', 'contact_allowed', "!!cargo.callerId && !callerIsInternational(cargo) && !cargo.callerDeclined && contact_options.caller_on_file !== 'no'"),
@@ -144,9 +167,14 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
144
167
  when('identity_contact_split_overshoot', "contact_partial && contact_digits.length > (contact_options.account_shape || []).reduce(function(max,s){return Math.max(max,Math.max.apply(null,s.lengths || [0]));},0)", call('identity_contact_restart_split', 'contact-split-failed', { contact_options: '{{contact_options}}' }, 'replace')),
145
168
  set('identity_contact_identifier', 'contact_id', "contact_options.account_pattern ? readIdentifier(contact_text,contact_options.account_pattern) : null"),
146
169
  set('identity_contact_phone', 'contact_phone', "readPhone(contact_text) || (validatePhone(contact_digits) ? contact_digits : '')"), set('identity_contact_email', 'contact_mail', 'readEmail(contact_text)'),
147
- set('identity_contact_classify', 'contact_kind', "contact_id && contact_id.kind === 'account' ? 'account' : contact_phone ? 'phone' : contact_mail ? 'email' : contact_options.account_pattern && !contact_digits && matchesChoice(contact_text,contact_names_account) ? 'names_account' : readInternationalPhone(contact_text) ? 'international' : isAgentRequest(contact_text) ? 'agent' : isExitRequest(contact_text) ? 'exit' : " + emailTry + " ? 'invalid_email' : contact_allowed && /^(?:no|nope|nah)\\b/i.test(contact_text.trim()) && !/[0-9@]/.test(contact_text) ? 'decline' : contact_allowed && cargo.serviceAnswer && cargo.serviceAnswer.values.caller_decision === 'yes' ? 'caller' : contact_digits ? 'invalid_phone' : contact_text.trim().split(/\\s+/).length>=3 && !/[0-9@]/.test(contact_text) ? 'unmapped' : 'invalid'"),
170
+ set('identity_contact_classify', 'contact_kind', "contact_id && contact_id.kind === 'account' ? 'account' : contact_phone ? 'phone' : contact_mail ? 'email' : contact_options.account_pattern && !contact_digits && matchesChoice(contact_text,contact_names_account) ? 'names_account' : readInternationalPhone(contact_text) ? 'international' : isAgentRequest(contact_text) ? 'agent' : isExitRequest(contact_text) ? 'exit' : " + emailTry + " ? 'invalid_email' : contact_allowed && /^(?:no|nope|nah)\\b/i.test(contact_text.trim()) && !/[0-9@]/.test(contact_text) ? 'decline' : contact_allowed && cargo.serviceAnswer && cargo.serviceAnswer.values.caller_decision === 'yes' ? 'caller' : contact_digits ? 'invalid_phone' : /[a-záéíóúñü]/i.test(contact_text) ? 'unmapped' : 'invalid'"),
148
171
  set('identity_contact_named', 'contact_named_options', "Object.assign({},contact_options,{fromMenu:false,intro:'Sure, your account number.',intro_es:'Claro, su número de cuenta.'})"),
149
172
  set('identity_contact_error', 'contact_error', expression(contactError, 'contact_kind', 'contact_options')), set('identity_contact_error_es', 'contact_error_es', expression(contactError, 'contact_kind', 'contact_options', 'true')),
173
+ // A reply with letters and no identifier goes to the reply ranker with the question's own options (owner 2026-11-18): the
174
+ // identifiers above are read lexically anywhere in the reply; the ranker only picks one of these, never an identifier.
175
+ set('identity_contact_rank_asked', 'contact_rank_asked', "language === 'es' ? contact_question_es : contact_question"),
176
+ set('identity_contact_rank_offers', 'contact_rank_offers', "[{key:'no_identifier',label:'does not know or does not have the phone number, email or account number on the account'},{key:'other_contact',label:'has or wants to give a different phone number or email'},{key:'__agent',label:'speak with a person (a live agent)'},{key:'exit',label:'does not want to continue and stops here'}].concat(callerTextNumber(cargo) ? [{key:'text',label:'continue by text message'}] : [])"),
177
+ set('identity_contact_rank_clear', 'contact_rank_reply', 'null'),
150
178
  cases('identity_contact_route', {
151
179
  "condition: contact_kind === 'agent'": call('identity_contact_agent', 'live-agent-requested', undefined, 'reboot'),
152
180
  "condition: contact_kind === 'exit'": call('identity_contact_exit', '{{contact_options.cancel_flow}}', undefined, 'reboot'),
@@ -157,11 +185,23 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
157
185
  "condition: contact_kind === 'international'": contactMiss('identity_contact_international'),
158
186
  "condition: contact_kind === 'invalid_phone'": contactMiss('identity_contact_invalid_phone'),
159
187
  "condition: contact_kind === 'invalid_email'": contactMiss('identity_contact_invalid_email'),
160
- "condition: contact_kind === 'unmapped'": { id: 'identity_contact_off_topic', type: 'DISPATCH', onResponse: 'continue', responseContext: 'account identifier: phone number, email address or account number (teléfono, correo o número de cuenta)', outcome: 'unresolved', reason: 'auth_prompt_off_topic' },
188
+ "condition: contact_kind === 'unmapped'": { id: 'identity_contact_off_topic', type: 'DISPATCH', onResponse: 'continue', responseContext: 'Current question: {{contact_rank_asked}}', responseChoices: 'contact_rank_offers', responseVariable: 'contact_rank_reply', outcome: 'unresolved', reason: 'auth_prompt_off_topic' },
161
189
  "condition: contact_kind === 'invalid'": contactMiss('identity_contact_missing'), default: effect('identity_contact_typed', 'true')
162
190
  }),
191
+ set('identity_contact_rank_read', 'contact_rank_kind', "contact_kind === 'unmapped' && contact_rank_reply && contact_rank_reply.key ? String(contact_rank_reply.key) : ''"),
192
+ set('identity_contact_rank_options', 'contact_rank_options', "['no_identifier','other_contact'].includes(contact_rank_kind) ? Object.assign({},contact_options,{fromMenu:false,intro:" + expression(rankedContactLine, 'contact_rank_kind', 'contact_options', 'cargo') + ",intro_es:" + expression(rankedContactLine, 'contact_rank_kind', 'contact_options', 'cargo', 'true') + "}) : null"),
193
+ // the first such pick in a row is answered and asked again; a second counts as a miss, with the same line
194
+ set('identity_contact_rank_first', 'contact_rank_first', '!!contact_rank_options && !cargo.gceRanked'),
195
+ effect('identity_contact_rank_mark', '(contact_rank_options ? cargo.gceRanked=true : true,true)'),
196
+ set('identity_contact_rank_line', 'contact_error', 'contact_rank_options ? contact_rank_options.intro : contact_error'), set('identity_contact_rank_line_es', 'contact_error_es', 'contact_rank_options ? contact_rank_options.intro_es : contact_error_es'),
163
197
  // A classified response is not authority to abandon identification: the question again, then the bounded recovery menu.
164
- when('identity_contact_unmapped_retry', "contact_kind === 'unmapped'", contactMiss('identity_contact_unmapped')),
198
+ cases('identity_contact_unmapped_retry', {
199
+ "condition: contact_rank_kind === '__agent'": call('identity_contact_rank_agent', 'live-agent-requested', undefined, 'reboot'),
200
+ "condition: contact_rank_kind === 'exit'": call('identity_contact_rank_exit', '{{contact_options.cancel_flow}}', undefined, 'reboot'),
201
+ "condition: contact_rank_kind === 'text'": call('identity_contact_rank_text', 'switch-to-text', undefined, 'reboot'),
202
+ "condition: contact_rank_first": contactReplay('identity_contact_rank_again', { contact_options: '{{contact_rank_options}}', gce_missed: true }),
203
+ "condition: contact_kind === 'unmapped'": contactMiss('identity_contact_unmapped'), default: effect('identity_contact_unmapped_retry_skip', 'true')
204
+ }),
165
205
  set('identity_contact_number', 'acct_number', "contact_kind === 'account' ? String(contact_id.value) : ''"),
166
206
  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 : ''"),
167
207
  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)"),
@@ -287,20 +327,21 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
287
327
  set('otp_cancel', 'otp_cancel', "cargo.authCancelFlow || 'contact-support'"),
288
328
  set('otp_email_too_ready', 'email_too', "!!(cargo.otp_cell_number && cargo.otpAltSent !== true && cargo.otpAltSent !== 'failed' && validateEmail(String(cargo.otpAltEmail || '')))"),
289
329
  set('otp_reset_no_code', 'no_code_given', 'false'), set('otp_reset_invite', 'whatsapp_invite_sent', 'false'), set('otp_reset_callback', 'answer_key', "''"),
290
- when('otp_tenant_code', 'cargo.authOptions && cargo.authOptions.code_validator && normalized_otp_code.length !== 6 && /[0-9]/.test(user_choice)', call('otp_tenant_code_call', '{{cargo.authOptions.code_validator}}', { answer: '{{user_choice}}' })),
330
+ when('otp_tenant_code', 'cargo.authOptions && cargo.authOptions.code_validator && String(user_choice).replace(/\\D/g,\'\').length !== 6 && /[0-9]/.test(user_choice)', call('otp_tenant_code_call', '{{cargo.authOptions.code_validator}}', { answer: '{{user_choice}}' })),
291
331
  set('otp_other_given', 'other_account_given', "answer_key === 'another_account' ? (cargo.authOtherAccount=String(answer_value || ''),true) : false"),
292
332
  set('otp_other_requested', 'wants_other_account', 'other_account_given || !!(cargo.callerPreselected && normalized_otp_code.length !== 6 && ((cargo.authOptions && cargo.authOptions.other_whole_answer ? pickChoice(user_choice,[{key:\'other\',phrases:otp_phrases.other,exact:true}],false) === \'other\' : matchesChoice(user_choice,otp_phrases.other)) || otp_phrases.other_alone.includes(user_choice.replace(/[.,!?¡¿]/g,\'\').trim())))'),
293
333
  when('otp_tenant_answer', 'cargo.authOptions && cargo.authOptions.answer_handler && normalized_otp_code.length !== 6 && !wants_other_account && answer_key !== \'code_notice\'', call('otp_tenant_answer_call', '{{cargo.authOptions.answer_handler}}', { answer: '{{user_choice}}' })),
294
334
  set('otp_where_early', 'otp_where', expression(otpWhere, 'cargo')), set('otp_where_early_es', 'otp_where_es', expression(otpWhere, 'cargo', 'true')),
295
335
  cases('otp_response', {
296
- 'condition: normalized_otp_code.length === 6': { id: 'otp_check_tool', type: 'CALL-TOOL', tool: 'validate-otp', variable: 'otp_validation_result', args: { otp: '{{normalized_otp_code}}', container: '{{cargo}}' }, onFail: call('otp_check_failed', 'get-and-validate-otp-code', undefined, 'replace') },
336
+ // The tenant's reading of the digits comes first (owner 2026-11-18: a real account number is taken before a code is tried).
337
+ "condition: normalized_otp_code.length === 6 && answer_key !== 'another_account' && answer_key !== 'code_notice'": { id: 'otp_check_tool', type: 'CALL-TOOL', tool: 'validate-otp', variable: 'otp_validation_result', args: { otp: '{{normalized_otp_code}}', container: '{{cargo}}' }, onFail: call('otp_check_failed', 'get-and-validate-otp-code', undefined, 'replace') },
297
338
  'condition: wants_other_account': toParent(call('otp_change_account', 'authenticate-user', { cell_number: '', email: '', retrying: true, declined_caller: true }, 'replace')),
298
339
  // Email asked for at a code sent by text: authentication is an input step, so the contact question is asked again
299
340
  // (without the caller-ID offer) and the caller gives the email; a code sent by email keeps "no me llegó el correo" a resend.
300
341
  ['condition: email_too && normalized_otp_code.length !== 6 && (' + 'matchesChoice(user_choice,otp_phrases.resend) || matchesChoice(user_choice,otp_phrases.cannot_find) || matchesChoice(user_choice,otp_phrases.another_way) || matchesChoice(user_choice,otp_phrases.email)' + ')']: call('otp_email_too', 'send-otp-email-too'),
301
342
  'condition: !!cargo.otp_cell_number && normalized_otp_code.length !== 6 && matchesChoice(user_choice,otp_phrases.email)': toParent(call('otp_use_email', 'authenticate-user', { cell_number: '', email: '', retrying: true, declined_caller: true }, 'replace')),
302
343
  "condition: isExitRequest(user_choice)": call('otp_exit', '{{otp_cancel}}', undefined, 'reboot'),
303
- "condition: isAnswer(user_choice,'agent')": call('otp_agent', 'live-agent-requested', undefined, 'reboot'),
344
+ "condition: isAgentRequest(user_choice)": call('otp_agent', 'live-agent-requested', undefined, 'reboot'),
304
345
  "condition: isAnswer(user_choice,'text')": call('otp_text', 'switch-to-text', undefined, 'reboot'),
305
346
  'condition: matchesChoice(user_choice,otp_phrases.resend)': call('otp_resend', 'resend-otp-code', { resend_reason: 'requested' }),
306
347
  'condition: matchesChoice(user_choice,otp_phrases.cannot_find)': say('otp_cannot_find', '{{otp_where}}', '{{otp_where_es}}'),
@@ -1 +1 @@
1
- {"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,sEAQC;AAkGD;;;GAGG;AACH,sFA8HC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;mHACmH;AAEnH,iEAEC;AAGD,gGAOC;AAYD,kDAGC;AAED;;;;;;;;;;;;;;;;;;;;;;EAeC;AACD;;;;;;;;;;;;;;;;;;;;;;;EAgXC"}
1
+ {"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,sEAQC;AAkGD;;;GAGG;AACH,sFAiIC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;mHACmH;AAEnH,iEAEC;AAGD,gGAOC;AAYD,kDAGC;AAED;;;;;;;;;;;;;;;;;;;;;;EAeC;AACD;;;;;;;;;;;;;;;;;;;;;;;EAgXC"}
@@ -183,6 +183,10 @@ export function readInputProfile(profile, answer, isCurrent = true) {
183
183
  // other_needs_letter: a name, so a number that is no offered choice is not an answer ("15" at a city list).
184
184
  if (profile.other_needs_letter === true && !/\p{L}/u.test(raw))
185
185
  return null;
186
+ // other_needs_digit: a number (an account number), so a word that is no offered choice is not an answer: the reply
187
+ // ranker reads it against the choices ("Omitr" at OMITIR; owner 2026-11-18).
188
+ if (profile.other_needs_digit === true && !/\d/.test(raw))
189
+ return null;
186
190
  return isCurrent && profile.accept_other === true && raw.trim() ? { value: raw.trim(), ...(profile.narrative === true ? { fallback: true } : {}), spans: [[0, raw.length]] } : null;
187
191
  }
188
192
  else if (kind === 'amount') {
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:48e6e2c4fceae55d0e1cf8184768c712140e1b03251a75d54ca307412312d33a";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:4712b40cf38385dbcf624dddb1f5b5f968a919ea8a6ae2be1d03dbccb72868ec";
@@ -196,7 +196,7 @@ Profiles:
196
196
 
197
197
  | `profile.kind` | Options |
198
198
  | --- | --- |
199
- | `choice` | `choices:[{key,phrases,label?,label_es?,keys?,exact?,neutral?,negative?,current_only?}]`; optional `accept_other`, `numeric_values`, `narrative`, `whole_phrases`, `template_words`. |
199
+ | `choice` | `choices:[{key,phrases,label?,label_es?,keys?,exact?,neutral?,negative?,current_only?}]`; optional `accept_other` (with `other_needs_letter`: other text only with a letter, such as a city; with `other_needs_digit`: only with a digit, such as an account number, so a word that is no choice goes to the reply ranker), `numeric_values`, `narrative`, `whole_phrases`, `template_words`. |
200
200
  | `digits` | `min`, `max`: one unambiguous digit run of that length. |
201
201
  | `identifier` | `pattern`: permitted account identifier shape. |
202
202
  | `pattern` | `regex`, optional `flags`, `group`; optional `accept_other` for the current field only, `whole_phrases`, `template_words`; `spoken_digits` (`true`, or `'house_number'` when a numbered street can follow) reads a number said in pieces as one number ("5 0 9 Lazy Lane", "apt 2 0 4"), required on any pattern that reads digits. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.75.0",
3
+ "version": "1.76.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",