@faststore/api 1.12.12 → 1.12.15

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
@@ -634,6 +634,11 @@ const StoreCollection = {
634
634
  key: 'brand',
635
635
  value: slug
636
636
  }]
637
+ } : isCollection(root) ? {
638
+ selectedFacets: [{
639
+ key: 'productclusterids',
640
+ value: root.id
641
+ }]
637
642
  } : {
638
643
  selectedFacets: slug.split('/').map((segment, index) => ({
639
644
  key: `category-${index + 1}`,
@@ -657,10 +662,16 @@ const StoreCollection = {
657
662
 
658
663
  const segments = slug.split('/').filter(segment => Boolean(segment));
659
664
  const slugs = segments.map((__, index) => segments.slice(0, index + 1).join('/'));
660
- const collections = await Promise.all(slugs.map(s => collectionLoader.load(s)));
665
+ const collections = await Promise.all(slugs.map(async s => {
666
+ const collection = await collectionLoader.load(s);
667
+ return {
668
+ slug: s,
669
+ ...collection
670
+ };
671
+ }));
661
672
  return {
662
673
  itemListElement: collections.map((collection, index) => ({
663
- item: new URL(`https://${collection.url}`).pathname.toLowerCase(),
674
+ item: isCollection(collection) ? `/${collection.slug}` : new URL(`https://${collection.url}`).pathname.toLowerCase(),
664
675
  name: collection.name,
665
676
  position: index + 1
666
677
  })),
@@ -1091,8 +1102,17 @@ const getOrderForm = async (id, session, {
1091
1102
 
1092
1103
  const orderForm = await commerce.checkout.orderForm({
1093
1104
  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);
1105
+ }); // Stores that are not yet providing the session while validating the cart
1106
+ // should not be able to update the shipping data
1107
+ //
1108
+ // This was causing errors while validating regionalizated carts
1109
+ // because the following code was trying to change the shippingData to an undefined address/session
1110
+
1111
+ if (!session) {
1112
+ return orderForm;
1113
+ }
1114
+
1115
+ const shouldUpdateShippingData = ((_orderForm$shippingDa = orderForm.shippingData) == null ? void 0 : (_orderForm$shippingDa2 = _orderForm$shippingDa.address) == null ? void 0 : _orderForm$shippingDa2.postalCode) != session.postalCode;
1096
1116
 
1097
1117
  if (shouldUpdateShippingData) {
1098
1118
  return commerce.checkout.shippingData({