@fynd-design-engineering/fynd-one-v2 3.1.28 → 3.1.30

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";(()=>{window.validationPassed=!1;function u(n="#phone-number",e="#country-code"){let t=typeof n=="string"?document.querySelector(n):n,o=document.querySelector(e);if(!t)return console.error("Phone input not found"),"91";if(!o)return console.error("Country code input not found"),"91";try{if(t.iti&&typeof t.iti.getSelectedCountryData=="function"){let i=t.iti.getSelectedCountryData();return o.value="+"+i.dialCode,i.dialCode}else if(window.intlTelInputGlobals&&typeof window.intlTelInputGlobals.getInstance=="function"){let i=window.intlTelInputGlobals.getInstance(t);if(i){let r=i.getSelectedCountryData();return o.value="+"+r.dialCode,r.dialCode}}return o.value="+91","91"}catch(i){return console.error("Error retrieving country code:",i),o.value="+91","91"}}function c(){let n=document.getElementById("product"),e=document.getElementById("page-url");e&&(e.value=window.location.href),n&&(n.value=document.title)}function m(){if(!window.redirectionOptions||!window.redirectionOptions.newTab)return console.error("window.redirectionOptions not found or missing newTab property"),null;let n=window.redirectionOptions.newTab,e=document.getElementById("first-name"),t=document.getElementById("last-name"),o=document.getElementById("work-email");if(!e||!e.value.trim()||!t||!t.value.trim()||!o||!o.value.trim())return console.error("Required fields missing or empty"),null;let i=`${e.value} ${t.value}`.trim(),r=o.value;return`${n}?email=${encodeURIComponent(r)}&name=${encodeURIComponent(i)}`}function w(){if(!window.redirectionOptions||!window.redirectionOptions.newTab)return console.error("window.redirectionOptions not found or missing newTab property"),null;let n=window.redirectionOptions.newTab,e=document.getElementById("first-name"),t=document.getElementById("last-name"),o=document.getElementById("work-email"),i=document.getElementById("message");if(!e||!e.value.trim()||!t||!t.value.trim()||!o||!o.value.trim())return console.error("Required fields missing or empty"),null;try{let r=new URL(n);return["email","firstname","lastname","message","Email","FirstName","LastName","Message"].forEach(d=>r.searchParams.delete(d)),r.searchParams.set("email",o.value.trim()),r.searchParams.set("firstname",e.value.trim()),r.searchParams.set("lastname",t.value.trim()),i&&i.value.trim()&&r.searchParams.set("message",i.value.trim()),r.toString()}catch(r){return console.error("Invalid URL:",r),null}}function a(){try{typeof l=="function"?l():window.location.href="/thank-you"}catch(n){console.error("Error during form submission:",n)}}function l(){if(!window.redirectionOptions||!window.redirectionOptions.type){console.error("window.redirectionOptions not found or missing type property");return}switch(window.redirectionOptions.type){case"calendly":p();break;case"hubspot":f();break;case"webflow":v();break;default:console.error("Invalid redirection type:",window.redirectionOptions.type);return}}function p(){let n=m(),e=window.redirectionOptions?.currentTab;n&&window.open(n,"_blank"),e&&(window.location.href=e)}function f(){let n=w(),e=window.redirectionOptions?.currentTab;n&&window.open(n,"_blank"),e&&(window.location.href=e)}function v(){let n=window.redirectionOptions?.newTab,e=window.redirectionOptions?.currentTab;n&&window.open(n,"_blank"),e&&(window.location.href=e)}function y(){document.querySelectorAll("select").forEach(e=>{let t=e.querySelector("option:first-child");t&&(t.setAttribute("value",""),t.setAttribute("disabled","disabled"),t.setAttribute("selected","selected"),e.selectedIndex=0,e.classList.add("placeholder-active"),e.value===""&&(e.style.color="#999999"),e.addEventListener("change",()=>{e.value?(e.style.color="",e.classList.remove("placeholder-active")):(e.style.color="#999999",e.classList.add("placeholder-active"))}))})}function b(){let n=document.querySelector("[data-form-handler]"),e=document.querySelector("#phone-number");if(!n||!e){console.error("Form or phone field not found");return}e.addEventListener("invalid",t=>{if(window.validatePhone){let o=window.validatePhone("phone-number",e.value);o.isValid||e.setCustomValidity(o.message||"Please enter a valid phone number")}}),e.addEventListener("input",()=>{e.setCustomValidity("")}),e.addEventListener("blur",()=>{if(window.validatePhone){let t=window.validatePhone("phone-number",e.value);!t.isValid&&e.value.trim()!==""?e.setCustomValidity(t.message||"Please enter a valid phone number"):e.setCustomValidity("")}}),n.addEventListener("submit",t=>{let o;if(typeof window.validatePhoneCustom=="function")o=window.validatePhoneCustom("phone-number",e.value);else if(typeof window.validatePhone=="function")o=window.validatePhone("phone-number",e.value);else return console.error("No phone validation function available"),t.preventDefault(),!1;return o.isValid?(e.setCustomValidity(""),window.validationPassed=!0,window._formSubmissionTime=Date.now(),setTimeout(()=>{console.log("Redirecting...."),a()},3e3),!0):(e.setCustomValidity(o.message||"Please enter a valid phone number"),t.preventDefault(),e.focus(),!1)},!0),(window.jQuery||window.$)&&(window.jQuery||window.$)(document).on("webflow-form-success",o=>{o.target===n&&(window.posthog&&window.getTrackingPropertiesWithForm&&window.posthog.capture("form_success",window.getTrackingPropertiesWithForm(window.interactedForm||"unknown_form")),a())})}document.addEventListener("DOMContentLoaded",()=>{let n=document.querySelector("#phone-number");n&&n.addEventListener("blur",()=>{if(typeof window.validatePhone=="function"){let e=window.validatePhone("phone-number",n.value);!e.isValid&&n.value.trim()!==""?n.setCustomValidity(e.message||"Please enter a valid phone number"):n.setCustomValidity("")}}),y(),u(),c(),b()});})();
1
+ "use strict";(()=>{window.validationPassed=!1;function u(n="#phone-number",e="#country-code"){let t=typeof n=="string"?document.querySelector(n):n,o=document.querySelector(e);if(!t||!o)return"91";try{if(t.iti&&typeof t.iti.getSelectedCountryData=="function"){let i=t.iti.getSelectedCountryData();return o.value="+"+i.dialCode,i.dialCode}else if(window.intlTelInputGlobals&&typeof window.intlTelInputGlobals.getInstance=="function"){let i=window.intlTelInputGlobals.getInstance(t);if(i){let r=i.getSelectedCountryData();return o.value="+"+r.dialCode,r.dialCode}}return o.value="+91","91"}catch(i){return console.error("Error retrieving country code:",i),o.value="+91","91"}}function c(){let n=document.getElementById("product"),e=document.getElementById("page-url");e&&(e.value=window.location.href),n&&(n.value=document.title)}function m(){if(!window.redirectionOptions||!window.redirectionOptions.newTab)return console.error("window.redirectionOptions not found or missing newTab property"),null;let n=window.redirectionOptions.newTab,e=document.getElementById("first-name"),t=document.getElementById("last-name"),o=document.getElementById("work-email");if(!e||!e.value.trim()||!t||!t.value.trim()||!o||!o.value.trim())return console.error("Required fields missing or empty"),null;let i=`${e.value} ${t.value}`.trim(),r=o.value;return`${n}?email=${encodeURIComponent(r)}&name=${encodeURIComponent(i)}`}function w(){if(!window.redirectionOptions||!window.redirectionOptions.newTab)return console.error("window.redirectionOptions not found or missing newTab property"),null;let n=window.redirectionOptions.newTab,e=document.getElementById("first-name"),t=document.getElementById("last-name"),o=document.getElementById("work-email"),i=document.getElementById("message");if(!e||!e.value.trim()||!t||!t.value.trim()||!o||!o.value.trim())return console.error("Required fields missing or empty"),null;try{let r=new URL(n);return["email","firstname","lastname","message","Email","FirstName","LastName","Message"].forEach(d=>r.searchParams.delete(d)),r.searchParams.set("email",o.value.trim()),r.searchParams.set("firstname",e.value.trim()),r.searchParams.set("lastname",t.value.trim()),i&&i.value.trim()&&r.searchParams.set("message",i.value.trim()),r.toString()}catch(r){return console.error("Invalid URL:",r),null}}function a(){try{typeof l=="function"?l():window.location.href="/thank-you"}catch(n){console.error("Error during form submission:",n)}}function l(){if(!window.redirectionOptions||!window.redirectionOptions.type){console.error("window.redirectionOptions not found or missing type property");return}switch(window.redirectionOptions.type){case"calendly":p();break;case"hubspot":f();break;case"webflow":v();break;default:console.error("Invalid redirection type:",window.redirectionOptions.type);return}}function p(){let n=m(),e=window.redirectionOptions?.currentTab;n&&window.open(n,"_blank"),e&&(window.location.href=e)}function f(){let n=w(),e=window.redirectionOptions?.currentTab;n&&window.open(n,"_blank"),e&&(window.location.href=e)}function v(){let n=window.redirectionOptions?.newTab,e=window.redirectionOptions?.currentTab;n&&window.open(n,"_blank"),e&&(window.location.href=e)}function y(){document.querySelectorAll("select").forEach(e=>{let t=e.querySelector("option:first-child");t&&(t.setAttribute("value",""),t.setAttribute("disabled","disabled"),t.setAttribute("selected","selected"),e.selectedIndex=0,e.classList.add("placeholder-active"),e.value===""&&(e.style.color="#999999"),e.addEventListener("change",()=>{e.value?(e.style.color="",e.classList.remove("placeholder-active")):(e.style.color="#999999",e.classList.add("placeholder-active"))}))})}function b(){let n=document.querySelector("[data-form-handler]"),e=document.querySelector("#phone-number");if(!n||!e){console.error("Form or phone field not found");return}e.addEventListener("invalid",t=>{if(window.validatePhone){let o=window.validatePhone("phone-number",e.value);o.isValid||e.setCustomValidity(o.message||"Please enter a valid phone number")}}),e.addEventListener("input",()=>{e.setCustomValidity("")}),e.addEventListener("blur",()=>{if(window.validatePhone){let t=window.validatePhone("phone-number",e.value);!t.isValid&&e.value.trim()!==""?e.setCustomValidity(t.message||"Please enter a valid phone number"):e.setCustomValidity("")}}),n.addEventListener("submit",t=>{let o;if(typeof window.validatePhoneCustom=="function")o=window.validatePhoneCustom("phone-number",e.value);else if(typeof window.validatePhone=="function")o=window.validatePhone("phone-number",e.value);else return console.error("No phone validation function available"),t.preventDefault(),!1;return o.isValid?(e.setCustomValidity(""),window.validationPassed=!0,window._formSubmissionTime=Date.now(),setTimeout(()=>{console.log("Redirecting...."),a()},3e3),!0):(e.setCustomValidity(o.message||"Please enter a valid phone number"),t.preventDefault(),e.focus(),!1)},!0),(window.jQuery||window.$)&&(window.jQuery||window.$)(document).on("webflow-form-success",o=>{o.target===n&&(window.posthog&&window.getTrackingPropertiesWithForm&&window.posthog.capture("form_success",window.getTrackingPropertiesWithForm(window.interactedForm||"unknown_form")),a())})}document.addEventListener("DOMContentLoaded",()=>{let n=document.querySelector("#phone-number");n&&n.addEventListener("blur",()=>{if(typeof window.validatePhone=="function"){let e=window.validatePhone("phone-number",n.value);!e.isValid&&n.value.trim()!==""?n.setCustomValidity(e.message||"Please enter a valid phone number"):n.setCustomValidity("")}}),y(),u(),c(),b()});})();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../bin/live-reload.js", "../../src/form/handler.ts"],
4
- "sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n console.log(\"Live reload disabled: not running on localhost\");\n}\n", "/**\n * Form Validation and Submission Script for Webflow\n * Handles phone validation, form submission prevention, and redirection logic\n * conververted version of https://cdn.jsdelivr.net/gh/Fynd-Design-Engineering/fynd-one@4.0.1/form/handler.min.js\n */\n\n// Type definitions\ninterface CountryData {\n dialCode: string;\n iso2: string;\n name: string;\n }\n \n interface IntlTelInputInstance {\n getSelectedCountryData(): CountryData;\n }\n \n interface PhoneInputElement extends HTMLInputElement {\n iti?: IntlTelInputInstance;\n }\n \n interface ValidationResult {\n isValid: boolean;\n message?: string;\n }\n \n interface RedirectionOptions {\n type: 'calendly' | 'hubspot' | 'webflow';\n newTab?: string;\n currentTab?: string;\n }\n \n // Extending Window interface for global variables\n declare global {\n interface Window {\n validationPassed?: boolean;\n _formSubmissionTime?: number;\n redirectionOptions?: RedirectionOptions;\n intlTelInputGlobals?: {\n getInstance(element: HTMLElement): IntlTelInputInstance | null;\n };\n validatePhone?: (selector: string, value: string) => ValidationResult;\n validatePhoneCustom?: (selector: string, value: string) => ValidationResult;\n jQuery?: any;\n $?: any;\n }\n }\n \n window.validationPassed = false; // Global flag to track validation status\n \n /**\n * Updates a hidden input with the country code from an initialized intl-tel-input element\n *\n * @param phoneInputSelector - Phone input element or its selector\n * @param countryCodeInputId - ID of the hidden input to update with country code\n */\n function updateCountryCode(\n phoneInputSelector: string | HTMLElement = \"#phone-number\",\n countryCodeInputId: string = \"#country-code\"\n ): string {\n const phoneInput: PhoneInputElement | null = \n typeof phoneInputSelector === \"string\"\n ? document.querySelector<PhoneInputElement>(phoneInputSelector)\n : phoneInputSelector as PhoneInputElement;\n \n const countryCodeInput = document.querySelector<HTMLInputElement>(countryCodeInputId);\n \n if (!phoneInput) {\n console.error(\"Phone input not found\");\n return \"91\";\n }\n \n if (!countryCodeInput) {\n console.error(\"Country code input not found\");\n return \"91\";\n }\n \n try {\n // Try to get country data directly - this will fail gracefully if not possible\n if (\n phoneInput.iti &&\n typeof phoneInput.iti.getSelectedCountryData === \"function\"\n ) {\n const countryData = phoneInput.iti.getSelectedCountryData();\n countryCodeInput.value = \"+\" + countryData.dialCode;\n return countryData.dialCode;\n } else if (\n window.intlTelInputGlobals &&\n typeof window.intlTelInputGlobals.getInstance === \"function\"\n ) {\n // Try using the global instance\n const iti = window.intlTelInputGlobals.getInstance(phoneInput);\n if (iti) {\n const countryData = iti.getSelectedCountryData();\n countryCodeInput.value = \"+\" + countryData.dialCode;\n return countryData.dialCode;\n }\n }\n \n // Default to India's country code (+91)\n countryCodeInput.value = \"+91\";\n return \"91\";\n } catch (error) {\n console.error(\"Error retrieving country code:\", error);\n // Default to India in case of error\n countryCodeInput.value = \"+91\";\n return \"91\";\n }\n }\n \n /**\n * Updates hidden inputs with page data like URL and page title\n */\n function updatePageData(): void {\n const productInput = document.getElementById(\"product\") as HTMLInputElement | null;\n const pageUrlInput = document.getElementById(\"page-url\") as HTMLInputElement | null;\n \n if (pageUrlInput) {\n pageUrlInput.value = window.location.href;\n }\n \n if (productInput) {\n productInput.value = document.title;\n }\n }\n \n /**\n * Generates a Calendly URL with user's information\n * @returns The Calendly URL or null if required fields are missing\n */\n function generateCalendlyURL(): string | null {\n if (!window.redirectionOptions || !window.redirectionOptions.newTab) {\n console.error(\n \"window.redirectionOptions not found or missing newTab property\"\n );\n return null;\n }\n \n const baseURL = window.redirectionOptions.newTab;\n const nameField = document.getElementById(\"first-name\") as HTMLInputElement | null;\n const lastNameField = document.getElementById(\"last-name\") as HTMLInputElement | null;\n const emailField = document.getElementById(\"work-email\") as HTMLInputElement | null;\n \n if (\n !nameField ||\n !nameField.value.trim() ||\n !lastNameField ||\n !lastNameField.value.trim() ||\n !emailField ||\n !emailField.value.trim()\n ) {\n console.error(\"Required fields missing or empty\");\n return null;\n }\n \n const fullName = `${nameField.value} ${lastNameField.value}`.trim();\n const email = emailField.value;\n const updatedURL = `${baseURL}?email=${encodeURIComponent(\n email\n )}&name=${encodeURIComponent(fullName)}`;\n return updatedURL;\n }\n \n /**\n * Generates a Hubspot URL with user's information\n * @returns The Hubspot URL or null if required fields are missing\n */\n function generateHubspotURL(): string | null {\n if (!window.redirectionOptions || !window.redirectionOptions.newTab) {\n console.error(\n \"window.redirectionOptions not found or missing newTab property\"\n );\n return null;\n }\n \n const baseURL = window.redirectionOptions.newTab;\n const nameField = document.getElementById(\"first-name\") as HTMLInputElement | null;\n const lastNameField = document.getElementById(\"last-name\") as HTMLInputElement | null;\n const emailField = document.getElementById(\"work-email\") as HTMLInputElement | null;\n const messageField = document.getElementById(\"message\") as HTMLTextAreaElement | null; // Optional field\n \n // Check only REQUIRED fields\n if (\n !nameField ||\n !nameField.value.trim() ||\n !lastNameField ||\n !lastNameField.value.trim() ||\n !emailField ||\n !emailField.value.trim()\n ) {\n console.error(\"Required fields missing or empty\");\n return null;\n }\n \n try {\n const url = new URL(baseURL);\n \n // Remove any existing params to avoid conflicts\n const paramsToRemove = [\n 'email', 'firstname', 'lastname', 'message',\n 'Email', 'FirstName', 'LastName', 'Message'\n ];\n \n paramsToRemove.forEach(param => url.searchParams.delete(param));\n \n // Add required parameters\n url.searchParams.set(\"email\", emailField.value.trim());\n url.searchParams.set(\"firstname\", nameField.value.trim());\n url.searchParams.set(\"lastname\", lastNameField.value.trim());\n \n // Add company parameter ONLY if field exists and has value\n if (messageField && messageField.value.trim()) {\n url.searchParams.set(\"message\", messageField.value.trim());\n }\n \n return url.toString();\n } catch (error) {\n console.error(\"Invalid URL:\", error);\n return null;\n }\n }\n \n\n \n /**\n * Handles the form submission process and redirection\n */\n function handleFormSubmission(): void {\n try {\n if (typeof handleRedirection === \"function\") {\n handleRedirection();\n } else {\n window.location.href = \"/thank-you\";\n }\n } catch (error) {\n console.error(\"Error during form submission:\", error);\n }\n }\n \n /**\n * Determines which type of redirection to perform\n */\n function handleRedirection(): void {\n if (!window.redirectionOptions || !window.redirectionOptions.type) {\n console.error(\n \"window.redirectionOptions not found or missing type property\"\n );\n return;\n }\n \n switch (window.redirectionOptions.type) {\n case \"calendly\":\n handleCalendlyRedirection();\n break;\n case \"hubspot\":\n handleHubspotRedirection();\n break;\n case \"webflow\":\n handleWebflowRedirection();\n break;\n default:\n console.error(\n \"Invalid redirection type:\",\n window.redirectionOptions.type\n );\n return;\n }\n }\n \n /**\n * Handles Calendly-specific redirection\n */\n function handleCalendlyRedirection(): void {\n const newTabUrl = generateCalendlyURL();\n const currentTabUrl = window.redirectionOptions?.currentTab;\n \n if (newTabUrl) {\n window.open(newTabUrl, \"_blank\");\n }\n \n if (currentTabUrl) {\n window.location.href = currentTabUrl;\n }\n }\n \n /**\n * Handles HubSpot-specific redirection\n */\n function handleHubspotRedirection(): void {\n const newTabUrl = generateHubspotURL();\n const currentTabUrl = window.redirectionOptions?.currentTab;\n \n if (newTabUrl) {\n window.open(newTabUrl, \"_blank\");\n }\n \n if (currentTabUrl) {\n window.location.href = currentTabUrl;\n }\n }\n \n /**\n * Handles Webflow-specific redirection\n */\n function handleWebflowRedirection(): void {\n const newTabUrl = window.redirectionOptions?.newTab;\n const currentTabUrl = window.redirectionOptions?.currentTab;\n \n if (newTabUrl) {\n window.open(newTabUrl, \"_blank\");\n }\n \n if (currentTabUrl) {\n window.location.href = currentTabUrl;\n }\n }\n \n /**\n * Converts the first option in select fields to actual placeholders with styling\n */\n function setupSelectPlaceholders(): void {\n // Find all select elements\n const selectFields = document.querySelectorAll<HTMLSelectElement>(\"select\");\n \n selectFields.forEach((select: HTMLSelectElement) => {\n // Get the first option\n const firstOption = select.querySelector<HTMLOptionElement>(\"option:first-child\");\n \n if (firstOption) {\n // Make it a true placeholder by adding these attributes\n firstOption.setAttribute(\"value\", \"\");\n firstOption.setAttribute(\"disabled\", \"disabled\");\n firstOption.setAttribute(\"selected\", \"selected\");\n \n // Set the select's initial selectedIndex to 0 (the placeholder)\n select.selectedIndex = 0;\n \n // Add a class to the select element to style it when showing placeholder\n select.classList.add(\"placeholder-active\");\n \n // Style the select element when showing the placeholder\n if (select.value === \"\") {\n select.style.color = \"#999999\"; // Placeholder color (gray)\n }\n \n // Change color when user selects a real option\n select.addEventListener(\"change\", () => {\n if (select.value) {\n select.style.color = \"\"; // Reset to default text color\n select.classList.remove(\"placeholder-active\");\n } else {\n select.style.color = \"#999999\"; // Back to placeholder color\n select.classList.add(\"placeholder-active\");\n }\n });\n }\n });\n \n // console.log(\"Select placeholders initialized\");\n }\n \n /**\n * Override Webflow's form submission functionality\n */\n function overrideWebflowFormSubmission(): void {\n const form = document.querySelector<HTMLFormElement>(\"[data-form-handler]\");\n const phoneField = document.querySelector<HTMLInputElement>(\"#phone-number\");\n \n if (!form || !phoneField) {\n console.error(\"Form or phone field not found\");\n return;\n }\n \n // Add validation using setCustomValidity\n phoneField.addEventListener(\"invalid\", (event: Event) => {\n if (window.validatePhone) {\n const validation = window.validatePhone(\"phone-number\", phoneField.value);\n if (!validation.isValid) {\n phoneField.setCustomValidity(\n validation.message || \"Please enter a valid phone number\"\n );\n }\n }\n });\n \n phoneField.addEventListener(\"input\", () => {\n phoneField.setCustomValidity(\"\");\n });\n \n phoneField.addEventListener(\"blur\", () => {\n if (window.validatePhone) {\n const validation = window.validatePhone(\"phone-number\", phoneField.value);\n if (!validation.isValid && phoneField.value.trim() !== \"\") {\n phoneField.setCustomValidity(\n validation.message || \"Please enter a valid phone number\"\n );\n } else {\n phoneField.setCustomValidity(\"\");\n }\n }\n });\n \n // Handle form submission with redirection\n form.addEventListener(\n \"submit\",\n (event: Event) => {\n // Use validatePhoneCustom as primary method (more reliable)\n let validation: ValidationResult;\n if (typeof window.validatePhoneCustom === \"function\") {\n validation = window.validatePhoneCustom(\n \"phone-number\",\n phoneField.value\n );\n } else if (typeof window.validatePhone === \"function\") {\n validation = window.validatePhone(\"phone-number\", phoneField.value);\n } else {\n console.error(\"No phone validation function available\");\n event.preventDefault();\n return false;\n }\n \n if (!validation.isValid) {\n phoneField.setCustomValidity(\n validation.message || \"Please enter a valid phone number\"\n );\n event.preventDefault();\n phoneField.focus();\n return false;\n } else {\n phoneField.setCustomValidity(\"\");\n \n // console.log(\"Validation passed, allowing form submission\");\n window.validationPassed = true;\n window._formSubmissionTime = Date.now();\n \n // Set up a delayed redirection that gives Webflow time to process\n setTimeout(() => {\n console.log(\"Redirecting....\");\n handleFormSubmission();\n }, 3000);\n \n // Let the form submit normally\n return true;\n }\n },\n true\n );\n \n // Additional Webflow success detection\n if (window.jQuery || window.$) {\n const $ = window.jQuery || window.$;\n \n // Listen for Webflow's success event\n $(document).on(\"webflow-form-success\", (e: any) => {\n if (e.target === form) {\n // console.log(\"Webflow success event detected\");\n if (window.posthog && window.getTrackingPropertiesWithForm) {\n window.posthog.capture(\n \"form_success\",\n window.getTrackingPropertiesWithForm(\n window.interactedForm || \"unknown_form\"\n )\n );\n }\n \n handleFormSubmission();\n } else {\n // event for error in future\n }\n });\n }\n \n // console.log(\"Form validation and redirection setup complete\");\n }\n \n /**\n * Initialize everything when the DOM is ready\n */\n document.addEventListener(\"DOMContentLoaded\", () => {\n // Detect phone input\n const phoneField = document.querySelector<HTMLInputElement>(\"#phone-number\");\n if (phoneField) {\n // Add validation on blur - using only browser validation\n phoneField.addEventListener(\"blur\", () => {\n if (typeof window.validatePhone === \"function\") {\n const validation = window.validatePhone(\n \"phone-number\",\n phoneField.value\n );\n if (!validation.isValid && phoneField.value.trim() !== \"\") {\n phoneField.setCustomValidity(\n validation.message || \"Please enter a valid phone number\"\n );\n } else {\n phoneField.setCustomValidity(\"\");\n }\n }\n });\n }\n \n // Select placeholders\n setupSelectPlaceholders();\n \n // Initialize country code and page data\n updateCountryCode();\n updatePageData();\n \n // Override Webflow form submission\n overrideWebflowFormSubmission();\n });\n\n// Export to make this file a module (fixes TypeScript global augmentation error)\nexport {};"],
5
- "mappings": ";;;AACA,MACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,QAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,MAAiB;AAAA,MAAU,MACpE,SAAS,OAAO;AAAA,IAClB;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,gDAAgD;AAAA,EAC9D;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AAI,iBAAiB;AAC7B,iCAAqB;AAAA,UACvB,GAAG,GAAI;AAGP,iBAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAGA,QAAI,OAAO,UAAU,OAAO,GAAG;AAC7B,YAAM,IAAI,OAAO,UAAU,OAAO;AAGlC,QAAE,QAAQ,EAAE,GAAG,wBAAwB,CAAC,MAAW;AACjD,YAAI,EAAE,WAAW,MAAM;AAErB,cAAI,OAAO,WAAW,OAAO,+BAA+B;AAC1D,mBAAO,QAAQ;AAAA,cACb;AAAA,cACA,OAAO;AAAA,gBACL,OAAO,kBAAkB;AAAA,cAC3B;AAAA,YACF;AAAA,UACF;AAEA,+BAAqB;AAAA,QACvB,OAAO;AAAA,QAEP;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAGF;AAKA,WAAS,iBAAiB,oBAAoB,MAAM;AAElD,UAAM,aAAa,SAAS,cAAgC,eAAe;AAC3E,QAAI,YAAY;AAEd,iBAAW,iBAAiB,QAAQ,MAAM;AACxC,YAAI,OAAO,OAAO,kBAAkB,YAAY;AAC9C,gBAAM,aAAa,OAAO;AAAA,YACxB;AAAA,YACA,WAAW;AAAA,UACb;AACA,cAAI,CAAC,WAAW,WAAW,WAAW,MAAM,KAAK,MAAM,IAAI;AACzD,uBAAW;AAAA,cACT,WAAW,WAAW;AAAA,YACxB;AAAA,UACF,OAAO;AACL,uBAAW,kBAAkB,EAAE;AAAA,UACjC;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAGA,4BAAwB;AAGxB,sBAAkB;AAClB,mBAAe;AAGf,kCAA8B;AAAA,EAChC,CAAC;",
4
+ "sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n console.log(\"Live reload disabled: not running on localhost\");\n}\n", "/**\n * Form Validation and Submission Script for Webflow\n * Handles phone validation, form submission prevention, and redirection logic\n * conververted version of https://cdn.jsdelivr.net/gh/Fynd-Design-Engineering/fynd-one@4.0.1/form/handler.min.js\n */\n\n// Type definitions\ninterface CountryData {\n dialCode: string;\n iso2: string;\n name: string;\n }\n \n interface IntlTelInputInstance {\n getSelectedCountryData(): CountryData;\n }\n \n interface PhoneInputElement extends HTMLInputElement {\n iti?: IntlTelInputInstance;\n }\n \n interface ValidationResult {\n isValid: boolean;\n message?: string;\n }\n \n interface RedirectionOptions {\n type: 'calendly' | 'hubspot' | 'webflow';\n newTab?: string;\n currentTab?: string;\n }\n \n // Extending Window interface for global variables\n declare global {\n interface Window {\n validationPassed?: boolean;\n _formSubmissionTime?: number;\n redirectionOptions?: RedirectionOptions;\n intlTelInputGlobals?: {\n getInstance(element: HTMLElement): IntlTelInputInstance | null;\n };\n validatePhone?: (selector: string, value: string) => ValidationResult;\n validatePhoneCustom?: (selector: string, value: string) => ValidationResult;\n jQuery?: any;\n $?: any;\n }\n }\n \n window.validationPassed = false; // Global flag to track validation status\n \n /**\n * Updates a hidden input with the country code from an initialized intl-tel-input element\n *\n * @param phoneInputSelector - Phone input element or its selector\n * @param countryCodeInputId - ID of the hidden input to update with country code\n */\n function updateCountryCode(\n phoneInputSelector: string | HTMLElement = \"#phone-number\",\n countryCodeInputId: string = \"#country-code\"\n ): string {\n const phoneInput: PhoneInputElement | null = \n typeof phoneInputSelector === \"string\"\n ? document.querySelector<PhoneInputElement>(phoneInputSelector)\n : phoneInputSelector as PhoneInputElement;\n \n const countryCodeInput = document.querySelector<HTMLInputElement>(countryCodeInputId);\n \n if (!phoneInput) {\n // console.error(\"Phone input not found\");\n return \"91\";\n }\n \n if (!countryCodeInput) {\n // console.error(\"Country code input not found\");\n return \"91\";\n }\n \n try {\n // Try to get country data directly - this will fail gracefully if not possible\n if (\n phoneInput.iti &&\n typeof phoneInput.iti.getSelectedCountryData === \"function\"\n ) {\n const countryData = phoneInput.iti.getSelectedCountryData();\n countryCodeInput.value = \"+\" + countryData.dialCode;\n return countryData.dialCode;\n } else if (\n window.intlTelInputGlobals &&\n typeof window.intlTelInputGlobals.getInstance === \"function\"\n ) {\n // Try using the global instance\n const iti = window.intlTelInputGlobals.getInstance(phoneInput);\n if (iti) {\n const countryData = iti.getSelectedCountryData();\n countryCodeInput.value = \"+\" + countryData.dialCode;\n return countryData.dialCode;\n }\n }\n \n // Default to India's country code (+91)\n countryCodeInput.value = \"+91\";\n return \"91\";\n } catch (error) {\n console.error(\"Error retrieving country code:\", error);\n // Default to India in case of error\n countryCodeInput.value = \"+91\";\n return \"91\";\n }\n }\n \n /**\n * Updates hidden inputs with page data like URL and page title\n */\n function updatePageData(): void {\n const productInput = document.getElementById(\"product\") as HTMLInputElement | null;\n const pageUrlInput = document.getElementById(\"page-url\") as HTMLInputElement | null;\n \n if (pageUrlInput) {\n pageUrlInput.value = window.location.href;\n }\n \n if (productInput) {\n productInput.value = document.title;\n }\n }\n \n /**\n * Generates a Calendly URL with user's information\n * @returns The Calendly URL or null if required fields are missing\n */\n function generateCalendlyURL(): string | null {\n if (!window.redirectionOptions || !window.redirectionOptions.newTab) {\n console.error(\n \"window.redirectionOptions not found or missing newTab property\"\n );\n return null;\n }\n \n const baseURL = window.redirectionOptions.newTab;\n const nameField = document.getElementById(\"first-name\") as HTMLInputElement | null;\n const lastNameField = document.getElementById(\"last-name\") as HTMLInputElement | null;\n const emailField = document.getElementById(\"work-email\") as HTMLInputElement | null;\n \n if (\n !nameField ||\n !nameField.value.trim() ||\n !lastNameField ||\n !lastNameField.value.trim() ||\n !emailField ||\n !emailField.value.trim()\n ) {\n console.error(\"Required fields missing or empty\");\n return null;\n }\n \n const fullName = `${nameField.value} ${lastNameField.value}`.trim();\n const email = emailField.value;\n const updatedURL = `${baseURL}?email=${encodeURIComponent(\n email\n )}&name=${encodeURIComponent(fullName)}`;\n return updatedURL;\n }\n \n /**\n * Generates a Hubspot URL with user's information\n * @returns The Hubspot URL or null if required fields are missing\n */\n function generateHubspotURL(): string | null {\n if (!window.redirectionOptions || !window.redirectionOptions.newTab) {\n console.error(\n \"window.redirectionOptions not found or missing newTab property\"\n );\n return null;\n }\n \n const baseURL = window.redirectionOptions.newTab;\n const nameField = document.getElementById(\"first-name\") as HTMLInputElement | null;\n const lastNameField = document.getElementById(\"last-name\") as HTMLInputElement | null;\n const emailField = document.getElementById(\"work-email\") as HTMLInputElement | null;\n const messageField = document.getElementById(\"message\") as HTMLTextAreaElement | null; // Optional field\n \n // Check only REQUIRED fields\n if (\n !nameField ||\n !nameField.value.trim() ||\n !lastNameField ||\n !lastNameField.value.trim() ||\n !emailField ||\n !emailField.value.trim()\n ) {\n console.error(\"Required fields missing or empty\");\n return null;\n }\n \n try {\n const url = new URL(baseURL);\n \n // Remove any existing params to avoid conflicts\n const paramsToRemove = [\n 'email', 'firstname', 'lastname', 'message',\n 'Email', 'FirstName', 'LastName', 'Message'\n ];\n \n paramsToRemove.forEach(param => url.searchParams.delete(param));\n \n // Add required parameters\n url.searchParams.set(\"email\", emailField.value.trim());\n url.searchParams.set(\"firstname\", nameField.value.trim());\n url.searchParams.set(\"lastname\", lastNameField.value.trim());\n \n // Add company parameter ONLY if field exists and has value\n if (messageField && messageField.value.trim()) {\n url.searchParams.set(\"message\", messageField.value.trim());\n }\n \n return url.toString();\n } catch (error) {\n console.error(\"Invalid URL:\", error);\n return null;\n }\n }\n \n\n \n /**\n * Handles the form submission process and redirection\n */\n function handleFormSubmission(): void {\n try {\n if (typeof handleRedirection === \"function\") {\n handleRedirection();\n } else {\n window.location.href = \"/thank-you\";\n }\n } catch (error) {\n console.error(\"Error during form submission:\", error);\n }\n }\n \n /**\n * Determines which type of redirection to perform\n */\n function handleRedirection(): void {\n if (!window.redirectionOptions || !window.redirectionOptions.type) {\n console.error(\n \"window.redirectionOptions not found or missing type property\"\n );\n return;\n }\n \n switch (window.redirectionOptions.type) {\n case \"calendly\":\n handleCalendlyRedirection();\n break;\n case \"hubspot\":\n handleHubspotRedirection();\n break;\n case \"webflow\":\n handleWebflowRedirection();\n break;\n default:\n console.error(\n \"Invalid redirection type:\",\n window.redirectionOptions.type\n );\n return;\n }\n }\n \n /**\n * Handles Calendly-specific redirection\n */\n function handleCalendlyRedirection(): void {\n const newTabUrl = generateCalendlyURL();\n const currentTabUrl = window.redirectionOptions?.currentTab;\n \n if (newTabUrl) {\n window.open(newTabUrl, \"_blank\");\n }\n \n if (currentTabUrl) {\n window.location.href = currentTabUrl;\n }\n }\n \n /**\n * Handles HubSpot-specific redirection\n */\n function handleHubspotRedirection(): void {\n const newTabUrl = generateHubspotURL();\n const currentTabUrl = window.redirectionOptions?.currentTab;\n \n if (newTabUrl) {\n window.open(newTabUrl, \"_blank\");\n }\n \n if (currentTabUrl) {\n window.location.href = currentTabUrl;\n }\n }\n \n /**\n * Handles Webflow-specific redirection\n */\n function handleWebflowRedirection(): void {\n const newTabUrl = window.redirectionOptions?.newTab;\n const currentTabUrl = window.redirectionOptions?.currentTab;\n \n if (newTabUrl) {\n window.open(newTabUrl, \"_blank\");\n }\n \n if (currentTabUrl) {\n window.location.href = currentTabUrl;\n }\n }\n \n /**\n * Converts the first option in select fields to actual placeholders with styling\n */\n function setupSelectPlaceholders(): void {\n // Find all select elements\n const selectFields = document.querySelectorAll<HTMLSelectElement>(\"select\");\n \n selectFields.forEach((select: HTMLSelectElement) => {\n // Get the first option\n const firstOption = select.querySelector<HTMLOptionElement>(\"option:first-child\");\n \n if (firstOption) {\n // Make it a true placeholder by adding these attributes\n firstOption.setAttribute(\"value\", \"\");\n firstOption.setAttribute(\"disabled\", \"disabled\");\n firstOption.setAttribute(\"selected\", \"selected\");\n \n // Set the select's initial selectedIndex to 0 (the placeholder)\n select.selectedIndex = 0;\n \n // Add a class to the select element to style it when showing placeholder\n select.classList.add(\"placeholder-active\");\n \n // Style the select element when showing the placeholder\n if (select.value === \"\") {\n select.style.color = \"#999999\"; // Placeholder color (gray)\n }\n \n // Change color when user selects a real option\n select.addEventListener(\"change\", () => {\n if (select.value) {\n select.style.color = \"\"; // Reset to default text color\n select.classList.remove(\"placeholder-active\");\n } else {\n select.style.color = \"#999999\"; // Back to placeholder color\n select.classList.add(\"placeholder-active\");\n }\n });\n }\n });\n \n // console.log(\"Select placeholders initialized\");\n }\n \n /**\n * Override Webflow's form submission functionality\n */\n function overrideWebflowFormSubmission(): void {\n const form = document.querySelector<HTMLFormElement>(\"[data-form-handler]\");\n const phoneField = document.querySelector<HTMLInputElement>(\"#phone-number\");\n \n if (!form || !phoneField) {\n console.error(\"Form or phone field not found\");\n return;\n }\n \n // Add validation using setCustomValidity\n phoneField.addEventListener(\"invalid\", (event: Event) => {\n if (window.validatePhone) {\n const validation = window.validatePhone(\"phone-number\", phoneField.value);\n if (!validation.isValid) {\n phoneField.setCustomValidity(\n validation.message || \"Please enter a valid phone number\"\n );\n }\n }\n });\n \n phoneField.addEventListener(\"input\", () => {\n phoneField.setCustomValidity(\"\");\n });\n \n phoneField.addEventListener(\"blur\", () => {\n if (window.validatePhone) {\n const validation = window.validatePhone(\"phone-number\", phoneField.value);\n if (!validation.isValid && phoneField.value.trim() !== \"\") {\n phoneField.setCustomValidity(\n validation.message || \"Please enter a valid phone number\"\n );\n } else {\n phoneField.setCustomValidity(\"\");\n }\n }\n });\n \n // Handle form submission with redirection\n form.addEventListener(\n \"submit\",\n (event: Event) => {\n // Use validatePhoneCustom as primary method (more reliable)\n let validation: ValidationResult;\n if (typeof window.validatePhoneCustom === \"function\") {\n validation = window.validatePhoneCustom(\n \"phone-number\",\n phoneField.value\n );\n } else if (typeof window.validatePhone === \"function\") {\n validation = window.validatePhone(\"phone-number\", phoneField.value);\n } else {\n console.error(\"No phone validation function available\");\n event.preventDefault();\n return false;\n }\n \n if (!validation.isValid) {\n phoneField.setCustomValidity(\n validation.message || \"Please enter a valid phone number\"\n );\n event.preventDefault();\n phoneField.focus();\n return false;\n } else {\n phoneField.setCustomValidity(\"\");\n \n // console.log(\"Validation passed, allowing form submission\");\n window.validationPassed = true;\n window._formSubmissionTime = Date.now();\n \n // Set up a delayed redirection that gives Webflow time to process\n setTimeout(() => {\n console.log(\"Redirecting....\");\n handleFormSubmission();\n }, 3000);\n \n // Let the form submit normally\n return true;\n }\n },\n true\n );\n \n // Additional Webflow success detection\n if (window.jQuery || window.$) {\n const $ = window.jQuery || window.$;\n \n // Listen for Webflow's success event\n $(document).on(\"webflow-form-success\", (e: any) => {\n if (e.target === form) {\n // console.log(\"Webflow success event detected\");\n if (window.posthog && window.getTrackingPropertiesWithForm) {\n window.posthog.capture(\n \"form_success\",\n window.getTrackingPropertiesWithForm(\n window.interactedForm || \"unknown_form\"\n )\n );\n }\n \n handleFormSubmission();\n } else {\n // event for error in future\n }\n });\n }\n \n // console.log(\"Form validation and redirection setup complete\");\n }\n \n /**\n * Initialize everything when the DOM is ready\n */\n document.addEventListener(\"DOMContentLoaded\", () => {\n // Detect phone input\n const phoneField = document.querySelector<HTMLInputElement>(\"#phone-number\");\n if (phoneField) {\n // Add validation on blur - using only browser validation\n phoneField.addEventListener(\"blur\", () => {\n if (typeof window.validatePhone === \"function\") {\n const validation = window.validatePhone(\n \"phone-number\",\n phoneField.value\n );\n if (!validation.isValid && phoneField.value.trim() !== \"\") {\n phoneField.setCustomValidity(\n validation.message || \"Please enter a valid phone number\"\n );\n } else {\n phoneField.setCustomValidity(\"\");\n }\n }\n });\n }\n \n // Select placeholders\n setupSelectPlaceholders();\n \n // Initialize country code and page data\n updateCountryCode();\n updatePageData();\n \n // Override Webflow form submission\n overrideWebflowFormSubmission();\n });\n\n// Export to make this file a module (fixes TypeScript global augmentation error)\nexport {};"],
5
+ "mappings": ";;;AACA,MACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,QAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,MAAiB;AAAA,MAAU,MACpE,SAAS,OAAO;AAAA,IAClB;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,gDAAgD;AAAA,EAC9D;;;AC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BAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAGA,QAAI,OAAO,UAAU,OAAO,GAAG;AAC7B,YAAM,IAAI,OAAO,UAAU,OAAO;AAGlC,QAAE,QAAQ,EAAE,GAAG,wBAAwB,CAAC,MAAW;AACjD,YAAI,EAAE,WAAW,MAAM;AAErB,cAAI,OAAO,WAAW,OAAO,+BAA+B;AAC1D,mBAAO,QAAQ;AAAA,cACb;AAAA,cACA,OAAO;AAAA,gBACL,OAAO,kBAAkB;AAAA,cAC3B;AAAA,YACF;AAAA,UACF;AAEA,+BAAqB;AAAA,QACvB,OAAO;AAAA,QAEP;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAGF;AAKA,WAAS,iBAAiB,oBAAoB,MAAM;AAElD,UAAM,aAAa,SAAS,cAAgC,eAAe;AAC3E,QAAI,YAAY;AAEd,iBAAW,iBAAiB,QAAQ,MAAM;AACxC,YAAI,OAAO,OAAO,kBAAkB,YAAY;AAC9C,gBAAM,aAAa,OAAO;AAAA,YACxB;AAAA,YACA,WAAW;AAAA,UACb;AACA,cAAI,CAAC,WAAW,WAAW,WAAW,MAAM,KAAK,MAAM,IAAI;AACzD,uBAAW;AAAA,cACT,WAAW,WAAW;AAAA,YACxB;AAAA,UACF,OAAO;AACL,uBAAW,kBAAkB,EAAE;AAAA,UACjC;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAGA,4BAAwB;AAGxB,sBAAkB;AAClB,mBAAe;AAGf,kCAA8B;AAAA,EAChC,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- "use strict";(()=>{console.log(" \u{1F525} Secondary Navigation");var v=null,N=!0,A=!1,k=!1,p=!1,l=class{static hasAnyActiveNavLink(){return document.querySelectorAll('[fynd-secondary-navlink-active="true"]').length>0}static checkIfAnySectionVisible(){let t=document.querySelectorAll("[fynd-secondary-nav-id]"),e=window.innerHeight;for(let n of t){let i=n.getBoundingClientRect(),s=Math.min(i.bottom,e)-Math.max(i.top,0),o=i.height;if((s>0?s/o*100:0)>50)return!0}return!1}static findMostVisibleSection(){let t=document.querySelectorAll("[fynd-secondary-nav-id]"),e=window.innerHeight,n=null,i=0;return t.forEach(s=>{let o=s.getAttribute("fynd-secondary-nav-id");if(!o)return;let a=s.getBoundingClientRect(),r=Math.min(a.bottom,e)-Math.max(a.top,0),g=a.height,c=r>0?r/g*100:0;c>50&&c>i&&(i=c,n=o)}),n}static getCurrentSectionGroup(t){let e=v||d.getSecondaryNavItems();for(let n of e)if(n.Links.find(s=>s.id===t))return n.groupName;return null}static getAdjacentSections(t){let e=Array.from(document.querySelectorAll("[fynd-secondary-nav-id]")),n=e.findIndex(s=>s.getAttribute("fynd-secondary-nav-id")===t),i=[];if(n>0){let s=e[n-1].getAttribute("fynd-secondary-nav-id");s&&i.push({id:s,position:"previous"})}if(n<e.length-1){let s=e[n+1].getAttribute("fynd-secondary-nav-id");s&&i.push({id:s,position:"next"})}return i}static getGroupSections(t){let n=(v||d.getSecondaryNavItems()).find(i=>i.groupName===t);return n?n.Links:[]}},d=class{static getSecondaryNavItems(){if(v)return v;let t=document.querySelectorAll('[fynd-secondary-nav="true"]'),e={};t.forEach((i,s)=>{let o=i.getAttribute("fynd-secondary-nav-text"),a=i.getAttribute("fynd-secondary-nav-group"),r=i.getAttribute("fynd-secondary-nav-id");r||(r=`secondary-nav-${a}-${s}-${Date.now()}`,i.setAttribute("fynd-secondary-nav-id",r));let c=i.querySelector("[fynd-scroll-target]")?.getAttribute("fynd-scroll-target");o&&a&&c&&(e[a]||(e[a]=[]),e[a].push({id:r,Text:o,link:c}))});let n=Object.keys(e).map(i=>({groupName:i,Links:e[i]}));return v=n,n}static getSecondaryNavJSON(){let t=this.getSecondaryNavItems();return JSON.stringify(t,null,2)}static getCurrentlyVisibleGroup(){let t=document.querySelectorAll("[fynd-secondary-nav-id]"),e={};t.forEach(s=>{let o=s.getAttribute("fynd-secondary-nav-id");if(!o)return;let a=l.getCurrentSectionGroup(o);if(!a)return;let r=s.getBoundingClientRect(),g=window.innerHeight,c=Math.min(r.bottom,g)-Math.max(r.top,0),m=r.height,L=c>0?c/m*100:0;L>0&&(e[a]||(e[a]=0),e[a]+=L)});let n=null,i=25;return Object.entries(e).forEach(([s,o])=>{o>i&&(i=o,n=s)}),n}},y=class{static setAllNavLinksInactive(){l.checkIfAnySectionVisible()||document.querySelectorAll("[fynd-secondary-navlink-active]").forEach(e=>{e.setAttribute("fynd-secondary-navlink-active","false")})}static activateNavLink(t){document.querySelectorAll("[fynd-secondary-navlink-active]").forEach(i=>{i.getAttribute("fynd-secondary-navlink-id")!==t&&i.setAttribute("fynd-secondary-navlink-active","false")});let n=document.querySelector(`[fynd-secondary-navlink-active][fynd-secondary-navlink-id="${t}"]`);n?n.setAttribute("fynd-secondary-navlink-active","true"):console.warn(`\u274C No matching nav link found for section: ${t}`)}static setActiveTab(){document.querySelectorAll("[fynd-secondary-navlink-active]").forEach(e=>{e.getAttribute("fynd-anchor-active")==="true"?e.setAttribute("fynd-secondary-navlink-active","true"):e.setAttribute("fynd-secondary-navlink-active","false")})}},S=class{static toggleSecondaryNav(t){if(p||k===t)return;let e=document.querySelector('[fynd-secondary-nav="wrapper"]');if(!e){console.warn("Secondary nav wrapper not found");return}p=!0,k=t,t?this.showSecondaryNav(e):this.hideSecondaryNav(e)}static showSecondaryNav(t){t.style.transform="translateY(-100px)",t.style.display="block",t.offsetHeight,t.style.transition="transform 300ms ease",t.style.transform="translateY(0px)",this.updateNavigationScrolledStyle(!0),setTimeout(()=>{t.style.transition="",p=!1},300)}static hideSecondaryNav(t){t.style.transition="transform 300ms ease",t.style.transform="translateY(-100px)",this.updateNavigationScrolledStyle(!1),setTimeout(()=>{t.style.display="none",t.style.transition="",p=!1},300)}static updateNavigationScrolledStyle(t){let e=document.querySelector("[navigation-scrolled]");if(!e){console.warn("Element with [navigation-scrolled] attribute not found");return}t?e.style.boxShadow="none":e.style.removeProperty("box-shadow")}},u=class{static updateGroupVisibility(t){this.updateNavLinkVisibility(t),this.updateWrapperVisibility(t)}static updateNavLinkVisibility(t){document.querySelectorAll('[fynd-secondary-nav="link"]').forEach(n=>{let i=n.getAttribute("fynd-secondary-navgroup");t&&i===t?(n.style.display="",n.setAttribute("fynd-group-visible","true")):(n.style.display="none",n.setAttribute("fynd-group-visible","false"))})}static updateWrapperVisibility(t){let e=l.hasAnyActiveNavLink(),n=t!==null&&e;S.toggleSecondaryNav(n)}},h=class{static handleNavigation(t){if(!document.querySelector(`[fynd-secondary-nav-id="${t}"]`))return;let n=l.getCurrentSectionGroup(t);if(!n){u.updateGroupVisibility(null);return}u.updateGroupVisibility(n),l.getAdjacentSections(t).some(o=>l.getCurrentSectionGroup(o.id)===n)?this.handleGroupSequentialNavigation(t,n):y.activateNavLink(t)}static handleGroupSequentialNavigation(t,e){let n=l.getGroupSections(e);n.findIndex(s=>s.id===t)!==-1&&(n.forEach(s=>{let o=document.querySelector(`[fynd-secondary-navlink-id="${s.id}"]`);o&&o.setAttribute("fynd-secondary-navlink-active","false")}),y.activateNavLink(t))}static checkInitialGroupVisibility(){let t=d.getCurrentlyVisibleGroup();if(t){let e=l.findMostVisibleSection();e&&l.getCurrentSectionGroup(e)===t&&y.activateNavLink(e),u.updateGroupVisibility(t)}else u.updateGroupVisibility(null)}},b=class{static initSecondarynav(){let t=d.getSecondaryNavItems();if(t.length===0)return;let e=document.querySelector('[fynd-secondary-nav="slot"]');if(!e){console.warn("Secondary nav slot not found");return}this.buildNavLinks(e,t),this.initializeScrollNavigation()}static buildNavLinks(t,e){t.innerHTML="",e.forEach(n=>{n.Links.forEach(i=>{let s=this.createNavLinkElement(i,n.groupName);t.appendChild(s)})})}static createNavLinkElement(t,e){let n=document.createElement("div");return n.setAttribute("fynd-secondary-nav","link"),n.setAttribute("fynd-secondary-navgroup",e),n.setAttribute("fynd-secondary-navlink-id",t.id),n.setAttribute("fynd-scroll-trigger",t.link),n.setAttribute("data-text-style","body-m-regular"),n.setAttribute("fynd-secondary-navlink-active","false"),n.textContent=t.Text,n.addEventListener("click",()=>{setTimeout(()=>{y.setActiveTab()},50)}),n}static initializeScrollNavigation(){window.scrollNavigation?.fullReinitialize()}static initSecondarynavScroll(){let t=document.querySelectorAll("[fynd-secondary-nav-id]");t.length!==0&&(this.setupScrollTriggers(t),this.finalizeInitialization(t.length))}static setupScrollTriggers(t){let e=v||d.getSecondaryNavItems();t.forEach(n=>{let i=n.getAttribute("fynd-secondary-nav-id");if(!i)return;let s=this.findCorrespondingData(i,e);s&&this.createScrollTrigger(n,i,s)})}static findCorrespondingData(t,e){for(let n of e){let i=n.Links.find(s=>s.id===t);if(i)return i}return null}static createScrollTrigger(t,e,n){window.gsap.registerPlugin(window.ScrollTrigger),window.ScrollTrigger.create({trigger:t,start:"top bottom",end:"bottom top",onUpdate:i=>{if(N)return;let s=t.getBoundingClientRect(),o=window.innerHeight,a=Math.min(s.bottom,o)-Math.max(s.top,0),r=s.height,g=a>0?a/r*100:0,c=l.findMostVisibleSection();if(c&&c===e&&g>50)h.handleNavigation(e);else if(!c){let m=d.getCurrentlyVisibleGroup();m?u.updateGroupVisibility(m):setTimeout(()=>{l.checkIfAnySectionVisible()||(y.setAllNavLinksInactive(),u.updateGroupVisibility(null))},10)}}})}static finalizeInitialization(t){A=!0,setTimeout(()=>{N=!1,h.checkInitialGroupVisibility()},500)}},T=d.getSecondaryNavItems();console.log(T);document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{v=null,N=!0,b.initSecondarynav(),setTimeout(()=>{b.initSecondarynavScroll()},300)},200)});})();
1
+ "use strict";(()=>{var v=null,N=!0,A=!1,k=!1,p=!1,l=class{static hasAnyActiveNavLink(){return document.querySelectorAll('[fynd-secondary-navlink-active="true"]').length>0}static checkIfAnySectionVisible(){let t=document.querySelectorAll("[fynd-secondary-nav-id]"),e=window.innerHeight;for(let n of t){let i=n.getBoundingClientRect(),s=Math.min(i.bottom,e)-Math.max(i.top,0),o=i.height;if((s>0?s/o*100:0)>50)return!0}return!1}static findMostVisibleSection(){let t=document.querySelectorAll("[fynd-secondary-nav-id]"),e=window.innerHeight,n=null,i=0;return t.forEach(s=>{let o=s.getAttribute("fynd-secondary-nav-id");if(!o)return;let a=s.getBoundingClientRect(),r=Math.min(a.bottom,e)-Math.max(a.top,0),g=a.height,c=r>0?r/g*100:0;c>50&&c>i&&(i=c,n=o)}),n}static getCurrentSectionGroup(t){let e=v||d.getSecondaryNavItems();for(let n of e)if(n.Links.find(s=>s.id===t))return n.groupName;return null}static getAdjacentSections(t){let e=Array.from(document.querySelectorAll("[fynd-secondary-nav-id]")),n=e.findIndex(s=>s.getAttribute("fynd-secondary-nav-id")===t),i=[];if(n>0){let s=e[n-1].getAttribute("fynd-secondary-nav-id");s&&i.push({id:s,position:"previous"})}if(n<e.length-1){let s=e[n+1].getAttribute("fynd-secondary-nav-id");s&&i.push({id:s,position:"next"})}return i}static getGroupSections(t){let n=(v||d.getSecondaryNavItems()).find(i=>i.groupName===t);return n?n.Links:[]}},d=class{static getSecondaryNavItems(){if(v)return v;let t=document.querySelectorAll('[fynd-secondary-nav="true"]'),e={};t.forEach((i,s)=>{let o=i.getAttribute("fynd-secondary-nav-text"),a=i.getAttribute("fynd-secondary-nav-group"),r=i.getAttribute("fynd-secondary-nav-id");r||(r=`secondary-nav-${a}-${s}-${Date.now()}`,i.setAttribute("fynd-secondary-nav-id",r));let c=i.querySelector("[fynd-scroll-target]")?.getAttribute("fynd-scroll-target");o&&a&&c&&(e[a]||(e[a]=[]),e[a].push({id:r,Text:o,link:c}))});let n=Object.keys(e).map(i=>({groupName:i,Links:e[i]}));return v=n,n}static getSecondaryNavJSON(){let t=this.getSecondaryNavItems();return JSON.stringify(t,null,2)}static getCurrentlyVisibleGroup(){let t=document.querySelectorAll("[fynd-secondary-nav-id]"),e={};t.forEach(s=>{let o=s.getAttribute("fynd-secondary-nav-id");if(!o)return;let a=l.getCurrentSectionGroup(o);if(!a)return;let r=s.getBoundingClientRect(),g=window.innerHeight,c=Math.min(r.bottom,g)-Math.max(r.top,0),m=r.height,L=c>0?c/m*100:0;L>0&&(e[a]||(e[a]=0),e[a]+=L)});let n=null,i=25;return Object.entries(e).forEach(([s,o])=>{o>i&&(i=o,n=s)}),n}},y=class{static setAllNavLinksInactive(){l.checkIfAnySectionVisible()||document.querySelectorAll("[fynd-secondary-navlink-active]").forEach(e=>{e.setAttribute("fynd-secondary-navlink-active","false")})}static activateNavLink(t){document.querySelectorAll("[fynd-secondary-navlink-active]").forEach(i=>{i.getAttribute("fynd-secondary-navlink-id")!==t&&i.setAttribute("fynd-secondary-navlink-active","false")});let n=document.querySelector(`[fynd-secondary-navlink-active][fynd-secondary-navlink-id="${t}"]`);n?n.setAttribute("fynd-secondary-navlink-active","true"):console.warn(`\u274C No matching nav link found for section: ${t}`)}static setActiveTab(){document.querySelectorAll("[fynd-secondary-navlink-active]").forEach(e=>{e.getAttribute("fynd-anchor-active")==="true"?e.setAttribute("fynd-secondary-navlink-active","true"):e.setAttribute("fynd-secondary-navlink-active","false")})}},S=class{static toggleSecondaryNav(t){if(p||k===t)return;let e=document.querySelector('[fynd-secondary-nav="wrapper"]');if(!e){console.warn("Secondary nav wrapper not found");return}p=!0,k=t,t?this.showSecondaryNav(e):this.hideSecondaryNav(e)}static showSecondaryNav(t){t.style.transform="translateY(-100px)",t.style.display="block",t.offsetHeight,t.style.transition="transform 300ms ease",t.style.transform="translateY(0px)",this.updateNavigationScrolledStyle(!0),setTimeout(()=>{t.style.transition="",p=!1},300)}static hideSecondaryNav(t){t.style.transition="transform 300ms ease",t.style.transform="translateY(-100px)",this.updateNavigationScrolledStyle(!1),setTimeout(()=>{t.style.display="none",t.style.transition="",p=!1},300)}static updateNavigationScrolledStyle(t){let e=document.querySelector("[navigation-scrolled]");if(!e){console.warn("Element with [navigation-scrolled] attribute not found");return}t?e.style.boxShadow="none":e.style.removeProperty("box-shadow")}},u=class{static updateGroupVisibility(t){this.updateNavLinkVisibility(t),this.updateWrapperVisibility(t)}static updateNavLinkVisibility(t){document.querySelectorAll('[fynd-secondary-nav="link"]').forEach(n=>{let i=n.getAttribute("fynd-secondary-navgroup");t&&i===t?(n.style.display="",n.setAttribute("fynd-group-visible","true")):(n.style.display="none",n.setAttribute("fynd-group-visible","false"))})}static updateWrapperVisibility(t){let e=l.hasAnyActiveNavLink(),n=t!==null&&e;S.toggleSecondaryNav(n)}},h=class{static handleNavigation(t){if(!document.querySelector(`[fynd-secondary-nav-id="${t}"]`))return;let n=l.getCurrentSectionGroup(t);if(!n){u.updateGroupVisibility(null);return}u.updateGroupVisibility(n),l.getAdjacentSections(t).some(o=>l.getCurrentSectionGroup(o.id)===n)?this.handleGroupSequentialNavigation(t,n):y.activateNavLink(t)}static handleGroupSequentialNavigation(t,e){let n=l.getGroupSections(e);n.findIndex(s=>s.id===t)!==-1&&(n.forEach(s=>{let o=document.querySelector(`[fynd-secondary-navlink-id="${s.id}"]`);o&&o.setAttribute("fynd-secondary-navlink-active","false")}),y.activateNavLink(t))}static checkInitialGroupVisibility(){let t=d.getCurrentlyVisibleGroup();if(t){let e=l.findMostVisibleSection();e&&l.getCurrentSectionGroup(e)===t&&y.activateNavLink(e),u.updateGroupVisibility(t)}else u.updateGroupVisibility(null)}},b=class{static initSecondarynav(){let t=d.getSecondaryNavItems();if(t.length===0)return;let e=document.querySelector('[fynd-secondary-nav="slot"]');if(!e){console.warn("Secondary nav slot not found");return}this.buildNavLinks(e,t),this.initializeScrollNavigation()}static buildNavLinks(t,e){t.innerHTML="",e.forEach(n=>{n.Links.forEach(i=>{let s=this.createNavLinkElement(i,n.groupName);t.appendChild(s)})})}static createNavLinkElement(t,e){let n=document.createElement("div");return n.setAttribute("fynd-secondary-nav","link"),n.setAttribute("fynd-secondary-navgroup",e),n.setAttribute("fynd-secondary-navlink-id",t.id),n.setAttribute("fynd-scroll-trigger",t.link),n.setAttribute("data-text-style","body-m-regular"),n.setAttribute("fynd-secondary-navlink-active","false"),n.textContent=t.Text,n.addEventListener("click",()=>{setTimeout(()=>{y.setActiveTab()},50)}),n}static initializeScrollNavigation(){window.scrollNavigation?.fullReinitialize()}static initSecondarynavScroll(){let t=document.querySelectorAll("[fynd-secondary-nav-id]");t.length!==0&&(this.setupScrollTriggers(t),this.finalizeInitialization(t.length))}static setupScrollTriggers(t){let e=v||d.getSecondaryNavItems();t.forEach(n=>{let i=n.getAttribute("fynd-secondary-nav-id");if(!i)return;let s=this.findCorrespondingData(i,e);s&&this.createScrollTrigger(n,i,s)})}static findCorrespondingData(t,e){for(let n of e){let i=n.Links.find(s=>s.id===t);if(i)return i}return null}static createScrollTrigger(t,e,n){window.gsap.registerPlugin(window.ScrollTrigger),window.ScrollTrigger.create({trigger:t,start:"top bottom",end:"bottom top",onUpdate:i=>{if(N)return;let s=t.getBoundingClientRect(),o=window.innerHeight,a=Math.min(s.bottom,o)-Math.max(s.top,0),r=s.height,g=a>0?a/r*100:0,c=l.findMostVisibleSection();if(c&&c===e&&g>50)h.handleNavigation(e);else if(!c){let m=d.getCurrentlyVisibleGroup();m?u.updateGroupVisibility(m):setTimeout(()=>{l.checkIfAnySectionVisible()||(y.setAllNavLinksInactive(),u.updateGroupVisibility(null))},10)}}})}static finalizeInitialization(t){A=!0,setTimeout(()=>{N=!1,h.checkInitialGroupVisibility()},500)}},T=d.getSecondaryNavItems();document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{v=null,N=!0,b.initSecondarynav(),setTimeout(()=>{b.initSecondarynavScroll()},300)},200)});})();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../bin/live-reload.js", "../../../src/navigation/secondary-navigation/index.ts"],
4
- "sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n console.log(\"Live reload disabled: not running on localhost\");\n}\n", "console.log(\" \uD83D\uDD25 Secondary Navigation\");\n\n// ===============================\n// TYPE DEFINITIONS\n// ===============================\ninterface NavLink {\n id: string;\n Text: string;\n link: string;\n}\n\ninterface NavGroup {\n groupName: string;\n Links: NavLink[];\n}\n\ninterface AdjacentSection {\n id: string;\n position: 'previous' | 'next';\n}\n\n// ===============================\n// GLOBAL STATE\n// ===============================\nlet cachedSecondaryNavItems: NavGroup[] | null = null;\nlet isInitialLoad = true;\nlet scrollTrackingInitialized = false;\nlet isSecondaryNavigationVisible = false;\nlet isAnimating = false;\n\n// ===============================\n// UTILITY FUNCTIONS\n// ===============================\nclass SecondaryNavUtils {\n static hasAnyActiveNavLink(): boolean {\n const activeNavLinks = document.querySelectorAll('[fynd-secondary-navlink-active=\"true\"]') as NodeListOf<HTMLElement>;\n return activeNavLinks.length > 0;\n }\n\n static checkIfAnySectionVisible(): boolean {\n const navSections = document.querySelectorAll('[fynd-secondary-nav-id]') as NodeListOf<HTMLElement>;\n const viewportHeight = window.innerHeight;\n \n for (const section of navSections) {\n const rect = section.getBoundingClientRect();\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n const sectionHeight = rect.height;\n const visibilityPercentage = visibleHeight > 0 ? (visibleHeight / sectionHeight) * 100 : 0;\n \n if (visibilityPercentage > 50) {\n return true;\n }\n }\n return false;\n }\n\n static findMostVisibleSection(): string | null {\n const navSections = document.querySelectorAll('[fynd-secondary-nav-id]') as NodeListOf<HTMLElement>;\n const viewportHeight = window.innerHeight;\n let mostVisibleSection: string | null = null;\n let highestVisibility = 0;\n \n navSections.forEach((section) => {\n const sectionId = section.getAttribute('fynd-secondary-nav-id');\n if (!sectionId) return;\n \n const rect = section.getBoundingClientRect();\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n const sectionHeight = rect.height;\n const visibilityPercentage = visibleHeight > 0 ? (visibleHeight / sectionHeight) * 100 : 0;\n \n if (visibilityPercentage > 50 && visibilityPercentage > highestVisibility) {\n highestVisibility = visibilityPercentage;\n mostVisibleSection = sectionId;\n }\n });\n \n return mostVisibleSection;\n }\n\n static getCurrentSectionGroup(sectionId: string): string | null {\n const secondaryNavItems = cachedSecondaryNavItems || SecondaryNavData.getSecondaryNavItems();\n \n for (const group of secondaryNavItems) {\n const found = group.Links.find(link => link.id === sectionId);\n if (found) {\n return group.groupName;\n }\n }\n return null;\n }\n\n static getAdjacentSections(currentSectionId: string): AdjacentSection[] {\n const allSections = Array.from(document.querySelectorAll('[fynd-secondary-nav-id]')) as HTMLElement[];\n const currentIndex = allSections.findIndex(section => \n section.getAttribute('fynd-secondary-nav-id') === currentSectionId\n );\n \n const adjacent: AdjacentSection[] = [];\n \n if (currentIndex > 0) {\n const prevId = allSections[currentIndex - 1].getAttribute('fynd-secondary-nav-id');\n if (prevId) adjacent.push({ id: prevId, position: 'previous' });\n }\n \n if (currentIndex < allSections.length - 1) {\n const nextId = allSections[currentIndex + 1].getAttribute('fynd-secondary-nav-id');\n if (nextId) adjacent.push({ id: nextId, position: 'next' });\n }\n \n return adjacent;\n }\n\n static getGroupSections(groupName: string): NavLink[] {\n const secondaryNavItems = cachedSecondaryNavItems || SecondaryNavData.getSecondaryNavItems();\n const group = secondaryNavItems.find(g => g.groupName === groupName);\n return group ? group.Links : [];\n }\n}\n\n// ===============================\n// DATA MANAGEMENT\n// ===============================\nclass SecondaryNavData {\n static getSecondaryNavItems(): NavGroup[] {\n if (cachedSecondaryNavItems) {\n return cachedSecondaryNavItems;\n }\n \n const secondaryNavDivs: NodeListOf<HTMLDivElement> = document.querySelectorAll('[fynd-secondary-nav=\"true\"]');\n const groupedNavs: { [key: string]: NavLink[] } = {};\n \n secondaryNavDivs.forEach((div: HTMLDivElement, index: number) => {\n const navText: string | null = div.getAttribute('fynd-secondary-nav-text');\n const navGroup: string | null = div.getAttribute('fynd-secondary-nav-group');\n \n let uniqueId = div.getAttribute('fynd-secondary-nav-id');\n if (!uniqueId) {\n uniqueId = `secondary-nav-${navGroup}-${index}-${Date.now()}`;\n div.setAttribute('fynd-secondary-nav-id', uniqueId);\n }\n \n const scrollTargetElement = div.querySelector('[fynd-scroll-target]') as HTMLElement;\n const scrollTargetValue = scrollTargetElement?.getAttribute('fynd-scroll-target');\n \n if (navText && navGroup && scrollTargetValue) {\n if (!groupedNavs[navGroup]) {\n groupedNavs[navGroup] = [];\n }\n \n groupedNavs[navGroup].push({ \n id: uniqueId,\n Text: navText,\n link: scrollTargetValue \n });\n }\n });\n \n const navGroupsArray: NavGroup[] = Object.keys(groupedNavs).map(groupName => ({\n groupName,\n Links: groupedNavs[groupName]\n }));\n \n cachedSecondaryNavItems = navGroupsArray;\n return navGroupsArray;\n }\n\n static getSecondaryNavJSON(): string {\n const navGroups = this.getSecondaryNavItems();\n return JSON.stringify(navGroups, null, 2);\n }\n\n static getCurrentlyVisibleGroup(): string | null {\n const navSections = document.querySelectorAll('[fynd-secondary-nav-id]') as NodeListOf<HTMLElement>;\n const groupVisibility: { [key: string]: number } = {};\n \n navSections.forEach(section => {\n const sectionId = section.getAttribute('fynd-secondary-nav-id');\n if (!sectionId) return;\n \n const groupName = SecondaryNavUtils.getCurrentSectionGroup(sectionId);\n if (!groupName) return;\n \n const rect = section.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n const sectionHeight = rect.height;\n const visibilityPercentage = visibleHeight > 0 ? (visibleHeight / sectionHeight) * 100 : 0;\n \n if (visibilityPercentage > 0) {\n if (!groupVisibility[groupName]) {\n groupVisibility[groupName] = 0;\n }\n groupVisibility[groupName] += visibilityPercentage;\n }\n });\n \n let mostVisibleGroup: string | null = null;\n let highestVisibility = 25;\n \n Object.entries(groupVisibility).forEach(([groupName, totalVisibility]) => {\n if (totalVisibility > highestVisibility) {\n highestVisibility = totalVisibility;\n mostVisibleGroup = groupName;\n }\n });\n \n return mostVisibleGroup;\n }\n}\n\n// ===============================\n// NAVIGATION LINK MANAGEMENT\n// ===============================\nclass NavLinkManager {\n static setAllNavLinksInactive(): void {\n if (!SecondaryNavUtils.checkIfAnySectionVisible()) {\n const allNavLinks = document.querySelectorAll('[fynd-secondary-navlink-active]') as NodeListOf<HTMLElement>;\n allNavLinks.forEach(navLink => {\n navLink.setAttribute('fynd-secondary-navlink-active', 'false');\n });\n }\n }\n\n static activateNavLink(sectionId: string): void {\n const allNavLinks = document.querySelectorAll('[fynd-secondary-navlink-active]') as NodeListOf<HTMLElement>;\n allNavLinks.forEach(navLink => {\n const linkId = navLink.getAttribute('fynd-secondary-navlink-id');\n if (linkId !== sectionId) {\n navLink.setAttribute('fynd-secondary-navlink-active', 'false');\n }\n });\n \n const matchingNavLink = document.querySelector(`[fynd-secondary-navlink-active][fynd-secondary-navlink-id=\"${sectionId}\"]`) as HTMLElement;\n \n if (matchingNavLink) {\n matchingNavLink.setAttribute('fynd-secondary-navlink-active', 'true');\n } else {\n console.warn(`\u274C No matching nav link found for section: ${sectionId}`);\n }\n }\n\n static setActiveTab(): void {\n const navLinkDivs = document.querySelectorAll('[fynd-secondary-navlink-active]') as NodeListOf<HTMLDivElement>;\n \n navLinkDivs.forEach((div: HTMLDivElement) => {\n const isAnchorActive = div.getAttribute('fynd-anchor-active') === 'true';\n \n if (isAnchorActive) {\n div.setAttribute('fynd-secondary-navlink-active', 'true');\n } else {\n div.setAttribute('fynd-secondary-navlink-active', 'false');\n }\n });\n }\n}\n\n// ===============================\n// ANIMATION CONTROLLER\n// ===============================\nclass AnimationController {\n static toggleSecondaryNav(shouldShow: boolean): void {\n if (isAnimating || isSecondaryNavigationVisible === shouldShow) return;\n \n const wrapper = document.querySelector('[fynd-secondary-nav=\"wrapper\"]') as HTMLElement;\n if (!wrapper) {\n console.warn(\"Secondary nav wrapper not found\");\n return;\n }\n \n isAnimating = true;\n isSecondaryNavigationVisible = shouldShow;\n \n if (shouldShow) {\n this.showSecondaryNav(wrapper);\n } else {\n this.hideSecondaryNav(wrapper);\n }\n }\n\n private static showSecondaryNav(wrapper: HTMLElement): void {\n wrapper.style.transform = 'translateY(-100px)';\n wrapper.style.display = 'block';\n wrapper.offsetHeight;\n \n wrapper.style.transition = 'transform 300ms ease';\n wrapper.style.transform = 'translateY(0px)';\n \n this.updateNavigationScrolledStyle(true);\n \n setTimeout(() => {\n wrapper.style.transition = '';\n isAnimating = false;\n }, 300);\n }\n\n private static hideSecondaryNav(wrapper: HTMLElement): void {\n wrapper.style.transition = 'transform 300ms ease';\n wrapper.style.transform = 'translateY(-100px)';\n \n this.updateNavigationScrolledStyle(false);\n \n setTimeout(() => {\n wrapper.style.display = 'none';\n wrapper.style.transition = '';\n isAnimating = false;\n }, 300);\n }\n\n private static updateNavigationScrolledStyle(isSecondaryNavVisible: boolean): void {\n const navigationScrolledElement = document.querySelector('[navigation-scrolled]') as HTMLElement;\n \n if (!navigationScrolledElement) {\n console.warn(\"Element with [navigation-scrolled] attribute not found\");\n return;\n }\n \n if (isSecondaryNavVisible) {\n navigationScrolledElement.style.boxShadow = 'none';\n } else {\n navigationScrolledElement.style.removeProperty('box-shadow');\n }\n }\n}\n\n// ===============================\n// GROUP VISIBILITY MANAGER\n// ===============================\nclass GroupVisibilityManager {\n static updateGroupVisibility(activeGroupName: string | null): void {\n this.updateNavLinkVisibility(activeGroupName);\n this.updateWrapperVisibility(activeGroupName);\n }\n\n private static updateNavLinkVisibility(activeGroupName: string | null): void {\n const allNavLinks = document.querySelectorAll('[fynd-secondary-nav=\"link\"]') as NodeListOf<HTMLElement>;\n \n allNavLinks.forEach(navLink => {\n const linkGroupName = navLink.getAttribute('fynd-secondary-navgroup');\n \n if (activeGroupName && linkGroupName === activeGroupName) {\n navLink.style.display = '';\n navLink.setAttribute('fynd-group-visible', 'true');\n } else {\n navLink.style.display = 'none';\n navLink.setAttribute('fynd-group-visible', 'false');\n }\n });\n }\n\n private static updateWrapperVisibility(activeGroupName: string | null): void {\n const hasActiveLinks = SecondaryNavUtils.hasAnyActiveNavLink();\n const shouldShowNav = activeGroupName !== null && hasActiveLinks;\n AnimationController.toggleSecondaryNav(shouldShowNav);\n }\n}\n\n// ===============================\n// NAVIGATION CONTROLLER\n// ===============================\nclass NavigationController {\n static handleNavigation(currentSectionId: string): void {\n const currentSectionElement = document.querySelector(`[fynd-secondary-nav-id=\"${currentSectionId}\"]`) as HTMLElement;\n if (!currentSectionElement) return;\n \n const currentGroupName = SecondaryNavUtils.getCurrentSectionGroup(currentSectionId);\n if (!currentGroupName) {\n GroupVisibilityManager.updateGroupVisibility(null);\n return;\n }\n \n GroupVisibilityManager.updateGroupVisibility(currentGroupName);\n \n const adjacentSections = SecondaryNavUtils.getAdjacentSections(currentSectionId);\n const hasAdjacentSameGroup = adjacentSections.some(adjSection => {\n const adjGroupName = SecondaryNavUtils.getCurrentSectionGroup(adjSection.id);\n return adjGroupName === currentGroupName;\n });\n \n if (hasAdjacentSameGroup) {\n this.handleGroupSequentialNavigation(currentSectionId, currentGroupName);\n } else {\n NavLinkManager.activateNavLink(currentSectionId);\n }\n }\n\n private static handleGroupSequentialNavigation(currentSectionId: string, groupName: string): void {\n const groupSections = SecondaryNavUtils.getGroupSections(groupName);\n const currentIndex = groupSections.findIndex(section => section.id === currentSectionId);\n \n if (currentIndex === -1) return;\n \n groupSections.forEach(section => {\n const navLink = document.querySelector(`[fynd-secondary-navlink-id=\"${section.id}\"]`) as HTMLElement;\n if (navLink) {\n navLink.setAttribute('fynd-secondary-navlink-active', 'false');\n }\n });\n \n NavLinkManager.activateNavLink(currentSectionId);\n }\n\n static checkInitialGroupVisibility(): void {\n const visibleGroup = SecondaryNavData.getCurrentlyVisibleGroup();\n \n if (visibleGroup) {\n const mostVisible = SecondaryNavUtils.findMostVisibleSection();\n if (mostVisible) {\n const mostVisibleGroup = SecondaryNavUtils.getCurrentSectionGroup(mostVisible);\n if (mostVisibleGroup === visibleGroup) {\n NavLinkManager.activateNavLink(mostVisible);\n }\n }\n \n GroupVisibilityManager.updateGroupVisibility(visibleGroup);\n } else {\n GroupVisibilityManager.updateGroupVisibility(null);\n }\n }\n}\n\n// ===============================\n// INITIALIZATION\n// ===============================\nclass SecondaryNavInitializer {\n static initSecondarynav(): void {\n const secondaryNavItems = SecondaryNavData.getSecondaryNavItems();\n \n if (secondaryNavItems.length === 0) {\n return;\n }\n \n const slotDiv = document.querySelector('[fynd-secondary-nav=\"slot\"]') as HTMLDivElement;\n if (!slotDiv) {\n console.warn(\"Secondary nav slot not found\");\n return;\n }\n \n this.buildNavLinks(slotDiv, secondaryNavItems);\n this.initializeScrollNavigation();\n }\n\n private static buildNavLinks(slotDiv: HTMLDivElement, secondaryNavItems: NavGroup[]): void {\n slotDiv.innerHTML = '';\n \n secondaryNavItems.forEach((group: NavGroup) => {\n group.Links.forEach((navLink: NavLink) => {\n const linkDiv = this.createNavLinkElement(navLink, group.groupName);\n slotDiv.appendChild(linkDiv);\n });\n });\n }\n\n private static createNavLinkElement(navLink: NavLink, groupName: string): HTMLDivElement {\n const linkDiv = document.createElement('div');\n \n linkDiv.setAttribute('fynd-secondary-nav', 'link');\n linkDiv.setAttribute('fynd-secondary-navgroup', groupName);\n linkDiv.setAttribute('fynd-secondary-navlink-id', navLink.id);\n linkDiv.setAttribute('fynd-scroll-trigger', navLink.link);\n linkDiv.setAttribute('data-text-style', 'body-m-regular');\n linkDiv.setAttribute('fynd-secondary-navlink-active', 'false');\n \n linkDiv.textContent = navLink.Text;\n \n linkDiv.addEventListener('click', () => {\n setTimeout(() => {\n NavLinkManager.setActiveTab();\n }, 50);\n });\n \n return linkDiv;\n }\n\n private static initializeScrollNavigation(): void {\n (window as any).scrollNavigation?.fullReinitialize();\n }\n\n static initSecondarynavScroll(): void {\n const navSections = document.querySelectorAll('[fynd-secondary-nav-id]') as NodeListOf<HTMLElement>;\n \n if (navSections.length === 0) {\n return;\n }\n \n this.setupScrollTriggers(navSections);\n this.finalizeInitialization(navSections.length);\n }\n\n private static setupScrollTriggers(navSections: NodeListOf<HTMLElement>): void {\n const secondaryNavItems = cachedSecondaryNavItems || SecondaryNavData.getSecondaryNavItems();\n \n navSections.forEach((section: HTMLElement) => {\n const sectionId = section.getAttribute('fynd-secondary-nav-id');\n if (!sectionId) return;\n \n const correspondingData = this.findCorrespondingData(sectionId, secondaryNavItems);\n if (!correspondingData) return;\n \n this.createScrollTrigger(section, sectionId, correspondingData);\n });\n }\n\n private static findCorrespondingData(sectionId: string, secondaryNavItems: NavGroup[]): NavLink | null {\n for (const group of secondaryNavItems) {\n const found = group.Links.find(link => link.id === sectionId);\n if (found) return found;\n }\n return null;\n }\n\n private static createScrollTrigger(section: HTMLElement, sectionId: string, correspondingData: NavLink): void {\n (window as any).gsap.registerPlugin((window as any).ScrollTrigger);\n \n (window as any).ScrollTrigger.create({\n trigger: section,\n start: \"top bottom\",\n end: \"bottom top\",\n onUpdate: (self: any) => {\n if (isInitialLoad) return;\n \n const rect = section.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n const sectionHeight = rect.height;\n const visibilityPercentage = visibleHeight > 0 ? (visibleHeight / sectionHeight) * 100 : 0;\n \n const mostVisible = SecondaryNavUtils.findMostVisibleSection();\n \n if (mostVisible && mostVisible === sectionId && visibilityPercentage > 50) {\n NavigationController.handleNavigation(sectionId);\n } else if (!mostVisible) {\n const visibleGroup = SecondaryNavData.getCurrentlyVisibleGroup();\n if (visibleGroup) {\n GroupVisibilityManager.updateGroupVisibility(visibleGroup);\n } else {\n setTimeout(() => {\n if (!SecondaryNavUtils.checkIfAnySectionVisible()) {\n NavLinkManager.setAllNavLinksInactive();\n GroupVisibilityManager.updateGroupVisibility(null);\n }\n }, 10);\n }\n }\n }\n });\n }\n\n private static finalizeInitialization(sectionCount: number): void {\n scrollTrackingInitialized = true;\n \n setTimeout(() => {\n isInitialLoad = false;\n NavigationController.checkInitialGroupVisibility();\n }, 500);\n }\n}\n\n// ===============================\n// MAIN EXECUTION\n// ===============================\nconst secondaryNavItems = SecondaryNavData.getSecondaryNavItems();\nconsole.log(secondaryNavItems);\n\ndocument.addEventListener('DOMContentLoaded', () => {\n setTimeout(() => {\n cachedSecondaryNavItems = null;\n isInitialLoad = true;\n \n SecondaryNavInitializer.initSecondarynav();\n \n setTimeout(() => {\n SecondaryNavInitializer.initSecondarynavScroll();\n }, 300);\n }, 200);\n});"],
5
- "mappings": ";;;AACA,MACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,QAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,MAAiB;AAAA,MAAU,MACpE,SAAS,OAAO;AAAA,IAClB;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,gDAAgD;AAAA,EAC9D;;;ACVA,UAAQ,IAAI,iCAA0B;AAwBtC,MAAI,0BAA6C;AACjD,MAAI,gBAAgB;AACpB,MAAI,4BAA4B;AAChC,MAAI,+BAA+B;AACnC,MAAI,cAAc;AAKlB,MAAM,oBAAN,MAAwB;AAAA,IACpB,OAAO,sBAA+B;AAClC,YAAM,iBAAiB,SAAS,iBAAiB,wCAAwC;AACzF,aAAO,eAAe,SAAS;AAAA,IACnC;AAAA,IAEA,OAAO,2BAAoC;AACvC,YAAM,cAAc,SAAS,iBAAiB,yBAAyB;AACvE,YAAM,iBAAiB,OAAO;AAE9B,iBAAW,WAAW,aAAa;AAC/B,cAAM,OAAO,QAAQ,sBAAsB;AAC3C,cAAM,gBAAgB,KAAK,IAAI,KAAK,QAAQ,cAAc,IAAI,KAAK,IAAI,KAAK,KAAK,CAAC;AAClF,cAAM,gBAAgB,KAAK;AAC3B,cAAM,uBAAuB,gBAAgB,IAAK,gBAAgB,gBAAiB,MAAM;AAEzF,YAAI,uBAAuB,IAAI;AAC3B,iBAAO;AAAA,QACX;AAAA,MACJ;AACA,aAAO;AAAA,IACX;AAAA,IAEA,OAAO,yBAAwC;AAC3C,YAAM,cAAc,SAAS,iBAAiB,yBAAyB;AACvE,YAAM,iBAAiB,OAAO;AAC9B,UAAI,qBAAoC;AACxC,UAAI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BAAkB,uBAAuB;AAE7D,cAAI,eAAe,gBAAgB,aAAa,uBAAuB,IAAI;AACvE,iCAAqB,iBAAiB,SAAS;AAAA,UACnD,WAAW,CAAC,aAAa;AACrB,kBAAM,eAAe,iBAAiB,yBAAyB;AAC/D,gBAAI,cAAc;AACd,qCAAuB,sBAAsB,YAAY;AAAA,YAC7D,OAAO;AACH,yBAAW,MAAM;AACb,oBAAI,CAAC,kBAAkB,yBAAyB,GAAG;AAC/C,iCAAe,uBAAuB;AACtC,yCAAuB,sBAAsB,IAAI;AAAA,gBACrD;AAAA,cACJ,GAAG,EAAE;AAAA,YACT;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,IAEA,OAAe,uBAAuB,cAA4B;AAC9D,kCAA4B;AAE5B,iBAAW,MAAM;AACb,wBAAgB;AAChB,6BAAqB,4BAA4B;AAAA,MACrD,GAAG,GAAG;AAAA,IACV;AAAA,EACJ;AAKA,MAAM,oBAAoB,iBAAiB,qBAAqB;AAChE,UAAQ,IAAI,iBAAiB;AAE7B,WAAS,iBAAiB,oBAAoB,MAAM;AAChD,eAAW,MAAM;AACb,gCAA0B;AAC1B,sBAAgB;AAEhB,8BAAwB,iBAAiB;AAEzC,iBAAW,MAAM;AACb,gCAAwB,uBAAuB;AAAA,MACnD,GAAG,GAAG;AAAA,IACV,GAAG,GAAG;AAAA,EACV,CAAC;",
4
+ "sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n console.log(\"Live reload disabled: not running on localhost\");\n}\n", "\n\n// ===============================\n// TYPE DEFINITIONS\n// ===============================\ninterface NavLink {\n id: string;\n Text: string;\n link: string;\n}\n\ninterface NavGroup {\n groupName: string;\n Links: NavLink[];\n}\n\ninterface AdjacentSection {\n id: string;\n position: 'previous' | 'next';\n}\n\n// ===============================\n// GLOBAL STATE\n// ===============================\nlet cachedSecondaryNavItems: NavGroup[] | null = null;\nlet isInitialLoad = true;\nlet scrollTrackingInitialized = false;\nlet isSecondaryNavigationVisible = false;\nlet isAnimating = false;\n\n// ===============================\n// UTILITY FUNCTIONS\n// ===============================\nclass SecondaryNavUtils {\n static hasAnyActiveNavLink(): boolean {\n const activeNavLinks = document.querySelectorAll('[fynd-secondary-navlink-active=\"true\"]') as NodeListOf<HTMLElement>;\n return activeNavLinks.length > 0;\n }\n\n static checkIfAnySectionVisible(): boolean {\n const navSections = document.querySelectorAll('[fynd-secondary-nav-id]') as NodeListOf<HTMLElement>;\n const viewportHeight = window.innerHeight;\n \n for (const section of navSections) {\n const rect = section.getBoundingClientRect();\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n const sectionHeight = rect.height;\n const visibilityPercentage = visibleHeight > 0 ? (visibleHeight / sectionHeight) * 100 : 0;\n \n if (visibilityPercentage > 50) {\n return true;\n }\n }\n return false;\n }\n\n static findMostVisibleSection(): string | null {\n const navSections = document.querySelectorAll('[fynd-secondary-nav-id]') as NodeListOf<HTMLElement>;\n const viewportHeight = window.innerHeight;\n let mostVisibleSection: string | null = null;\n let highestVisibility = 0;\n \n navSections.forEach((section) => {\n const sectionId = section.getAttribute('fynd-secondary-nav-id');\n if (!sectionId) return;\n \n const rect = section.getBoundingClientRect();\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n const sectionHeight = rect.height;\n const visibilityPercentage = visibleHeight > 0 ? (visibleHeight / sectionHeight) * 100 : 0;\n \n if (visibilityPercentage > 50 && visibilityPercentage > highestVisibility) {\n highestVisibility = visibilityPercentage;\n mostVisibleSection = sectionId;\n }\n });\n \n return mostVisibleSection;\n }\n\n static getCurrentSectionGroup(sectionId: string): string | null {\n const secondaryNavItems = cachedSecondaryNavItems || SecondaryNavData.getSecondaryNavItems();\n \n for (const group of secondaryNavItems) {\n const found = group.Links.find(link => link.id === sectionId);\n if (found) {\n return group.groupName;\n }\n }\n return null;\n }\n\n static getAdjacentSections(currentSectionId: string): AdjacentSection[] {\n const allSections = Array.from(document.querySelectorAll('[fynd-secondary-nav-id]')) as HTMLElement[];\n const currentIndex = allSections.findIndex(section => \n section.getAttribute('fynd-secondary-nav-id') === currentSectionId\n );\n \n const adjacent: AdjacentSection[] = [];\n \n if (currentIndex > 0) {\n const prevId = allSections[currentIndex - 1].getAttribute('fynd-secondary-nav-id');\n if (prevId) adjacent.push({ id: prevId, position: 'previous' });\n }\n \n if (currentIndex < allSections.length - 1) {\n const nextId = allSections[currentIndex + 1].getAttribute('fynd-secondary-nav-id');\n if (nextId) adjacent.push({ id: nextId, position: 'next' });\n }\n \n return adjacent;\n }\n\n static getGroupSections(groupName: string): NavLink[] {\n const secondaryNavItems = cachedSecondaryNavItems || SecondaryNavData.getSecondaryNavItems();\n const group = secondaryNavItems.find(g => g.groupName === groupName);\n return group ? group.Links : [];\n }\n}\n\n// ===============================\n// DATA MANAGEMENT\n// ===============================\nclass SecondaryNavData {\n static getSecondaryNavItems(): NavGroup[] {\n if (cachedSecondaryNavItems) {\n return cachedSecondaryNavItems;\n }\n \n const secondaryNavDivs: NodeListOf<HTMLDivElement> = document.querySelectorAll('[fynd-secondary-nav=\"true\"]');\n const groupedNavs: { [key: string]: NavLink[] } = {};\n \n secondaryNavDivs.forEach((div: HTMLDivElement, index: number) => {\n const navText: string | null = div.getAttribute('fynd-secondary-nav-text');\n const navGroup: string | null = div.getAttribute('fynd-secondary-nav-group');\n \n let uniqueId = div.getAttribute('fynd-secondary-nav-id');\n if (!uniqueId) {\n uniqueId = `secondary-nav-${navGroup}-${index}-${Date.now()}`;\n div.setAttribute('fynd-secondary-nav-id', uniqueId);\n }\n \n const scrollTargetElement = div.querySelector('[fynd-scroll-target]') as HTMLElement;\n const scrollTargetValue = scrollTargetElement?.getAttribute('fynd-scroll-target');\n \n if (navText && navGroup && scrollTargetValue) {\n if (!groupedNavs[navGroup]) {\n groupedNavs[navGroup] = [];\n }\n \n groupedNavs[navGroup].push({ \n id: uniqueId,\n Text: navText,\n link: scrollTargetValue \n });\n }\n });\n \n const navGroupsArray: NavGroup[] = Object.keys(groupedNavs).map(groupName => ({\n groupName,\n Links: groupedNavs[groupName]\n }));\n \n cachedSecondaryNavItems = navGroupsArray;\n return navGroupsArray;\n }\n\n static getSecondaryNavJSON(): string {\n const navGroups = this.getSecondaryNavItems();\n return JSON.stringify(navGroups, null, 2);\n }\n\n static getCurrentlyVisibleGroup(): string | null {\n const navSections = document.querySelectorAll('[fynd-secondary-nav-id]') as NodeListOf<HTMLElement>;\n const groupVisibility: { [key: string]: number } = {};\n \n navSections.forEach(section => {\n const sectionId = section.getAttribute('fynd-secondary-nav-id');\n if (!sectionId) return;\n \n const groupName = SecondaryNavUtils.getCurrentSectionGroup(sectionId);\n if (!groupName) return;\n \n const rect = section.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n const sectionHeight = rect.height;\n const visibilityPercentage = visibleHeight > 0 ? (visibleHeight / sectionHeight) * 100 : 0;\n \n if (visibilityPercentage > 0) {\n if (!groupVisibility[groupName]) {\n groupVisibility[groupName] = 0;\n }\n groupVisibility[groupName] += visibilityPercentage;\n }\n });\n \n let mostVisibleGroup: string | null = null;\n let highestVisibility = 25;\n \n Object.entries(groupVisibility).forEach(([groupName, totalVisibility]) => {\n if (totalVisibility > highestVisibility) {\n highestVisibility = totalVisibility;\n mostVisibleGroup = groupName;\n }\n });\n \n return mostVisibleGroup;\n }\n}\n\n// ===============================\n// NAVIGATION LINK MANAGEMENT\n// ===============================\nclass NavLinkManager {\n static setAllNavLinksInactive(): void {\n if (!SecondaryNavUtils.checkIfAnySectionVisible()) {\n const allNavLinks = document.querySelectorAll('[fynd-secondary-navlink-active]') as NodeListOf<HTMLElement>;\n allNavLinks.forEach(navLink => {\n navLink.setAttribute('fynd-secondary-navlink-active', 'false');\n });\n }\n }\n\n static activateNavLink(sectionId: string): void {\n const allNavLinks = document.querySelectorAll('[fynd-secondary-navlink-active]') as NodeListOf<HTMLElement>;\n allNavLinks.forEach(navLink => {\n const linkId = navLink.getAttribute('fynd-secondary-navlink-id');\n if (linkId !== sectionId) {\n navLink.setAttribute('fynd-secondary-navlink-active', 'false');\n }\n });\n \n const matchingNavLink = document.querySelector(`[fynd-secondary-navlink-active][fynd-secondary-navlink-id=\"${sectionId}\"]`) as HTMLElement;\n \n if (matchingNavLink) {\n matchingNavLink.setAttribute('fynd-secondary-navlink-active', 'true');\n } else {\n console.warn(`\u274C No matching nav link found for section: ${sectionId}`);\n }\n }\n\n static setActiveTab(): void {\n const navLinkDivs = document.querySelectorAll('[fynd-secondary-navlink-active]') as NodeListOf<HTMLDivElement>;\n \n navLinkDivs.forEach((div: HTMLDivElement) => {\n const isAnchorActive = div.getAttribute('fynd-anchor-active') === 'true';\n \n if (isAnchorActive) {\n div.setAttribute('fynd-secondary-navlink-active', 'true');\n } else {\n div.setAttribute('fynd-secondary-navlink-active', 'false');\n }\n });\n }\n}\n\n// ===============================\n// ANIMATION CONTROLLER\n// ===============================\nclass AnimationController {\n static toggleSecondaryNav(shouldShow: boolean): void {\n if (isAnimating || isSecondaryNavigationVisible === shouldShow) return;\n \n const wrapper = document.querySelector('[fynd-secondary-nav=\"wrapper\"]') as HTMLElement;\n if (!wrapper) {\n console.warn(\"Secondary nav wrapper not found\");\n return;\n }\n \n isAnimating = true;\n isSecondaryNavigationVisible = shouldShow;\n \n if (shouldShow) {\n this.showSecondaryNav(wrapper);\n } else {\n this.hideSecondaryNav(wrapper);\n }\n }\n\n private static showSecondaryNav(wrapper: HTMLElement): void {\n wrapper.style.transform = 'translateY(-100px)';\n wrapper.style.display = 'block';\n wrapper.offsetHeight;\n \n wrapper.style.transition = 'transform 300ms ease';\n wrapper.style.transform = 'translateY(0px)';\n \n this.updateNavigationScrolledStyle(true);\n \n setTimeout(() => {\n wrapper.style.transition = '';\n isAnimating = false;\n }, 300);\n }\n\n private static hideSecondaryNav(wrapper: HTMLElement): void {\n wrapper.style.transition = 'transform 300ms ease';\n wrapper.style.transform = 'translateY(-100px)';\n \n this.updateNavigationScrolledStyle(false);\n \n setTimeout(() => {\n wrapper.style.display = 'none';\n wrapper.style.transition = '';\n isAnimating = false;\n }, 300);\n }\n\n private static updateNavigationScrolledStyle(isSecondaryNavVisible: boolean): void {\n const navigationScrolledElement = document.querySelector('[navigation-scrolled]') as HTMLElement;\n \n if (!navigationScrolledElement) {\n console.warn(\"Element with [navigation-scrolled] attribute not found\");\n return;\n }\n \n if (isSecondaryNavVisible) {\n navigationScrolledElement.style.boxShadow = 'none';\n } else {\n navigationScrolledElement.style.removeProperty('box-shadow');\n }\n }\n}\n\n// ===============================\n// GROUP VISIBILITY MANAGER\n// ===============================\nclass GroupVisibilityManager {\n static updateGroupVisibility(activeGroupName: string | null): void {\n this.updateNavLinkVisibility(activeGroupName);\n this.updateWrapperVisibility(activeGroupName);\n }\n\n private static updateNavLinkVisibility(activeGroupName: string | null): void {\n const allNavLinks = document.querySelectorAll('[fynd-secondary-nav=\"link\"]') as NodeListOf<HTMLElement>;\n \n allNavLinks.forEach(navLink => {\n const linkGroupName = navLink.getAttribute('fynd-secondary-navgroup');\n \n if (activeGroupName && linkGroupName === activeGroupName) {\n navLink.style.display = '';\n navLink.setAttribute('fynd-group-visible', 'true');\n } else {\n navLink.style.display = 'none';\n navLink.setAttribute('fynd-group-visible', 'false');\n }\n });\n }\n\n private static updateWrapperVisibility(activeGroupName: string | null): void {\n const hasActiveLinks = SecondaryNavUtils.hasAnyActiveNavLink();\n const shouldShowNav = activeGroupName !== null && hasActiveLinks;\n AnimationController.toggleSecondaryNav(shouldShowNav);\n }\n}\n\n// ===============================\n// NAVIGATION CONTROLLER\n// ===============================\nclass NavigationController {\n static handleNavigation(currentSectionId: string): void {\n const currentSectionElement = document.querySelector(`[fynd-secondary-nav-id=\"${currentSectionId}\"]`) as HTMLElement;\n if (!currentSectionElement) return;\n \n const currentGroupName = SecondaryNavUtils.getCurrentSectionGroup(currentSectionId);\n if (!currentGroupName) {\n GroupVisibilityManager.updateGroupVisibility(null);\n return;\n }\n \n GroupVisibilityManager.updateGroupVisibility(currentGroupName);\n \n const adjacentSections = SecondaryNavUtils.getAdjacentSections(currentSectionId);\n const hasAdjacentSameGroup = adjacentSections.some(adjSection => {\n const adjGroupName = SecondaryNavUtils.getCurrentSectionGroup(adjSection.id);\n return adjGroupName === currentGroupName;\n });\n \n if (hasAdjacentSameGroup) {\n this.handleGroupSequentialNavigation(currentSectionId, currentGroupName);\n } else {\n NavLinkManager.activateNavLink(currentSectionId);\n }\n }\n\n private static handleGroupSequentialNavigation(currentSectionId: string, groupName: string): void {\n const groupSections = SecondaryNavUtils.getGroupSections(groupName);\n const currentIndex = groupSections.findIndex(section => section.id === currentSectionId);\n \n if (currentIndex === -1) return;\n \n groupSections.forEach(section => {\n const navLink = document.querySelector(`[fynd-secondary-navlink-id=\"${section.id}\"]`) as HTMLElement;\n if (navLink) {\n navLink.setAttribute('fynd-secondary-navlink-active', 'false');\n }\n });\n \n NavLinkManager.activateNavLink(currentSectionId);\n }\n\n static checkInitialGroupVisibility(): void {\n const visibleGroup = SecondaryNavData.getCurrentlyVisibleGroup();\n \n if (visibleGroup) {\n const mostVisible = SecondaryNavUtils.findMostVisibleSection();\n if (mostVisible) {\n const mostVisibleGroup = SecondaryNavUtils.getCurrentSectionGroup(mostVisible);\n if (mostVisibleGroup === visibleGroup) {\n NavLinkManager.activateNavLink(mostVisible);\n }\n }\n \n GroupVisibilityManager.updateGroupVisibility(visibleGroup);\n } else {\n GroupVisibilityManager.updateGroupVisibility(null);\n }\n }\n}\n\n// ===============================\n// INITIALIZATION\n// ===============================\nclass SecondaryNavInitializer {\n static initSecondarynav(): void {\n const secondaryNavItems = SecondaryNavData.getSecondaryNavItems();\n \n if (secondaryNavItems.length === 0) {\n return;\n }\n \n const slotDiv = document.querySelector('[fynd-secondary-nav=\"slot\"]') as HTMLDivElement;\n if (!slotDiv) {\n console.warn(\"Secondary nav slot not found\");\n return;\n }\n \n this.buildNavLinks(slotDiv, secondaryNavItems);\n this.initializeScrollNavigation();\n }\n\n private static buildNavLinks(slotDiv: HTMLDivElement, secondaryNavItems: NavGroup[]): void {\n slotDiv.innerHTML = '';\n \n secondaryNavItems.forEach((group: NavGroup) => {\n group.Links.forEach((navLink: NavLink) => {\n const linkDiv = this.createNavLinkElement(navLink, group.groupName);\n slotDiv.appendChild(linkDiv);\n });\n });\n }\n\n private static createNavLinkElement(navLink: NavLink, groupName: string): HTMLDivElement {\n const linkDiv = document.createElement('div');\n \n linkDiv.setAttribute('fynd-secondary-nav', 'link');\n linkDiv.setAttribute('fynd-secondary-navgroup', groupName);\n linkDiv.setAttribute('fynd-secondary-navlink-id', navLink.id);\n linkDiv.setAttribute('fynd-scroll-trigger', navLink.link);\n linkDiv.setAttribute('data-text-style', 'body-m-regular');\n linkDiv.setAttribute('fynd-secondary-navlink-active', 'false');\n \n linkDiv.textContent = navLink.Text;\n \n linkDiv.addEventListener('click', () => {\n setTimeout(() => {\n NavLinkManager.setActiveTab();\n }, 50);\n });\n \n return linkDiv;\n }\n\n private static initializeScrollNavigation(): void {\n (window as any).scrollNavigation?.fullReinitialize();\n }\n\n static initSecondarynavScroll(): void {\n const navSections = document.querySelectorAll('[fynd-secondary-nav-id]') as NodeListOf<HTMLElement>;\n \n if (navSections.length === 0) {\n return;\n }\n \n this.setupScrollTriggers(navSections);\n this.finalizeInitialization(navSections.length);\n }\n\n private static setupScrollTriggers(navSections: NodeListOf<HTMLElement>): void {\n const secondaryNavItems = cachedSecondaryNavItems || SecondaryNavData.getSecondaryNavItems();\n \n navSections.forEach((section: HTMLElement) => {\n const sectionId = section.getAttribute('fynd-secondary-nav-id');\n if (!sectionId) return;\n \n const correspondingData = this.findCorrespondingData(sectionId, secondaryNavItems);\n if (!correspondingData) return;\n \n this.createScrollTrigger(section, sectionId, correspondingData);\n });\n }\n\n private static findCorrespondingData(sectionId: string, secondaryNavItems: NavGroup[]): NavLink | null {\n for (const group of secondaryNavItems) {\n const found = group.Links.find(link => link.id === sectionId);\n if (found) return found;\n }\n return null;\n }\n\n private static createScrollTrigger(section: HTMLElement, sectionId: string, correspondingData: NavLink): void {\n (window as any).gsap.registerPlugin((window as any).ScrollTrigger);\n \n (window as any).ScrollTrigger.create({\n trigger: section,\n start: \"top bottom\",\n end: \"bottom top\",\n onUpdate: (self: any) => {\n if (isInitialLoad) return;\n \n const rect = section.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const visibleHeight = Math.min(rect.bottom, viewportHeight) - Math.max(rect.top, 0);\n const sectionHeight = rect.height;\n const visibilityPercentage = visibleHeight > 0 ? (visibleHeight / sectionHeight) * 100 : 0;\n \n const mostVisible = SecondaryNavUtils.findMostVisibleSection();\n \n if (mostVisible && mostVisible === sectionId && visibilityPercentage > 50) {\n NavigationController.handleNavigation(sectionId);\n } else if (!mostVisible) {\n const visibleGroup = SecondaryNavData.getCurrentlyVisibleGroup();\n if (visibleGroup) {\n GroupVisibilityManager.updateGroupVisibility(visibleGroup);\n } else {\n setTimeout(() => {\n if (!SecondaryNavUtils.checkIfAnySectionVisible()) {\n NavLinkManager.setAllNavLinksInactive();\n GroupVisibilityManager.updateGroupVisibility(null);\n }\n }, 10);\n }\n }\n }\n });\n }\n\n private static finalizeInitialization(sectionCount: number): void {\n scrollTrackingInitialized = true;\n \n setTimeout(() => {\n isInitialLoad = false;\n NavigationController.checkInitialGroupVisibility();\n }, 500);\n }\n}\n\n// ===============================\n// MAIN EXECUTION\n// ===============================\nconst secondaryNavItems = SecondaryNavData.getSecondaryNavItems();\n\ndocument.addEventListener('DOMContentLoaded', () => {\n setTimeout(() => {\n cachedSecondaryNavItems = null;\n isInitialLoad = true;\n \n SecondaryNavInitializer.initSecondarynav();\n \n setTimeout(() => {\n SecondaryNavInitializer.initSecondarynavScroll();\n }, 300);\n }, 200);\n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D,OAAO;AACH,yBAAW,MAAM;AACb,oBAAI,CAAC,kBAAkB,yBAAyB,GAAG;AAC/C,iCAAe,uBAAuB;AACtC,yCAAuB,sBAAsB,IAAI;AAAA,gBACrD;AAAA,cACJ,GAAG,EAAE;AAAA,YACT;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,IAEA,OAAe,uBAAuB,cAA4B;AAC9D,kCAA4B;AAE5B,iBAAW,MAAM;AACb,wBAAgB;AAChB,6BAAqB,4BAA4B;AAAA,MACrD,GAAG,GAAG;AAAA,IACV;AAAA,EACJ;AAKA,MAAM,oBAAoB,iBAAiB,qBAAqB;AAEhE,WAAS,iBAAiB,oBAAoB,MAAM;AAChD,eAAW,MAAM;AACb,gCAA0B;AAC1B,sBAAgB;AAEhB,8BAAwB,iBAAiB;AAEzC,iBAAW,MAAM;AACb,gCAAwB,uBAAuB;AAAA,MACnD,GAAG,GAAG;AAAA,IACV,GAAG,GAAG;AAAA,EACV,CAAC;",
6
6
  "names": ["secondaryNavItems"]
