@faststore/api 1.12.12 → 1.12.14

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/dist/api.esm.js CHANGED
@@ -1091,8 +1091,17 @@ const getOrderForm = async (id, session, {
1091
1091
 
1092
1092
  const orderForm = await commerce.checkout.orderForm({
1093
1093
  id
1094
- });
1095
- const shouldUpdateShippingData = ((_orderForm$shippingDa = orderForm.shippingData) == null ? void 0 : (_orderForm$shippingDa2 = _orderForm$shippingDa.address) == null ? void 0 : _orderForm$shippingDa2.postalCode) != (session == null ? void 0 : session.postalCode);
1094
+ }); // Stores that are not yet providing the session while validating the cart
1095
+ // should not be able to update the shipping data
1096
+ //
1097
+ // This was causing errors while validating regionalizated carts
1098
+ // because the following code was trying to change the shippingData to an undefined address/session
1099
+
1100
+ if (!session) {
1101
+ return orderForm;
1102
+ }
1103
+
1104
+ const shouldUpdateShippingData = ((_orderForm$shippingDa = orderForm.shippingData) == null ? void 0 : (_orderForm$shippingDa2 = _orderForm$shippingDa.address) == null ? void 0 : _orderForm$shippingDa2.postalCode) != session.postalCode;
1096
1105
 
1097
1106
  if (shouldUpdateShippingData) {
1098
1107
  return commerce.checkout.shippingData({