@zango-core/crm-framework 0.2.0 → 0.2.1

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.
@@ -10284,16 +10284,19 @@ class Sc {
10284
10284
  const t = window.fetch, r = this;
10285
10285
  window.fetch = async (...a) => {
10286
10286
  try {
10287
- const [i, c = {}] = a, d = Date.now().toString(), l = new Headers(c.headers || {});
10288
- l.set("X-Client-Timestamp", d), l.set(
10287
+ const [i, c = {}] = a, d = typeof i == "string" ? i : i.toString();
10288
+ if (d.startsWith("http") && !d.startsWith(window.location.origin))
10289
+ return await t(i, c);
10290
+ const u = Date.now().toString(), p = new Headers(c.headers || {});
10291
+ p.set("X-Client-Timestamp", u), p.set(
10289
10292
  "X-Client-Timezone",
10290
10293
  Intl.DateTimeFormat().resolvedOptions().timeZone
10291
- ), l.set("X-Client-Platform", navigator.platform);
10292
- const u = {
10294
+ ), p.set("X-Client-Platform", navigator.platform);
10295
+ const g = {
10293
10296
  ...c,
10294
- headers: l
10295
- }, p = await t(i, u), g = window.location.origin + "/login/";
10296
- return p.url && p.url === g && r.handleRedirect("/app/login/"), p;
10297
+ headers: p
10298
+ }, m = await t(i, g), f = window.location.origin + "/login/";
10299
+ return m.url && m.url === f && r.handleRedirect("/app/login/"), m;
10297
10300
  } catch (i) {
10298
10301
  throw i;
10299
10302
  }
@@ -10302,13 +10305,17 @@ class Sc {
10302
10305
  XMLHttpRequest.prototype.open = function(...a) {
10303
10306
  return this._requestUrl = a[1], s.apply(this, a);
10304
10307
  }, XMLHttpRequest.prototype.send = function(...a) {
10305
- const i = this, c = Date.now().toString();
10306
- return this.setRequestHeader("X-Client-Timestamp", c), this.setRequestHeader("X-User-Agent", navigator.userAgent), this.setRequestHeader(
10307
- "X-Client-Timezone",
10308
- Intl.DateTimeFormat().resolvedOptions().timeZone
10309
- ), this.setRequestHeader("X-Client-Platform", navigator.platform), this.addEventListener("load", function() {
10310
- const d = i.responseURL || i._requestUrl, l = window.location.origin + "/login/";
10311
- d && d === l && r.handleRedirect("/app/login/");
10308
+ const i = this, c = this._requestUrl || "";
10309
+ if (!(c.startsWith("http") && !c.startsWith(window.location.origin))) {
10310
+ const l = Date.now().toString();
10311
+ this.setRequestHeader("X-Client-Timestamp", l), this.setRequestHeader("X-User-Agent", navigator.userAgent), this.setRequestHeader(
10312
+ "X-Client-Timezone",
10313
+ Intl.DateTimeFormat().resolvedOptions().timeZone
10314
+ ), this.setRequestHeader("X-Client-Platform", navigator.platform);
10315
+ }
10316
+ return this.addEventListener("load", function() {
10317
+ const l = i.responseURL || i._requestUrl, u = window.location.origin + "/login/";
10318
+ l && l === u && r.handleRedirect("/app/login/");
10312
10319
  }), o.apply(this, a);
10313
10320
  };
10314
10321
  }