* feat: web push notifications feature * Revert yarn.lock changes * added new env variables requirement in .env.example * moved useNotifications hook in packages/lib/hooks * fix: bug * use i18n * chore: move to new file * chore: add yarn.lock * Update .env.example Co-authored-by: Amit Sharma <[email protected]> * chore: add instruction for brave browser * fix: tooltip * chore: use enum * chore * small update --------- Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Amit Sharma <[email protected]> Co-authored-by: Carina Wollendorfer <[email protected]> Co-authored-by: unknown <[email protected]> Co-authored-by: Anik Dhabal Babu <[email protected]>
17 lines
536 B
JavaScript
17 lines
536 B
JavaScript
self.addEventListener("push", (event) => {
|
|
let notificationData = event.data.json();
|
|
|
|
const title = notificationData.title || "You have new notification from Cal.com";
|
|
const image ="/cal-com-icon.svg";
|
|
const options = {
|
|
...notificationData.options,
|
|
icon: image,
|
|
};
|
|
self.registration.showNotification(title, options);
|
|
});
|
|
|
|
self.addEventListener("notificationclick", (event) => {
|
|
event.notification.close();
|
|
event.waitUntil(self.clients.openWindow(event.notification.data.targetURL || "https://app.cal.com"));
|
|
});
|