UNPKG

@spartacus/storefront

Version:

Spartacus Storefront is a package that you can include in your application, which allows you to add default storefront features.

37 lines (36 loc) 1.64 kB
import { Injector } from '@angular/core'; import { ActivatedRouteSnapshot } from '@angular/router'; import { ActivatedRoutesService } from '@spartacus/core'; import { Observable } from 'rxjs'; import { ContextToken } from './context.model'; import * as i0 from "@angular/core"; /** * Resolves the context for the specific route, based on the property `data.cxContext` * defined in the Angular Route. */ export declare class RoutingContextService { protected activatedRoutesService: ActivatedRoutesService; protected injector: Injector; constructor(activatedRoutesService: ActivatedRoutesService, injector: Injector); /** * Combined context token mapping consisting of all mappings defined in currently * Activated Angular Routes. * * The context token mapping is read from each Route's property `data.cxContext`. */ protected readonly contextTokenMapping$: Observable<Record<ContextToken, any>>; /** * Returns the merged context token mapping, consisting of mappings * defined in all Activated Angular Routes. */ protected getRoutesContextTokenMapping(routes: ActivatedRouteSnapshot[]): Record<ContextToken, any>; /** * Resolves the specified `contextToken` from `cxContext` data parameter of the activated Angular Routes. * @param contextToken * * @returns instance from the root injector if defined, otherwise `undefined`. */ get<T>(contextToken: ContextToken): Observable<T | undefined>; static ɵfac: i0.ɵɵFactoryDeclaration<RoutingContextService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RoutingContextService>; }