@usereactify/search 4.2.1 → 4.2.2

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
@@ -2,6 +2,18 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [4.2.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.2.1...v4.2.2) (2022-06-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * merge global boosting rules with curation when empty ([248cbdd](https://bitbucket.org/usereactify/reactify-search-ui/commit/248cbdda01864c0d536f5e971f81e331de4c827d))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * pass on nocache url param to config endpoint to bust caching on worker side ([51b9dcf](https://bitbucket.org/usereactify/reactify-search-ui/commit/51b9dcf0b8145691a2dd00aedbe951f71bbc04b3))
16
+
5
17
  ### [4.2.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.2.0...v4.2.1) (2022-06-14)
6
18
 
7
19
  ## [4.2.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.1.0...v4.2.0) (2022-06-14)
@@ -54,10 +54,15 @@ const useLiveConfig = (shopifyPermanentDomain, configId) => {
54
54
  if (configId) {
55
55
  searchParams.set("id", configId);
56
56
  }
57
+ const skipCache = new URLSearchParams(window.location.href.split("?")[1]).get("nocache") !== null;
58
+ if (skipCache) {
59
+ searchParams.set("nocache", "true");
60
+ }
57
61
  const json = yield fetch(`https://config.search.reactify.app/?${searchParams.toString()}`).then((response) => response.json());
58
62
  setConfig(json.body);
59
63
  window.sessionStorage.setItem("reactify-search:config", JSON.stringify({
60
64
  expiresAt: new Date().getTime() + CACHE_EXPIRY,
65
+ noCache: skipCache,
61
66
  config: json.body,
62
67
  }));
63
68
  }))();
package/dist/provider.js CHANGED
@@ -275,5 +275,20 @@ const useCuration = (config, collection, searchQuery) => react_1.default.useMemo
275
275
  normalisedHandleOrSearchTerm === normalisedCollectionHandle);
276
276
  return false;
277
277
  });
278
- return curation ? curation : globalCuration ? globalCuration : undefined;
278
+ const addGlobalBoosting = (curation) => {
279
+ const curationIsCollection = curation.type === "collection";
280
+ if (!curationIsCollection)
281
+ return curation;
282
+ const curationHasRules = !!curation.boosting.groupings.length ||
283
+ !!curation.boosting.sortings.length;
284
+ if (curationHasRules || !globalCuration)
285
+ return curation;
286
+ const curationWithGlobalBoosting = Object.assign(Object.assign({}, curation), { boosting: globalCuration.boosting });
287
+ return curationWithGlobalBoosting;
288
+ };
289
+ return curation
290
+ ? addGlobalBoosting(curation)
291
+ : globalCuration
292
+ ? globalCuration
293
+ : undefined;
279
294
  }, [config, collection, searchQuery]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "4.2.1",
4
+ "version": "4.2.2",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -15,6 +15,7 @@
15
15
  "release": "standard-version",
16
16
  "release:patch": "standard-version --release-as patch",
17
17
  "release:beta": "standard-version --release-as minor --prerelease beta",
18
+ "release:local": "yalc publish",
18
19
  "build": "rimraf dist && tsc",
19
20
  "prettier": "prettier --write .",
20
21
  "storybook": "start-storybook -p 6006",