@usereactify/search 5.0.0-beta.1 → 5.0.0-beta.4
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 +16 -0
- package/dist/package.json +70 -0
- package/dist/src/components/Example/ExampleFilterList.d.ts +4 -0
- package/dist/src/components/Example/ExampleFilterList.js +20 -0
- package/dist/src/components/Example/ExampleFilterList.js.map +1 -0
- package/dist/src/components/Example/ExampleFilterRange.d.ts +4 -0
- package/dist/src/components/Example/ExampleFilterRange.js +22 -0
- package/dist/src/components/Example/ExampleFilterRange.js.map +1 -0
- package/dist/src/components/Example/ExampleFilterSlider.d.ts +4 -0
- package/dist/src/components/Example/ExampleFilterSlider.js +21 -0
- package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -0
- package/dist/src/components/Example/ExampleFilterStack.d.ts +4 -0
- package/dist/src/components/Example/ExampleFilterStack.js +13 -0
- package/dist/src/components/Example/ExampleFilterStack.js.map +1 -0
- package/dist/src/components/Example/ExampleResultCardCallout.d.ts +4 -0
- package/dist/src/components/Example/ExampleResultCardCallout.js +22 -0
- package/dist/src/components/Example/ExampleResultCardCallout.js.map +1 -0
- package/dist/src/components/Example/ExampleResultCardProduct.d.ts +4 -0
- package/dist/src/components/Example/ExampleResultCardProduct.js +19 -0
- package/dist/src/components/Example/ExampleResultCardProduct.js.map +1 -0
- package/dist/src/components/Example/ExampleResultPaginationLoadMore.d.ts +4 -0
- package/dist/src/components/Example/ExampleResultPaginationLoadMore.js +12 -0
- package/dist/src/components/Example/ExampleResultPaginationLoadMore.js.map +1 -0
- package/dist/src/components/Example/ExampleResultPaginationNextPrev.d.ts +4 -0
- package/dist/src/components/Example/ExampleResultPaginationNextPrev.js +14 -0
- package/dist/src/components/Example/ExampleResultPaginationNextPrev.js.map +1 -0
- package/dist/src/components/Example/ExampleResultPaginationNumbered.d.ts +4 -0
- package/dist/src/components/Example/ExampleResultPaginationNumbered.js +27 -0
- package/dist/src/components/Example/ExampleResultPaginationNumbered.js.map +1 -0
- package/dist/src/components/Example/ExampleSortby.d.ts +4 -0
- package/dist/src/components/Example/ExampleSortby.js +13 -0
- package/dist/src/components/Example/ExampleSortby.js.map +1 -0
- package/dist/src/components/Example/index.d.ts +10 -0
- package/dist/src/components/Example/index.js +23 -0
- package/dist/src/components/Example/index.js.map +1 -0
- package/dist/src/components/Filter/Filter.d.ts +20 -0
- package/dist/src/components/Filter/Filter.js +90 -0
- package/dist/src/components/Filter/Filter.js.map +1 -0
- package/dist/src/components/Filter/FilterStack.d.ts +7 -0
- package/dist/src/components/Filter/FilterStack.js +17 -0
- package/dist/src/components/Filter/FilterStack.js.map +1 -0
- package/dist/src/components/Filter/index.d.ts +2 -0
- package/dist/src/components/Filter/index.js +15 -0
- package/dist/src/components/Filter/index.js.map +1 -0
- package/dist/src/components/ReactifySearchBase/ReactifySearchBase.d.ts +42 -0
- package/dist/src/components/ReactifySearchBase/ReactifySearchBase.js +143 -0
- package/dist/src/components/ReactifySearchBase/ReactifySearchBase.js.map +1 -0
- package/dist/src/components/ReactifySearchBase/index.d.ts +1 -0
- package/dist/src/components/ReactifySearchBase/index.js +14 -0
- package/dist/src/components/ReactifySearchBase/index.js.map +1 -0
- package/dist/src/components/Result/ResultCardCallout.d.ts +12 -0
- package/dist/src/components/Result/ResultCardCallout.js +47 -0
- package/dist/src/components/Result/ResultCardCallout.js.map +1 -0
- package/dist/src/components/Result/ResultCardProduct.d.ts +13 -0
- package/dist/src/components/Result/ResultCardProduct.js +64 -0
- package/dist/src/components/Result/ResultCardProduct.js.map +1 -0
- package/dist/src/components/Result/ResultPaginationLoadMore.d.ts +7 -0
- package/dist/src/components/Result/ResultPaginationLoadMore.js +17 -0
- package/dist/src/components/Result/ResultPaginationLoadMore.js.map +1 -0
- package/dist/src/components/Result/ResultPaginationNextPrev.d.ts +7 -0
- package/dist/src/components/Result/ResultPaginationNextPrev.js +17 -0
- package/dist/src/components/Result/ResultPaginationNextPrev.js.map +1 -0
- package/dist/src/components/Result/ResultPaginationNumbered.d.ts +7 -0
- package/dist/src/components/Result/ResultPaginationNumbered.js +20 -0
- package/dist/src/components/Result/ResultPaginationNumbered.js.map +1 -0
- package/dist/src/components/Result/ResultStack.d.ts +40 -0
- package/dist/src/components/Result/ResultStack.js +108 -0
- package/dist/src/components/Result/ResultStack.js.map +1 -0
- package/dist/src/components/Result/ResultStateProvider.d.ts +6 -0
- package/dist/src/components/Result/ResultStateProvider.js +11 -0
- package/dist/src/components/Result/ResultStateProvider.js.map +1 -0
- package/dist/src/components/Result/index.d.ts +7 -0
- package/dist/src/components/Result/index.js +20 -0
- package/dist/src/components/Result/index.js.map +1 -0
- package/dist/src/components/Search/SearchInput.d.ts +8 -0
- package/dist/src/components/Search/SearchInput.js +18 -0
- package/dist/src/components/Search/SearchInput.js.map +1 -0
- package/dist/src/components/Search/index.d.ts +1 -0
- package/dist/src/components/Search/index.js +14 -0
- package/dist/src/components/Search/index.js.map +1 -0
- package/dist/src/components/Sensor/SensorCollection.d.ts +2 -0
- package/dist/src/components/Sensor/SensorCollection.js +45 -0
- package/dist/src/components/Sensor/SensorCollection.js.map +1 -0
- package/dist/src/components/Sensor/SensorInventoryAvailable.d.ts +2 -0
- package/dist/src/components/Sensor/SensorInventoryAvailable.js +53 -0
- package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -0
- package/dist/src/components/Sensor/SensorPublished.d.ts +2 -0
- package/dist/src/components/Sensor/SensorPublished.js +17 -0
- package/dist/src/components/Sensor/SensorPublished.js.map +1 -0
- package/dist/src/components/Sensor/SensorSearch.d.ts +2 -0
- package/dist/src/components/Sensor/SensorSearch.js +83 -0
- package/dist/src/components/Sensor/SensorSearch.js.map +1 -0
- package/dist/src/components/Sensor/SensorSort.d.ts +2 -0
- package/dist/src/components/Sensor/SensorSort.js +205 -0
- package/dist/src/components/Sensor/SensorSort.js.map +1 -0
- package/dist/src/components/Sensor/SensorSortScore.d.ts +2 -0
- package/dist/src/components/Sensor/SensorSortScore.js +13 -0
- package/dist/src/components/Sensor/SensorSortScore.js.map +1 -0
- package/dist/src/components/Sensor/SensorStack.d.ts +3 -0
- package/dist/src/components/Sensor/SensorStack.js +32 -0
- package/dist/src/components/Sensor/SensorStack.js.map +1 -0
- package/dist/src/components/Sensor/index.d.ts +8 -0
- package/dist/src/components/Sensor/index.js +30 -0
- package/dist/src/components/Sensor/index.js.map +1 -0
- package/dist/src/components/Sortby/Sortby.d.ts +7 -0
- package/dist/src/components/Sortby/Sortby.js +17 -0
- package/dist/src/components/Sortby/Sortby.js.map +1 -0
- package/dist/src/components/Sortby/index.d.ts +1 -0
- package/dist/src/components/Sortby/index.js +14 -0
- package/dist/src/components/Sortby/index.js.map +1 -0
- package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.d.ts +2 -0
- package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js +15 -0
- package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js.map +1 -0
- package/dist/src/components/Utility/index.d.ts +1 -0
- package/dist/src/components/Utility/index.js +14 -0
- package/dist/src/components/Utility/index.js.map +1 -0
- package/dist/src/components/index.d.ts +8 -0
- package/dist/src/components/index.js +21 -0
- package/dist/src/components/index.js.map +1 -0
- package/dist/src/hooks/index.d.ts +14 -0
- package/dist/src/hooks/index.js +27 -0
- package/dist/src/hooks/index.js.map +1 -0
- package/dist/src/hooks/reactivesearch/index.d.ts +8 -0
- package/dist/src/hooks/reactivesearch/index.js +21 -0
- package/dist/src/hooks/reactivesearch/index.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.d.ts +7 -0
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +44 -0
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +26 -0
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +71 -0
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.d.ts +73 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +22 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.d.ts +70 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +22 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.d.ts +67 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +106 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.d.ts +68 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +22 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.d.ts +3 -0
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +26 -0
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js.map +1 -0
- package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.d.ts +17 -0
- package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.js +32 -0
- package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.js.map +1 -0
- package/dist/src/hooks/useAnalytics.d.ts +95 -0
- package/dist/src/hooks/useAnalytics.js +111 -0
- package/dist/src/hooks/useAnalytics.js.map +1 -0
- package/dist/src/hooks/useConfig.d.ts +4 -0
- package/dist/src/hooks/useConfig.js +82 -0
- package/dist/src/hooks/useConfig.js.map +1 -0
- package/dist/src/hooks/useCuration.d.ts +2 -0
- package/dist/src/hooks/useCuration.js +53 -0
- package/dist/src/hooks/useCuration.js.map +1 -0
- package/dist/src/hooks/useFilterCollapsedState.d.ts +8 -0
- package/dist/src/hooks/useFilterCollapsedState.js +28 -0
- package/dist/src/hooks/useFilterCollapsedState.js.map +1 -0
- package/dist/src/hooks/useFilterListProps.d.ts +12 -0
- package/dist/src/hooks/useFilterListProps.js +36 -0
- package/dist/src/hooks/useFilterListProps.js.map +1 -0
- package/dist/src/hooks/useFilterStack.d.ts +2 -0
- package/dist/src/hooks/useFilterStack.js +47 -0
- package/dist/src/hooks/useFilterStack.js.map +1 -0
- package/dist/src/hooks/useFilters.d.ts +4 -0
- package/dist/src/hooks/useFilters.js +23 -0
- package/dist/src/hooks/useFilters.js.map +1 -0
- package/dist/src/hooks/usePagination.d.ts +14 -0
- package/dist/src/hooks/usePagination.js +98 -0
- package/dist/src/hooks/usePagination.js.map +1 -0
- package/dist/src/hooks/usePaginationLoadMore.d.ts +15 -0
- package/dist/src/hooks/usePaginationLoadMore.js +38 -0
- package/dist/src/hooks/usePaginationLoadMore.js.map +1 -0
- package/dist/src/hooks/useProductPrice.d.ts +10 -0
- package/dist/src/hooks/useProductPrice.js +64 -0
- package/dist/src/hooks/useProductPrice.js.map +1 -0
- package/dist/src/hooks/useReactifySearchContext.d.ts +78 -0
- package/dist/src/hooks/useReactifySearchContext.js +11 -0
- package/dist/src/hooks/useReactifySearchContext.js.map +1 -0
- package/dist/src/hooks/useSearch.d.ts +8 -0
- package/dist/src/hooks/useSearch.js +37 -0
- package/dist/src/hooks/useSearch.js.map +1 -0
- package/dist/src/hooks/useSortby.d.ts +6 -0
- package/dist/src/hooks/useSortby.js +42 -0
- package/dist/src/hooks/useSortby.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +19 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/types/config.d.ts +26 -0
- package/dist/src/types/config.js +3 -0
- package/dist/src/types/config.js.map +1 -0
- package/dist/src/types/elastic.d.ts +209 -0
- package/dist/src/types/elastic.js +19 -0
- package/dist/src/types/elastic.js.map +1 -0
- package/dist/src/types/firestore.d.ts +280 -0
- package/dist/src/types/firestore.js +19 -0
- package/dist/src/types/firestore.js.map +1 -0
- package/dist/src/types/graphql.d.ts +26545 -0
- package/dist/src/types/graphql.js +4688 -0
- package/dist/src/types/graphql.js.map +1 -0
- package/dist/src/types/index.d.ts +3 -0
- package/dist/src/types/index.js +16 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/reactivesearch.d.ts +73 -0
- package/dist/src/types/reactivesearch.js +3 -0
- package/dist/src/types/reactivesearch.js.map +1 -0
- package/dist/src/types/shopify.d.ts +21 -0
- package/dist/src/types/shopify.js +28 -0
- package/dist/src/types/shopify.js.map +1 -0
- package/package.json +8 -3
|
@@ -0,0 +1,11 @@
|
|
|
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.ResultStateProvider = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const StateProvider_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/StateProvider"));
|
|
9
|
+
const ResultStateProvider = ({ render }) => (react_1.default.createElement(StateProvider_1.default, { componentIds: ["page"], includeKeys: ["isLoading", "hits", "resultStats", "error"], render: (state) => render(state.searchState.page) }));
|
|
10
|
+
exports.ResultStateProvider = ResultStateProvider;
|
|
11
|
+
//# sourceMappingURL=ResultStateProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResultStateProvider.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultStateProvider.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,iHAAyF;AAQlF,MAAM,mBAAmB,GAAuC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACrF,8BAAC,uBAAa,IACZ,YAAY,EAAE,CAAC,MAAM,CAAC,EACtB,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,EAC1D,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAChB,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAqC,CAAC,GAEjE,CACH,CAAC;AARW,QAAA,mBAAmB,uBAQ9B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./ResultStack";
|
|
2
|
+
export * from "./ResultCardCallout";
|
|
3
|
+
export * from "./ResultCardProduct";
|
|
4
|
+
export * from "./ResultStateProvider";
|
|
5
|
+
export * from "./ResultPaginationNumbered";
|
|
6
|
+
export * from "./ResultPaginationLoadMore";
|
|
7
|
+
export * from "./ResultPaginationNextPrev";
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./ResultStack"), exports);
|
|
14
|
+
__exportStar(require("./ResultCardCallout"), exports);
|
|
15
|
+
__exportStar(require("./ResultCardProduct"), exports);
|
|
16
|
+
__exportStar(require("./ResultStateProvider"), exports);
|
|
17
|
+
__exportStar(require("./ResultPaginationNumbered"), exports);
|
|
18
|
+
__exportStar(require("./ResultPaginationLoadMore"), exports);
|
|
19
|
+
__exportStar(require("./ResultPaginationNextPrev"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Result/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA8B;AAC9B,sDAAmC;AACnC,sDAAoC;AACpC,wDAAsC;AACtC,6DAA2C;AAC3C,6DAA2C;AAC3C,6DAA2C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DataSearch from "@appbaseio/reactivesearch/lib/components/search/DataSearch";
|
|
3
|
+
export declare type SearchInputProps = Omit<React.ComponentProps<typeof DataSearch>, "componentId"> & {
|
|
4
|
+
debounce?: number;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
inputClassName?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const SearchInput: React.FC<SearchInputProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
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.SearchInput = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const DataSearch_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/search/DataSearch"));
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const SearchInput = (props) => {
|
|
11
|
+
const { debounce, placeholder, inputClassName } = props;
|
|
12
|
+
const reactiveDataSearchProps = (0, hooks_1.useReactiveDataSearchProps)(Object.assign({ debounce,
|
|
13
|
+
placeholder,
|
|
14
|
+
inputClassName }, props));
|
|
15
|
+
return (react_1.default.createElement(DataSearch_1.default, Object.assign({}, reactiveDataSearchProps)));
|
|
16
|
+
};
|
|
17
|
+
exports.SearchInput = SearchInput;
|
|
18
|
+
//# sourceMappingURL=SearchInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../../src/components/Search/SearchInput.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4GAAoF;AAEpF,uCAAyD;AAQlD,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;IAC/D,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAExD,MAAM,uBAAuB,GAAG,IAAA,kCAA0B,kBACxD,QAAQ;QACR,WAAW;QACX,cAAc,IACX,KAAK,EACR,CAAC;IAEH,OAAO,CACL,8BAAC,oBAAU,oBACL,uBAAuB,EAC3B,CACH,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,WAAW,eAetB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SearchInput";
|
|
@@ -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("./SearchInput"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Search/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA8B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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.SensorCollection = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const SensorCollection = () => {
|
|
11
|
+
const { options } = (0, hooks_1.useReactifySearchContext)();
|
|
12
|
+
if (options.mode !== "collection") {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorCollection", customQuery: () => ({
|
|
16
|
+
query: {
|
|
17
|
+
bool: {
|
|
18
|
+
should: [
|
|
19
|
+
{
|
|
20
|
+
nested: {
|
|
21
|
+
path: "collections",
|
|
22
|
+
query: {
|
|
23
|
+
term: {
|
|
24
|
+
"collections.handle.keyword": options.collection.handle,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
nested: {
|
|
31
|
+
path: "curations",
|
|
32
|
+
query: {
|
|
33
|
+
term: {
|
|
34
|
+
"curations.collectionHandle.keyword": options.collection.handle,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
}) }));
|
|
43
|
+
};
|
|
44
|
+
exports.SensorCollection = SensorCollection;
|
|
45
|
+
//# sourceMappingURL=SensorCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorCollection.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorCollection.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAEjG,uCAAuD;AAEhD,MAAM,gBAAgB,GAAa,GAAG,EAAE;IAC7C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE;QACjC,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,8BAAC,2BAAiB,IAChB,WAAW,EAAC,kBAAkB,EAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;YAClB,KAAK,EAAE;gBACL,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN;4BACE,MAAM,EAAE;gCACN,IAAI,EAAE,aAAa;gCACnB,KAAK,EAAE;oCACL,IAAI,EAAE;wCACJ,4BAA4B,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;qCACxD;iCACF;6BACF;yBACF;wBACD;4BACE,MAAM,EAAE;gCACN,IAAI,EAAE,WAAW;gCACjB,KAAK,EAAE;oCACL,IAAI,EAAE;wCACJ,oCAAoC,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;qCAChE;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF,CAAC,GACF,CACH,CAAC;AACJ,CAAC,CAAC;AAxCW,QAAA,gBAAgB,oBAwC3B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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.SensorInventoryAvailable = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const SensorInventoryAvailable = () => {
|
|
11
|
+
const filterStack = (0, hooks_1.useFilterStack)();
|
|
12
|
+
if (!filterStack || "show_all" === filterStack.inventoryVisibility)
|
|
13
|
+
return null;
|
|
14
|
+
return (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorInventoryAvailable", customQuery: () => ({
|
|
15
|
+
query: {
|
|
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",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
}) }));
|
|
51
|
+
};
|
|
52
|
+
exports.SensorInventoryAvailable = SensorInventoryAvailable;
|
|
53
|
+
//# sourceMappingURL=SensorInventoryAvailable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorInventoryAvailable.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorInventoryAvailable.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAEjG,uCAA6C;AAEtC,MAAM,wBAAwB,GAAa,GAAG,EAAE;IACrD,MAAM,WAAW,GAAG,IAAA,sBAAc,GAAE,CAAC;IAErC,IAAI,CAAC,WAAW,IAAI,UAAU,KAAK,WAAW,CAAC,mBAAmB;QAChE,OAAO,IAAI,CAAC;IAEd,OAAO,CACL,8BAAC,2BAAiB,IAChB,WAAW,EAAC,0BAA0B,EACtC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;YAClB,KAAK,EAAE;gBACL,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN;4BACE,IAAI,EAAE;gCACJ,IAAI,EAAE;oCACJ;wCACE,IAAI,EAAE;4CACJ,IAAI,EAAE;gDACJ,KAAK,EAAE,SAAS;6CACjB;yCACF;qCACF;oCACD;wCACE,MAAM,EAAE;4CACN,IAAI,EAAE,UAAU;4CAChB,KAAK,EAAE;gDACL,KAAK,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE;6CACtC;yCACF;qCACF;iCACF;6BACF;yBACF;wBACD;4BACE,IAAI,EAAE;gCACJ,IAAI,EAAE;oCACJ,KAAK,EAAE,SAAS;iCACjB;6BACF;yBACF;qBACF;oBACD,oBAAoB,EAAE,GAAG;iBAC1B;aACF;SACF,CAAC,GACF,CACH,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,wBAAwB,4BAgDnC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.SensorPublished = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
|
|
9
|
+
const SensorPublished = () => (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorPublished", customQuery: () => ({
|
|
10
|
+
query: {
|
|
11
|
+
match: {
|
|
12
|
+
published: true,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
}) }));
|
|
16
|
+
exports.SensorPublished = SensorPublished;
|
|
17
|
+
//# sourceMappingURL=SensorPublished.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorPublished.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorPublished.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAE1F,MAAM,eAAe,GAAa,GAAG,EAAE,CAAC,CAC7C,8BAAC,2BAAiB,IAChB,WAAW,EAAC,iBAAiB,EAC7B,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;QAClB,KAAK,EAAE;YACL,KAAK,EAAE;gBACL,SAAS,EAAE,IAAI;aAChB;SACF;KACF,CAAC,GACF,CACH,CAAC;AAXW,QAAA,eAAe,mBAW1B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
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.SensorSearch = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const DataSearch_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/search/DataSearch"));
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const SensorSearch = () => {
|
|
11
|
+
const { config } = (0, hooks_1.useReactifySearchContext)();
|
|
12
|
+
const { searchQuery } = (0, hooks_1.useSearch)();
|
|
13
|
+
// ignore search fields only set for instant search
|
|
14
|
+
const searchFields = react_1.default.useMemo(() => config.fields.filter((field) => ["always_search", "search_page"].includes(field.searchType)), [config.fields]);
|
|
15
|
+
if (!searchQuery || !searchFields.length) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
19
|
+
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) => {
|
|
20
|
+
const { dataField, fieldWeights } = props;
|
|
21
|
+
const fieldsCrossFields = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
|
|
22
|
+
const fieldsPhrase = dataField.map((field, index) => `${field}^${fieldWeights[index]}`);
|
|
23
|
+
const fieldsPhrasePrefix = dataField
|
|
24
|
+
.filter((field) => !field.includes("."))
|
|
25
|
+
.map((field, index) => `${field}^${fieldWeights[index]}`);
|
|
26
|
+
const query = {
|
|
27
|
+
bool: {
|
|
28
|
+
should: [
|
|
29
|
+
{
|
|
30
|
+
nested: {
|
|
31
|
+
path: "curations",
|
|
32
|
+
query: {
|
|
33
|
+
term: {
|
|
34
|
+
"curations.searchTerm.keyword": value === null || value === void 0 ? void 0 : value.toLowerCase(),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
...(fieldsCrossFields.length > 0
|
|
40
|
+
? [
|
|
41
|
+
{
|
|
42
|
+
multi_match: {
|
|
43
|
+
query: value,
|
|
44
|
+
fields: fieldsCrossFields,
|
|
45
|
+
type: "cross_fields",
|
|
46
|
+
operator: "and",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
: []),
|
|
51
|
+
...(fieldsPhrase.length > 0
|
|
52
|
+
? [
|
|
53
|
+
{
|
|
54
|
+
multi_match: {
|
|
55
|
+
query: value,
|
|
56
|
+
fields: fieldsPhrase,
|
|
57
|
+
type: "phrase",
|
|
58
|
+
operator: "and",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
]
|
|
62
|
+
: []),
|
|
63
|
+
...(fieldsPhrasePrefix.length > 0
|
|
64
|
+
? [
|
|
65
|
+
{
|
|
66
|
+
multi_match: {
|
|
67
|
+
query: value,
|
|
68
|
+
fields: fieldsPhrasePrefix,
|
|
69
|
+
type: "phrase_prefix",
|
|
70
|
+
operator: "and",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
]
|
|
74
|
+
: []),
|
|
75
|
+
],
|
|
76
|
+
minimum_should_match: "1",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
return { query };
|
|
80
|
+
} })));
|
|
81
|
+
};
|
|
82
|
+
exports.SensorSearch = SensorSearch;
|
|
83
|
+
//# sourceMappingURL=SensorSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorSearch.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorSearch.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,4GAAoF;AAEpF,uCAAkE;AAE3D,MAAM,YAAY,GAAa,GAAG,EAAE;IACzC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC9C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEpC,mDAAmD;IACnD,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAChC,GAAG,EAAE,CACH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7B,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAC5D,EACH,CAAC,MAAM,CAAC,MAAM,CAAC,CAChB,CAAC;IAEF,IAAI,CAAC,WAAW,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACxC,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL;QACE,8BAAC,oBAAU,IACT,SAAS,EAAE,CAAC,EACZ,WAAW,EAAC,KAAK,EACjB,WAAW,EAAE,KAAK,EAClB,KAAK,EAAE,WAAW,EAClB,WAAW,EAAC,cAAc,EAC1B,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EACnD,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC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,GAAG,CAAC;gCACzB,CAAC,CAAC;oCACE;wCACE,WAAW,EAAE;4CACX,KAAK,EAAE,KAAK;4CACZ,MAAM,EAAE,YAAY;4CACpB,IAAI,EAAE,QAAQ;4CACd,QAAQ,EAAE,KAAK;yCAChB;qCACF;iCACF;gCACH,CAAC,CAAC,EAAE,CAAC;4BACP,GAAG,CAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC;gCAC/B,CAAC,CAAC;oCACE;wCACE,WAAW,EAAE;4CACX,KAAK,EAAE,KAAK;4CACZ,MAAM,EAAE,kBAAkB;4CAC1B,IAAI,EAAE,eAAe;4CACrB,QAAQ,EAAE,KAAK;yCAChB;qCACF;iCACF;gCACH,CAAC,CAAC,EAAE,CAAC;yBACR;wBACD,oBAAoB,EAAE,GAAG;qBAC1B;iBACF,CAAC;gBACF,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,CAAC,GACD,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAtGW,QAAA,YAAY,gBAsGvB"}
|
|
@@ -0,0 +1,205 @@
|
|
|
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.SensorSort = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const debug = require("debug")("reactify-search:SensorSort");
|
|
11
|
+
const SensorSort = () => {
|
|
12
|
+
const { options, config } = (0, hooks_1.useReactifySearchContext)();
|
|
13
|
+
const curation = (0, hooks_1.useCuration)();
|
|
14
|
+
const globalCuration = (curation === null || curation === void 0 ? void 0 : curation.id) === "global";
|
|
15
|
+
const { sortOption } = (0, hooks_1.useSortby)();
|
|
16
|
+
const searchQuery = react_1.default.useMemo(() => {
|
|
17
|
+
if (typeof window === "undefined")
|
|
18
|
+
return "";
|
|
19
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
20
|
+
return urlParams.get("q") || "";
|
|
21
|
+
}, []);
|
|
22
|
+
const { sort, query } = react_1.default.useMemo(() => {
|
|
23
|
+
return {
|
|
24
|
+
sort: buildSort({
|
|
25
|
+
config,
|
|
26
|
+
sortOption,
|
|
27
|
+
collection: options.mode === "collection" ? options.collection : undefined,
|
|
28
|
+
curation,
|
|
29
|
+
globalCuration,
|
|
30
|
+
}),
|
|
31
|
+
query: buildQuery({
|
|
32
|
+
sortOption,
|
|
33
|
+
curation,
|
|
34
|
+
globalCuration,
|
|
35
|
+
}),
|
|
36
|
+
};
|
|
37
|
+
}, [config, sortOption, curation]);
|
|
38
|
+
react_1.default.useEffect(() => {
|
|
39
|
+
debug("searchQuery", searchQuery);
|
|
40
|
+
debug("sort", sort);
|
|
41
|
+
debug("query", query);
|
|
42
|
+
}, [searchQuery, sort]);
|
|
43
|
+
return (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorSort", customQuery: () => ({
|
|
44
|
+
sort,
|
|
45
|
+
query,
|
|
46
|
+
}) }));
|
|
47
|
+
};
|
|
48
|
+
exports.SensorSort = SensorSort;
|
|
49
|
+
const buildSort = (args) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const { config, curation, sortOption, collection, globalCuration } = args;
|
|
52
|
+
debug("buildSortQuery.start", {
|
|
53
|
+
config,
|
|
54
|
+
curation,
|
|
55
|
+
sortOption,
|
|
56
|
+
});
|
|
57
|
+
// return default sort option if unset
|
|
58
|
+
if (!sortOption) {
|
|
59
|
+
return collection
|
|
60
|
+
? mapCollectionPositionSortClause(collection)
|
|
61
|
+
: ["_score"];
|
|
62
|
+
}
|
|
63
|
+
// curation positions are only applied for the default `collections.position` or `_score` sort
|
|
64
|
+
// if the sort is something else, apply a normal sort which applies what the user has requested
|
|
65
|
+
if (!["_score", "collections.position"].includes(sortOption.field)) {
|
|
66
|
+
return [{ [sortOption.field]: sortOption.direction }];
|
|
67
|
+
}
|
|
68
|
+
// no matching curation, return default sort clause
|
|
69
|
+
if (!curation) {
|
|
70
|
+
return collection
|
|
71
|
+
? mapCollectionPositionSortClause(collection)
|
|
72
|
+
: ["_score"];
|
|
73
|
+
}
|
|
74
|
+
const sorts = [];
|
|
75
|
+
// show pins first
|
|
76
|
+
if (globalCuration && collection) {
|
|
77
|
+
sorts.push(...mapCollectionPositionSortClause(collection));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
sorts.push({
|
|
81
|
+
"curations.position": {
|
|
82
|
+
unmapped_type: "long",
|
|
83
|
+
order: "asc",
|
|
84
|
+
nested: {
|
|
85
|
+
path: "curations",
|
|
86
|
+
filter: {
|
|
87
|
+
term: {
|
|
88
|
+
[`curations.${"collection" === curation.type
|
|
89
|
+
? "collectionHandle"
|
|
90
|
+
: "searchTerm"}.keyword`]: "collection" === curation.type
|
|
91
|
+
? curation.collectionHandle
|
|
92
|
+
: (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (0 < curation.boosting.groupings.length) {
|
|
100
|
+
const groupings = curation.boosting.groupings.sort((a, b) => a.position > b.position ? 1 : -1);
|
|
101
|
+
for (const grouping of groupings) {
|
|
102
|
+
try {
|
|
103
|
+
const query = JSON.parse(grouping.query);
|
|
104
|
+
if (query)
|
|
105
|
+
sorts.push(query);
|
|
106
|
+
}
|
|
107
|
+
catch (_b) {
|
|
108
|
+
console.error(`query could not be parsed for boost grouping`, grouping);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (0 < curation.boosting.sortings.length) {
|
|
113
|
+
const sortings = curation.boosting.sortings.sort((a, b) => a.position > b.position ? 1 : -1);
|
|
114
|
+
for (const sorting of sortings) {
|
|
115
|
+
try {
|
|
116
|
+
const query = JSON.parse(sorting.query);
|
|
117
|
+
if (query)
|
|
118
|
+
sorts.push(query);
|
|
119
|
+
}
|
|
120
|
+
catch (_c) {
|
|
121
|
+
console.error(`query could not be parsed for boost sorting`, sorting);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// finally, for collections, if no other sorting is defined, sort by index order to provide
|
|
126
|
+
// a consistent order
|
|
127
|
+
if ("collection" === curation.type && sorts.length === 0) {
|
|
128
|
+
sorts.push("_doc");
|
|
129
|
+
}
|
|
130
|
+
// finally, for search, sort by score
|
|
131
|
+
if ("search" === curation.type) {
|
|
132
|
+
sorts.push("_score");
|
|
133
|
+
}
|
|
134
|
+
return sorts;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Return a sort clause which sorts by position within the given collection.
|
|
138
|
+
*/
|
|
139
|
+
function mapCollectionPositionSortClause(collection) {
|
|
140
|
+
return [
|
|
141
|
+
{
|
|
142
|
+
"collections.position": {
|
|
143
|
+
order: "asc",
|
|
144
|
+
nested: {
|
|
145
|
+
path: "collections",
|
|
146
|
+
filter: {
|
|
147
|
+
term: {
|
|
148
|
+
"collections.handle.keyword": collection.handle,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
const buildQuery = (args) => {
|
|
157
|
+
var _a;
|
|
158
|
+
const { curation, sortOption, globalCuration } = args;
|
|
159
|
+
if (!curation || globalCuration) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
bool: {
|
|
164
|
+
must_not: [
|
|
165
|
+
{
|
|
166
|
+
nested: {
|
|
167
|
+
path: "curations",
|
|
168
|
+
query: {
|
|
169
|
+
bool: {
|
|
170
|
+
must: [
|
|
171
|
+
{
|
|
172
|
+
term: {
|
|
173
|
+
[`curations.${"collection" === curation.type
|
|
174
|
+
? "collectionHandle"
|
|
175
|
+
: "searchTerm"}.keyword`]: "collection" === curation.type
|
|
176
|
+
? curation.collectionHandle
|
|
177
|
+
: (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
term: {
|
|
182
|
+
"curations.hidden": true,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
// hide callout when not sorting by _score or collections.position
|
|
191
|
+
...(sortOption &&
|
|
192
|
+
!["_score", "collections.position"].includes(sortOption.field)
|
|
193
|
+
? [
|
|
194
|
+
{
|
|
195
|
+
term: {
|
|
196
|
+
type: "callout",
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
]
|
|
200
|
+
: []),
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
//# sourceMappingURL=SensorSort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorSort.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorSort.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAGjG,uCAA+E;AAE/E,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,CAAC;AAEtD,MAAM,UAAU,GAAa,GAAG,EAAE;IACvC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAA,mBAAW,GAAE,CAAC;IAC/B,MAAM,cAAc,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,EAAE,MAAK,QAAQ,CAAC;IAEjD,MAAM,EAAE,UAAU,EAAE,GAAG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C,CAAC,kBAAkB;gDACpB,CAAC,CAAC,YACN,UAAU,CAAC,EACT,YAAY,KAAK,QAAQ,CAAC,IAAI;gDAC5B,CAAC,CAAC,QAAQ,CAAC,gBAAgB;gDAC3B,CAAC,CAAC,MAAA,QAAQ,CAAC,UAAU,0CAAE,WAAW,EAAE;yCACzC;qCACF;oCACD;wCACE,IAAI,EAAE;4CACJ,kBAAkB,EAAE,IAAI;yCACzB;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;gBACD,kEAAkE;gBAClE,GAAG,CAAC,UAAU;oBACd,CAAC,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC;oBAC5D,CAAC,CAAC;wBACE;4BACE,IAAI,EAAE;gCACJ,IAAI,EAAE,SAAS;6BAChB;yBACF;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;aACR;SACF;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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.SensorSortScore = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ReactiveComponent_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent"));
|
|
9
|
+
const SensorSortScore = () => (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorSortScore", customQuery: () => ({
|
|
10
|
+
sort: { _score: "desc" },
|
|
11
|
+
}) }));
|
|
12
|
+
exports.SensorSortScore = SensorSortScore;
|
|
13
|
+
//# sourceMappingURL=SensorSortScore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorSortScore.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorSortScore.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAE1F,MAAM,eAAe,GAAa,GAAG,EAAE,CAAC,CAC7C,8BAAC,2BAAiB,IAChB,WAAW,EAAC,iBAAiB,EAC7B,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;QAClB,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;KACzB,CAAC,GACF,CACH,CAAC;AAPW,QAAA,eAAe,mBAO1B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.SensorStack = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const SensorSort_1 = require("./SensorSort");
|
|
10
|
+
const SensorSearch_1 = require("./SensorSearch");
|
|
11
|
+
const SensorSortScore_1 = require("./SensorSortScore");
|
|
12
|
+
const SensorPublished_1 = require("./SensorPublished");
|
|
13
|
+
const SensorCollection_1 = require("./SensorCollection");
|
|
14
|
+
const SensorInventoryAvailable_1 = require("./SensorInventoryAvailable");
|
|
15
|
+
const SensorStack = () => {
|
|
16
|
+
const { options } = (0, hooks_1.useReactifySearchContext)();
|
|
17
|
+
// instant search mode
|
|
18
|
+
if (options.mode === "instant-search") {
|
|
19
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
20
|
+
react_1.default.createElement(SensorPublished_1.SensorPublished, null),
|
|
21
|
+
react_1.default.createElement(SensorSortScore_1.SensorSortScore, null)));
|
|
22
|
+
}
|
|
23
|
+
// result grid mode
|
|
24
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
25
|
+
react_1.default.createElement(SensorSort_1.SensorSort, null),
|
|
26
|
+
react_1.default.createElement(SensorSearch_1.SensorSearch, null),
|
|
27
|
+
react_1.default.createElement(SensorPublished_1.SensorPublished, null),
|
|
28
|
+
react_1.default.createElement(SensorCollection_1.SensorCollection, null),
|
|
29
|
+
react_1.default.createElement(SensorInventoryAvailable_1.SensorInventoryAvailable, null)));
|
|
30
|
+
};
|
|
31
|
+
exports.SensorStack = SensorStack;
|
|
32
|
+
//# sourceMappingURL=SensorStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorStack.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorStack.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAuD;AAEvD,6CAA0C;AAC1C,iDAA8C;AAC9C,uDAAoD;AACpD,uDAAoD;AACpD,yDAAsD;AACtD,yEAAsE;AAM/D,MAAM,WAAW,GAA+B,GAAG,EAAE;IAC1D,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,sBAAsB;IACtB,IAAI,OAAO,CAAC,IAAI,KAAK,gBAAgB,EAAE;QACrC,OAAO,CACL;YACE,8BAAC,iCAAe,OAAG;YACnB,8BAAC,iCAAe,OAAG,CAClB,CACJ,CAAC;KACH;IAED,mBAAmB;IACnB,OAAO,CACL;QACE,8BAAC,uBAAU,OAAG;QACd,8BAAC,2BAAY,OAAG;QAChB,8BAAC,iCAAe,OAAG;QACnB,8BAAC,mCAAgB,OAAG;QACpB,8BAAC,mDAAwB,OAAG,CAC3B,CACJ,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,WAAW,eAuBtB"}
|