@fynd-design-engineering/fynd-one-v2 3.4.63 → 3.4.64
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.
- package/dist/accordians/dropdown.js +1 -95
- package/dist/accordians/index.js +1 -391
- package/dist/cms-listing/index.js +1 -24
- package/dist/filters/clear-search.js +1 -32
- package/dist/filters/konnect.js +1 -165
- package/dist/filters/show-count.js +1 -66
- package/dist/form/country-dropdown.css +1 -160
- package/dist/form/cs-gated-redirection.js +1 -40
- package/dist/form/download-file.js +1 -70
- package/dist/form/validation.css +1 -1019
- package/dist/form/validation.js +7 -10611
- package/dist/global/anchor-scroll.js +1 -174
- package/dist/global/auth.js +1 -87
- package/dist/global/chat.js +1 -185
- package/dist/global/console-links.js +1 -89
- package/dist/global/contact-popup.js +2 -83
- package/dist/global/css/in-page-embed.css +1 -1043
- package/dist/global/css/in-project-settings.css +1 -173
- package/dist/global/css/temp.css +1 -89
- package/dist/global/custom-bg-video.js +1 -40
- package/dist/global/footer-accordion.js +1 -44
- package/dist/global/lazy-loader.js +1 -135
- package/dist/global/loader.js +2 -166
- package/dist/global/media-card.js +1 -166
- package/dist/global/miscellaneous.js +1 -136
- package/dist/global/number-count.js +1 -82
- package/dist/global/popup-video.js +1 -276
- package/dist/global/progressive-scroll.js +1 -222
- package/dist/global/responsive-video.js +1 -321
- package/dist/global/style.css +1 -1065
- package/dist/global/video-card.js +1 -50
- package/dist/hacktimus/2025.js +1 -177
- package/dist/hacktimus/styles.css +1 -91
- package/dist/home/index.js +1 -17
- package/dist/marquee/index.js +1 -3104
- package/dist/marquee/marquee-swiper.js +1 -36
- package/dist/navigation/announcement/index.js +1 -5169
- package/dist/navigation/context-menu/index.js +1 -31
- package/dist/navigation/desktop/index.js +1 -4603
- package/dist/navigation/initialization.js +1 -602
- package/dist/navigation/main.js +1 -4911
- package/dist/navigation/mobile/index.js +1 -286
- package/dist/navigation/scroll/index.js +1 -62
- package/dist/navigation/secondary-navigation/index.js +1 -437
- package/dist/navigation/style.css +1 -154
- package/dist/navigation/temp.css +0 -2
- package/dist/navigation/theme.css +1 -69
- package/dist/navigation-v2/index.js +1 -4990
- package/dist/navigation-v2/styles.css +1 -233
- package/dist/others/feature-detail.js +1 -75
- package/dist/others/geolocation.js +1 -50
- package/dist/others/hero-aniamtion.js +1 -53
- package/dist/others/hero-india-animation-2.js +1 -70
- package/dist/others/hero-india-animation.js +1 -93
- package/dist/others/home-solution-tab.js +1 -115
- package/dist/others/storefront-chat/index.js +1 -487
- package/dist/others/storefront-chat/styles.css +1 -107
- package/dist/playbook-2026/hero-reveal.js +1 -47
- package/dist/playbook-2026/index.js +1 -536
- package/dist/playbook-2026/styles.css +1 -110
- package/dist/posthog-and-ga/attributes.js +1 -190
- package/dist/posthog-and-ga/main.js +1 -528
- package/dist/progressive-scroll/index.js +1 -147
- package/dist/quick-fix/reload.js +1 -22
- package/dist/seo/schema.js +1 -465
- package/dist/slider/freescroll.js +1 -34
- package/dist/test/sample.js +1 -15
- package/dist/testimonials/index.js +1 -2654
- package/dist/timeline/index.js +1 -160
- package/dist/timeline/style.css +1 -42
- package/dist/tracking/custom-id.js +1 -75
- package/dist/tracking/fill-form-fields.js +1 -238
- package/dist/tracking/form-tracker.js +1 -146
- package/dist/tracking/page-categories.js +1 -20
- package/dist/tracking/user-journey.js +1 -839
- package/dist/tracking/utm-links.js +1 -194
- package/dist/utils/sample.js +1 -17
- package/dist/validations/localhost.js +1 -221
- package/package.json +1 -1
package/dist/timeline/index.js
CHANGED
|
@@ -1,160 +1 @@
|
|
|
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/timeline/index.ts
|
|
13
|
-
var animationSpeed = 150;
|
|
14
|
-
var blockDelay = 0;
|
|
15
|
-
var fullCircleDelay = 1e3;
|
|
16
|
-
var resetDelay = 1e3;
|
|
17
|
-
var timelineGroups = /* @__PURE__ */ new Map();
|
|
18
|
-
function createDots() {
|
|
19
|
-
timelineGroups.clear();
|
|
20
|
-
const groupElements = Array.from(document.querySelectorAll("[fynd-timeline]"));
|
|
21
|
-
const dotCount = window.innerWidth <= 991 ? 14 : 32;
|
|
22
|
-
if (groupElements.length === 0) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
groupElements.forEach((groupElement) => {
|
|
26
|
-
const groupId = groupElement.getAttribute("fynd-timeline");
|
|
27
|
-
if (!groupId) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const blockElements = Array.from(groupElement.querySelectorAll('[fynd-timeline-element="block"]'));
|
|
31
|
-
if (blockElements.length === 0) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const blocks = [];
|
|
35
|
-
blockElements.forEach((blockElement, index) => {
|
|
36
|
-
const circleElement = blockElement.querySelector('[fynd-timeline-element="circle"]');
|
|
37
|
-
const dotWrapper = blockElement.querySelector('[fynd-timeline-element="dot-wrapper"]');
|
|
38
|
-
if (!circleElement || !dotWrapper) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
dotWrapper.innerHTML = "";
|
|
42
|
-
const isLastBlock = index === blockElements.length - 1;
|
|
43
|
-
if (!isLastBlock) {
|
|
44
|
-
for (let i = 0; i < dotCount; i++) {
|
|
45
|
-
const dot = document.createElement("div");
|
|
46
|
-
dot.setAttribute("fynd-timeline-element", "dot");
|
|
47
|
-
dot.dataset.index = i.toString();
|
|
48
|
-
dotWrapper.appendChild(dot);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
blocks.push({
|
|
52
|
-
blockElement,
|
|
53
|
-
circleElement,
|
|
54
|
-
dotWrapper,
|
|
55
|
-
blockIndex: index
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
if (blocks.length > 0) {
|
|
59
|
-
timelineGroups.set(groupId, {
|
|
60
|
-
parentElement: groupElement,
|
|
61
|
-
blocks,
|
|
62
|
-
currentBlockIndex: 0,
|
|
63
|
-
groupTimeout: null,
|
|
64
|
-
containerTimeout: null
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function animateBlockElements(block, isLastBlock, onComplete) {
|
|
70
|
-
block.circleElement.setAttribute("fynd-timeline-element", "circle-filled");
|
|
71
|
-
if (isLastBlock) {
|
|
72
|
-
setTimeout(onComplete, animationSpeed);
|
|
73
|
-
} else {
|
|
74
|
-
setTimeout(() => {
|
|
75
|
-
animateContainerDots(block.dotWrapper, onComplete);
|
|
76
|
-
}, animationSpeed);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function animateContainerDots(container, onComplete) {
|
|
80
|
-
const dots = container.querySelectorAll('[fynd-timeline-element="dot"], [fynd-timeline-element="dot-filled"]');
|
|
81
|
-
let currentIndex = 0;
|
|
82
|
-
if (dots.length === 0) {
|
|
83
|
-
setTimeout(onComplete, 500);
|
|
84
|
-
return 0;
|
|
85
|
-
}
|
|
86
|
-
dots.forEach((dot) => dot.setAttribute("fynd-timeline-element", "dot"));
|
|
87
|
-
function fillNext() {
|
|
88
|
-
if (currentIndex < dots.length) {
|
|
89
|
-
dots[currentIndex].setAttribute("fynd-timeline-element", "dot-filled");
|
|
90
|
-
currentIndex++;
|
|
91
|
-
setTimeout(fillNext, animationSpeed);
|
|
92
|
-
} else {
|
|
93
|
-
setTimeout(onComplete, 500);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return setTimeout(fillNext, 0);
|
|
97
|
-
}
|
|
98
|
-
function resetGroupElements(groupId) {
|
|
99
|
-
const group = timelineGroups.get(groupId);
|
|
100
|
-
if (!group) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
group.blocks.forEach((block) => {
|
|
104
|
-
block.circleElement.setAttribute("fynd-timeline-element", "circle");
|
|
105
|
-
const dots = block.dotWrapper.querySelectorAll('[fynd-timeline-element="dot"], [fynd-timeline-element="dot-filled"]');
|
|
106
|
-
dots.forEach((dot) => dot.setAttribute("fynd-timeline-element", "dot"));
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
function animateGroup(groupId) {
|
|
110
|
-
const group = timelineGroups.get(groupId);
|
|
111
|
-
if (!group) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
stopGroupAnimation(groupId);
|
|
115
|
-
function animateNextBlock() {
|
|
116
|
-
if (!group) return;
|
|
117
|
-
if (group.currentBlockIndex >= group.blocks.length) {
|
|
118
|
-
group.groupTimeout = setTimeout(() => {
|
|
119
|
-
resetGroupElements(groupId);
|
|
120
|
-
group.currentBlockIndex = 0;
|
|
121
|
-
group.groupTimeout = setTimeout(animateNextBlock, fullCircleDelay);
|
|
122
|
-
}, resetDelay);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const currentBlock = group.blocks[group.currentBlockIndex];
|
|
126
|
-
const isLastBlock = group.currentBlockIndex === group.blocks.length - 1;
|
|
127
|
-
animateBlockElements(currentBlock, isLastBlock, () => {
|
|
128
|
-
group.currentBlockIndex++;
|
|
129
|
-
group.groupTimeout = setTimeout(animateNextBlock, blockDelay);
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
animateNextBlock();
|
|
133
|
-
}
|
|
134
|
-
function stopGroupAnimation(groupId) {
|
|
135
|
-
const group = timelineGroups.get(groupId);
|
|
136
|
-
if (!group) return;
|
|
137
|
-
if (group.groupTimeout) {
|
|
138
|
-
clearTimeout(group.groupTimeout);
|
|
139
|
-
group.groupTimeout = null;
|
|
140
|
-
}
|
|
141
|
-
if (group.containerTimeout) {
|
|
142
|
-
clearTimeout(group.containerTimeout);
|
|
143
|
-
group.containerTimeout = null;
|
|
144
|
-
}
|
|
145
|
-
group.currentBlockIndex = 0;
|
|
146
|
-
}
|
|
147
|
-
function animateAllGroups() {
|
|
148
|
-
if (timelineGroups.size === 0) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
timelineGroups.forEach((group, groupId) => {
|
|
152
|
-
animateGroup(groupId);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
156
|
-
createDots();
|
|
157
|
-
setTimeout(animateAllGroups, 100);
|
|
158
|
-
});
|
|
159
|
-
})();
|
|
160
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";(()=>{var s=150,T=0,b=1e3,p=1e3,l=new Map;function g(){l.clear();let n=Array.from(document.querySelectorAll("[fynd-timeline]")),e=window.innerWidth<=991?14:32;n.length!==0&&n.forEach(t=>{let o=t.getAttribute("fynd-timeline");if(!o)return;let i=Array.from(t.querySelectorAll('[fynd-timeline-element="block"]'));if(i.length===0)return;let r=[];i.forEach((m,f)=>{let a=m.querySelector('[fynd-timeline-element="circle"]'),u=m.querySelector('[fynd-timeline-element="dot-wrapper"]');if(!a||!u)return;if(u.innerHTML="",!(f===i.length-1))for(let c=0;c<e;c++){let d=document.createElement("div");d.setAttribute("fynd-timeline-element","dot"),d.dataset.index=c.toString(),u.appendChild(d)}r.push({blockElement:m,circleElement:a,dotWrapper:u,blockIndex:f})}),r.length>0&&l.set(o,{parentElement:t,blocks:r,currentBlockIndex:0,groupTimeout:null,containerTimeout:null})})}function E(n,e,t){n.circleElement.setAttribute("fynd-timeline-element","circle-filled"),setTimeout(e?t:()=>{k(n.dotWrapper,t)},s)}function k(n,e){let t=n.querySelectorAll('[fynd-timeline-element="dot"], [fynd-timeline-element="dot-filled"]'),o=0;if(t.length===0)return setTimeout(e,500),0;t.forEach(r=>r.setAttribute("fynd-timeline-element","dot"));function i(){o<t.length?(t[o].setAttribute("fynd-timeline-element","dot-filled"),o++,setTimeout(i,s)):setTimeout(e,500)}return setTimeout(i,0)}function v(n){let e=l.get(n);e&&e.blocks.forEach(t=>{t.circleElement.setAttribute("fynd-timeline-element","circle"),t.dotWrapper.querySelectorAll('[fynd-timeline-element="dot"], [fynd-timeline-element="dot-filled"]').forEach(i=>i.setAttribute("fynd-timeline-element","dot"))})}function y(n){let e=l.get(n);if(!e)return;L(n);function t(){if(!e)return;if(e.currentBlockIndex>=e.blocks.length){e.groupTimeout=setTimeout(()=>{v(n),e.currentBlockIndex=0,e.groupTimeout=setTimeout(t,b)},p);return}let o=e.blocks[e.currentBlockIndex],i=e.currentBlockIndex===e.blocks.length-1;E(o,i,()=>{e.currentBlockIndex++,e.groupTimeout=setTimeout(t,T)})}t()}function L(n){let e=l.get(n);e&&(e.groupTimeout&&(clearTimeout(e.groupTimeout),e.groupTimeout=null),e.containerTimeout&&(clearTimeout(e.containerTimeout),e.containerTimeout=null),e.currentBlockIndex=0)}function M(){l.size!==0&&l.forEach((n,e)=>{y(e)})}document.addEventListener("DOMContentLoaded",()=>{g(),setTimeout(M,100)});})();
|
package/dist/timeline/style.css
CHANGED
|
@@ -1,42 +1 @@
|
|
|
1
|
-
|
|
2
|
-
[fynd-timeline-element=dot-wrapper] {
|
|
3
|
-
display: flex;
|
|
4
|
-
gap: 2px;
|
|
5
|
-
align-items: center;
|
|
6
|
-
}
|
|
7
|
-
@media (max-width: 991px) {
|
|
8
|
-
[fynd-timeline-element=dot-wrapper] {
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
}
|
|
11
|
-
[fynd-timeline-element=dot],
|
|
12
|
-
[fynd-timeline-element=dot-filled] {
|
|
13
|
-
width: 2px !important;
|
|
14
|
-
height: 4px;
|
|
15
|
-
}
|
|
16
|
-
[fynd-timeline-element=circle] {
|
|
17
|
-
box-shadow: inset 0 0 0 6px #A0A1A2;
|
|
18
|
-
}
|
|
19
|
-
[fynd-timeline-element=circle-filled] {
|
|
20
|
-
box-shadow: inset 0 0 0 8px #0E0E0E !important;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
[fynd-timeline-element=dot],
|
|
24
|
-
[fynd-timeline-element=dot-filled] {
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 2px;
|
|
27
|
-
border-radius: 10px;
|
|
28
|
-
background: #A0A1A2;
|
|
29
|
-
transition: background-color 0.3s ease;
|
|
30
|
-
}
|
|
31
|
-
[fynd-timeline-element=dot-filled] {
|
|
32
|
-
background: #0E0E0E;
|
|
33
|
-
}
|
|
34
|
-
[fynd-timeline-element=circle] {
|
|
35
|
-
transform: scale(.7);
|
|
36
|
-
box-shadow: inset 0 0 0 20px #A0A1A2;
|
|
37
|
-
}
|
|
38
|
-
[fynd-timeline-element=circle-filled] {
|
|
39
|
-
transform: scale(1);
|
|
40
|
-
box-shadow: inset 0 0 0 10px #0E0E0E;
|
|
41
|
-
}
|
|
42
|
-
/*# sourceMappingURL=style.css.map */
|
|
1
|
+
[fynd-timeline-element=dot-wrapper]{display:flex;gap:2px;align-items:center}@media (max-width: 991px){[fynd-timeline-element=dot-wrapper]{flex-direction:column}[fynd-timeline-element=dot],[fynd-timeline-element=dot-filled]{width:2px!important;height:4px}[fynd-timeline-element=circle]{box-shadow:inset 0 0 0 6px #a0a1a2}[fynd-timeline-element=circle-filled]{box-shadow:inset 0 0 0 8px #0e0e0e!important}}[fynd-timeline-element=dot],[fynd-timeline-element=dot-filled]{width:100%;height:2px;border-radius:10px;background:#a0a1a2;transition:background-color .3s ease}[fynd-timeline-element=dot-filled]{background:#0e0e0e}[fynd-timeline-element=circle]{transform:scale(.7);box-shadow:inset 0 0 0 20px #a0a1a2}[fynd-timeline-element=circle-filled]{transform:scale(1);box-shadow:inset 0 0 0 10px #0e0e0e}
|
|
@@ -1,75 +1 @@
|
|
|
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/tracking/custom-id.ts
|
|
13
|
-
var COOKIE_RID = "user-id";
|
|
14
|
-
function setCookie(name, value, days = 365) {
|
|
15
|
-
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
|
16
|
-
const secure = location.protocol === "https:" ? "; Secure" : "";
|
|
17
|
-
document.cookie = `${name}=${encodeURIComponent(
|
|
18
|
-
value
|
|
19
|
-
)}; Expires=${expires}; Path=/; SameSite=Lax${secure}`;
|
|
20
|
-
}
|
|
21
|
-
function getCookie(name) {
|
|
22
|
-
const match = document.cookie.match(
|
|
23
|
-
new RegExp("(^| )" + name + "=([^;]+)")
|
|
24
|
-
);
|
|
25
|
-
return match ? decodeURIComponent(match[2]) : null;
|
|
26
|
-
}
|
|
27
|
-
function getOrCreateStableRid() {
|
|
28
|
-
let rid = getCookie(COOKIE_RID);
|
|
29
|
-
if (rid) return rid;
|
|
30
|
-
if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
|
|
31
|
-
rid = crypto.randomUUID();
|
|
32
|
-
} else {
|
|
33
|
-
rid = `rid_${Date.now()}_${Math.random().toString(36).slice(2, 10)}`;
|
|
34
|
-
}
|
|
35
|
-
setCookie(COOKIE_RID, rid, 365 * 5);
|
|
36
|
-
console.log("Created new RID:", rid);
|
|
37
|
-
return rid;
|
|
38
|
-
}
|
|
39
|
-
window.getRid = function() {
|
|
40
|
-
return getOrCreateStableRid();
|
|
41
|
-
};
|
|
42
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
43
|
-
const rid = getOrCreateStableRid();
|
|
44
|
-
const posthog = window.posthog;
|
|
45
|
-
const phDistinctId = posthog && typeof posthog.get_distinct_id === "function" ? posthog.get_distinct_id() : null;
|
|
46
|
-
const phSessionId = posthog && typeof posthog.get_session_id === "function" ? posthog.get_session_id() : null;
|
|
47
|
-
const links = document.querySelectorAll(
|
|
48
|
-
'a[href*="console.fynd.com"], a[href^="https://console.fynd.com/"], a[href="https://console.fynd.com"]'
|
|
49
|
-
);
|
|
50
|
-
links.forEach((link) => {
|
|
51
|
-
try {
|
|
52
|
-
const url = new URL(link.href);
|
|
53
|
-
if (url.hostname.includes("console.fynd.com")) {
|
|
54
|
-
url.searchParams.set("referrer_uuid", rid);
|
|
55
|
-
if (phDistinctId) {
|
|
56
|
-
url.searchParams.set("ph_distinct_id", phDistinctId);
|
|
57
|
-
}
|
|
58
|
-
if (phSessionId) {
|
|
59
|
-
url.searchParams.set("ph_session_id", phSessionId);
|
|
60
|
-
}
|
|
61
|
-
link.href = url.toString();
|
|
62
|
-
}
|
|
63
|
-
} catch (err) {
|
|
64
|
-
console.warn("Invalid URL in link:", link.href);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
const uuidFields = document.querySelectorAll("[fynd-form-field='uuid']");
|
|
68
|
-
uuidFields.forEach((el) => {
|
|
69
|
-
if (el instanceof HTMLInputElement) {
|
|
70
|
-
el.value = rid;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
})();
|
|
75
|
-
//# sourceMappingURL=custom-id.js.map
|
|
1
|
+
"use strict";(()=>{var c="user-id";function a(e,n,i=365){let s=new Date(Date.now()+i*864e5).toUTCString(),r=location.protocol==="https:"?"; Secure":"";document.cookie=`${e}=${encodeURIComponent(n)}; Expires=${s}; Path=/; SameSite=Lax${r}`}function u(e){let n=document.cookie.match(new RegExp("(^| )"+e+"=([^;]+)"));return n?decodeURIComponent(n[2]):null}function d(){let e=u(c);return e||(typeof crypto<"u"&&"randomUUID"in crypto?e=crypto.randomUUID():e=`rid_${Date.now()}_${Math.random().toString(36).slice(2,10)}`,a(c,e,365*5),console.log("Created new RID:",e),e)}window.getRid=function(){return d()};document.addEventListener("DOMContentLoaded",()=>{let e=d(),n=window.posthog,i=n&&typeof n.get_distinct_id=="function"?n.get_distinct_id():null,s=n&&typeof n.get_session_id=="function"?n.get_session_id():null;document.querySelectorAll('a[href*="console.fynd.com"], a[href^="https://console.fynd.com/"], a[href="https://console.fynd.com"]').forEach(t=>{try{let o=new URL(t.href);o.hostname.includes("console.fynd.com")&&(o.searchParams.set("referrer_uuid",e),i&&o.searchParams.set("ph_distinct_id",i),s&&o.searchParams.set("ph_session_id",s),t.href=o.toString())}catch{console.warn("Invalid URL in link:",t.href)}}),document.querySelectorAll("[fynd-form-field='uuid']").forEach(t=>{t instanceof HTMLInputElement&&(t.value=e)})});})();
|
|
@@ -1,238 +1 @@
|
|
|
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/tracking/fill-form-fields.ts
|
|
13
|
-
var productInterestConfigs = [
|
|
14
|
-
{
|
|
15
|
-
"optionName": "Building a website",
|
|
16
|
-
"selectValues": ["Storefront", "Commerce"]
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"optionName": "Supply chain solutions",
|
|
20
|
-
"selectValues": ["WMS", "OMS", "TMS", "Commerce"]
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"optionName": "Retail store solutions",
|
|
24
|
-
"selectValues": ["StoreOS", "Commerce"]
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"optionName": "Sell on Marketplaces",
|
|
28
|
-
"selectValues": ["OMS", "Commerce"]
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"optionName": "AI solutions",
|
|
32
|
-
"selectValues": ["Kaily", "Boltic", "Pixelbin"]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"optionName": "Fashion manufacturing solution",
|
|
36
|
-
"selectValues": ["Create Sourcing", "Create Design", "Snap"]
|
|
37
|
-
}
|
|
38
|
-
];
|
|
39
|
-
var solutionMappingConfigs = [
|
|
40
|
-
{
|
|
41
|
-
slug: "/solutions/transport-management-system",
|
|
42
|
-
selectValues: ["TMS", "Commerce"]
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
slug: "/solutions/storefront",
|
|
46
|
-
selectValues: ["Storefront", "Commerce"]
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
slug: "/solutions/wms",
|
|
50
|
-
selectValues: ["WMS", "Commerce"]
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
slug: "/solutions/order-management-system",
|
|
54
|
-
selectValues: ["OMS", "Commerce"]
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
slug: "/solutions/order-management-system",
|
|
58
|
-
selectValues: ["OMS", "Commerce"]
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
slug: "/solutions/konnect-integrations",
|
|
62
|
-
selectValues: ["OMS", "Commerce"]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
slug: "/solutions/returns-management-system",
|
|
66
|
-
selectValues: ["StoreOS"]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
slug: "/solutions/ai-photoshoots",
|
|
70
|
-
selectValues: ["Snap"]
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
slug: "/solutions/ai-agent-builder",
|
|
74
|
-
selectValues: ["Kaily"]
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
slug: "/solutions/workflow-automation",
|
|
78
|
-
selectValues: ["Boltic"]
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
slug: "/solutions/ai-editing-for-commerce",
|
|
82
|
-
selectValues: ["Pixelbin"]
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
slug: "/solutions/create",
|
|
86
|
-
selectValues: ["Create Design", "Create Sourcing", "Snap"]
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
slug: "/solutions/3d-ar-vr-try-ons",
|
|
90
|
-
selectValues: ["GlamAR"]
|
|
91
|
-
}
|
|
92
|
-
];
|
|
93
|
-
function fillFormWithUserJourney() {
|
|
94
|
-
try {
|
|
95
|
-
const journey = getUserJourneyData();
|
|
96
|
-
const sourceValue = "Inbound Form";
|
|
97
|
-
const sourceDirectionValue = "Inbound";
|
|
98
|
-
const contactTypeValue = "Prospect";
|
|
99
|
-
if (!journey || journey.userJourney.length === 0) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const firstPage = journey.userJourney[0];
|
|
103
|
-
let lastPage = journey.userJourney[journey.userJourney.length - 1];
|
|
104
|
-
if (journey.userJourney.length > 1 && journey.userJourney[journey.userJourney.length - 1].page === "/contact-us") {
|
|
105
|
-
lastPage = journey.userJourney[journey.userJourney.length - 2];
|
|
106
|
-
}
|
|
107
|
-
const fieldMappings = {
|
|
108
|
-
// UTM parameters
|
|
109
|
-
"utm_source": firstPage.utm.source,
|
|
110
|
-
"utm_medium": firstPage.utm.medium,
|
|
111
|
-
"utm_campaign": firstPage.utm.campaign,
|
|
112
|
-
//hubspot essential fields
|
|
113
|
-
"source": sourceValue,
|
|
114
|
-
"source_direction": sourceDirectionValue,
|
|
115
|
-
"contact_type": contactTypeValue,
|
|
116
|
-
// Journey metadata
|
|
117
|
-
"userjourney": JSON.stringify(journey.userJourney),
|
|
118
|
-
"device": journey.deviceCategory,
|
|
119
|
-
"browser": journey.browser,
|
|
120
|
-
// Refferer and host
|
|
121
|
-
"refferer_domain": document.referrer ? new URL(document.referrer).hostname : "",
|
|
122
|
-
"host_url": window.location.hostname,
|
|
123
|
-
//current page URL
|
|
124
|
-
"current-page-url": window.location.href
|
|
125
|
-
};
|
|
126
|
-
Object.entries(fieldMappings).forEach(([attributeValue, data]) => {
|
|
127
|
-
fillFormField(attributeValue, data);
|
|
128
|
-
});
|
|
129
|
-
} catch (error) {
|
|
130
|
-
console.error("Error filling form with user journey data:", error);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
function getUserJourneyData() {
|
|
134
|
-
try {
|
|
135
|
-
const storedData = localStorage.getItem("userJourney");
|
|
136
|
-
return storedData ? JSON.parse(storedData) : null;
|
|
137
|
-
} catch (error) {
|
|
138
|
-
console.error("Error getting user journey data:", error);
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function fillFormField(attributeValue, data) {
|
|
143
|
-
try {
|
|
144
|
-
const selector = `[fynd-queryparam-name="${attributeValue}"]`;
|
|
145
|
-
const elements = document.querySelectorAll(selector);
|
|
146
|
-
if (elements.length > 0) {
|
|
147
|
-
elements.forEach((element) => {
|
|
148
|
-
element.value = data;
|
|
149
|
-
const inputEvent = new Event("input", { bubbles: true });
|
|
150
|
-
element.dispatchEvent(inputEvent);
|
|
151
|
-
const changeEvent = new Event("change", { bubbles: true });
|
|
152
|
-
element.dispatchEvent(changeEvent);
|
|
153
|
-
});
|
|
154
|
-
} else {
|
|
155
|
-
}
|
|
156
|
-
} catch (error) {
|
|
157
|
-
console.error(`Error filling field [${attributeValue}]:`, error);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function formatSelectValues(values) {
|
|
161
|
-
if (!Array.isArray(values)) return "";
|
|
162
|
-
return values.join("; ");
|
|
163
|
-
}
|
|
164
|
-
function shouldRunProductInterestLogic() {
|
|
165
|
-
const path = window.location.pathname;
|
|
166
|
-
return !path.startsWith("/solutions/");
|
|
167
|
-
}
|
|
168
|
-
function applySolutionMapping() {
|
|
169
|
-
const path = window.location.pathname;
|
|
170
|
-
const match = solutionMappingConfigs.find((cfg) => cfg.slug === path);
|
|
171
|
-
if (!match) return;
|
|
172
|
-
const formatted = formatSelectValues(match.selectValues);
|
|
173
|
-
const inputs = document.querySelectorAll('[fynd-form-field="product-interested-input"]');
|
|
174
|
-
inputs.forEach((el) => {
|
|
175
|
-
if (el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLTextAreaElement) {
|
|
176
|
-
el.value = formatted;
|
|
177
|
-
} else {
|
|
178
|
-
el.textContent = formatted;
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
function setupProductInterestAutoFill() {
|
|
183
|
-
const selectWrapper = '[fynd-wrapper-field="product-interested-select"]';
|
|
184
|
-
const selectSelector = '[fynd-form-field="product-interested-select"]';
|
|
185
|
-
const inputSelector = '[fynd-form-field="product-interested-input"]';
|
|
186
|
-
const selects = document.querySelectorAll(selectSelector);
|
|
187
|
-
const inputs = document.querySelectorAll(inputSelector);
|
|
188
|
-
const selectContainers = document.querySelectorAll(selectWrapper);
|
|
189
|
-
if (!shouldRunProductInterestLogic()) {
|
|
190
|
-
applySolutionMapping();
|
|
191
|
-
selectContainers.forEach((select) => {
|
|
192
|
-
select.style.display = "none";
|
|
193
|
-
});
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
selectContainers.forEach((select) => {
|
|
197
|
-
select.style.display = "flex";
|
|
198
|
-
});
|
|
199
|
-
if (!selects.length) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
selects.forEach((select) => {
|
|
203
|
-
select.addEventListener("change", () => {
|
|
204
|
-
const selectedValue = select.value;
|
|
205
|
-
const config = productInterestConfigs.find(
|
|
206
|
-
(item) => item.optionName === selectedValue
|
|
207
|
-
);
|
|
208
|
-
const valueToFill = config ? formatSelectValues(config.selectValues) : "";
|
|
209
|
-
inputs.forEach((input) => {
|
|
210
|
-
input.value = valueToFill;
|
|
211
|
-
const inputEvent = new Event("input", { bubbles: true });
|
|
212
|
-
input.dispatchEvent(inputEvent);
|
|
213
|
-
const changeEvent = new Event("change", { bubbles: true });
|
|
214
|
-
input.dispatchEvent(changeEvent);
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
220
|
-
setTimeout(() => {
|
|
221
|
-
fillFormWithUserJourney();
|
|
222
|
-
setupProductInterestAutoFill();
|
|
223
|
-
}, 500);
|
|
224
|
-
});
|
|
225
|
-
if (document.readyState === "loading") {
|
|
226
|
-
document.addEventListener("DOMContentLoaded", () => {
|
|
227
|
-
setTimeout(() => {
|
|
228
|
-
fillFormWithUserJourney();
|
|
229
|
-
}, 500);
|
|
230
|
-
});
|
|
231
|
-
} else {
|
|
232
|
-
setTimeout(() => {
|
|
233
|
-
fillFormWithUserJourney();
|
|
234
|
-
}, 500);
|
|
235
|
-
}
|
|
236
|
-
window.fillFormWithUserJourney = fillFormWithUserJourney;
|
|
237
|
-
})();
|
|
238
|
-
//# sourceMappingURL=fill-form-fields.js.map
|
|
1
|
+
"use strict";(()=>{var p=[{optionName:"Building a website",selectValues:["Storefront","Commerce"]},{optionName:"Supply chain solutions",selectValues:["WMS","OMS","TMS","Commerce"]},{optionName:"Retail store solutions",selectValues:["StoreOS","Commerce"]},{optionName:"Sell on Marketplaces",selectValues:["OMS","Commerce"]},{optionName:"AI solutions",selectValues:["Kaily","Boltic","Pixelbin"]},{optionName:"Fashion manufacturing solution",selectValues:["Create Sourcing","Create Design","Snap"]}],y=[{slug:"/solutions/transport-management-system",selectValues:["TMS","Commerce"]},{slug:"/solutions/storefront",selectValues:["Storefront","Commerce"]},{slug:"/solutions/wms",selectValues:["WMS","Commerce"]},{slug:"/solutions/order-management-system",selectValues:["OMS","Commerce"]},{slug:"/solutions/order-management-system",selectValues:["OMS","Commerce"]},{slug:"/solutions/konnect-integrations",selectValues:["OMS","Commerce"]},{slug:"/solutions/returns-management-system",selectValues:["StoreOS"]},{slug:"/solutions/ai-photoshoots",selectValues:["Snap"]},{slug:"/solutions/ai-agent-builder",selectValues:["Kaily"]},{slug:"/solutions/workflow-automation",selectValues:["Boltic"]},{slug:"/solutions/ai-editing-for-commerce",selectValues:["Pixelbin"]},{slug:"/solutions/create",selectValues:["Create Design","Create Sourcing","Snap"]},{slug:"/solutions/3d-ar-vr-try-ons",selectValues:["GlamAR"]}];function c(){try{let e=h(),r="Inbound Form",n="Inbound",s="Prospect";if(!e||e.userJourney.length===0)return;let t=e.userJourney[0],l=e.userJourney[e.userJourney.length-1];e.userJourney.length>1&&e.userJourney[e.userJourney.length-1].page==="/contact-us"&&(l=e.userJourney[e.userJourney.length-2]);let o={utm_source:t.utm.source,utm_medium:t.utm.medium,utm_campaign:t.utm.campaign,source:r,source_direction:n,contact_type:s,userjourney:JSON.stringify(e.userJourney),device:e.deviceCategory,browser:e.browser,refferer_domain:document.referrer?new URL(document.referrer).hostname:"",host_url:window.location.hostname,"current-page-url":window.location.href};Object.entries(o).forEach(([a,i])=>{E(a,i)})}catch(e){console.error("Error filling form with user journey data:",e)}}function h(){try{let e=localStorage.getItem("userJourney");return e?JSON.parse(e):null}catch(e){return console.error("Error getting user journey data:",e),null}}function E(e,r){try{let n=`[fynd-queryparam-name="${e}"]`,s=document.querySelectorAll(n);s.length>0&&s.forEach(t=>{t.value=r;let l=new Event("input",{bubbles:!0});t.dispatchEvent(l);let o=new Event("change",{bubbles:!0});t.dispatchEvent(o)})}catch(n){console.error(`Error filling field [${e}]:`,n)}}function m(e){return Array.isArray(e)?e.join("; "):""}function S(){return!window.location.pathname.startsWith("/solutions/")}function v(){let e=window.location.pathname,r=y.find(t=>t.slug===e);if(!r)return;let n=m(r.selectValues);document.querySelectorAll('[fynd-form-field="product-interested-input"]').forEach(t=>{t instanceof HTMLInputElement||t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement?t.value=n:t.textContent=n})}function b(){let e='[fynd-wrapper-field="product-interested-select"]',r='[fynd-form-field="product-interested-select"]',n='[fynd-form-field="product-interested-input"]',s=document.querySelectorAll(r),t=document.querySelectorAll(n),l=document.querySelectorAll(e);if(!S()){v(),l.forEach(o=>{o.style.display="none"});return}l.forEach(o=>{o.style.display="flex"}),s.length&&s.forEach(o=>{o.addEventListener("change",()=>{let a=o.value,i=p.find(u=>u.optionName===a),d=i?m(i.selectValues):"";t.forEach(u=>{u.value=d;let g=new Event("input",{bubbles:!0});u.dispatchEvent(g);let f=new Event("change",{bubbles:!0});u.dispatchEvent(f)})})})}document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{c(),b()},500)});document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{c()},500)}):setTimeout(()=>{c()},500);window.fillFormWithUserJourney=c;})();
|
|
@@ -1,146 +1 @@
|
|
|
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/tracking/form-tracker.ts
|
|
13
|
-
var FormTracker = class {
|
|
14
|
-
constructor() {
|
|
15
|
-
this.processedForms = /* @__PURE__ */ new Set();
|
|
16
|
-
this.formFieldMap = /* @__PURE__ */ new Map([
|
|
17
|
-
["firstName", "firstName"],
|
|
18
|
-
["first_name", "firstName"],
|
|
19
|
-
["fname", "firstName"],
|
|
20
|
-
["lastName", "lastName"],
|
|
21
|
-
["last_name", "lastName"],
|
|
22
|
-
["lname", "lastName"],
|
|
23
|
-
["email", "email"],
|
|
24
|
-
["email_address", "email"],
|
|
25
|
-
["phone", "phone"],
|
|
26
|
-
["phone_number", "phone"],
|
|
27
|
-
["mobile", "phone"],
|
|
28
|
-
["tel", "phone"]
|
|
29
|
-
]);
|
|
30
|
-
this.init();
|
|
31
|
-
}
|
|
32
|
-
init() {
|
|
33
|
-
if (document.readyState === "loading") {
|
|
34
|
-
document.addEventListener("DOMContentLoaded", () => this.setupFormTracking());
|
|
35
|
-
} else {
|
|
36
|
-
this.setupFormTracking();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
setupFormTracking() {
|
|
40
|
-
const formFields = document.querySelectorAll("[data-posthog-trigger]");
|
|
41
|
-
formFields.forEach((field) => {
|
|
42
|
-
field.addEventListener("change", (event) => {
|
|
43
|
-
this.handleFormInteraction(event);
|
|
44
|
-
});
|
|
45
|
-
field.addEventListener("input", (event) => {
|
|
46
|
-
this.handleFormInput(event);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
handleFormInteraction(event) {
|
|
51
|
-
const field = event.target;
|
|
52
|
-
const parentForm = field.closest("form");
|
|
53
|
-
console.log("Form interaction detected:", parentForm);
|
|
54
|
-
if (!parentForm) return null;
|
|
55
|
-
if (this.processedForms.has(parentForm)) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
this.processedForms.add(parentForm);
|
|
59
|
-
const formName = parentForm.getAttribute("data-name");
|
|
60
|
-
const formId = parentForm.getAttribute("id") || this.generateFormId(parentForm);
|
|
61
|
-
if (formName) {
|
|
62
|
-
window.interactedForm = formName;
|
|
63
|
-
this.updateUserJourneyFormDetails(formId, formName);
|
|
64
|
-
if (typeof window.getTrackingPropertiesWithForm === "function") {
|
|
65
|
-
if (typeof window.trackEvent === "function") {
|
|
66
|
-
window.trackEvent(
|
|
67
|
-
"fynd_form_started",
|
|
68
|
-
window.getTrackingPropertiesWithForm(formName)
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return formName;
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
handleFormInput(event) {
|
|
77
|
-
const field = event.target;
|
|
78
|
-
const fieldName = this.getFieldName(field);
|
|
79
|
-
const mappedFieldName = this.mapFieldName(fieldName);
|
|
80
|
-
if (!mappedFieldName) return;
|
|
81
|
-
this.updateUserJourneyFormData(mappedFieldName, field.value);
|
|
82
|
-
}
|
|
83
|
-
getFieldName(field) {
|
|
84
|
-
return field.getAttribute("name") || field.getAttribute("data-field") || field.getAttribute("data-name") || field.getAttribute("id") || "";
|
|
85
|
-
}
|
|
86
|
-
mapFieldName(fieldName) {
|
|
87
|
-
const lowerFieldName = fieldName.toLowerCase();
|
|
88
|
-
if (this.formFieldMap.has(lowerFieldName)) {
|
|
89
|
-
return this.formFieldMap.get(lowerFieldName);
|
|
90
|
-
}
|
|
91
|
-
for (const [key, mappedField] of this.formFieldMap.entries()) {
|
|
92
|
-
if (lowerFieldName.includes(key)) {
|
|
93
|
-
return mappedField;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
generateFormId(form) {
|
|
99
|
-
const formName = form.getAttribute("data-name") || "unknown";
|
|
100
|
-
const timestamp = Date.now();
|
|
101
|
-
return `form-${formName}-${timestamp}`;
|
|
102
|
-
}
|
|
103
|
-
updateUserJourneyFormDetails(formId, formName) {
|
|
104
|
-
if (typeof window.setFormDetails === "function") {
|
|
105
|
-
window.setFormDetails(formId, formName);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
updateUserJourneyFormData(fieldName, value) {
|
|
109
|
-
if (typeof window.setFormData === "function") {
|
|
110
|
-
window.setFormData(fieldName, value);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// Public method to add custom field mapping
|
|
114
|
-
addFieldMapping(fieldName, mappedField) {
|
|
115
|
-
this.formFieldMap.set(fieldName.toLowerCase(), mappedField);
|
|
116
|
-
}
|
|
117
|
-
// Public method to reinitialize tracking (useful for dynamic content)
|
|
118
|
-
reinitialize() {
|
|
119
|
-
this.processedForms.clear();
|
|
120
|
-
this.setupFormTracking();
|
|
121
|
-
if (typeof window.reinitializeFormTracking === "function") {
|
|
122
|
-
window.reinitializeFormTracking();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// Public method to get current form data
|
|
126
|
-
getFormData() {
|
|
127
|
-
if (typeof window.getUserJourney === "function") {
|
|
128
|
-
const journey = window.getUserJourney();
|
|
129
|
-
return journey ? journey.formDetails : null;
|
|
130
|
-
}
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
// Public method to manually set form data
|
|
134
|
-
setFormData(fieldName, value) {
|
|
135
|
-
return this.updateUserJourneyFormData(fieldName, value) !== void 0;
|
|
136
|
-
}
|
|
137
|
-
// Public method to check if a form has been interacted with
|
|
138
|
-
isFormInteracted(form) {
|
|
139
|
-
return this.processedForms.has(form);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
var formTracker = new FormTracker();
|
|
143
|
-
window.formTracker = formTracker;
|
|
144
|
-
var form_tracker_default = formTracker;
|
|
145
|
-
})();
|
|
146
|
-
//# sourceMappingURL=form-tracker.js.map
|
|
1
|
+
"use strict";(()=>{var o=class{constructor(){this.processedForms=new Set;this.formFieldMap=new Map([["firstName","firstName"],["first_name","firstName"],["fname","firstName"],["lastName","lastName"],["last_name","lastName"],["lname","lastName"],["email","email"],["email_address","email"],["phone","phone"],["phone_number","phone"],["mobile","phone"],["tel","phone"]]);this.init()}init(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.setupFormTracking()):this.setupFormTracking()}setupFormTracking(){document.querySelectorAll("[data-posthog-trigger]").forEach(t=>{t.addEventListener("change",r=>{this.handleFormInteraction(r)}),t.addEventListener("input",r=>{this.handleFormInput(r)})})}handleFormInteraction(e){let r=e.target.closest("form");if(console.log("Form interaction detected:",r),!r||this.processedForms.has(r))return null;this.processedForms.add(r);let a=r.getAttribute("data-name"),n=r.getAttribute("id")||this.generateFormId(r);return a?(window.interactedForm=a,this.updateUserJourneyFormDetails(n,a),typeof window.getTrackingPropertiesWithForm=="function"&&typeof window.trackEvent=="function"&&window.trackEvent("fynd_form_started",window.getTrackingPropertiesWithForm(a)),a):null}handleFormInput(e){let t=e.target,r=this.getFieldName(t),a=this.mapFieldName(r);a&&this.updateUserJourneyFormData(a,t.value)}getFieldName(e){return e.getAttribute("name")||e.getAttribute("data-field")||e.getAttribute("data-name")||e.getAttribute("id")||""}mapFieldName(e){let t=e.toLowerCase();if(this.formFieldMap.has(t))return this.formFieldMap.get(t);for(let[r,a]of this.formFieldMap.entries())if(t.includes(r))return a;return null}generateFormId(e){let t=e.getAttribute("data-name")||"unknown",r=Date.now();return`form-${t}-${r}`}updateUserJourneyFormDetails(e,t){typeof window.setFormDetails=="function"&&window.setFormDetails(e,t)}updateUserJourneyFormData(e,t){typeof window.setFormData=="function"&&window.setFormData(e,t)}addFieldMapping(e,t){this.formFieldMap.set(e.toLowerCase(),t)}reinitialize(){this.processedForms.clear(),this.setupFormTracking(),typeof window.reinitializeFormTracking=="function"&&window.reinitializeFormTracking()}getFormData(){if(typeof window.getUserJourney=="function"){let e=window.getUserJourney();return e?e.formDetails:null}return null}setFormData(e,t){return this.updateUserJourneyFormData(e,t)!==void 0}isFormInteracted(e){return this.processedForms.has(e)}},i=new o;window.formTracker=i;var m=i;})();
|