Skip to content

Commit f522540

Browse files
author
Boopathi
committed
Update layout, page, and blog view components
1 parent 75b0db6 commit f522540

File tree

3 files changed

+116
-390
lines changed

3 files changed

+116
-390
lines changed

src/app/layout.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,27 @@ export default function RootLayout({
6565
window.$zoho.salesiq = window.$zoho.salesiq || {
6666
widgetcode: "siq770fac757336897d739f9273d8f8f7b3aec5f63c512be52582e5f9e3440d863b",
6767
values: {},
68-
ready: function () {}
68+
ready: function () {
69+
var salesiqDoc = document.getElementById("zsiq_float");
70+
if (salesiqDoc) {
71+
document.addEventListener('router:end', (event) => {
72+
if (window.\$zoho && window.\$zoho.salesiq && window.\$zoho.salesiq.page) {
73+
window.\$zoho.salesiq.page.popup.close('all');
74+
window.\$zoho.salesiq.page.popup.show();
75+
}
76+
});
77+
}
78+
}
6979
};
7080
7181
var d = document;
7282
var s = d.createElement("script");
73-
s.type = "text/javascript";
74-
s.id = "zsiqscript";
75-
s.defer = true;
76-
s.src = "https://salesiq.zohopublic.in/widget";
83+
s.type = "text/javascript";
84+
s.id = "zsiqscript";
85+
s.defer = true;
86+
s.src = "https://salesiq.zohopublic.in/widget";
7787
var t = d.getElementsByTagName("script")[0];
78-
t.parentNode.insertBefore(s, t);
88+
t.parentNode.insertBefore(s, t);
7989
`}
8090
</Script>
8191
</body>

src/app/page.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,10 @@ export default function Home() {
162162
localStorage.setItem('theme', theme);
163163
}
164164
}, [theme]);
165-
166-
// Re-run Zoho SalesIQ trigger on SPA navigation
165+
167166
useEffect(() => {
168-
if (typeof window !== 'undefined' && (window as any).$zoho) {
169-
(window as any).$zoho.salesiq.ready = function() {
170-
(window as any).$zoho.salesiq.page.popup.close('all');
171-
(window as any).$zoho.salesiq.page.popup.show();
172-
}
167+
if (typeof window !== 'undefined') {
168+
document.dispatchEvent(new CustomEvent('router:end'));
173169
}
174170
}, [activeView]);
175171

0 commit comments

Comments
 (0)