1import { 2 init_modal_sidebar_v1 3} from "./chunk-MO2D3CXO.js"; 4import { 5 init_text_area_v1 6} from "./chunk-TWAA7YIK.js"; 7import { 8 init_survey_image_option_v1 9} from "./chunk-RVGXNBF6.js"; 10import { 11 init_select_box_v2 12} from "./chunk-R4YB6JIA.js"; 13import { 14 Fetcher, 15 MANUALLY_ABORTED, 16 checkoutNonceParams, 17 fetchCheckoutNonce, 18 fetcher_exports, 19 init_fetcher, 20 init_nonce 21} from "./chunk-NXH5VC2T.js"; 22import { 23 init_addToCart, 24 mountComponent 25} from "./chunk-Q6RFXGRD.js"; 26import { 27 debounce, 28 init_general, 29 init_nanostores, 30 nanostores_exports 31} from "./chunk-BY72GGKB.js"; 32import { 33 init_checkbox_v1, 34 init_radio_v1 35} from "./chunk-Y32E43UA.js"; 36import { 37 init_input_v1 38} from "./chunk-7HBS56XK.js"; 39import { 40 init_cf_utils, 41 isWithinCustomerCenterView, 42 uuidv4 43} from "./chunk-KIZY5IRN.js"; 44import { 45 init_modal_v1 46} from "./chunk-5NUE6T5P.js"; 47import { 48 CF2Component, 49 init_runtime, 50 registerComponent, 51 runtime_exports 52} from "./chunk-NQUHJ6NR.js"; 53import { 54 __commonJS, 55 __esm, 56 __export, 57 __toCommonJS, 58 init_define_process 59} from "./chunk-RFSPGZ3L.js"; 60
61// projects/user_pages/app/javascript/lander/utils/replace_tag.js 62var require_replace_tag = __commonJS({ 63 "projects/user_pages/app/javascript/lander/utils/replace_tag.js"() { 64 init_define_process(); 65 (function($4) { 66 $4.fn.changeElementType = function(newType) { 67 var attrs = {}; 68 $4.each(this[0].attributes, function(idx, attr) { 69 attrs[attr.nodeName] = attr.nodeValue; 70 }); 71 this.replaceWith(function() { 72 return $4("<" + newType + "/>", attrs).append($4(this).contents()); 73 }); 74 }; 75 })(jQuery); 76 } 77}); 78
79// projects/shared/javascript/parseurl.js 80var require_parseurl = __commonJS({ 81 "projects/shared/javascript/parseurl.js"() { 82 init_define_process(); 83 (function($4) { 84 var re = /([^&=]+)=?([^&]*)/g; 85 var decode = function(str) { 86 return decodeURIComponent(str.replace(/\+/g, " ")); 87 }; 88 $4.parseParams = function(query) { 89 function createElement(params2, key2, value2) { 90 key2 = key2 + ""; 91 if (key2.indexOf(".") !== -1) { 92 var list = key2.split("."); 93 var new_key = key2.split(/\.(.+)?/)[1]; 94 if (!params2[list[0]]) params2[list[0]] = {}; 95 if (new_key !== "") { 96 createElement(params2[list[0]], new_key, value2); 97 } else console.warn('parseParams :: empty property in key "' + key2 + '"'); 98 } else if (key2.indexOf("[") !== -1) { 99 var list = key2.split("["); 100 key2 = list[0]; 101 var list = list[1].split("]"); 102 var index = list[0]; 103 if (index == "") { 104 if (!params2) params2 = {}; 105 if (!params2[key2] || !$4.isArray(params2[key2])) params2[key2] = []; 106 params2[key2].push(value2); 107 } else { 108 if (!params2) params2 = {}; 109 if (!params2[key2] || !$4.isArray(params2[key2])) params2[key2] = []; 110 params2[key2][parseInt(index)] = value2; 111 } 112 } else { 113 if (!params2) params2 = {}; 114 params2[key2] = value2; 115 } 116 } 117 query = query + ""; 118 if (query === "") query = window.location + ""; 119 var params = {}, e; 120 if (query) { 121 if (query.indexOf("#") !== -1) { 122 query = query.substr(0, query.indexOf("#")); 123 } 124 if (query.indexOf("?") !== -1) { 125 query = query.substr(query.indexOf("?") + 1, query.length); 126 } else return {}; 127 if (query == "") return {}; 128 while (e = re.exec(query)) { 129 var key = decode(e[1]); 130 var value = decode(e[2]); 131 createElement(params, key, value); 132 } 133 } 134 return params; 135 }; 136 })(jQuery); 137 } 138}); 139
140// projects/user_pages/app/javascript/lander/audio_player.ts 141var require_audio_player = __commonJS({ 142 "projects/user_pages/app/javascript/lander/audio_player.ts"() { 143 init_define_process(); 144 var CFbuildAudioPlayer = function(el) { 145 try { 146 el.each(function() { 147 const $this = $(this); 148 const audioURL = $this.attr("data-audio-url") || "https://images.clickfunnels.com/images/SevenNationArmy.mp3"; 149 const loop = $this.attr("data-audio-loop") || "no"; 150 const playerOptions = { 151 class: "elAudioElement", 152 audioWidth: "100%", 153 audioHeight: "100%", 154 enableAutosize: true, 155 enableProgressTooltip: false, 156 loop: loop === "yes", 157 features: ["playpause", "current", "progress", "duration", "volume"] 158 }; 159 const audio = $(this).find("audio"); 160 audio.attr("src", audioURL); 161 audio.mediaelementplayer(playerOptions); 162 }); 163 } catch (err) { 164 console.log(err); 165 } 166 }; 167 window.addEventListener("load", function() { 168 CFbuildAudioPlayer($(".pageRoot .elAudioWrapper")); 169 }); 170 } 171}); 172
173// projects/user_pages/app/javascript/lander/vendor/garlic.cf.js 174var require_garlic_cf = __commonJS({ 175 "projects/user_pages/app/javascript/lander/vendor/garlic.cf.js"() { 176 init_define_process(); 177 globalThis.CFGarlicValues = {}; 178 !function($4) { 179 "use strict"; 180 class Storage { 181 constructor() { 182 this.defined = "undefined" !== typeof localStorage; 183 } 184 get(key, placeholder) { 185 return localStorage.getItem(key) ? localStorage.getItem(key) : "undefined" !== typeof placeholder ? placeholder : null; 186 } 187 has(key) { 188 return localStorage.getItem(key) ? true : false; 189 } 190 set(key, value, fn) { 191 if ("string" === typeof value) { 192 if ("" === value) { 193 this.destroy(key); 194 } else { 195 localStorage.setItem(key, value); 196 } 197 } 198 return "function" === typeof fn ? fn() : true; 199 } 200 destroy(key, fn) { 201 localStorage.removeItem(key); 202 return "function" === typeof fn ? fn() : true; 203 } 204 } 205 window.cfGarlicUtils = { 206 buildKey: (name) => { 207 return `garlic::${document.domain}*:${name}`; 208 }, 209 retrieve: (name) => { 210 if (window.CF2_DISABLE_GARLIC) return; 211 const storage = new Storage(); 212 const key = window.cfGarlicUtils.buildKey(name); 213 return storage.get(key); 214 }, 215 store: (name, value) => { 216 if (window.CF2_DISABLE_GARLIC) return; 217 const storage = new Storage(); 218 const key = window.cfGarlicUtils.buildKey(name); 219 return storage.set(key, value); 220 } 221 }; 222 var Garlic = function(element, storage, options) { 223 this.init("garlic", element, storage, options); 224 }; 225 Garlic.prototype = { 226 constructor: Garlic, 227 /* init data, bind jQuery on() actions */ 228 init: function(type, element, storage, options) { 229 this.type = type; 230 this.$element = $4(element); 231 this.options = this.getOptions(options); 232 this.storage = storage; 233 this.path = this.getPath(); 234 this.$element.addClass("garlic-auto-save"); 235 this.$element.on(this.options.events.join("." + this.type + " "), false, $4.proxy(this.persist, this)); 236 this.retrieve(); 237 }, 238 getOptions: function(options) { 239 return $4.extend({}, $4.fn[this.type].defaults, options, this.$element.data()); 240 }, 241 /* temporary store data / state in localStorage */ 242 persist: function() { 243 if (window.CF2_DISABLE_GARLIC) return; 244 if (this.val === this.getVal()) { 245 return; 246 } 247 this.val = this.getVal(); 248 this.storage.set(this.path, this.getVal()); 249 this.options.onPersist(this.$element, this.getVal()); 250 }, 251 getVal: function() { 252 return !this.$element.is("input[type=checkbox]") ? this.$element.val() : this.$element.prop("checked") ? "checked" : "unchecked"; 253 }, 254 /* retrieve localStorage data / state and update elem accordingly */ 255 retrieve: function() { 256 if (window.CF2_DISABLE_GARLIC) return; 257 if (this.storage.has(this.path)) { 258 var storedValue = this.storage.get(this.path); 259 if (this.$element.is("input[type=radio], input[type=checkbox]")) { 260 if ("checked" === storedValue || this.$element.val() === storedValue) { 261 return this.$element.attr("checked", true); 262 } else if ("unchecked" === storedValue) { 263 this.$element.attr("checked", false); 264 } 265 return; 266 } 267 this.$element.val(storedValue); 268 this.$element.trigger("input"); 269 this.options.onRetrieve(this.$element, storedValue); 270 return; 271 } 272 }, 273 /* delete localStorage persistance only */ 274 destroy: function() { 275 if (window.CF2_DISABLE_GARLIC) return; 276 this.storage.destroy(this.path); 277 }, 278 getPath: function(elem) { 279 if ("undefined" === typeof elem) { 280 elem = this.$element; 281 } 282 if (elem.length != 1) { 283 return false;
284 } 285 const node = elem.length ? elem[0] : elem; 286 const name = node.getAttribute("name"); 287 return window.cfGarlicUtils.buildKey(name); 288 }, 289 getStorage: function() { 290 return this.storage; 291 } 292 }; 293 $4.fn.garlic = function(option, fn) { 294 const options = $4.extend(true, {}, $4.fn.garlic.defaults, option, this.data()); 295 const storage = new Storage(); 296 if (!storage.defined) { 297 return false; 298 } 299 function bind(self) { 300 var $this = $4(self), data = $this.data("garlic"), fieldOptions = $4.extend({}, options, $this.data()); 301 if ("undefined" !== typeof fieldOptions.storage && !fieldOptions.storage) { 302 return; 303 } 304 if ("password" === $4(self).attr("type")) { 305 return; 306 } 307 if (!data) { 308 $this.data("garlic", data = new Garlic(self, storage, fieldOptions)); 309 } 310 if ("string" === typeof option && "function" === typeof data[option]) { 311 return data[option](); 312 } 313 } 314 const returnValue = bind($4(this)); 315 return "function" === typeof fn ? fn() : returnValue; 316 }; 317 $4.fn.garlic.Constructor = Garlic; 318 $4.fn.garlic.defaults = { 319 events: ["DOMAttrModified", "textInput", "input", "change", "click", "keypress", "paste", "focus"], 320 // Events list that trigger a localStorage 321 onRetrieve: function() { 322 }, 323 // This function will be triggered each time Garlic find an retrieve a local stored data for a field 324 onPersist: function() { 325 } 326 // This function will be triggered each time Garlic stores a field to local storage 327 }; 328 }(window.jQuery || window.Zepto); 329 } 330}); 331
332// projects/user_pages/app/javascript/lander/populate_select.ts 333var populate_select_exports = {}; 334__export(populate_select_exports, { 335 populateSelect: () => populateSelect 336}); 337var populateSelect; 338var init_populate_select = __esm({ 339 "projects/user_pages/app/javascript/lander/populate_select.ts"() { 340 init_define_process(); 341 globalThis.ClickFunnels = globalThis.ClickFunnels ?? {}; 342 populateSelect = (selectElement, type = void 0) => { 343 type = type ?? $(selectElement).parents(".elSelectWrapper").attr("data-type"); 344 let items; 345 const allCountries = globalThis.ClickFunnels.all_countries; 346 if (type == "all_united_states") { 347 selectElement.innerHTML = "<option> Select State </option>"; 348 items = allCountries.find((c) => c.iso2 == "US")?.regions; 349 items.forEach((item) => selectElement.innerHTML += `<option value="${item.state_code}" > ${item.name} </option>`); 350 } else if (type == "all_canadian_provinces") { 351 selectElement.innerHTML = "<option> Select State </option>"; 352 items = allCountries.find((c) => c.iso2 == "CA")?.regions; 353 items.forEach((item) => selectElement.innerHTML += `<option value="${item.state_code}" > ${item.name} </option>`); 354 } else if (type == "all_countries") { 355 const topMapping = ["US", "CA", "GB", "IE", "AU", "NZ"]; 356 const topHash = topMapping.reduce((acc, val) => { 357 acc[val] = true; 358 return acc; 359 }, {}); 360 const topOptions = topMapping.map((iso2) => ({ iso2 })); 361 const remainingOptions = []; 362 allCountries.forEach((item) => { 363 if (topHash[item.iso2]) { 364 const option = topOptions.find((option2) => option2.iso2 == item.iso2); 365 option.name = item.name; 366 } else { 367 remainingOptions.push(item); 368 } 369 }); 370 let html = ""; 371 topOptions.forEach((item) => html += `<option value="${item.iso2}" > ${item.name} </option>`); 372 remainingOptions.forEach((item) => html += `<option value="${item.iso2}" > ${item.name} </option>`); 373 selectElement.innerHTML = html; 374 } 375 }; 376 globalThis.ClickFunnels.populateSelect = populateSelect; 377 window.addEventListener("load", function() { 378 if (!$(".elCheckout, .elSelect, .elSuperSelect").length) return; 379 if ($('[data-page-element="Checkout/V2"]').length) return; 380 $.ajax({ 381 type: "GET", 382 contentType: "application/json", 383 url: "/cf_countries_states" 384 }).then((data) => { 385 globalThis.ClickFunnels.all_countries = data.result; 386 window.dispatchEvent(new CustomEvent("CF2_COUNTRIES_FETCHED")); 387 $(".elSelect, .elSuperSelect").each((index, element) => { 388 populateSelect(element); 389 }); 390 }); 391 }); 392 } 393}); 394
395// projects/user_pages/app/javascript/lander/runtime_events.ts 396var require_runtime_events = __commonJS({ 397 "projects/user_pages/app/javascript/lander/runtime_events.ts"() { 398 init_define_process(); 399 var CFEvents2 = /* @__PURE__ */ ((CFEvents3) => { 400 CFEvents3["FORM_SUBMITTED"] = "cf:form_submitted"; 401 CFEvents3["FORM_SUBMITTED_OK"] = "cf:form_submitted:ok"; 402 CFEvents3["FORM_SUBMITTED_FINALIZED"] = "cf:form_submitted:finalized"; 403 return CFEvents3; 404 })(CFEvents2 || {}); 405 globalThis.CFEvents = CFEvents2; 406 globalThis.CFDispatchEvent = function(eventName, detail) { 407 const event = new CustomEvent(eventName, { detail }); 408 document.dispatchEvent(event); 409 }; 410 } 411}); 412
413// projects/user_pages/app/javascript/lander/fhl_handle_select_transformation.ts 414var fhl_handle_select_transformation_exports = {}; 415var init_fhl_handle_select_transformation = __esm({ 416 "projects/user_pages/app/javascript/lander/fhl_handle_select_transformation.ts"() { 417 init_define_process(); 418 init_populate_select(); 419 window.addEventListener("CF2_COUNTRIES_FETCHED", function() { 420 const $allCountrySelects = $(".elSelectWrapper[data-type='all_countries'] .elSelect[name='country']"); 421 const $allStateInputs = $(".elInput[name='state']"); 422 let $allStates = $(".elSelect[name='state']"); 423 if ($allCountrySelects.length && $allStates.length && !$allStateInputs.length) { 424 $allCountrySelects.on("change", function() { 425 const $select = $(this); 426 const val = $select.val(); 427 $allStates = $(".elSelect[name='state']"); 428 if (val != "US") { 429 $allStates.html(""); 430 $allStates.val(""); 431 $allStates.changeElementType("input"); 432 $allStates = $(".elSelect[name='state']"); 433 $allStates.attr("placeholder", "Shipping State"); 434 } else { 435 $allStates.val(""); 436 $allStates.changeElementType("select"); 437 $allStates = $(".elSelect[name='state']"); 438 $allStates.each((index, element) => populateSelect(element)); 439 } 440 }); 441 $allCountrySelects.trigger("change"); 442 } 443 }); 444 } 445}); 446
vendor: 868 bytes, lines 447-461
447// node_modules/uuid/dist/esm-browser/stringify.js 448function unsafeStringify(arr, offset = 0) { 449 return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); 450} 451var byteToHex; 452var init_stringify = __esm({ 453 "node_modules/uuid/dist/esm-browser/stringify.js"() { 454 init_define_process(); 455 byteToHex = []; 456 for (let i = 0; i < 256; ++i) { 457 byteToHex.push((i + 256).toString(16).slice(1)); 458 } 459 } 460}); 461
vendor: 560 bytes, lines 462-479
462// node_modules/uuid/dist/esm-browser/rng.js 463function rng() { 464 if (!getRandomValues) { 465 if (typeof crypto === "undefined" || !crypto.getRandomValues) { 466 throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); 467 } 468 getRandomValues = crypto.getRandomValues.bind(crypto); 469 } 470 return getRandomValues(rnds8); 471} 472var getRandomValues, rnds8; 473var init_rng = __esm({ 474 "node_modules/uuid/dist/esm-browser/rng.js"() { 475 init_define_process(); 476 rnds8 = new Uint8Array(16); 477 } 478}); 479
vendor: 335 bytes, lines 480-489
480// node_modules/uuid/dist/esm-browser/native.js 481var randomUUID, native_default; 482var init_native = __esm({ 483 "node_modules/uuid/dist/esm-browser/native.js"() { 484 init_define_process(); 485 randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto); 486 native_default = { randomUUID }; 487 } 488}); 489
vendor: 936 bytes, lines 490-524
490// node_modules/uuid/dist/esm-browser/v4.js 491function v4(options, buf, offset) { 492 if (native_default.randomUUID && !buf && !options) { 493 return native_default.randomUUID(); 494 } 495 options = options || {}; 496 const rnds = options.random ?? options.rng?.() ?? rng(); 497 if (rnds.length < 16) { 498 throw new Error("Random bytes length must be >= 16"); 499 } 500 rnds[6] = rnds[6] & 15 | 64; 501 rnds[8] = rnds[8] & 63 | 128; 502 if (buf) { 503 offset = offset || 0; 504 if (offset < 0 || offset + 16 > buf.length) { 505 throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`); 506 } 507 for (let i = 0; i < 16; ++i) { 508 buf[offset + i] = rnds[i]; 509 } 510 return buf; 511 } 512 return unsafeStringify(rnds); 513} 514var v4_default; 515var init_v4 = __esm({ 516 "node_modules/uuid/dist/esm-browser/v4.js"() { 517 init_define_process(); 518 init_native(); 519 init_rng(); 520 init_stringify(); 521 v4_default = v4; 522 } 523}); 524
vendor: 181 bytes, lines 525-532
525// node_modules/uuid/dist/esm-browser/index.js 526var init_esm_browser = __esm({ 527 "node_modules/uuid/dist/esm-browser/index.js"() { 528 init_define_process(); 529 init_v4(); 530 } 531}); 532
vendor: 16,955 bytes, lines 533-1103
533// node_modules/@clickfunnels2/cfhoy.js/dist/cfhoy.esm.js 534function visitsUrl() { 535 return config.urlPrefix + config.visitsUrl; 536} 537function eventsUrl() { 538 return config.urlPrefix + config.eventsUrl; 539} 540function isEmpty(obj) { 541 return Object.keys(obj).length === 0; 542} 543function canTrackNow() { 544 return (config.useBeacon || config.trackNow) && isEmpty(config.headers) && canStringify && typeof window.navigator.sendBeacon !== "undefined" && !config.withCredentials; 545} 546function serialize(object) { 547 var data = new FormData(); 548 for (var key in object) { 549 if (object.hasOwnProperty(key)) { 550 data.append(key, object[key]); 551 } 552 } 553 return data; 554} 555function setCookie(name, value, ttl) { 556 Cookies.set(name, value, ttl, config.cookieDomain || config.domain); 557} 558function getCookie(name) { 559 return Cookies.get(name); 560} 561function destroyCookie(name) { 562 Cookies.set(name, "", -1); 563} 564function getFbclid() { 565 var fbclidQueryString = QueryString.get("fbclid"); 566 if (fbclidQueryString) { 567 return fbclidQueryString; 568 } else { 569 var fbcCookie = getCookie("_fbc"); 570 if (fbcCookie) { 571 var fbclid = fbcCookie.slice(19); 572 return fbclid; 573 } else { 574 return null; 575 } 576 } 577} 578function getG4ClientId() { 579 var g4Cookie = getCookie("_ga"); 580 if (g4Cookie) { 581 var g4ClientId = g4Cookie.slice(6); 582 return g4ClientId; 583 } else { 584 return null; 585 } 586} 587function log(message) { 588 if (getCookie("cfhoy_debug")) { 589 window.console.log(message); 590 } 591} 592function setReady() { 593 var callback; 594 while (callback = queue.shift()) { 595 callback(); 596 } 597 isReady = true; 598} 599function matchesSelector(element, selector) { 600 var matches = element.matches || element.matchesSelector || element.mozMatchesSelector || element.msMatchesSelector || element.oMatchesSelector || element.webkitMatchesSelector; 601 if (matches) { 602 if (matches.apply(element, [selector])) { 603 return element; 604 } else if (element.parentElement) { 605 return matchesSelector(element.parentElement, selector); 606 } 607 return null; 608 } else { 609 log("Unable to match"); 610 return null; 611 } 612} 613function onEvent(eventName, selector, callback) { 614 document.addEventListener(eventName, function(e) { 615 var matchedElement = matchesSelector(e.target, selector); 616 if (matchedElement) { 617 callback.call(matchedElement, e); 618 } 619 }); 620} 621function documentReady(callback) { 622 if (document.readyState === "interactive" || document.readyState === "complete") { 623 setTimeout(callback, 0); 624 } else { 625 document.addEventListener("DOMContentLoaded", callback); 626 } 627} 628function generateId(key) { 629 if (key === void 0) key = null; 630 if (key) { 631 if (idCache[key]) { 632 return idCache[key]; 633 } else { 634 var newId = v4_default(); 635 idCache[key] = newId; 636 return newId; 637 } 638 } 639 return v4_default(); 640} 641function saveEventQueue() { 642 if (config.cookies && canStringify) { 643 setCookie("cfhoy_events", JSON.stringify(eventQueue), 1); 644 } 645} 646function csrfToken() { 647 var meta = document.querySelector("meta[name=csrf-token]"); 648 return meta && meta.content; 649} 650function csrfParam() { 651 var meta = document.querySelector("meta[name=csrf-param]"); 652 return meta && meta.content; 653} 654function CSRFProtection(xhr) { 655 var token = csrfToken(); 656 if (token) { 657 xhr.setRequestHeader("X-CSRF-Token", token); 658 } 659} 660function sendRequest(url, data, success, error) { 661 if (canStringify) { 662 if ($2 && $2.ajax) { 663 $2.ajax({ 664 type: "POST", 665 url, 666 data: JSON.stringify(data), 667 contentType: "application/json; charset=utf-8", 668 dataType: "json", 669 beforeSend: CSRFProtection, 670 success, 671 error, 672 headers: config.headers, 673 xhrFields: { 674 withCredentials: config.withCredentials 675 } 676 }); 677 } else { 678 var xhr = new XMLHttpRequest(); 679 xhr.open("POST", url, true); 680 xhr.withCredentials = config.withCredentials; 681 xhr.setRequestHeader("Content-Type", "application/json"); 682 for (var header in config.headers) { 683 if (config.headers.hasOwnProperty(header)) { 684 xhr.setRequestHeader(header, config.headers[header]); 685 } 686 } 687 xhr.onload = function() { 688 if (xhr.status >= 200 && xhr.status < 400) { 689 success(null, null, xhr); 690 } else if (error) { 691 error(null, null, xhr); 692 } 693 }; 694 xhr.onerror = function() { 695 if (error) { 696 error(null, null, xhr); 697 } 698 }; 699 CSRFProtection(xhr); 700 xhr.send(JSON.stringify(data)); 701 } 702 } 703} 704function eventData(event) { 705 var data = { 706 events: [event] 707 }; 708 if (config.cookies) { 709 data.visit_token = event.visit_token; 710 data.visitor_token = event.visitor_token; 711 } 712 delete event.visit_token; 713 delete event.visitor_token; 714 return data; 715} 716function trackEvent(event) { 717 ahoy.ready(function() { 718 sendRequest(eventsUrl(), eventData(event), function() { 719 for (var i = 0; i < eventQueue.length; i++) { 720 if (eventQueue[i].id == event.id) { 721 eventQueue.splice(i, 1); 722 break; 723 } 724 } 725 saveEventQueue(); 726 }); 727 }); 728} 729function trackEventNow(event) { 730 ahoy.ready(function() { 731 var data = eventData(event); 732 var param = csrfParam(); 733 var token = csrfToken(); 734 if (param && token) { 735 data[param] = token; 736 } 737 data.events_json = JSON.stringify(data.events); 738 delete data.events; 739 window.navigator.sendBeacon(eventsUrl(), serialize(data)); 740 }); 741} 742function page() { 743 return config.page || window.location.pathname; 744} 745function presence(str) { 746 return str && str.length > 0 ? str : null; 747} 748function cleanObject(obj) { 749 for (var key in obj) { 750 if (obj.hasOwnProperty(key)) { 751 if (obj[key] === null) { 752 delete obj[key]; 753 } 754 } 755 } 756 return obj; 757} 758function eventProperties() { 759 return cleanObject({ 760 tag: this.tagName.toLowerCase(), 761 id: presence(this.id), 762 "class": presence(this.className), 763 page: page(), 764 section: getClosestSection(this) 765 }); 766} 767function getClosestSection(element) { 768 for (; element && element !== document; element = element.parentNode) { 769 if (element.hasAttribute("data-section")) { 770 return element.getAttribute("data-section"); 771 } 772 } 773 return null; 774} 775function createVisit() { 776 if (visitTrackedThisRequest) { 777 return; 778 } 779 isReady = false; 780 if (config.adoptVisit && config.adoptVisit.visitId && config.adoptVisit.visitorId) { 781 if (getCookie("cfhoy_visit") !== config.adoptVisit.visitId) { 782 setCookie("cfhoy_visit", config.adoptVisit.visitId, config.visitDuration); 783 } 784 if (getCookie("cfhoy_visitor") !== config.adoptVisit.visitorId) { 785 setCookie("cfhoy_visitor", config.adoptVisit.visitorId, config.visitorDuration); 786 } 787 if (getCookie("cfhoy_successful_visit_track") !== config.adoptVisit.visitId) { 788 setCookie("cfhoy_successful_visit_track", config.adoptVisit.visitId, config.visitDuration); 789 } 790 } 791 visitId = ahoy.getVisitId(); 792 visitorId = ahoy.getVisitorId(); 793 track = getCookie("cfhoy_track"); 794 var successful_visit_track = getCookie("cfhoy_successful_visit_track") === visitId; 795 if (config.cookies === false || config.trackVisits === false) { 796 log("Visit tracking disabled"); 797 setReady(); 798 } else if (visitId && visitorId && successful_visit_track && !track) { 799 log("Active visit"); 800 setReady(); 801 } else { 802 if (!visitId) { 803 visitId = generateId(); 804 setCookie("cfhoy_visit", visitId, config.visitDuration); 805 } 806 if (getCookie("cfhoy_visit")) { 807 log("Visit started"); 808 if (!visitorId) { 809 visitorId = generateId(); 810 setCookie("cfhoy_visitor", visitorId, config.visitorDuration); 811 } 812 var fbclid = getFbclid(); 813 var fbc = getCookie("_fbc"); 814 var fbp = getCookie("_fbp"); 815 var g4_client_id = getG4ClientId(); 816 var data = { 817 visit_token: visitId, 818 visitor_token: visitorId, 819 time: (/* @__PURE__ */ new Date()).getTime() / 1e3, 820 platform: config.platform, 821 landing_page: window.location.href, 822 screen_width: window.screen.width, 823 screen_height: window.screen.height, 824 fbclid, 825 fbc, 826 fbp, 827 js: true, 828 g4_client_id, 829 track_events: config.trackPageViewWithVisit ? [visitPageViewEvent()] : [] 830 }; 831 if (document.referrer.length > 0) { 832 data.referrer = document.referrer; 833 } 834 for (var key in config.visitParams) { 835 if (config.visitParams.hasOwnProperty(key)) { 836 data[key] = config.visitParams[key]; 837 } 838 } 839 log(data); 840 visitTrackedThisRequest = true; 841 sendRequest( 842 visitsUrl(), 843 data, 844 function(_data, _textStatus, jqXHR) { 845 if (config.extendedInstrumentation) { 846 var visitResponseCode = jqXHR.status; 847 var headers = config.extendedIntrumentationResponseHeaders.map(function(header) { 848 return header + "_" + jqXHR.getResponseHeader(header); 849 }).join("__"); 850 setCookie("cfhoy_extended_instrumentation", visitResponseCode + "__" + headers, config.visitDuration); 851 } 852 setCookie("cfhoy_successful_visit_track", visitId, config.visitDuration); 853 destroyCookie("cfhoy_track"); 854 setReady(); 855 }, 856 function() { 857 visitTrackedThisRequest = false; 858 setReady(); 859 } 860 ); 861 } else { 862 log("Cookies disabled"); 863 setReady(); 864 } 865 } 866} 867function visitPageViewEvent() { 868 var additionalProperties = config.trackPageViewWithVisitAdditionalProps() || {}; 869 return trackEventData("$view", trackPageViewData(additionalProperties)); 870} 871function trackEventData(name, properties) { 872 var event = { 873 name, 874 properties: properties || {}, 875 time: (/* @__PURE__ */ new Date()).getTime() / 1e3, 876 id: generateId(name === "$view" ? "pageview" : null), 877 source: window.location.href, 878 js: true 879 }; 880 return event; 881} 882function trackPageViewData(additionalProperties) { 883 var properties = { 884 url: window.location.href, 885 title: document.title, 886 page: page(), 887 platform: config.platform 888 }; 889 if (additionalProperties) { 890 for (var propName in additionalProperties) { 891 if (additionalProperties.hasOwnProperty(propName)) { 892 properties[propName] = additionalProperties[propName]; 893 } 894 } 895 } 896 return properties; 897} 898var Cookies, QueryString, config, ahoy, $2, visitId, visitorId, track, isReady, queue, canStringify, eventQueue, visitTrackedThisRequest, idCache, i, originalStart; 899var init_cfhoy_esm = __esm({ 900 "node_modules/@clickfunnels2/cfhoy.js/dist/cfhoy.esm.js"() { 901 init_define_process(); 902 init_esm_browser(); 903 Cookies = { 904 set: function(name, value, ttl, domain) { 905 var expires = ""; 906 var cookieDomain = ""; 907 if (ttl) { 908 var date = /* @__PURE__ */ new Date(); 909 date.setTime(date.getTime() + ttl * 60 * 1e3); 910 expires = "; expires=" + date.toGMTString(); 911 } 912 if (domain) { 913 cookieDomain = "; domain=" + domain; 914 } 915 document.cookie = name + "=" + escape(value) + expires + cookieDomain + "; path=/; samesite=lax"; 916 }, 917 get: function(name) { 918 var i, c; 919 var nameEQ = name + "="; 920 var ca = document.cookie.split(";"); 921 for (i = 0; i < ca.length; i++) { 922 c = ca[i]; 923 while (c.charAt(0) === " ") { 924 c = c.substring(1, c.length); 925 } 926 if (c.indexOf(nameEQ) === 0) { 927 return unescape(c.substring(nameEQ.length, c.length)); 928 } 929 } 930 return null; 931 } 932 }; 933 QueryString = { 934 get: function(name) { 935 var query = window.location.search.substring(1); 936 var vars = query.split("&"); 937 for (var i = 0; i < vars.length; i++) { 938 var pair = vars[i].split("="); 939 if (decodeURIComponent(pair[0]) == name) { 940 return decodeURIComponent(pair[1]); 941 } 942 } 943 return null; 944 } 945 }; 946 config = { 947 urlPrefix: "", 948 visitsUrl: "/ahoy/visits", 949 eventsUrl: "/ahoy/events", 950 page: null, 951 platform: "Web", 952 useBeacon: true, 953 startOnReady: true, 954 trackVisits: true, 955 cookies: true, 956 cookieDomain: null, 957 trackPageViewWithVisit: false, 958 headers: {}, 959 visitParams: {}, 960 withCredentials: false, 961 visitDuration: 4 * 60, 962 // default 4 hours 963 visitorDuration: 2 * 365 * 24 * 60, 964 // default 2 years, 965 trackPageViewWithVisitAdditionalProps: function() { 966 }, 967 extendedInstrumentation: false, 968 extendedIntrumentationResponseHeaders: ["X-Clickfunnels-Version"] 969 }; 970 ahoy = window.ahoy || window.Ahoy || {}; 971 ahoy.configure = function(options) { 972 for (var key in options) { 973 if (options.hasOwnProperty(key)) { 974 config[key] = options[key]; 975 } 976 } 977 }; 978 ahoy.configure(ahoy); 979 $2 = window.jQuery || window.Zepto || window.$; 980 isReady = false; 981 queue = []; 982 canStringify = typeof JSON !== "undefined" && typeof JSON.stringify !== "undefined"; 983 eventQueue = []; 984 visitTrackedThisRequest = false; 985 idCache = {}; 986 ahoy.ready = function(callback) { 987 if (isReady) { 988 callback(); 989 } else { 990 queue.push(callback); 991 } 992 }; 993 ahoy.getVisitId = ahoy.getVisitToken = function() { 994 return getCookie("cfhoy_visit"); 995 }; 996 ahoy.getVisitorId = ahoy.getVisitorToken = function() { 997 return getCookie("cfhoy_visitor"); 998 }; 999 ahoy.reset = function() { 1000 destroyCookie("cfhoy_visit"); 1001 destroyCookie("cfhoy_visitor"); 1002 destroyCookie("cfhoy_events"); 1003 destroyCookie("cfhoy_track"); 1004 destroyCookie("cfhoy_successful_visit_track"); 1005 visitTrackedThisRequest = false; 1006 ahoy.start = originalStart; 1007 return true; 1008 }; 1009 ahoy.debug = function(enabled) { 1010 if (enabled === false) { 1011 destroyCookie("cfhoy_debug"); 1012 } else { 1013 setCookie("cfhoy_debug", "t", 365 * 24 * 60); 1014 } 1015 return true; 1016 }; 1017 ahoy.track = function(name, properties, options) { 1018 var event = trackEventData(name, properties); 1019 var force = options && options.force; 1020 ahoy.ready(function() { 1021 if (name === "$view" && config.cookies && !getCookie("cfhoy_successful_visit_track")) { 1022 createVisit(); 1023 return; 1024 } 1025 if (config.cookies && !ahoy.getVisitId()) { 1026 createVisit(); 1027 } 1028 ahoy.ready(function() { 1029 log(event); 1030 event.visit_token = ahoy.getVisitId(); 1031 event.visitor_token = ahoy.getVisitorId(); 1032 var documentEvent = new CustomEvent("cfhoy:tracked", { detail: event }); 1033 document.dispatchEvent(documentEvent); 1034 if (name === "$view" && config.trackPageViewWithVisit && visitTrackedThisRequest && !force) { 1035 return; 1036 } 1037 if (canTrackNow()) { 1038 trackEventNow(event); 1039 } else { 1040 eventQueue.push(event); 1041 saveEventQueue(); 1042 setTimeout(function() { 1043 trackEvent(event); 1044 }, 1e3); 1045 } 1046 }); 1047 }); 1048 return true; 1049 }; 1050 ahoy.trackView = function(additionalProperties, options) { 1051 ahoy.track("$view", trackPageViewData(additionalProperties), options); 1052 }; 1053 ahoy.trackClicks = function(selector) { 1054 if (selector === void 0) { 1055 throw new Error("Missing selector"); 1056 } 1057 onEvent("click", selector, function(e) { 1058 var properties = eventProperties.call(this, e); 1059 properties.text = properties.tag == "input" ? this.value : (this.textContent || this.innerText || this.innerHTML).replace(/[\s\r\n]+/g, " ").trim(); 1060 properties.href = this.href; 1061 ahoy.track("$click", properties); 1062 }); 1063 }; 1064 ahoy.trackSubmits = function(selector) { 1065 if (selector === void 0) { 1066 throw new Error("Missing selector"); 1067 } 1068 onEvent("submit", selector, function(e) { 1069 var properties = eventProperties.call(this, e); 1070 ahoy.track("$submit", properties); 1071 }); 1072 }; 1073 ahoy.trackChanges = function(selector) { 1074 log("trackChanges is deprecated and will be removed in 0.5.0"); 1075 if (selector === void 0) { 1076 throw new Error("Missing selector"); 1077 } 1078 onEvent("change", selector, function(e) { 1079 var properties = eventProperties.call(this, e); 1080 ahoy.track("$change", properties); 1081 }); 1082 }; 1083 try { 1084 eventQueue = JSON.parse(getCookie("cfhoy_events") || "[]"); 1085 } catch (e) { 1086 } 1087 for (i = 0; i < eventQueue.length; i++) { 1088 trackEvent(eventQueue[i]); 1089 } 1090 ahoy.start = function() { 1091 createVisit(); 1092 ahoy.start = function() { 1093 }; 1094 }; 1095 originalStart = ahoy.start; 1096 documentReady(function() { 1097 if (config.startOnReady) { 1098 ahoy.start(); 1099 } 1100 }); 1101 } 1102}); 1103
1104// projects/user_pages/app/javascript/lander/track_events.js 1105var track_events_exports = {}; 1106function cfhoyVisitorData() { 1107 return { 1108 firstName: Cookies.get("contact_first_name"), 1109 lastName: Cookies.get("contact_last_name"), 1110 emailAddress: Cookies.get("contact_email_address"), 1111 phoneNumber: Cookies.get("contact_phone_number"), 1112 postalCode: Cookies.get("contact_postal_code"), 1113 country: Cookies.get("contact_country"), 1114 uuid: Cookies.get("cfhoy_visitor") 1115 }; 1116} 1117function getLeadEventID() { 1118 return Cookies.get("cfhoy_lead_event_id"); 1119} 1120function removeLeadEventID() { 1121 Cookies.set("cfhoy_lead_event_id", "", -1); 1122 return true; 1123} 1124function getPurchaseEventID() { 1125 return Cookies.get("cfhoy_purchase_event_id"); 1126} 1127function removePurchaseEventID() { 1128 Cookies.set("cfhoy_purchase_event_id", "", -1); 1129 return true; 1130} 1131function getRenderedPage() { 1132 return document.querySelector('meta[name="rendered-page-url"]')?.getAttribute("content"); 1133} 1134function getCfTokenFromUrl() { 1135 return new URLSearchParams(window.location.search).get(CF_TOKEN_PARAM); 1136} 1137function stripCfTokenFromUrl() { 1138 const url = new URL(window.location.href); 1139 if (!url.searchParams.has(CF_TOKEN_PARAM)) return; 1140 url.searchParams.delete(CF_TOKEN_PARAM); 1141 window.history.replaceState({}, "", url.toString()); 1142} 1143function pageUrlWithoutQuery() { 1144 const url = new URL(window.location.href); 1145 url.search = ""; 1146 url.hash = ""; 1147 return url.toString(); 1148} 1149function workspaceResolveTokenUrl() { 1150 return "/_cf/resolve_token"; 1151} 1152async function resolveCfTokenIfPresent() { 1153 const token = getCfTokenFromUrl(); 1154 if (!token) return; 1155 try { 1156 const response = await fetch(workspaceResolveTokenUrl(), { 1157 method: "POST", 1158 headers: { "Content-Type": "application/json", Accept: "application/json" }, 1159 body: JSON.stringify({ cf_token: token, url: pageUrlWithoutQuery() }) 1160 }); 1161 stripCfTokenFromUrl(); 1162 if (!response.ok) return; 1163 const payload = await response.json(); 1164 if (!payload.contact_uuid || !payload.visit_uuid) return; 1165 ahoy.configure({ 1166 adoptVisit: { visitId: payload.visit_uuid, visitorId: payload.contact_uuid } 1167 }); 1168 } catch { 1169 stripCfTokenFromUrl(); 1170 } 1171} 1172function isLivePage(queryString) { 1173 const urlParams = new URLSearchParams(queryString); 1174 return urlParams.get("preview") !== "true"; 1175} 1176var livePage, trackingDisabled, renderedPage, CF_TOKEN_PARAM; 1177var init_track_events = __esm({ 1178 "projects/user_pages/app/javascript/lander/track_events.js"() { 1179 init_define_process(); 1180 init_cfhoy_esm(); 1181 init_cfhoy_esm(); 1182 livePage = isLivePage(window.location.search); 1183 trackingDisabled = window.disableTracking; 1184 renderedPage = getRenderedPage(); 1185 ahoy.configure({ 1186 urlPrefix: "/_cf", 1187 visitsUrl: "/s", 1188 eventsUrl: "/a", 1189 platform: "Web", 1190 useBeacon: true, 1191 startOnReady: false, 1192 trackVisits: true, 1193 cookies: true, 1194 withCredentials: false, 1195 visitDuration: 4 * 60, 1196 // 4 hours 1197 visitorDuration: 2 * 365 * 24 * 60, 1198 // 2 years 1199 page: renderedPage, 1200 trackPageViewWithVisit: true, 1201 trackPageViewWithVisitAdditionalProps: () => ({ 1202 cfhoy_visitor: Cookies.get("cfhoy_visitor") || "", 1203 request_type: "visit" 1204 }), 1205 extendedInstrumentation: true 1206 }); 1207 CF_TOKEN_PARAM = "__cf_token"; 1208 if (!trackingDisabled && livePage) { 1209 const startCfHoy = () => { 1210 if (window._cfHoyStarted) return; 1211 window._cfHoyStarted = true; 1212 ahoy.start(); 1213 }; 1214 const resolveAndStart = () => resolveCfTokenIfPresent().finally(startCfHoy); 1215 if (document.readyState === "complete") { 1216 resolveAndStart(); 1217 } else { 1218 window.addEventListener("load", resolveAndStart); 1219 } 1220 document.addEventListener("cfhoy:tracked", function(event) { 1221 window.dataLayer = window.dataLayer || []; 1222 if (event.detail.name == "$view") { 1223 const visitorData = cfhoyVisitorData(); 1224 dataLayer.push({ 1225 event: "cfPageView", 1226 contactFirstName: visitorData.firstName, 1227 contactLastName: visitorData.lastName, 1228 contactEmailAddress: visitorData.emailAddress, 1229 contactPhoneNumber: visitorData.phoneNumber, 1230 contactPostalCode: visitorData.postalCode, 1231 contactCountry: visitorData.country, 1232 contactExternalID: visitorData.uuid, 1233 visitEventID: event.detail.id 1234 }); 1235 } 1236 }); 1237 document.addEventListener("DOMContentLoaded", function(event) { 1238 const additionalProps = { 1239 cfhoy_visitor: Cookies.get("cfhoy_visitor") || "", 1240 request_type: "trackView" 1241 }; 1242 ahoy.trackView(additionalProps); 1243 $(document).on("click", '[event-tracking="enable"]', function() { 1244 const data = { 1245 url: window.location.href, 1246 page: renderedPage || window.location.pathname, 1247 title: document.title 1248 }; 1249 ahoy.track("$button_click", data); 1250 }); 1251 }); 1252 } 1253 document.addEventListener("DOMContentLoaded", function(event) { 1254 window.dataLayer = window.dataLayer || []; 1255 const visitorData = cfhoyVisitorData(); 1256 const leadEventID = getLeadEventID(); 1257 const purchaseEventID = getPurchaseEventID(); 1258 if (leadEventID) { 1259 dataLayer.push({ 1260 event: "cfLead", 1261 contactFirstName: visitorData.firstName, 1262 contactLastName: visitorData.lastName, 1263 contactEmailAddress: visitorData.emailAddress, 1264 contactPhoneNumber: visitorData.phoneNumber, 1265 contactPostalCode: visitorData.postalCode, 1266 contactCountry: visitorData.country, 1267 contactExternalID: visitorData.uuid, 1268 leadEventID 1269 }); 1270 removeLeadEventID(); 1271 } 1272 if (purchaseEventID) { 1273 dataLayer.push({ 1274 event: "cfPurchase", 1275 contactFirstName: visitorData.firstName, 1276 contactLastName: visitorData.lastName, 1277 contactEmailAddress: visitorData.emailAddress, 1278 contactPhoneNumber: visitorData.phoneNumber, 1279 contactPostalCode: visitorData.postalCode, 1280 contactCountry: visitorData.country, 1281 contactExternalID: visitorData.uuid, 1282 purchaseEventID 1283 }); 1284 removePurchaseEventID(); 1285 } 1286 }); 1287 } 1288}); 1289
1290// projects/user_pages/app/javascript/lander/resource_sharing_concern.js 1291var resource_sharing_concern_exports = {}; 1292var init_resource_sharing_concern = __esm({ 1293 "projects/user_pages/app/javascript/lander/resource_sharing_concern.js"() { 1294 init_define_process(); 1295 init_cfhoy_esm(); 1296 document.addEventListener("DOMContentLoaded", function() { 1297 const queryString = window.location.search; 1298 const urlParams = new URLSearchParams(queryString); 1299 const ttl = 30 * 24 * 60; 1300 const workspace_sharing_id = urlParams.get("workspace_sharing_id"); 1301 if (workspace_sharing_id) { 1302 Cookies.set("workspace_sharing_id", workspace_sharing_id, ttl); 1303 } 1304 const resource_install_intent_ttl = 24 * 60 * 60; 1305 const resource_install_intent = urlParams.get("resource_install_intent"); 1306 if (resource_install_intent) { 1307 Cookies.set("resource_install_intent", resource_install_intent, resource_install_intent_ttl); 1308 } 1309 const awid_ttl = 60 * 60; 1310 const awid = urlParams.get("awid"); 1311 if (awid) { 1312 Cookies.set("awid", awid, awid_ttl); 1313 } 1314 }); 1315 } 1316}); 1317
1318// projects/user_pages/app/javascript/lander/vendor/mailCheck/domains.ts 1319var defaultDomains, defaultSecondLevelDomains, defaultTopLevelDomains; 1320var init_domains = __esm({ 1321 "projects/user_pages/app/javascript/lander/vendor/mailCheck/domains.ts"() { 1322 init_define_process(); 1323 defaultDomains = [ 1324 "msn.com", 1325 "bellsouth.net", 1326 "telus.net", 1327 "comcast.net", 1328 "optusnet.com.au", 1329 "earthlink.net", 1330 "qq.com", 1331 "sky.com", 1332 "icloud.com", 1333 "mac.com", 1334 "sympatico.ca", 1335 "googlemail.com", 1336 "att.net", 1337 "xtra.co.nz", 1338 "web.de", 1339 "cox.net", 1340 "gmail.com", 1341 "ymail.com", 1342 "aim.com", 1343 "rogers.com", 1344 "verizon.net", 1345 "rocketmail.com", 1346 "google.com", 1347 "optonline.net", 1348 "sbcglobal.net", 1349 "aol.com", 1350 "me.com", 1351 "btinternet.com", 1352 "charter.net", 1353 "shaw.ca" 1354 ]; 1355 defaultSecondLevelDomains = ["yahoo", "hotmail", "mail", "live", "outlook", "gmx"]; 1356 defaultTopLevelDomains = [ 1357 "com", 1358 "com.au", 1359 "com.tw", 1360 "ca", 1361 "co.nz", 1362 "co.uk", 1363 "de", 1364 "fr", 1365 "it", 1366 "ru", 1367 "net", 1368 "org", 1369 "edu", 1370 "gov", 1371 "jp", 1372 "nl", 1373 "kr", 1374 "se", 1375 "eu", 1376 "ie", 1377 "co.il", 1378 "us", 1379 "at", 1380 "be", 1381 "dk", 1382 "hk", 1383 "es", 1384 "gr", 1385 "ch", 1386 "no", 1387 "cz", 1388 "in", 1389 "net", 1390 "net.au", 1391 "info", 1392 "biz", 1393 "mil", 1394 "co.jp", 1395 "sg", 1396 "hu", 1397 "uk", 1398 "io" 1399 ]; 1400 } 1401}); 1402
1403// projects/user_pages/app/javascript/lander/vendor/mailCheck/main.ts 1404var define, Mailcheck; 1405var init_main = __esm({ 1406 "projects/user_pages/app/javascript/lander/vendor/mailCheck/main.ts"() { 1407 init_define_process(); 1408 init_domains(); 1409 Mailcheck = { 1410 domainThreshold: 2, 1411 secondLevelThreshold: 2, 1412 topLevelThreshold: 2, 1413 run: function(opts) { 1414 opts.domains = opts.domains || defaultDomains; 1415 opts.secondLevelDomains = opts.secondLevelDomains || defaultSecondLevelDomains; 1416 opts.topLevelDomains = opts.topLevelDomains || defaultTopLevelDomains; 1417 opts.distanceFunction = opts.distanceFunction || Mailcheck.sift4Distance; 1418 const defaultCallback = function(result2) { 1419 return result2; 1420 }; 1421 const suggestedCallback = opts.suggested || defaultCallback; 1422 const emptyCallback = opts.empty || defaultCallback; 1423 const result = Mailcheck.suggest( 1424 Mailcheck.encodeEmail(opts.email), 1425 opts.domains, 1426 opts.secondLevelDomains, 1427 opts.topLevelDomains, 1428 opts.distanceFunction 1429 ); 1430 return result ? suggestedCallback(result) : emptyCallback(); 1431 }, 1432 suggest: function(email, domains, secondLevelDomains, topLevelDomains, distanceFunction) { 1433 email = email.toLowerCase(); 1434 const emailParts = this.splitEmail(email); 1435 if (secondLevelDomains && topLevelDomains) { 1436 if (secondLevelDomains.indexOf(emailParts.secondLevelDomain) !== -1 && topLevelDomains.indexOf(emailParts.topLevelDomain) !== -1) { 1437 return false; 1438 } 1439 } 1440 let closestDomain = this.findClosestDomain(emailParts.domain, domains, distanceFunction, this.domainThreshold); 1441 if (closestDomain) { 1442 if (closestDomain == emailParts.domain) { 1443 return false; 1444 } else { 1445 return { address: emailParts.address, domain: closestDomain, full: emailParts.address + "@" + closestDomain }; 1446 } 1447 } 1448 const closestSecondLevelDomain = this.findClosestDomain( 1449 emailParts.secondLevelDomain, 1450 secondLevelDomains, 1451 distanceFunction, 1452 this.secondLevelThreshold 1453 ); 1454 const closestTopLevelDomain = this.findClosestDomain( 1455 emailParts.topLevelDomain, 1456 topLevelDomains, 1457 distanceFunction, 1458 this.topLevelThreshold 1459 ); 1460 if (emailParts.domain) { 1461 closestDomain = emailParts.domain; 1462 let rtrn = false; 1463 if (closestSecondLevelDomain && closestSecondLevelDomain != emailParts.secondLevelDomain) { 1464 closestDomain = closestDomain.replace(emailParts.secondLevelDomain, closestSecondLevelDomain); 1465 rtrn = true; 1466 } 1467 if (closestTopLevelDomain && closestTopLevelDomain != emailParts.topLevelDomain && emailParts.secondLevelDomain !== "") { 1468 closestDomain = closestDomain.replace(new RegExp(emailParts.topLevelDomain + "$"), closestTopLevelDomain); 1469 rtrn = true; 1470 } 1471 if (rtrn) { 1472 return { address: emailParts.address, domain: closestDomain, full: emailParts.address + "@" + closestDomain }; 1473 } 1474 } 1475 return false; 1476 }, 1477 findClosestDomain: function(domain, domains, distanceFunction, threshold) { 1478 threshold = threshold || this.topLevelThreshold; 1479 let dist; 1480 let minDist = Infinity; 1481 let closestDomain = null; 1482 if (!domain || !domains) { 1483 return false; 1484 } 1485 if (!distanceFunction) { 1486 distanceFunction = this.sift4Distance; 1487 } 1488 for (let i = 0; i < domains.length; i++) { 1489 if (domain === domains[i]) { 1490 return domain; 1491 } 1492 dist = distanceFunction(domain, domains[i]); 1493 if (dist < minDist) { 1494 minDist = dist; 1495 closestDomain = domains[i]; 1496 } 1497 } 1498 if (minDist <= threshold && closestDomain !== null) { 1499 return closestDomain; 1500 } else { 1501 return false; 1502 } 1503 }, 1504 sift4Distance: function(s1, s2, maxOffset) { 1505 if (maxOffset === void 0) { 1506 maxOffset = 5; 1507 } 1508 if (!s1 || !s1.length) { 1509 if (!s2) { 1510 return 0; 1511 } 1512 return s2.length; 1513 } 1514 if (!s2 || !s2.length) { 1515 return s1.length; 1516 } 1517 const l1 = s1.length; 1518 const l2 = s2.length; 1519 let c1 = 0; 1520 let c2 = 0; 1521 let lcss = 0; 1522 let local_cs = 0; 1523 let trans = 0; 1524 const offset_arr = []; 1525 while (c1 < l1 && c2 < l2) { 1526 if (s1.charAt(c1) == s2.charAt(c2)) { 1527 local_cs++; 1528 let isTrans = false;
1529 let i = 0; 1530 while (i < offset_arr.length) { 1531 const ofs = offset_arr[i]; 1532 if (c1 <= ofs.c1 || c2 <= ofs.c2) { 1533 isTrans = Math.abs(c2 - c1) >= Math.abs(ofs.c2 - ofs.c1); 1534 if (isTrans) { 1535 trans++; 1536 } else { 1537 if (!ofs.trans) { 1538 ofs.trans = true; 1539 trans++; 1540 } 1541 } 1542 break; 1543 } else { 1544 if (c1 > ofs.c2 && c2 > ofs.c1) { 1545 offset_arr.splice(i, 1); 1546 } else { 1547 i++; 1548 } 1549 } 1550 } 1551 offset_arr.push({ 1552 c1, 1553 c2, 1554 trans: isTrans 1555 }); 1556 } else { 1557 lcss += local_cs; 1558 local_cs = 0; 1559 if (c1 != c2) { 1560 c1 = c2 = Math.min(c1, c2); 1561 } 1562 for (let j = 0; j < maxOffset && (c1 + j < l1 || c2 + j < l2); j++) { 1563 if (c1 + j < l1 && s1.charAt(c1 + j) == s2.charAt(c2)) { 1564 c1 += j - 1; 1565 c2--; 1566 break; 1567 } 1568 if (c2 + j < l2 && s1.charAt(c1) == s2.charAt(c2 + j)) { 1569 c1--; 1570 c2 += j - 1; 1571 break; 1572 } 1573 } 1574 } 1575 c1++; 1576 c2++; 1577 if (c1 >= l1 || c2 >= l2) { 1578 lcss += local_cs; 1579 local_cs = 0; 1580 c1 = c2 = Math.min(c1, c2); 1581 } 1582 } 1583 lcss += local_cs; 1584 return Math.round(Math.max(l1, l2) - lcss + trans); 1585 }, 1586 splitEmail: function(email) { 1587 email = email !== null ? email.replace(/^\s*/, "").replace(/\s*$/, "") : null; 1588 const parts = email.split("@"); 1589 if (parts.length < 2) { 1590 return false; 1591 } 1592 for (let i = 0; i < parts.length; i++) { 1593 if (parts[i] === "") { 1594 return false; 1595 } 1596 } 1597 const domain = parts.pop(); 1598 const domainParts = domain.split("."); 1599 let sld = ""; 1600 let tld = ""; 1601 if (domainParts.length === 0) { 1602 return false; 1603 } else if (domainParts.length == 1) { 1604 tld = domainParts[0]; 1605 } else { 1606 sld = domainParts[0]; 1607 for (let j = 1; j < domainParts.length; j++) { 1608 tld += domainParts[j] + "."; 1609 } 1610 tld = tld.substring(0, tld.length - 1); 1611 } 1612 return { 1613 topLevelDomain: tld, 1614 secondLevelDomain: sld, 1615 domain, 1616 address: parts.join("@") 1617 }; 1618 }, 1619 // Encode the email address to prevent XSS but leave in valid 1620 // characters, following this official spec: 1621 // http://en.wikipedia.org/wiki/Email_address#Syntax 1622 encodeEmail: function(email) { 1623 let result = encodeURI(email); 1624 result = result.replace("%20", " ").replace("%25", "%").replace("%5E", "^").replace("%60", "`").replace("%7B", "{").replace("%7C", "|").replace("%7D", "}"); 1625 return result; 1626 } 1627 }; 1628 if (typeof define === "function" && define.amd) { 1629 define("mailcheck", [], function() { 1630 return Mailcheck; 1631 }); 1632 } 1633 if (typeof window !== "undefined" && window.jQuery) { 1634 ; 1635 (function($4) { 1636 $4.fn.mailcheck = function(opts) { 1637 const self = this; 1638 if (opts.suggested) { 1639 const oldSuggested = opts.suggested; 1640 opts.suggested = function(result) { 1641 oldSuggested(self, result); 1642 }; 1643 } 1644 if (opts.empty) { 1645 const oldEmpty = opts.empty; 1646 opts.empty = function() { 1647 oldEmpty.call(null, self); 1648 }; 1649 } 1650 opts.email = this.val(); 1651 Mailcheck.run(opts); 1652 }; 1653 })(jQuery); 1654 } 1655 } 1656}); 1657
1658// projects/user_pages/app/javascript/lander/submit.ts 1659var submit_exports = {}; 1660__export(submit_exports, { 1661 checkValidInputs: () => checkValidInputs, 1662 restoreButtonState: () => restoreButtonState, 1663 submitPage: () => submitPage 1664}); 1665function restoreButtonState() { 1666 $3('.elBTN a[href="#submit-form"]').each(function() { 1667 const $this = $3(this); 1668 const $text = $this.find(".elButtonMainText"); 1669 const $subText = $this.find(".elButtonSub"); 1670 const previousText = $this.attr("data-before-submit-text"); 1671 const previousSub = $this.attr("data-before-submit-sub"); 1672 const loadingSpinner = $text.parent().find(".elButtonSpinner"); 1673 loadingSpinner.css("display", "none"); 1674 if (previousText) { 1675 $this.removeClass("cf-submitting-page"); 1676 $text.text(previousText); 1677 $subText.text(previousSub); 1678 $this.removeAttr("data-before-submit-text"); 1679 $this.removeAttr("data-before-submit-sub"); 1680 } 1681 }); 1682} 1683function setButtonSubmitText(text, subtext) { 1684 $3('.elBTN a[href="#submit-form"]').each(function() { 1685 const $this = $3(this); 1686 const $text = $this.find(".elButtonMainText"); 1687 const $subText = $this.find(".elButtonSub"); 1688 const submitText = text ?? ($this.attr("data-param-submittingtext")?.length ? $this.attr("data-param-submittingtext") : "Submitting..."); 1689 const dataBeforeSubmit = $this.attr("data-before-submit-text"); 1690 if (!dataBeforeSubmit) { 1691 $this.attr("data-before-submit-text", $text.text()); 1692 $this.attr("data-before-submit-sub", $subText.text()); 1693 $this.addClass("cf-submitting-page"); 1694 } 1695 const loadingSpinner = $this.find(".elButtonSpinner"); 1696 $text.text(`${submitText}`); 1697 $subText.text(subtext ?? ""); 1698 loadingSpinner.css("display", "inline-block"); 1699 }); 1700} 1701async function sleepMs(timeMs) { 1702 return new Promise((resolve) => { 1703 setTimeout(resolve, timeMs); 1704 }); 1705} 1706function getRenderedHref() { 1707 const renderedPage2 = document.querySelector('meta[name="rendered-page-url"]')?.getAttribute("content"); 1708 const renderedPath = renderedPage2 ?? window.location.pathname; 1709 const url = new URL(window.location.href); 1710 url.pathname = renderedPath; 1711 return url.toString(); 1712} 1713function submitRedirectTarget(response) { 1714 const location = response.headers.get("Location"); 1715 if (location && location !== "null" && location !== "undefined") return location; 1716 if (response.redirected && response.url) return response.url; 1717 return null; 1718} 1719async function submitOrderAsync(body, maxRetries = 3, onBeforeSubmit, onRetryAfter) { 1720 let response; 1721 for (let i = 0; i < maxRetries; i++) { 1722 try { 1723 onBeforeSubmit(); 1724 const nonce = await fetchCheckoutNonce(); 1725 const nonceQuery = new URLSearchParams(checkoutNonceParams(nonce)).toString(); 1726 response = await fetch(getRenderedHref(), { 1727 credentials: "same-origin", 1728 method: "post", 1729 body: [body, nonceQuery].filter(Boolean).join("&"), 1730 headers: { 1731 "Content-Type": "application/x-www-form-urlencoded", 1732 "X-CF2-POST-TYPE": "submit" 1733 } 1734 }); 1735 if (response.status === 429) { 1736 const sleepTime = parseInt(response.headers.get("Retry-After")); 1737 onRetryAfter(sleepTime); 1738 console.log(`Waiting on queue, retrying after ${sleepTime}`); 1739 await sleepMs(sleepTime); 1740 } else { 1741 break; 1742 } 1743 } catch (err) { 1744 console.log(err); 1745 await sleepMs(5e3); 1746 } 1747 } 1748 return response; 1749} 1750function submitPage() { 1751 const data = globalThis.processForm(); 1752 $3("#cfAR .purchaseInput").remove(); 1753 data.purchase?.product_variants?.forEach((pv) => { 1754 $3("#cfAR").append( 1755 `<input type="text" class="purchaseInput" name="purchase[product_variants][][id]" value="${pv.id}" />` 1756 ); 1757 $3("#cfAR").append( 1758 `<input type="number" class="purchaseInput" name="purchase[product_variants][][quantity]" value="${pv.quantity}"/>` 1759 ); 1760 $3("#cfAR").append( 1761 `<input type="number" class="purchaseInput" name="purchase[product_variants][][price_id]" value="${pv.price_id}" />` 1762 ); 1763 }); 1764 data.purchase?.coupon_codes?.forEach((couponCode) => { 1765 $3("#cfAR").append( 1766 `<input type="text" class="purchaseInput" name="purchase[coupon_codes][]" value="${couponCode}" />` 1767 ); 1768 }); 1769 $3("#cfAR").append('<input type="text" class="purchaseInput" name="purchase[process_new_order]" value="true" />'); 1770 clearBlankInputFields(); 1771 const formData = [$3("#cfAR").serialize(), `request_idempotency=${uuidv4()}`].join("&"); 1772 let timer = null;
1773 globalThis.CFDispatchEvent(CFEvents.FORM_SUBMITTED, data); 1774 submitOrderAsync( 1775 formData, 1776 3, 1777 () => { 1778 clearInterval(timer); 1779 setButtonSubmitText(); 1780 }, 1781 (sleepTime) => { 1782 let remainingSeconds = sleepTime / 1e3; 1783 clearInterval(timer); 1784 timer = setInterval(() => { 1785 remainingSeconds -= 1; 1786 setButtonSubmitText("Waiting on queue", `(Retrying in ${remainingSeconds}s)`); 1787 }, 1e3); 1788 } 1789 ).then((response) => { 1790 if (response.status == 422) { 1791 response.json().then((responseJson) => { 1792 clearInterval(timer); 1793 window.dispatchEvent( 1794 new CustomEvent("checkout:order-submit-errors", { 1795 detail: { 1796 error: `Failed to submit: ${responseJson.error}` 1797 } 1798 }) 1799 ); 1800 restoreButtonState(); 1801 }); 1802 } else if (response.ok) { 1803 globalThis.CFDispatchEvent(CFEvents.FORM_SUBMITTED_OK, data); 1804 restoreButtonState(); 1805 if (response.headers.get("X-CF2-APPROVAL-URL")) { 1806 const approvalUrl = response.headers.get("X-CF2-APPROVAL-URL"); 1807 const auxWrapper = document.querySelector(".multiple-payment-aux-frame"); 1808 const $auxWrapper = $3(auxWrapper); 1809 const iframe = document.createElement("iframe"); 1810 const orderStautsIframe = "/cf_order_status?disable-dispatch=true"; 1811 iframe.onload = () => { 1812 if (iframe.src.includes(orderStautsIframe)) { 1813 $auxWrapper.css("display", "flex"); 1814 iframe.src = approvalUrl; 1815 } 1816 }; 1817 auxWrapper.innerHTML = ""; 1818 auxWrapper.appendChild(iframe); 1819 iframe.src = orderStautsIframe; 1820 } else { 1821 const isOrder = !!data.purchase; 1822 globalThis.CFDispatchEvent(CFEvents.FORM_SUBMITTED_FINALIZED, data); 1823 window.location.href = isOrder ? response.headers.get("Location") : submitRedirectTarget(response) ?? getRenderedHref(); 1824 } 1825 } else if (response.status === 429) { 1826 clearInterval(timer); 1827 setButtonSubmitText("Failed to submit", "Retry again in a few seconds"); 1828 sleepMs(5e3).then(() => { 1829 window.dispatchEvent(new CustomEvent("payments:submit-failed")); 1830 restoreButtonState(); 1831 }); 1832 } else if (response.status >= 300 && response.status < 400) { 1833 window.location.href = submitRedirectTarget(response) ?? window.location.href; 1834 } else { 1835 window.dispatchEvent(new CustomEvent("checkout:order-submit-errors")); 1836 } 1837 }).catch((err) => { 1838 console.log(err); 1839 clearInterval(timer); 1840 window.dispatchEvent(new CustomEvent("payments:submit-failed")); 1841 restoreButtonState(); 1842 }); 1843} 1844function clearBlankInputFields() { 1845 $3("#cfAR").find("input,select,textarea").each((index, input) => { 1846 if (input.value == "" && !input.classList.contains("keep")) { 1847 input.remove(); 1848 } 1849 }); 1850} 1851function getPurchaseForm() { 1852 const orderCart = window["OrderCart/V1"]?.default; 1853 if (!orderCart) return {}; 1854 const products = orderCart?.productVariants; 1855 const formPurchaseProductVariants = products?.map((product) => { 1856 return { 1857 id: product.id, 1858 price_id: product.priceId, 1859 quantity: product.quantity 1860 }; 1861 }); 1862 const rebillyToken = $3('#cfAR input[data-rebilly="token"]').val(); 1863 return { 1864 purchase: { 1865 product_variants: formPurchaseProductVariants, 1866 rebilly_token: rebillyToken, 1867 coupon_codes: [orderCart?.couponCode].filter(Boolean) 1868 } 1869 }; 1870} 1871function getAppointmentScheduleRequestForm() { 1872 const request = { appointments_schedule_request: {} }; 1873 document.querySelectorAll(".appointment_schedule_request_field").forEach((field) => { 1874 const fieldName = field.getAttribute("name")?.replace("appointment_schedule_request_", ""); 1875 cfARAppendInput(`appointments_schedule_request[${fieldName}]`, field.value, { 1876 param: `appointments_schedule_request[${fieldName}]` 1877 }); 1878 request.appointments_schedule_request[fieldName] = field.value; 1879 }); 1880 const emailField = document.querySelector("[name='email']"); 1881 if (emailField) { 1882 const cfEmailInput = document.querySelector("#cf_contact_email"); 1883 cfEmailInput.value = emailField.value; 1884 } 1885 const guestEmailInputs = document.querySelectorAll("input.guest-input"); 1886 const guestEmailStrings = [];
1887 guestEmailInputs.forEach((i) => guestEmailStrings.push(i.value)); 1888 cfARAppendInput("appointments_schedule_request[guest_emails]", guestEmailStrings.join(",")); 1889 return request; 1890} 1891function getContactForm() { 1892 const data = { contact: {} }; 1893 $3('.elFormItem:not([data-prevent-submit="true"])').each(function() { 1894 const $this = $3(this); 1895 if ($this.parents('[data-page-element="Checkout/V2"]').length > 0) return; 1896 let name = $this.attr("name"); 1897 if (name == "" || name == "not-set") return; 1898 if (["country", "state"].includes(name)) { 1899 name = "shipping_" + name; 1900 } 1901 let value = $this.val(); 1902 if (name == "phone_number" && this.iti) { 1903 value = this.iti.getNumber(); 1904 } 1905 if (this.getAttribute("type") == "checkbox") { 1906 if (name.endsWith("[]")) { 1907 const checkboxName = name.slice(0, -2); 1908 if (!data.contact[checkboxName]) { 1909 data.contact[checkboxName] = []; 1910 } 1911 if ($this.is(":checked")) { 1912 data.contact[checkboxName].push(value); 1913 } else { 1914 const index = data.contact[checkboxName].indexOf(value); 1915 if (index > -1) { 1916 data.contact[checkboxName].splice(index, 1); 1917 } 1918 } 1919 return; 1920 } else { 1921 value = $this.is(":checked"); 1922 data.contact[name] = value; 1923 } 1924 } else if (value) { 1925 data.contact[name] = value; 1926 } 1927 const $contactInput = $3("#cf_contact_" + name); 1928 if ($contactInput.length == 0 && name) { 1929 let customType = name.toLowerCase(); 1930 customType = customType.replace(/\s+/g, "_"); 1931 $3("#cf_contact_" + customType).remove(); 1932 cfARAppendInput(customType, value, { prefix: "cf_contact_" }); 1933 } else { 1934 if ($this.attr("data-prevent-submit") == "true") { 1935 $contactInput.val(""); 1936 } else { 1937 $contactInput.val(value); 1938 } 1939 } 1940 }); 1941 return data; 1942} 1943function handleMultiCheckboxForm() { 1944 $3('.elGroupedCheckbox .elFormItem:not([data-prevent-submit="true"])').each(function() { 1945 const $this = $3(this); 1946 const name = $this.attr("name"); 1947 const value = $this.val(); 1948 const checked = $this.is(":checked"); 1949 if (checked && value && !document.querySelector(`#cfAR input[name="${name}"][value="${value}"]`)) { 1950 cfARAppendInput(name, value); 1951 } else if (!document.querySelector(`#cfAR input[name="${name}"]`)) { 1952 cfARAppendInput(name, "", { keep: true }); 1953 } 1954 }); 1955 return {}; 1956} 1957function cfARAppendInput(name, value, options = {}) { 1958 const input = document.createElement("INPUT"); 1959 const prefix = options["prefix"] || "cf_"; 1960 const param = options["param"] || name; 1961 const keep = options["keep"] || false; 1962 input.id = prefix + name; 1963 input.name = name; 1964 input.setAttribute("value", value); 1965 if (keep) { 1966 input.classList.add("keep"); 1967 } 1968 input.setAttribute("data-cf-form-field", name); 1969 input.setAttribute("data-param", param); 1970 input.setAttribute("data-storage", "false"); 1971 $3("#cfAR").append(input); 1972} 1973function validateEmail(email) { 1974 email = $3.trim(email); 1975 const 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,}))$/; 1976 return re.test(email); 1977} 1978function updateInputStyle(selectedInput, type) { 1979 if (type === "error") { 1980 selectedInput.css("border-color", "#B91517"); 1981 selectedInput.css("border-width", "3px"); 1982 selectedInput.css("border-style", "solid"); 1983 } else { 1984 selectedInput.css("border-color", "#4a8920"); 1985 selectedInput.css("border-width", "3px"); 1986 selectedInput.css("border-style", "solid"); 1987 } 1988} 1989function checkValidInputs() { 1990 const popupVisibleCheck = $3(".modal-wrapper").is(":visible"); 1991 let fail = false; 1992 let elementPathSelector; 1993 if (popupVisibleCheck == true) { 1994 elementPathSelector = '#modalPopup .elFormItem.required1, #modalPopup .elFormItem[name="phone_number"]'; 1995 } else { 1996 elementPathSelector = '.pageRoot .elFormItem.required1, .pageRoot .elFormItem[name="phone_number"]'; 1997 } 1998 $3(elementPathSelector).each(function() { 1999 const $this = $3(this); 2000 const visible = $this.is(":visible"); 2001 const isRequired = $this.hasClass("required1"); 2002 if (visible) { 2003 let value = $this.val(); 2004 const isSelect = $this.is("select"); 2005 if (isSelect) value = $this.find(":selected").attr("value"); 2006 const parent = $this.parents(".elFormItemWrapper"); 2007 const selector = ".inputHolder, .borderHolder, .elCheckbox"; 2008 const selectedInput = parent.length && parent.find(selector).length ? parent.find(selector) : $this; 2009 if (selectedInput.is(":checkbox") ? !selectedInput.is(":checked") : isRequired && (value === null || typeof value === "undefined" || value === "")) { 2010 fail = true; 2011 updateInputStyle(selectedInput, "error"); 2012 } else { 2013 if (selectedInput.attr("name") == "email") { 2014 if (validateEmail(value)) { 2015 updateInputStyle(selectedInput, "valid"); 2016 } else { 2017 fail = true; 2018 updateInputStyle(selectedInput, "error"); 2019 } 2020 } else if (selectedInput.attr("name") == "phone_number" && selectedInput.get(0).iti) { 2021 if (selectedInput.get(0).iti.isValidNumber() || !isRequired && !value) { 2022 updateInputStyle(selectedInput, "valid"); 2023 } else { 2024 fail = true; 2025 updateInputStyle(selectedInput, "error"); 2026 } 2027 } else { 2028 updateInputStyle(selectedInput, "valid"); 2029 } 2030 } 2031 } 2032 }); 2033 if (popupVisibleCheck == true) { 2034 elementPathSelector = "#modalPopup .elGroupedCheckboxWrapper.required1"; 2035 } else { 2036 elementPathSelector = ".pageRoot .elGroupedCheckboxWrapper.required1"; 2037 } 2038 $3(elementPathSelector).each(function() { 2039 const $this = $3(this); 2040 const $checkboxes = $this.find(".elCheckboxInput"); 2041 const checked = $checkboxes.toArray().some((checkbox) => $3(checkbox).is(":checked")); 2042 fail = !checked; 2043 updateInputStyle($this, fail ? "error" : "valid"); 2044 }); 2045 return fail == false; 2046} 2047function mailCheck() { 2048 const inputsSelector = Array.from(document.getElementsByName("email")); 2049 inputsSelector.forEach((input, index) => { 2050 const mailCheckNode = document.createElement("div"); 2051 mailCheckNode.classList.add("mailcheck"); 2052 mailCheckNode.classList.add(`index${index}`); 2053 input.parentElement.appendChild(mailCheckNode); 2054 input.addEventListener("blur", function() { 2055 Mailcheck.run({ 2056 email: this.value, 2057 domains: defaultDomains, 2058 secondLevelDomains: defaultSecondLevelDomains, 2059 // optional 2060 topLevelDomains: defaultTopLevelDomains, 2061 // optional 2062 suggested: function(suggestion) { 2063 mailCheckNode.innerHTML = `<span>Did you mean <b>${suggestion.full}?</b></span>`;
2064 }, 2065 empty: function() { 2066 mailCheckNode.innerHTML = ""; 2067 } 2068 }); 2069 }); 2070 }); 2071} 2072function handleEnterSubmit() { 2073 const popupVisibleCheck = $3(".modal-wrapper").is(":visible"); 2074 let buttonsPathSelector; 2075 if (popupVisibleCheck == true) { 2076 buttonsPathSelector = '#modalPopup .elBTN a[href="#submit-form"]:visible'; 2077 } else { 2078 buttonsPathSelector = '.pageRoot .elBTN a[href="#submit-form"]:visible'; 2079 } 2080 const submitButton = $3(buttonsPathSelector).first(); 2081 const now = Date.now(); 2082 if (now - lastSubmitTime < SUBMIT_COOLDOWN) { 2083 return; 2084 } 2085 lastSubmitTime = now; 2086 handleFormSubmit(submitButton); 2087} 2088function setupEnterKeySubmit() { 2089 const inputsPathSelector = ".elFormItem"; 2090 $3(inputsPathSelector).each(function() { 2091 const thisInput = $3(this); 2092 if (thisInput.closest('[data-page-element="Checkout/V1"]').length > 0) { 2093 return true; 2094 } 2095 if (thisInput.closest('[data-page-element="Checkout/V2"]').length > 0) { 2096 return true; 2097 } 2098 thisInput.on("keypress", function(evt) { 2099 if (evt.originalEvent?.isComposing || evt.keyCode === 229) return; 2100 if (evt.key === "Enter") { 2101 handleEnterSubmit(); 2102 } 2103 }); 2104 }); 2105} 2106function setRedirectOverride($button) { 2107 let redirectOverride; 2108 if ($button.parents(".elBTN").length) { 2109 redirectOverride = $button.attr("data-on-submit-go-to"); 2110 } 2111 if (redirectOverride && redirectOverride !== "null" && redirectOverride !== "undefined") { 2112 $3("#cfAR").append(`<input type="text" class="redirectParams" name="redirect_to" value="${redirectOverride}" />`); 2113 } else { 2114 $3("#cfAR .redirectParams").remove(); 2115 } 2116} 2117function handleFormSubmit($button) { 2118 setRedirectOverride($button); 2119 setButtonSubmitText(); 2120 if ($3(".pai-payment-methods-inner:visible").length > 0) { 2121 const $rebillySubmit = $3(".pai-submit"); 2122 const $rebillyForm = $3(".elPAI"); 2123 if ($rebillySubmit.length) { 2124 $rebillySubmit.trigger("click"); 2125 return; 2126 } else if ($rebillyForm.length) { 2127 rebillyProcessOrder(); 2128 return; 2129 } else if (!checkValidInputs()) { 2130 restoreButtonState(); 2131 return; 2132 } 2133 } 2134 if (checkValidInputs()) { 2135 submitPage(); 2136 } else { 2137 restoreButtonState(); 2138 } 2139 return true; 2140} 2141var $3, lastSubmitTime, SUBMIT_COOLDOWN; 2142var init_submit = __esm({ 2143 "projects/user_pages/app/javascript/lander/submit.ts"() { 2144 init_define_process(); 2145 init_rebilly_element(); 2146 init_nonce(); 2147 init_cf_utils(); 2148 init_domains(); 2149 init_main(); 2150 $3 = window.$; 2151 globalThis.processForm = function() { 2152 return { 2153 ...getPurchaseForm(), 2154 ...getContactForm(), 2155 ...handleMultiCheckboxForm(), 2156 ...getAppointmentScheduleRequestForm() 2157 }; 2158 }; 2159 globalThis.submitPage = submitPage; 2160 lastSubmitTime = 0; 2161 SUBMIT_COOLDOWN = 1e3; 2162 globalThis.handleFormSubmit = handleFormSubmit; 2163 globalThis.setButtonSubmitText = setButtonSubmitText; 2164 globalThis.restoreButtonState = restoreButtonState; 2165 globalThis.setRedirectOverride = setRedirectOverride; 2166 globalThis.clearBlankInputFields = clearBlankInputFields; 2167 window.addEventListener("DOMContentLoaded", function() { 2168 mailCheck(); 2169 setupEnterKeySubmit(); 2170 $3(document).on("click", '[href="#submit-form"],[data-element-link="#submit-form"]', function() { 2171 const $button = $3(this); 2172 if ($button.closest('[data-page-element="Checkout/V1"]').length == 0) { 2173 handleFormSubmit($button); 2174 } 2175 }); 2176 }); 2177 } 2178}); 2179
2180// projects/user_pages/app/javascript/lander/rebilly_element.ts 2181var rebilly_element_exports = {}; 2182__export(rebilly_element_exports, { 2183 rebillyProcessOrder: () => rebillyProcessOrder 2184}); 2185function leadSourceGenerator() { 2186 const DEFAULT_MAX_CHARS_LENGTH = 512; 2187 const leadQueryParamMapping = { 2188 utm_source: { 2189 name: "source" 2190 }, 2191 utm_medium: { 2192 name: "medium" 2193 }, 2194 utm_campaign: { 2195 name: "campaign" 2196 }, 2197 utm_term: { 2198 name: "term" 2199 }, 2200 utm_content: { 2201 name: "content" 2202 }, 2203 affiliate: {}, 2204 subAffiliate: {}, 2205 clickId: {}, 2206 salesAgent: {} 2207 }; 2208 const params = new URLSearchParams(window.location.search); 2209 return Array.from(params.keys()).reduce((acc, key) => { 2210 const mappedValue = leadQueryParamMapping[key]; 2211 if (mappedValue) { 2212 const paramValue = params.get(key); 2213 const leadSourceName = mappedValue.name ?? key; 2214 acc[leadSourceName] = paramValue.substring(0, DEFAULT_MAX_CHARS_LENGTH); 2215 } 2216 return acc; 2217 }, {}); 2218} 2219var scrollToForm, rebillyProcessOrder; 2220var init_rebilly_element = __esm({ 2221 "projects/user_pages/app/javascript/lander/rebilly_element.ts"() { 2222 init_define_process(); 2223 init_submit(); 2224 scrollToForm = () => { 2225 if (!$(".elPAI").length) return; 2226 $([document.documentElement, document.body]).animate({ scrollTop: $(".elPAI").offset().top - 50 }, 200); 2227 }; 2228 globalThis.addEventListener("DOMContentLoad", function() { 2229 $(document).on("change", ".elInput", function() { 2230 globalThis.processForm(); 2231 }); 2232 window.addEventListener("payments:token-ready", () => { 2233 globalThis.processForm(); 2234 if (!checkValidInputs()) { 2235 restoreButtonState(); 2236 scrollToForm(); 2237 this.window.dispatchEvent(new CustomEvent("payments:submit-failed")); 2238 return; 2239 } 2240 submitPage(); 2241 }); 2242 }); 2243 rebillyProcessOrder = () => { 2244 const Rebilly = globalThis.Rebilly; 2245 let extraData = { 2246 method: globalThis.paymentsSelectedPaymentMethod 2247 }; 2248 const leadSource = leadSourceGenerator(); 2249 if (Object.keys(leadSource).length) { 2250 extraData = { ...extraData, leadSource }; 2251 } 2252 const form = document.querySelector("#cfAR"); 2253 window.dispatchEvent(new CustomEvent("payments:clear-errors")); 2254 globalThis.processForm(); 2255 if (!checkValidInputs()) { 2256 restoreButtonState(); 2257 scrollToForm(); 2258 window.dispatchEvent(new CustomEvent("payments:submit-failed")); 2259 return; 2260 } 2261 Rebilly.createToken(form, extraData).then(function(result) { 2262 console.log("Framepay success", result); 2263 globalThis.parent.postMessage("success", "*"); 2264 submitPage(); 2265 }).catch(function(error) { 2266 console.log("Framepay error", error); 2267 globalThis.parent.postMessage("error", "*"); 2268 form.querySelector('input[data-rebilly="token"]').value = ""; 2269 window.dispatchEvent( 2270 new CustomEvent("payments:set-token-error", { 2271 detail: { 2272 error 2273 } 2274 }) 2275 ); 2276 restoreButtonState(); 2277 scrollToForm(); 2278 window.dispatchEvent(new CustomEvent("payments:submit-failed")); 2279 }); 2280 }; 2281 globalThis.rebillyProcessOrder = rebillyProcessOrder; 2282 globalThis.scrollToForm = scrollToForm; 2283 } 2284}); 2285
2286// projects/user_pages/app/javascript/lander/upsell_element.js 2287var upsell_element_exports = {}; 2288__export(upsell_element_exports, { 2289 submitUpsellOrder: () => submitUpsellOrder 2290}); 2291var submitUpsellOrder; 2292var init_upsell_element = __esm({ 2293 "projects/user_pages/app/javascript/lander/upsell_element.js"() { 2294 init_define_process(); 2295 init_submit(); 2296 (function() { 2297 window.addEventListener("load", function() { 2298 $(document).on("click", "#upsell-submit-button", function(event) { 2299 event.preventDefault(); 2300 submitUpsellOrder(); 2301 }); 2302 }); 2303 })(); 2304 submitUpsellOrder = () => { 2305 $("#cfAR input[data-order-form]").val(true); 2306 submitPage(); 2307 }; 2308 } 2309}); 2310
2311// projects/user_pages/app/javascript/lander/order/main.ts 2312var main_exports = {}; 2313var init_main2 = __esm({ 2314 "projects/user_pages/app/javascript/lander/order/main.ts"() { 2315 init_define_process(); 2316 (function() { 2317 window.addEventListener("load", function() { 2318 const orderCart = window["OrderCart/V1"]?.default; 2319 let previousRadioProductVariant; 2320 document.querySelectorAll(".elOrderSelect").forEach(function(orderSelect) { 2321 const type = orderSelect.getAttribute("data-order-select-type"); 2322 if (type == "single") { 2323 const firstInput = orderSelect.querySelector('input[type="radio"]'); 2324 if (firstInput) { 2325 firstInput.checked = true; 2326 } 2327 const newProductVariant = orderCart.getProductVariant(firstInput, "single"); 2328 previousRadioProductVariant = newProductVariant; 2329 orderCart.updateProductVariant(newProductVariant); 2330 } 2331 }); 2332 $(document).on("change", '.elOrderSelect input[type="radio"]', function(event) { 2333 const input = event.target; 2334 $(`.elOrderSelect input[type="radio"][value=${input.value}]`).prop("checked", true); 2335 const newProductVariant = orderCart.getProductVariant(input, "single"); 2336 if (previousRadioProductVariant) { 2337 orderCart.incrementProductVariantQuantity(previousRadioProductVariant, -1); 2338 } 2339 orderCart.updateProductVariant(newProductVariant); 2340 previousRadioProductVariant = newProductVariant; 2341 }); 2342 $(document).on("change", '.elOrderSelect input[type="number"]', function(event) { 2343 const input = event.target; 2344 const productVariantId = input.getAttribute("data-product-variant-id"); 2345 const quantity = input.value; 2346 $(`.elOrderSelect input[type="number"][data-product-variant-id="${productVariantId}"]`).val(quantity); 2347 const productVariant = orderCart.getProductVariant(input, "multiple"); 2348 orderCart.updateProductVariant(productVariant); 2349 }); 2350 $(document).on("change", ".elOrderProductOptionsPrice select", function(event) { 2351 const priceSelect = event.target; 2352 const productVariantId = priceSelect.getAttribute("data-product-variant-id"); 2353 const priceId = priceSelect.value; 2354 const priceCents = priceSelect.querySelector(`option[value="${priceId}"`).getAttribute("data-product-variant-price-cents"); 2355 const orderSelectType = document.querySelector(".elOrderSelect").getAttribute("data-order-select-type"); 2356 const orderSelectInputType = orderSelectType == "single" ? "radio" : "number"; 2357 const productVariantInput = document.querySelector( 2358 `.elOrderSelect input[type="${orderSelectInputType}"][data-product-variant-id="${productVariantId}"]` 2359 ); 2360 productVariantInput.setAttribute("data-product-variant-price-id", priceId); 2361 productVariantInput.setAttribute("data-product-variant-price-cents", priceCents); 2362 if (orderSelectType == "single" && !productVariantInput.checked) return; 2363 const productVariant = orderCart.getProductVariant(productVariantInput, orderSelectType); 2364 orderCart.updateProductVariant(productVariant); 2365 }); 2366 $(document).on("change", ".elOrderBump input", function(event) { 2367 const input = event.target; 2368 const productVariant = orderCart.getProductVariant(input); 2369 orderCart.updateProductVariant(productVariant); 2370 }); 2371 $(document).on("change", ".elOrderBump select", function(event) { 2372 const select = event.target; 2373 const productId = select.getAttribute("data-product-id"); 2374 const selectedOption = select.querySelector(`option[value="${select.value}"]`); 2375 const productInput = document.querySelector( 2376 `.elOrderBump input[data-product-id="${productId}"]` 2377 ); 2378 const variantAttrs = ["id", "name", "price-id", "price-cents", "price-currency"]; 2379 variantAttrs.forEach(function(variantAttr) { 2380 productInput.setAttribute( 2381 `data-product-variant-${variantAttr}`, 2382 selectedOption.getAttribute(`data-product-variant-${variantAttr}`) 2383 ); 2384 }); 2385 if (!productInput.checked) return; 2386 const productVariant = orderCart.getProductVariant(productInput); 2387 orderCart.updateProductVariant(productVariant); 2388 }); 2389 $(document).on("click", ".elOrderCoupon button", function() { 2390 const input = document.querySelector(".elOrderCoupon input"); 2391 orderCart.updateCouponCode(input.value); 2392 }); 2393 document.querySelectorAll(".elOrderCoupon input[readonly]").forEach(function(element) { 2394 element.removeAttribute("readonly"); 2395 }); 2396 }); 2397 })(); 2398 } 2399}); 2400
2401// projects/user_pages/app/javascript/lander/utils/action_matching.ts 2402function matchesAction(element, action) { 2403 const link = element.getAttribute("data-element-link"); 2404 if (link !== null) return link === action; 2405 const { hash, origin, pathname } = element; 2406 return hash === action && origin === window.location.origin && pathname === window.location.pathname; 2407} 2408var init_action_matching = __esm({ 2409 "projects/user_pages/app/javascript/lander/utils/action_matching.ts"() { 2410 init_define_process(); 2411 } 2412}); 2413
2414// projects/user_pages/app/javascript/lander/action_link.ts 2415var action_link_exports = {}; 2416function setupActionLinkListeners() { 2417 $(document).on("click", "[data-element-link='#print'], a[href$='#print']", function(evt) { 2418 if (!matchesAction(evt.currentTarget, "#print")) return; 2419 window.print(); 2420 return false; 2421 }); 2422 $(document).on("click", "[data-element-link='#open-popup'], a[href$='#open-popup']", function(evt) { 2423 if (!matchesAction(evt.currentTarget, "#open-popup")) return; 2424 evt.preventDefault(); 2425 const checkIfShowHide = evt.target.parentElement?.getAttribute("data-elbuttontype"); 2426 if (typeof checkIfShowHide == "undefined" || !["2", "showHide"].includes(checkIfShowHide)) { 2427 globalThis.CFOpenPopup(); 2428 } 2429 }); 2430 $(document).on("click", "[data-element-link='#close-popup'], a[href$='#close-popup']", function(evt) { 2431 if (!matchesAction(evt.currentTarget, "#close-popup")) return; 2432 evt.preventDefault(); 2433 globalThis.CFClosePopup(); 2434 }); 2435 $(document).on("click", "a[href*='#scroll-'], [data-element-link*='#scroll-']", function(evt) { 2436 const href = evt.currentTarget.getAttribute("href") ?? ""; 2437 const [, id] = href.split("#scroll-"); 2438 if (id) { 2439 if (isWithinCustomerCenterView()) { 2440 const el = document.querySelector(`.${id}`); 2441 const mainElement = window.parent.document.body.querySelector("main"); 2442 if (el && mainElement) { 2443 mainElement.scrollTo({ top: $(el).offset().top, behavior: "smooth" }); 2444 } 2445 } else { 2446 const el = document.querySelector(`.${id}`); 2447 const popupParent = el?.closest(".modal-wrapper"); 2448 const scrollContainer = popupParent || document.documentElement; 2449 if (el && scrollContainer) { 2450 scrollContainer.scrollTo({ top: $(el).offset().top, behavior: "smooth" }); 2451 } 2452 } 2453 } 2454 return false; 2455 }); 2456 const getElementsIds = (evt, type) => (evt.currentTarget.getAttribute(`data-${type}-button-ids`) || "").split(",").filter((s) => s); 2457 const performActionOnId = (id, action) => { 2458 const $el = $(`.${id}`); 2459 if ($el.attr("data-show-only") && action === "fadeIn") { 2460 $el.removeAttr("data-show-only"); 2461 $el.css("display", "none"); 2462 } 2463 $el[action]({ duration: 500 }); 2464 }; 2465 $(document).on("click", "a[href*='#show-hide'], [data-element-link*='#show-hide']", function(evt) { 2466 evt.preventDefault(); 2467 const hideIds = getElementsIds(evt, "hide"); 2468 const showIds = getElementsIds(evt, "show"); 2469 hideIds.forEach((id) => performActionOnId(id, "fadeOut")); 2470 showIds.forEach((id) => performActionOnId(id, "fadeIn")); 2471 return false; 2472 }); 2473 $(document).on("click", "a[href=''], [data-element-link='']", function(evt) { 2474 evt.preventDefault(); 2475 return false; 2476 }); 2477 $(document).on("click", "[data-element-link]", function(evt) { 2478 evt.preventDefault(); 2479 const linkableElement = evt.currentTarget; 2480 const link = linkableElement.getAttribute("data-element-link"); 2481 if (link && !internalLinks.includes(link)) { 2482 const target = linkableElement.getAttribute("target") ?? "_self"; 2483 if (target === "_self") { 2484 window.location.href = link; 2485 } else { 2486 window.open(link, "_blank"); 2487 } 2488 } 2489 }); 2490 $(document).on("click", "a[href^='#download-asset:']", function(evt) { 2491 evt.preventDefault(); 2492 const id = evt.currentTarget.getAttribute("href").replace("#download-asset:", ""); 2493 window.location.href = `/account/downloads/${id}/file`; 2494 return false; 2495 }); 2496 $(document).on("click", "a[href^='#download-inline:']", function(evt) { 2497 evt.preventDefault(); 2498 const id = evt.currentTarget.getAttribute("href").replace("#download-inline:", ""); 2499 window.open(`/account/downloads/${id}/preview`, "_blank"); 2500 return false; 2501 }); 2502 $(document).on("click", "a[href*='#no-link'], [data-element-link*='#no-link']", function(evt) { 2503 evt.preventDefault(); 2504 const urlParams = new URLSearchParams(window.location.search); 2505 urlParams.set("next_funnel_step", "true"); 2506 window.location.href = `${window.location.pathname}?${urlParams}`; 2507 }); 2508 document.querySelectorAll("[data-element-link]").forEach((linkableElement) => { 2509 if (linkableElement.getAttribute("data-element-link")) linkableElement.setAttribute("tabindex", "0"); 2510 }); 2511} 2512var internalLinks; 2513var init_action_link = __esm({ 2514 "projects/user_pages/app/javascript/lander/action_link.ts"() { 2515 init_define_process(); 2516 init_cf_utils(); 2517 init_action_matching(); 2518 internalLinks = [ 2519 "#open-popup", 2520 "#close-popup", 2521 "#submit-form", 2522 "#scroll", 2523 "#print", 2524 "#show-hide", 2525 "#download-asset", 2526 "#download-inline" 2527 ]; 2528 window.addEventListener("DOMContentLoaded", setupActionLinkListeners); 2529 } 2530}); 2531
2532// projects/user_pages/app/javascript/lander/animation.ts 2533var require_animation = __commonJS({ 2534 "projects/user_pages/app/javascript/lander/animation.ts"() { 2535 init_define_process(); 2536 var unobserve = (element, observer) => { 2537 observer.unobserve(element); 2538 if (element.getAttribute("data-animation-once") !== "true") { 2539 const time = element.getAttribute("data-animation-time"); 2540 const delay = element.getAttribute("data-animation-delay"); 2541 const timeout = Number(time) + Number(delay); 2542 setTimeout(() => { 2543 observer.observe(element); 2544 }, timeout); 2545 } 2546 }; 2547 var startAnimation = (element) => { 2548 element.setAttribute("data-animation-state", "running"); 2549 }; 2550 var params = new URLSearchParams(window.location.search); 2551 var disabledAnimations = params.get("animations") == "skip"; 2552 window.addEventListener("DOMContentLoaded", function() { 2553 if (disabledAnimations) { 2554 const allAnimatedElements = document.querySelectorAll("[data-animation-type]"); 2555 allAnimatedElements.forEach((el) => { 2556 el.setAttribute("data-animation-type", "none"); 2557 }); 2558 } 2559 }); 2560 var setupStyleGuideAnimatedNodes = () => { 2561 if (disabledAnimations) return; 2562 const styleGuideAnimationNode = JSON.parse( 2563 document.getElementById("cf-lander-serialized-style-guide-animation-node")?.textContent ?? "{}" 2564 ); 2565 document.querySelectorAll("[data-style-guide-animation]").forEach((element) => { 2566 const style = element.getAttribute("data-style-guide-animation"); 2567 const selectedAnimation = styleGuideAnimationNode.selectors[`.elPageContent [data-style-guide-animation="${style}"]`]; 2568 element.setAttribute("data-animation-type", selectedAnimation.attrs["data-animation-type"]); 2569 element.setAttribute("data-animation-trigger", selectedAnimation.attrs["data-animation-trigger"]); 2570 }); 2571 }; 2572 $(document).ready(function() { 2573 const runAllAnimations = function() { 2574 setupStyleGuideAnimatedNodes(); 2575 const scrollElements = document.querySelectorAll('[data-animation-trigger="scroll"]'); 2576 const loadElements = document.querySelectorAll('[data-animation-trigger="load"]'); 2577 const config2 = { 2578 rootMargin: "50px 20px 75px 30px", 2579 threshold: [0, 0.25, 0.75, 1] 2580 }; 2581 const observer = new IntersectionObserver((entries) => { 2582 entries.forEach((entry) => { 2583 if (entry.isIntersecting) { 2584 if (entry.target.getAttribute("data-animation-state") !== "running") { 2585 unobserve(entry.target, observer); 2586 startAnimation(entry.target); 2587 } 2588 } else { 2589 entry.target.setAttribute("data-animation-state", "off"); 2590 } 2591 }); 2592 }, config2); 2593 scrollElements.forEach((element) => { 2594 observer.observe(element); 2595 }); 2596 loadElements.forEach((element) => { 2597 startAnimation(element); 2598 }); 2599 }; 2600 if (!disabledAnimations) runAllAnimations(); 2601 }); 2602 } 2603}); 2604
2605// projects/user_pages/app/javascript/lander/sticky.ts 2606var require_sticky = __commonJS({ 2607 "projects/user_pages/app/javascript/lander/sticky.ts"() { 2608 init_define_process(); 2609 function cloneSticky(sticky) { 2610 const stickyClone = sticky.clone(true, true).addClass("stickyClone"); 2611 sticky.parent().append(stickyClone); 2612 globalThis.CF2Component.hydrateTree(stickyClone.get(0)); 2613 } 2614 $(document).ready(function() { 2615 const $stickyElements = $(".stickyTop"); 2616 $stickyElements.each((_index, element) => { 2617 const sticky = $(element); 2618 let cloned = false; 2619 let scrollTop = $(window).scrollTop(); 2620 let stickyTop = sticky.offset().top; 2621 if (scrollTop > stickyTop) { 2622 cloneSticky(sticky); 2623 cloned = true; 2624 } 2625 document.addEventListener("scroll", () => { 2626 scrollTop = $(window).scrollTop(); 2627 stickyTop = sticky.offset().top; 2628 if (scrollTop >= stickyTop && !cloned) { 2629 cloneSticky(sticky); 2630 cloned = true; 2631 } 2632 if (scrollTop < stickyTop && cloned) { 2633 sticky.parent().find("> .stickyClone").remove(); 2634 cloned = false; 2635 } 2636 }); 2637 }); 2638 }); 2639 } 2640}); 2641
2642// projects/user_pages/app/javascript/lander.js 2643var require_lander = __commonJS({ 2644 "projects/user_pages/app/javascript/lander.js"() { 2645 init_define_process(); 2646 require_replace_tag(); 2647 init_fetcher(); 2648 require_parseurl(); 2649 require_audio_player(); 2650 require_garlic_cf(); 2651 init_populate_select(); 2652 require_runtime_events(); 2653 init_fhl_handle_select_transformation(); 2654 init_track_events(); 2655 init_resource_sharing_concern(); 2656 init_rebilly_element(); 2657 init_upsell_element(); 2658 init_main2(); 2659 init_runtime(); 2660 init_action_link(); 2661 require_animation(); 2662 init_submit(); 2663 require_sticky(); 2664 window.nanostores = (init_nanostores(), __toCommonJS(nanostores_exports)); 2665 var originalFetch = window.fetch; 2666 window.inflightRequests = 0; 2667 window.fetch = async (request, init) => { 2668 window.inflightRequests++; 2669 try { 2670 const rendered_page_url = document.querySelector('meta[name="rendered-page-url"]')?.getAttribute("content"); 2671 if (rendered_page_url) { 2672 const url = new URL(new Request(request).url); 2673 if (url.hostname == window.location.hostname) { 2674 init = init || {}; 2675 if (!init.headers) init.headers = {}; 2676 init.headers["X-Rendered-Page-Url"] = rendered_page_url; 2677 } 2678 } 2679 } catch (e) { 2680 console.error("Failed to set X-Rendered-Page-Url header", e); 2681 } 2682 return originalFetch(request, init).finally(() => { 2683 window.inflightRequests--; 2684 }); 2685 }; 2686 $(window).on("DOMContentLoaded", function() { 2687 $('.elFormItem:not([data-prevent-garlic="true"])').each(function() { 2688 let onPersist = () => { 2689 }; 2690 if (this.getAttribute("name") == "name") { 2691 onPersist = () => { 2692 const value = this.value.trim(); 2693 const firstName = value.split(" ")[0]; 2694 const lastName = value.split(" ").slice(1).join(" "); 2695 window.cfGarlicUtils.store("first_name", firstName); 2696 window.cfGarlicUtils.store("last_name", lastName); 2697 }; 2698 } else if (this.getAttribute("name") == "phone_number") { 2699 onPersist = () => { 2700 if (!this.iti?.isValidNumber()) return; 2701 const value = this.iti?.getNumber() ?? this.value.trim(); 2702 window.cfGarlicUtils.store("phone_number", value); 2703 }; 2704 } 2705 $(this).garlic({ 2706 onPersist, 2707 onRetrieve: function($el, retrievedValue) { 2708 const elemName = $el.attr("name"); 2709 globalThis.CFGarlicValues[elemName] = retrievedValue; 2710 $el.each((_, element) => { 2711 const closestBlueprintInstance = element.closest("[data-page-element]")?.cf2_instance; 2712 if (closestBlueprintInstance && closestBlueprintInstance.update) { 2713 closestBlueprintInstance.update(retrievedValue); 2714 } 2715 }); 2716 } 2717 }); 2718 }); 2719 }); 2720 } 2721}); 2722
2723// projects/shared/stylesheets/page-content/main.scss 2724var init_main3 = __esm({ 2725 "projects/shared/stylesheets/page-content/main.scss"() { 2726 } 2727}); 2728
2729// projects/shared/stylesheets/bootstrap-modal.min.css 2730var init_bootstrap_modal_min = __esm({ 2731 "projects/shared/stylesheets/bootstrap-modal.min.css"() { 2732 } 2733}); 2734
2735// projects/user_pages/app/stylesheets/core.css 2736var init_core = __esm({ 2737 "projects/user_pages/app/stylesheets/core.css"() { 2738 } 2739}); 2740
2741// projects/user_pages/app/stylesheets/mediaelementplayer-custom.css 2742var init_mediaelementplayer_custom = __esm({ 2743 "projects/user_pages/app/stylesheets/mediaelementplayer-custom.css"() { 2744 } 2745}); 2746
2747// projects/user_pages/app/stylesheets/alert_messages.scss 2748var init_alert_messages = __esm({ 2749 "projects/user_pages/app/stylesheets/alert_messages.scss"() { 2750 } 2751}); 2752
2753// projects/lib/packages/yggdrasil-blueprints/__generated__/dist/systemBluprints.min.css 2754var init_systemBluprints_min = __esm({ 2755 "projects/lib/packages/yggdrasil-blueprints/__generated__/dist/systemBluprints.min.css"() { 2756 } 2757}); 2758
2759// projects/user_pages/app/javascript/lander_styles.js 2760var lander_styles_exports = {}; 2761var init_lander_styles = __esm({ 2762 "projects/user_pages/app/javascript/lander_styles.js"() { 2763 init_define_process(); 2764 init_main3(); 2765 init_bootstrap_modal_min(); 2766 init_core(); 2767 init_mediaelementplayer_custom(); 2768 init_alert_messages(); 2769 init_systemBluprints_min(); 2770 } 2771}); 2772
2773// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/content-node.ts 2774var ContentNode; 2775var init_content_node = __esm({ 2776 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/content-node.ts"() { 2777 init_define_process(); 2778 init_runtime(); 2779 ContentNode = class extends CF2Component { 2780 constructor(el, runtimeSel) { 2781 super(el, runtimeSel); 2782 } 2783 mount(el) { 2784 this.syncSameNameInputs(); 2785 } 2786 syncSameNameInputs() { 2787 const formInputs = document.querySelectorAll(".elFormItem[name]"); 2788 formInputs.forEach((input) => { 2789 const inputName = input.name; 2790 input.addEventListener("change", () => { 2791 if (input.type === "checkbox" || input.type === "radio") { 2792 const inputValue = input.value; 2793 const otherInputs = document.querySelectorAll( 2794 `.elFormItem.elInput[name="${inputName}"][value="${inputValue}"]` 2795 ); 2796 otherInputs.forEach((otherInput) => { 2797 otherInput.checked = input.checked; 2798 }); 2799 } else { 2800 const otherInputs = document.querySelectorAll( 2801 `.elFormItem.elInput[name="${inputName}"]` 2802 ); 2803 otherInputs.forEach((otherInput) => { 2804 otherInput.value = input.value; 2805 }); 2806 } 2807 }); 2808 }); 2809 } 2810 }; 2811 registerComponent("ContentNode", ContentNode); 2812 window["ContentNode"] = ContentNode; 2813 } 2814}); 2815
2816// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/modal-container-v1.ts 2817var ModalContainerV1; 2818var init_modal_container_v1 = __esm({ 2819 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/modal-container-v1.ts"() { 2820 init_define_process(); 2821 init_modal_v1(); 2822 init_runtime(); 2823 ModalContainerV1 = class extends CF2Component { 2824 constructor(el, runtimeSel) { 2825 super(el, runtimeSel); 2826 } 2827 mount() { 2828 this.isAudioInitialized = false; 2829 this.modal = this.getComponent("Modal/V1"); 2830 this.videoElements = this.getComponents("Video/V1"); 2831 this.modalElement = this.modal.element; 2832 this.containerModal = document.getElementById("modalPopup"); 2833 this.showOnExit = this.containerModal.getAttribute("data-show-popup-on-exit") === "true"; 2834 this.showOnLoad = this.containerModal.getAttribute("data-show-popup-on-page-load") === "true"; 2835 this.showWhenElementIsVisible = this.element.getAttribute("data-selected-element"); 2836 this.closeButton = this.element.querySelector(".closeLPModal"); 2837 if (this.showWhenElementIsVisible) { 2838 const visibleElementSelector = this.showWhenElementIsVisible.startsWith("id-") ? `.${this.showWhenElementIsVisible}` : `.id-${this.showWhenElementIsVisible}`; 2839 this.visibleElement = document.querySelector(visibleElementSelector); 2840 } 2841 const self = this; 2842 this.modal.close = function() { 2843 handleModalClose(); 2844 }; 2845 if (this.visibleElement) { 2846 handleShowWhenElementIsVisible(this.visibleElement); 2847 } 2848 if (this.showOnExit) { 2849 handleShowOnExit(); 2850 } 2851 if (this.showOnLoad) { 2852 if (this.showOnLoadDelay) { 2853 setTimeout(() => { 2854 handleModalOpen(); 2855 }, this.showOnLoadDelay); 2856 } else { 2857 handleModalOpen(); 2858 } 2859 } 2860 function handleModalOpen() { 2861 const containerModal = self.containerModal; 2862 const modalElement = self.modalElement; 2863 const closeButton = self.closeButton; 2864 const scrollY = window.scrollY; 2865 $(containerModal).show(); 2866 $(containerModal).css("top", -800); 2867 $(closeButton).css("top", -800); 2868 $(containerModal).addClass("popup-relative-position"); 2869 $("html").addClass("hide-page-scroll"); 2870 $("body").css("position", "fixed"); 2871 $("body").css("top", `-${scrollY}px`); 2872 $("body").css("width", "100%"); 2873 $(modalElement).show(); 2874 if (!self.isAudioInitialized) { 2875 self.isAudioInitialized = true; 2876 setupAudioElements(); 2877 } 2878 $(modalElement).css({ 2879 opacity: 1, 2880 top: 0 2881 }); 2882 $(containerModal).animate( 2883 { 2884 opacity: 1, 2885 top: 0 2886 }, 2887 { 2888 duration: 200 2889 } 2890 ); 2891 $(closeButton).animate({ top: -20 }, { duration: 200 }); 2892 } 2893 function handleModalClose() { 2894 const containerModal = self.containerModal; 2895 const modalElement = self.modalElement; 2896 const closeButton = self.closeButton; 2897 const scrollY = $("body").css("top"); 2898 $(closeButton).animate({ top: -800 }, { duration: 200 }); 2899 $(containerModal).animate( 2900 { 2901 opacity: 0, 2902 top: -800 2903 }, 2904 { 2905 duration: 200, 2906 complete: function() { 2907 $(modalElement).css({ 2908 opacity: 0, 2909 top: -800 2910 }); 2911 $(modalElement).hide(); 2912 $(containerModal).hide(); 2913 $(containerModal).removeClass("popup-relative-position"); 2914 } 2915 } 2916 ); 2917 $("html").removeClass("hide-page-scroll"); 2918 $("body").css("position", ""); 2919 $("body").css("top", ""); 2920 $("body").css("width", ""); 2921 if (scrollY) { 2922 window.scrollTo(0, parseInt(scrollY || "0", 10) * -1); 2923 } 2924 } 2925 function handleShowWhenElementIsVisible() { 2926 const config2 = { 2927 rootMargin: "50px 20px 75px 30px", 2928 threshold: [0, 0.25, 0.75, 1] 2929 }; 2930 const observer = new IntersectionObserver((entries) => {
2931 entries.forEach((entry) => { 2932 if (entry.isIntersecting) { 2933 observer.unobserve(entry.target, observer); 2934 handleModalOpen(); 2935 } 2936 }); 2937 }, config2); 2938 observer.observe(self.visibleElement); 2939 } 2940 function handleShowOnExit() { 2941 let cfMouseP = 0; 2942 const modalElement = self.modalElement; 2943 const handleMouseMove = (evt) => { 2944 cfMouseP = evt.clientY; 2945 }; 2946 const handleMouseLeave = () => { 2947 if (cfMouseP <= 40) { 2948 if (!$(modalElement).is(":visible")) { 2949 handleModalOpen(); 2950 document.querySelector("body").removeEventListener("mouseleave", handleMouseLeave); 2951 document.querySelector("body").removeEventListener("mousemove", handleMouseMove); 2952 } 2953 } 2954 }; 2955 document.querySelector("body").addEventListener("mousemove", handleMouseMove); 2956 document.querySelector("body").addEventListener("mouseleave", handleMouseLeave); 2957 } 2958 function setupAudioElements() { 2959 const audioElements = $(".containerModal .elAudioWrapper"); 2960 try { 2961 audioElements.each(function() { 2962 const $this = $(this); 2963 const audioURL = $this.attr("data-audio-url") || "https://images.clickfunnels.com/images/SevenNationArmy.mp3"; 2964 const loop = $this.attr("data-audio-loop") || "no"; 2965 const playerOptions = { 2966 class: "elAudioElement", 2967 audioWidth: "100%", 2968 audioHeight: "100%", 2969 enableAutosize: true, 2970 enableProgressTooltip: false, 2971 loop: loop === "yes", 2972 features: [ 2973 "playpause", 2974 "current", 2975 "progress", 2976 "duration", 2977 "volume" 2978 ] 2979 }; 2980 const audio = $(this).find("audio"); 2981 audio.attr("src", audioURL); 2982 audio.mediaelementplayer(playerOptions); 2983 }); 2984 } catch (err) { 2985 console.log(err); 2986 } 2987 } 2988 globalThis.CFOpenPopup = handleModalOpen; 2989 globalThis.CFClosePopup = handleModalClose; 2990 } 2991 }; 2992 registerComponent("ModalContainer/V1", ModalContainerV1); 2993 window["ModalContainerV1"] = ModalContainerV1; 2994 } 2995}); 2996
2997// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/add-to-cart.ts 2998var AddToCart; 2999var init_add_to_cart = __esm({ 3000 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/add-to-cart.ts"() { 3001 init_define_process(); 3002 init_addToCart(); 3003 init_runtime(); 3004 AddToCart = class extends CF2Component { 3005 constructor(el, runtimeSel) { 3006 super(el, runtimeSel); 3007 } 3008 mount() { 3009 mountComponent(this); 3010 } 3011 remove() { 3012 this.element.innerHTML = ""; 3013 } 3014 render(initializeChildrenInstances = false) { 3015 const is_server = true; 3016 const product = this.product ?? null; 3017 const currentVariant = this.currentVariant ?? null; 3018 const selected_price = this.selected_price ?? null; 3019 const button_layout_size = this.button_layout_size ?? null; 3020 const input_layout_size = this.input_layout_size ?? null; 3021 const show_name = this.show_name ?? null; 3022 const show_description = this.show_description ?? null; 3023 const show_compare_at = this.show_compare_at ?? null; 3024 const editor_product = this.element.getAttribute("data-param-editor_product"); 3025 const primary_text = this.element.getAttribute("data-param-primary_text"); 3026 const secondary_text = this.element.getAttribute("data-param-secondary_text"); 3027 let html = ""; 3028 { 3029 const is_editor = false; 3030 const customVariants = product?.variants.filter((value) => value["default_variant"] == false); 3031 const variant = currentVariant ?? product; 3032 const selected_price2 = variant?.prices?.[0]; 3033 const desc = (product?.description_override ?? variant.description ?? product.description ?? product.default_variant.description ?? "").replaceAll(` 3034`, "<br>"); 3035 html += `<div class="elAddToCartWrapper">`; 3036 if (show_name) { 3037 html += `<a class="elAddToCartNameLink" href="${product?.url}"><span class="elAddToCartName">${variant?.name ?? product.default_variant.name}</span></a>`; 3038 } 3039 if (variant?.prices?.length == 1) { 3040 html += `<div class="elAddToCartSinglePriceWrapper"><span class="elAddToCartPrice">${selected_price2?.name}</span>`; 3041 const compare_at_amount = selected_price2?.compare_at_amount; 3042 if (compare_at_amount && show_compare_at) { 3043 html += `<span class="elAddToCartCompareAt">${compare_at_amount}</span>`; 3044 } 3045 html += `</div>`; 3046 } else { 3047 html += `<div class="elSelectWrapper`; 3048 if (input_layout_size == "xs") { 3049 html += ` elAddToCartInputExtraSmall`; 3050 } 3051 if (input_layout_size == "s") { 3052 html += ` elAddToCartInputSmall`; 3053 } 3054 if (input_layout_size == "m") { 3055 html += ` elAddToCartInputMedium`; 3056 } 3057 if (input_layout_size == "l") { 3058 html += ` elAddToCartInputLarge`; 3059 } 3060 if (input_layout_size == "xl") { 3061 html += ` elAddToCartInputExtraLarge`; 3062 } 3063 html += `"><select name="variant_price">`; 3064 const c0 = variant.prices; 3065 const fl1 = new CF2ForloopDrop(c0.length); 3066 for (const price of c0) { 3067 const forloop = fl1; 3068 html += `<option `; 3069 if (selected_price2?.id == price?.id) { 3070 html += `selected`; 3071 } 3072 html += ` value="${price?.id}">${price?.name}</option>`; 3073 forloop.next(); 3074 } 3075 html += `</select><div class="elSelectArrow"><i class="fas fa-chevron-down"></i></div></div>`; 3076 } 3077 if (desc != "" && show_description) { 3078 html += `<span class="elAddToCartDescription">${desc}</span>`; 3079 } 3080 if (customVariants?.length > 1) { 3081 html += `<div class="elAddToCartVariantSelectorWrapper">`; 3082 const c2 = product.sorted_property_values; 3083 const fl3 = new CF2ForloopDrop(c2.length); 3084 for (const property_values of c2) { 3085 const forloop = fl3; 3086 const property_id = property_values?.property_id; 3087 const select_index = forloop?.index0; 3088 html += `<div class="elSelectWrapper`; 3089 if (input_layout_size == "xs") { 3090 html += ` elAddToCartInputExtraSmall`; 3091 } 3092 if (input_layout_size == "s") { 3093 html += ` elAddToCartInputSmall`; 3094 } 3095 if (input_layout_size == "m") { 3096 html += ` elAddToCartInputMedium`; 3097 } 3098 if (input_layout_size == "l") { 3099 html += ` elAddToCartInputLarge`; 3100 } 3101 if (input_layout_size == "xl") { 3102 html += ` elAddToCartInputExtraLarge`; 3103 } 3104 html += `"><span class="elAddToCartVariantSelectorTitle">${product?.all_properties?.[property_id]}</span><div style="position:relative;"><select class="elVariantSelector" name="property_${property_id}">`; 3105 const c4 = property_values.value_ids; 3106 const fl5 = new CF2ForloopDrop(c4.length); 3107 for (const value_id of c4) { 3108 const forloop2 = fl5; 3109 html += `<option `; 3110 if (variant?.property_value_ids?.[select_index] == value_id) { 3111 html += `selected`; 3112 } 3113 html += ` value="${value_id}">${product?.all_properties_values?.[value_id]}</option>`; 3114 forloop2.next(); 3115 } 3116 html += `</select><div class="elSelectArrow"><i class="fas fa-chevron-down"></i></div></div></div>`; 3117 forloop.next(); 3118 } 3119 html += `</div>`; 3120 } 3121 html += `<div class="elAddToCartButtonsWrapper"><div data-page-element="Button/V1" class="elBTN elAddToCartAddToCartButton i
3121d-Button/V1`; 3122 if (button_layout_size == "xs") { 3123 html += ` elAddToCartButtonExtraSmall`; 3124 } 3125 if (button_layout_size == "s") { 3126 html += ` elAddToCartButtonSmall`; 3127 } 3128 if (button_layout_size == "m") { 3129 html += ` elAddToCartButtonMedium`; 3130 } 3131 if (button_layout_size == "l") { 3132 html += ` elAddToCartButtonLarge`; 3133 } 3134 if (button_layout_size == "xl") { 3135 html += ` elAddToCartButtonExtraLarge`; 3136 } 3137 html += `" data-liquid-replace="item">`; 3138 const label_key = "addtocart"; 3139 const label_key_slice = "addtoc"; 3140 let data_content_key = ""; 3141 data_content_key = "addtocart"; 3142 html += `<a target="_self" href="#add-to-cart" class="elButton" aria-label="" data-disabled="false" data-show-button-ids="" data-hide-button-ids="" data-on-submit-go-to="" data-param-submittingText="Submitting..." data-content="" data-style-guide-button="" rel="noopener"><span class="elButtonMain"><i class="fas fa-spinner fa-spin elButtonSpinner elButtonText"></i><span class="elButtonMainText elButtonText">${primary_text}</span></span><span class="elButtonSub"></span></a></div></div></div>`; 3143 } 3144 this.replaceContent(html); 3145 if (initializeChildrenInstances) { 3146 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3147 const options = { scopeToYggRender }; 3148 CF2Component.hydrateTree(this.element, options); 3149 } 3150 } 3151 }; 3152 registerComponent("AddToCart", AddToCart); 3153 window["AddToCart"] = AddToCart; 3154 } 3155}); 3156
3157// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search-products.ts 3158var StoreSearchProducts; 3159var init_store_search_products = __esm({ 3160 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search-products.ts"() { 3161 init_define_process(); 3162 init_runtime(); 3163 StoreSearchProducts = class extends CF2Component { 3164 constructor(el, runtimeSel) { 3165 super(el, runtimeSel); 3166 } 3167 mount() { 3168 } 3169 remove() { 3170 this.element.innerHTML = ""; 3171 } 3172 render(initializeChildrenInstances = false) { 3173 const is_server = true; 3174 const selected_products = this.selected_products ?? null; 3175 let html = ""; 3176 { 3177 const c0 = selected_products; 3178 const fl1 = new CF2ForloopDrop(c0.length); 3179 for (const product of c0) { 3180 const forloop = fl1; 3181 const default_variant = product?.default_variant ?? "{}"; 3182 const image = product?.image ?? default_variant.image ?? "/editor/editor-demo-image-placeholder.svg"; 3183 const name = product?.name ?? default_variant.name; 3184 const price = product?.price ?? default_variant.price; 3185 html += `<div class="elStoreSearchProductCard">`; 3186 if (image) { 3187 html += `<a class="elStoreSearchImageWrapper" href="${product?.url}"><div data-page-element="Image/V2" class="elImageWrapper de-image-block id-Image/V2`; 3188 if (CF2Blank(image) && CF2Blank(null) && true) { 3189 html += ` forceHide`; 3190 } 3191 html += `" data-liquid-replace="item">`; 3192 if (image || !CF2Blank(null)) { 3193 html += `<img class="elImage" src="${image ?? null}" data-lazy-loading="true" data-lazy-loading="true"/>`; 3194 } else if (false) { 3195 html += `<div class="image-placeholder" title=""><span class="image-placeholder-header"></span></div>`; 3196 } 3197 html += `</div></a>`; 3198 } 3199 html += `<div class="elStoreSearchProductCardInfo"><a href="${product?.url}" class="elStoreSearchProductCardName">${name}</a><span class="elStoreSearchProductCardPrice">${price}</span></div></div>`; 3200 forloop.next(); 3201 } 3202 } 3203 this.replaceContent(html); 3204 if (initializeChildrenInstances) { 3205 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3206 const options = { scopeToYggRender }; 3207 CF2Component.hydrateTree(this.element, options); 3208 } 3209 } 3210 }; 3211 registerComponent("StoreSearchProducts", StoreSearchProducts); 3212 window["StoreSearchProducts"] = StoreSearchProducts; 3213 } 3214}); 3215
3216// projects/lib/packages/yggdrasil-blueprints/src/Elements/Store/Search/storeSearch.ts 3217var allProductsById, productSearchFetcher, fetchProducts, handleSearchResults, searchProducts, debounceHandler, mountComponent2, getProductsElementComponent, updateProducts, showModal, productsReady, hideModal, showSearchProducts, hideProducts, hideTitle, showTitle, showResultsNotFound, hideResultsNotFound, showLoading, hideLoading; 3218var init_storeSearch = __esm({ 3219 "projects/lib/packages/yggdrasil-blueprints/src/Elements/Store/Search/storeSearch.ts"() { 3220 init_define_process(); 3221 init_general(); 3222 init_fetcher(); 3223 allProductsById = {}; 3224 fetchProducts = (component, searchQuery) => { 3225 if (productSearchFetcher) { 3226 productSearchFetcher.abort(); 3227 } 3228 const url = new URL("/products/search", window.location.origin); 3229 url.searchParams.set("q", searchQuery); 3230 productSearchFetcher = new Fetcher(); 3231 return productSearchFetcher.fetch( 3232 url.toString(), 3233 { 3234 headers: { "Content-Type": "application/json" } 3235 }, 3236 { retries: 3, shouldCaptureServerError: true } 3237 ).then((res) => { 3238 if (res instanceof Response && res.ok) { 3239 return res.json(); 3240 } 3241 throw new Error("Search request failed"); 3242 }).then((json) => { 3243 const products = json.products; 3244 if (!products) return; 3245 handleSearchResults(component, products, searchQuery); 3246 }).catch((error) => { 3247 if (error === MANUALLY_ABORTED) { 3248 return; 3249 } 3250 console.error("Product search error:", error); 3251 }).finally(() => { 3252 productSearchFetcher = null; 3253 hideLoading(component); 3254 }); 3255 }; 3256 handleSearchResults = (component, products, searchQuery) => { 3257 hideLoading(component); 3258 if (products.length > 0) { 3259 updateProducts(component, products); 3260 hideTitle(component); 3261 showSearchProducts(component); 3262 hideResultsNotFound(component); 3263 } else { 3264 hideProducts(component); 3265 hideTitle(component); 3266 showResultsNotFound(component, searchQuery); 3267 } 3268 }; 3269 searchProducts = (search, component) => { 3270 showLoading(component); 3271 fetchProducts(component, search); 3272 }; 3273 debounceHandler = debounce( 3274 ([evt, component]) => searchProducts(evt.target.value, component), 3275 500 3276 ); 3277 mountComponent2 = (component) => { 3278 showTitle(component); 3279 productsReady(component); 3280 const searchIcon = component.element.querySelector('[href="#open-store-search"]'); 3281 searchIcon.addEventListener("click", () => showModal(component)); 3282 const searchElement = component.element.querySelector('[name="store-search"]'); 3283 searchElement.addEventListener("input", (evt) => debounceHandler(evt, component)); 3284 searchElement.addEventListener("focus", (evt) => debounceHandler(evt, component)); 3285 const modal = component.getComponent("Modal/V1"); 3286 modal.element.addEventListener("click", () => { 3287 hideModal(component); 3288 }); 3289 component.element.querySelector(".elStoreSearch").addEventListener("click", (evt) => { 3290 evt.stopPropagation(); 3291 }); 3292 component.element.querySelectorAll(".elModalClose").forEach( 3293 (elem) => elem.addEventListener("click", () => { 3294 hideModal(component); 3295 }) 3296 ); 3297 document.addEventListener("keydown", (evt) => { 3298 if (evt.key === "Escape") hideModal(component); 3299 }); 3300 }; 3301 getProductsElementComponent = (component) => { 3302 return component.getComponent("StoreSearchProducts"); 3303 }; 3304 updateProducts = (component, products) => { 3305 ; 3306 getProductsElementComponent(component).selected_products = products; 3307 getProductsElementComponent(component).render(); 3308 }; 3309 showModal = (component) => { 3310 document.documentElement.classList.add("hide-page-scroll"); 3311 component.getComponent("Modal/V1").element.style.display = "flex"; 3312 component.element.querySelector(".elStoreSearch").setAttribute("data-animation-state", "running"); 3313 component.element.querySelector('[name="store-search"]').focus(); 3314 }; 3315 productsReady = (component) => { 3316 updateProducts(component, Object.values(allProductsById).slice(0, 6)); 3317 getProductsElementComponent(component).element.classList.remove("forceHide"); 3318 component.element.querySelector(".elStoreSearchTitle").classList.remove("forceHide"); 3319 component.element.querySelector('[name="store-search"]').disabled = false;
3320 component.element.querySelector(".elStoreSearchLoading").classList.add("forceHide"); 3321 }; 3322 hideModal = (component) => { 3323 document.documentElement.classList.remove("hide-page-scroll"); 3324 component.getComponent("Modal/V1").element.style.display = "none"; 3325 }; 3326 showSearchProducts = (component) => { 3327 getProductsElementComponent(component).element.classList.remove("forceHide"); 3328 }; 3329 hideProducts = (component) => { 3330 getProductsElementComponent(component).element.classList.add("forceHide"); 3331 }; 3332 hideTitle = (component) => { 3333 component.element.querySelector(".elStoreSearchTitle").classList.add("forceHide"); 3334 }; 3335 showTitle = (component) => { 3336 component.element.querySelector(".elStoreSearchTitle").classList.remove("forceHide"); 3337 }; 3338 showResultsNotFound = (component, text) => { 3339 const [split1, split2] = component.not_found_text.split("{search}"); 3340 component.element.querySelector(".elStoreSearchResultsNotFound").innerHTML = split1 + text + split2; 3341 component.element.querySelector(".elStoreSearchResultsNotFound").classList.remove("forceHide"); 3342 }; 3343 hideResultsNotFound = (component) => { 3344 component.element.querySelector(".elStoreSearchResultsNotFound").classList.add("forceHide"); 3345 }; 3346 showLoading = (component) => { 3347 component.element.querySelector(".elStoreSearchLoading").classList.remove("forceHide"); 3348 }; 3349 hideLoading = (component) => { 3350 component.element.querySelector(".elStoreSearchLoading").classList.add("forceHide"); 3351 }; 3352 } 3353}); 3354
3355// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search.ts 3356var StoreSearch; 3357var init_store_search = __esm({ 3358 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search.ts"() { 3359 init_define_process(); 3360 init_modal_v1(); 3361 init_store_search_products(); 3362 init_storeSearch(); 3363 init_runtime(); 3364 StoreSearch = class extends CF2Component { 3365 constructor(el, runtimeSel) { 3366 super(el, runtimeSel); 3367 } 3368 mount() { 3369 mountComponent2(this); 3370 } 3371 }; 3372 registerComponent("StoreSearch", StoreSearch); 3373 window["StoreSearch"] = StoreSearch; 3374 } 3375}); 3376
3377// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/accordion-v1.ts 3378var AccordionV1; 3379var init_accordion_v1 = __esm({ 3380 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/accordion-v1.ts"() { 3381 init_define_process(); 3382 init_runtime(); 3383 AccordionV1 = class extends CF2Component { 3384 constructor(el, runtimeSel) { 3385 super(el, runtimeSel); 3386 } 3387 mount() { 3388 const allAccordionElements = this.element.querySelector(".elAccordionWrapper").childNodes; 3389 const bodySelector = ".elAccordionItemBody"; 3390 const openClass = "elAccordionItemOpen"; 3391 const closeClass = "elAccordionItemClosing"; 3392 allAccordionElements.forEach((accordion) => { 3393 const header = accordion.querySelector(".elAccordionItemHeader"); 3394 const body = accordion.querySelector(bodySelector); 3395 header.addEventListener("click", () => { 3396 const isOpen = accordion.classList.contains(openClass); 3397 if (isOpen) { 3398 accordion.classList.add(closeClass); 3399 $(body).slideUp(300, () => { 3400 accordion.classList.remove(openClass); 3401 accordion.classList.remove(closeClass); 3402 }); 3403 } else { 3404 accordion.classList.add(openClass); 3405 $(body).slideDown(300); 3406 } 3407 allAccordionElements.forEach((otherAccordion) => { 3408 if (otherAccordion === accordion) return; 3409 const body2 = otherAccordion.querySelector(bodySelector); 3410 otherAccordion.classList.add(closeClass);
3411 $(body2).slideUp(300, () => { 3412 otherAccordion.classList.remove(openClass); 3413 otherAccordion.classList.remove(closeClass); 3414 }); 3415 }); 3416 }); 3417 }); 3418 } 3419 }; 3420 registerComponent("Accordion/V1", AccordionV1); 3421 window["AccordionV1"] = AccordionV1; 3422 } 3423}); 3424
3425// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/checkout-product-image-carousel-v1.ts 3426var CheckoutProductImageCarouselV1; 3427var init_checkout_product_image_carousel_v1 = __esm({ 3428 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/checkout-product-image-carousel-v1.ts"() { 3429 init_define_process(); 3430 init_runtime(); 3431 CheckoutProductImageCarouselV1 = class extends CF2Component { 3432 constructor(el, runtimeSel) { 3433 super(el, runtimeSel); 3434 } 3435 selectProduct(productId, variantId) { 3436 const changedProduct = productId != this.currentProduct?.id; 3437 if (changedProduct) { 3438 this.currentVariantId = variantId; 3439 this.currentProduct = globalResourceData.productsById[productId]; 3440 this.render(); 3441 this.calculateTotalThumbnails(); 3442 this.mountSlider(); 3443 this.scrollToVariant(true); 3444 } 3445 const changedVariant = variantId != this.currentVariantId; 3446 if (changedVariant) { 3447 this.currentVariantId = variantId; 3448 this.scrollToVariant(changedProduct); 3449 } 3450 } 3451 initialize() { 3452 document.addEventListener("ProductCarousel:Update", (evt) => { 3453 const { productId, variantId } = evt.detail; 3454 this.selectProduct(productId, variantId); 3455 }); 3456 } 3457 calculateTotalThumbnails() { 3458 this.totalImages = this.element.querySelectorAll(".slider-nav .swiper-slide").length; 3459 } 3460 scrollToVariant(disableAnimation = false) { 3461 const variantImages = this.element.querySelectorAll(`.slider-nav [data-variant-id="${this.currentVariantId}"]`); 3462 const productImages = this.element.querySelectorAll(".slider-nav .swiper-slide:not([data-variant-id])"); 3463 const itemImages = variantImages.length ? variantImages : productImages; 3464 if (itemImages.length) { 3465 const itemPositions = [...itemImages].map((item) => item.getAttribute("data-image-position")); 3466 const firstPosition = itemPositions[0]; 3467 const lastPosition = itemPositions[itemPositions.length - 1]; 3468 const speed = disableAnimation ? 0 : void 0; 3469 if (this.swiperNav) { 3470 this.swiperNav.setProgress(firstPosition / (this.totalImages - this.numberOfThumbnails), speed); 3471 } 3472 this.swiper.slideTo(firstPosition, speed); 3473 } 3474 } 3475 mountSlider() { 3476 const mainSliderEl = this.element.querySelector(".slider-main"); 3477 const navSliderEl = this.element.querySelector(".slider-nav"); 3478 const hasThumbnails = !!this.element.querySelector(".slider-nav"); 3479 const hasNextPrevButtons = !!this.element.querySelector(".swiper-button-next, .swiper-button-prev"); 3480 this.swiperNav = null; 3481 if (hasThumbnails) { 3482 this.swiperNav = new Swiper(navSliderEl, { 3483 spaceBetween: this.spaceBetweenThumbnails, 3484 slidesPerView: this.numberOfThumbnails, 3485 freeMode: true, 3486 watchSlidesProgress: true, 3487 mousewheel: true, 3488 scrollbar: { 3489 el: ".swiper-scrollbar", 3490 draggable: true 3491 } 3492 }); 3493 } 3494 this.swiper = new Swiper(mainSliderEl, { 3495 spaceBetween: 1, 3496 loop: true, 3497 ...hasNextPrevButtons ? { 3498 navigation: { 3499 nextEl: ".swiper-button-next", 3500 prevEl: ".swiper-button-prev" 3501 } 3502 } : {}, 3503 ...hasThumbnails ? { 3504 thumbs: { 3505 swiper: this.swiperNav 3506 } 3507 } : {} 3508 }); 3509 } 3510 remove() { 3511 this.element.innerHTML = ""; 3512 } 3513 render(initializeChildrenInstances = false) { 3514 const is_server = true; 3515 const currentProduct = this.currentProduct ?? null; 3516 const numberOfThumbnails = this.numberOfThumbnails ?? null; 3517 const spaceBetweenThumbnails = this.spaceBetweenThumbnails ?? null; 3518 const showThumbnails = this.element.getAttribute("data-param-showThumbnails"); 3519 const linkedCheckoutId = this.element.getAttribute("data-param-linkedCheckoutId"); 3520 let html = ""; 3521 { 3522 let assignedProduct = currentProduct; 3523 html += `<div class="elProductImageCarouselOuterFrame"></div>`; 3524 const is_editor = false;
3525 let warning = ""; 3526 if (CF2Blank(assignedProduct)) { 3527 assignedProduct = globalResourceData?.productsWithNoBump?.[0]; 3528 } 3529 let imagePosition = 0; 3530 const variantImages = assignedProduct?.variants.map((i) => i.images).flat(); 3531 const allImages = assignedProduct?.images.concat(variantImages).filter((v) => v != null && v != void 0); 3532 const totalImages = allImages?.length ?? 0; 3533 html += `<div style="--widget-tooltip-message-bottom:0px;--number-of-thumbnails:${numberOfThumbnails};--space-between-thumbnails:${spaceBetweenThumbnails};--total-images:${totalImages};" class="elCheckoutProductImageCarouselContainer" data-widget-tooltip-message="">`; 3534 if (totalImages > 0) { 3535 html += `<div class="slider-main-wrapper"><div class="elProductCarouselMainImageOuterFrame"></div><div class="swiper slider-main"><div class="swiper-wrapper">`; 3536 imagePosition = 0; 3537 if (assignedProduct?.images?.length > 0) { 3538 const c0 = assignedProduct.images; 3539 const fl1 = new CF2ForloopDrop(c0.length); 3540 for (const imageUrl of c0) { 3541 const forloop = fl1; 3542 html += `<div class="swiper-slide`; 3543 if (imagePosition == 0 && false) { 3544 html += ` swiper-slide-thumb-active`; 3545 } 3546 html += `" data-image-position="${imagePosition}"><img src="${imageUrl}"/></div>`; 3547 imagePosition = imagePosition + 1; 3548 forloop.next(); 3549 } 3550 } 3551 const c2 = assignedProduct.variants; 3552 const fl3 = new CF2ForloopDrop(c2.length); 3553 for (const variant of c2) { 3554 const forloop = fl3; 3555 if (variant?.images?.length > 0) { 3556 const c4 = variant.images; 3557 const fl5 = new CF2ForloopDrop(c4.length); 3558 for (const imageUrl of c4) { 3559 const forloop2 = fl5; 3560 html += `<div class="swiper-slide`; 3561 if (imagePosition == 0 && false) { 3562 html += ` swiper-slide-thumb-active`; 3563 } 3564 html += `" data-image-position="${imagePosition}" data-variant-id="${variant?.id}"><img src="${imageUrl}"/></div>`; 3565 imagePosition = imagePosition + 1; 3566 forloop2.next(); 3567 } 3568 } 3569 forloop.next(); 3570 } 3571 html += `</div>`; 3572 if (totalImages > 1) { 3573 html += `<div class="swiper-button-next"></div>`; 3574 html += `<div class="swiper-button-prev"></div>`; 3575 } 3576 html += `</div></div>`; 3577 if (showThumbnails && totalImages > 1) { 3578 html += `<div class="slider-nav-wrapper"><div class="swiper slider-nav"><div class="swiper-wrapper">`; 3579 imagePosition = 0; 3580 if (assignedProduct?.images?.length > 0) { 3581 const c6 = assignedProduct.images; 3582 const fl7 = new CF2ForloopDrop(c6.length); 3583 for (const imageUrl of c6) { 3584 const forloop = fl7; 3585 html += `<div class="swiper-slide`; 3586 if (imagePosition == 0 && true) { 3587 html += ` swiper-slide-thumb-active`; 3588 } 3589 html += `" data-image-position="${imagePosition}"><img src="${imageUrl}"/></div>`; 3590 imagePosition = imagePosition + 1; 3591 forloop.next(); 3592 } 3593 } 3594 const c8 = assignedProduct.variants; 3595 const fl9 = new CF2ForloopDrop(c8.length); 3596 for (const variant of c8) { 3597 const forloop = fl9; 3598 if (variant?.images?.length > 0) { 3599 const c10 = variant.images; 3600 const fl11 = new CF2ForloopDrop(c10.length); 3601 for (const imageUrl of c10) { 3602 const forloop2 = fl11; 3603 html += `<div class="swiper-slide`; 3604 if (imagePosition == 0 && true) { 3605 html += ` swiper-slide-thumb-active`; 3606 } 3607 html += `" data-image-position="${imagePosition}" data-variant-id="${variant?.id}"><img src="${imageUrl}"/></div>`; 3608 imagePosition = imagePosition + 1; 3609 forloop2.next(); 3610 } 3611 } 3612 forloop.next(); 3613 } 3614 html += `</div></div><div class="swiper-scrollbar swiper-scrollbar-horizontal"></div></div>`; 3615 } 3616 } 3617 html += `</div>`; 3618 } 3619 this.replaceContent(html); 3620 if (initializeChildrenInstances) { 3621 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3622 const options = { scopeToYggRender }; 3623 CF2Component.hydrateTree(this.element, options); 3624 } 3625 } 3626 }; 3627 registerComponent("CheckoutProductImageCarousel/V1", CheckoutProductImageCarouselV1); 3628 window["CheckoutProductImageCarouselV1"] = CheckoutProductImageCarouselV1; 3629 } 3630}); 3631
3632// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/sharedModules.ts 3633var sharedModules_exports = {}; 3634var init_sharedModules = __esm({ 3635 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/sharedModules.ts"() { 3636 init_define_process(); 3637 init_content_node(); 3638 init_modal_v1(); 3639 init_modal_sidebar_v1(); 3640 init_modal_container_v1(); 3641 init_select_box_v2(); 3642 init_checkbox_v1(); 3643 init_input_v1(); 3644 init_radio_v1(); 3645 init_text_area_v1(); 3646 init_add_to_cart(); 3647 init_store_search_products(); 3648 init_store_search(); 3649 init_accordion_v1(); 3650 init_checkout_product_image_carousel_v1(); 3651 init_survey_image_option_v1(); 3652 } 3653}); 3654
3655// projects/user_pages/app/packs/user_pages.js 3656init_define_process(); 3657require_lander(); 3658init_lander_styles(); 3659init_sharedModules(); 3660//# sourceMappingURL=user_pages-U3UZDXE2.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.