valtech-components 2.0.857 → 2.0.859
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/molecules/feedback-form/feedback-form.component.mjs +153 -268
- package/esm2022/lib/components/molecules/feedback-form/types.mjs +1 -1
- package/esm2022/lib/components/molecules/textarea-input/textarea-input.component.mjs +3 -3
- package/esm2022/lib/components/organisms/attachment-uploader/attachment-uploader.component.mjs +77 -0
- package/esm2022/lib/components/organisms/attachment-uploader/types.mjs +2 -0
- package/esm2022/lib/components/organisms/mfa-modal/mfa-modal.component.mjs +39 -4
- package/esm2022/lib/components/organisms/toolbar/toolbar.component.mjs +5 -5
- package/esm2022/lib/components/organisms/wizard/types.mjs +1 -1
- package/esm2022/lib/components/organisms/wizard/wizard.component.mjs +13 -37
- package/esm2022/lib/components/types.mjs +1 -1
- package/esm2022/lib/services/auth/auth.service.mjs +6 -1
- package/esm2022/lib/services/i18n/default-content.mjs +19 -1
- package/esm2022/lib/services/icons.service.mjs +3 -2
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/valtech-components.mjs +929 -934
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/molecules/feedback-form/feedback-form.component.d.ts +8 -39
- package/lib/components/molecules/feedback-form/types.d.ts +1 -0
- package/lib/components/organisms/attachment-uploader/attachment-uploader.component.d.ts +23 -0
- package/lib/components/organisms/attachment-uploader/types.d.ts +12 -0
- package/lib/components/organisms/mfa-modal/mfa-modal.component.d.ts +9 -1
- package/lib/components/organisms/wizard/types.d.ts +3 -3
- package/lib/components/organisms/wizard/wizard.component.d.ts +2 -1
- package/lib/components/types.d.ts +2 -0
- package/lib/services/auth/auth.service.d.ts +3 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
- package/src/lib/services/firebase/firebase-messaging-sw.js +145 -0
|
@@ -1,57 +1,26 @@
|
|
|
1
1
|
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
2
|
import { I18nService } from '../../../services/i18n';
|
|
3
|
-
import {
|
|
3
|
+
import { FormMetadata, FormSubmit } from '../../types';
|
|
4
|
+
import { AttachmentItem } from '../../organisms/attachment-uploader/types';
|
|
4
5
|
import { FeedbackFormMetadata, FeedbackSubmitEvent } from './types';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
|
-
/**
|
|
7
|
-
* val-feedback-form
|
|
8
|
-
*
|
|
9
|
-
* Formulario reutilizable para enviar feedback desde cualquier parte de la aplicación.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```html
|
|
13
|
-
* <!-- Feedback general -->
|
|
14
|
-
* <val-feedback-form
|
|
15
|
-
* [props]="{ defaultType: 'feedback', showTypeSelector: true }"
|
|
16
|
-
* (onSubmit)="handleSuccess($event)"
|
|
17
|
-
* (onCancel)="closeModal()"
|
|
18
|
-
* />
|
|
19
|
-
*
|
|
20
|
-
* <!-- Reportar contenido incorrecto -->
|
|
21
|
-
* <val-feedback-form
|
|
22
|
-
* [props]="{
|
|
23
|
-
* defaultType: 'poor-content',
|
|
24
|
-
* showTypeSelector: false,
|
|
25
|
-
* contentRef: { contentId: article.id, contentType: 'article' },
|
|
26
|
-
* submitButtonText: 'Reportar contenido'
|
|
27
|
-
* }"
|
|
28
|
-
* />
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
7
|
export declare class FeedbackFormComponent implements OnInit {
|
|
32
|
-
/**
|
|
33
|
-
* Configuración del formulario.
|
|
34
|
-
*/
|
|
35
8
|
props: FeedbackFormMetadata;
|
|
36
|
-
/**
|
|
37
|
-
* Evento emitido cuando el feedback se envía exitosamente.
|
|
38
|
-
*/
|
|
39
9
|
onSubmit: EventEmitter<FeedbackSubmitEvent>;
|
|
40
|
-
/**
|
|
41
|
-
* Evento emitido cuando el usuario cancela.
|
|
42
|
-
*/
|
|
43
10
|
onCancel: EventEmitter<void>;
|
|
44
|
-
private fb;
|
|
45
|
-
private feedbackService;
|
|
46
11
|
protected i18n: I18nService;
|
|
47
|
-
|
|
12
|
+
private feedbackService;
|
|
13
|
+
formProps: FormMetadata;
|
|
48
14
|
typeOptions: import("../../../services/feedback").FeedbackTypeOption[];
|
|
49
15
|
isSubmitting: import("@angular/core").WritableSignal<boolean>;
|
|
50
16
|
isSuccess: import("@angular/core").WritableSignal<boolean>;
|
|
51
17
|
error: import("@angular/core").WritableSignal<string>;
|
|
18
|
+
private currentAttachments;
|
|
52
19
|
constructor();
|
|
53
20
|
ngOnInit(): void;
|
|
54
|
-
|
|
21
|
+
private buildFormProps;
|
|
22
|
+
handleFormSubmit(submitted: FormSubmit): Promise<void>;
|
|
23
|
+
onAttachmentsChange(items: AttachmentItem[]): void;
|
|
55
24
|
onCancelClick(): void;
|
|
56
25
|
static ɵfac: i0.ɵɵFactoryDeclaration<FeedbackFormComponent, never>;
|
|
57
26
|
static ɵcmp: i0.ɵɵComponentDeclaration<FeedbackFormComponent, "val-feedback-form", never, { "props": { "alias": "props"; "required": false; }; }, { "onSubmit": "onSubmit"; "onCancel": "onCancel"; }, never, never, true, never>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { I18nService } from '../../../services/i18n';
|
|
2
|
+
import { AttachmentItem, AttachmentUploaderMetadata } from './types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class AttachmentUploaderComponent {
|
|
5
|
+
props: import("@angular/core").InputSignal<AttachmentUploaderMetadata>;
|
|
6
|
+
attachmentsChange: import("@angular/core").OutputEmitterRef<AttachmentItem[]>;
|
|
7
|
+
protected i18n: I18nService;
|
|
8
|
+
private feedbackService;
|
|
9
|
+
attachments: import("@angular/core").WritableSignal<AttachmentItem[]>;
|
|
10
|
+
maxFiles: import("@angular/core").Signal<number>;
|
|
11
|
+
accept: import("@angular/core").Signal<string>;
|
|
12
|
+
maxReached: import("@angular/core").Signal<boolean>;
|
|
13
|
+
isDisabled: import("@angular/core").Signal<boolean>;
|
|
14
|
+
isUploading: import("@angular/core").Signal<boolean>;
|
|
15
|
+
get readyUrls(): string[];
|
|
16
|
+
constructor();
|
|
17
|
+
onFilesSelected(event: Event): Promise<void>;
|
|
18
|
+
private uploadFile;
|
|
19
|
+
remove(id: string): void;
|
|
20
|
+
formatSize(bytes: number): string;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AttachmentUploaderComponent, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AttachmentUploaderComponent, "val-attachment-uploader", never, { "props": { "alias": "props"; "required": false; "isSignal": true; }; }, { "attachmentsChange": "attachmentsChange"; }, never, never, true, never>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface AttachmentItem {
|
|
2
|
+
id: string;
|
|
3
|
+
file: File;
|
|
4
|
+
status: 'uploading' | 'ready' | 'error';
|
|
5
|
+
url?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AttachmentUploaderMetadata {
|
|
9
|
+
maxFiles?: number;
|
|
10
|
+
accept?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
@@ -48,6 +48,12 @@ export declare class MfaModalComponent implements OnDestroy {
|
|
|
48
48
|
prefillCode?: string;
|
|
49
49
|
/** Emite cuando el estado MFA cambia (habilitado / deshabilitado). */
|
|
50
50
|
changed: EventEmitter<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Emitido cuando un setup MFA se confirma exitosamente y el modal fue abierto
|
|
53
|
+
* vía deep-link (con `prefillCode`). El host puede usarlo para cerrar el
|
|
54
|
+
* modal y navegar (ej. a home) en lugar de quedarse en la página de Security.
|
|
55
|
+
*/
|
|
56
|
+
enabledViaDeeplink: EventEmitter<void>;
|
|
51
57
|
/** Emite cuando el user cierra el modal (botón X o backdrop). */
|
|
52
58
|
dismissed: EventEmitter<void>;
|
|
53
59
|
private auth;
|
|
@@ -74,6 +80,7 @@ export declare class MfaModalComponent implements OnDestroy {
|
|
|
74
80
|
/** Marca momentánea cuando el secreto TOTP se acaba de copiar (feedback visual). */
|
|
75
81
|
readonly copiedSecret: import("@angular/core").WritableSignal<boolean>;
|
|
76
82
|
readonly resendCooldown: import("@angular/core").WritableSignal<number>;
|
|
83
|
+
readonly disableCodeSent: import("@angular/core").WritableSignal<boolean>;
|
|
77
84
|
readonly pinControl: FormControl<string>;
|
|
78
85
|
readonly phoneControl: FormControl<string>;
|
|
79
86
|
readonly pinInputProps: {
|
|
@@ -119,6 +126,7 @@ export declare class MfaModalComponent implements OnDestroy {
|
|
|
119
126
|
onDisableSubmit(event: FormSubmit): void;
|
|
120
127
|
/** Deshabilita MFA usando un código TOTP — para cuentas OAuth-only sin contraseña. */
|
|
121
128
|
disableWithMfaCode(): void;
|
|
129
|
+
sendDisableCode(): void;
|
|
122
130
|
private disable;
|
|
123
131
|
/** Copia una lista de códigos de respaldo al portapapeles. */
|
|
124
132
|
copyCodes(codes: string[]): Promise<void>;
|
|
@@ -133,6 +141,6 @@ export declare class MfaModalComponent implements OnDestroy {
|
|
|
133
141
|
private resolveError;
|
|
134
142
|
private showToast;
|
|
135
143
|
static ɵfac: i0.ɵɵFactoryDeclaration<MfaModalComponent, never>;
|
|
136
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<MfaModalComponent, "val-mfa-modal", never, { "isOpen": { "alias": "isOpen"; "required": false; }; "prefillCode": { "alias": "prefillCode"; "required": false; }; }, { "changed": "changed"; "dismissed": "dismissed"; }, never, never, true, never>;
|
|
144
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MfaModalComponent, "val-mfa-modal", never, { "isOpen": { "alias": "isOpen"; "required": false; }; "prefillCode": { "alias": "prefillCode"; "required": false; }; }, { "changed": "changed"; "enabledViaDeeplink": "enabledViaDeeplink"; "dismissed": "dismissed"; }, never, never, true, never>;
|
|
137
145
|
}
|
|
138
146
|
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Permiten definir los pasos, botones, estado y navegación del wizard.
|
|
4
4
|
*/
|
|
5
5
|
import { ButtonMetadata, ComponentState } from '../../types';
|
|
6
|
-
import {
|
|
6
|
+
import { EmptyStateMetadata } from '../../molecules/empty-state/types';
|
|
7
7
|
/**
|
|
8
8
|
* Metadatos del wizard.
|
|
9
9
|
* @property state Estado global del wizard.
|
|
@@ -19,11 +19,11 @@ export type WizardMetadata = {
|
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
21
|
* Representa un paso del wizard.
|
|
22
|
-
* @property titles Metadatos
|
|
22
|
+
* @property titles Metadatos del empty-state para el encabezado del paso.
|
|
23
23
|
* @property buttons Botones disponibles en el paso.
|
|
24
24
|
*/
|
|
25
25
|
export type Step = {
|
|
26
|
-
titles:
|
|
26
|
+
titles: EmptyStateMetadata;
|
|
27
27
|
buttons: ButtonMetadata[];
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { EmptyStateMetadata } from '../../molecules/empty-state/types';
|
|
2
3
|
import { MOTION, Step, WizardMetadata } from './types';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class WizardComponent implements OnInit, OnChanges {
|
|
@@ -9,7 +10,7 @@ export declare class WizardComponent implements OnInit, OnChanges {
|
|
|
9
10
|
}>;
|
|
10
11
|
wrapperId: string;
|
|
11
12
|
currentStep: Step | null;
|
|
12
|
-
currentStepTitles:
|
|
13
|
+
currentStepTitles: EmptyStateMetadata;
|
|
13
14
|
loadingText: string;
|
|
14
15
|
private cdr;
|
|
15
16
|
ngOnInit(): void;
|
|
@@ -226,6 +226,8 @@ export type ToolbarAction = {
|
|
|
226
226
|
avatarUrl?: string;
|
|
227
227
|
handle?: string;
|
|
228
228
|
} | null;
|
|
229
|
+
/** Controls avatar size when type is AVATAR. Defaults to 'small'. */
|
|
230
|
+
avatarSize?: 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
229
231
|
};
|
|
230
232
|
/**
|
|
231
233
|
* Metadata for an icon.
|
|
@@ -217,6 +217,9 @@ export declare class AuthService implements OnDestroy {
|
|
|
217
217
|
* `mfaCode` es para usuarios OAuth-only con TOTP que no tienen contraseña.
|
|
218
218
|
*/
|
|
219
219
|
disableMFA(input: MFADisableRequest): Observable<MFADisableResponse>;
|
|
220
|
+
sendMFADisableCode(): Observable<{
|
|
221
|
+
operationId: string;
|
|
222
|
+
}>;
|
|
220
223
|
/**
|
|
221
224
|
* Inicia configuración de TOTP MFA.
|
|
222
225
|
* Retorna el secreto, URL para QR code y códigos de respaldo.
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -179,6 +179,8 @@ export * from './lib/components/molecules/empty-state/factory';
|
|
|
179
179
|
export * from './lib/components/molecules/empty-state/types';
|
|
180
180
|
export * from './lib/components/molecules/image-crop/image-crop.component';
|
|
181
181
|
export * from './lib/components/molecules/modal-shell/modal-shell.component';
|
|
182
|
+
export * from './lib/components/organisms/attachment-uploader/attachment-uploader.component';
|
|
183
|
+
export * from './lib/components/organisms/attachment-uploader/types';
|
|
182
184
|
export * from './lib/components/organisms/article/article.component';
|
|
183
185
|
export * from './lib/components/organisms/article/types';
|
|
184
186
|
export * from './lib/components/organisms/banner/banner.component';
|
|
@@ -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
|
+
}
|