@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,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
5
|
-
const ApplicationEvents_1 = require("../ApplicationEvents");
|
|
6
|
-
class PaymentMethodsEnabled extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { ToShopfront, } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
3
|
+
export class PaymentMethodsEnabled extends BaseEvent {
|
|
7
4
|
constructor(callback) {
|
|
8
5
|
super(callback);
|
|
9
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
10
|
async emit(data) {
|
|
11
11
|
const result = await this.callback(data.data, data.context);
|
|
12
12
|
if (typeof result !== "object" || result === null) {
|
|
@@ -14,8 +14,10 @@ class PaymentMethodsEnabled extends BaseEvent_1.BaseEvent {
|
|
|
14
14
|
}
|
|
15
15
|
return result;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Sends the response data to Shopfront
|
|
19
|
+
*/
|
|
17
20
|
static async respond(bridge, data, id) {
|
|
18
|
-
bridge.sendMessage(
|
|
21
|
+
bridge.sendMessage(ToShopfront.RESPONSE_UI_PIPELINE, data, id);
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
|
-
exports.PaymentMethodsEnabled = PaymentMethodsEnabled;
|
package/lib/Events/Ready.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { FromShopfrontCallbacks, FromShopfrontReturns, RegisterChangedEvent } from "../ApplicationEvents";
|
|
2
|
-
import { BaseEvent } from "./BaseEvent";
|
|
1
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns, RegisterChangedEvent } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
3
|
+
interface ReadyData {
|
|
4
|
+
outlet: string | null;
|
|
5
|
+
register: string | null;
|
|
6
|
+
user: string | null;
|
|
7
|
+
}
|
|
3
8
|
export declare class Ready extends BaseEvent<RegisterChangedEvent> {
|
|
4
9
|
constructor(callback: FromShopfrontCallbacks["READY"]);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}): Promise<FromShopfrontReturns["READY"]>;
|
|
10
|
+
/**
|
|
11
|
+
* @inheritDoc
|
|
12
|
+
*/
|
|
13
|
+
emit(data: ReadyData): Promise<FromShopfrontReturns["READY"]>;
|
|
10
14
|
}
|
|
15
|
+
export {};
|
package/lib/Events/Ready.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Ready = void 0;
|
|
4
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
5
|
-
class Ready extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
2
|
+
export class Ready extends BaseEvent {
|
|
6
3
|
constructor(callback) {
|
|
7
4
|
super(callback);
|
|
8
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* @inheritDoc
|
|
8
|
+
*/
|
|
9
9
|
async emit(data) {
|
|
10
10
|
return this.callback({
|
|
11
11
|
outlet: data.outlet,
|
|
@@ -14,4 +14,3 @@ class Ready extends BaseEvent_1.BaseEvent {
|
|
|
14
14
|
}, undefined);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
exports.Ready = Ready;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
3
|
+
interface RegisterChangedData {
|
|
4
|
+
outlet: string | null;
|
|
5
|
+
register: string | null;
|
|
6
|
+
user: string | null;
|
|
7
|
+
}
|
|
3
8
|
export declare class RegisterChanged extends BaseEvent {
|
|
4
9
|
constructor(callback: FromShopfrontCallbacks["REGISTER_CHANGED"]);
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* @inheritDoc
|
|
12
|
+
*/
|
|
13
|
+
emit(data: RegisterChangedData): Promise<FromShopfrontReturns["REGISTER_CHANGED"]>;
|
|
9
14
|
}
|
|
15
|
+
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.RegisterChanged = void 0;
|
|
4
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
5
|
-
class RegisterChanged extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
2
|
+
export class RegisterChanged extends BaseEvent {
|
|
6
3
|
constructor(callback) {
|
|
7
4
|
super(callback);
|
|
8
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* @inheritDoc
|
|
8
|
+
*/
|
|
9
9
|
async emit(data) {
|
|
10
|
-
this.callback(data, undefined);
|
|
10
|
+
return this.callback(data, undefined);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
exports.RegisterChanged = RegisterChanged;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { MaybePromise } from "../Utilities/MiscTypes";
|
|
5
|
-
|
|
1
|
+
import { Button } from "../Actions/Button.js";
|
|
2
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents.js";
|
|
3
|
+
import { BaseBridge } from "../BaseBridge.js";
|
|
4
|
+
import { MaybePromise } from "../Utilities/MiscTypes.js";
|
|
5
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
6
|
+
interface RequestButtonsData {
|
|
6
7
|
location: string;
|
|
7
8
|
id: string;
|
|
8
9
|
context: unknown;
|
|
9
|
-
}
|
|
10
|
+
}
|
|
11
|
+
export declare class RequestButtons extends BaseEvent<RequestButtonsData, MaybePromise<FromShopfrontReturns["REQUEST_BUTTONS"]>, MaybePromise<FromShopfrontReturns["REQUEST_BUTTONS"]>, string, unknown> {
|
|
10
12
|
constructor(callback: FromShopfrontCallbacks["REQUEST_BUTTONS"]);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @inheritDoc
|
|
15
|
+
*/
|
|
16
|
+
emit(data: RequestButtonsData): Promise<FromShopfrontReturns["REQUEST_BUTTONS"]>;
|
|
17
|
+
/**
|
|
18
|
+
* Sends the response data to Shopfront
|
|
19
|
+
*/
|
|
20
|
+
static respond(bridge: BaseBridge, buttons: Array<Button>, id: string): Promise<void>;
|
|
17
21
|
}
|
|
22
|
+
export {};
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const __1 = require("..");
|
|
6
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
7
|
-
class RequestButtons extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { Button } from "../Actions/Button.js";
|
|
2
|
+
import { ToShopfront } from "../ApplicationEvents.js";
|
|
3
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
4
|
+
export class RequestButtons extends BaseEvent {
|
|
8
5
|
constructor(callback) {
|
|
9
6
|
super(callback);
|
|
10
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
11
|
async emit(data) {
|
|
12
12
|
let result = await this.callback(data.location, data.context);
|
|
13
13
|
if (!Array.isArray(result)) {
|
|
14
14
|
result = [result];
|
|
15
15
|
}
|
|
16
16
|
for (let i = 0, l = result.length; i < l; i++) {
|
|
17
|
-
if (!(result[i] instanceof
|
|
17
|
+
if (!(result[i] instanceof Button)) {
|
|
18
18
|
throw new TypeError("You must return an instance of Button");
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
return result;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Sends the response data to Shopfront
|
|
25
|
+
*/
|
|
23
26
|
static async respond(bridge, buttons, id) {
|
|
24
27
|
const response = [];
|
|
25
28
|
for (let i = 0, l = buttons.length; i < l; i++) {
|
|
26
|
-
if (!(buttons[i] instanceof
|
|
29
|
+
if (!(buttons[i] instanceof Button)) {
|
|
27
30
|
throw new TypeError("Invalid response returned, expected button");
|
|
28
31
|
}
|
|
29
32
|
response.push(buttons[i].serialize());
|
|
30
33
|
}
|
|
31
|
-
bridge.sendMessage(
|
|
34
|
+
bridge.sendMessage(ToShopfront.RESPONSE_BUTTONS, response, id);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
exports.RequestButtons = RequestButtons;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseBridge } from "../BaseBridge.js";
|
|
3
|
+
import { MaybePromise } from "../Utilities/MiscTypes.js";
|
|
4
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
5
5
|
export interface SellScreenCustomerListOption {
|
|
6
6
|
contents: string;
|
|
7
7
|
onClick: () => void;
|
|
8
8
|
}
|
|
9
9
|
export declare class RequestCustomerListOptions extends BaseEvent<Record<string, unknown>, MaybePromise<FromShopfrontReturns["REQUEST_CUSTOMER_LIST_OPTIONS"]>, FromShopfrontReturns["REQUEST_CUSTOMER_LIST_OPTIONS"], undefined> {
|
|
10
10
|
constructor(callback: FromShopfrontCallbacks["REQUEST_CUSTOMER_LIST_OPTIONS"]);
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
11
14
|
emit(_: Record<string, unknown>): Promise<FromShopfrontReturns["REQUEST_CUSTOMER_LIST_OPTIONS"]>;
|
|
12
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Sends the response data to Shopfront
|
|
17
|
+
*/
|
|
18
|
+
static respond(bridge: BaseBridge, options: Array<SellScreenCustomerListOption>, id: string): Promise<void>;
|
|
13
19
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
6
|
-
const CustomerListOption_1 = require("../Actions/CustomerListOption");
|
|
7
|
-
class RequestCustomerListOptions extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { CustomerListOption } from "../Actions/CustomerListOption.js";
|
|
2
|
+
import { ToShopfront } from "../ApplicationEvents.js";
|
|
3
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
4
|
+
export class RequestCustomerListOptions extends BaseEvent {
|
|
8
5
|
constructor(callback) {
|
|
9
6
|
super(callback);
|
|
10
7
|
}
|
|
11
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
12
11
|
async emit(_) {
|
|
13
12
|
let result = await this.callback(undefined, undefined);
|
|
14
13
|
if (!Array.isArray(result)) {
|
|
@@ -21,12 +20,14 @@ class RequestCustomerListOptions extends BaseEvent_1.BaseEvent {
|
|
|
21
20
|
}
|
|
22
21
|
return result;
|
|
23
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Sends the response data to Shopfront
|
|
25
|
+
*/
|
|
24
26
|
static async respond(bridge, options, id) {
|
|
25
|
-
bridge.sendMessage(
|
|
26
|
-
const o = new
|
|
27
|
+
bridge.sendMessage(ToShopfront.RESPONSE_CUSTOMER_LIST_OPTIONS, options.map(option => {
|
|
28
|
+
const o = new CustomerListOption(option.contents);
|
|
27
29
|
o.addEventListener("click", option.onClick);
|
|
28
30
|
return o.serialize();
|
|
29
31
|
}), id);
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
exports.RequestCustomerListOptions = RequestCustomerListOptions;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { SaleKey } from "../Actions/SaleKey.js";
|
|
2
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents.js";
|
|
3
|
+
import { BaseBridge } from "../BaseBridge.js";
|
|
4
|
+
import { MaybePromise } from "../Utilities/MiscTypes.js";
|
|
5
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
6
6
|
export declare class RequestSaleKeys extends BaseEvent<undefined, MaybePromise<Array<SaleKey>>, Array<SaleKey>> {
|
|
7
7
|
constructor(callback: FromShopfrontCallbacks["REQUEST_SALE_KEYS"]);
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
8
11
|
emit(): Promise<FromShopfrontReturns["REQUEST_SALE_KEYS"]>;
|
|
9
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Sends the response data to Shopfront
|
|
14
|
+
*/
|
|
15
|
+
static respond(bridge: BaseBridge, keys: Array<SaleKey>, id: string): Promise<void>;
|
|
10
16
|
}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
6
|
-
const SaleKey_1 = require("../Actions/SaleKey");
|
|
7
|
-
class RequestSaleKeys extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { SaleKey } from "../Actions/SaleKey.js";
|
|
2
|
+
import { ToShopfront } from "../ApplicationEvents.js";
|
|
3
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
4
|
+
export class RequestSaleKeys extends BaseEvent {
|
|
8
5
|
constructor(callback) {
|
|
9
6
|
super(callback);
|
|
10
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @inheritDoc
|
|
10
|
+
*/
|
|
11
11
|
async emit() {
|
|
12
12
|
let result = await this.callback(undefined, undefined);
|
|
13
13
|
if (!Array.isArray(result)) {
|
|
14
14
|
result = [result];
|
|
15
15
|
}
|
|
16
16
|
for (let i = 0, l = result.length; i < l; i++) {
|
|
17
|
-
if (!(result[i] instanceof
|
|
17
|
+
if (!(result[i] instanceof SaleKey)) {
|
|
18
18
|
throw new TypeError("You must return an instance of SaleKey");
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
return result;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Sends the response data to Shopfront
|
|
25
|
+
*/
|
|
23
26
|
static async respond(bridge, keys, id) {
|
|
24
27
|
const response = [];
|
|
25
28
|
for (let i = 0, l = keys.length; i < l; i++) {
|
|
26
|
-
if (!(keys[i] instanceof
|
|
29
|
+
if (!(keys[i] instanceof SaleKey)) {
|
|
27
30
|
throw new TypeError("Invalid response returned, expected SaleKey");
|
|
28
31
|
}
|
|
29
32
|
response.push(keys[i].serialize());
|
|
30
33
|
}
|
|
31
|
-
bridge.sendMessage(
|
|
34
|
+
bridge.sendMessage(ToShopfront.RESPONSE_SALE_KEYS, response, id);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
exports.RequestSaleKeys = RequestSaleKeys;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseBridge } from "../BaseBridge.js";
|
|
3
|
+
import { MaybePromise } from "../Utilities/MiscTypes.js";
|
|
4
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
5
5
|
export interface SellScreenOption {
|
|
6
6
|
url: string;
|
|
7
7
|
title: string;
|
|
@@ -9,8 +9,21 @@ export interface SellScreenOption {
|
|
|
9
9
|
}
|
|
10
10
|
export declare class RequestSellScreenOptions extends BaseEvent<undefined, MaybePromise<FromShopfrontReturns["REQUEST_SELL_SCREEN_OPTIONS"]>, FromShopfrontReturns["REQUEST_SELL_SCREEN_OPTIONS"]> {
|
|
11
11
|
constructor(callback: FromShopfrontCallbacks["REQUEST_SELL_SCREEN_OPTIONS"]);
|
|
12
|
+
/**
|
|
13
|
+
* Generates a unique identifier for a URL by encoding it to base64.
|
|
14
|
+
* If the URL contains non-ASCII characters, it first URI-encodes the URL before converting to base64.
|
|
15
|
+
*/
|
|
12
16
|
static getOptionId(url: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Validates the URL by ensuring it follows the HTTPS protocol
|
|
19
|
+
*/
|
|
13
20
|
static validateURL(url: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* @inheritDoc
|
|
23
|
+
*/
|
|
14
24
|
emit(_: never): Promise<FromShopfrontReturns["REQUEST_SELL_SCREEN_OPTIONS"]>;
|
|
15
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Sends the response data to Shopfront
|
|
27
|
+
*/
|
|
28
|
+
static respond(bridge: BaseBridge, options: Array<SellScreenOption>, id: string): Promise<void>;
|
|
16
29
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ApplicationEvents_1 = require("../ApplicationEvents");
|
|
5
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
6
|
-
class RequestSellScreenOptions extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { ToShopfront } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
3
|
+
export class RequestSellScreenOptions extends BaseEvent {
|
|
7
4
|
constructor(callback) {
|
|
8
5
|
super(callback);
|
|
9
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Generates a unique identifier for a URL by encoding it to base64.
|
|
9
|
+
* If the URL contains non-ASCII characters, it first URI-encodes the URL before converting to base64.
|
|
10
|
+
*/
|
|
10
11
|
static getOptionId(url) {
|
|
11
12
|
try {
|
|
12
13
|
return btoa(url);
|
|
@@ -16,13 +17,18 @@ class RequestSellScreenOptions extends BaseEvent_1.BaseEvent {
|
|
|
16
17
|
return btoa(encodeURI(url));
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Validates the URL by ensuring it follows the HTTPS protocol
|
|
22
|
+
*/
|
|
19
23
|
static validateURL(url) {
|
|
20
24
|
const urlObj = new URL(url);
|
|
21
25
|
if (urlObj.protocol !== "https:") {
|
|
22
26
|
throw new TypeError(`The URL "${url}" is invalid, please ensure that you're using the HTTPS protocol`);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
|
-
|
|
29
|
+
/**
|
|
30
|
+
* @inheritDoc
|
|
31
|
+
*/
|
|
26
32
|
async emit(_) {
|
|
27
33
|
let result = await this.callback(undefined, undefined);
|
|
28
34
|
if (!Array.isArray(result)) {
|
|
@@ -37,8 +43,10 @@ class RequestSellScreenOptions extends BaseEvent_1.BaseEvent {
|
|
|
37
43
|
}
|
|
38
44
|
return result;
|
|
39
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Sends the response data to Shopfront
|
|
48
|
+
*/
|
|
40
49
|
static async respond(bridge, options, id) {
|
|
41
|
-
bridge.sendMessage(
|
|
50
|
+
bridge.sendMessage(ToShopfront.RESPONSE_SELL_SCREEN_OPTIONS, options, id);
|
|
42
51
|
}
|
|
43
52
|
}
|
|
44
|
-
exports.RequestSellScreenOptions = RequestSellScreenOptions;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseBridge } from "../BaseBridge.js";
|
|
3
|
+
import { MaybePromise } from "../Utilities/MiscTypes.js";
|
|
4
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
5
5
|
export declare class RequestSettings extends BaseEvent<undefined, MaybePromise<FromShopfrontReturns["REQUEST_SETTINGS"]>, FromShopfrontReturns["REQUEST_SETTINGS"]> {
|
|
6
6
|
constructor(callback: FromShopfrontCallbacks["REQUEST_SETTINGS"]);
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
7
10
|
emit(_: never): Promise<FromShopfrontReturns["REQUEST_SETTINGS"]>;
|
|
8
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Sends the response data to Shopfront
|
|
13
|
+
*/
|
|
14
|
+
static respond(bridge: BaseBridge, settings: Array<FromShopfrontReturns["REQUEST_SETTINGS"]>, id: string): Promise<void>;
|
|
9
15
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ApplicationEvents_1 = require("../ApplicationEvents");
|
|
5
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
6
|
-
class RequestSettings extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { ToShopfront } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
3
|
+
export class RequestSettings extends BaseEvent {
|
|
7
4
|
constructor(callback) {
|
|
8
5
|
super(callback);
|
|
9
6
|
}
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
11
10
|
async emit(_) {
|
|
12
11
|
const result = await this.callback(undefined, undefined);
|
|
13
12
|
if (typeof result !== "object" || result === null) {
|
|
@@ -15,11 +14,14 @@ class RequestSettings extends BaseEvent_1.BaseEvent {
|
|
|
15
14
|
}
|
|
16
15
|
return result;
|
|
17
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Sends the response data to Shopfront
|
|
19
|
+
*/
|
|
18
20
|
static async respond(bridge, settings, id) {
|
|
19
21
|
if (settings.length > 1) {
|
|
20
|
-
throw new Error("Multiple settings responses found,
|
|
22
|
+
throw new Error("Multiple settings responses found, " +
|
|
23
|
+
"please ensure you are only subscribed to REQUEST_SETTINGS once");
|
|
21
24
|
}
|
|
22
|
-
bridge.sendMessage(
|
|
25
|
+
bridge.sendMessage(ToShopfront.RESPONSE_SETTINGS, settings[0], id);
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
|
-
exports.RequestSettings = RequestSettings;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseBridge } from "../BaseBridge.js";
|
|
3
|
+
import { MaybePromise } from "../Utilities/MiscTypes.js";
|
|
4
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
5
|
+
interface RequestTableColumnsData {
|
|
6
6
|
location: string;
|
|
7
7
|
context: unknown;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
|
+
export declare class RequestTableColumns extends BaseEvent<RequestTableColumnsData, MaybePromise<FromShopfrontReturns["REQUEST_TABLE_COLUMNS"]>, FromShopfrontReturns["REQUEST_TABLE_COLUMNS"], string, unknown> {
|
|
9
10
|
constructor(callback: FromShopfrontCallbacks["REQUEST_TABLE_COLUMNS"]);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
14
|
+
emit(data: RequestTableColumnsData): Promise<FromShopfrontReturns["REQUEST_TABLE_COLUMNS"]>;
|
|
15
|
+
/**
|
|
16
|
+
* Sends the response data to Shopfront
|
|
17
|
+
*/
|
|
18
|
+
static respond(bridge: BaseBridge, columns: Array<FromShopfrontReturns["REQUEST_TABLE_COLUMNS"]>, id: string): Promise<void>;
|
|
15
19
|
}
|
|
20
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ApplicationEvents_1 = require("../ApplicationEvents");
|
|
5
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
6
|
-
class RequestTableColumns extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { ToShopfront } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
3
|
+
export class RequestTableColumns extends BaseEvent {
|
|
7
4
|
constructor(callback) {
|
|
8
5
|
super(callback);
|
|
9
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* @inheritDoc
|
|
9
|
+
*/
|
|
10
10
|
async emit(data) {
|
|
11
11
|
const result = await this.callback(data.location, data.context);
|
|
12
12
|
if (typeof result !== "object") {
|
|
@@ -14,12 +14,15 @@ class RequestTableColumns extends BaseEvent_1.BaseEvent {
|
|
|
14
14
|
}
|
|
15
15
|
return result;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Sends the response data to Shopfront
|
|
19
|
+
*/
|
|
17
20
|
static async respond(bridge, columns, id) {
|
|
18
21
|
columns = columns.filter(column => column !== null);
|
|
19
22
|
if (columns.length > 1) {
|
|
20
|
-
throw new Error("Multiple table column responses found,
|
|
23
|
+
throw new Error("Multiple table column responses found," +
|
|
24
|
+
"please ensure you are only subscribed to REQUEST_TABLE_COLUMNS once");
|
|
21
25
|
}
|
|
22
|
-
bridge.sendMessage(
|
|
26
|
+
bridge.sendMessage(ToShopfront.RESPONSE_TABLE_COLUMNS, columns[0], id);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
|
-
exports.RequestTableColumns = RequestTableColumns;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents.js";
|
|
2
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
3
3
|
interface CompletedSaleProduct {
|
|
4
4
|
uuid: string;
|
|
5
5
|
type: "Normal" | "Product" | "GiftCard" | "Voucher" | "Basket" | "Package" | "Component" | "Integrated";
|
|
@@ -28,19 +28,15 @@ interface CompletedSaleProduct {
|
|
|
28
28
|
defaultProducts: Array<CompletedSaleProduct>;
|
|
29
29
|
special: boolean;
|
|
30
30
|
edited: boolean;
|
|
31
|
-
promotions: {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
amount: number;
|
|
41
|
-
quantity: number;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
31
|
+
promotions: Record<string, {
|
|
32
|
+
name: string;
|
|
33
|
+
active: boolean;
|
|
34
|
+
quantity: number;
|
|
35
|
+
}>;
|
|
36
|
+
rebates: Record<string, {
|
|
37
|
+
amount: number;
|
|
38
|
+
quantity: number;
|
|
39
|
+
}>;
|
|
44
40
|
giftCard: {
|
|
45
41
|
code: string;
|
|
46
42
|
amount: number;
|
|
@@ -56,9 +52,7 @@ interface CompletedSaleProduct {
|
|
|
56
52
|
discountReason?: string;
|
|
57
53
|
requestPrice?: boolean;
|
|
58
54
|
lockQuantity: boolean;
|
|
59
|
-
metaData:
|
|
60
|
-
[key: string]: unknown;
|
|
61
|
-
};
|
|
55
|
+
metaData: Record<string, unknown>;
|
|
62
56
|
}
|
|
63
57
|
interface CompletedSalePayment {
|
|
64
58
|
method: string;
|
|
@@ -108,6 +102,9 @@ export interface CompletedSale {
|
|
|
108
102
|
}
|
|
109
103
|
export declare class SaleComplete extends BaseEvent {
|
|
110
104
|
constructor(callback: FromShopfrontCallbacks["SALE_COMPLETE"]);
|
|
105
|
+
/**
|
|
106
|
+
* @inheritDoc
|
|
107
|
+
*/
|
|
111
108
|
emit(data: CompletedSale): Promise<FromShopfrontReturns["SALE_COMPLETE"]>;
|
|
112
109
|
}
|
|
113
110
|
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.SaleComplete = void 0;
|
|
4
|
-
const BaseEvent_1 = require("./BaseEvent");
|
|
5
|
-
class SaleComplete extends BaseEvent_1.BaseEvent {
|
|
1
|
+
import { BaseEvent } from "./BaseEvent.js";
|
|
2
|
+
export class SaleComplete extends BaseEvent {
|
|
6
3
|
constructor(callback) {
|
|
7
4
|
super(callback);
|
|
8
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* @inheritDoc
|
|
8
|
+
*/
|
|
9
9
|
async emit(data) {
|
|
10
|
-
this.callback(data, undefined);
|
|
10
|
+
return this.callback(data, undefined);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
exports.SaleComplete = SaleComplete;
|