jsfe 1.88.0 → 1.90.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.
- package/README.md +1 -1
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +7 -3
- package/dist/helpers/capture.d.ts.map +1 -1
- package/dist/helpers/capture.js +9 -4
- package/dist/helpers/card-checks.d.ts +5 -1
- package/dist/helpers/card-checks.d.ts.map +1 -1
- package/dist/helpers/card-checks.js +11 -2
- package/dist/helpers/contact.d.ts +4 -3
- package/dist/helpers/contact.d.ts.map +1 -1
- package/dist/helpers/contact.js +73 -4
- package/dist/helpers/match-inputs.d.ts.map +1 -1
- package/dist/helpers/match-inputs.js +46 -34
- package/dist/helpers/numbers.d.ts +3 -0
- package/dist/helpers/numbers.d.ts.map +1 -1
- package/dist/helpers/numbers.js +5 -0
- package/dist/runtime-identity.js +1 -1
- package/docs/architecture-guide.md +1 -1
- package/docs/copilot-reference.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -541,7 +541,7 @@ const engine = new WorkflowEngine(logger, aiCallback, flows, tools,
|
|
|
541
541
|
- Checks: `validateDigits(input, min, max)` (digits only, length in range), `validatePhone(phone, acceptInternational)`
|
|
542
542
|
(10 digits, or 11 with a leading 1; with `acceptInternational`, any 11 to 15), `validateEmail` (`x@y.z`, no spaces),
|
|
543
543
|
`validateCardNumber` (12 to 19 digits passing Luhn), `validateExpiration(MM, YY)` (a real month, not expired, at most
|
|
544
|
-
|
|
544
|
+
6 years out), and the async `validateOTP(code, container)`, which accepts a code whose SHA-256 matches
|
|
545
545
|
`container.otpHash` within 10 minutes of `container.otpTimestamp`, or a second code emailed beside it
|
|
546
546
|
(`otpAltHash` / `otpAltTimestamp`, jsfe 1.17.0) on its own clock; accepting either clears both (`clearOtp`).
|
|
547
547
|
Accepting sets `container.otpVerified` and `otpVerifiedAt`; an expired code is cleared. A refusal leaves its
|
|
@@ -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,4EAMC;AAkHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;
|
|
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,4EAMC;AAkHD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAgKD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AA/QD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAkSzC,0BAAsK"}
|
|
@@ -134,7 +134,7 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
|
|
|
134
134
|
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})"),
|
|
135
135
|
// options carried from an earlier verification may name a task the caller has since closed; opening under it fails
|
|
136
136
|
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"),
|
|
137
|
-
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
|
|
137
|
+
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",reader:"account",regex:contact_options.account_pattern}]:[]),true)'),
|
|
138
138
|
when('identity_contact_new_rejection_series', '!gce_rejected', effect('identity_contact_rejections_reset', '(cargo.gceRejects=0,true)')),
|
|
139
139
|
when('identity_contact_new_miss_series', '!gce_missed', effect('identity_contact_misses_reset', '(cargo.gceMisses=0,cargo.gceRanked=false,true)')),
|
|
140
140
|
set('identity_contact_partial', 'contact_partial', "!!(contact_options.merge_partials && gce_partial && cargo.gcePartial)"),
|
|
@@ -236,7 +236,7 @@ const auth = worker('authenticate-user', 'AuthenticateUser', 'Authenticate a con
|
|
|
236
236
|
when('auth_join_challenge', 'auth_join', call('auth_join_collect', 'get-and-validate-otp-code')),
|
|
237
237
|
when('auth_join_release', 'auth_join', call('auth_join_gate_end', 'task-gate', { form: '{{parent_form}}', gate: 'authenticate-user', active: false })),
|
|
238
238
|
when('auth_join_return', 'auth_join', end('auth_join_complete')),
|
|
239
|
-
effect('auth_challenge_init', "(cargo.otpLateCode='',cargo.otpResends=0,cargo.otpMismatches=0,cargo.otpFormatMisses=0,cargo.otpWordMisses=0,cargo.otp_cell_number=cell_number || '',cargo.otp_email=email || '',cargo.otpAltSent=false,cargo.otpAltHash=null,cargo.otpAltTimestamp=null,true)"),
|
|
239
|
+
effect('auth_challenge_init', "(cargo.otpLateCode='',cargo.otpResends=0,cargo.otpMismatches=0,cargo.otpFormatMisses=0,cargo.otpWordMisses=0,cargo.otpCodeHolds=0,cargo.otp_cell_number=cell_number || '',cargo.otp_email=email || '',cargo.otpAltSent=false,cargo.otpAltHash=null,cargo.otpAltTimestamp=null,true)"),
|
|
240
240
|
when('auth_send_limit', `((cargo.otpSendsTo || {})[${OTP_DESTINATION_JS}] || 0) >= ${MAX_OTP_SENDS_PER_CONTACT}`, call('auth_send_limit_end', 'verification-failed', { form: '{{cargo.authOptions.parent_form}}' }, 'reboot')),
|
|
241
241
|
call('auth_send', 'send-otp-code'), when('auth_send_failed', 'cargo.otpSendFailure', call('auth_send_failure', 'otp-send-failed', undefined, 'replace')),
|
|
242
242
|
call('auth_code', 'get-and-validate-otp-code'),
|
|
@@ -317,7 +317,7 @@ function otpPhoneUnavailable(value) {
|
|
|
317
317
|
// What the reply ranker may take at the code question beside the code: the step's offers. Email and another account are
|
|
318
318
|
// offered only where the step offers them (a code sent by text; a caller-ID preselection).
|
|
319
319
|
const OTP_REPLY_CHOICES = [{ key: 'email', label: 'use the email on the account instead of the phone' }, { key: 'another_account', label: 'use another account' }, { key: 'no_other_account', label: 'says they have no other account, this is their only one' },
|
|
320
|
-
{ key: 'where', label: 'asks where the code was sent' }, { key: 'cannot_find', label: 'cannot find the code, or it is not there' }, { key: 'another_way', label: 'asks for another way to get the code or to verify' }, { key: 'resend', label: 'the code did not arrive; send it again' }, { key: 'no_phone', label: 'no longer has that phone or number' }, { key: '__agent', label: 'speak with a person (a live agent)' }];
|
|
320
|
+
{ key: 'where', label: 'asks where the code was sent' }, { key: 'cannot_find', label: 'cannot find the code, or it is not there' }, { key: 'another_way', label: 'asks for another way to get the code or to verify' }, { key: 'resend', label: 'the code did not arrive; send it again' }, { key: 'has_code', label: 'has the code now or is getting it (here it is, one moment, let me look)' }, { key: 'no_phone', label: 'no longer has that phone or number' }, { key: '__agent', label: 'speak with a person (a live agent)' }];
|
|
321
321
|
const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a challenge response with explicit bounded retries, alternate-contact handling and tenant callbacks.', { loopBound: '3 mismatches, 3 format misses, 2 resends, 3 sends per contact', variables: vars({ otp_phrases: OTP_WORDS, email_too: false, no_code_given: false, wants_other_account: false, other_account_given: false, otp_validation_result: false, whatsapp_invite_sent: false, invite_text: '', otp_cancel: 'contact-support', answer_key: '', answer_value: '', otp_reply_choices: OTP_REPLY_CHOICES, otp_offers: [], otp_reply: {}, otp_where: '', otp_where_es: '' }), contract: { role: 'gate', summary: 'Validate the active one-time challenge', tools: ['validate-otp', 'send-whatsapp-invite'], result: { path: 'cargo.otpVerified', type: 'boolean' } }, steps: [
|
|
322
322
|
set('otp_cancel', 'otp_cancel', "cargo.authCancelFlow || 'contact-support'"),
|
|
323
323
|
set('otp_email_too_ready', 'email_too', "!!(cargo.otp_cell_number && cargo.otpAltSent !== true && cargo.otpAltSent !== 'failed' && validateEmail(String(cargo.otpAltEmail || '')))"),
|
|
@@ -364,12 +364,16 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
|
|
|
364
364
|
when('otp_off_topic', 'no_code_given', { id: 'otp_reply_rank', type: 'DISPATCH', onResponse: 'continue', responseContext: 'Please say the 6-digit verification code I sent you. (Por favor diga el código de verificación de 6 dígitos que le envié.)', responseChoices: 'otp_offers', responseVariable: 'otp_reply', onNoIntent: 'stay' }),
|
|
365
365
|
set('otp_where', 'otp_where', expression(otpWhere, 'cargo')), set('otp_where_es', 'otp_where_es', expression(otpWhere, 'cargo', 'true')),
|
|
366
366
|
set('otp_reply_picked', 'no_code_given', "no_code_given && !(otp_reply && otp_reply.key && String(otp_reply.key).indexOf('usecase:') !== 0)"),
|
|
367
|
+
// "Aquí está", "one moment, let me look" (owner 2026-11-23; prod 11-22 11:48 ended verification as a third word miss): the caller
|
|
368
|
+
// is answering, so it is no miss. Its own bound: from the fourth, it counts as a word miss again.
|
|
369
|
+
set('otp_hold_cap', 'no_code_given', "no_code_given || !!(otp_reply && otp_reply.key === 'has_code' && (cargo.otpCodeHolds=Number(cargo.otpCodeHolds || 0)+1) > 3)"),
|
|
367
370
|
cases('otp_reply_route', {
|
|
368
371
|
"condition: !no_code_given && email_too && otp_reply && ['email','resend','cannot_find','another_way'].includes(otp_reply.key)": call('otp_ranked_email_too', 'send-otp-email-too'),
|
|
369
372
|
"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')),
|
|
370
373
|
"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')),
|
|
371
374
|
"condition: !no_code_given && otp_reply && (otp_reply.key === 'where' || otp_reply.key === 'cannot_find')": say('otp_ranked_where', '{{otp_where}}', '{{otp_where_es}}'),
|
|
372
375
|
"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.'),
|
|
376
|
+
"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.'),
|
|
373
377
|
"condition: !no_code_given && otp_reply && otp_reply.key === 'resend'": call('otp_ranked_resend', 'resend-otp-code', { resend_reason: 'requested' }),
|
|
374
378
|
"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),
|
|
375
379
|
"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.'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/helpers/capture.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/helpers/capture.js"],"names":[],"mappings":"AAoBA;;;SA8BC"}
|
package/dist/helpers/capture.js
CHANGED
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
* through `warn`, so one bad tenant pattern cannot stop the others.
|
|
7
7
|
*
|
|
8
8
|
* A pattern may name a reader instead of a regex: { variable, reader: 'phone' | 'email' } reads the answer with
|
|
9
|
-
* readPhone / readEmail (spoken and spelled forms included)
|
|
9
|
+
* readPhone / readEmail (spoken and spelled forms included); { variable, reader: 'account', regex } reads it with
|
|
10
|
+
* readIdentifier, an account whose digits match the tenant's regex (a number inside an email is the email's).
|
|
10
11
|
*
|
|
11
12
|
* Part of jsfe/helpers; imports only its sibling contact.js.
|
|
12
13
|
*/
|
|
13
|
-
import { readEmail, readPhone } from './contact.js';
|
|
14
|
-
const READERS = {
|
|
14
|
+
import { readEmail, readPhone, readIdentifier } from './contact.js';
|
|
15
|
+
const READERS = {
|
|
16
|
+
phone: (input) => readPhone(input),
|
|
17
|
+
email: (input) => readEmail(input),
|
|
18
|
+
account: (input, pattern) => { const id = readIdentifier(input, pattern.regex || ''); return id && id.kind === 'account' ? id.value : ''; }
|
|
19
|
+
};
|
|
15
20
|
export function normalizeAndFindCapture(userInput, patterns, warn = () => { }) {
|
|
16
21
|
if (!Array.isArray(patterns)) {
|
|
17
22
|
return null;
|
|
@@ -19,7 +24,7 @@ export function normalizeAndFindCapture(userInput, patterns, warn = () => { }) {
|
|
|
19
24
|
else {
|
|
20
25
|
for (const pattern of patterns) {
|
|
21
26
|
if (pattern && READERS[pattern.reader]) {
|
|
22
|
-
const value = READERS[pattern.reader](userInput);
|
|
27
|
+
const value = READERS[pattern.reader](userInput, pattern);
|
|
23
28
|
if (value) {
|
|
24
29
|
return { variable: pattern.variable, value };
|
|
25
30
|
}
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/** 12–19 digits passing the Luhn checksum (catches nearly every typo, on every network). */
|
|
5
5
|
export function validateCardNumber(input: any): boolean;
|
|
6
|
-
/** MM and YY (two digits each), a real month, not expired, at most
|
|
6
|
+
/** MM and YY (two digits each), a real month, not expired, at most 6 years out (owner 2026-11-23: issuers set at most 5;
|
|
7
|
+
* one more for safety). `now` is for tests. */
|
|
7
8
|
export function validateExpiration(month: any, year: any, now?: Date): boolean;
|
|
9
|
+
/** A spoken or typed expiration's digits as MMYY when they are a valid one (validateExpiration), else ''. Month then year,
|
|
10
|
+
* as the card expiration validator reads digits: "0929", "929", "150" (01/50, past the window: ''), "09 2029", "09029". */
|
|
11
|
+
export function expirationDigits(value: any, now?: Date): string;
|
|
8
12
|
//# sourceMappingURL=card-checks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-checks.d.ts","sourceRoot":"","sources":["../../src/helpers/card-checks.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4FAA4F;AAC5F,wDAoBC;AAED
|
|
1
|
+
{"version":3,"file":"card-checks.d.ts","sourceRoot":"","sources":["../../src/helpers/card-checks.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4FAA4F;AAC5F,wDAoBC;AAED;+CAC+C;AAC/C,+EAYC;AAED;2HAC2H;AAC3H,iEAKC"}
|
|
@@ -26,7 +26,8 @@ export function validateCardNumber(input) {
|
|
|
26
26
|
return sum % 10 === 0;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
/** MM and YY (two digits each), a real month, not expired, at most
|
|
29
|
+
/** MM and YY (two digits each), a real month, not expired, at most 6 years out (owner 2026-11-23: issuers set at most 5;
|
|
30
|
+
* one more for safety). `now` is for tests. */
|
|
30
31
|
export function validateExpiration(month, year, now = new Date()) {
|
|
31
32
|
const m = String(month || '').replace(/\D/g, '');
|
|
32
33
|
const y = String(year || '').replace(/\D/g, '');
|
|
@@ -42,5 +43,13 @@ export function validateExpiration(month, year, now = new Date()) {
|
|
|
42
43
|
return false;
|
|
43
44
|
if (yNum === curYear && mNum < curMonth)
|
|
44
45
|
return false;
|
|
45
|
-
return yNum <= curYear +
|
|
46
|
+
return yNum <= curYear + 6;
|
|
47
|
+
}
|
|
48
|
+
/** A spoken or typed expiration's digits as MMYY when they are a valid one (validateExpiration), else ''. Month then year,
|
|
49
|
+
* as the card expiration validator reads digits: "0929", "929", "150" (01/50, past the window: ''), "09 2029", "09029". */
|
|
50
|
+
export function expirationDigits(value, now = new Date()) {
|
|
51
|
+
const digits = String(value ?? '').replace(/\D/g, '');
|
|
52
|
+
const m = /^(0?[1-9]|1[0-2])(?:20)?(\d{2})$/.exec(digits) || /^(0[1-9])0(\d{2})$/.exec(digits);
|
|
53
|
+
const mm = m ? m[1].padStart(2, '0') : '';
|
|
54
|
+
return m && validateExpiration(mm, m[2], now) ? mm + m[2] : '';
|
|
46
55
|
}
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
* With `{literal:true}`, a complete visible address wins over surrounding prose; absent one,
|
|
8
8
|
* the same spoken/spelled parsing applies. Distinct visible addresses are ambiguous and return empty.
|
|
9
9
|
*/
|
|
10
|
-
export function readEmail(text: any, {
|
|
11
|
-
literal?: boolean | undefined;
|
|
12
|
-
}): string;
|
|
10
|
+
export function readEmail(text: any, options?: {}): string;
|
|
13
11
|
/**
|
|
14
12
|
* An address at a known provider said without its ending ("Cecilia 41, at Yahoo."): its name and provider
|
|
15
13
|
* ("cecilia41@yahoo"), so the caller is asked only for what comes after the provider (owner 2026-11-18, prod 11-18 17:30:
|
|
@@ -29,6 +27,9 @@ export function emailSaid(address: any, voice: any, es?: boolean): string;
|
|
|
29
27
|
* 2026-11-17: "Juana Perez 12 34 at gmail." heard "the phone number you provided isn't valid").
|
|
30
28
|
*/
|
|
31
29
|
export function emailAttempt(text: any): boolean;
|
|
30
|
+
/** Where the address rawEmail read sits in the answer: [[start, end], ...]. Typed, the address itself; spoken (at / arroba /
|
|
31
|
+
* dot / punto), the shortest run of words that reads as it, with a spoken ending after it. */
|
|
32
|
+
export function emailSpans(raw: any, value: any): any[][];
|
|
32
33
|
/**
|
|
33
34
|
* The 10-digit North American number in the answer (a leading 1 dropped), or ''. A caller who restates the number
|
|
34
35
|
* ("Area code 21. 213 555 0147.", "Area code, 213 555. Area code 213-555-0147.") is read by the last complete number
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../src/helpers/contact.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contact.d.ts","sourceRoot":"","sources":["../../src/helpers/contact.js"],"names":[],"mappings":"AAwBA;;;;;;;;GAQG;AACH,2DAEC;AAsDD;;;;GAIG;AACH,sDASC;AAED;;;GAGG;AACH,+CASC;AAED,+GAA+G;AAC/G,0EAGC;AAoBD;;;;GAIG;AACH,iDAEC;AAID;8FAC8F;AAC9F,0DAsBC;AA+BD;;;;;GAKG;AACH,0CAWC;AAED;;;;;GAKG;AACH,0DAgBC;AAED,qHAAqH;AACrH,2DAIC;AAED;;;;GAIG;AACH;;;SAmBC;AAED;;;GAGG;AACH,sDAOC;AAED;;;;;GAKG;AACH,yEAUC;AAQD;;;;;GAKG;AACH,qDAIC;AAED,mHAAmH;AACnH,oDAIC"}
|
package/dist/helpers/contact.js
CHANGED
|
@@ -5,8 +5,15 @@
|
|
|
5
5
|
* address ("juan at gmail dot com", "j u a n arroba gmail punto com"), so the same answer worked for a statement and
|
|
6
6
|
* failed at the identity question (flow design review 2026-10-13).
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* An email and a phone claim the part of the answer they were read from, and a number inside the email is never read as
|
|
9
|
+
* another field (owner 2026-11-24: the longest match wins; a fragment of a match is never another field's). When the email
|
|
10
|
+
* and a complete phone overlap, the one that begins first keeps its part (a tie: the phone) and the other is read again on
|
|
11
|
+
* the rest. Prod 2026-11-23: the digits inside an address were read as an account number, an address's digits joined an
|
|
12
|
+
* account number into a phone, and a phone typed before an address became the start of the address.
|
|
13
|
+
*
|
|
14
|
+
* Part of jsfe/helpers; imports its sibling numbers.js.
|
|
9
15
|
*/
|
|
16
|
+
import { findNumbers } from './numbers.js';
|
|
10
17
|
// Words that introduce an address and are never part of it ("my email is", "mi correo es", "send it to").
|
|
11
18
|
const EMAIL_LEAD_IN = new Set(['my', 'mi', 'su', 'your', 'email', 'e-mail', 'mail', 'correo', 'electronico', 'electrónico',
|
|
12
19
|
'address', 'dirección', 'direccion', 'de', 'is', 'es', "it's", 'its', 'it', 'the', 'el', 'la', 'to', 'para', 'send',
|
|
@@ -22,7 +29,11 @@ const EMAIL_LEAD_IN = new Set(['my', 'mi', 'su', 'your', 'email', 'e-mail', 'mai
|
|
|
22
29
|
* With `{literal:true}`, a complete visible address wins over surrounding prose; absent one,
|
|
23
30
|
* the same spoken/spelled parsing applies. Distinct visible addresses are ambiguous and return empty.
|
|
24
31
|
*/
|
|
25
|
-
export function readEmail(text,
|
|
32
|
+
export function readEmail(text, options = {}) {
|
|
33
|
+
return emailClaim(text, options).email;
|
|
34
|
+
}
|
|
35
|
+
/** readEmail's reading of the whole answer, before any phone claims its part. */
|
|
36
|
+
function rawEmail(text, { literal = false } = {}) {
|
|
26
37
|
// Contextual prose must not become part of an already complete, visible address. This
|
|
27
38
|
// explicit mode preserves the default spoken/spelled-name grammar for existing callers.
|
|
28
39
|
if (literal) {
|
|
@@ -139,6 +150,64 @@ export function emailAttempt(text) {
|
|
|
139
150
|
return /@|\barroba\b|\b(?:g\s?mail|gmai|hotmail|hot mail|yahoo|outlook|icloud|aol)\b/i.test(String(text ?? ''));
|
|
140
151
|
}
|
|
141
152
|
const northAmerican = (digits) => digits.length === 11 && digits.startsWith('1') ? digits.slice(1) : digits.length === 10 ? digits : '';
|
|
153
|
+
/** Where the address rawEmail read sits in the answer: [[start, end], ...]. Typed, the address itself; spoken (at / arroba /
|
|
154
|
+
* dot / punto), the shortest run of words that reads as it, with a spoken ending after it. */
|
|
155
|
+
export function emailSpans(raw, value) {
|
|
156
|
+
const literal = raw.toLowerCase().indexOf(value);
|
|
157
|
+
if (literal >= 0)
|
|
158
|
+
return [[literal, literal + value.length]];
|
|
159
|
+
// Spoken addresses may use at / arroba / dot / punto. Select the shortest source window yielding this address.
|
|
160
|
+
const tokens = [...raw.matchAll(/\S+/g)];
|
|
161
|
+
if (tokens.length > 128)
|
|
162
|
+
return [[0, raw.length]];
|
|
163
|
+
for (let size = 1; size <= tokens.length; size++) {
|
|
164
|
+
const spans = [];
|
|
165
|
+
for (let i = 0; i + size <= tokens.length; i++) {
|
|
166
|
+
const a = tokens[i].index, b = tokens[i + size - 1].index + tokens[i + size - 1][0].length;
|
|
167
|
+
if (rawEmail(raw.slice(a, b)) === value) {
|
|
168
|
+
// "juan at gmail" already reads as gmail.com: the spoken ending after it belongs to the same address
|
|
169
|
+
let j = i + size;
|
|
170
|
+
while (j < tokens.length && /^(?:dot|punto|punt|ponto|com|con|\.com)[.,;:!?]*$/i.test(tokens[j][0]))
|
|
171
|
+
j++;
|
|
172
|
+
spans.push([a, j > i + size ? tokens[j - 1].index + tokens[j - 1][0].length : b]);
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
// this window is not the address
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (spans.length)
|
|
179
|
+
return spans;
|
|
180
|
+
}
|
|
181
|
+
return [[0, raw.length]];
|
|
182
|
+
}
|
|
183
|
+
const blank = (text, spans) => spans.reduce((out, [a, b]) => out.slice(0, a) + ' '.repeat(b - a) + out.slice(b), text);
|
|
184
|
+
/** The email in the answer and the part it claims: {email, spans}. A complete North American phone number overlapping it
|
|
185
|
+
* that begins no later than the email keeps its part, and the email is read again on the rest. */
|
|
186
|
+
function emailClaim(text, options = {}) {
|
|
187
|
+
const t = String(text ?? '');
|
|
188
|
+
const email = rawEmail(t, options);
|
|
189
|
+
if (!email) {
|
|
190
|
+
return { email: '', spans: [] };
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const spans = emailSpans(t, email);
|
|
194
|
+
const start = Math.min(...spans.map(([a]) => a));
|
|
195
|
+
const phone = findNumbers(t).find((n) => northAmerican(n.value) && spans.some(([a, b]) => n.start < b && n.end > a));
|
|
196
|
+
if (phone && phone.start <= start) {
|
|
197
|
+
const rest = blank(t, [[phone.start, phone.end]]);
|
|
198
|
+
const again = rawEmail(rest, options);
|
|
199
|
+
return again ? { email: again, spans: emailSpans(rest, again) } : { email: '', spans: [] };
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
return { email, spans };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/** The answer with the email's part blanked, for the digit readers: its digits are the email's. */
|
|
207
|
+
function withoutEmail(text) {
|
|
208
|
+
const t = String(text ?? '');
|
|
209
|
+
return blank(t, emailClaim(t).spans);
|
|
210
|
+
}
|
|
142
211
|
/**
|
|
143
212
|
* The 10-digit North American number in the answer (a leading 1 dropped), or ''. A caller who restates the number
|
|
144
213
|
* ("Area code 21. 213 555 0147.", "Area code, 213 555. Area code 213-555-0147.") is read by the last complete number
|
|
@@ -146,7 +215,7 @@ const northAmerican = (digits) => digits.length === 11 && digits.startsWith('1')
|
|
|
146
215
|
* nothing. An answer with an international prefix (+, plus, más, 00) is never split, so it stays international.
|
|
147
216
|
*/
|
|
148
217
|
export function readPhone(text) {
|
|
149
|
-
const t =
|
|
218
|
+
const t = withoutEmail(text);
|
|
150
219
|
const whole = northAmerican(t.replace(/[^0-9]/g, ''));
|
|
151
220
|
if (whole) {
|
|
152
221
|
return whole;
|
|
@@ -197,7 +266,7 @@ export function callerIsInternational(cargo) {
|
|
|
197
266
|
* accountPattern (a regex source, e.g. '^5\\d{6,7}$') is the tenant's account-number shape; its digits win first.
|
|
198
267
|
*/
|
|
199
268
|
export function readIdentifier(text, accountPattern = '') {
|
|
200
|
-
const digits =
|
|
269
|
+
const digits = withoutEmail(text).replace(/[^0-9]/g, '');
|
|
201
270
|
let account = false;
|
|
202
271
|
try {
|
|
203
272
|
account = !!accountPattern && new RegExp(accountPattern).test(digits);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"match-inputs.d.ts","sourceRoot":"","sources":["../../src/helpers/match-inputs.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,sEAQC;AA4ED;;;GAGG;AACH,sFAiIC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;mHACmH;AAEnH,iEAEC;AAID,gGAQC;AAYD,kDAGC;AAED;;;;;;;GAOG;AACH;;;;SAcC;AACD;;;;;GAKG;AACH;;;;;;;;;;;;;;;;;;;;;;EAaC;AACD;;;;;;;;;;;;;;;;;;;;;;EAeC;AAyDD;;;;;;;;;;;;;;;;;;;;;;;EAiZC"}
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { matchesChoice } from './matches-choice.js';
|
|
12
12
|
import { pickChoice, amountInAnswer, isAmountAnswer, isReaderFiller, ANSWER_WORDS, CONFIRM_WORDS } from './answer.js';
|
|
13
|
-
import { readEmail, readPhone, readInternationalPhone, readIdentifier } from './contact.js';
|
|
13
|
+
import { readEmail, readPhone, readInternationalPhone, readIdentifier, emailSpans } from './contact.js';
|
|
14
14
|
import { readSpokenMoney } from './spoken-money.js';
|
|
15
15
|
import { readMoneyAmount, isPartialMoneyAnswer } from './money.js';
|
|
16
16
|
import { pickProviderQuestion } from './form-sources.js';
|
|
17
17
|
import { spokenDigitsText, wholeSpokenNumber } from './spoken-digits.js';
|
|
18
|
-
import { DIGIT_RUN, findNumbers, assignNumbers, NUMBER_KINDS } from './numbers.js';
|
|
18
|
+
import { DIGIT_RUN, findNumbers, assignNumbers, NUMBER_KINDS, presetValid } from './numbers.js';
|
|
19
|
+
import { expirationDigits, validateExpiration } from './card-checks.js';
|
|
19
20
|
/**
|
|
20
21
|
* This turn's acceptance decisions for the host to log, appended per match: fields filled out of order, in a compound
|
|
21
22
|
* answer or as an invited input, and every refused reading, by form, field and rule. Field names and rules only, never
|
|
@@ -91,34 +92,6 @@ function choiceSpans(raw, words) {
|
|
|
91
92
|
}
|
|
92
93
|
return spans;
|
|
93
94
|
}
|
|
94
|
-
function emailSpans(raw, value) {
|
|
95
|
-
const literal = raw.toLowerCase().indexOf(value);
|
|
96
|
-
if (literal >= 0)
|
|
97
|
-
return [[literal, literal + value.length]];
|
|
98
|
-
// Spoken addresses may use at / arroba / dot / punto. Select the shortest source window yielding this address.
|
|
99
|
-
const tokens = [...raw.matchAll(/\S+/g)];
|
|
100
|
-
if (tokens.length > 128)
|
|
101
|
-
return [[0, raw.length]];
|
|
102
|
-
for (let size = 1; size <= tokens.length; size++) {
|
|
103
|
-
const spans = [];
|
|
104
|
-
for (let i = 0; i + size <= tokens.length; i++) {
|
|
105
|
-
const a = tokens[i].index, b = tokens[i + size - 1].index + tokens[i + size - 1][0].length;
|
|
106
|
-
if (readEmail(raw.slice(a, b)) === value) {
|
|
107
|
-
// "juan at gmail" already reads as gmail.com: the spoken ending after it belongs to the same address
|
|
108
|
-
let j = i + size;
|
|
109
|
-
while (j < tokens.length && /^(?:dot|punto|punt|ponto|com|con|\.com)[.,;:!?]*$/i.test(tokens[j][0]))
|
|
110
|
-
j++;
|
|
111
|
-
spans.push([a, j > i + size ? tokens[j - 1].index + tokens[j - 1][0].length : b]);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
// this window is not the address
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (spans.length)
|
|
118
|
-
return spans;
|
|
119
|
-
}
|
|
120
|
-
return [[0, raw.length]];
|
|
121
|
-
}
|
|
122
95
|
/** Remove independently spent evidence while leaving the original narrative value intact. */
|
|
123
96
|
function unclaimedSpans(raw, readings) {
|
|
124
97
|
let spans = [[0, raw.length]];
|
|
@@ -325,12 +298,14 @@ export function readInputProfile(profile, answer, isCurrent = true) {
|
|
|
325
298
|
export function saysConfirmWord(answer, spec) {
|
|
326
299
|
return [spec?.word, spec?.word_es].some((word) => word && matchesChoice(String(answer ?? ''), [String(word).toLowerCase()]));
|
|
327
300
|
}
|
|
328
|
-
// confirm_out_of_order's line: {value} the number (digit by digit on a call
|
|
301
|
+
// confirm_out_of_order's line: {value} the number (digit by digit on a call, unless spec.say_digits is false: an amount is
|
|
302
|
+
// said as a number), {word} its word.
|
|
329
303
|
export function confirmOutOfOrderLine(spec, value, language, voice) {
|
|
330
304
|
const es = language === 'es';
|
|
331
305
|
const line = String((es && spec?.message_es) || spec?.message || '');
|
|
332
306
|
const word = String((es && spec?.word_es) || spec?.word || '');
|
|
333
|
-
const
|
|
307
|
+
const said = spec?.say_digits === false ? String(value ?? '').replace(/\.0+$/, '') : String(value ?? '').split('').join(voice ? ' ' : '');
|
|
308
|
+
const own = line.replace('{value}', said).replace('{word}', word);
|
|
334
309
|
// The same number may name several fields ("1234": an expiration or a security code): each one's line is said (owner 2026-11-17).
|
|
335
310
|
return [own, ...(Array.isArray(spec?.also) ? spec.also.map((other) => confirmOutOfOrderLine({ ...other, also: undefined }, other.value, language, voice)) : [])].filter(Boolean).join(' ');
|
|
336
311
|
}
|
|
@@ -472,6 +447,31 @@ function numericSplit(raw, list, own) {
|
|
|
472
447
|
}
|
|
473
448
|
return out;
|
|
474
449
|
}
|
|
450
|
+
// Rule 1, a valid value (owner 2026-11-23): out of order a number is read as a field only when it is a valid value of that field.
|
|
451
|
+
// The card expiration is month then year within the card window ("150" is 01/50 and "300" is 03/00: neither); a month said by
|
|
452
|
+
// name is judged by its year. Every other preset by its own check (the card number's check digit, a code's length), a digits
|
|
453
|
+
// field by its declared length, an amount when it is more than zero. Any other field: its reader already decided.
|
|
454
|
+
function validOutOfOrder(field, value) {
|
|
455
|
+
const text = String(value ?? ''), digits = text.replace(/\D/g, '');
|
|
456
|
+
if (field.field === 'card_expiration' && /\p{L}/u.test(text)) {
|
|
457
|
+
return digits.length >= 2 && validateExpiration('12', digits.slice(-2));
|
|
458
|
+
}
|
|
459
|
+
else if (field.field === 'card_expiration') {
|
|
460
|
+
return !!expirationDigits(text);
|
|
461
|
+
}
|
|
462
|
+
else if (NUMBER_KINDS.includes(field.field) && presetValid(field.field, digits) !== null) {
|
|
463
|
+
return presetValid(field.field, digits);
|
|
464
|
+
}
|
|
465
|
+
else if (field.profile.kind === 'digits') {
|
|
466
|
+
return digits.length >= Number(field.profile.min || 1) && digits.length <= Number(field.profile.max || field.profile.min || digits.length);
|
|
467
|
+
}
|
|
468
|
+
else if (field.profile.kind === 'amount') {
|
|
469
|
+
return Number(text.replace(/[^\d.]/g, '')) > 0;
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
475
|
export function matchInputs(answer, candidates, current, choiceKey) {
|
|
476
476
|
const raw = asText(answer);
|
|
477
477
|
const list = Array.isArray(candidates) ? candidates.filter((c) => c && c.name && c.profile) : [];
|
|
@@ -581,7 +581,9 @@ export function matchInputs(answer, candidates, current, choiceKey) {
|
|
|
581
581
|
refused.push({ form: reading.form, name: reading.name, value: reading.value, rule: 'prerequisite_unmet', spans: reading.spans });
|
|
582
582
|
return false;
|
|
583
583
|
}
|
|
584
|
-
else if (bare(reading) && fieldOf(reading).profile.kind === 'amount') {
|
|
584
|
+
else if (bare(reading) && fieldOf(reading).profile.kind === 'amount' && !fieldOf(reading).confirm_out_of_order) {
|
|
585
|
+
// An amount that declares confirm_out_of_order is named among the number's fields below (owner 2026-11-23: a number
|
|
586
|
+
// is matched to every field it is valid for, and the caller is told how to mean each).
|
|
585
587
|
refused.push({ form: reading.form, name: reading.name, value: reading.value, rule: 'bare_amount_out_of_order', spans: reading.spans });
|
|
586
588
|
return false;
|
|
587
589
|
}
|
|
@@ -645,10 +647,20 @@ export function matchInputs(answer, candidates, current, choiceKey) {
|
|
|
645
647
|
// input.confirm_out_of_order {word, word_es, message, message_es}: out of order a number fills this input only beside its
|
|
646
648
|
// word ("account 5373850"). Alone it may be anything (a code said with an extra digit, owner 2026-11-02), so the caller is
|
|
647
649
|
// told how to mean it and the current question is asked again.
|
|
650
|
+
readings = readings.filter((reading) => {
|
|
651
|
+
if (reading.rule !== 'out_of_order' || validOutOfOrder(fieldOf(reading), reading.value)) {
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
refused.push({ form: reading.form, name: reading.name, value: reading.value, rule: 'invalid_out_of_order', spans: reading.spans });
|
|
656
|
+
return false;
|
|
657
|
+
}
|
|
658
|
+
});
|
|
648
659
|
const clarify = [];
|
|
649
660
|
readings = readings.filter((reading) => {
|
|
650
661
|
const field = fieldOf(reading);
|
|
651
|
-
|
|
662
|
+
// An amount asks its word only of a bare number (owner 2026-11-18): "109 con 47", "$150" or "150 dollars" is the amount.
|
|
663
|
+
if (reading.rule !== 'out_of_order' || !field.confirm_out_of_order || field.profile.kind === 'amount' && !bare(reading) || saysConfirmWord(raw, field.confirm_out_of_order)) {
|
|
652
664
|
return true;
|
|
653
665
|
}
|
|
654
666
|
else {
|
|
@@ -12,6 +12,9 @@ export function findNumbers(answer: any): {
|
|
|
12
12
|
restarts: any[];
|
|
13
13
|
groups: string[];
|
|
14
14
|
}[];
|
|
15
|
+
/** A preset field's own value check (a kind read with no spec: card_number, card_expiration, card_cvv, zip...): true when the
|
|
16
|
+
* digits are a valid value of it, false when not, null for a kind that needs its spec (date, pattern, digits). */
|
|
17
|
+
export function presetValid(kind: any, digits: any): boolean | null;
|
|
15
18
|
export function assignNumbers(numbers: any, specs: any, options: any): {
|
|
16
19
|
values: {};
|
|
17
20
|
ambiguous: any[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/helpers/numbers.js"],"names":[],"mappings":"AAoGA;;;;;GAKG;AACH;;;;;;;IAsBC;
|
|
1
|
+
{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../src/helpers/numbers.js"],"names":[],"mappings":"AAoGA;;;;;GAKG;AACH;;;;;;;IAsBC;AAuCD;kHACkH;AAClH,oEAEC;AAkED;;;;EAmCC;AAED;mFACmF;AACnF,qEASC;AAjRD;;;4EAG4E;AAC5E,+BAAqF;AAsJrF,oCAAqD"}
|
package/dist/helpers/numbers.js
CHANGED
|
@@ -194,6 +194,11 @@ const KNOWN_KINDS = {
|
|
|
194
194
|
digits: (spec) => length(Number(spec.min), Number(spec.max ?? spec.min))
|
|
195
195
|
};
|
|
196
196
|
export const NUMBER_KINDS = Object.keys(KNOWN_KINDS);
|
|
197
|
+
/** A preset field's own value check (a kind read with no spec: card_number, card_expiration, card_cvv, zip...): true when the
|
|
198
|
+
* digits are a valid value of it, false when not, null for a kind that needs its spec (date, pattern, digits). */
|
|
199
|
+
export function presetValid(kind, digits) {
|
|
200
|
+
return Object.hasOwn(KNOWN_KINDS, kind) && !['date', 'pattern', 'digits'].includes(kind) ? !!KNOWN_KINDS[kind]({})(String(digits ?? '')) : null;
|
|
201
|
+
}
|
|
197
202
|
/** specs → [{name, read}]. A spec list is the documented form; a {name: (digits) => false | true | value} object (jsfe
|
|
198
203
|
* 1.81-1.83) is still read the same way. An unknown kind, a pattern without its regex, digits without min, or a repeated
|
|
199
204
|
* name throws: a reader declared wrong fails where it is declared, never by reading nothing. */
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:2da4505cfef524d9ab9a5b9975111726f6885c8f7ef6fb63130ccd3abc6d6b5d";
|
|
@@ -364,7 +364,7 @@ it.
|
|
|
364
364
|
|
|
365
365
|
**Word readers and the ranker.** An input with `profile.whole_phrases` reads a choice from words only when the whole reply is accounted for: its phrase, another input's argument, courtesy, connecting words and the input's `template_words`. A reply with any other word goes to the ranker, so a word inside a sentence ("Quiero hacer una nueva compra" at a pay menu) never picks an option. Compound answers that carry arguments stay with the reader ("pay $50 with my Visa card"), because a picked option extracts only the arguments it declares. A proposal's confirmation offers the ranker its input's choices, so a correction ("yes, it was stolen") picks the changed candidate.
|
|
366
366
|
|
|
367
|
-
**A number that must name itself.** `input.confirm_out_of_order: {word, word_es, message, message_es}` (default off): out of order a number fills this input only beside its word, in either language ("account 5373850"). Alone it may be something else, a code said with an extra digit, so nothing is filled: the caller hears `message` (`{value}` the number, digit by digit on a call; `{word}` the word) and the current question again, which counts as an attempt at that question. It works at `collect-input` and `confirm-form` questions. At its own question the number needs no word. A pattern field's `asked_regex` also reads out of order beside the word ("vencimiento 0 4 3 1"); a reading of the field asked now wins over a number refused for want of its word, and no line is said. The card presets declare it on the expiration (EXPIRATION / VENCIMIENTO), the security code (SECURITY CODE / CÓDIGO DE SEGURIDAD) and the billing ZIP (owner 2026-11-17). `collect-credit-card` also checks the completed card (`validate-credit-card`): a security code whose length is not its brand's (4 for American Express, 3 for others) is asked again. `authenticate-user`'s `code_confirm` takes the same declaration for a `code_validator`, whose flow reads it with the helpers `saysConfirmWord(answer, spec)` and `confirmOutOfOrderLine(spec, value, language, voice)`.
|
|
367
|
+
**A number that must name itself.** `input.confirm_out_of_order: {word, word_es, message, message_es}` (default off): out of order a number fills this input only beside its word, in either language ("account 5373850"). Alone it may be something else, a code said with an extra digit, so nothing is filled: the caller hears `message` (`{value}` the number, digit by digit on a call; `{word}` the word) and the current question again, which counts as an attempt at that question. It works at `collect-input` and `confirm-form` questions. Out of order a number is read, and named, only as a field it is a valid value of (owner 2026-11-23): the expiration month then year within the card window ("150" is 01/50, "300" is 03/00: neither), every other preset by its own check, a digits field by its length, an amount above zero. A number valid for several fields names each ("1230": the expiration and the security code). An amount that declares it is named too (a bare amount out of order is otherwise refused silently); `say_digits: false` says its `{value}` as a number on a call. At its own question the number needs no word. A pattern field's `asked_regex` also reads out of order beside the word ("vencimiento 0 4 3 1"); a reading of the field asked now wins over a number refused for want of its word, and no line is said. The card presets declare it on the expiration (EXPIRATION / VENCIMIENTO), the security code (SECURITY CODE / CÓDIGO DE SEGURIDAD) and the billing ZIP (owner 2026-11-17). `collect-credit-card` also checks the completed card (`validate-credit-card`): a security code whose length is not its brand's (4 for American Express, 3 for others) is asked again. `authenticate-user`'s `code_confirm` takes the same declaration for a `code_validator`, whose flow reads it with the helpers `saysConfirmWord(answer, spec)` and `confirmOutOfOrderLine(spec, value, language, voice)`.
|
|
368
368
|
|
|
369
369
|
**A conflict the request carried is asked at its input (jsfe 1.74.0, owner 2026-11-17).** When values given at activation
|
|
370
370
|
(nothing asked yet) compete for one exclusive group, such as an amount and a payment option, the conflict is kept on the form
|
|
@@ -224,7 +224,7 @@ Declarations:
|
|
|
224
224
|
| input `invites:[names]`, `form.confirm.invites` | The other inputs this question (or the read-back) also asks for ("NEW CARD, LINK, or a different amount" invites `amount`), in its form or an enclosing one; read as in order while it is asked. |
|
|
225
225
|
| profile `out_of_order:{…}` | A narrower signature for out-of-order reading: the payment card takes a bare last four when asked, but out of order only a card word or "ending in 4242". |
|
|
226
226
|
| `authenticate-user` `other_whole_answer:true` | At the code question "another account" switches only as the whole answer; inside a sentence the reply ranker decides, offered `another_account` and `no_other_account` ("I understand. We still need to secure access to your account.", then the question). Default off. |
|
|
227
|
-
| input `confirm_out_of_order:{word,word_es,message,message_es}` | Out of order a number fills this input only beside its `word`, in either language. Alone, the caller hears `message` (`{value}` is the number, `{word}` the word) and the current question again, which counts as an attempt. `authenticate-user`'s `code_confirm` is the same declaration for a `code_validator`, whose flow reads it with `saysConfirmWord` and `confirmOutOfOrderLine`: an account number at the verification-code question, where it may be a code said with an extra digit. A pattern field's `asked_regex` also reads out of order beside the word; the field asked now wins over a refused number. Card presets: expiration, security code and billing ZIP. |
|
|
227
|
+
| input `confirm_out_of_order:{word,word_es,message,message_es}` | Out of order a number fills this input only beside its `word`, in either language. Alone, the caller hears `message` (`{value}` is the number, `{word}` the word) and the current question again, which counts as an attempt. `authenticate-user`'s `code_confirm` is the same declaration for a `code_validator`, whose flow reads it with `saysConfirmWord` and `confirmOutOfOrderLine`: an account number at the verification-code question, where it may be a code said with an extra digit. A pattern field's `asked_regex` also reads out of order beside the word; the field asked now wins over a refused number. Card presets: expiration, security code and billing ZIP. A number names only a field it is a valid value of, and every such field; an amount that declares it is named too. `say_digits:false` says `{value}` as a number on a call (an amount). |
|
|
228
228
|
| profile `refuse_amount_shape:true` (digits) | Out of order, three digits then two ("119 19") fill nothing: they read as dollars and cents. At its own question they read as the field. The `zip` and `card_zip` presets declare it. |
|
|
229
229
|
| profile `in_sentence:true` (digits) | At its own question a `digits` field takes its number only when the number is the whole answer (courtesy, connecting words and the field's own words aside, or a compound answer other fields read); any other sentence goes to the reply ranker, which extracts the field through the input's `rank_parameters`. `in_sentence` reads the number wherever it is said: the one-time code (the OTP profiles declare it). The `zip`, `card_zip` presets declare `rank_parameters`. |
|
|
230
230
|
| `digits: {min,max}` with `length_message` / `length_message_es` | At its own question (a `digits`, `phone` or `identifier` field; a pattern field reads only what it matches), one number of 3+ digits whose length is outside `digits`, read by no other field: a reading of the field, rejected with "{heard} digits; it has {lengths}", said with the re-ask. The declaration is the opt-in; the length presets declare messages. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.90.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",
|