@configura/web-api 1.6.0-iotest.2 → 1.6.1-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.
- package/dist/CfgProduct.d.ts +29 -10
- package/dist/CfgProduct.js +82 -47
- package/dist/index.d.ts +2 -4
- package/dist/index.js +2 -4
- package/dist/productConfiguration/CfgFeature.d.ts +2 -1
- package/dist/productConfiguration/CfgFeature.js +27 -8
- package/dist/productConfiguration/CfgOption.d.ts +21 -8
- package/dist/productConfiguration/CfgOption.js +26 -18
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +1 -2
- package/dist/productConfiguration/CfgProductConfiguration.js +9 -8
- package/dist/syncGroups/SyncGroupsApplier.d.ts +20 -0
- package/dist/syncGroups/SyncGroupsApplier.js +520 -0
- package/dist/syncGroups/SyncGroupsApplyMode.d.ts +21 -0
- package/dist/syncGroups/SyncGroupsApplyMode.js +21 -0
- package/dist/syncGroups/SyncGroupsHandler.d.ts +31 -0
- package/dist/syncGroups/SyncGroupsHandler.js +71 -0
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +27 -0
- package/dist/syncGroups/SyncGroupsPathHelper.js +89 -0
- package/dist/syncGroups/SyncGroupsState.d.ts +20 -0
- package/dist/syncGroups/SyncGroupsState.js +108 -0
- package/dist/syncGroups/SyncGroupsTransaction.d.ts +51 -0
- package/dist/syncGroups/SyncGroupsTransaction.js +100 -0
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +24 -95
- package/dist/tests/testData/testDataCachedGetProduct.js +8 -19
- package/dist/tests/testData/testDataOptions.d.ts +13 -0
- package/dist/tests/testData/testDataOptions.js +60 -0
- package/dist/tests/testData/testDataProductAggregatedPrice.js +12 -23
- package/dist/tests/testData/testDataUpcharge.js +16 -48
- package/dist/utilitiesCatalogueData.d.ts +7 -1
- package/dist/utilitiesCatalogueData.js +105 -4
- package/package.json +3 -3
- package/dist/io/CfgHistoryManager.d.ts +0 -30
- package/dist/io/CfgHistoryManager.js +0 -62
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +0 -10
- package/dist/io/CfgHistoryToProdConfConnector.js +0 -20
- package/dist/io/CfgIOManager.d.ts +0 -29
- package/dist/io/CfgIOManager.js +0 -89
- package/dist/io/CfgIOProdConfConnector.d.ts +0 -33
- package/dist/io/CfgIOProdConfConnector.js +0 -100
- package/dist/io/CfgWindowMessageManager.d.ts +0 -13
- package/dist/io/CfgWindowMessageManager.js +0 -28
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +0 -13
- package/dist/io/CfgWindowMessageToProdConfConnector.js +0 -17
|
@@ -10,16 +10,25 @@ export declare type OptionChangeNotification = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare enum ProductConfigurationBubbleMode {
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
|
|
13
|
+
* If this is select it will turns on all ancestors all the way up.
|
|
14
|
+
*/
|
|
15
|
+
BubbleSelected = "BubbleSelected",
|
|
16
|
+
/**
|
|
17
|
+
* Bubble to the closest CfgProduct, let it revalidate, then that will continue the bubble
|
|
18
|
+
* after validate.
|
|
15
19
|
*/
|
|
16
20
|
Validate = "Validate",
|
|
17
21
|
/**
|
|
18
|
-
* Bubble to the closest CfgProduct, let it revalidate, then that will continue
|
|
19
|
-
*
|
|
22
|
+
* Bubble to the closest CfgProduct, let it revalidate, then that will continue the bubble
|
|
23
|
+
* after validate. If this is select it will turn on all ancestors all the way up.
|
|
20
24
|
* So with this mode it is possible to select an option where its parents are not selected.
|
|
21
25
|
*/
|
|
22
26
|
ValidateAndBubbleSelected = "ValidateAndBubbleSelected",
|
|
27
|
+
/**
|
|
28
|
+
* Like ValidateAndBubbleSelected, but SyncGroups are applied after ValidateAndBubbleSelected
|
|
29
|
+
* has been done
|
|
30
|
+
*/
|
|
31
|
+
ValidateAndBubbleSelectedAndApplySyncGroups = "ValidateAndBubbleSelectedAndApplySyncGroups",
|
|
23
32
|
/**
|
|
24
33
|
* Stop bubbling
|
|
25
34
|
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
@@ -44,10 +53,9 @@ export declare enum ProductConfigurationBubbleMode {
|
|
|
44
53
|
ToRoot = "ToRoot"
|
|
45
54
|
}
|
|
46
55
|
/**
|
|
47
|
-
* This class is meant to
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* should be used and interacted with.
|
|
56
|
+
* This class is only meant to be used through CfgOption. It should never be instantiated on its
|
|
57
|
+
* own. Normally the internal state of this class should never be directly modified. CfgOption is
|
|
58
|
+
* the class that should be used and interacted with.
|
|
51
59
|
*/
|
|
52
60
|
export declare class _CfgOptionInternal {
|
|
53
61
|
readonly rawOption: Option;
|
|
@@ -118,6 +126,11 @@ export declare class CfgOption {
|
|
|
118
126
|
get selected(): boolean;
|
|
119
127
|
/** Are all ancestors up to the CfgProductConfiguration selected? Includes self. */
|
|
120
128
|
get ancestorsSelected(): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Selects this Option.
|
|
131
|
+
* Only Options belonging to Features that are "select many" can be deselected.
|
|
132
|
+
* Calling this will cause a validation call to the server.
|
|
133
|
+
*/
|
|
121
134
|
setSelected: (on: boolean) => Promise<boolean>;
|
|
122
135
|
get thumbnail(): string | undefined;
|
|
123
136
|
get upcharge(): number | undefined;
|
|
@@ -18,16 +18,25 @@ import { getMtrlPreview, syncCfgFeatures } from "./utilitiesProductConfiguration
|
|
|
18
18
|
export var ProductConfigurationBubbleMode;
|
|
19
19
|
(function (ProductConfigurationBubbleMode) {
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
|
|
21
|
+
* If this is select it will turns on all ancestors all the way up.
|
|
22
|
+
*/
|
|
23
|
+
ProductConfigurationBubbleMode["BubbleSelected"] = "BubbleSelected";
|
|
24
|
+
/**
|
|
25
|
+
* Bubble to the closest CfgProduct, let it revalidate, then that will continue the bubble
|
|
26
|
+
* after validate.
|
|
23
27
|
*/
|
|
24
28
|
ProductConfigurationBubbleMode["Validate"] = "Validate";
|
|
25
29
|
/**
|
|
26
|
-
* Bubble to the closest CfgProduct, let it revalidate, then that will continue
|
|
27
|
-
*
|
|
30
|
+
* Bubble to the closest CfgProduct, let it revalidate, then that will continue the bubble
|
|
31
|
+
* after validate. If this is select it will turn on all ancestors all the way up.
|
|
28
32
|
* So with this mode it is possible to select an option where its parents are not selected.
|
|
29
33
|
*/
|
|
30
34
|
ProductConfigurationBubbleMode["ValidateAndBubbleSelected"] = "ValidateAndBubbleSelected";
|
|
35
|
+
/**
|
|
36
|
+
* Like ValidateAndBubbleSelected, but SyncGroups are applied after ValidateAndBubbleSelected
|
|
37
|
+
* has been done
|
|
38
|
+
*/
|
|
39
|
+
ProductConfigurationBubbleMode["ValidateAndBubbleSelectedAndApplySyncGroups"] = "ValidateAndBubbleSelectedAndApplySyncGroups";
|
|
31
40
|
/**
|
|
32
41
|
* Stop bubbling
|
|
33
42
|
* This mode supports internal functionality and is not expected to be used by integrators.
|
|
@@ -66,10 +75,9 @@ function doesChildrenShareOptionsCode(features) {
|
|
|
66
75
|
return false;
|
|
67
76
|
}
|
|
68
77
|
/**
|
|
69
|
-
* This class is meant to
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* should be used and interacted with.
|
|
78
|
+
* This class is only meant to be used through CfgOption. It should never be instantiated on its
|
|
79
|
+
* own. Normally the internal state of this class should never be directly modified. CfgOption is
|
|
80
|
+
* the class that should be used and interacted with.
|
|
73
81
|
*/
|
|
74
82
|
export class _CfgOptionInternal {
|
|
75
83
|
constructor(rawOption, allRawFeatures, siblingHasDuplicateDescription, parent, parentConfiguration, parentProduct, rootProduct) {
|
|
@@ -93,7 +101,8 @@ export class _CfgOptionInternal {
|
|
|
93
101
|
features[i] = freshRef;
|
|
94
102
|
// In CfgOption we let stop bubble slip through. This is because CfgOption is sort of
|
|
95
103
|
// a semi level. Like Feature + Option together constitutes one level.
|
|
96
|
-
if (bubbleMode === ProductConfigurationBubbleMode.ValidateAndBubbleSelected
|
|
104
|
+
if (bubbleMode === ProductConfigurationBubbleMode.ValidateAndBubbleSelected ||
|
|
105
|
+
bubbleMode === ProductConfigurationBubbleMode.BubbleSelected) {
|
|
97
106
|
// selectOption takes care of the bubble
|
|
98
107
|
yield this.parent.selectOption(this, true, bubbleMode);
|
|
99
108
|
}
|
|
@@ -170,9 +179,8 @@ export class _CfgOptionInternal {
|
|
|
170
179
|
agg.push(...feature._internal._getFeaturesWithCode(code));
|
|
171
180
|
return agg;
|
|
172
181
|
}, []);
|
|
173
|
-
// Description based key helps when switching between
|
|
174
|
-
//
|
|
175
|
-
// to retain made selection
|
|
182
|
+
// Description based key helps when switching between products with similar feature-options
|
|
183
|
+
// tree and trying to retain made selection.
|
|
176
184
|
this.key =
|
|
177
185
|
this.description +
|
|
178
186
|
(this.description === "" || siblingHasDuplicateDescription ? this.code : "");
|
|
@@ -219,9 +227,9 @@ export class _CfgOptionInternal {
|
|
|
219
227
|
this._numericValue = val;
|
|
220
228
|
change = true;
|
|
221
229
|
}
|
|
222
|
-
// It could be that even though our value did not change some sibling value did, and
|
|
223
|
-
// could make it needed to bubble later. Maybe. A bit uncertain about why I did
|
|
224
|
-
// this in the if-statement above //Linus
|
|
230
|
+
// It could be that even though our value did not change some sibling value did, and
|
|
231
|
+
// this could make it needed to bubble later. Maybe. A bit uncertain about why I did
|
|
232
|
+
// not put this in the if-statement above //Linus
|
|
225
233
|
if (yield this.parent.pushStretch()) {
|
|
226
234
|
change = true;
|
|
227
235
|
}
|
|
@@ -233,7 +241,7 @@ export class _CfgOptionInternal {
|
|
|
233
241
|
}
|
|
234
242
|
else {
|
|
235
243
|
if (change) {
|
|
236
|
-
yield this.parent._childHasChanged(this, ProductConfigurationBubbleMode.
|
|
244
|
+
yield this.parent._childHasChanged(this, ProductConfigurationBubbleMode.OneLevel);
|
|
237
245
|
}
|
|
238
246
|
}
|
|
239
247
|
return change;
|
|
@@ -320,13 +328,13 @@ export class CfgOption {
|
|
|
320
328
|
this.isBackedBySame = (other) => this._internal === other._internal;
|
|
321
329
|
this.setNumericValue = (val, doSelectOption) => __awaiter(this, void 0, void 0, function* () { return yield this._internal.setNumericValue(val, doSelectOption); });
|
|
322
330
|
this.isAllowedNumericValue = (val) => this._internal.isAllowedNumericValue(val);
|
|
323
|
-
|
|
331
|
+
/**
|
|
324
332
|
* Selects this Option.
|
|
325
333
|
* Only Options belonging to Features that are "select many" can be deselected.
|
|
326
334
|
* Calling this will cause a validation call to the server.
|
|
327
335
|
*/
|
|
328
336
|
this.setSelected = (on) => __awaiter(this, void 0, void 0, function* () {
|
|
329
|
-
return yield this._internal.parent.selectOption(this._internal, on, ProductConfigurationBubbleMode.
|
|
337
|
+
return yield this._internal.parent.selectOption(this._internal, on, ProductConfigurationBubbleMode.ValidateAndBubbleSelectedAndApplySyncGroups);
|
|
330
338
|
});
|
|
331
339
|
this.listenForChange = (l) => this._internal.changeObservable.listen(l);
|
|
332
340
|
this.stopListenForChange = (l) => this._internal.changeObservable.stopListen(l);
|
|
@@ -5,7 +5,6 @@ import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js";
|
|
|
5
5
|
import { ProductConfigurationBubbleMode } from "./CfgOption.js";
|
|
6
6
|
export declare type ProductConfigurationChangeNotification = {
|
|
7
7
|
freshRef: CfgProductConfiguration;
|
|
8
|
-
committed: boolean;
|
|
9
8
|
};
|
|
10
9
|
export declare type LengthValue = {
|
|
11
10
|
length: number;
|
|
@@ -53,7 +52,7 @@ export declare class _CfgProductConfigurationInternal {
|
|
|
53
52
|
/** Only selected features. */
|
|
54
53
|
_getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
|
|
55
54
|
populateFeatures: (rootFeatureRefs: FeatureRef[]) => void;
|
|
56
|
-
setStretchReferenceLength: (measureParamCode: string, referenceLength: number | undefined, unit: LengthUnit) => Promise<boolean>;
|
|
55
|
+
setStretchReferenceLength: (measureParamCode: string, referenceLength: number | undefined, unit: LengthUnit, doNotify?: boolean) => Promise<boolean>;
|
|
57
56
|
}
|
|
58
57
|
export declare class CfgProductConfiguration {
|
|
59
58
|
readonly _internal: _CfgProductConfigurationInternal;
|
|
@@ -27,7 +27,7 @@ export class _CfgProductConfigurationInternal {
|
|
|
27
27
|
this._rootFeatureRefs = [];
|
|
28
28
|
this._features = [];
|
|
29
29
|
this.changeObservable = new Observable();
|
|
30
|
-
this._notifyAllOfChange = (bubbleMode
|
|
30
|
+
this._notifyAllOfChange = (bubbleMode) => __awaiter(this, void 0, void 0, function* () {
|
|
31
31
|
if (bubbleMode === ProductConfigurationBubbleMode.Stop) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
@@ -35,14 +35,13 @@ export class _CfgProductConfigurationInternal {
|
|
|
35
35
|
const parent = this.parentProduct;
|
|
36
36
|
this.changeObservable.notifyAll({
|
|
37
37
|
freshRef,
|
|
38
|
-
committed,
|
|
39
38
|
});
|
|
40
39
|
if (parent === undefined) {
|
|
41
40
|
return;
|
|
42
41
|
}
|
|
43
42
|
yield parent._configurationHasChanged(freshRef, bubbleMode === ProductConfigurationBubbleMode.OneLevel
|
|
44
43
|
? ProductConfigurationBubbleMode.Stop
|
|
45
|
-
: bubbleMode
|
|
44
|
+
: bubbleMode);
|
|
46
45
|
});
|
|
47
46
|
/** Called by child to tell its parent that it has changed. */
|
|
48
47
|
this._childHasChanged = (freshRef, bubbleMode) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -52,7 +51,7 @@ export class _CfgProductConfigurationInternal {
|
|
|
52
51
|
throw Error("Child feature not found");
|
|
53
52
|
}
|
|
54
53
|
features[i] = freshRef;
|
|
55
|
-
yield this._notifyAllOfChange(bubbleMode
|
|
54
|
+
yield this._notifyAllOfChange(bubbleMode);
|
|
56
55
|
});
|
|
57
56
|
this.getApiSelection = () => this._features.map((f) => {
|
|
58
57
|
return { code: "!~!", next: f._internal.getApiSelection() };
|
|
@@ -71,7 +70,7 @@ export class _CfgProductConfigurationInternal {
|
|
|
71
70
|
if (change) {
|
|
72
71
|
yield this._notifyAllOfChange(bubbleToRoot
|
|
73
72
|
? ProductConfigurationBubbleMode.ToRoot
|
|
74
|
-
: ProductConfigurationBubbleMode.OneLevel
|
|
73
|
+
: ProductConfigurationBubbleMode.OneLevel);
|
|
75
74
|
}
|
|
76
75
|
return change;
|
|
77
76
|
});
|
|
@@ -103,7 +102,7 @@ export class _CfgProductConfigurationInternal {
|
|
|
103
102
|
if (change) {
|
|
104
103
|
yield this._notifyAllOfChange(validate
|
|
105
104
|
? ProductConfigurationBubbleMode.Validate
|
|
106
|
-
: ProductConfigurationBubbleMode.OneLevel
|
|
105
|
+
: ProductConfigurationBubbleMode.OneLevel);
|
|
107
106
|
}
|
|
108
107
|
return change;
|
|
109
108
|
});
|
|
@@ -116,7 +115,7 @@ export class _CfgProductConfigurationInternal {
|
|
|
116
115
|
this._rootFeatureRefs = rootFeatureRefs;
|
|
117
116
|
this._features = syncCfgFeatures(rootFeatureRefs, this._features, this.allRawFeatures, this, this, this.parentProduct, this.rootProduct);
|
|
118
117
|
};
|
|
119
|
-
this.setStretchReferenceLength = (measureParamCode, referenceLength, unit) => __awaiter(this, void 0, void 0, function* () {
|
|
118
|
+
this.setStretchReferenceLength = (measureParamCode, referenceLength, unit, doNotify = true) => __awaiter(this, void 0, void 0, function* () {
|
|
120
119
|
if (measureParamCode === "") {
|
|
121
120
|
return false;
|
|
122
121
|
}
|
|
@@ -147,7 +146,9 @@ export class _CfgProductConfigurationInternal {
|
|
|
147
146
|
}
|
|
148
147
|
stretchReferenceLength.current = referenceLengthWithUnit;
|
|
149
148
|
}
|
|
150
|
-
|
|
149
|
+
if (doNotify) {
|
|
150
|
+
yield this._notifyAllOfChange(ProductConfigurationBubbleMode.ToRoot);
|
|
151
|
+
}
|
|
151
152
|
return true;
|
|
152
153
|
});
|
|
153
154
|
// Useful debug tool:
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SyncGroup } from "../CatalogueAPI.js";
|
|
2
|
+
import { _CfgOptionInternal } from "../productConfiguration/CfgOption.js";
|
|
3
|
+
import { SyncCode } from "./SyncGroupsHandler.js";
|
|
4
|
+
import { SyncGroupsTransaction } from "./SyncGroupsTransaction.js";
|
|
5
|
+
export declare class SyncGroupsApplier {
|
|
6
|
+
/**
|
|
7
|
+
* At load of a new product this is used to move it into a synced state
|
|
8
|
+
*/
|
|
9
|
+
static init(transaction: SyncGroupsTransaction): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* At an active select of an option this is the entry point
|
|
12
|
+
*/
|
|
13
|
+
static selectOption(transaction: SyncGroupsTransaction, option: _CfgOptionInternal, on: boolean): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* @returns undefined if the @syncGroup is undefined, false if
|
|
16
|
+
* the @mustSupport is not fulfilled or the syncCode if all is ok
|
|
17
|
+
*/
|
|
18
|
+
static getSyncCode(syncGroup: SyncGroup | undefined, mustSupport: "push" | "pull"): SyncCode | undefined | false;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=SyncGroupsApplier.d.ts.map
|