@microsoft/omnichannel-chat-widget 1.6.2 → 1.6.3-main.25307f2

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 (23) hide show
  1. package/lib/cjs/common/utils.js +6 -2
  2. package/lib/cjs/components/livechatwidget/common/authHelper.js +4 -1
  3. package/lib/cjs/components/livechatwidget/common/endChat.js +1 -22
  4. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +13 -3
  5. package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +5 -0
  6. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -34
  7. package/lib/cjs/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +4 -2
  8. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
  9. package/lib/cjs/contexts/createReducer.js +653 -345
  10. package/lib/esm/common/utils.js +3 -0
  11. package/lib/esm/components/livechatwidget/common/authHelper.js +4 -1
  12. package/lib/esm/components/livechatwidget/common/endChat.js +2 -23
  13. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +15 -4
  14. package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +5 -0
  15. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +28 -34
  16. package/lib/esm/components/webchatcontainerstateful/common/utils/isMaskingFromCustomer.js +4 -2
  17. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
  18. package/lib/esm/contexts/createReducer.js +650 -343
  19. package/lib/types/common/utils.d.ts +1 -0
  20. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +1 -1
  21. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
  22. package/lib/types/contexts/createReducer.d.ts +1 -0
  23. package/package.json +2 -2
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
6
+ exports.setTabIndices = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseLowerCaseString = exports.parseAdaptiveCardPayload = exports.newGuid = exports.isUndefinedOrEmpty = exports.isNullOrUndefined = exports.isNullOrEmptyString = exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = exports.getConversationDetailsCall = exports.getBroadcastChannelName = exports.formatTemplateString = exports.findParentFocusableElementsWithoutChildContainer = exports.findAllFocusableElement = exports.extractPreChatSurveyResponseValues = exports.escapeHtml = exports.debounceLeading = exports.createTimer = exports.createFileAndDownload = exports.checkContactIdError = exports.changeLanguageCodeFormatForWebChat = exports.addDelayInMs = void 0;
7
7
  var _Constants = require("./Constants");
8
8
  var _TelemetryConstants = require("./telemetry/TelemetryConstants");
9
9
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
@@ -449,4 +449,8 @@ const formatTemplateString = (templateMessage, values) => {
449
449
  return typeof values[index] !== "undefined" ? values[index] : match;
450
450
  });
451
451
  };
452
- exports.formatTemplateString = formatTemplateString;
452
+ exports.formatTemplateString = formatTemplateString;
453
+ const parseLowerCaseString = property => {
454
+ return String(property).toLowerCase();
455
+ };
456
+ exports.parseLowerCaseString = parseLowerCaseString;
@@ -7,6 +7,7 @@ exports.removeAuthTokenProvider = exports.handleAuthentication = exports.getAuth
7
7
  var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
8
8
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
9
9
  var _utils = require("../../../common/utils");
10
+ var _Constants = require("../../../common/Constants");
10
11
  const getAuthClientFunction = chatConfig => {
11
12
  let authClientFunction = undefined;
12
13
  if (chatConfig !== null && chatConfig !== void 0 && chatConfig.LiveChatConfigAuthSettings) {
@@ -32,10 +33,12 @@ const handleAuthentication = async (chatSDK, chatConfig, getAuthToken) => {
32
33
  });
33
34
  return true;
34
35
  } else {
36
+ // instead of returning false, it's more appropiate to thrown an error to force error handling on the caller side
37
+ // this will help to avoid the error to be ignored and the chat to be started
35
38
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
36
39
  Event: _TelemetryConstants.TelemetryEvent.ReceivedNullOrEmptyToken
37
40
  });
38
- return false;
41
+ throw new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString);
39
42
  }
40
43
  }
41
44
  return false;
@@ -119,7 +119,7 @@ const endChat = async (props, chatSDK, state, dispatch, setAdapter, setWebChatSt
119
119
  Event: _TelemetryConstants.TelemetryEvent.EndChatSDKCall
120
120
  });
121
121
  //Get auth token again if chat continued for longer time, otherwise gets 401 error
122
- await handleAuthenticationIfEnabled(props, chatSDK);
122
+ await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
123
123
  await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat());
124
124
  } catch (ex) {
125
125
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
@@ -308,27 +308,6 @@ const closeChatWidget = (dispatch, props, state) => {
308
308
  });
309
309
  };
310
310
 
