@open-rlb/ng-app 3.0.23 → 3.0.25

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.
@@ -484,12 +484,11 @@ class AppsService {
484
484
  // Core logic
485
485
  resolveRouteAndApps() {
486
486
  const route = this.findDeepestChild(this.activatedRoute);
487
- const fullPath = this.getFullPath(route);
488
- this.logger.info(`Full path for route resolution: '${fullPath}'`);
489
- // if (!fullPath) {
490
- // this.logger.warn('No valid path found, treating as default route:', route);
491
- // return of(null);
492
- // }
487
+ // 1. Get abstract route template (LIKE ".../:id")
488
+ const configPath = this.getConfigPath(route);
489
+ // 2. Get REAL url path (LIKE ".../abc-123")
490
+ const actualPath = this.getActualPath(route);
491
+ this.logger.info(`Resolving. ConfigPath: '${configPath}', ActualPath: '${actualPath}'`);
493
492
  const appRoutes = this.apps?.map(app => ({
494
493
  type: app.type,
495
494
  routes: app.routes || [],
@@ -498,10 +497,10 @@ class AppsService {
498
497
  core: app.core
499
498
  }));
500
499
  let appRoutesMatched = [];
501
- if (fullPath && !this.isDefaultRoute(fullPath)) {
502
- appRoutesMatched = appRoutes?.filter(app => app.routes?.some(r => r.includes(fullPath))) ?? [];
500
+ if (configPath && !this.isDefaultRoute(configPath)) {
501
+ appRoutesMatched = appRoutes?.filter(app => app.routes?.some(r => r.includes(configPath))) ?? [];
503
502
  }
504
- this.logger.info('Route fullPath:', fullPath, 'Matched appRoute:', appRoutesMatched);
503
+ this.logger.info('Matched appRoute:', appRoutesMatched);
505
504
  return this.store.select(state => state[appContextFeatureKey].apps).pipe(
506
505
  // waiting for all "finalizeApp" dispatches
507
506
  filter(apps => {
@@ -512,11 +511,14 @@ class AppsService {
512
511
  this.logger.info('Waiting for apps initialization (finalizeApp)...');
513
512
  }
514
513
  return allFinalized;
515
- }),
516
- // Return config in there are matched apps, or it's root route case
517
- map(apps => {
518
- if (appRoutesMatched.length > 0 || fullPath === '') {
519
- return { route, appsConfig: appRoutesMatched, apps };
514
+ }), map(apps => {
515
+ if (appRoutesMatched.length > 0 || actualPath === '') {
516
+ return {
517
+ route,
518
+ appsConfig: appRoutesMatched,
519
+ apps,
520
+ fullPath: actualPath
521
+ };
520
522
  }
521
523
  return null;
522
524
  }));
@@ -525,7 +527,7 @@ class AppsService {
525
527
  const route = this.findDeepestChild(this.activatedRoute);
526
528
  const storedId = this.getStoredAppId();
527
529
  // Check if route is root
528
- const currentPath = route.snapshot.url.map(s => s.path).join('/');
530
+ const currentPath = data ? data.fullPath : this.getActualPath(route);
529
531
  const isRoot = currentPath === '';
530
532
  // Basic check
531
533
  if (data?.apps?.some(app => !app.id)) {
@@ -612,7 +614,7 @@ class AppsService {
612
614
  return DEFAULT_ROUTES_CONFIG
613
615
  .some(r => r.path.includes(route));
614
616
  }
615
- getFullPath(route) {
617
+ getConfigPath(route) {
616
618
  const segments = [];
617
619
  let current = route.root;
618
620
  while (current) {
@@ -623,6 +625,18 @@ class AppsService {
623
625
  }
624
626
  return segments.join('/');
625
627
  }
628
+ getActualPath(route) {
629
+ const segments = [];
630
+ let current = route.root;
631
+ while (current) {
632
+ // map(s => s.path) extract params
633
+ const path = current.snapshot.url.map(s => s.path).join('/');
634
+ if (path && path !== '')
635
+ segments.push(path);
636
+ current = current.firstChild ?? null;
637
+ }
638
+ return segments.join('/');
639
+ }
626
640
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AppsService, deps: [{ token: i1$1.Store }, { token: i2.ActivatedRoute }, { token: i2.Router }, { token: AppLoggerService }, { token: RLB_CFG_AUTH, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
627
641
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AppsService, providedIn: 'root' }); }
628
642
  }