@configura/web-api 1.6.1-alpha.7 → 2.0.0-alpha.1

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 (98) hide show
  1. package/.eslintrc.json +18 -0
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +551 -512
  5. package/dist/CatalogueAPI.js +293 -277
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +268 -239
  9. package/dist/CfgProduct.js +778 -668
  10. package/dist/CfgReferencePathHelper.d.ts +14 -0
  11. package/dist/CfgReferencePathHelper.js +13 -0
  12. package/dist/ConfigurationConverter.d.ts +5 -0
  13. package/dist/ConfigurationConverter.js +72 -0
  14. package/dist/index.d.ts +23 -18
  15. package/dist/index.js +23 -18
  16. package/dist/io/CfgHistoryManager.d.ts +51 -0
  17. package/dist/io/CfgHistoryManager.js +82 -0
  18. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -0
  19. package/dist/io/CfgHistoryToProdConfConnector.js +56 -0
  20. package/dist/io/CfgIOManager.d.ts +49 -0
  21. package/dist/io/CfgIOManager.js +115 -0
  22. package/dist/io/CfgIOProdConfConnector.d.ts +53 -0
  23. package/dist/io/CfgIOProdConfConnector.js +141 -0
  24. package/dist/io/CfgObservableStateManager.d.ts +22 -0
  25. package/dist/io/CfgObservableStateManager.js +65 -0
  26. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -0
  27. package/dist/io/CfgObservableStateToProdConfConnector.js +16 -0
  28. package/dist/io/CfgWindowEventManager.d.ts +22 -0
  29. package/dist/io/CfgWindowEventManager.js +38 -0
  30. package/dist/io/CfgWindowMessageManager.d.ts +41 -0
  31. package/dist/io/CfgWindowMessageManager.js +84 -0
  32. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -0
  33. package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -0
  34. package/dist/io/index.d.ts +9 -0
  35. package/dist/io/index.js +8 -0
  36. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  37. package/dist/material/CfgMaterialMapping.js +181 -181
  38. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  39. package/dist/material/CfgMtrlApplication.js +43 -43
  40. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  41. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  42. package/dist/material/CfgMtrlSource.d.ts +19 -19
  43. package/dist/material/CfgMtrlSource.js +40 -40
  44. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  45. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  46. package/dist/productConfiguration/CfgFeature.d.ts +187 -178
  47. package/dist/productConfiguration/CfgFeature.js +645 -611
  48. package/dist/productConfiguration/CfgOption.d.ts +151 -128
  49. package/dist/productConfiguration/CfgOption.js +416 -394
  50. package/dist/productConfiguration/CfgProductConfiguration.d.ts +117 -120
  51. package/dist/productConfiguration/CfgProductConfiguration.js +307 -307
  52. package/dist/productConfiguration/filters.d.ts +15 -15
  53. package/dist/productConfiguration/filters.js +70 -70
  54. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  55. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  56. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  57. package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
  58. package/dist/productLoader.d.ts +33 -33
  59. package/dist/productLoader.js +49 -49
  60. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +21 -0
  61. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -0
  62. package/dist/syncGroups/SyncGroupsHandler.d.ts +41 -0
  63. package/dist/syncGroups/SyncGroupsHandler.js +359 -0
  64. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +27 -0
  65. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -0
  66. package/dist/syncGroups/SyncGroupsState.d.ts +36 -0
  67. package/dist/syncGroups/SyncGroupsState.js +125 -0
  68. package/dist/syncGroups/SyncGroupsTransaction.d.ts +155 -0
  69. package/dist/syncGroups/SyncGroupsTransaction.js +576 -0
  70. package/dist/tasks/TaskHandler.d.ts +77 -78
  71. package/dist/tasks/TaskHandler.js +275 -265
  72. package/dist/tasks/formats.d.ts +4 -4
  73. package/dist/tasks/formats.js +7 -7
  74. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  75. package/dist/tests/testData/collectorForTest.js +194 -195
  76. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  77. package/dist/tests/testData/dummyProductForTest.js +32 -36
  78. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -32
  79. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +277 -348
  80. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  81. package/dist/tests/testData/testDataCachedGetProduct.js +185 -196
  82. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  83. package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
  84. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  85. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  86. package/dist/tests/testData/testDataOptions.d.ts +13 -0
  87. package/dist/tests/testData/testDataOptions.js +60 -0
  88. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  89. package/dist/tests/testData/testDataProductAggregatedPrice.js +187 -198
  90. package/dist/tests/testData/testDataUpcharge.d.ts +8 -29
  91. package/dist/tests/testData/testDataUpcharge.js +119 -151
  92. package/dist/utilitiesCatalogueData.d.ts +33 -25
  93. package/dist/utilitiesCatalogueData.js +164 -66
  94. package/dist/utilitiesCataloguePermission.d.ts +32 -39
  95. package/dist/utilitiesCataloguePermission.js +76 -84
  96. package/dist/utilitiesNumericValues.d.ts +24 -24
  97. package/dist/utilitiesNumericValues.js +109 -109
  98. package/package.json +3 -3
