@configura/web-api 2.0.0-alpha.16 → 2.0.0-alpha.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CatalogueAPI.d.ts +16 -16
- package/dist/CfgProduct.d.ts +19 -6
- package/dist/CfgProduct.js +19 -0
- package/dist/CfgReferencePathHelper.d.ts +3 -3
- package/dist/io/CfgHistoryManager.js +6 -0
- package/dist/io/CfgIOManager.d.ts +5 -0
- package/dist/io/CfgIOManager.js +19 -0
- package/dist/io/CfgIOProdConfConnector.d.ts +7 -5
- package/dist/io/CfgIOProdConfConnector.js +18 -7
- package/dist/io/CfgIOWarningSupplier.d.ts +4 -0
- package/dist/io/CfgIOWarningSupplier.js +1 -0
- package/dist/io/CfgWindowMessageManager.js +4 -0
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +7 -0
- package/dist/productConfiguration/CfgProductConfiguration.js +12 -2
- package/dist/productConfiguration/filters.d.ts +2 -2
- package/dist/productConfiguration/productParamsGenerator.d.ts +3 -3
- package/dist/productLoader.d.ts +3 -3
- package/dist/tasks/TaskHandler.d.ts +2 -2
- package/dist/tests/testData/dummyProductForTest.d.ts +2 -2
- package/dist/utilitiesCatalogueData.d.ts +9 -9
- package/dist/utilitiesCataloguePermission.d.ts +4 -4
- package/package.json +3 -3
package/dist/CatalogueAPI.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface DtoAdditionalProductConfiguration {
|
|
|
13
13
|
/** AdditionalProductRef */
|
|
14
14
|
export interface DtoAdditionalProductRef {
|
|
15
15
|
refKey: string;
|
|
16
|
-
catId:
|
|
16
|
+
catId: DtoCatalogueParamsWithCid;
|
|
17
17
|
partNumber: string;
|
|
18
18
|
refDescription?: string;
|
|
19
19
|
anchor?: DtoMeasureParam;
|
|
@@ -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 - 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. */
|
|
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;
|
|
@@ -357,7 +357,7 @@ export interface DtoProductCatalogueInfo {
|
|
|
357
357
|
export interface DtoProductConf {
|
|
358
358
|
features?: Array<DtoFeatureConf>;
|
|
359
359
|
additionalProducts?: Array<DtoAdditionalProductConf>;
|
|
360
|
-
prodParams?:
|
|
360
|
+
prodParams?: DtoProductParamsWithCidAndLang;
|
|
361
361
|
}
|
|
362
362
|
/** ProductData */
|
|
363
363
|
export interface DtoProductData {
|
|
@@ -383,12 +383,12 @@ export interface DtoProductData {
|
|
|
383
383
|
models?: Array<DtoModel>;
|
|
384
384
|
partsData: DtoPartsData;
|
|
385
385
|
}
|
|
386
|
-
/**
|
|
387
|
-
export interface
|
|
386
|
+
/** ProductParamsWithCid */
|
|
387
|
+
export interface DtoProductParamsWithCid extends DtoCatalogueParamsWithCid {
|
|
388
388
|
partNumber: string;
|
|
389
389
|
}
|
|
390
|
-
/**
|
|
391
|
-
export interface
|
|
390
|
+
/** ProductParamsWithCidAndLang */
|
|
391
|
+
export interface DtoProductParamsWithCidAndLang extends DtoProductParamsWithCid {
|
|
392
392
|
lang: string;
|
|
393
393
|
}
|
|
394
394
|
/** ProductRef */
|
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, DtoMtrlApplication, 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";
|
|
@@ -72,7 +72,7 @@ export declare type CfgPrice = {
|
|
|
72
72
|
*/
|
|
73
73
|
export declare class _CfgProductInternal {
|
|
74
74
|
readonly _productLoaderRaw: ProductLoader;
|
|
75
|
-
readonly prodParams:
|
|
75
|
+
readonly prodParams: DtoProductParamsWithCidAndLang;
|
|
76
76
|
readonly settings: CfgProductSettings;
|
|
77
77
|
readonly uuid: string;
|
|
78
78
|
private readonly _rawUnit;
|
|
@@ -81,7 +81,7 @@ export declare class _CfgProductInternal {
|
|
|
81
81
|
readonly parent: _CfgProductInternal | undefined;
|
|
82
82
|
private _additionalProductRef;
|
|
83
83
|
private readonly _syncGroupHandler;
|
|
84
|
-
static make: (productLoaderRaw: ProductLoader, productLoaderForGroupedLoad: ProductLoader | undefined, prodParams:
|
|
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
85
|
private constructor();
|
|
86
86
|
readonly root: _CfgProductInternal;
|
|
87
87
|
private _destroyed;
|
|
@@ -101,6 +101,7 @@ export declare class _CfgProductInternal {
|
|
|
101
101
|
* change.
|
|
102
102
|
*/
|
|
103
103
|
_updateAdditionalProdRef(p: DtoAdditionalProductRef): void;
|
|
104
|
+
get hasRootFeaturesChanged(): boolean;
|
|
104
105
|
get description(): string | undefined;
|
|
105
106
|
get rootNodeSources(): RootNodeSource[] | undefined;
|
|
106
107
|
get mtrlApplications(): DtoMtrlApplication[] | undefined;
|
|
@@ -172,7 +173,7 @@ export declare class _CfgProductInternal {
|
|
|
172
173
|
}
|
|
173
174
|
export declare class CfgProduct {
|
|
174
175
|
readonly _internal: _CfgProductInternal;
|
|
175
|
-
static make(productLoader: ProductLoader, prodParams:
|
|
176
|
+
static make(productLoader: ProductLoader, prodParams: DtoProductParamsWithCidAndLang, settings?: Partial<CfgProductSettings>): Promise<CfgProduct>;
|
|
176
177
|
/**
|
|
177
178
|
* Makes an object wrapping the passed object. This is not a clone method, it is a method to
|
|
178
179
|
* make a new outer reference. Like a shallow copy. We use this to help frameworks that are
|
|
@@ -199,9 +200,9 @@ export declare class CfgProduct {
|
|
|
199
200
|
* It will be unique amongst child products, but not globally unique.
|
|
200
201
|
*/
|
|
201
202
|
get refKey(): string | undefined;
|
|
202
|
-
get prodParams():
|
|
203
|
+
get prodParams(): DtoProductParamsWithCidAndLang;
|
|
203
204
|
get lang(): string;
|
|
204
|
-
get catId():
|
|
205
|
+
get catId(): DtoCatalogueParamsWithCid;
|
|
205
206
|
get partNumber(): string;
|
|
206
207
|
get isAdditionalProduct(): boolean;
|
|
207
208
|
/** Only used when this product is an additional product. Root products are never optional. */
|
|
@@ -224,6 +225,18 @@ export declare class CfgProduct {
|
|
|
224
225
|
* assumed to always be legal.
|
|
225
226
|
*/
|
|
226
227
|
setSelected: (v: boolean) => Promise<boolean>;
|
|
228
|
+
/**
|
|
229
|
+
* Functional selection is a Catalogues feature where selecting Options on Features result in that you
|
|
230
|
+
* "jump" to another Product as a result of the Validate call. You normally do not notice that a functional
|
|
231
|
+
* selection has occurred except for the styleNr changing. Functional selection can change which Features
|
|
232
|
+
* from the original product call are used as root Features. This can in turn affect if serialized
|
|
233
|
+
* configuration can be applied or not.
|
|
234
|
+
*
|
|
235
|
+
* The SDK can currently only apply serialized configuration if the list of root Features has not changed.
|
|
236
|
+
* For this reason, when functional selection has happened, extracting data for external systems might work
|
|
237
|
+
* well, but reapplying back into Stage will probably fail.
|
|
238
|
+
*/
|
|
239
|
+
get hasRootFeaturesChanged(): boolean;
|
|
227
240
|
get rawProductData(): CfgProductData;
|
|
228
241
|
get uuid(): string;
|
|
229
242
|
get unit(): LengthUnit;
|
package/dist/CfgProduct.js
CHANGED
|
@@ -456,6 +456,10 @@ export class _CfgProductInternal {
|
|
|
456
456
|
this._selected = p.optional ? false : undefined;
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
|
+
get hasRootFeaturesChanged() {
|
|
460
|
+
return (this._configuration._internal.hasRootFeaturesChanged ||
|
|
461
|
+
this.additionalProducts.some((p) => p._internal.hasRootFeaturesChanged));
|
|
462
|
+
}
|
|
459
463
|
get description() {
|
|
460
464
|
var _a, _b;
|
|
461
465
|
return (_b = (_a = this._additionalProductRef) === null || _a === void 0 ? void 0 : _a.refDescription) !== null && _b !== void 0 ? _b : this._rawProductData.description;
|
|
@@ -772,6 +776,21 @@ export class CfgProduct {
|
|
|
772
776
|
get visible() {
|
|
773
777
|
return this._internal.visible;
|
|
774
778
|
}
|
|
779
|
+
// A similar text to the one below exists in global-message-managers.md and should be kept in sync.
|
|
780
|
+
/**
|
|
781
|
+
* Functional selection is a Catalogues feature where selecting Options on Features result in that you
|
|
782
|
+
* "jump" to another Product as a result of the Validate call. You normally do not notice that a functional
|
|
783
|
+
* selection has occurred except for the styleNr changing. Functional selection can change which Features
|
|
784
|
+
* from the original product call are used as root Features. This can in turn affect if serialized
|
|
785
|
+
* configuration can be applied or not.
|
|
786
|
+
*
|
|
787
|
+
* The SDK can currently only apply serialized configuration if the list of root Features has not changed.
|
|
788
|
+
* For this reason, when functional selection has happened, extracting data for external systems might work
|
|
789
|
+
* well, but reapplying back into Stage will probably fail.
|
|
790
|
+
*/
|
|
791
|
+
get hasRootFeaturesChanged() {
|
|
792
|
+
return this._internal.hasRootFeaturesChanged;
|
|
793
|
+
}
|
|
775
794
|
get rawProductData() {
|
|
776
795
|
return this._internal.rawProductData;
|
|
777
796
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoCatalogueParamsWithCidAndLang, DtoProductParamsWithCidAndLang } from "./CatalogueAPI";
|
|
2
2
|
/**
|
|
3
3
|
* These methods aims to provide a default suggested way of building
|
|
4
4
|
* URLs to Products and Catalogues. By using consistent URL:s copy-paste
|
|
@@ -14,7 +14,7 @@ export declare class CfgReferencePathHelper {
|
|
|
14
14
|
* @param catParams What catalogue to generate URL for.
|
|
15
15
|
* @returns An URL to a catalogue
|
|
16
16
|
*/
|
|
17
|
-
static getCataloguePath: (browsingRootUrl: string, catParams:
|
|
17
|
+
static getCataloguePath: (browsingRootUrl: string, catParams: DtoCatalogueParamsWithCidAndLang) => string;
|
|
18
18
|
/**
|
|
19
19
|
* Use to generate URLs in our reference format. This is the format Configura uses in our integrations.
|
|
20
20
|
* @param browsingRootUrl The URL where Stage browsing begins
|
|
@@ -22,6 +22,6 @@ export declare class CfgReferencePathHelper {
|
|
|
22
22
|
* @param separator Optional, defaults to "product", but can be changed to indicate another function.
|
|
23
23
|
* @returns An URL to a product
|
|
24
24
|
*/
|
|
25
|
-
static getProductPath: (browsingRootUrl: string, productParams:
|
|
25
|
+
static getProductPath: (browsingRootUrl: string, productParams: DtoProductParamsWithCidAndLang, separator?: string) => string;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=CfgReferencePathHelper.d.ts.map
|
|
@@ -59,6 +59,12 @@ export class CfgHistoryManager extends CfgWindowEventManager {
|
|
|
59
59
|
*/
|
|
60
60
|
send(messageKey, data) {
|
|
61
61
|
const { qsKeyValues, message, mode } = data;
|
|
62
|
+
const warnings = this.getWarnings();
|
|
63
|
+
if (warnings.length !== 0) {
|
|
64
|
+
console.warn("History updating blocked by warnings");
|
|
65
|
+
warnings.forEach((w) => console.warn(w));
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
62
68
|
for (const keyValue of qsKeyValues) {
|
|
63
69
|
this._aggregatedQsKeyValues.set(keyValue[0], keyValue[1]);
|
|
64
70
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CfgIOWarningSupplier } from "./CfgIOWarningSupplier";
|
|
1
2
|
declare type ConfiguraAttribute = "C0nf1gura";
|
|
2
3
|
declare type ConfiguraShebang = "arug1fn0C";
|
|
3
4
|
declare const CONFIGURA_ATTRIBUTE: ConfiguraAttribute;
|
|
@@ -17,6 +18,10 @@ export declare type CfgIOContainer = {
|
|
|
17
18
|
* Base class for classes handling input and output in globally shared environments.
|
|
18
19
|
*/
|
|
19
20
|
export declare abstract class CfgIOManager<S> {
|
|
21
|
+
private _warningSuppliers;
|
|
22
|
+
addWarningSupplier(supplier: CfgIOWarningSupplier): void;
|
|
23
|
+
removeWarningSupplier(supplier: CfgIOWarningSupplier): void;
|
|
24
|
+
getWarnings(): string[];
|
|
20
25
|
/**
|
|
21
26
|
* Listen for the message messageKey being received.
|
|
22
27
|
*/
|
package/dist/io/CfgIOManager.js
CHANGED
|
@@ -18,12 +18,31 @@ const hasConfiguraAttribute = (data) => {
|
|
|
18
18
|
*/
|
|
19
19
|
export class CfgIOManager {
|
|
20
20
|
constructor() {
|
|
21
|
+
this._warningSuppliers = [];
|
|
21
22
|
// A lock to avoid circular write. Asynchronous conditions can make this not be enough.
|
|
22
23
|
// Avoid creating pre-conditions where this can happen.
|
|
23
24
|
this._receiveInProgress = false;
|
|
24
25
|
this._messageListeners = [];
|
|
25
26
|
this._getIndexOfMessageListener = (l) => this._messageListeners.findIndex((item) => l === item.l);
|
|
26
27
|
}
|
|
28
|
+
addWarningSupplier(supplier) {
|
|
29
|
+
this._warningSuppliers.push(supplier);
|
|
30
|
+
}
|
|
31
|
+
removeWarningSupplier(supplier) {
|
|
32
|
+
const i = this._warningSuppliers.indexOf(supplier);
|
|
33
|
+
if (i === -1) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
this._warningSuppliers.splice(i, 1);
|
|
37
|
+
}
|
|
38
|
+
getWarnings() {
|
|
39
|
+
return this._warningSuppliers.reduce((aggregated, supplier) => {
|
|
40
|
+
for (const warning of supplier.getWarnings()) {
|
|
41
|
+
aggregated.push(warning);
|
|
42
|
+
}
|
|
43
|
+
return aggregated;
|
|
44
|
+
}, []);
|
|
45
|
+
}
|
|
27
46
|
/**
|
|
28
47
|
* Listen for the message messageKey being received.
|
|
29
48
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DtoAdditionalProductConfiguration, DtoProductConf } from "../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct, CfgProductChangeNotification } from "../CfgProduct.js";
|
|
3
3
|
import { CfgIOManager } from "./CfgIOManager.js";
|
|
4
|
+
import { CfgIOWarningSupplier } from "./CfgIOWarningSupplier.js";
|
|
4
5
|
export declare const isCfgProdConfMessage: (data: unknown) => data is CfgProdConfMessageV1 | CfgProdConfMessageV2;
|
|
5
6
|
export declare type CfgProdConfMessageV1 = {
|
|
6
7
|
version: "1.0";
|
|
@@ -27,16 +28,17 @@ declare type ProdConfCallback = (conf: DtoProductConf) => Promise<void>;
|
|
|
27
28
|
/**
|
|
28
29
|
* Base class for connecting the product configuration to an IO channel
|
|
29
30
|
*/
|
|
30
|
-
export declare abstract class CfgIOProdConfConnector<S> {
|
|
31
|
-
|
|
31
|
+
export declare abstract class CfgIOProdConfConnector<S> implements CfgIOWarningSupplier {
|
|
32
|
+
protected readonly _ioManager: CfgIOManager<S>;
|
|
32
33
|
private readonly _includeExtendedDataInSend;
|
|
33
34
|
private readonly _includeProdParamsInSend;
|
|
34
|
-
|
|
35
|
+
protected _product: CfgProduct | undefined;
|
|
35
36
|
private _stopListenToMessage;
|
|
36
37
|
private _stopListenToProdConf;
|
|
37
|
-
constructor(_ioManager: CfgIOManager<S>, _includeExtendedDataInSend: boolean, // Only v2.0
|
|
38
|
+
constructor(_ioManager: CfgIOManager<S>, _includeExtendedDataInSend: boolean, // Only for v2.0
|
|
38
39
|
_includeProdParamsInSend: boolean);
|
|
39
|
-
destroy
|
|
40
|
+
destroy(): void;
|
|
41
|
+
getWarnings(): string[];
|
|
40
42
|
setProduct: (product: CfgProduct | undefined) => Promise<void>;
|
|
41
43
|
private _send;
|
|
42
44
|
protected getInitialProdConf(): DtoProductConf | undefined;
|
|
@@ -24,19 +24,14 @@ export const STAGE_PROD_CONF_MESSAGE_KEY = "stageprodconf";
|
|
|
24
24
|
* Base class for connecting the product configuration to an IO channel
|
|
25
25
|
*/
|
|
26
26
|
export class CfgIOProdConfConnector {
|
|
27
|
-
constructor(_ioManager, _includeExtendedDataInSend, // Only v2.0
|
|
28
|
-
_includeProdParamsInSend // Only v2.0
|
|
27
|
+
constructor(_ioManager, _includeExtendedDataInSend, // Only for v2.0
|
|
28
|
+
_includeProdParamsInSend // Only for v2.0
|
|
29
29
|
) {
|
|
30
30
|
this._ioManager = _ioManager;
|
|
31
31
|
this._includeExtendedDataInSend = _includeExtendedDataInSend;
|
|
32
32
|
this._includeProdParamsInSend = _includeProdParamsInSend;
|
|
33
33
|
this._stopListenToMessage = undefined;
|
|
34
34
|
this._stopListenToProdConf = undefined;
|
|
35
|
-
this.destroy = () => {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
(_a = this._stopListenToMessage) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
38
|
-
(_b = this._stopListenToProdConf) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
39
|
-
};
|
|
40
35
|
this.setProduct = (product) => __awaiter(this, void 0, void 0, function* () {
|
|
41
36
|
var _a, _b;
|
|
42
37
|
const currentProduct = this._product;
|
|
@@ -88,6 +83,22 @@ export class CfgIOProdConfConnector {
|
|
|
88
83
|
this._stopListenToProdConf = CfgIOProdConfConnector.listenForProdConf(newProduct, (conf) => __awaiter(this, void 0, void 0, function* () { return this._send(this.makeSendData(conf, false)); }), this._includeExtendedDataInSend, this._includeProdParamsInSend);
|
|
89
84
|
});
|
|
90
85
|
this._send = (data) => this._ioManager.send(STAGE_PROD_CONF_MESSAGE_KEY, data);
|
|
86
|
+
_ioManager.addWarningSupplier(this);
|
|
87
|
+
}
|
|
88
|
+
destroy() {
|
|
89
|
+
var _a, _b;
|
|
90
|
+
(_a = this._stopListenToMessage) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
91
|
+
(_b = this._stopListenToProdConf) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
92
|
+
this._ioManager.removeWarningSupplier(this);
|
|
93
|
+
}
|
|
94
|
+
getWarnings() {
|
|
95
|
+
const product = this._product;
|
|
96
|
+
if (product !== undefined && product.hasRootFeaturesChanged) {
|
|
97
|
+
return [
|
|
98
|
+
"In at least one of the Products, Functional Selection has taken place, thereby changing what root Features are used. The SDK can not yet apply a serialized configuration in these cases. Extracting this data from the SDK for external applications can work, but reinserting the data into Stage will most likely fail.",
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
return [];
|
|
91
102
|
}
|
|
92
103
|
getInitialProdConf() {
|
|
93
104
|
return undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -70,6 +70,10 @@ export class CfgWindowMessageManager extends CfgWindowEventManager {
|
|
|
70
70
|
const container = CfgIOManager.makeContainer({
|
|
71
71
|
[messageKey]: data,
|
|
72
72
|
});
|
|
73
|
+
const warnings = this.getWarnings();
|
|
74
|
+
if (warnings.length !== 0) {
|
|
75
|
+
warnings.forEach((w) => console.warn(w));
|
|
76
|
+
}
|
|
73
77
|
for (const remoteEnd of this._remoteEnds) {
|
|
74
78
|
remoteEnd.postMessage(container, this._targetOrigin);
|
|
75
79
|
}
|
|
@@ -20,6 +20,7 @@ export declare class _CfgProductConfigurationInternal {
|
|
|
20
20
|
readonly allRawFeatures: DtoFeature[];
|
|
21
21
|
readonly parentProduct: _CfgProductInternal;
|
|
22
22
|
readonly rootProduct: _CfgProductInternal;
|
|
23
|
+
private readonly _initialRootFeatureRefs;
|
|
23
24
|
static _makeUninitialized(rootFeatureRefs: DtoFeatureRef[], allRawFeatures: DtoFeature[], // Flat packed. All the features that can appear anyplace in the selection tree.
|
|
24
25
|
parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): _CfgProductConfigurationInternal;
|
|
25
26
|
private constructor();
|
|
@@ -50,6 +51,12 @@ export declare class _CfgProductConfigurationInternal {
|
|
|
50
51
|
tryMatchSelection: (other: _CfgProductConfigurationInternal, descriptionMatch: boolean | undefined, validate: boolean) => Promise<boolean>;
|
|
51
52
|
/** Only selected features. */
|
|
52
53
|
_getFeaturesWithCode: (code: string) => _CfgFeatureInternal[];
|
|
54
|
+
private _hasRootFeaturesChanged;
|
|
55
|
+
/**
|
|
56
|
+
* True if what root Features are used is not the same as at initial load.
|
|
57
|
+
* This means that functional selection has happened.
|
|
58
|
+
*/
|
|
59
|
+
get hasRootFeaturesChanged(): boolean;
|
|
53
60
|
populateFeatures: (rootFeatureRefs: DtoFeatureRef[]) => void;
|
|
54
61
|
setStretchReferenceLength: (measureParamCode: string, referenceLength: number | undefined, unit: LengthUnit) => Promise<boolean>;
|
|
55
62
|
}
|
|
@@ -20,10 +20,11 @@ import { syncCfgFeatures } from "./utilitiesProductConfiguration.js";
|
|
|
20
20
|
*/
|
|
21
21
|
export class _CfgProductConfigurationInternal {
|
|
22
22
|
constructor(allRawFeatures, // Flat packed. All the features that can appear anyplace in the selection tree.
|
|
23
|
-
parentProduct, rootProduct) {
|
|
23
|
+
parentProduct, rootProduct, _initialRootFeatureRefs) {
|
|
24
24
|
this.allRawFeatures = allRawFeatures;
|
|
25
25
|
this.parentProduct = parentProduct;
|
|
26
26
|
this.rootProduct = rootProduct;
|
|
27
|
+
this._initialRootFeatureRefs = _initialRootFeatureRefs;
|
|
27
28
|
this.key = "~";
|
|
28
29
|
this._rootFeatureRefs = [];
|
|
29
30
|
this._features = [];
|
|
@@ -113,8 +114,10 @@ export class _CfgProductConfigurationInternal {
|
|
|
113
114
|
agg.push(...feature._internal._getFeaturesWithCode(code));
|
|
114
115
|
return agg;
|
|
115
116
|
}, []);
|
|
117
|
+
this._hasRootFeaturesChanged = false;
|
|
116
118
|
this.populateFeatures = (rootFeatureRefs) => {
|
|
117
119
|
this._rootFeatureRefs = rootFeatureRefs;
|
|
120
|
+
this._hasRootFeaturesChanged = !compareArrays(this._initialRootFeatureRefs, rootFeatureRefs, (l, r) => l.code === r.code);
|
|
118
121
|
this._features = syncCfgFeatures(rootFeatureRefs, this._features, this.allRawFeatures, this, this, this.parentProduct, this.rootProduct);
|
|
119
122
|
};
|
|
120
123
|
this.setStretchReferenceLength = (measureParamCode, referenceLength, unit) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -198,7 +201,7 @@ export class _CfgProductConfigurationInternal {
|
|
|
198
201
|
}
|
|
199
202
|
static _makeUninitialized(rootFeatureRefs, allRawFeatures, // Flat packed. All the features that can appear anyplace in the selection tree.
|
|
200
203
|
parentProduct, rootProduct) {
|
|
201
|
-
const configuration = new this(allRawFeatures, parentProduct, rootProduct);
|
|
204
|
+
const configuration = new this(allRawFeatures, parentProduct, rootProduct, rootFeatureRefs);
|
|
202
205
|
configuration.populateFeatures(rootFeatureRefs);
|
|
203
206
|
return configuration;
|
|
204
207
|
}
|
|
@@ -217,6 +220,13 @@ export class _CfgProductConfigurationInternal {
|
|
|
217
220
|
features[i] = CfgFeature._makeNewRefFrom(featureInternal);
|
|
218
221
|
}
|
|
219
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* True if what root Features are used is not the same as at initial load.
|
|
225
|
+
* This means that functional selection has happened.
|
|
226
|
+
*/
|
|
227
|
+
get hasRootFeaturesChanged() {
|
|
228
|
+
return this._hasRootFeaturesChanged;
|
|
229
|
+
}
|
|
220
230
|
}
|
|
221
231
|
export class CfgProductConfiguration {
|
|
222
232
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Filters, Matches } from "@configura/web-utilities";
|
|
2
|
-
import {
|
|
3
|
-
export declare function applyCatalogueFilters<T extends
|
|
2
|
+
import { DtoCatalogueParams, DtoLevel, DtoProductRef } from "../CatalogueAPI.js";
|
|
3
|
+
export declare function applyCatalogueFilters<T extends DtoCatalogueParams>(filters: Filters<DtoCatalogueParams>, catalogues: T[]): [Matches<DtoCatalogueParams>, T[]];
|
|
4
4
|
export interface ProductRefParams {
|
|
5
5
|
partNr: string;
|
|
6
6
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Filters } from "@configura/web-utilities";
|
|
2
|
-
import { CatalogueAPI, DtoApplicationAreasResponse,
|
|
2
|
+
import { CatalogueAPI, DtoApplicationAreasResponse, DtoCatalogueParamsWithCid, DtoCatalogueParamsWithCidAndLang } from "../CatalogueAPI.js";
|
|
3
3
|
import { CfgProduct, CfgProductSettings } from "../CfgProduct.js";
|
|
4
4
|
import { ProductRefParams } from "./filters.js";
|
|
5
5
|
export interface GeneratedProductConfiguration {
|
|
6
6
|
applicationAreasResponse: DtoApplicationAreasResponse;
|
|
7
7
|
catalogueCount: number;
|
|
8
8
|
catalogueIndex: number;
|
|
9
|
-
catalogueParams:
|
|
9
|
+
catalogueParams: DtoCatalogueParamsWithCidAndLang;
|
|
10
10
|
getProductDuration: number;
|
|
11
11
|
product: CfgProduct;
|
|
12
12
|
productCount: number;
|
|
13
13
|
productIndex: number;
|
|
14
14
|
}
|
|
15
|
-
export declare function generateProductConfigurations(api: CatalogueAPI, lang: string, catalogues:
|
|
15
|
+
export declare function generateProductConfigurations(api: CatalogueAPI, lang: string, catalogues: DtoCatalogueParamsWithCid[], filters: Filters<ProductRefParams>, settings?: Partial<CfgProductSettings>): AsyncIterableIterator<GeneratedProductConfiguration | Error>;
|
|
16
16
|
//# sourceMappingURL=productParamsGenerator.d.ts.map
|
package/dist/productLoader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoProductParamsWithCidAndLang, DtoValidateRequest } from "./CatalogueAPI.js";
|
|
2
2
|
import { CfgProductResponse, CfgValidateResponse } from "./utilitiesCatalogueData.js";
|
|
3
|
-
export declare type GetProduct = (params:
|
|
4
|
-
export declare type PostValidate = (params:
|
|
3
|
+
export declare type GetProduct = (params: DtoProductParamsWithCidAndLang) => Promise<CfgProductResponse>;
|
|
4
|
+
export declare type PostValidate = (params: DtoProductParamsWithCidAndLang, body: DtoValidateRequest) => Promise<CfgValidateResponse>;
|
|
5
5
|
export declare type ProductLoader = {
|
|
6
6
|
getProduct: GetProduct;
|
|
7
7
|
postValidate: PostValidate;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import { CatalogueAPI, DtoAdditionalProductConfiguration, DtoExportStatus, DtoExportStatusStatus,
|
|
2
|
+
import { CatalogueAPI, DtoAdditionalProductConfiguration, DtoExportStatus, DtoExportStatusStatus, DtoProductParamsWithCidAndLang, DtoRenderStatus, DtoRenderStatusStatus, DtoTargetCameraArgs } from "../CatalogueAPI.js";
|
|
3
3
|
import { CfgProduct } from "../CfgProduct.js";
|
|
4
4
|
import { RenderOrExportFormat } from "./formats.js";
|
|
5
5
|
export declare type TasksChangeNotification = {
|
|
@@ -51,7 +51,7 @@ export declare abstract class Task<F extends RenderOrExportFormat> {
|
|
|
51
51
|
protected constructor(taskHandler: _TaskHandlerInternal, format: F, product: CfgProduct, getPreviewUrl: (() => Promise<string>) | undefined);
|
|
52
52
|
protected abstract postInit(): Promise<DtoRenderStatus | DtoExportStatus>;
|
|
53
53
|
protected abstract pollStatus(): Promise<DtoRenderStatus | DtoExportStatus>;
|
|
54
|
-
protected _productParams:
|
|
54
|
+
protected _productParams: DtoProductParamsWithCidAndLang;
|
|
55
55
|
protected _apiSelection: DtoAdditionalProductConfiguration;
|
|
56
56
|
private _status;
|
|
57
57
|
private _uuid;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoCatalogueParamsWithCidAndLang } from "../../CatalogueAPI.js";
|
|
2
2
|
import { CfgProduct } from "../../CfgProduct.js";
|
|
3
|
-
export declare const dummyCatId:
|
|
3
|
+
export declare const dummyCatId: DtoCatalogueParamsWithCidAndLang;
|
|
4
4
|
export declare const getDummyCfgProduct: () => Promise<CfgProduct>;
|
|
5
5
|
//# sourceMappingURL=dummyProductForTest.d.ts.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { DtoAdditionalProductRef, DtoCatalogueParams,
|
|
1
|
+
import { DtoAdditionalProductRef, DtoCatalogueParams, DtoCatalogueParamsWithCid, DtoCatalogueParamsWithCidAndLang, DtoMeasureParam, DtoModel, DtoOrientation, DtoPartsData, DtoPrices, DtoProductData, DtoProductParamsWithCid, DtoProductParamsWithCidAndLang, DtoProductResponse, DtoSelectedOption, DtoTransform, DtoValidateResponse, DtoVector } from "./CatalogueAPI.js";
|
|
2
2
|
/**
|
|
3
3
|
* Makes a string from the params which can be used as a key in for example React. Language is not respected.
|
|
4
4
|
*/
|
|
5
|
-
export declare const makeCatalogueKey: (cat:
|
|
5
|
+
export declare const makeCatalogueKey: (cat: DtoCatalogueParamsWithCid) => string;
|
|
6
6
|
/**
|
|
7
7
|
* Makes a string from the params which can be used as a key in for example React. Language is not respected.
|
|
8
8
|
*/
|
|
9
|
-
export declare const makeProductKey: (prod:
|
|
9
|
+
export declare const makeProductKey: (prod: DtoProductParamsWithCid) => string;
|
|
10
10
|
/**
|
|
11
11
|
* Makes a string from selected options, can be used as a key for a selection.
|
|
12
12
|
*/
|
|
@@ -27,17 +27,17 @@ export declare type CfgValidateResponse = Omit<DtoValidateResponse, "productData
|
|
|
27
27
|
};
|
|
28
28
|
export declare function isModel(arg: unknown): arg is DtoModel;
|
|
29
29
|
/** Replace empty strings with "-" for compatibility with the API. */
|
|
30
|
-
export declare function correctDefaultsOnCatalogueParams<T extends
|
|
30
|
+
export declare function correctDefaultsOnCatalogueParams<T extends DtoCatalogueParams>(catId: T): T;
|
|
31
31
|
export declare function recursivelyGetPriceCodeValue(priceCodes: string[], prices: DtoPrices | undefined): number | undefined;
|
|
32
32
|
export declare function comparePricesObjects(prices1: DtoPrices | undefined, prices2: DtoPrices | undefined): boolean;
|
|
33
|
-
export declare const decodeCatalogueParams: <T extends
|
|
34
|
-
export declare const decodeProductParams: <T extends
|
|
35
|
-
export declare function isSameCatalogueParams(left:
|
|
33
|
+
export declare const decodeCatalogueParams: <T extends DtoCatalogueParams>(params: T) => T;
|
|
34
|
+
export declare const decodeProductParams: <T extends DtoProductParamsWithCid>(params: T) => T;
|
|
35
|
+
export declare function isSameCatalogueParams(left: DtoCatalogueParams, right: DtoCatalogueParams): boolean;
|
|
36
36
|
export declare function isSameVector(left: DtoVector, right: DtoVector): boolean;
|
|
37
37
|
export declare function isSameOrientation(left: DtoOrientation, right: DtoOrientation): boolean;
|
|
38
38
|
export declare function isSameAnchor(left: DtoMeasureParam, right: DtoMeasureParam): boolean;
|
|
39
39
|
export declare function isSameTransform(left: DtoTransform, right: DtoTransform): boolean;
|
|
40
40
|
export declare function isSameProductRef(left: DtoAdditionalProductRef, right: DtoAdditionalProductRef): boolean;
|
|
41
|
-
export declare const isSameDtoCatalogueParamsWithLang: (left:
|
|
42
|
-
export declare const isSameDtoProductParamsWithLang: (left:
|
|
41
|
+
export declare const isSameDtoCatalogueParamsWithLang: (left: DtoCatalogueParamsWithCidAndLang, right: DtoCatalogueParamsWithCidAndLang) => boolean;
|
|
42
|
+
export declare const isSameDtoProductParamsWithLang: (left: DtoProductParamsWithCidAndLang, right: DtoProductParamsWithCidAndLang) => boolean;
|
|
43
43
|
//# sourceMappingURL=utilitiesCatalogueData.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoCatalogueParamsWithCid, DtoCataloguePermission } from "./CatalogueAPI.js";
|
|
2
2
|
interface CataloguePermissionByEnterpriseKey {
|
|
3
3
|
[key: string]: DtoCataloguePermission[];
|
|
4
4
|
}
|
|
5
5
|
export declare const groupAndSortCataloguePermissions: (cataloguePermissions: DtoCataloguePermission[]) => CataloguePermissionByEnterpriseKey;
|
|
6
6
|
export declare const isParamSet: (param: string | undefined) => boolean;
|
|
7
|
-
export declare const createCataloguePermissionsFilter: (catParams: Partial<
|
|
7
|
+
export declare const createCataloguePermissionsFilter: (catParams: Partial<DtoCatalogueParamsWithCid>) => (perm: DtoCataloguePermission) => boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Sometimes you will want to use the latest available prdCatVersion. This method will
|
|
10
10
|
* find the highest prdCatVersion version in the cataloguePermissions. If the versions are
|
|
@@ -25,7 +25,7 @@ export declare const getPrdCatVersionFromPermissions: (cataloguePermissions: Dto
|
|
|
25
25
|
* @param auth
|
|
26
26
|
* @param params
|
|
27
27
|
*/
|
|
28
|
-
export declare const getPrdCatVersionOrLatestFromPermissions: (params:
|
|
28
|
+
export declare const getPrdCatVersionOrLatestFromPermissions: (params: DtoCatalogueParamsWithCid, cataloguePermissions: DtoCataloguePermission[]) => string;
|
|
29
29
|
/**
|
|
30
30
|
* Sometimes you will want a missing prdCatVersion to represent "Get the current highest version".
|
|
31
31
|
* This method will, if the prdCatVersion is not set, fetch the highest available from the
|
|
@@ -34,6 +34,6 @@ export declare const getPrdCatVersionOrLatestFromPermissions: (params: DtoCatalo
|
|
|
34
34
|
* @param auth
|
|
35
35
|
* @param params
|
|
36
36
|
*/
|
|
37
|
-
export declare const fillMissingPrdCatVersionFromPermissions: <T extends
|
|
37
|
+
export declare const fillMissingPrdCatVersionFromPermissions: <T extends DtoCatalogueParamsWithCid>(params: T, cataloguePermissions: DtoCataloguePermission[]) => T;
|
|
38
38
|
export {};
|
|
39
39
|
//# sourceMappingURL=utilitiesCataloguePermission.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configura/web-api",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.19",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@configura/web-utilities": "2.0.0-alpha.
|
|
26
|
+
"@configura/web-utilities": "2.0.0-alpha.19"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "cabb223e0e55c63991c09f652d446e98b0546bf8"
|
|
29
29
|
}
|