@shopfront/bridge 1.9.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/misc.xml +9 -0
- package/.idea/modules.xml +8 -0
- package/.idea/php.xml +4 -0
- package/.idea/shopfront-embedded-bridge.iml +8 -0
- package/.idea/vcs.xml +6 -0
- package/README.md +3 -2
- package/lib/APIs/CurrentSale/Sale.d.ts +12 -0
- package/lib/APIs/CurrentSale/Sale.js +18 -0
- package/lib/APIs/CurrentSale/SaleProduct.d.ts +1 -1
- package/lib/APIs/CurrentSale/SaleProduct.js +1 -2
- package/lib/APIs/CurrentSale/ShopfrontSaleState.d.ts +1 -0
- package/lib/APIs/CurrentSale/index.js +5 -1
- package/lib/APIs/InternalMessages/InternalMessageSource.d.ts +1 -1
- package/lib/Actions/BaseAction.d.ts +13 -8
- package/lib/Actions/BaseAction.js +7 -6
- package/lib/Actions/Button.js +0 -1
- package/lib/Actions/Redirect.js +0 -2
- package/lib/Actions/SaleKey.js +0 -1
- package/lib/Actions/SaleUpdate.d.ts +5 -2
- package/lib/Actions/SaleUpdate.js +0 -1
- package/lib/Actions/Toast.d.ts +1 -2
- package/lib/Application.d.ts +58 -8
- package/lib/Application.js +144 -10
- package/lib/ApplicationEvents.d.ts +58 -6
- package/lib/ApplicationEvents.js +9 -4
- package/lib/Bridge.d.ts +1 -1
- package/lib/Bridge.js +6 -2
- package/lib/Common/EventEmitter.d.ts +4 -3
- package/lib/Common/Serializable.d.ts +1 -1
- package/lib/EmitableEvents/SellScreenPromotionApplicable.d.ts +13 -0
- package/lib/EmitableEvents/SellScreenPromotionApplicable.js +19 -0
- package/lib/Events/AudioPermissionChange.d.ts +6 -0
- package/lib/Events/AudioPermissionChange.js +13 -0
- package/lib/Events/BaseEvent.d.ts +5 -4
- package/lib/Events/BaseEvent.js +1 -0
- package/lib/Events/Callback.d.ts +1 -1
- package/lib/Events/Callback.js +2 -2
- package/lib/Events/FormatIntegratedProduct.d.ts +14 -3
- package/lib/Events/FormatIntegratedProduct.js +1 -1
- package/lib/Events/InternalPageMessage.d.ts +4 -8
- package/lib/Events/InternalPageMessage.js +1 -1
- package/lib/Events/PaymentMethodsEnabled.d.ts +15 -0
- package/lib/Events/PaymentMethodsEnabled.js +21 -0
- package/lib/Events/Ready.d.ts +2 -2
- package/lib/Events/Ready.js +1 -1
- package/lib/Events/RegisterChanged.js +1 -1
- package/lib/Events/RequestButtons.d.ts +7 -2
- package/lib/Events/RequestButtons.js +2 -2
- package/lib/Events/RequestCustomerListOptions.d.ts +3 -2
- package/lib/Events/RequestCustomerListOptions.js +3 -2
- package/lib/Events/RequestSaleKeys.d.ts +2 -1
- package/lib/Events/RequestSaleKeys.js +2 -2
- package/lib/Events/RequestSellScreenOptions.d.ts +3 -2
- package/lib/Events/RequestSellScreenOptions.js +3 -2
- package/lib/Events/RequestSettings.d.ts +3 -2
- package/lib/Events/RequestSettings.js +3 -2
- package/lib/Events/RequestTableColumns.d.ts +6 -2
- package/lib/Events/RequestTableColumns.js +1 -1
- package/lib/Events/SaleComplete.d.ts +1 -1
- package/lib/Events/SaleComplete.js +1 -1
- package/lib/Events/UIPipeline.d.ts +15 -0
- package/lib/Events/UIPipeline.js +31 -0
- package/lib/Utilities/ActionEventRegistrar.d.ts +3 -3
- package/lib/Utilities/MiscTypes.d.ts +3 -0
- package/lib/Utilities/Static.js +2 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -2
- package/package.json +31 -27
- package/bitbucket-pipelines.yml +0 -22
- package/yarn.lock +0 -8
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/shopfront-embedded-bridge.iml" filepath="$PROJECT_DIR$/.idea/shopfront-embedded-bridge.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/php.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
</component>
|
|
8
|
+
</module>
|
package/.idea/vcs.xml
ADDED
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
#Shopfront Embedded Bridge
|
|
1
|
+
# Shopfront Embedded Bridge
|
|
2
|
+
|
|
2
3
|
This is the bridge library to use with the Shopfront Embedded API.
|
|
3
4
|
|
|
4
5
|
For more information, check out the documentation on the
|
|
5
|
-
[Shopfront developer website](https://developer.onshopfront.com/documentation/Embedded/Introduction).
|
|
6
|
+
[Shopfront developer website](https://developer.onshopfront.com/documentation/Embedded/Introduction).
|
|
@@ -80,6 +80,12 @@ export declare class Sale {
|
|
|
80
80
|
* @returns {string}
|
|
81
81
|
*/
|
|
82
82
|
getOrderReference(): string;
|
|
83
|
+
/**
|
|
84
|
+
* Get the current meta data for the sale
|
|
85
|
+
*
|
|
86
|
+
* @returns {Record<string, unknown>}
|
|
87
|
+
*/
|
|
88
|
+
getMetaData(): Record<string, unknown>;
|
|
83
89
|
/**
|
|
84
90
|
* Cancel the current sale in progress.
|
|
85
91
|
*
|
|
@@ -162,6 +168,12 @@ export declare class Sale {
|
|
|
162
168
|
* @returns {Promise<void>}
|
|
163
169
|
*/
|
|
164
170
|
setOrderReference(reference: string): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Set the meta data of the sale, this will override the previous meta data.
|
|
173
|
+
*
|
|
174
|
+
* @param metaData
|
|
175
|
+
*/
|
|
176
|
+
setMetaData(metaData: Record<string, unknown>): Promise<void>;
|
|
165
177
|
/**
|
|
166
178
|
* Update a product's details, currently this only updates the top-level meta data
|
|
167
179
|
* @param product
|
|
@@ -125,6 +125,14 @@ class Sale {
|
|
|
125
125
|
getOrderReference() {
|
|
126
126
|
return this.sale.orderReference;
|
|
127
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* Get the current meta data for the sale
|
|
130
|
+
*
|
|
131
|
+
* @returns {Record<string, unknown>}
|
|
132
|
+
*/
|
|
133
|
+
getMetaData() {
|
|
134
|
+
return this.sale.metaData;
|
|
135
|
+
}
|
|
128
136
|
/**
|
|
129
137
|
* Cancel the current sale in progress.
|
|
130
138
|
*
|
|
@@ -257,6 +265,16 @@ class Sale {
|
|
|
257
265
|
reference,
|
|
258
266
|
}));
|
|
259
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Set the meta data of the sale, this will override the previous meta data.
|
|
270
|
+
*
|
|
271
|
+
* @param metaData
|
|
272
|
+
*/
|
|
273
|
+
setMetaData(metaData) {
|
|
274
|
+
return this.sendSaleUpdate(new SaleUpdate_1.SaleUpdate("SALE_META_DATA", {
|
|
275
|
+
metaData,
|
|
276
|
+
}));
|
|
277
|
+
}
|
|
260
278
|
/**
|
|
261
279
|
* Update a product's details, currently this only updates the top-level meta data
|
|
262
280
|
* @param product
|
|
@@ -73,7 +73,7 @@ export declare class SaleProduct {
|
|
|
73
73
|
*
|
|
74
74
|
* @returns {ShopfrontSaleProductType | undefined}
|
|
75
75
|
*/
|
|
76
|
-
getType():
|
|
76
|
+
getType(): ShopfrontSaleProductType | undefined;
|
|
77
77
|
/**
|
|
78
78
|
* Get the tax rate amount.
|
|
79
79
|
* This is the rate of the tax rate (e.g. 10 is a tax rate of 10%).
|
|
@@ -44,10 +44,9 @@ class SaleProduct {
|
|
|
44
44
|
* @param {Array<number>} indexAddress
|
|
45
45
|
*/
|
|
46
46
|
setInternal(data, indexAddress) {
|
|
47
|
-
var _a;
|
|
48
47
|
this.name = data.name;
|
|
49
48
|
this.type = data.type;
|
|
50
|
-
this.taxRateAmount =
|
|
49
|
+
this.taxRateAmount = data.tax?.amount || 0;
|
|
51
50
|
this.note = data.note;
|
|
52
51
|
this.edited = data.edited;
|
|
53
52
|
this.caseQuantity = data.caseQuantity;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { EventEmitter } from "../Common/EventEmitter";
|
|
2
2
|
import { Serializable, Serialized } from "../Common/Serializable";
|
|
3
|
+
interface BaseActionConstructor<T> {
|
|
4
|
+
new (...args: Array<never>): BaseAction<T>;
|
|
5
|
+
new (serialized: Serialized<T>): BaseAction<T>;
|
|
6
|
+
}
|
|
3
7
|
export declare class BaseAction<T> extends EventEmitter {
|
|
4
8
|
protected target: string;
|
|
5
9
|
protected events: Array<{
|
|
6
|
-
callback:
|
|
10
|
+
callback: (...args: Array<unknown>) => void;
|
|
7
11
|
type: string;
|
|
8
12
|
id: string;
|
|
9
13
|
}>;
|
|
10
|
-
protected properties: Array<
|
|
14
|
+
protected properties: Array<unknown>;
|
|
11
15
|
static serializedRegistry: {
|
|
12
|
-
[id: string]:
|
|
16
|
+
[id: string]: BaseActionConstructor<unknown>;
|
|
13
17
|
};
|
|
14
|
-
constructor(serialized: Serialized<T>, type:
|
|
18
|
+
constructor(serialized: Serialized<T>, type: BaseActionConstructor<T>);
|
|
15
19
|
serialize(): Serialized<T>;
|
|
16
|
-
protected serializeProperties(properties: Array<
|
|
20
|
+
protected serializeProperties(properties: Array<unknown>): Array<unknown>;
|
|
17
21
|
static deserialize<T extends Serializable<T>>(serialized: Serialized<T>): T;
|
|
18
|
-
addEventListener(event: string, callback:
|
|
19
|
-
removeEventListener(event: string, callback:
|
|
20
|
-
handleRegistrarEvent(id: string, data:
|
|
22
|
+
addEventListener(event: string, callback: (...args: Array<unknown>) => void): void;
|
|
23
|
+
removeEventListener(event: string, callback: (...args: Array<unknown>) => void): void;
|
|
24
|
+
handleRegistrarEvent(id: string, data: unknown): void;
|
|
21
25
|
}
|
|
26
|
+
export {};
|
|
@@ -44,17 +44,18 @@ let BaseAction = BaseAction_1 = class BaseAction extends EventEmitter_1.EventEmi
|
|
|
44
44
|
const results = [];
|
|
45
45
|
// Loop through current layer of properties
|
|
46
46
|
for (let i = 0, l = properties.length; i < l; i++) {
|
|
47
|
-
|
|
47
|
+
const property = properties[i];
|
|
48
|
+
if (Array.isArray(property)) {
|
|
48
49
|
// Prepare to recurse through next layer of properties
|
|
49
|
-
results.push(this.serializeProperties(
|
|
50
|
+
results.push(this.serializeProperties(property));
|
|
50
51
|
}
|
|
51
|
-
else if (
|
|
52
|
+
else if (property instanceof BaseAction_1) {
|
|
52
53
|
// Serialize property
|
|
53
|
-
results.push(
|
|
54
|
+
results.push(property.serialize());
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
57
|
// Assume that the property is already serializable
|
|
57
|
-
results.push(
|
|
58
|
+
results.push(property);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
return results;
|
|
@@ -102,6 +103,6 @@ let BaseAction = BaseAction_1 = class BaseAction extends EventEmitter_1.EventEmi
|
|
|
102
103
|
};
|
|
103
104
|
BaseAction.serializedRegistry = {};
|
|
104
105
|
BaseAction = BaseAction_1 = __decorate([
|
|
105
|
-
Static_1.staticImplements()
|
|
106
|
+
(0, Static_1.staticImplements)()
|
|
106
107
|
], BaseAction);
|
|
107
108
|
exports.BaseAction = BaseAction;
|
package/lib/Actions/Button.js
CHANGED
|
@@ -19,7 +19,6 @@ class Button extends BaseAction_1.BaseAction {
|
|
|
19
19
|
})(), Button);
|
|
20
20
|
this.supportedEvents = ["click"];
|
|
21
21
|
if (typeof icon === "undefined" && typeof label !== "string") {
|
|
22
|
-
label = label;
|
|
23
22
|
this.label = label.properties[0];
|
|
24
23
|
this.icon = label.properties[1];
|
|
25
24
|
}
|
package/lib/Actions/Redirect.js
CHANGED
|
@@ -19,7 +19,6 @@ class InternalRedirect extends BaseAction_1.BaseAction {
|
|
|
19
19
|
})(), InternalRedirect);
|
|
20
20
|
this.supportedEvents = ["click"];
|
|
21
21
|
if (typeof to !== "string") {
|
|
22
|
-
to = to;
|
|
23
22
|
this.to = to.properties[0];
|
|
24
23
|
}
|
|
25
24
|
else {
|
|
@@ -47,7 +46,6 @@ class ExternalRedirect extends BaseAction_1.BaseAction {
|
|
|
47
46
|
this.to = to;
|
|
48
47
|
}
|
|
49
48
|
else {
|
|
50
|
-
to = to;
|
|
51
49
|
this.to = new URL(to.properties[0]);
|
|
52
50
|
}
|
|
53
51
|
}
|
package/lib/Actions/SaleKey.js
CHANGED
|
@@ -26,11 +26,11 @@ export interface SaleUpdateChanges {
|
|
|
26
26
|
cashout?: number;
|
|
27
27
|
status?: ShopfrontSalePaymentStatus;
|
|
28
28
|
};
|
|
29
|
-
SALE_CANCEL:
|
|
29
|
+
SALE_CANCEL: Record<string, never>;
|
|
30
30
|
CUSTOMER_ADD: {
|
|
31
31
|
id: string;
|
|
32
32
|
};
|
|
33
|
-
CUSTOMER_REMOVE:
|
|
33
|
+
CUSTOMER_REMOVE: Record<string, never>;
|
|
34
34
|
SALE_EXTERNAL_NOTE: {
|
|
35
35
|
note: string;
|
|
36
36
|
append?: boolean;
|
|
@@ -42,6 +42,9 @@ export interface SaleUpdateChanges {
|
|
|
42
42
|
SALE_ORDER_REFERENCE: {
|
|
43
43
|
reference: string;
|
|
44
44
|
};
|
|
45
|
+
SALE_META_DATA: {
|
|
46
|
+
metaData: Record<string, unknown>;
|
|
47
|
+
};
|
|
45
48
|
PRODUCT_UPDATE: {
|
|
46
49
|
id: string;
|
|
47
50
|
indexAddress: Array<number>;
|
package/lib/Actions/Toast.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BaseAction } from "./BaseAction";
|
|
2
2
|
import { Serialized } from "../Common/Serializable";
|
|
3
|
-
declare type ToastType = "success" | "error" | "information" | "warning";
|
|
3
|
+
export declare 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;
|
|
7
7
|
protected message: string;
|
|
8
8
|
constructor(type: Serialized<Toast> | ToastType, message?: string);
|
|
9
9
|
}
|
|
10
|
-
export {};
|
package/lib/Application.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Bridge } from "./Bridge";
|
|
2
|
-
import { DirectShopfrontEvent, FromShopfront, FromShopfrontCallbacks, FromShopfrontInternal, RegisterChangedEvent } from "./ApplicationEvents";
|
|
2
|
+
import { DirectShopfrontEvent, FromShopfront, FromShopfrontCallbacks, FromShopfrontInternal, RegisterChangedEvent, SoundEvents } from "./ApplicationEvents";
|
|
3
3
|
import { Serializable } from "./Common/Serializable";
|
|
4
4
|
import { BaseEmitableEvent } from "./EmitableEvents/BaseEmitableEvent";
|
|
5
5
|
import { Sale } from "./APIs/CurrentSale";
|
|
6
|
+
import { ShopfrontSaleState } from "./APIs/CurrentSale/ShopfrontSaleState";
|
|
6
7
|
import { Database } from "./APIs/Database/Database";
|
|
7
8
|
import { MaybePromise } from "./Utilities/MiscTypes";
|
|
9
|
+
import { BaseEvent } from "./Events/BaseEvent";
|
|
8
10
|
export declare class Application {
|
|
9
11
|
protected bridge: Bridge;
|
|
10
12
|
protected isReady: boolean;
|
|
@@ -13,7 +15,7 @@ export declare class Application {
|
|
|
13
15
|
protected outlet: string | null;
|
|
14
16
|
protected user: string | null;
|
|
15
17
|
protected listeners: {
|
|
16
|
-
[key in keyof Omit<FromShopfront, "CALLBACK">]: Map<
|
|
18
|
+
[key in keyof Omit<FromShopfront, "CALLBACK">]: Map<(...args: Array<unknown>) => void, FromShopfront[key] & BaseEvent>;
|
|
17
19
|
};
|
|
18
20
|
protected directListeners: {
|
|
19
21
|
[K in DirectShopfrontEvent]?: Set<(data: unknown) => void | Promise<void>>;
|
|
@@ -21,22 +23,26 @@ export declare class Application {
|
|
|
21
23
|
database: Database;
|
|
22
24
|
constructor(bridge: Bridge);
|
|
23
25
|
destroy(): void;
|
|
24
|
-
protected handleEvent: (event: keyof FromShopfront | keyof FromShopfrontInternal, data:
|
|
25
|
-
protected emit(event: keyof Omit<FromShopfront, "CALLBACK"> | DirectShopfrontEvent, data:
|
|
26
|
+
protected handleEvent: (event: keyof FromShopfront | keyof FromShopfrontInternal, data: Record<string, unknown>, id: string) => void;
|
|
27
|
+
protected emit(event: keyof Omit<FromShopfront, "CALLBACK"> | DirectShopfrontEvent, data: Record<string, unknown> | undefined, id: string): void | Promise<void>;
|
|
26
28
|
addEventListener<E extends keyof FromShopfrontCallbacks>(event: E, callback: FromShopfrontCallbacks[E]): void;
|
|
27
29
|
addEventListener<D>(event: DirectShopfrontEvent, callback: (event: D) => MaybePromise<void>): void;
|
|
28
|
-
removeEventListener(event: keyof Omit<FromShopfront, "CALLBACK"> | DirectShopfrontEvent, callback: (...args: Array<
|
|
29
|
-
send(item: BaseEmitableEvent<
|
|
30
|
-
send(item: Serializable<
|
|
30
|
+
removeEventListener(event: keyof Omit<FromShopfront, "CALLBACK"> | DirectShopfrontEvent, callback: (...args: Array<unknown>) => MaybePromise<void>): void;
|
|
31
|
+
send(item: BaseEmitableEvent<unknown>): void;
|
|
32
|
+
send(item: Serializable<unknown>): void;
|
|
31
33
|
download(file: string): void;
|
|
32
34
|
redirect(toLocation: string, externalRedirect?: boolean): void;
|
|
33
35
|
load(): () => void;
|
|
34
36
|
protected handleEventCallback(data: {
|
|
35
37
|
id?: string;
|
|
36
|
-
data:
|
|
38
|
+
data: unknown;
|
|
37
39
|
}): void;
|
|
38
40
|
protected handleLocationChanged(data: RegisterChangedEvent): void;
|
|
39
41
|
getAuthenticationKey(): string;
|
|
42
|
+
protected dataIsSaleEvent(data: Record<string, unknown>): data is {
|
|
43
|
+
requestId: string;
|
|
44
|
+
saleState: ShopfrontSaleState | false;
|
|
45
|
+
};
|
|
40
46
|
/**
|
|
41
47
|
* Get the current sale on the sell screen, if the current device is not a register
|
|
42
48
|
* then this will return false.
|
|
@@ -44,6 +50,12 @@ export declare class Application {
|
|
|
44
50
|
* @returns {Promise<Sale | boolean>}
|
|
45
51
|
*/
|
|
46
52
|
getCurrentSale(): Promise<Sale | false>;
|
|
53
|
+
protected dataIsLocation(data: Record<string, unknown>): data is {
|
|
54
|
+
requestId: string;
|
|
55
|
+
register: string | null;
|
|
56
|
+
outlet: string | null;
|
|
57
|
+
user: string | null;
|
|
58
|
+
};
|
|
47
59
|
/**
|
|
48
60
|
* Get the location from Shopfront
|
|
49
61
|
*/
|
|
@@ -53,4 +65,42 @@ export declare class Application {
|
|
|
53
65
|
user: string | null;
|
|
54
66
|
}>;
|
|
55
67
|
printReceipt(content: string): void;
|
|
68
|
+
protected dataIsAudioResponse(data: Record<string, unknown>): data is {
|
|
69
|
+
requestId: string;
|
|
70
|
+
success: boolean;
|
|
71
|
+
message?: string;
|
|
72
|
+
};
|
|
73
|
+
protected sendAudioRequest(type: SoundEvents, data?: unknown): Promise<{
|
|
74
|
+
success: boolean;
|
|
75
|
+
message?: string;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Requests permission from the user to be able to play audio
|
|
79
|
+
*/
|
|
80
|
+
requestAudioPermission(): Promise<{
|
|
81
|
+
success: boolean;
|
|
82
|
+
message?: string;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* Requests shopfront to preload audio so that it can be pre-cached before being played
|
|
86
|
+
* @param url
|
|
87
|
+
*/
|
|
88
|
+
audioPreload(url: string): Promise<{
|
|
89
|
+
success: boolean;
|
|
90
|
+
message?: string;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Requests the sound to be played
|
|
94
|
+
* @param url
|
|
95
|
+
*/
|
|
96
|
+
audioPlay(url: string): Promise<{
|
|
97
|
+
success: boolean;
|
|
98
|
+
message?: string;
|
|
99
|
+
}>;
|
|
100
|
+
protected dataIsOption<TValueType>(data: Record<string, unknown>): data is {
|
|
101
|
+
requestId: string;
|
|
102
|
+
option: string;
|
|
103
|
+
value: TValueType | undefined;
|
|
104
|
+
};
|
|
105
|
+
getOption<TValueType>(option: string, defaultValue: TValueType): Promise<TValueType>;
|
|
56
106
|
}
|