We had a block of code to make the bot to be open status, and it has been working so far, however last a few days our error handler indicate zoomCampainSdk is not existing. Could you investigate?
Error: zoomCampaignSdk not found within the specified timeout.
at checkzoomCampaignSdk
Snippet of the code is here
self.addEventListener('message', (event) => {
if (executed)
return
const startTime = Date.now();
const timeout = 10000; // 10 seconds
function checkzoomCampaignSdk() {
if (!executed && typeof zoomCampaignSdk !== 'undefined') {
try{
zoomCampaignSdk.open(); // Execute the action when zoomCampaignSdk exists
console.log('zoomCampaignSdk found and action executed.');
executed = true; // Mark as executed
} catch (exception) {
console.error('zoomCampaignSdk not found within the specified timeout.', exception);
}
} else {
const currentTime = Date.now();
if (currentTime - startTime < timeout) {
// Continue checking until timeout
setTimeout(checkzoomCampaignSdk, 1000); // Check every second
} else {
throw new Error('zoomCampaignSdk not found within the specified timeout.');
}
}
}
checkzoomCampaignSdk(); // Start checking
});