1import{f as formatMoney}from"./currency-DRNmrEpZ.js";class FreeShippingIndicator extends HTMLElement{constructor(){super()}static get observedAttributes(){return["cart-value"]}connectedCallback(){window.themeVars.config.freeShippingIndicator.threshold&&this.render()}attributeChangedCallback(name){window.themeVars.config.freeShippingIndicator.threshold&&name==="cart-value"&&this.render()}render(){const cartValueAttribute=this.getAttribute("cart-value"),totalPrice=cartValueAttribute?parseInt(cartValueAttribute,10):0,threshold=window.themeVars.config.freeShippingIndicator.threshold,textClass=this.getAttribute("text-class")||"text-md-body--semi-bold",progressBarWidth=this.getBarWidth(totalPrice,threshold);let textString=this.getTextString(totalPrice,threshold);const thresholdMet=progressBarWidth===100;this.setAttribute("threshold-met",`${thresholdMet}`);let html=` 2 <div 3 class="free-shipping-indicator" 4 js-free-shipping-indicator 5 > 6 <p class=" 7 free-shipping-indicator__title 8 ${textClass} 9 "> 10 ${textString} 11 </p> 12 13 <div class="free-shipping-indicator__track"> 14 <div 15 class="free-shipping-indicator__progress" 16 style="width: ${progressBarWidth}%" 17 ></div> 18 </div> 19 </div> 20 `;this.getAttribute("show-success-message")&&totalPrice>=threshold&&(textString=window.themeVars.strings.freeShippingIndicator.successMessage,html=` 21 <div 22 class=" 23 free-shipping-indicator 24 free-shipping-indicator--success 25 " 26 js-free-shipping-indicator 27 threshold-met="true" 28 > 29 <p class=" 30 free-shipping-indicator__title 31 ${textClass} 32 "> 33 ${window.themeVars.icons.thumb} 34 ${textString} 35 </p> 36 </div> 37 `),this.innerHTML=html}getBarWidth(totalPrice,threshold){return totalPrice<=0?0:totalPrice>=threshold?100:totalPrice/threshold*100}getTextString(totalPrice,threshold){const amountLeft=threshold-totalPrice,moneyFormattedAmountLeft=formatMoney(amountLeft,!0,!0),spendMoreString=window.themeVars.strings.freeShippingIndicator.spendMore.replace("{{ amount }}",moneyFormattedAmountLeft);return totalPrice<=0?spendMoreString:totalPrice>=threshold?window.themeVars.strings.freeShippingIndicator.achievedFreeShipping:spendMoreString}}customElements.define("uwp-free-shipping-indicator",FreeShippingIndicator); 38//# sourceMappingURL=/cdn/shop/t/271/assets/free-shipping-indicator-pe5l3IaX.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.