valtech-components 2.0.728 → 2.0.730
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/organisms/bottom-nav/bottom-nav.component.mjs +36 -21
- package/esm2022/lib/components/organisms/bottom-nav/types.mjs +2 -1
- package/esm2022/lib/services/auth/handoff.service.mjs +1 -1
- package/esm2022/lib/services/auth/notification-action.service.mjs +10 -6
- package/esm2022/lib/services/markdown-article/legal-content.service.mjs +65 -14
- package/esm2022/lib/services/markdown-article/markdown-article-parser.mjs +266 -0
- package/esm2022/lib/services/markdown-article/markdown-article-parser.service.mjs +6 -275
- package/esm2022/lib/services/preferences/index.mjs +3 -0
- package/esm2022/lib/services/preferences/preferences.service.mjs +164 -0
- package/esm2022/lib/services/preferences/preferences.types.mjs +7 -0
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +7 -1
- package/fesm2022/valtech-components.mjs +495 -267
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/organisms/bottom-nav/bottom-nav.component.d.ts +3 -0
- package/lib/components/organisms/bottom-nav/types.d.ts +3 -1
- package/lib/services/auth/handoff.service.d.ts +10 -0
- package/lib/services/markdown-article/legal-content.service.d.ts +49 -7
- package/lib/services/markdown-article/markdown-article-parser.d.ts +16 -0
- package/lib/services/markdown-article/markdown-article-parser.service.d.ts +3 -22
- package/lib/services/preferences/index.d.ts +2 -0
- package/lib/services/preferences/preferences.service.d.ts +51 -0
- package/lib/services/preferences/preferences.types.d.ts +35 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -64,6 +64,7 @@ export declare class BottomNavComponent implements OnInit, OnDestroy {
|
|
|
64
64
|
hideLabels: boolean;
|
|
65
65
|
safeArea: boolean;
|
|
66
66
|
animation: "none" | "slide" | "fade" | "scale";
|
|
67
|
+
maxWidth: string;
|
|
67
68
|
}>;
|
|
68
69
|
/** Computed tabs with FAB inserted if present */
|
|
69
70
|
displayTabs: import("@angular/core").Signal<BottomNavTab[]>;
|
|
@@ -75,6 +76,8 @@ export declare class BottomNavComponent implements OnInit, OnDestroy {
|
|
|
75
76
|
getLabel(tab: BottomNavTab): string;
|
|
76
77
|
/** Get CSS variables for theming */
|
|
77
78
|
getThemeStyles(): Record<string, string>;
|
|
79
|
+
/** Resolve maxWidth token (sm|md|lg|xl|full) to CSS var or raw value */
|
|
80
|
+
resolveMaxWidth(v?: string): string;
|
|
78
81
|
ngOnInit(): void;
|
|
79
82
|
ngOnDestroy(): void;
|
|
80
83
|
/** Handle tab click */
|
|
@@ -109,10 +109,12 @@ export interface BottomNavMetadata {
|
|
|
109
109
|
safeArea?: boolean;
|
|
110
110
|
/** Animation style */
|
|
111
111
|
animation?: 'fade' | 'scale' | 'slide' | 'none';
|
|
112
|
+
/** Cap del ancho de la barra. Token sm|md|lg|xl|full o valor CSS crudo. Default: 'xl' (1100px) — alinea con `--val-container-xl` del repo */
|
|
113
|
+
maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | 'full' | string;
|
|
112
114
|
}
|
|
113
115
|
/**
|
|
114
116
|
* Default values for BottomNavMetadata
|
|
115
117
|
*/
|
|
116
|
-
export declare const BOTTOM_NAV_DEFAULTS: Required<Pick<BottomNavMetadata, 'hideLabels' | 'safeArea' | 'animation'>> & {
|
|
118
|
+
export declare const BOTTOM_NAV_DEFAULTS: Required<Pick<BottomNavMetadata, 'hideLabels' | 'safeArea' | 'animation' | 'maxWidth'>> & {
|
|
117
119
|
theme: Required<BottomNavTheme>;
|
|
118
120
|
};
|
|
@@ -50,6 +50,16 @@ export interface HandoffCreateResponse {
|
|
|
50
50
|
expiresAt: string;
|
|
51
51
|
/** Echoed `route` from the request, when provided. */
|
|
52
52
|
route?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Absolute base URL of the target app (e.g. `"https://sigify.com"`).
|
|
55
|
+
*
|
|
56
|
+
* When present, callers should use this as the destination for the redirect.
|
|
57
|
+
* Backend resolves it from the `app-config` table (single source of truth).
|
|
58
|
+
*
|
|
59
|
+
* Optional for backward compatibility — when missing, callers may fall back
|
|
60
|
+
* to a client-side `appUrls` mapping.
|
|
61
|
+
*/
|
|
62
|
+
targetBaseUrl?: string;
|
|
53
63
|
}
|
|
54
64
|
/**
|
|
55
65
|
* Response body from `POST /v2/auth/handoff/exchange`.
|
|
@@ -1,31 +1,73 @@
|
|
|
1
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
1
2
|
import { Observable } from 'rxjs';
|
|
2
3
|
import { ArticleMetadata } from '../../components/organisms/article/types';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export type LegalSlug = 'terms' | 'privacy' | 'cookies' | 'data-usage' | 'legal-notice' | string;
|
|
6
|
+
/**
|
|
7
|
+
* Factory that returns a Record<slug, ArticleMetadata> for a given locale.
|
|
8
|
+
* Use a dynamic `import()` so each locale module is code-split by the bundler.
|
|
9
|
+
*/
|
|
10
|
+
export type LegalContentFactory = () => Promise<Record<string, ArticleMetadata>>;
|
|
11
|
+
export interface LegalContentConfig {
|
|
12
|
+
/** Pre-generated content factories keyed by locale (e.g. `{ es: () => import('./generated/legal-content.es') ... }`). */
|
|
13
|
+
factories?: Record<string, LegalContentFactory>;
|
|
14
|
+
/** Override default `/assets/legal` base path used when no factory matches. */
|
|
15
|
+
basePath?: string;
|
|
16
|
+
/** Fallback locale (default `es`). Set null to disable. */
|
|
17
|
+
fallbackLocale?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare const LEGAL_CONTENT_CONFIG: InjectionToken<LegalContentConfig>;
|
|
5
20
|
export interface LegalLoadOptions {
|
|
6
|
-
/** Two-letter locale code (es, en, pt).
|
|
21
|
+
/** Two-letter locale code (es, en, pt). */
|
|
7
22
|
locale?: string;
|
|
8
|
-
/** Override base path (default `/assets/legal`). */
|
|
23
|
+
/** Override base path for runtime mode (default `/assets/legal`). */
|
|
9
24
|
basePath?: string;
|
|
10
25
|
/** Fallback locale tried when the requested one is missing. Set null to disable. */
|
|
11
26
|
fallbackLocale?: string | null;
|
|
12
27
|
}
|
|
13
28
|
/**
|
|
14
|
-
* Loads
|
|
15
|
-
*
|
|
16
|
-
*
|
|
29
|
+
* Loads legal articles via one of two modes:
|
|
30
|
+
*
|
|
31
|
+
* 1. **Build-time** (preferred): when the app provides `LEGAL_CONTENT_CONFIG.factories`
|
|
32
|
+
* via `provideLegalContent()`, the service dynamically imports the matching
|
|
33
|
+
* locale module and returns the pre-parsed `ArticleMetadata` synchronously
|
|
34
|
+
* (wrapped in an Observable). Each locale is code-split.
|
|
35
|
+
*
|
|
36
|
+
* 2. **Runtime**: when no factory matches, falls back to fetching
|
|
37
|
+
* `/assets/legal/{locale}/{slug}.md` and parsing on the fly.
|
|
38
|
+
*
|
|
39
|
+
* Both modes cache by `locale:slug` so concurrent loads share one promise/HTTP request.
|
|
17
40
|
*/
|
|
18
41
|
export declare class LegalContentService {
|
|
19
42
|
private readonly http;
|
|
20
43
|
private readonly parser;
|
|
44
|
+
private readonly config;
|
|
21
45
|
private readonly DEFAULT_BASE;
|
|
22
46
|
private readonly cache;
|
|
47
|
+
private readonly factoryCache;
|
|
23
48
|
load(slug: LegalSlug, options?: LegalLoadOptions): Observable<ArticleMetadata>;
|
|
24
|
-
/**
|
|
49
|
+
/** Raw Markdown — only available in runtime mode (HTTP). */
|
|
25
50
|
raw(slug: LegalSlug, options?: LegalLoadOptions): Observable<string>;
|
|
26
|
-
/** Clears
|
|
51
|
+
/** Clears in-memory caches. Call on runtime locale change. */
|
|
27
52
|
invalidate(): void;
|
|
53
|
+
private loadOne;
|
|
54
|
+
private runFactory;
|
|
28
55
|
private fetchAndParse;
|
|
29
56
|
static ɵfac: i0.ɵɵFactoryDeclaration<LegalContentService, never>;
|
|
30
57
|
static ɵprov: i0.ɵɵInjectableDeclaration<LegalContentService>;
|
|
31
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Wires pre-generated legal content into `LegalContentService`. Call from `main.ts`
|
|
61
|
+
* (or any `providers: []` array). The factories use dynamic `import()` so each
|
|
62
|
+
* locale is code-split — only the active locale's bundle is loaded.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* provideLegalContent({
|
|
66
|
+
* factories: {
|
|
67
|
+
* es: () => import('./app/generated/legal-content.es').then((m) => m.LEGAL_CONTENT_ES),
|
|
68
|
+
* en: () => import('./app/generated/legal-content.en').then((m) => m.LEGAL_CONTENT_EN),
|
|
69
|
+
* pt: () => import('./app/generated/legal-content.pt').then((m) => m.LEGAL_CONTENT_PT),
|
|
70
|
+
* },
|
|
71
|
+
* })
|
|
72
|
+
*/
|
|
73
|
+
export declare function provideLegalContent(config: LegalContentConfig): Provider;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ArticleMetadata } from '../../components/organisms/article/types';
|
|
2
|
+
/**
|
|
3
|
+
* Pure Markdown → ArticleMetadata parser. No Angular deps — usable from Node scripts
|
|
4
|
+
* (build-time generation) and from the Angular `MarkdownArticleParserService` wrapper.
|
|
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 function parseMarkdownArticle(markdown: string, config?: Partial<ArticleMetadata>): ArticleMetadata;
|
|
@@ -1,31 +1,12 @@
|
|
|
1
1
|
import { ArticleMetadata } from '../../components/organisms/article/types';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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
|
|
4
|
+
* Angular service wrapper for the pure {@link parseMarkdownArticle} function.
|
|
5
|
+
* Provided in root so it can be injected anywhere. The actual parsing logic lives in
|
|
6
|
+
* `markdown-article-parser.ts` and is also usable from Node scripts (build-time generation).
|
|
15
7
|
*/
|
|
16
8
|
export declare class MarkdownArticleParserService {
|
|
17
9
|
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
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<MarkdownArticleParserService, never>;
|
|
30
11
|
static ɵprov: i0.ɵɵInjectableDeclaration<MarkdownArticleParserService>;
|
|
31
12
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import { AuthService } from '../auth/auth.service';
|
|
3
|
+
import { ValtechAuthConfig } from '../auth/types';
|
|
4
|
+
import { FirestoreService } from '../firebase/firestore.service';
|
|
5
|
+
import { I18nService } from '../i18n/i18n.service';
|
|
6
|
+
import { ThemeService } from '../theme.service';
|
|
7
|
+
import { PreferencesLanguage, PreferencesTheme, PreferencesUpdate, PreferencesUpdateResponse } from './preferences.types';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
/**
|
|
10
|
+
* PreferencesService — preferencias del user en el doc canónico Firestore
|
|
11
|
+
* `/apps/{appId}/users/{uid}/preferences/main`.
|
|
12
|
+
*
|
|
13
|
+
* Read reactivo (signals) via listener Firestore.
|
|
14
|
+
* Write via `PUT /v2/auth/preferences` (cliente NUNCA escribe Firestore directo —
|
|
15
|
+
* ver memoria `feedback_no_direct_firestore_writes`).
|
|
16
|
+
*
|
|
17
|
+
* Side-effects automáticos:
|
|
18
|
+
* - Cuando `theme()` cambia → `ThemeService.Theme = ...`
|
|
19
|
+
* - Cuando `language()` cambia → `I18nService.setLanguage(...)`
|
|
20
|
+
*
|
|
21
|
+
* Auto-bind al user actual via `AuthService.user()`. Sin user (logout) → unbind.
|
|
22
|
+
*/
|
|
23
|
+
export declare class PreferencesService {
|
|
24
|
+
private config;
|
|
25
|
+
private firestore;
|
|
26
|
+
private auth;
|
|
27
|
+
private http;
|
|
28
|
+
private themeService;
|
|
29
|
+
private i18n;
|
|
30
|
+
private readonly _theme;
|
|
31
|
+
private readonly _language;
|
|
32
|
+
private readonly _notificationsMaster;
|
|
33
|
+
/** `true` después del primer snapshot Firestore. Antes, defaults sin side-effects. */
|
|
34
|
+
private readonly _synced;
|
|
35
|
+
readonly theme: import("@angular/core").Signal<PreferencesTheme>;
|
|
36
|
+
readonly language: import("@angular/core").Signal<PreferencesLanguage>;
|
|
37
|
+
readonly notificationsMaster: import("@angular/core").Signal<boolean>;
|
|
38
|
+
readonly synced: import("@angular/core").Signal<boolean>;
|
|
39
|
+
private subscription?;
|
|
40
|
+
private currentUserId?;
|
|
41
|
+
constructor(config: ValtechAuthConfig, firestore: FirestoreService, auth: AuthService, http: HttpClient, themeService: ThemeService | null, i18n: I18nService | null);
|
|
42
|
+
/** Actualiza preferencias via backend. Optimistic UI: aplica local, revierte si falla. */
|
|
43
|
+
update(partial: PreferencesUpdate): Promise<PreferencesUpdateResponse>;
|
|
44
|
+
setTheme(theme: PreferencesTheme): Promise<PreferencesUpdateResponse>;
|
|
45
|
+
setLanguage(language: PreferencesLanguage): Promise<PreferencesUpdateResponse>;
|
|
46
|
+
setNotificationsMaster(enabled: boolean): Promise<PreferencesUpdateResponse>;
|
|
47
|
+
private bindToUser;
|
|
48
|
+
private unbind;
|
|
49
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PreferencesService, [null, null, null, null, { optional: true; }, { optional: true; }]>;
|
|
50
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PreferencesService>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preferences types — Fase 1 schema simple (theme + language + notifications.master).
|
|
3
|
+
* Doc canónico: /apps/{appId}/users/{uid}/preferences/main
|
|
4
|
+
* Cliente NUNCA escribe directo — todas las mutaciones via PUT /v2/auth/preferences.
|
|
5
|
+
*/
|
|
6
|
+
export type PreferencesTheme = 'light' | 'dark' | 'auto';
|
|
7
|
+
export type PreferencesLanguage = 'es' | 'en' | 'pt';
|
|
8
|
+
/** Forma del doc tal como lo escribe el backend (Admin SDK). */
|
|
9
|
+
export interface PreferencesDocument {
|
|
10
|
+
theme?: PreferencesTheme;
|
|
11
|
+
language?: PreferencesLanguage;
|
|
12
|
+
notifications?: {
|
|
13
|
+
master?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** serverTimestamp escrito por el backend en cada sync. */
|
|
16
|
+
syncedAt?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Payload aceptado por `PUT /v2/auth/preferences` — partial update. */
|
|
19
|
+
export interface PreferencesUpdate {
|
|
20
|
+
theme?: PreferencesTheme;
|
|
21
|
+
language?: PreferencesLanguage;
|
|
22
|
+
notifications?: {
|
|
23
|
+
master?: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** Response del backend tras el PUT. */
|
|
27
|
+
export interface PreferencesUpdateResponse {
|
|
28
|
+
operationId: string;
|
|
29
|
+
theme: PreferencesTheme | '';
|
|
30
|
+
language: PreferencesLanguage | '';
|
|
31
|
+
notifications: {
|
|
32
|
+
master?: boolean;
|
|
33
|
+
};
|
|
34
|
+
updated: boolean;
|
|
35
|
+
}
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -239,11 +239,13 @@ 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';
|
|
242
243
|
export * from './lib/services/markdown-article/markdown-article-parser.service';
|
|
243
244
|
export * from './lib/services/markdown-article/legal-content.service';
|
|
244
245
|
export * from './lib/services/firebase';
|
|
245
246
|
export * from './lib/services/auth';
|
|
246
247
|
export * from './lib/services/i18n';
|
|
248
|
+
export * from './lib/services/preferences';
|
|
247
249
|
export * from './lib/services/app-config';
|
|
248
250
|
export * from './lib/services/presets';
|
|
249
251
|
export * from './lib/services/skeleton';
|