@microsoft/omnichannel-chat-widget 1.8.3-main.ec1328d → 1.8.4-main.7bdb634
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 +6 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +34 -0
- package/lib/cjs/common/utils/SecureEventBus.js +307 -0
- package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
- 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/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/startChat.js +5 -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 +29 -5
- 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 +4 -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/index.js +9 -1
- package/lib/esm/common/Constants.js +6 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +34 -0
- package/lib/esm/common/utils/SecureEventBus.js +328 -0
- package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
- 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/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/startChat.js +5 -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 +29 -5
- 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 +2 -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/index.js +1 -0
- package/lib/types/common/Constants.d.ts +5 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +33 -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/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,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _defaultInLineBannerStyle = require("../defaultStyles/defaultInLineBannerStyle");
|
|
9
|
+
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
10
|
+
var _mergeStyles = require("@fluentui/merge-styles");
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
const LoadInlineBannerActivity = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
webChatContainerProps,
|
|
16
|
+
persistentChatHistory,
|
|
17
|
+
id
|
|
18
|
+
} = _ref;
|
|
19
|
+
const localizedTexts = (0, _react.useMemo)(() => ({
|
|
20
|
+
..._defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
|
|
21
|
+
...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
|
|
22
|
+
}), [webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts]);
|
|
23
|
+
const bannerStyle = (0, _mergeStyles.mergeStyles)(persistentChatHistory === null || persistentChatHistory === void 0 ? void 0 : persistentChatHistory.bannerStyle, _defaultInLineBannerStyle.defaultInlineBannerStyle);
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
25
|
+
id: id,
|
|
26
|
+
className: bannerStyle,
|
|
27
|
+
role: "status",
|
|
28
|
+
"aria-live": "polite",
|
|
29
|
+
"aria-label": localizedTexts.PREVIOUS_MESSAGES_LOADING,
|
|
30
|
+
"aria-busy": "true"
|
|
31
|
+
}, localizedTexts.PREVIOUS_MESSAGES_LOADING));
|
|
32
|
+
};
|
|
33
|
+
var _default = LoadInlineBannerActivity;
|
|
34
|
+
exports.default = _default;
|
|
@@ -4,8 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createActivityMiddleware = void 0;
|
|
7
|
+
var _LazyLoadActivity = _interopRequireWildcard(require("./activities/LazyLoadActivity"));
|
|
7
8
|
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
8
9
|
var _Constants = require("../../../../../common/Constants");
|
|
10
|
+
var _ConversationDividerActivity = _interopRequireDefault(require("./activities/ConversationDividerActivity"));
|
|
9
11
|
var _DirectLineActivityType = require("../../enums/DirectLineActivityType");
|
|
10
12
|
var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
|
|
11
13
|
var _react = _interopRequireDefault(require("react"));
|
|
@@ -14,6 +16,10 @@ var _defaultSystemMessageStyles = require("./defaultStyles/defaultSystemMessageS
|
|
|
14
16
|
var _defaultUserMessageStyles = require("./defaultStyles/defaultUserMessageStyles");
|
|
15
17
|
var _utils = require("../../../../../common/utils");
|
|
16
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
22
|
+
/* eslint-disable react/display-name */
|
|
17
23
|
/******
|
|
18
24
|
* ActivityMiddleware
|
|
19
25
|
*
|
|
@@ -24,6 +30,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
24
30
|
******/
|
|
25
31
|
|
|
26
32
|
const loggedSystemMessages = new Array();
|
|
33
|
+
let lastRenderedAt = 0; // Track last rendered receivedAt timestamp for deduplication
|
|
27
34
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
35
|
const handleSystemMessage = (next, args, card, renderMarkdown, systemMessageStyleProps) => {
|
|
29
36
|
var _card$activity, _card$activity$channe, _card$activity$channe2, _card$activity2, _card$activity2$chann, _card$activity3, _card$activity3$chann, _card$activity3$chann2, _card$activity4, _card$activity4$chann, _card$activity5, _card$activity5$chann, _card$nextVisibleActi, _card$nextVisibleActi2, _card$activity6, _card$activity6$chann, _card$activity7, _card$nextVisibleActi3, _card$activity8;
|
|
@@ -88,6 +95,43 @@ const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userM
|
|
|
88
95
|
if (isTagIncluded(card, _Constants.Constants.systemMessageTag)) {
|
|
89
96
|
return handleSystemMessage(next, args, card, renderMarkdown, systemMessageStyleProps);
|
|
90
97
|
}
|
|
98
|
+
if (isTagIncluded(card, _Constants.Constants.persistentChatHistoryMessagePullTriggerTag)) {
|
|
99
|
+
var _card$activity9, _card$activity9$chann, _card$activity9$chann2;
|
|
100
|
+
// Safety check: if this is a new chat session and flag is false, auto-correct it
|
|
101
|
+
if (!_LazyLoadActivity.LazyLoadHandler.hasMoreHistoryAvailable) {
|
|
102
|
+
_LazyLoadActivity.LazyLoadHandler.setHasMoreHistoryAvailable(true);
|
|
103
|
+
}
|
|
104
|
+
const receivedAt = card === null || card === void 0 ? void 0 : (_card$activity9 = card.activity) === null || _card$activity9 === void 0 ? void 0 : (_card$activity9$chann = _card$activity9.channelData) === null || _card$activity9$chann === void 0 ? void 0 : (_card$activity9$chann2 = _card$activity9$chann.webChat) === null || _card$activity9$chann2 === void 0 ? void 0 : _card$activity9$chann2.receivedAt;
|
|
105
|
+
if (receivedAt < lastRenderedAt) {
|
|
106
|
+
card.activity = null;
|
|
107
|
+
return () => false;
|
|
108
|
+
}
|
|
109
|
+
lastRenderedAt = receivedAt;
|
|
110
|
+
|
|
111
|
+
// Return a function that checks availability at render time
|
|
112
|
+
return () => {
|
|
113
|
+
// Double-check at render time in case history availability changed
|
|
114
|
+
if (!_LazyLoadActivity.LazyLoadHandler.hasMoreHistoryAvailable) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return /*#__PURE__*/_react.default.createElement(_LazyLoadActivity.default, null);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (isTagIncluded(card, _Constants.Constants.persistentChatHistoryMessageTag)) {
|
|
121
|
+
const userMessageStyles = {
|
|
122
|
+
..._defaultUserMessageStyles.defaultUserMessageStyles,
|
|
123
|
+
...userMessageStyleProps
|
|
124
|
+
};
|
|
125
|
+
return function () {
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
127
|
+
className: card.activity.from.role === _DirectLineSenderRole.DirectLineSenderRole.User ? _Constants.Constants.sentMessageClassName : _Constants.Constants.receivedMessageClassName,
|
|
128
|
+
style: userMessageStyles
|
|
129
|
+
}, next(...args)(...arguments));
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (isTagIncluded(card, _Constants.Constants.conversationDividerTag)) {
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement(_ConversationDividerActivity.default, null);
|
|
134
|
+
}
|
|
91
135
|
if (card.activity.text && card.activity.type === _DirectLineActivityType.DirectLineActivityType.Message) {
|
|
92
136
|
if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === _Constants.Constants.webchatChannelId) {
|
|
93
137
|
card.activity.text = (0, _utils.escapeHtml)(card.activity.text);
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.activityStatusMiddleware = void 0;
|
|
6
|
+
exports.createActivityStatusMiddleware = exports.activityStatusMiddleware = void 0;
|
|
7
7
|
var _Constants = require("../../../../../common/Constants");
|
|
8
8
|
var _DeliveredTimestamp = require("./timestamps/DeliveredTimestamp");
|
|
9
|
+
var _HistoryMessageTimestamp = require("./timestamps/HistoryMessageTimestamp");
|
|
9
10
|
var _NotDeliveredTimestamp = require("./timestamps/NotDeliveredTimestamp");
|
|
10
11
|
var _react = _interopRequireDefault(require("react"));
|
|
11
12
|
var _SendStatus = require("../../enums/SendStatus");
|
|
@@ -32,6 +33,11 @@ const activityStatusMiddleware = () => next => args => {
|
|
|
32
33
|
current_role = role,
|
|
33
34
|
current_timestamp = timestamp;
|
|
34
35
|
let sameTimestampGroupTemp = sameTimestampGroup;
|
|
36
|
+
if (tags !== null && tags !== void 0 && tags.includes(_Constants.Constants.persistentChatHistoryMessageTag)) {
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_HistoryMessageTimestamp.HistoryMessageTimestamp, {
|
|
38
|
+
args: args
|
|
39
|
+
});
|
|
40
|
+
}
|
|
35
41
|
if (args[_Constants.WebChatMiddlewareConstants.nextVisibleActivity]) {
|
|
36
42
|
const {
|
|
37
43
|
nextVisibleActivity: {
|
|
@@ -41,6 +47,7 @@ const activityStatusMiddleware = () => next => args => {
|
|
|
41
47
|
timestamp
|
|
42
48
|
}
|
|
43
49
|
} = args;
|
|
50
|
+
|
|
44
51
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
45
52
|
const next_name = name,
|
|
46
53
|
next_timestamp = timestamp;
|
|
@@ -68,4 +75,11 @@ const activityStatusMiddleware = () => next => args => {
|
|
|
68
75
|
;
|
|
69
76
|
}
|
|
70
77
|
};
|
|
71
|
-
|
|
78
|
+
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
80
|
+
exports.activityStatusMiddleware = activityStatusMiddleware;
|
|
81
|
+
const createActivityStatusMiddleware = function () {
|
|
82
|
+
let locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "en-us";
|
|
83
|
+
return activityStatusMiddleware;
|
|
84
|
+
};
|
|
85
|
+
exports.createActivityStatusMiddleware = createActivityStatusMiddleware;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.defaultAvatarTextStyles = void 0;
|
|
7
7
|
const defaultAvatarTextStyles = {
|
|
8
8
|
margin: "0",
|
|
9
|
-
fontFamily: "
|
|
9
|
+
fontFamily: "'Segoe UI', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Emoji', Arial, sans-serif",
|
|
10
10
|
fontWeight: 600,
|
|
11
11
|
fontSize: "13px",
|
|
12
12
|
lineHeight: "18px",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultInlineBannerStyle = void 0;
|
|
7
|
+
var _defaultSystemMessageStyles = require("./defaultSystemMessageStyles");
|
|
8
|
+
// Adjust the import path if necessary
|
|
9
|
+
|
|
10
|
+
const defaultInlineBannerStyle = {
|
|
11
|
+
..._defaultSystemMessageStyles.defaultSystemMessageStyles,
|
|
12
|
+
visibility: "visible",
|
|
13
|
+
height: "20px",
|
|
14
|
+
display: "flex",
|
|
15
|
+
justifyContent: "center",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
margin: "5px 10px",
|
|
18
|
+
cursor: "pointer"
|
|
19
|
+
};
|
|
20
|
+
exports.defaultInlineBannerStyle = defaultInlineBannerStyle;
|
|
@@ -11,7 +11,7 @@ const defaultSystemMessageStyles = {
|
|
|
11
11
|
fontSize: "12px",
|
|
12
12
|
borderRadius: 0,
|
|
13
13
|
minHeight: "auto",
|
|
14
|
-
fontFamily: "Segoe UI",
|
|
14
|
+
fontFamily: "'Segoe UI', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Emoji', Arial, sans-serif",
|
|
15
15
|
lineHeight: "16px",
|
|
16
16
|
padding: "0px 10px 0 10px"
|
|
17
17
|
};
|
|
@@ -10,7 +10,7 @@ var _react2 = require("@fluentui/react");
|
|
|
10
10
|
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
11
11
|
var _defaultTimestampContentStyles = require("../defaultStyles/defaultTimestampContentStyles");
|
|
12
12
|
var _utils = require("../../../../../../common/utils");
|
|
13
|
-
var
|
|
13
|
+
var _useChatContextStore = _interopRequireDefault(require("../../../../../../hooks/useChatContextStore"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
16
16
|
const DeliveredTimestamp = _ref => {
|
|
@@ -20,7 +20,7 @@ const DeliveredTimestamp = _ref => {
|
|
|
20
20
|
role,
|
|
21
21
|
name
|
|
22
22
|
} = _ref;
|
|
23
|
-
const [state] = (0,
|
|
23
|
+
const [state] = (0, _useChatContextStore.default)();
|
|
24
24
|
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
25
25
|
const contentStyles = {
|
|
26
26
|
..._defaultTimestampContentStyles.defaultTimestampContentStyles,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.HistoryMessageTimestamp = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _react2 = require("@fluentui/react");
|
|
9
|
+
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
10
|
+
var _defaultTimestampContentStyles = require("../defaultStyles/defaultTimestampContentStyles");
|
|
11
|
+
var _utils = require("../../../../../../common/utils");
|
|
12
|
+
var _useChatContextStore = _interopRequireDefault(require("../../../../../../hooks/useChatContextStore"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const HistoryMessageTimestamp = _ref => {
|
|
16
|
+
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
|
|
17
|
+
let {
|
|
18
|
+
args
|
|
19
|
+
} = _ref;
|
|
20
|
+
const [state] = (0, _useChatContextStore.default)();
|
|
21
|
+
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
22
|
+
const {
|
|
23
|
+
activity: {
|
|
24
|
+
timestamp,
|
|
25
|
+
from: {
|
|
26
|
+
name,
|
|
27
|
+
role
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} = args;
|
|
31
|
+
const contentStyles = {
|
|
32
|
+
..._defaultTimestampContentStyles.defaultTimestampContentStyles,
|
|
33
|
+
...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.timestampContentStyleProps)
|
|
34
|
+
};
|
|
35
|
+
const getTimeElement = timestamp => {
|
|
36
|
+
const timeString = (0, _utils.getTimestampHourMinute)(timestamp);
|
|
37
|
+
const isAmPmFormat = timeString.toLowerCase().includes("am") || timeString.toLowerCase().includes("pm");
|
|
38
|
+
if (dir === "rtl" && isAmPmFormat) {
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
40
|
+
dir: "ltr"
|
|
41
|
+
}, timeString);
|
|
42
|
+
} else {
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
44
|
+
dir: dir
|
|
45
|
+
}, timeString);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement(_react2.Stack, {
|
|
49
|
+
style: contentStyles,
|
|
50
|
+
dir: dir
|
|
51
|
+
}, role === "bot" && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
52
|
+
dir: dir,
|
|
53
|
+
"aria-hidden": "false"
|
|
54
|
+
}, name, " : ", getTimeElement(timestamp))), role === "user" && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
55
|
+
"aria-hidden": "false",
|
|
56
|
+
dir: dir
|
|
57
|
+
}, " ", getTimeElement(timestamp), " - ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_DELIVERED) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_DELIVERED), " "));
|
|
58
|
+
};
|
|
59
|
+
exports.HistoryMessageTimestamp = HistoryMessageTimestamp;
|
|
@@ -13,10 +13,11 @@ var _defaultTimestampFailedStyles = require("../defaultStyles/defaultTimestampFa
|
|
|
13
13
|
var _defaultTimestampRetryStyles = require("../defaultStyles/defaultTimestampRetryStyles");
|
|
14
14
|
var _utils = require("../../../../../../common/utils");
|
|
15
15
|
var _botframeworkWebchat = require("botframework-webchat");
|
|
16
|
-
var
|
|
16
|
+
var _useChatContextStore = _interopRequireDefault(require("../../../../../../hooks/useChatContextStore"));
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
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); }
|
|
18
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; }
|
|
19
|
-
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
21
|
const NotDeliveredTimestamp = _ref => {
|
|
21
22
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _state$domainStates$r4, _state$domainStates$m, _state$domainStates$m2;
|
|
22
23
|
let {
|
|
@@ -35,7 +36,7 @@ const NotDeliveredTimestamp = _ref => {
|
|
|
35
36
|
const {
|
|
36
37
|
timestamp
|
|
37
38
|
} = activity;
|
|
38
|
-
const [state] = (0,
|
|
39
|
+
const [state] = (0, _useChatContextStore.default)();
|
|
39
40
|
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
40
41
|
const contentStyles = {
|
|
41
42
|
..._defaultTimestampContentStyles.defaultTimestampContentStyles,
|
|
@@ -8,12 +8,12 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _react2 = require("@fluentui/react");
|
|
9
9
|
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
10
10
|
var _defaultTimestampContentStyles = require("../defaultStyles/defaultTimestampContentStyles");
|
|
11
|
-
var
|
|
11
|
+
var _useChatContextStore = _interopRequireDefault(require("../../../../../../hooks/useChatContextStore"));
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
14
14
|
const SendingTimestamp = () => {
|
|
15
15
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
|
|
16
|
-
const [state] = (0,
|
|
16
|
+
const [state] = (0, _useChatContextStore.default)();
|
|
17
17
|
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
18
18
|
const contentStyles = {
|
|
19
19
|
..._defaultTimestampContentStyles.defaultTimestampContentStyles,
|
|
@@ -5,59 +5,127 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createCitationsMiddleware = void 0;
|
|
7
7
|
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
8
|
+
var _LiveChatWidgetActionType = require("../../../../../contexts/common/LiveChatWidgetActionType");
|
|
8
9
|
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
var _createReducer = require("../../../../../contexts/createReducer");
|
|
11
|
+
// Middleware that extracts citation metadata from incoming ACS activities and
|
|
12
|
+
// updates in-memory app state with a global citation map. Also rewrites
|
|
13
|
+
// per-message citation labels in the activity text to use a stable,
|
|
14
|
+
// message-scoped prefix when the producer provides a message id.
|
|
15
|
+
|
|
16
|
+
const createCitationsMiddleware = (state, dispatch) => () => next => action => {
|
|
17
|
+
var _action$payload;
|
|
18
|
+
if ((_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
|
|
19
|
+
if (isApplicable(action)) {
|
|
20
|
+
try {
|
|
21
|
+
var _action$payload2, _action$payload2$acti, _gptFeedback$summariz, _gptFeedback$summariz2;
|
|
22
|
+
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
23
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
24
|
+
payload: null
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Use the producer-supplied messageid as a stable per-message prefix
|
|
28
|
+
// when present. Do not derive a prefix from activity.id or timestamps.
|
|
29
|
+
const messagePrefix = ((_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : _action$payload2$acti.messageid) ?? "";
|
|
30
|
+
const gptFeedback = JSON.parse(action.payload.activity.channelData.metadata["pva:gpt-feedback"]);
|
|
31
|
+
// Extract citation objects from the model response
|
|
32
|
+
const citations = (_gptFeedback$summariz = gptFeedback.summarizationOpenAIResponse) === null || _gptFeedback$summariz === void 0 ? void 0 : (_gptFeedback$summariz2 = _gptFeedback$summariz.result) === null || _gptFeedback$summariz2 === void 0 ? void 0 : _gptFeedback$summariz2.textCitations;
|
|
33
|
+
// Rewrite inline citation labels in activity.text to match the global map keys
|
|
34
|
+
const updatedText = replaceCitations(action.payload.activity.text, citations, messagePrefix);
|
|
35
|
+
action.payload.activity.text = updatedText;
|
|
36
|
+
// Build a global citation map keyed by the prefixed citation id and
|
|
37
|
+
// dispatch it to app state so the UI container can render citations.
|
|
17
38
|
try {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
39
|
+
var _inMemoryState$domain;
|
|
40
|
+
const citationMap = {};
|
|
41
|
+
if (citations && Array.isArray(citations)) {
|
|
42
|
+
citations.forEach(citation => {
|
|
43
|
+
if (citation !== null && citation !== void 0 && citation.id) {
|
|
44
|
+
// Preserve the 'cite:' scheme so renderer click handling remains consistent
|
|
45
|
+
const idWithoutScheme = citation.id.replace(/^cite:/, "");
|
|
46
|
+
const prefixedId = `cite:${messagePrefix}_${idWithoutScheme}`;
|
|
47
|
+
citationMap[prefixedId] = citation.text || citation.title || "";
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Read current in-memory state to merge with existing citations
|
|
53
|
+
//const inMemoryState = executeReducer(state, { type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE, payload: null });
|
|
54
|
+
const existingCitations = (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : _inMemoryState$domain.citations) || {};
|
|
55
|
+
const updatedCitations = {
|
|
56
|
+
...existingCitations,
|
|
57
|
+
...citationMap
|
|
58
|
+
};
|
|
59
|
+
// Always dispatch to app state
|
|
60
|
+
dispatch({
|
|
61
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CITATIONS,
|
|
62
|
+
payload: updatedCitations
|
|
63
|
+
});
|
|
64
|
+
} catch (innerErr) {
|
|
65
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
|
|
24
66
|
Event: _TelemetryConstants.TelemetryEvent.CitationMiddlewareFailed,
|
|
25
67
|
ExceptionDetails: {
|
|
26
|
-
ErrorData: "Error while
|
|
27
|
-
Exception:
|
|
68
|
+
ErrorData: "Error while populating citation map",
|
|
69
|
+
Exception: innerErr
|
|
28
70
|
}
|
|
29
71
|
});
|
|
30
72
|
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
75
|
+
Event: _TelemetryConstants.TelemetryEvent.CitationMiddlewareFailed,
|
|
76
|
+
ExceptionDetails: {
|
|
77
|
+
ErrorData: "Error while converting citation labels",
|
|
78
|
+
Exception: error
|
|
79
|
+
}
|
|
80
|
+
});
|
|
31
81
|
}
|
|
32
82
|
}
|
|
33
|
-
|
|
34
|
-
|
|
83
|
+
}
|
|
84
|
+
return next(action);
|
|
35
85
|
};
|
|
36
86
|
exports.createCitationsMiddleware = createCitationsMiddleware;
|
|
37
87
|
const isApplicable = action => {
|
|
38
|
-
var _action$
|
|
39
|
-
if ((action === null || action === void 0 ? void 0 : (_action$
|
|
40
|
-
var _action$
|
|
41
|
-
//
|
|
42
|
-
if (action !== null && action !== void 0 && (_action$
|
|
88
|
+
var _action$payload3, _action$payload3$acti, _action$payload4, _action$payload4$acti;
|
|
89
|
+
if ((action === null || action === void 0 ? void 0 : (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$acti = _action$payload3.activity) === null || _action$payload3$acti === void 0 ? void 0 : _action$payload3$acti.actionType) === "DIRECT_LINE/INCOMING_ACTIVITY" && (action === null || action === void 0 ? void 0 : (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : (_action$payload4$acti = _action$payload4.activity) === null || _action$payload4$acti === void 0 ? void 0 : _action$payload4$acti.channelId) === "ACS_CHANNEL") {
|
|
90
|
+
var _action$payload5, _action$payload5$acti, _action$payload5$acti2, _action$payload5$acti3;
|
|
91
|
+
// Only applicable for ACS incoming activities that include pva:gpt-feedback
|
|
92
|
+
if (action !== null && action !== void 0 && (_action$payload5 = action.payload) !== null && _action$payload5 !== void 0 && (_action$payload5$acti = _action$payload5.activity) !== null && _action$payload5$acti !== void 0 && (_action$payload5$acti2 = _action$payload5$acti.channelData) !== null && _action$payload5$acti2 !== void 0 && (_action$payload5$acti3 = _action$payload5$acti2.metadata) !== null && _action$payload5$acti3 !== void 0 && _action$payload5$acti3["pva:gpt-feedback"]) {
|
|
43
93
|
return true;
|
|
44
94
|
}
|
|
45
95
|
}
|
|
46
96
|
return false;
|
|
47
97
|
};
|
|
48
|
-
const replaceCitations = (text, citations) => {
|
|
98
|
+
const replaceCitations = (text, citations, messagePrefix) => {
|
|
49
99
|
if (!citations || !Array.isArray(citations)) {
|
|
50
100
|
return text;
|
|
51
101
|
}
|
|
52
102
|
try {
|
|
53
|
-
|
|
54
|
-
|
|
103
|
+
let updatedText = text;
|
|
104
|
+
|
|
105
|
+
// First, handle the citation reference definitions at the end (e.g., [1]: cite:1757450535119_1 "index.html")
|
|
106
|
+
// These should NOT be escaped as they are proper citation definitions
|
|
107
|
+
updatedText = updatedText.replace(/\[(\d+)\]:\s(cite:\d+)\s"([^\\"]+)"/g, (match, number, citeId) => {
|
|
108
|
+
// Attempt to find a citation object matching the inline cite id and
|
|
109
|
+
// update the displayed id/title. When a messagePrefix exists we
|
|
110
|
+
// rewrite the id to the prefixed form so it aligns with the
|
|
111
|
+
// global citation map keys.
|
|
112
|
+
const lookupId = citeId;
|
|
113
|
+
const citation = citations.find(c => c.id === lookupId);
|
|
55
114
|
if (citation) {
|
|
56
|
-
|
|
57
|
-
|
|
115
|
+
const idWithoutScheme = citeId.replace(/^cite:/, "");
|
|
116
|
+
const prefixed = messagePrefix ? `cite:${messagePrefix}_${idWithoutScheme}` : citeId;
|
|
117
|
+
return `[${number}]: ${prefixed} "${citation.title}"`;
|
|
58
118
|
}
|
|
59
|
-
return match;
|
|
119
|
+
return match;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Second, escape inline citation references that are NOT followed by a colon
|
|
123
|
+
// This handles cases like "[1][2]"" in the middle of text that should be escaped for markdown
|
|
124
|
+
updatedText = updatedText.replace(/\[(\d+)\](?!:)/g, (match, number) => {
|
|
125
|
+
// Escape the brackets to prevent markdown from treating them as incomplete link syntax
|
|
126
|
+
return `[${number}]`;
|
|
60
127
|
});
|
|
128
|
+
return updatedText;
|
|
61
129
|
} catch (error) {
|
|
62
130
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
63
131
|
Event: _TelemetryConstants.TelemetryEvent.CitationMiddlewareFailed,
|
|
@@ -66,7 +134,6 @@ const replaceCitations = (text, citations) => {
|
|
|
66
134
|
Exception: error
|
|
67
135
|
}
|
|
68
136
|
});
|
|
69
|
-
// Return the original text in case of issues
|
|
70
137
|
return text;
|
|
71
138
|
}
|
|
72
139
|
};
|
|
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createQueueOverflowMiddleware = void 0;
|
|
7
|
-
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
8
7
|
var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
|
|
9
|
-
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
10
8
|
var _LiveChatWidgetActionType = require("../../../../../contexts/common/LiveChatWidgetActionType");
|
|
9
|
+
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
10
|
+
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
11
11
|
var _createReducer = require("../../../../../contexts/createReducer");
|
|
12
12
|
var _utils = require("../../../../../common/utils");
|
|
13
13
|
const queueOverflowHandlingHelper = async (state, dispatch) => {
|
|
@@ -10,49 +10,50 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
10
10
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_ELEMENT_ID"] = 0] = "SET_WIDGET_ELEMENT_ID";
|
|
11
11
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RENDERING_MIDDLEWARE_PROPS"] = 1] = "SET_RENDERING_MIDDLEWARE_PROPS";
|
|
12
12
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MIDDLEWARE_LOCALIZED_TEXTS"] = 2] = "SET_MIDDLEWARE_LOCALIZED_TEXTS";
|
|
13
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
14
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
15
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
16
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
17
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
18
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
19
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
20
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
21
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
22
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
23
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
24
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
25
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
26
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
27
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
28
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
29
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
30
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
31
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
32
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
33
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
34
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
35
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
36
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
37
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
38
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
39
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
40
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
41
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
42
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
43
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
44
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
45
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
46
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
47
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
48
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
49
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
50
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
51
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
52
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
53
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
54
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
55
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
56
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
57
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
13
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CITATIONS"] = 3] = "SET_CITATIONS";
|
|
14
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 4] = "SET_GLOBAL_DIR";
|
|
15
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 5] = "SET_MINIMIZED";
|
|
16
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 6] = "SET_CONVERSATION_STATE";
|
|
17
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 7] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
|
|
18
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 8] = "SET_START_CHAT_FAILING";
|
|
19
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 9] = "SET_START_CHAT_FAILURE_TYPE";
|
|
20
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 10] = "SET_OUTSIDE_OPERATING_HOURS";
|
|
21
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 11] = "SET_PRE_CHAT_SURVEY_RESPONSE";
|
|
22
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 12] = "SET_CUSTOM_CONTEXT";
|
|
23
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 13] = "SET_SHOW_CONFIRMATION";
|
|
24
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 14] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
|
|
25
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 15] = "SET_PRECHAT_RESPONSE_EMAIL";
|
|
26
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 16] = "SET_AUDIO_NOTIFICATION";
|
|
27
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 17] = "SET_E2VV_ENABLED";
|
|
28
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 18] = "SET_POST_CHAT_CONTEXT";
|
|
29
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 19] = "SHOW_CALLING_CONTAINER";
|
|
30
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 20] = "SET_INCOMING_CALL";
|
|
31
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 21] = "DISABLE_VIDEO_CALL";
|
|
32
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 22] = "DISABLE_LOCAL_VIDEO";
|
|
33
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 23] = "DISABLE_REMOTE_VIDEO";
|
|
34
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 24] = "SET_CHAT_TOKEN";
|
|
35
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 25] = "SET_START_CHAT_BUTTON_DISPLAY";
|
|
36
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 26] = "SET_PROACTIVE_CHAT_PARAMS";
|
|
37
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 27] = "SET_TELEMETRY_DATA";
|
|
38
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 28] = "SET_RECONNECT_ID";
|
|
39
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 29] = "SET_UNREAD_MESSAGE_COUNT";
|
|
40
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 30] = "SET_FOCUS_CHAT_BUTTON";
|
|
41
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 31] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
|
|
42
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 32] = "SET_CONVERSATION_ENDED_BY";
|
|
43
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 33] = "SET_WIDGET_STATE";
|
|
44
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 34] = "SET_LIVE_CHAT_CONTEXT";
|
|
45
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 35] = "SET_BOT_OAUTH_SIGNIN_ID";
|
|
46
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 36] = "SET_WIDGET_SIZE";
|
|
47
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 37] = "SET_WIDGET_INSTANCE_ID";
|
|
48
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 38] = "SET_LIVE_CHAT_CONFIG";
|
|
49
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 39] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
|
|
50
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 40] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
|
|
51
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 41] = "SET_SHOULD_USE_BOT_SURVEY";
|
|
52
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 42] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
|
|
53
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 43] = "SET_SURVEY_MODE";
|
|
54
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 44] = "SET_CONFIRMATION_STATE";
|
|
55
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 45] = "SET_POST_CHAT_PARTICIPANT_TYPE";
|
|
56
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_ENABLED"] = 46] = "SET_CONVERSATIONAL_SURVEY_ENABLED";
|
|
57
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_DISPLAY"] = 47] = "SET_CONVERSATIONAL_SURVEY_DISPLAY";
|
|
58
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 48] = "GET_IN_MEMORY_STATE";
|
|
58
59
|
})(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
|