valtech-components 2.0.824 → 2.0.826

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/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "2.0.824";
5
+ export declare const VERSION = "2.0.826";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.824",
3
+ "version": "2.0.826",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
@@ -42,21 +42,32 @@ if (!self.FIREBASE_CONFIG) {
42
42
  messaging.onBackgroundMessage((payload) => {
43
43
  console.log('[SW] Mensaje recibido en background:', payload);
44
44
 
45
- const notificationTitle = payload.notification?.title || 'Nueva notificación';
45
+ // Web push usa mensajes data-only (sin bloque `notification`) para que el
46
+ // navegador NO auto-muestre una notificación duplicada — el SW es el único
47
+ // que la pinta. Title/body/icon llegan dentro de `data`. Se mantiene el
48
+ // fallback a `payload.notification` por compatibilidad con mensajes
49
+ // legacy o nativos que sí traen el bloque.
50
+ const data = payload.data || {};
51
+ const notificationTitle =
52
+ payload.notification?.title || data.title || 'Nueva notificación';
53
+ const notificationBody = payload.notification?.body || data.body || '';
54
+ const notificationIcon =
55
+ payload.notification?.icon || data.icon || '/assets/icon/favicon.ico';
56
+
46
57
  const notificationOptions = {
47
- body: payload.notification?.body || '',
48
- icon: payload.notification?.icon || '/assets/icon/favicon.ico',
58
+ body: notificationBody,
59
+ icon: notificationIcon,
49
60
  image: payload.notification?.image,
50
61
  badge: '/assets/icon/badge.png',
51
- tag: payload.messageId || 'default',
62
+ tag: payload.messageId || data.messageId || 'default',
52
63
  data: {
53
- ...payload.data,
54
- messageId: payload.messageId,
64
+ ...data,
65
+ messageId: payload.messageId || data.messageId,
55
66
  title: notificationTitle,
56
- body: payload.notification?.body,
67
+ body: notificationBody,
57
68
  },
58
69
  vibrate: [200, 100, 200],
59
- requireInteraction: payload.data?.require_interaction === 'true',
70
+ requireInteraction: data.require_interaction === 'true',
60
71
  };
61
72
 
62
73
  return self.registration.showNotification(notificationTitle, notificationOptions);