@faststore/api 1.5.7 → 1.5.11
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 +41 -0
- package/dist/__generated__/schema.d.ts +7 -0
- package/dist/api.cjs.development.js +28 -9
- 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 +28 -9
- package/dist/api.esm.js.map +1 -1
- package/dist/platforms/vtex/clients/search/types/ProductSearchResult.d.ts +1 -1
- package/package.json +2 -2
- package/src/__generated__/schema.ts +8 -0
- package/src/platforms/vtex/clients/search/types/ProductSearchResult.ts +1 -1
- package/src/platforms/vtex/resolvers/collection.ts +1 -1
- package/src/platforms/vtex/resolvers/product.ts +9 -1
- package/src/platforms/vtex/resolvers/productGroup.ts +10 -0
- package/src/typeDefs/index.ts +2 -0
- package/src/typeDefs/product.graphql +1 -0
- package/src/typeDefs/productGroup.graphql +1 -0
- package/src/typeDefs/propertyValue.graphql +4 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Resolver } from '..'
|
|
2
2
|
import type { EnhancedSku } from '../utils/enhanceSku'
|
|
3
|
+
import { slugify } from '../utils/slugify'
|
|
3
4
|
|
|
4
5
|
type Root = EnhancedSku
|
|
5
6
|
|
|
@@ -28,7 +29,9 @@ export const StoreProduct: Record<string, Resolver<Root>> = {
|
|
|
28
29
|
itemListElement: [
|
|
29
30
|
...categoryTrees.reverse().map(({ categoryNames }, index) => ({
|
|
30
31
|
name: categoryNames[categoryNames.length - 1],
|
|
31
|
-
item: `/${categoryNames
|
|
32
|
+
item: `/${categoryNames
|
|
33
|
+
.map((categoryName) => slugify(categoryName))
|
|
34
|
+
.join('/')}`,
|
|
32
35
|
position: index + 1,
|
|
33
36
|
})),
|
|
34
37
|
{
|
|
@@ -85,4 +88,9 @@ export const StoreProduct: Record<string, Resolver<Root>> = {
|
|
|
85
88
|
return { ...simulation, product }
|
|
86
89
|
},
|
|
87
90
|
isVariantOf: ({ isVariantOf }) => isVariantOf,
|
|
91
|
+
additionalProperty: ({ attributes = [] }) =>
|
|
92
|
+
attributes.map((attribute) => ({
|
|
93
|
+
name: attribute.key,
|
|
94
|
+
value: attribute.value,
|
|
95
|
+
})),
|
|
88
96
|
}
|
|
@@ -6,4 +6,14 @@ export const StoreProductGroup: Record<string, Resolver<Product>> = {
|
|
|
6
6
|
hasVariant: (root) => root.skus.map((sku) => enhanceSku(sku, root)),
|
|
7
7
|
productGroupID: ({ product }) => product,
|
|
8
8
|
name: ({ name }) => name,
|
|
9
|
+
additionalProperty: ({ textAttributes = [], productSpecifications = [] }) => {
|
|
10
|
+
const specs = new Set(productSpecifications)
|
|
11
|
+
|
|
12
|
+
return textAttributes
|
|
13
|
+
.filter((attribute) => specs.has(attribute.labelKey))
|
|
14
|
+
.map((attribute) => ({
|
|
15
|
+
name: attribute.labelKey,
|
|
16
|
+
value: attribute.labelValue,
|
|
17
|
+
}))
|
|
18
|
+
},
|
|
9
19
|
}
|
package/src/typeDefs/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ import Review from './review.graphql'
|
|
|
20
20
|
import Seo from './seo.graphql'
|
|
21
21
|
import Cart from './cart.graphql'
|
|
22
22
|
import Status from './status.graphql'
|
|
23
|
+
import PropertyValue from './propertyValue.graphql'
|
|
23
24
|
|
|
24
25
|
export const typeDefs = [
|
|
25
26
|
Query,
|
|
@@ -42,6 +43,7 @@ export const typeDefs = [
|
|
|
42
43
|
Order,
|
|
43
44
|
Cart,
|
|
44
45
|
Status,
|
|
46
|
+
PropertyValue,
|
|
45
47
|
]
|
|
46
48
|
.map(print)
|
|
47
49
|
.join('\n')
|