@microsoft/omnichannel-chat-widget 1.4.1-main.cfe8ebd → 1.4.1-main.d4130ad

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.
package/README.md CHANGED
@@ -125,7 +125,7 @@ These are components that are included in the ```@microsoft/omnichannel-chat-com
125
125
  | ProactiveChatSurveyPane | A pane that holds more information than a normal chat button and can be configured to proactively pop up | [IProactiveChatPaneProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-components/src/components/proactivechatpane/interfaces/IProactiveChatPaneProps.ts) |
126
126
  | ReconnectChatPane | The pane that shows up when the customer is re-connecting to the chat to add additional conversation | [IReconnectChatPaneProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-components/src/components/reconnectchatpane/interfaces/IReconnectChatPaneProps.ts) |
127
127
 
128
- > :warning: Because the components extend Microsoft's [Fluent UI](https://developer.microsoft.com/en-us/fluentui#/) components, the base interface for all the ```styleProps``` in the above table is [IStyle](https://github.com/microsoft/fluentui/blob/master/packages/merge-styles/src/IStyle.ts), which extends the [IRawStyleBase](https://docs.microsoft.com/en-us/javascript/api/merge-styles/irawstylebase?view=office-ui-fabric-react-latest) interface, which is the most useful reference.
128
+ > :warning: Because the components extend Microsoft's [Fluent UI](https://developer.microsoft.com/en-us/fluentui#/) components, the base interface for all the ```styleProps``` in the above table is [IStyle](https://github.com/microsoft/fluentui/blob/master/packages/merge-styles/src/IStyle.ts), which extends the [IRawStyleBase](https://github.com/microsoft/fluentui/blob/master/packages/merge-styles/src/IRawStyleBase.ts#L280) interface, which is the most useful reference.
129
129
 
130
130
  ### Stateful Components
131
131
 
@@ -65,17 +65,14 @@ const ChatButtonStateful = props => {
65
65
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
66
66
  Event: _TelemetryConstants.TelemetryEvent.LCWChatButtonClicked
67
67
  });
68
- if (state.appStates.isMinimized) {
69
- dispatch({
70
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
71
- payload: false
72
- });
73
- } else {
74
- dispatch({
75
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
76
- payload: _ConversationState.ConversationState.OutOfOffice
77
- });
78
- }
68
+ state.appStates.isMinimized && dispatch({
69
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
70
+ payload: false
71
+ });
72
+ dispatch({
73
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
74
+ payload: _ConversationState.ConversationState.OutOfOffice
75
+ });
79
76
  },
80
77
  unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
81
78
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
@@ -13,7 +13,8 @@ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
13
13
  const handleChatDisconnect = (props, state, setWebChatStyles) => {
14
14
  var _state$appStates;
15
15
  if (state !== null && state !== void 0 && (_state$appStates = state.appStates) !== null && _state$appStates !== void 0 && _state$appStates.chatDisconnectEventReceived) {
16
- var _props$webChatContain, _props$webChatContain2;
16
+ var _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
17
+ const chatDisconnectMessage = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_CHAT_DISCONNECT) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT;
17
18
  if ((props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd) !== false) {
18
19
  setWebChatStyles(styles => {
19
20
  return {
@@ -22,7 +23,7 @@ const handleChatDisconnect = (props, state, setWebChatStyles) => {
22
23
  };
23
24
  });
24
25
  }
25
- _NotificationHandler.NotificationHandler.notifyWarning(_NotificationScenarios.NotificationScenarios.ChatDisconnect, _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT);
26
+ _NotificationHandler.NotificationHandler.notifyWarning(_NotificationScenarios.NotificationScenarios.ChatDisconnect, chatDisconnectMessage);
26
27
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
27
28
  Event: _TelemetryConstants.TelemetryEvent.ChatDisconnectThreadEventReceived,
28
29
  Description: "Chat disconnected due to timeout, left or removed."
@@ -25,7 +25,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
25
25
  // Get chat reconnect context
26
26
  const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat);
27
27
 
28
- //Redirect if enabled
28
+ // Redirect if enabled
29
29
  if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
30
30
  var _props$reconnectChatP;
31
31
  redirectPage(reconnectChatContext.redirectURL, (_props$reconnectChatP = props.reconnectChatPaneProps) === null || _props$reconnectChatP === void 0 ? void 0 : _props$reconnectChatP.redirectInSameWindow);
@@ -69,15 +69,29 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
69
69
  const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
70
70
  const showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse && !(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hidePreChatSurveyPane);
71
71
  if (showPrechat) {
72
- dispatch({
73
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
74
- payload: preChatSurveyResponse
75
- });
76
- dispatch({
77
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
78
- payload: _ConversationState.ConversationState.Prechat
79
- });
80
- return;
72
+ var _state$domainStates, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3;
73
+ const isOutOfOperatingHours = (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$l3 = _state$domainStates$l2.OutOfOperatingHours) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.toLowerCase()) === "true";
74
+ if (isOutOfOperatingHours) {
75
+ (state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
76
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
77
+ payload: false
78
+ });
79
+ dispatch({
80
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
81
+ payload: _ConversationState.ConversationState.OutOfOffice
82
+ });
83
+ return;
84
+ } else {
85
+ dispatch({
86
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
87
+ payload: preChatSurveyResponse
88
+ });
89
+ dispatch({
90
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
91
+ payload: _ConversationState.ConversationState.Prechat
92
+ });
93
+ return;
94
+ }
81
95
  }
82
96
 
83
97
  //Initiate start chat
@@ -303,17 +317,17 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
303
317
 
304
318
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
305
319
  const setCustomContextParams = async (state, props) => {
306
- var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates, _persistedState$domai8;
320
+ var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates2, _persistedState$domai8;
307
321
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
308
322
  const isAuthenticatedChat = props !== null && props !== void 0 && (_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;
309
323
  //Should not set custom context for auth chat
310
324
  if (isAuthenticatedChat) {
311
325
  return;
312
326
  }
313
- if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.customContext) {
314
- var _state$domainStates2;
327
+ if (state !== null && state !== void 0 && (_state$domainStates2 = state.domainStates) !== null && _state$domainStates2 !== void 0 && _state$domainStates2.customContext) {
328
+ var _state$domainStates3;
315
329
  optionalParams = Object.assign({}, optionalParams, {
316
- customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.customContext))
330
+ customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.customContext))
317
331
  });
318
332
  return;
319
333
  }
@@ -361,8 +375,8 @@ const canStartPopoutChat = async props => {
361
375
 
362
376
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
363
377
  const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
364
- var _state$domainStates3, _state$domainStates3$;
365
- const requestIdFromCache = (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.liveChatContext) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.requestId;
378
+ var _state$domainStates4, _state$domainStates4$;
379
+ const requestIdFromCache = (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.liveChatContext) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.requestId;
366
380
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
367
381
  let conversationDetails = undefined;
368
382
 
@@ -56,17 +56,14 @@ export const ChatButtonStateful = props => {
56
56
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
57
57
  Event: TelemetryEvent.LCWChatButtonClicked
58
58
  });
59
- if (state.appStates.isMinimized) {
60
- dispatch({
61
- type: LiveChatWidgetActionType.SET_MINIMIZED,
62
- payload: false
63
- });
64
- } else {
65
- dispatch({
66
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
67
- payload: ConversationState.OutOfOffice
68
- });
69
- }
59
+ state.appStates.isMinimized && dispatch({
60
+ type: LiveChatWidgetActionType.SET_MINIMIZED,
61
+ payload: false
62
+ });
63
+ dispatch({
64
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
65
+ payload: ConversationState.OutOfOffice
66
+ });
70
67
  },
71
68
  unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
72
69
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
@@ -7,7 +7,8 @@ import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
7
7
  const handleChatDisconnect = (props, state, setWebChatStyles) => {
8
8
  var _state$appStates;
9
9
  if (state !== null && state !== void 0 && (_state$appStates = state.appStates) !== null && _state$appStates !== void 0 && _state$appStates.chatDisconnectEventReceived) {
10
- var _props$webChatContain, _props$webChatContain2;
10
+ var _state$domainStates, _state$domainStates$m, _props$webChatContain, _props$webChatContain2;
11
+ const chatDisconnectMessage = (state === null || state === void 0 ? void 0 : (_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$m = _state$domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_BANNER_CHAT_DISCONNECT) ?? defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT;
11
12
  if ((props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd) !== false) {
12
13
  setWebChatStyles(styles => {
13
14
  return {
@@ -16,7 +17,7 @@ const handleChatDisconnect = (props, state, setWebChatStyles) => {
16
17
  };
17
18
  });
18
19
  }
19
- NotificationHandler.notifyWarning(NotificationScenarios.ChatDisconnect, defaultMiddlewareLocalizedTexts.MIDDLEWARE_BANNER_CHAT_DISCONNECT);
20
+ NotificationHandler.notifyWarning(NotificationScenarios.ChatDisconnect, chatDisconnectMessage);
20
21
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
21
22
  Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
22
23
  Description: "Chat disconnected due to timeout, left or removed."
@@ -20,7 +20,7 @@ const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initSta
20
20
  // Get chat reconnect context
21
21
  const reconnectChatContext = await getChatReconnectContext(chatSDK, props.chatConfig, props, isAuthenticatedChat);
22
22
 
23
- //Redirect if enabled
23
+ // Redirect if enabled
24
24
  if (reconnectChatContext !== null && reconnectChatContext !== void 0 && reconnectChatContext.redirectURL) {
25
25
  var _props$reconnectChatP;
26
26
  redirectPage(reconnectChatContext.redirectURL, (_props$reconnectChatP = props.reconnectChatPaneProps) === null || _props$reconnectChatP === void 0 ? void 0 : _props$reconnectChatP.redirectInSameWindow);
@@ -63,15 +63,29 @@ const setPreChatAndInitiateChat = async (chatSDK, dispatch, setAdapter, isProact
63
63
  const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
64
64
  const showPrechat = isProactiveChat ? preChatSurveyResponse && proactiveChatEnablePrechatState : preChatSurveyResponse && !(props !== null && props !== void 0 && (_props$controlProps = props.controlProps) !== null && _props$controlProps !== void 0 && _props$controlProps.hidePreChatSurveyPane);
65
65
  if (showPrechat) {
66
- dispatch({
67
- type: LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
68
- payload: preChatSurveyResponse
69
- });
70
- dispatch({
71
- type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
72
- payload: ConversationState.Prechat
73
- });
74
- return;
66
+ var _state$domainStates, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3;
67
+ const isOutOfOperatingHours = (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$l3 = _state$domainStates$l2.OutOfOperatingHours) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.toLowerCase()) === "true";
68
+ if (isOutOfOperatingHours) {
69
+ (state === null || state === void 0 ? void 0 : state.appStates.isMinimized) && dispatch({
70
+ type: LiveChatWidgetActionType.SET_MINIMIZED,
71
+ payload: false
72
+ });
73
+ dispatch({
74
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
75
+ payload: ConversationState.OutOfOffice
76
+ });
77
+ return;
78
+ } else {
79
+ dispatch({
80
+ type: LiveChatWidgetActionType.SET_PRE_CHAT_SURVEY_RESPONSE,
81
+ payload: preChatSurveyResponse
82
+ });
83
+ dispatch({
84
+ type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
85
+ payload: ConversationState.Prechat
86
+ });
87
+ return;
88
+ }
75
89
  }
76
90
 
77
91
  //Initiate start chat
@@ -295,17 +309,17 @@ const canConnectToExistingChat = async (props, chatSDK, state, dispatch, setAdap
295
309
 
296
310
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
297
311
  const setCustomContextParams = async (state, props) => {
298
- var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates, _persistedState$domai8;
312
+ var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates2, _persistedState$domai8;
299
313
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
300
314
  const isAuthenticatedChat = props !== null && props !== void 0 && (_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;
301
315
  //Should not set custom context for auth chat
302
316
  if (isAuthenticatedChat) {
303
317
  return;
304
318
  }
305
- if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.customContext) {
306
- var _state$domainStates2;
319
+ if (state !== null && state !== void 0 && (_state$domainStates2 = state.domainStates) !== null && _state$domainStates2 !== void 0 && _state$domainStates2.customContext) {
320
+ var _state$domainStates3;
307
321
  optionalParams = Object.assign({}, optionalParams, {
308
- customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.customContext))
322
+ customContext: JSON.parse(JSON.stringify(state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.customContext))
309
323
  });
310
324
  return;
311
325
  }
@@ -353,8 +367,8 @@ const canStartPopoutChat = async props => {
353
367
 
354
368
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
355
369
  const checkIfConversationStillValid = async (chatSDK, dispatch, state) => {
356
- var _state$domainStates3, _state$domainStates3$;
357
- const requestIdFromCache = (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.liveChatContext) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.requestId;
370
+ var _state$domainStates4, _state$domainStates4$;
371
+ const requestIdFromCache = (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.liveChatContext) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.requestId;
358
372
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
359
373
  let conversationDetails = undefined;
360
374
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.4.1-main.cfe8ebd",
3
+ "version": "1.4.1-main.d4130ad",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -75,7 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@microsoft/omnichannel-chat-components": "^1.0.9",
78
- "@microsoft/omnichannel-chat-sdk": "1.5.5",
78
+ "@microsoft/omnichannel-chat-sdk": "1.5.6",
79
79
  "abort-controller-es5": "^2.0.1",
80
80
  "dompurify": "^2.3.4",
81
81
  "markdown-it": "^12.3.2",