@configura/web-api 1.6.1 → 2.0.0-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.
Files changed (98) hide show
  1. package/.eslintrc.json +18 -18
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +551 -507
  5. package/dist/CatalogueAPI.js +293 -280
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +268 -258
  9. package/dist/CfgProduct.js +778 -747
  10. package/dist/CfgReferencePathHelper.d.ts +14 -0
  11. package/dist/CfgReferencePathHelper.js +13 -0
  12. package/dist/ConfigurationConverter.d.ts +5 -0
  13. package/dist/ConfigurationConverter.js +72 -0
  14. package/dist/index.d.ts +23 -20
  15. package/dist/index.js +23 -20
  16. package/dist/io/CfgHistoryManager.d.ts +51 -0
  17. package/dist/io/CfgHistoryManager.js +82 -0
  18. package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -0
  19. package/dist/io/CfgHistoryToProdConfConnector.js +56 -0
  20. package/dist/io/CfgIOManager.d.ts +49 -0
  21. package/dist/io/CfgIOManager.js +115 -0
  22. package/dist/io/CfgIOProdConfConnector.d.ts +53 -0
  23. package/dist/io/CfgIOProdConfConnector.js +141 -0
  24. package/dist/io/CfgObservableStateManager.d.ts +22 -0
  25. package/dist/io/CfgObservableStateManager.js +65 -0
  26. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -0
  27. package/dist/io/CfgObservableStateToProdConfConnector.js +16 -0
  28. package/dist/io/CfgWindowEventManager.d.ts +22 -0
  29. package/dist/io/CfgWindowEventManager.js +38 -0
  30. package/dist/io/CfgWindowMessageManager.d.ts +41 -0
  31. package/dist/io/CfgWindowMessageManager.js +84 -0
  32. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -0
  33. package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -0
  34. package/dist/io/index.d.ts +9 -0
  35. package/dist/io/index.js +8 -0
  36. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  37. package/dist/material/CfgMaterialMapping.js +181 -181
  38. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  39. package/dist/material/CfgMtrlApplication.js +43 -43
  40. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  41. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  42. package/dist/material/CfgMtrlSource.d.ts +19 -19
  43. package/dist/material/CfgMtrlSource.js +40 -40
  44. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  45. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  46. package/dist/productConfiguration/CfgFeature.d.ts +187 -188
  47. package/dist/productConfiguration/CfgFeature.js +645 -636
  48. package/dist/productConfiguration/CfgOption.d.ts +151 -150
  49. package/dist/productConfiguration/CfgOption.js +416 -426
  50. package/dist/productConfiguration/CfgProductConfiguration.d.ts +117 -120
  51. package/dist/productConfiguration/CfgProductConfiguration.js +307 -309
  52. package/dist/productConfiguration/filters.d.ts +15 -15
  53. package/dist/productConfiguration/filters.js +70 -70
  54. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  55. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  56. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  57. package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
  58. package/dist/productLoader.d.ts +33 -33
  59. package/dist/productLoader.js +49 -49
  60. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
  61. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
  62. package/dist/syncGroups/SyncGroupsHandler.d.ts +40 -40
  63. package/dist/syncGroups/SyncGroupsHandler.js +359 -358
  64. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  65. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  66. package/dist/syncGroups/SyncGroupsState.d.ts +35 -35
  67. package/dist/syncGroups/SyncGroupsState.js +125 -125
  68. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  69. package/dist/syncGroups/SyncGroupsTransaction.js +576 -576
  70. package/dist/tasks/TaskHandler.d.ts +77 -78
  71. package/dist/tasks/TaskHandler.js +275 -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 -36
  78. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  79. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +277 -277
  80. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  81. package/dist/tests/testData/testDataCachedGetProduct.js +185 -185
  82. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  83. package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
  84. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  85. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  86. package/dist/tests/testData/testDataOptions.d.ts +12 -12
  87. package/dist/tests/testData/testDataOptions.js +60 -60
  88. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  89. package/dist/tests/testData/testDataProductAggregatedPrice.js +187 -187
  90. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  91. package/dist/tests/testData/testDataUpcharge.js +119 -119
  92. package/dist/utilitiesCatalogueData.d.ts +42 -31
  93. package/dist/utilitiesCatalogueData.js +173 -162
  94. package/dist/utilitiesCataloguePermission.d.ts +38 -37
  95. package/dist/utilitiesCataloguePermission.js +79 -80
  96. package/dist/utilitiesNumericValues.d.ts +24 -24
  97. package/dist/utilitiesNumericValues.js +109 -109
  98. package/package.json +3 -3
