@microsoft/omnichannel-chat-widget 0.1.0-main.e170704 → 0.1.0-main.e67738e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/lib/cjs/common/Constants.js +18 -2
- package/lib/cjs/common/telemetry/TelemetryConstants.js +25 -3
- package/lib/cjs/common/telemetry/TelemetryManager.js +7 -1
- package/lib/cjs/common/telemetry/loggers/ariaTelemetryLogger.js +8 -9
- package/lib/cjs/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/cjs/common/utils.js +76 -2
- package/lib/cjs/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +19 -3
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +0 -1
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +11 -2
- package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -3
- 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/common/ActivitySubscriber/IActivitySubscriber.js +1 -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 +52 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +13 -1
- package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +12 -0
- package/lib/cjs/components/livechatwidget/common/createMarkdown.js +31 -30
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -15
- package/lib/cjs/components/livechatwidget/common/endChat.js +63 -16
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +24 -3
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +55 -35
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/cjs/components/livechatwidget/common/shareObservable.js +45 -0
- package/lib/cjs/components/livechatwidget/common/startChat.js +170 -72
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +256 -93
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -10
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +91 -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/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -0
- package/lib/cjs/contexts/common/ConversationState.js +3 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +3 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +3 -2
- package/lib/cjs/contexts/createReducer.js +17 -0
- package/lib/cjs/controller/componentController.js +3 -3
- package/lib/cjs/plugins/newMessageEventHandler.js +10 -13
- package/lib/esm/common/Constants.js +18 -2
- package/lib/esm/common/telemetry/TelemetryConstants.js +25 -3
- package/lib/esm/common/telemetry/TelemetryManager.js +6 -1
- package/lib/esm/common/telemetry/loggers/ariaTelemetryLogger.js +8 -6
- package/lib/esm/common/telemetry/loggers/consoleLogger.js +6 -5
- package/lib/esm/common/utils.js +53 -0
- package/lib/esm/components/callingcontainerstateful/CallingContainerStateful.js +14 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +21 -6
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +0 -1
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +9 -3
- package/lib/esm/components/headerstateful/HeaderStateful.js +4 -3
- 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/common/ActivitySubscriber/IActivitySubscriber.js +1 -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 +39 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +12 -2
- package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +8 -0
- package/lib/esm/components/livechatwidget/common/createMarkdown.js +31 -30
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -15
- package/lib/esm/components/livechatwidget/common/endChat.js +61 -17
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +23 -5
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +56 -37
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +0 -4
- package/lib/esm/components/livechatwidget/common/shareObservable.js +38 -0
- package/lib/esm/components/livechatwidget/common/startChat.js +165 -75
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +248 -96
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -11
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +82 -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/interfaces/IBotMagicCodeConfig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +1 -0
- package/lib/esm/contexts/common/ConversationState.js +3 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +3 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +3 -2
- package/lib/esm/contexts/createReducer.js +17 -0
- package/lib/esm/controller/componentController.js +3 -3
- package/lib/esm/plugins/newMessageEventHandler.js +10 -12
- package/lib/types/common/Constants.d.ts +9 -1
- package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +25 -5
- package/lib/types/common/telemetry/TelemetryHelper.d.ts +1 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +12 -9
- package/lib/types/common/utils.d.ts +7 -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 +4 -0
- package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +5 -4
- package/lib/types/components/livechatwidget/common/shareObservable.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/startChat.d.ts +4 -2
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +1 -0
- package/lib/types/components/reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps.d.ts +0 -1
- 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/IBotMagicCodeConfig.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
- package/lib/types/contexts/common/ConversationState.d.ts +3 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -1
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +4 -1
- package/package.json +4 -3
|
@@ -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,39 @@
|
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
3
|
+
import { isNullOrEmptyString } from "../../../common/utils"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
|
|
5
|
+
const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
|
|
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
|
+
if (getAuthToken && authClientFunction) {
|
|
15
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
16
|
+
Event: TelemetryEvent.GetAuthTokenCalled
|
|
17
|
+
});
|
|
18
|
+
const token = await getAuthToken(authClientFunction);
|
|
19
|
+
|
|
20
|
+
if (!isNullOrEmptyString(token)) {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
chatSDK.setAuthTokenProvider(async () => {
|
|
23
|
+
return token;
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
27
|
+
Event: TelemetryEvent.ReceivedNullOrEmptyToken
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const removeAuthTokenProvider = chatSDK => {
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
chatSDK.authenticatedUserToken = null;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { 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
|
};
|
|
@@ -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
|
|
@@ -13,26 +13,40 @@ export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineM
|
|
|
13
13
|
breaks: !disableNewLineMarkdownSupport
|
|
14
14
|
}); // ToDo: Commenting below usage of plugin until deferred bug is resolved: https://github.com/mayashavin/markdown-it-slack/issues/1
|
|
15
15
|
// markdown.use(MarkdownSlack);
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
} else {
|
|
17
|
+
markdown = new MarkdownIt(Constants.Zero, {
|
|
18
|
+
html: true,
|
|
19
|
+
linkify: true,
|
|
20
|
+
breaks: !disableNewLineMarkdownSupport
|
|
21
|
+
});
|
|
22
|
+
markdown.enable(["entity", // Rule to process html entity - {, ¯, "
|
|
23
|
+
"linkify", // Rule to replace link-like texts with link nodes
|
|
24
|
+
"html_block", // Rule to process html blocks and paragraphs
|
|
25
|
+
"html_inline", // Rule to process html tags
|
|
26
|
+
"newline" // Rule to proceess '\n'
|
|
27
|
+
]);
|
|
28
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
29
|
|
|
19
|
-
markdown.use(MarkdownItForInline, "url_new_win", "link_open", function (tokens, idx, env) {
|
|
20
|
-
const targetAttrIndex = tokens[idx].attrIndex(Constants.Target); // Put a transparent pixel instead of the "open in new window" icon, so developers can easily modify the icon in CSS.
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
markdown.use(MarkdownItForInline, "url_new_win", "link_open", function (tokens, idx, env) {
|
|
32
|
+
const targetAttrIndex = tokens[idx].attrIndex(Constants.Target); // Put a transparent pixel instead of the "open in new window" icon, so developers can easily modify the icon in CSS.
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
const TRANSPARENT_GIF = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
35
|
+
|
|
36
|
+
if (~targetAttrIndex) {
|
|
37
|
+
tokens[idx].attrs[targetAttrIndex][1] = Constants.Blank;
|
|
38
|
+
} else {
|
|
39
|
+
tokens[idx].attrPush([Constants.Target, Constants.Blank]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const relAttrIndex = tokens[idx].attrIndex(Constants.TargetRelationship);
|
|
29
43
|
|
|
30
|
-
|
|
44
|
+
if (~relAttrIndex) {
|
|
45
|
+
tokens[idx].attrs[relAttrIndex][1] = Constants.TargetRelationshipAttributes;
|
|
46
|
+
} else {
|
|
47
|
+
tokens[idx].attrPush([Constants.TargetRelationship, Constants.TargetRelationshipAttributes]);
|
|
31
48
|
|
|
32
|
-
if (
|
|
33
|
-
tokens[idx].attrs[relAttrIndex][1] = Constants.TargetRelationshipAttributes;
|
|
34
|
-
} else {
|
|
35
|
-
tokens[idx].attrPush([Constants.TargetRelationship, Constants.TargetRelationshipAttributes]);
|
|
49
|
+
if (!disableMarkdownMessageFormatting) {
|
|
36
50
|
tokens[idx].attrPush([Constants.Title, defaultMarkdownLocalizedTexts.MARKDOWN_EXTERNAL_LINK_ALT]); // eslint-disable-next-line quotes
|
|
37
51
|
|
|
38
52
|
const iconTokens = markdown.parseInline(``, env)[0].children;
|
|
@@ -42,20 +56,7 @@ export const createMarkdown = (disableMarkdownMessageFormatting, disableNewLineM
|
|
|
42
56
|
tokens.splice(idx + 2, 0, ...iconTokens);
|
|
43
57
|
}
|
|
44
58
|
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
markdown = new MarkdownIt(Constants.Zero, {
|
|
48
|
-
html: true,
|
|
49
|
-
linkify: true,
|
|
50
|
-
breaks: !disableNewLineMarkdownSupport
|
|
51
|
-
});
|
|
52
|
-
markdown.enable(["entity", // Rule to process html entity - {, ¯, "
|
|
53
|
-
"linkify", // Rule to replace link-like texts with link nodes
|
|
54
|
-
"html_block", // Rule to process html blocks and paragraphs
|
|
55
|
-
"html_inline", // Rule to process html tags
|
|
56
|
-
"newline" // Rule to proceess '\n'
|
|
57
|
-
]);
|
|
58
|
-
}
|
|
59
|
-
|
|
59
|
+
}
|
|
60
|
+
});
|
|
60
61
|
return markdown;
|
|
61
62
|
};
|
|
@@ -253,18 +253,6 @@ export const dummyDefaultProps = {
|
|
|
253
253
|
width: "50px",
|
|
254
254
|
fontSize: "18px"
|
|
255
255
|
},
|
|
256
|
-
currentCallTimerStyleProps: {
|
|
257
|
-
borderRadius: "2px",
|
|
258
|
-
margin: "1px",
|
|
259
|
-
color: "#FFFFFF",
|
|
260
|
-
paddingTop: "18px",
|
|
261
|
-
fontSize: 12,
|
|
262
|
-
fontFamily: "Segoe UI, Arial, sans-serif",
|
|
263
|
-
backgroundColor: "darkgrey",
|
|
264
|
-
height: "45px",
|
|
265
|
-
width: "50px",
|
|
266
|
-
textAlign: "center"
|
|
267
|
-
},
|
|
268
256
|
videoTileStyleProps: {
|
|
269
257
|
width: "100%",
|
|
270
258
|
marginLeft: "auto",
|
|
@@ -328,7 +316,10 @@ export const dummyDefaultProps = {
|
|
|
328
316
|
hideChatTextContainer: false,
|
|
329
317
|
hideChatSubtitle: false,
|
|
330
318
|
hideChatTitle: false,
|
|
331
|
-
hideNotificationBubble: true
|
|
319
|
+
hideNotificationBubble: true,
|
|
320
|
+
unreadMessageString: "new messages",
|
|
321
|
+
largeUnreadMessageString: "99+",
|
|
322
|
+
ariaLabelUnreadMessageString: "you have new messages"
|
|
332
323
|
},
|
|
333
324
|
styleProps: {
|
|
334
325
|
generalStyleProps: {
|
|
@@ -1423,7 +1414,6 @@ export const dummyDefaultProps = {
|
|
|
1423
1414
|
startNewChatButtonClassName: undefined
|
|
1424
1415
|
}
|
|
1425
1416
|
},
|
|
1426
|
-
authClientFunction: undefined,
|
|
1427
1417
|
isReconnectEnabled: undefined,
|
|
1428
1418
|
reconnectId: undefined,
|
|
1429
1419
|
redirectInSameWindow: undefined
|
|
@@ -1688,7 +1678,16 @@ export const dummyDefaultProps = {
|
|
|
1688
1678
|
MIDDLEWARE_MESSAGE_RETRY: "Retry",
|
|
1689
1679
|
PRECHAT_REQUIRED_FIELD_MISSING_MESSAGE: "{0} field is required",
|
|
1690
1680
|
MARKDOWN_EXTERNAL_LINK_ALT: "Opens in a new window; external."
|
|
1681
|
+
},
|
|
1682
|
+
botMagicCode: {
|
|
1683
|
+
disabled: false,
|
|
1684
|
+
fwdUrl: ""
|
|
1685
|
+
},
|
|
1686
|
+
adaptiveCardStyles: {
|
|
1687
|
+
background: "white",
|
|
1688
|
+
color: "black"
|
|
1691
1689
|
}
|
|
1692
1690
|
},
|
|
1693
|
-
telemetryConfig: undefined
|
|
1691
|
+
telemetryConfig: undefined,
|
|
1692
|
+
getAuthToken: undefined
|
|
1694
1693
|
};
|
|
@@ -7,21 +7,38 @@ import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontro
|
|
|
7
7
|
import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
8
8
|
import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
|
|
9
9
|
import { Constants } from "../../../common/Constants";
|
|
10
|
+
import { addDelayInMs, getWidgetEndChatEventName } from "../../../common/utils"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
11
|
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
12
|
const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
|
|
13
|
-
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
|
|
13
|
+
var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _conversationDetails;
|
|
14
14
|
|
|
15
15
|
const isPostChatEnabled = (_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable;
|
|
16
|
-
const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode;
|
|
17
|
-
const conversationDetails = await chatSDK.getConversationDetails();
|
|
16
|
+
const postChatSurveyMode = (_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
let conversationDetails = undefined;
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
conversationDetails = await chatSDK.getConversationDetails();
|
|
22
|
+
} catch (erorr) {
|
|
23
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
24
|
+
Event: TelemetryEvent.GetConversationDetailsException,
|
|
25
|
+
ExceptionDetails: {
|
|
26
|
+
exception: `Failed to get conversation details: ${erorr}`
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (isPostChatEnabled === "true" && ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.canRenderPostChat) === Constants.truePascal) {
|
|
20
32
|
const skipEndChatSDK = false;
|
|
21
33
|
const skipCloseChat = true;
|
|
22
|
-
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat);
|
|
34
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, false);
|
|
23
35
|
|
|
24
36
|
if (postChatSurveyMode === PostChatSurveyMode.Embed) {
|
|
37
|
+
dispatch({
|
|
38
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
39
|
+
payload: ConversationState.PostchatLoading
|
|
40
|
+
});
|
|
41
|
+
await addDelayInMs(Constants.PostChatLoadingDurationInMs);
|
|
25
42
|
const loadPostChatEvent = {
|
|
26
43
|
eventName: BroadcastEvent.LoadPostChatSurvey
|
|
27
44
|
};
|
|
@@ -32,13 +49,15 @@ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
|
|
|
32
49
|
payload: ConversationState.InActive
|
|
33
50
|
});
|
|
34
51
|
}
|
|
35
|
-
|
|
36
|
-
|
|
52
|
+
|
|
53
|
+
return;
|
|
37
54
|
}
|
|
55
|
+
|
|
56
|
+
await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
|
|
38
57
|
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
58
|
|
|
40
59
|
|
|
41
|
-
const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat) => {
|
|
60
|
+
const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
|
|
42
61
|
if (!skipEndChatSDK) {
|
|
43
62
|
try {
|
|
44
63
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
@@ -52,8 +71,23 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
52
71
|
exception: ex
|
|
53
72
|
}
|
|
54
73
|
});
|
|
74
|
+
postMessageToOtherTab = false;
|
|
55
75
|
}
|
|
56
|
-
}
|
|
76
|
+
} // Need to clear these states immediately when chat ended from OC.
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
dispatch({
|
|
80
|
+
type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
81
|
+
payload: undefined
|
|
82
|
+
});
|
|
83
|
+
dispatch({
|
|
84
|
+
type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
85
|
+
payload: undefined
|
|
86
|
+
});
|
|
87
|
+
dispatch({
|
|
88
|
+
type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
89
|
+
payload: undefined
|
|
90
|
+
});
|
|
57
91
|
|
|
58
92
|
if (!skipCloseChat) {
|
|
59
93
|
try {
|
|
@@ -82,16 +116,26 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
|
|
|
82
116
|
payload: null
|
|
83
117
|
});
|
|
84
118
|
dispatch({
|
|
85
|
-
type: LiveChatWidgetActionType.
|
|
86
|
-
payload:
|
|
119
|
+
type: LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
|
|
120
|
+
payload: 0
|
|
87
121
|
});
|
|
88
122
|
dispatch({
|
|
89
|
-
type: LiveChatWidgetActionType.
|
|
90
|
-
payload:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
123
|
+
type: LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
|
|
124
|
+
payload: {
|
|
125
|
+
proactiveChatBodyTitle: "",
|
|
126
|
+
proactiveChatEnablePrechat: false,
|
|
127
|
+
proactiveChatInNewWindow: false
|
|
128
|
+
}
|
|
94
129
|
});
|
|
130
|
+
|
|
131
|
+
if (postMessageToOtherTab) {
|
|
132
|
+
var _chatSDK$omnichannelC, _chatSDK$omnichannelC2, _props$controlProps;
|
|
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, (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
|
|
135
|
+
BroadcastService.postMessage({
|
|
136
|
+
eventName: endChatEventName
|
|
137
|
+
});
|
|
138
|
+
}
|
|
95
139
|
} catch (error) {
|
|
96
140
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
97
141
|
Event: TelemetryEvent.CloseChatMethodException,
|
|
@@ -7,7 +7,7 @@ import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostC
|
|
|
7
7
|
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
8
8
|
import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader";
|
|
9
9
|
import attachmentProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware";
|
|
10
|
-
import { changeLanguageCodeFormatForWebChat } from "../../../common/utils";
|
|
10
|
+
import { addDelayInMs, changeLanguageCodeFormatForWebChat } from "../../../common/utils";
|
|
11
11
|
import channelDataMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware";
|
|
12
12
|
import { createActivityMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware";
|
|
13
13
|
import createAttachmentMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware";
|
|
@@ -26,10 +26,13 @@ import gifUploadMiddleware from "../../webchatcontainerstateful/webchatcontrolle
|
|
|
26
26
|
import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware";
|
|
27
27
|
import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
|
|
28
28
|
import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
|
|
29
|
-
import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
|
|
29
|
+
import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
|
|
30
|
+
import { createCardActionMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware";
|
|
31
|
+
import createMessageTimeStampMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware";
|
|
32
|
+
import { Constants } from "../../../common/Constants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
33
|
|
|
31
34
|
export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
|
|
32
|
-
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21;
|
|
35
|
+
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
|
|
33
36
|
|
|
34
37
|
const localizedTexts = { ...defaultMiddlewareLocalizedTexts,
|
|
35
38
|
...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.localizedTexts)
|
|
@@ -63,6 +66,12 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
|
|
|
63
66
|
|
|
64
67
|
if (isPostChatEnabled === "true") {
|
|
65
68
|
if (postChatSurveyMode === PostChatSurveyMode.Embed) {
|
|
69
|
+
WebChatStoreLoader.store = null;
|
|
70
|
+
dispatch({
|
|
71
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
72
|
+
payload: ConversationState.PostchatLoading
|
|
73
|
+
});
|
|
74
|
+
await addDelayInMs(Constants.PostChatLoadingDurationInMs);
|
|
66
75
|
const loadPostChatEvent = {
|
|
67
76
|
eventName: BroadcastEvent.LoadPostChatSurvey
|
|
68
77
|
};
|
|
@@ -74,6 +83,10 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
|
|
|
74
83
|
});
|
|
75
84
|
}
|
|
76
85
|
} else {
|
|
86
|
+
dispatch({
|
|
87
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
88
|
+
payload: ConversationState.InActive
|
|
89
|
+
});
|
|
77
90
|
dispatch({
|
|
78
91
|
type: LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
|
|
79
92
|
payload: true
|
|
@@ -84,10 +97,14 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
|
|
|
84
97
|
type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
|
|
85
98
|
payload: undefined
|
|
86
99
|
});
|
|
100
|
+
dispatch({
|
|
101
|
+
type: LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
102
|
+
payload: undefined
|
|
103
|
+
});
|
|
87
104
|
};
|
|
88
105
|
|
|
89
106
|
webChatStore = createStore({}, //initial state
|
|
90
|
-
preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), channelDataMiddleware, createConversationEndMiddleware(conversationEndCallback), createDataMaskingMiddleware((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware, createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
|
+
preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), channelDataMiddleware, createConversationEndMiddleware(conversationEndCallback), createDataMaskingMiddleware((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), createMessageTimeStampMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware, createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
108
|
...(((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.storeMiddlewares) ?? []));
|
|
92
109
|
WebChatStoreLoader.store = webChatStore;
|
|
93
110
|
} // Initialize the remaining Web Chat props
|
|
@@ -105,7 +122,8 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
|
|
|
105
122
|
groupActivitiesMiddleware: (_props$webChatContain17 = props.webChatContainerProps) !== null && _props$webChatContain17 !== void 0 && (_props$webChatContain18 = _props$webChatContain17.renderingMiddlewareProps) !== null && _props$webChatContain18 !== void 0 && _props$webChatContain18.disableGroupActivitiesMiddleware ? undefined : (_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.groupActivitiesMiddleware,
|
|
106
123
|
typingIndicatorMiddleware: (_props$webChatContain19 = props.webChatContainerProps) !== null && _props$webChatContain19 !== void 0 && (_props$webChatContain20 = _props$webChatContain19.renderingMiddlewareProps) !== null && _props$webChatContain20 !== void 0 && _props$webChatContain20.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai3 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.typingIndicatorMiddleware,
|
|
107
124
|
onTelemetry: createWebChatTelemetry(),
|
|
108
|
-
|
|
125
|
+
cardActionMiddleware: createCardActionMiddleware(((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.botMagicCode) || undefined),
|
|
126
|
+
...((_props$webChatContain22 = props.webChatContainerProps) === null || _props$webChatContain22 === void 0 ? void 0 : _props$webChatContain22.webChatProps)
|
|
109
127
|
};
|
|
110
128
|
return webChatProps;
|
|
111
129
|
};
|