@fynd-design-engineering/fynd-one-v2 3.4.61 → 3.4.63

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.
Files changed (81) hide show
  1. package/dist/accordians/dropdown.js +95 -1
  2. package/dist/accordians/index.js +391 -1
  3. package/dist/cms-listing/index.js +24 -1
  4. package/dist/filters/clear-search.js +32 -1
  5. package/dist/filters/konnect.js +165 -1
  6. package/dist/filters/show-count.js +66 -1
  7. package/dist/form/country-dropdown.css +160 -1
  8. package/dist/form/cs-gated-redirection.js +40 -1
  9. package/dist/form/download-file.js +70 -1
  10. package/dist/form/validation.css +1019 -1
  11. package/dist/form/validation.js +10611 -7
  12. package/dist/global/anchor-scroll.js +174 -1
  13. package/dist/global/auth.js +87 -1
  14. package/dist/global/chat.js +185 -1
  15. package/dist/global/console-links.js +89 -1
  16. package/dist/global/contact-popup.js +83 -2
  17. package/dist/global/css/in-page-embed.css +1043 -1
  18. package/dist/global/css/in-project-settings.css +173 -1
  19. package/dist/global/css/temp.css +89 -1
  20. package/dist/global/custom-bg-video.js +40 -1
  21. package/dist/global/footer-accordion.js +44 -1
  22. package/dist/global/lazy-loader.js +135 -1
  23. package/dist/global/loader.js +166 -2
  24. package/dist/global/media-card.js +166 -1
  25. package/dist/global/miscellaneous.js +136 -1
  26. package/dist/global/number-count.js +82 -1
  27. package/dist/global/popup-video.js +276 -1
  28. package/dist/global/progressive-scroll.js +222 -1
  29. package/dist/global/responsive-video.js +321 -1
  30. package/dist/global/style.css +1065 -1
  31. package/dist/global/video-card.js +50 -1
  32. package/dist/hacktimus/2025.js +177 -1
  33. package/dist/hacktimus/styles.css +91 -1
  34. package/dist/home/index.js +17 -1
  35. package/dist/marquee/index.js +3104 -1
  36. package/dist/marquee/marquee-swiper.js +36 -1
  37. package/dist/navigation/announcement/index.js +5169 -1
  38. package/dist/navigation/context-menu/index.js +31 -1
  39. package/dist/navigation/desktop/index.js +4603 -1
  40. package/dist/navigation/initialization.js +602 -1
  41. package/dist/navigation/main.js +4911 -1
  42. package/dist/navigation/mobile/index.js +286 -1
  43. package/dist/navigation/scroll/index.js +62 -1
  44. package/dist/navigation/secondary-navigation/index.js +437 -1
  45. package/dist/navigation/style.css +154 -1
  46. package/dist/navigation/temp.css +2 -0
  47. package/dist/navigation/theme.css +69 -1
  48. package/dist/navigation-v2/index.js +4990 -1
  49. package/dist/navigation-v2/styles.css +233 -1
  50. package/dist/others/feature-detail.js +75 -0
  51. package/dist/others/feature-detail.js.map +7 -0
  52. package/dist/others/geolocation.js +50 -1
  53. package/dist/others/hero-aniamtion.js +53 -1
  54. package/dist/others/hero-india-animation-2.js +70 -1
  55. package/dist/others/hero-india-animation.js +93 -1
  56. package/dist/others/home-solution-tab.js +115 -1
  57. package/dist/others/storefront-chat/index.js +487 -1
  58. package/dist/others/storefront-chat/styles.css +107 -1
  59. package/dist/playbook-2026/hero-reveal.js +47 -1
  60. package/dist/playbook-2026/index.js +536 -1
  61. package/dist/playbook-2026/styles.css +110 -1
  62. package/dist/posthog-and-ga/attributes.js +190 -1
  63. package/dist/posthog-and-ga/main.js +528 -1
  64. package/dist/progressive-scroll/index.js +147 -1
  65. package/dist/quick-fix/reload.js +22 -1
  66. package/dist/seo/schema.js +465 -1
  67. package/dist/slider/freescroll.js +34 -1
  68. package/dist/test/sample.js +15 -1
  69. package/dist/testimonials/index.js +2654 -1
  70. package/dist/timeline/index.js +160 -1
  71. package/dist/timeline/style.css +42 -1
  72. package/dist/tracking/custom-id.js +75 -1
  73. package/dist/tracking/fill-form-fields.js +238 -1
  74. package/dist/tracking/fill-form-fields.js.map +2 -2
  75. package/dist/tracking/form-tracker.js +146 -1
  76. package/dist/tracking/page-categories.js +20 -1
  77. package/dist/tracking/user-journey.js +839 -1
  78. package/dist/tracking/utm-links.js +194 -1
  79. package/dist/utils/sample.js +17 -1
  80. package/dist/validations/localhost.js +221 -1
  81. package/package.json +1 -1
