@microsoft/omnichannel-chat-widget 1.8.1-main.5ac9acf → 1.8.1-main.6ec59e7

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.
Files changed (39) hide show
  1. package/lib/cjs/common/facades/FacadeChatSDK.js +7 -49
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +0 -3
  3. package/lib/cjs/common/telemetry/TelemetryManager.js +2 -2
  4. package/lib/cjs/common/utils.js +0 -3
  5. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +3 -7
  6. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -15
  7. package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +1 -1
  8. package/lib/cjs/components/livechatwidget/common/persistentChatHelper.js +5 -12
  9. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +0 -4
  10. package/lib/cjs/components/livechatwidget/common/startChat.js +2 -2
  11. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +9 -55
  12. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +19 -31
  13. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -14
  14. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +0 -1
  15. package/lib/esm/common/facades/FacadeChatSDK.js +7 -49
  16. package/lib/esm/common/telemetry/TelemetryConstants.js +0 -3
  17. package/lib/esm/common/telemetry/TelemetryManager.js +2 -2
  18. package/lib/esm/common/utils.js +0 -3
  19. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +3 -7
  20. package/lib/esm/components/livechatwidget/LiveChatWidget.js +5 -16
  21. package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +1 -1
  22. package/lib/esm/components/livechatwidget/common/persistentChatHelper.js +5 -12
  23. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +0 -4
  24. package/lib/esm/components/livechatwidget/common/startChat.js +2 -2
  25. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +8 -53
  26. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +19 -31
  27. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -14
  28. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +0 -1
  29. package/lib/types/common/facades/FacadeChatSDK.d.ts +0 -1
  30. package/lib/types/common/telemetry/TelemetryConstants.d.ts +0 -3
  31. package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +1 -1
  32. package/lib/types/components/livechatwidget/common/persistentChatHelper.d.ts +1 -2
  33. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +0 -1
  34. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +1 -2
  35. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +0 -1
  36. package/package.json +2 -2
  37. package/lib/cjs/components/errorboundary/ErrorBoundary.js +0 -68
  38. package/lib/esm/components/errorboundary/ErrorBoundary.js +0 -59
  39. package/lib/types/components/errorboundary/ErrorBoundary.d.ts +0 -14
@@ -18,14 +18,13 @@ var _isValidSurveyUrl = _interopRequireDefault(require("./common/isValidSurveyUr
18
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
19
  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); }
20
20
  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; }
21
- const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact, customerVoiceSurveyCorrelationId) {
22
- let showMultiLingual = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
21
+ const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
22
+ let showMultiLingual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
23
23
  const surveyLinkParams = new URLSearchParams({
24
24
  embed: isEmbed.toString(),
25
25
  compact: (compact ?? true).toString(),
26
26
  lang: locale ?? "en-us",
27
- showmultilingual: (showMultiLingual ?? false).toString(),
28
- cvResponsePageRequestId: customerVoiceSurveyCorrelationId
27
+ showmultilingual: (showMultiLingual ?? false).toString()
29
28
  });
30
29
  return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
31
30
  };
@@ -41,9 +40,9 @@ const PostChatSurveyPaneStateful = props => {
41
40
  // Bot survey enabled
42
41
  state.appStates.postChatParticipantType === _Constants.ParticipantType.Bot) {
43
42
  // Only Bot has engaged
44
- surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
43
+ surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
45
44
  } else {
46
- surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
45
+ surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
47
46
  }
48
47
  if (props.copilotSurveyContext) {
49
48
  surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
@@ -106,14 +105,6 @@ const PostChatSurveyPaneStateful = props => {
106
105
  message: "Customer Voice form response error."
107
106
  }
108
107
  });
109
- } else if (typeof data === "string" && data.startsWith(_CustomerVoiceEvents.CustomerVoiceEvents.FormsError)) {
110
- _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.ERROR, {
111
- Event: _TelemetryConstants.TelemetryEvent.CustomerVoiceFormsError,
112
- Description: "Customer Voice failed to load with forms error.",
113
- ExceptionDetails: {
114
- message: `Customer Voice forms error details: ${data}`
115
- }
116
- });
117
108
  }
118
109
  });
119
110
  }, []);
@@ -10,5 +10,4 @@ exports.CustomerVoiceEvents = CustomerVoiceEvents;
10
10
  CustomerVoiceEvents["ResponsePageLoaded"] = "ResponsePageLoaded";
11
11
  CustomerVoiceEvents["FormResponseSubmitted"] = "FormResponseSubmitted";
12
12
  CustomerVoiceEvents["FormResponseError"] = "FormResponseError";
13
- CustomerVoiceEvents["FormsError"] = "FormsError";
14
13
  })(CustomerVoiceEvents || (exports.CustomerVoiceEvents = CustomerVoiceEvents = {}));
@@ -103,7 +103,7 @@ export let FacadeChatSDK = /*#__PURE__*/function () {
103
103
  token: last3digits
104
104
  }
105
105
  });
106
- throw new Error("Authentication Setup Error: Invalid token format, must be in JWT format");
106
+ throw new Error("Invalid token format, must be in JWT format");
107
107
  }
108
108
  try {
109
109
  const payload = this.enforceBase64Encoding(tokenParts[1]);
@@ -125,9 +125,9 @@ export let FacadeChatSDK = /*#__PURE__*/function () {
125
125
  token: last3digits
126
126
  }
127
127
  });
