@sawport/react-sdk 0.1.0-alpha.72 → 0.1.0-alpha.73
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 +13 -11
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -69482,7 +69482,7 @@ function WidgetInitForm({
|
|
|
69482
69482
|
...emptyFields2
|
|
69483
69483
|
}) => {
|
|
69484
69484
|
var _a, _b;
|
|
69485
|
-
const phoneNumberRegex =
|
|
69485
|
+
const phoneNumberRegex = /^\+?\d{1,3}(\s?[-]?\d{3}){3}\s?\d$/;
|
|
69486
69486
|
if (((_a = fields == null ? void 0 : fields.mobile) == null ? void 0 : _a.show) || ((_b = fields == null ? void 0 : fields.mobile) == null ? void 0 : _b.show) === void 0) {
|
|
69487
69487
|
if (mobile === "") {
|
|
69488
69488
|
toast.error("Phone number is required", {
|
|
@@ -73410,7 +73410,6 @@ function ChatWidgetScreen({
|
|
|
73410
73410
|
transferredAgent: null,
|
|
73411
73411
|
agentConnected: false
|
|
73412
73412
|
});
|
|
73413
|
-
const popupTime = ((_a = company == null ? void 0 : company.options) == null ? void 0 : _a.schedulePopUpTime) || 1e3 * 60;
|
|
73414
73413
|
const {
|
|
73415
73414
|
state: {
|
|
73416
73415
|
data: {
|
|
@@ -73422,7 +73421,7 @@ function ChatWidgetScreen({
|
|
|
73422
73421
|
asyncRequest: getMessages,
|
|
73423
73422
|
params: [{
|
|
73424
73423
|
conversation: {
|
|
73425
|
-
id: (
|
|
73424
|
+
id: (_a = dataRef.current) == null ? void 0 : _a.wait.conversation.id
|
|
73426
73425
|
}
|
|
73427
73426
|
}]
|
|
73428
73427
|
});
|
|
@@ -73519,7 +73518,7 @@ function ChatWidgetScreen({
|
|
|
73519
73518
|
});
|
|
73520
73519
|
}
|
|
73521
73520
|
};
|
|
73522
|
-
}, [(
|
|
73521
|
+
}, [(_c = (_b = dataRef.current) == null ? void 0 : _b.customer) == null ? void 0 : _c.id, t$3, setChatClose, ((_d = dataRef.current) == null ? void 0 : _d.wait.conversation.id) || ((_e = dataRef.current) == null ? void 0 : _e.wait.conversation), (_f = dataRef.current) == null ? void 0 : _f.wait.id]);
|
|
73523
73522
|
useSocketListeners({
|
|
73524
73523
|
listeners: listeners2
|
|
73525
73524
|
});
|
|
@@ -73527,11 +73526,14 @@ function ChatWidgetScreen({
|
|
|
73527
73526
|
isOngoingChat && clearInterval(timeoutRef.current);
|
|
73528
73527
|
}, [timeoutRef, isOngoingChat]);
|
|
73529
73528
|
reactExports.useEffect(() => {
|
|
73530
|
-
|
|
73531
|
-
|
|
73532
|
-
|
|
73529
|
+
var _a2, _b2;
|
|
73530
|
+
if (((_a2 = company == null ? void 0 : company.options) == null ? void 0 : _a2.schedulePopUpTime) && !agentDetails) {
|
|
73531
|
+
const intervalId = setInterval(() => {
|
|
73532
|
+
setPopupVisible(true);
|
|
73533
|
+
}, (_b2 = company == null ? void 0 : company.options) == null ? void 0 : _b2.schedulePopUpTime);
|
|
73534
|
+
return () => clearInterval(intervalId);
|
|
73533
73535
|
}
|
|
73534
|
-
}, [
|
|
73536
|
+
}, [(_g = company == null ? void 0 : company.options) == null ? void 0 : _g.schedulePopUpTime, agentDetails]);
|
|
73535
73537
|
return /* @__PURE__ */ jsxs("div", {
|
|
73536
73538
|
className: "widget-chat-container",
|
|
73537
73539
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
@@ -73643,7 +73645,7 @@ const ChatInput = reactExports.memo(function({
|
|
|
73643
73645
|
chatFiles: event.target.files[0]
|
|
73644
73646
|
});
|
|
73645
73647
|
} else {
|
|
73646
|
-
toast.info("
|
|
73648
|
+
toast.info("Ony PDF Files supported");
|
|
73647
73649
|
return;
|
|
73648
73650
|
}
|
|
73649
73651
|
}
|
|
@@ -76023,7 +76025,7 @@ const OngoingChat = ({
|
|
|
76023
76025
|
const currentTimestamp = (/* @__PURE__ */ new Date()).getTime();
|
|
76024
76026
|
const offlineAt = (/* @__PURE__ */ new Date(`${conversation == null ? void 0 : conversation.offlineAt}`)).getTime();
|
|
76025
76027
|
const timeDifferenceInMilliseconds = currentTimestamp - offlineAt;
|
|
76026
|
-
const timeDifferenceInMinutes = Math.floor(timeDifferenceInMilliseconds /
|
|
76028
|
+
const timeDifferenceInMinutes = Math.floor(timeDifferenceInMilliseconds / chatSession);
|
|
76027
76029
|
if (timeDifferenceInMinutes >= chatSession) {
|
|
76028
76030
|
toast.info("Time expired for going off chat", {
|
|
76029
76031
|
autoClose: 2e3
|
|
@@ -76031,7 +76033,7 @@ const OngoingChat = ({
|
|
|
76031
76033
|
endChat();
|
|
76032
76034
|
}
|
|
76033
76035
|
}
|
|
76034
|
-
}, []);
|
|
76036
|
+
}, [chatSession, wait == null ? void 0 : wait.status, conversation == null ? void 0 : conversation.offlineAt]);
|
|
76035
76037
|
return /* @__PURE__ */ jsxs("div", {
|
|
76036
76038
|
className: "p-4 d-flex flex-column align-items-center justify-content-center",
|
|
76037
76039
|
children: [/* @__PURE__ */ jsx("h3", {
|