valtech-components 2.0.726 → 2.0.728

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.
@@ -85,3 +85,5 @@ export { HandoffService, HANDOFF_TOKEN_PARAM, HANDOFF_ROUTE_PARAM } from './hand
85
85
  export type { HandoffCreateRequest, HandoffCreateResponse, HandoffExchangeResponse, DetectAndExchangeOptions, } from './handoff.service';
86
86
  export { OrgSwitchService } from './org-switch.service';
87
87
  export type { OrgChangedEvent, SwitchOrgOptions } from './org-switch.service';
88
+ export { NotificationActionService } from './notification-action.service';
89
+ export type { NotificationOpenResult } from './notification-action.service';
@@ -0,0 +1,34 @@
1
+ import { Router } from '@angular/router';
2
+ import { AuthService } from './auth.service';
3
+ import { HandoffService } from './handoff.service';
4
+ import { OrgSwitchService } from './org-switch.service';
5
+ import { ValtechAuthConfig } from './types';
6
+ import { NotificationDocument, NotificationsService } from '../firebase/notifications.service';
7
+ import * as i0 from "@angular/core";
8
+ /** Resultado descriptivo del open() — útil para tests y telemetría. */
9
+ export type NotificationOpenResult = 'navigated' | 'navigated-after-switch-org' | 'redirected-cross-app' | 'no-action-route' | 'cross-app-unconfigured' | 'handoff-failed';
10
+ export declare class NotificationActionService {
11
+ private config;
12
+ private auth;
13
+ private orgSwitch;
14
+ private handoff;
15
+ private notifications;
16
+ private router;
17
+ constructor(config: ValtechAuthConfig, auth: AuthService, orgSwitch: OrgSwitchService, handoff: HandoffService, notifications: NotificationsService, router: Router);
18
+ /**
19
+ * Abre la notificación: marca como leída, switch-org si toca, navegación local o
20
+ * redirect cross-app vía handoff.
21
+ *
22
+ * No lanza errores hacia la UI — devuelve un resultado descriptivo. Errores
23
+ * técnicos quedan en console.warn.
24
+ */
25
+ open(notif: NotificationDocument): Promise<NotificationOpenResult>;
26
+ private activeOrg;
27
+ /**
28
+ * Construye URL absoluta para handoff cross-app preservando pathname y otros
29
+ * params existentes de la baseUrl.
30
+ */
31
+ private buildHandoffUrl;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<NotificationActionService, never>;
33
+ static ɵprov: i0.ɵɵInjectableDeclaration<NotificationActionService>;
34
+ }
@@ -26,6 +26,18 @@ export interface ValtechAuthConfig {
26
26
  enableFirebaseIntegration?: boolean;
27
27
  /** Habilitar registro automático de device tokens para push notifications (default: false) */
28
28
  enableDeviceRegistration?: boolean;
29
+ /**
30
+ * AppID de esta app dentro del factory (ej: 'showcase', 'sigify', 'myvaltech').
31
+ * Usado por NotificationActionService para decidir si una notificación
32
+ * apunta a la app actual o requiere handoff cross-app.
33
+ */
34
+ appId?: string;
35
+ /**
36
+ * Mapa appId → baseUrl absoluta para handoff cross-app.
37
+ * Ej: { sigify: 'https://sigify.com', myvaltech: 'https://app.myvaltech.com' }
38
+ * NotificationActionService usa este map al disparar handoff a otra app.
39
+ */
40
+ appUrls?: Record<string, string>;
29
41
  }
30
42
  /**
31
43
  * Estado completo de autenticación.
@@ -23,12 +23,20 @@ export interface NotificationDocument extends FirestoreDocument {
23
23
  body?: string;
24
24
  /** URL de imagen */
25
25
  image?: string;
26
- /** Datos personalizados (ej: route, actionType) */
26
+ /** Datos personalizados (ej: route, actionType). Legacy — preferir actionRoute + payload */
27
27
  data?: Record<string, string>;
28
28
  /** Tipo de notificación */
29
29
  type?: 'fcm' | 'system' | 'reminder' | string;
30
30
  /** Si la notificación fue leída */
31
31
  isRead: boolean;
32
+ /** AppID origen (ej: 'showcase', 'sigify'). Permite cross-app routing */
33
+ appId?: string;
34
+ /** OrgID asociado (si la notif es org-scoped). Habilita switch-org al abrir */
35
+ orgId?: string;
36
+ /** Route destino al click (ej: '/app/docs/123') */
37
+ actionRoute?: string;
38
+ /** Payload estructurado para acciones (reemplazo tipado de `data`) */
39
+ payload?: Record<string, unknown>;
32
40
  }
