valtech-components 2.0.730 → 2.0.731

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.
@@ -109,7 +109,7 @@ 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 */
112
+ /** Cap del ancho de la barra. Token sm|md|lg|xl|full o valor CSS crudo. Default: 'md' (720px) — bottom-nav típicamente tiene pocos tabs y se ve mejor estrecho aunque el contenido use 'xl' */
113
113
  maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | 'full' | string;
114
114
  }
115
115
  /**
@@ -31,9 +31,19 @@ export declare const VALTECH_FOOTER_LOGO: {
31
31
  export interface CompanyLink {
32
32
  /** i18n key for the link text */
33
33
  key: string;
34
- /** URL path or external URL */
34
+ /** URL path (relative) or absolute URL */
35
35
  url: string;
36
- /** Whether the link opens in a new tab */
36
+ /**
37
+ * Hint for `LegalLinkService` about which app owns this link in a multi-app factory:
38
+ * - `'legal'` — canonical legal content (terms, privacy, …) — lives on main site
39
+ * - `'site'` — marketing/info pages (about, blog, …) — lives on main site
40
+ * - `'support'` — support/help — typically per-app (each product has own support)
41
+ *
42
+ * In satellite apps with `provideValtechLegal({ baseUrl })`, links with kind
43
+ * `'legal'` or `'site'` get rewritten to the main site URL.
44
+ */
45
+ kind?: 'legal' | 'site' | 'support';
46
+ /** Force opens in a new tab. Resolver may also set this when rewriting cross-origin. */
37
47
  external?: boolean;
38
48
  }
39
49
  /**
@@ -82,12 +92,22 @@ export declare const VALTECH_LANGUAGE_SELECTOR: {
82
92
  size: "default";
83
93
  };
84
94
  /**
85
- * Helper to build footer links from company links config
95
+ * Optional URL resolver applied per link (e.g. `LegalLinkService.resolve.bind(svc)`).
96
+ * Returns `{ url, external? }` to allow cross-origin rewrites.
97
+ */
98
+ export type CompanyLinkResolver = (link: CompanyLink) => {
99
+ url: string;
100
+ external?: boolean;
101
+ };
102
+ /**
103
+ * Helper to build footer links from company links config.
104
+ *
86
105
  * @param links - Array of company links
87
106
  * @param t - Translation function (key: string) => string
107
+ * @param resolver - Optional resolver — typically `(link) => ({ url: legalLink.resolve(link.url), external: legalLink.isExternal(link.url) && (link.kind === 'legal' || link.kind === 'site') })` to point cross-app legal/site links to the main site.
88
108
  * @returns Array of link objects ready for FooterLinksMetadata
89
109
  */
90
- export declare function buildFooterLinks(links: CompanyLink[], t: (key: string) => string): Array<{
110
+ export declare function buildFooterLinks(links: CompanyLink[], t: (key: string) => string, resolver?: CompanyLinkResolver): Array<{
91
111
  url: string;
92
112
  text: string;
93
113
  color: string;
@@ -0,0 +1,59 @@
1
+ import { InjectionToken, Provider } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Config for cross-app legal/site link resolution.
5
+ *
6
+ * Used by satellite apps (showcase, sigify, admin-portal, …) to point their legal
7
+ * and site links (terms, privacy, about, contact, …) to the main marketing site,
8
+ * which owns the canonical legal content. The main site itself does NOT call
9
+ * `provideValtechLegal` — its links stay relative.
10
+ */
11
+ export interface ValtechLegalConfig {
12
+ /**
13
+ * Absolute base URL of the main site (no trailing slash).
14
+ * @example 'https://myvaltech.com'
15
+ */
16
+ baseUrl?: string;
17
+ /** Open resolved external links in a new tab. Defaults to `true` when `baseUrl` is set. */
18
+ openInNewTab?: boolean;
19
+ }
20
+ export declare const VALTECH_LEGAL_CONFIG: InjectionToken<ValtechLegalConfig>;
21
+ /**
22
+ * Resolves legal/site paths against a configurable main-site base URL.
23
+ *
24
+ * - **Main site mode**: no `provideValtechLegal` called → `resolve('/legal/terms')` returns `/legal/terms` (relative).
25
+ * - **Satellite mode**: `provideValtechLegal({ baseUrl: 'https://myvaltech.com' })` → `resolve('/legal/terms')` returns `'https://myvaltech.com/legal/terms'` and `isExternal('/legal/terms')` returns `true`.
26
+ *
27
+ * Absolute URLs passed in are returned unchanged (no double-prefix).
28
+ */
29
+ export declare class LegalLinkService {
30
+ private readonly config;
31
+ /** Effective base URL (null if running as main site). */
32
+ get baseUrl(): string | null;
33
+ /** Whether resolved external links should open in a new tab. */
34
+ get openInNewTab(): boolean;
35
+ /**
36
+ * Returns the URL to use for a given internal path. Absolute URLs pass through.
37
+ * @example
38
+ * resolve('/legal/terms') // main site: '/legal/terms'
39
+ * // satellite: 'https://myvaltech.com/legal/terms'
40
+ * resolve('https://x.com/y') // unchanged
41
+ */
42
+ resolve(path: string): string;
43
+ /** `true` if the path would be resolved to a cross-origin URL. */
44
+ isExternal(path: string): boolean;
45
+ static ɵfac: i0.ɵɵFactoryDeclaration<LegalLinkService, never>;
46
+ static ɵprov: i0.ɵɵInjectableDeclaration<LegalLinkService>;
47
+ }
48
+ /**
49
+ * Wires `LegalLinkService` for satellite apps. Omit in the main site (the one
50
+ * that hosts the canonical /legal/* routes) so links stay relative.
51
+ *
52
+ * @example
53
+ * // main.ts of showcase / sigify / etc.
54
+ * provideValtechLegal({
55
+ * baseUrl: 'https://myvaltech.com',
56
+ * openInNewTab: true,
57
+ * }),
58
+ */
59
+ export declare function provideValtechLegal(config: ValtechLegalConfig): Provider;
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.730";
5
+ export declare const VERSION = "2.0.731";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.730",
3
+ "version": "2.0.731",
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
@@ -242,6 +242,7 @@ export * from './lib/services/meta';
242
242
  export * from './lib/services/markdown-article/markdown-article-parser';
243
243
  export * from './lib/services/markdown-article/markdown-article-parser.service';
244
244
  export * from './lib/services/markdown-article/legal-content.service';
245
+ export * from './lib/services/legal-link/legal-link.service';
245
246
  export * from './lib/services/firebase';
246
247
  export * from './lib/services/auth';
247
248
  export * from './lib/services/i18n';