jsfe 1.17.0 → 1.17.1

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.
@@ -7,7 +7,7 @@ export function contactPrompt(cargo: any, options: any, callerAllowed: any, part
7
7
  export function contactError(kind: any, options: any, es?: boolean): string;
8
8
  export function otpWhere(cargo: any, es?: boolean): string;
9
9
  export function otpPrompt(cargo: any, es?: boolean): string;
10
- /** What the caller hears when a second code goes to the account's email: the address masked to its first letter and domain. */
10
+ /** What the caller hears when a second code goes to the account's email, masked by maskEmail (jsfe/helpers). */
11
11
  export function otpAlsoSent(cargo: any, es?: boolean): string;
12
12
  export function emailReadback(address: any, voice: any, es?: boolean): string;
13
13
  /** Reenter the existing owning FORM or its gate without making the owner its own parent. */
@@ -1 +1 @@
1
- {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AA2BA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AAMD,4EAKC;AAwFD,2DAOC;AACD,4DAOC;AACD,+HAA+H;AAC/H,8DAGC;AA0ID,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAQD,0BAA4I"}
1
+ {"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AA6BA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,6CAMC;AACD,qHAQC;AAMD,4EAKC;AAwFD,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AA0ID,8EAGC;AA4BD,4FAA4F;AAC5F;;;;EAOC;AAQD,0BAA4I"}
@@ -1,6 +1,8 @@
1
1
  /** Shared identity protocols. Every conversational answer enters the ordinary FORM acceptance/matching pipeline. */
2
2
  import { defineWorker, defineForm } from './contracts.js';
3
3
  import { OTP_EXPIRY_MS } from '../helpers/otp-check.js';
4
+ // maskEmail is a standard function: these functions run as flow expressions too, where it is in scope by name.
5
+ import { maskEmail } from '../helpers/contact.js';
4
6
  const vars = o => Object.fromEntries(Object.entries(o).map(([k, v]) => [k, { type: Array.isArray(v) ? 'array' : v === null || typeof v === 'object' ? 'object' : typeof v, value: v }]));
5
7
  const param = (name, description, type = 'string') => ({ name, type, description });
6
8
  const set = (id, variable, value) => ({ id, type: 'SET', variable, value });
@@ -179,7 +181,7 @@ export function otpWhere(cargo, es = false) {
179
181
  const number = String(cargo.otp_cell_number || '').replace(/\D/g, '').slice(-4), tail = cargo.voice ? number.split('').join(', ') : number;
180
182
  if (cargo.otpSentOn === 'whatsapp')
181
183
  return es ? 'Se lo acabo de enviar aquí en este chat.' : 'I just sent it to you here in this chat.';
182
- const mail = String(cargo.otpAltEmail || ''), at = mail.indexOf('@'), masked = cargo.voice ? (es ? 'que empieza con ' : 'starting with ') + mail.charAt(0).toUpperCase() + (es ? ', arroba ' : ', at ') + mail.slice(at + 1) : mail.charAt(0) + '…@' + mail.slice(at + 1);
184
+ const masked = maskEmail(cargo.otpAltEmail, cargo.voice, es ? 'es' : 'en');
183
185
  if (cargo.otp_cell_number && cargo.otpAltSent === true)
184
186
  return es ? 'Se lo envié por mensaje de texto al celular que termina con ' + tail + ', y también le envié un código a su correo ' + masked + '. Revise sus mensajes de texto y su correo.' : 'I sent it by text message to the cell ending with ' + tail + ', and I also sent a code to your email ' + masked + '. Check your text messages and your email.';
185
187
  if (cargo.otp_cell_number)
@@ -189,14 +191,14 @@ export function otpWhere(cargo, es = false) {
189
191
  export function otpPrompt(cargo, es = false) {
190
192
  const verb = es ? cargo.verb_es : cargo.verb, number = String(cargo.otp_cell_number || '').replace(/\D/g, '').slice(-4), tail = cargo.voice ? number.split('').join(', ') : number;
191
193
  const where = cargo.otpSentOn === 'whatsapp' ? (es ? 'que le acabo de enviar aquí en este chat' : 'I just sent you here in this chat') : (es ? 'que recibió en ' : 'you received at ') + (cargo.otp_cell_number ? (es ? 'celular que termina con ' : 'cell ending with ') + tail : (es ? 'correo electrónico: ' : 'email: ') + String(cargo.otp_email || ''));
192
- const mail = String(cargo.otpAltEmail || ''), at = mail.indexOf('@'), also = cargo.otp_cell_number && cargo.otpAltSent === true ? (es ? ' o en su correo ' : ' or at your email ') + (cargo.voice ? (es ? 'que empieza con ' : 'starting with ') + mail.charAt(0).toUpperCase() + (es ? ', arroba ' : ', at ') + mail.slice(at + 1) : mail.charAt(0) + '…@' + mail.slice(at + 1)) : '';
194
+ const also = cargo.otp_cell_number && cargo.otpAltSent === true ? (es ? ' o en su correo ' : ' or at your email ') + maskEmail(cargo.otpAltEmail, cargo.voice, es ? 'es' : 'en') : '';
193
195
  const name = cargo.callerPreselected && cargo.callerNamed && cargo.displayName ? cargo.displayName : '';
194
196
  const lead = String((es ? cargo.otpIntro_es : cargo.otpIntro) || '');
195
197
  return (lead ? lead + ' ' : '') + (name ? name + (es ? ', por favor' : ', please') : es ? 'Por favor' : 'Please') + ' ' + verb + ' ' + (cargo.voice ? es ? 'o ingrese ' : 'or enter ' : '') + (es ? 'el código de verificación de 6 dígitos ' : 'the 6-digit verification code ') + where + also + '. ' + (es ? `También puede ${cargo.voice ? 'presionar * o decir' : 'escribir'} SALIR para cancelar.` : `You can also ${cargo.voice ? 'press * or ' : ''}${verb} EXIT to cancel.`) + (cargo.callerPreselected ? (es ? ` Para usar otra cuenta, ${verb} OTRA CUENTA.` : ` To use another account, ${verb} ANOTHER ACCOUNT.`) : '');
196
198
  }
197
- /** What the caller hears when a second code goes to the account's email: the address masked to its first letter and domain. */
199
+ /** What the caller hears when a second code goes to the account's email, masked by maskEmail (jsfe/helpers). */
198
200
  export function otpAlsoSent(cargo, es = false) {
199
- const mail = String(cargo.otpAltEmail || ''), at = mail.indexOf('@'), masked = cargo.voice ? (es ? 'que empieza con ' : 'starting with ') + mail.charAt(0).toUpperCase() + (es ? ', arroba ' : ', at ') + mail.slice(at + 1) : mail.charAt(0) + '…@' + mail.slice(at + 1);
201
+ const masked = maskEmail(cargo.otpAltEmail, cargo.voice, es ? 'es' : 'en');
200
202
  return es ? 'Muy bien, también le envié un código a su correo ' + masked + '.' : 'Okay, I also sent a code to your email ' + masked + '.';
201
203
  }
202
204
  // The caller cannot find the texted code (or asks for another way, or for email): a second code goes to the account's email
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:d627609ff5d3f9bcce717128efd724ef64caddf410f63224fc63ee56dda3451b";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:b277b5861474d6a664568a7ba90791e721acc952575b4182d58518de7f568e99";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
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",