@@ -1,74 +1,74 @@
1
- import { CfgProduct } from "../../CfgProduct";
2
- import { CfgFeature } from "../../productConfiguration/CfgFeature";
3
- import { CfgOption } from "../../productConfiguration/CfgOption";
4
- import { CfgProductConfiguration } from "../../productConfiguration/CfgProductConfiguration";
5
- declare type SnapShotForWrapper = {
6
- path: string;
7
- selected: boolean;
8
- };
9
- export declare type SnapShotForWrapperWithoutRef = SnapShotForWrapper & {
10
- productConfiguration: SnapShotForConfiguration;
11
- additionalProducts: SnapShotForWrapper[];
12
- };
13
- declare type SnapShotForWrapperWithRef = SnapShotForWrapper & {
14
- ref: CfgProduct;
15
- productConfiguration: SnapShotForConfigurationWithRef;
16
- additionalProducts: SnapShotForWrapperWithRef[];
17
- };
18
- declare type SnapShotForConfiguration = {
19
- path: string;
20
- };
21
- declare type SnapShotForConfigurationWithoutRef = SnapShotForConfiguration & {
22
- features: SnapShotForFeature[];
23
- };
24
- declare type SnapShotForConfigurationWithRef = SnapShotForConfiguration & {
25
- ref: CfgProductConfiguration;
26
- features: SnapShotForFeatureWithRef[];
27
- };
28
- declare type SnapShotForFeature = {
29
- path: string;
30
- };
31
- declare type SnapShotForFeatureWithoutRef = SnapShotForFeature & {
32
- options: SnapShotForOption[];
33
- };
34
- declare type SnapShotForFeatureWithRef = SnapShotForFeature & {
35
- ref: CfgFeature;
36
- options: SnapShotForOptionWithRef[];
37
- };
38
- declare type SnapShotForOption = {
39
- path: string;
40
- selected: boolean;
41
- };
42
- declare type SnapShotForOptionWithoutRef = SnapShotForOption & {
43
- features: SnapShotForFeature[];
44
- };
45
- declare type SnapShotForOptionWithRef = SnapShotForOption & {
46
- ref: CfgOption;
47
- features: SnapShotForFeatureWithRef[];
48
- };
49
- export declare class Collector {
50
- product: CfgProduct;
51
- static stripRefsForWrapper: (w: SnapShotForWrapperWithRef) => SnapShotForWrapperWithoutRef;
52
- static stripRefsForConf: (c: SnapShotForConfigurationWithRef) => SnapShotForConfigurationWithoutRef;
53
- static stripRefsForFeature: (f: SnapShotForFeatureWithRef) => SnapShotForFeatureWithoutRef;
54
- static stripRefsForOption: (o: SnapShotForOptionWithRef) => SnapShotForOptionWithoutRef;
55
- constructor(product: CfgProduct);
56
- notifications: string[];
57
- pushNotification: (message: string) => void;
58
- takeSnapshot: () => SnapShotForWrapperWithRef;
59
- compareSnapshot: (o: SnapShotForWrapperWithRef, n: SnapShotForWrapperWithRef) => string[];
60
- takeRefSnapshotForWrapper: (path: string, product: CfgProduct) => SnapShotForWrapperWithRef;
61
- compareSnapshotForWrapper: (result: string[], o: SnapShotForWrapperWithRef, n: SnapShotForWrapperWithRef) => void;
62
- takeRefSnapshopForConf: (path: string, productConfiguration: CfgProductConfiguration) => SnapShotForConfigurationWithRef;
63
- compareSnapshopForConf: (result: string[], o: SnapShotForConfigurationWithRef, n: SnapShotForConfigurationWithRef) => void;
64
- takeRefSnapshotForFeature: (path: string, feature: CfgFeature) => SnapShotForFeatureWithRef;
65
- compareSnapshopForFeature: (result: string[], o: SnapShotForFeatureWithRef, n: SnapShotForFeatureWithRef) => void;
66
- takeRefSnapshotForOption: (path: string, option: CfgOption) => SnapShotForOptionWithRef;
67
- compareSnapshopForOption: (result: string[], o: SnapShotForOptionWithRef, n: SnapShotForOptionWithRef) => void;
68
- addListenersForProduct: (path: string, product: CfgProduct) => void;
69
- addListenersForProductConfiguration: (path: string, productConfiguration: CfgProductConfiguration) => void;
70
- addListenersForFeature: (path: string, feature: CfgFeature) => void;
71
- addListenersForOption: (path: string, option: CfgOption) => void;
72
- }
73
- export {};
1
+ import { CfgProduct } from "../../CfgProduct";
2
+ import { CfgFeature } from "../../productConfiguration/CfgFeature";
3
+ import { CfgOption } from "../../productConfiguration/CfgOption";
4
+ import { CfgProductConfiguration } from "../../productConfiguration/CfgProductConfiguration";
5
+ declare type SnapShotForWrapper = {
6
+ path: string;
7
+ selected: boolean;
8
+ };
9
+ export declare type SnapShotForWrapperWithoutRef = SnapShotForWrapper & {
10
+ productConfiguration: SnapShotForConfiguration;
11
+ additionalProducts: SnapShotForWrapper[];
12
+ };
13
+ declare type SnapShotForWrapperWithRef = SnapShotForWrapper & {
14
+ ref: CfgProduct;
15
+ productConfiguration: SnapShotForConfigurationWithRef;
16
+ additionalProducts: SnapShotForWrapperWithRef[];
17
+ };
18
+ declare type SnapShotForConfiguration = {
19
+ path: string;
20
+ };
21
+ declare type SnapShotForConfigurationWithoutRef = SnapShotForConfiguration & {
22
+ features: SnapShotForFeature[];
23
+ };
24
+ declare type SnapShotForConfigurationWithRef = SnapShotForConfiguration & {
25
+ ref: CfgProductConfiguration;
26
+ features: SnapShotForFeatureWithRef[];
27
+ };
28
+ declare type SnapShotForFeature = {
29
+ path: string;
30
+ };
31
+ declare type SnapShotForFeatureWithoutRef = SnapShotForFeature & {
32
+ options: SnapShotForOption[];
33
+ };
34
+ declare type SnapShotForFeatureWithRef = SnapShotForFeature & {
35
+ ref: CfgFeature;
36
+ options: SnapShotForOptionWithRef[];
37
+ };
38
+ declare type SnapShotForOption = {
39
+ path: string;
40
+ selected: boolean;
41
+ };
42
+ declare type SnapShotForOptionWithoutRef = SnapShotForOption & {
43
+ features: SnapShotForFeature[];
44
+ };
45
+ declare type SnapShotForOptionWithRef = SnapShotForOption & {
46
+ ref: CfgOption;
47
+ features: SnapShotForFeatureWithRef[];
48
+ };
49
+ export declare class Collector {
50
+ product: CfgProduct;
51
+ static stripRefsForWrapper: (w: SnapShotForWrapperWithRef) => SnapShotForWrapperWithoutRef;
52
+ static stripRefsForConf: (c: SnapShotForConfigurationWithRef) => SnapShotForConfigurationWithoutRef;
53
+ static stripRefsForFeature: (f: SnapShotForFeatureWithRef) => SnapShotForFeatureWithoutRef;
54
+ static stripRefsForOption: (o: SnapShotForOptionWithRef) => SnapShotForOptionWithoutRef;
55
+ constructor(product: CfgProduct);
56
+ notifications: string[];
57
+ pushNotification: (message: string) => void;
58
+ takeSnapshot: () => SnapShotForWrapperWithRef;
59
+ compareSnapshot: (o: SnapShotForWrapperWithRef, n: SnapShotForWrapperWithRef) => string[];
60
+ takeRefSnapshotForWrapper: (path: string, product: CfgProduct) => SnapShotForWrapperWithRef;
61
+ compareSnapshotForWrapper: (result: string[], o: SnapShotForWrapperWithRef, n: SnapShotForWrapperWithRef) => void;
62
+ takeRefSnapshopForConf: (path: string, productConfiguration: CfgProductConfiguration) => SnapShotForConfigurationWithRef;
63
+ compareSnapshopForConf: (result: string[], o: SnapShotForConfigurationWithRef, n: SnapShotForConfigurationWithRef) => void;
64
+ takeRefSnapshotForFeature: (path: string, feature: CfgFeature) => SnapShotForFeatureWithRef;
65
+ compareSnapshopForFeature: (result: string[], o: SnapShotForFeatureWithRef, n: SnapShotForFeatureWithRef) => void;
66
+ takeRefSnapshotForOption: (path: string, option: CfgOption) => SnapShotForOptionWithRef;
67
+ compareSnapshopForOption: (result: string[], o: SnapShotForOptionWithRef, n: SnapShotForOptionWithRef) => void;
68
+ addListenersForProduct: (path: string, product: CfgProduct) => void;
69
+ addListenersForProductConfiguration: (path: string, productConfiguration: CfgProductConfiguration) => void;
70
+ addListenersForFeature: (path: string, feature: CfgFeature) => void;
71
+ addListenersForOption: (path: string, option: CfgOption) => void;
72
+ }
73
+ export {};
74
74
  //# sourceMappingURL=collectorForTest.d.ts.map
