@usereactify/search 5.18.0-beta.1 → 5.18.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 +3 -28
- package/dist/package.json +3 -3
- package/dist/src/components/Example/ExampleSuggestions.d.ts +4 -0
- package/dist/src/components/Example/ExampleSuggestions.js +16 -0
- package/dist/src/components/Example/ExampleSuggestions.js.map +1 -0
- package/dist/src/components/Example/index.d.ts +1 -0
- package/dist/src/components/Example/index.js +1 -0
- package/dist/src/components/Example/index.js.map +1 -1
- package/dist/src/components/Suggestions/Suggestions.d.ts +12 -0
- package/dist/src/components/Suggestions/Suggestions.js +44 -0
- package/dist/src/components/Suggestions/Suggestions.js.map +1 -0
- package/dist/src/components/Suggestions/index.d.ts +1 -0
- package/dist/src/components/Suggestions/index.js +14 -0
- package/dist/src/components/Suggestions/index.js.map +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/types/elastic.d.ts +53 -17
- package/dist/src/types/elastic.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,38 +2,13 @@
|
|
|
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
|
-
## [5.18.0
|
|
5
|
+
## [5.18.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.17.2...release-v5.18.0) (2023-03-17)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
### Features
|
|
9
9
|
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
## [5.18.0-beta.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.12.0-beta.0...beta-v5.18.0-beta.0) (2023-03-01)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Features
|
|
16
|
-
|
|
17
|
-
* add filter value sorting for bedding sizes ([3bcf4b0](https://bitbucket.org/usereactify/reactify-search-ui/commit/3bcf4b0d8b1da312c586e3ac99482bdbe4ced28b))
|
|
18
|
-
* add support for settingsFilterLogic ([4c3b00f](https://bitbucket.org/usereactify/reactify-search-ui/commit/4c3b00f18cb216a4c454e0cf89e2520562973a13))
|
|
19
|
-
* allow custom filter sort order ([e7d9b0b](https://bitbucket.org/usereactify/reactify-search-ui/commit/e7d9b0bed3b8df5cf47a12968c915b9c2e492e2e))
|
|
20
|
-
* implement ga-gtag ([ff0bcb2](https://bitbucket.org/usereactify/reactify-search-ui/commit/ff0bcb2d8490f6a428769c21b8f9472207c8792f))
|
|
21
|
-
* remove javascript cache ttl behaviour for config and rely on rs cache option and browser cache-control ([730a9c5](https://bitbucket.org/usereactify/reactify-search-ui/commit/730a9c541e57a7336015c5d93b7b23371cf64bef))
|
|
22
|
-
* upgrade @appbaseio/reactivesearch to 3.43.8 ([67284fc](https://bitbucket.org/usereactify/reactify-search-ui/commit/67284fc9b478668360285305bd7babd00e7be0f4))
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Bug Fixes
|
|
26
|
-
|
|
27
|
-
* check window exists before initializing ga ([19d0f48](https://bitbucket.org/usereactify/reactify-search-ui/commit/19d0f485374f78a9c567cc130e9ec289fe59ae46))
|
|
28
|
-
* clear range filter values when values are cleared within underlying reactivesearch component ([720917f](https://bitbucket.org/usereactify/reactify-search-ui/commit/720917f6e3b2c017cfd05a1d2bacf1692212f37e))
|
|
29
|
-
* exclude selectable sort option from instant search logic ([988427d](https://bitbucket.org/usereactify/reactify-search-ui/commit/988427d72ee6525cf20c4a3f8a900d3bf9db398a))
|
|
30
|
-
* move gtag initializer into provider and include relevant user properties ([72ca81e](https://bitbucket.org/usereactify/reactify-search-ui/commit/72ca81e5556f07f1c7fd4a0c630698ed4e70f6fa))
|
|
31
|
-
* only apply global boosting rules in collection mode ([731009c](https://bitbucket.org/usereactify/reactify-search-ui/commit/731009c9d6df2dee80d30bbef678b7c7a68bdd55))
|
|
32
|
-
* properly encode search query when submitting ([3ecc44f](https://bitbucket.org/usereactify/reactify-search-ui/commit/3ecc44fd72ebe4ea3bc919bf1d823b0a49bc0830))
|
|
33
|
-
* remove duplicate sensors from storybook ([c41aab2](https://bitbucket.org/usereactify/reactify-search-ui/commit/c41aab22be3dcb16ea0fe31ede1a232b28f6ced3))
|
|
34
|
-
* sort by collection position after curation pin and boost sorting rather than before ([593ee9d](https://bitbucket.org/usereactify/reactify-search-ui/commit/593ee9d2b9e46726a99e20e1e7a9782bf0bc4590))
|
|
35
|
-
* trim whitespace around search terms for tracking within analytics ([257d99a](https://bitbucket.org/usereactify/reactify-search-ui/commit/257d99aa916210d120c0a17e670d34efcd1979f6))
|
|
36
|
-
* use shared ga cookie ([b406fe1](https://bitbucket.org/usereactify/reactify-search-ui/commit/b406fe11a120326bb90d0452dc1a23c0c8643b9a))
|
|
10
|
+
* add Suggestions component ([21514bb](https://bitbucket.org/usereactify/reactify-search-ui/commit/21514bb7d643647b1ac2a19b57ec649e5a0684b3))
|
|
11
|
+
* improve elasticsearch types and add related field ([dd88e8a](https://bitbucket.org/usereactify/reactify-search-ui/commit/dd88e8a3ee5e1dce990495aa03b8fe814e35d6c5))
|
|
37
12
|
|
|
38
13
|
### [5.17.2](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.17.1...release-v5.17.2) (2023-01-23)
|
|
39
14
|
|
package/dist/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": "5.18.0
|
|
4
|
+
"version": "5.18.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"types": "dist/src/index.d.ts",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"react-slider": "2.0.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@appbaseio/reactivesearch": "3.
|
|
43
|
+
"@appbaseio/reactivesearch": "3.14.0",
|
|
44
44
|
"react": "17 - 18"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@appbaseio/reactivesearch": "3.
|
|
47
|
+
"@appbaseio/reactivesearch": "3.14.0",
|
|
48
48
|
"@babel/plugin-transform-typescript": "7.18.12",
|
|
49
49
|
"@commitlint/cli": "13.2.0",
|
|
50
50
|
"@commitlint/config-conventional": "13.2.0",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExampleSuggestions = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const ExampleSuggestions = (props) => {
|
|
10
|
+
const { setSearchTerm } = (0, hooks_1.useSearch)();
|
|
11
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
12
|
+
react_1.default.createElement("h3", null, "Suggestions"),
|
|
13
|
+
react_1.default.createElement("ul", null, props.suggestions.map((suggestion) => (react_1.default.createElement("li", { onClick: () => setSearchTerm(suggestion.text) }, suggestion.text))))));
|
|
14
|
+
};
|
|
15
|
+
exports.ExampleSuggestions = ExampleSuggestions;
|
|
16
|
+
//# sourceMappingURL=ExampleSuggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleSuggestions.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleSuggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAwC;AAMjC,MAAM,kBAAkB,GAAsC,CACnE,KAAK,EACL,EAAE;IACF,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEtC,OAAO,CACL;QACE,wDAAoB;QACpB,0CACG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CACrC,sCAAI,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,IAC9C,UAAU,CAAC,IAAI,CACb,CACN,CAAC,CACC,CACJ,CACJ,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,kBAAkB,sBAiB7B","sourcesContent":["import React from \"react\";\n\nimport { SuggestionsProps } from \"../../components\";\nimport { useSearch } from \"../../hooks\";\n\nexport type ExampleSuggestionsProps = React.ComponentProps<\n NonNullable<SuggestionsProps[\"render\"]>\n>;\n\nexport const ExampleSuggestions: React.FC<ExampleSuggestionsProps> = (\n props\n) => {\n const { setSearchTerm } = useSearch();\n\n return (\n <>\n <h3>Suggestions</h3>\n <ul>\n {props.suggestions.map((suggestion) => (\n <li onClick={() => setSearchTerm(suggestion.text)}>\n {suggestion.text}\n </li>\n ))}\n </ul>\n </>\n );\n};\n"]}
|
|
@@ -17,6 +17,7 @@ export * from "./ExampleResultPaginationNextPrev";
|
|
|
17
17
|
export * from "./ExampleSearch";
|
|
18
18
|
export * from "./ExampleSortBy";
|
|
19
19
|
export * from "./ExampleStats";
|
|
20
|
+
export * from "./ExampleSuggestions";
|
|
20
21
|
export * from "./ExampleHookUseFilters";
|
|
21
22
|
export * from "./ExampleHookUseResults";
|
|
22
23
|
export * from "./ExampleHookUseSearch";
|
|
@@ -29,6 +29,7 @@ __exportStar(require("./ExampleResultPaginationNextPrev"), exports);
|
|
|
29
29
|
__exportStar(require("./ExampleSearch"), exports);
|
|
30
30
|
__exportStar(require("./ExampleSortBy"), exports);
|
|
31
31
|
__exportStar(require("./ExampleStats"), exports);
|
|
32
|
+
__exportStar(require("./ExampleSuggestions"), exports);
|
|
32
33
|
__exportStar(require("./ExampleHookUseFilters"), exports);
|
|
33
34
|
__exportStar(require("./ExampleHookUseResults"), exports);
|
|
34
35
|
__exportStar(require("./ExampleHookUseSearch"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Example/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,mDAAiC;AACjC,2DAAyC;AACzC,4EAA0D;AAC1D,+EAA6D;AAC7D,wEAAsD;AACtD,6DAA2C;AAC3C,6DAA2C;AAC3C,oEAAkD;AAClD,oEAAkD;AAClD,0EAAwD;AACxD,oEAAkD;AAClD,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Example/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,mDAAiC;AACjC,2DAAyC;AACzC,4EAA0D;AAC1D,+EAA6D;AAC7D,wEAAsD;AACtD,6DAA2C;AAC3C,6DAA2C;AAC3C,oEAAkD;AAClD,oEAAkD;AAClD,0EAAwD;AACxD,oEAAkD;AAClD,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;AAC/B,uDAAqC;AAErC,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;AACvC,yDAAuC","sourcesContent":["export * from \"./ExampleClearAll\";\nexport * from \"./ExampleCustomComponent\";\nexport * from \"./ExampleFilterList\";\nexport * from \"./ExampleFilterRange\";\nexport * from \"./ExampleFilterSlider\";\nexport * from \"./ExampleFilters\";\nexport * from \"./ExampleFiltersSelected\";\nexport * from \"./ExampleReactiveSearchProviderCollection\";\nexport * from \"./ExampleReactiveSearchProviderInstantSearch\";\nexport * from \"./ExampleReactiveSearchProviderSearch\";\nexport * from \"./ExampleResultCardCallout\";\nexport * from \"./ExampleResultCardProduct\";\nexport * from \"./ExampleResultPaginationNumbered\";\nexport * from \"./ExampleResultPaginationLoadMore\";\nexport * from \"./ExampleResultPaginationInfiniteScroll\";\nexport * from \"./ExampleResultPaginationNextPrev\";\nexport * from \"./ExampleSearch\";\nexport * from \"./ExampleSortBy\";\nexport * from \"./ExampleStats\";\nexport * from \"./ExampleSuggestions\";\n\nexport * from \"./ExampleHookUseFilters\";\nexport * from \"./ExampleHookUseResults\";\nexport * from \"./ExampleHookUseSearch\";\nexport * from \"./ExampleHookUseSortBy\";\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare type SuggestionsProps = {
|
|
3
|
+
/** The field which should be used for autocompletion */
|
|
4
|
+
field: "title";
|
|
5
|
+
/** Render method */
|
|
6
|
+
render?: React.FC<{
|
|
7
|
+
suggestions: Array<{
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
12
|
+
export declare const Suggestions: React.FC<SuggestionsProps>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Suggestions = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const components_1 = require("../../components");
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const Suggestions = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleSuggestions;
|
|
13
|
+
const { searchTerm } = (0, hooks_1.useSearch)();
|
|
14
|
+
return (react_1.default.createElement(components_1.CustomComponent, { componentId: "SensorSuggestions", defaultQuery: () => {
|
|
15
|
+
return {
|
|
16
|
+
suggest: {
|
|
17
|
+
suggestions: {
|
|
18
|
+
text: searchTerm,
|
|
19
|
+
term: {
|
|
20
|
+
field: props.field,
|
|
21
|
+
sort: "score",
|
|
22
|
+
suggest_mode: "always",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}, react: {
|
|
28
|
+
and: components_1.SENSOR_IDS,
|
|
29
|
+
}, render: (renderProps) => {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
const props = {
|
|
32
|
+
suggestions: [],
|
|
33
|
+
};
|
|
34
|
+
if ((_b = (_a = renderProps.rawData) === null || _a === void 0 ? void 0 : _a.suggest) === null || _b === void 0 ? void 0 : _b.suggestions.length) {
|
|
35
|
+
const options = (_c = renderProps.rawData.suggest.suggestions[renderProps.rawData.suggest.suggestions.length - 1]) === null || _c === void 0 ? void 0 : _c.options;
|
|
36
|
+
props.suggestions.push(...options.map((option) => ({
|
|
37
|
+
text: option.text,
|
|
38
|
+
})));
|
|
39
|
+
}
|
|
40
|
+
return react_1.default.createElement(RenderComponent, Object.assign({}, props));
|
|
41
|
+
} }));
|
|
42
|
+
};
|
|
43
|
+
exports.Suggestions = Suggestions;
|
|
44
|
+
//# sourceMappingURL=Suggestions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Suggestions.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iDAI0B;AAC1B,uCAAwC;AAajC,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;;IAC/D,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,+BAAkB,CAAC;IAE3D,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEnC,OAAO,CACL,8BAAC,4BAAe,IACd,WAAW,EAAC,mBAAmB,EAC/B,YAAY,EAAE,GAAG,EAAE;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP,WAAW,EAAE;wBACX,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE;4BACJ,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,IAAI,EAAE,OAAO;4BACb,YAAY,EAAE,QAAQ;yBACvB;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,EACD,KAAK,EAAE;YACL,GAAG,EAAE,uBAAU;SAChB,EACD,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;;YACtB,MAAM,KAAK,GAEP;gBACF,WAAW,EAAE,EAAE;aAChB,CAAC;YAEF,IAAI,MAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,OAAO,0CAAE,WAAW,CAAC,MAAM,EAAE;gBACpD,MAAM,OAAO,GACX,MAAA,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CACrC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CACnD,0CAAE,OAAO,CAAC;gBACb,KAAK,CAAC,WAAW,CAAC,IAAI,CACpB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAsC,EAAE,EAAE,CAAC,CAAC;oBAC1D,IAAI,EAAE,MAAM,CAAC,IAAI;iBAClB,CAAC,CAAC,CACJ,CAAC;aACH;YAED,OAAO,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;QACxC,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,WAAW,eAgDtB","sourcesContent":["import React from \"react\";\n\nimport {\n CustomComponent,\n ExampleSuggestions,\n SENSOR_IDS,\n} from \"../../components\";\nimport { useSearch } from \"../../hooks\";\n\nexport type SuggestionsProps = {\n /** The field which should be used for autocompletion */\n field: \"title\";\n /** Render method */\n render?: React.FC<{\n suggestions: Array<{\n text: string;\n }>;\n }>;\n};\n\nexport const Suggestions: React.FC<SuggestionsProps> = (props) => {\n const RenderComponent = props.render ?? ExampleSuggestions;\n\n const { searchTerm } = useSearch();\n\n return (\n <CustomComponent\n componentId=\"SensorSuggestions\"\n defaultQuery={() => {\n return {\n suggest: {\n suggestions: {\n text: searchTerm,\n term: {\n field: props.field,\n sort: \"score\",\n suggest_mode: \"always\",\n },\n },\n },\n };\n }}\n react={{\n and: SENSOR_IDS,\n }}\n render={(renderProps) => {\n const props: React.ComponentProps<\n NonNullable<SuggestionsProps[\"render\"]>\n > = {\n suggestions: [],\n };\n\n if (renderProps.rawData?.suggest?.suggestions.length) {\n const options =\n renderProps.rawData.suggest.suggestions[\n renderProps.rawData.suggest.suggestions.length - 1\n ]?.options;\n props.suggestions.push(\n ...options.map((option: { text: string; freq: number }) => ({\n text: option.text,\n }))\n );\n }\n\n return <RenderComponent {...props} />;\n }}\n />\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Suggestions";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./Suggestions"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA8B","sourcesContent":["export * from \"./Suggestions\";\n"]}
|
|
@@ -20,5 +20,6 @@ __exportStar(require("./Search"), exports);
|
|
|
20
20
|
__exportStar(require("./Sensor"), exports);
|
|
21
21
|
__exportStar(require("./SortBy"), exports);
|
|
22
22
|
__exportStar(require("./Stats"), exports);
|
|
23
|
+
__exportStar(require("./Suggestions"), exports);
|
|
23
24
|
__exportStar(require("./Utility"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,6CAA2B;AAC3B,2CAAyB;AACzB,2DAAyC;AACzC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B","sourcesContent":["export * from \"./Example\";\nexport * from \"./CustomComponent\";\nexport * from \"./ClearAll\";\nexport * from \"./Filter\";\nexport * from \"./ReactifySearchProvider\";\nexport * from \"./Result\";\nexport * from \"./Search\";\nexport * from \"./Sensor\";\nexport * from \"./SortBy\";\nexport * from \"./Stats\";\nexport * from \"./Utility\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,oDAAkC;AAClC,6CAA2B;AAC3B,2CAAyB;AACzB,2DAAyC;AACzC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,gDAA8B;AAC9B,4CAA0B","sourcesContent":["export * from \"./Example\";\nexport * from \"./CustomComponent\";\nexport * from \"./ClearAll\";\nexport * from \"./Filter\";\nexport * from \"./ReactifySearchProvider\";\nexport * from \"./Result\";\nexport * from \"./Search\";\nexport * from \"./Sensor\";\nexport * from \"./SortBy\";\nexport * from \"./Stats\";\nexport * from \"./Suggestions\";\nexport * from \"./Utility\";\n"]}
|
|
@@ -27,16 +27,16 @@ export interface ElasticProduct {
|
|
|
27
27
|
product_type: string;
|
|
28
28
|
handle: string;
|
|
29
29
|
url: string;
|
|
30
|
-
tags: string
|
|
31
|
-
collection_titles: string
|
|
30
|
+
tags: Array<string>;
|
|
31
|
+
collection_titles: Array<string>;
|
|
32
32
|
/** tag prefixes defined in tagKeys are split to their own attributes */
|
|
33
|
-
[key: `tags_${string}`]: string
|
|
33
|
+
[key: `tags_${string}`]: Array<string> | undefined;
|
|
34
34
|
/** decimal number e.g. 99.95 */
|
|
35
35
|
price_min: number;
|
|
36
36
|
/** decimal number e.g. 99.95 */
|
|
37
37
|
price_max: number;
|
|
38
38
|
/** array of option names e.g. ["Colour", "Size"] */
|
|
39
|
-
options: string
|
|
39
|
+
options: Array<string>;
|
|
40
40
|
/** @todo it would be better to use ProductStatus directly, which has uppercase */
|
|
41
41
|
status: "active" | "archived" | "draft";
|
|
42
42
|
published: boolean;
|
|
@@ -50,22 +50,22 @@ export interface ElasticProduct {
|
|
|
50
50
|
/** originalSrc URL for featured image */
|
|
51
51
|
image: Maybe<string>;
|
|
52
52
|
/** array of images (undefined if images are disabled in sync settings) */
|
|
53
|
-
images?: ElasticImage
|
|
53
|
+
images?: Array<ElasticImage>;
|
|
54
54
|
/** array of variants attached to product (undefined if variants are disabled in sync settings) */
|
|
55
|
-
variants?: ElasticVariant
|
|
55
|
+
variants?: Array<ElasticVariant>;
|
|
56
56
|
/** price ranges from presentment prices (undefined if presentment prices or variants are disabled in sync settings) */
|
|
57
57
|
presentment_price_ranges?: {
|
|
58
|
-
min_variant_price: ElasticPresentmentPrice
|
|
59
|
-
max_variant_price: ElasticPresentmentPrice
|
|
58
|
+
min_variant_price: Array<ElasticPresentmentPrice>;
|
|
59
|
+
max_variant_price: Array<ElasticPresentmentPrice>;
|
|
60
60
|
};
|
|
61
61
|
/** array of variant skus (undefined if variants are disabled in sync settings) */
|
|
62
|
-
variant_skus?: string
|
|
62
|
+
variant_skus?: Array<string>;
|
|
63
63
|
/** combined array of option values from all option types (undefined if variants are disabled in sync settings) */
|
|
64
|
-
variant_options?: string
|
|
64
|
+
variant_options?: Array<string>;
|
|
65
65
|
/** array of collections which this product belongs to (undefined if collections are disabled in sync settings) */
|
|
66
|
-
collections?: ElasticCollection
|
|
66
|
+
collections?: Array<ElasticCollection>;
|
|
67
67
|
/** array of whitelisted metafields (undefined if metafields are disabled in sync settings) */
|
|
68
|
-
metafields?: ElasticMetafield
|
|
68
|
+
metafields?: Array<ElasticMetafield>;
|
|
69
69
|
/** decimal number e.g. 99.95 (undefined if variants are disabled in sync settings) */
|
|
70
70
|
discount_amount?: number;
|
|
71
71
|
/** combined inventory for all variants (undefined if variants are disabled in sync settings) */
|
|
@@ -73,7 +73,43 @@ export interface ElasticProduct {
|
|
|
73
73
|
/** number of days since published, null if unpublished */
|
|
74
74
|
published_days: Maybe<number>;
|
|
75
75
|
/** collection of curations that this product is attached to */
|
|
76
|
-
curations?: ElasticCuration
|
|
76
|
+
curations?: Array<ElasticCuration>;
|
|
77
|
+
/** related products **/
|
|
78
|
+
related?: Array<ElasticProductRelated>;
|
|
79
|
+
}
|
|
80
|
+
export interface ElasticProductRelated {
|
|
81
|
+
createdAt: string;
|
|
82
|
+
description: string;
|
|
83
|
+
featuredImage: {
|
|
84
|
+
originalSrc: "https://cdn.shopify.com/s/files/1/0614/3977/0777/p…71d6-e7fd-4f5f-aa99-c722e2832d01.jpg?v=1660776345";
|
|
85
|
+
};
|
|
86
|
+
handle: string;
|
|
87
|
+
id: string;
|
|
88
|
+
images: Array<ElasticImage>;
|
|
89
|
+
legacyResourceId: string;
|
|
90
|
+
metafields?: Array<ElasticMetafield>;
|
|
91
|
+
options: Array<{
|
|
92
|
+
name: string;
|
|
93
|
+
}>;
|
|
94
|
+
priceRangeV2: {
|
|
95
|
+
maxVariantPrice: {
|
|
96
|
+
amount: string;
|
|
97
|
+
};
|
|
98
|
+
minVariantPrice: {
|
|
99
|
+
amount: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
productType: string;
|
|
103
|
+
publishedAt: string;
|
|
104
|
+
status: "ACTIVE" | "ARCHIVED" | "DRAFT";
|
|
105
|
+
storefrontId: string;
|
|
106
|
+
tags: Array<string>;
|
|
107
|
+
title: string;
|
|
108
|
+
tracksInventory: boolean;
|
|
109
|
+
updatedAt: string;
|
|
110
|
+
variants: Array<ElasticVariant>;
|
|
111
|
+
vendor: string;
|
|
112
|
+
__typename: "Product";
|
|
77
113
|
}
|
|
78
114
|
export interface ElasticVariant {
|
|
79
115
|
/** legacy resource id */
|
|
@@ -83,10 +119,10 @@ export interface ElasticVariant {
|
|
|
83
119
|
sku: Maybe<string>;
|
|
84
120
|
barcode: Maybe<string>;
|
|
85
121
|
/** array of presentment prices (undefined if presentment prices are disabled in sync settings) */
|
|
86
|
-
presentment_prices?: {
|
|
122
|
+
presentment_prices?: Array<{
|
|
87
123
|
price: ElasticPresentmentPrice;
|
|
88
124
|
compare_at_price: Maybe<ElasticPresentmentPrice>;
|
|
89
|
-
}
|
|
125
|
+
}>;
|
|
90
126
|
/** decimal number e.g. 99.95 */
|
|
91
127
|
price: number;
|
|
92
128
|
/** decimal number e.g. 99.95 */
|
|
@@ -103,7 +139,7 @@ export interface ElasticVariant {
|
|
|
103
139
|
inventory_quantity: number;
|
|
104
140
|
available: boolean;
|
|
105
141
|
/** array of images (only available if this variant has been merged from another product and if images are enabled in sync settings) */
|
|
106
|
-
images?: ElasticImage
|
|
142
|
+
images?: Array<ElasticImage>;
|
|
107
143
|
}
|
|
108
144
|
export interface ElasticCollection {
|
|
109
145
|
/** legacy resource id */
|
|
@@ -175,7 +211,7 @@ export declare type ElasticBulkOperationIndex = [
|
|
|
175
211
|
export declare type ElasticBulkOperation = ElasticBulkOperationUpdate | ElasticBulkOperationIndex;
|
|
176
212
|
export declare type ElasticSearchResult<T = ElasticDocument> = {
|
|
177
213
|
hits: {
|
|
178
|
-
hits: ElasticHit<T
|
|
214
|
+
hits: Array<ElasticHit<T>>;
|
|
179
215
|
};
|
|
180
216
|
};
|
|
181
217
|
export declare type ElasticHit<T = ElasticDocument> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elastic.js","sourceRoot":"","sources":["../../../src/types/elastic.ts"],"names":[],"mappings":";;;AAOA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;AACrB,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;
|
|
1
|
+
{"version":3,"file":"elastic.js","sourceRoot":"","sources":["../../../src/types/elastic.ts"],"names":[],"mappings":";;;AAOA,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,0CAAmB,CAAA;IACnB,0CAAmB,CAAA;AACrB,CAAC,EAHW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAG9B;AAkOD,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;AACrB,CAAC,EARW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAQ1B","sourcesContent":["import { Callout } from \"./firestore\";\nimport {\n Maybe,\n ProductVariantInventoryPolicy,\n MetafieldValueType,\n} from \"./graphql\";\n\nexport enum ElasticDocumentType {\n Callout = \"callout\",\n Product = \"product\",\n}\n\nexport type ElasticDocument = ElasticCallout | ElasticProduct;\n\nexport interface ElasticCallout {\n type: ElasticDocumentType.Callout;\n key: string;\n callout: Omit<Callout, \"keywords\">;\n /** elastic callouts are always published */\n published: true;\n /** elastic callouts are always attached to one curation */\n curations: [ElasticCuration];\n}\n\nexport interface ElasticProduct {\n type: ElasticDocumentType.Product;\n /** the log id from which this product was last uploaded */\n lastLogId: string;\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n description: string;\n vendor: string;\n product_type: string;\n handle: string;\n url: string;\n tags: Array<string>;\n collection_titles: Array<string>;\n /** tag prefixes defined in tagKeys are split to their own attributes */\n [key: `tags_${string}`]: Array<string> | undefined;\n /** decimal number e.g. 99.95 */\n price_min: number;\n /** decimal number e.g. 99.95 */\n price_max: number;\n /** array of option names e.g. [\"Colour\", \"Size\"] */\n options: Array<string>;\n /** @todo it would be better to use ProductStatus directly, which has uppercase */\n status: \"active\" | \"archived\" | \"draft\";\n published: boolean;\n /** ISO 8601 datetime */\n published_at: Maybe<string>;\n /** ISO 8601 datetime */\n updated_at: string;\n /** ISO 8601 datetime */\n created_at: string;\n tracks_inventory: boolean;\n /** originalSrc URL for featured image */\n image: Maybe<string>;\n /** array of images (undefined if images are disabled in sync settings) */\n images?: Array<ElasticImage>;\n /** array of variants attached to product (undefined if variants are disabled in sync settings) */\n variants?: Array<ElasticVariant>;\n /** price ranges from presentment prices (undefined if presentment prices or variants are disabled in sync settings) */\n presentment_price_ranges?: {\n min_variant_price: Array<ElasticPresentmentPrice>;\n max_variant_price: Array<ElasticPresentmentPrice>;\n };\n /** array of variant skus (undefined if variants are disabled in sync settings) */\n variant_skus?: Array<string>;\n /** combined array of option values from all option types (undefined if variants are disabled in sync settings) */\n variant_options?: Array<string>;\n /** array of collections which this product belongs to (undefined if collections are disabled in sync settings) */\n collections?: Array<ElasticCollection>;\n /** array of whitelisted metafields (undefined if metafields are disabled in sync settings) */\n metafields?: Array<ElasticMetafield>;\n /** decimal number e.g. 99.95 (undefined if variants are disabled in sync settings) */\n discount_amount?: number;\n /** combined inventory for all variants (undefined if variants are disabled in sync settings) */\n inventory_total?: number;\n /** number of days since published, null if unpublished */\n published_days: Maybe<number>;\n /** collection of curations that this product is attached to */\n curations?: Array<ElasticCuration>;\n /** related products **/\n related?: Array<ElasticProductRelated>;\n}\n\nexport interface ElasticProductRelated {\n createdAt: string;\n description: string;\n featuredImage: {\n originalSrc: \"https://cdn.shopify.com/s/files/1/0614/3977/0777/p…71d6-e7fd-4f5f-aa99-c722e2832d01.jpg?v=1660776345\";\n };\n handle: string;\n id: string;\n images: Array<ElasticImage>;\n legacyResourceId: string;\n metafields?: Array<ElasticMetafield>;\n options: Array<{\n name: string;\n }>;\n priceRangeV2: {\n maxVariantPrice: {\n amount: string;\n };\n minVariantPrice: {\n amount: string;\n };\n };\n productType: string;\n publishedAt: string;\n status: \"ACTIVE\" | \"ARCHIVED\" | \"DRAFT\";\n storefrontId: string;\n tags: Array<string>;\n title: string;\n tracksInventory: boolean;\n updatedAt: string;\n variants: Array<ElasticVariant>;\n vendor: string;\n __typename: \"Product\";\n}\n\nexport interface ElasticVariant {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n title: string;\n sku: Maybe<string>;\n barcode: Maybe<string>;\n /** array of presentment prices (undefined if presentment prices are disabled in sync settings) */\n presentment_prices?: Array<{\n price: ElasticPresentmentPrice;\n compare_at_price: Maybe<ElasticPresentmentPrice>;\n }>;\n /** decimal number e.g. 99.95 */\n price: number;\n /** decimal number e.g. 99.95 */\n compare_at_price: Maybe<number>;\n /** value string for option 1 e.g. Blue */\n option1: Maybe<string>;\n /** value string for option 2 e.g. Medium */\n option2: Maybe<string>;\n /** value string for option 3 */\n option3: Maybe<string>;\n /** sort position within the product */\n position: number;\n inventory_policy: ProductVariantInventoryPolicy;\n inventory_quantity: number;\n available: boolean;\n /** array of images (only available if this variant has been merged from another product and if images are enabled in sync settings) */\n images?: Array<ElasticImage>;\n}\n\nexport interface ElasticCollection {\n /** legacy resource id */\n id: number;\n storefrontId: string;\n handle: string;\n title: string;\n position: number;\n}\n\nexport interface ElasticMetafield {\n key: string;\n type: string;\n value: string;\n namespace: string;\n /**\n * Legacy valueType attribute which is no longer provided by Shopify. We still\n * populate this field to prevent any frontends breaking which rely on it.\n *\n * @see https://shopify.dev/apps/metafields/definitions/types\n */\n value_type: MetafieldValueType;\n}\n\nexport interface ElasticPresentmentPrice {\n /** decimal number e.g. 99.95 */\n amount: number;\n currency_code: string;\n}\n\nexport interface ElasticImage {\n /** originalSrc URL */\n src: string;\n /** alt text */\n alt: Maybe<string>;\n}\n\nexport interface ElasticCuration {\n id: string;\n hidden: boolean;\n position?: number;\n searchTerm?: string;\n collectionHandle?: string;\n}\n\n// non-exhaustive type for bulk request\n// https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docs-bulk.html\nexport type ElasticBulkOperationUpdate = [\n { update: { _index: string; _id: string } },\n {\n script?: {\n lang: \"painless\";\n source: string;\n params?: Record<string, any>;\n };\n upsert?: Partial<ElasticProduct>;\n scripted_upsert?: true;\n doc?: Partial<ElasticProduct>;\n doc_as_upsert?: true;\n }\n];\n\nexport type ElasticBulkOperationIndex = [\n { index: { _index: string; _id: string } },\n ElasticDocument\n];\n\nexport type ElasticBulkOperation =\n | ElasticBulkOperationUpdate\n | ElasticBulkOperationIndex;\n\nexport type ElasticSearchResult<T = ElasticDocument> = {\n hits: {\n hits: Array<ElasticHit<T>>;\n };\n};\n\nexport type ElasticHit<T = ElasticDocument> = {\n _id: string;\n _source: T;\n _score: number | null;\n};\n\nexport enum ElasticDataType {\n Text = \"text\",\n Long = \"long\",\n Date = \"date\",\n Float = \"float\",\n Nested = \"nested\",\n Keyword = \"keyword\",\n Boolean = \"boolean\",\n}\n\nexport interface ElasticProperty {\n analyzer?: string;\n type: ElasticDataType;\n ignore_above?: number;\n fields?: { [key: string]: ElasticField };\n properties?: { [key: string]: ElasticProperty };\n}\n\nexport interface ElasticField {\n type: ElasticDataType;\n ignore_above?: number;\n}\n"]}
|
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": "5.18.0
|
|
4
|
+
"version": "5.18.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
7
7
|
"types": "dist/src/index.d.ts",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"react-slider": "2.0.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@appbaseio/reactivesearch": "3.
|
|
43
|
+
"@appbaseio/reactivesearch": "3.14.0",
|
|
44
44
|
"react": "17 - 18"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@appbaseio/reactivesearch": "3.
|
|
47
|
+
"@appbaseio/reactivesearch": "3.14.0",
|
|
48
48
|
"@babel/plugin-transform-typescript": "7.18.12",
|
|
49
49
|
"@commitlint/cli": "13.2.0",
|
|
50
50
|
"@commitlint/config-conventional": "13.2.0",
|