@microsoft/omnichannel-chat-widget 1.7.6-main.aac589b → 1.7.6-main.dca3f60
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/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -2
- package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +5 -3
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +1 -1
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +4 -2
- package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +5 -3
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +1 -1
- package/lib/types/components/livechatwidget/common/createInternetConnectionChangeHandler.d.ts +2 -1
- package/package.json +2 -2
|
@@ -61,22 +61,24 @@ const EmailTranscriptPaneStateful = props => {
|
|
|
61
61
|
attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
|
|
62
62
|
};
|
|
63
63
|
try {
|
|
64
|
+
var _state$domainStates2, _state$domainStates2$;
|
|
64
65
|
await (facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.emailLiveChatTranscript(chatTranscriptBody, {
|
|
65
66
|
liveChatContext
|
|
66
67
|
}));
|
|
67
|
-
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
|
|
68
|
+
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.EmailAddressSaved, (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.middlewareLocalizedTexts) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS) ?? (_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === null || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts === void 0 ? void 0 : _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS));
|
|
68
69
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
69
70
|
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptSent,
|
|
70
71
|
Description: "Transcript sent to email successfully."
|
|
71
72
|
});
|
|
72
73
|
} catch (ex) {
|
|
74
|
+
var _state$domainStates3, _state$domainStates3$;
|
|
73
75
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
74
76
|
Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptFailed,
|
|
75
77
|
ExceptionDetails: {
|
|
76
78
|
exception: ex
|
|
77
79
|
}
|
|
78
80
|
});
|
|
79
|
-
const message = (0, _utils.formatTemplateString)(_defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
81
|
+
const message = (0, _utils.formatTemplateString)((state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.middlewareLocalizedTexts) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
80
82
|
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
|
|
81
83
|
}
|
|
82
84
|
}, [props.attachmentMessage, props.bannerMessageOnError, facadeChatSDK, state.domainStates.liveChatContext]);
|
|
@@ -20,19 +20,21 @@ const isInternetConnected = async () => {
|
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
const createInternetConnectionChangeHandler = async
|
|
23
|
+
const createInternetConnectionChangeHandler = async state => {
|
|
24
24
|
const handler = async () => {
|
|
25
25
|
const connected = await isInternetConnected();
|
|
26
26
|
if (!connected) {
|
|
27
|
+
var _state$domainStates, _state$domainStates$m;
|
|
27
28
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
|
|
28
29
|
Event: _TelemetryConstants.TelemetryEvent.NetworkDisconnected
|
|
29
30
|
});
|
|
30
|
-
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.InternetConnection, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
|
|
31
|
+
_NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.InternetConnection, (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
|
|
31
32
|
} else {
|
|
33
|
+
var _state$domainStates2, _state$domainStates2$;
|
|
32
34
|
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
|
|
33
35
|
Event: _TelemetryConstants.TelemetryEvent.NetworkReconnected
|
|
34
36
|
});
|
|
35
|
-
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.InternetConnection, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
|
|
37
|
+
_NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.InternetConnection, (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.middlewareLocalizedTexts) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
|
|
36
38
|
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
37
39
|
eventName: _TelemetryConstants.BroadcastEvent.NetworkReconnected
|
|
38
40
|
});
|
|
@@ -227,7 +227,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
227
227
|
state.domainStates.confirmationState = _Constants.ConfirmationState.NotSet;
|
|
228
228
|
setupClientDataStore();
|
|
229
229
|
(0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
|
|
230
|
-
(0, _createInternetConnectionChangeHandler.createInternetConnectionChangeHandler)();
|
|
230
|
+
(0, _createInternetConnectionChangeHandler.createInternetConnectionChangeHandler)(state);
|
|
231
231
|
dispatch({
|
|
232
232
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
|
|
233
233
|
payload: widgetElementId
|
|
@@ -52,22 +52,24 @@ export const EmailTranscriptPaneStateful = props => {
|
|
|
52
52
|
attachmentMessage: (props === null || props === void 0 ? void 0 : props.attachmentMessage) ?? "The following attachment was uploaded during the conversation:"
|
|
53
53
|
};
|
|
54
54
|
try {
|
|
55
|
+
var _state$domainStates2, _state$domainStates2$;
|
|
55
56
|
await (facadeChatSDK === null || facadeChatSDK === void 0 ? void 0 : facadeChatSDK.emailLiveChatTranscript(chatTranscriptBody, {
|
|
56
57
|
liveChatContext
|
|
57
58
|
}));
|
|
58
|
-
NotificationHandler.notifySuccess(NotificationScenarios.EmailAddressSaved, defaultMiddlewareLocalizedTexts === null || defaultMiddlewareLocalizedTexts === void 0 ? void 0 : defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS);
|
|
59
|
+
NotificationHandler.notifySuccess(NotificationScenarios.EmailAddressSaved, (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.middlewareLocalizedTexts) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS) ?? (defaultMiddlewareLocalizedTexts === null || defaultMiddlewareLocalizedTexts === void 0 ? void 0 : defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS));
|
|
59
60
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
60
61
|
Event: TelemetryEvent.EmailTranscriptSent,
|
|
61
62
|
Description: "Transcript sent to email successfully."
|
|
62
63
|
});
|
|
63
64
|
} catch (ex) {
|
|
65
|
+
var _state$domainStates3, _state$domainStates3$;
|
|
64
66
|
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
65
67
|
Event: TelemetryEvent.EmailTranscriptFailed,
|
|
66
68
|
ExceptionDetails: {
|
|
67
69
|
exception: ex
|
|
68
70
|
}
|
|
69
71
|
});
|
|
70
|
-
const message = formatTemplateString(defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
72
|
+
const message = formatTemplateString((state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.middlewareLocalizedTexts) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR, [email]);
|
|
71
73
|
NotificationHandler.notifyError(NotificationScenarios.EmailTranscriptError, (props === null || props === void 0 ? void 0 : props.bannerMessageOnError) ?? message);
|
|
72
74
|
}
|
|
73
75
|
}, [props.attachmentMessage, props.bannerMessageOnError, facadeChatSDK, state.domainStates.liveChatContext]);
|
|
@@ -14,19 +14,21 @@ const isInternetConnected = async () => {
|
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
export const createInternetConnectionChangeHandler = async
|
|
17
|
+
export const createInternetConnectionChangeHandler = async state => {
|
|
18
18
|
const handler = async () => {
|
|
19
19
|
const connected = await isInternetConnected();
|
|
20
20
|
if (!connected) {
|
|
21
|
+
var _state$domainStates, _state$domainStates$m;
|
|
21
22
|
TelemetryHelper.logActionEvent(LogLevel.WARN, {
|
|
22
23
|
Event: TelemetryEvent.NetworkDisconnected
|
|
23
24
|
});
|
|
24
|
-
NotificationHandler.notifyError(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
|
|
25
|
+
NotificationHandler.notifyError(NotificationScenarios.InternetConnection, (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
|
|
25
26
|
} else {
|
|
27
|
+
var _state$domainStates2, _state$domainStates2$;
|
|
26
28
|
TelemetryHelper.logActionEvent(LogLevel.WARN, {
|
|
27
29
|
Event: TelemetryEvent.NetworkReconnected
|
|
28
30
|
});
|
|
29
|
-
NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
|
|
31
|
+
NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.middlewareLocalizedTexts) === null || _state$domainStates2$ === void 0 ? void 0 : _state$domainStates2$.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
|
|
30
32
|
BroadcastService.postMessage({
|
|
31
33
|
eventName: BroadcastEvent.NetworkReconnected
|
|
32
34
|
});
|
|
@@ -219,7 +219,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
219
219
|
state.domainStates.confirmationState = ConfirmationState.NotSet;
|
|
220
220
|
setupClientDataStore();
|
|
221
221
|
registerTelemetryLoggers(props, dispatch);
|
|
222
|
-
createInternetConnectionChangeHandler();
|
|
222
|
+
createInternetConnectionChangeHandler(state);
|
|
223
223
|
dispatch({
|
|
224
224
|
type: LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
|
|
225
225
|
payload: widgetElementId
|
package/lib/types/components/livechatwidget/common/createInternetConnectionChangeHandler.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
2
|
+
export declare const createInternetConnectionChangeHandler: (state: ILiveChatWidgetContext) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.7.6-main.
|
|
3
|
+
"version": "1.7.6-main.dca3f60",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"build-sample:dev": "yarn build && webpack --config ./webpack.dev.config.cjs",
|
|
113
113
|
"test:visual:build": "yarn build-storybook && yarn test:visual",
|
|
114
114
|
"lint": "yarn eslint . --max-warnings=0",
|
|
115
|
-
"
|
|
115
|
+
"pretest:visual": "yarn playwright install"
|
|
116
116
|
},
|
|
117
117
|
"resolutions": {
|
|
118
118
|
"**/url-parse": "1.5.9",
|