128
- throw new Error("Authentication Setup Error: Invalid token payload, payload is not valid JSON");
128
+ throw new Error("Invalid token payload, payload is not valid JSON");
129
129
  } catch (e) {
130
- console.error("Authentication Setup Error: Failed to decode token", e);
130
+ console.error("Failed to decode token", e);
131
131
  TelemetryHelper.logFacadeChatSDKEventToAllTelemetry(LogLevel.ERROR, {
132
132
  Event: TelemetryEvent.NewTokenValidationFailed,
133
133
  Description: "Failed to decode token",
@@ -136,7 +136,7 @@ export let FacadeChatSDK = /*#__PURE__*/function () {
136
136
  token: last3digits
137
137
  }
138
138
  });
139
- throw new Error("Authentication Setup Error: Failed to decode authentication token");
139
+ throw new Error("Failed to decode token");
140
140
  }
141
141
  }
142
142
  }, {
@@ -160,7 +160,7 @@ export let FacadeChatSDK = /*#__PURE__*/function () {
160
160
  "Token": last3digits
161
161
  }
162
162
  });
163
- throw new Error("Authentication Setup Error: New authentication token is already expired");
163
+ throw new Error(`New token is already expired, with epoch time ${this.expiration} , last 3 digits of token: ${last3digits}`);
164
164
  }
165
165
  }
166
166
  }
@@ -274,9 +274,9 @@ export let FacadeChatSDK = /*#__PURE__*/function () {
274
274
  if (pingResponse.result === true) {
275
275
  return fn();
276
276
  }
277
- const executionErrorMessage = "Authentication Setup Error: Token validation failed - GetAuthToken function is not present";
277
+ const executionErrorMessage = `Authentication failed: Process to get a token failed for ${functionName}, ${pingResponse.message}`;
278
278
  //telemetry is already logged in tokenRing, so no need to log again, just return the error and communicate to the console
279
- console.error(`${executionErrorMessage} Additional details: Process to get a token failed for ${functionName}, ${pingResponse.message}`);
279
+ console.error(executionErrorMessage);
280
280
  BroadcastService.postMessage({
281
281
  eventName: BroadcastEvent.OnWidgetError,
282
282
  payload: {
@@ -439,48 +439,6 @@ export let FacadeChatSDK = /*#__PURE__*/function () {
439
439
  let optionalParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
440
440
  return this.validateAndExecuteCall("getAgentAvailability", () => this.chatSDK.getAgentAvailability(optionalParams));
441
441
  }
442
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
443
- }, {
444
- key: "getReconnectableChats",
445
- value: async function getReconnectableChats() {
446
- let reconnectableChatsParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
447
- /**
448
- *
449
- * This is a particular case, we dont expose getReconnectableChats in the SDK,
450
- * The only way to use is by tunneling directly from the SDK to OCSDK,
451
- *
452
- * In case of prechat, the function is called before any formal authentication is made,
453
- * this is an specific case for persistent chats, to prevent the survey be loaded again for an on going chat,
454
- *
455
- * In this case, we check for existance of the token , otherwise we perform the authentication, error is propagated in case of issues.
456
- *
457
- * Once the token is obtained , this will be added to the params to call the function.
458
- *
459
- * This is a particular case, should not be taken as pattern.
460
- *
461
- */
462
-
463
- if (this.token === null || this.token === "") {
464
- // If token is not set, try to get it using tokenRing
465
- const pingResponse = await this.tokenRing();
466
- if (pingResponse.result === false) {
467
- const errorMessage = "Authentication Setup Error: Token validation failed for reconnectable chats";
468
- //telemetry is already logged in tokenRing, so no need to log again, just return the error and communicate to the console
469
- console.error(`Authentication failed: Process to get a token failed for getReconnectableChats, ${pingResponse.message}`);
470
- BroadcastService.postMessage({
471
- eventName: BroadcastEvent.OnWidgetError,
472
- payload: {
473
- errorMessage: errorMessage
474
- }
475
- });
476
- throw new Error(errorMessage);
477
- }
478
- }
479
-
480
- // Always override the token in params regardless of how getReconnectableChats was called
481
- reconnectableChatsParams.authenticatedUserToken = this.token;
482
- return this.validateAndExecuteCall("getReconnectableChats", () => this.chatSDK.OCClient.getReconnectableChats(reconnectableChatsParams));
483
- }
484
442
  }]);
485
443
  return FacadeChatSDK;
486
444
  }();
@@ -106,8 +106,6 @@ export let TelemetryEvent;
106
106
  TelemetryEvent["DisconnectEndChatSDKCallFailed"] = "DisconnectEndChatSDKCallFailed";
107
107
  TelemetryEvent["GetChatReconnectContextSDKCallStarted"] = "GetChatReconnectContextSDKCallStarted";
108
108
  TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
109
- TelemetryEvent["CheckContactIdError"] = "checkContactIdError";
110
- TelemetryEvent["GetChatReconnectContextSDKCallSucceeded"] = "GetChatReconnectContextSDKCallSucceeded";
111
109
  TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
112
110
  TelemetryEvent["ClientDataStoreProviderFailed"] = "ClientDataStoreProviderFailed";
113
111
  TelemetryEvent["InMemoryDataStoreFailed"] = "InMemoryDataStoreFailed";
@@ -175,7 +173,6 @@ export let TelemetryEvent;
175
173
  TelemetryEvent["CustomerVoiceResponsePageLoaded"] = "CustomerVoiceResponsePageLoaded";
176
174
  TelemetryEvent["CustomerVoiceFormResponseSubmitted"] = "CustomerVoiceFormResponseSubmitted";
177
175
  TelemetryEvent["CustomerVoiceFormResponseError"] = "CustomerVoiceFormResponseError";
