import { InjectionToken, Provider } from '@angular/core'; import { Observable } from 'rxjs'; import { ArticleMetadata } from '../../components/organisms/article/types'; import * as i0 from "@angular/core"; export type LegalSlug = 'terms' | 'privacy' | 'cookies' | 'data-usage' | 'legal-notice' | string; /** * Factory that returns a Record for a given locale. * Use a dynamic `import()` so each locale module is code-split by the bundler. */ export type LegalContentFactory = () => Promise>; export interface LegalContentConfig { /** Pre-generated content factories keyed by locale (e.g. `{ es: () => import('./generated/legal-content.es') ... }`). */ factories?: Record; /** Override default `/assets/legal` base path used when no factory matches. */ basePath?: string; /** Fallback locale (default `es`). Set null to disable. */ fallbackLocale?: string | null; } export declare const LEGAL_CONTENT_CONFIG: InjectionToken; export interface LegalLoadOptions { /** Two-letter locale code (es, en, pt). */ locale?: string; /** Override base path for runtime mode (default `/assets/legal`). */ basePath?: string; /** Fallback locale tried when the requested one is missing. Set null to disable. */ fallbackLocale?: string | null; } /** * Loads legal articles via one of two modes: * * 1. **Build-time** (preferred): when the app provides `LEGAL_CONTENT_CONFIG.factories` * via `provideLegalContent()`, the service dynamically imports the matching * locale module and returns the pre-parsed `ArticleMetadata` synchronously * (wrapped in an Observable). Each locale is code-split. * * 2. **Runtime**: when no factory matches, falls back to fetching * `/assets/legal/{locale}/{slug}.md` and parsing on the fly. * * Both modes cache by `locale:slug` so concurrent loads share one promise/HTTP request. */ export declare class LegalContentService { private readonly http; private readonly parser; private readonly config; private readonly DEFAULT_BASE; private readonly cache; private readonly factoryCache; load(slug: LegalSlug, options?: LegalLoadOptions): Observable; /** Raw Markdown — only available in runtime mode (HTTP). */ raw(slug: LegalSlug, options?: LegalLoadOptions): Observable; /** Clears in-memory caches. Call on runtime locale change. */ invalidate(): void; private loadOne; private runFactory; private fetchAndParse; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Wires pre-generated legal content into `LegalContentService`. Call from `main.ts` * (or any `providers: []` array). The factories use dynamic `import()` so each * locale is code-split — only the active locale's bundle is loaded. * * @example * provideLegalContent({ * factories: { * es: () => import('./app/generated/legal-content.es').then((m) => m.LEGAL_CONTENT_ES), * en: () => import('./app/generated/legal-content.en').then((m) => m.LEGAL_CONTENT_EN), * pt: () => import('./app/generated/legal-content.pt').then((m) => m.LEGAL_CONTENT_PT), * }, * }) */ export declare function provideLegalContent(config: LegalContentConfig): Provider;