valtech-components 4.0.204 → 4.0.206

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.
Files changed (31) hide show
  1. package/esm2022/lib/components/molecules/load-more/load-more.component.mjs +11 -7
  2. package/esm2022/lib/components/molecules/reaction-bar/reaction-bar.component.mjs +326 -0
  3. package/esm2022/lib/components/molecules/reaction-bar/types.mjs +2 -0
  4. package/esm2022/lib/components/organisms/organization-view/organization-view.component.mjs +4 -1
  5. package/esm2022/lib/components/organisms/switch-org-modal/switch-org-modal.component.mjs +79 -5
  6. package/esm2022/lib/components/organisms/switch-org-modal/switch-org-modal.i18n.mjs +5 -1
  7. package/esm2022/lib/components/organisms/toolbar/toolbar.component.mjs +3 -3
  8. package/esm2022/lib/services/auth/org-switch.service.mjs +11 -1
  9. package/esm2022/lib/services/reactions/config.mjs +22 -0
  10. package/esm2022/lib/services/reactions/index.mjs +3 -0
  11. package/esm2022/lib/services/reactions/reactions.service.mjs +89 -0
  12. package/esm2022/lib/services/reactions/types.mjs +2 -0
  13. package/esm2022/public-api.mjs +5 -3
  14. package/fesm2022/valtech-components.mjs +533 -68
  15. package/fesm2022/valtech-components.mjs.map +1 -1
  16. package/lib/components/molecules/reaction-bar/reaction-bar.component.d.ts +44 -0
  17. package/lib/components/molecules/reaction-bar/types.d.ts +55 -0
  18. package/lib/components/organisms/organization-view/organization-view.component.d.ts +1 -0
  19. package/lib/components/organisms/switch-org-modal/switch-org-modal.component.d.ts +5 -1
  20. package/lib/services/auth/org-switch.service.d.ts +9 -0
  21. package/lib/services/reactions/config.d.ts +20 -0
  22. package/lib/services/reactions/index.d.ts +3 -0
  23. package/lib/services/reactions/reactions.service.d.ts +42 -0
  24. package/lib/services/reactions/types.d.ts +48 -0
  25. package/package.json +1 -1
  26. package/public-api.d.ts +3 -2
  27. package/esm2022/lib/services/pdf/pdf.service.mjs +0 -59
  28. package/esm2022/lib/services/pdf/types.mjs +0 -2
  29. package/lib/services/pdf/pdf.service.d.ts +0 -27
  30. package/lib/services/pdf/types.d.ts +0 -31
  31. package/src/lib/services/firebase/firebase-messaging-sw.js +0 -145
