valtech-components 2.0.726 → 2.0.727
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/services/auth/index.mjs +3 -1
- package/esm2022/lib/services/auth/notification-action.service.mjs +113 -0
- package/esm2022/lib/services/auth/types.mjs +1 -1
- package/esm2022/lib/services/firebase/notifications.service.mjs +4 -3
- package/esm2022/lib/version.mjs +2 -2
- package/fesm2022/valtech-components.mjs +109 -5
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/auth/index.d.ts +2 -0
- package/lib/services/auth/notification-action.service.d.ts +34 -0
- package/lib/services/auth/types.d.ts +12 -0
- package/lib/services/firebase/notifications.service.d.ts +9 -1
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -85,3 +85,5 @@ export { HandoffService, HANDOFF_TOKEN_PARAM, HANDOFF_ROUTE_PARAM } from './hand
|
|
|
85
85
|
export type { HandoffCreateRequest, HandoffCreateResponse, HandoffExchangeResponse, DetectAndExchangeOptions, } from './handoff.service';
|
|
86
86
|
export { OrgSwitchService } from './org-switch.service';
|
|
87
87
|
export type { OrgChangedEvent, SwitchOrgOptions } from './org-switch.service';
|
|
88
|
+
export { NotificationActionService } from './notification-action.service';
|
|
89
|
+
export type { NotificationOpenResult } from './notification-action.service';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Router } from '@angular/router';
|
|
2
|
+
import { AuthService } from './auth.service';
|
|
3
|
+
import { HandoffService } from './handoff.service';
|
|
4
|
+
import { OrgSwitchService } from './org-switch.service';
|
|
5
|
+
import { ValtechAuthConfig } from './types';
|
|
6
|
+
import { NotificationDocument, NotificationsService } from '../firebase/notifications.service';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
/** Resultado descriptivo del open() — útil para tests y telemetría. */
|
|
9
|
+
export type NotificationOpenResult = 'navigated' | 'navigated-after-switch-org' | 'redirected-cross-app' | 'no-action-route' | 'cross-app-unconfigured' | 'handoff-failed';
|
|
10
|
+
export declare class NotificationActionService {
|
|
11
|
+
private config;
|
|
12
|
+
private auth;
|
|
13
|
+
private orgSwitch;
|
|
14
|
+
private handoff;
|
|
15
|
+
private notifications;
|
|
16
|
+
private router;
|
|
17
|
+
constructor(config: ValtechAuthConfig, auth: AuthService, orgSwitch: OrgSwitchService, handoff: HandoffService, notifications: NotificationsService, router: Router);
|
|
18
|
+
/**
|
|
19
|
+
* Abre la notificación: marca como leída, switch-org si toca, navegación local o
|
|
20
|
+
* redirect cross-app vía handoff.
|
|
21
|
+
*
|
|
22
|
+
* No lanza errores hacia la UI — devuelve un resultado descriptivo. Errores
|
|
23
|
+
* técnicos quedan en console.warn.
|
|
24
|
+
*/
|
|
25
|
+
open(notif: NotificationDocument): Promise<NotificationOpenResult>;
|
|
26
|
+
private activeOrg;
|
|
27
|
+
/**
|
|
28
|
+
* Construye URL absoluta para handoff cross-app preservando pathname y otros
|
|
29
|
+
* params existentes de la baseUrl.
|
|
30
|
+
*/
|
|
31
|
+
private buildHandoffUrl;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NotificationActionService, never>;
|
|
33
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationActionService>;
|
|
34
|
+
}
|
|
@@ -26,6 +26,18 @@ export interface ValtechAuthConfig {
|
|
|
26
26
|
enableFirebaseIntegration?: boolean;
|
|
27
27
|
/** Habilitar registro automático de device tokens para push notifications (default: false) */
|
|
28
28
|
enableDeviceRegistration?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* AppID de esta app dentro del factory (ej: 'showcase', 'sigify', 'myvaltech').
|
|
31
|
+
* Usado por NotificationActionService para decidir si una notificación
|
|
32
|
+
* apunta a la app actual o requiere handoff cross-app.
|
|
33
|
+
*/
|
|
34
|
+
appId?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Mapa appId → baseUrl absoluta para handoff cross-app.
|
|
37
|
+
* Ej: { sigify: 'https://sigify.com', myvaltech: 'https://app.myvaltech.com' }
|
|
38
|
+
* NotificationActionService usa este map al disparar handoff a otra app.
|
|
39
|
+
*/
|
|
40
|
+
appUrls?: Record<string, string>;
|
|
29
41
|
}
|
|
30
42
|
/**
|
|
31
43
|
* Estado completo de autenticación.
|
|
@@ -23,12 +23,20 @@ export interface NotificationDocument extends FirestoreDocument {
|
|
|
23
23
|
body?: string;
|
|
24
24
|
/** URL de imagen */
|
|
25
25
|
image?: string;
|
|
26
|
-
/** Datos personalizados (ej: route, actionType) */
|
|
26
|
+
/** Datos personalizados (ej: route, actionType). Legacy — preferir actionRoute + payload */
|
|
27
27
|
data?: Record<string, string>;
|
|
28
28
|
/** Tipo de notificación */
|
|
29
29
|
type?: 'fcm' | 'system' | 'reminder' | string;
|
|
30
30
|
/** Si la notificación fue leída */
|
|
31
31
|
isRead: boolean;
|
|
32
|
+
/** AppID origen (ej: 'showcase', 'sigify'). Permite cross-app routing */
|
|
33
|
+
appId?: string;
|
|
34
|
+
/** OrgID asociado (si la notif es org-scoped). Habilita switch-org al abrir */
|
|
35
|
+
orgId?: string;
|
|
36
|
+
/** Route destino al click (ej: '/app/docs/123') */
|
|
37
|
+
actionRoute?: string;
|
|
38
|
+
/** Payload estructurado para acciones (reemplazo tipado de `data`) */
|
|
39
|
+
payload?: Record<string, unknown>;
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* Servicio para leer notificaciones desde Firestore.
|
package/lib/version.d.ts
CHANGED