@microsoft/omnichannel-chat-widget 1.8.2-main.3368d1f → 1.8.2-main.5199342
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/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +28 -15
- package/lib/cjs/components/headerstateful/HeaderStateful.js +12 -2
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +2 -8
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +28 -15
- package/lib/esm/components/headerstateful/HeaderStateful.js +12 -2
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +2 -8
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
let uiTimer;
|
|
22
22
|
const ChatButtonStateful = props => {
|
|
23
|
-
var _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
|
|
23
|
+
var _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _outOfOfficeButtonPro, _outOfOfficeButtonPro2, _props$buttonProps3, _props$buttonProps3$c;
|
|
24
24
|
// this is to ensure the telemetry is set only once and start the load timer
|
|
25
25
|
(0, _react.useEffect)(() => {
|
|
26
26
|
uiTimer = (0, _utils.createTimer)();
|
|
@@ -39,7 +39,10 @@ const ChatButtonStateful = props => {
|
|
|
39
39
|
} = props;
|
|
40
40
|
//Setting OutOfOperatingHours Flag
|
|
41
41
|
//Setting OutOfOperatingHours Flag - to string conversion to normalize the value (could be boolean from other states or string directly from config)
|
|
42
|
-
|
|
42
|
+
// Initialize with the current state value to prevent visual flicker
|
|
43
|
+
const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(() => {
|
|
44
|
+
return state.appStates.conversationState === _ConversationState.ConversationState.Closed && state.appStates.outsideOperatingHours;
|
|
45
|
+
});
|
|
43
46
|
const ref = (0, _react.useRef)(() => {
|
|
44
47
|
return;
|
|
45
48
|
});
|
|
@@ -71,33 +74,38 @@ const ChatButtonStateful = props => {
|
|
|
71
74
|
};
|
|
72
75
|
const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeChatButtonStyleProps.defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
73
76
|
const controlProps = {
|
|
77
|
+
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps),
|
|
74
78
|
id: "oc-lcw-chat-button",
|
|
75
79
|
dir: state.domainStates.globalDir,
|
|
76
80
|
titleText: "Let's Chat!",
|
|
77
81
|
subtitleText: "We're online.",
|
|
78
82
|
hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
|
|
79
83
|
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > _Constants.Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
|
|
80
|
-
onClick: () => ref.current(),
|
|
81
84
|
unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
|
|
82
|
-
|
|
85
|
+
// Regular chat button onClick - this will always take precedence
|
|
86
|
+
onClick: () => ref.current()
|
|
83
87
|
};
|
|
84
88
|
const outOfOfficeControlProps = {
|
|
89
|
+
// Only take specific properties from outOfOfficeButtonProps, never onClick
|
|
85
90
|
id: "oc-lcw-chat-button",
|
|
86
91
|
dir: state.domainStates.globalDir,
|
|
87
|
-
titleText: "We're Offline",
|
|
88
|
-
subtitleText: "No agents available",
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
titleText: (outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : (_outOfOfficeButtonPro = outOfOfficeButtonProps.controlProps) === null || _outOfOfficeButtonPro === void 0 ? void 0 : _outOfOfficeButtonPro.titleText) || "We're Offline",
|
|
93
|
+
subtitleText: (outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : (_outOfOfficeButtonPro2 = outOfOfficeButtonProps.controlProps) === null || _outOfOfficeButtonPro2 === void 0 ? void 0 : _outOfOfficeButtonPro2.subtitleText) || "No agents available",
|
|
94
|
+
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,
|
|
95
|
+
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps),
|
|
96
|
+
// Out-of-office specific onClick - this will ALWAYS take precedence
|
|
97
|
+
onClick: () => {
|
|
98
|
+
if (state.appStates.isMinimized) {
|
|
99
|
+
dispatch({
|
|
100
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
101
|
+
payload: false
|
|
102
|
+
});
|
|
103
|
+
}
|
|
94
104
|
dispatch({
|
|
95
105
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
96
106
|
payload: _ConversationState.ConversationState.OutOfOffice
|
|
97
107
|
});
|
|
98
|
-
}
|
|
99
|
-
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,
|
|
100
|
-
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
108
|
+
}
|
|
101
109
|
};
|
|
102
110
|
(0, _react.useEffect)(() => {
|
|
103
111
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -123,8 +131,13 @@ const ChatButtonStateful = props => {
|
|
|
123
131
|
// If the conversation state is closed, check if we are outside operating hours
|
|
124
132
|
const isOutsideOperatingHours = state.appStates.outsideOperatingHours;
|
|
125
133
|
setOutOfOperatingHours(isOutsideOperatingHours);
|
|
134
|
+
} else {
|
|
135
|
+
// If conversation state is not Closed, we should not be in out-of-office mode
|
|
136
|
+
if (outOfOperatingHours) {
|
|
137
|
+
setOutOfOperatingHours(false);
|
|
138
|
+
}
|
|
126
139
|
}
|
|
127
|
-
}, [state.appStates.conversationState]);
|
|
140
|
+
}, [state.appStates.conversationState, state.appStates.outsideOperatingHours, state.appStates.isMinimized]);
|
|
128
141
|
return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ChatButton, {
|
|
129
142
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
130
143
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
|
@@ -37,7 +37,10 @@ const HeaderStateful = props => {
|
|
|
37
37
|
endChat
|
|
38
38
|
} = props;
|
|
39
39
|
//Setting OutOfOperatingHours Flag
|
|
40
|
-
|
|
40
|
+
// Initialize with the current state value to prevent visual flicker
|
|
41
|
+
const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(() => {
|
|
42
|
+
return state.appStates.conversationState === _ConversationState.ConversationState.Closed && state.appStates.outsideOperatingHours;
|
|
43
|
+
});
|
|
41
44
|
const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeHeaderStyleProps.defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
|
|
42
45
|
|
|
43
46
|
// For some reason state object is not getting updated values in this component
|
|
@@ -112,6 +115,13 @@ const HeaderStateful = props => {
|
|
|
112
115
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
|
|
113
116
|
payload: true
|
|
114
117
|
});
|
|
118
|
+
// Ensure conversation state remains Closed to maintain out-of-office mode
|
|
119
|
+
if (state.appStates.conversationState !== _ConversationState.ConversationState.Closed) {
|
|
120
|
+
dispatch({
|
|
121
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
122
|
+
payload: _ConversationState.ConversationState.Closed
|
|
123
|
+
});
|
|
124
|
+
}
|
|
115
125
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
116
126
|
Event: _TelemetryConstants.TelemetryEvent.MinimizeChatActionCompleted,
|
|
117
127
|
Description: "Header Minimize action completed."
|
|
@@ -141,7 +151,7 @@ const HeaderStateful = props => {
|
|
|
141
151
|
const isOutsideOperatingHours = state.appStates.outsideOperatingHours;
|
|
142
152
|
setOutOfOperatingHours(isOutsideOperatingHours);
|
|
143
153
|
}
|
|
144
|
-
}, [state.appStates.conversationState]);
|
|
154
|
+
}, [state.appStates.conversationState, state.appStates.outsideOperatingHours]);
|
|
145
155
|
if (props.draggable === true) {
|
|
146
156
|
var _generalStyleProps;
|
|
147
157
|
const styleProps = outOfOperatingHours || state.appStates.conversationState === _ConversationState.ConversationState.OutOfOffice ? outOfOfficeStyleProps : headerProps === null || headerProps === void 0 ? void 0 : headerProps.styleProps;
|
|
@@ -8,7 +8,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _ChatAdapterStore = require("../../contexts/ChatAdapterStore");
|
|
9
9
|
var _ChatContextStore = require("../../contexts/ChatContextStore");
|
|
10
10
|
var _ChatSDKStore = require("../../contexts/ChatSDKStore");
|
|
11
|
-
var _ErrorBoundary = _interopRequireDefault(require("../errorboundary/ErrorBoundary"));
|
|
12
11
|
var _FacadeChatSDK = require("../../common/facades/FacadeChatSDK");
|
|
13
12
|
var _FacadeChatSDKStore = require("../../contexts/FacadeChatSDKStore");
|
|
14
13
|
var _LiveChatWidgetStateful = _interopRequireDefault(require("./livechatwidgetstateful/LiveChatWidgetStateful"));
|
|
@@ -17,7 +16,6 @@ var _LiveChatWidgetContextInitialState = require("../../contexts/common/LiveChat
|
|
|
17
16
|
var _getMockChatSDKIfApplicable = require("./common/getMockChatSDKIfApplicable");
|
|
18
17
|
var _utils = require("../../common/utils");
|
|
19
18
|
var _liveChatConfigUtils = require("./common/liveChatConfigUtils");
|
|
20
|
-
var _startChatErrorHandler = require("./common/startChatErrorHandler");
|
|
21
19
|
var _overridePropsOnMockIfApplicable = _interopRequireDefault(require("./common/overridePropsOnMockIfApplicable"));
|
|
22
20
|
var _registerTelemetryLoggers = require("./common/registerTelemetryLoggers");
|
|
23
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -53,11 +51,7 @@ const LiveChatWidget = props => {
|
|
|
53
51
|
(0, _react.useEffect)(() => {
|
|
54
52
|
(0, _registerTelemetryLoggers.registerTelemetryLoggers)(props, dispatch);
|
|
55
53
|
}, [dispatch]);
|
|
56
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
57
|
-
onError: error => {
|
|
58
|
-
(0, _startChatErrorHandler.logWidgetLoadWithUnexpectedError)(error);
|
|
59
|
-
}
|
|
60
|
-
}, /*#__PURE__*/_react.default.createElement(_FacadeChatSDKStore.FacadeChatSDKStore.Provider, {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_FacadeChatSDKStore.FacadeChatSDKStore.Provider, {
|
|
61
55
|
value: [facadeChatSDK, setFacadeChatSDK]
|
|
62
56
|
}, /*#__PURE__*/_react.default.createElement(_ChatSDKStore.ChatSDKStore.Provider, {
|
|
63
57
|
value: chatSDK
|
|
@@ -65,7 +59,7 @@ const LiveChatWidget = props => {
|
|
|
65
59
|
value: [adapter, setAdapter]
|
|
66
60
|
}, /*#__PURE__*/_react.default.createElement(_ChatContextStore.ChatContextStore.Provider, {
|
|
67
61
|
value: [state, dispatch]
|
|
68
|
-
}, /*#__PURE__*/_react.default.createElement(_LiveChatWidgetStateful.default, props)))))
|
|
62
|
+
}, /*#__PURE__*/_react.default.createElement(_LiveChatWidgetStateful.default, props)))));
|
|
69
63
|
};
|
|
70
64
|
exports.LiveChatWidget = LiveChatWidget;
|
|
71
65
|
var _default = LiveChatWidget;
|
|
@@ -11,7 +11,7 @@ import { defaultOutOfOfficeChatButtonStyleProps } from "./common/styleProps/defa
|
|
|
11
11
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
12
12
|
let uiTimer;
|
|
13
13
|
export const ChatButtonStateful = props => {
|
|
14
|
-
var _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
|
|
14
|
+
var _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _outOfOfficeButtonPro, _outOfOfficeButtonPro2, _props$buttonProps3, _props$buttonProps3$c;
|
|
15
15
|
// this is to ensure the telemetry is set only once and start the load timer
|
|
16
16
|
useEffect(() => {
|
|
17
17
|
uiTimer = createTimer();
|
|
@@ -30,7 +30,10 @@ export const ChatButtonStateful = props => {
|
|
|
30
30
|
} = props;
|
|
31
31
|
//Setting OutOfOperatingHours Flag
|
|
32
32
|
//Setting OutOfOperatingHours Flag - to string conversion to normalize the value (could be boolean from other states or string directly from config)
|
|
33
|
-
|
|
33
|
+
// Initialize with the current state value to prevent visual flicker
|
|
34
|
+
const [outOfOperatingHours, setOutOfOperatingHours] = useState(() => {
|
|
35
|
+
return state.appStates.conversationState === ConversationState.Closed && state.appStates.outsideOperatingHours;
|
|
36
|
+
});
|
|
34
37
|
const ref = useRef(() => {
|
|
35
38
|
return;
|
|
36
39
|
});
|
|
@@ -62,33 +65,38 @@ export const ChatButtonStateful = props => {
|
|
|
62
65
|
};
|
|
63
66
|
const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
|
|
64
67
|
const controlProps = {
|
|
68
|
+
...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps),
|
|
65
69
|
id: "oc-lcw-chat-button",
|
|
66
70
|
dir: state.domainStates.globalDir,
|
|
67
71
|
titleText: "Let's Chat!",
|
|
68
72
|
subtitleText: "We're online.",
|
|
69
73
|
hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
|
|
70
74
|
unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
|
|
71
|
-
onClick: () => ref.current(),
|
|
72
75
|
unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
|
|
73
|
-
|
|
76
|
+
// Regular chat button onClick - this will always take precedence
|
|
77
|
+
onClick: () => ref.current()
|
|
74
78
|
};
|
|
75
79
|
const outOfOfficeControlProps = {
|
|
80
|
+
// Only take specific properties from outOfOfficeButtonProps, never onClick
|
|
76
81
|
id: "oc-lcw-chat-button",
|
|
77
82
|
dir: state.domainStates.globalDir,
|
|
78
|
-
titleText: "We're Offline",
|
|
79
|
-
subtitleText: "No agents available",
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
titleText: (outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : (_outOfOfficeButtonPro = outOfOfficeButtonProps.controlProps) === null || _outOfOfficeButtonPro === void 0 ? void 0 : _outOfOfficeButtonPro.titleText) || "We're Offline",
|
|
84
|
+
subtitleText: (outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : (_outOfOfficeButtonPro2 = outOfOfficeButtonProps.controlProps) === null || _outOfOfficeButtonPro2 === void 0 ? void 0 : _outOfOfficeButtonPro2.subtitleText) || "No agents available",
|
|
85
|
+
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,
|
|
86
|
+
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps),
|
|
87
|
+
// Out-of-office specific onClick - this will ALWAYS take precedence
|
|
88
|
+
onClick: () => {
|
|
89
|
+
if (state.appStates.isMinimized) {
|
|
90
|
+
dispatch({
|
|
91
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
92
|
+
payload: false
|
|
93
|
+
});
|
|
94
|
+
}
|
|
85
95
|
dispatch({
|
|
86
96
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
87
97
|
payload: ConversationState.OutOfOffice
|
|
88
98
|
});
|
|
89
|
-
}
|
|
90
|
-
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,
|
|
91
|
-
...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
|
|
99
|
+
}
|
|
92
100
|
};
|
|
93
101
|
useEffect(() => {
|
|
94
102
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
@@ -114,8 +122,13 @@ export const ChatButtonStateful = props => {
|
|
|
114
122
|
// If the conversation state is closed, check if we are outside operating hours
|
|
115
123
|
const isOutsideOperatingHours = state.appStates.outsideOperatingHours;
|
|
116
124
|
setOutOfOperatingHours(isOutsideOperatingHours);
|
|
125
|
+
} else {
|
|
126
|
+
// If conversation state is not Closed, we should not be in out-of-office mode
|
|
127
|
+
if (outOfOperatingHours) {
|
|
128
|
+
setOutOfOperatingHours(false);
|
|
129
|
+
}
|
|
117
130
|
}
|
|
118
|
-
}, [state.appStates.conversationState]);
|
|
131
|
+
}, [state.appStates.conversationState, state.appStates.outsideOperatingHours, state.appStates.isMinimized]);
|
|
119
132
|
return /*#__PURE__*/React.createElement(ChatButton, {
|
|
120
133
|
componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
|
|
121
134
|
controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
|
|
@@ -28,7 +28,10 @@ export const HeaderStateful = props => {
|
|
|
28
28
|
endChat
|
|
29
29
|
} = props;
|
|
30
30
|
//Setting OutOfOperatingHours Flag
|
|
31
|
-
|
|
31
|
+
// Initialize with the current state value to prevent visual flicker
|
|
32
|
+
const [outOfOperatingHours, setOutOfOperatingHours] = useState(() => {
|
|
33
|
+
return state.appStates.conversationState === ConversationState.Closed && state.appStates.outsideOperatingHours;
|
|
34
|
+
});
|
|
32
35
|
const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
|
|
33
36
|
|
|
34
37
|
// For some reason state object is not getting updated values in this component
|
|
@@ -103,6 +106,13 @@ export const HeaderStateful = props => {
|
|
|
103
106
|
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
104
107
|
payload: true
|
|
105
108
|
});
|
|
109
|
+
// Ensure conversation state remains Closed to maintain out-of-office mode
|
|
110
|
+
if (state.appStates.conversationState !== ConversationState.Closed) {
|
|
111
|
+
dispatch({
|
|
112
|
+
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
113
|
+
payload: ConversationState.Closed
|
|
114
|
+
});
|
|
115
|
+
}
|
|
106
116
|
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
107
117
|
Event: TelemetryEvent.MinimizeChatActionCompleted,
|
|
108
118
|
Description: "Header Minimize action completed."
|
|
@@ -132,7 +142,7 @@ export const HeaderStateful = props => {
|
|
|
132
142
|
const isOutsideOperatingHours = state.appStates.outsideOperatingHours;
|
|
133
143
|
setOutOfOperatingHours(isOutsideOperatingHours);
|
|
134
144
|
}
|
|
135
|
-
}, [state.appStates.conversationState]);
|
|
145
|
+
}, [state.appStates.conversationState, state.appStates.outsideOperatingHours]);
|
|
136
146
|
if (props.draggable === true) {
|
|
137
147
|
var _generalStyleProps;
|
|
138
148
|
const styleProps = outOfOperatingHours || state.appStates.conversationState === ConversationState.OutOfOffice ? outOfOfficeStyleProps : headerProps === null || headerProps === void 0 ? void 0 : headerProps.styleProps;
|
|
@@ -2,7 +2,6 @@ import React, { useEffect, 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";
|
|
@@ -11,7 +10,6 @@ import { getLiveChatWidgetContextInitialState } from "../../contexts/common/Live
|
|
|
11
10
|
import { getMockChatSDKIfApplicable } from "./common/getMockChatSDKIfApplicable";
|
|
12
11
|
import { isNullOrUndefined } from "../../common/utils";
|
|
13
12
|
import { isPersistentChatEnabled } from "./common/liveChatConfigUtils";
|
|
14
|
-
import { logWidgetLoadWithUnexpectedError } from "./common/startChatErrorHandler";
|
|
15
13
|
import overridePropsOnMockIfApplicable from "./common/overridePropsOnMockIfApplicable";
|
|
16
14
|
import { registerTelemetryLoggers } from "./common/registerTelemetryLoggers";
|
|
17
15
|
export const LiveChatWidget = props => {
|
|
@@ -44,11 +42,7 @@ export const LiveChatWidget = props => {
|
|
|
44
42
|
useEffect(() => {
|
|
45
43
|
registerTelemetryLoggers(props, dispatch);
|
|
46
44
|
}, [dispatch]);
|
|
47
|
-
return /*#__PURE__*/React.createElement(
|
|
48
|
-
onError: error => {
|
|
49
|
-
logWidgetLoadWithUnexpectedError(error);
|
|
50
|
-
}
|
|
51
|
-
}, /*#__PURE__*/React.createElement(FacadeChatSDKStore.Provider, {
|
|
45
|
+
return /*#__PURE__*/React.createElement(FacadeChatSDKStore.Provider, {
|
|
52
46
|
value: [facadeChatSDK, setFacadeChatSDK]
|
|
53
47
|
}, /*#__PURE__*/React.createElement(ChatSDKStore.Provider, {
|
|
54
48
|
value: chatSDK
|
|
@@ -56,6 +50,6 @@ export const LiveChatWidget = props => {
|
|
|
56
50
|
value: [adapter, setAdapter]
|
|
57
51
|
}, /*#__PURE__*/React.createElement(ChatContextStore.Provider, {
|
|
58
52
|
value: [state, dispatch]
|
|
59
|
-
}, /*#__PURE__*/React.createElement(LiveChatWidgetStateful, props)))))
|
|
53
|
+
}, /*#__PURE__*/React.createElement(LiveChatWidgetStateful, props)))));
|
|
60
54
|
};
|
|
61
55
|
export default LiveChatWidget;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.8.2-main.
|
|
3
|
+
"version": "1.8.2-main.5199342",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@azure/core-tracing": "^1.2.0",
|
|
88
88
|
"@microsoft/applicationinsights-web": "^3.3.6",
|
|
89
89
|
"@microsoft/omnichannel-chat-components": "1.1.12",
|
|
90
|
-
"@microsoft/omnichannel-chat-sdk": "^1.11.
|
|
90
|
+
"@microsoft/omnichannel-chat-sdk": "^1.11.4",
|
|
91
91
|
"@opentelemetry/api": "^1.9.0",
|
|
92
92
|
"abort-controller": "^3",
|
|
93
93
|
"abort-controller-es5": "^2.0.1",
|