simpo-component-library 3.8.4 → 3.8.5

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.
@@ -10602,15 +10602,21 @@ class CartComponent extends BaseSection {
10602
10602
  this.placeOrderLoader = false;
10603
10603
  }
10604
10604
  }, (error) => {
10605
- if (error?.error?.errorCode == 1101) {
10605
+ // Whatever sits between the browser and the backend reshapes every error into its own
10606
+ // envelope and drops the backend's errorCode along the way - message text is the one field
10607
+ // that survives intact, so that's what price-changed detection keys off of here.
10608
+ const errorMessage = (error?.error?.message || error?.message || '').toLowerCase();
10609
+ const priceChanged = error?.error?.errorCode == 1101 || error?.errorCode == 1101
10610
+ || errorMessage.includes('price of one or more items in your cart has changed');
10611
+ if (priceChanged) {
10606
10612
  this.placeOrderLoader = false;
10607
10613
  this.showPriceChangedDialog(() => this.proceedToPayment());
10608
10614
  return;
10609
10615
  }
10610
- else if (error?.status == 409) {
10616
+ else if (error?.status == 409 || error?.code == 409) {
10611
10617
  Swal.fire({
10612
10618
  icon: "info",
10613
- html: "<p>" + error?.error?.message.replace(/ *\([^)]*\) */g, "") + "</p>",
10619
+ html: "<p>" + (error?.error?.message || error?.message || '').replace(/ *\([^)]*\) */g, "") + "</p>",
10614
10620
  showCloseButton: true
10615
10621
  }).then(async (response) => {
10616
10622
  this.currentTab = "BAG";
@@ -11095,7 +11101,10 @@ class CartComponent extends BaseSection {
11095
11101
  });
11096
11102
  },
11097
11103
  error: (err) => {
11098
- if (err?.error?.errorCode == 1101) {
11104
+ const errorMessage = (err?.error?.message || err?.message || '').toLowerCase();
11105
+ const priceChanged = err?.error?.errorCode == 1101 || err?.errorCode == 1101
11106
+ || errorMessage.includes('price of one or more items in your cart has changed');
11107
+ if (priceChanged) {
11099
11108
  this.showPriceChangedDialog(() => this.paymentWithCompletePoints());
11100
11109
  return;
11101
11110
  }