// Open Botpress when Velo sets ?bpchat=1 function openIfFlagPresent() { const params = new URLSearchParams(window.location.search); if (params.get('bpchat') !== '1') return; if (window.botpress && typeof window.botpress.open === 'function') { window.botpress.open(); // Botpress method // Remove the flag so refresh doesn't re-open const url = new URL(window.location.href); url.searchParams.delete('bpchat'); history.replaceState({}, '', url.toString()); } } // Wait for Botpress Webchat to be initialized before opening function attachBotpressListener() { if (!window.botpress || typeof window.botpress.on !== 'function') return false; window.botpress.on('webchat:initialized', () => { openIfFlagPresent(); // Wix queryParams.add may update URL without a full reload, so poll lightly setInterval(openIfFlagPresent, 250); }); return true; } // inject.js loads async; poll briefly until window.botpress exists (function bootstrap() { if (attachBotpressListener()) return; const t = setInterval(() => { if (attachBotpressListener()) clearInterval(t); }, 200); setTimeout(() => clearInterval(t), 10000); })();
top of page
Nadyan Sport

LE BLOG
NADYAN SPORTS

bottom of page