@configura/web-api 2.0.0 → 2.1.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.
- package/.eslintrc.json +5 -5
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +622 -622
- package/dist/CatalogueAPI.js +329 -329
- package/dist/CfgMeasure.d.ts +32 -32
- package/dist/CfgMeasure.js +30 -30
- package/dist/CfgProduct.d.ts +344 -344
- package/dist/CfgProduct.js +990 -991
- package/dist/CfgReferencePathHelper.d.ts +26 -26
- package/dist/CfgReferencePathHelper.js +26 -26
- package/dist/index.d.ts +23 -23
- package/dist/index.js +23 -23
- package/dist/io/CfgHistoryManager.d.ts +83 -83
- package/dist/io/CfgHistoryManager.js +144 -144
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -21
- package/dist/io/CfgHistoryToProdConfConnector.js +50 -50
- package/dist/io/CfgIOManager.d.ts +53 -53
- package/dist/io/CfgIOManager.js +134 -134
- package/dist/io/CfgIOProdConfConnector.d.ts +54 -64
- package/dist/io/CfgIOProdConfConnector.js +137 -149
- package/dist/io/CfgIOWarningSupplier.d.ts +3 -3
- package/dist/io/CfgIOWarningSupplier.js +1 -1
- package/dist/io/CfgObservableStateManager.d.ts +25 -25
- package/dist/io/CfgObservableStateManager.js +69 -69
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -14
- package/dist/io/CfgObservableStateToProdConfConnector.js +17 -16
- package/dist/io/CfgWindowEventManager.d.ts +21 -21
- package/dist/io/CfgWindowEventManager.js +38 -38
- package/dist/io/CfgWindowMessageManager.d.ts +40 -40
- package/dist/io/CfgWindowMessageManager.js +91 -91
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -16
- package/dist/io/CfgWindowMessageToProdConfConnector.js +19 -18
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +8 -8
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +181 -181
- package/dist/material/CfgMtrlApplication.d.ts +18 -18
- package/dist/material/CfgMtrlApplication.js +43 -43
- package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
- package/dist/material/CfgMtrlApplicationSource.js +8 -8
- package/dist/material/CfgMtrlSource.d.ts +19 -19
- package/dist/material/CfgMtrlSource.js +40 -40
- package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
- package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
- package/dist/productConfiguration/CfgFeature.d.ts +192 -192
- package/dist/productConfiguration/CfgFeature.js +664 -663
- package/dist/productConfiguration/CfgOption.d.ts +157 -157
- package/dist/productConfiguration/CfgOption.js +444 -444
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +128 -128
- package/dist/productConfiguration/CfgProductConfiguration.js +331 -331
- package/dist/productConfiguration/filters.d.ts +17 -15
- package/dist/productConfiguration/filters.js +141 -70
- package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
- package/dist/productConfiguration/productParamsGenerator.js +51 -51
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
- package/dist/productConfiguration/utilitiesProductConfiguration.js +87 -87
- package/dist/productLoader.d.ts +33 -33
- package/dist/productLoader.js +49 -49
- package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
- package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
- package/dist/syncGroups/SyncGroupsHandler.d.ts +47 -47
- package/dist/syncGroups/SyncGroupsHandler.js +370 -370
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
- package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
- package/dist/syncGroups/SyncGroupsState.d.ts +39 -39
- package/dist/syncGroups/SyncGroupsState.js +167 -167
- package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
- package/dist/syncGroups/SyncGroupsTransaction.js +589 -589
- package/dist/tasks/TaskHandler.d.ts +77 -77
- package/dist/tasks/TaskHandler.js +276 -276
- package/dist/tasks/formats.d.ts +4 -4
- package/dist/tasks/formats.js +7 -7
- package/dist/tests/testData/collectorForTest.d.ts +73 -73
- package/dist/tests/testData/collectorForTest.js +194 -194
- package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
- package/dist/tests/testData/dummyProductForTest.js +32 -32
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +282 -282
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +187 -187
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +185 -185
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
- package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
- package/dist/tests/testData/testDataOptions.d.ts +12 -12
- package/dist/tests/testData/testDataOptions.js +60 -60
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
- package/dist/tests/testData/testDataProductAggregatedPrice.js +189 -189
- package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
- package/dist/tests/testData/testDataUpcharge.js +121 -121
- package/dist/utilitiesCatalogueData.d.ts +47 -47
- package/dist/utilitiesCatalogueData.js +180 -180
- package/dist/utilitiesCataloguePermission.d.ts +38 -38
- package/dist/utilitiesCataloguePermission.js +79 -79
- package/dist/{ConfigurationConverter.d.ts → utilitiesConfiguration.d.ts} +29 -18
- package/dist/{ConfigurationConverter.js → utilitiesConfiguration.js} +200 -175
- package/dist/utilitiesNumericValues.d.ts +24 -24
- package/dist/utilitiesNumericValues.js +114 -114
- package/package.json +3 -3
package/dist/CfgProduct.d.ts
CHANGED
|
@@ -1,345 +1,345 @@
|
|
|
1
|
-
import { AggregatedLoadingObservable, LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import { DtoAdditionalProductConfiguration, DtoAdditionalProductRef, DtoCatalogueParamsWithCid, DtoMeasureParam, DtoMiscFile, DtoMtrlApplication, DtoNote, DtoPrices, DtoProductConf, DtoProductParamsWithCidAndLang, DtoTransform } from "./CatalogueAPI.js";
|
|
3
|
-
import { CfgMeasureDefinition } from "./CfgMeasure.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
/**
|
|
13
|
-
* @freshRef a new pointer to the same product, backed by the same original object
|
|
14
|
-
* @committed false is an indication that this is a potentially transient state. It could
|
|
15
|
-
* be the expected outcome of a SyncGroups transaction, or dragging to stretch a Product.
|
|
16
|
-
* Uncommitted notifications can be used to update for instance spinners, but should not
|
|
17
|
-
* be sent to server or such.
|
|
18
|
-
*/
|
|
19
|
-
export declare type CfgProductChangeNotification = {
|
|
20
|
-
freshRef: CfgProduct;
|
|
21
|
-
committed: boolean;
|
|
22
|
-
};
|
|
23
|
-
export declare type CfgProductSettings = {
|
|
24
|
-
/**
|
|
25
|
-
* In a correctly setup catalogue a select-one Feature (i.e. neither optional nor multiple)
|
|
26
|
-
* must have exactly one Option set at a time. However, this is not enforced in Catalogue
|
|
27
|
-
* Creator and it is not uncommon with catalogues which fails to meet this requirement.
|
|
28
|
-
* Activating this will make setApi throw an Error if more or less than one is selected.
|
|
29
|
-
*/
|
|
30
|
-
strictSelectOneSelectionCount: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Controls if SyncGroups are applied Faster or Stricter.
|
|
33
|
-
*
|
|
34
|
-
* Fast - Tries to minimize the number of validates calls to the AI lowering the response times
|
|
35
|
-
* for selecting options. Might not always give the expected result for complex products.
|
|
36
|
-
*
|
|
37
|
-
* Strict - Apply the SyncGroups rules in a stricter fashion to be as close to CET as possible,
|
|
38
|
-
* which might result in longer response times and more validation calls to the API when
|
|
39
|
-
* selecting options.
|
|
40
|
-
*
|
|
41
|
-
* The SDK will default to Strict, but we recommend that you try out Fast since cases where the
|
|
42
|
-
* results differ should be rare in most real uses cases and the speedup can be quite large.
|
|
43
|
-
*/
|
|
44
|
-
syncGroupsApplyMode: SyncGroupsApplyMode | undefined;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* This enum is used internally in the SDK and is not expected by be used directly by integrators.
|
|
48
|
-
*/
|
|
49
|
-
export declare enum CfgProductBubbleMode {
|
|
50
|
-
/** Stop bubbling. */
|
|
51
|
-
Stop = "Stop",
|
|
52
|
-
/**
|
|
53
|
-
* Bubble to the parent CfgProduct up the tree.
|
|
54
|
-
* This makes the CfgProduct we we call from notify that it has changed, and the CfgProduct
|
|
55
|
-
* above switch out the reference to this.
|
|
56
|
-
*/
|
|
57
|
-
OneLevel = "OneLevel",
|
|
58
|
-
/** Bubble to the root CfgProduct. */
|
|
59
|
-
ToRoot = "ToRoot",
|
|
60
|
-
/** Bubble to the root CfgProduct and turn on all optional CfgProducts on the way up. */
|
|
61
|
-
ToRootAndBubbleSelected = "ToRootAndBubbleSelected"
|
|
62
|
-
}
|
|
63
|
-
export declare type CfgPrice = {
|
|
64
|
-
basePrice: number;
|
|
65
|
-
listPrice: number;
|
|
66
|
-
currency: string;
|
|
67
|
-
fractionDigits: number;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* This class is meant to only be used through CfgProduct. It should never be instantiated on its
|
|
71
|
-
* own. Normally the internal state of this class should never be directly modified. CfgProduct is
|
|
72
|
-
* the class that should be used and interacted with.
|
|
73
|
-
*/
|
|
74
|
-
export declare class _CfgProductInternal {
|
|
75
|
-
readonly _productLoaderRaw: ProductLoader;
|
|
76
|
-
readonly prodParams: DtoProductParamsWithCidAndLang;
|
|
77
|
-
readonly settings: CfgProductSettings;
|
|
78
|
-
readonly uuid: string;
|
|
79
|
-
private readonly _rawUnit;
|
|
80
|
-
private _rawProductData;
|
|
81
|
-
readonly loadingObservable: AggregatedLoadingObservable;
|
|
82
|
-
readonly parent: _CfgProductInternal | undefined;
|
|
83
|
-
private _additionalProductRef;
|
|
84
|
-
private readonly _syncGroupHandler;
|
|
85
|
-
static make: (productLoaderRaw: ProductLoader, productLoaderForGroupedLoad: ProductLoader | undefined, prodParams: DtoProductParamsWithCidAndLang, settings: CfgProductSettings, optional: boolean, loadingObservable: AggregatedLoadingObservable, parent: _CfgProductInternal | undefined, root: _CfgProductInternal | undefined, additionalProductRef: DtoAdditionalProductRef | undefined, initialProductConfiguration: DtoProductConf | DtoAdditionalProductConfiguration | undefined) => Promise<_CfgProductInternal>;
|
|
86
|
-
_initialClone: _CfgProductInternal | undefined;
|
|
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
|
-
private _notes;
|
|
95
|
-
readonly changeObservable: Observable<CfgProductChangeNotification>;
|
|
96
|
-
get selected(): boolean;
|
|
97
|
-
readonly isAdditionalProduct: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Please note that cloning an additional product will make the clone believe is is
|
|
100
|
-
* an additional product, even if it has no parent and root.
|
|
101
|
-
* Providing the parent and root of what you clone as arguments is unwise as it will
|
|
102
|
-
* make changes you do on the clone be propagated up to the original non-clone root product.
|
|
103
|
-
*/
|
|
104
|
-
clone(parent?: _CfgProductInternal, root?: _CfgProductInternal): Promise<_CfgProductInternal>;
|
|
105
|
-
/** Mark this and its descendants as destroyed and remove all listeners */
|
|
106
|
-
destroy: () => void;
|
|
107
|
-
/**
|
|
108
|
-
* Reset will reset the product to its initial state
|
|
109
|
-
*/
|
|
110
|
-
reset: () => Promise<void>;
|
|
111
|
-
/**
|
|
112
|
-
* Internal use. Used when this product is an additional product, and
|
|
113
|
-
* changing a parent product has made the settings for this product
|
|
114
|
-
* change.
|
|
115
|
-
*/
|
|
116
|
-
_updateAdditionalProdRef(p: DtoAdditionalProductRef): void;
|
|
117
|
-
/**
|
|
118
|
-
* Return a DtoNode using noteRef as a key.
|
|
119
|
-
* Throws an error if no note is found.
|
|
120
|
-
*/
|
|
121
|
-
getNote(noteRef: string): DtoNote;
|
|
122
|
-
/**
|
|
123
|
-
* noteRefs is a list of keys coming from CfgOption, CfgFeature or CfgProduct.
|
|
124
|
-
* The keys are used to get a DtoNote[] from notes at CfgProduct.
|
|
125
|
-
*/
|
|
126
|
-
getNotes(noteRefs: string[]): DtoNote[];
|
|
127
|
-
private addNotes;
|
|
128
|
-
get notes(): DtoNote[];
|
|
129
|
-
get miscFiles(): DtoMiscFile[];
|
|
130
|
-
get hasRootFeaturesChanged(): boolean;
|
|
131
|
-
get description(): string | undefined;
|
|
132
|
-
get rootNodeSources(): RootNodeSource[] | undefined;
|
|
133
|
-
get mtrlApplications(): DtoMtrlApplication[] | undefined;
|
|
134
|
-
get currency(): string;
|
|
135
|
-
get fractionDigits(): number;
|
|
136
|
-
get prices(): DtoPrices | undefined;
|
|
137
|
-
private _measureDefinitions;
|
|
138
|
-
get measureDefinitions(): CfgMeasureDefinition[];
|
|
139
|
-
private _unit;
|
|
140
|
-
get refKey(): string | undefined;
|
|
141
|
-
get transform(): DtoTransform | undefined;
|
|
142
|
-
get anchor(): DtoMeasureParam | undefined;
|
|
143
|
-
/** @throws an error if the actual unit sent by the server was not a LengthUnit */
|
|
144
|
-
get unit(): LengthUnit;
|
|
145
|
-
get aggregatedPrice(): CfgPrice;
|
|
146
|
-
get optional(): boolean;
|
|
147
|
-
setSelected(selected: boolean, bubbleMode: CfgProductBubbleMode, interactive: boolean): Promise<boolean>;
|
|
148
|
-
get configuration(): CfgProductConfiguration;
|
|
149
|
-
get rawProductData(): CfgProductData;
|
|
150
|
-
/**
|
|
151
|
-
* Please note that this relates to the visibility in the Configuration tree.
|
|
152
|
-
* It does not affect the visibility of anything in the 3D view at all.
|
|
153
|
-
*/
|
|
154
|
-
get visibleIfAdditionalProduct(): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Please note that this relates to the visibility in the Configuration tree.
|
|
157
|
-
* It does not affect the visibility of anything in the 3D view at all.
|
|
158
|
-
*/
|
|
159
|
-
get visibleIfMainProduct(): boolean;
|
|
160
|
-
/**
|
|
161
|
-
* Please note that this relates to the visibility in the Configuration tree.
|
|
162
|
-
* It does not affect the visibility of anything in the 3D view at all.
|
|
163
|
-
*/
|
|
164
|
-
get visible(): boolean;
|
|
165
|
-
_notifyAllOfChange: (bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
|
|
166
|
-
/** Called when a child (additional product or the configuration) has changed. */
|
|
167
|
-
private _childHasChanged;
|
|
168
|
-
/** Called by child to tell its parent that it has changed. */
|
|
169
|
-
_additionalProductHasChanged: (freshRef: CfgProduct, bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
|
|
170
|
-
/** Called by the configuration to tell its parent that it has changed. */
|
|
171
|
-
_configurationHasChanged: (freshRef: CfgProductConfiguration, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
|
|
172
|
-
getDtoConf: (include: CfgProdConfParts) => DtoProductConf;
|
|
173
|
-
setDtoConf: (s: DtoProductConf, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
174
|
-
setApiSelection: (s: DtoAdditionalProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
175
|
-
copyFrom: (source: _CfgProductInternal, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
176
|
-
private _setApiSelectionWithOtherProduct;
|
|
177
|
-
get syncGroupHandler(): SyncGroupsHandler | undefined;
|
|
178
|
-
get syncGroupsVerboseLogging(): boolean;
|
|
179
|
-
/**
|
|
180
|
-
* Set to true to get verbose sync state changes logged to the console.
|
|
181
|
-
*/
|
|
182
|
-
set syncGroupsVerboseLogging(v: boolean);
|
|
183
|
-
structureCompare: (other: _CfgProductInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
|
|
184
|
-
tryMatchSelection: (other: _CfgProductInternal, descriptionMatch?: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
185
|
-
/** Only features in selected options and selected additional products. */
|
|
186
|
-
_getDescendantFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
|
|
187
|
-
private _revalidateInProgressToken;
|
|
188
|
-
/**
|
|
189
|
-
* Do a validate call for this product. It does not validate additional products, only this
|
|
190
|
-
* product in isolation. The validation result is applied on the configuration. Then additional
|
|
191
|
-
* products are synced (unloaded, loaded etc.) Finally the changes bubble up the tree.
|
|
192
|
-
*/
|
|
193
|
-
_revalidate: (bubbleMode: CfgProductBubbleMode, productLoader: ProductLoader, committed: boolean) => Promise<boolean>;
|
|
194
|
-
/**
|
|
195
|
-
* Based on this configuration find what additional products should be shown and not, unload
|
|
196
|
-
* (i.e. destroy) those that should no longer be shown, load the new ones.
|
|
197
|
-
*/
|
|
198
|
-
_syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader, initialProductConfiguration: DtoAdditionalProductConfiguration | undefined) => Promise<boolean>;
|
|
199
|
-
}
|
|
200
|
-
export declare class CfgProduct {
|
|
201
|
-
readonly _internal: _CfgProductInternal;
|
|
202
|
-
static make(productLoader: ProductLoader, prodParams: DtoProductParamsWithCidAndLang, settings?: Partial<CfgProductSettings>, initialProductConfiguration?: DtoProductConf | DtoAdditionalProductConfiguration): Promise<CfgProduct>;
|
|
203
|
-
/**
|
|
204
|
-
* Makes an object wrapping the passed object. This is not a clone method, it is a method to
|
|
205
|
-
* make a new outer reference. Like a shallow copy. We use this to help frameworks that are
|
|
206
|
-
* build around using equals to detect change.
|
|
207
|
-
*/
|
|
208
|
-
static _makeNewRefFrom(source: _CfgProductInternal): CfgProduct;
|
|
209
|
-
private constructor();
|
|
210
|
-
isBackedBySame: (other: CfgProduct) => boolean;
|
|
211
|
-
/**
|
|
212
|
-
* Recursively marks this and descendants as destroyed so that late events are ignored
|
|
213
|
-
* correctly. If you destroy one shallow copy of this you destroy all.
|
|
214
|
-
*/
|
|
215
|
-
destroy: () => void;
|
|
216
|
-
/** Makes a clone of this. It is disconnected from the original. */
|
|
217
|
-
clone: () => Promise<CfgProduct>;
|
|
218
|
-
/**
|
|
219
|
-
* A client side only key that should uniquely identify this product amongst other additional
|
|
220
|
-
* products.
|
|
221
|
-
*/
|
|
222
|
-
get key(): string;
|
|
223
|
-
/**
|
|
224
|
-
* Only used when this product is in additional product.
|
|
225
|
-
* As a product can have multiple instances of the same additional product this key exists.
|
|
226
|
-
* It will be unique amongst child products, but not globally unique.
|
|
227
|
-
*/
|
|
228
|
-
get refKey(): string | undefined;
|
|
229
|
-
get notes(): DtoNote[];
|
|
230
|
-
get miscFiles(): DtoMiscFile[];
|
|
231
|
-
get prodParams(): DtoProductParamsWithCidAndLang;
|
|
232
|
-
get lang(): string;
|
|
233
|
-
get catId(): DtoCatalogueParamsWithCid;
|
|
234
|
-
get partNumber(): string;
|
|
235
|
-
get isAdditionalProduct(): boolean;
|
|
236
|
-
/** Only used when this product is an additional product. Root products are never optional. */
|
|
237
|
-
get optional(): boolean;
|
|
238
|
-
/**
|
|
239
|
-
* Only applicable when this product is optional. If this product is not optional this is
|
|
240
|
-
* always true.
|
|
241
|
-
*/
|
|
242
|
-
get selected(): boolean;
|
|
243
|
-
/**
|
|
244
|
-
* Please note that this relates to the visibility in the Configuration tree.
|
|
245
|
-
* It does not affect the visibility of anything in the 3D view at all.
|
|
246
|
-
* Visibility affects the Configuration for this Product, but any Additional Products
|
|
247
|
-
* will not be affected.
|
|
248
|
-
*/
|
|
249
|
-
get visible(): boolean;
|
|
250
|
-
/**
|
|
251
|
-
* Only applicable when this product is optional.
|
|
252
|
-
* Setting this does not cause a validation call as toggling an optional additional product is
|
|
253
|
-
* assumed to always be legal.
|
|
254
|
-
*/
|
|
255
|
-
setSelected: (v: boolean) => Promise<boolean>;
|
|
256
|
-
/**
|
|
257
|
-
* Functional selection is a Catalogues feature where selecting Options on Features result in that you
|
|
258
|
-
* "jump" to another Product as a result of the Validate call. You normally do not notice that a functional
|
|
259
|
-
* selection has occurred except for the styleNr changing. Functional selection can change which Features
|
|
260
|
-
* from the original product call are used as root Features. This can in turn affect if serialized
|
|
261
|
-
* configuration can be applied or not.
|
|
262
|
-
*
|
|
263
|
-
* The SDK can currently only apply serialized configuration if the list of root Features has not changed.
|
|
264
|
-
* For this reason, when functional selection has happened, extracting data for external systems might work
|
|
265
|
-
* well, but reapplying back into Stage will probably fail.
|
|
266
|
-
*/
|
|
267
|
-
get hasRootFeaturesChanged(): boolean;
|
|
268
|
-
get rawProductData(): CfgProductData;
|
|
269
|
-
get uuid(): string;
|
|
270
|
-
get unit(): LengthUnit;
|
|
271
|
-
get sku(): string;
|
|
272
|
-
get styleNr(): string;
|
|
273
|
-
/** An URL. */
|
|
274
|
-
get preview(): string | undefined;
|
|
275
|
-
get description(): string | undefined;
|
|
276
|
-
get additionalProducts(): CfgProduct[];
|
|
277
|
-
get configuration(): CfgProductConfiguration;
|
|
278
|
-
get transform(): DtoTransform | undefined;
|
|
279
|
-
get currency(): string;
|
|
280
|
-
/**
|
|
281
|
-
* If positive the number of fraction digits.
|
|
282
|
-
* If negative rounding (essentially the number of zeros to the right)
|
|
283
|
-
*/
|
|
284
|
-
get fractionDigits(): number;
|
|
285
|
-
get aggregatedPrice(): CfgPrice;
|
|
286
|
-
/**
|
|
287
|
-
* Experimental. Additional products lacks descriptions or keys that are suitably for structure
|
|
288
|
-
* compare, so we use strict-order when trying to match the additional products. This makes
|
|
289
|
-
* this method work nicely for different products having pretty much the same child products.
|
|
290
|
-
*/
|
|
291
|
-
structureCompare: (other: CfgProduct, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
|
|
292
|
-
/**
|
|
293
|
-
* Experimental. Additional products lacks descriptions or keys that are suitably for try
|
|
294
|
-
* match, so we use strict-order when trying to match the additional products. This makes
|
|
295
|
-
* this method work nicely for different products having pretty much the same child products.
|
|
296
|
-
* This method does not propagate its selections.
|
|
297
|
-
* This method will cause validation calls if something change.
|
|
298
|
-
*/
|
|
299
|
-
tryMatchSelection: (other: CfgProduct, descriptionMatch?: boolean) => Promise<boolean>;
|
|
300
|
-
/**
|
|
301
|
-
* Gets what selections has been made on the product, recursively including product
|
|
302
|
-
* configuration, optional products and additional products. Used when a full view of all
|
|
303
|
-
* selections on a product is needed, such as when doing Render or Export.
|
|
304
|
-
* @deprecated getDtoConf provides a newer format.
|
|
305
|
-
* @see getDtoConf
|
|
306
|
-
*/
|
|
307
|
-
getApiSelection: () => DtoAdditionalProductConfiguration;
|
|
308
|
-
/**
|
|
309
|
-
* Applies the configuration (selections) in the passed object onto the product recursively
|
|
310
|
-
* including product configuration, optional products and additional products.
|
|
311
|
-
* @param doValidate Makes a server side validation call. These are necessary to ensure that
|
|
312
|
-
* the right models are loaded.
|
|
313
|
-
* @deprecated setDtoConf uses a newer format.
|
|
314
|
-
*/
|
|
315
|
-
setApiSelection: (configuration: DtoAdditionalProductConfiguration, doValidate?: boolean) => Promise<boolean>;
|
|
316
|
-
/**
|
|
317
|
-
* A newer alternative version of getApiSelection. This returns the configuration (selections)
|
|
318
|
-
* on the product, recursively including product configuration, optional products and additional
|
|
319
|
-
* products.
|
|
320
|
-
* This version has the following advantages over getApiSelection:
|
|
321
|
-
* - The format is clearer, designed to be readable
|
|
322
|
-
* - Makes less assumptions about the structure in the Product being unchanging over time. In
|
|
323
|
-
* particular, the Feature codes are included in the data, so that changes to what Features
|
|
324
|
-
* are used in a Product is less likely to lead to unexpected results.
|
|
325
|
-
* - You can request ExtendedData, ProductParams and/or SyncGroupState to be included in the
|
|
326
|
-
* result. This extra data is ignored when passed back into the API, but it can be very useful
|
|
327
|
-
* for external applications.
|
|
328
|
-
* The other version (getApiSelection) has the advantage of using a format directly compatible with the API:s.
|
|
329
|
-
* @param include Includes extra data which is not an actual part of the configuration
|
|
330
|
-
*/
|
|
331
|
-
getDtoConf: (include?: CfgProdConfParts) => DtoProductConf;
|
|
332
|
-
/**
|
|
333
|
-
* A newer alternative version of setApiSelection.
|
|
334
|
-
* @param doValidate Makes a server side validation call. These are necessary to ensure that
|
|
335
|
-
* the right models are loaded.
|
|
336
|
-
*/
|
|
337
|
-
setDtoConf: (configuration: DtoProductConf, doValidate?: boolean) => Promise<boolean>;
|
|
338
|
-
listenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
|
|
339
|
-
stopListenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
|
|
340
|
-
stopAllListenForChange: () => void;
|
|
341
|
-
listenForLoading: (l: SingleArgCallback<boolean>) => void;
|
|
342
|
-
stopListenForLoading: (l: SingleArgCallback<boolean>) => void;
|
|
343
|
-
stopAllListenForLoading: () => void;
|
|
344
|
-
}
|
|
1
|
+
import { AggregatedLoadingObservable, LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
+
import { DtoAdditionalProductConfiguration, DtoAdditionalProductRef, DtoCatalogueParamsWithCid, DtoMeasureParam, DtoMiscFile, DtoMtrlApplication, DtoNote, DtoPrices, DtoProductConf, DtoProductParamsWithCidAndLang, DtoTransform } 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
|
+
import { CfgProdConfParts } from "./utilitiesConfiguration.js";
|
|
12
|
+
/**
|
|
13
|
+
* @freshRef a new pointer to the same product, backed by the same original object
|
|
14
|
+
* @committed false is an indication that this is a potentially transient state. It could
|
|
15
|
+
* be the expected outcome of a SyncGroups transaction, or dragging to stretch a Product.
|
|
16
|
+
* Uncommitted notifications can be used to update for instance spinners, but should not
|
|
17
|
+
* be sent to server or such.
|
|
18
|
+
*/
|
|
19
|
+
export declare type CfgProductChangeNotification = {
|
|
20
|
+
freshRef: CfgProduct;
|
|
21
|
+
committed: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare type CfgProductSettings = {
|
|
24
|
+
/**
|
|
25
|
+
* In a correctly setup catalogue a select-one Feature (i.e. neither optional nor multiple)
|
|
26
|
+
* must have exactly one Option set at a time. However, this is not enforced in Catalogue
|
|
27
|
+
* Creator and it is not uncommon with catalogues which fails to meet this requirement.
|
|
28
|
+
* Activating this will make setApi throw an Error if more or less than one is selected.
|
|
29
|
+
*/
|
|
30
|
+
strictSelectOneSelectionCount: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Controls if SyncGroups are applied Faster or Stricter.
|
|
33
|
+
*
|
|
34
|
+
* Fast - Tries to minimize the number of validates calls to the AI lowering the response times
|
|
35
|
+
* for selecting options. Might not always give the expected result for complex products.
|
|
36
|
+
*
|
|
37
|
+
* Strict - Apply the SyncGroups rules in a stricter fashion to be as close to CET as possible,
|
|
38
|
+
* which might result in longer response times and more validation calls to the API when
|
|
39
|
+
* selecting options.
|
|
40
|
+
*
|
|
41
|
+
* The SDK will default to Strict, but we recommend that you try out Fast since cases where the
|
|
42
|
+
* results differ should be rare in most real uses cases and the speedup can be quite large.
|
|
43
|
+
*/
|
|
44
|
+
syncGroupsApplyMode: SyncGroupsApplyMode | undefined;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* This enum is used internally in the SDK and is not expected by be used directly by integrators.
|
|
48
|
+
*/
|
|
49
|
+
export declare enum CfgProductBubbleMode {
|
|
50
|
+
/** Stop bubbling. */
|
|
51
|
+
Stop = "Stop",
|
|
52
|
+
/**
|
|
53
|
+
* Bubble to the parent CfgProduct up the tree.
|
|
54
|
+
* This makes the CfgProduct we we call from notify that it has changed, and the CfgProduct
|
|
55
|
+
* above switch out the reference to this.
|
|
56
|
+
*/
|
|
57
|
+
OneLevel = "OneLevel",
|
|
58
|
+
/** Bubble to the root CfgProduct. */
|
|
59
|
+
ToRoot = "ToRoot",
|
|
60
|
+
/** Bubble to the root CfgProduct and turn on all optional CfgProducts on the way up. */
|
|
61
|
+
ToRootAndBubbleSelected = "ToRootAndBubbleSelected"
|
|
62
|
+
}
|
|
63
|
+
export declare type CfgPrice = {
|
|
64
|
+
basePrice: number;
|
|
65
|
+
listPrice: number;
|
|
66
|
+
currency: string;
|
|
67
|
+
fractionDigits: number;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* This class is meant to only be used through CfgProduct. It should never be instantiated on its
|
|
71
|
+
* own. Normally the internal state of this class should never be directly modified. CfgProduct is
|
|
72
|
+
* the class that should be used and interacted with.
|
|
73
|
+
*/
|
|
74
|
+
export declare class _CfgProductInternal {
|
|
75
|
+
readonly _productLoaderRaw: ProductLoader;
|
|
76
|
+
readonly prodParams: DtoProductParamsWithCidAndLang;
|
|
77
|
+
readonly settings: CfgProductSettings;
|
|
78
|
+
readonly uuid: string;
|
|
79
|
+
private readonly _rawUnit;
|
|
80
|
+
private _rawProductData;
|
|
81
|
+
readonly loadingObservable: AggregatedLoadingObservable;
|
|
82
|
+
readonly parent: _CfgProductInternal | undefined;
|
|
83
|
+
private _additionalProductRef;
|
|
84
|
+
private readonly _syncGroupHandler;
|
|
85
|
+
static make: (productLoaderRaw: ProductLoader, productLoaderForGroupedLoad: ProductLoader | undefined, prodParams: DtoProductParamsWithCidAndLang, settings: CfgProductSettings, optional: boolean, loadingObservable: AggregatedLoadingObservable, parent: _CfgProductInternal | undefined, root: _CfgProductInternal | undefined, additionalProductRef: DtoAdditionalProductRef | undefined, initialProductConfiguration: DtoProductConf | DtoAdditionalProductConfiguration | undefined) => Promise<_CfgProductInternal>;
|
|
86
|
+
_initialClone: _CfgProductInternal | undefined;
|
|
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
|
+
private _notes;
|
|
95
|
+
readonly changeObservable: Observable<CfgProductChangeNotification>;
|
|
96
|
+
get selected(): boolean;
|
|
97
|
+
readonly isAdditionalProduct: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Please note that cloning an additional product will make the clone believe is is
|
|
100
|
+
* an additional product, even if it has no parent and root.
|
|
101
|
+
* Providing the parent and root of what you clone as arguments is unwise as it will
|
|
102
|
+
* make changes you do on the clone be propagated up to the original non-clone root product.
|
|
103
|
+
*/
|
|
104
|
+
clone(parent?: _CfgProductInternal, root?: _CfgProductInternal): Promise<_CfgProductInternal>;
|
|
105
|
+
/** Mark this and its descendants as destroyed and remove all listeners */
|
|
106
|
+
destroy: () => void;
|
|
107
|
+
/**
|
|
108
|
+
* Reset will reset the product to its initial state
|
|
109
|
+
*/
|
|
110
|
+
reset: () => Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Internal use. Used when this product is an additional product, and
|
|
113
|
+
* changing a parent product has made the settings for this product
|
|
114
|
+
* change.
|
|
115
|
+
*/
|
|
116
|
+
_updateAdditionalProdRef(p: DtoAdditionalProductRef): void;
|
|
117
|
+
/**
|
|
118
|
+
* Return a DtoNode using noteRef as a key.
|
|
119
|
+
* Throws an error if no note is found.
|
|
120
|
+
*/
|
|
121
|
+
getNote(noteRef: string): DtoNote;
|
|
122
|
+
/**
|
|
123
|
+
* noteRefs is a list of keys coming from CfgOption, CfgFeature or CfgProduct.
|
|
124
|
+
* The keys are used to get a DtoNote[] from notes at CfgProduct.
|
|
125
|
+
*/
|
|
126
|
+
getNotes(noteRefs: string[]): DtoNote[];
|
|
127
|
+
private addNotes;
|
|
128
|
+
get notes(): DtoNote[];
|
|
129
|
+
get miscFiles(): DtoMiscFile[];
|
|
130
|
+
get hasRootFeaturesChanged(): boolean;
|
|
131
|
+
get description(): string | undefined;
|
|
132
|
+
get rootNodeSources(): RootNodeSource[] | undefined;
|
|
133
|
+
get mtrlApplications(): DtoMtrlApplication[] | undefined;
|
|
134
|
+
get currency(): string;
|
|
135
|
+
get fractionDigits(): number;
|
|
136
|
+
get prices(): DtoPrices | undefined;
|
|
137
|
+
private _measureDefinitions;
|
|
138
|
+
get measureDefinitions(): CfgMeasureDefinition[];
|
|
139
|
+
private _unit;
|
|
140
|
+
get refKey(): string | undefined;
|
|
141
|
+
get transform(): DtoTransform | undefined;
|
|
142
|
+
get anchor(): DtoMeasureParam | undefined;
|
|
143
|
+
/** @throws an error if the actual unit sent by the server was not a LengthUnit */
|
|
144
|
+
get unit(): LengthUnit;
|
|
145
|
+
get aggregatedPrice(): CfgPrice;
|
|
146
|
+
get optional(): boolean;
|
|
147
|
+
setSelected(selected: boolean, bubbleMode: CfgProductBubbleMode, interactive: boolean): Promise<boolean>;
|
|
148
|
+
get configuration(): CfgProductConfiguration;
|
|
149
|
+
get rawProductData(): CfgProductData;
|
|
150
|
+
/**
|
|
151
|
+
* Please note that this relates to the visibility in the Configuration tree.
|
|
152
|
+
* It does not affect the visibility of anything in the 3D view at all.
|
|
153
|
+
*/
|
|
154
|
+
get visibleIfAdditionalProduct(): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Please note that this relates to the visibility in the Configuration tree.
|
|
157
|
+
* It does not affect the visibility of anything in the 3D view at all.
|
|
158
|
+
*/
|
|
159
|
+
get visibleIfMainProduct(): boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Please note that this relates to the visibility in the Configuration tree.
|
|
162
|
+
* It does not affect the visibility of anything in the 3D view at all.
|
|
163
|
+
*/
|
|
164
|
+
get visible(): boolean;
|
|
165
|
+
_notifyAllOfChange: (bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
|
|
166
|
+
/** Called when a child (additional product or the configuration) has changed. */
|
|
167
|
+
private _childHasChanged;
|
|
168
|
+
/** Called by child to tell its parent that it has changed. */
|
|
169
|
+
_additionalProductHasChanged: (freshRef: CfgProduct, bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
|
|
170
|
+
/** Called by the configuration to tell its parent that it has changed. */
|
|
171
|
+
_configurationHasChanged: (freshRef: CfgProductConfiguration, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
|
|
172
|
+
getDtoConf: (include: CfgProdConfParts) => DtoProductConf;
|
|
173
|
+
setDtoConf: (s: DtoProductConf, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
174
|
+
setApiSelection: (s: DtoAdditionalProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
175
|
+
copyFrom: (source: _CfgProductInternal, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
176
|
+
private _setApiSelectionWithOtherProduct;
|
|
177
|
+
get syncGroupHandler(): SyncGroupsHandler | undefined;
|
|
178
|
+
get syncGroupsVerboseLogging(): boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Set to true to get verbose sync state changes logged to the console.
|
|
181
|
+
*/
|
|
182
|
+
set syncGroupsVerboseLogging(v: boolean);
|
|
183
|
+
structureCompare: (other: _CfgProductInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
|
|
184
|
+
tryMatchSelection: (other: _CfgProductInternal, descriptionMatch?: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
185
|
+
/** Only features in selected options and selected additional products. */
|
|
186
|
+
_getDescendantFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
|
|
187
|
+
private _revalidateInProgressToken;
|
|
188
|
+
/**
|
|
189
|
+
* Do a validate call for this product. It does not validate additional products, only this
|
|
190
|
+
* product in isolation. The validation result is applied on the configuration. Then additional
|
|
191
|
+
* products are synced (unloaded, loaded etc.) Finally the changes bubble up the tree.
|
|
192
|
+
*/
|
|
193
|
+
_revalidate: (bubbleMode: CfgProductBubbleMode, productLoader: ProductLoader, committed: boolean) => Promise<boolean>;
|
|
194
|
+
/**
|
|
195
|
+
* Based on this configuration find what additional products should be shown and not, unload
|
|
196
|
+
* (i.e. destroy) those that should no longer be shown, load the new ones.
|
|
197
|
+
*/
|
|
198
|
+
_syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader, initialProductConfiguration: DtoAdditionalProductConfiguration | undefined) => Promise<boolean>;
|
|
199
|
+
}
|
|
200
|
+
export declare class CfgProduct {
|
|
201
|
+
readonly _internal: _CfgProductInternal;
|
|
202
|
+
static make(productLoader: ProductLoader, prodParams: DtoProductParamsWithCidAndLang, settings?: Partial<CfgProductSettings>, initialProductConfiguration?: DtoProductConf | DtoAdditionalProductConfiguration): Promise<CfgProduct>;
|
|
203
|
+
/**
|
|
204
|
+
* Makes an object wrapping the passed object. This is not a clone method, it is a method to
|
|
205
|
+
* make a new outer reference. Like a shallow copy. We use this to help frameworks that are
|
|
206
|
+
* build around using equals to detect change.
|
|
207
|
+
*/
|
|
208
|
+
static _makeNewRefFrom(source: _CfgProductInternal): CfgProduct;
|
|
209
|
+
private constructor();
|
|
210
|
+
isBackedBySame: (other: CfgProduct) => boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Recursively marks this and descendants as destroyed so that late events are ignored
|
|
213
|
+
* correctly. If you destroy one shallow copy of this you destroy all.
|
|
214
|
+
*/
|
|
215
|
+
destroy: () => void;
|
|
216
|
+
/** Makes a clone of this. It is disconnected from the original. */
|
|
217
|
+
clone: () => Promise<CfgProduct>;
|
|
218
|
+
/**
|
|
219
|
+
* A client side only key that should uniquely identify this product amongst other additional
|
|
220
|
+
* products.
|
|
221
|
+
*/
|
|
222
|
+
get key(): string;
|
|
223
|
+
/**
|
|
224
|
+
* Only used when this product is in additional product.
|
|
225
|
+
* As a product can have multiple instances of the same additional product this key exists.
|
|
226
|
+
* It will be unique amongst child products, but not globally unique.
|
|
227
|
+
*/
|
|
228
|
+
get refKey(): string | undefined;
|
|
229
|
+
get notes(): DtoNote[];
|
|
230
|
+
get miscFiles(): DtoMiscFile[];
|
|
231
|
+
get prodParams(): DtoProductParamsWithCidAndLang;
|
|
232
|
+
get lang(): string;
|
|
233
|
+
get catId(): DtoCatalogueParamsWithCid;
|
|
234
|
+
get partNumber(): string;
|
|
235
|
+
get isAdditionalProduct(): boolean;
|
|
236
|
+
/** Only used when this product is an additional product. Root products are never optional. */
|
|
237
|
+
get optional(): boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Only applicable when this product is optional. If this product is not optional this is
|
|
240
|
+
* always true.
|
|
241
|
+
*/
|
|
242
|
+
get selected(): boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Please note that this relates to the visibility in the Configuration tree.
|
|
245
|
+
* It does not affect the visibility of anything in the 3D view at all.
|
|
246
|
+
* Visibility affects the Configuration for this Product, but any Additional Products
|
|
247
|
+
* will not be affected.
|
|
248
|
+
*/
|
|
249
|
+
get visible(): boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Only applicable when this product is optional.
|
|
252
|
+
* Setting this does not cause a validation call as toggling an optional additional product is
|
|
253
|
+
* assumed to always be legal.
|
|
254
|
+
*/
|
|
255
|
+
setSelected: (v: boolean) => Promise<boolean>;
|
|
256
|
+
/**
|
|
257
|
+
* Functional selection is a Catalogues feature where selecting Options on Features result in that you
|
|
258
|
+
* "jump" to another Product as a result of the Validate call. You normally do not notice that a functional
|
|
259
|
+
* selection has occurred except for the styleNr changing. Functional selection can change which Features
|
|
260
|
+
* from the original product call are used as root Features. This can in turn affect if serialized
|
|
261
|
+
* configuration can be applied or not.
|
|
262
|
+
*
|
|
263
|
+
* The SDK can currently only apply serialized configuration if the list of root Features has not changed.
|
|
264
|
+
* For this reason, when functional selection has happened, extracting data for external systems might work
|
|
265
|
+
* well, but reapplying back into Stage will probably fail.
|
|
266
|
+
*/
|
|
267
|
+
get hasRootFeaturesChanged(): boolean;
|
|
268
|
+
get rawProductData(): CfgProductData;
|
|
269
|
+
get uuid(): string;
|
|
270
|
+
get unit(): LengthUnit;
|
|
271
|
+
get sku(): string;
|
|
272
|
+
get styleNr(): string;
|
|
273
|
+
/** An URL. */
|
|
274
|
+
get preview(): string | undefined;
|
|
275
|
+
get description(): string | undefined;
|
|
276
|
+
get additionalProducts(): CfgProduct[];
|
|
277
|
+
get configuration(): CfgProductConfiguration;
|
|
278
|
+
get transform(): DtoTransform | undefined;
|
|
279
|
+
get currency(): string;
|
|
280
|
+
/**
|
|
281
|
+
* If positive the number of fraction digits.
|
|
282
|
+
* If negative rounding (essentially the number of zeros to the right)
|
|
283
|
+
*/
|
|
284
|
+
get fractionDigits(): number;
|
|
285
|
+
get aggregatedPrice(): CfgPrice;
|
|
286
|
+
/**
|
|
287
|
+
* Experimental. Additional products lacks descriptions or keys that are suitably for structure
|
|
288
|
+
* compare, so we use strict-order when trying to match the additional products. This makes
|
|
289
|
+
* this method work nicely for different products having pretty much the same child products.
|
|
290
|
+
*/
|
|
291
|
+
structureCompare: (other: CfgProduct, strictOrder?: boolean, descriptionMatch?: boolean) => boolean;
|
|
292
|
+
/**
|
|
293
|
+
* Experimental. Additional products lacks descriptions or keys that are suitably for try
|
|
294
|
+
* match, so we use strict-order when trying to match the additional products. This makes
|
|
295
|
+
* this method work nicely for different products having pretty much the same child products.
|
|
296
|
+
* This method does not propagate its selections.
|
|
297
|
+
* This method will cause validation calls if something change.
|
|
298
|
+
*/
|
|
299
|
+
tryMatchSelection: (other: CfgProduct, descriptionMatch?: boolean) => Promise<boolean>;
|
|
300
|
+
/**
|
|
301
|
+
* Gets what selections has been made on the product, recursively including product
|
|
302
|
+
* configuration, optional products and additional products. Used when a full view of all
|
|
303
|
+
* selections on a product is needed, such as when doing Render or Export.
|
|
304
|
+
* @deprecated getDtoConf provides a newer format.
|
|
305
|
+
* @see getDtoConf
|
|
306
|
+
*/
|
|
307
|
+
getApiSelection: () => DtoAdditionalProductConfiguration;
|
|
308
|
+
/**
|
|
309
|
+
* Applies the configuration (selections) in the passed object onto the product recursively
|
|
310
|
+
* including product configuration, optional products and additional products.
|
|
311
|
+
* @param doValidate Makes a server side validation call. These are necessary to ensure that
|
|
312
|
+
* the right models are loaded.
|
|
313
|
+
* @deprecated setDtoConf uses a newer format.
|
|
314
|
+
*/
|
|
315
|
+
setApiSelection: (configuration: DtoAdditionalProductConfiguration, doValidate?: boolean) => Promise<boolean>;
|
|
316
|
+
/**
|
|
317
|
+
* A newer alternative version of getApiSelection. This returns the configuration (selections)
|
|
318
|
+
* on the product, recursively including product configuration, optional products and additional
|
|
319
|
+
* products.
|
|
320
|
+
* This version has the following advantages over getApiSelection:
|
|
321
|
+
* - The format is clearer, designed to be readable
|
|
322
|
+
* - Makes less assumptions about the structure in the Product being unchanging over time. In
|
|
323
|
+
* particular, the Feature codes are included in the data, so that changes to what Features
|
|
324
|
+
* are used in a Product is less likely to lead to unexpected results.
|
|
325
|
+
* - You can request ExtendedData, ProductParams and/or SyncGroupState to be included in the
|
|
326
|
+
* result. This extra data is ignored when passed back into the API, but it can be very useful
|
|
327
|
+
* for external applications.
|
|
328
|
+
* The other version (getApiSelection) has the advantage of using a format directly compatible with the API:s.
|
|
329
|
+
* @param include Includes extra data which is not an actual part of the configuration
|
|
330
|
+
*/
|
|
331
|
+
getDtoConf: (include?: CfgProdConfParts) => DtoProductConf;
|
|
332
|
+
/**
|
|
333
|
+
* A newer alternative version of setApiSelection.
|
|
334
|
+
* @param doValidate Makes a server side validation call. These are necessary to ensure that
|
|
335
|
+
* the right models are loaded.
|
|
336
|
+
*/
|
|
337
|
+
setDtoConf: (configuration: DtoProductConf, doValidate?: boolean) => Promise<boolean>;
|
|
338
|
+
listenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
|
|
339
|
+
stopListenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
|
|
340
|
+
stopAllListenForChange: () => void;
|
|
341
|
+
listenForLoading: (l: SingleArgCallback<boolean>) => void;
|
|
342
|
+
stopListenForLoading: (l: SingleArgCallback<boolean>) => void;
|
|
343
|
+
stopAllListenForLoading: () => void;
|
|
344
|
+
}
|
|
345
345
|
//# sourceMappingURL=CfgProduct.d.ts.map
|