@microsoft/omnichannel-chat-widget 1.7.3-main.112d01b → 1.7.3-main.3d9027c

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);
@@ -48,6 +48,7 @@ const setAuthenticationIfApplicable = async (props, chatSDK) => {
48
48
  const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
49
49
  optionalParams = {}; //Resetting to ensure no stale values
50
50
  widgetInstanceId = (0, _utils.getWidgetCacheIdfromProps)(props);
51
+
51
52
  // reconnect > chat from cache
52
53
  if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true && !(0, _reconnectChatHelper.isPersistentEnabled)(props.chatConfig)) {
53
54
  const shouldStartChatNormally = await (0, _reconnectChatHelper.handleChatReconnect)(chatSDK, props, dispatch, setAdapter, initStartChat, state);
@@ -69,7 +70,11 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
69
70
  // Setting Proactive chat settings
70
71
  const isProactiveChat = state.appStates.conversationState === _ConversationState.ConversationState.ProactiveChat;
71
72
  const isPreChatEnabledInProactiveChat = state.appStates.proactiveChatStates.proactiveChatEnablePrechat;
72
- await setAuthenticationIfApplicable(props, chatSDK);
73
+
74
+ // Setting auth settings to OC API to retrieve existing persistent chat session before start chat if any
75
+ if ((0, _reconnectChatHelper.isPersistentEnabled)(props.chatConfig)) {
76
+ await setAuthenticationIfApplicable(props, chatSDK);
77
+ }
73
78
 
74
79
  //Setting PreChat and intiate chat
75
80
  await setPreChatAndInitiateChat(chatSDK, dispatch, setAdapter, isProactiveChat, isPreChatEnabledInProactiveChat, state, props);
@@ -167,6 +172,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
167
172
  Description: "Widget loading started"
168
173
  });
169
174
 
175
+ // Auth token retrieval needs to happen during start chat to support pop-out chat
176
+ await setAuthenticationIfApplicable(props, chatSDK);
177
+
170
178
  //Check if chat retrieved from cache
171
179
  if (persistedState || params !== null && params !== void 0 && params.liveChatContext) {
172
180
  var _persistedState$domai, _persistedState$domai2, _persistedState$domai3, _persistedState$domai4, _persistedState$domai5;
@@ -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);
@@ -43,6 +43,7 @@ const setAuthenticationIfApplicable = async (props, chatSDK) => {
43
43
  const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) => {
44
44
  optionalParams = {}; //Resetting to ensure no stale values
45
45
  widgetInstanceId = getWidgetCacheIdfromProps(props);
46
+
46
47
  // reconnect > chat from cache
47
48
  if (isReconnectEnabled(props.chatConfig) === true && !isPersistentEnabled(props.chatConfig)) {
48
49
  const shouldStartChatNormally = await handleChatReconnect(chatSDK, props, dispatch, setAdapter, initStartChat, state);
@@ -64,7 +65,11 @@ const prepareStartChat = async (props, chatSDK, state, dispatch, setAdapter) =>
64
65
  // Setting Proactive chat settings
65
66
  const isProactiveChat = state.appStates.conversationState === ConversationState.ProactiveChat;
66
67
  const isPreChatEnabledInProactiveChat = state.appStates.proactiveChatStates.proactiveChatEnablePrechat;
67
- await setAuthenticationIfApplicable(props, chatSDK);
68
+
69
+ // Setting auth settings to OC API to retrieve existing persistent chat session before start chat if any
70
+ if (isPersistentEnabled(props.chatConfig)) {
71
+ await setAuthenticationIfApplicable(props, chatSDK);
72
+ }
68
73
 
69
74
  //Setting PreChat and intiate chat
70
75
  await setPreChatAndInitiateChat(chatSDK, dispatch, setAdapter, isProactiveChat, isPreChatEnabledInProactiveChat, state, props);
@@ -160,6 +165,9 @@ const initStartChat = async (chatSDK, dispatch, setAdapter, state, props, params
160
165
  Description: "Widget loading started"
161
166
  });
162
167
 
168
+ // Auth token retrieval needs to happen during start chat to support pop-out chat
169
+ await setAuthenticationIfApplicable(props, chatSDK);
170
+
163
171
  //Check if chat retrieved from cache
164
172
  if (persistedState || params !== null && params !== void 0 && params.liveChatContext) {
165
173
  var _persistedState$domai, _persistedState$domai2, _persistedState$domai3, _persistedState$domai4, _persistedState$domai5;
@@ -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.3d9027c",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -77,7 +77,7 @@
77
77
  "@microsoft/omnichannel-chat-components": "1.1.5",
78
78
  "@microsoft/omnichannel-chat-sdk": "^1.9.5",
79
79
  "abort-controller-es5": "^2.0.1",
80
- "dompurify": "^2.3.4",
80
+ "dompurify": "^2.5.4",
81
81
  "markdown-it": "^12.3.2",
82
82
  "markdown-it-attrs": "^4.1.6",
83
83
  "markdown-it-attrs-es5": "^2.0.2",