@faststore/api 1.12.14 → 1.12.16
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 +16 -0
- package/dist/api.cjs.development.js +14 -3
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +14 -3
- package/dist/api.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/platforms/vtex/resolvers/collection.ts +16 -3
- package/src/platforms/vtex/resolvers/validateCart.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.16",
|
|
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": "
|
|
49
|
+
"gitHead": "631697866c236b6d9a524fedd2e60ca34de0005f"
|
|
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
|
|
83
|
-
|
|
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:
|
|
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
|
})),
|