@microsoft/omnichannel-chat-widget 1.8.4-main.424a580 → 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 +2 -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/errorboundary/ErrorBoundary.js +2 -1
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +1 -1
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +24 -21
- 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/liveChatConfigUtils.js +36 -4
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +103 -26
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +8 -6
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +26 -33
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- 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/LazyLoadActivity.js +21 -1
- 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/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +11 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +2 -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/errorboundary/ErrorBoundary.js +4 -2
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +1 -1
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +24 -21
- 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/liveChatConfigUtils.js +33 -2
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +103 -26
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +8 -6
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +27 -37
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- 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/LazyLoadActivity.js +21 -1
- 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/types/common/Constants.d.ts +2 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -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 +0 -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/package.json +2 -2
|
@@ -85,7 +85,7 @@ let LazyLoadHandler = /*#__PURE__*/function () {
|
|
|
85
85
|
|
|
86
86
|
// Scroll operation state
|
|
87
87
|
// Current scroll operation tracking
|
|
88
|
-
// Prevents concurrent scroll operations
|
|
88
|
+
// Prevents concurrent scroll operations (public for event handlers)
|
|
89
89
|
|
|
90
90
|
// Timeout and queue management
|
|
91
91
|
// Tracks all setTimeout IDs for cleanup
|
|
@@ -956,6 +956,21 @@ const LazyLoadActivity = props => {
|
|
|
956
956
|
setHasMoreHistory(false);
|
|
957
957
|
};
|
|
958
958
|
|
|
959
|
+
// Event listener for HISTORY_LOAD_ERROR - hides banner temporarily without disabling future loads
|
|
960
|
+
const handleHistoryLoadError = () => {
|
|
961
|
+
// Temporarily hide the banner by pausing, but keep hasMoreHistory true to allow retry
|
|
962
|
+
LazyLoadHandler.paused = true;
|
|
963
|
+
LazyLoadHandler.pendingScrollAction = false;
|
|
964
|
+
|
|
965
|
+
// Re-enable after a delay to allow retry on next scroll
|
|
966
|
+
// Note: This timeout is intentionally not tracked as it's scoped to the component lifecycle
|
|
967
|
+
window.setTimeout(() => {
|
|
968
|
+
LazyLoadHandler.paused = false;
|
|
969
|
+
}, 2000); // 2 second delay before allowing retry
|
|
970
|
+
|
|
971
|
+
LazyLoadHandler.logLifecycleEvent(TelemetryEvent.LCWLazyLoadHistoryError, "History load error - will retry on next scroll");
|
|
972
|
+
};
|
|
973
|
+
|
|
959
974
|
// Event listener for PersistentConversationReset to sync React state
|
|
960
975
|
// This fixes the issue where banner doesn't appear in start chat + close chat + start chat sequence
|
|
961
976
|
// by ensuring React state (hasMoreHistory) is synchronized with handler state when reset occurs
|
|
@@ -968,6 +983,9 @@ const LazyLoadActivity = props => {
|
|
|
968
983
|
const eventBus = SecureEventBus.getInstance();
|
|
969
984
|
const unsubscribeNoMoreHistory = eventBus.subscribe(ChatWidgetEvents.NO_MORE_HISTORY_AVAILABLE, handleNoMoreHistory);
|
|
970
985
|
|
|
986
|
+
// Add event listener for history load errors
|
|
987
|
+
const unsubscribeHistoryError = eventBus.subscribe(ChatWidgetEvents.HISTORY_LOAD_ERROR, handleHistoryLoadError);
|
|
988
|
+
|
|
971
989
|
// Add event listener for persistent conversation reset
|
|
972
990
|
const resetSubscription = BroadcastService.getMessageByEventName(BroadcastEvent.PersistentConversationReset).subscribe(handlePersistentConversationReset);
|
|
973
991
|
|
|
@@ -984,6 +1002,7 @@ const LazyLoadActivity = props => {
|
|
|
984
1002
|
// Still need to return cleanup function even after reset
|
|
985
1003
|
return () => {
|
|
986
1004
|
unsubscribeNoMoreHistory();
|
|
1005
|
+
unsubscribeHistoryError();
|
|
987
1006
|
resetSubscription.unsubscribe();
|
|
988
1007
|
};
|
|
989
1008
|
}
|
|
@@ -1036,6 +1055,7 @@ const LazyLoadActivity = props => {
|
|
|
1036
1055
|
|
|
1037
1056
|
// Remove event listeners
|
|
1038
1057
|
unsubscribeNoMoreHistory();
|
|
1058
|
+
unsubscribeHistoryError();
|
|
1039
1059
|
resetSubscription.unsubscribe();
|
|
1040
1060
|
if (container) {
|
|
1041
1061
|
container.removeEventListener("scroll", handleScroll);
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { Constants } from "../../../../../common/Constants";
|
|
8
8
|
import { DeliveryMode } from "@microsoft/omnichannel-chat-sdk";
|
|
9
9
|
import { WebChatActionType } from "../../enums/WebChatActionType";
|
|
10
|
+
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
|
|
11
12
|
const channelDataMiddleware = addConversationalSurveyTagsCallback => _ref => {
|
|
12
13
|
let {
|
|
@@ -27,7 +27,12 @@ export const createCitationsMiddleware = (state, dispatch) => () => next => acti
|
|
|
27
27
|
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;
|
|
28
28
|
// Rewrite inline citation labels in activity.text to match the global map keys
|
|
29
29
|
const updatedText = replaceCitations(action.payload.activity.text, citations, messagePrefix);
|
|
30
|
-
|
|
30
|
+
|
|
31
|
+
// Create new activity object to avoid mutation
|
|
32
|
+
action.payload.activity = {
|
|
33
|
+
...action.payload.activity,
|
|
34
|
+
text: updatedText
|
|
35
|
+
};
|
|
31
36
|
// Build a global citation map keyed by the prefixed citation id and
|
|
32
37
|
// dispatch it to app state so the UI container can render citations.
|
|
33
38
|
try {
|
|
@@ -107,6 +107,7 @@ export declare class Constants {
|
|
|
107
107
|
static readonly customEventValue = "customEventValue";
|
|
108
108
|
static readonly Hidden = "Hidden";
|
|
109
109
|
static readonly EndConversationDueToOverflow = "endconversationduetooverflow";
|
|
110
|
+
static readonly SkipSessionCloseForPersistentChatFlag = "skipSessionCloseForPersistentChat";
|
|
110
111
|
}
|
|
111
112
|
export declare const Regex: {
|
|
112
113
|
new (): {};
|
|
@@ -285,6 +286,7 @@ export declare class PrepareEndChatDescriptionConstants {
|
|
|
285
286
|
static readonly PrepareEndChatError = "There's an error while preparing to end chat. Closing chat widget.";
|
|
286
287
|
static readonly WidgetLoadFailedAfterSessionInit = "SessionInit was successful, but widget load failed. Ending chat to avoid ghost chats in OC.";
|
|
287
288
|
static readonly InitiateEndChatReceived = "Received InitiateEndChat BroadcastEvent while conversation state is not Active. Ending chat.";
|
|
289
|
+
static readonly InitiateEndChatReceivedActiveChat = "Received InitiateEndChat BroadcastEvent while conversation state is Active. Updating conversation states.";
|
|
288
290
|
static readonly EndChatReceivedFromOtherTabs = "Received EndChat BroadcastEvent from other tabs. Closing this chat.";
|
|
289
291
|
static readonly CustomerCloseChatOnFailureOrPostChat = "Customer is trying to close chat widget on start chat failure or post chat pane.";
|
|
290
292
|
static readonly CustomerCloseInactiveChat = "Chat was Inactive and customer is trying to close chat widget or refreshing the page.";
|
|
@@ -288,6 +288,7 @@ export declare enum TelemetryEvent {
|
|
|
288
288
|
LCWPersistentConversationHandlerInitialized = "LCWPersistentConversationHandlerInitialized",
|
|
289
289
|
LCWPersistentHistoryPullBlocked = "LCWPersistentHistoryPullBlocked",
|
|
290
290
|
LCWPersistentHistoryPullCompleted = "LCWPersistentHistoryPullCompleted",
|
|
291
|
+
LCWPersistentHistoryReturnedNull = "LCWPersistentHistoryReturnedNull",
|
|
291
292
|
LCWLazyLoadInitializationStarted = "LCWLazyLoadInitializationStarted",
|
|
292
293
|
LCWLazyLoadContainerNotFound = "LCWLazyLoadContainerNotFound",
|
|
293
294
|
LCWLazyLoadInitializationCompleted = "LCWLazyLoadInitializationCompleted",
|
|
@@ -297,6 +298,7 @@ export declare enum TelemetryEvent {
|
|
|
297
298
|
LCWLazyLoadActivityMounted = "LCWLazyLoadActivityMounted",
|
|
298
299
|
LCWLazyLoadReset = "LCWLazyLoadReset",
|
|
299
300
|
LCWLazyLoadNoMoreHistory = "LCWLazyLoadNoMoreHistory",
|
|
301
|
+
LCWLazyLoadHistoryError = "LCWLazyLoadHistoryError",
|
|
300
302
|
LCWLazyLoadDestroyed = "LCWLazyLoadDestroyed",
|
|
301
303
|
SecureEventBusUnauthorizedDispatch = "SecureEventBusUnauthorizedDispatch",
|
|
302
304
|
SecureEventBusListenerError = "SecureEventBusListenerError",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as CustomEventType from "../contexts/common/CustomEventType";
|
|
1
2
|
import { FacadeChatSDK } from "./facades/FacadeChatSDK";
|
|
2
3
|
import { ITimer } from "./interfaces/ITimer";
|
|
3
|
-
import * as CustomEventType from "../contexts/common/CustomEventType";
|
|
4
4
|
export declare const setTabIndices: (elements: HTMLElement[] | null, tabIndexMap: Map<string, number>, shouldBeFocusable: boolean) => void;
|
|
5
5
|
export declare const findParentFocusableElementsWithoutChildContainer: (elementId: string) => HTMLElement[] | null;
|
|
6
6
|
export declare const findAllFocusableElement: (parent: string | HTMLElement) => any[] | null;
|
|
@@ -55,3 +55,11 @@ export declare function isEndConversationDueToOverflowActivity(activity: {
|
|
|
55
55
|
tags?: string[];
|
|
56
56
|
};
|
|
57
57
|
}): boolean | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Parses a value that can be boolean or string ("true"/"false") into a boolean.
|
|
60
|
+
* Handles null/undefined by returning false.
|
|
61
|
+
*
|
|
62
|
+
* @param value - The value to parse (can be boolean, string, null, or undefined)
|
|
63
|
+
* @returns true if value is true or "true" (case-insensitive), false otherwise
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseBooleanFromConfig(value: boolean | string | null | undefined): boolean;
|
|
@@ -2,6 +2,6 @@ declare enum ChatWidgetEvents {
|
|
|
2
2
|
ADD_ACTIVITY = "CHAT_WIDGET/ADD_ACTIVITY",
|
|
3
3
|
FETCH_PERSISTENT_CHAT_HISTORY = "CHAT_WIDGET/FETCH_PERSISTENT_CHAT_HISTORY",
|
|
4
4
|
NO_MORE_HISTORY_AVAILABLE = "CHAT_WIDGET/NO_MORE_HISTORY_AVAILABLE",
|
|
5
|
-
|
|
5
|
+
HISTORY_LOAD_ERROR = "CHAT_WIDGET/HISTORY_LOAD_ERROR"
|
|
6
6
|
}
|
|
7
7
|
export default ChatWidgetEvents;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
import { ExtendedChatConfig } from "../../webchatcontainerstateful/interfaces/IExtendedChatConffig";
|
|
1
2
|
import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
|
|
2
3
|
export declare const isPostChatSurveyEnabled: (facadeChatSDK: FacadeChatSDK) => Promise<boolean>;
|
|
3
4
|
export declare const getPostChatSurveyConfig: (facadeChatSDK: FacadeChatSDK) => Promise<any>;
|
|
4
5
|
export declare const isPersistentChatEnabled: (conversationMode: string | undefined) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Determines if persistent chat history should be loaded based on all required conditions.
|
|
8
|
+
*
|
|
9
|
+
* @param extendedChatConfig - The extended chat configuration object
|
|
10
|
+
* @returns true if ALL conditions are met:
|
|
11
|
+
* 1. Conversation mode must be Persistent ("192350001")
|
|
12
|
+
* 2. History is enabled in admin config (msdyn_enablepersistentchatpreviousconversations)
|
|
13
|
+
* 3. History is enabled via feature flag (lcwPersistentChatHistoryEnabled)
|
|
14
|
+
*/
|
|
15
|
+
export declare const shouldLoadPersistentChatHistory: (extendedChatConfig: ExtendedChatConfig | undefined) => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ExtendedChatConfig {
|
|
2
|
+
LcwFcbConfiguration?: LcwFcbConfiguration;
|
|
3
|
+
LiveChatConfigAuthSettings?: LiveChatConfigAuthSettings;
|
|
4
|
+
LiveWSAndLiveChatEngJoin?: {
|
|
5
|
+
msdyn_conversationmode?: string;
|
|
6
|
+
msdyn_enablepersistentchatpreviousconversations?: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
interface LcwFcbConfiguration {
|
|
10
|
+
lcwPersistentChatHistoryEnabled?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface LiveChatConfigAuthSettings {
|
|
13
|
+
msdyn_javascriptclientfunction?: string;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { IPersistentChatHistoryProps } from "../../livechatwidget/interfaces/IPersistentChatHistoryProps";
|
|
2
1
|
/**
|
|
3
2
|
* Component to handle persistent chat history events.
|
|
4
3
|
* Uses WebChatStoreLoader instead of hooks to avoid context issues.
|
|
5
4
|
*/
|
|
6
|
-
declare const WebChatEventSubscribers: (
|
|
5
|
+
declare const WebChatEventSubscribers: () => null;
|
|
7
6
|
export default WebChatEventSubscribers;
|
|
@@ -53,7 +53,7 @@ declare class LazyLoadHandler {
|
|
|
53
53
|
static paused: boolean;
|
|
54
54
|
static observer: IntersectionObserver | null;
|
|
55
55
|
private static scrollState;
|
|
56
|
-
|
|
56
|
+
static pendingScrollAction: boolean;
|
|
57
57
|
private static retryTimeouts;
|
|
58
58
|
static resetPending: boolean;
|
|
59
59
|
private static initTimer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.8.4-main.
|
|
3
|
+
"version": "1.8.4-main.4f09da2",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"compose-storybook": "start-storybook -c stories/.storybook -p 9009",
|
|
109
109
|
"build-composite-storybook": "build-storybook -c stories/.storybook -o storybook-build",
|
|
110
110
|
"build-storybook": "cross-env NODE_OPTIONS=--openssl-legacy-provider build-storybook",
|
|
111
|
-
"build": "yarn clean yarn lint && yarn build:esm && yarn build:cjs && tsc",
|
|
111
|
+
"build": "yarn clean && yarn lint && yarn build:esm && yarn build:cjs && tsc",
|
|
112
112
|
"test:unit": "jest -c jest.config.unit.cjs --env=jsdom --runInBand --force-exit",
|
|
113
113
|
"test:e2e": "cd automation_tests && yarn test",
|
|
114
114
|
"test:e2e:build": "yarn build-sample && cd automation_tests && yarn test",
|