jsfe 1.99.0 → 1.101.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/transfer-line-flow.d.ts.map +1 -1
- package/dist/forms/transfer-line-flow.js +10 -6
- package/dist/helpers/index.d.ts +3 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +4 -3
- package/dist/helpers/phone-to-speech.d.ts +2 -0
- package/dist/helpers/phone-to-speech.d.ts.map +1 -0
- package/dist/helpers/phone-to-speech.js +44 -0
- package/dist/runtime-identity.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-line-flow.d.ts","sourceRoot":"","sources":["../../src/forms/transfer-line-flow.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transfer-line-flow.d.ts","sourceRoot":"","sources":["../../src/forms/transfer-line-flow.js"],"names":[],"mappings":"AA6FA,0BAAsC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Available: the caller is asked (unless `confirmed`: they already asked to be connected); YES sets cargo.transferTo = key
|
|
10
10
|
* and ends every flow with the connecting line, and the host ends the call's session and dials the department. NO gives
|
|
11
11
|
* the number.
|
|
12
|
-
* - Not available (closed,
|
|
12
|
+
* - Not available: on a call (closed) it can help but cannot be connected now, its hours and number; not a call, its number and hours.
|
|
13
13
|
* - An unknown key says the team cannot be reached here.
|
|
14
14
|
*/
|
|
15
15
|
import { defineWorker } from './contracts.js';
|
|
@@ -29,7 +29,7 @@ const transferToLine = defineWorker({
|
|
|
29
29
|
contract: { role: 'router', summary: "Offers a warm transfer to one of the tenant's departments by key; gives its number and hours when it cannot transfer" },
|
|
30
30
|
id: 'transfer-to-line',
|
|
31
31
|
name: 'TransferToLine',
|
|
32
|
-
version: '1.
|
|
32
|
+
version: '1.2.0',
|
|
33
33
|
scope: 'isolated',
|
|
34
34
|
description: "Worker: offer to connect the caller with the tenant's department `line` (a key of cargo.transferLines). On a call inside its hours YES sets cargo.transferTo and ends the flows with the connecting line; otherwise, or on NO, its number and hours are given.",
|
|
35
35
|
parameters: [
|
|
@@ -39,7 +39,7 @@ const transferToLine = defineWorker({
|
|
|
39
39
|
{ name: 'confirmed', type: 'boolean', description: 'true when the caller already asked to be connected: no question, the transfer starts' },
|
|
40
40
|
{ name: 'no_closing', type: 'boolean', internal: true, description: 'Internal: true when the calling flow continues the conversation itself, so no closing question is asked.' },
|
|
41
41
|
],
|
|
42
|
-
variables: vars({ noop: false, tl: null, tl_name: '', tl_name_es: '', tl_reach: '', tl_reach_es: '', tl_q: '', tl_q_es: '' }),
|
|
42
|
+
variables: vars({ noop: false, tl: null, tl_name: '', tl_name_es: '', tl_reach: '', tl_reach_es: '', tl_closed: '', tl_closed_es: '', tl_q: '', tl_q_es: '' }),
|
|
43
43
|
steps: [
|
|
44
44
|
set('tl_line', 'tl', "(cargo.transferLines && typeof line === 'string' && cargo.transferLines[line]) || null"),
|
|
45
45
|
when('tl_unknown', '!tl', say('tl_unknown_say', "{{" + LEAD + "}}Sorry, I can't connect you with that team from here." + ANYTHING_ELSE, "{{" + LEAD_ES + "}}Lo siento, no puedo comunicarle con ese equipo desde aquí." + ANYTHING_ELSE_ES)),
|
|
@@ -47,10 +47,14 @@ const transferToLine = defineWorker({
|
|
|
47
47
|
set('tl_name', 'tl_name', "String(tl.name || '')"),
|
|
48
48
|
set('tl_name_es', 'tl_name_es', "String(tl.name_es || tl.name || '')"),
|
|
49
49
|
// how to reach it: the number, then its hours when it has any
|
|
50
|
-
|
|
51
|
-
set('
|
|
50
|
+
// said only when no transfer happens (closed, not a call, NO); on a call in words (phoneToSpeech)
|
|
51
|
+
set('tl_reach', 'tl_reach', "'You can reach ' + tl_name + (tl.phone ? ' at ' + phoneToSpeech(tl.phone, 'en', !!cargo.voice) : '') + (tl.hours ? ', ' + tl.hours : '') + '.'"),
|
|
52
|
+
set('tl_reach_es', 'tl_reach_es', "'Puede comunicarse con ' + tl_name_es + (tl.phone ? ' al ' + phoneToSpeech(tl.phone, 'es', !!cargo.voice) : '') + (tl.hours_es ? ', ' + tl.hours_es : '') + '.'"),
|
|
52
53
|
// not available now (closed, or not a call): the number and hours
|
|
53
|
-
|
|
54
|
+
// a call outside its hours (owner wording 2026-11-29): it can help, it cannot be connected now, its hours, its number
|
|
55
|
+
set('tl_closed_line', 'tl_closed', "tl_name.charAt(0).toUpperCase() + tl_name.slice(1) + ' can help, but I am not able to connect you at this time.' + (tl.hours ? ' Their working hours are ' + tl.hours + (tl.phone ? ', and their direct phone number is ' + phoneToSpeech(tl.phone, 'en', true) : '') + '.' : (tl.phone ? ' Their direct phone number is ' + phoneToSpeech(tl.phone, 'en', true) + '.' : ''))"),
|
|
56
|
+
set('tl_closed_line_es', 'tl_closed_es', "tl_name_es.charAt(0).toUpperCase() + tl_name_es.slice(1) + ' le puede ayudar, pero no puedo comunicarle en este momento.' + (tl.hours_es ? ' Su horario de atención es ' + tl.hours_es + (tl.phone ? ', y su número directo es ' + phoneToSpeech(tl.phone, 'es', true) : '') + '.' : (tl.phone ? ' Su número directo es ' + phoneToSpeech(tl.phone, 'es', true) + '.' : ''))"),
|
|
57
|
+
when('tl_closed_call', "tl.available !== true && cargo.voice", say('tl_closed_call_say', "{{" + LEAD + " + tl_closed}}" + ANYTHING_ELSE, "{{" + LEAD_ES + " + tl_closed_es}}" + ANYTHING_ELSE_ES)),
|
|
54
58
|
when('tl_closed_text', "tl.available !== true && !cargo.voice", say('tl_closed_text_say', "{{" + LEAD + " + tl_reach}}" + ANYTHING_ELSE, "{{" + LEAD_ES + " + tl_reach_es}}" + ANYTHING_ELSE_ES)),
|
|
55
59
|
when('tl_closed_end', 'tl.available !== true', end('tl_closed_done', { outcome: 'resolved', reason: 'transfer_line_number' })),
|
|
56
60
|
// already asked for by the caller: connected without a question
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ export namespace STANDARD_FUNCTIONS {
|
|
|
76
76
|
export { channelVerb };
|
|
77
77
|
export { dateToWords };
|
|
78
78
|
export { amountToSpeech };
|
|
79
|
+
export { phoneToSpeech };
|
|
79
80
|
export { validateCardNumber };
|
|
80
81
|
export { validateExpiration };
|
|
81
82
|
export { consumeActionReceipt };
|
|
@@ -232,6 +233,7 @@ import { yesNoKeys } from './phrases.js';
|
|
|
232
233
|
import { channelVerb } from './phrases.js';
|
|
233
234
|
import { dateToWords } from './date-words.js';
|
|
234
235
|
import { amountToSpeech } from './amount-to-speech.js';
|
|
236
|
+
import { phoneToSpeech } from './phone-to-speech.js';
|
|
235
237
|
import { validateCardNumber } from './card-checks.js';
|
|
236
238
|
import { validateExpiration } from './card-checks.js';
|
|
237
239
|
import { consumeActionReceipt } from './form-actions.js';
|
|
@@ -315,5 +317,5 @@ import { chatTranscript } from './sendables.js';
|
|
|
315
317
|
import { conversationCopy } from './sendables.js';
|
|
316
318
|
import { CONVERSATION_KEY } from './sendables.js';
|
|
317
319
|
import { WEB_LINK_KEY } from './sendables.js';
|
|
318
|
-
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, isReaderFiller, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY, WEB_LINK_KEY };
|
|
320
|
+
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, isReaderFiller, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, phoneToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY, WEB_LINK_KEY };
|
|
319
321
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.js"],"names":[],"mappings":"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"}
|
package/dist/helpers/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFo
|
|
|
10
10
|
/**
|
|
11
11
|
* jsfe/helpers — the functions JSFE's system flows call from expressions, in ONE place for every host: reading an
|
|
12
12
|
* answer (matchesChoice, pickChoice, isAnswer, readEmail, readIdentifier, amountInAnswer, matchInputs …), saying
|
|
13
|
-
* values (amountToSpeech, dateToWords, last4, urlToSpeech …), checking shapes and one-time codes. Pure: no credentials,
|
|
13
|
+
* values (amountToSpeech, phoneToSpeech, dateToWords, last4, urlToSpeech …), checking shapes and one-time codes. Pure: no credentials,
|
|
14
14
|
* no network, no host state beyond the container a caller passes in.
|
|
15
15
|
*
|
|
16
16
|
* The engine does not register them by itself. A host lists them among its approved functions, usually all at once:
|
|
@@ -39,7 +39,8 @@ import { joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone } fr
|
|
|
39
39
|
import { findNumbers, assignNumbers, joinSpokenNumbers } from './numbers.js';
|
|
40
40
|
import { addressDraft } from './address.js';
|
|
41
41
|
import { urlToSpeech, textWithUrlToSpeech } from './url-speech.js';
|
|
42
|
-
|
|
42
|
+
import { phoneToSpeech } from './phone-to-speech.js';
|
|
43
|
+
export { continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse, formProposalPolicy, stageFormProposal, nextFormProposal, formProposalReadings, bindFormProposal, retireStaleFormProposal, decideFormProposal, commitFormProposals, settleFormProposalValidation, formProposalProtocol, validateFormProposalPolicy, validateFormProposalDescriptor, formProposalDescriptor, clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome, readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, saysNoValue, confirmOutOfOrderLine, matchesChoice, ANSWER_WORDS, CONFIRM_WORDS, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, isReaderFiller, readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational, normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, phoneToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance, checkOtp, clearOtp, maskDestination, validateOTP, OTP_EXPIRY_MS, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, spokenDigitsText, wholeSpokenNumber, numberAlone, registerSendable, sendables, chatTranscript, conversationCopy, CONVERSATION_KEY, WEB_LINK_KEY, };
|
|
43
44
|
/** The functions flows call by name, ready to spread into a host's approved functions. */
|
|
44
45
|
export const STANDARD_FUNCTIONS = {
|
|
45
46
|
continuationSafetyProtocol, cancelFormTask, contextualResponseProtocol, validateFormResponse, hasFormResponse,
|
|
@@ -47,7 +48,7 @@ export const STANDARD_FUNCTIONS = {
|
|
|
47
48
|
clearFormMisses, formNoOwner, missFormInput, formMustComplete, formInputPrompt, formUserDescriptionSource, formConcernLine, formAcknowledges, consumeFormFeedback, keepFormLine, deferFormClarification, takeFormClarification, formClarificationKept, clearFormLines, formConversationOutcome,
|
|
48
49
|
readMoneyAmount, isMoneyAmount, moneyIntentAllows, isPastPaymentStatement, isPartialMoneyAnswer, validateMoneyOptions, takeChoiceOffer, saysConfirmWord, confirmOutOfOrderLine, matchesChoice, isAnswer, isAgentRequest, isExitRequest, isGlobalExit, isOtherRequest, isSpelledFragment, isAmountAnswer, amountInAnswer, pickChoice, pickWholeChoice, withoutPromptEcho, isReaderFiller,
|
|
49
50
|
readEmail, emailWithoutEnding, emailEnding, emailSaid, readPhone, readInternationalPhone, readIdentifier, last4, maskEmail, callerTextNumber, textDestination, callerIsInternational,
|
|
50
|
-
normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance,
|
|
51
|
+
normalizeAndFindCapture, anythingElse, goodbye, sayName, sorryNotCaught, yesNoKeys, channelVerb, dateToWords, amountToSpeech, phoneToSpeech, validateCardNumber, validateExpiration, consumeActionReceipt, authorizeFormActionRetry, formSignature, selectFormAction, confirmFormRevision, prepareFormAction, actionConfirmationValid, beginFormAction, finishFormAction, actionGateVerified, sourceNeedsLoad, beginSourceRefresh, completeSourceRefresh, pickProviderQuestion, matchInputs, readFormAnswer, readArgument, groundAmount, joinSpokenNumbers, findNumbers, assignNumbers, addressDraft, readInputProfile, formAcceptanceTrace, resolveFormInputs, formInputApplies, formInputFilled, nextFormInput, formInputChain, openFormInstance, validateFormIncompleteOutcome, formIncompleteOutcome, validateFormExhaustion, exhaustFormInput, formInitialReadings, orderFormReadings, proposedFormValues, applyFormValidation, formReadingDependencies, exclusiveFormReadings, enrichFormMatches, expandFormActivations, settleFormActivations, rememberFormArguments, resetFormInputs, hasFormValue, formPath, formValuesEqual, formReadingReady, formReadingRelevant, formPreparation, queueFormReadings, pendingFormReadings, formWorkLimit, answerResetsFormReplays, rejectFormReadings, invalidateFormInputs, acceptFormReadings, formInstanceApplies, formParentResume, closeFormInstance,
|
|
51
52
|
validateOTP, validateDigits, validatePhone, validateEmail, urlToSpeech, textWithUrlToSpeech, joinSpokenDigits, wholeSpokenNumber, numberAlone,
|
|
52
53
|
registerSendable, sendables, chatTranscript, conversationCopy,
|
|
53
54
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-to-speech.d.ts","sourceRoot":"","sources":["../../src/helpers/phone-to-speech.js"],"names":[],"mappings":"AA6BA,mFAYC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A phone number for a reply (owner 2026-11-29: "1-800-440-0544" was hard to follow on a call). On voice, each group in
|
|
3
|
+
* words, groups separated by commas so the speech engine pauses between them: "one, eight hundred, four four zero, zero
|
|
4
|
+
* five four four" / "uno, ochocientos, cuatro cuatro cero, cero cinco cuatro cuatro". A group that is a whole hundred
|
|
5
|
+
* ("800") is said as one ("eight hundred"), as toll-free numbers are said. Written: "1-800-440-0544" for a North American
|
|
6
|
+
* number, otherwise as given. '' when there are no digits. Pure, part of jsfe/helpers.
|
|
7
|
+
*/
|
|
8
|
+
const DIGITS = {
|
|
9
|
+
en: ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'],
|
|
10
|
+
es: ['cero', 'uno', 'dos', 'tres', 'cuatro', 'cinco', 'seis', 'siete', 'ocho', 'nueve'],
|
|
11
|
+
};
|
|
12
|
+
const HUNDREDS = {
|
|
13
|
+
en: (d) => `${DIGITS.en[d]} hundred`,
|
|
14
|
+
es: (d) => ['', 'cien', 'doscientos', 'trescientos', 'cuatrocientos', 'quinientos', 'seiscientos', 'setecientos', 'ochocientos', 'novecientos'][d],
|
|
15
|
+
};
|
|
16
|
+
function phoneGroups(raw) {
|
|
17
|
+
const digits = raw.replace(/\D/g, '');
|
|
18
|
+
if (digits.length === 11 && digits.startsWith('1')) {
|
|
19
|
+
return [digits.slice(0, 1), digits.slice(1, 4), digits.slice(4, 7), digits.slice(7)];
|
|
20
|
+
}
|
|
21
|
+
else if (digits.length === 10 && !raw.trim().startsWith('+')) {
|
|
22
|
+
return [digits.slice(0, 3), digits.slice(3, 6), digits.slice(6)];
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// as written: its own groups ("+52 55 1234 5678"), else runs of up to four digits
|
|
26
|
+
const written = raw.split(/\D+/).filter(Boolean);
|
|
27
|
+
return written.length > 1 ? written : (digits.match(/\d{1,4}/g) || []);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function phoneToSpeech(phone, language = 'en', voice = true) {
|
|
31
|
+
const raw = String(phone ?? '');
|
|
32
|
+
const groups = phoneGroups(raw);
|
|
33
|
+
if (!groups.length) {
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
else if (!voice) {
|
|
37
|
+
const digits = raw.replace(/\D/g, '');
|
|
38
|
+
return digits.length === 11 && digits.startsWith('1') ? groups.join('-') : digits.length === 10 && !raw.trim().startsWith('+') ? groups.join('-') : raw.trim();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const lang = language === 'es' ? 'es' : 'en';
|
|
42
|
+
return groups.map((g) => (/^[1-9]00$/.test(g) ? HUNDREDS[lang](Number(g[0])) : g.split('').map((d) => DIGITS[lang][Number(d)]).join(' '))).join(', ');
|
|
43
|
+
}
|
|
44
|
+
}
|
package/dist/runtime-identity.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const JSFE_RUNTIME_FINGERPRINT = "sha256:
|
|
1
|
+
export const JSFE_RUNTIME_FINGERPRINT = "sha256:e63269d2d8c3d4fd9f89f8fd037579f19eae751aca01d1c182dc172a847cf815";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsfe",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.101.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",
|