@microsoft/omnichannel-chat-widget 1.0.2 → 1.0.3-main.1acfc60
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 +54 -1
- package/lib/cjs/common/storage/default/defaultCacheManager.js +7 -6
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +9 -7
- package/lib/cjs/common/telemetry/TelemetryConstants.js +7 -1
- package/lib/cjs/common/utils.js +27 -5
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +1 -10
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -6
- package/lib/cjs/components/footerstateful/FooterStateful.js +1 -1
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +14 -13
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/Deferred.js +2 -3
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +11 -3
- package/lib/cjs/components/livechatwidget/common/endChat.js +197 -99
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +41 -21
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +11 -8
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +139 -0
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -255
- package/lib/cjs/components/livechatwidget/common/startChat.js +85 -69
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +162 -100
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +2 -2
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +18 -8
- package/lib/cjs/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -2
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -4
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +62 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +8 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +25 -12
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +7 -1
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +2 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +16 -13
- package/lib/cjs/contexts/createReducer.js +13 -23
- package/lib/cjs/controller/componentController.js +2 -1
- package/lib/cjs/index.js +20 -0
- package/lib/esm/common/Constants.js +49 -0
- package/lib/esm/common/storage/default/defaultCacheManager.js +5 -4
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +9 -7
- package/lib/esm/common/telemetry/TelemetryConstants.js +7 -1
- package/lib/esm/common/utils.js +25 -4
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -13
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -6
- package/lib/esm/components/footerstateful/FooterStateful.js +1 -1
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +14 -13
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/Deferred.js +2 -3
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +11 -3
- package/lib/esm/components/livechatwidget/common/endChat.js +196 -99
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +41 -21
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +11 -8
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +130 -0
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -255
- package/lib/esm/components/livechatwidget/common/startChat.js +86 -70
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +164 -102
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +2 -2
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +18 -8
- package/lib/esm/components/postchatsurveypanestateful/common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps.js +1 -2
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -4
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.js +54 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +8 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware.js +25 -12
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +7 -1
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +2 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -15
- package/lib/esm/contexts/createReducer.js +13 -23
- package/lib/esm/controller/componentController.js +2 -1
- package/lib/esm/index.js +4 -1
- package/lib/types/common/Constants.d.ts +21 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +3 -3
- package/lib/types/common/storage/default/defaultCacheManager.d.ts +2 -1
- package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +7 -1
- package/lib/types/common/utils.d.ts +3 -2
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +6 -0
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -6
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer.d.ts +9 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +8 -7
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +3 -1
- package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +2 -1
- package/lib/types/index.d.ts +3 -0
- package/package.json +2 -1
- package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +0 -36
- package/lib/cjs/contexts/common/ConversationEndEntity.js +0 -12
- package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +0 -30
- package/lib/esm/contexts/common/ConversationEndEntity.js +0 -5
- package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +0 -6
- package/lib/types/contexts/common/ConversationEndEntity.d.ts +0 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HtmlAttributeNames, Regex } from "../../common/Constants";
|
|
2
2
|
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
|
+
import { extractPreChatSurveyResponseValues, findAllFocusableElement, getStateFromCache, getWidgetCacheId, isUndefinedOrEmpty, parseAdaptiveCardPayload } from "../../common/utils";
|
|
4
5
|
import MarkdownIt from "markdown-it";
|
|
5
|
-
import { extractPreChatSurveyResponseValues, findAllFocusableElement, getStateFromCache, isUndefinedOrEmpty, parseAdaptiveCardPayload } from "../../common/utils";
|
|
6
6
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
7
7
|
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
8
8
|
import { PreChatSurveyPane } from "@microsoft/omnichannel-chat-components";
|
|
@@ -67,12 +67,13 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
67
67
|
payload: ConversationState.Loading
|
|
68
68
|
});
|
|
69
69
|
try {
|
|
70
|
-
var _state$domainStates, _state$domainStates$t, _state$domainStates$t2, _persistedState$domai, _persistedState$appSt;
|
|
71
|
-
const
|
|
70
|
+
var _state$domainStates, _state$domainStates$t, _state$domainStates$t2, _persistedState$domai, _persistedState$appSt, _state$appStates;
|
|
71
|
+
const widgetInstanceId = getWidgetCacheId(((_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$t = _state$domainStates.telemetryInternalData) === null || _state$domainStates$t === void 0 ? void 0 : _state$domainStates$t.orgId) ?? "", ((_state$domainStates$t2 = state.domainStates.telemetryInternalData) === null || _state$domainStates$t2 === void 0 ? void 0 : _state$domainStates$t2.widgetId) ?? "", state.domainStates.widgetInstanceId ?? "");
|
|
72
|
+
const persistedState = getStateFromCache(widgetInstanceId);
|
|
72
73
|
let optionalParams = {};
|
|
73
74
|
|
|
74
75
|
//Connect to Active chats and chat is not popout
|
|
75
|
-
if (persistedState && !isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai = persistedState.domainStates) === null || _persistedState$domai === void 0 ? void 0 : _persistedState$domai.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt = persistedState.appStates) === null || _persistedState$appSt === void 0 ? void 0 : _persistedState$appSt.conversationState) === ConversationState.Active && state.appStates.hideStartChatButton === false) {
|
|
76
|
+
if (persistedState && !isUndefinedOrEmpty(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai = persistedState.domainStates) === null || _persistedState$domai === void 0 ? void 0 : _persistedState$domai.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt = persistedState.appStates) === null || _persistedState$appSt === void 0 ? void 0 : _persistedState$appSt.conversationState) === ConversationState.Active && (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.hideStartChatButton) === false) {
|
|
76
77
|
var _persistedState$domai2;
|
|
77
78
|
optionalParams = {
|
|
78
79
|
liveChatContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai2 = persistedState.domainStates) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.liveChatContext
|
|
@@ -31,7 +31,10 @@ export const ReconnectChatPaneStateful = props => {
|
|
|
31
31
|
type: LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
32
32
|
payload: undefined
|
|
33
33
|
});
|
|
34
|
-
|
|
34
|
+
if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.initialChatSdkRequestId) {
|
|
35
|
+
var _state$domainStates2;
|
|
36
|
+
chatSDK.requestId = state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.initialChatSdkRequestId;
|
|
37
|
+
}
|
|
35
38
|
const parseToJson = false;
|
|
36
39
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
37
40
|
if (preChatSurveyResponse) {
|
|
@@ -9,6 +9,7 @@ export const defaultWebChatContainerStatefulProps = {
|
|
|
9
9
|
containerStyles: defaultWebChatStatefulContainerStyles,
|
|
10
10
|
disableNewLineMarkdownSupport: false,
|
|
11
11
|
disableMarkdownMessageFormatting: false,
|
|
12
|
+
hyperlinkTextOverride: false,
|
|
12
13
|
directLine: new MockAdapter(),
|
|
13
14
|
adaptiveCardStyles: defaultAdaptiveCardStyles
|
|
14
15
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
import { ParticipantType } from "../../../common/Constants";
|
|
4
5
|
import MockAdapter from "./mockadapter";
|
|
5
6
|
export class MockChatSDK {
|
|
6
7
|
constructor() {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
9
|
_defineProperty(this, "sleep", ms => new Promise(r => setTimeout(r, ms)));
|
|
8
10
|
_defineProperty(this, "isMockModeOn", true);
|
|
9
11
|
}
|
|
@@ -26,7 +28,10 @@ export class MockChatSDK {
|
|
|
26
28
|
}
|
|
27
29
|
getConversationDetails() {
|
|
28
30
|
return {
|
|
29
|
-
State: "Active"
|
|
31
|
+
State: "Active",
|
|
32
|
+
conversationId: "",
|
|
33
|
+
canRenderPostChat: "",
|
|
34
|
+
participantType: ParticipantType.User
|
|
30
35
|
};
|
|
31
36
|
}
|
|
32
37
|
getCurrentLiveChatContext() {
|
|
@@ -2,4 +2,5 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
4
|
export class WebChatStoreLoader {}
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
6
|
_defineProperty(WebChatStoreLoader, "store", void 0);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
import DOMPurify from "dompurify";
|
|
5
|
+
import { HtmlAttributeNames } from "../../../../common/Constants";
|
|
6
|
+
class HyperlinkTextOverrideRenderer {
|
|
7
|
+
constructor(hyperlinkTextOverride) {
|
|
8
|
+
_defineProperty(this, "hyperlinkTextOverride", void 0);
|
|
9
|
+
this.hyperlinkTextOverride = hyperlinkTextOverride;
|
|
10
|
+
}
|
|
11
|
+
convertTextToHtmlNode(text) {
|
|
12
|
+
const htmlNode = document.createElement(HtmlAttributeNames.div);
|
|
13
|
+
try {
|
|
14
|
+
text = DOMPurify.sanitize(text); // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
15
|
+
htmlNode.innerHTML = text;
|
|
16
|
+
} catch {
|
|
17
|
+
return htmlNode;
|
|
18
|
+
}
|
|
19
|
+
return htmlNode;
|
|
20
|
+
}
|
|
21
|
+
processANode(htmlNode) {
|
|
22
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
23
|
+
const aTags = htmlNode.getElementsByTagName(HtmlAttributeNames.aTagName);
|
|
24
|
+
for (let index = 0; index < aTags.length; index++) {
|
|
25
|
+
const aNode = aTags[index];
|
|
26
|
+
if (!aNode || !aNode.tagName || aNode.tagName.toLowerCase() !== HtmlAttributeNames.aTagName || !aNode.href) continue;
|
|
27
|
+
if (aNode.href !== aNode.text.trim()) {
|
|
28
|
+
aNode.text = aNode.href;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
applicable(text) {
|
|
33
|
+
if (!this.hyperlinkTextOverride) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const htmlNode = this.convertTextToHtmlNode(text);
|
|
38
|
+
const aNodes = htmlNode.getElementsByTagName(HtmlAttributeNames.aTagName);
|
|
39
|
+
return !!aNodes && aNodes.length && aNodes.length > 0;
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
render(text) {
|
|
45
|
+
if (!this.applicable(text)) {
|
|
46
|
+
return text;
|
|
47
|
+
}
|
|
48
|
+
const htmlNode = this.convertTextToHtmlNode(text);
|
|
49
|
+
this.processANode(htmlNode);
|
|
50
|
+
text = htmlNode.innerHTML;
|
|
51
|
+
return text;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export default HyperlinkTextOverrideRenderer;
|
|
@@ -18,13 +18,15 @@ const createConversationEndMiddleware = conversationEndCallback => _ref => {
|
|
|
18
18
|
return next => action => {
|
|
19
19
|
var _action$payload;
|
|
20
20
|
if ((action === null || action === void 0 ? void 0 : action.type) == WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
|
|
21
|
-
var _activity$
|
|
21
|
+
var _activity$from2, _activity$channelData7, _activity$channelData8;
|
|
22
22
|
const activity = action.payload.activity;
|
|
23
|
-
if (
|
|
24
|
-
var _activity$
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
if (activity.channelId === "ACS_CHANNEL") {
|
|
24
|
+
var _activity$from;
|
|
25
|
+
if (((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === DirectLineSenderRole.Bot) {
|
|
26
|
+
var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
|
|
27
|
+
if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(Constants.systemMessageTag) && ((_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(Constants.agentEndConversationMessageTag) || (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(Constants.supervisorForceCloseMessageTag))) {
|
|
28
|
+
conversationEndCallback();
|
|
29
|
+
}
|
|
28
30
|
}
|
|
29
31
|
} else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === DirectLineSenderRole.Channel && ((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.type) === MessageTypes.Thread && (_activity$channelData8 = activity.channelData) !== null && _activity$channelData8 !== void 0 && _activity$channelData8.properties) {
|
|
30
32
|
var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
|
|
@@ -22,22 +22,25 @@ const applyDataMasking = (action, regexCollection) => {
|
|
|
22
22
|
});
|
|
23
23
|
return action;
|
|
24
24
|
}
|
|
25
|
-
let isRuleMatched = false;
|
|
26
25
|
for (const ruleId of Object.keys(regexCollection)) {
|
|
27
26
|
const item = regexCollection[ruleId];
|
|
28
27
|
if (item) {
|
|
28
|
+
let ruleInfiniteException = false;
|
|
29
|
+
let ruleApplied = false;
|
|
29
30
|
try {
|
|
30
31
|
const regex = new RegExp(item, "gi");
|
|
31
32
|
let match;
|
|
32
33
|
// eslint-disable-next-line no-cond-assign
|
|
33
34
|
while (match = regex.exec(text)) {
|
|
34
35
|
const replaceStr = match[0].replace(/./gi, maskedChar);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const modifiedText = text.replace(match[0], replaceStr);
|
|
37
|
+
if (modifiedText == text) {
|
|
38
|
+
ruleInfiniteException = true;
|
|
39
|
+
console.warn(`The data masking rule ${item} is ignored because it matches empty strings. Please modify this rule.`);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
ruleApplied = true;
|
|
43
|
+
text = modifiedText;
|
|
41
44
|
}
|
|
42
45
|
} catch (err) {
|
|
43
46
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
@@ -48,11 +51,21 @@ const applyDataMasking = (action, regexCollection) => {
|
|
|
48
51
|
}
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
if (ruleApplied) {
|
|
55
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
56
|
+
Event: TelemetryEvent.DataMaskingRuleApplied,
|
|
57
|
+
Description: `Data Masking Rule Id: ${ruleId} applied.`
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (ruleInfiniteException) {
|
|
61
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
62
|
+
Event: TelemetryEvent.DataMaskingRuleApplyFailed,
|
|
63
|
+
ExceptionDetails: {
|
|
64
|
+
RuleId: ruleId,
|
|
65
|
+
Exception: "The data masking rule matches empty strings."
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
56
69
|
}
|
|
57
70
|
}
|
|
58
71
|
action.payload.text = text;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { LogLevel } from "../../../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import { TelemetryHelper } from "../../../../common/telemetry/TelemetryHelper";
|
|
3
3
|
export function createWebChatTelemetry() {
|
|
4
|
+
let isInitEventLogged = false;
|
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
6
|
const handleTelemetry = event => {
|
|
6
7
|
const {
|
|
7
|
-
level
|
|
8
|
+
level,
|
|
9
|
+
name
|
|
8
10
|
} = event;
|
|
9
11
|
const loglevel = level ? level.toUpperCase() : "";
|
|
12
|
+
if ((name === null || name === void 0 ? void 0 : name.toLowerCase()) === "init" && isInitEventLogged) return;
|
|
10
13
|
switch (loglevel) {
|
|
11
14
|
case LogLevel.DEBUG:
|
|
12
15
|
TelemetryHelper.logWebChatEvent(LogLevel.DEBUG, event);
|
|
@@ -22,6 +25,9 @@ export function createWebChatTelemetry() {
|
|
|
22
25
|
TelemetryHelper.logWebChatEvent(LogLevel.INFO, event);
|
|
23
26
|
break;
|
|
24
27
|
}
|
|
28
|
+
if ((name === null || name === void 0 ? void 0 : name.toLowerCase()) === "init") {
|
|
29
|
+
isInitEventLogged = true;
|
|
30
|
+
}
|
|
25
31
|
};
|
|
26
32
|
return handleTelemetry;
|
|
27
33
|
}
|
|
@@ -41,4 +41,6 @@ export let LiveChatWidgetActionType;
|
|
|
41
41
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 38] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
|
|
42
42
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 39] = "SET_SHOULD_USE_BOT_SURVEY";
|
|
43
43
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 40] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
|
|
44
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 41] = "SET_SURVEY_MODE";
|
|
45
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 42] = "SET_CONFIRMATION_STATE";
|
|
44
46
|
})(LiveChatWidgetActionType || (LiveChatWidgetActionType = {}));
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { ConversationState } from "./ConversationState";
|
|
2
2
|
import { defaultMiddlewareLocalizedTexts } from "../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
|
|
3
|
-
import {
|
|
3
|
+
import { getWidgetCacheIdfromProps, isNullOrUndefined } from "../../common/utils";
|
|
4
4
|
import { defaultClientDataStoreProvider } from "../../common/storage/default/defaultClientDataStoreProvider";
|
|
5
|
-
import { Constants } from "../../common/Constants";
|
|
5
|
+
import { ConfirmationState, Constants, ConversationEndEntity, StorageType } from "../../common/Constants";
|
|
6
6
|
export const getLiveChatWidgetContextInitialState = props => {
|
|
7
|
-
var _props$
|
|
8
|
-
const widgetCacheId =
|
|
9
|
-
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$
|
|
10
|
-
const
|
|
7
|
+
var _props$controlProps, _props$webChatContain;
|
|
8
|
+
const widgetCacheId = getWidgetCacheIdfromProps(props);
|
|
9
|
+
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.cacheTtlInMins) ?? Constants.CacheTtlInMinutes;
|
|
10
|
+
const storageType = (props === null || props === void 0 ? void 0 : props.useSessionStorage) === true ? StorageType.sessionStorage : StorageType.localStorage;
|
|
11
|
+
const initialState = defaultClientDataStoreProvider(cacheTtlInMins, storageType).getData(widgetCacheId);
|
|
11
12
|
if (!isNullOrUndefined(initialState)) {
|
|
12
|
-
|
|
13
|
+
const initialStateFromCache = JSON.parse(initialState);
|
|
14
|
+
return initialStateFromCache;
|
|
13
15
|
}
|
|
14
16
|
const LiveChatWidgetContextInitialState = {
|
|
15
17
|
domainStates: {
|
|
@@ -26,13 +28,16 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
26
28
|
customContext: undefined,
|
|
27
29
|
widgetSize: undefined,
|
|
28
30
|
widgetInstanceId: "",
|
|
29
|
-
initialChatSdkRequestId: ""
|
|
31
|
+
initialChatSdkRequestId: "",
|
|
32
|
+
transcriptRequestId: "",
|
|
33
|
+
confirmationPaneConfirmedOptionClicked: false,
|
|
34
|
+
confirmationState: ConfirmationState.NotSet
|
|
30
35
|
},
|
|
31
36
|
appStates: {
|
|
32
37
|
conversationState: ConversationState.Closed,
|
|
33
|
-
isMinimized:
|
|
38
|
+
isMinimized: undefined,
|
|
34
39
|
previousElementIdOnFocusBeforeModalOpen: null,
|
|
35
|
-
|
|
40
|
+
startChatFailed: false,
|
|
36
41
|
outsideOperatingHours: false,
|
|
37
42
|
preChatResponseEmail: "",
|
|
38
43
|
isAudioMuted: null,
|
|
@@ -46,11 +51,9 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
46
51
|
},
|
|
47
52
|
e2vvEnabled: false,
|
|
48
53
|
unreadMessageCount: 0,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
shouldUseBotSurvey: false,
|
|
53
|
-
chatDisconnectEventReceived: false
|
|
54
|
+
conversationEndedBy: ConversationEndEntity.NotSet,
|
|
55
|
+
chatDisconnectEventReceived: false,
|
|
56
|
+
selectedSurveyMode: null
|
|
54
57
|
},
|
|
55
58
|
uiStates: {
|
|
56
59
|
showConfirmationPane: false,
|
|
@@ -58,7 +58,7 @@ export const createReducer = () => {
|
|
|
58
58
|
...state,
|
|
59
59
|
appStates: {
|
|
60
60
|
...state.appStates,
|
|
61
|
-
|
|
61
|
+
startChatFailed: action.payload
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
case LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
|
|
@@ -258,14 +258,6 @@ export const createReducer = () => {
|
|
|
258
258
|
return {
|
|
259
259
|
...action.payload
|
|
260
260
|
};
|
|
261
|
-
case LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED:
|
|
262
|
-
return {
|
|
263
|
-
...state,
|
|
264
|
-
appStates: {
|
|
265
|
-
...state.appStates,
|
|
266
|
-
conversationEndedByAgentEventReceived: action.payload
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
261
|
case LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY:
|
|
270
262
|
return {
|
|
271
263
|
...state,
|
|
@@ -301,15 +293,6 @@ export const createReducer = () => {
|
|
|
301
293
|
liveChatConfig: action.payload
|
|
302
294
|
}
|
|
303
295
|
};
|
|
304
|
-
case LiveChatWidgetActionType.SET_POST_CHAT_WORKFLOW_IN_PROGRESS:
|
|
305
|
-
return {
|
|
306
|
-
...state,
|
|
307
|
-
appStates: {
|
|
308
|
-
...state.appStates,
|
|
309
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
310
|
-
postChatWorkflowInProgress: action.payload
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
296
|
case LiveChatWidgetActionType.SET_INITIAL_CHAT_SDK_REQUEST_ID:
|
|
314
297
|
return {
|
|
315
298
|
...state,
|
|
@@ -318,21 +301,28 @@ export const createReducer = () => {
|
|
|
318
301
|
initialChatSdkRequestId: action.payload
|
|
319
302
|
}
|
|
320
303
|
};
|
|
321
|
-
case LiveChatWidgetActionType.
|
|
304
|
+
case LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED:
|
|
322
305
|
return {
|
|
323
306
|
...state,
|
|
324
307
|
appStates: {
|
|
325
308
|
...state.appStates,
|
|
326
|
-
|
|
327
|
-
shouldUseBotSurvey: action.payload
|
|
309
|
+
chatDisconnectEventReceived: action.payload
|
|
328
310
|
}
|
|
329
311
|
};
|
|
330
|
-
case LiveChatWidgetActionType.
|
|
312
|
+
case LiveChatWidgetActionType.SET_SURVEY_MODE:
|
|
331
313
|
return {
|
|
332
314
|
...state,
|
|
333
315
|
appStates: {
|
|
334
316
|
...state.appStates,
|
|
335
|
-
|
|
317
|
+
selectedSurveyMode: action.payload
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
case LiveChatWidgetActionType.SET_CONFIRMATION_STATE:
|
|
321
|
+
return {
|
|
322
|
+
...state,
|
|
323
|
+
domainStates: {
|
|
324
|
+
...state.domainStates,
|
|
325
|
+
confirmationState: action.payload
|
|
336
326
|
}
|
|
337
327
|
};
|
|
338
328
|
default:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ConversationState } from "../contexts/common/ConversationState";
|
|
2
2
|
export const shouldShowChatButton = state => {
|
|
3
|
-
|
|
3
|
+
var _state$appStates;
|
|
4
|
+
return (state.appStates.isMinimized || state.appStates.conversationState === ConversationState.Closed) && (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.hideStartChatButton) === false; // Do not show chat button in case of popout
|
|
4
5
|
};
|
|
5
6
|
|
|
6
7
|
export const shouldShowProactiveChatPane = state => {
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BroadcastService, decodeComponentString, encodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
2
2
|
import useChatContextStore from "./hooks/useChatContextStore";
|
|
3
3
|
import useChatSDKStore from "./hooks/useChatSDKStore";
|
|
4
|
+
import { getWidgetCacheId, getWidgetEndChatEventName } from "./common/utils";
|
|
5
|
+
import { ConversationState } from "./contexts/common/ConversationState";
|
|
4
6
|
export { default as LiveChatWidget } from "./components/livechatwidget/LiveChatWidget";
|
|
5
|
-
export { encodeComponentString, decodeComponentString, BroadcastService, useChatSDKStore, useChatContextStore };
|
|
7
|
+
export { encodeComponentString, decodeComponentString, BroadcastService, useChatSDKStore, useChatContextStore };
|
|
8
|
+
export { getWidgetCacheId, getWidgetEndChatEventName, ConversationState };
|
|
@@ -81,6 +81,8 @@ export declare class Constants {
|
|
|
81
81
|
static readonly PostChatLoadingDurationInMs = 2000;
|
|
82
82
|
static readonly BrowserUnloadConfirmationMessage = "Do you want to leave chat?";
|
|
83
83
|
static readonly CacheTtlInMinutes = 15;
|
|
84
|
+
static readonly SessionCacheSuffix = "session";
|
|
85
|
+
static readonly PopoutCacheSuffix = "popout";
|
|
84
86
|
static readonly LWICheckOnVisibilityTimeout: number;
|
|
85
87
|
}
|
|
86
88
|
export declare const Regex: {
|
|
@@ -172,6 +174,25 @@ export declare enum LiveWorkItemState {
|
|
|
172
174
|
Waiting = "Waiting",
|
|
173
175
|
WrapUp = "WrapUp"
|
|
174
176
|
}
|
|
177
|
+
export declare enum StorageType {
|
|
178
|
+
"localStorage" = 0,
|
|
179
|
+
"sessionStorage" = 1
|
|
180
|
+
}
|
|
181
|
+
export declare enum ParticipantType {
|
|
182
|
+
User = "User",
|
|
183
|
+
Bot = "Bot"
|
|
184
|
+
}
|
|
185
|
+
export declare enum ConversationEndEntity {
|
|
186
|
+
Customer = "Customer",
|
|
187
|
+
Agent = "Agent",
|
|
188
|
+
Bot = "Bot",
|
|
189
|
+
NotSet = "NotSet"
|
|
190
|
+
}
|
|
191
|
+
export declare enum ConfirmationState {
|
|
192
|
+
Ok = "Ok",
|
|
193
|
+
Cancel = "Cancel",
|
|
194
|
+
NotSet = "NotSet"
|
|
195
|
+
}
|
|
175
196
|
export declare class TranscriptConstants {
|
|
176
197
|
static readonly ChatTranscriptsBodyColor = "#F5F5F5";
|
|
177
198
|
static readonly TranscriptMessageEmojiMessageType = "http://schema.skype.com/emoji";
|
|
@@ -2,13 +2,13 @@ export interface IContextDataStore {
|
|
|
2
2
|
/**
|
|
3
3
|
* getData: Get data from data store
|
|
4
4
|
*/
|
|
5
|
-
getData: (key: string
|
|
5
|
+
getData: (key: string) => any;
|
|
6
6
|
/**
|
|
7
7
|
* setData: Set data to data store
|
|
8
8
|
*/
|
|
9
|
-
setData: (key: string, value: any
|
|
9
|
+
setData: (key: string, value: any) => void;
|
|
10
10
|
/**
|
|
11
11
|
* removeData: Remove data from data store by key
|
|
12
12
|
*/
|
|
13
|
-
removeData: (key: string
|
|
13
|
+
removeData: (key: string) => void;
|
|
14
14
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { StorageType } from "../../Constants";
|
|
1
2
|
export declare class defaultCacheManager {
|
|
2
3
|
static InternalCache: any;
|
|
3
4
|
}
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const registerBroadcastServiceForStorage: (widgetCacheId: string, ttlInMins: number, storageType: StorageType) => void;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { IContextDataStore } from "../../interfaces/IContextDataStore";
|
|
2
|
-
|
|
2
|
+
import { StorageType } from "../../Constants";
|
|
3
|
+
export declare const defaultClientDataStoreProvider: (cacheTtlinMins?: number, storageType?: StorageType) => IContextDataStore;
|
|
@@ -25,7 +25,6 @@ export declare enum BroadcastEvent {
|
|
|
25
25
|
StartProactiveChat = "StartProactiveChat",
|
|
26
26
|
ProactiveChatStartChat = "ProactiveChatStartChat",
|
|
27
27
|
ProactiveChatStartPopoutChat = "ProactiveChatStartPopoutChat",
|
|
28
|
-
ProactiveChatIsInPopoutMode = "ProactiveChatIsInPopoutMode",
|
|
29
28
|
ResetProactiveChatParams = "ResetProactiveChatParams",
|
|
30
29
|
InvalidAdaptiveCardFormat = "InvalidAdaptiveCardFormat",
|
|
31
30
|
NewMessageSent = "NewMessageSent",
|
|
@@ -48,6 +47,8 @@ export declare enum BroadcastEvent {
|
|
|
48
47
|
SigninCardReceived = "SignInCardReceived",
|
|
49
48
|
BotAuthConfigRequest = "BotAuthConfigRequest",
|
|
50
49
|
BotAuthConfigResponse = "BotAuthConfigResponse",
|
|
50
|
+
RemoveWidgetDataFromCache = "RemoveWidgetDataFromCache",
|
|
51
|
+
InitiateStartChatInPopoutMode = "InitiateStartChatInPopoutMode",
|
|
51
52
|
HideChatVisibilityChangeEvent = "hideChatVisibilityChangeEvent",
|
|
52
53
|
UpdateSessionDataForTelemetry = "UpdateSessionDataForTelemetry",
|
|
53
54
|
UpdateConversationDataForTelemetry = "UpdateConversationDataForTelemetry"
|
|
@@ -82,13 +83,18 @@ export declare enum TelemetryEvent {
|
|
|
82
83
|
CallingSDKInitFailed = "CallingSDKInitFailed",
|
|
83
84
|
CallingSDKLoadSuccess = "CallingSDKLoadSuccess",
|
|
84
85
|
CallingSDKLoadFailed = "CallingSDKLoadFailed",
|
|
86
|
+
GetConversationDetailsCallStarted = "GetConversationDetailsCallStarted",
|
|
85
87
|
GetConversationDetailsCallFailed = "GetConversationDetailsCallFailed",
|
|
86
88
|
EndChatSDKCallFailed = "EndChatSDKCallFailed",
|
|
89
|
+
GetChatReconnectContextSDKCallStarted = "GetChatReconnectContextSDKCallStarted",
|
|
87
90
|
GetChatReconnectContextSDKCallFailed = "GetChatReconnectContextSDKCallFailed",
|
|
88
91
|
ParseAdaptiveCardFailed = "ParseAdaptiveCardFailed",
|
|
89
92
|
ClientDataStoreProviderFailed = "ClientDataStoreProviderFailed",
|
|
90
93
|
InMemoryDataStoreFailed = "InMemoryDataStoreFailed",
|
|
91
94
|
ChatVisibilityChanged = "ChatVisibilityChanged",
|
|
95
|
+
EndChatSucceeded = "EndChatSucceeded",
|
|
96
|
+
EndChatFailed = "EndChatFailed",
|
|
97
|
+
SetCustomContext = "SetCustomContext",
|
|
92
98
|
WebChatLoaded = "WebChatLoaded",
|
|
93
99
|
LCWChatButtonClicked = "LCWChatButtonClicked",
|
|
94
100
|
LCWChatButtonShow = "LCWChatButtonShow",
|
|
@@ -22,11 +22,12 @@ export declare const isNullOrEmptyString: (s: string | null) => boolean;
|
|
|
22
22
|
export declare const newGuid: () => string;
|
|
23
23
|
export declare const createTimer: () => ITimer;
|
|
24
24
|
export declare const getDomain: (hostValue: any) => string;
|
|
25
|
-
export declare const getWidgetCacheId: (orgId: string, widgetId: string, widgetInstanceId: string) => string;
|
|
25
|
+
export declare const getWidgetCacheId: (orgId: string, widgetId: string, widgetInstanceId: string, popoutChat?: boolean) => string;
|
|
26
26
|
export declare const getWidgetEndChatEventName: (orgId: string, widgetId: string, widgetInstanceId: string) => string;
|
|
27
|
-
export declare const getStateFromCache: (
|
|
27
|
+
export declare const getStateFromCache: (widgetCacheId: string) => any;
|
|
28
28
|
export declare const isUndefinedOrEmpty: (object: any) => boolean;
|
|
29
29
|
export declare const addDelayInMs: (ms: number) => Promise<void>;
|
|
30
30
|
export declare const getBroadcastChannelName: (widgetId: string, widgetInstanceId: string) => string;
|
|
31
|
+
export declare const getWidgetCacheIdfromProps: (props: any, popoutChat?: boolean) => string;
|
|
31
32
|
export declare const debounceLeading: (fn: any, ms?: number) => (...args: any[]) => void;
|
|
32
33
|
export declare const getConversationDetailsCall: (chatSDK: any) => Promise<any>;
|
|
@@ -4,4 +4,10 @@ export interface IConfirmationPaneStatefulParams extends IConfirmationPaneStatef
|
|
|
4
4
|
* setPostChatContext: Internal Prop injected for setting Post Chat Context
|
|
5
5
|
*/
|
|
6
6
|
setPostChatContext: () => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* prepareEndChat: Internal Prop injected for checking PostChat contexts and trigerring end of chat
|
|
9
|
+
* @param adapter : The chat adapter for the live chat session
|
|
10
|
+
* @param state : The chat state where the conversation is currently in
|
|
11
|
+
*/
|
|
12
|
+
prepareEndChat: () => Promise<void>;
|
|
7
13
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
2
|
+
export declare const downloadTranscript: (chatSDK: any, renderMarkDown?: ((transcriptContent: string) => string) | undefined, bannerMessageOnError?: string | undefined, attachmentMessage?: string | undefined, state?: ILiveChatWidgetContext | undefined) => Promise<void>;
|
|
@@ -2,6 +2,7 @@ import { Dispatch } from "react";
|
|
|
2
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
3
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
4
4
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
5
|
-
declare const prepareEndChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any,
|
|
6
|
-
declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any,
|
|
7
|
-
|
|
5
|
+
declare const prepareEndChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, uwid: string) => Promise<void>;
|
|
6
|
+
declare const endChat: (props: ILiveChatWidgetProps, chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, setWebChatStyles: any, adapter: any, skipEndChatSDK?: boolean | undefined, skipCloseChat?: boolean | undefined, postMessageToOtherTab?: boolean | undefined, uwid?: string) => Promise<void>;
|
|
7
|
+
declare const getConversationDetails: (chatSDK: any) => Promise<any>;
|
|
8
|
+
export { prepareEndChat, endChat, getConversationDetails };
|
|
@@ -3,4 +3,4 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
3
3
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
4
4
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
5
|
import { IWebChatProps } from "../../webchatcontainerstateful/interfaces/IWebChatProps";
|
|
6
|
-
export declare const initWebChatComposer: (props: ILiveChatWidgetProps,
|
|
6
|
+
export declare const initWebChatComposer: (props: ILiveChatWidgetProps, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>, chatSDK: any) => IWebChatProps;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Dispatch } from "react";
|
|
2
|
+
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
|
+
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
4
|
+
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
|
+
declare const initiatePostChat: (props: ILiveChatWidgetProps, conversationDetailsParam: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
6
|
+
declare const isPostChatEnabled: (props: ILiveChatWidgetProps, state: ILiveChatWidgetContext) => boolean;
|
|
7
|
+
declare const getPostChatContext: (chatSDK: any, state: ILiveChatWidgetContext, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
8
|
+
declare const setWidgetStateToInactive: (dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<void>;
|
|
9
|
+
export { initiatePostChat, setWidgetStateToInactive, getPostChatContext, isPostChatEnabled as checkPostChatEnabled };
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { Dispatch } from "react";
|
|
2
2
|
import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetAction";
|
|
3
|
-
|
|
4
|
-
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
5
|
-
declare const setPostChatContextAndLoadSurvey: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, persistedChat?: boolean | undefined) => Promise<void>;
|
|
6
|
-
declare const checkPostChatEnabled: (props: ILiveChatWidgetProps, state: ILiveChatWidgetContext) => boolean;
|
|
7
|
-
declare const initiatePostChat: (props: ILiveChatWidgetProps, chatSDK: any, setAdapter: any, setWebChatStyles: any, dispatch: Dispatch<ILiveChatWidgetAction>, adapter: any, state: ILiveChatWidgetContext) => Promise<void>;
|
|
8
|
-
export { setPostChatContextAndLoadSurvey, checkPostChatEnabled, initiatePostChat };
|
|
3
|
+
export declare const setPostChatContextAndLoadSurvey: (chatSDK: any, dispatch: Dispatch<ILiveChatWidgetAction>, persistedChat?: boolean | undefined) => Promise<void>;
|
|
@@ -53,6 +53,8 @@ export interface ILiveChatWidgetProps {
|
|
|
53
53
|
liveChatContextFromCache?: ILiveChatWidgetContext;
|
|
54
54
|
contextDataStore?: IContextDataStore;
|
|
55
55
|
getAuthToken?: (authClientFunction?: string) => Promise<string | null>;
|
|
56
|
-
initialCustomContext?: any;
|
|
57
56
|
scrollBarProps?: IScrollBarProps;
|
|
57
|
+
useSessionStorage?: boolean;
|
|
58
|
+
allowSdkChatSupport?: boolean;
|
|
59
|
+
initialCustomContext?: any;
|
|
58
60
|
}
|