@eshal-bot/chat-widget 0.1.11 → 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.esm.js.map +1 -1
- package/dist/chat-widget.js +189 -63
- package/dist/chat-widget.js.map +1 -1
- 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/chat-widget.umd.js.map +1 -1
- 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,22 +57763,28 @@
|
|
|
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,
|
|
57739
57776
|
left: 0,
|
|
57740
|
-
placement:
|
|
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;
|
|
@@ -57814,12 +57853,12 @@
|
|
|
57814
57853
|
// Try to position above first (preferred)
|
|
57815
57854
|
const spaceAbove = buttonRect.top;
|
|
57816
57855
|
const spaceBelow = window.innerHeight - buttonRect.bottom;
|
|
57817
|
-
let placement =
|
|
57856
|
+
let placement = "top";
|
|
57818
57857
|
let top = 0;
|
|
57819
57858
|
let left = 0;
|
|
57820
57859
|
if (spaceAbove >= tooltipHeight + arrowHeight + spacing) {
|
|
57821
57860
|
// Position above
|
|
57822
|
-
placement =
|
|
57861
|
+
placement = "top";
|
|
57823
57862
|
top = buttonRect.top - tooltipHeight - arrowHeight - spacing;
|
|
57824
57863
|
left = buttonRect.right - tooltipWidth; // Right-align with button
|
|
57825
57864
|
|
|
@@ -57833,7 +57872,7 @@
|
|
|
57833
57872
|
}
|
|
57834
57873
|
} else if (spaceBelow >= tooltipHeight + spacing) {
|
|
57835
57874
|
// Position below as fallback
|
|
57836
|
-
placement =
|
|
57875
|
+
placement = "bottom";
|
|
57837
57876
|
top = buttonRect.bottom + spacing;
|
|
57838
57877
|
left = buttonRect.right - tooltipWidth;
|
|
57839
57878
|
|
|
@@ -57846,7 +57885,7 @@
|
|
|
57846
57885
|
}
|
|
57847
57886
|
} else {
|
|
57848
57887
|
// Not enough space above or below, position above anyway (may be partially visible)
|
|
57849
|
-
placement =
|
|
57888
|
+
placement = "top";
|
|
57850
57889
|
top = Math.max(10, buttonRect.top - tooltipHeight - arrowHeight - spacing);
|
|
57851
57890
|
left = buttonRect.right - tooltipWidth;
|
|
57852
57891
|
if (left < 10) {
|
|
@@ -57896,11 +57935,11 @@
|
|
|
57896
57935
|
const position = calculateTooltipPosition();
|
|
57897
57936
|
setTooltipPosition(position);
|
|
57898
57937
|
};
|
|
57899
|
-
window.addEventListener(
|
|
57900
|
-
window.addEventListener(
|
|
57938
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
57939
|
+
window.addEventListener("resize", updatePosition);
|
|
57901
57940
|
return () => {
|
|
57902
|
-
window.removeEventListener(
|
|
57903
|
-
window.removeEventListener(
|
|
57941
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
57942
|
+
window.removeEventListener("resize", updatePosition);
|
|
57904
57943
|
};
|
|
57905
57944
|
}
|
|
57906
57945
|
}, [showTooltip, tooltipMessage]);
|
|
@@ -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",
|
|
@@ -57959,6 +57998,9 @@
|
|
|
57959
57998
|
onMouseEnter: handleMouseEnter,
|
|
57960
57999
|
onMouseLeave: handleMouseLeave,
|
|
57961
58000
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
58001
|
+
style: {
|
|
58002
|
+
border: "none"
|
|
58003
|
+
},
|
|
57962
58004
|
ref: voiceButtonRef,
|
|
57963
58005
|
type: "button",
|
|
57964
58006
|
onClick: onVoiceToggle,
|
|
@@ -57969,7 +58011,7 @@
|
|
|
57969
58011
|
}) : /*#__PURE__*/jsxRuntimeExports.jsx(AudioLines, {
|
|
57970
58012
|
className: "w-4 h-4"
|
|
57971
58013
|
})
|
|
57972
|
-
}), showTooltip && tooltipMessage && typeof document !==
|
|
58014
|
+
}), showTooltip && tooltipMessage && typeof document !== "undefined" && /*#__PURE__*/reactDomExports.createPortal(/*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
57973
58015
|
ref: tooltipRef,
|
|
57974
58016
|
className: "px-3 py-1.5 text-xs shadow-md pointer-events-none",
|
|
57975
58017
|
style: {
|
|
@@ -57984,14 +58026,14 @@
|
|
|
57984
58026
|
backgroundColor: isDark ? "#1f2937" : "#ffffff",
|
|
57985
58027
|
color: isDark ? "#f3f4f6" : "#111827",
|
|
57986
58028
|
border: isDark ? "1px solid #374151" : "1px solid #e5e7eb",
|
|
57987
|
-
borderRadius: tooltipPosition.placement ===
|
|
58029
|
+
borderRadius: tooltipPosition.placement === "top" ? "6px 6px 6px 6px" : "6px",
|
|
57988
58030
|
boxShadow: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",
|
|
57989
58031
|
overflow: "visible"
|
|
57990
58032
|
},
|
|
57991
58033
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
57992
58034
|
className: "text-left leading-relaxed",
|
|
57993
58035
|
children: tooltipMessage
|
|
57994
|
-
}), tooltipPosition.placement ===
|
|
58036
|
+
}), tooltipPosition.placement === "top" && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
57995
58037
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
57996
58038
|
style: {
|
|
57997
58039
|
position: "absolute",
|
|
@@ -58020,7 +58062,7 @@
|
|
|
58020
58062
|
pointerEvents: "none"
|
|
58021
58063
|
}
|
|
58022
58064
|
})]
|
|
58023
|
-
}), tooltipPosition.placement ===
|
|
58065
|
+
}), tooltipPosition.placement === "bottom" && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
58024
58066
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
58025
58067
|
className: "absolute bottom-full",
|
|
58026
58068
|
style: {
|
|
@@ -58052,7 +58094,8 @@
|
|
|
58052
58094
|
className: "h-10 w-10 rounded-xl transition-all duration-200 flex items-center justify-center shadow-md disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none ".concat(inputValue.trim() ? "scale-100" : "scale-95"),
|
|
58053
58095
|
style: {
|
|
58054
58096
|
backgroundColor: inputValue.trim() ? primaryColor : isDark ? "#374151" : "#e5e7eb",
|
|
58055
|
-
color: inputValue.trim() ? "white" : "#9ca3af"
|
|
58097
|
+
color: inputValue.trim() ? "white" : "#9ca3af",
|
|
58098
|
+
border: "none"
|
|
58056
58099
|
},
|
|
58057
58100
|
"aria-label": "Send message",
|
|
58058
58101
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(Send, {
|
|
@@ -58080,6 +58123,54 @@
|
|
|
58080
58123
|
},
|
|
58081
58124
|
dir: isRtl ? "rtl" : "ltr",
|
|
58082
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
|
+
})]
|
|
58083
58174
|
})]
|
|
58084
58175
|
});
|
|
58085
58176
|
};
|
|
@@ -58192,7 +58283,7 @@
|
|
|
58192
58283
|
textColor
|
|
58193
58284
|
};
|
|
58194
58285
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
58195
|
-
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"),
|
|
58196
58287
|
style: {
|
|
58197
58288
|
background: "linear-gradient(135deg, ".concat(primaryColor, " 0%, ").concat(primaryColor, "dd 100%)"),
|
|
58198
58289
|
fontFamily
|
|
@@ -58356,6 +58447,10 @@
|
|
|
58356
58447
|
assistantTextColor,
|
|
58357
58448
|
userTextColor,
|
|
58358
58449
|
fontFamily = "Inter",
|
|
58450
|
+
agentMessageBubbleFontFamily,
|
|
58451
|
+
agentMessageBubbleFontSize,
|
|
58452
|
+
userMessageBubbleFontFamily,
|
|
58453
|
+
userMessageBubbleFontSize,
|
|
58359
58454
|
fontSize = "14px",
|
|
58360
58455
|
defaultLanguage = "en",
|
|
58361
58456
|
onDecision,
|
|
@@ -58369,6 +58464,7 @@
|
|
|
58369
58464
|
onBidiSubmit,
|
|
58370
58465
|
disclaimerText,
|
|
58371
58466
|
disclaimerPosition = "top",
|
|
58467
|
+
showPoweredBy = true,
|
|
58372
58468
|
apiBaseUrl,
|
|
58373
58469
|
apiKey,
|
|
58374
58470
|
organizationId,
|
|
@@ -58453,6 +58549,10 @@
|
|
|
58453
58549
|
assistantTextColor: assistantTextColor,
|
|
58454
58550
|
userTextColor: userTextColor,
|
|
58455
58551
|
fontFamily: fontFamily,
|
|
58552
|
+
agentMessageBubbleFontFamily: agentMessageBubbleFontFamily,
|
|
58553
|
+
agentMessageBubbleFontSize: agentMessageBubbleFontSize,
|
|
58554
|
+
userMessageBubbleFontFamily: userMessageBubbleFontFamily,
|
|
58555
|
+
userMessageBubbleFontSize: userMessageBubbleFontSize,
|
|
58456
58556
|
fontSize: fontSize,
|
|
58457
58557
|
formatTime: formatTime,
|
|
58458
58558
|
isRtl: isRtlLanguage,
|
|
@@ -58485,6 +58585,8 @@
|
|
|
58485
58585
|
placeholder: placeholder,
|
|
58486
58586
|
textColor: resolvedTextColor,
|
|
58487
58587
|
fontFamily: fontFamily,
|
|
58588
|
+
userMessageBubbleFontFamily: userMessageBubbleFontFamily,
|
|
58589
|
+
userMessageBubbleFontSize: userMessageBubbleFontSize,
|
|
58488
58590
|
fontSize: fontSize,
|
|
58489
58591
|
isRtl: isRtlLanguage,
|
|
58490
58592
|
enableVoiceInteraction: enableVoiceInteraction,
|
|
@@ -58495,6 +58597,7 @@
|
|
|
58495
58597
|
onBidiSubmit: onBidiSubmit,
|
|
58496
58598
|
disclaimerText: disclaimerText,
|
|
58497
58599
|
disclaimerPosition: disclaimerPosition,
|
|
58600
|
+
showPoweredBy: showPoweredBy,
|
|
58498
58601
|
onboardingQuestions: onboardingQuestions,
|
|
58499
58602
|
onboardingActive: onboardingActive,
|
|
58500
58603
|
onboardingCompleted: onboardingCompleted
|
|
@@ -58516,7 +58619,8 @@
|
|
|
58516
58619
|
className: "group relative w-16 h-16 rounded-full shadow-2xl transition-all duration-300 flex items-center justify-center text-white overflow-hidden ".concat(isOpen ? "rotate-0 scale-100" : "hover:scale-110"),
|
|
58517
58620
|
style: {
|
|
58518
58621
|
background: isOpen ? isDark ? "#1f2937" : "#374151" : "linear-gradient(135deg, ".concat(primaryColor, " 0%, ").concat(primaryColor, "dd 100%)"),
|
|
58519
|
-
boxShadow: isOpen ? "0 10px 30px rgba(0,0,0,0.3)" : "0 10px 30px ".concat(primaryColor, "40")
|
|
58622
|
+
boxShadow: isOpen ? "0 10px 30px rgba(0,0,0,0.3)" : "0 10px 30px ".concat(primaryColor, "40"),
|
|
58623
|
+
border: "none"
|
|
58520
58624
|
},
|
|
58521
58625
|
"aria-label": isOpen ? "Close chat" : "Open chat",
|
|
58522
58626
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
@@ -58525,16 +58629,13 @@
|
|
|
58525
58629
|
className: "relative z-10 transition-transform duration-300",
|
|
58526
58630
|
children: isOpen ? /*#__PURE__*/jsxRuntimeExports.jsx(X, {
|
|
58527
58631
|
className: "w-7 h-7"
|
|
58528
|
-
}) : /*#__PURE__*/jsxRuntimeExports.
|
|
58529
|
-
children:
|
|
58632
|
+
}) : /*#__PURE__*/jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
|
|
58633
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(MessageCircle, {
|
|
58530
58634
|
className: "w-7 h-7",
|
|
58531
58635
|
style: {
|
|
58532
58636
|
color: textColor
|
|
58533
58637
|
}
|
|
58534
|
-
})
|
|
58535
|
-
className: "absolute -top-1 -right-1 w-5 h-5 bg-red-500 rounded-full flex items-center justify-center text-[10px] font-bold border-2 border-white animate-pulse",
|
|
58536
|
-
children: "1"
|
|
58537
|
-
})]
|
|
58638
|
+
})
|
|
58538
58639
|
})
|
|
58539
58640
|
})]
|
|
58540
58641
|
});
|
|
@@ -58622,6 +58723,10 @@
|
|
|
58622
58723
|
fontSize,
|
|
58623
58724
|
defaultLanguage,
|
|
58624
58725
|
apiKey,
|
|
58726
|
+
agentMessageBubbleFontFamily,
|
|
58727
|
+
agentMessageBubbleFontSize,
|
|
58728
|
+
userMessageBubbleFontFamily,
|
|
58729
|
+
userMessageBubbleFontSize,
|
|
58625
58730
|
autoOpen = false,
|
|
58626
58731
|
openDelay = 0,
|
|
58627
58732
|
locale,
|
|
@@ -58631,9 +58736,11 @@
|
|
|
58631
58736
|
enableVoiceInteraction,
|
|
58632
58737
|
disclaimerText,
|
|
58633
58738
|
disclaimerPosition,
|
|
58739
|
+
showPoweredBy,
|
|
58634
58740
|
onboardingQuestions,
|
|
58635
58741
|
collectionPrompt,
|
|
58636
|
-
allowedDomains
|
|
58742
|
+
allowedDomains,
|
|
58743
|
+
onboardingEnabled
|
|
58637
58744
|
} = _ref;
|
|
58638
58745
|
const [agentConfig, setAgentConfig] = reactExports.useState(null);
|
|
58639
58746
|
const [isLoadingConfig, setIsLoadingConfig] = reactExports.useState(true);
|
|
@@ -58664,7 +58771,7 @@
|
|
|
58664
58771
|
|
|
58665
58772
|
// Map API response to widget props (use props as overrides if provided)
|
|
58666
58773
|
const widgetConfig = reactExports.useMemo(() => {
|
|
58667
|
-
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;
|
|
58668
58775
|
if (!agentConfig) {
|
|
58669
58776
|
return null;
|
|
58670
58777
|
}
|
|
@@ -58691,12 +58798,18 @@
|
|
|
58691
58798
|
enableVoiceInteraction: (_ref18 = enableVoiceInteraction !== null && enableVoiceInteraction !== void 0 ? enableVoiceInteraction : agentConfig.enableVoiceInteraction) !== null && _ref18 !== void 0 ? _ref18 : false,
|
|
58692
58799
|
disclaimerText: disclaimerText !== null && disclaimerText !== void 0 ? disclaimerText : agentConfig.disclaimerText,
|
|
58693
58800
|
disclaimerPosition: (_ref19 = disclaimerPosition !== null && disclaimerPosition !== void 0 ? disclaimerPosition : agentConfig.disclaimerPosition) !== null && _ref19 !== void 0 ? _ref19 : "top",
|
|
58694
|
-
|
|
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 : [],
|
|
58695
58803
|
collectionPrompt: collectionPrompt !== null && collectionPrompt !== void 0 ? collectionPrompt : agentConfig.collapsiblePrompt,
|
|
58696
58804
|
allowedDomains: finalAllowedDomains,
|
|
58697
|
-
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"
|
|
58698
58811
|
};
|
|
58699
|
-
}, [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]);
|
|
58700
58813
|
|
|
58701
58814
|
// Check if current domain is allowed
|
|
58702
58815
|
const isAllowed = reactExports.useMemo(() => {
|
|
@@ -58718,6 +58831,7 @@
|
|
|
58718
58831
|
darkMode: false,
|
|
58719
58832
|
enableVoiceInteraction: false,
|
|
58720
58833
|
onboardingQuestions: [],
|
|
58834
|
+
onboardingEnabled: false,
|
|
58721
58835
|
collectionPrompt: undefined
|
|
58722
58836
|
}), [apiBaseUrl, apiKey, orgId]);
|
|
58723
58837
|
|
|
@@ -58757,6 +58871,7 @@
|
|
|
58757
58871
|
darkMode: widgetConfig.darkMode,
|
|
58758
58872
|
enableVoiceInteraction: widgetConfig.enableVoiceInteraction,
|
|
58759
58873
|
onboardingQuestions: widgetConfig.onboardingQuestions,
|
|
58874
|
+
onboardingEnabled: widgetConfig.onboardingEnabled,
|
|
58760
58875
|
collectionPrompt: widgetConfig.collectionPrompt
|
|
58761
58876
|
} : defaultConfig);
|
|
58762
58877
|
|
|
@@ -58819,6 +58934,10 @@
|
|
|
58819
58934
|
assistantTextColor: widgetConfig.assistantTextColor,
|
|
58820
58935
|
userTextColor: widgetConfig.userTextColor,
|
|
58821
58936
|
fontFamily: widgetConfig.fontFamily,
|
|
58937
|
+
agentMessageBubbleFontFamily: widgetConfig.agentMessageBubbleFontFamily,
|
|
58938
|
+
agentMessageBubbleFontSize: widgetConfig.agentMessageBubbleFontSize,
|
|
58939
|
+
userMessageBubbleFontFamily: widgetConfig.userMessageBubbleFontFamily,
|
|
58940
|
+
userMessageBubbleFontSize: widgetConfig.userMessageBubbleFontSize,
|
|
58822
58941
|
fontSize: widgetConfig.fontSize,
|
|
58823
58942
|
defaultLanguage: widgetConfig.defaultLanguage || locale,
|
|
58824
58943
|
onDecision: handleDecision,
|
|
@@ -58832,6 +58951,7 @@
|
|
|
58832
58951
|
onBidiSubmit: () => sendBidiTextMessage(inputValue),
|
|
58833
58952
|
disclaimerText: widgetConfig.disclaimerText,
|
|
58834
58953
|
disclaimerPosition: widgetConfig.disclaimerPosition,
|
|
58954
|
+
showPoweredBy: widgetConfig.showPoweredBy,
|
|
58835
58955
|
apiBaseUrl: apiBaseUrl,
|
|
58836
58956
|
apiKey: apiKey,
|
|
58837
58957
|
organizationId: widgetConfig.organizationId,
|
|
@@ -58886,16 +59006,18 @@
|
|
|
58886
59006
|
enableVoiceInteraction: false,
|
|
58887
59007
|
disclaimerText: undefined,
|
|
58888
59008
|
disclaimerPosition: 'top',
|
|
59009
|
+
showPoweredBy: true,
|
|
58889
59010
|
onboardingQuestions: [],
|
|
59011
|
+
onboardingEnabled: false,
|
|
58890
59012
|
collectionPrompt: undefined,
|
|
58891
59013
|
allowedDomains: [],
|
|
58892
59014
|
onOpen: null,
|
|
58893
59015
|
onClose: null
|
|
58894
59016
|
};
|
|
58895
59017
|
const API = {
|
|
58896
|
-
/**
|
|
58897
|
-
* Initialize the chat widget
|
|
58898
|
-
* @param {Object} options - Configuration options
|
|
59018
|
+
/**
|
|
59019
|
+
* Initialize the chat widget
|
|
59020
|
+
* @param {Object} options - Configuration options
|
|
58899
59021
|
*/
|
|
58900
59022
|
init: async function () {
|
|
58901
59023
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -58927,7 +59049,7 @@
|
|
|
58927
59049
|
// Render component
|
|
58928
59050
|
// If orgId and apiBaseUrl are provided, use dynamic config
|
|
58929
59051
|
// Otherwise, use the old static config approach for backward compatibility
|
|
58930
|
-
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({
|
|
58931
59053
|
// Required props
|
|
58932
59054
|
orgId: config.orgId,
|
|
58933
59055
|
apiBaseUrl: config.apiBaseUrl
|
|
@@ -58979,6 +59101,10 @@
|
|
|
58979
59101
|
disclaimerPosition: config.disclaimerPosition
|
|
58980
59102
|
}), options.onboardingQuestions !== undefined && {
|
|
58981
59103
|
onboardingQuestions: config.onboardingQuestions
|
|
59104
|
+
}), options.onboardingEnabled !== undefined && {
|
|
59105
|
+
onboardingEnabled: config.onboardingEnabled
|
|
59106
|
+
}), options.showPoweredBy !== undefined && {
|
|
59107
|
+
showPoweredBy: config.showPoweredBy
|
|
58982
59108
|
}), options.collectionPrompt !== undefined && {
|
|
58983
59109
|
collectionPrompt: config.collectionPrompt
|
|
58984
59110
|
}), options.allowedDomains !== undefined && options.allowedDomains.length > 0 && {
|
|
@@ -59003,17 +59129,17 @@
|
|
|
59003
59129
|
}
|
|
59004
59130
|
return API;
|
|
59005
59131
|
},
|
|
59006
|
-
/**
|
|
59007
|
-
* Update configuration
|
|
59008
|
-
* @param {Object} newConfig - New configuration options
|
|
59132
|
+
/**
|
|
59133
|
+
* Update configuration
|
|
59134
|
+
* @param {Object} newConfig - New configuration options
|
|
59009
59135
|
*/
|
|
59010
59136
|
updateConfig: function (newConfig) {
|
|
59011
59137
|
config = _objectSpread2(_objectSpread2({}, config), newConfig);
|
|
59012
59138
|
this.init(config);
|
|
59013
59139
|
return API;
|
|
59014
59140
|
},
|
|
59015
|
-
/**
|
|
59016
|
-
* Open the chat widget
|
|
59141
|
+
/**
|
|
59142
|
+
* Open the chat widget
|
|
59017
59143
|
*/
|
|
59018
59144
|
open: function () {
|
|
59019
59145
|
// Trigger open by updating config
|
|
@@ -59024,8 +59150,8 @@
|
|
|
59024
59150
|
if (config.onOpen) config.onOpen();
|
|
59025
59151
|
return API;
|
|
59026
59152
|
},
|
|
59027
|
-
/**
|
|
59028
|
-
* Close the chat widget
|
|
59153
|
+
/**
|
|
59154
|
+
* Close the chat widget
|
|
59029
59155
|
*/
|
|
59030
59156
|
close: function () {
|
|
59031
59157
|
this.updateConfig({
|
|
@@ -59034,8 +59160,8 @@
|
|
|
59034
59160
|
if (config.onClose) config.onClose();
|
|
59035
59161
|
return API;
|
|
59036
59162
|
},
|
|
59037
|
-
/**
|
|
59038
|
-
* Toggle dark mode
|
|
59163
|
+
/**
|
|
59164
|
+
* Toggle dark mode
|
|
59039
59165
|
*/
|
|
59040
59166
|
toggleTheme: function () {
|
|
59041
59167
|
config.darkMode = !config.darkMode;
|
|
@@ -59044,8 +59170,8 @@
|
|
|
59044
59170
|
});
|
|
59045
59171
|
return API;
|
|
59046
59172
|
},
|
|
59047
|
-
/**
|
|
59048
|
-
* Destroy the widget
|
|
59173
|
+
/**
|
|
59174
|
+
* Destroy the widget
|
|
59049
59175
|
*/
|
|
59050
59176
|
destroy: function () {
|
|
59051
59177
|
if (root) {
|
|
@@ -59060,8 +59186,8 @@
|
|
|
59060
59186
|
config = {};
|
|
59061
59187
|
return API;
|
|
59062
59188
|
},
|
|
59063
|
-
/**
|
|
59064
|
-
* Get current configuration
|
|
59189
|
+
/**
|
|
59190
|
+
* Get current configuration
|
|
59065
59191
|
*/
|
|
59066
59192
|
getConfig: function () {
|
|
59067
59193
|
return _objectSpread2({}, config);
|