@daffodil/product-composite 0.87.2 → 0.89.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/driver/in-memory/index.d.ts +15 -1
  2. package/driver/magento/index.d.ts +133 -1
  3. package/driver/magento/testing/index.d.ts +62 -1
  4. package/driver/testing/index.d.ts +15 -1
  5. package/fesm2022/daffodil-product-composite-driver-in-memory.mjs +4 -4
  6. package/fesm2022/daffodil-product-composite-driver-in-memory.mjs.map +1 -1
  7. package/fesm2022/daffodil-product-composite-driver-magento-testing.mjs +9 -9
  8. package/fesm2022/daffodil-product-composite-driver-magento-testing.mjs.map +1 -1
  9. package/fesm2022/daffodil-product-composite-driver-magento.mjs +10 -10
  10. package/fesm2022/daffodil-product-composite-driver-magento.mjs.map +1 -1
  11. package/fesm2022/daffodil-product-composite-driver-testing.mjs +4 -4
  12. package/fesm2022/daffodil-product-composite-driver-testing.mjs.map +1 -1
  13. package/fesm2022/daffodil-product-composite-routing.mjs +11 -12
  14. package/fesm2022/daffodil-product-composite-routing.mjs.map +1 -1
  15. package/fesm2022/daffodil-product-composite-state-testing.mjs +7 -7
  16. package/fesm2022/daffodil-product-composite-state-testing.mjs.map +1 -1
  17. package/fesm2022/daffodil-product-composite-state.mjs +7 -7
  18. package/fesm2022/daffodil-product-composite-state.mjs.map +1 -1
  19. package/fesm2022/daffodil-product-composite-testing.mjs +9 -9
  20. package/fesm2022/daffodil-product-composite-testing.mjs.map +1 -1
  21. package/fesm2022/daffodil-product-composite.mjs.map +1 -1
  22. package/index.d.ts +88 -1
  23. package/package.json +1 -1
  24. package/routing/index.d.ts +75 -1
  25. package/state/index.d.ts +321 -1
  26. package/state/testing/index.d.ts +32 -1
  27. package/testing/index.d.ts +64 -1
  28. package/driver/in-memory/in-memory.module.d.ts +0 -12
  29. package/driver/in-memory/public_api.d.ts +0 -1
  30. package/driver/magento/composite-product-driver.module.d.ts +0 -12
  31. package/driver/magento/fragments/bundled-product.d.ts +0 -2
  32. package/driver/magento/injection-tokens/fragments/item.token.d.ts +0 -2
  33. package/driver/magento/injection-tokens/fragments/option.token.d.ts +0 -2
  34. package/driver/magento/injection-tokens/public_api.d.ts +0 -4
  35. package/driver/magento/injection-tokens/transforms/item/extra.token.d.ts +0 -21
  36. package/driver/magento/injection-tokens/transforms/item/token.d.ts +0 -2
  37. package/driver/magento/injection-tokens/transforms/option/extra.token.d.ts +0 -21
  38. package/driver/magento/injection-tokens/transforms/option/token.d.ts +0 -2
  39. package/driver/magento/interfaces/item-extra-transform.type.d.ts +0 -3
  40. package/driver/magento/interfaces/item-transform.type.d.ts +0 -3
  41. package/driver/magento/interfaces/option-extra-transform.type.d.ts +0 -3
  42. package/driver/magento/interfaces/option-transform.type.d.ts +0 -3
  43. package/driver/magento/interfaces/public_api.d.ts +0 -4
  44. package/driver/magento/models/bundled-product.d.ts +0 -39
  45. package/driver/magento/models/public_api.d.ts +0 -1
  46. package/driver/magento/public_api.d.ts +0 -6
  47. package/driver/magento/testing/factories/bundle/bundle-item-option.factory.d.ts +0 -24
  48. package/driver/magento/testing/factories/bundle/bundle-item.factory.d.ts +0 -22
  49. package/driver/magento/testing/factories/bundle/bundle.factory.d.ts +0 -21
  50. package/driver/magento/testing/factories/public_api.d.ts +0 -3
  51. package/driver/magento/testing/public_api.d.ts +0 -1
  52. package/driver/magento/transforms/item-transformer.service.d.ts +0 -11
  53. package/driver/magento/transforms/option.d.ts +0 -3
  54. package/driver/magento/transforms/product-transformer.service.d.ts +0 -17
  55. package/driver/magento/transforms/public_api.d.ts +0 -3
  56. package/driver/testing/public_api.d.ts +0 -1
  57. package/driver/testing/testing.module.d.ts +0 -12
  58. package/helpers/build-selection-payload.d.ts +0 -2
  59. package/helpers/public_api.d.ts +0 -1
  60. package/models/composite-configuration-item.d.ts +0 -14
  61. package/models/composite-product-item.d.ts +0 -48
  62. package/models/composite-product.d.ts +0 -16
  63. package/models/public_api.d.ts +0 -4
  64. package/models/selection-payload.type.d.ts +0 -5
  65. package/public_api.d.ts +0 -2
  66. package/routing/config/default.d.ts +0 -8
  67. package/routing/config/interface.d.ts +0 -20
  68. package/routing/config/public_api.d.ts +0 -3
  69. package/routing/config/token.d.ts +0 -2
  70. package/routing/effects/product-page.effects.d.ts +0 -22
  71. package/routing/effects/public_api.d.ts +0 -1
  72. package/routing/module.d.ts +0 -10
  73. package/routing/public_api.d.ts +0 -3
  74. package/routing/services/query-param.service.d.ts +0 -13
  75. package/state/actions/composite-product.actions.d.ts +0 -24
  76. package/state/actions/public_api.d.ts +0 -1
  77. package/state/composite-product-state.module.d.ts +0 -10
  78. package/state/facades/composite-product/composite-product-facade.interface.d.ts +0 -73
  79. package/state/facades/composite-product/composite-product.facade.d.ts +0 -31
  80. package/state/facades/public_api.d.ts +0 -2
  81. package/state/helpers/ensure-items.d.ts +0 -7
  82. package/state/helpers/public_api.d.ts +0 -1
  83. package/state/public_api.d.ts +0 -6
  84. package/state/reducers/composite-product-entities/composite-product-entities-reducer-adapter.d.ts +0 -49
  85. package/state/reducers/composite-product-entities/composite-product-entities.reducer.d.ts +0 -14
  86. package/state/reducers/composite-product-entities/composite-product-entity.d.ts +0 -16
  87. package/state/reducers/composite-product-reducers-state.interface.d.ts +0 -14
  88. package/state/reducers/composite-product-reducers.d.ts +0 -6
  89. package/state/reducers/composite-product-store-feature-key.d.ts +0 -1
  90. package/state/reducers/ensure-items.meta-reducer.d.ts +0 -6
  91. package/state/reducers/injection-tokens/extra.token.d.ts +0 -3
  92. package/state/reducers/injection-tokens/public_api.d.ts +0 -1
  93. package/state/reducers/injection-tokens/reducers.token.d.ts +0 -3
  94. package/state/reducers/public_api.d.ts +0 -7
  95. package/state/selectors/all.selector.d.ts +0 -13
  96. package/state/selectors/composite-product/composite-product.selectors.d.ts +0 -38
  97. package/state/selectors/composite-product-entities/composite-product-entities.selectors.d.ts +0 -45
  98. package/state/selectors/feature.selector.d.ts +0 -12
  99. package/state/selectors/public_api.d.ts +0 -4
  100. package/state/testing/mock-composite-product-facade.d.ts +0 -23
  101. package/state/testing/product-testing.module.d.ts +0 -6
  102. package/state/testing/public_api.d.ts +0 -2
  103. package/testing/factories/composite-product-item-option.factory.d.ts +0 -19
  104. package/testing/factories/composite-product-item.factory.d.ts +0 -25
  105. package/testing/factories/composite-product.factory.d.ts +0 -23
  106. package/testing/factories/public_api.d.ts +0 -3
  107. package/testing/public_api.d.ts +0 -1
