@configura/web-api 1.3.0-alpha.0 → 1.3.0-alpha.4

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 (53) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +1 -1
  3. package/dist/CatalogueAPI.d.ts +448 -448
  4. package/dist/CatalogueAPI.js +206 -206
  5. package/dist/CfgProduct.d.ts +116 -116
  6. package/dist/CfgProduct.js +588 -588
  7. package/dist/index.d.ts +15 -15
  8. package/dist/index.js +15 -15
  9. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  10. package/dist/material/CfgMaterialMapping.js +176 -176
  11. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  12. package/dist/material/CfgMtrlApplication.js +43 -43
  13. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  14. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  15. package/dist/material/CfgMtrlSource.d.ts +19 -19
  16. package/dist/material/CfgMtrlSource.js +40 -40
  17. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  18. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  19. package/dist/productConfiguration/CfgFeature.d.ts +134 -80
  20. package/dist/productConfiguration/CfgFeature.js +483 -451
  21. package/dist/productConfiguration/CfgOption.d.ts +112 -64
  22. package/dist/productConfiguration/CfgOption.js +293 -263
  23. package/dist/productConfiguration/CfgProductConfiguration.d.ts +50 -50
  24. package/dist/productConfiguration/CfgProductConfiguration.js +198 -198
  25. package/dist/productConfiguration/filters.d.ts +7 -7
  26. package/dist/productConfiguration/filters.js +29 -29
  27. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  28. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  29. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +9 -9
  30. package/dist/productConfiguration/utilitiesProductConfiguration.js +61 -61
  31. package/dist/productLoader.d.ts +11 -11
  32. package/dist/productLoader.js +41 -41
  33. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  34. package/dist/tests/testData/collectorForTest.js +195 -195
  35. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  36. package/dist/tests/testData/dummyProductForTest.js +35 -35
  37. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +32 -32
  38. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +368 -368
  39. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  40. package/dist/tests/testData/testDataCachedGetProduct.js +199 -199
  41. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  42. package/dist/tests/testData/testDataCachedPostValidate.js +189 -189
  43. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  44. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1117 -1117
  45. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +28 -28
  46. package/dist/tests/testData/testDataProductAggregatedPrice.js +205 -205
  47. package/dist/tests/testData/testDataUpcharge.d.ts +29 -29
  48. package/dist/tests/testData/testDataUpcharge.js +159 -159
  49. package/dist/utilitiesCatalogueData.d.ts +20 -18
  50. package/dist/utilitiesCatalogueData.js +64 -56
  51. package/dist/utilitiesCataloguePermission.d.ts +39 -39
  52. package/dist/utilitiesCataloguePermission.js +84 -84
  53. package/package.json +3 -3
@@ -1,65 +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
- Validate = "Validate",
11
- ValidateAndBubbleSelected = "ValidateAndBubbleSelected",
12
- Stop = "Stop",
13
- OneLevel = "OneLevel",
14
- ToParentProduct = "ToParentProduct",
15
- ToRoot = "ToRoot"
16
- }
17
- export declare class _CfgOptionInternal {
18
- readonly rawOption: Option;
19
- readonly parent: _CfgFeatureInternal;
20
- private readonly allRawFeatures;
21
- readonly parentProduct: _CfgProductInternal;
22
- readonly rootProduct: _CfgProductInternal;
23
- constructor(rawOption: Option, parent: _CfgFeatureInternal, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal);
24
- private _features;
25
- private _mtrlApplications;
26
- readonly key: string;
27
- readonly changeObservable: Observable<OptionChangeNotification>;
28
- get code(): string;
29
- get description(): string;
30
- get mtrlApplications(): CfgMtrlApplication[];
31
- get thumbnail(): string | undefined;
32
- get upcharge(): number | undefined;
33
- get priceChangeAtSelectChange(): number | undefined;
34
- get features(): CfgFeature[];
35
- _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
36
- getApiSelection: () => SelectedOption;
37
- setApiSelection: (apiOptionSelection: SelectedOption | undefined) => Promise<boolean>;
38
- structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
39
- tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise<boolean>;
40
- keyMatch: (other: _CfgOptionInternal, descriptionMatch?: boolean) => boolean;
41
- _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
42
- _freshRefDescendants(): void;
43
- }
44
- export declare class CfgOption {
45
- readonly _internal: _CfgOptionInternal;
46
- static make: (rawOption: Option, parent: _CfgFeatureInternal, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal) => CfgOption;
47
- static _makeNewRefFrom: (internal: _CfgOptionInternal) => CfgOption;
48
- private constructor();
49
- isBackedBySame: (other: CfgOption) => boolean;
50
- get parentProduct(): CfgProduct;
51
- get rootProduct(): CfgProduct;
52
- get rawOption(): Option;
53
- get key(): string;
54
- get code(): string;
55
- get description(): string;
56
- get selected(): boolean;
57
- setSelected: (on: boolean) => Promise<boolean>;
58
- get thumbnail(): string | undefined;
59
- get upcharge(): number | undefined;
60
- get priceChangeAtSelectChange(): number | undefined;
61
- get features(): CfgFeature[];
62
- listenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
63
- stopListenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
64
- }
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
+ }
65
113
  //# sourceMappingURL=CfgOption.d.ts.map