@configura/web-api 2.0.0-alpha.20 → 2.0.0-alpha.22
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 +1 -14
- package/dist/CatalogueAPI.d.ts +41 -0
- package/dist/CatalogueAPI.js +1 -0
- package/dist/CfgProduct.d.ts +29 -15
- package/dist/CfgProduct.js +172 -55
- package/dist/ConfigurationConverter.d.ts +4 -0
- package/dist/ConfigurationConverter.js +9 -0
- package/dist/io/CfgHistoryManager.js +0 -6
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +6 -2
- package/dist/io/CfgHistoryToProdConfConnector.js +11 -8
- package/dist/io/CfgIOProdConfConnector.d.ts +17 -9
- package/dist/io/CfgIOProdConfConnector.js +48 -57
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +2 -2
- package/dist/io/CfgObservableStateToProdConfConnector.js +3 -3
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +2 -2
- package/dist/io/CfgWindowMessageToProdConfConnector.js +3 -3
- package/dist/productConfiguration/CfgFeature.d.ts +5 -1
- package/dist/productConfiguration/CfgFeature.js +13 -0
- package/dist/productConfiguration/CfgOption.d.ts +6 -1
- package/dist/productConfiguration/CfgOption.js +17 -0
- package/dist/productLoader.js +1 -1
- package/dist/syncGroups/SyncGroupsHandler.d.ts +5 -1
- package/dist/syncGroups/SyncGroupsHandler.js +9 -2
- package/dist/syncGroups/SyncGroupsState.d.ts +5 -1
- package/dist/syncGroups/SyncGroupsState.js +44 -2
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +14 -10
- package/dist/tests/testData/testDataCachedGetProduct.js +2 -1
- package/dist/tests/testData/testDataCachedPostValidate.js +1 -0
- package/dist/tests/testData/testDataProductAggregatedPrice.js +2 -1
- package/dist/tests/testData/testDataUpcharge.js +1 -0
- package/dist/utilitiesNumericValues.js +13 -8
- package/package.json +3 -3
package/.eslintrc.json
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"parser": "@typescript-eslint/parser",
|
|
3
3
|
"plugins": ["@typescript-eslint"],
|
|
4
|
-
"extends": [
|
|
5
|
-
"eslint:recommended",
|
|
6
|
-
"plugin:@typescript-eslint/recommended",
|
|
7
|
-
"prettier"
|
|
8
|
-
|
|
9
|
-
// TODO: Type-checking rules require a proper tsconfig-file to work,
|
|
10
|
-
// pointed at by the parserOption.project setting.
|
|
11
|
-
//
|
|
12
|
-
//"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
|
13
|
-
]
|
|
14
|
-
//"rules": { "@typescript-eslint/no-floating-promises": "error" }
|
|
15
|
-
//"parserOptions": {
|
|
16
|
-
// "project": "./tsconfig.json"
|
|
17
|
-
//}
|
|
4
|
+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"]
|
|
18
5
|
}
|
package/dist/CatalogueAPI.d.ts
CHANGED
|
@@ -119,6 +119,7 @@ export interface DtoFeature {
|
|
|
119
119
|
mtrlApplications?: Array<DtoMtrlApplication>;
|
|
120
120
|
multiple?: boolean;
|
|
121
121
|
numericOrder: boolean;
|
|
122
|
+
omitOnOrder?: boolean;
|
|
122
123
|
optional?: boolean;
|
|
123
124
|
options: Array<DtoOption>;
|
|
124
125
|
hideIfMainProduct?: boolean;
|
|
@@ -126,6 +127,7 @@ export interface DtoFeature {
|
|
|
126
127
|
measureParams?: Array<DtoMeasureParam>;
|
|
127
128
|
syncGroup?: DtoSyncGroup;
|
|
128
129
|
unit?: string;
|
|
130
|
+
noteRefs?: Array<string>;
|
|
129
131
|
}
|
|
130
132
|
/** FeatureConf */
|
|
131
133
|
export interface DtoFeatureConf {
|
|
@@ -232,6 +234,12 @@ export interface DtoMeasureParam {
|
|
|
232
234
|
export interface DtoMeasurePriority {
|
|
233
235
|
url: string;
|
|
234
236
|
}
|
|
237
|
+
/** MiscFile */
|
|
238
|
+
export interface DtoMiscFile {
|
|
239
|
+
key: string;
|
|
240
|
+
url: string;
|
|
241
|
+
preview?: string;
|
|
242
|
+
}
|
|
235
243
|
/** Model */
|
|
236
244
|
export interface DtoModel {
|
|
237
245
|
cid: number;
|
|
@@ -246,6 +254,17 @@ export interface DtoMtrlApplication {
|
|
|
246
254
|
preview?: string;
|
|
247
255
|
cid?: number;
|
|
248
256
|
}
|
|
257
|
+
/** Note */
|
|
258
|
+
export interface DtoNote {
|
|
259
|
+
code: string;
|
|
260
|
+
severity?: DtoNoteSeverity;
|
|
261
|
+
key?: string;
|
|
262
|
+
title?: string;
|
|
263
|
+
body: string;
|
|
264
|
+
}
|
|
265
|
+
/** NoteSeverity - WIP */
|
|
266
|
+
export declare type DtoNoteSeverity = "Information" | "Critical" | "Warning";
|
|
267
|
+
export declare const dtoNoteSeverityNames: DtoNoteSeverity[];
|
|
249
268
|
/** Option */
|
|
250
269
|
export interface DtoOption {
|
|
251
270
|
additionalProductRefs?: Array<DtoAdditionalProductRef>;
|
|
@@ -257,6 +276,8 @@ export interface DtoOption {
|
|
|
257
276
|
codeRanges?: Array<DtoCodeRange>;
|
|
258
277
|
upcharge?: number;
|
|
259
278
|
priceCodes?: Array<string>;
|
|
279
|
+
noteRefs?: Array<string>;
|
|
280
|
+
miscFiles?: Array<DtoMiscFile>;
|
|
260
281
|
}
|
|
261
282
|
/** OptionConf */
|
|
262
283
|
export interface DtoOptionConf {
|
|
@@ -378,6 +399,7 @@ export interface DtoProductConf {
|
|
|
378
399
|
features?: Array<DtoFeatureConf>;
|
|
379
400
|
additionalProducts?: Array<DtoAdditionalProductConf>;
|
|
380
401
|
prodParams?: DtoProductParamsWithCidAndLang;
|
|
402
|
+
syncGroupState?: DtoSyncGroupState;
|
|
381
403
|
}
|
|
382
404
|
/** ProductData */
|
|
383
405
|
export interface DtoProductData {
|
|
@@ -402,6 +424,8 @@ export interface DtoProductData {
|
|
|
402
424
|
width?: string;
|
|
403
425
|
models?: Array<DtoModel>;
|
|
404
426
|
partsData: DtoPartsData;
|
|
427
|
+
noteRefs?: Array<string>;
|
|
428
|
+
miscFiles?: Array<DtoMiscFile>;
|
|
405
429
|
}
|
|
406
430
|
/** ProductParamsWithCid */
|
|
407
431
|
export interface DtoProductParamsWithCid extends DtoCatalogueParamsWithCid {
|
|
@@ -429,6 +453,7 @@ export interface DtoProductResponse {
|
|
|
429
453
|
productData: DtoProductData;
|
|
430
454
|
unit: string;
|
|
431
455
|
uuid: string;
|
|
456
|
+
notes?: Array<DtoNote>;
|
|
432
457
|
}
|
|
433
458
|
/** RefreshSessionTokenResponse */
|
|
434
459
|
export interface DtoRefreshSessionTokenResponse {
|
|
@@ -482,6 +507,20 @@ export interface DtoSyncGroup {
|
|
|
482
507
|
/** SyncGroupMethods */
|
|
483
508
|
export declare type DtoSyncGroupMethods = "pull" | "push" | "twoWay";
|
|
484
509
|
export declare const dtoSyncGroupMethodsNames: DtoSyncGroupMethods[];
|
|
510
|
+
/** SyncGroupState */
|
|
511
|
+
export interface DtoSyncGroupState {
|
|
512
|
+
selectOne?: Array<DtoSyncToOptionCode>;
|
|
513
|
+
selectMany?: Array<DtoSyncToOptionCodeToSelected>;
|
|
514
|
+
}
|
|
515
|
+
/** SyncToOptionCode */
|
|
516
|
+
export interface DtoSyncToOptionCode {
|
|
517
|
+
syncCode: string;
|
|
518
|
+
optionCode: string;
|
|
519
|
+
}
|
|
520
|
+
/** SyncToOptionCodeToSelected */
|
|
521
|
+
export interface DtoSyncToOptionCodeToSelected extends DtoSyncToOptionCode {
|
|
522
|
+
selected: boolean;
|
|
523
|
+
}
|
|
485
524
|
/** TargetCameraArgs */
|
|
486
525
|
export interface DtoTargetCameraArgs {
|
|
487
526
|
location?: DtoPoint;
|
|
@@ -519,6 +558,8 @@ export interface DtoValidateRequestLegacyV1 {
|
|
|
519
558
|
/** ValidateResponse */
|
|
520
559
|
export interface DtoValidateResponse extends DtoValidateResponseLegacyV1 {
|
|
521
560
|
features: Array<DtoFeature>;
|
|
561
|
+
unit: string;
|
|
562
|
+
notes?: Array<DtoNote>;
|
|
522
563
|
}
|
|
523
564
|
/** ValidateResponseLegacyV1 */
|
|
524
565
|
export interface DtoValidateResponseLegacyV1 {
|
package/dist/CatalogueAPI.js
CHANGED
|
@@ -24,6 +24,7 @@ export const dtoExportStatusStatusNames = [
|
|
|
24
24
|
"finished",
|
|
25
25
|
"failed",
|
|
26
26
|
];
|
|
27
|
+
export const dtoNoteSeverityNames = ["Information", "Critical", "Warning"];
|
|
27
28
|
export const dtoRenderFormatNames = ["jpg", "png"];
|
|
28
29
|
export const dtoRenderStatusStatusNames = [
|
|
29
30
|
"pending",
|
package/dist/CfgProduct.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AggregatedLoadingObservable, LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import { DtoAdditionalProductConfiguration, DtoAdditionalProductRef, DtoCatalogueParamsWithCid, DtoMeasureParam, DtoMtrlApplication, DtoPrices, DtoProductConf, DtoProductParamsWithCidAndLang, DtoTransform } from "./CatalogueAPI.js";
|
|
2
|
+
import { DtoAdditionalProductConfiguration, DtoAdditionalProductRef, DtoCatalogueParamsWithCid, DtoMeasureParam, DtoMiscFile, DtoMtrlApplication, DtoNote, DtoPrices, DtoProductConf, DtoProductParamsWithCidAndLang, DtoTransform } from "./CatalogueAPI.js";
|
|
3
3
|
import { CfgMeasureDefinition } from "./CfgMeasure.js";
|
|
4
|
+
import { CfgProdConfParts } from "./index.js";
|
|
4
5
|
import { _CfgFeatureInternal } from "./productConfiguration/CfgFeature.js";
|
|
5
6
|
import { ProductConfigurationBubbleMode } from "./productConfiguration/CfgOption.js";
|
|
6
7
|
import { CfgProductConfiguration } from "./productConfiguration/CfgProductConfiguration.js";
|
|
@@ -81,7 +82,7 @@ export declare class _CfgProductInternal {
|
|
|
81
82
|
readonly parent: _CfgProductInternal | undefined;
|
|
82
83
|
private _additionalProductRef;
|
|
83
84
|
private readonly _syncGroupHandler;
|
|
84
|
-
static make: (productLoaderRaw: ProductLoader, productLoaderForGroupedLoad: ProductLoader | undefined, prodParams: DtoProductParamsWithCidAndLang, settings: CfgProductSettings, optional: boolean, loadingObservable: AggregatedLoadingObservable, parent: _CfgProductInternal | undefined, root: _CfgProductInternal | undefined, additionalProductRef: DtoAdditionalProductRef | undefined) => Promise<_CfgProductInternal>;
|
|
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>;
|
|
85
86
|
_initialClone: _CfgProductInternal | undefined;
|
|
86
87
|
private constructor();
|
|
87
88
|
readonly root: _CfgProductInternal;
|
|
@@ -90,6 +91,7 @@ export declare class _CfgProductInternal {
|
|
|
90
91
|
readonly additionalProducts: CfgProduct[];
|
|
91
92
|
private _selected;
|
|
92
93
|
private _configuration;
|
|
94
|
+
private _notes;
|
|
93
95
|
readonly changeObservable: Observable<CfgProductChangeNotification>;
|
|
94
96
|
get selected(): boolean;
|
|
95
97
|
readonly isAdditionalProduct: boolean;
|
|
@@ -112,6 +114,19 @@ export declare class _CfgProductInternal {
|
|
|
112
114
|
* change.
|
|
113
115
|
*/
|
|
114
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[];
|
|
115
130
|
get hasRootFeaturesChanged(): boolean;
|
|
116
131
|
get description(): string | undefined;
|
|
117
132
|
get rootNodeSources(): RootNodeSource[] | undefined;
|
|
@@ -129,7 +144,7 @@ export declare class _CfgProductInternal {
|
|
|
129
144
|
get unit(): LengthUnit;
|
|
130
145
|
get aggregatedPrice(): CfgPrice;
|
|
131
146
|
get optional(): boolean;
|
|
132
|
-
setSelected(
|
|
147
|
+
setSelected(selected: boolean, bubbleMode: CfgProductBubbleMode, interactive: boolean): Promise<boolean>;
|
|
133
148
|
get configuration(): CfgProductConfiguration;
|
|
134
149
|
get rawProductData(): CfgProductData;
|
|
135
150
|
/**
|
|
@@ -154,7 +169,7 @@ export declare class _CfgProductInternal {
|
|
|
154
169
|
_additionalProductHasChanged: (freshRef: CfgProduct, bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
|
|
155
170
|
/** Called by the configuration to tell its parent that it has changed. */
|
|
156
171
|
_configurationHasChanged: (freshRef: CfgProductConfiguration, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
|
|
157
|
-
getDtoConf: (
|
|
172
|
+
getDtoConf: (include: CfgProdConfParts) => DtoProductConf;
|
|
158
173
|
setDtoConf: (s: DtoProductConf, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
159
174
|
setApiSelection: (s: DtoAdditionalProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
160
175
|
copyFrom: (source: _CfgProductInternal, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
@@ -180,11 +195,11 @@ export declare class _CfgProductInternal {
|
|
|
180
195
|
* Based on this configuration find what additional products should be shown and not, unload
|
|
181
196
|
* (i.e. destroy) those that should no longer be shown, load the new ones.
|
|
182
197
|
*/
|
|
183
|
-
_syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader) => Promise<boolean>;
|
|
198
|
+
_syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader, initialProductConfiguration: DtoAdditionalProductConfiguration | undefined) => Promise<boolean>;
|
|
184
199
|
}
|
|
185
200
|
export declare class CfgProduct {
|
|
186
201
|
readonly _internal: _CfgProductInternal;
|
|
187
|
-
static make(productLoader: ProductLoader, prodParams: DtoProductParamsWithCidAndLang, settings?: Partial<CfgProductSettings
|
|
202
|
+
static make(productLoader: ProductLoader, prodParams: DtoProductParamsWithCidAndLang, settings?: Partial<CfgProductSettings>, initialProductConfiguration?: DtoProductConf | DtoAdditionalProductConfiguration): Promise<CfgProduct>;
|
|
188
203
|
/**
|
|
189
204
|
* Makes an object wrapping the passed object. This is not a clone method, it is a method to
|
|
190
205
|
* make a new outer reference. Like a shallow copy. We use this to help frameworks that are
|
|
@@ -211,6 +226,8 @@ export declare class CfgProduct {
|
|
|
211
226
|
* It will be unique amongst child products, but not globally unique.
|
|
212
227
|
*/
|
|
213
228
|
get refKey(): string | undefined;
|
|
229
|
+
get notes(): DtoNote[];
|
|
230
|
+
get miscFiles(): DtoMiscFile[];
|
|
214
231
|
get prodParams(): DtoProductParamsWithCidAndLang;
|
|
215
232
|
get lang(): string;
|
|
216
233
|
get catId(): DtoCatalogueParamsWithCid;
|
|
@@ -226,7 +243,7 @@ export declare class CfgProduct {
|
|
|
226
243
|
/**
|
|
227
244
|
* Please note that this relates to the visibility in the Configuration tree.
|
|
228
245
|
* It does not affect the visibility of anything in the 3D view at all.
|
|
229
|
-
* Visibility
|
|
246
|
+
* Visibility affects the Configuration for this Product, but any Additional Products
|
|
230
247
|
* will not be affected.
|
|
231
248
|
*/
|
|
232
249
|
get visible(): boolean;
|
|
@@ -305,16 +322,13 @@ export declare class CfgProduct {
|
|
|
305
322
|
* - Makes less assumptions about the structure in the Product being unchanging over time. In
|
|
306
323
|
* particular, the Feature codes are included in the data, so that changes to what Features
|
|
307
324
|
* are used in a Product is less likely to lead to unexpected results.
|
|
308
|
-
* - You can request ExtendedData and/or
|
|
309
|
-
* data is ignored when passed back into the API, but it can be very useful
|
|
310
|
-
* applications.
|
|
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.
|
|
311
328
|
* The other version (getApiSelection) has the advantage of using a format directly compatible with the API:s.
|
|
312
|
-
* @param
|
|
313
|
-
* i.e. units and groupCodes
|
|
314
|
-
* @param includeProductParams Includes what Product this was generated for, and the same for any
|
|
315
|
-
* Additional Products.
|
|
329
|
+
* @param include Includes extra data which is not an actual part of the configuration
|
|
316
330
|
*/
|
|
317
|
-
getDtoConf: (
|
|
331
|
+
getDtoConf: (include?: CfgProdConfParts) => DtoProductConf;
|
|
318
332
|
/**
|
|
319
333
|
* A newer alternative version of setApiSelection.
|
|
320
334
|
* @param doValidate Makes a server side validation call. These are necessary to ensure that
|