@faststore/api 1.12.6 → 1.12.8

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,22 @@
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.12.8](https://github.com/vtex/faststore/compare/v1.12.7...v1.12.8) (2022-09-29)
7
+
8
+ **Note:** Version bump only for package @faststore/api
9
+
10
+
11
+
12
+
13
+
14
+ ## [1.12.7](https://github.com/vtex/faststore/compare/v1.12.6...v1.12.7) (2022-09-28)
15
+
16
+ **Note:** Version bump only for package @faststore/api
17
+
18
+
19
+
20
+
21
+
6
22
  ## [1.12.6](https://github.com/vtex/faststore/compare/v1.12.5...v1.12.6) (2022-09-26)
7
23
 
8
24
 
@@ -1691,6 +1691,18 @@ const Query = {
1691
1691
  }
1692
1692
 
1693
1693
  const sku = await skuLoader.load(skuId);
1694
+ /**
1695
+ * Here be dragons 🦄🦄🦄
1696
+ *
1697
+ * In some cases, the slug has a valid skuId for a different
1698
+ * product. This condition makes sure that the fetched sku
1699
+ * is the one we actually asked for
1700
+ * */
1701
+
1702
+ if (slug && sku.isVariantOf.linkText && !slug.startsWith(sku.isVariantOf.linkText)) {
1703
+ throw new Error(`Slug was set but the fetched sku does not satisfy the slug condition. slug: ${slug}, linkText: ${sku.isVariantOf.linkText}`);
1704
+ }
1705
+
1694
1706
  return sku;
1695
1707
  } catch (err) {
1696
1708
  if (slug == null) {
@@ -1917,10 +1929,12 @@ const StoreSearchResult = {
1917
1929
  // a full text search.
1918
1930
 
1919
1931
  if (searchArgs.query) {
1932
+ var _products$correction$, _products$correction;
1933
+
1920
1934
  sp.sendEvent({
1921
1935
  type: 'search.query',
1922
1936
  text: searchArgs.query,
1923
- misspelled: products.correction.misspelled,
1937
+ misspelled: (_products$correction$ = (_products$correction = products.correction) == null ? void 0 : _products$correction.misspelled) != null ? _products$correction$ : false,
1924
1938
  match: products.recordsFiltered,
1925
1939
  operator: products.operator
1926
1940
  }).catch(console.error);