import * as _ngrx_store from '@ngrx/store'; import { Action, Selector, MemoizedSelector } from '@ngrx/store'; import { RouterStateSnapshot, ActivatedRouteSnapshot, NavigationStart, RoutesRecognized, NavigationCancel, NavigationError, NavigationEnd, Params, Data } from '@angular/router'; import * as i0 from '@angular/core'; import { InjectionToken, ModuleWithProviders, EnvironmentProviders } from '@angular/core'; /** * Simple router state. * All custom router states / state serializers should have at least * the properties of this interface. */ interface BaseRouterStoreState { url: string; } declare abstract class RouterStateSerializer { abstract serialize(routerState: RouterStateSnapshot): T; } interface SerializedRouterStateSnapshot extends BaseRouterStoreState { root: ActivatedRouteSnapshot; url: string; } declare class FullRouterStateSerializer implements RouterStateSerializer { serialize(routerState: RouterStateSnapshot): SerializedRouterStateSnapshot; private serializeRoute; } /** * An action dispatched when a router navigation request is fired. */ declare const ROUTER_REQUEST = "@ngrx/router-store/request"; /** * Payload of ROUTER_REQUEST */ type RouterRequestPayload = { routerState: T; event: NavigationStart; }; /** * An action dispatched when a router navigation request is fired. */ type RouterRequestAction = { type: typeof ROUTER_REQUEST; payload: RouterRequestPayload; }; declare const routerRequestAction: _ngrx_store.ActionCreator<"@ngrx/router-store/request", (props: { payload: RouterRequestPayload; }) => { payload: RouterRequestPayload; } & _ngrx_store.Action<"@ngrx/router-store/request">>; /** * An action dispatched when the router navigates. */ declare const ROUTER_NAVIGATION = "@ngrx/router-store/navigation"; /** * Payload of ROUTER_NAVIGATION. */ type RouterNavigationPayload = { routerState: T; event: RoutesRecognized; }; /** * An action dispatched when the router navigates. */ type RouterNavigationAction = { type: typeof ROUTER_NAVIGATION; payload: RouterNavigationPayload; }; declare const routerNavigationAction: _ngrx_store.ActionCreator<"@ngrx/router-store/navigation", (props: { payload: RouterNavigationPayload; }) => { payload: RouterNavigationPayload; } & _ngrx_store.Action<"@ngrx/router-store/navigation">>; /** * An action dispatched when the router cancels navigation. */ declare const ROUTER_CANCEL = "@ngrx/router-store/cancel"; /** * Payload of ROUTER_CANCEL. */ type RouterCancelPayload = { routerState: V; storeState: T; event: NavigationCancel; }; /** * An action dispatched when the router cancels navigation. */ type RouterCancelAction = { type: typeof ROUTER_CANCEL; payload: RouterCancelPayload; }; declare const routerCancelAction: _ngrx_store.ActionCreator<"@ngrx/router-store/cancel", (props: { payload: RouterCancelPayload; }) => { payload: RouterCancelPayload; } & _ngrx_store.Action<"@ngrx/router-store/cancel">>; /** * An action dispatched when the router errors. */ declare const ROUTER_ERROR = "@ngrx/router-store/error"; /** * Payload of ROUTER_ERROR. */ type RouterErrorPayload = { routerState: V; storeState: T; event: NavigationError; }; /** * An action dispatched when the router errors. */ type RouterErrorAction = { type: typeof ROUTER_ERROR; payload: RouterErrorPayload; }; declare const routerErrorAction: _ngrx_store.ActionCreator<"@ngrx/router-store/error", (props: { payload: RouterErrorPayload; }) => { payload: RouterErrorPayload; } & _ngrx_store.Action<"@ngrx/router-store/error">>; /** * An action dispatched after navigation has ended and new route is active. */ declare const ROUTER_NAVIGATED = "@ngrx/router-store/navigated"; /** * Payload of ROUTER_NAVIGATED. */ type RouterNavigatedPayload = { routerState: T; event: NavigationEnd; }; /** * An action dispatched after navigation has ended and new route is active. */ type RouterNavigatedAction = { type: typeof ROUTER_NAVIGATED; payload: RouterNavigatedPayload; }; declare const routerNavigatedAction: _ngrx_store.ActionCreator<"@ngrx/router-store/navigated", (props: { payload: RouterNavigatedPayload; }) => { payload: RouterNavigatedPayload; } & _ngrx_store.Action<"@ngrx/router-store/navigated">>; /** * A union type of router actions. */ type RouterAction = RouterRequestAction | RouterNavigationAction | RouterCancelAction | RouterErrorAction | RouterNavigatedAction; type RouterReducerState = { state: T; navigationId: number; }; declare function routerReducer>(state: Result | undefined, action: Action): Result; type StateKeyOrSelector = string | Selector>; declare enum NavigationActionTiming { PreActivation = 1, PostActivation = 2 } declare const DEFAULT_ROUTER_FEATURENAME = "router"; declare const ROUTER_CONFIG: InjectionToken; /** * Minimal = Serializes the router event with MinimalRouterStateSerializer * Full = Serializes the router event with FullRouterStateSerializer */ declare enum RouterState { Full = 0, Minimal = 1 } interface StoreRouterConfig { stateKey?: StateKeyOrSelector; serializer?: new (...args: any[]) => RouterStateSerializer; /** * By default, ROUTER_NAVIGATION is dispatched before guards and resolvers run. * Therefore, the action could run too soon, for example * there may be a navigation cancel due to a guard saying the navigation is not allowed. * To run ROUTER_NAVIGATION after guards and resolvers, * set this property to NavigationActionTiming.PostActivation. */ navigationActionTiming?: NavigationActionTiming; /** * Decides which router serializer should be used, if there is none provided, and the metadata on the dispatched @ngrx/router-store action payload. * Set to `Minimal` to use the `MinimalRouterStateSerializer` and to set a minimal router event with the navigation id and url as payload. * Set to `Full` to use the `FullRouterStateSerializer` and to set the angular router events as payload. */ routerState?: RouterState; } /** * Connects RouterModule with StoreModule. * * During the navigation, before any guards or resolvers run, the router will dispatch * a ROUTER_NAVIGATION action, which has the following signature: * * ``` * export type RouterNavigationPayload = { * routerState: SerializedRouterStateSnapshot, * event: RoutesRecognized * } * ``` * * Either a reducer or an effect can be invoked in response to this action. * If the invoked reducer throws, the navigation will be canceled. * * If navigation gets canceled because of a guard, a ROUTER_CANCEL action will be * dispatched. If navigation results in an error, a ROUTER_ERROR action will be dispatched. * * Both ROUTER_CANCEL and ROUTER_ERROR contain the store state before the navigation * which can be used to restore the consistency of the store. * * Usage: * * ```typescript * @NgModule({ * declarations: [AppCmp, SimpleCmp], * imports: [ * BrowserModule, * StoreModule.forRoot(mapOfReducers), * RouterModule.forRoot([ * { path: '', component: SimpleCmp }, * { path: 'next', component: SimpleCmp } * ]), * StoreRouterConnectingModule.forRoot() * ], * bootstrap: [AppCmp] * }) * export class AppModule { * } * ``` */ declare class StoreRouterConnectingModule { static forRoot(config?: StoreRouterConfig): ModuleWithProviders; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } interface MinimalActivatedRouteSnapshot { routeConfig: ActivatedRouteSnapshot['routeConfig']; url: ActivatedRouteSnapshot['url']; params: ActivatedRouteSnapshot['params']; queryParams: ActivatedRouteSnapshot['queryParams']; fragment: ActivatedRouteSnapshot['fragment']; data: ActivatedRouteSnapshot['data']; outlet: ActivatedRouteSnapshot['outlet']; title: ActivatedRouteSnapshot['title']; firstChild?: MinimalActivatedRouteSnapshot; children: MinimalActivatedRouteSnapshot[]; } interface MinimalRouterStateSnapshot extends BaseRouterStoreState { root: MinimalActivatedRouteSnapshot; url: string; } declare class MinimalRouterStateSerializer implements RouterStateSerializer { serialize(routerState: RouterStateSnapshot): MinimalRouterStateSnapshot; private serializeRoute; } type RouterStateSelectors = { selectCurrentRoute: MemoizedSelector; selectFragment: MemoizedSelector; selectQueryParams: MemoizedSelector; selectQueryParam: (param: string) => MemoizedSelector; selectRouteParams: MemoizedSelector; selectRouteParam: (param: string) => MemoizedSelector; selectRouteData: MemoizedSelector; selectRouteDataParam: (param: string) => MemoizedSelector; selectUrl: MemoizedSelector; selectTitle: MemoizedSelector; }; declare function createRouterSelector>(): MemoizedSelector; declare function getRouterSelectors>(selectState?: (state: V) => RouterReducerState): RouterStateSelectors; /** * Connects the Angular Router to the Store. * * @usageNotes * * ```ts * bootstrapApplication(AppComponent, { * providers: [ * provideStore({ router: routerReducer }), * provideRouterStore(), * ], * }); * ``` */ declare function provideRouterStore(config?: StoreRouterConfig): EnvironmentProviders; export { DEFAULT_ROUTER_FEATURENAME, FullRouterStateSerializer, MinimalRouterStateSerializer, NavigationActionTiming, ROUTER_CANCEL, ROUTER_CONFIG, ROUTER_ERROR, ROUTER_NAVIGATED, ROUTER_NAVIGATION, ROUTER_REQUEST, RouterState, RouterStateSerializer, StoreRouterConnectingModule, createRouterSelector, getRouterSelectors, provideRouterStore, routerCancelAction, routerErrorAction, routerNavigatedAction, routerNavigationAction, routerReducer, routerRequestAction }; export type { BaseRouterStoreState, MinimalActivatedRouteSnapshot, MinimalRouterStateSnapshot, RouterAction, RouterCancelAction, RouterCancelPayload, RouterErrorAction, RouterErrorPayload, RouterNavigatedAction, RouterNavigatedPayload, RouterNavigationAction, RouterNavigationPayload, RouterReducerState, RouterRequestAction, RouterRequestPayload, SerializedRouterStateSnapshot, StateKeyOrSelector, StoreRouterConfig };