@usereactify/search 5.0.0-beta.1 → 5.0.0-beta.12
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 +72 -0
- package/dist/package.json +70 -0
- package/dist/src/components/Example/ExampleFilterList.d.ts +4 -0
- package/dist/src/components/Example/ExampleFilterList.js +21 -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 +14 -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 +78 -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 +131 -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 +45 -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 +50 -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 +14 -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 +187 -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 +15 -0
- package/dist/src/hooks/index.js +28 -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 +45 -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 +23 -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 +23 -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 +107 -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 +23 -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/useReactiveReactiveListProps.d.ts +5 -0
- package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.js +33 -0
- package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.js.map +1 -0
- package/dist/src/hooks/useAnalytics.d.ts +95 -0
- package/dist/src/hooks/useAnalytics.js +113 -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 +83 -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 +66 -0
- package/dist/src/hooks/useCuration.js.map +1 -0
- package/dist/src/hooks/useDebugger.d.ts +1 -0
- package/dist/src/hooks/useDebugger.js +15 -0
- package/dist/src/hooks/useDebugger.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 +63 -0
- package/dist/src/hooks/useFilterListProps.js.map +1 -0
- package/dist/src/hooks/useFilterStack.d.ts +4 -0
- package/dist/src/hooks/useFilterStack.js +52 -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 +27 -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 +109 -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 +50 -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 +58 -0
- package/dist/src/hooks/useSortby.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +61 -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/dist/src/utility/debug.d.ts +12 -0
- package/dist/src/utility/debug.js +43 -0
- package/dist/src/utility/debug.js.map +1 -0
- package/dist/src/utility/index.d.ts +1 -0
- package/dist/src/utility/index.js +14 -0
- package/dist/src/utility/index.js.map +1 -0
- package/package.json +8 -3
|
@@ -0,0 +1,187 @@
|
|
|
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 SensorSort = () => {
|
|
11
|
+
const { options, config } = (0, hooks_1.useReactifySearchContext)();
|
|
12
|
+
const curation = (0, hooks_1.useCuration)();
|
|
13
|
+
const globalCuration = (curation === null || curation === void 0 ? void 0 : curation.id) === "global";
|
|
14
|
+
const { sortOption } = (0, hooks_1.useSortby)();
|
|
15
|
+
const { sort, query } = react_1.default.useMemo(() => {
|
|
16
|
+
return {
|
|
17
|
+
sort: buildSort({
|
|
18
|
+
sortOption,
|
|
19
|
+
collection: options.mode === "collection" ? options.collection : undefined,
|
|
20
|
+
curation,
|
|
21
|
+
globalCuration,
|
|
22
|
+
}),
|
|
23
|
+
query: buildQuery({
|
|
24
|
+
sortOption,
|
|
25
|
+
curation,
|
|
26
|
+
globalCuration,
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
}, [config, sortOption, curation]);
|
|
30
|
+
return (react_1.default.createElement(ReactiveComponent_1.default, { componentId: "SensorSort", customQuery: () => ({
|
|
31
|
+
sort,
|
|
32
|
+
query,
|
|
33
|
+
}) }));
|
|
34
|
+
};
|
|
35
|
+
exports.SensorSort = SensorSort;
|
|
36
|
+
const buildSort = (args) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const { curation, sortOption, collection, globalCuration } = args;
|
|
39
|
+
// return default sort option if unset
|
|
40
|
+
if (!sortOption) {
|
|
41
|
+
return collection
|
|
42
|
+
? mapCollectionPositionSortClause(collection)
|
|
43
|
+
: ["_score"];
|
|
44
|
+
}
|
|
45
|
+
// curation positions are only applied for the default `collections.position` or `_score` sort
|
|
46
|
+
// if the sort is something else, apply a normal sort which applies what the user has requested
|
|
47
|
+
if (!["_score", "collections.position"].includes(sortOption.field)) {
|
|
48
|
+
return [{ [sortOption.field]: sortOption.direction }];
|
|
49
|
+
}
|
|
50
|
+
// no matching curation, return default sort clause
|
|
51
|
+
if (!curation) {
|
|
52
|
+
return collection
|
|
53
|
+
? mapCollectionPositionSortClause(collection)
|
|
54
|
+
: ["_score"];
|
|
55
|
+
}
|
|
56
|
+
const sorts = [];
|
|
57
|
+
// show pins first
|
|
58
|
+
if (globalCuration && collection) {
|
|
59
|
+
sorts.push(...mapCollectionPositionSortClause(collection));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
sorts.push({
|
|
63
|
+
"curations.position": {
|
|
64
|
+
unmapped_type: "long",
|
|
65
|
+
order: "asc",
|
|
66
|
+
nested: {
|
|
67
|
+
path: "curations",
|
|
68
|
+
filter: {
|
|
69
|
+
term: {
|
|
70
|
+
[`curations.${"collection" === curation.type
|
|
71
|
+
? "collectionHandle"
|
|
72
|
+
: "searchTerm"}.keyword`]: "collection" === curation.type
|
|
73
|
+
? curation.collectionHandle
|
|
74
|
+
: (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (0 < curation.boosting.groupings.length) {
|
|
82
|
+
const groupings = curation.boosting.groupings.sort((a, b) => a.position > b.position ? 1 : -1);
|
|
83
|
+
for (const grouping of groupings) {
|
|
84
|
+
try {
|
|
85
|
+
const query = JSON.parse(grouping.query);
|
|
86
|
+
if (query)
|
|
87
|
+
sorts.push(query);
|
|
88
|
+
}
|
|
89
|
+
catch (_b) {
|
|
90
|
+
console.error(`query could not be parsed for boost grouping`, grouping);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (0 < curation.boosting.sortings.length) {
|
|
95
|
+
const sortings = curation.boosting.sortings.sort((a, b) => a.position > b.position ? 1 : -1);
|
|
96
|
+
for (const sorting of sortings) {
|
|
97
|
+
try {
|
|
98
|
+
const query = JSON.parse(sorting.query);
|
|
99
|
+
if (query)
|
|
100
|
+
sorts.push(query);
|
|
101
|
+
}
|
|
102
|
+
catch (_c) {
|
|
103
|
+
console.error(`query could not be parsed for boost sorting`, sorting);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// finally, for collections, if no other sorting is defined, sort by index order to provide
|
|
108
|
+
// a consistent order
|
|
109
|
+
if ("collection" === curation.type && sorts.length === 0) {
|
|
110
|
+
sorts.push("_doc");
|
|
111
|
+
}
|
|
112
|
+
// finally, for search, sort by score
|
|
113
|
+
if ("search" === curation.type) {
|
|
114
|
+
sorts.push("_score");
|
|
115
|
+
}
|
|
116
|
+
return sorts;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Return a sort clause which sorts by position within the given collection.
|
|
120
|
+
*/
|
|
121
|
+
function mapCollectionPositionSortClause(collection) {
|
|
122
|
+
return [
|
|
123
|
+
{
|
|
124
|
+
"collections.position": {
|
|
125
|
+
order: "asc",
|
|
126
|
+
nested: {
|
|
127
|
+
path: "collections",
|
|
128
|
+
filter: {
|
|
129
|
+
term: {
|
|
130
|
+
"collections.handle.keyword": collection.handle,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
const buildQuery = (args) => {
|
|
139
|
+
var _a;
|
|
140
|
+
const { curation, sortOption, globalCuration } = args;
|
|
141
|
+
if (!curation || globalCuration) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
bool: {
|
|
146
|
+
must_not: [
|
|
147
|
+
{
|
|
148
|
+
nested: {
|
|
149
|
+
path: "curations",
|
|
150
|
+
query: {
|
|
151
|
+
bool: {
|
|
152
|
+
must: [
|
|
153
|
+
{
|
|
154
|
+
term: {
|
|
155
|
+
[`curations.${"collection" === curation.type
|
|
156
|
+
? "collectionHandle"
|
|
157
|
+
: "searchTerm"}.keyword`]: "collection" === curation.type
|
|
158
|
+
? curation.collectionHandle
|
|
159
|
+
: (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase(),
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
term: {
|
|
164
|
+
"curations.hidden": true,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
// hide callout when not sorting by _score or collections.position
|
|
173
|
+
...(sortOption &&
|
|
174
|
+
!["_score", "collections.position"].includes(sortOption.field)
|
|
175
|
+
? [
|
|
176
|
+
{
|
|
177
|
+
term: {
|
|
178
|
+
type: "callout",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
]
|
|
182
|
+
: []),
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=SensorSort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensorSort.js","sourceRoot":"","sources":["../../../../src/components/Sensor/SensorSort.tsx"],"names":[],"mappings":"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","sourcesContent":["import React from \"react\";\nimport ReactiveComponent from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent\";\n\nimport { ConfigCuration, ConfigSort } from \"../../types\";\nimport { useReactifySearchContext, useSortby, useCuration } from \"../../hooks\";\n\nexport const SensorSort: React.FC = () => {\n const { options, config } = useReactifySearchContext();\n const curation = useCuration();\n const globalCuration = curation?.id === \"global\";\n\n const { sortOption } = useSortby();\n\n const { sort, query } = React.useMemo(() => {\n return {\n sort: buildSort({\n sortOption,\n collection: options.mode === \"collection\" ? options.collection : undefined,\n curation,\n globalCuration,\n }),\n query: buildQuery({\n sortOption,\n curation,\n globalCuration,\n }),\n };\n }, [config, sortOption, curation]);\n\n return (\n <ReactiveComponent\n componentId=\"SensorSort\"\n customQuery={() => ({\n sort,\n query,\n })}\n />\n );\n};\n\nconst buildSort = (args: {\n globalCuration?: boolean;\n sortOption?: ConfigSort;\n curation?: ConfigCuration;\n collection?: {\n id: number;\n title: string;\n handle: string;\n };\n}): any[] => {\n const { curation, sortOption, collection, globalCuration } = args;\n\n // return default sort option if unset\n if (!sortOption) {\n return collection\n ? mapCollectionPositionSortClause(collection)\n : [\"_score\"];\n }\n\n // curation positions are only applied for the default `collections.position` or `_score` sort\n // if the sort is something else, apply a normal sort which applies what the user has requested\n if (![\"_score\", \"collections.position\"].includes(sortOption.field)) {\n return [{ [sortOption.field]: sortOption.direction }];\n }\n\n // no matching curation, return default sort clause\n if (!curation) {\n return collection\n ? mapCollectionPositionSortClause(collection)\n : [\"_score\"];\n }\n\n const sorts = [];\n\n // show pins first\n if (globalCuration && collection) {\n sorts.push(...mapCollectionPositionSortClause(collection));\n } else {\n sorts.push({\n \"curations.position\": {\n unmapped_type: \"long\",\n order: \"asc\",\n nested: {\n path: \"curations\",\n filter: {\n term: {\n [`curations.${\n \"collection\" === curation.type\n ? \"collectionHandle\"\n : \"searchTerm\"\n }.keyword`]:\n \"collection\" === curation.type\n ? curation.collectionHandle\n : curation.searchTerm?.toLowerCase(),\n },\n },\n },\n },\n });\n }\n\n if (0 < curation.boosting.groupings.length) {\n const groupings = curation.boosting.groupings.sort((a, b) =>\n a.position > b.position ? 1 : -1\n );\n\n for (const grouping of groupings) {\n try {\n const query = JSON.parse(grouping.query);\n if (query) sorts.push(query);\n } catch {\n console.error(`query could not be parsed for boost grouping`, grouping);\n }\n }\n }\n\n if (0 < curation.boosting.sortings.length) {\n const sortings = curation.boosting.sortings.sort((a, b) =>\n a.position > b.position ? 1 : -1\n );\n\n for (const sorting of sortings) {\n try {\n const query = JSON.parse(sorting.query);\n if (query) sorts.push(query);\n } catch {\n console.error(`query could not be parsed for boost sorting`, sorting);\n }\n }\n }\n\n // finally, for collections, if no other sorting is defined, sort by index order to provide\n // a consistent order\n if (\"collection\" === curation.type && sorts.length === 0) {\n sorts.push(\"_doc\");\n }\n\n // finally, for search, sort by score\n if (\"search\" === curation.type) {\n sorts.push(\"_score\");\n }\n\n return sorts;\n};\n\n/**\n * Return a sort clause which sorts by position within the given collection.\n */\nfunction mapCollectionPositionSortClause(\n collection: NonNullable<{\n id: number;\n title: string;\n handle: string;\n }>\n) {\n return [\n {\n \"collections.position\": {\n order: \"asc\",\n nested: {\n path: \"collections\",\n filter: {\n term: {\n \"collections.handle.keyword\": collection.handle,\n },\n },\n },\n },\n },\n ];\n}\n\nconst buildQuery = (args: {\n sortOption?: ConfigSort;\n curation?: ConfigCuration;\n globalCuration?: boolean;\n}): Record<string, any> | undefined => {\n const { curation, sortOption, globalCuration } = args;\n\n if (!curation || globalCuration) {\n return undefined;\n }\n\n return {\n bool: {\n must_not: [\n {\n nested: {\n path: \"curations\",\n query: {\n bool: {\n must: [\n {\n term: {\n [`curations.${\n \"collection\" === curation.type\n ? \"collectionHandle\"\n : \"searchTerm\"\n }.keyword`]:\n \"collection\" === curation.type\n ? curation.collectionHandle\n : curation.searchTerm?.toLowerCase(),\n },\n },\n {\n term: {\n \"curations.hidden\": true,\n },\n },\n ],\n },\n },\n },\n },\n // hide callout when not sorting by _score or collections.position\n ...(sortOption &&\n ![\"_score\", \"collections.position\"].includes(sortOption.field)\n ? [\n {\n term: {\n type: \"callout\",\n },\n },\n ]\n : []),\n ],\n },\n };\n};\n"]}
|
|
@@ -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","sourcesContent":["import React from \"react\";\nimport ReactiveComponent from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveComponent\";\n\nexport const SensorSortScore: React.FC = () => (\n <ReactiveComponent\n componentId=\"SensorSortScore\"\n customQuery={() => ({\n sort: { _score: \"desc\" },\n })}\n />\n);\n"]}
|
|
@@ -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","sourcesContent":["import React from \"react\";\n\nimport { useReactifySearchContext } from \"../../hooks\";\n\nimport { SensorSort } from \"./SensorSort\";\nimport { SensorSearch } from \"./SensorSearch\";\nimport { SensorSortScore } from \"./SensorSortScore\";\nimport { SensorPublished } from \"./SensorPublished\";\nimport { SensorCollection } from \"./SensorCollection\";\nimport { SensorInventoryAvailable } from \"./SensorInventoryAvailable\";\n\nexport type SensorStackProps = {\n /** This component does not support any props */\n};\n\nexport const SensorStack: React.FC<SensorStackProps> = () => {\n const { options } = useReactifySearchContext();\n\n // instant search mode\n if (options.mode === \"instant-search\") {\n return (\n <>\n <SensorPublished />\n <SensorSortScore />\n </>\n );\n }\n\n // result grid mode\n return (\n <>\n <SensorSort />\n <SensorSearch />\n <SensorPublished />\n <SensorCollection />\n <SensorInventoryAvailable />\n </>\n );\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./SensorSort";
|
|
2
|
+
export * from "./SensorSearch";
|
|
3
|
+
export * from "./SensorPublished";
|
|
4
|
+
export * from "./SensorSortScore";
|
|
5
|
+
export * from "./SensorCollection";
|
|
6
|
+
export * from "./SensorInventoryAvailable";
|
|
7
|
+
export * from "./SensorStack";
|
|
8
|
+
export declare const SENSOR_IDS: string[];
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
exports.SENSOR_IDS = void 0;
|
|
14
|
+
__exportStar(require("./SensorSort"), exports);
|
|
15
|
+
__exportStar(require("./SensorSearch"), exports);
|
|
16
|
+
__exportStar(require("./SensorPublished"), exports);
|
|
17
|
+
__exportStar(require("./SensorSortScore"), exports);
|
|
18
|
+
__exportStar(require("./SensorCollection"), exports);
|
|
19
|
+
__exportStar(require("./SensorInventoryAvailable"), exports);
|
|
20
|
+
__exportStar(require("./SensorStack"), exports);
|
|
21
|
+
// this is consumed by the react prop in various components
|
|
22
|
+
exports.SENSOR_IDS = [
|
|
23
|
+
"SensorSort",
|
|
24
|
+
"SensorSearch",
|
|
25
|
+
"SensorSortScore",
|
|
26
|
+
"SensorPublished",
|
|
27
|
+
"SensorCollection",
|
|
28
|
+
"SensorInventoryAvailable",
|
|
29
|
+
];
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sensor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,iDAA+B;AAC/B,oDAAkC;AAClC,oDAAkC;AAClC,qDAAmC;AACnC,6DAA2C;AAE3C,gDAA8B;AAE9B,2DAA2D;AAC9C,QAAA,UAAU,GAAG;IACxB,YAAY;IACZ,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,0BAA0B;CAC3B,CAAC","sourcesContent":["export * from \"./SensorSort\";\nexport * from \"./SensorSearch\";\nexport * from \"./SensorPublished\";\nexport * from \"./SensorSortScore\";\nexport * from \"./SensorCollection\";\nexport * from \"./SensorInventoryAvailable\";\n\nexport * from \"./SensorStack\";\n\n// this is consumed by the react prop in various components\nexport const SENSOR_IDS = [\n \"SensorSort\",\n \"SensorSearch\",\n \"SensorSortScore\",\n \"SensorPublished\",\n \"SensorCollection\",\n \"SensorInventoryAvailable\",\n];\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useSortby } from "../../hooks";
|
|
3
|
+
export declare type SortbyProps = {
|
|
4
|
+
/** Render method called once for all sort options */
|
|
5
|
+
renderSortOptions?: React.FC<ReturnType<typeof useSortby>>;
|
|
6
|
+
};
|
|
7
|
+
export declare const Sortby: React.FC<SortbyProps>;
|
|
@@ -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.Sortby = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const components_1 = require("../../components");
|
|
10
|
+
const Sortby = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const sortbyData = (0, hooks_1.useSortby)();
|
|
13
|
+
const RenderSortOptionsComponent = (_a = props.renderSortOptions) !== null && _a !== void 0 ? _a : components_1.ExampleSortby;
|
|
14
|
+
return (react_1.default.createElement(RenderSortOptionsComponent, Object.assign({}, sortbyData)));
|
|
15
|
+
};
|
|
16
|
+
exports.Sortby = Sortby;
|
|
17
|
+
//# sourceMappingURL=Sortby.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sortby.js","sourceRoot":"","sources":["../../../../src/components/Sortby/Sortby.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAwC;AACxC,iDAAiD;AAO1C,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;;IACrD,MAAM,UAAU,GAAG,IAAA,iBAAS,GAAE,CAAC;IAE/B,MAAM,0BAA0B,GAAG,MAAA,KAAK,CAAC,iBAAiB,mCAAI,0BAAa,CAAC;IAE5E,OAAO,CACL,8BAAC,0BAA0B,oBACrB,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,MAAM,UAUjB","sourcesContent":["import React from \"react\";\n\nimport { useSortby } from \"../../hooks\";\nimport { ExampleSortby } from \"../../components\";\n\nexport type SortbyProps = {\n /** Render method called once for all sort options */\n renderSortOptions?: React.FC<ReturnType<typeof useSortby>>;\n};\n\nexport const Sortby: React.FC<SortbyProps> = (props) => {\n const sortbyData = useSortby();\n\n const RenderSortOptionsComponent = props.renderSortOptions ?? ExampleSortby;\n\n return (\n <RenderSortOptionsComponent\n {...sortbyData}\n />\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Sortby";
|
|
@@ -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("./Sortby"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sortby/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB","sourcesContent":["export * from \"./Sortby\";"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
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.UtilityAuthenticatedReactiveBase = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const hooks_1 = require("../../hooks");
|
|
9
|
+
const ReactiveBase_1 = __importDefault(require("@appbaseio/reactivesearch/lib/components/basic/ReactiveBase"));
|
|
10
|
+
const UtilityAuthenticatedReactiveBase = (props) => {
|
|
11
|
+
const reactiveBaseProps = (0, hooks_1.useReactiveBaseProps)();
|
|
12
|
+
return (react_1.default.createElement(ReactiveBase_1.default, Object.assign({}, reactiveBaseProps), props.children));
|
|
13
|
+
};
|
|
14
|
+
exports.UtilityAuthenticatedReactiveBase = UtilityAuthenticatedReactiveBase;
|
|
15
|
+
//# sourceMappingURL=UtilityAuthenticatedReactiveBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UtilityAuthenticatedReactiveBase.js","sourceRoot":"","sources":["../../../../src/components/Utility/UtilityAuthenticatedReactiveBase.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uCAAmD;AACnD,+GAAuF;AAEhF,MAAM,gCAAgC,GAAa,CAAC,KAAK,EAAE,EAAE;IAClE,MAAM,iBAAiB,GAAG,IAAA,4BAAoB,GAAE,CAAC;IAEjD,OAAO,CACL,8BAAC,sBAAY,oBACP,iBAAiB,GAEpB,KAAK,CAAC,QAAQ,CACF,CAChB,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,gCAAgC,oCAU3C","sourcesContent":["import React from \"react\";\nimport { useReactiveBaseProps } from \"../../hooks\";\nimport ReactiveBase from \"@appbaseio/reactivesearch/lib/components/basic/ReactiveBase\";\n\nexport const UtilityAuthenticatedReactiveBase: React.FC = (props) => {\n const reactiveBaseProps = useReactiveBaseProps();\n\n return (\n <ReactiveBase\n {...reactiveBaseProps}\n >\n {props.children}\n </ReactiveBase>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./UtilityAuthenticatedReactiveBase";
|
|
@@ -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("./UtilityAuthenticatedReactiveBase"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Utility/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qEAAmD","sourcesContent":["export * from \"./UtilityAuthenticatedReactiveBase\";"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./Example"), exports);
|
|
14
|
+
__exportStar(require("./Filter"), exports);
|
|
15
|
+
__exportStar(require("./ReactifySearchBase"), exports);
|
|
16
|
+
__exportStar(require("./Result"), exports);
|
|
17
|
+
__exportStar(require("./Search"), exports);
|
|
18
|
+
__exportStar(require("./Sensor"), exports);
|
|
19
|
+
__exportStar(require("./Sortby"), exports);
|
|
20
|
+
__exportStar(require("./Utility"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,uDAAqC;AACrC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,4CAAyB","sourcesContent":["export * from \"./Example\";\nexport * from \"./Filter\";\nexport * from \"./ReactifySearchBase\";\nexport * from \"./Result\";\nexport * from \"./Search\";\nexport * from \"./Sensor\";\nexport * from \"./Sortby\";\nexport * from \"./Utility\""]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./reactivesearch";
|
|
2
|
+
export * from "./useDebugger";
|
|
3
|
+
export * from "./useSortby";
|
|
4
|
+
export * from "./usePagination";
|
|
5
|
+
export * from "./usePaginationLoadMore";
|
|
6
|
+
export * from "./useSearch";
|
|
7
|
+
export * from "./useFilters";
|
|
8
|
+
export * from "./useCuration";
|
|
9
|
+
export * from "./useAnalytics";
|
|
10
|
+
export * from "./useFilterStack";
|
|
11
|
+
export * from "./useProductPrice";
|
|
12
|
+
export * from "./useFilterListProps";
|
|
13
|
+
export * from "./useFilterCollapsedState";
|
|
14
|
+
export * from "./useConfig";
|
|
15
|
+
export * from "./useReactifySearchContext";
|
|
@@ -0,0 +1,28 @@
|
|
|
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("./reactivesearch"), exports);
|
|
14
|
+
__exportStar(require("./useDebugger"), exports);
|
|
15
|
+
__exportStar(require("./useSortby"), exports);
|
|
16
|
+
__exportStar(require("./usePagination"), exports);
|
|
17
|
+
__exportStar(require("./usePaginationLoadMore"), exports);
|
|
18
|
+
__exportStar(require("./useSearch"), exports);
|
|
19
|
+
__exportStar(require("./useFilters"), exports);
|
|
20
|
+
__exportStar(require("./useCuration"), exports);
|
|
21
|
+
__exportStar(require("./useAnalytics"), exports);
|
|
22
|
+
__exportStar(require("./useFilterStack"), exports);
|
|
23
|
+
__exportStar(require("./useProductPrice"), exports);
|
|
24
|
+
__exportStar(require("./useFilterListProps"), exports);
|
|
25
|
+
__exportStar(require("./useFilterCollapsedState"), exports);
|
|
26
|
+
__exportStar(require("./useConfig"), exports);
|
|
27
|
+
__exportStar(require("./useReactifySearchContext"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AAEjC,gDAA8B;AAC9B,8CAA4B;AAC5B,kDAAgC;AAChC,0DAAwC;AACxC,8CAA4B;AAC5B,+CAA6B;AAC7B,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,4DAA0C;AAC1C,8CAA4B;AAC5B,6DAA2C","sourcesContent":["export * from \"./reactivesearch\";\n\nexport * from \"./useDebugger\";\nexport * from \"./useSortby\";\nexport * from \"./usePagination\";\nexport * from \"./usePaginationLoadMore\";\nexport * from \"./useSearch\";\nexport * from \"./useFilters\";\nexport * from \"./useCuration\";\nexport * from \"./useAnalytics\";\nexport * from \"./useFilterStack\";\nexport * from \"./useProductPrice\";\nexport * from \"./useFilterListProps\";\nexport * from \"./useFilterCollapsedState\";\nexport * from \"./useConfig\";\nexport * from \"./useReactifySearchContext\";\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./useReactiveBaseProps";
|
|
2
|
+
export * from "./useReactiveDataSearchProps";
|
|
3
|
+
export * from "./useReactiveFilterListProps";
|
|
4
|
+
export * from "./useReactiveFilterRangeProps";
|
|
5
|
+
export * from "./useReactiveFilterSliderProps";
|
|
6
|
+
export * from "./useReactiveFilterSharedProps";
|
|
7
|
+
export * from "./useReactiveReactProp";
|
|
8
|
+
export * from "./useReactiveReactiveListProps";
|
|
@@ -0,0 +1,21 @@
|
|
|
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("./useReactiveBaseProps"), exports);
|
|
14
|
+
__exportStar(require("./useReactiveDataSearchProps"), exports);
|
|
15
|
+
__exportStar(require("./useReactiveFilterListProps"), exports);
|
|
16
|
+
__exportStar(require("./useReactiveFilterRangeProps"), exports);
|
|
17
|
+
__exportStar(require("./useReactiveFilterSliderProps"), exports);
|
|
18
|
+
__exportStar(require("./useReactiveFilterSharedProps"), exports);
|
|
19
|
+
__exportStar(require("./useReactiveReactProp"), exports);
|
|
20
|
+
__exportStar(require("./useReactiveReactiveListProps"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuC;AACvC,+DAA6C;AAC7C,+DAA6C;AAC7C,gEAA8C;AAC9C,iEAA+C;AAC/C,iEAA+C;AAC/C,yDAAuC;AACvC,iEAA+C","sourcesContent":["export * from \"./useReactiveBaseProps\";\nexport * from \"./useReactiveDataSearchProps\";\nexport * from \"./useReactiveFilterListProps\";\nexport * from \"./useReactiveFilterRangeProps\";\nexport * from \"./useReactiveFilterSliderProps\";\nexport * from \"./useReactiveFilterSharedProps\";\nexport * from \"./useReactiveReactProp\";\nexport * from \"./useReactiveReactiveListProps\";\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.useReactiveBaseProps = void 0;
|
|
16
|
+
const react_1 = __importDefault(require("react"));
|
|
17
|
+
const hooks_1 = require("../../hooks");
|
|
18
|
+
const useReactiveBaseProps = () => {
|
|
19
|
+
const { options } = (0, hooks_1.useReactifySearchContext)();
|
|
20
|
+
const reactiveBaseProps = react_1.default.useMemo(() => ({
|
|
21
|
+
app: options.index,
|
|
22
|
+
url: options.credentials.endpoint,
|
|
23
|
+
credentials: `${options.credentials.username}:${options.credentials.password}`,
|
|
24
|
+
theme: options.theme,
|
|
25
|
+
transformResponse: (response) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
var _a, _b, _c, _d;
|
|
27
|
+
// support filtering inside nested aggregations by moving the inner aggregation
|
|
28
|
+
// up one level such that reactivesearch understands it
|
|
29
|
+
//
|
|
30
|
+
// see useReactiveFilterListProps > defaultQuery to see how a filter is being applied
|
|
31
|
+
// to variant aggregations to ensure that only in stock sizes are displayed as filter
|
|
32
|
+
// options, this involves a nested filter, which requires this fix
|
|
33
|
+
//
|
|
34
|
+
// https://github.com/appbaseio/reactivesearch/issues/1530
|
|
35
|
+
if ((_b = (_a = response === null || response === void 0 ? void 0 : response.aggregations) === null || _a === void 0 ? void 0 : _a.reactivesearch_nested) === null || _b === void 0 ? void 0 : _b.reactify_nested_outer) {
|
|
36
|
+
response.aggregations.reactivesearch_nested =
|
|
37
|
+
(_d = (_c = response === null || response === void 0 ? void 0 : response.aggregations) === null || _c === void 0 ? void 0 : _c.reactivesearch_nested) === null || _d === void 0 ? void 0 : _d.reactify_nested_outer;
|
|
38
|
+
}
|
|
39
|
+
return response;
|
|
40
|
+
}),
|
|
41
|
+
}), [options.credentials, options.theme]);
|
|
42
|
+
return reactiveBaseProps;
|
|
43
|
+
};
|
|
44
|
+
exports.useReactiveBaseProps = useReactiveBaseProps;
|
|
45
|
+
//# sourceMappingURL=useReactiveBaseProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uCAAuD;AAEhD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,MAAM,iBAAiB,GAAG,eAAK,CAAC,OAAO,CACrC,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,EAAE,OAAO,CAAC,KAAK;QAClB,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ;QACjC,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;QAC9E,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,iBAAiB,EAAE,CAAO,QAAa,EAAE,EAAE;;YACzC,+EAA+E;YAC/E,uDAAuD;YACvD,EAAE;YACF,qFAAqF;YACrF,qFAAqF;YACrF,kEAAkE;YAClE,EAAE;YACF,0DAA0D;YAC1D,IACE,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,EACpE;gBACA,QAAQ,CAAC,YAAY,CAAC,qBAAqB;oBACzC,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,CAAC;aACxE;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA;KACF,CAAC,EACF,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CACrC,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAhCW,QAAA,oBAAoB,wBAgC/B","sourcesContent":["import React from \"react\";\nimport { useReactifySearchContext } from \"../../hooks\";\n\nexport const useReactiveBaseProps = () => {\n const { options } = useReactifySearchContext();\n\n const reactiveBaseProps = React.useMemo(\n () => ({\n app: options.index,\n url: options.credentials.endpoint,\n credentials: `${options.credentials.username}:${options.credentials.password}`,\n theme: options.theme,\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n response.aggregations.reactivesearch_nested =\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer;\n }\n\n return response;\n },\n }),\n [options.credentials, options.theme]\n );\n\n return reactiveBaseProps;\n};\n"]}
|