@faststore/api 1.7.51 → 1.7.54

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 CHANGED
@@ -3,6 +3,36 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.7.54 (2022-05-06)
7
+
8
+ **Note:** Version bump only for package @faststore/api
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.7.53 (2022-05-06)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * suggestions api url ([#1273](https://github.com/vtex/faststore/issues/1273)) ([6f8a961](https://github.com/vtex/faststore/commit/6f8a9613e4627f91815e669a007ec4ff4c54ffe5))
20
+
21
+
22
+
23
+
24
+
25
+ ## 1.7.52 (2022-05-06)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * Release workflow ([#1271](https://github.com/vtex/faststore/issues/1271)) ([3b995a8](https://github.com/vtex/faststore/commit/3b995a82c956c13c4d6f9453ac4f44195c5ef543))
31
+
32
+
33
+
34
+
35
+
6
36
  ## 1.7.51 (2022-05-03)
7
37
 
8
38
  **Note:** Version bump only for package @faststore/api
@@ -162,9 +162,9 @@ const IntelligentSearch = ({
162
162
  type: 'product_search'
163
163
  });
164
164
 
165
- const suggestedProducts = args => fetchAPI(`${base}/api/suggestion_products/?term=${args.query}`);
165
+ const suggestedProducts = args => fetchAPI(`${base}/_v/api/intelligent-search/product_search?query=${args.query}`);
166
166
 
167
- const suggestedTerms = args => fetchAPI(`${base}/api/split/suggestion_search/?q=${args.query}`);
167
+ const suggestedTerms = args => fetchAPI(`${base}/_v/api/intelligent-search/search_suggestions?query=${args.query}`);
168
168
 
169
169
  const facets = args => search({ ...args,
170
170
  type: 'facets'
@@ -977,18 +977,20 @@ const StoreProduct = {
977
977
  };
978
978
  },
979
979
  isVariantOf: root => root,
980
- // TODO: get this value. Fix any type
981
980
  additionalProperty: ({
982
- attributes = []
983
- }) => attributes.map(attribute => ({
984
- name: attribute.key,
985
- value: attribute.value
986
- }))
981
+ variations = []
982
+ }) => {
983
+ return variations.flatMap(({
984
+ name,
985
+ values
986
+ }) => values.map(value => ({
987
+ name,
988
+ value
989
+ })));
990
+ }
987
991
  };
988
992
 
989
- const BLOCKED_PROPERTIES = {
990
- sellerId: true
991
- };
993
+ const BLOCKED_SPECIFICATIONS = /*#__PURE__*/new Set(['allSpecifications']);
992
994
  const StoreProductGroup = {
993
995
  hasVariant: root => root.isVariantOf.items.map(item => enhanceSku(item, root.isVariantOf)),
994
996
  productGroupID: ({
@@ -999,18 +1001,19 @@ const StoreProductGroup = {
999
1001
  }) => isVariantOf.productName,
1000
1002
  additionalProperty: ({
1001
1003
  isVariantOf: {
1002
- properties
1004
+ specificationGroups
1003
1005
  }
1004
- }) => properties.flatMap(property => {
1005
- if (BLOCKED_PROPERTIES[property.name]) {
1006
- return [];
1007
- }
1008
-
1009
- return property.values.map(propertyValue => ({
1010
- name: property.name,
1011
- value: propertyValue
1012
- }));
1013
- })
1006
+ }) => specificationGroups // filter sku specifications so we dont mess sku with product specs
1007
+ .filter(specificationGroup => !BLOCKED_SPECIFICATIONS.has(specificationGroup.name)) // Transform specs back into product specs
1008
+ .flatMap(({
1009
+ specifications
1010
+ }) => specifications.flatMap(({
1011
+ name,
1012
+ values
1013
+ }) => values.map(value => ({
1014
+ name,
1015
+ value
1016
+ }))))
1014
1017
  };
1015
1018
 
1016
1019
  /**
@@ -1239,9 +1242,7 @@ const StoreSearchResult = {
1239
1242
  return maybeSku && enhanceSku(maybeSku, product);
1240
1243
  }).filter(sku => !!sku);
1241
1244
  const {
1242
- suggestion: {
1243
- searches
1244
- }
1245
+ searches
1245
1246
  } = terms;
1246
1247
  return {
1247
1248
  terms: searches.map(item => item.term),