valtech-components 2.0.489 → 2.0.490
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/device.service.mjs +33 -2
- package/esm2022/lib/services/auth/types.mjs +1 -1
- package/fesm2022/valtech-components.mjs +32 -1
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/auth/device.service.d.ts +22 -1
- package/lib/services/auth/types.d.ts +17 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { ValtechAuthConfig, DeviceInfo, DeviceActionResult, DeviceActionResponse } from './types';
|
|
3
|
+
import { ValtechAuthConfig, DeviceInfo, DeviceActionResult, DeviceActionResponse, ValidateActionResponse } from './types';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
/**
|
|
6
6
|
* Servicio para gestión de dispositivos del usuario.
|
|
@@ -55,6 +55,27 @@ export declare class DeviceService {
|
|
|
55
55
|
* Elimina un dispositivo registrado.
|
|
56
56
|
*/
|
|
57
57
|
deleteDevice(deviceId: string): Observable<DeviceActionResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Valida un token de acción SIN ejecutarlo.
|
|
60
|
+
* Útil para mostrar confirmación al usuario antes de ejecutar.
|
|
61
|
+
* Este endpoint NO requiere autenticación.
|
|
62
|
+
*
|
|
63
|
+
* @param token Token JWT de acción
|
|
64
|
+
* @returns Información del token si es válido
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const token = this.route.snapshot.queryParams['token'];
|
|
69
|
+
* if (token) {
|
|
70
|
+
* const validation = await firstValueFrom(this.deviceService.validateAction(token));
|
|
71
|
+
* if (validation.valid) {
|
|
72
|
+
* // Mostrar confirmación al usuario
|
|
73
|
+
* console.log(`Acción: ${validation.actionType}`);
|
|
74
|
+
* }
|
|
75
|
+
* }
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
validateAction(token: string): Observable<ValidateActionResponse>;
|
|
58
79
|
/**
|
|
59
80
|
* Ejecuta una acción de dispositivo desde un token de email.
|
|
60
81
|
* Este endpoint NO requiere autenticación.
|
|
@@ -643,3 +643,20 @@ export interface DeviceActionResponse {
|
|
|
643
643
|
/** Mensaje descriptivo */
|
|
644
644
|
message: string;
|
|
645
645
|
}
|
|
646
|
+
/**
|
|
647
|
+
* Response de validar token de acción (sin ejecutar).
|
|
648
|
+
* Usado para mostrar confirmación al usuario antes de ejecutar.
|
|
649
|
+
*/
|
|
650
|
+
export interface ValidateActionResponse {
|
|
651
|
+
operationId: string;
|
|
652
|
+
/** Si el token es válido */
|
|
653
|
+
valid: boolean;
|
|
654
|
+
/** Tipo de acción (device:refuse, device:approve, etc.) */
|
|
655
|
+
actionType?: string;
|
|
656
|
+
/** Tipo de recurso objetivo (device, document, etc.) */
|
|
657
|
+
targetType?: string;
|
|
658
|
+
/** ID del recurso objetivo */
|
|
659
|
+
targetId?: string;
|
|
660
|
+
/** Mensaje de error (si valid=false) */
|
|
661
|
+
message?: string;
|
|
662
|
+
}
|