valtech-components 4.0.229 → 4.0.231

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.
@@ -1,28 +1,21 @@
1
- import { OnDestroy } from '@angular/core';
2
1
  import { MessageReplyTo } from '../../../services/chat/types';
3
2
  import * as i0 from "@angular/core";
4
- interface PendingAttachment {
5
- id: number;
6
- file: File;
7
- url?: string;
8
- isImage: boolean;
9
- }
10
3
  /**
11
4
  * val-chat-composer — barra de redacción de chat moderna (signal inputs).
12
5
  *
13
- * Pill con: adjuntar (+), textarea auto-grow, y mic/enviar (mic cuando está vacío,
14
- * enviar cuando hay texto o adjuntos). Los adjuntos (botón + / pegar imagen) se
15
- * acumulan como PREVIEW (miniaturas) y se emiten por `(attach)` recién al ENVIAR
16
- * no se van solos al chat. Audio grabado se emite directo al parar.
17
- * No incluye picker de emoji: el teclado del sistema ya lo trae.
6
+ * Pill con: adjuntar (+), textarea auto-grow, emoji (fila rápida) y mic/enviar
7
+ * (mic cuando está vacío, enviar cuando hay texto patrón WhatsApp/Telegram).
8
+ * Muestra una barra de contexto "respondiendo a" cuando `replyingTo` está seteado.
9
+ * `typing` se emite con debounce (máx. 1 vez cada 2s) para no spamear writes.
18
10
  */
