@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
package/lib/Application.d.ts
CHANGED
|
@@ -1,90 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { Sale } from "./APIs/Sale";
|
|
11
|
-
export interface ShopfrontEmbeddedVerificationToken {
|
|
12
|
-
auth: string;
|
|
13
|
-
id: string;
|
|
14
|
-
app: string;
|
|
15
|
-
user: string;
|
|
16
|
-
url: {
|
|
17
|
-
raw: string;
|
|
18
|
-
loaded: string;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export interface ShopfrontEmbeddedTokenError {
|
|
22
|
-
error: boolean;
|
|
23
|
-
type: string;
|
|
24
|
-
}
|
|
25
|
-
export declare class ShopfrontTokenDecodingError extends Error {
|
|
26
|
-
}
|
|
27
|
-
export declare class ShopfrontTokenRequestError extends Error {
|
|
28
|
-
}
|
|
29
|
-
export declare class Application {
|
|
30
|
-
protected bridge: Bridge;
|
|
31
|
-
protected isReady: boolean;
|
|
32
|
-
protected key: string;
|
|
33
|
-
protected register: string | null;
|
|
34
|
-
protected outlet: string | null;
|
|
35
|
-
protected user: string | null;
|
|
36
|
-
protected signingKey: CryptoKeyPair | undefined;
|
|
37
|
-
protected listeners: {
|
|
38
|
-
[key in keyof Omit<FromShopfront, "CALLBACK">]: Map<(...args: Array<unknown>) => void, FromShopfront[key] & BaseEvent>;
|
|
39
|
-
};
|
|
40
|
-
protected directListeners: {
|
|
41
|
-
[K in DirectShopfrontEvent]?: Set<(data: unknown) => void | Promise<void>>;
|
|
42
|
-
};
|
|
43
|
-
database: Database;
|
|
1
|
+
import { CurrentSale } from "./APIs/Sale/CurrentSale.js";
|
|
2
|
+
import { Sale, ShopfrontSaleState } from "./APIs/Sale/index.js";
|
|
3
|
+
import { DirectShopfrontEvent, DirectShopfrontEventCallback, FromShopfront, FromShopfrontCallbacks, FromShopfrontInternal, ListenableFromShopfrontEvents, RegisterChangedEvent, SellScreenActionMode, SellScreenSummaryMode, SoundEvents } from "./ApplicationEvents.js";
|
|
4
|
+
import { BaseApplication, ShopfrontEmbeddedTokenError, ShopfrontEmbeddedVerificationToken, ShopfrontResponse } from "./BaseApplication.js";
|
|
5
|
+
import { Bridge } from "./Bridge.js";
|
|
6
|
+
import { Serializable } from "./Common/Serializable.js";
|
|
7
|
+
import { BaseEmitableEvent } from "./EmitableEvents/BaseEmitableEvent.js";
|
|
8
|
+
import { MaybePromise } from "./Utilities/MiscTypes.js";
|
|
9
|
+
export declare class Application extends BaseApplication {
|
|
44
10
|
constructor(bridge: Bridge);
|
|
11
|
+
/**
|
|
12
|
+
* @inheritDoc
|
|
13
|
+
*/
|
|
45
14
|
destroy(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Handles an application event
|
|
17
|
+
*/
|
|
46
18
|
protected handleEvent: (event: keyof FromShopfront | keyof FromShopfrontInternal, data: Record<string, unknown>, id: string) => void;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Calls any registered listeners for the received event
|
|
21
|
+
*/
|
|
22
|
+
protected emit(event: ListenableFromShopfrontEvents | DirectShopfrontEvent, data: Record<string, unknown> | undefined, id: string): MaybePromise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
addEventListener<E extends ListenableFromShopfrontEvents>(event: E, callback: FromShopfrontCallbacks[E]): void;
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
addEventListener(event: DirectShopfrontEvent, callback: DirectShopfrontEventCallback): void;
|
|
31
|
+
/**
|
|
32
|
+
* @inheritDoc
|
|
33
|
+
*/
|
|
50
34
|
removeEventListener<E extends keyof FromShopfrontCallbacks>(event: E, callback: FromShopfrontCallbacks[E]): void;
|
|
35
|
+
/**
|
|
36
|
+
* @inheritDoc
|
|
37
|
+
*/
|
|
51
38
|
removeEventListener<D>(event: DirectShopfrontEvent, callback: (event: D) => MaybePromise<void>): void;
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
send(item: BaseEmitableEvent<unknown> | Serializable<unknown>): void;
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
54
46
|
download(file: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
55
50
|
redirect(toLocation: string, externalRedirect?: boolean): void;
|
|
51
|
+
/**
|
|
52
|
+
* @inheritDoc
|
|
53
|
+
*/
|
|
56
54
|
load(): () => void;
|
|
55
|
+
/**
|
|
56
|
+
* Handles an event callback via the `ActionEventRegistrar`
|
|
57
|
+
*/
|
|
57
58
|
protected handleEventCallback(data: {
|
|
58
59
|
id?: string;
|
|
59
60
|
data: unknown;
|
|
60
61
|
}): void;
|
|
61
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Updates the cached location data
|
|
64
|
+
*/
|
|
65
|
+
protected handleLocationChanged(data: RegisterChangedEvent): undefined;
|
|
66
|
+
/**
|
|
67
|
+
* @inheritDoc
|
|
68
|
+
*/
|
|
62
69
|
getAuthenticationKey(): string;
|
|
70
|
+
/**
|
|
71
|
+
* Checks whether `data` is formatted as a sale event
|
|
72
|
+
*/
|
|
63
73
|
protected dataIsSaleEvent(data: Record<string, unknown>): data is {
|
|
64
74
|
requestId: string;
|
|
65
75
|
saleState: ShopfrontSaleState | false;
|
|
66
76
|
};
|
|
67
77
|
/**
|
|
68
|
-
*
|
|
69
|
-
* then this will return false.
|
|
70
|
-
*
|
|
71
|
-
* @returns {Promise<CurrentSale | boolean>}
|
|
78
|
+
* @inheritDoc
|
|
72
79
|
*/
|
|
73
80
|
getCurrentSale(): Promise<CurrentSale | false>;
|
|
81
|
+
/**
|
|
82
|
+
* Checks whether `data` is formatted as response data from a 'create sale' request
|
|
83
|
+
*/
|
|
74
84
|
protected dataIsCreateEvent(data: Record<string, unknown>): data is {
|
|
75
85
|
requestId: string;
|
|
76
86
|
success: boolean;
|
|
77
87
|
message?: string;
|
|
78
88
|
};
|
|
79
89
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* @param sale
|
|
90
|
+
* @inheritDoc
|
|
83
91
|
*/
|
|
84
92
|
createSale(sale: Sale): Promise<{
|
|
85
93
|
success: boolean;
|
|
86
94
|
message?: string;
|
|
87
95
|
}>;
|
|
96
|
+
/**
|
|
97
|
+
* Checks whether `data` is formatted as location data
|
|
98
|
+
*/
|
|
88
99
|
protected dataIsLocation(data: Record<string, unknown>): data is {
|
|
89
100
|
requestId: string;
|
|
90
101
|
register: string | null;
|
|
@@ -92,62 +103,87 @@ export declare class Application {
|
|
|
92
103
|
user: string | null;
|
|
93
104
|
};
|
|
94
105
|
/**
|
|
95
|
-
*
|
|
106
|
+
* @inheritDoc
|
|
96
107
|
*/
|
|
97
108
|
getLocation(): Promise<{
|
|
98
109
|
register: string | null;
|
|
99
110
|
outlet: string | null;
|
|
100
111
|
user: string | null;
|
|
101
112
|
}>;
|
|
113
|
+
/**
|
|
114
|
+
* @inheritDoc
|
|
115
|
+
*/
|
|
102
116
|
printReceipt(content: string): void;
|
|
117
|
+
/**
|
|
118
|
+
* @inheritDoc
|
|
119
|
+
*/
|
|
103
120
|
changeSellScreenActionMode(mode: SellScreenActionMode): void;
|
|
121
|
+
/**
|
|
122
|
+
* @inheritDoc
|
|
123
|
+
*/
|
|
104
124
|
changeSellScreenSummaryMode(mode: SellScreenSummaryMode): void;
|
|
125
|
+
/**
|
|
126
|
+
* Checks whether `data` is formatted as an audio response
|
|
127
|
+
*/
|
|
105
128
|
protected dataIsAudioResponse(data: Record<string, unknown>): data is {
|
|
106
129
|
requestId: string;
|
|
107
130
|
success: boolean;
|
|
108
131
|
message?: string;
|
|
109
132
|
};
|
|
110
|
-
protected sendAudioRequest(type: SoundEvents, data?: unknown): Promise<{
|
|
111
|
-
success: boolean;
|
|
112
|
-
message?: string;
|
|
113
|
-
}>;
|
|
114
133
|
/**
|
|
115
|
-
*
|
|
134
|
+
* Sends an audio request to Shopfront
|
|
116
135
|
*/
|
|
117
|
-
|
|
118
|
-
success: boolean;
|
|
119
|
-
message?: string;
|
|
120
|
-
}>;
|
|
136
|
+
protected sendAudioRequest(type: SoundEvents, data?: unknown): Promise<ShopfrontResponse>;
|
|
121
137
|
/**
|
|
122
|
-
*
|
|
123
|
-
* @param url
|
|
138
|
+
* @inheritDoc
|
|
124
139
|
*/
|
|
125
|
-
|
|
126
|
-
success: boolean;
|
|
127
|
-
message?: string;
|
|
128
|
-
}>;
|
|
140
|
+
requestAudioPermission(): Promise<ShopfrontResponse>;
|
|
129
141
|
/**
|
|
130
|
-
*
|
|
131
|
-
|
|
142
|
+
* @inheritDoc
|
|
143
|
+
*/
|
|
144
|
+
audioPreload(url: string): Promise<ShopfrontResponse>;
|
|
145
|
+
/**
|
|
146
|
+
* @inheritDoc
|
|
147
|
+
*/
|
|
148
|
+
audioPlay(url: string): Promise<ShopfrontResponse>;
|
|
149
|
+
/**
|
|
150
|
+
* Checks whether `data` is formatted as response data to a 'get option' request
|
|
132
151
|
*/
|
|
133
|
-
audioPlay(url: string): Promise<{
|
|
134
|
-
success: boolean;
|
|
135
|
-
message?: string;
|
|
136
|
-
}>;
|
|
137
152
|
protected dataIsOption<TValueType>(data: Record<string, unknown>): data is {
|
|
138
153
|
requestId: string;
|
|
139
154
|
option: string;
|
|
140
155
|
value: TValueType | undefined;
|
|
141
156
|
};
|
|
157
|
+
/**
|
|
158
|
+
* @inheritDoc
|
|
159
|
+
*/
|
|
142
160
|
getOption<TValueType>(option: string, defaultValue: TValueType): Promise<TValueType>;
|
|
161
|
+
/**
|
|
162
|
+
* Checks whether `data` is formatted as response data to an embedded token request
|
|
163
|
+
*/
|
|
143
164
|
protected dataIsEmbeddedToken(data: Record<string, unknown>): data is {
|
|
144
165
|
requestId: string;
|
|
145
166
|
data: BufferSource;
|
|
146
167
|
signature: BufferSource;
|
|
147
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* Generates a signing key and sends it to Shopfront
|
|
171
|
+
*/
|
|
148
172
|
protected generateSigningKey(): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Decodes the embedded token response from Shopfront using the signing key
|
|
175
|
+
*/
|
|
149
176
|
protected decodeToken(signature: BufferSource, data: BufferSource, returnTokenObject?: boolean): Promise<ShopfrontEmbeddedVerificationToken | string>;
|
|
177
|
+
/**
|
|
178
|
+
* Checks whether `data` is an error response from an embedded token request
|
|
179
|
+
*/
|
|
150
180
|
protected tokenDataContainsErrors(data: unknown): data is ShopfrontEmbeddedTokenError;
|
|
181
|
+
/**
|
|
182
|
+
* @inheritDoc
|
|
183
|
+
*/
|
|
151
184
|
getToken(returnTokenObject: true): Promise<ShopfrontEmbeddedVerificationToken>;
|
|
185
|
+
/**
|
|
186
|
+
* @inheritDoc
|
|
187
|
+
*/
|
|
152
188
|
getToken(returnTokenObject?: false): Promise<string>;
|
|
153
189
|
}
|