@configura/web-api 2.0.0-alpha.0 → 2.0.0-alpha.11
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 +273 -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 +780 -778
- package/dist/CfgReferencePathHelper.d.ts +26 -13
- package/dist/CfgReferencePathHelper.js +26 -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 +51 -50
- package/dist/io/CfgHistoryManager.js +82 -82
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +20 -20
- package/dist/io/CfgHistoryToProdConfConnector.js +101 -56
- package/dist/io/CfgIOManager.d.ts +48 -48
- package/dist/io/CfgIOManager.js +115 -115
- package/dist/io/CfgIOProdConfConnector.d.ts +55 -52
- package/dist/io/CfgIOProdConfConnector.js +143 -141
- package/dist/io/CfgObservableStateManager.d.ts +25 -21
- package/dist/io/CfgObservableStateManager.js +69 -65
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -14
- package/dist/io/CfgObservableStateToProdConfConnector.js +17 -16
- package/dist/io/CfgWindowEventManager.d.ts +21 -21
- package/dist/io/CfgWindowEventManager.js +38 -38
- package/dist/io/CfgWindowMessageManager.d.ts +40 -40
- package/dist/io/CfgWindowMessageManager.js +87 -84
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -16
- package/dist/io/CfgWindowMessageToProdConfConnector.js +19 -18
- package/dist/io/index.d.ts +8 -8
- package/dist/io/index.js +8 -8
- package/dist/material/CfgMaterialMapping.d.ts +7 -7
- package/dist/material/CfgMaterialMapping.js +181 -181
- package/dist/material/CfgMtrlApplication.d.ts +18 -18
- package/dist/material/CfgMtrlApplication.js +43 -43
- package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
- package/dist/material/CfgMtrlApplicationSource.js +8 -8
- package/dist/material/CfgMtrlSource.d.ts +19 -19
- package/dist/material/CfgMtrlSource.js +40 -40
- package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
- package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
- package/dist/productConfiguration/CfgFeature.d.ts +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,27 @@
|
|
|
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
|
-
|
|
12
|
-
|
|
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
|
+
/**
|
|
12
|
+
* Use to generate URLs in our reference format. This is the format Configura uses in our integrations.
|
|
13
|
+
* @param browsingRootUrl The URL where Stage browsing begins
|
|
14
|
+
* @param catParams What catalogue to generate URL for.
|
|
15
|
+
* @returns An URL to a catalogue
|
|
16
|
+
*/
|
|
17
|
+
static getCataloguePath: (browsingRootUrl: string, catParams: DtoCatalogueParamsWithLang) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Use to generate URLs in our reference format. This is the format Configura uses in our integrations.
|
|
20
|
+
* @param browsingRootUrl The URL where Stage browsing begins
|
|
21
|
+
* @param productParams What product to generate URL for.
|
|
22
|
+
* @param separator Optional, defaults to "product", but can be changed to indicate another function.
|
|
23
|
+
* @returns An URL to a product
|
|
24
|
+
*/
|
|
25
|
+
static getProductPath: (browsingRootUrl: string, productParams: DtoProductParamsWithLang, separator?: string) => string;
|
|
26
|
+
}
|
|
14
27
|
//# sourceMappingURL=CfgReferencePathHelper.d.ts.map
|
|
@@ -1,13 +1,26 @@
|
|
|
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
|
-
|
|
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
|
+
/**
|
|
13
|
+
* Use to generate URLs in our reference format. This is the format Configura uses in our integrations.
|
|
14
|
+
* @param browsingRootUrl The URL where Stage browsing begins
|
|
15
|
+
* @param catParams What catalogue to generate URL for.
|
|
16
|
+
* @returns An URL to a catalogue
|
|
17
|
+
*/
|
|
18
|
+
CfgReferencePathHelper.getCataloguePath = (browsingRootUrl, catParams) => `${browsingRootUrl}/${encodeURIComponents(catParams.cid, catParams.lang, catParams.enterprise, catParams.prdCat, catParams.prdCatVersion, catParams.vendor, catParams.priceList)}`;
|
|
19
|
+
/**
|
|
20
|
+
* Use to generate URLs in our reference format. This is the format Configura uses in our integrations.
|
|
21
|
+
* @param browsingRootUrl The URL where Stage browsing begins
|
|
22
|
+
* @param productParams What product to generate URL for.
|
|
23
|
+
* @param separator Optional, defaults to "product", but can be changed to indicate another function.
|
|
24
|
+
* @returns An URL to a product
|
|
25
|
+
*/
|
|
26
|
+
CfgReferencePathHelper.getProductPath = (browsingRootUrl, productParams, separator = "product") => `${CfgReferencePathHelper.getCataloguePath(browsingRootUrl, productParams)}/${separator}/${encodeURIComponent(productParams.partNumber)}`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DtoAdditionalProductConfiguration,
|
|
2
|
-
export declare const isDtoConfProdAdditional: (value:
|
|
3
|
-
export declare const convertDtoConfProdToV1: (conf:
|
|
4
|
-
export declare const convertDtoConfFeaturesToSelOptions: (features:
|
|
1
|
+
import { DtoAdditionalProductConfiguration, DtoAdditionalProductConfigurationV2, DtoFeatureConfiguration, DtoProductConfiguration, DtoSelectedOption } from "./CatalogueAPI.js";
|
|
2
|
+
export declare const isDtoConfProdAdditional: (value: DtoProductConfiguration) => value is DtoAdditionalProductConfigurationV2;
|
|
3
|
+
export declare const convertDtoConfProdToV1: (conf: DtoProductConfiguration, silenceWarnings?: boolean) => DtoAdditionalProductConfiguration;
|
|
4
|
+
export declare const convertDtoConfFeaturesToSelOptions: (features: DtoFeatureConfiguration[], 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,52 @@
|
|
|
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
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* is
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
static
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* passed
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
protected
|
|
49
|
-
|
|
50
|
-
|
|
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 query string
|
|
8
|
+
* key-values used in the URL.
|
|
9
|
+
* When navigating back and forth the stage (message) is used to restore the old state. When
|
|
10
|
+
* opening a window with no prior history the Query String will be used.
|
|
11
|
+
*/
|
|
12
|
+
export declare type CfgHistoryManagerSendData<D> = {
|
|
13
|
+
message: D;
|
|
14
|
+
useHistoryPush: boolean;
|
|
15
|
+
qsKeyValues: Map<string, string | undefined>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* This class is used to coordinate writing and reading to the browser history.
|
|
19
|
+
* It handles messages sent from the connectors.
|
|
20
|
+
*/
|
|
21
|
+
export declare class CfgHistoryManager extends CfgWindowEventManager<"popstate", CfgHistoryManagerSendData<CfgHistoryManagerMessageData>> {
|
|
22
|
+
private static _instance;
|
|
23
|
+
static get instance(): CfgHistoryManager;
|
|
24
|
+
private constructor();
|
|
25
|
+
/**
|
|
26
|
+
* Write to the history
|
|
27
|
+
*/
|
|
28
|
+
send(messageKey: string, data: CfgHistoryManagerSendData<CfgHistoryManagerMessageData>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Takes the current in browser URL and updates it with the provided Query String values.
|
|
31
|
+
* Old Query String is replaced.
|
|
32
|
+
*/
|
|
33
|
+
private static _makeUpdatedUrl;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the current in browser Query String updated with the key values provided.
|
|
36
|
+
* If a value is undefined in the passed map it will be deleted from the Query String.
|
|
37
|
+
*/
|
|
38
|
+
private static _makeUpdatedQueryString;
|
|
39
|
+
/**
|
|
40
|
+
* @returns The current in browser Query String as a Map
|
|
41
|
+
*/
|
|
42
|
+
static currentQsKeyValues(): Map<string, string>;
|
|
43
|
+
/**
|
|
44
|
+
* If the passed currentState is a CfgIOContainer it will update it with the
|
|
45
|
+
* passed message. If not it will create a new CfgIOContainer with the message.
|
|
46
|
+
*/
|
|
47
|
+
private static _makeUpdatedState;
|
|
48
|
+
protected readonly eventType = "popstate";
|
|
49
|
+
protected getDataFromEvent(event: PopStateEvent): unknown;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
51
52
|
//# 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
|
|
6
|
-
*
|
|
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 is used to coordinate writing and reading to the browser history.
|
|
6
|
+
* It handles messages sent from the connectors.
|
|
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
|
+
}
|