311
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
312
- const handleAuthenticationIfEnabled = async (props, chatSDK) => {
313
- //Unable to end chat if token has expired
314
- if (props.getAuthToken) {
315
- const authClientFunction = (0, _authHelper.getAuthClientFunction)(props.chatConfig);
316
- if (props.getAuthToken && authClientFunction) {
317
- // set auth token to chat sdk before end chat
318
- const authSuccess = await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
319
- if (!authSuccess) {
320
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
321
- Event: _TelemetryConstants.TelemetryEvent.GetAuthTokenFailed,
322
- ExceptionDetails: {
323
- exception: "Unable to get auth token during end chat"
324
- }
325
- });
326
- throw new Error("handleAuthenticationIfEnabled:Failed to get authentication token");
327
- }
328
- }
329
- }
330
- };
331
-
332
311
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
333
312
  const chatTokenCleanUp = async dispatch => {
334
313
  //Just do cleanup here
@@ -13,6 +13,7 @@ var _Constants = require("../../../common/Constants");
13
13
  var _ConversationState = require("../../../contexts/common/ConversationState");
14
14
  var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
15
15
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
16
+ var _startChatErrorHandler = require("./startChatErrorHandler");
16
17
  // Return value: should start normal chat flow when reconnect is enabled
17
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
19
  const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
@@ -21,7 +22,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
21
22
  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 ? true : false;
22
23
 
23
24
  // Get chat reconnect context
24
- const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat);
25
+ const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat, dispatch);
25
26
 
26
27
  // Redirect if enabled
27
28
  if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
@@ -57,7 +58,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
57
58
 
58
59
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
60
  exports.handleChatReconnect = handleChatReconnect;
60
- const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticatedChat) => {
61
+ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticatedChat, dispatch) => {
61
62
  try {
62
63
  var _props$reconnectChatP4;
63
64
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
@@ -69,6 +70,7 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
69
70
  };
70
71
  // Get auth token for getting chat reconnect context
71
72
  if (isAuthenticatedChat) {
73
+ // handle authentication will throw error if auth token is not available, so no need to check for response
72
74
  await (0, _authHelper.handleAuthentication)(chatSDK, chatConfig, props.getAuthToken);
73
75
  }
74
76
  const reconnectChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatReconnectContext(chatReconnectOptionalParams));
@@ -78,7 +80,9 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
78
80
  (0, _authHelper.removeAuthTokenProvider)(chatSDK);
79
81
  }
80
82
  return reconnectChatContext;
81
- } catch (error) {
83
+ }
84
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
+ catch (error) {
82
86
  (0, _utils.checkContactIdError)(error);
83
87
  _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
84
88
  Event: _TelemetryConstants.TelemetryEvent.GetChatReconnectContextSDKCallFailed,
@@ -86,6 +90,12 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
86
90
  exception: error
87
91
  }
88
92
  });
93
+
94
+ // when auth token is not available, propagate the error to stop the execution and ensure error pane is loaded
95
+ if ((error === null || error === void 0 ? void 0 : error.message) == _Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString) {
96
+ (0, _startChatErrorHandler.handleStartChatError)(dispatch, chatSDK, props, new Error(_Constants.WidgetLoadCustomErrorString.AuthenticationFailedErrorString), false);
97
+ throw error;
98
+ }
89
99
  }
90
100
  };
91
101
 
@@ -29,6 +29,11 @@ const handleStartChatError = (dispatch, chatSDK, props, ex, isStartChatSuccessfu
29
29
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILURE_TYPE,
30
30
  payload: _StartChatFailureType.StartChatFailureType.AuthSetupError
31
31
  });
32
+ // set conversation to error to enforce error UI pane
33
+ dispatch({
34
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
35
+ payload: _ConversationState.ConversationState.Error
36
+ });
32
37
  logWidgetLoadCompleteWithError(ex);
33
38
  }
34
39
  if (ex.message === _Constants.WidgetLoadCustomErrorString.NetworkErrorString) {
@@ -57,6 +57,7 @@ var _useChatSDKStore = _interopRequireDefault(require("../../../hooks/useChatSDK
57
57
  var _defaultAdaptiveCardStyles = require("../../webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles");
58
58
  var _StartChatErrorPaneStateful = _interopRequireDefault(require("../../startchaterrorpanestateful/StartChatErrorPaneStateful"));
59
59
  var _StartChatFailureType = require("../../../contexts/common/StartChatFailureType");
60
+ var _createReducer = require("../../../contexts/createReducer");
60
61
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
61
62
  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); }
62
63
  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; }
