@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,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.CitationPaneStateful = void 0;
|
|
7
|
+
var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _utils = require("../../common/utils");
|
|
10
|
+
var _CitationDim = _interopRequireDefault(require("./CitationDim"));
|
|
11
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
12
|
+
var _Constants = require("../../common/Constants");
|
|
13
|
+
var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
|
|
14
|
+
var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
15
|
+
var _defaultCitationPaneProps = require("./common/defaultProps/defaultCitationPaneProps");
|
|
16
|
+
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
|
+
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); }
|
|
19
|
+
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; }
|
|
20
|
+
let uiTimer;
|
|
21
|
+
const CitationPaneStateful = props => {
|
|
22
|
+
var _props$styleProps3;
|
|
23
|
+
(0, _react.useEffect)(() => {
|
|
24
|
+
uiTimer = (0, _utils.createTimer)();
|
|
25
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
26
|
+
Event: _TelemetryConstants.TelemetryEvent.UXCitationPaneStart
|
|
27
|
+
});
|
|
28
|
+
}, []);
|
|
29
|
+
const initialTabIndexMap = new Map();
|
|
30
|
+
let elements = [];
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
+
const [state, dispatch] = (0, _useChatContextStore.default)();
|
|
34
|
+
|
|
35
|
+
// Use props.id if provided, otherwise fall back to default
|
|
36
|
+
const controlId = props.id || _Constants.HtmlAttributeNames.ocwCitationPaneClassName;
|
|
37
|
+
|
|
38
|
+
// Pane style computed to match the webchat widget container bounds so the pane
|
|
39
|
+
// stays within the widget and scrolls only vertically. We also track an
|
|
40
|
+
// "isReady" flag so we don't render the pane contents until the style is
|
|
41
|
+
// computed — this prevents a transient render that can appear as a flicker.
|
|
42
|
+
const [paneStyle, setPaneStyle] = (0, _react.useState)(null);
|
|
43
|
+
const [isReady, setIsReady] = (0, _react.useState)(false);
|
|
44
|
+
|
|
45
|
+
// Move focus to the container
|
|
46
|
+
(0, _react.useEffect)(() => {
|
|
47
|
+
(0, _utils.preventFocusToMoveOutOfElement)(controlId);
|
|
48
|
+
const focusableElements = (0, _utils.findAllFocusableElement)(`#${controlId}`);
|
|
49
|
+
requestAnimationFrame(() => {
|
|
50
|
+
if (focusableElements && focusableElements.length > 0 && focusableElements[0]) {
|
|
51
|
+
focusableElements[0].focus({
|
|
52
|
+
preventScroll: true
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
elements = (0, _utils.findParentFocusableElementsWithoutChildContainer)(controlId);
|
|
57
|
+
(0, _utils.setTabIndices)(elements, initialTabIndexMap, false);
|
|
58
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
59
|
+
Event: _TelemetryConstants.TelemetryEvent.CitationPaneLoaded
|
|
60
|
+
});
|
|
61
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
62
|
+
Event: _TelemetryConstants.TelemetryEvent.UXCitationPaneCompleted,
|
|
63
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
64
|
+
});
|
|
65
|
+
}, []);
|
|
66
|
+
|
|
67
|
+
// Compute the widget bounds and set pane style accordingly (95% of widget size
|
|
68
|
+
// and centered inside the widget). If the widget container can't be found,
|
|
69
|
+
// fall back to the default pane styles from defaultCitationPaneProps.
|
|
70
|
+
(0, _react.useEffect)(() => {
|
|
71
|
+
const compute = () => {
|
|
72
|
+
var _props$styleProps2;
|
|
73
|
+
try {
|
|
74
|
+
const container = document.querySelector(".webchat__stacked-layout_container");
|
|
75
|
+
if (container) {
|
|
76
|
+
var _props$styleProps;
|
|
77
|
+
const rect = container.getBoundingClientRect();
|
|
78
|
+
const widthPx = Math.round(rect.width * 0.95);
|
|
79
|
+
const heightPx = Math.round(rect.height * 0.95);
|
|
80
|
+
const leftPx = Math.round(rect.left + (rect.width - widthPx) / 2);
|
|
81
|
+
const topPx = Math.round(rect.top + (rect.height - heightPx) / 2);
|
|
82
|
+
// Clone defaults and remove transform so explicit left/top pixel
|
|
83
|
+
// coordinates are respected and the pane stays within the
|
|
84
|
+
// widget bounds.
|
|
85
|
+
const base = Object.assign({}, _defaultCitationPaneProps.defaultCitationPaneStyles.pane);
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
87
|
+
if (base && base.transform) {
|
|
88
|
+
// remove centering transform when we compute exact pixel coords
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
90
|
+
delete base.transform;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Merge user styles first, then computed positioning to ensure proper positioning
|
|
94
|
+
const computedStyle = {
|
|
95
|
+
left: `${leftPx}px`,
|
|
96
|
+
top: `${topPx}px`,
|
|
97
|
+
width: `${widthPx}px`,
|
|
98
|
+
height: `${heightPx}px`
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Apply user styles first, then override with computed positioning
|
|
102
|
+
const generalProps = (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps;
|
|
103
|
+
const userStyles = generalProps && typeof generalProps === "object" ? Object.assign({}, generalProps) : {};
|
|
104
|
+
// Remove positioning properties from user styles that would interfere
|
|
105
|
+
delete userStyles.position;
|
|
106
|
+
delete userStyles.left;
|
|
107
|
+
delete userStyles.top;
|
|
108
|
+
delete userStyles.width;
|
|
109
|
+
delete userStyles.height;
|
|
110
|
+
setPaneStyle(Object.assign({}, base, userStyles, computedStyle));
|
|
111
|
+
// Make the pane visible after the next paint to avoid layout
|
|
112
|
+
// flashes on initial mount.
|
|
113
|
+
requestAnimationFrame(() => setIsReady(true));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
} catch (e) {
|
|
117
|
+
// ignore
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// fallback - merge defaults with user-provided styles but preserve positioning
|
|
121
|
+
const generalProps = (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.generalStyleProps;
|
|
122
|
+
const userStyles = generalProps && typeof generalProps === "object" ? Object.assign({}, generalProps) : {};
|
|
123
|
+
// Remove positioning properties from user styles for fallback
|
|
124
|
+
delete userStyles.position;
|
|
125
|
+
delete userStyles.left;
|
|
126
|
+
delete userStyles.top;
|
|
127
|
+
delete userStyles.width;
|
|
128
|
+
delete userStyles.height;
|
|
129
|
+
const fallbackStyle = Object.assign({}, _defaultCitationPaneProps.defaultCitationPaneStyles.pane, userStyles);
|
|
130
|
+
setPaneStyle(fallbackStyle);
|
|
131
|
+
requestAnimationFrame(() => setIsReady(true));
|
|
132
|
+
};
|
|
133
|
+
compute();
|
|
134
|
+
window.addEventListener("resize", compute);
|
|
135
|
+
return () => window.removeEventListener("resize", compute);
|
|
136
|
+
}, [(_props$styleProps3 = props.styleProps) === null || _props$styleProps3 === void 0 ? void 0 : _props$styleProps3.generalStyleProps]);
|
|
137
|
+
const handleClose = () => {
|
|
138
|
+
if (props.onClose) props.onClose();
|
|
139
|
+
dispatch({
|
|
140
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
|
|
141
|
+
payload: null
|
|
142
|
+
});
|
|
143
|
+
(0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// Merge a safe style object for the container and cast to CSSProperties to satisfy TS
|
|
147
|
+
const baseStyle = Object.assign({
|
|
148
|
+
position: "relative"
|
|
149
|
+
}, paneStyle ?? {
|
|
150
|
+
position: "fixed"
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// If paneStyle hasn't been computed yet, render the DimLayer so clicks
|
|
154
|
+
// still close overlays but hide the pane itself to avoid flashes.
|
|
155
|
+
const hiddenStyle = {
|
|
156
|
+
visibility: isReady ? "visible" : "hidden",
|
|
157
|
+
pointerEvents: isReady ? "auto" : "none"
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// Default wrapper styles - these control the positioning container
|
|
161
|
+
const defaultWrapperStyles = {
|
|
162
|
+
display: "flex",
|
|
163
|
+
flexDirection: "column",
|
|
164
|
+
zIndex: 10001
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
// Wrapper styles for the positioning container
|
|
168
|
+
const wrapperStyles = Object.assign({}, baseStyle, hiddenStyle, defaultWrapperStyles);
|
|
169
|
+
|
|
170
|
+
// Merge the computed positioning styles with user's generalStyleProps for the CitationPane
|
|
171
|
+
const mergedStyleProps = props.styleProps ? {
|
|
172
|
+
...props.styleProps,
|
|
173
|
+
generalStyleProps: Object.assign({}, props.styleProps.generalStyleProps)
|
|
174
|
+
} : undefined;
|
|
175
|
+
const controlProps = {
|
|
176
|
+
id: controlId,
|
|
177
|
+
dir: state.domainStates.globalDir,
|
|
178
|
+
titleText: props.title,
|
|
179
|
+
contentHtml: props.contentHtml,
|
|
180
|
+
brightnessValueOnDim: "0.2",
|
|
181
|
+
// Default brightness
|
|
182
|
+
onClose: handleClose,
|
|
183
|
+
...(props === null || props === void 0 ? void 0 : props.controlProps) // User props override defaults
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CitationDim.default, {
|
|
188
|
+
brightness: controlProps.brightnessValueOnDim
|
|
189
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
190
|
+
style: wrapperStyles
|
|
191
|
+
}, /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.CitationPane, {
|
|
192
|
+
componentOverrides: props === null || props === void 0 ? void 0 : props.componentOverrides,
|
|
193
|
+
controlProps: controlProps,
|
|
194
|
+
styleProps: mergedStyleProps
|
|
195
|
+
})));
|
|
196
|
+
};
|
|
197
|
+
exports.CitationPaneStateful = CitationPaneStateful;
|
|
198
|
+
var _default = CitationPaneStateful;
|
|
199
|
+
exports.default = _default;
|
package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultCitationPaneStyles = exports.defaultCitationContentCSS = exports.default = void 0;
|
|
7
|
+
const defaultCitationPaneStyles = {
|
|
8
|
+
pane: {
|
|
9
|
+
position: "fixed",
|
|
10
|
+
left: "50%",
|
|
11
|
+
top: "18%",
|
|
12
|
+
transform: "translateX(-50%)",
|
|
13
|
+
background: "#fff",
|
|
14
|
+
width: "85%",
|
|
15
|
+
height: "85%",
|
|
16
|
+
overflowY: "auto",
|
|
17
|
+
overflowX: "hidden",
|
|
18
|
+
padding: 16,
|
|
19
|
+
borderRadius: 6,
|
|
20
|
+
zIndex: 10001,
|
|
21
|
+
boxSizing: "border-box"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.defaultCitationPaneStyles = defaultCitationPaneStyles;
|
|
25
|
+
const defaultCitationContentCSS = controlId => `
|
|
26
|
+
#${controlId} .citation-content {
|
|
27
|
+
flex: 1;
|
|
28
|
+
min-height: 0; /* allow flex child to scroll */
|
|
29
|
+
overflow-y: auto;
|
|
30
|
+
overflow-x: auto;
|
|
31
|
+
margin-bottom: 12px;
|
|
32
|
+
white-space: normal; /* wrap normal text */
|
|
33
|
+
word-break: break-word;
|
|
34
|
+
-webkit-overflow-scrolling: touch;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#${controlId} .citation-content pre,
|
|
38
|
+
#${controlId} .citation-content code {
|
|
39
|
+
white-space: pre; /* preserve formatting */
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#${controlId} .citation-content table {
|
|
43
|
+
width: 100%;
|
|
44
|
+
border-collapse: collapse;
|
|
45
|
+
margin-bottom: 12px;
|
|
46
|
+
table-layout: auto;
|
|
47
|
+
overflow-x: auto;
|
|
48
|
+
display: block;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#${controlId} .citation-content table th,
|
|
52
|
+
#${controlId} .citation-content table td {
|
|
53
|
+
padding: 8px 12px;
|
|
54
|
+
border: 1px solid rgba(0,0,0,0.08);
|
|
55
|
+
text-align: left;
|
|
56
|
+
vertical-align: top;
|
|
57
|
+
word-break: break-word;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#${controlId} .citation-content img {
|
|
61
|
+
max-width: 100%;
|
|
62
|
+
height: auto;
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
exports.defaultCitationContentCSS = defaultCitationContentCSS;
|
|
66
|
+
var _default = {
|
|
67
|
+
defaultCitationPaneStyles,
|
|
68
|
+
defaultCitationContentCSS
|
|
69
|
+
};
|
|
70
|
+
exports.default = _default;
|
package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -70,7 +70,10 @@ const HeaderStateful = props => {
|
|
|
70
70
|
var _props$headerProps, _props$headerProps$co, _props$headerProps$co2;
|
|
71
71
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
72
72
|
Event: _TelemetryConstants.TelemetryEvent.HeaderCloseButtonClicked,
|
|
73
|
-
Description: "Header Close action started."
|
|
73
|
+
Description: "Header Close action started.",
|
|
74
|
+
CustomProperties: {
|
|
75
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
76
|
+
}
|
|
74
77
|
});
|
|
75
78
|
if (localConfirmationPaneState.current !== _Constants.ConfirmationState.Ok) {
|
|
76
79
|
dispatch({
|
|
@@ -85,7 +88,10 @@ const HeaderStateful = props => {
|
|
|
85
88
|
}
|
|
86
89
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
87
90
|
Event: _TelemetryConstants.TelemetryEvent.CloseChatActionCompleted,
|
|
88
|
-
Description: "Header Close action completed."
|
|
91
|
+
Description: "Header Close action completed.",
|
|
92
|
+
CustomProperties: {
|
|
93
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
94
|
+
}
|
|
89
95
|
});
|
|
90
96
|
const closeButtonId = ((_props$headerProps = props.headerProps) === null || _props$headerProps === void 0 ? void 0 : (_props$headerProps$co = _props$headerProps.controlProps) === null || _props$headerProps$co === void 0 ? void 0 : (_props$headerProps$co2 = _props$headerProps$co.closeButtonProps) === null || _props$headerProps$co2 === void 0 ? void 0 : _props$headerProps$co2.id) ?? `${controlProps.id}-close-button`;
|
|
91
97
|
if (closeButtonId) {
|
|
@@ -22,13 +22,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
22
22
|
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); }
|
|
23
23
|
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; }
|
|
24
24
|
const LiveChatWidget = props => {
|
|
25
|
-
var _props$
|
|
25
|
+
var _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv, _props$chatConfig2, _props$chatConfig2$Li;
|
|
26
26
|
const reducer = (0, _createReducer.createReducer)();
|
|
27
27
|
const [state, dispatch] = (0, _react.useReducer)(reducer, (0, _LiveChatWidgetContextInitialState.getLiveChatWidgetContextInitialState)(props));
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
29
|
const [adapter, setAdapter] = (0, _react.useState)(undefined);
|
|
30
30
|
const [facadeChatSDK, setFacadeChatSDK] = (0, _react.useState)(undefined);
|
|
31
|
-
const chatSDK = (0, _getMockChatSDKIfApplicable.getMockChatSDKIfApplicable)(props.chatSDK, props === null || props === void 0 ? void 0 :
|
|
31
|
+
const chatSDK = (0, _getMockChatSDKIfApplicable.getMockChatSDKIfApplicable)(props.chatSDK, props === null || props === void 0 ? void 0 : props.mock);
|
|
32
32
|
const disableReauthentication = ((_props$featureConfigP = props.featureConfigProps) === null || _props$featureConfigP === void 0 ? void 0 : _props$featureConfigP.disableReauthentication) === true;
|
|
33
33
|
(0, _overridePropsOnMockIfApplicable.default)(props);
|
|
34
34
|
if (!props.chatConfig) {
|
|
@@ -38,14 +38,14 @@ const LiveChatWidget = props => {
|
|
|
38
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
39
|
const isAuthenticatedChat = !!((_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction) || (0, _liveChatConfigUtils.isPersistentChatEnabled)((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_conversationmode);
|
|
40
40
|
if (!facadeChatSDK) {
|
|
41
|
-
var _props$
|
|
41
|
+
var _props$mock;
|
|
42
42
|
setFacadeChatSDK(new _FacadeChatSDK.FacadeChatSDK({
|
|
43
43
|
"chatSDK": chatSDK,
|
|
44
44
|
"chatConfig": props.chatConfig,
|
|
45
45
|
"isAuthenticated": isAuthenticatedChat,
|
|
46
46
|
"getAuthToken": props === null || props === void 0 ? void 0 : props.getAuthToken,
|
|
47
47
|
//when type is not undefined, it means the SDK is mocked
|
|
48
|
-
"isSDKMocked": !(0, _utils.isNullOrUndefined)(props === null || props === void 0 ? void 0 : (_props$
|
|
48
|
+
"isSDKMocked": !(0, _utils.isNullOrUndefined)(props === null || props === void 0 ? void 0 : (_props$mock = props.mock) === null || _props$mock === void 0 ? void 0 : _props$mock.type)
|
|
49
49
|
}, disableReauthentication));
|
|
50
50
|
}
|
|
51
51
|
(0, _react.useEffect)(() => {
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AddActivitySubscriber = 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 _SecureEventBus = _interopRequireDefault(require("../../../../common/utils/SecureEventBus"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
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); } }
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
+
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; }
|
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
17
|
+
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); }
|
|
18
|
+
/**
|
|
19
|
+
* The `AddActivitySubscriber` class is responsible for subscribing to the `ADD_ACTIVITY` event
|
|
20
|
+
* from the `ChatWidgetEvents` and notifying an observer when a new activity is added.
|
|
21
|
+
*
|
|
22
|
+
* This class implements the `IActivitySubscriber` interface and acts as a bridge between
|
|
23
|
+
* the event system and the observer pattern.
|
|
24
|
+
*/
|
|
25
|
+
let AddActivitySubscriber = /*#__PURE__*/function () {
|
|
26
|
+
/**
|
|
27
|
+
* The observer that will be notified when a new activity is added.
|
|
28
|
+
* This is expected to be an object with a `next` method, such as an RxJS `Observer`.
|
|
29
|
+
*/
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Set to track processed activity IDs to prevent duplicate processing.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Unsubscribe function for the secure event listener
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Subscription for PersistentConversationReset event
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Constructor initializes the `AddActivitySubscriber` and sets up a secure event listener
|
|
47
|
+
* for the `ChatWidgetEvents.ADD_ACTIVITY` event. When the event is triggered, it checks
|
|
48
|
+
* if the event payload contains an `activity` and notifies the observer.
|
|
49
|
+
*/
|
|
50
|
+
function AddActivitySubscriber() {
|
|
51
|
+
_classCallCheck(this, AddActivitySubscriber);
|
|
52
|
+
_defineProperty(this, "observer", void 0);
|
|
53
|
+
_defineProperty(this, "processedActivityIds", new Set());
|
|
54
|
+
_defineProperty(this, "unsubscribeFromSecureEvent", null);
|
|
55
|
+
_defineProperty(this, "resetEventListener", void 0);
|
|
56
|
+
const eventBus = _SecureEventBus.default.getInstance();
|
|
57
|
+
|
|
58
|
+
// Subscribe to the secure event bus instead of global window events
|
|
59
|
+
this.unsubscribeFromSecureEvent = eventBus.subscribe(_ChatWidgetEvents.default.ADD_ACTIVITY, payload => {
|
|
60
|
+
if (payload !== null && payload !== void 0 && payload.activity) {
|
|
61
|
+
var _this$observer;
|
|
62
|
+
const activity = payload.activity;
|
|
63
|
+
const activityId = activity.id;
|
|
64
|
+
if (activity.identifier) {
|
|
65
|
+
if (this.processedActivityIds.has(activity === null || activity === void 0 ? void 0 : activity.identifier)) {
|
|
66
|
+
return; // Skip processing if already handled
|
|
67
|
+
}
|
|
68
|
+
// Add the activity ID to the processed set
|
|
69
|
+
this.processedActivityIds.add(activity === null || activity === void 0 ? void 0 : activity.identifier);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Check if activity has an ID and if it has already been processed
|
|
73
|
+
if (activityId) {
|
|
74
|
+
if (this.processedActivityIds.has(activityId)) {
|
|
75
|
+
return; // Skip processing if already handled
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Add the activity ID to the processed set
|
|
79
|
+
this.processedActivityIds.add(activityId);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Notify the observer with the new activity
|
|
83
|
+
(_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.next(activity);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Subscribe to reset events for cleanup
|
|
88
|
+
this.resetEventListener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.PersistentConversationReset).subscribe(() => {
|
|
89
|
+
this.reset();
|
|
90
|
+
// Clean up the secure event listener when conversation resets
|
|
91
|
+
if (this.unsubscribeFromSecureEvent) {
|
|
92
|
+
this.unsubscribeFromSecureEvent();
|
|
93
|
+
this.unsubscribeFromSecureEvent = null;
|
|
94
|
+
}
|
|
95
|
+
// Unsubscribe from the reset event to prevent accumulation
|
|
96
|
+
if (this.resetEventListener) {
|
|
97
|
+
this.resetEventListener.unsubscribe();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The `next` method is a placeholder for processing the activity.
|
|
104
|
+
* This method can be overridden or extended as needed.
|
|
105
|
+
*
|
|
106
|
+
* @param activity - The activity object to process.
|
|
107
|
+
* @returns The activity object (asynchronously).
|
|
108
|
+
*/
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
110
|
+
_createClass(AddActivitySubscriber, [{
|
|
111
|
+
key: "next",
|
|
112
|
+
value: async function next(activity) {
|
|
113
|
+
return activity;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Reset the processed activity IDs when a conversation resets
|
|
118
|
+
*/
|
|
119
|
+
}, {
|
|
120
|
+
key: "reset",
|
|
121
|
+
value: function reset() {
|
|
122
|
+
this.processedActivityIds.clear();
|
|
123
|
+
}
|
|
124
|
+
}]);
|
|
125
|
+
return AddActivitySubscriber;
|
|
126
|
+
}();
|
|
127
|
+
exports.AddActivitySubscriber = AddActivitySubscriber;
|
package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js
CHANGED
|
@@ -17,7 +17,6 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
17
17
|
const supportedSignInCardContentTypes = ["application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"];
|
|
18
18
|
const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
|
|
19
19
|
const delay = t => new Promise(resolve => setTimeout(resolve, t));
|
|
20
|
-
let response;
|
|
21
20
|
const extractSignInId = signInUrl => {
|
|
22
21
|
const result = botOauthUrlRegex.exec(signInUrl);
|
|
23
22
|
if (result && result[1]) {
|
|
@@ -53,20 +52,20 @@ const fetchBotAuthConfig = async (retries, interval) => {
|
|
|
53
52
|
eventName: _TelemetryConstants.BroadcastEvent.BotAuthConfigRequest
|
|
54
53
|
};
|
|
55
54
|
_omnichannelChatComponents.BroadcastService.postMessage(botAuthConfigRequestEvent);
|
|
55
|
+
let response;
|
|
56
56
|
const listener = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.BotAuthConfigResponse).subscribe(data => {
|
|
57
57
|
var _data$payload, _data$payload2;
|
|
58
58
|
response = ((_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.response) !== undefined ? (_data$payload2 = data.payload) === null || _data$payload2 === void 0 ? void 0 : _data$payload2.response : response;
|
|
59
59
|
listener.unsubscribe();
|
|
60
60
|
});
|
|
61
|
-
if (response !== undefined) {
|
|
62
|
-
//return response;
|
|
63
|
-
return response;
|
|
64
|
-
}
|
|
65
61
|
if (retries === 1) {
|
|
66
62
|
// Base Case
|
|
67
63
|
throw new Error();
|
|
68
64
|
}
|
|
69
65
|
await delay(interval);
|
|
66
|
+
if (response !== undefined) {
|
|
67
|
+
return response;
|
|
68
|
+
}
|
|
70
69
|
return await fetchBotAuthConfig(--retries, interval);
|
|
71
70
|
};
|
|
72
71
|
let BotAuthActivitySubscriber = /*#__PURE__*/function () {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var ChatWidgetEvents;
|
|
8
|
+
(function (ChatWidgetEvents) {
|
|
9
|
+
ChatWidgetEvents["ADD_ACTIVITY"] = "CHAT_WIDGET/ADD_ACTIVITY";
|
|
10
|
+
ChatWidgetEvents["FETCH_PERSISTENT_CHAT_HISTORY"] = "CHAT_WIDGET/FETCH_PERSISTENT_CHAT_HISTORY";
|
|
11
|
+
ChatWidgetEvents["NO_MORE_HISTORY_AVAILABLE"] = "CHAT_WIDGET/NO_MORE_HISTORY_AVAILABLE";
|
|
12
|
+
ChatWidgetEvents["HIDE_LOADING_BANNER"] = "CHAT_WIDGET/HIDE_LOADING_BANNER";
|
|
13
|
+
})(ChatWidgetEvents || (ChatWidgetEvents = {}));
|
|
14
|
+
var _default = ChatWidgetEvents;
|
|
15
|
+
exports.default = _default;
|