arch(sprint1): resolve dynamic pages by route config

This commit is contained in:
sdarbinyan
2026-07-03 02:04:01 +04:00
parent ac48799d9a
commit d6a1d5e3f5
4 changed files with 59 additions and 9 deletions

View File

@@ -1,16 +1,16 @@
import { Injectable } from '@angular/core';
import { Observable, map } from 'rxjs';
import { ConfigService } from '../../core/config/config.service';
import { BrandingEngineService } from '../../theme/runtime/branding-engine.service';
import { ThemeEngineService } from '../../theme/runtime/theme-engine.service';
import { PageRendererService } from '../../dynamic-renderer/page-renderer/page-renderer.service';
import { PageRenderModel } from '../../dynamic-renderer/page-renderer/page-renderer.model';
import { WidgetRegistryBootstrapService } from '../../widgets/registry/widget-registry.bootstrap.service';
import { PageResolverService } from '../../dynamic-renderer/page-resolver/page-resolver.service';
@Injectable({ providedIn: 'root' })
export class WebsiteRuntimeFacade {
constructor(
private readonly configService: ConfigService,
private readonly pageResolver: PageResolverService,
private readonly pageRenderer: PageRendererService,
private readonly registryBootstrap: WidgetRegistryBootstrapService,
private readonly themeEngine: ThemeEngineService,
@@ -23,10 +23,9 @@ export class WebsiteRuntimeFacade {
this.brandingEngine.initialize();
}
getPageRenderModel(pageKey: string): Observable<PageRenderModel | null> {
return this.configService.loadBootstrap().pipe(
map(bootstrap => {
const page = bootstrap.pages.find(p => p.key === pageKey && p.visible !== false);
getPageRenderModelForUrl(url: string): Observable<PageRenderModel | null> {
return this.pageResolver.resolveByUrl(url).pipe(
map(page => {
return page ? this.pageRenderer.toRenderModel(page) : null;
})
);