jsfe 1.72.3 → 1.72.4

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 CHANGED
@@ -522,7 +522,10 @@ const engine = new WorkflowEngine(logger, aiCallback, flows, tools,
522
522
  reason in `container.otpFailure` (`missing`, `expired` or `mismatch`). Sending the code is the host's job.
523
523
  - Built-in field validators: `validate-card-number` (Luhn; normalizes to digits), `validate-card-expiration` (a month
524
524
  as a number or its English or Spanish name, and a year; normalizes to MMYY) and `validate-card-cvv` (4 digits for
525
- American Express, 3 for every other brand; the rejection says "the 4 digits on the front" or "the 3 digits on the back").
525
+ American Express, 3 for every other brand; the rejection says "the 4 digits on the front" or "the 3 digits on the back"),
526
+ and `validate-us-phone` (a US or Canada number, 10 digits or 11 starting with 1; normalizes to the 10 digits). The
527
+ `phone` preset's reader alone also takes an 11-13 digit international number: declare this validator where only a US
528
+ number is valid.
526
529
  - Session-aware helpers read only the cargo a caller passes: `callerTextNumber`, `textDestination`,
527
530
  `callerIsInternational`.
528
531
 
@@ -1 +1 @@
1
- {"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AAwHA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AAsGD;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EC;AACD;;;GAGG;AACH;;;;;;EAGC;AAslBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AA15BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
@@ -933,6 +933,10 @@ const validators = [
933
933
  description: 'Validator: month (a number or its English or Spanish name) and year, a real month, not expired (validateExpiration). Normalizes to MMYY. Params: form, input, value, values, reading (it reads value).',
934
934
  parameters: [{ name: 'input', type: 'string', description: 'input name' }, { name: 'value', type: 'string', description: 'the reading' }],
935
935
  steps: [SIDE('vce_check', "(function (v) { var names = " + JSON.stringify(MONTH_NAMES.map(([n]) => n)) + "; var nums = " + JSON.stringify(MONTH_NAMES.map(([, k]) => k)) + "; var w = new RegExp('\\\\b(' + names.join('|') + ')\\\\b', 'i').exec(String(v)); if (w) { v = String(v).replace(w[0], ' ' + nums[names.indexOf(w[1].toLowerCase())] + ' '); } var m = /^(0?[1-9]|1[0-2])\\D*(?:20)?(\\d{2})$/.exec(String(v).replace(/\\s+/g, '').replace(/de/gi, '')) || /^(\\d{2})(\\d{2})$/.exec(String(v).replace(/\\D/g, '')) || /^(0[1-9])0(\\d{2})$/.exec(String(v).replace(/\\D/g, '')); var mm = m ? ('0' + m[1]).slice(-2) : ''; var yy = m ? m[2] : ''; cargo.inputCheck = m && validateExpiration(mm, yy) ? { ok: true, value: mm + yy } : { ok: false, message: \"That expiration date doesn't look right.\", message_es: 'Esa fecha de vencimiento no parece correcta.' }; return true; })(value)")] },
936
+ { id: 'validate-us-phone', name: 'ValidateUsPhone', version: '1.0.0', scope: 'isolated',
937
+ description: 'Validator: a US or Canada phone number, 10 digits or 11 starting with 1 (validatePhone); normalizes to its 10 digits. The phone reader alone also takes an 11-13 digit international number. Params: form, input, value, values, reading (it reads value).',
938
+ parameters: [{ name: 'input', type: 'string', description: 'input name' }, { name: 'value', type: 'string', description: 'the reading' }],
939
+ steps: [SIDE('vup_check', "(function (d) { cargo.inputCheck = validatePhone(d) ? { ok: true, value: d.slice(-10) } : { ok: false, message: 'I heard ' + d.length + ' digits; a phone number has 10.', message_es: 'Escuché ' + d.length + ' dígitos; el número de teléfono tiene 10.' }; return true; })(String(value).replace(/\\D/g, ''))")] },
936
940
  { id: 'validate-card-cvv', name: 'ValidateCardCvv', version: '1.0.0', scope: 'isolated',
937
941
  description: 'Validator: the security code has the length of its card brand, 4 digits for American Express (34, 37) and 3 for every other brand; with no card number yet, 3 or 4. Params: form, input, value, values, reading (it reads value and values.card_number).',
938
942
  parameters: [{ name: 'input', type: 'string', description: 'input name' }, { name: 'value', type: 'string', description: 'the reading' }, { name: 'values', type: 'object', description: "the form's values, for the card number" }],
@@ -1224,6 +1228,7 @@ const LIBRARY_CONTRACTS = {
1224
1228
  'validate-card-number': { role: 'worker', result: { path: 'cargo.inputCheck', type: 'object' } },
1225
1229
  'validate-card-expiration': { role: 'worker', result: { path: 'cargo.inputCheck', type: 'object' } },
1226
1230
  'validate-card-cvv': { role: 'worker', result: { path: 'cargo.inputCheck', type: 'object' } },
1231
+ 'validate-us-phone': { role: 'worker', result: { path: 'cargo.inputCheck', type: 'object' } },
1227
1232
  'collect-address': { role: 'collector' }, 'collect-credit-card': { role: 'collector' }
1228
1233
  };
1229
1234
  export const FLOWS = LIBRARY_FLOWS.map(flow => {
@@ -1 +1 @@
1
- export const JSFE_RUNTIME_FINGERPRINT = "sha256:67b90d87217c76f192cb6a675fa28d8d22e7988aaaba8c8630520390ff24f9f3";
1
+ export const JSFE_RUNTIME_FINGERPRINT = "sha256:04db9b89e52d2e293a7f27bf038137d59ecff227bb009ac0a73856ec12a02b6e";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsfe",
3
- "version": "1.72.3",
3
+ "version": "1.72.4",
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",