@daffodil/category 0.53.1 → 0.56.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/esm2020/routing/module.mjs +4 -1
- package/esm2020/routing/public_api.mjs +2 -1
- package/esm2020/routing/resolvers/category-page-url/category-page-url.resolver.mjs +8 -18
- package/esm2020/routing/services/public_api.mjs +2 -0
- package/esm2020/routing/services/url-request-builder.service.mjs +35 -0
- package/esm2020/state/facades/page/category-facade.interface.mjs +1 -1
- package/esm2020/state/facades/page/category.facade.mjs +7 -7
- package/esm2020/state/product-state.module.mjs +29 -0
- package/esm2020/state/public_api.mjs +2 -1
- package/esm2020/state/reducers/category/category-reducer-state.interface.mjs +1 -1
- package/esm2020/state/reducers/category/category.reducer.mjs +7 -28
- package/esm2020/state/reducers/product-reducers.mjs +9 -0
- package/esm2020/state/reducers/product.reducer.mjs +30 -0
- package/esm2020/state/selectors/category-page/category-page.selector.mjs +3 -13
- package/esm2020/state/testing/mock-category-facade.mjs +6 -6
- package/fesm2015/daffodil-category-routing.mjs +41 -16
- package/fesm2015/daffodil-category-routing.mjs.map +1 -1
- package/fesm2015/daffodil-category-state-testing.mjs +5 -5
- package/fesm2015/daffodil-category-state-testing.mjs.map +1 -1
- package/fesm2015/daffodil-category-state.mjs +74 -37
- package/fesm2015/daffodil-category-state.mjs.map +1 -1
- package/fesm2020/daffodil-category-routing.mjs +43 -20
- package/fesm2020/daffodil-category-routing.mjs.map +1 -1
- package/fesm2020/daffodil-category-state-testing.mjs +5 -5
- package/fesm2020/daffodil-category-state-testing.mjs.map +1 -1
- package/fesm2020/daffodil-category-state.mjs +73 -49
- package/fesm2020/daffodil-category-state.mjs.map +1 -1
- package/package.json +4 -4
- package/routing/public_api.d.ts +1 -0
- package/routing/resolvers/category-page-url/category-page-url.resolver.d.ts +3 -5
- package/routing/services/public_api.d.ts +1 -0
- package/routing/services/url-request-builder.service.d.ts +17 -0
- package/state/facades/page/category-facade.interface.d.ts +2 -31
- package/state/facades/page/category.facade.d.ts +5 -5
- package/state/product-state.module.d.ts +10 -0
- package/state/public_api.d.ts +1 -0
- package/state/reducers/category/category-reducer-state.interface.d.ts +2 -14
- package/state/reducers/product-reducers.d.ts +3 -0
- package/state/reducers/product.reducer.d.ts +10 -0
- package/state/selectors/category-page/category-page.selector.d.ts +2 -26
- package/state/testing/mock-category-facade.d.ts +5 -5
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@daffodil/category",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.56.0",
|
4
4
|
"description": "An ecommerce categories package that has multi-platform support and state management features.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -18,8 +18,8 @@
|
|
18
18
|
"peerDependencies": {
|
19
19
|
"@angular/common": "^13.0.0",
|
20
20
|
"@angular/core": "^13.0.0",
|
21
|
-
"@daffodil/core": "0.
|
22
|
-
"@daffodil/product": "0.
|
21
|
+
"@daffodil/core": "0.56.0",
|
22
|
+
"@daffodil/product": "0.56.0",
|
23
23
|
"@ngrx/effects": "^13.0.0",
|
24
24
|
"@ngrx/entity": "^13.0.0",
|
25
25
|
"@ngrx/store": "^13.0.0",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
},
|
28
28
|
"optionalDependencies": {
|
29
29
|
"@apollo/client": "^3.0.0",
|
30
|
-
"@daffodil/driver": "0.
|
30
|
+
"@daffodil/driver": "0.56.0",
|
31
31
|
"angular-in-memory-web-api": "^0.13.0",
|
32
32
|
"apollo-angular": "^3.0.1",
|
33
33
|
"@faker-js/faker": "^7.6.0"
|
package/routing/public_api.d.ts
CHANGED
@@ -2,8 +2,7 @@ import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/r
|
|
2
2
|
import { ActionsSubject, Store } from '@ngrx/store';
|
3
3
|
import { Observable } from 'rxjs';
|
4
4
|
import { DaffCategoryReducersState } from '@daffodil/category/state';
|
5
|
-
import {
|
6
|
-
import { DaffCategoryRoutingRequestBuilder } from '../../injection-tokens/public_api';
|
5
|
+
import { DaffCategoryRoutingUrlRequestBuilder } from '../../services/public_api';
|
7
6
|
import * as i0 from "@angular/core";
|
8
7
|
/**
|
9
8
|
* Resolves category data for category pages, and will only resolve the url
|
@@ -13,11 +12,10 @@ import * as i0 from "@angular/core";
|
|
13
12
|
*/
|
14
13
|
export declare class DaffCategoryPageUrlResolver implements Resolve<Observable<boolean>> {
|
15
14
|
private platformId;
|
16
|
-
private requestBuilder;
|
17
15
|
private store;
|
18
16
|
private dispatcher;
|
19
|
-
private
|
20
|
-
constructor(platformId: string,
|
17
|
+
private requestBuilder;
|
18
|
+
constructor(platformId: string, store: Store<DaffCategoryReducersState>, dispatcher: ActionsSubject, requestBuilder: DaffCategoryRoutingUrlRequestBuilder);
|
21
19
|
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>;
|
22
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryPageUrlResolver, never>;
|
23
21
|
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryPageUrlResolver>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { DaffCategoryRoutingUrlRequestBuilder } from './url-request-builder.service';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
2
|
+
import { DaffCategoryUrlRequest } from '@daffodil/category';
|
3
|
+
import { DaffRoutingUriNormalizer } from '@daffodil/core/routing';
|
4
|
+
import { DaffCategoryRoutingRequestBuilder } from '../injection-tokens/public_api';
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
export declare class DaffCategoryRoutingUrlRequestBuilder {
|
7
|
+
private requestBuilder;
|
8
|
+
private urlNormalizer;
|
9
|
+
constructor(requestBuilder: DaffCategoryRoutingRequestBuilder, urlNormalizer: DaffRoutingUriNormalizer);
|
10
|
+
/**
|
11
|
+
* Builds a category URL request from the provided route and router state that
|
12
|
+
* is suitable for passing to {@link DaffCategoryPageLoadByUrl}.
|
13
|
+
*/
|
14
|
+
build(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): DaffCategoryUrlRequest;
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryRoutingUrlRequestBuilder, never>;
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffCategoryRoutingUrlRequestBuilder>;
|
17
|
+
}
|
@@ -1,50 +1,21 @@
|
|
1
|
-
import { Action } from '@ngrx/store';
|
2
1
|
import { Observable } from 'rxjs';
|
3
2
|
import { DaffGenericCategory, DaffCategory } from '@daffodil/category';
|
4
|
-
import {
|
3
|
+
import { DaffOperationStateFacadeInterface } from '@daffodil/core/state';
|
5
4
|
import { DaffProduct } from '@daffodil/product';
|
6
5
|
import { DaffCategoryReducerState } from '../../reducers/category/category-reducer-state.interface';
|
7
6
|
/**
|
8
7
|
* A facade for interacting with the category state.
|
9
8
|
* This facade exposes many parts of the state for easy access and allows dispatching of actions.
|
10
9
|
*/
|
11
|
-
export interface DaffCategoryFacadeInterface<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> extends
|
10
|
+
export interface DaffCategoryFacadeInterface<V extends DaffGenericCategory<V> = DaffCategory, W extends DaffProduct = DaffProduct> extends DaffOperationStateFacadeInterface<DaffCategoryReducerState> {
|
12
11
|
/**
|
13
12
|
* The currently selected category.
|
14
13
|
*/
|
15
14
|
category$: Observable<V>;
|
16
|
-
/**
|
17
|
-
* The loading state of the current category page.
|
18
|
-
*/
|
19
|
-
pageLoadingState$: Observable<DaffCategoryReducerState['daffState']>;
|
20
|
-
/**
|
21
|
-
* Whether the current category is in a mutating state.
|
22
|
-
*/
|
23
|
-
isPageMutating$: Observable<boolean>;
|
24
|
-
/**
|
25
|
-
* Whether the current category is in a resolving state.
|
26
|
-
*/
|
27
|
-
isPageResolving$: Observable<boolean>;
|
28
15
|
/**
|
29
16
|
* Products of the current category.
|
30
17
|
*/
|
31
18
|
products$: Observable<W[]>;
|
32
|
-
/**
|
33
|
-
* The loading state for retrieving a single category.
|
34
|
-
*
|
35
|
-
* @deprecated Use isPageResolving$ instead
|
36
|
-
*/
|
37
|
-
categoryLoading$: Observable<boolean>;
|
38
|
-
/**
|
39
|
-
* The loading state for retrieving only the products of the category.
|
40
|
-
*
|
41
|
-
* @deprecated Use isPageResolving$ and isPageMutating$ instead
|
42
|
-
*/
|
43
|
-
productsLoading$: Observable<boolean>;
|
44
|
-
/**
|
45
|
-
* Errors associated with retrieving a single category.
|
46
|
-
*/
|
47
|
-
errors$: Observable<DaffStateError[]>;
|
48
19
|
/**
|
49
20
|
* Is the category page empty of products.
|
50
21
|
*/
|
@@ -16,13 +16,13 @@ export declare class DaffCategoryFacade<V extends DaffGenericCategory<V> = DaffC
|
|
16
16
|
private store;
|
17
17
|
private categorySelectors;
|
18
18
|
category$: Observable<V>;
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
loadingState$: Observable<DaffCategoryReducerState['daffState']>;
|
20
|
+
loading$: Observable<boolean>;
|
21
|
+
mutating$: Observable<boolean>;
|
22
|
+
resolving$: Observable<boolean>;
|
22
23
|
products$: Observable<W[]>;
|
23
|
-
categoryLoading$: Observable<boolean>;
|
24
|
-
productsLoading$: Observable<boolean>;
|
25
24
|
errors$: Observable<DaffStateError[]>;
|
25
|
+
hasErrors$: Observable<boolean>;
|
26
26
|
isCategoryEmpty$: Observable<boolean>;
|
27
27
|
getCategoryById(id: V['id']): Observable<V>;
|
28
28
|
getProductsByCategory(categoryId: V['id']): Observable<W[]>;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import * as i0 from "@angular/core";
|
2
|
+
import * as i1 from "@daffodil/product/state";
|
3
|
+
/**
|
4
|
+
* A module that provides injectable reducers into product state.
|
5
|
+
*/
|
6
|
+
export declare class DaffCategoryProductStateModule {
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCategoryProductStateModule, never>;
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCategoryProductStateModule, never, [typeof i1.DaffProductStateModule], never>;
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffCategoryProductStateModule>;
|
10
|
+
}
|
package/state/public_api.d.ts
CHANGED
@@ -1,18 +1,6 @@
|
|
1
1
|
import { DaffCategory } from '@daffodil/category';
|
2
|
-
import {
|
3
|
-
export interface DaffCategoryReducerState extends
|
4
|
-
/**
|
5
|
-
* @deprecated
|
6
|
-
*/
|
7
|
-
categoryLoading: boolean;
|
8
|
-
/**
|
9
|
-
* @deprecated
|
10
|
-
*/
|
11
|
-
productsLoading: boolean;
|
12
|
-
/**
|
13
|
-
* Errors associated with loading categories.
|
14
|
-
*/
|
15
|
-
errors: DaffStateError[];
|
2
|
+
import { DaffOperationState } from '@daffodil/core/state';
|
3
|
+
export interface DaffCategoryReducerState extends DaffOperationState {
|
16
4
|
/**
|
17
5
|
* The ID of the currently loaded category.
|
18
6
|
*/
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { DaffGenericCategory } from '@daffodil/category';
|
2
|
+
import { DaffProduct } from '@daffodil/product';
|
3
|
+
import { DaffProductReducerState } from '@daffodil/product/state';
|
4
|
+
import { DaffCategoryPageProductCollectionActions } from '../actions/category-page-filter.actions';
|
5
|
+
import { DaffCategoryPageActions } from '../actions/category-page.actions';
|
6
|
+
import { DaffCategoryActions } from '../actions/category.actions';
|
7
|
+
/**
|
8
|
+
* Modifies product state for category actions.
|
9
|
+
*/
|
10
|
+
export declare function daffCategoryProductReducer<U extends DaffGenericCategory<U>, W extends DaffProduct>(state: DaffProductReducerState, action: DaffCategoryActions<U, W> | DaffCategoryPageActions<U, W> | DaffCategoryPageProductCollectionActions): DaffProductReducerState;
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { MemoizedSelector } from '@ngrx/store';
|
2
2
|
import { DaffGenericCategory, DaffCategory, DaffCategoryPageMetadata } from '@daffodil/category';
|
3
|
-
import {
|
3
|
+
import { DaffOperationStateSelectors } from '@daffodil/core/state';
|
4
4
|
import { DaffCategoryReducerState, DaffCategoryStateRootSlice } from '../../reducers/public_api';
|
5
5
|
/**
|
6
6
|
* An interface to describe all selectors related to the category page metadata, category loading, and errors.
|
7
7
|
*/
|
8
|
-
export interface DaffCategoryPageMemoizedSelectors<V extends DaffGenericCategory<V> = DaffCategory> {
|
8
|
+
export interface DaffCategoryPageMemoizedSelectors<V extends DaffGenericCategory<V> = DaffCategory> extends DaffOperationStateSelectors<DaffCategoryStateRootSlice<V>, DaffCategoryReducerState> {
|
9
9
|
/**
|
10
10
|
* Selects all state related to the category page metadata, category loading, and errors.
|
11
11
|
*/
|
@@ -18,34 +18,10 @@ export interface DaffCategoryPageMemoizedSelectors<V extends DaffGenericCategory
|
|
18
18
|
* Selects whether the category page has no products.
|
19
19
|
*/
|
20
20
|
selectIsCategoryPageEmpty: MemoizedSelector<DaffCategoryStateRootSlice<V>, boolean>;
|
21
|
-
/**
|
22
|
-
* Selects the loading state of the current category; e.g. mutating, resolving, stable.
|
23
|
-
*/
|
24
|
-
selectCategoryPageState: MemoizedSelector<DaffCategoryStateRootSlice<V>, DaffCategoryReducerState['daffState']>;
|
25
21
|
/**
|
26
22
|
* Selects the id of the current category.
|
27
23
|
*/
|
28
24
|
selectCurrentCategoryId: MemoizedSelector<DaffCategoryStateRootSlice<V>, DaffCategoryPageMetadata['id']>;
|
29
|
-
/**
|
30
|
-
* @deprecated Use selectIsCategoryPageResolving instead
|
31
|
-
*/
|
32
|
-
selectCategoryLoading: MemoizedSelector<DaffCategoryStateRootSlice<V>, boolean>;
|
33
|
-
/**
|
34
|
-
* @deprecated Use selectIsCategoryPageResolving and selectIsCategoryPageMutating instead
|
35
|
-
*/
|
36
|
-
selectCategoryProductsLoading: MemoizedSelector<DaffCategoryStateRootSlice<V>, boolean>;
|
37
|
-
/**
|
38
|
-
* Selects all errors associated with loading a category.
|
39
|
-
*/
|
40
|
-
selectCategoryErrors: MemoizedSelector<DaffCategoryStateRootSlice<V>, DaffStateError[]>;
|
41
|
-
/**
|
42
|
-
* Selects whether the current category page is mutating; e.g. when a filter is applied to it.
|
43
|
-
*/
|
44
|
-
selectIsCategoryPageMutating: MemoizedSelector<DaffCategoryStateRootSlice<V>, boolean>;
|
45
|
-
/**
|
46
|
-
* Selects whether the current category is resolving; e.g. when the category first loads.
|
47
|
-
*/
|
48
|
-
selectIsCategoryPageResolving: MemoizedSelector<DaffCategoryStateRootSlice<V>, boolean>;
|
49
25
|
}
|
50
26
|
/**
|
51
27
|
* A function that returns all selectors related to the category page metadata, category loading, and errors.
|
@@ -13,12 +13,12 @@ import * as i0 from "@angular/core";
|
|
13
13
|
*/
|
14
14
|
export declare class MockDaffCategoryFacade implements DaffCategoryFacadeInterface {
|
15
15
|
category$: BehaviorSubject<DaffCategory>;
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
loadingState$: BehaviorSubject<DaffCategoryReducerState['daffState']>;
|
17
|
+
loading$: BehaviorSubject<boolean>;
|
18
|
+
mutating$: BehaviorSubject<boolean>;
|
19
|
+
resolving$: BehaviorSubject<boolean>;
|
20
|
+
hasErrors$: BehaviorSubject<boolean>;
|
19
21
|
products$: BehaviorSubject<DaffProduct[]>;
|
20
|
-
categoryLoading$: BehaviorSubject<boolean>;
|
21
|
-
productsLoading$: BehaviorSubject<boolean>;
|
22
22
|
errors$: BehaviorSubject<DaffStateError[]>;
|
23
23
|
isCategoryEmpty$: BehaviorSubject<boolean>;
|
24
24
|
getCategoryById(id: DaffCategory['id']): BehaviorSubject<DaffCategory>;
|