@configura/web-api 1.6.1 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CatalogueAPI.d.ts +200 -156
- package/dist/CatalogueAPI.js +23 -10
- package/dist/CfgMeasure.d.ts +3 -3
- package/dist/CfgProduct.d.ts +31 -21
- package/dist/CfgProduct.js +77 -46
- package/dist/CfgReferencePathHelper.d.ts +14 -0
- package/dist/CfgReferencePathHelper.js +13 -0
- package/dist/ConfigurationConverter.d.ts +5 -0
- package/dist/ConfigurationConverter.js +72 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/io/CfgHistoryManager.d.ts +51 -0
- package/dist/io/CfgHistoryManager.js +82 -0
- package/dist/io/CfgHistoryToProdConfConnector.d.ts +21 -0
- package/dist/io/CfgHistoryToProdConfConnector.js +56 -0
- package/dist/io/CfgIOManager.d.ts +49 -0
- package/dist/io/CfgIOManager.js +115 -0
- package/dist/io/CfgIOProdConfConnector.d.ts +53 -0
- package/dist/io/CfgIOProdConfConnector.js +141 -0
- package/dist/io/CfgObservableStateManager.d.ts +22 -0
- package/dist/io/CfgObservableStateManager.js +65 -0
- package/dist/io/CfgObservableStateToProdConfConnector.d.ts +15 -0
- package/dist/io/CfgObservableStateToProdConfConnector.js +16 -0
- package/dist/io/CfgWindowEventManager.d.ts +22 -0
- package/dist/io/CfgWindowEventManager.js +38 -0
- package/dist/io/CfgWindowMessageManager.d.ts +41 -0
- package/dist/io/CfgWindowMessageManager.js +84 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +17 -0
- package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -0
- package/dist/io/index.d.ts +9 -0
- package/dist/io/index.js +8 -0
- package/dist/material/CfgMtrlApplication.d.ts +2 -2
- package/dist/productConfiguration/CfgFeature.d.ts +11 -12
- package/dist/productConfiguration/CfgFeature.js +37 -28
- package/dist/productConfiguration/CfgOption.d.ts +9 -8
- package/dist/productConfiguration/CfgOption.js +20 -30
- package/dist/productConfiguration/CfgProductConfiguration.d.ts +17 -20
- package/dist/productConfiguration/CfgProductConfiguration.js +14 -16
- package/dist/productConfiguration/filters.d.ts +4 -4
- package/dist/productConfiguration/productParamsGenerator.d.ts +4 -4
- package/dist/productConfiguration/productParamsGenerator.js +5 -5
- package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +3 -3
- package/dist/productLoader.d.ts +3 -3
- package/dist/syncGroups/SyncGroupsHandler.js +3 -2
- package/dist/syncGroups/SyncGroupsTransaction.js +1 -1
- package/dist/tasks/TaskHandler.d.ts +7 -8
- package/dist/tasks/TaskHandler.js +4 -5
- package/dist/tasks/formats.d.ts +4 -4
- package/dist/tasks/formats.js +3 -3
- package/dist/tests/testData/dummyProductForTest.d.ts +2 -2
- package/dist/tests/testData/dummyProductForTest.js +3 -7
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +2 -2
- package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +1 -1
- package/dist/tests/testData/testDataCachedGetProduct.d.ts +2 -2
- package/dist/tests/testData/testDataCachedGetProduct.js +1 -1
- package/dist/tests/testData/testDataCachedPostValidate.js +1 -1
- package/dist/tests/testData/testDataOptions.d.ts +4 -4
- package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +3 -3
- package/dist/tests/testData/testDataProductAggregatedPrice.js +1 -1
- package/dist/tests/testData/testDataUpcharge.js +1 -1
- package/dist/utilitiesCatalogueData.d.ts +25 -23
- package/dist/utilitiesCatalogueData.js +10 -8
- package/dist/utilitiesCataloguePermission.d.ts +8 -13
- package/dist/utilitiesCataloguePermission.js +7 -11
- package/dist/utilitiesNumericValues.d.ts +3 -3
- package/package.json +3 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Observable } from "@configura/web-utilities";
|
|
2
|
+
import { CfgIOManager, IOManagerListener } from "./CfgIOManager.js";
|
|
3
|
+
export declare class CfgObservableStateManager extends CfgIOManager<unknown> {
|
|
4
|
+
private static _instance;
|
|
5
|
+
static get instance(): CfgObservableStateManager;
|
|
6
|
+
private constructor();
|
|
7
|
+
readonly stateObservable: Observable<string>;
|
|
8
|
+
private messagesState;
|
|
9
|
+
get stateAsString(): string;
|
|
10
|
+
set stateAsString(s: string);
|
|
11
|
+
listenForStateChange(listener: (v: string) => void): void;
|
|
12
|
+
stopListenForStateChange(listener: (v: string) => void): void;
|
|
13
|
+
listenForMessage(l: IOManagerListener, messageKey: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Removes the listener
|
|
16
|
+
*/
|
|
17
|
+
stopListenForMessage(l: IOManagerListener): boolean;
|
|
18
|
+
private _stateListenerBound;
|
|
19
|
+
private _stateListener;
|
|
20
|
+
send(messageKey: string, data: unknown): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=CfgObservableStateManager.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Observable } from "@configura/web-utilities";
|
|
2
|
+
import { CfgIOManager } from "./CfgIOManager.js";
|
|
3
|
+
export class CfgObservableStateManager extends CfgIOManager {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
this.stateObservable = new Observable();
|
|
7
|
+
this.messagesState = {};
|
|
8
|
+
this._stateListenerBound = this._stateListener.bind(this);
|
|
9
|
+
}
|
|
10
|
+
static get instance() {
|
|
11
|
+
if (this._instance === undefined) {
|
|
12
|
+
this._instance = new CfgObservableStateManager();
|
|
13
|
+
}
|
|
14
|
+
return this._instance;
|
|
15
|
+
}
|
|
16
|
+
get stateAsString() {
|
|
17
|
+
return JSON.stringify(CfgObservableStateManager.makeContainer(this.messagesState), null, 2);
|
|
18
|
+
}
|
|
19
|
+
set stateAsString(s) {
|
|
20
|
+
this.stateObservable.notifyAll(s);
|
|
21
|
+
}
|
|
22
|
+
listenForStateChange(listener) {
|
|
23
|
+
this.stateObservable.listen(listener);
|
|
24
|
+
}
|
|
25
|
+
stopListenForStateChange(listener) {
|
|
26
|
+
this.stateObservable.stopListen(listener);
|
|
27
|
+
}
|
|
28
|
+
listenForMessage(l, messageKey) {
|
|
29
|
+
const hadListeners = this.hasMessageListeners;
|
|
30
|
+
const didStartListen = super.listenForMessage(l, messageKey);
|
|
31
|
+
if (!hadListeners && didStartListen) {
|
|
32
|
+
this.stateObservable.listen(this._stateListenerBound, this);
|
|
33
|
+
}
|
|
34
|
+
return didStartListen;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Removes the listener
|
|
38
|
+
*/
|
|
39
|
+
stopListenForMessage(l) {
|
|
40
|
+
const didStopListen = super.stopListenForMessage(l);
|
|
41
|
+
if (didStopListen && !this.hasMessageListeners) {
|
|
42
|
+
this.stateObservable.stopListen(this._stateListenerBound);
|
|
43
|
+
}
|
|
44
|
+
return didStopListen;
|
|
45
|
+
}
|
|
46
|
+
_stateListener(data) {
|
|
47
|
+
let asJson;
|
|
48
|
+
try {
|
|
49
|
+
asJson = JSON.parse(data);
|
|
50
|
+
}
|
|
51
|
+
catch (_a) {
|
|
52
|
+
throw new Error("Not JSON data");
|
|
53
|
+
}
|
|
54
|
+
if (!CfgIOManager.isIOContainer(asJson)) {
|
|
55
|
+
console.warn("Not a readable IO container");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
this.messagesState = asJson.messages;
|
|
59
|
+
super._containerListener(asJson);
|
|
60
|
+
}
|
|
61
|
+
send(messageKey, data) {
|
|
62
|
+
this.messagesState[messageKey] = data;
|
|
63
|
+
this.stateObservable.notifyAll(this.stateAsString, this);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DtoConfProd } from "../CatalogueAPI.js";
|
|
2
|
+
import { CfgIOProdConfConnector, CfgProdConfMessage, CfgProdConfMessageVersions } from "./CfgIOProdConfConnector.js";
|
|
3
|
+
import { CfgObservableStateManager } from "./CfgObservableStateManager.js";
|
|
4
|
+
/**
|
|
5
|
+
* Instantiating this will make the observable state update with the product configuration.
|
|
6
|
+
* @param doValidate Run server side product validation for incoming
|
|
7
|
+
* @param sendVersions What versions of the productConfiguration shall be sent? Multiple can be selected
|
|
8
|
+
* @param includeExtendedDataInSend Only for version 2.0. Includes unit and groupCode.
|
|
9
|
+
* @param includeProdParamsInSend Only for version 2.0. Includes product params, in both main and additional products.
|
|
10
|
+
*/
|
|
11
|
+
export declare class CfgObservableStateToProdConfConnector extends CfgIOProdConfConnector<CfgProdConfMessage> {
|
|
12
|
+
constructor(manager: CfgObservableStateManager, doValidate?: boolean, sendVersions?: CfgProdConfMessageVersions, includeExtendedDataInSend?: boolean, includeProdParamsInSend?: boolean);
|
|
13
|
+
protected makeSendData(conf: DtoConfProd, initial: boolean): CfgProdConfMessage;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=CfgObservableStateToProdConfConnector.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CfgIOProdConfConnector, CfgProdConfMessageVersions, } from "./CfgIOProdConfConnector.js";
|
|
2
|
+
/**
|
|
3
|
+
* Instantiating this will make the observable state update with the product configuration.
|
|
4
|
+
* @param doValidate Run server side product validation for incoming
|
|
5
|
+
* @param sendVersions What versions of the productConfiguration shall be sent? Multiple can be selected
|
|
6
|
+
* @param includeExtendedDataInSend Only for version 2.0. Includes unit and groupCode.
|
|
7
|
+
* @param includeProdParamsInSend Only for version 2.0. Includes product params, in both main and additional products.
|
|
8
|
+
*/
|
|
9
|
+
export class CfgObservableStateToProdConfConnector extends CfgIOProdConfConnector {
|
|
10
|
+
constructor(manager, doValidate = true, sendVersions = CfgProdConfMessageVersions.V2dot0, includeExtendedDataInSend = false, includeProdParamsInSend = false) {
|
|
11
|
+
super(manager, doValidate, sendVersions, includeExtendedDataInSend, includeProdParamsInSend);
|
|
12
|
+
}
|
|
13
|
+
makeSendData(conf, initial) {
|
|
14
|
+
return this.makeMessage(conf, initial);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CfgIOManager, IOManagerListener } from "./CfgIOManager.js";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for classes handling input and output in globally shared environments, using
|
|
4
|
+
* event listeners on the window object, for example the History API and window.message API.
|
|
5
|
+
* These are global resources where data not being handled by Stage can appear.
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class CfgWindowEventManager<K extends keyof WindowEventMap, S> extends CfgIOManager<S> {
|
|
8
|
+
/**
|
|
9
|
+
* Listen for the message messageKey being received. This can for example be the history stack
|
|
10
|
+
* being popped or a window.message being received.
|
|
11
|
+
*/
|
|
12
|
+
listenForMessage(l: IOManagerListener, messageKey: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Removes the listener
|
|
15
|
+
*/
|
|
16
|
+
stopListenForMessage(l: IOManagerListener): boolean;
|
|
17
|
+
private _windowEventListenerBound;
|
|
18
|
+
private _windowEventListener;
|
|
19
|
+
protected abstract readonly eventType: K;
|
|
20
|
+
protected abstract getDataFromEvent(event: WindowEventMap[K]): unknown;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=CfgWindowEventManager.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CfgIOManager } from "./CfgIOManager.js";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for classes handling input and output in globally shared environments, using
|
|
4
|
+
* event listeners on the window object, for example the History API and window.message API.
|
|
5
|
+
* These are global resources where data not being handled by Stage can appear.
|
|
6
|
+
*/
|
|
7
|
+
export class CfgWindowEventManager extends CfgIOManager {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this._windowEventListenerBound = this._windowEventListener.bind(this);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Listen for the message messageKey being received. This can for example be the history stack
|
|
14
|
+
* being popped or a window.message being received.
|
|
15
|
+
*/
|
|
16
|
+
listenForMessage(l, messageKey) {
|
|
17
|
+
const hadListeners = this.hasMessageListeners;
|
|
18
|
+
const didStartListen = super.listenForMessage(l, messageKey);
|
|
19
|
+
if (!hadListeners && didStartListen) {
|
|
20
|
+
window.addEventListener(this.eventType, this._windowEventListenerBound);
|
|
21
|
+
}
|
|
22
|
+
return didStartListen;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Removes the listener
|
|
26
|
+
*/
|
|
27
|
+
stopListenForMessage(l) {
|
|
28
|
+
const didStopListen = super.stopListenForMessage(l);
|
|
29
|
+
if (didStopListen && !this.hasMessageListeners) {
|
|
30
|
+
window.removeEventListener(this.eventType, this._windowEventListenerBound);
|
|
31
|
+
}
|
|
32
|
+
return didStopListen;
|
|
33
|
+
}
|
|
34
|
+
_windowEventListener(event) {
|
|
35
|
+
const data = this.getDataFromEvent(event);
|
|
36
|
+
super._containerListener(data);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IOManagerListener } from "./CfgIOManager.js";
|
|
2
|
+
import { CfgWindowEventManager } from "./CfgWindowEventManager.js";
|
|
3
|
+
/**
|
|
4
|
+
* This class does nothing on it's own. It is used to coordinate sending and receiving
|
|
5
|
+
* using the post message-API. See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
6
|
+
*/
|
|
7
|
+
export declare class CfgWindowMessageManager extends CfgWindowEventManager<"message", unknown> {
|
|
8
|
+
private static _instance;
|
|
9
|
+
static get instance(): CfgWindowMessageManager;
|
|
10
|
+
/**
|
|
11
|
+
* If uncertain about security, please read https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
12
|
+
*/
|
|
13
|
+
private constructor();
|
|
14
|
+
private _doListenForIncoming;
|
|
15
|
+
private _remoteEnds;
|
|
16
|
+
private _targetOrigin;
|
|
17
|
+
private _acceptableMessageOrigin;
|
|
18
|
+
/**
|
|
19
|
+
* Listen for incoming messages or not
|
|
20
|
+
*/
|
|
21
|
+
set doListenForIncoming(v: boolean);
|
|
22
|
+
/**
|
|
23
|
+
* What window object outgoing messages should be sent to. Leave empty if you don't want to broadcast.
|
|
24
|
+
*/
|
|
25
|
+
set remoteEnds(v: Window[]);
|
|
26
|
+
/**
|
|
27
|
+
* What origins of the target window are acceptable.
|
|
28
|
+
*/
|
|
29
|
+
set targetOrigin(v: string);
|
|
30
|
+
/**
|
|
31
|
+
* @param _acceptableMessageOrigin What message origins we accept incoming from.
|
|
32
|
+
*/
|
|
33
|
+
set acceptableMessageOrigin(v: string);
|
|
34
|
+
listenForMessage(l: IOManagerListener, messageKey: string): boolean;
|
|
35
|
+
stopListenForMessage(l: IOManagerListener): boolean;
|
|
36
|
+
send(messageKey: string, data: unknown): void;
|
|
37
|
+
protected _containerListener(event: MessageEvent<unknown>): void;
|
|
38
|
+
protected readonly eventType = "message";
|
|
39
|
+
protected getDataFromEvent(event: MessageEvent<unknown>): unknown;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=CfgWindowMessageManager.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { CfgIOManager } from "./CfgIOManager.js";
|
|
2
|
+
import { CfgWindowEventManager } from "./CfgWindowEventManager.js";
|
|
3
|
+
/**
|
|
4
|
+
* This class does nothing on it's own. It is used to coordinate sending and receiving
|
|
5
|
+
* using the post message-API. See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
6
|
+
*/
|
|
7
|
+
export class CfgWindowMessageManager extends CfgWindowEventManager {
|
|
8
|
+
/**
|
|
9
|
+
* If uncertain about security, please read https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage
|
|
10
|
+
*/
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this._doListenForIncoming = true;
|
|
14
|
+
this._remoteEnds = [];
|
|
15
|
+
this._targetOrigin = "*";
|
|
16
|
+
this._acceptableMessageOrigin = undefined;
|
|
17
|
+
this.eventType = "message";
|
|
18
|
+
}
|
|
19
|
+
static get instance() {
|
|
20
|
+
if (this._instance === undefined) {
|
|
21
|
+
this._instance = new CfgWindowMessageManager();
|
|
22
|
+
}
|
|
23
|
+
return this._instance;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Listen for incoming messages or not
|
|
27
|
+
*/
|
|
28
|
+
set doListenForIncoming(v) {
|
|
29
|
+
this._doListenForIncoming = v;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* What window object outgoing messages should be sent to. Leave empty if you don't want to broadcast.
|
|
33
|
+
*/
|
|
34
|
+
set remoteEnds(v) {
|
|
35
|
+
for (const remote of v) {
|
|
36
|
+
if (remote === window) {
|
|
37
|
+
console.warn("You are providing your own window as a remote end.");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
this._remoteEnds = v;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* What origins of the target window are acceptable.
|
|
44
|
+
*/
|
|
45
|
+
set targetOrigin(v) {
|
|
46
|
+
this._targetOrigin = v;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @param _acceptableMessageOrigin What message origins we accept incoming from.
|
|
50
|
+
*/
|
|
51
|
+
set acceptableMessageOrigin(v) {
|
|
52
|
+
this._acceptableMessageOrigin = v;
|
|
53
|
+
}
|
|
54
|
+
listenForMessage(l, messageKey) {
|
|
55
|
+
if (!this._doListenForIncoming) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return super.listenForMessage(l, messageKey);
|
|
59
|
+
}
|
|
60
|
+
stopListenForMessage(l) {
|
|
61
|
+
if (!this._doListenForIncoming) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return super.stopListenForMessage(l);
|
|
65
|
+
}
|
|
66
|
+
send(messageKey, data) {
|
|
67
|
+
const container = CfgIOManager.makeContainer({
|
|
68
|
+
[messageKey]: data,
|
|
69
|
+
});
|
|
70
|
+
for (const remoteEnd of this._remoteEnds) {
|
|
71
|
+
remoteEnd.postMessage(container, this._targetOrigin);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
_containerListener(event) {
|
|
75
|
+
if (this._acceptableMessageOrigin !== undefined &&
|
|
76
|
+
event.origin !== this._acceptableMessageOrigin) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
super._containerListener(event);
|
|
80
|
+
}
|
|
81
|
+
getDataFromEvent(event) {
|
|
82
|
+
return event.data;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DtoConfProd } from "../CatalogueAPI.js";
|
|
2
|
+
import { CfgIOProdConfConnector, CfgProdConfMessage, CfgProdConfMessageVersions } from "./CfgIOProdConfConnector.js";
|
|
3
|
+
import { CfgWindowMessageManager } from "./CfgWindowMessageManager.js";
|
|
4
|
+
/**
|
|
5
|
+
* Instantiating this will make Stage send product configuration changes using the post message-API.
|
|
6
|
+
* It will also make Stage listen for incoming product configuration update messages.
|
|
7
|
+
* This can be used to communicate in and out of an iframe for example.
|
|
8
|
+
* @param doValidate Run server side product validation for incoming
|
|
9
|
+
* @param sendVersions What versions of the productConfiguration shall be sent? Multiple can be selected
|
|
10
|
+
* @param includeExtendedDataInSend Only for version 2.0. Includes unit and groupCode.
|
|
11
|
+
* @param includeProdParamsInSend Only for version 2.0. Includes product params, in both main and additional products.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CfgWindowMessageToProdConfConnector extends CfgIOProdConfConnector<CfgProdConfMessage> {
|
|
14
|
+
constructor(manager: CfgWindowMessageManager, doValidate?: boolean, sendVersions?: CfgProdConfMessageVersions, includeExtendedDataInSend?: boolean, includeProdParamsInSend?: boolean);
|
|
15
|
+
protected makeSendData(conf: DtoConfProd, initial: boolean): CfgProdConfMessage;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=CfgWindowMessageToProdConfConnector.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CfgIOProdConfConnector, CfgProdConfMessageVersions, } from "./CfgIOProdConfConnector.js";
|
|
2
|
+
/**
|
|
3
|
+
* Instantiating this will make Stage send product configuration changes using the post message-API.
|
|
4
|
+
* It will also make Stage listen for incoming product configuration update messages.
|
|
5
|
+
* This can be used to communicate in and out of an iframe for example.
|
|
6
|
+
* @param doValidate Run server side product validation for incoming
|
|
7
|
+
* @param sendVersions What versions of the productConfiguration shall be sent? Multiple can be selected
|
|
8
|
+
* @param includeExtendedDataInSend Only for version 2.0. Includes unit and groupCode.
|
|
9
|
+
* @param includeProdParamsInSend Only for version 2.0. Includes product params, in both main and additional products.
|
|
10
|
+
*/
|
|
11
|
+
export class CfgWindowMessageToProdConfConnector extends CfgIOProdConfConnector {
|
|
12
|
+
constructor(manager, doValidate = true, sendVersions = CfgProdConfMessageVersions.V2dot0, includeExtendedDataInSend = false, includeProdParamsInSend = false) {
|
|
13
|
+
super(manager, doValidate, sendVersions, includeExtendedDataInSend, includeProdParamsInSend);
|
|
14
|
+
}
|
|
15
|
+
makeSendData(conf, initial) {
|
|
16
|
+
return this.makeMessage(conf, initial);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./CfgHistoryManager.js";
|
|
2
|
+
export * from "./CfgHistoryToProdConfConnector.js";
|
|
3
|
+
export * from "./CfgIOManager.js";
|
|
4
|
+
export * from "./CfgIOProdConfConnector.js";
|
|
5
|
+
export * from "./CfgObservableStateManager.js";
|
|
6
|
+
export * from "./CfgObservableStateToProdConfConnector.js";
|
|
7
|
+
export * from "./CfgWindowMessageManager.js";
|
|
8
|
+
export * from "./CfgWindowMessageToProdConfConnector.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/io/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./CfgHistoryManager.js";
|
|
2
|
+
export * from "./CfgHistoryToProdConfConnector.js";
|
|
3
|
+
export * from "./CfgIOManager.js";
|
|
4
|
+
export * from "./CfgIOProdConfConnector.js";
|
|
5
|
+
export * from "./CfgObservableStateManager.js";
|
|
6
|
+
export * from "./CfgObservableStateToProdConfConnector.js";
|
|
7
|
+
export * from "./CfgWindowMessageManager.js";
|
|
8
|
+
export * from "./CfgWindowMessageToProdConfConnector.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DtoApplicationArea, DtoMtrlApplication } from "../CatalogueAPI.js";
|
|
2
2
|
import { CfgMtrlApplicationSource } from "./CfgMtrlApplicationSource.js";
|
|
3
3
|
import { CfgMtrlSource } from "./CfgMtrlSource.js";
|
|
4
4
|
export declare class CfgMtrlApplication {
|
|
@@ -9,7 +9,7 @@ export declare class CfgMtrlApplication {
|
|
|
9
9
|
static fromUrlForDebug(areaTags: string[], url: string): CfgMtrlApplication;
|
|
10
10
|
static fromBufferForDebug(areaTags: string[], fileName: string, buffer: ArrayBuffer): CfgMtrlApplication;
|
|
11
11
|
private static fromMtrlSourceForDebug;
|
|
12
|
-
static fromMtrlLikeApplication(source: CfgMtrlApplicationSource, application:
|
|
12
|
+
static fromMtrlLikeApplication(source: CfgMtrlApplicationSource, application: DtoApplicationArea | DtoMtrlApplication): CfgMtrlApplication;
|
|
13
13
|
private constructor();
|
|
14
14
|
get source(): CfgMtrlApplicationSource;
|
|
15
15
|
get areaTags(): string[] | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities";
|
|
2
|
-
import {
|
|
2
|
+
import { DtoConfFeature, DtoFeature, DtoSelectedOption, DtoSyncGroup, DtoSyncGroupMethods } from "../CatalogueAPI.js";
|
|
3
3
|
import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js";
|
|
4
4
|
import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js";
|
|
5
5
|
import { SyncCode } from "../syncGroups/SyncGroupsHandler.js";
|
|
@@ -22,6 +22,7 @@ export declare enum SelectionType {
|
|
|
22
22
|
}
|
|
23
23
|
export declare type FeatureChangeNotification = {
|
|
24
24
|
freshRef: CfgFeature;
|
|
25
|
+
committed: boolean;
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
28
|
* This class is meant to only be used through CfgFeature. It should
|
|
@@ -30,14 +31,14 @@ export declare type FeatureChangeNotification = {
|
|
|
30
31
|
* should be used and interacted with.
|
|
31
32
|
*/
|
|
32
33
|
export declare class _CfgFeatureInternal {
|
|
33
|
-
readonly rawFeature:
|
|
34
|
+
readonly rawFeature: DtoFeature;
|
|
34
35
|
private readonly allRawFeatures;
|
|
35
36
|
readonly key: string;
|
|
36
37
|
readonly parent: _CfgProductConfigurationInternal | _CfgOptionInternal;
|
|
37
38
|
readonly parentConfiguration: _CfgProductConfigurationInternal;
|
|
38
39
|
readonly parentProduct: _CfgProductInternal;
|
|
39
40
|
readonly rootProduct: _CfgProductInternal;
|
|
40
|
-
constructor(rawFeature:
|
|
41
|
+
constructor(rawFeature: DtoFeature, allRawFeatures: DtoFeature[], key: string, // Unique amongst siblings
|
|
41
42
|
parent: _CfgProductConfigurationInternal | _CfgOptionInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal);
|
|
42
43
|
readonly selectionType: SelectionType;
|
|
43
44
|
private _options;
|
|
@@ -51,16 +52,16 @@ export declare class _CfgFeatureInternal {
|
|
|
51
52
|
get numericValue(): number | undefined;
|
|
52
53
|
setNumericValue: (val: number) => Promise<boolean>;
|
|
53
54
|
get description(): string;
|
|
54
|
-
get syncGroup():
|
|
55
|
+
get syncGroup(): DtoSyncGroup | undefined;
|
|
55
56
|
/**
|
|
56
57
|
* @return one of the following, in order:
|
|
57
58
|
* - undefined if the Feature lacks a syncGroup.
|
|
58
59
|
* - false if the syncGroup doesn't fulfill the optional mustSupport requirement.
|
|
59
60
|
* - syncCode from the syncGroup.
|
|
60
61
|
*/
|
|
61
|
-
getSyncCode(mustSupport?:
|
|
62
|
+
getSyncCode(mustSupport?: DtoSyncGroupMethods): undefined | false | SyncCode;
|
|
62
63
|
/**
|
|
63
|
-
* The
|
|
64
|
+
* The DtoMeasureParam class is re-used for different purposes. In Features it is used
|
|
64
65
|
* to indicate which stretch measures inside Models shall be affected by this state
|
|
65
66
|
* of this Feature. Hence only the code property is used.
|
|
66
67
|
*/
|
|
@@ -97,12 +98,10 @@ export declare class _CfgFeatureInternal {
|
|
|
97
98
|
* @throws Will throw if options have not yet been generated. This should be impossible
|
|
98
99
|
* as nonexisting children can not call their parent.
|
|
99
100
|
*/
|
|
100
|
-
_childHasChanged: (childOption: _CfgOptionInternal, bubbleMode: ProductConfigurationBubbleMode) => Promise<void>;
|
|
101
|
-
|
|
102
|
-
[index: string]: SelectedOption;
|
|
103
|
-
} | undefined;
|
|
101
|
+
_childHasChanged: (childOption: _CfgOptionInternal, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise<void>;
|
|
102
|
+
getDtoConf: (includeExtendedData: boolean) => DtoConfFeature;
|
|
104
103
|
setApiSelection: (apiOptionSelectionMap: {
|
|
105
|
-
[index: string]:
|
|
104
|
+
[index: string]: DtoSelectedOption;
|
|
106
105
|
} | undefined) => Promise<boolean>;
|
|
107
106
|
/** Pushes to refresh stretch. Does not cause validation. */
|
|
108
107
|
pushStretch: () => Promise<boolean>;
|
|
@@ -129,7 +128,7 @@ export declare class _CfgFeatureInternal {
|
|
|
129
128
|
}
|
|
130
129
|
export declare class CfgFeature {
|
|
131
130
|
readonly _internal: _CfgFeatureInternal;
|
|
132
|
-
static make(rawFeature:
|
|
131
|
+
static make(rawFeature: DtoFeature, allRawFeatures: DtoFeature[], key: string, parent: _CfgProductConfigurationInternal | _CfgOptionInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgFeature;
|
|
133
132
|
/**
|
|
134
133
|
* Makes an object wrapping the passed object. This is not a clone method,
|
|
135
134
|
* it is a method to make a new outer reference. Like a shallow copy.
|