@eshal-bot/chat-widget 0.1.42 → 0.1.43
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.esm.js +2 -2
- package/dist/chat-widget.js +31 -5
- package/dist/chat-widget.min.js +2 -2
- package/dist/chat-widget.umd.js +3 -3
- package/package.json +1 -1
package/dist/chat-widget.js
CHANGED
|
@@ -8935,6 +8935,11 @@
|
|
|
8935
8935
|
openDelay,
|
|
8936
8936
|
darkMode,
|
|
8937
8937
|
enableVoiceInteraction = false,
|
|
8938
|
+
// behavior.provideCitations — forwarded as enable_citation on the chat
|
|
8939
|
+
// request so the backend skips citation generation when disabled. The
|
|
8940
|
+
// Sources render is also gated in MessageBubble (defence-in-depth, same
|
|
8941
|
+
// as the dashboard testing lab). Defaults to true.
|
|
8942
|
+
provideCitations = true,
|
|
8938
8943
|
onboardingQuestions = [],
|
|
8939
8944
|
onboardingEnabled = false,
|
|
8940
8945
|
collectionPrompt,
|
|
@@ -9458,6 +9463,11 @@
|
|
|
9458
9463
|
message: trimmed,
|
|
9459
9464
|
type: apiType,
|
|
9460
9465
|
conversationId: bidiSessionId,
|
|
9466
|
+
// Citation toggle (behavior.provideCitations). Mirrors the testing
|
|
9467
|
+
// lab's useChat.ts so knowledge-api skips citation generation when
|
|
9468
|
+
// the admin disabled them. The Sources panel is also gated client-
|
|
9469
|
+
// side in MessageBubble (defence-in-depth). Defaults to on.
|
|
9470
|
+
enable_citation: provideCitations !== null && provideCitations !== void 0 ? provideCitations : true,
|
|
9461
9471
|
// Identify this as a widget call so the knowledge-api side
|
|
9462
9472
|
// (chat_utils.EXTERNAL_CHAT_CHANNELS in services/
|
|
9463
9473
|
// knowledge-api) can enforce the visibility ACL — private
|
|
@@ -9562,7 +9572,7 @@
|
|
|
9562
9572
|
setIsLoading(false);
|
|
9563
9573
|
}
|
|
9564
9574
|
}
|
|
9565
|
-
}, [apiBaseUrl, apiKey, getNextMessageId, organizationId, messages, bidiSessionId, routingChoice, widgetFilter]);
|
|
9575
|
+
}, [apiBaseUrl, apiKey, getNextMessageId, organizationId, messages, bidiSessionId, routingChoice, widgetFilter, provideCitations]);
|
|
9566
9576
|
const handleOnboardingFormSubmit = reactExports.useCallback(async answers => {
|
|
9567
9577
|
const questions = getOnboardingQuestions(onboardingQuestions);
|
|
9568
9578
|
if (questions.length === 0) return;
|
|
@@ -54632,6 +54642,7 @@
|
|
|
54632
54642
|
organizationId,
|
|
54633
54643
|
onPromptSuggestionClick,
|
|
54634
54644
|
allowFeedback = true,
|
|
54645
|
+
provideCitations = true,
|
|
54635
54646
|
onFeedback,
|
|
54636
54647
|
headerTextColor
|
|
54637
54648
|
} = _ref17;
|
|
@@ -54740,7 +54751,7 @@
|
|
|
54740
54751
|
}), message.decisionResponse && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
54741
54752
|
className: "mt-2 text-xs ".concat(isDark ? "text-gray-400" : "text-gray-500"),
|
|
54742
54753
|
children: ["Selected: ", message.decisionResponse.selectedOption]
|
|
54743
|
-
}), ((_message$sources = message.sources) === null || _message$sources === void 0 ? void 0 : _message$sources.length) > 0 && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
54754
|
+
}), provideCitations !== false && ((_message$sources = message.sources) === null || _message$sources === void 0 ? void 0 : _message$sources.length) > 0 && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
54744
54755
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
54745
54756
|
className: "mt-3",
|
|
54746
54757
|
style: {
|
|
@@ -54765,7 +54776,7 @@
|
|
|
54765
54776
|
textColor: messageTextColor,
|
|
54766
54777
|
fontFamily: messageFontFamily,
|
|
54767
54778
|
fontSize: messageFontSize
|
|
54768
|
-
}), ((_message$sources2 = message.sources) === null || _message$sources2 === void 0 ? void 0 : _message$sources2.length) > 0 && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
54779
|
+
}), provideCitations !== false && ((_message$sources2 = message.sources) === null || _message$sources2 === void 0 ? void 0 : _message$sources2.length) > 0 && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
54769
54780
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
|
|
54770
54781
|
className: "mt-3",
|
|
54771
54782
|
style: {
|
|
@@ -54908,6 +54919,7 @@
|
|
|
54908
54919
|
organizationId,
|
|
54909
54920
|
onPromptSuggestionClick,
|
|
54910
54921
|
allowFeedback,
|
|
54922
|
+
provideCitations,
|
|
54911
54923
|
onFeedback,
|
|
54912
54924
|
headerTextColor
|
|
54913
54925
|
} = _ref19;
|
|
@@ -54951,6 +54963,7 @@
|
|
|
54951
54963
|
organizationId: organizationId,
|
|
54952
54964
|
onPromptSuggestionClick: onPromptSuggestionClick,
|
|
54953
54965
|
allowFeedback: allowFeedback,
|
|
54966
|
+
provideCitations: provideCitations,
|
|
54954
54967
|
onFeedback: onFeedback,
|
|
54955
54968
|
headerTextColor: headerTextColor
|
|
54956
54969
|
});
|
|
@@ -55806,6 +55819,7 @@
|
|
|
55806
55819
|
onPromptSuggestionClick,
|
|
55807
55820
|
conversationResetKey,
|
|
55808
55821
|
allowFeedback,
|
|
55822
|
+
provideCitations,
|
|
55809
55823
|
onFeedback,
|
|
55810
55824
|
headerTextColor,
|
|
55811
55825
|
// Inline filter slots — rendered in the initial-state region
|
|
@@ -55961,6 +55975,7 @@
|
|
|
55961
55975
|
apiBaseUrl: apiBaseUrl,
|
|
55962
55976
|
organizationId: organizationId,
|
|
55963
55977
|
allowFeedback: allowFeedback,
|
|
55978
|
+
provideCitations: provideCitations,
|
|
55964
55979
|
onFeedback: onFeedback,
|
|
55965
55980
|
headerTextColor: headerTextColor
|
|
55966
55981
|
}, message.id)), (() => {
|
|
@@ -59582,6 +59597,7 @@
|
|
|
59582
59597
|
onResetConversation,
|
|
59583
59598
|
autoPromptEnabled = true,
|
|
59584
59599
|
allowFeedback = true,
|
|
59600
|
+
provideCitations = true,
|
|
59585
59601
|
onFeedback,
|
|
59586
59602
|
onRefreshChat,
|
|
59587
59603
|
onCopyChat,
|
|
@@ -60120,6 +60136,7 @@
|
|
|
60120
60136
|
organizationId: organizationId,
|
|
60121
60137
|
conversationResetKey: conversationId,
|
|
60122
60138
|
allowFeedback: allowFeedback,
|
|
60139
|
+
provideCitations: provideCitations,
|
|
60123
60140
|
onFeedback: onFeedback,
|
|
60124
60141
|
headerTextColor: headerTextColor,
|
|
60125
60142
|
beforePromptsSlot: showInlineFilter ? /*#__PURE__*/jsxRuntimeExports.jsx(CategoryFilterInline, {
|
|
@@ -60457,7 +60474,7 @@
|
|
|
60457
60474
|
|
|
60458
60475
|
// Map API response to widget props (use props as overrides if provided)
|
|
60459
60476
|
const widgetConfig = reactExports.useMemo(() => {
|
|
60460
|
-
var _agentConfig$config, _cfg$identity, _cfg$branding, _cfg$typography, _cfg$messages, _cfg$voice, _cfg$onboarding, _cfg$disclaimer, _cfg$csat, _cfg$inactivity, _cfg$behavior, _cfg$security, _cfg$layout, _ref2, _messages$bundles$loc, _messages$bundles, _messages$bundles$en, _messages$bundles2, _ref3, _ref4, _ref5, _ref6, _branding$chatbotAvat, _branding$chatbotAvat2, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _inactivity$timeoutVa, _inactivity$timeoutUn, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _csat$enabled, _csat$format, _csat$prompt, _csat$triggerType, _csat$idleTimeoutMins, _csat$followUpEnabled, _csat$followUpPrompt, _behavior$autoPromptE, _behavior$allowFeedba;
|
|
60477
|
+
var _agentConfig$config, _cfg$identity, _cfg$branding, _cfg$typography, _cfg$messages, _cfg$voice, _cfg$onboarding, _cfg$disclaimer, _cfg$csat, _cfg$inactivity, _cfg$behavior, _cfg$security, _cfg$layout, _ref2, _messages$bundles$loc, _messages$bundles, _messages$bundles$en, _messages$bundles2, _ref3, _ref4, _ref5, _ref6, _branding$chatbotAvat, _branding$chatbotAvat2, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _inactivity$timeoutVa, _inactivity$timeoutUn, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _csat$enabled, _csat$format, _csat$prompt, _csat$triggerType, _csat$idleTimeoutMins, _csat$followUpEnabled, _csat$followUpPrompt, _behavior$autoPromptE, _behavior$allowFeedba, _behavior$provideCita;
|
|
60461
60478
|
if (!agentConfig) {
|
|
60462
60479
|
return null;
|
|
60463
60480
|
}
|
|
@@ -60548,7 +60565,12 @@
|
|
|
60548
60565
|
csatFollowUpEnabled: (_csat$followUpEnabled = csat.followUpEnabled) !== null && _csat$followUpEnabled !== void 0 ? _csat$followUpEnabled : false,
|
|
60549
60566
|
csatFollowUpPrompt: (_csat$followUpPrompt = csat.followUpPrompt) !== null && _csat$followUpPrompt !== void 0 ? _csat$followUpPrompt : null,
|
|
60550
60567
|
autoPromptEnabled: (_behavior$autoPromptE = behavior.autoPromptEnabled) !== null && _behavior$autoPromptE !== void 0 ? _behavior$autoPromptE : true,
|
|
60551
|
-
allowFeedback: (_behavior$allowFeedba = behavior.allowFeedback) !== null && _behavior$allowFeedba !== void 0 ? _behavior$allowFeedba : true
|
|
60568
|
+
allowFeedback: (_behavior$allowFeedba = behavior.allowFeedback) !== null && _behavior$allowFeedba !== void 0 ? _behavior$allowFeedba : true,
|
|
60569
|
+
// behavior.provideCitations — when false, hide the Sources panel on
|
|
60570
|
+
// every message and tell the backend to skip citation generation.
|
|
60571
|
+
// Defaults to true so agents that haven't set the field keep showing
|
|
60572
|
+
// citations (matches the testing-lab / chatbot-preview default).
|
|
60573
|
+
provideCitations: (_behavior$provideCita = behavior.provideCitations) !== null && _behavior$provideCita !== void 0 ? _behavior$provideCita : true
|
|
60552
60574
|
};
|
|
60553
60575
|
}, [agentConfig, darkMode, primaryColor, position, companyName, conciergeName, companyLogo, welcomeMessage, quickQuestions, quickQuestionsEnabled, textColor, agentMessageBubbleColor, userMessageBoxColor, assistantTextColor, userTextColor, fontFamily, fontSize, defaultLanguage, orgId, headerTextBold, headerTextItalic, enableVoiceInteraction, disclaimerEnabled, disclaimerText, disclaimerPosition, disclaimerLinkLabel, disclaimerLinkUrl, showPoweredBy, onboardingQuestions, onboardingEnabled, collectionPrompt, allowedDomains, agentMessageBubbleFontFamily, agentMessageBubbleFontSize, userMessageBubbleFontFamily, userMessageBubbleFontSize
|
|
60554
60576
|
// CSAT dependencies
|
|
@@ -60632,6 +60654,9 @@
|
|
|
60632
60654
|
onboardingQuestions: widgetConfig.onboardingQuestions,
|
|
60633
60655
|
onboardingEnabled: widgetConfig.onboardingEnabled,
|
|
60634
60656
|
collectionPrompt: widgetConfig.collectionPrompt,
|
|
60657
|
+
// Gates the chat request's enable_citation flag (text path). Voice
|
|
60658
|
+
// already reads provideCitations from the DB in voice_chat.py.
|
|
60659
|
+
provideCitations: widgetConfig.provideCitations,
|
|
60635
60660
|
inactivityTimeoutValue: widgetConfig.inactivityTimeoutValue,
|
|
60636
60661
|
inactivityTimeoutUnit: widgetConfig.inactivityTimeoutUnit,
|
|
60637
60662
|
// Sliding-window cap for the localStorage transcript. Comes from
|
|
@@ -60798,6 +60823,7 @@
|
|
|
60798
60823
|
onResetConversation: resetConversation,
|
|
60799
60824
|
autoPromptEnabled: widgetConfig.autoPromptEnabled,
|
|
60800
60825
|
allowFeedback: widgetConfig.allowFeedback,
|
|
60826
|
+
provideCitations: widgetConfig.provideCitations,
|
|
60801
60827
|
onFeedback: handleMessageFeedback,
|
|
60802
60828
|
onRefreshChat: handleRefreshChat,
|
|
60803
60829
|
onCopyChat: handleCopyChat
|