1Vue.component("ack-shop-product",{delimiters:["${","}$"],template:"#ack-shop-product",created(){this.hasSellingPlans||(this.priceInfo=this.product.variants[0].priceV2)},mounted(){this.selectAvailableVariant(),this.hasSellingPlans&&(this.sellingPlansSelectValue=this.sellingPlans[0].id),this.productChecked=this.productInitiallyChecked,EventBus.$on("unselect-all-products",()=>{this.productChecked=!1}),EventBus.$on("select-all-products",()=>{this.isPurchaseTemporarilyDisabled||(this.productChecked=!0)})},props:{product:{type:Object,required:!0},productInitiallyChecked:{type:Boolean,default:!1},isMobile:{type:Boolean,required:!0}},computed:{...Vuex.mapGetters("localization",["currencySymbol","isAU_NZ","isUS_CA"]),...Vuex.mapGetters("shop",["currentCountryCode"]),variants(){return this.product.variants},sellingPlans(){return this.product.sellingPlanGroups[0]?.sellingPlans},hasVariants(){return this.variants.length>1},hasSellingPlans(){return this.product.sellingPlanGroups.length>0},selectedVariant(){return this.variantsSelectValue!=null?this.variants.find(m=>m.id==this.variantsSelectValue):this.variants[0]},priceLabel(){return this.priceInfo&&parseFloat(this.priceInfo.amount)===0||this.isSoldOut||!this.hasSellingPlans&&this.stock===0?"Sold Out":this.priceInfo?`${this.priceInfo.currencyCode} ${this.currencySymbol}${new this.numeralFormatter(this.priceInfo.amount).format("0,0.00")}`:""},price(){return this.product!=null?parseFloat(this.selectedVariant.priceV2.amount):0},stock(){return this.product!=null?parseInt(this.selectedVariant.quantityAvailable):0},getImage(){let selectedVariant=this.product.variants.find(m=>m.id==this.variantsSelectValue);return selectedVariant?selectedVariant.image.src:this.product.variants[0].image.src},inventoryWarning(){let message="";this.product.totalInventory>0&&this.product.totalInventory<10&&(message="Low stock, possible delays");let selectedVariant=this.product.variants.find(m=>m.id==this.variantsSelectValue);return selectedVariant&&selectedVariant.quantityAvailable>0&&selectedVariant.quantityAvailable<10&&(message="Low stock, possible delays"),message},restrictedProductIds(){return["gid://shopify/Product/6627055435879","gid://shopify/Product/6624780812391","gid://shopify/Product/6624785760359","gid://shopify/Product/6627062448231"]},soldOutProductIds(){return[]},isRestricted(){const restrictedProductIds=this.restrictedProductIds,currentCountryCode=this.currentCountryCode?this.currentCountryCode.toUpperCase():"";return restrictedProductIds.includes(this.product.id)&&(currentCountryCode==="US"||currentCountryCode==="CA")},isSoldOut(){return this.soldOutProductIds.includes(this.product.id)},isPurchaseTemporarilyDisabled(){return isProductPurchaseTemporarilyDisabled(this.product.id)},isUnableToBuy(){return this.stock<=0||this.isSoldOut||this.isPurchaseTemporarilyDisabled}},data(){return{pageId:"shop-product",variantsSelectValue:null,sellingPlansSelectValue:null,productChecked:!1,numeralFormatter:numeral,priceInfo:null,loading:!1,userStockNotifyInfo:{email:"",userCountry:"",requestProduct:{id:"",name:"",variant:{name:"",id:""}}},isSendingNotification:!1,emailError:""}},methods:{...Vuex.mapActions("shop",["addToCartFromProperties","buyNow","getProductPrice"]),productPrice(){this.loading=!0,this.getProductPrice({variantId:this.selectedVariant.id,sellingPlanId:this.sellingPlansSelectValue}).then(priceInfo=>{priceInfo&&(this.priceInfo=priceInfo),this.loading=!1}).catch(error=>{console.error("Error fetching price:",error),this.loading=!1})},setVariantPrice(){!this.hasVariants||this.hasSellingPlans||(this.priceInfo=this.selectedVariant.priceV2)},onBuyNowClick(){this.isPurchaseTemporarilyDisabled||(this.stock!==0&&!this.isRestricted&&this.isSoldOut?alert("This product is sold out."):this.buyNow({variantId:this.variantsSelectValue,sellingPlanId:this.sellingPlansSelectValue}).then(url=>{window.open(url,"_blank")}))},onAddToCartClick(){appLog.log("onAddToCartClick",LOG_TYPE.debug);const shopifyId=this.product.id,variantId=this.variantsSelectValue,sellingPlanId=this.sellingPlansSelectValue;if(appLog.log({shopifyId,variantId,sellingPlanId},LOG_TYPE.debug),this.isRestricted){alert("This product is not available in your region.");return}if(this.isSoldOut){alert("This product is sold out.");return}this.addToCartFromProperties({productId:shopifyId,variantId,sellingPlanId})},toggleExpand(){this.isExpanded=!this.isExpanded},selectAvailableVariant(){let availableVariant=this.variants.find(variant=>variant.quantityAvailable>0);availableVariant?this.variantsSelectValue=availableVariant.id:this.variantsSelectValue=this.variants[0].id},validateEmail(email){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)},setUserStockNotifyInfoData(){const{id,title,variants}=this.product,hasMultipleSellingPlans=this.hasSellingPlans&&this.sellingPlans.length>1;let variantId="",variantName="";if(this.hasVariants)variantId=this.variantsSelectValue,variantName=this.selectedVariant.title;else if(hasMultipleSellingPlans){variantId=this.sellingPlansSelectValue;const selectedPlan=this.sellingPlans.find(sellingPlan=>sellingPlan.id===this.sellingPlansSelectValue);variantName=selectedPlan?selectedPlan.name:""}else variants&&variants.length>0&&(variantId=variants[0].id,variantName=variants[0].title);this.userStockNotifyInfo.userCountry=this.currentCountryCode,this.userStockNotifyInfo.requestProduct.id=id,this.userStockNotifyInfo.requestProduct.name=title,this.userStockNotifyInfo.requestProduct.variant.id=variantId,this.userStockNotifyInfo.requestProduct.variant.name=variantName},onUserStockNotifyClick(){const{email}=this.userStockNotifyInfo;if(!this.validateEmail(email)){this.emailError="Please enter correct Email";return}this.emailError="",this.setUserStockNotifyInfoData(),this.sendStockAlertRequest
1()},showAlert(alertType,message){let alertToBeShown={success:{title:"Request Confirmed!",text:"We will email you as soon as this product is back in stock.",icon:"success",confirmButtonText:"ok"},failed:{icon:"error",title:"Request Unsuccessful",text:message}};alertToBeShown[alertType]&&Swal.fire(alertToBeShown[alertType])},sendStockAlertRequest(){this.isSendingNotification=!0,fetch("https://dashboard.ackuretta.com/api/Shopify/stock_notify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.userStockNotifyInfo)}).then(response=>(this.isSendingNotification=!1,response.ok?response.json():response.json().then(errBody=>{throw{status:response.status,statusText:response.statusText,body:errBody}}))).then(data=>{console.log("Response:",data),this.showAlert("success"),this.userStockNotifyInfo.email=""}).catch(err=>{this.isSendingNotification=!1;let errMessage="Something went wrong! Please try again.";err.status===409&&(errMessage="You have already requested a stock notification with this email address."),this.showAlert("failed",errMessage)})}},beforeDestroy(){},watch:{sellingPlansSelectValue:"productPrice",variantsSelectValue:"setVariantPrice",productChecked:{handler(){if(appLog.log(`productChecked change to ${this.productChecked}`),this.productChecked&&this.isPurchaseTemporarilyDisabled){this.productChecked=!1;return}if(this.productChecked==!0){let sellingPlanTitle=null;this.sellingPlansSelectValue&&(sellingPlanTitle=this.product.sellingPlanGroups[0].sellingPlans.find(m=>m.id==this.sellingPlansSelectValue).name);let variantTitle="";this.variantsSelectValue&&(variantTitle=this.product.variants.find(m=>m.id==this.variantsSelectValue).title,variantTitle==="Default Title"&&(variantTitle="")),this.$emit("product-selected",{productId:this.product.id,variantId:this.variantsSelectValue,sellingPlanId:this.sellingPlansSelectValue,img:this.getImage,pricePerUnit:this.price,quantity:1,productTitle:this.product.title,sellingPlanTitle,variantTitle})}else this.$emit("product-unselected",{productId:this.product.id,variantId:this.variantsSelectValue,sellingPlanId:this.sellingPlansSelectValue,img:this.getImage,pricePerUnit:this.price,quantity:1})},deep:!1},isMobile:{handler(){},deep:!1}}}); 2//# sourceMappingURL=/cdn/shop/t/310/assets/vue.components.shop-product.js.map?v=30248851804605920991790740172
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.