@eshal-bot/chat-widget 0.2.35 → 0.2.36

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.
@@ -8060,6 +8060,48 @@
8060
8060
  return response.json();
8061
8061
  };
8062
8062
 
8063
+ /**
8064
+ * Widget verification codes (POST /api/v1/support/identity/start|verify).
8065
+ * The code is posted here, never as a chat message, so it never reaches the
8066
+ * model or the transcript. Resolves to { ok, status, body } so the card can
8067
+ * show the server's own wording (tries left, locked, expired).
8068
+ */
8069
+ const postIdentity = async (path, payload, apiBaseUrl, getAuthToken) => {
8070
+ const headers = {
8071
+ 'Content-Type': 'application/json'
8072
+ };
8073
+ if (typeof getAuthToken === 'function') {
8074
+ const token = await getAuthToken();
8075
+ if (token) headers['Authorization'] = `Bearer ${token}`;
8076
+ }
8077
+ const response = await fetch(`${apiBaseUrl.replace(/\/$/, '')}/api/v1/support/identity/${path}`, {
8078
+ method: 'POST',
8079
+ headers,
8080
+ credentials: 'include',
8081
+ body: JSON.stringify(payload)
8082
+ });
8083
+ let body = {};
8084
+ try {
8085
+ body = await response.json();
8086
+ } catch {
8087
+ body = {};
8088
+ }
8089
+ return {
8090
+ ok: response.ok,
8091
+ status: response.status,
8092
+ body
8093
+ };
8094
+ };
8095
+
8096
+ /** @param {{ conversationId: string, method: 'email'|'sms', email?: string, phone?: string }} payload */
8097
+ const startVisitorVerification = (payload, apiBaseUrl, getAuthToken) => postIdentity('start', payload, apiBaseUrl, getAuthToken);
8098
+
8099
+ /** @param {{ conversationId: string, code: string }} payload */
8100
+ const verifyVisitorCode = (payload, apiBaseUrl, getAuthToken) => postIdentity('verify', payload, apiBaseUrl, getAuthToken);
8101
+
8102
+ /** Delivery of the pending code ("sent", "delivered", "failed" or null). */
8103
+ const visitorCodeStatus = (payload, apiBaseUrl, getAuthToken) => postIdentity('status', payload, apiBaseUrl, getAuthToken);
8104
+
8063
8105
  // ============================================================================
8064
8106
  // UI HELPERS
8065
8107
  // ============================================================================
@@ -9245,7 +9287,28 @@
9245
9287
  // that dies on the wire (e.g. the network changed mid-request) used to
9246
9288
  // render exactly like a delivered message.
9247
9289
  messageNotDelivered: "Not delivered",
9248
- retrySend: "Retry"
9290
+ retrySend: "Retry",
9291
+ // Verification code card. EN-only for now - translate() falls back to EN
9292
+ // for locales without the key.
9293
+ verifyTitle: "Confirm it's you",
9294
+ verifyEmailLabel: "Your email",
9295
+ verifyPhoneLabel: "Your mobile number",
9296
+ verifySendCode: "Send code",
9297
+ verifySending: "Sending...",
9298
+ verifyEnterCode: "Enter the code we sent to {target}",
9299
+ verifyCodeLabel: "6-digit code",
9300
+ verifyConfirm: "Confirm",
9301
+ verifyResendIn: "Resend in {seconds} s",
9302
+ verifyResend: "Send a new code",
9303
+ verifyDifferent: "Use a different address",
9304
+ verifyDone: "Verified as {target}",
9305
+ verifyResumeMessage: "I've confirmed it's me.",
9306
+ verifyTriesLeft: "That code doesn't match. {count} tries left.",
9307
+ verifyGenericError: "Something went wrong. Try again.",
9308
+ verifyInputBlocked: "Enter your code above to continue",
9309
+ verifyCancel: "Cancel",
9310
+ verifyCancelled: "Verification cancelled.",
9311
+ verifyNotDelivered: "We couldn't deliver the code to that number. Check it and send a new code."
9249
9312
  };
