@microsoft/omnichannel-chat-widget 1.8.4-main.cbab5fc → 1.8.4-main.cd79f08
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 +12 -3
- package/lib/cjs/common/Constants.js +2 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +235 -9
- package/lib/cjs/common/telemetry/TelemetryConstants.js +13 -0
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/cjs/common/utils/xssUtils.js +23 -51
- package/lib/cjs/common/utils.js +15 -2
- package/lib/cjs/components/errorboundary/ErrorBoundary.js +2 -1
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +9 -1
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +1 -0
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +9 -0
- package/lib/cjs/components/livechatwidget/common/authHelper.js +44 -4
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +3 -2
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
- package/lib/cjs/components/livechatwidget/common/startChat.js +31 -14
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +62 -2
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +42 -27
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +117 -16
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +13 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +160 -167
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +6 -1
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/controller/componentController.js +13 -1
- package/lib/cjs/plugins/newMessageEventHandler.js +20 -3
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +236 -10
- package/lib/esm/common/telemetry/TelemetryConstants.js +13 -0
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/esm/common/utils/xssUtils.js +23 -51
- package/lib/esm/common/utils.js +12 -1
- package/lib/esm/components/errorboundary/ErrorBoundary.js +4 -2
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +9 -1
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +1 -0
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +9 -0
- package/lib/esm/components/livechatwidget/common/authHelper.js +44 -4
- package/lib/esm/components/livechatwidget/common/createAdapter.js +3 -2
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
- package/lib/esm/components/livechatwidget/common/startChat.js +31 -14
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +62 -2
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +1 -2
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +43 -28
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +117 -16
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +13 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +160 -171
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +1 -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/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +6 -1
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/controller/componentController.js +13 -1
- package/lib/esm/plugins/newMessageEventHandler.js +20 -3
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +29 -0
- package/lib/types/common/facades/types/IFacadeChatSDKInput.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +13 -2
- package/lib/types/common/utils/xssUtils.d.ts +5 -21
- 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/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +9 -2
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
- package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +14 -38
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +15 -6
|
@@ -34,6 +34,7 @@ export declare class FacadeChatSDK {
|
|
|
34
34
|
private getAuthToken?;
|
|
35
35
|
private sdkMocked;
|
|
36
36
|
private disableReauthentication;
|
|
37
|
+
private pendingMidAuthUnauthenticatedState;
|
|
37
38
|
isSDKMocked(): boolean;
|
|
38
39
|
getChatSDK(): OmnichannelChatSDK;
|
|
39
40
|
destroy(): void;
|
|
@@ -46,6 +47,34 @@ export declare class FacadeChatSDK {
|
|
|
46
47
|
private setToken;
|
|
47
48
|
private corroborateTokenIsSet;
|
|
48
49
|
private tokenRing;
|
|
50
|
+
/**
|
|
51
|
+
* Sets unauthenticated state for mid-auth flow.
|
|
52
|
+
* Clears SDK internal state to prevent reconnection to previous authenticated session.
|
|
53
|
+
*/
|
|
54
|
+
private setMidAuthUnauthenticatedState;
|
|
55
|
+
/** Clears authentication state in both FacadeChatSDK and underlying SDK */
|
|
56
|
+
private clearAuthState;
|
|
57
|
+
/**
|
|
58
|
+
* Migrates conversation from unauthenticated to authenticated via authenticateChat.
|
|
59
|
+
* Called after startChat() when user has a valid token but the backend conversation
|
|
60
|
+
* was started as unauthenticated.
|
|
61
|
+
*/
|
|
62
|
+
private migrateConversationToAuthenticated;
|
|
63
|
+
/**
|
|
64
|
+
* Configures SDK auth state before startChat.
|
|
65
|
+
* CASE 1: Pending unauthenticated (no token) - sets deferInitialAuth=true
|
|
66
|
+
* CASE 2: Authenticated with valid token - sets SDK token and deferInitialAuth based on scenario
|
|
67
|
+
*/
|
|
68
|
+
private configureMidAuthState;
|
|
69
|
+
/**
|
|
70
|
+
* CASE 1 handler: Returns true if reconnect params should be cleared (Auth -> Unauth transition)
|
|
71
|
+
*/
|
|
72
|
+
private handlePendingUnauthenticatedState;
|
|
73
|
+
/**
|
|
74
|
+
* CASE 2 handler: Sets deferInitialAuth only for reconnects to unauthenticated sessions (need migration).
|
|
75
|
+
* For new chats or reconnects to authenticated sessions, SDK handles auth internally.
|
|
76
|
+
*/
|
|
77
|
+
private handleAuthenticatedState;
|
|
49
78
|
private validateAndExecuteCall;
|
|
50
79
|
initialize(optionalParams?: InitializeOptionalParams): Promise<ChatConfig>;
|
|
51
80
|
getChatReconnectContext(optionalParams?: ChatReconnectOptionalParams): Promise<ChatReconnectContext>;
|
|
@@ -5,7 +5,9 @@ export interface IFacadeChatSDKInput {
|
|
|
5
5
|
chatConfig: ChatConfig;
|
|
6
6
|
isAuthenticated: boolean;
|
|
7
7
|
isSDKMocked: boolean;
|
|
8
|
-
getAuthToken?: (authClientFunction?: string
|
|
8
|
+
getAuthToken?: (authClientFunction?: string, options?: {
|
|
9
|
+
isMidAuthEnabled: boolean;
|
|
10
|
+
}) => Promise<string | null>;
|
|
9
11
|
}
|
|
10
12
|
export interface PingResponse {
|
|
11
13
|
result: boolean;
|
|
@@ -57,7 +57,9 @@ export declare enum BroadcastEvent {
|
|
|
57
57
|
OnWidgetError = "OnWidgetError",
|
|
58
58
|
FMLTrackingCompletedAck = "FMLTrackingCompletedAck",
|
|
59
59
|
FMLTrackingCompleted = "FMLTrackingCompleted",
|
|
60
|
-
PersistentConversationReset = "PersistentConversationReset"
|
|
60
|
+
PersistentConversationReset = "PersistentConversationReset",
|
|
61
|
+
MidConversationAuthSucceeded = "MidConversationAuthSucceeded",// Emitted when mid-conversation auth succeeds (for reconnect support)
|
|
62
|
+
MidConversationAuthReset = "MidConversationAuthReset"
|
|
61
63
|
}
|
|
62
64
|
export declare enum TelemetryEvent {
|
|
63
65
|
FetchPersistentChatHistoryFailed = "FetchPersistentChatHistoryFailed",
|
|
@@ -90,6 +92,9 @@ export declare enum TelemetryEvent {
|
|
|
90
92
|
CallingSDKInitFailed = "CallingSDKInitFailed",
|
|
91
93
|
CallingSDKLoadSuccess = "CallingSDKLoadSuccess",
|
|
92
94
|
CallingSDKLoadFailed = "CallingSDKLoadFailed",
|
|
95
|
+
MidConversationAuthSucceeded = "MidConversationAuthSucceeded",
|
|
96
|
+
MidConversationAuthFailed = "MidConversationAuthFailed",
|
|
97
|
+
MidConversationAuthReset = "MidConversationAuthReset",
|
|
93
98
|
GetConversationDetailsCallStarted = "GetConversationDetailsCallStarted",
|
|
94
99
|
GetConversationDetailsCallFailed = "GetConversationDetailsCallFailed",
|
|
95
100
|
EndChatSDKCallFailed = "EndChatSDKCallFailed",
|
|
@@ -300,10 +305,16 @@ export declare enum TelemetryEvent {
|
|
|
300
305
|
LCWLazyLoadNoMoreHistory = "LCWLazyLoadNoMoreHistory",
|
|
301
306
|
LCWLazyLoadHistoryError = "LCWLazyLoadHistoryError",
|
|
302
307
|
LCWLazyLoadDestroyed = "LCWLazyLoadDestroyed",
|
|
308
|
+
LCWLazyLoadTriggerFired = "LCWLazyLoadTriggerFired",
|
|
309
|
+
LCWLazyLoadBatchReceived = "LCWLazyLoadBatchReceived",
|
|
310
|
+
LCWLazyLoadInitialLoadComplete = "LCWLazyLoadInitialLoadComplete",
|
|
311
|
+
LCWLazyLoadScrollAnchorApplied = "LCWLazyLoadScrollAnchorApplied",
|
|
303
312
|
SecureEventBusUnauthorizedDispatch = "SecureEventBusUnauthorizedDispatch",
|
|
304
313
|
SecureEventBusListenerError = "SecureEventBusListenerError",
|
|
305
314
|
SecureEventBusDispatchError = "SecureEventBusDispatchError",
|
|
306
|
-
StartChatComplete = "StartChatComplete"
|
|
315
|
+
StartChatComplete = "StartChatComplete",
|
|
316
|
+
AgentJoinedConversation = "AgentJoinedConversation",
|
|
317
|
+
BrowserTabHidden = "BrowserTabHidden"
|
|
307
318
|
}
|
|
308
319
|
export interface TelemetryInput {
|
|
309
320
|
scenarioType: ScenarioType;
|
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Sanitizes text input and detects XSS attack patterns.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* against various XSS techniques including script injection, event handler injection, style-based
|
|
7
|
-
* attacks, and encoded payloads.
|
|
4
|
+
* Sanitizes first with DOMPurify, then checks for malicious patterns in both
|
|
5
|
+
* the original and sanitized text to catch mutation XSS attacks.
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - HTML event handlers (onmouseover, onclick, etc.)
|
|
12
|
-
* - Script tags (<script>)
|
|
13
|
-
* - CSS expression() functions
|
|
14
|
-
* - CSS url() functions
|
|
15
|
-
* - Position-based CSS attacks (position: fixed/absolute)
|
|
16
|
-
* - VBScript protocol URLs
|
|
17
|
-
* - Data URLs with HTML content
|
|
18
|
-
* - Fragment identifiers with escaped quotes
|
|
19
|
-
* - HTML entity-encoded angle brackets
|
|
20
|
-
*
|
|
21
|
-
* @param text - The input text to be analyzed and sanitized
|
|
22
|
-
* @returns An object containing:
|
|
23
|
-
* - cleanText: The sanitized version of the input text with all HTML tags and attributes removed
|
|
24
|
-
* - isXSSDetected: Boolean flag indicating whether potential XSS patterns were found in the original text
|
|
7
|
+
* @param text - Input text to sanitize
|
|
8
|
+
* @returns Object with cleanText (sanitized) and isXSSDetected flag
|
|
25
9
|
*/
|
|
26
10
|
export declare const detectAndCleanXSS: (text: string) => {
|
|
27
11
|
cleanText: string;
|
|
@@ -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;
|
package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare class BotAuthActivitySubscriber implements IActivitySubscriber {
|
|
|
5
5
|
private signInCardSeen;
|
|
6
6
|
private fetchBotAuthConfigRetries;
|
|
7
7
|
private fetchBotAuthConfigRetryInterval;
|
|
8
|
+
private fallbackShowSignInCard?;
|
|
8
9
|
constructor(optionalParams?: IBotAuthActivitySubscriberOptionalParams);
|
|
9
10
|
applicable(activity: any): boolean;
|
|
10
11
|
apply(activity: any): Promise<any>;
|
|
@@ -2,6 +2,7 @@ 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
|
-
HISTORY_LOAD_ERROR = "CHAT_WIDGET/HISTORY_LOAD_ERROR"
|
|
5
|
+
HISTORY_LOAD_ERROR = "CHAT_WIDGET/HISTORY_LOAD_ERROR",
|
|
6
|
+
HISTORY_BATCH_LOADED = "CHAT_WIDGET/HISTORY_BATCH_LOADED"
|
|
6
7
|
}
|
|
7
8
|
export default ChatWidgetEvents;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import ChatConfig from "@microsoft/omnichannel-chat-sdk/lib/core/ChatConfig";
|
|
2
2
|
import { OmnichannelChatSDK } from "@microsoft/omnichannel-chat-sdk";
|
|
3
|
+
/**
|
|
4
|
+
* Check if mid-auth is enabled based on chatConfig.
|
|
5
|
+
* Mid-auth flag lives under LiveWSAndLiveChatEngJoin.msdyn_authenticatedsigninoptional.
|
|
6
|
+
*/
|
|
7
|
+
declare const isMidAuthEnabled: (chatConfig: ChatConfig | undefined) => boolean;
|
|
3
8
|
declare const getAuthClientFunction: (chatConfig: ChatConfig | undefined) => string | undefined;
|
|
4
|
-
declare const handleAuthentication: (chatSDK: OmnichannelChatSDK, chatConfig: ChatConfig | undefined, getAuthToken: ((authClientFunction?: string
|
|
9
|
+
declare const handleAuthentication: (chatSDK: OmnichannelChatSDK, chatConfig: ChatConfig | undefined, getAuthToken: ((authClientFunction?: string, options?: {
|
|
10
|
+
isMidAuthEnabled: boolean;
|
|
11
|
+
}) => Promise<string | null>) | undefined) => Promise<{
|
|
5
12
|
result: boolean;
|
|
6
13
|
token: string | null;
|
|
7
14
|
error?: undefined;
|
|
@@ -15,4 +22,4 @@ declare const handleAuthentication: (chatSDK: OmnichannelChatSDK, chatConfig: Ch
|
|
|
15
22
|
};
|
|
16
23
|
}>;
|
|
17
24
|
declare const removeAuthTokenProvider: (chatSDK: any) => void;
|
|
18
|
-
export { getAuthClientFunction, handleAuthentication, removeAuthTokenProvider };
|
|
25
|
+
export { getAuthClientFunction, handleAuthentication, removeAuthTokenProvider, isMidAuthEnabled };
|
|
@@ -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;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
export interface IBotAuthConfig {
|
|
2
2
|
fetchBotAuthConfigRetries?: number;
|
|
3
3
|
fetchBotAuthConfigRetryInterval?: number;
|
|
4
|
+
/**
|
|
5
|
+
* Fallback value to determine whether to show the sign-in card when the bot auth config fetch fails after all retries.
|
|
6
|
+
* - `true`: Show the sign-in card to the user
|
|
7
|
+
* - `false`: Hide the sign-in card
|
|
8
|
+
* - `undefined`: Throw an error if the fetch fails (default behavior)
|
|
9
|
+
*/
|
|
10
|
+
fallbackShowSignInCard?: boolean;
|
|
4
11
|
}
|
|
@@ -3,7 +3,7 @@ export interface ExtendedChatConfig {
|
|
|
3
3
|
LiveChatConfigAuthSettings?: LiveChatConfigAuthSettings;
|
|
4
4
|
LiveWSAndLiveChatEngJoin?: {
|
|
5
5
|
msdyn_conversationmode?: string;
|
|
6
|
-
msdyn_enablepersistentchatpreviousconversations?:
|
|
6
|
+
msdyn_enablepersistentchatpreviousconversations?: string;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
interface LcwFcbConfiguration {
|
|
@@ -52,7 +52,9 @@ declare class LazyLoadHandler {
|
|
|
52
52
|
static initialized: boolean;
|
|
53
53
|
static paused: boolean;
|
|
54
54
|
static observer: IntersectionObserver | null;
|
|
55
|
-
|
|
55
|
+
static preLoadScrollHeight: number;
|
|
56
|
+
private static preLoadScrollTop;
|
|
57
|
+
static initialLoadComplete: boolean;
|
|
56
58
|
static pendingScrollAction: boolean;
|
|
57
59
|
private static retryTimeouts;
|
|
58
60
|
static resetPending: boolean;
|
|
@@ -151,40 +153,21 @@ declare class LazyLoadHandler {
|
|
|
151
153
|
* It coordinates the entire lazy loading process:
|
|
152
154
|
*
|
|
153
155
|
* 1. Sets flags to prevent concurrent operations
|
|
154
|
-
* 2.
|
|
155
|
-
* 3.
|
|
156
|
-
* 4. Executes scroll adjustment to maintain user position
|
|
156
|
+
* 2. Captures scroll state BEFORE content loads (for height-delta anchoring)
|
|
157
|
+
* 3. Dispatches event to fetch more chat history
|
|
157
158
|
*
|
|
158
|
-
*
|
|
159
|
+
* Scroll anchoring is triggered by HISTORY_BATCH_LOADED event (not a blind timeout).
|
|
159
160
|
*/
|
|
160
161
|
private static handleLazyLoadTrigger;
|
|
161
162
|
/**
|
|
162
|
-
*
|
|
163
|
+
* Applies height-delta scroll anchoring after new history content is prepended.
|
|
163
164
|
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* 4. Initiates the scroll attempt process
|
|
169
|
-
*
|
|
170
|
-
* If no suitable container is found, schedules a retry.
|
|
165
|
+
* When content is added above the viewport, the browser keeps scrollTop constant
|
|
166
|
+
* but the content shifts down — making the viewport drift upward.
|
|
167
|
+
* Fix: scrollTop = savedScrollTop + (newScrollHeight - savedScrollHeight)
|
|
168
|
+
* This keeps the user looking at the same content they had before.
|
|
171
169
|
*/
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Attempts to perform scroll with verification and retry logic
|
|
175
|
-
*
|
|
176
|
-
* This method implements a sophisticated scroll system:
|
|
177
|
-
*
|
|
178
|
-
* 1. Uses requestAnimationFrame for smooth execution
|
|
179
|
-
* 2. Performs the scroll operation
|
|
180
|
-
* 3. Verifies scroll actually occurred (5px tolerance)
|
|
181
|
-
* 4. Retries with exponential backoff if failed
|
|
182
|
-
* 5. Continues operation after max attempts
|
|
183
|
-
*
|
|
184
|
-
* The two-frame approach ensures scroll is applied and then verified
|
|
185
|
-
* after the browser has had time to process the scroll change.
|
|
186
|
-
*/
|
|
187
|
-
private static attemptScroll;
|
|
170
|
+
static applyScrollAnchor(): void;
|
|
188
171
|
/**
|
|
189
172
|
* Finishes scroll action and prepares for next cycle
|
|
190
173
|
*
|
|
@@ -192,21 +175,14 @@ declare class LazyLoadHandler {
|
|
|
192
175
|
* Uses delays to allow content stabilization before re-enabling
|
|
193
176
|
* the intersection observer for the next lazy load cycle.
|
|
194
177
|
*/
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Schedules retry for failed scroll operations
|
|
198
|
-
*
|
|
199
|
-
* Used when scroll container is not available or scrollable.
|
|
200
|
-
* Provides a longer delay to allow container to become ready.
|
|
201
|
-
*/
|
|
202
|
-
private static scheduleScrollRetry;
|
|
178
|
+
static finishScrollAction(): void;
|
|
203
179
|
/**
|
|
204
180
|
* Schedules observer reset for next lazy load cycle
|
|
205
181
|
*
|
|
206
182
|
* After a lazy load operation completes, the observer needs to be reset
|
|
207
183
|
* to detect the next time the user scrolls to the top.
|
|
208
184
|
*/
|
|
209
|
-
|
|
185
|
+
static scheduleReset(): void;
|
|
210
186
|
/**
|
|
211
187
|
* Finds the appropriate scroll container using multiple strategies
|
|
212
188
|
*
|
|
@@ -52,6 +52,7 @@ export interface ILiveChatWidgetContext {
|
|
|
52
52
|
postChatParticipantType: undefined | ParticipantType;
|
|
53
53
|
isConversationalSurvey: boolean;
|
|
54
54
|
isConversationalSurveyEnabled: boolean;
|
|
55
|
+
isUserAuthenticated: boolean;
|
|
55
56
|
};
|
|
56
57
|
uiStates: {
|
|
57
58
|
showConfirmationPane: boolean;
|
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.cd79f08",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"@typescript-eslint/parser": "^5.2.0",
|
|
48
48
|
"babel-jest": "^27.3.1",
|
|
49
49
|
"babel-loader": "^8.2.3",
|
|
50
|
+
"babel-plugin-react-native-web": "^0.21.2",
|
|
50
51
|
"botframework-directlinejs": "^0.15.0",
|
|
51
52
|
"concurrently": "^9.1.2",
|
|
52
53
|
"copyfiles": "^2.4.1",
|
|
@@ -64,14 +65,17 @@
|
|
|
64
65
|
"jest": "^27.3.1",
|
|
65
66
|
"jest-dom": "^4.0.0",
|
|
66
67
|
"jest-image-snapshot": "^4.5.1",
|
|
68
|
+
"jest-transform-stub": "^2.0.0",
|
|
67
69
|
"json": "^11.0.0",
|
|
68
70
|
"lint-staged": "^16.0.0",
|
|
71
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
69
72
|
"p-defer": "^4.0.1",
|
|
70
73
|
"playwright": "^1.20.0",
|
|
71
74
|
"postcss": "^8.3.9",
|
|
72
75
|
"react": "^18.3.1",
|
|
73
76
|
"react-docgen-typescript-plugin": "^1.0.8",
|
|
74
77
|
"react-dom": "^18.3.1",
|
|
78
|
+
"react-native-web": "^0.21.2",
|
|
75
79
|
"react-test-renderer": "^18.3.1",
|
|
76
80
|
"rimraf": "^6.0.1",
|
|
77
81
|
"storybook-addon-playwright": "^4.9.2",
|
|
@@ -86,11 +90,12 @@
|
|
|
86
90
|
"dependencies": {
|
|
87
91
|
"@azure/core-tracing": "^1.2.0",
|
|
88
92
|
"@microsoft/applicationinsights-web": "^3.3.6",
|
|
89
|
-
"@microsoft/omnichannel-chat-components": "1.1.
|
|
90
|
-
"@microsoft/omnichannel-chat-sdk": "
|
|
93
|
+
"@microsoft/omnichannel-chat-components": "1.1.17-main.940d996",
|
|
94
|
+
"@microsoft/omnichannel-chat-sdk": "1.11.9-main.39f9d5b",
|
|
91
95
|
"@opentelemetry/api": "^1.9.0",
|
|
92
96
|
"abort-controller": "^3",
|
|
93
97
|
"abort-controller-es5": "^2.0.1",
|
|
98
|
+
"botframework-webchat": "4.18.1-hotfix.20260308.b15b405",
|
|
94
99
|
"core-js-pure": "^3.42.0",
|
|
95
100
|
"dompurify": "^3.2.4",
|
|
96
101
|
"markdown-it": "^12.3.2",
|
|
@@ -106,9 +111,9 @@
|
|
|
106
111
|
"scripts": {
|
|
107
112
|
"storybook": "start-storybook -p 6006",
|
|
108
113
|
"compose-storybook": "start-storybook -c stories/.storybook -p 9009",
|
|
109
|
-
"build-composite-storybook": "build-storybook -c stories/.storybook -o storybook-build",
|
|
114
|
+
"build-composite-storybook": "cross-env NODE_OPTIONS=--openssl-legacy-provider build-storybook -c stories/.storybook -o storybook-build",
|
|
110
115
|
"build-storybook": "cross-env NODE_OPTIONS=--openssl-legacy-provider build-storybook",
|
|
111
|
-
"build": "yarn clean yarn lint && yarn build:esm && yarn build:cjs && tsc",
|
|
116
|
+
"build": "yarn clean && yarn lint && yarn build:esm && yarn build:cjs && tsc",
|
|
112
117
|
"test:unit": "jest -c jest.config.unit.cjs --env=jsdom --runInBand --force-exit",
|
|
113
118
|
"test:e2e": "cd automation_tests && yarn test",
|
|
114
119
|
"test:e2e:build": "yarn build-sample && cd automation_tests && yarn test",
|
|
@@ -145,7 +150,11 @@
|
|
|
145
150
|
"**/minimist": "1.2.6",
|
|
146
151
|
"**/sanitize-html": "2.14.0",
|
|
147
152
|
"@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0",
|
|
148
|
-
"**/semver": "7.5.4"
|
|
153
|
+
"**/semver": "7.5.4",
|
|
154
|
+
"**/lodash": "4.17.23",
|
|
155
|
+
"**/@babel/runtime-corejs3": "^7.29.0",
|
|
156
|
+
"**/brace-expansion": "2.0.2",
|
|
157
|
+
"**/swiper": "9.4.1"
|
|
149
158
|
},
|
|
150
159
|
"jest": {
|
|
151
160
|
"verbose": true,
|