1"use strict";(self.webpackChunkesign_template=self.webpackChunkesign_template||[]).push([["product-index"],{
1"./resources/assets/js/components/cart/Cart.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>Cart});var events__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/events/events.js"),events__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_0__),_constants_defaults__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./resources/assets/js/constants/defaults.js"),_api__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./resources/assets/js/components/cart/api.js"),_utils_klaviyoTracking__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./resources/assets/js/utils/klaviyoTracking.js");class Cart extends events__WEBPACK_IMPORTED_MODULE_0__.EventEmitter{getState(){return(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartFetch)().then(state=>(this.updateCartCount(state.item_count),state))}getCartPage(){return(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartPageFetch)().then(cartContent=>cartContent)}getCartTable(){return(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartTableFetch)().then(cartContent=>cartContent)}getCartTotalSummary(){return(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartTotalSummaryFetch)().then(cartContent=>cartContent)}clear(){(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartClear)()}trackAddedToCart(){(0,_utils_klaviyoTracking__WEBPACK_IMPORTED_MODULE_3__.trackKlaviyoAddedToCart)()}addItems(items){this.emit("adding");let data=items;Array.isArray(items)||(data=[items]),(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartAddItems)(data).then(()=>{this.trackAddedToCart(),_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.settings.ajaxCartEnabled?window.modalManager.idModalMap.get("cart-modal").show():this.getState(),this.emit("added")}).catch(response=>{response.json().then(error=>{this.emit("error_add_item",error)})})}async updateItem(key,options){return this.emit("updating"),(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartUpdateItem)(key,options).then(state=>this.getCartTable().then(cartTable=>this.getCartTotalSummary().then(cartSummary=>{this.emit("updated",state,cartTable,cartSummary),this.updateCartCount(state.item_count)}).catch(error=>{this.emit("error_update_item",error)})).catch(error=>{this.emit("error_update_item",error)})).catch(error=>{this.emit("error_update_item",error)})}async removeItem(key){return this.emit("removing"),(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartRemoveItem)(key).then(state=>{this.updateCartCount(state.item_count),this.emit("updated",null,state)}).catch(error=>{this.emit("error_remove_item",error)})}async updateNote(note){return(0,_api__WEBPACK_IMPORTED_MODULE_2__.cartUpdateNote)(note).catch(error=>{this.emit("error_update_note",error)})}updateCartCount(itemCount){[...document.querySelectorAll(".js-cart-count")].forEach(cartCountEl=>{cartCountEl.innerHTML=itemCount})}static getInstance(){return Cart.instance||(Cart.instance=new Cart),Cart.instance}}}),
1"./resources/assets/js/components/cart/FirmhouseCart.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>FirmhouseCart});var _utils_firmhouse_queries__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./resources/assets/js/utils/firmhouse-queries.js"),_constants_defaults__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./resources/assets/js/constants/defaults.js"),_Cart__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./resources/assets/js/components/cart/Cart.js");class FirmhouseCart{constructor(){this.shopifyCart=_Cart__WEBPACK_IMPORTED_MODULE_2__.default.getInstance(),this.tempCart=null,this.subscriptionManagerForm=document.querySelector(".js-subscription-manager-form")}showFirmhouseAddressError(errors){const errorEl=document.createElement("div");errorEl.classList.add("note","note--error"),errorEl.innerHTML=` 2 <span>${_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.subscriptionManagerError}</span> 3 <ul class="list--bullets"> 4 ${errors.map(error=>`<li>${error.message}</li>`).join("")} 5 </ul> 6 `;const parentEl=this.subscriptionManagerForm.parentNode;parentEl.appendChild(errorEl),parentEl.appendChild(this.subscriptionManagerForm)}showPaymentUrl(paymentUrl){const paymentUrlEl=document.createElement("div");paymentUrlEl.classList.add("note","note--success"),paymentUrlEl.innerHTML=` 7 <p><strong>${_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.paymentUrl}:</strong> <a href="${paymentUrl}" target="_blank">${paymentUrl}</a></p> 8 `;const parentEl=this.subscriptionManagerForm.parentNode,errorEl=parentEl.querySelector(".note--error");errorEl&&parentEl.removeChild(errorEl),parentEl.appendChild(paymentUrlEl),parentEl.removeChild(this.subscriptionManagerForm)}buildOrderedProduct(item){const firmhouseProductId=item.properties._firmhouse_product_id,interval=item.properties._subscription_plan.split("-")[0],intervalUnit=item.properties._subscription_plan.split("-")[1].toUpperCase();return firmhouseProductId?{interval:parseInt(interval,10)||3,intervalUnitOfMeasureType:intervalUnit||"MONTHS",productId:firmhouseProductId.toString(),quantity:item.quantity||1,metadata:item.properties,ensureNewRecord:!0,subscriptionId:this.tempCart.subscription.id}:null}async buildSubscription(){let customerData=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,hasErrors=!1;const shopifyCartItems=(await this.shopifyCart.getState()).items;this.tempCart=await(0,_utils_firmhouse_queries__WEBPACK_IMPORTED_MODULE_0__.createCart)();const orderedProductInputs=[];if(shopifyCartItems.forEach(item=>{orderedProductInputs.push(this.buildOrderedProduct(item))}),this.tempCart.subscription){if(orderedProductInputs.forEach(async orderedProductInput=>{await(0,_utils_firmhouse_queries__WEBPACK_IMPORTED_MODULE_0__.createOrderedProduct)(orderedProductInput,this.tempCart.subscription.token)}),await(0,_utils_firmhouse_queries__WEBPACK_IMPORTED_MODULE_0__.applyPromotionToSubscription)("120208",this.tempCart.subscription.id),customerData&&_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.isSubscriptionManager){this.subscriptionManagerForm=document.querySelector(".js-subscription-manager-form");const response=await(0,_utils_firmhouse_queries__WEBPACK_IMPORTED_MODULE_0__.updateCustomerDetails)(this.tempCart.subscription.token,customerData);response.errors.length&&(hasErrors=!0,this.showFirmhouseAddressError(response.errors))}hasErrors||this.createNewSubscription()}}async createNewSubscription(){const homeUrl=`${window.location.protocol}//${window.location.host}`,subscriptionInput={returnUrl:homeUrl,paymentPageUrl:homeUrl},{paymentUrl,subscription}=await(0,_utils_firmhouse_queries__WEBPACK_IMPORTED_MODULE_0__.createSubscriptionFromCart)(this.tempCart.subscription.token,subscriptionInput);subscription&&(this.cleanUpCarts(),_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.isSubscriptionManager&&paymentUrl?this.showPaymentUrl(paymentUrl):subscription.checkoutUrl&&(window.location.href=subscription.checkoutUrl))}cleanUpCarts(){this.shopifyCart.clear(),this.tempCart=null}static getInstance(){return FirmhouseCart.instance||(FirmhouseCart.instance=new FirmhouseCart),FirmhouseCart.instance}}}),
8"./resources/assets/js/components/cart/api.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{cartAddItems:()=>cartAddItems,cartClear:()=>cartClear,cartClearNote:()=>cartClearNote,cartFetch:()=>cartFetch,cartPageFetch:()=>cartPageFetch,cartRemoveItem:()=>cartRemoveItem,cartShippingRates:()=>cartShippingRates,cartTableFetch:()=>cartTableFetch,cartTotalSummaryFetch:()=>cartTotalSummaryFetch,cartUpdateItem:()=>cartUpdateItem,cartUpdateNote:()=>cartUpdateNote});var _constants_defaults__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./resources/assets/js/constants/defaults.js");function getDefaultRequestConfig(){return JSON.parse(JSON.stringify({credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json;"}}))}function getViewRequestConfig(){return JSON.parse(JSON.stringify({credentials:"same-origin",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"html;"}}))}async function fetchJSON(url,config){return fetch(url,config).then(response=>{if(!response.ok)throw response;return response.json()})}async function fetchView(url,config){return fetch(url,config).then(response=>{if(!response.ok)throw response;return response.text()})}function cartFetch(){return fetchJSON(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart.js`,getDefaultRequestConfig())}function cartPageFetch(){return fetchView(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart?view=content`,getViewRequestConfig())}function cartTableFetch(){return fetchView(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart?view=table`,getViewRequestConfig())}function cartTotalSummaryFetch(){return fetchView(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart?view=total-summary`,getViewRequestConfig())}function cartAddItems(items){const config=getDefaultRequestConfig();return config.method="POST",config.body=JSON.stringify({items}),fetchJSON(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart/add.js`,config)}function getItemIndex(key){if(typeof key!="string"||key.split(":").length!==2)throw new TypeError("Theme Cart: Provided key value is not a string with the format xxx:xxx");return cartFetch().then(state=>{let index=-1;return state.items.forEach((item,i)=>{index=item.key===key?i+1:index}),index===-1?Promise.reject(new Error("Theme Cart: Unable to match line item with provided key")):index})}function cartChange(line){let options=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const config=getDefaultRequestConfig();return config.method="POST",config.body=JSON.stringify({line,quantity:options.quantity,properties:options.properties}),fetchJSON(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart/change.js`,config)}function cartUpdateItem(key,options){return getItemIndex(key).then(line=>cartChange(line,options))}function cartRemoveItem(key){return getItemIndex(key).then(line=>cartChange(line,{quantity:0}))}function cartClear(){const config=getDefaultRequestConfig();return config.method="POST",fetchJSON(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart/clear.js`,config)}function cartUpdate(body){const config=getDefaultRequestConfig();return config.method="POST",config.body=JSON.stringify(body),fetchJSON(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart/update.js`,config)}function cartUpdateNote(note){return cartUpdate({note})}function cartClearNote(){return cartUpdate({note:""})}function cartShippingRates(){return fetchJSON(`${_constants_defaults__WEBPACK_IMPORTED_MODULE_0__.rootPath}cart/shipping_rates.json`,getDefaultRequestConfig())}}),
8"./resources/assets/js/components/cart/bcApi.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{bcBaseUrl:()=>bcBaseUrl,fetchProductFromBC:()=>fetchProductFromBC});const bcBaseUrl=window.location.host==="eyelens-development.myshopify.com"?"https://eyelens-development.apps.esign.eu/product":`${window.location.origin}/apps/eyelens/product`;async function fetchProductFromBC(requestData){try{const params=new URLSearchParams(requestData).toString(),url=`${bcBaseUrl}?${params}`,response=await fetch(url);if(!response.ok){const message=`An error has occured: ${response.status}`;throw new Error(message)}const json=await response.json();return json.error?{errors:json.message}:json}catch{return{errors:"Deze combinatie bestaat niet. Neem contact met ons op zodat we u verder kunnen helpen."}}}}),
8"./resources/assets/js/components/form/addToCart.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>AddToCart});var _shopify_theme_product_form__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/@shopify/theme-product-form/theme-product-form.js"),_cart_Cart__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./resources/assets/js/components/cart/Cart.js"),_constants_defaults__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./resources/assets/js/constants/defaults.js"),_utils_product__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./resources/assets/js/utils/product.js"),_cart_bcApi__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./resources/assets/js/components/cart/bcApi.js"),_templates_productSubscriptionPlansTemplate__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./resources/assets/js/templates/productSubscriptionPlansTemplate.js"),_cart_FirmhouseCart__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./resources/assets/js/components/cart/FirmhouseCart.js");class AddToCart{constructor(form){if(this.cart=_cart_Cart__WEBPACK_IMPORTED_MODULE_1__.default.getInstance(),this.FirmhouseCart=_cart_FirmhouseCart__WEBPACK_IMPORTED_MODULE_6__.default.getInstance(),this.productFormElement=form,this.noteElement=this.productFormElement.querySelector(".note"),this.addToCartTriggers=[...this.productFormElement.querySelectorAll(".js-add-to-cart")],this.quantitySelects=[...this.productFormElement.querySelectorAll(".js-quantity-select")],this.hasLensAttributes=form.dataset.hasLensAttributes.toLowerCase()==="true",this.lensAttributeInputs=[...this.productFormElement.querySelectorAll(".js-lens-attribute-input")],this.errorClass="input-group--error",this.deliveryTimeTexts=[...this.productFormElement.querySelectorAll(".js-delivery-time-text")],this.deliveryTextUpdateEnabled=!1,this.productFormElement){const closestWrapper=this.productFormElement.closest(".product__wrapper");if(closestWrapper){const quickAddMobileButton=closestWrapper.querySelector(".js-add-to-cart-reveal");quickAddMobileButton.addEventListener("click",()=>{const attribute=quickAddMobileButton.getAttribute("data-quick-add-button"),quickAddMobileForm=document.querySelector(`[data-quick-add-form='${attribute}']`);quickAddMobileForm.classList.contains("product__quick-add-to-cart--visible")?quickAddMobileForm.classList.remove("product__quick-add-to-cart--visible"):quickAddMobileForm.classList.add("product__quick-add-to-cart--visible")})}}this.initProductForm(this.productFormElement),this.addToCart(this.productFormElement)}initProductForm(formEl){const{productHandle}=this.productFormElement.dataset,requestUrl=`${_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.rootPath}products/${productHandle}.js`;fetch(requestUrl).then(response=>response.json()).then(productJSON=>{if(this.productFormObj=new _shopify_theme_product_form__WEBPACK_IMPORTED_MODULE_0__.ProductForm(formEl,productJSON,{onOptionChange:e=>this.onOptionChange(e,formEl),onFormSubmit:e=>this.onFormSubmit(e,formEl)}),window.firstAvailableVariantIsHidden){const swatchLabelEl=formEl.querySelector(".swatch__list-item .label");swatchLabelEl&&swatchLabelEl.click()}this.initSubscriptions(),this.displayPrice();const initialVariant=this.productFormObj.variant();if(initialVariant&&initialVariant.featured_image&&setTimeout(()=>{this.slideToVariantImage(initialVariant)},500),initialVariant&&this.handleVariantWarning(initialVariant),this.quantitySelects.forEach(quantitySelect=>{quantitySelect.addEventListener("change",()=>{this.displayPrice(window.quantityPlusDiscountedPriceArray)})}),this.hasLensAttributes)this.lensAttributeInputs.forEach(input=>{input.addEventListener("change",e=>{input.getAttribute("name").includes("enabled")&&this.updateAttributeSetAfterSideToggle(input),this.onOptionChange(e,formEl)})});else{const variant=this.productFormObj.variant();this.processProductWithoutAttributes(variant,!1)}}).catch(()=>{})}setLoadingStateAddToCartTriggers(){this.addToCartTriggers.forEach(trigger=>{trigger.classList.add("button--loading")})}removeLoadingStateAddToCartTriggers(){this.addToCartTriggers.forEac
8h(trigger=>{trigger.classList.remove("button--loading")})}updateAttributeSetAfterSideToggle(input){const attributesSetDisabledClass="attributes-set--disabled",attributesSetEl=input.closest(".attributes-set");attributesSetEl&&(input.checked?attributesSetEl.classList.remove(attributesSetDisabledClass):attributesSetEl.classList.add(attributesSetDisabledClass))}enableAddToCartTriggers(){this.addToCartTriggers.forEach(trigger=>{trigger.removeAttribute("disabled"),trigger.querySelector(".js-add-to-cart-text").innerHTML=_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.addToCart})}disableAddToCartTriggers(){this.addToCartTriggers.forEach(trigger=>{trigger.setAttribute("disabled","disabled"),trigger.querySelector(".js-add-to-cart-text").innerHTML=_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.soldOut})}displayPrice(quantityPlusDiscountedPriceArray){const variant=this.productFormObj.variant(),{title:variantTitle}=variant,volumeDealWrapperEl=document.querySelector(".js-volume-deal-wrapper");let{price:variantPrice}=variant;if(variantPrice===0)return;const subscriptionPlanId=this.getSelectedSubscriptionPlanId();if(subscriptionPlanId){const plan=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.findFirmhousePlanById)(subscriptionPlanId),discountPerc=parseInt(plan.discount_percentage,10);variantPrice*=1-discountPerc/100}const totalPriceEl=document.querySelector(".js-total-price"),variantInfoEl=document.querySelector(".js-variant-info");let totalQuantity=0;if(this.hasLensAttributes){const formProps=this.getFormProps(this.productFormElement),{sides}=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.formatAndValidateLensAttributes)(formProps,variant);Object.keys(sides).forEach(sideName=>{const side=sides[sideName];side.enabled&&(totalQuantity+=side.quantity)})}else totalQuantity=this.quantitySelects.reduce((total,select)=>{const value=parseInt(select.value,10);return total+value},0);const totalPrice=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.formatMoney)(totalQuantity*variantPrice),{isDiscount}=window,discountedPrice=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.formatMoney)(totalQuantity*(variantPrice*.95)),originalPriceEl=document.querySelector(".js-original-total-price");function getDiscountForQuantity(quantity){let applicableDiscount=0;return quantityPlusDiscountedPriceArray.forEach(tier=>{const tierQuantity=parseInt(Object.keys(tier)[0],10),discount=tier[tierQuantity];quantity>=tierQuantity&&(applicableDiscount=discount)}),applicableDiscount}if(volumeDealWrapperEl&&quantityPlusDiscountedPriceArray){if(totalPriceEl){const price=variant.price-variant.price*getDiscountForQuantity(totalQuantity)/100;totalPriceEl.innerHTML=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.formatMoney)(price*totalQuantity)}}else totalPriceEl&&(isDiscount?(totalPriceEl.innerHTML=discountedPrice,originalPriceEl.innerHTML=totalPrice):totalPriceEl.innerHTML=totalPrice);if(variantInfoEl&&variantTitle!==void 0){const title=variantTitle!=="Default title"?variantTitle:"";variantInfoEl.innerHTML=`${totalQuantity} x ${title}`}}onOptionChange(event,formEl){const variant=this.productFormObj.variant(),noteEl=formEl.querySelector(".note");this.hideNoteElement(noteEl),this.resetInvalidLensFields();const labelEl=event.target.previousElementSibling;this.setSubscriptionPlans();const selectedSizeOption=document.querySelector(`input[name="options[${_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.size}]"]:checked`);(selectedSizeOption.value.includes("daglenzen")||selectedSizeOption.value.includes("maandlenzen"))&&event.target.name===`options[${_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.size}]`&&document.querySelector(".js-subscription-checkbox").checked===!0&&this.handleCorrectAmountOfBoxes(selectedSizeOption.value),labelEl!==null&&labelEl.classList.add("active"),variant&&(this.hasLensAttributes?this.handleFormWithLensAttributes(variant,!1):(this.displayPrice(),variant.available?this.enableAddToCartTriggers():this.disableAddToCartTriggers(),this.processProductWithoutAttributes(variant,!1)),variant.featured_image&&this.slideToVariantImage(variant),[...document.querySelectorAll(".js-product-price")].forEac
8h(priceEl=>{priceEl.innerHTML=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.formatMoney)(variant.price)}),[...document.querySelectorAll(".js-product-compare-price")].forEach(comparePriceEl=>{variant.compare_at_price>variant.price?(comparePriceEl.innerHTML=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.formatMoney)(variant.compare_at_price),comparePriceEl.classList.remove("hide")):(comparePriceEl.innerHTML="",comparePriceEl.classList.add("hide"))}),this.setProductUrl(),this.displayPrice(),this.handleVariantWarning(variant))}handleCorrectAmountOfBoxes(selectedSizeValue){let planMinBoxes=1,boxSize="1_month";selectedSizeValue===_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.ninety_days||selectedSizeValue===_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.three_months?boxSize="3_months":selectedSizeValue===_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.six_months&&(boxSize="6_months");const subscriptionPlanId=this.getSelectedSubscriptionPlanId();if(subscriptionPlanId){const plan=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.findFirmhousePlanById)(subscriptionPlanId);planMinBoxes=parseInt(plan[`boxes_${boxSize}`],10)}this.quantitySelects.forEach(select=>{select.querySelectorAll("option").forEach(option=>{option.disabled=!1,option.selected=!1;const optionValue=parseInt(option.value,10);optionValue<planMinBoxes&&(option.disabled=!0),optionValue===planMinBoxes&&(option.selected=!0)})})}handleAmountOfBoxesReset(){this.quantitySelects.forEach(select=>{select.querySelectorAll("option").forEach(option2=>{option2.disabled=!1});const option=select.querySelector('option[value="1"]');option&&(option.selected=!0)})}initSubscriptions(){if(this.subscriptionPlansWrapper=document.querySelector(".js-subscription-plans-wrapper"),this.subscriptionCheckboxEl=document.querySelector(".js-subscription-checkbox"),this.subscriptionPlansEl=document.querySelector(".js-subscription-plans"),this.subscriptionCheckboxEl&&this.subscriptionPlansEl){const subscriptionCheckboxHandler=()=>{if(this.subscriptionPlansEl.style.display=this.subscriptionCheckboxEl.checked?"block":"none",this.subscriptionCheckboxEl.checked){const firstRadioInput=this.subscriptionPlansEl.querySelector('input[name="subscription_plan"]');firstRadioInput&&firstRadioInput.click();const selectedOption=document.querySelector(`input[name="options[${_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.size}]"]:checked`);selectedOption.value===_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.thirty_days||selectedOption.value===_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.ninety_days||selectedOption.value===_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.three_months||selectedOption.value===_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.six_months?this.handleCorrectAmountOfBoxes(selectedOption.value):this.handleAmountOfBoxesReset()}else this.handleAmountOfBoxesReset();this.setProductUrl(),this.displayPrice()};this.subscriptionCheckboxEl.addEventListener("change",subscriptionCheckboxHandler),this.setSubscriptionPlans();const subscriptionPlanId=new URLSearchParams(window.location.search.replace("?","")).get("subscription_plan");if(subscriptionPlanId){const subscriptionPlanInput=this.subscriptionPlansEl.querySelector(`[value="${subscriptionPlanId}"]`);subscriptionPlanInput&&(this.subscriptionCheckboxEl.checked=!0,subscriptionCheckboxHandler(),subscriptionPlanInput.getAttribute("type")==="radio"&&subscriptionPlanInput.click())}}}setProductUrl(){const variant=this.productFormObj.variant(),subscriptionPlanId=this.getSelectedSubscriptionPlanId(),url=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getProductUrlWithVariantAndSubPlan)(window.location.href,variant.id,subscriptionPlanId);window.history.replaceState({path:url},"",url)}setSubscriptionPlans(){if(this.subscriptionPlansEl){const variant=this.productFormObj.variant();if(this.subscriptionPlansEl.dataset.variantId!==variant.id.toString()){const{product}
8=this.productFormObj,subscriptionsHtml=(0,_templates_productSubscriptionPlansTemplate__WEBPACK_IMPORTED_MODULE_5__.default)(product,variant);this.subscriptionPlansEl.innerHTML=subscriptionsHtml,subscriptionsHtml===""?this.subscriptionPlansWrapper.style.display="none":this.subscriptionPlansWrapper.style.display="block";const inputs=[...this.subscriptionPlansEl.querySelectorAll('input[name="subscription_plan"]')];inputs.forEach(input=>{input===inputs[0]&&input.click(),input.addEventListener("change",()=>{const selectedSizeOption=document.querySelector(`input[name="options[${_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.options.packs.size}]"]:checked`);selectedSizeOption&&(selectedSizeOption.value.includes("daglenzen")||selectedSizeOption.value.includes("maandlenzen"))&&this.handleCorrectAmountOfBoxes(selectedSizeOption.value),this.setProductUrl(),this.displayPrice()})}),this.subscriptionPlansEl.setAttribute("data-variant-id",variant.id)}}}getSelectedSubscriptionPlanId(){if(this.subscriptionCheckboxEl&&this.subscriptionCheckboxEl.checked){const selectedSubscriptionPlanInput=this.subscriptionPlansEl.querySelector('input[type="hidden"][name="subscription_plan"],input[type="radio"][name="subscription_plan"]:checked');if(selectedSubscriptionPlanInput)return selectedSubscriptionPlanInput.value}return null}hideNoteElement(noteEl){noteEl.classList.add("hide"),noteEl.classList.remove("note--success"),noteEl.classList.remove("note--error"),noteEl.innerHTML=""}showNoteElement(message,isSuccess,noteEl){isSuccess?noteEl.classList.add("note--success"):noteEl.classList.add("note--error"),noteEl.innerHTML=message,noteEl.classList.remove("hide")}onFormSubmit(e){e.preventDefault();const{variant}=e.dataset;this.hasLensAttributes?this.handleFormWithLensAttributes(variant,!0):this.processProductWithoutAttributes(variant,!0)}handleFormWithLensAttributes(variant){let formSubmit=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;this.resetInvalidLensFields();const formProps=this.getFormProps(this.productFormElement),{sides,validationErrors}=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.formatAndValidateLensAttributes)(formProps,variant);this.displayPrice(),formSubmit?validationErrors.length>0?this.displayInvalidLensFields(validationErrors):this.processValidLenses(formProps,sides,variant,validationErrors,formSubmit):this.processValidLenses(formProps,sides,variant,validationErrors,formSubmit)}getFormProps(form){const formData=new FormData(form),formProps=Object.fromEntries(formData);return form.querySelectorAll('input[type="checkbox"]').forEach(checkbox=>{const name=checkbox.getAttribute("name");name.includes("side")&&(formProps[name]=checkbox.checked)}),formProps}resetInvalidLensFields(){this.lensAttributeInputs.forEach(input=>{input.parentNode.classList.remove(this.errorClass)}),this.addToCartTriggers.forEach(trigger=>{trigger.classList.add("button--error"),trigger.querySelector(".js-add-to-cart-text").innerHTML=_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.addToCart})}displayInvalidLensFields(validationErrors){validationErrors.forEach(error=>{const nameAttribute=`[name="${error.replace("Side.","_side[")}]"]`;this.productFormElement.querySelectorAll(nameAttribute).forEach(input=>{input.parentNode.classList.add(this.errorClass)})}),this.addToCartTriggers.forEach(trigger=>{trigger.classList.add("button--error"),trigger.querySelector(".js-add-to-cart-text").innerHTML=_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.addToCartErrorFields})}displayBcErrors(bcLeftSideErrors,bcRightSideErrors){if(bcLeftSideErrors||bcRightSideErrors){let errorText="";bcLeftSideErrors===bcRightSideErrors?errorText=bcLeftSideErrors:errorText=`${bcLeftSideErrors||""} ${bcLeftSideErrors&&bcRightSideErrors?"<br>":""} ${bcRightSideErrors||""}`;const noteEl=this.productFormElement.querySelector(".js-add-to-cart-error");this.showNoteElement(errorText,!1,noteEl)}}async processProductWithoutAttributes(variant,formSubmit){if(!formSubmit)return;const formProps=this.getFormProps(this.productFormElement),{bc_product_type:bcProductType,default_lead_time:defaultLeadTime}=formProps,quantity=parseInt(formProps.quantity,10),bcCustomProduct=formProps.bc_custom_product==="true",bcItem=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getBCItemFromProductWithoutAttributes)(variant,quantity,bcProductType);let bcData,bcErrors;if(!bcCustomProduct){this.setLoadingStateAddToCartTriggers();const bcResponse=await(0,_cart_bcApi__WEBPACK_IMPORTED_MODULE_4__.fetchProductFromBC)(bcItem);bcData=bcResponse.data||null,bcErrors=bcResponse.errors||null,this.displayBcErrors(bcErrors),this.removeLoadingStateAddToCartTriggers()}if(this.deliveryTextUpdateEnabled){const deliveryText=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getDeliveryTimeTextFromProductWithoutAttributes)(bcData,quantity,defaultLeadTime);
8this.deliveryTimeTexts.forEach(item=>{item.innerHTML=deliveryText})}if(formSubmit&&!bcErrors){let properties={};bcData&&(properties={...properties,...(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getLineItemPropertiesForBC)(bcData,properties)});const cartItem={id:variant.id,quantity,properties};variant.compare_at_price&&variant.compare_at_price>variant.price&&(cartItem.properties._bc_compare_at_price=variant.compare_at_price);const firmhouseProductId=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getFirmhouseIdFromMetafields)(variant.id),subscriptionPlanId=this.getSelectedSubscriptionPlanId();if(firmhouseProductId&&subscriptionPlanId){const plan=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.findFirmhousePlanById)(subscriptionPlanId);cartItem.properties._firmhouse_product_id=firmhouseProductId,cartItem.properties._subscription_plan=subscriptionPlanId,cartItem.properties._subscription_discount=plan.discount_percentage,cartItem.properties[_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.attributes.subscription]=plan.title}window.currentlySubmittedProductFormEl=this.productFormElement,this.checkIfItemCanBeAdded(subscriptionPlanId).then(itemCanBeAdded=>{itemCanBeAdded&&this.cart.addItems(cartItem)})}}async processValidLenses(formProps,sides,variant,validationErrors,formSubmit){const{bc_product_type:bcProductType,default_lead_time:defaultLeadTime}=formProps,bcCustomProduct=formProps.bc_custom_product==="true",{leftSideBC,rightSideBC}=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getBCItemsFromLensSides)(sides,variant,bcProductType);let bcLeftSideData,bcLeftSideErrors,bcRightSideData,bcRightSideErrors;if(formSubmit){if(validationErrors.length===0){if(this.setLoadingStateAddToCartTriggers(),!bcCustomProduct){if(leftSideBC){const bcLeftSideResponse=await(0,_cart_bcApi__WEBPACK_IMPORTED_MODULE_4__.fetchProductFromBC)(leftSideBC);bcLeftSideData=bcLeftSideResponse.data||null,bcLeftSideErrors=bcLeftSideResponse.errors||null}if(rightSideBC){const bcRightSideResponse=await(0,_cart_bcApi__WEBPACK_IMPORTED_MODULE_4__.fetchProductFromBC)(rightSideBC);bcRightSideData=bcRightSideResponse.data||null,bcRightSideErrors=bcRightSideResponse.errors||null}this.displayBcErrors(bcLeftSideErrors,bcRightSideErrors)}if(this.removeLoadingStateAddToCartTriggers(),this.deliveryTextUpdateEnabled){const deliveryText=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getDeliveryTimeTextFromProduct)(sides,bcLeftSideData,bcRightSideData,defaultLeadTime);
8this.deliveryTimeTexts.forEach(item=>{item.innerHTML=deliveryText})}}if(formSubmit&&validationErrors.length===0&&!bcLeftSideErrors&&!bcRightSideErrors){const subscriptionPlanId=this.getSelectedSubscriptionPlanId(),firmhouseProductId=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getFirmhouseIdFromMetafields)(variant.id),cartItems=(0,_utils_product__WEBPACK_IMPORTED_MODULE_3__.getCartItemsFromLensSides)(sides,variant,bcLeftSideData,bcRightSideData,firmhouseProductId,subscriptionPlanId);window.currentlySubmittedProductFormEl=this.productFormElement,this.checkIfItemCanBeAdded(subscriptionPlanId).then(itemCanBeAdded=>{itemCanBeAdded&&this.cart.addItems(cartItems)})}}}async checkIfItemCanBeAdded(){let subscriptionPlanId=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.cart.getState().then(state=>{let itemCanBeAdded=!0;if(state.items.length>0&&(subscriptionPlanId?itemCanBeAdded=state.items.every(item=>item.properties._subscription_plan&&item.properties._subscription_plan===subscriptionPlanId):itemCanBeAdded=state.items.every(item=>!item.properties._subscription_plan)),!itemCanBeAdded){const modal=window.modalManager.idModalMap.get("modal-subscriptions-mix-error");modal?modal.show():alert(_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.subscriptionsMixError)}return itemCanBeAdded})}addToCart(formEl){const addToCartTrigger=formEl.querySelector(".js-add-to-cart");let noteEl=formEl.querySelector(".note");this.cart.on("adding",()=>{addToCartTrigger&&addToCartTrigger.classList.add("loading"),window.currentlySubmittedProductFormEl&&(noteEl=window.currentlySubmittedProductFormEl.querySelector(".note"),this.hideNoteElement(noteEl))}),this.cart.on("added",()=>{addToCartTrigger&&addToCartTrigger.classList.remove("loading"),window.currentlySubmittedProductFormEl&&(noteEl=window.currentlySubmittedProductFormEl.querySelector(".note")),this.showNoteElement(_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.successAddToCart,!0,noteEl)}),this.cart.on("error_add_item",error=>{addToCartTrigger.classList.remove("loading"),noteEl=window.currentlySubmittedProductFormEl.querySelector(".note"),error.status===422?noteEl&&this.showNoteElement(error.description,!1,noteEl):noteEl&&this.showNoteElement(_constants_defaults__WEBPACK_IMPORTED_MODULE_2__.theme.strings.errorAddToCart,!1,noteEl)})}slideToVariantImage(variant){if(this.slider||(this.slider=window.slider["product-slider"]),this.slider&&variant.featured_image){const slides=[...this.slider.$el[0].querySelectorAll(".swiper-slide")],newSlide=this.slider.$el[0].querySelector(`[data-variant-image-id="${variant.featured_image.id}"]`);if(newSlide){const index=slides.indexOf(newSlide);index!==-1&&this.slider.slideTo(index,1e3)}}else variant.featured_image&&setTimeout(()=>{this.slideToVariantImage(variant)},200)}handleVariantWarning(variant){if(document.querySelectorAll(".js-product-warning").forEach(warningEl=>{warningEl.style.display="none"}),variant&&variant.id){const currentVariantWarning=document.querySelector(`.js-product-warning[data-variant-id="${variant.id}"]`);currentVariantWarning&&(currentVariantWarning.style.display="flex")}}}}),
8"./resources/assets/js/components/simple-gallery/SimpleGallery.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>SimpleGallery});var lightgallery__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/lightgallery/lightgallery.es5.js");class SimpleGallery{constructor(element){this.element=element,this.init()}init(){this.initLightGallery()}initLightGallery(){const triggers=document.querySelectorAll(".js-lightgallery-trigger");if(triggers&&window.galleryImages){const dynamicGallery=(0,lightgallery__WEBPACK_IMPORTED_MODULE_0__.default)(triggers,{counter:!1,download:!1,dynamic:!0,dynamicEl:window.galleryImages,licenseKey:"1111-1111-111-1111"});triggers.forEach(trigger=>{trigger.addEventListener("click",e=>{e.preventDefault();const currentThumb=document.querySelector(".swiper-slide-thumb-active .simple-gallery__thumbs-btn");if(currentThumb){const currentThumbIndex=parseInt(currentThumb.dataset.index,10);dynamicGallery.openGallery(currentThumbIndex)}})})}}}}),
8"./resources/assets/js/components/sliders/sliders.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var swiper__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/swiper/esm/components/core/core-class.js"),swiper__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/swiper/esm/components/navigation/navigation.js"),swiper__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./node_modules/swiper/esm/components/a11y/a11y.js"),swiper__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./node_modules/swiper/esm/components/pagination/pagination.js"),swiper__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./node_modules/swiper/esm/components/thumbs/thumbs.js"),swiper__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./node_modules/swiper/esm/components/autoplay/autoplay.js");const __WEBPACK_DEFAULT_EXPORT__=(()=>{swiper__WEBPACK_IMPORTED_MODULE_0__.default.use([swiper__WEBPACK_IMPORTED_MODULE_1__.default,swiper__WEBPACK_IMPORTED_MODULE_2__.default,swiper__WEBPACK_IMPORTED_MODULE_3__.default,swiper__WEBPACK_IMPORTED_MODULE_4__.default,swiper__WEBPACK_IMPORTED_MODULE_5__.default]);const defaultConfig={direction:"horizontal",slidesPerView:"auto",spaceBetween:0,preloadImages:!0,updateOnImagesReady:!0,effect:"fade",loop:!1,watchOverflow:!0,pagination:{el:".swiper-pagination",clickable:!0}},configurations=new Map;if(configurations.set("upsell-slider",{direction:"horizontal",centeredSlides:!1,preloadImages:!0,loop:!1,updateOnImagesReady:!0,slidesPerView:"auto",effect:"fade",a11y:!0,navigation:{nextEl:".swiper-button-next-upsell",prevEl:".swiper-button-prev-upsell"}}),configurations.set("slideshow",{autoplay:{delay:6e3},speed:1e3}),configurations.set("product-thumbs-slider",{direction:"horizontal",preloadImages:!0,loop:!1,spaceBetween:30,updateOnImagesReady:!0,slidesPerView:4,watchSlidesVisibility:!0,watchSlidesProgress:!0,slideToClickedSlide:!0,allowTouchMove:!1,effect:"fade",a11y:!0,observer:!0,observeParents:!0,shortSwipes:!1,breakpoints:{1200:{slidesPerView:3}},navigation:{nextEl:".swiper-button-next--thumb",prevEl:".swiper-button-prev--thumb"}}),configurations.set("product-slider",{direction:"horizontal",centeredSlides:!1,preloadImages:!0,loop:!1,spaceBetween:10,updateOnImagesReady:!0,effect:"fade",a11y:!0,observer:!0,observeParents:!0,navigation:{nextEl:".swiper-button-next--product",prevEl:".swiper-button-prev--product"},pagination:{el:".swiper-pagination",clickable:!0}}),configurations.set("collection-product-slider",{direction:"horizontal",preloadImages:!0,spaceBetween:20,updateOnImagesReady:!0,watchSlidesVisibility:!0,slidesPerView:1,effect:"fade",a11y:!0,navigation:{nextEl:".js-slider--next",prevEl:".js-slider--prev"},breakpoints:{768:{slidesPerView:2.4,spaceBetween:30},1200:{slidesPerView:3.4,spaceBetween:30},1450:{slidesPerView:4,spaceBetween:30}}}),configurations.set("collection-preview-slider",{slidesPerView:1.2,spaceBetween:25,breakpoints:{768:{slidesPerView:2.2}}}),configurations.set("product-recommendations-slider",{slidesPerView:1.2,loop:!1,spaceBetween:25,breakpoints:{1200:{slidesPerView:4}}}),configurations.set("related-products-slider",{direction:"horizontal",preloadImages:!0,spaceBetween:10,updateOnImagesReady:!0,watchSlidesVisibility:!0,slidesPerView:2,effect:"fade",a11y:!0,navigation:{nextEl:".js-slider--next",prevEl:".js-slider--prev"},breakpoints:{1400:{slidesPerView:3}}}
8),[...document.querySelectorAll(".js-slider")].forEach(sliderEl=>{let config=configurations.get(sliderEl.dataset.config);config||(config=defaultConfig),window.slider={...window.slider,[sliderEl.dataset.config]:new swiper__WEBPACK_IMPORTED_MODULE_0__.default(sliderEl.querySelector(".swiper-container"),config)}}),window.slider!==void 0&&window.slider["product-slider"]&&window.slider["product-thumbs-slider"]){const mainSlider=window.slider["product-slider"],thumbSlider=window.slider["product-thumbs-slider"];mainSlider.thumbs.swiper=thumbSlider,mainSlider.thumbs.init()}})}),
8"./resources/assets/js/components/volumeDiscounts/index.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>volumeDiscounts});var _templates_volumeDiscountTemplate__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./resources/assets/js/templates/volumeDiscountTemplate.js");async function volumeDiscounts(){const url=`${window.location.origin}/apps/multiscount/v2/discounts?shop=${window.Shopify.shop}`,volumeDealWrapperEl=document.querySelector(".js-volume-deal-wrapper");let discountTitle="Volumekortingen",isDefaultVolumeDiscount=!0,productPrice=0;if(volumeDealWrapperEl){const{discountCollectionTitle}=volumeDealWrapperEl.dataset;discountCollectionTitle&&discountCollectionTitle!==""&&(discountCollectionTitle.includes("Volume")||(discountTitle=discountCollectionTitle,isDefaultVolumeDiscount=!1))}try{const response=await fetch(url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.str
8ingify({title:discountTitle,type:"volume"})}),[data]=await response.json(),{tiers,products:discountProductIds}=data;if(volumeDealWrapperEl){productPrice=volumeDealWrapperEl.dataset.productPrice;const{productVariantPrices}=window;if(productVariantPrices&&discountProductIds){const currentProductVariant=productVariantPrices.find(variant=>discountProductIds.some(productId=>{const parsedProductId=parseInt(productId.split("/ProductVariant/")[1],10);return variant.id===parsedProductId}));currentProductVariant&¤tProductVariant.price&&(productPrice=currentProductVariant.price)}volumeDealWrapperEl.innerHTML=(0,_templates_volumeDiscountTemplate__WEBPACK_IMPORTED_MODULE_0__.default)(productPrice,tiers,isDefaultVolumeDiscount)}return response}catch{return{errors:"Nothing returned"}}}}),
8"./resources/assets/js/constants/defaults.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{lensFields:()=>lensFields,matchMobile:()=>matchMobile,rootPath:()=>rootPath,theme:()=>theme});const matchMobile=window.matchMedia("(min-width: 768px)"),{theme}=window,rootPath=theme&&theme.routes&&theme.routes.root!=="/"?`${theme.routes.root}/`:"/",lensFields=["basecurve","diameter","sph","cylinder","axe","kleur","lees_additie","type"]}),
8"./resources/assets/js/pages/product/index.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__);var _components_sliders_sliders__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./resources/assets/js/components/sliders/sliders.js"),_components_form_addToCart__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./resources/assets/js/components/form/addToCart.js"),_components_simple_gallery_SimpleGallery__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./resources/assets/js/components/simple-gallery/SimpleGallery.js"),_components_volumeDiscounts__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./resources/assets/js/components/volumeDiscounts/index.js");const productRecommendations=()=>{const container=document.querySelector(".js-product-recommendations");if(!container)return;const{baseUrl,productId,sectionId,limit}=container.dataset,recommendationsSectionUrl=`${baseUrl}?section_id=${sectionId}&product_id=${productId}&limit=${limit}`;fetch(recommendationsSectionUrl).then(res=>res.text()).then(section=>{container.innerHTML=section,(0,_components_sliders_sliders__WEBPACK_IMPORTED_MODULE_0__.default)(),container.querySelectorAll(".shopify-product-form").forEach(productForm=>{new _components_form_addToCart__WEBPACK_IMPORTED_MODULE_1__.default(productForm)})})};new _components_simple_gallery_SimpleGallery__WEBPACK_IMPORTED_MODULE_2__.default(document.querySelector(".js-simple-gallery")),document.addEventListener("shopify:section:load",event=>{event.detail.sectionId==="product-recommendations"&&productRecommendations()}),productRecommendations(),window.location.hash==="#reviews-widget"&&setTimeout(()=>{const reviewsWidget=document.querySelector(".yotpo-widget-instance");reviewsWidget&&reviewsWidget.scrollIntoView({behavior:"smooth"})},800),(0,_components_volumeDiscounts__WEBPACK_IMPORTED_MODULE_3__.default)()}),
8"./resources/assets/js/templates/productSubscriptionPlansTemplate.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_product__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./resources/assets/js/utils/product.js");const __WEBPACK_DEFAULT_EXPORT__=((product,variant)=>{const allowedPlans=(0,_utils_product__WEBPACK_IMPORTED_MODULE_0__.findFirmhousePlansByVariant)(variant);let subscriptionItems="";return allowedPlans&&allowedPlans.forEach(plan=>{if(!plan)return;const planTitle=plan.title,planId=plan.plan_id,name="subscription_plan",discountPerc=parseInt(plan.discount_percentage,10),discountPrice=variant.price*(1-discountPerc/100),label=` 9 ${planTitle} 10 <div class="product__subscription-allocation-price"> 11 <strong> 12 ${(0,_utils_product__WEBPACK_IMPORTED_MODULE_0__.formatMoney)(discountPrice)} 13 <sup>${(0,_utils_product__WEBPACK_IMPORTED_MODULE_0__.formatMoney)(variant.price)}</sup> 14 </strong> 15 / <strong>verpakking</strong> 16 </div> 17 `;allowedPlans.length===1?subscriptionItems+=` 18 <div class="product__subscription-allocation"> 19 <input type="hidden" value="${planId}" name="${name}" /> 20 <div class="label product__subscription-allocation-label"> 21 ${label} 22 </div> 23 </div> 24 `:subscriptionItems+=` 25 <div class="product__subscription-allocation"> 26 <div class="radio"> 27 <input type="radio" value="${planId}" id="plan-${planId}" name="${name}" class="input" /> 28 <label for="plan-${planId}" class="label product__subscription-allocation-label"> 29 ${label} 30 </label> 31 </div> 32 </div> 33 `}),subscriptionItems})}),
33"./resources/assets/js/templates/volumeDiscountTemplate.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var _utils_product__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./resources/assets/js/utils/product.js"),_constants_defaults__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./resources/assets/js/constants/defaults.js");const __WEBPACK_DEFAULT_EXPORT__=(function(productPrice,tiers){let isDefaultVolumeDiscount=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;const quantityPlusDiscountedPriceArray=[];tiers.forEach(tier=>{quantityPlusDiscountedPriceArray.push({[tier.requirementQuantity]:tier.value})}),window.quantityPlusDiscountedPriceArray=quantityPlusDiscountedPriceArray;const renderTierTitle=tier=>isDefaultVolumeDiscount?`${_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.discounts.from} ${tier.requirementQuantity} ${_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.discounts.items}`:tier.message;return` 34 <div class="volume-discounts"> 35 <ul> 36 ${tiers.map(tier=>`<li class="volume-discounts__item"> 37 <span>${renderTierTitle(tier)}</span> 38 <strong>${tier.value}% ${_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.discounts.discount}</strong> 39 <span class="volume-discounts__compare-at-price"> 40 <span>${(0,_utils_product__WEBPACK_IMPORTED_MODULE_0__.formatMoney)(productPrice)}</span></span> 41 <span class="volume-discounts__discounted-price"> 42 ${(0,_utils_product__WEBPACK_IMPORTED_MODULE_0__.formatMoney)(productPrice-productPrice*tier.value/100)}</span> 43 </li>`).join("")} 44 </ul> 45 </div> 46 `})}),
46"./resources/assets/js/utils/firmhouse-queries.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{applyPromotionToSubscription:()=>applyPromotionToSubscription,createCart:()=>createCart,createOrderedProduct:()=>createOrderedProduct,createSubscription:()=>createSubscription,createSubscriptionFromCart:()=>createSubscriptionFromCart,getCurrentCart:()=>getCurrentCart,getPlanSlugById:()=>getPlanSlugById,getSubscriptions:()=>getSubscriptions,updateCustomerDetails:()=>updateCustomerDetails,updatePlan:()=>updatePlan});async function getCurrentCart(){let subToken=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,subscriptionToken=subToken;subToken||(subscriptionToken=localStorage.getItem("subscriptionToken"));const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken,"X-Subscription-Token":subscriptionToken}),graphql=JSON.stringify({query:`query CurrentCart { 47 currentCart { 48 email 49 id 50 name 51 signupCompletedAt 52 token 53 orderedProducts { 54 id 55 title 56 metadata 57 } 58 activePlan { 59 id 60 name 61 } 62 subscribedPlan { 63 title 64 billingCycleIntervalUnit 65 billingCycleInterval 66 } 67 } 68 } 69 `});return(await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json()).data}async function getPlanSlugById(planId){const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken}),graphql=JSON.stringify({query:` 70 query Plans { 71 plans { 72 nodes { 73 id 74 slug 75 } 76 } 77 } 78 `,variables:{id:planId}}),body=await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json(),{plans}=body.data;return plans?plans.nodes.find(p=>p.id===planId).slug:null}async function createCart(){const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken}),graphql=JSON.stringify({query:`mutation { 79 createCart(input: {}){ 80 cart { 81 activePlan { 82 id 83 slug 84 } 85 subscribedPlan { 86 id 87 name 88 } 89 } 90 subscription { 91 id 92 token 93 } 94 } 95 } 96 `}),body=await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json(),{data}=body;return data.createCart}async function createOrderedProduct(orderedProductInput,subscriptionToken){const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken,"X-Subscription-Token":subscriptionToken}),graphql=JSON.stringify({query:` 97 mutation CreateOrderedProductV2($input: CreateOrderedProductV2Input!) { 98 createOrderedProductV2(input: $input) { 99 errors 100 subscription { 101 orderedProducts { 102 interval 103 intervalUnitOfMeasure 104 metadata 105 title 106 product { 107 metadata 108 } 109 shipmentDate 110 } 111 } 112 } 113 } 114 `,variables:{input:orderedProductInput}});return await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json()}async function getSubscriptions(){const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken}),graphql=JSON.stringify({query:` 115 query Subscriptions { 116 subscriptions { 117 totalCount 118 nodes { 119 id 120 email 121 monthlyAmount 122 name 123 companyName 124 token 125 status 126 subscribedPlan { 127 name 128 } 129 } 130 } 131 } 132 `});return(await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json()).data}async function applyPromotionToSubscription(promotionId,subscriptionId){const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken}),graphql=JSON.stringify({query:` 133 mutation applyPromotionToSubscription($input: ApplyPromotionToSubscriptionInput!) { 134 applyPromotionToSubscription(input: $input) { 135 appliedPromotion { 136 promotion { 137 publicName 138 title 139 percentDiscount 140 } 141 } 142 errors { 143 attribute 144 message 145 path 146 } 147 } 148 } 149 `,variables:{input:{promotionId,subscriptionId}}});return await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json()}async function updateCustomerDetails(subscriptionToken){let inputData=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken,"X-Subscription-Token":subscriptionToken}),graphql=JSON.stringify({query:`
150 mutation UpdateAddressDetails($input: UpdateAddressDetailsInput!) { 151 updateAddressDetails(input: $input) { 152 errors { 153 attribute 154 message 155 path 156 } 157 subscription { 158 fullName 159 address 160 city 161 zipcode 162 houseNumber 163 email 164 checkoutUrl 165 monthlyAmount 166 updatePaymentMethodUrl 167 } 168 } 169 } 170 `,variables:{input:inputData}}),body=await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json(),{data}=body;return data.updateAddressDetails}async function createSubscription(subscriptionInput){const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken}),graphql=JSON.stringify({query:` 171 mutation CreateSubscription($input: CreateSubscriptionInput!) { 172 createSubscription(input: $input) { 173 paymentUrl 174 returnUrl 175 subscription { 176 id 177 token 178 status 179 checkoutUrl 180 } 181 errors { 182 attribute 183 message 184 path 185 } 186 } 187 } 188 `,variables:{input:subscriptionInput}});return await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json()}async function createSubscriptionFromCart(subscriptionToken,subscriptionInput){const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken,"X-Subscription-Token":subscriptionToken}),graphql=JSON.stringify({query:` 189 mutation CreateSubscriptionFromCart($input: CreateSubscriptionFromCartInput!) { 190 createSubscriptionFromCart(input: $input) { 191 paymentUrl 192 returnUrl 193 subscription { 194 id 195 fullName 196 fullAddress 197 token 198 status 199 checkoutUrl 200 orderedProducts { 201 title 202 quantity 203 metadata 204 interval 205 intervalUnitOfMeasure 206 } 207 } 208 } 209 } 210 `,variables:{input:subscriptionInput}}),body=await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json(),{data}=body;return data.createSubscriptionFromCart}async function updatePlan(subscriptionToken,planSlug){const headers=new Headers({"Content-Type":"application/json","X-Project-Access-Token":window.Firmhouse.storefrontToken,"X-Subscription-Token":subscriptionToken}),graphql=JSON.stringify({query:` 211 mutation UpdatePlan($input: UpdatePlanInput!) { 212 updatePlan(input: $input) { 213 cart { 214 activePlan { 215 id 216 name 217 } 218 } 219 subscription { 220 activePlan { 221 id 222 name 223 } 224 } 225 } 226 } 227 `,variables:{input:{planSlug}}});return await(await fetch("https://portal.firmhouse.com/graphql",{method:"POST",headers,body:graphql})).json()}}),
227"./resources/assets/js/utils/image.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{getSizedImageUrl:()=>getSizedImageUrl,removeProtocol:()=>removeProtocol});function removeProtocol(path){return path.replace(/http(s)?:/,"")}const getSizedImageUrl=(src,size)=>{if(size===null)return src;if(size==="master")return removeProtocol(src);const match=src.match(/\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?$/i);if(match!==null){const prefix=src.split(match[0]),suffix=match[0];return removeProtocol(`${prefix[0]}_${size}${suffix}`)}return null}}),
227"./resources/assets/js/utils/klaviyoTracking.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{learnq:()=>learnq,trackKlaviyoAddedToCart:()=>trackKlaviyoAddedToCart});var _components_cart_api__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./resources/assets/js/components/cart/api.js");window._learnq=window._learnq||[];const learnq=window._learnq,trackKlaviyoAddedToCart=()=>{learnq&&(0,_components_cart_api__WEBPACK_IMPORTED_MODULE_0__.cartFetch)().then(state=>{const items=state.items.map(item=>{const adjustedItem=item;return["discounted_price","final_line_price","final_price","line_level_total_discount","line_price","original_line_price","original_price","price","total_discount"].forEach(key=>{const keyValue=adjustedItem[key];keyValue&&keyValue!==0&&(adjustedItem[key]=keyValue/100)}),adjustedItem}),cart={total_price:state.total_price/100,$value:state.total_price/100,total_discount:state.total_discount/100,original_total_price:state.original_total_price/100,items};learnq.push(["track","Added to Cart",cart])})}}),
227"./resources/assets/js/utils/product.js":((__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{calcSubscriptionLinePrice:()=>calcSubscriptionLinePrice,findFirmhousePlanById:()=>findFirmhousePlanById,findFirmhousePlansByVariant:()=>findFirmhousePlansByVariant,formatAndValidateLensAttributes:()=>formatAndValidateLensAttributes,formatMoney:()=>formatMoney,getBCItemFromProductWithoutAttributes:()=>getBCItemFromProductWithoutAttributes,getBCItemsFromLensSides:()=>getBCItemsFromLensSides,getCartItemsFromLensSides:()=>getCartItemsFromLensSides,getDeliveryTimeTextFromProduct:()=>getDeliveryTimeTextFromProduct,getDeliveryTimeTextFromProductWithoutAttributes:()=>getDeliveryTimeTextFromProductWithoutAttributes,getFirmhouseIdFromMetafields:()=>getFirmhouseIdFromMetafields,getFirmhousePlansFromMetafields:()=>getFirmhousePlansFromMetafields,getLineItemPropertiesForBC:()=>getLineItemPropertiesForBC,getProductImage:()=>getProductImage,getProductUrlWithVariantAndSubPlan:()=>getProductUrlWithVariantAndSubPlan,getSearchWithoutAttributesFromMetafields:()=>getSearchWithoutAttributesFromMetafields,getVariantCodeFromVariantMetafields:()=>getVariantCodeFromVariantMetafields,isCompareVaries:()=>isCompareVaries,isOnSale:()=>isOnSale,isPriceVaries:()=>isPriceVaries,normalizeProduct:()=>normalizeProduct,normalizeProductItem:()=>normalizeProductItem});var _shopify_theme_currency__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/@shopify/theme-currency/currency.js"),_constants_defaults__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./resources/assets/js/constants/defaults.js"),_image__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./resources/assets/js/utils/image.js");function formatMoney(price){return(0,_shopify_theme_currency__WEBPACK_IMPORTED_MODULE_0__.formatMoney)(price,_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.moneyFormat).replace(".00","")}function getProductImage(product){let imageSize=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"100x",image,featuredImage;return product.variants&&product.variants.length>0&&product.variants[0].image!==null?featuredImage=product.variants[0].featured_image:product.image?featuredImage=product.featured_image:image=null,image!==null&&(image={url:(0,_image__WEBPACK_IMPORTED_MODULE_2__.getSizedImageUrl)(featuredImage.url,imageSize),alt:featuredImage.alt}),image}function isOnSale(product){return product.compare_at_price_min!==null&&parseInt(product.compare_at_price_min,10)>parseInt(product.price_min,10)}function isPriceVaries(product){return product.price_max!==product.price_min}function isCompareVaries(product){return product.compare_at_price_max!==product.compare_at_price_min}function calcSubscriptionLinePrice(item){let discountPrice=null;return item.properties._subscription_plan&&item.properties._subscription_discount?(discountPrice=item.original_line_price*(1-parseInt(item.properties._subscription_discount,10)/100),formatMoney(discountPrice)):null}function normalizeProduct(product){return{url:(product.variants&&product.variants.length>0?product.variants[0]:product).url,image:getProductImage(product),title:product.title,vendor:product.vendor||"",price:formatMoney(product.price_min),compareAtPrice:formatMoney(product.compare_at_price_min),available:product.available,isOnSale:isOnSale(product),isPriceVaries:isPriceVaries(product),isCompareVaries:isCompareVaries(product)}}function normalizeProductItem(item){return{key:item.key,url:item.url,image:getProductImage(item,"200x200"),name:item.product_title,variation:item.variant_title,optionWithValue:item.options_with_values,vendor:item.vendor||"",properties:item.properties,quantity:item.quantity,price:formatMoney(item.price),linePrice:formatMoney(item.line_price),originalLinePrice:formatMoney(item.original_line_price),compareAtPrice:formatMoney(item.properties._bc_compare_at_price),discounts:item.discounts,discountsApplied:item.line_price!==item.original_line_price,subscriptionLinePrice:calcSubscriptionLinePrice(item)}}function getProductUrlWithVariantAndSubPlan(url,variantId,subscriptionPlanId){let formattedUrl=url;return/variant=/.test(url)?formattedUrl=url.replace(/(variant=)[^&]+/,`$1${variantId}`):/\?/.test(url)?formattedUrl=url.concat("&variant=").concat(variantId):formattedUrl=url.concat("?variant=").concat(variantId),subscriptionPlanId&&(
227/subscription_plan=/.test(url)?formattedUrl=formattedUrl.replace(/(subscription_plan=)[^&]+/,`$1${subscriptionPlanId}`):formattedUrl=`${formattedUrl}&subscription_plan=${subscriptionPlanId}`),formattedUrl}function formatAndValidateLensAttributes(formProps){const sides={leftSide:{},rightSide:{}},validationErrors=[];Object.entries(formProps).forEach(_ref=>{let[key,value]=_ref;const match=key.match(/^(left|right)_side\[(.*?)\]$/);if(match){const sideName=`${match[1]}Side`,fieldName=match[2].replace(/\[(.*?)\]/g,".$1");let formattedValue=value;fieldName==="quantity"&&(formattedValue=parseInt(value,10)),sides[sideName][fieldName]=formattedValue}});const validateFields=(side,sideName)=>{const invalidFields=[];return side.enabled&&_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.lensFields.forEach(field=>{side[field]===""&&invalidFields.push(`${sideName}.${field}`)}),invalidFields};if(Object.keys(sides).forEach(sideName=>{const side=sides[sideName],sideErrors=validateFields(side,sideName);side.enabled||(side.quantity=0),validationErrors.push(...sideErrors)}),!sides.leftSide.enabled&&!sides.rightSide.enabled){const quantityErrors=["leftSide.quantity","rightSide.quantity"];validationErrors.push(...quantityErrors)}return{sides,validationErrors}}function getSearchWithoutAttributesFromMetafields(variant){const variantMetafields=window.productVariantMetafields&&window.productVariantMetafields.find(item=>item.id===variant.id);return variantMetafields?variantMetafields.searchWithoutAttributes:null}function getFirmhouseIdFromMetafields(variantId){const variantMetafields=window.productVariantMetafields&&window.productVariantMetafields.find(item=>item.id===variantId);return variantMetafields?variantMetafields.firmhouseId:null}function getFirmhousePlansFromMetafields(variant){const variantMetafields=window.productVariantMetafields&&window.productVariantMetafields.find(item=>item.id===variant.id);return variantMetafields?variantMetafields.firmhouseAllowedPlans:null}function findFirmhousePlanById(planId){const plan=window.firmhousePlans.find(item=>item.plan_id===planId);return plan||null}function findFirmhousePlansByVariant(variant){const allowedPlanTitles=getFirmhousePlansFromMetafields(variant),allowedPlans=[];return!allowedPlanTitles||!window.firmhousePlans?null:(allowedPlanTitles.forEac
227h(planTitle=>{const plan=window.firmhousePlans.find(item=>item.title===planTitle);plan&&allowedPlans.push(plan)}),allowedPlans.length>0?allowedPlans:null)}function getVariantCodeFromVariantMetafields(variant){const variantMetafields=window.productVariantMetafields&&window.productVariantMetafields.find(item=>item.id===variant.id);return variantMetafields?variantMetafields.bcCode:null}function getBCItemFromProductWithoutAttributes(variant,quantity,bcProductType){const variantCode=getVariantCodeFromVariantMetafields(variant),searchWithoutAttributes=getSearchWithoutAttributesFromMetafields(variant);return{product_type:bcProductType,variant_code:variantCode,quantity,search_without_attributes:searchWithoutAttributes}}function getBCItemsFromLensSides(sides,variant,bcProductType){const bcItems={},variantCode=getVariantCodeFromVariantMetafields(variant),searchWithoutAttributes=getSearchWithoutAttributesFromMetafields(variant);return Object.keys(sides).forEach(sideName=>{const side=sides[sideName];if(side.enabled){const bcItem={product_type:bcProductType,variant_code:variantCode,quantity:side.quantity,search_without_attributes:searchWithoutAttributes};Object.keys(side).forEach(sideKey=>{if(sideKey!=="quantity"&&sideKey!=="enabled"){const bcKey=`attribute_filters[${sideKey.toUpperCase()}]`;bcItem[bcKey]=side[sideKey]}}),bcItems[`${sideName}BC`]=bcItem}}),bcItems}function getDeliveryTimeTextFromProductWithoutAttributes(bcData,quantity,defaultLeadTime){let deliveryTimeText=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.delivery_lead_time_0,leadTimeCalculation=-1;if(bcData){const{inventory}=bcData;quantity>inventory&&(leadTimeCalculation=bcData.lead_time_calculation>0?bcData.lead_time_calculation:defaultLeadTime)}if(leadTimeCalculation>-1){deliveryTimeText=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.delivery_lead_time_x.replace("{{ count }}",leadTimeCalculation);const leadTimeStringNamespace=`delivery_lead_time_${leadTimeCalculation}`;_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings[leadTimeStringNamespace]&&(deliveryTimeText=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings[leadTimeStringNamespace])}return deliveryTimeText}function getDeliveryTimeTextFromProduct(sides,bcLeftSideData,bcRightSideData,defaultLeadTime){let deliveryTimeText=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.delivery_lead_time_0,leadTimeCalculation=-1;const defaultLeadTimeStringNamespace=`delivery_lead_time_${defaultLeadTime}`;if(_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings[defaultLeadTimeStringNamespace]&&(deliveryTimeText=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings[defaultLeadTimeStringNamespace]),bcLeftSideData&&bcRightSideData&&bcLeftSideData.ean_code===bcRightSideData.ean_code){const quantity=sides.leftSide.quantity+sides.rightSide.quantity,{inventory}=bcLeftSideData;quantity>inventory&&(leadTimeCalculation=bcLeftSideData.lead_time_calculation>0?bcLeftSideData.lead_time_calculation:defaultLeadTime)}else{if(bcLeftSideData){const leftSideQuantity=sides.leftSide.quantity,leftSideInventory=bcLeftSideData.inventory;leftSideQuantity>leftSideInventory&&(leadTimeCalculation=bcLeftSideData.lead_time_calculation>0?bcLeftSideData.lead_time_calculation:defaultLeadTime)}if(bcRightSideData){const rightSideQuantity=sides.rightSide.quantity,rightSideInventory=bcRightSideData.inventory;rightSideQuantity>rightSideInventory&&bcRightSideData.lead_time_calculation>0&&bcRightSideData.lead_time_calculation>leadTimeCalculation&&(leadTimeCalculation=bcRightSideData.lead_time_calculation>0?bcRightSideData.lead_time_calculation:defaultLeadTime)}}if(leadTimeCalculation>-1){deliveryTimeText=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.delivery_lead_time_x.replace("{{ count }}",leadTimeCalculation);const leadTimeStringNamespace=`delivery_lead_time_${leadTimeCalculation}`;_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings[leadTimeStringNamespace]&&(deliveryTimeText=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings[leadTimeStringNamespace])}return deliveryTimeText}function getLineItemPropertiesForBC(bcData,properties){return console.log(bcData,properties),["item_no","code","ean_code"].forEach(key=>{const item=bcData[key];if(item){const formattedKey=key.replace("ean_code","ean");properties[`_${formattedKey}`]=item}}),properties}function getCartItemsFromLensSides(sides,variant,bcLeftSideData,bcRightSideData,firmhouseProductId,subscriptionPlanId){const cartItems=[];
227return Object.keys(sides).forEach(sideName=>{const side=sides[sideName];if(side.quantity&&side.quantity!==""){let lensProperties={};const sideKeyString=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.attributes.side||"Side",sideNameString=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.attributes[sideName]||sideName;lensProperties[sideKeyString]=sideNameString,Object.keys(side).forEach(sideKey=>{if(sideKey!=="quantity"&&sideKey!=="enabled"){const string=_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.attributes[sideKey]||sideKey;lensProperties[string]=side[sideKey]}});let bcData;sideName==="leftSide"?bcData=bcLeftSideData:sideName==="rightSide"&&(bcData=bcRightSideData),bcData&&(lensProperties=getLineItemPropertiesForBC(bcData,lensProperties));const item={id:variant.id,quantity:side.quantity,properties:lensProperties};if(firmhouseProductId&&(item.properties._firmhouse_product_id=firmhouseProductId),subscriptionPlanId){const plan=findFirmhousePlanById(subscriptionPlanId);item.properties._subscription_plan=subscriptionPlanId,item.properties._subscription_discount=plan.discount_percentage,item.properties[_constants_defaults__WEBPACK_IMPORTED_MODULE_1__.theme.strings.attributes.subscription]=plan.title}variant.compare_at_price&&variant.compare_at_price>variant.price&&(item.properties._bc_compare_at_price=variant.compare_at_price),cartItems.push(item)}}),cartItems.reverse()}})
227},__webpack_require__=>{var __webpack_exec__=moduleId=>__webpack_require__(__webpack_require__.s=moduleId);__webpack_require__.O(0,["vendor"],()=>__webpack_exec__("./resources/assets/js/pages/product/index.js"));var __webpack_exports__=__webpack_require__.O()}]); 228//# sourceMappingURL=/cdn/shop/t/4/assets/product-index.js.map?v=53580584171665867561750157583
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.