9250
9313
  const DICTIONARIES = {
9251
9314
  en: EN,
@@ -14026,6 +14089,11 @@
14026
14089
  ...(opts?.toolConfirmation ? {
14027
14090
  tool_confirmation: opts.toolConfirmation
14028
14091
  } : {}),
14092
+ // Verification code card: the held personal tool may run now. The
14093
+ // code itself was posted to /support/identity, not here.
14094
+ ...(opts?.verificationComplete ? {
14095
+ verification_complete: opts.verificationComplete
14096
+ } : {}),
14029
14097
  messageHistory: messages.filter(msg => {
14030
14098
  // Filter out processing messages, empty messages, and onboarding messages
14031
14099
  return !msg.isProcessing && msg.content && msg.content.trim() && !['userName', 'email', 'phone'].includes(msg.type);
@@ -19851,6 +19919,9 @@
19851
19919
  isMinimized,
19852
19920
  isLoading,
19853
19921
  isConversationLoading = false,
19922
+ // A verification code card is waiting for its code: the visitor finishes
19923
+ // (or cancels) it before typing, so a code is never typed into the chat.
19924
+ verificationPending = false,
19854
19925
  placeholder,
19855
19926
  textColor,
19856
19927
  fontFamily,
@@ -20054,7 +20125,7 @@
20054
20125
  // (so a user can upload a file and hit Send without typing). When
20055
20126
  // uploads are in flight we block Send to prevent partial payloads.
20056
20127
  const hasReadyAttachment = attachments.some(a => a.status === "ready");
20057
- const isDisabled = !inputValue.trim() && !hasReadyAttachment || isLoading || isConversationLoading || isUploadBusy;
20128
+ const isDisabled = !inputValue.trim() && !hasReadyAttachment || isLoading || isConversationLoading || isUploadBusy || verificationPending;
20058
20129
  const handleKeyPress = event => {
20059
20130
  if (event.key === "Enter" && !event.shiftKey) {
20060
20131
  event.preventDefault();
@@ -20065,6 +20136,7 @@
20065
20136
  // session - so the file is ingested into the shared session store and
20066
20137
  // answered, and later spoken turns in the same session see it too. A
20067
20138
  // plain voice turn (no attachment) still goes over the WS.
20139
+ if (verificationPending) return;
20068
20140
  if (isVoiceSessionActive && onBidiSubmit && !hasReadyAttachment) {
20069
20141
  onBidiSubmit();
20070
20142
  return;
@@ -20311,9 +20383,9 @@
20311
20383
  onFocus: () => setIsFocused(true),
20312
20384
  onBlur: () => setIsFocused(false),
20313
20385
  onKeyDown: handleKeyPress,
20314
- placeholder: isConversationLoading ? t("agentIsLoading") : placeholder || t("typeYourMessage"),
20386
+ placeholder: isConversationLoading ? t("agentIsLoading") : verificationPending ? t("verifyInputBlocked") : placeholder || t("typeYourMessage"),
20315
20387
  rows: 1,
20316
- disabled: csatVisible || isConversationLoading || isLoading || isVoiceSessionActive && voiceStatus !== "connected",
20388
+ disabled: csatVisible || isConversationLoading || isLoading || verificationPending || isVoiceSessionActive && voiceStatus !== "connected",
20317
20389
  dir: typedIsRtl ? "rtl" : "ltr",
20318
20390
  className: `w-full px-3 bg-transparent rounded-xl leading-normal ${isDark ? "text-gray-100" : "text-gray-900"} placeholder-gray-400 resize-none outline-none scrollbar-hide break-words`,
20319
20391
  style: {
@@ -20449,7 +20521,7 @@
20449
20521
  })
20450
20522
  }) : /*#__PURE__*/jsxRuntimeExports.jsx("button", {
20451
20523
  onClick: isVoiceSessionActive && onBidiSubmit && !hasReadyAttachment ? onBidiSubmit : sendWithAttachments,
20452
- disabled: csatVisible || isDisabled || isVoiceSessionActive && voiceStatus !== "connected",
20524
+ disabled: csatVisible || isDisabled || verificationPending || isVoiceSessionActive && voiceStatus !== "connected",
20453
20525
  className: `h-10 w-10 flex-shrink-0 rounded-xl transition-all duration-200 flex items-center justify-center shadow-md disabled:opacity-40 disabled:cursor-not-allowed disabled:shadow-none ${inputValue.trim() ? "scale-100" : "scale-95"}`,
20454
20526
  style: {
20455
20527
  backgroundColor: inputValue.trim() ? primaryColor : isDark ? "#374151" : "#e5e7eb",
@@ -21746,6 +21818,8 @@
21746
21818
  }
21747
21819
  }
21748
21820
 
21821
+ const VerificationContext = /*#__PURE__*/reactExports.createContext(null);
21822
+
21749
21823
  const DEFAULT_AGENT_BUBBLE_COLOR = "#ffffff";
21750
21824
  const DEFAULT_USER_MESSAGE_COLOR = "#f5f5f5";
21751
21825
  const DEFAULT_TEXT_COLOR = "#000000";
@@ -21897,6 +21971,35 @@
21897
21971
  const panelRef = reactExports.useRef(null);
21898
21972
  const t = reactExports.useMemo(() => createTranslator(defaultLanguage), [defaultLanguage]);
21899
21973
 
21974
+ // What the verify card (A2uiBlock "verification" fence) needs. The code is
21975
+ // posted to /support/identity, never through the chat send. Declared with
21976
+ // the other top-level hooks, ahead of the `if (!isOpen) return null;` below.
21977
+ // Cards still waiting for a code; while any is, the chat input is blocked.
21978
+ const [verificationPendingKeys, setVerificationPendingKeys] = reactExports.useState(() => new Set());
21979
+ const setVerificationPending = reactExports.useCallback((key, on) => {
21980
+ setVerificationPendingKeys(prev => {
21981
+ if (on === prev.has(key)) return prev;
21982
+ const next = new Set(prev);
21983
+ if (on) next.add(key);else next.delete(key);
21984
+ return next;
21985
+ });
21986
+ }, []);
21987
+ const verificationContextValue = reactExports.useMemo(() => apiBaseUrl && conversationId ? {
21988
+ t,
21989
+ setPending: setVerificationPending,
21990
+ start: payload => startVisitorVerification({
21991
+ ...payload,
21992
+ conversationId
21993
+ }, apiBaseUrl, getAuthToken),
21994
+ verify: payload => verifyVisitorCode({
21995
+ ...payload,
21996
+ conversationId
21997
+ }, apiBaseUrl, getAuthToken),
21998
+ status: () => visitorCodeStatus({
21999
+ conversationId
22000
+ }, apiBaseUrl, getAuthToken)
22001
+ } : null, [t, apiBaseUrl, conversationId, getAuthToken, setVerificationPending]);
22002
+
21900
22003
  // EV-2480: move focus into the dialog on open. This component only
21901
22004
  // mounts while isOpen is true (see the `if (!isOpen) return null;` below),
21902
22005
  // so a mount-only effect fires exactly once per open.
@@ -21934,8 +22037,13 @@
21934
22037
  // The structured answer rides on the send; the text is still the
21935
22038
  // message. A host override (onPromptSuggestionClick) keeps the text.
21936
22039
  const toolConfirmation = index && typeof index === "object" && index.toolConfirmation ? index.toolConfirmation : null;
22040
+ // The verify card's resume: the code was already checked by the
22041
+ // backend; this only tells the held tool to run.
22042
+ const verificationComplete = index && typeof index === "object" && index.verificationComplete ? index.verificationComplete : null;
21937
22043
  if (onPromptSuggestionClick) onPromptSuggestionClick(text);else if (toolConfirmation) onDirectSend?.(text, undefined, {
21938
22044
  toolConfirmation
22045
+ });else if (verificationComplete) onDirectSend?.(text, undefined, {
22046
+ verificationComplete
21939
22047
  });else onDirectSend?.(text);
21940
22048
  }, [onPromptSuggestionClick, onDirectSend, reportChipClick]);
21941
22049
 
@@ -22541,236 +22649,240 @@
22541
22649
  maxWidth: "92vw",
22542
22650
  maxHeight: "85vh"
22543
22651
  } : undefined;
22544
- return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
22545
- dir: isRtlLanguage ? "rtl" : "ltr",
22546
- className: `relative flex-shrink-0 z-50 ${isMinimized ? "w-80 h-auto" : ""}`,
22547
- style: sizeStyle,
22548
- children: [!isMinimized && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
22549
- children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
22550
- onMouseDown: e => handleResizeStart("horizontal", e),
22551
- className: `absolute top-0 h-full w-1.5 cursor-ew-resize hover:bg-blue-500/20 transition-colors z-[70] ${anchorRight ? "left-0" : "right-0"}`,
22552
- "aria-hidden": true
22553
- }), /*#__PURE__*/jsxRuntimeExports.jsx("div", {
22554
- onMouseDown: e => handleResizeStart("vertical", e),
22555
- className: `absolute left-0 w-full h-1.5 cursor-ns-resize hover:bg-blue-500/20 transition-colors z-[70] ${anchorBottom ? "top-0" : "bottom-0"}`,
22556
- "aria-hidden": true
22557
- })]
22558
- }), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
22559
- id: "chat-window-panel",
22560
- ref: panelRef,
22561
- role: "dialog",
22562
- "aria-modal": "true",
22563
- "aria-label": t("openChat"),
22564
- tabIndex: -1,
22565
- className: `relative focus:outline-none ${!widgetSize && !isMinimized ? "w-[380px]" : ""} ${!widgetSize && !isMinimized ? "h-[650px]" : ""} ${isMinimized ? "w-80 h-auto" : ""} ${widgetSize && !isMinimized ? "w-full h-full" : ""} max-w-[92vw] border rounded-2xl shadow-2xl bg-white border-gray-200 flex flex-col ${!isMinimized ? "max-h-[85vh]" : ""} overflow-hidden ${isDark ? "bg-gray-900 border-gray-700" : ""}`,
22566
- children: [!isMinimized && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
22567
- onMouseDown: e => handleResizeStart("corner", e),
22568
- "aria-hidden": "true",
22569
- className: `absolute w-4 h-4 ${anchorRight === anchorBottom ? "cursor-nwse-resize" : "cursor-nesw-resize"} text-gray-400 hover:text-blue-500 transition-colors z-[71] flex p-0.5 ${anchorBottom ? "top-0 items-start" : "bottom-0 items-end"} ${anchorRight ? "left-0 justify-start" : "right-0 justify-end"}`,
22570
- children: /*#__PURE__*/jsxRuntimeExports.jsx("svg", {
22571
- viewBox: "0 0 12 12",
22572
- className: `w-3 h-3 ${anchorBottom && anchorRight ? "rotate-180" : anchorBottom ? "-rotate-90" : anchorRight ? "rotate-90" : ""}`,
22573
- "aria-hidden": true,
22574
- children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
22575
- d: "M11 1 L1 11 M11 5 L5 11 M11 9 L9 11",
22576
- stroke: "currentColor",
22577
- strokeWidth: "1.5",
22578
- fill: "none",
22579
- strokeLinecap: "round"
22580
- })
22581
- })
22582
- }), /*#__PURE__*/jsxRuntimeExports.jsx(ChatHeader, {
22583
- conciergeName: conciergeName,
22584
- companyName: companyName,
22585
- companyLogo: companyLogo,
22586
- primaryColor: primaryColor,
22587
- isDark: isDark,
22588
- isMinimized: isMinimized,
22589
- textColor: resolvedTextColor,
22590
- fontFamily: fontFamily,
22591
- fontSize: fontSize,
22592
- onToggleTheme: onToggleTheme,
22593
- onMinimize: onMinimize,
22594
- onClose: handleCloseClick,
22595
- headerTextBold: headerTextBold,
22596
- headerTextItalic: headerTextItalic,
22597
- headerTextColor: headerTextColor,
22598
- headerFontFamily: headerFontFamily,
22599
- headerFontSize: headerFontSize,
22600
- subtitle: subtitle,
22601
- showStatus: showStatus,
22602
- statusMode: statusMode,
22603
- officeHours: officeHours,
22604
- onRefreshChat: onRefreshChat,
22605
- onCopyChat: onCopyChat,
22606
- defaultLanguage: defaultLanguage
22607
- }), !isMinimized && filterEnabled && !showInlineFilter && !(showResolveForm && !isConversationResolved) && !(onboardingActive && !onboardingCompleted) && /*#__PURE__*/jsxRuntimeExports.jsx(CategoryTabsBar, {
22608
- categories: filterCategories,
22609
- selectedCategoryId: widgetFilter?.category || null,
22610
- onSelect: handleSelectCategory,
22611
- isDark: isDark,
22612
- primaryColor: primaryColor,
22613
- fontFamily: fontFamily,
22614
- isRtl: isRtlLanguage,
22615
- defaultLanguage: defaultLanguage
22616
- }), !isMinimized && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
22652
+ return /*#__PURE__*/jsxRuntimeExports.jsx(VerificationContext.Provider, {
22653
+ value: verificationContextValue,
22654
+ children: /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
22655
+ dir: isRtlLanguage ? "rtl" : "ltr",
22656
+ className: `relative flex-shrink-0 z-50 ${isMinimized ? "w-80 h-auto" : ""}`,
22657
+ style: sizeStyle,
22658
+ children: [!isMinimized && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
22617
22659
  children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
22618
- ref: messagesContainerRef,
22619
- role: "log",
22620
- "aria-live": "polite",
22621
- className: `chat-messages flex-1 overflow-y-auto px-3 py-4 space-y-4 ${isDark ? "bg-gray-900" : "bg-gradient-to-b from-gray-50/50 to-white"} break-words`,
22622
- children: showResolveForm && !isConversationResolved ? renderFeedbackForm() : onboardingActive && !onboardingCompleted && onOnboardingFormSubmit ? /*#__PURE__*/jsxRuntimeExports.jsx(OnboardingForm, {
22623
- questions: onboardingQuestions,
22624
- onPromptSuggestionClick: stableOnPromptSuggestionClick,
22625
- collapsiblePrompt: collectionPrompt,
22626
- onSubmit: onOnboardingFormSubmit,
22627
- primaryColor: primaryColor,
22628
- isRtl: isRtlLanguage,
22629
- isDark: isDark,
22630
- defaultLanguage: defaultLanguage,
22631
- fontFamily: fontFamily
22632
- }) : /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
22633
- children: [sessionExpiringSoon && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
22634
- role: "status",
22635
- className: `mx-3 mt-1 mb-2 rounded-lg px-3 py-2 text-xs font-medium ${isDark ? 'bg-amber-900/40 text-amber-200 border border-amber-700/50' : 'bg-amber-50 text-amber-800 border border-amber-200'}`,
22636
- children: t("sessionExpiringSoon")
22637
- }), /*#__PURE__*/jsxRuntimeExports.jsx(MessageList, {
22638
- messages: messages,
22639
- liveJoined: liveJoined,
22640
- isDark: isDark,
22660
+ onMouseDown: e => handleResizeStart("horizontal", e),
22661
+ className: `absolute top-0 h-full w-1.5 cursor-ew-resize hover:bg-blue-500/20 transition-colors z-[70] ${anchorRight ? "left-0" : "right-0"}`,
22662
+ "aria-hidden": true
22663
+ }), /*#__PURE__*/jsxRuntimeExports.jsx("div", {
22664
+ onMouseDown: e => handleResizeStart("vertical", e),
22665
+ className: `absolute left-0 w-full h-1.5 cursor-ns-resize hover:bg-blue-500/20 transition-colors z-[70] ${anchorBottom ? "top-0" : "bottom-0"}`,
22666
+ "aria-hidden": true
22667
+ })]
22668
+ }), /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
22669
+ id: "chat-window-panel",
22670
+ ref: panelRef,
22671
+ role: "dialog",
22672
+ "aria-modal": "true",
22673
+ "aria-label": t("openChat"),
22674
+ tabIndex: -1,
22675
+ className: `relative focus:outline-none ${!widgetSize && !isMinimized ? "w-[380px]" : ""} ${!widgetSize && !isMinimized ? "h-[650px]" : ""} ${isMinimized ? "w-80 h-auto" : ""} ${widgetSize && !isMinimized ? "w-full h-full" : ""} max-w-[92vw] border rounded-2xl shadow-2xl bg-white border-gray-200 flex flex-col ${!isMinimized ? "max-h-[85vh]" : ""} overflow-hidden ${isDark ? "bg-gray-900 border-gray-700" : ""}`,
22676
+ children: [!isMinimized && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
22677
+ onMouseDown: e => handleResizeStart("corner", e),
22678
+ "aria-hidden": "true",
22679
+ className: `absolute w-4 h-4 ${anchorRight === anchorBottom ? "cursor-nwse-resize" : "cursor-nesw-resize"} text-gray-400 hover:text-blue-500 transition-colors z-[71] flex p-0.5 ${anchorBottom ? "top-0 items-start" : "bottom-0 items-end"} ${anchorRight ? "left-0 justify-start" : "right-0 justify-end"}`,
22680
+ children: /*#__PURE__*/jsxRuntimeExports.jsx("svg", {
22681
+ viewBox: "0 0 12 12",
22682
+ className: `w-3 h-3 ${anchorBottom && anchorRight ? "rotate-180" : anchorBottom ? "-rotate-90" : anchorRight ? "rotate-90" : ""}`,
22683
+ "aria-hidden": true,
22684
+ children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
22685
+ d: "M11 1 L1 11 M11 5 L5 11 M11 9 L9 11",
22686
+ stroke: "currentColor",
22687
+ strokeWidth: "1.5",
22688
+ fill: "none",
22689
+ strokeLinecap: "round"
22690
+ })
22691
+ })
22692
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(ChatHeader, {
22693
+ conciergeName: conciergeName,
22694
+ companyName: companyName,
22695
+ companyLogo: companyLogo,
22696
+ primaryColor: primaryColor,
22697
+ isDark: isDark,
22698
+ isMinimized: isMinimized,
22699
+ textColor: resolvedTextColor,
22700
+ fontFamily: fontFamily,
22701
+ fontSize: fontSize,
22702
+ onToggleTheme: onToggleTheme,
22703
+ onMinimize: onMinimize,
22704
+ onClose: handleCloseClick,
22705
+ headerTextBold: headerTextBold,
22706
+ headerTextItalic: headerTextItalic,
22707
+ headerTextColor: headerTextColor,
22708
+ headerFontFamily: headerFontFamily,
22709
+ headerFontSize: headerFontSize,
22710
+ subtitle: subtitle,
22711
+ showStatus: showStatus,
22712
+ statusMode: statusMode,
22713
+ officeHours: officeHours,
22714
+ onRefreshChat: onRefreshChat,
22715
+ onCopyChat: onCopyChat,
22716
+ defaultLanguage: defaultLanguage
22717
+ }), !isMinimized && filterEnabled && !showInlineFilter && !(showResolveForm && !isConversationResolved) && !(onboardingActive && !onboardingCompleted) && /*#__PURE__*/jsxRuntimeExports.jsx(CategoryTabsBar, {
22718
+ categories: filterCategories,
22719
+ selectedCategoryId: widgetFilter?.category || null,
22720
+ onSelect: handleSelectCategory,
22721
+ isDark: isDark,
22722
+ primaryColor: primaryColor,
22723
+ fontFamily: fontFamily,
22724
+ isRtl: isRtlLanguage,
22725
+ defaultLanguage: defaultLanguage
22726
+ }), !isMinimized && /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
22727
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx("div", {
22728
+ ref: messagesContainerRef,
22729
+ role: "log",
22730
+ "aria-live": "polite",
22731
+ className: `chat-messages flex-1 overflow-y-auto px-3 py-4 space-y-4 ${isDark ? "bg-gray-900" : "bg-gradient-to-b from-gray-50/50 to-white"} break-words`,
22732
+ children: showResolveForm && !isConversationResolved ? renderFeedbackForm() : onboardingActive && !onboardingCompleted && onOnboardingFormSubmit ? /*#__PURE__*/jsxRuntimeExports.jsx(OnboardingForm, {
22733
+ questions: onboardingQuestions,
22734
+ onPromptSuggestionClick: stableOnPromptSuggestionClick,
22735
+ collapsiblePrompt: collectionPrompt,
22736
+ onSubmit: onOnboardingFormSubmit,
22641
22737
  primaryColor: primaryColor,
22642
- isLoading: isLoading,
22643
- agentMessageBubbleColor: agentMessageBubbleColor,
22644
- userMessageBoxColor: userMessageBoxColor,
22645
- textColor: textColor,
22646
- assistantTextColor: assistantTextColor,
22647
- userTextColor: userTextColor,
22648
- fontFamily: fontFamily,
22649
- agentMessageBubbleFontFamily: agentMessageBubbleFontFamily,
22650
- agentMessageBubbleFontSize: agentMessageBubbleFontSize,
22651
- userMessageBubbleFontFamily: userMessageBubbleFontFamily,
22652
- userMessageBubbleFontSize: userMessageBubbleFontSize,
22653
- fontSize: fontSize,
22654
- formatTime: formatTime,
22655
22738
  isRtl: isRtlLanguage,
22739
+ isDark: isDark,
22656
22740
  defaultLanguage: defaultLanguage,
22657
- quickQuestions: quickQuestions,
22658
- shouldShowQuickQuestions: shouldShowQuickQuestions,
22659
- onQuickQuestion: onQuickQuestion ?? onDirectSend,
22660
- quickQuestionsLayout: quickQuestionsLayout,
22661
- onDecision: onDecision,
22662
- disclaimerEnabled: disclaimerEnabled,
22663
- disclaimerText: disclaimerText,
22664
- disclaimerPosition: disclaimerPosition,
22665
- disclaimerLinkUrl: disclaimerLinkUrl,
22666
- disclaimerLinkLabel: disclaimerLinkLabel,
22667
- resolvedAgentBubbleColor: resolvedAgentBubbleColor,
22668
- resolvedUserMessageColor: resolvedUserMessageColor,
22669
- resolvedTextColor: resolvedTextColor,
22670
- isVoiceSessionActive: isVoiceSessionActive,
22671
- voiceStatus: voiceStatus,
22672
- messagesContainerRef: messagesContainerRef,
22673
- companyLogo: companyLogo,
22674
- chatbotAvatarEnabled: chatbotAvatarEnabled,
22675
- chatbotAvatar: chatbotAvatar,
22676
- conciergeName: conciergeName,
22677
- companyName: companyName,
22678
- apiBaseUrl: apiBaseUrl,
22679
- getAuthToken: getAuthToken,
22680
- onPromptSuggestionClick: stableOnPromptSuggestionClick,
22681
- conversationResetKey: conversationId,
22682
- allowFeedback: allowFeedback,
22683
- provideCitations: provideCitations,
22684
- onFeedback: onFeedback,
22685
- onRetryMessage: onRetryMessage,
22686
- headerTextColor: headerTextColor,
22687
- beforePromptsSlot: showInlineFilter ? /*#__PURE__*/jsxRuntimeExports.jsx(CategoryFilterInline, {
22688
- categories: filterCategories,
22689
- selectedCategoryId: widgetFilter?.category || null,
22690
- onSelect: handleSelectCategory,
22741
+ fontFamily: fontFamily
22742
+ }) : /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
22743
+ children: [sessionExpiringSoon && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
22744
+ role: "status",
22745
+ className: `mx-3 mt-1 mb-2 rounded-lg px-3 py-2 text-xs font-medium ${isDark ? 'bg-amber-900/40 text-amber-200 border border-amber-700/50' : 'bg-amber-50 text-amber-800 border border-amber-200'}`,
22746
+ children: t("sessionExpiringSoon")
22747
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(MessageList, {
22748
+ messages: messages,
22749
+ liveJoined: liveJoined,
22691
22750
  isDark: isDark,
22692
22751
  primaryColor: primaryColor,
22752
+ isLoading: isLoading,
22753
+ agentMessageBubbleColor: agentMessageBubbleColor,
22754
+ userMessageBoxColor: userMessageBoxColor,
22755
+ textColor: textColor,
22756
+ assistantTextColor: assistantTextColor,
22757
+ userTextColor: userTextColor,
22693
22758
  fontFamily: fontFamily,
22759
+ agentMessageBubbleFontFamily: agentMessageBubbleFontFamily,
22760
+ agentMessageBubbleFontSize: agentMessageBubbleFontSize,
22761
+ userMessageBubbleFontFamily: userMessageBubbleFontFamily,
22762
+ userMessageBubbleFontSize: userMessageBubbleFontSize,
22694
22763
  fontSize: fontSize,
22764
+ formatTime: formatTime,
22695
22765
  isRtl: isRtlLanguage,
22696
- label: t("chooseTopicLabel"),
22697
- regionLabel: t("categoryFilter")
22698
- }) : null,
22699
- quickQuestionsHeadingLabel: filterEnabled ? t("quickQuestionsHeadingLabel") : undefined
22700
- }), (showCsat && csatEnabled || csatRequest) && !csatSubmitted && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
22701
- className: "",
22702
- "data-testid": "widget-csat-card",
22703
- children: /*#__PURE__*/jsxRuntimeExports.jsx(CSATWidget, {
22704
- format: normalizeCsatFormat(csatRequest?.format || csatFormat),
22705
- prompt: csatRequest?.prompt || csatPrompt || t("howWasYourExperience"),
22706
- onRating: handleCsatRating,
22707
- disabled: false,
22708
- isDark: isDark,
22709
- primaryColor: primaryColor,
22710
- defaultLanguage: defaultLanguage
22711
- })
22712
- })]
22713
- })
22714
- }), !(onboardingActive && !onboardingCompleted) && /*#__PURE__*/jsxRuntimeExports.jsx(ChatInput, {
22715
- onSynthesizeAssistantMessage: onSynthesizeAssistantMessage,
22716
- onStopGeneration: onStopGeneration,
22717
- inputValue: inputValue,
22718
- setInputValue: setInputValue,
22719
- onSend: onSend,
22720
- isDark: isDark,
22721
- primaryColor: primaryColor,
22722
- isOpen: isOpen,
22723
- isMinimized: isMinimized,
22724
- isLoading: isLoading,
22725
- isConversationLoading: isConversationLoading,
22726
- placeholder: placeholder,
22727
- textColor: resolvedTextColor,
22728
- fontFamily: fontFamily,
22729
- userMessageBubbleFontFamily: userMessageBubbleFontFamily,
22730
- userMessageBubbleFontSize: userMessageBubbleFontSize,
22731
- fontSize: fontSize,
22732
- isRtl: isRtlLanguage,
22733
- csatVisible: showCsat && csatEnabled && !csatSubmitted || isCsatEnabled && (showResolveForm || isConversationResolved),
22734
- enableVoiceInteraction: enableVoiceInteraction,
22735
- isVoiceSessionActive: isVoiceSessionActive,
22736
- voiceStatus: voiceStatus,
22737
- voiceError: voiceError,
22738
- onVoiceToggle: onVoiceToggle,
22739
- onBidiSubmit: onBidiSubmit,
22740
- disclaimerEnabled: disclaimerEnabled,
22741
- disclaimerText: disclaimerText,
22742
- disclaimerPosition: disclaimerPosition,
22743
- disclaimerLinkUrl: disclaimerLinkUrl,
22744
- disclaimerLinkLabel: disclaimerLinkLabel,
22745
- showPoweredBy: showPoweredBy,
22746
- defaultLanguage: defaultLanguage,
22747
- onboardingQuestions: onboardingQuestions,
22748
- onboardingActive: onboardingActive,
22749
- onboardingCompleted: onboardingCompleted,
22750
- onboardingEnabled: onboardingEnabled,
22751
- userMessageBoxColor: userMessageBoxColor,
22752
- resolvedUserMessageColor: resolvedUserMessageColor,
22753
- userTextColor: userTextColor,
22754
- promptSuggestions: showResolveForm || isConversationResolved || autoPromptEnabled === false || isLoading ? [] : stablePromptSuggestions,
22755
- onPromptSuggestionClick: stableOnPromptSuggestionClick,
22756
- autoPromptQuestionDisplay: autoPromptQuestionDisplay,
22757
- tagSelectorNode: null,
22758
- showResolveButton: isCsatEnabled && hasUserMessages && !isConversationResolved && !showResolveForm && !showCsat && !shouldHideResolveForOnboarding,
22759
- onResolve: () => {
22760
- if (!isCsatEnabled) return;
22761
- setShowResolveForm(true);
22762
- }
22763
- // Attachments (RAG-attach-1) - paperclip stays hidden
22764
- // unless the operator explicitly opted in via
22765
- // MasterAgent.config.chatFeatures.
22766
- ,
22767
- chatFeatures: chatFeatures,
22768
- apiEndpoint: apiBaseUrl,
22769
- organizationId: organizationId,
22770
- conversationId: conversationId
22766
+ defaultLanguage: defaultLanguage,
22767
+ quickQuestions: quickQuestions,
22768
+ shouldShowQuickQuestions: shouldShowQuickQuestions,
22769
+ onQuickQuestion: onQuickQuestion ?? onDirectSend,
22770
+ quickQuestionsLayout: quickQuestionsLayout,
22771
+ onDecision: onDecision,
22772
+ disclaimerEnabled: disclaimerEnabled,
22773
+ disclaimerText: disclaimerText,
22774
+ disclaimerPosition: disclaimerPosition,
22775
+ disclaimerLinkUrl: disclaimerLinkUrl,
22776
+ disclaimerLinkLabel: disclaimerLinkLabel,
22777
+ resolvedAgentBubbleColor: resolvedAgentBubbleColor,
22778
+ resolvedUserMessageColor: resolvedUserMessageColor,
22779
+ resolvedTextColor: resolvedTextColor,
22780
+ isVoiceSessionActive: isVoiceSessionActive,
22781
+ voiceStatus: voiceStatus,
22782
+ messagesContainerRef: messagesContainerRef,
22783
+ companyLogo: companyLogo,
22784
+ chatbotAvatarEnabled: chatbotAvatarEnabled,
22785
+ chatbotAvatar: chatbotAvatar,
22786
+ conciergeName: conciergeName,
22787
+ companyName: companyName,
22788
+ apiBaseUrl: apiBaseUrl,
22789
+ getAuthToken: getAuthToken,
22790
+ onPromptSuggestionClick: stableOnPromptSuggestionClick,
22791
+ conversationResetKey: conversationId,
22792
+ allowFeedback: allowFeedback,
22793
+ provideCitations: provideCitations,
22794
+ onFeedback: onFeedback,
22795
+ onRetryMessage: onRetryMessage,
22796
+ headerTextColor: headerTextColor,
22797
+ beforePromptsSlot: showInlineFilter ? /*#__PURE__*/jsxRuntimeExports.jsx(CategoryFilterInline, {
22798
+ categories: filterCategories,
22799
+ selectedCategoryId: widgetFilter?.category || null,
22800
+ onSelect: handleSelectCategory,
22801
+ isDark: isDark,
22802
+ primaryColor: primaryColor,
22803
+ fontFamily: fontFamily,
22804
+ fontSize: fontSize,
22805
+ isRtl: isRtlLanguage,
22806
+ label: t("chooseTopicLabel"),
22807
+ regionLabel: t("categoryFilter")
22808
+ }) : null,
22809
+ quickQuestionsHeadingLabel: filterEnabled ? t("quickQuestionsHeadingLabel") : undefined
22810
+ }), (showCsat && csatEnabled || csatRequest) && !csatSubmitted && /*#__PURE__*/jsxRuntimeExports.jsx("div", {
22811
+ className: "",
22812
+ "data-testid": "widget-csat-card",
22813
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(CSATWidget, {
22814
+ format: normalizeCsatFormat(csatRequest?.format || csatFormat),
22815
+ prompt: csatRequest?.prompt || csatPrompt || t("howWasYourExperience"),
22816
+ onRating: handleCsatRating,
22817
+ disabled: false,
22818
+ isDark: isDark,
22819
+ primaryColor: primaryColor,
22820
+ defaultLanguage: defaultLanguage
22821
+ })
22822
+ })]
22823
+ })
22824
+ }), !(onboardingActive && !onboardingCompleted) && /*#__PURE__*/jsxRuntimeExports.jsx(ChatInput, {
22825
+ onSynthesizeAssistantMessage: onSynthesizeAssistantMessage,
22826
+ onStopGeneration: onStopGeneration,
22827
+ inputValue: inputValue,
22828
+ setInputValue: setInputValue,
22829
+ onSend: onSend,
22830
+ isDark: isDark,
22831
+ primaryColor: primaryColor,
22832
+ isOpen: isOpen,
22833
+ isMinimized: isMinimized,
22834
+ isLoading: isLoading,
22835
+ isConversationLoading: isConversationLoading,
22836
+ verificationPending: verificationPendingKeys.size > 0,
22837
+ placeholder: placeholder,
22838
+ textColor: resolvedTextColor,
22839
+ fontFamily: fontFamily,
22840
+ userMessageBubbleFontFamily: userMessageBubbleFontFamily,
22841
+ userMessageBubbleFontSize: userMessageBubbleFontSize,
22842
+ fontSize: fontSize,
22843
+ isRtl: isRtlLanguage,
22844
+ csatVisible: showCsat && csatEnabled && !csatSubmitted || isCsatEnabled && (showResolveForm || isConversationResolved),
22845
+ enableVoiceInteraction: enableVoiceInteraction,
22846
+ isVoiceSessionActive: isVoiceSessionActive,
22847
+ voiceStatus: voiceStatus,
22848
+ voiceError: voiceError,
22849
+ onVoiceToggle: onVoiceToggle,
22850
+ onBidiSubmit: onBidiSubmit,
22851
+ disclaimerEnabled: disclaimerEnabled,
22852
+ disclaimerText: disclaimerText,
22853
+ disclaimerPosition: disclaimerPosition,
22854
+ disclaimerLinkUrl: disclaimerLinkUrl,
22855
+ disclaimerLinkLabel: disclaimerLinkLabel,
22856
+ showPoweredBy: showPoweredBy,
22857
+ defaultLanguage: defaultLanguage,
22858
+ onboardingQuestions: onboardingQuestions,
22859
+ onboardingActive: onboardingActive,
22860
+ onboardingCompleted: onboardingCompleted,
22861
+ onboardingEnabled: onboardingEnabled,
22862
+ userMessageBoxColor: userMessageBoxColor,
22863
+ resolvedUserMessageColor: resolvedUserMessageColor,
22864
+ userTextColor: userTextColor,
22865
+ promptSuggestions: showResolveForm || isConversationResolved || autoPromptEnabled === false || isLoading ? [] : stablePromptSuggestions,
22866
+ onPromptSuggestionClick: stableOnPromptSuggestionClick,
22867
+ autoPromptQuestionDisplay: autoPromptQuestionDisplay,
22868
+ tagSelectorNode: null,
22869
+ showResolveButton: isCsatEnabled && hasUserMessages && !isConversationResolved && !showResolveForm && !showCsat && !shouldHideResolveForOnboarding,
22870
+ onResolve: () => {
22871
+ if (!isCsatEnabled) return;
22872
+ setShowResolveForm(true);
22873
+ }
22874
+ // Attachments (RAG-attach-1) - paperclip stays hidden
22875
+ // unless the operator explicitly opted in via
22876
+ // MasterAgent.config.chatFeatures.
22877
+ ,
22878
+ chatFeatures: chatFeatures,
22879
+ apiEndpoint: apiBaseUrl,
22880
+ organizationId: organizationId,
22881
+ conversationId: conversationId
22882
+ })]
22771
22883
  })]
22772
22884
  })]
22773
- })]
22885
+ })
22774
22886
  });
22775
22887
  };
22776
22888
 
@@ -23089,7 +23201,7 @@
23089
23201
  * value by its own test (that constant sat at 0.1.113 while this package was
23090
23202
  * at 0.2.2 precisely because nothing enforced it - EV-2431).
23091
23203
  */
23092
- const WIDGET_VERSION = '0.2.35';
23204
+ const WIDGET_VERSION = '0.2.36';
23093
23205
 
23094
23206
  /**
23095
23207
  * API utility functions