UNPKG

@o3r/components

Version:

This module contains component-related features (Component replacement, CMS compatibility, helpers, pipes, debugging developer tools...) It comes with an integrated ng builder to help you generate components compatible with Otter features (CMS integration

87 lines (82 loc) 3.89 kB
import { RulesEngineAction, RulesEngineActionHandler } from '@o3r/core'; import { Observable, Subject } from 'rxjs'; import * as i2 from '@o3r/components'; import { PlaceholderRequestReply } from '@o3r/components'; import * as i0 from '@angular/core'; import * as i1 from '@ngrx/effects'; /** * Minimal subset of the underlying translation service (ngx-translate's `TranslateService` or * transloco's `TranslocoService`) exposing language-change notifications. * TODO: remove this abstraction and rely on the single supported translation service in v16 */ interface PlaceholderTranslateService { /** Language-change stream exposed by ngx-translate (`@o3r/localization`) */ onLangChange?: Observable<{ lang: string; }>; /** Language-change stream exposed by transloco (`@o3r/transloco`) */ langChanges$?: Observable<string>; } /** * Minimal subset of the `LocalizationService` API (from `@o3r/localization` or `@o3r/transloco`) * used by the placeholder rules engine. Declared locally so that neither package is a hard dependency. * TODO: remove this abstraction and import `LocalizationService` directly from the single supported translation package in v16 */ interface PlaceholderLocalizationService { /** Translate a localization key, resolving the given interpolation parameters */ translate(key: string, interpolateParams?: object): Observable<string>; /** Get the underlying translation service used by the localization service */ getTranslateService(): PlaceholderTranslateService; /** Get the current active language */ getCurrentLanguage(): string; } /** ActionUpdatePlaceholderBlock */ declare const RULES_ENGINE_PLACEHOLDER_UPDATE_ACTION_TYPE = "UPDATE_PLACEHOLDER"; /** * Content of action that updates a placeholder */ interface ActionUpdatePlaceholderBlock extends RulesEngineAction { actionType: typeof RULES_ENGINE_PLACEHOLDER_UPDATE_ACTION_TYPE; placeholderId: string; value: string; priority?: number; } /** * Service to handle async PlaceholderTemplate actions */ declare class PlaceholderRulesEngineActionHandler implements RulesEngineActionHandler<ActionUpdatePlaceholderBlock> { private readonly logger; private readonly injector; private readonly translationService; protected placeholdersActions$: Subject<{ placeholderId: string; templateUrl: string; priority: number; }[]>; /** @inheritdoc */ readonly supportingActions: readonly ["UPDATE_PLACEHOLDER"]; constructor(); /** * Localize the url, replacing the language marker * @param url * @param language */ protected resolveUrlWithLang(url: string, language: string | null): string; /** * Retrieve template as json from a given url * @param url */ protected retrieveTemplate(url: string): Promise<PlaceholderRequestReply>; /** @inheritdoc */ executeActions(actions: ActionUpdatePlaceholderBlock[]): void; static ɵfac: i0.ɵɵFactoryDeclaration<PlaceholderRulesEngineActionHandler, never>; static ɵprov: i0.ɵɵInjectableDeclaration<PlaceholderRulesEngineActionHandler>; } declare class PlaceholderRulesEngineActionModule { static ɵfac: i0.ɵɵFactoryDeclaration<PlaceholderRulesEngineActionModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<PlaceholderRulesEngineActionModule, never, [typeof i1.EffectsFeatureModule, typeof i2.PlaceholderRequestStoreModule, typeof i2.PlaceholderTemplateStoreModule], never>; static ɵinj: i0.ɵɵInjectorDeclaration<PlaceholderRulesEngineActionModule>; } export { PlaceholderRulesEngineActionHandler, PlaceholderRulesEngineActionModule, RULES_ENGINE_PLACEHOLDER_UPDATE_ACTION_TYPE }; export type { ActionUpdatePlaceholderBlock, PlaceholderLocalizationService, PlaceholderTranslateService }; //# sourceMappingURL=o3r-components-rules-engine.d.ts.map