@microsoft/omnichannel-chat-widget 1.8.1-main.3ee330c → 1.8.1-main.565f247

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 (44) hide show
  1. package/lib/cjs/common/facades/FacadeChatSDK.js +0 -42
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +0 -4
  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 +1 -30
  12. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +19 -31
  13. package/lib/cjs/components/ooohpanestateful/OOOHPaneStateful.js +2 -23
  14. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -14
  15. package/lib/cjs/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +0 -1
  16. package/lib/esm/common/facades/FacadeChatSDK.js +0 -42
  17. package/lib/esm/common/telemetry/TelemetryConstants.js +0 -4
  18. package/lib/esm/common/telemetry/TelemetryManager.js +2 -2
  19. package/lib/esm/common/utils.js +0 -3
  20. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +3 -7
  21. package/lib/esm/components/livechatwidget/LiveChatWidget.js +5 -16
  22. package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +1 -1
  23. package/lib/esm/components/livechatwidget/common/persistentChatHelper.js +5 -12
  24. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +0 -4
  25. package/lib/esm/components/livechatwidget/common/startChat.js +2 -2
  26. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +0 -28
  27. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +19 -31
  28. package/lib/esm/components/ooohpanestateful/OOOHPaneStateful.js +2 -23
  29. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +5 -14
  30. package/lib/esm/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.js +0 -1
  31. package/lib/types/common/facades/FacadeChatSDK.d.ts +0 -1
  32. package/lib/types/common/telemetry/TelemetryConstants.d.ts +0 -4
  33. package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +1 -1
  34. package/lib/types/components/livechatwidget/common/persistentChatHelper.d.ts +1 -2
  35. package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +0 -1
  36. package/lib/types/components/postchatsurveypanestateful/enums/CustomerVoiceEvents.d.ts +1 -2
  37. package/lib/types/components/postchatsurveypanestateful/interfaces/IPostChatSurveyPaneStatefulProps.d.ts +0 -1
  38. package/package.json +2 -2
  39. package/lib/cjs/common/utils/xssUtils.js +0 -79
  40. package/lib/cjs/components/errorboundary/ErrorBoundary.js +0 -68
  41. package/lib/esm/common/utils/xssUtils.js +0 -72
  42. package/lib/esm/components/errorboundary/ErrorBoundary.js +0 -59
  43. package/lib/types/common/utils/xssUtils.d.ts +0 -29
  44. package/lib/types/components/errorboundary/ErrorBoundary.d.ts +0 -14
