@daffodil/product-composite 0.58.10 → 0.59.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 (56) hide show
  1. package/esm2020/helpers/build-selection-payload.mjs +10 -0
  2. package/esm2020/helpers/public_api.mjs +2 -0
  3. package/esm2020/models/public_api.mjs +5 -0
  4. package/esm2020/models/selection-payload.type.mjs +2 -0
  5. package/esm2020/public_api.mjs +3 -4
  6. package/esm2020/routing/config/default.mjs +8 -0
  7. package/esm2020/routing/config/interface.mjs +2 -0
  8. package/esm2020/routing/config/public_api.mjs +3 -0
  9. package/esm2020/routing/config/token.mjs +22 -0
  10. package/esm2020/routing/daffodil-product-composite-routing.mjs +5 -0
  11. package/esm2020/routing/effects/product-page.effects.mjs +73 -0
  12. package/esm2020/routing/effects/public_api.mjs +2 -0
  13. package/esm2020/routing/index.mjs +2 -0
  14. package/esm2020/routing/module.mjs +37 -0
  15. package/esm2020/routing/public_api.mjs +4 -0
  16. package/esm2020/state/actions/composite-product.actions.mjs +1 -1
  17. package/esm2020/testing/factories/composite-product-item-option.factory.mjs +32 -0
  18. package/esm2020/testing/factories/composite-product-item.factory.mjs +45 -0
  19. package/esm2020/testing/factories/composite-product.factory.mjs +11 -103
  20. package/esm2020/testing/factories/public_api.mjs +3 -1
  21. package/fesm2015/daffodil-product-composite-routing.mjs +133 -0
  22. package/fesm2015/daffodil-product-composite-routing.mjs.map +1 -0
  23. package/fesm2015/daffodil-product-composite-state.mjs.map +1 -1
  24. package/fesm2015/daffodil-product-composite-testing.mjs +76 -103
  25. package/fesm2015/daffodil-product-composite-testing.mjs.map +1 -1
  26. package/fesm2015/daffodil-product-composite.mjs +11 -1
  27. package/fesm2015/daffodil-product-composite.mjs.map +1 -1
  28. package/fesm2020/daffodil-product-composite-routing.mjs +136 -0
  29. package/fesm2020/daffodil-product-composite-routing.mjs.map +1 -0
  30. package/fesm2020/daffodil-product-composite-state.mjs.map +1 -1
  31. package/fesm2020/daffodil-product-composite-testing.mjs +76 -103
  32. package/fesm2020/daffodil-product-composite-testing.mjs.map +1 -1
  33. package/fesm2020/daffodil-product-composite.mjs +11 -1
  34. package/fesm2020/daffodil-product-composite.mjs.map +1 -1
  35. package/helpers/build-selection-payload.d.ts +2 -0
  36. package/helpers/public_api.d.ts +1 -0
  37. package/models/public_api.d.ts +4 -0
  38. package/models/selection-payload.type.d.ts +5 -0
  39. package/package.json +13 -5
  40. package/public_api.d.ts +2 -3
  41. package/routing/config/default.d.ts +6 -0
  42. package/routing/config/interface.d.ts +20 -0
  43. package/routing/config/public_api.d.ts +3 -0
  44. package/routing/config/token.d.ts +10 -0
  45. package/routing/daffodil-product-composite-routing.d.ts +5 -0
  46. package/routing/effects/product-page.effects.d.ts +26 -0
  47. package/routing/effects/public_api.d.ts +1 -0
  48. package/routing/index.d.ts +1 -0
  49. package/routing/module.d.ts +10 -0
  50. package/routing/package.json +10 -0
  51. package/routing/public_api.d.ts +3 -0
  52. package/state/actions/composite-product.actions.d.ts +1 -1
  53. package/testing/factories/composite-product-item-option.factory.d.ts +19 -0
  54. package/testing/factories/composite-product-item.factory.d.ts +25 -0
  55. package/testing/factories/composite-product.factory.d.ts +6 -29
  56. package/testing/factories/public_api.d.ts +2 -0
