@daffodil/product 0.83.0 → 0.85.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 +10 -13
- package/fesm2022/daffodil-product-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-magento-testing.mjs +57 -57
- package/fesm2022/daffodil-product-driver-magento-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-magento.mjs +19 -25
- package/fesm2022/daffodil-product-driver-magento.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-shopify.mjs +7 -12
- package/fesm2022/daffodil-product-driver-shopify.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver-testing.mjs +7 -15
- package/fesm2022/daffodil-product-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-driver.mjs.map +1 -1
- package/fesm2022/daffodil-product-routing.mjs +17 -17
- package/fesm2022/daffodil-product-routing.mjs.map +1 -1
- package/fesm2022/daffodil-product-state-testing.mjs +15 -35
- package/fesm2022/daffodil-product-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-state.mjs +55 -250
- package/fesm2022/daffodil-product-state.mjs.map +1 -1
- package/fesm2022/daffodil-product-testing.mjs +25 -25
- package/fesm2022/daffodil-product-testing.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,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Inject, Injectable, inject, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@ngrx/effects';
|
|
4
4
|
import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
|
|
5
5
|
import { of } from 'rxjs';
|
|
@@ -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
|
*
|
|
@@ -292,10 +203,10 @@ class DaffProductGridEffects {
|
|
|
292
203
|
this.loadAll$ = createEffect(() => this.actions$.pipe(ofType(DaffProductGridActionTypes.ProductGridLoadAction), switchMap((action) => this.driver.getAll()
|
|
293
204
|
.pipe(map((resp) => new DaffProductGridLoadSuccess(resp)), catchError((error) => of(new DaffProductGridLoadFailure(this.errorMatcher(error))))))));
|
|
294
205
|
}
|
|
295
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
296
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
206
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductGridEffects, deps: [{ token: i1.Actions }, { token: DaffProductDriver }, { token: DAFF_PRODUCT_ERROR_MATCHER }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
207
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductGridEffects }); }
|
|
297
208
|
}
|
|
298
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductGridEffects, decorators: [{
|
|
299
210
|
type: Injectable
|
|
300
211
|
}], ctorParameters: () => [{ type: i1.Actions }, { type: undefined, decorators: [{
|
|
301
212
|
type: Inject,
|
|
@@ -325,10 +236,10 @@ class DaffProductEffects {
|
|
|
325
236
|
this.load$ = createEffect(() => this.actions$.pipe(ofType(DaffProductActionTypes.ProductLoadAction), switchMap((action) => this.driver.get(action.payload)
|
|
326
237
|
.pipe(map((resp) => new DaffProductLoadSuccess(resp)), catchError((error) => of(new DaffProductLoadFailure(this.errorMatcher(error))))))));
|
|
327
238
|
}
|
|
328
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
329
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
239
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductEffects, deps: [{ token: i1.Actions }, { token: DaffProductDriver }, { token: DAFF_PRODUCT_ERROR_MATCHER }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
240
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductEffects }); }
|
|
330
241
|
}
|
|
331
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductEffects, decorators: [{
|
|
332
243
|
type: Injectable
|
|
333
244
|
}], ctorParameters: () => [{ type: i1.Actions }, { type: undefined, decorators: [{
|
|
334
245
|
type: Inject,
|
|
@@ -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
|
*
|
|
@@ -556,10 +408,10 @@ class DaffProductFacade {
|
|
|
556
408
|
dispatch(action) {
|
|
557
409
|
this.store.dispatch(action);
|
|
558
410
|
}
|
|
559
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
560
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
411
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductFacade, deps: [{ token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
412
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductFacade, providedIn: 'root' }); }
|
|
561
413
|
}
|
|
562
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductFacade, decorators: [{
|
|
563
415
|
type: Injectable,
|
|
564
416
|
args: [{
|
|
565
417
|
providedIn: 'root',
|
|
@@ -586,10 +438,10 @@ class DaffProductPageFacade {
|
|
|
586
438
|
dispatch(action) {
|
|
587
439
|
this.store.dispatch(action);
|
|
588
440
|
}
|
|
589
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
590
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
441
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductPageFacade, deps: [{ token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
442
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductPageFacade, providedIn: 'root' }); }
|
|
591
443
|
}
|
|
592
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
444
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductPageFacade, decorators: [{
|
|
593
445
|
type: Injectable,
|
|
594
446
|
args: [{
|
|
595
447
|
providedIn: 'root',
|
|
@@ -611,55 +463,16 @@ class DaffProductGridFacade {
|
|
|
611
463
|
dispatch(action) {
|
|
612
464
|
this.store.dispatch(action);
|
|
613
465
|
}
|
|
614
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
615
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
466
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductGridFacade, deps: [{ token: i1$1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
467
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductGridFacade, providedIn: 'root' }); }
|
|
616
468
|
}
|
|
617
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
469
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductGridFacade, decorators: [{
|
|
618
470
|
type: Injectable,
|
|
619
471
|
args: [{
|
|
620
472
|
providedIn: 'root',
|
|
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 {
|
|
@@ -824,10 +631,10 @@ class DaffProductPageEffects {
|
|
|
824
631
|
this.loadByUrl$ = createEffect(() => this.actions$.pipe(ofType(DaffProductPageActionTypes.ProductPageLoadByUrlAction), switchMap((action) => this.driver.getByUrl(action.payload)
|
|
825
632
|
.pipe(map((resp) => new DaffProductPageLoadSuccess(resp)), catchError((error) => of(new DaffProductPageLoadFailure(this.errorMatcher(error))))))));
|
|
826
633
|
}
|
|
827
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
828
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
|
634
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductPageEffects, deps: [{ token: i1.Actions }, { token: DaffProductDriver }, { token: DAFF_PRODUCT_ERROR_MATCHER }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
635
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductPageEffects }); }
|
|
829
636
|
}
|
|
830
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
637
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductPageEffects, decorators: [{
|
|
831
638
|
type: Injectable
|
|
832
639
|
}], ctorParameters: () => [{ type: i1.Actions }, { type: undefined, decorators: [{
|
|
833
640
|
type: Inject,
|
|
@@ -876,17 +683,16 @@ provider: provideDaffProductReducers, } = createSingleInjectionToken('DAFF_PRODU
|
|
|
876
683
|
* A module that provides the default reducers and effects for the product redux state.
|
|
877
684
|
*/
|
|
878
685
|
class DaffProductStateModule {
|
|
879
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
|
880
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
|
881
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
|
686
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
687
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.11", ngImport: i0, type: DaffProductStateModule, imports: [i1$1.StoreFeatureModule, i1.EffectsFeatureModule] }); }
|
|
688
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductStateModule, imports: [StoreModule.forFeature(DAFF_PRODUCT_STORE_FEATURE_KEY, DAFF_PRODUCT_REDUCERS, DAFF_PRODUCT_STORE_CONFIG),
|
|
882
689
|
EffectsModule.forFeature([
|
|
883
690
|
DaffProductGridEffects,
|
|
884
691
|
DaffProductEffects,
|
|
885
692
|
DaffProductPageEffects,
|
|
886
|
-
DaffBestSellersEffects,
|
|
887
693
|
])] }); }
|
|
888
694
|
}
|
|
889
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
|
695
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductStateModule, decorators: [{
|
|
890
696
|
type: NgModule,
|
|
891
697
|
args: [{
|
|
892
698
|
imports: [
|
|
@@ -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
|