ui.shipaid.com 0.1.3 → 0.1.4

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.
@@ -272,7 +272,7 @@ var xt=Object.defineProperty,Ct=Object.defineProperties;var Pt=Object.getOwnProp
272
272
  color: var(--shipaid-text-grey);
273
273
  font-weight: var(--shipaid-font-heavy);
274
274
  }
275
- `,L=(o=>(o.LOADED="shipaid-loaded",o.STATUS_UPDATE="shipaid-protection-status",o))(L||{}),Qt=Object.defineProperty,te=Object.getOwnPropertyDescriptor,v=(o,t,e,i)=>{for(var r=i>1?void 0:i?te(t,e):t,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(i?n(t,e,r):n(r))||r);return i&&r&&Qt(t,e,r),r};const Et=async(o,t)=>{try{const e=await fetch(o,t);if(!e.ok)throw new Error(await e.text());return await e.json()}catch(e){throw console.error(e),new Error("Failed to complete fetch request.")}},ee=4e3;let m=class extends H{constructor(){super(...arguments);var o;this._apiEndpoint="/apps/shipaid",this._storeDomain=(o=window.Shopify)==null?void 0:o.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>Et(t),post:(t,e)=>Et(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var e;Gt(this,async()=>{var r,s,n,d;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[a,p]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=a,this._cart=p}catch{this._hasFinishedSetup=!0;return}if(!((s=(r=this._store)==null?void 0:r.plan)!=null&&s.active)){console.warn("No ShipAid plan is active for this store - skipping setup."),this._hasFinishedSetup=!0;return}if(!((d=(n=this._store)==null?void 0:n.protectionSettings)!=null&&d.protectionType)){console.warn("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0;return}this._hasFinishedSetup=!0,this._dispatchEvent(L.LOADED,this._store),setTimeout(async()=>{var a;!this._hasProtectionInCart&&((a=this._store)==null?void 0:a.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()},500),this.polling&&setInterval(async()=>{if(!this.polling)return;const a=this._cartLastUpdated;a&&new Date().getTime()-a.getTime()<this.polling||await this.updateCart()},this.polling)}),bt(this,async()=>{var h,c,u,_,g;if(this._cartLastUpdated=new Date,!((h=this._cart)!=null&&h.items))return;const i=await this.calculateProtectionTotal(this._cart),r=this._findProtectionVariant(i);if(this._protectionVariant=r,!(r!=null&&r.id))throw new Error("No matching protection variant found.");const s=(u=(c=this._cart.items)==null?void 0:c.findIndex(St=>{var G,X,Q,tt,et;return(et=(tt=(Q=(X=(G=this._store)==null?void 0:G.protectionSettings)==null?void 0:X.product)==null?void 0:Q.variants)==null?void 0:tt.edges)==null?void 0:et.some(({node:R})=>{var it;return(it=R==null?void 0:R.id)==null?void 0:it.includes(St.variant_id.toString())})}))!=null?u:[],n=(_=this._cart)==null?void 0:_.items[s];if(this._hasProtectionInCart=!!n,!n)return;if((g=r.id)!=null&&g.includes(n.id.toString())){this._protectionCartItem=b(A({},n),{index:s,position:s+1});return}const d={id:n.key,quantity:0};await this._fetch.post("/cart/change.js",d);const a={id:r.id.replace("gid://shopify/ProductVariant/",""),quantity:1},p=await this._fetch.post("/cart/add.js",a),l=b(A({},this._cart),{items:[p,...this._cart.items]});this._cart=l,this._dispatchEvent(L.STATUS_UPDATE,{protection:!0,cart:l,lineItem:p})},[this._store,this._cart]);const o=P`
275
+ `,L=(o=>(o.LOADED="shipaid-loaded",o.STATUS_UPDATE="shipaid-protection-status",o))(L||{}),Qt=Object.defineProperty,te=Object.getOwnPropertyDescriptor,v=(o,t,e,i)=>{for(var r=i>1?void 0:i?te(t,e):t,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(i?n(t,e,r):n(r))||r);return i&&r&&Qt(t,e,r),r};const Et=async(o,t)=>{try{const e=await fetch(o,t);if(!e.ok)throw new Error(await e.text());return await e.json()}catch(e){throw console.error(e),new Error("Failed to complete fetch request.")}},ee=4e3;let m=class extends H{constructor(){super(...arguments);var o;this._apiEndpoint="/apps/shipaid",this._storeDomain=(o=window.Shopify)==null?void 0:o.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>Et(t),post:(t,e)=>Et(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var e;Gt(this,async()=>{var r,s,n,d;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[a,p]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=a,this._cart=p}catch{this._hasFinishedSetup=!0;return}if(!((s=(r=this._store)==null?void 0:r.plan)!=null&&s.active)){console.warn("No ShipAid plan is active for this store - skipping setup."),this._hasFinishedSetup=!0;return}if(!((d=(n=this._store)==null?void 0:n.protectionSettings)!=null&&d.protectionType)){console.warn("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0;return}this._hasFinishedSetup=!0,this._dispatchEvent(L.LOADED,this._store),setTimeout(async()=>{var a;!this._hasProtectionInCart&&((a=this._store)==null?void 0:a.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()},500),this.polling&&setInterval(async()=>{if(!this.polling)return;const a=this._cartLastUpdated;a&&new Date().getTime()-a.getTime()<this.polling||(await this.updateCart(),window.location.reload())},this.polling)}),bt(this,async()=>{var h,c,u,_,g;if(this._cartLastUpdated=new Date,!((h=this._cart)!=null&&h.items))return;const i=await this.calculateProtectionTotal(this._cart),r=this._findProtectionVariant(i);if(this._protectionVariant=r,!(r!=null&&r.id))throw new Error("No matching protection variant found.");const s=(u=(c=this._cart.items)==null?void 0:c.findIndex(St=>{var G,X,Q,tt,et;return(et=(tt=(Q=(X=(G=this._store)==null?void 0:G.protectionSettings)==null?void 0:X.product)==null?void 0:Q.variants)==null?void 0:tt.edges)==null?void 0:et.some(({node:R})=>{var it;return(it=R==null?void 0:R.id)==null?void 0:it.includes(St.variant_id.toString())})}))!=null?u:[],n=(_=this._cart)==null?void 0:_.items[s];if(this._hasProtectionInCart=!!n,!n)return;if((g=r.id)!=null&&g.includes(n.id.toString())){this._protectionCartItem=b(A({},n),{index:s,position:s+1});return}const d={id:n.key,quantity:0};await this._fetch.post("/cart/change.js",d);const a={id:r.id.replace("gid://shopify/ProductVariant/",""),quantity:1},p=await this._fetch.post("/cart/add.js",a),l=b(A({},this._cart),{items:[p,...this._cart.items]});this._cart=l,this._dispatchEvent(L.STATUS_UPDATE,{protection:!0,cart:l,lineItem:p})},[this._store,this._cart]);const o=P`
276
276
  <div class=${`shipaid-popup ${this._popup==="learn-more"&&"active"}`}>
