1import { 2 init_modal_sidebar_v1 3} from "./chunk-HCI44IIR.js"; 4import { 5 init_text_area_v1 6} from "./chunk-WOE7C5NJ.js"; 7import { 8 init_survey_image_option_v1 9} from "./chunk-4B3LWMAW.js"; 10import { 11 init_select_box_v2 12} from "./chunk-VN7A3V3C.js"; 13import { 14 Fetcher, 15 MANUALLY_ABORTED, 16 checkoutNonceParams, 17 fetchCheckoutNonce, 18 fetcher_exports, 19 init_fetcher, 20 init_nonce 21} from "./chunk-5CDFUW2T.js"; 22import { 23 init_addToCart, 24 mountComponent 25} from "./chunk-T2PQTTID.js"; 26import { 27 debounce, 28 init_general, 29 init_nanostores, 30 nanostores_exports 31} from "./chunk-WDQK6HWQ.js"; 32import { 33 init_radio_v1 34} from "./chunk-MSPQW4FO.js"; 35import { 36 init_checkbox_v1, 37 init_input_v1 38} from "./chunk-USXYI4AH.js"; 39import { 40 init_cf_utils, 41 isWithinCustomerCenterView, 42 uuidv4 43} from "./chunk-VVEAJADP.js"; 44import { 45 init_modal_v1 46} from "./chunk-L4HCJ2FE.js"; 47import { 48 CF2Component, 49 init_runtime, 50 registerComponent, 51 runtime_exports 52} from "./chunk-7CTAZQES.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(PURCHASE_EVENT_ID_COOKIE); 1126} 1127function purchaseAlreadyPushed(purchaseEventID) { 1128 return Cookies.get(PURCHASE_EVENT_PUSHED_COOKIE) === purchaseEventID; 1129} 1130function markPurchasePushed(purchaseEventID) { 1131 Cookies.set(PURCHASE_EVENT_PUSHED_COOKIE, purchaseEventID, PURCHASE_EVENT_ID_TTL); 1132 Cookies.set(PURCHASE_EVENT_ID_COOKIE, purchaseEventID, PURCHASE_EVENT_ID_TTL); 1133} 1134function getRenderedPage() { 1135 return document.querySelector('meta[name="rendered-page-url"]')?.getAttribute("content"); 1136} 1137function getCfTokenFromUrl() { 1138 return new URLSearchParams(window.location.search).get(CF_TOKEN_PARAM); 1139} 1140function stripCfTokenFromUrl() { 1141 const url = new URL(window.location.href); 1142 if (!url.searchParams.has(CF_TOKEN_PARAM)) return; 1143 url.searchParams.delete(CF_TOKEN_PARAM); 1144 window.history.replaceState({}, "", url.toString()); 1145} 1146function pageUrlWithoutQuery() { 1147 const url = new URL(window.location.href); 1148 url.search = ""; 1149 url.hash = ""; 1150 return url.toString(); 1151} 1152function workspaceResolveTokenUrl() { 1153 return "/_cf/resolve_token"; 1154} 1155async function resolveCfTokenIfPresent() { 1156 const token = getCfTokenFromUrl(); 1157 if (!token) return; 1158 try { 1159 const response = await fetch(workspaceResolveTokenUrl(), { 1160 method: "POST", 1161 headers: { "Content-Type": "application/json", Accept: "application/json" }, 1162 body: JSON.stringify({ cf_token: token, url: pageUrlWithoutQuery() }) 1163 }); 1164 stripCfTokenFromUrl(); 1165 if (!response.ok) return; 1166 const payload = await response.json(); 1167 if (!payload.contact_uuid || !payload.visit_uuid) return; 1168 ahoy.configure({ 1169 adoptVisit: { visitId: payload.visit_uuid, visitorId: payload.contact_uuid } 1170 }); 1171 } catch { 1172 stripCfTokenFromUrl(); 1173 } 1174} 1175function isLivePage(queryString) { 1176 const urlParams = new URLSearchParams(queryString); 1177 return urlParams.get("preview") !== "true"; 1178} 1179var PURCHASE_EVENT_ID_COOKIE, PURCHASE_EVENT_PUSHED_COOKIE, PURCHASE_EVENT_ID_TTL, livePage, trackingDisabled, renderedPage, CF_TOKEN_PARAM; 1180var init_track_events = __esm({ 1181 "projects/user_pages/app/javascript/lander/track_events.js"() { 1182 init_define_process(); 1183 init_cfhoy_esm(); 1184 init_cfhoy_esm(); 1185 PURCHASE_EVENT_ID_COOKIE = "cfhoy_purchase_event_id"; 1186 PURCHASE_EVENT_PUSHED_COOKIE = "cfhoy_purchase_event_pushed"; 1187 PURCHASE_EVENT_ID_TTL = 60; 1188 livePage = isLivePage(window.location.search); 1189 trackingDisabled = window.disableTracking; 1190 renderedPage = getRenderedPage(); 1191 ahoy.configure({ 1192 urlPrefix: "/_cf", 1193 visitsUrl: "/s", 1194 eventsUrl: "/a", 1195 platform: "Web", 1196 useBeacon: true, 1197 startOnReady: false, 1198 trackVisits: true, 1199 cookies: true, 1200 withCredentials: false, 1201 visitDuration: 4 * 60, 1202 // 4 hours 1203 visitorDuration: 2 * 365 * 24 * 60, 1204 // 2 years 1205 page: renderedPage, 1206 trackPageViewWithVisit: true, 1207 trackPageViewWithVisitAdditionalProps: () => ({ 1208 cfhoy_visitor: Cookies.get("cfhoy_visitor") || "", 1209 request_type: "visit" 1210 }), 1211 extendedInstrumentation: true 1212 }); 1213 CF_TOKEN_PARAM = "__cf_token"; 1214 if (!trackingDisabled && livePage) { 1215 const startCfHoy = () => { 1216 if (window._cfHoyStarted) return; 1217 window._cfHoyStarted = true; 1218 ahoy.start(); 1219 }; 1220 const resolveAndStart = () => resolveCfTokenIfPresent().finally(startCfHoy); 1221 if (document.readyState === "complete") { 1222 resolveAndStart(); 1223 } else { 1224 window.addEventListener("load", resolveAndStart); 1225 } 1226 document.addEventListener("cfhoy:tracked", function(event) { 1227 window.dataLayer = window.dataLayer || []; 1228 if (event.detail.name == "$view") { 1229 const visitorData = cfhoyVisitorData(); 1230 dataLayer.push({ 1231 event: "cfPageView", 1232 contactFirstName: visitorData.firstName, 1233 contactLastName: visitorData.lastName, 1234 contactEmailAddress: visitorData.emailAddress, 1235 contactPhoneNumber: visitorData.phoneNumber, 1236 contactPostalCode: visitorData.postalCode, 1237 contactCountry: visitorData.country, 1238 contactExternalID: visitorData.uuid, 1239 visitEventID: event.detail.id 1240 }); 1241 } 1242 }); 1243 document.addEventListener("DOMContentLoaded", function(event) { 1244 const additionalProps = { 1245 cfhoy_visitor: Cookies.get("cfhoy_visitor") || "", 1246 request_type: "trackView" 1247 }; 1248 ahoy.trackView(additionalProps); 1249 $(document).on("click", '[event-tracking="enable"]', function() { 1250 const data = { 1251 url: window.location.href, 1252 page: renderedPage || window.location.pathname, 1253 title: document.title 1254 }; 1255 ahoy.track("$button_click", data); 1256 }); 1257 }); 1258 } 1259 document.addEventListener("DOMContentLoaded", function(event) { 1260 window.dataLayer = window.dataLayer || []; 1261 const visitorData = cfhoyVisitorData(); 1262 const leadEventID = getLeadEventID(); 1263 const purchaseEventID = getPurchaseEventID(); 1264 if (leadEventID) { 1265 dataLayer.push({ 1266 event: "cfLead", 1267 contactFirstName: visitorData.firstName, 1268 contactLastName: visitorData.lastName, 1269 contactEmailAddress: visitorData.emailAddress, 1270 contactPhoneNumber: visitorData.phoneNumber, 1271 contactPostalCode: visitorData.postalCode, 1272 contactCountry: visitorData.country, 1273 contactExternalID: visitorData.uuid, 1274 leadEventID 1275 }); 1276 removeLeadEventID(); 1277 } 1278 if (purchaseEventID && !purchaseAlreadyPushed(purchaseEventID)) { 1279 dataLayer.push({ 1280 event: "cfPurchase", 1281 contactFirstName: visitorData.firstName, 1282 contactLastName: visitorData.lastName, 1283 contactEmailAddress: visitorData.emailAddress, 1284 contactPhoneNumber: visitorData.phoneNumber, 1285 contactPostalCode: visitorData.postalCode, 1286 contactCountry: visitorData.country, 1287 contactExternalID: visitorData.uuid, 1288 purchaseEventID 1289 }); 1290 markPurchasePushed(purchaseEventID); 1291 } 1292 }); 1293 } 1294}); 1295
1296// projects/user_pages/app/javascript/lander/resource_sharing_concern.js 1297var resource_sharing_concern_exports = {}; 1298var init_resource_sharing_concern = __esm({ 1299 "projects/user_pages/app/javascript/lander/resource_sharing_concern.js"() { 1300 init_define_process(); 1301 init_cfhoy_esm(); 1302 document.addEventListener("DOMContentLoaded", function() { 1303 const queryString = window.location.search; 1304 const urlParams = new URLSearchParams(queryString); 1305 const ttl = 30 * 24 * 60; 1306 const workspace_sharing_id = urlParams.get("workspace_sharing_id"); 1307 if (workspace_sharing_id) { 1308 Cookies.set("workspace_sharing_id", workspace_sharing_id, ttl); 1309 } 1310 const resource_install_intent_ttl = 24 * 60 * 60; 1311 const resource_install_intent = urlParams.get("resource_install_intent"); 1312 if (resource_install_intent) { 1313 Cookies.set("resource_install_intent", resource_install_intent, resource_install_intent_ttl); 1314 } 1315 const awid_ttl = 60 * 60; 1316 const awid = urlParams.get("awid"); 1317 if (awid) { 1318 Cookies.set("awid", awid, awid_ttl); 1319 } 1320 }); 1321 } 1322}); 1323
1324// projects/user_pages/app/javascript/lander/contact_fields.ts 1325function contactCarrierInputId(name) { 1326 return `cf_contact_${CONTACT_CARRIER_ID_SUFFIXES.get(name) ?? name}`; 1327} 1328var CONTACT_CARRIER_ID_SUFFIXES; 1329var init_contact_fields = __esm({ 1330 "projects/user_pages/app/javascript/lander/contact_fields.ts"() { 1331 init_define_process(); 1332 CONTACT_CARRIER_ID_SUFFIXES = /* @__PURE__ */ new Map([["phone_number", "phone"]]); 1333 } 1334}); 1335
1336// projects/user_pages/app/javascript/lander/vendor/mailCheck/domains.ts 1337var defaultDomains, defaultSecondLevelDomains, defaultTopLevelDomains; 1338var init_domains = __esm({ 1339 "projects/user_pages/app/javascript/lander/vendor/mailCheck/domains.ts"() { 1340 init_define_process(); 1341 defaultDomains = [ 1342 "msn.com", 1343 "bellsouth.net", 1344 "telus.net", 1345 "comcast.net", 1346 "optusnet.com.au", 1347 "earthlink.net", 1348 "qq.com", 1349 "sky.com", 1350 "icloud.com", 1351 "mac.com", 1352 "sympatico.ca", 1353 "googlemail.com", 1354 "att.net", 1355 "xtra.co.nz", 1356 "web.de", 1357 "cox.net", 1358 "gmail.com", 1359 "ymail.com", 1360 "aim.com", 1361 "rogers.com", 1362 "verizon.net", 1363 "rocketmail.com", 1364 "google.com", 1365 "optonline.net", 1366 "sbcglobal.net", 1367 "aol.com", 1368 "me.com", 1369 "btinternet.com", 1370 "charter.net", 1371 "shaw.ca" 1372 ]; 1373 defaultSecondLevelDomains = ["yahoo", "hotmail", "mail", "live", "outlook", "gmx"]; 1374 defaultTopLevelDomains = [ 1375 "com", 1376 "com.au", 1377 "com.tw", 1378 "ca", 1379 "co.nz", 1380 "co.uk", 1381 "de", 1382 "fr", 1383 "it", 1384 "ru", 1385 "net", 1386 "org", 1387 "edu", 1388 "gov", 1389 "jp", 1390 "nl", 1391 "kr", 1392 "se", 1393 "eu", 1394 "ie", 1395 "co.il", 1396 "us", 1397 "at", 1398 "be", 1399 "dk", 1400 "hk", 1401 "es", 1402 "gr", 1403 "ch", 1404 "no", 1405 "cz", 1406 "in", 1407 "net", 1408 "net.au", 1409 "info", 1410 "biz", 1411 "mil", 1412 "co.jp", 1413 "sg", 1414 "hu", 1415 "uk", 1416 "io" 1417 ]; 1418 } 1419}); 1420
1421// projects/user_pages/app/javascript/lander/vendor/mailCheck/main.ts 1422var define, Mailcheck; 1423var init_main = __esm({ 1424 "projects/user_pages/app/javascript/lander/vendor/mailCheck/main.ts"() { 1425 init_define_process(); 1426 init_domains(); 1427 Mailcheck = { 1428 domainThreshold: 2, 1429 secondLevelThreshold: 2, 1430 topLevelThreshold: 2, 1431 run: function(opts) { 1432 opts.domains = opts.domains || defaultDomains; 1433 opts.secondLevelDomains = opts.secondLevelDomains || defaultSecondLevelDomains; 1434 opts.topLevelDomains = opts.topLevelDomains || defaultTopLevelDomains; 1435 opts.distanceFunction = opts.distanceFunction || Mailcheck.sift4Distance; 1436 const defaultCallback = function(result2) { 1437 return result2; 1438 }; 1439 const suggestedCallback = opts.suggested || defaultCallback; 1440 const emptyCallback = opts.empty || defaultCallback; 1441 const result = Mailcheck.suggest( 1442 Mailcheck.encodeEmail(opts.email), 1443 opts.domains, 1444 opts.secondLevelDomains, 1445 opts.topLevelDomains, 1446 opts.distanceFunction 1447 ); 1448 return result ? suggestedCallback(result) : emptyCallback(); 1449 }, 1450 suggest: function(email, domains, secondLevelDomains, topLevelDomains, distanceFunction) { 1451 email = email.toLowerCase(); 1452 const emailParts = this.splitEmail(email); 1453 if (secondLevelDomains && topLevelDomains) { 1454 if (secondLevelDomains.indexOf(emailParts.secondLevelDomain) !== -1 && topLevelDomains.indexOf(emailParts.topLevelDomain) !== -1) { 1455 return false; 1456 } 1457 } 1458 let closestDomain = this.findClosestDomain(emailParts.domain, domains, distanceFunction, this.domainThreshold); 1459 if (closestDomain) { 1460 if (closestDomain == emailParts.domain) { 1461 return false; 1462 } else { 1463 return { address: emailParts.address, domain: closestDomain, full: emailParts.address + "@" + closestDomain }; 1464 } 1465 } 1466 const closestSecondLevelDomain = this.findClosestDomain( 1467 emailParts.secondLevelDomain, 1468 secondLevelDomains, 1469 distanceFunction, 1470 this.secondLevelThreshold 1471 ); 1472 const closestTopLevelDomain = this.findClosestDomain( 1473 emailParts.topLevelDomain, 1474 topLevelDomains, 1475 distanceFunction, 1476 this.topLevelThreshold 1477 ); 1478 if (emailParts.domain) { 1479 closestDomain = emailParts.domain; 1480 let rtrn = false; 1481 if (closestSecondLevelDomain && closestSecondLevelDomain != emailParts.secondLevelDomain) { 1482 closestDomain = closestDomain.replace(emailParts.secondLevelDomain, closestSecondLevelDomain); 1483 rtrn = true; 1484 } 1485 if (closestTopLevelDomain && closestTopLevelDomain != emailParts.topLevelDomain && emailParts.secondLevelDomain !== "") { 1486 closestDomain = closestDomain.replace(new RegExp(emailParts.topLevelDomain + "$"), closestTopLevelDomain); 1487 rtrn = true; 1488 } 1489 if (rtrn) { 1490 return { address: emailParts.address, domain: closestDomain, full: emailParts.address + "@" + closestDomain }; 1491 } 1492 } 1493 return false; 1494 }, 1495 findClosestDomain: function(domain, domains, distanceFunction, threshold) { 1496 threshold = threshold || this.topLevelThreshold; 1497 let dist; 1498 let minDist = Infinity; 1499 let closestDomain = null; 1500 if (!domain || !domains) { 1501 return false; 1502 } 1503 if (!distanceFunction) { 1504 distanceFunction = this.sift4Distance; 1505 } 1506 for (let i = 0; i < domains.length; i++) { 1507 if (domain === domains[i]) { 1508 return domain; 1509 } 1510 dist = distanceFunction(domain, domains[i]); 1511 if (dist < minDist) { 1512 minDist = dist; 1513 closestDomain = domains[i]; 1514 } 1515 } 1516 if (minDist <= threshold && closestDomain !== null) { 1517 return closestDomain; 1518 } else { 1519 return false; 1520 } 1521 }, 1522 sift4Distance: function(s1, s2, maxOffset) { 1523 if (maxOffset === void 0) { 1524 maxOffset = 5; 1525 } 1526 if (!s1 || !s1.length) { 1527 if (!s2) { 1528 return 0; 1529 } 1530 return s2.length; 1531 } 1532 if (!s2 || !s2.length) { 1533 return s1.length; 1534 } 1535 const l1 = s1.length; 1536 const l2 = s2.length; 1537 let c1 = 0; 1538 let c2 = 0; 1539 let lcss = 0; 1540 let local_cs = 0; 1541 let trans = 0; 1542 const offset_arr = []; 1543 while (c1 < l1 && c2 < l2) { 1544 if (s1.charAt(c1) == s2.charAt(c2)) { 1545 local_cs++; 1546 let isTrans = false;
1547 let i = 0; 1548 while (i < offset_arr.length) { 1549 const ofs = offset_arr[i]; 1550 if (c1 <= ofs.c1 || c2 <= ofs.c2) { 1551 isTrans = Math.abs(c2 - c1) >= Math.abs(ofs.c2 - ofs.c1); 1552 if (isTrans) { 1553 trans++; 1554 } else { 1555 if (!ofs.trans) { 1556 ofs.trans = true; 1557 trans++; 1558 } 1559 } 1560 break; 1561 } else { 1562 if (c1 > ofs.c2 && c2 > ofs.c1) { 1563 offset_arr.splice(i, 1); 1564 } else { 1565 i++; 1566 } 1567 } 1568 } 1569 offset_arr.push({ 1570 c1, 1571 c2, 1572 trans: isTrans 1573 }); 1574 } else { 1575 lcss += local_cs; 1576 local_cs = 0; 1577 if (c1 != c2) { 1578 c1 = c2 = Math.min(c1, c2); 1579 } 1580 for (let j = 0; j < maxOffset && (c1 + j < l1 || c2 + j < l2); j++) { 1581 if (c1 + j < l1 && s1.charAt(c1 + j) == s2.charAt(c2)) { 1582 c1 += j - 1; 1583 c2--; 1584 break; 1585 } 1586 if (c2 + j < l2 && s1.charAt(c1) == s2.charAt(c2 + j)) { 1587 c1--; 1588 c2 += j - 1; 1589 break; 1590 } 1591 } 1592 } 1593 c1++; 1594 c2++; 1595 if (c1 >= l1 || c2 >= l2) { 1596 lcss += local_cs; 1597 local_cs = 0; 1598 c1 = c2 = Math.min(c1, c2); 1599 } 1600 } 1601 lcss += local_cs; 1602 return Math.round(Math.max(l1, l2) - lcss + trans); 1603 }, 1604 splitEmail: function(email) { 1605 email = email !== null ? email.replace(/^\s*/, "").replace(/\s*$/, "") : null; 1606 const parts = email.split("@"); 1607 if (parts.length < 2) { 1608 return false; 1609 } 1610 for (let i = 0; i < parts.length; i++) { 1611 if (parts[i] === "") { 1612 return false; 1613 } 1614 } 1615 const domain = parts.pop(); 1616 const domainParts = domain.split("."); 1617 let sld = ""; 1618 let tld = ""; 1619 if (domainParts.length === 0) { 1620 return false; 1621 } else if (domainParts.length == 1) { 1622 tld = domainParts[0]; 1623 } else { 1624 sld = domainParts[0]; 1625 for (let j = 1; j < domainParts.length; j++) { 1626 tld += domainParts[j] + "."; 1627 } 1628 tld = tld.substring(0, tld.length - 1); 1629 } 1630 return { 1631 topLevelDomain: tld, 1632 secondLevelDomain: sld, 1633 domain, 1634 address: parts.join("@") 1635 }; 1636 }, 1637 // Encode the email address to prevent XSS but leave in valid 1638 // characters, following this official spec: 1639 // http://en.wikipedia.org/wiki/Email_address#Syntax 1640 encodeEmail: function(email) { 1641 let result = encodeURI(email); 1642 result = result.replace("%20", " ").replace("%25", "%").replace("%5E", "^").replace("%60", "`").replace("%7B", "{").replace("%7C", "|").replace("%7D", "}"); 1643 return result; 1644 } 1645 }; 1646 if (typeof define === "function" && define.amd) { 1647 define("mailcheck", [], function() { 1648 return Mailcheck; 1649 }); 1650 } 1651 if (typeof window !== "undefined" && window.jQuery) { 1652 ; 1653 (function($4) { 1654 $4.fn.mailcheck = function(opts) { 1655 const self = this; 1656 if (opts.suggested) { 1657 const oldSuggested = opts.suggested; 1658 opts.suggested = function(result) { 1659 oldSuggested(self, result); 1660 }; 1661 } 1662 if (opts.empty) { 1663 const oldEmpty = opts.empty; 1664 opts.empty = function() { 1665 oldEmpty.call(null, self); 1666 }; 1667 } 1668 opts.email = this.val(); 1669 Mailcheck.run(opts); 1670 }; 1671 })(jQuery); 1672 } 1673 } 1674}); 1675
1676// projects/user_pages/app/javascript/lander/submit.ts 1677var submit_exports = {}; 1678__export(submit_exports, { 1679 checkValidInputs: () => checkValidInputs, 1680 restoreButtonState: () => restoreButtonState, 1681 submitPage: () => submitPage 1682}); 1683function restoreButtonState() { 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 previousText = $this.attr("data-before-submit-text"); 1689 const previousSub = $this.attr("data-before-submit-sub"); 1690 const loadingSpinner = $text.parent().find(".elButtonSpinner"); 1691 loadingSpinner.css("display", "none"); 1692 if (previousText) { 1693 $this.removeClass("cf-submitting-page"); 1694 $text.text(previousText); 1695 $subText.text(previousSub); 1696 $this.removeAttr("data-before-submit-text"); 1697 $this.removeAttr("data-before-submit-sub"); 1698 } 1699 }); 1700} 1701function setButtonSubmitText(text, subtext) { 1702 $3('.elBTN a[href="#submit-form"]').each(function() { 1703 const $this = $3(this); 1704 const $text = $this.find(".elButtonMainText"); 1705 const $subText = $this.find(".elButtonSub"); 1706 const submitText = text ?? ($this.attr("data-param-submittingtext")?.length ? $this.attr("data-param-submittingtext") : "Submitting..."); 1707 const dataBeforeSubmit = $this.attr("data-before-submit-text"); 1708 if (!dataBeforeSubmit) { 1709 $this.attr("data-before-submit-text", $text.text()); 1710 $this.attr("data-before-submit-sub", $subText.text()); 1711 $this.addClass("cf-submitting-page"); 1712 } 1713 const loadingSpinner = $this.find(".elButtonSpinner"); 1714 $text.text(`${submitText}`); 1715 $subText.text(subtext ?? ""); 1716 loadingSpinner.css("display", "inline-block"); 1717 }); 1718} 1719async function sleepMs(timeMs) { 1720 return new Promise((resolve) => { 1721 setTimeout(resolve, timeMs); 1722 }); 1723} 1724function getRenderedHref() { 1725 const renderedPage2 = document.querySelector('meta[name="rendered-page-url"]')?.getAttribute("content"); 1726 const renderedPath = renderedPage2 ?? window.location.pathname; 1727 const url = new URL(window.location.href); 1728 url.pathname = renderedPath; 1729 return url.toString(); 1730} 1731function submitRedirectTarget(response) { 1732 const location = response.headers.get("Location"); 1733 if (location && location !== "null" && location !== "undefined") return location; 1734 if (response.redirected && response.url) return response.url; 1735 return null; 1736} 1737async function submitOrderAsync(body, maxRetries = 3, onBeforeSubmit, onRetryAfter) { 1738 let response; 1739 for (let i = 0; i < maxRetries; i++) { 1740 try { 1741 onBeforeSubmit(); 1742 const nonce = await fetchCheckoutNonce(); 1743 const nonceQuery = new URLSearchParams(checkoutNonceParams(nonce)).toString(); 1744 response = await fetch(getRenderedHref(), { 1745 credentials: "same-origin", 1746 method: "post", 1747 body: [body, nonceQuery].filter(Boolean).join("&"), 1748 headers: { 1749 "Content-Type": "application/x-www-form-urlencoded", 1750 "X-CF2-POST-TYPE": "submit" 1751 } 1752 }); 1753 if (response.status === 429) { 1754 const sleepTime = parseInt(response.headers.get("Retry-After")); 1755 onRetryAfter(sleepTime); 1756 console.log(`Waiting on queue, retrying after ${sleepTime}`); 1757 await sleepMs(sleepTime); 1758 } else { 1759 break; 1760 } 1761 } catch (err) { 1762 console.log(err); 1763 await sleepMs(5e3); 1764 } 1765 } 1766 return response; 1767} 1768function submitPage() { 1769 const data = globalThis.processForm(); 1770 $3("#cfAR .purchaseInput").remove(); 1771 data.purchase?.product_variants?.forEach((pv) => { 1772 $3("#cfAR").append( 1773 `<input type="text" class="purchaseInput" name="purchase[product_variants][][id]" value="${pv.id}" />` 1774 ); 1775 $3("#cfAR").append( 1776 `<input type="number" class="purchaseInput" name="purchase[product_variants][][quantity]" value="${pv.quantity}"/>` 1777 ); 1778 $3("#cfAR").append( 1779 `<input type="number" class="purchaseInput" name="purchase[product_variants][][price_id]" value="${pv.price_id}" />` 1780 ); 1781 }); 1782 data.purchase?.coupon_codes?.forEach((couponCode) => { 1783 $3("#cfAR").append( 1784 `<input type="text" class="purchaseInput" name="purchase[coupon_codes][]" value="${couponCode}" />` 1785 ); 1786 }); 1787 $3("#cfAR").append('<input type="text" class="purchaseInput" name="purchase[process_new_order]" value="true" />'); 1788 clearBlankInputFields(); 1789 const formData = [$3("#cfAR").serialize(), `request_idempotency=${uuidv4()}`].join("&"); 1790 let timer = null;
1791 globalThis.CFDispatchEvent(CFEvents.FORM_SUBMITTED, data); 1792 submitOrderAsync( 1793 formData, 1794 3, 1795 () => { 1796 clearInterval(timer); 1797 setButtonSubmitText(); 1798 }, 1799 (sleepTime) => { 1800 let remainingSeconds = sleepTime / 1e3; 1801 clearInterval(timer); 1802 timer = setInterval(() => { 1803 remainingSeconds -= 1; 1804 setButtonSubmitText("Waiting on queue", `(Retrying in ${remainingSeconds}s)`); 1805 }, 1e3); 1806 } 1807 ).then((response) => { 1808 if (response.status == 422) { 1809 response.json().then((responseJson) => { 1810 clearInterval(timer); 1811 window.dispatchEvent( 1812 new CustomEvent("checkout:order-submit-errors", { 1813 detail: { 1814 error: `Failed to submit: ${responseJson.error}` 1815 } 1816 }) 1817 ); 1818 restoreButtonState(); 1819 }); 1820 } else if (response.ok) { 1821 globalThis.CFDispatchEvent(CFEvents.FORM_SUBMITTED_OK, data); 1822 restoreButtonState(); 1823 if (response.headers.get("X-CF2-APPROVAL-URL")) { 1824 const approvalUrl = response.headers.get("X-CF2-APPROVAL-URL"); 1825 const auxWrapper = document.querySelector(".multiple-payment-aux-frame"); 1826 const $auxWrapper = $3(auxWrapper); 1827 const iframe = document.createElement("iframe"); 1828 const orderStautsIframe = "/cf_order_status?disable-dispatch=true"; 1829 iframe.onload = () => { 1830 if (iframe.src.includes(orderStautsIframe)) { 1831 $auxWrapper.css("display", "flex"); 1832 iframe.src = approvalUrl; 1833 } 1834 }; 1835 auxWrapper.innerHTML = ""; 1836 auxWrapper.appendChild(iframe); 1837 iframe.src = orderStautsIframe; 1838 } else { 1839 const isOrder = !!data.purchase; 1840 globalThis.CFDispatchEvent(CFEvents.FORM_SUBMITTED_FINALIZED, data); 1841 window.location.href = isOrder ? response.headers.get("Location") : submitRedirectTarget(response) ?? getRenderedHref(); 1842 } 1843 } else if (response.status === 429) { 1844 clearInterval(timer); 1845 setButtonSubmitText("Failed to submit", "Retry again in a few seconds"); 1846 sleepMs(5e3).then(() => { 1847 window.dispatchEvent(new CustomEvent("payments:submit-failed")); 1848 restoreButtonState(); 1849 }); 1850 } else if (response.status >= 300 && response.status < 400) { 1851 window.location.href = submitRedirectTarget(response) ?? window.location.href; 1852 } else { 1853 window.dispatchEvent(new CustomEvent("checkout:order-submit-errors")); 1854 } 1855 }).catch((err) => { 1856 console.log(err); 1857 clearInterval(timer); 1858 window.dispatchEvent(new CustomEvent("payments:submit-failed")); 1859 restoreButtonState(); 1860 }); 1861} 1862function clearBlankInputFields() { 1863 $3("#cfAR").find("input,select,textarea").each((index, input) => { 1864 if (input.value == "" && !input.classList.contains("keep")) { 1865 input.remove(); 1866 } 1867 }); 1868} 1869function getPurchaseForm() { 1870 const orderCart = window["OrderCart/V1"]?.default; 1871 if (!orderCart) return {}; 1872 const products = orderCart?.productVariants; 1873 const formPurchaseProductVariants = products?.map((product) => { 1874 return { 1875 id: product.id, 1876 price_id: product.priceId, 1877 quantity: product.quantity 1878 }; 1879 }); 1880 const rebillyToken = $3('#cfAR input[data-rebilly="token"]').val(); 1881 return { 1882 purchase: { 1883 product_variants: formPurchaseProductVariants, 1884 rebilly_token: rebillyToken, 1885 coupon_codes: [orderCart?.couponCode].filter(Boolean) 1886 } 1887 }; 1888} 1889function getAppointmentScheduleRequestForm() { 1890 const request = { appointments_schedule_request: {} }; 1891 document.querySelectorAll(".appointment_schedule_request_field").forEach((field) => { 1892 const fieldName = field.getAttribute("name")?.replace("appointment_schedule_request_", ""); 1893 cfARAppendInput(`appointments_schedule_request[${fieldName}]`, field.value, { 1894 param: `appointments_schedule_request[${fieldName}]` 1895 }); 1896 request.appointments_schedule_request[fieldName] = field.value; 1897 }); 1898 document.querySelectorAll(".appointment_schedule_request_options").forEach((group) => { 1899 const name = `appointments_schedule_request[${group.dataset.name}][]`; 1900 const values = Array.from( 1901 group.querySelectorAll(".elCheckboxInput:checked"), 1902 (input) => input.value 1903 ); 1904 $3("#cfAR").find(`input[name="${name}"]`).remove();
1905 values.forEach((value) => cfARAppendInput(name, value)); 1906 request.appointments_schedule_request[group.dataset.name] = values; 1907 }); 1908 const emailField = document.querySelector("[name='email']"); 1909 if (emailField) { 1910 const cfEmailInput = document.querySelector("#cf_contact_email"); 1911 cfEmailInput.value = emailField.value; 1912 } 1913 const guestEmailInputs = document.querySelectorAll("input.guest-input"); 1914 const guestEmailStrings = []; 1915 guestEmailInputs.forEach((i) => guestEmailStrings.push(i.value)); 1916 cfARAppendInput("appointments_schedule_request[guest_emails]", guestEmailStrings.join(",")); 1917 return request; 1918} 1919function getContactForm() { 1920 const data = { contact: {} }; 1921 const writtenCarriers = /* @__PURE__ */ new Set(); 1922 $3('.elFormItem:not([data-prevent-submit="true"])').each(function() { 1923 const $this = $3(this); 1924 if ($this.parents('[data-page-element="Checkout/V2"]').length > 0) return; 1925 let name = $this.attr("name"); 1926 if (name == "" || name == "not-set") return; 1927 if (["country", "state"].includes(name)) { 1928 name = "shipping_" + name; 1929 } 1930 let value = $this.val(); 1931 if (name == "phone_number" && this.iti) { 1932 value = this.iti.getNumber(); 1933 } 1934 if (this.getAttribute("type") == "checkbox") { 1935 if (name.endsWith("[]")) { 1936 const checkboxName = name.slice(0, -2); 1937 if (!data.contact[checkboxName]) { 1938 data.contact[checkboxName] = []; 1939 } 1940 if ($this.is(":checked")) { 1941 data.contact[checkboxName].push(value); 1942 } else { 1943 const index = data.contact[checkboxName].indexOf(value); 1944 if (index > -1) { 1945 data.contact[checkboxName].splice(index, 1); 1946 } 1947 } 1948 return; 1949 } else { 1950 value = $this.is(":checked"); 1951 data.contact[name] = value; 1952 } 1953 } else if (value) { 1954 data.contact[name] = value; 1955 } 1956 const carrierId = contactCarrierInputId(name); 1957 const $contactInput = $3("#" + carrierId); 1958 if ($contactInput.length == 0 && name) { 1959 let customType = name.toLowerCase(); 1960 customType = customType.replace(/\s+/g, "_"); 1961 $3("#cf_contact_" + customType).remove(); 1962 cfARAppendInput(customType, value, { prefix: "cf_contact_" }); 1963 } else { 1964 if ($this.attr("data-prevent-submit") == "true") { 1965 $contactInput.val(""); 1966 } else if (value !== "" || !writtenCarriers.has(carrierId)) { 1967 $contactInput.val(value); 1968 writtenCarriers.add(carrierId); 1969 } 1970 } 1971 }); 1972 return data; 1973} 1974function handleMultiCheckboxForm() { 1975 $3('.elGroupedCheckbox .elFormItem:not([data-prevent-submit="true"])').each(function() { 1976 const $this = $3(this); 1977 const name = $this.attr("name"); 1978 const value = $this.val(); 1979 const checked = $this.is(":checked"); 1980 if (checked && value && !document.querySelector(`#cfAR input[name="${name}"][value="${value}"]`)) { 1981 cfARAppendInput(name, value); 1982 } else if (!document.querySelector(`#cfAR input[name="${name}"]`)) { 1983 cfARAppendInput(name, "", { keep: true }); 1984 } 1985 }); 1986 return {}; 1987} 1988function cfARAppendInput(name, value, options = {}) { 1989 const input = document.createElement("INPUT"); 1990 const prefix = options["prefix"] || "cf_"; 1991 const param = options["param"] || name; 1992 const keep = options["keep"] || false; 1993 input.id = prefix + name; 1994 input.name = name; 1995 input.setAttribute("value", value); 1996 if (keep) { 1997 input.classList.add("keep"); 1998 } 1999 input.setAttribute("data-cf-form-field", name); 2000 input.setAttribute("data-param", param); 2001 input.setAttribute("data-storage", "false"); 2002 $3("#cfAR").append(input); 2003} 2004function validateEmail(email) { 2005 email = $3.trim(email); 2006 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,}))$/; 2007 return re.test(email); 2008} 2009function updateInputStyle(selectedInput, type) { 2010 if (type === "error") { 2011 selectedInput.css("border-color", "#B91517"); 2012 selectedInput.css("border-width", "3px"); 2013 selectedInput.css("border-style", "solid"); 2014 } else { 2015 selectedInput.css("border-color", "#4a8920"); 2016 selectedInput.css("border-width", "3px"); 2017 selectedInput.css("border-style", "solid"); 2018 } 2019} 2020function checkValidInputs() { 2021 const popupVisibleCheck = $3(".modal-wrapper").is(":visible"); 2022 let fail = false;
2023 let elementPathSelector; 2024 if (popupVisibleCheck == true) { 2025 elementPathSelector = '#modalPopup .elFormItem.required1, #modalPopup .elFormItem[name="phone_number"]'; 2026 } else { 2027 elementPathSelector = '.pageRoot .elFormItem.required1, .pageRoot .elFormItem[name="phone_number"]'; 2028 } 2029 $3(elementPathSelector).each(function() { 2030 const $this = $3(this); 2031 const visible = $this.is(":visible"); 2032 const isRequired = $this.hasClass("required1"); 2033 if (visible) { 2034 let value = $this.val(); 2035 const isSelect = $this.is("select"); 2036 if (isSelect) value = $this.find(":selected").attr("value"); 2037 const parent = $this.parents(".elFormItemWrapper"); 2038 const selector = ".inputHolder, .borderHolder, .elCheckbox"; 2039 const selectedInput = parent.length && parent.find(selector).length ? parent.find(selector) : $this; 2040 if (selectedInput.is(":checkbox") ? !selectedInput.is(":checked") : isRequired && (value === null || typeof value === "undefined" || value === "")) { 2041 fail = true; 2042 updateInputStyle(selectedInput, "error"); 2043 } else { 2044 if (selectedInput.attr("name") == "email") { 2045 if (validateEmail(value)) { 2046 updateInputStyle(selectedInput, "valid"); 2047 } else { 2048 fail = true; 2049 updateInputStyle(selectedInput, "error"); 2050 } 2051 } else if (selectedInput.attr("name") == "phone_number" && selectedInput.get(0).iti) { 2052 if (selectedInput.get(0).iti.isValidNumber() || !isRequired && !value) { 2053 updateInputStyle(selectedInput, "valid"); 2054 } else { 2055 fail = true; 2056 updateInputStyle(selectedInput, "error"); 2057 } 2058 } else { 2059 updateInputStyle(selectedInput, "valid"); 2060 } 2061 } 2062 } 2063 }); 2064 if (popupVisibleCheck == true) { 2065 elementPathSelector = "#modalPopup .elGroupedCheckboxWrapper.required1"; 2066 } else { 2067 elementPathSelector = ".pageRoot .elGroupedCheckboxWrapper.required1"; 2068 } 2069 $3(elementPathSelector).each(function() { 2070 const $this = $3(this); 2071 if (!$this.is(":visible")) return; 2072 const $checkboxes = $this.find(".elCheckboxInput"); 2073 const checked = $checkboxes.toArray().some((checkbox) => $3(checkbox).is(":checked")); 2074 if (!checked) fail = true; 2075 updateInputStyle($this, checked ? "valid" : "error"); 2076 }); 2077 return fail == false; 2078} 2079function mailCheck() { 2080 const inputsSelector = Array.from(document.getElementsByName("email")); 2081 inputsSelector.forEach((input, index) => { 2082 const mailCheckNode = document.createElement("div"); 2083 mailCheckNode.classList.add("mailcheck"); 2084 mailCheckNode.classList.add(`index${index}`); 2085 input.parentElement.appendChild(mailCheckNode); 2086 input.addEventListener("blur", function() { 2087 Mailcheck.run({ 2088 email: this.value, 2089 domains: defaultDomains, 2090 secondLevelDomains: defaultSecondLevelDomains, 2091 // optional 2092 topLevelDomains: defaultTopLevelDomains, 2093 // optional 2094 suggested: function(suggestion) { 2095 mailCheckNode.innerHTML = `<span>Did you mean <b>${suggestion.full}?</b></span>`; 2096 }, 2097 empty: function() { 2098 mailCheckNode.innerHTML = ""; 2099 } 2100 }); 2101 }); 2102 }); 2103} 2104function handleEnterSubmit() { 2105 const popupVisibleCheck = $3(".modal-wrapper").is(":visible"); 2106 let buttonsPathSelector; 2107 if (popupVisibleCheck == true) { 2108 buttonsPathSelector = '#modalPopup .elBTN a[href="#submit-form"]:visible'; 2109 } else { 2110 buttonsPathSelector = '.pageRoot .elBTN a[href="#submit-form"]:visible'; 2111 } 2112 const submitButton = $3(buttonsPathSelector).first(); 2113 const now = Date.now(); 2114 if (now - lastSubmitTime < SUBMIT_COOLDOWN) { 2115 return; 2116 } 2117 lastSubmitTime = now; 2118 handleFormSubmit(submitButton); 2119} 2120function setupEnterKeySubmit() { 2121 const inputsPathSelector = ".elFormItem"; 2122 $3(inputsPathSelector).each(function() { 2123 const thisInput = $3(this); 2124 if (thisInput.closest('[data-page-element="Checkout/V1"]').length > 0) { 2125 return true; 2126 } 2127 if (thisInput.closest('[data-page-element="Checkout/V2"]').length > 0) { 2128 return true; 2129 } 2130 thisInput.on("keypress", function(evt) { 2131 if (evt.originalEvent?.isComposing || evt.keyCode === 229) return; 2132 if (evt.key === "Enter") { 2133 handleEnterSubmit(); 2134 } 2135 }); 2136 }); 2137} 2138function setRedirectOverride($button) { 2139 let redirectOverride; 2140 if ($button.parents(".elBTN").length) { 2141 redirectOverride = $button.attr("data-on-submit-go-to"); 2142 } 2143 if (redirectOverride && redirectOverride !== "null" && redirectOverride !== "undefined") { 2144 $3("#cfAR").append(`<input type="text" class="redirectParams" name="redirect_to" value="${redirectOverride}" />`); 2145 } else { 2146 $3("#cfAR .redirectParams").remove(); 2147 } 2148} 2149function handleFormSubmit($button) { 2150 setRedirectOverride($button); 2151 setButtonSubmitText(); 2152 if ($3(".pai-payment-methods-inner:visible").length > 0) { 2153 const $rebillySubmit = $3(".pai-submit"); 2154 const $rebillyForm = $3(".elPAI"); 2155 if ($rebillySubmit.length) { 2156 $rebillySubmit.trigger("click"); 2157 return; 2158 } else if ($rebillyForm.length) { 2159 rebillyProcessOrder(); 2160 return; 2161 } else if (!checkValidInputs()) { 2162 restoreButtonState(); 2163 return; 2164 } 2165 } 2166 if (checkValidInputs()) { 2167 submitPage(); 2168 } else { 2169 restoreButtonState(); 2170 } 2171 return true; 2172} 2173var $3, lastSubmitTime, SUBMIT_COOLDOWN; 2174var init_submit = __esm({ 2175 "projects/user_pages/app/javascript/lander/submit.ts"() { 2176 init_define_process(); 2177 init_rebilly_element(); 2178 init_contact_fields(); 2179 init_nonce(); 2180 init_cf_utils(); 2181 init_domains(); 2182 init_main(); 2183 $3 = window.$; 2184 globalThis.processForm = function() { 2185 return { 2186 ...getPurchaseForm(), 2187 ...getContactForm(), 2188 ...handleMultiCheckboxForm(),
2189 ...getAppointmentScheduleRequestForm() 2190 }; 2191 }; 2192 globalThis.submitPage = submitPage; 2193 lastSubmitTime = 0; 2194 SUBMIT_COOLDOWN = 1e3; 2195 globalThis.handleFormSubmit = handleFormSubmit; 2196 globalThis.setButtonSubmitText = setButtonSubmitText; 2197 globalThis.restoreButtonState = restoreButtonState; 2198 globalThis.setRedirectOverride = setRedirectOverride; 2199 globalThis.clearBlankInputFields = clearBlankInputFields; 2200 window.addEventListener("DOMContentLoaded", function() { 2201 mailCheck(); 2202 setupEnterKeySubmit(); 2203 $3(document).on("click", '[href="#submit-form"],[data-element-link="#submit-form"]', function() { 2204 const $button = $3(this); 2205 if ($button.closest('[data-page-element="Checkout/V1"]').length == 0) { 2206 handleFormSubmit($button); 2207 } 2208 }); 2209 }); 2210 } 2211}); 2212
2213// projects/user_pages/app/javascript/lander/rebilly_element.ts 2214var rebilly_element_exports = {}; 2215__export(rebilly_element_exports, { 2216 rebillyProcessOrder: () => rebillyProcessOrder 2217}); 2218function leadSourceGenerator() { 2219 const DEFAULT_MAX_CHARS_LENGTH = 512; 2220 const leadQueryParamMapping = { 2221 utm_source: { 2222 name: "source" 2223 }, 2224 utm_medium: { 2225 name: "medium" 2226 }, 2227 utm_campaign: { 2228 name: "campaign" 2229 }, 2230 utm_term: { 2231 name: "term" 2232 }, 2233 utm_content: { 2234 name: "content" 2235 }, 2236 affiliate: {}, 2237 subAffiliate: {}, 2238 clickId: {}, 2239 salesAgent: {} 2240 }; 2241 const params = new URLSearchParams(window.location.search); 2242 return Array.from(params.keys()).reduce((acc, key) => { 2243 const mappedValue = leadQueryParamMapping[key]; 2244 if (mappedValue) { 2245 const paramValue = params.get(key); 2246 const leadSourceName = mappedValue.name ?? key; 2247 acc[leadSourceName] = paramValue.substring(0, DEFAULT_MAX_CHARS_LENGTH); 2248 } 2249 return acc; 2250 }, {}); 2251} 2252var scrollToForm, rebillyProcessOrder; 2253var init_rebilly_element = __esm({ 2254 "projects/user_pages/app/javascript/lander/rebilly_element.ts"() { 2255 init_define_process(); 2256 init_submit(); 2257 scrollToForm = () => { 2258 if (!$(".elPAI").length) return; 2259 $([document.documentElement, document.body]).animate({ scrollTop: $(".elPAI").offset().top - 50 }, 200); 2260 }; 2261 globalThis.addEventListener("DOMContentLoad", function() { 2262 $(document).on("change", ".elInput", function() { 2263 globalThis.processForm(); 2264 }); 2265 window.addEventListener("payments:token-ready", () => { 2266 globalThis.processForm(); 2267 if (!checkValidInputs()) { 2268 restoreButtonState(); 2269 scrollToForm(); 2270 this.window.dispatchEvent(new CustomEvent("payments:submit-failed")); 2271 return; 2272 } 2273 submitPage(); 2274 }); 2275 }); 2276 rebillyProcessOrder = () => { 2277 const Rebilly = globalThis.Rebilly; 2278 let extraData = { 2279 method: globalThis.paymentsSelectedPaymentMethod 2280 }; 2281 const leadSource = leadSourceGenerator(); 2282 if (Object.keys(leadSource).length) { 2283 extraData = { ...extraData, leadSource }; 2284 } 2285 const form = document.querySelector("#cfAR"); 2286 window.dispatchEvent(new CustomEvent("payments:clear-errors")); 2287 globalThis.processForm(); 2288 if (!checkValidInputs()) { 2289 restoreButtonState(); 2290 scrollToForm(); 2291 window.dispatchEvent(new CustomEvent("payments:submit-failed")); 2292 return; 2293 } 2294 Rebilly.createToken(form, extraData).then(function(result) { 2295 console.log("Framepay success", result); 2296 globalThis.parent.postMessage("success", "*"); 2297 submitPage(); 2298 }).catch(function(error) { 2299 console.log("Framepay error", error); 2300 globalThis.parent.postMessage("error", "*"); 2301 form.querySelector('input[data-rebilly="token"]').value = ""; 2302 window.dispatchEvent( 2303 new CustomEvent("payments:set-token-error", { 2304 detail: { 2305 error 2306 } 2307 }) 2308 ); 2309 restoreButtonState(); 2310 scrollToForm(); 2311 window.dispatchEvent(new CustomEvent("payments:submit-failed")); 2312 }); 2313 }; 2314 globalThis.rebillyProcessOrder = rebillyProcessOrder; 2315 globalThis.scrollToForm = scrollToForm; 2316 } 2317}); 2318
2319// projects/user_pages/app/javascript/lander/upsell_element.js 2320var upsell_element_exports = {}; 2321__export(upsell_element_exports, { 2322 submitUpsellOrder: () => submitUpsellOrder 2323}); 2324var submitUpsellOrder; 2325var init_upsell_element = __esm({ 2326 "projects/user_pages/app/javascript/lander/upsell_element.js"() { 2327 init_define_process(); 2328 init_submit(); 2329 (function() { 2330 window.addEventListener("load", function() { 2331 $(document).on("click", "#upsell-submit-button", function(event) { 2332 event.preventDefault(); 2333 submitUpsellOrder(); 2334 }); 2335 }); 2336 })(); 2337 submitUpsellOrder = () => { 2338 $("#cfAR input[data-order-form]").val(true); 2339 submitPage(); 2340 }; 2341 } 2342}); 2343
2344// projects/user_pages/app/javascript/lander/order/main.ts 2345var main_exports = {}; 2346var init_main2 = __esm({ 2347 "projects/user_pages/app/javascript/lander/order/main.ts"() { 2348 init_define_process(); 2349 (function() { 2350 window.addEventListener("load", function() { 2351 const orderCart = window["OrderCart/V1"]?.default; 2352 let previousRadioProductVariant; 2353 document.querySelectorAll(".elOrderSelect").forEach(function(orderSelect) { 2354 const type = orderSelect.getAttribute("data-order-select-type"); 2355 if (type == "single") { 2356 const firstInput = orderSelect.querySelector('input[type="radio"]'); 2357 if (firstInput) { 2358 firstInput.checked = true; 2359 } 2360 const newProductVariant = orderCart.getProductVariant(firstInput, "single"); 2361 previousRadioProductVariant = newProductVariant; 2362 orderCart.updateProductVariant(newProductVariant); 2363 } 2364 }); 2365 $(document).on("change", '.elOrderSelect input[type="radio"]', function(event) { 2366 const input = event.target; 2367 $(`.elOrderSelect input[type="radio"][value=${input.value}]`).prop("checked", true); 2368 const newProductVariant = orderCart.getProductVariant(input, "single"); 2369 if (previousRadioProductVariant) { 2370 orderCart.incrementProductVariantQuantity(previousRadioProductVariant, -1); 2371 } 2372 orderCart.updateProductVariant(newProductVariant); 2373 previousRadioProductVariant = newProductVariant; 2374 }); 2375 $(document).on("change", '.elOrderSelect input[type="number"]', function(event) { 2376 const input = event.target; 2377 const productVariantId = input.getAttribute("data-product-variant-id"); 2378 const quantity = input.value; 2379 $(`.elOrderSelect input[type="number"][data-product-variant-id="${productVariantId}"]`).val(quantity); 2380 const productVariant = orderCart.getProductVariant(input, "multiple"); 2381 orderCart.updateProductVariant(productVariant); 2382 }); 2383 $(document).on("change", ".elOrderProductOptionsPrice select", function(event) { 2384 const priceSelect = event.target; 2385 const productVariantId = priceSelect.getAttribute("data-product-variant-id"); 2386 const priceId = priceSelect.value; 2387 const priceCents = priceSelect.querySelector(`option[value="${priceId}"`).getAttribute("data-product-variant-price-cents"); 2388 const orderSelectType = document.querySelector(".elOrderSelect").getAttribute("data-order-select-type"); 2389 const orderSelectInputType = orderSelectType == "single" ? "radio" : "number"; 2390 const productVariantInput = document.querySelector( 2391 `.elOrderSelect input[type="${orderSelectInputType}"][data-product-variant-id="${productVariantId}"]` 2392 ); 2393 productVariantInput.setAttribute("data-product-variant-price-id", priceId); 2394 productVariantInput.setAttribute("data-product-variant-price-cents", priceCents); 2395 if (orderSelectType == "single" && !productVariantInput.checked) return; 2396 const productVariant = orderCart.getProductVariant(productVariantInput, orderSelectType); 2397 orderCart.updateProductVariant(productVariant); 2398 }); 2399 $(document).on("change", ".elOrderBump input", function(event) { 2400 const input = event.target; 2401 const productVariant = orderCart.getProductVariant(input); 2402 orderCart.updateProductVariant(productVariant); 2403 }); 2404 $(document).on("change", ".elOrderBump select", function(event) { 2405 const select = event.target; 2406 const productId = select.getAttribute("data-product-id"); 2407 const selectedOption = select.querySelector(`option[value="${select.value}"]`); 2408 const productInput = document.querySelector( 2409 `.elOrderBump input[data-product-id="${productId}"]` 2410 ); 2411 const variantAttrs = ["id", "name", "price-id", "price-cents", "price-currency"]; 2412 variantAttrs.forEach(function(variantAttr) { 2413 productInput.setAttribute( 2414 `data-product-variant-${variantAttr}`, 2415 selectedOption.getAttribute(`data-product-variant-${variantAttr}`) 2416 ); 2417 }); 2418 if (!productInput.checked) return; 2419 const productVariant = orderCart.getProductVariant(productInput); 2420 orderCart.updateProductVariant(productVariant); 2421 }); 2422 $(document).on("click", ".elOrderCoupon button", function() { 2423 const input = document.querySelector(".elOrderCoupon input"); 2424 orderCart.updateCouponCode(input.value); 2425 }); 2426 document.querySelectorAll(".elOrderCoupon input[readonly]").forEach(function(element) { 2427 element.removeAttribute("readonly"); 2428 }); 2429 }); 2430 })(); 2431 } 2432}); 2433
2434// projects/user_pages/app/javascript/lander/utils/action_matching.ts 2435function matchesAction(element, action) { 2436 const link = element.getAttribute("data-element-link"); 2437 if (link !== null) return link === action; 2438 const { hash, origin, pathname } = element; 2439 return hash === action && origin === window.location.origin && pathname === window.location.pathname; 2440} 2441var init_action_matching = __esm({ 2442 "projects/user_pages/app/javascript/lander/utils/action_matching.ts"() { 2443 init_define_process(); 2444 } 2445}); 2446
2447// projects/user_pages/app/javascript/lander/action_link.ts 2448var action_link_exports = {}; 2449function setupActionLinkListeners() { 2450 $(document).on("click", "[data-element-link='#print'], a[href$='#print']", function(evt) { 2451 if (!matchesAction(evt.currentTarget, "#print")) return; 2452 window.print(); 2453 return false; 2454 }); 2455 $(document).on("click", "[data-element-link='#open-popup'], a[href$='#open-popup']", function(evt) { 2456 if (!matchesAction(evt.currentTarget, "#open-popup")) return; 2457 evt.preventDefault(); 2458 const checkIfShowHide = evt.target.parentElement?.getAttribute("data-elbuttontype"); 2459 if (typeof checkIfShowHide == "undefined" || !["2", "showHide"].includes(checkIfShowHide)) { 2460 globalThis.CFOpenPopup(); 2461 } 2462 }); 2463 $(document).on("click", "[data-element-link='#close-popup'], a[href$='#close-popup']", function(evt) { 2464 if (!matchesAction(evt.currentTarget, "#close-popup")) return; 2465 evt.preventDefault(); 2466 globalThis.CFClosePopup(); 2467 }); 2468 $(document).on("click", "a[href*='#scroll-'], [data-element-link*='#scroll-']", function(evt) { 2469 const href = evt.currentTarget.getAttribute("href") ?? ""; 2470 const [, id] = href.split("#scroll-"); 2471 if (id) { 2472 if (isWithinCustomerCenterView()) { 2473 const el = document.querySelector(`.${id}`); 2474 const mainElement = window.parent.document.body.querySelector("main"); 2475 if (el && mainElement) { 2476 mainElement.scrollTo({ top: $(el).offset().top, behavior: "smooth" }); 2477 } 2478 } else { 2479 const el = document.querySelector(`.${id}`); 2480 const popupParent = el?.closest(".modal-wrapper"); 2481 const scrollContainer = popupParent || document.documentElement; 2482 if (el && scrollContainer) { 2483 scrollContainer.scrollTo({ top: $(el).offset().top, behavior: "smooth" }); 2484 } 2485 } 2486 } 2487 return false; 2488 }); 2489 const getElementsIds = (evt, type) => (evt.currentTarget.getAttribute(`data-${type}-button-ids`) || "").split(",").filter((s) => s); 2490 const performActionOnId = (id, action) => { 2491 const $el = $(`.${id}`); 2492 if ($el.attr("data-show-only") && action === "fadeIn") { 2493 $el.removeAttr("data-show-only"); 2494 $el.css("display", "none"); 2495 } 2496 $el[action]({ duration: 500 }); 2497 }; 2498 $(document).on("click", "a[href*='#show-hide'], [data-element-link*='#show-hide']", function(evt) { 2499 evt.preventDefault(); 2500 const hideIds = getElementsIds(evt, "hide"); 2501 const showIds = getElementsIds(evt, "show"); 2502 hideIds.forEach((id) => performActionOnId(id, "fadeOut")); 2503 showIds.forEach((id) => performActionOnId(id, "fadeIn")); 2504 return false; 2505 }); 2506 $(document).on("click", "a[href=''], [data-element-link='']", function(evt) { 2507 evt.preventDefault(); 2508 return false; 2509 }); 2510 $(document).on("click", "[data-element-link]", function(evt) { 2511 evt.preventDefault(); 2512 const linkableElement = evt.currentTarget; 2513 const link = linkableElement.getAttribute("data-element-link"); 2514 if (link && !internalLinks.includes(link)) { 2515 const target = linkableElement.getAttribute("target") ?? "_self"; 2516 if (target === "_self") { 2517 window.location.href = link; 2518 } else { 2519 window.open(link, "_blank"); 2520 } 2521 } 2522 }); 2523 $(document).on("click", "a[href^='#download-asset:']", function(evt) { 2524 evt.preventDefault(); 2525 const id = evt.currentTarget.getAttribute("href").replace("#download-asset:", ""); 2526 window.location.href = `/account/downloads/${id}/file`; 2527 return false; 2528 }); 2529 $(document).on("click", "a[href^='#download-inline:']", function(evt) { 2530 evt.preventDefault(); 2531 const id = evt.currentTarget.getAttribute("href").replace("#download-inline:", ""); 2532 window.open(`/account/downloads/${id}/preview`, "_blank"); 2533 return false; 2534 }); 2535 $(document).on("click", "a[href*='#no-link'], [data-element-link*='#no-link']", function(evt) { 2536 evt.preventDefault(); 2537 const urlParams = new URLSearchParams(window.location.search); 2538 urlParams.set("next_funnel_step", "true"); 2539 window.location.href = `${window.location.pathname}?${urlParams}`; 2540 }); 2541 document.querySelectorAll("[data-element-link]").forEach((linkableElement) => { 2542 if (linkableElement.getAttribute("data-element-link")) linkableElement.setAttribute("tabindex", "0"); 2543 }); 2544} 2545var internalLinks; 2546var init_action_link = __esm({ 2547 "projects/user_pages/app/javascript/lander/action_link.ts"() { 2548 init_define_process(); 2549 init_cf_utils(); 2550 init_action_matching(); 2551 internalLinks = [ 2552 "#open-popup", 2553 "#close-popup", 2554 "#submit-form", 2555 "#scroll", 2556 "#print", 2557 "#show-hide", 2558 "#download-asset", 2559 "#download-inline" 2560 ]; 2561 window.addEventListener("DOMContentLoaded", setupActionLinkListeners); 2562 } 2563}); 2564
2565// projects/user_pages/app/javascript/lander/animation.ts 2566var require_animation = __commonJS({ 2567 "projects/user_pages/app/javascript/lander/animation.ts"() { 2568 init_define_process(); 2569 var unobserve = (element, observer) => { 2570 observer.unobserve(element); 2571 if (element.getAttribute("data-animation-once") !== "true") { 2572 const time = element.getAttribute("data-animation-time"); 2573 const delay = element.getAttribute("data-animation-delay"); 2574 const timeout = Number(time) + Number(delay); 2575 setTimeout(() => { 2576 observer.observe(element); 2577 }, timeout); 2578 } 2579 }; 2580 var startAnimation = (element) => { 2581 element.setAttribute("data-animation-state", "running"); 2582 }; 2583 var params = new URLSearchParams(window.location.search); 2584 var disabledAnimations = params.get("animations") == "skip"; 2585 window.addEventListener("DOMContentLoaded", function() { 2586 if (disabledAnimations) { 2587 const allAnimatedElements = document.querySelectorAll("[data-animation-type]"); 2588 allAnimatedElements.forEach((el) => { 2589 el.setAttribute("data-animation-type", "none"); 2590 }); 2591 } 2592 }); 2593 var setupStyleGuideAnimatedNodes = () => { 2594 if (disabledAnimations) return; 2595 const styleGuideAnimationNode = JSON.parse( 2596 document.getElementById("cf-lander-serialized-style-guide-animation-node")?.textContent ?? "{}" 2597 ); 2598 document.querySelectorAll("[data-style-guide-animation]").forEach((element) => { 2599 const style = element.getAttribute("data-style-guide-animation"); 2600 const selectedAnimation = styleGuideAnimationNode.selectors[`.elPageContent [data-style-guide-animation="${style}"]`]; 2601 element.setAttribute("data-animation-type", selectedAnimation.attrs["data-animation-type"]); 2602 element.setAttribute("data-animation-trigger", selectedAnimation.attrs["data-animation-trigger"]); 2603 }); 2604 }; 2605 $(document).ready(function() { 2606 const runAllAnimations = function() { 2607 setupStyleGuideAnimatedNodes(); 2608 const scrollElements = document.querySelectorAll('[data-animation-trigger="scroll"]'); 2609 const loadElements = document.querySelectorAll('[data-animation-trigger="load"]'); 2610 const config2 = { 2611 rootMargin: "50px 20px 75px 30px", 2612 threshold: [0, 0.25, 0.75, 1] 2613 }; 2614 const observer = new IntersectionObserver((entries) => { 2615 entries.forEach((entry) => { 2616 if (entry.isIntersecting) { 2617 if (entry.target.getAttribute("data-animation-state") !== "running") { 2618 unobserve(entry.target, observer); 2619 startAnimation(entry.target); 2620 } 2621 } else { 2622 entry.target.setAttribute("data-animation-state", "off"); 2623 } 2624 }); 2625 }, config2); 2626 scrollElements.forEach((element) => { 2627 observer.observe(element); 2628 }); 2629 loadElements.forEach((element) => { 2630 startAnimation(element); 2631 }); 2632 }; 2633 if (!disabledAnimations) runAllAnimations(); 2634 }); 2635 } 2636}); 2637
2638// projects/user_pages/app/javascript/lander/sticky.ts 2639var require_sticky = __commonJS({ 2640 "projects/user_pages/app/javascript/lander/sticky.ts"() { 2641 init_define_process(); 2642 var STUCK_CLASS = "stickyClone"; 2643 function createPlaceholder() { 2644 return $("<div>").addClass("stickyPlaceholder").attr("aria-hidden", "true"); 2645 } 2646 function sizePlaceholder(sticky, placeholder) { 2647 const height = sticky.outerHeight() ?? 0; 2648 placeholder.css({ 2649 boxSizing: "border-box", 2650 height, 2651 marginTop: sticky.css("marginTop"), 2652 marginBottom: sticky.css("marginBottom") 2653 }); 2654 return height; 2655 } 2656 $(document).ready(function() { 2657 const $stickyElements = $(".stickyTop"); 2658 $stickyElements.each((_index, element) => { 2659 const sticky = $(element); 2660 const placeholder = createPlaceholder(); 2661 let stuck = false; 2662 let flowHeight = 0; 2663 const hasBox = () => element.getClientRects().length > 0; 2664 const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => { 2665 if (stuck) placeholder.css("height", Math.max(flowHeight, sticky.outerHeight() ?? 0)); 2666 }); 2667 const pin = () => { 2668 flowHeight = sizePlaceholder(sticky, placeholder); 2669 placeholder.insertBefore(sticky); 2670 sticky.addClass(STUCK_CLASS); 2671 stuck = true; 2672 resizeObserver?.observe(element); 2673 }; 2674 const unpin = () => { 2675 resizeObserver?.unobserve(element); 2676 sticky.removeClass(STUCK_CLASS); 2677 placeholder.detach(); 2678 stuck = false; 2679 }; 2680 const stickyTop = () => stuck ? placeholder.offset().top : sticky.offset().top; 2681 if (hasBox() && $(window).scrollTop() > stickyTop()) { 2682 pin(); 2683 } 2684 document.addEventListener("scroll", () => { 2685 const scrollTop = $(window).scrollTop(); 2686 if (!stuck && hasBox() && scrollTop >= stickyTop()) { 2687 pin(); 2688 } else if (stuck && scrollTop < stickyTop()) { 2689 unpin(); 2690 } 2691 }); 2692 }); 2693 }); 2694 } 2695}); 2696
2697// projects/user_pages/app/javascript/lander.js 2698var require_lander = __commonJS({ 2699 "projects/user_pages/app/javascript/lander.js"() { 2700 init_define_process(); 2701 require_replace_tag(); 2702 init_fetcher(); 2703 require_parseurl(); 2704 require_audio_player(); 2705 require_garlic_cf(); 2706 init_populate_select(); 2707 require_runtime_events(); 2708 init_fhl_handle_select_transformation(); 2709 init_track_events(); 2710 init_resource_sharing_concern(); 2711 init_rebilly_element(); 2712 init_upsell_element(); 2713 init_main2(); 2714 init_runtime(); 2715 init_action_link(); 2716 require_animation(); 2717 init_submit(); 2718 require_sticky(); 2719 window.nanostores = (init_nanostores(), __toCommonJS(nanostores_exports)); 2720 var originalFetch = window.fetch; 2721 window.inflightRequests = 0; 2722 window.fetch = async (request, init) => { 2723 window.inflightRequests++; 2724 try { 2725 const rendered_page_url = document.querySelector('meta[name="rendered-page-url"]')?.getAttribute("content"); 2726 if (rendered_page_url) { 2727 const url = new URL(new Request(request).url); 2728 if (url.hostname == window.location.hostname) { 2729 init = init || {}; 2730 if (!init.headers) init.headers = {}; 2731 init.headers["X-Rendered-Page-Url"] = rendered_page_url; 2732 } 2733 } 2734 } catch (e) { 2735 console.error("Failed to set X-Rendered-Page-Url header", e); 2736 } 2737 return originalFetch(request, init).finally(() => { 2738 window.inflightRequests--; 2739 }); 2740 }; 2741 $(window).on("DOMContentLoaded", function() { 2742 $('.elFormItem:not([data-prevent-garlic="true"])').each(function() { 2743 let onPersist = () => { 2744 }; 2745 if (this.getAttribute("name") == "name") { 2746 onPersist = () => { 2747 const value = this.value.trim(); 2748 const firstName = value.split(" ")[0]; 2749 const lastName = value.split(" ").slice(1).join(" "); 2750 window.cfGarlicUtils.store("first_name", firstName); 2751 window.cfGarlicUtils.store("last_name", lastName); 2752 }; 2753 } else if (this.getAttribute("name") == "phone_number") { 2754 onPersist = () => { 2755 if (!this.iti?.isValidNumber()) return; 2756 const value = this.iti?.getNumber() ?? this.value.trim(); 2757 window.cfGarlicUtils.store("phone_number", value); 2758 }; 2759 } 2760 $(this).garlic({ 2761 onPersist, 2762 onRetrieve: function($el, retrievedValue) { 2763 const elemName = $el.attr("name"); 2764 globalThis.CFGarlicValues[elemName] = retrievedValue; 2765 $el.each((_, element) => { 2766 const closestBlueprintInstance = element.closest("[data-page-element]")?.cf2_instance; 2767 if (closestBlueprintInstance && closestBlueprintInstance.update) { 2768 closestBlueprintInstance.update(retrievedValue); 2769 } 2770 }); 2771 } 2772 }); 2773 }); 2774 }); 2775 } 2776}); 2777
2778// projects/shared/stylesheets/page-content/main.scss 2779var init_main3 = __esm({ 2780 "projects/shared/stylesheets/page-content/main.scss"() { 2781 } 2782}); 2783
2784// projects/shared/stylesheets/bootstrap-modal.min.css 2785var init_bootstrap_modal_min = __esm({ 2786 "projects/shared/stylesheets/bootstrap-modal.min.css"() { 2787 } 2788}); 2789
2790// projects/user_pages/app/stylesheets/core.css 2791var init_core = __esm({ 2792 "projects/user_pages/app/stylesheets/core.css"() { 2793 } 2794}); 2795
2796// projects/user_pages/app/stylesheets/mediaelementplayer-custom.css 2797var init_mediaelementplayer_custom = __esm({ 2798 "projects/user_pages/app/stylesheets/mediaelementplayer-custom.css"() { 2799 } 2800}); 2801
2802// projects/user_pages/app/stylesheets/alert_messages.scss 2803var init_alert_messages = __esm({ 2804 "projects/user_pages/app/stylesheets/alert_messages.scss"() { 2805 } 2806}); 2807
2808// projects/lib/packages/yggdrasil-blueprints/__generated__/dist/systemBluprints.min.css 2809var init_systemBluprints_min = __esm({ 2810 "projects/lib/packages/yggdrasil-blueprints/__generated__/dist/systemBluprints.min.css"() { 2811 } 2812}); 2813
2814// projects/user_pages/app/javascript/lander_styles.js 2815var lander_styles_exports = {}; 2816var init_lander_styles = __esm({ 2817 "projects/user_pages/app/javascript/lander_styles.js"() { 2818 init_define_process(); 2819 init_main3(); 2820 init_bootstrap_modal_min(); 2821 init_core(); 2822 init_mediaelementplayer_custom(); 2823 init_alert_messages(); 2824 init_systemBluprints_min(); 2825 } 2826}); 2827
2828// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/content-node.ts 2829var ContentNode; 2830var init_content_node = __esm({ 2831 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/content-node.ts"() { 2832 init_define_process(); 2833 init_runtime(); 2834 ContentNode = class extends CF2Component { 2835 constructor(el, runtimeSel) { 2836 super(el, runtimeSel); 2837 } 2838 mount(el) { 2839 this.syncSameNameInputs(); 2840 } 2841 syncSameNameInputs() { 2842 const formInputs = document.querySelectorAll(".elFormItem[name]"); 2843 formInputs.forEach((input) => { 2844 const inputName = input.name; 2845 input.addEventListener("change", () => { 2846 if (input.type === "checkbox" || input.type === "radio") { 2847 const inputValue = input.value; 2848 const otherInputs = document.querySelectorAll( 2849 `.elFormItem.elInput[name="${inputName}"][value="${inputValue}"]` 2850 ); 2851 otherInputs.forEach((otherInput) => { 2852 otherInput.checked = input.checked; 2853 }); 2854 } else { 2855 const otherInputs = document.querySelectorAll( 2856 `.elFormItem.elInput[name="${inputName}"]` 2857 ); 2858 otherInputs.forEach((otherInput) => { 2859 otherInput.value = input.value; 2860 }); 2861 } 2862 }); 2863 }); 2864 } 2865 }; 2866 registerComponent("ContentNode", ContentNode); 2867 window["ContentNode"] = ContentNode; 2868 } 2869}); 2870
2871// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/modal-container-v1.ts 2872var ModalContainerV1; 2873var init_modal_container_v1 = __esm({ 2874 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/modal-container-v1.ts"() { 2875 init_define_process(); 2876 init_modal_v1(); 2877 init_runtime(); 2878 ModalContainerV1 = class extends CF2Component { 2879 constructor(el, runtimeSel) { 2880 super(el, runtimeSel); 2881 } 2882 mount() { 2883 this.isAudioInitialized = false; 2884 this.modal = this.getComponent("Modal/V1"); 2885 this.videoElements = this.getComponents("Video/V1"); 2886 this.modalElement = this.modal.element; 2887 this.containerModal = document.getElementById("modalPopup"); 2888 this.showOnExit = this.containerModal.getAttribute("data-show-popup-on-exit") === "true"; 2889 this.showOnLoad = this.containerModal.getAttribute("data-show-popup-on-page-load") === "true"; 2890 this.showWhenElementIsVisible = this.element.getAttribute("data-selected-element"); 2891 this.closeButton = this.element.querySelector(".closeLPModal"); 2892 if (this.showWhenElementIsVisible) { 2893 const visibleElementSelector = this.showWhenElementIsVisible.startsWith("id-") ? `.${this.showWhenElementIsVisible}` : `.id-${this.showWhenElementIsVisible}`; 2894 this.visibleElement = document.querySelector(visibleElementSelector); 2895 } 2896 const self = this; 2897 this.modal.close = function() { 2898 handleModalClose(); 2899 }; 2900 if (this.visibleElement) { 2901 handleShowWhenElementIsVisible(this.visibleElement); 2902 } 2903 if (this.showOnExit) { 2904 handleShowOnExit(); 2905 } 2906 if (this.showOnLoad) { 2907 if (this.showOnLoadDelay) { 2908 setTimeout(() => { 2909 handleModalOpen(); 2910 }, this.showOnLoadDelay); 2911 } else { 2912 handleModalOpen(); 2913 } 2914 } 2915 function handleModalOpen() { 2916 const containerModal = self.containerModal; 2917 const modalElement = self.modalElement; 2918 const closeButton = self.closeButton; 2919 const scrollY = window.scrollY; 2920 $(containerModal).show(); 2921 $(containerModal).css("top", -800); 2922 $(closeButton).css("top", -800); 2923 $(containerModal).addClass("popup-relative-position"); 2924 $("html").addClass("hide-page-scroll"); 2925 $("body").css("position", "fixed"); 2926 $("body").css("top", `-${scrollY}px`); 2927 $("body").css("width", "100%"); 2928 $(modalElement).show(); 2929 if (!self.isAudioInitialized) { 2930 self.isAudioInitialized = true; 2931 setupAudioElements(); 2932 } 2933 $(modalElement).css({ 2934 opacity: 1, 2935 top: 0 2936 }); 2937 $(containerModal).animate( 2938 { 2939 opacity: 1, 2940 top: 0 2941 }, 2942 { 2943 duration: 200 2944 } 2945 ); 2946 $(closeButton).animate({ top: -20 }, { duration: 200 }); 2947 } 2948 function handleModalClose() { 2949 const containerModal = self.containerModal; 2950 const modalElement = self.modalElement; 2951 const closeButton = self.closeButton; 2952 const scrollY = $("body").css("top"); 2953 $(closeButton).animate({ top: -800 }, { duration: 200 }); 2954 $(containerModal).animate( 2955 { 2956 opacity: 0, 2957 top: -800 2958 }, 2959 { 2960 duration: 200, 2961 complete: function() { 2962 $(modalElement).css({ 2963 opacity: 0, 2964 top: -800 2965 }); 2966 $(modalElement).hide(); 2967 $(containerModal).hide(); 2968 $(containerModal).removeClass("popup-relative-position"); 2969 } 2970 } 2971 ); 2972 $("html").removeClass("hide-page-scroll"); 2973 $("body").css("position", ""); 2974 $("body").css("top", ""); 2975 $("body").css("width", ""); 2976 if (scrollY) { 2977 window.scrollTo(0, parseInt(scrollY || "0", 10) * -1); 2978 } 2979 } 2980 function handleShowWhenElementIsVisible() { 2981 const config2 = { 2982 rootMargin: "50px 20px 75px 30px", 2983 threshold: [0, 0.25, 0.75, 1] 2984 }; 2985 const observer = new IntersectionObserver((entries) => {
2986 entries.forEach((entry) => { 2987 if (entry.isIntersecting) { 2988 observer.unobserve(entry.target, observer); 2989 handleModalOpen(); 2990 } 2991 }); 2992 }, config2); 2993 observer.observe(self.visibleElement); 2994 } 2995 function handleShowOnExit() { 2996 let cfMouseP = 0; 2997 const modalElement = self.modalElement; 2998 const handleMouseMove = (evt) => { 2999 cfMouseP = evt.clientY; 3000 }; 3001 const handleMouseLeave = () => { 3002 if (cfMouseP <= 40) { 3003 if (!$(modalElement).is(":visible")) { 3004 handleModalOpen(); 3005 document.querySelector("body").removeEventListener("mouseleave", handleMouseLeave); 3006 document.querySelector("body").removeEventListener("mousemove", handleMouseMove); 3007 } 3008 } 3009 }; 3010 document.querySelector("body").addEventListener("mousemove", handleMouseMove); 3011 document.querySelector("body").addEventListener("mouseleave", handleMouseLeave); 3012 } 3013 function setupAudioElements() { 3014 const audioElements = $(".containerModal .elAudioWrapper"); 3015 try { 3016 audioElements.each(function() { 3017 const $this = $(this); 3018 const audioURL = $this.attr("data-audio-url") || "https://images.clickfunnels.com/images/SevenNationArmy.mp3"; 3019 const loop = $this.attr("data-audio-loop") || "no"; 3020 const playerOptions = { 3021 class: "elAudioElement", 3022 audioWidth: "100%", 3023 audioHeight: "100%", 3024 enableAutosize: true, 3025 enableProgressTooltip: false, 3026 loop: loop === "yes", 3027 features: [ 3028 "playpause", 3029 "current", 3030 "progress", 3031 "duration", 3032 "volume" 3033 ] 3034 }; 3035 const audio = $(this).find("audio"); 3036 audio.attr("src", audioURL); 3037 audio.mediaelementplayer(playerOptions); 3038 }); 3039 } catch (err) { 3040 console.log(err); 3041 } 3042 } 3043 globalThis.CFOpenPopup = handleModalOpen; 3044 globalThis.CFClosePopup = handleModalClose; 3045 } 3046 }; 3047 registerComponent("ModalContainer/V1", ModalContainerV1); 3048 window["ModalContainerV1"] = ModalContainerV1; 3049 } 3050}); 3051
3052// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/add-to-cart.ts 3053var AddToCart; 3054var init_add_to_cart = __esm({ 3055 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/add-to-cart.ts"() { 3056 init_define_process(); 3057 init_addToCart(); 3058 init_runtime(); 3059 AddToCart = class extends CF2Component { 3060 constructor(el, runtimeSel) { 3061 super(el, runtimeSel); 3062 } 3063 mount() { 3064 mountComponent(this); 3065 } 3066 remove() { 3067 this.element.innerHTML = ""; 3068 } 3069 render(initializeChildrenInstances = false) { 3070 const is_server = true; 3071 const product = this.product ?? null; 3072 const currentVariant = this.currentVariant ?? null; 3073 const selected_price = this.selected_price ?? null; 3074 const button_layout_size = this.button_layout_size ?? null; 3075 const input_layout_size = this.input_layout_size ?? null; 3076 const show_name = this.show_name ?? null; 3077 const show_description = this.show_description ?? null; 3078 const show_compare_at = this.show_compare_at ?? null; 3079 const editor_product = this.element.getAttribute("data-param-editor_product"); 3080 const primary_text = this.element.getAttribute("data-param-primary_text"); 3081 const secondary_text = this.element.getAttribute("data-param-secondary_text"); 3082 let html = ""; 3083 { 3084 const is_editor = false; 3085 const customVariants = product?.variants.filter((value) => value["default_variant"] == false); 3086 const variant = currentVariant ?? product; 3087 const selected_price2 = variant?.prices?.[0]; 3088 const desc = (product?.description_override ?? variant.description ?? product.description ?? product.default_variant.description ?? "").replaceAll(` 3089`, "<br>"); 3090 html += `<div class="elAddToCartWrapper">`; 3091 if (show_name) { 3092 html += `<a class="elAddToCartNameLink" href="${product?.url}"><span class="elAddToCartName">${variant?.name ?? product.default_variant.name}</span></a>`; 3093 } 3094 if (variant?.prices?.length == 1) { 3095 html += `<div class="elAddToCartSinglePriceWrapper"><span class="elAddToCartPrice">${selected_price2?.name}</span>`; 3096 const compare_at_amount = selected_price2?.compare_at_amount; 3097 if (compare_at_amount && show_compare_at) { 3098 html += `<span class="elAddToCartCompareAt">${compare_at_amount}</span>`; 3099 } 3100 html += `</div>`; 3101 } else { 3102 html += `<div class="elSelectWrapper`; 3103 if (input_layout_size == "xs") { 3104 html += ` elAddToCartInputExtraSmall`; 3105 } 3106 if (input_layout_size == "s") { 3107 html += ` elAddToCartInputSmall`; 3108 } 3109 if (input_layout_size == "m") { 3110 html += ` elAddToCartInputMedium`; 3111 } 3112 if (input_layout_size == "l") { 3113 html += ` elAddToCartInputLarge`; 3114 } 3115 if (input_layout_size == "xl") { 3116 html += ` elAddToCartInputExtraLarge`; 3117 } 3118 html += `"><select name="variant_price">`; 3119 const c0 = variant.prices; 3120 const fl1 = new CF2ForloopDrop(c0.length); 3121 for (const price of c0) { 3122 const forloop = fl1; 3123 html += `<option `; 3124 if (selected_price2?.id == price?.id) { 3125 html += `selected`; 3126 } 3127 html += ` value="${price?.id}">${price?.name}</option>`; 3128 forloop.next(); 3129 } 3130 html += `</select><div class="elSelectArrow"><i class="fas fa-chevron-down"></i></div></div>`; 3131 } 3132 if (desc != "" && show_description) { 3133 html += `<span class="elAddToCartDescription">${desc}</span>`; 3134 } 3135 if (customVariants?.length > 1) { 3136 html += `<div class="elAddToCartVariantSelectorWrapper">`; 3137 const c2 = product.sorted_property_values; 3138 const fl3 = new CF2ForloopDrop(c2.length); 3139 for (const property_values of c2) { 3140 const forloop = fl3; 3141 const property_id = property_values?.property_id; 3142 const select_index = forloop?.index0; 3143 html += `<div class="elSelectWrapper`; 3144 if (input_layout_size == "xs") { 3145 html += ` elAddToCartInputExtraSmall`; 3146 } 3147 if (input_layout_size == "s") { 3148 html += ` elAddToCartInputSmall`; 3149 } 3150 if (input_layout_size == "m") { 3151 html += ` elAddToCartInputMedium`; 3152 } 3153 if (input_layout_size == "l") { 3154 html += ` elAddToCartInputLarge`; 3155 } 3156 if (input_layout_size == "xl") { 3157 html += ` elAddToCartInputExtraLarge`; 3158 } 3159 html += `"><span class="elAddToCartVariantSelectorTitle">${product?.all_properties?.[property_id]}</span><div style="position:relative;"><select class="elVariantSelector" name="property_${property_id}">`; 3160 const c4 = property_values.value_ids; 3161 const fl5 = new CF2ForloopDrop(c4.length); 3162 for (const value_id of c4) { 3163 const forloop2 = fl5; 3164 html += `<option `; 3165 if (variant?.property_value_ids?.[select_index] == value_id) { 3166 html += `selected`; 3167 } 3168 html += ` value="${value_id}">${product?.all_properties_values?.[value_id]}</option>`; 3169 forloop2.next(); 3170 } 3171 html += `</select><div class="elSelectArrow"><i class="fas fa-chevron-down"></i></div></div></div>`; 3172 forloop.next(); 3173 } 3174 html += `</div>`; 3175 } 3176 html += `<div class="elAddToCartButtonsWrapper"><div data-page-element="Button/V1" class="elBTN elAddToCartAddToCartButton i
3176d-Button/V1`; 3177 if (button_layout_size == "xs") { 3178 html += ` elAddToCartButtonExtraSmall`; 3179 } 3180 if (button_layout_size == "s") { 3181 html += ` elAddToCartButtonSmall`; 3182 } 3183 if (button_layout_size == "m") { 3184 html += ` elAddToCartButtonMedium`; 3185 } 3186 if (button_layout_size == "l") { 3187 html += ` elAddToCartButtonLarge`; 3188 } 3189 if (button_layout_size == "xl") { 3190 html += ` elAddToCartButtonExtraLarge`; 3191 } 3192 html += `" data-liquid-replace="item">`; 3193 const label_key = "addtocart"; 3194 const label_key_slice = "addtoc"; 3195 let data_content_key = ""; 3196 data_content_key = "addtocart"; 3197 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>`; 3198 } 3199 this.replaceContent(html); 3200 if (initializeChildrenInstances) { 3201 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3202 const options = { scopeToYggRender }; 3203 CF2Component.hydrateTree(this.element, options); 3204 } 3205 } 3206 }; 3207 registerComponent("AddToCart", AddToCart); 3208 window["AddToCart"] = AddToCart; 3209 } 3210}); 3211
3212// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search-products.ts 3213var StoreSearchProducts; 3214var init_store_search_products = __esm({ 3215 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search-products.ts"() { 3216 init_define_process(); 3217 init_runtime(); 3218 StoreSearchProducts = class extends CF2Component { 3219 constructor(el, runtimeSel) { 3220 super(el, runtimeSel); 3221 } 3222 mount() { 3223 } 3224 remove() { 3225 this.element.innerHTML = ""; 3226 } 3227 render(initializeChildrenInstances = false) { 3228 const is_server = true; 3229 const selected_products = this.selected_products ?? null; 3230 let html = ""; 3231 { 3232 const c0 = selected_products; 3233 const fl1 = new CF2ForloopDrop(c0.length); 3234 for (const product of c0) { 3235 const forloop = fl1; 3236 const default_variant = product?.default_variant ?? "{}"; 3237 const image = product?.image ?? default_variant.image ?? "/editor/editor-demo-image-placeholder.svg"; 3238 const name = product?.name ?? default_variant.name; 3239 const price = product?.price ?? default_variant.price; 3240 html += `<div class="elStoreSearchProductCard">`; 3241 if (image) { 3242 html += `<a class="elStoreSearchImageWrapper" href="${product?.url}"><div data-page-element="Image/V2" class="elImageWrapper de-image-block id-Image/V2`; 3243 if (CF2Blank(image) && CF2Blank(null) && true) { 3244 html += ` forceHide`; 3245 } 3246 html += `" data-liquid-replace="item">`; 3247 if (image || !CF2Blank(null)) { 3248 html += `<img class="elImage" src="${image ?? null}" data-lazy-loading="true" data-lazy-loading="true"/>`; 3249 } else if (false) { 3250 html += `<div class="image-placeholder" title=""><span class="image-placeholder-header"></span></div>`; 3251 } 3252 html += `</div></a>`; 3253 } 3254 html += `<div class="elStoreSearchProductCardInfo"><a href="${product?.url}" class="elStoreSearchProductCardName">${name}</a><span class="elStoreSearchProductCardPrice">${price}</span></div></div>`; 3255 forloop.next(); 3256 } 3257 } 3258 this.replaceContent(html); 3259 if (initializeChildrenInstances) { 3260 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3261 const options = { scopeToYggRender }; 3262 CF2Component.hydrateTree(this.element, options); 3263 } 3264 } 3265 }; 3266 registerComponent("StoreSearchProducts", StoreSearchProducts); 3267 window["StoreSearchProducts"] = StoreSearchProducts; 3268 } 3269}); 3270
3271// projects/lib/packages/yggdrasil-blueprints/src/Elements/Store/Search/storeSearch.ts 3272var allProductsById, productSearchFetcher, fetchProducts, handleSearchResults, searchProducts, debounceHandler, mountComponent2, getProductsElementComponent, updateProducts, showModal, productsReady, hideModal, showSearchProducts, hideProducts, hideTitle, showTitle, showResultsNotFound, hideResultsNotFound, showLoading, hideLoading; 3273var init_storeSearch = __esm({ 3274 "projects/lib/packages/yggdrasil-blueprints/src/Elements/Store/Search/storeSearch.ts"() { 3275 init_define_process(); 3276 init_general(); 3277 init_fetcher(); 3278 allProductsById = {}; 3279 fetchProducts = (component, searchQuery) => { 3280 if (productSearchFetcher) { 3281 productSearchFetcher.abort(); 3282 } 3283 const url = new URL("/products/search", window.location.origin); 3284 url.searchParams.set("q", searchQuery); 3285 productSearchFetcher = new Fetcher(); 3286 return productSearchFetcher.fetch( 3287 url.toString(), 3288 { 3289 headers: { "Content-Type": "application/json" } 3290 }, 3291 { retries: 3, shouldCaptureServerError: true } 3292 ).then((res) => { 3293 if (res instanceof Response && res.ok) { 3294 return res.json(); 3295 } 3296 throw new Error("Search request failed"); 3297 }).then((json) => { 3298 const products = json.products; 3299 if (!products) return; 3300 handleSearchResults(component, products, searchQuery); 3301 }).catch((error) => { 3302 if (error === MANUALLY_ABORTED) { 3303 return; 3304 } 3305 console.error("Product search error:", error); 3306 }).finally(() => { 3307 productSearchFetcher = null; 3308 hideLoading(component); 3309 }); 3310 }; 3311 handleSearchResults = (component, products, searchQuery) => { 3312 hideLoading(component); 3313 if (products.length > 0) { 3314 updateProducts(component, products); 3315 hideTitle(component); 3316 showSearchProducts(component); 3317 hideResultsNotFound(component); 3318 } else { 3319 hideProducts(component); 3320 hideTitle(component); 3321 showResultsNotFound(component, searchQuery); 3322 } 3323 }; 3324 searchProducts = (search, component) => { 3325 showLoading(component); 3326 fetchProducts(component, search); 3327 }; 3328 debounceHandler = debounce( 3329 ([evt, component]) => searchProducts(evt.target.value, component), 3330 500 3331 ); 3332 mountComponent2 = (component) => { 3333 showTitle(component); 3334 productsReady(component); 3335 const searchIcon = component.element.querySelector('[href="#open-store-search"]'); 3336 searchIcon.addEventListener("click", () => showModal(component)); 3337 const searchElement = component.element.querySelector('[name="store-search"]'); 3338 searchElement.addEventListener("input", (evt) => debounceHandler(evt, component)); 3339 searchElement.addEventListener("focus", (evt) => debounceHandler(evt, component)); 3340 const modal = component.getComponent("Modal/V1"); 3341 modal.element.addEventListener("click", () => { 3342 hideModal(component); 3343 }); 3344 component.element.querySelector(".elStoreSearch").addEventListener("click", (evt) => { 3345 evt.stopPropagation(); 3346 }); 3347 component.element.querySelectorAll(".elModalClose").forEach( 3348 (elem) => elem.addEventListener("click", () => { 3349 hideModal(component); 3350 }) 3351 ); 3352 document.addEventListener("keydown", (evt) => { 3353 if (evt.key === "Escape") hideModal(component); 3354 }); 3355 }; 3356 getProductsElementComponent = (component) => { 3357 return component.getComponent("StoreSearchProducts"); 3358 }; 3359 updateProducts = (component, products) => { 3360 ; 3361 getProductsElementComponent(component).selected_products = products; 3362 getProductsElementComponent(component).render(); 3363 }; 3364 showModal = (component) => { 3365 document.documentElement.classList.add("hide-page-scroll"); 3366 component.getComponent("Modal/V1").element.style.display = "flex"; 3367 component.element.querySelector(".elStoreSearch").setAttribute("data-animation-state", "running"); 3368 component.element.querySelector('[name="store-search"]').focus(); 3369 }; 3370 productsReady = (component) => { 3371 updateProducts(component, Object.values(allProductsById).slice(0, 6)); 3372 getProductsElementComponent(component).element.classList.remove("forceHide"); 3373 component.element.querySelector(".elStoreSearchTitle").classList.remove("forceHide"); 3374 component.element.querySelector('[name="store-search"]').disabled = false;
3375 component.element.querySelector(".elStoreSearchLoading").classList.add("forceHide"); 3376 }; 3377 hideModal = (component) => { 3378 document.documentElement.classList.remove("hide-page-scroll"); 3379 component.getComponent("Modal/V1").element.style.display = "none"; 3380 }; 3381 showSearchProducts = (component) => { 3382 getProductsElementComponent(component).element.classList.remove("forceHide"); 3383 }; 3384 hideProducts = (component) => { 3385 getProductsElementComponent(component).element.classList.add("forceHide"); 3386 }; 3387 hideTitle = (component) => { 3388 component.element.querySelector(".elStoreSearchTitle").classList.add("forceHide"); 3389 }; 3390 showTitle = (component) => { 3391 component.element.querySelector(".elStoreSearchTitle").classList.remove("forceHide"); 3392 }; 3393 showResultsNotFound = (component, text) => { 3394 const [split1, split2] = component.not_found_text.split("{search}"); 3395 component.element.querySelector(".elStoreSearchResultsNotFound").innerHTML = split1 + text + split2; 3396 component.element.querySelector(".elStoreSearchResultsNotFound").classList.remove("forceHide"); 3397 }; 3398 hideResultsNotFound = (component) => { 3399 component.element.querySelector(".elStoreSearchResultsNotFound").classList.add("forceHide"); 3400 }; 3401 showLoading = (component) => { 3402 component.element.querySelector(".elStoreSearchLoading").classList.remove("forceHide"); 3403 }; 3404 hideLoading = (component) => { 3405 component.element.querySelector(".elStoreSearchLoading").classList.add("forceHide"); 3406 }; 3407 } 3408}); 3409
3410// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search.ts 3411var StoreSearch; 3412var init_store_search = __esm({ 3413 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/store-search.ts"() { 3414 init_define_process(); 3415 init_modal_v1(); 3416 init_store_search_products(); 3417 init_storeSearch(); 3418 init_runtime(); 3419 StoreSearch = class extends CF2Component { 3420 constructor(el, runtimeSel) { 3421 super(el, runtimeSel); 3422 } 3423 mount() { 3424 mountComponent2(this); 3425 } 3426 }; 3427 registerComponent("StoreSearch", StoreSearch); 3428 window["StoreSearch"] = StoreSearch; 3429 } 3430}); 3431
3432// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/accordion-v1.ts 3433var AccordionV1; 3434var init_accordion_v1 = __esm({ 3435 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/accordion-v1.ts"() { 3436 init_define_process(); 3437 init_runtime(); 3438 AccordionV1 = class extends CF2Component { 3439 constructor(el, runtimeSel) { 3440 super(el, runtimeSel); 3441 } 3442 mount() { 3443 const allAccordionElements = this.element.querySelector(".elAccordionWrapper").childNodes; 3444 const bodySelector = ".elAccordionItemBody"; 3445 const openClass = "elAccordionItemOpen"; 3446 const closeClass = "elAccordionItemClosing"; 3447 allAccordionElements.forEach((accordion) => { 3448 const header = accordion.querySelector(".elAccordionItemHeader"); 3449 const body = accordion.querySelector(bodySelector); 3450 header.addEventListener("click", () => { 3451 const isOpen = accordion.classList.contains(openClass); 3452 if (isOpen) { 3453 accordion.classList.add(closeClass); 3454 $(body).slideUp(300, () => { 3455 accordion.classList.remove(openClass); 3456 accordion.classList.remove(closeClass); 3457 }); 3458 } else { 3459 accordion.classList.add(openClass); 3460 $(body).slideDown(300); 3461 } 3462 allAccordionElements.forEach((otherAccordion) => { 3463 if (otherAccordion === accordion) return; 3464 const body2 = otherAccordion.querySelector(bodySelector); 3465 otherAccordion.classList.add(closeClass);
3466 $(body2).slideUp(300, () => { 3467 otherAccordion.classList.remove(openClass); 3468 otherAccordion.classList.remove(closeClass); 3469 }); 3470 }); 3471 }); 3472 }); 3473 } 3474 }; 3475 registerComponent("Accordion/V1", AccordionV1); 3476 window["AccordionV1"] = AccordionV1; 3477 } 3478}); 3479
3480// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/checkout-product-image-carousel-v1.ts 3481var CheckoutProductImageCarouselV1; 3482var init_checkout_product_image_carousel_v1 = __esm({ 3483 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/checkout-product-image-carousel-v1.ts"() { 3484 init_define_process(); 3485 init_runtime(); 3486 CheckoutProductImageCarouselV1 = class extends CF2Component { 3487 constructor(el, runtimeSel) { 3488 super(el, runtimeSel); 3489 } 3490 selectProduct(productId, variantId) { 3491 const changedProduct = productId != this.currentProduct?.id; 3492 if (changedProduct) { 3493 this.currentVariantId = variantId; 3494 this.currentProduct = globalResourceData.productsById[productId]; 3495 this.render(); 3496 this.calculateTotalThumbnails(); 3497 this.mountSlider(); 3498 this.scrollToVariant(true); 3499 } 3500 const changedVariant = variantId != this.currentVariantId; 3501 if (changedVariant) { 3502 this.currentVariantId = variantId; 3503 this.scrollToVariant(changedProduct); 3504 } 3505 } 3506 initialize() { 3507 document.addEventListener("ProductCarousel:Update", (evt) => { 3508 const { productId, variantId } = evt.detail; 3509 this.selectProduct(productId, variantId); 3510 }); 3511 } 3512 // The sliders have to be mounted on load, not only when a ProductCarousel:Update 3513 // arrives. That event is dispatched exclusively by CheckoutProductSelect/V2 and 3514 // AddToCart, so a page carrying the carousel without one of those elements (a 3515 // plain sales page, for example) never mounted Swiper at all: the thumbnail strip 3516 // fell back to Swiper's own 100%-wide .swiper-slide rule, so only the first 3517 // thumbnail was visible and it was stretched across the whole strip. The editor 3518 // hides this because it does not hydrate CF2 components, and lays the strip out 3519 // with the editor-only editor-styles macro instead - hence thumbnails that show 3520 // in the builder but not on preview or live (ENG-7465). 3521 mount() { 3522 this.calculateTotalThumbnails(); 3523 this.mountSlider(); 3524 } 3525 calculateTotalThumbnails() { 3526 this.totalImages = this.element.querySelectorAll(".slider-nav .swiper-slide").length; 3527 } 3528 scrollToVariant(disableAnimation = false) { 3529 const variantImages = this.element.querySelectorAll(`.slider-nav [data-variant-id="${this.currentVariantId}"]`); 3530 const productImages = this.element.querySelectorAll(".slider-nav .swiper-slide:not([data-variant-id])"); 3531 const itemImages = variantImages.length ? variantImages : productImages; 3532 if (itemImages.length) { 3533 const itemPositions = [...itemImages].map((item) => item.getAttribute("data-image-position")); 3534 const firstPosition = itemPositions[0]; 3535 const lastPosition = itemPositions[itemPositions.length - 1]; 3536 const speed = disableAnimation ? 0 : void 0; 3537 if (this.swiperNav) { 3538 this.swiperNav.setProgress(firstPosition / (this.totalImages - this.numberOfThumbnails), speed); 3539 } 3540 this.swiper.slideTo(firstPosition, speed); 3541 } 3542 } 3543 // Destroys with cleanStyles = false on purpose: selectProduct() re-renders the 3544 // element before re-mounting, so by the time this runs the instances point at 3545 // detached nodes and there is nothing worth restoring styles on. 3546 destroySliders() { 3547 this.swiper?.destroy(true, false); 3548 this.swiper = null; 3549 this.swiperNav?.destroy(true, false); 3550 this.swiperNav = null; 3551 } 3552 mountSlider() { 3553 const mainSliderEl = this.element.querySelector(".slider-main"); 3554 const navSliderEl = this.element.querySelector(".slider-nav"); 3555 const hasThumbnails = !!navSliderEl; 3556 const hasNextPrevButtons = !!this.element.querySelector(".swiper-button-next, .swiper-button-prev"); 3557 this.destroySliders(); 3558 if (!mainSliderEl) return; 3559 if (hasThumbnails) { 3560 this.swiperNav = new Swiper(navSliderEl, { 3561 spaceBetween: this.spaceBetweenThumbnails, 3562 slidesPerView: this.numberOfThumbnails, 3563 freeMode: true, 3564 watchSlidesProgress: true, 3565 mousewheel: true, 3566 scrollbar: { 3567 // The scrollbar is a sibling of .slider-nav rather than a descendant, so 3568 // Swiper resolves a selector string here against the document, not this 3569 // carousel. Harmless while only one carousel was ever mounted at a time; 3570 // now that every carousel mounts on load, two on the same page would both 3571 // bind to the first match. Pass this element's own node instead. 3572 el: this.element.querySelector(".swiper-scrollbar"), 3573 draggable: true 3574 } 3575 }); 3576 } 3577 this.swiper = new Swiper(mainSliderEl, { 3578 spaceBetween: 1, 3579 loop: true, 3580 ...hasNextPrevButtons ? { 3581 navigation: { 3582 nextEl: ".swiper-button-next", 3583 prevEl: ".swiper-button-prev" 3584 } 3585 } : {}, 3586 ...hasThumbnails ? { 3587 thumbs: { 3588 swiper: this.swiperNav 3589 } 3590 } : {} 3591 }); 3592 } 3593 remove() { 3594 this.element.innerHTML = ""; 3595 } 3596 render(initializeChildrenInstances = false) { 3597 const is_server = true; 3598 const currentProduct = this.currentProduct ?? null; 3599 const showThumbnails = this.showThumbnails ?? null; 3600 const numberOfThumbnails = this.numberOfThumbnails ?? null; 3601 const spaceBetweenThumbnails = this.spaceBetweenThumbnails ?? null; 3602 const linkedCheckoutId = this.element.getAttribute("data-param-linkedCheckoutId"); 3603 let html = ""; 3604 { 3605 let assignedProduct = currentProduct; 3606 html += `<div class="elProductImageCarouselOuterFrame"></div>`; 3607 const is_editor = false;
3608 let warning = ""; 3609 if (CF2Blank(assignedProduct)) { 3610 assignedProduct = globalResourceData?.productsWithNoBump?.[0]; 3611 } 3612 let imagePosition = 0; 3613 const variantImages = assignedProduct?.variants.map((i) => i.images).flat(); 3614 const allImages = assignedProduct?.images.concat(variantImages).filter((v) => v != null && v != void 0); 3615 const totalImages = allImages?.length ?? 0; 3616 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="">`; 3617 if (totalImages > 0) { 3618 html += `<div class="slider-main-wrapper"><div class="elProductCarouselMainImageOuterFrame"></div><div class="swiper slider-main"><div class="swiper-wrapper">`; 3619 imagePosition = 0; 3620 if (assignedProduct?.images?.length > 0) { 3621 const c0 = assignedProduct.images; 3622 const fl1 = new CF2ForloopDrop(c0.length); 3623 for (const imageUrl of c0) { 3624 const forloop = fl1; 3625 html += `<div class="swiper-slide`; 3626 if (imagePosition == 0 && false) { 3627 html += ` swiper-slide-thumb-active`; 3628 } 3629 html += `" data-image-position="${imagePosition}"><img src="${imageUrl}"/></div>`; 3630 imagePosition = imagePosition + 1; 3631 forloop.next(); 3632 } 3633 } 3634 const c2 = assignedProduct.variants; 3635 const fl3 = new CF2ForloopDrop(c2.length); 3636 for (const variant of c2) { 3637 const forloop = fl3; 3638 if (variant?.images?.length > 0) { 3639 const c4 = variant.images; 3640 const fl5 = new CF2ForloopDrop(c4.length); 3641 for (const imageUrl of c4) { 3642 const forloop2 = fl5; 3643 html += `<div class="swiper-slide`; 3644 if (imagePosition == 0 && false) { 3645 html += ` swiper-slide-thumb-active`; 3646 } 3647 html += `" data-image-position="${imagePosition}" data-variant-id="${variant?.id}"><img src="${imageUrl}"/></div>`; 3648 imagePosition = imagePosition + 1; 3649 forloop2.next(); 3650 } 3651 } 3652 forloop.next(); 3653 } 3654 html += `</div>`; 3655 if (totalImages > 1) { 3656 html += `<div class="swiper-button-next"></div>`; 3657 html += `<div class="swiper-button-prev"></div>`; 3658 } 3659 html += `</div></div>`; 3660 if (showThumbnails && totalImages > 1) { 3661 html += `<div class="slider-nav-wrapper"><div class="swiper slider-nav"><div class="swiper-wrapper">`; 3662 imagePosition = 0; 3663 if (assignedProduct?.images?.length > 0) { 3664 const c6 = assignedProduct.images; 3665 const fl7 = new CF2ForloopDrop(c6.length); 3666 for (const imageUrl of c6) { 3667 const forloop = fl7; 3668 html += `<div class="swiper-slide`; 3669 if (imagePosition == 0 && true) { 3670 html += ` swiper-slide-thumb-active`; 3671 } 3672 html += `" data-image-position="${imagePosition}"><img src="${imageUrl}"/></div>`; 3673 imagePosition = imagePosition + 1; 3674 forloop.next(); 3675 } 3676 } 3677 const c8 = assignedProduct.variants; 3678 const fl9 = new CF2ForloopDrop(c8.length); 3679 for (const variant of c8) { 3680 const forloop = fl9; 3681 if (variant?.images?.length > 0) { 3682 const c10 = variant.images; 3683 const fl11 = new CF2ForloopDrop(c10.length); 3684 for (const imageUrl of c10) { 3685 const forloop2 = fl11; 3686 html += `<div class="swiper-slide`; 3687 if (imagePosition == 0 && true) { 3688 html += ` swiper-slide-thumb-active`; 3689 } 3690 html += `" data-image-position="${imagePosition}" data-variant-id="${variant?.id}"><img src="${imageUrl}"/></div>`; 3691 imagePosition = imagePosition + 1; 3692 forloop2.next(); 3693 } 3694 } 3695 forloop.next(); 3696 } 3697 html += `</div></div><div class="swiper-scrollbar swiper-scrollbar-horizontal"></div></div>`; 3698 } 3699 } 3700 html += `</div>`; 3701 } 3702 this.replaceContent(html); 3703 if (initializeChildrenInstances) { 3704 const scopeToYggRender = this.element.querySelectorAll("[ygg-render]").length > 0; 3705 const options = { scopeToYggRender }; 3706 CF2Component.hydrateTree(this.element, options); 3707 } 3708 } 3709 }; 3710 registerComponent("CheckoutProductImageCarousel/V1", CheckoutProductImageCarouselV1); 3711 window["CheckoutProductImageCarouselV1"] = CheckoutProductImageCarouselV1; 3712 } 3713}); 3714
3715// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/sharedModules.ts 3716var sharedModules_exports = {}; 3717var init_sharedModules = __esm({ 3718 "projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/sharedModules.ts"() { 3719 init_define_process(); 3720 init_content_node(); 3721 init_modal_v1(); 3722 init_modal_sidebar_v1(); 3723 init_modal_container_v1(); 3724 init_select_box_v2(); 3725 init_checkbox_v1(); 3726 init_input_v1(); 3727 init_radio_v1(); 3728 init_text_area_v1(); 3729 init_add_to_cart(); 3730 init_store_search_products(); 3731 init_store_search(); 3732 init_accordion_v1(); 3733 init_checkout_product_image_carousel_v1(); 3734 init_survey_image_option_v1(); 3735 } 3736}); 3737
3738// projects/user_pages/app/packs/user_pages.js 3739init_define_process(); 3740require_lander(); 3741init_lander_styles(); 3742init_sharedModules(); 3743//# sourceMappingURL=user_pages-HOIFQUQV.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.