ui.shipaid.com 0.3.41 → 0.3.43
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/widget.es.js +299 -327
- package/dist/widget.iife.js +21 -21
- package/dist/widget.umd.js +18 -18
- package/dist-types/widget/src/shipaid-widget.d.ts +4 -1
- package/dist-types/widget/src/utils/fetch_interceptor.d.ts +3 -0
- package/dist-types/widget/src/utils/fetch_interceptor.test.d.ts +1 -0
- package/package.json +8 -3
- /package/dist/{de-7465ac1a.js → de-VKiubByf.js} +0 -0
- /package/dist/{es-ffafb8a6.js → es-gSoKNDaV.js} +0 -0
- /package/dist/{fr-ef63017f.js → fr-B4wOlIrE.js} +0 -0
- /package/dist/{it-108c90b9.js → it-1qLegqAS.js} +0 -0
- /package/dist/{pt-b1b6ec67.js → pt-CeUvCcpv.js} +0 -0
package/dist/widget.es.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
function calculateProtectionTotal(store, protectionProduct, cart) {
|
|
2
2
|
var _a, _b;
|
|
3
|
-
if (!store)
|
|
4
|
-
|
|
5
|
-
if (!
|
|
6
|
-
throw new Error("Missing protectionProduct.");
|
|
7
|
-
if (!cart)
|
|
8
|
-
throw new Error("Missing Shopify cart.");
|
|
3
|
+
if (!store) throw new Error("Missing store settings.");
|
|
4
|
+
if (!protectionProduct) throw new Error("Missing protectionProduct.");
|
|
5
|
+
if (!cart) throw new Error("Missing Shopify cart.");
|
|
9
6
|
const settings = store == null ? void 0 : store.protectionSettings;
|
|
10
7
|
if (!settings) {
|
|
11
8
|
throw new Error("Tried to find protection variant, but protection settings for this store are missing.");
|
|
@@ -32,23 +29,18 @@ function calculateProtectionTotal(store, protectionProduct, cart) {
|
|
|
32
29
|
})) ?? [];
|
|
33
30
|
const protectionVariantsInCartTotal = protectionVariantsInCart.reduce((total, item) => total + item.final_line_price, 0);
|
|
34
31
|
const cartTotal = itemTotal - protectionVariantsInCartTotal;
|
|
35
|
-
if (cartTotal === 0)
|
|
36
|
-
return cartTotal;
|
|
32
|
+
if (cartTotal === 0) return cartTotal;
|
|
37
33
|
if (settings.protectionType === "FIXED") {
|
|
38
|
-
if (typeof settings.defaultFee !== "number")
|
|
39
|
-
|
|
40
|
-
if (!((_b = settings.rules) == null ? void 0 : _b.length))
|
|
41
|
-
return settings.defaultFee;
|
|
34
|
+
if (typeof settings.defaultFee !== "number") throw new Error("Missing default fee amount.");
|
|
35
|
+
if (!((_b = settings.rules) == null ? void 0 : _b.length)) return settings.defaultFee;
|
|
42
36
|
const formattedCartTotal = cartTotal / 100;
|
|
43
37
|
const sortedRules = settings.rules.sort((a2, b) => {
|
|
44
|
-
if (!a2.rangeLower || !b.rangeLower)
|
|
45
|
-
return 0;
|
|
38
|
+
if (!a2.rangeLower || !b.rangeLower) return 0;
|
|
46
39
|
return a2.rangeLower - b.rangeLower;
|
|
47
40
|
});
|
|
48
41
|
const rule = sortedRules.find((rule2) => {
|
|
49
42
|
const lower = Boolean(rule2.rangeLower && rule2.rangeLower < formattedCartTotal);
|
|
50
|
-
if (!rule2.rangeUpper)
|
|
51
|
-
return lower;
|
|
43
|
+
if (!rule2.rangeUpper) return lower;
|
|
52
44
|
return lower && rule2.rangeUpper >= formattedCartTotal;
|
|
53
45
|
});
|
|
54
46
|
return typeof (rule == null ? void 0 : rule.fee) === "number" ? rule.fee : settings.defaultFee;
|
|
@@ -66,8 +58,7 @@ function findProtectionVariant(store, protectionProduct, protectionFee) {
|
|
|
66
58
|
throw new Error("Missing product and variants from protection settings.");
|
|
67
59
|
}
|
|
68
60
|
const formattedVariants = protectionProduct == null ? void 0 : protectionProduct.variants.flatMap((variant) => {
|
|
69
|
-
if (!(variant == null ? void 0 : variant.price))
|
|
70
|
-
return [];
|
|
61
|
+
if (!(variant == null ? void 0 : variant.price)) return [];
|
|
71
62
|
const formattedPrice = Number(variant.price);
|
|
72
63
|
return [{ ...variant, formattedPrice }];
|
|
73
64
|
}).sort((a2, b) => a2.formattedPrice - b.formattedPrice);
|
|
@@ -122,8 +113,7 @@ null != (null === (n$6 = window.HTMLSlotElement) || void 0 === n$6 ? void 0 : n$
|
|
|
122
113
|
const t$2 = window, e$5 = t$2.ShadowRoot && (void 0 === t$2.ShadyCSS || t$2.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$4 = Symbol(), n$5 = /* @__PURE__ */ new WeakMap();
|
|
123
114
|
let o$4 = class o {
|
|
124
115
|
constructor(t2, e2, n2) {
|
|
125
|
-
if (this._$cssResult$ = true, n2 !== s$4)
|
|
126
|
-
throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
116
|
+
if (this._$cssResult$ = true, n2 !== s$4) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
127
117
|
this.cssText = t2, this.t = e2;
|
|
128
118
|
}
|
|
129
119
|
get styleSheet() {
|
|
@@ -141,10 +131,8 @@ let o$4 = class o {
|
|
|
141
131
|
};
|
|
142
132
|
const r$3 = (t2) => new o$4("string" == typeof t2 ? t2 : t2 + "", void 0, s$4), i$2 = (t2, ...e2) => {
|
|
143
133
|
const n2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s3, n3) => e3 + ((t3) => {
|
|
144
|
-
if (true === t3._$cssResult$)
|
|
145
|
-
|
|
146
|
-
if ("number" == typeof t3)
|
|
147
|
-
return t3;
|
|
134
|
+
if (true === t3._$cssResult$) return t3.cssText;
|
|
135
|
+
if ("number" == typeof t3) return t3;
|
|
148
136
|
throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
149
137
|
})(s3) + t2[n3 + 1], t2[0]);
|
|
150
138
|
return new o$4(n2, t2, s$4);
|
|
@@ -155,8 +143,7 @@ const r$3 = (t2) => new o$4("string" == typeof t2 ? t2 : t2 + "", void 0, s$4),
|
|
|
155
143
|
});
|
|
156
144
|
}, c$2 = e$5 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
|
|
157
145
|
let e2 = "";
|
|
158
|
-
for (const s3 of t3.cssRules)
|
|
159
|
-
e2 += s3.cssText;
|
|
146
|
+
for (const s3 of t3.cssRules) e2 += s3.cssText;
|
|
160
147
|
return r$3(e2);
|
|
161
148
|
})(t2) : t2;
|
|
162
149
|
/**
|
|
@@ -228,14 +215,12 @@ let u$1 = class u extends HTMLElement {
|
|
|
228
215
|
return this.elementProperties.get(t2) || l$3;
|
|
229
216
|
}
|
|
230
217
|
static finalize() {
|
|
231
|
-
if (this.hasOwnProperty(d$1))
|
|
232
|
-
return false;
|
|
218
|
+
if (this.hasOwnProperty(d$1)) return false;
|
|
233
219
|
this[d$1] = true;
|
|
234
220
|
const t2 = Object.getPrototypeOf(this);
|
|
235
221
|
if (t2.finalize(), void 0 !== t2.h && (this.h = [...t2.h]), this.elementProperties = new Map(t2.elementProperties), this._$Ev = /* @__PURE__ */ new Map(), this.hasOwnProperty("properties")) {
|
|
236
222
|
const t3 = this.properties, i2 = [...Object.getOwnPropertyNames(t3), ...Object.getOwnPropertySymbols(t3)];
|
|
237
|
-
for (const s3 of i2)
|
|
238
|
-
this.createProperty(s3, t3[s3]);
|
|
223
|
+
for (const s3 of i2) this.createProperty(s3, t3[s3]);
|
|
239
224
|
}
|
|
240
225
|
return this.elementStyles = this.finalizeStyles(this.styles), true;
|
|
241
226
|
}
|
|
@@ -243,10 +228,8 @@ let u$1 = class u extends HTMLElement {
|
|
|
243
228
|
const s3 = [];
|
|
244
229
|
if (Array.isArray(i2)) {
|
|
245
230
|
const e2 = new Set(i2.flat(1 / 0).reverse());
|
|
246
|
-
for (const i3 of e2)
|
|
247
|
-
|
|
248
|
-
} else
|
|
249
|
-
void 0 !== i2 && s3.push(c$2(i2));
|
|
231
|
+
for (const i3 of e2) s3.unshift(c$2(i3));
|
|
232
|
+
} else void 0 !== i2 && s3.push(c$2(i2));
|
|
250
233
|
return s3;
|
|
251
234
|
}
|
|
252
235
|
static _$Ep(t2, i2) {
|
|
@@ -329,8 +312,7 @@ let u$1 = class u extends HTMLElement {
|
|
|
329
312
|
}
|
|
330
313
|
performUpdate() {
|
|
331
314
|
var t2;
|
|
332
|
-
if (!this.isUpdatePending)
|
|
333
|
-
return;
|
|
315
|
+
if (!this.isUpdatePending) return;
|
|
334
316
|
this.hasUpdated, this._$Ei && (this._$Ei.forEach((t3, i3) => this[i3] = t3), this._$Ei = void 0);
|
|
335
317
|
let i2 = false;
|
|
336
318
|
const s3 = this._$AL;
|
|
@@ -383,8 +365,7 @@ var t$1;
|
|
|
383
365
|
const i$1 = window, s$2 = i$1.trustedTypes, e$3 = s$2 ? s$2.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, o$2 = "$lit$", n$3 = `lit$${(Math.random() + "").slice(9)}$`, l$2 = "?" + n$3, h$1 = `<${l$2}>`, r$1 = document, u2 = () => r$1.createComment(""), d = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, c$1 = Array.isArray, v = (t2) => c$1(t2) || "function" == typeof (null == t2 ? void 0 : t2[Symbol.iterator]), a = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, _ = /-->/g, m = />/g, p = RegExp(`>|${a}(?:([^\\s"'>=/]+)(${a}*=${a}*(?:[^
|
|
384
366
|
\f\r"'\`<>=]|("|')|))|$)`, "g"), g = /'/g, $ = /"/g, y = /^(?:script|style|textarea|title)$/i, w = (t2) => (i2, ...s3) => ({ _$litType$: t2, strings: i2, values: s3 }), x = w(1), T = Symbol.for("lit-noChange"), A = Symbol.for("lit-nothing"), E = /* @__PURE__ */ new WeakMap(), C = r$1.createTreeWalker(r$1, 129, null, false);
|
|
385
367
|
function P(t2, i2) {
|
|
386
|
-
if (!Array.isArray(t2) || !t2.hasOwnProperty("raw"))
|
|
387
|
-
throw Error("invalid template strings array");
|
|
368
|
+
if (!Array.isArray(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
388
369
|
return void 0 !== e$3 ? e$3.createHTML(i2) : i2;
|
|
389
370
|
}
|
|
390
371
|
const V = (t2, i2) => {
|
|
@@ -393,8 +374,7 @@ const V = (t2, i2) => {
|
|
|
393
374
|
for (let i3 = 0; i3 < s3; i3++) {
|
|
394
375
|
const s4 = t2[i3];
|
|
395
376
|
let d2, c2, v2 = -1, a2 = 0;
|
|
396
|
-
for (; a2 < s4.length && (u3.lastIndex = a2, c2 = u3.exec(s4), null !== c2); )
|
|
397
|
-
a2 = u3.lastIndex, u3 === f ? "!--" === c2[1] ? u3 = _ : void 0 !== c2[1] ? u3 = m : void 0 !== c2[2] ? (y.test(c2[2]) && (l2 = RegExp("</" + c2[2], "g")), u3 = p) : void 0 !== c2[3] && (u3 = p) : u3 === p ? ">" === c2[0] ? (u3 = null != l2 ? l2 : f, v2 = -1) : void 0 === c2[1] ? v2 = -2 : (v2 = u3.lastIndex - c2[2].length, d2 = c2[1], u3 = void 0 === c2[3] ? p : '"' === c2[3] ? $ : g) : u3 === $ || u3 === g ? u3 = p : u3 === _ || u3 === m ? u3 = f : (u3 = p, l2 = void 0);
|
|
377
|
+
for (; a2 < s4.length && (u3.lastIndex = a2, c2 = u3.exec(s4), null !== c2); ) a2 = u3.lastIndex, u3 === f ? "!--" === c2[1] ? u3 = _ : void 0 !== c2[1] ? u3 = m : void 0 !== c2[2] ? (y.test(c2[2]) && (l2 = RegExp("</" + c2[2], "g")), u3 = p) : void 0 !== c2[3] && (u3 = p) : u3 === p ? ">" === c2[0] ? (u3 = null != l2 ? l2 : f, v2 = -1) : void 0 === c2[1] ? v2 = -2 : (v2 = u3.lastIndex - c2[2].length, d2 = c2[1], u3 = void 0 === c2[3] ? p : '"' === c2[3] ? $ : g) : u3 === $ || u3 === g ? u3 = p : u3 === _ || u3 === m ? u3 = f : (u3 = p, l2 = void 0);
|
|
398
378
|
const w2 = u3 === p && t2[i3 + 1].startsWith("/>") ? " " : "";
|
|
399
379
|
r2 += u3 === f ? s4 + h$1 : v2 >= 0 ? (e2.push(d2), s4.slice(0, v2) + o$2 + s4.slice(v2) + n$3 + w2) : s4 + n$3 + (-2 === v2 ? (e2.push(void 0), i3) : w2);
|
|
400
380
|
}
|
|
@@ -414,35 +394,28 @@ class N {
|
|
|
414
394
|
if (1 === h2.nodeType) {
|
|
415
395
|
if (h2.hasAttributes()) {
|
|
416
396
|
const t3 = [];
|
|
417
|
-
for (const i3 of h2.getAttributeNames())
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
for (const i3 of t3)
|
|
427
|
-
h2.removeAttribute(i3);
|
|
397
|
+
for (const i3 of h2.getAttributeNames()) if (i3.endsWith(o$2) || i3.startsWith(n$3)) {
|
|
398
|
+
const s3 = f2[d2++];
|
|
399
|
+
if (t3.push(i3), void 0 !== s3) {
|
|
400
|
+
const t4 = h2.getAttribute(s3.toLowerCase() + o$2).split(n$3), i4 = /([.?@])?(.*)/.exec(s3);
|
|
401
|
+
v2.push({ type: 1, index: r2, name: i4[2], strings: t4, ctor: "." === i4[1] ? H : "?" === i4[1] ? L : "@" === i4[1] ? z : k });
|
|
402
|
+
} else v2.push({ type: 6, index: r2 });
|
|
403
|
+
}
|
|
404
|
+
for (const i3 of t3) h2.removeAttribute(i3);
|
|
428
405
|
}
|
|
429
406
|
if (y.test(h2.tagName)) {
|
|
430
407
|
const t3 = h2.textContent.split(n$3), i3 = t3.length - 1;
|
|
431
408
|
if (i3 > 0) {
|
|
432
409
|
h2.textContent = s$2 ? s$2.emptyScript : "";
|
|
433
|
-
for (let s3 = 0; s3 < i3; s3++)
|
|
434
|
-
h2.append(t3[s3], u2()), C.nextNode(), v2.push({ type: 2, index: ++r2 });
|
|
410
|
+
for (let s3 = 0; s3 < i3; s3++) h2.append(t3[s3], u2()), C.nextNode(), v2.push({ type: 2, index: ++r2 });
|
|
435
411
|
h2.append(t3[i3], u2());
|
|
436
412
|
}
|
|
437
413
|
}
|
|
438
|
-
} else if (8 === h2.nodeType)
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
for (; -1 !== (t3 = h2.data.indexOf(n$3, t3 + 1)); )
|
|
444
|
-
v2.push({ type: 7, index: r2 }), t3 += n$3.length - 1;
|
|
445
|
-
}
|
|
414
|
+
} else if (8 === h2.nodeType) if (h2.data === l$2) v2.push({ type: 2, index: r2 });
|
|
415
|
+
else {
|
|
416
|
+
let t3 = -1;
|
|
417
|
+
for (; -1 !== (t3 = h2.data.indexOf(n$3, t3 + 1)); ) v2.push({ type: 7, index: r2 }), t3 += n$3.length - 1;
|
|
418
|
+
}
|
|
446
419
|
r2++;
|
|
447
420
|
}
|
|
448
421
|
}
|
|
@@ -453,8 +426,7 @@ class N {
|
|
|
453
426
|
}
|
|
454
427
|
function S(t2, i2, s3 = t2, e2) {
|
|
455
428
|
var o3, n2, l2, h2;
|
|
456
|
-
if (i2 === T)
|
|
457
|
-
return i2;
|
|
429
|
+
if (i2 === T) return i2;
|
|
458
430
|
let r2 = void 0 !== e2 ? null === (o3 = s3._$Co) || void 0 === o3 ? void 0 : o3[e2] : s3._$Cl;
|
|
459
431
|
const u3 = d(i2) ? void 0 : i2._$litDirective$;
|
|
460
432
|
return (null == r2 ? void 0 : r2.constructor) !== u3 && (null === (n2 = null == r2 ? void 0 : r2._$AO) || void 0 === n2 || n2.call(r2, false), void 0 === u3 ? r2 = void 0 : (r2 = new u3(t2), r2._$AT(t2, s3, e2)), void 0 !== e2 ? (null !== (l2 = (h2 = s3)._$Co) && void 0 !== l2 ? l2 : h2._$Co = [])[e2] = r2 : s3._$Cl = r2), void 0 !== r2 && (i2 = S(t2, r2._$AS(t2, i2.values), r2, e2)), i2;
|
|
@@ -485,8 +457,7 @@ class M {
|
|
|
485
457
|
}
|
|
486
458
|
v(t2) {
|
|
487
459
|
let i2 = 0;
|
|
488
|
-
for (const s3 of this._$AV)
|
|
489
|
-
void 0 !== s3 && (void 0 !== s3.strings ? (s3._$AI(t2, s3, i2), i2 += s3.strings.length - 2) : s3._$AI(t2[i2])), i2++;
|
|
460
|
+
for (const s3 of this._$AV) void 0 !== s3 && (void 0 !== s3.strings ? (s3._$AI(t2, s3, i2), i2 += s3.strings.length - 2) : s3._$AI(t2[i2])), i2++;
|
|
490
461
|
}
|
|
491
462
|
}
|
|
492
463
|
class R {
|
|
@@ -524,8 +495,7 @@ class R {
|
|
|
524
495
|
g(t2) {
|
|
525
496
|
var i2;
|
|
526
497
|
const { values: s3, _$litType$: e2 } = t2, o3 = "number" == typeof e2 ? this._$AC(t2) : (void 0 === e2.el && (e2.el = N.createElement(P(e2.h, e2.h[0]), this.options)), e2);
|
|
527
|
-
if ((null === (i2 = this._$AH) || void 0 === i2 ? void 0 : i2._$AD) === o3)
|
|
528
|
-
this._$AH.v(s3);
|
|
498
|
+
if ((null === (i2 = this._$AH) || void 0 === i2 ? void 0 : i2._$AD) === o3) this._$AH.v(s3);
|
|
529
499
|
else {
|
|
530
500
|
const t3 = new M(o3, this), i3 = t3.u(this.options);
|
|
531
501
|
t3.v(s3), this.$(i3), this._$AH = t3;
|
|
@@ -539,8 +509,7 @@ class R {
|
|
|
539
509
|
c$1(this._$AH) || (this._$AH = [], this._$AR());
|
|
540
510
|
const i2 = this._$AH;
|
|
541
511
|
let s3, e2 = 0;
|
|
542
|
-
for (const o3 of t2)
|
|
543
|
-
e2 === i2.length ? i2.push(s3 = new R(this.k(u2()), this.k(u2()), this, this.options)) : s3 = i2[e2], s3._$AI(o3), e2++;
|
|
512
|
+
for (const o3 of t2) e2 === i2.length ? i2.push(s3 = new R(this.k(u2()), this.k(u2()), this, this.options)) : s3 = i2[e2], s3._$AI(o3), e2++;
|
|
544
513
|
e2 < i2.length && (this._$AR(s3 && s3._$AB.nextSibling, e2), i2.length = e2);
|
|
545
514
|
}
|
|
546
515
|
_$AR(t2 = this._$AA.nextSibling, i2) {
|
|
@@ -568,13 +537,11 @@ class k {
|
|
|
568
537
|
_$AI(t2, i2 = this, s3, e2) {
|
|
569
538
|
const o3 = this.strings;
|
|
570
539
|
let n2 = false;
|
|
571
|
-
if (void 0 === o3)
|
|
572
|
-
t2 = S(this, t2, i2, 0), n2 = !d(t2) || t2 !== this._$AH && t2 !== T, n2 && (this._$AH = t2);
|
|
540
|
+
if (void 0 === o3) t2 = S(this, t2, i2, 0), n2 = !d(t2) || t2 !== this._$AH && t2 !== T, n2 && (this._$AH = t2);
|
|
573
541
|
else {
|
|
574
542
|
const e3 = t2;
|
|
575
543
|
let l2, h2;
|
|
576
|
-
for (t2 = o3[0], l2 = 0; l2 < o3.length - 1; l2++)
|
|
577
|
-
h2 = S(this, e3[s3 + l2], i2, l2), h2 === T && (h2 = this._$AH[l2]), n2 || (n2 = !d(h2) || h2 !== this._$AH[l2]), h2 === A ? t2 = A : t2 !== A && (t2 += (null != h2 ? h2 : "") + o3[l2 + 1]), this._$AH[l2] = h2;
|
|
544
|
+
for (t2 = o3[0], l2 = 0; l2 < o3.length - 1; l2++) h2 = S(this, e3[s3 + l2], i2, l2), h2 === T && (h2 = this._$AH[l2]), n2 || (n2 = !d(h2) || h2 !== this._$AH[l2]), h2 === A ? t2 = A : t2 !== A && (t2 += (null != h2 ? h2 : "") + o3[l2 + 1]), this._$AH[l2] = h2;
|
|
578
545
|
}
|
|
579
546
|
n2 && !e2 && this.j(t2);
|
|
580
547
|
}
|
|
@@ -605,8 +572,7 @@ class z extends k {
|
|
|
605
572
|
}
|
|
606
573
|
_$AI(t2, i2 = this) {
|
|
607
574
|
var s3;
|
|
608
|
-
if ((t2 = null !== (s3 = S(this, t2, i2, 0)) && void 0 !== s3 ? s3 : A) === T)
|
|
609
|
-
return;
|
|
575
|
+
if ((t2 = null !== (s3 = S(this, t2, i2, 0)) && void 0 !== s3 ? s3 : A) === T) return;
|
|
610
576
|
const e2 = this._$AH, o3 = t2 === A && e2 !== A || t2.capture !== e2.capture || t2.once !== e2.once || t2.passive !== e2.passive, n2 = t2 !== A && (e2 === A || o3);
|
|
611
577
|
o3 && this.element.removeEventListener(this.name, this, e2), n2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
|
|
612
578
|
}
|
|
@@ -763,25 +729,20 @@ const e$1 = (o3) => void 0 === o3.strings;
|
|
|
763
729
|
const s2 = (i2, t2) => {
|
|
764
730
|
var e2, o3;
|
|
765
731
|
const r2 = i2._$AN;
|
|
766
|
-
if (void 0 === r2)
|
|
767
|
-
|
|
768
|
-
for (const i3 of r2)
|
|
769
|
-
null === (o3 = (e2 = i3)._$AO) || void 0 === o3 || o3.call(e2, t2, false), s2(i3, t2);
|
|
732
|
+
if (void 0 === r2) return false;
|
|
733
|
+
for (const i3 of r2) null === (o3 = (e2 = i3)._$AO) || void 0 === o3 || o3.call(e2, t2, false), s2(i3, t2);
|
|
770
734
|
return true;
|
|
771
735
|
}, o2 = (i2) => {
|
|
772
736
|
let t2, e2;
|
|
773
737
|
do {
|
|
774
|
-
if (void 0 === (t2 = i2._$AM))
|
|
775
|
-
break;
|
|
738
|
+
if (void 0 === (t2 = i2._$AM)) break;
|
|
776
739
|
e2 = t2._$AN, e2.delete(i2), i2 = t2;
|
|
777
740
|
} while (0 === (null == e2 ? void 0 : e2.size));
|
|
778
741
|
}, r = (i2) => {
|
|
779
742
|
for (let t2; t2 = i2._$AM; i2 = t2) {
|
|
780
743
|
let e2 = t2._$AN;
|
|
781
|
-
if (void 0 === e2)
|
|
782
|
-
|
|
783
|
-
else if (e2.has(i2))
|
|
784
|
-
break;
|
|
744
|
+
if (void 0 === e2) t2._$AN = e2 = /* @__PURE__ */ new Set();
|
|
745
|
+
else if (e2.has(i2)) break;
|
|
785
746
|
e2.add(i2), l(t2);
|
|
786
747
|
}
|
|
787
748
|
};
|
|
@@ -790,15 +751,9 @@ function n$1(i2) {
|
|
|
790
751
|
}
|
|
791
752
|
function h(i2, t2 = false, e2 = 0) {
|
|
792
753
|
const r2 = this._$AH, n2 = this._$AN;
|
|
793
|
-
if (void 0 !== n2 && 0 !== n2.size)
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
for (let i3 = e2; i3 < r2.length; i3++)
|
|
797
|
-
s2(r2[i3], false), o2(r2[i3]);
|
|
798
|
-
else
|
|
799
|
-
null != r2 && (s2(r2, false), o2(r2));
|
|
800
|
-
else
|
|
801
|
-
s2(this, i2);
|
|
754
|
+
if (void 0 !== n2 && 0 !== n2.size) if (t2) if (Array.isArray(r2)) for (let i3 = e2; i3 < r2.length; i3++) s2(r2[i3], false), o2(r2[i3]);
|
|
755
|
+
else null != r2 && (s2(r2, false), o2(r2));
|
|
756
|
+
else s2(this, i2);
|
|
802
757
|
}
|
|
803
758
|
const l = (i2) => {
|
|
804
759
|
var t$12, s3, o3, r2;
|
|
@@ -816,8 +771,7 @@ class c extends i {
|
|
|
816
771
|
i2 !== this.isConnected && (this.isConnected = i2, i2 ? null === (e2 = this.reconnected) || void 0 === e2 || e2.call(this) : null === (r2 = this.disconnected) || void 0 === r2 || r2.call(this)), t2 && (s2(this, i2), o2(this));
|
|
817
772
|
}
|
|
818
773
|
setValue(t2) {
|
|
819
|
-
if (e$1(this._$Ct))
|
|
820
|
-
this._$Ct._$AI(t2, this);
|
|
774
|
+
if (e$1(this._$Ct)) this._$Ct._$AI(t2, this);
|
|
821
775
|
else {
|
|
822
776
|
const i2 = [...this._$Ct._$AH];
|
|
823
777
|
i2[this._$Ci] = t2, this._$Ct._$AI(i2, this, 0);
|
|
@@ -893,18 +847,13 @@ const translate = e$2(TranslateDirective);
|
|
|
893
847
|
*/
|
|
894
848
|
class e extends i {
|
|
895
849
|
constructor(i2) {
|
|
896
|
-
if (super(i2), this.et = A, i2.type !== t.CHILD)
|
|
897
|
-
throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
850
|
+
if (super(i2), this.et = A, i2.type !== t.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
898
851
|
}
|
|
899
852
|
render(r2) {
|
|
900
|
-
if (r2 === A || null == r2)
|
|
901
|
-
|
|
902
|
-
if (r2
|
|
903
|
-
|
|
904
|
-
if ("string" != typeof r2)
|
|
905
|
-
throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
906
|
-
if (r2 === this.et)
|
|
907
|
-
return this.ft;
|
|
853
|
+
if (r2 === A || null == r2) return this.ft = void 0, this.et = r2;
|
|
854
|
+
if (r2 === T) return r2;
|
|
855
|
+
if ("string" != typeof r2) throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
856
|
+
if (r2 === this.et) return this.ft;
|
|
908
857
|
this.et = r2;
|
|
909
858
|
const s3 = [r2];
|
|
910
859
|
return s3.raw = s3, this.ft = { _$litType$: this.constructor.resultType, strings: s3, values: [] };
|
|
@@ -921,8 +870,7 @@ function asUpdateableLitElement(element) {
|
|
|
921
870
|
const reservedKeyword = "__registered_effects";
|
|
922
871
|
function decorate(litElement) {
|
|
923
872
|
const decoratedLitElement = litElement;
|
|
924
|
-
if (decoratedLitElement[reservedKeyword])
|
|
925
|
-
return decoratedLitElement;
|
|
873
|
+
if (decoratedLitElement[reservedKeyword]) return decoratedLitElement;
|
|
926
874
|
const updateableLitLikeElement = asUpdateableLitElement(litElement);
|
|
927
875
|
const oldUpdated = updateableLitLikeElement.updated;
|
|
928
876
|
decoratedLitElement[reservedKeyword] = {
|
|
@@ -1484,17 +1432,15 @@ const BellIcon = x`
|
|
|
1484
1432
|
</svg>
|
|
1485
1433
|
`;
|
|
1486
1434
|
var __defProp$2 = Object.defineProperty;
|
|
1487
|
-
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
1488
1435
|
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
1489
|
-
var result =
|
|
1436
|
+
var result = void 0;
|
|
1490
1437
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1491
1438
|
if (decorator = decorators[i2])
|
|
1492
|
-
result =
|
|
1493
|
-
if (
|
|
1494
|
-
__defProp$2(target, key, result);
|
|
1439
|
+
result = decorator(target, key, result) || result;
|
|
1440
|
+
if (result) __defProp$2(target, key, result);
|
|
1495
1441
|
return result;
|
|
1496
1442
|
};
|
|
1497
|
-
class
|
|
1443
|
+
const _LearnMorePopup = class _LearnMorePopup extends s$1 {
|
|
1498
1444
|
constructor() {
|
|
1499
1445
|
super(...arguments);
|
|
1500
1446
|
this.active = false;
|
|
@@ -1566,11 +1512,12 @@ class LearnMorePopup extends s$1 {
|
|
|
1566
1512
|
<div class="blocker" @click=${this.handleClosePopup}></div>
|
|
1567
1513
|
`;
|
|
1568
1514
|
}
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1515
|
+
};
|
|
1516
|
+
_LearnMorePopup.styles = styles$2;
|
|
1517
|
+
let LearnMorePopup = _LearnMorePopup;
|
|
1571
1518
|
__decorateClass$2([
|
|
1572
1519
|
n$7({ type: Boolean, attribute: true })
|
|
1573
|
-
], LearnMorePopup.prototype, "active"
|
|
1520
|
+
], LearnMorePopup.prototype, "active");
|
|
1574
1521
|
if (!customElements.get("shipaid-popup-learn-more")) {
|
|
1575
1522
|
customElements.define("shipaid-popup-learn-more", LearnMorePopup);
|
|
1576
1523
|
}
|
|
@@ -1720,17 +1667,15 @@ const styles$1 = i$2`
|
|
|
1720
1667
|
}
|
|
1721
1668
|
`;
|
|
1722
1669
|
var __defProp$1 = Object.defineProperty;
|
|
1723
|
-
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
1724
1670
|
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
1725
|
-
var result =
|
|
1671
|
+
var result = void 0;
|
|
1726
1672
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1727
1673
|
if (decorator = decorators[i2])
|
|
1728
|
-
result =
|
|
1729
|
-
if (
|
|
1730
|
-
__defProp$1(target, key, result);
|
|
1674
|
+
result = decorator(target, key, result) || result;
|
|
1675
|
+
if (result) __defProp$1(target, key, result);
|
|
1731
1676
|
return result;
|
|
1732
1677
|
};
|
|
1733
|
-
class
|
|
1678
|
+
const _ConfirmationPopup = class _ConfirmationPopup extends s$1 {
|
|
1734
1679
|
constructor() {
|
|
1735
1680
|
super(...arguments);
|
|
1736
1681
|
this.active = false;
|
|
@@ -1770,11 +1715,12 @@ class ConfirmationPopup extends s$1 {
|
|
|
1770
1715
|
<div class="blocker" @click=${this.handleClosePopup}></div>
|
|
1771
1716
|
`;
|
|
1772
1717
|
}
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1718
|
+
};
|
|
1719
|
+
_ConfirmationPopup.styles = styles$1;
|
|
1720
|
+
let ConfirmationPopup = _ConfirmationPopup;
|
|
1775
1721
|
__decorateClass$1([
|
|
1776
1722
|
n$7({ type: Boolean, attribute: true })
|
|
1777
|
-
], ConfirmationPopup.prototype, "active"
|
|
1723
|
+
], ConfirmationPopup.prototype, "active");
|
|
1778
1724
|
if (!customElements.get("shipaid-popup-confirmation")) {
|
|
1779
1725
|
customElements.define("shipaid-popup-confirmation", ConfirmationPopup);
|
|
1780
1726
|
}
|
|
@@ -1982,22 +1928,42 @@ var Events = /* @__PURE__ */ ((Events2) => {
|
|
|
1982
1928
|
Events2["STATUS_UPDATE"] = "shipaid-protection-status";
|
|
1983
1929
|
return Events2;
|
|
1984
1930
|
})(Events || {});
|
|
1931
|
+
function interceptFetch(interceptor) {
|
|
1932
|
+
const originalFetch = window.fetch;
|
|
1933
|
+
let running = true;
|
|
1934
|
+
const _fetch = async (input, init) => {
|
|
1935
|
+
const promise = originalFetch(input, init);
|
|
1936
|
+
if (running) {
|
|
1937
|
+
try {
|
|
1938
|
+
await interceptor([input, init], promise);
|
|
1939
|
+
} catch (e2) {
|
|
1940
|
+
console.warn(e2);
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
return await promise;
|
|
1944
|
+
};
|
|
1945
|
+
window.fetch = _fetch;
|
|
1946
|
+
return () => {
|
|
1947
|
+
if (window.fetch === _fetch) {
|
|
1948
|
+
window.fetch = originalFetch;
|
|
1949
|
+
} else {
|
|
1950
|
+
running = false;
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1985
1954
|
var __defProp = Object.defineProperty;
|
|
1986
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1987
1955
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
1988
|
-
var result =
|
|
1956
|
+
var result = void 0;
|
|
1989
1957
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
1990
1958
|
if (decorator = decorators[i2])
|
|
1991
|
-
result =
|
|
1992
|
-
if (
|
|
1993
|
-
__defProp(target, key, result);
|
|
1959
|
+
result = decorator(target, key, result) || result;
|
|
1960
|
+
if (result) __defProp(target, key, result);
|
|
1994
1961
|
return result;
|
|
1995
1962
|
};
|
|
1996
1963
|
const runRequest = async (input, init) => {
|
|
1997
1964
|
try {
|
|
1998
1965
|
const response = await fetch(input, init);
|
|
1999
|
-
if (!response.ok)
|
|
2000
|
-
throw new Error(await response.text());
|
|
1966
|
+
if (!response.ok) throw new Error(await response.text());
|
|
2001
1967
|
const data = await response.json();
|
|
2002
1968
|
return data;
|
|
2003
1969
|
} catch (error) {
|
|
@@ -2033,22 +1999,21 @@ const SellinPlanGroupFromVariant = `query SellingPlanFromVariant($store: String!
|
|
|
2033
1999
|
sellingPlanFromVariant(input: {store: $store, variantId: $variantId })
|
|
2034
2000
|
}`;
|
|
2035
2001
|
const langFiles = /* @__PURE__ */ Object.assign({
|
|
2036
|
-
"./lang/de.json": () => import("./de-
|
|
2002
|
+
"./lang/de.json": () => import("./de-VKiubByf.js").then((m2) => m2["default"]),
|
|
2037
2003
|
"./lang/en.json": () => Promise.resolve().then(() => en).then((m2) => m2["default"]),
|
|
2038
|
-
"./lang/es.json": () => import("./es-
|
|
2039
|
-
"./lang/fr.json": () => import("./fr-
|
|
2040
|
-
"./lang/it.json": () => import("./it-
|
|
2041
|
-
"./lang/pt.json": () => import("./pt-
|
|
2004
|
+
"./lang/es.json": () => import("./es-gSoKNDaV.js").then((m2) => m2["default"]),
|
|
2005
|
+
"./lang/fr.json": () => import("./fr-B4wOlIrE.js").then((m2) => m2["default"]),
|
|
2006
|
+
"./lang/it.json": () => import("./it-1qLegqAS.js").then((m2) => m2["default"]),
|
|
2007
|
+
"./lang/pt.json": () => import("./pt-CeUvCcpv.js").then((m2) => m2["default"])
|
|
2042
2008
|
});
|
|
2043
2009
|
registerTranslateConfig({
|
|
2044
2010
|
loader: async (lang) => {
|
|
2045
|
-
if (lang === "en")
|
|
2046
|
-
return defaultLangFile;
|
|
2011
|
+
if (lang === "en") return defaultLangFile;
|
|
2047
2012
|
const fileImport = Reflect.get(langFiles, `./lang/${lang}.json`);
|
|
2048
2013
|
return fileImport ? await fileImport() : defaultLangFile;
|
|
2049
2014
|
}
|
|
2050
2015
|
});
|
|
2051
|
-
class
|
|
2016
|
+
const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
2052
2017
|
constructor() {
|
|
2053
2018
|
var _a, _b, _c;
|
|
2054
2019
|
super(...arguments);
|
|
@@ -2069,6 +2034,8 @@ class ShipAidWidget extends s$1 {
|
|
|
2069
2034
|
this._shouldShowWidget = false;
|
|
2070
2035
|
this._hasProtectionInCart = false;
|
|
2071
2036
|
this.hasLoadedStrings = false;
|
|
2037
|
+
this.fetchInterceptorCleanup = () => {
|
|
2038
|
+
};
|
|
2072
2039
|
this.intervalId = 0;
|
|
2073
2040
|
this._state = {
|
|
2074
2041
|
loading: false,
|
|
@@ -2080,7 +2047,7 @@ class ShipAidWidget extends s$1 {
|
|
|
2080
2047
|
get: (url) => runRequest(url),
|
|
2081
2048
|
post: (url, body) => runRequest(url, {
|
|
2082
2049
|
method: "POST",
|
|
2083
|
-
headers: { "Content-Type": "application/json" },
|
|
2050
|
+
headers: { "Content-Type": "application/json", "X-ShipAid": "1" },
|
|
2084
2051
|
body: JSON.stringify(body)
|
|
2085
2052
|
})
|
|
2086
2053
|
};
|
|
@@ -2099,10 +2066,8 @@ class ShipAidWidget extends s$1 {
|
|
|
2099
2066
|
}
|
|
2100
2067
|
/** Getter to check if we should refresh the page or not */
|
|
2101
2068
|
get shouldRefreshOnUpdate() {
|
|
2102
|
-
if (this.disablePolling)
|
|
2103
|
-
|
|
2104
|
-
if (this.disableRefresh)
|
|
2105
|
-
return false;
|
|
2069
|
+
if (this.disablePolling) return false;
|
|
2070
|
+
if (this.disableRefresh) return false;
|
|
2106
2071
|
return true;
|
|
2107
2072
|
}
|
|
2108
2073
|
/** Getter to check whether to show the widget or not */
|
|
@@ -2136,16 +2101,13 @@ class ShipAidWidget extends s$1 {
|
|
|
2136
2101
|
);
|
|
2137
2102
|
}
|
|
2138
2103
|
_handleRefreshCart() {
|
|
2139
|
-
if (this.refreshCart)
|
|
2140
|
-
return window.location.reload();
|
|
2104
|
+
if (this.refreshCart) return window.location.reload();
|
|
2141
2105
|
}
|
|
2142
2106
|
/** Handle cart or page refreshes */
|
|
2143
2107
|
async _handleRefresh(input) {
|
|
2144
2108
|
const isCart = Reflect.has(input, "items");
|
|
2145
|
-
if (this.shouldRefreshOnUpdate)
|
|
2146
|
-
|
|
2147
|
-
if (!isCart)
|
|
2148
|
-
await this.updateCart();
|
|
2109
|
+
if (this.shouldRefreshOnUpdate) return window.location.reload();
|
|
2110
|
+
if (!isCart) await this.updateCart();
|
|
2149
2111
|
this._dispatchEvent(Events.STATUS_UPDATE, {
|
|
2150
2112
|
protection: this._hasProtectionInCart,
|
|
2151
2113
|
cart: isCart ? input : this._cart,
|
|
@@ -2154,12 +2116,9 @@ class ShipAidWidget extends s$1 {
|
|
|
2154
2116
|
}
|
|
2155
2117
|
/** Given the current order, it calculates the protection total according to the store protection settings. */
|
|
2156
2118
|
async calculateProtectionTotal(cart) {
|
|
2157
|
-
if (!cart)
|
|
2158
|
-
|
|
2159
|
-
if (!
|
|
2160
|
-
throw new Error("Could not fetch cart.");
|
|
2161
|
-
if (!this._store)
|
|
2162
|
-
throw new Error("Missing ShipAid store");
|
|
2119
|
+
if (!cart) cart = await this._fetchCart();
|
|
2120
|
+
if (!cart) throw new Error("Could not fetch cart.");
|
|
2121
|
+
if (!this._store) throw new Error("Missing ShipAid store");
|
|
2163
2122
|
if (!this._protectionProduct) {
|
|
2164
2123
|
throw new Error("Missing Shopify protection product");
|
|
2165
2124
|
}
|
|
@@ -2174,8 +2133,7 @@ class ShipAidWidget extends s$1 {
|
|
|
2174
2133
|
* This should be run whenever the cart updates, or it is manually triggered.
|
|
2175
2134
|
*/
|
|
2176
2135
|
_findProtectionVariant(protectionFee) {
|
|
2177
|
-
if (!this._store)
|
|
2178
|
-
throw new Error("Missing ShipAid store");
|
|
2136
|
+
if (!this._store) throw new Error("Missing ShipAid store");
|
|
2179
2137
|
if (!this._protectionProduct) {
|
|
2180
2138
|
throw new Error("Missing Shopify protection product");
|
|
2181
2139
|
}
|
|
@@ -2195,8 +2153,7 @@ class ShipAidWidget extends s$1 {
|
|
|
2195
2153
|
}
|
|
2196
2154
|
/** Trigger confirmation popup */
|
|
2197
2155
|
_handleConfirmationPopup() {
|
|
2198
|
-
if (this._popup === "confirmation")
|
|
2199
|
-
return;
|
|
2156
|
+
if (this._popup === "confirmation") return;
|
|
2200
2157
|
this._popup = "confirmation";
|
|
2201
2158
|
}
|
|
2202
2159
|
/** Updates the current protection status, calling the relevant add/remove function. */
|
|
@@ -2215,8 +2172,7 @@ class ShipAidWidget extends s$1 {
|
|
|
2215
2172
|
async _fetchShipAidData() {
|
|
2216
2173
|
var _a, _b, _c, _d, _e;
|
|
2217
2174
|
const shop = ((_a = window.Shopify) == null ? void 0 : _a.shop) ?? ((_c = (_b = window.Shopify) == null ? void 0 : _b.Checkout) == null ? void 0 : _c.apiHost);
|
|
2218
|
-
if (!shop)
|
|
2219
|
-
throw new Error("No shop found in Shopify object.");
|
|
2175
|
+
if (!shop) throw new Error("No shop found in Shopify object.");
|
|
2220
2176
|
try {
|
|
2221
2177
|
const endpoint = new URL(window.location.href);
|
|
2222
2178
|
endpoint.pathname = this._apiEndpoint;
|
|
@@ -2228,10 +2184,8 @@ class ShipAidWidget extends s$1 {
|
|
|
2228
2184
|
endpoint.toString(),
|
|
2229
2185
|
payload
|
|
2230
2186
|
);
|
|
2231
|
-
if (!response)
|
|
2232
|
-
|
|
2233
|
-
if ((_d = response.errors) == null ? void 0 : _d.length)
|
|
2234
|
-
throw new Error(response.errors[0].message);
|
|
2187
|
+
if (!response) throw new Error("Missing response for store query.");
|
|
2188
|
+
if ((_d = response.errors) == null ? void 0 : _d.length) throw new Error(response.errors[0].message);
|
|
2235
2189
|
if (!((_e = response.data) == null ? void 0 : _e.store)) {
|
|
2236
2190
|
throw new Error("Missing store from store query response.");
|
|
2237
2191
|
}
|
|
@@ -2257,8 +2211,7 @@ class ShipAidWidget extends s$1 {
|
|
|
2257
2211
|
async _fetchSellingPlanFromVariant(subCartItemSellingPlan) {
|
|
2258
2212
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2259
2213
|
const shop = ((_a = window.Shopify) == null ? void 0 : _a.shop) ?? ((_c = (_b = window.Shopify) == null ? void 0 : _b.Checkout) == null ? void 0 : _c.apiHost);
|
|
2260
|
-
if (!shop)
|
|
2261
|
-
throw new Error("No shop found in Shopify object.");
|
|
2214
|
+
if (!shop) throw new Error("No shop found in Shopify object.");
|
|
2262
2215
|
try {
|
|
2263
2216
|
const endpoint = new URL(window.location.href);
|
|
2264
2217
|
endpoint.pathname = this._apiEndpoint;
|
|
@@ -2270,10 +2223,8 @@ class ShipAidWidget extends s$1 {
|
|
|
2270
2223
|
endpoint.toString(),
|
|
2271
2224
|
payload
|
|
2272
2225
|
);
|
|
2273
|
-
if (!response)
|
|
2274
|
-
|
|
2275
|
-
if ((_e = response.errors) == null ? void 0 : _e.length)
|
|
2276
|
-
throw new Error(response.errors[0].message);
|
|
2226
|
+
if (!response) throw new Error("Missing response for selling plan query.");
|
|
2227
|
+
if ((_e = response.errors) == null ? void 0 : _e.length) throw new Error(response.errors[0].message);
|
|
2277
2228
|
if (!((_f = response.data) == null ? void 0 : _f.sellingPlanFromVariant)) {
|
|
2278
2229
|
throw new Error("Missing variant from selling plan query response.");
|
|
2279
2230
|
}
|
|
@@ -2316,18 +2267,15 @@ class ShipAidWidget extends s$1 {
|
|
|
2316
2267
|
}
|
|
2317
2268
|
/** Update the internal cart, which will trigger any protection fee updates */
|
|
2318
2269
|
async updateCart(cart) {
|
|
2319
|
-
if (!cart)
|
|
2320
|
-
cart = await this._fetchCart();
|
|
2270
|
+
if (!cart) cart = await this._fetchCart();
|
|
2321
2271
|
this._cart = cart;
|
|
2322
2272
|
}
|
|
2323
2273
|
/** Add ShipAid shipping protection. */
|
|
2324
2274
|
async addProtection() {
|
|
2325
2275
|
var _a, _b;
|
|
2326
2276
|
try {
|
|
2327
|
-
if (!this._store)
|
|
2328
|
-
|
|
2329
|
-
if (!((_a = this._cart) == null ? void 0 : _a.items))
|
|
2330
|
-
throw new Error("Cart has not been loaded.");
|
|
2277
|
+
if (!this._store) throw new Error("Store has not been loaded.");
|
|
2278
|
+
if (!((_a = this._cart) == null ? void 0 : _a.items)) throw new Error("Cart has not been loaded.");
|
|
2331
2279
|
if (!((_b = this._protectionVariant) == null ? void 0 : _b.id)) {
|
|
2332
2280
|
throw new Error("No protection variant found.");
|
|
2333
2281
|
}
|
|
@@ -2364,8 +2312,7 @@ class ShipAidWidget extends s$1 {
|
|
|
2364
2312
|
/** Remove ShipAid shipping protection. */
|
|
2365
2313
|
async removeProtection() {
|
|
2366
2314
|
try {
|
|
2367
|
-
if (!this._store)
|
|
2368
|
-
throw new Error("Store has not been loaded.");
|
|
2315
|
+
if (!this._store) throw new Error("Store has not been loaded.");
|
|
2369
2316
|
if (!this._protectionCartItem) {
|
|
2370
2317
|
throw new Error("Protection product not found.");
|
|
2371
2318
|
}
|
|
@@ -2392,10 +2339,8 @@ class ShipAidWidget extends s$1 {
|
|
|
2392
2339
|
/** Try adding ShipAid shipping protection during polling if applicable */
|
|
2393
2340
|
async attemptAddProtection() {
|
|
2394
2341
|
var _a, _b, _c, _d, _e, _f;
|
|
2395
|
-
if (!((_a = this._store) == null ? void 0 : _a.widgetAutoOptIn))
|
|
2396
|
-
|
|
2397
|
-
if (!((_b = this._cart) == null ? void 0 : _b.items) || !((_c = this._cart) == null ? void 0 : _c.item_count))
|
|
2398
|
-
return;
|
|
2342
|
+
if (!((_a = this._store) == null ? void 0 : _a.widgetAutoOptIn)) return;
|
|
2343
|
+
if (!((_b = this._cart) == null ? void 0 : _b.items) || !((_c = this._cart) == null ? void 0 : _c.item_count)) return;
|
|
2399
2344
|
const protectionCartItemIndex = (_d = this._cart.items) == null ? void 0 : _d.findIndex((item) => {
|
|
2400
2345
|
var _a2, _b2;
|
|
2401
2346
|
return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some(
|
|
@@ -2404,11 +2349,9 @@ class ShipAidWidget extends s$1 {
|
|
|
2404
2349
|
});
|
|
2405
2350
|
const protectionCartItem = (_e = this._cart) == null ? void 0 : _e.items[protectionCartItemIndex];
|
|
2406
2351
|
this._hasProtectionInCart = !!protectionCartItem;
|
|
2407
|
-
if (this._cart.item_count === 1 && !!protectionCartItem)
|
|
2408
|
-
return;
|
|
2352
|
+
if (this._cart.item_count === 1 && !!protectionCartItem) return;
|
|
2409
2353
|
const hasSessionPayload = !!sessionStorage.getItem(LOCAL_STORAGE_KEY);
|
|
2410
|
-
if (hasSessionPayload)
|
|
2411
|
-
return;
|
|
2354
|
+
if (hasSessionPayload) return;
|
|
2412
2355
|
if (
|
|
2413
2356
|
// If we first check that no protection items are in the cart
|
|
2414
2357
|
!this._hasProtectionInCart && // Then check we have some items in the cart
|
|
@@ -2424,14 +2367,12 @@ class ShipAidWidget extends s$1 {
|
|
|
2424
2367
|
}
|
|
2425
2368
|
async handleMultipleProtectionVariants() {
|
|
2426
2369
|
var _a, _b, _c, _d, _e;
|
|
2427
|
-
if (!((_a = this._cart) == null ? void 0 : _a.items) || !((_b = this._cart) == null ? void 0 : _b.item_count))
|
|
2428
|
-
return;
|
|
2370
|
+
if (!((_a = this._cart) == null ? void 0 : _a.items) || !((_b = this._cart) == null ? void 0 : _b.item_count)) return;
|
|
2429
2371
|
let count = 0;
|
|
2430
2372
|
(_c = this._cart.items) == null ? void 0 : _c.forEach((item) => {
|
|
2431
2373
|
var _a2, _b2;
|
|
2432
2374
|
const isProtectionItem = (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some((variant) => variant.id === item.variant_id);
|
|
2433
|
-
if (isProtectionItem)
|
|
2434
|
-
count++;
|
|
2375
|
+
if (isProtectionItem) count++;
|
|
2435
2376
|
});
|
|
2436
2377
|
if (count > 1) {
|
|
2437
2378
|
const protectionCartItemIndex = (_d = this._cart.items) == null ? void 0 : _d.findIndex((item) => {
|
|
@@ -2592,6 +2533,133 @@ class ShipAidWidget extends s$1 {
|
|
|
2592
2533
|
super.connectedCallback();
|
|
2593
2534
|
await use(this.lang);
|
|
2594
2535
|
this.hasLoadedStrings = true;
|
|
2536
|
+
this.fetchInterceptorCleanup = interceptFetch(async (args, promise) => {
|
|
2537
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2538
|
+
if (((_b = (_a = args[1]) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase()) !== "POST") {
|
|
2539
|
+
return;
|
|
2540
|
+
}
|
|
2541
|
+
if ((_d = (_c = args[1]) == null ? void 0 : _c.headers) == null ? void 0 : _d["X-ShipAid"]) {
|
|
2542
|
+
return;
|
|
2543
|
+
}
|
|
2544
|
+
if (!args[0].startsWith("/cart/change") && !args[0].startsWith("/cart/update")) {
|
|
2545
|
+
return;
|
|
2546
|
+
}
|
|
2547
|
+
const buttonSelector = ((_f = (_e = this._store) == null ? void 0 : _e.widgetConfigurations) == null ? void 0 : _f.checkoutButtonSelector) || 'button[type="submit"][name="checkout"][form="cart"]';
|
|
2548
|
+
const button = document.querySelector(buttonSelector);
|
|
2549
|
+
console.log("q", button);
|
|
2550
|
+
if (!button) {
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2553
|
+
button.setAttribute("disabled", "true");
|
|
2554
|
+
console.debug("button", "t");
|
|
2555
|
+
try {
|
|
2556
|
+
await promise;
|
|
2557
|
+
await this.updateCart();
|
|
2558
|
+
await this.updateProtection();
|
|
2559
|
+
} finally {
|
|
2560
|
+
button.removeAttribute("disabled");
|
|
2561
|
+
console.debug("button", "f");
|
|
2562
|
+
}
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
disconnectedCallback() {
|
|
2566
|
+
var _a;
|
|
2567
|
+
super.disconnectedCallback();
|
|
2568
|
+
(_a = this.fetchInterceptorCleanup) == null ? void 0 : _a.call(this);
|
|
2569
|
+
}
|
|
2570
|
+
async updateProtection() {
|
|
2571
|
+
var _a, _b, _c, _d;
|
|
2572
|
+
this._cartLastUpdated = /* @__PURE__ */ new Date();
|
|
2573
|
+
if (!((_a = this._cart) == null ? void 0 : _a.items)) return;
|
|
2574
|
+
const protectionCartItemIndex = (_b = this._cart.items) == null ? void 0 : _b.findIndex((item) => {
|
|
2575
|
+
var _a2, _b2;
|
|
2576
|
+
return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some(
|
|
2577
|
+
(variant) => variant.id === item.variant_id
|
|
2578
|
+
);
|
|
2579
|
+
});
|
|
2580
|
+
const protectionCartItem = (_c = this._cart) == null ? void 0 : _c.items[protectionCartItemIndex];
|
|
2581
|
+
this._hasProtectionInCart = !!protectionCartItem;
|
|
2582
|
+
if (!this._store) return;
|
|
2583
|
+
const protectionFee = await this.calculateProtectionTotal(this._cart);
|
|
2584
|
+
if (this._cart.item_count > 0 && !!protectionCartItem && (this._cart.total_price === (protectionCartItem == null ? void 0 : protectionCartItem.final_line_price) || !protectionFee)) {
|
|
2585
|
+
const removePayload = {
|
|
2586
|
+
id: protectionCartItem.key,
|
|
2587
|
+
quantity: 0
|
|
2588
|
+
};
|
|
2589
|
+
const cart2 = await this._fetch.post(
|
|
2590
|
+
"/cart/change.js",
|
|
2591
|
+
removePayload
|
|
2592
|
+
);
|
|
2593
|
+
sessionStorage.removeItem(LOCAL_STORAGE_KEY);
|
|
2594
|
+
return await this._handleRefresh(cart2);
|
|
2595
|
+
}
|
|
2596
|
+
const protectionVariant = this._findProtectionVariant(protectionFee);
|
|
2597
|
+
if (!protectionFee) {
|
|
2598
|
+
this._protectionVariant = {
|
|
2599
|
+
id: 0,
|
|
2600
|
+
price: "0"
|
|
2601
|
+
};
|
|
2602
|
+
} else {
|
|
2603
|
+
this._protectionVariant = protectionVariant;
|
|
2604
|
+
this._shouldShowWidget = true;
|
|
2605
|
+
}
|
|
2606
|
+
if (!(protectionVariant == null ? void 0 : protectionVariant.id)) {
|
|
2607
|
+
this._shouldShowWidget = false;
|
|
2608
|
+
logger.error("No matching protection variant found.");
|
|
2609
|
+
return;
|
|
2610
|
+
}
|
|
2611
|
+
if (!((_d = this._protectionVariant) == null ? void 0 : _d.id)) {
|
|
2612
|
+
this._shouldShowWidget = false;
|
|
2613
|
+
return;
|
|
2614
|
+
}
|
|
2615
|
+
if (!protectionCartItem) return;
|
|
2616
|
+
if (this.supportSubscriptions) {
|
|
2617
|
+
const itemWithSubscription = this._cart.items.find((item) => {
|
|
2618
|
+
var _a2;
|
|
2619
|
+
return item.id !== ((_a2 = this._protectionVariant) == null ? void 0 : _a2.id) && !!(item == null ? void 0 : item.selling_plan_allocation);
|
|
2620
|
+
});
|
|
2621
|
+
let updateSubscriptionPayload = null;
|
|
2622
|
+
if (!itemWithSubscription && (protectionCartItem == null ? void 0 : protectionCartItem.selling_plan_allocation)) {
|
|
2623
|
+
updateSubscriptionPayload = { id: protectionCartItem.key, quantity: 1, selling_plan: null };
|
|
2624
|
+
} else if (itemWithSubscription && !(protectionCartItem == null ? void 0 : protectionCartItem.selling_plan_allocation)) {
|
|
2625
|
+
const protectionSellingPlan = await this._fetchSellingPlanFromVariant(itemWithSubscription.selling_plan_allocation.selling_plan);
|
|
2626
|
+
const sellingPlanId = protectionSellingPlan ? getIdFromShopifyGid(protectionSellingPlan.id) : null;
|
|
2627
|
+
updateSubscriptionPayload = { id: protectionCartItem.key, quantity: 1, selling_plan: sellingPlanId };
|
|
2628
|
+
}
|
|
2629
|
+
if (updateSubscriptionPayload) {
|
|
2630
|
+
const cart2 = await this._fetch.post("/cart/change.js", updateSubscriptionPayload);
|
|
2631
|
+
await this._handleRefresh(cart2);
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
if (protectionVariant.id === protectionCartItem.variant_id) {
|
|
2635
|
+
this._protectionCartItem = {
|
|
2636
|
+
...protectionCartItem,
|
|
2637
|
+
index: protectionCartItemIndex,
|
|
2638
|
+
position: protectionCartItemIndex + 1
|
|
2639
|
+
};
|
|
2640
|
+
if (protectionCartItem.quantity === 1) return;
|
|
2641
|
+
const updatePayload2 = {
|
|
2642
|
+
id: protectionCartItem.key,
|
|
2643
|
+
quantity: 1
|
|
2644
|
+
};
|
|
2645
|
+
const cart2 = await this._fetch.post(
|
|
2646
|
+
"/cart/change.js",
|
|
2647
|
+
updatePayload2
|
|
2648
|
+
);
|
|
2649
|
+
this._handleRefreshCart();
|
|
2650
|
+
return await this._handleRefresh(cart2);
|
|
2651
|
+
}
|
|
2652
|
+
const updatePayload = {
|
|
2653
|
+
updates: {
|
|
2654
|
+
[protectionCartItem.variant_id]: 0,
|
|
2655
|
+
[protectionVariant.id]: 1
|
|
2656
|
+
}
|
|
2657
|
+
};
|
|
2658
|
+
const cart = await this._fetch.post(
|
|
2659
|
+
"/cart/update.js",
|
|
2660
|
+
updatePayload
|
|
2661
|
+
);
|
|
2662
|
+
await this._handleRefresh(cart);
|
|
2595
2663
|
}
|
|
2596
2664
|
render() {
|
|
2597
2665
|
useOnce(this, async () => {
|
|
@@ -2643,16 +2711,13 @@ class ShipAidWidget extends s$1 {
|
|
|
2643
2711
|
this._dispatchEvent(Events.LOADED, this._store);
|
|
2644
2712
|
setTimeout(async () => {
|
|
2645
2713
|
var _a2, _b2, _c2, _d2;
|
|
2646
|
-
if (!((_a2 = this._store) == null ? void 0 : _a2.widgetAutoOptIn))
|
|
2647
|
-
|
|
2648
|
-
if (!((_b2 = this._cart) == null ? void 0 : _b2.item_count))
|
|
2649
|
-
return;
|
|
2714
|
+
if (!((_a2 = this._store) == null ? void 0 : _a2.widgetAutoOptIn)) return;
|
|
2715
|
+
if (!((_b2 = this._cart) == null ? void 0 : _b2.item_count)) return;
|
|
2650
2716
|
if (this.customerId && this._store.excludedCustomersIdsAutoOptIn && ((_c2 = this._store.excludedCustomersIdsAutoOptIn) == null ? void 0 : _c2.length) && this._store.excludedCustomersIdsAutoOptIn.includes(`gid://shopify/Customer/${this.customerId}`)) {
|
|
2651
2717
|
return;
|
|
2652
2718
|
}
|
|
2653
2719
|
const hasSessionPayload = !!sessionStorage.getItem(LOCAL_STORAGE_KEY);
|
|
2654
|
-
if (hasSessionPayload)
|
|
2655
|
-
return;
|
|
2720
|
+
if (hasSessionPayload) return;
|
|
2656
2721
|
if (
|
|
2657
2722
|
// If we first check that no protection items are in the cart
|
|
2658
2723
|
!this._hasProtectionInCart && // Then check we have some items in the cart
|
|
@@ -2666,15 +2731,13 @@ class ShipAidWidget extends s$1 {
|
|
|
2666
2731
|
);
|
|
2667
2732
|
}
|
|
2668
2733
|
}, 500);
|
|
2669
|
-
if (this.disablePolling)
|
|
2670
|
-
return;
|
|
2734
|
+
if (this.disablePolling) return;
|
|
2671
2735
|
setInterval(async () => {
|
|
2672
2736
|
const lastUpdated = this._cartLastUpdated;
|
|
2673
2737
|
if (lastUpdated) {
|
|
2674
2738
|
const now = /* @__PURE__ */ new Date();
|
|
2675
2739
|
const msAgo = now.getTime() - lastUpdated.getTime();
|
|
2676
|
-
if (msAgo < this.pollingInterval)
|
|
2677
|
-
return;
|
|
2740
|
+
if (msAgo < this.pollingInterval) return;
|
|
2678
2741
|
}
|
|
2679
2742
|
await this.updateCart();
|
|
2680
2743
|
}, this.pollingInterval);
|
|
@@ -2693,102 +2756,7 @@ class ShipAidWidget extends s$1 {
|
|
|
2693
2756
|
useEffect(
|
|
2694
2757
|
this,
|
|
2695
2758
|
async () => {
|
|
2696
|
-
|
|
2697
|
-
this._cartLastUpdated = /* @__PURE__ */ new Date();
|
|
2698
|
-
if (!((_a = this._cart) == null ? void 0 : _a.items))
|
|
2699
|
-
return;
|
|
2700
|
-
const protectionCartItemIndex = (_b = this._cart.items) == null ? void 0 : _b.findIndex((item) => {
|
|
2701
|
-
var _a2, _b2;
|
|
2702
|
-
return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some(
|
|
2703
|
-
(variant) => variant.id === item.variant_id
|
|
2704
|
-
);
|
|
2705
|
-
});
|
|
2706
|
-
const protectionCartItem = (_c = this._cart) == null ? void 0 : _c.items[protectionCartItemIndex];
|
|
2707
|
-
this._hasProtectionInCart = !!protectionCartItem;
|
|
2708
|
-
if (!this._store)
|
|
2709
|
-
return;
|
|
2710
|
-
const protectionFee = await this.calculateProtectionTotal(this._cart);
|
|
2711
|
-
if (this._cart.item_count > 0 && !!protectionCartItem && (this._cart.total_price === (protectionCartItem == null ? void 0 : protectionCartItem.final_line_price) || !protectionFee)) {
|
|
2712
|
-
const removePayload = {
|
|
2713
|
-
id: protectionCartItem.key,
|
|
2714
|
-
quantity: 0
|
|
2715
|
-
};
|
|
2716
|
-
const cart2 = await this._fetch.post(
|
|
2717
|
-
"/cart/change.js",
|
|
2718
|
-
removePayload
|
|
2719
|
-
);
|
|
2720
|
-
sessionStorage.removeItem(LOCAL_STORAGE_KEY);
|
|
2721
|
-
return await this._handleRefresh(cart2);
|
|
2722
|
-
}
|
|
2723
|
-
const protectionVariant = this._findProtectionVariant(protectionFee);
|
|
2724
|
-
if (!protectionFee) {
|
|
2725
|
-
this._protectionVariant = {
|
|
2726
|
-
id: 0,
|
|
2727
|
-
price: "0"
|
|
2728
|
-
};
|
|
2729
|
-
} else {
|
|
2730
|
-
this._protectionVariant = protectionVariant;
|
|
2731
|
-
this._shouldShowWidget = true;
|
|
2732
|
-
}
|
|
2733
|
-
if (!(protectionVariant == null ? void 0 : protectionVariant.id)) {
|
|
2734
|
-
this._shouldShowWidget = false;
|
|
2735
|
-
logger.error("No matching protection variant found.");
|
|
2736
|
-
return;
|
|
2737
|
-
}
|
|
2738
|
-
if (!((_d = this._protectionVariant) == null ? void 0 : _d.id)) {
|
|
2739
|
-
this._shouldShowWidget = false;
|
|
2740
|
-
return;
|
|
2741
|
-
}
|
|
2742
|
-
if (!protectionCartItem)
|
|
2743
|
-
return;
|
|
2744
|
-
if (this.supportSubscriptions) {
|
|
2745
|
-
const itemWithSubscription = this._cart.items.find((item) => {
|
|
2746
|
-
var _a2;
|
|
2747
|
-
return item.id !== ((_a2 = this._protectionVariant) == null ? void 0 : _a2.id) && !!(item == null ? void 0 : item.selling_plan_allocation);
|
|
2748
|
-
});
|
|
2749
|
-
let updateSubscriptionPayload = null;
|
|
2750
|
-
if (!itemWithSubscription && (protectionCartItem == null ? void 0 : protectionCartItem.selling_plan_allocation)) {
|
|
2751
|
-
updateSubscriptionPayload = { id: protectionCartItem.key, quantity: 1, selling_plan: null };
|
|
2752
|
-
} else if (itemWithSubscription && !(protectionCartItem == null ? void 0 : protectionCartItem.selling_plan_allocation)) {
|
|
2753
|
-
const protectionSellingPlan = await this._fetchSellingPlanFromVariant(itemWithSubscription.selling_plan_allocation.selling_plan);
|
|
2754
|
-
const sellingPlanId = protectionSellingPlan ? getIdFromShopifyGid(protectionSellingPlan.id) : null;
|
|
2755
|
-
updateSubscriptionPayload = { id: protectionCartItem.key, quantity: 1, selling_plan: sellingPlanId };
|
|
2756
|
-
}
|
|
2757
|
-
if (updateSubscriptionPayload) {
|
|
2758
|
-
const cart2 = await this._fetch.post("/cart/change.js", updateSubscriptionPayload);
|
|
2759
|
-
await this._handleRefresh(cart2);
|
|
2760
|
-
}
|
|
2761
|
-
}
|
|
2762
|
-
if (protectionVariant.id === protectionCartItem.variant_id) {
|
|
2763
|
-
this._protectionCartItem = {
|
|
2764
|
-
...protectionCartItem,
|
|
2765
|
-
index: protectionCartItemIndex,
|
|
2766
|
-
position: protectionCartItemIndex + 1
|
|
2767
|
-
};
|
|
2768
|
-
if (protectionCartItem.quantity === 1)
|
|
2769
|
-
return;
|
|
2770
|
-
const updatePayload2 = {
|
|
2771
|
-
id: protectionCartItem.key,
|
|
2772
|
-
quantity: 1
|
|
2773
|
-
};
|
|
2774
|
-
const cart2 = await this._fetch.post(
|
|
2775
|
-
"/cart/change.js",
|
|
2776
|
-
updatePayload2
|
|
2777
|
-
);
|
|
2778
|
-
this._handleRefreshCart();
|
|
2779
|
-
return await this._handleRefresh(cart2);
|
|
2780
|
-
}
|
|
2781
|
-
const updatePayload = {
|
|
2782
|
-
updates: {
|
|
2783
|
-
[protectionCartItem.variant_id]: 0,
|
|
2784
|
-
[protectionVariant.id]: 1
|
|
2785
|
-
}
|
|
2786
|
-
};
|
|
2787
|
-
const cart = await this._fetch.post(
|
|
2788
|
-
"/cart/update.js",
|
|
2789
|
-
updatePayload
|
|
2790
|
-
);
|
|
2791
|
-
await this._handleRefresh(cart);
|
|
2759
|
+
await this.updateProtection();
|
|
2792
2760
|
},
|
|
2793
2761
|
[this._store, this._cart]
|
|
2794
2762
|
);
|
|
@@ -3075,83 +3043,87 @@ class ShipAidWidget extends s$1 {
|
|
|
3075
3043
|
</div>
|
|
3076
3044
|
`;
|
|
3077
3045
|
}
|
|
3078
|
-
}
|
|
3079
|
-
|
|
3046
|
+
};
|
|
3047
|
+
_ShipAidWidget.styles = styles;
|
|
3048
|
+
let ShipAidWidget = _ShipAidWidget;
|
|
3080
3049
|
__decorateClass([
|
|
3081
3050
|
n$7({ type: Boolean, attribute: true })
|
|
3082
|
-
], ShipAidWidget.prototype, "disablePolling"
|
|
3051
|
+
], ShipAidWidget.prototype, "disablePolling");
|
|
3083
3052
|
__decorateClass([
|
|
3084
3053
|
n$7({ type: Boolean, attribute: true })
|
|
3085
|
-
], ShipAidWidget.prototype, "disableActions"
|
|
3054
|
+
], ShipAidWidget.prototype, "disableActions");
|
|
3086
3055
|
__decorateClass([
|
|
3087
3056
|
n$7({ type: Number, attribute: true })
|
|
3088
|
-
], ShipAidWidget.prototype, "pollingInterval"
|
|
3057
|
+
], ShipAidWidget.prototype, "pollingInterval");
|
|
3089
3058
|
__decorateClass([
|
|
3090
3059
|
n$7({ type: Boolean, attribute: true })
|
|
3091
|
-
], ShipAidWidget.prototype, "disableRefresh"
|
|
3060
|
+
], ShipAidWidget.prototype, "disableRefresh");
|
|
3092
3061
|
__decorateClass([
|
|
3093
3062
|
n$7({ type: Boolean, attribute: true })
|
|
3094
|
-
], ShipAidWidget.prototype, "refreshCart"
|
|
3063
|
+
], ShipAidWidget.prototype, "refreshCart");
|
|
3095
3064
|
__decorateClass([
|
|
3096
3065
|
n$7({ type: Boolean, attribute: true })
|
|
3097
|
-
], ShipAidWidget.prototype, "persistPopup"
|
|
3066
|
+
], ShipAidWidget.prototype, "persistPopup");
|
|
3098
3067
|
__decorateClass([
|
|
3099
3068
|
n$7({ type: Boolean, attribute: true })
|
|
3100
|
-
], ShipAidWidget.prototype, "defaultToggleButton"
|
|
3069
|
+
], ShipAidWidget.prototype, "defaultToggleButton");
|
|
3101
3070
|
__decorateClass([
|
|
3102
3071
|
n$7({ type: String, attribute: true })
|
|
3103
|
-
], ShipAidWidget.prototype, "lang"
|
|
3072
|
+
], ShipAidWidget.prototype, "lang");
|
|
3104
3073
|
__decorateClass([
|
|
3105
3074
|
n$7({ type: String, attribute: true })
|
|
3106
|
-
], ShipAidWidget.prototype, "currency"
|
|
3075
|
+
], ShipAidWidget.prototype, "currency");
|
|
3107
3076
|
__decorateClass([
|
|
3108
3077
|
n$7({ type: String, attribute: true })
|
|
3109
|
-
], ShipAidWidget.prototype, "customerId"
|
|
3078
|
+
], ShipAidWidget.prototype, "customerId");
|
|
3110
3079
|
__decorateClass([
|
|
3111
3080
|
n$7({ type: Boolean, attribute: true })
|
|
3112
|
-
], ShipAidWidget.prototype, "supportSubscriptions"
|
|
3081
|
+
], ShipAidWidget.prototype, "supportSubscriptions");
|
|
3082
|
+
__decorateClass([
|
|
3083
|
+
t$3()
|
|
3084
|
+
], ShipAidWidget.prototype, "_storeDomain");
|
|
3113
3085
|
__decorateClass([
|
|
3114
3086
|
t$3()
|
|
3115
|
-
], ShipAidWidget.prototype, "
|
|
3087
|
+
], ShipAidWidget.prototype, "_store");
|
|
3116
3088
|
__decorateClass([
|
|
3117
3089
|
t$3()
|
|
3118
|
-
], ShipAidWidget.prototype, "
|
|
3090
|
+
], ShipAidWidget.prototype, "_cart");
|
|
3119
3091
|
__decorateClass([
|
|
3120
3092
|
t$3()
|
|
3121
|
-
], ShipAidWidget.prototype, "
|
|
3093
|
+
], ShipAidWidget.prototype, "_protectionProduct");
|
|
3122
3094
|
__decorateClass([
|
|
3123
3095
|
t$3()
|
|
3124
|
-
], ShipAidWidget.prototype, "
|
|
3096
|
+
], ShipAidWidget.prototype, "_cartLastUpdated");
|
|
3125
3097
|
__decorateClass([
|
|
3126
3098
|
t$3()
|
|
3127
|
-
], ShipAidWidget.prototype, "
|
|
3099
|
+
], ShipAidWidget.prototype, "_hasFinishedSetup");
|
|
3128
3100
|
__decorateClass([
|
|
3129
3101
|
t$3()
|
|
3130
|
-
], ShipAidWidget.prototype, "
|
|
3102
|
+
], ShipAidWidget.prototype, "_shouldShowWidget");
|
|
3131
3103
|
__decorateClass([
|
|
3132
3104
|
t$3()
|
|
3133
|
-
], ShipAidWidget.prototype, "
|
|
3105
|
+
], ShipAidWidget.prototype, "_hasProtectionInCart");
|
|
3134
3106
|
__decorateClass([
|
|
3135
3107
|
t$3()
|
|
3136
|
-
], ShipAidWidget.prototype, "
|
|
3108
|
+
], ShipAidWidget.prototype, "_protectionCartItem");
|
|
3137
3109
|
__decorateClass([
|
|
3138
3110
|
t$3()
|
|
3139
|
-
], ShipAidWidget.prototype, "
|
|
3111
|
+
], ShipAidWidget.prototype, "_protectionVariant");
|
|
3140
3112
|
__decorateClass([
|
|
3141
3113
|
t$3()
|
|
3142
|
-
], ShipAidWidget.prototype, "
|
|
3114
|
+
], ShipAidWidget.prototype, "hasLoadedStrings");
|
|
3143
3115
|
__decorateClass([
|
|
3144
3116
|
t$3()
|
|
3145
|
-
], ShipAidWidget.prototype, "
|
|
3117
|
+
], ShipAidWidget.prototype, "fetchInterceptorCleanup");
|
|
3146
3118
|
__decorateClass([
|
|
3147
3119
|
t$3()
|
|
3148
|
-
], ShipAidWidget.prototype, "intervalId"
|
|
3120
|
+
], ShipAidWidget.prototype, "intervalId");
|
|
3149
3121
|
__decorateClass([
|
|
3150
3122
|
t$3()
|
|
3151
|
-
], ShipAidWidget.prototype, "_state"
|
|
3123
|
+
], ShipAidWidget.prototype, "_state");
|
|
3152
3124
|
__decorateClass([
|
|
3153
3125
|
t$3()
|
|
3154
|
-
], ShipAidWidget.prototype, "_popup"
|
|
3126
|
+
], ShipAidWidget.prototype, "_popup");
|
|
3155
3127
|
if (!customElements.get("shipaid-widget")) {
|
|
3156
3128
|
customElements.define("shipaid-widget", ShipAidWidget);
|
|
3157
3129
|
}
|