ui.shipaid.com 0.3.172 → 0.3.174
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.es.js
CHANGED
|
@@ -5011,6 +5011,7 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5011
5011
|
(_f = (_e = this._store) == null ? void 0 : _e.freeGifts) == null ? void 0 : _f.enabled
|
|
5012
5012
|
);
|
|
5013
5013
|
const impactActive = isGreenProtectionEnabled || isFreeGiftEnabled;
|
|
5014
|
+
if (!this._hasFinishedSetup) return A;
|
|
5014
5015
|
return x`
|
|
5015
5016
|
<div class="shipaid-prompt ${isGreenProtectionEnabled ? "green" : ""}">
|
|
5016
5017
|
<div class="prompt-product">
|
|
@@ -5514,7 +5515,8 @@ const _ShipAidWidget = class _ShipAidWidget extends s$1 {
|
|
|
5514
5515
|
.shipaid-prompt .prompt-product .prompt-product-image {
|
|
5515
5516
|
position: relative;
|
|
5516
5517
|
}
|
|
5517
|
-
.shipaid-prompt .prompt-product .prompt-product-image svg
|
|
5518
|
+
.shipaid-prompt .prompt-product .prompt-product-image svg,
|
|
5519
|
+
.shipaid-prompt .prompt-product .prompt-product-image img {
|
|
5518
5520
|
height: var(--shipaid-logo-height, 35px);
|
|
5519
5521
|
max-height: var(--shipaid-logo-max-height, 35px);
|
|
5520
5522
|
width: var(--shipaid-logo-width, auto);
|
package/dist/widget.iife.js
CHANGED
|
@@ -1261,7 +1261,7 @@ function GA(A,e,t){return A?e():null==t?void 0:t()}const JA=aA`
|
|
|
1261
1261
|
/>
|
|
1262
1262
|
</path>
|
|
1263
1263
|
</svg>
|
|
1264
|
-
`;return"get_mechanism"===(null==(e=null==(A=this._store)?void 0:A.widgetConfigurations)?void 0:e.theme)?this._renderGetMechanismCheckoutButton(d,n,r,a,o,v):this._renderDefaultCheckoutButton(d,n,r,a,o,g,v)}renderPopups(){return this.persistPopup&&(this._popup=this.shouldPersistPopup(),"learn-more"===this._popup&&(Ve("shipaid-widget"),this._popup=null)),"confirmation"===this._popup?this.confirmationPopupTemplate():null}promptTemplate(){var A,e,t,d,n,r,a;if(this.useShipAidCheckout&&this.dataSelector)return this.checkoutButtonTemplate();const{useToggle:o,leftCheckbox:g,activeLogo:v,inactiveLogo:u,toggleStyles:f,priceStyles:D}=(null==(e=null==(A=this._store)?void 0:A.widgetConfigurations)?void 0:e.widget)||{useToggle:!1,leftCheckbox:!1,activeLogo:null,inactiveLogo:null,toggleStyles:null,priceStyles:null},B=Boolean(null==(d=null==(t=this._store)?void 0:t.greenProtection)?void 0:d.enabled),Q=Boolean(null==(r=null==(n=this._store)?void 0:n.freeGifts)?void 0:r.enabled),p=B||Q;return E`
|
|
1264
|
+
`;return"get_mechanism"===(null==(e=null==(A=this._store)?void 0:A.widgetConfigurations)?void 0:e.theme)?this._renderGetMechanismCheckoutButton(d,n,r,a,o,v):this._renderDefaultCheckoutButton(d,n,r,a,o,g,v)}renderPopups(){return this.persistPopup&&(this._popup=this.shouldPersistPopup(),"learn-more"===this._popup&&(Ve("shipaid-widget"),this._popup=null)),"confirmation"===this._popup?this.confirmationPopupTemplate():null}promptTemplate(){var A,e,t,d,n,r,a;if(this.useShipAidCheckout&&this.dataSelector)return this.checkoutButtonTemplate();const{useToggle:o,leftCheckbox:g,activeLogo:v,inactiveLogo:u,toggleStyles:f,priceStyles:D}=(null==(e=null==(A=this._store)?void 0:A.widgetConfigurations)?void 0:e.widget)||{useToggle:!1,leftCheckbox:!1,activeLogo:null,inactiveLogo:null,toggleStyles:null,priceStyles:null},B=Boolean(null==(d=null==(t=this._store)?void 0:t.greenProtection)?void 0:d.enabled),Q=Boolean(null==(r=null==(n=this._store)?void 0:n.freeGifts)?void 0:r.enabled),p=B||Q;return this._hasFinishedSetup?E`
|
|
1265
1265
|
<div class="shipaid-prompt ${B?"green":""}">
|
|
1266
1266
|
<div class="prompt-product">
|
|
1267
1267
|
${GA(!this.disableActions&&g,(()=>E`
|
|
@@ -1349,7 +1349,7 @@ function GA(A,e,t){return A?e():null==t?void 0:t()}const JA=aA`
|
|
|
1349
1349
|
${this._renderBenefitsSection(B,Q)}
|
|
1350
1350
|
${GA(this._state.error,(()=>E`<p class="error">${this._state.error}</p>`))}
|
|
1351
1351
|
</div>
|
|
1352
|
-
|
|
1352
|
+
`:T}async connectedCallback(){super.connectedCallback();"/cart"===window.location.pathname.replace(/\/$/,"")&&(this._isCartPage=!0),await CA(this.lang),this.hasLoadedStrings=!0,this.fetchInterceptorCleanup=function(A){const e=window.fetch;let t=!0;const d=async(d,n)=>{const r=e(d,n);if(t)try{await A([d,n],r)}catch(a){console.warn(a)}return await r};return window.fetch=d,()=>{window.fetch===d?window.fetch=e:t=!1}}((async(A,e)=>{var t,d;if(!(null==(d=null==(t=A[1])?void 0:t.headers)?void 0:d["X-ShipAid"])&&(A[0].startsWith("/cart/change")||A[0].startsWith("/cart/update"))&&!this._isUpdatingShipAid)try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons(),await e,await this.updateCart(),await this.updateProtection(!0)}catch(n){console.error("[ShipAid] Interceptor error:",n)}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}}));try{document.addEventListener(ue.CART_UPDATE,this._onShipAidCartEvent)}catch{}try{window.addEventListener(ue.CART_UPDATE,this._onShipAidCartEvent)}catch{}try{document.addEventListener(ve.CART_UPDATED,this._onShipAidInternalCartUpdated)}catch{}}disconnectedCallback(){var A;super.disconnectedCallback(),null==(A=this.fetchInterceptorCleanup)||A.call(this);try{document.removeEventListener(ue.CART_UPDATE,this._onShipAidCartEvent)}catch{}try{window.removeEventListener(ue.CART_UPDATE,this._onShipAidCartEvent)}catch{}try{document.removeEventListener(ve.CART_UPDATED,this._onShipAidInternalCartUpdated)}catch{}this._restoreCheckoutButtonState()}async updateProtection(A=!1){var e,t,d;if(this._cartLastUpdated=new Date,!(null==(e=this._cart)?void 0:e.items))return;if(this._isUpdatingShipAid&&!A)return;const n=this._cart.items.filter((A=>{var e,t;return null==(t=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:t.some((e=>e.id===A.variant_id))}));if(n.length>1)try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons();for(let A=1;A<n.length;A++)await this.updateCartProtectionVariant(0,n[A]),await new Promise((A=>setTimeout(A,100)));this._cart=await this._fetchCart()}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}const r=(null==(t=this._cart.items)?void 0:t.findIndex((A=>{var e,t;return null==(t=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:t.some((e=>e.id===A.variant_id))})))??-1,a=r>=0&&this._cart.items?this._cart.items[r]:void 0;if(this._hasProtectionInCart=!!a,!this._store)return;const o=await this.calculateProtectionTotal(this._cart);if(this._cart.item_count>0&&a&&(this._cart.total_price===(null==a?void 0:a.final_line_price)||!o)){const A=await this.updateCartProtectionVariant(0,a);return sessionStorage.removeItem(me),await this._handleRefresh(A)}const g=this._findProtectionVariant(o);if(o?(this._protectionVariant=g,this._shouldShowWidget=!0):this._protectionVariant={id:0,price:"0"},!(null==g?void 0:g.id))return this._shouldShowWidget=!1,this._restoreCheckoutButtonState(),void we.error("No matching protection variant found.");if(!(null==(d=this._protectionVariant)?void 0:d.id))return this._shouldShowWidget=!1,void this._restoreCheckoutButtonState();if(this.useShipAidCheckout&&this.supportSubscriptions&&(this._sellingPlanId=await this.getSubscription(this._cart)),a){if(this.supportSubscriptions&&!this.useShipAidCheckout&&this._cart.items){const A=this._cart.items.find((A=>{var e;return A.id!==(null==(e=this._protectionVariant)?void 0:e.id)&&!!(null==A?void 0:A.selling_plan_allocation)}));let e=!0;if(!A&&(null==a?void 0:a.selling_plan_allocation)?this._sellingPlanId=null:A&&!(null==a?void 0:a.selling_plan_allocation)?this._sellingPlanId=await this.getSubscription(this._cart):e=!1,e)try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons();const A=await this.updateCartProtectionVariant(1,a);await this._handleRefresh(A)}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}}if(a&&g.id===a.variant_id){if(this._protectionCartItem={...a,index:r,position:r+1},1===a.quantity)return;try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons();const A=await this.updateCartProtectionVariant(1,a);this._handleRefreshCart(),await this._handleRefresh(A)}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}}else try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons();const A={updates:{[a.variant_id]:0,[g.id]:1}},e=await this._fetch.post("/cart/update.js",A);await this.updateCart(e,{dispatchExternalEvents:!0})}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}}}render(){return UA(this,(async()=>{var A,e,t,d,n,r;document.cookie.split(";").forEach((function(A){const e=A.split("=")[0].trim();e.endsWith("product_tags")&&(document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/",document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT;")}));const a=document.createElement("link");a.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),a.setAttribute("rel","stylesheet"),document.head.appendChild(a);try{const[A,e,t]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=A,this._cart=e,this._protectionProduct=t}catch(o){return we.error(o.message),this._hasFinishedSetup=!0,this._shouldShowWidget=!1,void this._restoreCheckoutButtonState()}return this.planActive?(null==(e=null==(A=this._store)?void 0:A.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,xe(this._store),this._dispatchEvent(ve.LOADED,this._store),setTimeout((async()=>{var A,e,t,d;(null==(A=this._store)?void 0:A.widgetAutoOptIn)&&!this.useShipAidCheckout&&(null==(e=this._cart)?void 0:e.item_count)&&(this.customerId&&this._store.excludedCustomersIdsAutoOptIn&&(null==(t=this._store.excludedCustomersIdsAutoOptIn)?void 0:t.length)&&this._store.excludedCustomersIdsAutoOptIn.includes(`gid://shopify/Customer/${this.customerId}`)||sessionStorage.getItem(me)||!this._hasProtectionInCart&&(null==(d=this._cart)?void 0:d.item_count)&&this._store.widgetShowCart&&(await this.addProtection(),sessionStorage.setItem(me,JSON.stringify({loaded:!0}))))}),500),void(this.disablePolling||(setInterval((async()=>{const A=this._cartLastUpdated;A&&(new Date).getTime()-A.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval),(null==(t=this._store)?void 0:t.widgetPollProtection)&&!this.intervalId&&(this.intervalId=setInterval((async()=>{await this.attemptAddProtection()}),400),localStorage.setItem(`${Oe}_${this.intervalId}`,`${this.intervalId}`)),(null==(r=null==(n=null==(d=this._store)?void 0:d.widgetConfigurations)?void 0:n.widget)?void 0:r.pollVariantsCheck)&&setInterval((async()=>{await this.handleMultipleProtectionVariants()}),400)))):(we.warn("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,this._shouldShowWidget=!1,void this._restoreCheckoutButtonState()):(we.warn("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,this._shouldShowWidget=!1,void this._restoreCheckoutButtonState()):(we.warn("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,this._shouldShowWidget=!1,void this._restoreCheckoutButtonState())}),[]),UA(this,(async()=>{await this.updateProtection()}),[this._store,this._cart]),UA(this,(()=>{h(this.renderPopups(),document.body)}),[this._popup]),E`
|
|
1353
1353
|
<style>
|
|
1354
1354
|
:host {
|
|
1355
1355
|
--shipaid-primary: #002bd6;
|
|
@@ -1421,7 +1421,8 @@ function GA(A,e,t){return A?e():null==t?void 0:t()}const JA=aA`
|
|
|
1421
1421
|
.shipaid-prompt .prompt-product .prompt-product-image {
|
|
1422
1422
|
position: relative;
|
|
1423
1423
|
}
|
|
1424
|
-
.shipaid-prompt .prompt-product .prompt-product-image svg
|
|
1424
|
+
.shipaid-prompt .prompt-product .prompt-product-image svg,
|
|
1425
|
+
.shipaid-prompt .prompt-product .prompt-product-image img {
|
|
1425
1426
|
height: var(--shipaid-logo-height, 35px);
|
|
1426
1427
|
max-height: var(--shipaid-logo-max-height, 35px);
|
|
1427
1428
|
width: var(--shipaid-logo-width, auto);
|
package/dist/widget.umd.js
CHANGED
|
@@ -1261,7 +1261,7 @@ function GA(A,e,t){return A?e():null==t?void 0:t()}const JA=aA`
|
|
|
1261
1261
|
/>
|
|
1262
1262
|
</path>
|
|
1263
1263
|
</svg>
|
|
1264
|
-
`;return"get_mechanism"===(null==(e=null==(A=this._store)?void 0:A.widgetConfigurations)?void 0:e.theme)?this._renderGetMechanismCheckoutButton(d,n,r,a,o,v):this._renderDefaultCheckoutButton(d,n,r,a,o,g,v)}renderPopups(){return this.persistPopup&&(this._popup=this.shouldPersistPopup(),"learn-more"===this._popup&&(Ve("shipaid-widget"),this._popup=null)),"confirmation"===this._popup?this.confirmationPopupTemplate():null}promptTemplate(){var A,e,t,d,n,r,a;if(this.useShipAidCheckout&&this.dataSelector)return this.checkoutButtonTemplate();const{useToggle:o,leftCheckbox:g,activeLogo:v,inactiveLogo:u,toggleStyles:f,priceStyles:D}=(null==(e=null==(A=this._store)?void 0:A.widgetConfigurations)?void 0:e.widget)||{useToggle:!1,leftCheckbox:!1,activeLogo:null,inactiveLogo:null,toggleStyles:null,priceStyles:null},B=Boolean(null==(d=null==(t=this._store)?void 0:t.greenProtection)?void 0:d.enabled),Q=Boolean(null==(r=null==(n=this._store)?void 0:n.freeGifts)?void 0:r.enabled),p=B||Q;return E`
|
|
1264
|
+
`;return"get_mechanism"===(null==(e=null==(A=this._store)?void 0:A.widgetConfigurations)?void 0:e.theme)?this._renderGetMechanismCheckoutButton(d,n,r,a,o,v):this._renderDefaultCheckoutButton(d,n,r,a,o,g,v)}renderPopups(){return this.persistPopup&&(this._popup=this.shouldPersistPopup(),"learn-more"===this._popup&&(Ve("shipaid-widget"),this._popup=null)),"confirmation"===this._popup?this.confirmationPopupTemplate():null}promptTemplate(){var A,e,t,d,n,r,a;if(this.useShipAidCheckout&&this.dataSelector)return this.checkoutButtonTemplate();const{useToggle:o,leftCheckbox:g,activeLogo:v,inactiveLogo:u,toggleStyles:f,priceStyles:D}=(null==(e=null==(A=this._store)?void 0:A.widgetConfigurations)?void 0:e.widget)||{useToggle:!1,leftCheckbox:!1,activeLogo:null,inactiveLogo:null,toggleStyles:null,priceStyles:null},B=Boolean(null==(d=null==(t=this._store)?void 0:t.greenProtection)?void 0:d.enabled),Q=Boolean(null==(r=null==(n=this._store)?void 0:n.freeGifts)?void 0:r.enabled),p=B||Q;return this._hasFinishedSetup?E`
|
|
1265
1265
|
<div class="shipaid-prompt ${B?"green":""}">
|
|
1266
1266
|
<div class="prompt-product">
|
|
1267
1267
|
${GA(!this.disableActions&&g,(()=>E`
|
|
@@ -1349,7 +1349,7 @@ function GA(A,e,t){return A?e():null==t?void 0:t()}const JA=aA`
|
|
|
1349
1349
|
${this._renderBenefitsSection(B,Q)}
|
|
1350
1350
|
${GA(this._state.error,(()=>E`<p class="error">${this._state.error}</p>`))}
|
|
1351
1351
|
</div>
|
|
1352
|
-
|
|
1352
|
+
`:T}async connectedCallback(){super.connectedCallback();"/cart"===window.location.pathname.replace(/\/$/,"")&&(this._isCartPage=!0),await CA(this.lang),this.hasLoadedStrings=!0,this.fetchInterceptorCleanup=function(A){const e=window.fetch;let t=!0;const d=async(d,n)=>{const r=e(d,n);if(t)try{await A([d,n],r)}catch(a){console.warn(a)}return await r};return window.fetch=d,()=>{window.fetch===d?window.fetch=e:t=!1}}((async(A,e)=>{var t,d;if(!(null==(d=null==(t=A[1])?void 0:t.headers)?void 0:d["X-ShipAid"])&&(A[0].startsWith("/cart/change")||A[0].startsWith("/cart/update"))&&!this._isUpdatingShipAid)try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons(),await e,await this.updateCart(),await this.updateProtection(!0)}catch(n){console.error("[ShipAid] Interceptor error:",n)}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}}));try{document.addEventListener(ue.CART_UPDATE,this._onShipAidCartEvent)}catch{}try{window.addEventListener(ue.CART_UPDATE,this._onShipAidCartEvent)}catch{}try{document.addEventListener(ve.CART_UPDATED,this._onShipAidInternalCartUpdated)}catch{}}disconnectedCallback(){var A;super.disconnectedCallback(),null==(A=this.fetchInterceptorCleanup)||A.call(this);try{document.removeEventListener(ue.CART_UPDATE,this._onShipAidCartEvent)}catch{}try{window.removeEventListener(ue.CART_UPDATE,this._onShipAidCartEvent)}catch{}try{document.removeEventListener(ve.CART_UPDATED,this._onShipAidInternalCartUpdated)}catch{}this._restoreCheckoutButtonState()}async updateProtection(A=!1){var e,t,d;if(this._cartLastUpdated=new Date,!(null==(e=this._cart)?void 0:e.items))return;if(this._isUpdatingShipAid&&!A)return;const n=this._cart.items.filter((A=>{var e,t;return null==(t=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:t.some((e=>e.id===A.variant_id))}));if(n.length>1)try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons();for(let A=1;A<n.length;A++)await this.updateCartProtectionVariant(0,n[A]),await new Promise((A=>setTimeout(A,100)));this._cart=await this._fetchCart()}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}const r=(null==(t=this._cart.items)?void 0:t.findIndex((A=>{var e,t;return null==(t=null==(e=this._protectionProduct)?void 0:e.variants)?void 0:t.some((e=>e.id===A.variant_id))})))??-1,a=r>=0&&this._cart.items?this._cart.items[r]:void 0;if(this._hasProtectionInCart=!!a,!this._store)return;const o=await this.calculateProtectionTotal(this._cart);if(this._cart.item_count>0&&a&&(this._cart.total_price===(null==a?void 0:a.final_line_price)||!o)){const A=await this.updateCartProtectionVariant(0,a);return sessionStorage.removeItem(me),await this._handleRefresh(A)}const g=this._findProtectionVariant(o);if(o?(this._protectionVariant=g,this._shouldShowWidget=!0):this._protectionVariant={id:0,price:"0"},!(null==g?void 0:g.id))return this._shouldShowWidget=!1,this._restoreCheckoutButtonState(),void we.error("No matching protection variant found.");if(!(null==(d=this._protectionVariant)?void 0:d.id))return this._shouldShowWidget=!1,void this._restoreCheckoutButtonState();if(this.useShipAidCheckout&&this.supportSubscriptions&&(this._sellingPlanId=await this.getSubscription(this._cart)),a){if(this.supportSubscriptions&&!this.useShipAidCheckout&&this._cart.items){const A=this._cart.items.find((A=>{var e;return A.id!==(null==(e=this._protectionVariant)?void 0:e.id)&&!!(null==A?void 0:A.selling_plan_allocation)}));let e=!0;if(!A&&(null==a?void 0:a.selling_plan_allocation)?this._sellingPlanId=null:A&&!(null==a?void 0:a.selling_plan_allocation)?this._sellingPlanId=await this.getSubscription(this._cart):e=!1,e)try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons();const A=await this.updateCartProtectionVariant(1,a);await this._handleRefresh(A)}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}}if(a&&g.id===a.variant_id){if(this._protectionCartItem={...a,index:r,position:r+1},1===a.quantity)return;try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons();const A=await this.updateCartProtectionVariant(1,a);this._handleRefreshCart(),await this._handleRefresh(A)}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}}else try{this._isUpdatingShipAid=!0,this._disableCheckoutButtons();const A={updates:{[a.variant_id]:0,[g.id]:1}},e=await this._fetch.post("/cart/update.js",A);await this.updateCart(e,{dispatchExternalEvents:!0})}finally{this._isUpdatingShipAid=!1,this._enableCheckoutButtons()}}}render(){return UA(this,(async()=>{var A,e,t,d,n,r;document.cookie.split(";").forEach((function(A){const e=A.split("=")[0].trim();e.endsWith("product_tags")&&(document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/",document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT;")}));const a=document.createElement("link");a.setAttribute("href","https://fonts.googleapis.com/css2?family=Lato&display=swap"),a.setAttribute("rel","stylesheet"),document.head.appendChild(a);try{const[A,e,t]=await Promise.all([this._fetchShipAidData(),this._fetchCart(),this._fetchProduct()]);this._store=A,this._cart=e,this._protectionProduct=t}catch(o){return we.error(o.message),this._hasFinishedSetup=!0,this._shouldShowWidget=!1,void this._restoreCheckoutButtonState()}return this.planActive?(null==(e=null==(A=this._store)?void 0:A.protectionSettings)?void 0:e.protectionType)?this._protectionProduct?(this._hasFinishedSetup=!0,xe(this._store),this._dispatchEvent(ve.LOADED,this._store),setTimeout((async()=>{var A,e,t,d;(null==(A=this._store)?void 0:A.widgetAutoOptIn)&&!this.useShipAidCheckout&&(null==(e=this._cart)?void 0:e.item_count)&&(this.customerId&&this._store.excludedCustomersIdsAutoOptIn&&(null==(t=this._store.excludedCustomersIdsAutoOptIn)?void 0:t.length)&&this._store.excludedCustomersIdsAutoOptIn.includes(`gid://shopify/Customer/${this.customerId}`)||sessionStorage.getItem(me)||!this._hasProtectionInCart&&(null==(d=this._cart)?void 0:d.item_count)&&this._store.widgetShowCart&&(await this.addProtection(),sessionStorage.setItem(me,JSON.stringify({loaded:!0}))))}),500),void(this.disablePolling||(setInterval((async()=>{const A=this._cartLastUpdated;A&&(new Date).getTime()-A.getTime()<this.pollingInterval||await this.updateCart()}),this.pollingInterval),(null==(t=this._store)?void 0:t.widgetPollProtection)&&!this.intervalId&&(this.intervalId=setInterval((async()=>{await this.attemptAddProtection()}),400),localStorage.setItem(`${Oe}_${this.intervalId}`,`${this.intervalId}`)),(null==(r=null==(n=null==(d=this._store)?void 0:d.widgetConfigurations)?void 0:n.widget)?void 0:r.pollVariantsCheck)&&setInterval((async()=>{await this.handleMultipleProtectionVariants()}),400)))):(we.warn("No protection settings product for this store - skipping setup."),this._hasFinishedSetup=!0,this._shouldShowWidget=!1,void this._restoreCheckoutButtonState()):(we.warn("No protection settings for this store - skipping setup."),this._hasFinishedSetup=!0,this._shouldShowWidget=!1,void this._restoreCheckoutButtonState()):(we.warn("No plan is active for this store - skipping setup."),this._hasFinishedSetup=!0,this._shouldShowWidget=!1,void this._restoreCheckoutButtonState())}),[]),UA(this,(async()=>{await this.updateProtection()}),[this._store,this._cart]),UA(this,(()=>{h(this.renderPopups(),document.body)}),[this._popup]),E`
|
|
1353
1353
|
<style>
|
|
1354
1354
|
:host {
|
|
1355
1355
|
--shipaid-primary: #002bd6;
|
|
@@ -1421,7 +1421,8 @@ function GA(A,e,t){return A?e():null==t?void 0:t()}const JA=aA`
|
|
|
1421
1421
|
.shipaid-prompt .prompt-product .prompt-product-image {
|
|
1422
1422
|
position: relative;
|
|
1423
1423
|
}
|
|
1424
|
-
.shipaid-prompt .prompt-product .prompt-product-image svg
|
|
1424
|
+
.shipaid-prompt .prompt-product .prompt-product-image svg,
|
|
1425
|
+
.shipaid-prompt .prompt-product .prompt-product-image img {
|
|
1425
1426
|
height: var(--shipaid-logo-height, 35px);
|
|
1426
1427
|
max-height: var(--shipaid-logo-max-height, 35px);
|
|
1427
1428
|
width: var(--shipaid-logo-width, auto);
|
|
@@ -223,7 +223,7 @@ export declare class ShipAidWidget extends LitElement {
|
|
|
223
223
|
private _renderDefaultCheckoutButton;
|
|
224
224
|
checkoutButtonTemplate(): import("lit").TemplateResult<1> | undefined;
|
|
225
225
|
renderPopups(): import("lit").TemplateResult<1> | null;
|
|
226
|
-
promptTemplate(): import("lit").TemplateResult<1> | undefined;
|
|
226
|
+
promptTemplate(): import("lit").TemplateResult<1> | typeof nothing | undefined;
|
|
227
227
|
connectedCallback(): Promise<void>;
|
|
228
228
|
disconnectedCallback(): void;
|
|
229
229
|
updated: (changedProperties: PropertyValues) => void;
|