@microsoft/omnichannel-chat-widget 1.8.3-main.ec1328d → 1.8.4-main.4478bbf
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 +46 -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 +199 -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 +284 -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 +8 -6
- 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 +41 -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 +122 -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 +2 -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 +18 -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 +44 -0
- 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/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +46 -45
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/cjs/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 +44 -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 +188 -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 +277 -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 +8 -6
- 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 +42 -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 +125 -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 +2 -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 +10 -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 +42 -0
- 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/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +46 -45
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/esm/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 +41 -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 +7 -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/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/queueOverflowHandlerMiddleware.d.ts +2 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +46 -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 = () => {
|
|
@@ -876,23 +886,46 @@ const LiveChatWidgetStateful = props => {
|
|
|
876
886
|
|
|
877
887
|
// WebChat's Composer can only be rendered if a directLine object is defined
|
|
878
888
|
return directLine && /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement("style", null, `
|
|
879
|
-
::-webkit-scrollbar {
|
|
889
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
|
|
880
890
|
width: ${scrollbarProps.width};
|
|
881
891
|
}
|
|
882
892
|
|
|
883
|
-
::-webkit-scrollbar-track {
|
|
893
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
|
|
884
894
|
background: ${scrollbarProps.trackBackgroundColor};
|
|
885
895
|
}
|
|
886
896
|
|
|
887
|
-
::-webkit-scrollbar-thumb {
|
|
897
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
|
|
888
898
|
background: ${scrollbarProps.thumbBackgroundColor};
|
|
889
899
|
border-radius: ${scrollbarProps.thumbBorderRadius};
|
|
890
900
|
}
|
|
891
901
|
|
|
892
|
-
::-webkit-scrollbar-thumb:hover {
|
|
902
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
|
|
893
903
|
background: ${scrollbarProps.thumbHoverColor};
|
|
894
904
|
}
|
|
895
905
|
|
|
906
|
+
/* High Contrast mode support - optimized for all variants */
|
|
907
|
+
@media (prefers-contrast: high), (-ms-high-contrast: active), (forced-colors: active) {
|
|
908
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
|
|
909
|
+
background: Canvas !important;
|
|
910
|
+
border: 1px solid CanvasText !important;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
|
|
914
|
+
background: CanvasText !important;
|
|
915
|
+
border: 1px solid Canvas !important;
|
|
916
|
+
min-height: 20px !important;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
|
|
920
|
+
background: Highlight !important;
|
|
921
|
+
border: 1px solid CanvasText !important;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-corner {
|
|
925
|
+
background: Canvas !important;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
896
929
|
.webchat__basic-transcript__activity-markdown-body > :last-child {
|
|
897
930
|
margin-bottom: 0px;
|
|
898
931
|
}
|
|
@@ -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, _extendedChatConfig$L, _props$persistentChat, _extendedChatConfig$L2, _extendedChatConfig$L3, _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,68 @@ 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 isHistoryEnabledInConfig = extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L = extendedChatConfig.LcwFcbConfiguration) === null || _extendedChatConfig$L === void 0 ? void 0 : _extendedChatConfig$L.lcwPersistentChatHistoryEnabled;
|
|
100
|
+
const isHistoryEnabledViaProps = props === null || props === void 0 ? void 0 : (_props$persistentChat = props.persistentChatHistoryProps) === null || _props$persistentChat === void 0 ? void 0 : _props$persistentChat.persistentChatHistoryEnabled;
|
|
101
|
+
const isPersistentChatEnabledForWidget = !!(extendedChatConfig !== null && extendedChatConfig !== void 0 && (_extendedChatConfig$L2 = extendedChatConfig.LiveChatConfigAuthSettings) !== null && _extendedChatConfig$L2 !== void 0 && _extendedChatConfig$L2.msdyn_javascriptclientfunction) || (0, _liveChatConfigUtils.isPersistentChatEnabled)(extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L3 = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L3 === void 0 ? void 0 : _extendedChatConfig$L3.msdyn_conversationmode);
|
|
102
|
+
|
|
103
|
+
// Persistent chat history is enabled if explicitly set via props, or if enabled in config
|
|
104
|
+
// Props take precedence over config settings
|
|
105
|
+
const isPersistentHistoryEnabled = isHistoryEnabledViaProps || isHistoryEnabledInConfig;
|
|
106
|
+
|
|
107
|
+
// Check if both persistent chat and widget support are enabled
|
|
108
|
+
const shouldLoadPersistentHistoryMessages = isPersistentHistoryEnabled && isPersistentChatEnabledForWidget;
|
|
109
|
+
if (shouldLoadPersistentHistoryMessages) {
|
|
110
|
+
(0, _usePersistentChatHistory.default)(facadeChatSDK, (props === null || props === void 0 ? void 0 : props.persistentChatHistoryProps) ?? {});
|
|
111
|
+
}
|
|
112
|
+
// Delegated click handler for citation anchors. Placed after state is
|
|
113
|
+
// available so we can prefer reading citations from app state and fall
|
|
114
|
+
// back to the legacy window map for backward-compatibility in tests.
|
|
115
|
+
(0, _react2.useEffect)(() => {
|
|
116
|
+
const clickHandler = ev => {
|
|
117
|
+
try {
|
|
118
|
+
if (citationOpeningRef.current) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const target = ev.target;
|
|
122
|
+
// Only consider anchors whose href starts with the citation scheme
|
|
123
|
+
const anchor = target.closest && target.closest("a[href^=\"cite:\"]");
|
|
124
|
+
if (anchor) {
|
|
125
|
+
ev.preventDefault();
|
|
126
|
+
citationOpeningRef.current = true;
|
|
127
|
+
// Rely only on the href to identify the citation key
|
|
128
|
+
let text = "";
|
|
129
|
+
try {
|
|
130
|
+
var _state$domainStates;
|
|
131
|
+
const cid = anchor.getAttribute("href");
|
|
132
|
+
// Prefer state-based citations injected by middleware
|
|
133
|
+
if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.citations && cid) {
|
|
134
|
+
text = state.domainStates.citations[cid] ?? "";
|
|
135
|
+
}
|
|
136
|
+
// If state lookup failed, fall back to the anchor's title or innerText
|
|
137
|
+
if (!text) {
|
|
138
|
+
text = anchor.getAttribute("title") || anchor.innerText || "";
|
|
139
|
+
}
|
|
140
|
+
} catch (e) {
|
|
141
|
+
// ignore
|
|
142
|
+
}
|
|
143
|
+
setCitationPaneOpen(true);
|
|
144
|
+
setCitationPaneText(text);
|
|
145
|
+
|
|
146
|
+
// Simple debounce - reset guard after a short delay
|
|
147
|
+
setTimeout(() => {
|
|
148
|
+
citationOpeningRef.current = false;
|
|
149
|
+
}, 100);
|
|
150
|
+
}
|
|
151
|
+
} catch (e) {
|
|
152
|
+
citationOpeningRef.current = false;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
document.addEventListener("click", clickHandler);
|
|
156
|
+
return () => document.removeEventListener("click", clickHandler);
|
|
157
|
+
}, [state]);
|
|
74
158
|
const containerStyles = {
|
|
75
159
|
root: Object.assign({}, _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
|
|
76
160
|
display: state.appStates.isMinimized ? "none" : ""
|
|
@@ -82,7 +166,7 @@ const WebChatContainerStateful = props => {
|
|
|
82
166
|
...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
|
|
83
167
|
};
|
|
84
168
|
(0, _react2.useEffect)(() => {
|
|
85
|
-
var _props$
|
|
169
|
+
var _props$webChatContain2, _props$webChatContain3;
|
|
86
170
|
if ((0, _utils.getDeviceType)() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
|
|
87
171
|
const chatHistoryElement = document.querySelector(`.${_Constants.HtmlClassNames.webChatHistoryContainer}`);
|
|
88
172
|
if (chatHistoryElement) {
|
|
@@ -100,21 +184,23 @@ const WebChatContainerStateful = props => {
|
|
|
100
184
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
101
185
|
Event: _TelemetryConstants.TelemetryEvent.WebChatLoaded
|
|
102
186
|
});
|
|
103
|
-
if (((_props$
|
|
187
|
+
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
188
|
try {
|
|
105
189
|
localStorage;
|
|
106
190
|
sessionStorage;
|
|
107
191
|
} catch (error) {
|
|
192
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
193
|
if (!window.TPCWarningShown) {
|
|
109
194
|
_NotificationHandler.NotificationHandler.notifyWarning(_NotificationScenarios.NotificationScenarios.TPC, (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE) ?? "");
|
|
195
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
196
|
window.TPCWarningShown = true;
|
|
111
197
|
}
|
|
112
198
|
}
|
|
113
199
|
}
|
|
114
200
|
}, []);
|
|
115
201
|
(0, _react2.useEffect)(() => {
|
|
116
|
-
var _props$
|
|
117
|
-
if (!((_props$
|
|
202
|
+
var _props$webChatContain4, _props$webChatContain5;
|
|
203
|
+
if (!((_props$webChatContain4 = props.webChatContainerProps) !== null && _props$webChatContain4 !== void 0 && (_props$webChatContain5 = _props$webChatContain4.botMagicCode) !== null && _props$webChatContain5 !== void 0 && _props$webChatContain5.disabled)) {
|
|
118
204
|
return;
|
|
119
205
|
}
|
|
120
206
|
if (!window.BroadcastChannel) {
|
|
@@ -206,8 +292,8 @@ const WebChatContainerStateful = props => {
|
|
|
206
292
|
}
|
|
207
293
|
|
|
208
294
|
.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$
|
|
295
|
+
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)};
|
|
296
|
+
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
297
|
}
|
|
212
298
|
|
|
213
299
|
div[class="ac-textBlock"] a:link,
|
|
@@ -285,7 +371,7 @@ const WebChatContainerStateful = props => {
|
|
|
285
371
|
}
|
|
286
372
|
|
|
287
373
|
.webchat__stacked-layout_container>div {
|
|
288
|
-
background: ${(props === null || props === void 0 ? void 0 : (_props$
|
|
374
|
+
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
375
|
}
|
|
290
376
|
.webchat__toast_text {
|
|
291
377
|
display: flex;
|
|
@@ -312,10 +398,35 @@ const WebChatContainerStateful = props => {
|
|
|
312
398
|
height: 100% !important;
|
|
313
399
|
}
|
|
314
400
|
|
|
401
|
+
.webchat__auto-resize-textarea__textarea.webchat__send-box-text-box__html-text-area {
|
|
402
|
+
font-family: ${fontFamilyWithEmojis} !important;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/* Suggested actions carousel previous/next navigation focus */
|
|
406
|
+
.webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
|
|
407
|
+
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;
|
|
408
|
+
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp27 === void 0 ? void 0 : _webChatContainerProp27.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
|
|
409
|
+
|
|
315
410
|
`), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
|
|
316
411
|
styles: containerStyles,
|
|
317
412
|
className: "webchat__stacked-layout_container"
|
|
318
|
-
}, /*#__PURE__*/_react2.default.createElement(
|
|
413
|
+
}, /*#__PURE__*/_react2.default.createElement("div", {
|
|
414
|
+
id: "ms_lcw_webchat_root",
|
|
415
|
+
style: {
|
|
416
|
+
height: "100%",
|
|
417
|
+
width: "100%"
|
|
418
|
+
}
|
|
419
|
+
}, shouldLoadPersistentHistoryMessages && /*#__PURE__*/_react2.default.createElement(_WebChatEventSubscribers.default, {
|
|
420
|
+
persistentChatHistoryEnabled: props === null || props === void 0 ? void 0 : (_props$persistentChat2 = props.persistentChatHistoryProps) === null || _props$persistentChat2 === void 0 ? void 0 : _props$persistentChat2.persistentChatHistoryEnabled
|
|
421
|
+
}), /*#__PURE__*/_react2.default.createElement(BasicWebChat, null))), citationPaneOpen && /*#__PURE__*/_react2.default.createElement(_CitationPaneStateful.default, {
|
|
422
|
+
id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || _Constants.HtmlAttributeNames.ocwCitationPaneClassName,
|
|
423
|
+
title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || _Constants.HtmlAttributeNames.ocwCitationPaneTitle,
|
|
424
|
+
contentHtml: citationPaneText,
|
|
425
|
+
onClose: () => setCitationPaneOpen(false),
|
|
426
|
+
componentOverrides: (_props$citationPanePr3 = props.citationPaneProps) === null || _props$citationPanePr3 === void 0 ? void 0 : _props$citationPanePr3.componentOverrides,
|
|
427
|
+
controlProps: (_props$citationPanePr4 = props.citationPaneProps) === null || _props$citationPanePr4 === void 0 ? void 0 : _props$citationPanePr4.controlProps,
|
|
428
|
+
styleProps: (_props$citationPanePr5 = props.citationPaneProps) === null || _props$citationPanePr5 === void 0 ? void 0 : _props$citationPanePr5.styleProps
|
|
429
|
+
}));
|
|
319
430
|
};
|
|
320
431
|
exports.WebChatContainerStateful = WebChatContainerStateful;
|
|
321
432
|
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;
|