@microsoft/omnichannel-chat-widget 1.8.3-main.ec1328d → 1.8.4-main.424a580
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/common/Constants.js +7 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
- package/lib/cjs/common/telemetry/AppInsightsEvents.js +4 -5
- package/lib/cjs/common/telemetry/TelemetryConstants.js +47 -2
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +26 -10
- package/lib/cjs/common/utils/SecureEventBus.js +307 -0
- package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
- package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +218 -0
- package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
- package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
- package/lib/cjs/components/headerstateful/HeaderStateful.js +8 -2
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +127 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +15 -0
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +287 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +18 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +28 -3
- package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +10 -5
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +24 -4
- package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
- package/lib/cjs/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +51 -8
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +29 -2
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -3
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +127 -11
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/common/activities/botActivity.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +17 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +97 -0
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +36 -2
- package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
- package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +59 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +122 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +47 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1038 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +34 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +50 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +20 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +59 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +97 -30
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +47 -45
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +9 -1
- package/lib/cjs/contexts/createReducer.js +30 -0
- package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/cjs/index.js +9 -1
- package/lib/cjs/plugins/newMessageEventHandler.js +4 -1
- package/lib/esm/common/Constants.js +7 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +4 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +45 -1
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +27 -11
- package/lib/esm/common/utils/SecureEventBus.js +328 -0
- package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -5
- package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +207 -0
- package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
- package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
- package/lib/esm/components/headerstateful/HeaderStateful.js +9 -3
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +120 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +8 -0
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +280 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +11 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +29 -4
- package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +12 -7
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +23 -4
- package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
- package/lib/esm/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +52 -9
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +31 -4
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -4
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +130 -12
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/common/activities/botActivity.js +7 -0
- package/lib/esm/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +9 -0
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +90 -0
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +32 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
- package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +51 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +115 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +39 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1060 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +25 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +48 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +52 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +3 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +98 -30
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +47 -45
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +9 -1
- package/lib/esm/contexts/createReducer.js +30 -0
- package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/esm/index.js +1 -0
- package/lib/esm/plugins/newMessageEventHandler.js +4 -1
- package/lib/types/common/Constants.d.ts +6 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +42 -2
- package/lib/types/common/utils/SecureEventBus.d.ts +159 -0
- package/lib/types/common/utils/dispatchCustomEvent.d.ts +2 -0
- package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
- package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
- package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
- package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
- package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.d.ts +45 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/PersistentConversationHandler.d.ts +28 -0
- package/lib/types/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -1
- package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +12 -0
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
- package/lib/types/components/webchatcontainerstateful/common/activities/botActivity.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/common/activities/conversationDividerActivity.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +6 -1
- package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/hooks/usePersistentChatHistory.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +326 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.d.ts +8 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +3 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +6 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +47 -45
- package/lib/types/index.d.ts +1 -0
- package/package.json +3 -3
- /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
- /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
- /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.logWidgetLoadWithUnexpectedError = exports.logWidgetLoadComplete = exports.handleStartChatError = void 0;
|
|
6
|
+
exports.logWidgetLoadWithUnexpectedError = exports.logWidgetLoadComplete = exports.logStartChatComplete = exports.handleStartChatError = void 0;
|
|
7
7
|
var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
var _Constants = require("../../../common/Constants");
|
|
@@ -124,7 +124,10 @@ const logWidgetLoadFailed = ex => {
|
|
|
124
124
|
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
125
125
|
Description: "Widget load complete with error",
|
|
126
126
|
ExceptionDetails: exDetails,
|
|
127
|
-
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg === void 0 ? void 0 : _TelemetryTimers$Widg.milliSecondsElapsed
|
|
127
|
+
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg === void 0 ? void 0 : _TelemetryTimers$Widg.milliSecondsElapsed,
|
|
128
|
+
CustomProperties: {
|
|
129
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
130
|
+
}
|
|
128
131
|
});
|
|
129
132
|
};
|
|
130
133
|
const logWidgetLoadComplete = additionalMessage => {
|
|
@@ -140,6 +143,17 @@ const logWidgetLoadComplete = additionalMessage => {
|
|
|
140
143
|
});
|
|
141
144
|
};
|
|
142
145
|
exports.logWidgetLoadComplete = logWidgetLoadComplete;
|
|
146
|
+
const logStartChatComplete = additionalMessage => {
|
|
147
|
+
let descriptionString = "Start chat complete";
|
|
148
|
+
if (additionalMessage) {
|
|
149
|
+
descriptionString += `. ${additionalMessage}`;
|
|
150
|
+
}
|
|
151
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
152
|
+
Event: _TelemetryConstants.TelemetryEvent.StartChatComplete,
|
|
153
|
+
Description: descriptionString
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
exports.logStartChatComplete = logStartChatComplete;
|
|
143
157
|
const logWidgetLoadCompleteWithError = ex => {
|
|
144
158
|
var _TelemetryTimers$Widg3;
|
|
145
159
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -156,7 +170,10 @@ const logWidgetLoadCompleteWithError = ex => {
|
|
|
156
170
|
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
157
171
|
Description: "Widget load complete with error",
|
|
158
172
|
ExceptionDetails: exDetails,
|
|
159
|
-
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
|
|
173
|
+
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed,
|
|
174
|
+
CustomProperties: {
|
|
175
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
176
|
+
}
|
|
160
177
|
});
|
|
161
178
|
};
|
|
162
179
|
const logWidgetLoadWithUnexpectedError = ex => {
|
|
@@ -184,7 +201,10 @@ const logWidgetLoadWithUnexpectedError = ex => {
|
|
|
184
201
|
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadFailed,
|
|
185
202
|
Description: "Widget load with unexpected error",
|
|
186
203
|
ExceptionDetails: exDetails,
|
|
187
|
-
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed
|
|
204
|
+
ElapsedTimeInMilliseconds: _TelemetryManager.TelemetryTimers === null || _TelemetryManager.TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = _TelemetryManager.TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed,
|
|
205
|
+
CustomProperties: {
|
|
206
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
207
|
+
}
|
|
188
208
|
});
|
|
189
209
|
};
|
|
190
210
|
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LiveChatWidgetMockType = void 0;
|
|
7
|
+
let LiveChatWidgetMockType;
|
|
8
|
+
exports.LiveChatWidgetMockType = LiveChatWidgetMockType;
|
|
4
9
|
(function (LiveChatWidgetMockType) {
|
|
5
10
|
LiveChatWidgetMockType["Test"] = "Test";
|
|
6
11
|
LiveChatWidgetMockType["Demo"] = "Demo";
|
|
7
|
-
|
|
12
|
+
LiveChatWidgetMockType["Designer"] = "Designer";
|
|
13
|
+
})(LiveChatWidgetMockType || (exports.LiveChatWidgetMockType = LiveChatWidgetMockType = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -69,7 +69,10 @@ const LiveChatWidgetStateful = props => {
|
|
|
69
69
|
uiTimer = (0, _utils.createTimer)();
|
|
70
70
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
71
71
|
Event: _TelemetryConstants.TelemetryEvent.UXLiveChatWidgetStart,
|
|
72
|
-
Description: "Live chat widget loading started."
|
|
72
|
+
Description: "Live chat widget loading started.",
|
|
73
|
+
CustomProperties: {
|
|
74
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
75
|
+
}
|
|
73
76
|
});
|
|
74
77
|
}, []);
|
|
75
78
|
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
@@ -488,7 +491,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
488
491
|
eventName: _TelemetryConstants.BroadcastEvent.MaximizeChat,
|
|
489
492
|
payload: {
|
|
490
493
|
height: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : (_inMemoryState$domain2 = _inMemoryState$domain.widgetSize) === null || _inMemoryState$domain2 === void 0 ? void 0 : _inMemoryState$domain2.height,
|
|
491
|
-
width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width
|
|
494
|
+
width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width,
|
|
495
|
+
lcwRuntimeId: _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId
|
|
492
496
|
}
|
|
493
497
|
});
|
|
494
498
|
return;
|
|
@@ -499,7 +503,10 @@ const LiveChatWidgetStateful = props => {
|
|
|
499
503
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.InitiateEndChat).subscribe(async () => {
|
|
500
504
|
_TelemetryHelper.TelemetryHelper.logSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
501
505
|
Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
|
|
502
|
-
Description: "Received InitiateEndChat BroadcastEvent."
|
|
506
|
+
Description: "Received InitiateEndChat BroadcastEvent.",
|
|
507
|
+
CustomProperties: {
|
|
508
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
509
|
+
}
|
|
503
510
|
});
|
|
504
511
|
|
|
505
512
|
// This is to ensure to get latest state from cache in multitab
|
|
@@ -804,7 +811,10 @@ const LiveChatWidgetStateful = props => {
|
|
|
804
811
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
805
812
|
Event: _TelemetryConstants.TelemetryEvent.UXLiveChatWidgetCompleted,
|
|
806
813
|
Description: "Live chat widget loading completed.",
|
|
807
|
-
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
814
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
815
|
+
CustomProperties: {
|
|
816
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
817
|
+
}
|
|
808
818
|
});
|
|
809
819
|
}, []);
|
|
810
820
|
const initiateEndChatOnBrowserUnload = () => {
|
|
@@ -874,25 +884,58 @@ const LiveChatWidgetStateful = props => {
|
|
|
874
884
|
bubbleTextColor
|
|
875
885
|
}), [webChatStyles, bubbleBackground, bubbleTextColor]);
|
|
876
886
|
|
|
887
|
+
// React to dynamic bot avatar initials updates from context
|
|
888
|
+
(0, _react2.useEffect)(() => {
|
|
889
|
+
if (state.domainStates.botAvatarInitials && state.domainStates.botAvatarInitials !== webChatStyles.botAvatarInitials) {
|
|
890
|
+
setWebChatStyles(styles => ({
|
|
891
|
+
...styles,
|
|
892
|
+
botAvatarInitials: state.domainStates.botAvatarInitials
|
|
893
|
+
}));
|
|
894
|
+
}
|
|
895
|
+
}, [state.domainStates.botAvatarInitials]);
|
|
896
|
+
|
|
877
897
|
// WebChat's Composer can only be rendered if a directLine object is defined
|
|
878
898
|
return directLine && /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement("style", null, `
|
|
879
|
-
::-webkit-scrollbar {
|
|
899
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
|
|
880
900
|
width: ${scrollbarProps.width};
|
|
881
901
|
}
|
|
882
902
|
|
|
883
|
-
::-webkit-scrollbar-track {
|
|
903
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
|
|
884
904
|
background: ${scrollbarProps.trackBackgroundColor};
|
|
885
905
|
}
|
|
886
906
|
|
|
887
|
-
::-webkit-scrollbar-thumb {
|
|
907
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
|
|
888
908
|
background: ${scrollbarProps.thumbBackgroundColor};
|
|
889
909
|
border-radius: ${scrollbarProps.thumbBorderRadius};
|
|
890
910
|
}
|
|
891
911
|
|
|
892
|
-
::-webkit-scrollbar-thumb:hover {
|
|
912
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
|
|
893
913
|
background: ${scrollbarProps.thumbHoverColor};
|
|
894
914
|
}
|
|
895
915
|
|
|
916
|
+
/* High Contrast mode support - optimized for all variants */
|
|
917
|
+
@media (prefers-contrast: high), (-ms-high-contrast: active), (forced-colors: active) {
|
|
918
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
|
|
919
|
+
background: Canvas !important;
|
|
920
|
+
border: 1px solid CanvasText !important;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
|
|
924
|
+
background: CanvasText !important;
|
|
925
|
+
border: 1px solid Canvas !important;
|
|
926
|
+
min-height: 20px !important;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
|
|
930
|
+
background: Highlight !important;
|
|
931
|
+
border: 1px solid CanvasText !important;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-corner {
|
|
935
|
+
background: Canvas !important;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
|
|
896
939
|
.webchat__basic-transcript__activity-markdown-body > :last-child {
|
|
897
940
|
margin-bottom: 0px;
|
|
898
941
|
}
|
|
@@ -18,6 +18,7 @@ var _isValidSurveyUrl = _interopRequireDefault(require("./common/isValidSurveyUr
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
20
|
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; }
|
|
21
|
+
let uiTimer;
|
|
21
22
|
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact, customerVoiceSurveyCorrelationId) {
|
|
22
23
|
let showMultiLingual = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
23
24
|
const surveyLinkParams = new URLSearchParams({
|
|
@@ -31,6 +32,16 @@ const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, co
|
|
|
31
32
|
};
|
|
32
33
|
const PostChatSurveyPaneStateful = props => {
|
|
33
34
|
var _props$styleProps, _state$appStates, _props$controlProps;
|
|
35
|
+
(0, _react.useEffect)(() => {
|
|
36
|
+
uiTimer = (0, _utils.createTimer)();
|
|
37
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
38
|
+
Event: _TelemetryConstants.TelemetryEvent.UXPostChatPaneStarted,
|
|
39
|
+
Description: "Postchat survey pane loading started.",
|
|
40
|
+
CustomProperties: {
|
|
41
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}, []);
|
|
34
45
|
const [state] = (0, _useChatContextStore.default)();
|
|
35
46
|
const generalStyleProps = Object.assign({}, _defaultgeneralPostChatSurveyPaneStyleProps.defaultGeneralPostChatSurveyPaneStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
36
47
|
display: state.appStates.isMinimized ? "none" : "contents"
|
|
@@ -81,7 +92,14 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
81
92
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
82
93
|
Event: _TelemetryConstants.TelemetryEvent.PostChatSurveyLoaded
|
|
83
94
|
});
|
|
84
|
-
|
|
95
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
96
|
+
Event: _TelemetryConstants.TelemetryEvent.UXPostChatPaneCompleted,
|
|
97
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
98
|
+
Description: "Postchat survey pane loading completed.",
|
|
99
|
+
CustomProperties: {
|
|
100
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
101
|
+
}
|
|
102
|
+
});
|
|
85
103
|
//Customer Voice Telemetry Events
|
|
86
104
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
105
|
window.addEventListener("message", message => {
|
|
@@ -96,7 +114,10 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
96
114
|
} else if (data === _CustomerVoiceEvents.CustomerVoiceEvents.FormResponseSubmitted) {
|
|
97
115
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
98
116
|
Event: _TelemetryConstants.TelemetryEvent.CustomerVoiceFormResponseSubmitted,
|
|
99
|
-
Description: "Customer Voice form response submitted."
|
|
117
|
+
Description: "Customer Voice form response submitted.",
|
|
118
|
+
CustomProperties: {
|
|
119
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
120
|
+
}
|
|
100
121
|
});
|
|
101
122
|
} else if (data === _CustomerVoiceEvents.CustomerVoiceEvents.FormResponseError) {
|
|
102
123
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
|
|
@@ -104,6 +125,9 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
104
125
|
Description: "Customer Voice form response error.",
|
|
105
126
|
ExceptionDetails: {
|
|
106
127
|
message: "Customer Voice form response error."
|
|
128
|
+
},
|
|
129
|
+
CustomProperties: {
|
|
130
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
107
131
|
}
|
|
108
132
|
});
|
|
109
133
|
} else if (typeof data === "string" && data.startsWith(_CustomerVoiceEvents.CustomerVoiceEvents.FormsError)) {
|
|
@@ -112,6 +136,9 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
112
136
|
Description: "Customer Voice failed to load with forms error.",
|
|
113
137
|
ExceptionDetails: {
|
|
114
138
|
message: `Customer Voice forms error details: ${data}`
|
|
139
|
+
},
|
|
140
|
+
CustomProperties: {
|
|
141
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
115
142
|
}
|
|
116
143
|
});
|
|
117
144
|
}
|
|
@@ -28,7 +28,10 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
28
28
|
uiTimer = (0, _utils.createTimer)();
|
|
29
29
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
30
30
|
Event: _TelemetryConstants.TelemetryEvent.UXPrechatPaneStart,
|
|
31
|
-
Description: "Prechat survey pane loading started."
|
|
31
|
+
Description: "Prechat survey pane loading started.",
|
|
32
|
+
CustomProperties: {
|
|
33
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
34
|
+
}
|
|
32
35
|
});
|
|
33
36
|
}, []);
|
|
34
37
|
|
|
@@ -79,7 +82,10 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
79
82
|
onSubmit: async values => {
|
|
80
83
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
81
84
|
Event: _TelemetryConstants.TelemetryEvent.PrechatSubmitted,
|
|
82
|
-
Description: "Prechat survey submitted."
|
|
85
|
+
Description: "Prechat survey submitted.",
|
|
86
|
+
CustomProperties: {
|
|
87
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
88
|
+
}
|
|
83
89
|
});
|
|
84
90
|
dispatch({
|
|
85
91
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
@@ -153,7 +159,10 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
153
159
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
154
160
|
Event: _TelemetryConstants.TelemetryEvent.UXPrechatPaneCompleted,
|
|
155
161
|
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
156
|
-
Description: "Prechat survey pane loading completed."
|
|
162
|
+
Description: "Prechat survey pane loading completed.",
|
|
163
|
+
CustomProperties: {
|
|
164
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
165
|
+
}
|
|
157
166
|
});
|
|
158
167
|
}, []);
|
|
159
168
|
|
|
@@ -10,13 +10,16 @@ var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
|
|
|
10
10
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _utils = require("../../common/utils");
|
|
12
12
|
var _BotMagicCodeStore = require("./webchatcontroller/BotMagicCodeStore");
|
|
13
|
+
var _CitationPaneStateful = _interopRequireDefault(require("../citationpanestateful/CitationPaneStateful"));
|
|
13
14
|
var _botframeworkWebchat = require("botframework-webchat");
|
|
14
15
|
var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
|
|
15
16
|
var _NotificationHandler = require("./webchatcontroller/notification/NotificationHandler");
|
|
16
17
|
var _NotificationScenarios = require("./webchatcontroller/enums/NotificationScenarios");
|
|
17
18
|
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
18
19
|
var _WebChatActionType = require("./webchatcontroller/enums/WebChatActionType");
|
|
20
|
+
var _WebChatEventSubscribers = _interopRequireDefault(require("./webchatcontroller/WebChatEventSubscribers"));
|
|
19
21
|
var _WebChatStoreLoader = require("./webchatcontroller/WebChatStoreLoader");
|
|
22
|
+
var _fontUtils = require("./common/utils/fontUtils");
|
|
20
23
|
var _defaultAdaptiveCardStyles = require("./common/defaultStyles/defaultAdaptiveCardStyles");
|
|
21
24
|
var _defaultMiddlewareLocalizedTexts = require("./common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
22
25
|
var _defaultReceivedMessageAnchorStyles = require("./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles");
|
|
@@ -24,13 +27,16 @@ var _defaultSentMessageAnchorStyles = require("./webchatcontroller/middlewares/r
|
|
|
24
27
|
var _defaultSystemMessageBoxStyles = require("./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles");
|
|
25
28
|
var _defaultUserMessageBoxStyles = require("./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles");
|
|
26
29
|
var _defaultWebChatContainerStatefulProps = require("./common/defaultProps/defaultWebChatContainerStatefulProps");
|
|
30
|
+
var _liveChatConfigUtils = require("../livechatwidget/common/liveChatConfigUtils");
|
|
27
31
|
var _ = require("../..");
|
|
32
|
+
var _useFacadeChatSDKStore = _interopRequireDefault(require("../../hooks/useFacadeChatSDKStore"));
|
|
33
|
+
var _usePersistentChatHistory = _interopRequireDefault(require("./hooks/usePersistentChatHistory"));
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
35
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
36
|
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; }
|
|
30
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
31
|
-
|
|
32
37
|
let uiTimer;
|
|
33
38
|
const broadcastChannelMessageEvent = "message";
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
40
|
const postActivity = activity => {
|
|
35
41
|
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
36
42
|
return {
|
|
@@ -56,13 +62,29 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
56
62
|
};
|
|
57
63
|
};
|
|
58
64
|
const WebChatContainerStateful = props => {
|
|
59
|
-
var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$
|
|
65
|
+
var _props$webChatContain, _defaultWebChatContai, _props$persistentChat, _extendedChatConfig$L, _extendedChatConfig$L2, _extendedChatConfig$L3, _extendedChatConfig$L4, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$webChatContain10, _props$webChatContain11, _webChatContainerProp24, _webChatContainerProp25, _webChatContainerProp26, _webChatContainerProp27, _props$persistentChat2, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
|
|
66
|
+
const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
|
|
67
|
+
|
|
68
|
+
// Create a font family that includes emoji support, based on the primary font or default
|
|
69
|
+
const webChatStyles = ((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles) ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles;
|
|
70
|
+
const primaryFont = (webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.primaryFont) ?? ((_defaultWebChatContai = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.primaryFont);
|
|
71
|
+
|
|
72
|
+
// Use iOS-optimized emoji font that prioritizes system-ui for proper emoji rendering
|
|
73
|
+
const fontFamilyWithEmojis = (0, _fontUtils.createIOSOptimizedEmojiFont)(primaryFont);
|
|
60
74
|
(0, _react2.useEffect)(() => {
|
|
61
75
|
uiTimer = (0, _utils.createTimer)();
|
|
62
76
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
63
77
|
Event: _TelemetryConstants.TelemetryEvent.UXWebchatContainerCompleted
|
|
64
78
|
});
|
|
65
79
|
}, []);
|
|
80
|
+
|
|
81
|
+
// Citation pane state
|
|
82
|
+
const [citationPaneOpen, setCitationPaneOpen] = (0, _react2.useState)(false);
|
|
83
|
+
const [citationPaneText, setCitationPaneText] = (0, _react2.useState)("");
|
|
84
|
+
|
|
85
|
+
// Guard to prevent handling multiple rapid clicks which could cause
|
|
86
|
+
// the dim layer and pane to re-render out of sync and create a flicker.
|
|
87
|
+
const citationOpeningRef = (0, _react2.useRef)(false);
|
|
66
88
|
const {
|
|
67
89
|
BasicWebChat
|
|
68
90
|
} = _botframeworkWebchat.Components;
|
|
@@ -71,6 +93,73 @@ const WebChatContainerStateful = props => {
|
|
|
71
93
|
webChatContainerProps,
|
|
72
94
|
contextDataStore
|
|
73
95
|
} = props;
|
|
96
|
+
|
|
97
|
+
// Type the chatConfig properly to avoid 'any' usage
|
|
98
|
+
const extendedChatConfig = props.chatConfig;
|
|
99
|
+
const isHistoryEnabledViaProps = props === null || props === void 0 ? void 0 : (_props$persistentChat = props.persistentChatHistoryProps) === null || _props$persistentChat === void 0 ? void 0 : _props$persistentChat.persistentChatHistoryEnabled;
|
|
100
|
+
const isHistoryEnabledInConfig = extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L === void 0 ? void 0 : _extendedChatConfig$L.msdyn_enablepersistentchatpreviousconversations;
|
|
101
|
+
const isHistoryEnabledViaFCB = extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L2 = extendedChatConfig.LcwFcbConfiguration) === null || _extendedChatConfig$L2 === void 0 ? void 0 : _extendedChatConfig$L2.lcwPersistentChatHistoryEnabled;
|
|
102
|
+
const isPersistentChatEnabledForWidget = !!(extendedChatConfig !== null && extendedChatConfig !== void 0 && (_extendedChatConfig$L3 = extendedChatConfig.LiveChatConfigAuthSettings) !== null && _extendedChatConfig$L3 !== void 0 && _extendedChatConfig$L3.msdyn_javascriptclientfunction) || (0, _liveChatConfigUtils.isPersistentChatEnabled)(extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L4 = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L4 === void 0 ? void 0 : _extendedChatConfig$L4.msdyn_conversationmode);
|
|
103
|
+
|
|
104
|
+
// isPersistentHistoryEnabled can only be true if isHistoryEnabledViaFCB is true, and next conditions are met:
|
|
105
|
+
// 1. isHistoryEnabledViaProps is true (takes precedence over config)
|
|
106
|
+
// 2. isHistoryEnabledInConfig is true and isHistoryEnabledViaProps is undefined
|
|
107
|
+
const isPersistentHistoryEnabled = isHistoryEnabledViaProps || isHistoryEnabledInConfig && !isHistoryEnabledViaProps;
|
|
108
|
+
|
|
109
|
+
// Check if both persistent chat and widget support are enabled
|
|
110
|
+
const shouldLoadPersistentHistoryMessages = isPersistentHistoryEnabled && isHistoryEnabledViaFCB && isPersistentChatEnabledForWidget;
|
|
111
|
+
if (shouldLoadPersistentHistoryMessages) {
|
|
112
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
113
|
+
Event: _TelemetryConstants.TelemetryEvent.PersistentChatHistoryEnabled
|
|
114
|
+
});
|
|
115
|
+
(0, _usePersistentChatHistory.default)(facadeChatSDK, (props === null || props === void 0 ? void 0 : props.persistentChatHistoryProps) ?? {});
|
|
116
|
+
}
|
|
117
|
+
// Delegated click handler for citation anchors. Placed after state is
|
|
118
|
+
// available so we can prefer reading citations from app state and fall
|
|
119
|
+
// back to the legacy window map for backward-compatibility in tests.
|
|
120
|
+
(0, _react2.useEffect)(() => {
|
|
121
|
+
const clickHandler = ev => {
|
|
122
|
+
try {
|
|
123
|
+
if (citationOpeningRef.current) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const target = ev.target;
|
|
127
|
+
// Only consider anchors whose href starts with the citation scheme
|
|
128
|
+
const anchor = target.closest && target.closest("a[href^=\"cite:\"]");
|
|
129
|
+
if (anchor) {
|
|
130
|
+
ev.preventDefault();
|
|
131
|
+
citationOpeningRef.current = true;
|
|
132
|
+
// Rely only on the href to identify the citation key
|
|
133
|
+
let text = "";
|
|
134
|
+
try {
|
|
135
|
+
var _state$domainStates;
|
|
136
|
+
const cid = anchor.getAttribute("href");
|
|
137
|
+
// Prefer state-based citations injected by middleware
|
|
138
|
+
if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.citations && cid) {
|
|
139
|
+
text = state.domainStates.citations[cid] ?? "";
|
|
140
|
+
}
|
|
141
|
+
// If state lookup failed, fall back to the anchor's title or innerText
|
|
142
|
+
if (!text) {
|
|
143
|
+
text = anchor.getAttribute("title") || anchor.innerText || "";
|
|
144
|
+
}
|
|
145
|
+
} catch (e) {
|
|
146
|
+
// ignore
|
|
147
|
+
}
|
|
148
|
+
setCitationPaneOpen(true);
|
|
149
|
+
setCitationPaneText(text);
|
|
150
|
+
|
|
151
|
+
// Simple debounce - reset guard after a short delay
|
|
152
|
+
setTimeout(() => {
|
|
153
|
+
citationOpeningRef.current = false;
|
|
154
|
+
}, 100);
|
|
155
|
+
}
|
|
156
|
+
} catch (e) {
|
|
157
|
+
citationOpeningRef.current = false;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
document.addEventListener("click", clickHandler);
|
|
161
|
+
return () => document.removeEventListener("click", clickHandler);
|
|
162
|
+
}, [state]);
|
|
74
163
|
const containerStyles = {
|
|
75
164
|
root: Object.assign({}, _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
|
|
76
165
|
display: state.appStates.isMinimized ? "none" : ""
|
|
@@ -82,7 +171,7 @@ const WebChatContainerStateful = props => {
|
|
|
82
171
|
...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
|
|
83
172
|
};
|
|
84
173
|
(0, _react2.useEffect)(() => {
|
|
85
|
-
var _props$
|
|
174
|
+
var _props$webChatContain2, _props$webChatContain3;
|
|
86
175
|
if ((0, _utils.getDeviceType)() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
|
|
87
176
|
const chatHistoryElement = document.querySelector(`.${_Constants.HtmlClassNames.webChatHistoryContainer}`);
|
|
88
177
|
if (chatHistoryElement) {
|
|
@@ -100,21 +189,23 @@ const WebChatContainerStateful = props => {
|
|
|
100
189
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
101
190
|
Event: _TelemetryConstants.TelemetryEvent.WebChatLoaded
|
|
102
191
|
});
|
|
103
|
-
if (((_props$
|
|
192
|
+
if (((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.renderingMiddlewareProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.disableThirdPartyCookiesAlert) !== true && !contextDataStore) {
|
|
104
193
|
try {
|
|
105
194
|
localStorage;
|
|
106
195
|
sessionStorage;
|
|
107
196
|
} catch (error) {
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
198
|
if (!window.TPCWarningShown) {
|
|
109
199
|
_NotificationHandler.NotificationHandler.notifyWarning(_NotificationScenarios.NotificationScenarios.TPC, (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE) ?? "");
|
|
200
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
201
|
window.TPCWarningShown = true;
|
|
111
202
|
}
|
|
112
203
|
}
|
|
113
204
|
}
|
|
114
205
|
}, []);
|
|
115
206
|
(0, _react2.useEffect)(() => {
|
|
116
|
-
var _props$
|
|
117
|
-
if (!((_props$
|
|
207
|
+
var _props$webChatContain4, _props$webChatContain5;
|
|
208
|
+
if (!((_props$webChatContain4 = props.webChatContainerProps) !== null && _props$webChatContain4 !== void 0 && (_props$webChatContain5 = _props$webChatContain4.botMagicCode) !== null && _props$webChatContain5 !== void 0 && _props$webChatContain5.disabled)) {
|
|
118
209
|
return;
|
|
119
210
|
}
|
|
120
211
|
if (!window.BroadcastChannel) {
|
|
@@ -206,8 +297,8 @@ const WebChatContainerStateful = props => {
|
|
|
206
297
|
}
|
|
207
298
|
|
|
208
299
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
209
|
-
background-color: ${((_props$
|
|
210
|
-
color:${((_props$
|
|
300
|
+
background-color: ${((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : (_props$webChatContain7 = _props$webChatContain6.webChatStyles) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.bubbleBackground) ?? ((_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleBackground)};
|
|
301
|
+
color:${((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : (_props$webChatContain9 = _props$webChatContain8.webChatStyles) === null || _props$webChatContain9 === void 0 ? void 0 : _props$webChatContain9.bubbleTextColor) ?? ((_defaultWebChatContai3 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.bubbleTextColor)};
|
|
211
302
|
}
|
|
212
303
|
|
|
213
304
|
div[class="ac-textBlock"] a:link,
|
|
@@ -285,7 +376,7 @@ const WebChatContainerStateful = props => {
|
|
|
285
376
|
}
|
|
286
377
|
|
|
287
378
|
.webchat__stacked-layout_container>div {
|
|
288
|
-
background: ${(props === null || props === void 0 ? void 0 : (_props$
|
|
379
|
+
background: ${(props === null || props === void 0 ? void 0 : (_props$webChatContain10 = props.webChatContainerProps) === null || _props$webChatContain10 === void 0 ? void 0 : (_props$webChatContain11 = _props$webChatContain10.containerStyles) === null || _props$webChatContain11 === void 0 ? void 0 : _props$webChatContain11.background) ?? ""}
|
|
289
380
|
}
|
|
290
381
|
.webchat__toast_text {
|
|
291
382
|
display: flex;
|
|
@@ -312,10 +403,35 @@ const WebChatContainerStateful = props => {
|
|
|
312
403
|
height: 100% !important;
|
|
313
404
|
}
|
|
314
405
|
|
|
406
|
+
.webchat__auto-resize-textarea__textarea.webchat__send-box-text-box__html-text-area {
|
|
407
|
+
font-family: ${fontFamilyWithEmojis} !important;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/* Suggested actions carousel previous/next navigation focus */
|
|
411
|
+
.webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
|
|
412
|
+
outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp24 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp24 === void 0 ? void 0 : _webChatContainerProp24.suggestedActionKeyboardFocusIndicatorBorderStyle) ?? "dashed"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp25 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp25 === void 0 ? void 0 : _webChatContainerProp25.suggestedActionKeyboardFocusIndicatorBorderWidth) ?? "1px"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp26 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp26 === void 0 ? void 0 : _webChatContainerProp26.suggestedActionKeyboardFocusIndicatorBorderColor) ?? "#605E5C"} !important;
|
|
413
|
+
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp27 === void 0 ? void 0 : _webChatContainerProp27.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
|
|
414
|
+
|
|
315
415
|
`), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
316
416
|
styles: containerStyles,
|
|
317
417
|
className: "webchat__stacked-layout_container"
|
|
318
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
418
|
+
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
419
|
+
id: "ms_lcw_webchat_root",
|
|
420
|
+
style: {
|
|
421
|
+
height: "100%",
|
|
422
|
+
width: "100%"
|
|
423
|
+
}
|
|
424
|
+
}, shouldLoadPersistentHistoryMessages && /*#__PURE__*/_react2.default.createElement(_WebChatEventSubscribers.default, {
|
|
425
|
+
persistentChatHistoryEnabled: props === null || props === void 0 ? void 0 : (_props$persistentChat2 = props.persistentChatHistoryProps) === null || _props$persistentChat2 === void 0 ? void 0 : _props$persistentChat2.persistentChatHistoryEnabled
|
|
426
|
+
}), /*#__PURE__*/_react2.default.createElement(BasicWebChat, null))), citationPaneOpen && /*#__PURE__*/_react2.default.createElement(_CitationPaneStateful.default, {
|
|
427
|
+
id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || _Constants.HtmlAttributeNames.ocwCitationPaneClassName,
|
|
428
|
+
title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || _Constants.HtmlAttributeNames.ocwCitationPaneTitle,
|
|
429
|
+
contentHtml: citationPaneText,
|
|
430
|
+
onClose: () => setCitationPaneOpen(false),
|
|
431
|
+
componentOverrides: (_props$citationPanePr3 = props.citationPaneProps) === null || _props$citationPanePr3 === void 0 ? void 0 : _props$citationPanePr3.componentOverrides,
|
|
432
|
+
controlProps: (_props$citationPanePr4 = props.citationPaneProps) === null || _props$citationPanePr4 === void 0 ? void 0 : _props$citationPanePr4.controlProps,
|
|
433
|
+
styleProps: (_props$citationPanePr5 = props.citationPaneProps) === null || _props$citationPanePr5 === void 0 ? void 0 : _props$citationPanePr5.styleProps
|
|
434
|
+
}));
|
|
319
435
|
};
|
|
320
436
|
exports.WebChatContainerStateful = WebChatContainerStateful;
|
|
321
437
|
var _default = WebChatContainerStateful;
|
|
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DesignerChatAdapter = void 0;
|
|
7
|
-
var _Observable = require("rxjs/Observable");
|
|
8
|
-
var _mockadapter = _interopRequireDefault(require("./mockadapter"));
|
|
9
7
|
var _chatAdapterUtils = require("./utils/chatAdapterUtils");
|
|
8
|
+
var _mockadapter = _interopRequireDefault(require("./mockadapter"));
|
|
9
|
+
var _Observable = require("rxjs/Observable");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
12
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
14
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
15
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
14
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
17
15
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
18
16
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -20,25 +18,56 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
|
|
|
20
18
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
21
19
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
20
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
23
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
23
24
|
let DesignerChatAdapter = /*#__PURE__*/function (_MockAdapter) {
|
|
24
25
|
_inherits(DesignerChatAdapter, _MockAdapter);
|
|
25
26
|
var _super = _createSuper(DesignerChatAdapter);
|
|
26
|
-
function DesignerChatAdapter() {
|
|
27
|
+
function DesignerChatAdapter(messages) {
|
|
27
28
|
var _this;
|
|
28
29
|
_classCallCheck(this, DesignerChatAdapter);
|
|
29
30
|
_this = _super.call(this);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
_this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "messages", void 0);
|
|
32
|
+
_this.messages = messages;
|
|
33
|
+
if (_this.messages) {
|
|
34
|
+
if (_this.messages.length > 0) {
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
var _this$messages;
|
|
37
|
+
(_this$messages = _this.messages) === null || _this$messages === void 0 ? void 0 : _this$messages.forEach((msg, index) => {
|
|
38
|
+
_this.processMessage(msg, index);
|
|
39
|
+
});
|
|
40
|
+
}, 1000); // Initial 1 second delay to ensure activityObserver is ready
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
// Default hardcoded flow
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
(0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
|
|
46
|
+
(0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "Please accept terms and conditions to proceed. Visit the link for terms and conditions <a href=\"\">here</a>.", undefined, 0);
|
|
47
|
+
_this.postUserActivity("I need to change my address.", 0);
|
|
48
|
+
(0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
|
|
49
|
+
(0, _chatAdapterUtils.postSystemMessageActivity)(_this.activityObserver, "John has joined the chat", 100);
|
|
50
|
+
(0, _chatAdapterUtils.postAgentMessageActivity)(_this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
|
|
51
|
+
_this.postUserActivity("I have trouble visiting the signin page <a href=\"\">signin</a>.", 0);
|
|
52
|
+
}, 1000);
|
|
53
|
+
}
|
|
39
54
|
return _this;
|
|
40
55
|
}
|
|
41
56
|
_createClass(DesignerChatAdapter, [{
|
|
57
|
+
key: "processMessage",
|
|
58
|
+
value: function processMessage(msg, index) {
|
|
59
|
+
if (msg.text) {
|
|
60
|
+
if (msg.suggestedActions) {
|
|
61
|
+
(0, _chatAdapterUtils.postAgentSuggestedActionsActivity)(this.activityObserver, msg.text, msg.suggestedActions, index * 100);
|
|
62
|
+
} else {
|
|
63
|
+
(0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, msg.text, undefined, index * 100);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (msg.attachments && msg.attachments.length > 0) {
|
|
67
|
+
(0, _chatAdapterUtils.postAgentAttachmentActivity)(this.activityObserver, msg.attachments, index * 100, msg.attachmentLayout);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
42
71
|
key: "postUserActivity",
|
|
43
72
|
value: function postUserActivity(text) {
|
|
44
73
|
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|