@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
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
8
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
9
|
+
var _ChatWidgetEvents = _interopRequireDefault(require("./ChatWidgetEvents"));
|
|
10
|
+
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
11
|
+
var _conversationDividerActivity = _interopRequireDefault(require("../../webchatcontainerstateful/common/activities/conversationDividerActivity"));
|
|
12
|
+
var _convertPersistentChatHistoryMessageToActivity = _interopRequireDefault(require("../../webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity"));
|
|
13
|
+
var _utils = require("../../../common/utils");
|
|
14
|
+
var _defaultPersistentChatHistoryProps = require("./defaultProps/defaultPersistentChatHistoryProps");
|
|
15
|
+
var _dispatchCustomEvent = _interopRequireDefault(require("../../../common/utils/dispatchCustomEvent"));
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
+
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); } }
|
|
19
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
22
|
+
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
|
+
* Class responsible for handling persistent conversation history
|
|
25
|
+
*/
|
|
26
|
+
let PersistentConversationHandler = /*#__PURE__*/function () {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
|
|
29
|
+
function PersistentConversationHandler(facadeChatSDK, props) {
|
|
30
|
+
_classCallCheck(this, PersistentConversationHandler);
|
|
31
|
+
_defineProperty(this, "appliedProps", {
|
|
32
|
+
..._defaultPersistentChatHistoryProps.defaultPersistentChatHistoryProps
|
|
33
|
+
});
|
|
34
|
+
_defineProperty(this, "isLastPull", false);
|
|
35
|
+
_defineProperty(this, "pageToken", null);
|
|
36
|
+
_defineProperty(this, "facadeChatSDK", void 0);
|
|
37
|
+
_defineProperty(this, "lastMessage", null);
|
|
38
|
+
_defineProperty(this, "count", 0);
|
|
39
|
+
_defineProperty(this, "pageSize", 4);
|
|
40
|
+
_defineProperty(this, "isCurrentlyPulling", false);
|
|
41
|
+
_defineProperty(this, "pageTokenInTransitSet", new Set());
|
|
42
|
+
_defineProperty(this, "resetEventListener", _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.PersistentConversationReset).subscribe(() => {
|
|
43
|
+
this.reset();
|
|
44
|
+
}));
|
|
45
|
+
this.facadeChatSDK = facadeChatSDK;
|
|
46
|
+
this.appliedPropsHandler(props);
|
|
47
|
+
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
48
|
+
Event: _TelemetryConstants.TelemetryEvent.LCWPersistentConversationHandlerInitialized,
|
|
49
|
+
Description: "PersistentConversationHandler initialized",
|
|
50
|
+
CustomProperties: {
|
|
51
|
+
pageSize: this.pageSize
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
_createClass(PersistentConversationHandler, [{
|
|
56
|
+
key: "appliedPropsHandler",
|
|
57
|
+
value: function appliedPropsHandler(props) {
|
|
58
|
+
this.appliedProps = {
|
|
59
|
+
..._defaultPersistentChatHistoryProps.defaultPersistentChatHistoryProps,
|
|
60
|
+
...props
|
|
61
|
+
};
|
|
62
|
+
this.pageSize = this.appliedProps.pageSize || 4;
|
|
63
|
+
}
|
|
64
|
+
}, {
|
|
65
|
+
key: "reset",
|
|
66
|
+
value: function reset() {
|
|
67
|
+
this.isLastPull = false;
|
|
68
|
+
this.pageToken = null;
|
|
69
|
+
this.lastMessage = null;
|
|
70
|
+
this.count = 0;
|
|
71
|
+
this.isCurrentlyPulling = false;
|
|
72
|
+
this.pageTokenInTransitSet.clear();
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
key: "destroy",
|
|
76
|
+
value: function destroy() {
|
|
77
|
+
// Only unsubscribe when the handler is being destroyed completely
|
|
78
|
+
this.resetEventListener.unsubscribe();
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "pullHistory",
|
|
82
|
+
value: async function pullHistory() {
|
|
83
|
+
const pullTimer = (0, _utils.createTimer)();
|
|
84
|
+
|
|
85
|
+
// Prevent concurrent pulls regardless of pageToken
|
|
86
|
+
if (this.isCurrentlyPulling) {
|
|
87
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
|
|
88
|
+
Event: _TelemetryConstants.TelemetryEvent.LCWPersistentHistoryPullBlocked,
|
|
89
|
+
Description: "History pull blocked - already in progress"
|
|
90
|
+
});
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Additional check for specific pageToken duplicates
|
|
95
|
+
if (this.pageToken && this.pageTokenInTransitSet.has(this.pageToken)) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Mark as currently pulling
|
|
100
|
+
this.isCurrentlyPulling = true;
|
|
101
|
+
if (this.pageToken) {
|
|
102
|
+
this.pageTokenInTransitSet.add(this.pageToken);
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
var _ref;
|
|
106
|
+
const messages = await this.fetchHistoryMessages();
|
|
107
|
+
if (messages === null || (messages === null || messages === void 0 ? void 0 : messages.length) === 0) {
|
|
108
|
+
this.isLastPull = true;
|
|
109
|
+
// Dispatch event to notify UI that no more history is available
|
|
110
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.NO_MORE_HISTORY_AVAILABLE);
|
|
111
|
+
// Also hide the loading banner
|
|
112
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.HIDE_LOADING_BANNER);
|
|
113
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
114
|
+
Event: _TelemetryConstants.TelemetryEvent.LCWPersistentHistoryPullCompleted,
|
|
115
|
+
Description: "History pull completed - no more messages",
|
|
116
|
+
ElapsedTimeInMilliseconds: pullTimer.milliSecondsElapsed
|
|
117
|
+
});
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const messagesDescOrder = (_ref = [...messages]) === null || _ref === void 0 ? void 0 : _ref.reverse();
|
|
121
|
+
this.processHistoryMessages(messagesDescOrder);
|
|
122
|
+
|
|
123
|
+
// Dispatch event to hide the loading banner after messages are processed
|
|
124
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.HIDE_LOADING_BANNER);
|
|
125
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
126
|
+
Event: _TelemetryConstants.TelemetryEvent.LCWPersistentHistoryPullCompleted,
|
|
127
|
+
Description: "History pull completed successfully",
|
|
128
|
+
ElapsedTimeInMilliseconds: pullTimer.milliSecondsElapsed,
|
|
129
|
+
CustomProperties: {
|
|
130
|
+
messageCount: messages.length,
|
|
131
|
+
totalProcessed: this.count
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
} finally {
|
|
135
|
+
// Always clear the pulling flag when done
|
|
136
|
+
this.isCurrentlyPulling = false;
|
|
137
|
+
|
|
138
|
+
// Remove pageToken from transit set if it was added
|
|
139
|
+
if (this.pageToken) {
|
|
140
|
+
this.pageTokenInTransitSet.delete(this.pageToken);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
+
}, {
|
|
147
|
+
key: "processHistoryMessages",
|
|
148
|
+
value: function processHistoryMessages(messagesDescOrder) {
|
|
149
|
+
for (const message of messagesDescOrder) {
|
|
150
|
+
try {
|
|
151
|
+
const activity = this.processMessageToActivity(message);
|
|
152
|
+
if (activity) {
|
|
153
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.ADD_ACTIVITY, {
|
|
154
|
+
activity
|
|
155
|
+
});
|
|
156
|
+
const dividerActivity = this.createDividerActivity(activity);
|
|
157
|
+
if (dividerActivity) {
|
|
158
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.ADD_ACTIVITY, {
|
|
159
|
+
activity: dividerActivity
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
this.lastMessage = activity;
|
|
163
|
+
}
|
|
164
|
+
} catch (error) {
|
|
165
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
166
|
+
Event: _TelemetryConstants.TelemetryEvent.ConvertPersistentChatHistoryMessageToActivityFailed,
|
|
167
|
+
ExceptionDetails: error
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
174
|
+
}, {
|
|
175
|
+
key: "fetchHistoryMessages",
|
|
176
|
+
value: async function fetchHistoryMessages() {
|
|
177
|
+
if (!this.shouldPull()) {
|
|
178
|
+
// Dispatch event to ensure banner is hidden when no more pulls are needed
|
|
179
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.NO_MORE_HISTORY_AVAILABLE);
|
|
180
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.HIDE_LOADING_BANNER);
|
|
181
|
+
return [];
|
|
182
|
+
}
|
|
183
|
+
const options = {
|
|
184
|
+
pageSize: this.pageSize,
|
|
185
|
+
pageToken: this.pageToken || undefined
|
|
186
|
+
};
|
|
187
|
+
try {
|
|
188
|
+
var _this$facadeChatSDK;
|
|
189
|
+
const response = await ((_this$facadeChatSDK = this.facadeChatSDK) === null || _this$facadeChatSDK === void 0 ? void 0 : _this$facadeChatSDK.fetchPersistentConversationHistory(options));
|
|
190
|
+
const {
|
|
191
|
+
chatMessages: messages,
|
|
192
|
+
nextPageToken: pageToken
|
|
193
|
+
} = response;
|
|
194
|
+
this.pageToken = pageToken || null;
|
|
195
|
+
if (pageToken === null) {
|
|
196
|
+
this.isLastPull = true;
|
|
197
|
+
// Dispatch event when we reach the end of available history
|
|
198
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.NO_MORE_HISTORY_AVAILABLE);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// if chatMessages is null, return empty array
|
|
202
|
+
if (!messages) {
|
|
203
|
+
this.isLastPull = true;
|
|
204
|
+
// Dispatch event when we reach the end of available history
|
|
205
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.NO_MORE_HISTORY_AVAILABLE);
|
|
206
|
+
// Also hide the loading banner
|
|
207
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.HIDE_LOADING_BANNER);
|
|
208
|
+
return [];
|
|
209
|
+
}
|
|
210
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.HIDE_LOADING_BANNER);
|
|
211
|
+
return messages;
|
|
212
|
+
} catch (error) {
|
|
213
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
214
|
+
Event: _TelemetryConstants.TelemetryEvent.FetchPersistentChatHistoryFailed,
|
|
215
|
+
ExceptionDetails: error
|
|
216
|
+
});
|
|
217
|
+
this.isLastPull = true;
|
|
218
|
+
this.pageToken = null;
|
|
219
|
+
// Dispatch event when there's an error to stop loading banner
|
|
220
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.NO_MORE_HISTORY_AVAILABLE);
|
|
221
|
+
// Also hide the loading banner
|
|
222
|
+
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.HIDE_LOADING_BANNER);
|
|
223
|
+
return [];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}, {
|
|
227
|
+
key: "shouldPull",
|
|
228
|
+
value: function shouldPull() {
|
|
229
|
+
return !this.isLastPull;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
233
|
+
}, {
|
|
234
|
+
key: "processMessageToActivity",
|
|
235
|
+
value: function processMessageToActivity(message) {
|
|
236
|
+
try {
|
|
237
|
+
const activity = (0, _convertPersistentChatHistoryMessageToActivity.default)(message);
|
|
238
|
+
activity.id = activity.id || `activity-${this.count}`;
|
|
239
|
+
activity.channelData = {
|
|
240
|
+
...activity.channelData,
|
|
241
|
+
metadata: {
|
|
242
|
+
count: this.count
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// Increment the count after assigning it to the activity
|
|
247
|
+
this.count += 1;
|
|
248
|
+
return activity;
|
|
249
|
+
} catch (error) {
|
|
250
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
251
|
+
Event: _TelemetryConstants.TelemetryEvent.ConvertPersistentChatHistoryMessageToActivityFailed,
|
|
252
|
+
ExceptionDetails: error
|
|
253
|
+
});
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
259
|
+
}, {
|
|
260
|
+
key: "createDividerActivity",
|
|
261
|
+
value: function createDividerActivity(activity) {
|
|
262
|
+
var _this$lastMessage, _this$lastMessage$cha;
|
|
263
|
+
if (((_this$lastMessage = this.lastMessage) === null || _this$lastMessage === void 0 ? void 0 : (_this$lastMessage$cha = _this$lastMessage.channelData) === null || _this$lastMessage$cha === void 0 ? void 0 : _this$lastMessage$cha.conversationId) !== activity.channelData.conversationId) {
|
|
264
|
+
const rawSequenceId = activity.channelData["webchat:sequence-id"];
|
|
265
|
+
const sequenceId = typeof rawSequenceId === "number" && !isNaN(rawSequenceId) ? rawSequenceId + 1 : 1;
|
|
266
|
+
const timestamp = new Date(activity.timestamp).getTime() + 1;
|
|
267
|
+
return {
|
|
268
|
+
..._conversationDividerActivity.default,
|
|
269
|
+
channelData: {
|
|
270
|
+
..._conversationDividerActivity.default.channelData,
|
|
271
|
+
conversationId: activity.channelData.conversationId,
|
|
272
|
+
"webchat:sequence-id": sequenceId
|
|
273
|
+
},
|
|
274
|
+
timestamp: new Date(timestamp).toISOString(),
|
|
275
|
+
identifier: `divider-${activity.channelData.conversationId}`
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
}]);
|
|
281
|
+
return PersistentConversationHandler;
|
|
282
|
+
}();
|
|
283
|
+
var _default = PersistentConversationHandler;
|
|
284
|
+
exports.default = _default;
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createAdapter = void 0;
|
|
7
|
+
var _AddActivitySubscriber = require("./ActivitySubscriber/AddActivitySubscriber");
|
|
7
8
|
var _BotAuthActivitySubscriber = require("./ActivitySubscriber/BotAuthActivitySubscriber");
|
|
8
9
|
var _ChatAdapterShim = require("./ChatAdapterShim");
|
|
9
10
|
var _HiddenAdaptiveCardActivitySubscriber = require("./ActivitySubscriber/HiddenAdaptiveCardActivitySubscriber");
|
|
@@ -50,6 +51,7 @@ const createAdapter = async (facadeChatSDK, props) => {
|
|
|
50
51
|
fetchBotAuthConfigRetryInterval: (props === null || props === void 0 ? void 0 : (_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : (_props$webChatContain4 = _props$webChatContain3.botAuthConfig) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.fetchBotAuthConfigRetryInterval) || defaultBotAuthConfig.fetchBotAuthConfigRetryInterval
|
|
51
52
|
};
|
|
52
53
|
adapter = new _ChatAdapterShim.ChatAdapterShim(adapter);
|
|
54
|
+
adapter.addSubscriber(new _AddActivitySubscriber.AddActivitySubscriber());
|
|
53
55
|
adapter.addSubscriber(new _PauseActivitySubscriber.PauseActivitySubscriber());
|
|
54
56
|
adapter.addSubscriber(new _BotAuthActivitySubscriber.BotAuthActivitySubscriber(botAuthActivitySubscriberOptionalParams));
|
|
55
57
|
// Remove this code after ICM ID:544623085 is fixed
|
package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultPersistentChatHistoryProps = void 0;
|
|
7
|
+
const defaultPersistentChatHistoryProps = {
|
|
8
|
+
persistentChatHistoryEnabled: true,
|
|
9
|
+
pageSize: 4,
|
|
10
|
+
dividerActivityStyle: {
|
|
11
|
+
border: "1px solid rgb(96, 94, 92, 0.5)",
|
|
12
|
+
margin: "10px 20%"
|
|
13
|
+
},
|
|
14
|
+
bannerStyle: {
|
|
15
|
+
margin: "10px auto"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.defaultPersistentChatHistoryProps = defaultPersistentChatHistoryProps;
|
|
@@ -10,6 +10,7 @@ var _utils = require("../../../common/utils");
|
|
|
10
10
|
var _renderSurveyHelpers = require("./renderSurveyHelpers");
|
|
11
11
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
12
12
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
13
|
+
var _LazyLoadActivity = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity");
|
|
13
14
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
14
15
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
15
16
|
var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
@@ -44,7 +45,7 @@ const prepareEndChat = async (props, facadeChatSDK, state, dispatch, setAdapter,
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
// Use Case: If ended by Agent, stay chat in InActive state
|
|
47
|
-
|
|
48
|
+
const isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
|
|
48
49
|
if (isConversationalSurveyEnabled && ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === _Constants.ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates3 = state.appStates) === null || _state$appStates3 === void 0 ? void 0 : _state$appStates3.conversationEndedBy) === _Constants.ConversationEndEntity.Bot)) {
|
|
49
50
|
dispatch({
|
|
50
51
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
@@ -153,8 +154,23 @@ const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWeb
|
|
|
153
154
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
154
155
|
payload: null
|
|
155
156
|
});
|
|
157
|
+
let isSessionEnded = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.chatDisconnectEventReceived;
|
|
158
|
+
if (!isSessionEnded) {
|
|
159
|
+
// double check by fetching the latest conversation details
|
|
160
|
+
const conversationDetails = await (0, _utils.getConversationDetailsCall)(facadeChatSDK);
|
|
161
|
+
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === _Constants.LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === _Constants.LiveWorkItemState.Closed) {
|
|
162
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
163
|
+
Event: _TelemetryConstants.TelemetryEvent.ChatDisconnectThreadEventReceived,
|
|
164
|
+
Description: "Checking conversation details upon endChat. Chat disconnected.",
|
|
165
|
+
CustomProperties: {
|
|
166
|
+
conversationDetails
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
isSessionEnded = true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
156
172
|
const endChatOptionalParameters = {
|
|
157
|
-
isSessionEnded
|
|
173
|
+
isSessionEnded
|
|
158
174
|
};
|
|
159
175
|
try {
|
|
160
176
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -216,7 +232,12 @@ const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWeb
|
|
|
216
232
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_POST_CHAT_CONTEXT,
|
|
217
233
|
payload: undefined
|
|
218
234
|
});
|
|
219
|
-
|
|
235
|
+
|
|
236
|
+
// Call direct reset to ensure LazyLoadHandler gets reset regardless of broadcast timing
|
|
237
|
+
_LazyLoadActivity.LazyLoadHandler.directReset();
|
|
238
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
239
|
+
eventName: _TelemetryConstants.BroadcastEvent.PersistentConversationReset
|
|
240
|
+
});
|
|
220
241
|
closeChatWidget(dispatch, setWebChatStyles, props);
|
|
221
242
|
facadeChatSDK.destroy();
|
|
222
243
|
}
|
|
@@ -305,6 +326,10 @@ const closeChatStateCleanUp = dispatch => {
|
|
|
305
326
|
proactiveChatInNewWindow: false
|
|
306
327
|
}
|
|
307
328
|
});
|
|
329
|
+
dispatch({
|
|
330
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CITATIONS,
|
|
331
|
+
payload: {}
|
|
332
|
+
});
|
|
308
333
|
|
|
309
334
|
// Clear live chat context only if chat widget is fully closed to support transcript calls after sessionclose is called
|
|
310
335
|
dispatch({
|
|
@@ -8,14 +8,15 @@ var _DemoChatSDK = require("../../webchatcontainerstateful/common/DemoChatSDK");
|
|
|
8
8
|
var _DesignerChatSDK = require("../../webchatcontainerstateful/common/DesignerChatSDK");
|
|
9
9
|
var _mockchatsdk = require("../../webchatcontainerstateful/common/mockchatsdk");
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
-
const getMockChatSDKIfApplicable = (chatSDK,
|
|
12
|
-
if (type) {
|
|
13
|
-
switch (type.toLowerCase()) {
|
|
11
|
+
const getMockChatSDKIfApplicable = (chatSDK, mockProps) => {
|
|
12
|
+
if (mockProps !== null && mockProps !== void 0 && mockProps.type) {
|
|
13
|
+
switch (mockProps.type.toLowerCase()) {
|
|
14
14
|
case "demo":
|
|
15
15
|
chatSDK = new _DemoChatSDK.DemoChatSDK();
|
|
16
16
|
break;
|
|
17
17
|
case "designer":
|
|
18
18
|
chatSDK = new _DesignerChatSDK.DesignerChatSDK();
|
|
19
|
+
chatSDK.mockMessages = mockProps === null || mockProps === void 0 ? void 0 : mockProps.mockMessages;
|
|
19
20
|
break;
|
|
20
21
|
default:
|
|
21
22
|
chatSDK = new _mockchatsdk.MockChatSDK();
|
|
@@ -7,6 +7,7 @@ exports.initWebChatComposer = void 0;
|
|
|
7
7
|
var _Constants = require("../../../common/Constants");
|
|
8
8
|
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
9
9
|
var _utils = require("../../../common/utils");
|
|
10
|
+
var _localizedStringsBotInitialsMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware");
|
|
10
11
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
11
12
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
12
13
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
@@ -17,6 +18,7 @@ var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontrol
|
|
|
17
18
|
var _attachmentProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware"));
|
|
18
19
|
var _channelDataMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware"));
|
|
19
20
|
var _activityMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware");
|
|
21
|
+
var _activityStatusMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware");
|
|
20
22
|
var _attachmentMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware");
|
|
21
23
|
var _attachmentUploadValidatorMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware"));
|
|
22
24
|
var _avatarMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware");
|
|
@@ -44,11 +46,10 @@ var _htmlPlayerMiddleware = _interopRequireDefault(require("../../webchatcontain
|
|
|
44
46
|
var _htmlTextMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware"));
|
|
45
47
|
var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware"));
|
|
46
48
|
var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
|
|
47
|
-
var _localizedStringsBotInitialsMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware");
|
|
48
49
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
49
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
51
|
const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) => {
|
|
51
|
-
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16,
|
|
52
|
+
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _state$domainStates$l6, _state$domainStates$l7, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai2, _props$webChatContain25, _props$webChatContain26, _props$webChatContain27, _props$webChatContain28;
|
|
52
53
|
// Add a hook to make all links open a new window
|
|
53
54
|
postDomPurifyActivities();
|
|
54
55
|
const localizedTexts = {
|
|
@@ -66,6 +67,7 @@ const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) =>
|
|
|
66
67
|
let webChatStore = _WebChatStoreLoader.WebChatStoreLoader.store;
|
|
67
68
|
if (!webChatStore) {
|
|
68
69
|
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _props$webChatContain7;
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
69
71
|
const addConversationalSurveyTagsCallback = action => {
|
|
70
72
|
var _inMemoryState$appSta;
|
|
71
73
|
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
@@ -123,7 +125,7 @@ const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) =>
|
|
|
123
125
|
};
|
|
124
126
|
webChatStore = (0, _botframeworkWebchat.createStore)({},
|
|
125
127
|
//initial state
|
|
126
|
-
_preProcessingMiddleware.default, _attachmentProcessingMiddleware.default, (0, _attachmentUploadValidatorMiddleware.default)((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), (0, _customEventMiddleware.default)(_omnichannelChatComponents.BroadcastService), (0, _queueOverflowHandlerMiddleware.createQueueOverflowMiddleware)(state, dispatch), (0, _channelDataMiddleware.default)(addConversationalSurveyTagsCallback), (0, _conversationEndMiddleware.default)(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), (0, _dataMaskingMiddleware.default)((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), _messageTimestampMiddleware.createMessageTimeStampMiddleware, _messageSequenceIdOverrideMiddleware.createMessageSequenceIdOverrideMiddleware, _citationsMiddleware.createCitationsMiddleware, _gifUploadMiddleware.default, _htmlPlayerMiddleware.default, (0, _htmlTextMiddleware.default)(honorsTargetInHTMLLinks), (0, _maxMessageSizeValidator.default)(localizedTexts), _sanitizationMiddleware.default, (0, _callActionMiddleware.default)(), (0, _localizedStringsBotInitialsMiddleware.localizedStringsBotInitialsMiddleware)(),
|
|
128
|
+
_preProcessingMiddleware.default, _attachmentProcessingMiddleware.default, (0, _attachmentUploadValidatorMiddleware.default)((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), (0, _customEventMiddleware.default)(_omnichannelChatComponents.BroadcastService), (0, _queueOverflowHandlerMiddleware.createQueueOverflowMiddleware)(state, dispatch), (0, _channelDataMiddleware.default)(addConversationalSurveyTagsCallback), (0, _conversationEndMiddleware.default)(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), (0, _dataMaskingMiddleware.default)((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), _messageTimestampMiddleware.createMessageTimeStampMiddleware, _messageSequenceIdOverrideMiddleware.createMessageSequenceIdOverrideMiddleware, (0, _citationsMiddleware.createCitationsMiddleware)(state, dispatch), _gifUploadMiddleware.default, _htmlPlayerMiddleware.default, (0, _htmlTextMiddleware.default)(honorsTargetInHTMLLinks), (0, _maxMessageSizeValidator.default)(localizedTexts), _sanitizationMiddleware.default, (0, _callActionMiddleware.default)(), (0, _localizedStringsBotInitialsMiddleware.localizedStringsBotInitialsMiddleware)(),
|
|
127
129
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
128
130
|
...(((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.storeMiddlewares) ?? []));
|
|
129
131
|
_WebChatStoreLoader.WebChatStoreLoader.store = webChatStore;
|
|
@@ -168,12 +170,12 @@ const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) =>
|
|
|
168
170
|
store: webChatStore,
|
|
169
171
|
activityMiddleware: (_props$webChatContain11 = props.webChatContainerProps) !== null && _props$webChatContain11 !== void 0 && (_props$webChatContain12 = _props$webChatContain11.renderingMiddlewareProps) !== null && _props$webChatContain12 !== void 0 && _props$webChatContain12.disableActivityMiddleware ? undefined : (0, _activityMiddleware.createActivityMiddleware)(renderMarkdown, (_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.systemMessageStyleProps, (_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.userMessageStyleProps),
|
|
170
172
|
attachmentMiddleware: (_props$webChatContain13 = props.webChatContainerProps) !== null && _props$webChatContain13 !== void 0 && (_props$webChatContain14 = _props$webChatContain13.renderingMiddlewareProps) !== null && _props$webChatContain14 !== void 0 && _props$webChatContain14.disableAttachmentMiddleware ? undefined : (0, _attachmentMiddleware.createAttachmentMiddleware)(((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : (_state$domainStates$r4 = _state$domainStates$r3.attachmentProps) === null || _state$domainStates$r4 === void 0 ? void 0 : _state$domainStates$r4.enableInlinePlaying) ?? _defaultAttachmentProps.defaultAttachmentProps.enableInlinePlaying),
|
|
171
|
-
activityStatusMiddleware: (_props$webChatContain15 = props.webChatContainerProps) !== null && _props$webChatContain15 !== void 0 && (_props$webChatContain16 = _props$webChatContain15.renderingMiddlewareProps) !== null && _props$webChatContain16 !== void 0 && _props$webChatContain16.disableActivityStatusMiddleware ? undefined : (
|
|
173
|
+
activityStatusMiddleware: (_props$webChatContain15 = props.webChatContainerProps) !== null && _props$webChatContain15 !== void 0 && (_props$webChatContain16 = _props$webChatContain15.renderingMiddlewareProps) !== null && _props$webChatContain16 !== void 0 && _props$webChatContain16.disableActivityStatusMiddleware ? undefined : (0, _activityStatusMiddleware.createActivityStatusMiddleware)((0, _omnichannelChatSdk.getLocaleStringFromId)((_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : (_state$domainStates$l7 = _state$domainStates$l6.ChatWidgetLanguage) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.msdyn_localeid)),
|
|
172
174
|
toastMiddleware: (_props$webChatContain17 = props.webChatContainerProps) !== null && _props$webChatContain17 !== void 0 && (_props$webChatContain18 = _props$webChatContain17.renderingMiddlewareProps) !== null && _props$webChatContain18 !== void 0 && _props$webChatContain18.disableToastMiddleware ? undefined : (0, _toastMiddleware.createToastMiddleware)(props.notificationPaneProps, endChat),
|
|
173
175
|
renderMarkdown,
|
|
174
176
|
avatarMiddleware: (_props$webChatContain19 = props.webChatContainerProps) !== null && _props$webChatContain19 !== void 0 && (_props$webChatContain20 = _props$webChatContain19.renderingMiddlewareProps) !== null && _props$webChatContain20 !== void 0 && _props$webChatContain20.disableAvatarMiddleware ? undefined : (0, _avatarMiddleware.createAvatarMiddleware)((_state$domainStates$r5 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r5 === void 0 ? void 0 : _state$domainStates$r5.avatarStyleProps, (_state$domainStates$r6 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r6 === void 0 ? void 0 : _state$domainStates$r6.avatarTextStyleProps),
|
|
175
|
-
groupActivitiesMiddleware: (_props$webChatContain21 = props.webChatContainerProps) !== null && _props$webChatContain21 !== void 0 && (_props$webChatContain22 = _props$webChatContain21.renderingMiddlewareProps) !== null && _props$webChatContain22 !== void 0 && _props$webChatContain22.disableGroupActivitiesMiddleware ? undefined : (
|
|
176
|
-
typingIndicatorMiddleware: (_props$webChatContain23 = props.webChatContainerProps) !== null && _props$webChatContain23 !== void 0 && (_props$webChatContain24 = _props$webChatContain23.renderingMiddlewareProps) !== null && _props$webChatContain24 !== void 0 && _props$webChatContain24.disableTypingIndicatorMiddleware ? undefined : (
|
|
177
|
+
groupActivitiesMiddleware: (_props$webChatContain21 = props.webChatContainerProps) !== null && _props$webChatContain21 !== void 0 && (_props$webChatContain22 = _props$webChatContain21.renderingMiddlewareProps) !== null && _props$webChatContain22 !== void 0 && _props$webChatContain22.disableGroupActivitiesMiddleware ? undefined : (_defaultWebChatContai = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.groupActivitiesMiddleware,
|
|
178
|
+
typingIndicatorMiddleware: (_props$webChatContain23 = props.webChatContainerProps) !== null && _props$webChatContain23 !== void 0 && (_props$webChatContain24 = _props$webChatContain23.renderingMiddlewareProps) !== null && _props$webChatContain24 !== void 0 && _props$webChatContain24.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai2 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.typingIndicatorMiddleware,
|
|
177
179
|
onTelemetry: (0, _WebChatLogger.createWebChatTelemetry)(),
|
|
178
180
|
cardActionMiddleware: (0, _cardActionMiddleware.createCardActionMiddleware)(((_props$webChatContain25 = props.webChatContainerProps) === null || _props$webChatContain25 === void 0 ? void 0 : _props$webChatContain25.botMagicCode) || undefined),
|
|
179
181
|
sendTypingIndicator: true,
|
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
const overridePropsOnMockIfApplicable = props => {
|
|
8
8
|
var _props$mock, _props$mock2;
|
|
9
9
|
if (props !== null && props !== void 0 && (_props$mock = props.mock) !== null && _props$mock !== void 0 && _props$mock.type && (props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type.toLowerCase()) === "designer") {
|
|
10
|
+
var _props$mock3, _props$mock3$mockMess;
|
|
10
11
|
if (!props.webChatContainerProps) {
|
|
11
12
|
props.webChatContainerProps = {};
|
|
12
13
|
}
|
|
@@ -22,7 +23,7 @@ const overridePropsOnMockIfApplicable = props => {
|
|
|
22
23
|
props.webChatContainerProps = {
|
|
23
24
|
...props.webChatContainerProps,
|
|
24
25
|
webChatProps: {
|
|
25
|
-
disabled:
|
|
26
|
+
disabled: !(props !== null && props !== void 0 && (_props$mock3 = props.mock) !== null && _props$mock3 !== void 0 && (_props$mock3$mockMess = _props$mock3.mockMessages) !== null && _props$mock3$mockMess !== void 0 && _props$mock3$mockMess.length),
|
|
26
27
|
...props.webChatContainerProps.webChatProps,
|
|
27
28
|
overrideLocalizedStrings: {
|
|
28
29
|
TEXT_INPUT_PLACEHOLDER: "Send a message . . .",
|
|
@@ -156,7 +156,7 @@ const getPostChatContext = async (facadeChatSDK, state, dispatch) => {
|
|
|
156
156
|
if ((state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.postChatContext) === undefined) {
|
|
157
157
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
158
158
|
const context = await facadeChatSDK.getPostChatSurveyContext();
|
|
159
|
-
_TelemetryHelper.TelemetryHelper.
|
|
159
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
160
160
|
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallSucceed,
|
|
161
161
|
Description: _Constants.PostChatSurveyTelemetryMessage.PostChatContextCallSucceed
|
|
162
162
|
});
|
|
@@ -174,7 +174,7 @@ const getPostChatContext = async (facadeChatSDK, state, dispatch) => {
|
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
} catch (error) {
|
|
177
|
-
_TelemetryHelper.TelemetryHelper.
|
|
177
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
178
178
|
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallFailed,
|
|
179
179
|
Description: _Constants.PostChatSurveyTelemetryMessage.PostChatContextCallFailed,
|
|
180
180
|
ExceptionDetails: {
|
|
@@ -24,13 +24,13 @@ const setPostChatContextAndLoadSurvey = async (facadeChatSDK, dispatch, persiste
|
|
|
24
24
|
const postChatEnabled = postChatConfig.postChatEnabled;
|
|
25
25
|
if (postChatEnabled) {
|
|
26
26
|
if (!persistedChat) {
|
|
27
|
-
_TelemetryHelper.TelemetryHelper.
|
|
27
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
28
28
|
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallStarted,
|
|
29
29
|
Description: _Constants.PostChatSurveyTelemetryMessage.PostChatContextCallStarted
|
|
30
30
|
});
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
32
|
const context = await facadeChatSDK.getPostChatSurveyContext();
|
|
33
|
-
_TelemetryHelper.TelemetryHelper.
|
|
33
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
34
34
|
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallSucceed,
|
|
35
35
|
Description: _Constants.PostChatSurveyTelemetryMessage.PostChatContextCallSucceed
|
|
36
36
|
});
|
|
@@ -47,7 +47,7 @@ const setPostChatContextAndLoadSurvey = async (facadeChatSDK, dispatch, persiste
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
} catch (ex) {
|
|
50
|
-
_TelemetryHelper.TelemetryHelper.
|
|
50
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
51
51
|
Event: _TelemetryConstants.TelemetryEvent.PostChatContextCallFailed,
|
|
52
52
|
Description: _Constants.PostChatSurveyTelemetryMessage.PostChatContextCallFailed,
|
|
53
53
|
ExceptionDetails: {
|
|
@@ -105,7 +105,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
105
105
|
|
|
106
106
|
// If minimized, maximize the chat, if the state is missing, consider it as minimized
|
|
107
107
|
if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) === undefined || (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.isMinimized) === true) {
|
|
108
|
-
var _state$domainStates3, _state$domainStates3$, _state$domainStates4, _state$domainStates4
|
|
108
|
+
var _state$domainStates3, _state$domainStates3$, _state$domainStates4, _state$domainStates4$, _TelemetryManager$Int;
|
|
109
109
|
dispatch({
|
|
110
110
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
111
111
|
payload: false
|
|
@@ -116,7 +116,8 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
116
116
|
eventName: _TelemetryConstants.BroadcastEvent.MaximizeChat,
|
|
117
117
|
payload: {
|
|
118
118
|
height: state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.widgetSize) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.height,
|
|
119
|
-
width: state === null || state === void 0 ? void 0 : (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.widgetSize) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.width
|
|
119
|
+
width: state === null || state === void 0 ? void 0 : (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.widgetSize) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.width,
|
|
120
|
+
runtimeId: _TelemetryManager.TelemetryManager === null || _TelemetryManager.TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.lcwRuntimeId
|
|
120
121
|
}
|
|
121
122
|
});
|
|
122
123
|
}
|
|
@@ -137,7 +138,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
137
138
|
* This is because a new change to control OOH as closed event when a widget is coming from chat.
|
|
138
139
|
*/
|
|
139
140
|
if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) === undefined || (state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.isMinimized) === true) {
|
|
140
|
-
var _state$domainStates5, _state$domainStates5$, _state$domainStates6, _state$domainStates6$, _TelemetryManager$
|
|
141
|
+
var _state$domainStates5, _state$domainStates5$, _state$domainStates6, _state$domainStates6$, _TelemetryManager$Int2;
|
|
141
142
|
dispatch({
|
|
142
143
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
143
144
|
payload: false
|
|
@@ -148,7 +149,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
|
|
|
148
149
|
payload: {
|
|
149
150
|
height: state === null || state === void 0 ? void 0 : (_state$domainStates5 = state.domainStates) === null || _state$domainStates5 === void 0 ? void 0 : (_state$domainStates5$ = _state$domainStates5.widgetSize) === null || _state$domainStates5$ === void 0 ? void 0 : _state$domainStates5$.height,
|
|
150
151
|
width: state === null || state === void 0 ? void 0 : (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.widgetSize) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.width,
|
|
151
|
-
runtimeId: _TelemetryManager.TelemetryManager === null || _TelemetryManager.TelemetryManager === void 0 ? void 0 : (_TelemetryManager$
|
|
152
|
+
runtimeId: _TelemetryManager.TelemetryManager === null || _TelemetryManager.TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int2 = _TelemetryManager.TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.lcwRuntimeId
|
|
152
153
|
}
|
|
153
154
|
});
|
|
154
155
|
}
|
|
@@ -180,7 +181,10 @@ const initStartChat = async (facadeChatSDK, dispatch, setAdapter, state, props,
|
|
|
180
181
|
_TelemetryManager.TelemetryTimers.WidgetLoadTimer = (0, _utils.createTimer)();
|
|
181
182
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
182
183
|
Event: _TelemetryConstants.TelemetryEvent.WidgetLoadStarted,
|
|
183
|
-
Description: "Widget start chat started."
|
|
184
|
+
Description: "Widget start chat started.",
|
|
185
|
+
CustomProperties: {
|
|
186
|
+
ConversationStage: _TelemetryConstants.ConversationStage.Initialization
|
|
187
|
+
}
|
|
184
188
|
});
|
|
185
189
|
|
|
186
190
|
//Check if chat retrieved from cache
|
|
@@ -208,6 +212,7 @@ const initStartChat = async (facadeChatSDK, dispatch, setAdapter, state, props,
|
|
|
208
212
|
const startTime = new Date().getTime();
|
|
209
213
|
(0, _FirstMessageTrackerFromBot.createTrackingForFirstMessage)();
|
|
210
214
|
await facadeChatSDK.startChat(startChatOptionalParams);
|
|
215
|
+
(0, _startChatErrorHandler.logStartChatComplete)();
|
|
211
216
|
isStartChatSuccessful = true;
|
|
212
217
|
await createAdapterAndSubscribe(facadeChatSDK, dispatch, setAdapter, startTime, props);
|
|
213
218
|
} catch (error) {
|