ui.shipaid.com 0.3.12 → 0.3.13
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 +3 -0
- package/dist/widget.es.js +6 -6
- package/dist/widget.iife.js +6 -6
- package/dist/widget.umd.js +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -133,6 +133,9 @@ If you need to change any of the widget colors to suit a specific theme, there a
|
|
|
133
133
|
| `--shipaid-logo-max-height` | Changes the max height of ShipAid logo. | `var(--shipaid-logo-max-height, 35px)` |
|
|
134
134
|
| `--shipaid-logo-width` | Changes the width of ShipAid logo. | `var(--shipaid-logo-width, auto)` |
|
|
135
135
|
| `--shipaid-logo-max-width` | Changes the max width of ShipAid logo. | `var(--shipaid-logo-max-width, 50px)` |
|
|
136
|
+
| `--shipaid-prompt-footer-button-size` | Changes the height of info button in footer. | `var(--shipaid-prompt-footer-button-size, 10px)` |
|
|
137
|
+
| `--shipaid-prompt-badge-border-radius` | Changes border radius of footer | `var(--shipaid-prompt-badge-border-radius, 30px)` |
|
|
138
|
+
| `--shipaid-footer-badge-logo-height` | Changes the height of logo in footer. | `var(--shipaid-footer-badge-logo-height, 9px)` |
|
|
136
139
|
|
|
137
140
|
Other variables can be found [here](/widget/src/assets/styles.ts) (`/widget/src/assets/styles.ts`).
|
|
138
141
|
|
package/dist/widget.es.js
CHANGED
|
@@ -1737,7 +1737,7 @@ const styles = i$2`
|
|
|
1737
1737
|
.shipaid-prompt .prompt-footer .prompt-footer-about {
|
|
1738
1738
|
color: var(--shipaid-text);
|
|
1739
1739
|
cursor: pointer;
|
|
1740
|
-
font-size: 10px;
|
|
1740
|
+
font-size: var(--shipaid-prompt-footer-button-size, 10px);
|
|
1741
1741
|
background-color: transparent;
|
|
1742
1742
|
cursor: pointer;
|
|
1743
1743
|
border: 1px solid var(--shipaid-text);
|
|
@@ -1751,7 +1751,7 @@ const styles = i$2`
|
|
|
1751
1751
|
);
|
|
1752
1752
|
color: var(--shipaid-prompt-badge-text-color, var(--shipaid-text));
|
|
1753
1753
|
padding: 0.2rem 1rem;
|
|
1754
|
-
border-radius: 30px;
|
|
1754
|
+
border-radius: var(--shipaid-prompt-badge-border-radius, 30px);
|
|
1755
1755
|
cursor: pointer;
|
|
1756
1756
|
text-decoration: none;
|
|
1757
1757
|
font-size: var(--shipaid-font-xs);
|
|
@@ -1761,7 +1761,7 @@ const styles = i$2`
|
|
|
1761
1761
|
white-space: nowrap;
|
|
1762
1762
|
}
|
|
1763
1763
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
1764
|
-
height: 9px;
|
|
1764
|
+
height:var(--shipaid-footer-badge-logo-height, 9px);
|
|
1765
1765
|
}
|
|
1766
1766
|
`;
|
|
1767
1767
|
var Events = /* @__PURE__ */ ((Events2) => {
|
|
@@ -2487,7 +2487,7 @@ let ShipAidWidget = class extends s$1 {
|
|
|
2487
2487
|
.shipaid-prompt .prompt-footer .prompt-footer-about {
|
|
2488
2488
|
color: var(--shipaid-text);
|
|
2489
2489
|
cursor: pointer;
|
|
2490
|
-
font-size: 10px;
|
|
2490
|
+
font-size: var(--shipaid-prompt-footer-button-size, 10px);
|
|
2491
2491
|
background-color: transparent;
|
|
2492
2492
|
cursor: pointer;
|
|
2493
2493
|
border: 1px solid var(--shipaid-text);
|
|
@@ -2501,7 +2501,7 @@ let ShipAidWidget = class extends s$1 {
|
|
|
2501
2501
|
);
|
|
2502
2502
|
color: var(--shipaid-prompt-badge-text-color, var(--shipaid-text));
|
|
2503
2503
|
padding: 0.2rem 1rem;
|
|
2504
|
-
border-radius: 30px;
|
|
2504
|
+
border-radius: var(--shipaid-prompt-badge-border-radius, 30px);
|
|
2505
2505
|
cursor: pointer;
|
|
2506
2506
|
text-decoration: none;
|
|
2507
2507
|
font-size: var(--shipaid-font-xs);
|
|
@@ -2511,7 +2511,7 @@ let ShipAidWidget = class extends s$1 {
|
|
|
2511
2511
|
white-space: nowrap;
|
|
2512
2512
|
}
|
|
2513
2513
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
2514
|
-
height: 9px;
|
|
2514
|
+
height:var(--shipaid-footer-badge-logo-height, 9px);
|
|
2515
2515
|
}
|
|
2516
2516
|
</style>
|
|
2517
2517
|
<div class="shipaid">
|
package/dist/widget.iife.js
CHANGED
|
@@ -761,7 +761,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
761
761
|
.shipaid-prompt .prompt-footer .prompt-footer-about {
|
|
762
762
|
color: var(--shipaid-text);
|
|
763
763
|
cursor: pointer;
|
|
764
|
-
font-size: 10px;
|
|
764
|
+
font-size: var(--shipaid-prompt-footer-button-size, 10px);
|
|
765
765
|
background-color: transparent;
|
|
766
766
|
cursor: pointer;
|
|
767
767
|
border: 1px solid var(--shipaid-text);
|
|
@@ -775,7 +775,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
775
775
|
);
|
|
776
776
|
color: var(--shipaid-prompt-badge-text-color, var(--shipaid-text));
|
|
777
777
|
padding: 0.2rem 1rem;
|
|
778
|
-
border-radius: 30px;
|
|
778
|
+
border-radius: var(--shipaid-prompt-badge-border-radius, 30px);
|
|
779
779
|
cursor: pointer;
|
|
780
780
|
text-decoration: none;
|
|
781
781
|
font-size: var(--shipaid-font-xs);
|
|
@@ -785,7 +785,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
785
785
|
white-space: nowrap;
|
|
786
786
|
}
|
|
787
787
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
788
|
-
height: 9px;
|
|
788
|
+
height:var(--shipaid-footer-badge-logo-height, 9px);
|
|
789
789
|
}
|
|
790
790
|
`;var oe=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(oe||{}),re=Object.defineProperty,se=Object.getOwnPropertyDescriptor,ae=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?se(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&re(e,i,s),s};const ne=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.")}},pe=t=>console.warn(`[ShipAid] ${t}`),de=t=>console.error(`[ShipAid] ${t}`),le="shipaid-protection",ce=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>ee)).then((t=>t.default)),"./lang/es.json":()=>Promise.resolve().then((()=>ye)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>Le)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>Te)).then((t=>t.default))});var he;he={loader:async t=>{if("en"===t)return te;const e=Reflect.get(ce,`./lang/${t}.json`);return e?await e():te}},_t=Object.assign(Object.assign({},_t),he),t.ShipAidWidget=class extends ht{constructor(){var t,e,i;super(...arguments),this.disablePolling=!1,this.disableActions=!1,this.pollingInterval=2500,this.disableRefresh=!1,this.lang="en",this.currency=void 0,this.customerId=void 0,this._apiEndpoint="/apps/shipaid",this._storeDomain=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost),this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this.hasLoadedStrings=!1,this.intervalId=0,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ne(t),post:(t,e)=>ne(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}shouldUpdate(t){return this.hasLoadedStrings&&super.shouldUpdate(t)}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")?(pe("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o;return new Intl.NumberFormat(void 0,{currency:this.currency||(null==(e=this._store)?void 0:e.currency)||(null==(o=null==(i=window.Shopify)?void 0:i.currency)?void 0:o.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(oe.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.calculateProtectionTotal(this._store,this._protectionProduct,t)}_findProtectionVariant(t){if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.findProtectionVariant(this._store,this._protectionProduct,t)}_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,o,r;const s=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost);if(!s)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetPollProtection\n widgetShowCart\n excludedProductSkus\n excludedCustomersIdsAutoOptIn\n protectionSettings\n }\n}",variables:{store:s}},i=await this._fetch.post(t.toString(),e);if(!i)throw new Error("Missing response for store query.");if(null==(o=i.errors)?void 0:o.length)throw new Error(i.errors[0].message);if(!(null==(r=i.data)?void 0:r.store))throw new Error("Missing store from store query response.");return i.data.store}catch(a){throw console.error(a),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw de(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 de(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._setState("success")}catch(i){de(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._cart=e,this._setState("success")}catch(t){de(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async attemptAddProtection(){var t,e,i,o,r,s;if(!(null==(t=this._store)?void 0:t.widgetAutoOptIn))return;if(!(null==(e=this._cart)?void 0:e.items)||!(null==(i=this._cart)?void 0:i.item_count))return;const a=null==(o=this._cart.items)?void 0:o.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))})),n=null==(r=this._cart)?void 0:r.items[a];if(this._hasProtectionInCart=!!n,1===this._cart.item_count&&n)return;!!sessionStorage.getItem(le)||(sessionStorage.setItem(le,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(s=this._cart)?void 0:s.item_count)&&this._store.widgetShowCart&&await this.addProtection())}learnMorePopupTemplate(){return B`
|
|
791
791
|
<shipaid-popup-learn-more
|
|
@@ -968,7 +968,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
968
968
|
.shipaid-prompt .prompt-footer .prompt-footer-about {
|
|
969
969
|
color: var(--shipaid-text);
|
|
970
970
|
cursor: pointer;
|
|
971
|
-
font-size: 10px;
|
|
971
|
+
font-size: var(--shipaid-prompt-footer-button-size, 10px);
|
|
972
972
|
background-color: transparent;
|
|
973
973
|
cursor: pointer;
|
|
974
974
|
border: 1px solid var(--shipaid-text);
|
|
@@ -982,7 +982,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
982
982
|
);
|
|
983
983
|
color: var(--shipaid-prompt-badge-text-color, var(--shipaid-text));
|
|
984
984
|
padding: 0.2rem 1rem;
|
|
985
|
-
border-radius: 30px;
|
|
985
|
+
border-radius: var(--shipaid-prompt-badge-border-radius, 30px);
|
|
986
986
|
cursor: pointer;
|
|
987
987
|
text-decoration: none;
|
|
988
988
|
font-size: var(--shipaid-font-xs);
|
|
@@ -992,7 +992,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
992
992
|
white-space: nowrap;
|
|
993
993
|
}
|
|
994
994
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
995
|
-
height: 9px;
|
|
995
|
+
height:var(--shipaid-footer-badge-logo-height, 9px);
|
|
996
996
|
}
|
|
997
997
|
</style>
|
|
998
998
|
<div class="shipaid">
|
package/dist/widget.umd.js
CHANGED
|
@@ -761,7 +761,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
761
761
|
.shipaid-prompt .prompt-footer .prompt-footer-about {
|
|
762
762
|
color: var(--shipaid-text);
|
|
763
763
|
cursor: pointer;
|
|
764
|
-
font-size: 10px;
|
|
764
|
+
font-size: var(--shipaid-prompt-footer-button-size, 10px);
|
|
765
765
|
background-color: transparent;
|
|
766
766
|
cursor: pointer;
|
|
767
767
|
border: 1px solid var(--shipaid-text);
|
|
@@ -775,7 +775,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
775
775
|
);
|
|
776
776
|
color: var(--shipaid-prompt-badge-text-color, var(--shipaid-text));
|
|
777
777
|
padding: 0.2rem 1rem;
|
|
778
|
-
border-radius: 30px;
|
|
778
|
+
border-radius: var(--shipaid-prompt-badge-border-radius, 30px);
|
|
779
779
|
cursor: pointer;
|
|
780
780
|
text-decoration: none;
|
|
781
781
|
font-size: var(--shipaid-font-xs);
|
|
@@ -785,7 +785,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
785
785
|
white-space: nowrap;
|
|
786
786
|
}
|
|
787
787
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
788
|
-
height: 9px;
|
|
788
|
+
height:var(--shipaid-footer-badge-logo-height, 9px);
|
|
789
789
|
}
|
|
790
790
|
`;var oe=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(oe||{}),re=Object.defineProperty,se=Object.getOwnPropertyDescriptor,ae=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?se(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(s=(o?r(e,i,s):r(s))||s);return o&&s&&re(e,i,s),s};const ne=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.")}},pe=t=>console.warn(`[ShipAid] ${t}`),de=t=>console.error(`[ShipAid] ${t}`),le="shipaid-protection",ce=Object.assign({"./lang/en.json":()=>Promise.resolve().then((()=>ee)).then((t=>t.default)),"./lang/es.json":()=>Promise.resolve().then((()=>ye)).then((t=>t.default)),"./lang/it.json":()=>Promise.resolve().then((()=>Le)).then((t=>t.default)),"./lang/pt.json":()=>Promise.resolve().then((()=>Te)).then((t=>t.default))});var he;he={loader:async t=>{if("en"===t)return te;const e=Reflect.get(ce,`./lang/${t}.json`);return e?await e():te}},_t=Object.assign(Object.assign({},_t),he),t.ShipAidWidget=class extends ht{constructor(){var t,e,i;super(...arguments),this.disablePolling=!1,this.disableActions=!1,this.pollingInterval=2500,this.disableRefresh=!1,this.lang="en",this.currency=void 0,this.customerId=void 0,this._apiEndpoint="/apps/shipaid",this._storeDomain=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost),this._hasFinishedSetup=!1,this._shouldShowWidget=!0,this._hasProtectionInCart=!1,this.hasLoadedStrings=!1,this.intervalId=0,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>ne(t),post:(t,e)=>ne(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}shouldUpdate(t){return this.hasLoadedStrings&&super.shouldUpdate(t)}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")?(pe("Currently in preview mode."),!0):!!(null==(e=this._store)?void 0:e.planActive)}_currencyFormat(t){var e,i,o;return new Intl.NumberFormat(void 0,{currency:this.currency||(null==(e=this._store)?void 0:e.currency)||(null==(o=null==(i=window.Shopify)?void 0:i.currency)?void 0:o.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(oe.STATUS_UPDATE,{protection:this._hasProtectionInCart,cart:e?t:this._cart,lineItem:e?this._protectionCartItem:t})}async calculateProtectionTotal(t){if(t||(t=await this._fetchCart()),!t)throw new Error("Could not fetch cart.");if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.calculateProtectionTotal(this._store,this._protectionProduct,t)}_findProtectionVariant(t){if(!this._store)throw new Error("Missing ShipAid store");if(!this._protectionProduct)throw new Error("Missing Shopify protection product");return e.findProtectionVariant(this._store,this._protectionProduct,t)}_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,o,r;const s=(null==(t=window.Shopify)?void 0:t.shop)??(null==(i=null==(e=window.Shopify)?void 0:e.Checkout)?void 0:i.apiHost);if(!s)throw new Error("No shop found in Shopify object.");try{const t=new URL(window.location.href);t.pathname=this._apiEndpoint;const e={query:"query StoreByDomain ($store: String!) {\n store: storeByDomain (input: {store: $store}) {\n currency\n planActive\n store\n widgetAutoOptIn\n widgetPollProtection\n widgetShowCart\n excludedProductSkus\n excludedCustomersIdsAutoOptIn\n protectionSettings\n }\n}",variables:{store:s}},i=await this._fetch.post(t.toString(),e);if(!i)throw new Error("Missing response for store query.");if(null==(o=i.errors)?void 0:o.length)throw new Error(i.errors[0].message);if(!(null==(r=i.data)?void 0:r.store))throw new Error("Missing store from store query response.");return i.data.store}catch(a){throw console.error(a),new Error(`Could not find a store for ${this._storeDomain}`)}}async _fetchCart(){try{return await this._fetch.get("/cart.js")}catch(t){throw de(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 de(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._setState("success")}catch(i){de(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._cart=e,this._setState("success")}catch(t){de(t.message),this._setState("error","Failed to add protection to cart - please try again, or contact us for help.")}}async attemptAddProtection(){var t,e,i,o,r,s;if(!(null==(t=this._store)?void 0:t.widgetAutoOptIn))return;if(!(null==(e=this._cart)?void 0:e.items)||!(null==(i=this._cart)?void 0:i.item_count))return;const a=null==(o=this._cart.items)?void 0:o.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))})),n=null==(r=this._cart)?void 0:r.items[a];if(this._hasProtectionInCart=!!n,1===this._cart.item_count&&n)return;!!sessionStorage.getItem(le)||(sessionStorage.setItem(le,JSON.stringify({loaded:!0})),!this._hasProtectionInCart&&(null==(s=this._cart)?void 0:s.item_count)&&this._store.widgetShowCart&&await this.addProtection())}learnMorePopupTemplate(){return B`
|
|
791
791
|
<shipaid-popup-learn-more
|
|
@@ -968,7 +968,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
968
968
|
.shipaid-prompt .prompt-footer .prompt-footer-about {
|
|
969
969
|
color: var(--shipaid-text);
|
|
970
970
|
cursor: pointer;
|
|
971
|
-
font-size: 10px;
|
|
971
|
+
font-size: var(--shipaid-prompt-footer-button-size, 10px);
|
|
972
972
|
background-color: transparent;
|
|
973
973
|
cursor: pointer;
|
|
974
974
|
border: 1px solid var(--shipaid-text);
|
|
@@ -982,7 +982,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
982
982
|
);
|
|
983
983
|
color: var(--shipaid-prompt-badge-text-color, var(--shipaid-text));
|
|
984
984
|
padding: 0.2rem 1rem;
|
|
985
|
-
border-radius: 30px;
|
|
985
|
+
border-radius: var(--shipaid-prompt-badge-border-radius, 30px);
|
|
986
986
|
cursor: pointer;
|
|
987
987
|
text-decoration: none;
|
|
988
988
|
font-size: var(--shipaid-font-xs);
|
|
@@ -992,7 +992,7 @@ function It(t,e,i){return t?e():null==i?void 0:i()}const qt=u`
|
|
|
992
992
|
white-space: nowrap;
|
|
993
993
|
}
|
|
994
994
|
.shipaid-prompt .prompt-footer .prompt-footer-badge svg {
|
|
995
|
-
height: 9px;
|
|
995
|
+
height:var(--shipaid-footer-badge-logo-height, 9px);
|
|
996
996
|
}
|
|
997
997
|
</style>
|
|
998
998
|
<div class="shipaid">
|