jsfe 1.47.0 → 1.49.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/dist/forms/flows.d.ts.map +1 -1
- package/dist/forms/flows.js +5 -28
- package/dist/runtime-identity.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flows.d.ts","sourceRoot":"","sources":["../../src/forms/flows.js"],"names":[],"mappings":"AA4GA;;;;;;;GAOG;AACH;;;;GAIG;AACH,8HAA8H;AAC9H,uFAIC;AA2ED;;2EAE2E;AAC3E,qEAEC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEC;AACD;;;GAGG;AACH;;;;;;EAGC;AA+kBD,wHAAwH;AACxH,wEAaC;AACD,4FAA4F;AAC5F;;;EAYC;AACD,sGAAsG;AACtG;;;EAOC;AA12BM,6CAAuG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAikC9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOG"}
|
package/dist/forms/flows.js
CHANGED
|
@@ -10,8 +10,8 @@ import { CONTEXTUAL_RESPONSES_REQUIREMENT, hasFormResponse, contextualResponseRu
|
|
|
10
10
|
*
|
|
11
11
|
* Collection: run-form (the reentrant loop, shared scope), collect-input (ask one input, read the answer against the
|
|
12
12
|
* form chain), collect-input-accept (validate + store, one reading at a time), disambiguate-input,
|
|
13
|
-
* form-done (hand the result to the parent, clear the form), the
|
|
14
|
-
*
|
|
13
|
+
* form-done (hand the result to the parent, clear the form), the sub-forms collect-address and
|
|
14
|
+
* collect-credit-card, validate-card-number / validate-card-expiration.
|
|
15
15
|
* Retrieval: provide-data (gate → load → answer), load-source, answer-facts.
|
|
16
16
|
*
|
|
17
17
|
* State lives in cargo.forms[<form id>] = { values, attempts, replays, parent, result_input, specs }: cargo is the only
|
|
@@ -99,10 +99,6 @@ export const FIELD_PRESETS = {
|
|
|
99
99
|
confirm_out_of_order: { word: 'ZIP', word_es: 'CÓDIGO POSTAL', message: 'If {value} is the billing ZIP code of the card, add the word {word}.', message_es: 'Si {value} es el código postal de facturación de la tarjeta, agregue las palabras {word}.' },
|
|
100
100
|
question: 'What is the billing ZIP code for the card?', question_es: '¿Cuál es el código postal de facturación de la tarjeta?' },
|
|
101
101
|
};
|
|
102
|
-
// Field collectors: one-input forms over a preset, callable directly (result in cargo.formResults[<id>]).
|
|
103
|
-
const FIELD_COLLECTORS = { 'collect-phone': 'phone', 'collect-email': 'email', 'collect-zip': 'zip', 'collect-street-address': 'street_address',
|
|
104
|
-
'collect-city': 'city', 'collect-card-number': 'card_number', 'collect-card-expiration': 'card_expiration', 'collect-card-cvv': 'card_cvv',
|
|
105
|
-
'collect-card-zip': 'card_zip' };
|
|
106
102
|
// ── a form flow (the shape every form follows; tenant forms are written the same way) ──────────────────────────────
|
|
107
103
|
/**
|
|
108
104
|
* The form shell: declare inputs, run the loop, hand the result on. `after` = the form's own steps once complete.
|
|
@@ -564,17 +560,6 @@ const rankedDispatch = (id, reason, stay = false, parameters = '') => ({ ...yiel
|
|
|
564
560
|
// (DISPATCH responseConcernForm: the engine renders it). The ranker is offered `concern` only then; a concern says the rendered
|
|
565
561
|
// description, how to cancel, and the question again, with no attempt.
|
|
566
562
|
const concernRoute = (id, input) => [WHEN(id, 'reply && reply.concern === true', SIDE(`${id}_line`, `(cargo.forms[form].concernText=String(reply.concern_text || ''),cargo.forms[form].feedback=cargo.forms[form].feedback || {},cargo.forms[form].feedback[${input}]='concern',true)`)), WHEN(`${id}_end`, 'reply && reply.concern === true', END(`${id}_done`))];
|
|
567
|
-
const readFormReply = {
|
|
568
|
-
id: 'read-form-reply', name: 'ReadFormReply', version: '1.1.0', scope: 'isolated', description: 'Rank an unreadable answer against its question: a request for a person or for text is taken; an answer is asked again; a withdrawal or a new request leaves with saved form progress.',
|
|
569
|
-
parameters: [{ name: 'form', type: 'string' }, { name: 'input', type: 'string' }, { name: 'question', type: 'string' }, { name: 'question_es', type: 'string' }],
|
|
570
|
-
variables: vars({ question: '', question_es: '', asked: '', ranked: [], reply: null }),
|
|
571
|
-
steps: [SET('reply_asked', 'asked', "language === 'es' && question_es ? question_es : question"),
|
|
572
|
-
rankedChoices('reply_ranked', '[]'),
|
|
573
|
-
rankedDispatch('reply_dispatch', 'input_not_matched'),
|
|
574
|
-
...escapeRoutes('reply_escape'),
|
|
575
|
-
...concernRoute('reply_concern', 'input'),
|
|
576
|
-
rankedMiss('reply_miss')]
|
|
577
|
-
};
|
|
578
563
|
// A provider menu's fact named inside a longer sentence (provides.menu.whole_phrases): the phrase does not decide, the ranker
|
|
579
564
|
// does. It is offered every choice the menu's reader accepts. The result is cargo.providerReply: { key, also? }, key '' when no
|
|
580
565
|
// choice was picked (the menu then hands the turn to the host, which holds the account in its user context).
|
|
@@ -900,12 +885,7 @@ const validators = [
|
|
|
900
885
|
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" }],
|
|
901
886
|
steps: [SIDE('vcc_check', "(function (v, n) { var d = String(v).replace(/\\D/g, ''); var pan = String(n || '').replace(/\\D/g, ''); var want = pan ? (/^3[47]/.test(pan) ? 4 : 3) : 0; var ok = want ? d.length === want : d.length === 3 || d.length === 4; cargo.inputCheck = ok ? { ok: true, value: d } : want === 4 ? { ok: false, message: \"That security code doesn't look right. It is the 4 digits on the front of the card.\", message_es: 'Ese código de seguridad no parece correcto. Son los 4 dígitos al frente de la tarjeta.' } : { ok: false, message: \"That security code doesn't look right. It is the 3 digits on the back of the card.\", message_es: 'Ese código de seguridad no parece correcto. Son los 3 dígitos al reverso de la tarjeta.' }; return true; })(value, typeof values !== 'undefined' && values ? values.card_number : '')")] },
|
|
902
887
|
];
|
|
903
|
-
// ──
|
|
904
|
-
const fieldCollectors = Object.entries(FIELD_COLLECTORS).map(([id, field]) => formFlow({
|
|
905
|
-
id, name: id.split('-').map((w) => w[0].toUpperCase() + w.slice(1)).join(''), version: '1.0.0',
|
|
906
|
-
description: `Field collector: the ${FIELD_PRESETS[field].label} (preset '${field}'). Result: cargo.formResults['${id}'].${field}.`,
|
|
907
|
-
inputs: [{ name: field, field }],
|
|
908
|
-
}));
|
|
888
|
+
// ── sub-forms ──────────────────────────────────────────────────────────────────────────────────
|
|
909
889
|
const subForms = [
|
|
910
890
|
formFlow({ id: 'collect-address', name: 'CollectAddress', version: '1.0.0',
|
|
911
891
|
description: "Sub-form: street address, city, state, ZIP, in any order. Result: the parent's result input (or cargo.formResults['collect-address']).",
|
|
@@ -1168,7 +1148,7 @@ const resumeForm = { id: 'resume-form', name: 'ResumeForm', version: '1.0.0', sc
|
|
|
1168
1148
|
SET('resume_definition', 'target', 'cargo.forms[form].definition'), SET('resume_parent', 'parent', "cargo.forms[form].parent || ''"), SET('resume_slot', 'slot', "cargo.forms[form].result_input || ''"),
|
|
1169
1149
|
FLOW('resume_owned_form', '{{target}}', 'replace', { form_instance: '{{form}}', parent_form: '{{parent}}', result_input: '{{slot}}' })
|
|
1170
1150
|
] };
|
|
1171
|
-
const LIBRARY_FLOWS = [providerUnanswered, readProviderReply,
|
|
1151
|
+
const LIBRARY_FLOWS = [providerUnanswered, readProviderReply, readFormChoice, readConfirmReply, confirmInputProposal, proposalDeclined, resumeForm, performAction, sendTextAction, prepareInput, runForm, collectInput, validateBatch, requestCancelled, readFormResponse, collectContextualAnswer, accept, acceptedEffects, disambiguate, confirmForm, formDone, providerMenu, ...validators, ...subForms, provideData, provideQueuedData, loadSource, answerFacts];
|
|
1172
1152
|
const LIBRARY_CONTRACTS = {
|
|
1173
1153
|
'confirm-input-proposal': { role: 'collector', requires: [INPUT_PROPOSALS_REQUIREMENT] }, 'confirm-input-proposal-declined': { role: 'worker', requires: [INPUT_PROPOSALS_REQUIREMENT] },
|
|
1174
1154
|
'resume-form': { role: 'worker' },
|
|
@@ -1177,7 +1157,7 @@ const LIBRARY_CONTRACTS = {
|
|
|
1177
1157
|
'prepare-input': { role: 'worker' }, 'run-form': { role: 'worker' }, 'collect-input': { role: 'worker' },
|
|
1178
1158
|
'request-cancelled': { role: 'worker' },
|
|
1179
1159
|
'read-form-response': { role: 'worker', requires: [CONTEXTUAL_RESPONSES_REQUIREMENT] },
|
|
1180
|
-
'read-form-
|
|
1160
|
+
'read-form-choice': { role: 'worker', requires: [CONTEXTUAL_RESPONSES_REQUIREMENT] }, 'read-provider-reply': { role: 'worker', requires: [CONTEXTUAL_RESPONSES_REQUIREMENT] }, 'read-confirm-reply': { role: 'worker', requires: [CONTEXTUAL_RESPONSES_REQUIREMENT] },
|
|
1181
1161
|
'collect-contextual-answer': { role: 'collector', requires: [CONTEXTUAL_RESPONSES_REQUIREMENT] },
|
|
1182
1162
|
'validate-input-batch': { role: 'worker', result: { path: 'cargo.inputBatch', type: 'object' } },
|
|
1183
1163
|
'collect-input-accept': { role: 'worker' }, 'input-accepted-effects': { role: 'worker' },
|
|
@@ -1187,9 +1167,6 @@ const LIBRARY_CONTRACTS = {
|
|
|
1187
1167
|
'validate-card-number': { role: 'worker', result: { path: 'cargo.inputCheck', type: 'object' } },
|
|
1188
1168
|
'validate-card-expiration': { role: 'worker', result: { path: 'cargo.inputCheck', type: 'object' } },
|
|
1189
1169
|
'validate-card-cvv': { role: 'worker', result: { path: 'cargo.inputCheck', type: 'object' } },
|
|
1190
|
-
'collect-phone': { role: 'collector' }, 'collect-email': { role: 'collector' }, 'collect-zip': { role: 'collector' },
|
|
1191
|
-
'collect-street-address': { role: 'collector' }, 'collect-city': { role: 'collector' }, 'collect-card-number': { role: 'collector' },
|
|
1192
|
-
'collect-card-expiration': { role: 'collector' }, 'collect-card-cvv': { role: 'collector' }, 'collect-card-zip': { role: 'collector' },
|
|
1193
1170
|
'collect-address': { role: 'collector' }, 'collect-credit-card': { role: 'collector' }
|
|
1194
1171
|
};
|
|
1195
1172
|
export const FLOWS = LIBRARY_FLOWS.map(flow => {
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:5df591949d638f7d274d63b101b4fbb9f35d3210148381cf17a5c7d01d4d9767";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.49.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",
|