simpo-component-library 3.8.3 → 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.
- package/esm2022/lib/ecommerce/sections/cart/cart.component.mjs +51 -38
- package/fesm2022/simpo-component-library.mjs +50 -37
- package/fesm2022/simpo-component-library.mjs.map +1 -1
- package/lib/components/input-fields/input-fields.component.d.ts +1 -1
- package/lib/ecommerce/sections/cart/cart.component.d.ts +5 -0
- package/lib/ecommerce/sections/featured-brand/featured-brand.component.d.ts +1 -1
- package/lib/ecommerce/sections/featured-category/featured-category.component.d.ts +1 -1
- package/lib/ecommerce/sections/featured-category/featured-collection.component.d.ts +1 -1
- package/lib/ecommerce/sections/new-collection/new-collection.component.d.ts +1 -1
- package/lib/sections/banner-carousel/banner-carousel.component.d.ts +1 -1
- package/lib/sections/image-grid-hotspot/image-grid-hotspot.component.d.ts +1 -1
- package/lib/sections/image-grid-section/image-grid-section.component.d.ts +1 -1
- package/package.json +1 -1
- package/simpo-component-library-3.8.5.tgz +0 -0
- package/simpo-component-library-3.8.3.tgz +0 -0
|
@@ -10602,32 +10602,21 @@ class CartComponent extends BaseSection {
|
|
|
10602
10602
|
this.placeOrderLoader = false;
|
|
10603
10603
|
}
|
|
10604
10604
|
}, (error) => {
|
|
10605
|
-
|
|
10606
|
-
|
|
10607
|
-
|
|
10608
|
-
|
|
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) {
|
|
10609
10612
|
this.placeOrderLoader = false;
|
|
10610
|
-
|
|
10611
|
-
icon: "warning",
|
|
10612
|
-
title: "Price Updated",
|
|
10613
|
-
text: "The price of one or more items in your cart has changed. Would you like to continue with the updated price, or review your cart?",
|
|
10614
|
-
showCancelButton: true,
|
|
10615
|
-
confirmButtonText: "Continue",
|
|
10616
|
-
cancelButtonText: "Review Cart"
|
|
10617
|
-
}).then((response) => {
|
|
10618
|
-
if (response.isConfirmed) {
|
|
10619
|
-
this.proceedToPayment();
|
|
10620
|
-
}
|
|
10621
|
-
else {
|
|
10622
|
-
this.currentTab = "BAG";
|
|
10623
|
-
}
|
|
10624
|
-
});
|
|
10613
|
+
this.showPriceChangedDialog(() => this.proceedToPayment());
|
|
10625
10614
|
return;
|
|
10626
10615
|
}
|
|
10627
|
-
else if (error?.error?.code == 409) {
|
|
10616
|
+
else if (error?.status == 409 || error?.code == 409) {
|
|
10628
10617
|
Swal.fire({
|
|
10629
10618
|
icon: "info",
|
|
10630
|
-
html: "<p>" + error?.error?.message.replace(/ *\([^)]*\) */g, "") + "</p>",
|
|
10619
|
+
html: "<p>" + (error?.error?.message || error?.message || '').replace(/ *\([^)]*\) */g, "") + "</p>",
|
|
10631
10620
|
showCloseButton: true
|
|
10632
10621
|
}).then(async (response) => {
|
|
10633
10622
|
this.currentTab = "BAG";
|
|
@@ -10639,6 +10628,41 @@ class CartComponent extends BaseSection {
|
|
|
10639
10628
|
this.placeOrderLoader = false;
|
|
10640
10629
|
});
|
|
10641
10630
|
}
|
|
10631
|
+
/** Backend already corrected the cart's stored prices to the live catalog before rejecting the
|
|
10632
|
+
* placement attempt - refresh local cart state from the server first so the displayed total (and
|
|
10633
|
+
* whatever onContinue resubmits) reflects that correction instead of the stale local values. */
|
|
10634
|
+
showPriceChangedDialog(onContinue) {
|
|
10635
|
+
this.restService.getUserItems(this.userId, "CART").subscribe({
|
|
10636
|
+
next: (response) => {
|
|
10637
|
+
const freshCart = response?.data?.[0];
|
|
10638
|
+
if (freshCart) {
|
|
10639
|
+
this.cartInfo.orderedItems = freshCart.orderedItems ?? this.cartInfo.orderedItems;
|
|
10640
|
+
this.cartInfo.billdetails = freshCart.billdetails ?? this.cartInfo.billdetails;
|
|
10641
|
+
this.cartInfo.totalAmount = freshCart.totalAmount ?? this.cartInfo.totalAmount;
|
|
10642
|
+
this.responseData = this.cartInfo;
|
|
10643
|
+
}
|
|
10644
|
+
this.promptPriceChanged(onContinue);
|
|
10645
|
+
},
|
|
10646
|
+
error: () => this.promptPriceChanged(onContinue)
|
|
10647
|
+
});
|
|
10648
|
+
}
|
|
10649
|
+
promptPriceChanged(onContinue) {
|
|
10650
|
+
Swal.fire({
|
|
10651
|
+
icon: "warning",
|
|
10652
|
+
title: "Price Updated",
|
|
10653
|
+
text: "The price of one or more items in your cart has changed. Would you like to continue with the updated price, or review your cart?",
|
|
10654
|
+
showCancelButton: true,
|
|
10655
|
+
confirmButtonText: "Continue",
|
|
10656
|
+
cancelButtonText: "Review Cart"
|
|
10657
|
+
}).then((response) => {
|
|
10658
|
+
if (response.isConfirmed) {
|
|
10659
|
+
onContinue();
|
|
10660
|
+
}
|
|
10661
|
+
else {
|
|
10662
|
+
this.currentTab = "BAG";
|
|
10663
|
+
}
|
|
10664
|
+
});
|
|
10665
|
+
}
|
|
10642
10666
|
addressSelected(index) {
|
|
10643
10667
|
this.selectedAddressIdx = index;
|
|
10644
10668
|
}
|
|
@@ -11077,22 +11101,11 @@ class CartComponent extends BaseSection {
|
|
|
11077
11101
|
});
|
|
11078
11102
|
},
|
|
11079
11103
|
error: (err) => {
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
showCancelButton: true,
|
|
11086
|
-
confirmButtonText: "Continue",
|
|
11087
|
-
cancelButtonText: "Review Cart"
|
|
11088
|
-
}).then((response) => {
|
|
11089
|
-
if (response.isConfirmed) {
|
|
11090
|
-
this.paymentWithCompletePoints();
|
|
11091
|
-
}
|
|
11092
|
-
else {
|
|
11093
|
-
this.currentTab = "BAG";
|
|
11094
|
-
}
|
|
11095
|
-
});
|
|
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) {
|
|
11108
|
+
this.showPriceChangedDialog(() => this.paymentWithCompletePoints());
|
|
11096
11109
|
return;
|
|
11097
11110
|
}
|
|
11098
11111
|
this.messageService.add({ severity: 'error', summary: 'Order Failed', detail: 'Failed to place order' });
|