@@ -1 +1,528 @@
1
- "use strict";(()=>{var E=n=>{let t=new URLSearchParams(window.location.search).get(n);return t?t.trim():null},P=()=>{let n=E("utm_medium")?.toLowerCase();return n==="cpc"||n==="ads"},T="fynd_website_ad.",L=n=>`${T}${n}`,_=n=>{let t=n.closest("form");return t&&(t.getAttribute("data-name")||t.getAttribute("name")||t.id)||null},g=()=>{if(window.__adsTrackingInitializedGeneral||!P())return;window.__adsTrackingInitializedGeneral=!0;let n={"fynd_website.current_page":window.location.pathname},t=(e,i)=>{let r=L(e);window.trackEvent?.(r,{...n,...i||{}})};document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('[data-ph="sign-up"]').forEach(o=>o.addEventListener("click",()=>t("sign_up.clicked"))),document.querySelectorAll('[data-ph="sign-in"]').forEach(o=>o.addEventListener("click",()=>t("sign_in.clicked"))),document.querySelectorAll('[data-ph="book-a-demo"]').forEach(o=>o.addEventListener("click",()=>t("book_a_demo.clicked")));let e=document.querySelectorAll("[ph-form-field]"),i=new Set,r=function(){let o=_(this)||"unknown-form";i.has(o)||(i.add(o),t("form.started",{started_form:o}))};e.forEach(o=>{let a=o.tagName.toLowerCase(),c=o.type?.toLowerCase();a==="button"||a==="input"&&c==="submit"||o.addEventListener("focus",r),a==="button"||a==="input"&&c==="submit"?o.addEventListener("click",r):a==="select"?o.addEventListener("change",r):o.addEventListener("input",r)}),document.querySelectorAll('[type="submit"]').forEach(o=>{o.addEventListener("click",function(){let a=_(this);setTimeout(()=>{window.validationPassed===!0&&t("form.submitted",a?{submitted_form:a}:{})},10)})})})};var w="2741377816069290";function A(){typeof window>"u"||window.fbq||function(n,t,e,i,r,o,a){n.fbq||(r=n.fbq=function(){r.callMethod?r.callMethod.apply(r,arguments):r.queue.push(arguments)},n._fbq||(n._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[],o=t.createElement(e),o.async=!0,o.src="https://connect.facebook.net/en_US/fbevents.js",a=t.getElementsByTagName(e)[0],a.parentNode.insertBefore(o,a))}(window,document,"script",void 0)}function b(){try{let n=null;if(typeof window.getUserJourney=="function"&&(n=window.getUserJourney()),!n){let i=sessionStorage.getItem("userJourney");i&&(n=JSON.parse(i))}let t={},e=n?.formDetails;return e?.email&&(t.email=e.email),e?.phone&&(t.phone=e.phone),e?.firstName&&(t.first_name=e.firstName),e?.lastName&&(t.last_name=e.lastName),e?.city&&(t.city=e.city),e?.state&&(t.state=e.state),e?.zip&&(t.zip=e.zip),n?.country&&(t.country=n.country),n?.userId&&(t.external_id=String(n.userId)),Object.keys(t).forEach(i=>{let r=i;t[r]||delete t[r]}),Object.keys(t).length?t:null}catch{return null}}function D(n){if(!n)return null;let t={};return n["fynd_website.form_email"]&&(t.email=n["fynd_website.form_email"]),n["fynd_website.form_phone"]&&(t.phone=n["fynd_website.form_phone"]),n["fynd_website.form_first_name"]&&(t.first_name=n["fynd_website.form_first_name"]),n["fynd_website.form_last_name"]&&(t.last_name=n["fynd_website.form_last_name"]),n.city&&(t.city=n.city),n.state&&(t.state=n.state),n.zip&&(t.zip=n.zip),n.country&&(t.country=n.country),n.external_id&&(t.external_id=n.external_id),Object.keys(t).forEach(e=>{let i=e;t[i]||delete t[i]}),Object.keys(t).length?t:null}function S(n="evt"){return`${n}_${Date.now()}_${Math.random().toString(36).slice(2)}`}function u(...n){window.fbq&&window.fbq(...n)}function M(n,t){let e=t||{},i=D(e)||b();switch(n){case"fynd_website.form.submitted":{let r=e.event_id||S("lead"),o=e.submitted_form||e["fynd_website.form_name"]||"unknown_form";return{type:"track",name:"Lead",params:{form_id:e["fynd_website.form_id"]||void 0,form_name:o,value:0,currency:"INR"},options:{eventID:r},userData:i}}case"fynd_website.sign_up.clicked":return{type:"trackCustom",name:"SignUpClick",params:{},userData:i};case"fynd_website.sign_in.clicked":return{type:"trackCustom",name:"SignInClick",params:{},userData:i};case"fynd_website.book_a_demo.clicked":return{type:"trackCustom",name:"BookDemoClick",params:{source_page:e?.["fynd_website.source_page"]},userData:i};case"fynd_website.form.started":return{type:"trackCustom",name:"FormStarted",params:{form_id:e?.["fynd_website.form_id"]||void 0,form_name:e?.["fynd_website.form_name"]||void 0},userData:i};case"fynd_website.page.loaded":return{type:"track",name:"PageView",params:{},userData:i};default:return null}}function h(n={}){let{enableAdvancedMatching:t=!0,enableSpaPageViews:e=!0,hasConsent:i}=n;A();let r=t?b():null;if(i&&!i()){let a=window.setInterval(()=>{i()&&(window.clearInterval(a),u("init",w,r||{}),p(e))},250)}else u("init",w,r||{}),p(e);let o=window.trackEvent;window.trackEvent=function(a,c){try{if(typeof o=="function"&&o.call(window,a,c),i&&!i())return;let s=M(a,c);if(!s)return;s.type==="track"?s.options?.eventID?u("track",s.name,s.params||{},{eventID:s.options.eventID}):u("track",s.name,s.params||{}):u("trackCustom",s.name,s.params||{})}catch(s){console.warn("Meta tracking error:",s)}}}function p(n){if(u("track","PageView"),n){let r=function(){setTimeout(()=>u("track","PageView"),0)};var t=r;let e=history.pushState,i=history.replaceState;history.pushState=function(...o){let a=e.apply(this,o);return r(),a},history.replaceState=function(...o){let a=i.apply(this,o);return r(),a},window.addEventListener("popstate",r)}}var v=()=>{let n={};try{let t=null;if(typeof window.getUserJourney=="function"&&(t=window.getUserJourney()),!t){let e=localStorage.getItem("userJourney");e&&(t=JSON.parse(e))}if(t?.formDetails){let e=t.formDetails;e.formId&&(n.form_id=e.formId),e.formName&&(n.form_name=e.formName),e.firstName&&(n.form_first_name=e.firstName),e.lastName&&(n.form_last_name=e.lastName),e.email&&(n.form_email=e.email),e.phone&&(n.form_phone=e.phone)}if(t?.aiData){let e=t.aiData;e.context&&(n.aidata_context=e.context),e.platform&&(n.aidata_platform=e.platform),e.type&&(n.aidata_type=e.type),e.detectionMethod&&(n.aidata_detection=e.detectionMethod)}}catch(t){console.warn("Error getting user journey data for GA tracking:",t)}return n},y=()=>{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 i=localStorage.getItem("userJourney");i&&(e=JSON.parse(i))}if(e){if(t["fynd_website.journey_touchpoints"]=e.userJourney||e,e.formDetails){let i=e.formDetails;i.formId&&(t["fynd_website.form_id"]=i.formId),i.formName&&(t["fynd_website.form_name"]=i.formName),i.firstName&&(t["fynd_website.form_first_name"]=i.firstName),i.lastName&&(t["fynd_website.form_last_name"]=i.lastName),i.email&&(t["fynd_website.form_email"]=i.email),i.phone&&(t["fynd_website.form_phone"]=i.phone)}if(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 i=new Date(e.userJourney[0].time),r=new Date(e.userJourney[e.userJourney.length-1].time);t["fynd_website.journey_session_duration"]=Math.floor((r.getTime()-i.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}if(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),e.aiData){let i=e.aiData;i.context&&(t["fynd_website.aidata_context"]=i.context),i.platform&&(t["fynd_website.aidata_platform"]=i.platform),i.type&&(t["fynd_website.aidata_type"]=i.type),i.detectionMethod&&(t["fynd_website.aidata_detection"]=i.detectionMethod)}}}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"}try{let e=document.cookie.match(/(?:^|;\s*)user-id=([^;]*)/);t["fynd_website.uuid"]=e?decodeURIComponent(e[1]):null}catch(e){console.warn("Error reading user-id cookie:",e),t["fynd_website.uuid"]=null}return t},j=(n,t,e)=>{if(window.dataLayer){let i={event:n,event_category:"form_interaction",event_label:n,...t};e?.submitted_form&&(i.submitted_form=e.submitted_form),window.dataLayer.push(i)}else console.warn("dataLayer not available for GA tracking")},m=(n,t)=>{try{console.log("Event fired:",n,t);let e=y(),i=t?{...e,...t}:e;if(window.posthog&&(window.posthog.capture(n,i),n==="fynd_website.form.submitted"))try{let c=window.getUserJourney?.()||JSON.parse(localStorage.getItem("userJourney")||"{}"),s={};c?.formDetails?.firstName&&(s.name=c.formDetails.firstName),c?.formDetails?.email&&(s.email=c.formDetails.email),c?.formDetails?.phone&&(s.mobile=c.formDetails.phone),Object.keys(s).length>0&&(console.log("\u{1F4CA} PostHog Person Properties - Form Submission:",s),window.posthog.setPersonProperties(s))}catch(c){console.warn("Error setting person properties:",c)}let r=v(),o=r.aidata_context||r.aidata_platform||r.aidata_type||r.aidata_detection;(n.includes("form")||Object.keys(r).length>0||t?.submitted_form||!!o)&&j(n,r,t)}catch(e){console.error("Error tracking event:",e)}},k=n=>{let t=n.closest("form");return t&&(t.getAttribute("data-name")||t.getAttribute("name")||t.id)||null};document.addEventListener("DOMContentLoaded",()=>{let n=y();window.posthog&&window.posthog.capture("$pageview",n)});window.addEventListener("load",()=>{m("fynd_website.page.loaded")});document.addEventListener("DOMContentLoaded",()=>{let n=document.querySelectorAll('[data-ph="sign-up"]'),t=document.querySelectorAll('[data-ph="sign-in"]'),e=document.querySelectorAll('[href="#footer-form"]'),i=document.querySelectorAll('[data-ph="book-a-demo"]'),r=document.querySelectorAll('[data-ph="call"]');document.querySelectorAll('[type="submit"]').forEach(d=>{d.addEventListener("click",function(){let f=k(this);setTimeout(()=>{window.validationPassed===!0&&m("fynd_website.form.submitted",f?{submitted_form:f}:{})},10)})}),n.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.sign_up.clicked"))}),t.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.sign_in.clicked"))}),e.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.scroll_to_form.clicked"))}),i.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.book_a_demo.clicked"))}),r.forEach(d=>{d.addEventListener("click",()=>m("fynd_website.call.clicked"))});let a=document.querySelectorAll("[ph-form-field]"),c=new Set,s=function(){let f=k(this)||"unknown-form";c.has(f)||(c.add(f),m("fynd_website.form.started"))};a.forEach(d=>{let f=d.tagName.toLowerCase(),l=d.type?.toLowerCase();f==="button"||f==="input"&&l==="submit"||d.addEventListener("focus",s),f==="button"||f==="input"&&l==="submit"?d.addEventListener("click",s):f==="select"?d.addEventListener("change",s):d.addEventListener("input",s)})});window.getPosthogTrackingProperties=y;window.trackEvent=m;window.getGaTrackingProperties=v;g();h({enableAdvancedMatching:!0,enableSpaPageViews:!0,hasConsent:()=>window.__ad_consent==="granted"||!0});})();
1
+ "use strict";
2
+ (() => {
3
+ // bin/live-reload.js
4
+ if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
5
+ new EventSource(`${"http://localhost:3000"}/esbuild`).addEventListener(
6
+ "change",
7
+ () => location.reload()
8
+ );
9
+ } else {
10
+ }
11
+
12
+ // src/posthog-and-ga/adtracking-general.ts
13
+ var getSearchParam = (name) => {
14
+ const v = new URLSearchParams(window.location.search).get(name);
15
+ return v ? v.trim() : null;
16
+ };
17
+ var isAdTraffic = () => {
18
+ const medium = getSearchParam("utm_medium")?.toLowerCase();
19
+ return medium === "cpc" || medium === "ads";
20
+ };
21
+ var AD_EVENT_PREFIX = "fynd_website_ad.";
22
+ var makeEvent = (suffix) => `${AD_EVENT_PREFIX}${suffix}`;
23
+ var getParentFormName = (element) => {
24
+ const parentForm = element.closest("form");
25
+ if (!parentForm) return null;
26
+ return parentForm.getAttribute("data-name") || parentForm.getAttribute("name") || parentForm.id || null;
27
+ };
28
+ var initGeneralAdsTracking = () => {
29
+ if (window.__adsTrackingInitializedGeneral) return;
30
+ if (!isAdTraffic()) return;
31
+ window.__adsTrackingInitializedGeneral = true;
32
+ const baseProps = {
33
+ "fynd_website.current_page": window.location.pathname
34
+ };
35
+ const emit = (suffix, props) => {
36
+ const name = makeEvent(suffix);
37
+ window.trackEvent?.(name, { ...baseProps, ...props || {} });
38
+ };
39
+ document.addEventListener("DOMContentLoaded", () => {
40
+ document.querySelectorAll('[data-ph="sign-up"]').forEach(
41
+ (btn) => btn.addEventListener("click", () => emit("sign_up.clicked"))
42
+ );
43
+ document.querySelectorAll('[data-ph="sign-in"]').forEach(
44
+ (btn) => btn.addEventListener("click", () => emit("sign_in.clicked"))
45
+ );
46
+ document.querySelectorAll('[data-ph="book-a-demo"]').forEach(
47
+ (btn) => btn.addEventListener("click", () => emit("book_a_demo.clicked"))
48
+ );
49
+ const formFields = document.querySelectorAll("[ph-form-field]");
50
+ const triggeredForms = /* @__PURE__ */ new Set();
51
+ const handleFormStarted = function() {
52
+ const formName = getParentFormName(this) || "unknown-form";
53
+ if (!triggeredForms.has(formName)) {
54
+ triggeredForms.add(formName);
55
+ emit("form.started", { started_form: formName });
56
+ }
57
+ };
58
+ formFields.forEach((field) => {
59
+ const tag = field.tagName.toLowerCase();
60
+ const type = field.type?.toLowerCase();
61
+ if (!(tag === "button" || tag === "input" && type === "submit")) {
62
+ field.addEventListener("focus", handleFormStarted);
63
+ }
64
+ if (tag === "button" || tag === "input" && type === "submit") {
65
+ field.addEventListener("click", handleFormStarted);
66
+ } else if (tag === "select") {
67
+ field.addEventListener("change", handleFormStarted);
68
+ } else {
69
+ field.addEventListener("input", handleFormStarted);
70
+ }
71
+ });
72
+ document.querySelectorAll('[type="submit"]').forEach((button) => {
73
+ button.addEventListener("click", function() {
74
+ const formName = getParentFormName(this);
75
+ setTimeout(() => {
76
+ if (window.validationPassed === true) {
77
+ const props = formName ? { submitted_form: formName } : {};
78
+ emit("form.submitted", props);
79
+ }
80
+ }, 10);
81
+ });
82
+ });
83
+ });
84
+ };
85
+
86
+ // src/posthog-and-ga/meta-tracking.ts
87
+ var META_PIXEL_ID = "2741377816069290";
88
+ function loadMetaPixel() {
89
+ if (typeof window === "undefined") return;
90
+ if (window.fbq) return;
91
+ (function(f, b, e, v, n, t, s) {
92
+ if (f.fbq) return;
93
+ n = f.fbq = function() {
94
+ n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
95
+ };
96
+ if (!f._fbq) f._fbq = n;
97
+ n.push = n;
98
+ n.loaded = true;
99
+ n.version = "2.0";
100
+ n.queue = [];
101
+ t = b.createElement(e);
102
+ t.async = true;
103
+ t.src = "https://connect.facebook.net/en_US/fbevents.js";
104
+ s = b.getElementsByTagName(e)[0];
105
+ s.parentNode.insertBefore(t, s);
106
+ })(window, document, "script", void 0);
107
+ }
108
+ function getAdvancedUserFromJourney() {
109
+ try {
110
+ let journey = null;
111
+ if (typeof window.getUserJourney === "function") {
112
+ journey = window.getUserJourney();
113
+ }
114
+ if (!journey) {
115
+ const stored = sessionStorage.getItem("userJourney");
116
+ if (stored) journey = JSON.parse(stored);
117
+ }
118
+ const u = {};
119
+ const fd = journey?.formDetails;
120
+ if (fd?.email) u.email = fd.email;
121
+ if (fd?.phone) u.phone = fd.phone;
122
+ if (fd?.firstName) u.first_name = fd.firstName;
123
+ if (fd?.lastName) u.last_name = fd.lastName;
124
+ if (fd?.city) u.city = fd.city;
125
+ if (fd?.state) u.state = fd.state;
126
+ if (fd?.zip) u.zip = fd.zip;
127
+ if (journey?.country) u.country = journey.country;
128
+ if (journey?.userId) u.external_id = String(journey.userId);
129
+ Object.keys(u).forEach((k) => {
130
+ const key = k;
131
+ if (!u[key]) delete u[key];
132
+ });
133
+ return Object.keys(u).length ? u : null;
134
+ } catch {
135
+ return null;
136
+ }
137
+ }
138
+ function getAdvancedUserFromProps(props) {
139
+ if (!props) return null;
140
+ const u = {};
141
+ if (props["fynd_website.form_email"]) u.email = props["fynd_website.form_email"];
142
+ if (props["fynd_website.form_phone"]) u.phone = props["fynd_website.form_phone"];
143
+ if (props["fynd_website.form_first_name"]) u.first_name = props["fynd_website.form_first_name"];
144
+ if (props["fynd_website.form_last_name"]) u.last_name = props["fynd_website.form_last_name"];
145
+ if (props.city) u.city = props.city;
146
+ if (props.state) u.state = props.state;
147
+ if (props.zip) u.zip = props.zip;
148
+ if (props.country) u.country = props.country;
149
+ if (props.external_id) u.external_id = props.external_id;
150
+ Object.keys(u).forEach((k) => {
151
+ const key = k;
152
+ if (!u[key]) delete u[key];
153
+ });
154
+ return Object.keys(u).length ? u : null;
155
+ }
156
+ function genEventId(prefix = "evt") {
157
+ return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2)}`;
158
+ }
159
+ function safeFbq(...args) {
160
+ if (!window.fbq) return;
161
+ window.fbq(...args);
162
+ }
163
+ function mapFyndToMeta(eventName, properties) {
164
+ const props = properties || {};
165
+ const userData = getAdvancedUserFromProps(props) || getAdvancedUserFromJourney();
166
+ switch (eventName) {
167
+ case "fynd_website.form.submitted": {
168
+ const eventID = props.event_id || genEventId("lead");
169
+ const formName = props.submitted_form || props["fynd_website.form_name"] || "unknown_form";
170
+ return {
171
+ type: "track",
172
+ name: "Lead",
173
+ params: {
174
+ form_id: props["fynd_website.form_id"] || void 0,
175
+ form_name: formName,
176
+ value: 0,
177
+ currency: "INR"
178
+ },
179
+ options: { eventID },
180
+ userData
181
+ };
182
+ }
183
+ case "fynd_website.sign_up.clicked":
184
+ return { type: "trackCustom", name: "SignUpClick", params: {}, userData };
185
+ case "fynd_website.sign_in.clicked":
186
+ return { type: "trackCustom", name: "SignInClick", params: {}, userData };
187
+ case "fynd_website.book_a_demo.clicked":
188
+ return {
189
+ type: "trackCustom",
190
+ name: "BookDemoClick",
191
+ params: {
192
+ source_page: props?.["fynd_website.source_page"]
193
+ },
194
+ userData
195
+ };
196
+ case "fynd_website.form.started":
197
+ return {
198
+ type: "trackCustom",
199
+ name: "FormStarted",
200
+ params: {
201
+ form_id: props?.["fynd_website.form_id"] || void 0,
202
+ form_name: props?.["fynd_website.form_name"] || void 0
203
+ },
204
+ userData
205
+ };
206
+ // Page lifecycle
207
+ case "fynd_website.page.loaded":
208
+ return { type: "track", name: "PageView", params: {}, userData };
209
+ default:
210
+ return null;
211
+ }
212
+ }
213
+ function initMetaTracking(options = {}) {
214
+ const { enableAdvancedMatching = true, enableSpaPageViews = true, hasConsent } = options;
215
+ loadMetaPixel();
216
+ const initialUser = enableAdvancedMatching ? getAdvancedUserFromJourney() : null;
217
+ if (hasConsent && !hasConsent()) {
218
+ const iv = window.setInterval(() => {
219
+ if (hasConsent()) {
220
+ window.clearInterval(iv);
221
+ safeFbq("init", META_PIXEL_ID, initialUser || {});
222
+ postInit(enableSpaPageViews);
223
+ }
224
+ }, 250);
225
+ } else {
226
+ safeFbq("init", META_PIXEL_ID, initialUser || {});
227
+ postInit(enableSpaPageViews);
228
+ }
229
+ const originalTrackEvent = window.trackEvent;
230
+ window.trackEvent = function(eventName, properties) {
231
+ try {
232
+ if (typeof originalTrackEvent === "function") {
233
+ originalTrackEvent.call(window, eventName, properties);
234
+ }
235
+ if (hasConsent && !hasConsent()) return;
236
+ const mapped = mapFyndToMeta(eventName, properties);
237
+ if (!mapped) return;
238
+ if (mapped.type === "track") {
239
+ if (mapped.options?.eventID) {
240
+ safeFbq("track", mapped.name, mapped.params || {}, { eventID: mapped.options.eventID });
241
+ } else {
242
+ safeFbq("track", mapped.name, mapped.params || {});
243
+ }
244
+ } else {
245
+ safeFbq("trackCustom", mapped.name, mapped.params || {});
246
+ }
247
+ } catch (e) {
248
+ console.warn("Meta tracking error:", e);
249
+ }
250
+ };
251
+ }
252
+ function postInit(enableSpaPageViews) {
253
+ safeFbq("track", "PageView");
254
+ if (enableSpaPageViews) {
255
+ let onLocationChange2 = function() {
256
+ setTimeout(() => safeFbq("track", "PageView"), 0);
257
+ };
258
+ var onLocationChange = onLocationChange2;
259
+ const origPushState = history.pushState;
260
+ const origReplaceState = history.replaceState;
261
+ history.pushState = function(...args) {
262
+ const ret = origPushState.apply(this, args);
263
+ onLocationChange2();
264
+ return ret;
265
+ };
266
+ history.replaceState = function(...args) {
267
+ const ret = origReplaceState.apply(this, args);
268
+ onLocationChange2();
269
+ return ret;
270
+ };
271
+ window.addEventListener("popstate", onLocationChange2);
272
+ }
273
+ }
274
+
275
+ // src/posthog-and-ga/main.ts
276
+ var getGaTrackingProperties = () => {
277
+ const gaProperties = {};
278
+ try {
279
+ let journey = null;
280
+ if (typeof window.getUserJourney === "function") {
281
+ journey = window.getUserJourney();
282
+ }
283
+ if (!journey) {
284
+ const storedData = localStorage.getItem("userJourney");
285
+ if (storedData) journey = JSON.parse(storedData);
286
+ }
287
+ if (journey?.formDetails) {
288
+ const formDetails = journey.formDetails;
289
+ if (formDetails.formId) gaProperties.form_id = formDetails.formId;
290
+ if (formDetails.formName) gaProperties.form_name = formDetails.formName;
291
+ if (formDetails.firstName) gaProperties.form_first_name = formDetails.firstName;
292
+ if (formDetails.lastName) gaProperties.form_last_name = formDetails.lastName;
293
+ if (formDetails.email) gaProperties.form_email = formDetails.email;
294
+ if (formDetails.phone) gaProperties.form_phone = formDetails.phone;
295
+ }
296
+ if (journey?.aiData) {
297
+ const aiData = journey.aiData;
298
+ if (aiData.context) gaProperties.aidata_context = aiData.context;
299
+ if (aiData.platform) gaProperties.aidata_platform = aiData.platform;
300
+ if (aiData.type) gaProperties.aidata_type = aiData.type;
301
+ if (aiData.detectionMethod) gaProperties.aidata_detection = aiData.detectionMethod;
302
+ }
303
+ } catch (err) {
304
+ console.warn("Error getting user journey data for GA tracking:", err);
305
+ }
306
+ return gaProperties;
307
+ };
308
+ var getPosthogTrackingProperties = () => {
309
+ const pathname = window.location.pathname;
310
+ const base = {
311
+ "fynd_website.source_page": pathname,
312
+ "fynd_website.product": "fynd.com website",
313
+ "fynd_website.device_type": "Unknown",
314
+ "fynd_website.utm_source": new URLSearchParams(window.location.search).get("utm_source") || "",
315
+ "fynd_website.utm_medium": new URLSearchParams(window.location.search).get("utm_medium") || "",
316
+ "fynd_website.utm_campaign": new URLSearchParams(window.location.search).get("utm_campaign") || "",
317
+ "fynd_website.referrer": document.referrer
318
+ };
319
+ try {
320
+ let journey = null;
321
+ if (typeof window.getUserJourney === "function") {
322
+ journey = window.getUserJourney();
323
+ }
324
+ if (!journey) {
325
+ const storedData = localStorage.getItem("userJourney");
326
+ if (storedData) journey = JSON.parse(storedData);
327
+ }
328
+ if (journey) {
329
+ base["fynd_website.journey_touchpoints"] = journey.userJourney || journey;
330
+ if (journey.formDetails) {
331
+ const f = journey.formDetails;
332
+ if (f.formId) base["fynd_website.form_id"] = f.formId;
333
+ if (f.formName) base["fynd_website.form_name"] = f.formName;
334
+ if (f.firstName) base["fynd_website.form_first_name"] = f.firstName;
335
+ if (f.lastName) base["fynd_website.form_last_name"] = f.lastName;
336
+ if (f.email) base["fynd_website.form_email"] = f.email;
337
+ if (f.phone) base["fynd_website.form_phone"] = f.phone;
338
+ }
339
+ if (journey.userJourney?.length > 0) {
340
+ base["fynd_website.journey_total_pages"] = journey.userJourney.length;
341
+ base["fynd_website.journey_touchpoints_count"] = journey.userJourney.length;
342
+ base["fynd_website.journey_first_page"] = journey.userJourney[0].page;
343
+ base["fynd_website.journey_current_page"] = journey.userJourney[journey.userJourney.length - 1].page;
344
+ const firstVisit = new Date(journey.userJourney[0].time);
345
+ const lastVisit = new Date(journey.userJourney[journey.userJourney.length - 1].time);
346
+ base["fynd_website.journey_session_duration"] = Math.floor(
347
+ (lastVisit.getTime() - firstVisit.getTime()) / 1e3
348
+ );
349
+ base["fynd_website.journey_entry_time"] = journey.userJourney[0].time;
350
+ base["fynd_website.journey_exit_time"] = journey.userJourney[journey.userJourney.length - 1].time;
351
+ }
352
+ if (journey.deviceCategory) base["fynd_website.device_type"] = journey.deviceCategory;
353
+ if (journey.browser) base["fynd_website.journey_browser"] = journey.browser;
354
+ if (journey.device) base["fynd_website.journey_device"] = journey.device;
355
+ if (journey.origin) base["fynd_website.journey_origin"] = journey.origin;
356
+ if (journey.utmPath) base["fynd_website.journey_utm_path"] = journey.utmPath;
357
+ if (journey.scrollDepth) base["fynd_website.journey_scroll_depth"] = journey.scrollDepth;
358
+ if (journey.aiData) {
359
+ const aiData = journey.aiData;
360
+ if (aiData.context) base["fynd_website.aidata_context"] = aiData.context;
361
+ if (aiData.platform) base["fynd_website.aidata_platform"] = aiData.platform;
362
+ if (aiData.type) base["fynd_website.aidata_type"] = aiData.type;
363
+ if (aiData.detectionMethod) base["fynd_website.aidata_detection"] = aiData.detectionMethod;
364
+ }
365
+ }
366
+ } catch (err) {
367
+ console.warn("Error getting user journey data for tracking:", err);
368
+ }
369
+ if (base["fynd_website.device_type"] === "Unknown") {
370
+ const ua = navigator.userAgent;
371
+ if (/iPad/.test(ua) || /Android/.test(ua) && !/Mobile/.test(ua) || /Tablet/.test(ua)) {
372
+ base["fynd_website.device_type"] = "Tablet";
373
+ } else if (/Mobile|iPhone|Android|BlackBerry|Opera Mini|IEMobile|WPDesktop/.test(ua)) {
374
+ base["fynd_website.device_type"] = "Mobile";
375
+ } else {
376
+ base["fynd_website.device_type"] = "Desktop";
377
+ }
378
+ }
379
+ try {
380
+ const cookieMatch = document.cookie.match(/(?:^|;\s*)user-id=([^;]*)/);
381
+ base["fynd_website.uuid"] = cookieMatch ? decodeURIComponent(cookieMatch[1]) : null;
382
+ } catch (err) {
383
+ console.warn("Error reading user-id cookie:", err);
384
+ base["fynd_website.uuid"] = null;
385
+ }
386
+ return base;
387
+ };
388
+ var sendToGA = (eventName, gaProps, additionalProps) => {
389
+ if (window.dataLayer) {
390
+ const eventData = {
391
+ event: eventName,
392
+ event_category: "form_interaction",
393
+ event_label: eventName,
394
+ ...gaProps
395
+ };
396
+ if (additionalProps?.submitted_form) {
397
+ eventData.submitted_form = additionalProps.submitted_form;
398
+ }
399
+ window.dataLayer.push(eventData);
400
+ } else {
401
+ console.warn("dataLayer not available for GA tracking");
402
+ }
403
+ };
404
+ var trackEvent = (eventName, properties) => {
405
+ try {
406
+ console.log("Event fired:", eventName, properties);
407
+ const baseProps = getPosthogTrackingProperties();
408
+ const finalProps = properties ? { ...baseProps, ...properties } : baseProps;
409
+ if (window.posthog) {
410
+ window.posthog.capture(eventName, finalProps);
411
+ if (eventName === "fynd_website.form.submitted") {
412
+ try {
413
+ const journey = window.getUserJourney?.() || JSON.parse(localStorage.getItem("userJourney") || "{}");
414
+ const personProps = {};
415
+ if (journey?.formDetails?.firstName) {
416
+ personProps["name"] = journey.formDetails.firstName;
417
+ }
418
+ if (journey?.formDetails?.email) {
419
+ personProps["email"] = journey.formDetails.email;
420
+ }
421
+ if (journey?.formDetails?.phone) {
422
+ personProps["mobile"] = journey.formDetails.phone;
423
+ }
424
+ if (Object.keys(personProps).length > 0) {
425
+ console.log("\u{1F4CA} PostHog Person Properties - Form Submission:", personProps);
426
+ window.posthog.setPersonProperties(personProps);
427
+ }
428
+ } catch (err) {
429
+ console.warn("Error setting person properties:", err);
430
+ }
431
+ }
432
+ }
433
+ const gaProps = getGaTrackingProperties();
434
+ const hasAIData = gaProps.aidata_context || gaProps.aidata_platform || gaProps.aidata_type || gaProps.aidata_detection;
435
+ const isFormRelatedEvent = eventName.includes("form") || Object.keys(gaProps).length > 0 || properties?.submitted_form || !!hasAIData;
436
+ if (isFormRelatedEvent) {
437
+ sendToGA(eventName, gaProps, properties);
438
+ }
439
+ } catch (error) {
440
+ console.error("Error tracking event:", error);
441
+ }
442
+ };
443
+ var getParentFormName2 = (element) => {
444
+ const parentForm = element.closest("form");
445
+ if (!parentForm) return null;
446
+ return parentForm.getAttribute("data-name") || parentForm.getAttribute("name") || parentForm.id || null;
447
+ };
448
+ document.addEventListener("DOMContentLoaded", () => {
449
+ const props = getPosthogTrackingProperties();
450
+ if (window.posthog) {
451
+ window.posthog.capture("$pageview", props);
452
+ }
453
+ });
454
+ window.addEventListener("load", () => {
455
+ trackEvent("fynd_website.page.loaded");
456
+ });
457
+ document.addEventListener("DOMContentLoaded", () => {
458
+ const signUpButtons = document.querySelectorAll('[data-ph="sign-up"]');
459
+ const signInButtons = document.querySelectorAll('[data-ph="sign-in"]');
460
+ const scrollToFormButtons = document.querySelectorAll('[href="#footer-form"]');
461
+ const bookADemoButtons = document.querySelectorAll('[data-ph="book-a-demo"]');
462
+ const callButtons = document.querySelectorAll('[data-ph="call"]');
463
+ const submitButtons = document.querySelectorAll('[type="submit"]');
464
+ submitButtons.forEach((button) => {
465
+ button.addEventListener("click", function() {
466
+ const formName = getParentFormName2(this);
467
+ setTimeout(() => {
468
+ if (window.validationPassed === true) {
469
+ const additionalProps = formName ? { submitted_form: formName } : {};
470
+ trackEvent("fynd_website.form.submitted", additionalProps);
471
+ }
472
+ }, 10);
473
+ });
474
+ });
475
+ signUpButtons.forEach((button) => {
476
+ button.addEventListener("click", () => trackEvent("fynd_website.sign_up.clicked"));
477
+ });
478
+ signInButtons.forEach((button) => {
479
+ button.addEventListener("click", () => trackEvent("fynd_website.sign_in.clicked"));
480
+ });
481
+ scrollToFormButtons.forEach((button) => {
482
+ button.addEventListener("click", () => trackEvent("fynd_website.scroll_to_form.clicked"));
483
+ });
484
+ bookADemoButtons.forEach((button) => {
485
+ button.addEventListener("click", () => trackEvent("fynd_website.book_a_demo.clicked"));
486
+ });
487
+ callButtons.forEach((button) => {
488
+ button.addEventListener("click", () => trackEvent("fynd_website.call.clicked"));
489
+ });
490
+ const formFields = document.querySelectorAll("[ph-form-field]");
491
+ const triggeredForms = /* @__PURE__ */ new Set();
492
+ const handleFormStarted = function() {
493
+ const formName = getParentFormName2(this);
494
+ const formIdentifier = formName || "unknown-form";
495
+ if (!triggeredForms.has(formIdentifier)) {
496
+ triggeredForms.add(formIdentifier);
497
+ trackEvent("fynd_website.form.started");
498
+ }
499
+ };
500
+ formFields.forEach((field) => {
501
+ const tagName = field.tagName.toLowerCase();
502
+ const inputType = field.type?.toLowerCase();
503
+ if (!(tagName === "button" || tagName === "input" && inputType === "submit")) {
504
+ field.addEventListener("focus", handleFormStarted);
505
+ }
506
+ if (tagName === "button" || tagName === "input" && inputType === "submit") {
507
+ field.addEventListener("click", handleFormStarted);
508
+ } else if (tagName === "select") {
509
+ field.addEventListener("change", handleFormStarted);
510
+ } else {
511
+ field.addEventListener("input", handleFormStarted);
512
+ }
513
+ });
514
+ });
515
+ window.getPosthogTrackingProperties = getPosthogTrackingProperties;
516
+ window.trackEvent = trackEvent;
517
+ window.getGaTrackingProperties = getGaTrackingProperties;
518
+ initGeneralAdsTracking();
519
+ initMetaTracking({
520
+ enableAdvancedMatching: true,
521
+ // pulls user data from your journey store when available
522
+ enableSpaPageViews: true,
523
+ // fires PageView on virtual navigations
524
+ hasConsent: () => window.__ad_consent === "granted" || true
525
+ // replace with your consent logic
526
+ });
527
+ })();
528
+ //# sourceMappingURL=main.js.map