1import { 2 IntlTel_initPhoneInput, 3 init_cf_utils 4} from "./chunk-KIZY5IRN.js"; 5import { 6 CF2Component, 7 init_runtime, 8 registerComponent 9} from "./chunk-NQUHJ6NR.js"; 10import { 11 __esm, 12 __publicField, 13 init_define_process 14} from "./chunk-RFSPGZ3L.js"; 15
16// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/checkbox-v1.ts 17var CheckboxV1; 18var init_checkbox_v1 = __esm({ 19 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/checkbox-v1.ts"() { 20 init_define_process(); 21 init_runtime(); 22 CheckboxV1 = class extends CF2Component { 23 constructor(el, runtimeSel) { 24 super(el, runtimeSel); 25 __publicField(this, "checkbox"); 26 } 27 mount() { 28 this.checkbox = this.element.querySelector(".elCheckboxInput"); 29 this.preventClickOnLabel = this.element.getAttribute("data-prevent-click-on-label"); 30 if (this.element.dataset.triggerClickOnWrapper == "true") { 31 this.element.addEventListener("click", (e) => { 32 if (e.target.closest("a")) return; 33 e.preventDefault(); 34 this.toggle(); 35 }); 36 } else if (this.preventClickOnLabel == "true") { 37 this.element.querySelector(".elCheckboxLabel").addEventListener("click", (e) => { 38 if (e.target.closest("a")) return; 39 e.preventDefault(); 40 }); 41 this.element.querySelector(".elCheckbox").addEventListener("click", (e) => { 42 this.toggle(); 43 }); 44 } else { 45 this.element.addEventListener("click", (evt) => { 46 if (evt.target.closest("a")) return; 47 evt.preventDefault(); 48 this.toggle(); 49 }); 50 this.checkbox.addEventListener("click", (e) => { 51 e.preventDefault(); 52 e.stopPropagation(); 53 }); 54 } 55 if (this.useCheckboxIcon) { 56 const fakeCheckbox = this.element.querySelector(".elCheckbox"); 57 fakeCheckbox.addEventListener("click", () => { 58 this.toggle(); 59 }); 60 } 61 } 62 toggle() { 63 this.setChecked(!this.checkbox.checked); 64 } 65 setChecked(checked) { 66 const event = new Event("change"); 67 this.checkbox.checked = checked; 68 this.checkbox.dispatchEvent(event); 69 } 70 }; 71 registerComponent("Checkbox/V1", CheckboxV1); 72 window["CheckboxV1"] = CheckboxV1; 73 } 74}); 75
76// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/input-v1.ts 77var InputV1; 78var init_input_v1 = __esm({ 79 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/input-v1.ts"() { 80 init_define_process(); 81 init_cf_utils(); 82 init_runtime(); 83 InputV1 = class extends CF2Component { 84 constructor(el, runtimeSel) { 85 super(el, runtimeSel); 86 } 87 mount() { 88 this.input = this.element.querySelector(".elInput"); 89 this.re = /^(([^<>()[\]\.,;:#%\s@"]+(\.[^<>()[\]\.,;:#%\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 90 if (this.input.getAttribute("name") === "shipping_zip") { 91 this.input.setAttribute("maxlength", "10"); 92 } 93 this.addInputListeners(); 94 if (this.isStandalonePhoneNumberInput()) { 95 this.setupPhoneNumberInput(); 96 } 97 } 98 update() { 99 if (this.input.value) { 100 this.element.classList.add("hasValue"); 101 } else { 102 this.element.classList.remove("hasValue"); 103 } 104 } 105 isStandalonePhoneNumberInput() { 106 return this.input.getAttribute("name") === "phone_number" && !$(this.input).closest('[data-page-element="Checkout/V1"]').length && !$(this.input).closest('[data-page-element="Checkout/V2"]').length && !$(this.input).closest('[data-page-element="Survey/V1').length; 107 } 108 addInputListeners() { 109 this.input.addEventListener("focus", () => { 110 this.element.querySelector("[data-input-status-type]").innerHTML = ""; 111 this.element.classList.remove("elInputValid"); 112 this.element.classList.remove("elInputError"); 113 this.element.classList.remove("elInputWarning"); 114 this.element.classList.add("elInputFocused"); 115 }); 116 if (this.isStandalonePhoneNumberInput() && this.input.iti) { 117 this.input.addEventListener("countrychange", () => { 118 const newCountry = this.input.iti.getSelectedCountryData().iso2; 119 document.querySelectorAll('[name="phone_number"]').forEach((s) => { 120 if (s.iti) { 121 s.iti.setCountry(newCountry); 122 } 123 }); 124 }); 125 } 126 this.input.addEventListener("blur", () => { 127 this.element.classList.remove("elInputFocused"); 128 this.update(); 129 if (this.input.getAttribute("name") === "phone_number" && this.input.iti) { 130 document.querySelectorAll('[name="phone_number"]').forEach((s) => { 131 if (s.iti) { 132 s.iti.setCountry(this.input.iti.getSelectedCountryData().iso2); 133 s.iti.setNumber(this.input.value); 134 } 135 }); 136 } 137 if (this.input.classList.contains("required1") && this.element.matches(".elInputError")) { 138 if (this.input.value === "") { 139 return; 140 } else { 141 if (this.input.getAttribute("name") === "email") { 142 const parsedEmail = $.trim(input.value); 143 if (this.re.test(parsedEmail)) { 144 this.element.classList.add("elInputValid"); 145 this.element.classList.remove("elInputError"); 146 } 147 } else if (this.isStandalonePhoneNumberInput() && !window.intlTelInput.utils.isValidNumber(this.input.value)) { 148 this.element.classList.remove("elInputValid"); 149 this.element.classList.add("elInputError"); 150 } else { 151 this.element.classList.remove("elInputError"); 152 this.element.classList.add("elInputValid"); 153 } 154 } 155 } 156 }); 157 } 158 setupPhoneNumberInput() { 159 IntlTel_initPhoneInput(this.input, { 160 initialCountry: window.cfVisitorData?.country ?? "us" 161 }); 162 } 163 }; 164 registerComponent("Input/V1", InputV1); 165 window["InputV1"] = InputV1; 166 } 167}); 168 169export { 170 init_checkbox_v1, 171 init_input_v1 172}; 173//# sourceMappingURL=chunk-FQR6BHZQ.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.