@microsoft/omnichannel-chat-widget 1.8.4-main.cbab5fc → 1.8.4-main.cd79f08
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/README.md +12 -3
- package/lib/cjs/common/Constants.js +2 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +235 -9
- package/lib/cjs/common/telemetry/TelemetryConstants.js +13 -0
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/cjs/common/utils/xssUtils.js +23 -51
- package/lib/cjs/common/utils.js +15 -2
- package/lib/cjs/components/errorboundary/ErrorBoundary.js +2 -1
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +9 -1
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +1 -0
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +9 -0
- package/lib/cjs/components/livechatwidget/common/authHelper.js +44 -4
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +3 -2
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +31 -14
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +62 -2
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +42 -27
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +117 -16
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +13 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +160 -167
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +6 -1
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/controller/componentController.js +13 -1
- package/lib/cjs/plugins/newMessageEventHandler.js +20 -3
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +236 -10
- package/lib/esm/common/telemetry/TelemetryConstants.js +13 -0
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/esm/common/utils/xssUtils.js +23 -51
- package/lib/esm/common/utils.js +12 -1
- package/lib/esm/components/errorboundary/ErrorBoundary.js +4 -2
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +9 -1
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +1 -0
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +9 -0
- package/lib/esm/components/livechatwidget/common/authHelper.js +44 -4
- package/lib/esm/components/livechatwidget/common/createAdapter.js +3 -2
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
- package/lib/esm/components/livechatwidget/common/startChat.js +31 -14
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +62 -2
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +1 -2
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +43 -28
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +117 -16
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +13 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +160 -171
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +6 -1
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/controller/componentController.js +13 -1
- package/lib/esm/plugins/newMessageEventHandler.js +20 -3
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +29 -0
- package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +13 -2
- package/lib/types/common/utils/xssUtils.d.ts +5 -21
- package/lib/types/common/utils.d.ts +9 -1
- package/lib/types/components/errorboundary/ErrorBoundary.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +9 -2
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
- package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +14 -38
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +15 -6
|
@@ -21,7 +21,7 @@ import { defaultSentMessageAnchorStyles } from "./webchatcontroller/middlewares/
|
|
|
21
21
|
import { defaultSystemMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles";
|
|
22
22
|
import { defaultUserMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles";
|
|
23
23
|
import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
24
|
-
import {
|
|
24
|
+
import { shouldLoadPersistentChatHistory } from "../livechatwidget/common/liveChatConfigUtils";
|
|
25
25
|
import { useChatContextStore } from "../..";
|
|
26
26
|
import useFacadeSDKStore from "../../hooks/useFacadeChatSDKStore";
|
|
27
27
|
import usePersistentChatHistory from "./hooks/usePersistentChatHistory";
|
|
@@ -53,7 +53,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
export const WebChatContainerStateful = props => {
|
|
56
|
-
var _props$webChatContain, _defaultWebChatContai,
|
|
56
|
+
var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _webChatContainerProp24, _webChatContainerProp25, _webChatContainerProp26, _webChatContainerProp27, _webChatContainerProp28, _webChatContainerProp29, _props$webChatContain10, _props$webChatContain11, _webChatContainerProp30, _webChatContainerProp31, _webChatContainerProp32, _webChatContainerProp33, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
|
|
57
57
|
const [facadeChatSDK] = useFacadeSDKStore();
|
|
58
58
|
|
|
59
59
|
// Create a font family that includes emoji support, based on the primary font or default
|
|
@@ -87,12 +87,9 @@ export const WebChatContainerStateful = props => {
|
|
|
87
87
|
|
|
88
88
|
// Type the chatConfig properly to avoid 'any' usage
|
|
89
89
|
const extendedChatConfig = props.chatConfig;
|
|
90
|
-
const isHistoryEnabledInConfig = extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L === void 0 ? void 0 : _extendedChatConfig$L.msdyn_enablepersistentchatpreviousconversations;
|
|
91
|
-
const isHistoryEnabledViaFCB = extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L2 = extendedChatConfig.LcwFcbConfiguration) === null || _extendedChatConfig$L2 === void 0 ? void 0 : _extendedChatConfig$L2.lcwPersistentChatHistoryEnabled;
|
|
92
|
-
const isPersistentChatEnabledForWidget = !!(extendedChatConfig !== null && extendedChatConfig !== void 0 && (_extendedChatConfig$L3 = extendedChatConfig.LiveChatConfigAuthSettings) !== null && _extendedChatConfig$L3 !== void 0 && _extendedChatConfig$L3.msdyn_javascriptclientfunction) || isPersistentChatEnabled(extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L4 = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L4 === void 0 ? void 0 : _extendedChatConfig$L4.msdyn_conversationmode);
|
|
93
90
|
|
|
94
|
-
//
|
|
95
|
-
const shouldLoadPersistentHistoryMessages =
|
|
91
|
+
// Determine if persistent chat history should be loaded based on all conditions
|
|
92
|
+
const shouldLoadPersistentHistoryMessages = shouldLoadPersistentChatHistory(extendedChatConfig);
|
|
96
93
|
if (shouldLoadPersistentHistoryMessages) {
|
|
97
94
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
98
95
|
Event: TelemetryEvent.PersistentChatHistoryEnabled
|
|
@@ -145,10 +142,18 @@ export const WebChatContainerStateful = props => {
|
|
|
145
142
|
document.addEventListener("click", clickHandler);
|
|
146
143
|
return () => document.removeEventListener("click", clickHandler);
|
|
147
144
|
}, [state]);
|
|
145
|
+
const minimizedStyles = state.appStates.isMinimized ? shouldLoadPersistentHistoryMessages ? {
|
|
146
|
+
visibility: "hidden",
|
|
147
|
+
position: "absolute",
|
|
148
|
+
width: 0,
|
|
149
|
+
height: 0,
|
|
150
|
+
overflow: "hidden",
|
|
151
|
+
pointerEvents: "none"
|
|
152
|
+
} : {
|
|
153
|
+
display: "none"
|
|
154
|
+
} : {};
|
|
148
155
|
const containerStyles = {
|
|
149
|
-
root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles,
|
|
150
|
-
display: state.appStates.isMinimized ? "none" : ""
|
|
151
|
-
}) // Use this instead of removing WebChat from the picture so that the activity observer inside the adapter is not invoked
|
|
156
|
+
root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, minimizedStyles) // Use visibility-based hiding instead of display:none to preserve scroll position across minimize/maximize
|
|
152
157
|
};
|
|
153
158
|
|
|
154
159
|
const localizedTexts = {
|
|
@@ -255,34 +260,37 @@ export const WebChatContainerStateful = props => {
|
|
|
255
260
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
256
261
|
.webchat__stacked-layout__content .ac-pushButton {
|
|
257
262
|
cursor: pointer;
|
|
263
|
+
border: 1px solid ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp === void 0 ? void 0 : _webChatContainerProp.color) ?? defaultAdaptiveCardStyles.color} !important;
|
|
264
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? defaultAdaptiveCardStyles.color} !important;
|
|
265
|
+
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp3 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp3 === void 0 ? void 0 : _webChatContainerProp3.background) ?? defaultAdaptiveCardStyles.background};
|
|
258
266
|
}
|
|
259
267
|
|
|
260
268
|
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card {
|
|
261
|
-
background: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
269
|
+
background: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp4 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp4 === void 0 ? void 0 : _webChatContainerProp4.background) ?? defaultAdaptiveCardStyles.background};
|
|
262
270
|
}
|
|
263
271
|
|
|
264
272
|
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock[role=heading] {
|
|
265
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
273
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp5 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp5 === void 0 ? void 0 : _webChatContainerProp5.color) ?? defaultAdaptiveCardStyles.color} !important;
|
|
266
274
|
}
|
|
267
275
|
|
|
268
276
|
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card label .ac-textRun:first-child {
|
|
269
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
277
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp6 === void 0 ? void 0 : _webChatContainerProp6.color) ?? defaultAdaptiveCardStyles.color} !important;
|
|
270
278
|
}
|
|
271
279
|
|
|
272
280
|
.webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__bubble--from-user {
|
|
273
|
-
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
281
|
+
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp7 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp7 === void 0 ? void 0 : (_webChatContainerProp8 = _webChatContainerProp7.userMessageBoxStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.maxWidth) ?? (defaultUserMessageBoxStyles === null || defaultUserMessageBoxStyles === void 0 ? void 0 : defaultUserMessageBoxStyles.maxWidth)}
|
|
274
282
|
}
|
|
275
283
|
|
|
276
284
|
.webchat__stacked-layout--show-avatar div.webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__stacked-layout__message {
|
|
277
|
-
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
285
|
+
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp9 === void 0 ? void 0 : (_webChatContainerProp10 = _webChatContainerProp9.systemMessageBoxStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.maxWidth) ?? (defaultSystemMessageBoxStyles === null || defaultSystemMessageBoxStyles === void 0 ? void 0 : defaultSystemMessageBoxStyles.maxWidth)}
|
|
278
286
|
}
|
|
279
287
|
|
|
280
288
|
div[class="ac-textBlock"] *,
|
|
281
|
-
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
289
|
+
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp11 === void 0 ? void 0 : _webChatContainerProp11.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
282
290
|
|
|
283
291
|
div[class="ac-input-container"] input.ac-multichoiceInput,
|
|
284
292
|
div[class="ac-input-container"] select.ac-multichoiceInput {
|
|
285
|
-
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (
|
|
293
|
+
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp12 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp12 !== void 0 && _webChatContainerProp12.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
|
|
286
294
|
}
|
|
287
295
|
|
|
288
296
|
.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 {
|
|
@@ -294,15 +302,22 @@ export const WebChatContainerStateful = props => {
|
|
|
294
302
|
div[class="ac-textBlock"] a:visited,
|
|
295
303
|
div[class="ac-textBlock"] a:hover,
|
|
296
304
|
div[class="ac-textBlock"] a:active {
|
|
297
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
305
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp13 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp13 === void 0 ? void 0 : _webChatContainerProp13.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
|
|
298
306
|
}
|
|
299
307
|
|
|
300
|
-
.webchat__stacked-layout__content .ac-actionSet
|
|
308
|
+
.webchat__stacked-layout__content .ac-actionSet {
|
|
309
|
+
flex-wrap: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp14 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp14 === void 0 ? void 0 : _webChatContainerProp14.buttonFlexWrap) ?? defaultAdaptiveCardStyles.buttonFlexWrap} !important;
|
|
310
|
+
gap: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp15 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp15 === void 0 ? void 0 : _webChatContainerProp15.buttonGap) ?? defaultAdaptiveCardStyles.buttonGap} !important;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {
|
|
314
|
+
white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp16 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp16 === void 0 ? void 0 : _webChatContainerProp16.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;
|
|
315
|
+
}
|
|
301
316
|
|
|
302
317
|
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
303
318
|
/* Fallback for browsers that don't support mask */
|
|
304
319
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjRkZGRkZGIiAvPjwvc3ZnPg==);
|
|
305
|
-
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
320
|
+
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp17 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp17 === void 0 ? void 0 : (_webChatContainerProp18 = _webChatContainerProp17.receivedMessageAnchorStyles) === null || _webChatContainerProp18 === void 0 ? void 0 : _webChatContainerProp18.filter) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.filter)};
|
|
306
321
|
height: .75em;
|
|
307
322
|
width: .75em;
|
|
308
323
|
margin-left: .25em;
|
|
@@ -312,7 +327,7 @@ export const WebChatContainerStateful = props => {
|
|
|
312
327
|
.ms_lcw_webchat_sent_message img.webchat__render-markdown__external-link-icon {
|
|
313
328
|
/* Fallback for browsers that don't support mask */
|
|
314
329
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjRkZGRkZGIiAvPjwvc3ZnPg==);
|
|
315
|
-
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
330
|
+
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp19 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp19 === void 0 ? void 0 : (_webChatContainerProp20 = _webChatContainerProp19.sentMessageAnchorStyles) === null || _webChatContainerProp20 === void 0 ? void 0 : _webChatContainerProp20.filter) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.filter)};
|
|
316
331
|
height: .75em;
|
|
317
332
|
width: .75em;
|
|
318
333
|
margin-left: .25em;
|
|
@@ -322,7 +337,7 @@ export const WebChatContainerStateful = props => {
|
|
|
322
337
|
/* Modern browsers with mask support */
|
|
323
338
|
@supports (mask: url()) or (-webkit-mask: url()) {
|
|
324
339
|
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
325
|
-
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
340
|
+
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp21 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp21 === void 0 ? void 0 : (_webChatContainerProp22 = _webChatContainerProp21.receivedMessageAnchorStyles) === null || _webChatContainerProp22 === void 0 ? void 0 : _webChatContainerProp22.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)} !important;
|
|
326
341
|
background-image: none !important;
|
|
327
342
|
filter: none !important;
|
|
328
343
|
mask: url("data:image/svg+xml,%3Csvg viewBox='3 3 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.2501 4.50017H10.7495C11.1637 4.50017 11.4995 4.83596 11.4995 5.25017C11.4995 5.62986 11.2173 5.94366 10.8513 5.99332L10.7495 6.00017H7.24974C6.07079 5.99961 5.10349 6.90656 5.00786 8.06112L5.00028 8.22003L5.00312 16.7507C5.00343 17.9415 5.92885 18.9161 7.09966 18.9949L7.25371 19.0001L15.7518 18.9884C16.9415 18.9868 17.9145 18.062 17.9935 16.8923L17.9987 16.7384V13.2321C17.9987 12.8179 18.3345 12.4821 18.7487 12.4821C19.1284 12.4821 19.4422 12.7643 19.4918 13.1303L19.4987 13.2321V16.7384C19.4987 18.7407 17.9293 20.3769 15.9528 20.4829L15.7538 20.4884L7.25827 20.5001L7.05495 20.4949C5.14239 20.3954 3.60895 18.8627 3.50837 16.9502L3.50312 16.7511L3.50089 8.2527L3.50529 8.0502C3.60539 6.13749 5.13867 4.60449 7.05096 4.50527L7.2501 4.50017H10.7495H7.2501ZM13.7481 3.00146L20.3018 3.00197L20.4014 3.01575L20.5022 3.04393L20.559 3.06803C20.6122 3.09122 20.6634 3.12163 20.7111 3.15885L20.7804 3.22156L20.8641 3.32014L20.9183 3.41025L20.957 3.50057L20.9762 3.56476L20.9898 3.62862L20.9992 3.72282L20.9997 10.2554C20.9997 10.6696 20.6639 11.0054 20.2497 11.0054C19.87 11.0054 19.5562 10.7232 19.5065 10.3571L19.4997 10.2554L19.4989 5.56147L12.2797 12.7847C12.0134 13.051 11.5968 13.0753 11.3031 12.8575L11.219 12.7849C10.9527 12.5187 10.9284 12.1021 11.1462 11.8084L11.2188 11.7243L18.4369 4.50146H13.7481C13.3684 4.50146 13.0546 4.21931 13.005 3.85324L12.9981 3.75146C12.9981 3.37177 13.2803 3.05797 13.6464 3.00831L13.7481 3.00146Z' fill='currentColor' /%3E%3C/svg%3E") no-repeat center;
|
|
@@ -332,7 +347,7 @@ export const WebChatContainerStateful = props => {
|
|
|
332
347
|
}
|
|
333
348
|
|
|
334
349
|
.ms_lcw_webchat_sent_message img.webchat__render-markdown__external-link-icon {
|
|
335
|
-
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
350
|
+
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp23 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp23 === void 0 ? void 0 : (_webChatContainerProp24 = _webChatContainerProp23.sentMessageAnchorStyles) === null || _webChatContainerProp24 === void 0 ? void 0 : _webChatContainerProp24.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)} !important;
|
|
336
351
|
background-image: none !important;
|
|
337
352
|
filter: none !important;
|
|
338
353
|
mask: url("data:image/svg+xml,%3Csvg viewBox='3 3 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.2501 4.50017H10.7495C11.1637 4.50017 11.4995 4.83596 11.4995 5.25017C11.4995 5.62986 11.2173 5.94366 10.8513 5.99332L10.7495 6.00017H7.24974C6.07079 5.99961 5.10349 6.90656 5.00786 8.06112L5.00028 8.22003L5.00312 16.7507C5.00343 17.9415 5.92885 18.9161 7.09966 18.9949L7.25371 19.0001L15.7518 18.9884C16.9415 18.9868 17.9145 18.062 17.9935 16.8923L17.9987 16.7384V13.2321C17.9987 12.8179 18.3345 12.4821 18.7487 12.4821C19.1284 12.4821 19.4422 12.7643 19.4918 13.1303L19.4987 13.2321V16.7384C19.4987 18.7407 17.9293 20.3769 15.9528 20.4829L15.7538 20.4884L7.25827 20.5001L7.05495 20.4949C5.14239 20.3954 3.60895 18.8627 3.50837 16.9502L3.50312 16.7511L3.50089 8.2527L3.50529 8.0502C3.60539 6.13749 5.13867 4.60449 7.05096 4.50527L7.2501 4.50017H10.7495H7.2501ZM13.7481 3.00146L20.3018 3.00197L20.4014 3.01575L20.5022 3.04393L20.559 3.06803C20.6122 3.09122 20.6634 3.12163 20.7111 3.15885L20.7804 3.22156L20.8641 3.32014L20.9183 3.41025L20.957 3.50057L20.9762 3.56476L20.9898 3.62862L20.9992 3.72282L20.9997 10.2554C20.9997 10.6696 20.6639 11.0054 20.2497 11.0054C19.87 11.0054 19.5562 10.7232 19.5065 10.3571L19.4997 10.2554L19.4989 5.56147L12.2797 12.7847C12.0134 13.051 11.5968 13.0753 11.3031 12.8575L11.219 12.7849C10.9527 12.5187 10.9284 12.1021 11.1462 11.8084L11.2188 11.7243L18.4369 4.50146H13.7481C13.3684 4.50146 13.0546 4.21931 13.005 3.85324L12.9981 3.75146C12.9981 3.37177 13.2803 3.05797 13.6464 3.00831L13.7481 3.00146Z' fill='currentColor' /%3E%3C/svg%3E") no-repeat center;
|
|
@@ -350,18 +365,18 @@ export const WebChatContainerStateful = props => {
|
|
|
350
365
|
.ms_lcw_webchat_received_message a:visited,
|
|
351
366
|
.ms_lcw_webchat_received_message a:hover,
|
|
352
367
|
.ms_lcw_webchat_received_message a:active {
|
|
353
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
368
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp25 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp25 === void 0 ? void 0 : (_webChatContainerProp26 = _webChatContainerProp25.receivedMessageAnchorStyles) === null || _webChatContainerProp26 === void 0 ? void 0 : _webChatContainerProp26.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
|
|
354
369
|
}
|
|
355
370
|
.ms_lcw_webchat_sent_message a:link,
|
|
356
371
|
.ms_lcw_webchat_sent_message a:visited,
|
|
357
372
|
.ms_lcw_webchat_sent_message a:hover,
|
|
358
373
|
.ms_lcw_webchat_sent_message a:active {
|
|
359
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
374
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp27 === void 0 ? void 0 : (_webChatContainerProp28 = _webChatContainerProp27.sentMessageAnchorStyles) === null || _webChatContainerProp28 === void 0 ? void 0 : _webChatContainerProp28.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
|
|
360
375
|
}
|
|
361
376
|
|
|
362
377
|
// we had a nasty bug long time ago with crashing borders messing with the sendbox, so if customer adds this value, they need to deal with that
|
|
363
378
|
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
364
|
-
border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
379
|
+
border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp29 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp29 === void 0 ? void 0 : _webChatContainerProp29.bubbleBorderRadius) ?? 0} !important; /* Override border-radius */
|
|
365
380
|
}
|
|
366
381
|
|
|
367
382
|
.webchat__stacked-layout_container>div {
|
|
@@ -398,8 +413,8 @@ export const WebChatContainerStateful = props => {
|
|
|
398
413
|
|
|
399
414
|
/* Suggested actions carousel previous/next navigation focus */
|
|
400
415
|
.webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
|
|
401
|
-
outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
402
|
-
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
416
|
+
outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp30 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp30 === void 0 ? void 0 : _webChatContainerProp30.suggestedActionKeyboardFocusIndicatorBorderStyle) ?? "dashed"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp31 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp31 === void 0 ? void 0 : _webChatContainerProp31.suggestedActionKeyboardFocusIndicatorBorderWidth) ?? "1px"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp32 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp32 === void 0 ? void 0 : _webChatContainerProp32.suggestedActionKeyboardFocusIndicatorBorderColor) ?? "#605E5C"} !important;
|
|
417
|
+
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp33 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp33 === void 0 ? void 0 : _webChatContainerProp33.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
|
|
403
418
|
|
|
404
419
|
`), /*#__PURE__*/React.createElement(Stack, {
|
|
405
420
|
styles: containerStyles,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Constants } from "../../../../common/Constants";
|
|
2
|
+
import { SupportedAdaptiveCards } from "@microsoft/omnichannel-chat-sdk/lib/utils/printers/interfaces/SupportedAdaptiveCards";
|
|
2
3
|
import botActivity from "../activities/botActivity";
|
|
3
4
|
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -17,15 +18,24 @@ const convertStringValueToInt = value => {
|
|
|
17
18
|
|
|
18
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
20
|
const convertPersistentChatHistoryMessageToActivity = message => {
|
|
20
|
-
var _from$user, _from$
|
|
21
|
+
var _from$application, _from$user, _from$application2;
|
|
21
22
|
const {
|
|
22
23
|
additionalData,
|
|
23
24
|
attachments,
|
|
25
|
+
botContentType,
|
|
24
26
|
content,
|
|
25
27
|
created,
|
|
26
28
|
from,
|
|
27
29
|
transcriptOriginalMessageId
|
|
28
30
|
} = message;
|
|
31
|
+
const isFromCustomer = (from === null || from === void 0 ? void 0 : (_from$application = from.application) === null || _from$application === void 0 ? void 0 : _from$application.displayName) === "Customer";
|
|
32
|
+
|
|
33
|
+
// Filter out customer responses to adaptive cards (e.g., form submissions like {"value":{"goPaperless":"yes"}}).
|
|
34
|
+
// These are the customer's postBack/messageBack replies to bot adaptive cards — not displayable content.
|
|
35
|
+
// In live chat, webchat hides these natively; in history we must filter them explicitly.
|
|
36
|
+
if (isFromCustomer && botContentType === "azurebotservice.adaptivecard") {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
29
39
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
40
|
const activity = {
|
|
31
41
|
...botActivity,
|
|
@@ -47,20 +57,14 @@ const convertPersistentChatHistoryMessageToActivity = message => {
|
|
|
47
57
|
}
|
|
48
58
|
}
|
|
49
59
|
if (additionalData !== null && additionalData !== void 0 && additionalData.tags) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const formattedTags = additionalData.tags.split(",");
|
|
59
|
-
activity.channelData = {
|
|
60
|
-
...activity.channelData,
|
|
61
|
-
tags: [...activity.channelData.tags, ...formattedTags]
|
|
62
|
-
};
|
|
63
|
-
}
|
|
60
|
+
const formattedTags = additionalData.tags.split(",");
|
|
61
|
+
activity.channelData = {
|
|
62
|
+
...activity.channelData,
|
|
63
|
+
tags: [...activity.channelData.tags, ...formattedTags]
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (additionalData !== null && additionalData !== void 0 && additionalData.ConversationId) {
|
|
67
|
+
activity.channelData.conversationId = additionalData.ConversationId;
|
|
64
68
|
}
|
|
65
69
|
if (from !== null && from !== void 0 && (_from$user = from.user) !== null && _from$user !== void 0 && _from$user.displayName) {
|
|
66
70
|
activity.from = {
|
|
@@ -68,13 +72,110 @@ const convertPersistentChatHistoryMessageToActivity = message => {
|
|
|
68
72
|
name: from.user.displayName
|
|
69
73
|
};
|
|
70
74
|
}
|
|
71
|
-
if ((from === null || from === void 0 ? void 0 : (_from$
|
|
75
|
+
if ((from === null || from === void 0 ? void 0 : (_from$application2 = from.application) === null || _from$application2 === void 0 ? void 0 : _from$application2.displayName) === "Customer") {
|
|
72
76
|
activity.from = {
|
|
73
77
|
role: "user",
|
|
74
78
|
name: from.application.displayName
|
|
75
79
|
};
|
|
76
80
|
}
|
|
77
81
|
if (content) {
|
|
82
|
+
var _parsedContent, _parsedContent$value;
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
|
+
let parsedContent;
|
|
85
|
+
try {
|
|
86
|
+
parsedContent = JSON.parse(content);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
parsedContent = null; // fall back to normal text handling
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Check if this is a customer form submission response (e.g., RichObjectMessage_Form)
|
|
92
|
+
// These should be ignored as they are form submission data, not displayable content
|
|
93
|
+
if (isFromCustomer && ((_parsedContent = parsedContent) === null || _parsedContent === void 0 ? void 0 : (_parsedContent$value = _parsedContent.value) === null || _parsedContent$value === void 0 ? void 0 : _parsedContent$value.type) === "RichObjectMessage_Form") {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
if (parsedContent && typeof parsedContent === "object") {
|
|
97
|
+
var _parsedContent$sugges;
|
|
98
|
+
// Structural detection: check the parsed object's properties directly
|
|
99
|
+
const hasAttachments = Array.isArray(parsedContent.attachments) && parsedContent.attachments.length > 0;
|
|
100
|
+
const hasSuggestedActions = Array.isArray((_parsedContent$sugges = parsedContent.suggestedActions) === null || _parsedContent$sugges === void 0 ? void 0 : _parsedContent$sugges.actions) && parsedContent.suggestedActions.actions.length > 0;
|
|
101
|
+
const isRawAdaptiveCardBody = parsedContent.type === "AdaptiveCard";
|
|
102
|
+
|
|
103
|
+
// Filter out suggested-action-only messages from history.
|
|
104
|
+
// WebChat only renders suggestedActions for the most recent activity, so in history
|
|
105
|
+
// these render as empty "Suggested reply" text bubbles with no actionable buttons.
|
|
106
|
+
if (hasSuggestedActions && !hasAttachments) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Substring detection: check the raw content string for known card type patterns
|
|
111
|
+
const contentLower = content.toLowerCase();
|
|
112
|
+
const isAdaptiveCard = contentLower.includes(Constants.AdaptiveCardType);
|
|
113
|
+
const isSuggestedActions = contentLower.includes(Constants.SuggestedActionsType);
|
|
114
|
+
const containsSupportedCard = Object.values(SupportedAdaptiveCards).some(type => contentLower.includes(type.toLowerCase()));
|
|
115
|
+
|
|
116
|
+
// If the content is a raw adaptive card body (type: "AdaptiveCard"), wrap it as an attachment
|
|
117
|
+
// so webchat can render it properly instead of treating it as an unknown activity type
|
|
118
|
+
if (isRawAdaptiveCardBody) {
|
|
119
|
+
return {
|
|
120
|
+
...activity,
|
|
121
|
+
text: "",
|
|
122
|
+
attachments: [{
|
|
123
|
+
contentType: SupportedAdaptiveCards.Adaptive,
|
|
124
|
+
content: parsedContent
|
|
125
|
+
}],
|
|
126
|
+
timestamp,
|
|
127
|
+
channelData: {
|
|
128
|
+
...activity.channelData,
|
|
129
|
+
"webchat:sequence-id": webchatSequenceId
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Detect rich content using both structural checks and substring matching
|
|
135
|
+
if (hasAttachments || hasSuggestedActions || isAdaptiveCard || isSuggestedActions || containsSupportedCard) {
|
|
136
|
+
var _activity$from;
|
|
137
|
+
// Preserve from.role from the base activity — parsedContent.from may lack the role property
|
|
138
|
+
// which webchat needs to determine how to render the message (bot vs user)
|
|
139
|
+
const preservedFrom = {
|
|
140
|
+
...activity.from,
|
|
141
|
+
...(parsedContent.from || {}),
|
|
142
|
+
role: ((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) || "bot"
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
...activity,
|
|
146
|
+
...parsedContent,
|
|
147
|
+
from: preservedFrom,
|
|
148
|
+
timestamp,
|
|
149
|
+
channelData: {
|
|
150
|
+
...activity.channelData,
|
|
151
|
+
"webchat:sequence-id": webchatSequenceId
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// If parsedContent is a webchat activity (type: "message") but didn't match any specific card check,
|
|
157
|
+
// still treat it as a rich activity to avoid displaying raw JSON as text
|
|
158
|
+
if (parsedContent.type === "message" && (parsedContent.attachments || parsedContent.suggestedActions || parsedContent.value)) {
|
|
159
|
+
var _activity$from2;
|
|
160
|
+
const preservedFrom = {
|
|
161
|
+
...activity.from,
|
|
162
|
+
...(parsedContent.from || {}),
|
|
163
|
+
role: ((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) || "bot"
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
...activity,
|
|
167
|
+
...parsedContent,
|
|
168
|
+
from: preservedFrom,
|
|
169
|
+
timestamp,
|
|
170
|
+
channelData: {
|
|
171
|
+
...activity.channelData,
|
|
172
|
+
"webchat:sequence-id": webchatSequenceId
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Plain text message
|
|
78
179
|
return {
|
|
79
180
|
...activity,
|
|
80
181
|
text: content,
|
package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js
CHANGED
|
@@ -70,15 +70,26 @@ const WebChatEventSubscribers = () => {
|
|
|
70
70
|
// Dispatch events when connection is established
|
|
71
71
|
setTimeout(() => {
|
|
72
72
|
dispatchCustomEvent(ChatWidgetEvents.FETCH_PERSISTENT_CHAT_HISTORY);
|
|
73
|
+
// The trigger activity renders the "Loading previous messages..." banner
|
|
74
|
+
// via LazyLoadActivity. We set webchat:sequence-id to 1 and timestamp
|
|
75
|
+
// to epoch+1ms so WebChat sorts this activity BEFORE all history messages
|
|
76
|
+
// (which have sequence-ids based on transcriptOriginalMessageId timestamps).
|
|
77
|
+
// Without these, WebChat places activities without a sequence-id at the
|
|
78
|
+
// end of the transcript, causing the banner to appear at the bottom and
|
|
79
|
+
// breaking the IntersectionObserver pagination trigger (the observer only
|
|
80
|
+
// fires on visibility transitions — if the element starts visible at the
|
|
81
|
+
// bottom, the initial fire is blocked by the paused state and never
|
|
82
|
+
// re-fires since there is no transition).
|
|
73
83
|
dispatchCustomEvent(ChatWidgetEvents.ADD_ACTIVITY, {
|
|
74
84
|
activity: {
|
|
75
85
|
from: {
|
|
76
86
|
role: "bot"
|
|
77
87
|
},
|
|
78
|
-
timestamp:
|
|
88
|
+
timestamp: new Date(1).toISOString(),
|
|
79
89
|
type: "message",
|
|
80
90
|
channelData: {
|
|
81
|
-
tags: [Constants.persistentChatHistoryMessagePullTriggerTag]
|
|
91
|
+
tags: [Constants.persistentChatHistoryMessagePullTriggerTag],
|
|
92
|
+
"webchat:sequence-id": 1
|
|
82
93
|
}
|
|
83
94
|
}
|
|
84
95
|
});
|