@microsoft/omnichannel-chat-widget 1.7.7-main.a833758 → 1.7.7

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.
@@ -11,6 +11,8 @@ var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontro
11
11
  var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
12
12
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
13
13
  var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
14
+ var _createReducer = require("../../../contexts/createReducer");
15
+ var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
14
16
  const isInternetConnected = async () => {
15
17
  try {
16
18
  const response = await fetch(_Constants.Constants.internetConnectionTestUrl);
@@ -23,18 +25,22 @@ const isInternetConnected = async () => {
23
25
  const createInternetConnectionChangeHandler = async state => {
24
26
  const handler = async () => {
25
27
  const connected = await isInternetConnected();
28
+ const inMemoryState = (0, _createReducer.executeReducer)(state, {
29
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
30
+ payload: null
31
+ });
26
32
  if (!connected) {
27
- var _state$domainStates, _state$domainStates$m;
33
+ var _inMemoryState$domain, _inMemoryState$domain2;
28
34
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
29
35
  Event: _TelemetryConstants.TelemetryEvent.NetworkDisconnected
30
36
  });
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);
37
+ _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.InternetConnection, (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : (_inMemoryState$domain2 = _inMemoryState$domain.middlewareLocalizedTexts) === null || _inMemoryState$domain2 === void 0 ? void 0 : _inMemoryState$domain2.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
32
38
  } else {
33
- var _state$domainStates2, _state$domainStates2$;
39
+ var _inMemoryState$domain3, _inMemoryState$domain4;
34
40
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.WARN, {
35
41
  Event: _TelemetryConstants.TelemetryEvent.NetworkReconnected
36
42
  });
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);
43
+ _NotificationHandler.NotificationHandler.notifySuccess(_NotificationScenarios.NotificationScenarios.InternetConnection, (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.middlewareLocalizedTexts) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
38
44
  _omnichannelChatComponents.BroadcastService.postMessage({
39
45
  eventName: _TelemetryConstants.BroadcastEvent.NetworkReconnected
40
46
  });
@@ -89,7 +89,7 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
89
89
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
90
90
  Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
91
91
  Description: "New message received",
92
- Data: payload
92
+ CustomProperties: payload
93
93
  });
94
94
  } else {
95
95
  if (!isHistoryMessageReceivedEventRasied) {
@@ -97,7 +97,7 @@ const createOnNewAdapterActivityHandler = (chatId, userId) => {
97
97
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
98
98
  Event: _TelemetryConstants.TelemetryEvent.RehydrateMessageReceived,
99
99
  Description: "History message received",
100
- Data: payload
100
+ CustomProperties: payload
101
101
  });
102
102
  }
103
103
  }
@@ -5,6 +5,8 @@ import { NotificationHandler } from "../../webchatcontainerstateful/webchatcontr
5
5
  import { NotificationScenarios } from "../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios";
6
6
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
7
7
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
8
+ import { executeReducer } from "../../../contexts/createReducer";
9
+ import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
8
10
  const isInternetConnected = async () => {
9
11
  try {
10
12
  const response = await fetch(Constants.internetConnectionTestUrl);
@@ -17,18 +19,22 @@ const isInternetConnected = async () => {
17
19
  export const createInternetConnectionChangeHandler = async state => {
18
20
  const handler = async () => {
19
21
  const connected = await isInternetConnected();
22
+ const inMemoryState = executeReducer(state, {
23
+ type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
24
+ payload: null
25
+ });
20
26
  if (!connected) {
21
- var _state$domainStates, _state$domainStates$m;
27
+ var _inMemoryState$domain, _inMemoryState$domain2;
22
28
  TelemetryHelper.logActionEvent(LogLevel.WARN, {
23
29
  Event: TelemetryEvent.NetworkDisconnected
24
30
  });
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);
31
+ NotificationHandler.notifyError(NotificationScenarios.InternetConnection, (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : (_inMemoryState$domain2 = _inMemoryState$domain.middlewareLocalizedTexts) === null || _inMemoryState$domain2 === void 0 ? void 0 : _inMemoryState$domain2.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_NO_INTERNET_CONNECTION);
26
32
  } else {
27
- var _state$domainStates2, _state$domainStates2$;
33
+ var _inMemoryState$domain3, _inMemoryState$domain4;
28
34
  TelemetryHelper.logActionEvent(LogLevel.WARN, {
29
35
  Event: TelemetryEvent.NetworkReconnected
30
36
  });
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);
37
+ NotificationHandler.notifySuccess(NotificationScenarios.InternetConnection, (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.middlewareLocalizedTexts) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_INTERNET_BACK_ONLINE);
32
38
  BroadcastService.postMessage({
33
39
  eventName: BroadcastEvent.NetworkReconnected
34
40
  });
@@ -83,7 +83,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
83
83
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
84
84
  Event: TelemetryEvent.MessageReceived,
85
85
  Description: "New message received",
86
- Data: payload
86
+ CustomProperties: payload
87
87
  });
88
88
  } else {
89
89
  if (!isHistoryMessageReceivedEventRasied) {
@@ -91,7 +91,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId) => {
91
91
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
92
92
  Event: TelemetryEvent.RehydrateMessageReceived,
93
93
  Description: "History message received",
94
- Data: payload
94
+ CustomProperties: payload
95
95
  });
96
96
  }
97
97
  }
@@ -12,6 +12,7 @@ export interface TelemetryEventWrapper {
12
12
  ExceptionDetails?: any;
13
13
  ElapsedTimeInMilliseconds?: number;
14
14
  Data?: any;
15
+ CustomProperties?: any;
15
16
  }
16
17
  export declare class TelemetryHelper {
17
18
  static callId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.7.7-main.a833758",
3
+ "version": "1.7.7",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",