feat: sound on browser push notification (#18548)

* feat: sound on notification

* refactor: add load audio

* chore: remove

* fix: type error

* fix: notification

* fix: prevent multiple initialization
=

* feat: create notification page

* chore: update the mp3 file
This commit is contained in:
Udit Takkar authored and GitHub committed 2025-03-11 11:49:51 +05:30
1 parent 4daad2ac08
commit b0125e1a05
16 files changed
+416 -237

No files matched your search

@@ -6,7 +6,7 @@ const vapidKeys = {
};
// The mail to email address should be the one at which push service providers can reach you. It can also be a URL.
webpush.setVapidDetails("https://cal.com", vapidKeys.publicKey, vapidKeys.privateKey);
webpush.setVapidDetails("mailto:support@cal.com", vapidKeys.publicKey, vapidKeys.privateKey);
type Subscription = {
endpoint: string;
@@ -24,6 +24,7 @@ export const sendNotification = async ({
url,
actions,
requireInteraction,
type = "INSTANT_MEETING",
}: {
subscription: Subscription;
title: string;
@@ -32,6 +33,7 @@ export const sendNotification = async ({
url?: string;
actions?: { action: string; title: string; type: string; image: string | null }[];
requireInteraction?: boolean;
type?: string;
}) => {
try {
const payload = JSON.stringify({
@@ -40,9 +42,11 @@ export const sendNotification = async ({
icon,
data: {
url,
type,
},
actions,
requireInteraction,
tag: `cal-notification-${Date.now()}`,
});
await webpush.sendNotification(subscription, payload);
} catch (error) {