ui.shipaid.com 0.2.9 → 0.2.11

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/README.md CHANGED
@@ -14,6 +14,30 @@ Once we have this data, we can check whether the customer currently has the Ship
14
14
 
15
15
  We also emit various [custom events](https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events#adding_custom_data_%E2%80%93_customevent) when we add or remove the ShipAid product from the cart, so other developers can listen to these events, and update AJAX carts.
16
16
 
17
+ ### Installation
18
+
19
+ Add the script tag to the theme - if the theme has an ajax cart, you'll likely want to add this to the `theme.liquid` file, otherwise if the store has only a cart page (`/cart`), then you can add it to just that page, to save it being unecessarily loaded when it isn't needed.
20
+ As we don't want to affect a stores speed at all, you should add it to the bottom of the page just before the ending body tag (`</body>`), rather than inside the `<head>` block.
21
+
22
+ ```html
23
+ <!-- ShipAid Widget -->
24
+ <script src="https://unpkg.com/ui.shipaid.com/dist/widget.es.js" type="module"></script>
25
+ ```
26
+ Then add the widget element where needed:
27
+
28
+ ```html
29
+ <shipaid-widget></shipaid-widget>
30
+
31
+ <!-- Disable polling example -->
32
+ <shipaid-widget disablePolling></shipaid-widget>
33
+
34
+ <!-- With customised text -->
35
+ <shipaid-widget>
36
+ <p>Loading ShipAid Protection</p>
37
+ </shipaid-widget>
38
+ ```
39
+
40
+
17
41
  ### Events
18
42
 
19
43
  This is a list of the events emitted by the widget:
@@ -42,7 +66,7 @@ This is a list of props that can be used to configure the widget:
42
66
  |--------|-------------|---------|
43
67
  | `disablePolling` | Sets whether the cart should disable polling (enabled by default) - should be disabled if integrating manually with an ajax cart. | `boolean` |
44
68
  | `pollingInterval` | If polling is enabled, it sets the interval (in ms) between API updates. | `number` in milliseconds |
45
- | `disableRefresh ` | Sets whether the store cart should be updated when the protection item is added/removed. Set to `true` if you want to initially hide the protection product from the cart, even if it has just been added. | `boolean` |
69
+ | `disableRefresh ` | Sets whether the store cart should be updated when the protection item is added/removed. Add if you want to initially hide the protection product from the cart, even if it has just been added. | `boolean` |
46
70
 
47
71
  ## Contributing
48
72
 
@@ -67,10 +91,12 @@ Once the project is running, add the below to your development Shopify store `th
67
91
  ```html
68
92
  <!-- Dev -->
69
93
  <script src="http://localhost:3000/src/shipaid-widget.ts"type="module" ></script>
94
+
70
95
  <!-- Prod -->
96
+ <!-- ShipAid Widget -->
71
97
  <script src="https://unpkg.com/ui.shipaid.com/dist/widget.es.js" type="module"></script>
72
98
  ```
73
- And add the widget element in your cart (likely `/sections/main-cart-items.liquid`):
99
+ And add the widget element where needed:
74
100
 
75
101
  ```html
76
102
  <shipaid-widget>
package/dist/widget.es.js CHANGED
@@ -834,16 +834,17 @@ const styles = i$1`
834
834
  width: auto;
835
835
  }
836
836
  .shipaid-prompt
837
- .prompt-product
838
- .prompt-product-details
839
- .prompt-product-details-title {
837
+ .prompt-product
838
+ .prompt-product-details
839
+ .prompt-product-details-title {
840
+ text-align: left;
840
841
  font-size: var(--shipaid-font-sm);
841
842
  font-weight: var(--shipaid-font-heavy);
842
843
  }
843
844
  .shipaid-prompt
844
- .prompt-product
845
- .prompt-product-details
846
- .prompt-product-details-description {
845
+ .prompt-product
846
+ .prompt-product-details
847
+ .prompt-product-details-description {
847
848
  font-size: var(--shipaid-font-xs);
848
849
  margin-top: 0.65rem;
849
850
  }
@@ -1085,6 +1086,8 @@ const logger = {
1085
1086
  };
1086
1087
  const POLL_INTERVAL_DEFAULT = 2500;
1087
1088
  const LOCAL_STORAGE_KEY = "shipaid-protection";
1089
+ const PRODUCT_HANDLE = "shipaid-protection";
1090
+ const PREVIEW_FLAG = "shipaid-test";
1088
1091
  const StoreQuery = `query StoreByDomain ($store: String!) {
1089
1092
  store: storeByDomain (input: {store: $store}) {
1090
1093
  currency
@@ -1124,9 +1127,6 @@ let ShipAidWidget = class extends s {
1124
1127
  };
1125
1128
  }
1126
1129
  get shouldRefreshOnUpdate() {
1127
- var _a;
1128
- if ((_a = window.Shopify) == null ? void 0 : _a.Checkout)
1129
- return true;
1130
1130
  if (this.disablePolling)
1131
1131
  return false;
1132
1132
  if (this.disableRefresh)
@@ -1135,8 +1135,11 @@ let ShipAidWidget = class extends s {
1135
1135
  }
1136
1136
  get planActive() {
1137
1137
  var _a, _b;
1138
- if ((_a = window.Shopify) == null ? void 0 : _a.designMode)
1138
+ const { searchParams } = new URL(window.location.href);
1139
+ if (((_a = window.Shopify) == null ? void 0 : _a.designMode) || searchParams.has(PREVIEW_FLAG)) {
1140
+ logger.warn("Currently in preview mode.");
1139
1141
  return true;
1142
+ }
1140
1143
  return !!((_b = this._store) == null ? void 0 : _b.planActive);
1141
1144
  }
1142
1145
  _currencyFormat(value) {
@@ -1172,33 +1175,23 @@ let ShipAidWidget = class extends s {
1172
1175
  if (!this._store)
1173
1176
  throw new Error("Missing store settings.");
1174
1177
  const settings = (_a = this._store) == null ? void 0 : _a.protectionSettings;
1175
- if (!settings || !settings.product) {
1176
- throw new Error(
1177
- "Tried to find protection variant, but protection settings for this store are missing."
1178
- );
1178
+ if (!settings || !this._protectionProduct) {
1179
+ throw new Error("Tried to find protection variant, but protection settings for this store are missing.");
1179
1180
  }
1180
1181
  const itemTotal = ((_b = this._store) == null ? void 0 : _b.excludedProductSkus) && cart.items ? cart.items.reduce((total, item) => {
1181
1182
  if (!item.sku)
1182
1183
  return total;
1183
- const itemIsExcluded = this._store.excludedProductSkus.find(
1184
- (sku) => sku === item.sku
1185
- );
1184
+ const itemIsExcluded = this._store.excludedProductSkus.find((sku) => sku === item.sku);
1186
1185
  return itemIsExcluded ? total - item.final_price : total;
1187
1186
  }, cart.total_price) : cart.total_price;
1188
1187
  const protectionVariantsInCart = (_d = (_c = cart.items) == null ? void 0 : _c.filter((item) => {
1189
- var _a2, _b2, _c2;
1190
- return (_c2 = (_b2 = (_a2 = settings.product) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.edges) == null ? void 0 : _c2.some(({ node }) => {
1191
- var _a3;
1192
- return (_a3 = node == null ? void 0 : node.id) == null ? void 0 : _a3.includes(item.variant_id.toString());
1193
- });
1188
+ var _a2, _b2;
1189
+ return (_b2 = (_a2 = this._protectionProduct) == null ? void 0 : _a2.variants) == null ? void 0 : _b2.some((variant) => variant.id === item.variant_id);
1194
1190
  })) != null ? _d : [];
1195
- const protectionVariantsInCartTotal = protectionVariantsInCart.reduce(
1196
- (total, item) => {
1197
- const updatedTotal = total += item.final_line_price;
1198
- return updatedTotal;
1199
- },
1200
- 0
1201
- );
1191
+ const protectionVariantsInCartTotal = protectionVariantsInCart.reduce((total, item) => {
1192
+ const updatedTotal = total += item.final_line_price;
1193
+ return updatedTotal;
1194
+ }, 0);
1202
1195
  const cartTotal = itemTotal - protectionVariantsInCartTotal;
1203
1196
  if (settings.protectionType === "FIXED") {
1204
1197
  if (!settings.defaultFee)
@@ -1228,20 +1221,18 @@ let ShipAidWidget = class extends s {
1228
1221
  throw new Error("No protection type handler found for this store.");
1229
1222
  }
1230
1223
  _findProtectionVariant(protectionFee) {
1231
- var _a, _b, _c;
1224
+ var _a, _b, _c, _d;
1232
1225
  const settings = (_a = this._store) == null ? void 0 : _a.protectionSettings;
1233
- if (!settings || !((_c = (_b = settings.product) == null ? void 0 : _b.variants) == null ? void 0 : _c.edges)) {
1226
+ if (!settings || !((_c = (_b = this._protectionProduct) == null ? void 0 : _b.variants) == null ? void 0 : _c.length)) {
1234
1227
  throw new Error("Missing product and variants from protection settings.");
1235
1228
  }
1236
- const formattedVariants = settings.product.variants.edges.flatMap(({ node: variant }) => {
1229
+ const formattedVariants = (_d = this._protectionProduct) == null ? void 0 : _d.variants.flatMap((variant) => {
1237
1230
  if (!variant || !variant.price)
1238
1231
  return [];
1239
1232
  const formattedPrice = Number(variant.price);
1240
1233
  return [{ ...variant, formattedPrice }];
1241
1234
  }).sort((a2, b2) => a2.formattedPrice - b2.formattedPrice);
1242
- const matchingVariant = formattedVariants.find(
1243
- (variant) => variant.formattedPrice >= protectionFee
1244
- );
1235
+ const matchingVariant = formattedVariants.find((variant) => variant.formattedPrice >= protectionFee);
1245
1236
  if (!matchingVariant) {
1246
1237
  return formattedVariants[formattedVariants.length - 1];
1247
1238
  }
@@ -1296,6 +1287,16 @@ let ShipAidWidget = class extends s {
1296
1287
  throw new Error("Could not fetch cart for current domain.");
1297
1288
  }
1298
1289
  }
1290
+ async _fetchProduct() {
1291
+ try {
1292
+ const { product } = await this._fetch.get(`/products/${PRODUCT_HANDLE}.json`);
1293
+ return product;
1294
+ } catch (err) {
1295
+ const error = err;
1296
+ logger.error(error.message);
1297
+ throw new Error("Could not fetch protection product for current domain.");
1298
+ }
1299
+ }
1299
1300
  hasProtection() {
1300
1301
  return this._hasProtectionInCart;
1301
1302
  }
@@ -1316,12 +1317,8 @@ let ShipAidWidget = class extends s {
1316
1317
  }
1317
1318
  this._setState("loading");
1318
1319
  const payload = {
1319
- id: this._protectionVariant.id.replace(
1320
- "gid://shopify/ProductVariant/",
1321
- ""
1322
- ),
1323
1320
  quantity: 1,
1324
- sections: "main-cart-items,main-cart-footer"
1321
+ id: this._protectionVariant.id
1325
1322
  };
1326
1323
  const cartItem = await this._fetch.post(
1327
1324
  "/cart/add.js",
@@ -1348,9 +1345,8 @@ let ShipAidWidget = class extends s {
1348
1345
  }
1349
1346
  this._setState("loading");
1350
1347
  const payload = {
1351
- id: this._protectionCartItem.key,
1352
1348
  quantity: 0,
1353
- sections: "main-cart-items,main-cart-footer"
1349
+ id: this._protectionCartItem.key
1354
1350
  };
1355
1351
  const cart = await this._fetch.post(
1356
1352
  "/cart/change.js",
@@ -1372,7 +1368,7 @@ let ShipAidWidget = class extends s {
1372
1368
  render() {
1373
1369
  var _a;
1374
1370
  useOnce(this, async () => {
1375
- var _a2, _b, _c, _d;
1371
+ var _a2, _b;
1376
1372
  const linkEl = document.createElement("link");
1377
1373
  linkEl.setAttribute(
1378
1374
  "href",
@@ -1389,12 +1385,14 @@ let ShipAidWidget = class extends s {
1389
1385
  logger.warn("Failed to parse local storage.");
1390
1386
  }
1391
1387
  try {
1392
- const [storeData, cartData] = await Promise.all([
1388
+ const [storeData, cartData, productData] = await Promise.all([
1393
1389
  this._fetchShipAidData(),
1394
- this._fetchCart()
1390
+ this._fetchCart(),
1391
+ this._fetchProduct()
1395
1392
  ]);
1396
1393
  this._store = storeData;
1397
1394
  this._cart = cartData;
1395
+ this._protectionProduct = productData;
1398
1396
  } catch (error) {
1399
1397
  this._hasFinishedSetup = true;
1400
1398
  this._shouldShowWidget = false;
@@ -1412,7 +1410,7 @@ let ShipAidWidget = class extends s {
1412
1410
  this._shouldShowWidget = false;
1413
1411
  return;
1414
1412
  }
1415
- if (!((_d = (_c = this._store) == null ? void 0 : _c.protectionSettings) == null ? void 0 : _d.product)) {
1413
+ if (!this._protectionProduct) {
1416
1414
  logger.warn("No protection settings product for this store - skipping setup.");
1417
1415
  this._hasFinishedSetup = true;
1418
1416
  this._shouldShowWidget = false;
@@ -1456,20 +1454,15 @@ let ShipAidWidget = class extends s {
1456
1454
  useEffect(
1457
1455
  this,
1458
1456
  async () => {
1459
- var _a2, _b, _c, _d, _e;
1457
+ var _a2, _b, _c;
1460
1458
  this._cartLastUpdated = new Date();
1461
1459
  if (!((_a2 = this._cart) == null ? void 0 : _a2.items))
1462
1460
  return;
1463
- const protectionCartItemIndex = (_c = (_b = this._cart.items) == null ? void 0 : _b.findIndex((item) => {
1464
- var _a3, _b2, _c2, _d2, _e2;
1465
- return (_e2 = (_d2 = (_c2 = (_b2 = (_a3 = this._store) == null ? void 0 : _a3.protectionSettings) == null ? void 0 : _b2.product) == null ? void 0 : _c2.variants) == null ? void 0 : _d2.edges) == null ? void 0 : _e2.some(
1466
- ({ node }) => {
1467
- var _a4;
1468
- return (_a4 = node == null ? void 0 : node.id) == null ? void 0 : _a4.includes(item.variant_id.toString());
1469
- }
1470
- );
1471
- })) != null ? _c : [];
1472
- const protectionCartItem = (_d = this._cart) == null ? void 0 : _d.items[protectionCartItemIndex];
1461
+ const protectionCartItemIndex = (_b = this._cart.items) == null ? void 0 : _b.findIndex((item) => {
1462
+ var _a3, _b2;
1463
+ return (_b2 = (_a3 = this._protectionProduct) == null ? void 0 : _a3.variants) == null ? void 0 : _b2.some((variant) => variant.id === item.variant_id);
1464
+ });
1465
+ const protectionCartItem = (_c = this._cart) == null ? void 0 : _c.items[protectionCartItemIndex];
1473
1466
  this._hasProtectionInCart = !!protectionCartItem;
1474
1467
  if (this._cart.item_count === 1 && !!protectionCartItem) {
1475
1468
  const removePayload2 = {
@@ -1492,13 +1485,20 @@ let ShipAidWidget = class extends s {
1492
1485
  }
1493
1486
  if (!protectionCartItem)
1494
1487
  return;
1495
- if ((_e = protectionVariant.id) == null ? void 0 : _e.includes(protectionCartItem.id.toString())) {
1488
+ if (protectionVariant.id === protectionCartItem.id) {
1496
1489
  this._protectionCartItem = {
1497
1490
  ...protectionCartItem,
1498
1491
  index: protectionCartItemIndex,
1499
1492
  position: protectionCartItemIndex + 1
1500
1493
  };
1501
- return;
1494
+ if (protectionCartItem.quantity === 1)
1495
+ return;
1496
+ const updatePayload = {
1497
+ id: protectionCartItem.key,
1498
+ quantity: 1
1499
+ };
1500
+ const cart = await this._fetch.post("/cart/change.js", updatePayload);
1501
+ return await this._handleRefresh(cart);
1502
1502
  }
1503
1503
  const removePayload = {
1504
1504
  id: protectionCartItem.key,
@@ -1506,9 +1506,8 @@ let ShipAidWidget = class extends s {
1506
1506
  };
1507
1507
  await this._fetch.post("/cart/change.js", removePayload);
1508
1508
  const addPayload = {
1509
- id: protectionVariant.id.replace("gid://shopify/ProductVariant/", ""),
1510
1509
  quantity: 1,
1511
- sections: "main-cart-items"
1510
+ id: protectionVariant.id
1512
1511
  };
1513
1512
  const cartItem = await this._fetch.post(
1514
1513
  "/cart/add.js",
@@ -1591,10 +1590,10 @@ let ShipAidWidget = class extends s {
1591
1590
  </div>
1592
1591
  <div class="prompt-product-details">
1593
1592
  <p class="prompt-product-details-title">
1594
- Package Protection
1593
+ <slot name="title">Package Protection</slot>
1595
1594
  </p>
1596
1595
  <p class="prompt-product-details-description">
1597
- from Loss, Damage or Theft
1596
+ <slot name="subtitle">from Loss, Damage or Theft</slot>
1598
1597
  </p>
1599
1598
  </div>
1600
1599
  <div class="prompt-product-actions">
@@ -1647,7 +1646,7 @@ let ShipAidWidget = class extends s {
1647
1646
  () => y``
1648
1647
  );
1649
1648
  },
1650
- () => y`<p><slot>Loading ShipAid Widget...</slot></p>`
1649
+ () => y`<p><slot name="loading" default>Loading ShipAid Widget...</slot></p>`
1651
1650
  )}
1652
1651
  </div>
1653
1652
  `;
@@ -1672,6 +1671,9 @@ __decorateClass([
1672
1671
  __decorateClass([
1673
1672
  t$2()
1674
1673
  ], ShipAidWidget.prototype, "_cart", 2);
1674
+ __decorateClass([
1675
+ t$2()
1676
+ ], ShipAidWidget.prototype, "_protectionProduct", 2);
1675
1677
  __decorateClass([
1676
1678
  t$2()
1677
1679
  ], ShipAidWidget.prototype, "_cartLastUpdated", 2);
@@ -24,7 +24,7 @@ var ShipAidWidget=function(t){"use strict";
24
24
  * Copyright 2019 Google LLC
25
25
  * SPDX-License-Identifier: BSD-3-Clause
26
26
  */
27
- const s=window,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;class p{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}}const d=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new p("string"==typeof t?t:t+"",void 0,a))(e)})(t):t
27
+ const s=window,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),p=new WeakMap;class l{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=p.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&p.set(e,t))}return t}toString(){return this.cssText}}const d=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new l("string"==typeof t?t:t+"",void 0,a))(e)})(t):t
28
28
  /**
29
29
  * @license
30
30
  * Copyright 2017 Google LLC
@@ -35,19 +35,19 @@ const s=window,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"
35
35
  * Copyright 2017 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
37
37
  */
38
- var y;C.finalized=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},null==v||v({ReactiveElement:C}),(null!==(h=c.reactiveElementVersions)&&void 0!==h?h:c.reactiveElementVersions=[]).push("1.4.1");const w=window,$=w.trustedTypes,L=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,A=`lit$${(Math.random()+"").slice(9)}$`,S="?"+A,b=`<${S}>`,x=document,E=(t="")=>x.createComment(t),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,k=Array.isArray,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,U=/>/g,z=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),O=/'/g,N=/"/g,I=/^(?:script|style|textarea|title)$/i,R=(B=1,(t,...e)=>({_$litType$:B,strings:t,values:e})),W=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),D=new WeakMap,j=x.createTreeWalker(x,129,null,!1);var B;class F{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[l,p]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=M;for(let l=0;l<i;l++){const e=t[l];let i,a,p=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===M?"!--"===a[1]?n=T:void 0!==a[1]?n=U:void 0!==a[2]?(I.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=z):void 0!==a[3]&&(n=z):n===z?">"===a[0]?(n=null!=r?r:M,p=-1):void 0===a[1]?p=-2:(p=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?z:'"'===a[3]?N:O):n===N||n===O?n=z:n===T||n===U?n=M:(n=z,r=void 0);const h=n===z&&t[l+1].startsWith("/>")?" ":"";s+=n===M?e+b:p>=0?(o.push(i),e.slice(0,p)+"$lit$"+e.slice(p)+A+h):e+A+(-2===p?(o.push(void 0),l):h)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==L?L.createHTML(a):a,o]})(t,e);if(this.el=F.createElement(l,i),j.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=j.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(A)){const i=p[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(A),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?K:"?"===e[1]?G:"@"===e[1]?X:J})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(I.test(o.tagName)){const t=o.textContent.split(A),e=t.length-1;if(e>0){o.textContent=$?$.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],E()),j.nextNode(),a.push({type:2,index:++r});o.append(t[e],E())}}}else if(8===o.nodeType)if(o.data===S)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(A,t+1));)a.push({type:7,index:r}),t+=A.length-1}r++}}static createElement(t,e){const i=x.createElement("template");return i.innerHTML=t,i}}function Z(t,e,i=t,o){var r,s,n,a;if(e===W)return e;let l=void 0!==o?null===(r=i._$Cl)||void 0===r?void 0:r[o]:i._$Cu;const p=P(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==p&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===p?l=void 0:(l=new p(t),l._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[o]=l:i._$Cu=l),void 0!==l&&(e=Z(t,l._$AS(t,e.values),l,o)),e}class V{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:x).importNode(i,!0);j.currentNode=r;let s=j.nextNode(),n=0,a=0,l=o[0];for(;void 0!==l;){if(n===l.index){let e;2===l.type?e=new q(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new Q(s,this,t)),this.v.push(e),l=o[++a]}n!==(null==l?void 0:l.index)&&(s=j.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class q{constructor(t,e,i,o){var r;this.type=2,this._$AH=H,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$C_=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$C_}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),P(t)?t===H||null==t||""===t?(this._$AH!==H&&this._$AR(),this._$AH=H):t!==this._$AH&&t!==W&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>k(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.O(t):this.$(t)}S(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}$(t){this._$AH!==H&&P(this._$AH)?this._$AA.nextSibling.data=t:this.k(x.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=F.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new V(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=D.get(t.strings);return void 0===e&&D.set(t.strings,e=new F(t)),e}O(t){k(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new q(this.S(E()),this.S(E()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$C_=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class J{constructor(t,e,i,o,r){this.type=1,this._$AH=H,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=H}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=Z(this,t,e,0),s=!P(t)||t!==this._$AH&&t!==W,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Z(this,o[i+n],e,n),a===W&&(a=this._$AH[n]),s||(s=!P(a)||a!==this._$AH[n]),a===H?t=H:t!==H&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.P(t)}P(t){t===H?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class K extends J{constructor(){super(...arguments),this.type=3}P(t){this.element[this.name]=t===H?void 0:t}}const Y=$?$.emptyScript:"";class G extends J{constructor(){super(...arguments),this.type=4}P(t){t&&t!==H?this.element.setAttribute(this.name,Y):this.element.removeAttribute(this.name)}}class X extends J{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Z(this,t,e,0))&&void 0!==i?i:H)===W)return;const o=this._$AH,r=t===H&&o!==H||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==H&&(o===H||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Q{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Z(this,t)}}const tt=w.litHtmlPolyfillSupport;
38
+ var y;C.finalized=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},null==v||v({ReactiveElement:C}),(null!==(h=c.reactiveElementVersions)&&void 0!==h?h:c.reactiveElementVersions=[]).push("1.4.1");const w=window,$=w.trustedTypes,L=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,A=`lit$${(Math.random()+"").slice(9)}$`,S="?"+A,b=`<${S}>`,x=document,E=(t="")=>x.createComment(t),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,k=Array.isArray,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,U=/>/g,z=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),O=/'/g,N=/"/g,R=/^(?:script|style|textarea|title)$/i,I=(B=1,(t,...e)=>({_$litType$:B,strings:t,values:e})),W=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),D=new WeakMap,j=x.createTreeWalker(x,129,null,!1);var B;class F{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[p,l]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=M;for(let p=0;p<i;p++){const e=t[p];let i,a,l=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===M?"!--"===a[1]?n=T:void 0!==a[1]?n=U:void 0!==a[2]?(R.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=z):void 0!==a[3]&&(n=z):n===z?">"===a[0]?(n=null!=r?r:M,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?z:'"'===a[3]?N:O):n===N||n===O?n=z:n===T||n===U?n=M:(n=z,r=void 0);const h=n===z&&t[p+1].startsWith("/>")?" ":"";s+=n===M?e+b:l>=0?(o.push(i),e.slice(0,l)+"$lit$"+e.slice(l)+A+h):e+A+(-2===l?(o.push(void 0),p):h)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==L?L.createHTML(a):a,o]})(t,e);if(this.el=F.createElement(p,i),j.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=j.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(A)){const i=l[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(A),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?K:"?"===e[1]?G:"@"===e[1]?X:J})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(R.test(o.tagName)){const t=o.textContent.split(A),e=t.length-1;if(e>0){o.textContent=$?$.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],E()),j.nextNode(),a.push({type:2,index:++r});o.append(t[e],E())}}}else if(8===o.nodeType)if(o.data===S)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(A,t+1));)a.push({type:7,index:r}),t+=A.length-1}r++}}static createElement(t,e){const i=x.createElement("template");return i.innerHTML=t,i}}function Z(t,e,i=t,o){var r,s,n,a;if(e===W)return e;let p=void 0!==o?null===(r=i._$Cl)||void 0===r?void 0:r[o]:i._$Cu;const l=P(e)?void 0:e._$litDirective$;return(null==p?void 0:p.constructor)!==l&&(null===(s=null==p?void 0:p._$AO)||void 0===s||s.call(p,!1),void 0===l?p=void 0:(p=new l(t),p._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[o]=p:i._$Cu=p),void 0!==p&&(e=Z(t,p._$AS(t,e.values),p,o)),e}class q{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:x).importNode(i,!0);j.currentNode=r;let s=j.nextNode(),n=0,a=0,p=o[0];for(;void 0!==p;){if(n===p.index){let e;2===p.type?e=new V(s,s.nextSibling,this,t):1===p.type?e=new p.ctor(s,p.name,p.strings,this,t):6===p.type&&(e=new Q(s,this,t)),this.v.push(e),p=o[++a]}n!==(null==p?void 0:p.index)&&(s=j.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class V{constructor(t,e,i,o){var r;this.type=2,this._$AH=H,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$C_=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$C_}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),P(t)?t===H||null==t||""===t?(this._$AH!==H&&this._$AR(),this._$AH=H):t!==this._$AH&&t!==W&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>k(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.O(t):this.$(t)}S(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}$(t){this._$AH!==H&&P(this._$AH)?this._$AA.nextSibling.data=t:this.k(x.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=F.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new q(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=D.get(t.strings);return void 0===e&&D.set(t.strings,e=new F(t)),e}O(t){k(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new V(this.S(E()),this.S(E()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$C_=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class J{constructor(t,e,i,o,r){this.type=1,this._$AH=H,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=H}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=Z(this,t,e,0),s=!P(t)||t!==this._$AH&&t!==W,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Z(this,o[i+n],e,n),a===W&&(a=this._$AH[n]),s||(s=!P(a)||a!==this._$AH[n]),a===H?t=H:t!==H&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.P(t)}P(t){t===H?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class K extends J{constructor(){super(...arguments),this.type=3}P(t){this.element[this.name]=t===H?void 0:t}}const Y=$?$.emptyScript:"";class G extends J{constructor(){super(...arguments),this.type=4}P(t){t&&t!==H?this.element.setAttribute(this.name,Y):this.element.removeAttribute(this.name)}}class X extends J{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Z(this,t,e,0))&&void 0!==i?i:H)===W)return;const o=this._$AH,r=t===H&&o!==H||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==H&&(o===H||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Q{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Z(this,t)}}const tt=w.litHtmlPolyfillSupport;
39
39
  /**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
43
  */
44
- var et,it;null==tt||tt(F,q),(null!==(y=w.litHtmlVersions)&&void 0!==y?y:w.litHtmlVersions=[]).push("2.3.1");class ot extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new q(e.insertBefore(E(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return W}}ot.finalized=!0,ot._$litElement$=!0,null===(et=globalThis.litElementHydrateSupport)||void 0===et||et.call(globalThis,{LitElement:ot});const rt=globalThis.litElementPolyfillSupport;null==rt||rt({LitElement:ot}),(null!==(it=globalThis.litElementVersions)&&void 0!==it?it:globalThis.litElementVersions=[]).push("3.2.0");const st="__registered_effects";function nt(t){const e=t;if(e[st])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[st]={index:0,count:0,effects:[]},i.updated=t=>(e[st].index=0,o(t)),e}function at(t,e,i){const o=function(t,e){const i=nt(t),{index:o,count:r}=i[st];return o===r?(i[st].index++,i[st].count++,i[st].effects.push(e),e):(i[st].index++,i[st].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
44
+ var et,it;null==tt||tt(F,V),(null!==(y=w.litHtmlVersions)&&void 0!==y?y:w.litHtmlVersions=[]).push("2.3.1");class ot extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new V(e.insertBefore(E(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return W}}ot.finalized=!0,ot._$litElement$=!0,null===(et=globalThis.litElementHydrateSupport)||void 0===et||et.call(globalThis,{LitElement:ot});const rt=globalThis.litElementPolyfillSupport;null==rt||rt({LitElement:ot}),(null!==(it=globalThis.litElementVersions)&&void 0!==it?it:globalThis.litElementVersions=[]).push("3.2.0");const st="__registered_effects";function nt(t){const e=t;if(e[st])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[st]={index:0,count:0,effects:[]},i.updated=t=>(e[st].index=0,o(t)),e}function at(t,e,i){const o=function(t,e){const i=nt(t),{index:o,count:r}=i[st];return o===r?(i[st].index++,i[st].count++,i[st].effects.push(e),e):(i[st].index++,i[st].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
45
45
  /**
46
46
  * @license
47
47
  * Copyright 2021 Google LLC
48
48
  * SPDX-License-Identifier: BSD-3-Clause
49
49
  */
50
- function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new p(i,t,a)})`
50
+ function pt(t,e,i){return t?e():null==i?void 0:i()}const lt=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new l(i,t,a)})`
51
51
  :host {
52
52
  --shipaid-primary: #002bd6;
53
53
  --shipaid-secondary: #0076ff;
@@ -228,16 +228,17 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
228
228
  width: auto;
229
229
  }
230
230
  .shipaid-prompt
231
- .prompt-product
232
- .prompt-product-details
233
- .prompt-product-details-title {
231
+ .prompt-product
232
+ .prompt-product-details
233
+ .prompt-product-details-title {
234
+ text-align: left;
234
235
  font-size: var(--shipaid-font-sm);
235
236
  font-weight: var(--shipaid-font-heavy);
236
237
  }
237
238
  .shipaid-prompt
238
- .prompt-product
239
- .prompt-product-details
240
- .prompt-product-details-description {
239
+ .prompt-product
240
+ .prompt-product-details
241
+ .prompt-product-details-description {
241
242
  font-size: var(--shipaid-font-xs);
242
243
  margin-top: 0.65rem;
243
244
  }
@@ -310,14 +311,14 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
310
311
  color: var(--shipaid-text-grey);
311
312
  font-weight: var(--shipaid-font-heavy);
312
313
  }
313
- `,dt=R`
314
+ `,dt=I`
314
315
  <svg viewBox="0 0 453 511" version="1.1" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
315
316
  <g transform="matrix(1,0,0,1,-29.4375,-0.984384)">
316
317
  <path d="M468.297,67.385L262.417,2C258.177,0.646 253.63,0.646 249.391,2L43.51,67.385C35.188,69.708 29.438,77.318 29.438,85.979C32.302,157.156 52.266,370.036 52.266,370.036C52.906,378.188 57.297,385.568 64.167,390.01L248.807,509.156C253.12,511.943 258.688,511.943 263.005,509.156L447.641,390.01C454.51,385.568 458.901,378.188 459.542,370.036C459.542,370.036 479.51,157.156 482.37,85.979C482.37,77.318 476.625,69.708 468.297,67.385" style="fill:rgb(47,52,61);fill-rule:nonzero;"/>
317
318
  <path d="M256.01,120.969C286.193,120.969 314.057,130.87 336.536,147.604L309.406,174.656C294.073,164.573 275.729,158.708 256.01,158.708C229.141,158.708 204.823,169.604 187.214,187.198C169.615,204.797 158.719,229.125 158.719,255.995C158.719,282.865 169.615,307.182 187.214,324.792C204.813,342.406 229.141,353.286 256.01,353.286C282.88,353.286 307.208,342.406 324.807,324.792C342.406,307.193 353.297,282.865 353.297,255.995C353.297,251.818 353.036,247.719 352.526,243.688L383.859,212.458C388.51,226.115 391.036,240.766 391.036,255.995C391.036,293.286 375.927,327.047 351.49,351.479C327.057,375.911 293.302,391.021 256.01,391.021C218.729,391.021 184.964,375.911 160.526,351.479C136.094,327.047 120.984,293.286 120.984,255.995C120.984,218.719 136.094,184.948 160.526,160.516C184.964,136.083 218.719,120.969 256.01,120.969ZM218.141,220.906L253.615,259.729L354.844,158.813L381.375,185.484L252.396,314.068L190.422,246.255L218.13,220.906L218.141,220.906Z" style="fill:white;fill-rule:nonzero;"/>
318
319
  </g>
319
320
  </svg>
320
- `,ht=R`
321
+ `,ht=I`
321
322
  <svg
322
323
  viewBox="0 0 384 383.999986"
323
324
  preserveAspectRatio="xMidYMid meet"
@@ -359,7 +360,7 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
359
360
  />
360
361
  </g>
361
362
  </svg>
362
- `,ct=R`
363
+ `,ct=I`
363
364
  <svg
364
365
  viewBox="0 0 423 62"
365
366
  version="1.1"
@@ -441,7 +442,7 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
441
442
  />
442
443
  </g>
443
444
  </svg>
444
- `;var ut=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(ut||{}),ft=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,mt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?vt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&ft(e,i,s),s};const gt=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},_t=t=>console.warn(`[ShipAid] ${t}`),Ct=t=>console.error(`[ShipAid] ${t}`),yt="shipaid-protection";var wt;return t.ShipAidWidget=class extends ot{constructor(){var t;super(...arguments),this.disablePolling=!1,this.pollingInterval=2500,this.disableRefresh=!1,this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>gt(t),post:(t,e)=>gt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}get shouldRefreshOnUpdate(){var t;return!!(null==(t=window.Shopify)?void 0:t.Checkout)||!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;return!!(null==(t=window.Shopify)?void 0:t.designMode)||!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o,r,s;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:(null==(o=this._store)?void 0:o.currency)||(null==(s=null==(r=window.Shopify)?void 0:r.currency)?void 0:s.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(ut.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){var e,i,o,r,s;if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing store settings.");const n=null==(e=this._store)?void 0:e.protectionSettings;if(!n||!n.product)throw new Error("Tried to find protection variant, but protection settings for this store are missing.");const a=((null==(i=this._store)?void 0:i.excludedProductSkus)&&t.items?t.items.reduce(((t,e)=>{if(!e.sku)return t;return this._store.excludedProductSkus.find((t=>t===e.sku))?t-e.final_price:t}),t.total_price):t.total_price)-(null!=(r=null==(o=t.items)?void 0:o.filter((t=>{var e,i,o;return null==(o=null==(i=null==(e=n.product)?void 0:e.variants)?void 0:i.edges)?void 0:o.some((({node:e})=>{var i;return null==(i=null==e?void 0:e.id)?void 0:i.includes(t.variant_id.toString())}))})))?r:[]).reduce(((t,e)=>t+=e.final_line_price),0);if("FIXED"===n.protectionType){if(!n.defaultFee)throw new Error("Missing default fee amount.");if(!(null==(s=n.rules)?void 0:s.length))return n.defaultFee;const t=a/100,e=n.rules.sort(((t,e)=>t.rangeLower&&e.rangeLower?t.rangeLower-e.rangeLower:0)).find((e=>{const i=Boolean(e.rangeLower&&e.rangeLower<t);return e.rangeUpper?i&&e.rangeUpper>=t:i}));return"number"==typeof(null==e?void 0:e.fee)?e.fee:n.defaultFee}if("PERCENTAGE"===n.protectionType){const t=a*n.percentage/100;return t>=n.minimumFee?t:n.minimumFee}throw new Error("No protection type handler found for this store.")}_findProtectionVariant(t){var e,i,o;const r=null==(e=this._store)?void 0:e.protectionSettings;if(!r||!(null==(o=null==(i=r.product)?void 0:i.variants)?void 0:o.edges))throw new Error("Missing product and variants from protection settings.");const s=r.product.variants.edges.flatMap((({node:t})=>{if(!t||!t.price)return[];const e=Number(t.price);return[{...t,formattedPrice:e}]})).sort(((t,e)=>t.formattedPrice-e.formattedPrice)),n=s.find((e=>e.formattedPrice>=t));return n||s[s.length-1]}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i;const o=null==(t=window.Shopify)?void 0:t.shop;if(!o)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const r={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetShowCart\n excludedProductSkus\n protectionSettings\n }\n}",variables:{store:o}},s=await this._fetch.post(t.toString(),r);if(!s)throw new Error("Missing response for store query.");if(null==(e=s.errors)?void 0:e.length)throw new Error(s.errors[0].message);if(!(null==(i=s.data)?void 0:i.store))throw new Error("Missing store from store query response.");return s.data.store}catch(r){throw console.error(r),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw Ct(t.message),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={id:this._protectionVariant.id.replace("gid://shopify/ProductVariant/",""),quantity:1,sections:"main-cart-items,main-cart-footer"},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._lastAction="added",this._setState("success")}catch(i){Ct(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={id:this._protectionCartItem.key,quantity:0,sections:"main-cart-items,main-cart-footer"},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._lastAction="removed",this._cart=e,this._setState("success")}catch(t){Ct(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}render(){var t;at(this,(async()=>{var t,e,i,o;const r=document.createElement("link");r.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),r.setAttribute("rel","stylesheet"),document.head.appendChild(r);try{const t=sessionStorage.getItem(yt),{lastAction:e}=t?JSON.parse(t):{};e&&(this._lastAction=e)}catch(s){_t("Failed to parse local storage.")}try{const[t,e]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=t,this._cart=e}catch(s){return this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?(null==(o=null==(i=this._store)?void 0:i.protectionSettings)?void 0:o.product)?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(ut.LOADED,this._store),setTimeout((async()=>{var t,e;const i=sessionStorage.getItem(yt),{lastAction:o}=i?JSON.parse(i):{};"removed"!==o&&!this._hasProtectionInCart&&(null==(t=this._cart)?void 0:t.item_count)&&(null==(e=this._store)?void 0:e.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.disablePolling||setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval))):(_t("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(_t("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(_t("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),at(this,(()=>{const t={hasProtection:this._hasProtectionInCart,lastAction:this._lastAction};sessionStorage.setItem(yt,JSON.stringify(t))}),[this._lastAction]),at(this,(async()=>{var t,e,i,o,r;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const s=null!=(i=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i,o,r,s;return null==(s=null==(r=null==(o=null==(i=null==(e=this._store)?void 0:e.protectionSettings)?void 0:i.product)?void 0:o.variants)?void 0:r.edges)?void 0:s.some((({node:e})=>{var i;return null==(i=null==e?void 0:e.id)?void 0:i.includes(t.variant_id.toString())}))})))?i:[],n=null==(o=this._cart)?void 0:o.items[s];if(this._hasProtectionInCart=!!n,1===this._cart.item_count&&n){const t={id:n.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const a=await this.calculateProtectionTotal(this._cart),l=this._findProtectionVariant(a);if(this._protectionVariant=l,!(null==l?void 0:l.id))return this._shouldShowWidget=!1,void Ct("No matching protection variant found.");if(!n)return;if(null==(r=l.id)?void 0:r.includes(n.id.toString()))return void(this._protectionCartItem={...n,index:s,position:s+1});const p={id:n.key,quantity:0};await this._fetch.post("/cart/change.js",p);const d={id:l.id.replace("gid://shopify/ProductVariant/",""),quantity:1,sections:"main-cart-items"},h=await this._fetch.post("/cart/add.js",d);await this._handleRefresh(h)}),[this._store,this._cart]);const e=R`
445
+ `;var ut=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(ut||{}),ft=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,mt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?vt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&ft(e,i,s),s};const gt=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},_t=t=>console.warn(`[ShipAid] ${t}`),Ct=t=>console.error(`[ShipAid] ${t}`),yt="shipaid-protection";var wt;return t.ShipAidWidget=class extends ot{constructor(){var t;super(...arguments),this.disablePolling=!1,this.pollingInterval=2500,this.disableRefresh=!1,this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>gt(t),post:(t,e)=>gt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}get shouldRefreshOnUpdate(){return!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;const{searchParams:i}=new URL(window.location.href);return(null==(t=window.Shopify)?void 0:t.designMode)||i.has("shipaid-test")?(_t("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o,r,s;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:(null==(o=this._store)?void 0:o.currency)||(null==(s=null==(r=window.Shopify)?void 0:r.currency)?void 0:s.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(ut.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){var e,i,o,r,s;if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing store settings.");const n=null==(e=this._store)?void 0:e.protectionSettings;if(!n||!this._protectionProduct)throw new Error("Tried to find protection variant, but protection settings for this store are missing.");const a=((null==(i=this._store)?void 0:i.excludedProductSkus)&&t.items?t.items.reduce(((t,e)=>{if(!e.sku)return t;return this._store.excludedProductSkus.find((t=>t===e.sku))?t-e.final_price:t}),t.total_price):t.total_price)-(null!=(r=null==(o=t.items)?void 0:o.filter((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})))?r:[]).reduce(((t,e)=>t+=e.final_line_price),0);if("FIXED"===n.protectionType){if(!n.defaultFee)throw new Error("Missing default fee amount.");if(!(null==(s=n.rules)?void 0:s.length))return n.defaultFee;const t=a/100,e=n.rules.sort(((t,e)=>t.rangeLower&&e.rangeLower?t.rangeLower-e.rangeLower:0)).find((e=>{const i=Boolean(e.rangeLower&&e.rangeLower<t);return e.rangeUpper?i&&e.rangeUpper>=t:i}));return"number"==typeof(null==e?void 0:e.fee)?e.fee:n.defaultFee}if("PERCENTAGE"===n.protectionType){const t=a*n.percentage/100;return t>=n.minimumFee?t:n.minimumFee}throw new Error("No protection type handler found for this store.")}_findProtectionVariant(t){var e,i,o,r;if(!(null==(e=this._store)?void 0:e.protectionSettings)||!(null==(o=null==(i=this._protectionProduct)?void 0:i.variants)?void 0:o.length))throw new Error("Missing product and variants from protection settings.");const s=null==(r=this._protectionProduct)?void 0:r.variants.flatMap((t=>{if(!t||!t.price)return[];const e=Number(t.price);return[{...t,formattedPrice:e}]})).sort(((t,e)=>t.formattedPrice-e.formattedPrice)),n=s.find((e=>e.formattedPrice>=t));return n||s[s.length-1]}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i;const o=null==(t=window.Shopify)?void 0:t.shop;if(!o)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const r={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetShowCart\n excludedProductSkus\n protectionSettings\n }\n}",variables:{store:o}},s=await this._fetch.post(t.toString(),r);if(!s)throw new Error("Missing response for store query.");if(null==(e=s.errors)?void 0:e.length)throw new Error(s.errors[0].message);if(!(null==(i=s.data)?void 0:i.store))throw new Error("Missing store from store query response.");return s.data.store}catch(r){throw console.error(r),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw Ct(t.message),new Error("Could not fetch cart for current domain.")}}async _fetchProduct(){try{const{product:t}=await this._fetch.get("/products/shipaid-protection.json");return t}catch(t){throw Ct(t.message),new Error("Could not fetch protection product for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={quantity:1,id:this._protectionVariant.id},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._lastAction="added",this._setState("success")}catch(i){Ct(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={quantity:0,id:this._protectionCartItem.key},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._lastAction="removed",this._cart=e,this._setState("success")}catch(t){Ct(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}render(){var t;at(this,(async()=>{var t,e;const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i);try{const t=sessionStorage.getItem(yt),{lastAction:e}=t?JSON.parse(t):{};e&&(this._lastAction=e)}catch(o){_t("Failed to parse local storage.")}try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(o){return this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(ut.LOADED,this._store),setTimeout((async()=>{var t,e;const i=sessionStorage.getItem(yt),{lastAction:o}=i?JSON.parse(i):{};"removed"!==o&&!this._hasProtectionInCart&&(null==(t=this._cart)?void 0:t.item_count)&&(null==(e=this._store)?void 0:e.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.disablePolling||setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval))):(_t("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(_t("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(_t("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),at(this,(()=>{const t={hasProtection:this._hasProtectionInCart,lastAction:this._lastAction};sessionStorage.setItem(yt,JSON.stringify(t))}),[this._lastAction]),at(this,(async()=>{var t,e,i;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const o=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),r=null==(i=this._cart)?void 0:i.items[o];if(this._hasProtectionInCart=!!r,1===this._cart.item_count&&r){const t={id:r.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,!(null==n?void 0:n.id))return this._shouldShowWidget=!1,void Ct("No matching protection variant found.");if(!r)return;if(n.id===r.id){if(this._protectionCartItem={...r,index:o,position:o+1},1===r.quantity)return;const t={id:r.key,quantity:1},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const a={id:r.key,quantity:0};await this._fetch.post("/cart/change.js",a);const p={quantity:1,id:n.id},l=await this._fetch.post("/cart/add.js",p);await this._handleRefresh(l)}),[this._store,this._cart]);const e=I`
445
446
  <div class=${`shipaid-popup ${"learn-more"===this._popup&&"active"}`}>
446
447
  <div class="popup">
447
448
  <button
@@ -499,18 +500,18 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
499
500
  </div>
500
501
  </div>
501
502
  </div>
502
- `,i=R`
503
+ `,i=I`
503
504
  <div class="shipaid-prompt">
504
505
  <div class="prompt-product">
505
506
  <div class="prompt-product-image">
506
- ${lt(this._hasProtectionInCart,(()=>dt),(()=>ht))}
507
+ ${pt(this._hasProtectionInCart,(()=>dt),(()=>ht))}
507
508
  </div>
508
509
  <div class="prompt-product-details">
509
510
  <p class="prompt-product-details-title">
510
- Package Protection
511
+ <slot name="title">Package Protection</slot>
511
512
  </p>
512
513
  <p class="prompt-product-details-description">
513
- from Loss, Damage or Theft
514
+ <slot name="subtitle">from Loss, Damage or Theft</slot>
514
515
  </p>
515
516
  </div>
516
517
  <div class="prompt-product-actions">
@@ -526,7 +527,7 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
526
527
  </button>
527
528
  </div>
528
529
  </div>
529
- ${lt(this._state.error,(()=>R`<p class="error">${this._state.error}</p>`))}
530
+ ${pt(this._state.error,(()=>I`<p class="error">${this._state.error}</p>`))}
530
531
  <div class="prompt-footer">
531
532
  <a
532
533
  class="prompt-footer-badge"
@@ -543,8 +544,8 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
543
544
  </button>
544
545
  </div>
545
546
  </div>
546
- `;return R`
547
+ `;return I`
547
548
  <div class="shipaid">
548
- ${lt(this._hasFinishedSetup,(()=>{var t;return lt(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>[e,i]),(()=>R``))}),(()=>R`<p><slot>Loading ShipAid Widget...</slot></p>`))}
549
+ ${pt(this._hasFinishedSetup,(()=>{var t;return pt(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>[e,i]),(()=>I``))}),(()=>I`<p><slot name="loading" default>Loading ShipAid Widget...</slot></p>`))}
549
550
  </div>
550
- `}},t.ShipAidWidget.styles=pt,mt([i({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),mt([i({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),mt([i({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),mt([o()],t.ShipAidWidget.prototype,"_storeDomain",2),mt([o()],t.ShipAidWidget.prototype,"_store",2),mt([o()],t.ShipAidWidget.prototype,"_cart",2),mt([o()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),mt([o()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),mt([o()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),mt([o()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),mt([o()],t.ShipAidWidget.prototype,"_lastAction",2),mt([o()],t.ShipAidWidget.prototype,"_protectionCartItem",2),mt([o()],t.ShipAidWidget.prototype,"_protectionVariant",2),mt([o()],t.ShipAidWidget.prototype,"_state",2),mt([o()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=mt([(wt="shipaid-widget",t=>{return"function"==typeof t?(e=wt,i=t,customElements.define(e,i),i):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){customElements.define(t,e)}}})(wt,t);var e,i})],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),t}({});
551
+ `}},t.ShipAidWidget.styles=lt,mt([i({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),mt([i({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),mt([i({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),mt([o()],t.ShipAidWidget.prototype,"_storeDomain",2),mt([o()],t.ShipAidWidget.prototype,"_store",2),mt([o()],t.ShipAidWidget.prototype,"_cart",2),mt([o()],t.ShipAidWidget.prototype,"_protectionProduct",2),mt([o()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),mt([o()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),mt([o()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),mt([o()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),mt([o()],t.ShipAidWidget.prototype,"_lastAction",2),mt([o()],t.ShipAidWidget.prototype,"_protectionCartItem",2),mt([o()],t.ShipAidWidget.prototype,"_protectionVariant",2),mt([o()],t.ShipAidWidget.prototype,"_state",2),mt([o()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=mt([(wt="shipaid-widget",t=>{return"function"==typeof t?(e=wt,i=t,customElements.define(e,i),i):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){customElements.define(t,e)}}})(wt,t);var e,i})],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),t}({});
@@ -24,7 +24,7 @@
24
24
  * Copyright 2019 Google LLC
25
25
  * SPDX-License-Identifier: BSD-3-Clause
26
26
  */
27
- const s=window,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),l=new WeakMap;class p{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=l.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&l.set(e,t))}return t}toString(){return this.cssText}}const d=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new p("string"==typeof t?t:t+"",void 0,a))(e)})(t):t
27
+ const s=window,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),p=new WeakMap;class l{constructor(t,e,i){if(this._$cssResult$=!0,i!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=p.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&p.set(e,t))}return t}toString(){return this.cssText}}const d=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new l("string"==typeof t?t:t+"",void 0,a))(e)})(t):t
28
28
  /**
29
29
  * @license
30
30
  * Copyright 2017 Google LLC
@@ -35,19 +35,19 @@ const s=window,n=s.ShadowRoot&&(void 0===s.ShadyCSS||s.ShadyCSS.nativeShadow)&&"
35
35
  * Copyright 2017 Google LLC
36
36
  * SPDX-License-Identifier: BSD-3-Clause
37
37
  */
38
- var y;C.finalized=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},null==v||v({ReactiveElement:C}),(null!==(h=c.reactiveElementVersions)&&void 0!==h?h:c.reactiveElementVersions=[]).push("1.4.1");const w=window,$=w.trustedTypes,L=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,A=`lit$${(Math.random()+"").slice(9)}$`,S="?"+A,b=`<${S}>`,x=document,E=(t="")=>x.createComment(t),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,k=Array.isArray,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,U=/>/g,z=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),O=/'/g,N=/"/g,I=/^(?:script|style|textarea|title)$/i,R=(B=1,(t,...e)=>({_$litType$:B,strings:t,values:e})),W=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),D=new WeakMap,j=x.createTreeWalker(x,129,null,!1);var B;class F{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[l,p]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=M;for(let l=0;l<i;l++){const e=t[l];let i,a,p=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===M?"!--"===a[1]?n=T:void 0!==a[1]?n=U:void 0!==a[2]?(I.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=z):void 0!==a[3]&&(n=z):n===z?">"===a[0]?(n=null!=r?r:M,p=-1):void 0===a[1]?p=-2:(p=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?z:'"'===a[3]?N:O):n===N||n===O?n=z:n===T||n===U?n=M:(n=z,r=void 0);const h=n===z&&t[l+1].startsWith("/>")?" ":"";s+=n===M?e+b:p>=0?(o.push(i),e.slice(0,p)+"$lit$"+e.slice(p)+A+h):e+A+(-2===p?(o.push(void 0),l):h)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==L?L.createHTML(a):a,o]})(t,e);if(this.el=F.createElement(l,i),j.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=j.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(A)){const i=p[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(A),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?K:"?"===e[1]?G:"@"===e[1]?X:J})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(I.test(o.tagName)){const t=o.textContent.split(A),e=t.length-1;if(e>0){o.textContent=$?$.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],E()),j.nextNode(),a.push({type:2,index:++r});o.append(t[e],E())}}}else if(8===o.nodeType)if(o.data===S)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(A,t+1));)a.push({type:7,index:r}),t+=A.length-1}r++}}static createElement(t,e){const i=x.createElement("template");return i.innerHTML=t,i}}function Z(t,e,i=t,o){var r,s,n,a;if(e===W)return e;let l=void 0!==o?null===(r=i._$Cl)||void 0===r?void 0:r[o]:i._$Cu;const p=P(e)?void 0:e._$litDirective$;return(null==l?void 0:l.constructor)!==p&&(null===(s=null==l?void 0:l._$AO)||void 0===s||s.call(l,!1),void 0===p?l=void 0:(l=new p(t),l._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[o]=l:i._$Cu=l),void 0!==l&&(e=Z(t,l._$AS(t,e.values),l,o)),e}class V{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:x).importNode(i,!0);j.currentNode=r;let s=j.nextNode(),n=0,a=0,l=o[0];for(;void 0!==l;){if(n===l.index){let e;2===l.type?e=new q(s,s.nextSibling,this,t):1===l.type?e=new l.ctor(s,l.name,l.strings,this,t):6===l.type&&(e=new Q(s,this,t)),this.v.push(e),l=o[++a]}n!==(null==l?void 0:l.index)&&(s=j.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class q{constructor(t,e,i,o){var r;this.type=2,this._$AH=H,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$C_=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$C_}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),P(t)?t===H||null==t||""===t?(this._$AH!==H&&this._$AR(),this._$AH=H):t!==this._$AH&&t!==W&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>k(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.O(t):this.$(t)}S(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}$(t){this._$AH!==H&&P(this._$AH)?this._$AA.nextSibling.data=t:this.k(x.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=F.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new V(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=D.get(t.strings);return void 0===e&&D.set(t.strings,e=new F(t)),e}O(t){k(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new q(this.S(E()),this.S(E()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$C_=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class J{constructor(t,e,i,o,r){this.type=1,this._$AH=H,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=H}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=Z(this,t,e,0),s=!P(t)||t!==this._$AH&&t!==W,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Z(this,o[i+n],e,n),a===W&&(a=this._$AH[n]),s||(s=!P(a)||a!==this._$AH[n]),a===H?t=H:t!==H&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.P(t)}P(t){t===H?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class K extends J{constructor(){super(...arguments),this.type=3}P(t){this.element[this.name]=t===H?void 0:t}}const Y=$?$.emptyScript:"";class G extends J{constructor(){super(...arguments),this.type=4}P(t){t&&t!==H?this.element.setAttribute(this.name,Y):this.element.removeAttribute(this.name)}}class X extends J{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Z(this,t,e,0))&&void 0!==i?i:H)===W)return;const o=this._$AH,r=t===H&&o!==H||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==H&&(o===H||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Q{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Z(this,t)}}const tt=w.litHtmlPolyfillSupport;
38
+ var y;C.finalized=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},null==v||v({ReactiveElement:C}),(null!==(h=c.reactiveElementVersions)&&void 0!==h?h:c.reactiveElementVersions=[]).push("1.4.1");const w=window,$=w.trustedTypes,L=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,A=`lit$${(Math.random()+"").slice(9)}$`,S="?"+A,b=`<${S}>`,x=document,E=(t="")=>x.createComment(t),P=t=>null===t||"object"!=typeof t&&"function"!=typeof t,k=Array.isArray,M=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,U=/>/g,z=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),O=/'/g,N=/"/g,R=/^(?:script|style|textarea|title)$/i,I=(B=1,(t,...e)=>({_$litType$:B,strings:t,values:e})),W=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),j=new WeakMap,D=x.createTreeWalker(x,129,null,!1);var B;class F{constructor({strings:t,_$litType$:e},i){let o;this.parts=[];let r=0,s=0;const n=t.length-1,a=this.parts,[p,l]=((t,e)=>{const i=t.length-1,o=[];let r,s=2===e?"<svg>":"",n=M;for(let p=0;p<i;p++){const e=t[p];let i,a,l=-1,d=0;for(;d<e.length&&(n.lastIndex=d,a=n.exec(e),null!==a);)d=n.lastIndex,n===M?"!--"===a[1]?n=T:void 0!==a[1]?n=U:void 0!==a[2]?(R.test(a[2])&&(r=RegExp("</"+a[2],"g")),n=z):void 0!==a[3]&&(n=z):n===z?">"===a[0]?(n=null!=r?r:M,l=-1):void 0===a[1]?l=-2:(l=n.lastIndex-a[2].length,i=a[1],n=void 0===a[3]?z:'"'===a[3]?N:O):n===N||n===O?n=z:n===T||n===U?n=M:(n=z,r=void 0);const h=n===z&&t[p+1].startsWith("/>")?" ":"";s+=n===M?e+b:l>=0?(o.push(i),e.slice(0,l)+"$lit$"+e.slice(l)+A+h):e+A+(-2===l?(o.push(void 0),p):h)}const a=s+(t[i]||"<?>")+(2===e?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==L?L.createHTML(a):a,o]})(t,e);if(this.el=F.createElement(p,i),D.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(o=D.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes()){const t=[];for(const e of o.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(A)){const i=l[s++];if(t.push(e),void 0!==i){const t=o.getAttribute(i.toLowerCase()+"$lit$").split(A),e=/([.?@])?(.*)/.exec(i);a.push({type:1,index:r,name:e[2],strings:t,ctor:"."===e[1]?K:"?"===e[1]?G:"@"===e[1]?X:J})}else a.push({type:6,index:r})}for(const e of t)o.removeAttribute(e)}if(R.test(o.tagName)){const t=o.textContent.split(A),e=t.length-1;if(e>0){o.textContent=$?$.emptyScript:"";for(let i=0;i<e;i++)o.append(t[i],E()),D.nextNode(),a.push({type:2,index:++r});o.append(t[e],E())}}}else if(8===o.nodeType)if(o.data===S)a.push({type:2,index:r});else{let t=-1;for(;-1!==(t=o.data.indexOf(A,t+1));)a.push({type:7,index:r}),t+=A.length-1}r++}}static createElement(t,e){const i=x.createElement("template");return i.innerHTML=t,i}}function Z(t,e,i=t,o){var r,s,n,a;if(e===W)return e;let p=void 0!==o?null===(r=i._$Cl)||void 0===r?void 0:r[o]:i._$Cu;const l=P(e)?void 0:e._$litDirective$;return(null==p?void 0:p.constructor)!==l&&(null===(s=null==p?void 0:p._$AO)||void 0===s||s.call(p,!1),void 0===l?p=void 0:(p=new l(t),p._$AT(t,i,o)),void 0!==o?(null!==(n=(a=i)._$Cl)&&void 0!==n?n:a._$Cl=[])[o]=p:i._$Cu=p),void 0!==p&&(e=Z(t,p._$AS(t,e.values),p,o)),e}class q{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:o}=this._$AD,r=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:x).importNode(i,!0);D.currentNode=r;let s=D.nextNode(),n=0,a=0,p=o[0];for(;void 0!==p;){if(n===p.index){let e;2===p.type?e=new V(s,s.nextSibling,this,t):1===p.type?e=new p.ctor(s,p.name,p.strings,this,t):6===p.type&&(e=new Q(s,this,t)),this.v.push(e),p=o[++a]}n!==(null==p?void 0:p.index)&&(s=D.nextNode(),n++)}return r}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class V{constructor(t,e,i,o){var r;this.type=2,this._$AH=H,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=o,this._$C_=null===(r=null==o?void 0:o.isConnected)||void 0===r||r}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$C_}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Z(this,t,e),P(t)?t===H||null==t||""===t?(this._$AH!==H&&this._$AR(),this._$AH=H):t!==this._$AH&&t!==W&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):(t=>k(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.O(t):this.$(t)}S(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}$(t){this._$AH!==H&&P(this._$AH)?this._$AA.nextSibling.data=t:this.k(x.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:o}=t,r="number"==typeof o?this._$AC(t):(void 0===o.el&&(o.el=F.createElement(o.h,this.options)),o);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(i);else{const t=new q(r,this),e=t.p(this.options);t.m(i),this.k(e),this._$AH=t}}_$AC(t){let e=j.get(t.strings);return void 0===e&&j.set(t.strings,e=new F(t)),e}O(t){k(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,o=0;for(const r of t)o===e.length?e.push(i=new V(this.S(E()),this.S(E()),this,this.options)):i=e[o],i._$AI(r),o++;o<e.length&&(this._$AR(i&&i._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$C_=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class J{constructor(t,e,i,o,r){this.type=1,this._$AH=H,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=H}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,o){const r=this.strings;let s=!1;if(void 0===r)t=Z(this,t,e,0),s=!P(t)||t!==this._$AH&&t!==W,s&&(this._$AH=t);else{const o=t;let n,a;for(t=r[0],n=0;n<r.length-1;n++)a=Z(this,o[i+n],e,n),a===W&&(a=this._$AH[n]),s||(s=!P(a)||a!==this._$AH[n]),a===H?t=H:t!==H&&(t+=(null!=a?a:"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.P(t)}P(t){t===H?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class K extends J{constructor(){super(...arguments),this.type=3}P(t){this.element[this.name]=t===H?void 0:t}}const Y=$?$.emptyScript:"";class G extends J{constructor(){super(...arguments),this.type=4}P(t){t&&t!==H?this.element.setAttribute(this.name,Y):this.element.removeAttribute(this.name)}}class X extends J{constructor(t,e,i,o,r){super(t,e,i,o,r),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=Z(this,t,e,0))&&void 0!==i?i:H)===W)return;const o=this._$AH,r=t===H&&o!==H||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==H&&(o===H||r);r&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class Q{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){Z(this,t)}}const tt=w.litHtmlPolyfillSupport;
39
39
  /**
40
40
  * @license
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
43
  */
44
- var et,it;null==tt||tt(F,q),(null!==(y=w.litHtmlVersions)&&void 0!==y?y:w.litHtmlVersions=[]).push("2.3.1");class ot extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new q(e.insertBefore(E(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return W}}ot.finalized=!0,ot._$litElement$=!0,null===(et=globalThis.litElementHydrateSupport)||void 0===et||et.call(globalThis,{LitElement:ot});const rt=globalThis.litElementPolyfillSupport;null==rt||rt({LitElement:ot}),(null!==(it=globalThis.litElementVersions)&&void 0!==it?it:globalThis.litElementVersions=[]).push("3.2.0");const st="__registered_effects";function nt(t){const e=t;if(e[st])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[st]={index:0,count:0,effects:[]},i.updated=t=>(e[st].index=0,o(t)),e}function at(t,e,i){const o=function(t,e){const i=nt(t),{index:o,count:r}=i[st];return o===r?(i[st].index++,i[st].count++,i[st].effects.push(e),e):(i[st].index++,i[st].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
44
+ var et,it;null==tt||tt(F,V),(null!==(y=w.litHtmlVersions)&&void 0!==y?y:w.litHtmlVersions=[]).push("2.3.1");class ot extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var o,r;const s=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:e;let n=s._$litPart$;if(void 0===n){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;s._$litPart$=n=new V(e.insertBefore(E(),t),t,void 0,null!=i?i:{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return W}}ot.finalized=!0,ot._$litElement$=!0,null===(et=globalThis.litElementHydrateSupport)||void 0===et||et.call(globalThis,{LitElement:ot});const rt=globalThis.litElementPolyfillSupport;null==rt||rt({LitElement:ot}),(null!==(it=globalThis.litElementVersions)&&void 0!==it?it:globalThis.litElementVersions=[]).push("3.2.0");const st="__registered_effects";function nt(t){const e=t;if(e[st])return e;const i=function(t){if(!t.dispatchEvent||!t.requestUpdate)throw new Error("Element missing required functions (dispatchEvent/requestUpdate)");return t}(t),o=i.updated;return e[st]={index:0,count:0,effects:[]},i.updated=t=>(e[st].index=0,o(t)),e}function at(t,e,i){const o=function(t,e){const i=nt(t),{index:o,count:r}=i[st];return o===r?(i[st].index++,i[st].count++,i[st].effects.push(e),e):(i[st].index++,i[st].effects[o])}(t,{on:e,observe:["__initial__dirty"]});o.observe.some(((t,e)=>i[e]!==t))&&o.on(),o.observe=i}
45
45
  /**
46
46
  * @license
47
47
  * Copyright 2021 Google LLC
48
48
  * SPDX-License-Identifier: BSD-3-Clause
49
49
  */
50
- function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new p(i,t,a)})`
50
+ function pt(t,e,i){return t?e():null==i?void 0:i()}const lt=((t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[o+1]),t[0]);return new l(i,t,a)})`
51
51
  :host {
52
52
  --shipaid-primary: #002bd6;
53
53
  --shipaid-secondary: #0076ff;
@@ -228,16 +228,17 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
228
228
  width: auto;
229
229
  }
230
230
  .shipaid-prompt
231
- .prompt-product
232
- .prompt-product-details
233
- .prompt-product-details-title {
231
+ .prompt-product
232
+ .prompt-product-details
233
+ .prompt-product-details-title {
234
+ text-align: left;
234
235
  font-size: var(--shipaid-font-sm);
235
236
  font-weight: var(--shipaid-font-heavy);
236
237
  }
237
238
  .shipaid-prompt
238
- .prompt-product
239
- .prompt-product-details
240
- .prompt-product-details-description {
239
+ .prompt-product
240
+ .prompt-product-details
241
+ .prompt-product-details-description {
241
242
  font-size: var(--shipaid-font-xs);
242
243
  margin-top: 0.65rem;
243
244
  }
@@ -310,14 +311,14 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
310
311
  color: var(--shipaid-text-grey);
311
312
  font-weight: var(--shipaid-font-heavy);
312
313
  }
313
- `,dt=R`
314
+ `,dt=I`
314
315
  <svg viewBox="0 0 453 511" version="1.1" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
315
316
  <g transform="matrix(1,0,0,1,-29.4375,-0.984384)">
316
317
  <path d="M468.297,67.385L262.417,2C258.177,0.646 253.63,0.646 249.391,2L43.51,67.385C35.188,69.708 29.438,77.318 29.438,85.979C32.302,157.156 52.266,370.036 52.266,370.036C52.906,378.188 57.297,385.568 64.167,390.01L248.807,509.156C253.12,511.943 258.688,511.943 263.005,509.156L447.641,390.01C454.51,385.568 458.901,378.188 459.542,370.036C459.542,370.036 479.51,157.156 482.37,85.979C482.37,77.318 476.625,69.708 468.297,67.385" style="fill:rgb(47,52,61);fill-rule:nonzero;"/>
317
318
  <path d="M256.01,120.969C286.193,120.969 314.057,130.87 336.536,147.604L309.406,174.656C294.073,164.573 275.729,158.708 256.01,158.708C229.141,158.708 204.823,169.604 187.214,187.198C169.615,204.797 158.719,229.125 158.719,255.995C158.719,282.865 169.615,307.182 187.214,324.792C204.813,342.406 229.141,353.286 256.01,353.286C282.88,353.286 307.208,342.406 324.807,324.792C342.406,307.193 353.297,282.865 353.297,255.995C353.297,251.818 353.036,247.719 352.526,243.688L383.859,212.458C388.51,226.115 391.036,240.766 391.036,255.995C391.036,293.286 375.927,327.047 351.49,351.479C327.057,375.911 293.302,391.021 256.01,391.021C218.729,391.021 184.964,375.911 160.526,351.479C136.094,327.047 120.984,293.286 120.984,255.995C120.984,218.719 136.094,184.948 160.526,160.516C184.964,136.083 218.719,120.969 256.01,120.969ZM218.141,220.906L253.615,259.729L354.844,158.813L381.375,185.484L252.396,314.068L190.422,246.255L218.13,220.906L218.141,220.906Z" style="fill:white;fill-rule:nonzero;"/>
318
319
  </g>
319
320
  </svg>
320
- `,ht=R`
321
+ `,ht=I`
321
322
  <svg
322
323
  viewBox="0 0 384 383.999986"
323
324
  preserveAspectRatio="xMidYMid meet"
@@ -359,7 +360,7 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
359
360
  />
360
361
  </g>
361
362
  </svg>
362
- `,ct=R`
363
+ `,ct=I`
363
364
  <svg
364
365
  viewBox="0 0 423 62"
365
366
  version="1.1"
@@ -441,7 +442,7 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
441
442
  />
442
443
  </g>
443
444
  </svg>
444
- `;var ut=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(ut||{}),ft=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,mt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?vt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&ft(e,i,s),s};const gt=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},_t=t=>console.warn(`[ShipAid] ${t}`),Ct=t=>console.error(`[ShipAid] ${t}`),yt="shipaid-protection";var wt;t.ShipAidWidget=class extends ot{constructor(){var t;super(...arguments),this.disablePolling=!1,this.pollingInterval=2500,this.disableRefresh=!1,this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>gt(t),post:(t,e)=>gt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}get shouldRefreshOnUpdate(){var t;return!!(null==(t=window.Shopify)?void 0:t.Checkout)||!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;return!!(null==(t=window.Shopify)?void 0:t.designMode)||!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o,r,s;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:(null==(o=this._store)?void 0:o.currency)||(null==(s=null==(r=window.Shopify)?void 0:r.currency)?void 0:s.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(ut.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){var e,i,o,r,s;if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing store settings.");const n=null==(e=this._store)?void 0:e.protectionSettings;if(!n||!n.product)throw new Error("Tried to find protection variant, but protection settings for this store are missing.");const a=((null==(i=this._store)?void 0:i.excludedProductSkus)&&t.items?t.items.reduce(((t,e)=>{if(!e.sku)return t;return this._store.excludedProductSkus.find((t=>t===e.sku))?t-e.final_price:t}),t.total_price):t.total_price)-(null!=(r=null==(o=t.items)?void 0:o.filter((t=>{var e,i,o;return null==(o=null==(i=null==(e=n.product)?void 0:e.variants)?void 0:i.edges)?void 0:o.some((({node:e})=>{var i;return null==(i=null==e?void 0:e.id)?void 0:i.includes(t.variant_id.toString())}))})))?r:[]).reduce(((t,e)=>t+=e.final_line_price),0);if("FIXED"===n.protectionType){if(!n.defaultFee)throw new Error("Missing default fee amount.");if(!(null==(s=n.rules)?void 0:s.length))return n.defaultFee;const t=a/100,e=n.rules.sort(((t,e)=>t.rangeLower&&e.rangeLower?t.rangeLower-e.rangeLower:0)).find((e=>{const i=Boolean(e.rangeLower&&e.rangeLower<t);return e.rangeUpper?i&&e.rangeUpper>=t:i}));return"number"==typeof(null==e?void 0:e.fee)?e.fee:n.defaultFee}if("PERCENTAGE"===n.protectionType){const t=a*n.percentage/100;return t>=n.minimumFee?t:n.minimumFee}throw new Error("No protection type handler found for this store.")}_findProtectionVariant(t){var e,i,o;const r=null==(e=this._store)?void 0:e.protectionSettings;if(!r||!(null==(o=null==(i=r.product)?void 0:i.variants)?void 0:o.edges))throw new Error("Missing product and variants from protection settings.");const s=r.product.variants.edges.flatMap((({node:t})=>{if(!t||!t.price)return[];const e=Number(t.price);return[{...t,formattedPrice:e}]})).sort(((t,e)=>t.formattedPrice-e.formattedPrice)),n=s.find((e=>e.formattedPrice>=t));return n||s[s.length-1]}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i;const o=null==(t=window.Shopify)?void 0:t.shop;if(!o)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const r={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetShowCart\n excludedProductSkus\n protectionSettings\n }\n}",variables:{store:o}},s=await this._fetch.post(t.toString(),r);if(!s)throw new Error("Missing response for store query.");if(null==(e=s.errors)?void 0:e.length)throw new Error(s.errors[0].message);if(!(null==(i=s.data)?void 0:i.store))throw new Error("Missing store from store query response.");return s.data.store}catch(r){throw console.error(r),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw Ct(t.message),new Error("Could not fetch cart for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={id:this._protectionVariant.id.replace("gid://shopify/ProductVariant/",""),quantity:1,sections:"main-cart-items,main-cart-footer"},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._lastAction="added",this._setState("success")}catch(i){Ct(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={id:this._protectionCartItem.key,quantity:0,sections:"main-cart-items,main-cart-footer"},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._lastAction="removed",this._cart=e,this._setState("success")}catch(t){Ct(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}render(){var t;at(this,(async()=>{var t,e,i,o;const r=document.createElement("link");r.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),r.setAttribute("rel","stylesheet"),document.head.appendChild(r);try{const t=sessionStorage.getItem(yt),{lastAction:e}=t?JSON.parse(t):{};e&&(this._lastAction=e)}catch(s){_t("Failed to parse local storage.")}try{const[t,e]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=t,this._cart=e}catch(s){return this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?(null==(o=null==(i=this._store)?void 0:i.protectionSettings)?void 0:o.product)?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(ut.LOADED,this._store),setTimeout((async()=>{var t,e;const i=sessionStorage.getItem(yt),{lastAction:o}=i?JSON.parse(i):{};"removed"!==o&&!this._hasProtectionInCart&&(null==(t=this._cart)?void 0:t.item_count)&&(null==(e=this._store)?void 0:e.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.disablePolling||setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval))):(_t("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(_t("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(_t("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),at(this,(()=>{const t={hasProtection:this._hasProtectionInCart,lastAction:this._lastAction};sessionStorage.setItem(yt,JSON.stringify(t))}),[this._lastAction]),at(this,(async()=>{var t,e,i,o,r;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const s=null!=(i=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i,o,r,s;return null==(s=null==(r=null==(o=null==(i=null==(e=this._store)?void 0:e.protectionSettings)?void 0:i.product)?void 0:o.variants)?void 0:r.edges)?void 0:s.some((({node:e})=>{var i;return null==(i=null==e?void 0:e.id)?void 0:i.includes(t.variant_id.toString())}))})))?i:[],n=null==(o=this._cart)?void 0:o.items[s];if(this._hasProtectionInCart=!!n,1===this._cart.item_count&&n){const t={id:n.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const a=await this.calculateProtectionTotal(this._cart),l=this._findProtectionVariant(a);if(this._protectionVariant=l,!(null==l?void 0:l.id))return this._shouldShowWidget=!1,void Ct("No matching protection variant found.");if(!n)return;if(null==(r=l.id)?void 0:r.includes(n.id.toString()))return void(this._protectionCartItem={...n,index:s,position:s+1});const p={id:n.key,quantity:0};await this._fetch.post("/cart/change.js",p);const d={id:l.id.replace("gid://shopify/ProductVariant/",""),quantity:1,sections:"main-cart-items"},h=await this._fetch.post("/cart/add.js",d);await this._handleRefresh(h)}),[this._store,this._cart]);const e=R`
445
+ `;var ut=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(ut||{}),ft=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,mt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?vt(e,i):e,n=t.length-1;n>=0;n--)(r=t[n])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&ft(e,i,s),s};const gt=async(t,e)=>{try{const i=await fetch(t,e);if(!i.ok)throw new Error(await i.text());return await i.json()}catch(i){throw console.error(i),new Error("Failed to complete fetch request.")}},_t=t=>console.warn(`[ShipAid] ${t}`),Ct=t=>console.error(`[ShipAid] ${t}`),yt="shipaid-protection";var wt;t.ShipAidWidget=class extends ot{constructor(){var t;super(...arguments),this.disablePolling=!1,this.pollingInterval=2500,this.disableRefresh=!1,this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>gt(t),post:(t,e)=>gt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}get shouldRefreshOnUpdate(){return!this.disablePolling&&!this.disableRefresh}get planActive(){var t,e;const{searchParams:i}=new URL(window.location.href);return(null==(t=window.Shopify)?void 0:t.designMode)||i.has("shipaid-test")?(_t("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o,r,s;return new Intl.NumberFormat(null!=(i=null==(e=window.Shopify)?void 0:e.locale)?i:void 0,{currency:(null==(o=this._store)?void 0:o.currency)||(null==(s=null==(r=window.Shopify)?void 0:r.currency)?void 0:s.active)||"USD",style:"currency"}).format(Number(t))}_dispatchEvent(t,e={}){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e}))}async _handleRefresh(t){const e=Reflect.has(t,"items");if(this.shouldRefreshOnUpdate)return window.location.reload();e||await this.updateCart(),this._dispatchEvent(ut.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){var e,i,o,r,s;if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing store settings.");const n=null==(e=this._store)?void 0:e.protectionSettings;if(!n||!this._protectionProduct)throw new Error("Tried to find protection variant, but protection settings for this store are missing.");const a=((null==(i=this._store)?void 0:i.excludedProductSkus)&&t.items?t.items.reduce(((t,e)=>{if(!e.sku)return t;return this._store.excludedProductSkus.find((t=>t===e.sku))?t-e.final_price:t}),t.total_price):t.total_price)-(null!=(r=null==(o=t.items)?void 0:o.filter((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})))?r:[]).reduce(((t,e)=>t+=e.final_line_price),0);if("FIXED"===n.protectionType){if(!n.defaultFee)throw new Error("Missing default fee amount.");if(!(null==(s=n.rules)?void 0:s.length))return n.defaultFee;const t=a/100,e=n.rules.sort(((t,e)=>t.rangeLower&&e.rangeLower?t.rangeLower-e.rangeLower:0)).find((e=>{const i=Boolean(e.rangeLower&&e.rangeLower<t);return e.rangeUpper?i&&e.rangeUpper>=t:i}));return"number"==typeof(null==e?void 0:e.fee)?e.fee:n.defaultFee}if("PERCENTAGE"===n.protectionType){const t=a*n.percentage/100;return t>=n.minimumFee?t:n.minimumFee}throw new Error("No protection type handler found for this store.")}_findProtectionVariant(t){var e,i,o,r;if(!(null==(e=this._store)?void 0:e.protectionSettings)||!(null==(o=null==(i=this._protectionProduct)?void 0:i.variants)?void 0:o.length))throw new Error("Missing product and variants from protection settings.");const s=null==(r=this._protectionProduct)?void 0:r.variants.flatMap((t=>{if(!t||!t.price)return[];const e=Number(t.price);return[{...t,formattedPrice:e}]})).sort(((t,e)=>t.formattedPrice-e.formattedPrice)),n=s.find((e=>e.formattedPrice>=t));return n||s[s.length-1]}_setState(t,e){this._state={loading:"loading"===t,success:"success"===t,error:"error"===t&&(e||!0)}}async _updateProtection(){return this._hasProtectionInCart?this.removeProtection():this.addProtection()}async _fetchShipAidData(){var t,e,i;const o=null==(t=window.Shopify)?void 0:t.shop;if(!o)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const r={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetShowCart\n excludedProductSkus\n protectionSettings\n }\n}",variables:{store:o}},s=await this._fetch.post(t.toString(),r);if(!s)throw new Error("Missing response for store query.");if(null==(e=s.errors)?void 0:e.length)throw new Error(s.errors[0].message);if(!(null==(i=s.data)?void 0:i.store))throw new Error("Missing store from store query response.");return s.data.store}catch(r){throw console.error(r),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw Ct(t.message),new Error("Could not fetch cart for current domain.")}}async _fetchProduct(){try{const{product:t}=await this._fetch.get("/products/shipaid-protection.json");return t}catch(t){throw Ct(t.message),new Error("Could not fetch protection product for current domain.")}}hasProtection(){return this._hasProtectionInCart}async updateCart(t){t||(t=await this._fetchCart()),this._cart=t}async addProtection(){var t,e;try{if(!this._store)throw new Error("Store has not been loaded.");if(!(null==(t=this._cart)?void 0:t.items))throw new Error("Cart has not been loaded.");if(!(null==(e=this._protectionVariant)?void 0:e.id))throw new Error("No protection variant found.");this._setState("loading");const i={quantity:1,id:this._protectionVariant.id},o=await this._fetch.post("/cart/add.js",i);await this._handleRefresh(o),this._lastAction="added",this._setState("success")}catch(i){Ct(i.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async removeProtection(){try{if(!this._store)throw new Error("Store has not been loaded.");if(!this._protectionCartItem)throw new Error("Protection product not found.");this._setState("loading");const t={quantity:0,id:this._protectionCartItem.key},e=await this._fetch.post("/cart/change.js",t);await this._handleRefresh(e),this._lastAction="removed",this._cart=e,this._setState("success")}catch(t){Ct(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}render(){var t;at(this,(async()=>{var t,e;const i=document.createElement("link");i.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),i.setAttribute("rel","stylesheet"),document.head.appendChild(i);try{const t=sessionStorage.getItem(yt),{lastAction:e}=t?JSON.parse(t):{};e&&(this._lastAction=e)}catch(o){_t("Failed to parse local storage.")}try{const[t,e,i]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=t,this._cart=e,this._protectionProduct=i}catch(o){return this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)}return this.planActive?(null==(e=null==(t=this._store)?void 0:t.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,this._shouldShowWidget=!0,this._dispatchEvent(ut.LOADED,this._store),setTimeout((async()=>{var t,e;const i=sessionStorage.getItem(yt),{lastAction:o}=i?JSON.parse(i):{};"removed"!==o&&!this._hasProtectionInCart&&(null==(t=this._cart)?void 0:t.item_count)&&(null==(e=this._store)?void 0:e.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.disablePolling||setInterval((async()=>{const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval))):(_t("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(_t("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1)):(_t("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,void(this._shouldShowWidget=!1))}),[]),at(this,(()=>{const t={hasProtection:this._hasProtectionInCart,lastAction:this._lastAction};sessionStorage.setItem(yt,JSON.stringify(t))}),[this._lastAction]),at(this,(async()=>{var t,e,i;if(this._cartLastUpdated=new Date,!(null==(t=this._cart)?void 0:t.items))return;const o=null==(e=this._cart.items)?void 0:e.findIndex((t=>{var e,i;return null==(i=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:i.some((e=>e.id===t.variant_id))})),r=null==(i=this._cart)?void 0:i.items[o];if(this._hasProtectionInCart=!!r,1===this._cart.item_count&&r){const t={id:r.key,quantity:0},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,!(null==n?void 0:n.id))return this._shouldShowWidget=!1,void Ct("No matching protection variant found.");if(!r)return;if(n.id===r.id){if(this._protectionCartItem={...r,index:o,position:o+1},1===r.quantity)return;const t={id:r.key,quantity:1},e=await this._fetch.post("/cart/change.js",t);return await this._handleRefresh(e)}const a={id:r.key,quantity:0};await this._fetch.post("/cart/change.js",a);const p={quantity:1,id:n.id},l=await this._fetch.post("/cart/add.js",p);await this._handleRefresh(l)}),[this._store,this._cart]);const e=I`
445
446
  <div class=${`shipaid-popup ${"learn-more"===this._popup&&"active"}`}>
446
447
  <div class="popup">
447
448
  <button
@@ -499,18 +500,18 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
499
500
  </div>
500
501
  </div>
501
502
  </div>
502
- `,i=R`
503
+ `,i=I`
503
504
  <div class="shipaid-prompt">
504
505
  <div class="prompt-product">
505
506
  <div class="prompt-product-image">
506
- ${lt(this._hasProtectionInCart,(()=>dt),(()=>ht))}
507
+ ${pt(this._hasProtectionInCart,(()=>dt),(()=>ht))}
507
508
  </div>
508
509
  <div class="prompt-product-details">
509
510
  <p class="prompt-product-details-title">
510
- Package Protection
511
+ <slot name="title">Package Protection</slot>
511
512
  </p>
512
513
  <p class="prompt-product-details-description">
513
- from Loss, Damage or Theft
514
+ <slot name="subtitle">from Loss, Damage or Theft</slot>
514
515
  </p>
515
516
  </div>
516
517
  <div class="prompt-product-actions">
@@ -526,7 +527,7 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
526
527
  </button>
527
528
  </div>
528
529
  </div>
529
- ${lt(this._state.error,(()=>R`<p class="error">${this._state.error}</p>`))}
530
+ ${pt(this._state.error,(()=>I`<p class="error">${this._state.error}</p>`))}
530
531
  <div class="prompt-footer">
531
532
  <a
532
533
  class="prompt-footer-badge"
@@ -543,8 +544,8 @@ function lt(t,e,i){return t?e():null==i?void 0:i()}const pt=((t,...e)=>{const i=
543
544
  </button>
544
545
  </div>
545
546
  </div>
546
- `;return R`
547
+ `;return I`
547
548
  <div class="shipaid">
548
- ${lt(this._hasFinishedSetup,(()=>{var t;return lt(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>[e,i]),(()=>R``))}),(()=>R`<p><slot>Loading ShipAid Widget...</slot></p>`))}
549
+ ${pt(this._hasFinishedSetup,(()=>{var t;return pt(this._shouldShowWidget&&this.planActive&&(null==(t=this._store)?void 0:t.widgetShowCart),(()=>[e,i]),(()=>I``))}),(()=>I`<p><slot name="loading" default>Loading ShipAid Widget...</slot></p>`))}
549
550
  </div>
550
- `}},t.ShipAidWidget.styles=pt,mt([i({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),mt([i({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),mt([i({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),mt([o()],t.ShipAidWidget.prototype,"_storeDomain",2),mt([o()],t.ShipAidWidget.prototype,"_store",2),mt([o()],t.ShipAidWidget.prototype,"_cart",2),mt([o()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),mt([o()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),mt([o()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),mt([o()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),mt([o()],t.ShipAidWidget.prototype,"_lastAction",2),mt([o()],t.ShipAidWidget.prototype,"_protectionCartItem",2),mt([o()],t.ShipAidWidget.prototype,"_protectionVariant",2),mt([o()],t.ShipAidWidget.prototype,"_state",2),mt([o()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=mt([(wt="shipaid-widget",t=>{return"function"==typeof t?(e=wt,i=t,customElements.define(e,i),i):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){customElements.define(t,e)}}})(wt,t);var e,i})],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
551
+ `}},t.ShipAidWidget.styles=lt,mt([i({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disablePolling",2),mt([i({type:Number,attribute:!0})],t.ShipAidWidget.prototype,"pollingInterval",2),mt([i({type:Boolean,attribute:!0})],t.ShipAidWidget.prototype,"disableRefresh",2),mt([o()],t.ShipAidWidget.prototype,"_storeDomain",2),mt([o()],t.ShipAidWidget.prototype,"_store",2),mt([o()],t.ShipAidWidget.prototype,"_cart",2),mt([o()],t.ShipAidWidget.prototype,"_protectionProduct",2),mt([o()],t.ShipAidWidget.prototype,"_cartLastUpdated",2),mt([o()],t.ShipAidWidget.prototype,"_hasFinishedSetup",2),mt([o()],t.ShipAidWidget.prototype,"_shouldShowWidget",2),mt([o()],t.ShipAidWidget.prototype,"_hasProtectionInCart",2),mt([o()],t.ShipAidWidget.prototype,"_lastAction",2),mt([o()],t.ShipAidWidget.prototype,"_protectionCartItem",2),mt([o()],t.ShipAidWidget.prototype,"_protectionVariant",2),mt([o()],t.ShipAidWidget.prototype,"_state",2),mt([o()],t.ShipAidWidget.prototype,"_popup",2),t.ShipAidWidget=mt([(wt="shipaid-widget",t=>{return"function"==typeof t?(e=wt,i=t,customElements.define(e,i),i):((t,e)=>{const{kind:i,elements:o}=e;return{kind:i,elements:o,finisher(e){customElements.define(t,e)}}})(wt,t);var e,i})],t.ShipAidWidget),Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -20,6 +20,8 @@ export declare class ShipAidWidget extends LitElement {
20
20
  private _store;
21
21
  /** The current cart data object from the Shopify API */
22
22
  private _cart;
23
+ /** The current protection product data object from the Shopify API */
24
+ private _protectionProduct;
23
25
  /** When the cart was last updated */
24
26
  private _cartLastUpdated;
25
27
  /** Whether we have finished the initial setup */
@@ -68,6 +70,8 @@ export declare class ShipAidWidget extends LitElement {
68
70
  private _fetchShipAidData;
69
71
  /** Fetch current cart from the Shopify ajax API */
70
72
  private _fetchCart;
73
+ /** Fetch current product from the Shopify ajax API */
74
+ private _fetchProduct;
71
75
  /** Whether the cart currently contains Shipping protection from ShipAid. */
72
76
  hasProtection(): boolean;
73
77
  /** Update the internal cart, which will trigger any protection fee updates */
@@ -24,12 +24,12 @@ export interface ProtectionSettingsProduct {
24
24
  export interface ProtectionSettings {
25
25
  product?: ProtectionSettingsProduct;
26
26
  }
27
- export interface ProtectionSettingsPercentage extends ProtectionSettings {
27
+ export interface ProtectionSettingsPercentage {
28
28
  protectionType: 'PERCENTAGE';
29
29
  percentage: number;
30
30
  minimumFee: number;
31
31
  }
32
- export interface ProtectionSettingsFixed extends ProtectionSettings {
32
+ export interface ProtectionSettingsFixed {
33
33
  protectionType: 'FIXED';
34
34
  defaultFee?: number;
35
35
  rules?: {
@@ -80,5 +80,67 @@ export interface OptionsWithValuesEntity {
80
80
  export interface ShopifyCartAddPayload {
81
81
  id: number | string;
82
82
  quantity?: number;
83
- sections?: string;
83
+ }
84
+ export interface ShopifyProductResponse {
85
+ product: ShopifyProduct;
86
+ }
87
+ export interface ShopifyProduct {
88
+ id: number;
89
+ title: string;
90
+ body_html: string;
91
+ vendor: string;
92
+ product_type: string;
93
+ created_at: string;
94
+ handle: string;
95
+ updated_at: string;
96
+ published_at: string;
97
+ template_suffix: string;
98
+ published_scope: string;
99
+ tags: string;
100
+ variants?: ShopifyProductVariant[];
101
+ options?: (OptionsEntity)[] | null;
102
+ images?: (ImagesEntityOrImage)[] | null;
103
+ image: ImagesEntityOrImage;
104
+ }
105
+ export interface ShopifyProductVariant {
106
+ id: number;
107
+ product_id: number;
108
+ title: string;
109
+ price: string;
110
+ sku: string;
111
+ position: number;
112
+ compare_at_price: string;
113
+ fulfillment_service: string;
114
+ inventory_management?: null;
115
+ option1: string;
116
+ option2?: null;
117
+ option3?: null;
118
+ created_at: string;
119
+ updated_at: string;
120
+ taxable: boolean;
121
+ barcode?: null;
122
+ grams: number;
123
+ image_id?: null;
124
+ weight: number;
125
+ weight_unit: string;
126
+ requires_shipping: boolean;
127
+ }
128
+ export interface OptionsEntity {
129
+ id: number;
130
+ product_id: number;
131
+ name: string;
132
+ position: number;
133
+ values?: (string)[] | null;
134
+ }
135
+ export interface ImagesEntityOrImage {
136
+ id: number;
137
+ product_id: number;
138
+ position: number;
139
+ created_at: string;
140
+ updated_at: string;
141
+ alt?: null;
142
+ width: number;
143
+ height: number;
144
+ src: string;
145
+ variant_ids?: (null)[] | null;
84
146
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui.shipaid.com",
3
3
  "private": false,
4
- "version": "0.2.9",
4
+ "version": "0.2.11",
5
5
  "type": "module",
6
6
  "main": "dist/widget.umd.js",
7
7
  "unpkg": "dist/widget.iife.js",