@configura/web-api 1.6.0-iotest.2 → 1.6.0-rc.0

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 (86) hide show
  1. package/.eslintrc.json +18 -0
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +507 -511
  5. package/dist/CatalogueAPI.js +280 -273
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +253 -244
  9. package/dist/CfgProduct.js +733 -674
  10. package/dist/index.d.ts +20 -22
  11. package/dist/index.js +20 -22
  12. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  13. package/dist/material/CfgMaterialMapping.js +181 -181
  14. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  15. package/dist/material/CfgMtrlApplication.js +43 -43
  16. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  17. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  18. package/dist/material/CfgMtrlSource.d.ts +19 -19
  19. package/dist/material/CfgMtrlSource.js +40 -40
  20. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  21. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  22. package/dist/productConfiguration/CfgFeature.d.ts +188 -178
  23. package/dist/productConfiguration/CfgFeature.js +636 -611
  24. package/dist/productConfiguration/CfgOption.d.ts +150 -128
  25. package/dist/productConfiguration/CfgOption.js +426 -394
  26. package/dist/productConfiguration/CfgProductConfiguration.d.ts +120 -121
  27. package/dist/productConfiguration/CfgProductConfiguration.js +309 -306
  28. package/dist/productConfiguration/filters.d.ts +15 -15
  29. package/dist/productConfiguration/filters.js +70 -67
  30. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  31. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  32. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  33. package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
  34. package/dist/productLoader.d.ts +33 -33
  35. package/dist/productLoader.js +49 -49
  36. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +21 -0
  37. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -0
  38. package/dist/syncGroups/SyncGroupsHandler.d.ts +36 -0
  39. package/dist/syncGroups/SyncGroupsHandler.js +349 -0
  40. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +27 -0
  41. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -0
  42. package/dist/syncGroups/SyncGroupsState.d.ts +26 -0
  43. package/dist/syncGroups/SyncGroupsState.js +113 -0
  44. package/dist/syncGroups/SyncGroupsTransaction.d.ts +155 -0
  45. package/dist/syncGroups/SyncGroupsTransaction.js +576 -0
  46. package/dist/tasks/TaskHandler.d.ts +78 -78
  47. package/dist/tasks/TaskHandler.js +276 -265
  48. package/dist/tasks/formats.d.ts +4 -4
  49. package/dist/tasks/formats.js +7 -7
  50. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  51. package/dist/tests/testData/collectorForTest.js +194 -195
  52. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  53. package/dist/tests/testData/dummyProductForTest.js +36 -36
  54. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -32
  55. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +277 -348
  56. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  57. package/dist/tests/testData/testDataCachedGetProduct.js +185 -196
  58. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  59. package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
  60. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  61. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  62. package/dist/tests/testData/testDataOptions.d.ts +13 -0
  63. package/dist/tests/testData/testDataOptions.js +60 -0
  64. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  65. package/dist/tests/testData/testDataProductAggregatedPrice.js +187 -198
  66. package/dist/tests/testData/testDataUpcharge.d.ts +8 -29
  67. package/dist/tests/testData/testDataUpcharge.js +119 -151
  68. package/dist/utilitiesCatalogueData.d.ts +31 -25
  69. package/dist/utilitiesCatalogueData.js +162 -65
  70. package/dist/utilitiesCataloguePermission.d.ts +37 -39
  71. package/dist/utilitiesCataloguePermission.js +80 -84
  72. package/dist/utilitiesNumericValues.d.ts +24 -24
  73. package/dist/utilitiesNumericValues.js +109 -109
  74. package/package.json +3 -3
  75. package/dist/io/CfgHistoryManager.d.ts +0 -30
  76. package/dist/io/CfgHistoryManager.js +0 -62
  77. package/dist/io/CfgHistoryToProdConfConnector.d.ts +0 -10
  78. package/dist/io/CfgHistoryToProdConfConnector.js +0 -20
  79. package/dist/io/CfgIOManager.d.ts +0 -29
  80. package/dist/io/CfgIOManager.js +0 -89
  81. package/dist/io/CfgIOProdConfConnector.d.ts +0 -33
  82. package/dist/io/CfgIOProdConfConnector.js +0 -100
  83. package/dist/io/CfgWindowMessageManager.d.ts +0 -13
  84. package/dist/io/CfgWindowMessageManager.js +0 -28
  85. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +0 -13
  86. package/dist/io/CfgWindowMessageToProdConfConnector.js +0 -17
