@microsoft/omnichannel-chat-widget 1.8.3-main.ec1328d → 1.8.3
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/lib/cjs/common/Constants.js +2 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +199 -0
- package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
- package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/cjs/components/livechatwidget/common/endChat.js +21 -2
- package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +1 -1
- package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/cjs/components/livechatwidget/common/startChat.js +5 -4
- package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +29 -5
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +96 -11
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +36 -2
- package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +97 -30
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +46 -45
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/index.js +9 -1
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +188 -0
- package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
- package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/esm/components/livechatwidget/common/endChat.js +22 -3
- package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +1 -1
- package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/esm/components/livechatwidget/common/startChat.js +5 -4
- package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +29 -5
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +96 -12
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +32 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +98 -30
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +46 -45
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/index.js +1 -0
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -0
- package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
- package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
- package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
- package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
- package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
- package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +6 -1
- package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +3 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +46 -45
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
- /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
- /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
- /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const overridePropsOnMockIfApplicable = props => {
|
|
2
2
|
var _props$mock, _props$mock2;
|
|
3
3
|
if (props !== null && props !== void 0 && (_props$mock = props.mock) !== null && _props$mock !== void 0 && _props$mock.type && (props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type.toLowerCase()) === "designer") {
|
|
4
|
+
var _props$mock3, _props$mock3$mockMess;
|
|
4
5
|
if (!props.webChatContainerProps) {
|
|
5
6
|
props.webChatContainerProps = {};
|
|
6
7
|
}
|
|
@@ -16,7 +17,7 @@ const overridePropsOnMockIfApplicable = props => {
|
|
|
16
17
|
props.webChatContainerProps = {
|
|
17
18
|
...props.webChatContainerProps,
|
|
18
19
|
webChatProps: {
|
|
19
|
-
disabled:
|
|
20
|
+
disabled: !(props !== null && props !== void 0 && (_props$mock3 = props.mock) !== null && _props$mock3 !== void 0 && (_props$mock3$mockMess = _props$mock3.mockMessages) !== null && _props$mock3$mockMess !== void 0 && _props$mock3$mockMess.length),
|
|
20
21
|
...props.webChatContainerProps.webChatProps,
|
|
21
22
|
overrideLocalizedStrings: {
|
|
22
23
|
TEXT_INPUT_PLACEHOLDER: "Send a message . . .",
|
|
@@ -99,7 +99,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
99
99
|
|
|
100
100
|
// If minimized, maximize the chat, if the state is missing, consider it as minimized
|
|
101
101
|
if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) === undefined || (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.isMinimized) === true) {
|
|
102
|
-
var _state$domainStates3, _state$domainStates3$, _state$domainStates4, _state$domainStates4
|
|
102
|
+
var _state$domainStates3, _state$domainStates3$, _state$domainStates4, _state$domainStates4$, _TelemetryManager$Int;
|
|
103
103
|
dispatch({
|
|
104
104
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
105
105
|
payload: false
|
|
@@ -110,7 +110,8 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
110
110
|
eventName: BroadcastEvent.MaximizeChat,
|
|
111
111
|
payload: {
|
|
112
112
|
height: state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.widgetSize) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.height,
|
|
113
|
-
width: state === null || state === void 0 ? void 0 : (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.widgetSize) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.width
|
|
113
|
+
width: state === null || state === void 0 ? void 0 : (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.widgetSize) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.width,
|
|
114
|
+
runtimeId: TelemetryManager === null || TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.lcwRuntimeId
|
|
114
115
|
}
|
|
115
116
|
});
|
|
116
117
|
}
|
|
@@ -131,7 +132,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
131
132
|
* This is because a new change to control OOH as closed event when a widget is coming from chat.
|
|
132
133
|
*/
|
|
133
134
|
if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) === undefined || (state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.isMinimized) === true) {
|
|
134
|
-
var _state$domainStates5, _state$domainStates5$, _state$domainStates6, _state$domainStates6$, _TelemetryManager$
|
|
135
|
+
var _state$domainStates5, _state$domainStates5$, _state$domainStates6, _state$domainStates6$, _TelemetryManager$Int2;
|
|
135
136
|
dispatch({
|
|
136
137
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
137
138
|
payload: false
|
|
@@ -142,7 +143,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
142
143
|
payload: {
|
|
143
144
|
height: state === null || state === void 0 ? void 0 : (_state$domainStates5 = state.domainStates) === null || _state$domainStates5 === void 0 ? void 0 : (_state$domainStates5$ = _state$domainStates5.widgetSize) === null || _state$domainStates5$ === void 0 ? void 0 : _state$domainStates5$.height,
|
|
144
145
|
width: state === null || state === void 0 ? void 0 : (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.widgetSize) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.width,
|
|
145
|
-
runtimeId: TelemetryManager === null || TelemetryManager === void 0 ? void 0 : (_TelemetryManager$
|
|
146
|
+
runtimeId: TelemetryManager === null || TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int2 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.lcwRuntimeId
|
|
146
147
|
}
|
|
147
148
|
});
|
|
148
149
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
export let LiveChatWidgetMockType;
|
|
2
2
|
(function (LiveChatWidgetMockType) {
|
|
3
3
|
LiveChatWidgetMockType["Test"] = "Test";
|
|
4
4
|
LiveChatWidgetMockType["Demo"] = "Demo";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
LiveChatWidgetMockType["Designer"] = "Designer";
|
|
6
|
+
})(LiveChatWidgetMockType || (LiveChatWidgetMockType = {}));
|
|
@@ -480,7 +480,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
480
480
|
eventName: BroadcastEvent.MaximizeChat,
|
|
481
481
|
payload: {
|
|
482
482
|
height: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : (_inMemoryState$domain2 = _inMemoryState$domain.widgetSize) === null || _inMemoryState$domain2 === void 0 ? void 0 : _inMemoryState$domain2.height,
|
|
483
|
-
width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width
|
|
483
|
+
width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width,
|
|
484
|
+
lcwRuntimeId: TelemetryManager.InternalTelemetryData.lcwRuntimeId
|
|
484
485
|
}
|
|
485
486
|
});
|
|
486
487
|
return;
|
|
@@ -868,23 +869,46 @@ export const LiveChatWidgetStateful = props => {
|
|
|
868
869
|
|
|
869
870
|
// WebChat's Composer can only be rendered if a directLine object is defined
|
|
870
871
|
return directLine && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
871
|
-
::-webkit-scrollbar {
|
|
872
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
|
|
872
873
|
width: ${scrollbarProps.width};
|
|
873
874
|
}
|
|
874
875
|
|
|
875
|
-
::-webkit-scrollbar-track {
|
|
876
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
|
|
876
877
|
background: ${scrollbarProps.trackBackgroundColor};
|
|
877
878
|
}
|
|
878
879
|
|
|
879
|
-
::-webkit-scrollbar-thumb {
|
|
880
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
|
|
880
881
|
background: ${scrollbarProps.thumbBackgroundColor};
|
|
881
882
|
border-radius: ${scrollbarProps.thumbBorderRadius};
|
|
882
883
|
}
|
|
883
884
|
|
|
884
|
-
::-webkit-scrollbar-thumb:hover {
|
|
885
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
|
|
885
886
|
background: ${scrollbarProps.thumbHoverColor};
|
|
886
887
|
}
|
|
887
888
|
|
|
889
|
+
/* High Contrast mode support - optimized for all variants */
|
|
890
|
+
@media (prefers-contrast: high), (-ms-high-contrast: active), (forced-colors: active) {
|
|
891
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
|
|
892
|
+
background: Canvas !important;
|
|
893
|
+
border: 1px solid CanvasText !important;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
|
|
897
|
+
background: CanvasText !important;
|
|
898
|
+
border: 1px solid Canvas !important;
|
|
899
|
+
min-height: 20px !important;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
|
|
903
|
+
background: Highlight !important;
|
|
904
|
+
border: 1px solid CanvasText !important;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-corner {
|
|
908
|
+
background: Canvas !important;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
|
|
888
912
|
.webchat__basic-transcript__activity-markdown-body > :last-child {
|
|
889
913
|
margin-bottom: 0px;
|
|
890
914
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
|
|
3
1
|
import { Constants, HtmlAttributeNames, HtmlClassNames } from "../../common/Constants";
|
|
4
2
|
import { Stack } from "@fluentui/react";
|
|
5
3
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
6
|
-
import React, { useEffect } from "react";
|
|
4
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
7
5
|
import { createTimer, getDeviceType, setFocusOnSendBox } from "../../common/utils";
|
|
8
6
|
import { BotMagicCodeStore } from "./webchatcontroller/BotMagicCodeStore";
|
|
7
|
+
import CitationPaneStateful from "../citationpanestateful/CitationPaneStateful";
|
|
9
8
|
import { Components } from "botframework-webchat";
|
|
10
9
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
11
10
|
import { NotificationHandler } from "./webchatcontroller/notification/NotificationHandler";
|
|
@@ -13,6 +12,7 @@ import { NotificationScenarios } from "./webchatcontroller/enums/NotificationSce
|
|
|
13
12
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
14
13
|
import { WebChatActionType } from "./webchatcontroller/enums/WebChatActionType";
|
|
15
14
|
import { WebChatStoreLoader } from "./webchatcontroller/WebChatStoreLoader";
|
|
15
|
+
import { createIOSOptimizedEmojiFont } from "./common/utils/fontUtils";
|
|
16
16
|
import { defaultAdaptiveCardStyles } from "./common/defaultStyles/defaultAdaptiveCardStyles";
|
|
17
17
|
import { defaultMiddlewareLocalizedTexts } from "./common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
18
18
|
import { defaultReceivedMessageAnchorStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles";
|
|
@@ -23,6 +23,7 @@ import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defa
|
|
|
23
23
|
import { useChatContextStore } from "../..";
|
|
24
24
|
let uiTimer;
|
|
25
25
|
const broadcastChannelMessageEvent = "message";
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
27
|
const postActivity = activity => {
|
|
27
28
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
28
29
|
return {
|
|
@@ -48,13 +49,30 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
48
49
|
};
|
|
49
50
|
};
|
|
50
51
|
export const WebChatContainerStateful = props => {
|
|
51
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$
|
|
52
|
+
var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$webChatContain10, _props$webChatContain11, _webChatContainerProp24, _webChatContainerProp25, _webChatContainerProp26, _webChatContainerProp27, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
|
|
53
|
+
// Create a font family that includes emoji support, based on the primary font or default
|
|
54
|
+
const webChatStyles = ((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles) ?? defaultWebChatContainerStatefulProps.webChatStyles;
|
|
55
|
+
const primaryFont = (webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.primaryFont) ?? ((_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.primaryFont);
|
|
56
|
+
|
|
57
|
+
// Use iOS-optimized emoji font that prioritizes system-ui for proper emoji rendering
|
|
58
|
+
const fontFamilyWithEmojis = createIOSOptimizedEmojiFont(primaryFont);
|
|
52
59
|
useEffect(() => {
|
|
53
60
|
uiTimer = createTimer();
|
|
54
61
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
55
62
|
Event: TelemetryEvent.UXWebchatContainerCompleted
|
|
56
63
|
});
|
|
57
64
|
}, []);
|
|
65
|
+
|
|
66
|
+
// Citation pane state
|
|
67
|
+
const [citationPaneOpen, setCitationPaneOpen] = useState(false);
|
|
68
|
+
const [citationPaneText, setCitationPaneText] = useState("");
|
|
69
|
+
|
|
70
|
+
// Guard to prevent handling multiple rapid clicks which could cause
|
|
71
|
+
// the dim layer and pane to re-render out of sync and create a flicker.
|
|
72
|
+
const citationOpeningRef = useRef(false);
|
|
73
|
+
|
|
74
|
+
// ...existing code...
|
|
75
|
+
|
|
58
76
|
const {
|
|
59
77
|
BasicWebChat
|
|
60
78
|
} = Components;
|
|
@@ -63,6 +81,53 @@ export const WebChatContainerStateful = props => {
|
|
|
63
81
|
webChatContainerProps,
|
|
64
82
|
contextDataStore
|
|
65
83
|
} = props;
|
|
84
|
+
|
|
85
|
+
// Delegated click handler for citation anchors. Placed after state is
|
|
86
|
+
// available so we can prefer reading citations from app state and fall
|
|
87
|
+
// back to the legacy window map for backward-compatibility in tests.
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
const clickHandler = ev => {
|
|
90
|
+
try {
|
|
91
|
+
if (citationOpeningRef.current) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const target = ev.target;
|
|
95
|
+
// Only consider anchors whose href starts with the citation scheme
|
|
96
|
+
const anchor = target.closest && target.closest("a[href^=\"cite:\"]");
|
|
97
|
+
if (anchor) {
|
|
98
|
+
ev.preventDefault();
|
|
99
|
+
citationOpeningRef.current = true;
|
|
100
|
+
// Rely only on the href to identify the citation key
|
|
101
|
+
let text = "";
|
|
102
|
+
try {
|
|
103
|
+
var _state$domainStates;
|
|
104
|
+
const cid = anchor.getAttribute("href");
|
|
105
|
+
// Prefer state-based citations injected by middleware
|
|
106
|
+
if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.citations && cid) {
|
|
107
|
+
text = state.domainStates.citations[cid] ?? "";
|
|
108
|
+
}
|
|
109
|
+
// If state lookup failed, fall back to the anchor's title or innerText
|
|
110
|
+
if (!text) {
|
|
111
|
+
text = anchor.getAttribute("title") || anchor.innerText || "";
|
|
112
|
+
}
|
|
113
|
+
} catch (e) {
|
|
114
|
+
// ignore
|
|
115
|
+
}
|
|
116
|
+
setCitationPaneOpen(true);
|
|
117
|
+
setCitationPaneText(text);
|
|
118
|
+
|
|
119
|
+
// Simple debounce - reset guard after a short delay
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
citationOpeningRef.current = false;
|
|
122
|
+
}, 100);
|
|
123
|
+
}
|
|
124
|
+
} catch (e) {
|
|
125
|
+
citationOpeningRef.current = false;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
document.addEventListener("click", clickHandler);
|
|
129
|
+
return () => document.removeEventListener("click", clickHandler);
|
|
130
|
+
}, [state]);
|
|
66
131
|
const containerStyles = {
|
|
67
132
|
root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
|
|
68
133
|
display: state.appStates.isMinimized ? "none" : ""
|
|
@@ -74,7 +139,7 @@ export const WebChatContainerStateful = props => {
|
|
|
74
139
|
...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
|
|
75
140
|
};
|
|
76
141
|
useEffect(() => {
|
|
77
|
-
var _props$
|
|
142
|
+
var _props$webChatContain2, _props$webChatContain3;
|
|
78
143
|
if (getDeviceType() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
|
|
79
144
|
const chatHistoryElement = document.querySelector(`.${HtmlClassNames.webChatHistoryContainer}`);
|
|
80
145
|
if (chatHistoryElement) {
|
|
@@ -92,21 +157,23 @@ export const WebChatContainerStateful = props => {
|
|
|
92
157
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
93
158
|
Event: TelemetryEvent.WebChatLoaded
|
|
94
159
|
});
|
|
95
|
-
if (((_props$
|
|
160
|
+
if (((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.renderingMiddlewareProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.disableThirdPartyCookiesAlert) !== true && !contextDataStore) {
|
|
96
161
|
try {
|
|
97
162
|
localStorage;
|
|
98
163
|
sessionStorage;
|
|
99
164
|
} catch (error) {
|
|
165
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
166
|
if (!window.TPCWarningShown) {
|
|
101
167
|
NotificationHandler.notifyWarning(NotificationScenarios.TPC, (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE) ?? "");
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
102
169
|
window.TPCWarningShown = true;
|
|
103
170
|
}
|
|
104
171
|
}
|
|
105
172
|
}
|
|
106
173
|
}, []);
|
|
107
174
|
useEffect(() => {
|
|
108
|
-
var _props$
|
|
109
|
-
if (!((_props$
|
|
175
|
+
var _props$webChatContain4, _props$webChatContain5;
|
|
176
|
+
if (!((_props$webChatContain4 = props.webChatContainerProps) !== null && _props$webChatContain4 !== void 0 && (_props$webChatContain5 = _props$webChatContain4.botMagicCode) !== null && _props$webChatContain5 !== void 0 && _props$webChatContain5.disabled)) {
|
|
110
177
|
return;
|
|
111
178
|
}
|
|
112
179
|
if (!window.BroadcastChannel) {
|
|
@@ -198,8 +265,8 @@ export const WebChatContainerStateful = props => {
|
|
|
198
265
|
}
|
|
199
266
|
|
|
200
267
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
201
|
-
background-color: ${((_props$
|
|
202
|
-
color:${((_props$
|
|
268
|
+
background-color: ${((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : (_props$webChatContain7 = _props$webChatContain6.webChatStyles) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.bubbleBackground) ?? ((_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleBackground)};
|
|
269
|
+
color:${((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : (_props$webChatContain9 = _props$webChatContain8.webChatStyles) === null || _props$webChatContain9 === void 0 ? void 0 : _props$webChatContain9.bubbleTextColor) ?? ((_defaultWebChatContai3 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.bubbleTextColor)};
|
|
203
270
|
}
|
|
204
271
|
|
|
205
272
|
div[class="ac-textBlock"] a:link,
|
|
@@ -277,7 +344,7 @@ export const WebChatContainerStateful = props => {
|
|
|
277
344
|
}
|
|
278
345
|
|
|
279
346
|
.webchat__stacked-layout_container>div {
|
|
280
|
-
background: ${(props === null || props === void 0 ? void 0 : (_props$
|
|
347
|
+
background: ${(props === null || props === void 0 ? void 0 : (_props$webChatContain10 = props.webChatContainerProps) === null || _props$webChatContain10 === void 0 ? void 0 : (_props$webChatContain11 = _props$webChatContain10.containerStyles) === null || _props$webChatContain11 === void 0 ? void 0 : _props$webChatContain11.background) ?? ""}
|
|
281
348
|
}
|
|
282
349
|
.webchat__toast_text {
|
|
283
350
|
display: flex;
|
|
@@ -304,9 +371,26 @@ export const WebChatContainerStateful = props => {
|
|
|
304
371
|
height: 100% !important;
|
|
305
372
|
}
|
|
306
373
|
|
|
374
|
+
.webchat__auto-resize-textarea__textarea.webchat__send-box-text-box__html-text-area {
|
|
375
|
+
font-family: ${fontFamilyWithEmojis} !important;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/* Suggested actions carousel previous/next navigation focus */
|
|
379
|
+
.webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
|
|
380
|
+
outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp24 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp24 === void 0 ? void 0 : _webChatContainerProp24.suggestedActionKeyboardFocusIndicatorBorderStyle) ?? "dashed"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp25 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp25 === void 0 ? void 0 : _webChatContainerProp25.suggestedActionKeyboardFocusIndicatorBorderWidth) ?? "1px"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp26 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp26 === void 0 ? void 0 : _webChatContainerProp26.suggestedActionKeyboardFocusIndicatorBorderColor) ?? "#605E5C"} !important;
|
|
381
|
+
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp27 === void 0 ? void 0 : _webChatContainerProp27.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
|
|
382
|
+
|
|
307
383
|
`), /*#__PURE__*/React.createElement(Stack, {
|
|
308
384
|
styles: containerStyles,
|
|
309
385
|
className: "webchat__stacked-layout_container"
|
|
310
|
-
}, /*#__PURE__*/React.createElement(BasicWebChat, null))
|
|
386
|
+
}, /*#__PURE__*/React.createElement(BasicWebChat, null)), citationPaneOpen && /*#__PURE__*/React.createElement(CitationPaneStateful, {
|
|
387
|
+
id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || HtmlAttributeNames.ocwCitationPaneClassName,
|
|
388
|
+
title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || HtmlAttributeNames.ocwCitationPaneTitle,
|
|
389
|
+
contentHtml: citationPaneText,
|
|
390
|
+
onClose: () => setCitationPaneOpen(false),
|
|
391
|
+
componentOverrides: (_props$citationPanePr3 = props.citationPaneProps) === null || _props$citationPanePr3 === void 0 ? void 0 : _props$citationPanePr3.componentOverrides,
|
|
392
|
+
controlProps: (_props$citationPanePr4 = props.citationPaneProps) === null || _props$citationPanePr4 === void 0 ? void 0 : _props$citationPanePr4.controlProps,
|
|
393
|
+
styleProps: (_props$citationPanePr5 = props.citationPaneProps) === null || _props$citationPanePr5 === void 0 ? void 0 : _props$citationPanePr5.styleProps
|
|
394
|
+
}));
|
|
311
395
|
};
|
|
312
396
|
export default WebChatContainerStateful;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
2
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
3
3
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
5
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
4
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
7
5
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
8
6
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -10,28 +8,59 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
|
|
|
10
8
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
10
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
13
|
-
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
+
import { customerUser, postAgentAttachmentActivity, postAgentMessageActivity, postAgentSuggestedActionsActivity, postBotMessageActivity, postEchoActivity, postSystemMessageActivity } from "./utils/chatAdapterUtils";
|
|
14
15
|
import MockAdapter from "./mockadapter";
|
|
15
|
-
import {
|
|
16
|
+
import { Observable } from "rxjs/Observable";
|
|
16
17
|
export let DesignerChatAdapter = /*#__PURE__*/function (_MockAdapter) {
|
|
17
18
|
_inherits(DesignerChatAdapter, _MockAdapter);
|
|
18
19
|
var _super = _createSuper(DesignerChatAdapter);
|
|
19
|
-
function DesignerChatAdapter() {
|
|
20
|
+
function DesignerChatAdapter(messages) {
|
|
20
21
|
var _this;
|
|
21
22
|
_classCallCheck(this, DesignerChatAdapter);
|
|
22
23
|
_this = _super.call(this);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
_this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
_defineProperty(_assertThisInitialized(_this), "messages", void 0);
|
|
25
|
+
_this.messages = messages;
|
|
26
|
+
if (_this.messages) {
|
|
27
|
+
if (_this.messages.length > 0) {
|
|
28
|
+
setTimeout(() => {
|
|
29
|
+
var _this$messages;
|
|
30
|
+
(_this$messages = _this.messages) === null || _this$messages === void 0 ? void 0 : _this$messages.forEach((msg, index) => {
|
|
31
|
+
_this.processMessage(msg, index);
|
|
32
|
+
});
|
|
33
|
+
}, 1000); // Initial 1 second delay to ensure activityObserver is ready
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
// Default hardcoded flow
|
|
37
|
+
setTimeout(() => {
|
|
38
|
+
postBotMessageActivity(_this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
|
|
39
|
+
postBotMessageActivity(_this.activityObserver, "Please accept terms and conditions to proceed. Visit the link for terms and conditions <a href=\"\">here</a>.", undefined, 0);
|
|
40
|
+
_this.postUserActivity("I need to change my address.", 0);
|
|
41
|
+
postBotMessageActivity(_this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
|
|
42
|
+
postSystemMessageActivity(_this.activityObserver, "John has joined the chat", 100);
|
|
43
|
+
postAgentMessageActivity(_this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
|
|
44
|
+
_this.postUserActivity("I have trouble visiting the signin page <a href=\"\">signin</a>.", 0);
|
|
45
|
+
}, 1000);
|
|
46
|
+
}
|
|
32
47
|
return _this;
|
|
33
48
|
}
|
|
34
49
|
_createClass(DesignerChatAdapter, [{
|
|
50
|
+
key: "processMessage",
|
|
51
|
+
value: function processMessage(msg, index) {
|
|
52
|
+
if (msg.text) {
|
|
53
|
+
if (msg.suggestedActions) {
|
|
54
|
+
postAgentSuggestedActionsActivity(this.activityObserver, msg.text, msg.suggestedActions, index * 100);
|
|
55
|
+
} else {
|
|
56
|
+
postBotMessageActivity(this.activityObserver, msg.text, undefined, index * 100);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (msg.attachments && msg.attachments.length > 0) {
|
|
60
|
+
postAgentAttachmentActivity(this.activityObserver, msg.attachments, index * 100, msg.attachmentLayout);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
35
64
|
key: "postUserActivity",
|
|
36
65
|
value: function postUserActivity(text) {
|
|
37
66
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
@@ -20,13 +20,18 @@ export let DesignerChatSDK = /*#__PURE__*/function (_MockChatSDK) {
|
|
|
20
20
|
var _this;
|
|
21
21
|
_classCallCheck(this, DesignerChatSDK);
|
|
22
22
|
_this = _super.call(this);
|
|
23
|
+
/**
|
|
24
|
+
* Create a chat adapter for the designer. Uses this.mockMessages if set.
|
|
25
|
+
*/
|
|
26
|
+
_defineProperty(_assertThisInitialized(_this), "mockMessages", void 0);
|
|
23
27
|
_defineProperty(_assertThisInitialized(_this), "localeId", _this.getLiveChatConfig().ChatWidgetLanguage.msdyn_localeid);
|
|
24
28
|
return _this;
|
|
25
29
|
}
|
|
26
30
|
_createClass(DesignerChatSDK, [{
|
|
27
31
|
key: "createChatAdapter",
|
|
28
32
|
value: function createChatAdapter() {
|
|
29
|
-
|
|
33
|
+
const adapter = new DesignerChatAdapter(this.mockMessages);
|
|
34
|
+
return adapter;
|
|
30
35
|
}
|
|
31
36
|
}, {
|
|
32
37
|
key: "getLiveChatConfig",
|
package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js
CHANGED
|
@@ -17,7 +17,7 @@ export const defaultWebChatStyles = {
|
|
|
17
17
|
bubbleTextColor: "White",
|
|
18
18
|
hideSendBox: false,
|
|
19
19
|
hideUploadButton: true,
|
|
20
|
-
primaryFont: "Segoe UI, Arial, sans-serif",
|
|
20
|
+
primaryFont: "Segoe UI, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Noto Color Emoji\"",
|
|
21
21
|
rootHeight: "100%",
|
|
22
22
|
rootWidth: "100%",
|
|
23
23
|
sendBoxTextWrap: true,
|
|
@@ -97,4 +97,36 @@ export const postBotAttachmentActivity = function (activityObserver) {
|
|
|
97
97
|
timestamp: new Date().toISOString()
|
|
98
98
|
});
|
|
99
99
|
}, delay);
|
|
100
|
+
};
|
|
101
|
+
export const postAgentAttachmentActivity = function (activityObserver) {
|
|
102
|
+
let attachments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
103
|
+
let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
|
|
104
|
+
let attachmentLayout = arguments.length > 3 ? arguments[3] : undefined;
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
|
|
107
|
+
id: uuidv4(),
|
|
108
|
+
from: {
|
|
109
|
+
...agentUser
|
|
110
|
+
},
|
|
111
|
+
attachments,
|
|
112
|
+
attachmentLayout,
|
|
113
|
+
type: "message",
|
|
114
|
+
timestamp: new Date().toISOString()
|
|
115
|
+
});
|
|
116
|
+
}, delay);
|
|
117
|
+
};
|
|
118
|
+
export const postAgentSuggestedActionsActivity = function (activityObserver, text, suggestedActions) {
|
|
119
|
+
let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
|
|
122
|
+
id: uuidv4(),
|
|
123
|
+
from: {
|
|
124
|
+
...agentUser
|
|
125
|
+
},
|
|
126
|
+
text,
|
|
127
|
+
type: "message",
|
|
128
|
+
suggestedActions,
|
|
129
|
+
timestamp: new Date().toISOString()
|
|
130
|
+
});
|
|
131
|
+
}, delay);
|
|
100
132
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for font handling and emoji support
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates a font family optimized for iOS emoji support
|
|
7
|
+
* Uses system-ui as the primary font for better emoji rendering on iOS
|
|
8
|
+
* @param primaryFont - The base font family string (optional, used as fallback)
|
|
9
|
+
* @returns Font family string optimized for iOS emoji support
|
|
10
|
+
*/
|
|
11
|
+
export const createIOSOptimizedEmojiFont = primaryFont => {
|
|
12
|
+
// For iOS emoji support, system-ui should be first
|
|
13
|
+
const baseFont = "system-ui";
|
|
14
|
+
const emojiSupport = "\"Apple Color Emoji\", \"Segoe UI Emoji\"";
|
|
15
|
+
if (!primaryFont || primaryFont.includes("system-ui") || primaryFont.includes("Apple Color Emoji")) {
|
|
16
|
+
return `${baseFont}, ${emojiSupport}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Add configured font as fallback after emoji fonts
|
|
20
|
+
return `${baseFont}, ${emojiSupport}, ${primaryFont}`;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const defaultAvatarTextStyles = {
|
|
2
2
|
margin: "0",
|
|
3
|
-
fontFamily: "
|
|
3
|
+
fontFamily: "'Segoe UI', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Emoji', Arial, sans-serif",
|
|
4
4
|
fontWeight: 600,
|
|
5
5
|
fontSize: "13px",
|
|
6
6
|
lineHeight: "18px",
|
|
@@ -5,7 +5,7 @@ export const defaultSystemMessageStyles = {
|
|
|
5
5
|
fontSize: "12px",
|
|
6
6
|
borderRadius: 0,
|
|
7
7
|
minHeight: "auto",
|
|
8
|
-
fontFamily: "Segoe UI",
|
|
8
|
+
fontFamily: "'Segoe UI', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Emoji', Arial, sans-serif",
|
|
9
9
|
lineHeight: "16px",
|
|
10
10
|
padding: "0px 10px 0 10px"
|
|
11
11
|
};
|