@configura/web-api 1.6.1-alpha.7 → 1.6.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/.eslintrc.json +18 -0
- package/dist/CatalogueAPI.d.ts +4 -9
- package/dist/CatalogueAPI.js +6 -3
- package/dist/CfgProduct.d.ts +31 -12
- package/dist/CfgProduct.js +124 -45
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/productConfiguration/CfgFeature.d.ts +13 -3
- package/dist/productConfiguration/CfgFeature.js +77 -52
- package/dist/productConfiguration/CfgOption.d.ts +30 -8
- package/dist/productConfiguration/CfgOption.js +49 -17
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +1 -1
- package/dist/productConfiguration/CfgProductConfiguration.js +4 -2
- package/dist/productConfiguration/filters.js +7 -7
- package/dist/syncGroups/SyncGroupsApplyMode.d.ts +21 -0
- package/dist/syncGroups/SyncGroupsApplyMode.js +21 -0
- package/dist/syncGroups/SyncGroupsHandler.d.ts +41 -0
- package/dist/syncGroups/SyncGroupsHandler.js +358 -0
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +27 -0
- package/dist/syncGroups/SyncGroupsPathHelper.js +90 -0
- package/dist/syncGroups/SyncGroupsState.d.ts +36 -0
- package/dist/syncGroups/SyncGroupsState.js +125 -0
- package/dist/syncGroups/SyncGroupsTransaction.d.ts +155 -0
- package/dist/syncGroups/SyncGroupsTransaction.js +576 -0
- package/dist/tasks/TaskHandler.d.ts +1 -1
- package/dist/tasks/TaskHandler.js +20 -9
- package/dist/tests/testData/collectorForTest.d.ts +1 -1
- package/dist/tests/testData/collectorForTest.js +1 -2
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +3 -24
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +30 -101
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +1 -1
- package/dist/tests/testData/testDataCachedGetProduct.js +16 -27
- package/dist/tests/testData/testDataCachedPostValidate.js +5 -5
- package/dist/tests/testData/testDataOptions.d.ts +13 -0
- package/dist/tests/testData/testDataOptions.js +60 -0
- package/dist/tests/testData/testDataProductAggregatedPrice.js +19 -30
- package/dist/tests/testData/testDataUpcharge.d.ts +3 -24
- package/dist/tests/testData/testDataUpcharge.js +17 -49
- package/dist/utilitiesCatalogueData.d.ts +8 -2
- package/dist/utilitiesCatalogueData.js +105 -9
- package/dist/utilitiesCataloguePermission.d.ts +1 -3
- package/dist/utilitiesCataloguePermission.js +10 -14
- package/package.json +3 -3
|
@@ -6,7 +6,7 @@ declare type SnapShotForWrapper = {
|
|
|
6
6
|
path: string;
|
|
7
7
|
selected: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare type SnapShotForWrapperWithoutRef = SnapShotForWrapper & {
|
|
9
|
+
export declare type SnapShotForWrapperWithoutRef = SnapShotForWrapper & {
|
|
10
10
|
productConfiguration: SnapShotForConfiguration;
|
|
11
11
|
additionalProducts: SnapShotForWrapper[];
|
|
12
12
|
};
|
|
@@ -162,8 +162,7 @@ export class Collector {
|
|
|
162
162
|
this.addListenersForFeature(path, feature);
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
-
|
|
166
|
-
this.addListenersForProduct(path, product);
|
|
165
|
+
this.addListenersForProduct("", product);
|
|
167
166
|
}
|
|
168
167
|
}
|
|
169
168
|
Collector.stripRefsForWrapper = (w) => {
|
package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
import { GetProductParams } from "../../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
3
|
import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
|
|
4
|
+
import { SnapShotForWrapperWithoutRef } from "./collectorForTest.js";
|
|
4
5
|
export declare const getTestProduct: (params: GetProductParams) => Promise<CfgProductResponse>;
|
|
5
6
|
export declare const cfgProductTest: (testFunc: (product: CfgProduct) => Promise<void>, prepFunc?: ((product: CfgProduct) => Promise<void>) | undefined) => Promise<{
|
|
6
|
-
beforeSnapshot:
|
|
7
|
-
|
|
8
|
-
selected: boolean;
|
|
9
|
-
} & {
|
|
10
|
-
productConfiguration: {
|
|
11
|
-
path: string;
|
|
12
|
-
};
|
|
13
|
-
additionalProducts: {
|
|
14
|
-
path: string;
|
|
15
|
-
selected: boolean;
|
|
16
|
-
}[];
|
|
17
|
-
};
|
|
18
|
-
afterSnapshot: {
|
|
19
|
-
path: string;
|
|
20
|
-
selected: boolean;
|
|
21
|
-
} & {
|
|
22
|
-
productConfiguration: {
|
|
23
|
-
path: string;
|
|
24
|
-
};
|
|
25
|
-
additionalProducts: {
|
|
26
|
-
path: string;
|
|
27
|
-
selected: boolean;
|
|
28
|
-
}[];
|
|
29
|
-
};
|
|
7
|
+
beforeSnapshot: SnapShotForWrapperWithoutRef;
|
|
8
|
+
afterSnapshot: SnapShotForWrapperWithoutRef;
|
|
30
9
|
diff: string[];
|
|
31
10
|
notifications: string[];
|
|
32
11
|
}>;
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
11
11
|
import { Collector } from "./collectorForTest.js";
|
|
12
12
|
import { dummyCatId } from "./dummyProductForTest.js";
|
|
13
|
+
import { letterOptionCodeA, letterOptionCodeB, letterOptionCodeC, letterOptions, } from "./testDataOptions.js";
|
|
13
14
|
const A = () => ({
|
|
14
15
|
uuid: "A",
|
|
15
16
|
unit: "m",
|
|
@@ -19,96 +20,37 @@ const A = () => ({
|
|
|
19
20
|
description: "",
|
|
20
21
|
numericOrder: false,
|
|
21
22
|
options: [
|
|
22
|
-
{
|
|
23
|
-
code: "optionA",
|
|
24
|
-
description: "",
|
|
25
|
-
additionalProductRefs: [
|
|
23
|
+
Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
|
|
26
24
|
{ refKey: "C_0", catId: dummyCatId, partNumber: "C" },
|
|
27
25
|
{ refKey: "B_0", catId: dummyCatId, partNumber: "B" },
|
|
28
|
-
],
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
code: "optionB",
|
|
32
|
-
description: "",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
code: "optionC",
|
|
36
|
-
description: "",
|
|
37
|
-
additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
|
|
38
|
-
},
|
|
26
|
+
] }),
|
|
27
|
+
letterOptions[1],
|
|
28
|
+
Object.assign(Object.assign({}, letterOptions[2]), { additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }] }),
|
|
39
29
|
],
|
|
40
30
|
},
|
|
41
31
|
{
|
|
42
32
|
code: "featureX",
|
|
43
33
|
description: "",
|
|
44
34
|
numericOrder: false,
|
|
45
|
-
options: [
|
|
46
|
-
{
|
|
47
|
-
code: "optionA",
|
|
48
|
-
description: "",
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
code: "optionB",
|
|
52
|
-
description: "",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
code: "optionC",
|
|
56
|
-
description: "",
|
|
57
|
-
},
|
|
58
|
-
],
|
|
35
|
+
options: [...letterOptions],
|
|
59
36
|
},
|
|
60
37
|
{
|
|
61
38
|
code: "featureNotUsed",
|
|
62
39
|
description: "",
|
|
63
40
|
numericOrder: false,
|
|
64
|
-
options: [
|
|
65
|
-
{
|
|
66
|
-
code: "optionA",
|
|
67
|
-
description: "",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
code: "optionB",
|
|
71
|
-
description: "",
|
|
72
|
-
},
|
|
73
|
-
],
|
|
41
|
+
options: [...letterOptions],
|
|
74
42
|
},
|
|
75
43
|
{
|
|
76
44
|
code: "featureOptionCSelectedAtStart",
|
|
77
45
|
description: "",
|
|
78
46
|
numericOrder: false,
|
|
79
|
-
options: [
|
|
80
|
-
{
|
|
81
|
-
code: "optionA",
|
|
82
|
-
description: "",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
code: "optionB",
|
|
86
|
-
description: "",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
code: "optionC",
|
|
90
|
-
description: "",
|
|
91
|
-
},
|
|
92
|
-
],
|
|
47
|
+
options: [...letterOptions],
|
|
93
48
|
},
|
|
94
49
|
{
|
|
95
50
|
code: "featureSelectMany",
|
|
96
51
|
description: "",
|
|
97
52
|
numericOrder: false,
|
|
98
|
-
options: [
|
|
99
|
-
{
|
|
100
|
-
code: "optionA",
|
|
101
|
-
description: "",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
code: "optionB",
|
|
105
|
-
description: "",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
code: "optionC",
|
|
109
|
-
description: "",
|
|
110
|
-
},
|
|
111
|
-
],
|
|
53
|
+
options: [...letterOptions],
|
|
112
54
|
},
|
|
113
55
|
],
|
|
114
56
|
productData: {
|
|
@@ -123,24 +65,24 @@ const A = () => ({
|
|
|
123
65
|
{
|
|
124
66
|
code: "!~!",
|
|
125
67
|
next: {
|
|
126
|
-
|
|
127
|
-
code:
|
|
68
|
+
[letterOptionCodeA]: {
|
|
69
|
+
code: letterOptionCodeA,
|
|
128
70
|
},
|
|
129
71
|
},
|
|
130
72
|
},
|
|
131
73
|
{
|
|
132
74
|
code: "!~!",
|
|
133
75
|
next: {
|
|
134
|
-
|
|
135
|
-
code:
|
|
76
|
+
[letterOptionCodeB]: {
|
|
77
|
+
code: letterOptionCodeB,
|
|
136
78
|
},
|
|
137
79
|
},
|
|
138
80
|
},
|
|
139
81
|
{
|
|
140
82
|
code: "!~!",
|
|
141
83
|
next: {
|
|
142
|
-
|
|
143
|
-
code:
|
|
84
|
+
[letterOptionCodeC]: {
|
|
85
|
+
code: letterOptionCodeC,
|
|
144
86
|
},
|
|
145
87
|
},
|
|
146
88
|
},
|
|
@@ -219,20 +161,7 @@ const C = () => ({
|
|
|
219
161
|
code: "featureC",
|
|
220
162
|
description: "",
|
|
221
163
|
numericOrder: false,
|
|
222
|
-
options: [
|
|
223
|
-
{
|
|
224
|
-
code: "optionA",
|
|
225
|
-
description: "",
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
code: "optionB",
|
|
229
|
-
description: "",
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
code: "optionC",
|
|
233
|
-
description: "",
|
|
234
|
-
},
|
|
235
|
-
],
|
|
164
|
+
options: [...letterOptions],
|
|
236
165
|
},
|
|
237
166
|
],
|
|
238
167
|
productData: {
|
|
@@ -246,8 +175,8 @@ const C = () => ({
|
|
|
246
175
|
{
|
|
247
176
|
code: "!~!",
|
|
248
177
|
next: {
|
|
249
|
-
|
|
250
|
-
code:
|
|
178
|
+
[letterOptionCodeA]: {
|
|
179
|
+
code: letterOptionCodeA,
|
|
251
180
|
},
|
|
252
181
|
},
|
|
253
182
|
},
|
|
@@ -274,20 +203,20 @@ const D = () => ({
|
|
|
274
203
|
},
|
|
275
204
|
rootFeatureRefs: [],
|
|
276
205
|
});
|
|
277
|
-
export const getTestProduct = (params) =>
|
|
206
|
+
export const getTestProduct = (params) => {
|
|
278
207
|
const partNumber = params.partNumber;
|
|
279
208
|
switch (partNumber) {
|
|
280
209
|
case "A":
|
|
281
|
-
return A();
|
|
210
|
+
return Promise.resolve(A());
|
|
282
211
|
case "B":
|
|
283
|
-
return B();
|
|
212
|
+
return Promise.resolve(B());
|
|
284
213
|
case "C":
|
|
285
|
-
return C();
|
|
214
|
+
return Promise.resolve(C());
|
|
286
215
|
case "D":
|
|
287
|
-
return D();
|
|
216
|
+
return Promise.resolve(D());
|
|
288
217
|
}
|
|
289
218
|
throw new Error("No such part");
|
|
290
|
-
}
|
|
219
|
+
};
|
|
291
220
|
export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0, void 0, function* () {
|
|
292
221
|
const product = yield CfgProduct.make({
|
|
293
222
|
getProduct: getTestProduct,
|
|
@@ -297,8 +226,8 @@ export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0,
|
|
|
297
226
|
{
|
|
298
227
|
code: "!~!",
|
|
299
228
|
next: {
|
|
300
|
-
|
|
301
|
-
code:
|
|
229
|
+
[letterOptionCodeC]: {
|
|
230
|
+
code: letterOptionCodeC,
|
|
302
231
|
},
|
|
303
232
|
},
|
|
304
233
|
},
|
|
@@ -307,16 +236,16 @@ export const cfgProductTest = (testFunc, prepFunc) => __awaiter(void 0, void 0,
|
|
|
307
236
|
productData.partsData.selOptions.push({
|
|
308
237
|
code: "!~!",
|
|
309
238
|
next: {
|
|
310
|
-
|
|
311
|
-
code:
|
|
239
|
+
[letterOptionCodeC]: {
|
|
240
|
+
code: letterOptionCodeC,
|
|
312
241
|
},
|
|
313
242
|
},
|
|
314
243
|
});
|
|
315
244
|
productData.partsData.selOptions.push({
|
|
316
245
|
code: "!~!",
|
|
317
246
|
next: {
|
|
318
|
-
|
|
319
|
-
code:
|
|
247
|
+
[letterOptionCodeC]: {
|
|
248
|
+
code: letterOptionCodeC,
|
|
320
249
|
},
|
|
321
250
|
},
|
|
322
251
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GetProductParams } from "../../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
3
|
import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
|
|
4
|
-
export declare const getTestProduct: (params: GetProductParams, validateCall?:
|
|
4
|
+
export declare const getTestProduct: (params: GetProductParams, validateCall?: boolean | undefined) => Promise<CfgProductResponse>;
|
|
5
5
|
export declare const cachedProductLoaderTest: () => Promise<CfgProduct>;
|
|
6
6
|
//# sourceMappingURL=testDataCachedGetProduct.d.ts.map
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
11
11
|
import { wrapWithGetProductCache } from "../../productLoader.js";
|
|
12
12
|
import { dummyCatId } from "./dummyProductForTest.js";
|
|
13
|
+
import { letterOptionCodeA, letterOptions } from "./testDataOptions.js";
|
|
13
14
|
let prodKeyArray = [];
|
|
14
15
|
const A = () => ({
|
|
15
16
|
uuid: "A",
|
|
@@ -20,24 +21,12 @@ const A = () => ({
|
|
|
20
21
|
description: "",
|
|
21
22
|
numericOrder: false,
|
|
22
23
|
options: [
|
|
23
|
-
{
|
|
24
|
-
code: "optionA",
|
|
25
|
-
description: "",
|
|
26
|
-
additionalProductRefs: [
|
|
24
|
+
Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
|
|
27
25
|
{ refKey: "C_0", catId: dummyCatId, partNumber: "C" },
|
|
28
26
|
{ refKey: "B_0", catId: dummyCatId, partNumber: "B" },
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
code: "optionB",
|
|
33
|
-
description: "",
|
|
34
|
-
additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
code: "optionC",
|
|
38
|
-
description: "",
|
|
39
|
-
additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
|
|
40
|
-
},
|
|
27
|
+
] }),
|
|
28
|
+
Object.assign(Object.assign({}, letterOptions[1]), { additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }] }),
|
|
29
|
+
Object.assign(Object.assign({}, letterOptions[2]), { additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }] }),
|
|
41
30
|
],
|
|
42
31
|
},
|
|
43
32
|
],
|
|
@@ -53,8 +42,8 @@ const A = () => ({
|
|
|
53
42
|
{
|
|
54
43
|
code: "!~!",
|
|
55
44
|
next: {
|
|
56
|
-
|
|
57
|
-
code:
|
|
45
|
+
[letterOptionCodeA]: {
|
|
46
|
+
code: letterOptionCodeA,
|
|
58
47
|
},
|
|
59
48
|
},
|
|
60
49
|
},
|
|
@@ -135,7 +124,7 @@ const E = () => ({
|
|
|
135
124
|
},
|
|
136
125
|
rootFeatureRefs: [],
|
|
137
126
|
});
|
|
138
|
-
export const getTestProduct = (params, validateCall) =>
|
|
127
|
+
export const getTestProduct = (params, validateCall) => {
|
|
139
128
|
const partNumber = params.partNumber;
|
|
140
129
|
if (validateCall !== true) {
|
|
141
130
|
if (prodKeyArray.indexOf(partNumber) > -1) {
|
|
@@ -147,26 +136,26 @@ export const getTestProduct = (params, validateCall) => __awaiter(void 0, void 0
|
|
|
147
136
|
}
|
|
148
137
|
switch (partNumber) {
|
|
149
138
|
case "A":
|
|
150
|
-
return A();
|
|
139
|
+
return Promise.resolve(A());
|
|
151
140
|
case "B":
|
|
152
|
-
return B();
|
|
141
|
+
return Promise.resolve(B());
|
|
153
142
|
case "C":
|
|
154
|
-
return C();
|
|
143
|
+
return Promise.resolve(C());
|
|
155
144
|
case "D":
|
|
156
|
-
return D();
|
|
145
|
+
return Promise.resolve(D());
|
|
157
146
|
case "E":
|
|
158
|
-
return E();
|
|
147
|
+
return Promise.resolve(E());
|
|
159
148
|
}
|
|
160
149
|
throw new Error("No such part");
|
|
161
|
-
}
|
|
150
|
+
};
|
|
162
151
|
export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
163
152
|
prodKeyArray = [];
|
|
164
153
|
const productLoader = {
|
|
165
154
|
getProduct: getTestProduct,
|
|
166
155
|
postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
156
|
const productData = (yield getTestProduct(params, true)).productData;
|
|
168
|
-
let code =
|
|
169
|
-
for (
|
|
157
|
+
let code = letterOptionCodeA;
|
|
158
|
+
for (const test in _body.selOptions[0].next) {
|
|
170
159
|
code = test;
|
|
171
160
|
break;
|
|
172
161
|
}
|
|
@@ -151,18 +151,18 @@ const LegWheel = () => ({
|
|
|
151
151
|
},
|
|
152
152
|
rootFeatureRefs: [{ code: "Color" }],
|
|
153
153
|
});
|
|
154
|
-
const getProduct = (params) =>
|
|
154
|
+
const getProduct = (params) => {
|
|
155
155
|
const partNumber = params.partNumber;
|
|
156
156
|
switch (partNumber) {
|
|
157
157
|
case "Table":
|
|
158
|
-
return Table();
|
|
158
|
+
return Promise.resolve(Table());
|
|
159
159
|
case "LegA":
|
|
160
|
-
return LegA();
|
|
160
|
+
return Promise.resolve(LegA());
|
|
161
161
|
case "LegWheel":
|
|
162
|
-
return LegWheel();
|
|
162
|
+
return Promise.resolve(LegWheel());
|
|
163
163
|
}
|
|
164
164
|
throw new Error("No such part");
|
|
165
|
-
}
|
|
165
|
+
};
|
|
166
166
|
export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
167
167
|
const validateCounter = { count: 0 };
|
|
168
168
|
const productLoader = {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Option, SelectedOption } from "../../CatalogueAPI.js";
|
|
2
|
+
export declare function addDefaultsToMockSelectedOption(root: SelectedOption, optionCodeToAdd: string | undefined, optionCodesToRemove: string[], unlessOptionCodes: string[]): void;
|
|
3
|
+
export declare const letterOptionCodeA = "optA";
|
|
4
|
+
export declare const letterOptionCodeB = "optB";
|
|
5
|
+
export declare const letterOptionCodeC = "optC";
|
|
6
|
+
export declare const letterOptionCodeD = "optD";
|
|
7
|
+
export declare const letterOptionCodeE = "optE";
|
|
8
|
+
export declare const letterOptionCodeF = "optF";
|
|
9
|
+
export declare const letterOptions: Option[];
|
|
10
|
+
export declare const toggleOptionCodeOff = "optOff";
|
|
11
|
+
export declare const toggleOptionCodeOn = "optOn";
|
|
12
|
+
export declare const toggleOptions: Option[];
|
|
13
|
+
//# sourceMappingURL=testDataOptions.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export function addDefaultsToMockSelectedOption(root, optionCodeToAdd, optionCodesToRemove, unlessOptionCodes) {
|
|
2
|
+
let next = root.next;
|
|
3
|
+
if (next === undefined) {
|
|
4
|
+
if (optionCodeToAdd === undefined) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
next = {};
|
|
8
|
+
root.next = next;
|
|
9
|
+
}
|
|
10
|
+
for (const oCode of unlessOptionCodes) {
|
|
11
|
+
if (next[oCode] !== undefined) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
for (const oCode of optionCodesToRemove) {
|
|
16
|
+
delete next[oCode];
|
|
17
|
+
}
|
|
18
|
+
if (optionCodeToAdd === undefined) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
next[optionCodeToAdd] = { code: optionCodeToAdd };
|
|
22
|
+
}
|
|
23
|
+
export const letterOptionCodeA = "optA";
|
|
24
|
+
export const letterOptionCodeB = "optB";
|
|
25
|
+
export const letterOptionCodeC = "optC";
|
|
26
|
+
export const letterOptionCodeD = "optD";
|
|
27
|
+
export const letterOptionCodeE = "optE";
|
|
28
|
+
export const letterOptionCodeF = "optF";
|
|
29
|
+
export const letterOptions = [
|
|
30
|
+
{
|
|
31
|
+
code: letterOptionCodeA,
|
|
32
|
+
description: "",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
code: letterOptionCodeB,
|
|
36
|
+
description: "",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
code: letterOptionCodeC,
|
|
40
|
+
description: "",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
code: letterOptionCodeD,
|
|
44
|
+
description: "",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
code: letterOptionCodeE,
|
|
48
|
+
description: "",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
code: letterOptionCodeF,
|
|
52
|
+
description: "",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
export const toggleOptionCodeOff = "optOff";
|
|
56
|
+
export const toggleOptionCodeOn = "optOn";
|
|
57
|
+
export const toggleOptions = [
|
|
58
|
+
{ code: toggleOptionCodeOff, description: "" },
|
|
59
|
+
{ code: toggleOptionCodeOn, description: "" },
|
|
60
|
+
];
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
11
11
|
import { dummyCatId } from "./dummyProductForTest.js";
|
|
12
|
+
import { letterOptionCodeA, letterOptionCodeB, letterOptionCodeC, letterOptions, } from "./testDataOptions.js";
|
|
12
13
|
const A = () => ({
|
|
13
14
|
uuid: "A",
|
|
14
15
|
unit: "m",
|
|
@@ -18,24 +19,12 @@ const A = () => ({
|
|
|
18
19
|
description: "",
|
|
19
20
|
numericOrder: false,
|
|
20
21
|
options: [
|
|
21
|
-
{
|
|
22
|
-
code: "optionA",
|
|
23
|
-
description: "",
|
|
24
|
-
additionalProductRefs: [
|
|
22
|
+
Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
|
|
25
23
|
{ refKey: "C_0", catId: dummyCatId, partNumber: "C" },
|
|
26
24
|
{ refKey: "B_0", catId: dummyCatId, partNumber: "B" },
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
code: "optionB",
|
|
31
|
-
description: "",
|
|
32
|
-
additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }],
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
code: "optionC",
|
|
36
|
-
description: "",
|
|
37
|
-
additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }],
|
|
38
|
-
},
|
|
25
|
+
] }),
|
|
26
|
+
Object.assign(Object.assign({}, letterOptions[1]), { additionalProductRefs: [{ refKey: "E", catId: dummyCatId, partNumber: "E" }] }),
|
|
27
|
+
Object.assign(Object.assign({}, letterOptions[2]), { additionalProductRefs: [{ refKey: "D", catId: dummyCatId, partNumber: "D" }] }),
|
|
39
28
|
],
|
|
40
29
|
},
|
|
41
30
|
],
|
|
@@ -51,8 +40,8 @@ const A = () => ({
|
|
|
51
40
|
{
|
|
52
41
|
code: "!~!",
|
|
53
42
|
next: {
|
|
54
|
-
|
|
55
|
-
code:
|
|
43
|
+
[letterOptionCodeA]: {
|
|
44
|
+
code: letterOptionCodeA,
|
|
56
45
|
},
|
|
57
46
|
},
|
|
58
47
|
},
|
|
@@ -133,30 +122,30 @@ const E = () => ({
|
|
|
133
122
|
},
|
|
134
123
|
rootFeatureRefs: [],
|
|
135
124
|
});
|
|
136
|
-
export const getTestProduct = (params) =>
|
|
125
|
+
export const getTestProduct = (params) => {
|
|
137
126
|
const partNumber = params.partNumber;
|
|
138
127
|
switch (partNumber) {
|
|
139
128
|
case "A":
|
|
140
|
-
return A();
|
|
129
|
+
return Promise.resolve(A());
|
|
141
130
|
case "B":
|
|
142
|
-
return B();
|
|
131
|
+
return Promise.resolve(B());
|
|
143
132
|
case "C":
|
|
144
|
-
return C();
|
|
133
|
+
return Promise.resolve(C());
|
|
145
134
|
case "D":
|
|
146
|
-
return D();
|
|
135
|
+
return Promise.resolve(D());
|
|
147
136
|
case "E":
|
|
148
|
-
return E();
|
|
137
|
+
return Promise.resolve(E());
|
|
149
138
|
}
|
|
150
139
|
throw new Error("No such part");
|
|
151
|
-
}
|
|
140
|
+
};
|
|
152
141
|
export function getSelOptions(option) {
|
|
153
|
-
if (option ===
|
|
142
|
+
if (option === letterOptionCodeB) {
|
|
154
143
|
return [
|
|
155
144
|
{
|
|
156
145
|
code: "!~!",
|
|
157
146
|
next: {
|
|
158
|
-
|
|
159
|
-
code:
|
|
147
|
+
[letterOptionCodeB]: {
|
|
148
|
+
code: letterOptionCodeB,
|
|
160
149
|
},
|
|
161
150
|
},
|
|
162
151
|
},
|
|
@@ -167,8 +156,8 @@ export function getSelOptions(option) {
|
|
|
167
156
|
{
|
|
168
157
|
code: "!~!",
|
|
169
158
|
next: {
|
|
170
|
-
|
|
171
|
-
code:
|
|
159
|
+
[letterOptionCodeC]: {
|
|
160
|
+
code: letterOptionCodeC,
|
|
172
161
|
},
|
|
173
162
|
},
|
|
174
163
|
},
|
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
2
|
+
import { SnapShotForWrapperWithoutRef } from "./collectorForTest.js";
|
|
2
3
|
export declare const getUpchargeProduct: (testFunc: (product: CfgProduct) => Promise<void>) => Promise<{
|
|
3
|
-
beforeSnapshot:
|
|
4
|
-
|
|
5
|
-
selected: boolean;
|
|
6
|
-
} & {
|
|
7
|
-
productConfiguration: {
|
|
8
|
-
path: string;
|
|
9
|
-
};
|
|
10
|
-
additionalProducts: {
|
|
11
|
-
path: string;
|
|
12
|
-
selected: boolean;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
afterSnapshot: {
|
|
16
|
-
path: string;
|
|
17
|
-
selected: boolean;
|
|
18
|
-
} & {
|
|
19
|
-
productConfiguration: {
|
|
20
|
-
path: string;
|
|
21
|
-
};
|
|
22
|
-
additionalProducts: {
|
|
23
|
-
path: string;
|
|
24
|
-
selected: boolean;
|
|
25
|
-
}[];
|
|
26
|
-
};
|
|
4
|
+
beforeSnapshot: SnapShotForWrapperWithoutRef;
|
|
5
|
+
afterSnapshot: SnapShotForWrapperWithoutRef;
|
|
27
6
|
diff: string[];
|
|
28
7
|
notifications: string[];
|
|
29
8
|
}>;
|