@connorpham/live-chat-widget 8.0.0 → 10.0.0
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.
|
@@ -706,7 +706,7 @@ const Qf = {
|
|
|
706
706
|
language: "en",
|
|
707
707
|
maxUploadSize: nD.UPLOAD_MAX_SIZE_IN_BYTES ?? "" ? Number(nD.UPLOAD_MAX_SIZE_IN_BYTES) : 20 * 1024 * 1024,
|
|
708
708
|
// 20 MB in bytes
|
|
709
|
-
ownerId: nD.REACT_APP_WIDGET_OWNER_ID || "
|
|
709
|
+
ownerId: nD.REACT_APP_WIDGET_OWNER_ID || "68342cec1e3cef0065f1b563"
|
|
710
710
|
}, u1 = Mu(Qf), D1 = ({ children: u, ...D }) => {
|
|
711
711
|
const f = bu({
|
|
712
712
|
...Qf,
|
|
@@ -3238,7 +3238,7 @@ cD(vD, "defaultConfig", {
|
|
|
3238
3238
|
let uf = vD, MD;
|
|
3239
3239
|
const me = (u, D) => {
|
|
3240
3240
|
var e;
|
|
3241
|
-
const f = (e = JSON.parse(localStorage.getItem("
|
|
3241
|
+
const f = (e = JSON.parse(localStorage.getItem("profileLiveChat") || "{}")) == null ? void 0 : e.id;
|
|
3242
3242
|
return MD || (MD = new uf(
|
|
3243
3243
|
u.apiUrl,
|
|
3244
3244
|
{
|
|
@@ -3511,7 +3511,7 @@ const me = (u, D) => {
|
|
|
3511
3511
|
typeof zu == "string" && zu.trim() && au.append(gu, zu);
|
|
3512
3512
|
}), au.append("owner_id", e.ownerId);
|
|
3513
3513
|
const { body: lu } = await Bu.get(`/webhook/${e.channel}/?${au.toString()}`);
|
|
3514
|
-
console.log("jump here 2"), localStorage.setItem("
|
|
3514
|
+
console.log("jump here 2"), localStorage.setItem("profileLiveChat", JSON.stringify(lu.profile)), localStorage.setItem("isOffline", JSON.stringify(cu || !1)), localStorage.setItem(
|
|
3515
3515
|
"submitedFormLateTime",
|
|
3516
3516
|
JSON.stringify(lu.profile.submitedFormLateTime || null)
|
|
3517
3517
|
), j(
|
|
@@ -3569,7 +3569,7 @@ const me = (u, D) => {
|
|
|
3569
3569
|
}, [F, d]), G(() => {
|
|
3570
3570
|
if (d && A === fD.connected) {
|
|
3571
3571
|
console.log("🔄 Widget opened - fetching fresh data");
|
|
3572
|
-
const S = localStorage.getItem("
|
|
3572
|
+
const S = localStorage.getItem("profileLiveChat");
|
|
3573
3573
|
if (S) {
|
|
3574
3574
|
const fu = JSON.parse(S);
|
|
3575
3575
|
console.log("🔄 Widget opened - fetching fresh data", fu), du(fu.firstName, fu.lastName);
|
|
@@ -3581,7 +3581,7 @@ const me = (u, D) => {
|
|
|
3581
3581
|
}), G(() => {
|
|
3582
3582
|
n === "chat" && A === fD.connected && du();
|
|
3583
3583
|
const S = () => {
|
|
3584
|
-
const fu = localStorage.getItem("
|
|
3584
|
+
const fu = localStorage.getItem("profileLiveChat");
|
|
3585
3585
|
if (fu) {
|
|
3586
3586
|
const au = JSON.parse(fu);
|
|
3587
3587
|
du(au.firstName, au.lastName);
|
|
@@ -4014,7 +4014,7 @@ const me = (u, D) => {
|
|
|
4014
4014
|
}, []);
|
|
4015
4015
|
const s = async () => {
|
|
4016
4016
|
try {
|
|
4017
|
-
const F = localStorage.getItem("
|
|
4017
|
+
const F = localStorage.getItem("profileLiveChat");
|
|
4018
4018
|
if (!F) {
|
|
4019
4019
|
console.error("No profile found in localStorage");
|
|
4020
4020
|
return;
|
|
@@ -6713,14 +6713,14 @@ const aD = [
|
|
|
6713
6713
|
if (t.formSettings.forEach(($) => {
|
|
6714
6714
|
var Du;
|
|
6715
6715
|
$.isDisplay && A[$.key] !== void 0 && (v[$.key] = ((Du = A[$.key]) == null ? void 0 : Du.toString().trim()) || "");
|
|
6716
|
-
}), !localStorage.getItem("
|
|
6716
|
+
}), !localStorage.getItem("profileLiveChat"))
|
|
6717
6717
|
try {
|
|
6718
6718
|
const $ = new URLSearchParams();
|
|
6719
6719
|
Object.entries(v).forEach(([b, O]) => {
|
|
6720
6720
|
typeof O == "string" && O.trim() && $.append(b, O);
|
|
6721
6721
|
}), $.append("owner_id", e.ownerId), $.append("contactLateTime", (/* @__PURE__ */ new Date()).toISOString());
|
|
6722
6722
|
const { body: Du } = await n.get(`/webhook/${e.channel}/?${$.toString()}`), { messages: N, profile: E } = Du;
|
|
6723
|
-
localStorage.setItem("
|
|
6723
|
+
localStorage.setItem("profileLiveChat", JSON.stringify(E)), localStorage.setItem("isOffline", JSON.stringify(!1)), localStorage.setItem(
|
|
6724
6724
|
"submitedFormLateTime",
|
|
6725
6725
|
JSON.stringify((E == null ? void 0 : E.submitedFormLateTime) || null)
|
|
6726
6726
|
), N.forEach((b) => {
|
|
@@ -7090,7 +7090,7 @@ const pt = ({ message: u, Avatar: D }) => {
|
|
|
7090
7090
|
}, 100);
|
|
7091
7091
|
}, [D, e]), G(() => {
|
|
7092
7092
|
const B = () => {
|
|
7093
|
-
const y = JSON.parse(localStorage.getItem("
|
|
7093
|
+
const y = JSON.parse(localStorage.getItem("profileLiveChat") || "{}"), v = JSON.parse(localStorage.getItem("submitedFormLateTime") || "null") || y.submitedFormLateTime, q = t.some(
|
|
7094
7094
|
(P) => P.data && "isShowForm" in P.data && P.data.isShowForm
|
|
7095
7095
|
);
|
|
7096
7096
|
if (m && !v && !q) {
|
|
@@ -10824,7 +10824,7 @@ const Nt = ({ item: u, onPostback: D }) => {
|
|
|
10824
10824
|
}, b = () => {
|
|
10825
10825
|
var z;
|
|
10826
10826
|
(z = B.current) == null || z.focus();
|
|
10827
|
-
}, O = d === FD.uploading, R = JSON.parse(localStorage.getItem("
|
|
10827
|
+
}, O = d === FD.uploading, R = JSON.parse(localStorage.getItem("profileLiveChat") || "{}"), W = JSON.parse(localStorage.getItem("isOffline") || "false") || (R == null ? void 0 : R.isOffline), J = ((X = R == null ? void 0 : R.channel) == null ? void 0 : X.name) === "console-channel";
|
|
10828
10828
|
return (W || !(R != null && R.id)) && !J ? null : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
10829
10829
|
A.length > 0 && /* @__PURE__ */ a.jsx(Ot, {}),
|
|
10830
10830
|
/* @__PURE__ */ a.jsxs("div", { className: "sc-user-input-wrapper", children: [
|
|
@@ -10983,7 +10983,7 @@ const Nt = ({ item: u, onPostback: D }) => {
|
|
|
10983
10983
|
m.preventDefault(), s.setIsOpen(!s.isOpen);
|
|
10984
10984
|
};
|
|
10985
10985
|
return _e(), new URLSearchParams().append("owner_id", n.ownerId), G(() => {
|
|
10986
|
-
if (!l && !localStorage.getItem("
|
|
10986
|
+
if (!l && !localStorage.getItem("profileLiveChat")) {
|
|
10987
10987
|
d("prechat");
|
|
10988
10988
|
return;
|
|
10989
10989
|
}
|
|
@@ -11057,7 +11057,7 @@ const Nt = ({ item: u, onPostback: D }) => {
|
|
|
11057
11057
|
typeof g == "string" && g.trim() && _.append(P, g);
|
|
11058
11058
|
}), _.append("contactLateTime", (/* @__PURE__ */ new Date()).toISOString()), _.append("owner_id", D.ownerId);
|
|
11059
11059
|
const { body: B } = await t.get(`/webhook/${D.channel}/?${_.toString()}`), { messages: T, profile: y } = B;
|
|
11060
|
-
console.log("jump here 1"), localStorage.setItem("
|
|
11060
|
+
console.log("jump here 1"), localStorage.setItem("profileLiveChat", JSON.stringify(y)), localStorage.setItem("isOffline", JSON.stringify(j || !1)), localStorage.setItem(
|
|
11061
11061
|
"submitedFormLateTime",
|
|
11062
11062
|
JSON.stringify((y == null ? void 0 : y.submitedFormLateTime) || null)
|
|
11063
11063
|
), T.forEach((P) => {
|
|
@@ -11113,7 +11113,7 @@ const Nt = ({ item: u, onPostback: D }) => {
|
|
|
11113
11113
|
return G(() => {
|
|
11114
11114
|
if (!L.current) {
|
|
11115
11115
|
L.current = !0;
|
|
11116
|
-
const I = localStorage.getItem("
|
|
11116
|
+
const I = localStorage.getItem("profileLiveChat");
|
|
11117
11117
|
if (I) {
|
|
11118
11118
|
const _ = JSON.parse(I), B = {};
|
|
11119
11119
|
Object.entries(_).forEach(([T, y]) => {
|