@digipair/skill-web-push-notification 0.95.1 → 0.95.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  let WebHttpNotificationService = class WebHttpNotificationService {
6
- async registerServiceWorker() {
6
+ async registerServiceWorker(serviceWorkerPath) {
7
7
  if (!('serviceWorker' in navigator)) {
8
8
  console.log('Service Worker not supported in this browser');
9
9
  return null;
10
10
  }
11
11
  try {
12
- const registration = await navigator.serviceWorker.register('/assets/push-notification.worker.js');
12
+ const registration = await navigator.serviceWorker.register(serviceWorkerPath);
13
13
  return registration;
14
14
  } catch (error) {
15
15
  console.error('Error when registering the Service Worker', error);
@@ -38,8 +38,8 @@ let WebHttpNotificationService = class WebHttpNotificationService {
38
38
  }
39
39
  }
40
40
  async initialize(params, _pinsSettingsList, context) {
41
- const { publicKey = context.variables.PUSH_NOTIFICATION_PUBLIC_KEY } = params;
42
- const registration = await this.registerServiceWorker();
41
+ const { SERVICE_WORKER_PATH = '/public/push-notification.worker.js', publicKey = context.variables.PUSH_NOTIFICATION_PUBLIC_KEY } = params;
42
+ const registration = await this.registerServiceWorker(SERVICE_WORKER_PATH);
43
43
  if (registration) {
44
44
  return await this.subscribeToPushNotifications(registration, publicKey);
45
45
  }
package/index.esm.js CHANGED
@@ -1,11 +1,11 @@
1
1
  let WebHttpNotificationService = class WebHttpNotificationService {
2
- async registerServiceWorker() {
2
+ async registerServiceWorker(serviceWorkerPath) {
3
3
  if (!('serviceWorker' in navigator)) {
4
4
  console.log('Service Worker not supported in this browser');
5
5
  return null;
6
6
  }
7
7
  try {
8
- const registration = await navigator.serviceWorker.register('/assets/push-notification.worker.js');
8
+ const registration = await navigator.serviceWorker.register(serviceWorkerPath);
9
9
  return registration;
10
10
  } catch (error) {
11
11
  console.error('Error when registering the Service Worker', error);
@@ -34,8 +34,8 @@ let WebHttpNotificationService = class WebHttpNotificationService {
34
34
  }
35
35
  }
36
36
  async initialize(params, _pinsSettingsList, context) {
37
- const { publicKey = context.variables.PUSH_NOTIFICATION_PUBLIC_KEY } = params;
38
- const registration = await this.registerServiceWorker();
37
+ const { SERVICE_WORKER_PATH = '/public/push-notification.worker.js', publicKey = context.variables.PUSH_NOTIFICATION_PUBLIC_KEY } = params;
38
+ const registration = await this.registerServiceWorker(SERVICE_WORKER_PATH);
39
39
  if (registration) {
40
40
  return await this.subscribeToPushNotifications(registration, publicKey);
41
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-web-push-notification",
3
- "version": "0.95.1",
3
+ "version": "0.95.2",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "web",
package/schema.fr.json CHANGED
@@ -14,6 +14,15 @@
14
14
  "summary": "Enregistre l'utilisateur aux notifications push",
15
15
  "description": "Enregistre l'utilisateur pour recevoir des notifications push en temps réel.",
16
16
  "parameters": [
17
+ {
18
+ "name": "SERVICE_WORKER_PATH",
19
+ "summary": "Chemin du service worker",
20
+ "required": false,
21
+ "description": "Chemin du service worker pour les notifications push.",
22
+ "schema": {
23
+ "type": "string"
24
+ }
25
+ },
17
26
  {
18
27
  "name": "publicKey",
19
28
  "summary": "Clé publique VAPID",
package/schema.json CHANGED
@@ -14,6 +14,15 @@
14
14
  "summary": "Register the user for push notifications.",
15
15
  "description": "Register the user to receive push notifications for real-time updates.",
16
16
  "parameters": [
17
+ {
18
+ "name": "SERVICE_WORKER_PATH",
19
+ "summary": "Service worker path",
20
+ "required": false,
21
+ "description": "Path to the service worker for push notifications.",
22
+ "schema": {
23
+ "type": "string"
24
+ }
25
+ },
17
26
  {
18
27
  "name": "publicKey",
19
28
  "summary": "VAPID public key",