277
277
  <div class="popup">
278
278
  <button class="popup-close" @click=${()=>{this._popup=null}}>Close</button>
@@ -285,7 +285,7 @@ function ft(t,e,i){return t?e():null==i?void 0:i()}var vt=((t,...e)=>{const i=1=
285
285
  color: var(--shipaid-text-grey);
286
286
  font-weight: var(--shipaid-font-heavy);
287
287
  }
288
- `,mt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(mt||{}),_t=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,yt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?gt(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&&_t(e,i,s),s};const $t=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.")}};return t.ShipAidWidget=class extends lt{constructor(){var t;super(...arguments),this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>$t(t),post:(t,e)=>$t(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t;((t,e)=>{ut(t,e,[])})(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,e]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=t,this._cart=e}catch{return void(this._hasFinishedSetup=!0)}return null!=(e=null==(t=this._store)?void 0:t.plan)&&e.active?null!=(o=null==(i=this._store)?void 0:i.protectionSettings)&&o.protectionType?(this._hasFinishedSetup=!0,this._dispatchEvent(mt.LOADED,this._store),setTimeout((async()=>{var t;!this._hasProtectionInCart&&(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.polling&&setInterval((async()=>{if(!this.polling)return;const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.polling||await this.updateCart()}),this.polling))):(console.warn("No protection settings for this store - skipping setup."),void(this._hasFinishedSetup=!0)):(console.warn("No ShipAid plan is active for this store - skipping setup."),void(this._hasFinishedSetup=!0))})),ut(this,(async()=>{var t,e,i,o,r;if(this._cartLastUpdated=new Date,null==(t=this._cart)||!t.items)return;const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,null==n||!n.id)throw new Error("No matching protection variant found.");const a=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:[],d=null==(o=this._cart)?void 0:o.items[a];if(this._hasProtectionInCart=!!d,!d)return;if(null!=(r=n.id)&&r.includes(d.id.toString()))return void(this._protectionCartItem=l(p({},d),{index:a,position:a+1}));const h={id:d.key,quantity:0};await this._fetch.post("/cart/change.js",h);const c={id:n.id.replace("gid://shopify/ProductVariant/",""),quantity:1},u=await this._fetch.post("/cart/add.js",c),f=l(p({},this._cart),{items:[u,...this._cart.items]});this._cart=f,this._dispatchEvent(mt.STATUS_UPDATE,{protection:!0,cart:f,lineItem:u})}),[this._store,this._cart]);const e=V`
288
+ `,mt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(mt||{}),_t=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,yt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?gt(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&&_t(e,i,s),s};const $t=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.")}};return t.ShipAidWidget=class extends lt{constructor(){var t;super(...arguments),this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>$t(t),post:(t,e)=>$t(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t;((t,e)=>{ut(t,e,[])})(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,e]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=t,this._cart=e}catch{return void(this._hasFinishedSetup=!0)}return null!=(e=null==(t=this._store)?void 0:t.plan)&&e.active?null!=(o=null==(i=this._store)?void 0:i.protectionSettings)&&o.protectionType?(this._hasFinishedSetup=!0,this._dispatchEvent(mt.LOADED,this._store),setTimeout((async()=>{var t;!this._hasProtectionInCart&&(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.polling&&setInterval((async()=>{if(!this.polling)return;const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.polling||(await this.updateCart(),window.location.reload())}),this.polling))):(console.warn("No protection settings for this store - skipping setup."),void(this._hasFinishedSetup=!0)):(console.warn("No ShipAid plan is active for this store - skipping setup."),void(this._hasFinishedSetup=!0))})),ut(this,(async()=>{var t,e,i,o,r;if(this._cartLastUpdated=new Date,null==(t=this._cart)||!t.items)return;const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,null==n||!n.id)throw new Error("No matching protection variant found.");const a=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:[],d=null==(o=this._cart)?void 0:o.items[a];if(this._hasProtectionInCart=!!d,!d)return;if(null!=(r=n.id)&&r.includes(d.id.toString()))return void(this._protectionCartItem=l(p({},d),{index:a,position:a+1}));const h={id:d.key,quantity:0};await this._fetch.post("/cart/change.js",h);const c={id:n.id.replace("gid://shopify/ProductVariant/",""),quantity:1},u=await this._fetch.post("/cart/add.js",c),f=l(p({},this._cart),{items:[u,...this._cart.items]});this._cart=f,this._dispatchEvent(mt.STATUS_UPDATE,{protection:!0,cart:f,lineItem:u})}),[this._store,this._cart]);const e=V`
289
289
  <div class=${`shipaid-popup ${"learn-more"===this._popup&&"active"}`}>
290
290
  <div class="popup">
291
291
  <button class="popup-close" @click=${()=>{this._popup=null}}>Close</button>
@@ -285,7 +285,7 @@ function ft(t,e,i){return t?e():null==i?void 0:i()}var vt=((t,...e)=>{const i=1=
285
285
  color: var(--shipaid-text-grey);
286
286
  font-weight: var(--shipaid-font-heavy);
287
287
  }
288
- `,mt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(mt||{}),_t=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,yt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?gt(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&&_t(e,i,s),s};const $t=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.ShipAidWidget=class extends lt{constructor(){var t;super(...arguments),this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>$t(t),post:(t,e)=>$t(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t;((t,e)=>{ut(t,e,[])})(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,e]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=t,this._cart=e}catch{return void(this._hasFinishedSetup=!0)}return null!=(e=null==(t=this._store)?void 0:t.plan)&&e.active?null!=(o=null==(i=this._store)?void 0:i.protectionSettings)&&o.protectionType?(this._hasFinishedSetup=!0,this._dispatchEvent(mt.LOADED,this._store),setTimeout((async()=>{var t;!this._hasProtectionInCart&&(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.polling&&setInterval((async()=>{if(!this.polling)return;const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.polling||await this.updateCart()}),this.polling))):(console.warn("No protection settings for this store - skipping setup."),void(this._hasFinishedSetup=!0)):(console.warn("No ShipAid plan is active for this store - skipping setup."),void(this._hasFinishedSetup=!0))})),ut(this,(async()=>{var t,e,i,o,r;if(this._cartLastUpdated=new Date,null==(t=this._cart)||!t.items)return;const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,null==n||!n.id)throw new Error("No matching protection variant found.");const a=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:[],d=null==(o=this._cart)?void 0:o.items[a];if(this._hasProtectionInCart=!!d,!d)return;if(null!=(r=n.id)&&r.includes(d.id.toString()))return void(this._protectionCartItem=l(p({},d),{index:a,position:a+1}));const h={id:d.key,quantity:0};await this._fetch.post("/cart/change.js",h);const c={id:n.id.replace("gid://shopify/ProductVariant/",""),quantity:1},u=await this._fetch.post("/cart/add.js",c),f=l(p({},this._cart),{items:[u,...this._cart.items]});this._cart=f,this._dispatchEvent(mt.STATUS_UPDATE,{protection:!0,cart:f,lineItem:u})}),[this._store,this._cart]);const e=V`
288
+ `,mt=(t=>(t.LOADED="shipaid-loaded",t.STATUS_UPDATE="shipaid-protection-status",t))(mt||{}),_t=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,yt=(t,e,i,o)=>{for(var r,s=o>1?void 0:o?gt(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&&_t(e,i,s),s};const $t=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.ShipAidWidget=class extends lt{constructor(){var t;super(...arguments),this._apiEndpoint="/apps/shipaid",this._storeDomain=null==(t=window.Shopify)?void 0:t.shop,this._hasFinishedSetup=!1,this._hasProtectionInCart=!1,this._state={loading:!1,success:null,error:!1},this._popup=null,this._fetch={get:t=>$t(t),post:(t,e)=>$t(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}}render(){var t;((t,e)=>{ut(t,e,[])})(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,e]=await Promise.all([this._fetchShipAidData(),this._fetchCart()]);this._store=t,this._cart=e}catch{return void(this._hasFinishedSetup=!0)}return null!=(e=null==(t=this._store)?void 0:t.plan)&&e.active?null!=(o=null==(i=this._store)?void 0:i.protectionSettings)&&o.protectionType?(this._hasFinishedSetup=!0,this._dispatchEvent(mt.LOADED,this._store),setTimeout((async()=>{var t;!this._hasProtectionInCart&&(null==(t=this._store)?void 0:t.widgetAutoOptIn)&&this._store.widgetShowCart&&await this.addProtection()}),500),void(this.polling&&setInterval((async()=>{if(!this.polling)return;const t=this._cartLastUpdated;t&&(new Date).getTime()-t.getTime()<this.polling||(await this.updateCart(),window.location.reload())}),this.polling))):(console.warn("No protection settings for this store - skipping setup."),void(this._hasFinishedSetup=!0)):(console.warn("No ShipAid plan is active for this store - skipping setup."),void(this._hasFinishedSetup=!0))})),ut(this,(async()=>{var t,e,i,o,r;if(this._cartLastUpdated=new Date,null==(t=this._cart)||!t.items)return;const s=await this.calculateProtectionTotal(this._cart),n=this._findProtectionVariant(s);if(this._protectionVariant=n,null==n||!n.id)throw new Error("No matching protection variant found.");const a=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:[],d=null==(o=this._cart)?void 0:o.items[a];if(this._hasProtectionInCart=!!d,!d)return;if(null!=(r=n.id)&&r.includes(d.id.toString()))return void(this._protectionCartItem=l(p({},d),{index:a,position:a+1}));const h={id:d.key,quantity:0};await this._fetch.post("/cart/change.js",h);const c={id:n.id.replace("gid://shopify/ProductVariant/",""),quantity:1},u=await this._fetch.post("/cart/add.js",c),f=l(p({},this._cart),{items:[u,...this._cart.items]});this._cart=f,this._dispatchEvent(mt.STATUS_UPDATE,{protection:!0,cart:f,lineItem:u})}),[this._store,this._cart]);const e=V`
289
289
  <div class=${`shipaid-popup ${"learn-more"===this._popup&&"active"}`}>
290
290
  <div class="popup">
291
291
  <button class="popup-close" @click=${()=>{this._popup=null}}>Close</button>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui.shipaid.com",
3
3
  "private": false,
4
- "version": "0.1.3",
4
+ "version": "0.1.4",
5
5
  "main": "dist/ui.shipaid.com.umd.js",
6
6
  "unpkg": "dist/ui.shipaid.com.iife.js",
7
7
  "module": "dist/ui.shipaid.com.es.js",