jsfe 1.39.0 → 1.40.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":"AA2BA,iGAAiG;AACjG;;;;;SAiEC;AAED,+GAA+G;AAC/G;;;;SAgCC;AAED;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BC;AA5JD,qCAAsC,eAAe,CAAC"}
1
+ {"version":3,"file":"form-client.d.ts","sourceRoot":"","sources":["../../src/forms/form-client.js"],"names":[],"mappings":"AA2BA,iGAAiG;AACjG;;;;;SAmEC;AAED,+GAA+G;AAC/G;;;;SAgCC;AAED;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BC;AA9JD,qCAAsC,eAAe,CAAC"}
@@ -58,7 +58,7 @@ export function projectForm(session, flows) {
58
58
  const members = fields(input.any_of, state, prefix, depth + 1).map(field => ({ ...field, required: false }));
59
59
  const groupLabel = language === 'es' ? input.label_es || input.label : input.label;
60
60
  if (members.length)
61
- out.push({ name: input.name, path, kind: 'alternatives', label: groupLabel || '', required, exclusive: input.exclusive === true, fields: members });
61
+ out.push({ name: input.name, path, kind: 'alternatives', label: groupLabel || '', required, exclusive: input.exclusive === true, ...(isCurrent ? { current: true } : {}), fields: members });
62
62
  }
