jsfe 1.102.0 → 1.102.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.
- package/dist/forms/identity-flows.d.ts.map +1 -1
- package/dist/forms/identity-flows.js +2 -1
- package/dist/forms/send-copy-flow.d.ts.map +1 -1
- package/dist/forms/send-copy-flow.js +39 -26
- package/dist/helpers/answer.d.ts +1 -0
- package/dist/helpers/answer.d.ts.map +1 -1
- package/dist/helpers/answer.js +6 -1
- package/dist/helpers/money.js +2 -2
- package/dist/runtime-identity.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAkDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,0CAYC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAYC;AAED;;kGAEkG;AAClG,0FASC;AAED;kIACkI;AAClI;;;;SAUC;AAiID,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;
|
|
1
|
+
{"version":3,"file":"identity-flows.d.ts","sourceRoot":"","sources":["../../src/forms/identity-flows.js"],"names":[],"mappings":"AAkDA,+GAA+G;AAC/G,oFAOC;AAQD,wFAAwF;AACxF,iDAGC;AACD,0CAYC;AACD,qHAQC;AASD,qHAAqH;AACrH,6FAKC;AACD,4EAYC;AAED;;kGAEkG;AAClG,0FASC;AAED;kIACkI;AAClI;;;;SAUC;AAiID,2DAOC;AACD,4DAOC;AACD,gHAAgH;AAChH,8DAGC;AAmKD,8EAGC;AAgCD,4FAA4F;AAC5F;;;;EAOC;AAYD,oGAOC;AAnRD,iCAAgC,wIAAwI,CAAC;AACzK,wCAAuC,CAAC,CAAC;AAsSzC,0BAAsK"}
|
|
@@ -443,7 +443,8 @@ const validateCode = worker('validate-otp-code', 'ValidateOtpCode', 'Validate a
|
|
|
443
443
|
default: effect('otp_reply_route_none', 'true')
|
|
444
444
|
}),
|
|
445
445
|
effect('otp_word_count', '(cargo.otpWordMisses=Number(cargo.otpWordMisses || 0)+(no_code_given?1:0),true)'),
|
|
446
|
-
|
|
446
|
+
// Words alone end it at the sixth reply (owner 2026-12-04): at the third, callers still getting or saying the code lost it.
|
|
447
|
+
when('otp_word_cap', 'no_code_given && cargo.otpWordMisses >= 6', verificationEnd('otp_word_end')),
|
|
447
448
|
// a reason for the call authentication serves is acknowledged: verification comes first
|
|
448
449
|
when('otp_usecase_ack', "no_code_given && otp_reply && String(otp_reply.key || '').indexOf('usecase:') === 0", say('otp_usecase_explain', 'Understood. First we need to finish verifying your identity. I sent you a message with a six-digit code in it. Read those six digits back to me. You can also {{cargo.verb}} EXIT to cancel.', "Entendido. Primero necesitamos completar la verificación de su identidad. Le envié un mensaje con un código de seis dígitos. Dígame esos seis dígitos. También puede {{cargo.voice ? 'decir' : 'escribir'}} SALIR para cancelar.")),
|
|
449
450
|
when('otp_explanation', "no_code_given && !(no_code_given && otp_reply && String(otp_reply.key || '').indexOf('usecase:') === 0)", say('otp_explain', 'Let me explain. I sent you a message with a six-digit code in it. Read those six digits back to me. You can also {{cargo.verb}} EXIT to cancel.', "Le explico. Le envié un mensaje con un código de seis dígitos. Dígame esos seis dígitos. También puede {{cargo.voice ? 'decir' : 'escribir'}} SALIR para cancelar.")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"send-copy-flow.d.ts","sourceRoot":"","sources":["../../src/forms/send-copy-flow.js"],"names":[],"mappings":"AAqPA,0BAAmD"}
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
* - The web chat link (WEB_LINK_KEY, owner 2026-11-26: "can I continue this on my computer?") is made at send time by the
|
|
16
16
|
* host's get-web-chat-link tool. With no medium or destination named it is texted to the caller's number, else emailed to
|
|
17
17
|
* the email on file, else the medium is asked; any number or email the caller names is used, as for any item.
|
|
18
|
-
* -
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* - The email on file is a verified customer's only: cargo.accountEmail, which the tenant sets from the verified account, else
|
|
19
|
+
* the address the code went to. It is offered in full when no address was given (owner 2026-12-03).
|
|
20
|
+
* - Any item to a target that is not the caller's own (their phone, the verified cell, the email on file) is read back once and
|
|
21
|
+
* sent only on YES: ask-email's read-back is that question for an address it collected, and a second one is asked only when
|
|
22
|
+
* the item has a warning (owner 2026-12-03): the web link, the whole conversation, or a registered document that declares
|
|
23
|
+
* a disclaimer (owner 2026-11-26: anything in the chat may be sensitive). A sender item's own flow gates its destination.
|
|
21
24
|
* No authentication gate here (owner rule: an authenticated caller's chat and documents are theirs to send anywhere;
|
|
22
25
|
* before authentication no reply holds account data). A sender flow gates its own document.
|
|
23
26
|
*/
|
|
@@ -43,7 +46,7 @@ const sendCopy = defineWorker({
|
|
|
43
46
|
contract: { role: 'router', summary: 'Sends a reply, registered document, the whole conversation or a link to continue it on the web, as the caller picks, by text or email, through the system send workers or the document\'s sender flow' },
|
|
44
47
|
id: 'send-copy',
|
|
45
48
|
name: 'SendCopy',
|
|
46
|
-
version: '1.
|
|
49
|
+
version: '1.4.0',
|
|
47
50
|
primary: true,
|
|
48
51
|
prompt: 'Send a copy',
|
|
49
52
|
prompt_es: 'Enviar una copia',
|
|
@@ -57,7 +60,7 @@ const sendCopy = defineWorker({
|
|
|
57
60
|
],
|
|
58
61
|
variables: vars({
|
|
59
62
|
noop: false, sc_items: [], sc_key: '', sc_item: null, sc_last: null, sc_last_head: '', sc_offer_q: '', sc_offer_q_es: '', sc_doc_list: '', sc_email: '', sc_phone: '',
|
|
60
|
-
sc_medium: '', sc_medium_q: '', sc_medium_q_es: '', sc_given: '', sc_other: false, sc_too_long: false, sc_media: [], sc_forced: '', sc_to: '', sc_subject: '', sc_content: '', sc_sent: false, sc_link: '',
|
|
63
|
+
sc_medium: '', sc_medium_q: '', sc_medium_q_es: '', sc_given: '', sc_other: false, sc_too_long: false, sc_media: [], sc_forced: '', sc_to: '', sc_subject: '', sc_content: '', sc_sent: false, sc_link: '', sc_on_file: '', sc_account_email: false, sc_email_q: '', sc_email_q_es: '', sc_read_back: false, sc_ask: false, sc_warning: '', sc_warning_es: '', sc_target: '', sc_confirm_q: '', sc_confirm_q_es: '',
|
|
61
64
|
}),
|
|
62
65
|
steps: [
|
|
63
66
|
set('sc_items', 'sc_items', 'sendables(cargo)'),
|
|
@@ -89,9 +92,12 @@ const sendCopy = defineWorker({
|
|
|
89
92
|
set('sc_email', 'sc_email', `${EMAIL_IN_JS}(typeof destination === 'string' ? destination : '')`),
|
|
90
93
|
set('sc_phone', 'sc_phone', "readPhone(typeof destination === 'string' ? destination : '')"),
|
|
91
94
|
set('sc_medium', 'sc_medium', "typeof medium === 'string' && (medium === 'text' || medium === 'email') ? medium : sc_email ? 'email' : sc_phone ? 'text' : ''"),
|
|
95
|
+
// the email on file: the verified account's, else the address the verification code went to
|
|
96
|
+
set('sc_on_file', 'sc_on_file', "cargo.otpVerified === true ? [cargo.accountEmail, cargo.otp_email].map(function (e) { return String(e || '').trim(); }).find(function (e) { return validateEmail(e); }) || '' : ''"),
|
|
97
|
+
set('sc_account_email', 'sc_account_email', "!!sc_on_file && sc_on_file === String(cargo.accountEmail || '').trim()"),
|
|
92
98
|
// the web chat link: texted to the caller's number when nothing was named, else emailed to the email on file
|
|
93
99
|
when('sc_link_text', "sc_item.kind === 'web_link' && !sc_medium && !!cargo.twilioNumber && !!textDestination(cargo)", set('sc_link_text_set', 'sc_medium', "'text'")),
|
|
94
|
-
when('sc_link_email', "sc_item.kind === 'web_link' && !sc_medium &&
|
|
100
|
+
when('sc_link_email', "sc_item.kind === 'web_link' && !sc_medium && !!sc_on_file", set('sc_link_email_set', 'sc_email', 'sc_on_file')),
|
|
95
101
|
when('sc_link_email_medium', "sc_item.kind === 'web_link' && !sc_medium && !!sc_email", set('sc_link_email_medium_set', 'sc_medium', "'email'")),
|
|
96
102
|
when('sc_link', "sc_item.kind === 'web_link'", { id: 'sc_link_call', type: 'CALL-TOOL', tool: 'get-web-chat-link', variable: 'sc_link', args: {}, onFail: set('sc_link_failed', 'sc_link', "''") }),
|
|
97
103
|
when('sc_link_none', "sc_item.kind === 'web_link' && !sc_link", say('sc_link_none_say', "Sorry, I couldn't make a link to continue on the web." + ANYTHING_ELSE, 'Lo siento, no pude crear un enlace para continuar en la web.' + ANYTHING_ELSE_ES)),
|
|
@@ -138,7 +144,9 @@ const sendCopy = defineWorker({
|
|
|
138
144
|
question: 'What email address should I send it to?', question_es: '¿A qué correo electrónico se lo envío?', on_file: '',
|
|
139
145
|
})),
|
|
140
146
|
when('sc_other_email_read', "sc_other && sc_medium === 'email'", set('sc_other_email_set', 'sc_email', "cargo.email && validateEmail(String(cargo.email)) ? String(cargo.email) : ''")),
|
|
141
|
-
when('
|
|
147
|
+
when('sc_other_email_heard', "sc_other && sc_medium === 'email'", set('sc_other_email_read_back', 'sc_read_back', 'true')),
|
|
148
|
+
when('sc_other_email_bad', "sc_other && sc_medium === 'email' && !sc_email", say('sc_other_email_bad_say', "Sorry, I couldn't read that email address, so I didn't send it." + ANYTHING_ELSE, 'Lo siento, no pude entender ese correo electrónico, así que no lo envié.' + ANYTHING_ELSE_ES)),
|
|
149
|
+
when('sc_other_email_end', "sc_other && sc_medium === 'email' && !sc_email", end('sc_other_email_done', { outcome: 'unresolved', reason: 'no_email' })),
|
|
142
150
|
// a sender item: its flow collects what it needs (destination, identity) and tells the caller every outcome
|
|
143
151
|
set('sc_given', 'sc_given', "sc_medium === 'email' ? sc_email : sc_phone"),
|
|
144
152
|
when('sc_sender_reset', '!!sc_item.sender', effect('sc_sender_reset_set', 'cargo.copyHandled = false')),
|
|
@@ -160,25 +168,30 @@ const sendCopy = defineWorker({
|
|
|
160
168
|
when('sc_number_bad', "sc_medium === 'text' && !cargo.textTo", say('sc_number_bad_say', "Sorry, I couldn't read that phone number." + ANYTHING_ELSE, 'Lo siento, no pude entender ese número de teléfono.' + ANYTHING_ELSE_ES)),
|
|
161
169
|
when('sc_number_bad_end', "sc_medium === 'text' && !cargo.textTo", end('sc_number_bad_done', { outcome: 'unresolved', reason: 'no_phone_number' })),
|
|
162
170
|
when('sc_text_four', "sc_medium === 'text'", effect('sc_text_four_set', 'cargo.textTo4 = last4(cargo.textTo, cargo.voice)')),
|
|
163
|
-
// email: the address given, else asked
|
|
171
|
+
// email: the address given, else asked, offering the email on file
|
|
164
172
|
set('sc_to', 'sc_to', "sc_medium === 'email' && sc_email && validateEmail(sc_email) ? sc_email : ''"),
|
|
165
173
|
when('sc_email_clear', "sc_medium === 'email' && !sc_to", effect('sc_email_clear_set', "cargo.email = ''")),
|
|
174
|
+
set('sc_email_q', 'sc_email_q', "!sc_on_file ? 'What email address should I send it to?' : \"I'll email it to \" + emailSaid(sc_on_file, cargo.voice) + (sc_account_email ? ', the email on your account' : '') + (cargo.voice ? '. Press 1 or say OK to send it, or say a different email address.' : '. Type OK to send it, or type a different email address.')"),
|
|
175
|
+
set('sc_email_q_es', 'sc_email_q_es', "!sc_on_file ? '¿A qué correo electrónico se lo envío?' : 'Se lo enviaré a ' + emailSaid(sc_on_file, cargo.voice, true) + (sc_account_email ? ', el correo de su cuenta' : '') + (cargo.voice ? '. Presione 1 o diga OK para enviarlo, o diga otro correo electrónico.' : '. Escriba OK para enviarlo, o escriba otro correo electrónico.')"),
|
|
166
176
|
when('sc_ask_email', "sc_medium === 'email' && !sc_to", call('sc_ask_email_call', 'ask-email', {
|
|
167
|
-
question: '
|
|
168
|
-
question_es: '
|
|
169
|
-
on_file: '{{
|
|
177
|
+
question: '{{sc_email_q}}',
|
|
178
|
+
question_es: '{{sc_email_q_es}}',
|
|
179
|
+
on_file: '{{sc_on_file}}',
|
|
170
180
|
})),
|
|
181
|
+
when('sc_email_heard', "sc_medium === 'email' && !sc_to", set('sc_email_read_back', 'sc_read_back', 'true')),
|
|
171
182
|
when('sc_email_read', "sc_medium === 'email' && !sc_to", set('sc_email_pick', 'sc_to', "cargo.email && validateEmail(String(cargo.email)) ? String(cargo.email) : ''")),
|
|
172
|
-
when('
|
|
173
|
-
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
when('
|
|
181
|
-
when('
|
|
183
|
+
when('sc_email_none', "sc_medium === 'email' && !sc_to", say('sc_email_none_say', "Sorry, I couldn't read that email address, so I didn't send it." + ANYTHING_ELSE, 'Lo siento, no pude entender ese correo electrónico, así que no lo envié.' + ANYTHING_ELSE_ES)),
|
|
184
|
+
when('sc_email_none_end', "sc_medium === 'email' && !sc_to", end('sc_email_none_done', { outcome: 'unresolved', reason: 'no_email' })),
|
|
185
|
+
// a target that is not the caller's own (their phone, the verified cell, the email on file): sent only on YES. An address
|
|
186
|
+
// ask-email just read back has had its YES: only an item with a warning (the web link, the whole conversation, a registered
|
|
187
|
+
// document's disclaimer) is asked about again, saying why
|
|
188
|
+
set('sc_warning', 'sc_warning', "sc_item.kind === 'web_link' ? 'This link opens our conversation, including any account details, for whoever has it. ' : sc_item.kind === 'conversation' ? 'This is our whole conversation, including any account details. ' : sc_item.disclaimer ? String(sc_item.disclaimer) + ' ' : ''"),
|
|
189
|
+
set('sc_warning_es', 'sc_warning_es', "sc_item.kind === 'web_link' ? 'Este enlace abre nuestra conversación, incluidos los datos de su cuenta, para quien lo tenga. ' : sc_item.kind === 'conversation' ? 'Es toda nuestra conversación, incluidos los datos de su cuenta. ' : sc_item.disclaimer ? String(sc_item.disclaimer_es || sc_item.disclaimer) + ' ' : ''"),
|
|
190
|
+
set('sc_ask', 'sc_ask', "!(sc_medium === 'email' ? !!sc_on_file && [sc_on_file, cargo.otp_email].some(function (e) { return String(e || '').trim().toLowerCase() === sc_to.toLowerCase(); }) : [cargo.callerId, cargo.otp_cell_number].map(function (n) { return String(n || '').replace(/\\D/g, '').slice(-10); }).filter(function (n) { return n.length === 10; }).indexOf(String(cargo.textTo || '').replace(/\\D/g, '').slice(-10)) >= 0) && (!sc_read_back || !!sc_warning)"),
|
|
191
|
+
when('sc_target', 'sc_ask', set('sc_target_set', 'sc_target', "sc_medium === 'email' ? sc_to : String(cargo.textTo || '').replace(/\\D/g, '').slice(-10).replace(/^(\\d{3})(\\d{3})(\\d{4})$/, '($1) $2-$3')")),
|
|
192
|
+
when('sc_confirm_q', 'sc_ask', set('sc_confirm_q_set', 'sc_confirm_q', "sc_warning + (sc_read_back ? (sc_account_email ? 'The address you gave is not the email on your account. ' : '') + 'Are you sure you want it sent there? ' : 'Should I send it to ' + sc_target + '? ') + yesNoKeys('en', cargo)")),
|
|
193
|
+
when('sc_confirm_q_es', 'sc_ask', set('sc_confirm_q_es_set', 'sc_confirm_q_es', "sc_warning_es + (sc_read_back ? (sc_account_email ? 'La dirección que me dio no es el correo de su cuenta. ' : '') + '¿Seguro que quiere que se lo envíe ahí? ' : '¿Se lo envío a ' + sc_target + '? ') + yesNoKeys('es', cargo)")),
|
|
194
|
+
when('sc_confirm', 'sc_ask', call('sc_confirm_ask', 'ask-choice', {
|
|
182
195
|
question: '{{sc_confirm_q}}',
|
|
183
196
|
question_es: '{{sc_confirm_q_es}}',
|
|
184
197
|
choices: [{ key: 'yes', phrases: ['1'] }, { key: 'no', phrases: ['2'] }],
|
|
@@ -188,11 +201,11 @@ const sendCopy = defineWorker({
|
|
|
188
201
|
answer_precheck: 'send-copy-destination-answer',
|
|
189
202
|
})),
|
|
190
203
|
// another email address or phone number: SendCopy again with it, so it is read back in its turn
|
|
191
|
-
when('sc_corrected', "
|
|
192
|
-
when('sc_corrected_medium', "
|
|
193
|
-
when('sc_corrected_again', "
|
|
194
|
-
when('sc_confirm_no', "
|
|
195
|
-
when('sc_confirm_no_end', "
|
|
204
|
+
when('sc_corrected', "sc_ask && (cargo.choice === 'email' || cargo.choice === 'text')", set('sc_corrected_set', 'sc_given', `cargo.choice === 'email' ? ${EMAIL_IN_JS}(cargo.choiceText) : readPhone(String(cargo.choiceText || ''))`)),
|
|
205
|
+
when('sc_corrected_medium', "sc_ask && (cargo.choice === 'email' || cargo.choice === 'text')", set('sc_corrected_medium_set', 'sc_medium', 'cargo.choice')),
|
|
206
|
+
when('sc_corrected_again', "sc_ask && !!sc_given && (sc_medium === 'email' || sc_medium === 'text') && (cargo.choice === 'email' || cargo.choice === 'text')", { id: 'sc_corrected_again_flow', type: 'FLOW', value: 'send-copy', callType: 'replace', parameters: { item: '{{sc_item.key}}', medium: '{{sc_medium}}', destination: '{{sc_given}}', no_closing: '{{no_closing}}' } }),
|
|
207
|
+
when('sc_confirm_no', "sc_ask && cargo.choice !== 'yes'", say('sc_confirm_no_say', "Okay, I didn't send it." + ANYTHING_ELSE, 'De acuerdo, no lo envié.' + ANYTHING_ELSE_ES)),
|
|
208
|
+
when('sc_confirm_no_end', "sc_ask && cargo.choice !== 'yes'", end('sc_confirm_no_done', { outcome: 'unresolved', reason: 'declined' })),
|
|
196
209
|
// send: a sender item runs its flow (it tells the caller); content goes as is
|
|
197
210
|
set('sc_subject', 'sc_subject', "sc_item.kind === 'web_link' ? (language === 'es' ? 'Continúe nuestra conversación en la web' : 'Continue our conversation on the web') : language === 'es' ? 'Su copia de nuestra conversación' : sc_item.kind === 'conversation' ? 'Your copy of our conversation' : 'Your copy from our conversation'"),
|
|
198
211
|
when('sc_send_text', "sc_medium === 'text'", call('sc_send_text_call', 'send-text', { message: '{{sc_content}}' })),
|
package/dist/helpers/answer.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export function isOtherRequest(input: any, kind: any): boolean;
|
|
|
34
34
|
* the caller was offered $235.90 (2026-10-14).
|
|
35
35
|
*/
|
|
36
36
|
export function isAmountAnswer(input: any): boolean;
|
|
37
|
+
export function joinDollarPieces(input: any): string;
|
|
37
38
|
/**
|
|
38
39
|
* The amount an answer names, or NaN when it names none or is ambiguous. Prod replay 2026-10-14: the first number in the
|
|
39
40
|
* answer was taken, so "pagar cuenta 50, ciento treinta y cuatro…" paid $50, "$10 con 18 centavos" paid $10.00 and an
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AA0NA;;;GAGG;AACH,wEAkBC;AAED,qHAAqH;AACrH,+CAGC;AAED;;;;GAIG;AACH,mDAIC;AAED;;;;GAIG;AACH,kDAIC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;
|
|
1
|
+
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../src/helpers/answer.js"],"names":[],"mappings":"AA0NA;;;GAGG;AACH,wEAkBC;AAED,qHAAqH;AACrH,+CAGC;AAED;;;;GAIG;AACH,mDAIC;AAED;;;;GAIG;AACH,kDAIC;AAED,+HAA+H;AAC/H,oDAIC;AAcD,2GAA2G;AAC3G,uDAGC;AAOD;;;;;GAKG;AACH,+DAUC;AAKD;;;;GAIG;AACH,oDAEC;AA2BD,qDAA0I;AAE1I;;;;;;GAMG;AACH,mDAAmF;AAEnF,kGAAkG;AAClG;;;EAqCC;AAqBD,oEAqBC;AASD,gJAAgJ;AAChJ,sEAGC;AAED;;;;;;;;;GASG;AACH,6EA4GC;AAED;;;;;GAKG;AACH,uFAeC;;;;;;;;AA5iBD,qCAKwE"}
|
package/dist/helpers/answer.js
CHANGED
|
@@ -355,6 +355,11 @@ const DOLLARS_JOINED_CENTS = /(\$\s*)?(\d+)(\s*(?:dollars?|d[oó]lar(?:es)?|buck
|
|
|
355
355
|
// cinco": "157 95", "$157 95", "1 50" (owner 2026-10-29; prod 10-28 callers re-asked). Never after a decimal or before more
|
|
356
356
|
// digits, and never two-digit dollars: "95 52" is four digits, a card's last four read in pairs.
|
|
357
357
|
const DOLLARS_SPACE_CENTS = /(?<![\d.,])(\$\s*)?(\d|\d{3,})\s+(\d{2})(?![\d.,]|\s*(?:dollars?|d[oó]lar(?:es)?|bucks?|cents?|centavos?)\b)/gi;
|
|
358
|
+
// Dollars said in pieces, as speech-to-text writes "one sixty three" ("1 63") or "one six three" ("1 6 3"), are one number when
|
|
359
|
+
// a dollar word or "and NN cents" follows (prod 2026-12-04 CAb2b7f: "1 63 and 52 cents" was asked again twice). A first digit and
|
|
360
|
+
// then single digits or one pair: "50 100 dollars" stays two numbers (a sub account and an amount).
|
|
361
|
+
const DOLLARS_IN_PIECES = /(?<![\d$.,-]\s*)\d(?:(?:\s+\d)+|\s+\d{2})(?=\s*(?:(?:dollars?|d[oó]lar(?:es)?|bucks?)\b|(?:and|con|y)\s*(?:un\s+)?\d{1,2}\s*(?:cents?|centavos?)\b))/gi;
|
|
362
|
+
export function joinDollarPieces(input) { return String(input ?? '').replace(DOLLARS_IN_PIECES, (digits) => digits.replace(/\s+/g, '')); }
|
|
358
363
|
/**
|
|
359
364
|
* The amount an answer names, or NaN when it names none or is ambiguous. Prod replay 2026-10-14: the first number in the
|
|
360
365
|
* answer was taken, so "pagar cuenta 50, ciento treinta y cuatro…" paid $50, "$10 con 18 centavos" paid $10.00 and an
|
|
@@ -365,7 +370,7 @@ const DOLLARS_SPACE_CENTS = /(?<![\d.,])(\$\s*)?(\d|\d{3,})\s+(\d{2})(?![\d.,]|\
|
|
|
365
370
|
export function amountInAnswer(input) { return numericAmountReading(input).value; }
|
|
366
371
|
/** Internal numeric evidence shared by the opt-in money reader; legacy results stay unchanged. */
|
|
367
372
|
export function numericAmountReading(input) {
|
|
368
|
-
const raw =
|
|
373
|
+
const raw = joinDollarPieces(input);
|
|
369
374
|
// A connector plus cents is a fragment of another amount, not a new standalone payment.
|
|
370
375
|
// A caller can instead explicitly request "51 cents" or provide the complete dollars and cents.
|
|
371
376
|
if (/^\s*(?:and|con|y)\s*(?:un\s+)?\d{1,2}\s*(?:cents?|centavos?)\b/i.test(raw))
|
package/dist/helpers/money.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Opt-in currency grammar. Existing amountInAnswer/isAmountAnswer retain their published 1.6 semantics. */
|
|
2
|
-
import { numericAmountReading } from './answer.js';
|
|
2
|
+
import { joinDollarPieces, numericAmountReading } from './answer.js';
|
|
3
3
|
import { scanSpokenMoney } from './spoken-money.js';
|
|
4
4
|
/** A profile must declare its currency; currently only USD grammar is supported. No exchange-rate inference. */
|
|
5
5
|
export function validateMoneyOptions(options) {
|
|
@@ -26,7 +26,7 @@ function completeMoneyAnswer(input) {
|
|
|
26
26
|
let raw = String(input ?? '').trim().replace(/^[¡!]+|[.!]+$/g, '').trim();
|
|
27
27
|
raw = raw.replace(/^(?:please|por favor)[, ]+/i, '').replace(/[, ]+(?:please|por favor)$/i, '').trim();
|
|
28
28
|
raw = raw.replace(PAYMENT_PREFIX, '').replace(AMOUNT_LABEL_PREFIX, '').replace(AMOUNT_LABEL_SUFFIX, '').replace(ACCOUNT_PREFIX, '').replace(CARD_SUFFIX, '').replace(ACCOUNT_SUFFIX, '').trim();
|
|
29
|
-
if (NUMERIC_MONEY.test(raw))
|
|
29
|
+
if (NUMERIC_MONEY.test(joinDollarPieces(raw)))
|
|
30
30
|
return true;
|
|
31
31
|
const { readings, invalid } = scanSpokenMoney(raw);
|
|
32
32
|
return !invalid.length && readings.length === 1 && readings[0].start === 0 && readings[0].end === raw.length;
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:d4c6ab7e924bce0da918301dfa047d58a3bdc738cddff44a8f766d3f70489754";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.102.
|
|
3
|
+
"version": "1.102.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",
|