@daffodil/category 0.88.1 → 0.89.0
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.
- package/driver/in-memory/index.d.ts +81 -1
- package/driver/index.d.ts +23 -1
- package/driver/magento/index.d.ts +179 -1
- package/driver/magento/testing/index.d.ts +11 -1
- package/driver/testing/index.d.ts +36 -1
- package/fesm2022/daffodil-category-driver-in-memory.mjs +10 -10
- package/fesm2022/daffodil-category-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-category-driver-magento-testing.mjs +3 -3
- package/fesm2022/daffodil-category-driver-magento-testing.mjs.map +1 -1
- package/fesm2022/daffodil-category-driver-magento.mjs +19 -19
- package/fesm2022/daffodil-category-driver-magento.mjs.map +1 -1
- package/fesm2022/daffodil-category-driver-testing.mjs +7 -7
- package/fesm2022/daffodil-category-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-category-routing.mjs +16 -16
- package/fesm2022/daffodil-category-routing.mjs.map +1 -1
- package/fesm2022/daffodil-category-state-testing.mjs +7 -7
- package/fesm2022/daffodil-category-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-category-state.mjs +23 -23
- package/fesm2022/daffodil-category-state.mjs.map +1 -1
- package/fesm2022/daffodil-category-testing.mjs +9 -9
- package/fesm2022/daffodil-category-testing.mjs.map +1 -1
- package/fesm2022/daffodil-category.mjs +0 -1
- package/fesm2022/daffodil-category.mjs.map +1 -1
- package/index.d.ts +126 -1
- package/package.json +1 -1
- package/routing/index.d.ts +68 -1
- package/state/index.d.ts +456 -1
- package/state/testing/index.d.ts +41 -1
- package/testing/index.d.ts +71 -1
- package/driver/in-memory/backend/category.service.d.ts +0 -49
- package/driver/in-memory/backend/public_api.d.ts +0 -1
- package/driver/in-memory/collection-name.const.d.ts +0 -1
- package/driver/in-memory/drivers/category-driver.module.d.ts +0 -12
- package/driver/in-memory/drivers/category.service.d.ts +0 -20
- package/driver/in-memory/drivers/public_api.d.ts +0 -2
- package/driver/in-memory/public_api.d.ts +0 -2
- package/driver/interfaces/category-service.interface.d.ts +0 -17
- package/driver/magento/category-driver.module.d.ts +0 -13
- package/driver/magento/category.service.d.ts +0 -29
- package/driver/magento/fragments/public_api.d.ts +0 -1
- package/driver/magento/fragments/token.d.ts +0 -2
- package/driver/magento/models/category.d.ts +0 -21
- package/driver/magento/models/complete-category-response.d.ts +0 -14
- package/driver/magento/models/get-category-and-products.interface.d.ts +0 -13
- package/driver/magento/models/public_api.d.ts +0 -6
- package/driver/magento/models/requests/custom-metadata-attribute.d.ts +0 -4
- package/driver/magento/models/requests/get-products-by-categories-request.d.ts +0 -9
- package/driver/magento/models/url-resolver.d.ts +0 -4
- package/driver/magento/public_api.d.ts +0 -7
- package/driver/magento/queries/fragments/category-tree.d.ts +0 -1
- package/driver/magento/queries/fragments/public_api.d.ts +0 -1
- package/driver/magento/queries/get-category-and-products.d.ts +0 -3
- package/driver/magento/queries/public_api.d.ts +0 -3
- package/driver/magento/queries/resolve-url/public_api.d.ts +0 -4
- package/driver/magento/queries/resolve-url/query.d.ts +0 -8
- package/driver/magento/queries/resolve-url/response.type.d.ts +0 -4
- package/driver/magento/queries/resolve-url/validator.d.ts +0 -3
- package/driver/magento/queries/resolve-url/variables.type.d.ts +0 -3
- package/driver/magento/testing/factories/category.factory.d.ts +0 -8
- package/driver/magento/testing/factories/public_api.d.ts +0 -1
- package/driver/magento/testing/public_api.d.ts +0 -1
- package/driver/magento/transformers/applied-filter-transformer.service.d.ts +0 -11
- package/driver/magento/transformers/category-page-config-transformer.service.d.ts +0 -8
- package/driver/magento/transformers/category-response-transform.service.d.ts +0 -15
- package/driver/magento/transformers/category-transformer.service.d.ts +0 -13
- package/driver/magento/transformers/public_api.d.ts +0 -4
- package/driver/magento/transformers/pure/add-metadata-types-to-aggregates.d.ts +0 -3
- package/driver/magento/transforms/public_api.d.ts +0 -2
- package/driver/magento/transforms/token.d.ts +0 -2
- package/driver/magento/transforms/type.d.ts +0 -7
- package/driver/public_api.d.ts +0 -1
- package/driver/testing/drivers/category-driver.module.d.ts +0 -12
- package/driver/testing/drivers/category.service.d.ts +0 -21
- package/driver/testing/drivers/public_api.d.ts +0 -2
- package/driver/testing/public_api.d.ts +0 -1
- package/models/category-breadcrumb.d.ts +0 -21
- package/models/category-page-metadata.d.ts +0 -7
- package/models/category-request.d.ts +0 -29
- package/models/category.d.ts +0 -6
- package/models/generic-category.d.ts +0 -45
- package/models/get-category-response.d.ts +0 -21
- package/models/public_api.d.ts +0 -6
- package/public_api.d.ts +0 -1
- package/routing/effects/collection-route.effects.d.ts +0 -10
- package/routing/injection-tokens/public_api.d.ts +0 -1
- package/routing/injection-tokens/request/builder.token.d.ts +0 -2
- package/routing/injection-tokens/request/builders.token.d.ts +0 -4
- package/routing/module.d.ts +0 -8
- package/routing/public_api.d.ts +0 -4
- package/routing/resolvers/category-page-id/category-page-id.resolver.d.ts +0 -20
- package/routing/resolvers/category-page-url/category-page-url.resolver.d.ts +0 -22
- package/routing/resolvers/public_api.d.ts +0 -2
- package/routing/services/public_api.d.ts +0 -1
- package/routing/services/url-request-builder.service.d.ts +0 -17
- package/state/actions/category-page-filter.actions.d.ts +0 -100
- package/state/actions/category-page.actions.d.ts +0 -58
- package/state/actions/category.actions.d.ts +0 -43
- package/state/category-state.module.d.ts +0 -12
- package/state/effects/category-page-metadata.effects.d.ts +0 -29
- package/state/effects/category-page.effects.d.ts +0 -17
- package/state/effects/category.effects.d.ts +0 -16
- package/state/facades/collection/facade.d.ts +0 -9
- package/state/facades/page/category-facade.interface.d.ts +0 -41
- package/state/facades/page/category.facade.d.ts +0 -39
- package/state/facades/public_api.d.ts +0 -3
- package/state/injection-tokens/error-matcher.token.d.ts +0 -2
- package/state/injection-tokens/public_api.d.ts +0 -1
- package/state/product-state.module.d.ts +0 -10
- package/state/public_api.d.ts +0 -9
- package/state/reducers/category/category-reducer-state.interface.d.ts +0 -8
- package/state/reducers/category/category.reducer.d.ts +0 -11
- package/state/reducers/category-entities/category-entities-adapter.d.ts +0 -3
- package/state/reducers/category-entities/category-entities.reducer.d.ts +0 -9
- package/state/reducers/category-reducers.d.ts +0 -6
- package/state/reducers/category-reducers.interface.d.ts +0 -27
- package/state/reducers/category-store-feature-key.d.ts +0 -4
- package/state/reducers/page-metadata/reducer.d.ts +0 -11
- package/state/reducers/page-metadata/state.interface.d.ts +0 -2
- package/state/reducers/product-reducers.d.ts +0 -3
- package/state/reducers/product.reducer.d.ts +0 -10
- package/state/reducers/public_api.d.ts +0 -9
- package/state/reducers/token/extra.token.d.ts +0 -3
- package/state/reducers/token/public_api.d.ts +0 -1
- package/state/reducers/token/reducers.token.d.ts +0 -3
- package/state/selectors/category-entities/category-entities.selector.d.ts +0 -33
- package/state/selectors/category-feature.selector.d.ts +0 -13
- package/state/selectors/category-page/category-page.selector.d.ts +0 -30
- package/state/selectors/category.selector.d.ts +0 -43
- package/state/selectors/collection/selectors.d.ts +0 -5
- package/state/testing/category-testing.module.d.ts +0 -9
- package/state/testing/mock-category-facade.d.ts +0 -30
- package/state/testing/public_api.d.ts +0 -2
- package/testing/factories/category-breadcrumb.factory.d.ts +0 -17
- package/testing/factories/category-page-metadata.factory.d.ts +0 -15
- package/testing/factories/category.factory.d.ts +0 -34
- package/testing/factories/public_api.d.ts +0 -3
- package/testing/helpers/category-helper.d.ts +0 -7
- package/testing/public_api.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@daffodil/category","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/category"]}}},"version":"0.
|
|
1
|
+
{"name":"@daffodil/category","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/category"]}}},"version":"0.89.0","description":"An ecommerce categories package that has multi-platform support and state management features.","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"publishConfig":{"directory":"../../dist/category"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^20.0.0","@angular/core":"^20.0.0","@daffodil/core":"0.89.0","@daffodil/product":"0.89.0","@ngrx/effects":"^20.0.0","@ngrx/entity":"^20.0.0","@ngrx/store":"^20.0.0","rxjs":"7.8.1"},"optionalDependencies":{"@apollo/client":"^3.12.6","@daffodil/driver":"0.89.0","angular-in-memory-web-api":"^0.20.0","apollo-angular":"^11.0.0","@faker-js/faker":"^9.8.0"},"module":"fesm2022/daffodil-category.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","default":"./fesm2022/daffodil-category.mjs"},"./driver":{"types":"./driver/index.d.ts","default":"./fesm2022/daffodil-category-driver.mjs"},"./routing":{"types":"./routing/index.d.ts","default":"./fesm2022/daffodil-category-routing.mjs"},"./state":{"types":"./state/index.d.ts","default":"./fesm2022/daffodil-category-state.mjs"},"./testing":{"types":"./testing/index.d.ts","default":"./fesm2022/daffodil-category-testing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","default":"./fesm2022/daffodil-category-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","default":"./fesm2022/daffodil-category-driver-magento.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","default":"./fesm2022/daffodil-category-driver-testing.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","default":"./fesm2022/daffodil-category-state-testing.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","default":"./fesm2022/daffodil-category-driver-magento-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
|
package/routing/index.d.ts
CHANGED
|
@@ -1 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
|
2
|
+
import { Store, ActionsSubject } from '@ngrx/store';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { DaffCategoryReducersState } from '@daffodil/category/state';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
import { DaffCollectionRequest } from '@daffodil/core';
|
|
7
|
+
import { DaffCategoryUrlRequest } from '@daffodil/category';
|
|
8
|
+
import { DaffRoutingUriNormalizer } from '@daffodil/core/routing';
|
|
9
|
+
import * as i1 from '@daffodil/product/routing';
|
|
10
|
+
import * as i2 from '@ngrx/effects';
|
|
11
|
+
|
|
12
|
+
type DaffCategoryRoutingRequestBuilder<T extends DaffCollectionRequest = DaffCollectionRequest> = (route: ActivatedRouteSnapshot) => T;
|
|
13
|
+
declare const DAFF_CATEGORY_ROUTING_OPTIONS_BUILDERS: i0.InjectionToken<DaffCategoryRoutingRequestBuilder<DaffCollectionRequest>[]>;
|
|
14
|
+
declare const provideDaffCategoryRoutingRequestBuilders: <R extends DaffCategoryRoutingRequestBuilder<DaffCollectionRequest> = DaffCategoryRoutingRequestBuilder<DaffCollectionRequest>>(...values: R[]) => Array<i0.ValueProvider>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Resolves category data for category pages, and will only resolve the url after a category request succeeds or fails. This resolver expects a url
|
|
18
|
+
* of the form `some/url/{id}` where `{id}` is the category id.
|
|
19
|
+
*/
|
|
20
|
+
declare class DaffCategoryPageIdResolver {
|
|
21
|
+
private platformId;
|
|
22
|
+
private requestBuilder;
|
|
23
|
+
private store;
|
|
24
|
+
private dispatcher;
|
|
25
|
+
constructor(platformId: string, requestBuilder: DaffCategoryRoutingRequestBuilder, store: Store<DaffCategoryReducersState>, dispatcher: ActionsSubject);
|
|
26
|
+
resolve(route: ActivatedRouteSnapshot): Observable<boolean>;
|
|
27
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryPageIdResolver, never>;
|
|
28
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryPageIdResolver>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare class DaffCategoryRoutingUrlRequestBuilder {
|
|
32
|
+
private requestBuilder;
|
|
33
|
+
private urlNormalizer;
|
|
34
|
+
constructor(requestBuilder: DaffCategoryRoutingRequestBuilder, urlNormalizer: DaffRoutingUriNormalizer);
|
|
35
|
+
/**
|
|
36
|
+
* Builds a category URL request from the provided route and router state that
|
|
37
|
+
* is suitable for passing to {@link DaffCategoryPageLoadByUrl}.
|
|
38
|
+
*/
|
|
39
|
+
build(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): DaffCategoryUrlRequest;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryRoutingUrlRequestBuilder, never>;
|
|
41
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryRoutingUrlRequestBuilder>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Resolves category data for category pages, and will only resolve the url
|
|
46
|
+
* after a category request succeeds or fails. This resolver will take a full
|
|
47
|
+
* a url of the form `some/url.html(secondary:outlet)?query=param#fragment` and attempt to resolve a product from it.
|
|
48
|
+
* Assumes that the URL to be resolved is the primary outlet.
|
|
49
|
+
*/
|
|
50
|
+
declare class DaffCategoryPageUrlResolver {
|
|
51
|
+
private platformId;
|
|
52
|
+
private store;
|
|
53
|
+
private dispatcher;
|
|
54
|
+
private requestBuilder;
|
|
55
|
+
constructor(platformId: string, store: Store<DaffCategoryReducersState>, dispatcher: ActionsSubject, requestBuilder: DaffCategoryRoutingUrlRequestBuilder);
|
|
56
|
+
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>;
|
|
57
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryPageUrlResolver, never>;
|
|
58
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryPageUrlResolver>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare class DaffCategoryRoutingModule {
|
|
62
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryRoutingModule, never>;
|
|
63
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCategoryRoutingModule, never, [typeof i1.DaffProductRoutingModule, typeof i2.EffectsFeatureModule], never>;
|
|
64
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffCategoryRoutingModule>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { DAFF_CATEGORY_ROUTING_OPTIONS_BUILDERS, DaffCategoryPageIdResolver, DaffCategoryPageUrlResolver, DaffCategoryRoutingModule, DaffCategoryRoutingUrlRequestBuilder, provideDaffCategoryRoutingRequestBuilders };
|
|
68
|
+
export type { DaffCategoryRoutingRequestBuilder };
|
package/state/index.d.ts
CHANGED
|
@@ -1 +1,456 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import * as _ngrx_store from '@ngrx/store';
|
|
3
|
+
import { ActionReducerMap, Action, ActionReducer, MemoizedSelector, Store } from '@ngrx/store';
|
|
4
|
+
import * as i2 from '@ngrx/effects';
|
|
5
|
+
import * as i3 from '@daffodil/product/state';
|
|
6
|
+
import { DaffProductStateRootSlice } from '@daffodil/product/state';
|
|
7
|
+
import * as _daffodil_category from '@daffodil/category';
|
|
8
|
+
import { DaffCategory, DaffCategoryPageMetadata, DaffGenericCategory, DaffCategoryRequest, DaffCategoryIdRequest, DaffCategoryUrlRequest, DaffGetCategoryResponse } from '@daffodil/category';
|
|
9
|
+
import { DaffProduct } from '@daffodil/product';
|
|
10
|
+
import { EntityState, Dictionary } from '@ngrx/entity';
|
|
11
|
+
import { DaffOperationState, DaffStateError, DaffOperationStateSelectors, DaffCollectionMemoizedSelectors, DaffOperationStateFacadeInterface, DaffCollectionFacade, DaffCollectionFacadeInterface, daffTransformErrorToStateError } from '@daffodil/core/state';
|
|
12
|
+
import { DaffFilterRequest, DaffFilterToggleRequest } from '@daffodil/core';
|
|
13
|
+
import { Observable } from 'rxjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A module that provides default reducers and effects for the category redux state.
|
|
17
|
+
*/
|
|
18
|
+
declare class DaffCategoryStateModule {
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryStateModule, never>;
|
|
20
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCategoryStateModule, never, [typeof _ngrx_store.StoreFeatureModule, typeof i2.EffectsFeatureModule, typeof i3.DaffProductStateModule], never>;
|
|
21
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffCategoryStateModule>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A module that provides injectable reducers into product state.
|
|
26
|
+
*/
|
|
27
|
+
declare class DaffCategoryProductStateModule {
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryProductStateModule, never>;
|
|
29
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCategoryProductStateModule, never, [typeof i3.DaffProductStateModule], never>;
|
|
30
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffCategoryProductStateModule>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface DaffCategoryReducerState extends DaffOperationState {
|
|
34
|
+
/**
|
|
35
|
+
* The ID of the currently loaded category.
|
|
36
|
+
*/
|
|
37
|
+
id: DaffCategory['id'];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The key for the slice of category related redux state in the global redux state object.
|
|
42
|
+
*/
|
|
43
|
+
declare const DAFF_CATEGORY_STORE_FEATURE_KEY = "daffCategory";
|
|
44
|
+
|
|
45
|
+
type DaffCategoryPageMetadataReducerState = DaffCategoryPageMetadata;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An interface to describe all of category state.
|
|
49
|
+
*/
|
|
50
|
+
interface DaffCategoryReducersState<V extends DaffGenericCategory<V> = DaffCategory> {
|
|
51
|
+
/**
|
|
52
|
+
* Redux state for category page metadata, category loading state, and errors associated with loading a category.
|
|
53
|
+
*/
|
|
54
|
+
category: DaffCategoryReducerState;
|
|
55
|
+
/**
|
|
56
|
+
* Redux state for category entities.
|
|
57
|
+
*/
|
|
58
|
+
categoryEntities: EntityState<V>;
|
|
59
|
+
/**
|
|
60
|
+
* The product collection metadata for the category page.
|
|
61
|
+
*/
|
|
62
|
+
pageMetadata: DaffCategoryPageMetadataReducerState;
|
|
63
|
+
}
|
|
64
|
+
interface DaffCategoryStateRootSlice<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> extends DaffProductStateRootSlice<W> {
|
|
65
|
+
[DAFF_CATEGORY_STORE_FEATURE_KEY]: DaffCategoryReducersState<V>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* All daffodil defined category reducers.
|
|
70
|
+
*/
|
|
71
|
+
declare const daffCategoryReducers: ActionReducerMap<DaffCategoryReducersState>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The possible types of category page filter actions.
|
|
75
|
+
*/
|
|
76
|
+
declare enum DaffCategoryPageProductCollectionActionTypes {
|
|
77
|
+
CategoryPageReplaceFiltersAction = "[@daffodil/category] Category Page Replace Filters Action",
|
|
78
|
+
CategoryPageApplyFiltersAction = "[@daffodil/category] Category Page Apply Filters Action",
|
|
79
|
+
CategoryPageRemoveFiltersAction = "[@daffodil/category] Category Page Remove Filters Action",
|
|
80
|
+
CategoryPageClearFiltersAction = "[@daffodil/category] Category Page Clear Filters Action",
|
|
81
|
+
CategoryPageToggleFilterAction = "[@daffodil/category] Category Page Toggle Filter Action",
|
|
82
|
+
CategoryPageChangeSizeAction = "[@daffodil/category] Category Page Change Size Action",
|
|
83
|
+
CategoryPageChangeCurrentPageAction = "[@daffodil/category] Category Page Change Current Page Action",
|
|
84
|
+
CategoryPageChangeSortingOptionAction = "[@daffodil/category] Category Page Change Sorting Option Action"
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* An action for replacing the filters for the current category.
|
|
88
|
+
* All existing filters will be removed and the specified filters will be applied.
|
|
89
|
+
*
|
|
90
|
+
* @param filters - Filters to be set on the current category.
|
|
91
|
+
*/
|
|
92
|
+
declare class DaffCategoryPageReplaceFilters implements Action {
|
|
93
|
+
filters: DaffFilterRequest[];
|
|
94
|
+
readonly type = DaffCategoryPageProductCollectionActionTypes.CategoryPageReplaceFiltersAction;
|
|
95
|
+
constructor(filters: DaffFilterRequest[]);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* An action for applying the specified filters for the current category.
|
|
99
|
+
*
|
|
100
|
+
* @param filters - Filters to be applied to the current category.
|
|
101
|
+
*/
|
|
102
|
+
declare class DaffCategoryPageApplyFilters implements Action {
|
|
103
|
+
filters: DaffFilterRequest[];
|
|
104
|
+
readonly type = DaffCategoryPageProductCollectionActionTypes.CategoryPageApplyFiltersAction;
|
|
105
|
+
constructor(filters: DaffFilterRequest[]);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* An action for removing the specified filters for the current category.
|
|
109
|
+
*
|
|
110
|
+
* @param filters - Filters to be removed from the current category.
|
|
111
|
+
*/
|
|
112
|
+
declare class DaffCategoryPageRemoveFilters implements Action {
|
|
113
|
+
filters: DaffFilterRequest[];
|
|
114
|
+
readonly type = DaffCategoryPageProductCollectionActionTypes.CategoryPageRemoveFiltersAction;
|
|
115
|
+
constructor(filters: DaffFilterRequest[]);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* An action for removing all the filters for the current category.
|
|
119
|
+
*/
|
|
120
|
+
declare class DaffCategoryPageClearFilters implements Action {
|
|
121
|
+
readonly type = DaffCategoryPageProductCollectionActionTypes.CategoryPageClearFiltersAction;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* An action for toggling a filters for the current category.
|
|
125
|
+
*
|
|
126
|
+
* @param filter - Filter to be toggled on the current category.
|
|
127
|
+
*/
|
|
128
|
+
declare class DaffCategoryPageToggleFilter implements Action {
|
|
129
|
+
filter: DaffFilterToggleRequest;
|
|
130
|
+
readonly type = DaffCategoryPageProductCollectionActionTypes.CategoryPageToggleFilterAction;
|
|
131
|
+
constructor(filter: DaffFilterToggleRequest);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* An action for changing the number of products shown on each page for the selected category.
|
|
135
|
+
*
|
|
136
|
+
* @param pageSize - The number of products per page.
|
|
137
|
+
*/
|
|
138
|
+
declare class DaffCategoryPageChangePageSize implements Action {
|
|
139
|
+
pageSize: number;
|
|
140
|
+
readonly type = DaffCategoryPageProductCollectionActionTypes.CategoryPageChangeSizeAction;
|
|
141
|
+
constructor(pageSize: number);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* An action for changing the current page of products for the selected category.
|
|
145
|
+
*
|
|
146
|
+
* @param currentPage - The current page of products for the selected category.
|
|
147
|
+
*/
|
|
148
|
+
declare class DaffCategoryPageChangeCurrentPage implements Action {
|
|
149
|
+
currentPage: number;
|
|
150
|
+
readonly type = DaffCategoryPageProductCollectionActionTypes.CategoryPageChangeCurrentPageAction;
|
|
151
|
+
constructor(currentPage: number);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* An action for changing the sorting option for the selected category.
|
|
155
|
+
*
|
|
156
|
+
* @param sort - The sort option to be applied.
|
|
157
|
+
*/
|
|
158
|
+
declare class DaffCategoryPageChangeSortingOption implements Action {
|
|
159
|
+
sort: {
|
|
160
|
+
option: DaffCategoryRequest['appliedSortOption'];
|
|
161
|
+
direction: DaffCategoryRequest['appliedSortDirection'];
|
|
162
|
+
};
|
|
163
|
+
readonly type = DaffCategoryPageProductCollectionActionTypes.CategoryPageChangeSortingOptionAction;
|
|
164
|
+
constructor(sort: {
|
|
165
|
+
option: DaffCategoryRequest['appliedSortOption'];
|
|
166
|
+
direction: DaffCategoryRequest['appliedSortDirection'];
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
type DaffCategoryPageProductCollectionActions = DaffCategoryPageReplaceFilters | DaffCategoryPageApplyFilters | DaffCategoryPageRemoveFilters | DaffCategoryPageClearFilters | DaffCategoryPageToggleFilter | DaffCategoryPageChangePageSize | DaffCategoryPageChangeCurrentPage | DaffCategoryPageChangeSortingOption;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The possible types of category page actions.
|
|
173
|
+
*/
|
|
174
|
+
declare enum DaffCategoryPageActionTypes {
|
|
175
|
+
CategoryPageLoadAction = "[@daffodil/category] Category Page Load Action",
|
|
176
|
+
CategoryPageLoadByUrlAction = "[@daffodil/category] Category Page Load By URL Action",
|
|
177
|
+
CategoryPageLoadSuccessAction = "[@daffodil/category] Category Page Load Success Action",
|
|
178
|
+
CategoryPageLoadFailureAction = "[@daffodil/category] Category Page Load Failure Action"
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* An action triggered to initialize a category page load request.
|
|
182
|
+
* This is intended to be used for loading full category pages.
|
|
183
|
+
* Queries the category by ID.
|
|
184
|
+
*
|
|
185
|
+
* @param request - DaffCategoryRequest object
|
|
186
|
+
*/
|
|
187
|
+
declare class DaffCategoryPageLoad implements Action {
|
|
188
|
+
request: DaffCategoryIdRequest;
|
|
189
|
+
readonly type = DaffCategoryPageActionTypes.CategoryPageLoadAction;
|
|
190
|
+
constructor(request: DaffCategoryIdRequest);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* An action triggered to initialize a category page load request.
|
|
194
|
+
* This is intended to be used for loading full category pages.
|
|
195
|
+
* Queries the category by URL.
|
|
196
|
+
*
|
|
197
|
+
* @param request - DaffCategoryRequest object
|
|
198
|
+
*/
|
|
199
|
+
declare class DaffCategoryPageLoadByUrl implements Action {
|
|
200
|
+
request: DaffCategoryUrlRequest;
|
|
201
|
+
readonly type = DaffCategoryPageActionTypes.CategoryPageLoadByUrlAction;
|
|
202
|
+
constructor(request: DaffCategoryUrlRequest);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* An action triggered upon a successful category page request.
|
|
206
|
+
*
|
|
207
|
+
* @param response - DaffGetCategoryResponse object
|
|
208
|
+
*/
|
|
209
|
+
declare class DaffCategoryPageLoadSuccess<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> implements Action {
|
|
210
|
+
response: DaffGetCategoryResponse<V, W>;
|
|
211
|
+
readonly type = DaffCategoryPageActionTypes.CategoryPageLoadSuccessAction;
|
|
212
|
+
constructor(response: DaffGetCategoryResponse<V, W>);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* An action triggered upon a failed category page request.
|
|
216
|
+
*
|
|
217
|
+
* @param errorMessage - an error message
|
|
218
|
+
*/
|
|
219
|
+
declare class DaffCategoryPageLoadFailure implements Action {
|
|
220
|
+
errorMessage: DaffStateError;
|
|
221
|
+
readonly type = DaffCategoryPageActionTypes.CategoryPageLoadFailureAction;
|
|
222
|
+
constructor(errorMessage: DaffStateError);
|
|
223
|
+
}
|
|
224
|
+
type DaffCategoryPageActions<U extends DaffGenericCategory<U> = DaffCategory, W extends DaffProduct = DaffProduct> = DaffCategoryPageLoad | DaffCategoryPageLoadByUrl | DaffCategoryPageLoadSuccess<U, W> | DaffCategoryPageLoadFailure;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* The possible types of category actions.
|
|
228
|
+
*/
|
|
229
|
+
declare enum DaffCategoryActionTypes {
|
|
230
|
+
CategoryLoadAction = "[@daffodil/category] Category Load Action",
|
|
231
|
+
CategoryLoadSuccessAction = "[@daffodil/category] Category Load Success Action",
|
|
232
|
+
CategoryLoadFailureAction = "[@daffodil/category] Category Load Failure Action"
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* An action triggered to initialize a category load request.
|
|
236
|
+
*
|
|
237
|
+
* @param request - DaffCategoryRequest object
|
|
238
|
+
*/
|
|
239
|
+
declare class DaffCategoryLoad implements Action {
|
|
240
|
+
request: DaffCategoryIdRequest;
|
|
241
|
+
readonly type = DaffCategoryActionTypes.CategoryLoadAction;
|
|
242
|
+
constructor(request: DaffCategoryIdRequest);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* An action triggered upon a successful category request.
|
|
246
|
+
*
|
|
247
|
+
* @param response - DaffGetCategoryResponse object
|
|
248
|
+
*/
|
|
249
|
+
declare class DaffCategoryLoadSuccess<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> implements Action {
|
|
250
|
+
response: DaffGetCategoryResponse<V, W>;
|
|
251
|
+
readonly type = DaffCategoryActionTypes.CategoryLoadSuccessAction;
|
|
252
|
+
constructor(response: DaffGetCategoryResponse<V, W>);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* An action triggered upon a failed category request.
|
|
256
|
+
*
|
|
257
|
+
* @param errorMessage - an error message
|
|
258
|
+
*/
|
|
259
|
+
declare class DaffCategoryLoadFailure implements Action {
|
|
260
|
+
errorMessage: DaffStateError;
|
|
261
|
+
readonly type = DaffCategoryActionTypes.CategoryLoadFailureAction;
|
|
262
|
+
constructor(errorMessage: DaffStateError);
|
|
263
|
+
}
|
|
264
|
+
type DaffCategoryActions<U extends DaffGenericCategory<U> = DaffCategory, W extends DaffProduct = DaffProduct> = DaffCategoryLoad | DaffCategoryLoadSuccess<U, W> | DaffCategoryLoadFailure;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Returns the state for category data except for category entities.
|
|
268
|
+
*/
|
|
269
|
+
declare function daffCategoryReducer<U extends DaffGenericCategory<U>, W extends DaffProduct>(state: DaffCategoryReducerState, action: DaffCategoryActions<U, W> | DaffCategoryPageActions<U, W> | DaffCategoryPageProductCollectionActions): DaffCategoryReducerState;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Returns the state for category data except for category entities.
|
|
273
|
+
*/
|
|
274
|
+
declare function daffCategoryPageMetadataReducer<U extends DaffGenericCategory<U>, W extends DaffProduct>(state: _daffodil_category.DaffCategoryPageMetadata, action: DaffCategoryActions<U, W> | DaffCategoryPageActions<U, W> | DaffCategoryPageProductCollectionActions): DaffCategoryPageMetadataReducerState;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* A reducer function to store category entities from DaffCategoryLoadSuccess and DaffCategoryPageLoadSuccess actions.
|
|
278
|
+
*/
|
|
279
|
+
declare function daffCategoryEntitiesReducer<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct>(state: EntityState<V>, action: DaffCategoryActions<V, W> | DaffCategoryPageActions<V, W>): EntityState<V>;
|
|
280
|
+
|
|
281
|
+
declare const DAFF_CATEGORY_EXTRA_REDUCERS: i0.InjectionToken<ActionReducer<DaffCategoryReducersState<_daffodil_category.DaffCategory>, _ngrx_store.Action<string>>[]>;
|
|
282
|
+
declare const daffCategoryProvideExtraReducers: <R extends ActionReducer<DaffCategoryReducersState<_daffodil_category.DaffCategory>, _ngrx_store.Action<string>> = ActionReducer<DaffCategoryReducersState<_daffodil_category.DaffCategory>, _ngrx_store.Action<string>>>(...values: R[]) => Array<i0.ValueProvider>;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* An interface to describe all selectors related to category ngrx entities state.
|
|
286
|
+
*/
|
|
287
|
+
interface DaffCategoryEntitiesMemoizedSelectors<V extends DaffGenericCategory<V> = DaffCategory> {
|
|
288
|
+
/**
|
|
289
|
+
* Selects ngrx category entities state.
|
|
290
|
+
*/
|
|
291
|
+
selectCategoryEntitiesState: MemoizedSelector<DaffCategoryStateRootSlice<V>, EntityState<V>>;
|
|
292
|
+
/**
|
|
293
|
+
* Selects the ids of all categories in state.
|
|
294
|
+
*/
|
|
295
|
+
selectCategoryIds: MemoizedSelector<DaffCategoryStateRootSlice<V>, string[] | number[]>;
|
|
296
|
+
/**
|
|
297
|
+
* Selects all categories in state as a dictionary.
|
|
298
|
+
*/
|
|
299
|
+
selectCategoryEntities: MemoizedSelector<DaffCategoryStateRootSlice<V>, Dictionary<V>>;
|
|
300
|
+
/**
|
|
301
|
+
* Selects all categories in state as an array.
|
|
302
|
+
*/
|
|
303
|
+
selectAllCategories: MemoizedSelector<DaffCategoryStateRootSlice<V>, V[]>;
|
|
304
|
+
/**
|
|
305
|
+
* Selects the total number of categories in state.
|
|
306
|
+
*/
|
|
307
|
+
selectCategoryTotal: MemoizedSelector<DaffCategoryStateRootSlice<V>, number>;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* An interface for the entire category feature state.
|
|
312
|
+
*/
|
|
313
|
+
interface DaffCategoryFeatureMemoizedSelectors<V extends DaffGenericCategory<V> = DaffCategory> {
|
|
314
|
+
selectCategoryFeatureState: MemoizedSelector<DaffCategoryStateRootSlice<V>, DaffCategoryReducersState<V>>;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* An interface to describe all selectors related to the category page metadata, category loading, and errors.
|
|
319
|
+
*/
|
|
320
|
+
interface DaffCategoryPageMemoizedSelectors<V extends DaffGenericCategory<V> = DaffCategory> extends DaffOperationStateSelectors<DaffCategoryStateRootSlice<V>, DaffCategoryReducerState> {
|
|
321
|
+
/**
|
|
322
|
+
* Selects all state related to the category page metadata, category loading, and errors.
|
|
323
|
+
*/
|
|
324
|
+
selectCategoryState: MemoizedSelector<DaffCategoryStateRootSlice<V>, DaffCategoryReducerState>;
|
|
325
|
+
/**
|
|
326
|
+
* Selects the ids of all products in the current category page.
|
|
327
|
+
*/
|
|
328
|
+
selectCategoryPageProductIds: MemoizedSelector<DaffCategoryStateRootSlice<V>, DaffCategoryPageMetadata['ids']>;
|
|
329
|
+
/**
|
|
330
|
+
* Selects whether the category page has no products.
|
|
331
|
+
*/
|
|
332
|
+
selectIsCategoryPageEmpty: MemoizedSelector<DaffCategoryStateRootSlice<V>, boolean>;
|
|
333
|
+
/**
|
|
334
|
+
* Selects the id of the current category.
|
|
335
|
+
*/
|
|
336
|
+
selectCurrentCategoryId: MemoizedSelector<DaffCategoryStateRootSlice<V>, DaffCategoryPageMetadata['id']>;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
type DaffCategoryPageProductCollectionSelectors = DaffCollectionMemoizedSelectors<DaffCategoryStateRootSlice, DaffCategoryPageMetadata>;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* An interface for selectors that combine category metadata and category entities selectors.
|
|
343
|
+
*/
|
|
344
|
+
interface DaffCategoryMemoizedSelectors<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> extends DaffCategoryFeatureMemoizedSelectors<V>, DaffCategoryPageMemoizedSelectors<V>, DaffCategoryPageProductCollectionSelectors, DaffCategoryEntitiesMemoizedSelectors<V> {
|
|
345
|
+
/**
|
|
346
|
+
* Selects the current category
|
|
347
|
+
*/
|
|
348
|
+
selectCurrentCategory: MemoizedSelector<DaffCategoryStateRootSlice<V>, V>;
|
|
349
|
+
/**
|
|
350
|
+
* Selects the products of the current category.
|
|
351
|
+
*/
|
|
352
|
+
selectCategoryPageProducts: MemoizedSelector<DaffCategoryStateRootSlice<V, W>, W[]>;
|
|
353
|
+
/**
|
|
354
|
+
* Selects a category by id.
|
|
355
|
+
*
|
|
356
|
+
* @param categoryId a category id.
|
|
357
|
+
*/
|
|
358
|
+
selectCategory: (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V>, V>;
|
|
359
|
+
/**
|
|
360
|
+
* Selects products by category id.
|
|
361
|
+
*
|
|
362
|
+
* @param categoryId a category id.
|
|
363
|
+
*/
|
|
364
|
+
selectProductsByCategory: (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V, W>, W[]>;
|
|
365
|
+
/**
|
|
366
|
+
* Selects the total number of products in a category.
|
|
367
|
+
*
|
|
368
|
+
* @param categoryId a category id.
|
|
369
|
+
*/
|
|
370
|
+
selectTotalProductsByCategory: (categoryId: V['id']) => MemoizedSelector<DaffCategoryStateRootSlice<V>, number>;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* A function that returns all combinatoric category selectors.
|
|
374
|
+
*/
|
|
375
|
+
declare const getDaffCategorySelectors: <V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct>() => DaffCategoryMemoizedSelectors<V, W>;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* A facade for interacting with the category state.
|
|
379
|
+
* This facade exposes many parts of the state for easy access and allows dispatching of actions.
|
|
380
|
+
*/
|
|
381
|
+
interface DaffCategoryFacadeInterface<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> extends DaffOperationStateFacadeInterface<DaffCategoryReducerState> {
|
|
382
|
+
/**
|
|
383
|
+
* The currently selected category.
|
|
384
|
+
*/
|
|
385
|
+
category$: Observable<V>;
|
|
386
|
+
/**
|
|
387
|
+
* Products of the current category.
|
|
388
|
+
*/
|
|
389
|
+
products$: Observable<W[]>;
|
|
390
|
+
/**
|
|
391
|
+
* Is the category page empty of products.
|
|
392
|
+
*/
|
|
393
|
+
isCategoryEmpty$: Observable<boolean>;
|
|
394
|
+
/**
|
|
395
|
+
* Get a category by the provided Id.
|
|
396
|
+
*
|
|
397
|
+
* @param id
|
|
398
|
+
*/
|
|
399
|
+
getCategoryById(id: V['id']): Observable<V>;
|
|
400
|
+
/**
|
|
401
|
+
* Get products by a category Id.
|
|
402
|
+
*
|
|
403
|
+
* @param categoryId
|
|
404
|
+
*/
|
|
405
|
+
getProductsByCategory(categoryId: V['id']): Observable<W[]>;
|
|
406
|
+
/**
|
|
407
|
+
* Get products by a category Id.
|
|
408
|
+
*
|
|
409
|
+
* @param categoryId
|
|
410
|
+
*/
|
|
411
|
+
getTotalProductsByCategory(categoryId: V['id']): Observable<number>;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* A facade for interacting with the category state.
|
|
416
|
+
* This facade exposes many parts of the state for easy access and allows dispatching of actions.
|
|
417
|
+
*
|
|
418
|
+
* @inheritdoc
|
|
419
|
+
*/
|
|
420
|
+
declare class DaffCategoryFacade<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> implements DaffCategoryFacadeInterface<V, W> {
|
|
421
|
+
private store;
|
|
422
|
+
private categorySelectors;
|
|
423
|
+
category$: Observable<V>;
|
|
424
|
+
loadingState$: Observable<DaffCategoryReducerState['daffState']>;
|
|
425
|
+
loading$: Observable<boolean>;
|
|
426
|
+
mutating$: Observable<boolean>;
|
|
427
|
+
resolving$: Observable<boolean>;
|
|
428
|
+
products$: Observable<W[]>;
|
|
429
|
+
errors$: Observable<DaffStateError[]>;
|
|
430
|
+
hasErrors$: Observable<boolean>;
|
|
431
|
+
isCategoryEmpty$: Observable<boolean>;
|
|
432
|
+
getCategoryById(id: V['id']): Observable<V>;
|
|
433
|
+
getProductsByCategory(categoryId: V['id']): Observable<W[]>;
|
|
434
|
+
getTotalProductsByCategory(categoryId: V['id']): Observable<number>;
|
|
435
|
+
constructor(store: Store<DaffCategoryStateRootSlice<V, W>>);
|
|
436
|
+
/**
|
|
437
|
+
* Dispatches the given action.
|
|
438
|
+
*
|
|
439
|
+
* @param action action to dispatch.
|
|
440
|
+
*/
|
|
441
|
+
dispatch(action: Action): void;
|
|
442
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryFacade<any, any>, never>;
|
|
443
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryFacade<any, any>>;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
declare class DaffCategoryProductCollectionFacade extends DaffCollectionFacade<DaffCategoryStateRootSlice> implements DaffCollectionFacadeInterface {
|
|
447
|
+
constructor(store: Store<DaffCategoryStateRootSlice>);
|
|
448
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryProductCollectionFacade, never>;
|
|
449
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryProductCollectionFacade>;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare const DAFF_CATEGORY_ERROR_MATCHER: i0.InjectionToken<typeof daffTransformErrorToStateError>;
|
|
453
|
+
declare const provideDaffCategoryErrorMatcher: <R extends typeof daffTransformErrorToStateError = typeof daffTransformErrorToStateError>(value: R) => i0.ValueProvider;
|
|
454
|
+
|
|
455
|
+
export { DAFF_CATEGORY_ERROR_MATCHER, DAFF_CATEGORY_EXTRA_REDUCERS, DAFF_CATEGORY_STORE_FEATURE_KEY, DaffCategoryActionTypes, DaffCategoryFacade, DaffCategoryLoad, DaffCategoryLoadFailure, DaffCategoryLoadSuccess, DaffCategoryPageActionTypes, DaffCategoryPageApplyFilters, DaffCategoryPageChangeCurrentPage, DaffCategoryPageChangePageSize, DaffCategoryPageChangeSortingOption, DaffCategoryPageClearFilters, DaffCategoryPageLoad, DaffCategoryPageLoadByUrl, DaffCategoryPageLoadFailure, DaffCategoryPageLoadSuccess, DaffCategoryPageProductCollectionActionTypes, DaffCategoryPageRemoveFilters, DaffCategoryPageReplaceFilters, DaffCategoryPageToggleFilter, DaffCategoryProductCollectionFacade, DaffCategoryProductStateModule, DaffCategoryStateModule, daffCategoryEntitiesReducer, daffCategoryPageMetadataReducer, daffCategoryProvideExtraReducers, daffCategoryReducer, daffCategoryReducers, getDaffCategorySelectors, provideDaffCategoryErrorMatcher };
|
|
456
|
+
export type { DaffCategoryActions, DaffCategoryFacadeInterface, DaffCategoryMemoizedSelectors, DaffCategoryPageActions, DaffCategoryPageMetadataReducerState, DaffCategoryPageProductCollectionActions, DaffCategoryReducerState, DaffCategoryReducersState, DaffCategoryStateRootSlice };
|
package/state/testing/index.d.ts
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Action } from '@ngrx/store';
|
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
|
4
|
+
import { DaffCategory } from '@daffodil/category';
|
|
5
|
+
import { DaffCategoryFacadeInterface, DaffCategoryReducerState } from '@daffodil/category/state';
|
|
6
|
+
import { DaffStateError } from '@daffodil/core/state';
|
|
7
|
+
import { DaffProduct } from '@daffodil/product';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A module that mocks out the {@link DaffCategoryFacade} with {@link MockDaffCategoryFacade} for testing environments.
|
|
11
|
+
*/
|
|
12
|
+
declare class DaffCategoryStateTestingModule {
|
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryStateTestingModule, never>;
|
|
14
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCategoryStateTestingModule, never, never, never>;
|
|
15
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffCategoryStateTestingModule>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Can be used to mock out the {@link DaffCategoryFacade} in testing environments.
|
|
20
|
+
*
|
|
21
|
+
* @inheritdoc
|
|
22
|
+
*/
|
|
23
|
+
declare class MockDaffCategoryFacade implements DaffCategoryFacadeInterface {
|
|
24
|
+
category$: BehaviorSubject<DaffCategory>;
|
|
25
|
+
loadingState$: BehaviorSubject<DaffCategoryReducerState['daffState']>;
|
|
26
|
+
loading$: BehaviorSubject<boolean>;
|
|
27
|
+
mutating$: BehaviorSubject<boolean>;
|
|
28
|
+
resolving$: BehaviorSubject<boolean>;
|
|
29
|
+
hasErrors$: BehaviorSubject<boolean>;
|
|
30
|
+
products$: BehaviorSubject<DaffProduct[]>;
|
|
31
|
+
errors$: BehaviorSubject<DaffStateError[]>;
|
|
32
|
+
isCategoryEmpty$: BehaviorSubject<boolean>;
|
|
33
|
+
getCategoryById(id: DaffCategory['id']): BehaviorSubject<DaffCategory>;
|
|
34
|
+
getProductsByCategory(categoryId: DaffCategory['id']): BehaviorSubject<DaffProduct[]>;
|
|
35
|
+
getTotalProductsByCategory(categoryId: DaffCategory['id']): BehaviorSubject<number>;
|
|
36
|
+
dispatch(action: Action): void;
|
|
37
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MockDaffCategoryFacade, never>;
|
|
38
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MockDaffCategoryFacade>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { DaffCategoryStateTestingModule, MockDaffCategoryFacade };
|
package/testing/index.d.ts
CHANGED
|
@@ -1 +1,71 @@
|
|
|
1
|
-
|
|
1
|
+
import * as _daffodil_category from '@daffodil/category';
|
|
2
|
+
import { DaffCategoryBreadcrumb, DaffCategory, DaffCategoryPageMetadata } from '@daffodil/category';
|
|
3
|
+
import { DaffModelFactory, MockCollectionMetadata, DaffNumericallyPaginableFactory, DaffSortableFactory, DaffFilterFactory } from '@daffodil/core/testing';
|
|
4
|
+
import { DaffProduct } from '@daffodil/product';
|
|
5
|
+
import * as i0 from '@angular/core';
|
|
6
|
+
|
|
7
|
+
declare class MockCategoryBreadcrumb implements DaffCategoryBreadcrumb {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
level: number;
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A factory for creating a {@link DaffCategoryBreadcrumb}.
|
|
15
|
+
*/
|
|
16
|
+
declare class DaffCategoryBreadcrumbFactory extends DaffModelFactory<DaffCategoryBreadcrumb, typeof MockCategoryBreadcrumb> {
|
|
17
|
+
constructor();
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryBreadcrumbFactory, never>;
|
|
19
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryBreadcrumbFactory>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare class MockCategory implements DaffCategory {
|
|
23
|
+
protected breadcrumbFactory: DaffCategoryBreadcrumbFactory;
|
|
24
|
+
id: string;
|
|
25
|
+
url: string;
|
|
26
|
+
canonicalUrl: string;
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
meta_title: string;
|
|
30
|
+
meta_description: string;
|
|
31
|
+
breadcrumbs: _daffodil_category.DaffCategoryBreadcrumb[];
|
|
32
|
+
children_count: number;
|
|
33
|
+
total_products: number;
|
|
34
|
+
product_ids: string[];
|
|
35
|
+
constructor(breadcrumbFactory: DaffCategoryBreadcrumbFactory);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A factory for creating a {@link DaffCategory}.
|
|
39
|
+
*/
|
|
40
|
+
declare class DaffCategoryFactory extends DaffModelFactory<DaffCategory, typeof MockCategory> {
|
|
41
|
+
constructor(breadcrumbFactory: DaffCategoryBreadcrumbFactory);
|
|
42
|
+
/**
|
|
43
|
+
* Creates a category tree of specified depth, optionally using the passed product IDs.
|
|
44
|
+
* This is very useful for creating a category tree that closely resembles those found in the wild.
|
|
45
|
+
* Each child has a minimum of half of the parent's products.
|
|
46
|
+
*/
|
|
47
|
+
createTree(depth: number, productIds?: DaffProduct['id'][], partial?: Partial<DaffCategory>): DaffCategory;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryFactory, never>;
|
|
49
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryFactory>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A helper function to verify that a model is a Category.
|
|
54
|
+
*
|
|
55
|
+
* @param category
|
|
56
|
+
*/
|
|
57
|
+
declare function isCategory(category: DaffCategory): boolean;
|
|
58
|
+
|
|
59
|
+
declare class MockCategoryPageMetadata extends MockCollectionMetadata implements DaffCategoryPageMetadata {
|
|
60
|
+
id: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A factory for creating {@link DaffCategoryPageMetadata}.
|
|
64
|
+
*/
|
|
65
|
+
declare class DaffCategoryPageMetadataFactory extends DaffModelFactory<DaffCategoryPageMetadata> {
|
|
66
|
+
constructor(pageInfoFactory: DaffNumericallyPaginableFactory, sortFieldsFactory: DaffSortableFactory, filterFactory: DaffFilterFactory);
|
|
67
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryPageMetadataFactory, never>;
|
|
68
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryPageMetadataFactory>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { DaffCategoryBreadcrumbFactory, DaffCategoryFactory, DaffCategoryPageMetadataFactory, MockCategory, MockCategoryBreadcrumb, MockCategoryPageMetadata, isCategory };
|