@configura/web-api 1.5.0 → 1.6.0-iotest.1

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