valtech-components 2.0.482 → 2.0.484
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/auth.service.mjs +47 -1
- package/esm2022/lib/services/auth/types.mjs +1 -1
- package/esm2022/lib/services/firebase/notifications.service.mjs +17 -5
- package/fesm2022/valtech-components.mjs +60 -3
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/services/auth/auth.service.d.ts +24 -1
- package/lib/services/auth/types.d.ts +58 -1
- package/lib/services/firebase/notifications.service.d.ts +4 -3
- package/package.json +1 -1
|
@@ -25208,6 +25208,52 @@ class AuthService {
|
|
|
25208
25208
|
.pipe(catchError(error => this.handleAuthError(error)));
|
|
25209
25209
|
}
|
|
25210
25210
|
// =============================================
|
|
25211
|
+
// TOTP MFA (Google Authenticator)
|
|
25212
|
+
// =============================================
|
|
25213
|
+
/**
|
|
25214
|
+
* Inicia configuración de TOTP MFA.
|
|
25215
|
+
* Retorna el secreto, URL para QR code y códigos de respaldo.
|
|
25216
|
+
*/
|
|
25217
|
+
setupTOTP() {
|
|
25218
|
+
return this.http
|
|
25219
|
+
.post(`${this.baseUrl}/mfa/totp/setup`, {})
|
|
25220
|
+
.pipe(catchError(error => this.handleAuthError(error)));
|
|
25221
|
+
}
|
|
25222
|
+
/**
|
|
25223
|
+
* Verifica el código TOTP y activa MFA.
|
|
25224
|
+
* Debe llamarse después de setupTOTP con el código del authenticator.
|
|
25225
|
+
*/
|
|
25226
|
+
verifyTOTPSetup(code) {
|
|
25227
|
+
return this.http
|
|
25228
|
+
.post(`${this.baseUrl}/mfa/totp/verify`, { code })
|
|
25229
|
+
.pipe(catchError(error => this.handleAuthError(error)));
|
|
25230
|
+
}
|
|
25231
|
+
/**
|
|
25232
|
+
* Regenera los códigos de respaldo TOTP.
|
|
25233
|
+
* Los códigos anteriores son invalidados.
|
|
25234
|
+
*/
|
|
25235
|
+
regenerateBackupCodes() {
|
|
25236
|
+
return this.http
|
|
25237
|
+
.post(`${this.baseUrl}/mfa/totp/backup-codes`, {})
|
|
25238
|
+
.pipe(catchError(error => this.handleAuthError(error)));
|
|
25239
|
+
}
|
|
25240
|
+
/**
|
|
25241
|
+
* Obtiene la cantidad de códigos de respaldo restantes.
|
|
25242
|
+
*/
|
|
25243
|
+
getBackupCodesCount() {
|
|
25244
|
+
return this.http
|
|
25245
|
+
.get(`${this.baseUrl}/mfa/totp/backup-codes/count`)
|
|
25246
|
+
.pipe(catchError(error => this.handleAuthError(error)));
|
|
25247
|
+
}
|
|
25248
|
+
/**
|
|
25249
|
+
* Desactiva TOTP MFA (requiere contraseña).
|
|
25250
|
+
*/
|
|
25251
|
+
disableTOTP(password) {
|
|
25252
|
+
return this.http
|
|
25253
|
+
.post(`${this.baseUrl}/mfa/totp/disable`, { password })
|
|
25254
|
+
.pipe(catchError(error => this.handleAuthError(error)));
|
|
25255
|
+
}
|
|
25256
|
+
// =============================================
|
|
25211
25257
|
// ORGANIZACIONES
|
|
25212
25258
|
// =============================================
|
|
25213
25259
|
/**
|
|
@@ -25754,9 +25800,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
25754
25800
|
* ```
|
|
25755
25801
|
*/
|
|
25756
25802
|
class NotificationsService {
|
|
25757
|
-
constructor(injector, collectionFactory) {
|
|
25803
|
+
constructor(injector, collectionFactory, config) {
|
|
25758
25804
|
this.injector = injector;
|
|
25759
25805
|
this.collectionFactory = collectionFactory;
|
|
25806
|
+
this.config = config;
|
|
25760
25807
|
this.collection = null;
|
|
25761
25808
|
this.currentUserId = null;
|
|
25762
25809
|
// Inyección opcional - AuthService puede no estar configurado
|
|
@@ -25808,7 +25855,12 @@ class NotificationsService {
|
|
|
25808
25855
|
return;
|
|
25809
25856
|
}
|
|
25810
25857
|
this.currentUserId = userId;
|
|
25811
|
-
|
|
25858
|
+
// Construir path correcto basado en appId
|
|
25859
|
+
const basePath = this.config?.appId
|
|
25860
|
+
? `apps/${this.config.appId}/users/${userId}/notifications`
|
|
25861
|
+
: `users/${userId}/notifications`;
|
|
25862
|
+
this.collection = this.collectionFactory.create(basePath, { timestamps: true });
|
|
25863
|
+
console.log('[Notifications] Initialized with path:', basePath);
|
|
25812
25864
|
}
|
|
25813
25865
|
/**
|
|
25814
25866
|
* Verifica si el servicio está inicializado.
|
|
@@ -25904,7 +25956,7 @@ class NotificationsService {
|
|
|
25904
25956
|
this.collection = null;
|
|
25905
25957
|
this.currentUserId = null;
|
|
25906
25958
|
}
|
|
25907
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NotificationsService, deps: [{ token: i0.Injector }, { token: FirestoreCollectionFactory, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
25959
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NotificationsService, deps: [{ token: i0.Injector }, { token: FirestoreCollectionFactory, optional: true }, { token: VALTECH_FIREBASE_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
25908
25960
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NotificationsService, providedIn: 'root' }); }
|
|
25909
25961
|
}
|
|
25910
25962
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: NotificationsService, decorators: [{
|
|
@@ -25912,6 +25964,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
25912
25964
|
args: [{ providedIn: 'root' }]
|
|
25913
25965
|
}], ctorParameters: () => [{ type: i0.Injector }, { type: FirestoreCollectionFactory, decorators: [{
|
|
25914
25966
|
type: Optional
|
|
25967
|
+
}] }, { type: undefined, decorators: [{
|
|
25968
|
+
type: Optional
|
|
25969
|
+
}, {
|
|
25970
|
+
type: Inject,
|
|
25971
|
+
args: [VALTECH_FIREBASE_CONFIG]
|
|
25915
25972
|
}] }] });
|
|
25916
25973
|
|
|
25917
25974
|
/**
|