@configura/web-api 1.3.0-alpha.2 → 1.3.0-alpha.7
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.
- package/dist/CatalogueAPI.d.ts +55 -1
- package/dist/CfgMeasure.d.ts +33 -0
- package/dist/CfgMeasure.js +30 -0
- package/dist/CfgProduct.d.ts +106 -5
- package/dist/CfgProduct.js +117 -71
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/material/CfgMaterialMapping.js +11 -6
- package/dist/material/CfgMtrlApplication.js +4 -4
- package/dist/productConfiguration/CfgFeature.d.ts +30 -4
- package/dist/productConfiguration/CfgFeature.js +162 -52
- package/dist/productConfiguration/CfgOption.d.ts +21 -5
- package/dist/productConfiguration/CfgOption.js +125 -24
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +74 -4
- package/dist/productConfiguration/CfgProductConfiguration.js +158 -49
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +9 -1
- package/dist/productConfiguration/utilitiesProductConfiguration.js +32 -13
- package/dist/productLoader.d.ts +22 -0
- package/dist/productLoader.js +22 -14
- package/dist/tests/testData/dummyProductForTest.js +1 -0
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +13 -0
- package/dist/tests/testData/testDataCachedGetProduct.js +6 -0
- package/dist/tests/testData/testDataCachedPostValidate.js +6 -0
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +2 -0
- package/dist/tests/testData/testDataProductAggregatedPrice.js +6 -1
- package/dist/tests/testData/testDataUpcharge.js +4 -0
- package/dist/utilitiesCatalogueData.d.ts +5 -1
- package/dist/utilitiesCatalogueData.js +9 -1
- package/dist/utilitiesNumericValues.d.ts +25 -0
- package/dist/utilitiesNumericValues.js +109 -0
- package/package.json +3 -3
package/dist/CatalogueAPI.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface AdditionalProductRef {
|
|
|
11
11
|
catId: CatalogueParams;
|
|
12
12
|
partNumber: string;
|
|
13
13
|
refDescription?: string;
|
|
14
|
+
anchor?: MeasureParam;
|
|
14
15
|
transform?: Transform;
|
|
15
16
|
optional?: boolean;
|
|
16
17
|
}
|
|
@@ -59,6 +60,20 @@ export interface CataloguePermission {
|
|
|
59
60
|
export interface CategoryMap {
|
|
60
61
|
[index: string]: string;
|
|
61
62
|
}
|
|
63
|
+
/** CodeRange */
|
|
64
|
+
export interface CodeRange {
|
|
65
|
+
minValue: number;
|
|
66
|
+
maxValue: number;
|
|
67
|
+
increment?: number;
|
|
68
|
+
}
|
|
69
|
+
/** ConnectorRef */
|
|
70
|
+
export interface ConnectorRef {
|
|
71
|
+
code: string;
|
|
72
|
+
connectRule: string;
|
|
73
|
+
visible: boolean;
|
|
74
|
+
anchor?: MeasureParam;
|
|
75
|
+
transform: Transform;
|
|
76
|
+
}
|
|
62
77
|
/** ErrorResponse */
|
|
63
78
|
export interface ErrorResponse {
|
|
64
79
|
error: string;
|
|
@@ -95,10 +110,14 @@ export interface Feature {
|
|
|
95
110
|
groupCode?: string;
|
|
96
111
|
mtrlApplications?: Array<MtrlApplication>;
|
|
97
112
|
multiple?: boolean;
|
|
113
|
+
numericOrder: boolean;
|
|
98
114
|
optional?: boolean;
|
|
99
115
|
options: Array<Option>;
|
|
100
116
|
hideIfMainProduct?: boolean;
|
|
101
117
|
hideIfAdditionalProduct?: boolean;
|
|
118
|
+
measureParams?: Array<MeasureParam>;
|
|
119
|
+
syncGroup?: SyncGroup;
|
|
120
|
+
unit?: string;
|
|
102
121
|
}
|
|
103
122
|
/** FeatureRef */
|
|
104
123
|
export interface FeatureRef {
|
|
@@ -172,9 +191,26 @@ export interface Level {
|
|
|
172
191
|
export interface LevelProductRef {
|
|
173
192
|
prdRef: string;
|
|
174
193
|
}
|
|
194
|
+
/** Measurement */
|
|
195
|
+
export interface Measurement {
|
|
196
|
+
code: string;
|
|
197
|
+
numericValue?: ValueWithUnit;
|
|
198
|
+
measureParam?: MeasureParam;
|
|
199
|
+
}
|
|
200
|
+
/** MeasureParam */
|
|
201
|
+
export interface MeasureParam {
|
|
202
|
+
code: string;
|
|
203
|
+
anchorPoint?: string;
|
|
204
|
+
measurePriority?: Array<MeasurePriority>;
|
|
205
|
+
}
|
|
206
|
+
/** MeasurePriority */
|
|
207
|
+
export interface MeasurePriority {
|
|
208
|
+
url: string;
|
|
209
|
+
}
|
|
175
210
|
/** Model */
|
|
176
211
|
export interface Model {
|
|
177
212
|
cid: number;
|
|
213
|
+
anchor?: MeasureParam;
|
|
178
214
|
t?: Transform;
|
|
179
215
|
uri: string;
|
|
180
216
|
}
|
|
@@ -187,12 +223,13 @@ export interface MtrlApplication {
|
|
|
187
223
|
}
|
|
188
224
|
/** Option */
|
|
189
225
|
export interface Option {
|
|
226
|
+
additionalProductRefs?: Array<AdditionalProductRef>;
|
|
190
227
|
code: string;
|
|
191
228
|
description: string;
|
|
192
229
|
featureRefs?: Array<FeatureRef>;
|
|
193
230
|
material?: string;
|
|
194
231
|
mtrlApplications?: Array<MtrlApplication>;
|
|
195
|
-
|
|
232
|
+
codeRanges?: Array<CodeRange>;
|
|
196
233
|
upcharge?: number;
|
|
197
234
|
priceCodes?: Array<string>;
|
|
198
235
|
}
|
|
@@ -216,6 +253,7 @@ export interface PartsData {
|
|
|
216
253
|
/** PartsSelectedOption */
|
|
217
254
|
export interface PartsSelectedOption {
|
|
218
255
|
code: string;
|
|
256
|
+
numericValue?: ValueWithUnit;
|
|
219
257
|
description?: string;
|
|
220
258
|
feature: string;
|
|
221
259
|
featDesc: string;
|
|
@@ -305,6 +343,8 @@ export interface ProductData {
|
|
|
305
343
|
additionalProductRefs?: Array<AdditionalProductRef>;
|
|
306
344
|
navImage?: string;
|
|
307
345
|
sku: string;
|
|
346
|
+
measurements?: Array<Measurement>;
|
|
347
|
+
connectorRefs?: Array<ConnectorRef>;
|
|
308
348
|
tags?: Array<{
|
|
309
349
|
[index: string]: string;
|
|
310
350
|
}>;
|
|
@@ -330,6 +370,7 @@ export interface ProductResponse {
|
|
|
330
370
|
rootFeatureRefs: Array<FeatureRef>;
|
|
331
371
|
features: Array<Feature>;
|
|
332
372
|
productData: ProductData;
|
|
373
|
+
unit: string;
|
|
333
374
|
uuid: string;
|
|
334
375
|
}
|
|
335
376
|
/** RefreshSessionTokenResponse */
|
|
@@ -364,6 +405,7 @@ export declare type RenderStatusStatus = "pending" | "running" | "finished" | "f
|
|
|
364
405
|
/** SelectedOption */
|
|
365
406
|
export interface SelectedOption {
|
|
366
407
|
code: string;
|
|
408
|
+
numericValue?: ValueWithUnit;
|
|
367
409
|
next?: {
|
|
368
410
|
[index: string]: SelectedOption;
|
|
369
411
|
};
|
|
@@ -373,6 +415,13 @@ export interface SuccessResponse {
|
|
|
373
415
|
uuid: string;
|
|
374
416
|
success: boolean;
|
|
375
417
|
}
|
|
418
|
+
/** SyncGroup */
|
|
419
|
+
export interface SyncGroup {
|
|
420
|
+
syncGroupCode: string;
|
|
421
|
+
syncMethod: SyncGroupMethods;
|
|
422
|
+
}
|
|
423
|
+
/** SyncGroupMethods */
|
|
424
|
+
export declare type SyncGroupMethods = "pull" | "push" | "twoWay";
|
|
376
425
|
/** TargetCameraArgs */
|
|
377
426
|
export interface TargetCameraArgs {
|
|
378
427
|
location?: Point;
|
|
@@ -410,6 +459,11 @@ export interface ValidateResponse {
|
|
|
410
459
|
validated: boolean;
|
|
411
460
|
rootFeatureRefs?: Array<FeatureRef>;
|
|
412
461
|
}
|
|
462
|
+
/** ValueWithUnit */
|
|
463
|
+
export interface ValueWithUnit {
|
|
464
|
+
value: number;
|
|
465
|
+
unit?: string;
|
|
466
|
+
}
|
|
413
467
|
/** Vector */
|
|
414
468
|
export interface Vector {
|
|
415
469
|
x: number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Measurement, ValueWithUnit } from "./CatalogueAPI";
|
|
2
|
+
/**
|
|
3
|
+
* Measures can be used to Anchor items (Models or Additional Products).
|
|
4
|
+
*
|
|
5
|
+
* Measures originates in Models, and can then be used in Products. There is nothing stopping
|
|
6
|
+
* having multiple Models in the same Product that use the same Measure name. If so it is ambiguous
|
|
7
|
+
* which of the Models in the Product to anchor to.
|
|
8
|
+
*
|
|
9
|
+
* Measure Priority tries to solve this by allowing MeasureParams to contain an ordered list
|
|
10
|
+
* containing which Model should have highest priority (i.e. gets "first dibs") when Anchoring.
|
|
11
|
+
*
|
|
12
|
+
* Unfortunately the solution is currently a bit limited - we can not differentiate between Models
|
|
13
|
+
* pointing to the same URL in a Product. However, we consistently pick the first one.
|
|
14
|
+
* Lower index = higher priority
|
|
15
|
+
*/
|
|
16
|
+
export declare type CfgMeasurePriority = {
|
|
17
|
+
index: number;
|
|
18
|
+
modelLocalFilePath: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* This class strips the Measurement of things that are not actually used or relevant
|
|
22
|
+
* to Stage, specifically anchoring and stretching. Measurments can also contain
|
|
23
|
+
* volume and area, but these are ignored. Here Measures are used to define defaults
|
|
24
|
+
* such as its preferences when dealing with ambiguity or its default value.
|
|
25
|
+
*/
|
|
26
|
+
export declare class CfgMeasureDefinition {
|
|
27
|
+
readonly measureParamCode: string;
|
|
28
|
+
readonly numericValue: ValueWithUnit | undefined;
|
|
29
|
+
readonly measurePriorities: CfgMeasurePriority[];
|
|
30
|
+
static make(measurement: Measurement): CfgMeasureDefinition | undefined;
|
|
31
|
+
private constructor();
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=CfgMeasure.d.ts.map
|
|
@@ -0,0 +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
|
+
}
|
package/dist/CfgProduct.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AggregatedLoadingObservable, Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import { AdditionalProductConfiguration, CatalogueParams, MtrlApplication, Prices, Transform } from "./CatalogueAPI.js";
|
|
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";
|
|
3
4
|
import { _CfgFeatureInternal } from "./productConfiguration/CfgFeature.js";
|
|
4
5
|
import { ProductConfigurationBubbleMode } from "./productConfiguration/CfgOption.js";
|
|
5
6
|
import { CfgProductConfiguration } from "./productConfiguration/CfgProductConfiguration.js";
|
|
@@ -9,13 +10,36 @@ export declare type CfgProductChangeNotification = {
|
|
|
9
10
|
freshRef: CfgProduct;
|
|
10
11
|
};
|
|
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
|
+
*/
|
|
12
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
|
+
*/
|
|
13
26
|
strictSetApiSelectionMatch: boolean;
|
|
14
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* This enum is used internally in the SDK and is not expected by be used directly by integrators.
|
|
30
|
+
*/
|
|
15
31
|
export declare enum CfgProductBubbleMode {
|
|
32
|
+
/** Stop bubbling. */
|
|
16
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
|
+
*/
|
|
17
39
|
OneLevel = "OneLevel",
|
|
40
|
+
/** Bubble to the root CfgProduct. */
|
|
18
41
|
ToRoot = "ToRoot",
|
|
42
|
+
/** Bubble to the root CfgProduct and turn on all optional CfgProducts on the way up. */
|
|
19
43
|
ToRootAndBubbleSelected = "ToRootAndBubbleSelected"
|
|
20
44
|
}
|
|
21
45
|
export declare type CfgPrice = {
|
|
@@ -24,6 +48,11 @@ export declare type CfgPrice = {
|
|
|
24
48
|
currency: string;
|
|
25
49
|
fractionDigits: number;
|
|
26
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
|
+
*/
|
|
27
56
|
export declare class _CfgProductInternal {
|
|
28
57
|
readonly _productLoaderRaw: ProductLoader;
|
|
29
58
|
readonly lang: string;
|
|
@@ -31,13 +60,15 @@ export declare class _CfgProductInternal {
|
|
|
31
60
|
readonly partNumber: string;
|
|
32
61
|
readonly settings: CfgProductSettings;
|
|
33
62
|
readonly uuid: string;
|
|
63
|
+
private readonly _rawUnit;
|
|
34
64
|
private _rawProductData;
|
|
35
65
|
readonly loadingObservable: AggregatedLoadingObservable;
|
|
36
66
|
readonly refKey: string | undefined;
|
|
37
67
|
readonly refDescription: string | undefined;
|
|
38
68
|
readonly parent: _CfgProductInternal | undefined;
|
|
39
69
|
readonly transform: Transform | undefined;
|
|
40
|
-
|
|
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>;
|
|
41
72
|
private constructor();
|
|
42
73
|
readonly root: _CfgProductInternal;
|
|
43
74
|
private _destroyed;
|
|
@@ -56,55 +87,125 @@ export declare class _CfgProductInternal {
|
|
|
56
87
|
get currency(): string;
|
|
57
88
|
get fractionDigits(): number;
|
|
58
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;
|
|
59
95
|
get aggregatedPrice(): CfgPrice;
|
|
60
96
|
get optional(): boolean;
|
|
61
97
|
setSelected(v: boolean, bubbleMode: CfgProductBubbleMode): Promise<boolean>;
|
|
62
98
|
get configuration(): CfgProductConfiguration;
|
|
63
99
|
get rawProductData(): CfgProductData;
|
|
64
100
|
_notifyAllOfChange: (bubbleMode: CfgProductBubbleMode) => Promise<void>;
|
|
101
|
+
/** Called when a child (additional product or the configuration) has changed. */
|
|
65
102
|
private _childHasChanged;
|
|
103
|
+
/** Called by child to tell its parent that it has changed. */
|
|
66
104
|
_additionalProductHasChanged: (freshRef: CfgProduct, bubbleMode: CfgProductBubbleMode) => Promise<void>;
|
|
105
|
+
/** Called by the configuration to tell its parent that it has changed. */
|
|
67
106
|
_configurationHasChanged: (freshRef: CfgProductConfiguration, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
|
|
68
107
|
getApiSelection: () => AdditionalProductConfiguration;
|
|
69
108
|
setApiSelection: (s: AdditionalProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
70
109
|
structureCompare: (other: _CfgProductInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
|
|
71
110
|
tryMatchSelection: (other: _CfgProductInternal, descriptionMatch?: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
111
|
+
/** Only features in selected options and selected additional products. */
|
|
72
112
|
_getDescendantFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
|
|
73
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
|
+
*/
|
|
74
119
|
_revalidate: (bubbleMode: CfgProductBubbleMode, productLoaderForGroupedLoad: 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
|
+
*/
|
|
75
124
|
_syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader) => Promise<boolean>;
|
|
76
125
|
}
|
|
77
126
|
export declare class CfgProduct {
|
|
78
127
|
readonly _internal: _CfgProductInternal;
|
|
79
|
-
static make
|
|
80
|
-
|
|
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;
|
|
81
135
|
private constructor();
|
|
82
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
|
+
*/
|
|
83
141
|
destroy: () => void;
|
|
142
|
+
/** Makes a clone of this. It is disconnected from the original. */
|
|
84
143
|
clone: () => Promise<CfgProduct>;
|
|
144
|
+
/**
|
|
145
|
+
* A client side only key that should uniquely identify this product amongst other additional
|
|
146
|
+
* products.
|
|
147
|
+
*/
|
|
85
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
|
+
*/
|
|
86
154
|
get refKey(): string | undefined;
|
|
87
155
|
get lang(): string;
|
|
88
156
|
get catId(): CatalogueParams;
|
|
89
157
|
get partNumber(): string;
|
|
90
158
|
get isAdditionalProduct(): boolean;
|
|
159
|
+
/** Only used when this product is an additional product. Root products are never optional. */
|
|
91
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
|
+
*/
|
|
92
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
|
+
*/
|
|
93
171
|
setSelected: (v: boolean) => Promise<boolean>;
|
|
94
172
|
get rawProductData(): CfgProductData;
|
|
95
173
|
get uuid(): string;
|
|
174
|
+
get unit(): LengthUnit;
|
|
96
175
|
get sku(): string;
|
|
97
176
|
get styleNr(): string;
|
|
177
|
+
/** An URL. */
|
|
98
178
|
get preview(): string | undefined;
|
|
99
179
|
get description(): string | undefined;
|
|
100
180
|
get additionalProducts(): CfgProduct[];
|
|
101
181
|
get configuration(): CfgProductConfiguration;
|
|
102
182
|
get transform(): Transform | undefined;
|
|
103
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
|
+
*/
|
|
104
188
|
get fractionDigits(): number;
|
|
105
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
|
+
*/
|
|
106
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
|
+
*/
|
|
107
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
|
+
*/
|
|
108
209
|
getApiSelection: () => AdditionalProductConfiguration;
|
|
109
210
|
setApiSelection: (s: AdditionalProductConfiguration, doValidate?: boolean) => Promise<boolean>;
|
|
110
211
|
listenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
|