jsfe 1.51.0 → 1.53.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 +4 -3
- package/dist/forms/address-flows.js +6 -6
- package/dist/forms/flows.d.ts +1 -0
- package/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +61 -21
- package/dist/forms/form-client.d.ts +18 -0
- package/dist/forms/form-client.d.ts.map +1 -1
- package/dist/forms/form-client.js +56 -5
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +5 -3
- package/dist/forms/index.d.ts +1 -1
- package/dist/forms/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/runtime-identity.js +1 -1
- package/docs/architecture-guide.md +3 -3
- package/docs/copilot-reference.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -387,10 +387,11 @@ instructions with its text model.
|
|
|
387
387
|
favor / now / ahora; CANCEL is not one) ends every flow at any question, before any reader, command or the reply ranker
|
|
388
388
|
(`isGlobalExit`), outcome `user_aborted`, reason `exit_requested`, unless the question declares a choice of its own for that
|
|
389
389
|
word (its key or a phrase is `*`, EXIT, QUIT or SALIR): that choice takes the answer. The engine then starts
|
|
390
|
-
the worker `global-exit`
|
|
391
|
-
|
|
390
|
+
the worker `global-exit` with `exit_outcome`, the outcome in force before the flows ended (default since 1.52.0: "The process has
|
|
391
|
+
been cancelled at your request. Is there anything else I can help you with?", or thanks with the same offer when that outcome is
|
|
392
|
+
`resolved`; no contact list), or the tenant flow that `wraps: "global-exit"`. A waiting stack
|
|
392
393
|
that declares its own exit destination (`cancel_flow` other than `contact-support`, e.g. the retry menu's) starts that flow instead,
|
|
393
|
-
as its local exit did. A set with neither a wrapper nor `
|
|
394
|
+
as its local exit did. A set with neither a wrapper nor `global-exit` keeps the generic reply.
|
|
394
395
|
|
|
395
396
|
**Keypad 9 (jsfe 1.42.0, owner 2026-10-31):** on a call, a whole answer of `9` at any question ends every flow and starts
|
|
396
397
|
`switch-to-text`, when the caller's number can take texts (`callerTextNumber`) and the set has that flow. A question that declares a
|
|
@@ -9,16 +9,16 @@ const E = (fn, ...args) => `(${fn.toString()})(${args.join(',')})`;
|
|
|
9
9
|
const P = (name, type = 'string') => ({ name, type, description: name });
|
|
10
10
|
const C = (id, summary, steps, extra = {}) => defineWorker({ id, name: id.split('-').map(w => w[0].toUpperCase() + w.slice(1)).join(''), description: summary, ...extra, contract: { role: 'worker', summary, ...extra.contract }, steps });
|
|
11
11
|
const streetPattern = '\\b\\d{1,6}\\s+(?:[A-Za-z0-9.\\xC0-\\xFF-]+\\s+){1,8}(?:st(?:reet)?|ave(?:nue)?|blvd|boulevard|rd|road|ln|lane|dr(?:ive)?|way|ct|court|pl(?:ace)?|pkwy|parkway|cir(?:cle)?|ter(?:race)?)\\b';
|
|
12
|
-
const address = defineForm({ id: 'collect-geocoded-address', name: 'CollectGeocodedAddress', version: '1.
|
|
12
|
+
const address = defineForm({ id: 'collect-geocoded-address', name: 'CollectGeocodedAddress', version: '1.1.0', description: 'Collect a mailing address in any order, project geocoder evidence, and read the complete address back for confirmation.', contract: { summary: 'Collect and confirm a geocoded mailing address', result: { path: 'form result.resolved', type: 'object' } }, parameters: [P('given')], extraVars: { given: '', zip: '', street: '', unit: '', draft: null, address_result: null, address_spec: null, address_label: 'new address', address_label_es: 'nueva dirección', exit_context: 'your address', exit_context_es: 'su dirección' },
|
|
13
13
|
before: [S('address_given', 'given', "given || (cargo.forms[cargo.forms[form_instance].parent] || {}).context && (cargo.forms[cargo.forms[form_instance].parent].context.given || '') || ''"), S('address_draft', 'draft', E(addressDraft, "given || (cargo.forms[form_instance].seeds && cargo.forms[form_instance].seeds.given) || ''")), S('address_seed_zip', 'zip', "zip || draft.zip"), S('address_seed_street', 'street', "street || draft.street"), S('address_seed_unit', 'unit', "unit || draft.unit"), S('address_data', 'noop', "(cargo.forms[form_instance].data=Object.assign({need_city:false},cargo.forms[form_instance].data || {}), draft.street ? (cargo.addressDraft={said:draft.street}) : null, true)"),
|
|
14
14
|
// The calling form's own label for this input names what is being changed ("new delivery address") in every question and the read-back;
|
|
15
15
|
// without one, today's wording.
|
|
16
16
|
S('address_spec', 'address_spec', "(function(f){var p=f&&f.parent?cargo.forms[f.parent]:null,s=p&&p.specs,n=f&&f.result_input,x=null;if(n&&Array.isArray(s)){for(var i=0;i<s.length;i++){if(s[i]&&s[i].name===n){x=s[i];break;}}}else if(n&&s&&typeof s==='object'){x=s[n]||null;}return x||{};})(cargo.forms[form_instance])"), S('address_label', 'address_label', "typeof address_spec.label==='string'&&address_spec.label.trim()?address_spec.label.trim():'new address'"), S('address_label_es', 'address_label_es', "typeof address_spec.label_es==='string'&&address_spec.label_es.trim()?address_spec.label_es.trim():'nueva dirección'"), S('address_label_data', 'noop', "(function(d,labelled){d.label=address_label;d.label_es=address_label_es;d.labelled=labelled;d.city_state_question=labelled?'What city and state is your '+address_label+' in?':'What city and state is that in?';d.city_state_question_es=labelled?'¿En qué ciudad y estado está su '+address_label_es+'?':'¿En qué ciudad y estado está?';d.unit_question=labelled?'Is there an apartment or unit number in your '+address_label+'? Type the number, or NONE.':'Is there an apartment or unit number? Type the number, or NONE.';d.unit_question_es=labelled?'¿Hay un número de apartamento o unidad en su '+address_label_es+'? Escriba el número, o NINGUNO.':'¿Hay un número de apartamento o unidad? Escriba el número, o NINGUNO.';return true;})(cargo.forms[form_instance].data,typeof address_spec.label==='string'&&!!address_spec.label.trim())")],
|
|
17
|
-
inputs: [{ name: 'zip', field: 'zip', argument_description: '5-digit ZIP code', names: ['zip', 'zip code', 'postal code', 'código postal', 'codigo postal'], validator: 'address-zip-validate', prepare: 'address-zip-prompt', question_from: 'zip_question', question: 'What is the 5-digit zip code of your new address?', question_es: '¿Cuál es el código postal de 5 dígitos de su nueva dirección?' },
|
|
18
|
-
{ name: 'city', argument_description: 'city name alone', label: 'city', label_es: 'ciudad', names: ['city', 'ciudad'], profile: { kind: 'choice', choices: [], accept_other: true, other_needs_letter: true }, choices_from: 'city_choices', when: { 'form.data.city_known': true }, depends_on: ['zip'], reset_on: ['zip'], prepare: 'address-city-prompt', question_from: 'city_question', question: 'Which city is it?', question_es: '¿Qué ciudad es?' },
|
|
17
|
+
inputs: [{ name: 'zip', field: 'zip', argument_description: '5-digit ZIP code', names: ['zip', 'zip code', 'postal code', 'código postal', 'codigo postal'], validator: 'address-zip-validate', prepare: 'address-zip-prompt', question_from: 'zip_question', question: 'What is the 5-digit zip code of your new address?', question_es: '¿Cuál es el código postal de 5 dígitos de su nueva dirección?', form_client: { control: 'postal', regions: ['us'], fills: { city: 'locality' }, autofill: 'postal-code' } },
|
|
18
|
+
{ name: 'city', argument_description: 'city name alone', label: 'city', label_es: 'ciudad', names: ['city', 'ciudad'], profile: { kind: 'choice', choices: [], accept_other: true, other_needs_letter: true }, choices_from: 'city_choices', when: { 'form.data.city_known': true }, depends_on: ['zip'], reset_on: ['zip'], prepare: 'address-city-prompt', question_from: 'city_question', question: 'Which city is it?', question_es: '¿Qué ciudad es?', form_client: { control: 'combobox', autofill: 'address-level2' } },
|
|
19
19
|
{ name: 'city_state', argument_description: 'city and state', label: 'city and state', label_es: 'ciudad y estado', names: ['city', 'ciudad'], profile: { kind: 'text' }, when: { 'form.data.need_city': true }, depends_on: ['zip'], question_from: 'city_state_question', question: 'What city and state is that in?', question_es: '¿En qué ciudad y estado está?' },
|
|
20
|
-
{ name: 'street', argument_description: 'street number and street name, without the apartment', label: 'street address', label_es: 'dirección', names: ['street', 'calle'], profile: { kind: 'pattern', regex: streetPattern, spoken_digits: 'house_number', accept_other: true }, depends_on: ['zip'], validator: 'address-street-validate', prepare: 'address-street-prompt', question_from: 'street_question', question: 'What is the street address?', question_es: '¿Cuál es la dirección?', form_client: { control: 'place', types: 'address', regions: ['us'] } },
|
|
21
|
-
{ name: 'unit', declinable: true, argument_description: 'apartment or unit number alone, such as 4 or 12B', reset_on: ['street'], label: 'apartment or unit', label_es: 'apartamento o unidad', names: ['apartment', 'apt', 'unit', 'apartamento', 'unidad', 'departamento'], profile: { kind: 'pattern', regex: '(?:\\bapartment|\\bapartamento|\\bdepartamento|\\bapt\\.?|\\bunit|\\bunidad|#)\\s*([\\w-]+)', group: 1, spoken_digits: true, accept_other: true }, question_from: 'unit_question', question: 'Is there an apartment or unit number? Type the number, or NONE.', question_es: '¿Hay un número de apartamento o unidad? Escriba el número, o NINGUNO.' }],
|
|
20
|
+
{ name: 'street', argument_description: 'street number and street name, without the apartment', label: 'street address', label_es: 'dirección', names: ['street', 'calle'], profile: { kind: 'pattern', regex: streetPattern, spoken_digits: 'house_number', accept_other: true }, depends_on: ['zip'], validator: 'address-street-validate', prepare: 'address-street-prompt', question_from: 'street_question', question: 'What is the street address?', question_es: '¿Cuál es la dirección?', form_client: { control: 'place', types: 'address', regions: ['us'], fills: { zip: 'postal_code', city: 'locality' }, autofill: 'address-line1' } },
|
|
21
|
+
{ name: 'unit', declinable: true, argument_description: 'apartment or unit number alone, such as 4 or 12B', reset_on: ['street'], label: 'apartment or unit', label_es: 'apartamento o unidad', names: ['apartment', 'apt', 'unit', 'apartamento', 'unidad', 'departamento'], profile: { kind: 'pattern', regex: '(?:\\bapartment|\\bapartamento|\\bdepartamento|\\bapt\\.?|\\bunit|\\bunidad|#)\\s*([\\w-]+)', group: 1, spoken_digits: true, accept_other: true }, question_from: 'unit_question', question: 'Is there an apartment or unit number? Type the number, or NONE.', question_es: '¿Hay un número de apartamento o unidad? Escriba el número, o NINGUNO.', form_client: { autofill: 'address-line2' } }],
|
|
22
22
|
before_confirm: [S('address_resolved', 'address_result', E(resolvedAddress, 'cargo.forms[form_instance].values', 'cargo.forms[form_instance].data'))],
|
|
23
23
|
confirm: { named_fields: true, reply_context: 'This is a mailing address read back for confirmation. A reply may correct one part or several at once: the street number, street name or street type, the apartment or unit, the city, or the ZIP code.', no_keys: ['2', 'not right', 'not correct', 'incorrect', 'wrong', 'no es correcto', 'no es correcta', 'incorrecta'], question: 'Your {{address_label}} is {{address_result.line}}. Is that correct?', question_es: 'Su {{address_label_es}} es {{address_result.line}}. ¿Es correcta?' },
|
|
24
24
|
after: [S('address_result_store', 'noop', '(cargo.forms[form_instance].values.resolved = address_result, cargo.address = address_result, cargo.addressDraft = null, true)')], declined: [S('address_retry_noop', 'noop', 'true')] });
|
|
@@ -38,7 +38,7 @@ const zipPrompt = C('address-zip-prompt', 'Render the ZIP question from the owne
|
|
|
38
38
|
const streetPrompt = C('address-street-prompt', 'Include the ZIP-derived location when asking for the street.', [S('address_street_prompt', 'noop', "(cargo.forms[form].data.street_question=(cargo.forms[form].data.location?'Got it, '+(cargo.forms[form].values.city?cargo.forms[form].values.city+', '+cargo.forms[form].data.location.state:cargo.forms[form].data.location.line)+'. ':'')+(cargo.forms[form].data.labelled?'What is the street of your '+cargo.forms[form].data.label+'?':'What is the street address?'),cargo.forms[form].data.street_question_es=(cargo.forms[form].data.location?'Entendido, '+(cargo.forms[form].values.city?cargo.forms[form].values.city+', '+cargo.forms[form].data.location.state:cargo.forms[form].data.location.line)+'. ':'')+(cargo.forms[form].data.labelled?'¿Cuál es la calle de su '+cargo.forms[form].data.label_es+'?':'¿Cuál es la dirección?'),true)")], { parameters: [P('form')], contract: { result: { path: 'cargo.forms[form].data', type: 'object' } } });
|
|
39
39
|
const cityPrompt = C('address-city-prompt', 'Ask which of the ZIP code\'s place names the address carries.', [S('address_city_prompt', 'noop', "(function(data,voice){var names=(data.location&&data.location.cities)||[],n=names.length,list=function(and){return names.slice(0,-1).join(', ')+' '+and+' '+names[n-1];};if(n<2){data.city_question=data.labelled?'What city is your '+data.label+' in?':'What city is it?';data.city_question_es=data.labelled?'¿En qué ciudad está su '+data.label_es+'?':'¿Qué ciudad es?';return true;}data.city_question=(data.labelled?'Which city is your '+data.label+' in: ':'Which city is it: ')+list('or')+'? '+(voice?names.map(function(c,i){return (i?'':'Press ')+(i+1)+' for '+c;}).join(', ')+'.':'Type the city or its number, 1 to '+n+'.');data.city_question_es=(data.labelled?'¿En qué ciudad está su '+data.label_es+': ':'¿Qué ciudad es: ')+list('o')+'? '+(voice?names.map(function(c,i){return (i?'':'Presione ')+(i+1)+' para '+c;}).join(', ')+'.':'Escriba la ciudad o su número, del 1 al '+n+'.');return true;})(cargo.forms[form].data,cargo.voice===true)")], { parameters: [P('form')], contract: { result: { path: 'cargo.forms[form].data', type: 'object' } } });
|
|
40
40
|
// NO at the read-back asks which part is wrong and re-asks only that part; ALL starts over.
|
|
41
|
-
const PARTS = [{ key: 'zip', phrases: ['1', 'zip', 'zip code', 'postal code', 'código postal', 'codigo postal'] }, { key: 'city', phrases: ['2', 'city', 'ciudad'] }, { key: 'street', phrases: ['3', 'street', 'calle'] }, { key: 'unit', phrases: ['4', 'apartment', 'apt', 'unit', 'apartamento', 'unidad', 'departamento'] }, { key: 'all', phrases: ['5', 'all', 'everything', 'all of it', 'todo', 'toda'] }];
|
|
41
|
+
const PARTS = [{ key: 'zip', label: 'ZIP code', label_es: 'Código postal', phrases: ['1', 'zip', 'zip code', 'postal code', 'código postal', 'codigo postal'] }, { key: 'city', label: 'City', label_es: 'Ciudad', phrases: ['2', 'city', 'ciudad'] }, { key: 'street', label: 'Street', label_es: 'Calle', phrases: ['3', 'street', 'calle'] }, { key: 'unit', label: 'Apartment', label_es: 'Apartamento', phrases: ['4', 'apartment', 'apt', 'unit', 'apartamento', 'unidad', 'departamento'] }, { key: 'all', label: 'Everything', label_es: 'Todo', phrases: ['5', 'all', 'everything', 'all of it', 'todo', 'toda'] }];
|
|
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
|
F('address_retry_part_ask', 'ask-choice', { question: '{{part_question}}', question_es: '{{part_question_es}}', choices: '{{parts}}' }),
|
package/dist/forms/flows.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA4GA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA4GA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAiGD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEC;AACD;;;GAGG;AACH;;;;;;EAGC;AAmlBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AAp4BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8H9G,4CAEqI;AA29BrI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
|
package/dist/forms/flows.js
CHANGED
|
@@ -145,17 +145,33 @@ function validateAcceptanceDeclarations(id, inputs) {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
* input.form_client: false (never on a form card) or
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
* start of a range, a date input of this form that is not itself an end.
|
|
152
|
-
*
|
|
153
|
-
*
|
|
148
|
+
* input.form_client: false (never on a form card) or how a form card draws it (docs/form-client.md). Every key is optional
|
|
149
|
+
* except a control's own requirements:
|
|
150
|
+
* - control 'date' {range_from?, min?, max?, timezone?}: a date's min and max are whole days from today in `timezone`
|
|
151
|
+
* (required with either); range_from names the start of a range, a date input of this form that is not itself an end.
|
|
152
|
+
* - control 'number' {min?, max?}: bounds on the value.
|
|
153
|
+
* - control 'place' {types, regions?, fills?}: suggests what the caller types from the host's place service: types
|
|
154
|
+
* 'cities' or 'address', regions up to 15 ISO 3166-1 alpha-2 country codes; fills {input: part} names inputs of this
|
|
155
|
+
* form a pick fills with a part of the picked place (postal_code, locality, admin_area, country).
|
|
156
|
+
* - control 'postal' {regions?, fills}: a postal code the host looks up as it is completed; the card shows the place it
|
|
157
|
+
* names, and fills {input: part} fills inputs of this form with its locality (and, for a combobox, the code's other
|
|
158
|
+
* localities as its options) or admin_area.
|
|
159
|
+
* - control 'combobox': a choice that also takes other text (accept_other), drawn as a text box offering its choices.
|
|
160
|
+
* - autofill: the HTML autocomplete token the browser may fill the box from (a saved address, name, email or phone).
|
|
161
|
+
* Checked at definition time; malformed fails.
|
|
154
162
|
*/
|
|
155
|
-
const FORM_CLIENT_KEYS = { date: ['control', 'range_from', 'min', 'max', 'timezone'], number: ['control', 'min', 'max'
|
|
163
|
+
const FORM_CLIENT_KEYS = { date: ['control', 'range_from', 'min', 'max', 'timezone', 'autofill'], number: ['control', 'min', 'max', 'autofill'],
|
|
164
|
+
place: ['control', 'types', 'regions', 'fills', 'autofill'], postal: ['control', 'regions', 'fills', 'autofill'], combobox: ['control', 'autofill'], none: ['autofill'] };
|
|
156
165
|
const FORM_CLIENT_KINDS = ['pattern', 'text', 'digits', 'amount', 'identifier'];
|
|
157
|
-
const
|
|
166
|
+
const FORM_CONTROL_KINDS = { place: ['pattern', 'text'], postal: ['digits', 'pattern', 'text', 'identifier'], combobox: ['choice'],
|
|
167
|
+
none: ['pattern', 'text', 'digits', 'amount', 'identifier', 'email', 'phone', 'choice'] };
|
|
158
168
|
const FORM_PLACE_TYPES = ['cities', 'address'];
|
|
169
|
+
const FORM_FILL_PARTS = { place: ['postal_code', 'locality', 'admin_area', 'country'], postal: ['locality', 'admin_area'] };
|
|
170
|
+
// Positive whitelist: what a browser may fill from its own saved data. No payment card or one-time-code token: those are
|
|
171
|
+
// sensitive, and a sensitive input never takes a form_client control.
|
|
172
|
+
export const FORM_AUTOFILL_TOKENS = ['name', 'given-name', 'additional-name', 'family-name', 'honorific-prefix', 'honorific-suffix', 'nickname',
|
|
173
|
+
'organization', 'organization-title', 'email', 'tel', 'tel-national', 'street-address', 'address-line1', 'address-line2', 'address-line3',
|
|
174
|
+
'address-level1', 'address-level2', 'address-level3', 'postal-code', 'country', 'country-name', 'bday', 'sex', 'language', 'url'];
|
|
159
175
|
function validateFormClientControls(id, inputs) {
|
|
160
176
|
const all = (inputs || []).flatMap((input) => input.any_of || [input]);
|
|
161
177
|
const fail = (input, message) => { throw new Error(`FORM ${id}: ${input.name} form_client ${message}`); };
|
|
@@ -164,24 +180,30 @@ function validateFormClientControls(id, inputs) {
|
|
|
164
180
|
if (declared === undefined || declared === false)
|
|
165
181
|
continue;
|
|
166
182
|
else if (!declared || typeof declared !== 'object' || Array.isArray(declared))
|
|
167
|
-
fail(input, 'must be false or {control
|
|
168
|
-
else if (!Object.hasOwn(FORM_CLIENT_KEYS, declared.control))
|
|
169
|
-
fail(input, 'control must be "date", "number" or "
|
|
170
|
-
else { /* a control object, checked below */ }
|
|
171
|
-
const
|
|
183
|
+
fail(input, 'must be false or {control?, autofill?, ...}');
|
|
184
|
+
else if (declared.control !== undefined && (declared.control === 'none' || !Object.hasOwn(FORM_CLIENT_KEYS, declared.control)))
|
|
185
|
+
fail(input, 'control must be "date", "number", "place", "postal" or "combobox"');
|
|
186
|
+
else { /* a control object, or autofill alone; checked below */ }
|
|
187
|
+
const control = declared.control ?? 'none';
|
|
188
|
+
const extra = Object.keys(declared).filter((key) => !FORM_CLIENT_KEYS[control].includes(key));
|
|
172
189
|
if (extra.length)
|
|
173
|
-
fail(input, `${
|
|
174
|
-
const kinds =
|
|
175
|
-
|
|
176
|
-
|
|
190
|
+
fail(input, control === 'none' ? `without a control declares only autofill, not ${extra.join(', ')}` : `${control} cannot declare ${extra.join(', ')}`);
|
|
191
|
+
const kinds = FORM_CONTROL_KINDS[control] || FORM_CLIENT_KINDS;
|
|
192
|
+
const kind = (input.profile || FIELD_PRESETS[input.field]?.profile)?.kind;
|
|
193
|
+
if (!kinds.includes(kind))
|
|
194
|
+
fail(input, `${control === 'none' ? 'autofill' : control + ' control'} needs a profile of kind ${kinds.join(', ')}`);
|
|
177
195
|
if (input.pii === true)
|
|
178
196
|
fail(input, 'control cannot draw a sensitive input');
|
|
197
|
+
if (declared.autofill !== undefined && !FORM_AUTOFILL_TOKENS.includes(declared.autofill))
|
|
198
|
+
fail(input, `autofill ${JSON.stringify(declared.autofill)} is not one of ${FORM_AUTOFILL_TOKENS.join(', ')}`);
|
|
199
|
+
if (control === 'combobox' && (input.profile || {}).accept_other !== true)
|
|
200
|
+
fail(input, 'combobox needs a choice that accepts other text (accept_other)');
|
|
179
201
|
for (const key of ['min', 'max'])
|
|
180
202
|
if (declared[key] !== undefined && !Number.isInteger(declared[key]))
|
|
181
203
|
fail(input, `${key} must be a whole number`);
|
|
182
204
|
if (Number.isInteger(declared.min) && Number.isInteger(declared.max) && declared.min > declared.max)
|
|
183
205
|
fail(input, 'min is above max');
|
|
184
|
-
if (
|
|
206
|
+
if (control === 'date') {
|
|
185
207
|
if ((declared.min !== undefined || declared.max !== undefined) && declared.timezone === undefined)
|
|
186
208
|
fail(input, 'min and max are days from today: declare the timezone they count in');
|
|
187
209
|
if (declared.timezone !== undefined) {
|
|
@@ -203,15 +225,33 @@ function validateFormClientControls(id, inputs) {
|
|
|
203
225
|
}
|
|
204
226
|
else { /* a single date or a range start */ }
|
|
205
227
|
}
|
|
206
|
-
else if (
|
|
207
|
-
if (!FORM_PLACE_TYPES.includes(declared.types))
|
|
228
|
+
else if (control === 'place' || control === 'postal') {
|
|
229
|
+
if (control === 'place' && !FORM_PLACE_TYPES.includes(declared.types))
|
|
208
230
|
fail(input, `types must be ${FORM_PLACE_TYPES.map((type) => `"${type}"`).join(' or ')}`);
|
|
209
231
|
if (declared.regions !== undefined && (!Array.isArray(declared.regions) || !declared.regions.length || declared.regions.length > 15 ||
|
|
210
232
|
!declared.regions.every((region) => typeof region === 'string' && /^[a-z]{2}$/i.test(region))))
|
|
211
233
|
fail(input, 'regions must be 1 to 15 two-letter country codes');
|
|
212
234
|
else { /* any region, or a valid list */ }
|
|
235
|
+
const fills = declared.fills;
|
|
236
|
+
if (fills === undefined && control === 'postal')
|
|
237
|
+
fail(input, 'postal needs fills: the inputs its place fills');
|
|
238
|
+
else if (fills !== undefined) {
|
|
239
|
+
if (!fills || typeof fills !== 'object' || Array.isArray(fills) || !Object.keys(fills).length || Object.keys(fills).length > 8)
|
|
240
|
+
fail(input, 'fills must map 1 to 8 inputs to a part');
|
|
241
|
+
for (const [name, part] of Object.entries(fills)) {
|
|
242
|
+
const target = all.find((other) => other.name === name);
|
|
243
|
+
if (!target || target === input)
|
|
244
|
+
fail(input, `fills ${name} must name another input of this form`);
|
|
245
|
+
else if (target.pii === true || target.form_client === false)
|
|
246
|
+
fail(input, `fills ${name} must be an input a card can draw`);
|
|
247
|
+
else if (!FORM_FILL_PARTS[control].includes(part))
|
|
248
|
+
fail(input, `fills ${name}: part must be ${FORM_FILL_PARTS[control].join(', ')}`);
|
|
249
|
+
else { /* a valid fill */ }
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else { /* a place that fills nothing else */ }
|
|
213
253
|
}
|
|
214
|
-
else { /* a number */ }
|
|
254
|
+
else { /* a number, a combobox or autofill alone */ }
|
|
215
255
|
}
|
|
216
256
|
}
|
|
217
257
|
/** How firm a form's confirmation is: firm ONLY when an action it authorizes is a payment (effect 'charge'); every other
|
|
@@ -5,6 +5,24 @@ export function projectForm(session: any, flows: any): {
|
|
|
5
5
|
language: any;
|
|
6
6
|
fields: any;
|
|
7
7
|
} | null;
|
|
8
|
+
/**
|
|
9
|
+
* The options of the question asked now, when it has a closed, labelled set, for a client that draws them as buttons or a list:
|
|
10
|
+
* {version: 1, language, options: [{key, label, say}]}, else null. Only a question asked by ask-choice qualifies (a
|
|
11
|
+
* confirmation, a menu, a choice asked in chat), and only when every option it offers has a label in the session's
|
|
12
|
+
* language (yes and no have standard ones). An option keyed 'event:' is an interrupt word, never offered. A tap sends `say`
|
|
13
|
+
* as the caller's own message: the label when the option reads it, else the option's first word or key that is not a
|
|
14
|
+
* number, else its first key; so the answer is read by the question's own reader. A host offers this only when no form
|
|
15
|
+
* card is drawn (projectForm is null).
|
|
16
|
+
*/
|
|
17
|
+
export function projectChoices(session: any): {
|
|
18
|
+
version: number;
|
|
19
|
+
language: string;
|
|
20
|
+
options: {
|
|
21
|
+
key: string;
|
|
22
|
+
label: string;
|
|
23
|
+
say: string;
|
|
24
|
+
}[];
|
|
25
|
+
} | null;
|
|
8
26
|
/** Host preflight: call before updateActivity. Unknown paths and malformed envelopes never enter execution. */
|
|
9
27
|
/** The place a view's field suggests, or null: the host's suggestion endpoint answers only for a place field of the
|
|
10
28
|
* form that is open now (`form` is the view's instance, `path` the field's), so it is never a general place service. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-client.d.ts","sourceRoot":"","sources":["../../src/forms/form-client.js"],"names":[],"mappings":"AAiCA,iGAAiG;AACjG;;;;;
|
|
1
|
+
{"version":3,"file":"form-client.d.ts","sourceRoot":"","sources":["../../src/forms/form-client.js"],"names":[],"mappings":"AAiCA,iGAAiG;AACjG;;;;;SAwGC;AAMD;;;;;;;;GAQG;AACH;;;;;;;;SAoBC;AAED,+GAA+G;AAC/G;wHACwH;AACxH,qEAWC;AAED;;;;SA4CC;AAED;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BC;AA1QD,qCAAsC,eAAe,CAAC"}
|
|
@@ -105,7 +105,9 @@ export function projectForm(session, flows) {
|
|
|
105
105
|
choices.some(choice => choice.current_only && String(choice.key) === acceptedKey))
|
|
106
106
|
continue;
|
|
107
107
|
field.choices = [...allowedChoices.values()];
|
|
108
|
-
|
|
108
|
+
// A choice that also takes other text is drawn only as a combobox (a text box offering its choices, which may
|
|
109
|
+
// be none yet); a select could not hold the other text.
|
|
110
|
+
if (profile.accept_other ? input.form_client?.control !== 'combobox' : !field.choices.length)
|
|
109
111
|
continue;
|
|
110
112
|
}
|
|
111
113
|
field.constraints = Object.fromEntries(['min', 'max'].filter(key => typeof profile[key] === 'number').map(key => [key, profile[key]]));
|
|
@@ -119,12 +121,21 @@ export function projectForm(session, flows) {
|
|
|
119
121
|
if (control === 'date' && input.form_client.range_from)
|
|
120
122
|
field.range_from = prefix + input.form_client.range_from;
|
|
121
123
|
}
|
|
122
|
-
else if (control === 'place') {
|
|
123
|
-
// Suggestions come from the host's place service; the profile's bounds still apply to the typed text.
|
|
124
|
+
else if (control === 'place' || control === 'postal') {
|
|
125
|
+
// Suggestions and lookups come from the host's place service; the profile's bounds still apply to the typed text.
|
|
126
|
+
// fills names the card's fields (by path) that a pick or a looked-up code fills, with the part each takes.
|
|
127
|
+
const { types, regions, fills } = input.form_client;
|
|
128
|
+
field.control = control;
|
|
129
|
+
field[control] = { ...(types ? { types } : {}), ...(regions ? { regions: regions.map(region => region.toLowerCase()) } : {}),
|
|
130
|
+
...(fills ? { fills: Object.fromEntries(Object.entries(fills).map(([name, part]) => [prefix + name, part])) } : {}) };
|
|
131
|
+
}
|
|
132
|
+
else if (control === 'combobox') {
|
|
124
133
|
field.control = control;
|
|
125
|
-
field.place = { types: input.form_client.types, ...(input.form_client.regions ? { regions: input.form_client.regions.map(region => region.toLowerCase()) } : {}) };
|
|
126
134
|
}
|
|
127
135
|
else { /* the profile's own box */ }
|
|
136
|
+
// The browser may fill the box from its saved data (an address, a name).
|
|
137
|
+
if (input.form_client?.autofill && !field.sensitive)
|
|
138
|
+
field.autofill = input.form_client.autofill;
|
|
128
139
|
// A declinable field may be left blank: the submission names it in `declined` (answered, no value).
|
|
129
140
|
if (input.declinable === true) {
|
|
130
141
|
field.declinable = true;
|
|
@@ -156,6 +167,44 @@ export function projectForm(session, flows) {
|
|
|
156
167
|
return null;
|
|
157
168
|
return projected.length ? { version: 1, form: root.id, language, fields: projected } : null;
|
|
158
169
|
}
|
|
170
|
+
const STANDARD_LABELS = { yes: { en: 'Yes', es: 'Sí' }, no: { en: 'No', es: 'No' } };
|
|
171
|
+
const MAX_CHOICE_OPTIONS = 12;
|
|
172
|
+
const said = text => String(text ?? '').trim().toLowerCase().replace(/\s+/g, ' ');
|
|
173
|
+
/**
|
|
174
|
+
* The options of the question asked now, when it has a closed, labelled set, for a client that draws them as buttons or a list:
|
|
175
|
+
* {version: 1, language, options: [{key, label, say}]}, else null. Only a question asked by ask-choice qualifies (a
|
|
176
|
+
* confirmation, a menu, a choice asked in chat), and only when every option it offers has a label in the session's
|
|
177
|
+
* language (yes and no have standard ones). An option keyed 'event:' is an interrupt word, never offered. A tap sends `say`
|
|
178
|
+
* as the caller's own message: the label when the option reads it, else the option's first word or key that is not a
|
|
179
|
+
* number, else its first key; so the answer is read by the question's own reader. A host offers this only when no form
|
|
180
|
+
* card is drawn (projectForm is null).
|
|
181
|
+
*/
|
|
182
|
+
export function projectChoices(session) {
|
|
183
|
+
if (!session || session.continuationSafetyHold)
|
|
184
|
+
return null;
|
|
185
|
+
const frame = (session.flowStacks || []).flat().at(-1);
|
|
186
|
+
if (!frame?.pendingVariable || frame.flowId !== 'ask-choice')
|
|
187
|
+
return null;
|
|
188
|
+
const language = session.language === 'es' ? 'es' : 'en';
|
|
189
|
+
const choices = Array.isArray(frame.variables?.choices) ? frame.variables.choices.filter(choice => !String(choice?.key ?? '').startsWith('event:')) : [];
|
|
190
|
+
if (choices.length < 2 || choices.length > MAX_CHOICE_OPTIONS)
|
|
191
|
+
return null;
|
|
192
|
+
const options = [], seen = new Set();
|
|
193
|
+
for (const choice of choices) {
|
|
194
|
+
const key = String(choice.key ?? '');
|
|
195
|
+
const label = String((language === 'es' ? choice.label_es || choice.label : choice.label) || STANDARD_LABELS[key]?.[language] || '').trim();
|
|
196
|
+
if (!key || !label || seen.has(key))
|
|
197
|
+
return null;
|
|
198
|
+
seen.add(key);
|
|
199
|
+
const words = [].concat(choice.phrases ?? choice.words ?? []).map(String);
|
|
200
|
+
const reads = words.some(word => said(word) === said(label)) || (STANDARD_LABELS[key] && label === STANDARD_LABELS[key][language]);
|
|
201
|
+
const say = reads ? label : words.find(word => !/^\d+$/.test(word.trim())) || words[0] || '';
|
|
202
|
+
if (!say)
|
|
203
|
+
return null;
|
|
204
|
+
options.push({ key, label, say });
|
|
205
|
+
}
|
|
206
|
+
return { version: 1, language, options };
|
|
207
|
+
}
|
|
159
208
|
/** Host preflight: call before updateActivity. Unknown paths and malformed envelopes never enter execution. */
|
|
160
209
|
/** The place a view's field suggests, or null: the host's suggestion endpoint answers only for a place field of the
|
|
161
210
|
* form that is open now (`form` is the view's instance, `path` the field's), so it is never a general place service. */
|
|
@@ -262,7 +311,9 @@ export function formSubmissionReaders(submission, getSession) {
|
|
|
262
311
|
const profile = candidates.find(candidate => candidate.form === hit.form && candidate.name === hit.name)?.profile || hit.profile;
|
|
263
312
|
const raw = hit.raw;
|
|
264
313
|
const read = profile.kind === 'choice'
|
|
265
|
-
? (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 }
|
|
314
|
+
? (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 }
|
|
315
|
+
// A combobox's own text: a choice that takes other text keeps it (with a letter when the profile asks for one).
|
|
316
|
+
: profile.accept_other === true && raw.trim() && (!profile.other_needs_letter || /\p{L}/u.test(raw)) ? { value: raw.trim() } : null
|
|
266
317
|
: readInputProfile({ ...profile, marked: false }, raw, true);
|
|
267
318
|
const valid = read && Object.hasOwn(read, 'value') && read.value !== '' && read.refused !== true && !read.incompleteMoney;
|
|
268
319
|
return { ...hit, value: valid ? read.value : raw, invalid: !valid, origin: 'form_submission', current: false, utterance: '' };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AA8CA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AASD,4EAKC;AAiGD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAyJD,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAWD,oGAOC;AApQD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AA8CA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AASD,4EAKC;AAiGD,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"}
|
|
@@ -468,9 +468,11 @@ const failed = worker('verification-failed', 'VerificationFailed', 'End a verifi
|
|
|
468
468
|
end('vf_end')]
|
|
469
469
|
});
|
|
470
470
|
// The global exit (owner 2026-11-11): the engine starts this flow when the whole answer is *, EXIT, QUIT or SALIR (and the
|
|
471
|
-
// question declares no choice of its own for it), after every flow has ended. Default
|
|
471
|
+
// question declares no choice of its own for it), after every flow has ended. Default (1.52.0, owner 2026-11-11): the process cancelled at the
|
|
472
|
+
// caller's request, or thanks when the outcome in force is resolved, each ending with an offer of more help; no contact list (the caller chose
|
|
473
|
+
// to leave, they are not stuck). A tenant
|
|
472
474
|
// gives the global exit its own path with a flow that `wraps` this one; the engine then starts that wrapper.
|
|
473
|
-
const globalExit = worker('global-exit', 'GlobalExit', 'Worker (started by the engine): the caller exited;
|
|
474
|
-
|
|
475
|
+
const globalExit = worker('global-exit', 'GlobalExit', 'Worker (started by the engine): the caller exited; say the process was cancelled at their request (thanks when the outcome in force is resolved) and offer more help.', { scope: 'isolated', version: '1.1.0', parameters: [param('exit_outcome', 'The declared outcome in force when the caller exited (resolved: thanks)'), param('support_context', 'What the caller needed help with (the question\'s exit_context), English; not spoken since 1.52.0'), param('support_context_es', 'The same in Spanish')], steps: [
|
|
476
|
+
{ id: 'global_exit_say', type: 'SAY', value: "{{exit_outcome === 'resolved' ? 'Thank you for contacting us! Is there anything else I can help you with?' : 'The process has been cancelled at your request. Is there anything else I can help you with?'}}", value_es: "{{exit_outcome === 'resolved' ? '¡Gracias por comunicarse con nosotros! ¿Hay algo más en lo que pueda ayudarle?' : 'El proceso fue cancelado a petición suya. ¿Hay algo más en lo que pueda ayudarle?'}}", outcome: "{{exit_outcome === 'resolved' ? 'resolved' : 'user_aborted'}}", reason: "{{exit_outcome === 'resolved' ? 'left_after_resolved' : 'exit_requested'}}" }
|
|
475
477
|
] });
|
|
476
478
|
export const FLOWS = [taskGate, resume, service, rawTransport, contact, misread, declined, splitFailed, rejected, auth, code, validateCode, emailToo, retry, email, failed, globalExit];
|
package/dist/forms/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export { addressDraft, zipLocation, streetLocation, resolvedAddress } from "../h
|
|
|
11
11
|
export { Form, Provider, Performer, Worker, compileExpression } from "./authoring.js";
|
|
12
12
|
export { compileFlowDeclarations, serializeFlowDeclaration, captureOriginalDeclaration } from "./declarations.js";
|
|
13
13
|
export { findFlowTraps, formatFlowTrap } from "./flow-traps.js";
|
|
14
|
-
export { projectForm, parseFormSubmission, formSubmissionReaders, formPlaceField, FORM_SUBMISSION_PREFIX } from "./form-client.js";
|
|
14
|
+
export { projectForm, projectChoices, parseFormSubmission, formSubmissionReaders, formPlaceField, FORM_SUBMISSION_PREFIX } from "./form-client.js";
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/forms/index.js
CHANGED
|
@@ -16,4 +16,4 @@ export { compileFlowDeclarations, serializeFlowDeclaration, captureOriginalDecla
|
|
|
16
16
|
export { continuationBreaks } from './continuation-compat.js';
|
|
17
17
|
export { inheritFlowDeclaration } from './declaration-capture.js';
|
|
18
18
|
export { findFlowTraps, formatFlowTrap } from './flow-traps.js';
|
|
19
|
-
export { projectForm, parseFormSubmission, formSubmissionReaders, formPlaceField, FORM_SUBMISSION_PREFIX } from './form-client.js';
|
|
19
|
+
export { projectForm, projectChoices, parseFormSubmission, formSubmissionReaders, formPlaceField, FORM_SUBMISSION_PREFIX } from './form-client.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -604,7 +604,7 @@ export declare function detectFlowWithParameters(input: string, engine: Engine):
|
|
|
604
604
|
/**
|
|
605
605
|
* The global exit (owner 2026-11-11). The flow that answers a caller who exits, after every flow has ended: the
|
|
606
606
|
* system set's `global-exit`, or the tenant flow that `wraps` it. It receives the outcome in force before the flows ended, so
|
|
607
|
-
* a caller who leaves after being served is thanked. Null when the set has neither a wrapper nor `
|
|
607
|
+
* a caller who leaves after being served is thanked. Null when the set has neither a wrapper nor `global-exit`: the generic reply answers.
|
|
608
608
|
*/
|
|
609
609
|
export declare const GLOBAL_EXIT_FLOW = "global-exit";
|
|
610
610
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4230,7 +4230,7 @@ async function handleDispatchStep(currentFlowFrame, engine) {
|
|
|
4230
4230
|
/**
|
|
4231
4231
|
* The global exit (owner 2026-11-11). The flow that answers a caller who exits, after every flow has ended: the
|
|
4232
4232
|
* system set's `global-exit`, or the tenant flow that `wraps` it. It receives the outcome in force before the flows ended, so
|
|
4233
|
-
* a caller who leaves after being served is thanked. Null when the set has neither a wrapper nor `
|
|
4233
|
+
* a caller who leaves after being served is thanked. Null when the set has neither a wrapper nor `global-exit`: the generic reply answers.
|
|
4234
4234
|
*/
|
|
4235
4235
|
export const GLOBAL_EXIT_FLOW = 'global-exit';
|
|
4236
4236
|
function globalExitStart(engine) {
|
|
@@ -4249,8 +4249,8 @@ function globalExitStart(engine) {
|
|
|
4249
4249
|
}
|
|
4250
4250
|
const base = menu.find(f => f.id === GLOBAL_EXIT_FLOW);
|
|
4251
4251
|
const wrapper = base ? menu.find(f => f.wraps === base.id || f.wraps === base.name) : undefined;
|
|
4252
|
-
// The default
|
|
4253
|
-
const flow = wrapper ||
|
|
4252
|
+
// The default answers on its own (1.52.0); a set without `global-exit` keeps the generic reply.
|
|
4253
|
+
const flow = wrapper || base;
|
|
4254
4254
|
const context = declared('exit_context'), contextEs = declared('exit_context_es');
|
|
4255
4255
|
return flow ? { flow: flow.id, arguments: { exit_outcome: outcomeInForce(engine)?.outcome || '', ...(context ? { support_context: context, support_context_es: contextEs || context } : {}) } } : null;
|
|
4256
4256
|
}
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:00e658a3501432cfcba47657486370b3517cb6c1698fbb438b3de360be600b97";
|
|
@@ -254,10 +254,10 @@ flowchart TD
|
|
|
254
254
|
Before any reader, a waiting question checks two whole answers that work everywhere (jsfe 1.42.0):
|
|
255
255
|
|
|
256
256
|
- **The global exit.** `*`, EXIT, QUIT or SALIR (repeated, or with please / por favor / now / ahora; CANCEL is not one) ends
|
|
257
|
-
every flow, outcome `user_aborted`, reason `exit_requested`. The engine then starts `global-exit`: by default
|
|
258
|
-
|
|
257
|
+
every flow, outcome `user_aborted`, reason `exit_requested`. The engine then starts `global-exit`: by default (1.52.0) it says the
|
|
258
|
+
process was cancelled at the caller's request, or thanks a caller whose request was already resolved, and offers more help. A tenant
|
|
259
259
|
gives the exit its own path with a flow that `wraps: "global-exit"`; a flow that declares its own exit destination (`cancel_flow`)
|
|
260
|
-
keeps it. A set with neither a wrapper nor `
|
|
260
|
+
keeps it. A set with neither a wrapper nor `global-exit` keeps the generic cancel reply.
|
|
261
261
|
- **Keypad 9 switches a call to text,** when the caller's number can take texts and the set has `switch-to-text`. Keypad 8
|
|
262
262
|
(language) and 0 (a person) are the host's, before the engine.
|
|
263
263
|
- **A declared choice wins.** A question that offers its own choice for the word (its key or a phrase is `*`, EXIT, QUIT,
|
|
@@ -271,7 +271,7 @@ An unreadable answer with any words goes to the reply ranker, offered the questi
|
|
|
271
271
|
|
|
272
272
|
`user_description` / `user_description_es` on a form (jsfe 1.42.0): one sentence saying what the process does, written with the engine's own `{{...}}` expressions, every input of the form in scope ('' until answered) and its data ("This process allows you to change the delivery address or delivery date for your order.{{change === 'address' ? ' You chose to change the delivery address.' : change === 'date' ? ' You chose to change the delivery date.' : ''}}"). The nearest form in the chain declaring one is used. The form's readers then offer the reply ranker `concern`; a caller who expresses doubt that the process is what they need hears the sentence, "To cancel, press the asterisk key or say EXIT." (text: "To cancel, type EXIT."; Spanish SALIR) and the question again, with no attempt counted. Declare it where a caller may mistake what the flow is doing; it applies to every question of the form and its sub-forms, so word it for all of them.
|
|
273
273
|
|
|
274
|
-
**Global keys (jsfe 1.42.0).** A whole answer `*`, EXIT, QUIT or SALIR ends every flow at any question and starts `global-exit` (default:
|
|
274
|
+
**Global keys (jsfe 1.42.0).** A whole answer `*`, EXIT, QUIT or SALIR ends every flow at any question and starts `global-exit` (default: "cancelled at your request" and an offer of more help, thanks when resolved; a tenant overrides it with a flow that `wraps: "global-exit"`). On a call a whole answer `9` starts `switch-to-text` when the caller can be texted. Never write a local handler for these; to give a question its own meaning for one, declare it as a choice (key or phrase): a declared choice takes the answer. CANCEL is not an exit word.
|
|
275
275
|
|
|
276
276
|
`must_complete:true` on a form (inherited by every field of it and of the forms nested in it) or on one field (`false` on a field opts out): an unreadable answer is never yielded to DISPATCH, however long, and neither is a confirmation miss or an unresolved ambiguity — the question is asked again, acknowledged. A worded reply always reaches the reply ranker, offered every choice the chain's reader accepts: a pick is taken, a clear withdrawal ends the flows, and any other verdict (a new request included) stays and says `first_task` / `first_task_es` from the nearest form declaring it, "I understand, first let's record your new card." / "Entiendo, primero vamos a registrar su tarjeta nueva.", then the field's `retry` or its question. It uses no attempt. Use it where leaving would strand an effect in progress (a payment's card, its billing-ZIP correction). Other exits stay explicit: the form's stop words, `max_attempts` with `on_exhausted`, and whatever the host intercepts before the engine. The form runaway guard counts passes without a caller answer only.
|
|
277
277
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.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",
|