@microsoft/omnichannel-chat-widget 0.1.0-main.d4c1f9e → 0.1.0-main.d553f80
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/telemetry/TelemetryConstants.js +4 -0
- package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +12 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -10
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
- package/lib/esm/common/telemetry/TelemetryConstants.js +4 -0
- package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -10
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
- package/package.json +2 -2
|
@@ -171,6 +171,8 @@ exports.TelemetryEvent = TelemetryEvent;
|
|
|
171
171
|
TelemetryEvent["MessageSent"] = "MessageSent";
|
|
172
172
|
TelemetryEvent["MessageReceived"] = "MessageReceived";
|
|
173
173
|
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
174
|
+
TelemetryEvent["NetworkDisconnected"] = "NetworkDisconnected";
|
|
175
|
+
TelemetryEvent["NetworkReconnected"] = "NetworkReconnected";
|
|
174
176
|
})(TelemetryEvent || (exports.TelemetryEvent = TelemetryEvent = {}));
|
|
175
177
|
|
|
176
178
|
class TelemetryConstants {
|
|
@@ -217,6 +219,8 @@ class TelemetryConstants {
|
|
|
217
219
|
case TelemetryEvent.MessageReceived:
|
|
218
220
|
case TelemetryEvent.CustomContextReceived:
|
|
219
221
|
case TelemetryEvent.BrowserUnloadEventStarted:
|
|
222
|
+
case TelemetryEvent.NetworkDisconnected:
|
|
223
|
+
case TelemetryEvent.NetworkReconnected:
|
|
220
224
|
return ScenarioType.ACTIONS;
|
|
221
225
|
|
|
222
226
|
case TelemetryEvent.StartChatSDKCall:
|
|
@@ -13,6 +13,10 @@ var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcont
|
|
|
13
13
|
|
|
14
14
|
var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
15
15
|
|
|
16
|
+
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
17
|
+
|
|
18
|
+
var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
|
|
19
|
+
|
|
16
20
|
const isInternetConnected = async () => {
|
|
17
21
|
try {
|
|
18
22
|
const response = await fetch(_Constants.Constants.internetConnectionTestUrl);
|
|
@@ -28,8 +32,16 @@ const createInternetConnectionChangeHandler = async () => {
|
|
|
28
32
|
const connected = await isInternetConnected();
|
|
29
33
|
|
|
30
34
|
if (!connected) {
|
|
35
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
|
|
36
|
+
Event: _TelemetryConstants.TelemetryEvent.NetworkDisconnected
|
|
37
|
+
});
|
|
38
|
+
|
|
31
39
|
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.InternetConnection, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
|
|
32
40
|
} else {
|
|
41
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
|
|
42
|
+
Event: _TelemetryConstants.TelemetryEvent.NetworkReconnected
|
|
43
|
+
});
|
|
44
|
+
|
|
33
45
|
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.InternetConnection, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
|
|
34
46
|
}
|
|
35
47
|
}; // Checking connection status on online & offline events due to possible false positives
|
|
@@ -102,7 +102,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
102
102
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
103
103
|
|
|
104
104
|
const LiveChatWidgetStateful = props => {
|
|
105
|
-
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps14, _props$controlProps15, _props$componentOverr, _props$controlProps16, _props$componentOverr2, _props$controlProps17, _props$componentOverr3, _props$controlProps18, _props$componentOverr4, _props$controlProps19, _props$componentOverr5, _props$controlProps20, _props$componentOverr6, _props$controlProps21, _props$componentOverr7, _props$controlProps22, _props$controlProps23, _props$componentOverr8, _props$controlProps24, _props$componentOverr9, _props$controlProps25, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
105
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps14, _props$controlProps15, _props$componentOverr, _props$controlProps16, _props$componentOverr2, _props$controlProps17, _props$componentOverr3, _props$controlProps18, _props$componentOverr4, _props$controlProps19, _props$componentOverr5, _props$controlProps20, _props$componentOverr6, _props$controlProps21, _props$componentOverr7, _props$controlProps22, _props$controlProps23, _props$componentOverr8, _props$controlProps24, _props$componentOverr9, _props$controlProps25, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
106
106
|
|
|
107
107
|
const [state, dispatch] = (0, _useChatContextStore.default)(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
108
|
|
|
@@ -122,8 +122,10 @@ const LiveChatWidgetStateful = props => {
|
|
|
122
122
|
const generalStyles = {
|
|
123
123
|
root: Object.assign({}, (0, _getGeneralStylesForButton.getGeneralStylesForButton)(state), (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyles)
|
|
124
124
|
};
|
|
125
|
+
const broadcastServiceChannelName = (0, _utils.getBroadcastChannelName)(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.widgetId, ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
|
|
126
|
+
(0, _omnichannelChatComponents.BroadcastServiceInitialize)(broadcastServiceChannelName);
|
|
125
127
|
_TelemetryManager.TelemetryTimers.LcwLoadToChatButtonTimer = (0, _utils.createTimer)();
|
|
126
|
-
const widgetElementId = ((_props$
|
|
128
|
+
const widgetElementId = ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.id) || "oc-lcw";
|
|
127
129
|
const currentMessageCountRef = (0, _react2.useRef)(0);
|
|
128
130
|
let widgetStateEventName = "";
|
|
129
131
|
|
|
@@ -150,10 +152,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
150
152
|
};
|
|
151
153
|
|
|
152
154
|
(0, _react2.useEffect)(() => {
|
|
153
|
-
var
|
|
155
|
+
var _props$controlProps3, _props$controlProps4, _props$controlProps5, _props$controlProps7, _props$chatConfig, _props$chatConfig$Cha, _props$controlProps8, _props$reconnectChatP, _props$chatConfig2, _props$chatConfig2$Li, _props$reconnectChatP4;
|
|
154
156
|
|
|
155
|
-
const broadcastServiceChannelName = (0, _utils.getBroadcastChannelName)(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.widgetId, ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.widgetInstanceId) ?? "");
|
|
156
|
-
(0, _omnichannelChatComponents.BroadcastServiceInitialize)(broadcastServiceChannelName);
|
|
157
157
|
(0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
|
|
158
158
|
(0, _createInternetConnectionChangeHandler.createInternetConnectionChangeHandler)();
|
|
159
159
|
_DataStoreManager.DataStoreManager.clientDataStore = props.contextDataStore ?? undefined;
|
|
@@ -197,12 +197,30 @@ const LiveChatWidgetStateful = props => {
|
|
|
197
197
|
|
|
198
198
|
(0, _reconnectChatHelper.startUnauthenticatedReconnectChat)(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, (_props$reconnectChatP2 = props.reconnectChatPaneProps) === null || _props$reconnectChatP2 === void 0 ? void 0 : _props$reconnectChatP2.isReconnectEnabled, (_props$reconnectChatP3 = props.reconnectChatPaneProps) === null || _props$reconnectChatP3 === void 0 ? void 0 : _props$reconnectChatP3.reconnectId, _startChat.initStartChat);
|
|
199
199
|
return;
|
|
200
|
-
} //
|
|
200
|
+
} // Checks if reconnectId is present for auth chat. If it is present, then it shows reconnect chat pane,
|
|
201
|
+
// where customer can choose to continue previous conversation or start new conversation
|
|
201
202
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
202
203
|
|
|
203
204
|
|
|
204
205
|
const isAuthenticationSettingsEnabled = (_props$chatConfig2 = props.chatConfig) !== null && _props$chatConfig2 !== void 0 && (_props$chatConfig2$Li = _props$chatConfig2.LiveChatConfigAuthSettings) !== null && _props$chatConfig2$Li !== void 0 && _props$chatConfig2$Li.msdyn_javascriptclientfunction ? true : false;
|
|
205
206
|
|
|
207
|
+
if (!state.appStates.skipChatButtonRendering && state.appStates.conversationState === _ConversationState.ConversationState.Active && isAuthenticationSettingsEnabled === true && (_props$reconnectChatP4 = props.reconnectChatPaneProps) !== null && _props$reconnectChatP4 !== void 0 && _props$reconnectChatP4.isReconnectEnabled) {
|
|
208
|
+
(0, _reconnectChatHelper.getReconnectIdForAuthenticatedChat)(props, chatSDK).then(authReconnectId => {
|
|
209
|
+
if (authReconnectId && !state.appStates.reconnectId) {
|
|
210
|
+
dispatch({
|
|
211
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
212
|
+
payload: authReconnectId
|
|
213
|
+
});
|
|
214
|
+
dispatch({
|
|
215
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
216
|
+
payload: _ConversationState.ConversationState.ReconnectChat
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
return;
|
|
221
|
+
} // Check if auth settings enabled, do not connect to existing chat from cache during refresh/re-load
|
|
222
|
+
|
|
223
|
+
|
|
206
224
|
if (isAuthenticationSettingsEnabled === false) {
|
|
207
225
|
var _state$domainStates;
|
|
208
226
|
|
|
@@ -226,16 +244,16 @@ const LiveChatWidgetStateful = props => {
|
|
|
226
244
|
|
|
227
245
|
(0, _react2.useEffect)(() => {
|
|
228
246
|
if (state.appStates.skipChatButtonRendering) {
|
|
229
|
-
var _props$
|
|
247
|
+
var _props$reconnectChatP5;
|
|
230
248
|
|
|
231
249
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
232
250
|
eventName: _TelemetryConstants.BroadcastEvent.ChatInitiated
|
|
233
251
|
});
|
|
234
252
|
|
|
235
|
-
if ((_props$
|
|
236
|
-
var _props$
|
|
253
|
+
if ((_props$reconnectChatP5 = props.reconnectChatPaneProps) !== null && _props$reconnectChatP5 !== void 0 && _props$reconnectChatP5.reconnectId && !state.appStates.reconnectId) {
|
|
254
|
+
var _props$reconnectChatP6, _props$reconnectChatP7, _props$reconnectChatP8;
|
|
237
255
|
|
|
238
|
-
(0, _reconnectChatHelper.handleUnauthenticatedReconnectChat)(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, (_props$
|
|
256
|
+
(0, _reconnectChatHelper.handleUnauthenticatedReconnectChat)(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, (_props$reconnectChatP6 = props.reconnectChatPaneProps) === null || _props$reconnectChatP6 === void 0 ? void 0 : _props$reconnectChatP6.isReconnectEnabled, (_props$reconnectChatP7 = props.reconnectChatPaneProps) === null || _props$reconnectChatP7 === void 0 ? void 0 : _props$reconnectChatP7.reconnectId, _startChat.initStartChat, (_props$reconnectChatP8 = props.reconnectChatPaneProps) === null || _props$reconnectChatP8 === void 0 ? void 0 : _props$reconnectChatP8.redirectInSameWindow);
|
|
239
257
|
} else {
|
|
240
258
|
(0, _reconnectChatHelper.getReconnectIdForAuthenticatedChat)(props, chatSDK).then(authReconnectId => {
|
|
241
259
|
if (authReconnectId && !state.appStates.reconnectId) {
|
|
@@ -159,6 +159,8 @@ export let TelemetryEvent;
|
|
|
159
159
|
TelemetryEvent["MessageSent"] = "MessageSent";
|
|
160
160
|
TelemetryEvent["MessageReceived"] = "MessageReceived";
|
|
161
161
|
TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
|
|
162
|
+
TelemetryEvent["NetworkDisconnected"] = "NetworkDisconnected";
|
|
163
|
+
TelemetryEvent["NetworkReconnected"] = "NetworkReconnected";
|
|
162
164
|
})(TelemetryEvent || (TelemetryEvent = {}));
|
|
163
165
|
|
|
164
166
|
export class TelemetryConstants {
|
|
@@ -205,6 +207,8 @@ export class TelemetryConstants {
|
|
|
205
207
|
case TelemetryEvent.MessageReceived:
|
|
206
208
|
case TelemetryEvent.CustomContextReceived:
|
|
207
209
|
case TelemetryEvent.BrowserUnloadEventStarted:
|
|
210
|
+
case TelemetryEvent.NetworkDisconnected:
|
|
211
|
+
case TelemetryEvent.NetworkReconnected:
|
|
208
212
|
return ScenarioType.ACTIONS;
|
|
209
213
|
|
|
210
214
|
case TelemetryEvent.StartChatSDKCall:
|
|
@@ -2,6 +2,8 @@ import { Constants } from "../../../common/Constants";
|
|
|
2
2
|
import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
3
3
|
import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
4
4
|
import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
5
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
6
|
+
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
5
7
|
|
|
6
8
|
const isInternetConnected = async () => {
|
|
7
9
|
try {
|
|
@@ -18,8 +20,14 @@ export const createInternetConnectionChangeHandler = async () => {
|
|
|
18
20
|
const connected = await isInternetConnected();
|
|
19
21
|
|
|
20
22
|
if (!connected) {
|
|
23
|
+
TelemetryHelper.logActionEvent(LogLevel.WARN, {
|
|
24
|
+
Event: TelemetryEvent.NetworkDisconnected
|
|
25
|
+
});
|
|
21
26
|
NotificationHandler.notifyError(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
|
|
22
27
|
} else {
|
|
28
|
+
TelemetryHelper.logActionEvent(LogLevel.WARN, {
|
|
29
|
+
Event: TelemetryEvent.NetworkReconnected
|
|
30
|
+
});
|
|
23
31
|
NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
|
|
24
32
|
}
|
|
25
33
|
}; // Checking connection status on online & offline events due to possible false positives
|
|
@@ -46,7 +46,7 @@ import useChatSDKStore from "../../../hooks/useChatSDKStore";
|
|
|
46
46
|
import { ActivityStreamHandler } from "../common/ActivityStreamHandler";
|
|
47
47
|
import { Constants } from "../../../common/Constants";
|
|
48
48
|
export const LiveChatWidgetStateful = props => {
|
|
49
|
-
var _props$webChatContain, _props$styleProps, _props$controlProps, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps14, _props$controlProps15, _props$componentOverr, _props$controlProps16, _props$componentOverr2, _props$controlProps17, _props$componentOverr3, _props$controlProps18, _props$componentOverr4, _props$controlProps19, _props$componentOverr5, _props$controlProps20, _props$componentOverr6, _props$controlProps21, _props$componentOverr7, _props$controlProps22, _props$controlProps23, _props$componentOverr8, _props$controlProps24, _props$componentOverr9, _props$controlProps25, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
49
|
+
var _props$webChatContain, _props$styleProps, _chatSDK$omnichannelC, _props$controlProps, _props$controlProps2, _props$webChatContain3, _props$webChatContain4, _props$styleProps2, _props$controlProps14, _props$controlProps15, _props$componentOverr, _props$controlProps16, _props$componentOverr2, _props$controlProps17, _props$componentOverr3, _props$controlProps18, _props$componentOverr4, _props$controlProps19, _props$componentOverr5, _props$controlProps20, _props$componentOverr6, _props$controlProps21, _props$componentOverr7, _props$controlProps22, _props$controlProps23, _props$componentOverr8, _props$controlProps24, _props$componentOverr9, _props$controlProps25, _props$componentOverr10, _props$componentOverr11, _props$componentOverr12;
|
|
50
50
|
|
|
51
51
|
const [state, dispatch] = useChatContextStore(); // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
52
|
|
|
@@ -66,8 +66,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
66
66
|
const generalStyles = {
|
|
67
67
|
root: Object.assign({}, getGeneralStylesForButton(state), (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyles)
|
|
68
68
|
};
|
|
69
|
+
const broadcastServiceChannelName = getBroadcastChannelName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.widgetId, ((_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
|
|
70
|
+
BroadcastServiceInitialize(broadcastServiceChannelName);
|
|
69
71
|
TelemetryTimers.LcwLoadToChatButtonTimer = createTimer();
|
|
70
|
-
const widgetElementId = ((_props$
|
|
72
|
+
const widgetElementId = ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.id) || "oc-lcw";
|
|
71
73
|
const currentMessageCountRef = useRef(0);
|
|
72
74
|
let widgetStateEventName = "";
|
|
73
75
|
|
|
@@ -93,10 +95,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
useEffect(() => {
|
|
96
|
-
var
|
|
98
|
+
var _props$controlProps3, _props$controlProps4, _props$controlProps5, _props$controlProps7, _props$chatConfig, _props$chatConfig$Cha, _props$controlProps8, _props$reconnectChatP, _props$chatConfig2, _props$chatConfig2$Li, _props$reconnectChatP4;
|
|
97
99
|
|
|
98
|
-
const broadcastServiceChannelName = getBroadcastChannelName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.widgetId, ((_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.widgetInstanceId) ?? "");
|
|
99
|
-
BroadcastServiceInitialize(broadcastServiceChannelName);
|
|
100
100
|
registerTelemetryLoggers(props, dispatch);
|
|
101
101
|
createInternetConnectionChangeHandler();
|
|
102
102
|
DataStoreManager.clientDataStore = props.contextDataStore ?? undefined;
|
|
@@ -140,12 +140,30 @@ export const LiveChatWidgetStateful = props => {
|
|
|
140
140
|
|
|
141
141
|
startUnauthenticatedReconnectChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, (_props$reconnectChatP2 = props.reconnectChatPaneProps) === null || _props$reconnectChatP2 === void 0 ? void 0 : _props$reconnectChatP2.isReconnectEnabled, (_props$reconnectChatP3 = props.reconnectChatPaneProps) === null || _props$reconnectChatP3 === void 0 ? void 0 : _props$reconnectChatP3.reconnectId, initStartChat);
|
|
142
142
|
return;
|
|
143
|
-
} //
|
|
143
|
+
} // Checks if reconnectId is present for auth chat. If it is present, then it shows reconnect chat pane,
|
|
144
|
+
// where customer can choose to continue previous conversation or start new conversation
|
|
144
145
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
145
146
|
|
|
146
147
|
|
|
147
148
|
const isAuthenticationSettingsEnabled = (_props$chatConfig2 = props.chatConfig) !== null && _props$chatConfig2 !== void 0 && (_props$chatConfig2$Li = _props$chatConfig2.LiveChatConfigAuthSettings) !== null && _props$chatConfig2$Li !== void 0 && _props$chatConfig2$Li.msdyn_javascriptclientfunction ? true : false;
|
|
148
149
|
|
|
150
|
+
if (!state.appStates.skipChatButtonRendering && state.appStates.conversationState === ConversationState.Active && isAuthenticationSettingsEnabled === true && (_props$reconnectChatP4 = props.reconnectChatPaneProps) !== null && _props$reconnectChatP4 !== void 0 && _props$reconnectChatP4.isReconnectEnabled) {
|
|
151
|
+
getReconnectIdForAuthenticatedChat(props, chatSDK).then(authReconnectId => {
|
|
152
|
+
if (authReconnectId && !state.appStates.reconnectId) {
|
|
153
|
+
dispatch({
|
|
154
|
+
type: LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
155
|
+
payload: authReconnectId
|
|
156
|
+
});
|
|
157
|
+
dispatch({
|
|
158
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
159
|
+
payload: ConversationState.ReconnectChat
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return;
|
|
164
|
+
} // Check if auth settings enabled, do not connect to existing chat from cache during refresh/re-load
|
|
165
|
+
|
|
166
|
+
|
|
149
167
|
if (isAuthenticationSettingsEnabled === false) {
|
|
150
168
|
var _state$domainStates;
|
|
151
169
|
|
|
@@ -169,16 +187,16 @@ export const LiveChatWidgetStateful = props => {
|
|
|
169
187
|
|
|
170
188
|
useEffect(() => {
|
|
171
189
|
if (state.appStates.skipChatButtonRendering) {
|
|
172
|
-
var _props$
|
|
190
|
+
var _props$reconnectChatP5;
|
|
173
191
|
|
|
174
192
|
BroadcastService.postMessage({
|
|
175
193
|
eventName: BroadcastEvent.ChatInitiated
|
|
176
194
|
});
|
|
177
195
|
|
|
178
|
-
if ((_props$
|
|
179
|
-
var _props$
|
|
196
|
+
if ((_props$reconnectChatP5 = props.reconnectChatPaneProps) !== null && _props$reconnectChatP5 !== void 0 && _props$reconnectChatP5.reconnectId && !state.appStates.reconnectId) {
|
|
197
|
+
var _props$reconnectChatP6, _props$reconnectChatP7, _props$reconnectChatP8;
|
|
180
198
|
|
|
181
|
-
handleUnauthenticatedReconnectChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, (_props$
|
|
199
|
+
handleUnauthenticatedReconnectChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, (_props$reconnectChatP6 = props.reconnectChatPaneProps) === null || _props$reconnectChatP6 === void 0 ? void 0 : _props$reconnectChatP6.isReconnectEnabled, (_props$reconnectChatP7 = props.reconnectChatPaneProps) === null || _props$reconnectChatP7 === void 0 ? void 0 : _props$reconnectChatP7.reconnectId, initStartChat, (_props$reconnectChatP8 = props.reconnectChatPaneProps) === null || _props$reconnectChatP8 === void 0 ? void 0 : _props$reconnectChatP8.redirectInSameWindow);
|
|
182
200
|
} else {
|
|
183
201
|
getReconnectIdForAuthenticatedChat(props, chatSDK).then(authReconnectId => {
|
|
184
202
|
if (authReconnectId && !state.appStates.reconnectId) {
|
|
@@ -148,7 +148,9 @@ export declare enum TelemetryEvent {
|
|
|
148
148
|
ReconnectChatMinimize = "ReconnectChatMinimize",
|
|
149
149
|
MessageSent = "MessageSent",
|
|
150
150
|
MessageReceived = "MessageReceived",
|
|
151
|
-
CustomContextReceived = "CustomContextReceived"
|
|
151
|
+
CustomContextReceived = "CustomContextReceived",
|
|
152
|
+
NetworkDisconnected = "NetworkDisconnected",
|
|
153
|
+
NetworkReconnected = "NetworkReconnected"
|
|
152
154
|
}
|
|
153
155
|
export interface TelemetryInput {
|
|
154
156
|
scenarioType: ScenarioType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const activityStatusMiddleware: () => (next: any) => (args: any) =>
|
|
1
|
+
export declare const activityStatusMiddleware: () => (next: any) => (args: any) => any;
|
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.d553f80",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@fluentui/react": "^8.49.1",
|
|
77
|
-
"@microsoft/omnichannel-chat-components": "0.1.0-main.
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "0.1.0-main.5a87386",
|
|
78
78
|
"@microsoft/omnichannel-chat-sdk": "1.0.1-main.077d17c",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|