@microsoft/omnichannel-chat-widget 0.1.0-main.ae3aa42 → 0.1.0-main.b511ad6
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 +32 -0
- package/lib/cjs/common/Constants.js +16 -2
- package/lib/cjs/common/telemetry/TelemetryConstants.js +26 -3
- package/lib/cjs/common/telemetry/TelemetryManager.js +7 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +8 -9
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/cjs/common/utils.js +63 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +20 -4
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +0 -1
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
- package/lib/cjs/components/headerstateful/HeaderStateful.js +2 -2
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
- package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +31 -30
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +9 -15
- package/lib/cjs/components/livechatwidget/common/endChat.js +63 -16
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +20 -3
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +23 -15
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +177 -67
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +206 -85
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -10
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -0
- package/lib/cjs/contexts/common/ConversationState.js +3 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +24 -21
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +3 -2
- package/lib/cjs/contexts/createReducer.js +16 -0
- package/lib/cjs/controller/componentController.js +3 -3
- package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
- package/lib/esm/common/Constants.js +16 -2
- package/lib/esm/common/telemetry/TelemetryConstants.js +26 -3
- package/lib/esm/common/telemetry/TelemetryManager.js +6 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +8 -6
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/esm/common/utils.js +44 -0
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +22 -7
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +0 -1
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
- package/lib/esm/components/headerstateful/HeaderStateful.js +2 -2
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
- package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +31 -30
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +9 -15
- package/lib/esm/components/livechatwidget/common/endChat.js +61 -17
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +19 -5
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +23 -15
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +172 -68
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +197 -87
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -11
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -0
- package/lib/esm/contexts/common/ConversationState.js +3 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +24 -21
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +3 -2
- package/lib/esm/contexts/createReducer.js +16 -0
- package/lib/esm/controller/componentController.js +3 -3
- package/lib/esm/plugins/newMessageEventHandler.js +10 -12
- package/lib/types/common/Constants.d.ts +8 -1
- package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +25 -5
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -1
- package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
- package/lib/types/common/utils.d.ts +6 -1
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -4
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
- package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -0
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -1
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
- package/lib/types/contexts/common/ConversationState.d.ts +3 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -1
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +24 -21
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
1. [Installation](#installation)
|
|
12
12
|
1. [Example Usage](#example-usage)
|
|
13
13
|
1. [Components](#components)
|
|
14
|
+
1. [Common Scenarios](#common-scenarios)
|
|
15
|
+
- [Disable Bot Magic Code](#disable-bot-magic-code)
|
|
14
16
|
1. [See Also](#see-also)
|
|
15
17
|
|
|
16
18
|
## Introduction
|
|
@@ -218,6 +220,36 @@ const customizedFooterProp: IFooterProps = {
|
|
|
218
220
|
|
|
219
221
|
> :pushpin: Note that [WebChat hooks](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/HOOKS.md) can also be used in any custom components.
|
|
220
222
|
|
|
223
|
+
## Common Scenarios
|
|
224
|
+
|
|
225
|
+
### Disable Bot Magic Code
|
|
226
|
+
|
|
227
|
+
Configuration to disable the default behaviour of having to type the magic code in the conversation to complete the sign-in proccess with a bot. Instead, the magic code will be sent to the bot behind the scenes.
|
|
228
|
+
|
|
229
|
+
1. Add [MagicCodeForwarder.html](sample/MagicCodeForwarder.html) in the same location as the chat widget
|
|
230
|
+
|
|
231
|
+
2. Add `botMagicCode` configuration to disable default magic code feature
|
|
232
|
+
|
|
233
|
+
> :exclamation: `fwdUrl` **MUST** have the same `origin` as the chat widget URL
|
|
234
|
+
|
|
235
|
+
```js
|
|
236
|
+
const liveChatWidgetProps = {
|
|
237
|
+
chatSDK: chatSDK, // mandatory
|
|
238
|
+
chatConfig: chatConfig, // mandatory
|
|
239
|
+
webChatContainerProps: {
|
|
240
|
+
botMagicCode: {
|
|
241
|
+
disabled: true,
|
|
242
|
+
fwdUrl: 'http://localhost:8000/sample/MagicCodeForwarder.html'
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
ReactDOM.render(
|
|
248
|
+
<LiveChatWidget {...liveChatWidgetProps}/>,
|
|
249
|
+
document.getElementById("my-container")
|
|
250
|
+
);
|
|
251
|
+
```
|
|
252
|
+
|
|
221
253
|
## See Also
|
|
222
254
|
|
|
223
255
|
[Telemetry](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/Telemetry.md)\
|
|
@@ -13,6 +13,10 @@ class Constants {}
|
|
|
13
13
|
|
|
14
14
|
exports.Constants = Constants;
|
|
15
15
|
|
|
16
|
+
_defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
|
|
17
|
+
|
|
18
|
+
_defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
|
|
19
|
+
|
|
16
20
|
_defineProperty(Constants, "systemMessageTag", "system");
|
|
17
21
|
|
|
18
22
|
_defineProperty(Constants, "userMessageTag", "user");
|
|
@@ -45,8 +49,6 @@ _defineProperty(Constants, "false", "false");
|
|
|
45
49
|
|
|
46
50
|
_defineProperty(Constants, "maximumUnreadMessageCount", 99);
|
|
47
51
|
|
|
48
|
-
_defineProperty(Constants, "widgetStateDataKey", "LcwChatWidgetState");
|
|
49
|
-
|
|
50
52
|
_defineProperty(Constants, "channelIdKey", "ChannelId-");
|
|
51
53
|
|
|
52
54
|
_defineProperty(Constants, "ChannelId", "lcw");
|
|
@@ -81,6 +83,14 @@ _defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
|
|
|
81
83
|
|
|
82
84
|
_defineProperty(Constants, "message", "message");
|
|
83
85
|
|
|
86
|
+
_defineProperty(Constants, "hiddenTag", "Hidden");
|
|
87
|
+
|
|
88
|
+
_defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
|
|
89
|
+
|
|
90
|
+
_defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
|
|
91
|
+
|
|
92
|
+
_defineProperty(Constants, "publicMessageTag", "public");
|
|
93
|
+
|
|
84
94
|
_defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"]);
|
|
85
95
|
|
|
86
96
|
_defineProperty(Constants, "maxUploadFileSize", "500000");
|
|
@@ -155,6 +165,10 @@ _defineProperty(Constants, "internetConnectionTestUrl", "https://ocsdk-prod.azur
|
|
|
155
165
|
|
|
156
166
|
_defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
|
|
157
167
|
|
|
168
|
+
_defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
|
|
169
|
+
|
|
170
|
+
_defineProperty(Constants, "PostChatLoadingDurationInMs", 2000);
|
|
171
|
+
|
|
158
172
|
const Regex = (_class = class Regex {}, _defineProperty(_class, "EmailRegex", "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"), _class);
|
|
159
173
|
exports.Regex = Regex;
|
|
160
174
|
|
|
@@ -37,18 +37,29 @@ exports.BroadcastEvent = BroadcastEvent;
|
|
|
37
37
|
|
|
38
38
|
(function (BroadcastEvent) {
|
|
39
39
|
BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
|
|
40
|
-
BroadcastEvent["
|
|
40
|
+
BroadcastEvent["ChatEnded"] = "ChatEnded";
|
|
41
41
|
BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
|
|
42
42
|
BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
|
|
43
|
-
BroadcastEvent["
|
|
43
|
+
BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
|
|
44
44
|
BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
|
|
45
45
|
BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
|
|
46
|
+
BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
|
|
47
|
+
BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
|
|
46
48
|
BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
|
|
47
49
|
BroadcastEvent["NewMessageSent"] = "NewMessageSent";
|
|
48
50
|
BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
|
|
49
51
|
BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
|
|
52
|
+
BroadcastEvent["StartChat"] = "StartChat";
|
|
50
53
|
BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
|
|
51
54
|
BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
|
|
55
|
+
BroadcastEvent["InitiateEndChat"] = "InitiateEndChat";
|
|
56
|
+
BroadcastEvent["SetCustomContext"] = "SetCustomContext";
|
|
57
|
+
BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
|
|
58
|
+
BroadcastEvent["MaximizeChat"] = "MaximizeChat";
|
|
59
|
+
BroadcastEvent["ChatInitiated"] = "ChatInitiated";
|
|
60
|
+
BroadcastEvent["CloseChat"] = "CloseChat";
|
|
61
|
+
BroadcastEvent["InitiateEndChatOnBrowserUnload"] = "InitiateEndChatOnBrowserUnload";
|
|
62
|
+
BroadcastEvent["ClosePopoutWindow"] = "ClosePopoutWindow";
|
|
52
63
|
})(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
|
|
53
64
|
|
|
54
65
|
let TelemetryEvent;
|
|
@@ -101,8 +112,9 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
101
112
|
TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
|
|
102
113
|
TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
|
|
103
114
|
TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
|
|
104
|
-
TelemetryEvent["EndChatSDKCall"] = "
|
|
115
|
+
TelemetryEvent["EndChatSDKCall"] = "EndChatSDKCall";
|
|
105
116
|
TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
|
|
117
|
+
TelemetryEvent["WindowClosed"] = "WindowClosed";
|
|
106
118
|
TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
|
|
107
119
|
TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
|
|
108
120
|
TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
|
|
@@ -127,6 +139,12 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
127
139
|
TelemetryEvent["EmailTranscriptButtonClicked"] = "EmailTranscriptButtonClicked";
|
|
128
140
|
TelemetryEvent["EmailTranscriptCancelButtonClicked"] = "EmailTranscriptCancelButtonClicked";
|
|
129
141
|
TelemetryEvent["AudioToggleButtonClicked"] = "AudioToggleButtonClicked";
|
|
142
|
+
TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
|
|
143
|
+
TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
|
|
144
|
+
TelemetryEvent["GetConversationDetailsException"] = "GetConversationDetailsException";
|
|
145
|
+
TelemetryEvent["BrowserUnloadEventStarted"] = "BrowserUnloadEventStarted";
|
|
146
|
+
TelemetryEvent["GetAuthTokenCalled"] = "GetAuthTokenCalled";
|
|
147
|
+
TelemetryEvent["ReceivedNullOrEmptyToken"] = "ReceivedNullOrEmptyToken";
|
|
130
148
|
TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
|
|
131
149
|
TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
|
|
132
150
|
TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
|
|
@@ -152,6 +170,7 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
152
170
|
TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
|
|
153
171
|
TelemetryEvent["MessageSent"] = "MessageSent";
|
|
154
172
|
TelemetryEvent["MessageReceived"] = "MessageReceived";
|
|
173
|
+
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
155
174
|
})(TelemetryEvent || (exports.TelemetryEvent = TelemetryEvent = {}));
|
|
156
175
|
|
|
157
176
|
class TelemetryConstants {
|
|
@@ -194,6 +213,10 @@ class TelemetryConstants {
|
|
|
194
213
|
case TelemetryEvent.PreChatSurveyStartChatMethodFailed:
|
|
195
214
|
case TelemetryEvent.HeaderCloseButtonClicked:
|
|
196
215
|
case TelemetryEvent.HeaderMinimizeButtonClicked:
|
|
216
|
+
case TelemetryEvent.MessageSent:
|
|
217
|
+
case TelemetryEvent.MessageReceived:
|
|
218
|
+
case TelemetryEvent.CustomContextReceived:
|
|
219
|
+
case TelemetryEvent.BrowserUnloadEventStarted:
|
|
197
220
|
return ScenarioType.ACTIONS;
|
|
198
221
|
|
|
199
222
|
case TelemetryEvent.StartChatSDKCall:
|
|
@@ -15,6 +15,8 @@ var _consoleLogger = require("./loggers/consoleLogger");
|
|
|
15
15
|
|
|
16
16
|
var _defaultAriaConfig = require("./defaultConfigs/defaultAriaConfig");
|
|
17
17
|
|
|
18
|
+
var _TelemetryHelper = require("./TelemetryHelper");
|
|
19
|
+
|
|
18
20
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
21
|
|
|
20
22
|
class TelemetryTimers {}
|
|
@@ -92,7 +94,11 @@ const RegisterLoggers = () => {
|
|
|
92
94
|
|
|
93
95
|
const logLevel = telemetryEvent.logLevel ?? _TelemetryConstants.LogLevel.INFO;
|
|
94
96
|
const scenarioType = ((_payload = telemetryEvent.payload) === null || _payload === void 0 ? void 0 : _payload.scenarioType) ?? _TelemetryConstants.ScenarioType.UNDEFINED;
|
|
95
|
-
|
|
97
|
+
const telemetryInput = parseInput(telemetryEvent === null || telemetryEvent === void 0 ? void 0 : telemetryEvent.payload, scenarioType);
|
|
98
|
+
telemetryInput.telemetryInfo = {
|
|
99
|
+
telemetryInfo: _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput)
|
|
100
|
+
};
|
|
101
|
+
logger.log(logLevel, telemetryInput);
|
|
96
102
|
});
|
|
97
103
|
};
|
|
98
104
|
|
|
@@ -15,8 +15,6 @@ var _Enums = require("@microsoft/omnichannel-chat-sdk/lib/external/aria/common/E
|
|
|
15
15
|
|
|
16
16
|
var _Constants = require("../../Constants");
|
|
17
17
|
|
|
18
|
-
var _TelemetryHelper = require("../TelemetryHelper");
|
|
19
|
-
|
|
20
18
|
var _TelemetryManager = require("../TelemetryManager");
|
|
21
19
|
|
|
22
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -67,18 +65,19 @@ const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUr
|
|
|
67
65
|
log: (logLevel, telemetryInput) => {
|
|
68
66
|
try {
|
|
69
67
|
let property;
|
|
68
|
+
const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
|
|
70
69
|
const eventProperties = new _AWTEventProperties.default();
|
|
71
|
-
|
|
72
|
-
const event = _TelemetryHelper.TelemetryHelper.buildTelemetryEvent(logLevel, telemetryInput);
|
|
73
|
-
|
|
74
70
|
eventProperties.setName(telemetryInput.scenarioType);
|
|
75
71
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
if (telemetryInfo) {
|
|
73
|
+
for (const key of Object.keys(telemetryInfo)) {
|
|
74
|
+
property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
|
|
75
|
+
eventProperties.setProperty(key, property);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, _Constants.Constants.LiveChatWidget, _Enums.AWTPiiKind.GenericData);
|
|
82
81
|
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
83
82
|
} catch (error) {
|
|
84
83
|
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
@@ -13,27 +13,28 @@ const consoleLogger = () => {
|
|
|
13
13
|
const consoleLogger = {
|
|
14
14
|
log: (logLevel, telemetryInput) => {
|
|
15
15
|
const payload = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.payload && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.payload : "";
|
|
16
|
+
const telemetryInfo = telemetryInput !== null && telemetryInput !== void 0 && telemetryInput.telemetryInfo && Object.keys(telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo).length > 0 ? telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo : "";
|
|
16
17
|
|
|
17
18
|
try {
|
|
18
19
|
switch (logLevel) {
|
|
19
20
|
case _TelemetryConstants.LogLevel.INFO:
|
|
20
|
-
console.info(_Constants.Constants.LiveChatWidget, payload);
|
|
21
|
+
console.info(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
21
22
|
break;
|
|
22
23
|
|
|
23
24
|
case _TelemetryConstants.LogLevel.DEBUG:
|
|
24
|
-
console.debug(_Constants.Constants.LiveChatWidget, payload);
|
|
25
|
+
console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
25
26
|
break;
|
|
26
27
|
|
|
27
28
|
case _TelemetryConstants.LogLevel.WARN:
|
|
28
|
-
console.warn(_Constants.Constants.LiveChatWidget, payload);
|
|
29
|
+
console.warn(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
29
30
|
break;
|
|
30
31
|
|
|
31
32
|
case _TelemetryConstants.LogLevel.ERROR:
|
|
32
|
-
console.error(_Constants.Constants.LiveChatWidget, payload);
|
|
33
|
+
console.error(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
33
34
|
break;
|
|
34
35
|
|
|
35
36
|
default:
|
|
36
|
-
console.debug(_Constants.Constants.LiveChatWidget, payload);
|
|
37
|
+
console.debug(_Constants.Constants.LiveChatWidget, payload, telemetryInfo);
|
|
37
38
|
break;
|
|
38
39
|
}
|
|
39
40
|
} catch (ex) {
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getTimestampHourMinute = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = void 0;
|
|
6
|
+
exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.createTimer = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
|
|
7
7
|
|
|
8
8
|
var _Constants = require("./Constants");
|
|
9
9
|
|
|
10
|
+
var _DataStoreManager = require("./contextDataStore/DataStoreManager");
|
|
11
|
+
|
|
10
12
|
var _KeyCodes = require("./KeyCodes");
|
|
11
13
|
|
|
14
|
+
var _TelemetryConstants = require("./telemetry/TelemetryConstants");
|
|
15
|
+
|
|
12
16
|
const getElementBySelector = selector => {
|
|
13
17
|
let element;
|
|
14
18
|
|
|
@@ -333,6 +337,7 @@ const createTimer = () => {
|
|
|
333
337
|
|
|
334
338
|
};
|
|
335
339
|
}; // Returns the domain of the org
|
|
340
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
336
341
|
|
|
337
342
|
|
|
338
343
|
exports.createTimer = createTimer;
|
|
@@ -347,4 +352,60 @@ const getDomain = hostValue => {
|
|
|
347
352
|
return _Constants.AriaTelemetryConstants.Public;
|
|
348
353
|
};
|
|
349
354
|
|
|
350
|
-
exports.getDomain = getDomain;
|
|
355
|
+
exports.getDomain = getDomain;
|
|
356
|
+
|
|
357
|
+
const getWidgetCacheId = (orgId, widgetId) => {
|
|
358
|
+
return `${_Constants.Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
exports.getWidgetCacheId = getWidgetCacheId;
|
|
362
|
+
|
|
363
|
+
const getWidgetEndChatEventName = (orgId, widgetId) => {
|
|
364
|
+
return `${_TelemetryConstants.BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
|
|
365
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
exports.getWidgetEndChatEventName = getWidgetEndChatEventName;
|
|
369
|
+
|
|
370
|
+
const getStateFromCache = (orgId, widgetId) => {
|
|
371
|
+
// Getting updated state from cache
|
|
372
|
+
try {
|
|
373
|
+
if (_DataStoreManager.DataStoreManager.clientDataStore) {
|
|
374
|
+
var _DataStoreManager$cli;
|
|
375
|
+
|
|
376
|
+
const widgetStateEventName = getWidgetCacheId(orgId, widgetId);
|
|
377
|
+
const widgetStateFromCache = (_DataStoreManager$cli = _DataStoreManager.DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateEventName, "localStorage");
|
|
378
|
+
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
379
|
+
return persistedState;
|
|
380
|
+
} else {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
} catch (error) {
|
|
384
|
+
console.log(error);
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
exports.getStateFromCache = getStateFromCache;
|
|
391
|
+
|
|
392
|
+
const isUndefinedOrEmpty = object => {
|
|
393
|
+
if (object) {
|
|
394
|
+
if (Object.keys(object).length === 0) {
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return false;
|
|
399
|
+
} else {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
exports.isUndefinedOrEmpty = isUndefinedOrEmpty;
|
|
406
|
+
|
|
407
|
+
const addDelayInMs = ms => {
|
|
408
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
exports.addDelayInMs = addDelayInMs;
|
|
@@ -206,6 +206,20 @@ const CallingContainerStateful = props => {
|
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
|
+
window.addEventListener("beforeunload", () => {
|
|
210
|
+
if (state.uiStates.isIncomingCall) {
|
|
211
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
|
|
212
|
+
} else {
|
|
213
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
|
|
217
|
+
dispatch({
|
|
218
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
219
|
+
payload: false
|
|
220
|
+
});
|
|
221
|
+
resetCallingStates(true);
|
|
222
|
+
});
|
|
209
223
|
}, []);
|
|
210
224
|
const controlProps = {
|
|
211
225
|
id: "oc-lcw-callingcontainer",
|
|
@@ -34,7 +34,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
34
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
35
|
|
|
36
36
|
const ChatButtonStateful = props => {
|
|
37
|
-
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
|
|
37
|
+
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
|
|
38
38
|
|
|
39
39
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
40
40
|
const {
|
|
@@ -44,20 +44,27 @@ const ChatButtonStateful = props => {
|
|
|
44
44
|
} = props; //Setting OutOfOperatingHours Flag
|
|
45
45
|
|
|
46
46
|
const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
|
|
47
|
+
const proactiveChatInNewWindow = (0, _react.useRef)(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
|
|
47
48
|
const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeChatButtonStyleProps.defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
48
49
|
const controlProps = {
|
|
49
50
|
id: "oc-lcw-chat-button",
|
|
50
51
|
dir: state.domainStates.globalDir,
|
|
51
52
|
titleText: "Let's Chat!",
|
|
52
53
|
subtitleText: "We're online.",
|
|
53
|
-
hideNotificationBubble:
|
|
54
|
-
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ?
|
|
54
|
+
hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
|
|
55
|
+
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
|
|
55
56
|
onClick: async () => {
|
|
56
57
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
57
58
|
Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
|
|
58
59
|
});
|
|
59
60
|
|
|
60
|
-
if (
|
|
61
|
+
if (proactiveChatInNewWindow.current) {
|
|
62
|
+
const proactiveChatIsInPopoutModeEvent = {
|
|
63
|
+
eventName: _TelemetryConstants.BroadcastEvent.ProactiveChatIsInPopoutMode
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
_omnichannelChatComponents.BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
|
|
67
|
+
} else if (state.appStates.isMinimized) {
|
|
61
68
|
dispatch({
|
|
62
69
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
63
70
|
payload: false
|
|
@@ -66,6 +73,7 @@ const ChatButtonStateful = props => {
|
|
|
66
73
|
await startChat();
|
|
67
74
|
}
|
|
68
75
|
},
|
|
76
|
+
unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
|
|
69
77
|
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
|
|
70
78
|
};
|
|
71
79
|
const outOfOfficeControlProps = {
|
|
@@ -74,6 +82,10 @@ const ChatButtonStateful = props => {
|
|
|
74
82
|
titleText: "We're Offline",
|
|
75
83
|
subtitleText: "No agents available",
|
|
76
84
|
onClick: async () => {
|
|
85
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
86
|
+
Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
|
|
87
|
+
});
|
|
88
|
+
|
|
77
89
|
if (state.appStates.isMinimized) {
|
|
78
90
|
dispatch({
|
|
79
91
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -86,6 +98,7 @@ const ChatButtonStateful = props => {
|
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
100
|
},
|
|
101
|
+
unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
|
|
89
102
|
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
90
103
|
};
|
|
91
104
|
(0, _react.useEffect)(() => {
|
|
@@ -107,6 +120,9 @@ const ChatButtonStateful = props => {
|
|
|
107
120
|
});
|
|
108
121
|
}
|
|
109
122
|
}, []);
|
|
123
|
+
(0, _react.useEffect)(() => {
|
|
124
|
+
proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
|
|
125
|
+
}, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
|
|
110
126
|
return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ChatButton, {
|
|
111
127
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
112
128
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
|
@@ -41,7 +41,6 @@ const ConfirmationPaneStateful = props => {
|
|
|
41
41
|
const {
|
|
42
42
|
prepareEndChat
|
|
43
43
|
} = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
44
|
|
|
46
45
|
const [adapter] = (0, _useChatAdapterStore.default)();
|
|
47
46
|
const controlProps = {
|
package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -116,8 +116,17 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
116
116
|
let fileAttachmentName = _Constants.TranscriptConstants.DefaultFileAttachmentName;
|
|
117
117
|
let dialogColor = _Constants.TranscriptConstants.CustomerDialogColor;
|
|
118
118
|
let fontColor = _Constants.TranscriptConstants.CustomerFontColor;
|
|
119
|
+
const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.systemMessageTag) !== -1;
|
|
120
|
+
const isControlMessage = value.isControlMessage && value.isControlMessage === true;
|
|
119
121
|
|
|
120
|
-
|
|
122
|
+
const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === _Constants.TranscriptConstants.AdaptiveCardType;
|
|
123
|
+
|
|
124
|
+
const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === _Constants.TranscriptConstants.InternalMode;
|
|
125
|
+
|
|
126
|
+
const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(_Constants.Constants.hiddenTag.toLowerCase()) !== -1;
|
|
127
|
+
const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
|
|
128
|
+
|
|
129
|
+
if (shouldIgnoreMessage) {
|
|
121
130
|
return;
|
|
122
131
|
} else if (value.from) {
|
|
123
132
|
if (value.from.application) {
|
|
@@ -138,7 +147,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
138
147
|
|
|
139
148
|
if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
|
|
140
149
|
fileAttachmentName = value.attachments[0].name;
|
|
141
|
-
value.content = attachmentMessage
|
|
150
|
+
value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
|
|
142
151
|
}
|
|
143
152
|
}
|
|
144
153
|
|
|
@@ -81,8 +81,8 @@ const HeaderStateful = props => {
|
|
|
81
81
|
});
|
|
82
82
|
},
|
|
83
83
|
...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
|
|
84
|
-
hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
|
|
85
|
-
hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
|
|
84
|
+
hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
|
|
85
|
+
hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
|
|
86
86
|
hideCloseButton: state.appStates.conversationState === _ConversationState.ConversationState.Loading || state.appStates.conversationState === _ConversationState.ConversationState.Prechat || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
|
|
87
87
|
};
|
|
88
88
|
const outOfOfficeControlProps = {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ActivityStreamHandler = void 0;
|
|
7
|
+
|
|
8
|
+
var _Deferred = require("./Deferred");
|
|
9
|
+
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
|
|
12
|
+
class ActivityStreamHandler {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Use of a deferred pattern, to hold the execution of the activity.
|
|
18
|
+
*
|
|
19
|
+
* */
|
|
20
|
+
static cork() {
|
|
21
|
+
ActivityStreamHandler.restoreDeferred = new _Deferred.Deferred();
|
|
22
|
+
ActivityStreamHandler.restorePromise = ActivityStreamHandler.restoreDeferred.promise;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolve the promise, releasing it to continue with the execution of the activity.
|
|
26
|
+
*
|
|
27
|
+
* */
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
static uncork() {
|
|
31
|
+
ActivityStreamHandler.restoreDeferred.resolve();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.ActivityStreamHandler = ActivityStreamHandler;
|
|
37
|
+
|
|
38
|
+
_defineProperty(ActivityStreamHandler, "restoreDeferred", {
|
|
39
|
+
resolve: () => {
|
|
40
|
+
return "initialState";
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
_defineProperty(ActivityStreamHandler, "restorePromise", void 0);
|
package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DefaultActivitySubscriber = void 0;
|
|
7
|
+
|
|
8
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
|
|
10
|
+
class DefaultActivitySubscriber {
|
|
11
|
+
constructor() {
|
|
12
|
+
_defineProperty(this, "observer", void 0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
async next(activity) {
|
|
17
|
+
this.observer.next(activity);
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.DefaultActivitySubscriber = DefaultActivitySubscriber;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PauseActivitySubscriber = void 0;
|
|
7
|
+
|
|
8
|
+
var _ActivityStreamHandler = require("../ActivityStreamHandler");
|
|
9
|
+
|
|
10
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
+
|
|
12
|
+
class PauseActivitySubscriber {
|
|
13
|
+
constructor() {
|
|
14
|
+
_defineProperty(this, "observer", void 0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
async apply(activity) {
|
|
19
|
+
await _ActivityStreamHandler.ActivityStreamHandler.restorePromise;
|
|
20
|
+
return activity;
|
|
21
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
applicable(activity) {
|
|
25
|
+
return true;
|
|
26
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
async next(activity) {
|
|
30
|
+
if (this.applicable(activity)) {
|
|
31
|
+
return await this.apply(activity);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return activity;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.PauseActivitySubscriber = PauseActivitySubscriber;
|