19
- export declare class ChatComposerComponent implements OnDestroy {
11
+ export declare class ChatComposerComponent {
20
12
  private i18n;
21
13
  readonly placeholder: import("@angular/core").InputSignal<string>;
22
14
  readonly disabled: import("@angular/core").InputSignal<boolean>;
23
15
  readonly maxLength: import("@angular/core").InputSignal<number>;
24
16
  readonly replyingTo: import("@angular/core").InputSignal<MessageReplyTo>;
25
17
  readonly showAttach: import("@angular/core").InputSignal<boolean>;
18
+ readonly showEmoji: import("@angular/core").InputSignal<boolean>;
26
19
  readonly showMic: import("@angular/core").InputSignal<boolean>;
27
20
  readonly send: import("@angular/core").OutputEmitterRef<string>;
28
21
  readonly typing: import("@angular/core").OutputEmitterRef<void>;
@@ -30,15 +23,8 @@ export declare class ChatComposerComponent implements OnDestroy {
30
23
  readonly voice: import("@angular/core").OutputEmitterRef<void>;
31
24
  readonly cancelReply: import("@angular/core").OutputEmitterRef<void>;
32
25
  protected readonly body: import("@angular/core").WritableSignal<string>;
33
- protected readonly pending: import("@angular/core").WritableSignal<PendingAttachment[]>;
34
- private pendingId;
35
- protected readonly recording: import("@angular/core").WritableSignal<boolean>;
36
- private readonly recSeconds;
37
- private recorder?;
38
- private recStream?;
39
- private recChunks;
40
- private recTimer?;
41
- protected readonly recTimeLabel: import("@angular/core").Signal<string>;
26
+ protected readonly emojiOpen: import("@angular/core").WritableSignal<boolean>;
27
+ protected readonly quickEmojis: string[];
42
28
  private lastTypingEmit;
43
29
  constructor();
44
30
  protected readonly canSend: import("@angular/core").Signal<boolean>;
@@ -46,24 +32,15 @@ export declare class ChatComposerComponent implements OnDestroy {
46
32
  protected onInput(event: Event): void;
47
33
  protected onKeydown(event: KeyboardEvent): void;
48
34
  protected onSend(): void;
35
+ protected toggleEmoji(): void;
36
+ protected insertEmoji(emoji: string): void;
49
37
  protected onFile(event: Event): void;
50
- /** Pegar imagen desde el portapapeles (captura de pantalla, copiar imagen). */
51
- protected onPaste(event: ClipboardEvent): void;
52
- private addPending;
53
- protected removePending(id: number): void;
54
38
  /**
55
- * Emite typing como máximo 1 vez cada 2s. performance.now es seguro en runtime.
39
+ * Emite typing como máximo 1 vez cada 2s. No usa Date.now() directo en plantillas
40
+ * de workflow; aquí estamos en runtime de navegador, performance.now es seguro.
56
41
  */
57
42
  private emitTypingDebounced;
58
- /** Selecciona un mimeType de audio soportado por el navegador. */
59
- private pickAudioMime;
60
- protected startRecording(): Promise<void>;
61
- protected stopAndSend(): void;
62
- protected cancelRecording(): void;
63
- private cleanupRecording;
64
- ngOnDestroy(): void;
65
43
  t(key: string): string;
66
44
  static ɵfac: i0.ɵɵFactoryDeclaration<ChatComposerComponent, never>;
67
- static ɵcmp: i0.ɵɵComponentDeclaration<ChatComposerComponent, "val-chat-composer", never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "maxLength": { "alias": "maxLength"; "required": false; "isSignal": true; }; "replyingTo": { "alias": "replyingTo"; "required": false; "isSignal": true; }; "showAttach": { "alias": "showAttach"; "required": false; "isSignal": true; }; "showMic": { "alias": "showMic"; "required": false; "isSignal": true; }; }, { "send": "send"; "typing": "typing"; "attach": "attach"; "voice": "voice"; "cancelReply": "cancelReply"; }, never, never, true, never>;
45
+ static ɵcmp: i0.ɵɵComponentDeclaration<ChatComposerComponent, "val-chat-composer", never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "maxLength": { "alias": "maxLength"; "required": false; "isSignal": true; }; "replyingTo": { "alias": "replyingTo"; "required": false; "isSignal": true; }; "showAttach": { "alias": "showAttach"; "required": false; "isSignal": true; }; "showEmoji": { "alias": "showEmoji"; "required": false; "isSignal": true; }; "showMic": { "alias": "showMic"; "required": false; "isSignal": true; }; }, { "send": "send"; "typing": "typing"; "attach": "attach"; "voice": "voice"; "cancelReply": "cancelReply"; }, never, never, true, never>;
68
46
  }
69
- export {};
@@ -31,7 +31,6 @@ export declare class MessageBubbleComponent {
31
31
  protected readonly time: import("@angular/core").Signal<string>;
32
32
  protected readonly initials: import("@angular/core").Signal<string>;
33
33
  protected readonly imageAttachments: import("@angular/core").Signal<import("valtech-components").MessageAttachment[]>;
34
- protected readonly audioAttachments: import("@angular/core").Signal<import("valtech-components").MessageAttachment[]>;
35
34
  protected readonly fileAttachments: import("@angular/core").Signal<import("valtech-components").MessageAttachment[]>;
36
35
  protected readonly statusIcon: import("@angular/core").Signal<"time-outline" | "alert-circle" | "checkmark-done" | "checkmark">;
37
36
  protected toggleActions(): void;
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { Conversation, ConversationType, CreateConversationRequest, ListConversationsResponse, Message, MessageAttachment, UpdateConversationRequest } from './types';
2
+ import { Conversation, ConversationType, CreateConversationRequest, ListConversationsResponse, Message, UpdateConversationRequest } from './types';
3
3
  import * as i0 from "@angular/core";
4
4
  /**
5
5
  * ConversationService
@@ -75,11 +75,9 @@ export declare class ConversationService {
75
75
  */
76
76
  removeParticipant(convId: string, userId: string): Observable<void>;
77
77
  /**
78
- * Envia un mensaje a una conversacion, opcionalmente con adjuntos.
79
- * El backend espera `attachments: { url, type, name, size }[]` (key `type` = MIME),
80
- * mientras que el front usa `mimeType` — se mapea aqui.
78
+ * Envia un mensaje a una conversacion.
81
79
  */
82
- sendMessage(convId: string, body: string, attachments?: MessageAttachment[]): Observable<Message>;
80
+ sendMessage(convId: string, body: string): Observable<Message>;
83
81
  /**
84
82
  * Elimina (marca como eliminado) un mensaje.
85
83
  */
@@ -1,14 +1,21 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ValtechAuthConfig } from '../auth/types';
3
- import type { PdfGenerateRequest, PdfResult } from './types';
3
+ import type { PdfGenerateRequest, PdfResult, PdfJob, PdfJobEnqueued } from './types';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
- * Servicio para generación de PDFs via el PDF Lambda (/v2/pdf/generate).
6
+ * Servicio de PDF de plataforma (ADR-042). Reutilizable por cualquier app.
7
7
  *
8
8
  * El JWT del usuario se inyecta automáticamente por el authInterceptor
9
9
  * (configurado vía provideValtechAuth). El app-id se toma de ValtechAuthConfig.
10
10
  *
11
- * Modos de uso:
11
+ * Tres modos:
12
+ * - generate() → HTTP sync: genera y devuelve la URL presignada.
13
+ * - createJob() → async: encola un job (delivery.mode='async') y devuelve
14
+ * { jobId, status:'queued' }. El PDF se genera fuera de banda.
15
+ * - watchJob() → observa el estado del job en tiempo real (Firestore),
16
+ * proyectado por el backend al completarse.
17
+ *
18
+ * Fuentes (en los 3 modos):
12
19
  * - source.template → renderiza una plantilla desde DynamoDB
13
20
  * - source.html → HTML arbitrario provisto por el caller
14
21
  * - source.url → URL pública (Puppeteer la carga)
@@ -16,11 +23,26 @@ import * as i0 from "@angular/core";
16
23
  export declare class PdfService {
17
24
  private config;
18
25
  private http;
26
+ private auth;
27
+ private collections;
19
28
  constructor(config: ValtechAuthConfig | null);
20
29
  private get baseUrl();
21
30
  private get appIdHeader();
22
31
  generate(req: PdfGenerateRequest): Observable<PdfResult>;
23
32
  generateAndDownload(req: PdfGenerateRequest, filename?: string): Observable<void>;
33
+ /**
34
+ * Encola un job PDF async. El backend publica `pdf.generate.requested`; el PDF
35
+ * Lambda lo genera fuera de banda y, al completar, proyecta el estado a
36
+ * Firestore. Usar watchJob(jobId) para observar el resultado en tiempo real.
37
+ */
38
+ createJob(req: PdfGenerateRequest): Observable<PdfJobEnqueued>;
39
+ /**
40
+ * Observa el estado de un job PDF async en tiempo real (onSnapshot del doc
41
+ * `apps/{appId}/orgs/{orgId}/pdf-jobs/{jobId}`). Emite null si no hay org
42
+ * activa o hasta que el doc exista. Cuando el job completa/falla, el doc trae
43
+ * status + url. Cierra la suscripción al completar tu propia lógica.
44
+ */
45
+ watchJob(jobId: string): Observable<PdfJob | null>;
24
46
  private _download;
25
47
  static ɵfac: i0.ɵɵFactoryDeclaration<PdfService, [{ optional: true; }]>;
26
48
  static ɵprov: i0.ɵɵInjectableDeclaration<PdfService>;
@@ -1,3 +1,4 @@
1
+ import type { FirestoreDocument } from '../firebase/types';
1
2
  export interface PdfTemplateSource {
2
3
  template: {
3
4
  id: string;
@@ -18,6 +19,8 @@ export interface PdfGenerateOptions {
18
19
  export interface PdfDeliveryOptions {
19
20
  expiresIn?: number;
20
21
  filename?: string;
22
+ /** 'sync' (default) genera y devuelve la URL; 'async' encola un job (ADR-042). */
23
+ mode?: 'sync' | 'async';
21
24
  }
22
25
  export interface PdfGenerateRequest {
23
26
  source: PdfSource;
@@ -30,3 +33,25 @@ export interface PdfResult {
30
33
  url: string;
31
34
  expiresAt: string;
32
35
  }
36
+ export type PdfJobStatus = 'queued' | 'processing' | 'completed' | 'failed';
37
+ /** Respuesta al encolar un job async (ADR-042). */
38
+ export interface PdfJobEnqueued {
39
+ jobId: string;
40
+ status: 'queued';
41
+ }
42
+ /**
43
+ * Estado de un job PDF async proyectado a Firestore por el admin Lambda
44
+ * (apps/{appId}/orgs/{orgId}/pdf-jobs/{jobId}). Lo observa PdfService.watchJob().
45
+ * Extiende FirestoreDocument (id/createdAt/updatedAt los maneja Firestore).
46
+ */
47
+ export interface PdfJob extends FirestoreDocument {
48
+ jobId: string;
49
+ appId: string;
50
+ orgId: string;
51
+ status: PdfJobStatus;
52
+ url?: string;
53
+ s3Key?: string;
54
+ expiresAt?: string;
55
+ elapsedMs?: number;
56
+ caller?: string;
57
+ }
package/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "4.0.229";
5
+ export declare const VERSION = "4.0.231";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "4.0.229",
3
+ "version": "4.0.231",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"