merchi_cart 1.2.1 → 1.2.2
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/README.md +2 -1
- package/esm/CartProvider.js +93 -57
- package/lib/CartProvider.js +93 -57
- package/package.json +1 -1
- package/src/CartProvider.tsx +15 -0
package/package.json
CHANGED
package/src/CartProvider.tsx
CHANGED
|
@@ -645,6 +645,19 @@ const CartProvider = ({
|
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
647
|
|
|
648
|
+
async function getCartShipmentOptions() {
|
|
649
|
+
setFetchingShipmentGroups(true);
|
|
650
|
+
try {
|
|
651
|
+
const cartWithGroups = await getCartShipmentGroupsAndQuotes(cart);
|
|
652
|
+
const cartJson = cartWithGroups.toJson();
|
|
653
|
+
setCart({...cartJson});
|
|
654
|
+
} catch (e: any) {
|
|
655
|
+
alertError(e.errorMessage || e.message || 'Unable to fetch shipment options');
|
|
656
|
+
} finally {
|
|
657
|
+
setFetchingShipmentGroups(false);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
648
661
|
async function getMerchiCartValues() {
|
|
649
662
|
const { cartItems, currency, subtotalCost, taxAmount, totalCost } = (cart as any);
|
|
650
663
|
const cartItemsCount = cartItems ? cartItems.length : 0;
|
|
@@ -891,6 +904,8 @@ const CartProvider = ({
|
|
|
891
904
|
setLoadingTotals,
|
|
892
905
|
|
|
893
906
|
setActiveTabAndEditDisabled,
|
|
907
|
+
|
|
908
|
+
getCartShipmentOptions, // refetch of the shipment quote options
|
|
894
909
|
} as PropsCart}
|
|
895
910
|
>
|
|
896
911
|
{children}
|