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-YSVSPNWW.js"; 22import { 23 init_addToCart, 24 mountComponent 25} from "./chunk-372FPXG6.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 var STUCK_CLASS = "stickyClone"; 2610 function createPlaceholder() { 2611 return $("<div>").addClass("stickyPlaceholder").attr("aria-hidden", "true"); 2612 } 2613 function sizePlaceholder(sticky, placeholder) { 2614 const height = sticky.outerHeight() ?? 0; 2615 placeholder.css({ 2616 boxSizing: "border-box", 2617 height, 2618 marginTop: sticky.css("marginTop"), 2619 marginBottom: sticky.css("marginBottom") 2620 }); 2621 return height; 2622 } 2623 $(document).ready(function() { 2624 const $stickyElements = $(".stickyTop"); 2625 $stickyElements.each((_index, element) => { 2626 const sticky = $(element); 2627 const placeholder = createPlaceholder(); 2628 let stuck = false; 2629 let flowHeight = 0; 2630 const hasBox = () => element.getClientRects().length > 0; 2631 const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => { 2632 if (stuck) placeholder.css("height", Math.max(flowHeight, sticky.outerHeight() ?? 0)); 2633 }); 2634 const pin = () => { 2635 flowHeight = sizePlaceholder(sticky, placeholder); 2636 placeholder.insertBefore(sticky); 2637 sticky.addClass(STUCK_CLASS); 2638 stuck = true; 2639 resizeObserver?.observe(element); 2640 }; 2641 const unpin = () => { 2642 resizeObserver?.unobserve(element); 2643 sticky.removeClass(STUCK_CLASS); 2644 placeholder.detach(); 2645 stuck = false; 2646 }; 2647 const stickyTop = () => stuck ? placeholder.offset().top : sticky.offset().top; 2648 if (hasBox() && $(window).scrollTop() > stickyTop()) { 2649 pin(); 2650 } 2651 document.addEventListener("scroll", () => { 2652 const scrollTop = $(window).scrollTop(); 2653 if (!stuck && hasBox() && scrollTop >= stickyTop()) { 2654 pin(); 2655 } else if (stuck && scrollTop < stickyTop()) { 2656 unpin(); 2657 } 2658 }); 2659 }); 2660 }); 2661 } 2662}); 2663
2664// projects/user_pages/app/javascript/lander.js 2665var require_lander = __commonJS({ 2666 "projects/user_pages/app/javascript/lander.js"() { 2667 init_define_process(); 2668 require_replace_tag(); 2669 init_fetcher(); 2670 require_parseurl(); 2671 require_audio_player(); 2672 require_garlic_cf(); 2673 init_populate_select(); 2674 require_runtime_events(); 2675 init_fhl_handle_select_transformation(); 2676 init_track_events(); 2677 init_resource_sharing_concern(); 2678 init_rebilly_element(); 2679 init_upsell_element(); 2680 init_main2(); 2681 init_runtime(); 2682 init_action_link(); 2683 require_animation(); 2684 init_submit(); 2685 require_sticky(); 2686 window.nanostores = (init_nanostores(), __toCommonJS(nanostores_exports)); 2687 var originalFetch = window.fetch; 2688 window.inflightRequests = 0; 2689 window.fetch = async (request, init) => { 2690 window.inflightRequests++; 2691 try { 2692 const rendered_page_url = document.querySelector('meta[name="rendered-page-url"]')?.getAttribute("content"); 2693 if (rendered_page_url) { 2694 const url = new URL(new Request(request).url); 2695 if (url.hostname == window.location.hostname) { 2696 init = init || {}; 2697 if (!init.headers) init.headers = {}; 2698 init.headers["X-Rendered-Page-Url"] = rendered_page_url; 2699 } 2700 } 2701 } catch (e) { 2702 console.error("Failed to set X-Rendered-Page-Url header", e); 2703 } 2704 return originalFetch(request, init).finally(() => { 2705 window.inflightRequests--; 2706 }); 2707 }; 2708 $(window).on("DOMContentLoaded", function() { 2709 $('.elFormItem:not([data-prevent-garlic="true"])').each(function() { 2710 let onPersist = () => { 2711 }; 2712 if (this.getAttribute("name") == "name") { 2713 onPersist = () => { 2714 const value = this.value.trim(); 2715 const firstName = value.split(" ")[0]; 2716 const lastName = value.split(" ").slice(1).join(" "); 2717 window.cfGarlicUtils.store("first_name", firstName); 2718 window.cfGarlicUtils.store("last_name", lastName); 2719 }; 2720 } else if (this.getAttribute("name") == "phone_number") { 2721 onPersist = () => { 2722 if (!this.iti?.isValidNumber()) return; 2723 const value = this.iti?.getNumber() ?? this.value.trim(); 2724 window.cfGarlicUtils.store("phone_number", value); 2725 }; 2726 } 2727 $(this).garlic({ 2728 onPersist, 2729 onRetrieve: function($el, retrievedValue) { 2730 const elemName = $el.attr("name"); 2731 globalThis.CFGarlicValues[elemName] = retrievedValue; 2732 $el.each((_, element) => { 2733 const closestBlueprintInstance = element.closest("[data-page-element]")?.cf2_instance; 2734 if (closestBlueprintInstance && closestBlueprintInstance.update) { 2735 closestBlueprintInstance.update(retrievedValue); 2736 } 2737 }); 2738 } 2739 }); 2740 }); 2741 }); 2742 } 2743}); 2744
2745// projects/shared/stylesheets/page-content/main.scss 2746var init_main3 = __esm({ 2747 "projects/shared/stylesheets/page-content/main.scss"() { 2748 } 2749}); 2750
2751// projects/shared/stylesheets/bootstrap-modal.min.css 2752var init_bootstrap_modal_min = __esm({ 2753 "projects/shared/stylesheets/bootstrap-modal.min.css"() { 2754 } 2755}); 2756
2757// projects/user_pages/app/stylesheets/core.css 2758var init_core = __esm({ 2759 "projects/user_pages/app/stylesheets/core.css"() { 2760 } 2761}); 2762
2763// projects/user_pages/app/stylesheets/mediaelementplayer-custom.css 2764var init_mediaelementplayer_custom = __esm({ 2765 "projects/user_pages/app/stylesheets/mediaelementplayer-custom.css"() { 2766 } 2767}); 2768
2769// projects/user_pages/app/stylesheets/alert_messages.scss 2770var init_alert_messages = __esm({ 2771 "projects/user_pages/app/stylesheets/alert_messages.scss"() { 2772 } 2773}); 2774
2775// projects/lib/packages/yggdrasil-blueprints/__generated__/dist/systemBluprints.min.css 2776var init_systemBluprints_min = __esm({ 2777 "projects/lib/packages/yggdrasil-blueprints/__generated__/dist/systemBluprints.min.css"() { 2778 } 2779}); 2780
2781// projects/user_pages/app/javascript/lander_styles.js 2782var lander_styles_exports = {}; 2783var init_lander_styles = __esm({ 2784 "projects/user_pages/app/javascript/lander_styles.js"() { 2785 init_define_process(); 2786 init_main3(); 2787 init_bootstrap_modal_min(); 2788 init_core(); 2789 init_mediaelementplayer_custom(); 2790 init_alert_messages(); 2791 init_systemBluprints_min(); 2792 } 2793}); 2794
2795// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/content-node.ts 2796var ContentNode; 2797var init_content_node = __esm({ 2798 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/content-node.ts"() { 2799 init_define_process(); 2800 init_runtime(); 2801 ContentNode = class extends CF2Component { 2802 constructor(el, runtimeSel) { 2803 super(el, runtimeSel); 2804 } 2805 mount(el) { 2806 this.syncSameNameInputs(); 2807 } 2808 syncSameNameInputs() { 2809 const formInputs = document.querySelectorAll(".elFormItem[name]"); 2810 formInputs.forEach((input) => { 2811 const inputName = input.name; 2812 input.addEventListener("change", () => { 2813 if (input.type === "checkbox" || input.type === "radio") { 2814 const inputValue = input.value; 2815 const otherInputs = document.querySelectorAll( 2816 `.elFormItem.elInput[name="${inputName}"][value="${inputValue}"]` 2817 ); 2818 otherInputs.forEach((otherInput) => { 2819 otherInput.checked = input.checked; 2820 }); 2821 } else { 2822 const otherInputs = document.querySelectorAll( 2823 `.elFormItem.elInput[name="${inputName}"]` 2824 ); 2825 otherInputs.forEach((otherInput) => { 2826 otherInput.value = input.value; 2827 }); 2828 } 2829 }); 2830 }); 2831 } 2832 }; 2833 registerComponent("ContentNode", ContentNode); 2834 window["ContentNode"] = ContentNode; 2835 } 2836}); 2837
2838// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/modal-container-v1.ts 2839var ModalContainerV1; 2840var init_modal_container_v1 = __esm({ 2841 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/modal-container-v1.ts"() { 2842 init_define_process(); 2843 init_modal_v1(); 2844 init_runtime(); 2845 ModalContainerV1 = class extends CF2Component { 2846 constructor(el, runtimeSel) { 2847 super(el, runtimeSel); 2848 } 2849 mount() { 2850 this.isAudioInitialized = false; 2851 this.modal = this.getComponent("Modal/V1"); 2852 this.videoElements = this.getComponents("Video/V1"); 2853 this.modalElement = this.modal.element; 2854 this.containerModal = document.getElementById("modalPopup"); 2855 this.showOnExit = this.containerModal.getAttribute("data-show-popup-on-exit") === "true"; 2856 this.showOnLoad = this.containerModal.getAttribute("data-show-popup-on-page-load") === "true"; 2857 this.showWhenElementIsVisible = this.element.getAttribute("data-selected-element"); 2858 this.closeButton = this.element.querySelector(".closeLPModal"); 2859 if (this.showWhenElementIsVisible) { 2860 const visibleElementSelector = this.showWhenElementIsVisible.startsWith("id-") ? `.${this.showWhenElementIsVisible}` : `.id-${this.showWhenElementIsVisible}`; 2861 this.visibleElement = document.querySelector(visibleElementSelector); 2862 } 2863 const self = this; 2864 this.modal.close = function() { 2865 handleModalClose(); 2866 }; 2867 if (this.visibleElement) { 2868 handleShowWhenElementIsVisible(this.visibleElement); 2869 } 2870 if (this.showOnExit) { 2871 handleShowOnExit(); 2872 } 2873 if (this.showOnLoad) { 2874 if (this.showOnLoadDelay) { 2875 setTimeout(() => { 2876 handleModalOpen(); 2877 }, this.showOnLoadDelay); 2878 } else { 2879 handleModalOpen(); 2880 } 2881 } 2882 function handleModalOpen() { 2883 const containerModal = self.containerModal; 2884 const modalElement = self.modalElement; 2885 const closeButton = self.closeButton; 2886 const scrollY = window.scrollY; 2887 $(containerModal).show(); 2888 $(containerModal).css("top", -800); 2889 $(closeButton).css("top", -800); 2890 $(containerModal).addClass("popup-relative-position"); 2891 $("html").addClass("hide-page-scroll"); 2892 $("body").css("position", "fixed"); 2893 $("body").css("top", `-${scrollY}px`); 2894 $("body").css("width", "100%"); 2895 $(modalElement).show(); 2896 if (!self.isAudioInitialized) { 2897 self.isAudioInitialized = true; 2898 setupAudioElements(); 2899 } 2900 $(modalElement).css({ 2901 opacity: 1, 2902 top: 0 2903 }); 2904 $(containerModal).animate( 2905 { 2906 opacity: 1, 2907 top: 0 2908 }, 2909 { 2910 duration: 200 2911 } 2912 ); 2913 $(closeButton).animate({ top: -20 }, { duration: 200 }); 2914 } 2915 function handleModalClose() { 2916 const containerModal = self.containerModal; 2917 const modalElement = self.modalElement; 2918 const closeButton = self.closeButton; 2919 const scrollY = $("body").css("top"); 2920 $(closeButton).animate({ top: -800 }, { duration: 200 }); 2921 $(containerModal).animate( 2922 { 2923 opacity: 0, 2924 top: -800 2925 }, 2926 { 2927 duration: 200, 2928 complete: function() { 2929 $(modalElement).css({ 2930 opacity: 0, 2931 top: -800 2932 }); 2933 $(modalElement).hide(); 2934 $(containerModal).hide(); 2935 $(containerModal).removeClass("popup-relative-position"); 2936 } 2937 } 2938 ); 2939 $("html").removeClass("hide-page-scroll"); 2940 $("body").css("position", ""); 2941 $("body").css("top", ""); 2942 $("body").css("width", ""); 2943 if (scrollY) { 2944 window.scrollTo(0, parseInt(scrollY || "0", 10) * -1); 2945 } 2946 } 2947 function handleShowWhenElementIsVisible() { 2948 const config2 = { 2949 rootMargin: "50px 20px 75px 30px", 2950 threshold: [0, 0.25, 0.75, 1] 2951 }; 2952 const observer = new IntersectionObserver((entries) => {
2953 entries.forEach((entry) => { 2954 if (entry.isIntersecting) { 2955 observer.unobserve(entry.target, observer); 2956 handleModalOpen(); 2957 } 2958 }); 2959 }, config2); 2960 observer.observe(self.visibleElement); 2961 } 2962 function handleShowOnExit() { 2963 let cfMouseP = 0; 2964 const modalElement = self.modalElement; 2965 const handleMouseMove = (evt) => { 2966 cfMouseP = evt.clientY; 2967 }; 2968 const handleMouseLeave = () => { 2969 if (cfMouseP <= 40) { 2970 if (!$(modalElement).is(":visible")) { 2971 handleModalOpen(); 2972 document.querySelector("body").removeEventListener("mouseleave", handleMouseLeave); 2973 document.querySelector("body").removeEventListener("mousemove", handleMouseMove); 2974 } 2975 } 2976 }; 2977 document.querySelector("body").addEventListener("mousemove", handleMouseMove); 2978 document.querySelector("body").addEventListener("mouseleave", handleMouseLeave); 2979 } 2980 function setupAudioElements() { 2981 const audioElements = $(".containerModal .elAudioWrapper"); 2982 try { 2983 audioElements.each(function() { 2984 const $this = $(this); 2985 const audioURL = $this.attr("data-audio-url") || "https://images.clickfunnels.com/images/SevenNationArmy.mp3"; 2986 const loop = $this.attr("data-audio-loop") || "no"; 2987 const playerOptions = { 2988 class: "elAudioElement", 2989 audioWidth: "100%", 2990 audioHeight: "100%", 2991 enableAutosize: true, 2992 enableProgressTooltip: false, 2993 loop: loop === "yes", 2994 features: [ 2995 "playpause", 2996 "current", 2997 "progress", 2998 "duration", 2999 "volume" 3000 ] 3001 }; 3002 const audio = $(this).find("audio"); 3003 audio.attr("src", audioURL); 3004 audio.mediaelementplayer(playerOptions); 3005 }); 3006 } catch (err) { 3007 console.log(err); 3008 } 3009 } 3010 globalThis.CFOpenPopup = handleModalOpen; 3011 globalThis.CFClosePopup = handleModalClose; 3012 } 3013 }; 3014 registerComponent("ModalContainer/V1", ModalContainerV1); 3015 window["ModalContainerV1"] = ModalContainerV1; 3016 } 3017}); 3018
3019// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/add-to-cart.ts 3020var AddToCart; 3021var init_add_to_cart = __esm({ 3022 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/add-to-cart.ts"() { 3023 init_define_process(); 3024 init_addToCart(); 3025 init_runtime(); 3026 AddToCart = class extends CF2Component { 3027 constructor(el, runtimeSel) { 3028 super(el, runtimeSel); 3029 } 3030 mount() { 3031 mountComponent(this); 3032 } 3033 remove() { 3034 this.element.innerHTML = ""; 3035 } 3036 render(initializeChildrenInstances = false) { 3037 const is_server = true; 3038 const product = this.product ?? null; 3039 const currentVariant = this.currentVariant ?? null; 3040 const selected_price = this.selected_price ?? null; 3041 const button_layout_size = this.button_layout_size ?? null; 3042 const input_layout_size = this.input_layout_size ?? null; 3043 const show_name = this.show_name ?? null; 3044 const show_description = this.show_description ?? null; 3045 const show_compare_at = this.show_compare_at ?? null; 3046 const editor_product = this.element.getAttribute("data-param-editor_product"); 3047 const primary_text = this.element.getAttribute("data-param-primary_text"); 3048 const secondary_text = this.element.getAttribute("data-param-secondary_text"); 3049 let html = ""; 3050 { 3051 const is_editor = false; 3052 const customVariants = product?.variants.filter((value) => value["default_variant"] == false); 3053 const variant = currentVariant ?? product; 3054 const selected_price2 = variant?.prices?.[0]; 3055 const desc = (product?.description_override ?? variant.description ?? product.description ?? product.default_variant.description ?? "").replaceAll(` 3056`, "<br>"); 3057 html += `<div class="elAddToCartWrapper">`; 3058 if (show_name) { 3059 html += `<a class="elAddToCartNameLink" href="${product?.url}"><span class="elAddToCartName">${variant?.name ?? product.default_variant.name}</span></a>`; 3060 } 3061 if (variant?.prices?.length == 1) { 3062 html += `<div class="elAddToCartSinglePriceWrapper"><span class="elAddToCartPrice">${selected_price2?.name}</span>`; 3063 const compare_at_amount = selected_price2?.compare_at_amount; 3064 if (compare_at_amount && show_compare_at) { 3065 html += `<span class="elAddToCartCompareAt">${compare_at_amount}</span>`; 3066 } 3067 html += `</div>`; 3068 } else { 3069 html += `<div class="elSelectWrapper`; 3070 if (input_layout_size == "xs") { 3071 html += ` elAddToCartInputExtraSmall`; 3072 } 3073 if (input_layout_size == "s") { 3074 html += ` elAddToCartInputSmall`; 3075 } 3076 if (input_layout_size == "m") { 3077 html += ` elAddToCartInputMedium`; 3078 } 3079 if (input_layout_size == "l") { 3080 html += ` elAddToCartInputLarge`; 3081 } 3082 if (input_layout_size == "xl") { 3083 html += ` elAddToCartInputExtraLarge`; 3084 } 3085 html += `"><select name="variant_price">`; 3086 const c0 = variant.prices; 3087 const fl1 = new CF2ForloopDrop(c0.length); 3088 for (const price of c0) { 3089 const forloop = fl1; 3090 html += `<option `; 3091 if (selected_price2?.id == price?.id) { 3092 html += `selected`; 3093 } 3094 html += ` value="${price?.id}">${price?.name}</option>`; 3095 forloop.next(); 3096 } 3097 html += `</select><div class="elSelectArrow"><i class="fas fa-chevron-down"></i></div></div>`; 3098 } 3099 if (desc != "" && show_description) { 3100 html += `<span class="elAddToCartDescription">${desc}</span>`; 3101 } 3102 if (customVariants?.length > 1) { 3103 html += `<div class="elAddToCartVariantSelectorWrapper">`; 3104 const c2 = product.sorted_property_values; 3105 const fl3 = new CF2ForloopDrop(c2.length); 3106 for (const property_values of c2) { 3107 const forloop = fl3; 3108 const property_id = property_values?.property_id; 3109 const select_index = forloop?.index0; 3110 html += `<div class="elSelectWrapper`; 3111 if (input_layout_size == "xs") { 3112 html += ` elAddToCartInputExtraSmall`; 3113 } 3114 if (input_layout_size == "s") { 3115 html += ` elAddToCartInputSmall`; 3116 } 3117 if (input_layout_size == "m") { 3118 html += ` elAddToCartInputMedium`; 3119 } 3120 if (input_layout_size == "l") { 3121 html += ` elAddToCartInputLarge`; 3122 } 3123 if (input_layout_size == "xl") { 3124 html += ` elAddToCartInputExtraLarge`; 3125 } 3126 html += `"><span class="elAddToCartVariantSelectorTitle">${product?.all_properties?.[property_id]}</span><div style="position:relative;"><select class="elVariantSelector" name="property_${property_id}">`; 3127 const c4 = property_values.value_ids; 3128 const fl5 = new CF2ForloopDrop(c4.length); 3129 for (const value_id of c4) { 3130 const forloop2 = fl5; 3131 html += `<option `; 3132 if (variant?.property_value_ids?.[select_index] == value_id) { 3133 html += `selected`; 3134 } 3135 html += ` value="${value_id}">${product?.all_properties_values?.[value_id]}</option>`; 3136 forloop2.next(); 3137 } 3138 html += `</select><div class="elSelectArrow"><i class="fas fa-chevron-down"></i></div></div></div>`; 3139 forloop.next(); 3140 } 3141 html += `</div>`; 3142 } 3143 html += `<div class="elAddToCartButtonsWrapper"><div data-page-element="Button/V1" class="elBTN elAddToCartAddToCartButton i
3143d-Button/V1`; 3144 if (button_layout_size == "xs") { 3145 html += ` elAddToCartButtonExtraSmall`; 3146 } 3147 if (button_layout_size == "s") { 3148 html += ` elAddToCartButtonSmall`; 3149 } 3150 if (button_layout_size == "m") { 3151 html += ` elAddToCartButtonMedium`; 3152 } 3153 if (button_layout_size == "l") { 3154 html += ` elAddToCartButtonLarge`; 3155 } 3156 if (button_layout_size == "xl") { 3157 html += ` elAddToCartButtonExtraLarge`; 3158 } 3159 html += `" data-liquid-replace="item">`; 3160 const label_key = "addtocart"; 3161 const label_key_slice = "addtoc"; 3162 let data_content_key = ""; 3163 data_content_key = "addtocart"; 3164 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>`; 3165 } 3166 this.replaceContent(html); 3167 if (initializeChildrenInstances) { 3168 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3169 const options = { scopeToYggRender }; 3170 CF2Component.hydrateTree(this.element, options); 3171 } 3172 } 3173 }; 3174 registerComponent("AddToCart", AddToCart); 3175 window["AddToCart"] = AddToCart; 3176 } 3177}); 3178
3179// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search-products.ts 3180var StoreSearchProducts; 3181var init_store_search_products = __esm({ 3182 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search-products.ts"() { 3183 init_define_process(); 3184 init_runtime(); 3185 StoreSearchProducts = class extends CF2Component { 3186 constructor(el, runtimeSel) { 3187 super(el, runtimeSel); 3188 } 3189 mount() { 3190 } 3191 remove() { 3192 this.element.innerHTML = ""; 3193 } 3194 render(initializeChildrenInstances = false) { 3195 const is_server = true; 3196 const selected_products = this.selected_products ?? null; 3197 let html = ""; 3198 { 3199 const c0 = selected_products; 3200 const fl1 = new CF2ForloopDrop(c0.length); 3201 for (const product of c0) { 3202 const forloop = fl1; 3203 const default_variant = product?.default_variant ?? "{}"; 3204 const image = product?.image ?? default_variant.image ?? "/editor/editor-demo-image-placeholder.svg"; 3205 const name = product?.name ?? default_variant.name; 3206 const price = product?.price ?? default_variant.price; 3207 html += `<div class="elStoreSearchProductCard">`; 3208 if (image) { 3209 html += `<a class="elStoreSearchImageWrapper" href="${product?.url}"><div data-page-element="Image/V2" class="elImageWrapper de-image-block id-Image/V2`; 3210 if (CF2Blank(image) && CF2Blank(null) && true) { 3211 html += ` forceHide`; 3212 } 3213 html += `" data-liquid-replace="item">`; 3214 if (image || !CF2Blank(null)) { 3215 html += `<img class="elImage" src="${image ?? null}" data-lazy-loading="true" data-lazy-loading="true"/>`; 3216 } else if (false) { 3217 html += `<div class="image-placeholder" title=""><span class="image-placeholder-header"></span></div>`; 3218 } 3219 html += `</div></a>`; 3220 } 3221 html += `<div class="elStoreSearchProductCardInfo"><a href="${product?.url}" class="elStoreSearchProductCardName">${name}</a><span class="elStoreSearchProductCardPrice">${price}</span></div></div>`; 3222 forloop.next(); 3223 } 3224 } 3225 this.replaceContent(html); 3226 if (initializeChildrenInstances) { 3227 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3228 const options = { scopeToYggRender }; 3229 CF2Component.hydrateTree(this.element, options); 3230 } 3231 } 3232 }; 3233 registerComponent("StoreSearchProducts", StoreSearchProducts); 3234 window["StoreSearchProducts"] = StoreSearchProducts; 3235 } 3236}); 3237
3238// projects/lib/packages/yggdrasil-blueprints/src/Elements/Store/Search/storeSearch.ts 3239var allProductsById, productSearchFetcher, fetchProducts, handleSearchResults, searchProducts, debounceHandler, mountComponent2, getProductsElementComponent, updateProducts, showModal, productsReady, hideModal, showSearchProducts, hideProducts, hideTitle, showTitle, showResultsNotFound, hideResultsNotFound, showLoading, hideLoading; 3240var init_storeSearch = __esm({ 3241 "projects/lib/packages/yggdrasil-blueprints/src/Elements/Store/Search/storeSearch.ts"() { 3242 init_define_process(); 3243 init_general(); 3244 init_fetcher(); 3245 allProductsById = {}; 3246 fetchProducts = (component, searchQuery) => { 3247 if (productSearchFetcher) { 3248 productSearchFetcher.abort(); 3249 } 3250 const url = new URL("/products/search", window.location.origin); 3251 url.searchParams.set("q", searchQuery); 3252 productSearchFetcher = new Fetcher(); 3253 return productSearchFetcher.fetch( 3254 url.toString(), 3255 { 3256 headers: { "Content-Type": "application/json" } 3257 }, 3258 { retries: 3, shouldCaptureServerError: true } 3259 ).then((res) => { 3260 if (res instanceof Response && res.ok) { 3261 return res.json(); 3262 } 3263 throw new Error("Search request failed"); 3264 }).then((json) => { 3265 const products = json.products; 3266 if (!products) return; 3267 handleSearchResults(component, products, searchQuery); 3268 }).catch((error) => { 3269 if (error === MANUALLY_ABORTED) { 3270 return; 3271 } 3272 console.error("Product search error:", error); 3273 }).finally(() => { 3274 productSearchFetcher = null; 3275 hideLoading(component); 3276 }); 3277 }; 3278 handleSearchResults = (component, products, searchQuery) => { 3279 hideLoading(component); 3280 if (products.length > 0) { 3281 updateProducts(component, products); 3282 hideTitle(component); 3283 showSearchProducts(component); 3284 hideResultsNotFound(component); 3285 } else { 3286 hideProducts(component); 3287 hideTitle(component); 3288 showResultsNotFound(component, searchQuery); 3289 } 3290 }; 3291 searchProducts = (search, component) => { 3292 showLoading(component); 3293 fetchProducts(component, search); 3294 }; 3295 debounceHandler = debounce( 3296 ([evt, component]) => searchProducts(evt.target.value, component), 3297 500 3298 ); 3299 mountComponent2 = (component) => { 3300 showTitle(component); 3301 productsReady(component); 3302 const searchIcon = component.element.querySelector('[href="#open-store-search"]'); 3303 searchIcon.addEventListener("click", () => showModal(component)); 3304 const searchElement = component.element.querySelector('[name="store-search"]'); 3305 searchElement.addEventListener("input", (evt) => debounceHandler(evt, component)); 3306 searchElement.addEventListener("focus", (evt) => debounceHandler(evt, component)); 3307 const modal = component.getComponent("Modal/V1"); 3308 modal.element.addEventListener("click", () => { 3309 hideModal(component); 3310 }); 3311 component.element.querySelector(".elStoreSearch").addEventListener("click", (evt) => { 3312 evt.stopPropagation(); 3313 }); 3314 component.element.querySelectorAll(".elModalClose").forEach( 3315 (elem) => elem.addEventListener("click", () => { 3316 hideModal(component); 3317 }) 3318 ); 3319 document.addEventListener("keydown", (evt) => { 3320 if (evt.key === "Escape") hideModal(component); 3321 }); 3322 }; 3323 getProductsElementComponent = (component) => { 3324 return component.getComponent("StoreSearchProducts"); 3325 }; 3326 updateProducts = (component, products) => { 3327 ; 3328 getProductsElementComponent(component).selected_products = products; 3329 getProductsElementComponent(component).render(); 3330 }; 3331 showModal = (component) => { 3332 document.documentElement.classList.add("hide-page-scroll"); 3333 component.getComponent("Modal/V1").element.style.display = "flex"; 3334 component.element.querySelector(".elStoreSearch").setAttribute("data-animation-state", "running"); 3335 component.element.querySelector('[name="store-search"]').focus(); 3336 }; 3337 productsReady = (component) => { 3338 updateProducts(component, Object.values(allProductsById).slice(0, 6)); 3339 getProductsElementComponent(component).element.classList.remove("forceHide"); 3340 component.element.querySelector(".elStoreSearchTitle").classList.remove("forceHide"); 3341 component.element.querySelector('[name="store-search"]').disabled = false;
3342 component.element.querySelector(".elStoreSearchLoading").classList.add("forceHide"); 3343 }; 3344 hideModal = (component) => { 3345 document.documentElement.classList.remove("hide-page-scroll"); 3346 component.getComponent("Modal/V1").element.style.display = "none"; 3347 }; 3348 showSearchProducts = (component) => { 3349 getProductsElementComponent(component).element.classList.remove("forceHide"); 3350 }; 3351 hideProducts = (component) => { 3352 getProductsElementComponent(component).element.classList.add("forceHide"); 3353 }; 3354 hideTitle = (component) => { 3355 component.element.querySelector(".elStoreSearchTitle").classList.add("forceHide"); 3356 }; 3357 showTitle = (component) => { 3358 component.element.querySelector(".elStoreSearchTitle").classList.remove("forceHide"); 3359 }; 3360 showResultsNotFound = (component, text) => { 3361 const [split1, split2] = component.not_found_text.split("{search}"); 3362 component.element.querySelector(".elStoreSearchResultsNotFound").innerHTML = split1 + text + split2; 3363 component.element.querySelector(".elStoreSearchResultsNotFound").classList.remove("forceHide"); 3364 }; 3365 hideResultsNotFound = (component) => { 3366 component.element.querySelector(".elStoreSearchResultsNotFound").classList.add("forceHide"); 3367 }; 3368 showLoading = (component) => { 3369 component.element.querySelector(".elStoreSearchLoading").classList.remove("forceHide"); 3370 }; 3371 hideLoading = (component) => { 3372 component.element.querySelector(".elStoreSearchLoading").classList.add("forceHide"); 3373 }; 3374 } 3375}); 3376
3377// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search.ts 3378var StoreSearch; 3379var init_store_search = __esm({ 3380 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search.ts"() { 3381 init_define_process(); 3382 init_modal_v1(); 3383 init_store_search_products(); 3384 init_storeSearch(); 3385 init_runtime(); 3386 StoreSearch = class extends CF2Component { 3387 constructor(el, runtimeSel) { 3388 super(el, runtimeSel); 3389 } 3390 mount() { 3391 mountComponent2(this); 3392 } 3393 }; 3394 registerComponent("StoreSearch", StoreSearch); 3395 window["StoreSearch"] = StoreSearch; 3396 } 3397}); 3398
3399// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/accordion-v1.ts 3400var AccordionV1; 3401var init_accordion_v1 = __esm({ 3402 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/accordion-v1.ts"() { 3403 init_define_process(); 3404 init_runtime(); 3405 AccordionV1 = class extends CF2Component { 3406 constructor(el, runtimeSel) { 3407 super(el, runtimeSel); 3408 } 3409 mount() { 3410 const allAccordionElements = this.element.querySelector(".elAccordionWrapper").childNodes; 3411 const bodySelector = ".elAccordionItemBody"; 3412 const openClass = "elAccordionItemOpen"; 3413 const closeClass = "elAccordionItemClosing"; 3414 allAccordionElements.forEach((accordion) => { 3415 const header = accordion.querySelector(".elAccordionItemHeader"); 3416 const body = accordion.querySelector(bodySelector); 3417 header.addEventListener("click", () => { 3418 const isOpen = accordion.classList.contains(openClass); 3419 if (isOpen) { 3420 accordion.classList.add(closeClass); 3421 $(body).slideUp(300, () => { 3422 accordion.classList.remove(openClass); 3423 accordion.classList.remove(closeClass); 3424 }); 3425 } else { 3426 accordion.classList.add(openClass); 3427 $(body).slideDown(300); 3428 } 3429 allAccordionElements.forEach((otherAccordion) => { 3430 if (otherAccordion === accordion) return; 3431 const body2 = otherAccordion.querySelector(bodySelector); 3432 otherAccordion.classList.add(closeClass);
3433 $(body2).slideUp(300, () => { 3434 otherAccordion.classList.remove(openClass); 3435 otherAccordion.classList.remove(closeClass); 3436 }); 3437 }); 3438 }); 3439 }); 3440 } 3441 }; 3442 registerComponent("Accordion/V1", AccordionV1); 3443 window["AccordionV1"] = AccordionV1; 3444 } 3445}); 3446
3447// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/checkout-product-image-carousel-v1.ts 3448var CheckoutProductImageCarouselV1; 3449var init_checkout_product_image_carousel_v1 = __esm({ 3450 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/checkout-product-image-carousel-v1.ts"() { 3451 init_define_process(); 3452 init_runtime(); 3453 CheckoutProductImageCarouselV1 = class extends CF2Component { 3454 constructor(el, runtimeSel) { 3455 super(el, runtimeSel); 3456 } 3457 selectProduct(productId, variantId) { 3458 const changedProduct = productId != this.currentProduct?.id; 3459 if (changedProduct) { 3460 this.currentVariantId = variantId; 3461 this.currentProduct = globalResourceData.productsById[productId]; 3462 this.render(); 3463 this.calculateTotalThumbnails(); 3464 this.mountSlider(); 3465 this.scrollToVariant(true); 3466 } 3467 const changedVariant = variantId != this.currentVariantId; 3468 if (changedVariant) { 3469 this.currentVariantId = variantId; 3470 this.scrollToVariant(changedProduct); 3471 } 3472 } 3473 initialize() { 3474 document.addEventListener("ProductCarousel:Update", (evt) => { 3475 const { productId, variantId } = evt.detail; 3476 this.selectProduct(productId, variantId); 3477 }); 3478 } 3479 // The sliders have to be mounted on load, not only when a ProductCarousel:Update 3480 // arrives. That event is dispatched exclusively by CheckoutProductSelect/V2 and 3481 // AddToCart, so a page carrying the carousel without one of those elements (a 3482 // plain sales page, for example) never mounted Swiper at all: the thumbnail strip 3483 // fell back to Swiper's own 100%-wide .swiper-slide rule, so only the first 3484 // thumbnail was visible and it was stretched across the whole strip. The editor 3485 // hides this because it does not hydrate CF2 components, and lays the strip out 3486 // with the editor-only editor-styles macro instead - hence thumbnails that show 3487 // in the builder but not on preview or live (ENG-7465). 3488 mount() { 3489 this.calculateTotalThumbnails(); 3490 this.mountSlider(); 3491 } 3492 calculateTotalThumbnails() { 3493 this.totalImages = this.element.querySelectorAll(".slider-nav .swiper-slide").length; 3494 } 3495 scrollToVariant(disableAnimation = false) { 3496 const variantImages = this.element.querySelectorAll(`.slider-nav [data-variant-id="${this.currentVariantId}"]`); 3497 const productImages = this.element.querySelectorAll(".slider-nav .swiper-slide:not([data-variant-id])"); 3498 const itemImages = variantImages.length ? variantImages : productImages; 3499 if (itemImages.length) { 3500 const itemPositions = [...itemImages].map((item) => item.getAttribute("data-image-position")); 3501 const firstPosition = itemPositions[0]; 3502 const lastPosition = itemPositions[itemPositions.length - 1]; 3503 const speed = disableAnimation ? 0 : void 0; 3504 if (this.swiperNav) { 3505 this.swiperNav.setProgress(firstPosition / (this.totalImages - this.numberOfThumbnails), speed); 3506 } 3507 this.swiper.slideTo(firstPosition, speed); 3508 } 3509 } 3510 // Destroys with cleanStyles = false on purpose: selectProduct() re-renders the 3511 // element before re-mounting, so by the time this runs the instances point at 3512 // detached nodes and there is nothing worth restoring styles on. 3513 destroySliders() { 3514 this.swiper?.destroy(true, false); 3515 this.swiper = null; 3516 this.swiperNav?.destroy(true, false); 3517 this.swiperNav = null; 3518 } 3519 mountSlider() { 3520 const mainSliderEl = this.element.querySelector(".slider-main"); 3521 const navSliderEl = this.element.querySelector(".slider-nav"); 3522 const hasThumbnails = !!navSliderEl; 3523 const hasNextPrevButtons = !!this.element.querySelector(".swiper-button-next, .swiper-button-prev"); 3524 this.destroySliders(); 3525 if (!mainSliderEl) return; 3526 if (hasThumbnails) { 3527 this.swiperNav = new Swiper(navSliderEl, { 3528 spaceBetween: this.spaceBetweenThumbnails, 3529 slidesPerView: this.numberOfThumbnails, 3530 freeMode: true, 3531 watchSlidesProgress: true, 3532 mousewheel: true, 3533 scrollbar: { 3534 // The scrollbar is a sibling of .slider-nav rather than a descendant, so 3535 // Swiper resolves a selector string here against the document, not this 3536 // carousel. Harmless while only one carousel was ever mounted at a time; 3537 // now that every carousel mounts on load, two on the same page would both 3538 // bind to the first match. Pass this element's own node instead. 3539 el: this.element.querySelector(".swiper-scrollbar"), 3540 draggable: true 3541 } 3542 }); 3543 } 3544 this.swiper = new Swiper(mainSliderEl, { 3545 spaceBetween: 1, 3546 loop: true, 3547 ...hasNextPrevButtons ? { 3548 navigation: { 3549 nextEl: ".swiper-button-next", 3550 prevEl: ".swiper-button-prev" 3551 } 3552 } : {}, 3553 ...hasThumbnails ? { 3554 thumbs: { 3555 swiper: this.swiperNav 3556 } 3557 } : {} 3558 }); 3559 } 3560 remove() { 3561 this.element.innerHTML = ""; 3562 } 3563 render(initializeChildrenInstances = false) { 3564 const is_server = true; 3565 const currentProduct = this.currentProduct ?? null; 3566 const numberOfThumbnails = this.numberOfThumbnails ?? null; 3567 const spaceBetweenThumbnails = this.spaceBetweenThumbnails ?? null; 3568 const showThumbnails = this.element.getAttribute("data-param-showThumbnails"); 3569 const linkedCheckoutId = this.element.getAttribute("data-param-linkedCheckoutId"); 3570 let html = ""; 3571 { 3572 let assignedProduct = currentProduct; 3573 html += `<div class="elProductImageCarouselOuterFrame"></div>`; 3574 const is_editor = false;
3575 let warning = ""; 3576 if (CF2Blank(assignedProduct)) { 3577 assignedProduct = globalResourceData?.productsWithNoBump?.[0]; 3578 } 3579 let imagePosition = 0; 3580 const variantImages = assignedProduct?.variants.map((i) => i.images).flat(); 3581 const allImages = assignedProduct?.images.concat(variantImages).filter((v) => v != null && v != void 0); 3582 const totalImages = allImages?.length ?? 0; 3583 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="">`; 3584 if (totalImages > 0) { 3585 html += `<div class="slider-main-wrapper"><div class="elProductCarouselMainImageOuterFrame"></div><div class="swiper slider-main"><div class="swiper-wrapper">`; 3586 imagePosition = 0; 3587 if (assignedProduct?.images?.length > 0) { 3588 const c0 = assignedProduct.images; 3589 const fl1 = new CF2ForloopDrop(c0.length); 3590 for (const imageUrl of c0) { 3591 const forloop = fl1; 3592 html += `<div class="swiper-slide`; 3593 if (imagePosition == 0 && false) { 3594 html += ` swiper-slide-thumb-active`; 3595 } 3596 html += `" data-image-position="${imagePosition}"><img src="${imageUrl}"/></div>`; 3597 imagePosition = imagePosition + 1; 3598 forloop.next(); 3599 } 3600 } 3601 const c2 = assignedProduct.variants; 3602 const fl3 = new CF2ForloopDrop(c2.length); 3603 for (const variant of c2) { 3604 const forloop = fl3; 3605 if (variant?.images?.length > 0) { 3606 const c4 = variant.images; 3607 const fl5 = new CF2ForloopDrop(c4.length); 3608 for (const imageUrl of c4) { 3609 const forloop2 = fl5; 3610 html += `<div class="swiper-slide`; 3611 if (imagePosition == 0 && false) { 3612 html += ` swiper-slide-thumb-active`; 3613 } 3614 html += `" data-image-position="${imagePosition}" data-variant-id="${variant?.id}"><img src="${imageUrl}"/></div>`; 3615 imagePosition = imagePosition + 1; 3616 forloop2.next(); 3617 } 3618 } 3619 forloop.next(); 3620 } 3621 html += `</div>`; 3622 if (totalImages > 1) { 3623 html += `<div class="swiper-button-next"></div>`; 3624 html += `<div class="swiper-button-prev"></div>`; 3625 } 3626 html += `</div></div>`; 3627 if (showThumbnails && totalImages > 1) { 3628 html += `<div class="slider-nav-wrapper"><div class="swiper slider-nav"><div class="swiper-wrapper">`; 3629 imagePosition = 0; 3630 if (assignedProduct?.images?.length > 0) { 3631 const c6 = assignedProduct.images; 3632 const fl7 = new CF2ForloopDrop(c6.length); 3633 for (const imageUrl of c6) { 3634 const forloop = fl7; 3635 html += `<div class="swiper-slide`; 3636 if (imagePosition == 0 && true) { 3637 html += ` swiper-slide-thumb-active`; 3638 } 3639 html += `" data-image-position="${imagePosition}"><img src="${imageUrl}"/></div>`; 3640 imagePosition = imagePosition + 1; 3641 forloop.next(); 3642 } 3643 } 3644 const c8 = assignedProduct.variants; 3645 const fl9 = new CF2ForloopDrop(c8.length); 3646 for (const variant of c8) { 3647 const forloop = fl9; 3648 if (variant?.images?.length > 0) { 3649 const c10 = variant.images; 3650 const fl11 = new CF2ForloopDrop(c10.length); 3651 for (const imageUrl of c10) { 3652 const forloop2 = fl11; 3653 html += `<div class="swiper-slide`; 3654 if (imagePosition == 0 && true) { 3655 html += ` swiper-slide-thumb-active`; 3656 } 3657 html += `" data-image-position="${imagePosition}" data-variant-id="${variant?.id}"><img src="${imageUrl}"/></div>`; 3658 imagePosition = imagePosition + 1; 3659 forloop2.next(); 3660 } 3661 } 3662 forloop.next(); 3663 } 3664 html += `</div></div><div class="swiper-scrollbar swiper-scrollbar-horizontal"></div></div>`; 3665 } 3666 } 3667 html += `</div>`; 3668 } 3669 this.replaceContent(html); 3670 if (initializeChildrenInstances) { 3671 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3672 const options = { scopeToYggRender }; 3673 CF2Component.hydrateTree(this.element, options); 3674 } 3675 } 3676 }; 3677 registerComponent("CheckoutProductImageCarousel/V1", CheckoutProductImageCarouselV1); 3678 window["CheckoutProductImageCarouselV1"] = CheckoutProductImageCarouselV1; 3679 } 3680}); 3681
3682// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/sharedModules.ts 3683var sharedModules_exports = {}; 3684var init_sharedModules = __esm({ 3685 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/sharedModules.ts"() { 3686 init_define_process(); 3687 init_content_node(); 3688 init_modal_v1(); 3689 init_modal_sidebar_v1(); 3690 init_modal_container_v1(); 3691 init_select_box_v2(); 3692 init_checkbox_v1(); 3693 init_input_v1(); 3694 init_radio_v1(); 3695 init_text_area_v1(); 3696 init_add_to_cart(); 3697 init_store_search_products(); 3698 init_store_search(); 3699 init_accordion_v1(); 3700 init_checkout_product_image_carousel_v1(); 3701 init_survey_image_option_v1(); 3702 } 3703}); 3704
3705// projects/user_pages/app/packs/user_pages.js 3706init_define_process(); 3707require_lander(); 3708init_lander_styles(); 3709init_sharedModules(); 3710//# sourceMappingURL=user_pages-Y637IHEK.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.