@@ -1,73 +0,0 @@
1
- import { Dictionary } from '@ngrx/entity';
2
- import { Action } from '@ngrx/store';
3
- import { Observable } from 'rxjs';
4
- import { DaffStoreFacade } from '@daffodil/core/state';
5
- import { DaffPriceRange } from '@daffodil/product';
6
- import { DaffCompositeProductItemOption, DaffCompositeProductItem, DaffCompositeConfigurationItem, DaffCompositeProduct } from '@daffodil/product-composite';
7
- /**
8
- * A facade for interacting with the composite product state.
9
- * Exposes many parts of the state for easy access and allows dispatching of actions.
10
- */
11
- export interface DaffCompositeProductFacadeInterface extends DaffStoreFacade<Action> {
12
- /**
13
- * Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.
14
- *
15
- * @param id an id for a composite product
16
- * @param configuration a Dictionary of DaffCompositeConfigurationItems
17
- */
18
- getRequiredItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange>;
19
- /**
20
- * Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.
21
- *
22
- * @param id the id of the composite product.
23
- * @param configuration a Dictionary of DaffCompositeConfigurationItems
24
- */
25
- getOptionalItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange>;
26
- /**
27
- * Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and
28
- * excluding unselected, optional item prices.
29
- *
30
- * @param id the id of the composite product.
31
- */
32
- getPricesAsCurrentlyConfigured(id: DaffCompositeProduct['id']): Observable<DaffPriceRange>;
33
- /**
34
- * Returns the applied options for a composite product.
35
- *
36
- * @param id the id of the composite product.
37
- */
38
- getAppliedOptions(id: DaffCompositeProduct['id']): Observable<Dictionary<DaffCompositeProductItemOption>>;
39
- /**
40
- * Returns whether the item of a composite product is required.
41
- *
42
- * @param id the id of the composite product.
43
- * @param item_id the id of the item_id.
44
- */
45
- isItemRequired(id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']): Observable<boolean>;
46
- /**
47
- * Returns whether a DaffPriceRange has a discount.
48
- *
49
- * @param priceRange a DaffPriceRange
50
- */
51
- hasDiscount(priceRange: DaffPriceRange): boolean;
52
- /**
53
- * Returns the discount amount of a composite product based on the current configuration of the selected item options in redux
54
- * state and excluding unselected, optional item prices. Will return undefined if all required options are not chosen.
55
- *
56
- * @param id the id of the composite product.
57
- */
58
- getDiscountAmount(id: DaffCompositeProduct['id']): Observable<number>;
59
- /**
60
- * Returns the discount percent of a composite product based on the current configuration of the selected item options in redux
61
- * state and excluding unselected, optional item prices. Will return undefined if all required options are not chosen.
62
- * Note: This percent is computed client-side and should be treated as an estimate rather than an exact value.
63
- *
64
- * @param id the id of the composite product.
65
- */
66
- getDiscountPercent(id: DaffCompositeProduct['id']): Observable<number>;
67
- /**
68
- * Returns whether the min and max prices of a DaffPriceRange are different.
69
- *
70
- * @param priceRange a DaffPriceRange
71
- */
72
- hasPriceRange(priceRange: DaffPriceRange): boolean;
73
- }
@@ -1,31 +0,0 @@
1
- import { Dictionary } from '@ngrx/entity';
2
- import { Store, Action } from '@ngrx/store';
3
- import { Observable } from 'rxjs';
4
- import { DaffProduct, DaffPriceRange } from '@daffodil/product';
5
- import { DaffCompositeConfigurationItem, DaffCompositeProductItemOption, DaffCompositeProductItem } from '@daffodil/product-composite';
6
- import { DaffCompositeProductFacadeInterface } from './composite-product-facade.interface';
7
- import { DaffCompositeProductStateRootSlice } from '../../reducers/composite-product-reducers-state.interface';
8
- import * as i0 from "@angular/core";
9
- /**
10
- * A facade for interacting with the composite product state.
11
- * Exposes many parts of the state for easy access and allows dispatching of actions.
12
- *
13
- * @inheritdoc
14
- */
15
- export declare class DaffCompositeProductFacade<T extends DaffProduct = DaffProduct> implements DaffCompositeProductFacadeInterface {
16
- private store;
17
- constructor(store: Store<DaffCompositeProductStateRootSlice<T>>);
18
- compositeProductSelectors: import("../../selectors/all.selector").DaffCompositeProductAllSelectors<T>;
19
- hasDiscount: (priceRange: DaffPriceRange) => boolean;
20
- hasPriceRange: (priceRange: DaffPriceRange) => boolean;
21
- getRequiredItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange>;
22
- getOptionalItemPricesForConfiguration(id: T['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): Observable<DaffPriceRange>;
23
- getPricesAsCurrentlyConfigured(id: T['id']): Observable<DaffPriceRange>;
24
- getAppliedOptions(id: T['id']): Observable<Dictionary<DaffCompositeProductItemOption>>;
25
- getDiscountAmount(id: T['id']): Observable<number>;
26
- getDiscountPercent(id: T['id']): Observable<number>;
27
- isItemRequired(id: T['id'], item_id: DaffCompositeProductItem['id']): Observable<boolean>;
28
- dispatch(action: Action): void;
29
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductFacade<any>, never>;
30
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductFacade<any>>;
31
- }
@@ -1,2 +0,0 @@
1
- export { DaffCompositeProductFacadeInterface } from './composite-product/composite-product-facade.interface';
2
- export { DaffCompositeProductFacade } from './composite-product/composite-product.facade';
@@ -1,7 +0,0 @@
1
- import { DaffProductReducersState } from '@daffodil/product/state';
2
- import { DaffCompositeProduct } from '@daffodil/product-composite';
3
- /**
4
- * Maps a list of products, ensuring that the composite products have a list of items.
5
- * If the incoming items is empty or nully, the items from state are intentionally used instead.
6
- */
7
- export declare function daffProductCompositeEnsureItems<T extends DaffCompositeProduct = DaffCompositeProduct>(state: DaffProductReducersState<T>, products: T[]): T[];
@@ -1 +0,0 @@
1
- export { daffProductCompositeEnsureItems } from './ensure-items';
@@ -1,6 +0,0 @@
1
- export * from './actions/public_api';
2
- export * from './facades/public_api';
3
- export * from './reducers/public_api';
4
- export * from './selectors/public_api';
5
- export * from './helpers/public_api';
6
- export { DaffCompositeProductStateModule } from './composite-product-state.module';
@@ -1,49 +0,0 @@
1
- import { EntityState } from '@ngrx/entity';
2
- import { DaffCompositeProduct, DaffCompositeProductItem, DaffCompositeProductItemOption } from '@daffodil/product-composite';
3
- import { DaffCompositeProductEntity } from './composite-product-entity';
4
- /**
5
- * Composite Product Item Options Adapter for changing/overwriting entity state.
6
- */
7
- export declare class DaffCompositeProductAppliedOptionsEntitiesAdapter<T extends EntityState<DaffCompositeProductEntity> = EntityState<DaffCompositeProductEntity>> {
8
- /**
9
- * @docs-private
10
- */
11
- private _adapter;
12
- /**
13
- * Gets the initial entity state.
14
- */
15
- getInitialState(): EntityState<DaffCompositeProductEntity>;
16
- /**
17
- * Get the entity selectors.
18
- */
19
- getSelectors(): import("@ngrx/entity/src/models").EntitySelectors<DaffCompositeProductEntity, EntityState<DaffCompositeProductEntity>>;
20
- /**
21
- * Upserts the given composite products into state.
22
- */
23
- upsertProducts(state: T, ...products: DaffCompositeProduct[]): T;
24
- /**
25
- * Apply the specified option for the given composite product item.
26
- */
27
- applyOption(state: T, productId: DaffCompositeProduct['id'], itemId: DaffCompositeProductItem['id'], optionId: DaffCompositeProductItemOption['id'], qty?: number): T;
28
- /**
29
- * @docs-private
30
- */
31
- private mapOptionsEntities;
32
- /**
33
- * @docs-private
34
- */
35
- private buildCompositeProductAppliedOptionsEntity;
36
- /**
37
- * Sets the default item option to the specified default option if it is in stock.
38
- * Does not set a default option if a default is not specified.
39
- * Does not set a default option but does set a default qty if the default is out of stock.
40
- *
41
- * @param item a DaffCompositeProductItem
42
- * @docs-private
43
- */
44
- private getDefaultOption;
45
- }
46
- /**
47
- * Gets the composite product entity adapter singleton.
48
- */
49
- export declare const daffCompositeProductAppliedOptionsEntitiesAdapter: () => DaffCompositeProductAppliedOptionsEntitiesAdapter;
@@ -1,14 +0,0 @@
1
- import { EntityState } from '@ngrx/entity';
2
- import { DaffProduct } from '@daffodil/product';
3
- import { DaffProductPageActions, DaffProductGridActions, DaffProductActions } from '@daffodil/product/state';
4
- import { DaffCompositeProduct } from '@daffodil/product-composite';
5
- import { DaffCompositeProductEntity } from './composite-product-entity';
6
- import { DaffCompositeProductActions } from '../../actions/public_api';
7
- /**
8
- * Reducer function that catches actions and changes/overwrites composite product entities state.
9
- *
10
- * @param state current State of the redux store
11
- * @param action ProductGrid, BestSellers, Product, or Composite Product actions
12
- * @returns Product entities state
13
- */
14
- export declare function daffCompositeProductEntitiesReducer<T extends DaffProduct, V extends DaffCompositeProduct>(state: EntityState<DaffCompositeProductEntity>, action: DaffProductGridActions<T> | DaffProductActions<T> | DaffProductPageActions<T> | DaffCompositeProductActions<V>): EntityState<DaffCompositeProductEntity>;
@@ -1,16 +0,0 @@
1
- import { Dictionary } from '@ngrx/entity';
2
- import { DaffProduct } from '@daffodil/product';
3
- import { DaffCompositeConfigurationItem } from '@daffodil/product-composite';
4
- /**
5
- * Describes how composite product configurations are stored in rxjs entity state.
6
- */
7
- export interface DaffCompositeProductEntity {
8
- /**
9
- * The id of the composite product.
10
- */
11
- id: DaffProduct['id'];
12
- /**
13
- * A dictionary of the configurations set for a composite product.
14
- */
15
- items: Dictionary<DaffCompositeConfigurationItem>;
16
- }
@@ -1,14 +0,0 @@
1
- import { EntityState } from '@ngrx/entity';
2
- import { DaffProduct } from '@daffodil/product';
3
- import { DaffProductStateRootSlice } from '@daffodil/product/state';
4
- import { DaffCompositeProductEntity } from './composite-product-entities/composite-product-entity';
5
- import { DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY } from './composite-product-store-feature-key';
6
- /**
7
- * Interface for the redux store of the composite product feature area.
8
- */
9
- export interface DaffCompositeProductReducersState {
10
- compositeProductOptions: EntityState<DaffCompositeProductEntity>;
11
- }
12
- export interface DaffCompositeProductStateRootSlice<T extends DaffProduct = DaffProduct> extends DaffProductStateRootSlice<T> {
13
- [DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY]: DaffCompositeProductReducersState;
14
- }
@@ -1,6 +0,0 @@
1
- import { ActionReducerMap } from '@ngrx/store';
2
- import { DaffCompositeProductReducersState } from './composite-product-reducers-state.interface';
3
- /**
4
- * Returns state values from all composite product related reducers.
5
- */
6
- export declare const daffCompositeProductReducers: ActionReducerMap<DaffCompositeProductReducersState>;
@@ -1 +0,0 @@
1
- export declare const DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY = "daffCompositeProduct";
@@ -1,6 +0,0 @@
1
- import { ActionReducer } from '@ngrx/store';
2
- import { DaffProductActions, DaffProductPageActions, DaffProductReducersState } from '@daffodil/product/state';
3
- import { DaffCompositeProduct } from '@daffodil/product-composite';
4
- type Reducer = ActionReducer<DaffProductReducersState<DaffCompositeProduct>, DaffProductActions<DaffCompositeProduct> | DaffProductPageActions<DaffCompositeProduct>>;
5
- export declare function daffProductCompositeEnsureItemsMetaReducer(reducer: Reducer): Reducer;
6
- export {};
@@ -1,3 +0,0 @@
1
- import { ActionReducer } from '@ngrx/store';
2
- import { DaffCompositeProductReducersState } from '../composite-product-reducers-state.interface';
3
- export declare const DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS: import("@angular/core").InjectionToken<ActionReducer<DaffCompositeProductReducersState, import("@ngrx/store").Action<string>>[]>, daffProductCompositeProvideExtraReducers: <R extends ActionReducer<DaffCompositeProductReducersState, import("@ngrx/store").Action<string>> = ActionReducer<DaffCompositeProductReducersState, import("@ngrx/store").Action<string>>>(...values: R[]) => Array<import("@angular/core").ValueProvider>;
@@ -1 +0,0 @@
1
- export { daffProductCompositeProvideExtraReducers, DAFF_PRODUCT_COMPOSITE_EXTRA_REDUCERS, } from './extra.token';
@@ -1,3 +0,0 @@
1
- import { ActionReducer } from '@ngrx/store';
2
- import { DaffCompositeProductReducersState } from '../composite-product-reducers-state.interface';
3
- export declare const DAFF_PRODUCT_COMPOSITE_REDUCERS: import("@angular/core").InjectionToken<ActionReducer<DaffCompositeProductReducersState, import("@ngrx/store").Action<string>>>, provideDaffProductCompositeReducers: <R extends ActionReducer<DaffCompositeProductReducersState, import("@ngrx/store").Action<string>> = ActionReducer<DaffCompositeProductReducersState, import("@ngrx/store").Action<string>>>(value: R) => import("@angular/core").ValueProvider;
@@ -1,7 +0,0 @@
1
- export { daffCompositeProductReducers } from './composite-product-reducers';
2
- export { DaffCompositeProductReducersState, DaffCompositeProductStateRootSlice, } from './composite-product-reducers-state.interface';
3
- export { DaffCompositeProductEntity } from './composite-product-entities/composite-product-entity';
4
- export { daffCompositeProductAppliedOptionsEntitiesAdapter, DaffCompositeProductAppliedOptionsEntitiesAdapter, } from './composite-product-entities/composite-product-entities-reducer-adapter';
5
- export { DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY } from './composite-product-store-feature-key';
6
- export * from './composite-product-entities/composite-product-entity';
7
- export * from './injection-tokens/public_api';
@@ -1,13 +0,0 @@
1
- import { DaffProduct } from '@daffodil/product';
2
- import { DaffCompositeProductMemoizedSelectors } from './composite-product/composite-product.selectors';
3
- import { DaffCompositeProductEntitiesMemoizedSelectors } from './composite-product-entities/composite-product-entities.selectors';
4
- /**
5
- * An interface for all selectors in the composite product feature area.
6
- */
7
- export interface DaffCompositeProductAllSelectors<T extends DaffProduct = DaffProduct> extends DaffCompositeProductEntitiesMemoizedSelectors<T>, DaffCompositeProductMemoizedSelectors<T> {
8
- }
9
- /**
10
- * A function that returns all selectors in the composite product feature area.
11
- * Returns {@link DaffCompositeProductAllSelectors}.
12
- */
13
- export declare const getDaffCompositeProductSelectors: <T extends DaffProduct>() => DaffCompositeProductAllSelectors<T>;
@@ -1,38 +0,0 @@
1
- import { Dictionary } from '@ngrx/entity';
2
- import { MemoizedSelector } from '@ngrx/store';
3
- import { DaffProduct, DaffPriceRange } from '@daffodil/product';
4
- import { DaffCompositeProduct, DaffCompositeConfigurationItem } from '@daffodil/product-composite';
5
- import { DaffCompositeProductStateRootSlice } from '../../reducers/composite-product-reducers-state.interface';
6
- /**
7
- * An interface describing selectors unique to the composite product, such as pricing and discounts.
8
- */
9
- export interface DaffCompositeProductMemoizedSelectors<T extends DaffProduct = DaffProduct> {
10
- /**
11
- * Get a DaffPriceRange for a composite product based on the configuration provided excluding unselected, optional item prices.
12
- */
13
- selectCompositeProductRequiredItemPricesForConfiguration: (id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;
14
- /**
15
- * Get the broadest possible DaffPriceRange for a composite product based on the configuration provided including optional item prices.
16
- */
17
- selectCompositeProductOptionalItemPricesForConfiguration: (id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;
18
- /**
19
- * Get the DaffPriceRange for a composite product based on the current configuration of selected item options in redux state and
20
- * excluding unselected, optional item prices.
21
- */
22
- selectCompositeProductPricesAsCurrentlyConfigured: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, DaffPriceRange>;
23
- /**
24
- * Get the discount amount for a composite product. This value will be undefined if all required options are not chosen.
25
- */
26
- selectCompositeProductDiscountAmount: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;
27
- /**
28
- * Get the discount percent for a composite product. This value will be undefined if all required options are not chosen.
29
- * Note: this percent is computed client-side and should be treated as an estimate rather than an exact value.
30
- */
31
- selectCompositeProductDiscountPercent: (id: DaffCompositeProduct['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;
32
- }
33
- /**
34
- * A function that returns all selectors related to the composite product feature.
35
- *
36
- * Returns {@link DaffCompositeProductMemoizedSelectors}.
37
- */
38
- export declare const getDaffCompositeProductPriceSelectors: <T extends DaffProduct = DaffProduct>() => DaffCompositeProductMemoizedSelectors<T>;
@@ -1,45 +0,0 @@
1
- import { EntityState, Dictionary } from '@ngrx/entity';
2
- import { MemoizedSelector } from '@ngrx/store';
3
- import { DaffProduct } from '@daffodil/product';
4
- import { DaffCompositeProductItemOption, DaffCompositeProductItem } from '@daffodil/product-composite';
5
- import { DaffCompositeProductEntity } from '../../reducers/composite-product-entities/composite-product-entity';
6
- import { DaffCompositeProductStateRootSlice } from '../../reducers/composite-product-reducers-state.interface';
7
- /**
8
- * An interface for selectors related to the composite product applied options.
9
- */
10
- export interface DaffCompositeProductEntitiesMemoizedSelectors<T extends DaffProduct = DaffProduct> {
11
- /**
12
- * The ngrx entities state for composite product applied options.
13
- */
14
- selectCompositeProductAppliedOptionsEntitiesState: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>>;
15
- /**
16
- * A selector for all composite product ids in state.
17
- */
18
- selectCompositeProductIds: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>['ids']>;
19
- /**
20
- * The ngrx entities for the composite product appllied options.
21
- */
22
- selectCompositeProductAppliedOptionsEntities: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, EntityState<DaffCompositeProductEntity>['entities']>;
23
- /**
24
- * The total number of composite products in state.
25
- */
26
- selectCompositeProductTotal: MemoizedSelector<DaffCompositeProductStateRootSlice<T>, number>;
27
- /**
28
- * Selects the applied options for a composite product.
29
- *
30
- * @param id the id of the composite product.
31
- */
32
- selectCompositeProductAppliedOptions: (id: T['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, Dictionary<DaffCompositeProductItemOption>>;
33
- /**
34
- * Selects whether the particular item of a composite product is required in order for the product to be valid, i.e. addable to the cart.
35
- *
36
- * @param id the id of the composite product.
37
- * @param item_id the id of the composite product item.
38
- */
39
- selectIsCompositeProductItemRequired: (id: T['id'], item_id: DaffCompositeProductItem['id']) => MemoizedSelector<DaffCompositeProductStateRootSlice<T>, boolean>;
40
- }
41
- /**
42
- * A function that returns all selectors related to composite product applied option entities.
43
- * Returns {@link DaffCompositeProductEntitiesMemoizedSelectors}.
44
- */
45
- export declare const getDaffCompositeProductEntitiesSelectors: <T extends DaffProduct>() => DaffCompositeProductEntitiesMemoizedSelectors<T>;
@@ -1,12 +0,0 @@
1
- import { MemoizedSelector } from '@ngrx/store';
2
- import { DaffCompositeProductReducersState } from '../reducers/composite-product-reducers-state.interface';
3
- /**
4
- * An interface for the composite product feature state.
5
- */
6
- export interface DaffCompositeProductFeatureMemoizedSelector {
7
- selectCompositeProductState: MemoizedSelector<Record<string, any>, DaffCompositeProductReducersState>;
8
- }
9
- /**
10
- * A function that returns a selector for the composite product feature state.
11
- */
12
- export declare const getDaffCompositeProductFeatureSelector: () => DaffCompositeProductFeatureMemoizedSelector;
@@ -1,4 +0,0 @@
1
- export * from './all.selector';
2
- export * from './composite-product/composite-product.selectors';
3
- export * from './composite-product-entities/composite-product-entities.selectors';
4
- export * from './feature.selector';
@@ -1,23 +0,0 @@
1
- import { Dictionary } from '@ngrx/entity';
2
- import { BehaviorSubject } from 'rxjs';
3
- import { DaffPriceRange } from '@daffodil/product';
4
- import { DaffCompositeProductItemOption, DaffCompositeProduct, DaffCompositeProductItem, DaffCompositeConfigurationItem } from '@daffodil/product-composite';
5
- import { DaffCompositeProductFacadeInterface } from '@daffodil/product-composite/state';
6
- import * as i0 from "@angular/core";
7
- /**
8
- * @inheritdoc
9
- */
10
- export declare class MockDaffCompositeProductFacade implements DaffCompositeProductFacadeInterface {
11
- getRequiredItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): BehaviorSubject<DaffPriceRange>;
12
- getOptionalItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): BehaviorSubject<DaffPriceRange>;
13
- getPricesAsCurrentlyConfigured(id: DaffCompositeProduct['id']): BehaviorSubject<DaffPriceRange>;
14
- getAppliedOptions(id: DaffCompositeProduct['id']): BehaviorSubject<Dictionary<DaffCompositeProductItemOption>>;
15
- getDiscountAmount(id: DaffCompositeProduct['id']): BehaviorSubject<number>;
16
- getDiscountPercent(id: DaffCompositeProduct['id']): BehaviorSubject<number>;
17
- isItemRequired(id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']): BehaviorSubject<boolean>;
18
- dispatch(action: any): void;
19
- hasDiscount(priceRange: DaffPriceRange): boolean;
20
- hasPriceRange(priceRange: DaffPriceRange): boolean;
21
- static ɵfac: i0.ɵɵFactoryDeclaration<MockDaffCompositeProductFacade, never>;
22
- static ɵprov: i0.ɵɵInjectableDeclaration<MockDaffCompositeProductFacade>;
23
- }
@@ -1,6 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class DaffCompositeProductStateTestingModule {
3
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductStateTestingModule, never>;
4
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffCompositeProductStateTestingModule, never, never, never>;
5
- static ɵinj: i0.ɵɵInjectorDeclaration<DaffCompositeProductStateTestingModule>;
6
- }
@@ -1,2 +0,0 @@
1
- export { MockDaffCompositeProductFacade } from './mock-composite-product-facade';
2
- export { DaffCompositeProductStateTestingModule } from './product-testing.module';
@@ -1,19 +0,0 @@
1
- import { DaffModelFactory } from '@daffodil/core/testing';
2
- import { DaffProductImageFactory, MockProduct } from '@daffodil/product/testing';
3
- import { DaffCompositeProductItemOption } from '@daffodil/product-composite';
4
- import * as i0 from "@angular/core";
5
- /**
6
- * Mocked DaffCompositeProductItemOption object.
7
- */
8
- export declare class MockCompositeProductItemOption extends MockProduct implements DaffCompositeProductItemOption {
9
- quantity: number;
10
- is_default: boolean;
11
- }
12
- /**
13
- * Factory for creating DaffCompositeProductItemOptions.
14
- */
15
- export declare class DaffCompositeProductItemOptionFactory extends DaffModelFactory<DaffCompositeProductItemOption> {
16
- constructor(imageFactory: DaffProductImageFactory);
17
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductItemOptionFactory, never>;
18
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductItemOptionFactory>;
19
- }
@@ -1,25 +0,0 @@
1
- import { DaffModelFactory } from '@daffodil/core/testing';
2
- import { DaffCompositeProductItem, DaffCompositeProductItemInputEnum } from '@daffodil/product-composite';
3
- import { DaffCompositeProductItemOptionFactory } from './composite-product-item-option.factory';
4
- import * as i0 from "@angular/core";
5
- /**
6
- * Mocked DaffCompositeProductItem object.
7
- */
8
- export declare class MockCompositeProductItem implements DaffCompositeProductItem {
9
- protected optionFactory: DaffCompositeProductItemOptionFactory;
10
- id: string;
11
- url: string;
12
- required: boolean;
13
- title: string;
14
- input_type: DaffCompositeProductItemInputEnum;
15
- options: import("@daffodil/product-composite").DaffCompositeProductItemOption[];
16
- constructor(optionFactory: DaffCompositeProductItemOptionFactory);
17
- }
18
- /**
19
- * Factory for creating DaffCompositeProductItems.
20
- */
21
- export declare class DaffCompositeProductItemFactory extends DaffModelFactory<DaffCompositeProductItem> {
22
- constructor(optionFactory: DaffCompositeProductItemOptionFactory);
23
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductItemFactory, never>;
24
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductItemFactory>;
25
- }
@@ -1,23 +0,0 @@
1
- import { DaffModelFactory } from '@daffodil/core/testing';
2
- import { DaffProductTypeEnum } from '@daffodil/product';
3
- import { DaffProductImageFactory, MockProduct } from '@daffodil/product/testing';
4
- import { DaffCompositeProduct } from '@daffodil/product-composite';
5
- import { DaffCompositeProductItemFactory } from './composite-product-item.factory';
6
- import * as i0 from "@angular/core";
7
- /**
8
- * Mocked DaffCompositeProduct object.
9
- */
10
- export declare class MockCompositeProduct extends MockProduct implements DaffCompositeProduct {
11
- protected itemFactory: DaffCompositeProductItemFactory;
12
- type: DaffProductTypeEnum;
13
- items: import("@daffodil/product-composite").DaffCompositeProductItem[];
14
- constructor(itemFactory: DaffCompositeProductItemFactory, imageFactory: DaffProductImageFactory);
15
- }
16
- /**
17
- * Factory for creating DaffCompositeProducts.
18
- */
19
- export declare class DaffCompositeProductFactory extends DaffModelFactory<DaffCompositeProduct> {
20
- constructor(itemFactory: DaffCompositeProductItemFactory, imageFactory: DaffProductImageFactory);
21
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductFactory, never>;
22
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductFactory>;
23
- }
@@ -1,3 +0,0 @@
1
- export * from './composite-product.factory';
2
- export * from './composite-product-item.factory';
3
- export * from './composite-product-item-option.factory';
@@ -1 +0,0 @@
1
- export * from './factories/public_api';