@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/api",
3
- "version": "1.12.12",
3
+ "version": "1.12.15",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -46,5 +46,5 @@
46
46
  "peerDependencies": {
47
47
  "graphql": "^15.6.0"
48
48
  },
49
- "gitHead": "9ef2cae11e8ae9458675d0fbfdcabe0eac0c8860"
49
+ "gitHead": "c3e2335c34d75b9efb037dbee5e899096b04698f"
50
50
  }
@@ -54,6 +54,10 @@ export const StoreCollection: Record<string, Resolver<Root>> = {
54
54
  ? {
55
55
  selectedFacets: [{ key: 'brand', value: slug }],
56
56
  }
57
+ : isCollection(root)
58
+ ? {
59
+ selectedFacets: [{ key: 'productclusterids', value: root.id }],
60
+ }
57
61
  : {
58
62
  selectedFacets: slug.split('/').map((segment, index) => ({
59
63
  key: `category-${index + 1}`,
@@ -79,13 +83,22 @@ export const StoreCollection: Record<string, Resolver<Root>> = {
79
83
  segments.slice(0, index + 1).join('/')
80
84
  )
81
85
 
82
- const collections = await Promise.all(
83
- slugs.map((s) => collectionLoader.load(s))
86
+ const collections: (CollectionPageType & {
87
+ slug: string
88
+ })[] = await Promise.all(
89
+ slugs.map(async (s) => {
90
+ const collection = await collectionLoader.load(s)
91
+ return { slug: s, ...collection }
92
+ })
84
93
  )
85
94
 
86
95
  return {
87
96
  itemListElement: collections.map((collection, index) => ({
88
- item: new URL(`https://${collection.url}`).pathname.toLowerCase(),
97
+ item: isCollection(collection)
98
+ ? `/${collection.slug}`
99
+ : new URL(
100
+ `https://${(collection as CollectionPageType).url}`
101
+ ).pathname.toLowerCase(),
89
102
  name: collection.name,
90
103
  position: index + 1,
91
104
  })),
@@ -205,8 +205,17 @@ const getOrderForm = async (
205
205
  id,
206
206
  });
207
207
 
208
+ // Stores that are not yet providing the session while validating the cart
209
+ // should not be able to update the shipping data
210
+ //
211
+ // This was causing errors while validating regionalizated carts
212
+ // because the following code was trying to change the shippingData to an undefined address/session
213
+ if(!session) {
214
+ return orderForm
215
+ }
216
+
208
217
  const shouldUpdateShippingData =
209
- orderForm.shippingData?.address?.postalCode != session?.postalCode;
218
+ orderForm.shippingData?.address?.postalCode != session.postalCode;
210
219
 
211
220
  if (shouldUpdateShippingData) {
212
221
  return commerce.checkout.shippingData({