@configura/web-api 2.0.0-alpha.9 → 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 +1 -14
- package/dist/CatalogueAPI.d.ts +103 -32
- package/dist/CatalogueAPI.js +62 -6
- package/dist/CfgProduct.d.ts +90 -14
- package/dist/CfgProduct.js +266 -56
- package/dist/CfgReferencePathHelper.d.ts +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/io/CfgHistoryManager.d.ts +33 -1
- package/dist/io/CfgHistoryManager.js +68 -6
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +11 -10
- package/dist/io/CfgHistoryToProdConfConnector.js +32 -38
- package/dist/io/CfgIOManager.d.ts +5 -0
- package/dist/io/CfgIOManager.js +20 -1
- package/dist/io/CfgIOProdConfConnector.d.ts +17 -18
- package/dist/io/CfgIOProdConfConnector.js +52 -58
- package/dist/io/CfgIOWarningSupplier.d.ts +4 -0
- package/dist/io/CfgIOWarningSupplier.js +1 -0
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +4 -4
- package/dist/io/CfgObservableStateToProdConfConnector.js +3 -3
- package/dist/io/CfgWindowMessageManager.js +4 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +4 -4
- package/dist/io/CfgWindowMessageToProdConfConnector.js +3 -3
- package/dist/productConfiguration/CfgFeature.d.ts +12 -7
- package/dist/productConfiguration/CfgFeature.js +33 -14
- package/dist/productConfiguration/CfgOption.d.ts +16 -10
- package/dist/productConfiguration/CfgOption.js +46 -18
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +27 -16
- package/dist/productConfiguration/CfgProductConfiguration.js +53 -29
- package/dist/productConfiguration/filters.d.ts +6 -4
- package/dist/productConfiguration/filters.js +94 -23
- package/dist/productConfiguration/productParamsGenerator.d.ts +3 -3
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +1 -1
- package/dist/productConfiguration/utilitiesProductConfiguration.js +11 -4
- package/dist/productLoader.d.ts +3 -3
- package/dist/productLoader.js +1 -1
- package/dist/syncGroups/SyncGroupsHandler.d.ts +9 -2
- package/dist/syncGroups/SyncGroupsHandler.js +15 -4
- package/dist/syncGroups/SyncGroupsState.d.ts +5 -1
- package/dist/syncGroups/SyncGroupsState.js +44 -2
- package/dist/syncGroups/SyncGroupsTransaction.js +34 -21
- package/dist/tasks/TaskHandler.d.ts +2 -2
- package/dist/tasks/TaskHandler.js +2 -1
- package/dist/tests/testData/dummyProductForTest.d.ts +2 -2
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +14 -9
- package/dist/tests/testData/testDataCachedGetProduct.js +2 -0
- package/dist/tests/testData/testDataCachedPostValidate.js +2 -0
- package/dist/tests/testData/testDataProductAggregatedPrice.js +3 -1
- package/dist/tests/testData/testDataUpcharge.js +2 -0
- package/dist/utilitiesCatalogueData.d.ts +14 -9
- package/dist/utilitiesCatalogueData.js +7 -0
- package/dist/utilitiesCataloguePermission.d.ts +4 -4
- package/dist/utilitiesConfiguration.d.ts +29 -0
- package/dist/utilitiesConfiguration.js +200 -0
- package/dist/utilitiesNumericValues.js +13 -8
- package/package.json +3 -3
- package/dist/ConfigurationConverter.d.ts +0 -5
- package/dist/ConfigurationConverter.js +0 -72
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
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/** AdditionalProductConf */
|
|
2
|
+
export interface DtoAdditionalProductConf extends DtoProductConf {
|
|
3
|
+
refKey: string;
|
|
4
|
+
selected: boolean;
|
|
5
|
+
}
|
|
1
6
|
/** AdditionalProductConfiguration */
|
|
2
7
|
export interface DtoAdditionalProductConfiguration {
|
|
3
8
|
refKey?: string;
|
|
@@ -5,11 +10,6 @@ export interface DtoAdditionalProductConfiguration {
|
|
|
5
10
|
selOptions: Array<DtoSelectedOption>;
|
|
6
11
|
additionalProducts?: Array<DtoAdditionalProductConfiguration>;
|
|
7
12
|
}
|
|
8
|
-
/** AdditionalProductConfigurationV2 */
|
|
9
|
-
export interface DtoAdditionalProductConfigurationV2 extends DtoProductConfiguration {
|
|
10
|
-
refKey: string;
|
|
11
|
-
selected: boolean;
|
|
12
|
-
}
|
|
13
13
|
/** AdditionalProductRef */
|
|
14
14
|
export interface DtoAdditionalProductRef {
|
|
15
15
|
refKey: string;
|
|
@@ -44,22 +44,22 @@ export interface DtoCatalogueAPISession {
|
|
|
44
44
|
features?: Array<string>;
|
|
45
45
|
permissions?: Array<DtoCataloguePermission>;
|
|
46
46
|
}
|
|
47
|
-
/** CatalogueParams */
|
|
48
|
-
export interface DtoCatalogueParams
|
|
49
|
-
cid: number;
|
|
50
|
-
}
|
|
51
|
-
/** CatalogueParamsWithLang */
|
|
52
|
-
export interface DtoCatalogueParamsWithLang extends DtoCatalogueParams {
|
|
53
|
-
lang: string;
|
|
54
|
-
}
|
|
55
|
-
/** CatalogueParamsWithoutCid */
|
|
56
|
-
export interface DtoCatalogueParamsWithoutCid {
|
|
47
|
+
/** CatalogueParams - To identify one catalogue the Portfolio ID CID is needed in addition to the parameters in this object. However as of now CID is not used in API calls and therefore this version without CID is needed. */
|
|
48
|
+
export interface DtoCatalogueParams {
|
|
57
49
|
enterprise: string;
|
|
58
50
|
prdCat: string;
|
|
59
51
|
prdCatVersion: string;
|
|
60
52
|
vendor: string;
|
|
61
53
|
priceList: string;
|
|
62
54
|
}
|
|
55
|
+
/** CatalogueParamsWithCid */
|
|
56
|
+
export interface DtoCatalogueParamsWithCid extends DtoCatalogueParams {
|
|
57
|
+
cid: number;
|
|
58
|
+
}
|
|
59
|
+
/** CatalogueParamsWithCidAndLang */
|
|
60
|
+
export interface DtoCatalogueParamsWithCidAndLang extends DtoCatalogueParamsWithCid {
|
|
61
|
+
lang: string;
|
|
62
|
+
}
|
|
63
63
|
/** CataloguePermission */
|
|
64
64
|
export interface DtoCataloguePermission {
|
|
65
65
|
cid: number;
|
|
@@ -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,13 +127,14 @@ export interface DtoFeature {
|
|
|
126
127
|
measureParams?: Array<DtoMeasureParam>;
|
|
127
128
|
syncGroup?: DtoSyncGroup;
|
|
128
129
|
unit?: string;
|
|
130
|
+
noteRefs?: Array<string>;
|
|
129
131
|
}
|
|
130
|
-
/**
|
|
131
|
-
export interface
|
|
132
|
+
/** FeatureConf */
|
|
133
|
+
export interface DtoFeatureConf {
|
|
132
134
|
code: string;
|
|
133
135
|
groupCode?: string;
|
|
134
136
|
unit?: string;
|
|
135
|
-
options?: Array<
|
|
137
|
+
options?: Array<DtoOptionConf>;
|
|
136
138
|
}
|
|
137
139
|
/** FeatureRef */
|
|
138
140
|
export interface DtoFeatureRef {
|
|
@@ -163,6 +165,16 @@ export interface DtoGetPriceListsParams {
|
|
|
163
165
|
vendor: string;
|
|
164
166
|
priceList: string;
|
|
165
167
|
}
|
|
168
|
+
/** GetProductLegacyV2Params represents the URL parameters of getProductLegacyV2 */
|
|
169
|
+
export interface DtoGetProductLegacyV2Params {
|
|
170
|
+
lang: string;
|
|
171
|
+
enterprise: string;
|
|
172
|
+
prdCat: string;
|
|
173
|
+
prdCatVersion: string;
|
|
174
|
+
vendor: string;
|
|
175
|
+
priceList: string;
|
|
176
|
+
partNumber: string;
|
|
177
|
+
}
|
|
166
178
|
/** GetProductParams represents the URL parameters of getProduct */
|
|
167
179
|
export interface DtoGetProductParams {
|
|
168
180
|
lang: string;
|
|
@@ -222,6 +234,12 @@ export interface DtoMeasureParam {
|
|
|
222
234
|
export interface DtoMeasurePriority {
|
|
223
235
|
url: string;
|
|
224
236
|
}
|
|
237
|
+
/** MiscFile */
|
|
238
|
+
export interface DtoMiscFile {
|
|
239
|
+
key: string;
|
|
240
|
+
url: string;
|
|
241
|
+
preview?: string;
|
|
242
|
+
}
|
|
225
243
|
/** Model */
|
|
226
244
|
export interface DtoModel {
|
|
227
245
|
cid: number;
|
|
@@ -236,6 +254,17 @@ export interface DtoMtrlApplication {
|
|
|
236
254
|
preview?: string;
|
|
237
255
|
cid?: number;
|
|
238
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[];
|
|
239
268
|
/** Option */
|
|
240
269
|
export interface DtoOption {
|
|
241
270
|
additionalProductRefs?: Array<DtoAdditionalProductRef>;
|
|
@@ -247,13 +276,15 @@ export interface DtoOption {
|
|
|
247
276
|
codeRanges?: Array<DtoCodeRange>;
|
|
248
277
|
upcharge?: number;
|
|
249
278
|
priceCodes?: Array<string>;
|
|
279
|
+
noteRefs?: Array<string>;
|
|
280
|
+
miscFiles?: Array<DtoMiscFile>;
|
|
250
281
|
}
|
|
251
|
-
/**
|
|
252
|
-
export interface
|
|
282
|
+
/** OptionConf */
|
|
283
|
+
export interface DtoOptionConf {
|
|
253
284
|
code: string;
|
|
254
285
|
selected: boolean;
|
|
255
286
|
numericValue?: DtoValueWithUnit;
|
|
256
|
-
features?: Array<
|
|
287
|
+
features?: Array<DtoFeatureConf>;
|
|
257
288
|
}
|
|
258
289
|
/** Orientation */
|
|
259
290
|
export interface DtoOrientation {
|
|
@@ -314,6 +345,16 @@ export interface DtoPostRenderParams {
|
|
|
314
345
|
priceList: string;
|
|
315
346
|
partNumber: string;
|
|
316
347
|
}
|
|
348
|
+
/** PostValidateLegacyV1Params represents the URL parameters of postValidateLegacyV1 */
|
|
349
|
+
export interface DtoPostValidateLegacyV1Params {
|
|
350
|
+
lang: string;
|
|
351
|
+
enterprise: string;
|
|
352
|
+
prdCat: string;
|
|
353
|
+
prdCatVersion: string;
|
|
354
|
+
vendor: string;
|
|
355
|
+
priceList: string;
|
|
356
|
+
partNumber: string;
|
|
357
|
+
}
|
|
317
358
|
/** PostValidateParams represents the URL parameters of postValidate */
|
|
318
359
|
export interface DtoPostValidateParams {
|
|
319
360
|
lang: string;
|
|
@@ -353,11 +394,12 @@ export interface DtoProductCatalogueInfo {
|
|
|
353
394
|
exchangeRate: number;
|
|
354
395
|
lastModified: string;
|
|
355
396
|
}
|
|
356
|
-
/**
|
|
357
|
-
export interface
|
|
358
|
-
features?: Array<
|
|
359
|
-
additionalProducts?: Array<
|
|
360
|
-
prodParams?:
|
|
397
|
+
/** ProductConf - This is intended to eventually supersede AdditionalProductConfiguration as the format for sending/receiving how a Product is configured. */
|
|
398
|
+
export interface DtoProductConf {
|
|
399
|
+
features?: Array<DtoFeatureConf>;
|
|
400
|
+
additionalProducts?: Array<DtoAdditionalProductConf>;
|
|
401
|
+
prodParams?: DtoProductParamsWithCidAndLang;
|
|
402
|
+
syncGroupState?: DtoSyncGroupState;
|
|
361
403
|
}
|
|
362
404
|
/** ProductData */
|
|
363
405
|
export interface DtoProductData {
|
|
@@ -382,13 +424,15 @@ export interface DtoProductData {
|
|
|
382
424
|
width?: string;
|
|
383
425
|
models?: Array<DtoModel>;
|
|
384
426
|
partsData: DtoPartsData;
|
|
427
|
+
noteRefs?: Array<string>;
|
|
428
|
+
miscFiles?: Array<DtoMiscFile>;
|
|
385
429
|
}
|
|
386
|
-
/**
|
|
387
|
-
export interface
|
|
430
|
+
/** ProductParamsWithCid */
|
|
431
|
+
export interface DtoProductParamsWithCid extends DtoCatalogueParamsWithCid {
|
|
388
432
|
partNumber: string;
|
|
389
433
|
}
|
|
390
|
-
/**
|
|
391
|
-
export interface
|
|
434
|
+
/** ProductParamsWithCidAndLang */
|
|
435
|
+
export interface DtoProductParamsWithCidAndLang extends DtoProductParamsWithCid {
|
|
392
436
|
lang: string;
|
|
393
437
|
}
|
|
394
438
|
/** ProductRef */
|
|
@@ -409,6 +453,7 @@ export interface DtoProductResponse {
|
|
|
409
453
|
productData: DtoProductData;
|
|
410
454
|
unit: string;
|
|
411
455
|
uuid: string;
|
|
456
|
+
notes?: Array<DtoNote>;
|
|
412
457
|
}
|
|
413
458
|
/** RefreshSessionTokenResponse */
|
|
414
459
|
export interface DtoRefreshSessionTokenResponse {
|
|
@@ -462,6 +507,20 @@ export interface DtoSyncGroup {
|
|
|
462
507
|
/** SyncGroupMethods */
|
|
463
508
|
export declare type DtoSyncGroupMethods = "pull" | "push" | "twoWay";
|
|
464
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
|
+
}
|
|
465
524
|
/** TargetCameraArgs */
|
|
466
525
|
export interface DtoTargetCameraArgs {
|
|
467
526
|
location?: DtoPoint;
|
|
@@ -489,11 +548,21 @@ export interface DtoTransform {
|
|
|
489
548
|
rot: DtoOrientation;
|
|
490
549
|
}
|
|
491
550
|
/** ValidateRequest */
|
|
492
|
-
export interface DtoValidateRequest {
|
|
551
|
+
export interface DtoValidateRequest extends DtoValidateRequestLegacyV1 {
|
|
552
|
+
knownFeatureCodes: Array<string>;
|
|
553
|
+
}
|
|
554
|
+
/** ValidateRequestLegacyV1 */
|
|
555
|
+
export interface DtoValidateRequestLegacyV1 {
|
|
493
556
|
selOptions: Array<DtoSelectedOption>;
|
|
494
557
|
}
|
|
495
558
|
/** ValidateResponse */
|
|
496
|
-
export interface DtoValidateResponse {
|
|
559
|
+
export interface DtoValidateResponse extends DtoValidateResponseLegacyV1 {
|
|
560
|
+
features: Array<DtoFeature>;
|
|
561
|
+
unit: string;
|
|
562
|
+
notes?: Array<DtoNote>;
|
|
563
|
+
}
|
|
564
|
+
/** ValidateResponseLegacyV1 */
|
|
565
|
+
export interface DtoValidateResponseLegacyV1 {
|
|
497
566
|
productData: DtoProductData;
|
|
498
567
|
uuid: string;
|
|
499
568
|
validated: boolean;
|
|
@@ -536,8 +605,10 @@ export declare class CatalogueAPI {
|
|
|
536
605
|
getApplicationAreas(params: DtoGetApplicationAreasParams): Promise<DtoApplicationAreasResponse>;
|
|
537
606
|
postExport(params: DtoPostExportParams, body: DtoExportRequest): Promise<DtoExportResponse>;
|
|
538
607
|
getPriceLists(params: DtoGetPriceListsParams): Promise<DtoPriceListsResponse>;
|
|
608
|
+
getProductLegacyV2(params: DtoGetProductLegacyV2Params): Promise<DtoProductResponse>;
|
|
539
609
|
getProduct(params: DtoGetProductParams): Promise<DtoProductResponse>;
|
|
540
610
|
postRender(params: DtoPostRenderParams, body: DtoRenderRequest): Promise<DtoRenderResponse>;
|
|
611
|
+
postValidateLegacyV1(params: DtoPostValidateLegacyV1Params, body: DtoValidateRequestLegacyV1): Promise<DtoValidateResponseLegacyV1>;
|
|
541
612
|
postValidate(params: DtoPostValidateParams, body: DtoValidateRequest): Promise<DtoValidateResponse>;
|
|
542
613
|
getTocTree(params: DtoGetTocTreeParams): Promise<DtoTOCResponse>;
|
|
543
614
|
getTocFlat(params: DtoGetTocFlatParams): Promise<DtoTOCResponse>;
|
package/dist/CatalogueAPI.js
CHANGED
|
@@ -9,10 +9,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
10
|
});
|
|
11
11
|
};
|
|
12
|
-
export const dtoExportFormatNames = [
|
|
13
|
-
|
|
12
|
+
export const dtoExportFormatNames = [
|
|
13
|
+
"glb",
|
|
14
|
+
"gltf",
|
|
15
|
+
"fbx",
|
|
16
|
+
"dwg",
|
|
17
|
+
"cmdrw",
|
|
18
|
+
"cmfav",
|
|
19
|
+
"cmsym",
|
|
20
|
+
];
|
|
21
|
+
export const dtoExportStatusStatusNames = [
|
|
22
|
+
"pending",
|
|
23
|
+
"running",
|
|
24
|
+
"finished",
|
|
25
|
+
"failed",
|
|
26
|
+
];
|
|
27
|
+
export const dtoNoteSeverityNames = ["Information", "Critical", "Warning"];
|
|
14
28
|
export const dtoRenderFormatNames = ["jpg", "png"];
|
|
15
|
-
export const dtoRenderStatusStatusNames = [
|
|
29
|
+
export const dtoRenderStatusStatusNames = [
|
|
30
|
+
"pending",
|
|
31
|
+
"running",
|
|
32
|
+
"finished",
|
|
33
|
+
"failed",
|
|
34
|
+
];
|
|
16
35
|
export const dtoSyncGroupMethodsNames = ["pull", "push", "twoWay"];
|
|
17
36
|
export class DtoAPIError extends Error {
|
|
18
37
|
}
|
|
@@ -31,7 +50,9 @@ export class CatalogueAPI {
|
|
|
31
50
|
}
|
|
32
51
|
}
|
|
33
52
|
hasFeature(feature) {
|
|
34
|
-
return this.auth !== undefined &&
|
|
53
|
+
return (this.auth !== undefined &&
|
|
54
|
+
this.auth.apiSession.features !== undefined &&
|
|
55
|
+
this.auth.apiSession.features.indexOf(feature) > -1);
|
|
35
56
|
}
|
|
36
57
|
fetch(url, options) {
|
|
37
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -127,7 +148,7 @@ export class CatalogueAPI {
|
|
|
127
148
|
return this.fetch(this.auth.endpoint + url, options);
|
|
128
149
|
});
|
|
129
150
|
}
|
|
130
|
-
|
|
151
|
+
getProductLegacyV2(params) {
|
|
131
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
153
|
if (this.auth === undefined) {
|
|
133
154
|
throw new Error("missing auth");
|
|
@@ -143,6 +164,22 @@ export class CatalogueAPI {
|
|
|
143
164
|
return this.fetch(this.auth.endpoint + url, options);
|
|
144
165
|
});
|
|
145
166
|
}
|
|
167
|
+
getProduct(params) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
if (this.auth === undefined) {
|
|
170
|
+
throw new Error("missing auth");
|
|
171
|
+
}
|
|
172
|
+
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product-v3/${encodeURIComponent(params.partNumber)}`;
|
|
173
|
+
const options = {
|
|
174
|
+
method: "GET",
|
|
175
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
176
|
+
};
|
|
177
|
+
if (this._alternativeReferer) {
|
|
178
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
179
|
+
}
|
|
180
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
146
183
|
postRender(params, body) {
|
|
147
184
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
185
|
if (this.auth === undefined) {
|
|
@@ -160,7 +197,7 @@ export class CatalogueAPI {
|
|
|
160
197
|
return this.fetch(this.auth.endpoint + url, options);
|
|
161
198
|
});
|
|
162
199
|
}
|
|
163
|
-
|
|
200
|
+
postValidateLegacyV1(params, body) {
|
|
164
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
202
|
if (this.auth === undefined) {
|
|
166
203
|
throw new Error("missing auth");
|
|
@@ -177,6 +214,23 @@ export class CatalogueAPI {
|
|
|
177
214
|
return this.fetch(this.auth.endpoint + url, options);
|
|
178
215
|
});
|
|
179
216
|
}
|
|
217
|
+
postValidate(params, body) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
if (this.auth === undefined) {
|
|
220
|
+
throw new Error("missing auth");
|
|
221
|
+
}
|
|
222
|
+
const url = `/v1/catalogue/${encodeURIComponent(params.lang)}/${encodeURIComponent(params.enterprise)}/${encodeURIComponent(params.prdCat)}/${encodeURIComponent(params.prdCatVersion)}/${encodeURIComponent(params.vendor)}/${encodeURIComponent(params.priceList)}/product/${encodeURIComponent(params.partNumber)}/validate-v2`;
|
|
223
|
+
const options = {
|
|
224
|
+
method: "POST",
|
|
225
|
+
headers: { "X-API-Key": this.auth.secretToken || "" },
|
|
226
|
+
body: JSON.stringify(body),
|
|
227
|
+
};
|
|
228
|
+
if (this._alternativeReferer) {
|
|
229
|
+
options.headers["Alternative-Referer"] = this._alternativeReferer;
|
|
230
|
+
}
|
|
231
|
+
return this.fetch(this.auth.endpoint + url, options);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
180
234
|
getTocTree(params) {
|
|
181
235
|
return __awaiter(this, void 0, void 0, function* () {
|
|
182
236
|
if (this.auth === undefined) {
|
|
@@ -263,8 +317,10 @@ export const DTO_OPERATION_ID_TO_DEBIT_GROUP = {
|
|
|
263
317
|
getApplicationAreas: "base",
|
|
264
318
|
postExport: "export",
|
|
265
319
|
getPriceLists: "base",
|
|
320
|
+
getProductLegacyV2: "base",
|
|
266
321
|
getProduct: "base",
|
|
267
322
|
postRender: "render",
|
|
323
|
+
postValidateLegacyV1: "base",
|
|
268
324
|
postValidate: "base",
|
|
269
325
|
getTocTree: "base",
|
|
270
326
|
getTocFlat: "base",
|
package/dist/CfgProduct.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AggregatedLoadingObservable, LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import { DtoAdditionalProductConfiguration, DtoAdditionalProductRef,
|
|
2
|
+
import { DtoAdditionalProductConfiguration, DtoAdditionalProductRef, DtoCatalogueParamsWithCid, DtoMeasureParam, DtoMiscFile, DtoMtrlApplication, DtoNote, DtoPrices, DtoProductConf, DtoProductParamsWithCidAndLang, DtoTransform } from "./CatalogueAPI.js";
|
|
3
3
|
import { CfgMeasureDefinition } from "./CfgMeasure.js";
|
|
4
4
|
import { _CfgFeatureInternal } from "./productConfiguration/CfgFeature.js";
|
|
5
5
|
import { ProductConfigurationBubbleMode } from "./productConfiguration/CfgOption.js";
|
|
@@ -8,6 +8,7 @@ import { ProductLoader } from "./productLoader.js";
|
|
|
8
8
|
import { SyncGroupsApplyMode } from "./syncGroups/SyncGroupsApplyMode.js";
|
|
9
9
|
import { SyncGroupsHandler } from "./syncGroups/SyncGroupsHandler.js";
|
|
10
10
|
import { CfgProductData, RootNodeSource } from "./utilitiesCatalogueData.js";
|
|
11
|
+
import { CfgProdConfParts } from "./utilitiesConfiguration.js";
|
|
11
12
|
/**
|
|
12
13
|
* @freshRef a new pointer to the same product, backed by the same original object
|
|
13
14
|
* @committed false is an indication that this is a potentially transient state. It could
|
|
@@ -72,7 +73,7 @@ export declare type CfgPrice = {
|
|
|
72
73
|
*/
|
|
73
74
|
export declare class _CfgProductInternal {
|
|
74
75
|
readonly _productLoaderRaw: ProductLoader;
|
|
75
|
-
readonly prodParams:
|
|
76
|
+
readonly prodParams: DtoProductParamsWithCidAndLang;
|
|
76
77
|
readonly settings: CfgProductSettings;
|
|
77
78
|
readonly uuid: string;
|
|
78
79
|
private readonly _rawUnit;
|
|
@@ -81,7 +82,8 @@ 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:
|
|
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;
|
|
85
87
|
private constructor();
|
|
86
88
|
readonly root: _CfgProductInternal;
|
|
87
89
|
private _destroyed;
|
|
@@ -89,12 +91,43 @@ export declare class _CfgProductInternal {
|
|
|
89
91
|
readonly additionalProducts: CfgProduct[];
|
|
90
92
|
private _selected;
|
|
91
93
|
private _configuration;
|
|
94
|
+
private _notes;
|
|
92
95
|
readonly changeObservable: Observable<CfgProductChangeNotification>;
|
|
93
96
|
get selected(): boolean;
|
|
94
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
|
+
*/
|
|
95
104
|
clone(parent?: _CfgProductInternal, root?: _CfgProductInternal): Promise<_CfgProductInternal>;
|
|
105
|
+
/** Mark this and its descendants as destroyed and remove all listeners */
|
|
96
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
|
+
*/
|
|
97
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;
|
|
98
131
|
get description(): string | undefined;
|
|
99
132
|
get rootNodeSources(): RootNodeSource[] | undefined;
|
|
100
133
|
get mtrlApplications(): DtoMtrlApplication[] | undefined;
|
|
@@ -111,7 +144,7 @@ export declare class _CfgProductInternal {
|
|
|
111
144
|
get unit(): LengthUnit;
|
|
112
145
|
get aggregatedPrice(): CfgPrice;
|
|
113
146
|
get optional(): boolean;
|
|
114
|
-
setSelected(
|
|
147
|
+
setSelected(selected: boolean, bubbleMode: CfgProductBubbleMode, interactive: boolean): Promise<boolean>;
|
|
115
148
|
get configuration(): CfgProductConfiguration;
|
|
116
149
|
get rawProductData(): CfgProductData;
|
|
117
150
|
/**
|
|
@@ -136,8 +169,8 @@ export declare class _CfgProductInternal {
|
|
|
136
169
|
_additionalProductHasChanged: (freshRef: CfgProduct, bubbleMode: CfgProductBubbleMode, committed: boolean) => Promise<void>;
|
|
137
170
|
/** Called by the configuration to tell its parent that it has changed. */
|
|
138
171
|
_configurationHasChanged: (freshRef: CfgProductConfiguration, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
|
|
139
|
-
getDtoConf: (
|
|
140
|
-
setDtoConf: (s:
|
|
172
|
+
getDtoConf: (include: CfgProdConfParts) => DtoProductConf;
|
|
173
|
+
setDtoConf: (s: DtoProductConf, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
141
174
|
setApiSelection: (s: DtoAdditionalProductConfiguration, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
142
175
|
copyFrom: (source: _CfgProductInternal, doValidate: boolean, productLoaderForGroupedLoad?: ProductLoader | undefined) => Promise<boolean>;
|
|
143
176
|
private _setApiSelectionWithOtherProduct;
|
|
@@ -162,11 +195,11 @@ export declare class _CfgProductInternal {
|
|
|
162
195
|
* Based on this configuration find what additional products should be shown and not, unload
|
|
163
196
|
* (i.e. destroy) those that should no longer be shown, load the new ones.
|
|
164
197
|
*/
|
|
165
|
-
_syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader) => Promise<boolean>;
|
|
198
|
+
_syncAndLoadAdditionalProducts: (productLoaderForGroupedLoad: ProductLoader, initialProductConfiguration: DtoAdditionalProductConfiguration | undefined) => Promise<boolean>;
|
|
166
199
|
}
|
|
167
200
|
export declare class CfgProduct {
|
|
168
201
|
readonly _internal: _CfgProductInternal;
|
|
169
|
-
static make(productLoader: ProductLoader, prodParams:
|
|
202
|
+
static make(productLoader: ProductLoader, prodParams: DtoProductParamsWithCidAndLang, settings?: Partial<CfgProductSettings>, initialProductConfiguration?: DtoProductConf | DtoAdditionalProductConfiguration): Promise<CfgProduct>;
|
|
170
203
|
/**
|
|
171
204
|
* Makes an object wrapping the passed object. This is not a clone method, it is a method to
|
|
172
205
|
* make a new outer reference. Like a shallow copy. We use this to help frameworks that are
|
|
@@ -193,9 +226,11 @@ export declare class CfgProduct {
|
|
|
193
226
|
* It will be unique amongst child products, but not globally unique.
|
|
194
227
|
*/
|
|
195
228
|
get refKey(): string | undefined;
|
|
196
|
-
get
|
|
229
|
+
get notes(): DtoNote[];
|
|
230
|
+
get miscFiles(): DtoMiscFile[];
|
|
231
|
+
get prodParams(): DtoProductParamsWithCidAndLang;
|
|
197
232
|
get lang(): string;
|
|
198
|
-
get catId():
|
|
233
|
+
get catId(): DtoCatalogueParamsWithCid;
|
|
199
234
|
get partNumber(): string;
|
|
200
235
|
get isAdditionalProduct(): boolean;
|
|
201
236
|
/** Only used when this product is an additional product. Root products are never optional. */
|
|
@@ -208,7 +243,7 @@ export declare class CfgProduct {
|
|
|
208
243
|
/**
|
|
209
244
|
* Please note that this relates to the visibility in the Configuration tree.
|
|
210
245
|
* It does not affect the visibility of anything in the 3D view at all.
|
|
211
|
-
* Visibility
|
|
246
|
+
* Visibility affects the Configuration for this Product, but any Additional Products
|
|
212
247
|
* will not be affected.
|
|
213
248
|
*/
|
|
214
249
|
get visible(): boolean;
|
|
@@ -218,6 +253,18 @@ export declare class CfgProduct {
|
|
|
218
253
|
* assumed to always be legal.
|
|
219
254
|
*/
|
|
220
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;
|
|
221
268
|
get rawProductData(): CfgProductData;
|
|
222
269
|
get uuid(): string;
|
|
223
270
|
get unit(): LengthUnit;
|
|
@@ -254,11 +301,40 @@ export declare class CfgProduct {
|
|
|
254
301
|
* Gets what selections has been made on the product, recursively including product
|
|
255
302
|
* configuration, optional products and additional products. Used when a full view of all
|
|
256
303
|
* selections on a product is needed, such as when doing Render or Export.
|
|
304
|
+
* @deprecated getDtoConf provides a newer format.
|
|
305
|
+
* @see getDtoConf
|
|
257
306
|
*/
|
|
258
307
|
getApiSelection: () => DtoAdditionalProductConfiguration;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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>;
|
|
262
338
|
listenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
|
|
263
339
|
stopListenForChange: (l: SingleArgCallback<CfgProductChangeNotification>) => void;
|
|
264
340
|
stopAllListenForChange: () => void;
|