var zoneOfficeName = "popupOfficeZone"; var zoneEventName = "popupEventZone"; var zoneSchoolName = "popupSchoolZone"; var zoneTCMName = "popupTCMZone"; var urlPricing = "https://workadventu.re/pricing"; var urlSchoolOffer = "https://workadventu.re/school-offer"; var urlEvent = "https://workadventu.re/events"; var currentPopup = undefined; WA.onEnterZone(zoneOfficeName, () => { currentPopup = WA.openPopup("popUpOffice","You can purchase virtual office in WorkAdventure",[ { label: "See the pricing", className: "popUpElement", callback: (popup => { WA.openTab(urlPricing); }) }]); }) WA.onEnterZone(zoneEventName, () => { currentPopup = WA.openPopup("popUpEvent","You can create your own Event in WorkAdventure",[ { label: "See the event page", className: "popUpElement", callback: (popup => { WA.openTab(urlEvent); }) }]); }) WA.onEnterZone(zoneTCMName, () => { currentPopup = WA.openPopup("popUpTCM","Come meet the TCM team in our office ! ",[]); }) WA.onEnterZone(zoneSchoolName, () => { currentPopup = WA.openPopup("popUpSchool","WorkAdventure is free for teachers a the moment ! Take advantage of our offer ",[ { label: "See the offer", className: "popUpElement", callback: (popup => { WA.openTab(urlSchoolOffer); }) }]); }) WA.onLeaveZone(zoneSchoolName, closePopUp) WA.onLeaveZone(zoneTCMName, closePopUp) WA.onLeaveZone(zoneEventName, closePopUp) WA.onLeaveZone(zoneOfficeName, closePopUp) function closePopUp(){ if (currentPopup !== undefined) { currentPopup.close(); currentPopup = undefined; } }