@@ -1,194 +1,194 @@
1
- export class Collector {
2
- constructor(product) {
3
- this.product = product;
4
- this.notifications = [];
5
- this.pushNotification = (message) => {
6
- this.notifications.push(message);
7
- };
8
- this.takeSnapshot = () => {
9
- return this.takeRefSnapshotForWrapper("", this.product);
10
- };
11
- this.compareSnapshot = (o, n) => {
12
- const result = [];
13
- this.compareSnapshotForWrapper(result, o, n);
14
- return result;
15
- };
16
- this.takeRefSnapshotForWrapper = (path, product) => {
17
- path += `prdwrap ${product.refKey || product.partNumber} `;
18
- return {
19
- path,
20
- selected: product.selected,
21
- ref: product,
22
- productConfiguration: this.takeRefSnapshopForConf(path, product.configuration),
23
- additionalProducts: product.additionalProducts.map((additionalProduct) => this.takeRefSnapshotForWrapper(path, additionalProduct)),
24
- };
25
- };
26
- this.compareSnapshotForWrapper = (result, o, n) => {
27
- if (o.path !== n.path) {
28
- result.push(`No longer same path ${o.path}, ${n.path}`);
29
- return;
30
- }
31
- if (o.ref !== n.ref) {
32
- result.push(`New ref ${n.path}${o.ref.optional
33
- ? `Was ${o.selected ? "selected " : "deselected"} Now ${n.selected ? "selected " : "deselected"}`
34
- : ""} `);
35
- }
36
- this.compareSnapshopForConf(result, o.productConfiguration, n.productConfiguration);
37
- const oAdditionals = o.additionalProducts.slice();
38
- const nAdditionals = n.additionalProducts.slice();
39
- for (const oAdditional of oAdditionals) {
40
- const i = nAdditionals.findIndex((nAdditional) => oAdditional.path === nAdditional.path);
41
- if (i === -1) {
42
- result.push(`Removed additional product ${oAdditional.path}`);
43
- }
44
- else {
45
- this.compareSnapshotForWrapper(result, oAdditional, nAdditionals[i]);
46
- nAdditionals.splice(i, 1);
47
- }
48
- }
49
- for (const nAdditional of nAdditionals) {
50
- result.push(`Added additional product ${nAdditional.path}`);
51
- }
52
- };
53
- this.takeRefSnapshopForConf = (path, productConfiguration) => {
54
- path += `cfg `;
55
- return {
56
- path,
57
- ref: productConfiguration,
58
- features: productConfiguration.features.map((feature) => this.takeRefSnapshotForFeature(path, feature)),
59
- };
60
- };
61
- this.compareSnapshopForConf = (result, o, n) => {
62
- if (o.ref !== n.ref) {
63
- result.push(`New ref ${n.path}`);
64
- }
65
- const oFeatures = o.features;
66
- const nFeatures = n.features;
67
- if (oFeatures.length !== nFeatures.length) {
68
- result.push(`No longer same options for ${o.path}`);
69
- return;
70
- }
71
- for (let i = 0; i < oFeatures.length; i++) {
72
- this.compareSnapshopForFeature(result, oFeatures[i], nFeatures[i]);
73
- }
74
- };
75
- this.takeRefSnapshotForFeature = (path, feature) => {
76
- path += `feature ${feature.code} `;
77
- return {
78
- path,
79
- ref: feature,
80
- options: feature.options.map((option) => this.takeRefSnapshotForOption(path, option)),
81
- };
82
- };
83
- this.compareSnapshopForFeature = (result, o, n) => {
84
- if (o.path !== n.path) {
85
- result.push(`No longer same path ${o.path}, ${n.path}`);
86
- return;
87
- }
88
- if (o.ref !== n.ref) {
89
- result.push(`New ref ${n.path}`);
90
- }
91
- const oOptions = o.options;
92
- const nOptions = n.options;
93
- if (oOptions.length !== nOptions.length) {
94
- result.push(`No longer same features for ${o.path}`);
95
- return;
96
- }
97
- for (let i = 0; i < oOptions.length; i++) {
98
- this.compareSnapshopForOption(result, oOptions[i], nOptions[i]);
99
- }
100
- };
101
- this.takeRefSnapshotForOption = (path, option) => {
102
- path += `option ${option.code} `;
103
- return {
104
- path,
105
- ref: option,
106
- selected: option.selected,
107
- features: option.features.map((feature) => this.takeRefSnapshotForFeature(path, feature)),
108
- };
109
- };
110
- this.compareSnapshopForOption = (result, o, n) => {
111
- if (o.path !== n.path) {
112
- result.push(`No longer same path ${o.path}, ${n.path}`);
113
- return;
114
- }
115
- if (o.ref !== n.ref) {
116
- result.push(`New ref ${n.path} Was ${o.selected ? "selected" : "deselected"} Now ${n.selected ? "selected" : "deselected"}`);
117
- }
118
- const oFeatures = o.features;
119
- const nFeatures = n.features;
120
- if (oFeatures.length !== nFeatures.length) {
121
- result.push(`No longer same options for ${o.path}`);
122
- return;
123
- }
124
- for (let i = 0; i < oFeatures.length; i++) {
125
- this.compareSnapshopForFeature(result, oFeatures[i], nFeatures[i]);
126
- }
127
- };
128
- this.addListenersForProduct = (path, product) => {
129
- path += `prdwrap ${product.refKey || product.partNumber} `;
130
- product.listenForChange(() => {
131
- this.pushNotification(`${path}${product.optional ? `${product.selected ? "selected" : "deselected"}` : ""}`);
132
- });
133
- this.addListenersForProductConfiguration(path, product.configuration);
134
- for (const additionalProduct of product.additionalProducts) {
135
- this.addListenersForProduct(path, additionalProduct);
136
- }
137
- };
138
- this.addListenersForProductConfiguration = (path, productConfiguration) => {
139
- path += `cfg `;
140
- productConfiguration.listenForChange(() => {
141
- this.pushNotification(path);
142
- });
143
- for (const feature of productConfiguration.features) {
144
- this.addListenersForFeature(path, feature);
145
- }
146
- };
147
- this.addListenersForFeature = (path, feature) => {
148
- path += `feature ${feature.code} `;
149
- feature.listenForChange(() => {
150
- this.pushNotification(path);
151
- });
152
- for (const option of feature.options) {
153
- this.addListenersForOption(path, option);
154
- }
155
- };
156
- this.addListenersForOption = (path, option) => {
157
- path += `option ${option.code} `;
158
- option.listenForChange(() => {
159
- this.pushNotification(`${path}${option.selected ? "selected" : "deselected"}`);
160
- });
161
- for (const feature of option.features) {
162
- this.addListenersForFeature(path, feature);
163
- }
164
- };
165
- this.addListenersForProduct("", product);
166
- }
167
- }
168
- Collector.stripRefsForWrapper = (w) => {
169
- return {
170
- path: w.path,
171
- selected: w.selected,
172
- productConfiguration: Collector.stripRefsForConf(w.productConfiguration),
173
- additionalProducts: w.additionalProducts.map(Collector.stripRefsForWrapper),
174
- };
175
- };
176
- Collector.stripRefsForConf = (c) => {
177
- return {
178
- path: c.path,
179
- features: c.features.map(Collector.stripRefsForFeature),
180
- };
181
- };
182
- Collector.stripRefsForFeature = (f) => {
183
- return {
184
- path: f.path,
185
- options: f.options.map(Collector.stripRefsForOption),
186
- };
187
- };
188
- Collector.stripRefsForOption = (o) => {
189
- return {
190
- path: o.path,
191
- selected: o.selected,
192
- features: o.features.map(Collector.stripRefsForFeature),
193
- };
194
- };
1
+ export class Collector {
2
+ constructor(product) {
3
+ this.product = product;
4
+ this.notifications = [];
5
+ this.pushNotification = (message) => {
6
+ this.notifications.push(message);
7
+ };
8
+ this.takeSnapshot = () => {
9
+ return this.takeRefSnapshotForWrapper("", this.product);
10
+ };
11
+ this.compareSnapshot = (o, n) => {
12
+ const result = [];
13
+ this.compareSnapshotForWrapper(result, o, n);
14
+ return result;
15
+ };
16
+ this.takeRefSnapshotForWrapper = (path, product) => {
17
+ path += `prdwrap ${product.refKey || product.partNumber} `;
18
+ return {
19
+ path,
20
+ selected: product.selected,
21
+ ref: product,
22
+ productConfiguration: this.takeRefSnapshopForConf(path, product.configuration),
23
+ additionalProducts: product.additionalProducts.map((additionalProduct) => this.takeRefSnapshotForWrapper(path, additionalProduct)),
24
+ };
25
+ };
26
+ this.compareSnapshotForWrapper = (result, o, n) => {
27
+ if (o.path !== n.path) {
28
+ result.push(`No longer same path ${o.path}, ${n.path}`);
29
+ return;
30
+ }
31
+ if (o.ref !== n.ref) {
32
+ result.push(`New ref ${n.path}${o.ref.optional
33
+ ? `Was ${o.selected ? "selected " : "deselected"} Now ${n.selected ? "selected " : "deselected"}`
34
+ : ""} `);
35
+ }
36
+ this.compareSnapshopForConf(result, o.productConfiguration, n.productConfiguration);
37
+ const oAdditionals = o.additionalProducts.slice();
38
+ const nAdditionals = n.additionalProducts.slice();
39
+ for (const oAdditional of oAdditionals) {
40
+ const i = nAdditionals.findIndex((nAdditional) => oAdditional.path === nAdditional.path);
41
+ if (i === -1) {
42
+ result.push(`Removed additional product ${oAdditional.path}`);
43
+ }
44
+ else {
45
+ this.compareSnapshotForWrapper(result, oAdditional, nAdditionals[i]);
46
+ nAdditionals.splice(i, 1);
47
+ }
48
+ }
49
+ for (const nAdditional of nAdditionals) {
50
+ result.push(`Added additional product ${nAdditional.path}`);
51
+ }
52
+ };
53
+ this.takeRefSnapshopForConf = (path, productConfiguration) => {
54
+ path += `cfg `;
55
+ return {
56
+ path,
57
+ ref: productConfiguration,
58
+ features: productConfiguration.features.map((feature) => this.takeRefSnapshotForFeature(path, feature)),
59
+ };
60
+ };
61
+ this.compareSnapshopForConf = (result, o, n) => {
62
+ if (o.ref !== n.ref) {
63
+ result.push(`New ref ${n.path}`);
64
+ }
65
+ const oFeatures = o.features;
66
+ const nFeatures = n.features;
67
+ if (oFeatures.length !== nFeatures.length) {
68
+ result.push(`No longer same options for ${o.path}`);
69
+ return;
70
+ }
71
+ for (let i = 0; i < oFeatures.length; i++) {
72
+ this.compareSnapshopForFeature(result, oFeatures[i], nFeatures[i]);
73
+ }
74
+ };
75
+ this.takeRefSnapshotForFeature = (path, feature) => {
76
+ path += `feature ${feature.code} `;
77
+ return {
78
+ path,
79
+ ref: feature,
80
+ options: feature.options.map((option) => this.takeRefSnapshotForOption(path, option)),
81
+ };
82
+ };
83
+ this.compareSnapshopForFeature = (result, o, n) => {
84
+ if (o.path !== n.path) {
85
+ result.push(`No longer same path ${o.path}, ${n.path}`);
86
+ return;
87
+ }
88
+ if (o.ref !== n.ref) {
89
+ result.push(`New ref ${n.path}`);
90
+ }
91
+ const oOptions = o.options;
92
+ const nOptions = n.options;
93
+ if (oOptions.length !== nOptions.length) {
94
+ result.push(`No longer same features for ${o.path}`);
95
+ return;
96
+ }
97
+ for (let i = 0; i < oOptions.length; i++) {
98
+ this.compareSnapshopForOption(result, oOptions[i], nOptions[i]);
99
+ }
100
+ };
101
+ this.takeRefSnapshotForOption = (path, option) => {
102
+ path += `option ${option.code} `;
103
+ return {
104
+ path,
105
+ ref: option,
106
+ selected: option.selected,
107
+ features: option.features.map((feature) => this.takeRefSnapshotForFeature(path, feature)),
108
+ };
109
+ };
110
+ this.compareSnapshopForOption = (result, o, n) => {
111
+ if (o.path !== n.path) {
112
+ result.push(`No longer same path ${o.path}, ${n.path}`);
113
+ return;
114
+ }
115
+ if (o.ref !== n.ref) {
116
+ result.push(`New ref ${n.path} Was ${o.selected ? "selected" : "deselected"} Now ${n.selected ? "selected" : "deselected"}`);
117
+ }
118
+ const oFeatures = o.features;
119
+ const nFeatures = n.features;
120
+ if (oFeatures.length !== nFeatures.length) {
121
+ result.push(`No longer same options for ${o.path}`);
122
+ return;
123
+ }
124
+ for (let i = 0; i < oFeatures.length; i++) {
125
+ this.compareSnapshopForFeature(result, oFeatures[i], nFeatures[i]);
126
+ }
127
+ };
128
+ this.addListenersForProduct = (path, product) => {
129
+ path += `prdwrap ${product.refKey || product.partNumber} `;
130
+ product.listenForChange(() => {
131
+ this.pushNotification(`${path}${product.optional ? `${product.selected ? "selected" : "deselected"}` : ""}`);
132
+ });
133
+ this.addListenersForProductConfiguration(path, product.configuration);
134
+ for (const additionalProduct of product.additionalProducts) {
135
+ this.addListenersForProduct(path, additionalProduct);
136
+ }
137
+ };
138
+ this.addListenersForProductConfiguration = (path, productConfiguration) => {
139
+ path += `cfg `;
140
+ productConfiguration.listenForChange(() => {
141
+ this.pushNotification(path);
142
+ });
143
+ for (const feature of productConfiguration.features) {
144
+ this.addListenersForFeature(path, feature);
145
+ }
146
+ };
147
+ this.addListenersForFeature = (path, feature) => {
148
+ path += `feature ${feature.code} `;
149
+ feature.listenForChange(() => {
150
+ this.pushNotification(path);
151
+ });
152
+ for (const option of feature.options) {
153
+ this.addListenersForOption(path, option);
154
+ }
155
+ };
156
+ this.addListenersForOption = (path, option) => {
157
+ path += `option ${option.code} `;
158
+ option.listenForChange(() => {
159
+ this.pushNotification(`${path}${option.selected ? "selected" : "deselected"}`);
160
+ });
161
+ for (const feature of option.features) {
162
+ this.addListenersForFeature(path, feature);
163
+ }
164
+ };
165
+ this.addListenersForProduct("", product);
166
+ }
167
+ }
168
+ Collector.stripRefsForWrapper = (w) => {
169
+ return {
170
+ path: w.path,
171
+ selected: w.selected,
172
+ productConfiguration: Collector.stripRefsForConf(w.productConfiguration),
173
+ additionalProducts: w.additionalProducts.map(Collector.stripRefsForWrapper),
174
+ };
175
+ };
176
+ Collector.stripRefsForConf = (c) => {
177
+ return {
178
+ path: c.path,
179
+ features: c.features.map(Collector.stripRefsForFeature),
180
+ };
181
+ };
182
+ Collector.stripRefsForFeature = (f) => {
183
+ return {
184
+ path: f.path,
185
+ options: f.options.map(Collector.stripRefsForOption),
186
+ };
187
+ };
188
+ Collector.stripRefsForOption = (o) => {
189
+ return {
190
+ path: o.path,
191
+ selected: o.selected,
192
+ features: o.features.map(Collector.stripRefsForFeature),
193
+ };
194
+ };
@@ -1,5 +1,5 @@
1
- import { CatalogueParams } from "../../CatalogueAPI.js";
2
- import { CfgProduct } from "../../CfgProduct.js";
3
- export declare const dummyCatId: CatalogueParams;
4
- export declare const getDummyCfgProduct: () => Promise<CfgProduct>;
1
+ import { DtoCatalogueParamsWithLang } from "../../CatalogueAPI.js";
2
+ import { CfgProduct } from "../../CfgProduct.js";
3
+ export declare const dummyCatId: DtoCatalogueParamsWithLang;
4
+ export declare const getDummyCfgProduct: () => Promise<CfgProduct>;
5
5
  //# sourceMappingURL=dummyProductForTest.d.ts.map