33
41
  /**
34
42
  * Servicio para leer notificaciones desde Firestore.
@@ -0,0 +1,31 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ArticleMetadata } from '../../components/organisms/article/types';
3
+ import * as i0 from "@angular/core";
4
+ export type LegalSlug = 'terms' | 'privacy' | 'cookies' | 'data-usage' | 'legal-notice' | string;
5
+ export interface LegalLoadOptions {
6
+ /** Two-letter locale code (es, en, pt). Falls back to `es` on 404. */
7
+ locale?: string;
8
+ /** Override base path (default `/assets/legal`). */
9
+ basePath?: string;
10
+ /** Fallback locale tried when the requested one is missing. Set null to disable. */
11
+ fallbackLocale?: string | null;
12
+ }
13
+ /**
14
+ * Loads Markdown legal documents from `/assets/legal/{locale}/{slug}.md` and parses them
15
+ * into ArticleMetadata ready for `<val-article>`. Caches parsed results by `locale:slug`
16
+ * so multiple views consuming the same doc share one HTTP request.
17
+ */
18
+ export declare class LegalContentService {
19
+ private readonly http;
20
+ private readonly parser;
21
+ private readonly DEFAULT_BASE;
22
+ private readonly cache;
23
+ load(slug: LegalSlug, options?: LegalLoadOptions): Observable<ArticleMetadata>;
24
+ /** Returns the raw Markdown string without parsing. Useful for debugging. */
25
+ raw(slug: LegalSlug, options?: LegalLoadOptions): Observable<string>;
26
+ /** Clears the in-memory cache. Call when the user changes locale at runtime. */
27
+ invalidate(): void;
28
+ private fetchAndParse;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<LegalContentService, never>;
30
+ static ɵprov: i0.ɵɵInjectableDeclaration<LegalContentService>;
31
+ }
@@ -0,0 +1,31 @@
1
+ import { ArticleMetadata } from '../../components/organisms/article/types';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Converts Markdown documents into ArticleMetadata for the val-article organism.
5
+ *
6
+ * Supported syntax:
7
+ * - Headings (#, ##, ### …) → title / subtitle
8
+ * - Paragraphs → paragraph (with `processLinks` + `allowPartialBold`)
9
+ * - Lists (-, *, 1.) → unordered / ordered list (- [ ] / - [x] for checklist)
10
+ * - Blockquotes (>) → quote, with GitHub callouts `> [!NOTE|TIP|INFO|WARNING|CAUTION|IMPORTANT]` mapped to notes
11
+ * - Code fences (```lang) → code
12
+ * - Box-drawing ASCII art (┌┐└┘│─) auto-wrapped as code
13
+ * - Tables → flattened into paragraphs with bold keys
14
+ * - Horizontal rules (---, ***, ___) → separator
15
+ */
16
+ export declare class MarkdownArticleParserService {
17
+ parse(markdown: string, config?: Partial<ArticleMetadata>): ArticleMetadata;
18
+ private normalize;
19
+ private startsNewBlock;
20
+ private makeHeading;
21
+ private makeQuoteOrCallout;
22
+ private makeNote;
23
+ /**
24
+ * Tables are flattened into a header subtitle (if present) followed by one paragraph per
25
+ * data row using `**col[0]:** col[1] · **col[2]:** col[3] …` format. val-article has no
26
+ * native table element so this preserves the information without breaking the layout.
27
+ */
28
+ private makeTable;
29
+ static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownArticleParserService, never>;
30
+ static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownArticleParserService>;
31
+ }
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 = "2.0.726";
5
+ export declare const VERSION = "2.0.728";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.726",
3
+ "version": "2.0.728",
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
@@ -239,6 +239,8 @@ export * from './lib/services/qr-generator/types';
239
239
  export * from './lib/services/modal/modal.service';
240
240
  export * from './lib/services/modal/types';
241
241
  export * from './lib/services/meta';
242
+ export * from './lib/services/markdown-article/markdown-article-parser.service';
243
+ export * from './lib/services/markdown-article/legal-content.service';
242
244
  export * from './lib/services/firebase';
243
245
  export * from './lib/services/auth';
244
246
  export * from './lib/services/i18n';