63
63
  else if (input.form && input.schema) {
64
64
  if (input.prepare && !state.prepared?.[input.name])
@@ -68,7 +68,7 @@ export function projectForm(session, flows) {
68
68
  const virtual = child || { values: state.values?.[input.name] || {}, data: snapshot?.data || {}, prepared: snapshot?.prepared || {}, errors: {} };
69
69
  const nested = fields(child?.specs || input.schema.inputs, virtual, path + '.', depth + 1);
70
70
  if (nested.length)
71
- out.push({ name: input.name, path, kind: 'group', label: label(input, language), required, fields: nested });
71
+ out.push({ name: input.name, path, kind: 'group', label: label(input, language), required, ...(isCurrent ? { current: true } : {}), fields: nested });
72
72
  }
73
73
  else if (input.profile) {
74
74
  const profile = input.profile;
@@ -103,6 +103,9 @@ export function projectForm(session, flows) {
103
103
  field.value = state.values[input.name];
104
104
  if (state.errors?.[input.name])
105
105
  field.error = String(state.errors[input.name]);
106
+ // The field the conversation is asking for now, so a client can point at it on a redrawn form.
107
+ if (isCurrent)
108
+ field.current = true;
106
109
  out.push(field);
107
110
  }
108
111
  }
@@ -94,7 +94,7 @@ export function contactPrompt(cargo, options, callerAllowed, partial = false, es
94
94
  }
95
95
  const contactParams = [param('retry_flow', 'Retry destination'), param('cancel_flow', 'Exit destination'), param('cell_number', 'Phone already supplied'), param('email', 'Email already supplied'), param('acct_number', 'Account identifier already supplied'), param('account_pattern', 'Tenant account identifier pattern'), param('account_name', 'English account identifier label'), param('account_name_es', 'Spanish account identifier label'), param('account_shape', 'Tenant keypad identifier shapes', 'array'), param('intro', 'English introduction'), param('intro_es', 'Spanish introduction'), param('caller_on_file', 'yes, no or unknown caller-ID eligibility'), param('retry_call_type', 'Retry destination invocation policy'), param('validate_flow', 'Contact existence validator'), param('merge_partials', 'Allow split account identifiers', 'boolean'), param('parent_form', 'Owning task FORM instance'), param('contact_options', 'Internal options across protocol transitions', 'object'), param('retrying', 'Retry-menu continuation', 'boolean'), param('gce_partial', 'Internal split identifier continuation', 'boolean'), param('gce_rejected', 'Internal rejected contact continuation', 'boolean')];
96
96
  const contactDefaults = { retry_flow: 'authenticate-user', cancel_flow: 'contact-support', cell_number: '', email: '', acct_number: '', account_pattern: '', account_name: '', account_name_es: '', account_shape: [], intro: '', intro_es: '', caller_on_file: '', retry_call_type: 'reboot', validate_flow: '', merge_partials: false, parent_form: '', contact_options: null, retrying: false, gce_partial: false, gce_rejected: false, contact_allowed: false, contact_prefill: '', contact_partial: false, contact_text: '', contact_digits: '', contact_mail: '', contact_phone: '', contact_id: null, contact_profiles: [], contact_keypad: null, contact_question: '', contact_question_es: '', contact_check_key: '', contact_error: '', contact_error_es: '', contact_kind: '' };
97
- const contactProfiles = [{ name: 'phone', label: 'phone number', label_es: 'número de teléfono', profile: { kind: 'phone' } }, { name: 'email_address', label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' } }, { name: 'account', label: 'account number', label_es: 'número de cuenta', profile: { kind: 'identifier', pattern: '(?!)' } }, { ...raw, form_client: false }];
97
+ const contactProfiles = [{ name: 'phone', label: 'phone number', label_es: 'número de teléfono', profile: { kind: 'phone' } }, { name: 'email_address', label: 'email address', label_es: 'correo electrónico', profile: { kind: 'email' } }, { name: 'account', label: 'account number', label_es: 'número de cuenta', profile: { kind: 'identifier' } }, { ...raw, form_client: false }];
98
98
  const contactReplay = (id, extra = {}) => call(id, 'get-cell-or-email', { contact_options: '{{contact_options}}', cell_number: '', email: '', acct_number: '', ...extra }, 'replace');
99
99
  const contactMenu = id => call(id, 'generic-retry-with-options', { error_message: '{{contact_error}}', error_message_es: '{{contact_error_es}}', retry_flow: '{{contact_options.retry_flow}}', cancel_flow: '{{contact_options.cancel_flow}}', capture_patterns: '{{cargo.authCapture}}', retry_call_type: '{{contact_options.retry_call_type}}', parent_form: '{{contact_options.parent_form}}', contact_options: '{{contact_options}}', gce_menu: true }, 'replace');
100
100
  export function contactError(kind, options, es = false) {
@@ -119,7 +119,7 @@ const contact = worker('get-cell-or-email', 'GetCellOrEmail', 'Identify a suppli
119
119
  // account is needed) leads the verification code question instead (otpPrompt). A spoken question said it (or had none).
120
120
  effect('identity_contact_intro_unsaid', "(!contact_prefill ? (cargo.otpIntro='',cargo.otpIntro_es='') : contact_options.intro && !cargo.contactIntroSkip && !contact_options.fromMenu ? (cargo.otpIntro=String(contact_options.intro),cargo.otpIntro_es=String(contact_options.intro_es || contact_options.intro)) : true,true)"),
121
121
  effect('identity_contact_preselected', "(acct_number || cell_number || email ? true : (cargo.callerPreselected=!!(contact_prefill && contact_options.caller_on_file === 'yes')),true)"),
122
- set('identity_contact_profiles', 'contact_profiles', "contact_profiles_base.map(function (field) {return field.name === 'account' ? Object.assign({},field,{profile:{kind:'identifier',pattern:contact_options.account_pattern || '(?!)'}}) : field;}).concat(contact_allowed ? [{name:'caller_decision',label:'caller ID choice',label_es:'opción del identificador de llamadas',profile:{kind:'choice',choices:[{key:'yes',phrases:['1','yes','si','sí'],exact:true},{key:'no',phrases:['no','nope','nah'],exact:true}]}}] : [])"),
122
+ set('identity_contact_profiles', 'contact_profiles', "contact_profiles_base.filter(function (field) {return field.name !== 'account' || !!contact_options.account_pattern;}).map(function (field) {return field.name === 'account' ? Object.assign({},field,{profile:{kind:'identifier',pattern:contact_options.account_pattern}}) : field;}).concat(contact_allowed ? [{name:'caller_decision',label:'caller ID choice',label_es:'opción del identificador de llamadas',profile:{kind:'choice',choices:[{key:'yes',phrases:['1','yes','si','sí'],exact:true},{key:'no',phrases:['no','nope','nah'],exact:true}]}}] : [])"),
123
123
  set('identity_contact_keypad', 'contact_keypad', "(function () {var shapes=[{first:'23456789',lengths:[10]},{first:'1',lengths:[11]}].concat(contact_options.account_shape || []);if(contact_partial){var left=[];(contact_options.account_shape || []).forEach(function(s){(s.lengths || []).forEach(function(n){var rest=n-String(cargo.gcePartial).length;if(rest>0 && left.indexOf(rest)<0)left.push(rest);});});return {min:1,max:12,autoSubmitMs:3000,complete:[{first:'0123456789',lengths:left.sort(function(a,b){return a-b;})}]};}return {min:7,max:12,autoSubmitMs:3000,autoSubmitChars:contact_allowed?['1']:[],complete:shapes};})()"),
124
124
  set('identity_contact_question', 'contact_question', expression(contactPrompt, 'cargo', 'contact_options', 'contact_allowed', 'contact_partial')),
125
125
  set('identity_contact_question_es', 'contact_question_es', expression(contactPrompt, 'cargo', 'contact_options', 'contact_allowed', 'contact_partial', 'true')),
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:a8f2fe0501d76281db508eab15e0453c1d5dc1bee80419d2c0ac8d6811b866cf";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:66fc7813afb500bc0554e498473cb92a02100e37f3283ccfd6d84471fbd304ee";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.39.0",
3
+ "version": "1.40.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",