tanya-chatbot 0.2.6 → 0.2.8
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/tanya-chatbot.es.js
CHANGED
|
@@ -127,10 +127,9 @@ const wt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
|
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
async function Ut() {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
).isGuest
|
|
133
|
-
if (t && e && (/* @__PURE__ */ new Date()).getTime() < parseInt(t) && r === JSON.parse(localStorage.getItem("isGuest") || "false"))
|
|
130
|
+
var a;
|
|
131
|
+
const t = localStorage.getItem("expires_in"), e = localStorage.getItem("access_token"), r = ((a = JSON.parse(sessionStorage.getItem("customerData") || "{}")) == null ? void 0 : a.isGuest) || !0;
|
|
132
|
+
if (t && e && (/* @__PURE__ */ new Date()).getTime() < parseInt(t) && (r === localStorage.getItem("isGuest") || !0))
|
|
134
133
|
return console.log("access token found in local storage"), { access_token: e, expires_in: t };
|
|
135
134
|
const { serverUrl: n } = wt(), o = JSON.parse(
|
|
136
135
|
sessionStorage.getItem("customerData") || "{}"
|
|
@@ -138,18 +137,18 @@ async function Ut() {
|
|
|
138
137
|
sessionStorage.getItem("customerData") || "{}"
|
|
139
138
|
).usrRef;
|
|
140
139
|
try {
|
|
141
|
-
const
|
|
142
|
-
`${n}sc-api/${
|
|
140
|
+
const c = r ? "unregister-auth" : "register-auth", s = await z.get(
|
|
141
|
+
`${n}sc-api/${c}?dwsid=${o}&email=${i}&pubCfg=${dt()}&envRef=${ft()}&orgRef=${pt()}&siteId=${et()}&token=true`,
|
|
143
142
|
{
|
|
144
143
|
withCredentials: !0
|
|
145
144
|
}
|
|
146
145
|
);
|
|
147
|
-
return console.log(
|
|
146
|
+
return console.log(s.data), localStorage.setItem("access_token", s.data.access_token), localStorage.setItem(
|
|
148
147
|
"expires_in",
|
|
149
|
-
String((/* @__PURE__ */ new Date()).getTime() +
|
|
150
|
-
), localStorage.setItem("isGuest", r),
|
|
151
|
-
} catch (
|
|
152
|
-
console.log(
|
|
148
|
+
String((/* @__PURE__ */ new Date()).getTime() + s.data.expires_in * 1e3)
|
|
149
|
+
), localStorage.setItem("isGuest", r ? "true" : "false"), s.data;
|
|
150
|
+
} catch (c) {
|
|
151
|
+
console.log(c);
|
|
153
152
|
}
|
|
154
153
|
}
|
|
155
154
|
const ut = () => sessionStorage.getItem("Host"), et = () => sessionStorage.getItem("SiteId"), dt = () => sessionStorage.getItem("pubCfg"), ft = () => sessionStorage.getItem("envRef"), pt = () => sessionStorage.getItem("orgRef"), De = async (t) => {
|