@microsoft/omnichannel-chat-widget 0.1.0-main.a72fbb6 → 0.1.0-main.acb91cf
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/telemetry/TelemetryConstants.js +6 -0
- package/lib/cjs/common/utils.js +20 -7
- package/lib/cjs/components/footerstateful/FooterStateful.js +1 -8
- package/lib/cjs/components/headerstateful/HeaderStateful.js +2 -1
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +44 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +23 -0
- package/lib/cjs/components/livechatwidget/{interfaces/IAuthProps.js → common/ActivitySubscriber/IActivitySubscriber.js} +0 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +39 -0
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +70 -0
- package/lib/cjs/components/livechatwidget/common/Deferred.js +42 -0
- package/lib/cjs/components/livechatwidget/common/authHelper.js +65 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
- package/lib/cjs/components/livechatwidget/common/createFooter.js +7 -16
- package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +12 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +8 -6
- package/lib/cjs/components/livechatwidget/common/endChat.js +3 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +4 -0
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +55 -35
- package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +55 -27
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +113 -55
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +11 -0
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +11 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
- package/lib/cjs/contexts/createReducer.js +8 -0
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +6 -0
- package/lib/esm/common/utils.js +14 -5
- package/lib/esm/components/footerstateful/FooterStateful.js +1 -8
- package/lib/esm/components/headerstateful/HeaderStateful.js +2 -1
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +34 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +14 -0
- package/lib/esm/components/livechatwidget/{interfaces/IAuthProps.js → common/ActivitySubscriber/IActivitySubscriber.js} +0 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +29 -0
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +59 -0
- package/lib/esm/components/livechatwidget/common/Deferred.js +33 -0
- package/lib/esm/components/livechatwidget/common/authHelper.js +50 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
- package/lib/esm/components/livechatwidget/common/createFooter.js +4 -15
- package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +8 -6
- package/lib/esm/components/livechatwidget/common/endChat.js +3 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +4 -0
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +55 -37
- package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +51 -28
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +112 -57
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +10 -0
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +4 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +2 -1
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
- package/lib/esm/contexts/createReducer.js +8 -0
- package/lib/types/common/Constants.d.ts +1 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +5 -1
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -1
- package/lib/types/common/utils.d.ts +5 -4
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +1 -1
- package/lib/types/components/headerstateful/interfaces/IHeaderStatefulParams.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/ActivityStreamHandler.d.ts +14 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/IActivitySubscriber.d.ts +6 -0
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/ChatAdapterShim.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/Deferred.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/authHelper.d.ts +5 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -5
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/startChat.d.ts +3 -3
- package/lib/types/components/livechatwidget/common/startProactiveChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -2
- package/lib/types/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +4 -3
- package/lib/types/components/livechatwidget/interfaces/IAuthProps.d.ts +0 -4
package/lib/esm/common/utils.js
CHANGED
|
@@ -2,6 +2,7 @@ import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants"
|
|
|
2
2
|
import { DataStoreManager } from "./contextDataStore/DataStoreManager";
|
|
3
3
|
import { KeyCodes } from "./KeyCodes";
|
|
4
4
|
import { BroadcastEvent } from "./telemetry/TelemetryConstants";
|
|
5
|
+
import { Md5 } from "md5-typescript";
|
|
5
6
|
|
|
6
7
|
const getElementBySelector = selector => {
|
|
7
8
|
let element;
|
|
@@ -290,20 +291,25 @@ export const getDomain = hostValue => {
|
|
|
290
291
|
|
|
291
292
|
return AriaTelemetryConstants.Public;
|
|
292
293
|
};
|
|
293
|
-
export const getWidgetCacheId = (orgId, widgetId) => {
|
|
294
|
-
|
|
294
|
+
export const getWidgetCacheId = (orgId, widgetId, widgetInstanceId) => {
|
|
295
|
+
const widgetCacheId = `${widgetInstanceId}_${orgId}_${widgetId}`;
|
|
296
|
+
return Md5.init(widgetCacheId);
|
|
295
297
|
};
|
|
296
|
-
export const getWidgetEndChatEventName = (orgId, widgetId) => {
|
|
298
|
+
export const getWidgetEndChatEventName = (orgId, widgetId, widgetInstanceId) => {
|
|
299
|
+
if (!isNullOrEmptyString(widgetInstanceId)) {
|
|
300
|
+
return `${BroadcastEvent.ChatEnded}_${widgetInstanceId}_${orgId}_${widgetId}`;
|
|
301
|
+
}
|
|
302
|
+
|
|
297
303
|
return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
|
|
298
304
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
299
305
|
|
|
300
|
-
export const getStateFromCache = (orgId, widgetId) => {
|
|
306
|
+
export const getStateFromCache = (orgId, widgetId, widgetInstanceId) => {
|
|
301
307
|
// Getting updated state from cache
|
|
302
308
|
try {
|
|
303
309
|
if (DataStoreManager.clientDataStore) {
|
|
304
310
|
var _DataStoreManager$cli;
|
|
305
311
|
|
|
306
|
-
const widgetStateEventName = getWidgetCacheId(orgId, widgetId);
|
|
312
|
+
const widgetStateEventName = getWidgetCacheId(orgId, widgetId, widgetInstanceId);
|
|
307
313
|
const widgetStateFromCache = (_DataStoreManager$cli = DataStoreManager.clientDataStore) === null || _DataStoreManager$cli === void 0 ? void 0 : _DataStoreManager$cli.getData(widgetStateEventName, "localStorage");
|
|
308
314
|
const persistedState = widgetStateFromCache ? JSON.parse(widgetStateFromCache) : undefined;
|
|
309
315
|
return persistedState;
|
|
@@ -330,4 +336,7 @@ export const isUndefinedOrEmpty = object => {
|
|
|
330
336
|
|
|
331
337
|
export const addDelayInMs = ms => {
|
|
332
338
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
339
|
+
};
|
|
340
|
+
export const getBroadcastChannelName = (widgetId, widgetInstanceId) => {
|
|
341
|
+
return widgetInstanceId && !isNullOrEmptyString(widgetInstanceId) ? `${widgetInstanceId}_${widgetId}` : widgetId;
|
|
333
342
|
};
|
|
@@ -84,14 +84,7 @@ export const FooterStateful = props => {
|
|
|
84
84
|
isAudioMuted: state.appStates.isAudioMuted
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
const footer = document.getElementById(footerId);
|
|
89
|
-
|
|
90
|
-
if (footer) {
|
|
91
|
-
footer.style.display = hideFooterDisplay ? "none" : "";
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Footer, {
|
|
87
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, !hideFooterDisplay && /*#__PURE__*/React.createElement(Footer, {
|
|
95
88
|
componentOverrides: footerProps === null || footerProps === void 0 ? void 0 : footerProps.componentOverrides,
|
|
96
89
|
controlProps: controlProps,
|
|
97
90
|
styleProps: footerProps === null || footerProps === void 0 ? void 0 : footerProps.styleProps
|
|
@@ -49,7 +49,8 @@ export const HeaderStateful = props => {
|
|
|
49
49
|
} else {
|
|
50
50
|
const skipEndChatSDK = true;
|
|
51
51
|
const skipCloseChat = false;
|
|
52
|
-
|
|
52
|
+
const postMessageToOtherTabs = true;
|
|
53
|
+
await endChat(adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTabs);
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
dispatch({
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import { Deferred } from "./Deferred";
|
|
4
|
+
export class ActivityStreamHandler {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Use of a deferred pattern, to hold the execution of the activity.
|
|
10
|
+
*
|
|
11
|
+
* */
|
|
12
|
+
static cork() {
|
|
13
|
+
ActivityStreamHandler.restoreDeferred = new Deferred();
|
|
14
|
+
ActivityStreamHandler.restorePromise = ActivityStreamHandler.restoreDeferred.promise;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the promise, releasing it to continue with the execution of the activity.
|
|
18
|
+
*
|
|
19
|
+
* */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
static uncork() {
|
|
23
|
+
ActivityStreamHandler.restoreDeferred.resolve();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
_defineProperty(ActivityStreamHandler, "restoreDeferred", {
|
|
29
|
+
resolve: () => {
|
|
30
|
+
return "initialState";
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
_defineProperty(ActivityStreamHandler, "restorePromise", void 0);
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
export class DefaultActivitySubscriber {
|
|
4
|
+
constructor() {
|
|
5
|
+
_defineProperty(this, "observer", void 0);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
async next(activity) {
|
|
10
|
+
this.observer.next(activity);
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
}
|
|
File without changes
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import { ActivityStreamHandler } from "../ActivityStreamHandler";
|
|
4
|
+
export class PauseActivitySubscriber {
|
|
5
|
+
constructor() {
|
|
6
|
+
_defineProperty(this, "observer", void 0);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
async apply(activity) {
|
|
11
|
+
await ActivityStreamHandler.restorePromise;
|
|
12
|
+
return activity;
|
|
13
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
applicable(activity) {
|
|
17
|
+
return true;
|
|
18
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
async next(activity) {
|
|
22
|
+
if (this.applicable(activity)) {
|
|
23
|
+
return await this.apply(activity);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return activity;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
import { DefaultActivitySubscriber } from "./ActivitySubscriber/DefaultActivitySubscriber";
|
|
4
|
+
import { shareObservable } from "./shareObservable";
|
|
5
|
+
export class ChatAdapterShim {
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
constructor(chatAdapter) {
|
|
11
|
+
_defineProperty(this, "chatAdapter", void 0);
|
|
12
|
+
|
|
13
|
+
_defineProperty(this, "activityObserver", void 0);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "subscribers", void 0);
|
|
16
|
+
|
|
17
|
+
this.subscribers = [];
|
|
18
|
+
this.chatAdapter = { ...chatAdapter,
|
|
19
|
+
activity$: shareObservable( // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
new window.Observable(observer => {
|
|
21
|
+
this.activityObserver = observer; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
|
|
23
|
+
const abortController = new window.AbortController();
|
|
24
|
+
|
|
25
|
+
(async () => {
|
|
26
|
+
try {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
for await (let activity of chatAdapter.activities({
|
|
29
|
+
signal: abortController.signal
|
|
30
|
+
})) {
|
|
31
|
+
for (const subscriber of [...this.subscribers, new DefaultActivitySubscriber()]) {
|
|
32
|
+
subscriber.observer = this.activityObserver;
|
|
33
|
+
activity = await subscriber.next(activity);
|
|
34
|
+
|
|
35
|
+
if (!activity) {
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
observer.complete();
|
|
42
|
+
} catch (error) {
|
|
43
|
+
observer.error(error);
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
|
|
47
|
+
return () => {
|
|
48
|
+
abortController.abort();
|
|
49
|
+
};
|
|
50
|
+
}))
|
|
51
|
+
};
|
|
52
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
addSubscriber(subscriber) {
|
|
56
|
+
this.subscribers.push(subscriber);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
|
|
3
|
+
export class Deferred {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
constructor() {
|
|
6
|
+
_defineProperty(this, "_promise", void 0);
|
|
7
|
+
|
|
8
|
+
_defineProperty(this, "_resolve", void 0);
|
|
9
|
+
|
|
10
|
+
_defineProperty(this, "_reject", () => {
|
|
11
|
+
return;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "resolve", value => {
|
|
15
|
+
this._resolve(value);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
_defineProperty(this, "reject", value => {
|
|
19
|
+
this._reject(value);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
this._promise = new Promise((resolve, reject) => {
|
|
23
|
+
this._resolve = resolve;
|
|
24
|
+
this._reject = reject;
|
|
25
|
+
});
|
|
26
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
get promise() {
|
|
30
|
+
return this._promise;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
3
|
+
import { isNullOrEmptyString } from "../../../common/utils";
|
|
4
|
+
|
|
5
|
+
const getAuthClientFunction = chatConfig => {
|
|
6
|
+
let authClientFunction = undefined;
|
|
7
|
+
|
|
8
|
+
if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
|
|
9
|
+
var _chatConfig$LiveChatC;
|
|
10
|
+
|
|
11
|
+
authClientFunction = (chatConfig === null || chatConfig === void 0 ? void 0 : (_chatConfig$LiveChatC = chatConfig.LiveChatConfigAuthSettings) === null || _chatConfig$LiveChatC === void 0 ? void 0 : _chatConfig$LiveChatC.msdyn_javascriptclientfunction) ?? undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return authClientFunction;
|
|
15
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
19
|
+
const authClientFunction = getAuthClientFunction(chatConfig);
|
|
20
|
+
|
|
21
|
+
if (getAuthToken && authClientFunction) {
|
|
22
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
23
|
+
Event: TelemetryEvent.GetAuthTokenCalled
|
|
24
|
+
});
|
|
25
|
+
const token = await getAuthToken(authClientFunction);
|
|
26
|
+
|
|
27
|
+
if (!isNullOrEmptyString(token)) {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
chatSDK.setAuthTokenProvider(async () => {
|
|
30
|
+
return token;
|
|
31
|
+
});
|
|
32
|
+
return true;
|
|
33
|
+
} else {
|
|
34
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
35
|
+
Event: TelemetryEvent.ReceivedNullOrEmptyToken
|
|
36
|
+
});
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return false;
|
|
42
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const removeAuthTokenProvider = chatSDK => {
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
chatSDK.authenticatedUserToken = null;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export { getAuthClientFunction, handleAuthentication, removeAuthTokenProvider };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler";
|
|
2
2
|
import { NotificationLevel } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationLevel";
|
|
3
3
|
import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
|
|
4
|
-
import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
4
|
+
import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
5
|
+
import { ChatAdapterShim } from "./ChatAdapterShim";
|
|
6
|
+
import { PauseActivitySubscriber } from "./ActivitySubscriber/PauseActivitySubscriber"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
7
|
|
|
6
8
|
export const createAdapter = async chatSDK => {
|
|
7
9
|
const chatAdapterOptionalParams = {
|
|
@@ -23,5 +25,13 @@ export const createAdapter = async chatSDK => {
|
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
};
|
|
26
|
-
|
|
28
|
+
let adapter = await chatSDK.createChatAdapter(chatAdapterOptionalParams); //so far, there is no need to convert to the shim adapter when using visual tests
|
|
29
|
+
|
|
30
|
+
if (chatSDK.isMockModeOn !== true) {
|
|
31
|
+
adapter = new ChatAdapterShim(adapter);
|
|
32
|
+
adapter.addSubscriber(new PauseActivitySubscriber());
|
|
33
|
+
return adapter.chatAdapter;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return adapter;
|
|
27
37
|
};
|
|
@@ -3,25 +3,14 @@ import React from "react";
|
|
|
3
3
|
import { decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { shouldShowFooter } from "../../../controller/componentController";
|
|
5
5
|
export const createFooter = (props, state) => {
|
|
6
|
-
var _props$
|
|
6
|
+
var _props$controlProps, _props$componentOverr;
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
hideDownloadTranscriptButton: true,
|
|
11
|
-
hideEmailTranscriptButton: true,
|
|
12
|
-
hideAudioNotificationButton: true
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const footer = !((_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hideFooter) && shouldShowFooter(state) ? decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
|
|
8
|
+
const hideFooterDisplay = !((_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hideFooter) && shouldShowFooter(state) ? false : true;
|
|
9
|
+
const footer = decodeComponentString((_props$componentOverr = props.componentOverrides) === null || _props$componentOverr === void 0 ? void 0 : _props$componentOverr.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
|
|
16
10
|
footerProps: props.footerProps,
|
|
17
11
|
downloadTranscriptProps: props.downloadTranscriptProps,
|
|
18
12
|
audioNotificationProps: props.audioNotificationProps,
|
|
19
|
-
hideFooterDisplay:
|
|
20
|
-
}) : decodeComponentString((_props$componentOverr2 = props.componentOverrides) === null || _props$componentOverr2 === void 0 ? void 0 : _props$componentOverr2.footer) || /*#__PURE__*/React.createElement(FooterStateful, {
|
|
21
|
-
footerProps: footerPropsHidden,
|
|
22
|
-
downloadTranscriptProps: props.downloadTranscriptProps,
|
|
23
|
-
audioNotificationProps: props.audioNotificationProps,
|
|
24
|
-
hideFooterDisplay: true
|
|
13
|
+
hideFooterDisplay: hideFooterDisplay
|
|
25
14
|
});
|
|
26
15
|
return footer;
|
|
27
16
|
};
|
|
@@ -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
|
|
@@ -318,7 +318,8 @@ export const dummyDefaultProps = {
|
|
|
318
318
|
hideChatTitle: false,
|
|
319
319
|
hideNotificationBubble: true,
|
|
320
320
|
unreadMessageString: "new messages",
|
|
321
|
-
largeUnreadMessageString: "99+"
|
|
321
|
+
largeUnreadMessageString: "99+",
|
|
322
|
+
ariaLabelUnreadMessageString: "you have new messages"
|
|
322
323
|
},
|
|
323
324
|
styleProps: {
|
|
324
325
|
generalStyleProps: {
|
|
@@ -1681,11 +1682,12 @@ export const dummyDefaultProps = {
|
|
|
1681
1682
|
botMagicCode: {
|
|
1682
1683
|
disabled: false,
|
|
1683
1684
|
fwdUrl: ""
|
|
1685
|
+
},
|
|
1686
|
+
adaptiveCardStyles: {
|
|
1687
|
+
background: "white",
|
|
1688
|
+
color: "black"
|
|
1684
1689
|
}
|
|
1685
1690
|
},
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
setAuthTokenProviderToChatSdk: undefined
|
|
1689
|
-
},
|
|
1690
|
-
telemetryConfig: undefined
|
|
1691
|
+
telemetryConfig: undefined,
|
|
1692
|
+
getAuthToken: undefined
|
|
1691
1693
|
};
|
|
@@ -31,7 +31,7 @@ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
|
|
|
31
31
|
if (isPostChatEnabled === "true" && ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.canRenderPostChat) === Constants.truePascal) {
|
|
32
32
|
const skipEndChatSDK = false;
|
|
33
33
|
const skipCloseChat = true;
|
|
34
|
-
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat,
|
|
34
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, false);
|
|
35
35
|
|
|
36
36
|
if (postChatSurveyMode === PostChatSurveyMode.Embed) {
|
|
37
37
|
dispatch({
|
|
@@ -129,9 +129,9 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
if (postMessageToOtherTab) {
|
|
132
|
-
var _chatSDK$omnichannelC, _chatSDK$omnichannelC2;
|
|
132
|
+
var _chatSDK$omnichannelC, _chatSDK$omnichannelC2, _props$controlProps;
|
|
133
133
|
|
|
134
|
-
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId);
|
|
134
|
+
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
|
|
135
135
|
BroadcastService.postMessage({
|
|
136
136
|
eventName: endChatEventName
|
|
137
137
|
});
|
|
@@ -83,6 +83,10 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
} else {
|
|
86
|
+
dispatch({
|
|
87
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
88
|
+
payload: ConversationState.InActive
|
|
89
|
+
});
|
|
86
90
|
dispatch({
|
|
87
91
|
type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
|
|
88
92
|
payload: true
|
|
@@ -4,25 +4,33 @@ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
|
4
4
|
import { ConversationState } from "../../../contexts/common/ConversationState";
|
|
5
5
|
import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
|
|
6
6
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const getChatReconnectContext = async (chatSDK, reconnectId) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
import { handleAuthentication, removeAuthTokenProvider } from "./authHelper"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
|
|
9
|
+
const getChatReconnectContext = async (chatSDK, chatConfig, getAuthToken, isReconnectEnabled, reconnectId) => {
|
|
10
|
+
if (isReconnectEnabled) {
|
|
11
|
+
try {
|
|
12
|
+
if (reconnectId) {
|
|
13
|
+
const chatReconnectOptionalParams = {
|
|
14
|
+
reconnectId: reconnectId
|
|
15
|
+
};
|
|
16
|
+
return await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatReconnectContext(chatReconnectOptionalParams));
|
|
17
|
+
} else {
|
|
18
|
+
// set auth token to chat sdk to get reconnectId for auth chat
|
|
19
|
+
await handleAuthentication(chatSDK, chatConfig, getAuthToken);
|
|
20
|
+
const reconnectChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatReconnectContext()); // remove auth token after reconnectId is fetched
|
|
21
|
+
// this will be reset later at start chat
|
|
22
|
+
|
|
23
|
+
removeAuthTokenProvider(chatSDK);
|
|
24
|
+
return reconnectChatContext;
|
|
24
25
|
}
|
|
25
|
-
})
|
|
26
|
+
} catch (ex) {
|
|
27
|
+
TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
|
|
28
|
+
Event: TelemetryEvent.GetChatReconnectContextSDKCallFailed,
|
|
29
|
+
ExceptionDetails: {
|
|
30
|
+
exception: ex
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
return null;
|
|
@@ -30,13 +38,23 @@ const getChatReconnectContext = async (chatSDK, reconnectId) => {
|
|
|
30
38
|
|
|
31
39
|
|
|
32
40
|
const getReconnectIdForAuthenticatedChat = async (props, chatSDK) => {
|
|
33
|
-
var _props$
|
|
41
|
+
var _props$chatConfig, _props$reconnectChatP;
|
|
42
|
+
|
|
43
|
+
let authClientFunction = undefined;
|
|
34
44
|
|
|
35
|
-
if ((_props$
|
|
45
|
+
if ((_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && _props$chatConfig.LiveChatConfigAuthSettings) {
|
|
46
|
+
var _props$chatConfig2, _props$chatConfig2$Li;
|
|
47
|
+
|
|
48
|
+
authClientFunction = ((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveChatConfigAuthSettings) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_javascriptclientfunction) ?? undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if ((_props$reconnectChatP = props.reconnectChatPaneProps) !== null && _props$reconnectChatP !== void 0 && _props$reconnectChatP.isReconnectEnabled && authClientFunction // TODO: Implement this after storage is in place
|
|
36
52
|
|
|
37
53
|
/* && !isLoadWithState() */
|
|
38
54
|
) {
|
|
39
|
-
|
|
55
|
+
var _props$reconnectChatP2;
|
|
56
|
+
|
|
57
|
+
const previousActiveSessionResponse = await getChatReconnectContext(chatSDK, props.chatConfig, props.getAuthToken, (_props$reconnectChatP2 = props.reconnectChatPaneProps) === null || _props$reconnectChatP2 === void 0 ? void 0 : _props$reconnectChatP2.isReconnectEnabled);
|
|
40
58
|
|
|
41
59
|
if (previousActiveSessionResponse && previousActiveSessionResponse.reconnectId) {
|
|
42
60
|
return previousActiveSessionResponse.reconnectId;
|
|
@@ -47,27 +65,27 @@ const getReconnectIdForAuthenticatedChat = async (props, chatSDK) => {
|
|
|
47
65
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
66
|
|
|
49
67
|
|
|
50
|
-
const handleUnauthenticatedReconnectChat = async (chatSDK,
|
|
51
|
-
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, reconnectId);
|
|
68
|
+
const handleUnauthenticatedReconnectChat = async (chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, isReconnectEnabled, reconnectId, initStartChat, redirectInSameWindow) => {
|
|
69
|
+
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, chatConfig, getAuthToken, isReconnectEnabled, reconnectId);
|
|
52
70
|
|
|
53
71
|
if (shouldRedirectOrStartNewChat(reconnectAvailabilityResponse)) {
|
|
54
|
-
await redirectOrStartNewChat(reconnectAvailabilityResponse, chatSDK,
|
|
72
|
+
await redirectOrStartNewChat(reconnectAvailabilityResponse, chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, initStartChat, redirectInSameWindow);
|
|
55
73
|
} else {
|
|
56
|
-
await setReconnectIdAndStartChat(chatSDK,
|
|
74
|
+
await setReconnectIdAndStartChat(chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, reconnectId, initStartChat);
|
|
57
75
|
}
|
|
58
76
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
77
|
|
|
60
78
|
|
|
61
|
-
const startUnauthenticatedReconnectChat = async (chatSDK,
|
|
62
|
-
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, reconnectId);
|
|
79
|
+
const startUnauthenticatedReconnectChat = async (chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, isReconnectEnabled, reconnectId, initStartChat) => {
|
|
80
|
+
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, chatConfig, getAuthToken, isReconnectEnabled, reconnectId);
|
|
63
81
|
|
|
64
82
|
if (!shouldRedirectOrStartNewChat(reconnectAvailabilityResponse)) {
|
|
65
|
-
await setReconnectIdAndStartChat(chatSDK,
|
|
83
|
+
await setReconnectIdAndStartChat(chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, reconnectId, initStartChat);
|
|
66
84
|
}
|
|
67
85
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
86
|
|
|
69
87
|
|
|
70
|
-
const setReconnectIdAndStartChat = async (chatSDK,
|
|
88
|
+
const setReconnectIdAndStartChat = async (chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, reconnectId, initStartChat) => {
|
|
71
89
|
const startUnauthenticatedReconnectChat = {
|
|
72
90
|
eventName: BroadcastEvent.StartUnauthenticatedReconnectChat
|
|
73
91
|
};
|
|
@@ -83,7 +101,7 @@ const setReconnectIdAndStartChat = async (chatSDK, authProps, dispatch, setAdapt
|
|
|
83
101
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
84
102
|
payload: ConversationState.Loading
|
|
85
103
|
});
|
|
86
|
-
await initStartChat(chatSDK,
|
|
104
|
+
await initStartChat(chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, optionalParams);
|
|
87
105
|
};
|
|
88
106
|
|
|
89
107
|
const redirectPage = (redirectURL, redirectInSameWindow) => {
|
|
@@ -105,7 +123,7 @@ const shouldRedirectOrStartNewChat = reconnectAvailabilityResponse => {
|
|
|
105
123
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
124
|
|
|
107
125
|
|
|
108
|
-
const startNewChatEmptyRedirectionUrl = async (chatSDK,
|
|
126
|
+
const startNewChatEmptyRedirectionUrl = async (chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, initStartChat) => {
|
|
109
127
|
const startUnauthenticatedReconnectChat = {
|
|
110
128
|
eventName: BroadcastEvent.StartUnauthenticatedReconnectChat
|
|
111
129
|
};
|
|
@@ -128,25 +146,25 @@ const startNewChatEmptyRedirectionUrl = async (chatSDK, authProps, dispatch, set
|
|
|
128
146
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
129
147
|
payload: ConversationState.Loading
|
|
130
148
|
});
|
|
131
|
-
await initStartChat(chatSDK,
|
|
149
|
+
await initStartChat(chatSDK, chatConfig, getAuthToken, dispatch, setAdapter);
|
|
132
150
|
}
|
|
133
151
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
152
|
|
|
135
153
|
|
|
136
|
-
const handleRedirectUnauthenticatedReconnectChat = async (chatSDK,
|
|
137
|
-
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, reconnectId);
|
|
154
|
+
const handleRedirectUnauthenticatedReconnectChat = async (chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, initStartChat, isReconnectEnabled, reconnectId, redirectInSameWindow) => {
|
|
155
|
+
const reconnectAvailabilityResponse = await getChatReconnectContext(chatSDK, chatConfig, getAuthToken, isReconnectEnabled, reconnectId);
|
|
138
156
|
|
|
139
157
|
if (shouldRedirectOrStartNewChat(reconnectAvailabilityResponse)) {
|
|
140
|
-
await redirectOrStartNewChat(reconnectAvailabilityResponse, chatSDK,
|
|
158
|
+
await redirectOrStartNewChat(reconnectAvailabilityResponse, chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, initStartChat, redirectInSameWindow);
|
|
141
159
|
}
|
|
142
160
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
161
|
|
|
144
162
|
|
|
145
|
-
const redirectOrStartNewChat = async (reconnectAvailabilityResponse, chatSDK,
|
|
163
|
+
const redirectOrStartNewChat = async (reconnectAvailabilityResponse, chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, initStartChat, redirectInSameWindow) => {
|
|
146
164
|
if (reconnectAvailabilityResponse.redirectURL) {
|
|
147
165
|
redirectPage(reconnectAvailabilityResponse.redirectURL, redirectInSameWindow);
|
|
148
166
|
} else {
|
|
149
|
-
await startNewChatEmptyRedirectionUrl(chatSDK,
|
|
167
|
+
await startNewChatEmptyRedirectionUrl(chatSDK, chatConfig, getAuthToken, dispatch, setAdapter, initStartChat);
|
|
150
168
|
}
|
|
151
169
|
};
|
|
152
170
|
|