@configura/web-api 1.6.0-iotest.4 → 1.6.1-alpha.2

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.
Files changed (51) hide show
  1. package/dist/CfgProduct.d.ts +34 -17
  2. package/dist/CfgProduct.js +118 -54
  3. package/dist/index.d.ts +2 -6
  4. package/dist/index.js +2 -6
  5. package/dist/productConfiguration/CfgFeature.d.ts +2 -1
  6. package/dist/productConfiguration/CfgFeature.js +26 -20
  7. package/dist/productConfiguration/CfgOption.d.ts +30 -8
  8. package/dist/productConfiguration/CfgOption.js +50 -18
  9. package/dist/productConfiguration/CfgProductConfiguration.d.ts +1 -2
  10. package/dist/productConfiguration/CfgProductConfiguration.js +9 -8
  11. package/dist/productConfiguration/filters.d.ts +1 -1
  12. package/dist/productConfiguration/filters.js +6 -3
  13. package/dist/syncGroups/SyncGroupsApplier.d.ts +20 -0
  14. package/dist/syncGroups/SyncGroupsApplier.js +520 -0
  15. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +21 -0
  16. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -0
  17. package/dist/syncGroups/SyncGroupsHandler.d.ts +40 -0
  18. package/dist/syncGroups/SyncGroupsHandler.js +352 -0
  19. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +27 -0
  20. package/dist/syncGroups/SyncGroupsPathHelper.js +89 -0
  21. package/dist/syncGroups/SyncGroupsState.d.ts +26 -0
  22. package/dist/syncGroups/SyncGroupsState.js +111 -0
  23. package/dist/syncGroups/SyncGroupsTransaction.d.ts +51 -0
  24. package/dist/syncGroups/SyncGroupsTransaction.js +100 -0
  25. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +24 -95
  26. package/dist/tests/testData/testDataCachedGetProduct.js +8 -19
  27. package/dist/tests/testData/testDataOptions.d.ts +13 -0
  28. package/dist/tests/testData/testDataOptions.js +60 -0
  29. package/dist/tests/testData/testDataProductAggregatedPrice.js +12 -23
  30. package/dist/tests/testData/testDataUpcharge.js +16 -48
  31. package/dist/utilitiesCatalogueData.d.ts +7 -1
  32. package/dist/utilitiesCatalogueData.js +104 -1
  33. package/package.json +3 -3
  34. package/dist/io/CfgHistoryManager.d.ts +0 -26
  35. package/dist/io/CfgHistoryManager.js +0 -58
  36. package/dist/io/CfgHistoryToCameraConfConnector.d.ts +0 -15
  37. package/dist/io/CfgHistoryToCameraConfConnector.js +0 -58
  38. package/dist/io/CfgHistoryToProdConfConnector.d.ts +0 -14
  39. package/dist/io/CfgHistoryToProdConfConnector.js +0 -24
  40. package/dist/io/CfgIOCameraConfConnector.d.ts +0 -31
  41. package/dist/io/CfgIOCameraConfConnector.js +0 -72
  42. package/dist/io/CfgIOManager.d.ts +0 -29
  43. package/dist/io/CfgIOManager.js +0 -89
  44. package/dist/io/CfgIOProdConfConnector.d.ts +0 -36
  45. package/dist/io/CfgIOProdConfConnector.js +0 -102
  46. package/dist/io/CfgWindowMessageManager.d.ts +0 -13
  47. package/dist/io/CfgWindowMessageManager.js +0 -33
  48. package/dist/io/CfgWindowMessageToCameraConfConnector.d.ts +0 -6
  49. package/dist/io/CfgWindowMessageToCameraConfConnector.js +0 -6
  50. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +0 -14
  51. package/dist/io/CfgWindowMessageToProdConfConnector.js +0 -17
