@daffodil/product 0.82.0 → 0.84.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/driver/product.service.d.ts +0 -1
- package/driver/interfaces/product-service.interface.d.ts +0 -6
- package/driver/magento/product.service.d.ts +0 -1
- package/driver/shopify/product.service.d.ts +0 -1
- package/driver/testing/drivers/product.service.d.ts +0 -1
- package/fesm2022/daffodil-product-driver-in-memory.mjs +0 -3
- package/fesm2022/daffodil-product-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-magento.mjs +0 -6
- package/fesm2022/daffodil-product-driver-magento.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-shopify.mjs +0 -5
- package/fesm2022/daffodil-product-driver-shopify.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-testing.mjs +0 -8
- package/fesm2022/daffodil-product-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver.mjs.map +1 -1
- package/fesm2022/daffodil-product-state-testing.mjs +2 -22
- package/fesm2022/daffodil-product-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-state.mjs +32 -227
- package/fesm2022/daffodil-product-state.mjs.map +1 -1
- package/package.json +1 -1
- package/state/actions/public_api.d.ts +0 -1
- package/state/effects/public_api.d.ts +0 -1
- package/state/facades/public_api.d.ts +0 -1
- package/state/reducers/product-entities/product-entities.reducer.d.ts +2 -2
- package/state/reducers/product-reducers-state.interface.d.ts +0 -5
- package/state/reducers/public_api.d.ts +0 -2
- package/state/selectors/all-selectors.selectors.d.ts +1 -2
- package/state/selectors/public_api.d.ts +0 -1
- package/state/testing/public_api.d.ts +0 -1
- package/state/actions/best-sellers.actions.d.ts +0 -56
- package/state/effects/best-seller.effects.d.ts +0 -28
- package/state/facades/best-sellers/best-sellers.facade.d.ts +0 -32
- package/state/reducers/best-sellers/best-sellers-reducer-state.interface.d.ts +0 -20
- package/state/reducers/best-sellers/best-sellers.reducer.d.ts +0 -13
- package/state/selectors/best-sellers/best-sellers.selectors.d.ts +0 -33
- package/state/testing/mock-best-sellers.facade.d.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-product-driver.mjs","sources":["../../../libs/product/driver/src/interfaces/product-service.interface.ts","../../../libs/product/driver/src/errors/codes.enum.ts","../../../libs/product/driver/src/errors/product-not-found.ts","../../../libs/product/driver/src/errors/map.ts","../../../libs/product/driver/src/daffodil-product-driver.ts"],"sourcesContent":["import { Observable } from 'rxjs';\n\nimport { createSingletonInjectionToken } from '@daffodil/core';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductDriverResponse } from '../models/response.interface';\n\nexport const {\n /**\n * Injection token that serves as a placeholder for any service that implements the DaffProductServiceInterface.\n */\n token: DaffProductDriver,\n /**\n * Provider function for {@link DaffProductDriver}.\n */\n provider: provideDaffProductDriver,\n} = createSingletonInjectionToken<DaffProductServiceInterface>('DaffProductDriver');\n\n\n/**\n * An interface for any Product service drivers.\n */\nexport interface DaffProductServiceInterface<T extends DaffProduct = DaffProduct> {\n /**\n * Get all products.\n */\n getAll(): Observable<T[]>;\n /**\n * Get
|
|
1
|
+
{"version":3,"file":"daffodil-product-driver.mjs","sources":["../../../libs/product/driver/src/interfaces/product-service.interface.ts","../../../libs/product/driver/src/errors/codes.enum.ts","../../../libs/product/driver/src/errors/product-not-found.ts","../../../libs/product/driver/src/errors/map.ts","../../../libs/product/driver/src/daffodil-product-driver.ts"],"sourcesContent":["import { Observable } from 'rxjs';\n\nimport { createSingletonInjectionToken } from '@daffodil/core';\nimport { DaffProduct } from '@daffodil/product';\n\nimport { DaffProductDriverResponse } from '../models/response.interface';\n\nexport const {\n /**\n * Injection token that serves as a placeholder for any service that implements the DaffProductServiceInterface.\n */\n token: DaffProductDriver,\n /**\n * Provider function for {@link DaffProductDriver}.\n */\n provider: provideDaffProductDriver,\n} = createSingletonInjectionToken<DaffProductServiceInterface>('DaffProductDriver');\n\n\n/**\n * An interface for any Product service drivers.\n */\nexport interface DaffProductServiceInterface<T extends DaffProduct = DaffProduct> {\n /**\n * Get all products.\n */\n getAll(): Observable<T[]>;\n /**\n * Get a product by Id.\n *\n * @param productId - A string of the product ID.\n */\n get(productId: T['id']): Observable<DaffProductDriverResponse<T>>;\n /**\n * Get a product by URL.\n *\n * @param url - A string of the product URL.\n *\n * See {@link DaffLocatable} for more information on the requirements for the url argument of {@link DaffProduct}.\n */\n getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse<T>>;\n}\n","export enum DaffProductDriverErrorCodes {\n PRODUCT_NOT_FOUND = 'DAFF_PRODUCT_NOT_FOUND',\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffProductDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the requested product cannot be found.\n */\nexport class DaffProductNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffProductDriverErrorCodes.PRODUCT_NOT_FOUND;\n\n constructor(message?: string) {\n super(message);\n }\n}\n","import { DaffProductDriverErrorCodes } from './codes.enum';\nimport { DaffProductNotFoundError } from './product-not-found';\n\n/**\n * A mapping from error codes to error class constructors.\n */\nexport const DaffProductDriverErrorMap = {\n [DaffProductDriverErrorCodes.PRODUCT_NOT_FOUND]: DaffProductNotFoundError,\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAOa,MAAA;AACX;;AAEG;AACH,KAAK,EAAE,iBAAiB;AACxB;;AAEG;AACH,QAAQ,EAAE,wBAAwB,GACnC,GAAG,6BAA6B,CAA8B,mBAAmB;;IChBtE;AAAZ,CAAA,UAAY,2BAA2B,EAAA;AACrC,IAAA,2BAAA,CAAA,mBAAA,CAAA,GAAA,wBAA4C;AAC9C,CAAC,EAFW,2BAA2B,KAA3B,2BAA2B,GAEtC,EAAA,CAAA,CAAA;;ACKD;;AAEG;AACG,MAAO,wBAAyB,SAAQ,oBAAoB,CAAA;AAGhE,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC;AAHA,QAAA,IAAA,CAAA,IAAI,GAAW,2BAA2B,CAAC,iBAAiB;;AAK7E;;ACbD;;AAEG;AACU,MAAA,yBAAyB,GAAG;AACvC,IAAA,CAAC,2BAA2B,CAAC,iBAAiB,GAAG,wBAAwB;;;ACP3E;;AAEG;;;;"}
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, NgModule } from '@angular/core';
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
import { DaffProductFacade, DaffProductGridFacade,
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @inheritdoc
|
|
8
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
9
|
-
*/
|
|
10
|
-
class MockDaffBestSellersFacade {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.loading$ = new BehaviorSubject(false);
|
|
13
|
-
this.bestSellers$ = new BehaviorSubject([]);
|
|
14
|
-
}
|
|
15
|
-
dispatch(action) { }
|
|
16
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: MockDaffBestSellersFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
17
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: MockDaffBestSellersFacade, providedIn: 'root' }); }
|
|
18
|
-
}
|
|
19
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: MockDaffBestSellersFacade, decorators: [{
|
|
20
|
-
type: Injectable,
|
|
21
|
-
args: [{ providedIn: 'root' }]
|
|
22
|
-
}] });
|
|
4
|
+
import { DaffProductFacade, DaffProductGridFacade, DaffProductPageFacade } from '@daffodil/product/state';
|
|
23
5
|
|
|
24
6
|
/**
|
|
25
7
|
* @inheritdoc
|
|
@@ -103,7 +85,6 @@ class DaffProductStateTestingModule {
|
|
|
103
85
|
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DaffProductStateTestingModule, providers: [
|
|
104
86
|
{ provide: DaffProductFacade, useExisting: MockDaffProductFacade },
|
|
105
87
|
{ provide: DaffProductGridFacade, useExisting: MockDaffProductGridFacade },
|
|
106
|
-
{ provide: DaffBestSellersFacade, useExisting: MockDaffBestSellersFacade },
|
|
107
88
|
{ provide: DaffProductPageFacade, useExisting: MockDaffProductPageFacade },
|
|
108
89
|
] }); }
|
|
109
90
|
}
|
|
@@ -113,7 +94,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
113
94
|
providers: [
|
|
114
95
|
{ provide: DaffProductFacade, useExisting: MockDaffProductFacade },
|
|
115
96
|
{ provide: DaffProductGridFacade, useExisting: MockDaffProductGridFacade },
|
|
116
|
-
{ provide: DaffBestSellersFacade, useExisting: MockDaffBestSellersFacade },
|
|
117
97
|
{ provide: DaffProductPageFacade, useExisting: MockDaffProductPageFacade },
|
|
118
98
|
],
|
|
119
99
|
}]
|
|
@@ -123,5 +103,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
123
103
|
* Generated bundle index. Do not edit.
|
|
124
104
|
*/
|
|
125
105
|
|
|
126
|
-
export { DaffProductStateTestingModule,
|
|
106
|
+
export { DaffProductStateTestingModule, MockDaffProductFacade, MockDaffProductGridFacade, MockDaffProductPageFacade };
|
|
127
107
|
//# sourceMappingURL=daffodil-product-state-testing.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-product-state-testing.mjs","sources":["../../../libs/product/state/testing/src/mock-
|
|
1
|
+
{"version":3,"file":"daffodil-product-state-testing.mjs","sources":["../../../libs/product/state/testing/src/mock-product-facade.ts","../../../libs/product/state/testing/src/mock-product-grid-facade.ts","../../../libs/product/state/testing/src/mock-product-page-facade.ts","../../../libs/product/state/testing/src/product-testing.module.ts","../../../libs/product/state/testing/src/daffodil-product-state-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffProductFacadeInterface } from '@daffodil/product/state';\n\n/**\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffProductFacade implements DaffProductFacadeInterface {\n getProduct(id: DaffProduct['id']): BehaviorSubject<DaffProduct> {\n return new BehaviorSubject(null);\n }\n getPrice(id: DaffProduct['id']): BehaviorSubject<number> {\n return new BehaviorSubject(null);\n }\n hasDiscount(id: DaffProduct['id']): BehaviorSubject<boolean> {\n return new BehaviorSubject(false);\n }\n getDiscountAmount(id: DaffProduct['id']): BehaviorSubject<number> {\n return new BehaviorSubject(null);\n }\n getDiscountedPrice(id: DaffProduct['id']): BehaviorSubject<number> {\n return new BehaviorSubject(null);\n }\n getDiscountPercent(id: DaffProduct['id']): BehaviorSubject<number> {\n return new BehaviorSubject(null);\n }\n isOutOfStock(id: DaffProduct['id']): BehaviorSubject<boolean> {\n return new BehaviorSubject(false);\n }\n dispatch(action) {};\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffProductGridFacadeInterface } from '@daffodil/product/state';\n\n/**\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffProductGridFacade implements DaffProductGridFacadeInterface {\n loading$: BehaviorSubject<boolean> = new BehaviorSubject(false);\n products$: BehaviorSubject<DaffProduct[]> = new BehaviorSubject([]);\n dispatch(action) {};\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\nimport {\n DaffState,\n DaffStateError,\n} from '@daffodil/core/state';\nimport { DaffProduct } from '@daffodil/product';\nimport { DaffProductPageFacadeInterface } from '@daffodil/product/state';\n\n/**\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffProductPageFacade implements DaffProductPageFacadeInterface {\n loadingState$ = new BehaviorSubject<DaffState>(DaffState.Stable);\n loading$ = new BehaviorSubject<boolean>(false);\n mutating$ = new BehaviorSubject<boolean>(false);\n resolving$ = new BehaviorSubject<boolean>(false);\n errors$ = new BehaviorSubject<DaffStateError[]>([]);\n hasErrors$ = new BehaviorSubject<boolean>(false);\n product$ = new BehaviorSubject<DaffProduct>(null);\n\n dispatch(action) {};\n}\n","import { NgModule } from '@angular/core';\n\nimport {\n DaffProductFacade,\n DaffProductGridFacade,\n DaffProductPageFacade,\n} from '@daffodil/product/state';\n\nimport { MockDaffProductFacade } from './mock-product-facade';\nimport { MockDaffProductGridFacade } from './mock-product-grid-facade';\nimport { MockDaffProductPageFacade } from './mock-product-page-facade';\n\n@NgModule({\n providers: [\n { provide: DaffProductFacade, useExisting: MockDaffProductFacade },\n { provide: DaffProductGridFacade, useExisting: MockDaffProductGridFacade },\n { provide: DaffProductPageFacade, useExisting: MockDaffProductPageFacade },\n ],\n})\nexport class DaffProductStateTestingModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMA;;AAEG;MAEU,qBAAqB,CAAA;AAChC,IAAA,UAAU,CAAC,EAAqB,EAAA;AAC9B,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;AAElC,IAAA,QAAQ,CAAC,EAAqB,EAAA;AAC5B,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;AAElC,IAAA,WAAW,CAAC,EAAqB,EAAA;AAC/B,QAAA,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC;;AAEnC,IAAA,iBAAiB,CAAC,EAAqB,EAAA;A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AA,CAAA;kIAA7B,6BAA6B,EAAA,CAAA,CAAA;AAA7B,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,6BAA6B,EAN7B,SAAA,EAAA;AACT,YAAA,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,qBAAqB,EAAE;AAClE,YAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,yBAAyB,EAAE;AAC1E,YAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,yBAAyB,EAAE;AAC3E,SAAA,EAAA,CAAA,CAAA;;2FAEU,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBAPzC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;AACT,wBAAA,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,qBAAqB,EAAE;AAClE,wBAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,yBAAyB,EAAE;AAC1E,wBAAA,EAAE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,yBAAyB,EAAE;AAC3E,qBAAA;AACF,iBAAA;;;AClBD;;AAEG;;;;"}
|
|
@@ -11,61 +11,6 @@ import * as i1$1 from '@ngrx/store';
|
|
|
11
11
|
import { createFeatureSelector, createSelector, defaultMemoize, select, combineReducers, StoreModule } from '@ngrx/store';
|
|
12
12
|
import { createEntityAdapter } from '@ngrx/entity';
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Action types for Best Seller Actions.
|
|
16
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
17
|
-
*/
|
|
18
|
-
var DaffBestSellersActionTypes;
|
|
19
|
-
(function (DaffBestSellersActionTypes) {
|
|
20
|
-
DaffBestSellersActionTypes["BestSellersLoadAction"] = "[@daffodil/product] BestSellers Load Action";
|
|
21
|
-
DaffBestSellersActionTypes["BestSellersLoadSuccessAction"] = "[@daffodil/product] BestSellers Load Success Action";
|
|
22
|
-
DaffBestSellersActionTypes["BestSellersLoadFailureAction"] = "[@daffodil/product] BestSellers Load Failure Action";
|
|
23
|
-
DaffBestSellersActionTypes["BestSellersResetAction"] = "[@daffodil/product] BestSellers Reset Action";
|
|
24
|
-
})(DaffBestSellersActionTypes || (DaffBestSellersActionTypes = {}));
|
|
25
|
-
/**
|
|
26
|
-
* Triggers a request for best selling products.
|
|
27
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
28
|
-
*/
|
|
29
|
-
class DaffBestSellersLoad {
|
|
30
|
-
constructor() {
|
|
31
|
-
this.type = DaffBestSellersActionTypes.BestSellersLoadAction;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* An action called when a request for best selling products succeeded.
|
|
36
|
-
*
|
|
37
|
-
* @param payload - An array of Products
|
|
38
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
39
|
-
*/
|
|
40
|
-
class DaffBestSellersLoadSuccess {
|
|
41
|
-
constructor(payload) {
|
|
42
|
-
this.payload = payload;
|
|
43
|
-
this.type = DaffBestSellersActionTypes.BestSellersLoadSuccessAction;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* An action called when a request for best selling products failed.
|
|
48
|
-
*
|
|
49
|
-
* @param payload - An error message
|
|
50
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
51
|
-
*/
|
|
52
|
-
class DaffBestSellersLoadFailure {
|
|
53
|
-
constructor(payload) {
|
|
54
|
-
this.payload = payload;
|
|
55
|
-
this.type = DaffBestSellersActionTypes.BestSellersLoadFailureAction;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Resets the state of the best sellers redux store to its initial state.
|
|
60
|
-
*
|
|
61
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
62
|
-
*/
|
|
63
|
-
class DaffBestSellersReset {
|
|
64
|
-
constructor() {
|
|
65
|
-
this.type = DaffBestSellersActionTypes.BestSellersResetAction;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
14
|
/**
|
|
70
15
|
* Action types for Product Grid Actions.
|
|
71
16
|
*/
|
|
@@ -238,40 +183,6 @@ token: DAFF_PRODUCT_ERROR_MATCHER,
|
|
|
238
183
|
*/
|
|
239
184
|
provider: provideDaffProductErrorMatcher, } = createSingleInjectionToken('DAFF_PRODUCT_ERROR_MATCHER', { factory: () => daffTransformErrorToStateError });
|
|
240
185
|
|
|
241
|
-
/**
|
|
242
|
-
* Effects for handling best seller actions and best seller service requests.
|
|
243
|
-
*
|
|
244
|
-
* @param action$ - Redux action object
|
|
245
|
-
* @param driver - A product service driver
|
|
246
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
247
|
-
*/
|
|
248
|
-
class DaffBestSellersEffects {
|
|
249
|
-
constructor(actions$, driver, errorMatcher) {
|
|
250
|
-
this.actions$ = actions$;
|
|
251
|
-
this.driver = driver;
|
|
252
|
-
this.errorMatcher = errorMatcher;
|
|
253
|
-
/**
|
|
254
|
-
* Handles BestSellersLoadAction by making a service call for best selling products and returning a success or failure action
|
|
255
|
-
* to the action stream.
|
|
256
|
-
*
|
|
257
|
-
* @returns An Observable of a BestSellersLoad action
|
|
258
|
-
*/
|
|
259
|
-
this.loadBestSellers$ = createEffect(() => this.actions$.pipe(ofType(DaffBestSellersActionTypes.BestSellersLoadAction), switchMap((action) => this.driver.getBestSellers()
|
|
260
|
-
.pipe(map((resp) => new DaffBestSellersLoadSuccess(resp)), catchError((error) => of(new DaffBestSellersLoadFailure(this.errorMatcher(error))))))));
|
|
261
|
-
}
|
|
262
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DaffBestSellersEffects, deps: [{ token: i1.Actions }, { token: DaffProductDriver }, { token: DAFF_PRODUCT_ERROR_MATCHER }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
263
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DaffBestSellersEffects }); }
|
|
264
|
-
}
|
|
265
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DaffBestSellersEffects, decorators: [{
|
|
266
|
-
type: Injectable
|
|
267
|
-
}], ctorParameters: () => [{ type: i1.Actions }, { type: undefined, decorators: [{
|
|
268
|
-
type: Inject,
|
|
269
|
-
args: [DaffProductDriver]
|
|
270
|
-
}] }, { type: undefined, decorators: [{
|
|
271
|
-
type: Inject,
|
|
272
|
-
args: [DAFF_PRODUCT_ERROR_MATCHER]
|
|
273
|
-
}] }] });
|
|
274
|
-
|
|
275
186
|
/**
|
|
276
187
|
* Effects for handling product grid actions and for triggering corresponding service requests.
|
|
277
188
|
*
|
|
@@ -338,14 +249,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
338
249
|
args: [DAFF_PRODUCT_ERROR_MATCHER]
|
|
339
250
|
}] }] });
|
|
340
251
|
|
|
341
|
-
/**
|
|
342
|
-
* Product Adapter for changing/overwriting entity state.
|
|
343
|
-
*/
|
|
344
|
-
const daffProductEntitiesAdapter = (() => {
|
|
345
|
-
let cache;
|
|
346
|
-
return () => cache = cache || createEntityAdapter();
|
|
347
|
-
})();
|
|
348
|
-
|
|
349
252
|
const DAFF_PRODUCT_STORE_FEATURE_KEY = 'daffProduct';
|
|
350
253
|
|
|
351
254
|
/**
|
|
@@ -358,6 +261,37 @@ const getDaffProductFeatureSelector = (() => {
|
|
|
358
261
|
: { selectProductState: createFeatureSelector(DAFF_PRODUCT_STORE_FEATURE_KEY) };
|
|
359
262
|
})();
|
|
360
263
|
|
|
264
|
+
const createProductPageSelectors = () => {
|
|
265
|
+
const { selectProductState, } = getDaffProductFeatureSelector();
|
|
266
|
+
const selectCurrentProductState = createSelector(selectProductState, (state) => state.product);
|
|
267
|
+
const selectCurrentProductId = createSelector(selectCurrentProductState, (state) => state.currentProductId);
|
|
268
|
+
const selectCurrentProduct = createSelector(selectProductState, selectCurrentProductId, (state, id) => state.products.entities[id]);
|
|
269
|
+
return {
|
|
270
|
+
...daffOperationStateSelectorFactory(selectCurrentProductState),
|
|
271
|
+
selectCurrentProductState,
|
|
272
|
+
selectCurrentProductId,
|
|
273
|
+
selectCurrentProduct,
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* A function that returns all selectors related to the product page.
|
|
278
|
+
* Returns {@link DaffProductPageMemoizedSelectors}.
|
|
279
|
+
*/
|
|
280
|
+
const getDaffProductPageSelectors = (() => {
|
|
281
|
+
let cache;
|
|
282
|
+
return () => cache = cache
|
|
283
|
+
? cache
|
|
284
|
+
: createProductPageSelectors();
|
|
285
|
+
})();
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Product Adapter for changing/overwriting entity state.
|
|
289
|
+
*/
|
|
290
|
+
const daffProductEntitiesAdapter = (() => {
|
|
291
|
+
let cache;
|
|
292
|
+
return () => cache = cache || createEntityAdapter();
|
|
293
|
+
})();
|
|
294
|
+
|
|
361
295
|
const createProductEntitiesSelectors = () => {
|
|
362
296
|
const { selectProductState, } = getDaffProductFeatureSelector();
|
|
363
297
|
const adapterSelectors = daffProductEntitiesAdapter().getSelectors();
|
|
@@ -409,56 +343,6 @@ const getDaffProductEntitiesSelectors = (() => {
|
|
|
409
343
|
: createProductEntitiesSelectors();
|
|
410
344
|
})();
|
|
411
345
|
|
|
412
|
-
const createBestSellersSelectors = () => {
|
|
413
|
-
const { selectAllProducts, } = getDaffProductEntitiesSelectors();
|
|
414
|
-
const { selectProductState, } = getDaffProductFeatureSelector();
|
|
415
|
-
const selectBestSellersState = createSelector(selectProductState, (state) => state.bestSellers);
|
|
416
|
-
const selectBestSellersLoadingState = createSelector(selectBestSellersState, (state) => state.loading);
|
|
417
|
-
const selectBestSellersIdsState = createSelector(selectBestSellersState, (state) => state.productIds);
|
|
418
|
-
const selectBestSellersProducts = createSelector(selectBestSellersIdsState, selectAllProducts, (ids, products) => products.filter(product => ids.indexOf(product.id) > -1));
|
|
419
|
-
return {
|
|
420
|
-
selectBestSellersState,
|
|
421
|
-
selectBestSellersLoadingState,
|
|
422
|
-
selectBestSellersIdsState,
|
|
423
|
-
selectBestSellersProducts,
|
|
424
|
-
};
|
|
425
|
-
};
|
|
426
|
-
/**
|
|
427
|
-
* A function that returns all selectors related to best sellers state.
|
|
428
|
-
*
|
|
429
|
-
* Returns {@link DaffBestSellersMemoizedSelectors}.
|
|
430
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
431
|
-
*/
|
|
432
|
-
const getDaffBestSellersSelectors = (() => {
|
|
433
|
-
let cache;
|
|
434
|
-
return () => cache = cache
|
|
435
|
-
? cache
|
|
436
|
-
: createBestSellersSelectors();
|
|
437
|
-
})();
|
|
438
|
-
|
|
439
|
-
const createProductPageSelectors = () => {
|
|
440
|
-
const { selectProductState, } = getDaffProductFeatureSelector();
|
|
441
|
-
const selectCurrentProductState = createSelector(selectProductState, (state) => state.product);
|
|
442
|
-
const selectCurrentProductId = createSelector(selectCurrentProductState, (state) => state.currentProductId);
|
|
443
|
-
const selectCurrentProduct = createSelector(selectProductState, selectCurrentProductId, (state, id) => state.products.entities[id]);
|
|
444
|
-
return {
|
|
445
|
-
...daffOperationStateSelectorFactory(selectCurrentProductState),
|
|
446
|
-
selectCurrentProductState,
|
|
447
|
-
selectCurrentProductId,
|
|
448
|
-
selectCurrentProduct,
|
|
449
|
-
};
|
|
450
|
-
};
|
|
451
|
-
/**
|
|
452
|
-
* A function that returns all selectors related to the product page.
|
|
453
|
-
* Returns {@link DaffProductPageMemoizedSelectors}.
|
|
454
|
-
*/
|
|
455
|
-
const getDaffProductPageSelectors = (() => {
|
|
456
|
-
let cache;
|
|
457
|
-
return () => cache = cache
|
|
458
|
-
? cache
|
|
459
|
-
: createProductPageSelectors();
|
|
460
|
-
})();
|
|
461
|
-
|
|
462
346
|
const createProductGridSelectors = () => {
|
|
463
347
|
const { selectProductState, } = getDaffProductFeatureSelector();
|
|
464
348
|
const selectProductGridState = createSelector(selectProductState, (state) => state.productGrid);
|
|
@@ -484,44 +368,12 @@ const getDaffProductGridSelectors = (() => {
|
|
|
484
368
|
* Returns {@link DaffProductAllSelectors}.
|
|
485
369
|
*/
|
|
486
370
|
const getDaffProductSelectors = () => ({
|
|
487
|
-
...getDaffBestSellersSelectors(),
|
|
488
371
|
...getDaffProductPageSelectors(),
|
|
489
372
|
...getDaffProductGridSelectors(),
|
|
490
373
|
...getDaffProductEntitiesSelectors(),
|
|
491
374
|
...getDaffProductFeatureSelector(),
|
|
492
375
|
});
|
|
493
376
|
|
|
494
|
-
/**
|
|
495
|
-
* A facade for accessing best sellers state from an application component.
|
|
496
|
-
*
|
|
497
|
-
* @inheritdoc
|
|
498
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
499
|
-
*/
|
|
500
|
-
class DaffBestSellersFacade {
|
|
501
|
-
constructor(store) {
|
|
502
|
-
this.store = store;
|
|
503
|
-
const { selectBestSellersProducts, selectBestSellersLoadingState, } = getDaffProductSelectors();
|
|
504
|
-
this.loading$ = this.store.pipe(select(selectBestSellersLoadingState));
|
|
505
|
-
this.bestSellers$ = this.store.pipe(select(selectBestSellersProducts));
|
|
506
|
-
}
|
|
507
|
-
/**
|
|
508
|
-
* Dispatches an action to the rxjs action stream.
|
|
509
|
-
*
|
|
510
|
-
* @param action
|
|
511
|
-
*/
|
|
512
|
-
dispatch(action) {
|
|
513
|
-
this.store.dispatch(action);
|
|
514
|
-
}
|
|
515
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DaffBestSellersFacade, deps: [{ token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
516
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DaffBestSellersFacade, providedIn: 'root' }); }
|
|
517
|
-
}
|
|
518
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DaffBestSellersFacade, decorators: [{
|
|
519
|
-
type: Injectable,
|
|
520
|
-
args: [{
|
|
521
|
-
providedIn: 'root',
|
|
522
|
-
}]
|
|
523
|
-
}], ctorParameters: () => [{ type: i1$1.Store }] });
|
|
524
|
-
|
|
525
377
|
/**
|
|
526
378
|
* A facade for getting state about a particular product.
|
|
527
379
|
*
|
|
@@ -621,45 +473,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
621
473
|
}]
|
|
622
474
|
}], ctorParameters: () => [{ type: i1$1.Store }] });
|
|
623
475
|
|
|
624
|
-
/**
|
|
625
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
626
|
-
*/
|
|
627
|
-
const initialState$1 = {
|
|
628
|
-
productIds: [],
|
|
629
|
-
loading: false,
|
|
630
|
-
errors: [],
|
|
631
|
-
};
|
|
632
|
-
const resetState = Object.assign({}, initialState$1);
|
|
633
|
-
/**
|
|
634
|
-
* The default best sellers reducer provided by Daffodil.
|
|
635
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
636
|
-
*/
|
|
637
|
-
function daffBestSellersReducer(state = initialState$1, action) {
|
|
638
|
-
switch (action.type) {
|
|
639
|
-
case DaffBestSellersActionTypes.BestSellersLoadAction:
|
|
640
|
-
return { ...state, loading: true };
|
|
641
|
-
case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:
|
|
642
|
-
return { ...state, loading: false, productIds: getIds(action.payload) };
|
|
643
|
-
case DaffBestSellersActionTypes.BestSellersLoadFailureAction:
|
|
644
|
-
return { ...state,
|
|
645
|
-
loading: false,
|
|
646
|
-
errors: state.errors.concat(new Array(action.payload)) };
|
|
647
|
-
case DaffBestSellersActionTypes.BestSellersResetAction:
|
|
648
|
-
return {
|
|
649
|
-
...resetState,
|
|
650
|
-
};
|
|
651
|
-
default:
|
|
652
|
-
return state;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
function getIds(products) {
|
|
656
|
-
const ids = [];
|
|
657
|
-
products.forEach(product => {
|
|
658
|
-
ids.push(product.id);
|
|
659
|
-
});
|
|
660
|
-
return ids;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
476
|
/**
|
|
664
477
|
* Initial values of the product state.
|
|
665
478
|
*/
|
|
@@ -703,8 +516,6 @@ function daffProductEntitiesReducer(state = daffProductEntitiesAdapter().getInit
|
|
|
703
516
|
switch (action.type) {
|
|
704
517
|
case DaffProductGridActionTypes.ProductGridLoadSuccessAction:
|
|
705
518
|
return adapter.upsertMany(action.payload, state);
|
|
706
|
-
case DaffBestSellersActionTypes.BestSellersLoadSuccessAction:
|
|
707
|
-
return adapter.upsertMany(action.payload, state);
|
|
708
519
|
case DaffProductPageActionTypes.ProductPageLoadSuccessAction:
|
|
709
520
|
case DaffProductActionTypes.ProductLoadSuccessAction:
|
|
710
521
|
return adapter.upsertMany(action.payload.products, state);
|
|
@@ -752,10 +563,6 @@ const daffProductReducers = {
|
|
|
752
563
|
products: daffProductEntitiesReducer,
|
|
753
564
|
productGrid: daffProductGridReducer,
|
|
754
565
|
product: daffProductReducer,
|
|
755
|
-
/**
|
|
756
|
-
* @deprecated in favor of features from `@daffodil/related-products/state` and `@daffodil/upsell-products/state`. Deprecated in version 0.81.0. Will be removed in version 0.84.0.
|
|
757
|
-
*/
|
|
758
|
-
bestSellers: daffBestSellersReducer,
|
|
759
566
|
};
|
|
760
567
|
|
|
761
568
|
const {
|
|
@@ -883,7 +690,6 @@ class DaffProductStateModule {
|
|
|
883
690
|
DaffProductGridEffects,
|
|
884
691
|
DaffProductEffects,
|
|
885
692
|
DaffProductPageEffects,
|
|
886
|
-
DaffBestSellersEffects,
|
|
887
693
|
])] }); }
|
|
888
694
|
}
|
|
889
695
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: DaffProductStateModule, decorators: [{
|
|
@@ -895,7 +701,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
895
701
|
DaffProductGridEffects,
|
|
896
702
|
DaffProductEffects,
|
|
897
703
|
DaffProductPageEffects,
|
|
898
|
-
DaffBestSellersEffects,
|
|
899
704
|
]),
|
|
900
705
|
],
|
|
901
706
|
}]
|
|
@@ -905,5 +710,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImpor
|
|
|
905
710
|
* Generated bundle index. Do not edit.
|
|
906
711
|
*/
|
|
907
712
|
|
|
908
|
-
export { DAFF_PRODUCT_ERROR_MATCHER, DAFF_PRODUCT_EXTRA_REDUCERS, DAFF_PRODUCT_META_REDUCERS, DAFF_PRODUCT_STORE_FEATURE_KEY,
|
|
713
|
+
export { DAFF_PRODUCT_ERROR_MATCHER, DAFF_PRODUCT_EXTRA_REDUCERS, DAFF_PRODUCT_META_REDUCERS, DAFF_PRODUCT_STORE_FEATURE_KEY, DaffProductActionTypes, DaffProductEffects, DaffProductFacade, DaffProductGridActionTypes, DaffProductGridEffects, DaffProductGridFacade, DaffProductGridLoad, DaffProductGridLoadFailure, DaffProductGridLoadSuccess, DaffProductGridReset, DaffProductLoad, DaffProductLoadFailure, DaffProductLoadSuccess, DaffProductPageActionTypes, DaffProductPageFacade, DaffProductPageLoad, DaffProductPageLoadByUrl, DaffProductPageLoadFailure, DaffProductPageLoadSuccess, DaffProductPageUpdateQty, DaffProductStateModule, daffProductEntitiesAdapter, daffProductEntitiesReducer, daffProductGridReducer, daffProductProvideExtraReducers, daffProductProvideMetaReducers, daffProductReducer, daffProductReducerInitialState, daffProductReducers, getDaffProductEntitiesSelectors, getDaffProductFeatureSelector, getDaffProductGridSelectors, getDaffProductPageSelectors, getDaffProductSelectors, provideDaffProductErrorMatcher };
|
|
909
714
|
//# sourceMappingURL=daffodil-product-state.mjs.map
|