@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/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.12.15](https://github.com/vtex/faststore/compare/v1.12.14...v1.12.15) (2022-10-15)
7
+
8
+ **Note:** Version bump only for package @faststore/api
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.12.14](https://github.com/vtex/faststore/compare/v1.12.13...v1.12.14) (2022-10-13)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * checks for session existance before trying to update shipping data ([#1487](https://github.com/vtex/faststore/issues/1487)) ([8edced3](https://github.com/vtex/faststore/commit/8edced304ccdc804c7c9eb215955cec6f7c621ca))
20
+
21
+
22
+
6
23
  ## [1.12.12](https://github.com/vtex/faststore/compare/v1.12.11...v1.12.12) (2022-10-10)
7
24
 
8
25
  **Note:** Version bump only for package @faststore/api
@@ -638,6 +638,11 @@ const StoreCollection = {
638
638
  key: 'brand',
639
639
  value: slug
640
640
  }]
641
+ } : isCollection(root) ? {
642
+ selectedFacets: [{
643
+ key: 'productclusterids',
644
+ value: root.id
645
+ }]
641
646
  } : {
642
647
  selectedFacets: slug.split('/').map((segment, index) => ({
643
648
  key: `category-${index + 1}`,
@@ -661,10 +666,16 @@ const StoreCollection = {
661
666
 
662
667
  const segments = slug.split('/').filter(segment => Boolean(segment));
663
668
  const slugs = segments.map((__, index) => segments.slice(0, index + 1).join('/'));
664
- const collections = await Promise.all(slugs.map(s => collectionLoader.load(s)));
669
+ const collections = await Promise.all(slugs.map(async s => {
670
+ const collection = await collectionLoader.load(s);
671
+ return {
672
+ slug: s,
673
+ ...collection
674
+ };
675
+ }));
665
676
  return {
666
677
  itemListElement: collections.map((collection, index) => ({
667
- item: new URL(`https://${collection.url}`).pathname.toLowerCase(),
678
+ item: isCollection(collection) ? `/${collection.slug}` : new URL(`https://${collection.url}`).pathname.toLowerCase(),
668
679
  name: collection.name,
669
680
  position: index + 1
670
681
  })),
@@ -1095,8 +1106,17 @@ const getOrderForm = async (id, session, {
1095
1106
 
1096
1107
  const orderForm = await commerce.checkout.orderForm({
1097
1108
  id
1098
- });
1099
- 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);
1109
+ }); // Stores that are not yet providing the session while validating the cart
1110
+ // should not be able to update the shipping data
1111
+ //
1112
+ // This was causing errors while validating regionalizated carts
1113
+ // because the following code was trying to change the shippingData to an undefined address/session
1114
+
1115
+ if (!session) {
1116
+ return orderForm;
1117
+ }
1118
+
1119
+ const shouldUpdateShippingData = ((_orderForm$shippingDa = orderForm.shippingData) == null ? void 0 : (_orderForm$shippingDa2 = _orderForm$shippingDa.address) == null ? void 0 : _orderForm$shippingDa2.postalCode) != session.postalCode;
1100
1120
 
1101
1121
  if (shouldUpdateShippingData) {
1102
1122
  return commerce.checkout.shippingData({