@@ -1,30 +1,30 @@
1
- /**
2
- * This class strips the Measurement of things that are not actually used or relevant
3
- * to Stage, specifically anchoring and stretching. Measurements can also contain
4
- * volume and area, but these are ignored. Here Measures are used to define defaults
5
- * such as its preferences when dealing with ambiguity or its default value.
6
- */
7
- export class CfgMeasureDefinition {
8
- constructor(measureParamCode, numericValue, measurePriorities) {
9
- this.measureParamCode = measureParamCode;
10
- this.numericValue = numericValue;
11
- this.measurePriorities = measurePriorities;
12
- }
13
- static make(measurement) {
14
- // The measurement.code seems to be used in CET to connect the value to
15
- // pre-existing fields in the product, such as width, height and depth.
16
- // We however only use this for anchoring and stretching and so it is the
17
- // code of the measureParam that is relevant. Hence Measurements with no
18
- // measureParam are ignored.
19
- var _a;
20
- const measureParam = measurement.measureParam;
21
- if (measureParam === undefined) {
22
- return undefined;
23
- }
24
- const code = measureParam.code;
25
- return new this(code, measurement.numericValue, ((_a = measureParam.measurePriority) !== null && _a !== void 0 ? _a : []).map((p, index) => ({
26
- modelLocalFilePath: p.url,
27
- index,
28
- })));
29
- }
30
- }
1
+ /**
2
+ * This class strips the Measurement of things that are not actually used or relevant
3
+ * to Stage, specifically anchoring and stretching. Measurements can also contain
4
+ * volume and area, but these are ignored. Here Measures are used to define defaults
5
+ * such as its preferences when dealing with ambiguity or its default value.
6
+ */
7
+ export class CfgMeasureDefinition {
8
+ constructor(measureParamCode, numericValue, measurePriorities) {
9
+ this.measureParamCode = measureParamCode;
10
+ this.numericValue = numericValue;
11
+ this.measurePriorities = measurePriorities;
12
+ }
13
+ static make(measurement) {
14
+ // The measurement.code seems to be used in CET to connect the value to
15
+ // pre-existing fields in the product, such as width, height and depth.
16
+ // We however only use this for anchoring and stretching and so it is the
17
+ // code of the measureParam that is relevant. Hence Measurements with no
18
+ // measureParam are ignored.
19
+ var _a;
20
+ const measureParam = measurement.measureParam;
21
+ if (measureParam === undefined) {
22
+ return undefined;
23
+ }
24
+ const code = measureParam.code;
25
+ return new this(code, measurement.numericValue, ((_a = measureParam.measurePriority) !== null && _a !== void 0 ? _a : []).map((p, index) => ({
26
+ modelLocalFilePath: p.url,
27
+ index,
28
+ })));
29
+ }
30
+ }
@@ -1,245 +1,254 @@
1
- import { AggregatedLoadingObservable, LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
2
- import { AdditionalProductConfiguration, CatalogueParams, MeasureParam, MtrlApplication, Prices, Transform } from "./CatalogueAPI.js";
3
- import { CfgMeasureDefinition } from "./CfgMeasure.js";
4
- import { _CfgFeatureInternal } from "./productConfiguration/CfgFeature.js";
5
- import { ProductConfigurationBubbleMode } from "./productConfiguration/CfgOption.js";
6
- import { CfgProductConfiguration } from "./productConfiguration/CfgProductConfiguration.js";
7
- import { ProductLoader } from "./productLoader.js";
8
- import { CfgProductData, RootNodeSource } from "./utilitiesCatalogueData.js";
9
- export declare type CfgProductChangeNotification = {
10
- freshRef: CfgProduct;
11
- committed: boolean;
12
- };
13
- export declare type CfgProductSettings = {
14
- /**
15
- * In a correctly setup catalogue a select-one Feature (i.e. neither optional nor multiple)
16
- * must have exactly one Option set at a time. However, this is not enforced in Catalogue
17
- * Creator and it is not uncommon with catalogues which fails to meet this requirement.
18
- * Activating this will make setApi throw an Error if more or less than one is selected.
19
- */
20
- strictSelectOneSelectionCount: boolean;
21
- /**
22
- * Activating this will make setAPI throw an error if the number of actually selected options
23
- * on Features (excluding Group) are not exactly equal to the number of options passed in.
24
- * Note: This check is not always reliable for Options with multiple Features each, which we
25
- * believe is a rare use case.
26
- */
27
- strictSetApiSelectionMatch: boolean;
28
- };
29
- /**
30
- * This enum is used internally in the SDK and is not expected by be used directly by integrators.
31
- */
32
- export declare enum CfgProductBubbleMode {
33
- /** Stop bubbling. */
34
- Stop = "Stop",
35
- /**
36
- * Bubble to the parent CfgProduct up the tree.
37
- * This makes the CfgProduct we we call from notify that it has changed, and the CfgProduct
38
- * above switch out the reference to this.
39
- */
40
- OneLevel = "OneLevel",
41
- /** Bubble to the root CfgProduct. */
42
- ToRoot = "ToRoot",
43
- /** Bubble to the root CfgProduct and turn on all optional CfgProducts on the way up. */
44
- ToRootAndBubbleSelected = "ToRootAndBubbleSelected"
45
- }
46
- export declare type CfgPrice = {
47
- basePrice: number;
48
- listPrice: number;
49
- currency: string;
50
- fractionDigits: number;
51
- };
52
- /**
53
- * This class is meant to only be used through CfgProduct. It should never be instantiated on its
54
- * own. Normally the internal state of this class should never be directly modified. CfgProduct is
55
- * the class that should be used and interacted with.
56
- */
57
- export declare class _CfgProductInternal {
58
- readonly _productLoaderRaw: ProductLoader;
59
- readonly lang: string;
60
- readonly catId: CatalogueParams;
61
- readonly partNumber: string;
62
- readonly settings: CfgProductSettings;
63
- readonly uuid: string;
64
- private readonly _rawUnit;
65
- private _rawProductData;
66
- readonly loadingObservable: AggregatedLoadingObservable;
67
- readonly refKey: string | undefined;
68
- readonly refDescription: string | undefined;
69
- readonly parent: _CfgProductInternal | undefined;
70
- readonly transform: Transform | undefined;
71
- anchor: MeasureParam | undefined;
72
- static make: (productLoaderRaw: ProductLoader, productLoaderForGroupedLoad: ProductLoader | undefined, lang: string, catId: CatalogueParams, partNumber: string, settings: CfgProductSettings, optional: boolean, loadingObservable: AggregatedLoadingObservable, refKey: string | undefined, refDescription: string | undefined, parent: _CfgProductInternal | undefined, root: _CfgProductInternal | undefined, transform: Transform | undefined, anchor: MeasureParam | undefined) => Promise<_CfgProductInternal>;
73
- private constructor();
74
- readonly root: _CfgProductInternal;
75
- private _destroyed;
76
- readonly key: string;
77
- readonly additionalProducts: CfgProduct[];
78
- private _selected;
79
- private _configuration;
80
- readonly changeObservable: Observable<CfgProductChangeNotification>;
81
- get selected(): boolean;
82
- readonly isAdditionalProduct: boolean;
83
- clone(parent?: _CfgProductInternal, root?: _CfgProductInternal): Promise<_CfgProductInternal>;
84
- destroy: () => void;
85
- get description(): string | undefined;
86
- get rootNodeSources(): RootNodeSource[] | undefined;
87
- get mtrlApplications(): MtrlApplication[] | undefined;
88
- get currency(): string;
89
- get fractionDigits(): number;
90
- get prices(): Prices | undefined;
91
- private _measureDefinitions;
92
- get measureDefinitions(): CfgMeasureDefinition[];
93
- private _unit;
94
- /** @throws an error if the actual unit sent by the server was not a LengthUnit */
95
- get unit(): LengthUnit;
96
- get aggregatedPrice(): CfgPrice;
97
- get optional(): boolean;
98
- setSelected(v: boolean, bubbleMode: CfgProductBubbleMode): Promise<boolean>;
99
- get configuration(): CfgProductConfiguration;
100
- get rawProductData(): CfgProductData;
101
- /**
102
- * Please note that this relates to the visibility in the Configuration tree.
103
- * It does not affect the visibility of anything in the 3D view at all.
104
- */
105
- get visibleIfAdditionalProduct(): boolean;
106
- /**
107
- * Please note that this relates to the visibility in the Configuration tree.
108
- * It does not affect the visibility of anything in the 3D view at all.
109
- */
110
- get visibleIfMainProduct(): boolean;
111
- /**
112
- * Please note that this relates to the visibility in the Configuration tree.
113
- * It does not affect the visibility of anything in the 3D view at all.
114
- */
115
- get visible(): boolean;
116
- _notifyAllOfChange: (bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
117
- /** Called when a child (additional product or the configuration) has changed. */
118
- private _childHasChanged;
119
- /** Called by child to tell its parent that it has changed. */
120
- _additionalProductHasChanged: (freshRef: CfgProduct, bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
121
- /** Called by the configuration to tell its parent that it has changed. */
122
- _configurationHasChanged: (freshRef: CfgProductConfiguration, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
123
- getApiSelection: () => AdditionalProductConfiguration;
124
- setApiSelection: (s: AdditionalProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
125
- getApiSelectionAsString: () => string;
126
- setFromApiSelectionString: (str: string, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
127
- structureCompare: (other: _CfgProductInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
128
- tryMatchSelection: (other: _CfgProductInternal, descriptionMatch?: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
129
- /** Only features in selected options and selected additional products. */
130
- _getDescendantFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
131
- private _revalidateInProgressToken;
132
- /**
133
- * Do a validate call for this product. It does not validate additional products, only this
134
- * product in isolation. The validation result is applied on the configuration. Then additional
135
- * products are synced (unloaded, loaded etc.) Finally the changes bubble up the tree.
136
- */
137
- _revalidate: (bubbleMode: CfgProductBubbleMode, productLoader: ProductLoader, committed: boolean) => Promise<boolean>;
138
- /**
139
- * Based on this configuration find what additional products should be shown and not, unload
140
- * (i.e. destroy) those that should no longer be shown, load the new ones.
141
- */
142
- _syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader) => Promise<boolean>;
143
- }
144
- export declare class CfgProduct {
145
- readonly _internal: _CfgProductInternal;
146
- static make(productLoader: ProductLoader, lang: string, catId: CatalogueParams, partNumber: string, settings?: Partial<CfgProductSettings>): Promise<CfgProduct>;
147
- /**
148
- * Makes an object wrapping the passed object. This is not a clone method, it is a method to
149
- * make a new outer reference. Like a shallow copy./ We use this to help frameworks that are
150
- * build around using equals to detect change.
151
- */
152
- static _makeNewRefFrom(source: _CfgProductInternal): CfgProduct;
153
- private constructor();
154
- isBackedBySame: (other: CfgProduct) => boolean;
155
- /**
156
- * Recursively marks this and descendants as destroyed so that late events are ignored
157
- * correctly. If you destroy one shallow copy of this you destroy all.
158
- */
159
- destroy: () => void;
160
- /** Makes a clone of this. It is disconnected from the original. */
161
- clone: () => Promise<CfgProduct>;
162
- /**
163
- * A client side only key that should uniquely identify this product amongst other additional
164
- * products.
165
- */
166
- get key(): string;
167
- /**
168
- * Only used when this product is in additional product.
169
- * As a product can have multiple instances of the same additional product this key exists.
170
- * It will be unique amongst child products, but not globally unique.
171
- */
172
- get refKey(): string | undefined;
173
- get lang(): string;
174
- get catId(): CatalogueParams;
175
- get partNumber(): string;
176
- get isAdditionalProduct(): boolean;
177
- /** Only used when this product is an additional product. Root products are never optional. */
178
- get optional(): boolean;
179
- /**
180
- * Only applicable when this product is optional. If this product is not optional this is
181
- * always true.
182
- */
183
- get selected(): boolean;
184
- /**
185
- * Please note that this relates to the visibility in the Configuration tree.
186
- * It does not affect the visibility of anything in the 3D view at all.
187
- * Visibility is affects the Configuration for this Product, but any Additional Products
188
- * will not be affected.
189
- */
190
- get visible(): boolean;
191
- /**
192
- * Only applicable when this product is optional.
193
- * Setting this does not cause a validation call as toggling an optional additional product is
194
- * assumed to always be legal.
195
- */
196
- setSelected: (v: boolean) => Promise<boolean>;
197
- get rawProductData(): CfgProductData;
198
- get uuid(): string;
199
- get unit(): LengthUnit;
200
- get sku(): string;
201
- get styleNr(): string;
202
- /** An URL. */
203
- get preview(): string | undefined;
204
- get description(): string | undefined;
205
- get additionalProducts(): CfgProduct[];
206
- get configuration(): CfgProductConfiguration;
207
- get transform(): Transform | undefined;
208
- get currency(): string;
209
- /**
210
- * If positive the number of fraction digits.
211
- * If negative rounding (essentially the number of zeros to the right)
212
- */
213
- get fractionDigits(): number;
214
- get aggregatedPrice(): CfgPrice;
215
- /**
216
- * Experimental. Additional products lacks descriptions or keys that are suitably for structure
217
- * compare, so we use strict-order when trying to match the additional products. This makes
218
- * this method work nicely for different products having pretty much the same child products.
219
- */
220
- structureCompare: (other: CfgProduct, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
221
- /**
222
- * Experimental. Additional products lacks descriptions or keys that are suitably for try
223
- * match, so we use strict-order when trying to match the additional products. This makes
224
- * this method work nicely for different products having pretty much the same child products.
225
- * This method does not propagate its selections.
226
- * This method will cause validation calls if something change.
227
- */
228
- tryMatchSelection: (other: CfgProduct, descriptionMatch?: boolean) => Promise<boolean>;
229
- /**
230
- * Gets what selections has been made on the product, recursively including product
231
- * configuration, optional products and additional products. Used when a full view of all
232
- * selections on a product is needed, such as when doing Render or Export.
233
- */
234
- getApiSelection: () => AdditionalProductConfiguration;
235
- setApiSelection: (s: AdditionalProductConfiguration, doValidate?: boolean) => Promise<boolean>;
236
- getApiSelectionAsString: () => string;
237
- setFromApiSelectionString: (str: string, doValidate?: boolean) => Promise<boolean>;
238
- listenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
239
- stopListenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
240
- stopAllListenForChange: () => void;
241
- listenForLoading: (l: SingleArgCallback<boolean>) => void;
242
- stopListenForLoading: (l: SingleArgCallback<boolean>) => void;
243
- stopAllListenForLoading: () => void;
244
- }
1
+ import { AggregatedLoadingObservable, LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
2
+ import { AdditionalProductConfiguration, AdditionalProductRef, CatalogueParams, MeasureParam, MtrlApplication, Prices, Transform } from "./CatalogueAPI.js";
3
+ import { CfgMeasureDefinition } from "./CfgMeasure.js";
4
+ import { _CfgFeatureInternal } from "./productConfiguration/CfgFeature.js";
5
+ import { ProductConfigurationBubbleMode } from "./productConfiguration/CfgOption.js";
6
+ import { CfgProductConfiguration } from "./productConfiguration/CfgProductConfiguration.js";
7
+ import { ProductLoader } from "./productLoader.js";
8
+ import { SyncGroupsApplyMode } from "./syncGroups/SyncGroupsApplyMode.js";
9
+ import { SyncGroupsHandler } from "./syncGroups/SyncGroupsHandler.js";
10
+ import { CfgProductData, RootNodeSource } from "./utilitiesCatalogueData.js";
11
+ export declare type CfgProductChangeNotification = {
12
+ freshRef: CfgProduct;
13
+ };
14
+ export declare type CfgProductSettings = {
15
+ /**
16
+ * In a correctly setup catalogue a select-one Feature (i.e. neither optional nor multiple)
17
+ * must have exactly one Option set at a time. However, this is not enforced in Catalogue
18
+ * Creator and it is not uncommon with catalogues which fails to meet this requirement.
19
+ * Activating this will make setApi throw an Error if more or less than one is selected.
20
+ */
21
+ strictSelectOneSelectionCount: boolean;
22
+ /**
23
+ * Controls if SyncGroups are applied Faster or Stricter.
24
+ *
25
+ * Fast - Tries to minimize the number of validates calls to the AI lowering the response times
26
+ * for selecting options. Might not always give the expected result for complex products.
27
+ *
28
+ * Strict - Apply the SyncGroups rules in a stricter fashion to be as close to CET as possible,
29
+ * which might result in longer response times and more validation calls to the API when
30
+ * selecting options.
31
+ *
32
+ * The SDK will default to Strict, but we recommend that you try out Fast since cases where the
33
+ * results differ should be rare in most real uses cases and the speedup can be quite large.
34
+ */
35
+ syncGroupsApplyMode: SyncGroupsApplyMode | undefined;
36
+ };
37
+ /**
38
+ * This enum is used internally in the SDK and is not expected by be used directly by integrators.
39
+ */
40
+ export declare enum CfgProductBubbleMode {
41
+ /** Stop bubbling. */
42
+ Stop = "Stop",
43
+ /**
44
+ * Bubble to the parent CfgProduct up the tree.
45
+ * This makes the CfgProduct we we call from notify that it has changed, and the CfgProduct
46
+ * above switch out the reference to this.
47
+ */
48
+ OneLevel = "OneLevel",
49
+ /** Bubble to the root CfgProduct. */
50
+ ToRoot = "ToRoot",
51
+ /** Bubble to the root CfgProduct and turn on all optional CfgProducts on the way up. */
52
+ ToRootAndBubbleSelected = "ToRootAndBubbleSelected"
53
+ }
54
+ export declare type CfgPrice = {
55
+ basePrice: number;
56
+ listPrice: number;
57
+ currency: string;
58
+ fractionDigits: number;
59
+ };
60
+ /**
61
+ * This class is meant to only be used through CfgProduct. It should never be instantiated on its
62
+ * own. Normally the internal state of this class should never be directly modified. CfgProduct is
63
+ * the class that should be used and interacted with.
64
+ */
65
+ export declare class _CfgProductInternal {
66
+ readonly _productLoaderRaw: ProductLoader;
67
+ readonly lang: string;
68
+ readonly catId: CatalogueParams;
69
+ readonly partNumber: string;
70
+ readonly settings: CfgProductSettings;
71
+ readonly uuid: string;
72
+ private readonly _rawUnit;
73
+ private _rawProductData;
74
+ readonly loadingObservable: AggregatedLoadingObservable;
75
+ readonly parent: _CfgProductInternal | undefined;
76
+ private _additionalProductRef;
77
+ private readonly _syncGroupHandler;
78
+ static make: (productLoaderRaw: ProductLoader, productLoaderForGroupedLoad: ProductLoader | undefined, lang: string, catId: CatalogueParams, partNumber: string, settings: CfgProductSettings, optional: boolean, loadingObservable: AggregatedLoadingObservable, parent: _CfgProductInternal | undefined, root: _CfgProductInternal | undefined, additionalProductRef: AdditionalProductRef | undefined) => Promise<_CfgProductInternal>;
79
+ private constructor();
80
+ readonly root: _CfgProductInternal;
81
+ private _destroyed;
82
+ readonly key: string;
83
+ readonly additionalProducts: CfgProduct[];
84
+ private _selected;
85
+ private _configuration;
86
+ readonly changeObservable: Observable<CfgProductChangeNotification>;
87
+ get selected(): boolean;
88
+ readonly isAdditionalProduct: boolean;
89
+ clone(parent?: _CfgProductInternal, root?: _CfgProductInternal): Promise<_CfgProductInternal>;
90
+ destroy: () => void;
91
+ _updateAdditionalProdRef(p: AdditionalProductRef): void;
92
+ get description(): string | undefined;
93
+ get rootNodeSources(): RootNodeSource[] | undefined;
94
+ get mtrlApplications(): MtrlApplication[] | undefined;
95
+ get currency(): string;
96
+ get fractionDigits(): number;
97
+ get prices(): Prices | undefined;
98
+ private _measureDefinitions;
99
+ get measureDefinitions(): CfgMeasureDefinition[];
100
+ private _unit;
101
+ get refKey(): string | undefined;
102
+ get transform(): Transform | undefined;
103
+ get anchor(): MeasureParam | undefined;
104
+ /** @throws an error if the actual unit sent by the server was not a LengthUnit */
105
+ get unit(): LengthUnit;
106
+ get aggregatedPrice(): CfgPrice;
107
+ get optional(): boolean;
108
+ setSelected(v: boolean, bubbleMode: CfgProductBubbleMode): Promise<boolean>;
109
+ get configuration(): CfgProductConfiguration;
110
+ get rawProductData(): CfgProductData;
111
+ /**
112
+ * Please note that this relates to the visibility in the Configuration tree.
113
+ * It does not affect the visibility of anything in the 3D view at all.
114
+ */
115
+ get visibleIfAdditionalProduct(): boolean;
116
+ /**
117
+ * Please note that this relates to the visibility in the Configuration tree.
118
+ * It does not affect the visibility of anything in the 3D view at all.
119
+ */
120
+ get visibleIfMainProduct(): boolean;
121
+ /**
122
+ * Please note that this relates to the visibility in the Configuration tree.
123
+ * It does not affect the visibility of anything in the 3D view at all.
124
+ */
125
+ get visible(): boolean;
126
+ _notifyAllOfChange: (bubbleMode: CfgProductBubbleMode) => Promise<void>;
127
+ /** Called when a child (additional product or the configuration) has changed. */
128
+ private _childHasChanged;
129
+ /** Called by child to tell its parent that it has changed. */
130
+ _additionalProductHasChanged: (freshRef: CfgProduct, bubbleMode: CfgProductBubbleMode) => Promise<void>;
131
+ /** Called by the configuration to tell its parent that it has changed. */
132
+ _configurationHasChanged: (freshRef: CfgProductConfiguration, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
133
+ getApiSelection: () => AdditionalProductConfiguration;
134
+ setApiSelection: (s: AdditionalProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
135
+ copyFrom: (source: _CfgProductInternal, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
136
+ private _setApiSelectionWithOtherProduct;
137
+ get syncGroupHandler(): SyncGroupsHandler | undefined;
138
+ structureCompare: (other: _CfgProductInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
139
+ tryMatchSelection: (other: _CfgProductInternal, descriptionMatch?: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
140
+ /** Only features in selected options and selected additional products. */
141
+ _getDescendantFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
142
+ private _revalidateInProgressToken;
143
+ /**
144
+ * Do a validate call for this product. It does not validate additional products, only this
145
+ * product in isolation. The validation result is applied on the configuration. Then additional
146
+ * products are synced (unloaded, loaded etc.) Finally the changes bubble up the tree.
147
+ */
148
+ _revalidate: (bubbleMode: CfgProductBubbleMode, productLoader: ProductLoader) => Promise<boolean>;
149
+ /**
150
+ * Based on this configuration find what additional products should be shown and not, unload
151
+ * (i.e. destroy) those that should no longer be shown, load the new ones.
152
+ */
153
+ _syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader) => Promise<boolean>;
154
+ }
155
+ export declare class CfgProduct {
156
+ readonly _internal: _CfgProductInternal;
157
+ static make(productLoader: ProductLoader, lang: string, catId: CatalogueParams, partNumber: string, settings?: Partial<CfgProductSettings>): Promise<CfgProduct>;
158
+ /**
159
+ * Makes an object wrapping the passed object. This is not a clone method, it is a method to
160
+ * make a new outer reference. Like a shallow copy. We use this to help frameworks that are
161
+ * build around using equals to detect change.
162
+ */
163
+ static _makeNewRefFrom(source: _CfgProductInternal): CfgProduct;
164
+ private constructor();
165
+ isBackedBySame: (other: CfgProduct) => boolean;
166
+ /**
167
+ * Recursively marks this and descendants as destroyed so that late events are ignored
168
+ * correctly. If you destroy one shallow copy of this you destroy all.
169
+ */
170
+ destroy: () => void;
171
+ /** Makes a clone of this. It is disconnected from the original. */
172
+ clone: () => Promise<CfgProduct>;
173
+ /**
174
+ * A client side only key that should uniquely identify this product amongst other additional
175
+ * products.
176
+ */
177
+ get key(): string;
178
+ /**
179
+ * Only used when this product is in additional product.
180
+ * As a product can have multiple instances of the same additional product this key exists.
181
+ * It will be unique amongst child products, but not globally unique.
182
+ */
183
+ get refKey(): string | undefined;
184
+ get lang(): string;
185
+ get catId(): CatalogueParams;
186
+ get partNumber(): string;
187
+ get isAdditionalProduct(): boolean;
188
+ /** Only used when this product is an additional product. Root products are never optional. */
189
+ get optional(): boolean;
190
+ /**
191
+ * Only applicable when this product is optional. If this product is not optional this is
192
+ * always true.
193
+ */
194
+ get selected(): boolean;
195
+ /**
196
+ * Please note that this relates to the visibility in the Configuration tree.
197
+ * It does not affect the visibility of anything in the 3D view at all.
198
+ * Visibility is affects the Configuration for this Product, but any Additional Products
199
+ * will not be affected.
200
+ */
201
+ get visible(): boolean;
202
+ /**
203
+ * Only applicable when this product is optional.
204
+ * Setting this does not cause a validation call as toggling an optional additional product is
205
+ * assumed to always be legal.
206
+ */
207
+ setSelected: (v: boolean) => Promise<boolean>;
208
+ get rawProductData(): CfgProductData;
209
+ get uuid(): string;
210
+ get unit(): LengthUnit;
211
+ get sku(): string;
212
+ get styleNr(): string;
213
+ /** An URL. */
214
+ get preview(): string | undefined;
215
+ get description(): string | undefined;
216
+ get additionalProducts(): CfgProduct[];
217
+ get configuration(): CfgProductConfiguration;
218
+ get transform(): Transform | undefined;
219
+ get currency(): string;
220
+ /**
221
+ * If positive the number of fraction digits.
222
+ * If negative rounding (essentially the number of zeros to the right)
223
+ */
224
+ get fractionDigits(): number;
225
+ get aggregatedPrice(): CfgPrice;
226
+ /**
227
+ * Experimental. Additional products lacks descriptions or keys that are suitably for structure
228
+ * compare, so we use strict-order when trying to match the additional products. This makes
229
+ * this method work nicely for different products having pretty much the same child products.
230
+ */
231
+ structureCompare: (other: CfgProduct, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
232
+ /**
233
+ * Experimental. Additional products lacks descriptions or keys that are suitably for try
234
+ * match, so we use strict-order when trying to match the additional products. This makes
235
+ * this method work nicely for different products having pretty much the same child products.
236
+ * This method does not propagate its selections.
237
+ * This method will cause validation calls if something change.
238
+ */
239
+ tryMatchSelection: (other: CfgProduct, descriptionMatch?: boolean) => Promise<boolean>;
240
+ /**
241
+ * Gets what selections has been made on the product, recursively including product
242
+ * configuration, optional products and additional products. Used when a full view of all
243
+ * selections on a product is needed, such as when doing Render or Export.
244
+ */
245
+ getApiSelection: () => AdditionalProductConfiguration;
246
+ setApiSelection: (s: AdditionalProductConfiguration, doValidate?: boolean) => Promise<boolean>;
247
+ listenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
248
+ stopListenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
249
+ stopAllListenForChange: () => void;
250
+ listenForLoading: (l: SingleArgCallback<boolean>) => void;
251
+ stopListenForLoading: (l: SingleArgCallback<boolean>) => void;
252
+ stopAllListenForLoading: () => void;
253
+ }
245
254
  //# sourceMappingURL=CfgProduct.d.ts.map