@@ -1,36 +1,32 @@
1
- import { CfgProduct } from "../../CfgProduct.js";
2
- export const dummyCatId = {
3
- enterprise: "enterprise",
4
- prdCat: "prdCat",
5
- prdCatVersion: "prdCatVersion",
6
- vendor: "vendor",
7
- priceList: "priceList",
8
- };
9
- export const getDummyCfgProduct = () => CfgProduct.make({
10
- getProduct: () => Promise.resolve({
11
- features: [],
12
- uuid: "uuid",
13
- unit: "m",
14
- rootFeatureRefs: [],
15
- productData: {
16
- sku: "sku",
17
- partsData: {
18
- basePrice: 0,
19
- currency: "",
20
- listPrice: 0,
21
- pkgCount: 0,
22
- selOptions: [],
23
- styleNr: "",
24
- },
25
- },
26
- }),
27
- postValidate: () => {
28
- throw new Error("Should not be used");
29
- },
30
- }, "lang", {
31
- enterprise: "enterprise",
32
- prdCat: "prdCat",
33
- prdCatVersion: "prdCatVersion",
34
- priceList: "priceList",
35
- vendor: "vendor",
36
- }, "partNumber");
1
+ import { CfgProduct } from "../../CfgProduct.js";
2
+ export const dummyCatId = {
3
+ cid: 123,
4
+ lang: "lang",
5
+ enterprise: "enterprise",
6
+ prdCat: "prdCat",
7
+ prdCatVersion: "prdCatVersion",
8
+ vendor: "vendor",
9
+ priceList: "priceList",
10
+ };
11
+ export const getDummyCfgProduct = () => CfgProduct.make({
12
+ getProduct: () => Promise.resolve({
13
+ features: [],
14
+ uuid: "uuid",
15
+ unit: "m",
16
+ rootFeatureRefs: [],
17
+ productData: {
18
+ sku: "sku",
19
+ partsData: {
20
+ basePrice: 0,
21
+ currency: "",
22
+ listPrice: 0,
23
+ pkgCount: 0,
24
+ selOptions: [],
25
+ styleNr: "",
26
+ },
27
+ },
28
+ }),
29
+ postValidate: () => {
30
+ throw new Error("Should not be used");
31
+ },
32
+ }, Object.assign(Object.assign({}, dummyCatId), { partNumber: "partNumber" }));
@@ -1,12 +1,12 @@
1
- import { GetProductParams } from "../../CatalogueAPI.js";
2
- import { CfgProduct } from "../../CfgProduct.js";
3
- import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
4
- import { SnapShotForWrapperWithoutRef } from "./collectorForTest.js";
5
- export declare const getTestProduct: (params: GetProductParams) => Promise<CfgProductResponse>;
6
- export declare const cfgProductTest: (testFunc: (product: CfgProduct) => Promise<void>, prepFunc?: ((product: CfgProduct) => Promise<void>) | undefined) => Promise<{
7
- beforeSnapshot: SnapShotForWrapperWithoutRef;
8
- afterSnapshot: SnapShotForWrapperWithoutRef;
9
- diff: string[];
10
- notifications: string[];
11
- }>;
1
+ import { DtoGetProductParams } from "../../CatalogueAPI.js";
2
+ import { CfgProduct } from "../../CfgProduct.js";
3
+ import { CfgProductResponse } from "../../utilitiesCatalogueData.js";
4
+ import { SnapShotForWrapperWithoutRef } from "./collectorForTest.js";
5
+ export declare const getTestProduct: (params: DtoGetProductParams) => Promise<CfgProductResponse>;
6
+ export declare const cfgProductTest: (testFunc: (product: CfgProduct) => Promise<void>, prepFunc?: ((product: CfgProduct) => Promise<void>) | undefined) => Promise<{
7
+ beforeSnapshot: SnapShotForWrapperWithoutRef;
8
+ afterSnapshot: SnapShotForWrapperWithoutRef;
9
+ diff: string[];
10
+ notifications: string[];
11
+ }>;
12
12
  //# sourceMappingURL=testDataAdditionalProductInAdditionalProductInProductForTest.d.ts.map