PageSourceSearch

https://aristavault.com/cdn/shop/t/153/assets/product-form.js?v=158665995997241511551750658267

js aristavault.com collected 2026-09-26 01:55:34 UTC 3,699 bytes, 2 lines download raw bytes

1customElements.get("product-form")||customElements.define("product-form",class extends HTMLElement{constructor(){super(),this.selectors={form:"form",inputId:"[name=id]",submitButton:'[name="add"]',errorWrapper:".f-product-form__error-message-wrapper",customFields:["[data-product-custom-field]"]},this.domNodes=queryDomNodes(this.selectors,this),this.form=this.domNodes.form,this.submitButton=this.domNodes.submitButton,this.domNodes.inputId.disabled=!1,this.Notification=window.FoxTheme.Notification,this.notificationType=this.dataset.notificationType,this.customFields=document.querySelectorAll(this.selectors.customFields),this.cartDrawer=document.querySelector("cart-drawer"),this.mainCart=document.querySelector("cart-items"),this.type=this.dataset.type,this.errorWrapper=this.type==="product-card"?this.closest(".product-card"):this.domNodes.errorWrapper,this.form.addEventListener("submit",this.onSubmitHandler.bind(this))}validateForm(form){const missingFields=[];return form&&form.querySelectorAll('[data-product-custom-field] [name][required]:not([hidden]):not([type="hidden"])').forEach(field=>{if(field.classList.remove("form-control--warning"),field.type==="radio"){const buttons=form.querySelectorAll(`input[name="${field.name}"]`);Array.from(buttons).some(btn=>btn.checked)||(missingFields.push(field),field.classList.add("form-control--warning"))}else field.value||(missingFields.push(field),field.classList.add("form-control--warning"))}),missingFields}onSubmitHandler(evt){evt.preventDefault();const missing=this.validateForm(this.form.closest(".f-product-single__blocks"));if(missing&&missing.length>0)return this.Notification.show({target:this.domNodes.errorWrapper,method:"appendChild",type:"warning",message:window.FoxThemeStrings.requiredField});if(this.submitButton.classList.contains("btn--loading"))return;this.submitButton.setAttribute("aria-disabled",!0),this.submitButton.classList.add("btn--loading");const config={method:"POST",headers:{Accept:"application/javascript","X-Requested-With":"XMLHttpRequest"}},formData=new FormData(this.form);this.cartDrawer&&formData.append("sections",this.cartDrawer.getSectionsToRender().map(section=>section.id)),this.mainCart&&formData.append("sections",this.mainCart.getSectionsToRender().map(section=>section.section)),(this.mainCart||this.cartDrawer)&&formData.append("sections_url",window.location.pathname),config.body=formData;const{FoxThemeSettings,FoxThemeStrings}=window;fetch(`${FoxThemeSettings.routes.cart_add_url}`,config).then(response=>response.json()).then(response=>{if(response.status)return window.FoxThemeEvents.emit(PUB_SUB_EVENTS.cartError,{source:"product-form",productVariantId:formData.get("id"),errors:response.description,message:response.message}),this.error=!0,this.Notification.show({target:this.notificationType==="toast"?document.body:this.errorWrapper,method:"appendChild",type:"warning",message:response.description||response.message,last:3e3,sticky:this.notificationType==="toast"});(!FoxThemeSettings.cart.openDrawerWhenAdded||FoxThemeSettings.cart.cartType==="page")&&this.Notification.show({target:this.errorWrapper,method:"appendChild",type:"success",message:FoxThemeStrings.item_added,last:3e3,sticky:this.notificationType==="toast"}),FoxThemeSettings.cart.cartType==="page"&&FoxThemeCartHelpers.getState().then(state=>{FoxThemeCartHelpers.updateCartCount(state.item_count)}),this.error=!1,window.FoxThemeEvents.emit("ON_ITEM_ADDED",response)}).catch(e=>{console.error(e)}).finally(()=>{this.submitButton.classList.remove("btn--loading"),this.submitButton.removeAttribute("aria-disabled")})}});
2//# sourceMappingURL=/cdn/shop/t/153/assets/product-form.js.map?v=158665995997241511551750658267

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.