@@ -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 failed: Process to get a token failed for getReconnectableChats, ${pingResponse.message}`;
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(errorMessage);
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";
@@ -253,7 +250,6 @@ export let TelemetryEvent;
253
250
  TelemetryEvent["UXNotificationPaneCompleted"] = "UXNotificationPaneCompleted";
254
251
  TelemetryEvent["UXOutOfOfficeHoursPaneStart"] = "UXOutOfOfficeHoursPaneStart";
255
252
  TelemetryEvent["UXOutOfOfficeHoursPaneCompleted"] = "UXOutOfOfficeHoursPaneCompleted";
256
- TelemetryEvent["XSSTextDetected"] = "XSSTextDetected";
257
253
  TelemetryEvent["UXPostChatLoadingPaneStart"] = "UXPostChatLoadingPaneStart";
258
254
  TelemetryEvent["UXPostChatLoadingPaneCompleted"] = "UXPostChatLoadingPaneCompleted";
259
255
  TelemetryEvent["UXPrechatPaneStart"] = "UXPrechatPaneStart";
@@ -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());
@@ -141,34 +141,6 @@ const logWidgetLoadCompleteWithError = ex => {
141
141
  ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg3 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg3 === void 0 ? void 0 : _TelemetryTimers$Widg3.milliSecondsElapsed
142
142
  });
143
143
  };
144
- export const logWidgetLoadWithUnexpectedError = ex => {
145
- var _TelemetryTimers$Widg4;
146
- // eslint-disable-line @typescript-eslint/no-explicit-any
147
- const details = {
148
- message: (ex === null || ex === void 0 ? void 0 : ex.message) || "An unexpected error occurred",
149
- stack: (ex === null || ex === void 0 ? void 0 : ex.stack) || "No stack trace available"
150
- };
151
- let additionalDetails = "";
152
- try {
153
- additionalDetails = JSON.stringify(details);
154
- } catch (error) {
155
- additionalDetails = "Failed to stringify error details";
156
- }
157
-
158
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
159
- const exDetails = {
160
- Exception: `Widget load with unexpected error: ${additionalDetails}`
161
- };
162
- if (ex !== null && ex !== void 0 && ex.httpResponseStatusCode) {
163
- exDetails.HttpResponseStatusCode = ex.httpResponseStatusCode;
164
- }
165
- TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.ERROR, {
166
- Event: TelemetryEvent.WidgetLoadFailed,
167
- Description: "Widget load with unexpected error",
168
- ExceptionDetails: exDetails,
169
- ElapsedTimeInMilliseconds: TelemetryTimers === null || TelemetryTimers === void 0 ? void 0 : (_TelemetryTimers$Widg4 = TelemetryTimers.WidgetLoadTimer) === null || _TelemetryTimers$Widg4 === void 0 ? void 0 : _TelemetryTimers$Widg4.milliSecondsElapsed
170
- });
171
- };
172
144
 
173
145
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
174
146
  const forceEndChat = facadeChatSDK => {
@@ -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;
@@ -1,13 +1,12 @@
1
1
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
2
  import React, { useEffect } from "react";
3
3
  import { createTimer, findAllFocusableElement } from "../../common/utils";
4
+ import DOMPurify from "dompurify";
4
5
  import { OutOfOfficeHoursPane } from "@microsoft/omnichannel-chat-components";
5
6
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
6
7
  import { defaultGeneralStyleProps } from "./common/defaultStyleProps/defaultgeneralOOOHPaneStyleProps";
7
- import { detectAndCleanXSS } from "../../common/utils/xssUtils";
8
8
  import useChatContextStore from "../../hooks/useChatContextStore";
9
9
  let uiTimer;
10
- const OOOHPaneTitleText = "Thanks for contacting us. You have reached us outside of our operating hours. An agent will respond when we open.";
11
10
  export const OutOfOfficeHoursPaneStateful = props => {
12
11
  var _props$styleProps;
13
12
  useEffect(() => {
@@ -46,28 +45,8 @@ export const OutOfOfficeHoursPaneStateful = props => {
46
45
  ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
47
46
  });
48
47
  }, []);
49
-
50
- // Enhanced titleText sanitization
51
48
  if (controlProps !== null && controlProps !== void 0 && controlProps.titleText) {
52
- const {
53
- cleanText,
54
- isXSSDetected
55
- } = detectAndCleanXSS(controlProps.titleText);
56
- if (!isXSSDetected) {
57
- // replace with the sanitized text
58
- controlProps.titleText = cleanText;
59
- } else {
60
- TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.WARN, {
61
- Event: TelemetryEvent.XSSTextDetected,
62
- Description: "Potential XSS attempt detected in titleText",
63
- CustomProperties: {
64
- originalText: controlProps.titleText.substring(0, 100),
65
- // Log first 100 chars for analysis
66
- cleanedText: cleanText.substring(0, 100)
67
- }
68
- });
69
- controlProps.titleText = OOOHPaneTitleText;
70
- }
49
+ controlProps.titleText = DOMPurify.sanitize(controlProps.titleText);
71
50
  }
72
51
  return /*#__PURE__*/React.createElement(OutOfOfficeHoursPane, {
73
52
  componentOverrides: props.componentOverrides,
@@ -9,14 +9,13 @@ import { defaultGeneralPostChatSurveyPaneStyleProps } from "./common/defaultStyl
9
9
  import { findAllFocusableElement } from "../../common/utils";
10
10
  import useChatContextStore from "../../hooks/useChatContextStore";
11
11
  import isValidSurveyUrl from "./common/isValidSurveyUrl";
12
- const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact, customerVoiceSurveyCorrelationId) {
13
- let showMultiLingual = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
12
+ const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
13
+ let showMultiLingual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
14
14
  const surveyLinkParams = new URLSearchParams({
15
15
  embed: isEmbed.toString(),
16
16
  compact: (compact ?? true).toString(),
17
17
  lang: locale ?? "en-us",
18
- showmultilingual: (showMultiLingual ?? false).toString(),
19
- cvResponsePageRequestId: customerVoiceSurveyCorrelationId
18
+ showmultilingual: (showMultiLingual ?? false).toString()
20
19
  });
21
20
  return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
22
21
  };
@@ -32,9 +31,9 @@ export const PostChatSurveyPaneStateful = props => {
32
31
  // Bot survey enabled
33
32
  state.appStates.postChatParticipantType === ParticipantType.Bot) {
34
33
  // Only Bot has engaged
35
- surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
34
+ surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
36
35
  } else {
37
- surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
36
+ surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
38
37
  }
39
38
  if (props.copilotSurveyContext) {
40
39
  surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
@@ -97,14 +96,6 @@ export const PostChatSurveyPaneStateful = props => {
97
96
  message: "Customer Voice form response error."
98
97
  }
99
98
  });
100
- } else if (typeof data === "string" && data.startsWith(CustomerVoiceEvents.FormsError)) {
101
- TelemetryHelper.logActionEventToAllTelemetry(LogLevel.ERROR, {
102
- Event: TelemetryEvent.CustomerVoiceFormsError,
103
- Description: "Customer Voice failed to load with forms error.",
104
- ExceptionDetails: {
105
- message: `Customer Voice forms error details: ${data}`
106
- }
107
- });
108
99
  }
109
100
  });
110
101
  }, []);
@@ -3,5 +3,4 @@ export let CustomerVoiceEvents;
3
3
  CustomerVoiceEvents["ResponsePageLoaded"] = "ResponsePageLoaded";
4
4
  CustomerVoiceEvents["FormResponseSubmitted"] = "FormResponseSubmitted";
5
5
  CustomerVoiceEvents["FormResponseError"] = "FormResponseError";
6
- CustomerVoiceEvents["FormsError"] = "FormsError";
7
6
  })(CustomerVoiceEvents || (CustomerVoiceEvents = {}));
@@ -72,5 +72,4 @@ export declare class FacadeChatSDK {
72
72
  getVoiceVideoCalling(params?: VoiceVideoCallingOptionalParams): Promise<GetVoiceVideoCallingResponse>;
73
73
  getPostChatSurveyContext(): Promise<PostChatContext>;
74
74
  getAgentAvailability(optionalParams?: GetAgentAvailabilityOptionalParams): Promise<GetAgentAvailabilityResponse>;
75
- getReconnectableChats(reconnectableChatsParams?: any): Promise<any>;
76
75
  }
@@ -94,8 +94,6 @@ export declare enum TelemetryEvent {
94
94
  DisconnectEndChatSDKCallFailed = "DisconnectEndChatSDKCallFailed",
95
95
  GetChatReconnectContextSDKCallStarted = "GetChatReconnectContextSDKCallStarted",
96
96
  GetChatReconnectContextSDKCallFailed = "GetChatReconnectContextSDKCallFailed",
97
- CheckContactIdError = "checkContactIdError",
98
- GetChatReconnectContextSDKCallSucceeded = "GetChatReconnectContextSDKCallSucceeded",
99
97
  ParseAdaptiveCardFailed = "ParseAdaptiveCardFailed",
100
98
  ClientDataStoreProviderFailed = "ClientDataStoreProviderFailed",
101
99
  InMemoryDataStoreFailed = "InMemoryDataStoreFailed",
@@ -163,7 +161,6 @@ export declare enum TelemetryEvent {
163
161
  CustomerVoiceResponsePageLoaded = "CustomerVoiceResponsePageLoaded",
164
162
  CustomerVoiceFormResponseSubmitted = "CustomerVoiceFormResponseSubmitted",
165
163
  CustomerVoiceFormResponseError = "CustomerVoiceFormResponseError",
166
- CustomerVoiceFormsError = "CustomerVoiceFormsError",
167
164
  BotAuthActivityEmptySasUrl = "BotAuthActivityEmptySasUrl",
168
165
  SetBotAuthProviderFetchConfig = "SetBotAuthProviderFetchConfig",
169
166
  SetBotAuthProviderHideCard = "SetBotAuthProviderHideCard",
@@ -241,7 +238,6 @@ export declare enum TelemetryEvent {
241
238
  UXNotificationPaneCompleted = "UXNotificationPaneCompleted",
242
239
  UXOutOfOfficeHoursPaneStart = "UXOutOfOfficeHoursPaneStart",
243
240
  UXOutOfOfficeHoursPaneCompleted = "UXOutOfOfficeHoursPaneCompleted",
244
- XSSTextDetected = "XSSTextDetected",
245
241
  UXPostChatLoadingPaneStart = "UXPostChatLoadingPaneStart",
246
242
  UXPostChatLoadingPaneCompleted = "UXPostChatLoadingPaneCompleted",
247
243
  UXPrechatPaneStart = "UXPrechatPaneStart",
@@ -1,3 +1,3 @@
1
1
  import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
2
2
  export declare const isPostChatSurveyEnabled: (facadeChatSDK: FacadeChatSDK) => Promise<boolean>;
3
- export declare const isPersistentChatEnabled: (conversationMode: string | undefined) => boolean;
3
+ export declare const isPersistentChatEnabled: (conversationMode: string | undefined) => Promise<boolean>;
@@ -1,2 +1 @@
1
- import { FacadeChatSDK } from "../../../common/facades/FacadeChatSDK";
2
- export declare const shouldSetPreChatIfPersistentChat: (facadeChatSDK: FacadeChatSDK, conversationMode: string, showPreChat: boolean) => Promise<boolean>;
1
+ export declare const shouldSetPreChatIfPersistentChat: (chatSDK: any, conversationMode: string, showPreChat: boolean) => Promise<boolean>;
@@ -4,4 +4,3 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
4
4
  import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
5
5
  export declare const handleStartChatError: (dispatch: Dispatch<ILiveChatWidgetAction>, facadeChatSDK: FacadeChatSDK, props: ILiveChatWidgetProps | undefined, ex: any, isStartChatSuccessful: boolean) => void;
6
6
  export declare const logWidgetLoadComplete: (additionalMessage?: string) => void;
7
- export declare const logWidgetLoadWithUnexpectedError: (ex: any) => void;
@@ -1,6 +1,5 @@
1
1
  export declare enum CustomerVoiceEvents {
2
2
  ResponsePageLoaded = "ResponsePageLoaded",
3
3
  FormResponseSubmitted = "FormResponseSubmitted",
4
- FormResponseError = "FormResponseError",
5
- FormsError = "FormsError"
4
+ FormResponseError = "FormResponseError"
6
5
  }
@@ -2,5 +2,4 @@ import { IPostChatSurveyPaneProps } from "@microsoft/omnichannel-chat-components
2
2
  export interface IPostChatSurveyPaneStatefulProps extends IPostChatSurveyPaneProps {
3
3
  isCustomerVoiceSurveyCompact?: boolean;
4
4
  copilotSurveyContext?: Record<string, string>;
5
- customerVoiceSurveyCorrelationId?: string;
6
5
  }