@configura/web-api 1.2.1 → 1.3.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +448 -448
- package/dist/CatalogueAPI.js +206 -206
- package/dist/CfgProduct.d.ts +116 -116
- package/dist/CfgProduct.js +588 -588
- package/dist/index.d.ts +15 -15
- package/dist/index.js +15 -15
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +176 -176
- package/dist/material/CfgMtrlApplication.d.ts +18 -18
- package/dist/material/CfgMtrlApplication.js +43 -43
- package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
- package/dist/material/CfgMtrlApplicationSource.js +8 -8
- package/dist/material/CfgMtrlSource.d.ts +19 -19
- package/dist/material/CfgMtrlSource.js +40 -40
- package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
- package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
- package/dist/productConfiguration/CfgFeature.d.ts +134 -134
- package/dist/productConfiguration/CfgFeature.js +483 -483
- package/dist/productConfiguration/CfgOption.d.ts +112 -112
- package/dist/productConfiguration/CfgOption.js +293 -293
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +50 -50
- package/dist/productConfiguration/CfgProductConfiguration.js +198 -198
- package/dist/productConfiguration/filters.d.ts +7 -7
- package/dist/productConfiguration/filters.js +29 -29
- package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
- package/dist/productConfiguration/productParamsGenerator.js +51 -51
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +9 -9
- package/dist/productConfiguration/utilitiesProductConfiguration.js +61 -61
- package/dist/productLoader.d.ts +11 -11
- package/dist/productLoader.js +41 -41
- package/dist/tests/testData/collectorForTest.d.ts +73 -73
- package/dist/tests/testData/collectorForTest.js +195 -195
- package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
- package/dist/tests/testData/dummyProductForTest.js +35 -35
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +368 -368
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +199 -199
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +189 -189
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1117 -1117
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +28 -28
- package/dist/tests/testData/testDataProductAggregatedPrice.js +205 -205
- package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
- package/dist/tests/testData/testDataUpcharge.js +159 -159
- package/dist/utilitiesCatalogueData.d.ts +20 -18
- package/dist/utilitiesCatalogueData.js +64 -56
- package/dist/utilitiesCataloguePermission.d.ts +39 -39
- package/dist/utilitiesCataloguePermission.js +84 -84
- package/package.json +3 -3
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
import { Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import { Feature, Option, SelectedOption } from "../CatalogueAPI.js";
|
|
3
|
-
import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js";
|
|
4
|
-
import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
|
|
5
|
-
import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
|
|
6
|
-
export declare type OptionChangeNotification = {
|
|
7
|
-
freshRef: CfgOption;
|
|
8
|
-
};
|
|
9
|
-
export declare enum ProductConfigurationBubbleMode {
|
|
10
|
-
/**
|
|
11
|
-
* Bubble to the closest CfgProduct, let it revalidate, then that will continue
|
|
12
|
-
* the bubble after validate. Turns on all ancestors all the way up.
|
|
13
|
-
*/
|
|
14
|
-
Validate = "Validate",
|
|
15
|
-
/**
|
|
16
|
-
* Bubble to the closest CfgProduct, let it revalidate, then that will continue
|
|
17
|
-
* the bubble after validate. If this is select it will turns on all ancestors all the way up.
|
|
18
|
-
* So with this mode it is possible to select an option where its parents are not selected.
|
|
19
|
-
*/
|
|
20
|
-
ValidateAndBubbleSelected = "ValidateAndBubbleSelected",
|
|
21
|
-
/**
|
|
22
|
-
* Stop bubbling
|
|
23
|
-
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
24
|
-
*/
|
|
25
|
-
Stop = "Stop",
|
|
26
|
-
/**
|
|
27
|
-
* Bubble to the next level up the tree. In features-options the next level is considered
|
|
28
|
-
* the next feature, so option levels are skipped over. The node we call from notifies its
|
|
29
|
-
* parent, and the parent switches out the reference to the node. Then bubbling stops.
|
|
30
|
-
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
31
|
-
*/
|
|
32
|
-
OneLevel = "OneLevel",
|
|
33
|
-
/**
|
|
34
|
-
* Bubble to the closest CfgProduct without doing any validation
|
|
35
|
-
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
36
|
-
*/
|
|
37
|
-
ToParentProduct = "ToParentProduct",
|
|
38
|
-
/**
|
|
39
|
-
* Bubble to the root CfgProduct
|
|
40
|
-
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
41
|
-
*/
|
|
42
|
-
ToRoot = "ToRoot"
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* This class is meant to only be used through CfgOption. It should
|
|
46
|
-
* never be instantiated on its own. Normally the internal state of this class
|
|
47
|
-
* should never be directly modified. CfgOption is the class that
|
|
48
|
-
* should be used and interacted with.
|
|
49
|
-
*/
|
|
50
|
-
export declare class _CfgOptionInternal {
|
|
51
|
-
readonly rawOption: Option;
|
|
52
|
-
readonly parent: _CfgFeatureInternal;
|
|
53
|
-
private readonly allRawFeatures;
|
|
54
|
-
readonly parentProduct: _CfgProductInternal;
|
|
55
|
-
readonly rootProduct: _CfgProductInternal;
|
|
56
|
-
constructor(rawOption: Option, parent: _CfgFeatureInternal, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal);
|
|
57
|
-
private _features;
|
|
58
|
-
private _mtrlApplications;
|
|
59
|
-
readonly key: string;
|
|
60
|
-
readonly changeObservable: Observable<OptionChangeNotification>;
|
|
61
|
-
get code(): string;
|
|
62
|
-
get description(): string;
|
|
63
|
-
get selected(): boolean;
|
|
64
|
-
get ancestorsSelected(): boolean;
|
|
65
|
-
get mtrlApplications(): CfgMtrlApplication[];
|
|
66
|
-
get thumbnail(): string | undefined;
|
|
67
|
-
get upcharge(): number | undefined;
|
|
68
|
-
get priceChangeAtSelectChange(): number | undefined;
|
|
69
|
-
get features(): CfgFeature[];
|
|
70
|
-
/** Called by child to tell its parent that it has changed. */
|
|
71
|
-
_childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
|
|
72
|
-
getApiSelection: () => SelectedOption;
|
|
73
|
-
setApiSelection: (apiOptionSelection: SelectedOption | undefined) => Promise<boolean>;
|
|
74
|
-
structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
|
|
75
|
-
tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise<boolean>;
|
|
76
|
-
keyMatch: (other: _CfgOptionInternal, descriptionMatch?: boolean) => boolean;
|
|
77
|
-
_getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
|
|
78
|
-
_freshRefDescendants(): void;
|
|
79
|
-
}
|
|
80
|
-
export declare class CfgOption {
|
|
81
|
-
readonly _internal: _CfgOptionInternal;
|
|
82
|
-
static make: (rawOption: Option, parent: _CfgFeatureInternal, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal) => CfgOption;
|
|
83
|
-
/**
|
|
84
|
-
* Makes an object wrapping the passed object. This is not a clone method,
|
|
85
|
-
* it is a method to make a new outer reference. Like a shallow copy.
|
|
86
|
-
* We use this to help frameworks that are build around using equals to detect change.
|
|
87
|
-
*/
|
|
88
|
-
static _makeNewRefFrom: (internal: _CfgOptionInternal) => CfgOption;
|
|
89
|
-
/**
|
|
90
|
-
* Private constructor and make-method because make new ref requires the constructor to
|
|
91
|
-
* take an internal and we don't want those who instantiate CfgOption to have to be aware
|
|
92
|
-
* of the internal.
|
|
93
|
-
*/
|
|
94
|
-
private constructor();
|
|
95
|
-
isBackedBySame: (other: CfgOption) => boolean;
|
|
96
|
-
get parentProduct(): CfgProduct;
|
|
97
|
-
get rootProduct(): CfgProduct;
|
|
98
|
-
get rawOption(): Option;
|
|
99
|
-
get key(): string;
|
|
100
|
-
get code(): string;
|
|
101
|
-
get description(): string;
|
|
102
|
-
get selected(): boolean;
|
|
103
|
-
/** Are all ancestors up to the CfgProductConfiguration selected? Includes self. */
|
|
104
|
-
get ancestorsSelected(): boolean;
|
|
105
|
-
setSelected: (on: boolean) => Promise<boolean>;
|
|
106
|
-
get thumbnail(): string | undefined;
|
|
107
|
-
get upcharge(): number | undefined;
|
|
108
|
-
get priceChangeAtSelectChange(): number | undefined;
|
|
109
|
-
get features(): CfgFeature[];
|
|
110
|
-
listenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
|
|
111
|
-
stopListenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
|
|
112
|
-
}
|
|
1
|
+
import { Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
+
import { Feature, Option, SelectedOption } from "../CatalogueAPI.js";
|
|
3
|
+
import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js";
|
|
4
|
+
import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
|
|
5
|
+
import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
|
|
6
|
+
export declare type OptionChangeNotification = {
|
|
7
|
+
freshRef: CfgOption;
|
|
8
|
+
};
|
|
9
|
+
export declare enum ProductConfigurationBubbleMode {
|
|
10
|
+
/**
|
|
11
|
+
* Bubble to the closest CfgProduct, let it revalidate, then that will continue
|
|
12
|
+
* the bubble after validate. Turns on all ancestors all the way up.
|
|
13
|
+
*/
|
|
14
|
+
Validate = "Validate",
|
|
15
|
+
/**
|
|
16
|
+
* Bubble to the closest CfgProduct, let it revalidate, then that will continue
|
|
17
|
+
* the bubble after validate. If this is select it will turns on all ancestors all the way up.
|
|
18
|
+
* So with this mode it is possible to select an option where its parents are not selected.
|
|
19
|
+
*/
|
|
20
|
+
ValidateAndBubbleSelected = "ValidateAndBubbleSelected",
|
|
21
|
+
/**
|
|
22
|
+
* Stop bubbling
|
|
23
|
+
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
24
|
+
*/
|
|
25
|
+
Stop = "Stop",
|
|
26
|
+
/**
|
|
27
|
+
* Bubble to the next level up the tree. In features-options the next level is considered
|
|
28
|
+
* the next feature, so option levels are skipped over. The node we call from notifies its
|
|
29
|
+
* parent, and the parent switches out the reference to the node. Then bubbling stops.
|
|
30
|
+
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
31
|
+
*/
|
|
32
|
+
OneLevel = "OneLevel",
|
|
33
|
+
/**
|
|
34
|
+
* Bubble to the closest CfgProduct without doing any validation
|
|
35
|
+
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
36
|
+
*/
|
|
37
|
+
ToParentProduct = "ToParentProduct",
|
|
38
|
+
/**
|
|
39
|
+
* Bubble to the root CfgProduct
|
|
40
|
+
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
41
|
+
*/
|
|
42
|
+
ToRoot = "ToRoot"
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This class is meant to only be used through CfgOption. It should
|
|
46
|
+
* never be instantiated on its own. Normally the internal state of this class
|
|
47
|
+
* should never be directly modified. CfgOption is the class that
|
|
48
|
+
* should be used and interacted with.
|
|
49
|
+
*/
|
|
50
|
+
export declare class _CfgOptionInternal {
|
|
51
|
+
readonly rawOption: Option;
|
|
52
|
+
readonly parent: _CfgFeatureInternal;
|
|
53
|
+
private readonly allRawFeatures;
|
|
54
|
+
readonly parentProduct: _CfgProductInternal;
|
|
55
|
+
readonly rootProduct: _CfgProductInternal;
|
|
56
|
+
constructor(rawOption: Option, parent: _CfgFeatureInternal, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal);
|
|
57
|
+
private _features;
|
|
58
|
+
private _mtrlApplications;
|
|
59
|
+
readonly key: string;
|
|
60
|
+
readonly changeObservable: Observable<OptionChangeNotification>;
|
|
61
|
+
get code(): string;
|
|
62
|
+
get description(): string;
|
|
63
|
+
get selected(): boolean;
|
|
64
|
+
get ancestorsSelected(): boolean;
|
|
65
|
+
get mtrlApplications(): CfgMtrlApplication[];
|
|
66
|
+
get thumbnail(): string | undefined;
|
|
67
|
+
get upcharge(): number | undefined;
|
|
68
|
+
get priceChangeAtSelectChange(): number | undefined;
|
|
69
|
+
get features(): CfgFeature[];
|
|
70
|
+
/** Called by child to tell its parent that it has changed. */
|
|
71
|
+
_childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
|
|
72
|
+
getApiSelection: () => SelectedOption;
|
|
73
|
+
setApiSelection: (apiOptionSelection: SelectedOption | undefined) => Promise<boolean>;
|
|
74
|
+
structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
|
|
75
|
+
tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise<boolean>;
|
|
76
|
+
keyMatch: (other: _CfgOptionInternal, descriptionMatch?: boolean) => boolean;
|
|
77
|
+
_getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
|
|
78
|
+
_freshRefDescendants(): void;
|
|
79
|
+
}
|
|
80
|
+
export declare class CfgOption {
|
|
81
|
+
readonly _internal: _CfgOptionInternal;
|
|
82
|
+
static make: (rawOption: Option, parent: _CfgFeatureInternal, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal) => CfgOption;
|
|
83
|
+
/**
|
|
84
|
+
* Makes an object wrapping the passed object. This is not a clone method,
|
|
85
|
+
* it is a method to make a new outer reference. Like a shallow copy.
|
|
86
|
+
* We use this to help frameworks that are build around using equals to detect change.
|
|
87
|
+
*/
|
|
88
|
+
static _makeNewRefFrom: (internal: _CfgOptionInternal) => CfgOption;
|
|
89
|
+
/**
|
|
90
|
+
* Private constructor and make-method because make new ref requires the constructor to
|
|
91
|
+
* take an internal and we don't want those who instantiate CfgOption to have to be aware
|
|
92
|
+
* of the internal.
|
|
93
|
+
*/
|
|
94
|
+
private constructor();
|
|
95
|
+
isBackedBySame: (other: CfgOption) => boolean;
|
|
96
|
+
get parentProduct(): CfgProduct;
|
|
97
|
+
get rootProduct(): CfgProduct;
|
|
98
|
+
get rawOption(): Option;
|
|
99
|
+
get key(): string;
|
|
100
|
+
get code(): string;
|
|
101
|
+
get description(): string;
|
|
102
|
+
get selected(): boolean;
|
|
103
|
+
/** Are all ancestors up to the CfgProductConfiguration selected? Includes self. */
|
|
104
|
+
get ancestorsSelected(): boolean;
|
|
105
|
+
setSelected: (on: boolean) => Promise<boolean>;
|
|
106
|
+
get thumbnail(): string | undefined;
|
|
107
|
+
get upcharge(): number | undefined;
|
|
108
|
+
get priceChangeAtSelectChange(): number | undefined;
|
|
109
|
+
get features(): CfgFeature[];
|
|
110
|
+
listenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
|
|
111
|
+
stopListenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
|
|
112
|
+
}
|
|
113
113
|
//# sourceMappingURL=CfgOption.d.ts.map
|