@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.
@@ -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.join('/').toLowerCase()}`,
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
  }
@@ -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')
@@ -16,6 +16,7 @@ type StoreProduct {
16
16
  review: [StoreReview!]!
17
17
  aggregateRating: StoreAggregateRating!
18
18
  isVariantOf: StoreProductGroup!
19
+ additionalProperty: [StorePropertyValue!]!
19
20
  }
20
21
 
21
22
  input IStoreProduct {
@@ -2,4 +2,5 @@ type StoreProductGroup {
2
2
  hasVariant: [StoreProduct!]!
3
3
  productGroupID: String!
4
4
  name: String!
5
+ additionalProperty: [StorePropertyValue!]!
5
6
  }
@@ -0,0 +1,4 @@
1
+ type StorePropertyValue {
2
+ value: String!
3
+ name: String!
4
+ }