@microsoft/omnichannel-chat-widget 1.7.6-main.dca3f60 → 1.7.6
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/facades/FacadeChatSDK.js +14 -2
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +3 -2
- package/lib/cjs/components/livechatwidget/interfaces/IFeatureConfigProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +2 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +14 -2
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +3 -2
- package/lib/esm/components/livechatwidget/interfaces/IFeatureConfigProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +2 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -2
- package/lib/types/components/livechatwidget/interfaces/IFeatureConfigProps.d.ts +3 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +9 -7
- package/package.json +2 -2
|
@@ -26,7 +26,7 @@ class FacadeChatSDK {
|
|
|
26
26
|
isTokenSet() {
|
|
27
27
|
return !(0, _utils.isNullOrEmptyString)(this.token);
|
|
28
28
|
}
|
|
29
|
-
constructor(input) {
|
|
29
|
+
constructor(input, disableReauthentication) {
|
|
30
30
|
_defineProperty(this, "chatSDK", void 0);
|
|
31
31
|
_defineProperty(this, "chatConfig", void 0);
|
|
32
32
|
_defineProperty(this, "token", "");
|
|
@@ -34,11 +34,13 @@ class FacadeChatSDK {
|
|
|
34
34
|
_defineProperty(this, "isAuthenticated", void 0);
|
|
35
35
|
_defineProperty(this, "getAuthToken", void 0);
|
|
36
36
|
_defineProperty(this, "sdkMocked", void 0);
|
|
37
|
+
_defineProperty(this, "disableReauthentication", void 0);
|
|
37
38
|
this.chatSDK = input.chatSDK;
|
|
38
39
|
this.chatConfig = input.chatConfig;
|
|
39
40
|
this.getAuthToken = input.getAuthToken;
|
|
40
41
|
this.isAuthenticated = input.isAuthenticated;
|
|
41
42
|
this.sdkMocked = input.isSDKMocked;
|
|
43
|
+
this.disableReauthentication = disableReauthentication;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
//set default expiration to zero, for undefined or missed exp in jwt
|
|
@@ -103,6 +105,14 @@ class FacadeChatSDK {
|
|
|
103
105
|
}
|
|
104
106
|
}
|
|
105
107
|
async tokenRing() {
|
|
108
|
+
if (this.disableReauthentication === true) {
|
|
109
|
+
// facade feature is disabled, so we are bypassing the re authentication and let it fail.
|
|
110
|
+
return {
|
|
111
|
+
result: true,
|
|
112
|
+
message: "Facade is disabled"
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
106
116
|
// this is needed for storybooks, specifically for reconnect pane which requires authentication bypass
|
|
107
117
|
if (this.sdkMocked === true) {
|
|
108
118
|
return {
|
|
@@ -247,7 +257,9 @@ class FacadeChatSDK {
|
|
|
247
257
|
return this.validateAndExecuteCall("sendMessage", () => this.chatSDK.sendMessage(message));
|
|
248
258
|
}
|
|
249
259
|
async onNewMessage(onNewMessageCallback) {
|
|
250
|
-
let optionalParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
260
|
+
let optionalParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
261
|
+
disablePolling: false
|
|
262
|
+
};
|
|
251
263
|
return this.validateAndExecuteCall("onNewMessage", () => this.chatSDK.onNewMessage(onNewMessageCallback, optionalParams));
|
|
252
264
|
}
|
|
253
265
|
async sendTypingEvent() {
|
|
@@ -20,13 +20,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
20
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
22
|
const LiveChatWidget = props => {
|
|
23
|
-
var _props$mock, _props$chatConfig, _props$chatConfig$Liv;
|
|
23
|
+
var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv;
|
|
24
24
|
const reducer = (0, _createReducer.createReducer)();
|
|
25
25
|
const [state, dispatch] = (0, _react.useReducer)(reducer, (0, _LiveChatWidgetContextInitialState.getLiveChatWidgetContextInitialState)(props));
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
27
|
const [adapter, setAdapter] = (0, _react.useState)(undefined);
|
|
28
28
|
const [facadeChatSDK, setFacadeChatSDK] = (0, _react.useState)(undefined);
|
|
29
29
|
const chatSDK = (0, _getMockChatSDKIfApplicable.getMockChatSDKIfApplicable)(props.chatSDK, props === null || props === void 0 ? void 0 : (_props$mock = props.mock) === null || _props$mock === void 0 ? void 0 : _props$mock.type);
|
|
30
|
+
const disableReauthentication = ((_props$featureConfigP = props.featureConfigProps) === null || _props$featureConfigP === void 0 ? void 0 : _props$featureConfigP.disableReauthentication) === true;
|
|
30
31
|
(0, _overridePropsOnMockIfApplicable.default)(props);
|
|
31
32
|
if (!props.chatConfig) {
|
|
32
33
|
throw new Error("chatConfig is required");
|
|
@@ -43,7 +44,7 @@ const LiveChatWidget = props => {
|
|
|
43
44
|
"getAuthToken": props === null || props === void 0 ? void 0 : props.getAuthToken,
|
|
44
45
|
//when type is not undefined, it means the SDK is mocked
|
|
45
46
|
"isSDKMocked": !(0, _utils.isNullOrUndefined)(props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type)
|
|
46
|
-
}));
|
|
47
|
+
}, disableReauthentication));
|
|
47
48
|
}
|
|
48
49
|
return /*#__PURE__*/_react.default.createElement(_FacadeChatSDKStore.FacadeChatSDKStore.Provider, {
|
|
49
50
|
value: [facadeChatSDK, setFacadeChatSDK]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -588,6 +588,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
588
588
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
589
589
|
eventName: _TelemetryConstants.BroadcastEvent.NewMessageNotification
|
|
590
590
|
});
|
|
591
|
+
}, {
|
|
592
|
+
disablePolling: true
|
|
591
593
|
});
|
|
592
594
|
facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.onAgentEndSession(event => {
|
|
593
595
|
var _inMemoryState$appSta6;
|
|
@@ -20,7 +20,7 @@ export class FacadeChatSDK {
|
|
|
20
20
|
isTokenSet() {
|
|
21
21
|
return !isNullOrEmptyString(this.token);
|
|
22
22
|
}
|
|
23
|
-
constructor(input) {
|
|
23
|
+
constructor(input, disableReauthentication) {
|
|
24
24
|
_defineProperty(this, "chatSDK", void 0);
|
|
25
25
|
_defineProperty(this, "chatConfig", void 0);
|
|
26
26
|
_defineProperty(this, "token", "");
|
|
@@ -28,11 +28,13 @@ export class FacadeChatSDK {
|
|
|
28
28
|
_defineProperty(this, "isAuthenticated", void 0);
|
|
29
29
|
_defineProperty(this, "getAuthToken", void 0);
|
|
30
30
|
_defineProperty(this, "sdkMocked", void 0);
|
|
31
|
+
_defineProperty(this, "disableReauthentication", void 0);
|
|
31
32
|
this.chatSDK = input.chatSDK;
|
|
32
33
|
this.chatConfig = input.chatConfig;
|
|
33
34
|
this.getAuthToken = input.getAuthToken;
|
|
34
35
|
this.isAuthenticated = input.isAuthenticated;
|
|
35
36
|
this.sdkMocked = input.isSDKMocked;
|
|
37
|
+
this.disableReauthentication = disableReauthentication;
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
//set default expiration to zero, for undefined or missed exp in jwt
|
|
@@ -97,6 +99,14 @@ export class FacadeChatSDK {
|
|
|
97
99
|
}
|
|
98
100
|
}
|
|
99
101
|
async tokenRing() {
|
|
102
|
+
if (this.disableReauthentication === true) {
|
|
103
|
+
// facade feature is disabled, so we are bypassing the re authentication and let it fail.
|
|
104
|
+
return {
|
|
105
|
+
result: true,
|
|
106
|
+
message: "Facade is disabled"
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
100
110
|
// this is needed for storybooks, specifically for reconnect pane which requires authentication bypass
|
|
101
111
|
if (this.sdkMocked === true) {
|
|
102
112
|
return {
|
|
@@ -241,7 +251,9 @@ export class FacadeChatSDK {
|
|
|
241
251
|
return this.validateAndExecuteCall("sendMessage", () => this.chatSDK.sendMessage(message));
|
|
242
252
|
}
|
|
243
253
|
async onNewMessage(onNewMessageCallback) {
|
|
244
|
-
let optionalParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
254
|
+
let optionalParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
255
|
+
disablePolling: false
|
|
256
|
+
};
|
|
245
257
|
return this.validateAndExecuteCall("onNewMessage", () => this.chatSDK.onNewMessage(onNewMessageCallback, optionalParams));
|
|
246
258
|
}
|
|
247
259
|
async sendTypingEvent() {
|
|
@@ -11,13 +11,14 @@ import { getMockChatSDKIfApplicable } from "./common/getMockChatSDKIfApplicable"
|
|
|
11
11
|
import { isNullOrUndefined } from "../../common/utils";
|
|
12
12
|
import overridePropsOnMockIfApplicable from "./common/overridePropsOnMockIfApplicable";
|
|
13
13
|
export const LiveChatWidget = props => {
|
|
14
|
-
var _props$mock, _props$chatConfig, _props$chatConfig$Liv;
|
|
14
|
+
var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv;
|
|
15
15
|
const reducer = createReducer();
|
|
16
16
|
const [state, dispatch] = useReducer(reducer, getLiveChatWidgetContextInitialState(props));
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
18
|
const [adapter, setAdapter] = useState(undefined);
|
|
19
19
|
const [facadeChatSDK, setFacadeChatSDK] = useState(undefined);
|
|
20
20
|
const chatSDK = getMockChatSDKIfApplicable(props.chatSDK, props === null || props === void 0 ? void 0 : (_props$mock = props.mock) === null || _props$mock === void 0 ? void 0 : _props$mock.type);
|
|
21
|
+
const disableReauthentication = ((_props$featureConfigP = props.featureConfigProps) === null || _props$featureConfigP === void 0 ? void 0 : _props$featureConfigP.disableReauthentication) === true;
|
|
21
22
|
overridePropsOnMockIfApplicable(props);
|
|
22
23
|
if (!props.chatConfig) {
|
|
23
24
|
throw new Error("chatConfig is required");
|
|
@@ -34,7 +35,7 @@ export const LiveChatWidget = props => {
|
|
|
34
35
|
"getAuthToken": props === null || props === void 0 ? void 0 : props.getAuthToken,
|
|
35
36
|
//when type is not undefined, it means the SDK is mocked
|
|
36
37
|
"isSDKMocked": !isNullOrUndefined(props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type)
|
|
37
|
-
}));
|
|
38
|
+
}, disableReauthentication));
|
|
38
39
|
}
|
|
39
40
|
return /*#__PURE__*/React.createElement(FacadeChatSDKStore.Provider, {
|
|
40
41
|
value: [facadeChatSDK, setFacadeChatSDK]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -580,6 +580,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
580
580
|
BroadcastService.postMessage({
|
|
581
581
|
eventName: BroadcastEvent.NewMessageNotification
|
|
582
582
|
});
|
|
583
|
+
}, {
|
|
584
|
+
disablePolling: true
|
|
583
585
|
});
|
|
584
586
|
facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.onAgentEndSession(event => {
|
|
585
587
|
var _inMemoryState$appSta6;
|
|
@@ -32,11 +32,12 @@ export declare class FacadeChatSDK {
|
|
|
32
32
|
private isAuthenticated;
|
|
33
33
|
private getAuthToken?;
|
|
34
34
|
private sdkMocked;
|
|
35
|
+
private disableReauthentication;
|
|
35
36
|
isSDKMocked(): boolean;
|
|
36
37
|
getChatSDK(): OmnichannelChatSDK;
|
|
37
38
|
destroy(): void;
|
|
38
39
|
isTokenSet(): boolean;
|
|
39
|
-
constructor(input: IFacadeChatSDKInput);
|
|
40
|
+
constructor(input: IFacadeChatSDKInput, disableReauthentication: boolean);
|
|
40
41
|
private convertExpiration;
|
|
41
42
|
private isTokenExpired;
|
|
42
43
|
private setToken;
|
|
@@ -55,7 +56,7 @@ export declare class FacadeChatSDK {
|
|
|
55
56
|
getMessages(): Promise<IMessage[] | OmnichannelMessage[] | undefined>;
|
|
56
57
|
getDataMaskingRules(): Promise<MaskingRules>;
|
|
57
58
|
sendMessage(message: ChatSDKMessage): Promise<void>;
|
|
58
|
-
onNewMessage(onNewMessageCallback: CallableFunction, optionalParams?: OnNewMessageOptionalParams
|
|
59
|
+
onNewMessage(onNewMessageCallback: CallableFunction, optionalParams?: OnNewMessageOptionalParams): Promise<void>;
|
|
59
60
|
sendTypingEvent(): Promise<void>;
|
|
60
61
|
onTypingEvent(onTypingEventCallback: CallableFunction): Promise<void>;
|
|
61
62
|
onAgentEndSession(onAgentEndSessionCallback: (message: IRawThread | ParticipantsRemovedEvent) => void): Promise<void>;
|
|
@@ -3,29 +3,30 @@ import { IAudioNotificationProps } from "../../footerstateful/audionotifications
|
|
|
3
3
|
import { ICallingContainerProps } from "@microsoft/omnichannel-chat-components/lib/types/components/callingcontainer/interfaces/ICallingContainerProps";
|
|
4
4
|
import { IChatButtonProps } from "@microsoft/omnichannel-chat-components/lib/types/components/chatbutton/interfaces/IChatButtonProps";
|
|
5
5
|
import { IConfirmationPaneStatefulProps } from "../../confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps";
|
|
6
|
+
import { IContextDataStore } from "../../../common/interfaces/IContextDataStore";
|
|
6
7
|
import { IDownloadTranscriptProps } from "../../footerstateful/downloadtranscriptstateful/interfaces/IDownloadTranscriptProps";
|
|
8
|
+
import { IDraggableChatWidgetProps } from "./IDraggableChatWidgetProps";
|
|
7
9
|
import { IEmailTranscriptPaneProps } from "../../emailtranscriptpanestateful/interfaces/IEmailTranscriptPaneProps";
|
|
10
|
+
import { IFeatureConfigProps } from "./IFeatureConfigProps";
|
|
8
11
|
import { IFooterProps } from "@microsoft/omnichannel-chat-components/lib/types/components/footer/interfaces/IFooterProps";
|
|
9
12
|
import { IHeaderProps } from "@microsoft/omnichannel-chat-components/lib/types/components/header/interfaces/IHeaderProps";
|
|
10
13
|
import { ILiveChatWidgetComponentOverrides } from "./ILiveChatWidgetComponentOverrides";
|
|
14
|
+
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
11
15
|
import { ILiveChatWidgetControlProps } from "./ILiveChatWidgetControlProps";
|
|
12
16
|
import { ILiveChatWidgetStyleProps } from "./ILiveChatWidgetStyleProps";
|
|
13
17
|
import { ILoadingPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/loadingpane/interfaces/ILoadingPaneProps";
|
|
18
|
+
import { IMockProps } from "./IMockProps";
|
|
19
|
+
import { INotificationPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/notificationpane/interfaces/INotificationPaneProps";
|
|
14
20
|
import { IOOOHPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/outofofficehourspane/interfaces/IOOOHPaneProps";
|
|
21
|
+
import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps";
|
|
15
22
|
import { IPreChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/prechatsurveypane/interfaces/IPreChatSurveyPaneProps";
|
|
16
23
|
import { IProactiveChatPaneStatefulProps } from "../../proactivechatpanestateful/interfaces/IProactiveChatPaneStatefulProps";
|
|
17
24
|
import { IReconnectChatPaneStatefulProps } from "../../reconnectchatpanestateful/interfaces/IReconnectChatPaneStatefulProps";
|
|
25
|
+
import { IScrollBarProps } from "./IScrollBarProps";
|
|
18
26
|
import { IStartChatErrorPaneProps } from "../../startchaterrorpanestateful/interfaces/IStartChatErrorPaneProps";
|
|
19
27
|
import { ITelemetryConfig } from "../../../common/telemetry/interfaces/ITelemetryConfig";
|
|
20
28
|
import { IWebChatContainerStatefulProps } from "../../webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps";
|
|
21
29
|
import { OmnichannelChatSDK } from "@microsoft/omnichannel-chat-sdk";
|
|
22
|
-
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
23
|
-
import { IContextDataStore } from "../../../common/interfaces/IContextDataStore";
|
|
24
|
-
import { IPostChatSurveyPaneStatefulProps } from "../../postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps";
|
|
25
|
-
import { IScrollBarProps } from "./IScrollBarProps";
|
|
26
|
-
import { IDraggableChatWidgetProps } from "./IDraggableChatWidgetProps";
|
|
27
|
-
import { INotificationPaneProps } from "@microsoft/omnichannel-chat-components/lib/types/components/notificationpane/interfaces/INotificationPaneProps";
|
|
28
|
-
import { IMockProps } from "./IMockProps";
|
|
29
30
|
export interface ILiveChatWidgetProps {
|
|
30
31
|
audioNotificationProps?: IAudioNotificationProps;
|
|
31
32
|
callingContainerProps?: ICallingContainerProps;
|
|
@@ -63,4 +64,5 @@ export interface ILiveChatWidgetProps {
|
|
|
63
64
|
initialCustomContext?: any;
|
|
64
65
|
draggableChatWidgetProps?: IDraggableChatWidgetProps;
|
|
65
66
|
mock?: IMockProps;
|
|
67
|
+
featureConfigProps?: IFeatureConfigProps;
|
|
66
68
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.7.6
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@azure/core-tracing": "^1.2.0",
|
|
80
80
|
"@microsoft/omnichannel-chat-components": "1.1.8",
|
|
81
|
-
"@microsoft/omnichannel-chat-sdk": "^1.10.
|
|
81
|
+
"@microsoft/omnichannel-chat-sdk": "^1.10.13",
|
|
82
82
|
"@opentelemetry/api": "^1.9.0",
|
|
83
83
|
"abort-controller-es5": "^2.0.1",
|
|
84
84
|
"dompurify": "^3.2.4",
|