@shopfront/bridge 3.0.15 → 3.0.16--canary.34.8701ef8.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.
@@ -104,6 +104,6 @@ export declare class MockCurrentSale extends BaseCurrentSale {
104
104
  /**
105
105
  * Clear the sale data
106
106
  */
107
- clearSale(): void;
107
+ clearSale(): Promise<void>;
108
108
  }
109
109
  //# sourceMappingURL=MockCurrentSale.d.ts.map
package/lib/index.mjs CHANGED
@@ -3054,7 +3054,7 @@ class qe extends F {
3054
3054
  async cancelSale() {
3055
3055
  if (!this.sale.isCancellable)
3056
3056
  throw new C();
3057
- this.clearSale(), this.cancelled = !0;
3057
+ await this.clearSale(), this.cancelled = !0;
3058
3058
  }
3059
3059
  /**
3060
3060
  * Round the price to the specified decimal place
@@ -3119,7 +3119,7 @@ class qe extends F {
3119
3119
  this.products[s].indexAddress = [s];
3120
3120
  await this.triggerEvent("SALE_REMOVE_PRODUCT", {
3121
3121
  indexAddress: e.getIndexAddress()
3122
- });
3122
+ }), this.products.length === 0 && await this.clearSale();
3123
3123
  }
3124
3124
  /**
3125
3125
  * @inheritDoc
@@ -3127,7 +3127,7 @@ class qe extends F {
3127
3127
  async addPayment(e) {
3128
3128
  if (this.checkIfCancelled(), this.payments.push(this.clonePayment(e)), e.getStatus() === "cancelled" || e.getStatus() === "failed")
3129
3129
  return;
3130
- this.updatePaidTotal(e.getAmount() - (e.getCashout() || 0)), this.roundNumber(this.sale.totals.sale - this.sale.totals.paid) <= 0 && (this.clearSale(), await this.triggerEvent("SALE_CLEAR", void 0));
3130
+ this.updatePaidTotal(e.getAmount() - (e.getCashout() || 0)), this.roundNumber(this.sale.totals.sale - this.sale.totals.paid) <= 0 && await this.clearSale();
3131
3131
  }
3132
3132
  /**
3133
3133
  * @inheritDoc
@@ -3294,7 +3294,7 @@ class qe extends F {
3294
3294
  /**
3295
3295
  * Clear the sale data
3296
3296
  */
3297
- clearSale() {
3297
+ async clearSale() {
3298
3298
  this.products.length = 0, this.products.push(), this.payments.length = 0, this.payments.push(), this.customer = null, this.cancelled = !1, this.sale = {
3299
3299
  internalId: S.generate(),
3300
3300
  register: void 0,
@@ -3314,7 +3314,7 @@ class qe extends F {
3314
3314
  priceSet: null,
3315
3315
  metaData: {},
3316
3316
  isCancellable: !0
3317
- };
3317
+ }, await this.triggerEvent("SALE_CLEAR", void 0);
3318
3318
  }
3319
3319
  }
3320
3320
  function Xe(r, e) {