178
- TelemetryEvent["CustomerVoiceFormsError"] = "CustomerVoiceFormsError";
179
176
  TelemetryEvent["BotAuthActivityEmptySasUrl"] = "BotAuthActivityEmptySasUrl";
180
177
  TelemetryEvent["SetBotAuthProviderFetchConfig"] = "SetBotAuthProviderFetchConfig";
181
178
  TelemetryEvent["SetBotAuthProviderHideCard"] = "SetBotAuthProviderHideCard";
@@ -6,11 +6,11 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
6
6
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
7
  import { LogLevel, ScenarioType, TelemetryConstants, TelemetryEvent } from "./TelemetryConstants";
8
8
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
9
- import { TelemetryHelper } from "./TelemetryHelper";
10
- import { appInsightsLogger } from "./loggers/appInsightsLogger";
11
9
  import { ariaTelemetryLogger } from "./loggers/ariaTelemetryLogger";
12
10
  import { consoleLogger } from "./loggers/consoleLogger";
13
11
  import { defaultAriaConfig } from "./defaultConfigs/defaultAriaConfig";
12
+ import { TelemetryHelper } from "./TelemetryHelper";
13
+ import { appInsightsLogger } from "./loggers/appInsightsLogger";
14
14
  export let TelemetryTimers = /*#__PURE__*/_createClass(function TelemetryTimers() {
15
15
  _classCallCheck(this, TelemetryTimers);
16
16
  });
