@faststore/api 2.2.38 → 2.2.42

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": "2.2.38",
3
+ "version": "2.2.42",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -59,5 +59,5 @@
59
59
  "@envelop/core": "^1 || ^2",
60
60
  "graphql": "^15.6.0"
61
61
  },
62
- "gitHead": "d766a3a32d882476d6234abd41ae7eb3818ea3b7"
62
+ "gitHead": "42551deeabb190aa2f4efa0e0803fec593a997af"
63
63
  }
@@ -3,6 +3,7 @@ import type { Resolver } from '..'
3
3
  import type { SearchArgs } from '../clients/search'
4
4
  import type { Facet } from '../clients/search/types/FacetSearchResult'
5
5
  import { ProductSearchResult } from '../clients/search/types/ProductSearchResult'
6
+ import { pickBestSku } from '../utils/sku'
6
7
 
7
8
  export type Root = {
8
9
  searchArgs: Omit<SearchArgs, 'type'>
@@ -45,7 +46,9 @@ export const StoreSearchResult: Record<string, Resolver<Root>> = {
45
46
 
46
47
  const skus = productSearchResult.products
47
48
  .map((product) => {
48
- const [maybeSku] = product.items
49
+ // What determines the presentation of the SKU is the price order
50
+ // https://help.vtex.com/pt/tutorial/ordenando-imagens-na-vitrine-e-na-pagina-de-produto--tutorials_278
51
+ const maybeSku = pickBestSku(product.items)
49
52
 
50
53
  return maybeSku && enhanceSku(maybeSku, product)
51
54
  })
@@ -63,7 +66,9 @@ export const StoreSearchResult: Record<string, Resolver<Root>> = {
63
66
 
64
67
  const skus = productSearchResult.products
65
68
  .map((product) => {
66
- const [maybeSku] = product.items
69
+ // What determines the presentation of the SKU is the price order
70
+ // https://help.vtex.com/pt/tutorial/ordenando-imagens-na-vitrine-e-na-pagina-de-produto--tutorials_278
71
+ const maybeSku = pickBestSku(product.items)
67
72
 
68
73
  return maybeSku && enhanceSku(maybeSku, product)
69
74
  })