simpo-component-library 3.8.3 → 3.8.4
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 +39 -35
- package/fesm2022/simpo-component-library.mjs +38 -34
- package/fesm2022/simpo-component-library.mjs.map +1 -1
- package/lib/ecommerce/sections/cart/cart.component.d.ts +5 -0
- package/lib/sections/banner-carousel/banner-carousel.component.d.ts +1 -1
- package/package.json +1 -1
- package/simpo-component-library-3.8.4.tgz +0 -0
- package/simpo-component-library-3.8.3.tgz +0 -0
|
@@ -10603,28 +10603,11 @@ class CartComponent extends BaseSection {
|
|
|
10603
10603
|
}
|
|
10604
10604
|
}, (error) => {
|
|
10605
10605
|
if (error?.error?.errorCode == 1101) {
|
|
10606
|
-
// Backend already corrected the cart's stored prices to the live catalog before rejecting
|
|
10607
|
-
// this attempt - Continue just retries proceedToPayment(), which re-reads the now-correct
|
|
10608
|
-
// cart/totals and resubmits; Cancel leaves the customer on the cart to review it.
|
|
10609
10606
|
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
|
-
});
|
|
10607
|
+
this.showPriceChangedDialog(() => this.proceedToPayment());
|
|
10625
10608
|
return;
|
|
10626
10609
|
}
|
|
10627
|
-
else if (error?.
|
|
10610
|
+
else if (error?.status == 409) {
|
|
10628
10611
|
Swal.fire({
|
|
10629
10612
|
icon: "info",
|
|
10630
10613
|
html: "<p>" + error?.error?.message.replace(/ *\([^)]*\) */g, "") + "</p>",
|
|
@@ -10639,6 +10622,41 @@ class CartComponent extends BaseSection {
|
|
|
10639
10622
|
this.placeOrderLoader = false;
|
|
10640
10623
|
});
|
|
10641
10624
|
}
|
|
10625
|
+
/** Backend already corrected the cart's stored prices to the live catalog before rejecting the
|
|
10626
|
+
* placement attempt - refresh local cart state from the server first so the displayed total (and
|
|
10627
|
+
* whatever onContinue resubmits) reflects that correction instead of the stale local values. */
|
|
10628
|
+
showPriceChangedDialog(onContinue) {
|
|
10629
|
+
this.restService.getUserItems(this.userId, "CART").subscribe({
|
|
10630
|
+
next: (response) => {
|
|
10631
|
+
const freshCart = response?.data?.[0];
|
|
10632
|
+
if (freshCart) {
|
|
10633
|
+
this.cartInfo.orderedItems = freshCart.orderedItems ?? this.cartInfo.orderedItems;
|
|
10634
|
+
this.cartInfo.billdetails = freshCart.billdetails ?? this.cartInfo.billdetails;
|
|
10635
|
+
this.cartInfo.totalAmount = freshCart.totalAmount ?? this.cartInfo.totalAmount;
|
|
10636
|
+
this.responseData = this.cartInfo;
|
|
10637
|
+
}
|
|
10638
|
+
this.promptPriceChanged(onContinue);
|
|
10639
|
+
},
|
|
10640
|
+
error: () => this.promptPriceChanged(onContinue)
|
|
10641
|
+
});
|
|
10642
|
+
}
|
|
10643
|
+
promptPriceChanged(onContinue) {
|
|
10644
|
+
Swal.fire({
|
|
10645
|
+
icon: "warning",
|
|
10646
|
+
title: "Price Updated",
|
|
10647
|
+
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?",
|
|
10648
|
+
showCancelButton: true,
|
|
10649
|
+
confirmButtonText: "Continue",
|
|
10650
|
+
cancelButtonText: "Review Cart"
|
|
10651
|
+
}).then((response) => {
|
|
10652
|
+
if (response.isConfirmed) {
|
|
10653
|
+
onContinue();
|
|
10654
|
+
}
|
|
10655
|
+
else {
|
|
10656
|
+
this.currentTab = "BAG";
|
|
10657
|
+
}
|
|
10658
|
+
});
|
|
10659
|
+
}
|
|
10642
10660
|
addressSelected(index) {
|
|
10643
10661
|
this.selectedAddressIdx = index;
|
|
10644
10662
|
}
|
|
@@ -11078,21 +11096,7 @@ class CartComponent extends BaseSection {
|
|
|
11078
11096
|
},
|
|
11079
11097
|
error: (err) => {
|
|
11080
11098
|
if (err?.error?.errorCode == 1101) {
|
|
11081
|
-
|
|
11082
|
-
icon: "warning",
|
|
11083
|
-
title: "Price Updated",
|
|
11084
|
-
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?",
|
|
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
|
-
});
|
|
11099
|
+
this.showPriceChangedDialog(() => this.paymentWithCompletePoints());
|
|
11096
11100
|
return;
|
|
11097
11101
|
}
|
|
11098
11102
|
this.messageService.add({ severity: 'error', summary: 'Order Failed', detail: 'Failed to place order' });
|