valtech-components 4.0.207 → 4.0.209
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/load-more/load-more.component.mjs +7 -11
- package/esm2022/lib/components/organisms/organization-view/organization-view.component.mjs +9 -12
- package/esm2022/lib/components/organisms/switch-org-modal/switch-org-modal.component.mjs +5 -79
- package/esm2022/lib/components/organisms/switch-org-modal/switch-org-modal.i18n.mjs +1 -5
- package/esm2022/lib/components/organisms/toolbar/toolbar.component.mjs +3 -3
- package/esm2022/lib/components/templates/page-wrapper/page-wrapper.component.mjs +88 -10
- package/esm2022/lib/components/templates/page-wrapper/types.mjs +1 -1
- package/esm2022/lib/services/auth/org-switch.service.mjs +1 -11
- package/esm2022/lib/services/pdf/pdf.service.mjs +59 -0
- package/esm2022/lib/services/pdf/types.mjs +2 -0
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +3 -5
- package/fesm2022/valtech-components.mjs +163 -550
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/atoms/rights-footer/rights-footer.component.d.ts +2 -2
- package/lib/components/molecules/cta-card/cta-card.component.d.ts +1 -1
- package/lib/components/molecules/features-list/features-list.component.d.ts +1 -1
- package/lib/components/molecules/load-more/load-more.component.d.ts +1 -1
- package/lib/components/molecules/metric-card/metric-card.component.d.ts +1 -1
- package/lib/components/organisms/account-view/account-view.component.d.ts +1 -1
- package/lib/components/organisms/article/article.component.d.ts +5 -5
- package/lib/components/organisms/auth-cta/auth-cta.component.d.ts +1 -1
- package/lib/components/organisms/landing-steps/landing-steps.component.d.ts +1 -1
- package/lib/components/organisms/organization-view/organization-view.component.d.ts +1 -2
- package/lib/components/organisms/switch-org-modal/switch-org-modal.component.d.ts +1 -5
- package/lib/components/templates/page-wrapper/page-wrapper.component.d.ts +3 -1
- package/lib/components/templates/page-wrapper/types.d.ts +17 -0
- package/lib/services/auth/org-switch.service.d.ts +0 -9
- package/lib/services/pdf/pdf.service.d.ts +27 -0
- package/lib/services/pdf/types.d.ts +31 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -3
- package/src/lib/services/firebase/firebase-messaging-sw.js +145 -0
- package/esm2022/lib/components/molecules/reaction-bar/reaction-bar.component.mjs +0 -326
- package/esm2022/lib/components/molecules/reaction-bar/types.mjs +0 -2
- package/esm2022/lib/services/reactions/config.mjs +0 -22
- package/esm2022/lib/services/reactions/index.mjs +0 -3
- package/esm2022/lib/services/reactions/reactions.service.mjs +0 -89
- package/esm2022/lib/services/reactions/types.mjs +0 -2
- package/lib/components/molecules/reaction-bar/reaction-bar.component.d.ts +0 -44
- package/lib/components/molecules/reaction-bar/types.d.ts +0 -55
- package/lib/services/reactions/config.d.ts +0 -20
- package/lib/services/reactions/index.d.ts +0 -3
- package/lib/services/reactions/reactions.service.d.ts +0 -42
- package/lib/services/reactions/types.d.ts +0 -48
|
@@ -39,11 +39,11 @@ export declare class RightsFooterComponent {
|
|
|
39
39
|
/**
|
|
40
40
|
* Computed helper for align prop in template.
|
|
41
41
|
*/
|
|
42
|
-
propsAlign: import("@angular/core").Signal<"
|
|
42
|
+
propsAlign: import("@angular/core").Signal<"left" | "center" | "right">;
|
|
43
43
|
/**
|
|
44
44
|
* Computed helper for color prop in template.
|
|
45
45
|
*/
|
|
46
|
-
propsColor: import("@angular/core").Signal<"
|
|
46
|
+
propsColor: import("@angular/core").Signal<"success" | "medium" | "primary" | "secondary" | "tertiary" | "warning" | "danger" | "light" | "dark">;
|
|
47
47
|
/**
|
|
48
48
|
* Computed helper for withMargin prop in template.
|
|
49
49
|
*/
|
|
@@ -35,7 +35,7 @@ export declare class CtaCardComponent {
|
|
|
35
35
|
/** Emitted with the token of the clicked action button */
|
|
36
36
|
onAction: EventEmitter<string>;
|
|
37
37
|
/** Merged configuration with defaults */
|
|
38
|
-
config: import("@angular/core").Signal<CtaCardMetadata & Required<Pick<CtaCardMetadata, "
|
|
38
|
+
config: import("@angular/core").Signal<CtaCardMetadata & Required<Pick<CtaCardMetadata, "borderRadius" | "bordered" | "shadowed" | "align" | "padding">>>;
|
|
39
39
|
getBackground(): string;
|
|
40
40
|
getColor(): string | null;
|
|
41
41
|
static ɵfac: i0.ɵɵFactoryDeclaration<CtaCardComponent, never>;
|
|
@@ -42,7 +42,7 @@ export declare class FeaturesListComponent {
|
|
|
42
42
|
iconSize: number;
|
|
43
43
|
mode: "horizontal" | "vertical";
|
|
44
44
|
gap: "small" | "medium" | "large";
|
|
45
|
-
alignment: "
|
|
45
|
+
alignment: "center" | "start";
|
|
46
46
|
imageShape: "circle" | "square";
|
|
47
47
|
maxVisible: number;
|
|
48
48
|
showMoreLabel?: string;
|
|
@@ -26,7 +26,7 @@ export declare class LoadMoreComponent {
|
|
|
26
26
|
readonly color: import("@angular/core").Signal<string>;
|
|
27
27
|
readonly fill: import("@angular/core").Signal<string>;
|
|
28
28
|
readonly shape: import("@angular/core").Signal<string>;
|
|
29
|
-
readonly size: import("@angular/core").Signal<"
|
|
29
|
+
readonly size: import("@angular/core").Signal<"default" | "small" | "large">;
|
|
30
30
|
readonly threshold: import("@angular/core").Signal<string>;
|
|
31
31
|
readonly label: import("@angular/core").Signal<string>;
|
|
32
32
|
private readonly _pendingComplete;
|
|
@@ -28,7 +28,7 @@ export declare class MetricCardComponent {
|
|
|
28
28
|
/** Emitted with the token of the clicked action */
|
|
29
29
|
onAction: EventEmitter<string>;
|
|
30
30
|
/** Merged configuration with defaults */
|
|
31
|
-
config: import("@angular/core").Signal<MetricCardMetadata & Required<Pick<MetricCardMetadata, "
|
|
31
|
+
config: import("@angular/core").Signal<MetricCardMetadata & Required<Pick<MetricCardMetadata, "borderRadius" | "bordered" | "shadowed" | "padding">>>;
|
|
32
32
|
static ɵfac: i0.ɵɵFactoryDeclaration<MetricCardComponent, never>;
|
|
33
33
|
static ɵcmp: i0.ɵɵComponentDeclaration<MetricCardComponent, "val-metric-card", never, { "props": { "alias": "props"; "required": false; "isSignal": true; }; }, { "onAction": "onAction"; }, never, never, true, never>;
|
|
34
34
|
}
|
|
@@ -35,7 +35,7 @@ export declare class AccountViewComponent {
|
|
|
35
35
|
* mergea con los defaults — `@Input` gana sobre route data.
|
|
36
36
|
*/
|
|
37
37
|
config?: AccountViewConfig;
|
|
38
|
-
readonly resolvedConfig: import("@angular/core").Signal<Required<Omit<AccountViewConfig, "
|
|
38
|
+
readonly resolvedConfig: import("@angular/core").Signal<Required<Omit<AccountViewConfig, "onOrgSwitched" | "onOrgCreated" | "onLoggedOut" | "onAccountDeleted">> & Pick<AccountViewConfig, "onOrgSwitched" | "onOrgCreated" | "onLoggedOut" | "onAccountDeleted">>;
|
|
39
39
|
/** Namespace i18n resuelto (capturado para llamadas no-reactivas). */
|
|
40
40
|
private get ns();
|
|
41
41
|
readonly orgs: import("@angular/core").WritableSignal<Organization[]>;
|
|
@@ -57,7 +57,7 @@ export declare class ArticleComponent implements OnInit {
|
|
|
57
57
|
linkConfig?: import("valtech-components").LinkProcessorConfig;
|
|
58
58
|
allowPartialBold?: boolean;
|
|
59
59
|
authorColor?: import("@ionic/core").Color;
|
|
60
|
-
alignment?: "
|
|
60
|
+
alignment?: "left" | "center" | "right";
|
|
61
61
|
showQuoteMark?: boolean;
|
|
62
62
|
};
|
|
63
63
|
getHighlightTextProps(element: ArticleElement): {
|
|
@@ -78,7 +78,7 @@ export declare class ArticleComponent implements OnInit {
|
|
|
78
78
|
actionType?: import("valtech-components").ActionType; /**
|
|
79
79
|
* Obtiene los estilos de padding para el contenedor article
|
|
80
80
|
*/
|
|
81
|
-
expand?: "
|
|
81
|
+
expand?: "full" | "block";
|
|
82
82
|
link?: string;
|
|
83
83
|
href?: string;
|
|
84
84
|
routerLink?: string | any[];
|
|
@@ -93,9 +93,9 @@ export declare class ArticleComponent implements OnInit {
|
|
|
93
93
|
contentInterpolation?: Record<string, string | number>;
|
|
94
94
|
icon?: import("valtech-components").IconMetada;
|
|
95
95
|
shape?: "round";
|
|
96
|
-
size?: "
|
|
97
|
-
fill?: "
|
|
98
|
-
type: "
|
|
96
|
+
size?: "default" | "small" | "large";
|
|
97
|
+
fill?: "default" | "clear" | "outline" | "solid";
|
|
98
|
+
type: "reset" | "submit" | "button";
|
|
99
99
|
token?: string;
|
|
100
100
|
ref?: any;
|
|
101
101
|
handler?: (value: any) => any;
|
|
@@ -35,7 +35,7 @@ export declare class AuthCtaComponent {
|
|
|
35
35
|
onRegister: EventEmitter<void>;
|
|
36
36
|
constructor();
|
|
37
37
|
/** Merged configuration with defaults */
|
|
38
|
-
config: import("@angular/core").Signal<AuthCtaMetadata & Required<Pick<AuthCtaMetadata, "
|
|
38
|
+
config: import("@angular/core").Signal<AuthCtaMetadata & Required<Pick<AuthCtaMetadata, "borderRadius" | "align" | "padding">>>;
|
|
39
39
|
loginLabel: import("@angular/core").Signal<string>;
|
|
40
40
|
registerLabel: import("@angular/core").Signal<string>;
|
|
41
41
|
topLogoProps: import("@angular/core").Signal<{
|
|
@@ -4,7 +4,7 @@ export declare class LandingStepsComponent {
|
|
|
4
4
|
private readonly props_;
|
|
5
5
|
set props(v: LandingStepsMetadata);
|
|
6
6
|
readonly p: import("@angular/core").Signal<LandingStepsMetadata>;
|
|
7
|
-
readonly cols: import("@angular/core").Signal<
|
|
7
|
+
readonly cols: import("@angular/core").Signal<2 | 3 | 4>;
|
|
8
8
|
readonly accentColor: import("@angular/core").Signal<string>;
|
|
9
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<LandingStepsComponent, never>;
|
|
10
10
|
static ɵcmp: i0.ɵɵComponentDeclaration<LandingStepsComponent, "val-landing-steps", never, { "props": { "alias": "props"; "required": false; }; }, {}, never, never, true, never>;
|
|
@@ -38,7 +38,6 @@ export declare class OrganizationViewComponent {
|
|
|
38
38
|
private nav;
|
|
39
39
|
private i18n;
|
|
40
40
|
readonly auth: AuthService;
|
|
41
|
-
private orgSwitch;
|
|
42
41
|
private orgService;
|
|
43
42
|
private toast;
|
|
44
43
|
private errors;
|
|
@@ -53,7 +52,7 @@ export declare class OrganizationViewComponent {
|
|
|
53
52
|
* `resolvedConfig` mergea con los defaults — `@Input` gana sobre route data.
|
|
54
53
|
*/
|
|
55
54
|
config?: OrganizationViewConfig;
|
|
56
|
-
readonly resolvedConfig: import("@angular/core").Signal<Required<Omit<OrganizationViewConfig, "onOrgEdited" | "onMemberInvited" | "onOwnershipTransferred" | "onLeftOrg" | "onOrgDeleted"
|
|
55
|
+
readonly resolvedConfig: import("@angular/core").Signal<Required<Omit<OrganizationViewConfig, "onOrgCreated" | "onOrgEdited" | "onMemberInvited" | "onOwnershipTransferred" | "onLeftOrg" | "onOrgDeleted">> & Pick<OrganizationViewConfig, "onOrgCreated" | "onOrgEdited" | "onMemberInvited" | "onOwnershipTransferred" | "onLeftOrg" | "onOrgDeleted">>;
|
|
57
56
|
/** Namespace i18n resuelto (capturado para llamadas no-reactivas). */
|
|
58
57
|
private get ns();
|
|
59
58
|
readonly org: import("@angular/core").WritableSignal<Organization>;
|
|
@@ -32,8 +32,6 @@ 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;
|
|
37
35
|
/** Namespace i18n con que la vista resuelve sus textos. */
|
|
38
36
|
i18nNamespace: string;
|
|
39
37
|
readonly orgs: import("@angular/core").WritableSignal<Organization[]>;
|
|
@@ -50,7 +48,6 @@ export declare class SwitchOrgModalComponent {
|
|
|
50
48
|
protected onLogoError(orgId: string): void;
|
|
51
49
|
protected readonly userInitials: import("@angular/core").Signal<string>;
|
|
52
50
|
readonly activeOrgId: import("@angular/core").Signal<string>;
|
|
53
|
-
readonly activeOrg: import("@angular/core").Signal<Organization>;
|
|
54
51
|
readonly filteredOrgs: import("@angular/core").Signal<Organization[]>;
|
|
55
52
|
constructor();
|
|
56
53
|
onQueryChange(value: string): void;
|
|
@@ -58,10 +55,9 @@ export declare class SwitchOrgModalComponent {
|
|
|
58
55
|
private loadOrgs;
|
|
59
56
|
loadMore(): void;
|
|
60
57
|
onProfile(): void;
|
|
61
|
-
onManage(): void;
|
|
62
58
|
onCreateNew(): void;
|
|
63
59
|
dismiss(): void;
|
|
64
60
|
t(key: string): string;
|
|
65
61
|
static ɵfac: i0.ɵɵFactoryDeclaration<SwitchOrgModalComponent, 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; }; "
|
|
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>;
|
|
67
63
|
}
|
|
@@ -2,7 +2,7 @@ import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
|
2
2
|
import { ViewWillEnter, ViewWillLeave } from '@ionic/angular/standalone';
|
|
3
3
|
import { ContainerSize } from '../../atoms/container/types';
|
|
4
4
|
import { PageRefreshService } from '../../../services/page-refresh/page-refresh.service';
|
|
5
|
-
import { PageWrapperMetadata } from './types';
|
|
5
|
+
import { PageWrapperMetadata, SideNavItem } from './types';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
/**
|
|
8
8
|
* val-page-wrapper
|
|
@@ -81,6 +81,8 @@ export declare class PageWrapperComponent implements ViewWillEnter, ViewWillLeav
|
|
|
81
81
|
contentId: import("@angular/core").Signal<string>;
|
|
82
82
|
propsFooter: import("@angular/core").Signal<import("valtech-components").CompanyFooterMetadata>;
|
|
83
83
|
contentMaxWidth: import("@angular/core").Signal<ContainerSize>;
|
|
84
|
+
menuItems: import("@angular/core").Signal<SideNavItem[]>;
|
|
85
|
+
hasSideMenu: import("@angular/core").Signal<boolean>;
|
|
84
86
|
background: import("@angular/core").Signal<string>;
|
|
85
87
|
ngOnInit(): void;
|
|
86
88
|
ngOnDestroy(): void;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { HeaderMetadata } from '../../organisms/header/types';
|
|
2
2
|
import { CompanyFooterMetadata } from '../../organisms/company-footer/types';
|
|
3
3
|
import { ContainerSize } from '../../atoms/container/types';
|
|
4
|
+
/** Item de navegación del menú lateral. */
|
|
5
|
+
export interface SideNavItem {
|
|
6
|
+
/** Etiqueta visible. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Nombre del ionicon (debe estar registrado con addIcons en la app). */
|
|
9
|
+
icon?: string;
|
|
10
|
+
/** Ruta Angular para routerLink. */
|
|
11
|
+
route: string;
|
|
12
|
+
/** Si true, routerLinkActive requiere coincidencia exacta (default false). */
|
|
13
|
+
exact?: boolean;
|
|
14
|
+
}
|
|
4
15
|
/**
|
|
5
16
|
* Configuration for the page wrapper component.
|
|
6
17
|
*/
|
|
@@ -23,4 +34,10 @@ export interface PageWrapperMetadata {
|
|
|
23
34
|
* Recommended: 'xl' for typical app pages.
|
|
24
35
|
*/
|
|
25
36
|
contentMaxWidth?: ContainerSize;
|
|
37
|
+
/**
|
|
38
|
+
* Items del menú lateral. Cuando se provee, val-page-wrapper renderiza
|
|
39
|
+
* ion-split-pane + ion-menu. En desktop (>= 768px) el menú es visible
|
|
40
|
+
* siempre; en mobile se abre con el botón hamburger (withMenu: true en toolbar).
|
|
41
|
+
*/
|
|
42
|
+
menuItems?: SideNavItem[];
|
|
26
43
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { AuthService } from './auth.service';
|
|
3
|
-
import { Organization } from '../org/types';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
4
|
/**
|
|
6
5
|
* Event emitted when the active organization changes.
|
|
@@ -90,7 +89,6 @@ export declare class OrgSwitchService {
|
|
|
90
89
|
private auth;
|
|
91
90
|
private readonly _switching;
|
|
92
91
|
private readonly _orgChanged;
|
|
93
|
-
private readonly _orgDataUpdated;
|
|
94
92
|
/**
|
|
95
93
|
* `true` while a switch is in flight. UI should disable interactions
|
|
96
94
|
* with org-scoped data and show a loading indicator.
|
|
@@ -104,13 +102,6 @@ export declare class OrgSwitchService {
|
|
|
104
102
|
* see the updated Firebase user / activeOrg claim.
|
|
105
103
|
*/
|
|
106
104
|
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;
|
|
114
105
|
constructor(auth: AuthService);
|
|
115
106
|
/**
|
|
116
107
|
* Switch the user's active organization.
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
}
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -350,6 +350,8 @@ 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';
|
|
353
355
|
export * from './lib/services/icons.service';
|
|
354
356
|
export * from './lib/services/in-app-browser.service';
|
|
355
357
|
export * from './lib/services/link-processor.service';
|
|
@@ -410,9 +412,6 @@ export * from './lib/components/molecules/request-form/request-form.component';
|
|
|
410
412
|
export * from './lib/components/molecules/request-form/types';
|
|
411
413
|
export * from './lib/components/molecules/content-reaction/content-reaction.component';
|
|
412
414
|
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';
|
|
416
415
|
export * from './lib/services/splash-screen';
|
|
417
416
|
export * from './lib/services/haptics';
|
|
418
417
|
export * from './lib/components/templates/docs-layout/docs-layout.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
|
+
}
|