@@ -1,129 +1,152 @@
1
- import { LengthUnit, 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 { NumericValuesSelection } from "../utilitiesNumericValues.js";
6
- import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
7
- import { _CfgProductConfigurationInternal } from "./CfgProductConfiguration.js";
8
- export declare type OptionChangeNotification = {
9
- freshRef: CfgOption;
10
- };
11
- export declare enum ProductConfigurationBubbleMode {
12
- /**
13
- * Bubble to the closest CfgProduct, let it revalidate, then that will continue
14
- * the bubble after validate.
15
- */
16
- Validate = "Validate",
17
- /**
18
- * Bubble to the closest CfgProduct, let it revalidate, then that will continue
19
- * the bubble after validate. If this is select it will turns on all ancestors all the way up.
20
- * So with this mode it is possible to select an option where its parents are not selected.
21
- */
22
- ValidateAndBubbleSelected = "ValidateAndBubbleSelected",
23
- /**
24
- * Stop bubbling
25
- * This mode supports internal functionality and is not expected to be used by integrators.
26
- */
27
- Stop = "Stop",
28
- /**
29
- * Bubble to the next level up the tree. In features-options the next level is considered
30
- * the next feature, so option levels are skipped over. The node we call from notifies its
31
- * parent, and the parent switches out the reference to the node. Then bubbling stops.
32
- * This mode supports internal functionality and is not expected to be used by integrators.
33
- */
34
- OneLevel = "OneLevel",
35
- /**
36
- * Bubble to the closest CfgProduct without doing any validation
37
- * This mode supports internal functionality and is not expected to be used by integrators.
38
- */
39
- ToParentProduct = "ToParentProduct",
40
- /**
41
- * Bubble to the root CfgProduct
42
- * This mode supports internal functionality and is not expected to be used by integrators.
43
- */
44
- ToRoot = "ToRoot"
45
- }
46
- /**
47
- * This class is meant to only be used through CfgOption. It should
48
- * never be instantiated on its own. Normally the internal state of this class
49
- * should never be directly modified. CfgOption is the class that
50
- * should be used and interacted with.
51
- */
52
- export declare class _CfgOptionInternal {
53
- readonly rawOption: Option;
54
- private readonly allRawFeatures;
55
- readonly parent: _CfgFeatureInternal;
56
- readonly parentConfiguration: _CfgProductConfigurationInternal;
57
- readonly parentProduct: _CfgProductInternal;
58
- readonly rootProduct: _CfgProductInternal;
59
- constructor(rawOption: Option, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal);
60
- private _features;
61
- private _mtrlApplications;
62
- readonly key: string;
63
- private _numericValue;
64
- readonly allowedNumericValues: NumericValuesSelection | undefined;
65
- isAllowedNumericValue(val: number): boolean;
66
- readonly changeObservable: Observable<OptionChangeNotification>;
67
- get code(): string;
68
- get isUseNumericValue(): boolean;
69
- get numericValue(): number | undefined;
70
- setNumericValue(val: number, doSelectOption: boolean): Promise<boolean>;
71
- get unit(): LengthUnit;
72
- get description(): string;
73
- get selected(): boolean;
74
- get ancestorsSelected(): boolean;
75
- get mtrlApplications(): CfgMtrlApplication[];
76
- get thumbnail(): string | undefined;
77
- get upcharge(): number | undefined;
78
- get priceChangeAtSelectChange(): number | undefined;
79
- get features(): CfgFeature[];
80
- /** Called by child to tell its parent that it has changed. */
81
- _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
82
- getApiSelection: () => SelectedOption;
83
- setApiSelection: (apiOptionSelection: SelectedOption | undefined) => Promise<boolean>;
84
- structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
85
- tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise<boolean>;
86
- keyMatch: (other: _CfgOptionInternal, descriptionMatch?: boolean) => boolean;
87
- _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
88
- _freshRefDescendants(): void;
89
- }
90
- export declare class CfgOption {
91
- readonly _internal: _CfgOptionInternal;
92
- static make(rawOption: Option, allRawFeatures: Feature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgOption;
93
- /**
94
- * Makes an object wrapping the passed object. This is not a clone method,
95
- * it is a method to make a new outer reference. Like a shallow copy.
96
- * We use this to help frameworks that are build around using equals to detect change.
97
- */
98
- static _makeNewRefFrom(internal: _CfgOptionInternal): CfgOption;
99
- /**
100
- * Private constructor and make-method because make new ref requires the constructor to
101
- * take an internal and we don't want those who instantiate CfgOption to have to be aware
102
- * of the internal.
103
- */
104
- private constructor();
105
- isBackedBySame: (other: CfgOption) => boolean;
106
- get parentProduct(): CfgProduct;
107
- get rootProduct(): CfgProduct;
108
- get rawOption(): Option;
109
- get key(): string;
110
- get code(): string;
111
- get isUseNumericValue(): boolean;
112
- get numericValue(): number | undefined;
113
- setNumericValue: (val: number, doSelectOption: boolean) => Promise<boolean>;
114
- get allowedNumericValues(): NumericValuesSelection | undefined;
115
- isAllowedNumericValue: (val: number) => boolean;
116
- get unit(): LengthUnit;
117
- get description(): string;
118
- get selected(): boolean;
119
- /** Are all ancestors up to the CfgProductConfiguration selected? Includes self. */
120
- get ancestorsSelected(): boolean;
121
- setSelected: (on: boolean) => Promise<boolean>;
122
- get thumbnail(): string | undefined;
123
- get upcharge(): number | undefined;
124
- get priceChangeAtSelectChange(): number | undefined;
125
- get features(): CfgFeature[];
126
- listenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
127
- stopListenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
128
- }
1
+ import { LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
2
+ import { DtoConfOption, DtoFeature, DtoOption, DtoSelectedOption } from "../CatalogueAPI.js";
3
+ import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js";
4
+ import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
5
+ import { NumericValuesSelection } from "../utilitiesNumericValues.js";
6
+ import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
7
+ import { _CfgProductConfigurationInternal } from "./CfgProductConfiguration.js";
8
+ export declare type OptionChangeNotification = {
9
+ freshRef: CfgOption;
10
+ committed: boolean;
11
+ };
12
+ export declare enum ProductConfigurationBubbleMode {
13
+ /**
14
+ * If this is select it will turns on all ancestors all the way up.
15
+ */
16
+ BubbleSelected = "BubbleSelected",
17
+ /**
18
+ * Bubble to the closest CfgProduct, let it revalidate, then that will continue the bubble
19
+ * after validate.
20
+ */
21
+ Validate = "Validate",
22
+ /**
23
+ * Bubble to the closest CfgProduct, let it revalidate, then that will continue the bubble
24
+ * after validate. If this is select it will turn on all ancestors all the way up.
25
+ * So with this mode it is possible to select an option where its parents are not selected.
26
+ */
27
+ ValidateAndBubbleSelected = "ValidateAndBubbleSelected",
28
+ /**
29
+ * Like ValidateAndBubbleSelected, but SyncGroups are applied after ValidateAndBubbleSelected
30
+ * has been done
31
+ */
32
+ ValidateAndBubbleSelectedAndApplySyncGroups = "ValidateAndBubbleSelectedAndApplySyncGroups",
33
+ /**
34
+ * Stop bubbling
35
+ * This mode supports internal functionality and is not expected to be used by integrators.
36
+ */
37
+ Stop = "Stop",
38
+ /**
39
+ * Bubble to the next level up the tree. In features-options the next level is considered
40
+ * the next feature, so option levels are skipped over. The node we call from notifies its
41
+ * parent, and the parent switches out the reference to the node. Then bubbling stops.
42
+ * This mode supports internal functionality and is not expected to be used by integrators.
43
+ */
44
+ OneLevel = "OneLevel",
45
+ /**
46
+ * Bubble to the closest CfgProduct without doing any validation
47
+ * This mode supports internal functionality and is not expected to be used by integrators.
48
+ */
49
+ ToParentProduct = "ToParentProduct",
50
+ /**
51
+ * Bubble to the root CfgProduct
52
+ * This mode supports internal functionality and is not expected to be used by integrators.
53
+ */
54
+ ToRoot = "ToRoot"
55
+ }
56
+ /**
57
+ * This class is only meant to be used through CfgOption. It should never be instantiated on its
58
+ * own. Normally the internal state of this class should never be directly modified. CfgOption is
59
+ * the class that should be used and interacted with.
60
+ */
61
+ export declare class _CfgOptionInternal {
62
+ readonly rawOption: DtoOption;
63
+ private readonly allRawFeatures;
64
+ readonly parent: _CfgFeatureInternal;
65
+ readonly parentConfiguration: _CfgProductConfigurationInternal;
66
+ readonly parentProduct: _CfgProductInternal;
67
+ readonly rootProduct: _CfgProductInternal;
68
+ constructor(rawOption: DtoOption, allRawFeatures: DtoFeature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal);
69
+ private _features;
70
+ private _mtrlApplications;
71
+ readonly key: string;
72
+ private _numericValue;
73
+ readonly allowedNumericValues: NumericValuesSelection | undefined;
74
+ isAllowedNumericValue(val: number): boolean;
75
+ readonly changeObservable: Observable<OptionChangeNotification>;
76
+ get code(): string;
77
+ get isUseNumericValue(): boolean;
78
+ get numericValue(): number | undefined;
79
+ setNumericValue(val: number, doSelectOption: boolean): Promise<boolean>;
80
+ get unit(): LengthUnit;
81
+ get description(): string;
82
+ get selected(): boolean;
83
+ get selectedChangeInProgress(): boolean;
84
+ get ancestorsSelected(): boolean;
85
+ get mtrlApplications(): CfgMtrlApplication[];
86
+ get thumbnail(): string | undefined;
87
+ get upcharge(): number | undefined;
88
+ get priceChangeAtSelectChange(): number | undefined;
89
+ get features(): CfgFeature[];
90
+ /** Called by child to tell its parent that it has changed. */
91
+ _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
92
+ getDtoConf: (includeExtendedData: boolean) => DtoConfOption;
93
+ setApiSelection: (apiOptionSelection: DtoSelectedOption | undefined) => Promise<boolean>;
94
+ structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
95
+ tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise<boolean>;
96
+ keyMatch: (other: _CfgOptionInternal, descriptionMatch?: boolean) => boolean;
97
+ _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
98
+ _freshRefDescendants(): void;
99
+ }
100
+ export declare class CfgOption {
101
+ readonly _internal: _CfgOptionInternal;
102
+ static make(rawOption: DtoOption, allRawFeatures: DtoFeature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgOption;
103
+ /**
104
+ * Makes an object wrapping the passed object. This is not a clone method,
105
+ * it is a method to make a new outer reference. Like a shallow copy.
106
+ * We use this to help frameworks that are build around using equals to detect change.
107
+ */
108
+ static _makeNewRefFrom(internal: _CfgOptionInternal): CfgOption;
109
+ /**
110
+ * Private constructor and make-method because make new ref requires the constructor to
111
+ * take an internal and we don't want those who instantiate CfgOption to have to be aware
112
+ * of the internal.
113
+ */
114
+ private constructor();
115
+ isBackedBySame: (other: CfgOption) => boolean;
116
+ get parentProduct(): CfgProduct;
117
+ get rootProduct(): CfgProduct;
118
+ get rawOption(): DtoOption;
119
+ get key(): string;
120
+ get code(): string;
121
+ get isUseNumericValue(): boolean;
122
+ get numericValue(): number | undefined;
123
+ setNumericValue: (val: number, doSelectOption: boolean) => Promise<boolean>;
124
+ get allowedNumericValues(): NumericValuesSelection | undefined;
125
+ isAllowedNumericValue: (val: number) => boolean;
126
+ get unit(): LengthUnit;
127
+ get description(): string;
128
+ get selected(): boolean;
129
+ /**
130
+ * Selection state is in progress to be changed. This can be used in GUI
131
+ * to display the state as transitioning, or as already changed.
132
+ * If selectedChangeInProgress and:
133
+ * selected is true, it means that this is about to get unselected
134
+ * selected is false, it means that this is about to get selected
135
+ */
136
+ get selectedChangeInProgress(): boolean;
137
+ /** Are all ancestors up to the CfgProductConfiguration selected? Includes self. */
138
+ get ancestorsSelected(): boolean;
139
+ /**
140
+ * Selects this Option.
141
+ * Only Options belonging to Features that are "select many" can be deselected.
142
+ * Calling this will cause a validation call to the server.
143
+ */
144
+ setSelected: (on: boolean) => Promise<boolean>;
145
+ get thumbnail(): string | undefined;
146
+ get upcharge(): number | undefined;
147
+ get priceChangeAtSelectChange(): number | undefined;
148
+ get features(): CfgFeature[];
149
+ listenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
150
+ stopListenForChange: (l: SingleArgCallback<OptionChangeNotification>) => void;
151
+ }
129
152
  //# sourceMappingURL=CfgOption.d.ts.map