|
1
|
-
"use strict";(()=>{function y(){return{firstName:sessionStorage.getItem("ty_firstName")??"",lastName:sessionStorage.getItem("ty_lastName")??"",email:sessionStorage.getItem("ty_email")??"",showCalendar:sessionStorage.getItem("ty_showCalendar")==="true",calendarName:sessionStorage.getItem("ty_calendarName")??"",embedUrl:sessionStorage.getItem("ty_embedUrl")??"",flow:sessionStorage.getItem("ty_flow")??""}}function f(){let e=window.Termly?.getConsentState();return e?e.analytics===!0&&e.advertising===!0:!1}function i(){let e=document.querySelector("[hs-calender-block]");e&&(e.setAttribute("hs-calender-block-active","false"),e.innerHTML=""),document.querySelectorAll("[hs-thankyou-block-active]").forEach(t=>t.setAttribute("hs-thankyou-block-active","true"))}function r(e){let t=document.querySelector("[hs-calender-block]");if(!t)return;let o=f();if(!e.showCalendar||!e.embedUrl||!o){i();return}t.setAttribute("hs-calender-block-active","true"),t.innerHTML="",document.querySelectorAll("[hs-thankyou-block-active]").forEach(d=>d.setAttribute("hs-thankyou-block-active","false"));let n=new URLSearchParams;e.firstName&&n.set("firstName",e.firstName),e.lastName&&n.set("lastName",e.lastName),e.email&&n.set("email",e.email);let m=e.embedUrl.includes("?")?"&":"?",u=n.toString()?`${e.embedUrl}${m}${n.toString()}`:e.embedUrl,a=document.createElement("div");a.className="meetings-iframe-container",a.setAttribute("data-src",u),t.appendChild(a);let l="https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js",c=document.querySelector(`script[src="${l}"]`);c&&c.remove();let s=document.createElement("script");s.type="text/javascript",s.src=l,t.appendChild(s)}function h(){let e=sessionStorage.getItem("ty_flow")??"";e&&document.querySelectorAll("[hs-thankyou-flow]").forEach(t=>{let o=t.getAttribute("hs-thankyou-flow");t.setAttribute("form-flow-active",o===e?"true":"false")})}document.addEventListener("DOMContentLoaded",()=>{let e=y();console.log("1. DOMContentLoaded - data:",e),h(),i(),console.log("2. after showThankYou - blocks:",Array.from(document.querySelectorAll("[hs-thankyou-block-active]")).map(t=>t.getAttribute("hs-thankyou-block-active"))),window.Termly?.on("initialized",()=>{console.log("3. Termly initialized event fired"),setTimeout(()=>{console.log("4. consent state at initialized:",window.Termly?.getConsentState()),r(e),console.log("5. after loadCalendar at initialized - blocks:",Array.from(document.querySelectorAll("[hs-thankyou-block-active]")).map(t=>t.getAttribute("hs-thankyou-block-active")))},300)}),window.Termly?.on("consent",()=>{console.log("6. Termly consent event fired"),setTimeout(()=>{console.log("7. consent state at consent:",window.Termly?.getConsentState()),r(e),console.log("8. after loadCalendar at consent - blocks:",Array.from(document.querySelectorAll("[hs-thankyou-block-active]")).map(t=>t.getAttribute("hs-thankyou-block-active")))},300)}),setTimeout(()=>{console.log("9. fallback timeout - consent state:",window.Termly?.getConsentState()),window.Termly?.getConsentState()&&r(e),console.log("10. after fallback loadCalendar - blocks:",Array.from(document.querySelectorAll("[hs-thankyou-block-active]")).map(o=>o.getAttribute("hs-thankyou-block-active")))},500)});})();
|
|
1
|
+
"use strict";(()=>{function s(){return{firstName:sessionStorage.getItem("ty_firstName")??"",lastName:sessionStorage.getItem("ty_lastName")??"",email:sessionStorage.getItem("ty_email")??"",showCalendar:sessionStorage.getItem("ty_showCalendar")==="true",calendarName:sessionStorage.getItem("ty_calendarName")??"",embedUrl:sessionStorage.getItem("ty_embedUrl")??"",flow:sessionStorage.getItem("ty_flow")??""}}function n(){let e=document.querySelector("[hs-calender-block]");e&&(e.setAttribute("hs-calender-block-active","false"),e.innerHTML=""),document.querySelectorAll("[hs-thankyou-block-active]").forEach(t=>t.setAttribute("hs-thankyou-block-active","true"))}function o(e){n()}function r(){let e=sessionStorage.getItem("ty_flow")??"";e&&document.querySelectorAll("[hs-thankyou-flow]").forEach(t=>{let a=t.getAttribute("hs-thankyou-flow");t.setAttribute("form-flow-active",a===e?"true":"false")})}document.addEventListener("DOMContentLoaded",()=>{let e=s();r(),n(),window.Termly?.on("initialized",()=>{setTimeout(()=>o(e),300)}),window.Termly?.on("consent",()=>{setTimeout(()=>o(e),300)}),setTimeout(()=>{window.Termly?.getConsentState()&&o(e)},500)});})();
|