@@ -1,102 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- export const STAGE_PROD_CONF_MESSAGE_KEY = "stageprodconf";
11
- export const STAGE_PROD_CONF_MESSAGE_VERSION = "1.0";
12
- export function prodConfToString(conf) {
13
- return JSON.stringify(conf, undefined, "");
14
- }
15
- export function stringToProdConf(conf) {
16
- return JSON.parse(conf);
17
- }
18
- export class CfgIOProdConfConnector {
19
- constructor(_ioManager, _doValidate) {
20
- this._ioManager = _ioManager;
21
- this._doValidate = _doValidate;
22
- this._stopListenToMessage = undefined;
23
- this._stopListenToProdConf = undefined;
24
- this.setProduct = (product) => __awaiter(this, void 0, void 0, function* () {
25
- var _a, _b;
26
- const currentProduct = this._product;
27
- const newProduct = product;
28
- this._product = newProduct;
29
- // If same product don't do anything at all
30
- if (currentProduct !== undefined &&
31
- newProduct !== undefined &&
32
- currentProduct.isBackedBySame(newProduct)) {
33
- return;
34
- }
35
- if (currentProduct !== undefined) {
36
- (_a = this._stopListenToMessage) === null || _a === void 0 ? void 0 : _a.call(this);
37
- (_b = this._stopListenToProdConf) === null || _b === void 0 ? void 0 : _b.call(this);
38
- }
39
- if (newProduct === undefined) {
40
- return;
41
- }
42
- if (currentProduct === undefined) {
43
- const initialProdConf = this.getInitialProdConf();
44
- if (initialProdConf !== undefined) {
45
- yield newProduct.setApiSelection(stringToProdConf(initialProdConf), this._doValidate);
46
- }
47
- }
48
- this._ioManager.send(STAGE_PROD_CONF_MESSAGE_KEY, this.makeSendData(newProduct.getApiSelection(), true));
49
- this._stopListenToMessage = this.listenForMessage((message) => __awaiter(this, void 0, void 0, function* () {
50
- yield newProduct.setApiSelection(message.prodConf, this._doValidate);
51
- }));
52
- this._stopListenToProdConf = this.listenForProdConf(newProduct, (prodConf) => __awaiter(this, void 0, void 0, function* () {
53
- this._ioManager.send(STAGE_PROD_CONF_MESSAGE_KEY, this.makeSendData(prodConf, false));
54
- }));
55
- });
56
- }
57
- makeMessage(prodConf, initial) {
58
- return {
59
- version: STAGE_PROD_CONF_MESSAGE_VERSION,
60
- initial,
61
- prodConf,
62
- };
63
- }
64
- makeMessageListener(callback) {
65
- return (message) => __awaiter(this, void 0, void 0, function* () {
66
- const prodConfMessage = message;
67
- const version = prodConfMessage.version;
68
- if (version !== "1.0") {
69
- console.error(`The a message was passed with an unsupported version "${version}". Currently only ${STAGE_PROD_CONF_MESSAGE_VERSION} is supported.`);
70
- return;
71
- }
72
- yield callback(prodConfMessage);
73
- });
74
- }
75
- /**
76
- * Register the callback to listen for Product Configuration messages
77
- * @returns A function which when called will cancel listening
78
- */
79
- listenForMessage(callback) {
80
- const ioManager = this._ioManager;
81
- const listener = this.makeMessageListener(callback);
82
- ioManager.listen(listener, STAGE_PROD_CONF_MESSAGE_KEY);
83
- return () => {
84
- ioManager.stopListen(listener);
85
- };
86
- }
87
- makeProdConfListener(callback) {
88
- return (n) => {
89
- if (!n.committed) {
90
- return;
91
- }
92
- callback(n.freshRef.getApiSelection());
93
- };
94
- }
95
- listenForProdConf(product, callback) {
96
- const listener = this.makeProdConfListener(callback);
97
- product.listenForChange(listener);
98
- return () => {
99
- product.stopListenForChange(listener);
100
- };
101
- }
102
- }
@@ -1,13 +0,0 @@
1
- import { CfgIOManager } from "./CfgIOManager.js";
2
- export declare type CfgWindowMessageManagerSendData = unknown;
3
- export declare class CfgWindowMessageManager extends CfgIOManager<"message", CfgWindowMessageManagerSendData> {
4
- private readonly _remoteEnds;
5
- private readonly _targetOrigin;
6
- private readonly _acceptableMessageOrigin?;
7
- constructor(_remoteEnds: Window[], _targetOrigin?: string, _acceptableMessageOrigin?: string | undefined);
8
- protected doSend(messageKey: string, data: unknown): void;
9
- protected _containerListener(event: MessageEvent<any>): void;
10
- protected readonly eventType = "message";
11
- protected getDataFromEvent(event: MessageEvent<any>): unknown;
12
- }
13
- //# sourceMappingURL=CfgWindowMessageManager.d.ts.map
@@ -1,33 +0,0 @@
1
- import { CfgIOManager } from "./CfgIOManager.js";
2
- export class CfgWindowMessageManager extends CfgIOManager {
3
- constructor(_remoteEnds, _targetOrigin = "*", _acceptableMessageOrigin) {
4
- super();
5
- this._remoteEnds = _remoteEnds;
6
- this._targetOrigin = _targetOrigin;
7
- this._acceptableMessageOrigin = _acceptableMessageOrigin;
8
- this.eventType = "message";
9
- for (const remote of _remoteEnds) {
10
- if (remote === window) {
11
- console.warn("You are providing your own window as a remote end.");
12
- }
13
- }
14
- }
15
- doSend(messageKey, data) {
16
- const container = CfgIOManager.makeContainer({
17
- [messageKey]: data,
18
- });
19
- for (const remoteEnd of this._remoteEnds) {
20
- remoteEnd.postMessage(container, this._targetOrigin);
21
- }
22
- }
23
- _containerListener(event) {
24
- if (this._acceptableMessageOrigin !== undefined &&
25
- event.origin !== this._acceptableMessageOrigin) {
26
- return;
27
- }
28
- super._containerListener(event);
29
- }
30
- getDataFromEvent(event) {
31
- return event.data;
32
- }
33
- }
@@ -1,6 +0,0 @@
1
- import { CfgCameraConf, CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
2
- import { CfgWindowMessageManager, CfgWindowMessageManagerSendData } from "./CfgWindowMessageManager.js";
3
- export declare class CfgWindowMessageToCameraConfConnector extends CfgIOCameraConfConnector<"message", CfgWindowMessageManagerSendData, CfgWindowMessageManager> {
4
- protected makeSendData(cameraConf: CfgCameraConf, initial: boolean): CfgWindowMessageManagerSendData;
5
- }
6
- //# sourceMappingURL=CfgWindowMessageToCameraConfConnector.d.ts.map
@@ -1,6 +0,0 @@
1
- import { CfgIOCameraConfConnector } from "./CfgIOCameraConfConnector.js";
2
- export class CfgWindowMessageToCameraConfConnector extends CfgIOCameraConfConnector {
3
- makeSendData(cameraConf, initial) {
4
- return this.makeMessage(cameraConf, initial);
5
- }
6
- }
@@ -1,14 +0,0 @@
1
- import { AdditionalProductConfiguration } from "../CatalogueAPI.js";
2
- import { CfgIOProdConfConnector } from "./CfgIOProdConfConnector.js";
3
- import { CfgWindowMessageManager, CfgWindowMessageManagerSendData } from "./CfgWindowMessageManager.js";
4
- /**
5
- * Instantiating the class will expose your product to:
6
- * - Listen for configuration changes posted to this window
7
- * - Send configuration changes using sendMessage
8
- */
9
- export declare class CfgWindowMessageToProdConfConnector extends CfgIOProdConfConnector<"message", CfgWindowMessageManagerSendData, CfgWindowMessageManager> {
10
- constructor(manager: CfgWindowMessageManager, doValidate?: boolean);
11
- protected getInitialProdConf(): string | undefined;
12
- protected makeSendData(prodConf: AdditionalProductConfiguration, initial: boolean): CfgWindowMessageManagerSendData;
13
- }
14
- //# sourceMappingURL=CfgWindowMessageToProdConfConnector.d.ts.map
@@ -1,17 +0,0 @@
1
- import { CfgIOProdConfConnector } from "./CfgIOProdConfConnector.js";
2
- /**
3
- * Instantiating the class will expose your product to:
4
- * - Listen for configuration changes posted to this window
5
- * - Send configuration changes using sendMessage
6
- */
7
- export class CfgWindowMessageToProdConfConnector extends CfgIOProdConfConnector {
8
- constructor(manager, doValidate = true) {
9
- super(manager, doValidate);
10
- }
11
- getInitialProdConf() {
12
- return undefined;
13
- }
14
- makeSendData(prodConf, initial) {
15
- return this.makeMessage(prodConf, initial);
16
- }
17
- }