7
7
  }
@@ -1 +1 @@
1
- "use strict";(()=>{var g=()=>{let r={};try{let t=null;if(typeof window.getUserJourney=="function"&&(t=window.getUserJourney()),!t){let e=sessionStorage.getItem("userJourney");e&&(t=JSON.parse(e))}if(t&&t.formDetails){let e=t.formDetails;e.formId&&(r.form_id=e.formId),e.formName&&(r.form_name=e.formName),e.firstName&&(r.form_first_name=e.firstName),e.lastName&&(r.form_last_name=e.lastName),e.email&&(r.form_email=e.email),e.phone&&(r.form_phone=e.phone)}}catch(t){console.warn("Error getting user journey data for GA tracking:",t)}return r},f=()=>{let t={"fynd_website.source_page":window.location.pathname,"fynd_website.product":"fynd.com website","fynd_website.device_type":"Unknown","fynd_website.utm_source":new URLSearchParams(window.location.search).get("utm_source")||"","fynd_website.utm_medium":new URLSearchParams(window.location.search).get("utm_medium")||"","fynd_website.utm_campaign":new URLSearchParams(window.location.search).get("utm_campaign")||"","fynd_website.referrer":document.referrer};try{let e=null;if(typeof window.getUserJourney=="function"&&(e=window.getUserJourney()),!e){let n=sessionStorage.getItem("userJourney");n&&(e=JSON.parse(n))}if(e){if(t["fynd_website.journey_touchpoints"]=e.userJourney||e,e.formDetails){let n=e.formDetails;n.formId&&(t["fynd_website.form_id"]=n.formId),n.formName&&(t["fynd_website.form_name"]=n.formName),n.firstName&&(t["fynd_website.form_first_name"]=n.firstName),n.lastName&&(t["fynd_website.form_last_name"]=n.lastName),n.email&&(t["fynd_website.form_email"]=n.email),n.phone&&(t["fynd_website.form_phone"]=n.phone)}if(e.userJourney&&e.userJourney.length>0){t["fynd_website.journey_total_pages"]=e.userJourney.length,t["fynd_website.journey_touchpoints_count"]=e.userJourney.length,t["fynd_website.journey_first_page"]=e.userJourney[0].page,t["fynd_website.journey_current_page"]=e.userJourney[e.userJourney.length-1].page;let n=new Date(e.userJourney[0].time),a=new Date(e.userJourney[e.userJourney.length-1].time);t["fynd_website.journey_session_duration"]=Math.floor((a.getTime()-n.getTime())/1e3),t["fynd_website.journey_entry_time"]=e.userJourney[0].time,t["fynd_website.journey_exit_time"]=e.userJourney[e.userJourney.length-1].time}e.deviceCategory&&(t["fynd_website.device_type"]=e.deviceCategory),e.browser&&(t["fynd_website.journey_browser"]=e.browser),e.device&&(t["fynd_website.journey_device"]=e.device),e.origin&&(t["fynd_website.journey_origin"]=e.origin),e.utmPath&&(t["fynd_website.journey_utm_path"]=e.utmPath),e.scrollDepth&&(t["fynd_website.journey_scroll_depth"]=e.scrollDepth)}}catch(e){console.warn("Error getting user journey data for tracking:",e)}if(t["fynd_website.device_type"]==="Unknown"){let e=navigator.userAgent;/iPad/.test(e)||/Android/.test(e)&&!/Mobile/.test(e)||/Tablet/.test(e)?t["fynd_website.device_type"]="Tablet":/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(e)?t["fynd_website.device_type"]="Mobile":t["fynd_website.device_type"]="Desktop"}return t},l=(r,t,e)=>{if(window.dataLayer){let n={event:r,event_category:"form_interaction",event_label:r,...t};e?.submitted_form&&(n.submitted_form=e.submitted_form),window.dataLayer.push(n),console.log("Event sent to GA:",n)}else console.log("dataLayer not available for GA tracking")},i=(r,t)=>{try{let e=f(),n=t?{...e,...t}:e;window.posthog&&(window.posthog.capture(r,n),console.log("Event sent to PostHog:",{event:r,properties:n}));let a=g();(r.includes("form")||Object.keys(a).length>0||t?.submitted_form)&&l(r,a,t)}catch(e){console.error("Error tracking event:",e)}},y=r=>{let t=r.closest("form");return t&&(t.getAttribute("data-name")||t.getAttribute("name")||t.id)||null};document.addEventListener("DOMContentLoaded",function(){let r=f();window.posthog&&window.posthog.capture("$pageview",r)});window.addEventListener("load",function(){let r=f();console.log("Tracking Properties on Page Load:",r),i("fynd_website.page.loaded"),w()});function w(){if(window.location.pathname==="/thank-you"){let t=performance.getEntriesByType("navigation");t.length>0&&(t[0].type==="reload"||document.referrer&&new URL(document.referrer).origin===window.location.origin)&&setTimeout(()=>{i("fynd_website.form.success")},200)}}document.addEventListener("DOMContentLoaded",function(){let r=document.querySelectorAll('[data-ph="sign-up"]'),t=document.querySelectorAll('[data-ph="sign-in"]'),e=document.querySelectorAll('[href="#footer-form"]'),n=document.querySelectorAll('[data-ph="book-a-demo"]');document.querySelectorAll('[type="submit"]').forEach(o=>{o.addEventListener("click",function(){let s=y(this);setTimeout(()=>{window.validationPassed===!0&&i("fynd_website.form.submitted",s?{submitted_form:s}:{})},10)})}),r.forEach(o=>{o.addEventListener("click",function(){i("fynd_website.sign_up.clicked")})}),t.forEach(o=>{o.addEventListener("click",function(){i("fynd_website.sign_in.clicked")})}),e.forEach(o=>{o.addEventListener("click",function(){i("fynd_website.scroll_to_form.clicked")})}),n.forEach(o=>{o.addEventListener("click",function(){i("fynd_website.book_a_demo.clicked")})});let c=document.querySelectorAll("[ph-form-field]"),u=new Set;c.forEach(o=>{let s=o.tagName.toLowerCase(),m=o.type?.toLowerCase(),d=function(){let _=y(this)||"unknown-form";u.has(_)||(u.add(_),i("fynd_website.form.started"))};s==="button"||s==="input"&&m==="submit"||o.addEventListener("focus",d),s==="button"||s==="input"&&m==="submit"?o.addEventListener("click",d):s==="select"?o.addEventListener("change",d):o.addEventListener("input",d)})});window.getPosthogTrackingProperties=f;window.trackEvent=i;window.getGaTrackingProperties=g;})();
1
+ "use strict";(()=>{var g=()=>{let r={};try{let t=null;if(typeof window.getUserJourney=="function"&&(t=window.getUserJourney()),!t){let e=sessionStorage.getItem("userJourney");e&&(t=JSON.parse(e))}if(t&&t.formDetails){let e=t.formDetails;e.formId&&(r.form_id=e.formId),e.formName&&(r.form_name=e.formName),e.firstName&&(r.form_first_name=e.firstName),e.lastName&&(r.form_last_name=e.lastName),e.email&&(r.form_email=e.email),e.phone&&(r.form_phone=e.phone)}}catch(t){console.warn("Error getting user journey data for GA tracking:",t)}return r},d=()=>{let t={"fynd_website.source_page":window.location.pathname,"fynd_website.product":"fynd.com website","fynd_website.device_type":"Unknown","fynd_website.utm_source":new URLSearchParams(window.location.search).get("utm_source")||"","fynd_website.utm_medium":new URLSearchParams(window.location.search).get("utm_medium")||"","fynd_website.utm_campaign":new URLSearchParams(window.location.search).get("utm_campaign")||"","fynd_website.referrer":document.referrer};try{let e=null;if(typeof window.getUserJourney=="function"&&(e=window.getUserJourney()),!e){let n=sessionStorage.getItem("userJourney");n&&(e=JSON.parse(n))}if(e){if(t["fynd_website.journey_touchpoints"]=e.userJourney||e,e.formDetails){let n=e.formDetails;n.formId&&(t["fynd_website.form_id"]=n.formId),n.formName&&(t["fynd_website.form_name"]=n.formName),n.firstName&&(t["fynd_website.form_first_name"]=n.firstName),n.lastName&&(t["fynd_website.form_last_name"]=n.lastName),n.email&&(t["fynd_website.form_email"]=n.email),n.phone&&(t["fynd_website.form_phone"]=n.phone)}if(e.userJourney&&e.userJourney.length>0){t["fynd_website.journey_total_pages"]=e.userJourney.length,t["fynd_website.journey_touchpoints_count"]=e.userJourney.length,t["fynd_website.journey_first_page"]=e.userJourney[0].page,t["fynd_website.journey_current_page"]=e.userJourney[e.userJourney.length-1].page;let n=new Date(e.userJourney[0].time),a=new Date(e.userJourney[e.userJourney.length-1].time);t["fynd_website.journey_session_duration"]=Math.floor((a.getTime()-n.getTime())/1e3),t["fynd_website.journey_entry_time"]=e.userJourney[0].time,t["fynd_website.journey_exit_time"]=e.userJourney[e.userJourney.length-1].time}e.deviceCategory&&(t["fynd_website.device_type"]=e.deviceCategory),e.browser&&(t["fynd_website.journey_browser"]=e.browser),e.device&&(t["fynd_website.journey_device"]=e.device),e.origin&&(t["fynd_website.journey_origin"]=e.origin),e.utmPath&&(t["fynd_website.journey_utm_path"]=e.utmPath),e.scrollDepth&&(t["fynd_website.journey_scroll_depth"]=e.scrollDepth)}}catch(e){console.warn("Error getting user journey data for tracking:",e)}if(t["fynd_website.device_type"]==="Unknown"){let e=navigator.userAgent;/iPad/.test(e)||/Android/.test(e)&&!/Mobile/.test(e)||/Tablet/.test(e)?t["fynd_website.device_type"]="Tablet":/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(e)?t["fynd_website.device_type"]="Mobile":t["fynd_website.device_type"]="Desktop"}return t},l=(r,t,e)=>{if(window.dataLayer){let n={event:r,event_category:"form_interaction",event_label:r,...t};e?.submitted_form&&(n.submitted_form=e.submitted_form),window.dataLayer.push(n)}else console.warn("dataLayer not available for GA tracking")},o=(r,t)=>{try{let e=d(),n=t?{...e,...t}:e;window.posthog&&window.posthog.capture(r,n);let a=g();(r.includes("form")||Object.keys(a).length>0||t?.submitted_form)&&l(r,a,t)}catch(e){console.error("Error tracking event:",e)}},y=r=>{let t=r.closest("form");return t&&(t.getAttribute("data-name")||t.getAttribute("name")||t.id)||null};document.addEventListener("DOMContentLoaded",function(){let r=d();window.posthog&&window.posthog.capture("$pageview",r)});window.addEventListener("load",function(){let r=d();o("fynd_website.page.loaded"),w()});function w(){if(window.location.pathname==="/thank-you"){let t=performance.getEntriesByType("navigation");t.length>0&&(t[0].type==="reload"||document.referrer&&new URL(document.referrer).origin===window.location.origin)&&setTimeout(()=>{o("fynd_website.form.success")},200)}}document.addEventListener("DOMContentLoaded",function(){let r=document.querySelectorAll('[data-ph="sign-up"]'),t=document.querySelectorAll('[data-ph="sign-in"]'),e=document.querySelectorAll('[href="#footer-form"]'),n=document.querySelectorAll('[data-ph="book-a-demo"]');document.querySelectorAll('[type="submit"]').forEach(i=>{i.addEventListener("click",function(){let s=y(this);setTimeout(()=>{window.validationPassed===!0&&o("fynd_website.form.submitted",s?{submitted_form:s}:{})},10)})}),r.forEach(i=>{i.addEventListener("click",function(){o("fynd_website.sign_up.clicked")})}),t.forEach(i=>{i.addEventListener("click",function(){o("fynd_website.sign_in.clicked")})}),e.forEach(i=>{i.addEventListener("click",function(){o("fynd_website.scroll_to_form.clicked")})}),n.forEach(i=>{i.addEventListener("click",function(){o("fynd_website.book_a_demo.clicked")})});let c=document.querySelectorAll("[ph-form-field]"),u=new Set;c.forEach(i=>{let s=i.tagName.toLowerCase(),m=i.type?.toLowerCase(),f=function(){let _=y(this)||"unknown-form";u.has(_)||(u.add(_),o("fynd_website.form.started"))};s==="button"||s==="input"&&m==="submit"||i.addEventListener("focus",f),s==="button"||s==="input"&&m==="submit"?i.addEventListener("click",f):s==="select"?i.addEventListener("change",f):i.addEventListener("input",f)})});window.getPosthogTrackingProperties=d;window.trackEvent=o;window.getGaTrackingProperties=g;})();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../bin/live-reload.js", "../../src/posthog/main.ts"],
4
- "sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n console.log(\"Live reload disabled: not running on localhost\");\n}\n", "// trackingIntegration.ts - PostHog tracking with user journey integration\nimport { FormDetails, UserJourney } from '../utils/types/user-journey';\n\n// TypeScript interface for GTM dataLayer events\ninterface GTMEvent {\n event: string;\n event_category: string;\n event_label: string;\n form_id?: string;\n form_name?: string;\n form_first_name?: string;\n form_last_name?: string;\n form_email?: string;\n form_phone?: string;\n submitted_form?: string;\n [key: string]: any; // Allow additional properties\n}\n\n// GA tracking properties interface (form-related only)\ninterface GATrackingProperties {\n form_id?: string;\n form_name?: string;\n form_first_name?: string;\n form_last_name?: string;\n form_email?: string;\n form_phone?: string;\n submitted_form?: string;\n}\n\n// Define tracking properties interface\ninterface TrackingProperties {\n 'fynd_website.source_page': string;\n 'fynd_website.product': string;\n 'fynd_website.device_type': string;\n 'fynd_website.utm_source': string;\n 'fynd_website.utm_medium': string;\n 'fynd_website.utm_campaign': string;\n 'fynd_website.referrer': string;\n // Form details from user journey\n 'fynd_website.form_id'?: string;\n 'fynd_website.form_name'?: string;\n 'fynd_website.form_first_name'?: string;\n 'fynd_website.form_last_name'?: string;\n 'fynd_website.form_email'?: string;\n 'fynd_website.form_phone'?: string;\n // User journey details\n 'fynd_website.journey_total_pages'?: number;\n 'fynd_website.journey_session_duration'?: number;\n 'fynd_website.journey_first_page'?: string;\n 'fynd_website.journey_current_page'?: string;\n 'fynd_website.journey_device'?: string;\n 'fynd_website.journey_browser'?: string;\n 'fynd_website.journey_device_name'?: string;\n 'fynd_website.journey_origin'?: string;\n 'fynd_website.journey_touchpoints'?: any; // Array of touchpoints from userJourney field\n 'fynd_website.journey_touchpoints_count'?: number;\n 'fynd_website.journey_utm_path'?: string;\n 'fynd_website.journey_entry_time'?: string;\n 'fynd_website.journey_exit_time'?: string;\n 'fynd_website.journey_scroll_depth'?: number;\n // Additional event-specific properties\n submitted_form?: string;\n field_type?: string;\n field_name?: string;\n [key: string]: any; // Allow additional properties\n}\n\ndeclare global {\n interface Window {\n trackEvent: (eventName: string, properties?: any) => void;\n getPosthogTrackingProperties: () => TrackingProperties;\n getGaTrackingProperties: () => GATrackingProperties;\n validationPassed?: boolean;\n getUserJourney: () => UserJourney | null;\n dataLayer?: GTMEvent[];\n }\n}\n\n// GA tracking properties function (form-related data only)\nconst getGaTrackingProperties = (): GATrackingProperties => {\n const gaProperties: GATrackingProperties = {};\n\n // Get user journey data if available\n try {\n // Try to get from getUserJourney function first\n let journey = null;\n if (typeof (window as any).getUserJourney === 'function') {\n journey = (window as any).getUserJourney();\n }\n\n // If not available from function, try to get directly from sessionStorage\n if (!journey) {\n const storedData = sessionStorage.getItem('userJourney');\n if (storedData) {\n journey = JSON.parse(storedData);\n }\n }\n\n if (journey && journey.formDetails) {\n const formDetails: FormDetails = journey.formDetails;\n\n // Only add form properties if they have values\n if (formDetails.formId) {\n gaProperties.form_id = formDetails.formId;\n }\n if (formDetails.formName) {\n gaProperties.form_name = formDetails.formName;\n }\n if (formDetails.firstName) {\n gaProperties.form_first_name = formDetails.firstName;\n }\n if (formDetails.lastName) {\n gaProperties.form_last_name = formDetails.lastName;\n }\n if (formDetails.email) {\n gaProperties.form_email = formDetails.email;\n }\n if (formDetails.phone) {\n gaProperties.form_phone = formDetails.phone;\n }\n }\n } catch (error) {\n console.warn('Error getting user journey data for GA tracking:', error);\n }\n\n return gaProperties;\n};\n\n// Enhanced tracking properties function\nconst getPosthogTrackingProperties = (): TrackingProperties => {\n const pathname: string = window.location.pathname;\n\n // Base tracking properties\n const baseProperties: TrackingProperties = {\n 'fynd_website.source_page': pathname,\n 'fynd_website.product': \"fynd.com website\",\n 'fynd_website.device_type': \"Unknown\", // Will be updated from user journey\n 'fynd_website.utm_source':\n new URLSearchParams(window.location.search).get(\"utm_source\") || \"\",\n 'fynd_website.utm_medium':\n new URLSearchParams(window.location.search).get(\"utm_medium\") || \"\",\n 'fynd_website.utm_campaign':\n new URLSearchParams(window.location.search).get(\"utm_campaign\") || \"\",\n 'fynd_website.referrer': document.referrer,\n };\n\n // Get user journey data if available\n try {\n // Try to get from getUserJourney function first\n let journey = null;\n if (typeof (window as any).getUserJourney === 'function') {\n journey = (window as any).getUserJourney();\n }\n\n // If not available from function, try to get directly from sessionStorage\n if (!journey) {\n const storedData = sessionStorage.getItem('userJourney');\n if (storedData) {\n journey = JSON.parse(storedData);\n }\n }\n\n if (journey) {\n // Add the complete user journey object as touchpoints\n baseProperties['fynd_website.journey_touchpoints'] = journey.userJourney || journey;\n\n // Add form details if available\n if (journey.formDetails) {\n const formDetails: FormDetails = journey.formDetails;\n\n // Only add form properties if they have values\n if (formDetails.formId) {\n baseProperties['fynd_website.form_id'] = formDetails.formId;\n }\n if (formDetails.formName) {\n baseProperties['fynd_website.form_name'] = formDetails.formName;\n }\n if (formDetails.firstName) {\n baseProperties['fynd_website.form_first_name'] = formDetails.firstName;\n }\n if (formDetails.lastName) {\n baseProperties['fynd_website.form_last_name'] = formDetails.lastName;\n }\n if (formDetails.email) {\n baseProperties['fynd_website.form_email'] = formDetails.email;\n }\n if (formDetails.phone) {\n baseProperties['fynd_website.form_phone'] = formDetails.phone;\n }\n }\n\n // Add journey metadata\n if (journey.userJourney && journey.userJourney.length > 0) {\n baseProperties['fynd_website.journey_total_pages'] = journey.userJourney.length;\n baseProperties['fynd_website.journey_touchpoints_count'] = journey.userJourney.length;\n baseProperties['fynd_website.journey_first_page'] = journey.userJourney[0].page;\n baseProperties['fynd_website.journey_current_page'] = journey.userJourney[journey.userJourney.length - 1].page;\n\n // Calculate session duration\n const firstVisit = new Date(journey.userJourney[0].time);\n const lastVisit = new Date(journey.userJourney[journey.userJourney.length - 1].time);\n baseProperties['fynd_website.journey_session_duration'] = Math.floor((lastVisit.getTime() - firstVisit.getTime()) / 1000);\n \n // Add entry and exit times\n baseProperties['fynd_website.journey_entry_time'] = journey.userJourney[0].time;\n baseProperties['fynd_website.journey_exit_time'] = journey.userJourney[journey.userJourney.length - 1].time;\n }\n\n // Add device and browser info from journey\n if (journey.deviceCategory) {\n // Device category is already capitalized from user journey\n baseProperties['fynd_website.device_type'] = journey.deviceCategory;\n }\n if (journey.browser) {\n baseProperties['fynd_website.journey_browser'] = journey.browser;\n }\n if (journey.device) {\n baseProperties['fynd_website.journey_device'] = journey.device;\n }\n if (journey.origin) {\n baseProperties['fynd_website.journey_origin'] = journey.origin;\n }\n \n // Add UTM path if available\n if (journey.utmPath) {\n baseProperties['fynd_website.journey_utm_path'] = journey.utmPath;\n }\n \n // Add scroll depth if available\n if (journey.scrollDepth) {\n baseProperties['fynd_website.journey_scroll_depth'] = journey.scrollDepth;\n }\n }\n } catch (error) {\n console.warn('Error getting user journey data for tracking:', error);\n }\n\n // Fallback device type calculation if user journey isn't available\n if (baseProperties['fynd_website.device_type'] === \"Unknown\") {\n const userAgent = navigator.userAgent;\n \n // Check for tablets first\n if (/iPad/.test(userAgent) || \n (/Android/.test(userAgent) && !/Mobile/.test(userAgent)) ||\n /Tablet/.test(userAgent)) {\n baseProperties['fynd_website.device_type'] = \"Tablet\";\n }\n // Check for mobile devices\n else if (/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(userAgent)) {\n baseProperties['fynd_website.device_type'] = \"Mobile\";\n }\n // Default to desktop\n else {\n baseProperties['fynd_website.device_type'] = \"Desktop\";\n }\n }\n\n return baseProperties;\n};\n\n// Function to send event to GA via dataLayer\nconst sendToGA = (eventName: string, gaProperties: GATrackingProperties, additionalProperties?: any): void => {\n if ((window as any).dataLayer) {\n const eventData: GTMEvent = {\n event: eventName,\n event_category: 'form_interaction',\n event_label: eventName,\n ...gaProperties\n };\n\n // Add submitted_form from additional properties if available\n if (additionalProperties?.submitted_form) {\n eventData.submitted_form = additionalProperties.submitted_form;\n }\n\n (window as any).dataLayer.push(eventData);\n console.log('Event sent to GA:', eventData);\n } else {\n console.log('dataLayer not available for GA tracking');\n }\n};\n\n// Track event function\nconst trackEvent = (eventName: string, properties?: Partial<TrackingProperties>): void => {\n try {\n // Get PostHog tracking properties (all data)\n const trackingProps = getPosthogTrackingProperties();\n\n // Merge with additional properties if provided\n const finalProperties = properties ? { ...trackingProps, ...properties } : trackingProps;\n\n // Track with PostHog if available\n if ((window as any).posthog) {\n (window as any).posthog.capture(eventName, finalProperties);\n console.log('Event sent to PostHog:', { event: eventName, properties: finalProperties });\n }\n\n // Get GA tracking properties (form-related data only)\n const gaProperties = getGaTrackingProperties();\n\n // Only send to GA if there's form-related data or it's a form-related event\n const isFormRelatedEvent = eventName.includes('form') || \n Object.keys(gaProperties).length > 0 || \n properties?.submitted_form;\n\n if (isFormRelatedEvent) {\n sendToGA(eventName, gaProperties, properties);\n }\n\n // Optional: Console log for debugging (remove in production)\n // console.log('Tracked event:', eventName, finalProperties);\n } catch (error) {\n console.error('Error tracking event:', error);\n }\n};\n\n// Helper function to get parent form name\nconst getParentFormName = (element: HTMLElement): string | null => {\n const parentForm = element.closest(\"form\") as HTMLFormElement | null;\n if (parentForm) {\n return parentForm.getAttribute(\"data-name\") ||\n parentForm.getAttribute(\"name\") ||\n parentForm.id ||\n null;\n }\n return null;\n};\n\n// Initialize PostHog pageview\ndocument.addEventListener(\"DOMContentLoaded\", function (): void {\n const trackingProps = getPosthogTrackingProperties();\n\n // PostHog pageview\n if ((window as any).posthog) {\n (window as any).posthog.capture(\"$pageview\", trackingProps);\n }\n});\n\n// Track page load event\nwindow.addEventListener(\"load\", function (): void {\n const trackingProps = getPosthogTrackingProperties();\n console.log(\"Tracking Properties on Page Load:\", trackingProps);\n \n trackEvent(\"fynd_website.page.loaded\");\n\n // Check if this is the thank you page and trigger form success event\n checkThankYouPageEvent();\n});\n\n// Function to check and trigger thank you page event\nfunction checkThankYouPageEvent(): void {\n const currentPath = window.location.pathname;\n\n // Check if current page is thank you page\n if (currentPath === '/thank-you') {\n // Check if this is a page reload (not initial navigation)\n const navigationEntries = performance.getEntriesByType('navigation');\n if (navigationEntries.length > 0) {\n const navEntry = navigationEntries[0] as PerformanceNavigationTiming;\n\n // Check if it's a reload (type === 'reload') or if there's a referrer from the same origin\n const isReload = navEntry.type === 'reload' ||\n (document.referrer && new URL(document.referrer).origin === window.location.origin);\n\n if (isReload) {\n // Trigger event after 200ms delay\n setTimeout(() => {\n trackEvent(\"fynd_website.form.success\");\n }, 200);\n }\n }\n }\n}\n\n// Button click tracking for sign up, sign in, scroll to form and book a demo buttons\ndocument.addEventListener(\"DOMContentLoaded\", function (): void {\n const signUpButtons = document.querySelectorAll('[data-ph=\"sign-up\"]') as NodeListOf<Element>;\n const signInButtons = document.querySelectorAll('[data-ph=\"sign-in\"]') as NodeListOf<Element>;\n const scrollToFormButtons = document.querySelectorAll(\n '[href=\"#footer-form\"]'\n ) as NodeListOf<Element>;\n const bookADemoButtons = document.querySelectorAll('[data-ph=\"book-a-demo\"]') as NodeListOf<Element>;\n const submitButtons = document.querySelectorAll('[type=\"submit\"]') as NodeListOf<Element>;\n\n submitButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (this: HTMLElement): void {\n const formName = getParentFormName(this);\n setTimeout(() => {\n if (window.validationPassed === true) {\n // If validation passed, track the submit event\n const additionalProps = formName ? { submitted_form: formName } : {};\n trackEvent(\"fynd_website.form.submitted\", additionalProps);\n }\n }, 10);\n });\n });\n\n signUpButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (): void {\n trackEvent(\"fynd_website.sign_up.clicked\");\n });\n });\n\n signInButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (): void {\n trackEvent(\"fynd_website.sign_in.clicked\");\n });\n });\n\n scrollToFormButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (): void {\n trackEvent(\"fynd_website.scroll_to_form.clicked\");\n });\n });\n\n bookADemoButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (): void {\n trackEvent(\"fynd_website.book_a_demo.clicked\");\n });\n });\n\n // Form field change tracking for fynd_form_started event\n const formFields = document.querySelectorAll('[ph-form-field]') as NodeListOf<HTMLElement>;\n \n // Set to track which forms have already triggered the event\n const triggeredForms = new Set<string>();\n\n formFields.forEach((field: HTMLElement) => {\n // Handle different element types\n const tagName = field.tagName.toLowerCase();\n const inputType = (field as HTMLInputElement).type?.toLowerCase();\n \n // Function to handle form started event\n const handleFormStarted = function (this: HTMLElement): void {\n const formName = getParentFormName(this);\n const formIdentifier = formName || 'unknown-form';\n \n // Only trigger once per form to avoid duplicate events\n if (!triggeredForms.has(formIdentifier)) {\n triggeredForms.add(formIdentifier);\n \n trackEvent(\"fynd_website.form.started\");\n }\n };\n \n // Add focus event for all interactive form fields (except buttons)\n if (!(tagName === 'button' || (tagName === 'input' && inputType === 'submit'))) {\n field.addEventListener('focus', handleFormStarted);\n }\n \n // Add specific interaction events as before\n if (tagName === 'button' || (tagName === 'input' && inputType === 'submit')) {\n field.addEventListener('click', handleFormStarted);\n } else if (tagName === 'select') {\n field.addEventListener('change', handleFormStarted);\n } else {\n field.addEventListener('input', handleFormStarted);\n }\n });\n});\n\n// Make functions globally accessible\nwindow.getPosthogTrackingProperties = getPosthogTrackingProperties;\nwindow.trackEvent = trackEvent;\nwindow.getGaTrackingProperties = getGaTrackingProperties;\n\n// Export for module usage\nexport {\n getPosthogTrackingProperties,\n getGaTrackingProperties,\n trackEvent,\n sendToGA,\n getParentFormName,\n type TrackingProperties,\n type GATrackingProperties,\n type GTMEvent\n};"],
5
- "mappings": ";;;AACA,MACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,QAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,MAAiB;AAAA,MAAU,MACpE,SAAS,OAAO;AAAA,IAClB;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,gDAAgD;AAAA,EAC9D;;;ACqEA,MAAM,0BAA0B,MAA4B;AACxD,UAAM,eAAqC,CAAC;AAG5C,QAAI;AAEA,UAAI,UAAU;AACd,UAAI,OAAQ,OAAe,mBAAmB,YAAY;AACtD,kBAAW,OAAe,eAAe;AAAA,MAC7C;AAGA,UAAI,CAAC,SAAS;AACV,cAAM,aAAa,eAAe,QAAQ,aAAa;AACvD,YAAI,YAAY;AACZ,oBAAU,KAAK,MAAM,UAAU;AAAA,QACnC;AAAA,MACJ;AAEA,UAAI,WAAW,QAAQ,aAAa;AA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;AAAA,IACL,CAAC;AAGD,UAAM,aAAa,SAAS,iBAAiB,iBAAiB;AAG9D,UAAM,iBAAiB,oBAAI,IAAY;AAEvC,eAAW,QAAQ,CAAC,UAAuB;AAEvC,YAAM,UAAU,MAAM,QAAQ,YAAY;AAC1C,YAAM,YAAa,MAA2B,MAAM,YAAY;AAGhE,YAAM,oBAAoB,WAAmC;AACzD,cAAM,WAAW,kBAAkB,IAAI;AACvC,cAAM,iBAAiB,YAAY;AAGnC,YAAI,CAAC,eAAe,IAAI,cAAc,GAAG;AACrC,yBAAe,IAAI,cAAc;AAEjC,qBAAW,2BAA2B;AAAA,QAC1C;AAAA,MACJ;AAGA,UAAI,EAAE,YAAY,YAAa,YAAY,WAAW,cAAc,WAAY;AAC5E,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACrD;AAGA,UAAI,YAAY,YAAa,YAAY,WAAW,cAAc,UAAW;AACzE,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACrD,WAAW,YAAY,UAAU;AAC7B,cAAM,iBAAiB,UAAU,iBAAiB;AAAA,MACtD,OAAO;AACH,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACrD;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAGD,SAAO,+BAA+B;AACtC,SAAO,aAAa;AACpB,SAAO,0BAA0B;",
4
+ "sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n console.log(\"Live reload disabled: not running on localhost\");\n}\n", "// trackingIntegration.ts - PostHog tracking with user journey integration\nimport { FormDetails, UserJourney } from '../utils/types/user-journey';\n\n// TypeScript interface for GTM dataLayer events\ninterface GTMEvent {\n event: string;\n event_category: string;\n event_label: string;\n form_id?: string;\n form_name?: string;\n form_first_name?: string;\n form_last_name?: string;\n form_email?: string;\n form_phone?: string;\n submitted_form?: string;\n [key: string]: any; // Allow additional properties\n}\n\n// GA tracking properties interface (form-related only)\ninterface GATrackingProperties {\n form_id?: string;\n form_name?: string;\n form_first_name?: string;\n form_last_name?: string;\n form_email?: string;\n form_phone?: string;\n submitted_form?: string;\n}\n\n// Define tracking properties interface\ninterface TrackingProperties {\n 'fynd_website.source_page': string;\n 'fynd_website.product': string;\n 'fynd_website.device_type': string;\n 'fynd_website.utm_source': string;\n 'fynd_website.utm_medium': string;\n 'fynd_website.utm_campaign': string;\n 'fynd_website.referrer': string;\n // Form details from user journey\n 'fynd_website.form_id'?: string;\n 'fynd_website.form_name'?: string;\n 'fynd_website.form_first_name'?: string;\n 'fynd_website.form_last_name'?: string;\n 'fynd_website.form_email'?: string;\n 'fynd_website.form_phone'?: string;\n // User journey details\n 'fynd_website.journey_total_pages'?: number;\n 'fynd_website.journey_session_duration'?: number;\n 'fynd_website.journey_first_page'?: string;\n 'fynd_website.journey_current_page'?: string;\n 'fynd_website.journey_device'?: string;\n 'fynd_website.journey_browser'?: string;\n 'fynd_website.journey_device_name'?: string;\n 'fynd_website.journey_origin'?: string;\n 'fynd_website.journey_touchpoints'?: any; // Array of touchpoints from userJourney field\n 'fynd_website.journey_touchpoints_count'?: number;\n 'fynd_website.journey_utm_path'?: string;\n 'fynd_website.journey_entry_time'?: string;\n 'fynd_website.journey_exit_time'?: string;\n 'fynd_website.journey_scroll_depth'?: number;\n // Additional event-specific properties\n submitted_form?: string;\n field_type?: string;\n field_name?: string;\n [key: string]: any; // Allow additional properties\n}\n\ndeclare global {\n interface Window {\n trackEvent: (eventName: string, properties?: any) => void;\n getPosthogTrackingProperties: () => TrackingProperties;\n getGaTrackingProperties: () => GATrackingProperties;\n validationPassed?: boolean;\n getUserJourney: () => UserJourney | null;\n dataLayer?: GTMEvent[];\n }\n}\n\n// GA tracking properties function (form-related data only)\nconst getGaTrackingProperties = (): GATrackingProperties => {\n const gaProperties: GATrackingProperties = {};\n\n // Get user journey data if available\n try {\n // Try to get from getUserJourney function first\n let journey = null;\n if (typeof (window as any).getUserJourney === 'function') {\n journey = (window as any).getUserJourney();\n }\n\n // If not available from function, try to get directly from sessionStorage\n if (!journey) {\n const storedData = sessionStorage.getItem('userJourney');\n if (storedData) {\n journey = JSON.parse(storedData);\n }\n }\n\n if (journey && journey.formDetails) {\n const formDetails: FormDetails = journey.formDetails;\n\n // Only add form properties if they have values\n if (formDetails.formId) {\n gaProperties.form_id = formDetails.formId;\n }\n if (formDetails.formName) {\n gaProperties.form_name = formDetails.formName;\n }\n if (formDetails.firstName) {\n gaProperties.form_first_name = formDetails.firstName;\n }\n if (formDetails.lastName) {\n gaProperties.form_last_name = formDetails.lastName;\n }\n if (formDetails.email) {\n gaProperties.form_email = formDetails.email;\n }\n if (formDetails.phone) {\n gaProperties.form_phone = formDetails.phone;\n }\n }\n } catch (error) {\n console.warn('Error getting user journey data for GA tracking:', error);\n }\n\n return gaProperties;\n};\n\n// Enhanced tracking properties function\nconst getPosthogTrackingProperties = (): TrackingProperties => {\n const pathname: string = window.location.pathname;\n\n // Base tracking properties\n const baseProperties: TrackingProperties = {\n 'fynd_website.source_page': pathname,\n 'fynd_website.product': \"fynd.com website\",\n 'fynd_website.device_type': \"Unknown\", // Will be updated from user journey\n 'fynd_website.utm_source':\n new URLSearchParams(window.location.search).get(\"utm_source\") || \"\",\n 'fynd_website.utm_medium':\n new URLSearchParams(window.location.search).get(\"utm_medium\") || \"\",\n 'fynd_website.utm_campaign':\n new URLSearchParams(window.location.search).get(\"utm_campaign\") || \"\",\n 'fynd_website.referrer': document.referrer,\n };\n\n // Get user journey data if available\n try {\n // Try to get from getUserJourney function first\n let journey = null;\n if (typeof (window as any).getUserJourney === 'function') {\n journey = (window as any).getUserJourney();\n }\n\n // If not available from function, try to get directly from sessionStorage\n if (!journey) {\n const storedData = sessionStorage.getItem('userJourney');\n if (storedData) {\n journey = JSON.parse(storedData);\n }\n }\n\n if (journey) {\n // Add the complete user journey object as touchpoints\n baseProperties['fynd_website.journey_touchpoints'] = journey.userJourney || journey;\n\n // Add form details if available\n if (journey.formDetails) {\n const formDetails: FormDetails = journey.formDetails;\n\n // Only add form properties if they have values\n if (formDetails.formId) {\n baseProperties['fynd_website.form_id'] = formDetails.formId;\n }\n if (formDetails.formName) {\n baseProperties['fynd_website.form_name'] = formDetails.formName;\n }\n if (formDetails.firstName) {\n baseProperties['fynd_website.form_first_name'] = formDetails.firstName;\n }\n if (formDetails.lastName) {\n baseProperties['fynd_website.form_last_name'] = formDetails.lastName;\n }\n if (formDetails.email) {\n baseProperties['fynd_website.form_email'] = formDetails.email;\n }\n if (formDetails.phone) {\n baseProperties['fynd_website.form_phone'] = formDetails.phone;\n }\n }\n\n // Add journey metadata\n if (journey.userJourney && journey.userJourney.length > 0) {\n baseProperties['fynd_website.journey_total_pages'] = journey.userJourney.length;\n baseProperties['fynd_website.journey_touchpoints_count'] = journey.userJourney.length;\n baseProperties['fynd_website.journey_first_page'] = journey.userJourney[0].page;\n baseProperties['fynd_website.journey_current_page'] = journey.userJourney[journey.userJourney.length - 1].page;\n\n // Calculate session duration\n const firstVisit = new Date(journey.userJourney[0].time);\n const lastVisit = new Date(journey.userJourney[journey.userJourney.length - 1].time);\n baseProperties['fynd_website.journey_session_duration'] = Math.floor((lastVisit.getTime() - firstVisit.getTime()) / 1000);\n \n // Add entry and exit times\n baseProperties['fynd_website.journey_entry_time'] = journey.userJourney[0].time;\n baseProperties['fynd_website.journey_exit_time'] = journey.userJourney[journey.userJourney.length - 1].time;\n }\n\n // Add device and browser info from journey\n if (journey.deviceCategory) {\n // Device category is already capitalized from user journey\n baseProperties['fynd_website.device_type'] = journey.deviceCategory;\n }\n if (journey.browser) {\n baseProperties['fynd_website.journey_browser'] = journey.browser;\n }\n if (journey.device) {\n baseProperties['fynd_website.journey_device'] = journey.device;\n }\n if (journey.origin) {\n baseProperties['fynd_website.journey_origin'] = journey.origin;\n }\n \n // Add UTM path if available\n if (journey.utmPath) {\n baseProperties['fynd_website.journey_utm_path'] = journey.utmPath;\n }\n \n // Add scroll depth if available\n if (journey.scrollDepth) {\n baseProperties['fynd_website.journey_scroll_depth'] = journey.scrollDepth;\n }\n }\n } catch (error) {\n console.warn('Error getting user journey data for tracking:', error);\n }\n\n // Fallback device type calculation if user journey isn't available\n if (baseProperties['fynd_website.device_type'] === \"Unknown\") {\n const userAgent = navigator.userAgent;\n \n // Check for tablets first\n if (/iPad/.test(userAgent) || \n (/Android/.test(userAgent) && !/Mobile/.test(userAgent)) ||\n /Tablet/.test(userAgent)) {\n baseProperties['fynd_website.device_type'] = \"Tablet\";\n }\n // Check for mobile devices\n else if (/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(userAgent)) {\n baseProperties['fynd_website.device_type'] = \"Mobile\";\n }\n // Default to desktop\n else {\n baseProperties['fynd_website.device_type'] = \"Desktop\";\n }\n }\n\n return baseProperties;\n};\n\n// Function to send event to GA via dataLayer\nconst sendToGA = (eventName: string, gaProperties: GATrackingProperties, additionalProperties?: any): void => {\n if ((window as any).dataLayer) {\n const eventData: GTMEvent = {\n event: eventName,\n event_category: 'form_interaction',\n event_label: eventName,\n ...gaProperties\n };\n\n // Add submitted_form from additional properties if available\n if (additionalProperties?.submitted_form) {\n eventData.submitted_form = additionalProperties.submitted_form;\n }\n\n (window as any).dataLayer.push(eventData);\n // console.log('Event sent to GA:', eventData);\n } else {\n console.warn('dataLayer not available for GA tracking');\n }\n};\n\n// Track event function\nconst trackEvent = (eventName: string, properties?: Partial<TrackingProperties>): void => {\n try {\n // Get PostHog tracking properties (all data)\n const trackingProps = getPosthogTrackingProperties();\n\n // Merge with additional properties if provided\n const finalProperties = properties ? { ...trackingProps, ...properties } : trackingProps;\n\n // Track with PostHog if available\n if ((window as any).posthog) {\n (window as any).posthog.capture(eventName, finalProperties);\n // console.log('Event sent to PostHog:', { event: eventName, properties: finalProperties });\n }\n\n // Get GA tracking properties (form-related data only)\n const gaProperties = getGaTrackingProperties();\n\n // Only send to GA if there's form-related data or it's a form-related event\n const isFormRelatedEvent = eventName.includes('form') || \n Object.keys(gaProperties).length > 0 || \n properties?.submitted_form;\n\n if (isFormRelatedEvent) {\n sendToGA(eventName, gaProperties, properties);\n }\n\n // Optional: Console log for debugging (remove in production)\n // console.log('Tracked event:', eventName, finalProperties);\n } catch (error) {\n console.error('Error tracking event:', error);\n }\n};\n\n// Helper function to get parent form name\nconst getParentFormName = (element: HTMLElement): string | null => {\n const parentForm = element.closest(\"form\") as HTMLFormElement | null;\n if (parentForm) {\n return parentForm.getAttribute(\"data-name\") ||\n parentForm.getAttribute(\"name\") ||\n parentForm.id ||\n null;\n }\n return null;\n};\n\n// Initialize PostHog pageview\ndocument.addEventListener(\"DOMContentLoaded\", function (): void {\n const trackingProps = getPosthogTrackingProperties();\n\n // PostHog pageview\n if ((window as any).posthog) {\n (window as any).posthog.capture(\"$pageview\", trackingProps);\n }\n});\n\n// Track page load event\nwindow.addEventListener(\"load\", function (): void {\n const trackingProps = getPosthogTrackingProperties();\n // console.log(\"Tracking Properties on Page Load:\", trackingProps);\n \n trackEvent(\"fynd_website.page.loaded\");\n\n // Check if this is the thank you page and trigger form success event\n checkThankYouPageEvent();\n});\n\n// Function to check and trigger thank you page event\nfunction checkThankYouPageEvent(): void {\n const currentPath = window.location.pathname;\n\n // Check if current page is thank you page\n if (currentPath === '/thank-you') {\n // Check if this is a page reload (not initial navigation)\n const navigationEntries = performance.getEntriesByType('navigation');\n if (navigationEntries.length > 0) {\n const navEntry = navigationEntries[0] as PerformanceNavigationTiming;\n\n // Check if it's a reload (type === 'reload') or if there's a referrer from the same origin\n const isReload = navEntry.type === 'reload' ||\n (document.referrer && new URL(document.referrer).origin === window.location.origin);\n\n if (isReload) {\n // Trigger event after 200ms delay\n setTimeout(() => {\n trackEvent(\"fynd_website.form.success\");\n }, 200);\n }\n }\n }\n}\n\n// Button click tracking for sign up, sign in, scroll to form and book a demo buttons\ndocument.addEventListener(\"DOMContentLoaded\", function (): void {\n const signUpButtons = document.querySelectorAll('[data-ph=\"sign-up\"]') as NodeListOf<Element>;\n const signInButtons = document.querySelectorAll('[data-ph=\"sign-in\"]') as NodeListOf<Element>;\n const scrollToFormButtons = document.querySelectorAll(\n '[href=\"#footer-form\"]'\n ) as NodeListOf<Element>;\n const bookADemoButtons = document.querySelectorAll('[data-ph=\"book-a-demo\"]') as NodeListOf<Element>;\n const submitButtons = document.querySelectorAll('[type=\"submit\"]') as NodeListOf<Element>;\n\n submitButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (this: HTMLElement): void {\n const formName = getParentFormName(this);\n setTimeout(() => {\n if (window.validationPassed === true) {\n // If validation passed, track the submit event\n const additionalProps = formName ? { submitted_form: formName } : {};\n trackEvent(\"fynd_website.form.submitted\", additionalProps);\n }\n }, 10);\n });\n });\n\n signUpButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (): void {\n trackEvent(\"fynd_website.sign_up.clicked\");\n });\n });\n\n signInButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (): void {\n trackEvent(\"fynd_website.sign_in.clicked\");\n });\n });\n\n scrollToFormButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (): void {\n trackEvent(\"fynd_website.scroll_to_form.clicked\");\n });\n });\n\n bookADemoButtons.forEach((button: Element) => {\n button.addEventListener(\"click\", function (): void {\n trackEvent(\"fynd_website.book_a_demo.clicked\");\n });\n });\n\n // Form field change tracking for fynd_form_started event\n const formFields = document.querySelectorAll('[ph-form-field]') as NodeListOf<HTMLElement>;\n \n // Set to track which forms have already triggered the event\n const triggeredForms = new Set<string>();\n\n formFields.forEach((field: HTMLElement) => {\n // Handle different element types\n const tagName = field.tagName.toLowerCase();\n const inputType = (field as HTMLInputElement).type?.toLowerCase();\n \n // Function to handle form started event\n const handleFormStarted = function (this: HTMLElement): void {\n const formName = getParentFormName(this);\n const formIdentifier = formName || 'unknown-form';\n \n // Only trigger once per form to avoid duplicate events\n if (!triggeredForms.has(formIdentifier)) {\n triggeredForms.add(formIdentifier);\n \n trackEvent(\"fynd_website.form.started\");\n }\n };\n \n // Add focus event for all interactive form fields (except buttons)\n if (!(tagName === 'button' || (tagName === 'input' && inputType === 'submit'))) {\n field.addEventListener('focus', handleFormStarted);\n }\n \n // Add specific interaction events as before\n if (tagName === 'button' || (tagName === 'input' && inputType === 'submit')) {\n field.addEventListener('click', handleFormStarted);\n } else if (tagName === 'select') {\n field.addEventListener('change', handleFormStarted);\n } else {\n field.addEventListener('input', handleFormStarted);\n }\n });\n});\n\n// Make functions globally accessible\nwindow.getPosthogTrackingProperties = getPosthogTrackingProperties;\nwindow.trackEvent = trackEvent;\nwindow.getGaTrackingProperties = getGaTrackingProperties;\n\n// Export for module usage\nexport {\n getPosthogTrackingProperties,\n getGaTrackingProperties,\n trackEvent,\n sendToGA,\n getParentFormName,\n type TrackingProperties,\n type GATrackingProperties,\n type GTMEvent\n};"],
5
+ "mappings": ";;;AACA,MACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,QAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,MAAiB;AAAA,MAAU,MACpE,SAAS,OAAO;AAAA,IAClB;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,gDAAgD;AAAA,EAC9D;;;ACqEA,MAAM,0BAA0B,MAA4B;AACxD,UAAM,eAAqC,CAAC;AAG5C,QAAI;AAEA,UAAI,UAAU;AACd,UAAI,OAAQ,OAAe,mBAAmB,YAAY;AACtD,kBAAW,OAAe,eAAe;AAAA,MAC7C;AAGA,UAAI,CAAC,SAAS;AACV,cAAM,aAAa,eAAe,QAAQ,aAAa;AACvD,YAAI,YAAY;AACZ,oBAAU,KAAK,MAAM,UAAU;AAAA,QACnC;AAAA,MACJ;AAEA,UAAI,WAAW,QAAQ,aAAa;AAChC,cAAM,cAA2B,QAAQ;AAGzC,YAAI,YAAY,QAAQ;AACpB,uBAAa,UAAU,YAAY;AAAA,QACvC;AACA,YAAI,YAAY,UAAU;AACtB,u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BAAkB,IAAI;AACvC,cAAM,iBAAiB,YAAY;AAGnC,YAAI,CAAC,eAAe,IAAI,cAAc,GAAG;AACrC,yBAAe,IAAI,cAAc;AAEjC,qBAAW,2BAA2B;AAAA,QAC1C;AAAA,MACJ;AAGA,UAAI,EAAE,YAAY,YAAa,YAAY,WAAW,cAAc,WAAY;AAC5E,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACrD;AAGA,UAAI,YAAY,YAAa,YAAY,WAAW,cAAc,UAAW;AACzE,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACrD,WAAW,YAAY,UAAU;AAC7B,cAAM,iBAAiB,UAAU,iBAAiB;AAAA,MACtD,OAAO;AACH,cAAM,iBAAiB,SAAS,iBAAiB;AAAA,MACrD;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAGD,SAAO,+BAA+B;AACtC,SAAO,aAAa;AACpB,SAAO,0BAA0B;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- "use strict";(()=>{var s=class{constructor(){this.baseUrl="https://www.fynd.com",this.organizationData={"@type":"Organization","@id":`${this.baseUrl}#organization`,name:"Fynd",url:this.baseUrl,logo:`${this.baseUrl}/logo.png`,sameAs:["https://www.linkedin.com/company/fynd","https://en.wikipedia.org/wiki/Fynd","https://twitter.com/Fynd"],description:"Fynd is an AI-powered unified commerce platform enabling brands to manage end-to-end retail operations."}}generateWebsiteSchema(){return{"@type":"WebSite","@id":`${this.baseUrl}#website`,url:this.baseUrl,name:"Fynd",description:"AI-powered unified commerce platform",publisher:{"@id":`${this.baseUrl}#organization`},potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${this.baseUrl}/search?q={search_term_string}`},"query-input":"required name=search_term_string"}}}generateBreadcrumbSchema(e){return{"@type":"BreadcrumbList",itemListElement:e.map((t,r)=>({"@type":"ListItem",position:r+1,name:t.name,item:t.url}))}}generateWebPageSchema(e){let t={"@type":"WebPage","@id":e.url,url:e.url,name:e.title,description:e.description||"",isPartOf:{"@id":`${this.baseUrl}#website`}};return e.mainEntity&&(t.mainEntity=e.mainEntity),t}generateSoftwareSchema(e){return{"@type":"SoftwareApplication","@id":`${e.url}#software`,name:e.name,applicationCategory:e.category||"RetailSoftware",operatingSystem:"Web",featureList:e.features||[],offers:{"@type":"Offer",price:e.price||"Contact for Pricing",priceCurrency:"USD",availability:"InStock",url:`${this.baseUrl}/contact`},audience:{"@type":"Audience",audienceType:e.audience||"Business"},url:e.url,description:e.description,manufacturer:{"@id":`${this.baseUrl}#organization`}}}generateProductSchema(e){return{"@type":"Product",name:e.name,url:e.url,description:e.description,brand:{"@id":`${this.baseUrl}#organization`},offers:{"@type":"Offer",price:e.price||"Contact for Pricing",priceCurrency:"USD",availability:"InStock",url:`${this.baseUrl}/contact`}}}generateFAQSchema(e){return!e||e.length===0?null:{"@type":"FAQPage",mainEntity:e.map(t=>({"@type":"Question",name:t.question,acceptedAnswer:{"@type":"Answer",text:t.answer}}))}}generateArticleSchema(e){return{"@type":"Article",headline:e.title,description:e.description,image:e.image,author:{"@type":"Person",name:e.author||"Fynd Team"},publisher:{"@id":`${this.baseUrl}#organization`},datePublished:e.publishDate,dateModified:e.modifyDate||e.publishDate,mainEntityOfPage:{"@type":"WebPage","@id":e.url}}}generateSchema(e){let t=[];t.push(this.organizationData),t.push(this.generateWebsiteSchema());let r=this.generateWebPageSchema({url:e.url||window.location.href,title:e.title||document.title,description:e.description||document.querySelector('meta[name="description"]')?.content,mainEntity:e.mainEntity});switch(t.push(r),e.breadcrumbs&&t.push(this.generateBreadcrumbSchema(e.breadcrumbs)),e.pageType){case"solution":if(e.solutionData){let i=this.generateSoftwareSchema(e.solutionData);if(t.push(i),e.asProduct){let n=this.generateProductSchema({...e.solutionData});t.push(n)}}break;case"article":e.articleData&&t.push(this.generateArticleSchema(e.articleData));break;case"product":e.productData&&t.push(this.generateProductSchema(e.productData));break}if(e.faqs){let i=this.generateFAQSchema(e.faqs);i&&t.push(i)}return{"@context":"https://schema.org","@graph":t}}injectSchema(e){let t=document.querySelector('script[data-schema="fynd"]');t&&t.remove();let r=document.createElement("script");r.type="application/ld+json",r.setAttribute("data-schema","fynd"),r.textContent=JSON.stringify(e,null,2),document.head.appendChild(r)}},c=class{static safeJsonParse(e,t,r){try{return JSON.parse(e)}catch(i){return console.warn(`\u{1F50D} Fynd Schema: Failed to parse JSON${r?` for ${r}`:""}:`,{jsonString:e,error:i instanceof Error?i.message:i}),t}}static getConfigFromDataAttributes(){let e=document.body,t={url:"",title:"",description:"",pageType:"default"};switch(console.log("\u{1F50D} Fynd Schema: Body data attributes:",e.dataset),t.url=window.location.href,t.title=document.title,t.description=document.querySelector('meta[name="description"]')?.content,t.pageType=e.dataset.pageType||"default",e.dataset.breadcrumbs?t.breadcrumbs=this.safeJsonParse(e.dataset.breadcrumbs,this.generateBreadcrumbsFromURL(),"breadcrumbs"):t.breadcrumbs=this.generateBreadcrumbsFromURL(),t.pageType){case"solution":t.solutionData={name:e.dataset.solutionName||document.title,url:t.url,description:t.description||"",features:e.dataset.features?this.safeJsonParse(e.dataset.features,[],"features"):[],audience:e.dataset.audience,price:e.dataset.price,category:e.dataset.category},t.asProduct=e.dataset.asProduct==="true";break;case"article":t.articleData={title:t.title,url:t.url,description:t.description||"",author:e.dataset.author,publishDate:e.dataset.publishDate||new Date().toISOString(),modifyDate:e.dataset.modifyDate,image:e.dataset.image||document.querySelector('meta[property="og:image"]')?.content};break;case"product":t.productData={name:e.dataset.productName||document.title,url:t.url,description:t.description||"",price:e.dataset.price};break}return t.faqs=this.extractFAQsFromPage(),t}static extractFAQsFromPage(){let e=[];return document.querySelectorAll('[fynd-faq-element="wrapper"]').forEach(r=>{let i=r.querySelector('[fynd-faq-element="toggle"]'),n=r.querySelector('[fynd-faq-element="content"]');if(i&&n){let o=i.querySelector('div[class*="title"], div[data-text-style], .accordian-title'),d=o?(o.textContent||"").trim():"",m=n.querySelector('.richtext, [class*="richtext"], .rich-text, [class*="rich-text"]'),u=m?(m.textContent||"").trim():(n.textContent||"").trim();d&&u&&e.push({question:d,answer:u})}}),e.length>0?e:null}static generateBreadcrumbsFromURL(){let e=window.location.pathname.split("/").filter(i=>i),t=[{name:"Home",url:"https://www.fynd.com"}],r="https://www.fynd.com";return e.forEach(i=>{r+=`/${i}`,t.push({name:i.charAt(0).toUpperCase()+i.slice(1).replace("-"," "),url:r})}),t}};document.addEventListener("DOMContentLoaded",function(){console.log("\u{1F50D} Fynd Schema: DOM loaded, initializing schema...");try{let a=new s,e=c.getConfigFromDataAttributes();console.log("\u{1F50D} Fynd Schema: Page config:",e);let t=a.generateSchema(e);console.log("\u{1F50D} Fynd Schema: Generated schema:",t),a.injectSchema(t),console.log("\u{1F50D} Fynd Schema: Schema injected successfully!");let r=document.querySelector('script[data-schema="fynd"]');r?console.log("\u2705 Fynd Schema: Schema script found in DOM:",r):console.error("\u274C Fynd Schema: Schema script NOT found in DOM")}catch(a){console.error("\u274C Fynd Schema: Error during initialization:",a)}});window.FyndSchema={generator:s,configManager:c};})();
1
+ "use strict";(()=>{var s=class{constructor(){this.baseUrl="https://www.fynd.com",this.organizationData={"@type":"Organization","@id":`${this.baseUrl}#organization`,name:"Fynd",url:this.baseUrl,logo:`${this.baseUrl}/logo.png`,sameAs:["https://www.linkedin.com/company/fynd","https://en.wikipedia.org/wiki/Fynd","https://twitter.com/Fynd"],description:"Fynd is an AI-powered unified commerce platform enabling brands to manage end-to-end retail operations."}}generateWebsiteSchema(){return{"@type":"WebSite","@id":`${this.baseUrl}#website`,url:this.baseUrl,name:"Fynd",description:"AI-powered unified commerce platform",publisher:{"@id":`${this.baseUrl}#organization`},potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${this.baseUrl}/search?q={search_term_string}`},"query-input":"required name=search_term_string"}}}generateBreadcrumbSchema(e){return{"@type":"BreadcrumbList",itemListElement:e.map((t,r)=>({"@type":"ListItem",position:r+1,name:t.name,item:t.url}))}}generateWebPageSchema(e){let t={"@type":"WebPage","@id":e.url,url:e.url,name:e.title,description:e.description||"",isPartOf:{"@id":`${this.baseUrl}#website`}};return e.mainEntity&&(t.mainEntity=e.mainEntity),t}generateSoftwareSchema(e){let t={"@type":"SoftwareApplication","@id":`${e.url}#software`,name:e.name,applicationCategory:e.category||"RetailSoftware",operatingSystem:"Web",featureList:e.features||[],offers:{"@type":"Offer",price:e.price||"Contact for Pricing",priceCurrency:"USD",availability:"InStock",url:`${this.baseUrl}/contact`},audience:{"@type":"Audience",audienceType:e.audience||"Business"},url:e.url,description:e.description,manufacturer:{"@id":`${this.baseUrl}#organization`}};return e.proficiencyLevel&&(t.proficiencyLevel=e.proficiencyLevel),e.conditionsOfAccess&&(t.conditionsOfAccess=e.conditionsOfAccess),t}generateProductSchema(e){return{"@type":"Product",name:e.name,url:e.url,description:e.description,brand:{"@id":`${this.baseUrl}#organization`},offers:{"@type":"Offer",price:e.price||"Contact for Pricing",priceCurrency:"USD",availability:"InStock",url:`${this.baseUrl}/contact`}}}generateFAQSchema(e){return!e||e.length===0?null:{"@type":"FAQPage",mainEntity:e.map(t=>({"@type":"Question",name:t.question,acceptedAnswer:{"@type":"Answer",text:t.answer}}))}}generateArticleSchema(e){return{"@type":"Article",headline:e.title,description:e.description,image:e.image,author:{"@type":"Person",name:e.author||"Fynd Team"},publisher:{"@id":`${this.baseUrl}#organization`},datePublished:e.publishDate,dateModified:e.modifyDate||e.publishDate,mainEntityOfPage:{"@type":"WebPage","@id":e.url}}}generateSchema(e){let t=[];t.push(this.organizationData),t.push(this.generateWebsiteSchema());let r=this.generateWebPageSchema({url:e.url||window.location.href,title:e.title||document.title,description:e.description||document.querySelector('meta[name="description"]')?.content,mainEntity:e.mainEntity});switch(t.push(r),e.breadcrumbs&&t.push(this.generateBreadcrumbSchema(e.breadcrumbs)),e.pageType){case"solution":if(e.solutionData){let i=this.generateSoftwareSchema(e.solutionData);if(t.push(i),r.mainEntity={"@id":`${e.solutionData.url}#software`},e.asProduct){let n=this.generateProductSchema({...e.solutionData});t.push(n)}}break;case"article":e.articleData&&t.push(this.generateArticleSchema(e.articleData));break;case"product":e.productData&&t.push(this.generateProductSchema(e.productData));break}if(e.faqs){let i=this.generateFAQSchema(e.faqs);i&&t.push(i)}return{"@context":"https://schema.org","@graph":t}}injectSchema(e){let t=document.querySelector('script[data-schema="fynd"]');t&&t.remove();let r=document.createElement("script");r.type="application/ld+json",r.setAttribute("data-schema","fynd"),r.textContent=JSON.stringify(e,null,2),document.head.appendChild(r)}},c=class{static safeJsonParse(e,t,r){try{return JSON.parse(e)}catch(i){return console.warn(`\u{1F50D} Fynd Schema: Failed to parse JSON${r?` for ${r}`:""}:`,{jsonString:e,error:i instanceof Error?i.message:i}),t}}static getConfigFromDataAttributes(){let e=document.body,t={url:"",title:"",description:"",pageType:"default"};switch(console.log("\u{1F50D} Fynd Schema: Body data attributes:",e.dataset),t.url=window.location.href,t.title=document.title,t.description=document.querySelector('meta[name="description"]')?.content,t.pageType=e.dataset.pageType||"default",e.dataset.breadcrumbs?t.breadcrumbs=this.safeJsonParse(e.dataset.breadcrumbs,this.generateBreadcrumbsFromURL(),"breadcrumbs"):t.breadcrumbs=this.generateBreadcrumbsFromURL(),t.pageType){case"solution":t.solutionData={name:e.dataset.solutionName||document.title,url:t.url,description:t.description||"",features:e.dataset.features?this.safeJsonParse(e.dataset.features,[],"features"):[],audience:e.dataset.audience,price:e.dataset.price,category:e.dataset.category},t.asProduct=e.dataset.asProduct==="true";break;case"article":t.articleData={title:t.title,url:t.url,description:t.description||"",author:e.dataset.author,publishDate:e.dataset.publishDate||new Date().toISOString(),modifyDate:e.dataset.modifyDate,image:e.dataset.image||document.querySelector('meta[property="og:image"]')?.content};break;case"product":t.productData={name:e.dataset.productName||document.title,url:t.url,description:t.description||"",price:e.dataset.price};break}return t.faqs=this.extractFAQsFromPage(),t}static extractFAQsFromPage(){let e=[];return document.querySelectorAll('[fynd-faq-element="wrapper"]').forEach(r=>{let i=r.querySelector('[fynd-faq-element="toggle"]'),n=r.querySelector('[fynd-faq-element="content"]');if(i&&n){let o=i.querySelector('div[class*="title"], div[data-text-style], .accordian-title'),d=o?(o.textContent||"").trim():"",m=n.querySelector('.richtext, [class*="richtext"], .rich-text, [class*="rich-text"]'),u=m?(m.textContent||"").trim():(n.textContent||"").trim();d&&u&&e.push({question:d,answer:u})}}),e.length>0?e:null}static generateBreadcrumbsFromURL(){let e=window.location.pathname.split("/").filter(i=>i),t=[{name:"Home",url:"https://www.fynd.com"}],r="https://www.fynd.com";return e.forEach(i=>{r+=`/${i}`,t.push({name:i.charAt(0).toUpperCase()+i.slice(1).replace("-"," "),url:r})}),t}};document.addEventListener("DOMContentLoaded",function(){console.log("\u{1F50D} Fynd Schema: DOM loaded, initializing schema...");try{let a=new s,e=c.getConfigFromDataAttributes();console.log("\u{1F50D} Fynd Schema: Page config:",e);let t=a.generateSchema(e);console.log("\u{1F50D} Fynd Schema: Generated schema:",t),a.injectSchema(t),console.log("\u{1F50D} Fynd Schema: Schema injected successfully!");let r=document.querySelector('script[data-schema="fynd"]');r?console.log("\u2705 Fynd Schema: Schema script found in DOM:",r):console.error("\u274C Fynd Schema: Schema script NOT found in DOM")}catch(a){console.error("\u274C Fynd Schema: Error during initialization:",a)}});window.FyndSchema={generator:s,configManager:c};})();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../bin/live-reload.js", "../../src/seo/schema.ts"],
4
- "sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n console.log(\"Live reload disabled: not running on localhost\");\n}\n", "// Dynamic Schema Generator for Fynd.com\n\n// Type definitions for Schema.org entities\ninterface SchemaOrganization {\n \"@type\": \"Organization\";\n \"@id\": string;\n name: string;\n url: string;\n logo: string;\n sameAs: string[];\n description: string;\n}\n\ninterface SchemaWebsite {\n \"@type\": \"WebSite\";\n \"@id\": string;\n url: string;\n name: string;\n description: string;\n publisher: { \"@id\": string };\n potentialAction: {\n \"@type\": \"SearchAction\";\n target: {\n \"@type\": \"EntryPoint\";\n urlTemplate: string;\n };\n \"query-input\": string;\n };\n}\n\ninterface BreadcrumbItem {\n name: string;\n url: string;\n}\n\ninterface SchemaBreadcrumbList {\n \"@type\": \"BreadcrumbList\";\n itemListElement: Array<{\n \"@type\": \"ListItem\";\n position: number;\n name: string;\n item: string;\n }>;\n}\n\ninterface SchemaWebPage {\n \"@type\": \"WebPage\";\n \"@id\": string;\n url: string;\n name: string;\n description: string;\n isPartOf: { \"@id\": string };\n mainEntity?: any;\n}\n\ninterface SolutionData {\n name: string;\n url: string;\n description: string;\n features?: string[];\n audience?: string;\n price?: string;\n category?: string;\n}\n\ninterface SchemaSoftwareApplication {\n \"@type\": \"SoftwareApplication\";\n \"@id\": string;\n name: string;\n applicationCategory: string;\n operatingSystem: string;\n featureList: string[];\n offers: {\n \"@type\": \"Offer\";\n price: string;\n priceCurrency: string;\n availability: string;\n url: string;\n };\n audience: {\n \"@type\": \"Audience\";\n audienceType: string;\n };\n url: string;\n description: string;\n manufacturer: { \"@id\": string };\n}\n\ninterface ProductData {\n name: string;\n url: string;\n description: string;\n price?: string;\n}\n\ninterface SchemaProduct {\n \"@type\": \"Product\";\n name: string;\n url: string;\n description: string;\n brand: { \"@id\": string };\n offers: {\n \"@type\": \"Offer\";\n price: string;\n priceCurrency: string;\n availability: string;\n url: string;\n };\n}\n\ninterface FAQItem {\n question: string;\n answer: string;\n}\n\ninterface SchemaFAQPage {\n \"@type\": \"FAQPage\";\n mainEntity: Array<{\n \"@type\": \"Question\";\n name: string;\n acceptedAnswer: {\n \"@type\": \"Answer\";\n text: string;\n };\n }>;\n}\n\ninterface ArticleData {\n title: string;\n url: string;\n description: string;\n author?: string;\n publishDate: string;\n modifyDate?: string;\n image?: string;\n}\n\ninterface SchemaArticle {\n \"@type\": \"Article\";\n headline: string;\n description: string;\n image?: string;\n author: {\n \"@type\": \"Person\";\n name: string;\n };\n publisher: { \"@id\": string };\n datePublished: string;\n dateModified: string;\n mainEntityOfPage: {\n \"@type\": \"WebPage\";\n \"@id\": string;\n };\n}\n\ninterface PageConfig {\n url: string;\n title: string;\n description?: string;\n pageType: string;\n breadcrumbs?: BreadcrumbItem[];\n solutionData?: SolutionData;\n asProduct?: boolean;\n articleData?: ArticleData;\n productData?: ProductData;\n faqs?: FAQItem[] | null;\n mainEntity?: any;\n}\n\ninterface SchemaGraph {\n \"@context\": \"https://schema.org\";\n \"@graph\": any[];\n}\n\n// Extend Window interface for FyndSchema\ndeclare global {\n interface Window {\n FyndSchema: {\n generator: typeof FyndSchemaGenerator;\n configManager: typeof PageConfigManager;\n };\n }\n}\n\nclass FyndSchemaGenerator {\n private baseUrl: string;\n private organizationData: SchemaOrganization;\n\n constructor() {\n this.baseUrl = \"https://www.fynd.com\";\n this.organizationData = {\n \"@type\": \"Organization\",\n \"@id\": `${this.baseUrl}#organization`,\n name: \"Fynd\",\n url: this.baseUrl,\n logo: `${this.baseUrl}/logo.png`,\n sameAs: [\n \"https://www.linkedin.com/company/fynd\",\n \"https://en.wikipedia.org/wiki/Fynd\",\n \"https://twitter.com/Fynd\",\n ],\n description:\n \"Fynd is an AI-powered unified commerce platform enabling brands to manage end-to-end retail operations.\",\n };\n }\n\n // Generate base website schema\n generateWebsiteSchema(): SchemaWebsite {\n return {\n \"@type\": \"WebSite\",\n \"@id\": `${this.baseUrl}#website`,\n url: this.baseUrl,\n name: \"Fynd\",\n description: \"AI-powered unified commerce platform\",\n publisher: { \"@id\": `${this.baseUrl}#organization` },\n potentialAction: {\n \"@type\": \"SearchAction\",\n target: {\n \"@type\": \"EntryPoint\",\n urlTemplate: `${this.baseUrl}/search?q={search_term_string}`,\n },\n \"query-input\": \"required name=search_term_string\",\n },\n };\n }\n\n // Generate breadcrumb schema\n generateBreadcrumbSchema(breadcrumbs: BreadcrumbItem[]): SchemaBreadcrumbList {\n return {\n \"@type\": \"BreadcrumbList\",\n itemListElement: breadcrumbs.map((item, index) => ({\n \"@type\": \"ListItem\",\n position: index + 1,\n name: item.name,\n item: item.url,\n })),\n };\n }\n\n // Generate WebPage schema\n generateWebPageSchema(pageData: {\n url: string;\n title: string;\n description?: string;\n mainEntity?: any;\n }): SchemaWebPage {\n const schema: SchemaWebPage = {\n \"@type\": \"WebPage\",\n \"@id\": pageData.url,\n url: pageData.url,\n name: pageData.title,\n description: pageData.description || \"\",\n isPartOf: { \"@id\": `${this.baseUrl}#website` },\n };\n\n if (pageData.mainEntity) {\n schema.mainEntity = pageData.mainEntity;\n }\n\n return schema;\n }\n\n // Generate SoftwareApplication schema for solution pages\n generateSoftwareSchema(solutionData: SolutionData): SchemaSoftwareApplication {\n return {\n \"@type\": \"SoftwareApplication\",\n \"@id\": `${solutionData.url}#software`,\n name: solutionData.name,\n applicationCategory: solutionData.category || \"RetailSoftware\",\n operatingSystem: \"Web\",\n featureList: solutionData.features || [],\n offers: {\n \"@type\": \"Offer\",\n price: solutionData.price || \"Contact for Pricing\",\n priceCurrency: \"USD\",\n availability: \"InStock\",\n url: `${this.baseUrl}/contact`,\n },\n audience: {\n \"@type\": \"Audience\",\n audienceType: solutionData.audience || \"Business\",\n },\n url: solutionData.url,\n description: solutionData.description,\n manufacturer: { \"@id\": `${this.baseUrl}#organization` },\n };\n }\n\n // Generate Product schema\n generateProductSchema(productData: ProductData): SchemaProduct {\n return {\n \"@type\": \"Product\",\n name: productData.name,\n url: productData.url,\n description: productData.description,\n brand: { \"@id\": `${this.baseUrl}#organization` },\n offers: {\n \"@type\": \"Offer\",\n price: productData.price || \"Contact for Pricing\",\n priceCurrency: \"USD\",\n availability: \"InStock\",\n url: `${this.baseUrl}/contact`,\n },\n };\n }\n\n // Generate FAQ schema\n generateFAQSchema(faqs: FAQItem[]): SchemaFAQPage | null {\n if (!faqs || faqs.length === 0) return null;\n\n return {\n \"@type\": \"FAQPage\",\n mainEntity: faqs.map((faq) => ({\n \"@type\": \"Question\",\n name: faq.question,\n acceptedAnswer: {\n \"@type\": \"Answer\",\n text: faq.answer,\n },\n })),\n };\n }\n\n // Generate Article schema for blog posts\n generateArticleSchema(articleData: ArticleData): SchemaArticle {\n return {\n \"@type\": \"Article\",\n headline: articleData.title,\n description: articleData.description,\n image: articleData.image,\n author: {\n \"@type\": \"Person\",\n name: articleData.author || \"Fynd Team\",\n },\n publisher: { \"@id\": `${this.baseUrl}#organization` },\n datePublished: articleData.publishDate,\n dateModified: articleData.modifyDate || articleData.publishDate,\n mainEntityOfPage: {\n \"@type\": \"WebPage\",\n \"@id\": articleData.url,\n },\n };\n }\n\n // Main method to generate complete schema based on page type\n generateSchema(pageConfig: PageConfig): SchemaGraph {\n const graph: any[] = [];\n\n // Always include organization\n graph.push(this.organizationData);\n\n // Always include website\n graph.push(this.generateWebsiteSchema());\n\n // Add webpage schema\n const webPageSchema = this.generateWebPageSchema({\n url: pageConfig.url || window.location.href,\n title: pageConfig.title || document.title,\n description:\n pageConfig.description ||\n (document.querySelector('meta[name=\"description\"]') as HTMLMetaElement)?.content,\n mainEntity: pageConfig.mainEntity,\n });\n graph.push(webPageSchema);\n\n // Add breadcrumbs if provided\n if (pageConfig.breadcrumbs) {\n graph.push(this.generateBreadcrumbSchema(pageConfig.breadcrumbs));\n }\n\n // Page type specific schemas\n switch (pageConfig.pageType) {\n case \"solution\":\n if (pageConfig.solutionData) {\n const softwareSchema = this.generateSoftwareSchema(\n pageConfig.solutionData\n );\n graph.push(softwareSchema);\n\n if (pageConfig.asProduct) {\n const productSchema = this.generateProductSchema({\n ...pageConfig.solutionData,\n });\n graph.push(productSchema);\n }\n }\n break;\n\n case \"article\":\n if (pageConfig.articleData) {\n graph.push(this.generateArticleSchema(pageConfig.articleData));\n }\n break;\n\n case \"product\":\n if (pageConfig.productData) {\n graph.push(this.generateProductSchema(pageConfig.productData));\n }\n break;\n }\n\n // Add FAQ if provided\n if (pageConfig.faqs) {\n const faqSchema = this.generateFAQSchema(pageConfig.faqs);\n if (faqSchema) graph.push(faqSchema);\n }\n\n return {\n \"@context\": \"https://schema.org\",\n \"@graph\": graph,\n };\n }\n\n // Inject schema into page\n injectSchema(schema: SchemaGraph): void {\n // Remove existing schema script if any\n const existingScript = document.querySelector('script[data-schema=\"fynd\"]');\n if (existingScript) {\n existingScript.remove();\n }\n\n // Create and inject new schema script\n const script = document.createElement(\"script\");\n script.type = \"application/ld+json\";\n script.setAttribute(\"data-schema\", \"fynd\");\n script.textContent = JSON.stringify(schema, null, 2);\n document.head.appendChild(script);\n }\n}\n\n// Page Configuration Manager\nclass PageConfigManager {\n // Helper method to safely parse JSON\n private static safeJsonParse<T>(jsonString: string, fallback: T, context?: string): T {\n try {\n return JSON.parse(jsonString);\n } catch (error) {\n console.warn(`\uD83D\uDD0D Fynd Schema: Failed to parse JSON${context ? ` for ${context}` : ''}:`, {\n jsonString,\n error: error instanceof Error ? error.message : error\n });\n return fallback;\n }\n }\n\n static getConfigFromDataAttributes(): PageConfig {\n const body = document.body;\n const config: PageConfig = {\n url: \"\",\n title: \"\",\n description: \"\",\n pageType: \"default\",\n };\n\n // Debug: Log all data attributes\n console.log(\"\uD83D\uDD0D Fynd Schema: Body data attributes:\", body.dataset);\n\n // Get basic page info\n config.url = window.location.href;\n config.title = document.title;\n config.description = (document.querySelector(\n 'meta[name=\"description\"]'\n ) as HTMLMetaElement)?.content;\n\n // Get page type from data attribute\n config.pageType = body.dataset.pageType || \"default\";\n\n // Get breadcrumbs from data attribute or generate from URL\n if (body.dataset.breadcrumbs) {\n config.breadcrumbs = this.safeJsonParse(\n body.dataset.breadcrumbs, \n this.generateBreadcrumbsFromURL(), \n 'breadcrumbs'\n );\n } else {\n config.breadcrumbs = this.generateBreadcrumbsFromURL();\n }\n\n // Page type specific configurations\n switch (config.pageType) {\n case \"solution\":\n config.solutionData = {\n name: body.dataset.solutionName || document.title,\n url: config.url,\n description: config.description || \"\",\n features: body.dataset.features\n ? this.safeJsonParse(body.dataset.features, [], 'features')\n : [],\n audience: body.dataset.audience,\n price: body.dataset.price,\n category: body.dataset.category,\n };\n config.asProduct = body.dataset.asProduct === \"true\";\n break;\n\n case \"article\":\n config.articleData = {\n title: config.title,\n url: config.url,\n description: config.description || \"\",\n author: body.dataset.author,\n publishDate: body.dataset.publishDate || new Date().toISOString(),\n modifyDate: body.dataset.modifyDate,\n image:\n body.dataset.image ||\n (document.querySelector('meta[property=\"og:image\"]') as HTMLMetaElement)?.content,\n };\n break;\n\n case \"product\":\n config.productData = {\n name: body.dataset.productName || document.title,\n url: config.url,\n description: config.description || \"\",\n price: body.dataset.price,\n };\n break;\n }\n\n // Auto-detect FAQs from page content\n config.faqs = this.extractFAQsFromPage();\n\n return config;\n }\n\n static extractFAQsFromPage(): FAQItem[] | null {\n const faqs: FAQItem[] = [];\n\n // Look for Fynd FAQ structure using custom attributes\n const faqWrappers = document.querySelectorAll(\n '[fynd-faq-element=\"wrapper\"]'\n );\n\n faqWrappers.forEach((wrapper) => {\n // Find the toggle element (contains the question)\n const toggle = wrapper.querySelector('[fynd-faq-element=\"toggle\"]');\n // Find the content element (contains the answer)\n const content = wrapper.querySelector('[fynd-faq-element=\"content\"]');\n\n if (toggle && content) {\n // Extract question from the toggle div\n const questionDiv = toggle.querySelector(\n 'div[class*=\"title\"], div[data-text-style], .accordian-title'\n );\n const questionText = questionDiv ? (questionDiv.textContent || \"\").trim() : \"\";\n\n // Extract answer from the content div - look for richtext\n const richTextDiv = content.querySelector(\n '.richtext, [class*=\"richtext\"], .rich-text, [class*=\"rich-text\"]'\n );\n const answerText = richTextDiv\n ? (richTextDiv.textContent || \"\").trim()\n : (content.textContent || \"\").trim();\n\n if (questionText && answerText) {\n faqs.push({\n question: questionText,\n answer: answerText,\n });\n }\n }\n });\n\n return faqs.length > 0 ? faqs : null;\n }\n\n static generateBreadcrumbsFromURL(): BreadcrumbItem[] {\n const pathSegments = window.location.pathname\n .split(\"/\")\n .filter((segment) => segment);\n const breadcrumbs: BreadcrumbItem[] = [{ name: \"Home\", url: \"https://www.fynd.com\" }];\n\n let currentPath = \"https://www.fynd.com\";\n pathSegments.forEach((segment) => {\n currentPath += `/${segment}`;\n breadcrumbs.push({\n name:\n segment.charAt(0).toUpperCase() + segment.slice(1).replace(\"-\", \" \"),\n url: currentPath,\n });\n });\n\n return breadcrumbs;\n }\n}\n\n// Auto-initialize when DOM is ready\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n console.log(\"\uD83D\uDD0D Fynd Schema: DOM loaded, initializing schema...\");\n \n try {\n const schemaGenerator = new FyndSchemaGenerator();\n const pageConfig = PageConfigManager.getConfigFromDataAttributes();\n \n console.log(\"\uD83D\uDD0D Fynd Schema: Page config:\", pageConfig);\n \n const schema = schemaGenerator.generateSchema(pageConfig);\n \n console.log(\"\uD83D\uDD0D Fynd Schema: Generated schema:\", schema);\n \n schemaGenerator.injectSchema(schema);\n \n console.log(\"\uD83D\uDD0D Fynd Schema: Schema injected successfully!\");\n \n // Verify injection\n const injectedScript = document.querySelector('script[data-schema=\"fynd\"]');\n if (injectedScript) {\n console.log(\"\u2705 Fynd Schema: Schema script found in DOM:\", injectedScript);\n } else {\n console.error(\"\u274C Fynd Schema: Schema script NOT found in DOM\");\n }\n \n } catch (error) {\n console.error(\"\u274C Fynd Schema: Error during initialization:\", error);\n }\n});\n\n// Export for manual usage\n(window as any).FyndSchema = {\n generator: FyndSchemaGenerator,\n configManager: PageConfigManager,\n};\n\n// Export to make this file a module (required for global declarations)\nexport {};\n "],
5
- "mappings": ";;;AACA,MACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,QAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,MAAiB;AAAA,MAAU,MACpE,SAAS,OAAO;AAAA,IAClB;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,gDAAgD;AAAA,EAC9D;;;AC8KA,MAAM,sBAAN,MAA0B;AAAA,IAIxB,cAAc;AACZ,WAAK,UAAU;A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AoB;AAChD,YAAM,aAAa,kBAAkB,4BAA4B;AAEjE,cAAQ,IAAI,uCAAgC,UAAU;AAEtD,YAAM,SAAS,gBAAgB,eAAe,UAAU;AAExD,cAAQ,IAAI,4CAAqC,MAAM;AAEvD,sBAAgB,aAAa,MAAM;AAEnC,cAAQ,IAAI,sDAA+C;AAG3D,YAAM,iBAAiB,SAAS,cAAc,4BAA4B;AAC1E,UAAI,gBAAgB;AAClB,gBAAQ,IAAI,mDAA8C,cAAc;AAAA,MAC1E,OAAO;AACL,gBAAQ,MAAM,oDAA+C;AAAA,MAC/D;AAAA,IAEF,SAAS,OAAO;AACd,cAAQ,MAAM,oDAA+C,KAAK;AAAA,IACpE;AAAA,EACF,CAAC;AAGD,EAAC,OAAe,aAAa;AAAA,IAC3B,WAAW;AAAA,IACX,eAAe;AAAA,EACjB;",
4
+ "sourcesContent": ["// Only enable live reload when running on localhost\nif (\n window.location.hostname === \"localhost\" ||\n window.location.hostname === \"127.0.0.1\"\n) {\n new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n );\n} else {\n console.log(\"Live reload disabled: not running on localhost\");\n}\n", "// Dynamic Schema Generator for Fynd.com\n\n// Type definitions for Schema.org entities\ninterface SchemaOrganization {\n \"@type\": \"Organization\";\n \"@id\": string;\n name: string;\n url: string;\n logo: string;\n sameAs: string[];\n description: string;\n}\n\ninterface SchemaWebsite {\n \"@type\": \"WebSite\";\n \"@id\": string;\n url: string;\n name: string;\n description: string;\n publisher: { \"@id\": string };\n potentialAction: {\n \"@type\": \"SearchAction\";\n target: {\n \"@type\": \"EntryPoint\";\n urlTemplate: string;\n };\n \"query-input\": string;\n };\n}\n\ninterface BreadcrumbItem {\n name: string;\n url: string;\n}\n\ninterface SchemaBreadcrumbList {\n \"@type\": \"BreadcrumbList\";\n itemListElement: Array<{\n \"@type\": \"ListItem\";\n position: number;\n name: string;\n item: string;\n }>;\n}\n\ninterface SchemaWebPage {\n \"@type\": \"WebPage\";\n \"@id\": string;\n url: string;\n name: string;\n description: string;\n isPartOf: { \"@id\": string };\n mainEntity?: any;\n}\n\ninterface SolutionData {\n name: string;\n url: string;\n description: string;\n features?: string[];\n audience?: string;\n price?: string;\n category?: string;\n proficiencyLevel?: string;\n conditionsOfAccess?: string;\n}\n\ninterface SchemaSoftwareApplication {\n \"@type\": \"SoftwareApplication\";\n \"@id\": string;\n name: string;\n applicationCategory: string;\n operatingSystem: string;\n featureList: string[];\n offers: {\n \"@type\": \"Offer\";\n price: string;\n priceCurrency: string;\n availability: string;\n url: string;\n };\n audience: {\n \"@type\": \"Audience\";\n audienceType: string;\n };\n proficiencyLevel?: string;\n conditionsOfAccess?: string;\n url: string;\n description: string;\n manufacturer: { \"@id\": string };\n}\n\ninterface ProductData {\n name: string;\n url: string;\n description: string;\n price?: string;\n}\n\ninterface SchemaProduct {\n \"@type\": \"Product\";\n name: string;\n url: string;\n description: string;\n brand: { \"@id\": string };\n offers: {\n \"@type\": \"Offer\";\n price: string;\n priceCurrency: string;\n availability: string;\n url: string;\n };\n}\n\ninterface FAQItem {\n question: string;\n answer: string;\n}\n\ninterface SchemaFAQPage {\n \"@type\": \"FAQPage\";\n mainEntity: Array<{\n \"@type\": \"Question\";\n name: string;\n acceptedAnswer: {\n \"@type\": \"Answer\";\n text: string;\n };\n }>;\n}\n\ninterface ArticleData {\n title: string;\n url: string;\n description: string;\n author?: string;\n publishDate: string;\n modifyDate?: string;\n image?: string;\n}\n\ninterface SchemaArticle {\n \"@type\": \"Article\";\n headline: string;\n description: string;\n image?: string;\n author: {\n \"@type\": \"Person\";\n name: string;\n };\n publisher: { \"@id\": string };\n datePublished: string;\n dateModified: string;\n mainEntityOfPage: {\n \"@type\": \"WebPage\";\n \"@id\": string;\n };\n}\n\ninterface PageConfig {\n url: string;\n title: string;\n description?: string;\n pageType: string;\n breadcrumbs?: BreadcrumbItem[];\n solutionData?: SolutionData;\n asProduct?: boolean;\n articleData?: ArticleData;\n productData?: ProductData;\n faqs?: FAQItem[] | null;\n mainEntity?: any;\n}\n\ninterface SchemaGraph {\n \"@context\": \"https://schema.org\";\n \"@graph\": any[];\n}\n\n// Extend Window interface for FyndSchema\ndeclare global {\n interface Window {\n FyndSchema: {\n generator: typeof FyndSchemaGenerator;\n configManager: typeof PageConfigManager;\n };\n }\n}\n\nclass FyndSchemaGenerator {\n private baseUrl: string;\n private organizationData: SchemaOrganization;\n\n constructor() {\n this.baseUrl = \"https://www.fynd.com\";\n this.organizationData = {\n \"@type\": \"Organization\",\n \"@id\": `${this.baseUrl}#organization`,\n name: \"Fynd\",\n url: this.baseUrl,\n logo: `${this.baseUrl}/logo.png`,\n sameAs: [\n \"https://www.linkedin.com/company/fynd\",\n \"https://en.wikipedia.org/wiki/Fynd\",\n \"https://twitter.com/Fynd\",\n ],\n description:\n \"Fynd is an AI-powered unified commerce platform enabling brands to manage end-to-end retail operations.\",\n };\n }\n\n // Generate base website schema\n generateWebsiteSchema(): SchemaWebsite {\n return {\n \"@type\": \"WebSite\",\n \"@id\": `${this.baseUrl}#website`,\n url: this.baseUrl,\n name: \"Fynd\",\n description: \"AI-powered unified commerce platform\",\n publisher: { \"@id\": `${this.baseUrl}#organization` },\n potentialAction: {\n \"@type\": \"SearchAction\",\n target: {\n \"@type\": \"EntryPoint\",\n urlTemplate: `${this.baseUrl}/search?q={search_term_string}`,\n },\n \"query-input\": \"required name=search_term_string\",\n },\n };\n }\n\n // Generate breadcrumb schema\n generateBreadcrumbSchema(breadcrumbs: BreadcrumbItem[]): SchemaBreadcrumbList {\n return {\n \"@type\": \"BreadcrumbList\",\n itemListElement: breadcrumbs.map((item, index) => ({\n \"@type\": \"ListItem\",\n position: index + 1,\n name: item.name,\n item: item.url,\n })),\n };\n }\n\n // Generate WebPage schema\n generateWebPageSchema(pageData: {\n url: string;\n title: string;\n description?: string;\n mainEntity?: any;\n }): SchemaWebPage {\n const schema: SchemaWebPage = {\n \"@type\": \"WebPage\",\n \"@id\": pageData.url,\n url: pageData.url,\n name: pageData.title,\n description: pageData.description || \"\",\n isPartOf: { \"@id\": `${this.baseUrl}#website` },\n };\n\n if (pageData.mainEntity) {\n schema.mainEntity = pageData.mainEntity;\n }\n\n return schema;\n }\n\n // Generate SoftwareApplication schema for solution pages\n generateSoftwareSchema(solutionData: SolutionData): SchemaSoftwareApplication {\n const schema: SchemaSoftwareApplication = {\n \"@type\": \"SoftwareApplication\",\n \"@id\": `${solutionData.url}#software`,\n name: solutionData.name,\n applicationCategory: solutionData.category || \"RetailSoftware\",\n operatingSystem: \"Web\",\n featureList: solutionData.features || [],\n offers: {\n \"@type\": \"Offer\",\n price: solutionData.price || \"Contact for Pricing\",\n priceCurrency: \"USD\",\n availability: \"InStock\",\n url: `${this.baseUrl}/contact`,\n },\n audience: {\n \"@type\": \"Audience\",\n audienceType: solutionData.audience || \"Business\",\n },\n url: solutionData.url,\n description: solutionData.description,\n manufacturer: { \"@id\": `${this.baseUrl}#organization` },\n };\n\n if (solutionData.proficiencyLevel) {\n schema.proficiencyLevel = solutionData.proficiencyLevel;\n }\n\n if (solutionData.conditionsOfAccess) {\n schema.conditionsOfAccess = solutionData.conditionsOfAccess;\n }\n\n return schema;\n }\n\n // Generate Product schema\n generateProductSchema(productData: ProductData): SchemaProduct {\n return {\n \"@type\": \"Product\",\n name: productData.name,\n url: productData.url,\n description: productData.description,\n brand: { \"@id\": `${this.baseUrl}#organization` },\n offers: {\n \"@type\": \"Offer\",\n price: productData.price || \"Contact for Pricing\",\n priceCurrency: \"USD\",\n availability: \"InStock\",\n url: `${this.baseUrl}/contact`,\n },\n };\n }\n\n // Generate FAQ schema\n generateFAQSchema(faqs: FAQItem[]): SchemaFAQPage | null {\n if (!faqs || faqs.length === 0) return null;\n\n return {\n \"@type\": \"FAQPage\",\n mainEntity: faqs.map((faq) => ({\n \"@type\": \"Question\",\n name: faq.question,\n acceptedAnswer: {\n \"@type\": \"Answer\",\n text: faq.answer,\n },\n })),\n };\n }\n\n // Generate Article schema for blog posts\n generateArticleSchema(articleData: ArticleData): SchemaArticle {\n return {\n \"@type\": \"Article\",\n headline: articleData.title,\n description: articleData.description,\n image: articleData.image,\n author: {\n \"@type\": \"Person\",\n name: articleData.author || \"Fynd Team\",\n },\n publisher: { \"@id\": `${this.baseUrl}#organization` },\n datePublished: articleData.publishDate,\n dateModified: articleData.modifyDate || articleData.publishDate,\n mainEntityOfPage: {\n \"@type\": \"WebPage\",\n \"@id\": articleData.url,\n },\n };\n }\n\n // Main method to generate complete schema based on page type\n generateSchema(pageConfig: PageConfig): SchemaGraph {\n const graph: any[] = [];\n\n // Always include organization\n graph.push(this.organizationData);\n\n // Always include website\n graph.push(this.generateWebsiteSchema());\n\n // Add webpage schema\n const webPageSchema = this.generateWebPageSchema({\n url: pageConfig.url || window.location.href,\n title: pageConfig.title || document.title,\n description:\n pageConfig.description ||\n (document.querySelector('meta[name=\"description\"]') as HTMLMetaElement)?.content,\n mainEntity: pageConfig.mainEntity,\n });\n graph.push(webPageSchema);\n\n // Add breadcrumbs if provided\n if (pageConfig.breadcrumbs) {\n graph.push(this.generateBreadcrumbSchema(pageConfig.breadcrumbs));\n }\n\n // Page type specific schemas\n switch (pageConfig.pageType) {\n case \"solution\":\n if (pageConfig.solutionData) {\n const softwareSchema = this.generateSoftwareSchema(\n pageConfig.solutionData\n );\n graph.push(softwareSchema);\n\n // Set software as mainEntity for the webpage\n webPageSchema.mainEntity = { \"@id\": `${pageConfig.solutionData.url}#software` };\n\n if (pageConfig.asProduct) {\n const productSchema = this.generateProductSchema({\n ...pageConfig.solutionData,\n });\n graph.push(productSchema);\n }\n }\n break;\n\n case \"article\":\n if (pageConfig.articleData) {\n graph.push(this.generateArticleSchema(pageConfig.articleData));\n }\n break;\n\n case \"product\":\n if (pageConfig.productData) {\n graph.push(this.generateProductSchema(pageConfig.productData));\n }\n break;\n }\n\n // Add FAQ if provided\n if (pageConfig.faqs) {\n const faqSchema = this.generateFAQSchema(pageConfig.faqs);\n if (faqSchema) graph.push(faqSchema);\n }\n\n return {\n \"@context\": \"https://schema.org\",\n \"@graph\": graph,\n };\n }\n\n // Inject schema into page\n injectSchema(schema: SchemaGraph): void {\n // Remove existing schema script if any\n const existingScript = document.querySelector('script[data-schema=\"fynd\"]');\n if (existingScript) {\n existingScript.remove();\n }\n\n // Create and inject new schema script\n const script = document.createElement(\"script\");\n script.type = \"application/ld+json\";\n script.setAttribute(\"data-schema\", \"fynd\");\n script.textContent = JSON.stringify(schema, null, 2);\n document.head.appendChild(script);\n }\n}\n\n// Page Configuration Manager\nclass PageConfigManager {\n // Helper method to safely parse JSON\n private static safeJsonParse<T>(jsonString: string, fallback: T, context?: string): T {\n try {\n return JSON.parse(jsonString);\n } catch (error) {\n console.warn(`\uD83D\uDD0D Fynd Schema: Failed to parse JSON${context ? ` for ${context}` : ''}:`, {\n jsonString,\n error: error instanceof Error ? error.message : error\n });\n return fallback;\n }\n }\n\n static getConfigFromDataAttributes(): PageConfig {\n const body = document.body;\n const config: PageConfig = {\n url: \"\",\n title: \"\",\n description: \"\",\n pageType: \"default\",\n };\n\n // Debug: Log all data attributes\n console.log(\"\uD83D\uDD0D Fynd Schema: Body data attributes:\", body.dataset);\n\n // Get basic page info\n config.url = window.location.href;\n config.title = document.title;\n config.description = (document.querySelector(\n 'meta[name=\"description\"]'\n ) as HTMLMetaElement)?.content;\n\n // Get page type from data attribute\n config.pageType = body.dataset.pageType || \"default\";\n\n // Get breadcrumbs from data attribute or generate from URL\n if (body.dataset.breadcrumbs) {\n config.breadcrumbs = this.safeJsonParse(\n body.dataset.breadcrumbs, \n this.generateBreadcrumbsFromURL(), \n 'breadcrumbs'\n );\n } else {\n config.breadcrumbs = this.generateBreadcrumbsFromURL();\n }\n\n // Page type specific configurations\n switch (config.pageType) {\n case \"solution\":\n config.solutionData = {\n name: body.dataset.solutionName || document.title,\n url: config.url,\n description: config.description || \"\",\n features: body.dataset.features\n ? this.safeJsonParse(body.dataset.features, [], 'features')\n : [],\n audience: body.dataset.audience,\n price: body.dataset.price,\n category: body.dataset.category,\n };\n config.asProduct = body.dataset.asProduct === \"true\";\n break;\n\n case \"article\":\n config.articleData = {\n title: config.title,\n url: config.url,\n description: config.description || \"\",\n author: body.dataset.author,\n publishDate: body.dataset.publishDate || new Date().toISOString(),\n modifyDate: body.dataset.modifyDate,\n image:\n body.dataset.image ||\n (document.querySelector('meta[property=\"og:image\"]') as HTMLMetaElement)?.content,\n };\n break;\n\n case \"product\":\n config.productData = {\n name: body.dataset.productName || document.title,\n url: config.url,\n description: config.description || \"\",\n price: body.dataset.price,\n };\n break;\n }\n\n // Auto-detect FAQs from page content\n config.faqs = this.extractFAQsFromPage();\n\n return config;\n }\n\n static extractFAQsFromPage(): FAQItem[] | null {\n const faqs: FAQItem[] = [];\n\n // Look for Fynd FAQ structure using custom attributes\n const faqWrappers = document.querySelectorAll(\n '[fynd-faq-element=\"wrapper\"]'\n );\n\n faqWrappers.forEach((wrapper) => {\n // Find the toggle element (contains the question)\n const toggle = wrapper.querySelector('[fynd-faq-element=\"toggle\"]');\n // Find the content element (contains the answer)\n const content = wrapper.querySelector('[fynd-faq-element=\"content\"]');\n\n if (toggle && content) {\n // Extract question from the toggle div\n const questionDiv = toggle.querySelector(\n 'div[class*=\"title\"], div[data-text-style], .accordian-title'\n );\n const questionText = questionDiv ? (questionDiv.textContent || \"\").trim() : \"\";\n\n // Extract answer from the content div - look for richtext\n const richTextDiv = content.querySelector(\n '.richtext, [class*=\"richtext\"], .rich-text, [class*=\"rich-text\"]'\n );\n const answerText = richTextDiv\n ? (richTextDiv.textContent || \"\").trim()\n : (content.textContent || \"\").trim();\n\n if (questionText && answerText) {\n faqs.push({\n question: questionText,\n answer: answerText,\n });\n }\n }\n });\n\n return faqs.length > 0 ? faqs : null;\n }\n\n static generateBreadcrumbsFromURL(): BreadcrumbItem[] {\n const pathSegments = window.location.pathname\n .split(\"/\")\n .filter((segment) => segment);\n const breadcrumbs: BreadcrumbItem[] = [{ name: \"Home\", url: \"https://www.fynd.com\" }];\n\n let currentPath = \"https://www.fynd.com\";\n pathSegments.forEach((segment) => {\n currentPath += `/${segment}`;\n breadcrumbs.push({\n name:\n segment.charAt(0).toUpperCase() + segment.slice(1).replace(\"-\", \" \"),\n url: currentPath,\n });\n });\n\n return breadcrumbs;\n }\n}\n\n// Auto-initialize when DOM is ready\ndocument.addEventListener(\"DOMContentLoaded\", function () {\n console.log(\"\uD83D\uDD0D Fynd Schema: DOM loaded, initializing schema...\");\n \n try {\n const schemaGenerator = new FyndSchemaGenerator();\n const pageConfig = PageConfigManager.getConfigFromDataAttributes();\n \n console.log(\"\uD83D\uDD0D Fynd Schema: Page config:\", pageConfig);\n \n const schema = schemaGenerator.generateSchema(pageConfig);\n \n console.log(\"\uD83D\uDD0D Fynd Schema: Generated schema:\", schema);\n \n schemaGenerator.injectSchema(schema);\n \n console.log(\"\uD83D\uDD0D Fynd Schema: Schema injected successfully!\");\n \n // Verify injection\n const injectedScript = document.querySelector('script[data-schema=\"fynd\"]');\n if (injectedScript) {\n console.log(\"\u2705 Fynd Schema: Schema script found in DOM:\", injectedScript);\n } else {\n console.error(\"\u274C Fynd Schema: Schema script NOT found in DOM\");\n }\n \n } catch (error) {\n console.error(\"\u274C Fynd Schema: Error during initialization:\", error);\n }\n});\n\n// Export for manual usage\n(window as any).FyndSchema = {\n generator: FyndSchemaGenerator,\n configManager: PageConfigManager,\n};\n\n// Export to make this file a module (required for global declarations)\nexport {};\n "],
5
+ "mappings": ";;;AACA,MACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,QAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,MAAiB;AAAA,MAAU,MACpE,SAAS,OAAO;AAAA,IAClB;AAAA,EACF,OAAO;AACL,YAAQ,IAAI,gDAAgD;AAAA,EAC9D;;;ACkLA,MAAM,sBAAN,MAA0B;AAAA,IAIxB,cAAc;AACZ,WAAK,UAAU;AACf,WAAK,mBAAmB;AAAA,QACtB,SAAS;AAAA,QAC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AAA,QACP,CAAC;AAAA,MACH,CAAC;AAED,aAAO;AAAA,IACT;AAAA,EACF;AAGA,WAAS,iBAAiB,oBAAoB,WAAY;AACxD,YAAQ,IAAI,2DAAoD;AAEhE,QAAI;AACF,YAAM,kBAAkB,IAAI,oBAAoB;AAChD,YAAM,aAAa,kBAAkB,4BAA4B;AAEjE,cAAQ,IAAI,uCAAgC,UAAU;AAEtD,YAAM,SAAS,gBAAgB,eAAe,UAAU;AAExD,cAAQ,IAAI,4CAAqC,MAAM;AAEvD,sBAAgB,aAAa,MAAM;AAEnC,cAAQ,IAAI,sDAA+C;AAG3D,YAAM,iBAAiB,SAAS,cAAc,4BAA4B;AAC1E,UAAI,gBAAgB;AAClB,gBAAQ,IAAI,mDAA8C,cAAc;AAAA,MAC1E,OAAO;AACL,gBAAQ,MAAM,oDAA+C;AAAA,MAC/D;AAAA,IAEF,SAAS,OAAO;AACd,cAAQ,MAAM,oDAA+C,KAAK;AAAA,IACpE;AAAA,EACF,CAAC;AAGD,EAAC,OAAe,aAAa;AAAA,IAC3B,WAAW;AAAA,IACX,eAAe;AAAA,EACjB;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fynd-design-engineering/fynd-one-v2",
3
- "version": "3.1.28",
3
+ "version": "3.1.30",
4
4
  "description": "Updated CDN for fynd.com",
5
5
  "homepage": "https://github.com/Fynd-Design-Engineering/Fynd-Utils/blob/main/README.md",
6
6
  "license": "ISC",