@microsoft/omnichannel-chat-widget 1.8.4-main.4478bbf → 1.8.4-main.4f09da2
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/README.md +27 -0
- package/lib/cjs/common/Constants.js +2 -0
- package/lib/cjs/common/telemetry/AppInsightsEvents.js +11 -5
- package/lib/cjs/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -7
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/cjs/common/utils.js +14 -1
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/cjs/components/errorboundary/ErrorBoundary.js +2 -1
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +1 -1
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +26 -20
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
- package/lib/cjs/components/livechatwidget/common/endChat.js +26 -9
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +9 -2
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +113 -26
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +8 -6
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +28 -30
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +6 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +30 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +21 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +11 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/esm/common/utils.js +11 -0
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/esm/components/errorboundary/ErrorBoundary.js +4 -2
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +1 -1
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +26 -20
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
- package/lib/esm/components/livechatwidget/common/endChat.js +26 -9
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +9 -2
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +113 -26
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +8 -6
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +29 -34
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +6 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +30 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +21 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -0
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
- package/lib/types/common/utils.d.ts +9 -1
- package/lib/types/components/errorboundary/ErrorBoundary.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +5 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +15 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +1 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +5 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +2 -2
package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js
CHANGED
|
@@ -17,14 +17,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
* Component to handle persistent chat history events.
|
|
18
18
|
* Uses WebChatStoreLoader instead of hooks to avoid context issues.
|
|
19
19
|
*/
|
|
20
|
-
const WebChatEventSubscribers =
|
|
20
|
+
const WebChatEventSubscribers = () => {
|
|
21
21
|
const [isConnected, setIsConnected] = (0, _react.useState)(false);
|
|
22
22
|
const [storeReady, setStoreReady] = (0, _react.useState)(false);
|
|
23
23
|
const storeWaitTimer = (0, _utils.createTimer)();
|
|
24
|
+
// Type the chatConfig properly to avoid 'any' usage
|
|
25
|
+
|
|
24
26
|
(0, _react.useEffect)(() => {
|
|
25
|
-
if (!props.persistentChatHistoryEnabled) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
27
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
29
28
|
Event: _TelemetryConstants.TelemetryEvent.LCWWebChatStorePollingStarted,
|
|
30
29
|
Description: "WebChat store polling started"
|
|
@@ -56,9 +55,9 @@ const WebChatEventSubscribers = props => {
|
|
|
56
55
|
clearInterval(storeCheckInterval);
|
|
57
56
|
};
|
|
58
57
|
}
|
|
59
|
-
}, [
|
|
58
|
+
}, []);
|
|
60
59
|
(0, _react.useEffect)(() => {
|
|
61
|
-
if (!
|
|
60
|
+
if (!storeReady) {
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
63
|
const checkConnectionStatus = () => {
|
|
@@ -115,7 +114,7 @@ const WebChatEventSubscribers = props => {
|
|
|
115
114
|
return () => {
|
|
116
115
|
clearInterval(interval);
|
|
117
116
|
};
|
|
118
|
-
}, [isConnected,
|
|
117
|
+
}, [isConnected, storeReady]);
|
|
119
118
|
return null;
|
|
120
119
|
};
|
|
121
120
|
var _default = WebChatEventSubscribers;
|
|
@@ -5,13 +5,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
8
9
|
var _defaultPersistentChatHistoryProps = require("../../../../../livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps");
|
|
9
10
|
var _react2 = require("@fluentui/react");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
const ConversationDividerActivity = props => {
|
|
12
13
|
const styleApplied = (0, _react2.mergeStyles)(_defaultPersistentChatHistoryProps.defaultPersistentChatHistoryProps.dividerActivityStyle, props.dividerActivityStyle);
|
|
14
|
+
const ariaLabel = props.dividerActivityAriaLabel || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL;
|
|
15
|
+
|
|
16
|
+
// Create a simple separator that screen readers can detect without being interactive
|
|
17
|
+
// Preserve the visual divider styling while making it accessible
|
|
18
|
+
// Use a ref to programmatically remove only the "EL said:" prefix from the label
|
|
19
|
+
const dividerRef = _react.default.useRef(null);
|
|
20
|
+
_react.default.useEffect(() => {
|
|
21
|
+
if (dividerRef.current) {
|
|
22
|
+
// Find and hardcode the text in the label div to just show the divider label
|
|
23
|
+
const article = dividerRef.current.closest(".webchat__basic-transcript__activity");
|
|
24
|
+
if (article) {
|
|
25
|
+
const labelDiv = article.querySelector("div[id*=\"webchat__basic-transcript__active-descendant-label--\"]");
|
|
26
|
+
if (labelDiv) {
|
|
27
|
+
// Hardcode the text to just the aria label
|
|
28
|
+
labelDiv.textContent = ariaLabel || "";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, [ariaLabel]);
|
|
13
33
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
14
|
-
|
|
34
|
+
ref: dividerRef,
|
|
35
|
+
role: "separator",
|
|
36
|
+
"aria-label": ariaLabel,
|
|
37
|
+
"aria-hidden": false,
|
|
38
|
+
className: styleApplied,
|
|
39
|
+
"data-accessibility-divider": "true",
|
|
40
|
+
style: {
|
|
41
|
+
// Add accessibility enhancements
|
|
42
|
+
position: "relative"
|
|
43
|
+
}
|
|
15
44
|
});
|
|
16
45
|
};
|
|
17
46
|
var _default = ConversationDividerActivity;
|
|
@@ -62,7 +62,7 @@ let LazyLoadHandler = /*#__PURE__*/function () {
|
|
|
62
62
|
|
|
63
63
|
// Scroll operation state
|
|
64
64
|
// Current scroll operation tracking
|
|
65
|
-
// Prevents concurrent scroll operations
|
|
65
|
+
// Prevents concurrent scroll operations (public for event handlers)
|
|
66
66
|
|
|
67
67
|
// Timeout and queue management
|
|
68
68
|
// Tracks all setTimeout IDs for cleanup
|
|
@@ -934,6 +934,21 @@ const LazyLoadActivity = props => {
|
|
|
934
934
|
setHasMoreHistory(false);
|
|
935
935
|
};
|
|
936
936
|
|
|
937
|
+
// Event listener for HISTORY_LOAD_ERROR - hides banner temporarily without disabling future loads
|
|
938
|
+
const handleHistoryLoadError = () => {
|
|
939
|
+
// Temporarily hide the banner by pausing, but keep hasMoreHistory true to allow retry
|
|
940
|
+
LazyLoadHandler.paused = true;
|
|
941
|
+
LazyLoadHandler.pendingScrollAction = false;
|
|
942
|
+
|
|
943
|
+
// Re-enable after a delay to allow retry on next scroll
|
|
944
|
+
// Note: This timeout is intentionally not tracked as it's scoped to the component lifecycle
|
|
945
|
+
window.setTimeout(() => {
|
|
946
|
+
LazyLoadHandler.paused = false;
|
|
947
|
+
}, 2000); // 2 second delay before allowing retry
|
|
948
|
+
|
|
949
|
+
LazyLoadHandler.logLifecycleEvent(_TelemetryConstants.TelemetryEvent.LCWLazyLoadHistoryError, "History load error - will retry on next scroll");
|
|
950
|
+
};
|
|
951
|
+
|
|
937
952
|
// Event listener for PersistentConversationReset to sync React state
|
|
938
953
|
// This fixes the issue where banner doesn't appear in start chat + close chat + start chat sequence
|
|
939
954
|
// by ensuring React state (hasMoreHistory) is synchronized with handler state when reset occurs
|
|
@@ -946,6 +961,9 @@ const LazyLoadActivity = props => {
|
|
|
946
961
|
const eventBus = _SecureEventBus.default.getInstance();
|
|
947
962
|
const unsubscribeNoMoreHistory = eventBus.subscribe(_ChatWidgetEvents.default.NO_MORE_HISTORY_AVAILABLE, handleNoMoreHistory);
|
|
948
963
|
|
|
964
|
+
// Add event listener for history load errors
|
|
965
|
+
const unsubscribeHistoryError = eventBus.subscribe(_ChatWidgetEvents.default.HISTORY_LOAD_ERROR, handleHistoryLoadError);
|
|
966
|
+
|
|
949
967
|
// Add event listener for persistent conversation reset
|
|
950
968
|
const resetSubscription = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.PersistentConversationReset).subscribe(handlePersistentConversationReset);
|
|
951
969
|
|
|
@@ -962,6 +980,7 @@ const LazyLoadActivity = props => {
|
|
|
962
980
|
// Still need to return cleanup function even after reset
|
|
963
981
|
return () => {
|
|
964
982
|
unsubscribeNoMoreHistory();
|
|
983
|
+
unsubscribeHistoryError();
|
|
965
984
|
resetSubscription.unsubscribe();
|
|
966
985
|
};
|
|
967
986
|
}
|
|
@@ -1014,6 +1033,7 @@ const LazyLoadActivity = props => {
|
|
|
1014
1033
|
|
|
1015
1034
|
// Remove event listeners
|
|
1016
1035
|
unsubscribeNoMoreHistory();
|
|
1036
|
+
unsubscribeHistoryError();
|
|
1017
1037
|
resetSubscription.unsubscribe();
|
|
1018
1038
|
if (container) {
|
|
1019
1039
|
container.removeEventListener("scroll", handleScroll);
|
|
@@ -12,6 +12,7 @@ var _DirectLineActivityType = require("../../enums/DirectLineActivityType");
|
|
|
12
12
|
var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
15
|
+
var _defaultMiddlewareLocalizedTexts = require("../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
15
16
|
var _defaultSystemMessageStyles = require("./defaultStyles/defaultSystemMessageStyles");
|
|
16
17
|
var _defaultUserMessageStyles = require("./defaultStyles/defaultUserMessageStyles");
|
|
17
18
|
var _utils = require("../../../../../common/utils");
|
|
@@ -79,7 +80,7 @@ const isDataTagsPresent = card => {
|
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
-
const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userMessageStyleProps) => () => next => function () {
|
|
83
|
+
const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userMessageStyleProps, localizedTexts) => () => next => function () {
|
|
83
84
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
84
85
|
args[_key] = arguments[_key];
|
|
85
86
|
}
|
|
@@ -130,7 +131,11 @@ const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userM
|
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
133
|
if (isTagIncluded(card, _Constants.Constants.conversationDividerTag)) {
|
|
133
|
-
|
|
134
|
+
const conversationDividerLabel = (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL) || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL;
|
|
135
|
+
// Pass the computed localized text to the divider component
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement(_ConversationDividerActivity.default, {
|
|
137
|
+
dividerActivityAriaLabel: conversationDividerLabel
|
|
138
|
+
});
|
|
134
139
|
}
|
|
135
140
|
if (card.activity.text && card.activity.type === _DirectLineActivityType.DirectLineActivityType.Message) {
|
|
136
141
|
if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === _Constants.Constants.webchatChannelId) {
|
|
@@ -17,6 +17,8 @@ var _useChatContextStore = _interopRequireDefault(require("../../../../../../hoo
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
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
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
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
21
|
+
|
|
20
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
23
|
const NotDeliveredTimestamp = _ref => {
|
|
22
24
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$r3, _state$domainStates$r4, _state$domainStates$m, _state$domainStates$m2;
|
|
@@ -32,7 +32,12 @@ const createCitationsMiddleware = (state, dispatch) => () => next => action => {
|
|
|
32
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
33
|
// Rewrite inline citation labels in activity.text to match the global map keys
|
|
34
34
|
const updatedText = replaceCitations(action.payload.activity.text, citations, messagePrefix);
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
// Create new activity object to avoid mutation
|
|
37
|
+
action.payload.activity = {
|
|
38
|
+
...action.payload.activity,
|
|
39
|
+
text: updatedText
|
|
40
|
+
};
|
|
36
41
|
// Build a global citation map keyed by the prefixed citation id and
|
|
37
42
|
// dispatch it to app state so the UI container can render citations.
|
|
38
43
|
try {
|
|
@@ -4,18 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.localizedStringsBotInitialsMiddleware = exports.getOverriddenLocalizedStrings = void 0;
|
|
7
|
+
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
7
8
|
var _Constants = require("../../../../../common/Constants");
|
|
8
|
-
var _utils = require("../../../../../common/utils");
|
|
9
|
-
var _defaultWebChatStyles = require("../../../common/defaultStyles/defaultWebChatStyles");
|
|
10
9
|
var _WebChatActionType = require("../../enums/WebChatActionType");
|
|
10
|
+
var _defaultWebChatStyles = require("../../../common/defaultStyles/defaultWebChatStyles");
|
|
11
|
+
var _utils = require("../../../../../common/utils");
|
|
11
12
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
12
13
|
|
|
13
14
|
let currentAgentInitials = _defaultWebChatStyles.defaultWebChatStyles.botAvatarInitials;
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
// Optional external updater (React context dispatch wrapper) set at runtime
|
|
17
|
+
let externalInitialsUpdater;
|
|
18
|
+
const localizedStringsBotInitialsMiddleware = onInitialsChange => _ref => {
|
|
15
19
|
let {
|
|
16
20
|
dispatch
|
|
17
21
|
} = _ref;
|
|
18
22
|
return next => action => {
|
|
23
|
+
if (onInitialsChange && !externalInitialsUpdater) {
|
|
24
|
+
externalInitialsUpdater = onInitialsChange; // capture once
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
|
|
20
28
|
var _action$payload, _activity$from;
|
|
21
29
|
const activity = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
|
|
@@ -23,10 +31,25 @@ const localizedStringsBotInitialsMiddleware = () => _ref => {
|
|
|
23
31
|
var _activity$channelData, _activity$channelData2, _activity$tags;
|
|
24
32
|
const agentName = activity.from.name.trim();
|
|
25
33
|
const isSystemMessage = agentName === "__agent__" || agentName.startsWith("__") || ((_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(_Constants.Constants.systemMessageTag)) || ((_activity$tags = activity.tags) === null || _activity$tags === void 0 ? void 0 : _activity$tags.includes(_Constants.Constants.systemMessageTag));
|
|
26
|
-
if (!isSystemMessage && agentName
|
|
27
|
-
// Update initials for valid agent/bot names
|
|
34
|
+
if (!isSystemMessage && agentName) {
|
|
28
35
|
const newInitials = (0, _utils.getIconText)(agentName) || currentAgentInitials;
|
|
29
|
-
currentAgentInitials
|
|
36
|
+
if (newInitials !== currentAgentInitials) {
|
|
37
|
+
var _externalInitialsUpda;
|
|
38
|
+
currentAgentInitials = newInitials;
|
|
39
|
+
// Notify external React context if provided
|
|
40
|
+
(_externalInitialsUpda = externalInitialsUpdater) === null || _externalInitialsUpda === void 0 ? void 0 : _externalInitialsUpda(currentAgentInitials || "");
|
|
41
|
+
// Broadcast (optional) for multi-tab sync without forcing consumers
|
|
42
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
43
|
+
eventName: "BotAvatarInitialsUpdated",
|
|
44
|
+
payload: {
|
|
45
|
+
initials: currentAgentInitials
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
// Also dispatch a no-op action into WebChat store to encourage re-render (cheap)
|
|
49
|
+
dispatch({
|
|
50
|
+
type: "__BOT_INITIALS_UPDATED__"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
30
53
|
}
|
|
31
54
|
}
|
|
32
55
|
}
|
|
@@ -40,7 +63,6 @@ const getOverriddenLocalizedStrings = existingOverrides => {
|
|
|
40
63
|
...strings,
|
|
41
64
|
...existingOverrides
|
|
42
65
|
};
|
|
43
|
-
|
|
44
66
|
// Apply dynamic bot initials to alt text if not already overridden through props
|
|
45
67
|
if (!(existingOverrides !== null && existingOverrides !== void 0 && existingOverrides.ACTIVITY_BOT_SAID_ALT)) {
|
|
46
68
|
result.ACTIVITY_BOT_SAID_ALT = `${currentAgentInitials} said:`;
|
|
@@ -56,4 +56,5 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
56
56
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_ENABLED"] = 46] = "SET_CONVERSATIONAL_SURVEY_ENABLED";
|
|
57
57
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_DISPLAY"] = 47] = "SET_CONVERSATIONAL_SURVEY_DISPLAY";
|
|
58
58
|
LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 48] = "GET_IN_MEMORY_STATE";
|
|
59
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_AVATAR_INITIALS"] = 49] = "SET_BOT_AVATAR_INITIALS";
|
|
59
60
|
})(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
|
|
@@ -10,6 +10,7 @@ var _ConversationState = require("./ConversationState");
|
|
|
10
10
|
var _StartChatFailureType = require("./StartChatFailureType");
|
|
11
11
|
var _defaultClientDataStoreProvider = require("../../common/storage/default/defaultClientDataStoreProvider");
|
|
12
12
|
var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
13
|
+
var _defaultWebChatStyles = require("../../components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles");
|
|
13
14
|
const getLiveChatWidgetContextInitialState = props => {
|
|
14
15
|
var _props$controlProps, _props$webChatContain;
|
|
15
16
|
const isOutsideOperatingHours = () => {
|
|
@@ -39,6 +40,10 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
39
40
|
initialStateFromCache.domainStates.liveChatConfig = props.chatConfig;
|
|
40
41
|
// Cache the result of isOutsideOperatingHours() to ensure consistency
|
|
41
42
|
initialStateFromCache.appStates.outsideOperatingHours = outsideOperatingHours;
|
|
43
|
+
// Backward compatibility: if botAvatarInitials not cached (older sessions), seed with default
|
|
44
|
+
if (!initialStateFromCache.domainStates.botAvatarInitials) {
|
|
45
|
+
initialStateFromCache.domainStates.botAvatarInitials = _defaultWebChatStyles.defaultWebChatStyles.botAvatarInitials;
|
|
46
|
+
}
|
|
42
47
|
return initialStateFromCache;
|
|
43
48
|
}
|
|
44
49
|
const LiveChatWidgetContextInitialState = {
|
|
@@ -62,7 +67,8 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
62
67
|
transcriptRequestId: "",
|
|
63
68
|
confirmationPaneConfirmedOptionClicked: false,
|
|
64
69
|
confirmationState: _Constants.ConfirmationState.NotSet,
|
|
65
|
-
startChatFailureType: _StartChatFailureType.StartChatFailureType.Generic
|
|
70
|
+
startChatFailureType: _StartChatFailureType.StartChatFailureType.Generic,
|
|
71
|
+
botAvatarInitials: _defaultWebChatStyles.defaultWebChatStyles.botAvatarInitials
|
|
66
72
|
},
|
|
67
73
|
appStates: {
|
|
68
74
|
conversationState: _ConversationState.ConversationState.Closed,
|
|
@@ -562,6 +562,21 @@ const reducer = (state, action) => {
|
|
|
562
562
|
widgetSize: action.payload
|
|
563
563
|
}
|
|
564
564
|
};
|
|
565
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_BOT_AVATAR_INITIALS:
|
|
566
|
+
inMemory = {
|
|
567
|
+
...inMemory,
|
|
568
|
+
domainStates: {
|
|
569
|
+
...inMemory.domainStates,
|
|
570
|
+
botAvatarInitials: action.payload
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
return {
|
|
574
|
+
...state,
|
|
575
|
+
domainStates: {
|
|
576
|
+
...state.domainStates,
|
|
577
|
+
botAvatarInitials: action.payload
|
|
578
|
+
}
|
|
579
|
+
};
|
|
565
580
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_INSTANCE_ID:
|
|
566
581
|
inMemory = {
|
|
567
582
|
...inMemory,
|
|
@@ -136,6 +136,7 @@ _defineProperty(Constants, "customEventName", "customEventName");
|
|
|
136
136
|
_defineProperty(Constants, "customEventValue", "customEventValue");
|
|
137
137
|
_defineProperty(Constants, "Hidden", "Hidden");
|
|
138
138
|
_defineProperty(Constants, "EndConversationDueToOverflow", "endconversationduetooverflow");
|
|
139
|
+
_defineProperty(Constants, "SkipSessionCloseForPersistentChatFlag", "skipSessionCloseForPersistentChat");
|
|
139
140
|
export const Regex = (_class = /*#__PURE__*/_createClass(function Regex() {
|
|
140
141
|
_classCallCheck(this, Regex);
|
|
141
142
|
}), _defineProperty(_class, "EmailRegex", "^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)*|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\])$"), _class);
|
|
@@ -345,6 +346,7 @@ _defineProperty(PrepareEndChatDescriptionConstants, "ConversationEndedBy", "Conv
|
|
|
345
346
|
_defineProperty(PrepareEndChatDescriptionConstants, "PrepareEndChatError", "There's an error while preparing to end chat. Closing chat widget.");
|
|
346
347
|
_defineProperty(PrepareEndChatDescriptionConstants, "WidgetLoadFailedAfterSessionInit", "SessionInit was successful, but widget load failed. Ending chat to avoid ghost chats in OC.");
|
|
347
348
|
_defineProperty(PrepareEndChatDescriptionConstants, "InitiateEndChatReceived", "Received InitiateEndChat BroadcastEvent while conversation state is not Active. Ending chat.");
|
|
349
|
+
_defineProperty(PrepareEndChatDescriptionConstants, "InitiateEndChatReceivedActiveChat", "Received InitiateEndChat BroadcastEvent while conversation state is Active. Updating conversation states.");
|
|
348
350
|
_defineProperty(PrepareEndChatDescriptionConstants, "EndChatReceivedFromOtherTabs", "Received EndChat BroadcastEvent from other tabs. Closing this chat.");
|
|
349
351
|
_defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseChatOnFailureOrPostChat", "Customer is trying to close chat widget on start chat failure or post chat pane.");
|
|
350
352
|
_defineProperty(PrepareEndChatDescriptionConstants, "CustomerCloseInactiveChat", "Chat was Inactive and customer is trying to close chat widget or refreshing the page.");
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export const AppInsightsEventMapping = {
|
|
2
2
|
"LCWChatButtonClicked": "LCWChatButtonActionStarted",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
3
|
+
"UXLCWChatButtonLoadingStart": "LiveChatWidgetChatButtonLoadingStarted",
|
|
4
|
+
"UXLCWChatButtonLoadingCompleted": "LiveChatWidgetChatButtonLoadingCompleted",
|
|
5
|
+
"UXPrechatPaneStart": "PrechatSurveyStarted",
|
|
6
|
+
"UXPrechatPaneCompleted": "PrechatSurveyCompleted",
|
|
7
|
+
"PrechatSubmitted": "PrechatSurveySubmitCompleted",
|
|
5
8
|
"EndChatEventReceived": "EndChatEventReceivedCompleted",
|
|
6
9
|
"EmailTranscriptSent": "EmailTranscriptActionCompleted",
|
|
7
10
|
"EmailTranscriptFailed": "EmailTranscriptActionFailed",
|
|
@@ -9,8 +12,6 @@ export const AppInsightsEventMapping = {
|
|
|
9
12
|
"HeaderMinimizeButtonClicked": "MinimizeChatActionStarted",
|
|
10
13
|
"DownloadTranscriptButtonClicked": "DownloadTranscriptActionStarted",
|
|
11
14
|
"EmailTranscriptButtonClicked": "EmailTranscriptButtonActionStarted",
|
|
12
|
-
"CustomerVoiceFormResponseSubmitted": "CustomerVoiceFormResponseSubmitCompleted",
|
|
13
|
-
"StartProactiveChatEventReceived": "StartProactiveChatEventReceivedCompleted",
|
|
14
15
|
"ProactiveChatRejected": "ProactiveChatTimeOutCompleted",
|
|
15
16
|
"MessageSent": "MessageSentCompleted",
|
|
16
17
|
"MessageReceived": "MessageReceivedCompleted",
|
|
@@ -19,5 +20,10 @@ export const AppInsightsEventMapping = {
|
|
|
19
20
|
"CustomContextReceived": "CustomContextReceivedCompleted",
|
|
20
21
|
"NewTokenValidationStarted": "AuthTokenValidationStarted",
|
|
21
22
|
"NewTokenValidationCompleted": "AuthTokenValidationCompleted",
|
|
22
|
-
"NewTokenValidationFailed": "AuthTokenValidationFailed"
|
|
23
|
+
"NewTokenValidationFailed": "AuthTokenValidationFailed",
|
|
24
|
+
"UXPostChatPaneStarted": "PostChatSurveyStarted",
|
|
25
|
+
"UXPostChatPaneCompleted": "PostChatSurveyCompleted",
|
|
26
|
+
"WidgetLoadStarted": "ChatSessionInitializationStarted",
|
|
27
|
+
"WidgetLoadComplete": "ChatSessionInitializationCompleted",
|
|
28
|
+
"WidgetLoadFailed": "ChatSessionInitializationFailed"
|
|
23
29
|
};
|
|
@@ -118,6 +118,7 @@ export let TelemetryEvent;
|
|
|
118
118
|
TelemetryEvent["EndChatFailed"] = "EndChatFailed";
|
|
119
119
|
TelemetryEvent["SettingCustomContext"] = "SettingCustomContext";
|
|
120
120
|
TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
|
|
121
|
+
TelemetryEvent["PersistentChatHistoryEnabled"] = "PersistentChatHistoryEnabled";
|
|
121
122
|
TelemetryEvent["LCWChatButtonActionCompleted"] = "LCWChatButtonActionCompleted";
|
|
122
123
|
TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
|
|
123
124
|
TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
|
|
@@ -299,6 +300,7 @@ export let TelemetryEvent;
|
|
|
299
300
|
TelemetryEvent["LCWPersistentConversationHandlerInitialized"] = "LCWPersistentConversationHandlerInitialized";
|
|
300
301
|
TelemetryEvent["LCWPersistentHistoryPullBlocked"] = "LCWPersistentHistoryPullBlocked";
|
|
301
302
|
TelemetryEvent["LCWPersistentHistoryPullCompleted"] = "LCWPersistentHistoryPullCompleted";
|
|
303
|
+
TelemetryEvent["LCWPersistentHistoryReturnedNull"] = "LCWPersistentHistoryReturnedNull";
|
|
302
304
|
TelemetryEvent["LCWLazyLoadInitializationStarted"] = "LCWLazyLoadInitializationStarted";
|
|
303
305
|
TelemetryEvent["LCWLazyLoadContainerNotFound"] = "LCWLazyLoadContainerNotFound";
|
|
304
306
|
TelemetryEvent["LCWLazyLoadInitializationCompleted"] = "LCWLazyLoadInitializationCompleted";
|
|
@@ -308,6 +310,7 @@ export let TelemetryEvent;
|
|
|
308
310
|
TelemetryEvent["LCWLazyLoadActivityMounted"] = "LCWLazyLoadActivityMounted";
|
|
309
311
|
TelemetryEvent["LCWLazyLoadReset"] = "LCWLazyLoadReset";
|
|
310
312
|
TelemetryEvent["LCWLazyLoadNoMoreHistory"] = "LCWLazyLoadNoMoreHistory";
|
|
313
|
+
TelemetryEvent["LCWLazyLoadHistoryError"] = "LCWLazyLoadHistoryError";
|
|
311
314
|
TelemetryEvent["LCWLazyLoadDestroyed"] = "LCWLazyLoadDestroyed";
|
|
312
315
|
TelemetryEvent["SecureEventBusUnauthorizedDispatch"] = "SecureEventBusUnauthorizedDispatch";
|
|
313
316
|
TelemetryEvent["SecureEventBusListenerError"] = "SecureEventBusListenerError";
|
|
@@ -41,7 +41,7 @@ export const RegisterLoggers = () => {
|
|
|
41
41
|
loggers.push(consoleLogger());
|
|
42
42
|
}
|
|
43
43
|
if (((_TelemetryManager$Int9 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int9 === void 0 ? void 0 : (_TelemetryManager$Int10 = _TelemetryManager$Int9.telemetryConfig) === null || _TelemetryManager$Int10 === void 0 ? void 0 : _TelemetryManager$Int10.telemetryDisabled) === false) {
|
|
44
|
-
var _TelemetryManager$Int11, _TelemetryManager$Int20, _TelemetryManager$Int21, _TelemetryManager$Int22, _TelemetryManager$Int23;
|
|
44
|
+
var _TelemetryManager$Int11, _TelemetryManager$Int20, _TelemetryManager$Int21, _TelemetryManager$Int22, _TelemetryManager$Int23, _TelemetryManager$Int24, _TelemetryManager$Int25, _TelemetryManager$Int26;
|
|
45
45
|
if ((_TelemetryManager$Int11 = TelemetryManager.InternalTelemetryData) !== null && _TelemetryManager$Int11 !== void 0 && _TelemetryManager$Int11.ariaConfig) {
|
|
46
46
|
var _TelemetryManager$Int12, _TelemetryManager$Int13, _TelemetryManager$Int14, _TelemetryManager$Int15, _TelemetryManager$Int16, _TelemetryManager$Int17, _TelemetryManager$Int18, _TelemetryManager$Int19;
|
|
47
47
|
loggers.push(ariaTelemetryLogger(((_TelemetryManager$Int12 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int12 === void 0 ? void 0 : (_TelemetryManager$Int13 = _TelemetryManager$Int12.ariaConfig) === null || _TelemetryManager$Int13 === void 0 ? void 0 : _TelemetryManager$Int13.ariaTelemetryKey) ?? defaultAriaConfig.ariaTelemetryKey, ((_TelemetryManager$Int14 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int14 === void 0 ? void 0 : (_TelemetryManager$Int15 = _TelemetryManager$Int14.ariaConfig) === null || _TelemetryManager$Int15 === void 0 ? void 0 : _TelemetryManager$Int15.disableCookieUsage) ?? defaultAriaConfig.disableCookieUsage, ((_TelemetryManager$Int16 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int16 === void 0 ? void 0 : (_TelemetryManager$Int17 = _TelemetryManager$Int16.ariaConfig) === null || _TelemetryManager$Int17 === void 0 ? void 0 : _TelemetryManager$Int17.collectorUriForTelemetry) ?? defaultAriaConfig.collectorUriForTelemetry, ((_TelemetryManager$Int18 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int18 === void 0 ? void 0 : (_TelemetryManager$Int19 = _TelemetryManager$Int18.ariaConfig) === null || _TelemetryManager$Int19 === void 0 ? void 0 : _TelemetryManager$Int19.ariaTelemetryApplicationName) ?? defaultAriaConfig.ariaTelemetryApplicationName));
|
|
@@ -52,12 +52,15 @@ export const RegisterLoggers = () => {
|
|
|
52
52
|
loggers.push(logger);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
const chatConfigAppInsightsKey = (_TelemetryManager$Int22 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int22 === void 0 ? void 0 : _TelemetryManager$Int22.chatConfigAppInsightsKey;
|
|
56
|
+
const appInsightsKeyFromUser = (_TelemetryManager$Int23 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int23 === void 0 ? void 0 : (_TelemetryManager$Int24 = _TelemetryManager$Int23.appInsightsConfig) === null || _TelemetryManager$Int24 === void 0 ? void 0 : _TelemetryManager$Int24.appInsightsKey;
|
|
57
|
+
// when chatConfig has AppInsightsInstrumentationKey
|
|
58
|
+
if (chatConfigAppInsightsKey) {
|
|
59
|
+
loggers.push(appInsightsLogger(chatConfigAppInsightsKey));
|
|
60
|
+
}
|
|
61
|
+
// when key set through appInsightsConfig
|
|
62
|
+
else if (appInsightsKeyFromUser && ((_TelemetryManager$Int25 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int25 === void 0 ? void 0 : (_TelemetryManager$Int26 = _TelemetryManager$Int25.appInsightsConfig) === null || _TelemetryManager$Int26 === void 0 ? void 0 : _TelemetryManager$Int26.appInsightsDisabled) === false) {
|
|
63
|
+
loggers.push(appInsightsLogger(appInsightsKeyFromUser));
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
};
|
|
@@ -5,11 +5,11 @@ import { AppInsightsTelemetryMessage } from "../../Constants";
|
|
|
5
5
|
import { AppInsightsEventMapping } from "../AppInsightsEvents";
|
|
6
6
|
var AllowedKeys;
|
|
7
7
|
(function (AllowedKeys) {
|
|
8
|
-
AllowedKeys["OrganizationId"] = "
|
|
9
|
-
AllowedKeys["ConversationId"] = "
|
|
8
|
+
AllowedKeys["OrganizationId"] = "powerplatform.analytics.resource.organization.id";
|
|
9
|
+
AllowedKeys["ConversationId"] = "powerplatform.analytics.resource.id";
|
|
10
10
|
AllowedKeys["ElapsedTimeInMilliseconds"] = "Duration";
|
|
11
|
-
AllowedKeys["Description"] = "
|
|
12
|
-
AllowedKeys["ChannelId"] = "
|
|
11
|
+
AllowedKeys["Description"] = "omnichannel.description";
|
|
12
|
+
AllowedKeys["ChannelId"] = "omnichannel.channel.type";
|
|
13
13
|
AllowedKeys["LCWRuntimeId"] = "ClientSessionId";
|
|
14
14
|
})(AllowedKeys || (AllowedKeys = {}));
|
|
15
15
|
let initializationPromise = null;
|
|
@@ -86,8 +86,8 @@ export const appInsightsLogger = appInsightsKey => {
|
|
|
86
86
|
if (eventName) {
|
|
87
87
|
const trackingEventName = getTrackingEventName(logLevel, eventName);
|
|
88
88
|
const eventProperties = setEventProperties(trackingEventName, telemetryInfo);
|
|
89
|
-
_logger.
|
|
90
|
-
|
|
89
|
+
_logger.trackTrace({
|
|
90
|
+
message: trackingEventName,
|
|
91
91
|
properties: eventProperties
|
|
92
92
|
});
|
|
93
93
|
}
|
|
@@ -133,7 +133,7 @@ export const appInsightsLogger = appInsightsKey => {
|
|
|
133
133
|
// Additional properties
|
|
134
134
|
eventProperties["ConversationStage"] = customProperties.ConversationStage ?? ConversationStage.CSREngagement;
|
|
135
135
|
eventProperties["Scenario"] = "Conversation Diagnostics";
|
|
136
|
-
eventProperties["
|
|
136
|
+
eventProperties["powerplatform.analytics.subscenario"] = eventName.includes(": ") ? eventName.split(": ")[1] : eventName;
|
|
137
137
|
return eventProperties;
|
|
138
138
|
}
|
|
139
139
|
function getTrackingEventName(logLevel, eventName) {
|
package/lib/esm/common/utils.js
CHANGED
|
@@ -474,4 +474,15 @@ export const getCustomEventValue = customEventPayload => {
|
|
|
474
474
|
export function isEndConversationDueToOverflowActivity(activity) {
|
|
475
475
|
var _activity$channelData, _activity$channelData2;
|
|
476
476
|
return (activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : _activity$channelData.tags) && Array.isArray(activity === null || activity === void 0 ? void 0 : (_activity$channelData2 = activity.channelData) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.tags) && activity.channelData.tags.includes(Constants.EndConversationDueToOverflow);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Parses a value that can be boolean or string ("true"/"false") into a boolean.
|
|
481
|
+
* Handles null/undefined by returning false.
|
|
482
|
+
*
|
|
483
|
+
* @param value - The value to parse (can be boolean, string, null, or undefined)
|
|
484
|
+
* @returns true if value is true or "true" (case-insensitive), false otherwise
|
|
485
|
+
*/
|
|
486
|
+
export function parseBooleanFromConfig(value) {
|
|
487
|
+
return value === true || (value === null || value === void 0 ? void 0 : value.toString().toLowerCase()) === "true";
|
|
477
488
|
}
|
|
@@ -33,7 +33,7 @@ export const CitationPaneStateful = props => {
|
|
|
33
33
|
const [paneStyle, setPaneStyle] = useState(null);
|
|
34
34
|
const [isReady, setIsReady] = useState(false);
|
|
35
35
|
|
|
36
|
-
//
|
|
36
|
+
// Initial focus pattern (mirrors ConfirmationPaneStateful): focus first focusable element (will re-attempt after visibility becomes true)
|
|
37
37
|
useEffect(() => {
|
|
38
38
|
preventFocusToMoveOutOfElement(controlId);
|
|
39
39
|
const focusableElements = findAllFocusableElement(`#${controlId}`);
|
|
@@ -55,6 +55,25 @@ export const CitationPaneStateful = props => {
|
|
|
55
55
|
});
|
|
56
56
|
}, []);
|
|
57
57
|
|
|
58
|
+
// Retry focus once pane is actually visible (isReady) in case initial attempt occurred while wrapper was visibility:hidden
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (!isReady) return;
|
|
61
|
+
const focusableElements = findAllFocusableElement(`#${controlId}`);
|
|
62
|
+
if (focusableElements && focusableElements.length > 0) {
|
|
63
|
+
const first = focusableElements[0];
|
|
64
|
+
// If focused element is not already inside the pane, move focus
|
|
65
|
+
if (!first.contains(document.activeElement) && !(document.activeElement && document.activeElement.id.startsWith(controlId))) {
|
|
66
|
+
requestAnimationFrame(() => {
|
|
67
|
+
if (first.isConnected) {
|
|
68
|
+
first.focus({
|
|
69
|
+
preventScroll: true
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, [isReady, controlId]);
|
|
76
|
+
|
|
58
77
|
// Compute the widget bounds and set pane style accordingly (95% of widget size
|
|
59
78
|
// and centered inside the widget). If the widget container can't be found,
|
|
60
79
|
// fall back to the default pane styles from defaultCitationPaneProps.
|
|
@@ -10,12 +10,14 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
|
|
|
10
10
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
13
|
-
import React, { Component } from
|
|
13
|
+
import React, { Component } from "react";
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
14
16
|
const RenderChildrenFunction = _ref => {
|
|
15
17
|
let {
|
|
16
18
|
children
|
|
17
19
|
} = _ref;
|
|
18
|
-
return typeof children ===
|
|
20
|
+
return typeof children === "function" ? children() : children;
|
|
19
21
|
};
|
|
20
22
|
let ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
21
23
|
_inherits(ErrorBoundary, _Component);
|
|
@@ -3,6 +3,6 @@ var ChatWidgetEvents;
|
|
|
3
3
|
ChatWidgetEvents["ADD_ACTIVITY"] = "CHAT_WIDGET/ADD_ACTIVITY";
|
|
4
4
|
ChatWidgetEvents["FETCH_PERSISTENT_CHAT_HISTORY"] = "CHAT_WIDGET/FETCH_PERSISTENT_CHAT_HISTORY";
|
|
5
5
|
ChatWidgetEvents["NO_MORE_HISTORY_AVAILABLE"] = "CHAT_WIDGET/NO_MORE_HISTORY_AVAILABLE";
|
|
6
|
-
ChatWidgetEvents["
|
|
6
|
+
ChatWidgetEvents["HISTORY_LOAD_ERROR"] = "CHAT_WIDGET/HISTORY_LOAD_ERROR";
|
|
7
7
|
})(ChatWidgetEvents || (ChatWidgetEvents = {}));
|
|
8
8
|
export default ChatWidgetEvents;
|