ui.shipaid.com 0.3.40 → 0.3.42

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 CHANGED
@@ -1,11 +1,8 @@
1
1
  function calculateProtectionTotal(store, protectionProduct, cart) {
2
2
  var _a, _b;
3
- if (!store)
4
- throw new Error("Missing store settings.");
5
- if (!protectionProduct)
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
- throw new Error("Missing default fee amount.");
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
- return t3.cssText;
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
- s3.unshift(c$2(i3));
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
- if (i3.endsWith(o$2) || i3.startsWith(n$3)) {
419
- const s3 = f2[d2++];
420
- if (t3.push(i3), void 0 !== s3) {
421
- const t4 = h2.getAttribute(s3.toLowerCase() + o$2).split(n$3), i4 = /([.?@])?(.*)/.exec(s3);
422
- v2.push({ type: 1, index: r2, name: i4[2], strings: t4, ctor: "." === i4[1] ? H : "?" === i4[1] ? L : "@" === i4[1] ? z : k });
423
- } else
424
- v2.push({ type: 6, index: r2 });
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
- if (h2.data === l$2)
440
- v2.push({ type: 2, index: r2 });
441
- else {
442
- let t3 = -1;
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
- return false;
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
- t2._$AN = e2 = /* @__PURE__ */ new Set();
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
- if (t2)
795
- if (Array.isArray(r2))
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
- return this.ft = void 0, this.et = r2;
902
- if (r2 === T)
903
- return r2;
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] = {
@@ -965,7 +913,7 @@ const useOnce = (element, on) => useEffect(element, on, []);
965
913
  function n(n2, o3, r2) {
966
914
  return n2 ? o3() : null == r2 ? void 0 : r2();
967
915
  }
968
- const styles$1 = i$2`
916
+ const styles$2 = i$2`
969
917
  :host {
970
918
  --shipaid-primary: #0056d6;
971
919
  --shipaid-secondary: #0076ff;
@@ -1483,18 +1431,16 @@ const BellIcon = x`
1483
1431
  </g>
1484
1432
  </svg>
1485
1433
  `;
1486
- var __defProp$1 = Object.defineProperty;
1487
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
1488
- var __decorateClass$1 = (decorators, target, key, kind) => {
1489
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
1434
+ var __defProp$2 = Object.defineProperty;
1435
+ var __decorateClass$2 = (decorators, target, key, kind) => {
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 = (kind ? decorator(target, key, result) : decorator(result)) || result;
1493
- if (kind && result)
1494
- __defProp$1(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 LearnMorePopup extends s$1 {
1443
+ const _LearnMorePopup = class _LearnMorePopup extends s$1 {
1498
1444
  constructor() {
1499
1445
  super(...arguments);
1500
1446
  this.active = false;
@@ -1566,14 +1512,218 @@ class LearnMorePopup extends s$1 {
1566
1512
  <div class="blocker" @click=${this.handleClosePopup}></div>
1567
1513
  `;
1568
1514
  }
1569
- }
1570
- LearnMorePopup.styles = styles$1;
1571
- __decorateClass$1([
1515
+ };
1516
+ _LearnMorePopup.styles = styles$2;
1517
+ let LearnMorePopup = _LearnMorePopup;
1518
+ __decorateClass$2([
1572
1519
  n$7({ type: Boolean, attribute: true })
1573
- ], LearnMorePopup.prototype, "active", 2);
1520
+ ], LearnMorePopup.prototype, "active");
1574
1521
  if (!customElements.get("shipaid-popup-learn-more")) {
1575
1522
  customElements.define("shipaid-popup-learn-more", LearnMorePopup);
1576
1523
  }
1524
+ const styles$1 = i$2`
1525
+ :host {
1526
+ --shipaid-primary: #0056d6;
1527
+ --shipaid-secondary: #0076ff;
1528
+ --shipaid-danger: #f44336;
1529
+ --shipaid-text: #000000;
1530
+ --shipaid-text-muted: #cccccc;
1531
+ --shipaid-text-grey: #aaaaaa;
1532
+ --shipaid-light-grey: #ebecf0;
1533
+ --shipaid-light-blue: #bacef4;
1534
+ --shipaid-font: "Lato", sans-serif;
1535
+ --shipaid-font-xs: 12px;
1536
+ --shipaid-font-sm: 14px;
1537
+ --shipaid-font-base: 16px;
1538
+ --shipaid-font-lg: 18px;
1539
+ --shipaid-font-display: 36px;
1540
+ --shipaid-font-regular: 400;
1541
+ --shipaid-font-heavy: 700;
1542
+ }
1543
+
1544
+ p,
1545
+ a {
1546
+ font-family: var(--shipaid-font);
1547
+ font-weight: var(--shipaid-font-regular);
1548
+ font-size: var(--shipaid-font-base);
1549
+ color: var(--shipaid-text);
1550
+ }
1551
+
1552
+ .shipaid-confirmation-popup {
1553
+ position: fixed;
1554
+ top: 0;
1555
+ bottom: 0;
1556
+ left: 0;
1557
+ right: 0;
1558
+ margin: 13rem auto;
1559
+ max-width: 30%;
1560
+ max-height: 70vh;
1561
+ height: fit-content;
1562
+ border: var(--shipaid-popup-border, var(--shipaid-primary)) .2rem solid;
1563
+ background-color: var(--shipaid-popup-background, #fff);
1564
+ border-radius: 45px;
1565
+ z-index: 1000000000;
1566
+ overflow: auto;
1567
+ visibility: hidden;
1568
+ opacity: 0;
1569
+ transition: all 250ms ease-in-out;
1570
+ display: inline-flex;
1571
+ flex-direction: column;
1572
+ gap: 1rem;
1573
+ padding: 2rem
1574
+ }
1575
+
1576
+ .shipaid-confirmation-popup.active {
1577
+ visibility: visible;
1578
+ opacity: 1;
1579
+ }
1580
+
1581
+ .shipaid-confirmation-popup.active + .blocker {
1582
+ z-index: 50;
1583
+ }
1584
+
1585
+ .popup-actions {
1586
+ display: flex;
1587
+ flex-direction: row;
1588
+ justify-content: space-around;
1589
+ margin-top: 2rem;
1590
+ margin-bottom: 1rem;
1591
+ }
1592
+
1593
+ .popup-subtitle {
1594
+ text-align: center;
1595
+ }
1596
+
1597
+ @media (max-width: 600px) {
1598
+ .shipaid-confirmation-popup {
1599
+ width: auto;
1600
+ height: 100vh;
1601
+ padding: 3rem;
1602
+ margin-left: 20px;
1603
+ margin-right: 20px;
1604
+ }
1605
+ }
1606
+
1607
+ .btn-primary {
1608
+ background-color: #0073e6;
1609
+ color: white;
1610
+ border: none;
1611
+ padding: 10px 20px;
1612
+ border-radius: 4px;
1613
+ cursor: pointer;
1614
+ }
1615
+
1616
+ .btn-primary:hover {
1617
+ background-color: #005bb5;
1618
+ }
1619
+
1620
+ .btn-secondary {
1621
+ background-color: transparent;
1622
+ color: #666;
1623
+ border: 1px solid #ccc;
1624
+ padding: 10px 20px;
1625
+ border-radius: 4px;
1626
+ cursor: pointer;
1627
+ }
1628
+
1629
+ .btn-secondary:hover {
1630
+ background-color: #f5f5f5;
1631
+ }
1632
+
1633
+
1634
+ .shipaid-confirmation-popup .popup-title {
1635
+ font-size: var(--shipaid-font-display);
1636
+ font-weight: var(--shipaid-font-regular);
1637
+ letter-spacing: 1px;
1638
+ text-align: center;
1639
+ }
1640
+
1641
+ @media (max-width: 600px) {
1642
+ .shipaid-confirmation-popup .popup-title {
1643
+ font-size: 2rem;
1644
+ }
1645
+ }
1646
+
1647
+ .shipaid-confirmation-popup p {
1648
+ font-size: var(--shipaid-font-base);
1649
+ margin: 0;
1650
+ }
1651
+
1652
+ @media (max-width: 600px) {
1653
+ .shipaid-confirmation-popup p {
1654
+ font-size: 10px;
1655
+ }
1656
+ }
1657
+
1658
+ .blocker {
1659
+ position: fixed;
1660
+ top: 0;
1661
+ left: 0;
1662
+ bottom: 0;
1663
+ right: 0;
1664
+ content: " ";
1665
+ background: transparent;
1666
+ z-index: -1;
1667
+ }
1668
+ `;
1669
+ var __defProp$1 = Object.defineProperty;
1670
+ var __decorateClass$1 = (decorators, target, key, kind) => {
1671
+ var result = void 0;
1672
+ for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
1673
+ if (decorator = decorators[i2])
1674
+ result = decorator(target, key, result) || result;
1675
+ if (result) __defProp$1(target, key, result);
1676
+ return result;
1677
+ };
1678
+ const _ConfirmationPopup = class _ConfirmationPopup extends s$1 {
1679
+ constructor() {
1680
+ super(...arguments);
1681
+ this.active = false;
1682
+ }
1683
+ handleClosePopup() {
1684
+ const event = new Event("close");
1685
+ this.dispatchEvent(event);
1686
+ }
1687
+ handleRemoveProtection() {
1688
+ const event = new Event("remove-protection");
1689
+ this.dispatchEvent(event);
1690
+ }
1691
+ render() {
1692
+ return x`
1693
+ <div class=${`shipaid-confirmation-popup ${this.active && "active"}`}>
1694
+ <p class="popup-title">Are you sure?</p>
1695
+ <div class="popup-subtitle">
1696
+ <p>Thousands of customers choose to protect their orders to ensure a seamless resolution process in the event of damage or loss in transit.</p>
1697
+ </div>
1698
+ <div class="popup-actions">
1699
+ <button
1700
+ type="button"
1701
+ class="btn-primary"
1702
+ @click=${this.handleClosePopup}
1703
+ >
1704
+ Keep the Delivery Guarantee
1705
+ </button>
1706
+ <button
1707
+ type="button"
1708
+ class="btn-secondary"
1709
+ @click=${this.handleRemoveProtection}
1710
+ >
1711
+ No, I'd like to ship my order unprotected
1712
+ </button>
1713
+ </div>
1714
+ </div>
1715
+ <div class="blocker" @click=${this.handleClosePopup}></div>
1716
+ `;
1717
+ }
1718
+ };
1719
+ _ConfirmationPopup.styles = styles$1;
1720
+ let ConfirmationPopup = _ConfirmationPopup;
1721
+ __decorateClass$1([
1722
+ n$7({ type: Boolean, attribute: true })
1723
+ ], ConfirmationPopup.prototype, "active");
1724
+ if (!customElements.get("shipaid-popup-confirmation")) {
1725
+ customElements.define("shipaid-popup-confirmation", ConfirmationPopup);
1726
+ }
1577
1727
  const loading = "Loading ShipAid Widget...";
1578
1728
  const title = "Delivery Guarantee";
1579
1729
  const description = "in case of Loss, Damage or Theft";
@@ -1778,22 +1928,42 @@ var Events = /* @__PURE__ */ ((Events2) => {
1778
1928
  Events2["STATUS_UPDATE"] = "shipaid-protection-status";
1779
1929
  return Events2;
1780
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
+ }
1781
1954
  var __defProp = Object.defineProperty;
1782
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1783
1955
  var __decorateClass = (decorators, target, key, kind) => {
1784
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
1956
+ var result = void 0;
1785
1957
  for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
1786
1958
  if (decorator = decorators[i2])
1787
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1788
- if (kind && result)
1789
- __defProp(target, key, result);
1959
+ result = decorator(target, key, result) || result;
1960
+ if (result) __defProp(target, key, result);
1790
1961
  return result;
1791
1962
  };
1792
1963
  const runRequest = async (input, init) => {
1793
1964
  try {
1794
1965
  const response = await fetch(input, init);
1795
- if (!response.ok)
1796
- throw new Error(await response.text());
1966
+ if (!response.ok) throw new Error(await response.text());
1797
1967
  const data = await response.json();
1798
1968
  return data;
1799
1969
  } catch (error) {
@@ -1829,22 +1999,21 @@ const SellinPlanGroupFromVariant = `query SellingPlanFromVariant($store: String!
1829
1999
  sellingPlanFromVariant(input: {store: $store, variantId: $variantId })
1830
2000
  }`;
1831
2001
  const langFiles = /* @__PURE__ */ Object.assign({
1832
- "./lang/de.json": () => import("./de-7465ac1a.js").then((m2) => m2["default"]),
2002
+ "./lang/de.json": () => import("./de-VKiubByf.js").then((m2) => m2["default"]),
1833
2003
  "./lang/en.json": () => Promise.resolve().then(() => en).then((m2) => m2["default"]),
1834
- "./lang/es.json": () => import("./es-ffafb8a6.js").then((m2) => m2["default"]),
1835
- "./lang/fr.json": () => import("./fr-ef63017f.js").then((m2) => m2["default"]),
1836
- "./lang/it.json": () => import("./it-108c90b9.js").then((m2) => m2["default"]),
1837
- "./lang/pt.json": () => import("./pt-b1b6ec67.js").then((m2) => m2["default"])
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"])
1838
2008
  });
1839
2009
  registerTranslateConfig({
1840
2010
  loader: async (lang) => {
1841
- if (lang === "en")
1842
- return defaultLangFile;
2011
+ if (lang === "en") return defaultLangFile;
1843
2012
  const fileImport = Reflect.get(langFiles, `./lang/${lang}.json`);
1844
2013
  return fileImport ? await fileImport() : defaultLangFile;
1845
2014
  }
1846
2015
  });
1847
- class ShipAidWidget extends s$1 {
2016
+ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
1848
2017
  constructor() {
1849
2018
  var _a, _b, _c;
1850
2019
  super(...arguments);
@@ -1865,6 +2034,8 @@ class ShipAidWidget extends s$1 {
1865
2034
  this._shouldShowWidget = false;
1866
2035
  this._hasProtectionInCart = false;
1867
2036
  this.hasLoadedStrings = false;
2037
+ this.fetchInterceptorCleanup = () => {
2038
+ };
1868
2039
  this.intervalId = 0;
1869
2040
  this._state = {
1870
2041
  loading: false,
@@ -1876,7 +2047,7 @@ class ShipAidWidget extends s$1 {
1876
2047
  get: (url) => runRequest(url),
1877
2048
  post: (url, body) => runRequest(url, {
1878
2049
  method: "POST",
1879
- headers: { "Content-Type": "application/json" },
2050
+ headers: { "Content-Type": "application/json", "X-ShipAid": "1" },
1880
2051
  body: JSON.stringify(body)
1881
2052
  })
1882
2053
  };
@@ -1895,10 +2066,8 @@ class ShipAidWidget extends s$1 {
1895
2066
  }
1896
2067
  /** Getter to check if we should refresh the page or not */
1897
2068
  get shouldRefreshOnUpdate() {
1898
- if (this.disablePolling)
1899
- return false;
1900
- if (this.disableRefresh)
1901
- return false;
2069
+ if (this.disablePolling) return false;
2070
+ if (this.disableRefresh) return false;
1902
2071
  return true;
1903
2072
  }
1904
2073
  /** Getter to check whether to show the widget or not */
@@ -1932,16 +2101,13 @@ class ShipAidWidget extends s$1 {
1932
2101
  );
1933
2102
  }
1934
2103
  _handleRefreshCart() {
1935
- if (this.refreshCart)
1936
- return window.location.reload();
2104
+ if (this.refreshCart) return window.location.reload();
1937
2105
  }
1938
2106
  /** Handle cart or page refreshes */
1939
2107
  async _handleRefresh(input) {
1940
2108
  const isCart = Reflect.has(input, "items");
1941
- if (this.shouldRefreshOnUpdate)
1942
- return window.location.reload();
1943
- if (!isCart)
1944
- await this.updateCart();
2109
+ if (this.shouldRefreshOnUpdate) return window.location.reload();
2110
+ if (!isCart) await this.updateCart();
1945
2111
  this._dispatchEvent(Events.STATUS_UPDATE, {
1946
2112
  protection: this._hasProtectionInCart,
1947
2113
  cart: isCart ? input : this._cart,
@@ -1950,12 +2116,9 @@ class ShipAidWidget extends s$1 {
1950
2116
  }
1951
2117
  /** Given the current order, it calculates the protection total according to the store protection settings. */
1952
2118
  async calculateProtectionTotal(cart) {
1953
- if (!cart)
1954
- cart = await this._fetchCart();
1955
- if (!cart)
1956
- throw new Error("Could not fetch cart.");
1957
- if (!this._store)
1958
- 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");
1959
2122
  if (!this._protectionProduct) {
1960
2123
  throw new Error("Missing Shopify protection product");
1961
2124
  }
@@ -1970,8 +2133,7 @@ class ShipAidWidget extends s$1 {
1970
2133
  * This should be run whenever the cart updates, or it is manually triggered.
1971
2134
  */
1972
2135
  _findProtectionVariant(protectionFee) {
1973
- if (!this._store)
1974
- throw new Error("Missing ShipAid store");
2136
+ if (!this._store) throw new Error("Missing ShipAid store");
1975
2137
  if (!this._protectionProduct) {
1976
2138
  throw new Error("Missing Shopify protection product");
1977
2139
  }
@@ -1989,16 +2151,28 @@ class ShipAidWidget extends s$1 {
1989
2151
  error: state2 === "error" ? message || true : false
1990
2152
  };
1991
2153
  }
2154
+ /** Trigger confirmation popup */
2155
+ _handleConfirmationPopup() {
2156
+ if (this._popup === "confirmation") return;
2157
+ this._popup = "confirmation";
2158
+ }
1992
2159
  /** Updates the current protection status, calling the relevant add/remove function. */
1993
- async _updateProtection() {
1994
- return this._hasProtectionInCart ? this.removeProtection() : this.addProtection();
2160
+ _updateProtection() {
2161
+ var _a, _b, _c;
2162
+ const removeWithConfirmation = (_c = (_b = (_a = this._store) == null ? void 0 : _a.widgetConfigurations) == null ? void 0 : _b.widget) == null ? void 0 : _c.removeWithConfirmation;
2163
+ if (!this._hasProtectionInCart) {
2164
+ return this.addProtection();
2165
+ }
2166
+ if (!removeWithConfirmation) {
2167
+ return this.removeProtection();
2168
+ }
2169
+ return this._handleConfirmationPopup();
1995
2170
  }
1996
2171
  /** Fetches store info from the ShipAid public API. */
1997
2172
  async _fetchShipAidData() {
1998
2173
  var _a, _b, _c, _d, _e;
1999
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);
2000
- if (!shop)
2001
- throw new Error("No shop found in Shopify object.");
2175
+ if (!shop) throw new Error("No shop found in Shopify object.");
2002
2176
  try {
2003
2177
  const endpoint = new URL(window.location.href);
2004
2178
  endpoint.pathname = this._apiEndpoint;
@@ -2010,10 +2184,8 @@ class ShipAidWidget extends s$1 {
2010
2184
  endpoint.toString(),
2011
2185
  payload
2012
2186
  );
2013
- if (!response)
2014
- throw new Error("Missing response for store query.");
2015
- if ((_d = response.errors) == null ? void 0 : _d.length)
2016
- 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);
2017
2189
  if (!((_e = response.data) == null ? void 0 : _e.store)) {
2018
2190
  throw new Error("Missing store from store query response.");
2019
2191
  }
@@ -2039,8 +2211,7 @@ class ShipAidWidget extends s$1 {
2039
2211
  async _fetchSellingPlanFromVariant(subCartItemSellingPlan) {
2040
2212
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2041
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);
2042
- if (!shop)
2043
- throw new Error("No shop found in Shopify object.");
2214
+ if (!shop) throw new Error("No shop found in Shopify object.");
2044
2215
  try {
2045
2216
  const endpoint = new URL(window.location.href);
2046
2217
  endpoint.pathname = this._apiEndpoint;
@@ -2052,10 +2223,8 @@ class ShipAidWidget extends s$1 {
2052
2223
  endpoint.toString(),
2053
2224
  payload
2054
2225
  );
2055
- if (!response)
2056
- throw new Error("Missing response for selling plan query.");
2057
- if ((_e = response.errors) == null ? void 0 : _e.length)
2058
- 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);
2059
2228
  if (!((_f = response.data) == null ? void 0 : _f.sellingPlanFromVariant)) {
2060
2229
  throw new Error("Missing variant from selling plan query response.");
2061
2230
  }
@@ -2098,18 +2267,15 @@ class ShipAidWidget extends s$1 {
2098
2267
  }
2099
2268
  /** Update the internal cart, which will trigger any protection fee updates */
2100
2269
  async updateCart(cart) {
2101
- if (!cart)
2102
- cart = await this._fetchCart();
2270
+ if (!cart) cart = await this._fetchCart();
2103
2271
  this._cart = cart;
2104
2272
  }
2105
2273
  /** Add ShipAid shipping protection. */
2106
2274
  async addProtection() {
2107
2275
  var _a, _b;
2108
2276
  try {
2109
- if (!this._store)
2110
- throw new Error("Store has not been loaded.");
2111
- if (!((_a = this._cart) == null ? void 0 : _a.items))
2112
- 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.");
2113
2279
  if (!((_b = this._protectionVariant) == null ? void 0 : _b.id)) {
2114
2280
  throw new Error("No protection variant found.");
2115
2281
  }
@@ -2146,8 +2312,7 @@ class ShipAidWidget extends s$1 {
2146
2312
  /** Remove ShipAid shipping protection. */
2147
2313
  async removeProtection() {
2148
2314
  try {
2149
- if (!this._store)
2150
- throw new Error("Store has not been loaded.");
2315
+ if (!this._store) throw new Error("Store has not been loaded.");
2151
2316
  if (!this._protectionCartItem) {
2152
2317
  throw new Error("Protection product not found.");
2153
2318
  }
@@ -2174,10 +2339,8 @@ class ShipAidWidget extends s$1 {
2174
2339
  /** Try adding ShipAid shipping protection during polling if applicable */
2175
2340
  async attemptAddProtection() {
2176
2341
  var _a, _b, _c, _d, _e, _f;
2177
- if (!((_a = this._store) == null ? void 0 : _a.widgetAutoOptIn))
2178
- return;
2179
- if (!((_b = this._cart) == null ? void 0 : _b.items) || !((_c = this._cart) == null ? void 0 : _c.item_count))
2180
- 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;
2181
2344
  const protectionCartItemIndex = (_d = this._cart.items) == null ? void 0 : _d.findIndex((item) => {
2182
2345
  var _a2, _b2;
2183
2346
  return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some(
@@ -2186,11 +2349,9 @@ class ShipAidWidget extends s$1 {
2186
2349
  });
2187
2350
  const protectionCartItem = (_e = this._cart) == null ? void 0 : _e.items[protectionCartItemIndex];
2188
2351
  this._hasProtectionInCart = !!protectionCartItem;
2189
- if (this._cart.item_count === 1 && !!protectionCartItem)
2190
- return;
2352
+ if (this._cart.item_count === 1 && !!protectionCartItem) return;
2191
2353
  const hasSessionPayload = !!sessionStorage.getItem(LOCAL_STORAGE_KEY);
2192
- if (hasSessionPayload)
2193
- return;
2354
+ if (hasSessionPayload) return;
2194
2355
  if (
2195
2356
  // If we first check that no protection items are in the cart
2196
2357
  !this._hasProtectionInCart && // Then check we have some items in the cart
@@ -2206,14 +2367,12 @@ class ShipAidWidget extends s$1 {
2206
2367
  }
2207
2368
  async handleMultipleProtectionVariants() {
2208
2369
  var _a, _b, _c, _d, _e;
2209
- if (!((_a = this._cart) == null ? void 0 : _a.items) || !((_b = this._cart) == null ? void 0 : _b.item_count))
2210
- return;
2370
+ if (!((_a = this._cart) == null ? void 0 : _a.items) || !((_b = this._cart) == null ? void 0 : _b.item_count)) return;
2211
2371
  let count = 0;
2212
2372
  (_c = this._cart.items) == null ? void 0 : _c.forEach((item) => {
2213
2373
  var _a2, _b2;
2214
2374
  const isProtectionItem = (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some((variant) => variant.id === item.variant_id);
2215
- if (isProtectionItem)
2216
- count++;
2375
+ if (isProtectionItem) count++;
2217
2376
  });
2218
2377
  if (count > 1) {
2219
2378
  const protectionCartItemIndex = (_d = this._cart.items) == null ? void 0 : _d.findIndex((item) => {
@@ -2236,9 +2395,6 @@ class ShipAidWidget extends s$1 {
2236
2395
  }
2237
2396
  /** Templates */
2238
2397
  learnMorePopupTemplate() {
2239
- if (this.persistPopup) {
2240
- this._popup = this.shouldPersistPopup();
2241
- }
2242
2398
  return x`
2243
2399
  <shipaid-popup-learn-more
2244
2400
  ?active=${this._popup === "learn-more"}
@@ -2251,6 +2407,39 @@ class ShipAidWidget extends s$1 {
2251
2407
  ></shipaid-popup-learn-more>
2252
2408
  `;
2253
2409
  }
2410
+ confirmationPopupTemplate() {
2411
+ return x`
2412
+ <shipaid-popup-confirmation
2413
+ ?active=${this._popup === "confirmation"}
2414
+ @close=${() => {
2415
+ if (this.persistPopup) {
2416
+ localStorage.removeItem(`${LOCAL_STORAGE_SHIPAID_POPUP_KEY}`);
2417
+ }
2418
+ this._popup = null;
2419
+ }}
2420
+ @remove-protection=${() => {
2421
+ this.removeProtection();
2422
+ if (this.persistPopup) {
2423
+ localStorage.removeItem(`${LOCAL_STORAGE_SHIPAID_POPUP_KEY}`);
2424
+ }
2425
+ this._popup = null;
2426
+ }}
2427
+ ></shipaid-popup-confirmation>
2428
+ `;
2429
+ }
2430
+ renderPopups() {
2431
+ if (this.persistPopup) {
2432
+ this._popup = this.shouldPersistPopup();
2433
+ }
2434
+ switch (this._popup) {
2435
+ case "confirmation":
2436
+ return this.confirmationPopupTemplate();
2437
+ case "learn-more":
2438
+ return this.learnMorePopupTemplate();
2439
+ default:
2440
+ return null;
2441
+ }
2442
+ }
2254
2443
  promptTemplate() {
2255
2444
  var _a, _b, _c;
2256
2445
  const { useToggle, useCheckbox, leftCheckbox } = ((_b = (_a = this._store) == null ? void 0 : _a.widgetConfigurations) == null ? void 0 : _b.widget) || { useToggle: false, useCheckbox: false, leftCheckbox: false };
@@ -2344,6 +2533,136 @@ class ShipAidWidget extends s$1 {
2344
2533
  super.connectedCallback();
2345
2534
  await use(this.lang);
2346
2535
  this.hasLoadedStrings = true;
2536
+ this.fetchInterceptorCleanup = interceptFetch(async (args, promise) => {
2537
+ var _a, _b, _c, _d;
2538
+ console.debug("fetch:", args);
2539
+ if (((_b = (_a = args[1]) == null ? void 0 : _a.method) == null ? void 0 : _b.toUpperCase()) !== "POST") {
2540
+ return;
2541
+ }
2542
+ console.debug("s:", 1);
2543
+ if ((_d = (_c = args[1]) == null ? void 0 : _c.headers) == null ? void 0 : _d["X-ShipAid"]) {
2544
+ return;
2545
+ }
2546
+ console.debug("s:", 2);
2547
+ if (!args[0].startsWith("/cart/change") && !args[0].startsWith("/cart/update")) {
2548
+ return;
2549
+ }
2550
+ console.debug("s:", 3);
2551
+ const button = document.querySelector('button[type="submit"][name="checkout"][form="cart"]');
2552
+ console.log("q", button);
2553
+ if (!button) {
2554
+ return;
2555
+ }
2556
+ button.setAttribute("disabled", "true");
2557
+ console.debug("button", "t");
2558
+ try {
2559
+ await promise;
2560
+ await this.updateCart();
2561
+ await this.updateProtection();
2562
+ } finally {
2563
+ button.removeAttribute("disabled");
2564
+ console.debug("button", "f");
2565
+ }
2566
+ });
2567
+ }
2568
+ disconnectedCallback() {
2569
+ var _a;
2570
+ super.disconnectedCallback();
2571
+ (_a = this.fetchInterceptorCleanup) == null ? void 0 : _a.call(this);
2572
+ }
2573
+ async updateProtection() {
2574
+ var _a, _b, _c, _d;
2575
+ this._cartLastUpdated = /* @__PURE__ */ new Date();
2576
+ if (!((_a = this._cart) == null ? void 0 : _a.items)) return;
2577
+ const protectionCartItemIndex = (_b = this._cart.items) == null ? void 0 : _b.findIndex((item) => {
2578
+ var _a2, _b2;
2579
+ return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some(
2580
+ (variant) => variant.id === item.variant_id
2581
+ );
2582
+ });
2583
+ const protectionCartItem = (_c = this._cart) == null ? void 0 : _c.items[protectionCartItemIndex];
2584
+ this._hasProtectionInCart = !!protectionCartItem;
2585
+ if (!this._store) return;
2586
+ const protectionFee = await this.calculateProtectionTotal(this._cart);
2587
+ if (this._cart.item_count > 0 && !!protectionCartItem && (this._cart.total_price === (protectionCartItem == null ? void 0 : protectionCartItem.final_line_price) || !protectionFee)) {
2588
+ const removePayload = {
2589
+ id: protectionCartItem.key,
2590
+ quantity: 0
2591
+ };
2592
+ const cart2 = await this._fetch.post(
2593
+ "/cart/change.js",
2594
+ removePayload
2595
+ );
2596
+ sessionStorage.removeItem(LOCAL_STORAGE_KEY);
2597
+ return await this._handleRefresh(cart2);
2598
+ }
2599
+ const protectionVariant = this._findProtectionVariant(protectionFee);
2600
+ if (!protectionFee) {
2601
+ this._protectionVariant = {
2602
+ id: 0,
2603
+ price: "0"
2604
+ };
2605
+ } else {
2606
+ this._protectionVariant = protectionVariant;
2607
+ this._shouldShowWidget = true;
2608
+ }
2609
+ if (!(protectionVariant == null ? void 0 : protectionVariant.id)) {
2610
+ this._shouldShowWidget = false;
2611
+ logger.error("No matching protection variant found.");
2612
+ return;
2613
+ }
2614
+ if (!((_d = this._protectionVariant) == null ? void 0 : _d.id)) {
2615
+ this._shouldShowWidget = false;
2616
+ return;
2617
+ }
2618
+ if (!protectionCartItem) return;
2619
+ if (this.supportSubscriptions) {
2620
+ const itemWithSubscription = this._cart.items.find((item) => {
2621
+ var _a2;
2622
+ return item.id !== ((_a2 = this._protectionVariant) == null ? void 0 : _a2.id) && !!(item == null ? void 0 : item.selling_plan_allocation);
2623
+ });
2624
+ let updateSubscriptionPayload = null;
2625
+ if (!itemWithSubscription && (protectionCartItem == null ? void 0 : protectionCartItem.selling_plan_allocation)) {
2626
+ updateSubscriptionPayload = { id: protectionCartItem.key, quantity: 1, selling_plan: null };
2627
+ } else if (itemWithSubscription && !(protectionCartItem == null ? void 0 : protectionCartItem.selling_plan_allocation)) {
2628
+ const protectionSellingPlan = await this._fetchSellingPlanFromVariant(itemWithSubscription.selling_plan_allocation.selling_plan);
2629
+ const sellingPlanId = protectionSellingPlan ? getIdFromShopifyGid(protectionSellingPlan.id) : null;
2630
+ updateSubscriptionPayload = { id: protectionCartItem.key, quantity: 1, selling_plan: sellingPlanId };
2631
+ }
2632
+ if (updateSubscriptionPayload) {
2633
+ const cart2 = await this._fetch.post("/cart/change.js", updateSubscriptionPayload);
2634
+ await this._handleRefresh(cart2);
2635
+ }
2636
+ }
2637
+ if (protectionVariant.id === protectionCartItem.variant_id) {
2638
+ this._protectionCartItem = {
2639
+ ...protectionCartItem,
2640
+ index: protectionCartItemIndex,
2641
+ position: protectionCartItemIndex + 1
2642
+ };
2643
+ if (protectionCartItem.quantity === 1) return;
2644
+ const updatePayload2 = {
2645
+ id: protectionCartItem.key,
2646
+ quantity: 1
2647
+ };
2648
+ const cart2 = await this._fetch.post(
2649
+ "/cart/change.js",
2650
+ updatePayload2
2651
+ );
2652
+ this._handleRefreshCart();
2653
+ return await this._handleRefresh(cart2);
2654
+ }
2655
+ const updatePayload = {
2656
+ updates: {
2657
+ [protectionCartItem.variant_id]: 0,
2658
+ [protectionVariant.id]: 1
2659
+ }
2660
+ };
2661
+ const cart = await this._fetch.post(
2662
+ "/cart/update.js",
2663
+ updatePayload
2664
+ );
2665
+ await this._handleRefresh(cart);
2347
2666
  }
2348
2667
  render() {
2349
2668
  useOnce(this, async () => {
@@ -2395,16 +2714,13 @@ class ShipAidWidget extends s$1 {
2395
2714
  this._dispatchEvent(Events.LOADED, this._store);
2396
2715
  setTimeout(async () => {
2397
2716
  var _a2, _b2, _c2, _d2;
2398
- if (!((_a2 = this._store) == null ? void 0 : _a2.widgetAutoOptIn))
2399
- return;
2400
- if (!((_b2 = this._cart) == null ? void 0 : _b2.item_count))
2401
- return;
2717
+ if (!((_a2 = this._store) == null ? void 0 : _a2.widgetAutoOptIn)) return;
2718
+ if (!((_b2 = this._cart) == null ? void 0 : _b2.item_count)) return;
2402
2719
  if (this.customerId && this._store.excludedCustomersIdsAutoOptIn && ((_c2 = this._store.excludedCustomersIdsAutoOptIn) == null ? void 0 : _c2.length) && this._store.excludedCustomersIdsAutoOptIn.includes(`gid://shopify/Customer/${this.customerId}`)) {
2403
2720
  return;
2404
2721
  }
2405
2722
  const hasSessionPayload = !!sessionStorage.getItem(LOCAL_STORAGE_KEY);
2406
- if (hasSessionPayload)
2407
- return;
2723
+ if (hasSessionPayload) return;
2408
2724
  if (
2409
2725
  // If we first check that no protection items are in the cart
2410
2726
  !this._hasProtectionInCart && // Then check we have some items in the cart
@@ -2418,15 +2734,13 @@ class ShipAidWidget extends s$1 {
2418
2734
  );
2419
2735
  }
2420
2736
  }, 500);
2421
- if (this.disablePolling)
2422
- return;
2737
+ if (this.disablePolling) return;
2423
2738
  setInterval(async () => {
2424
2739
  const lastUpdated = this._cartLastUpdated;
2425
2740
  if (lastUpdated) {
2426
2741
  const now = /* @__PURE__ */ new Date();
2427
2742
  const msAgo = now.getTime() - lastUpdated.getTime();
2428
- if (msAgo < this.pollingInterval)
2429
- return;
2743
+ if (msAgo < this.pollingInterval) return;
2430
2744
  }
2431
2745
  await this.updateCart();
2432
2746
  }, this.pollingInterval);
@@ -2445,106 +2759,11 @@ class ShipAidWidget extends s$1 {
2445
2759
  useEffect(
2446
2760
  this,
2447
2761
  async () => {
2448
- var _a, _b, _c, _d;
2449
- this._cartLastUpdated = /* @__PURE__ */ new Date();
2450
- if (!((_a = this._cart) == null ? void 0 : _a.items))
2451
- return;
2452
- const protectionCartItemIndex = (_b = this._cart.items) == null ? void 0 : _b.findIndex((item) => {
2453
- var _a2, _b2;
2454
- return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some(
2455
- (variant) => variant.id === item.variant_id
2456
- );
2457
- });
2458
- const protectionCartItem = (_c = this._cart) == null ? void 0 : _c.items[protectionCartItemIndex];
2459
- this._hasProtectionInCart = !!protectionCartItem;
2460
- if (!this._store)
2461
- return;
2462
- const protectionFee = await this.calculateProtectionTotal(this._cart);
2463
- if (this._cart.item_count > 0 && !!protectionCartItem && (this._cart.total_price === (protectionCartItem == null ? void 0 : protectionCartItem.final_line_price) || !protectionFee)) {
2464
- const removePayload = {
2465
- id: protectionCartItem.key,
2466
- quantity: 0
2467
- };
2468
- const cart2 = await this._fetch.post(
2469
- "/cart/change.js",
2470
- removePayload
2471
- );
2472
- sessionStorage.removeItem(LOCAL_STORAGE_KEY);
2473
- return await this._handleRefresh(cart2);
2474
- }
2475
- const protectionVariant = this._findProtectionVariant(protectionFee);
2476
- if (!protectionFee) {
2477
- this._protectionVariant = {
2478
- id: 0,
2479
- price: "0"
2480
- };
2481
- } else {
2482
- this._protectionVariant = protectionVariant;
2483
- this._shouldShowWidget = true;
2484
- }
2485
- if (!(protectionVariant == null ? void 0 : protectionVariant.id)) {
2486
- this._shouldShowWidget = false;
2487
- logger.error("No matching protection variant found.");
2488
- return;
2489
- }
2490
- if (!((_d = this._protectionVariant) == null ? void 0 : _d.id)) {
2491
- this._shouldShowWidget = false;
2492
- return;
2493
- }
2494
- if (!protectionCartItem)
2495
- return;
2496
- if (this.supportSubscriptions) {
2497
- const itemWithSubscription = this._cart.items.find((item) => {
2498
- var _a2;
2499
- return item.id !== ((_a2 = this._protectionVariant) == null ? void 0 : _a2.id) && !!(item == null ? void 0 : item.selling_plan_allocation);
2500
- });
2501
- let updateSubscriptionPayload = null;
2502
- if (!itemWithSubscription && (protectionCartItem == null ? void 0 : protectionCartItem.selling_plan_allocation)) {
2503
- updateSubscriptionPayload = { id: protectionCartItem.key, quantity: 1, selling_plan: null };
2504
- } else if (itemWithSubscription && !(protectionCartItem == null ? void 0 : protectionCartItem.selling_plan_allocation)) {
2505
- const protectionSellingPlan = await this._fetchSellingPlanFromVariant(itemWithSubscription.selling_plan_allocation.selling_plan);
2506
- const sellingPlanId = protectionSellingPlan ? getIdFromShopifyGid(protectionSellingPlan.id) : null;
2507
- updateSubscriptionPayload = { id: protectionCartItem.key, quantity: 1, selling_plan: sellingPlanId };
2508
- }
2509
- if (updateSubscriptionPayload) {
2510
- const cart2 = await this._fetch.post("/cart/change.js", updateSubscriptionPayload);
2511
- await this._handleRefresh(cart2);
2512
- }
2513
- }
2514
- if (protectionVariant.id === protectionCartItem.variant_id) {
2515
- this._protectionCartItem = {
2516
- ...protectionCartItem,
2517
- index: protectionCartItemIndex,
2518
- position: protectionCartItemIndex + 1
2519
- };
2520
- if (protectionCartItem.quantity === 1)
2521
- return;
2522
- const updatePayload2 = {
2523
- id: protectionCartItem.key,
2524
- quantity: 1
2525
- };
2526
- const cart2 = await this._fetch.post(
2527
- "/cart/change.js",
2528
- updatePayload2
2529
- );
2530
- this._handleRefreshCart();
2531
- return await this._handleRefresh(cart2);
2532
- }
2533
- const updatePayload = {
2534
- updates: {
2535
- [protectionCartItem.variant_id]: 0,
2536
- [protectionVariant.id]: 1
2537
- }
2538
- };
2539
- const cart = await this._fetch.post(
2540
- "/cart/update.js",
2541
- updatePayload
2542
- );
2543
- await this._handleRefresh(cart);
2762
+ await this.updateProtection();
2544
2763
  },
2545
2764
  [this._store, this._cart]
2546
2765
  );
2547
- D(this.learnMorePopupTemplate(), document.body);
2766
+ D(this.renderPopups(), document.body);
2548
2767
  return x`
2549
2768
  <style>
2550
2769
  :host {
@@ -2827,83 +3046,87 @@ class ShipAidWidget extends s$1 {
2827
3046
  </div>
2828
3047
  `;
2829
3048
  }
2830
- }
2831
- ShipAidWidget.styles = styles;
3049
+ };
3050
+ _ShipAidWidget.styles = styles;
3051
+ let ShipAidWidget = _ShipAidWidget;
2832
3052
  __decorateClass([
2833
3053
  n$7({ type: Boolean, attribute: true })
2834
- ], ShipAidWidget.prototype, "disablePolling", 2);
3054
+ ], ShipAidWidget.prototype, "disablePolling");
2835
3055
  __decorateClass([
2836
3056
  n$7({ type: Boolean, attribute: true })
2837
- ], ShipAidWidget.prototype, "disableActions", 2);
3057
+ ], ShipAidWidget.prototype, "disableActions");
2838
3058
  __decorateClass([
2839
3059
  n$7({ type: Number, attribute: true })
2840
- ], ShipAidWidget.prototype, "pollingInterval", 2);
3060
+ ], ShipAidWidget.prototype, "pollingInterval");
2841
3061
  __decorateClass([
2842
3062
  n$7({ type: Boolean, attribute: true })
2843
- ], ShipAidWidget.prototype, "disableRefresh", 2);
3063
+ ], ShipAidWidget.prototype, "disableRefresh");
2844
3064
  __decorateClass([
2845
3065
  n$7({ type: Boolean, attribute: true })
2846
- ], ShipAidWidget.prototype, "refreshCart", 2);
3066
+ ], ShipAidWidget.prototype, "refreshCart");
2847
3067
  __decorateClass([
2848
3068
  n$7({ type: Boolean, attribute: true })
2849
- ], ShipAidWidget.prototype, "persistPopup", 2);
3069
+ ], ShipAidWidget.prototype, "persistPopup");
2850
3070
  __decorateClass([
2851
3071
  n$7({ type: Boolean, attribute: true })
2852
- ], ShipAidWidget.prototype, "defaultToggleButton", 2);
3072
+ ], ShipAidWidget.prototype, "defaultToggleButton");
2853
3073
  __decorateClass([
2854
3074
  n$7({ type: String, attribute: true })
2855
- ], ShipAidWidget.prototype, "lang", 2);
3075
+ ], ShipAidWidget.prototype, "lang");
2856
3076
  __decorateClass([
2857
3077
  n$7({ type: String, attribute: true })
2858
- ], ShipAidWidget.prototype, "currency", 2);
3078
+ ], ShipAidWidget.prototype, "currency");
2859
3079
  __decorateClass([
2860
3080
  n$7({ type: String, attribute: true })
2861
- ], ShipAidWidget.prototype, "customerId", 2);
3081
+ ], ShipAidWidget.prototype, "customerId");
2862
3082
  __decorateClass([
2863
3083
  n$7({ type: Boolean, attribute: true })
2864
- ], ShipAidWidget.prototype, "supportSubscriptions", 2);
3084
+ ], ShipAidWidget.prototype, "supportSubscriptions");
3085
+ __decorateClass([
3086
+ t$3()
3087
+ ], ShipAidWidget.prototype, "_storeDomain");
2865
3088
  __decorateClass([
2866
3089
  t$3()
2867
- ], ShipAidWidget.prototype, "_storeDomain", 2);
3090
+ ], ShipAidWidget.prototype, "_store");
2868
3091
  __decorateClass([
2869
3092
  t$3()
2870
- ], ShipAidWidget.prototype, "_store", 2);
3093
+ ], ShipAidWidget.prototype, "_cart");
2871
3094
  __decorateClass([
2872
3095
  t$3()
2873
- ], ShipAidWidget.prototype, "_cart", 2);
3096
+ ], ShipAidWidget.prototype, "_protectionProduct");
2874
3097
  __decorateClass([
2875
3098
  t$3()
2876
- ], ShipAidWidget.prototype, "_protectionProduct", 2);
3099
+ ], ShipAidWidget.prototype, "_cartLastUpdated");
2877
3100
  __decorateClass([
2878
3101
  t$3()
2879
- ], ShipAidWidget.prototype, "_cartLastUpdated", 2);
3102
+ ], ShipAidWidget.prototype, "_hasFinishedSetup");
2880
3103
  __decorateClass([
2881
3104
  t$3()
2882
- ], ShipAidWidget.prototype, "_hasFinishedSetup", 2);
3105
+ ], ShipAidWidget.prototype, "_shouldShowWidget");
2883
3106
  __decorateClass([
2884
3107
  t$3()
2885
- ], ShipAidWidget.prototype, "_shouldShowWidget", 2);
3108
+ ], ShipAidWidget.prototype, "_hasProtectionInCart");
2886
3109
  __decorateClass([
2887
3110
  t$3()
2888
- ], ShipAidWidget.prototype, "_hasProtectionInCart", 2);
3111
+ ], ShipAidWidget.prototype, "_protectionCartItem");
2889
3112
  __decorateClass([
2890
3113
  t$3()
2891
- ], ShipAidWidget.prototype, "_protectionCartItem", 2);
3114
+ ], ShipAidWidget.prototype, "_protectionVariant");
2892
3115
  __decorateClass([
2893
3116
  t$3()
2894
- ], ShipAidWidget.prototype, "_protectionVariant", 2);
3117
+ ], ShipAidWidget.prototype, "hasLoadedStrings");
2895
3118
  __decorateClass([
2896
3119
  t$3()
2897
- ], ShipAidWidget.prototype, "hasLoadedStrings", 2);
3120
+ ], ShipAidWidget.prototype, "fetchInterceptorCleanup");
2898
3121
  __decorateClass([
2899
3122
  t$3()
2900
- ], ShipAidWidget.prototype, "intervalId", 2);
3123
+ ], ShipAidWidget.prototype, "intervalId");
2901
3124
  __decorateClass([
2902
3125
  t$3()
2903
- ], ShipAidWidget.prototype, "_state", 2);
3126
+ ], ShipAidWidget.prototype, "_state");
2904
3127
  __decorateClass([
2905
3128
  t$3()
2906
- ], ShipAidWidget.prototype, "_popup", 2);
3129
+ ], ShipAidWidget.prototype, "_popup");
2907
3130
  if (!customElements.get("shipaid-widget")) {
2908
3131
  customElements.define("shipaid-widget", ShipAidWidget);
2909
3132
  }