@@ -0,0 +1,5 @@
1
+ import { DaffCompositeProductItem, DaffCompositeProductItemOption } from './composite-product-item';
2
+ /**
3
+ * Denotes a particular configuration for a composite item.
4
+ */
5
+ export declare type DaffProductCompositeSelectionPayload = Record<DaffCompositeProductItem['id'], DaffCompositeProductItemOption['id'][]>;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  }
11
11
  },
12
- "version": "0.58.10",
12
+ "version": "0.59.0",
13
13
  "description": "Interfaces built for daffodil/state",
14
14
  "repository": {
15
15
  "type": "git",
@@ -27,8 +27,8 @@
27
27
  "peerDependencies": {
28
28
  "@angular/common": "^13.0.0",
29
29
  "@angular/core": "^13.0.0",
30
- "@daffodil/core": "0.58.10",
31
- "@daffodil/product": "0.58.10",
30
+ "@daffodil/core": "0.59.0",
31
+ "@daffodil/product": "0.59.0",
32
32
  "@ngrx/effects": "^13.0.0",
33
33
  "@ngrx/entity": "^13.0.0",
34
34
  "@ngrx/store": "^13.0.0",
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "optionalDependencies": {
38
38
  "@apollo/client": "^3.0.0",
39
- "@daffodil/driver": "0.58.10",
40
- "@daffodil/product": "0.58.10",
39
+ "@daffodil/driver": "0.59.0",
40
+ "@daffodil/product": "0.59.0",
41
41
  "angular-in-memory-web-api": "^0.13.0",
42
42
  "apollo-angular": "^3.0.1",
43
43
  "@faker-js/faker": "^7.6.0"
@@ -92,6 +92,14 @@
92
92
  "node": "./fesm2015/daffodil-product-composite-driver-testing.mjs",
93
93
  "default": "./fesm2020/daffodil-product-composite-driver-testing.mjs"
94
94
  },
95
+ "./routing": {
96
+ "types": "./routing/daffodil-product-composite-routing.d.ts",
97
+ "esm2020": "./esm2020/routing/daffodil-product-composite-routing.mjs",
98
+ "es2020": "./fesm2020/daffodil-product-composite-routing.mjs",
99
+ "es2015": "./fesm2015/daffodil-product-composite-routing.mjs",
100
+ "node": "./fesm2015/daffodil-product-composite-routing.mjs",
101
+ "default": "./fesm2020/daffodil-product-composite-routing.mjs"
102
+ },
95
103
  "./state": {
96
104
  "types": "./state/daffodil-product-composite-state.d.ts",
97
105
  "esm2020": "./esm2020/state/daffodil-product-composite-state.mjs",
package/public_api.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export * from './models/composite-configuration-item';
2
- export * from './models/composite-product';
3
- export * from './models/composite-product-item';
1
+ export * from './helpers/public_api';
2
+ export * from './models/public_api';
@@ -0,0 +1,6 @@
1
+ import { DaffBase64Service } from '@daffodil/core';
2
+ import { DaffProductCompositeRoutingConfig } from './interface';
3
+ /**
4
+ * The default configuration for the {@link DaffProductCompositeRoutingConfig}.
5
+ */
6
+ export declare const daffProductCompositeRoutingConfigDefaultFactory: (base64: DaffBase64Service) => DaffProductCompositeRoutingConfig;
@@ -0,0 +1,20 @@
1
+ import { DaffCompositeProduct, DaffProductCompositeSelectionPayload } from '@daffodil/product-composite';
2
+ /**
3
+ * An interface for providing `@daffodil/product-composite/routing` with necessary config values.
4
+ */
5
+ export interface DaffProductCompositeRoutingConfig {
6
+ /**
7
+ * The name of the query param for which a composite product page preselection can be defined.
8
+ * The value of this query param should be a {@link DaffProductCompositeSelectionPayload} after being base64 decoded and JSON parsed.
9
+ *
10
+ * Defaults to `composite_selection`.
11
+ */
12
+ compositeSelectionQueryParam?: string;
13
+ /**
14
+ * The function used to decode the value of the {@link DaffProductCompositeStateConfig#compositeSelectionQueryParam}
15
+ * into a {@link DaffProductCompositeSelectionPayload}.
16
+ *
17
+ * Defaults to `(queryParam: string) => JSON.parse(atob(queryParam))`.
18
+ */
19
+ compositeSelectionQueryParamDecode?: (queryParam: string, product: DaffCompositeProduct) => DaffProductCompositeSelectionPayload;
20
+ }
@@ -0,0 +1,3 @@
1
+ export { daffProductCompositeRoutingConfigDefaultFactory } from './default';
2
+ export { DaffProductCompositeRoutingConfig } from './interface';
3
+ export { DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG, daffProductCompositeRoutingProvideConfig, } from './token';
@@ -0,0 +1,10 @@
1
+ import { FactoryProvider, InjectionToken } from '@angular/core';
2
+ import { DaffProductCompositeRoutingConfig } from './interface';
3
+ /**
4
+ * The token used to provide @daffodil/product-composite/routing config data.
5
+ */
6
+ export declare const DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG: InjectionToken<DaffProductCompositeRoutingConfig>;
7
+ /**
8
+ * Provides the {@link DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG} token.
9
+ */
10
+ export declare function daffProductCompositeRoutingProvideConfig(config: Partial<DaffProductCompositeRoutingConfig>): FactoryProvider;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@daffodil/product-composite/routing" />
5
+ export * from './index';
@@ -0,0 +1,26 @@
1
+ import { ActivatedRoute } from '@angular/router';
2
+ import { Actions } from '@ngrx/effects';
3
+ import { EMPTY, Observable } from 'rxjs';
4
+ import { DaffCompositeProduct } from '@daffodil/product-composite';
5
+ import { DaffCompositeProductApplyOption } from '@daffodil/product-composite/state';
6
+ import { DaffProductCompositeRoutingConfig } from '../config/public_api';
7
+ import * as i0 from "@angular/core";
8
+ /**
9
+ * Handles composite product specific actions for the product page.
10
+ */
11
+ export declare class DaffProductCompositePageEffects<T extends DaffCompositeProduct = DaffCompositeProduct> {
12
+ private actions$;
13
+ private route;
14
+ private config;
15
+ constructor(actions$: Actions, route: ActivatedRoute, config: DaffProductCompositeRoutingConfig);
16
+ /**
17
+ * Get the value of the configured composite selection query param.
18
+ */
19
+ private getQueryParam;
20
+ /**
21
+ * Applies composite item options based on the value of the configured query param.
22
+ */
23
+ preselectCompositeOptions$: Observable<typeof EMPTY | DaffCompositeProductApplyOption<T>>;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductCompositePageEffects<any>, never>;
25
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductCompositePageEffects<any>>;
26
+ }
@@ -0,0 +1 @@
1
+ export { DaffProductCompositePageEffects } from './product-page.effects';
@@ -0,0 +1 @@
1
+ export * from './public_api';
@@ -0,0 +1,10 @@
1
+ import { ModuleWithProviders } from '@angular/core';
2
+ import { DaffProductCompositeRoutingConfig } from './config/public_api';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@ngrx/effects";
5
+ export declare class DaffProductCompositeRoutingModule {
6
+ static withConfig(config?: DaffProductCompositeRoutingConfig): ModuleWithProviders<DaffProductCompositeRoutingModule>;
7
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductCompositeRoutingModule, never>;
8
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffProductCompositeRoutingModule, never, [typeof i1.EffectsFeatureModule], never>;
9
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffProductCompositeRoutingModule>;
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@daffodil/product-composite/routing",
3
+ "module": "../fesm2015/daffodil-product-composite-routing.mjs",
4
+ "es2020": "../fesm2020/daffodil-product-composite-routing.mjs",
5
+ "esm2020": "../esm2020/routing/daffodil-product-composite-routing.mjs",
6
+ "fesm2020": "../fesm2020/daffodil-product-composite-routing.mjs",
7
+ "fesm2015": "../fesm2015/daffodil-product-composite-routing.mjs",
8
+ "typings": "daffodil-product-composite-routing.d.ts",
9
+ "sideEffects": false
10
+ }
@@ -0,0 +1,3 @@
1
+ export * from './config/public_api';
2
+ export * from './effects/public_api';
3
+ export * from './module';
@@ -13,7 +13,7 @@ export declare enum DaffCompositeProductActionTypes {
13
13
  * @param itemId - Id of the product item.
14
14
  * @param optionId - Id of the option of the product item that is chosen.
15
15
  */
16
- export declare class DaffCompositeProductApplyOption<T extends DaffCompositeProduct> implements Action {
16
+ export declare class DaffCompositeProductApplyOption<T extends DaffCompositeProduct = DaffCompositeProduct> implements Action {
17
17
  id: T['id'];
18
18
  itemId: DaffCompositeProductItem['id'];
19
19
  optionId: DaffCompositeProductItemOption['id'];
@@ -0,0 +1,19 @@
1
+ import { DaffModelFactory } from '@daffodil/core/testing';
2
+ import { DaffCompositeProductItemOption } from '@daffodil/product-composite';
3
+ import { MockProduct } from '@daffodil/product/testing';
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();
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductItemOptionFactory, never>;
18
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductItemOptionFactory>;
19
+ }
@@ -0,0 +1,25 @@
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,46 +1,23 @@
1
1
  import { DaffModelFactory } from '@daffodil/core/testing';
2
2
  import { DaffProductTypeEnum } from '@daffodil/product';
3
- import { DaffCompositeProduct, DaffCompositeProductItemInputEnum } from '@daffodil/product-composite';
3
+ import { DaffCompositeProduct } from '@daffodil/product-composite';
4
4
  import { MockProduct } from '@daffodil/product/testing';
5
+ import { DaffCompositeProductItemFactory } from './composite-product-item.factory';
5
6
  import * as i0 from "@angular/core";
6
7
  /**
7
8
  * Mocked DaffCompositeProduct object.
8
- *
9
- * @deprecated import from @daffodil/product-composite/testing instead.
10
9
  */
11
10
  export declare class MockCompositeProduct extends MockProduct implements DaffCompositeProduct {
11
+ protected itemFactory: DaffCompositeProductItemFactory;
12
12
  type: DaffProductTypeEnum;
13
- items: {
14
- id: string;
15
- url: string;
16
- required: boolean;
17
- title: string;
18
- input_type: DaffCompositeProductItemInputEnum;
19
- options: {
20
- id: string;
21
- type: DaffProductTypeEnum;
22
- url: string;
23
- name: string;
24
- price: number;
25
- images: any[];
26
- thumbnail: any;
27
- discount: {
28
- amount: number;
29
- percent: number;
30
- };
31
- quantity: number;
32
- is_default: boolean;
33
- in_stock: boolean;
34
- related: any[];
35
- upsell: any[];
36
- }[];
37
- }[];
13
+ items: import("@daffodil/product-composite").DaffCompositeProductItem[];
14
+ constructor(itemFactory: DaffCompositeProductItemFactory);
38
15
  }
39
16
  /**
40
17
  * Factory for creating DaffCompositeProducts.
41
18
  */
42
19
  export declare class DaffCompositeProductFactory extends DaffModelFactory<DaffCompositeProduct> {
43
- constructor();
20
+ constructor(itemFactory: DaffCompositeProductItemFactory);
44
21
  static ɵfac: i0.ɵɵFactoryDeclaration<DaffCompositeProductFactory, never>;
45
22
  static ɵprov: i0.ɵɵInjectableDeclaration<DaffCompositeProductFactory>;
46
23
  }
@@ -1 +1,3 @@
1
1
  export * from './composite-product.factory';
2
+ export * from './composite-product-item.factory';
3
+ export * from './composite-product-item-option.factory';