@configura/web-api 2.2.0-alpha.1 → 2.2.0-alpha.3

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 (102) hide show
  1. package/.eslintrc.json +5 -5
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +633 -633
  5. package/dist/CatalogueAPI.js +312 -312
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +359 -344
  9. package/dist/CfgProduct.js +1005 -992
  10. package/dist/CfgReferencePathHelper.d.ts +26 -26
  11. package/dist/CfgReferencePathHelper.js +26 -26
  12. package/dist/index.d.ts +24 -24
  13. package/dist/index.js +24 -24
  14. package/dist/io/CfgHistoryManager.d.ts +83 -83
  15. package/dist/io/CfgHistoryManager.js +144 -144
  16. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -21
  17. package/dist/io/CfgHistoryToProdConfConnector.js +50 -50
  18. package/dist/io/CfgIOManager.d.ts +53 -53
  19. package/dist/io/CfgIOManager.js +134 -134
  20. package/dist/io/CfgIOProdConfConnector.d.ts +54 -54
  21. package/dist/io/CfgIOProdConfConnector.js +139 -139
  22. package/dist/io/CfgIOWarningSupplier.d.ts +3 -3
  23. package/dist/io/CfgIOWarningSupplier.js +1 -1
  24. package/dist/io/CfgObservableStateManager.d.ts +25 -25
  25. package/dist/io/CfgObservableStateManager.js +69 -69
  26. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -15
  27. package/dist/io/CfgObservableStateToProdConfConnector.js +17 -17
  28. package/dist/io/CfgWindowEventManager.d.ts +21 -21
  29. package/dist/io/CfgWindowEventManager.js +38 -38
  30. package/dist/io/CfgWindowMessageManager.d.ts +40 -40
  31. package/dist/io/CfgWindowMessageManager.js +91 -91
  32. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -17
  33. package/dist/io/CfgWindowMessageToProdConfConnector.js +19 -19
  34. package/dist/io/index.d.ts +8 -8
  35. package/dist/io/index.js +8 -8
  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 +199 -199
  47. package/dist/productConfiguration/CfgFeature.js +691 -691
  48. package/dist/productConfiguration/CfgOption.d.ts +160 -160
  49. package/dist/productConfiguration/CfgOption.js +464 -464
  50. package/dist/productConfiguration/CfgProductConfiguration.d.ts +136 -129
  51. package/dist/productConfiguration/CfgProductConfiguration.js +355 -346
  52. package/dist/productConfiguration/filters.d.ts +17 -17
  53. package/dist/productConfiguration/filters.js +141 -141
  54. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  55. package/dist/productConfiguration/productParamsGenerator.js +65 -65
  56. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  57. package/dist/productConfiguration/utilitiesProductConfiguration.js +89 -87
  58. package/dist/productLoader.d.ts +33 -33
  59. package/dist/productLoader.js +49 -49
  60. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
  61. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
  62. package/dist/syncGroups/SyncGroupsHandler.d.ts +47 -47
  63. package/dist/syncGroups/SyncGroupsHandler.js +370 -370
  64. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  65. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  66. package/dist/syncGroups/SyncGroupsState.d.ts +39 -39
  67. package/dist/syncGroups/SyncGroupsState.js +167 -167
  68. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  69. package/dist/syncGroups/SyncGroupsTransaction.js +589 -589
  70. package/dist/tasks/TaskHandler.d.ts +77 -77
  71. package/dist/tasks/TaskHandler.js +276 -276
  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 -194
  76. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  77. package/dist/tests/testData/dummyProductForTest.js +32 -32
  78. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  79. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -282
  80. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  81. package/dist/tests/testData/testDataCachedGetProduct.js +187 -187
  82. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  83. package/dist/tests/testData/testDataCachedPostValidate.js +185 -185
  84. package/dist/tests/testData/testDataConstraints.d.ts +3 -3
  85. package/dist/tests/testData/testDataConstraints.js +174 -174
  86. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  87. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  88. package/dist/tests/testData/testDataOptions.d.ts +12 -12
  89. package/dist/tests/testData/testDataOptions.js +60 -60
  90. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  91. package/dist/tests/testData/testDataProductAggregatedPrice.js +189 -189
  92. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  93. package/dist/tests/testData/testDataUpcharge.js +121 -121
  94. package/dist/utilitiesCatalogueData.d.ts +47 -47
  95. package/dist/utilitiesCatalogueData.js +180 -180
  96. package/dist/utilitiesCataloguePermission.d.ts +38 -38
  97. package/dist/utilitiesCataloguePermission.js +79 -79
  98. package/dist/utilitiesConfiguration.d.ts +28 -28
  99. package/dist/utilitiesConfiguration.js +200 -200
  100. package/dist/utilitiesNumericValues.d.ts +24 -24
  101. package/dist/utilitiesNumericValues.js +114 -114
  102. package/package.json +3 -3
