@shopfront/bridge 1.18.3 → 1.20.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.
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="GitToolBoxProjectSettings">
4
+ <option name="commitMessageIssueKeyValidationOverride">
5
+ <BoolValueOverride>
6
+ <option name="enabled" value="true" />
7
+ </BoolValueOverride>
8
+ </option>
9
+ <option name="commitMessageValidationEnabledOverride">
10
+ <BoolValueOverride>
11
+ <option name="enabled" value="true" />
12
+ </BoolValueOverride>
13
+ </option>
14
+ </component>
15
+ </project>
@@ -1,4 +1,4 @@
1
- import { ShopfrontSaleProduct, ShopfrontSaleProductType } from "./ShopfrontSaleState";
1
+ import { ShopfrontSaleProduct, ShopfrontSaleProductPromotions, ShopfrontSaleProductType } from "./ShopfrontSaleState";
2
2
  export declare class SaleProduct {
3
3
  readonly internalId: string;
4
4
  protected id: string;
@@ -12,6 +12,7 @@ export declare class SaleProduct {
12
12
  protected contains: Array<SaleProduct>;
13
13
  protected edited: boolean;
14
14
  protected caseQuantity?: number;
15
+ protected promotions: ShopfrontSaleProductPromotions;
15
16
  protected metaData: Record<string, unknown>;
16
17
  protected mapped?: string;
17
18
  constructor(id: string, quantity: number, price?: number, indexAddress?: Array<number>);
@@ -114,6 +115,12 @@ export declare class SaleProduct {
114
115
  * @returns {number | undefined}
115
116
  */
116
117
  getCaseQuantity(): number | undefined;
118
+ /**
119
+ * Get the promotions for the product.
120
+ *
121
+ * @returns {Record<string, unknown>}
122
+ */
123
+ getPromotions(): ShopfrontSaleProductPromotions;
117
124
  /**
118
125
  * Get the meta data for the product.
119
126
  *
@@ -7,6 +7,7 @@ exports.SaleProduct = void 0;
7
7
  const UUID_1 = __importDefault(require("../../Utilities/UUID"));
8
8
  class SaleProduct {
9
9
  constructor(id, quantity, price, indexAddress) {
10
+ this.promotions = {};
10
11
  this.metaData = {};
11
12
  this.internalId = UUID_1.default.generate();
12
13
  this.id = id;
@@ -55,6 +56,7 @@ class SaleProduct {
55
56
  this.note = data.note;
56
57
  this.edited = data.edited;
57
58
  this.caseQuantity = data.caseQuantity;
59
+ this.promotions = data.promotions;
58
60
  this.metaData = data.metaData;
59
61
  this.mapped = data.mapped;
60
62
  for (let i = 0, l = data.products.length; i < l; i++) {
@@ -161,6 +163,14 @@ class SaleProduct {
161
163
  getCaseQuantity() {
162
164
  return this.caseQuantity;
163
165
  }
166
+ /**
167
+ * Get the promotions for the product.
168
+ *
169
+ * @returns {Record<string, unknown>}
170
+ */
171
+ getPromotions() {
172
+ return this.promotions;
173
+ }
164
174
  /**
165
175
  * Get the meta data for the product.
166
176
  *
@@ -1,5 +1,12 @@
1
1
  export declare type ShopfrontSalePaymentStatus = "completed" | "cancelled" | "failed";
2
2
  export declare type ShopfrontSaleProductType = "Normal" | "Basket" | "Package" | "Component" | "Voucher";
3
+ export interface ShopfrontSaleProductPromotions {
4
+ [id: string]: {
5
+ name: string;
6
+ active: boolean;
7
+ quantity: number;
8
+ };
9
+ }
3
10
  export interface ShopfrontSaleProduct {
4
11
  uuid: string;
5
12
  type: ShopfrontSaleProductType;
@@ -15,6 +22,7 @@ export interface ShopfrontSaleProduct {
15
22
  };
16
23
  note: string;
17
24
  products: Array<ShopfrontSaleProduct>;
25
+ promotions: ShopfrontSaleProductPromotions;
18
26
  edited: boolean;
19
27
  caseQuantity: number;
20
28
  metaData: Record<string, unknown>;
@@ -1,5 +1,5 @@
1
1
  import { Bridge } from "./Bridge";
2
- import { DirectShopfrontEvent, FromShopfront, FromShopfrontCallbacks, FromShopfrontInternal, RegisterChangedEvent, SoundEvents } from "./ApplicationEvents";
2
+ import { DirectShopfrontEvent, FromShopfront, FromShopfrontCallbacks, FromShopfrontInternal, RegisterChangedEvent, SellScreenActionMode, SellScreenSummaryMode, SoundEvents } from "./ApplicationEvents";
3
3
  import { Serializable } from "./Common/Serializable";
4
4
  import { BaseEmitableEvent } from "./EmitableEvents/BaseEmitableEvent";
5
5
  import { ShopfrontSaleState } from "./APIs/Sale";
@@ -100,6 +100,8 @@ export declare class Application {
100
100
  user: string | null;
101
101
  }>;
102
102
  printReceipt(content: string): void;
103
+ changeSellScreenActionMode(mode: SellScreenActionMode): void;
104
+ changeSellScreenSummaryMode(mode: SellScreenSummaryMode): void;
103
105
  protected dataIsAudioResponse(data: Record<string, unknown>): data is {
104
106
  requestId: string;
105
107
  success: boolean;
@@ -31,6 +31,7 @@ const FulfilmentCollectOrder_1 = require("./Events/FulfilmentCollectOrder");
31
31
  const FulfilmentCompleteOrder_1 = require("./Events/FulfilmentCompleteOrder");
32
32
  const CurrentSale_1 = require("./APIs/Sale/CurrentSale");
33
33
  const SaleCreate_1 = require("./Utilities/SaleCreate");
34
+ const AudioReady_1 = require("./Events/AudioReady");
34
35
  class ShopfrontTokenDecodingError extends Error {
35
36
  }
36
37
  exports.ShopfrontTokenDecodingError = ShopfrontTokenDecodingError;
@@ -55,6 +56,7 @@ class Application {
55
56
  UI_PIPELINE: new Map(),
56
57
  PAYMENT_METHODS_ENABLED: new Map(),
57
58
  AUDIO_PERMISSION_CHANGE: new Map(),
59
+ AUDIO_READY: new Map(),
58
60
  FULFILMENT_GET_ORDER: new Map(),
59
61
  FULFILMENT_PROCESS_ORDER: new Map(),
60
62
  FULFILMENT_VOID_ORDER: new Map(),
@@ -266,6 +268,10 @@ class Application {
266
268
  c = new PaymentMethodsEnabled_1.PaymentMethodsEnabled(callback);
267
269
  this.listeners[event].set(callback, c);
268
270
  break;
271
+ case "AUDIO_READY":
272
+ c = new AudioReady_1.AudioReady(callback);
273
+ this.listeners[event].set(callback, c);
274
+ break;
269
275
  case "AUDIO_PERMISSION_CHANGE":
270
276
  c = new AudioPermissionChange_1.AudioPermissionChange(callback);
271
277
  this.listeners[event].set(callback, c);
@@ -473,6 +479,16 @@ class Application {
473
479
  type: "text",
474
480
  });
475
481
  }
482
+ changeSellScreenActionMode(mode) {
483
+ this.bridge.sendMessage(ApplicationEvents_1.ToShopfront.CHANGE_SELL_SCREEN_ACTION_MODE, {
484
+ mode
485
+ });
486
+ }
487
+ changeSellScreenSummaryMode(mode) {
488
+ this.bridge.sendMessage(ApplicationEvents_1.ToShopfront.CHANGE_SELL_SCREEN_SUMMARY_MODE, {
489
+ mode
490
+ });
491
+ }
476
492
  dataIsAudioResponse(data) {
477
493
  return typeof data.requestId === "string" &&
478
494
  typeof data.success === "boolean" && (typeof data.message === "string" ||
@@ -26,6 +26,7 @@ import { OrderDetails } from "./APIs/Fulfilment/FulfilmentTypes";
26
26
  import { FulfilmentCollectOrder } from "./Events/FulfilmentCollectOrder";
27
27
  import { FulfilmentCompleteOrder } from "./Events/FulfilmentCompleteOrder";
28
28
  import { Sale } from "./APIs/Sale";
29
+ import { AudioReady } from "./Events/AudioReady";
29
30
  export declare enum ToShopfront {
30
31
  READY = "READY",
31
32
  SERIALIZED = "SERIALIZED",
@@ -52,6 +53,8 @@ export declare enum ToShopfront {
52
53
  AUDIO_REQUEST_PERMISSION = "AUDIO_REQUEST_PERMISSION",
53
54
  AUDIO_PRELOAD = "AUDIO_PRELOAD",
54
55
  AUDIO_PLAY = "AUDIO_PLAY",
56
+ CHANGE_SELL_SCREEN_ACTION_MODE = "CHANGE_SELL_SCREEN_ACTION_MODE",
57
+ CHANGE_SELL_SCREEN_SUMMARY_MODE = "CHANGE_SELL_SCREEN_SUMMARY_MODE",
55
58
  SELL_SCREEN_OPTION_CHANGE = "SELL_SCREEN_OPTION_CHANGE",
56
59
  INTERNAL_PAGE_MESSAGE = "INTERNAL_PAGE_MESSAGE",
57
60
  TABLE_UPDATE = "TABLE_UPDATE",
@@ -113,6 +116,7 @@ export interface FromShopfrontReturns {
113
116
  SALE_COMPLETE: void;
114
117
  UI_PIPELINE: Array<UIPipelineResponse>;
115
118
  PAYMENT_METHODS_ENABLED: Array<SellScreenPaymentMethod>;
119
+ AUDIO_READY: void;
116
120
  AUDIO_PERMISSION_CHANGE: void;
117
121
  FULFILMENT_GET_ORDER: OrderDetails;
118
122
  FULFILMENT_VOID_ORDER: void;
@@ -193,6 +197,7 @@ export interface FromShopfrontCallbacks {
193
197
  SALE_COMPLETE: (event: SaleCompletedEvent) => MaybePromise<FromShopfrontReturns["SALE_COMPLETE"]>;
194
198
  UI_PIPELINE: (event: Array<UIPipelineResponse>, context: UIPipelineContext) => MaybePromise<FromShopfrontReturns["UI_PIPELINE"]>;
195
199
  PAYMENT_METHODS_ENABLED: (event: Array<SellScreenPaymentMethod>, context: PaymentMethodEnabledContext) => MaybePromise<FromShopfrontReturns["PAYMENT_METHODS_ENABLED"]>;
200
+ AUDIO_READY: () => MaybePromise<FromShopfrontReturns["AUDIO_READY"]>;
196
201
  AUDIO_PERMISSION_CHANGE: (event: AudioPermissionChangeEvent) => MaybePromise<FromShopfrontReturns["AUDIO_PERMISSION_CHANGE"]>;
197
202
  FULFILMENT_GET_ORDER: (id: string) => MaybePromise<FromShopfrontReturns["FULFILMENT_GET_ORDER"]>;
198
203
  FULFILMENT_VOID_ORDER: (id: string) => MaybePromise<FromShopfrontReturns["FULFILMENT_VOID_ORDER"]>;
@@ -216,6 +221,7 @@ export interface FromShopfront {
216
221
  REQUEST_SALE_KEYS: RequestSaleKeys;
217
222
  UI_PIPELINE: UIPipeline;
218
223
  PAYMENT_METHODS_ENABLED: PaymentMethodsEnabled;
224
+ AUDIO_READY: AudioReady;
219
225
  AUDIO_PERMISSION_CHANGE: AudioPermissionChange;
220
226
  FULFILMENT_GET_ORDER: FulfilmentGetOrder;
221
227
  FULFILMENT_VOID_ORDER: FulfilmentVoidOrder;
@@ -237,3 +243,5 @@ export interface FromShopfrontInternal {
237
243
  RESPONSE_SECURE_KEY: "RESPONSE_SECURE_KEY";
238
244
  RESPONSE_CREATE_SALE: "RESPONSE_CREATE_SALE";
239
245
  }
246
+ export declare type SellScreenActionMode = "search" | "keys" | "held-sales" | "payment" | "customers" | "promotions" | "show-backorders" | "fulfilment-orders";
247
+ export declare type SellScreenSummaryMode = "transaction" | "payments" | "receipts";
@@ -29,6 +29,9 @@ var ToShopfront;
29
29
  ToShopfront["AUDIO_REQUEST_PERMISSION"] = "AUDIO_REQUEST_PERMISSION";
30
30
  ToShopfront["AUDIO_PRELOAD"] = "AUDIO_PRELOAD";
31
31
  ToShopfront["AUDIO_PLAY"] = "AUDIO_PLAY";
32
+ // Sell Screen Events
33
+ ToShopfront["CHANGE_SELL_SCREEN_ACTION_MODE"] = "CHANGE_SELL_SCREEN_ACTION_MODE";
34
+ ToShopfront["CHANGE_SELL_SCREEN_SUMMARY_MODE"] = "CHANGE_SELL_SCREEN_SUMMARY_MODE";
32
35
  // Emitable Events
33
36
  ToShopfront["SELL_SCREEN_OPTION_CHANGE"] = "SELL_SCREEN_OPTION_CHANGE";
34
37
  ToShopfront["INTERNAL_PAGE_MESSAGE"] = "INTERNAL_PAGE_MESSAGE";
@@ -0,0 +1,6 @@
1
+ import { BaseEvent } from "./BaseEvent";
2
+ import { FromShopfrontCallbacks, FromShopfrontReturns } from "../ApplicationEvents";
3
+ export declare class AudioReady extends BaseEvent<undefined> {
4
+ constructor(callback: FromShopfrontCallbacks["AUDIO_READY"]);
5
+ emit(): Promise<FromShopfrontReturns["AUDIO_READY"]>;
6
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AudioReady = void 0;
4
+ const BaseEvent_1 = require("./BaseEvent");
5
+ class AudioReady extends BaseEvent_1.BaseEvent {
6
+ constructor(callback) {
7
+ super(callback);
8
+ }
9
+ async emit() {
10
+ this.callback(undefined, undefined);
11
+ }
12
+ }
13
+ exports.AudioReady = AudioReady;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopfront/bridge",
3
- "version": "1.18.3",
3
+ "version": "1.20.0",
4
4
  "main": "./lib/index.js",
5
5
  "license": "ISC",
6
6
  "description": "The bridge used to embed your application within Shopfront",