@usereactify/search 4.4.2 → 4.4.5
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 +21 -0
- package/dist/package.json +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +2 -2
- package/dist/src/provider.d.ts +2 -2
- package/dist/src/provider.js +3 -3
- package/dist/src/sensor/SensorCollection.js +42 -27
- package/dist/src/sensor/SensorSearch.js +15 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
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.4.5](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.4...v4.4.5) (2022-08-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* rename "additonalComponentHandles" to "additonalComponentIds" ([d2b3fd3](https://bitbucket.org/usereactify/reactify-search-ui/commit/d2b3fd3a829168ca1150540b32d9cd21c07b397f))
|
|
11
|
+
|
|
12
|
+
### [4.4.4](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.3...v4.4.4) (2022-08-05)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* ignore curation in sensors if it's global curation ([5762c0d](https://bitbucket.org/usereactify/reactify-search-ui/commit/5762c0dc30f2d3eac1ebae71208cc93b190d706f))
|
|
18
|
+
|
|
19
|
+
### [4.4.3](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.2...v4.4.3) (2022-08-03)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* only query for curations when a curation is active ([6ff04df](https://bitbucket.org/usereactify/reactify-search-ui/commit/6ff04df4c88bc3d2c0c205fb31b8b7899785a815))
|
|
25
|
+
|
|
5
26
|
### [4.4.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.1...v4.4.2) (2022-08-01)
|
|
6
27
|
|
|
7
28
|
### [4.4.1](https://bitbucket.org/usereactify/reactify-search-ui/compare/v4.4.0...v4.4.1) (2022-07-21)
|
package/dist/package.json
CHANGED
|
@@ -10,13 +10,13 @@ const useFilters_1 = require("../useFilters");
|
|
|
10
10
|
const provider_1 = require("../../provider");
|
|
11
11
|
const useReactiveReactProp = (currentHandle) => {
|
|
12
12
|
const filters = (0, useFilters_1.useFilters)();
|
|
13
|
-
const {
|
|
13
|
+
const { additionalComponentIds } = (0, provider_1.useContext)();
|
|
14
14
|
return react_1.default.useMemo(() => {
|
|
15
15
|
return {
|
|
16
16
|
and: [
|
|
17
17
|
"SearchInput",
|
|
18
18
|
...sensor_1.SENSOR_IDS,
|
|
19
|
-
...(
|
|
19
|
+
...(additionalComponentIds !== null && additionalComponentIds !== void 0 ? additionalComponentIds : []),
|
|
20
20
|
...filters.map((filter) => filter.handle),
|
|
21
21
|
].filter((handle) => handle !== currentHandle),
|
|
22
22
|
};
|
package/dist/src/provider.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ declare type Context = {
|
|
|
20
20
|
theme?: Theme;
|
|
21
21
|
curation?: ConfigCuration;
|
|
22
22
|
/** Array of additional component IDs managed outside of Reactify Search */
|
|
23
|
-
|
|
23
|
+
additionalComponentIds?: string[];
|
|
24
24
|
};
|
|
25
25
|
declare const Context: React.Context<Context | undefined>;
|
|
26
26
|
declare type Props = {
|
|
@@ -35,7 +35,7 @@ declare type Props = {
|
|
|
35
35
|
credentials?: Credentials;
|
|
36
36
|
theme?: Theme;
|
|
37
37
|
/** Array of additional component IDs managed outside of Reactify Search */
|
|
38
|
-
|
|
38
|
+
additionalComponentIds?: string[];
|
|
39
39
|
/**
|
|
40
40
|
* Optional render function to display a component when the config is loading.
|
|
41
41
|
*/
|
package/dist/src/provider.js
CHANGED
|
@@ -71,7 +71,7 @@ const Provider = (_a) => {
|
|
|
71
71
|
exports.Provider = Provider;
|
|
72
72
|
const ConfiguredProvider = (props) => {
|
|
73
73
|
var _a, _b;
|
|
74
|
-
const { index, config, children, collection, instantSearch, filterStackHandle, noReactiveBase, shopifyPermanentDomain,
|
|
74
|
+
const { index, config, children, collection, instantSearch, filterStackHandle, noReactiveBase, shopifyPermanentDomain, additionalComponentIds, onRedirect, } = props;
|
|
75
75
|
const credentials = (_a = props.credentials) !== null && _a !== void 0 ? _a : defaultCredentials;
|
|
76
76
|
const theme = (_b = props.theme) !== null && _b !== void 0 ? _b : {
|
|
77
77
|
typography: {
|
|
@@ -152,7 +152,7 @@ const ConfiguredProvider = (props) => {
|
|
|
152
152
|
setShowInstantSearchResults,
|
|
153
153
|
theme,
|
|
154
154
|
curation,
|
|
155
|
-
|
|
155
|
+
additionalComponentIds,
|
|
156
156
|
instantSearch: !!instantSearch,
|
|
157
157
|
showInstantSearchResults: !!showInstantSearchResults && !!searchQuery,
|
|
158
158
|
}), [
|
|
@@ -169,7 +169,7 @@ const ConfiguredProvider = (props) => {
|
|
|
169
169
|
onRedirect,
|
|
170
170
|
submitSearch,
|
|
171
171
|
instantSearch,
|
|
172
|
-
|
|
172
|
+
additionalComponentIds,
|
|
173
173
|
showInstantSearchResults,
|
|
174
174
|
theme,
|
|
175
175
|
]);
|
|
@@ -6,36 +6,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SensorCollection = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
|
|
9
|
-
const
|
|
9
|
+
const provider_1 = require("../provider");
|
|
10
10
|
const SensorCollection = () => {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
var _a;
|
|
12
|
+
const context = (0, provider_1.useContext)();
|
|
13
|
+
if (!((_a = context.collection) === null || _a === void 0 ? void 0 : _a.handle)) {
|
|
13
14
|
return null;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
}
|
|
16
|
+
return (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorCollection", customQuery: () => {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
return ({
|
|
19
|
+
query: {
|
|
20
|
+
bool: {
|
|
21
|
+
should: [
|
|
22
|
+
...(((_a = context.collection) === null || _a === void 0 ? void 0 : _a.handle)
|
|
23
|
+
? [
|
|
24
|
+
{
|
|
25
|
+
nested: {
|
|
26
|
+
path: "collections",
|
|
27
|
+
query: {
|
|
28
|
+
term: {
|
|
29
|
+
"collections.handle.keyword": context.collection.handle,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
32
33
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
]
|
|
35
|
+
: []),
|
|
36
|
+
...(((_b = context.curation) === null || _b === void 0 ? void 0 : _b.id) && ((_c = context.curation) === null || _c === void 0 ? void 0 : _c.id) !== "global"
|
|
37
|
+
? [
|
|
38
|
+
{
|
|
39
|
+
nested: {
|
|
40
|
+
path: "curations",
|
|
41
|
+
query: {
|
|
42
|
+
term: {
|
|
43
|
+
"curations.collectionHandle.keyword": context.curation.collectionHandle,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
]
|
|
49
|
+
: []),
|
|
50
|
+
],
|
|
51
|
+
},
|
|
37
52
|
},
|
|
38
|
-
}
|
|
39
|
-
}
|
|
53
|
+
});
|
|
54
|
+
} }));
|
|
40
55
|
};
|
|
41
56
|
exports.SensorCollection = SensorCollection;
|
|
@@ -7,7 +7,9 @@ exports.SensorSearch = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const DataSearch_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/search/DataSearch"));
|
|
9
9
|
const hooks_1 = require("../hooks");
|
|
10
|
+
const provider_1 = require("../provider");
|
|
10
11
|
const SensorSearch = () => {
|
|
12
|
+
const context = (0, provider_1.useContext)();
|
|
11
13
|
const { fields } = (0, hooks_1.useConfig)();
|
|
12
14
|
const { searchQuery } = (0, hooks_1.useSearch)();
|
|
13
15
|
// ignore search fields only set for instant search
|
|
@@ -17,6 +19,7 @@ const SensorSearch = () => {
|
|
|
17
19
|
}
|
|
18
20
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
19
21
|
react_1.default.createElement(DataSearch_1.default, { fuzziness: 1, queryFormat: "and", autosuggest: false, value: searchQuery, componentId: "SensorSearch", style: { display: "none" }, dataField: searchFields.map((field) => field.field), fieldWeights: searchFields.map((field) => field.importance), customQuery: (value, props) => {
|
|
22
|
+
var _a;
|
|
20
23
|
const { dataField, fieldWeights } = props;
|
|
21
24
|
const fieldsCrossFields = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
|
|
22
25
|
const fieldsPhrase = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
|
|
@@ -26,16 +29,20 @@ const SensorSearch = () => {
|
|
|
26
29
|
const query = {
|
|
27
30
|
bool: {
|
|
28
31
|
should: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
...(((_a = context.curation) === null || _a === void 0 ? void 0 : _a.id) && context.curation.id !== "global"
|
|
33
|
+
? [
|
|
34
|
+
{
|
|
35
|
+
nested: {
|
|
36
|
+
path: "curations",
|
|
37
|
+
query: {
|
|
38
|
+
term: {
|
|
39
|
+
"curations.searchTerm.keyword": value === null || value === void 0 ? void 0 : value.toLowerCase(),
|
|
40
|
+
},
|
|
41
|
+
},
|
|
35
42
|
},
|
|
36
43
|
},
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
]
|
|
45
|
+
: []),
|
|
39
46
|
...(fieldsCrossFields.length > 0
|
|
40
47
|
? [
|
|
41
48
|
{
|