@microsoft/omnichannel-chat-widget 1.8.3 → 1.8.4-main.424a580
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 +5 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
- package/lib/cjs/common/telemetry/AppInsightsEvents.js +4 -5
- package/lib/cjs/common/telemetry/TelemetryConstants.js +44 -2
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +26 -10
- package/lib/cjs/common/utils/SecureEventBus.js +307 -0
- package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +8 -2
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +127 -0
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +15 -0
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +287 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +18 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +7 -1
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +5 -1
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +24 -4
- package/lib/cjs/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +22 -3
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +29 -2
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -3
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +36 -5
- package/lib/cjs/components/webchatcontainerstateful/common/activities/botActivity.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +17 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +97 -0
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +59 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +122 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +47 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1038 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +34 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +50 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +20 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +59 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/cjs/plugins/newMessageEventHandler.js +4 -1
- package/lib/esm/common/Constants.js +5 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +4 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +42 -1
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +27 -11
- package/lib/esm/common/utils/SecureEventBus.js +328 -0
- package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -5
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +9 -3
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +120 -0
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +8 -0
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +280 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +11 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +7 -1
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +7 -3
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +23 -4
- package/lib/esm/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +23 -4
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +31 -4
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -4
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +39 -5
- package/lib/esm/components/webchatcontainerstateful/common/activities/botActivity.js +7 -0
- package/lib/esm/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +9 -0
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +90 -0
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +51 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +115 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +39 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1060 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +25 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +48 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +52 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +3 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/esm/plugins/newMessageEventHandler.js +4 -1
- package/lib/types/common/Constants.d.ts +4 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +39 -2
- package/lib/types/common/utils/SecureEventBus.d.ts +159 -0
- package/lib/types/common/utils/dispatchCustomEvent.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.d.ts +45 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/PersistentConversationHandler.d.ts +28 -0
- package/lib/types/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +12 -0
- package/lib/types/components/webchatcontainerstateful/common/activities/botActivity.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/common/activities/conversationDividerActivity.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/hooks/usePersistentChatHistory.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +326 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.d.ts +8 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +6 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +3 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { defaultInlineBannerStyle } from "../defaultStyles/defaultInLineBannerStyle";
|
|
3
|
+
import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
4
|
+
import { mergeStyles } from "@fluentui/merge-styles";
|
|
5
|
+
const LoadInlineBannerActivity = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
webChatContainerProps,
|
|
8
|
+
persistentChatHistory,
|
|
9
|
+
id
|
|
10
|
+
} = _ref;
|
|
11
|
+
const localizedTexts = useMemo(() => ({
|
|
12
|
+
...defaultMiddlewareLocalizedTexts,
|
|
13
|
+
...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
|
|
14
|
+
}), [webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts]);
|
|
15
|
+
const bannerStyle = mergeStyles(persistentChatHistory === null || persistentChatHistory === void 0 ? void 0 : persistentChatHistory.bannerStyle, defaultInlineBannerStyle);
|
|
16
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
id: id,
|
|
18
|
+
className: bannerStyle,
|
|
19
|
+
role: "status",
|
|
20
|
+
"aria-live": "polite",
|
|
21
|
+
"aria-label": localizedTexts.PREVIOUS_MESSAGES_LOADING,
|
|
22
|
+
"aria-busy": "true"
|
|
23
|
+
}, localizedTexts.PREVIOUS_MESSAGES_LOADING));
|
|
24
|
+
};
|
|
25
|
+
export default LoadInlineBannerActivity;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable react/display-name */
|
|
1
3
|
/******
|
|
2
4
|
* ActivityMiddleware
|
|
3
5
|
*
|
|
@@ -7,16 +9,20 @@
|
|
|
7
9
|
* 3. Decodes certain html characters that came through from chat services
|
|
8
10
|
******/
|
|
9
11
|
|
|
12
|
+
import LazyLoadActivity, { LazyLoadHandler } from "./activities/LazyLoadActivity";
|
|
10
13
|
import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
|
|
11
14
|
import { Constants } from "../../../../../common/Constants";
|
|
15
|
+
import ConversationDividerActivity from "./activities/ConversationDividerActivity";
|
|
12
16
|
import { DirectLineActivityType } from "../../enums/DirectLineActivityType";
|
|
13
17
|
import { DirectLineSenderRole } from "../../enums/DirectLineSenderRole";
|
|
14
18
|
import React from "react";
|
|
15
19
|
import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
|
|
20
|
+
import { defaultMiddlewareLocalizedTexts } from "../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
16
21
|
import { defaultSystemMessageStyles } from "./defaultStyles/defaultSystemMessageStyles";
|
|
17
22
|
import { defaultUserMessageStyles } from "./defaultStyles/defaultUserMessageStyles";
|
|
18
23
|
import { escapeHtml } from "../../../../../common/utils";
|
|
19
24
|
const loggedSystemMessages = new Array();
|
|
25
|
+
let lastRenderedAt = 0; // Track last rendered receivedAt timestamp for deduplication
|
|
20
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
27
|
const handleSystemMessage = (next, args, card, renderMarkdown, systemMessageStyleProps) => {
|
|
22
28
|
var _card$activity, _card$activity$channe, _card$activity$channe2, _card$activity2, _card$activity2$chann, _card$activity3, _card$activity3$chann, _card$activity3$chann2, _card$activity4, _card$activity4$chann, _card$activity5, _card$activity5$chann, _card$nextVisibleActi, _card$nextVisibleActi2, _card$activity6, _card$activity6$chann, _card$activity7, _card$nextVisibleActi3, _card$activity8;
|
|
@@ -65,7 +71,7 @@ const isDataTagsPresent = card => {
|
|
|
65
71
|
};
|
|
66
72
|
|
|
67
73
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
-
export const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userMessageStyleProps) => () => next => function () {
|
|
74
|
+
export const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userMessageStyleProps, localizedTexts) => () => next => function () {
|
|
69
75
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
70
76
|
args[_key] = arguments[_key];
|
|
71
77
|
}
|
|
@@ -81,6 +87,47 @@ export const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps
|
|
|
81
87
|
if (isTagIncluded(card, Constants.systemMessageTag)) {
|
|
82
88
|
return handleSystemMessage(next, args, card, renderMarkdown, systemMessageStyleProps);
|
|
83
89
|
}
|
|
90
|
+
if (isTagIncluded(card, Constants.persistentChatHistoryMessagePullTriggerTag)) {
|
|
91
|
+
var _card$activity9, _card$activity9$chann, _card$activity9$chann2;
|
|
92
|
+
// Safety check: if this is a new chat session and flag is false, auto-correct it
|
|
93
|
+
if (!LazyLoadHandler.hasMoreHistoryAvailable) {
|
|
94
|
+
LazyLoadHandler.setHasMoreHistoryAvailable(true);
|
|
95
|
+
}
|
|
96
|
+
const receivedAt = card === null || card === void 0 ? void 0 : (_card$activity9 = card.activity) === null || _card$activity9 === void 0 ? void 0 : (_card$activity9$chann = _card$activity9.channelData) === null || _card$activity9$chann === void 0 ? void 0 : (_card$activity9$chann2 = _card$activity9$chann.webChat) === null || _card$activity9$chann2 === void 0 ? void 0 : _card$activity9$chann2.receivedAt;
|
|
97
|
+
if (receivedAt < lastRenderedAt) {
|
|
98
|
+
card.activity = null;
|
|
99
|
+
return () => false;
|
|
100
|
+
}
|
|
101
|
+
lastRenderedAt = receivedAt;
|
|
102
|
+
|
|
103
|
+
// Return a function that checks availability at render time
|
|
104
|
+
return () => {
|
|
105
|
+
// Double-check at render time in case history availability changed
|
|
106
|
+
if (!LazyLoadHandler.hasMoreHistoryAvailable) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
return /*#__PURE__*/React.createElement(LazyLoadActivity, null);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (isTagIncluded(card, Constants.persistentChatHistoryMessageTag)) {
|
|
113
|
+
const userMessageStyles = {
|
|
114
|
+
...defaultUserMessageStyles,
|
|
115
|
+
...userMessageStyleProps
|
|
116
|
+
};
|
|
117
|
+
return function () {
|
|
118
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
119
|
+
className: card.activity.from.role === DirectLineSenderRole.User ? Constants.sentMessageClassName : Constants.receivedMessageClassName,
|
|
120
|
+
style: userMessageStyles
|
|
121
|
+
}, next(...args)(...arguments));
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (isTagIncluded(card, Constants.conversationDividerTag)) {
|
|
125
|
+
const conversationDividerLabel = (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL) || defaultMiddlewareLocalizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL;
|
|
126
|
+
// Pass the computed localized text to the divider component
|
|
127
|
+
return /*#__PURE__*/React.createElement(ConversationDividerActivity, {
|
|
128
|
+
dividerActivityAriaLabel: conversationDividerLabel
|
|
129
|
+
});
|
|
130
|
+
}
|
|
84
131
|
if (card.activity.text && card.activity.type === DirectLineActivityType.Message) {
|
|
85
132
|
if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === Constants.webchatChannelId) {
|
|
86
133
|
card.activity.text = escapeHtml(card.activity.text);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Constants, WebChatMiddlewareConstants } from "../../../../../common/Constants";
|
|
2
2
|
import { DeliveredTimestamp } from "./timestamps/DeliveredTimestamp";
|
|
3
|
+
import { HistoryMessageTimestamp } from "./timestamps/HistoryMessageTimestamp";
|
|
3
4
|
import { NotDeliveredTimestamp } from "./timestamps/NotDeliveredTimestamp";
|
|
4
5
|
import React from "react";
|
|
5
6
|
import { SendStatus } from "../../enums/SendStatus";
|
|
@@ -26,6 +27,11 @@ export const activityStatusMiddleware = () => next => args => {
|
|
|
26
27
|
current_role = role,
|
|
27
28
|
current_timestamp = timestamp;
|
|
28
29
|
let sameTimestampGroupTemp = sameTimestampGroup;
|
|
30
|
+
if (tags !== null && tags !== void 0 && tags.includes(Constants.persistentChatHistoryMessageTag)) {
|
|
31
|
+
return /*#__PURE__*/React.createElement(HistoryMessageTimestamp, {
|
|
32
|
+
args: args
|
|
33
|
+
});
|
|
34
|
+
}
|
|
29
35
|
if (args[WebChatMiddlewareConstants.nextVisibleActivity]) {
|
|
30
36
|
const {
|
|
31
37
|
nextVisibleActivity: {
|
|
@@ -35,6 +41,7 @@ export const activityStatusMiddleware = () => next => args => {
|
|
|
35
41
|
timestamp
|
|
36
42
|
}
|
|
37
43
|
} = args;
|
|
44
|
+
|
|
38
45
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
39
46
|
const next_name = name,
|
|
40
47
|
next_timestamp = timestamp;
|
|
@@ -61,4 +68,10 @@ export const activityStatusMiddleware = () => next => args => {
|
|
|
61
68
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
69
|
;
|
|
63
70
|
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
|
+
export const createActivityStatusMiddleware = function () {
|
|
75
|
+
let locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "en-us";
|
|
76
|
+
return activityStatusMiddleware;
|
|
64
77
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defaultSystemMessageStyles } from "./defaultSystemMessageStyles";
|
|
2
|
+
// Adjust the import path if necessary
|
|
3
|
+
|
|
4
|
+
export const defaultInlineBannerStyle = {
|
|
5
|
+
...defaultSystemMessageStyles,
|
|
6
|
+
visibility: "visible",
|
|
7
|
+
height: "20px",
|
|
8
|
+
display: "flex",
|
|
9
|
+
justifyContent: "center",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
margin: "5px 10px",
|
|
12
|
+
cursor: "pointer"
|
|
13
|
+
};
|
|
@@ -4,7 +4,7 @@ import { Stack } from "@fluentui/react";
|
|
|
4
4
|
import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
5
5
|
import { defaultTimestampContentStyles } from "../defaultStyles/defaultTimestampContentStyles";
|
|
6
6
|
import { getTimestampHourMinute } from "../../../../../../common/utils";
|
|
7
|
-
import
|
|
7
|
+
import useChatContextStore from "../../../../../../hooks/useChatContextStore";
|
|
8
8
|
|
|
9
9
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
10
10
|
export const DeliveredTimestamp = _ref => {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Stack } from "@fluentui/react";
|
|
3
|
+
import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
4
|
+
import { defaultTimestampContentStyles } from "../defaultStyles/defaultTimestampContentStyles";
|
|
5
|
+
import { getTimestampHourMinute } from "../../../../../../common/utils";
|
|
6
|
+
import useChatContextStore from "../../../../../../hooks/useChatContextStore";
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
export const HistoryMessageTimestamp = _ref => {
|
|
10
|
+
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
|
|
11
|
+
let {
|
|
12
|
+
args
|
|
13
|
+
} = _ref;
|
|
14
|
+
const [state] = useChatContextStore();
|
|
15
|
+
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
16
|
+
const {
|
|
17
|
+
activity: {
|
|
18
|
+
timestamp,
|
|
19
|
+
from: {
|
|
20
|
+
name,
|
|
21
|
+
role
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
} = args;
|
|
25
|
+
const contentStyles = {
|
|
26
|
+
...defaultTimestampContentStyles,
|
|
27
|
+
...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.timestampContentStyleProps)
|
|
28
|
+
};
|
|
29
|
+
const getTimeElement = timestamp => {
|
|
30
|
+
const timeString = getTimestampHourMinute(timestamp);
|
|
31
|
+
const isAmPmFormat = timeString.toLowerCase().includes("am") || timeString.toLowerCase().includes("pm");
|
|
32
|
+
if (dir === "rtl" && isAmPmFormat) {
|
|
33
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
34
|
+
dir: "ltr"
|
|
35
|
+
}, timeString);
|
|
36
|
+
} else {
|
|
37
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
38
|
+
dir: dir
|
|
39
|
+
}, timeString);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
43
|
+
style: contentStyles,
|
|
44
|
+
dir: dir
|
|
45
|
+
}, role === "bot" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
46
|
+
dir: dir,
|
|
47
|
+
"aria-hidden": "false"
|
|
48
|
+
}, name, " : ", getTimeElement(timestamp))), role === "user" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
"aria-hidden": "false",
|
|
50
|
+
dir: dir
|
|
51
|
+
}, " ", getTimeElement(timestamp), " - ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_DELIVERED) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_DELIVERED), " "));
|
|
52
|
+
};
|
|
@@ -7,9 +7,9 @@ import { defaultTimestampFailedStyles } from "../defaultStyles/defaultTimestampF
|
|
|
7
7
|
import { defaultTimestampRetryStyles } from "../defaultStyles/defaultTimestampRetryStyles";
|
|
8
8
|
import { getTimestampHourMinute } from "../../../../../../common/utils";
|
|
9
9
|
import { hooks } from "botframework-webchat";
|
|
10
|
-
import
|
|
10
|
+
import useChatContextStore from "../../../../../../hooks/useChatContextStore";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
13
|
export const NotDeliveredTimestamp = _ref => {
|
|
14
14
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _state$domainStates$r4, _state$domainStates$m, _state$domainStates$m2;
|
|
15
15
|
let {
|
|
@@ -69,6 +69,7 @@ export const NotDeliveredTimestamp = _ref => {
|
|
|
69
69
|
style: failedTextStyles
|
|
70
70
|
}, " ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_NOT_DELIVERED) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_NOT_DELIVERED, " "), /*#__PURE__*/React.createElement("span", null, " \xA0-\xA0 "), /*#__PURE__*/React.createElement("span", {
|
|
71
71
|
style: retryTextStyles,
|
|
72
|
+
role: "button",
|
|
72
73
|
onClick: onRetryClick,
|
|
73
74
|
onKeyDown: onRetryKeyEnter,
|
|
74
75
|
tabIndex: 0
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { Stack } from "@fluentui/react";
|
|
3
3
|
import { defaultMiddlewareLocalizedTexts } from "../../../../common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
4
4
|
import { defaultTimestampContentStyles } from "../defaultStyles/defaultTimestampContentStyles";
|
|
5
|
-
import
|
|
5
|
+
import useChatContextStore from "../../../../../../hooks/useChatContextStore";
|
|
6
6
|
|
|
7
7
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
8
8
|
export const SendingTimestamp = () => {
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
|
|
3
|
+
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
3
4
|
import { Constants } from "../../../../../common/Constants";
|
|
4
|
-
import { getIconText } from "../../../../../common/utils";
|
|
5
|
-
import { defaultWebChatStyles } from "../../../common/defaultStyles/defaultWebChatStyles";
|
|
6
5
|
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
6
|
+
import { defaultWebChatStyles } from "../../../common/defaultStyles/defaultWebChatStyles";
|
|
7
|
+
import { getIconText } from "../../../../../common/utils";
|
|
7
8
|
let currentAgentInitials = defaultWebChatStyles.botAvatarInitials;
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
// Optional external updater (React context dispatch wrapper) set at runtime
|
|
11
|
+
let externalInitialsUpdater;
|
|
12
|
+
export const localizedStringsBotInitialsMiddleware = onInitialsChange => _ref => {
|
|
9
13
|
let {
|
|
10
14
|
dispatch
|
|
11
15
|
} = _ref;
|
|
12
16
|
return next => action => {
|
|
17
|
+
if (onInitialsChange && !externalInitialsUpdater) {
|
|
18
|
+
externalInitialsUpdater = onInitialsChange; // capture once
|
|
19
|
+
}
|
|
20
|
+
|
|
13
21
|
if (action.type === WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
|
|
14
22
|
var _action$payload, _activity$from;
|
|
15
23
|
const activity = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
|
|
@@ -17,10 +25,25 @@ export const localizedStringsBotInitialsMiddleware = () => _ref => {
|
|
|
17
25
|
var _activity$channelData, _activity$channelData2, _activity$tags;
|
|
18
26
|
const agentName = activity.from.name.trim();
|
|
19
27
|
const isSystemMessage = agentName === "__agent__" || agentName.startsWith("__") || ((_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(Constants.systemMessageTag)) || ((_activity$tags = activity.tags) === null || _activity$tags === void 0 ? void 0 : _activity$tags.includes(Constants.systemMessageTag));
|
|
20
|
-
if (!isSystemMessage && agentName
|
|
21
|
-
// Update initials for valid agent/bot names
|
|
28
|
+
if (!isSystemMessage && agentName) {
|
|
22
29
|
const newInitials = getIconText(agentName) || currentAgentInitials;
|
|
23
|
-
currentAgentInitials
|
|
30
|
+
if (newInitials !== currentAgentInitials) {
|
|
31
|
+
var _externalInitialsUpda;
|
|
32
|
+
currentAgentInitials = newInitials;
|
|
33
|
+
// Notify external React context if provided
|
|
34
|
+
(_externalInitialsUpda = externalInitialsUpdater) === null || _externalInitialsUpda === void 0 ? void 0 : _externalInitialsUpda(currentAgentInitials || "");
|
|
35
|
+
// Broadcast (optional) for multi-tab sync without forcing consumers
|
|
36
|
+
BroadcastService.postMessage({
|
|
37
|
+
eventName: "BotAvatarInitialsUpdated",
|
|
38
|
+
payload: {
|
|
39
|
+
initials: currentAgentInitials
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
// Also dispatch a no-op action into WebChat store to encourage re-render (cheap)
|
|
43
|
+
dispatch({
|
|
44
|
+
type: "__BOT_INITIALS_UPDATED__"
|
|
45
|
+
});
|
|
46
|
+
}
|
|
24
47
|
}
|
|
25
48
|
}
|
|
26
49
|
}
|
|
@@ -33,7 +56,6 @@ export const getOverriddenLocalizedStrings = existingOverrides => {
|
|
|
33
56
|
...strings,
|
|
34
57
|
...existingOverrides
|
|
35
58
|
};
|
|
36
|
-
|
|
37
59
|
// Apply dynamic bot initials to alt text if not already overridden through props
|
|
38
60
|
if (!(existingOverrides !== null && existingOverrides !== void 0 && existingOverrides.ACTIVITY_BOT_SAID_ALT)) {
|
|
39
61
|
result.ACTIVITY_BOT_SAID_ALT = `${currentAgentInitials} said:`;
|
|
@@ -49,4 +49,5 @@ export let LiveChatWidgetActionType;
|
|
|
49
49
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_ENABLED"] = 46] = "SET_CONVERSATIONAL_SURVEY_ENABLED";
|
|
50
50
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_DISPLAY"] = 47] = "SET_CONVERSATIONAL_SURVEY_DISPLAY";
|
|
51
51
|
LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 48] = "GET_IN_MEMORY_STATE";
|
|
52
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_AVATAR_INITIALS"] = 49] = "SET_BOT_AVATAR_INITIALS";
|
|
52
53
|
})(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));
|
|
@@ -4,6 +4,7 @@ import { ConversationState } from "./ConversationState";
|
|
|
4
4
|
import { StartChatFailureType } from "./StartChatFailureType";
|
|
5
5
|
import { defaultClientDataStoreProvider } from "../../common/storage/default/defaultClientDataStoreProvider";
|
|
6
6
|
import { defaultMiddlewareLocalizedTexts } from "../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
7
|
+
import { defaultWebChatStyles } from "../../components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles";
|
|
7
8
|
export const getLiveChatWidgetContextInitialState = props => {
|
|
8
9
|
var _props$controlProps, _props$webChatContain;
|
|
9
10
|
const isOutsideOperatingHours = () => {
|
|
@@ -33,6 +34,10 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
33
34
|
initialStateFromCache.domainStates.liveChatConfig = props.chatConfig;
|
|
34
35
|
// Cache the result of isOutsideOperatingHours() to ensure consistency
|
|
35
36
|
initialStateFromCache.appStates.outsideOperatingHours = outsideOperatingHours;
|
|
37
|
+
// Backward compatibility: if botAvatarInitials not cached (older sessions), seed with default
|
|
38
|
+
if (!initialStateFromCache.domainStates.botAvatarInitials) {
|
|
39
|
+
initialStateFromCache.domainStates.botAvatarInitials = defaultWebChatStyles.botAvatarInitials;
|
|
40
|
+
}
|
|
36
41
|
return initialStateFromCache;
|
|
37
42
|
}
|
|
38
43
|
const LiveChatWidgetContextInitialState = {
|
|
@@ -56,7 +61,8 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
56
61
|
transcriptRequestId: "",
|
|
57
62
|
confirmationPaneConfirmedOptionClicked: false,
|
|
58
63
|
confirmationState: ConfirmationState.NotSet,
|
|
59
|
-
startChatFailureType: StartChatFailureType.Generic
|
|
64
|
+
startChatFailureType: StartChatFailureType.Generic,
|
|
65
|
+
botAvatarInitials: defaultWebChatStyles.botAvatarInitials
|
|
60
66
|
},
|
|
61
67
|
appStates: {
|
|
62
68
|
conversationState: ConversationState.Closed,
|
|
@@ -554,6 +554,21 @@ const reducer = (state, action) => {
|
|
|
554
554
|
widgetSize: action.payload
|
|
555
555
|
}
|
|
556
556
|
};
|
|
557
|
+
case LiveChatWidgetActionType.SET_BOT_AVATAR_INITIALS:
|
|
558
|
+
inMemory = {
|
|
559
|
+
...inMemory,
|
|
560
|
+
domainStates: {
|
|
561
|
+
...inMemory.domainStates,
|
|
562
|
+
botAvatarInitials: action.payload
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
return {
|
|
566
|
+
...state,
|
|
567
|
+
domainStates: {
|
|
568
|
+
...state.domainStates,
|
|
569
|
+
botAvatarInitials: action.payload
|
|
570
|
+
}
|
|
571
|
+
};
|
|
557
572
|
case LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
|
|
558
573
|
inMemory = {
|
|
559
574
|
...inMemory,
|
|
@@ -31,7 +31,7 @@ export const createTrackingForFirstMessage = () => {
|
|
|
31
31
|
* Starts tracking the time for the first bot message after widget loads.
|
|
32
32
|
* Sets a 5-second timeout to auto-reset if no bot message is received.
|
|
33
33
|
*/
|
|
34
|
-
const widgetLoadListener = BroadcastService.getMessageByEventName(TelemetryEvent.
|
|
34
|
+
const widgetLoadListener = BroadcastService.getMessageByEventName(TelemetryEvent.StartChatComplete).subscribe(() => {
|
|
35
35
|
if (isTracking) return;
|
|
36
36
|
isTracking = true;
|
|
37
37
|
startTime = new Date().getTime();
|
|
@@ -86,7 +86,8 @@ export const createTrackingForFirstMessage = () => {
|
|
|
86
86
|
CustomProperties: {
|
|
87
87
|
elapsedTime,
|
|
88
88
|
widgetLoadedAt: startTime,
|
|
89
|
-
botMessage: stopTrackingMessage
|
|
89
|
+
botMessage: stopTrackingMessage,
|
|
90
|
+
type: payload === null || payload === void 0 ? void 0 : payload.type
|
|
90
91
|
}
|
|
91
92
|
});
|
|
92
93
|
disconnectListener();
|
|
@@ -7,6 +7,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
7
7
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../common/telemetry/TelemetryConstants";
|
|
8
8
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
9
9
|
import { TelemetryHelper } from "../common/telemetry/TelemetryHelper";
|
|
10
|
+
import { Constants } from "../common/Constants";
|
|
10
11
|
export let FirstResponseLatencyTracker = /*#__PURE__*/function () {
|
|
11
12
|
function FirstResponseLatencyTracker() {
|
|
12
13
|
_classCallCheck(this, FirstResponseLatencyTracker);
|
|
@@ -127,7 +128,8 @@ export let FirstResponseLatencyTracker = /*#__PURE__*/function () {
|
|
|
127
128
|
CustomProperties: {
|
|
128
129
|
elapsedTime,
|
|
129
130
|
userMessage: this.startTrackingMessage,
|
|
130
|
-
botMessage: this.stopTrackingMessage
|
|
131
|
+
botMessage: this.stopTrackingMessage,
|
|
132
|
+
type: payload === null || payload === void 0 ? void 0 : payload.type
|
|
131
133
|
}
|
|
132
134
|
});
|
|
133
135
|
}
|
|
@@ -168,7 +170,9 @@ export let FirstResponseLatencyTracker = /*#__PURE__*/function () {
|
|
|
168
170
|
value: function stopClock(payload) {
|
|
169
171
|
try {
|
|
170
172
|
if (!payload || !payload.Id) {
|
|
171
|
-
|
|
173
|
+
if ((payload === null || payload === void 0 ? void 0 : payload.type) !== Constants.typing) {
|
|
174
|
+
throw new Error("Invalid payload");
|
|
175
|
+
}
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
// Only allow stopTracking if sender is valid and tracking is active
|
|
@@ -78,6 +78,9 @@ export const createOnNewAdapterActivityHandler = (chatId, userId, startTime) =>
|
|
|
78
78
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
79
|
const messageHasNoAttachments = !(activity !== null && activity !== void 0 && activity.attachments) || (activity === null || activity === void 0 ? void 0 : activity.attachments.length) === 0;
|
|
80
80
|
if (messageHasNoTags && messageHasNoText && messageHasNoAttachments) {
|
|
81
|
+
if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.typing) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
81
84
|
return false;
|
|
82
85
|
}
|
|
83
86
|
return true;
|
|
@@ -106,7 +109,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId, startTime) =>
|
|
|
106
109
|
});
|
|
107
110
|
};
|
|
108
111
|
const raiseMessageEvent = activity => {
|
|
109
|
-
if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message) {
|
|
112
|
+
if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message || (activity === null || activity === void 0 ? void 0 : activity.type) === Constants.typing) {
|
|
110
113
|
const scenarioType = getScenarioType(activity);
|
|
111
114
|
switch (scenarioType) {
|
|
112
115
|
case ScenarioType.UserSendMessageStrategy:
|
|
@@ -28,6 +28,9 @@ export declare class Constants {
|
|
|
28
28
|
static readonly channelIdKey = "ChannelId-";
|
|
29
29
|
static readonly ChannelId = "lcw";
|
|
30
30
|
static readonly CustomerTag = "FromCustomer";
|
|
31
|
+
static persistentChatHistoryMessageTag: string;
|
|
32
|
+
static persistentChatHistoryMessagePullTriggerTag: string;
|
|
33
|
+
static conversationDividerTag: string;
|
|
31
34
|
static readonly GifContentType = "image/gif";
|
|
32
35
|
static readonly video = "video";
|
|
33
36
|
static readonly audio = "audio";
|
|
@@ -43,6 +46,7 @@ export declare class Constants {
|
|
|
43
46
|
static readonly averageWaitTimeMessageTag = "averagewaittime";
|
|
44
47
|
static readonly message = "message";
|
|
45
48
|
static readonly hiddenTag = "Hidden";
|
|
49
|
+
static readonly typing = "typing";
|
|
46
50
|
static readonly prefixTimestampTag = "ServerMessageTimestamp_";
|
|
47
51
|
static readonly acsChannel = "ACS_CHANNEL";
|
|
48
52
|
static readonly publicMessageTag = "public";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatAdapter, ChatSDKMessage, GetAgentAvailabilityResponse, GetLiveChatTranscriptResponse, GetVoiceVideoCallingResponse, IFileInfo, IRawMessage, MaskingRules, OmnichannelChatSDK, VoiceVideoCallingOptionalParams } from "@microsoft/omnichannel-chat-sdk";
|
|
1
|
+
import { ChatAdapter, ChatSDKMessage, GetAgentAvailabilityResponse, GetLiveChatTranscriptResponse, GetPersistentChatHistoryResponse, GetVoiceVideoCallingResponse, IFileInfo, IRawMessage, MaskingRules, OmnichannelChatSDK, VoiceVideoCallingOptionalParams } from "@microsoft/omnichannel-chat-sdk";
|
|
2
2
|
import { IFacadeChatSDKInput } from "./types/IFacadeChatSDKInput";
|
|
3
3
|
import ChatAdapterOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/messaging/ChatAdapterOptionalParams";
|
|
4
4
|
import ChatConfig from "@microsoft/omnichannel-chat-sdk/lib/core/ChatConfig";
|
|
@@ -13,6 +13,7 @@ import GetChatTokenOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core
|
|
|
13
13
|
import GetConversationDetailsOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/GetConversationDetailsOptionalParams";
|
|
14
14
|
import GetLiveChatConfigOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/GetLiveChatConfigOptionalParams";
|
|
15
15
|
import GetLiveChatTranscriptOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/GetLiveChatTranscriptOptionalParams";
|
|
16
|
+
import GetPersistentChatHistoryOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/GetPersistentChatHistoryOptionalParams";
|
|
16
17
|
import IChatToken from "@microsoft/omnichannel-chat-sdk/lib/external/IC3Adapter/IChatToken";
|
|
17
18
|
import IFileMetadata from "@microsoft/omnichannel-ic3core/lib/model/IFileMetadata";
|
|
18
19
|
import IMessage from "@microsoft/omnichannel-ic3core/lib/model/IMessage";
|
|
@@ -73,4 +74,5 @@ export declare class FacadeChatSDK {
|
|
|
73
74
|
getPostChatSurveyContext(): Promise<PostChatContext>;
|
|
74
75
|
getAgentAvailability(optionalParams?: GetAgentAvailabilityOptionalParams): Promise<GetAgentAvailabilityResponse>;
|
|
75
76
|
getReconnectableChats(reconnectableChatsParams?: any): Promise<any>;
|
|
77
|
+
fetchPersistentConversationHistory(getPersistentChatHistoryOptionalParams?: GetPersistentChatHistoryOptionalParams): Promise<GetPersistentChatHistoryResponse>;
|
|
76
78
|
}
|
|
@@ -56,9 +56,11 @@ export declare enum BroadcastEvent {
|
|
|
56
56
|
SyncMinimize = "SyncMinimize",
|
|
57
57
|
OnWidgetError = "OnWidgetError",
|
|
58
58
|
FMLTrackingCompletedAck = "FMLTrackingCompletedAck",
|
|
59
|
-
FMLTrackingCompleted = "FMLTrackingCompleted"
|
|
59
|
+
FMLTrackingCompleted = "FMLTrackingCompleted",
|
|
60
|
+
PersistentConversationReset = "PersistentConversationReset"
|
|
60
61
|
}
|
|
61
62
|
export declare enum TelemetryEvent {
|
|
63
|
+
FetchPersistentChatHistoryFailed = "FetchPersistentChatHistoryFailed",
|
|
62
64
|
CallAdded = "CallAdded",
|
|
63
65
|
LocalVideoStreamAdded = "LocalVideoStreamAdded",
|
|
64
66
|
LocalVideoStreamRemoved = "LocalVideoStreamRemoved",
|
|
@@ -104,6 +106,7 @@ export declare enum TelemetryEvent {
|
|
|
104
106
|
EndChatFailed = "EndChatFailed",
|
|
105
107
|
SettingCustomContext = "SettingCustomContext",
|
|
106
108
|
WebChatLoaded = "WebChatLoaded",
|
|
109
|
+
PersistentChatHistoryEnabled = "PersistentChatHistoryEnabled",
|
|
107
110
|
LCWChatButtonActionCompleted = "LCWChatButtonActionCompleted",
|
|
108
111
|
LCWChatButtonClicked = "LCWChatButtonClicked",
|
|
109
112
|
LCWChatButtonShow = "LCWChatButtonShow",
|
|
@@ -268,8 +271,37 @@ export declare enum TelemetryEvent {
|
|
|
268
271
|
UXCitationPaneCompleted = "UXCitationPaneCompleted",
|
|
269
272
|
UXLiveChatWidgetStart = "UXLiveChatWidgetStart",
|
|
270
273
|
UXLiveChatWidgetCompleted = "UXLiveChatWidgetCompleted",
|
|
274
|
+
UXPostChatPaneStarted = "UXPostChatPaneStarted",
|
|
275
|
+
UXPostChatPaneCompleted = "UXPostChatPaneCompleted",
|
|
271
276
|
AppInsightsInitialized = "AppInsightsInitialized",
|
|
272
|
-
AppInsightsInitFailed = "AppInsightsInitFailed"
|
|
277
|
+
AppInsightsInitFailed = "AppInsightsInitFailed",
|
|
278
|
+
ConvertPersistentChatHistoryMessageToActivityFailed = "ConvertPersistentChatHistoryMessageToActivityFailed",
|
|
279
|
+
UXLCWPersistentChatHistoryInitialized = "UXLCWPersistentChatHistoryInitialized",
|
|
280
|
+
LCWPersistentChatHistoryFetchStarted = "LCWPersistentChatHistoryFetchStarted",
|
|
281
|
+
LCWPersistentChatHistoryFetchCompleted = "LCWPersistentChatHistoryFetchCompleted",
|
|
282
|
+
LCWPersistentChatHistoryFetchFailed = "LCWPersistentChatHistoryFetchFailed",
|
|
283
|
+
LCWWebChatStorePollingStarted = "LCWWebChatStorePollingStarted",
|
|
284
|
+
LCWWebChatStoreReady = "LCWWebChatStoreReady",
|
|
285
|
+
LCWWebChatConnected = "LCWWebChatConnected",
|
|
286
|
+
LCWWebChatDisconnected = "LCWWebChatDisconnected",
|
|
287
|
+
LCWWebChatConnectionCheckFailed = "LCWWebChatConnectionCheckFailed",
|
|
288
|
+
LCWPersistentConversationHandlerInitialized = "LCWPersistentConversationHandlerInitialized",
|
|
289
|
+
LCWPersistentHistoryPullBlocked = "LCWPersistentHistoryPullBlocked",
|
|
290
|
+
LCWPersistentHistoryPullCompleted = "LCWPersistentHistoryPullCompleted",
|
|
291
|
+
LCWLazyLoadInitializationStarted = "LCWLazyLoadInitializationStarted",
|
|
292
|
+
LCWLazyLoadContainerNotFound = "LCWLazyLoadContainerNotFound",
|
|
293
|
+
LCWLazyLoadInitializationCompleted = "LCWLazyLoadInitializationCompleted",
|
|
294
|
+
LCWLazyLoadSessionMetrics = "LCWLazyLoadSessionMetrics",
|
|
295
|
+
LCWLazyLoadTargetElementNotFound = "LCWLazyLoadTargetElementNotFound",
|
|
296
|
+
LCWLazyLoadScrollFailed = "LCWLazyLoadScrollFailed",
|
|
297
|
+
LCWLazyLoadActivityMounted = "LCWLazyLoadActivityMounted",
|
|
298
|
+
LCWLazyLoadReset = "LCWLazyLoadReset",
|
|
299
|
+
LCWLazyLoadNoMoreHistory = "LCWLazyLoadNoMoreHistory",
|
|
300
|
+
LCWLazyLoadDestroyed = "LCWLazyLoadDestroyed",
|
|
301
|
+
SecureEventBusUnauthorizedDispatch = "SecureEventBusUnauthorizedDispatch",
|
|
302
|
+
SecureEventBusListenerError = "SecureEventBusListenerError",
|
|
303
|
+
SecureEventBusDispatchError = "SecureEventBusDispatchError",
|
|
304
|
+
StartChatComplete = "StartChatComplete"
|
|
273
305
|
}
|
|
274
306
|
export interface TelemetryInput {
|
|
275
307
|
scenarioType: ScenarioType;
|
|
@@ -280,3 +312,8 @@ export declare class TelemetryConstants {
|
|
|
280
312
|
private static map;
|
|
281
313
|
static mapEventToScenario(eventTypeOrScenarioType: TelemetryEvent): ScenarioType;
|
|
282
314
|
}
|
|
315
|
+
export declare enum ConversationStage {
|
|
316
|
+
Initialization = "Initialization",
|
|
317
|
+
CSREngagement = "CSR Engagement",
|
|
318
|
+
ConversationEnd = "Conversation End"
|
|
319
|
+
}
|