@fynd-design-engineering/fynd-one-v2 2.0.1 → 2.0.3

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";(()=>{document.addEventListener("DOMContentLoaded",function(){let e=document.getElementById("wf-form-Event-Download");if(!e){console.error("Form with ID 'wf-form-Event-Download' not found");return}e.addEventListener("submit",function(d){if(d.preventDefault(),e.checkValidity()){e.submit();let t=new MutationObserver(()=>{let o=document.getElementById("ebook-success");if(o&&o.style.display!=="none"){let n=document.getElementById("ebook-download");n&&(setTimeout(()=>{n.click()},1e3),t.disconnect())}});t.observe(document.body,{childList:!0,subtree:!0})}else e.reportValidity()})});})();
1
+ "use strict";(()=>{document.addEventListener("DOMContentLoaded",function(){let e=document.querySelector("#wf-form-Event-Download input[type='submit']");if(!e){console.error("Submit button not found");return}e.addEventListener("click",function(){setTimeout(()=>{let n=document.getElementById("ebook-success");if(n&&n.style.display!=="none"){let t=document.getElementById("ebook-download");t&&t.click()}},2500)})});})();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../bin/live-reload.js", "../../src/form/download-file.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", "document.addEventListener(\"DOMContentLoaded\", function (): void {\n const form = document.getElementById(\"wf-form-Event-Download\") as HTMLFormElement;\n\n if (!form) {\n console.error(\"Form with ID 'wf-form-Event-Download' not found\");\n return;\n }\n\n form.addEventListener(\"submit\", function (event: Event): void {\n event.preventDefault(); // Prevent default submission initially\n\n // If the form is valid, submit it programmatically\n if (form.checkValidity()) {\n form.submit(); // Let Webflow handle actual submission\n\n // Wait for Webflow to show success message\n const observer = new MutationObserver((): void => {\n const successEl = document.getElementById(\"ebook-success\") as HTMLElement | null;\n if (successEl && successEl.style.display !== \"none\") {\n const downloadLink = document.getElementById(\"ebook-download\") as HTMLAnchorElement | null;\n if (downloadLink) {\n setTimeout((): void => {\n downloadLink.click();\n }, 1000);\n observer.disconnect();\n }\n }\n });\n\n // Watch for DOM changes to detect success message\n observer.observe(document.body, { childList: true, subtree: true });\n } else {\n form.reportValidity(); // Trigger browser's native validation UI\n }\n });\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,WAAS,iBAAiB,oBAAoB,WAAkB;AAC9D,UAAM,OAAO,SAAS,eAAe,wBAAwB;AAE7D,QAAI,CAAC,MAAM;AACT,cAAQ,MAAM,iDAAiD;AAC/D;AAAA,IACF;AAEA,SAAK,iBAAiB,UAAU,SAAU,OAAoB;AAC5D,YAAM,eAAe;AAGrB,UAAI,KAAK,cAAc,GAAG;AACxB,aAAK,OAAO;AAGZ,cAAM,WAAW,IAAI,iBAAiB,MAAY;AAChD,gBAAM,YAAY,SAAS,eAAe,eAAe;AACzD,cAAI,aAAa,UAAU,MAAM,YAAY,QAAQ;AACnD,kBAAM,eAAe,SAAS,eAAe,gBAAgB;AAC7D,gBAAI,cAAc;AAChB,yBAAW,MAAY;AACrB,6BAAa,MAAM;AAAA,cACrB,GAAG,GAAI;AACP,uBAAS,WAAW;AAAA,YACtB;AAAA,UACF;AAAA,QACF,CAAC;AAGD,iBAAS,QAAQ,SAAS,MAAM,EAAE,WAAW,MAAM,SAAS,KAAK,CAAC;AAAA,MACpE,OAAO;AACL,aAAK,eAAe;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH,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", "document.addEventListener(\"DOMContentLoaded\", function (): void {\n const submitButton = document.querySelector(\"#wf-form-Event-Download input[type='submit']\") as HTMLInputElement;\n\n if (!submitButton) {\n console.error(\"Submit button not found\");\n return;\n }\n\n submitButton.addEventListener(\"click\", function (): void {\n // Wait 1000ms then check for success div\n setTimeout((): void => {\n const successEl = document.getElementById(\"ebook-success\") as HTMLElement | null;\n if (successEl && successEl.style.display !== \"none\") {\n const downloadLink = document.getElementById(\"ebook-download\") as HTMLAnchorElement | null;\n if (downloadLink) {\n downloadLink.click();\n }\n }\n }, 2500);\n });\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,WAAS,iBAAiB,oBAAoB,WAAkB;AAC9D,UAAM,eAAe,SAAS,cAAc,8CAA8C;AAE1F,QAAI,CAAC,cAAc;AACjB,cAAQ,MAAM,yBAAyB;AACvC;AAAA,IACF;AAEA,iBAAa,iBAAiB,SAAS,WAAkB;AAEvD,iBAAW,MAAY;AACrB,cAAM,YAAY,SAAS,eAAe,eAAe;AACzD,YAAI,aAAa,UAAU,MAAM,YAAY,QAAQ;AACnD,gBAAM,eAAe,SAAS,eAAe,gBAAgB;AAC7D,cAAI,cAAc;AAChB,yBAAa,MAAM;AAAA,UACrB;AAAA,QACF;AAAA,MACF,GAAG,IAAI;AAAA,IACT,CAAC;AAAA,EACH,CAAC;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1 @@
1
+ "use strict";(()=>{function o(){try{let e=i();if(!e||e.userJourney.length===0)return;let t=e.userJourney[0],r=e.userJourney[e.userJourney.length-1];e.userJourney.length>1&&e.userJourney[e.userJourney.length-1].page==="/contact-us"&&(r=e.userJourney[e.userJourney.length-2]);let n={utm_source:t.utm.source,utm_medium:t.utm.medium,utm_campaign:t.utm.campaign,fp_custom_page_title:t.title,fp_custom_page_category:t.category.join(", "),fp_custom_page_type:t.type,fp_timestamp:t.time,fp_path:t.page,lp_custom_page_title:r.title,lp_custom_page_category:r.category.join(", "),lp_custom_page_type:r.type,lp_timestamp:r.time,lp_path:r.page,userjourney:JSON.stringify(e.userJourney),device:e.deviceCategory,browser:e.browser};Object.entries(n).forEach(([u,s])=>{a(u,s)})}catch(e){console.error("Error filling form with user journey data:",e)}}function i(){try{let e=sessionStorage.getItem("userJourney");return e?JSON.parse(e):null}catch(e){return console.error("Error getting user journey data:",e),null}}function a(e,t){try{let r=`[fynd-queryparam-name="${e}"]`,n=document.querySelector(r);if(n){n.value=t;let u=new Event("input",{bubbles:!0});n.dispatchEvent(u);let s=new Event("change",{bubbles:!0});n.dispatchEvent(s)}}catch(r){console.error(`Error filling field [${e}]:`,r)}}document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{o()},500)});document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{o()},500)}):setTimeout(()=>{o()},500);window.fillFormWithUserJourney=o;})();
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../bin/live-reload.js", "../../src/tracking/fill-form-fields.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", "// formFiller.ts - Auto-fill form fields with user journey data\nimport { UserJourney, TouchPoint } from './types';\n\n/**\n * Fills form input fields with user journey data based on fynd-queryparam-name attributes\n */\nfunction fillFormWithUserJourney(): void {\n try {\n // Get user journey data from session storage\n const journey: UserJourney | null = getUserJourneyData();\n\n if (!journey || journey.userJourney.length === 0) {\n //console.log('No user journey data available to fill form fields');\n return;\n }\n\n // Get first page (landing page) and last page data\n const firstPage: TouchPoint = journey.userJourney[0];\n let lastPage: TouchPoint = journey.userJourney[journey.userJourney.length - 1];\n\n // If current page is contact-us, use the previous page as last page\n if (journey.userJourney.length > 1 &&\n journey.userJourney[journey.userJourney.length - 1].page === '/contact-us') {\n lastPage = journey.userJourney[journey.userJourney.length - 2];\n }\n\n // Define the mapping of attribute values to data\n const fieldMappings: Record<string, string> = {\n // UTM parameters\n 'utm_source': firstPage.utm.source,\n 'utm_medium': firstPage.utm.medium,\n 'utm_campaign': firstPage.utm.campaign,\n\n // First Page (Landing Page) data\n 'fp_custom_page_title': firstPage.title,\n 'fp_custom_page_category': firstPage.category.join(', '),\n 'fp_custom_page_type': firstPage.type,\n 'fp_timestamp': firstPage.time,\n 'fp_path': firstPage.page,\n\n // Last Page data\n 'lp_custom_page_title': lastPage.title,\n 'lp_custom_page_category': lastPage.category.join(', '),\n 'lp_custom_page_type': lastPage.type,\n 'lp_timestamp': lastPage.time,\n 'lp_path': lastPage.page,\n\n // Journey metadata\n 'userjourney': JSON.stringify(journey.userJourney),\n 'device': journey.deviceCategory,\n 'browser': journey.browser\n };\n\n // Find and fill each form field\n Object.entries(fieldMappings).forEach(([attributeValue, data]) => {\n fillFormField(attributeValue, data);\n });\n\n //console.log('Form fields filled with user journey data');\n\n } catch (error: unknown) {\n console.error('Error filling form with user journey data:', error);\n }\n}\n\n/**\n * Helper function to get user journey data from session storage\n */\nfunction getUserJourneyData(): UserJourney | null {\n try {\n const storedData: string | null = sessionStorage.getItem('userJourney');\n return storedData ? JSON.parse(storedData) as UserJourney : null;\n } catch (error: unknown) {\n console.error('Error getting user journey data:', error);\n return null;\n }\n}\n\n/**\n * Helper function to find and fill a specific form field\n */\nfunction fillFormField(attributeValue: string, data: string): void {\n try {\n // Find any element with the specific fynd-queryparam-name attribute\n const selector: string = `[fynd-queryparam-name=\"${attributeValue}\"]`;\n const element: HTMLElement | null = document.querySelector(selector);\n\n if (element) {\n // Fill the element with the data\n (element as any).value = data;\n\n // Trigger input event to notify any listeners\n const inputEvent = new Event('input', { bubbles: true });\n element.dispatchEvent(inputEvent);\n\n // Trigger change event as well\n const changeEvent = new Event('change', { bubbles: true });\n element.dispatchEvent(changeEvent);\n\n //console.log(`Filled field [${attributeValue}] with:`, data);\n } else {\n //console.log(`Field with attribute [${attributeValue}] not found`);\n }\n } catch (error: unknown) {\n console.error(`Error filling field [${attributeValue}]:`, error);\n }\n}\n\n// Execute the function on DOM load with 500ms delay\ndocument.addEventListener('DOMContentLoaded', (): void => {\n setTimeout(() => {\n fillFormWithUserJourney();\n }, 500);\n});\n\n// Also execute immediately if DOM is already loaded\nif (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', (): void => {\n setTimeout(() => {\n fillFormWithUserJourney();\n }, 500);\n });\n} else {\n setTimeout(() => {\n fillFormWithUserJourney();\n }, 500);\n}\n\n// Make function globally accessible\ndeclare global {\n interface Window {\n fillFormWithUserJourney: () => void;\n }\n}\n\n// Attach function to window object for global access\nwindow.fillFormWithUserJourney = fillFormWithUserJourney;\n\n// Export function for module usage\nexport { fillFormWithUserJourney };"],
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;;;ACJA,WAAS,0BAAgC;AACrC,QAAI;AAEA,YAAM,UAA8B,mBAAmB;AAEvD,UAAI,CAA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AACvD,aAAO;AAAA,IACX;AAAA,EACJ;AAKA,WAAS,cAAc,gBAAwB,MAAoB;AAC/D,QAAI;AAEA,YAAM,WAAmB,0BAA0B,cAAc;AACjE,YAAM,UAA8B,SAAS,cAAc,QAAQ;AAEnE,UAAI,SAAS;AAET,QAAC,QAAgB,QAAQ;AAGzB,cAAM,aAAa,IAAI,MAAM,SAAS,EAAE,SAAS,KAAK,CAAC;AACvD,gBAAQ,cAAc,UAAU;AAGhC,cAAM,cAAc,IAAI,MAAM,UAAU,EAAE,SAAS,KAAK,CAAC;AACzD,gBAAQ,cAAc,WAAW;AAAA,MAGrC,OAAO;AAAA,MAEP;AAAA,IACJ,SAAS,OAAgB;AACrB,cAAQ,MAAM,wBAAwB,cAAc,MAAM,KAAK;AAAA,IACnE;AAAA,EACJ;AAGA,WAAS,iBAAiB,oBAAoB,MAAY;AACtD,eAAW,MAAM;AACb,8BAAwB;AAAA,IAC5B,GAAG,GAAG;AAAA,EACV,CAAC;AAGD,MAAI,SAAS,eAAe,WAAW;AACnC,aAAS,iBAAiB,oBAAoB,MAAY;AACtD,iBAAW,MAAM;AACb,gCAAwB;AAAA,MAC5B,GAAG,GAAG;AAAA,IACV,CAAC;AAAA,EACL,OAAO;AACH,eAAW,MAAM;AACb,8BAAwB;AAAA,IAC5B,GAAG,GAAG;AAAA,EACV;AAUA,SAAO,0BAA0B;",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- "use strict";(()=>{async function c(){let t="userJourney";function i(){let e=navigator.userAgent;return/tablet|ipad|playbook|silk/i.test(e)?"tablet":/mobile|iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(e)?"mobile":"desktop"}function l(){let e=navigator.userAgent;return e.includes("Chrome")&&!e.includes("Edg")?"Chrome":e.includes("Firefox")?"Firefox":e.includes("Safari")&&!e.includes("Chrome")?"Safari":e.includes("Edg")?"Edge":e.includes("Opera")?"Opera":"Unknown"}function y(e){if(!e)return"Unknown";try{let s=new URL(e).hostname.replace(/^www\./,""),a=s.split(".");return a.length>=2?a[0]:s||"Unknown"}catch{return"Unknown"}}function d(e,r){let o=new URLSearchParams(window.location.search),s=o.has("utm_source")||o.has("utm_medium")||o.has("utm_campaign");return e||s?s?{source:o.get("utm_source")||"",medium:o.get("utm_medium")||"",campaign:o.get("utm_campaign")||""}:{source:y(document.referrer),medium:"organic",campaign:"unknown"}:r||{source:"Unknown",medium:"organic",campaign:"unknown"}}function p(){try{return typeof window.pageCategories<"u"&&Array.isArray(window.pageCategories)&&window.pageCategories.length>0?window.pageCategories:["Not applicable"]}catch(e){return console.warn("Error accessing pageCategories:",e),["Not applicable"]}}function f(){let e=new URLSearchParams(window.location.search);return e.has("utm_source")||e.has("utm_medium")||e.has("utm_campaign")}function h(e){let r=e.split("?")[0].toLowerCase(),o={exactMatches:{"/":"Home","/home":"Home","/blog":"Blog listing","/about-us":"About us","/contact-us":"Contact","/privacy-policy":"Privacy policy","/terms-of-service":"Terms of service","/careers":"Careers","/customer-stories":"Customer stories listing","/events":"Events listing","/infographics":"Infographics listing","/newsroom":"Newsroom","/releases":"Releases listing"},pathStartsWith:[{pattern:"/blog/",type:"Blog"},{pattern:"/customer-stories/",type:"Customer story"},{pattern:"/case-studies/",type:"Case study"},{pattern:"/solutions/",type:"Solution"},{pattern:"/events/",type:"Event"},{pattern:"/news/",type:"News"},{pattern:"/press-releases/",type:"Press release"},{pattern:"/releases/",type:"Release"}]};if(o.exactMatches[r])return o.exactMatches[r];for(let s of o.pathStartsWith)if(r.startsWith(s.pattern))return s.type;return"Other"}function w(e){if(!e.userJourney||e.userJourney.length===0)return!1;let r=new Date(e.userJourney[e.userJourney.length-1].time);return new Date().getTime()-r.getTime()<18e5}return new Promise(e=>{setTimeout(()=>{try{let r=null,o=sessionStorage.getItem(t);if(o){let u=JSON.parse(o);w(u)&&(r=u)}r||(r={userJourney:[],origin:window.location.hostname,deviceCategory:i(),browser:l()});let s=window.location.pathname,a=new Date().toISOString(),m=r.userJourney[r.userJourney.length-1];if(m&&m.page===s)m.time=a;else{let u=r.userJourney.length===0,J=u?void 0:r.userJourney[0].utm,P={touchPoint:r.userJourney.length+1,page:s,title:document.title||"Untitled",type:h(s),category:p(),time:a,utmVisibility:f()?"visible":"hidden",utm:d(u,J)};r.userJourney.push(P)}sessionStorage.setItem(t,JSON.stringify(r)),e(r)}catch(r){console.error("Error tracking user journey:",r),e(null)}},200)})}function g(){try{let t=sessionStorage.getItem("userJourney");return t?JSON.parse(t):null}catch(t){return console.error("Error getting user journey:",t),null}}function b(){sessionStorage.removeItem("userJourney")}function U(t){try{let n=g();if(!n||n.userJourney.length===0)return!1;let i=n.userJourney[n.userJourney.length-1];return i.category=t.length>0?t:["Not applicable"],sessionStorage.setItem("userJourney",JSON.stringify(n)),!0}catch(n){return console.error("Error updating page categories:",n),!1}}function S(t){try{let n=g();if(!n||n.userJourney.length===0)return!1;let i=n.userJourney[n.userJourney.length-1];return i.type=t,sessionStorage.setItem("userJourney",JSON.stringify(n)),!0}catch(n){return console.error("Error updating page type:",n),!1}}function T(){let t=g();if(!t||t.userJourney.length===0)return null;let n=t.userJourney[0],i=t.userJourney[t.userJourney.length-1],l=new Date(i.time).getTime()-new Date(n.time).getTime();return{totalPages:t.userJourney.length,sessionDuration:Math.floor(l/1e3),firstPage:n.page,lastPage:i.page}}document.addEventListener("DOMContentLoaded",()=>{c()});document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{c()}):c();window.trackUserJourney=c;window.getUserJourney=g;window.clearUserJourney=b;window.updatePageType=S;window.updatePageCategories=U;window.getJourneyStats=T;})();
1
+ "use strict";(()=>{async function c(){let t="userJourney";function i(){let e=navigator.userAgent;return/tablet|ipad|playbook|silk/i.test(e)?"tablet":/mobile|iphone|ipod|android|blackberry|opera|mini|windows\sce|palm|smartphone|iemobile/i.test(e)?"mobile":"desktop"}function g(){let e=navigator.userAgent;return e.includes("Chrome")&&!e.includes("Edg")?"Chrome":e.includes("Firefox")?"Firefox":e.includes("Safari")&&!e.includes("Chrome")?"Safari":e.includes("Edg")?"Edge":e.includes("Opera")?"Opera":"Unknown"}function m(e){if(!e)return"Unknown";try{let s=new URL(e).hostname.replace(/^www\./,""),a=s.split(".");return a.length>=2?a[0]:s||"Unknown"}catch{return"Unknown"}}function p(e,r){let o=new URLSearchParams(window.location.search),s=o.has("utm_source")||o.has("utm_medium")||o.has("utm_campaign");return e||s?s?{source:o.get("utm_source")||"",medium:o.get("utm_medium")||"",campaign:o.get("utm_campaign")||""}:{source:m(document.referrer),medium:"organic",campaign:"unknown"}:r||{source:"Unknown",medium:"organic",campaign:"unknown"}}function d(){try{return typeof window.pageCategories<"u"&&Array.isArray(window.pageCategories)&&window.pageCategories.length>0?window.pageCategories:["Not applicable"]}catch(e){return console.warn("Error accessing pageCategories:",e),["Not applicable"]}}function f(){let e=new URLSearchParams(window.location.search);return e.has("utm_source")||e.has("utm_medium")||e.has("utm_campaign")}function h(e){let r=e.split("?")[0].toLowerCase(),o={exactMatches:{"/":"Home","/home":"Home","/blog":"Blog listing","/about-us":"About us","/contact-us":"Contact","/privacy-policy":"Privacy policy","/terms-of-service":"Terms of service","/careers":"Careers","/customer-stories":"Customer stories listing","/events":"Events listing","/infographics":"Infographics listing","/newsroom":"Newsroom","/releases":"Releases listing"},pathStartsWith:[{pattern:"/blog/",type:"Blog"},{pattern:"/customer-stories/",type:"Customer story"},{pattern:"/case-studies/",type:"Case study"},{pattern:"/solutions/",type:"Solution"},{pattern:"/events/",type:"Event"},{pattern:"/news/",type:"News"},{pattern:"/press-releases/",type:"Press release"},{pattern:"/releases/",type:"Release"}]};if(o.exactMatches[r])return o.exactMatches[r];for(let s of o.pathStartsWith)if(r.startsWith(s.pattern))return s.type;return"Other"}function w(e){if(!e.userJourney||e.userJourney.length===0)return!1;let r=new Date(e.userJourney[e.userJourney.length-1].time);return new Date().getTime()-r.getTime()<18e5}return new Promise(e=>{setTimeout(()=>{try{let r=null,o=sessionStorage.getItem(t);if(o){let u=JSON.parse(o);w(u)&&(r=u)}r||(r={userJourney:[],origin:window.location.hostname,deviceCategory:i(),browser:g()});let s=window.location.pathname,a=new Date().toISOString(),y=r.userJourney[r.userJourney.length-1];if(y&&y.page===s)y.time=a;else{let u=r.userJourney.length===0,J=u?void 0:r.userJourney[0].utm,U={touchPoint:r.userJourney.length+1,page:s,title:document.title||"Untitled",type:h(s),category:d(),time:a,utmVisibility:f()?"visible":"hidden",utm:p(u,J)};r.userJourney.push(U)}sessionStorage.setItem(t,JSON.stringify(r)),e(r)}catch(r){console.error("Error tracking user journey:",r),e(null)}},200)})}function l(){try{let t=sessionStorage.getItem("userJourney");return t?JSON.parse(t):null}catch(t){return console.error("Error getting user journey:",t),null}}function P(){sessionStorage.removeItem("userJourney")}function S(t){try{let n=l();if(!n||n.userJourney.length===0)return!1;let i=n.userJourney[n.userJourney.length-1];return i.category=t.length>0?t:["Not applicable"],sessionStorage.setItem("userJourney",JSON.stringify(n)),!0}catch(n){return console.error("Error updating page categories:",n),!1}}function b(t){try{let n=l();if(!n||n.userJourney.length===0)return!1;let i=n.userJourney[n.userJourney.length-1];return i.type=t,sessionStorage.setItem("userJourney",JSON.stringify(n)),!0}catch(n){return console.error("Error updating page type:",n),!1}}function T(){let t=l();if(!t||t.userJourney.length===0)return null;let n=t.userJourney[0],i=t.userJourney[t.userJourney.length-1],g=new Date(i.time).getTime()-new Date(n.time).getTime();return{totalPages:t.userJourney.length,sessionDuration:Math.floor(g/1e3),firstPage:n.page,lastPage:i.page}}document.addEventListener("DOMContentLoaded",()=>{c()});document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{c()}):c();window.trackUserJourney=c;window.getUserJourney=l;window.clearUserJourney=P;window.updatePageType=b;window.updatePageCategories=S;window.getJourneyStats=T;})();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../bin/live-reload.js", "../../src/tracking/user-journey.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", "export { };\n\n// Type definitions\ninterface UTMParameters {\n source: string;\n medium: string;\n campaign: string;\n}\n\ninterface TouchPoint {\n touchPoint: number;\n page: string;\n title: string;\n type: string;\n category: string[];\n time: string;\n utmVisibility: 'visible' | 'hidden';\n utm: UTMParameters;\n}\n\ninterface UserJourney {\n userJourney: TouchPoint[];\n origin: string;\n deviceCategory: 'desktop' | 'mobile' | 'tablet';\n browser: string;\n}\n\ntype DeviceCategory = 'desktop' | 'mobile' | 'tablet';\ntype UTMVisibility = 'visible' | 'hidden';\n\nasync function trackUserJourney(): Promise<UserJourney | null> {\n const STORAGE_KEY: string = 'userJourney';\n const SESSION_TIMEOUT: number = 30 * 60 * 1000; // 30 minutes\n\n // Helper function to get device category\n function getDeviceCategory(): DeviceCategory {\n const userAgent: string = navigator.userAgent;\n if (/tablet|ipad|playbook|silk/i.test(userAgent)) return 'tablet';\n if (/mobile|iphone|ipod|android|blackberry|opera|mini|windows\\sce|palm|smartphone|iemobile/i.test(userAgent)) return 'mobile';\n return 'desktop';\n }\n\n // Helper function to get browser\n function getBrowser(): string {\n const userAgent: string = navigator.userAgent;\n if (userAgent.includes('Chrome') && !userAgent.includes('Edg')) return 'Chrome';\n if (userAgent.includes('Firefox')) return 'Firefox';\n if (userAgent.includes('Safari') && !userAgent.includes('Chrome')) return 'Safari';\n if (userAgent.includes('Edg')) return 'Edge';\n if (userAgent.includes('Opera')) return 'Opera';\n return 'Unknown';\n }\n\n // Helper function to extract domain from referrer\n function extractDomainFromReferrer(referrer: string): string {\n if (!referrer) return 'Unknown';\n\n try {\n const url = new URL(referrer);\n const hostname = url.hostname;\n\n // Remove www. prefix if present\n const domain = hostname.replace(/^www\\./, '');\n\n // Extract the main domain name (remove TLD)\n const domainParts = domain.split('.');\n if (domainParts.length >= 2) {\n return domainParts[0];\n }\n\n return domain || 'Unknown';\n } catch (error) {\n return 'Unknown';\n }\n }\n\n // Helper function to get UTM parameters\n function getUTMParameters(isFirstVisit: boolean, firstVisitUTM?: UTMParameters): UTMParameters {\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n const hasCurrentUTM: boolean = urlParams.has('utm_source') || urlParams.has('utm_medium') || urlParams.has('utm_campaign');\n\n if (isFirstVisit || hasCurrentUTM) {\n // If UTM parameters are present in URL, use them\n if (hasCurrentUTM) {\n return {\n source: urlParams.get('utm_source') || '',\n medium: urlParams.get('utm_medium') || '',\n campaign: urlParams.get('utm_campaign') || ''\n };\n } else {\n // No UTM parameters in URL, use referrer-based defaults\n const referrerDomain = extractDomainFromReferrer(document.referrer);\n return {\n source: referrerDomain,\n medium: 'organic',\n campaign: 'unknown'\n };\n }\n } else {\n // Inherit from first visit\n return firstVisitUTM || {\n source: 'Unknown',\n medium: 'organic',\n campaign: 'unknown'\n };\n }\n }\n\n // Helper function to get page categories from global variable\n function getPageCategories(): string[] {\n try {\n // Check if global pageCategories variable exists and is an array\n if (typeof (window as any).pageCategories !== 'undefined' &&\n Array.isArray((window as any).pageCategories) &&\n (window as any).pageCategories.length > 0) {\n return (window as any).pageCategories;\n }\n\n // Return default if not available or empty\n return ['Not applicable'];\n } catch (error) {\n console.warn('Error accessing pageCategories:', error);\n return ['Not applicable'];\n }\n }\n function hasVisibleUTM(): boolean {\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n return urlParams.has('utm_source') || urlParams.has('utm_medium') || urlParams.has('utm_campaign');\n }\n\n // Helper function to get page type (customize as needed)\n function getPageType(url: string): string {\n const path: string = url.split('?')[0].toLowerCase();\n\n // Type configuration - easy to maintain and extend\n const typeConfig = {\n // Exact path matches (highest priority)\n exactMatches: {\n '/': 'Home',\n '/home': 'Home',\n '/blog': 'Blog listing',\n '/about-us': 'About us',\n '/contact-us': 'Contact',\n '/privacy-policy': 'Privacy policy',\n '/terms-of-service': 'Terms of service',\n '/careers': 'Careers',\n '/customer-stories': 'Customer stories listing',\n '/events': 'Events listing',\n '/infographics': 'Infographics listing',\n '/newsroom': 'Newsroom',\n '/releases': 'Releases listing',\n } as Record<string, string>,\n\n // Path pattern matches\n // These will match if the path starts with the pattern\n pathStartsWith: [\n { pattern: '/blog/', type: 'Blog' },\n { pattern: '/customer-stories/', type: 'Customer story' },\n { pattern: '/case-studies/', type: 'Case study' },\n { pattern: '/solutions/', type: 'Solution' },\n { pattern: '/events/', type: 'Event' },\n { pattern: '/news/', type: 'News' },\n { pattern: '/press-releases/', type: 'Press release' },\n { pattern: '/releases/', type: 'Release' },\n ]\n };\n\n // 1. Check exact matches first\n if (typeConfig.exactMatches[path]) {\n return typeConfig.exactMatches[path];\n }\n\n // 2. Check path starts with patterns\n for (const item of typeConfig.pathStartsWith) {\n if (path.startsWith(item.pattern)) {\n return item.type;\n }\n }\n\n // 3. Default fallback\n return 'Other';\n }\n\n // Check if session is still valid\n function isValidSession(journey: UserJourney): boolean {\n if (!journey.userJourney || journey.userJourney.length === 0) return false;\n\n const lastVisit: Date = new Date(journey.userJourney[journey.userJourney.length - 1].time);\n const now: Date = new Date();\n\n return (now.getTime() - lastVisit.getTime()) < SESSION_TIMEOUT;\n }\n\n // Add 200ms delay before executing the main logic\n return new Promise((resolve) => {\n setTimeout(() => {\n try {\n // Get existing journey from sessionStorage\n let journey: UserJourney | null = null;\n const storedData: string | null = sessionStorage.getItem(STORAGE_KEY);\n\n if (storedData) {\n const parsedData: UserJourney = JSON.parse(storedData);\n\n // Check if session is still valid\n if (isValidSession(parsedData)) {\n journey = parsedData;\n }\n }\n\n // Initialize new journey if none exists or session expired\n if (!journey) {\n journey = {\n userJourney: [],\n origin: window.location.hostname,\n deviceCategory: getDeviceCategory(),\n browser: getBrowser()\n };\n }\n\n // Get current page info\n const currentUrl: string = window.location.pathname;\n const currentTime: string = new Date().toISOString();\n\n // Check if this is the same page as the last visit (avoid duplicates)\n const lastVisit: TouchPoint | undefined = journey.userJourney[journey.userJourney.length - 1];\n if (lastVisit && lastVisit.page === currentUrl) {\n // Same page, just update the time\n lastVisit.time = currentTime;\n } else {\n // New page visit\n const isFirstVisit: boolean = journey.userJourney.length === 0;\n const firstVisitUTM: UTMParameters | undefined = isFirstVisit ? undefined : journey.userJourney[0].utm;\n\n const touchPoint: TouchPoint = {\n touchPoint: journey.userJourney.length + 1,\n page: currentUrl,\n title: document.title || 'Untitled',\n type: getPageType(currentUrl),\n category: getPageCategories(),\n time: currentTime,\n utmVisibility: hasVisibleUTM() ? 'visible' : 'hidden',\n utm: getUTMParameters(isFirstVisit, firstVisitUTM)\n };\n\n journey.userJourney.push(touchPoint);\n }\n\n // Save updated journey to sessionStorage\n sessionStorage.setItem(STORAGE_KEY, JSON.stringify(journey));\n\n // // Optional: Log for debugging\n // console.log('User journey updated:', journey);\n\n resolve(journey);\n\n } catch (error: unknown) {\n console.error('Error tracking user journey:', error);\n resolve(null);\n }\n }, 200); // 200ms delay\n });\n}\n\n// Helper function to get current journey data\nfunction getUserJourney(): UserJourney | null {\n try {\n const storedData: string | null = sessionStorage.getItem('userJourney');\n return storedData ? JSON.parse(storedData) as UserJourney : null;\n } catch (error: unknown) {\n console.error('Error getting user journey:', error);\n return null;\n }\n}\n\n// Helper function to clear journey data\nfunction clearUserJourney(): void {\n sessionStorage.removeItem('userJourney');\n}\n\n// Helper function to update page categories manually\nfunction updatePageCategories(categories: string[]): boolean {\n try {\n const journey: UserJourney | null = getUserJourney();\n if (!journey || journey.userJourney.length === 0) return false;\n\n const lastVisit: TouchPoint = journey.userJourney[journey.userJourney.length - 1];\n lastVisit.category = categories.length > 0 ? categories : ['Not applicable'];\n\n sessionStorage.setItem('userJourney', JSON.stringify(journey));\n return true;\n } catch (error: unknown) {\n console.error('Error updating page categories:', error);\n return false;\n }\n}\nfunction updatePageType(type: string): boolean {\n try {\n const journey: UserJourney | null = getUserJourney();\n if (!journey || journey.userJourney.length === 0) return false;\n\n const lastVisit: TouchPoint = journey.userJourney[journey.userJourney.length - 1];\n lastVisit.type = type;\n\n sessionStorage.setItem('userJourney', JSON.stringify(journey));\n return true;\n } catch (error: unknown) {\n console.error('Error updating page type:', error);\n return false;\n }\n}\n\n// Helper function to get journey statistics\nfunction getJourneyStats(): {\n totalPages: number;\n sessionDuration: number;\n firstPage: string;\n lastPage: string;\n} | null {\n const journey: UserJourney | null = getUserJourney();\n if (!journey || journey.userJourney.length === 0) return null;\n\n const firstVisit: TouchPoint = journey.userJourney[0];\n const lastVisit: TouchPoint = journey.userJourney[journey.userJourney.length - 1];\n\n const sessionDuration: number = new Date(lastVisit.time).getTime() - new Date(firstVisit.time).getTime();\n\n return {\n totalPages: journey.userJourney.length,\n sessionDuration: Math.floor(sessionDuration / 1000), // in seconds\n firstPage: firstVisit.page,\n lastPage: lastVisit.page\n };\n}\n\n// Auto-execute on page load\ndocument.addEventListener('DOMContentLoaded', (): void => {\n trackUserJourney();\n});\n\n// Also execute immediately if DOM is already loaded\nif (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', (): void => {\n trackUserJourney();\n });\n} else {\n trackUserJourney();\n}\n\n// Make functions globally accessible\ndeclare global {\n interface Window {\n trackUserJourney: () => Promise<UserJourney | null>;\n getUserJourney: () => UserJourney | null;\n clearUserJourney: () => void;\n updatePageType: (type: string) => boolean;\n updatePageCategories: (categories: string[]) => boolean;\n getJourneyStats: () => {\n totalPages: number;\n sessionDuration: number;\n firstPage: string;\n lastPage: string;\n } | null;\n }\n}\n\n// Attach functions to window object for global access\nwindow.trackUserJourney = trackUserJourney;\nwindow.getUserJourney = getUserJourney;\nwindow.clearUserJourney = clearUserJourney;\nwindow.updatePageType = updatePageType;\nwindow.updatePageCategories = updatePageCategories;\nwindow.getJourneyStats = getJourneyStats;\n\n// Export functions for module usage (optional)\n// export { trackUserJourney, getUserJourney, clearUserJourney, updatePageType, updatePageCategories, getJourneyStats };"],
5
- "mappings": ";;;AACA,MACE,OAAO,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AAAA,MAChC,iBAAiB,KAAK,MAAM,kBAAkB,GAAI;AAAA;AAAA,MAClD,WAAW,WAAW;AAAA,MACtB,UAAU,UAAU;AAAA,IACxB;AAAA,EACJ;AAGA,WAAS,iBAAiB,oBAAoB,MAAY;AACtD,qBAAiB;AAAA,EACrB,CAAC;AAGD,MAAI,SAAS,eAAe,WAAW;AACnC,aAAS,iBAAiB,oBAAoB,MAAY;AACtD,uBAAiB;AAAA,IACrB,CAAC;AAAA,EACL,OAAO;AACH,qBAAiB;AAAA,EACrB;AAoBA,SAAO,mBAAmB;AAC1B,SAAO,iBAAiB;AACxB,SAAO,mBAAmB;AAC1B,SAAO,iBAAiB;AACxB,SAAO,uBAAuB;AAC9B,SAAO,kBAAkB;",
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", "// userJourney.ts - Main tracking functionality\nimport {\n UTMParameters,\n TouchPoint,\n UserJourney,\n DeviceCategory,\n UTMVisibility,\n JourneyStats\n} from './types';\n\nexport { };\n\nasync function trackUserJourney(): Promise<UserJourney | null> {\n const STORAGE_KEY: string = 'userJourney';\n const SESSION_TIMEOUT: number = 30 * 60 * 1000; // 30 minutes\n\n // Helper function to get device category\n function getDeviceCategory(): DeviceCategory {\n const userAgent: string = navigator.userAgent;\n if (/tablet|ipad|playbook|silk/i.test(userAgent)) return 'tablet';\n if (/mobile|iphone|ipod|android|blackberry|opera|mini|windows\\sce|palm|smartphone|iemobile/i.test(userAgent)) return 'mobile';\n return 'desktop';\n }\n\n // Helper function to get browser\n function getBrowser(): string {\n const userAgent: string = navigator.userAgent;\n if (userAgent.includes('Chrome') && !userAgent.includes('Edg')) return 'Chrome';\n if (userAgent.includes('Firefox')) return 'Firefox';\n if (userAgent.includes('Safari') && !userAgent.includes('Chrome')) return 'Safari';\n if (userAgent.includes('Edg')) return 'Edge';\n if (userAgent.includes('Opera')) return 'Opera';\n return 'Unknown';\n }\n\n // Helper function to extract domain from referrer\n function extractDomainFromReferrer(referrer: string): string {\n if (!referrer) return 'Unknown';\n\n try {\n const url = new URL(referrer);\n const hostname = url.hostname;\n\n // Remove www. prefix if present\n const domain = hostname.replace(/^www\\./, '');\n\n // Extract the main domain name (remove TLD)\n const domainParts = domain.split('.');\n if (domainParts.length >= 2) {\n return domainParts[0];\n }\n\n return domain || 'Unknown';\n } catch (error) {\n return 'Unknown';\n }\n }\n\n // Helper function to get UTM parameters\n function getUTMParameters(isFirstVisit: boolean, firstVisitUTM?: UTMParameters): UTMParameters {\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n const hasCurrentUTM: boolean = urlParams.has('utm_source') || urlParams.has('utm_medium') || urlParams.has('utm_campaign');\n\n if (isFirstVisit || hasCurrentUTM) {\n // If UTM parameters are present in URL, use them\n if (hasCurrentUTM) {\n return {\n source: urlParams.get('utm_source') || '',\n medium: urlParams.get('utm_medium') || '',\n campaign: urlParams.get('utm_campaign') || ''\n };\n } else {\n // No UTM parameters in URL, use referrer-based defaults\n const referrerDomain = extractDomainFromReferrer(document.referrer);\n return {\n source: referrerDomain,\n medium: 'organic',\n campaign: 'unknown'\n };\n }\n } else {\n // Inherit from first visit\n return firstVisitUTM || {\n source: 'Unknown',\n medium: 'organic',\n campaign: 'unknown'\n };\n }\n }\n\n // Helper function to get page categories from global variable\n function getPageCategories(): string[] {\n try {\n // Check if global pageCategories variable exists and is an array\n if (typeof (window as any).pageCategories !== 'undefined' &&\n Array.isArray((window as any).pageCategories) &&\n (window as any).pageCategories.length > 0) {\n return (window as any).pageCategories;\n }\n\n // Return default if not available or empty\n return ['Not applicable'];\n } catch (error) {\n console.warn('Error accessing pageCategories:', error);\n return ['Not applicable'];\n }\n }\n\n function hasVisibleUTM(): boolean {\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n return urlParams.has('utm_source') || urlParams.has('utm_medium') || urlParams.has('utm_campaign');\n }\n\n // Helper function to get page type (customize as needed)\n function getPageType(url: string): string {\n const path: string = url.split('?')[0].toLowerCase();\n\n // Type configuration - easy to maintain and extend\n const typeConfig = {\n // Exact path matches (highest priority)\n exactMatches: {\n '/': 'Home',\n '/home': 'Home',\n '/blog': 'Blog listing',\n '/about-us': 'About us',\n '/contact-us': 'Contact',\n '/privacy-policy': 'Privacy policy',\n '/terms-of-service': 'Terms of service',\n '/careers': 'Careers',\n '/customer-stories': 'Customer stories listing',\n '/events': 'Events listing',\n '/infographics': 'Infographics listing',\n '/newsroom': 'Newsroom',\n '/releases': 'Releases listing',\n } as Record<string, string>,\n\n // Path pattern matches\n // These will match if the path starts with the pattern\n pathStartsWith: [\n { pattern: '/blog/', type: 'Blog' },\n { pattern: '/customer-stories/', type: 'Customer story' },\n { pattern: '/case-studies/', type: 'Case study' },\n { pattern: '/solutions/', type: 'Solution' },\n { pattern: '/events/', type: 'Event' },\n { pattern: '/news/', type: 'News' },\n { pattern: '/press-releases/', type: 'Press release' },\n { pattern: '/releases/', type: 'Release' },\n ]\n };\n\n // 1. Check exact matches first\n if (typeConfig.exactMatches[path]) {\n return typeConfig.exactMatches[path];\n }\n\n // 2. Check path starts with patterns\n for (const item of typeConfig.pathStartsWith) {\n if (path.startsWith(item.pattern)) {\n return item.type;\n }\n }\n\n // 3. Default fallback\n return 'Other';\n }\n\n // Check if session is still valid\n function isValidSession(journey: UserJourney): boolean {\n if (!journey.userJourney || journey.userJourney.length === 0) return false;\n\n const lastVisit: Date = new Date(journey.userJourney[journey.userJourney.length - 1].time);\n const now: Date = new Date();\n\n return (now.getTime() - lastVisit.getTime()) < SESSION_TIMEOUT;\n }\n\n // Add 200ms delay before executing the main logic\n return new Promise((resolve) => {\n setTimeout(() => {\n try {\n // Get existing journey from sessionStorage\n let journey: UserJourney | null = null;\n const storedData: string | null = sessionStorage.getItem(STORAGE_KEY);\n\n if (storedData) {\n const parsedData: UserJourney = JSON.parse(storedData);\n\n // Check if session is still valid\n if (isValidSession(parsedData)) {\n journey = parsedData;\n }\n }\n\n // Initialize new journey if none exists or session expired\n if (!journey) {\n journey = {\n userJourney: [],\n origin: window.location.hostname,\n deviceCategory: getDeviceCategory(),\n browser: getBrowser()\n };\n }\n\n // Get current page info\n const currentUrl: string = window.location.pathname;\n const currentTime: string = new Date().toISOString();\n\n // Check if this is the same page as the last visit (avoid duplicates)\n const lastVisit: TouchPoint | undefined = journey.userJourney[journey.userJourney.length - 1];\n if (lastVisit && lastVisit.page === currentUrl) {\n // Same page, just update the time\n lastVisit.time = currentTime;\n } else {\n // New page visit\n const isFirstVisit: boolean = journey.userJourney.length === 0;\n const firstVisitUTM: UTMParameters | undefined = isFirstVisit ? undefined : journey.userJourney[0].utm;\n\n const touchPoint: TouchPoint = {\n touchPoint: journey.userJourney.length + 1,\n page: currentUrl,\n title: document.title || 'Untitled',\n type: getPageType(currentUrl),\n category: getPageCategories(),\n time: currentTime,\n utmVisibility: hasVisibleUTM() ? 'visible' : 'hidden',\n utm: getUTMParameters(isFirstVisit, firstVisitUTM)\n };\n\n journey.userJourney.push(touchPoint);\n }\n\n // Save updated journey to sessionStorage\n sessionStorage.setItem(STORAGE_KEY, JSON.stringify(journey));\n\n // // Optional: Log for debugging\n // console.log('User journey updated:', journey);\n\n resolve(journey);\n\n } catch (error: unknown) {\n console.error('Error tracking user journey:', error);\n resolve(null);\n }\n }, 200); // 200ms delay\n });\n}\n\n// Helper function to get current journey data\nfunction getUserJourney(): UserJourney | null {\n try {\n const storedData: string | null = sessionStorage.getItem('userJourney');\n return storedData ? JSON.parse(storedData) as UserJourney : null;\n } catch (error: unknown) {\n console.error('Error getting user journey:', error);\n return null;\n }\n}\n\n// Helper function to clear journey data\nfunction clearUserJourney(): void {\n sessionStorage.removeItem('userJourney');\n}\n\n// Helper function to update page categories manually\nfunction updatePageCategories(categories: string[]): boolean {\n try {\n const journey: UserJourney | null = getUserJourney();\n if (!journey || journey.userJourney.length === 0) return false;\n\n const lastVisit: TouchPoint = journey.userJourney[journey.userJourney.length - 1];\n lastVisit.category = categories.length > 0 ? categories : ['Not applicable'];\n\n sessionStorage.setItem('userJourney', JSON.stringify(journey));\n return true;\n } catch (error: unknown) {\n console.error('Error updating page categories:', error);\n return false;\n }\n}\n\nfunction updatePageType(type: string): boolean {\n try {\n const journey: UserJourney | null = getUserJourney();\n if (!journey || journey.userJourney.length === 0) return false;\n\n const lastVisit: TouchPoint = journey.userJourney[journey.userJourney.length - 1];\n lastVisit.type = type;\n\n sessionStorage.setItem('userJourney', JSON.stringify(journey));\n return true;\n } catch (error: unknown) {\n console.error('Error updating page type:', error);\n return false;\n }\n}\n\n// Helper function to get journey statistics\nfunction getJourneyStats(): JourneyStats | null {\n const journey: UserJourney | null = getUserJourney();\n if (!journey || journey.userJourney.length === 0) return null;\n\n const firstVisit: TouchPoint = journey.userJourney[0];\n const lastVisit: TouchPoint = journey.userJourney[journey.userJourney.length - 1];\n\n const sessionDuration: number = new Date(lastVisit.time).getTime() - new Date(firstVisit.time).getTime();\n\n return {\n totalPages: journey.userJourney.length,\n sessionDuration: Math.floor(sessionDuration / 1000), // in seconds\n firstPage: firstVisit.page,\n lastPage: lastVisit.page\n };\n}\n\n// Auto-execute on page load\ndocument.addEventListener('DOMContentLoaded', (): void => {\n trackUserJourney();\n});\n\n// Also execute immediately if DOM is already loaded\nif (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', (): void => {\n trackUserJourney();\n });\n} else {\n trackUserJourney();\n}\n\n// Make functions globally accessible\ndeclare global {\n interface Window {\n trackUserJourney: () => Promise<UserJourney | null>;\n getUserJourney: () => UserJourney | null;\n clearUserJourney: () => void;\n updatePageType: (type: string) => boolean;\n updatePageCategories: (categories: string[]) => boolean;\n getJourneyStats: () => JourneyStats | null;\n }\n}\n\n// Attach functions to window object for global access\nwindow.trackUserJourney = trackUserJourney;\nwindow.getUserJourney = getUserJourney;\nwindow.clearUserJourney = clearUserJourney;\nwindow.updatePageType = updatePageType;\nwindow.updatePageCategories = updatePageCategories;\nwindow.getJourneyStats = getJourneyStats;\n\n// Export functions for module usage (optional)\nexport { trackUserJourney, getUserJourney, clearUserJourney, updatePageType, updatePageCategories, getJourneyStats };"],
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;;;ACEA,iBAAe,mBAAgD;AAC3D,UAAM,cAAsB;AAC5B,UAAM,kBAA0B,KAAK,KAAK;AAG1C,aAAS,oBAAoC;AACzC,YAAM,YAAoB,UAAU;AACpC,UAAI,6BAA6B,KAAK,SAAS,EAAG,QAAO;AACzD,UAAI,yFAAyF,KAAK,SAAS,EAAG,QAAO;AACrH,aAAO;AAAA,IACX;AAGA,aAAS,aAAqB;AAC1B,YAAM,YAAoB,UAAU;AACpC,UAAI,UAAU,SAAS,QAAQ,KAAK,CAAC,UAAU,SAAS,KAAK,EAAG,QAAO;AACvE,UAAI,UAAU,SAAS,SAAS,EAAG,QAAO;AAC1C,UAAI,UAAU,SAAS,QAAQ,KAAK,CAAC,UAAU,SAAS,QAAQ,EAAG,QAAO;AAC1E,UAAI,UAAU,SAAS,KAAK,EAAG,QAAO;AACtC,UAAI,UAAU,SAAS,OAAO,EAAG,QAAO;AACxC,aAAO;AAAA,IACX;AAGA,aAAS,0BAA0B,UAA0B;AACzD,UAAI,CAAC,SAAU,QAAO;AAEtB,UAAI;AACA,cAAM,MAAM,IAAI,IAAI,QAAQ;AAC5B,cAAM,WAAW,IAAI;AAGrB,cAAM,SAAS,SAAS,QAAQ,UAAU,EAAE;AAG5C,cAAM,cAAc,OAAO,MAAM,GAAG;AACpC,YAAI,YAAY,UAAU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Q,YAAY,CAAC;AACpD,UAAM,YAAwB,QAAQ,YAAY,QAAQ,YAAY,SAAS,CAAC;AAEhF,UAAM,kBAA0B,IAAI,KAAK,UAAU,IAAI,EAAE,QAAQ,IAAI,IAAI,KAAK,WAAW,IAAI,EAAE,QAAQ;AAEvG,WAAO;AAAA,MACH,YAAY,QAAQ,YAAY;AAAA,MAChC,iBAAiB,KAAK,MAAM,kBAAkB,GAAI;AAAA;AAAA,MAClD,WAAW,WAAW;AAAA,MACtB,UAAU,UAAU;AAAA,IACxB;AAAA,EACJ;AAGA,WAAS,iBAAiB,oBAAoB,MAAY;AACtD,qBAAiB;AAAA,EACrB,CAAC;AAGD,MAAI,SAAS,eAAe,WAAW;AACnC,aAAS,iBAAiB,oBAAoB,MAAY;AACtD,uBAAiB;AAAA,IACrB,CAAC;AAAA,EACL,OAAO;AACH,qBAAiB;AAAA,EACrB;AAeA,SAAO,mBAAmB;AAC1B,SAAO,iBAAiB;AACxB,SAAO,mBAAmB;AAC1B,SAAO,iBAAiB;AACxB,SAAO,uBAAuB;AAC9B,SAAO,kBAAkB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1 @@
1
+ "use strict";(()=>{var S=Object.create;var v=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var j=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of E(e))!R.call(t,o)&&o!==n&&v(t,o,{get:()=>e[o],enumerable:!(r=C(e,o))||r.enumerable});return t};var k=(t,e,n)=>(n=t!=null?S(A(t)):{},j(e||!t||!t.__esModule?v(n,"default",{value:t,enumerable:!0}):n,t));var m=g(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.getPathSegments=F;function F(){return window.location.pathname.replace(/^\//,"").split("/").filter(e=>e!=="")}});var L=g(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.checkForLocalhostUrls=b;f.enableAutomaticLocalhostCheck=T;function b(t={}){let{checkLinks:e=!0,checkImages:n=!0,checkScripts:r=!0,checkTextContent:o=!0}=t,d=[/localhost/gi,/127\.0\.0\.1/g,/0\.0\.0\.0/g,/\b(?:https?:\/\/)?(?:www\.)?localhost(?::\d+)?(?:\/[^\s]*)?/gi,/\b(?:https?:\/\/)?127\.0\.0\.1(?::\d+)?(?:\/[^\s]*)?/g,/\b(?:https?:\/\/)?0\.0\.0\.0(?::\d+)?(?:\/[^\s]*)?/g],i=[],u=new Set;if(e&&document.querySelectorAll("a[href], link[href]").forEach(a=>{let s=a.getAttribute("href");s&&d.some(l=>l.test(s))&&(u.add(s),i.push(`Found localhost URL in ${a.tagName.toLowerCase()} href: ${s}`))}),n&&document.querySelectorAll("img[src]").forEach(a=>{let s=a.getAttribute("src");s&&d.some(l=>l.test(s))&&(u.add(s),i.push(`Found localhost URL in img src: ${s}`))}),r&&document.querySelectorAll("script[src]").forEach(a=>{let s=a.getAttribute("src");s&&d.some(l=>l.test(s))&&(u.add(s),i.push(`Found localhost URL in script src: ${s}`))}),o){let h=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT,null),a;for(;a=h.nextNode();){let s=a.textContent||"";d.forEach(l=>{let _=s.match(l);_&&_.forEach(w=>{u.add(w),i.push(`Found localhost URL in text content: ${w}`)})})}}if(i.length>0)throw console.group("\u{1F6A8} LOCALHOST URLs DETECTED - PRODUCTION WARNING"),console.warn("\u26A0\uFE0F CRITICAL: Localhost URLs found in production environment!"),console.warn(`\u{1F4CA} Total issues found: ${i.length}`),console.warn(`\u{1F517} Unique URLs: ${u.size}`),console.log(""),i.forEach((h,a)=>{console.warn(`${a+1}. ${h}`)}),console.log(""),console.warn("\u{1F527} Please replace all localhost URLs with production URLs before deployment."),console.warn("\u{1F4DA} This can cause broken links, missing resources, and poor user experience."),console.groupEnd(),new Error(`Production build contains ${u.size} localhost URLs. Please fix before deployment.`);console.log("\u2705 No localhost URLs detected in the document.")}function T(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>b()):b()}});var y=g(c=>{"use strict";var N=c&&c.__createBinding||(Object.create?function(t,e,n,r){r===void 0&&(r=n);var o=Object.getOwnPropertyDescriptor(e,n);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,o)}:function(t,e,n,r){r===void 0&&(r=n),t[r]=e[n]}),$=c&&c.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),O=c&&c.__importStar||function(){var t=function(e){return t=Object.getOwnPropertyNames||function(n){var r=[];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[r.length]=o);return r},t(e)};return function(e){if(e&&e.__esModule)return e;var n={};if(e!=null)for(var r=t(e),o=0;o<r.length;o++)r[o]!=="default"&&N(n,e,r[o]);return $(n,e),n}}();Object.defineProperty(c,"__esModule",{value:!0});c.navigation=c.validations=c.enableAutomaticLocalhostCheck=c.checkForLocalhostUrls=c.getPathSegments=void 0;var q=m();Object.defineProperty(c,"getPathSegments",{enumerable:!0,get:function(){return q.getPathSegments}});var P=L();Object.defineProperty(c,"checkForLocalhostUrls",{enumerable:!0,get:function(){return P.checkForLocalhostUrls}});Object.defineProperty(c,"enableAutomaticLocalhostCheck",{enumerable:!0,get:function(){return P.enableAutomaticLocalhostCheck}});c.validations=O(L());c.navigation=O(m())});var U=k(y(),1);(0,U.checkForLocalhostUrls)();})();
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../bin/live-reload.js", "../../node_modules/.pnpm/@fynd-design-engineering+web-utils@1.0.1/node_modules/@fynd-design-engineering/web-utils/src/window/get-path-segments.ts", "../../node_modules/.pnpm/@fynd-design-engineering+web-utils@1.0.1/node_modules/@fynd-design-engineering/web-utils/src/validations/localhost.ts", "../../node_modules/.pnpm/@fynd-design-engineering+web-utils@1.0.1/node_modules/@fynd-design-engineering/web-utils/src/index.ts", "../../src/validations/localhost.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", null, null, null, "import { checkForLocalhostUrls } from \"@fynd-design-engineering/web-utils\";\n\ncheckForLocalhostUrls();"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AACA,UACE,OAAO,SAAS,aAAa,eAC7B,OAAO,SAAS,aAAa,aAC7B;AACA,YAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,UAAiB;AAAA,UAAU,MACpE,SAAS,OAAO;AAAA,QAClB;AAAA,MACF,OAAO;AACL,gBAAQ,IAAI,gDAAgD;AAAA,MAC9D;AAAA;AAAA;;;;;;;;ACDA,cAAA,kBAAA;AAAA,eAAgB,kBAAe;AAC3B,cAAM,eAAe,OAAO,SAAS,SAAS,QAAQ,OAAO,EAAE,EAAE,MAAM,GAAG;AAC1E,eAAO,aAAa,OAAO,aAAW,YAAY,EAAE;MACxD;;;;;;;;;;ACHA,cAAA,wBAAAA;AAkHA,cAAA,gCAAA;AAlHA,eAAgBA,uBAAsB,UAKlC,CAAA,GAAE;AACF,cAAM,EACF,aAAa,MACb,cAAc,MACd,eAAe,MACf,mBAAmB,KAAI,IACvB;AAEJ,cAAM,oBAAoB;UACtB;UACA;UACA;UACA;UACA;UACA;;AAGJ,cAAM,WAAqB,CAAA;AAC3B,cAAM,YAAY,oBAAI,IAAG;AAGzB,YAAI,YAAY;AACZ,gBAAM,QAAQ,SAAS,iBAAiB,qBAAqB;AAC7D,gBAAM,QAAQ,CAAC,YAAW;AACtB,kBAAM,OAAO,QAAQ,aAAa,MAAM;AACxC,gBAAI,QAAQ,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.1",
3
+ "version": "2.0.3",
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",
@@ -31,6 +31,7 @@
31
31
  "esbuild": "^0.25.5"
32
32
  },
33
33
  "dependencies": {
34
+ "@fynd-design-engineering/web-utils": "^1.0.1",
34
35
  "gsap": "^3.13.0",
35
36
  "swiper": "^11.2.8",
36
37
  "typescript": "^5.8.3"