@@ -1,13 +1,13 @@
1
- import { DtoOption, DtoSelectedOption } from "../../CatalogueAPI.js";
2
- export declare function addDefaultsToMockSelectedOption(root: DtoSelectedOption, 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: DtoOption[];
10
- export declare const toggleOptionCodeOff = "optOff";
11
- export declare const toggleOptionCodeOn = "optOn";
12
- export declare const toggleOptions: DtoOption[];
1
+ import { DtoOption, DtoSelectedOption } from "../../CatalogueAPI.js";
2
+ export declare function addDefaultsToMockSelectedOption(root: DtoSelectedOption, 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: DtoOption[];
10
+ export declare const toggleOptionCodeOff = "optOff";
11
+ export declare const toggleOptionCodeOn = "optOn";
12
+ export declare const toggleOptions: DtoOption[];
13
13
  //# sourceMappingURL=testDataOptions.d.ts.map
@@ -1,60 +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
- ];
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
+ ];
@@ -1,7 +1,7 @@
1
- import { DtoGetProductParams, DtoSelectedOption } from "../../CatalogueAPI.js";
2
- import { CfgProduct } from "../../CfgProduct.js";
3
- import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
4
- export declare const getTestProduct: (params: DtoGetProductParams) => Promise<CfgProductResponse>;
5
- export declare function getSelOptions(option: string): DtoSelectedOption[];
6
- export declare const cfgProductPriceTest: (testFunc?: ((cfgProduct: CfgProduct) => Promise<void>) | undefined, featureOption?: string | undefined) => Promise<CfgProduct>;
1
+ import { DtoGetProductParams, DtoSelectedOption } from "../../CatalogueAPI.js";
2
+ import { CfgProduct } from "../../CfgProduct.js";
3
+ import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
4
+ export declare const getTestProduct: (params: DtoGetProductParams) => Promise<CfgProductResponse>;
5
+ export declare function getSelOptions(option: string): DtoSelectedOption[];
6
+ export declare const cfgProductPriceTest: (testFunc?: ((cfgProduct: CfgProduct) => Promise<void>) | undefined, featureOption?: string | undefined) => Promise<CfgProduct>;
7
7
  //# sourceMappingURL=testDataProductAggregatedPrice.d.ts.map
