tanya-chatbot 0.2.7 → 0.2.9
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
|
@@ -98,8 +98,8 @@ function pn({
|
|
|
98
98
|
}) {
|
|
99
99
|
return /* @__PURE__ */ l(wr.Trigger, { "data-slot": "popover-trigger", ...t });
|
|
100
100
|
}
|
|
101
|
-
const wt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1.amazonaws.com/dev/api/bedrock/invoke/stream", xAPIKey: "BJBtjpPkqGatuoa3qJqdR8aHXSsHkgvGaootbubi", serverUrl: "
|
|
102
|
-
const t = "
|
|
101
|
+
const wt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1.amazonaws.com/dev/api/bedrock/invoke/stream", xAPIKey: "BJBtjpPkqGatuoa3qJqdR8aHXSsHkgvGaootbubi", serverUrl: "https://tanya-sfcc-server.vercel.app/", basePath: "sc-api" }), xr = async () => {
|
|
102
|
+
const t = "https://tanya-sfcc-server.vercel.app/";
|
|
103
103
|
try {
|
|
104
104
|
const e = await z.post(
|
|
105
105
|
`${t}api/auth/token-bm-grant?baseUrl=${ut()}&siteId=${et()}`
|
|
@@ -109,7 +109,7 @@ const wt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
|
|
|
109
109
|
return z.isAxiosError(e) ? console.error("Error fetching token:", e.response || e.message) : console.error("Unexpected error:", e), null;
|
|
110
110
|
}
|
|
111
111
|
}, vr = async (t) => {
|
|
112
|
-
const e = "
|
|
112
|
+
const e = "https://tanya-sfcc-server.vercel.app/";
|
|
113
113
|
try {
|
|
114
114
|
const r = JSON.parse(sessionStorage.getItem("customerData") || "{}").dwsid, n = await z.post(
|
|
115
115
|
`${e}api/auth/token-existing-guest-customer?dwsid=${r}&baseUrl=${ut()}&siteId=${et()}&pubCfg=${dt()}&envRef=${ft()}&orgRef=${pt()}`,
|
|
@@ -129,7 +129,7 @@ const wt = () => ({ aiConversationUrl: "https://mdv3qwfi2j.execute-api.us-east-1
|
|
|
129
129
|
async function Ut() {
|
|
130
130
|
var a;
|
|
131
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 ===
|
|
132
|
+
if (t && e && (/* @__PURE__ */ new Date()).getTime() < parseInt(t) && (r === localStorage.getItem("isGuest") || !0))
|
|
133
133
|
return console.log("access token found in local storage"), { access_token: e, expires_in: t };
|
|
134
134
|
const { serverUrl: n } = wt(), o = JSON.parse(
|
|
135
135
|
sessionStorage.getItem("customerData") || "{}"
|
|
@@ -143,10 +143,10 @@ async function Ut() {
|
|
|
143
143
|
withCredentials: !0
|
|
144
144
|
}
|
|
145
145
|
);
|
|
146
|
-
return
|
|
146
|
+
return localStorage.setItem("access_token", s.data.access_token), localStorage.setItem(
|
|
147
147
|
"expires_in",
|
|
148
148
|
String((/* @__PURE__ */ new Date()).getTime() + s.data.expires_in * 1e3)
|
|
149
|
-
), localStorage.setItem("isGuest", r), s.data;
|
|
149
|
+
), localStorage.setItem("isGuest", r ? "true" : "false"), s.data;
|
|
150
150
|
} catch (c) {
|
|
151
151
|
console.log(c);
|
|
152
152
|
}
|