@usereactify/search 4.2.6 → 4.3.0

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,22 @@
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.3.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.3.0-beta.0...v4.3.0) (2022-07-21)
6
+
7
+ ## [4.3.0-beta.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.2.7...v4.3.0-beta.0) (2022-07-20)
8
+
9
+
10
+ ### Features
11
+
12
+ * hide callouts when not sorting by "_score" or "collections.position" ([bf2d57a](https://bitbucket.org/usereactify/reactify-search-ui/commit/bf2d57aa5b682375dc06995bb54d90ece330f5e3))
13
+
14
+ ### [4.2.7](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.2.6...v4.2.7) (2022-07-19)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * only apply inventory sensor to products, not callouts ([7c186b8](https://bitbucket.org/usereactify/reactify-search-ui/commit/7c186b83c9f403f0987ef088714db1438f27cd84))
20
+
5
21
  ### [4.2.6](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.2.5...v4.2.6) (2022-07-11)
6
22
 
7
23
  ### [4.2.5](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.2.4...v4.2.5) (2022-07-11)
package/dist/provider.js CHANGED
@@ -56,7 +56,17 @@ const Provider = (_a) => {
56
56
  return renderBooting();
57
57
  return null;
58
58
  }
59
- return react_1.default.createElement(exports.ConfiguredProvider, Object.assign({}, props, { config: config }));
59
+ return (react_1.default.createElement(Sentry.ErrorBoundary, { fallback: react_1.default.createElement("p", null, "An error has occurred"), beforeCapture: (scope) => {
60
+ scope.setTag("index", props.index);
61
+ scope.setTag("shop", props.shopifyPermanentDomain);
62
+ if (!!props.collection)
63
+ scope.setTag("collection", props.collection.handle);
64
+ if (!!props.filterStackHandle)
65
+ scope.setTag("filter", props.filterStackHandle);
66
+ if (!!props.instantSearch)
67
+ scope.setTag("search", true);
68
+ } },
69
+ react_1.default.createElement(exports.ConfiguredProvider, Object.assign({}, props, { config: config }))));
60
70
  };
61
71
  exports.Provider = Provider;
62
72
  const ConfiguredProvider = (props) => {
@@ -13,11 +13,38 @@ const SensorInventoryAvailable = () => {
13
13
  return null;
14
14
  return (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorInventoryAvailable", customQuery: () => ({
15
15
  query: {
16
- nested: {
17
- path: "variants",
18
- query: {
19
- match: { "variants.available": true },
20
- },
16
+ bool: {
17
+ should: [
18
+ {
19
+ bool: {
20
+ must: [
21
+ {
22
+ term: {
23
+ type: {
24
+ value: "product",
25
+ },
26
+ },
27
+ },
28
+ {
29
+ nested: {
30
+ path: "variants",
31
+ query: {
32
+ match: { "variants.available": true },
33
+ },
34
+ },
35
+ },
36
+ ],
37
+ },
38
+ },
39
+ {
40
+ term: {
41
+ type: {
42
+ value: "callout",
43
+ },
44
+ },
45
+ },
46
+ ],
47
+ minimum_should_match: "1",
21
48
  },
22
49
  },
23
50
  }) }));
@@ -24,12 +24,16 @@ const SensorSort = () => {
24
24
  return {
25
25
  sort: buildSort({
26
26
  config,
27
- curation,
28
27
  sortOption,
29
28
  collection,
29
+ curation,
30
+ globalCuration,
31
+ }),
32
+ query: buildQuery({
33
+ sortOption,
34
+ curation,
30
35
  globalCuration,
31
36
  }),
32
- query: buildQuery(curation, globalCuration),
33
37
  };
34
38
  }, [config, sortOption, curation]);
35
39
  react_1.default.useEffect(() => {
@@ -150,37 +154,52 @@ function mapCollectionPositionSortClause(collection) {
150
154
  },
151
155
  ];
152
156
  }
153
- const buildQuery = (curation, globalCuration) => {
157
+ const buildQuery = (args) => {
154
158
  var _a;
155
- if (!curation || globalCuration)
159
+ const { curation, sortOption, globalCuration } = args;
160
+ if (!curation || globalCuration) {
156
161
  return undefined;
162
+ }
157
163
  return {
158
164
  bool: {
159
- must_not: {
160
- nested: {
161
- path: "curations",
162
- query: {
163
- bool: {
164
- must: [
165
- {
166
- term: {
167
- [`curations.${"collection" === curation.type
168
- ? "collectionHandle"
169
- : "searchTerm"}.keyword`]: "collection" === curation.type
170
- ? curation.collectionHandle
171
- : (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
165
+ must_not: [
166
+ {
167
+ nested: {
168
+ path: "curations",
169
+ query: {
170
+ bool: {
171
+ must: [
172
+ {
173
+ term: {
174
+ [`curations.${"collection" === curation.type
175
+ ? "collectionHandle"
176
+ : "searchTerm"}.keyword`]: "collection" === curation.type
177
+ ? curation.collectionHandle
178
+ : (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
179
+ },
172
180
  },
173
- },
174
- {
175
- term: {
176
- "curations.hidden": true,
181
+ {
182
+ term: {
183
+ "curations.hidden": true,
184
+ },
177
185
  },
178
- },
179
- ],
186
+ ],
187
+ },
180
188
  },
181
189
  },
182
190
  },
183
- },
191
+ // hide callout when not sorting by _score or collections.position
192
+ ...(sortOption &&
193
+ !["_score", "collections.position"].includes(sortOption.field)
194
+ ? [
195
+ {
196
+ term: {
197
+ type: "callout",
198
+ },
199
+ },
200
+ ]
201
+ : []),
202
+ ],
184
203
  },
185
204
  };
186
205
  };
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.6",
4
+ "version": "4.3.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",