@@ -1,189 +1,189 @@
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 { CfgProduct } from "../../CfgProduct.js";
11
- import { dummyCatId } from "./dummyProductForTest.js";
12
- import { letterOptionCodeA, letterOptionCodeB, letterOptionCodeC, letterOptions, } from "./testDataOptions.js";
13
- const A = () => ({
14
- uuid: "A",
15
- unit: "m",
16
- features: [
17
- {
18
- code: "featureA",
19
- description: "",
20
- numericOrder: false,
21
- options: [
22
- Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
23
- { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
24
- { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
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" }] }),
28
- ],
29
- },
30
- ],
31
- productData: {
32
- sku: "A",
33
- partsData: {
34
- basePrice: 40,
35
- currency: "EURO",
36
- listPrice: 50,
37
- pkgCount: 0,
38
- styleNr: "",
39
- selOptions: [
40
- {
41
- code: "!~!",
42
- next: {
43
- [letterOptionCodeA]: {
44
- code: letterOptionCodeA,
45
- },
46
- },
47
- },
48
- ],
49
- },
50
- additionalProductRefs: [
51
- { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
52
- ],
53
- },
54
- rootFeatureRefs: [{ code: "featureA" }],
55
- });
56
- const B = () => ({
57
- uuid: "B",
58
- unit: "m",
59
- features: [],
60
- productData: {
61
- sku: "B",
62
- partsData: {
63
- basePrice: 30,
64
- currency: "EURO",
65
- listPrice: 40,
66
- pkgCount: 0,
67
- selOptions: [],
68
- styleNr: "",
69
- },
70
- additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
71
- },
72
- rootFeatureRefs: [],
73
- });
74
- const C = () => ({
75
- uuid: "C",
76
- unit: "m",
77
- features: [],
78
- productData: {
79
- sku: "C",
80
- partsData: {
81
- basePrice: 20,
82
- currency: "EURO",
83
- listPrice: 30,
84
- pkgCount: 0,
85
- selOptions: [],
86
- styleNr: "",
87
- },
88
- },
89
- rootFeatureRefs: [],
90
- });
91
- const D = () => ({
92
- uuid: "D",
93
- unit: "m",
94
- features: [],
95
- productData: {
96
- sku: "D",
97
- partsData: {
98
- basePrice: 10,
99
- currency: "EURO",
100
- listPrice: 20,
101
- pkgCount: 0,
102
- selOptions: [],
103
- styleNr: "",
104
- },
105
- },
106
- rootFeatureRefs: [],
107
- });
108
- const E = () => ({
109
- uuid: "E",
110
- unit: "m",
111
- features: [],
112
- productData: {
113
- sku: "E",
114
- partsData: {
115
- basePrice: 15,
116
- currency: "USD",
117
- listPrice: 25,
118
- pkgCount: 0,
119
- selOptions: [],
120
- styleNr: "",
121
- },
122
- },
123
- rootFeatureRefs: [],
124
- });
125
- export const getTestProduct = (params) => {
126
- const partNumber = params.partNumber;
127
- switch (partNumber) {
128
- case "A":
129
- return Promise.resolve(A());
130
- case "B":
131
- return Promise.resolve(B());
132
- case "C":
133
- return Promise.resolve(C());
134
- case "D":
135
- return Promise.resolve(D());
136
- case "E":
137
- return Promise.resolve(E());
138
- }
139
- throw new Error("No such part");
140
- };
141
- export function getSelOptions(option) {
142
- if (option === letterOptionCodeB) {
143
- return [
144
- {
145
- code: "!~!",
146
- next: {
147
- [letterOptionCodeB]: {
148
- code: letterOptionCodeB,
149
- },
150
- },
151
- },
152
- ];
153
- }
154
- else {
155
- return [
156
- {
157
- code: "!~!",
158
- next: {
159
- [letterOptionCodeC]: {
160
- code: letterOptionCodeC,
161
- },
162
- },
163
- },
164
- ];
165
- }
166
- }
167
- export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0, void 0, void 0, function* () {
168
- const cfgProduct = yield CfgProduct.make({
169
- getProduct: getTestProduct,
170
- postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
171
- const productData = (yield getTestProduct(params)).productData;
172
- if (featureOption !== undefined && params.partNumber === "A") {
173
- productData.partsData.selOptions = getSelOptions(featureOption);
174
- }
175
- const validateResponse = {
176
- uuid: "",
177
- unit: "m",
178
- validated: true,
179
- productData,
180
- features: [],
181
- };
182
- return validateResponse;
183
- }),
184
- }, Object.assign(Object.assign({}, dummyCatId), { partNumber: "A" }));
185
- if (testFunc !== undefined) {
186
- yield testFunc(cfgProduct);
187
- }
188
- return cfgProduct;
189
- });
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 { CfgProduct } from "../../CfgProduct.js";
11
+ import { dummyCatId } from "./dummyProductForTest.js";
12
+ import { letterOptionCodeA, letterOptionCodeB, letterOptionCodeC, letterOptions, } from "./testDataOptions.js";
13
+ const A = () => ({
14
+ uuid: "A",
15
+ unit: "m",
16
+ features: [
17
+ {
18
+ code: "featureA",
19
+ description: "",
20
+ numericOrder: false,
21
+ options: [
22
+ Object.assign(Object.assign({}, letterOptions[0]), { additionalProductRefs: [
23
+ { refKey: "C_0", catId: dummyCatId, partNumber: "C" },
24
+ { refKey: "B_0", catId: dummyCatId, partNumber: "B" },
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" }] }),
28
+ ],
29
+ },
30
+ ],
31
+ productData: {
32
+ sku: "A",
33
+ partsData: {
34
+ basePrice: 40,
35
+ currency: "EURO",
36
+ listPrice: 50,
37
+ pkgCount: 0,
38
+ styleNr: "",
39
+ selOptions: [
40
+ {
41
+ code: "!~!",
42
+ next: {
43
+ [letterOptionCodeA]: {
44
+ code: letterOptionCodeA,
45
+ },
46
+ },
47
+ },
48
+ ],
49
+ },
50
+ additionalProductRefs: [
51
+ { refKey: "B_1", catId: dummyCatId, partNumber: "B", optional: true },
52
+ ],
53
+ },
54
+ rootFeatureRefs: [{ code: "featureA" }],
55
+ });
56
+ const B = () => ({
57
+ uuid: "B",
58
+ unit: "m",
59
+ features: [],
60
+ productData: {
61
+ sku: "B",
62
+ partsData: {
63
+ basePrice: 30,
64
+ currency: "EURO",
65
+ listPrice: 40,
66
+ pkgCount: 0,
67
+ selOptions: [],
68
+ styleNr: "",
69
+ },
70
+ additionalProductRefs: [{ refKey: "C_0", catId: dummyCatId, partNumber: "C" }],
71
+ },
72
+ rootFeatureRefs: [],
73
+ });
74
+ const C = () => ({
75
+ uuid: "C",
76
+ unit: "m",
77
+ features: [],
78
+ productData: {
79
+ sku: "C",
80
+ partsData: {
81
+ basePrice: 20,
82
+ currency: "EURO",
83
+ listPrice: 30,
84
+ pkgCount: 0,
85
+ selOptions: [],
86
+ styleNr: "",
87
+ },
88
+ },
89
+ rootFeatureRefs: [],
90
+ });
91
+ const D = () => ({
92
+ uuid: "D",
93
+ unit: "m",
94
+ features: [],
95
+ productData: {
96
+ sku: "D",
97
+ partsData: {
98
+ basePrice: 10,
99
+ currency: "EURO",
100
+ listPrice: 20,
101
+ pkgCount: 0,
102
+ selOptions: [],
103
+ styleNr: "",
104
+ },
105
+ },
106
+ rootFeatureRefs: [],
107
+ });
108
+ const E = () => ({
109
+ uuid: "E",
110
+ unit: "m",
111
+ features: [],
112
+ productData: {
113
+ sku: "E",
114
+ partsData: {
115
+ basePrice: 15,
116
+ currency: "USD",
117
+ listPrice: 25,
118
+ pkgCount: 0,
119
+ selOptions: [],
120
+ styleNr: "",
121
+ },
122
+ },
123
+ rootFeatureRefs: [],
124
+ });
125
+ export const getTestProduct = (params) => {
126
+ const partNumber = params.partNumber;
127
+ switch (partNumber) {
128
+ case "A":
129
+ return Promise.resolve(A());
130
+ case "B":
131
+ return Promise.resolve(B());
132
+ case "C":
133
+ return Promise.resolve(C());
134
+ case "D":
135
+ return Promise.resolve(D());
136
+ case "E":
137
+ return Promise.resolve(E());
138
+ }
139
+ throw new Error("No such part");
140
+ };
141
+ export function getSelOptions(option) {
142
+ if (option === letterOptionCodeB) {
143
+ return [
144
+ {
145
+ code: "!~!",
146
+ next: {
147
+ [letterOptionCodeB]: {
148
+ code: letterOptionCodeB,
149
+ },
150
+ },
151
+ },
152
+ ];
153
+ }
154
+ else {
155
+ return [
156
+ {
157
+ code: "!~!",
158
+ next: {
159
+ [letterOptionCodeC]: {
160
+ code: letterOptionCodeC,
161
+ },
162
+ },
163
+ },
164
+ ];
165
+ }
166
+ }
167
+ export const cfgProductPriceTest = (testFunc, featureOption) => __awaiter(void 0, void 0, void 0, function* () {
168
+ const cfgProduct = yield CfgProduct.make({
169
+ getProduct: getTestProduct,
170
+ postValidate: (params, _body) => __awaiter(void 0, void 0, void 0, function* () {
171
+ const productData = (yield getTestProduct(params)).productData;
172
+ if (featureOption !== undefined && params.partNumber === "A") {
173
+ productData.partsData.selOptions = getSelOptions(featureOption);
174
+ }
175
+ const validateResponse = {
176
+ uuid: "",
177
+ unit: "m",
178
+ validated: true,
179
+ productData,
180
+ features: [],
181
+ };
182
+ return validateResponse;
183
+ }),
184
+ }, Object.assign(Object.assign({}, dummyCatId), { partNumber: "A" }));
185
+ if (testFunc !== undefined) {
186
+ yield testFunc(cfgProduct);
187
+ }
188
+ return cfgProduct;
189
+ });
@@ -1,9 +1,9 @@
1
- import { CfgProduct } from "../../CfgProduct.js";
2
- import { SnapShotForWrapperWithoutRef } from "./collectorForTest.js";
3
- export declare const getUpchargeProduct: (testFunc: (product: CfgProduct) => Promise<void>) => Promise<{
4
- beforeSnapshot: SnapShotForWrapperWithoutRef;
5
- afterSnapshot: SnapShotForWrapperWithoutRef;
6
- diff: string[];
7
- notifications: string[];
8
- }>;
1
+ import { CfgProduct } from "../../CfgProduct.js";
2
+ import { SnapShotForWrapperWithoutRef } from "./collectorForTest.js";
3
+ export declare const getUpchargeProduct: (testFunc: (product: CfgProduct) => Promise<void>) => Promise<{
4
+ beforeSnapshot: SnapShotForWrapperWithoutRef;
5
+ afterSnapshot: SnapShotForWrapperWithoutRef;
6
+ diff: string[];
7
+ notifications: string[];
8
+ }>;
9
9
  //# sourceMappingURL=testDataUpcharge.d.ts.map