@daffodil/product-composite 0.58.9 → 0.59.0
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2020/helpers/build-selection-payload.mjs +10 -0
- package/esm2020/helpers/public_api.mjs +2 -0
- package/esm2020/models/public_api.mjs +5 -0
- package/esm2020/models/selection-payload.type.mjs +2 -0
- package/esm2020/public_api.mjs +3 -4
- package/esm2020/routing/config/default.mjs +8 -0
- package/esm2020/routing/config/interface.mjs +2 -0
- package/esm2020/routing/config/public_api.mjs +3 -0
- package/esm2020/routing/config/token.mjs +22 -0
- package/esm2020/routing/daffodil-product-composite-routing.mjs +5 -0
- package/esm2020/routing/effects/product-page.effects.mjs +73 -0
- package/esm2020/routing/effects/public_api.mjs +2 -0
- package/esm2020/routing/index.mjs +2 -0
- package/esm2020/routing/module.mjs +37 -0
- package/esm2020/routing/public_api.mjs +4 -0
- package/esm2020/state/actions/composite-product.actions.mjs +1 -1
- package/esm2020/testing/factories/composite-product-item-option.factory.mjs +32 -0
- package/esm2020/testing/factories/composite-product-item.factory.mjs +45 -0
- package/esm2020/testing/factories/composite-product.factory.mjs +11 -103
- package/esm2020/testing/factories/public_api.mjs +3 -1
- package/fesm2015/daffodil-product-composite-routing.mjs +133 -0
- package/fesm2015/daffodil-product-composite-routing.mjs.map +1 -0
- package/fesm2015/daffodil-product-composite-state.mjs.map +1 -1
- package/fesm2015/daffodil-product-composite-testing.mjs +76 -103
- package/fesm2015/daffodil-product-composite-testing.mjs.map +1 -1
- package/fesm2015/daffodil-product-composite.mjs +11 -1
- package/fesm2015/daffodil-product-composite.mjs.map +1 -1
- package/fesm2020/daffodil-product-composite-routing.mjs +136 -0
- package/fesm2020/daffodil-product-composite-routing.mjs.map +1 -0
- package/fesm2020/daffodil-product-composite-state.mjs.map +1 -1
- package/fesm2020/daffodil-product-composite-testing.mjs +76 -103
- package/fesm2020/daffodil-product-composite-testing.mjs.map +1 -1
- package/fesm2020/daffodil-product-composite.mjs +11 -1
- package/fesm2020/daffodil-product-composite.mjs.map +1 -1
- package/helpers/build-selection-payload.d.ts +2 -0
- package/helpers/public_api.d.ts +1 -0
- package/models/public_api.d.ts +4 -0
- package/models/selection-payload.type.d.ts +5 -0
- package/package.json +22 -5
- package/public_api.d.ts +2 -3
- package/routing/config/default.d.ts +6 -0
- package/routing/config/interface.d.ts +20 -0
- package/routing/config/public_api.d.ts +3 -0
- package/routing/config/token.d.ts +10 -0
- package/routing/daffodil-product-composite-routing.d.ts +5 -0
- package/routing/effects/product-page.effects.d.ts +26 -0
- package/routing/effects/public_api.d.ts +1 -0
- package/routing/index.d.ts +1 -0
- package/routing/module.d.ts +10 -0
- package/routing/package.json +10 -0
- package/routing/public_api.d.ts +3 -0
- package/state/actions/composite-product.actions.d.ts +1 -1
- package/testing/factories/composite-product-item-option.factory.d.ts +19 -0
- package/testing/factories/composite-product-item.factory.d.ts +25 -0
- package/testing/factories/composite-product.factory.d.ts +6 -29
- 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
@@ -1,6 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "@daffodil/product-composite",
|
3
|
-
"
|
3
|
+
"nx": {
|
4
|
+
"targets": {
|
5
|
+
"build": {
|
6
|
+
"outputs": [
|
7
|
+
"{workspaceRoot}/dist/product-composite"
|
8
|
+
]
|
9
|
+
}
|
10
|
+
}
|
11
|
+
},
|
12
|
+
"version": "0.59.0",
|
4
13
|
"description": "Interfaces built for daffodil/state",
|
5
14
|
"repository": {
|
6
15
|
"type": "git",
|
@@ -18,8 +27,8 @@
|
|
18
27
|
"peerDependencies": {
|
19
28
|
"@angular/common": "^13.0.0",
|
20
29
|
"@angular/core": "^13.0.0",
|
21
|
-
"@daffodil/core": "0.
|
22
|
-
"@daffodil/product": "0.
|
30
|
+
"@daffodil/core": "0.59.0",
|
31
|
+
"@daffodil/product": "0.59.0",
|
23
32
|
"@ngrx/effects": "^13.0.0",
|
24
33
|
"@ngrx/entity": "^13.0.0",
|
25
34
|
"@ngrx/store": "^13.0.0",
|
@@ -27,8 +36,8 @@
|
|
27
36
|
},
|
28
37
|
"optionalDependencies": {
|
29
38
|
"@apollo/client": "^3.0.0",
|
30
|
-
"@daffodil/driver": "0.
|
31
|
-
"@daffodil/product": "0.
|
39
|
+
"@daffodil/driver": "0.59.0",
|
40
|
+
"@daffodil/product": "0.59.0",
|
32
41
|
"angular-in-memory-web-api": "^0.13.0",
|
33
42
|
"apollo-angular": "^3.0.1",
|
34
43
|
"@faker-js/faker": "^7.6.0"
|
@@ -83,6 +92,14 @@
|
|
83
92
|
"node": "./fesm2015/daffodil-product-composite-driver-testing.mjs",
|
84
93
|
"default": "./fesm2020/daffodil-product-composite-driver-testing.mjs"
|
85
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
|
+
},
|
86
103
|
"./state": {
|
87
104
|
"types": "./state/daffodil-product-composite-state.d.ts",
|
88
105
|
"esm2020": "./esm2020/state/daffodil-product-composite-state.mjs",
|
package/public_api.d.ts
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
export * from './
|
2
|
-
export * from './models/
|
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,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,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
|
+
}
|
@@ -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
|
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
|
-
|
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
|
}
|