@faststore/api 1.12.14 → 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.14",
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": "4480e494ab3aa840f1283273c53f3b55cc608fc0"
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
  })),