@rtstic.dev/pulse 0.0.92 → 0.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{function
|
|
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/form/book-a-demo/thank-you.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;
|
|
4
|
+
"sourcesContent": ["function getSessionData() {\n return {\n firstName: sessionStorage.getItem(\"ty_firstName\") ?? \"\",\n lastName: sessionStorage.getItem(\"ty_lastName\") ?? \"\",\n email: sessionStorage.getItem(\"ty_email\") ?? \"\",\n showCalendar: sessionStorage.getItem(\"ty_showCalendar\") === \"true\",\n calendarName: sessionStorage.getItem(\"ty_calendarName\") ?? \"\",\n embedUrl: sessionStorage.getItem(\"ty_embedUrl\") ?? \"\",\n flow: sessionStorage.getItem(\"ty_flow\") ?? \"\",\n };\n}\n\nfunction hasCookieConsent(): boolean {\n const state = (window as any).Termly?.getConsentState();\n if (!state) return false;\n return state.analytics === true && state.advertising === true;\n}\n\nfunction showThankYou(): void {\n const container = document.querySelector<HTMLElement>(\"[hs-calender-block]\");\n if (container) {\n container.setAttribute(\"hs-calender-block-active\", \"false\");\n container.innerHTML = \"\";\n }\n document.querySelectorAll<HTMLElement>(\"[hs-thankyou-block-active]\")\n .forEach((el) => el.setAttribute(\"hs-thankyou-block-active\", \"true\"));\n}\n\nfunction loadCalendar(data: ReturnType<typeof getSessionData>): void {\n const container = document.querySelector<HTMLElement>(\"[hs-calender-block]\");\n if (!container) return;\n\n const consentGiven = hasCookieConsent();\n\n if (!data.showCalendar || !data.embedUrl || !consentGiven) {\n showThankYou();\n return;\n }\n\n // show calendar, hide thank you\n container.setAttribute(\"hs-calender-block-active\", \"true\");\n container.innerHTML = \"\";\n document.querySelectorAll<HTMLElement>(\"[hs-thankyou-block-active]\")\n .forEach((el) => el.setAttribute(\"hs-thankyou-block-active\", \"false\"));\n\n // build prefill params\n const prefillParams = new URLSearchParams();\n if (data.firstName) prefillParams.set(\"firstName\", data.firstName);\n if (data.lastName) prefillParams.set(\"lastName\", data.lastName);\n if (data.email) prefillParams.set(\"email\", data.email);\n\n const separator = data.embedUrl.includes(\"?\") ? \"&\" : \"?\";\n const embedUrl = prefillParams.toString()\n ? `${data.embedUrl}${separator}${prefillParams.toString()}`\n : data.embedUrl;\n\n // inject iframe\n const meetingsDiv = document.createElement(\"div\");\n meetingsDiv.className = \"meetings-iframe-container\";\n meetingsDiv.setAttribute(\"data-src\", embedUrl);\n container.appendChild(meetingsDiv);\n\n // inject HubSpot script\n const scriptSrc = \"https://static.hsappstatic.net/MeetingsEmbed/ex/MeetingsEmbedCode.js\";\n const existingScript = document.querySelector<HTMLScriptElement>(`script[src=\"${scriptSrc}\"]`);\n if (existingScript) existingScript.remove();\n\n const script = document.createElement(\"script\");\n script.type = \"text/javascript\";\n script.src = scriptSrc;\n container.appendChild(script);\n}\n\nfunction setFlowAttribute(): void {\n const flow = sessionStorage.getItem(\"ty_flow\") ?? \"\";\n if (!flow) return;\n\n document.querySelectorAll<HTMLElement>(\"[hs-thankyou-flow]\")\n .forEach((el) => {\n const elFlow = el.getAttribute(\"hs-thankyou-flow\");\n el.setAttribute(\n \"form-flow-active\",\n elFlow === flow ? \"true\" : \"false\"\n );\n });\n}\n\n// Boot\ndocument.addEventListener(\"DOMContentLoaded\", () => {\n const data = getSessionData();\n console.log(\"1. DOMContentLoaded - data:\", data);\n\n setFlowAttribute();\n\n // show thank-you immediately by default\n showThankYou();\n console.log(\"2. after showThankYou - blocks:\",\n Array.from(document.querySelectorAll(\"[hs-thankyou-block-active]\"))\n .map(el => el.getAttribute(\"hs-thankyou-block-active\"))\n );\n\n // check consent when Termly initializes\n (window as any).Termly?.on(\"initialized\", () => {\n console.log(\"3. Termly initialized event fired\");\n setTimeout(() => {\n console.log(\"4. consent state at initialized:\", (window as any).Termly?.getConsentState());\n loadCalendar(data);\n console.log(\"5. after loadCalendar at initialized - blocks:\",\n Array.from(document.querySelectorAll(\"[hs-thankyou-block-active]\"))\n .map(el => el.getAttribute(\"hs-thankyou-block-active\"))\n );\n }, 300);\n });\n\n // re-check consent when user changes cookie preferences\n (window as any).Termly?.on(\"consent\", () => {\n console.log(\"6. Termly consent event fired\");\n setTimeout(() => {\n console.log(\"7. consent state at consent:\", (window as any).Termly?.getConsentState());\n loadCalendar(data);\n console.log(\"8. after loadCalendar at consent - blocks:\",\n Array.from(document.querySelectorAll(\"[hs-thankyou-block-active]\"))\n .map(el => el.getAttribute(\"hs-thankyou-block-active\"))\n );\n }, 300);\n });\n\n // fallback \u2014 if Termly already initialized before our listeners attached\n setTimeout(() => {\n console.log(\"9. fallback timeout - consent state:\", (window as any).Termly?.getConsentState());\n const state = (window as any).Termly?.getConsentState();\n if (state) loadCalendar(data);\n console.log(\"10. after fallback loadCalendar - blocks:\",\n Array.from(document.querySelectorAll(\"[hs-thankyou-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