@microsoft/omnichannel-chat-widget 0.1.0-main.c881067 → 0.1.0-main.c91fa67
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 +2 -0
- package/lib/cjs/common/storage/default/defaultCacheManager.js +2 -2
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +7 -3
- package/lib/cjs/common/telemetry/TelemetryConstants.js +5 -0
- package/lib/cjs/components/headerstateful/HeaderStateful.js +1 -1
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +6 -3
- package/lib/cjs/components/livechatwidget/common/endChat.js +23 -17
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +25 -13
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +3 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +53 -51
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +35 -29
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +8 -1
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
- package/lib/cjs/hooks/useDebounce.js +28 -0
- package/lib/cjs/hooks/useWindowDimensions.js +30 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +11 -1
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/storage/default/defaultCacheManager.js +2 -2
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +7 -3
- package/lib/esm/common/telemetry/TelemetryConstants.js +5 -0
- package/lib/esm/components/headerstateful/HeaderStateful.js +1 -1
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +6 -3
- package/lib/esm/components/livechatwidget/common/endChat.js +23 -17
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +25 -13
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +3 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +53 -51
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +36 -30
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +8 -1
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
- package/lib/esm/hooks/useDebounce.js +22 -0
- package/lib/esm/hooks/useWindowDimensions.js +23 -0
- package/lib/esm/plugins/newMessageEventHandler.js +11 -1
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/storage/default/defaultCacheManager.d.ts +1 -1
- package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +6 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +2 -3
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -0
- package/lib/types/hooks/useDebounce.d.ts +3 -0
- package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
- package/package.json +3 -3
|
@@ -9,6 +9,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
9
9
|
const isHistoryMessage = isActivityMessage && ((activity === null || activity === void 0 ? void 0 : (_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.historyMessageTag)) || (activity === null || activity === void 0 ? void 0 : (_activity$channelData3 = activity.channelData) === null || _activity$channelData3 === void 0 ? void 0 : _activity$channelData3.fromList));
|
|
10
10
|
raiseMessageEvent(activity, isHistoryMessage);
|
|
11
11
|
};
|
|
12
|
+
let isHistoryMessageReceivedEventRasied = false;
|
|
12
13
|
const raiseMessageEvent = (activity, isHistoryMessage) => {
|
|
13
14
|
if ((activity === null || activity === void 0 ? void 0 : activity.type) === Constants.message) {
|
|
14
15
|
var _text, _text2, _activity$channelData4, _activity$from;
|
|
@@ -40,7 +41,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
40
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
42
|
payload.messageType = Constants.systemMessageTag;
|
|
42
43
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
43
|
-
Event: TelemetryEvent.
|
|
44
|
+
Event: TelemetryEvent.SystemMessageReceived,
|
|
44
45
|
Description: "System message received"
|
|
45
46
|
});
|
|
46
47
|
} else {
|
|
@@ -67,6 +68,15 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
|
|
|
67
68
|
Description: "New message received",
|
|
68
69
|
Data: payload
|
|
69
70
|
});
|
|
71
|
+
} else {
|
|
72
|
+
if (!isHistoryMessageReceivedEventRasied) {
|
|
73
|
+
isHistoryMessageReceivedEventRasied = true;
|
|
74
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
75
|
+
Event: TelemetryEvent.HistoryMessageReceived,
|
|
76
|
+
Description: "History message received",
|
|
77
|
+
Data: payload
|
|
78
|
+
});
|
|
79
|
+
}
|
|
70
80
|
}
|
|
71
81
|
}
|
|
72
82
|
}
|
|
@@ -78,6 +78,7 @@ export declare class Constants {
|
|
|
78
78
|
static readonly ChatWidgetStateChangedPrefix = "ChatWidgetStateChanged";
|
|
79
79
|
static readonly PostChatLoadingDurationInMs = 2000;
|
|
80
80
|
static readonly BrowserUnloadConfirmationMessage = "Do you want to leave chat?";
|
|
81
|
+
static readonly CacheTtlInMinutes = 15;
|
|
81
82
|
}
|
|
82
83
|
export declare const Regex: {
|
|
83
84
|
new (): {};
|
|
@@ -125,6 +126,7 @@ export declare class HtmlAttributeNames {
|
|
|
125
126
|
static readonly adaptiveCardClassName = "ac-adaptiveCard";
|
|
126
127
|
static readonly adaptiveCardTextBlockClassName = "ac-textBlock";
|
|
127
128
|
static readonly adaptiveCardToggleInputClassName = "ac-toggleInput";
|
|
129
|
+
static readonly adaptiveCardActionSetClassName = "ac-actionSet";
|
|
128
130
|
}
|
|
129
131
|
export declare class WebChatMiddlewareConstants {
|
|
130
132
|
static readonly nextVisibleActivity = "nextVisibleActivity";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare class defaultCacheManager {
|
|
2
2
|
static InternalCache: any;
|
|
3
3
|
}
|
|
4
|
-
export declare const registerBroadcastServiceForLocalStorage: (orgid: string, widgetId: string, widgetInstanceId: string) => void;
|
|
4
|
+
export declare const registerBroadcastServiceForLocalStorage: (orgid: string, widgetId: string, widgetInstanceId: string, ttlInMins: number) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IContextDataStore } from "../../interfaces/IContextDataStore";
|
|
2
|
-
export declare const defaultClientDataStoreProvider: () => IContextDataStore;
|
|
2
|
+
export declare const defaultClientDataStoreProvider: (cacheTtlinMins?: number) => IContextDataStore;
|
|
@@ -42,7 +42,9 @@ export declare enum BroadcastEvent {
|
|
|
42
42
|
CloseChat = "CloseChat",
|
|
43
43
|
InitiateEndChatOnBrowserUnload = "InitiateEndChatOnBrowserUnload",
|
|
44
44
|
ClosePopoutWindow = "ClosePopoutWindow",
|
|
45
|
-
RaiseErrorEvent = "RaiseErrorEvent"
|
|
45
|
+
RaiseErrorEvent = "RaiseErrorEvent",
|
|
46
|
+
NetworkDisconnected = "NetworkDisconnected",
|
|
47
|
+
NetworkReconnected = "NetworkReconnected"
|
|
46
48
|
}
|
|
47
49
|
export declare enum TelemetryEvent {
|
|
48
50
|
CallAdded = "CallAdded",
|
|
@@ -102,6 +104,7 @@ export declare enum TelemetryEvent {
|
|
|
102
104
|
DownloadTranscriptResponseNullOrUndefined = "DownloadTranscriptResponseNullOrUndefined",
|
|
103
105
|
EmailTranscriptSent = "EmailTranscriptSent",
|
|
104
106
|
EmailTranscriptFailed = "EmailTranscriptFailed",
|
|
107
|
+
ErrorUIPaneLoaded = "ErrorUIPaneLoaded",
|
|
105
108
|
DownloadTranscriptFailed = "DownloadTranscriptFailed",
|
|
106
109
|
StartChatFailed = "StartChatFailed",
|
|
107
110
|
IC3ThreadUpdateEventReceived = "IC3ThreadUpdateEventReceived",
|
|
@@ -157,6 +160,8 @@ export declare enum TelemetryEvent {
|
|
|
157
160
|
ReconnectChatMinimize = "ReconnectChatMinimize",
|
|
158
161
|
MessageSent = "MessageSent",
|
|
159
162
|
MessageReceived = "MessageReceived",
|
|
163
|
+
SystemMessageReceived = "SystemMessageReceived",
|
|
164
|
+
HistoryMessageReceived = "HistoryMessageReceived",
|
|
160
165
|
CustomContextReceived = "CustomContextReceived",
|
|
161
166
|
NetworkDisconnected = "NetworkDisconnected",
|
|
162
167
|
NetworkReconnected = "NetworkReconnected"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import ChatConfig from "@microsoft/omnichannel-chat-sdk/lib/core/ChatConfig";
|
|
2
1
|
import { Dispatch } from "react";
|
|
3
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
4
3
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
@@ -6,6 +5,6 @@ import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
|
6
5
|
import StartChatOptionalParams from "@microsoft/omnichannel-chat-sdk/lib/core/StartChatOptionalParams";
|
|
7
6
|
declare const prepareStartChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any) => Promise<void>;
|
|
8
7
|
declare const setPreChatAndInitiateChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, isProactiveChat?: boolean | undefined, proactiveChatEnablePrechatState?: boolean | undefined, state?: ILiveChatWidgetContext | undefined, props?: ILiveChatWidgetProps | undefined) => Promise<void>;
|
|
9
|
-
declare const initStartChat: (chatSDK: any,
|
|
10
|
-
declare const checkIfConversationStillValid: (chatSDK: any, props:
|
|
8
|
+
declare const initStartChat: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, props?: ILiveChatWidgetProps | undefined, params?: StartChatOptionalParams | undefined, persistedState?: any) => Promise<void>;
|
|
9
|
+
declare const checkIfConversationStillValid: (chatSDK: any, props: ILiveChatWidgetProps, requestId: any, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<boolean>;
|
|
11
10
|
export { prepareStartChat, initStartChat, setPreChatAndInitiateChat, checkIfConversationStillValid };
|
|
@@ -4,6 +4,7 @@ export interface ILiveChatWidgetControlProps {
|
|
|
4
4
|
hideCallingContainer?: boolean;
|
|
5
5
|
hideChatButton?: boolean;
|
|
6
6
|
hideConfirmationPane?: boolean;
|
|
7
|
+
hideErrorUIPane?: boolean;
|
|
7
8
|
hideFooter?: boolean;
|
|
8
9
|
hideHeader?: boolean;
|
|
9
10
|
hideLoadingPane?: boolean;
|
|
@@ -15,4 +16,5 @@ export interface ILiveChatWidgetControlProps {
|
|
|
15
16
|
hideWebChatContainer?: boolean;
|
|
16
17
|
hideStartChatButton?: boolean;
|
|
17
18
|
widgetInstanceId?: string | undefined;
|
|
19
|
+
cacheTtlInMins?: number;
|
|
18
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "0.1.0-main.
|
|
3
|
+
"version": "0.1.0-main.c91fa67",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@fluentui/react": "^8.49.1",
|
|
77
|
-
"@microsoft/omnichannel-chat-components": "0.1.0-main.
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "1.2.1-main.
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "0.1.0-main.f4c21f0",
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "1.2.1-main.cb2cd37",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|