valtech-components 4.0.53 → 4.0.56
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/esm2022/lib/components/atoms/skeleton/skeleton.component.mjs +35 -23
- package/esm2022/lib/components/organisms/auth-cta/auth-cta.component.mjs +3 -3
- package/esm2022/lib/components/organisms/landing-split/landing-split.component.mjs +3 -3
- package/esm2022/lib/components/organisms/organization-view/organization-view.component.mjs +79 -1
- package/esm2022/lib/components/organisms/organization-view/organization-view.i18n.mjs +13 -1
- package/esm2022/lib/components/organisms/organization-view/types.mjs +1 -1
- package/esm2022/lib/version.mjs +2 -2
- package/fesm2022/valtech-components.mjs +129 -27
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/organisms/organization-view/organization-view.component.d.ts +4 -1
- package/lib/components/organisms/organization-view/types.d.ts +7 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/lib/services/firebase/firebase-messaging-sw.js +145 -0
|
@@ -50,7 +50,7 @@ export declare class OrganizationViewComponent {
|
|
|
50
50
|
* `resolvedConfig` mergea con los defaults — `@Input` gana sobre route data.
|
|
51
51
|
*/
|
|
52
52
|
config?: OrganizationViewConfig;
|
|
53
|
-
readonly resolvedConfig: import("@angular/core").Signal<Required<Omit<OrganizationViewConfig, "onOrgEdited" | "onMemberInvited" | "onOwnershipTransferred" | "onLeftOrg">> & Pick<OrganizationViewConfig, "onOrgEdited" | "onMemberInvited" | "onOwnershipTransferred" | "onLeftOrg">>;
|
|
53
|
+
readonly resolvedConfig: import("@angular/core").Signal<Required<Omit<OrganizationViewConfig, "onOrgEdited" | "onMemberInvited" | "onOwnershipTransferred" | "onLeftOrg" | "onOrgDeleted">> & Pick<OrganizationViewConfig, "onOrgEdited" | "onMemberInvited" | "onOwnershipTransferred" | "onLeftOrg" | "onOrgDeleted">>;
|
|
54
54
|
/** Namespace i18n resuelto (capturado para llamadas no-reactivas). */
|
|
55
55
|
private get ns();
|
|
56
56
|
readonly org: import("@angular/core").WritableSignal<Organization>;
|
|
@@ -70,6 +70,7 @@ export declare class OrganizationViewComponent {
|
|
|
70
70
|
readonly showAllMembers: import("@angular/core").WritableSignal<boolean>;
|
|
71
71
|
readonly visibleMembers: import("@angular/core").Signal<MemberDetail[]>;
|
|
72
72
|
readonly transferring: import("@angular/core").WritableSignal<boolean>;
|
|
73
|
+
readonly deleting: import("@angular/core").WritableSignal<boolean>;
|
|
73
74
|
readonly availableRoles: import("@angular/core").WritableSignal<OrgRole[]>;
|
|
74
75
|
readonly activeOrgId: import("@angular/core").Signal<string>;
|
|
75
76
|
readonly userId: import("@angular/core").Signal<string>;
|
|
@@ -87,11 +88,13 @@ export declare class OrganizationViewComponent {
|
|
|
87
88
|
readonly openInviteButtonProps: import("@angular/core").Signal<Partial<ButtonMetadata>>;
|
|
88
89
|
readonly openImportButtonProps: import("@angular/core").Signal<Partial<ButtonMetadata>>;
|
|
89
90
|
readonly openApiKeysButtonProps: import("@angular/core").Signal<Partial<ButtonMetadata>>;
|
|
91
|
+
readonly deleteButtonProps: import("@angular/core").Signal<Partial<ButtonMetadata>>;
|
|
90
92
|
/** Guarda para detectar el primer disparo del effect (evita doble carga). */
|
|
91
93
|
private lastLoadedOrgId;
|
|
92
94
|
constructor();
|
|
93
95
|
onEdit(): void;
|
|
94
96
|
onLeave(): Promise<void>;
|
|
97
|
+
onDelete(): Promise<void>;
|
|
95
98
|
onOpenInvite(): void;
|
|
96
99
|
onOpenImport(): void;
|
|
97
100
|
onOpenApiKeys(): void;
|
|
@@ -35,6 +35,11 @@ export interface OrganizationViewConfig {
|
|
|
35
35
|
showTransferOwnership?: boolean;
|
|
36
36
|
/** Muestra la sección "Salir de la organización". Default `true`. */
|
|
37
37
|
showLeave?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Muestra la sección "Eliminar organización". Default `true`. El render real
|
|
40
|
+
* exige además ser owner (gating RBAC interno vía `isOwner()`).
|
|
41
|
+
*/
|
|
42
|
+
showDeleteOrg?: boolean;
|
|
38
43
|
/**
|
|
39
44
|
* Namespace i18n con el que la vista resuelve sus textos.
|
|
40
45
|
* Default `'Settings.Organization'`.
|
|
@@ -64,4 +69,6 @@ export interface OrganizationViewConfig {
|
|
|
64
69
|
onOwnershipTransferred?: () => void;
|
|
65
70
|
/** Hook tras salir de la organización. */
|
|
66
71
|
onLeftOrg?: () => void;
|
|
72
|
+
/** Hook tras eliminar la organización. */
|
|
73
|
+
onOrgDeleted?: () => void;
|
|
67
74
|
}
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Firebase Messaging Service Worker
|
|
3
|
+
*
|
|
4
|
+
* Service Worker estático para Firebase Cloud Messaging.
|
|
5
|
+
* Carga la configuración dinámicamente desde /firebase-config.js.
|
|
6
|
+
*
|
|
7
|
+
* CONFIGURACIÓN:
|
|
8
|
+
* 1. Crea firebase.config.json con tu configuración de Firebase
|
|
9
|
+
* 2. Ejecuta: npm run generate:firebase-config
|
|
10
|
+
* Esto genera /firebase-config.js con: self.FIREBASE_CONFIG = {...}
|
|
11
|
+
* 3. Agrega este SW y firebase-config.js a los assets de angular.json
|
|
12
|
+
*
|
|
13
|
+
* Ver README.md para documentación completa.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// Importar Firebase scripts
|
|
17
|
+
importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-app-compat.js');
|
|
18
|
+
importScripts('https://www.gstatic.com/firebasejs/10.7.0/firebase-messaging-compat.js');
|
|
19
|
+
|
|
20
|
+
// Importar configuración desde archivo externo (generado en build)
|
|
21
|
+
// Este archivo define: self.FIREBASE_CONFIG = { ... }
|
|
22
|
+
try {
|
|
23
|
+
importScripts('/firebase-config.js');
|
|
24
|
+
} catch (e) {
|
|
25
|
+
console.error('[SW] No se pudo cargar firebase-config.js:', e);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Verificar que la configuración existe
|
|
29
|
+
if (!self.FIREBASE_CONFIG) {
|
|
30
|
+
console.error('[SW] FIREBASE_CONFIG no está definido.');
|
|
31
|
+
console.error('[SW] Ejecuta: npm run generate:firebase-config');
|
|
32
|
+
} else {
|
|
33
|
+
// Inicializar Firebase
|
|
34
|
+
firebase.initializeApp(self.FIREBASE_CONFIG);
|
|
35
|
+
|
|
36
|
+
// Obtener instancia de messaging
|
|
37
|
+
const messaging = firebase.messaging();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Handler para mensajes en background.
|
|
41
|
+
*/
|
|
42
|
+
messaging.onBackgroundMessage((payload) => {
|
|
43
|
+
console.log('[SW] Mensaje recibido en background:', payload);
|
|
44
|
+
|
|
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
|
+
|
|
57
|
+
const notificationOptions = {
|
|
58
|
+
body: notificationBody,
|
|
59
|
+
icon: notificationIcon,
|
|
60
|
+
image: payload.notification?.image,
|
|
61
|
+
badge: '/assets/icon/badge.png',
|
|
62
|
+
tag: payload.messageId || data.messageId || 'default',
|
|
63
|
+
data: {
|
|
64
|
+
...data,
|
|
65
|
+
messageId: payload.messageId || data.messageId,
|
|
66
|
+
title: notificationTitle,
|
|
67
|
+
body: notificationBody,
|
|
68
|
+
},
|
|
69
|
+
vibrate: [200, 100, 200],
|
|
70
|
+
requireInteraction: data.require_interaction === 'true',
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
return self.registration.showNotification(notificationTitle, notificationOptions);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Handler para clicks en notificaciones.
|
|
78
|
+
*/
|
|
79
|
+
self.addEventListener('notificationclick', (event) => {
|
|
80
|
+
console.log('[SW] Click en notificación:', event);
|
|
81
|
+
event.notification.close();
|
|
82
|
+
|
|
83
|
+
const data = event.notification.data || {};
|
|
84
|
+
let targetUrl = '/';
|
|
85
|
+
|
|
86
|
+
if (data.route) {
|
|
87
|
+
targetUrl = data.route;
|
|
88
|
+
} else if (data.url) {
|
|
89
|
+
targetUrl = data.url;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (data.query_params) {
|
|
93
|
+
const separator = targetUrl.includes('?') ? '&' : '?';
|
|
94
|
+
targetUrl += separator + data.query_params;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const notificationPayload = {
|
|
98
|
+
type: 'NOTIFICATION_CLICK',
|
|
99
|
+
notification: {
|
|
100
|
+
title: data.title,
|
|
101
|
+
body: data.body,
|
|
102
|
+
data: data,
|
|
103
|
+
messageId: data.messageId,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
event.waitUntil(
|
|
108
|
+
clients
|
|
109
|
+
.matchAll({ type: 'window', includeUncontrolled: true })
|
|
110
|
+
.then((clientList) => {
|
|
111
|
+
// Siempre enviar postMessage para que la app pueda reaccionar
|
|
112
|
+
for (const client of clientList) {
|
|
113
|
+
client.postMessage(notificationPayload);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Navegar si hay route o url
|
|
117
|
+
if (targetUrl !== '/') {
|
|
118
|
+
for (const client of clientList) {
|
|
119
|
+
if ('navigate' in client) {
|
|
120
|
+
return client.navigate(targetUrl).then((c) => c?.focus());
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// Si no hay cliente abierto, abrir nueva ventana
|
|
124
|
+
if (clients.openWindow) {
|
|
125
|
+
return clients.openWindow(targetUrl);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Solo hacer focus si no hay navegación
|
|
130
|
+
for (const client of clientList) {
|
|
131
|
+
if ('focus' in client) {
|
|
132
|
+
return client.focus();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (clients.openWindow) {
|
|
136
|
+
return clients.openWindow('/');
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
self.addEventListener('notificationclose', (event) => {
|
|
143
|
+
console.log('[SW] Notificación cerrada:', event.notification.tag);
|
|
144
|
+
});
|
|
145
|
+
}
|