@daffodil/upsell-products 0.94.1 → 0.95.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.
Files changed (40) hide show
  1. package/fesm2022/daffodil-upsell-products-driver-in-memory.mjs +57 -47
  2. package/fesm2022/daffodil-upsell-products-driver-in-memory.mjs.map +1 -1
  3. package/fesm2022/daffodil-upsell-products-driver-magento-2.4.7-testing.mjs +48 -0
  4. package/fesm2022/daffodil-upsell-products-driver-magento-2.4.7-testing.mjs.map +1 -0
  5. package/fesm2022/daffodil-upsell-products-driver-magento-2.4.7.mjs +130 -0
  6. package/fesm2022/daffodil-upsell-products-driver-magento-2.4.7.mjs.map +1 -0
  7. package/fesm2022/daffodil-upsell-products-driver-magento-auto-testing.mjs +7 -0
  8. package/fesm2022/daffodil-upsell-products-driver-magento-auto-testing.mjs.map +1 -0
  9. package/fesm2022/daffodil-upsell-products-driver-magento-auto.mjs +7 -0
  10. package/fesm2022/daffodil-upsell-products-driver-magento-auto.mjs.map +1 -0
  11. package/fesm2022/daffodil-upsell-products-driver-testing.mjs +54 -36
  12. package/fesm2022/daffodil-upsell-products-driver-testing.mjs.map +1 -1
  13. package/fesm2022/daffodil-upsell-products-driver.mjs +0 -4
  14. package/fesm2022/daffodil-upsell-products-state-testing.mjs +84 -45
  15. package/fesm2022/daffodil-upsell-products-state-testing.mjs.map +1 -1
  16. package/fesm2022/daffodil-upsell-products-state.mjs +124 -130
  17. package/fesm2022/daffodil-upsell-products-state.mjs.map +1 -1
  18. package/fesm2022/daffodil-upsell-products-testing.mjs +49 -38
  19. package/fesm2022/daffodil-upsell-products-testing.mjs.map +1 -1
  20. package/fesm2022/daffodil-upsell-products.mjs +0 -4
  21. package/package.json +1 -1
  22. package/types/daffodil-upsell-products-driver-in-memory.d.ts +14 -11
  23. package/types/daffodil-upsell-products-driver-magento-2.4.7-testing.d.ts +15 -0
  24. package/types/daffodil-upsell-products-driver-magento-2.4.7.d.ts +42 -0
  25. package/types/daffodil-upsell-products-driver-magento-auto-testing.d.ts +1 -0
  26. package/types/daffodil-upsell-products-driver-magento-auto.d.ts +1 -0
  27. package/types/daffodil-upsell-products-driver-testing.d.ts +14 -11
  28. package/types/daffodil-upsell-products-driver.d.ts +1 -2
  29. package/types/daffodil-upsell-products-state-testing.d.ts +21 -17
  30. package/types/daffodil-upsell-products-state.d.ts +62 -71
  31. package/types/daffodil-upsell-products-testing.d.ts +10 -12
  32. package/types/daffodil-upsell-products.d.ts +7 -10
  33. package/fesm2022/daffodil-upsell-products-driver-magento-testing.mjs +0 -34
  34. package/fesm2022/daffodil-upsell-products-driver-magento-testing.mjs.map +0 -1
  35. package/fesm2022/daffodil-upsell-products-driver-magento.mjs +0 -104
  36. package/fesm2022/daffodil-upsell-products-driver-magento.mjs.map +0 -1
  37. package/fesm2022/daffodil-upsell-products-driver.mjs.map +0 -1
  38. package/fesm2022/daffodil-upsell-products.mjs.map +0 -1
  39. package/types/daffodil-upsell-products-driver-magento-testing.d.ts +0 -18
  40. package/types/daffodil-upsell-products-driver-magento.d.ts +0 -44
@@ -1,24 +1,28 @@
1
- import { BehaviorSubject } from 'rxjs';
2
- import { DaffProduct } from '@daffodil/product';
3
- import { DaffUpsellProductsFacadeInterface } from '@daffodil/upsell-products/state';
4
- import * as i0 from '@angular/core';
5
-
1
+ import { BehaviorSubject } from "rxjs";
2
+ import { DaffProduct } from "@daffodil/product";
3
+ import { DaffUpsellProductsFacadeInterface } from "@daffodil/upsell-products/state";
4
+ import * as i0 from "@angular/core";
5
+ import { EnvironmentProviders } from "@angular/core";
6
6
  /**
7
7
  * Mocks the {@link DaffUpsellProductsFacadeInterface} for testing purposes.
8
8
  *
9
9
  * @inheritdoc
10
10
  */
