@shopfront/bridge 2.0.0 → 2.0.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.
- package/.idea/codeStyles/Project.xml +10 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/git_toolbox_blame.xml +6 -0
- package/.idea/git_toolbox_prj.xml +15 -0
- package/.idea/inspectionProfiles/Project_Default.xml +5 -0
- package/.idea/jsLinters/eslint.xml +6 -0
- package/.idea/modules.xml +1 -1
- package/.idea/php.xml +15 -0
- package/lib/APIs/Database/BaseDatabase.d.ts +28 -0
- package/lib/APIs/Database/BaseDatabase.js +5 -0
- package/lib/APIs/Database/Database.d.ts +19 -7
- package/lib/APIs/Database/Database.js +22 -12
- package/lib/APIs/Database/types/BaseBarcodeTemplateRepository.d.ts +8 -0
- package/lib/APIs/Database/types/BaseBarcodeTemplateRepository.js +1 -0
- package/lib/APIs/Database/types/BaseClassificationRepository.d.ts +11 -0
- package/lib/APIs/Database/types/BaseClassificationRepository.js +1 -0
- package/lib/APIs/Database/types/BaseCustomerDisplayRepository.d.ts +10 -0
- package/lib/APIs/Database/types/BaseCustomerDisplayRepository.js +1 -0
- package/lib/APIs/Database/types/BaseCustomerGroupRepository.d.ts +24 -0
- package/lib/APIs/Database/types/BaseCustomerGroupRepository.js +1 -0
- package/lib/APIs/Database/types/BaseCustomerRepository.d.ts +76 -0
- package/lib/APIs/Database/types/BaseCustomerRepository.js +1 -0
- package/lib/APIs/Database/types/BaseEnterpriseRepository.d.ts +8 -0
- package/lib/APIs/Database/types/BaseEnterpriseRepository.js +1 -0
- package/lib/APIs/Database/types/BaseGiftCardRepository.d.ts +18 -0
- package/lib/APIs/Database/types/BaseGiftCardRepository.js +1 -0
- package/lib/APIs/Database/types/BaseKitchenOrderRepository.d.ts +41 -0
- package/lib/APIs/Database/types/BaseKitchenOrderRepository.js +1 -0
- package/lib/APIs/Database/types/BaseKitchenScreenRepository.d.ts +16 -0
- package/lib/APIs/Database/types/BaseKitchenScreenRepository.js +1 -0
- package/lib/APIs/Database/types/BaseLockedResourceRepository.d.ts +12 -0
- package/lib/APIs/Database/types/BaseLockedResourceRepository.js +1 -0
- package/lib/APIs/Database/types/BaseLoyaltyRepository.d.ts +16 -0
- package/lib/APIs/Database/types/BaseLoyaltyRepository.js +1 -0
- package/lib/APIs/Database/types/BaseMovementRepository.d.ts +16 -0
- package/lib/APIs/Database/types/BaseMovementRepository.js +1 -0
- package/lib/APIs/Database/types/BaseOutletRepository.d.ts +19 -0
- package/lib/APIs/Database/types/BaseOutletRepository.js +1 -0
- package/lib/APIs/Database/types/BasePaymentMethodRepository.d.ts +27 -0
- package/lib/APIs/Database/types/BasePaymentMethodRepository.js +1 -0
- package/lib/APIs/Database/types/BasePriceListRepository.d.ts +40 -0
- package/lib/APIs/Database/types/BasePriceListRepository.js +1 -0
- package/lib/APIs/Database/types/BasePriceSetRepository.d.ts +6 -0
- package/lib/APIs/Database/types/BasePriceSetRepository.js +1 -0
- package/lib/APIs/Database/types/BaseProductRepository.d.ts +160 -0
- package/lib/APIs/Database/types/BaseProductRepository.js +1 -0
- package/lib/APIs/Database/types/BasePromotionCategoryRepository.d.ts +10 -0
- package/lib/APIs/Database/types/BasePromotionCategoryRepository.js +1 -0
- package/lib/APIs/Database/types/BasePromotionRepository.d.ts +72 -0
- package/lib/APIs/Database/types/BasePromotionRepository.js +1 -0
- package/lib/APIs/Database/types/BaseReceiptRepository.d.ts +31 -0
- package/lib/APIs/Database/types/BaseReceiptRepository.js +1 -0
- package/lib/APIs/Database/types/BaseRegisterRepository.d.ts +56 -0
- package/lib/APIs/Database/types/BaseRegisterRepository.js +1 -0
- package/lib/APIs/Database/types/BaseRepository.d.ts +41 -0
- package/lib/APIs/Database/types/BaseRepository.js +1 -0
- package/lib/APIs/Database/types/BaseSalesKeyRepository.d.ts +37 -0
- package/lib/APIs/Database/types/BaseSalesKeyRepository.js +1 -0
- package/lib/APIs/Database/types/BaseSalesRepository.d.ts +123 -0
- package/lib/APIs/Database/types/BaseSalesRepository.js +1 -0
- package/lib/APIs/Database/types/BaseSearchableRepository.d.ts +8 -0
- package/lib/APIs/Database/types/BaseSearchableRepository.js +1 -0
- package/lib/APIs/Database/types/BaseStocktakeAccumulatedRepository.d.ts +16 -0
- package/lib/APIs/Database/types/BaseStocktakeAccumulatedRepository.js +1 -0
- package/lib/APIs/Database/types/BaseStocktakeRepository.d.ts +8 -0
- package/lib/APIs/Database/types/BaseStocktakeRepository.js +1 -0
- package/lib/APIs/Database/types/BaseStocktakeScannedRepository.d.ts +24 -0
- package/lib/APIs/Database/types/BaseStocktakeScannedRepository.js +1 -0
- package/lib/APIs/Database/types/BaseSupplierRepository.d.ts +35 -0
- package/lib/APIs/Database/types/BaseSupplierRepository.js +1 -0
- package/lib/APIs/Database/types/BaseTakingsRepository.d.ts +13 -0
- package/lib/APIs/Database/types/BaseTakingsRepository.js +1 -0
- package/lib/APIs/Database/types/BaseTaxRateRepository.d.ts +9 -0
- package/lib/APIs/Database/types/BaseTaxRateRepository.js +1 -0
- package/lib/APIs/Database/types/BaseTransfereeRepository.d.ts +12 -0
- package/lib/APIs/Database/types/BaseTransfereeRepository.js +1 -0
- package/lib/APIs/Database/types/BaseVendorConnectionRepository.d.ts +7 -0
- package/lib/APIs/Database/types/BaseVendorConnectionRepository.js +1 -0
- package/lib/APIs/Database/types/DataSourceTables.d.ts +61 -0
- package/lib/APIs/Database/types/DataSourceTables.js +1 -0
- package/lib/APIs/Fulfilment/FulfilmentTypes.d.ts +2 -2
- package/lib/APIs/Fulfilment/FulfilmentTypes.js +1 -2
- package/lib/APIs/InternalMessages/InternalMessageSource.d.ts +6 -3
- package/lib/APIs/InternalMessages/InternalMessageSource.js +6 -7
- package/lib/APIs/Sale/BaseCurrentSale.d.ts +83 -0
- package/lib/APIs/Sale/BaseCurrentSale.js +13 -0
- package/lib/APIs/Sale/BaseSale.d.ts +3 -38
- package/lib/APIs/Sale/BaseSale.js +1 -40
- package/lib/APIs/Sale/CurrentSale.d.ts +19 -84
- package/lib/APIs/Sale/CurrentSale.js +32 -102
- package/lib/APIs/Sale/Exceptions.d.ts +3 -0
- package/lib/APIs/Sale/Exceptions.js +7 -7
- package/lib/APIs/Sale/Sale.d.ts +39 -7
- package/lib/APIs/Sale/Sale.js +41 -13
- package/lib/APIs/Sale/SaleCustomer.d.ts +0 -2
- package/lib/APIs/Sale/SaleCustomer.js +1 -7
- package/lib/APIs/Sale/SalePayment.d.ts +3 -22
- package/lib/APIs/Sale/SalePayment.js +7 -33
- package/lib/APIs/Sale/SaleProduct.d.ts +6 -46
- package/lib/APIs/Sale/SaleProduct.js +6 -53
- package/lib/APIs/Sale/ShopfrontSaleState.d.ts +7 -9
- package/lib/APIs/Sale/ShopfrontSaleState.js +1 -2
- package/lib/APIs/Sale/index.d.ts +9 -9
- package/lib/APIs/Sale/index.js +7 -39
- package/lib/Actions/BaseAction.d.ts +21 -5
- package/lib/Actions/BaseAction.js +155 -97
- package/lib/Actions/Button.d.ts +2 -2
- package/lib/Actions/Button.js +3 -7
- package/lib/Actions/CustomerListOption.d.ts +2 -2
- package/lib/Actions/CustomerListOption.js +2 -6
- package/lib/Actions/Dialog.d.ts +4 -4
- package/lib/Actions/Dialog.js +2 -6
- package/lib/Actions/Redirect.d.ts +2 -2
- package/lib/Actions/Redirect.js +7 -9
- package/lib/Actions/SaleKey.d.ts +2 -2
- package/lib/Actions/SaleKey.js +3 -7
- package/lib/Actions/SaleUpdate.d.ts +3 -3
- package/lib/Actions/SaleUpdate.js +3 -7
- package/lib/Actions/Toast.d.ts +3 -3
- package/lib/Actions/Toast.js +2 -6
- package/lib/Application.d.ts +114 -78
- package/lib/Application.js +207 -160
- package/lib/ApplicationEvents.d.ts +66 -53
- package/lib/ApplicationEvents.js +10 -6
- package/lib/BaseApplication.d.ts +169 -0
- package/lib/BaseApplication.js +40 -0
- package/lib/BaseBridge.d.ts +33 -0
- package/lib/BaseBridge.js +16 -0
- package/lib/Bridge.d.ts +46 -9
- package/lib/Bridge.js +42 -54
- package/lib/Common/EventEmitter.d.ts +10 -1
- package/lib/Common/EventEmitter.js +10 -5
- package/lib/Common/Serializable.d.ts +8 -6
- package/lib/Common/Serializable.js +1 -2
- package/lib/EmitableEvents/BaseEmitableEvent.d.ts +7 -1
- package/lib/EmitableEvents/BaseEmitableEvent.js +7 -5
- package/lib/EmitableEvents/Fulfilment/Options.d.ts +1 -1
- package/lib/EmitableEvents/Fulfilment/Options.js +4 -8
- package/lib/EmitableEvents/Fulfilment/OrderCancel.d.ts +1 -1
- package/lib/EmitableEvents/Fulfilment/OrderCancel.js +4 -8
- package/lib/EmitableEvents/Fulfilment/OrderCreate.d.ts +2 -2
- package/lib/EmitableEvents/Fulfilment/OrderCreate.js +4 -8
- package/lib/EmitableEvents/Fulfilment/OrderUpdate.d.ts +2 -2
- package/lib/EmitableEvents/Fulfilment/OrderUpdate.js +4 -8
- package/lib/EmitableEvents/Fulfilment/OrdersSync.d.ts +2 -2
- package/lib/EmitableEvents/Fulfilment/OrdersSync.js +4 -8
- package/lib/EmitableEvents/Fulfilment/RegisterIntent.d.ts +2 -2
- package/lib/EmitableEvents/Fulfilment/RegisterIntent.js +4 -8
- package/lib/EmitableEvents/Fulfilment/index.d.ts +7 -7
- package/lib/EmitableEvents/Fulfilment/index.js +6 -15
- package/lib/EmitableEvents/InternalMessage.d.ts +2 -2
- package/lib/EmitableEvents/InternalMessage.js +4 -8
- package/lib/EmitableEvents/SellScreenOption.d.ts +2 -2
- package/lib/EmitableEvents/SellScreenOption.js +7 -11
- package/lib/EmitableEvents/SellScreenPromotionApplicable.d.ts +1 -1
- package/lib/EmitableEvents/SellScreenPromotionApplicable.js +4 -8
- package/lib/EmitableEvents/TableUpdate.d.ts +2 -2
- package/lib/EmitableEvents/TableUpdate.js +4 -8
- package/lib/Events/AudioPermissionChange.d.ts +5 -2
- package/lib/Events/AudioPermissionChange.js +6 -7
- package/lib/Events/AudioReady.d.ts +5 -2
- package/lib/Events/AudioReady.js +6 -7
- package/lib/Events/BaseEvent.d.ts +8 -3
- package/lib/Events/BaseEvent.js +1 -6
- package/lib/Events/Callback.d.ts +5 -2
- package/lib/Events/Callback.js +5 -6
- package/lib/Events/FormatIntegratedProduct.d.ts +27 -32
- package/lib/Events/FormatIntegratedProduct.js +12 -9
- package/lib/Events/FulfilmentCollectOrder.d.ts +5 -2
- package/lib/Events/FulfilmentCollectOrder.js +5 -6
- package/lib/Events/FulfilmentCompleteOrder.d.ts +5 -2
- package/lib/Events/FulfilmentCompleteOrder.js +5 -6
- package/lib/Events/FulfilmentGetOrder.d.ts +12 -6
- package/lib/Events/FulfilmentGetOrder.js +10 -8
- package/lib/Events/FulfilmentOrderApproval.d.ts +5 -2
- package/lib/Events/FulfilmentOrderApproval.js +5 -6
- package/lib/Events/FulfilmentProcessOrder.d.ts +12 -10
- package/lib/Events/FulfilmentProcessOrder.js +7 -8
- package/lib/Events/FulfilmentVoidOrder.d.ts +5 -2
- package/lib/Events/FulfilmentVoidOrder.js +5 -6
- package/lib/Events/GiftCardCodeCheck.d.ts +19 -0
- package/lib/Events/GiftCardCodeCheck.js +23 -0
- package/lib/Events/InternalPageMessage.d.ts +10 -4
- package/lib/Events/InternalPageMessage.js +12 -10
- package/lib/Events/PaymentMethodsEnabled.d.ts +16 -11
- package/lib/Events/PaymentMethodsEnabled.js +10 -8
- package/lib/Events/Ready.d.ts +12 -7
- package/lib/Events/Ready.js +5 -6
- package/lib/Events/RegisterChanged.d.ts +12 -6
- package/lib/Events/RegisterChanged.js +6 -7
- package/lib/Events/RequestButtons.d.ts +17 -12
- package/lib/Events/RequestButtons.js +13 -11
- package/lib/Events/RequestCustomerListOptions.d.ts +11 -5
- package/lib/Events/RequestCustomerListOptions.js +12 -11
- package/lib/Events/RequestSaleKeys.d.ts +12 -6
- package/lib/Events/RequestSaleKeys.js +13 -11
- package/lib/Events/RequestSellScreenOptions.d.ts +18 -5
- package/lib/Events/RequestSellScreenOptions.js +17 -9
- package/lib/Events/RequestSettings.d.ts +11 -5
- package/lib/Events/RequestSettings.js +12 -10
- package/lib/Events/RequestTableColumns.d.ts +16 -11
- package/lib/Events/RequestTableColumns.js +12 -9
- package/lib/Events/SaleComplete.d.ts +15 -18
- package/lib/Events/SaleComplete.js +6 -7
- package/lib/Events/UIPipeline.d.ts +17 -5
- package/lib/Events/UIPipeline.js +17 -10
- package/lib/Mocks/APIs/Sale/MockCurrentSale.d.ts +99 -0
- package/lib/Mocks/APIs/Sale/MockCurrentSale.js +326 -0
- package/lib/Mocks/Database/MockDatabase.d.ts +96 -0
- package/lib/Mocks/Database/MockDatabase.js +89 -0
- package/lib/Mocks/MockApplication.d.ts +154 -0
- package/lib/Mocks/MockApplication.js +481 -0
- package/lib/Mocks/MockBridge.d.ts +31 -0
- package/lib/Mocks/MockBridge.js +77 -0
- package/lib/Mocks/index.d.ts +7 -0
- package/lib/Mocks/index.js +15 -0
- package/lib/Utilities/ActionEventRegistrar.d.ts +19 -4
- package/lib/Utilities/ActionEventRegistrar.js +19 -3
- package/lib/Utilities/MiscTypes.d.ts +6 -4
- package/lib/Utilities/MiscTypes.js +1 -2
- package/lib/Utilities/SaleCreate.d.ts +6 -2
- package/lib/Utilities/SaleCreate.js +10 -6
- package/lib/Utilities/Static.d.ts +3 -0
- package/lib/Utilities/Static.js +5 -7
- package/lib/Utilities/UUID.d.ts +9 -3
- package/lib/Utilities/UUID.js +10 -7
- package/lib/index.d.ts +16 -14
- package/lib/index.js +14 -49
- package/package.json +3 -2
- package/lib/APIs/CurrentSale/Exceptions.d.ts +0 -6
- package/lib/APIs/CurrentSale/Exceptions.js +0 -15
- package/lib/APIs/CurrentSale/Sale.d.ts +0 -182
- package/lib/APIs/CurrentSale/Sale.js +0 -290
- package/lib/APIs/CurrentSale/SaleCustomer.d.ts +0 -10
- package/lib/APIs/CurrentSale/SaleCustomer.js +0 -17
- package/lib/APIs/CurrentSale/SalePayment.d.ts +0 -68
- package/lib/APIs/CurrentSale/SalePayment.js +0 -99
- package/lib/APIs/CurrentSale/SaleProduct.d.ts +0 -121
- package/lib/APIs/CurrentSale/SaleProduct.js +0 -167
- package/lib/APIs/CurrentSale/ShopfrontSaleState.d.ts +0 -53
- package/lib/APIs/CurrentSale/ShopfrontSaleState.js +0 -2
- package/lib/APIs/CurrentSale/index.d.ts +0 -6
- package/lib/APIs/CurrentSale/index.js +0 -37
- /package/.idea/{embedded-bridge.iml → shopfront-embedded-bridge.iml} +0 -0
|
@@ -1,108 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (new.target === BaseAction_1) {
|
|
20
|
-
throw new TypeError("You cannot construct BaseAction instances directly");
|
|
1
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
+
var _, done = false;
|
|
7
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
+
var context = {};
|
|
9
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
+
if (kind === "accessor") {
|
|
14
|
+
if (result === void 0) continue;
|
|
15
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.properties = serialized.properties;
|
|
26
|
-
// Ensure that we are registered in the registry
|
|
27
|
-
BaseAction_1.serializedRegistry[this.target] = type;
|
|
28
|
-
}
|
|
29
|
-
serialize() {
|
|
30
|
-
const events = {};
|
|
31
|
-
for (let i = 0, l = this.events.length; i < l; i++) {
|
|
32
|
-
if (typeof events[this.events[i].type] === "undefined") {
|
|
33
|
-
events[this.events[i].type] = [];
|
|
34
|
-
}
|
|
35
|
-
events[this.events[i].type].push(this.events[i].id);
|
|
20
|
+
else if (_ = accept(result)) {
|
|
21
|
+
if (kind === "field") initializers.unshift(_);
|
|
22
|
+
else descriptor[key] = _;
|
|
36
23
|
}
|
|
37
|
-
return {
|
|
38
|
-
properties: this.serializeProperties(this.properties),
|
|
39
|
-
events: events,
|
|
40
|
-
type: this.target,
|
|
41
|
-
};
|
|
42
24
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
+
done = true;
|
|
27
|
+
};
|
|
28
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
+
var useValue = arguments.length > 2;
|
|
30
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
+
}
|
|
33
|
+
return useValue ? value : void 0;
|
|
34
|
+
};
|
|
35
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
36
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
37
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
38
|
+
};
|
|
39
|
+
import { EventEmitter } from "../Common/EventEmitter.js";
|
|
40
|
+
import ActionEventRegistrar from "../Utilities/ActionEventRegistrar.js";
|
|
41
|
+
import { staticImplements } from "../Utilities/Static.js";
|
|
42
|
+
let BaseAction = (() => {
|
|
43
|
+
let _classDecorators = [staticImplements()];
|
|
44
|
+
let _classDescriptor;
|
|
45
|
+
let _classExtraInitializers = [];
|
|
46
|
+
let _classThis;
|
|
47
|
+
let _classSuper = EventEmitter;
|
|
48
|
+
var BaseAction = _classThis = class extends _classSuper {
|
|
49
|
+
constructor(serialized, type) {
|
|
50
|
+
if (new.target === BaseAction) {
|
|
51
|
+
throw new TypeError("You cannot construct BaseAction instances directly");
|
|
55
52
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
super();
|
|
54
|
+
this.target = serialized.type;
|
|
55
|
+
this.events = [];
|
|
56
|
+
this.properties = serialized.properties;
|
|
57
|
+
// Ensure that we are registered in the registry
|
|
58
|
+
BaseAction.serializedRegistry[this.target] = type;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Serializes the registered action event data (excluding callbacks) and properties
|
|
62
|
+
*/
|
|
63
|
+
serialize() {
|
|
64
|
+
const events = {};
|
|
65
|
+
for (let i = 0, l = this.events.length; i < l; i++) {
|
|
66
|
+
if (typeof events[this.events[i].type] === "undefined") {
|
|
67
|
+
events[this.events[i].type] = [];
|
|
68
|
+
}
|
|
69
|
+
events[this.events[i].type].push(this.events[i].id);
|
|
59
70
|
}
|
|
71
|
+
return {
|
|
72
|
+
properties: this.serializeProperties(this.properties),
|
|
73
|
+
events: events,
|
|
74
|
+
type: this.target,
|
|
75
|
+
};
|
|
60
76
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Recursively serializes the action properties
|
|
79
|
+
*/
|
|
80
|
+
serializeProperties(properties) {
|
|
81
|
+
const results = [];
|
|
82
|
+
// Loop through current layer of properties
|
|
83
|
+
for (let i = 0, l = properties.length; i < l; i++) {
|
|
84
|
+
const property = properties[i];
|
|
85
|
+
if (Array.isArray(property)) {
|
|
86
|
+
// Prepare to recurse through next layer of properties
|
|
87
|
+
results.push(this.serializeProperties(property));
|
|
88
|
+
}
|
|
89
|
+
else if (property instanceof BaseAction) {
|
|
90
|
+
// Serialize property
|
|
91
|
+
results.push(property.serialize());
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// Assume that the property is already serializable
|
|
95
|
+
results.push(property);
|
|
96
|
+
}
|
|
81
97
|
}
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
return results;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Deserializes the action data
|
|
102
|
+
*/
|
|
103
|
+
static deserialize(serialized) {
|
|
104
|
+
return new BaseAction.serializedRegistry[serialized.type](serialized);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Registers an action event listener
|
|
108
|
+
*/
|
|
109
|
+
addEventListener(event, callback) {
|
|
110
|
+
super.addEventListener(event, callback);
|
|
111
|
+
const id = `${Date.now()}-${event}-${Math.random()}`;
|
|
112
|
+
ActionEventRegistrar.add(id, this);
|
|
113
|
+
this.events.push({
|
|
114
|
+
id,
|
|
115
|
+
callback,
|
|
116
|
+
type: event,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Unregisters an action event listener
|
|
121
|
+
*/
|
|
122
|
+
removeEventListener(event, callback) {
|
|
123
|
+
super.removeEventListener(event, callback);
|
|
124
|
+
for (let i = 0, l = this.events.length; i < l; i++) {
|
|
125
|
+
if (this.events[i].type !== event) {
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (this.events[i].callback !== callback) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const id = this.events[i].id;
|
|
132
|
+
ActionEventRegistrar.remove(id);
|
|
133
|
+
this.events = [
|
|
134
|
+
...this.events.slice(0, i),
|
|
135
|
+
...this.events.slice(i + 1),
|
|
136
|
+
];
|
|
137
|
+
break;
|
|
84
138
|
}
|
|
85
|
-
const id = this.events[i].id;
|
|
86
|
-
ActionEventRegistrar_1.default.remove(id);
|
|
87
|
-
this.events = [
|
|
88
|
-
...this.events.slice(0, i),
|
|
89
|
-
...this.events.slice(i + 1),
|
|
90
|
-
];
|
|
91
|
-
break;
|
|
92
139
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Fires the callback for the registered action event
|
|
142
|
+
*/
|
|
143
|
+
handleRegistrarEvent(id, data) {
|
|
144
|
+
for (let i = 0, l = this.events.length; i < l; i++) {
|
|
145
|
+
if (this.events[i].id !== id) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
this.events[i].callback(data);
|
|
149
|
+
break;
|
|
98
150
|
}
|
|
99
|
-
this.events[i].callback(data);
|
|
100
|
-
break;
|
|
101
151
|
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
152
|
+
};
|
|
153
|
+
__setFunctionName(_classThis, "BaseAction");
|
|
154
|
+
(() => {
|
|
155
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
156
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
157
|
+
BaseAction = _classThis = _classDescriptor.value;
|
|
158
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
159
|
+
})();
|
|
160
|
+
_classThis.serializedRegistry = {};
|
|
161
|
+
(() => {
|
|
162
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
163
|
+
})();
|
|
164
|
+
return BaseAction = _classThis;
|
|
165
|
+
})();
|
|
166
|
+
export { BaseAction };
|
package/lib/Actions/Button.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Serialized } from "../Common/Serializable.js";
|
|
2
|
+
import { BaseAction } from "./BaseAction.js";
|
|
3
3
|
export declare class Button extends BaseAction<Button> {
|
|
4
4
|
protected supportedEvents: string[];
|
|
5
5
|
protected label: string;
|
package/lib/Actions/Button.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Button = void 0;
|
|
4
|
-
const BaseAction_1 = require("./BaseAction");
|
|
5
|
-
class Button extends BaseAction_1.BaseAction {
|
|
1
|
+
import { BaseAction } from "./BaseAction.js";
|
|
2
|
+
export class Button extends BaseAction {
|
|
6
3
|
constructor(label, icon) {
|
|
7
4
|
// https://github.com/Microsoft/TypeScript/issues/8277
|
|
8
5
|
super((() => {
|
|
@@ -10,7 +7,7 @@ class Button extends BaseAction_1.BaseAction {
|
|
|
10
7
|
return {
|
|
11
8
|
properties: [label, icon],
|
|
12
9
|
events: {},
|
|
13
|
-
type: "Button"
|
|
10
|
+
type: "Button",
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
13
|
else {
|
|
@@ -33,4 +30,3 @@ class Button extends BaseAction_1.BaseAction {
|
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
|
-
exports.Button = Button;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Serialized } from "../Common/Serializable.js";
|
|
2
|
+
import { BaseAction } from "./BaseAction.js";
|
|
3
3
|
export declare class CustomerListOption extends BaseAction<CustomerListOption> {
|
|
4
4
|
protected supportedEvents: string[];
|
|
5
5
|
protected contents: string;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.CustomerListOption = void 0;
|
|
4
|
-
const BaseAction_1 = require("./BaseAction");
|
|
5
|
-
class CustomerListOption extends BaseAction_1.BaseAction {
|
|
1
|
+
import { BaseAction } from "./BaseAction.js";
|
|
2
|
+
export class CustomerListOption extends BaseAction {
|
|
6
3
|
constructor(contents) {
|
|
7
4
|
super((() => {
|
|
8
5
|
if (typeof contents === "string") {
|
|
@@ -23,4 +20,3 @@ class CustomerListOption extends BaseAction_1.BaseAction {
|
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
|
-
exports.CustomerListOption = CustomerListOption;
|
package/lib/Actions/Dialog.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { Button } from "./Button";
|
|
4
|
-
|
|
1
|
+
import { Serialized } from "../Common/Serializable.js";
|
|
2
|
+
import { BaseAction } from "./BaseAction.js";
|
|
3
|
+
import { Button } from "./Button.js";
|
|
4
|
+
type DialogType = "success" | "information" | "question" | "danger" | "warning" | "error" | "edit" | "frame";
|
|
5
5
|
export declare class Dialog extends BaseAction<Dialog> {
|
|
6
6
|
protected supportedEvents: string[];
|
|
7
7
|
protected type: DialogType;
|
package/lib/Actions/Dialog.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Dialog = void 0;
|
|
4
|
-
const BaseAction_1 = require("./BaseAction");
|
|
5
|
-
class Dialog extends BaseAction_1.BaseAction {
|
|
1
|
+
import { BaseAction } from "./BaseAction.js";
|
|
2
|
+
export class Dialog extends BaseAction {
|
|
6
3
|
constructor(type, closeable, header, content, buttons) {
|
|
7
4
|
// https://github.com/Microsoft/TypeScript/issues/8277
|
|
8
5
|
super((() => {
|
|
@@ -35,4 +32,3 @@ class Dialog extends BaseAction_1.BaseAction {
|
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
|
-
exports.Dialog = Dialog;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Serialized } from "../Common/Serializable.js";
|
|
2
|
+
import { BaseAction } from "./BaseAction.js";
|
|
3
3
|
declare class InternalRedirect extends BaseAction<InternalRedirect> {
|
|
4
4
|
protected supportedEvents: string[];
|
|
5
5
|
protected to: string;
|
package/lib/Actions/Redirect.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Redirect = void 0;
|
|
4
|
-
const BaseAction_1 = require("./BaseAction");
|
|
5
|
-
class InternalRedirect extends BaseAction_1.BaseAction {
|
|
1
|
+
import { BaseAction } from "./BaseAction.js";
|
|
2
|
+
class InternalRedirect extends BaseAction {
|
|
6
3
|
constructor(to) {
|
|
7
4
|
// https://github.com/Microsoft/TypeScript/issues/8277
|
|
8
5
|
super((() => {
|
|
@@ -10,7 +7,7 @@ class InternalRedirect extends BaseAction_1.BaseAction {
|
|
|
10
7
|
return {
|
|
11
8
|
properties: [to],
|
|
12
9
|
events: {},
|
|
13
|
-
type: "InternalRedirect"
|
|
10
|
+
type: "InternalRedirect",
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
13
|
else {
|
|
@@ -26,7 +23,7 @@ class InternalRedirect extends BaseAction_1.BaseAction {
|
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
class ExternalRedirect extends
|
|
26
|
+
class ExternalRedirect extends BaseAction {
|
|
30
27
|
constructor(to) {
|
|
31
28
|
// https://github.com/Microsoft/TypeScript/issues/8277
|
|
32
29
|
super((() => {
|
|
@@ -50,7 +47,8 @@ class ExternalRedirect extends BaseAction_1.BaseAction {
|
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
}
|
|
53
|
-
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
51
|
+
export const Redirect = {
|
|
54
52
|
InternalRedirect,
|
|
55
|
-
ExternalRedirect
|
|
53
|
+
ExternalRedirect,
|
|
56
54
|
};
|
package/lib/Actions/SaleKey.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Serialized } from "../Common/Serializable.js";
|
|
2
|
+
import { BaseAction } from "./BaseAction.js";
|
|
3
3
|
export declare class SaleKey extends BaseAction<SaleKey> {
|
|
4
4
|
protected supportedEvents: string[];
|
|
5
5
|
protected id: string;
|
package/lib/Actions/SaleKey.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SaleKey = void 0;
|
|
4
|
-
const BaseAction_1 = require("./BaseAction");
|
|
5
|
-
class SaleKey extends BaseAction_1.BaseAction {
|
|
1
|
+
import { BaseAction } from "./BaseAction.js";
|
|
2
|
+
export class SaleKey extends BaseAction {
|
|
6
3
|
constructor(id, name) {
|
|
7
4
|
// https://github.com/Microsoft/TypeScript/issues/8277
|
|
8
5
|
super((() => {
|
|
@@ -10,7 +7,7 @@ class SaleKey extends BaseAction_1.BaseAction {
|
|
|
10
7
|
return {
|
|
11
8
|
properties: [id, name],
|
|
12
9
|
events: {},
|
|
13
|
-
type: "Button"
|
|
10
|
+
type: "Button",
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
13
|
else {
|
|
@@ -33,4 +30,3 @@ class SaleKey extends BaseAction_1.BaseAction {
|
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
|
-
exports.SaleKey = SaleKey;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Serialized } from "../Common/Serializable";
|
|
3
|
-
import {
|
|
1
|
+
import { ShopfrontSalePaymentStatus } from "../APIs/Sale/index.js";
|
|
2
|
+
import { Serialized } from "../Common/Serializable.js";
|
|
3
|
+
import { BaseAction } from "./BaseAction.js";
|
|
4
4
|
export interface SaleUpdateChanges {
|
|
5
5
|
PRODUCT_ADD: {
|
|
6
6
|
id: string;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SaleUpdate = void 0;
|
|
4
|
-
const BaseAction_1 = require("./BaseAction");
|
|
5
|
-
class SaleUpdate extends BaseAction_1.BaseAction {
|
|
1
|
+
import { BaseAction } from "./BaseAction.js";
|
|
2
|
+
export class SaleUpdate extends BaseAction {
|
|
6
3
|
constructor(type, data) {
|
|
7
4
|
// https://github.com/Microsoft/TypeScript/issues/8277
|
|
8
5
|
super((() => {
|
|
@@ -10,7 +7,7 @@ class SaleUpdate extends BaseAction_1.BaseAction {
|
|
|
10
7
|
return {
|
|
11
8
|
properties: [type, data],
|
|
12
9
|
events: {},
|
|
13
|
-
type: "SaleUpdate"
|
|
10
|
+
type: "SaleUpdate",
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
13
|
else {
|
|
@@ -33,4 +30,3 @@ class SaleUpdate extends BaseAction_1.BaseAction {
|
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
|
-
exports.SaleUpdate = SaleUpdate;
|
package/lib/Actions/Toast.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
1
|
+
import { Serialized } from "../Common/Serializable.js";
|
|
2
|
+
import { BaseAction } from "./BaseAction.js";
|
|
3
|
+
export type ToastType = "success" | "error" | "information" | "warning";
|
|
4
4
|
export declare class Toast extends BaseAction<Toast> {
|
|
5
5
|
protected supportedEvents: string[];
|
|
6
6
|
protected type: ToastType;
|
package/lib/Actions/Toast.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Toast = void 0;
|
|
4
|
-
const BaseAction_1 = require("./BaseAction");
|
|
5
|
-
class Toast extends BaseAction_1.BaseAction {
|
|
1
|
+
import { BaseAction } from "./BaseAction.js";
|
|
2
|
+
export class Toast extends BaseAction {
|
|
6
3
|
constructor(type, message) {
|
|
7
4
|
// https://github.com/Microsoft/TypeScript/issues/8277
|
|
8
5
|
super((() => {
|
|
@@ -29,4 +26,3 @@ class Toast extends BaseAction_1.BaseAction {
|
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
exports.Toast = Toast;
|