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