@sawport/react-sdk 0.1.0-alpha.67 → 0.1.0-alpha.68
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/dist/index.js +74 -81
- package/dist/index.umd.js +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -67320,7 +67320,8 @@ const SlotPicker = react.exports.memo(({
|
|
|
67320
67320
|
name: "time"
|
|
67321
67321
|
}
|
|
67322
67322
|
}),
|
|
67323
|
-
status: errors["time"] && "error"
|
|
67323
|
+
status: errors["time"] && "error",
|
|
67324
|
+
disabled: !date4
|
|
67324
67325
|
})]
|
|
67325
67326
|
})]
|
|
67326
67327
|
});
|
|
@@ -67390,10 +67391,11 @@ const Offline = react.exports.memo(({
|
|
|
67390
67391
|
const endDay = days$1[toDay];
|
|
67391
67392
|
return day >= startDay && day <= endDay;
|
|
67392
67393
|
}),
|
|
67393
|
-
time: create$4().
|
|
67394
|
+
time: create$4().required("Please specify a time").test("time", "Selected time is out of Hours of Operation", function(value2, prop) {
|
|
67394
67395
|
const timeformat = "HH:mm:ss";
|
|
67395
67396
|
const check2 = hooks(value2, timeformat), beforeTime = hooks.tz(fromTime, timeformat, companyTimezone).local(), afterTime = hooks.tz(toTime, timeformat, companyTimezone).local();
|
|
67396
|
-
|
|
67397
|
+
const isToday = hooks(prop.parent.date).isSame(hooks(), "D");
|
|
67398
|
+
return isToday ? check2.isSameOrAfter(hooks()) && check2.isSameOrBefore(afterTime) : check2.isSameOrAfter(beforeTime) && check2.isSameOrBefore(afterTime);
|
|
67397
67399
|
}),
|
|
67398
67400
|
reason: create$4().min(1).required("Reason is required"),
|
|
67399
67401
|
mobile: create$4().min(7).required()
|
|
@@ -67561,7 +67563,10 @@ const Offline = react.exports.memo(({
|
|
|
67561
67563
|
scheduled: false
|
|
67562
67564
|
});
|
|
67563
67565
|
if (offlineMode) {
|
|
67564
|
-
quickStopChat(
|
|
67566
|
+
quickStopChat({
|
|
67567
|
+
companyClosed: false,
|
|
67568
|
+
offlineMode: false
|
|
67569
|
+
});
|
|
67565
67570
|
}
|
|
67566
67571
|
};
|
|
67567
67572
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -71890,14 +71895,14 @@ function ChatWidgetScreen({
|
|
|
71890
71895
|
dataRef,
|
|
71891
71896
|
setChatClose,
|
|
71892
71897
|
videoRef,
|
|
71893
|
-
companyUser,
|
|
71894
|
-
calendar: calendar2,
|
|
71895
|
-
setIsScheduling,
|
|
71896
71898
|
company,
|
|
71897
|
-
|
|
71898
|
-
|
|
71899
|
+
isOngoingChat,
|
|
71900
|
+
handleOk,
|
|
71901
|
+
popupVisible,
|
|
71902
|
+
handleCancel,
|
|
71903
|
+
setPopupVisible
|
|
71899
71904
|
}) {
|
|
71900
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
71905
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
71901
71906
|
const bottomRef = react.exports.useRef();
|
|
71902
71907
|
const [{
|
|
71903
71908
|
typingEvent,
|
|
@@ -71912,8 +71917,6 @@ function ChatWidgetScreen({
|
|
|
71912
71917
|
transferredAgent: null,
|
|
71913
71918
|
agentConnected: false
|
|
71914
71919
|
});
|
|
71915
|
-
const [popupVisible, setPopupVisible] = useState(false);
|
|
71916
|
-
const [offlineMode, setOfflineMode] = useState(false);
|
|
71917
71920
|
const [timeoutTriggered, setTimeoutTriggered] = useState(false);
|
|
71918
71921
|
const popupTime = ((_a = company == null ? void 0 : company.options) == null ? void 0 : _a.schedulePopUpTime) || 5;
|
|
71919
71922
|
const {
|
|
@@ -71941,7 +71944,7 @@ function ChatWidgetScreen({
|
|
|
71941
71944
|
state.transferredAgent = null;
|
|
71942
71945
|
});
|
|
71943
71946
|
const listeners2 = react.exports.useMemo(() => {
|
|
71944
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2,
|
|
71947
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j;
|
|
71945
71948
|
return {
|
|
71946
71949
|
[`message.new.${((_a2 = dataRef.current) == null ? void 0 : _a2.wait.conversation.id) || ((_b2 = dataRef.current) == null ? void 0 : _b2.wait.conversation)}`]: async ({
|
|
71947
71950
|
message
|
|
@@ -71992,7 +71995,7 @@ function ChatWidgetScreen({
|
|
|
71992
71995
|
state.transferredAgent = agent;
|
|
71993
71996
|
});
|
|
71994
71997
|
},
|
|
71995
|
-
[`WaitList.transferred.${((_g2 = dataRef.current) == null ? void 0 : _g2.wait.conversation.id) || ((
|
|
71998
|
+
[`WaitList.transferred.${((_g2 = dataRef.current) == null ? void 0 : _g2.wait.conversation.id) || ((_h = dataRef.current) == null ? void 0 : _h.wait.conversation)}`]: ({
|
|
71996
71999
|
agent
|
|
71997
72000
|
}) => {
|
|
71998
72001
|
setEvent((state) => {
|
|
@@ -72028,11 +72031,6 @@ function ChatWidgetScreen({
|
|
|
72028
72031
|
useSocketListeners({
|
|
72029
72032
|
listeners: listeners2
|
|
72030
72033
|
});
|
|
72031
|
-
const handleOk = () => {
|
|
72032
|
-
setOfflineMode(true);
|
|
72033
|
-
setPopupVisible(false);
|
|
72034
|
-
};
|
|
72035
|
-
const handleCancel = () => setPopupVisible(false);
|
|
72036
72034
|
react.exports.useEffect(() => {
|
|
72037
72035
|
if (isOngoingChat) {
|
|
72038
72036
|
setTimeoutTriggered(true);
|
|
@@ -72055,60 +72053,41 @@ function ChatWidgetScreen({
|
|
|
72055
72053
|
clearTimeout(timer);
|
|
72056
72054
|
};
|
|
72057
72055
|
}, [popupTime, agentDetails, timeoutTriggered]);
|
|
72058
|
-
return /* @__PURE__ */
|
|
72059
|
-
|
|
72060
|
-
|
|
72061
|
-
|
|
72062
|
-
|
|
72063
|
-
|
|
72064
|
-
|
|
72065
|
-
|
|
72066
|
-
|
|
72067
|
-
|
|
72068
|
-
|
|
72069
|
-
|
|
72070
|
-
|
|
72071
|
-
toDay: company == null ? void 0 : company.to_day,
|
|
72072
|
-
fromDay: company == null ? void 0 : company.from_day,
|
|
72073
|
-
options: (company == null ? void 0 : company.options) || {},
|
|
72074
|
-
offlineMode,
|
|
72075
|
-
quickStopChat
|
|
72076
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
72077
|
-
className: "widget-chat-container",
|
|
72078
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
72079
|
-
id: "widget-chat-send",
|
|
72080
|
-
className: "widget-chat-display-container",
|
|
72081
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
72082
|
-
className: "chat-receive-container mb-4 d-flex align-items-center",
|
|
72083
|
-
children: /* @__PURE__ */ jsx("p", {
|
|
72084
|
-
className: `widget-chat-receive mb-0`,
|
|
72085
|
-
children: welcome_message
|
|
72086
|
-
})
|
|
72087
|
-
}), /* @__PURE__ */ jsx(Messages, {
|
|
72088
|
-
chatMessages: messages2,
|
|
72089
|
-
dataRef,
|
|
72090
|
-
companyColor: company == null ? void 0 : company.hex_code
|
|
72091
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
72092
|
-
ref: bottomRef,
|
|
72093
|
-
className: "chat-bottom"
|
|
72094
|
-
})]
|
|
72095
|
-
}), /* @__PURE__ */ jsx(ChatInput, {
|
|
72056
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
72057
|
+
className: "widget-chat-container",
|
|
72058
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
72059
|
+
id: "widget-chat-send",
|
|
72060
|
+
className: "widget-chat-display-container",
|
|
72061
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
72062
|
+
className: "chat-receive-container mb-4 d-flex align-items-center",
|
|
72063
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
72064
|
+
className: `widget-chat-receive mb-0`,
|
|
72065
|
+
children: welcome_message
|
|
72066
|
+
})
|
|
72067
|
+
}), /* @__PURE__ */ jsx(Messages, {
|
|
72068
|
+
chatMessages: messages2,
|
|
72096
72069
|
dataRef,
|
|
72097
|
-
|
|
72098
|
-
|
|
72099
|
-
|
|
72100
|
-
|
|
72101
|
-
popupVisible,
|
|
72102
|
-
handleCancel,
|
|
72103
|
-
handleOk
|
|
72104
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
72105
|
-
style: {
|
|
72106
|
-
fontStyle: "italic",
|
|
72107
|
-
fontSize: "10px"
|
|
72108
|
-
},
|
|
72109
|
-
children: agentDetails && typingEvent ? `${agentDetails == null ? void 0 : agentDetails.firstName} is typing...` : ""
|
|
72070
|
+
companyColor: company == null ? void 0 : company.hex_code
|
|
72071
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
72072
|
+
ref: bottomRef,
|
|
72073
|
+
className: "chat-bottom"
|
|
72110
72074
|
})]
|
|
72111
|
-
})
|
|
72075
|
+
}), /* @__PURE__ */ jsx(ChatInput, {
|
|
72076
|
+
dataRef,
|
|
72077
|
+
agentDetails,
|
|
72078
|
+
transferredAgent,
|
|
72079
|
+
waitlistTransferredStatus,
|
|
72080
|
+
agentConnected,
|
|
72081
|
+
popupVisible,
|
|
72082
|
+
handleCancel,
|
|
72083
|
+
handleOk
|
|
72084
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
72085
|
+
style: {
|
|
72086
|
+
fontStyle: "italic",
|
|
72087
|
+
fontSize: "10px"
|
|
72088
|
+
},
|
|
72089
|
+
children: agentDetails && typingEvent ? `${agentDetails == null ? void 0 : agentDetails.firstName} is typing...` : ""
|
|
72090
|
+
})]
|
|
72112
72091
|
});
|
|
72113
72092
|
}
|
|
72114
72093
|
const ChatInput = react.exports.memo(function({
|
|
@@ -74212,7 +74191,8 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
74212
74191
|
isScheduling,
|
|
74213
74192
|
companyClosed,
|
|
74214
74193
|
calendar: calendar2,
|
|
74215
|
-
customerCount
|
|
74194
|
+
customerCount,
|
|
74195
|
+
offlineMode
|
|
74216
74196
|
}, setState, stateRef] = useState({
|
|
74217
74197
|
chatInit: false,
|
|
74218
74198
|
chatClose: true,
|
|
@@ -74221,7 +74201,8 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
74221
74201
|
isScheduling: false,
|
|
74222
74202
|
companyClosed: companyIsClosed,
|
|
74223
74203
|
calendar: void 0,
|
|
74224
|
-
customerCount: 0
|
|
74204
|
+
customerCount: 0,
|
|
74205
|
+
offlineMode: false
|
|
74225
74206
|
});
|
|
74226
74207
|
react.exports.useEffect(() => setState({
|
|
74227
74208
|
companyClosed: companyIsClosed
|
|
@@ -74260,12 +74241,13 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
74260
74241
|
});
|
|
74261
74242
|
}
|
|
74262
74243
|
}, [socket2.connected, chatInit, customer == null ? void 0 : customer.id]);
|
|
74263
|
-
const quickStopChat = react.exports.useCallback(() => {
|
|
74244
|
+
const quickStopChat = react.exports.useCallback((extraState = {}) => {
|
|
74264
74245
|
var _a2, _b2, _c2, _d2;
|
|
74265
74246
|
setState({
|
|
74266
74247
|
chatInit: false,
|
|
74267
74248
|
chatClose: true,
|
|
74268
|
-
companyClosed: companyIsClosed
|
|
74249
|
+
companyClosed: companyIsClosed,
|
|
74250
|
+
...extraState
|
|
74269
74251
|
});
|
|
74270
74252
|
if (((_b2 = (_a2 = dataRef.current) == null ? void 0 : _a2.wait) == null ? void 0 : _b2.status) === "waiting") {
|
|
74271
74253
|
updateWait((_d2 = (_c2 = dataRef.current) == null ? void 0 : _c2.wait) == null ? void 0 : _d2.id, {
|
|
@@ -74391,7 +74373,9 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
74391
74373
|
toDay: company == null ? void 0 : company.to_day,
|
|
74392
74374
|
fromDay: company == null ? void 0 : company.from_day,
|
|
74393
74375
|
timezone: company == null ? void 0 : company.timezone,
|
|
74394
|
-
options: (company == null ? void 0 : company.options) || {}
|
|
74376
|
+
options: (company == null ? void 0 : company.options) || {},
|
|
74377
|
+
offlineMode,
|
|
74378
|
+
quickStopChat
|
|
74395
74379
|
}) : chatInit && !chatClose ? /* @__PURE__ */ jsx(Feedback$1, {
|
|
74396
74380
|
quickStopChat,
|
|
74397
74381
|
agent,
|
|
@@ -74442,6 +74426,15 @@ const ChatMode = react.exports.memo(({
|
|
|
74442
74426
|
}]
|
|
74443
74427
|
});
|
|
74444
74428
|
const [isOngoingChat, setIsOngoingChat] = useState(false);
|
|
74429
|
+
const [popupVisible, setPopupVisible] = useState(false);
|
|
74430
|
+
const handleOk = () => {
|
|
74431
|
+
setPopupVisible(false);
|
|
74432
|
+
quickStopChat({
|
|
74433
|
+
companyClosed: true,
|
|
74434
|
+
offlineMode: true
|
|
74435
|
+
});
|
|
74436
|
+
};
|
|
74437
|
+
const handleCancel = () => setPopupVisible(false);
|
|
74445
74438
|
const agent_ = react.exports.useMemo(() => {
|
|
74446
74439
|
var _a2, _b2;
|
|
74447
74440
|
const connectors = (_a2 = data2 == null ? void 0 : data2[0]) == null ? void 0 : _a2.connectors;
|
|
@@ -74471,13 +74464,13 @@ const ChatMode = react.exports.memo(({
|
|
|
74471
74464
|
dataRef,
|
|
74472
74465
|
setChatClose,
|
|
74473
74466
|
videoRef,
|
|
74474
|
-
companyUser,
|
|
74475
|
-
calendar: calendar2,
|
|
74476
|
-
setIsScheduling,
|
|
74477
74467
|
company,
|
|
74478
|
-
quickStopChat,
|
|
74479
74468
|
agent: agent_,
|
|
74480
|
-
isOngoingChat
|
|
74469
|
+
isOngoingChat,
|
|
74470
|
+
handleOk,
|
|
74471
|
+
popupVisible,
|
|
74472
|
+
handleCancel,
|
|
74473
|
+
setPopupVisible
|
|
74481
74474
|
});
|
|
74482
74475
|
});
|
|
74483
74476
|
const OngoingChat = ({
|