@faststore/api 1.7.51 → 1.7.52

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.
@@ -5,24 +5,24 @@ import type { StoreProduct } from './product'
5
5
 
6
6
  type Root = PromiseType<ReturnType<typeof StoreProduct.isVariantOf>>
7
7
 
8
- const BLOCKED_PROPERTIES: Record<string, boolean> = {
9
- sellerId: true,
10
- }
8
+ const BLOCKED_SPECIFICATIONS = new Set(['allSpecifications'])
11
9
 
12
10
  export const StoreProductGroup: Record<string, Resolver<Root>> = {
13
11
  hasVariant: (root) =>
14
12
  root.isVariantOf.items.map((item) => enhanceSku(item, root.isVariantOf)),
15
13
  productGroupID: ({ isVariantOf }) => isVariantOf.productId,
16
14
  name: ({ isVariantOf }) => isVariantOf.productName,
17
- additionalProperty: ({ isVariantOf: { properties } }) =>
18
- properties.flatMap((property) => {
19
- if (BLOCKED_PROPERTIES[property.name]) {
20
- return []
21
- }
22
-
23
- return property.values.map((propertyValue) => ({
24
- name: property.name,
25
- value: propertyValue,
26
- }))
27
- }),
15
+ additionalProperty: ({ isVariantOf: { specificationGroups } }) =>
16
+ specificationGroups
17
+ // filter sku specifications so we dont mess sku with product specs
18
+ .filter(
19
+ (specificationGroup) =>
20
+ !BLOCKED_SPECIFICATIONS.has(specificationGroup.name)
21
+ )
22
+ // Transform specs back into product specs
23
+ .flatMap(({ specifications }) =>
24
+ specifications.flatMap(({ name, values }) =>
25
+ values.map((value) => ({ name, value }))
26
+ )
27
+ ),
28
28
  }