@configura/web-api 2.0.0-alpha.0 → 2.0.0-alpha.3
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 +18 -18
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/CatalogueAPI.d.ts +551 -551
- package/dist/CatalogueAPI.js +293 -293
- package/dist/CfgMeasure.d.ts +32 -32
- package/dist/CfgMeasure.js +30 -30
- package/dist/CfgProduct.d.ts +268 -268
- package/dist/CfgProduct.js +778 -778
- package/dist/CfgReferencePathHelper.d.ts +13 -13
- package/dist/CfgReferencePathHelper.js +13 -13
- package/dist/ConfigurationConverter.d.ts +4 -4
- package/dist/ConfigurationConverter.js +72 -72
- package/dist/index.d.ts +23 -23
- package/dist/index.js +23 -23
- package/dist/io/CfgHistoryManager.d.ts +50 -50
- package/dist/io/CfgHistoryManager.js +82 -82
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +20 -20
- package/dist/io/CfgHistoryToProdConfConnector.js +56 -56
- package/dist/io/CfgIOManager.d.ts +48 -48
- package/dist/io/CfgIOManager.js +115 -115
- package/dist/io/CfgIOProdConfConnector.d.ts +52 -52
- package/dist/io/CfgIOProdConfConnector.js +141 -141
- package/dist/io/CfgObservableStateManager.d.ts +21 -21
- package/dist/io/CfgObservableStateManager.js +65 -65
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +14 -14
- package/dist/io/CfgObservableStateToProdConfConnector.js +16 -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 +84 -84
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +16 -16
- package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -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 +187 -187
- package/dist/productConfiguration/CfgFeature.js +645 -645
- package/dist/productConfiguration/CfgOption.d.ts +151 -151
- package/dist/productConfiguration/CfgOption.js +416 -416
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +117 -117
- package/dist/productConfiguration/CfgProductConfiguration.js +307 -307
- package/dist/productConfiguration/filters.d.ts +15 -15
- package/dist/productConfiguration/filters.js +70 -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 +80 -80
- 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 +40 -40
- package/dist/syncGroups/SyncGroupsHandler.js +359 -359
- package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
- package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
- package/dist/syncGroups/SyncGroupsState.d.ts +35 -35
- package/dist/syncGroups/SyncGroupsState.js +125 -125
- package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
- package/dist/syncGroups/SyncGroupsTransaction.js +576 -576
- package/dist/tasks/TaskHandler.d.ts +77 -77
- package/dist/tasks/TaskHandler.js +275 -275
- 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 +277 -277
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
- package/dist/tests/testData/testDataCachedGetProduct.js +185 -185
- package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
- package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
- 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 +187 -187
- package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
- package/dist/tests/testData/testDataUpcharge.js +119 -119
- package/dist/utilitiesCatalogueData.d.ts +42 -33
- package/dist/utilitiesCatalogueData.js +173 -164
- package/dist/utilitiesCataloguePermission.d.ts +38 -32
- package/dist/utilitiesCataloguePermission.js +79 -76
- package/dist/utilitiesNumericValues.d.ts +24 -24
- package/dist/utilitiesNumericValues.js +109 -109
- package/package.json +3 -3
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { DtoCatalogueParamsWithLang, DtoProductParamsWithLang } from "./CatalogueAPI";
|
|
2
|
-
/**
|
|
3
|
-
* These methods aims to provide a default suggested way of building
|
|
4
|
-
* URLs to Products and Catalogues. By using consistent URL:s copy-paste
|
|
5
|
-
* between systems becomes easy and this can aid when debugging.
|
|
6
|
-
* Using this format on URL is no requirement. In fact, most of our
|
|
7
|
-
* integrators do not, as they do not expose the Catalogue-path.
|
|
8
|
-
* Internally at Configura we try to stick with this format.
|
|
9
|
-
*/
|
|
10
|
-
export declare class CfgReferencePathHelper {
|
|
11
|
-
static getCataloguePath: (browsingRootUrl: string, catParams: DtoCatalogueParamsWithLang) => string;
|
|
12
|
-
static getProductPath: (browsingRootUrl: string, productParams: DtoProductParamsWithLang) => string;
|
|
13
|
-
}
|
|
1
|
+
import { DtoCatalogueParamsWithLang, DtoProductParamsWithLang } from "./CatalogueAPI";
|
|
2
|
+
/**
|
|
3
|
+
* These methods aims to provide a default suggested way of building
|
|
4
|
+
* URLs to Products and Catalogues. By using consistent URL:s copy-paste
|
|
5
|
+
* between systems becomes easy and this can aid when debugging.
|
|
6
|
+
* Using this format on URL is no requirement. In fact, most of our
|
|
7
|
+
* integrators do not, as they do not expose the Catalogue-path.
|
|
8
|
+
* Internally at Configura we try to stick with this format.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CfgReferencePathHelper {
|
|
11
|
+
static getCataloguePath: (browsingRootUrl: string, catParams: DtoCatalogueParamsWithLang) => string;
|
|
12
|
+
static getProductPath: (browsingRootUrl: string, productParams: DtoProductParamsWithLang) => string;
|
|
13
|
+
}
|
|
14
14
|
//# sourceMappingURL=CfgReferencePathHelper.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { encodeURIComponents } from "@configura/web-utilities";
|
|
2
|
-
/**
|
|
3
|
-
* These methods aims to provide a default suggested way of building
|
|
4
|
-
* URLs to Products and Catalogues. By using consistent URL:s copy-paste
|
|
5
|
-
* between systems becomes easy and this can aid when debugging.
|
|
6
|
-
* Using this format on URL is no requirement. In fact, most of our
|
|
7
|
-
* integrators do not, as they do not expose the Catalogue-path.
|
|
8
|
-
* Internally at Configura we try to stick with this format.
|
|
9
|
-
*/
|
|
10
|
-
export class CfgReferencePathHelper {
|
|
11
|
-
}
|
|
12
|
-
CfgReferencePathHelper.getCataloguePath = (browsingRootUrl, catParams) => `${browsingRootUrl}/${encodeURIComponents(catParams.cid, catParams.lang, catParams.enterprise, catParams.prdCat, catParams.prdCatVersion, catParams.vendor, catParams.priceList)}`;
|
|
13
|
-
CfgReferencePathHelper.getProductPath = (browsingRootUrl, productParams) => `${CfgReferencePathHelper.getCataloguePath(browsingRootUrl, productParams)}/product/${encodeURIComponent(productParams.partNumber)}`;
|
|
1
|
+
import { encodeURIComponents } from "@configura/web-utilities";
|
|
2
|
+
/**
|
|
3
|
+
* These methods aims to provide a default suggested way of building
|
|
4
|
+
* URLs to Products and Catalogues. By using consistent URL:s copy-paste
|
|
5
|
+
* between systems becomes easy and this can aid when debugging.
|
|
6
|
+
* Using this format on URL is no requirement. In fact, most of our
|
|
7
|
+
* integrators do not, as they do not expose the Catalogue-path.
|
|
8
|
+
* Internally at Configura we try to stick with this format.
|
|
9
|
+
*/
|
|
10
|
+
export class CfgReferencePathHelper {
|
|
11
|
+
}
|
|
12
|
+
CfgReferencePathHelper.getCataloguePath = (browsingRootUrl, catParams) => `${browsingRootUrl}/${encodeURIComponents(catParams.cid, catParams.lang, catParams.enterprise, catParams.prdCat, catParams.prdCatVersion, catParams.vendor, catParams.priceList)}`;
|
|
13
|
+
CfgReferencePathHelper.getProductPath = (browsingRootUrl, productParams) => `${CfgReferencePathHelper.getCataloguePath(browsingRootUrl, productParams)}/product/${encodeURIComponent(productParams.partNumber)}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DtoAdditionalProductConfiguration, DtoConfAddProd, DtoConfFeature, DtoConfProd, DtoSelectedOption } from "./CatalogueAPI.js";
|
|
2
|
-
export declare const isDtoConfProdAdditional: (value: DtoConfProd) => value is DtoConfAddProd;
|
|
3
|
-
export declare const convertDtoConfProdToV1: (conf: DtoConfProd, silenceWarnings?: boolean) => DtoAdditionalProductConfiguration;
|
|
4
|
-
export declare const convertDtoConfFeaturesToSelOptions: (features: DtoConfFeature[], silenceWarnings?: boolean) => DtoSelectedOption[];
|
|
1
|
+
import { DtoAdditionalProductConfiguration, DtoConfAddProd, DtoConfFeature, DtoConfProd, DtoSelectedOption } from "./CatalogueAPI.js";
|
|
2
|
+
export declare const isDtoConfProdAdditional: (value: DtoConfProd) => value is DtoConfAddProd;
|
|
3
|
+
export declare const convertDtoConfProdToV1: (conf: DtoConfProd, silenceWarnings?: boolean) => DtoAdditionalProductConfiguration;
|
|
4
|
+
export declare const convertDtoConfFeaturesToSelOptions: (features: DtoConfFeature[], silenceWarnings?: boolean) => DtoSelectedOption[];
|
|
5
5
|
//# sourceMappingURL=ConfigurationConverter.d.ts.map
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
export const isDtoConfProdAdditional = (value) => "refKey" in value;
|
|
2
|
-
// As this has potential to flood the terminal we only inform once
|
|
3
|
-
let hasInformedAboutProdParams = false;
|
|
4
|
-
let hasInformedAboutGroupCode = false;
|
|
5
|
-
let hasInformedAboutUnit = false;
|
|
6
|
-
export const convertDtoConfProdToV1 = (conf, silenceWarnings = false) => {
|
|
7
|
-
var _a, _b;
|
|
8
|
-
if (!silenceWarnings && conf.prodParams !== undefined && !hasInformedAboutProdParams) {
|
|
9
|
-
hasInformedAboutProdParams = true;
|
|
10
|
-
console.info("Incoming DtoProductConfiguration contains prodParams. These will be ignored.");
|
|
11
|
-
}
|
|
12
|
-
const result = {
|
|
13
|
-
selOptions: ((_a = conf.features) !== null && _a !== void 0 ? _a : []).map((f) => ({
|
|
14
|
-
code: "!~!",
|
|
15
|
-
next: convertDtoConfFeatureToApiSelection(f, silenceWarnings),
|
|
16
|
-
})),
|
|
17
|
-
additionalProducts: ((_b = conf.additionalProducts) !== null && _b !== void 0 ? _b : []).map((p) => convertDtoConfProdToV1(p, silenceWarnings)),
|
|
18
|
-
selected: true,
|
|
19
|
-
};
|
|
20
|
-
if (isDtoConfProdAdditional(conf)) {
|
|
21
|
-
result.refKey = conf.refKey;
|
|
22
|
-
result.selected = conf.selected;
|
|
23
|
-
}
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
export const convertDtoConfFeaturesToSelOptions = (features, silenceWarnings = false) => (features !== null && features !== void 0 ? features : []).map((f) => ({
|
|
27
|
-
code: "!~!",
|
|
28
|
-
next: convertDtoConfFeatureToApiSelection(f, silenceWarnings),
|
|
29
|
-
}));
|
|
30
|
-
const convertDtoConfFeatureToApiSelection = (feature, silenceWarnings) => {
|
|
31
|
-
const { groupCode, options, unit } = feature;
|
|
32
|
-
if (!silenceWarnings && groupCode !== undefined && !hasInformedAboutGroupCode) {
|
|
33
|
-
hasInformedAboutGroupCode = true;
|
|
34
|
-
console.info("Incoming DtoFeature contains groupCode. It will be ignored.");
|
|
35
|
-
}
|
|
36
|
-
if (!silenceWarnings && unit !== undefined && !hasInformedAboutUnit) {
|
|
37
|
-
hasInformedAboutUnit = true;
|
|
38
|
-
console.info("Incoming DtoFeature contains a unit. It will be ignored.");
|
|
39
|
-
}
|
|
40
|
-
const result = {};
|
|
41
|
-
for (const option of (options !== null && options !== void 0 ? options : []).filter((o) => o.selected)) {
|
|
42
|
-
result[option.code] = convertDtoConfOptionToSelectedOption(option, silenceWarnings);
|
|
43
|
-
}
|
|
44
|
-
return result;
|
|
45
|
-
};
|
|
46
|
-
const convertDtoConfOptionToSelectedOption = (option, silenceWarnings) => {
|
|
47
|
-
const { features, code, numericValue } = option;
|
|
48
|
-
const selectionTrees = (features !== null && features !== void 0 ? features : []).map((f) => convertDtoConfFeatureToApiSelection(f, silenceWarnings));
|
|
49
|
-
const mergedSelectionTree = {};
|
|
50
|
-
let anyItems = false;
|
|
51
|
-
for (const selectionTree of selectionTrees) {
|
|
52
|
-
if (selectionTree === undefined) {
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
for (const key of Object.keys(selectionTree)) {
|
|
56
|
-
if (mergedSelectionTree[key] !== undefined) {
|
|
57
|
-
console.warn(`The key (${key}) is already used in the selection tree. Option code: "${code}".`);
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
mergedSelectionTree[key] = selectionTree[key];
|
|
61
|
-
anyItems = true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const selectedOption = {
|
|
65
|
-
code,
|
|
66
|
-
numericValue,
|
|
67
|
-
};
|
|
68
|
-
if (anyItems) {
|
|
69
|
-
selectedOption.next = mergedSelectionTree;
|
|
70
|
-
}
|
|
71
|
-
return selectedOption;
|
|
72
|
-
};
|
|
1
|
+
export const isDtoConfProdAdditional = (value) => "refKey" in value;
|
|
2
|
+
// As this has potential to flood the terminal we only inform once
|
|
3
|
+
let hasInformedAboutProdParams = false;
|
|
4
|
+
let hasInformedAboutGroupCode = false;
|
|
5
|
+
let hasInformedAboutUnit = false;
|
|
6
|
+
export const convertDtoConfProdToV1 = (conf, silenceWarnings = false) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
if (!silenceWarnings && conf.prodParams !== undefined && !hasInformedAboutProdParams) {
|
|
9
|
+
hasInformedAboutProdParams = true;
|
|
10
|
+
console.info("Incoming DtoProductConfiguration contains prodParams. These will be ignored.");
|
|
11
|
+
}
|
|
12
|
+
const result = {
|
|
13
|
+
selOptions: ((_a = conf.features) !== null && _a !== void 0 ? _a : []).map((f) => ({
|
|
14
|
+
code: "!~!",
|
|
15
|
+
next: convertDtoConfFeatureToApiSelection(f, silenceWarnings),
|
|
16
|
+
})),
|
|
17
|
+
additionalProducts: ((_b = conf.additionalProducts) !== null && _b !== void 0 ? _b : []).map((p) => convertDtoConfProdToV1(p, silenceWarnings)),
|
|
18
|
+
selected: true,
|
|
19
|
+
};
|
|
20
|
+
if (isDtoConfProdAdditional(conf)) {
|
|
21
|
+
result.refKey = conf.refKey;
|
|
22
|
+
result.selected = conf.selected;
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
export const convertDtoConfFeaturesToSelOptions = (features, silenceWarnings = false) => (features !== null && features !== void 0 ? features : []).map((f) => ({
|
|
27
|
+
code: "!~!",
|
|
28
|
+
next: convertDtoConfFeatureToApiSelection(f, silenceWarnings),
|
|
29
|
+
}));
|
|
30
|
+
const convertDtoConfFeatureToApiSelection = (feature, silenceWarnings) => {
|
|
31
|
+
const { groupCode, options, unit } = feature;
|
|
32
|
+
if (!silenceWarnings && groupCode !== undefined && !hasInformedAboutGroupCode) {
|
|
33
|
+
hasInformedAboutGroupCode = true;
|
|
34
|
+
console.info("Incoming DtoFeature contains groupCode. It will be ignored.");
|
|
35
|
+
}
|
|
36
|
+
if (!silenceWarnings && unit !== undefined && !hasInformedAboutUnit) {
|
|
37
|
+
hasInformedAboutUnit = true;
|
|
38
|
+
console.info("Incoming DtoFeature contains a unit. It will be ignored.");
|
|
39
|
+
}
|
|
40
|
+
const result = {};
|
|
41
|
+
for (const option of (options !== null && options !== void 0 ? options : []).filter((o) => o.selected)) {
|
|
42
|
+
result[option.code] = convertDtoConfOptionToSelectedOption(option, silenceWarnings);
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
const convertDtoConfOptionToSelectedOption = (option, silenceWarnings) => {
|
|
47
|
+
const { features, code, numericValue } = option;
|
|
48
|
+
const selectionTrees = (features !== null && features !== void 0 ? features : []).map((f) => convertDtoConfFeatureToApiSelection(f, silenceWarnings));
|
|
49
|
+
const mergedSelectionTree = {};
|
|
50
|
+
let anyItems = false;
|
|
51
|
+
for (const selectionTree of selectionTrees) {
|
|
52
|
+
if (selectionTree === undefined) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
for (const key of Object.keys(selectionTree)) {
|
|
56
|
+
if (mergedSelectionTree[key] !== undefined) {
|
|
57
|
+
console.warn(`The key (${key}) is already used in the selection tree. Option code: "${code}".`);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
mergedSelectionTree[key] = selectionTree[key];
|
|
61
|
+
anyItems = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const selectedOption = {
|
|
65
|
+
code,
|
|
66
|
+
numericValue,
|
|
67
|
+
};
|
|
68
|
+
if (anyItems) {
|
|
69
|
+
selectedOption.next = mergedSelectionTree;
|
|
70
|
+
}
|
|
71
|
+
return selectedOption;
|
|
72
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export * from "./CatalogueAPI.js";
|
|
2
|
-
export * from "./CfgProduct.js";
|
|
3
|
-
export * from "./CfgReferencePathHelper.js";
|
|
4
|
-
export * from "./ConfigurationConverter.js";
|
|
5
|
-
export * from "./io/index.js";
|
|
6
|
-
export * from "./material/CfgMaterialMapping.js";
|
|
7
|
-
export * from "./material/CfgMtrlApplication.js";
|
|
8
|
-
export * from "./material/CfgMtrlApplicationSource.js";
|
|
9
|
-
export * from "./material/CfgMtrlSource.js";
|
|
10
|
-
export * from "./material/CfgMtrlSourceWithMetaData.js";
|
|
11
|
-
export * from "./productConfiguration/CfgFeature.js";
|
|
12
|
-
export * from "./productConfiguration/CfgOption.js";
|
|
13
|
-
export * from "./productConfiguration/CfgProductConfiguration.js";
|
|
14
|
-
export * from "./productConfiguration/filters.js";
|
|
15
|
-
export * from "./productConfiguration/productParamsGenerator.js";
|
|
16
|
-
export * from "./productLoader.js";
|
|
17
|
-
export * from "./syncGroups/SyncGroupsApplyMode.js";
|
|
18
|
-
export * from "./syncGroups/SyncGroupsHandler.js";
|
|
19
|
-
export * from "./tasks/formats.js";
|
|
20
|
-
export * from "./tasks/TaskHandler.js";
|
|
21
|
-
export * from "./utilitiesCatalogueData.js";
|
|
22
|
-
export * from "./utilitiesCataloguePermission.js";
|
|
23
|
-
export * from "./utilitiesNumericValues.js";
|
|
1
|
+
export * from "./CatalogueAPI.js";
|
|
2
|
+
export * from "./CfgProduct.js";
|
|
3
|
+
export * from "./CfgReferencePathHelper.js";
|
|
4
|
+
export * from "./ConfigurationConverter.js";
|
|
5
|
+
export * from "./io/index.js";
|
|
6
|
+
export * from "./material/CfgMaterialMapping.js";
|
|
7
|
+
export * from "./material/CfgMtrlApplication.js";
|
|
8
|
+
export * from "./material/CfgMtrlApplicationSource.js";
|
|
9
|
+
export * from "./material/CfgMtrlSource.js";
|
|
10
|
+
export * from "./material/CfgMtrlSourceWithMetaData.js";
|
|
11
|
+
export * from "./productConfiguration/CfgFeature.js";
|
|
12
|
+
export * from "./productConfiguration/CfgOption.js";
|
|
13
|
+
export * from "./productConfiguration/CfgProductConfiguration.js";
|
|
14
|
+
export * from "./productConfiguration/filters.js";
|
|
15
|
+
export * from "./productConfiguration/productParamsGenerator.js";
|
|
16
|
+
export * from "./productLoader.js";
|
|
17
|
+
export * from "./syncGroups/SyncGroupsApplyMode.js";
|
|
18
|
+
export * from "./syncGroups/SyncGroupsHandler.js";
|
|
19
|
+
export * from "./tasks/formats.js";
|
|
20
|
+
export * from "./tasks/TaskHandler.js";
|
|
21
|
+
export * from "./utilitiesCatalogueData.js";
|
|
22
|
+
export * from "./utilitiesCataloguePermission.js";
|
|
23
|
+
export * from "./utilitiesNumericValues.js";
|
|
24
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export * from "./CatalogueAPI.js";
|
|
2
|
-
export * from "./CfgProduct.js";
|
|
3
|
-
export * from "./CfgReferencePathHelper.js";
|
|
4
|
-
export * from "./ConfigurationConverter.js";
|
|
5
|
-
export * from "./io/index.js";
|
|
6
|
-
export * from "./material/CfgMaterialMapping.js";
|
|
7
|
-
export * from "./material/CfgMtrlApplication.js";
|
|
8
|
-
export * from "./material/CfgMtrlApplicationSource.js";
|
|
9
|
-
export * from "./material/CfgMtrlSource.js";
|
|
10
|
-
export * from "./material/CfgMtrlSourceWithMetaData.js";
|
|
11
|
-
export * from "./productConfiguration/CfgFeature.js";
|
|
12
|
-
export * from "./productConfiguration/CfgOption.js";
|
|
13
|
-
export * from "./productConfiguration/CfgProductConfiguration.js";
|
|
14
|
-
export * from "./productConfiguration/filters.js";
|
|
15
|
-
export * from "./productConfiguration/productParamsGenerator.js";
|
|
16
|
-
export * from "./productLoader.js";
|
|
17
|
-
export * from "./syncGroups/SyncGroupsApplyMode.js";
|
|
18
|
-
export * from "./syncGroups/SyncGroupsHandler.js";
|
|
19
|
-
export * from "./tasks/formats.js";
|
|
20
|
-
export * from "./tasks/TaskHandler.js";
|
|
21
|
-
export * from "./utilitiesCatalogueData.js";
|
|
22
|
-
export * from "./utilitiesCataloguePermission.js";
|
|
23
|
-
export * from "./utilitiesNumericValues.js";
|
|
1
|
+
export * from "./CatalogueAPI.js";
|
|
2
|
+
export * from "./CfgProduct.js";
|
|
3
|
+
export * from "./CfgReferencePathHelper.js";
|
|
4
|
+
export * from "./ConfigurationConverter.js";
|
|
5
|
+
export * from "./io/index.js";
|
|
6
|
+
export * from "./material/CfgMaterialMapping.js";
|
|
7
|
+
export * from "./material/CfgMtrlApplication.js";
|
|
8
|
+
export * from "./material/CfgMtrlApplicationSource.js";
|
|
9
|
+
export * from "./material/CfgMtrlSource.js";
|
|
10
|
+
export * from "./material/CfgMtrlSourceWithMetaData.js";
|
|
11
|
+
export * from "./productConfiguration/CfgFeature.js";
|
|
12
|
+
export * from "./productConfiguration/CfgOption.js";
|
|
13
|
+
export * from "./productConfiguration/CfgProductConfiguration.js";
|
|
14
|
+
export * from "./productConfiguration/filters.js";
|
|
15
|
+
export * from "./productConfiguration/productParamsGenerator.js";
|
|
16
|
+
export * from "./productLoader.js";
|
|
17
|
+
export * from "./syncGroups/SyncGroupsApplyMode.js";
|
|
18
|
+
export * from "./syncGroups/SyncGroupsHandler.js";
|
|
19
|
+
export * from "./tasks/formats.js";
|
|
20
|
+
export * from "./tasks/TaskHandler.js";
|
|
21
|
+
export * from "./utilitiesCatalogueData.js";
|
|
22
|
+
export * from "./utilitiesCataloguePermission.js";
|
|
23
|
+
export * from "./utilitiesNumericValues.js";
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { CfgWindowEventManager } from "./CfgWindowEventManager.js";
|
|
2
|
-
declare type CfgHistoryManagerMessageData = {
|
|
3
|
-
initial: boolean;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* The collected data used when sending. For history this both contains the message, which is
|
|
7
|
-
* used as the "state" in the history-frame, and the qsKeyValues, which are used in the URL.
|
|
8
|
-
* When navigating back and forth the stage (message) is used to restore the old state. When
|
|
9
|
-
* opening a window with no prior history the Query String will be used.
|
|
10
|
-
*/
|
|
11
|
-
export declare type CfgHistoryManagerSendData<D> = {
|
|
12
|
-
message: D;
|
|
13
|
-
useHistoryPush: boolean;
|
|
14
|
-
qsKeyValues: Map<string, string | undefined>;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* This class does nothing on it's own. It is used to coordinate writing to the history, that
|
|
18
|
-
* is, updating the browsing history.
|
|
19
|
-
*/
|
|
20
|
-
export declare class CfgHistoryManager extends CfgWindowEventManager<"popstate", CfgHistoryManagerSendData<CfgHistoryManagerMessageData>> {
|
|
21
|
-
private static _instance;
|
|
22
|
-
static get instance(): CfgHistoryManager;
|
|
23
|
-
private constructor();
|
|
24
|
-
/**
|
|
25
|
-
* Write to the history
|
|
26
|
-
*/
|
|
27
|
-
send(messageKey: string, data: CfgHistoryManagerSendData<CfgHistoryManagerMessageData>): void;
|
|
28
|
-
/**
|
|
29
|
-
* Takes the current in browser URL and updates it with the provided Query String values.
|
|
30
|
-
* Old Query String is replaced.
|
|
31
|
-
*/
|
|
32
|
-
private static _makeUpdatedUrl;
|
|
33
|
-
/**
|
|
34
|
-
* Returns the current in browser Query String updated with the key values provided.
|
|
35
|
-
* If a value is undefined in the passed map it will be deleted from the Query String.
|
|
36
|
-
*/
|
|
37
|
-
private static _makeUpdatedQueryString;
|
|
38
|
-
/**
|
|
39
|
-
* @returns The current in browser Query String as a Map
|
|
40
|
-
*/
|
|
41
|
-
static currentQsKeyValues(): Map<string, string>;
|
|
42
|
-
/**
|
|
43
|
-
* If the passed currentState is a CfgIOContainer it will update it with the
|
|
44
|
-
* passed message. If not it will create a new CfgIOContainer with the message.
|
|
45
|
-
*/
|
|
46
|
-
private static _makeUpdatedState;
|
|
47
|
-
protected readonly eventType = "popstate";
|
|
48
|
-
protected getDataFromEvent(event: PopStateEvent): unknown;
|
|
49
|
-
}
|
|
50
|
-
export {};
|
|
1
|
+
import { CfgWindowEventManager } from "./CfgWindowEventManager.js";
|
|
2
|
+
declare type CfgHistoryManagerMessageData = {
|
|
3
|
+
initial: boolean;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The collected data used when sending. For history this both contains the message, which is
|
|
7
|
+
* used as the "state" in the history-frame, and the qsKeyValues, which are used in the URL.
|
|
8
|
+
* When navigating back and forth the stage (message) is used to restore the old state. When
|
|
9
|
+
* opening a window with no prior history the Query String will be used.
|
|
10
|
+
*/
|
|
11
|
+
export declare type CfgHistoryManagerSendData<D> = {
|
|
12
|
+
message: D;
|
|
13
|
+
useHistoryPush: boolean;
|
|
14
|
+
qsKeyValues: Map<string, string | undefined>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* This class does nothing on it's own. It is used to coordinate writing to the history, that
|
|
18
|
+
* is, updating the browsing history.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CfgHistoryManager extends CfgWindowEventManager<"popstate", CfgHistoryManagerSendData<CfgHistoryManagerMessageData>> {
|
|
21
|
+
private static _instance;
|
|
22
|
+
static get instance(): CfgHistoryManager;
|
|
23
|
+
private constructor();
|
|
24
|
+
/**
|
|
25
|
+
* Write to the history
|
|
26
|
+
*/
|
|
27
|
+
send(messageKey: string, data: CfgHistoryManagerSendData<CfgHistoryManagerMessageData>): void;
|
|
28
|
+
/**
|
|
29
|
+
* Takes the current in browser URL and updates it with the provided Query String values.
|
|
30
|
+
* Old Query String is replaced.
|
|
31
|
+
*/
|
|
32
|
+
private static _makeUpdatedUrl;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the current in browser Query String updated with the key values provided.
|
|
35
|
+
* If a value is undefined in the passed map it will be deleted from the Query String.
|
|
36
|
+
*/
|
|
37
|
+
private static _makeUpdatedQueryString;
|
|
38
|
+
/**
|
|
39
|
+
* @returns The current in browser Query String as a Map
|
|
40
|
+
*/
|
|
41
|
+
static currentQsKeyValues(): Map<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* If the passed currentState is a CfgIOContainer it will update it with the
|
|
44
|
+
* passed message. If not it will create a new CfgIOContainer with the message.
|
|
45
|
+
*/
|
|
46
|
+
private static _makeUpdatedState;
|
|
47
|
+
protected readonly eventType = "popstate";
|
|
48
|
+
protected getDataFromEvent(event: PopStateEvent): unknown;
|
|
49
|
+
}
|
|
50
|
+
export {};
|
|
51
51
|
//# sourceMappingURL=CfgHistoryManager.d.ts.map
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { mapQueryString, unmapQueryString } from "@configura/web-utilities";
|
|
2
|
-
import { CfgIOManager } from "./CfgIOManager.js";
|
|
3
|
-
import { CfgWindowEventManager } from "./CfgWindowEventManager.js";
|
|
4
|
-
/**
|
|
5
|
-
* This class does nothing on it's own. It is used to coordinate writing to the history, that
|
|
6
|
-
* is, updating the browsing history.
|
|
7
|
-
*/
|
|
8
|
-
export class CfgHistoryManager extends CfgWindowEventManager {
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this.eventType = "popstate";
|
|
12
|
-
}
|
|
13
|
-
static get instance() {
|
|
14
|
-
if (this._instance === undefined) {
|
|
15
|
-
this._instance = new CfgHistoryManager();
|
|
16
|
-
}
|
|
17
|
-
return this._instance;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Write to the history
|
|
21
|
-
*/
|
|
22
|
-
send(messageKey, data) {
|
|
23
|
-
const { qsKeyValues, message, useHistoryPush } = data;
|
|
24
|
-
// Initial data is before user interaction has happened
|
|
25
|
-
const initial = message.initial;
|
|
26
|
-
// At initial we do not replace the URL as we presumable have the defaults
|
|
27
|
-
const newUrl = initial ? null : CfgHistoryManager._makeUpdatedUrl(qsKeyValues);
|
|
28
|
-
// ...but we do replace the state so that we can in the future browse back to here
|
|
29
|
-
const newState = CfgHistoryManager._makeUpdatedState(window.history.state, message, messageKey);
|
|
30
|
-
if (initial || !useHistoryPush || this.receiveInProgress) {
|
|
31
|
-
window.history.replaceState(newState, "", newUrl);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
window.history.pushState(newState, "", newUrl);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Takes the current in browser URL and updates it with the provided Query String values.
|
|
39
|
-
* Old Query String is replaced.
|
|
40
|
-
*/
|
|
41
|
-
static _makeUpdatedUrl(qsKeyValues) {
|
|
42
|
-
const qs = this._makeUpdatedQueryString(qsKeyValues);
|
|
43
|
-
return `${window.location.origin}${window.location.pathname}${qs ? "?" : ""}${qs}${window.location.hash}`;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Returns the current in browser Query String updated with the key values provided.
|
|
47
|
-
* If a value is undefined in the passed map it will be deleted from the Query String.
|
|
48
|
-
*/
|
|
49
|
-
static _makeUpdatedQueryString(qsKeyValues) {
|
|
50
|
-
const currentKeyValues = this.currentQsKeyValues();
|
|
51
|
-
for (const [key, value] of qsKeyValues) {
|
|
52
|
-
if (value === undefined) {
|
|
53
|
-
currentKeyValues.delete(key);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
currentKeyValues.set(key, value);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return unmapQueryString(currentKeyValues);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* @returns The current in browser Query String as a Map
|
|
63
|
-
*/
|
|
64
|
-
static currentQsKeyValues() {
|
|
65
|
-
return mapQueryString(window.location.search);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* If the passed currentState is a CfgIOContainer it will update it with the
|
|
69
|
-
* passed message. If not it will create a new CfgIOContainer with the message.
|
|
70
|
-
*/
|
|
71
|
-
static _makeUpdatedState(currentState, message, messageKey) {
|
|
72
|
-
let messages = {};
|
|
73
|
-
if (CfgIOManager.isIOContainer(currentState)) {
|
|
74
|
-
messages = currentState.messages;
|
|
75
|
-
}
|
|
76
|
-
messages[messageKey] = message;
|
|
77
|
-
return CfgIOManager.makeContainer(messages);
|
|
78
|
-
}
|
|
79
|
-
getDataFromEvent(event) {
|
|
80
|
-
return event.state;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
1
|
+
import { mapQueryString, unmapQueryString } from "@configura/web-utilities";
|
|
2
|
+
import { CfgIOManager } from "./CfgIOManager.js";
|
|
3
|
+
import { CfgWindowEventManager } from "./CfgWindowEventManager.js";
|
|
4
|
+
/**
|
|
5
|
+
* This class does nothing on it's own. It is used to coordinate writing to the history, that
|
|
6
|
+
* is, updating the browsing history.
|
|
7
|
+
*/
|
|
8
|
+
export class CfgHistoryManager extends CfgWindowEventManager {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.eventType = "popstate";
|
|
12
|
+
}
|
|
13
|
+
static get instance() {
|
|
14
|
+
if (this._instance === undefined) {
|
|
15
|
+
this._instance = new CfgHistoryManager();
|
|
16
|
+
}
|
|
17
|
+
return this._instance;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Write to the history
|
|
21
|
+
*/
|
|
22
|
+
send(messageKey, data) {
|
|
23
|
+
const { qsKeyValues, message, useHistoryPush } = data;
|
|
24
|
+
// Initial data is before user interaction has happened
|
|
25
|
+
const initial = message.initial;
|
|
26
|
+
// At initial we do not replace the URL as we presumable have the defaults
|
|
27
|
+
const newUrl = initial ? null : CfgHistoryManager._makeUpdatedUrl(qsKeyValues);
|
|
28
|
+
// ...but we do replace the state so that we can in the future browse back to here
|
|
29
|
+
const newState = CfgHistoryManager._makeUpdatedState(window.history.state, message, messageKey);
|
|
30
|
+
if (initial || !useHistoryPush || this.receiveInProgress) {
|
|
31
|
+
window.history.replaceState(newState, "", newUrl);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
window.history.pushState(newState, "", newUrl);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Takes the current in browser URL and updates it with the provided Query String values.
|
|
39
|
+
* Old Query String is replaced.
|
|
40
|
+
*/
|
|
41
|
+
static _makeUpdatedUrl(qsKeyValues) {
|
|
42
|
+
const qs = this._makeUpdatedQueryString(qsKeyValues);
|
|
43
|
+
return `${window.location.origin}${window.location.pathname}${qs ? "?" : ""}${qs}${window.location.hash}`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns the current in browser Query String updated with the key values provided.
|
|
47
|
+
* If a value is undefined in the passed map it will be deleted from the Query String.
|
|
48
|
+
*/
|
|
49
|
+
static _makeUpdatedQueryString(qsKeyValues) {
|
|
50
|
+
const currentKeyValues = this.currentQsKeyValues();
|
|
51
|
+
for (const [key, value] of qsKeyValues) {
|
|
52
|
+
if (value === undefined) {
|
|
53
|
+
currentKeyValues.delete(key);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
currentKeyValues.set(key, value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return unmapQueryString(currentKeyValues);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @returns The current in browser Query String as a Map
|
|
63
|
+
*/
|
|
64
|
+
static currentQsKeyValues() {
|
|
65
|
+
return mapQueryString(window.location.search);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* If the passed currentState is a CfgIOContainer it will update it with the
|
|
69
|
+
* passed message. If not it will create a new CfgIOContainer with the message.
|
|
70
|
+
*/
|
|
71
|
+
static _makeUpdatedState(currentState, message, messageKey) {
|
|
72
|
+
let messages = {};
|
|
73
|
+
if (CfgIOManager.isIOContainer(currentState)) {
|
|
74
|
+
messages = currentState.messages;
|
|
75
|
+
}
|
|
76
|
+
messages[messageKey] = message;
|
|
77
|
+
return CfgIOManager.makeContainer(messages);
|
|
78
|
+
}
|
|
79
|
+
getDataFromEvent(event) {
|
|
80
|
+
return event.state;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { DtoConfProd } from "../CatalogueAPI.js";
|
|
2
|
-
import { CfgHistoryManager, CfgHistoryManagerSendData } from "./CfgHistoryManager.js";
|
|
3
|
-
import { CfgIOProdConfConnector, CfgProdConfMessage } from "./CfgIOProdConfConnector.js";
|
|
4
|
-
export declare function dtoConfToString(conf: DtoConfProd): string;
|
|
5
|
-
export declare function stringToDtoConf(conf: string): DtoConfProd;
|
|
6
|
-
/**
|
|
7
|
-
* Instantiating this will make the browser history (and URL) update with the product configuration.
|
|
8
|
-
*/
|
|
9
|
-
export declare class CfgHistoryToProdConfConnector extends CfgIOProdConfConnector<CfgHistoryManagerSendData<CfgProdConfMessage>> {
|
|
10
|
-
private readonly _useHistoryPush;
|
|
11
|
-
private readonly _qsKey;
|
|
12
|
-
/**
|
|
13
|
-
* @param _useHistoryPush As opposed to replace. Push makes the web browser navigation buttons navigate configuration changes. Replace just updates the URL.
|
|
14
|
-
* @param _qsKey The Query String key for product configuration.
|
|
15
|
-
* @param doValidate When popping from the history stack (navigating in the browser), should a navigate call be sent to the server to verify that the product configuration is still valid?
|
|
16
|
-
*/
|
|
17
|
-
constructor(manager: CfgHistoryManager, _useHistoryPush: boolean, _qsKey?: string, doValidate?: boolean);
|
|
18
|
-
protected getInitialProdConf(): DtoConfProd | undefined;
|
|
19
|
-
protected makeSendData(conf: DtoConfProd, initial: boolean): CfgHistoryManagerSendData<CfgProdConfMessage>;
|
|
20
|
-
}
|
|
1
|
+
import { DtoConfProd } from "../CatalogueAPI.js";
|
|
2
|
+
import { CfgHistoryManager, CfgHistoryManagerSendData } from "./CfgHistoryManager.js";
|
|
3
|
+
import { CfgIOProdConfConnector, CfgProdConfMessage } from "./CfgIOProdConfConnector.js";
|
|
4
|
+
export declare function dtoConfToString(conf: DtoConfProd): string;
|
|
5
|
+
export declare function stringToDtoConf(conf: string): DtoConfProd;
|
|
6
|
+
/**
|
|
7
|
+
* Instantiating this will make the browser history (and URL) update with the product configuration.
|
|
8
|
+
*/
|
|
9
|
+
export declare class CfgHistoryToProdConfConnector extends CfgIOProdConfConnector<CfgHistoryManagerSendData<CfgProdConfMessage>> {
|
|
10
|
+
private readonly _useHistoryPush;
|
|
11
|
+
private readonly _qsKey;
|
|
12
|
+
/**
|
|
13
|
+
* @param _useHistoryPush As opposed to replace. Push makes the web browser navigation buttons navigate configuration changes. Replace just updates the URL.
|
|
14
|
+
* @param _qsKey The Query String key for product configuration.
|
|
15
|
+
* @param doValidate When popping from the history stack (navigating in the browser), should a navigate call be sent to the server to verify that the product configuration is still valid?
|
|
16
|
+
*/
|
|
17
|
+
constructor(manager: CfgHistoryManager, _useHistoryPush: boolean, _qsKey?: string, doValidate?: boolean);
|
|
18
|
+
protected getInitialProdConf(): DtoConfProd | undefined;
|
|
19
|
+
protected makeSendData(conf: DtoConfProd, initial: boolean): CfgHistoryManagerSendData<CfgProdConfMessage>;
|
|
20
|
+
}
|
|
21
21
|
//# sourceMappingURL=CfgHistoryToProdConfConnector.d.ts.map
|