@configura/web-api 1.6.0-iotest.4 → 1.6.1-alpha.2
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 +34 -17
- package/dist/CfgProduct.js +118 -54
- package/dist/index.d.ts +2 -6
- package/dist/index.js +2 -6
- package/dist/productConfiguration/CfgFeature.d.ts +2 -1
- package/dist/productConfiguration/CfgFeature.js +26 -20
- package/dist/productConfiguration/CfgOption.d.ts +30 -8
- package/dist/productConfiguration/CfgOption.js +50 -18
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +1 -2
- package/dist/productConfiguration/CfgProductConfiguration.js +9 -8
- package/dist/productConfiguration/filters.d.ts +1 -1
- package/dist/productConfiguration/filters.js +6 -3
- 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 +40 -0
- package/dist/syncGroups/SyncGroupsHandler.js +352 -0
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +27 -0
- package/dist/syncGroups/SyncGroupsPathHelper.js +89 -0
- package/dist/syncGroups/SyncGroupsState.d.ts +26 -0
- package/dist/syncGroups/SyncGroupsState.js +111 -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 +104 -1
- package/package.json +3 -3
- package/dist/io/CfgHistoryManager.d.ts +0 -26
- package/dist/io/CfgHistoryManager.js +0 -58
- package/dist/io/CfgHistoryToCameraConfConnector.d.ts +0 -15
- package/dist/io/CfgHistoryToCameraConfConnector.js +0 -58
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +0 -14
- package/dist/io/CfgHistoryToProdConfConnector.js +0 -24
- package/dist/io/CfgIOCameraConfConnector.d.ts +0 -31
- package/dist/io/CfgIOCameraConfConnector.js +0 -72
- package/dist/io/CfgIOManager.d.ts +0 -29
- package/dist/io/CfgIOManager.js +0 -89
- package/dist/io/CfgIOProdConfConnector.d.ts +0 -36
- package/dist/io/CfgIOProdConfConnector.js +0 -102
- package/dist/io/CfgWindowMessageManager.d.ts +0 -13
- package/dist/io/CfgWindowMessageManager.js +0 -33
- package/dist/io/CfgWindowMessageToCameraConfConnector.d.ts +0 -6
- package/dist/io/CfgWindowMessageToCameraConfConnector.js +0 -6
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +0 -14
- package/dist/io/CfgWindowMessageToProdConfConnector.js +0 -17
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { assert } from "@configura/web-utilities";
|
|
11
|
+
import { SelectionType } from "../productConfiguration/CfgFeature.js";
|
|
12
|
+
import { SyncGroupsApplier } from "./SyncGroupsApplier.js";
|
|
13
|
+
import { SyncGroupsPathHelper } from "./SyncGroupsPathHelper.js";
|
|
14
|
+
/**
|
|
15
|
+
* A transaction is normally limited to one user interaction. Like opening a product or
|
|
16
|
+
* selecting an option. This object is used to keep data for one transaction. In particular
|
|
17
|
+
* what Features and what SyncGroups have been affected in the transaction. This is a means
|
|
18
|
+
* to eliminate the risk of infinite loops.
|
|
19
|
+
*/
|
|
20
|
+
export class SyncGroupsTransaction {
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param syncState A clone of the original syncState. Replaces the original syncState if nothing fails and the transaction doesn't get cancelled
|
|
24
|
+
* @param updateMode
|
|
25
|
+
* @param productLoader
|
|
26
|
+
* @param original The product instance that this transaction will be applied on provided nothing fails and the transaction doesn't get cancelled
|
|
27
|
+
* @param target A clone of the original product used to apply the configuration changes to
|
|
28
|
+
* @param initial A clone of the original product used to track what the original state was. As a safe measure we do not use originalProduct for this, as it might be changed by someone else
|
|
29
|
+
*/
|
|
30
|
+
constructor(syncState, updateMode, productLoader, original, target, initial) {
|
|
31
|
+
this.syncState = syncState;
|
|
32
|
+
this.updateMode = updateMode;
|
|
33
|
+
this.productLoader = productLoader;
|
|
34
|
+
this.original = original;
|
|
35
|
+
this.target = target;
|
|
36
|
+
this.initial = initial;
|
|
37
|
+
this._closed = false;
|
|
38
|
+
this.affectedSelectOneFeatures = new Set();
|
|
39
|
+
this.affectedSelectManyOptions = new Set();
|
|
40
|
+
this.affectedSelectOneSyncGroups = new Set();
|
|
41
|
+
this.affectedSelectManySyncGroupsAndOptions = new Map();
|
|
42
|
+
}
|
|
43
|
+
static make(syncState, updateMode, product, productLoader, assumeNoStartState) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const t = new this(syncState.clone(), updateMode, productLoader, product, yield product.clone(), assumeNoStartState ? undefined : yield product.clone());
|
|
46
|
+
return t;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
get isClosed() {
|
|
50
|
+
return this._closed;
|
|
51
|
+
}
|
|
52
|
+
close() {
|
|
53
|
+
this._closed = true;
|
|
54
|
+
}
|
|
55
|
+
init() {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
return yield SyncGroupsApplier.init(this);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
selectOption(optionPath, on) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const targetOption = SyncGroupsPathHelper.getOptionFromPath(optionPath, this.target);
|
|
63
|
+
return yield SyncGroupsApplier.selectOption(this, targetOption, on);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
addSelectOneFeatureAffected(feature) {
|
|
67
|
+
assert(feature.selectionType === SelectionType.SelectOne, "Can only be used for SelectOne Feature");
|
|
68
|
+
this.affectedSelectOneFeatures.add(feature);
|
|
69
|
+
}
|
|
70
|
+
addSelectManyOptionAffected(option) {
|
|
71
|
+
assert(option.parent.selectionType === SelectionType.SelectMany, "Can only be used for option in SelectMany Feature");
|
|
72
|
+
this.affectedSelectManyOptions.add(option);
|
|
73
|
+
}
|
|
74
|
+
hasSelectOneFeatureBeenAffected(feature) {
|
|
75
|
+
assert(feature.selectionType === SelectionType.SelectOne, "Can only be used for SelectOne Feature");
|
|
76
|
+
return this.affectedSelectOneFeatures.has(feature);
|
|
77
|
+
}
|
|
78
|
+
hasSelectManyOptionBeenAffected(option) {
|
|
79
|
+
assert(option.parent.selectionType === SelectionType.SelectMany, "Can only be used for option in SelectMany Feature");
|
|
80
|
+
return this.affectedSelectManyOptions.has(option);
|
|
81
|
+
}
|
|
82
|
+
addSyncGroupAffectedForSelectOne(syncCode) {
|
|
83
|
+
this.affectedSelectOneSyncGroups.add(syncCode);
|
|
84
|
+
}
|
|
85
|
+
addSyncGroupAffectedForSelectMany(syncCode, optionCode) {
|
|
86
|
+
let forSyncCode = this.affectedSelectManySyncGroupsAndOptions.get(syncCode);
|
|
87
|
+
if (forSyncCode === undefined) {
|
|
88
|
+
forSyncCode = new Set();
|
|
89
|
+
this.affectedSelectManySyncGroupsAndOptions.set(syncCode, forSyncCode);
|
|
90
|
+
}
|
|
91
|
+
forSyncCode.add(optionCode);
|
|
92
|
+
}
|
|
93
|
+
isSyncGroupAffectedForSelectOne(syncCode) {
|
|
94
|
+
return this.affectedSelectOneSyncGroups.has(syncCode);
|
|
95
|
+
}
|
|
96
|
+
isSyncGroupAffectedForSelectMany(syncCode, optionCode) {
|
|
97
|
+
var _a;
|
|
98
|
+
return ((_a = this.affectedSelectManySyncGroupsAndOptions.get(syncCode)) === null || _a === void 0 ? void 0 : _a.has(optionCode)) === true;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -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
|
},
|
|
@@ -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
|
});
|
|
@@ -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
|
},
|
|
@@ -165,7 +154,7 @@ export const cachedProductLoaderTest = () => __awaiter(void 0, void 0, void 0, f
|
|
|
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 =
|
|
157
|
+
let code = letterOptionCodeA;
|
|
169
158
|
for (let test in _body.selOptions[0].next) {
|
|
170
159
|
code = test;
|
|
171
160
|
break;
|
|
@@ -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
|
},
|
|
@@ -150,13 +139,13 @@ export const getTestProduct = (params) => __awaiter(void 0, void 0, void 0, func
|
|
|
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
|
},
|
|
@@ -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, letterOptions } from "./testDataOptions.js";
|
|
13
14
|
const Prd = () => ({
|
|
14
15
|
uuid: "Prd",
|
|
15
16
|
unit: "m",
|
|
@@ -19,20 +20,9 @@ const Prd = () => ({
|
|
|
19
20
|
description: "",
|
|
20
21
|
numericOrder: false,
|
|
21
22
|
options: [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
code: "B",
|
|
28
|
-
description: "",
|
|
29
|
-
upcharge: undefined,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
code: "C",
|
|
33
|
-
description: "",
|
|
34
|
-
upcharge: 0,
|
|
35
|
-
},
|
|
23
|
+
letterOptions[0],
|
|
24
|
+
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
25
|
+
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 0 }),
|
|
36
26
|
],
|
|
37
27
|
},
|
|
38
28
|
{
|
|
@@ -40,20 +30,9 @@ const Prd = () => ({
|
|
|
40
30
|
description: "",
|
|
41
31
|
numericOrder: false,
|
|
42
32
|
options: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
code: "B",
|
|
49
|
-
description: "",
|
|
50
|
-
upcharge: undefined,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
code: "C",
|
|
54
|
-
description: "",
|
|
55
|
-
upcharge: 10,
|
|
56
|
-
},
|
|
33
|
+
letterOptions[0],
|
|
34
|
+
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
35
|
+
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 10 }),
|
|
57
36
|
],
|
|
58
37
|
},
|
|
59
38
|
{
|
|
@@ -62,20 +41,9 @@ const Prd = () => ({
|
|
|
62
41
|
numericOrder: false,
|
|
63
42
|
optional: true,
|
|
64
43
|
options: [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
code: "B",
|
|
71
|
-
description: "",
|
|
72
|
-
upcharge: undefined,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
code: "C",
|
|
76
|
-
description: "",
|
|
77
|
-
upcharge: 10,
|
|
78
|
-
},
|
|
44
|
+
letterOptions[0],
|
|
45
|
+
Object.assign(Object.assign({}, letterOptions[1]), { upcharge: undefined }),
|
|
46
|
+
Object.assign(Object.assign({}, letterOptions[2]), { upcharge: 10 }),
|
|
79
47
|
],
|
|
80
48
|
},
|
|
81
49
|
],
|
|
@@ -91,24 +59,24 @@ const Prd = () => ({
|
|
|
91
59
|
{
|
|
92
60
|
code: "!~!",
|
|
93
61
|
next: {
|
|
94
|
-
|
|
95
|
-
code:
|
|
62
|
+
[letterOptionCodeA]: {
|
|
63
|
+
code: letterOptionCodeA,
|
|
96
64
|
},
|
|
97
65
|
},
|
|
98
66
|
},
|
|
99
67
|
{
|
|
100
68
|
code: "!~!",
|
|
101
69
|
next: {
|
|
102
|
-
|
|
103
|
-
code:
|
|
70
|
+
[letterOptionCodeA]: {
|
|
71
|
+
code: letterOptionCodeA,
|
|
104
72
|
},
|
|
105
73
|
},
|
|
106
74
|
},
|
|
107
75
|
{
|
|
108
76
|
code: "!~!",
|
|
109
77
|
next: {
|
|
110
|
-
|
|
111
|
-
code:
|
|
78
|
+
[letterOptionCodeA]: {
|
|
79
|
+
code: letterOptionCodeA,
|
|
112
80
|
},
|
|
113
81
|
},
|
|
114
82
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CatalogueParams, GetProductParams, Model, PartsData, Prices, ProductData, ProductResponse, SelectedOption, ValidateResponse } from "./CatalogueAPI.js";
|
|
1
|
+
import { AdditionalProductRef, CatalogueParams, GetProductParams, MeasureParam, Model, Orientation, PartsData, Prices, ProductData, ProductResponse, SelectedOption, Transform, ValidateResponse, Vector } from "./CatalogueAPI.js";
|
|
2
2
|
export declare const makeCatalogueKey: (cat: CatalogueParams) => string;
|
|
3
3
|
export declare const makeProductKey: (cat: CatalogueParams, pKey: string) => string;
|
|
4
4
|
export declare const makeSelOptionsKey: (options: SelectedOption[]) => string;
|
|
@@ -23,4 +23,10 @@ export declare function recursivelyGetPriceCodeValue(priceCodes: string[], price
|
|
|
23
23
|
export declare function comparePricesObjects(prices1: Prices | undefined, prices2: Prices | undefined): boolean;
|
|
24
24
|
export declare const decodeCatalogueParams: <T extends CatalogueParams>(params: T) => T;
|
|
25
25
|
export declare const decodeProductParams: <T extends GetProductParams>(params: T) => T;
|
|
26
|
+
export declare function isSameCatalogueParams(left: CatalogueParams, right: CatalogueParams): boolean;
|
|
27
|
+
export declare function isSameVector(left: Vector, right: Vector): boolean;
|
|
28
|
+
export declare function isSameOrientation(left: Orientation, right: Orientation): boolean;
|
|
29
|
+
export declare function isSameAnchor(left: MeasureParam, right: MeasureParam): boolean;
|
|
30
|
+
export declare function isSameTransform(left: Transform, right: Transform): boolean;
|
|
31
|
+
export declare function isSameProductRef(left: AdditionalProductRef, right: AdditionalProductRef): boolean;
|
|
26
32
|
//# sourceMappingURL=utilitiesCatalogueData.d.ts.map
|