PageSourceSearch

https://audocph.com/cdn/shop/t/33/assets/novicell_product-form-1790860190.js

js audocph.com collected 2026-10-01 15:14:37 UTC 4,821 bytes, 2 lines download raw bytes

1import{f as p}from"./theme-scripts-1790860190.js";customElements.get("product-form")||customElements.define("product-form",class extends HTMLElement{constructor(){super(),this.form=this.querySelector("form"),this.form.querySelector("[name=id]").disabled=!1,this.form.addEventListener("submit",this.onSubmitHandler.bind(this)),this.cart=document.querySelector("cart-notification")||document.querySelector("cart-drawer"),this.querySelector('[type="submit"]')&&document.querySelector("cart-drawer")&&this.querySelector('[type="submit"]').setAttribute("aria-haspopup","dialog")}onSubmitHandler(e){e.preventDefault();const i=JSON.parse(document.querySelector("[data-product-json]").innerHTML),d=i.product.type.toLowerCase(),c=i.selected_variant_id,s=i?.configuration?.metafields?.configuration_modules?.[c]||{},n=Object.keys(s).length>0?s:!1;p().then(t=>{if(t.swatchProductsLimitReached[0]&&d==window.swatches.productTypeUpholstery||t.swatchProductsLimitReached[0]&&d==window.swatches.productTypeMaterial){const a=new Event("click"),o=document.querySelector('[data-modal="#PopupModal-Samples"]'),r=document.querySelector("[data-stock-modal][open]");r&&r.removeAttribute("open"),o.querySelector("button").dispatchEvent(a)}else{if(this.querySelector('[type="submit"]').getAttribute("aria-disabled")==="true")return;this.handleErrorMessage(),this.querySelector('[type="submit"]').setAttribute("aria-disabled",!0),this.querySelector('[type="submit"]').classList.add("loading"),this.querySelector(".loading-overlay__spinner").classList.remove("hidden");const a=fetchConfig("javascript");a.headers["X-Requested-With"]="XMLHttpRequest",delete a.headers["Content-Type"];const o=n?new FormData:new FormData(this.form);this.appendProductRecommendationsToCart(o),this.form&&typeof this.form.id=="string"&&!this.form.id.includes("MaterialDrawer-")&&this.addBuyXGetYProductToCart(o),n&&this.appendProductModulesToCart(o,i),this.cart&&(o.append("sections",this.cart.getSectionsToRender().map(r=>r.id)),o.append("sections_url",window.location.pathname),this.cart.setActiveElement(document.activeElement)),a.body=o,fetch(`${routes.cart_add_url}`,a).then(r=>r.json()).then(r=>{if(r.status){this.handleErrorMessage(r.description);const l=this.querySelector('[type="submit"]').querySelector(".sold-out-message");if(!l)return;this.querySelector('[type="submit"]').setAttribute("aria-disabled",!0),this.querySelector('[type="submit"]').querySelector("span").classList.add("hidden"),l.classList.remove("hidden"),this.error=!0;return}else if(!this.cart){window.location=window.routes.cart_url;return}this.error||publish(PUB_SUB_EVENTS.cartUpdate,{source:"product-form"}),this.error=!1;const u=this.closest("quick-add-modal")||this.querySelector("[data-stock-modal]");u?(document.body.addEventListener("modalClosed",()=>{setTimeout(()=>{this.cart.renderContents(r)})},{once:!0}),u.hide(!0)):this.cart.renderContents(r)}).catch(r=>{console.error(r)}).finally(()=>{this.querySelector('[type="submit"]').classList.remove("loading"),this.cart&&this.cart.classList.contains("is-empty")&&this.cart.classList.remove("is-empty"),this.error||this.querySelector('[type="submit"]').removeAttribute("aria-disabled"),this.querySelector(".loading-overlay__spinner").classList.add("hidden")})}}).catch(t=>{console.error(t)})}handleErrorMessage(e=!1){this.errorMessageWrapper=this.errorMessageWrapper||this.querySelector(".product-form__error-message-wrapper"),this.errorMessageWrapper&&(this.errorMessage=this.errorMessage||this.errorMessageWrapper.querySelector(".product-form__error-message"),this.errorMessageWrapper.toggleAttribute("hidden",!e),e&&(this.errorMessage.textContent=e))}appendProductRecommendationsToCart(e){document.querySelectorAll('[id^="ProductsRecommendations"]').forEach((d,c)=>{const s=d.dataset.productRecommendationsType;Array.from(document.querySelectorAll(`.${s}-checkbox:checked`)).map(t=>t.dataset.variantId).forEach((t,a)=>{const o=c*100+a+1;e.append(`items[${o}][id]`,t),e.append(`items[${o}][quantity]`,1),e.append(`items[${o}][properties][_type]`,s)})})}appendProductModulesToCart(e,i){document.querySelectorAll("[data-add-configuration-module]").forEach((c,s)=>{const n=c.dataset.moduleId,t=s*100+s+1;e.append(`items[${t}][id]`,n),e.append(`items[${t}][quantity]`,1),e.append(`items[${t}][properties][Configuration]`,i.product.title),e.append(`items[${t}][properties][_configuration_url]`,window.location.href)})}addBuyXGetYProductToCart(e){const i=document.querySelector(".product-variant-id").value,s=JSON.parse(document.querySelector("[data-product-json]").innerHTML).configuration.metafields.buy_x_get_y[i].get_product;i&&s>0&&(e.append("items[0][id]",s),e.append("items[0][quantity]",1),e.append("items[0][properties][Campaign]","Free"))}});
2//# sourceMappingURL=/cdn/shop/t/33/assets/novicell_product-form-1790860190.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.