@eshal-bot/chat-widget 0.1.12 → 0.1.13
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.css +2 -2
- package/dist/chat-widget.esm.css +2 -2
- package/dist/chat-widget.esm.js +3 -3
- package/dist/chat-widget.js +166 -42
- package/dist/chat-widget.min.js +5 -5
- package/dist/chat-widget.standalone.css +2 -2
- package/dist/chat-widget.umd.js +3 -3
- package/dist/index.css +2 -2
- package/dist/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/chat-widget.js
CHANGED
|
@@ -1296,6 +1296,7 @@
|
|
|
1296
1296
|
darkMode,
|
|
1297
1297
|
enableVoiceInteraction = false,
|
|
1298
1298
|
onboardingQuestions = [],
|
|
1299
|
+
onboardingEnabled = false,
|
|
1299
1300
|
collectionPrompt
|
|
1300
1301
|
} = _ref2;
|
|
1301
1302
|
const [isOpen, setIsOpen] = reactExports.useState(autoOpen);
|
|
@@ -1694,8 +1695,8 @@
|
|
|
1694
1695
|
return;
|
|
1695
1696
|
}
|
|
1696
1697
|
|
|
1697
|
-
// Case 1: No onboarding questions OR onboarding already completed
|
|
1698
|
-
if (questions.length === 0 || onboardingCompleted) {
|
|
1698
|
+
// Case 1: No onboarding questions OR onboarding already completed OR onboarding disabled
|
|
1699
|
+
if (questions.length === 0 || onboardingCompleted || !onboardingEnabled) {
|
|
1699
1700
|
await sendMessage(trimmedInput);
|
|
1700
1701
|
return;
|
|
1701
1702
|
}
|
|
@@ -1755,8 +1756,8 @@
|
|
|
1755
1756
|
}
|
|
1756
1757
|
const questions = getOnboardingQuestions(onboardingQuestions);
|
|
1757
1758
|
|
|
1758
|
-
// Case 1: No onboarding questions OR onboarding already completed
|
|
1759
|
-
if (questions.length === 0 || onboardingCompleted) {
|
|
1759
|
+
// Case 1: No onboarding questions OR onboarding already completed OR onboarding disabled
|
|
1760
|
+
if (questions.length === 0 || onboardingCompleted || !onboardingEnabled) {
|
|
1760
1761
|
await sendMessage(trimmedQuestion);
|
|
1761
1762
|
return;
|
|
1762
1763
|
}
|
|
@@ -2024,10 +2025,12 @@
|
|
|
2024
2025
|
messageId: currentInputMessageIdRef.current
|
|
2025
2026
|
});
|
|
2026
2027
|
currentInputMessageIdRef.current = null;
|
|
2028
|
+
setIsLoading(true);
|
|
2027
2029
|
}
|
|
2028
2030
|
}, []);
|
|
2029
2031
|
const appendAssistantContent = reactExports.useCallback(function (text) {
|
|
2030
2032
|
let finished = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2033
|
+
setIsLoading(false);
|
|
2031
2034
|
console.log("[BIDI] appendAssistantContent called", {
|
|
2032
2035
|
text: text === null || text === void 0 ? void 0 : text.substring(0, 50),
|
|
2033
2036
|
finished,
|
|
@@ -2302,6 +2305,7 @@
|
|
|
2302
2305
|
}
|
|
2303
2306
|
}, [appendAssistantContent]);
|
|
2304
2307
|
const handleTurnComplete = reactExports.useCallback(() => {
|
|
2308
|
+
setIsLoading(false);
|
|
2305
2309
|
console.log("[BIDI] handleTurnComplete called", {
|
|
2306
2310
|
currentAssistantId: currentAssistantMessageIdRef.current,
|
|
2307
2311
|
currentInputId: currentInputMessageIdRef.current
|
|
@@ -2327,6 +2331,7 @@
|
|
|
2327
2331
|
currentInputMessageIdRef.current = null;
|
|
2328
2332
|
}, []);
|
|
2329
2333
|
const handleInterrupted = reactExports.useCallback(() => {
|
|
2334
|
+
setIsLoading(false);
|
|
2330
2335
|
if (audioPlayerNodeRef.current) {
|
|
2331
2336
|
audioPlayerNodeRef.current.port.postMessage({
|
|
2332
2337
|
command: "endOfAudio"
|
|
@@ -2496,10 +2501,12 @@
|
|
|
2496
2501
|
ws.onerror = () => {
|
|
2497
2502
|
setVoiceStatus("error");
|
|
2498
2503
|
setVoiceError("Voice session connection error");
|
|
2504
|
+
setIsLoading(false);
|
|
2499
2505
|
};
|
|
2500
2506
|
ws.onclose = () => {
|
|
2501
2507
|
websocketRef.current = null;
|
|
2502
2508
|
setVoiceStatus("idle");
|
|
2509
|
+
setIsLoading(false);
|
|
2503
2510
|
if (isVoiceSessionActiveRef.current) {
|
|
2504
2511
|
setTimeout(() => {
|
|
2505
2512
|
connectWebsocket();
|
|
@@ -2557,6 +2564,7 @@
|
|
|
2557
2564
|
const stopVoiceSession = reactExports.useCallback(() => {
|
|
2558
2565
|
var _audioPlayerNodeRef$c, _audioPlayerContextRe, _audioRecorderNodeRef, _audioRecorderContext;
|
|
2559
2566
|
setIsVoiceSessionActive(false);
|
|
2567
|
+
setIsLoading(false);
|
|
2560
2568
|
isVoiceSessionActiveRef.current = false;
|
|
2561
2569
|
setVoiceStatus("idle");
|
|
2562
2570
|
setVoiceError(null);
|
|
@@ -2606,6 +2614,7 @@
|
|
|
2606
2614
|
type: "text",
|
|
2607
2615
|
text: trimmed
|
|
2608
2616
|
}));
|
|
2617
|
+
setIsLoading(true);
|
|
2609
2618
|
const userMessage = createMessage({
|
|
2610
2619
|
id: "bidi-user-".concat(Date.now()),
|
|
2611
2620
|
role: "user",
|
|
@@ -57037,6 +57046,8 @@
|
|
|
57037
57046
|
textColor,
|
|
57038
57047
|
assistantTextColor,
|
|
57039
57048
|
fontFamily,
|
|
57049
|
+
agentMessageBubbleFontFamily,
|
|
57050
|
+
agentMessageBubbleFontSize,
|
|
57040
57051
|
fontSize,
|
|
57041
57052
|
isRtl,
|
|
57042
57053
|
onDecision,
|
|
@@ -57048,8 +57059,8 @@
|
|
|
57048
57059
|
const isTypingMessage = message.isProcessing && (!displayContent || displayContent.length === 0);
|
|
57049
57060
|
const bubbleColor = agentMessageBubbleColor !== undefined && agentMessageBubbleColor !== null ? agentMessageBubbleColor : isDark ? "#1f2937" : "#FFFFFF";
|
|
57050
57061
|
const messageTextColor = assistantTextColor !== undefined && assistantTextColor !== null ? assistantTextColor : textColor !== undefined && textColor !== null ? textColor : isDark ? "#f3f4f6" : "#1A1A1A";
|
|
57051
|
-
const messageFontFamily = fontFamily !== undefined && fontFamily !== null ? fontFamily : "Inter";
|
|
57052
|
-
const messageFontSize = fontSize !== undefined && fontSize !== null ? fontSize : "14px";
|
|
57062
|
+
const messageFontFamily = agentMessageBubbleFontFamily !== undefined && agentMessageBubbleFontFamily !== null ? agentMessageBubbleFontFamily : fontFamily !== undefined && fontFamily !== null ? fontFamily : "Inter";
|
|
57063
|
+
const messageFontSize = agentMessageBubbleFontSize !== undefined && agentMessageBubbleFontSize !== null ? agentMessageBubbleFontSize : fontSize !== undefined && fontSize !== null ? fontSize : "14px";
|
|
57053
57064
|
useGoogleFont(messageFontFamily);
|
|
57054
57065
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
57055
57066
|
className: "flex gap-3 flex-row animate-in",
|
|
@@ -57142,14 +57153,16 @@
|
|
|
57142
57153
|
textColor,
|
|
57143
57154
|
userTextColor,
|
|
57144
57155
|
fontFamily,
|
|
57156
|
+
userMessageBubbleFontFamily,
|
|
57157
|
+
userMessageBubbleFontSize,
|
|
57145
57158
|
fontSize,
|
|
57146
57159
|
isDark,
|
|
57147
57160
|
isRtl
|
|
57148
57161
|
} = _ref16;
|
|
57149
57162
|
const primary = userMessageBoxColor !== undefined && userMessageBoxColor !== null ? userMessageBoxColor : primaryColor !== undefined && primaryColor !== null ? primaryColor : "#2563eb";
|
|
57150
57163
|
const messageTextColor = userTextColor !== undefined && userTextColor !== null ? userTextColor : textColor !== undefined && textColor !== null ? textColor : "#FFFFFF";
|
|
57151
|
-
const messageFontFamily = fontFamily !== undefined && fontFamily !== null ? fontFamily : "Inter";
|
|
57152
|
-
const messageFontSize = fontSize !== undefined && fontSize !== null ? fontSize : "14px";
|
|
57164
|
+
const messageFontFamily = userMessageBubbleFontFamily !== undefined && userMessageBubbleFontFamily !== null ? userMessageBubbleFontFamily : fontFamily !== undefined && fontFamily !== null ? fontFamily : "Inter";
|
|
57165
|
+
const messageFontSize = userMessageBubbleFontSize !== undefined && userMessageBubbleFontSize !== null ? userMessageBubbleFontSize : fontSize !== undefined && fontSize !== null ? fontSize : "14px";
|
|
57153
57166
|
useGoogleFont(messageFontFamily);
|
|
57154
57167
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
57155
57168
|
className: "flex gap-3 flex-row-reverse animate-in",
|
|
@@ -57203,6 +57216,10 @@
|
|
|
57203
57216
|
assistantTextColor,
|
|
57204
57217
|
userTextColor,
|
|
57205
57218
|
fontFamily,
|
|
57219
|
+
agentMessageBubbleFontFamily,
|
|
57220
|
+
agentMessageBubbleFontSize,
|
|
57221
|
+
userMessageBubbleFontFamily,
|
|
57222
|
+
userMessageBubbleFontSize,
|
|
57206
57223
|
fontSize,
|
|
57207
57224
|
formatTime,
|
|
57208
57225
|
isRtl,
|
|
@@ -57223,6 +57240,8 @@
|
|
|
57223
57240
|
textColor: textColor,
|
|
57224
57241
|
userTextColor: userTextColor,
|
|
57225
57242
|
fontFamily: fontFamily,
|
|
57243
|
+
userMessageBubbleFontFamily: userMessageBubbleFontFamily,
|
|
57244
|
+
userMessageBubbleFontSize: userMessageBubbleFontSize,
|
|
57226
57245
|
fontSize: fontSize,
|
|
57227
57246
|
isDark: isDark,
|
|
57228
57247
|
isRtl: isRtl
|
|
@@ -57237,6 +57256,8 @@
|
|
|
57237
57256
|
textColor: textColor,
|
|
57238
57257
|
assistantTextColor: assistantTextColor,
|
|
57239
57258
|
fontFamily: fontFamily,
|
|
57259
|
+
agentMessageBubbleFontFamily: agentMessageBubbleFontFamily,
|
|
57260
|
+
agentMessageBubbleFontSize: agentMessageBubbleFontSize,
|
|
57240
57261
|
fontSize: fontSize,
|
|
57241
57262
|
isRtl: isRtl,
|
|
57242
57263
|
onDecision: onDecision,
|
|
@@ -57551,6 +57572,10 @@
|
|
|
57551
57572
|
assistantTextColor,
|
|
57552
57573
|
userTextColor,
|
|
57553
57574
|
fontFamily,
|
|
57575
|
+
agentMessageBubbleFontFamily,
|
|
57576
|
+
agentMessageBubbleFontSize,
|
|
57577
|
+
userMessageBubbleFontFamily,
|
|
57578
|
+
userMessageBubbleFontSize,
|
|
57554
57579
|
fontSize,
|
|
57555
57580
|
formatTime,
|
|
57556
57581
|
isRtl = false,
|
|
@@ -57651,6 +57676,10 @@
|
|
|
57651
57676
|
assistantTextColor: assistantTextColor,
|
|
57652
57677
|
userTextColor: userTextColor,
|
|
57653
57678
|
fontFamily: fontFamily,
|
|
57679
|
+
agentMessageBubbleFontFamily: agentMessageBubbleFontFamily,
|
|
57680
|
+
agentMessageBubbleFontSize: agentMessageBubbleFontSize,
|
|
57681
|
+
userMessageBubbleFontFamily: userMessageBubbleFontFamily,
|
|
57682
|
+
userMessageBubbleFontSize: userMessageBubbleFontSize,
|
|
57654
57683
|
fontSize: fontSize,
|
|
57655
57684
|
formatTime: formatTime,
|
|
57656
57685
|
isRtl: isRtl,
|
|
@@ -57673,6 +57702,10 @@
|
|
|
57673
57702
|
assistantTextColor: assistantTextColor,
|
|
57674
57703
|
userTextColor: userTextColor,
|
|
57675
57704
|
fontFamily: fontFamily,
|
|
57705
|
+
agentMessageBubbleFontFamily: agentMessageBubbleFontFamily,
|
|
57706
|
+
agentMessageBubbleFontSize: agentMessageBubbleFontSize,
|
|
57707
|
+
userMessageBubbleFontFamily: userMessageBubbleFontFamily,
|
|
57708
|
+
userMessageBubbleFontSize: userMessageBubbleFontSize,
|
|
57676
57709
|
fontSize: fontSize,
|
|
57677
57710
|
formatTime: formatTime,
|
|
57678
57711
|
isRtl: isRtl,
|
|
@@ -57706,6 +57739,7 @@
|
|
|
57706
57739
|
});
|
|
57707
57740
|
};
|
|
57708
57741
|
|
|
57742
|
+
const ESHAL_LOGO_URL = "https://app.eshal.ai/brand/logos/full/logo-full-light.svg";
|
|
57709
57743
|
const ChatInput = _ref => {
|
|
57710
57744
|
let {
|
|
57711
57745
|
inputValue,
|
|
@@ -57729,10 +57763,13 @@
|
|
|
57729
57763
|
onBidiSubmit,
|
|
57730
57764
|
disclaimerText,
|
|
57731
57765
|
disclaimerPosition = "top",
|
|
57766
|
+
showPoweredBy = true,
|
|
57732
57767
|
onboardingQuestions = [],
|
|
57733
57768
|
onboardingActive = false,
|
|
57734
|
-
onboardingCompleted = false
|
|
57769
|
+
onboardingCompleted = false,
|
|
57770
|
+
userMessageBubbleFontFamily
|
|
57735
57771
|
} = _ref;
|
|
57772
|
+
const [isFocused, setIsFocused] = reactExports.useState(false);
|
|
57736
57773
|
const [showTooltip, setShowTooltip] = reactExports.useState(false);
|
|
57737
57774
|
const [tooltipPosition, setTooltipPosition] = reactExports.useState({
|
|
57738
57775
|
top: 0,
|
|
@@ -57740,11 +57777,14 @@
|
|
|
57740
57777
|
placement: "top",
|
|
57741
57778
|
arrowOffset: 0
|
|
57742
57779
|
});
|
|
57780
|
+
const [logoImageLoaded, setLogoImageLoaded] = reactExports.useState(false);
|
|
57781
|
+
const [logoImageError, setLogoImageError] = reactExports.useState(false);
|
|
57743
57782
|
const tooltipTimeoutRef = reactExports.useRef(null);
|
|
57744
57783
|
const textareaRef = reactExports.useRef(null);
|
|
57745
57784
|
const voiceButtonRef = reactExports.useRef(null);
|
|
57746
57785
|
const tooltipRef = reactExports.useRef(null);
|
|
57747
57786
|
useGoogleFont(fontFamily);
|
|
57787
|
+
useGoogleFont(userMessageBubbleFontFamily);
|
|
57748
57788
|
reactExports.useEffect(() => {
|
|
57749
57789
|
if (isOpen && !isMinimized) {
|
|
57750
57790
|
var _textareaRef$current;
|
|
@@ -57780,7 +57820,6 @@
|
|
|
57780
57820
|
setInputValue(event.target.value);
|
|
57781
57821
|
};
|
|
57782
57822
|
const isDisabled = !inputValue.trim() || isLoading;
|
|
57783
|
-
const separatorColor = isDark ? "#374151" : "#e5e7eb";
|
|
57784
57823
|
|
|
57785
57824
|
// Check if onboarding flow exists and is not completed
|
|
57786
57825
|
const hasOnboardingQuestions = onboardingQuestions && onboardingQuestions.length > 0;
|
|
@@ -57912,26 +57951,26 @@
|
|
|
57912
57951
|
};
|
|
57913
57952
|
}, []);
|
|
57914
57953
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
57915
|
-
className: "px-5 py-4
|
|
57954
|
+
className: "px-5 py-4 flex-shrink-0 relative ".concat(isDark ? "bg-gray-900" : "bg-white"),
|
|
57916
57955
|
style: {
|
|
57917
|
-
borderTopColor: separatorColor,
|
|
57918
|
-
borderTopWidth: "1px",
|
|
57919
|
-
borderTopStyle: "solid",
|
|
57920
57956
|
overflow: "visible"
|
|
57921
57957
|
},
|
|
57922
57958
|
children: [/*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
57923
57959
|
className: "flex items-center gap-1.5",
|
|
57924
57960
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
57925
|
-
className: "flex-1 flex items-center min-h-[48px] ".concat(isDark ? "bg-gray-800" : "bg-gray-50", " rounded-2xl
|
|
57961
|
+
className: "flex-1 flex items-center min-h-[48px] ".concat(isDark ? "bg-gray-800" : "bg-gray-50", " rounded-2xl transition-all duration-200"),
|
|
57926
57962
|
style: {
|
|
57927
|
-
|
|
57928
|
-
|
|
57963
|
+
borderStyle: "solid",
|
|
57964
|
+
borderColor: inputValue && inputValue.trim().length > 0 ? primaryColor || "#2563eb" : "transparent",
|
|
57965
|
+
borderWidth: "2px"
|
|
57929
57966
|
},
|
|
57930
57967
|
children: /*#__PURE__*/jsxRuntimeExports.jsx("textarea", {
|
|
57931
57968
|
id: "chat-widget-input",
|
|
57932
57969
|
ref: textareaRef,
|
|
57933
57970
|
value: inputValue,
|
|
57934
57971
|
onChange: handleChange,
|
|
57972
|
+
onFocus: () => setIsFocused(true),
|
|
57973
|
+
onBlur: () => setIsFocused(false),
|
|
57935
57974
|
onKeyDown: handleKeyPress,
|
|
57936
57975
|
placeholder: placeholder || "Type your message...",
|
|
57937
57976
|
rows: 1,
|
|
@@ -57945,8 +57984,8 @@
|
|
|
57945
57984
|
paddingTop: inputValue.trim().length > 0 ? "12px" : "0px",
|
|
57946
57985
|
paddingBottom: inputValue.trim().length > 0 ? "12px" : "0px",
|
|
57947
57986
|
lineHeight: inputValue.trim().length > 0 ? "1.4" : "48px",
|
|
57948
|
-
fontFamily: fontFamily || "Inter",
|
|
57949
|
-
fontSize:
|
|
57987
|
+
fontFamily: userMessageBubbleFontFamily || fontFamily || "Inter",
|
|
57988
|
+
fontSize: "14px",
|
|
57950
57989
|
color: isDark ? "#FFFFFF" : "#000000",
|
|
57951
57990
|
textAlign: isRtl ? "right" : "left",
|
|
57952
57991
|
direction: isRtl ? "rtl" : "ltr",
|
|
@@ -58084,6 +58123,54 @@
|
|
|
58084
58123
|
},
|
|
58085
58124
|
dir: isRtl ? "rtl" : "ltr",
|
|
58086
58125
|
children: disclaimerText
|
|
58126
|
+
}), showPoweredBy && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
58127
|
+
className: "mt-1.5 flex justify-center relative",
|
|
58128
|
+
style: {
|
|
58129
|
+
direction: isRtl ? "rtl" : "ltr",
|
|
58130
|
+
fontFamily: "Inter"
|
|
58131
|
+
},
|
|
58132
|
+
dir: isRtl ? "rtl" : "ltr",
|
|
58133
|
+
children: [!logoImageLoaded && !logoImageError && /*#__PURE__*/jsxRuntimeExports.jsx("img", {
|
|
58134
|
+
src: ESHAL_LOGO_URL,
|
|
58135
|
+
alt: "",
|
|
58136
|
+
"aria-hidden": true,
|
|
58137
|
+
className: "absolute opacity-0 pointer-events-none",
|
|
58138
|
+
style: {
|
|
58139
|
+
width: 0,
|
|
58140
|
+
height: 0
|
|
58141
|
+
},
|
|
58142
|
+
onLoad: () => setLogoImageLoaded(true),
|
|
58143
|
+
onError: () => setLogoImageError(true)
|
|
58144
|
+
}), (logoImageLoaded || logoImageError) && /*#__PURE__*/jsxRuntimeExports.jsxs("span", {
|
|
58145
|
+
className: "inline-flex items-center gap-1.5 rounded-lg py-2 px-3",
|
|
58146
|
+
style: {
|
|
58147
|
+
backgroundColor: "#000000"
|
|
58148
|
+
},
|
|
58149
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
58150
|
+
style: {
|
|
58151
|
+
color: "#ffffff",
|
|
58152
|
+
fontFamily: "Inter",
|
|
58153
|
+
fontSize: "12px",
|
|
58154
|
+
fontWeight: 500
|
|
58155
|
+
},
|
|
58156
|
+
children: "Powered by"
|
|
58157
|
+
}), logoImageError ? /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
58158
|
+
style: {
|
|
58159
|
+
color: "#ffffff",
|
|
58160
|
+
fontFamily: "Inter",
|
|
58161
|
+
fontSize: "12px",
|
|
58162
|
+
fontWeight: 500
|
|
58163
|
+
},
|
|
58164
|
+
children: "ESHAL"
|
|
58165
|
+
}) : /*#__PURE__*/jsxRuntimeExports.jsx("img", {
|
|
58166
|
+
src: ESHAL_LOGO_URL,
|
|
58167
|
+
alt: "ESHAL",
|
|
58168
|
+
className: "h-3.5 w-auto",
|
|
58169
|
+
style: {
|
|
58170
|
+
filter: "brightness(0) invert(1)"
|
|
58171
|
+
}
|
|
58172
|
+
})]
|
|
58173
|
+
})]
|
|
58087
58174
|
})]
|
|
58088
58175
|
});
|
|
58089
58176
|
};
|
|
@@ -58196,7 +58283,7 @@
|
|
|
58196
58283
|
textColor
|
|
58197
58284
|
};
|
|
58198
58285
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
58199
|
-
className: "text-white ".concat(isMinimized ? "px-4 py-2.5" : "px-
|
|
58286
|
+
className: "text-white ".concat(isMinimized ? "px-4 py-2.5" : "px-2 py-4", " flex items-center justify-between relative overflow-hidden rounded-t-2xl"),
|
|
58200
58287
|
style: {
|
|
58201
58288
|
background: "linear-gradient(135deg, ".concat(primaryColor, " 0%, ").concat(primaryColor, "dd 100%)"),
|
|
58202
58289
|
fontFamily
|
|
@@ -58360,6 +58447,10 @@
|
|
|
58360
58447
|
assistantTextColor,
|
|
58361
58448
|
userTextColor,
|
|
58362
58449
|
fontFamily = "Inter",
|
|
58450
|
+
agentMessageBubbleFontFamily,
|
|
58451
|
+
agentMessageBubbleFontSize,
|
|
58452
|
+
userMessageBubbleFontFamily,
|
|
58453
|
+
userMessageBubbleFontSize,
|
|
58363
58454
|
fontSize = "14px",
|
|
58364
58455
|
defaultLanguage = "en",
|
|
58365
58456
|
onDecision,
|
|
@@ -58373,6 +58464,7 @@
|
|
|
58373
58464
|
onBidiSubmit,
|
|
58374
58465
|
disclaimerText,
|
|
58375
58466
|
disclaimerPosition = "top",
|
|
58467
|
+
showPoweredBy = true,
|
|
58376
58468
|
apiBaseUrl,
|
|
58377
58469
|
apiKey,
|
|
58378
58470
|
organizationId,
|
|
@@ -58457,6 +58549,10 @@
|
|
|
58457
58549
|
assistantTextColor: assistantTextColor,
|
|
58458
58550
|
userTextColor: userTextColor,
|
|
58459
58551
|
fontFamily: fontFamily,
|
|
58552
|
+
agentMessageBubbleFontFamily: agentMessageBubbleFontFamily,
|
|
58553
|
+
agentMessageBubbleFontSize: agentMessageBubbleFontSize,
|
|
58554
|
+
userMessageBubbleFontFamily: userMessageBubbleFontFamily,
|
|
58555
|
+
userMessageBubbleFontSize: userMessageBubbleFontSize,
|
|
58460
58556
|
fontSize: fontSize,
|
|
58461
58557
|
formatTime: formatTime,
|
|
58462
58558
|
isRtl: isRtlLanguage,
|
|
@@ -58489,6 +58585,8 @@
|
|
|
58489
58585
|
placeholder: placeholder,
|
|
58490
58586
|
textColor: resolvedTextColor,
|
|
58491
58587
|
fontFamily: fontFamily,
|
|
58588
|
+
userMessageBubbleFontFamily: userMessageBubbleFontFamily,
|
|
58589
|
+
userMessageBubbleFontSize: userMessageBubbleFontSize,
|
|
58492
58590
|
fontSize: fontSize,
|
|
58493
58591
|
isRtl: isRtlLanguage,
|
|
58494
58592
|
enableVoiceInteraction: enableVoiceInteraction,
|
|
@@ -58499,6 +58597,7 @@
|
|
|
58499
58597
|
onBidiSubmit: onBidiSubmit,
|
|
58500
58598
|
disclaimerText: disclaimerText,
|
|
58501
58599
|
disclaimerPosition: disclaimerPosition,
|
|
58600
|
+
showPoweredBy: showPoweredBy,
|
|
58502
58601
|
onboardingQuestions: onboardingQuestions,
|
|
58503
58602
|
onboardingActive: onboardingActive,
|
|
58504
58603
|
onboardingCompleted: onboardingCompleted
|
|
@@ -58624,6 +58723,10 @@
|
|
|
58624
58723
|
fontSize,
|
|
58625
58724
|
defaultLanguage,
|
|
58626
58725
|
apiKey,
|
|
58726
|
+
agentMessageBubbleFontFamily,
|
|
58727
|
+
agentMessageBubbleFontSize,
|
|
58728
|
+
userMessageBubbleFontFamily,
|
|
58729
|
+
userMessageBubbleFontSize,
|
|
58627
58730
|
autoOpen = false,
|
|
58628
58731
|
openDelay = 0,
|
|
58629
58732
|
locale,
|
|
@@ -58633,9 +58736,11 @@
|
|
|
58633
58736
|
enableVoiceInteraction,
|
|
58634
58737
|
disclaimerText,
|
|
58635
58738
|
disclaimerPosition,
|
|
58739
|
+
showPoweredBy,
|
|
58636
58740
|
onboardingQuestions,
|
|
58637
58741
|
collectionPrompt,
|
|
58638
|
-
allowedDomains
|
|
58742
|
+
allowedDomains,
|
|
58743
|
+
onboardingEnabled
|
|
58639
58744
|
} = _ref;
|
|
58640
58745
|
const [agentConfig, setAgentConfig] = reactExports.useState(null);
|
|
58641
58746
|
const [isLoadingConfig, setIsLoadingConfig] = reactExports.useState(true);
|
|
@@ -58666,7 +58771,7 @@
|
|
|
58666
58771
|
|
|
58667
58772
|
// Map API response to widget props (use props as overrides if provided)
|
|
58668
58773
|
const widgetConfig = reactExports.useMemo(() => {
|
|
58669
|
-
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21;
|
|
58774
|
+
var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31, _ref32, _ref33, _ref34, _ref35;
|
|
58670
58775
|
if (!agentConfig) {
|
|
58671
58776
|
return null;
|
|
58672
58777
|
}
|
|
@@ -58693,12 +58798,18 @@
|
|
|
58693
58798
|
enableVoiceInteraction: (_ref18 = enableVoiceInteraction !== null && enableVoiceInteraction !== void 0 ? enableVoiceInteraction : agentConfig.enableVoiceInteraction) !== null && _ref18 !== void 0 ? _ref18 : false,
|
|
58694
58799
|
disclaimerText: disclaimerText !== null && disclaimerText !== void 0 ? disclaimerText : agentConfig.disclaimerText,
|
|
58695
58800
|
disclaimerPosition: (_ref19 = disclaimerPosition !== null && disclaimerPosition !== void 0 ? disclaimerPosition : agentConfig.disclaimerPosition) !== null && _ref19 !== void 0 ? _ref19 : "top",
|
|
58696
|
-
|
|
58801
|
+
showPoweredBy: (_ref20 = showPoweredBy !== null && showPoweredBy !== void 0 ? showPoweredBy : agentConfig.showPoweredBy) !== null && _ref20 !== void 0 ? _ref20 : true,
|
|
58802
|
+
onboardingQuestions: (_ref21 = onboardingQuestions !== null && onboardingQuestions !== void 0 ? onboardingQuestions : agentConfig.onboardingQuestions) !== null && _ref21 !== void 0 ? _ref21 : [],
|
|
58697
58803
|
collectionPrompt: collectionPrompt !== null && collectionPrompt !== void 0 ? collectionPrompt : agentConfig.collapsiblePrompt,
|
|
58698
58804
|
allowedDomains: finalAllowedDomains,
|
|
58699
|
-
launcherPosition: (
|
|
58805
|
+
launcherPosition: (_ref22 = position !== null && position !== void 0 ? position : agentConfig.launcherPosition) !== null && _ref22 !== void 0 ? _ref22 : "bottom-right",
|
|
58806
|
+
onboardingEnabled: (_ref23 = onboardingEnabled !== null && onboardingEnabled !== void 0 ? onboardingEnabled : agentConfig.onboardingEnabled) !== null && _ref23 !== void 0 ? _ref23 : false,
|
|
58807
|
+
agentMessageBubbleFontFamily: (_ref24 = (_ref25 = (_ref26 = agentMessageBubbleFontFamily !== null && agentMessageBubbleFontFamily !== void 0 ? agentMessageBubbleFontFamily : agentConfig.agentMessageBubbleFontFamily) !== null && _ref26 !== void 0 ? _ref26 : fontFamily) !== null && _ref25 !== void 0 ? _ref25 : agentConfig.fontFamily) !== null && _ref24 !== void 0 ? _ref24 : "Inter",
|
|
58808
|
+
agentMessageBubbleFontSize: (_ref27 = (_ref28 = (_ref29 = agentMessageBubbleFontSize !== null && agentMessageBubbleFontSize !== void 0 ? agentMessageBubbleFontSize : agentConfig.agentMessageBubbleFontSize) !== null && _ref29 !== void 0 ? _ref29 : fontSize) !== null && _ref28 !== void 0 ? _ref28 : agentConfig.fontSize) !== null && _ref27 !== void 0 ? _ref27 : "14px",
|
|
58809
|
+
userMessageBubbleFontFamily: (_ref30 = (_ref31 = (_ref32 = userMessageBubbleFontFamily !== null && userMessageBubbleFontFamily !== void 0 ? userMessageBubbleFontFamily : agentConfig.userMessageBubbleFontFamily) !== null && _ref32 !== void 0 ? _ref32 : fontFamily) !== null && _ref31 !== void 0 ? _ref31 : agentConfig.fontFamily) !== null && _ref30 !== void 0 ? _ref30 : "Inter",
|
|
58810
|
+
userMessageBubbleFontSize: (_ref33 = (_ref34 = (_ref35 = userMessageBubbleFontSize !== null && userMessageBubbleFontSize !== void 0 ? userMessageBubbleFontSize : agentConfig.userMessageBubbleFontSize) !== null && _ref35 !== void 0 ? _ref35 : fontSize) !== null && _ref34 !== void 0 ? _ref34 : agentConfig.fontSize) !== null && _ref33 !== void 0 ? _ref33 : "14px"
|
|
58700
58811
|
};
|
|
58701
|
-
}, [agentConfig, darkMode, primaryColor, position, companyName, conciergeName, companyLogo, welcomeMessage, quickQuestions, textColor, agentMessageBubbleColor, userMessageBoxColor, assistantTextColor, userTextColor, fontFamily, fontSize, defaultLanguage, orgId, headerTextBold, headerTextItalic, enableVoiceInteraction, disclaimerText, disclaimerPosition, onboardingQuestions, collectionPrompt, allowedDomains]);
|
|
58812
|
+
}, [agentConfig, darkMode, primaryColor, position, companyName, conciergeName, companyLogo, welcomeMessage, quickQuestions, textColor, agentMessageBubbleColor, userMessageBoxColor, assistantTextColor, userTextColor, fontFamily, fontSize, defaultLanguage, orgId, headerTextBold, headerTextItalic, enableVoiceInteraction, disclaimerText, disclaimerPosition, showPoweredBy, onboardingQuestions, onboardingEnabled, collectionPrompt, allowedDomains, agentMessageBubbleFontFamily, agentMessageBubbleFontSize, userMessageBubbleFontFamily, userMessageBubbleFontSize]);
|
|
58702
58813
|
|
|
58703
58814
|
// Check if current domain is allowed
|
|
58704
58815
|
const isAllowed = reactExports.useMemo(() => {
|
|
@@ -58720,6 +58831,7 @@
|
|
|
58720
58831
|
darkMode: false,
|
|
58721
58832
|
enableVoiceInteraction: false,
|
|
58722
58833
|
onboardingQuestions: [],
|
|
58834
|
+
onboardingEnabled: false,
|
|
58723
58835
|
collectionPrompt: undefined
|
|
58724
58836
|
}), [apiBaseUrl, apiKey, orgId]);
|
|
58725
58837
|
|
|
@@ -58759,6 +58871,7 @@
|
|
|
58759
58871
|
darkMode: widgetConfig.darkMode,
|
|
58760
58872
|
enableVoiceInteraction: widgetConfig.enableVoiceInteraction,
|
|
58761
58873
|
onboardingQuestions: widgetConfig.onboardingQuestions,
|
|
58874
|
+
onboardingEnabled: widgetConfig.onboardingEnabled,
|
|
58762
58875
|
collectionPrompt: widgetConfig.collectionPrompt
|
|
58763
58876
|
} : defaultConfig);
|
|
58764
58877
|
|
|
@@ -58821,6 +58934,10 @@
|
|
|
58821
58934
|
assistantTextColor: widgetConfig.assistantTextColor,
|
|
58822
58935
|
userTextColor: widgetConfig.userTextColor,
|
|
58823
58936
|
fontFamily: widgetConfig.fontFamily,
|
|
58937
|
+
agentMessageBubbleFontFamily: widgetConfig.agentMessageBubbleFontFamily,
|
|
58938
|
+
agentMessageBubbleFontSize: widgetConfig.agentMessageBubbleFontSize,
|
|
58939
|
+
userMessageBubbleFontFamily: widgetConfig.userMessageBubbleFontFamily,
|
|
58940
|
+
userMessageBubbleFontSize: widgetConfig.userMessageBubbleFontSize,
|
|
58824
58941
|
fontSize: widgetConfig.fontSize,
|
|
58825
58942
|
defaultLanguage: widgetConfig.defaultLanguage || locale,
|
|
58826
58943
|
onDecision: handleDecision,
|
|
@@ -58834,6 +58951,7 @@
|
|
|
58834
58951
|
onBidiSubmit: () => sendBidiTextMessage(inputValue),
|
|
58835
58952
|
disclaimerText: widgetConfig.disclaimerText,
|
|
58836
58953
|
disclaimerPosition: widgetConfig.disclaimerPosition,
|
|
58954
|
+
showPoweredBy: widgetConfig.showPoweredBy,
|
|
58837
58955
|
apiBaseUrl: apiBaseUrl,
|
|
58838
58956
|
apiKey: apiKey,
|
|
58839
58957
|
organizationId: widgetConfig.organizationId,
|
|
@@ -58888,16 +59006,18 @@
|
|
|
58888
59006
|
enableVoiceInteraction: false,
|
|
58889
59007
|
disclaimerText: undefined,
|
|
58890
59008
|
disclaimerPosition: 'top',
|
|
59009
|
+
showPoweredBy: true,
|
|
58891
59010
|
onboardingQuestions: [],
|
|
59011
|
+
onboardingEnabled: false,
|
|
58892
59012
|
collectionPrompt: undefined,
|
|
58893
59013
|
allowedDomains: [],
|
|
58894
59014
|
onOpen: null,
|
|
58895
59015
|
onClose: null
|
|
58896
59016
|
};
|
|
58897
59017
|
const API = {
|
|
58898
|
-
/**
|
|
58899
|
-
* Initialize the chat widget
|
|
58900
|
-
* @param {Object} options - Configuration options
|
|
59018
|
+
/**
|
|
59019
|
+
* Initialize the chat widget
|
|
59020
|
+
* @param {Object} options - Configuration options
|
|
58901
59021
|
*/
|
|
58902
59022
|
init: async function () {
|
|
58903
59023
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -58929,7 +59049,7 @@
|
|
|
58929
59049
|
// Render component
|
|
58930
59050
|
// If orgId and apiBaseUrl are provided, use dynamic config
|
|
58931
59051
|
// Otherwise, use the old static config approach for backward compatibility
|
|
58932
|
-
const widgetProps = config.orgId && config.apiBaseUrl ? _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
59052
|
+
const widgetProps = config.orgId && config.apiBaseUrl ? _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
|
|
58933
59053
|
// Required props
|
|
58934
59054
|
orgId: config.orgId,
|
|
58935
59055
|
apiBaseUrl: config.apiBaseUrl
|
|
@@ -58981,6 +59101,10 @@
|
|
|
58981
59101
|
disclaimerPosition: config.disclaimerPosition
|
|
58982
59102
|
}), options.onboardingQuestions !== undefined && {
|
|
58983
59103
|
onboardingQuestions: config.onboardingQuestions
|
|
59104
|
+
}), options.onboardingEnabled !== undefined && {
|
|
59105
|
+
onboardingEnabled: config.onboardingEnabled
|
|
59106
|
+
}), options.showPoweredBy !== undefined && {
|
|
59107
|
+
showPoweredBy: config.showPoweredBy
|
|
58984
59108
|
}), options.collectionPrompt !== undefined && {
|
|
58985
59109
|
collectionPrompt: config.collectionPrompt
|
|
58986
59110
|
}), options.allowedDomains !== undefined && options.allowedDomains.length > 0 && {
|
|
@@ -59005,17 +59129,17 @@
|
|
|
59005
59129
|
}
|
|
59006
59130
|
return API;
|
|
59007
59131
|
},
|
|
59008
|
-
/**
|
|
59009
|
-
* Update configuration
|
|
59010
|
-
* @param {Object} newConfig - New configuration options
|
|
59132
|
+
/**
|
|
59133
|
+
* Update configuration
|
|
59134
|
+
* @param {Object} newConfig - New configuration options
|
|
59011
59135
|
*/
|
|
59012
59136
|
updateConfig: function (newConfig) {
|
|
59013
59137
|
config = _objectSpread2(_objectSpread2({}, config), newConfig);
|
|
59014
59138
|
this.init(config);
|
|
59015
59139
|
return API;
|
|
59016
59140
|
},
|
|
59017
|
-
/**
|
|
59018
|
-
* Open the chat widget
|
|
59141
|
+
/**
|
|
59142
|
+
* Open the chat widget
|
|
59019
59143
|
*/
|
|
59020
59144
|
open: function () {
|
|
59021
59145
|
// Trigger open by updating config
|
|
@@ -59026,8 +59150,8 @@
|
|
|
59026
59150
|
if (config.onOpen) config.onOpen();
|
|
59027
59151
|
return API;
|
|
59028
59152
|
},
|
|
59029
|
-
/**
|
|
59030
|
-
* Close the chat widget
|
|
59153
|
+
/**
|
|
59154
|
+
* Close the chat widget
|
|
59031
59155
|
*/
|
|
59032
59156
|
close: function () {
|
|
59033
59157
|
this.updateConfig({
|
|
@@ -59036,8 +59160,8 @@
|
|
|
59036
59160
|
if (config.onClose) config.onClose();
|
|
59037
59161
|
return API;
|
|
59038
59162
|
},
|
|
59039
|
-
/**
|
|
59040
|
-
* Toggle dark mode
|
|
59163
|
+
/**
|
|
59164
|
+
* Toggle dark mode
|
|
59041
59165
|
*/
|
|
59042
59166
|
toggleTheme: function () {
|
|
59043
59167
|
config.darkMode = !config.darkMode;
|
|
@@ -59046,8 +59170,8 @@
|
|
|
59046
59170
|
});
|
|
59047
59171
|
return API;
|
|
59048
59172
|
},
|
|
59049
|
-
/**
|
|
59050
|
-
* Destroy the widget
|
|
59173
|
+
/**
|
|
59174
|
+
* Destroy the widget
|
|
59051
59175
|
*/
|
|
59052
59176
|
destroy: function () {
|
|
59053
59177
|
if (root) {
|
|
@@ -59062,8 +59186,8 @@
|
|
|
59062
59186
|
config = {};
|
|
59063
59187
|
return API;
|
|
59064
59188
|
},
|
|
59065
|
-
/**
|
|
59066
|
-
* Get current configuration
|
|
59189
|
+
/**
|
|
59190
|
+
* Get current configuration
|
|
59067
59191
|
*/
|
|
59068
59192
|
getConfig: function () {
|
|
59069
59193
|
return _objectSpread2({}, config);
|