@microsoft/omnichannel-chat-widget 1.8.3 → 1.8.4-main.424a580
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 +5 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
- package/lib/cjs/common/telemetry/AppInsightsEvents.js +4 -5
- package/lib/cjs/common/telemetry/TelemetryConstants.js +44 -2
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +26 -10
- package/lib/cjs/common/utils/SecureEventBus.js +307 -0
- package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +8 -2
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +127 -0
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +15 -0
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +287 -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 +7 -1
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +5 -1
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +24 -4
- package/lib/cjs/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +22 -3
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +29 -2
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -3
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +36 -5
- 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 +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +59 -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 +47 -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 +50 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +20 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +59 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/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/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/cjs/plugins/newMessageEventHandler.js +4 -1
- package/lib/esm/common/Constants.js +5 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +4 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +42 -1
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +27 -11
- package/lib/esm/common/utils/SecureEventBus.js +328 -0
- package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -5
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +9 -3
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +120 -0
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +8 -0
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +280 -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 +7 -1
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +7 -3
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +23 -4
- package/lib/esm/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +23 -4
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +31 -4
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -4
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +39 -5
- 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 +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +51 -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 +39 -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 +48 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +52 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +3 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/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/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/esm/plugins/newMessageEventHandler.js +4 -1
- package/lib/types/common/Constants.d.ts +4 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +39 -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/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/startChatErrorHandler.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +12 -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/hooks/usePersistentChatHistory.d.ts +4 -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/activityMiddleware.d.ts +2 -1
- 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/localizedStringsBotInitialsMiddleware.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +6 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +3 -3
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SecureEventBus class implementing the singleton pattern for secure event communication.
|
|
3
|
+
* Provides authentication-based event dispatching to prevent unauthorized external access.
|
|
4
|
+
*/
|
|
5
|
+
declare class SecureEventBus {
|
|
6
|
+
private static instance;
|
|
7
|
+
private listeners;
|
|
8
|
+
private readonly authToken;
|
|
9
|
+
private eventCounter;
|
|
10
|
+
/**
|
|
11
|
+
* Private constructor to enforce singleton pattern.
|
|
12
|
+
* Generates a unique authentication token for this session.
|
|
13
|
+
*/
|
|
14
|
+
private constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Get the singleton instance of SecureEventBus.
|
|
17
|
+
* Creates a new instance if one doesn't exist.
|
|
18
|
+
*
|
|
19
|
+
* @returns The singleton instance of SecureEventBus
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const eventBus = SecureEventBus.getInstance();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
static getInstance(): SecureEventBus;
|
|
27
|
+
/**
|
|
28
|
+
* Generate a cryptographically secure authentication token.
|
|
29
|
+
* Uses crypto.getRandomValues when available, falls back to Math.random.
|
|
30
|
+
*
|
|
31
|
+
* @private
|
|
32
|
+
* @returns A 64-character hexadecimal string representing the authentication token
|
|
33
|
+
*/
|
|
34
|
+
private generateAuthToken;
|
|
35
|
+
/**
|
|
36
|
+
* Get the authentication token for this SecureEventBus instance.
|
|
37
|
+
* This token is required for dispatching events and should only be used internally.
|
|
38
|
+
*
|
|
39
|
+
* @returns The authentication token string
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const eventBus = SecureEventBus.getInstance();
|
|
44
|
+
* const token = eventBus.getAuthToken();
|
|
45
|
+
* eventBus.dispatch('myEvent', { data: 'value' }, token);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
getAuthToken(): string;
|
|
49
|
+
/**
|
|
50
|
+
* Dispatch an event with authentication to all registered listeners.
|
|
51
|
+
* Verifies the authentication token before dispatching to prevent unauthorized access.
|
|
52
|
+
*
|
|
53
|
+
* @param eventName - The name of the event to dispatch
|
|
54
|
+
* @param payload - The data to send with the event (optional)
|
|
55
|
+
* @param token - Authentication token (must match the internal token)
|
|
56
|
+
* @returns true if event was successfully dispatched, false if unauthorized or error occurred
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const eventBus = SecureEventBus.getInstance();
|
|
61
|
+
* const token = eventBus.getAuthToken();
|
|
62
|
+
*
|
|
63
|
+
* // Dispatch with payload
|
|
64
|
+
* const success = eventBus.dispatch('userAction', { action: 'click', target: 'button' }, token);
|
|
65
|
+
*
|
|
66
|
+
* // Dispatch without payload
|
|
67
|
+
* eventBus.dispatch('windowClosed', undefined, token);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
dispatch(eventName: string, payload?: any, token?: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Subscribe to an event with a callback function.
|
|
73
|
+
* The callback will be executed whenever the specified event is dispatched.
|
|
74
|
+
*
|
|
75
|
+
* @param eventName - The name of the event to listen for
|
|
76
|
+
* @param callback - The function to execute when the event is fired
|
|
77
|
+
* @returns A function that can be called to unsubscribe from the event
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const eventBus = SecureEventBus.getInstance();
|
|
82
|
+
*
|
|
83
|
+
* // Subscribe to an event
|
|
84
|
+
* const unsubscribe = eventBus.subscribe('chatMessage', (message) => {
|
|
85
|
+
* console.log('New message:', message.text);
|
|
86
|
+
* console.log('From user:', message.userId);
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* // Later, unsubscribe
|
|
90
|
+
* unsubscribe();
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
subscribe(eventName: string, callback: (payload: any) => void): () => void;
|
|
94
|
+
/**
|
|
95
|
+
* Remove all listeners for a specific event.
|
|
96
|
+
* This completely removes the event from the internal listeners map.
|
|
97
|
+
*
|
|
98
|
+
* @param eventName - The name of the event to remove all listeners for
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* const eventBus = SecureEventBus.getInstance();
|
|
103
|
+
*
|
|
104
|
+
* // Remove all listeners for 'chatClosed' event
|
|
105
|
+
* eventBus.removeAllListeners('chatClosed');
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
removeAllListeners(eventName: string): void;
|
|
109
|
+
/**
|
|
110
|
+
* Clear all listeners for all events.
|
|
111
|
+
* This resets the entire event bus to its initial state.
|
|
112
|
+
* Useful for cleanup during application shutdown or testing.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* const eventBus = SecureEventBus.getInstance();
|
|
117
|
+
*
|
|
118
|
+
* // Clear all event listeners
|
|
119
|
+
* eventBus.clear();
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
clear(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Get the number of listeners for a specific event.
|
|
125
|
+
* Useful for debugging and monitoring purposes.
|
|
126
|
+
*
|
|
127
|
+
* @param eventName - The name of the event to count listeners for
|
|
128
|
+
* @returns The number of listeners registered for the event
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* const eventBus = SecureEventBus.getInstance();
|
|
133
|
+
*
|
|
134
|
+
* // Check how many listeners are registered for 'userAction'
|
|
135
|
+
* const count = eventBus.getListenerCount('userAction');
|
|
136
|
+
* console.log(`${count} listeners registered for userAction`);
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
getListenerCount(eventName: string): number;
|
|
140
|
+
/**
|
|
141
|
+
* Get all registered event names.
|
|
142
|
+
* Returns an array of event names that currently have listeners.
|
|
143
|
+
* Useful for debugging and monitoring purposes.
|
|
144
|
+
*
|
|
145
|
+
* @returns An array of event names that have registered listeners
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const eventBus = SecureEventBus.getInstance();
|
|
150
|
+
*
|
|
151
|
+
* // Get all registered events
|
|
152
|
+
* const events = eventBus.getRegisteredEvents();
|
|
153
|
+
* console.log('Active events:', events);
|
|
154
|
+
* // Output: ['userAction', 'chatMessage', 'windowResize']
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
getRegisteredEvents(): string[];
|
|
158
|
+
}
|
|
159
|
+
export default SecureEventBus;
|
package/lib/types/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IActivitySubscriber } from "./IActivitySubscriber";
|
|
2
|
+
/**
|
|
3
|
+
* The `AddActivitySubscriber` class is responsible for subscribing to the `ADD_ACTIVITY` event
|
|
4
|
+
* from the `ChatWidgetEvents` and notifying an observer when a new activity is added.
|
|
5
|
+
*
|
|
6
|
+
* This class implements the `IActivitySubscriber` interface and acts as a bridge between
|
|
7
|
+
* the event system and the observer pattern.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AddActivitySubscriber implements IActivitySubscriber {
|
|
10
|
+
/**
|
|
11
|
+
* The observer that will be notified when a new activity is added.
|
|
12
|
+
* This is expected to be an object with a `next` method, such as an RxJS `Observer`.
|
|
13
|
+
*/
|
|
14
|
+
observer: any;
|
|
15
|
+
/**
|
|
16
|
+
* Set to track processed activity IDs to prevent duplicate processing.
|
|
17
|
+
*/
|
|
18
|
+
private processedActivityIds;
|
|
19
|
+
/**
|
|
20
|
+
* Unsubscribe function for the secure event listener
|
|
21
|
+
*/
|
|
22
|
+
private unsubscribeFromSecureEvent;
|
|
23
|
+
/**
|
|
24
|
+
* Subscription for PersistentConversationReset event
|
|
25
|
+
*/
|
|
26
|
+
private resetEventListener;
|
|
27
|
+
/**
|
|
28
|
+
* Constructor initializes the `AddActivitySubscriber` and sets up a secure event listener
|
|
29
|
+
* for the `ChatWidgetEvents.ADD_ACTIVITY` event. When the event is triggered, it checks
|
|
30
|
+
* if the event payload contains an `activity` and notifies the observer.
|
|
31
|
+
*/
|
|
32
|
+
constructor();
|
|
33
|
+
/**
|
|
34
|
+
* The `next` method is a placeholder for processing the activity.
|
|
35
|
+
* This method can be overridden or extended as needed.
|
|
36
|
+
*
|
|
37
|
+
* @param activity - The activity object to process.
|
|
38
|
+
* @returns The activity object (asynchronously).
|
|
39
|
+
*/
|
|
40
|
+
next(activity: any): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Reset the processed activity IDs when a conversation resets
|
|
43
|
+
*/
|
|
44
|
+
reset(): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare enum ChatWidgetEvents {
|
|
2
|
+
ADD_ACTIVITY = "CHAT_WIDGET/ADD_ACTIVITY",
|
|
3
|
+
FETCH_PERSISTENT_CHAT_HISTORY = "CHAT_WIDGET/FETCH_PERSISTENT_CHAT_HISTORY",
|
|
4
|
+
NO_MORE_HISTORY_AVAILABLE = "CHAT_WIDGET/NO_MORE_HISTORY_AVAILABLE",
|
|
5
|
+
HIDE_LOADING_BANNER = "CHAT_WIDGET/HIDE_LOADING_BANNER"
|
|
6
|
+
}
|
|
7
|
+
export default ChatWidgetEvents;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
|
|
2
|
+
import { IPersistentChatHistoryProps } from "../interfaces/IPersistentChatHistoryProps";
|
|
3
|
+
/**
|
|
4
|
+
* Class responsible for handling persistent conversation history
|
|
5
|
+
*/
|
|
6
|
+
declare class PersistentConversationHandler {
|
|
7
|
+
private appliedProps;
|
|
8
|
+
private isLastPull;
|
|
9
|
+
private pageToken;
|
|
10
|
+
private facadeChatSDK;
|
|
11
|
+
private lastMessage;
|
|
12
|
+
private count;
|
|
13
|
+
private pageSize;
|
|
14
|
+
private isCurrentlyPulling;
|
|
15
|
+
private pageTokenInTransitSet;
|
|
16
|
+
constructor(facadeChatSDK: FacadeChatSDK, props: IPersistentChatHistoryProps);
|
|
17
|
+
private appliedPropsHandler;
|
|
18
|
+
private resetEventListener;
|
|
19
|
+
reset(): void;
|
|
20
|
+
destroy(): void;
|
|
21
|
+
pullHistory(): Promise<void>;
|
|
22
|
+
private processHistoryMessages;
|
|
23
|
+
private fetchHistoryMessages;
|
|
24
|
+
private shouldPull;
|
|
25
|
+
private processMessageToActivity;
|
|
26
|
+
private createDividerActivity;
|
|
27
|
+
}
|
|
28
|
+
export default PersistentConversationHandler;
|
|
@@ -4,4 +4,5 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
5
|
export declare const handleStartChatError: (dispatch: Dispatch<ILiveChatWidgetAction>, facadeChatSDK: FacadeChatSDK, props: ILiveChatWidgetProps | undefined, ex: any, isStartChatSuccessful: boolean) => void;
|
|
6
6
|
export declare const logWidgetLoadComplete: (additionalMessage?: string) => void;
|
|
7
|
+
export declare const logStartChatComplete: (additionalMessage?: string) => void;
|
|
7
8
|
export declare const logWidgetLoadWithUnexpectedError: (ex: any) => void;
|
|
@@ -20,6 +20,7 @@ import { ILoadingPaneProps } from "@microsoft/omnichannel-chat-components/lib/ty
|
|
|
20
20
|
import { IMockProps } from "./IMockProps";
|
|
21
21
|
import { INotificationPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/notificationpane/interfaces/INotificationPaneProps";
|
|
22
22
|
import { IOOOHPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/outofofficehourspane/interfaces/IOOOHPaneProps";
|
|
23
|
+
import { IPersistentChatHistoryProps } from "./IPersistentChatHistoryProps";
|
|
23
24
|
import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps";
|
|
24
25
|
import { IPreChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneProps";
|
|
25
26
|
import { IProactiveChatPaneStatefulProps } from "../../proactivechatpanestateful/interfaces/IProactiveChatPaneStatefulProps";
|
|
@@ -69,4 +70,5 @@ export interface ILiveChatWidgetProps {
|
|
|
69
70
|
mock?: IMockProps;
|
|
70
71
|
featureConfigProps?: IFeatureConfigProps;
|
|
71
72
|
appInsightsConfig?: IAppInsightsConfig;
|
|
73
|
+
persistentChatHistoryProps?: IPersistentChatHistoryProps;
|
|
72
74
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IStyle } from "@fluentui/react";
|
|
2
|
+
export interface IPersistentChatHistoryProps {
|
|
3
|
+
persistentChatHistoryEnabled?: boolean;
|
|
4
|
+
pageSize?: number;
|
|
5
|
+
dividerActivityStyle?: IStyle;
|
|
6
|
+
/**
|
|
7
|
+
* Accessible label announced by screen readers for the conversation divider element.
|
|
8
|
+
* If not supplied, a default provided in defaultPersistentChatHistoryProps will be used.
|
|
9
|
+
*/
|
|
10
|
+
dividerActivityAriaLabel?: string;
|
|
11
|
+
bannerStyle?: IStyle;
|
|
12
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
|
|
2
|
+
import { IPersistentChatHistoryProps } from "../../livechatwidget/interfaces/IPersistentChatHistoryProps";
|
|
3
|
+
declare const usePersistentChatHistory: (facadeChatSDK: FacadeChatSDK | undefined, props: IPersistentChatHistoryProps) => void;
|
|
4
|
+
export default usePersistentChatHistory;
|
package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IPersistentChatHistoryProps } from "../../livechatwidget/interfaces/IPersistentChatHistoryProps";
|
|
2
|
+
/**
|
|
3
|
+
* Component to handle persistent chat history events.
|
|
4
|
+
* Uses WebChatStoreLoader instead of hooks to avoid context issues.
|
|
5
|
+
*/
|
|
6
|
+
declare const WebChatEventSubscribers: (props: IPersistentChatHistoryProps) => null;
|
|
7
|
+
export default WebChatEventSubscribers;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPersistentChatHistoryProps } from "../../../../../livechatwidget/interfaces/IPersistentChatHistoryProps";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare const ConversationDividerActivity: (props: IPersistentChatHistoryProps) => React.JSX.Element;
|
|
4
|
+
export default ConversationDividerActivity;
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LazyLoadActivity Component
|
|
3
|
+
*
|
|
4
|
+
* This component implements a sophisticated lazy loading system for chat history in the webchat widget.
|
|
5
|
+
* It uses an IntersectionObserver to detect when the user scrolls near the top of the chat container
|
|
6
|
+
* and then triggers the loading of previous chat messages.
|
|
7
|
+
*
|
|
8
|
+
* Key Features:
|
|
9
|
+
* - Intersection Observer based detection for optimal performance
|
|
10
|
+
* - Reliable scroll management with retry mechanisms
|
|
11
|
+
* - Immediate user feedback even during initialization delays
|
|
12
|
+
* - Handles edge cases like minimize/maximize widget scenarios
|
|
13
|
+
* - Memory leak prevention with proper cleanup
|
|
14
|
+
*
|
|
15
|
+
* Architecture:
|
|
16
|
+
* - LazyLoadHandler: Static class managing all lazy load logic
|
|
17
|
+
* - LazyLoadActivity: React component providing the UI and lifecycle integration for lazy loading
|
|
18
|
+
*
|
|
19
|
+
* Flow:
|
|
20
|
+
* 1. Component renders a trigger element at the top of chat history
|
|
21
|
+
* 2. IntersectionObserver watches when this element becomes visible
|
|
22
|
+
* 3. When visible, dispatches event to fetch more chat history
|
|
23
|
+
* 4. Performs controlled scroll to maintain user position
|
|
24
|
+
* 5. Resets observer for next lazy load cycle
|
|
25
|
+
*/
|
|
26
|
+
import { TelemetryEvent } from "../../../../../../common/telemetry/TelemetryConstants";
|
|
27
|
+
import React from "react";
|
|
28
|
+
import { ILiveChatWidgetProps } from "../../../../../livechatwidget/interfaces/ILiveChatWidgetProps";
|
|
29
|
+
/**
|
|
30
|
+
* LazyLoadHandler - Static class managing all lazy loading functionality
|
|
31
|
+
*
|
|
32
|
+
* This class uses a singleton pattern with static methods to ensure consistent
|
|
33
|
+
* state management across component re-renders and widget lifecycle events.
|
|
34
|
+
*
|
|
35
|
+
* State Management:
|
|
36
|
+
* - initialized: Tracks if the IntersectionObserver has been set up
|
|
37
|
+
* - paused: Temporarily disables lazy loading (during initialization/loading)
|
|
38
|
+
* - pendingScrollAction: Prevents overlapping scroll operations
|
|
39
|
+
* - isReady: Indicates when the system is fully ready for user interactions
|
|
40
|
+
* - initializationQueue: Stores user actions while system initializes
|
|
41
|
+
*
|
|
42
|
+
* Reliability Features:
|
|
43
|
+
* - Retry mechanisms with exponential backoff
|
|
44
|
+
* - Scroll verification with tolerance checking
|
|
45
|
+
* - Multiple container detection strategies
|
|
46
|
+
* - Immediate user feedback during delays
|
|
47
|
+
* - Proper memory management and cleanup
|
|
48
|
+
*/
|
|
49
|
+
declare class LazyLoadHandler {
|
|
50
|
+
static rootId: string;
|
|
51
|
+
static targetId: string;
|
|
52
|
+
static initialized: boolean;
|
|
53
|
+
static paused: boolean;
|
|
54
|
+
static observer: IntersectionObserver | null;
|
|
55
|
+
private static scrollState;
|
|
56
|
+
private static pendingScrollAction;
|
|
57
|
+
private static retryTimeouts;
|
|
58
|
+
static resetPending: boolean;
|
|
59
|
+
private static initTimer;
|
|
60
|
+
static logLifecycleEvent(event: TelemetryEvent, description: string, elapsedTime?: number): void;
|
|
61
|
+
private static resetEventListener;
|
|
62
|
+
static isReady: boolean;
|
|
63
|
+
private static initializationQueue;
|
|
64
|
+
static hasMoreHistoryAvailable: boolean;
|
|
65
|
+
static setHasMoreHistoryAvailable(value: boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* Direct reset method that can be called externally
|
|
68
|
+
* This bypasses the broadcast system for more reliable resets
|
|
69
|
+
*/
|
|
70
|
+
static directReset(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Main initialization method for the lazy loading system
|
|
73
|
+
*
|
|
74
|
+
* This method sets up the IntersectionObserver that watches for when the trigger
|
|
75
|
+
* element becomes visible, indicating the user has scrolled near the top.
|
|
76
|
+
*
|
|
77
|
+
* Process:
|
|
78
|
+
* 1. Prevents duplicate initialization
|
|
79
|
+
* 2. Sets up intersection callback to handle visibility events
|
|
80
|
+
* 3. Finds appropriate scroll container with fallback strategies
|
|
81
|
+
* 4. Configures observer with optimal settings for chat history loading
|
|
82
|
+
* 5. Waits for target element availability with exponential backoff
|
|
83
|
+
*
|
|
84
|
+
* Observer Configuration:
|
|
85
|
+
* - root: The scrollable container (webchat or fallback)
|
|
86
|
+
* - rootMargin: 20px top margin to trigger slightly before element is visible
|
|
87
|
+
* - threshold: 0.05 (5%) visibility required to trigger
|
|
88
|
+
*/
|
|
89
|
+
static useLazyLoadObserver(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Waits for the target element to be available in the DOM
|
|
92
|
+
*
|
|
93
|
+
* Uses exponential backoff to retry finding the target element.
|
|
94
|
+
* This is necessary because the target element may not be immediately
|
|
95
|
+
* available when the observer is being set up.
|
|
96
|
+
*
|
|
97
|
+
* @param callback - Function to call when target element is found
|
|
98
|
+
* @param maxAttempts - Maximum number of retry attempts (default: 10)
|
|
99
|
+
* @param attempt - Current attempt number (default: 1)
|
|
100
|
+
*/
|
|
101
|
+
private static waitForTargetElement;
|
|
102
|
+
/**
|
|
103
|
+
* Handles immediate scroll requests when system might not be ready
|
|
104
|
+
*
|
|
105
|
+
* This is crucial for handling minimize/maximize scenarios where users
|
|
106
|
+
* immediately scroll up before the observer is fully initialized.
|
|
107
|
+
*
|
|
108
|
+
* Two-Path Strategy:
|
|
109
|
+
* 1. If ready: Execute normal lazy load trigger
|
|
110
|
+
* 2. If not ready: Provide immediate feedback + queue action for later
|
|
111
|
+
*
|
|
112
|
+
* This ensures users always get visual feedback even during initialization delays.
|
|
113
|
+
*/
|
|
114
|
+
static handleImmediateScrollRequest(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Provides immediate scroll feedback during initialization
|
|
117
|
+
*
|
|
118
|
+
* When the system isn't ready but user scrolls up, this provides
|
|
119
|
+
* immediate visual feedback (20px scroll) so the user knows their
|
|
120
|
+
* action was recognized.
|
|
121
|
+
*/
|
|
122
|
+
private static executeImmediateScrollFeedback;
|
|
123
|
+
/**
|
|
124
|
+
* Forces faster initialization attempts
|
|
125
|
+
*
|
|
126
|
+
* When user interacts before system is ready, this tries to
|
|
127
|
+
* speed up the initialization process.
|
|
128
|
+
*/
|
|
129
|
+
private static expediteInitialization;
|
|
130
|
+
/**
|
|
131
|
+
* Processes all queued actions once system is ready
|
|
132
|
+
*
|
|
133
|
+
* During initialization, user actions are queued. Once the system
|
|
134
|
+
* is ready, this processes all queued actions with small delays
|
|
135
|
+
* between them to prevent overwhelming the system.
|
|
136
|
+
*/
|
|
137
|
+
private static processInitializationQueue;
|
|
138
|
+
/**
|
|
139
|
+
* Manually checks if target element is visible and triggers lazy load
|
|
140
|
+
*
|
|
141
|
+
* This is used when the intersection observer might not be ready yet
|
|
142
|
+
* but we need to check if the trigger element is already in view.
|
|
143
|
+
*
|
|
144
|
+
* Uses getBoundingClientRect() to calculate visibility manually.
|
|
145
|
+
*/
|
|
146
|
+
static checkVisibilityAndTrigger(): void;
|
|
147
|
+
/**
|
|
148
|
+
* Main lazy load trigger handler
|
|
149
|
+
*
|
|
150
|
+
* This is the core method that executes when the trigger element becomes visible.
|
|
151
|
+
* It coordinates the entire lazy loading process:
|
|
152
|
+
*
|
|
153
|
+
* 1. Sets flags to prevent concurrent operations
|
|
154
|
+
* 2. Dispatches event to fetch more chat history
|
|
155
|
+
* 3. Waits for content to load
|
|
156
|
+
* 4. Executes scroll adjustment to maintain user position
|
|
157
|
+
*
|
|
158
|
+
* Timing: Uses 300ms delay to allow content loading before scroll adjustment
|
|
159
|
+
*/
|
|
160
|
+
private static handleLazyLoadTrigger;
|
|
161
|
+
/**
|
|
162
|
+
* Executes reliable scroll with validation and retry logic
|
|
163
|
+
*
|
|
164
|
+
* This method implements a robust scroll system that:
|
|
165
|
+
* 1. Finds and validates the scroll container
|
|
166
|
+
* 2. Calculates target scroll position (current + 35px)
|
|
167
|
+
* 3. Sets up scroll state for tracking and retries
|
|
168
|
+
* 4. Initiates the scroll attempt process
|
|
169
|
+
*
|
|
170
|
+
* If no suitable container is found, schedules a retry.
|
|
171
|
+
*/
|
|
172
|
+
private static executeReliableScroll;
|
|
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;
|
|
188
|
+
/**
|
|
189
|
+
* Finishes scroll action and prepares for next cycle
|
|
190
|
+
*
|
|
191
|
+
* Cleans up scroll state and schedules the reset cycle.
|
|
192
|
+
* Uses delays to allow content stabilization before re-enabling
|
|
193
|
+
* the intersection observer for the next lazy load cycle.
|
|
194
|
+
*/
|
|
195
|
+
private static finishScrollAction;
|
|
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;
|
|
203
|
+
/**
|
|
204
|
+
* Schedules observer reset for next lazy load cycle
|
|
205
|
+
*
|
|
206
|
+
* After a lazy load operation completes, the observer needs to be reset
|
|
207
|
+
* to detect the next time the user scrolls to the top.
|
|
208
|
+
*/
|
|
209
|
+
private static scheduleReset;
|
|
210
|
+
/**
|
|
211
|
+
* Finds the appropriate scroll container using multiple strategies
|
|
212
|
+
*
|
|
213
|
+
* Container Detection Priority:
|
|
214
|
+
* 1. Primary: Specific webchat scroll container (.webchat__basic-transcript__scrollable)
|
|
215
|
+
* 2. Secondary: Widget root container (ms_lcw_webchat_root)
|
|
216
|
+
* 3. Tertiary: Any scrollable parent of the target element
|
|
217
|
+
* 4. Fallback: Best available container (even if not scrollable)
|
|
218
|
+
*
|
|
219
|
+
* Returns both the container and whether it's actually scrollable.
|
|
220
|
+
*
|
|
221
|
+
* @returns Object containing container element and scrollability status
|
|
222
|
+
*/
|
|
223
|
+
static findScrollContainer(): {
|
|
224
|
+
container: HTMLElement | null;
|
|
225
|
+
isScrollable: boolean;
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Determines if an element is scrollable
|
|
229
|
+
*
|
|
230
|
+
* Checks two conditions:
|
|
231
|
+
* 1. Content overflow: scrollHeight > clientHeight (content extends beyond visible area)
|
|
232
|
+
* 2. CSS overflow settings: overflow/overflowY set to 'auto' or 'scroll'
|
|
233
|
+
*
|
|
234
|
+
* @param element - The element to check for scrollability
|
|
235
|
+
* @returns true if element is scrollable, false otherwise
|
|
236
|
+
*/
|
|
237
|
+
private static isElementScrollable;
|
|
238
|
+
/**
|
|
239
|
+
* Traverses up the DOM tree to find a scrollable parent element
|
|
240
|
+
*
|
|
241
|
+
* Starting from the given element, walks up the parent chain
|
|
242
|
+
* until it finds a scrollable element or reaches document.body.
|
|
243
|
+
*
|
|
244
|
+
* @param element - Starting element to search from
|
|
245
|
+
* @returns Scrollable parent element or null if none found
|
|
246
|
+
*/
|
|
247
|
+
private static findScrollableParent;
|
|
248
|
+
/**
|
|
249
|
+
* Legacy method - redirects to new reliable scroll system
|
|
250
|
+
*
|
|
251
|
+
* Maintained for backwards compatibility with existing code
|
|
252
|
+
* that might call this method directly.
|
|
253
|
+
*/
|
|
254
|
+
static moveScrollDown(): void;
|
|
255
|
+
/**
|
|
256
|
+
* Legacy scroll adjustment method with enhancements
|
|
257
|
+
*
|
|
258
|
+
* Enhanced version of the original adjustScroll method:
|
|
259
|
+
* - Validates container scrollability before attempting scroll
|
|
260
|
+
* - Uses requestAnimationFrame for smooth execution
|
|
261
|
+
* - Provides logging for debugging
|
|
262
|
+
*
|
|
263
|
+
* @param scrollContainer - The container element to scroll
|
|
264
|
+
*/
|
|
265
|
+
static adjustScroll(scrollContainer: HTMLElement): void;
|
|
266
|
+
/**
|
|
267
|
+
* Handles the NO_MORE_HISTORY_AVAILABLE event
|
|
268
|
+
*
|
|
269
|
+
* Called when there's no more chat history to load.
|
|
270
|
+
* Disables further lazy loading attempts and cleans up the observer.
|
|
271
|
+
* Also removes the trigger element from the DOM to prevent further triggering.
|
|
272
|
+
*/
|
|
273
|
+
static handleNoMoreHistoryAvailable(): void;
|
|
274
|
+
/**
|
|
275
|
+
* Resets the lazy load system for the next cycle
|
|
276
|
+
*
|
|
277
|
+
* This method prepares the system for the next lazy load operation:
|
|
278
|
+
* 1. Cleans up current state
|
|
279
|
+
* 2. Resets all flags and queues
|
|
280
|
+
* 3. Reinitializes the observer with faster timing
|
|
281
|
+
*
|
|
282
|
+
* Called after each lazy load cycle completes.
|
|
283
|
+
*/
|
|
284
|
+
static reset(): void;
|
|
285
|
+
/**
|
|
286
|
+
* Comprehensive cleanup method
|
|
287
|
+
*
|
|
288
|
+
* Performs complete cleanup of all lazy load resources:
|
|
289
|
+
* - Clears all pending timeouts to prevent memory leaks
|
|
290
|
+
* - Removes intersection observer and event listeners
|
|
291
|
+
* - Resets all state variables to initial values
|
|
292
|
+
* - Clears action queue
|
|
293
|
+
*
|
|
294
|
+
* Critical for preventing memory leaks and ensuring clean component unmounting.
|
|
295
|
+
*/
|
|
296
|
+
static unmount(): void;
|
|
297
|
+
/**
|
|
298
|
+
* Complete cleanup including broadcast event listener
|
|
299
|
+
*
|
|
300
|
+
* This method is used for final cleanup when the LazyLoadActivity component is being destroyed completely.
|
|
301
|
+
* It includes unsubscribing from broadcast events and performing complete cleanup.
|
|
302
|
+
* This is different from reset() which prepares the system for a new chat session.
|
|
303
|
+
*/
|
|
304
|
+
static destroy(): void;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* LazyLoadActivity React Component
|
|
308
|
+
*
|
|
309
|
+
* This component serves as the React wrapper for the LazyLoadHandler system.
|
|
310
|
+
* It renders the trigger element and manages the component lifecycle.
|
|
311
|
+
*
|
|
312
|
+
* Component Lifecycle:
|
|
313
|
+
* 1. Mount: Initializes lazy load observer and sets up scroll listener
|
|
314
|
+
* 2. Active: Monitors user scroll behavior and responds to interactions
|
|
315
|
+
* 3. Unmount: Cleans up all resources and prevents memory leaks
|
|
316
|
+
*
|
|
317
|
+
* Key Features:
|
|
318
|
+
* - Automatic initialization on mount
|
|
319
|
+
* - Scroll event monitoring for immediate responsiveness
|
|
320
|
+
* - Proper cleanup on unmount
|
|
321
|
+
* - Handles minimize/maximize scenarios
|
|
322
|
+
* - Reactive rendering based on history availability
|
|
323
|
+
*/
|
|
324
|
+
declare const LazyLoadActivity: (props?: Partial<ILiveChatWidgetProps>) => React.JSX.Element | null;
|
|
325
|
+
export default LazyLoadActivity;
|
|
326
|
+
export { LazyLoadHandler };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ILiveChatWidgetProps } from "../../../../../livechatwidget/interfaces/ILiveChatWidgetProps";
|
|
3
|
+
declare const LoadInlineBannerActivity: ({ webChatContainerProps, persistentChatHistory, id }: {
|
|
4
|
+
webChatContainerProps?: ILiveChatWidgetProps["webChatContainerProps"];
|
|
5
|
+
persistentChatHistory?: ILiveChatWidgetProps["persistentChatHistoryProps"];
|
|
6
|
+
id: string;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default LoadInlineBannerActivity;
|