@@ -385,9 +385,6 @@ export const getConversationDetailsCall = async function (facadeChatSDK) {
385
385
 
386
386
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
387
387
  export const checkContactIdError = e => {
388
- TelemetryHelper.logSDKEvent(LogLevel.ERROR, {
389
- Event: TelemetryEvent.CheckContactIdError
390
- });
391
388
  if ((e === null || e === void 0 ? void 0 : e.message) === ChatSDKErrorName.AuthContactIdNotFoundFailure) {
392
389
  const contactIdNotFoundErrorEvent = {
393
390
  eventName: BroadcastEvent.ContactIdNotFound,
@@ -75,13 +75,9 @@ export const ConfirmationPaneStateful = props => {
75
75
  useEffect(() => {
76
76
  preventFocusToMoveOutOfElement(controlProps.id);
77
77
  const focusableElements = findAllFocusableElement(`#${controlProps.id}`);
78
- requestAnimationFrame(() => {
79
- if (focusableElements && focusableElements.length > 0 && focusableElements[0]) {
80
- focusableElements[0].focus({
81
- preventScroll: true
82
- });
83
- }
84
- });
78
+ if (focusableElements) {
79
+ focusableElements[0].focus();
80
+ }
85
81
  elements = findParentFocusableElementsWithoutChildContainer(controlProps.id);
86
82
  setTabIndices(elements, initialTabIndexMap, false);
87
83
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
@@ -1,8 +1,7 @@
1
- import React, { useEffect, useReducer, useState } from "react";
1
+ import React, { useReducer, useState } from "react";
2
2
  import { ChatAdapterStore } from "../../contexts/ChatAdapterStore";
3
3
  import { ChatContextStore } from "../../contexts/ChatContextStore";
4
4
  import { ChatSDKStore } from "../../contexts/ChatSDKStore";
5
- import ErrorBoundary from "../errorboundary/ErrorBoundary";
6
5
  import { FacadeChatSDK } from "../../common/facades/FacadeChatSDK";
7
6
  import { FacadeChatSDKStore } from "../../contexts/FacadeChatSDKStore";
8
7
  import LiveChatWidgetStateful from "./livechatwidgetstateful/LiveChatWidgetStateful";
@@ -10,12 +9,9 @@ import { createReducer } from "../../contexts/createReducer";
10
9
  import { getLiveChatWidgetContextInitialState } from "../../contexts/common/LiveChatWidgetContextInitialState";
11
10
  import { getMockChatSDKIfApplicable } from "./common/getMockChatSDKIfApplicable";
12
11
  import { isNullOrUndefined } from "../../common/utils";
13
- import { isPersistentChatEnabled } from "./common/liveChatConfigUtils";
14
- import { logWidgetLoadWithUnexpectedError } from "./common/startChatErrorHandler";
15
12
  import overridePropsOnMockIfApplicable from "./common/overridePropsOnMockIfApplicable";
16
- import { registerTelemetryLoggers } from "./common/registerTelemetryLoggers";
17
13
  export const LiveChatWidget = props => {
18
- var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv, _props$chatConfig2, _props$chatConfig2$Li;
14
+ var _props$mock, _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv;
19
15
  const reducer = createReducer();
20
16
  const [state, dispatch] = useReducer(reducer, getLiveChatWidgetContextInitialState(props));
21
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -29,7 +25,7 @@ export const LiveChatWidget = props => {
29
25
  }
30
26
 
31
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
- const isAuthenticatedChat = !!((_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction) || isPersistentChatEnabled((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_conversationmode);
28
+ const isAuthenticatedChat = !!((_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction);
33
29
  if (!facadeChatSDK) {
34
30
  var _props$mock2;
35
31
  setFacadeChatSDK(new FacadeChatSDK({
@@ -41,14 +37,7 @@ export const LiveChatWidget = props => {
41
37
  "isSDKMocked": !isNullOrUndefined(props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type)
42
38
  }, disableReauthentication));
43
39
  }
44
- useEffect(() => {
45
- registerTelemetryLoggers(props, dispatch);
46
- }, [dispatch]);
47
- return /*#__PURE__*/React.createElement(ErrorBoundary, {
48
- onError: error => {
49
- logWidgetLoadWithUnexpectedError(error);
50
- }
51
- }, /*#__PURE__*/React.createElement(FacadeChatSDKStore.Provider, {
40
+ return /*#__PURE__*/React.createElement(FacadeChatSDKStore.Provider, {
52
41
  value: [facadeChatSDK, setFacadeChatSDK]
53
42
  }, /*#__PURE__*/React.createElement(ChatSDKStore.Provider, {
54
43
  value: chatSDK
@@ -56,6 +45,6 @@ export const LiveChatWidget = props => {
56
45
  value: [adapter, setAdapter]
57
46
  }, /*#__PURE__*/React.createElement(ChatContextStore.Provider, {
58
47
  value: [state, dispatch]
59
- }, /*#__PURE__*/React.createElement(LiveChatWidgetStateful, props))))));
48
+ }, /*#__PURE__*/React.createElement(LiveChatWidgetStateful, props)))));
60
49
  };
61
50
  export default LiveChatWidget;
@@ -6,7 +6,7 @@ export const isPostChatSurveyEnabled = async facadeChatSDK => {
6
6
  const postChatEnabled = (_chatConfig$LiveWSAnd = chatConfig.LiveWSAndLiveChatEngJoin) === null || _chatConfig$LiveWSAnd === void 0 ? void 0 : _chatConfig$LiveWSAnd.msdyn_postconversationsurveyenable.toString().toLowerCase();
7
7
  return postChatEnabled === "true";
8
8
  };
9
- export const isPersistentChatEnabled = conversationMode => {
9
+ export const isPersistentChatEnabled = async conversationMode => {
10
10
  if (isNullOrUndefined(conversationMode)) {
11
11
  return false;
12
12
  }
@@ -1,23 +1,16 @@
1
1
  import { isPersistentChatEnabled } from "./liveChatConfigUtils";
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- export const shouldSetPreChatIfPersistentChat = async (facadeChatSDK, conversationMode, showPreChat) => {
5
- const persistentEnabled = isPersistentChatEnabled(conversationMode);
4
+ export const shouldSetPreChatIfPersistentChat = async (chatSDK, conversationMode, showPreChat) => {
5
+ const persistentEnabled = await isPersistentChatEnabled(conversationMode);
6
6
  let skipPreChat = false;
7
7
  if (persistentEnabled) {
8
- // Access private properties using type assertions
9
- const chatSDK = facadeChatSDK.getChatSDK();
10
-
11
- // Use type assertion to bypass private access restriction
12
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- const sdkAsAny = chatSDK;
14
- // most likely this is not set , the facade will take care of it
15
8
  const reconnectableChatsParams = {
16
- authenticatedUserToken: sdkAsAny.authenticatedUserToken,
17
- requestId: sdkAsAny.requestId
9
+ authenticatedUserToken: chatSDK.authenticatedUserToken,
10
+ requestId: chatSDK.requestId
18
11
  };
19
12
  try {
20
- const reconnectableChatsResponse = await facadeChatSDK.getReconnectableChats(reconnectableChatsParams);
13
+ const reconnectableChatsResponse = await chatSDK.OCClient.getReconnectableChats(reconnectableChatsParams);
21
14
  if (reconnectableChatsResponse && reconnectableChatsResponse.reconnectid) {
22
15
  // Skip rendering prechat on existing persistent chat session
23
16
  skipPreChat = true;
@@ -67,10 +67,6 @@ const getChatReconnectContext = async (facadeChatSDK, chatConfig, props, isAuthe
67
67
  // AuthToken will be reset later at start chat
68
68
  removeAuthTokenProvider(facadeChatSDK.getChatSDK());
69
69
  }
70
- TelemetryHelper.logSDKEvent(LogLevel.INFO, {
71
- Event: TelemetryEvent.GetChatReconnectContextSDKCallSucceeded,
72
- Description: "Reconnect context SDK call succeeded"
73
- });
74
70
  return reconnectChatContext;
75
71
  }
76
72
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -69,7 +69,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
69
69
  const parseToJson = false;
70
70
  const preChatSurveyResponse = (props === null || props === void 0 ? void 0 : (_props$preChatSurveyP = props.preChatSurveyPaneProps) === null || _props$preChatSurveyP === void 0 ? void 0 : (_props$preChatSurveyP2 = _props$preChatSurveyP.controlProps) === null || _props$preChatSurveyP2 === void 0 ? void 0 : _props$preChatSurveyP2.payload) ?? (await facadeChatSDK.getPreChatSurvey(parseToJson));
71
71
  let showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse && !(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hidePreChatSurveyPane);
72
- showPrechat = await shouldSetPreChatIfPersistentChat(facadeChatSDK, state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$l = _state$domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_conversationmode, showPrechat);
72
+ showPrechat = await shouldSetPreChatIfPersistentChat(facadeChatSDK.getChatSDK(), state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$l = _state$domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_conversationmode, showPrechat);
73
73
  if (showPrechat) {
74
74
  var _state$domainStates2, _state$domainStates2$, _state$domainStates2$2, _state$domainStates2$3;
75
75
  const isOutOfOperatingHours = (state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : (_state$domainStates2$ = _state$domainStates2.liveChatConfig) === null || _state$domainStates2$ === void 0 ? void 0 : (_state$domainStates2$2 = _state$domainStates2$.LiveWSAndLiveChatEngJoin) === null || _state$domainStates2$2 === void 0 ? void 0 : (_state$domainStates2$3 = _state$domainStates2$2.OutOfOperatingHours) === null || _state$domainStates2$3 === void 0 ? void 0 : _state$domainStates2$3.toString().toLowerCase()) === "true";
@@ -156,7 +156,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
156
156
  const initStartChat = async (facadeChatSDK, dispatch, setAdapter, state, props, params, persistedState) => {
157
157
  var _state$domainStates7, _state$domainStates7$, _state$domainStates7$2;
158
158
  let isStartChatSuccessful = false;
159
- const persistentChatEnabled = isPersistentChatEnabled(state === null || state === void 0 ? void 0 : (_state$domainStates7 = state.domainStates) === null || _state$domainStates7 === void 0 ? void 0 : (_state$domainStates7$ = _state$domainStates7.liveChatConfig) === null || _state$domainStates7$ === void 0 ? void 0 : (_state$domainStates7$2 = _state$domainStates7$.LiveWSAndLiveChatEngJoin) === null || _state$domainStates7$2 === void 0 ? void 0 : _state$domainStates7$2.msdyn_conversationmode);
159
+ const persistentChatEnabled = await isPersistentChatEnabled(state === null || state === void 0 ? void 0 : (_state$domainStates7 = state.domainStates) === null || _state$domainStates7 === void 0 ? void 0 : (_state$domainStates7$ = _state$domainStates7.liveChatConfig) === null || _state$domainStates7$ === void 0 ? void 0 : (_state$domainStates7$2 = _state$domainStates7$.LiveWSAndLiveChatEngJoin) === null || _state$domainStates7$2 === void 0 ? void 0 : _state$domainStates7$2.msdyn_conversationmode);
160
160
  if ((state === null || state === void 0 ? void 0 : state.appStates.conversationState) === ConversationState.Closed) {
161
161
  // Preventive reset to avoid starting chat with previous requestId which could potentially cause problems
162
162
  chatSDKStateCleanUp(facadeChatSDK.getChatSDK());
@@ -10,11 +10,6 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
10
10
  import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
11
11
  import { getWidgetCacheIdfromProps } from "../../../common/utils";
12
12
 
13
- // Helper function to check if error is authentication-related
14
- const isAuthenticationError = errorMessage => {
15
- return errorMessage === WidgetLoadCustomErrorString.AuthenticationFailedErrorString || errorMessage.startsWith("Authentication Setup Error:") || errorMessage.includes("Token validation failed") || errorMessage.includes("Authentication token");
16
- };
17
-
18
13
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
14
  export const handleStartChatError = (dispatch, facadeChatSDK, props, ex, isStartChatSuccessful) => {
20
15
  var _props$controlProps;
@@ -23,16 +18,19 @@ export const handleStartChatError = (dispatch, facadeChatSDK, props, ex, isStart
23
18
  return;
24
19
  }
25
20
 
26
- // Handle authentication-related errors
27
- if (isAuthenticationError(ex.message)) {
21
+ // Handle internal or misc errors
22
+ if (ex.message === WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
28
23
  dispatch({
29
24
  type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
30
25
  payload: StartChatFailureType.AuthSetupError
31
26
  });
27
+ // set conversation to error to enforce error UI pane
28
+ dispatch({
29
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
30
+ payload: ConversationState.Error
31
+ });
32
32
  logWidgetLoadCompleteWithError(ex);
33
- // Don't return early - let the generic error handling logic handle hideErrorUIPane and telemetry
34
33
  }
35
-
36
34
  if (ex.message === WidgetLoadCustomErrorString.NetworkErrorString) {
37
35
  logWidgetLoadCompleteWithError(ex);
38
36
  }
@@ -55,11 +53,8 @@ export const handleStartChatError = (dispatch, facadeChatSDK, props, ex, isStart
55
53
  case ChatSDKErrorName.UninitializedChatSDK:
56
54
  handleUninitializedChatSDK(ex);
57
55
  break;
56
+ // Handle the case indicating failure to retrieve an authenticated chat conversation
58
57
  case ChatSDKErrorName.AuthenticatedChatConversationRetrievalFailure:
59
- dispatch({
60
- type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
61
- payload: StartChatFailureType.Unauthorized
62
- });
63
58
  logWidgetLoadCompleteWithError(ex);
64
59
  break;
65
60
  case ChatSDKErrorName.InvalidConversation:
@@ -111,9 +106,6 @@ const logWidgetLoadFailed = ex => {
111
106
  if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
112
107
  exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
113
108
  }
114
- if (ex !== null && ex !== void 0 && ex.exceptionDetails) {
115
- exDetails.ChatSDKExceptionDetails = ex.exceptionDetails;
116
- }
117
109
  TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.ERROR, {
118
110
  Event: TelemetryEvent.WidgetLoadFailed,
119
111
  Description: "Widget load complete with error",
@@ -142,9 +134,6 @@ const logWidgetLoadCompleteWithError = ex => {
142
134
  if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
143
135
  exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
144
136
  }
145
- if (ex !== null && ex !== void 0 && ex.exceptionDetails) {
146
- exDetails.ChatSDKExceptionDetails = ex.exceptionDetails;
147
- }
148
137
  TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.ERROR, {
149
138
  Event: TelemetryEvent.WidgetLoadFailed,
150
139
  Description: "Widget load complete with error",
@@ -152,34 +141,6 @@ const logWidgetLoadCompleteWithError = ex => {
152
141
  ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
153
142
  });
154
143
  };
155
- export const logWidgetLoadWithUnexpectedError = ex => {
156
- var _TelemetryTimers$Widg4;
157
- // eslint-disable-line @typescript-eslint/no-explicit-any
158
- const details = {
159
- message: (ex === null || ex === void 0 ? void 0 : ex.message) || "An unexpected error occurred",
160
- stack: (ex === null || ex === void 0 ? void 0 : ex.stack) || "No stack trace available"
161
- };
162
- let additionalDetails = "";
163
- try {
164
- additionalDetails = JSON.stringify(details);
165
- } catch (error) {
166
- additionalDetails = "Failed to stringify error details";
167
- }
168
-
169
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
170
- const exDetails = {
171
- Exception: `Widget load with unexpected error: ${additionalDetails}`
172
- };
173
- if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
174
- exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
175
- }
176
- TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.ERROR, {
177
- Event: TelemetryEvent.WidgetLoadFailed,
178
- Description: "Widget load with unexpected error",
179
- ExceptionDetails: exDetails,
180
- ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed
181
- });
182
- };
183
144
 
184
145
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
185
146
  const forceEndChat = facadeChatSDK => {
@@ -232,12 +193,6 @@ const handleChatTokenRetrievalFailure = (dispatch, ex) => {
232
193
  type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
233
194
  payload: StartChatFailureType.Unauthorized
234
195
  });
235
- } else {
236
- // For other authentication-related token retrieval failures, set as AuthSetupError
237
- dispatch({
238
- type: LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
239
- payload: StartChatFailureType.AuthSetupError
240
- });
241
196
  }
242
197
  logWidgetLoadCompleteWithError(ex);
243
198
  }
@@ -48,6 +48,7 @@ import { initCallingSdk } from "../common/initCallingSdk";
48
48
  import { initConfirmationPropsComposer } from "../common/initConfirmationPropsComposer";
49
49
  import { initWebChatComposer } from "../common/initWebChatComposer";
50
50
  import { registerBroadcastServiceForStorage } from "../../../common/storage/default/defaultCacheManager";
51
+ import { registerTelemetryLoggers } from "../common/registerTelemetryLoggers";
51
52
  import { setPostChatContextAndLoadSurvey } from "../common/setPostChatContextAndLoadSurvey";
52
53
  import { startProactiveChat } from "../common/startProactiveChat";
53
54
  import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
@@ -55,7 +56,7 @@ import useChatContextStore from "../../../hooks/useChatContextStore";
55
56
  import useFacadeSDKStore from "../../../hooks/useFacadeChatSDKStore";
56
57
  let uiTimer;
57
58
  export const LiveChatWidgetStateful = props => {
58
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$styleProps, _props$webChatContain10, _props$webChatContain11, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain15, _state$appStates14, _props$webChatContain17, _props$webChatContain18, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
59
+ var _props$webChatContain, _props$styleProps, _props$webChatContain2, _props$webChatContain3, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain7, _state$appStates14, _props$webChatContain9, _props$webChatContain10, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _props$webChatContain11, _props$webChatContain12, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _props$webChatContain17, _props$webChatContain18, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
59
60
  useEffect(() => {
60
61
  uiTimer = createTimer();
61
62
  TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
@@ -74,13 +75,10 @@ export const LiveChatWidgetStateful = props => {
74
75
  const [facadeChatSDK] = useFacadeSDKStore();
75
76
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
77
  const [voiceVideoCallingSDK, setVoiceVideoCallingSDK] = useState(undefined);
77
- const [conversationId, setConversationId] = useState("");
78
78
  const {
79
79
  Composer
80
80
  } = Components;
81
81
  const canStartProactiveChat = useRef(true);
82
- const bubbleBackground = ((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.webChatStyles) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.bubbleBackground) ?? ((_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : (_props$webChatContain5 = _props$webChatContain4.adaptiveCardStyles) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.background) ?? defaultAdaptiveCardStyles.background;
83
- const bubbleTextColor = ((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : (_props$webChatContain7 = _props$webChatContain6.webChatStyles) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.bubbleTextColor) ?? ((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : (_props$webChatContain9 = _props$webChatContain8.adaptiveCardStyles) === null || _props$webChatContain9 === void 0 ? void 0 : _props$webChatContain9.color) ?? defaultAdaptiveCardStyles.color;
84
82
 
85
83
  // Process general styles
86
84
  const generalStyles = {
@@ -89,7 +87,7 @@ export const LiveChatWidgetStateful = props => {
89
87
 
90
88
  //Scrollbar styles
91
89
  const scrollbarProps = Object.assign({}, defaultScrollBarProps, props === null || props === void 0 ? void 0 : props.scrollBarProps);
92
- const sendBoxTextArea = props === null || props === void 0 ? void 0 : (_props$webChatContain10 = props.webChatContainerProps) === null || _props$webChatContain10 === void 0 ? void 0 : (_props$webChatContain11 = _props$webChatContain10.sendBoxTextBox) === null || _props$webChatContain11 === void 0 ? void 0 : _props$webChatContain11.textarea;
90
+ const sendBoxTextArea = props === null || props === void 0 ? void 0 : (_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.sendBoxTextBox) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.textarea;
93
91
 
94
92
  // In case the broadcast channel is already initialized elsewhere; One tab can only hold 1 instance
95
93
  if ((props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.skipBroadcastChannelInit) !== true) {
@@ -222,6 +220,7 @@ export const LiveChatWidgetStateful = props => {
222
220
  state.domainStates.confirmationPaneConfirmedOptionClicked = false;
223
221
  state.domainStates.confirmationState = ConfirmationState.NotSet;
224
222
  setupClientDataStore();
223
+ registerTelemetryLoggers(props, dispatch);
225
224
  createInternetConnectionChangeHandler(state);
226
225
  dispatch({
227
226
  type: LiveChatWidgetActionType.SET_WIDGET_ELEMENT_ID,
@@ -571,14 +570,6 @@ export const LiveChatWidgetStateful = props => {
571
570
  });
572
571
  });
573
572
 
574
- // Retrieve convId
575
- BroadcastService.getMessageByEventName(BroadcastEvent.UpdateConversationDataForTelemetry).subscribe(msg => {
576
- var _msg$payload11, _msg$payload11$liveWo;
577
- if ((_msg$payload11 = msg.payload) !== null && _msg$payload11 !== void 0 && (_msg$payload11$liveWo = _msg$payload11.liveWorkItem) !== null && _msg$payload11$liveWo !== void 0 && _msg$payload11$liveWo.conversationId) {
578
- setConversationId(msg.payload.liveWorkItem.conversationId);
579
- }
580
- });
581
-
582
573
  // Check for TPC and log in telemetry if blocked
583
574
  isCookieAllowed();
584
575
  return () => {
@@ -625,8 +616,8 @@ export const LiveChatWidgetStateful = props => {
625
616
  });
626
617
  }
627
618
  if (state.appStates.conversationState === ConversationState.InActive) {
628
- var _props$webChatContain12, _props$webChatContain13;
629
- if ((props === null || props === void 0 ? void 0 : (_props$webChatContain12 = props.webChatContainerProps) === null || _props$webChatContain12 === void 0 ? void 0 : (_props$webChatContain13 = _props$webChatContain12.renderingMiddlewareProps) === null || _props$webChatContain13 === void 0 ? void 0 : _props$webChatContain13.hideSendboxOnConversationEnd) !== false) {
619
+ var _props$webChatContain4, _props$webChatContain5;
620
+ if ((props === null || props === void 0 ? void 0 : (_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : (_props$webChatContain5 = _props$webChatContain4.renderingMiddlewareProps) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.hideSendboxOnConversationEnd) !== false) {
630
621
  setWebChatStyles(styles => {
631
622
  return {
632
623
  ...styles,
@@ -670,12 +661,12 @@ export const LiveChatWidgetStateful = props => {
670
661
  }
671
662
  }, [state.appStates.unreadMessageCount]);
672
663
  useEffect(() => {
673
- var _props$webChatContain14;
664
+ var _props$webChatContain6;
674
665
  setWebChatStyles({
675
666
  ...webChatStyles,
676
- ...((_props$webChatContain14 = props.webChatContainerProps) === null || _props$webChatContain14 === void 0 ? void 0 : _props$webChatContain14.webChatStyles)
667
+ ...((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.webChatStyles)
677
668
  });
678
- }, [(_props$webChatContain15 = props.webChatContainerProps) === null || _props$webChatContain15 === void 0 ? void 0 : _props$webChatContain15.webChatStyles]);
669
+ }, [(_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.webChatStyles]);
679
670
  useEffect(() => {
680
671
  //Confirmation pane dismissing through OK option, so proceed with end chat
681
672
  if (state.domainStates.confirmationState === ConfirmationState.Ok) {
@@ -774,12 +765,12 @@ export const LiveChatWidgetStateful = props => {
774
765
 
775
766
  // if props state gets updates we need to update the renderingMiddlewareProps in the state
776
767
  useEffect(() => {
777
- var _props$webChatContain16;
768
+ var _props$webChatContain8;
778
769
  dispatch({
779
770
  type: LiveChatWidgetActionType.SET_RENDERING_MIDDLEWARE_PROPS,
780
- payload: (_props$webChatContain16 = props.webChatContainerProps) === null || _props$webChatContain16 === void 0 ? void 0 : _props$webChatContain16.renderingMiddlewareProps
771
+ payload: (_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.renderingMiddlewareProps
781
772
  });
782
- }, [(_props$webChatContain17 = props.webChatContainerProps) === null || _props$webChatContain17 === void 0 ? void 0 : _props$webChatContain17.renderingMiddlewareProps]);
773
+ }, [(_props$webChatContain9 = props.webChatContainerProps) === null || _props$webChatContain9 === void 0 ? void 0 : _props$webChatContain9.renderingMiddlewareProps]);
783
774
  useEffect(() => {
784
775
  TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
785
776
  Event: TelemetryEvent.UXLiveChatWidgetCompleted,
@@ -822,7 +813,7 @@ export const LiveChatWidgetStateful = props => {
822
813
  const webChatProps = initWebChatComposer(props, state, dispatch, facadeChatSDK, endChatRelay);
823
814
  const downloadTranscriptProps = createDownloadTranscriptProps(props.downloadTranscriptProps, {
824
815
  ...(defaultWebChatContainerStatefulProps === null || defaultWebChatContainerStatefulProps === void 0 ? void 0 : defaultWebChatContainerStatefulProps.webChatStyles),
825
- ...((_props$webChatContain18 = props.webChatContainerProps) === null || _props$webChatContain18 === void 0 ? void 0 : _props$webChatContain18.webChatStyles)
816
+ ...((_props$webChatContain10 = props.webChatContainerProps) === null || _props$webChatContain10 === void 0 ? void 0 : _props$webChatContain10.webChatStyles)
826
817
  }, props.webChatContainerProps);
827
818
  const livechatProps = {
828
819
  ...props,
@@ -848,11 +839,6 @@ export const LiveChatWidgetStateful = props => {
848
839
  setOcUserAgent(facadeChatSDK.getChatSDK());
849
840
  const directLine = ((_livechatProps$webCha = livechatProps.webChatContainerProps) === null || _livechatProps$webCha === void 0 ? void 0 : _livechatProps$webCha.directLine) ?? adapter ?? defaultWebChatContainerStatefulProps.directLine;
850
841
  const userID = directLine.getState ? directLine === null || directLine === void 0 ? void 0 : directLine.getState("acs.userId") : "teamsvisitor";
851
- const styleOptions = React.useMemo(() => ({
852
- ...webChatStyles,
853
- bubbleBackground,
854
- bubbleTextColor
855
- }), [webChatStyles, bubbleBackground, bubbleTextColor]);
856
842
 
857
843
  // WebChat's Composer can only be rendered if a directLine object is defined
858
844
  return directLine && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
@@ -891,7 +877,11 @@ export const LiveChatWidgetStateful = props => {
891
877
  }`}
892
878
  `), /*#__PURE__*/React.createElement(DraggableChatWidget, chatWidgetDraggableConfig, /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
893
879
  userID: userID,
894
- styleOptions: styleOptions,
880
+ styleOptions: {
881
+ ...webChatStyles,
882
+ bubbleBackground: ((_props$webChatContain11 = props.webChatContainerProps) === null || _props$webChatContain11 === void 0 ? void 0 : (_props$webChatContain12 = _props$webChatContain11.webChatStyles) === null || _props$webChatContain12 === void 0 ? void 0 : _props$webChatContain12.bubbleBackground) ?? ((_props$webChatContain13 = props.webChatContainerProps) === null || _props$webChatContain13 === void 0 ? void 0 : (_props$webChatContain14 = _props$webChatContain13.adaptiveCardStyles) === null || _props$webChatContain14 === void 0 ? void 0 : _props$webChatContain14.background) ?? defaultAdaptiveCardStyles.background,
883
+ bubbleTextColor: ((_props$webChatContain15 = props.webChatContainerProps) === null || _props$webChatContain15 === void 0 ? void 0 : (_props$webChatContain16 = _props$webChatContain15.webChatStyles) === null || _props$webChatContain16 === void 0 ? void 0 : _props$webChatContain16.bubbleTextColor) ?? ((_props$webChatContain17 = props.webChatContainerProps) === null || _props$webChatContain17 === void 0 ? void 0 : (_props$webChatContain18 = _props$webChatContain17.adaptiveCardStyles) === null || _props$webChatContain18 === void 0 ? void 0 : _props$webChatContain18.color) ?? defaultAdaptiveCardStyles.color
884
+ },
895
885
  directLine: directLine
896
886
  }), /*#__PURE__*/React.createElement(Stack, {
897
887
  id: widgetElementId,
@@ -922,8 +912,6 @@ export const LiveChatWidgetStateful = props => {
922
912
  }, livechatProps.callingContainerProps)), !((_livechatProps$contro11 = livechatProps.controlProps) !== null && _livechatProps$contro11 !== void 0 && _livechatProps$contro11.hideWebChatContainer) && shouldShowWebChatContainer(state) && (decodeComponentString((_livechatProps$compon9 = livechatProps.componentOverrides) === null || _livechatProps$compon9 === void 0 ? void 0 : _livechatProps$compon9.webChatContainer) || /*#__PURE__*/React.createElement(WebChatContainerStateful, livechatProps)), !((_livechatProps$contro12 = livechatProps.controlProps) !== null && _livechatProps$contro12 !== void 0 && _livechatProps$contro12.hideConfirmationPane) && shouldShowConfirmationPane(state) && (decodeComponentString((_livechatProps$compon10 = livechatProps.componentOverrides) === null || _livechatProps$compon10 === void 0 ? void 0 : _livechatProps$compon10.confirmationPane) || /*#__PURE__*/React.createElement(ConfirmationPaneStateful, _extends({}, confirmationPaneProps, {
923
913
  setPostChatContext: setPostChatContextRelay,
924
914
  prepareEndChat: prepareEndChatRelay
925
- }))), !((_livechatProps$contro13 = livechatProps.controlProps) !== null && _livechatProps$contro13 !== void 0 && _livechatProps$contro13.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK, {
926
- customerVoiceSurveyCorrelationId: conversationId
927
- }))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon13 = livechatProps.componentOverrides) === null || _livechatProps$compon13 === void 0 ? void 0 : _livechatProps$compon13.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane))))));
915
+ }))), !((_livechatProps$contro13 = livechatProps.controlProps) !== null && _livechatProps$contro13 !== void 0 && _livechatProps$contro13.hidePostChatLoadingPane) && shouldShowPostChatLoadingPane(state) && (decodeComponentString((_livechatProps$compon11 = livechatProps.componentOverrides) === null || _livechatProps$compon11 === void 0 ? void 0 : _livechatProps$compon11.postChatLoadingPane) || /*#__PURE__*/React.createElement(PostChatLoadingPaneStateful, livechatProps.postChatLoadingPaneProps)), shouldShowPostChatSurveyPane(state) && (decodeComponentString((_livechatProps$compon12 = livechatProps.componentOverrides) === null || _livechatProps$compon12 === void 0 ? void 0 : _livechatProps$compon12.postChatSurveyPane) || /*#__PURE__*/React.createElement(PostChatSurveyPaneStateful, _extends({}, livechatProps.postChatSurveyPaneProps, livechatProps.chatSDK))), createFooter(livechatProps, state), shouldShowEmailTranscriptPane(state) && (decodeComponentString((_livechatProps$compon13 = livechatProps.componentOverrides) === null || _livechatProps$compon13 === void 0 ? void 0 : _livechatProps$compon13.emailTranscriptPane) || /*#__PURE__*/React.createElement(EmailTranscriptPaneStateful, livechatProps.emailTranscriptPane))))));
928
916
  };
929
917
  export default LiveChatWidgetStateful;