@microsoft/omnichannel-chat-widget 1.7.3-main.112d01b → 1.7.3-main.5f11aa4

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.
@@ -101,6 +101,7 @@ exports.TelemetryEvent = TelemetryEvent;
101
101
  TelemetryEvent["GetConversationDetailsCallStarted"] = "GetConversationDetailsCallStarted";
102
102
  TelemetryEvent["GetConversationDetailsCallFailed"] = "GetConversationDetailsCallFailed";
103
103
  TelemetryEvent["EndChatSDKCallFailed"] = "EndChatSDKCallFailed";
104
+ TelemetryEvent["DisconnectEndChatSDKCallFailed"] = "DisconnectEndChatSDKCallFailed";
104
105
  TelemetryEvent["GetChatReconnectContextSDKCallStarted"] = "GetChatReconnectContextSDKCallStarted";
105
106
  TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
106
107
  TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
@@ -141,12 +141,27 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
141
141
  await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
142
142
  await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
143
143
  } catch (ex) {
144
- _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
145
- Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCallFailed,
146
- ExceptionDetails: {
147
- exception: ex
148
- }
144
+ var _inMemoryState$appSta;
145
+ const inMemoryState = (0, _createReducer.executeReducer)(state, {
146
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
147
+ payload: null
149
148
  });
149
+ // if the chat was disconnected or ended by the agent, we don't want to log the error
150
+ if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta = inMemoryState.appStates) !== null && _inMemoryState$appSta !== void 0 && _inMemoryState$appSta.chatDisconnectEventReceived)) {
151
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
152
+ Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCallFailed,
153
+ ExceptionDetails: {
154
+ exception: ex
155
+ }
156
+ });
157
+ } else {
158
+ _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.WARN, {
159
+ Event: _TelemetryConstants.TelemetryEvent.DisconnectEndChatSDKCallFailed,
160
+ ExceptionDetails: {
161
+ exception: ex
162
+ }
163
+ });
164
+ }
150
165
  postMessageToOtherTab = false;
151
166
  } finally {
152
167
  await endChatStateCleanUp(dispatch);
@@ -95,6 +95,7 @@ export let TelemetryEvent;
95
95
  TelemetryEvent["GetConversationDetailsCallStarted"] = "GetConversationDetailsCallStarted";
96
96
  TelemetryEvent["GetConversationDetailsCallFailed"] = "GetConversationDetailsCallFailed";
97
97
  TelemetryEvent["EndChatSDKCallFailed"] = "EndChatSDKCallFailed";
98
+ TelemetryEvent["DisconnectEndChatSDKCallFailed"] = "DisconnectEndChatSDKCallFailed";
98
99
  TelemetryEvent["GetChatReconnectContextSDKCallStarted"] = "GetChatReconnectContextSDKCallStarted";
99
100
  TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
100
101
  TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
@@ -135,12 +135,27 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
135
135
  await handleAuthentication(chatSDK, props.chatConfig, props.getAuthToken);
136
136
  await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
137
137
  } catch (ex) {
138
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
139
- Event: TelemetryEvent.EndChatSDKCallFailed,
140
- ExceptionDetails: {
141
- exception: ex
142
- }
138
+ var _inMemoryState$appSta;
139
+ const inMemoryState = executeReducer(state, {
140
+ type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
141
+ payload: null
143
142
  });
143
+ // if the chat was disconnected or ended by the agent, we don't want to log the error
144
+ if (!(inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta = inMemoryState.appStates) !== null && _inMemoryState$appSta !== void 0 && _inMemoryState$appSta.chatDisconnectEventReceived)) {
145
+ TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
146
+ Event: TelemetryEvent.EndChatSDKCallFailed,
147
+ ExceptionDetails: {
148
+ exception: ex
149
+ }
150
+ });
151
+ } else {
152
+ TelemetryHelper.logSDKEvent(LogLevel.WARN, {
153
+ Event: TelemetryEvent.DisconnectEndChatSDKCallFailed,
154
+ ExceptionDetails: {
155
+ exception: ex
156
+ }
157
+ });
158
+ }
144
159
  postMessageToOtherTab = false;
145
160
  } finally {
146
161
  await endChatStateCleanUp(dispatch);
@@ -88,6 +88,7 @@ export declare enum TelemetryEvent {
88
88
  GetConversationDetailsCallStarted = "GetConversationDetailsCallStarted",
89
89
  GetConversationDetailsCallFailed = "GetConversationDetailsCallFailed",
90
90
  EndChatSDKCallFailed = "EndChatSDKCallFailed",
91
+ DisconnectEndChatSDKCallFailed = "DisconnectEndChatSDKCallFailed",
91
92
  GetChatReconnectContextSDKCallStarted = "GetChatReconnectContextSDKCallStarted",
92
93
  GetChatReconnectContextSDKCallFailed = "GetChatReconnectContextSDKCallFailed",
93
94
  ParseAdaptiveCardFailed = "ParseAdaptiveCardFailed",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.7.3-main.112d01b",
3
+ "version": "1.7.3-main.5f11aa4",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",