@microsoft/omnichannel-chat-widget 0.1.0-main.edd8c2a → 0.1.0-main.fdf1fdf
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 +259 -0
- package/lib/cjs/assets/Audios.js +8 -0
- package/lib/cjs/assets/Icons.js +28 -0
- package/lib/cjs/common/Constants.js +54 -4
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +14 -0
- package/lib/cjs/{assets/assets.d.js → common/interfaces/IContextDataStore.js} +0 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +61 -4
- package/lib/cjs/common/telemetry/TelemetryHelper.js +22 -4
- package/lib/cjs/common/telemetry/TelemetryManager.js +28 -9
- package/lib/cjs/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/cjs/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +48 -15
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +9 -5
- package/lib/cjs/common/utils.js +89 -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 +7 -54
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/cjs/components/footerstateful/FooterStateful.js +4 -5
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
- package/lib/cjs/components/headerstateful/HeaderStateful.js +14 -10
- 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/authHelper.js +52 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +32 -32
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +30 -24
- package/lib/cjs/components/livechatwidget/common/disposeTelemetryLoggers.js +14 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +142 -43
- package/lib/cjs/components/livechatwidget/common/initCallingSdk.js +5 -0
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +51 -10
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +144 -39
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +11 -7
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +22 -24
- package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +198 -41
- package/lib/cjs/components/livechatwidget/common/startProactiveChat.js +3 -3
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +299 -72
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +8 -0
- package/lib/cjs/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +8 -0
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +27 -5
- package/lib/cjs/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +91 -0
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +51 -73
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -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 +25 -48
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +3 -1
- 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/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +45 -0
- package/lib/cjs/contexts/common/ConversationState.js +4 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +13 -7
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +12 -4
- package/lib/cjs/contexts/createReducer.js +44 -10
- package/lib/cjs/controller/componentController.js +5 -5
- package/lib/cjs/plugins/newMessageEventHandler.js +99 -0
- package/lib/esm/assets/Audios.js +1 -0
- package/lib/esm/assets/Icons.js +11 -0
- package/lib/esm/common/Constants.js +50 -3
- package/lib/esm/common/contextDataStore/DataStoreManager.js +5 -0
- package/lib/esm/common/interfaces/IContextDataStore.js +1 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +57 -3
- package/lib/esm/common/telemetry/TelemetryHelper.js +22 -5
- package/lib/esm/common/telemetry/TelemetryManager.js +22 -9
- package/lib/esm/common/telemetry/defaultConfigs/defaultAriaConfig.js +3 -3
- package/lib/esm/common/telemetry/defaultConfigs/defaultTelemetryConfiguration.js +4 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +50 -15
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +9 -5
- package/lib/esm/common/utils.js +64 -1
- 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 +7 -50
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +2 -2
- package/lib/esm/components/footerstateful/FooterStateful.js +4 -5
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
- package/lib/esm/components/headerstateful/HeaderStateful.js +15 -11
- 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/authHelper.js +39 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +32 -31
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +28 -25
- package/lib/esm/components/livechatwidget/common/disposeTelemetryLoggers.js +4 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +139 -42
- package/lib/esm/components/livechatwidget/common/initCallingSdk.js +3 -0
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +45 -11
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +134 -41
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +10 -3
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +19 -22
- package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +186 -39
- package/lib/esm/components/livechatwidget/common/startProactiveChat.js +5 -5
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +283 -77
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +1 -1
- package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +6 -0
- package/lib/esm/components/postchatloadingpanestateful/PostChatLoadingPaneStateful.js +6 -0
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +22 -10
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +26 -6
- package/lib/esm/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +82 -0
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -12
- package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -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 +23 -46
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- 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/middlewares/storemiddlewares/conversationEndMiddleware.js +6 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +32 -0
- package/lib/esm/contexts/common/ConversationState.js +4 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +13 -7
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +12 -4
- package/lib/esm/contexts/createReducer.js +44 -9
- package/lib/esm/controller/componentController.js +5 -5
- package/lib/esm/plugins/newMessageEventHandler.js +82 -0
- package/lib/types/assets/Audios.d.ts +1 -0
- package/lib/types/assets/Icons.d.ts +11 -0
- package/lib/types/common/Constants.d.ts +27 -1
- package/lib/types/common/contextDataStore/DataStoreManager.d.ts +4 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +14 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +45 -2
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +2 -0
- package/lib/types/common/telemetry/TelemetryManager.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +3 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +15 -9
- package/lib/types/common/telemetry/interfaces/IChatSDKLogger.d.ts +1 -0
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +2 -0
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +12 -0
- package/lib/types/common/utils.d.ts +8 -1
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +5 -2
- package/lib/types/components/footerstateful/audionotificationstateful/interfaces/IAudioNotificationStatefulParams.d.ts +0 -1
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +5 -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/authHelper.d.ts +4 -0
- package/lib/types/components/livechatwidget/common/disposeTelemetryLoggers.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +6 -2
- 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 +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetComponentOverrides.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +4 -1
- package/lib/types/components/prechatsurveypanestateful/interfaces/IPreChatSurveyPaneStatefulParams.d.ts +1 -1
- package/lib/types/components/proactivechatpanestateful/interfaces/IProactiveChatNotificationConfig.d.ts +3 -0
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +0 -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/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.d.ts +1 -0
- package/lib/types/contexts/common/ConversationState.d.ts +4 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -1
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +14 -8
- package/lib/types/plugins/newMessageEventHandler.d.ts +2 -0
- package/package.json +13 -12
- package/lib/cjs/assets/audios/newMessageNotification.mp3 +0 -0
- package/lib/cjs/assets/icons/archiveIcon.svg +0 -3
- package/lib/cjs/assets/icons/audioIcon.svg +0 -6
- package/lib/cjs/assets/icons/blankIcon.svg +0 -6
- package/lib/cjs/assets/icons/excelIcon.svg +0 -6
- package/lib/cjs/assets/icons/imageIcon.svg +0 -6
- package/lib/cjs/assets/icons/oneNoteIcon.svg +0 -6
- package/lib/cjs/assets/icons/pdfIcon.svg +0 -6
- package/lib/cjs/assets/icons/powerpointIcon.svg +0 -6
- package/lib/cjs/assets/icons/videoIcon.svg +0 -6
- package/lib/cjs/assets/icons/visioIcon.svg +0 -6
- package/lib/cjs/assets/icons/wordIcon.svg +0 -6
- package/lib/esm/assets/assets.d.js +0 -0
- package/lib/esm/assets/audios/newMessageNotification.mp3 +0 -0
- package/lib/esm/assets/icons/archiveIcon.svg +0 -3
- package/lib/esm/assets/icons/audioIcon.svg +0 -6
- package/lib/esm/assets/icons/blankIcon.svg +0 -6
- package/lib/esm/assets/icons/excelIcon.svg +0 -6
- package/lib/esm/assets/icons/imageIcon.svg +0 -6
- package/lib/esm/assets/icons/oneNoteIcon.svg +0 -6
- package/lib/esm/assets/icons/pdfIcon.svg +0 -6
- package/lib/esm/assets/icons/powerpointIcon.svg +0 -6
- package/lib/esm/assets/icons/videoIcon.svg +0 -6
- package/lib/esm/assets/icons/visioIcon.svg +0 -6
- package/lib/esm/assets/icons/wordIcon.svg +0 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isNullOrEmptyString, isNullOrUndefined } from "../../utils";
|
|
1
|
+
import { getDomain, isNullOrEmptyString, isNullOrUndefined } from "../../utils";
|
|
2
2
|
import AWTEventProperties from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTEventProperties";
|
|
3
3
|
import AWTLogManager from "@microsoft/omnichannel-chat-sdk/lib/external/aria/webjs/AWTLogManager";
|
|
4
4
|
import { AWTPiiKind } from "@microsoft/omnichannel-chat-sdk/lib/external/aria/common/Enums";
|
|
5
|
-
import { Constants } from "../../Constants";
|
|
6
|
-
import {
|
|
5
|
+
import { Constants, AriaTelemetryConstants, EnvironmentVersion } from "../../Constants";
|
|
6
|
+
import { TelemetryManager } from "../TelemetryManager";
|
|
7
7
|
export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, collectiorUriForTelemetry, ariaTelemetryApplicationName) => {
|
|
8
8
|
let _logger;
|
|
9
9
|
|
|
@@ -15,9 +15,32 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
15
15
|
|
|
16
16
|
if (!isNullOrEmptyString(collectiorUriForTelemetry)) {
|
|
17
17
|
configuration.collectorUri = collectiorUriForTelemetry;
|
|
18
|
+
} else {
|
|
19
|
+
if (TelemetryManager.InternalTelemetryData.environmentVersion == EnvironmentVersion.prod) {
|
|
20
|
+
var _TelemetryManager$Int;
|
|
21
|
+
|
|
22
|
+
const orgUrl = (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.orgUrl;
|
|
23
|
+
|
|
24
|
+
if (!isNullOrUndefined(orgUrl)) {
|
|
25
|
+
// If the given org is a Production EU org, modify the Aria collector uri
|
|
26
|
+
const region = getDomain(orgUrl);
|
|
27
|
+
|
|
28
|
+
if (region === AriaTelemetryConstants.EU) {
|
|
29
|
+
configuration.collectorUri = AriaTelemetryConstants.EUROPE_ENDPOINT;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
18
33
|
}
|
|
19
34
|
|
|
20
|
-
|
|
35
|
+
try {
|
|
36
|
+
_logger = AWTLogManager.initialize(ariaTelemetryKey, configuration);
|
|
37
|
+
|
|
38
|
+
if (_logger === undefined) {
|
|
39
|
+
_logger = AWTLogManager.getLogger(ariaTelemetryKey);
|
|
40
|
+
}
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.log(error);
|
|
43
|
+
}
|
|
21
44
|
}
|
|
22
45
|
|
|
23
46
|
return _logger;
|
|
@@ -25,18 +48,30 @@ export const ariaTelemetryLogger = (ariaTelemetryKey, disabledCookieUsage, colle
|
|
|
25
48
|
|
|
26
49
|
const ariaLogger = {
|
|
27
50
|
log: (logLevel, telemetryInput) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
51
|
+
try {
|
|
52
|
+
let property;
|
|
53
|
+
const telemetryInfo = telemetryInput === null || telemetryInput === void 0 ? void 0 : telemetryInput.telemetryInfo;
|
|
54
|
+
const eventProperties = new AWTEventProperties();
|
|
55
|
+
eventProperties.setName(telemetryInput.scenarioType);
|
|
56
|
+
|
|
57
|
+
if (telemetryInfo) {
|
|
58
|
+
for (const key of Object.keys(telemetryInfo)) {
|
|
59
|
+
property = typeof telemetryInfo[key] === "object" ? JSON.stringify(telemetryInfo[key]) : telemetryInfo[key];
|
|
60
|
+
eventProperties.setProperty(key, property);
|
|
61
|
+
}
|
|
37
62
|
|
|
38
|
-
|
|
39
|
-
|
|
63
|
+
eventProperties.setPropertyWithPii(ariaTelemetryApplicationName, Constants.LiveChatWidget, AWTPiiKind.GenericData);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
logger() ? logger().logEvent(eventProperties) : console.log("Unable to initialize aria logger");
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error("Error in logging telemetry to Aria logger:" + error);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
dispose: () => {
|
|
72
|
+
AWTLogManager.flush(function () {
|
|
73
|
+
console.log("Aria logger disposed");
|
|
74
|
+
});
|
|
40
75
|
}
|
|
41
76
|
};
|
|
42
77
|
return ariaLogger;
|
|
@@ -4,32 +4,36 @@ export const consoleLogger = () => {
|
|
|
4
4
|
const consoleLogger = {
|
|
5
5
|
log: (logLevel, telemetryInput) => {
|
|
6
6
|
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 : "";
|
|
7
|
+
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 : "";
|
|
7
8
|
|
|
8
9
|
try {
|
|
9
10
|
switch (logLevel) {
|
|
10
11
|
case LogLevel.INFO:
|
|
11
|
-
console.info(Constants.LiveChatWidget, payload);
|
|
12
|
+
console.info(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
12
13
|
break;
|
|
13
14
|
|
|
14
15
|
case LogLevel.DEBUG:
|
|
15
|
-
console.debug(Constants.LiveChatWidget, payload);
|
|
16
|
+
console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
16
17
|
break;
|
|
17
18
|
|
|
18
19
|
case LogLevel.WARN:
|
|
19
|
-
console.warn(Constants.LiveChatWidget, payload);
|
|
20
|
+
console.warn(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
20
21
|
break;
|
|
21
22
|
|
|
22
23
|
case LogLevel.ERROR:
|
|
23
|
-
console.error(Constants.LiveChatWidget, payload);
|
|
24
|
+
console.error(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
24
25
|
break;
|
|
25
26
|
|
|
26
27
|
default:
|
|
27
|
-
console.debug(Constants.LiveChatWidget, payload);
|
|
28
|
+
console.debug(Constants.LiveChatWidget, payload, telemetryInfo);
|
|
28
29
|
break;
|
|
29
30
|
}
|
|
30
31
|
} catch (ex) {
|
|
31
32
|
console.error("An unexpected error occurred in the Telemetry client: " + ex);
|
|
32
33
|
}
|
|
34
|
+
},
|
|
35
|
+
dispose: () => {
|
|
36
|
+
console.log("disposing loggers");
|
|
33
37
|
}
|
|
34
38
|
};
|
|
35
39
|
return consoleLogger;
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { Constants, LocaleConstants } from "./Constants";
|
|
1
|
+
import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
|
|
2
|
+
import { DataStoreManager } from "./contextDataStore/DataStoreManager";
|
|
2
3
|
import { KeyCodes } from "./KeyCodes";
|
|
4
|
+
import { BroadcastEvent } from "./telemetry/TelemetryConstants";
|
|
5
|
+
import { Md5 } from "md5-typescript";
|
|
3
6
|
|
|
4
7
|
const getElementBySelector = selector => {
|
|
5
8
|
let element;
|
|
@@ -276,4 +279,64 @@ export const createTimer = () => {
|
|
|
276
279
|
}
|
|
277
280
|
|
|
278
281
|
};
|
|
282
|
+
}; // Returns the domain of the org
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
284
|
+
|
|
285
|
+
export const getDomain = hostValue => {
|
|
286
|
+
for (let i = 0; i < AriaTelemetryConstants.lcwEUDomainNames.length; i++) {
|
|
287
|
+
if (hostValue.endsWith(AriaTelemetryConstants.lcwEUDomainNames[i])) {
|
|
288
|
+
return AriaTelemetryConstants.EU;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return AriaTelemetryConstants.Public;
|
|
293
|
+
};
|
|
294
|
+
export const getWidgetCacheId = (orgId, widgetId, widgetInstanceId) => {
|
|
295
|
+
const widgetCacheId = `${widgetInstanceId}_${orgId}_${widgetId}`;
|
|
296
|
+
return Md5.init(widgetCacheId);
|
|
297
|
+
};
|
|
298
|
+
export const getWidgetEndChatEventName = (orgId, widgetId, widgetInstanceId) => {
|
|
299
|
+
if (!isNullOrEmptyString(widgetInstanceId)) {
|
|
300
|
+
return `${BroadcastEvent.ChatEnded}_${widgetInstanceId}_${orgId}_${widgetId}`;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
|
|
304
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
305
|
+
|
|
306
|
+
export const getStateFromCache = (orgId, widgetId, widgetInstanceId) => {
|
|
307
|
+
// Getting updated state from cache
|
|
308
|
+
try {
|
|
309
|
+
if (DataStoreManager.clientDataStore) {
|
|
310
|
+
var _DataStoreManager$cli;
|
|
311
|
+
|
|
312
|
+
const widgetStateEventName = getWidgetCacheId(orgId, widgetId, widgetInstanceId);
|
|
313
|
+
const widgetStateFromCache = (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateEventName, "localStorage");
|
|
314
|
+
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
315
|
+
return persistedState;
|
|
316
|
+
} else {
|
|
317
|
+
return null;
|
|
318
|
+
}
|
|
319
|
+
} catch (error) {
|
|
320
|
+
console.log(error);
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
324
|
+
|
|
325
|
+
export const isUndefinedOrEmpty = object => {
|
|
326
|
+
if (object) {
|
|
327
|
+
if (Object.keys(object).length === 0) {
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return false;
|
|
332
|
+
} else {
|
|
333
|
+
return true;
|
|
334
|
+
}
|
|
335
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
336
|
+
|
|
337
|
+
export const addDelayInMs = ms => {
|
|
338
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
339
|
+
};
|
|
340
|
+
export const getBroadcastChannelName = (widgetId, widgetInstanceId) => {
|
|
341
|
+
return widgetInstanceId && !isNullOrEmptyString(widgetInstanceId) ? `${widgetInstanceId}_${widgetId}` : widgetId;
|
|
279
342
|
};
|
|
@@ -177,6 +177,20 @@ export const CallingContainerStateful = props => {
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
+
window.addEventListener("beforeunload", () => {
|
|
181
|
+
if (state.uiStates.isIncomingCall) {
|
|
182
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.rejectCall();
|
|
183
|
+
} else {
|
|
184
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.stopCall();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
voiceVideoCallingSdk === null || voiceVideoCallingSdk === void 0 ? void 0 : voiceVideoCallingSdk.close();
|
|
188
|
+
dispatch({
|
|
189
|
+
type: LiveChatWidgetActionType.SET_E2VV_ENABLED,
|
|
190
|
+
payload: false
|
|
191
|
+
});
|
|
192
|
+
resetCallingStates(true);
|
|
193
|
+
});
|
|
180
194
|
}, []);
|
|
181
195
|
const controlProps = {
|
|
182
196
|
id: "oc-lcw-callingcontainer",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
3
|
-
import { ChatButton } from "@microsoft/omnichannel-chat-components";
|
|
1
|
+
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
+
import { BroadcastService, ChatButton } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Constants } from "../../common/Constants";
|
|
5
5
|
import { setFocusOnElement } from "../../common/utils";
|
|
6
6
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
@@ -10,7 +10,7 @@ import { TelemetryTimers } from "../../common/telemetry/TelemetryManager";
|
|
|
10
10
|
import { defaultOutOfOfficeChatButtonStyleProps } from "./common/styleProps/defaultOutOfOfficeChatButtonStyleProps";
|
|
11
11
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
12
12
|
export const ChatButtonStateful = props => {
|
|
13
|
-
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
|
|
13
|
+
var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
|
|
14
14
|
|
|
15
15
|
const [state, dispatch] = useChatContextStore();
|
|
16
16
|
const {
|
|
@@ -20,20 +20,26 @@ export const ChatButtonStateful = props => {
|
|
|
20
20
|
} = props; //Setting OutOfOperatingHours Flag
|
|
21
21
|
|
|
22
22
|
const [outOfOperatingHours, setOutOfOperatingHours] = 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");
|
|
23
|
+
const proactiveChatInNewWindow = useRef(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
|
|
23
24
|
const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
24
25
|
const controlProps = {
|
|
25
26
|
id: "oc-lcw-chat-button",
|
|
26
27
|
dir: state.domainStates.globalDir,
|
|
27
28
|
titleText: "Let's Chat!",
|
|
28
29
|
subtitleText: "We're online.",
|
|
29
|
-
hideNotificationBubble:
|
|
30
|
-
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ?
|
|
30
|
+
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,
|
|
31
|
+
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > 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",
|
|
31
32
|
onClick: async () => {
|
|
32
33
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
33
34
|
Event: TelemetryEvent.LCWChatButtonClicked
|
|
34
35
|
});
|
|
35
36
|
|
|
36
|
-
if (
|
|
37
|
+
if (proactiveChatInNewWindow.current) {
|
|
38
|
+
const proactiveChatIsInPopoutModeEvent = {
|
|
39
|
+
eventName: BroadcastEvent.ProactiveChatIsInPopoutMode
|
|
40
|
+
};
|
|
41
|
+
BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
|
|
42
|
+
} else if (state.appStates.isMinimized) {
|
|
37
43
|
dispatch({
|
|
38
44
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
39
45
|
payload: false
|
|
@@ -42,6 +48,7 @@ export const ChatButtonStateful = props => {
|
|
|
42
48
|
await startChat();
|
|
43
49
|
}
|
|
44
50
|
},
|
|
51
|
+
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,
|
|
45
52
|
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
|
|
46
53
|
};
|
|
47
54
|
const outOfOfficeControlProps = {
|
|
@@ -50,6 +57,10 @@ export const ChatButtonStateful = props => {
|
|
|
50
57
|
titleText: "We're Offline",
|
|
51
58
|
subtitleText: "No agents available",
|
|
52
59
|
onClick: async () => {
|
|
60
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
61
|
+
Event: TelemetryEvent.LCWChatButtonClicked
|
|
62
|
+
});
|
|
63
|
+
|
|
53
64
|
if (state.appStates.isMinimized) {
|
|
54
65
|
dispatch({
|
|
55
66
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
@@ -62,6 +73,7 @@ export const ChatButtonStateful = props => {
|
|
|
62
73
|
});
|
|
63
74
|
}
|
|
64
75
|
},
|
|
76
|
+
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,
|
|
65
77
|
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
66
78
|
};
|
|
67
79
|
useEffect(() => {
|
|
@@ -83,6 +95,9 @@ export const ChatButtonStateful = props => {
|
|
|
83
95
|
});
|
|
84
96
|
}
|
|
85
97
|
}, []);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
|
|
100
|
+
}, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
|
|
86
101
|
return /*#__PURE__*/React.createElement(ChatButton, {
|
|
87
102
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
88
103
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
|
@@ -1,40 +1,29 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { ConfirmationPane } from "@microsoft/omnichannel-chat-components";
|
|
2
3
|
import React, { useEffect } from "react";
|
|
3
4
|
import { findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, preventFocusToMoveOutOfElement, setFocusOnElement, setFocusOnSendBox, setTabIndices } from "../../common/utils";
|
|
4
|
-
import { ConfirmationPane } from "@microsoft/omnichannel-chat-components";
|
|
5
|
-
import { Constants } from "../../common/Constants";
|
|
6
|
-
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
7
5
|
import { DimLayer } from "../dimlayer/DimLayer";
|
|
8
6
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
9
7
|
import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
10
8
|
import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
11
|
-
import { PostChatSurveyMode } from "../postchatsurveypanestateful/enums/PostChatSurveyMode";
|
|
12
9
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
13
10
|
import useChatAdapterStore from "../../hooks/useChatAdapterStore";
|
|
14
|
-
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
15
|
-
import useChatSDKStore from "../../hooks/useChatSDKStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
+
import useChatContextStore from "../../hooks/useChatContextStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
12
|
|
|
17
13
|
export const ConfirmationPaneStateful = props => {
|
|
18
|
-
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
|
|
19
|
-
|
|
20
14
|
const initialTabIndexMap = new Map();
|
|
21
15
|
let elements = [];
|
|
22
16
|
const [state, dispatch] = useChatContextStore();
|
|
23
17
|
const {
|
|
24
|
-
|
|
25
|
-
endChat
|
|
18
|
+
prepareEndChat
|
|
26
19
|
} = props; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
20
|
|
|
28
|
-
const chatSDK = useChatSDKStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
|
|
30
21
|
const [adapter] = useChatAdapterStore();
|
|
31
|
-
const isPostChatEnabled = (_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.msdyn_postconversationsurveyenable;
|
|
32
|
-
const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
|
|
33
22
|
const controlProps = {
|
|
34
23
|
id: "oc-lcw-confirmation-pane",
|
|
35
24
|
dir: state.domainStates.globalDir,
|
|
36
25
|
onConfirm: async () => {
|
|
37
|
-
TelemetryHelper.
|
|
26
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
38
27
|
Event: TelemetryEvent.ConfirmationConfirmButtonClicked,
|
|
39
28
|
Description: "Confirmation pane Confirm button clicked"
|
|
40
29
|
});
|
|
@@ -44,40 +33,8 @@ export const ConfirmationPaneStateful = props => {
|
|
|
44
33
|
});
|
|
45
34
|
|
|
46
35
|
try {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (isPostChatEnabled === "true" && postChatSurveyMode === PostChatSurveyMode.Embed && conversationDetails.canRenderPostChat === Constants.truePascal) {
|
|
51
|
-
dispatch({
|
|
52
|
-
type: LiveChatWidgetActionType.SET_SHOULD_SHOW_POST_CHAT,
|
|
53
|
-
payload: true
|
|
54
|
-
});
|
|
55
|
-
dispatch({
|
|
56
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
57
|
-
payload: ConversationState.Loading
|
|
58
|
-
});
|
|
59
|
-
await setPostChatContext();
|
|
60
|
-
|
|
61
|
-
if (state.domainStates.postChatContext) {
|
|
62
|
-
dispatch({
|
|
63
|
-
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
64
|
-
payload: ConversationState.Postchat
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
setTabIndices(elements, initialTabIndexMap, true);
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
await endChat(adapter);
|
|
72
|
-
} catch (error) {
|
|
73
|
-
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
74
|
-
Event: TelemetryEvent.CloseChatMethodException,
|
|
75
|
-
ExceptionDetails: {
|
|
76
|
-
exception: `Failed to endChat: ${error}`
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
36
|
+
setTabIndices(elements, initialTabIndexMap, true);
|
|
37
|
+
await prepareEndChat(adapter, state);
|
|
81
38
|
} catch (ex) {
|
|
82
39
|
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
83
40
|
Event: TelemetryEvent.GetConversationDetailsCallFailed,
|
|
@@ -89,7 +46,7 @@ export const ConfirmationPaneStateful = props => {
|
|
|
89
46
|
}
|
|
90
47
|
},
|
|
91
48
|
onCancel: () => {
|
|
92
|
-
TelemetryHelper.
|
|
49
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
93
50
|
Event: TelemetryEvent.ConfirmationCancelButtonClicked,
|
|
94
51
|
Description: "Confirmation pane Cancel button clicked."
|
|
95
52
|
});
|
|
@@ -68,8 +68,8 @@ export const EmailTranscriptPaneStateful = props => {
|
|
|
68
68
|
},
|
|
69
69
|
onCancel: () => {
|
|
70
70
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
71
|
-
Event: TelemetryEvent.
|
|
72
|
-
Description: "Email Transcript button clicked."
|
|
71
|
+
Event: TelemetryEvent.EmailTranscriptCancelButtonClicked,
|
|
72
|
+
Description: "Email Transcript cancel button clicked."
|
|
73
73
|
});
|
|
74
74
|
closeEmailTranscriptPane();
|
|
75
75
|
},
|
|
@@ -4,13 +4,13 @@ import AudioNotificationStateful from "./audionotificationstateful/AudioNotifica
|
|
|
4
4
|
import { Constants } from "../../common/Constants";
|
|
5
5
|
import { Footer } from "@microsoft/omnichannel-chat-components";
|
|
6
6
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
7
|
+
import { NewMessageNotificationSoundBase64 } from "../../assets/Audios";
|
|
7
8
|
import { NotificationHandler } from "../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
8
9
|
import { NotificationScenarios } from "../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
9
10
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
10
11
|
import { downloadTranscript } from "./downloadtranscriptstateful/DownloadTranscriptStateful";
|
|
11
12
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
12
|
-
import useChatSDKStore from "../../hooks/useChatSDKStore";
|
|
13
|
-
import newMessageNotification from "../../assets/audios/newMessageNotification.mp3"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
import useChatSDKStore from "../../hooks/useChatSDKStore"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
14
|
|
|
15
15
|
export const FooterStateful = props => {
|
|
16
16
|
var _footerProps$controlP3, _footerProps$controlP4;
|
|
@@ -96,9 +96,8 @@ export const FooterStateful = props => {
|
|
|
96
96
|
controlProps: controlProps,
|
|
97
97
|
styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
|
|
98
98
|
}), /*#__PURE__*/React.createElement(AudioNotificationStateful, {
|
|
99
|
-
audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ??
|
|
100
|
-
|
|
101
|
-
isAudioMuted: state.appStates.isAudioMuted ?? false
|
|
99
|
+
audioSrc: (audioNotificationProps === null || audioNotificationProps === void 0 ? void 0 : audioNotificationProps.audioSrc) ?? NewMessageNotificationSoundBase64,
|
|
100
|
+
isAudioMuted: state.appStates.isAudioMuted === null ? (footerProps === null || footerProps === void 0 ? void 0 : (_footerProps$controlP4 = footerProps.controlProps) === null || _footerProps$controlP4 === void 0 ? void 0 : _footerProps$controlP4.hideAudioNotificationButton) ?? false : state.appStates.isAudioMuted ?? false
|
|
102
101
|
}));
|
|
103
102
|
};
|
|
104
103
|
export default FooterStateful;
|
package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js
CHANGED
|
@@ -105,8 +105,14 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
105
105
|
let fileAttachmentName = TranscriptConstants.DefaultFileAttachmentName;
|
|
106
106
|
let dialogColor = TranscriptConstants.CustomerDialogColor;
|
|
107
107
|
let fontColor = TranscriptConstants.CustomerFontColor;
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1;
|
|
109
|
+
const isControlMessage = value.isControlMessage && value.isControlMessage === true;
|
|
110
|
+
const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType;
|
|
111
|
+
const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode;
|
|
112
|
+
const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.hiddenTag.toLowerCase()) !== -1;
|
|
113
|
+
const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
|
|
114
|
+
|
|
115
|
+
if (shouldIgnoreMessage) {
|
|
110
116
|
return;
|
|
111
117
|
} else if (value.from) {
|
|
112
118
|
if (value.from.application) {
|
|
@@ -127,7 +133,7 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
|
|
|
127
133
|
|
|
128
134
|
if (value.attachments && value.attachments.length > 0 && value.attachments[0].name) {
|
|
129
135
|
fileAttachmentName = value.attachments[0].name;
|
|
130
|
-
value.content = attachmentMessage
|
|
136
|
+
value.content = attachmentMessage ? attachmentMessage + " " + fileAttachmentName : "The following attachment was uploaded during the conversation: " + fileAttachmentName;
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
2
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
4
4
|
import { Header } from "@microsoft/omnichannel-chat-components";
|
|
5
5
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
@@ -21,6 +21,7 @@ export const HeaderStateful = props => {
|
|
|
21
21
|
|
|
22
22
|
const [outOfOperatingHours, setOutOfOperatingHours] = 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");
|
|
23
23
|
const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
|
|
24
|
+
const conversationState = useRef(state.appStates.conversationState);
|
|
24
25
|
const controlProps = {
|
|
25
26
|
id: "oc-lcw-header",
|
|
26
27
|
dir: state.domainStates.globalDir,
|
|
@@ -40,17 +41,16 @@ export const HeaderStateful = props => {
|
|
|
40
41
|
Description: "Header Close button clicked."
|
|
41
42
|
});
|
|
42
43
|
|
|
43
|
-
if (
|
|
44
|
+
if (conversationState.current === ConversationState.Active) {
|
|
44
45
|
dispatch({
|
|
45
46
|
type: LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
|
|
46
47
|
payload: true
|
|
47
48
|
});
|
|
48
|
-
} else
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
await endChat(adapter);
|
|
49
|
+
} else {
|
|
50
|
+
const skipEndChatSDK = true;
|
|
51
|
+
const skipCloseChat = false;
|
|
52
|
+
const postMessageToOtherTabs = true;
|
|
53
|
+
await endChat(adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTabs);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
dispatch({
|
|
@@ -59,8 +59,8 @@ export const HeaderStateful = props => {
|
|
|
59
59
|
});
|
|
60
60
|
},
|
|
61
61
|
...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
|
|
62
|
-
hideTitle: state.appStates.conversationState === ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
|
|
63
|
-
hideIcon: state.appStates.conversationState === ConversationState.Loading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
|
|
62
|
+
hideTitle: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
|
|
63
|
+
hideIcon: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
|
|
64
64
|
hideCloseButton: state.appStates.conversationState === ConversationState.Loading || state.appStates.conversationState === ConversationState.Prechat || state.appStates.conversationState === ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
|
|
65
65
|
};
|
|
66
66
|
const outOfOfficeControlProps = {
|
|
@@ -82,7 +82,11 @@ export const HeaderStateful = props => {
|
|
|
82
82
|
if (state.appStates.outsideOperatingHours) {
|
|
83
83
|
setOutOfOperatingHours(true);
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
|
|
86
|
+
if (state.appStates.conversationState) {
|
|
87
|
+
conversationState.current = state.appStates.conversationState;
|
|
88
|
+
}
|
|
89
|
+
}, [state.appStates]);
|
|
86
90
|
return /*#__PURE__*/React.createElement(Header, {
|
|
87
91
|
componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
|
|
88
92
|
controlProps: outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeControlProps : controlProps,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
import { Deferred } from "./Deferred";
|
|
4
|
+
export class ActivityStreamHandler {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Use of a deferred pattern, to hold the execution of the activity.
|
|
10
|
+
*
|
|
11
|
+
* */
|
|
12
|
+
static cork() {
|
|
13
|
+
ActivityStreamHandler.restoreDeferred = new Deferred();
|
|
14
|
+
ActivityStreamHandler.restorePromise = ActivityStreamHandler.restoreDeferred.promise;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the promise, releasing it to continue with the execution of the activity.
|
|
18
|
+
*
|
|
19
|
+
* */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
static uncork() {
|
|
23
|
+
ActivityStreamHandler.restoreDeferred.resolve();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_defineProperty(ActivityStreamHandler, "restoreDeferred", {
|
|
29
|
+
resolve: () => {
|
|
30
|
+
return "initialState";
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
_defineProperty(ActivityStreamHandler, "restorePromise", void 0);
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
export class DefaultActivitySubscriber {
|
|
4
|
+
constructor() {
|
|
5
|
+
_defineProperty(this, "observer", void 0);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
async next(activity) {
|
|
10
|
+
this.observer.next(activity);
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
import { ActivityStreamHandler } from "../ActivityStreamHandler";
|
|
4
|
+
export class PauseActivitySubscriber {
|
|
5
|
+
constructor() {
|
|
6
|
+
_defineProperty(this, "observer", void 0);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
async apply(activity) {
|
|
11
|
+
await ActivityStreamHandler.restorePromise;
|
|
12
|
+
return activity;
|
|
13
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
applicable(activity) {
|
|
17
|
+
return true;
|
|
18
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
async next(activity) {
|
|
22
|
+
if (this.applicable(activity)) {
|
|
23
|
+
return await this.apply(activity);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return activity;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|