@eshal-bot/chat-widget 0.2.37 → 0.2.38
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/{chat-widget-MarkdownRenderer-NLBiwbCl.esm.js → chat-widget-MarkdownRenderer-DBibTmXG.esm.js} +1 -1
- package/dist/{chat-widget-index-Byr1aRO0.esm.js → chat-widget-index-nFrn-Uh5.esm.js} +3 -3
- package/dist/chat-widget.esm.js +1 -1
- package/dist/chat-widget.js +72 -58
- package/dist/chat-widget.min.js +5 -5
- package/dist/chat-widget.umd.js +2 -2
- package/package.json +1 -1
package/dist/chat-widget.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{S as default}from"./chat-widget-index-
|
|
1
|
+
export{S as default}from"./chat-widget-index-nFrn-Uh5.esm.js";import"react";import"react-dom/client";import"react/jsx-runtime";import"react-dom";
|
package/dist/chat-widget.js
CHANGED
|
@@ -10809,46 +10809,46 @@
|
|
|
10809
10809
|
},
|
|
10810
10810
|
sr: {
|
|
10811
10811
|
agentJoinedConversation: "{name} se pridružio/la razgovoru",
|
|
10812
|
-
connectionError: "
|
|
10813
|
-
micDenied: "
|
|
10814
|
-
micNotFound: "
|
|
10815
|
-
voiceUnavailable: "
|
|
10812
|
+
connectionError: "Izvinite, trenutno imam problema sa povezivanjem. Probajte ponovo.",
|
|
10813
|
+
micDenied: "Nismo mogli da pristupimo vašem mikrofonu. Dozvolite pristup i probajte ponovo.",
|
|
10814
|
+
micNotFound: "Mikrofon nije pronađen. Priključite mikrofon i probajte ponovo.",
|
|
10815
|
+
voiceUnavailable: "Glasovna funkcija trenutno nije dostupna. Probajte ponovo.",
|
|
10816
10816
|
// Topic-picker + quick-questions surface strings. {category} is
|
|
10817
10817
|
// substituted verbatim at the call site and rendered through
|
|
10818
10818
|
// ReactMarkdown - keep the **{category}** bold wrapper.
|
|
10819
|
-
chooseTopicLabel: "
|
|
10820
|
-
categoryTopicsHeading: "
|
|
10821
|
-
quickQuestionsHeadingLabel: "
|
|
10822
|
-
typeYourMessage: "
|
|
10823
|
-
agentIsLoading: "
|
|
10824
|
-
conversationResolved: "
|
|
10825
|
-
howWasYourExperience: "
|
|
10826
|
-
feedbackPrompt: "
|
|
10827
|
-
feedbackPlaceholder: "
|
|
10828
|
-
submitFeedback: "
|
|
10829
|
-
submitting: "
|
|
10830
|
-
selectRatingFirst: "
|
|
10831
|
-
pleaseSubmitRatingFirst: "
|
|
10832
|
-
completeOnboardingToEnableVoice: "
|
|
10833
|
-
sendMessageToCompleteOnboarding: "
|
|
10834
|
-
resolve: "
|
|
10835
|
-
scrollLeft: "
|
|
10836
|
-
scrollRight: "
|
|
10837
|
-
sendMessage: "
|
|
10838
|
-
voiceSessionLive: "
|
|
10839
|
-
connectingVoice: "
|
|
10840
|
-
poweredBy: "
|
|
10841
|
-
menu: "
|
|
10842
|
-
close: "
|
|
10843
|
-
openChat: "
|
|
10844
|
-
closeChat: "
|
|
10845
|
-
lightMode: "
|
|
10846
|
-
nightMode: "
|
|
10847
|
-
refreshChat: "
|
|
10848
|
-
copyChat: "
|
|
10849
|
-
startChat: "
|
|
10850
|
-
startingVoiceSession: "
|
|
10851
|
-
allowMicAccess: "
|
|
10819
|
+
chooseTopicLabel: "Izaberite temu da biste započeli:",
|
|
10820
|
+
categoryTopicsHeading: "Molimo postavite svoje pitanje o **{category}** ispod.",
|
|
10821
|
+
quickQuestionsHeadingLabel: "Ili postavite brzo pitanje:",
|
|
10822
|
+
typeYourMessage: "Ukucajte vašu poruku...",
|
|
10823
|
+
agentIsLoading: "Agent se učitava...",
|
|
10824
|
+
conversationResolved: "Razgovor je završen",
|
|
10825
|
+
howWasYourExperience: "Kakvo je bilo vaše iskustvo?",
|
|
10826
|
+
feedbackPrompt: "Molimo ocenite našu podršku da bismo se poboljšali.",
|
|
10827
|
+
feedbackPlaceholder: "Recite nam više o svom iskustvu...",
|
|
10828
|
+
submitFeedback: "Pošalji povratne informacije",
|
|
10829
|
+
submitting: "Slanje...",
|
|
10830
|
+
selectRatingFirst: "Prvo odaberite ocenu",
|
|
10831
|
+
pleaseSubmitRatingFirst: "Molimo prvo pošaljite ocenu.",
|
|
10832
|
+
completeOnboardingToEnableVoice: "Završite uvod da omogućite glas",
|
|
10833
|
+
sendMessageToCompleteOnboarding: "Pošaljite poruku da završite uvod i omogućite glas.",
|
|
10834
|
+
resolve: "Završi",
|
|
10835
|
+
scrollLeft: "Skrolovati levo",
|
|
10836
|
+
scrollRight: "Skrolovati desno",
|
|
10837
|
+
sendMessage: "Pošalji poruku",
|
|
10838
|
+
voiceSessionLive: "Glasovna sesija aktivna - govorite ili kucajte.",
|
|
10839
|
+
connectingVoice: "Povezivanje sa glasovnom sesijom...",
|
|
10840
|
+
poweredBy: "Pokreće",
|
|
10841
|
+
menu: "Meni",
|
|
10842
|
+
close: "Zatvori",
|
|
10843
|
+
openChat: "Otvori ćaskanje",
|
|
10844
|
+
closeChat: "Zatvori ćaskanje",
|
|
10845
|
+
lightMode: "Svetli režim",
|
|
10846
|
+
nightMode: "Tamni režim",
|
|
10847
|
+
refreshChat: "Osveži ćaskanje",
|
|
10848
|
+
copyChat: "Kopiraj ćaskanje",
|
|
10849
|
+
startChat: "Započni ćaskanje",
|
|
10850
|
+
startingVoiceSession: "Pokretanje glasovne sesije...",
|
|
10851
|
+
allowMicAccess: "Dozvoli pristup mikrofonu"
|
|
10852
10852
|
},
|
|
10853
10853
|
sk: {
|
|
10854
10854
|
connectionError: "Ľutujeme, momentálne mám problém s pripojením. Skúste to znova.",
|
|
@@ -11735,19 +11735,19 @@
|
|
|
11735
11735
|
moreSources: "+{count} ещё"
|
|
11736
11736
|
},
|
|
11737
11737
|
sr: {
|
|
11738
|
-
removeAttachment: "
|
|
11739
|
-
categoryFilter: "
|
|
11740
|
-
filterByCategory: "
|
|
11741
|
-
scrollCategoriesLeft: "
|
|
11742
|
-
scrollCategoriesRight: "
|
|
11743
|
-
scrollTagsLeft: "
|
|
11744
|
-
scrollTagsRight: "
|
|
11745
|
-
copyMessage: "
|
|
11746
|
-
copied: "
|
|
11747
|
-
like: "
|
|
11748
|
-
dislike: "
|
|
11749
|
-
sourcesCited: "
|
|
11750
|
-
moreSources: "+{count}
|
|
11738
|
+
removeAttachment: "Ukloni prilog",
|
|
11739
|
+
categoryFilter: "Filter kategorija",
|
|
11740
|
+
filterByCategory: "Filtriraj po kategoriji",
|
|
11741
|
+
scrollCategoriesLeft: "Skroluj kategorije levo",
|
|
11742
|
+
scrollCategoriesRight: "Skroluj kategorije desno",
|
|
11743
|
+
scrollTagsLeft: "Skroluj oznake levo",
|
|
11744
|
+
scrollTagsRight: "Skroluj oznake desno",
|
|
11745
|
+
copyMessage: "Kopiraj poruku",
|
|
11746
|
+
copied: "Kopirano",
|
|
11747
|
+
like: "Sviđa mi se",
|
|
11748
|
+
dislike: "Ne sviđa mi se",
|
|
11749
|
+
sourcesCited: "Citirani izvori: {count}",
|
|
11750
|
+
moreSources: "+{count} još"
|
|
11751
11751
|
},
|
|
11752
11752
|
sk: {
|
|
11753
11753
|
removeAttachment: "Odstrániť prílohu",
|
|
@@ -12052,9 +12052,9 @@
|
|
|
12052
12052
|
onboardingPhonePlaceholder: "Введите номер телефона"
|
|
12053
12053
|
},
|
|
12054
12054
|
sr: {
|
|
12055
|
-
onboardingNamePlaceholder: "
|
|
12056
|
-
onboardingEmailPlaceholder: "
|
|
12057
|
-
onboardingPhonePlaceholder: "
|
|
12055
|
+
onboardingNamePlaceholder: "Unesite svoje ime",
|
|
12056
|
+
onboardingEmailPlaceholder: "Unesite svoju adresu e-pošte",
|
|
12057
|
+
onboardingPhonePlaceholder: "Unesite svoj broj telefona"
|
|
12058
12058
|
},
|
|
12059
12059
|
sk: {
|
|
12060
12060
|
onboardingNamePlaceholder: "Zadajte svoje meno",
|
|
@@ -13223,6 +13223,10 @@
|
|
|
13223
13223
|
// EV-4552 (19): the org's fallback message from an out-of-credits refusal
|
|
13224
13224
|
// frame, shown to the customer when the socket then closes 1008.
|
|
13225
13225
|
const voiceFallbackRef = reactExports.useRef(null);
|
|
13226
|
+
// EV-4901 (5): the server refused this voice session because the org is out
|
|
13227
|
+
// of AI credits. The org's own message says so, so the generic "voice isn't
|
|
13228
|
+
// available" error must not appear under it.
|
|
13229
|
+
const voiceCreditsExhaustedRef = reactExports.useRef(false);
|
|
13226
13230
|
// EV-4552 (19): show the org's fallback message from an out-of-credits
|
|
13227
13231
|
// refusal in the chat, once. A mid-session refusal already spoke and
|
|
13228
13232
|
// streamed it, so skip it when it is already the last assistant message.
|
|
@@ -15068,7 +15072,8 @@
|
|
|
15068
15072
|
// the text fallback when STT/TTS fails mid-session (e.g. no credits /
|
|
15069
15073
|
// invalid key). Previously the widget ignored it - matching the Testing
|
|
15070
15074
|
// Lab fix. Do NOT return; let the rest of the handler still render text.
|
|
15071
|
-
|
|
15075
|
+
// EV-4901 (5): an out-of-credits refusal is told by the org's message.
|
|
15076
|
+
if (event.error && event.code !== "AI_CREDITS_EXHAUSTED") {
|
|
15072
15077
|
// EV-3813: the backend error text is diagnostic, not customer copy.
|
|
15073
15078
|
console.warn("[BIDI] voice error from backend", event.error);
|
|
15074
15079
|
setVoiceError("voiceUnavailable");
|
|
@@ -15369,6 +15374,7 @@
|
|
|
15369
15374
|
}
|
|
15370
15375
|
setVoiceStatus("connecting");
|
|
15371
15376
|
setVoiceError(null);
|
|
15377
|
+
voiceCreditsExhaustedRef.current = false;
|
|
15372
15378
|
|
|
15373
15379
|
// EV-4119: the voice socket now requires a ticket minted by the backend
|
|
15374
15380
|
// behind verified widget auth. Previously the org id in the URL path WAS
|
|
@@ -15432,6 +15438,9 @@
|
|
|
15432
15438
|
if (payload && payload.code === "AI_CREDITS_EXHAUSTED" && typeof payload.fallbackMessage === "string" && payload.fallbackMessage.trim()) {
|
|
15433
15439
|
voiceFallbackRef.current = payload.fallbackMessage.trim();
|
|
15434
15440
|
}
|
|
15441
|
+
if (payload && payload.code === "AI_CREDITS_EXHAUSTED") {
|
|
15442
|
+
voiceCreditsExhaustedRef.current = true;
|
|
15443
|
+
}
|
|
15435
15444
|
handleBidiEvent(payload);
|
|
15436
15445
|
} catch (error) {
|
|
15437
15446
|
console.error("[BIDI] Failed to parse WebSocket event", {
|
|
@@ -15442,7 +15451,7 @@
|
|
|
15442
15451
|
};
|
|
15443
15452
|
ws.onerror = () => {
|
|
15444
15453
|
setVoiceStatus("error");
|
|
15445
|
-
setVoiceError("voiceUnavailable");
|
|
15454
|
+
if (!voiceCreditsExhaustedRef.current) setVoiceError("voiceUnavailable");
|
|
15446
15455
|
setIsLoading(false);
|
|
15447
15456
|
};
|
|
15448
15457
|
ws.onclose = event => {
|
|
@@ -15466,7 +15475,12 @@
|
|
|
15466
15475
|
isVoiceSessionActiveRef.current = false;
|
|
15467
15476
|
setIsVoiceSessionActive(false);
|
|
15468
15477
|
setVoiceStatus("error");
|
|
15469
|
-
|
|
15478
|
+
// EV-4901 (5): out of credits with the org's message to show, show
|
|
15479
|
+
// only that. Any other refusal, or no message, keeps the generic one.
|
|
15480
|
+
const creditLimit = voiceCreditsExhaustedRef.current || String(event.reason || "").startsWith("AI_CREDITS_EXHAUSTED");
|
|
15481
|
+
if (!creditLimit || !voiceFallbackRef.current) {
|
|
15482
|
+
setVoiceError("voiceUnavailable");
|
|
15483
|
+
}
|
|
15470
15484
|
// EV-4552 (19): show the org's fallback message in the chat, once.
|
|
15471
15485
|
showVoiceFallback();
|
|
15472
15486
|
return;
|
|
@@ -15550,7 +15564,7 @@
|
|
|
15550
15564
|
userHasSpokenRef.current = true;
|
|
15551
15565
|
const ws = websocketRef.current;
|
|
15552
15566
|
if (!ws || ws.readyState !== WebSocket.OPEN) {
|
|
15553
|
-
setVoiceError("voiceUnavailable");
|
|
15567
|
+
if (!voiceCreditsExhaustedRef.current) setVoiceError("voiceUnavailable");
|
|
15554
15568
|
return;
|
|
15555
15569
|
}
|
|
15556
15570
|
ws.send(JSON.stringify({
|
|
@@ -23205,7 +23219,7 @@
|
|
|
23205
23219
|
* value by its own test (that constant sat at 0.1.113 while this package was
|
|
23206
23220
|
* at 0.2.2 precisely because nothing enforced it - EV-2431).
|
|
23207
23221
|
*/
|
|
23208
|
-
const WIDGET_VERSION = '0.2.
|
|
23222
|
+
const WIDGET_VERSION = '0.2.38';
|
|
23209
23223
|
|
|
23210
23224
|
/**
|
|
23211
23225
|
* API utility functions
|