PageSourceSearch

https://www.hausofyarn.com/cdn/shop/t/19/assets/gift-card-recipient-form.js?v=25114532869471163621747838877

js hausofyarn.com collected 2026-09-26 08:00:29 UTC 2,108 bytes, 2 lines download raw bytes

1import{EVENTS}from"@archetype-themes/utils/events";class GiftCardRecipientForm extends HTMLElement{constructor(){super(),this.checkboxInput=this.querySelector(".recipient-form__checkbox"),this.emailInput=this.querySelector(".recipient-form__email"),this.nameInput=this.querySelector(".recipient-form__name"),this.messageInput=this.querySelector(".recipient-form__message"),this.dateInput=this.querySelector(".recipient-form__date"),this.addEventListener("change",()=>this.onChange()),this.recipientFields=this.querySelector(".recipient-fields"),this.checkboxInput.addEventListener("change",()=>{this.recipientFields.style.display=this.checkboxInput.checked?"block":"none"})}connectedCallback(){this.abortController=new AbortController,document.addEventListener(EVENTS.ajaxProductError,event=>{event.target.querySelector('[name="id"]').value===this.dataset.productVariantId&&this.displayErrorMessage(event.detail.errorMessage)},{signal:this.abortController.signal}),document.addEventListener(EVENTS.ajaxProductAdded,event=>{event.target.querySelector('[name="id"]').value===this.dataset.productVariantId&&(this.clearInputFields(),this.clearErrorMessage())},{signal:this.abortController.signal})}disconnectedCallback(){this.abortController.abort()}onChange(){this.checkboxInput.checked||(this.clearInputFields(),this.clearErrorMessage())}clearInputFields(){for(const element of this.querySelectorAll(".field__input"))element.value=""}displayErrorMessage(body){if(this.clearErrorMessage(),body)return Object.entries(body).forEach(([key,value])=>{const inputElement=this[`${key}Input`];inputElement&&(inputElement.setAttribute("aria-invalid",!0),inputElement.classList.add("field__input--error"))})}clearErrorMessage(){for(const inputElement of this.querySelectorAll(".field__input"))inputElement.setAttribute("aria-invalid",!1),inputElement.removeAttribute("aria-describedby"),inputElement.classList.remove("field__input--error")}}customElements.define("gift-card-recipient-form",GiftCardRecipientForm);
2//# sourceMappingURL=/cdn/shop/t/19/assets/gift-card-recipient-form.js.map?v=25114532869471163621747838877

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.