@@ -0,0 +1,44 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { ReactionBarMetadata, ReactionBarEvent, EnrichedReaction } from './types';
3
+ import { ReactionSet } from '../../../services/reactions/types';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Barra de reacciones emoji configurables por contexto.
7
+ *
8
+ * Muestra un set de emojis y permite al usuario reaccionar a una entidad.
9
+ * Soporta conteos, multiples reacciones y modo picker (popup).
10
+ *
11
+ * @example
12
+ * html
13
+ * <val-reaction-bar
14
+ * [props]="{
15
+ * entityRef: { entityType: 'post', entityId: 'p1' },
16
+ * reactionSet: mySet,
17
+ * showCounts: true
18
+ * }"
19
+ * (reactionChange)="onReaction($event)"
20
+ * />
21
+ */
22
+ export declare class ReactionBarComponent implements OnInit {
23
+ props: ReactionBarMetadata;
24
+ reactionChange: EventEmitter<ReactionBarEvent>;
25
+ private reactionsService;
26
+ private i18n;
27
+ protected reactionSet: import("@angular/core").WritableSignal<ReactionSet>;
28
+ protected myReactions: import("@angular/core").WritableSignal<string[]>;
29
+ protected counts: import("@angular/core").WritableSignal<Record<string, number>>;
30
+ protected isLoading: import("@angular/core").WritableSignal<boolean>;
31
+ protected pickerOpen: import("@angular/core").WritableSignal<boolean>;
32
+ protected enrichedReactions: import("@angular/core").Signal<EnrichedReaction[]>;
33
+ constructor();
34
+ ngOnInit(): void;
35
+ private loadSetAndCounts;
36
+ private loadCounts;
37
+ protected onReact(token: string): void;
38
+ protected onReactAndClosePicker(token: string): void;
39
+ protected togglePicker(): void;
40
+ private handleReact;
41
+ protected t(key: string): string;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReactionBarComponent, never>;
43
+ static ɵcmp: i0.ɵɵComponentDeclaration<ReactionBarComponent, "val-reaction-bar", never, { "props": { "alias": "props"; "required": false; }; }, { "reactionChange": "reactionChange"; }, never, never, true, never>;
44
+ }
@@ -0,0 +1,55 @@
1
+ import { ReactionSet } from '../../../services/reactions/types';
2
+ export interface ReactionBarMetadata {
3
+ /** Referencia a la entidad a reaccionar */
4
+ entityRef: {
5
+ entityType: string;
6
+ entityId: string;
7
+ };
8
+ /** ID del set de reacciones a mostrar. Si no se provee, se carga desde el binding. */
9
+ reactionSetId?: string;
10
+ /** Set completo (si ya se tiene, evita fetch) */
11
+ reactionSet?: ReactionSet;
12
+ /** Max reacciones permitidas por usuario: 1=swap, 0=multiples */
13
+ maxReactions?: number;
14
+ /** Tamano visual */
15
+ size?: 'sm' | 'md' | 'lg';
16
+ /** Mostrar conteos numericos junto al emoji */
17
+ showCounts?: boolean;
18
+ /** Layout: row=barra horizontal, picker=popup selector */
19
+ layout?: 'row' | 'picker';
20
+ /** Modo readonly */
21
+ readonly?: boolean;
22
+ /** appId para la API */
23
+ appId?: string;
24
+ /** Reacciones del usuario ya conocidas (evita fetch inicial) */
25
+ initialMyReactions?: string[];
26
+ /** Conteos ya conocidos (evita fetch inicial) */
27
+ initialCounts?: Record<string, number>;
28
+ /** Omitir carga inicial desde API */
29
+ skipInitialLoad?: boolean;
30
+ }
31
+ export interface ReactionBarState {
32
+ reactionSet: ReactionSet | null;
33
+ myReactions: string[];
34
+ counts: Record<string, number>;
35
+ isLoading: boolean;
36
+ error: string | null;
37
+ }
38
+ export interface ReactionBarEvent {
39
+ token: string;
40
+ active: boolean;
41
+ entityRef: {
42
+ entityType: string;
43
+ entityId: string;
44
+ };
45
+ counts: Record<string, number>;
46
+ }
47
+ export interface EnrichedReaction {
48
+ token: string;
49
+ emoji: string;
50
+ label: string;
51
+ icon: string;
52
+ order: number;
53
+ count: number;
54
+ active: boolean;
55
+ }
@@ -38,6 +38,7 @@ export declare class OrganizationViewComponent {
38
38
  private nav;
39
39
  private i18n;
40
40
  readonly auth: AuthService;
41
+ private orgSwitch;
41
42
  private orgService;
42
43
  private toast;
43
44
  private errors;
@@ -32,6 +32,8 @@ export declare class SwitchOrgModalComponent {
32
32
  onProfileClick?: () => void;
33
33
  /** Callback al hacer clic en "Nueva organización". Si está presente, muestra el CTA. */
34
34
  onCreateOrg?: () => void;
35
+ /** Callback al hacer clic en "Administrar" de la org activa. Si está presente, muestra el botón. */
36
+ onManageOrg?: () => void;
35
37
  /** Namespace i18n con que la vista resuelve sus textos. */
36
38
  i18nNamespace: string;
37
39
  readonly orgs: import("@angular/core").WritableSignal<Organization[]>;
@@ -48,6 +50,7 @@ export declare class SwitchOrgModalComponent {
48
50
  protected onLogoError(orgId: string): void;
49
51
  protected readonly userInitials: import("@angular/core").Signal<string>;
50
52
  readonly activeOrgId: import("@angular/core").Signal<string>;
53
+ readonly activeOrg: import("@angular/core").Signal<Organization>;
51
54
  readonly filteredOrgs: import("@angular/core").Signal<Organization[]>;
52
55
  constructor();
53
56
  onQueryChange(value: string): void;
@@ -55,9 +58,10 @@ export declare class SwitchOrgModalComponent {
55
58
  private loadOrgs;
56
59
  loadMore(): void;
57
60
  onProfile(): void;
61
+ onManage(): void;
58
62
  onCreateNew(): void;
59
63
  dismiss(): void;
60
64
  t(key: string): string;
61
65
  static ɵfac: i0.ɵɵFactoryDeclaration<SwitchOrgModalComponent, never>;
62
- static ɵcmp: i0.ɵɵComponentDeclaration<SwitchOrgModalComponent, "val-switch-org-modal", never, { "_modalRef": { "alias": "_modalRef"; "required": false; }; "onSuccess": { "alias": "onSuccess"; "required": false; }; "onProfileClick": { "alias": "onProfileClick"; "required": false; }; "onCreateOrg": { "alias": "onCreateOrg"; "required": false; }; "i18nNamespace": { "alias": "i18nNamespace"; "required": false; }; }, {}, never, never, true, never>;
66
+ static ɵcmp: i0.ɵɵComponentDeclaration<SwitchOrgModalComponent, "val-switch-org-modal", never, { "_modalRef": { "alias": "_modalRef"; "required": false; }; "onSuccess": { "alias": "onSuccess"; "required": false; }; "onProfileClick": { "alias": "onProfileClick"; "required": false; }; "onCreateOrg": { "alias": "onCreateOrg"; "required": false; }; "onManageOrg": { "alias": "onManageOrg"; "required": false; }; "i18nNamespace": { "alias": "i18nNamespace"; "required": false; }; }, {}, never, never, true, never>;
63
67
  }
@@ -1,5 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { AuthService } from './auth.service';
3
+ import { Organization } from '../org/types';
3
4
  import * as i0 from "@angular/core";
4
5
  /**
5
6
  * Event emitted when the active organization changes.
@@ -89,6 +90,7 @@ export declare class OrgSwitchService {
89
90
  private auth;
90
91
  private readonly _switching;
91
92
  private readonly _orgChanged;
93
+ private readonly _orgDataUpdated;
92
94
  /**
93
95
  * `true` while a switch is in flight. UI should disable interactions
94
96
  * with org-scoped data and show a loading indicator.
@@ -102,6 +104,13 @@ export declare class OrgSwitchService {
102
104
  * see the updated Firebase user / activeOrg claim.
103
105
  */
104
106
  readonly orgChanged$: Observable<OrgChangedEvent>;
107
+ /**
108
+ * Fires when org data (name, logoUrl, etc.) changes without a full org switch.
109
+ * Subscribe in the app shell to keep the header org avatar up to date.
110
+ */
111
+ readonly orgDataUpdated$: Observable<Organization>;
112
+ /** Notify subscribers that the active org's data was updated. */
113
+ notifyOrgDataUpdated(org: Organization): void;
105
114
  constructor(auth: AuthService);
106
115
  /**
107
116
  * Switch the user's active organization.
@@ -0,0 +1,20 @@
1
+ import { EnvironmentProviders, InjectionToken } from '@angular/core';
2
+ import { ValtechReactionsConfig } from './types';
3
+ /**
4
+ * Token de inyeccion para la configuracion del servicio de Reactions.
5
+ */
6
+ export declare const VALTECH_REACTIONS_CONFIG: InjectionToken<ValtechReactionsConfig>;
7
+ /**
8
+ * Provee el servicio de reactions a la aplicacion Angular.
9
+ *
10
+ * @param config - Configuracion de reactions
11
+ * @returns EnvironmentProviders para usar en bootstrapApplication
12
+ *
13
+ * @example
14
+ * bootstrapApplication(AppComponent, {
15
+ * providers: [
16
+ * provideValtechReactions({ apiUrl: environment.apiUrl, appId: 'my-app' }),
17
+ * ],
18
+ * });
19
+ */
20
+ export declare function provideValtechReactions(config: ValtechReactionsConfig): EnvironmentProviders;
@@ -0,0 +1,3 @@
1
+ export { VALTECH_REACTIONS_CONFIG, provideValtechReactions } from './config';
2
+ export { ReactionsService } from './reactions.service';
3
+ export type { ValtechReactionsConfig, ReactionSetContext, ReactionDefinition, ReactionSet, ReactionCounts, ReactRequest, ReactResponse, GetCountsResponse, GetMyReactionsResponse, } from './types';
@@ -0,0 +1,42 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ReactRequest, ReactResponse, GetCountsResponse, ReactionSet } from './types';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Servicio para gestionar reacciones emoji configurables por contexto.
6
+ *
7
+ * Requiere provideValtechReactions() en el bootstrap de la app.
8
+ *
9
+ * @example
10
+ * const svc = inject(ReactionsService);
11
+ * svc.react({ entityRef: { entityType: 'post', entityId: '1' }, token: 'heart', appId: 'app' })
12
+ * .subscribe(res => console.log(res.counts));
13
+ */
14
+ export declare class ReactionsService {
15
+ private http;
16
+ private config;
17
+ constructor();
18
+ private get apiUrl();
19
+ private get baseUrl();
20
+ /**
21
+ * Toggle reaccion — retorna estado nuevo + conteos actualizados.
22
+ */
23
+ react(req: ReactRequest): Observable<ReactResponse>;
24
+ /**
25
+ * Conteos + reacciones del usuario para una entidad.
26
+ */
27
+ getCounts(appId: string, entityType: string, entityId: string): Observable<GetCountsResponse>;
28
+ /**
29
+ * Solo mis tokens activos para una entidad.
30
+ */
31
+ getMyReactions(appId: string, entityType: string, entityId: string): Observable<string[]>;
32
+ /**
33
+ * Obtener un set de reacciones por ID.
34
+ */
35
+ getSet(setId: string): Observable<ReactionSet>;
36
+ /**
37
+ * Listar todos los sets disponibles para una app.
38
+ */
39
+ listSets(appId: string): Observable<ReactionSet[]>;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReactionsService, never>;
41
+ static ɵprov: i0.ɵɵInjectableDeclaration<ReactionsService>;
42
+ }
@@ -0,0 +1,48 @@
1
+ export type ReactionSetContext = 'formal' | 'social' | 'celebration' | 'opinion' | 'custom';
2
+ export interface ReactionDefinition {
3
+ token: string;
4
+ emoji: string;
5
+ label: string;
6
+ icon: string;
7
+ order: number;
8
+ }
9
+ export interface ReactionSet {
10
+ setId: string;
11
+ appId: string;
12
+ name: string;
13
+ context: ReactionSetContext;
14
+ reactions: ReactionDefinition[];
15
+ isPreset: boolean;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ }
19
+ export interface ReactionCounts {
20
+ counts: Record<string, number>;
21
+ }
22
+ export interface ReactRequest {
23
+ entityRef: {
24
+ entityType: string;
25
+ entityId: string;
26
+ };
27
+ token: string;
28
+ appId: string;
29
+ }
30
+ export interface ReactResponse {
31
+ operationId: string;
32
+ token: string;
33
+ active: boolean;
34
+ counts: Record<string, number>;
35
+ }
36
+ export interface GetCountsResponse {
37
+ operationId: string;
38
+ counts: Record<string, number>;
39
+ myReactions: string[];
40
+ }
41
+ export interface GetMyReactionsResponse {
42
+ operationId: string;
43
+ tokens: string[];
44
+ }
45
+ export interface ValtechReactionsConfig {
46
+ apiUrl: string;
47
+ appId?: string;
48
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "4.0.204",
3
+ "version": "4.0.206",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
package/public-api.d.ts CHANGED
@@ -350,8 +350,6 @@ export * from './lib/components/templates/maintenance-page/types';
350
350
  export * from './lib/components/templates/auth-background/auth-background.component';
351
351
  export * from './lib/components/templates/auth-background/types';
352
352
  export * from './lib/services/download.service';
353
- export * from './lib/services/pdf/pdf.service';
354
- export * from './lib/services/pdf/types';
355
353
  export * from './lib/services/icons.service';
356
354
  export * from './lib/services/in-app-browser.service';
357
355
  export * from './lib/services/link-processor.service';
@@ -412,6 +410,9 @@ export * from './lib/components/molecules/request-form/request-form.component';
412
410
  export * from './lib/components/molecules/request-form/types';
413
411
  export * from './lib/components/molecules/content-reaction/content-reaction.component';
414
412
  export * from './lib/components/molecules/content-reaction/types';
413
+ export * from './lib/services/reactions/index';
414
+ export * from './lib/components/molecules/reaction-bar/reaction-bar.component';
415
+ export * from './lib/components/molecules/reaction-bar/types';
415
416
  export * from './lib/services/splash-screen';
416
417
  export * from './lib/services/haptics';
417
418
  export * from './lib/components/templates/docs-layout/docs-layout.component';
@@ -1,59 +0,0 @@
1
- import { inject, Injectable, Optional, Inject } from '@angular/core';
2
- import { HttpClient } from '@angular/common/http';
3
- import { switchMap, from } from 'rxjs';
4
- import { VALTECH_AUTH_CONFIG } from '../auth/config';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * Servicio para generación de PDFs via el PDF Lambda (/v2/pdf/generate).
8
- *
9
- * El JWT del usuario se inyecta automáticamente por el authInterceptor
10
- * (configurado vía provideValtechAuth). El app-id se toma de ValtechAuthConfig.
11
- *
12
- * Modos de uso:
13
- * - source.template → renderiza una plantilla desde DynamoDB
14
- * - source.html → HTML arbitrario provisto por el caller
15
- * - source.url → URL pública (Puppeteer la carga)
16
- */
17
- export class PdfService {
18
- constructor(config) {
19
- this.config = config;
20
- this.http = inject(HttpClient);
21
- }
22
- get baseUrl() {
23
- return `${this.config?.apiUrl ?? ''}/v2/pdf`;
24
- }
25
- get appIdHeader() {
26
- const appId = this.config?.appId;
27
- return appId ? { 'x-app-id': appId } : {};
28
- }
29
- generate(req) {
30
- return this.http.post(`${this.baseUrl}/generate`, req, {
31
- headers: this.appIdHeader,
32
- });
33
- }
34
- generateAndDownload(req, filename = 'documento.pdf') {
35
- return this.generate(req).pipe(switchMap(result => from(this._download(result.url, filename))));
36
- }
37
- async _download(url, filename) {
38
- const res = await fetch(url);
39
- const blob = await res.blob();
40
- const objUrl = URL.createObjectURL(blob);
41
- const a = document.createElement('a');
42
- a.href = objUrl;
43
- a.download = filename;
44
- a.click();
45
- URL.revokeObjectURL(objUrl);
46
- }
47
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PdfService, deps: [{ token: VALTECH_AUTH_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
48
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PdfService, providedIn: 'root' }); }
49
- }
50
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: PdfService, decorators: [{
51
- type: Injectable,
52
- args: [{ providedIn: 'root' }]
53
- }], ctorParameters: () => [{ type: undefined, decorators: [{
54
- type: Optional
55
- }, {
56
- type: Inject,
57
- args: [VALTECH_AUTH_CONFIG]
58
- }] }] });
59
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGRmLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbGliL3NlcnZpY2VzL3BkZi9wZGYuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3JFLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUNsRCxPQUFPLEVBQWMsU0FBUyxFQUFFLElBQUksRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUNuRCxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7QUFJckQ7Ozs7Ozs7Ozs7R0FVRztBQUVILE1BQU0sT0FBTyxVQUFVO0lBR3JCLFlBQTZELE1BQWdDO1FBQWhDLFdBQU0sR0FBTixNQUFNLENBQTBCO1FBRnJGLFNBQUksR0FBRyxNQUFNLENBQUMsVUFBVSxDQUFDLENBQUM7SUFFOEQsQ0FBQztJQUVqRyxJQUFZL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RmUmVzdWx0IHtcbiAgam9iSWQ6IHN0cmluZztcbiAgc3RhdHVzOiAnY29tcGxldGVkJztcbiAgdXJsOiBzdHJpbmc7XG4gIGV4cGlyZXNBdDogc3RyaW5nO1xufVxuIl19
@@ -1,27 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { ValtechAuthConfig } from '../auth/types';
3
- import type { PdfGenerateRequest, PdfResult } from './types';
4
- import * as i0 from "@angular/core";
5
- /**
6
- * Servicio para generación de PDFs via el PDF Lambda (/v2/pdf/generate).
7
- *
8
- * El JWT del usuario se inyecta automáticamente por el authInterceptor
9
- * (configurado vía provideValtechAuth). El app-id se toma de ValtechAuthConfig.
10
- *
11
- * Modos de uso:
12
- * - source.template → renderiza una plantilla desde DynamoDB
13
- * - source.html → HTML arbitrario provisto por el caller
14
- * - source.url → URL pública (Puppeteer la carga)
15
- */
16
- export declare class PdfService {
17
- private config;
18
- private http;
19
- constructor(config: ValtechAuthConfig | null);
20
- private get baseUrl();
21
- private get appIdHeader();
22
- generate(req: PdfGenerateRequest): Observable<PdfResult>;
23
- generateAndDownload(req: PdfGenerateRequest, filename?: string): Observable<void>;
24
- private _download;
25
- static ɵfac: i0.ɵɵFactoryDeclaration<PdfService, [{ optional: true; }]>;
26
- static ɵprov: i0.ɵɵInjectableDeclaration<PdfService>;
27
- }
@@ -1,31 +0,0 @@
1
- export interface PdfTemplateSource {
2
- template: {
3
- id: string;
4
- language: string;
5
- data: Record<string, string>;
6
- };
7
- }
8
- export interface PdfHtmlSource {
9
- html: string;
10
- }
11
- export interface PdfUrlSource {
12
- url: string;
13
- }
14
- export type PdfSource = PdfTemplateSource | PdfHtmlSource | PdfUrlSource;
15
- export interface PdfGenerateOptions {
16
- format?: 'A4' | 'Letter';
17
- }
18
- export interface PdfDeliveryOptions {
19
- expiresIn?: number;
20
- }
21
- export interface PdfGenerateRequest {
22
- source: PdfSource;
23
- output?: PdfGenerateOptions;
24
- delivery?: PdfDeliveryOptions;
25
- }
26
- export interface PdfResult {
27
- jobId: string;
28
- status: 'completed';
29
- url: string;
30
- expiresAt: string;
31
- }
@@ -1,145 +0,0 @@
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
- }