jsfe 1.65.0 → 1.66.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.
|
@@ -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;;;;;SA4HC;AAMD;;;;;;;;GAQG;AACH;;;;;;;;SAoBC;AAED;;;;yGAIyG;AACzG,oDAyBC;AACD,+GAA+G;AAC/G;wHACwH;AACxH,qEAWC;AAED;;;;SA4CC;AAED;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CC;AAzUD,qCAAsC,eAAe,CAAC"}
|
|
@@ -179,7 +179,18 @@ export function projectForm(session, flows) {
|
|
|
179
179
|
const asked = context.names?.length || context.current;
|
|
180
180
|
if (asked && !askedShown)
|
|
181
181
|
return null;
|
|
182
|
-
|
|
182
|
+
if (!projected.length)
|
|
183
|
+
return null;
|
|
184
|
+
// A card holding one plain box adds nothing to the client's own message box, so the question is asked in chat. One field
|
|
185
|
+
// keeps its card when it has a control (a list, a stepper, a date, a place, ready replies) or is sensitive (masked).
|
|
186
|
+
const leaves = [];
|
|
187
|
+
const gather = list => { for (const field of list)
|
|
188
|
+
field.fields ? gather(field.fields) : leaves.push(field); };
|
|
189
|
+
gather(projected);
|
|
190
|
+
const plain = field => field.kind !== 'choice' && !field.control && !field.sensitive;
|
|
191
|
+
if (leaves.length === 1 && plain(leaves[0]))
|
|
192
|
+
return null;
|
|
193
|
+
return { version: 1, form: root.id, language, fields: projected };
|
|
183
194
|
}
|
|
184
195
|
const STANDARD_LABELS = { yes: { en: 'Yes', es: 'Sí' }, no: { en: 'No', es: 'No' } };
|
|
185
196
|
const MAX_CHOICE_OPTIONS = 12;
|
|
@@ -398,7 +398,7 @@ export function emailReadback(address, voice, es = false) {
|
|
|
398
398
|
said = said.split('').join(' ').replace(/ @ /, es ? ' arroba ' : ' at ').replace(/ \. /g, es ? ' punto ' : ' dot ').replace(/ _ /g, es ? ' guion bajo ' : ' underscore ').replace(/ - /g, es ? ' guion ' : ' dash ');
|
|
399
399
|
return (es ? 'Tengo ' : 'I have ') + said + (es ? '. ¿Es correcto? ' : '. Is that right? ') + (es ? voice ? 'Presione 1 o diga' : 'Escriba' : voice ? 'Press 1 or say' : 'Type') + (es ? ' SÍ, o ' : ' YES, or ') + (es ? voice ? 'presione 2 o diga' : 'escriba' : voice ? 'press 2 or say' : 'type') + (es ? ' NO.' : ' NO.');
|
|
400
400
|
}
|
|
401
|
-
const email = worker('ask-email', 'AskEmail', 'Collect an email through shared FORM matching, retaining field-specific spelling and readback behavior.', { scope: 'isolated', parameters: [param('question', 'English email question'), param('question_es', 'Spanish email question'), param('on_file', 'Known email offered by OK'), param('attempt', 'Retry attempt'), param('why', 'invalid, retry or more'), param('confirm', 'Read back a caller-supplied known address'), param('parent_form', 'Owning task FORM instance'), param('email_state', 'Internal field protocol state', 'object')], variables: vars({ question: '', question_es: '', on_file: '', attempt: '', why: '', confirm: '', parent_form: '', email_state: null, email_question: '', email_question_es: '', email_raw: '', email_found: '', email_spelling: false, email_new: false, email_choice: '', email_readback: '', email_readback_es: '', email_choices: EMAIL_CHOICES, email_profiles_base: [{ name: 'email_address', label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' } }, raw], email_profiles: [], email_confirm_profiles: [{ name: 'decision', label: 'email confirmation', label_es: 'confirmación de correo', profile: { kind: 'choice', choices: [{ key: 'no', phrases: ['2', 'no', 'wrong', 'incorrect', 'incorrecto'] }, { key: 'yes', phrases: ['1', 'yes', 'sí', 'si', 'correct', 'correcto'] }] } }, raw] }), contract: { role: 'collector', summary: 'Email field spelling and readback service', result: { path: 'cargo.email', type: 'string' } }, steps: [
|
|
401
|
+
const email = worker('ask-email', 'AskEmail', 'Collect an email through shared FORM matching, retaining field-specific spelling and readback behavior.', { scope: 'isolated', parameters: [param('question', 'English email question'), param('question_es', 'Spanish email question'), param('on_file', 'Known email offered by OK'), param('attempt', 'Retry attempt'), param('why', 'invalid, retry or more'), param('confirm', 'Read back a caller-supplied known address'), param('parent_form', 'Owning task FORM instance'), param('email_state', 'Internal field protocol state', 'object')], variables: vars({ question: '', question_es: '', on_file: '', attempt: '', why: '', confirm: '', parent_form: '', email_state: null, email_question: '', email_question_es: '', email_raw: '', email_found: '', email_spelling: false, email_new: false, email_choice: '', email_readback: '', email_readback_es: '', email_choices: EMAIL_CHOICES, email_profiles_base: [{ name: 'email_address', label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' } }, { ...raw, form_client: false }], email_profiles: [], email_confirm_profiles: [{ name: 'decision', label: 'email confirmation', label_es: 'confirmación de correo', profile: { kind: 'choice', choices: [{ key: 'no', phrases: ['2', 'no', 'wrong', 'incorrect', 'incorrecto'] }, { key: 'yes', phrases: ['1', 'yes', 'sí', 'si', 'correct', 'correcto'] }] } }, raw] }), contract: { role: 'collector', summary: 'Email field spelling and readback service', result: { path: 'cargo.email', type: 'string' } }, steps: [
|
|
402
402
|
set('email_protocol', 'email_state', "email_state || {question:question,question_es:question_es || question,on_file:on_file,confirm:confirm === true || confirm === 'true',attempt:Number(attempt || 0),why:why,draft:why === 'more'?String(cargo.emailDraft || ''):'',parent_form:parent_form}"),
|
|
403
403
|
set('email_profiles', 'email_profiles', "email_profiles_base.concat(email_state.on_file ? [{name:'known_email_choice',label:'email destination choice',label_es:'opción de destino del correo',profile:{kind:'choice',choices:[{key:'ok',phrases:email_choices.ok},{key:'another',phrases:email_choices.another}]}}] : [])"),
|
|
404
404
|
set('email_question', 'email_question', "email_state.why === 'more' ? 'Got it. Go on.' : (email_state.attempt>0 ? email_state.why === 'retry' ? \"Okay, let's try again. \" : \"That doesn't look like an email address. \" : '')+email_state.question"),
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:b1afd306e1642e130fd912e974947379a120980d23c3665cb9b665c52d4e766d";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.66.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",
|