@@ -125,8 +126,12 @@ const LiveChatWidgetStateful = props => {
125
126
  const isReconnectTriggered = async () => {
126
127
  if ((0, _reconnectChatHelper.isReconnectEnabled)(props.chatConfig) === true && !(0, _reconnectChatHelper.isPersistentEnabled)(props.chatConfig)) {
127
128
  const noValidReconnectId = await (0, _reconnectChatHelper.handleChatReconnect)(chatSDK, props, dispatch, setAdapter, _startChat.initStartChat, state);
129
+ const inMemoryState = (0, _createReducer.executeReducer)(state, {
130
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
131
+ payload: null
132
+ });
128
133
  // If chat reconnect has kicked in chat state will become Active or Reconnect. So just exit, else go next
129
- if (!noValidReconnectId && (state.appStates.conversationState === _ConversationState.ConversationState.Active || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat)) {
134
+ if (!noValidReconnectId && (inMemoryState.appStates.conversationState === _ConversationState.ConversationState.Active || inMemoryState.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat)) {
130
135
  return true;
131
136
  }
132
137
  }
@@ -340,7 +345,7 @@ const LiveChatWidgetStateful = props => {
340
345
 
341
346
  // Start chat from SDK Event
342
347
  _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(msg => {
343
- var _msg$payload4, _msg$payload5, _msg$payload6;
348
+ var _msg$payload4, _msg$payload5, _msg$payload6, _inMemoryState$appSta, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
344
349
  // If the startChat event is not initiated by the same tab. Ignore the call
345
350
  if (!(0, _utils.isNullOrUndefined)(msg === null || msg === void 0 ? void 0 : (_msg$payload4 = msg.payload) === null || _msg$payload4 === void 0 ? void 0 : _msg$payload4.runtimeId) && (msg === null || msg === void 0 ? void 0 : (_msg$payload5 = msg.payload) === null || _msg$payload5 === void 0 ? void 0 : _msg$payload5.runtimeId) !== _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
346
351
  return;
@@ -368,12 +373,13 @@ const LiveChatWidgetStateful = props => {
368
373
  Event: _TelemetryConstants.TelemetryEvent.StartChatEventRecevied,
369
374
  Description: "Start chat event received."
370
375
  });
376
+ const inMemoryState = (0, _createReducer.executeReducer)(state, {
377
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
378
+ payload: null
379
+ });
371
380
 
372
- // DataStoreManager.clientDataStore?.swtichToSessionStorage(true);
373
- const persistedState = (0, _utils.getStateFromCache)((0, _utils.getWidgetCacheIdfromProps)(props));
374
-
375
- // Chat not found in cache - scenario: explicitly clearing cache and calling startChat SDK method
376
- if (persistedState === undefined) {
381
+ // Only initiate new chat if widget runtime state is one of the followings
382
+ if (((_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.conversationState) === _ConversationState.ConversationState.Closed || ((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === _ConversationState.ConversationState.InActive || ((_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.conversationState) === _ConversationState.ConversationState.Postchat) {
377
383
  _omnichannelChatComponents.BroadcastService.postMessage({
378
384
  eventName: _TelemetryConstants.BroadcastEvent.ChatInitiated
379
385
  });
@@ -381,33 +387,21 @@ const LiveChatWidgetStateful = props => {
381
387
  return;
382
388
  }
383
389
 
384
- // Chat exist in cache
385
- if (persistedState) {
386
- var _persistedState$appSt, _persistedState$appSt2, _persistedState$appSt3, _persistedState$appSt4;
387
- // Only initiate new chat if widget state in cache in one of the followings
388
- if (((_persistedState$appSt = persistedState.appStates) === null || _persistedState$appSt === void 0 ? void 0 : _persistedState$appSt.conversationState) === _ConversationState.ConversationState.Closed || ((_persistedState$appSt2 = persistedState.appStates) === null || _persistedState$appSt2 === void 0 ? void 0 : _persistedState$appSt2.conversationState) === _ConversationState.ConversationState.InActive || ((_persistedState$appSt3 = persistedState.appStates) === null || _persistedState$appSt3 === void 0 ? void 0 : _persistedState$appSt3.conversationState) === _ConversationState.ConversationState.Postchat) {
389
- _omnichannelChatComponents.BroadcastService.postMessage({
390
- eventName: _TelemetryConstants.BroadcastEvent.ChatInitiated
391
- });
392
- (0, _startChat.prepareStartChat)(props, chatSDK, stateWithUpdatedContext, dispatch, setAdapter);
393
- return;
394
- }
395
-
396
- // If minimized, maximize the chat
397
- if ((persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt4 = persistedState.appStates) === null || _persistedState$appSt4 === void 0 ? void 0 : _persistedState$appSt4.isMinimized) === true) {
398
- var _persistedState$domai, _persistedState$domai2, _persistedState$domai3, _persistedState$domai4;
399
- dispatch({
400
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
401
- payload: false
402
- });
403
- _omnichannelChatComponents.BroadcastService.postMessage({
404
- eventName: _TelemetryConstants.BroadcastEvent.MaximizeChat,
405
- payload: {
406
- height: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai = persistedState.domainStates) === null || _persistedState$domai === void 0 ? void 0 : (_persistedState$domai2 = _persistedState$domai.widgetSize) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.height,
407
- width: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai3 = persistedState.domainStates) === null || _persistedState$domai3 === void 0 ? void 0 : (_persistedState$domai4 = _persistedState$domai3.widgetSize) === null || _persistedState$domai4 === void 0 ? void 0 : _persistedState$domai4.width
408
- }
409
- });
410
- }
390
+ // If minimized, maximize the chat
391
+ if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta4 = inMemoryState.appStates) === null || _inMemoryState$appSta4 === void 0 ? void 0 : _inMemoryState$appSta4.isMinimized) === true) {
392
+ var _inMemoryState$domain, _inMemoryState$domain2, _inMemoryState$domain3, _inMemoryState$domain4;
393
+ dispatch({
394
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
395
+ payload: false
396
+ });
397
+ _omnichannelChatComponents.BroadcastService.postMessage({
398
+ eventName: _TelemetryConstants.BroadcastEvent.MaximizeChat,
399
+ payload: {
400
+ height: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : (_inMemoryState$domain2 = _inMemoryState$domain.widgetSize) === null || _inMemoryState$domain2 === void 0 ? void 0 : _inMemoryState$domain2.height,
401
+ width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width
402
+ }
403
+ });
404
+ return;
411
405
  }
412
406
  });
413
407
 
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isMaskingforCustomer = void 0;
7
+ var _utils = require("../../../../common/utils");
7
8
  const isMaskingforCustomer = maskingInfo => {
8
9
  var _maskingInfo$setting;
9
10
  // If the masking info (containing masking setting and masking rules) is missing or empty, return false.
@@ -14,8 +15,9 @@ const isMaskingforCustomer = maskingInfo => {
14
15
 
15
16
  // If the masking rules are provided and;
16
17
  // If the masking setting is NOT null and masking for customer is NOT null, return the configuration
17
- if ((_maskingInfo$setting = maskingInfo.setting) !== null && _maskingInfo$setting !== void 0 && _maskingInfo$setting.msdyn_maskforcustomer) {
18
- return maskingInfo.setting.msdyn_maskforcustomer;
18
+ if (!(0, _utils.isNullOrUndefined)((_maskingInfo$setting = maskingInfo.setting) === null || _maskingInfo$setting === void 0 ? void 0 : _maskingInfo$setting.msdyn_maskforcustomer)) {
19
+ var _maskingInfo$setting2;
20
+ return (0, _utils.parseLowerCaseString)(maskingInfo === null || maskingInfo === void 0 ? void 0 : (_maskingInfo$setting2 = maskingInfo.setting) === null || _maskingInfo$setting2 === void 0 ? void 0 : _maskingInfo$setting2.msdyn_maskforcustomer) === "true";
19
21
  }
20
22
 
21
23
  // In all other cases, even if masking setting is missing, return true to apply the masking for backward compatibility (i.e. in old versions, OC does not have masking info settings)
@@ -52,4 +52,5 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
52
52
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 42] = "SET_SURVEY_MODE";
53
53
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 43] = "SET_CONFIRMATION_STATE";
54
54
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 44] = "SET_POST_CHAT_PARTICIPANT_TYPE";
55
+ LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 45] = "GET_IN_MEMORY_STATE";
55
56
  })(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));