@sawport/react-sdk 0.1.0-alpha.24 → 0.1.0-alpha.26
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 +10 -20
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31745,15 +31745,13 @@ function WidgetInitForm({
|
|
|
31745
31745
|
country_code: country_code2,
|
|
31746
31746
|
timezone: timezone2
|
|
31747
31747
|
} = data2.data;
|
|
31748
|
-
const timezoneStringSplit = timezone2.split("/");
|
|
31749
31748
|
setState({
|
|
31750
31749
|
ipAddress: ip,
|
|
31751
31750
|
country: country_name,
|
|
31752
31751
|
longitude: longitude2,
|
|
31753
31752
|
latitude: latitude2,
|
|
31754
31753
|
location: region,
|
|
31755
|
-
country_code: country_code2
|
|
31756
|
-
continent: timezoneStringSplit[0]
|
|
31754
|
+
country_code: country_code2
|
|
31757
31755
|
});
|
|
31758
31756
|
const requestObject = {
|
|
31759
31757
|
ip_address: ip,
|
|
@@ -31794,8 +31792,7 @@ function WidgetInitForm({
|
|
|
31794
31792
|
latitude,
|
|
31795
31793
|
longitude,
|
|
31796
31794
|
location: location2,
|
|
31797
|
-
source_url
|
|
31798
|
-
continent
|
|
31795
|
+
source_url
|
|
31799
31796
|
}, "post"), {
|
|
31800
31797
|
onError: (err) => {
|
|
31801
31798
|
toast.error("Error occured, try again", {
|
|
@@ -45788,6 +45785,7 @@ var Rating = dist.Rating = function(t2) {
|
|
|
45788
45785
|
const createFeedback = (params) => api("feedbacks", params, "post");
|
|
45789
45786
|
const getWaitConnectors = async (data2) => api("wait-connectors", data2);
|
|
45790
45787
|
const getLongestWaitTime = async (data2) => api("waits/longest", data2);
|
|
45788
|
+
const updateWait = async (id2, data2) => api(`waits/${id2}`, data2, "put");
|
|
45791
45789
|
function Feedback({
|
|
45792
45790
|
agent: agent_,
|
|
45793
45791
|
quickStopChat,
|
|
@@ -47285,7 +47283,7 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
47285
47283
|
setIsWidgetLaunched,
|
|
47286
47284
|
isWidgetLaunched
|
|
47287
47285
|
}) => {
|
|
47288
|
-
var _a, _b, _c, _d
|
|
47286
|
+
var _a, _b, _c, _d;
|
|
47289
47287
|
const {
|
|
47290
47288
|
socket: socket2
|
|
47291
47289
|
} = useSocket();
|
|
@@ -47332,26 +47330,18 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
47332
47330
|
}
|
|
47333
47331
|
}, [socket2.connected, chatInit, customer == null ? void 0 : customer.id]);
|
|
47334
47332
|
const quickStopChat = react.exports.useCallback(() => {
|
|
47335
|
-
var _a2, _b2, _c2, _d2;
|
|
47336
47333
|
setState({
|
|
47337
47334
|
chatInit: false,
|
|
47338
47335
|
chatClose: true,
|
|
47339
47336
|
companyClosed: companyIsClosed
|
|
47340
47337
|
});
|
|
47341
|
-
((_a2 = dataRef.current) == null ? void 0 : _a2.wait) && socket2.emit("chat.ended", {
|
|
47342
|
-
to: (_b2 = agent == null ? void 0 : agent.user) == null ? void 0 : _b2.id,
|
|
47343
|
-
waitId: (_d2 = (_c2 = dataRef.current) == null ? void 0 : _c2.wait) == null ? void 0 : _d2.id,
|
|
47344
|
-
customer
|
|
47345
|
-
});
|
|
47346
47338
|
dataRef.current = null;
|
|
47347
|
-
}, [companyIsClosed,
|
|
47339
|
+
}, [companyIsClosed, dataRef]);
|
|
47348
47340
|
const setChatClose = (chatClose2) => {
|
|
47349
|
-
var _a2, _b2
|
|
47341
|
+
var _a2, _b2;
|
|
47350
47342
|
t$1.emit("chat-ended");
|
|
47351
|
-
|
|
47352
|
-
|
|
47353
|
-
waitId: (_c2 = (_b2 = dataRef.current) == null ? void 0 : _b2.wait) == null ? void 0 : _c2.id,
|
|
47354
|
-
customer
|
|
47343
|
+
updateWait((_b2 = (_a2 = dataRef.current) == null ? void 0 : _a2.wait) == null ? void 0 : _b2.id, {
|
|
47344
|
+
status: "ended"
|
|
47355
47345
|
});
|
|
47356
47346
|
setState({
|
|
47357
47347
|
chatClose: chatClose2
|
|
@@ -47406,7 +47396,7 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
47406
47396
|
quickStopChat,
|
|
47407
47397
|
company,
|
|
47408
47398
|
videoRef
|
|
47409
|
-
}), !!((
|
|
47399
|
+
}), !!((_c = (_b = dataRef == null ? void 0 : dataRef.current) == null ? void 0 : _b.wait) == null ? void 0 : _c.createdAt) && !stateRef.current.agent && /* @__PURE__ */ jsx(LongestWaitime, {}), /* @__PURE__ */ jsx("div", {
|
|
47410
47400
|
className: `widget-body-container px-3 ${companyClosed && "widget-body-container-offline"} `,
|
|
47411
47401
|
children: isLoadingCustomer ? /* @__PURE__ */ jsx(Spinner$2, {}) : isScheduling ? /* @__PURE__ */ jsx(Schedules, {
|
|
47412
47402
|
setParentState: setState,
|
|
@@ -47428,7 +47418,7 @@ const WidgetFormDisplay = react.exports.memo(({
|
|
|
47428
47418
|
}) : chatInit && !chatClose ? /* @__PURE__ */ jsx(Feedback$1, {
|
|
47429
47419
|
quickStopChat,
|
|
47430
47420
|
agent,
|
|
47431
|
-
conversation_id: (
|
|
47421
|
+
conversation_id: (_d = dataRef.current) == null ? void 0 : _d.wait.conversation.id
|
|
47432
47422
|
}) : !chatInit ? /* @__PURE__ */ jsx(WidgetInitForm$1, {
|
|
47433
47423
|
company_id,
|
|
47434
47424
|
companyUser,
|