11
- declare class MockDaffUpsellProductsFacade implements DaffUpsellProductsFacadeInterface {
12
- upsellProducts$: BehaviorSubject<DaffProduct[]>;
13
- dispatch(action: any): void;
14
- static ɵfac: i0.ɵɵFactoryDeclaration<MockDaffUpsellProductsFacade, never>;
15
- static ɵprov: i0.ɵɵInjectableDeclaration<MockDaffUpsellProductsFacade>;
11
+ export declare class MockDaffUpsellProductsFacade implements DaffUpsellProductsFacadeInterface {
12
+ upsellProducts$: BehaviorSubject<DaffProduct[]>;
13
+ dispatch(action: any): void;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<MockDaffUpsellProductsFacade, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
16
16
  }
17
-
18
- declare class DaffUpsellProductsStateTestingModule {
19
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductsStateTestingModule, never>;
20
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffUpsellProductsStateTestingModule, never, never, never>;
21
- static ɵinj: i0.ɵɵInjectorDeclaration<DaffUpsellProductsStateTestingModule>;
17
+ /**
18
+ * @deprecated in favor of {@link provideDaffUpsellProductsStateTesting} Deprecated in version 0.95.0. Will be removed in version 0.98.0.
19
+ */
20
+ export declare class DaffUpsellProductsStateTestingModule {
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductsStateTestingModule, never>;
22
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffUpsellProductsStateTestingModule, never, never, never>;
23
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffUpsellProductsStateTestingModule>;
22
24
  }
23
-
24
- export { DaffUpsellProductsStateTestingModule, MockDaffUpsellProductsFacade };
25
+ /**
26
+ * Provides the mock upsell products facade in place of the real one.
27
+ */
28
+ export declare const provideDaffUpsellProductsStateTesting: () => EnvironmentProviders;
@@ -1,132 +1,123 @@
1
- import * as i1 from '@ngrx/store';
2
- import { Action, Store, ActionReducer, ActionReducerMap, MemoizedSelector } from '@ngrx/store';
3
- import { Observable } from 'rxjs';
4
- import { DaffStoreFacade } from '@daffodil/core/state';
5
- import { DaffProduct } from '@daffodil/product';
6
- import { DaffProductStateRootSlice, DaffProductPageActions, DaffProductPageLoadSuccess } from '@daffodil/product/state';
7
- import { ID } from '@daffodil/core';
8
- import * as i0 from '@angular/core';
9
-
1
+ import * as i1 from "@ngrx/store";
2
+ import { Action, ActionReducer, ActionReducerMap, MemoizedSelector, Store } from "@ngrx/store";
3
+ import { Observable } from "rxjs";
4
+ import { DaffStoreFacade } from "@daffodil/core/state";
5
+ import { DaffProduct } from "@daffodil/product";
6
+ import { DaffProductPageActions, DaffProductPageLoadSuccess, DaffProductStateRootSlice } from "@daffodil/product/state";
7
+ import { ID } from "@daffodil/core";
8
+ import * as i0 from "@angular/core";
9
+ import { EnvironmentProviders } from "@angular/core";
10
10
  /**
11
11
  * A facade for getting state about a particular product's upsell products.
12
12
  */
13
- interface DaffUpsellProductsFacadeInterface<T extends DaffProduct = DaffProduct> extends DaffStoreFacade<Action> {
14
- /**
15
- * A list of upsell products of the current product.
16
- */
17
- upsellProducts$: Observable<T[]>;
13
+ export interface DaffUpsellProductsFacadeInterface<T extends DaffProduct = DaffProduct> extends DaffStoreFacade<Action> {
14
+ /**
15
+ * A list of upsell products of the current product.
16
+ */
17
+ upsellProducts$: Observable<T[]>;
18
18
  }
19
-
20
- declare const DAFF_UPSELL_PRODUCTS_STORE_FEATURE_KEY = "daffUpsellProducts";
21
-
19
+ export declare const DAFF_UPSELL_PRODUCTS_STORE_FEATURE_KEY = "daffUpsellProducts";
22
20
  /**
23
21
  * An interface describing upsell product redux state.
24
22
  * Stores the upsell product IDs for the current product that is loaded for a product page.
25
23
  */
26
- interface DaffUpsellProductsReducerState {
27
- /**
28
- * The upsell product IDs.
29
- */
30
- upsellProductIds: ID[];
24
+ export interface DaffUpsellProductsReducerState {
25
+ /**
26
+ * The upsell product IDs.
27
+ */
28
+ upsellProductIds: ID[];
31
29
  }
32
-
33
30
  /**
34
31
  * Interface for the redux store of the upsell product feature area.
35
32
  */
36
- interface DaffUpsellProductsReducersState {
37
- upsellProducts: DaffUpsellProductsReducerState;
33
+ export interface DaffUpsellProductsReducersState {
34
+ upsellProducts: DaffUpsellProductsReducerState;
38
35
  }
39
36
  /**
40
37
  * The footprint of the upsell product feature in the root state.
41
38
  */
42
- interface DaffUpsellProductStateRootSlice<T extends DaffProduct = DaffProduct> extends DaffProductStateRootSlice<T> {
43
- [DAFF_UPSELL_PRODUCTS_STORE_FEATURE_KEY]: DaffUpsellProductsReducersState;
39
+ export interface DaffUpsellProductStateRootSlice<T extends DaffProduct = DaffProduct> extends DaffProductStateRootSlice<T> {
40
+ [DAFF_UPSELL_PRODUCTS_STORE_FEATURE_KEY]: DaffUpsellProductsReducersState;
44
41
  }
45
-
46
42
  /**
47
43
  * @inheritdoc
48
44
  */
49
- declare class DaffUpsellProductsFacade<T extends DaffProduct = DaffProduct> implements DaffUpsellProductsFacadeInterface<T> {
50
- private store;
51
- upsellProducts$: Observable<T[]>;
52
- private readonly selectors;
53
- constructor(store: Store<DaffUpsellProductStateRootSlice<T>>);
54
- dispatch(action: Action): void;
55
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductsFacade<any>, never>;
56
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffUpsellProductsFacade<any>>;
45
+ export declare class DaffUpsellProductsFacade<T extends DaffProduct = DaffProduct> implements DaffUpsellProductsFacadeInterface<T> {
46
+ private store;
47
+ upsellProducts$: Observable<T[]>;
48
+ private readonly selectors;
49
+ constructor(store: Store<DaffUpsellProductStateRootSlice<T>>);
50
+ dispatch(action: Action): void;
51
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductsFacade<any>, never>;
52
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
57
53
  }
58
-
59
54
  /**
60
55
  * Initial values of the upsell product state.
61
56
  */
62
- declare const initialState: DaffUpsellProductsReducerState;
63
- declare const getUpsellProductIds: <T extends DaffProduct>(action: DaffProductPageLoadSuccess<T>) => string[];
57
+ export declare const initialState: DaffUpsellProductsReducerState;
58
+ export declare const getUpsellProductIds: <T extends DaffProduct>(action: DaffProductPageLoadSuccess<T>) => string[];
64
59
  /**
65
60
  * Reducer function that catches actions and changes/overwrites upsell product state.
66
61
  */
67
- declare function daffUpsellProductsReducer<T extends DaffProduct>(state: DaffUpsellProductsReducerState, action: DaffProductPageActions<T>): DaffUpsellProductsReducerState;
68
-
62
+ export declare function daffUpsellProductsReducer<T extends DaffProduct>(state: DaffUpsellProductsReducerState, action: DaffProductPageActions<T>): DaffUpsellProductsReducerState;
69
63
  /**
70
64
  * A meta reducer that dedupes nested upsell products.
71
65
  * Invokes the passed reducer with a new DaffProductPageLoadSuccess
72
66
  * that contains a payload missing the upsell products.
73
67
  */
74
- declare function daffUpsellProductsDedupeMetaReducer<T = Record<string, any>>(reducer: ActionReducer<T, DaffProductPageActions>): ActionReducer<T, DaffProductPageActions>;
75
-
68
+ export declare function daffUpsellProductsDedupeMetaReducer<T = Record<string, any>>(reducer: ActionReducer<T, DaffProductPageActions>): ActionReducer<T, DaffProductPageActions>;
76
69
  /**
77
70
  * Returns state values from all upsell product reducers.
78
71
  */
79
- declare const daffUpsellProductsReducers: ActionReducerMap<DaffUpsellProductsReducersState>;
80
-
72
+ export declare const daffUpsellProductsReducers: ActionReducerMap<DaffUpsellProductsReducersState>;
81
73
  /**
82
74
  * An interface for the entire upsell products feature state.
83
75
  */
84
- interface DaffUpsellProductsFeatureMemoizedSelector<T extends DaffProduct = DaffProduct> {
85
- selectUpsellProductsState: MemoizedSelector<DaffUpsellProductStateRootSlice<T>, DaffUpsellProductsReducersState>;
76
+ export interface DaffUpsellProductsFeatureMemoizedSelector<T extends DaffProduct = DaffProduct> {
77
+ selectUpsellProductsState: MemoizedSelector<DaffUpsellProductStateRootSlice<T>, DaffUpsellProductsReducersState>;
86
78
  }
87
79
  /**
88
80
  * A function that returns a selector for the entire upsell products feature state.
89
81
  */
90
- declare const getDaffUpsellProductsFeatureSelector: <T extends DaffProduct>() => DaffUpsellProductsFeatureMemoizedSelector<T>;
91
-
82
+ export declare const getDaffUpsellProductsFeatureSelector: <T extends DaffProduct>() => DaffUpsellProductsFeatureMemoizedSelector<T>;
92
83
  /**
93
84
  * An interface for selectors of upsell products for the current product page.
94
85
  */
95
- interface DaffUpsellProductsMemoizedSelectors<T extends DaffProduct = DaffProduct> {
96
- /**
97
- * Selects the IDs of the upsell products.
98
- */
99
- selectUpsellProductIds: MemoizedSelector<DaffUpsellProductStateRootSlice, T['id'][]>;
100
- /**
101
- * Selects the upsell products.
102
- */
103
- selectUpsellProducts: MemoizedSelector<DaffUpsellProductStateRootSlice, T[]>;
86
+ export interface DaffUpsellProductsMemoizedSelectors<T extends DaffProduct = DaffProduct> {
87
+ /**
88
+ * Selects the IDs of the upsell products.
89
+ */
90
+ selectUpsellProductIds: MemoizedSelector<DaffUpsellProductStateRootSlice, T['id'][]>;
91
+ /**
92
+ * Selects the upsell products.
93
+ */
94
+ selectUpsellProducts: MemoizedSelector<DaffUpsellProductStateRootSlice, T[]>;
104
95
  }
105
96
  /**
106
97
  * A function that returns all selectors of upsell products for the current product page.
107
98
  * Returns {@link DaffUpsellProductsMemoizedSelectors}.
108
99
  */
109
- declare const getDaffUpsellProductsPageSelectors: <T extends DaffProduct>() => DaffUpsellProductsMemoizedSelectors<T>;
110
-
100
+ export declare const getDaffUpsellProductsPageSelectors: <T extends DaffProduct>() => DaffUpsellProductsMemoizedSelectors<T>;
111
101
  /**
112
102
  * An interface for all selectors in the entire upsell products feature area.
113
103
  */
114
- interface DaffUpsellProductsAllSelectors<T extends DaffProduct = DaffProduct> extends DaffUpsellProductsMemoizedSelectors<T>, DaffUpsellProductsFeatureMemoizedSelector<T> {
115
- }
104
+ export interface DaffUpsellProductsAllSelectors<T extends DaffProduct = DaffProduct> extends DaffUpsellProductsMemoizedSelectors<T>, DaffUpsellProductsFeatureMemoizedSelector<T> {}
116
105
  /**
117
106
  * A function that returns all selectors in the entire upsell products feature area.
118
107
  * Returns {@link DaffUpsellProductsAllSelectors}.
119
108
  */
120
- declare const getDaffUpsellProductsSelectors: <T extends DaffProduct = DaffProduct>() => DaffUpsellProductsAllSelectors<T>;
121
-
109
+ export declare const getDaffUpsellProductsSelectors: <T extends DaffProduct = DaffProduct>() => DaffUpsellProductsAllSelectors<T>;
122
110
  /**
123
111
  * A module that provides the default reducers for the upsell product redux state.
112
+ *
113
+ * @deprecated in favor of {@link provideDaffUpsellProductsState} Deprecated in version 0.95.0. Will be removed in version 0.98.0.
124
114
  */
125
- declare class DaffUpsellProductStateModule {
126
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductStateModule, never>;
127
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffUpsellProductStateModule, never, [typeof i1.StoreFeatureModule], never>;
128
- static ɵinj: i0.ɵɵInjectorDeclaration<DaffUpsellProductStateModule>;
115
+ export declare class DaffUpsellProductStateModule {
116
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductStateModule, never>;
117
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffUpsellProductStateModule, never, [typeof i1.StoreFeatureModule], never>;
118
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffUpsellProductStateModule>;
129
119
  }
130
-
131
- export { DAFF_UPSELL_PRODUCTS_STORE_FEATURE_KEY, DaffUpsellProductStateModule, DaffUpsellProductsFacade, daffUpsellProductsDedupeMetaReducer, daffUpsellProductsReducer, daffUpsellProductsReducers, getDaffUpsellProductsFeatureSelector, getDaffUpsellProductsPageSelectors, getDaffUpsellProductsSelectors, getUpsellProductIds, initialState };
132
- export type { DaffUpsellProductStateRootSlice, DaffUpsellProductsAllSelectors, DaffUpsellProductsFacadeInterface, DaffUpsellProductsFeatureMemoizedSelector, DaffUpsellProductsMemoizedSelectors, DaffUpsellProductsReducerState, DaffUpsellProductsReducersState };
120
+ /**
121
+ * Provides the default reducers for the upsell product redux state.
122
+ */
123
+ export declare const provideDaffUpsellProductsState: () => EnvironmentProviders;
@@ -1,15 +1,13 @@
1
- import { DaffModelFactory } from '@daffodil/core/testing';
2
- import { DaffProductKindFactory, DaffProductImageFactory } from '@daffodil/product/testing';
3
- import { DaffUpsellProduct } from '@daffodil/upsell-products';
4
- import * as i0 from '@angular/core';
5
-
1
+ import { DaffModelFactory } from "@daffodil/core/testing";
2
+ import "@daffodil/product";
3
+ import { DaffProductImageFactory, DaffProductKindFactory } from "@daffodil/product/testing";
4
+ import { DaffUpsellProduct } from "@daffodil/upsell-products";
5
+ import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Factory for creating DaffUpsellProducts.
8
8
  */
9
- declare class DaffUpsellProductFactory extends DaffModelFactory<DaffUpsellProduct> {
10
- constructor(productKindFactory: DaffProductKindFactory, imageFactory: DaffProductImageFactory);
11
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductFactory, never>;
12
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffUpsellProductFactory>;
13
- }
14
-
15
- export { DaffUpsellProductFactory };
9
+ export declare class DaffUpsellProductFactory extends DaffModelFactory<DaffUpsellProduct> {
10
+ constructor(productKindFactory: DaffProductKindFactory, imageFactory: DaffProductImageFactory);
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductFactory, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
13
+ }
@@ -1,13 +1,10 @@
1
- import { DaffProduct } from '@daffodil/product';
2
-
1
+ import { DaffProduct } from "@daffodil/product";
3
2
  /**
4
3
  * An extension of a {@link DaffProduct} that includes a list of upsell products.
5
4
  */
6
- interface DaffUpsellProduct extends DaffProduct {
7
- /**
8
- * A list of upsell products.
9
- */
10
- upsell: DaffProduct[];
11
- }
12
-
13
- export type { DaffUpsellProduct };
5
+ export interface DaffUpsellProduct extends DaffProduct {
6
+ /**
7
+ * A list of upsell products.
8
+ */
9
+ upsell: DaffProduct[];
10
+ }
@@ -1,34 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable } from '@angular/core';
3
- import { DaffModelFactory } from '@daffodil/core/testing';
4
- import { MockMagentoCoreProduct } from '@daffodil/product/driver/magento/testing';
5
-
6
- class MockMagentoProductWithUpsell extends MockMagentoCoreProduct {
7
- constructor() {
8
- super(...arguments);
9
- this.upsell_products = [];
10
- }
11
- }
12
- /**
13
- * A factory for creating stub data for {@link MagentoProductWithUpsell}s.
14
- */
15
- class MagentoProductWithUpsellFactory extends DaffModelFactory {
16
- constructor() {
17
- super(MockMagentoProductWithUpsell);
18
- }
19
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoProductWithUpsellFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
20
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoProductWithUpsellFactory, providedIn: 'root' }); }
21
- }
22
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: MagentoProductWithUpsellFactory, decorators: [{
23
- type: Injectable,
24
- args: [{
25
- providedIn: 'root',
26
- }]
27
- }], ctorParameters: () => [] });
28
-
29
- /**
30
- * Generated bundle index. Do not edit.
31
- */
32
-
33
- export { MagentoProductWithUpsellFactory, MockMagentoProductWithUpsell };
34
- //# sourceMappingURL=daffodil-upsell-products-driver-magento-testing.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"daffodil-upsell-products-driver-magento-testing.mjs","sources":["../../../libs/upsell-products/driver/magento/testing/src/factories/product-with-upsell.factory.ts","../../../libs/upsell-products/driver/magento/testing/src/daffodil-upsell-products-driver-magento-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { DaffModelFactory } from '@daffodil/core/testing';\nimport { MockMagentoCoreProduct } from '@daffodil/product/driver/magento/testing';\nimport { MagentoProductWithUpsell } from '@daffodil/upsell-products/driver/magento';\n\nexport class MockMagentoProductWithUpsell extends MockMagentoCoreProduct implements MagentoProductWithUpsell {\n upsell_products = [];\n}\n\n/**\n * A factory for creating stub data for {@link MagentoProductWithUpsell}s.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class MagentoProductWithUpsellFactory extends DaffModelFactory<MagentoProductWithUpsell> {\n constructor(){\n super(MockMagentoProductWithUpsell);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMM,MAAO,4BAA6B,SAAQ,sBAAsB,CAAA;AAAxE,IAAA,WAAA,GAAA;;QACE,IAAA,CAAA,eAAe,GAAG,EAAE;IACtB;AAAC;AAED;;AAEG;AAIG,MAAO,+BAAgC,SAAQ,gBAA0C,CAAA;AAC7F,IAAA,WAAA,GAAA;QACE,KAAK,CAAC,4BAA4B,CAAC;IACrC;iIAHW,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAA/B,uBAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,+BAA+B,cAF9B,MAAM,EAAA,CAAA,CAAA;;2FAEP,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBAH3C,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACfD;;AAEG;;;;"}
@@ -1,104 +0,0 @@
1
- import { gql } from 'apollo-angular';
2
- import { daffBuildFragmentNameSpread, daffBuildFragmentDefinition } from '@daffodil/core/graphql';
3
- import { magentoProductPreviewFragment, DAFF_PRODUCT_MAGENTO_PRODUCT_PREVIEW_TRANSFORM, DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PAGE_FRAGMENTS, DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_RESPONSE_TRANSFORMS, DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PREVIEW_FRAGMENTS } from '@daffodil/product/driver/magento';
4
- import * as i0 from '@angular/core';
5
- import { Inject, Injectable, inject, NgModule } from '@angular/core';
6
- import { CommonModule } from '@angular/common';
7
-
8
- const magentoUpsellProductsFragment = (extraProductFragments = []) => gql `
9
- fragment upsellProducts on ProductInterface {
10
- upsell_products {
11
- ...magentoProductPreview
12
- ${daffBuildFragmentNameSpread(...extraProductFragments)}
13
- }
14
- }
15
- ${magentoProductPreviewFragment}
16
- ${daffBuildFragmentDefinition(...extraProductFragments)}
17
- `;
18
-
19
- /**
20
- * Adds upsell product info to the product driver response.
21
- */
22
- class DaffMagentoUpsellProductsTransformers {
23
- constructor(productPreviewTransform) {
24
- this.productPreviewTransform = productPreviewTransform;
25
- }
26
- /**
27
- * Transforms magento upsell products with the product preview transform and
28
- * stores those upsell products in the products array and nested in the main product.
29
- */
30
- transformMagentoUpsellProducts(daffProductResponse, magentoProduct, mediaUrl) {
31
- const upsell = magentoProduct.upsell_products.map(p => this.productPreviewTransform(p, mediaUrl));
32
- return {
33
- ...daffProductResponse,
34
- products: [
35
- ...daffProductResponse.products.map(product => product.id === daffProductResponse.id
36
- ? ({
37
- ...product,
38
- upsell,
39
- })
40
- : product),
41
- ...upsell,
42
- ],
43
- };
44
- }
45
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoUpsellProductsTransformers, deps: [{ token: DAFF_PRODUCT_MAGENTO_PRODUCT_PREVIEW_TRANSFORM }], target: i0.ɵɵFactoryTarget.Injectable }); }
46
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoUpsellProductsTransformers, providedIn: 'root' }); }
47
- }
48
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffMagentoUpsellProductsTransformers, decorators: [{
49
- type: Injectable,
50
- args: [{
51
- providedIn: 'root',
52
- }]
53
- }], ctorParameters: () => [{ type: undefined, decorators: [{
54
- type: Inject,
55
- args: [DAFF_PRODUCT_MAGENTO_PRODUCT_PREVIEW_TRANSFORM]
56
- }] }] });
57
-
58
- /**
59
- * A module that provides the {@link magentoUpsellProductsFragment} and {@link DaffMagentoUpsellProductsTransformers}.
60
- */
61
- class DaffUpsellProductsMagentoDriverModule {
62
- static forRoot() {
63
- return {
64
- ngModule: DaffUpsellProductsMagentoDriverModule,
65
- providers: [
66
- {
67
- provide: DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PAGE_FRAGMENTS,
68
- multi: true,
69
- useFactory() {
70
- return magentoUpsellProductsFragment(inject(DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PREVIEW_FRAGMENTS));
71
- },
72
- },
73
- {
74
- provide: DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_RESPONSE_TRANSFORMS,
75
- multi: true,
76
- useFactory() {
77
- const transformerService = inject(DaffMagentoUpsellProductsTransformers);
78
- return (daffProductResponse, magentoProduct, mediaUrl) => magentoProduct.upsell_products
79
- ? transformerService.transformMagentoUpsellProducts(daffProductResponse, magentoProduct, mediaUrl)
80
- : daffProductResponse;
81
- },
82
- },
83
- ],
84
- };
85
- }
86
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffUpsellProductsMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
87
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffUpsellProductsMagentoDriverModule, imports: [CommonModule] }); }
88
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffUpsellProductsMagentoDriverModule, imports: [CommonModule] }); }
89
- }
90
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffUpsellProductsMagentoDriverModule, decorators: [{
91
- type: NgModule,
92
- args: [{
93
- imports: [
94
- CommonModule,
95
- ],
96
- }]
97
- }] });
98
-
99
- /**
100
- * Generated bundle index. Do not edit.
101
- */
102
-
103
- export { DaffMagentoUpsellProductsTransformers, DaffUpsellProductsMagentoDriverModule, magentoUpsellProductsFragment };
104
- //# sourceMappingURL=daffodil-upsell-products-driver-magento.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"daffodil-upsell-products-driver-magento.mjs","sources":["../../../libs/upsell-products/driver/magento/src/queries/fragments/upsell-products.ts","../../../libs/upsell-products/driver/magento/src/transforms/product-response.service.ts","../../../libs/upsell-products/driver/magento/src/magento.module.ts","../../../libs/upsell-products/driver/magento/src/daffodil-upsell-products-driver-magento.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\nimport { DocumentNode } from 'graphql';\n\nimport {\n daffBuildFragmentDefinition,\n daffBuildFragmentNameSpread,\n} from '@daffodil/core/graphql';\nimport { magentoProductPreviewFragment } from '@daffodil/product/driver/magento';\n\nexport const magentoUpsellProductsFragment = (extraProductFragments: DocumentNode[] = []) => gql`\n fragment upsellProducts on ProductInterface {\n upsell_products {\n ...magentoProductPreview\n ${daffBuildFragmentNameSpread(...extraProductFragments)}\n }\n\t}\n\t${magentoProductPreviewFragment}\n ${daffBuildFragmentDefinition(...extraProductFragments)}\n`;\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\n\nimport { DaffProductDriverResponse } from '@daffodil/product/driver';\nimport {\n DaffMagentoProductTransform,\n DAFF_PRODUCT_MAGENTO_PRODUCT_PREVIEW_TRANSFORM,\n} from '@daffodil/product/driver/magento';\n\nimport { MagentoProductWithUpsell } from '../models/product-with-upsell.interface';\n\n/**\n * Adds upsell product info to the product driver response.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffMagentoUpsellProductsTransformers {\n constructor(\n @Inject(DAFF_PRODUCT_MAGENTO_PRODUCT_PREVIEW_TRANSFORM) private productPreviewTransform: DaffMagentoProductTransform,\n ) {}\n\n /**\n * Transforms magento upsell products with the product preview transform and\n * stores those upsell products in the products array and nested in the main product.\n */\n transformMagentoUpsellProducts(\n daffProductResponse: DaffProductDriverResponse,\n magentoProduct: MagentoProductWithUpsell,\n mediaUrl: string,\n ): DaffProductDriverResponse {\n const upsell = magentoProduct.upsell_products.map(p => this.productPreviewTransform(p, mediaUrl));\n\n return {\n ...daffProductResponse,\n\n products: [\n ...daffProductResponse.products.map(product =>\n product.id === daffProductResponse.id\n ? ({\n ...product,\n upsell,\n })\n : product,\n ),\n ...upsell,\n ],\n };\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n inject,\n} from '@angular/core';\n\nimport { DaffProductDriverResponse } from '@daffodil/product/driver';\nimport {\n DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PAGE_FRAGMENTS,\n DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PREVIEW_FRAGMENTS,\n DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_RESPONSE_TRANSFORMS,\n} from '@daffodil/product/driver/magento';\n\nimport { MagentoProductWithUpsell } from './models/product-with-upsell.interface';\nimport { magentoUpsellProductsFragment } from './queries/fragments/upsell-products';\nimport { DaffMagentoUpsellProductsTransformers } from './transforms/product-response.service';\n\n/**\n * A module that provides the {@link magentoUpsellProductsFragment} and {@link DaffMagentoUpsellProductsTransformers}.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffUpsellProductsMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffUpsellProductsMagentoDriverModule> {\n return {\n ngModule: DaffUpsellProductsMagentoDriverModule,\n providers: [\n {\n provide: DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PAGE_FRAGMENTS,\n multi: true,\n useFactory() {\n return magentoUpsellProductsFragment(inject(DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PREVIEW_FRAGMENTS));\n },\n },\n {\n provide: DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_RESPONSE_TRANSFORMS,\n multi: true,\n useFactory() {\n const transformerService = inject(DaffMagentoUpsellProductsTransformers);\n return (\n daffProductResponse: DaffProductDriverResponse,\n magentoProduct: MagentoProductWithUpsell,\n mediaUrl: string,\n ) =>\n magentoProduct.upsell_products\n ? transformerService.transformMagentoUpsellProducts(daffProductResponse, magentoProduct, mediaUrl)\n : daffProductResponse;\n },\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"daffodil-upsell-products-driver.mjs","sources":["../../../libs/upsell-products/driver/src/daffodil-upsell-products-driver.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;AAEG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"daffodil-upsell-products.mjs","sources":["../../../libs/upsell-products/src/daffodil-upsell-products.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;AAEG"}
@@ -1,18 +0,0 @@
1
- import { DaffModelFactory } from '@daffodil/core/testing';
2
- import { MockMagentoCoreProduct } from '@daffodil/product/driver/magento/testing';
3
- import { MagentoProductWithUpsell } from '@daffodil/upsell-products/driver/magento';
4
- import * as i0 from '@angular/core';
5
-
6
- declare class MockMagentoProductWithUpsell extends MockMagentoCoreProduct implements MagentoProductWithUpsell {
7
- upsell_products: any[];
8
- }
9
- /**
10
- * A factory for creating stub data for {@link MagentoProductWithUpsell}s.
11
- */
12
- declare class MagentoProductWithUpsellFactory extends DaffModelFactory<MagentoProductWithUpsell> {
13
- constructor();
14
- static ɵfac: i0.ɵɵFactoryDeclaration<MagentoProductWithUpsellFactory, never>;
15
- static ɵprov: i0.ɵɵInjectableDeclaration<MagentoProductWithUpsellFactory>;
16
- }
17
-
18
- export { MagentoProductWithUpsellFactory, MockMagentoProductWithUpsell };
@@ -1,44 +0,0 @@
1
- import * as apollo_angular from 'apollo-angular';
2
- import { DocumentNode } from 'graphql';
3
- import { DaffProductDriverResponse } from '@daffodil/product/driver';
4
- import { MagentoProduct, MagentoProductPreview, DaffMagentoProductTransform } from '@daffodil/product/driver/magento';
5
- import * as i0 from '@angular/core';
6
- import { ModuleWithProviders } from '@angular/core';
7
- import * as i1 from '@angular/common';
8
-
9
- declare const magentoUpsellProductsFragment: (extraProductFragments?: DocumentNode[]) => apollo_angular.TypedDocumentNode<unknown, unknown>;
10
-
11
- /**
12
- * A product that includes a list of upsell products.
13
- */
14
- interface MagentoProductWithUpsell extends MagentoProduct {
15
- upsell_products: MagentoProductPreview[];
16
- }
17
-
18
- /**
19
- * Adds upsell product info to the product driver response.
20
- */
21
- declare class DaffMagentoUpsellProductsTransformers {
22
- private productPreviewTransform;
23
- constructor(productPreviewTransform: DaffMagentoProductTransform);
24
- /**
25
- * Transforms magento upsell products with the product preview transform and
26
- * stores those upsell products in the products array and nested in the main product.
27
- */
28
- transformMagentoUpsellProducts(daffProductResponse: DaffProductDriverResponse, magentoProduct: MagentoProductWithUpsell, mediaUrl: string): DaffProductDriverResponse;
29
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffMagentoUpsellProductsTransformers, never>;
30
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffMagentoUpsellProductsTransformers>;
31
- }
32
-
33
- /**
34
- * A module that provides the {@link magentoUpsellProductsFragment} and {@link DaffMagentoUpsellProductsTransformers}.
35
- */
36
- declare class DaffUpsellProductsMagentoDriverModule {
37
- static forRoot(): ModuleWithProviders<DaffUpsellProductsMagentoDriverModule>;
38
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffUpsellProductsMagentoDriverModule, never>;
39
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffUpsellProductsMagentoDriverModule, never, [typeof i1.CommonModule], never>;
40
- static ɵinj: i0.ɵɵInjectorDeclaration<DaffUpsellProductsMagentoDriverModule>;
41
- }
42
-
43
- export { DaffMagentoUpsellProductsTransformers, DaffUpsellProductsMagentoDriverModule, magentoUpsellProductsFragment };
44
- export type { MagentoProductWithUpsell };