@usereactify/search 5.0.0-beta.9 → 5.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +713 -0
- package/README.md +3 -21
- package/dist/package.json +3 -3
- package/dist/src/components/ClearAll/ClearAll.d.ts +8 -0
- package/dist/src/components/ClearAll/ClearAll.js +29 -0
- package/dist/src/components/ClearAll/ClearAll.js.map +1 -0
- package/dist/src/components/ClearAll/index.d.ts +1 -0
- package/dist/src/components/{ReactifySearchBase → ClearAll}/index.js +1 -1
- package/dist/src/components/ClearAll/index.js.map +1 -0
- package/dist/src/components/CustomComponent/CustomComponent.d.ts +4 -0
- package/dist/src/components/CustomComponent/CustomComponent.js +13 -0
- package/dist/src/components/CustomComponent/CustomComponent.js.map +1 -0
- package/dist/src/components/CustomComponent/index.d.ts +1 -0
- package/dist/src/components/CustomComponent/index.js +14 -0
- package/dist/src/components/CustomComponent/index.js.map +1 -0
- package/dist/src/components/Example/ExampleClearAll.d.ts +4 -0
- package/dist/src/components/Example/ExampleClearAll.js +12 -0
- package/dist/src/components/Example/ExampleClearAll.js.map +1 -0
- package/dist/src/components/Example/ExampleCustomComponent.d.ts +2 -0
- package/dist/src/components/Example/ExampleCustomComponent.js +20 -0
- package/dist/src/components/Example/ExampleCustomComponent.js.map +1 -0
- package/dist/src/components/Example/ExampleFilterList.d.ts +5 -0
- package/dist/src/components/Example/ExampleFilterList.js +81 -10
- package/dist/src/components/Example/ExampleFilterList.js.map +1 -1
- package/dist/src/components/Example/ExampleFilterRange.js +6 -11
- package/dist/src/components/Example/ExampleFilterRange.js.map +1 -1
- package/dist/src/components/Example/ExampleFilterSlider.js +8 -9
- package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -1
- package/dist/src/components/Example/ExampleFilters.d.ts +4 -0
- package/dist/src/components/Example/{ExampleFilterStack.js → ExampleFilters.js} +6 -5
- package/dist/src/components/Example/ExampleFilters.js.map +1 -0
- package/dist/src/components/Example/ExampleFiltersActive.d.ts +4 -0
- package/dist/src/components/Example/ExampleFiltersActive.js +23 -0
- package/dist/src/components/Example/ExampleFiltersActive.js.map +1 -0
- package/dist/src/components/Example/ExampleHookUseFilters.d.ts +2 -0
- package/dist/src/components/Example/ExampleHookUseFilters.js +20 -0
- package/dist/src/components/Example/ExampleHookUseFilters.js.map +1 -0
- package/dist/src/components/Example/ExampleHookUseSearch.d.ts +2 -0
- package/dist/src/components/Example/ExampleHookUseSearch.js +22 -0
- package/dist/src/components/Example/ExampleHookUseSearch.js.map +1 -0
- package/dist/src/components/Example/ExampleHookUseSortBy.d.ts +2 -0
- package/dist/src/components/Example/ExampleHookUseSortBy.js +18 -0
- package/dist/src/components/Example/ExampleHookUseSortBy.js.map +1 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.d.ts +2 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.js +11 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.js.map +1 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.d.ts +2 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.js +11 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.js.map +1 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.d.ts +2 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.js +11 -0
- package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.js.map +1 -0
- package/dist/src/components/Example/ExampleResultCardCallout.js +1 -1
- package/dist/src/components/Example/ExampleResultCardCallout.js.map +1 -1
- package/dist/src/components/Example/ExampleResultCardProduct.js +1 -1
- package/dist/src/components/Example/ExampleResultCardProduct.js.map +1 -1
- package/dist/src/components/Example/ExampleResults.d.ts +2 -0
- package/dist/src/components/Example/ExampleResults.js +22 -0
- package/dist/src/components/Example/ExampleResults.js.map +1 -0
- package/dist/src/components/Example/ExampleSearch.d.ts +4 -0
- package/dist/src/components/Example/ExampleSearch.js +20 -0
- package/dist/src/components/Example/ExampleSearch.js.map +1 -0
- package/dist/src/components/Example/ExampleSortBy.d.ts +4 -0
- package/dist/src/components/Example/{ExampleSortby.js → ExampleSortBy.js} +4 -4
- package/dist/src/components/Example/ExampleSortBy.js.map +1 -0
- package/dist/src/components/Example/ExampleStats.d.ts +4 -0
- package/dist/src/components/Example/ExampleStats.js +15 -0
- package/dist/src/components/Example/ExampleStats.js.map +1 -0
- package/dist/src/components/Example/index.d.ts +12 -2
- package/dist/src/components/Example/index.js +12 -2
- package/dist/src/components/Example/index.js.map +1 -1
- package/dist/src/components/Filter/Filter.d.ts +9 -6
- package/dist/src/components/Filter/Filter.js +29 -29
- package/dist/src/components/Filter/Filter.js.map +1 -1
- package/dist/src/components/Filter/Filters.d.ts +7 -0
- package/dist/src/components/Filter/Filters.js +17 -0
- package/dist/src/components/Filter/Filters.js.map +1 -0
- package/dist/src/components/Filter/FiltersActive.d.ts +16 -0
- package/dist/src/components/Filter/FiltersActive.js +36 -0
- package/dist/src/components/Filter/FiltersActive.js.map +1 -0
- package/dist/src/components/Filter/index.d.ts +2 -1
- package/dist/src/components/Filter/index.js +2 -1
- package/dist/src/components/Filter/index.js.map +1 -1
- package/dist/src/components/{ReactifySearchBase/ReactifySearchBase.d.ts → ReactifySearchProvider/ReactifySearchProvider.d.ts} +6 -10
- package/dist/src/components/{ReactifySearchBase/ReactifySearchBase.js → ReactifySearchProvider/ReactifySearchProvider.js} +33 -29
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -0
- package/dist/src/components/ReactifySearchProvider/index.d.ts +1 -0
- package/dist/src/components/ReactifySearchProvider/index.js +14 -0
- package/dist/src/components/ReactifySearchProvider/index.js.map +1 -0
- package/dist/src/components/Result/ResultCardCallout.d.ts +2 -4
- package/dist/src/components/Result/ResultCardCallout.js.map +1 -1
- package/dist/src/components/Result/ResultCardProduct.d.ts +2 -5
- package/dist/src/components/Result/ResultCardProduct.js.map +1 -1
- package/dist/src/components/Result/ResultPaginationLoadMore.d.ts +2 -2
- package/dist/src/components/Result/ResultPaginationLoadMore.js +1 -1
- package/dist/src/components/Result/ResultPaginationLoadMore.js.map +1 -1
- package/dist/src/components/Result/ResultPaginationNextPrev.d.ts +2 -2
- package/dist/src/components/Result/ResultPaginationNextPrev.js +1 -1
- package/dist/src/components/Result/ResultPaginationNextPrev.js.map +1 -1
- package/dist/src/components/Result/ResultPaginationNumbered.d.ts +2 -2
- package/dist/src/components/Result/ResultPaginationNumbered.js +1 -1
- package/dist/src/components/Result/ResultPaginationNumbered.js.map +1 -1
- package/dist/src/components/Result/{ResultStack.d.ts → Results.d.ts} +21 -13
- package/dist/src/components/Result/{ResultStack.js → Results.js} +45 -28
- package/dist/src/components/Result/Results.js.map +1 -0
- package/dist/src/components/Result/index.d.ts +1 -1
- package/dist/src/components/Result/index.js +1 -1
- package/dist/src/components/Result/index.js.map +1 -1
- package/dist/src/components/Search/Search.d.ts +7 -0
- package/dist/src/components/Search/Search.js +17 -0
- package/dist/src/components/Search/Search.js.map +1 -0
- package/dist/src/components/Search/index.d.ts +1 -1
- package/dist/src/components/Search/index.js +1 -1
- package/dist/src/components/Search/index.js.map +1 -1
- package/dist/src/components/Sensor/SensorCollection.js +2 -2
- package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
- package/dist/src/components/Sensor/SensorInstantSearch.d.ts +2 -0
- package/dist/src/components/Sensor/SensorInstantSearch.js +73 -0
- package/dist/src/components/Sensor/SensorInstantSearch.js.map +1 -0
- package/dist/src/components/Sensor/SensorInventoryAvailable.js +1 -1
- package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -1
- package/dist/src/components/Sensor/SensorSearch.js +3 -3
- package/dist/src/components/Sensor/SensorSearch.js.map +1 -1
- package/dist/src/components/Sensor/SensorSort.js +13 -13
- package/dist/src/components/Sensor/SensorSort.js.map +1 -1
- package/dist/src/components/Sensor/Sensors.d.ts +3 -0
- package/dist/src/components/Sensor/{SensorStack.js → Sensors.js} +6 -4
- package/dist/src/components/Sensor/Sensors.js.map +1 -0
- package/dist/src/components/Sensor/index.d.ts +2 -1
- package/dist/src/components/Sensor/index.js +3 -1
- package/dist/src/components/Sensor/index.js.map +1 -1
- 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 → SortBy}/index.js +1 -1
- package/dist/src/components/{Sortby → SortBy}/index.js.map +1 -1
- package/dist/src/components/Stats/Stats.d.ts +22 -0
- package/dist/src/components/Stats/Stats.js +15 -0
- package/dist/src/components/Stats/Stats.js.map +1 -0
- package/dist/src/components/Stats/index.d.ts +1 -0
- package/dist/src/components/Stats/index.js +14 -0
- package/dist/src/components/Stats/index.js.map +1 -0
- package/dist/src/components/index.d.ts +5 -2
- package/dist/src/components/index.js +5 -2
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/hooks/index.d.ts +4 -3
- package/dist/src/hooks/index.js +4 -3
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/reactivesearch/index.d.ts +3 -3
- package/dist/src/hooks/reactivesearch/index.js +3 -3
- package/dist/src/hooks/reactivesearch/index.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +2 -1
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +12 -11
- package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +2 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.d.ts +6 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +14 -2
- package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +2 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.d.ts +5 -0
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +11 -3
- package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +4 -4
- package/dist/src/hooks/reactivesearch/useReactiveReactProp.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.d.ts +5 -0
- package/dist/src/hooks/reactivesearch/{useReactiveResultStackProps.js → useReactiveReactiveListProps.js} +7 -6
- package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.js.map +1 -0
- package/dist/src/hooks/useConfig.js +1 -1
- package/dist/src/hooks/useConfig.js.map +1 -1
- package/dist/src/hooks/useCuration.js +4 -8
- package/dist/src/hooks/useCuration.js.map +1 -1
- package/dist/src/hooks/useFilterListProps.d.ts +3 -2
- package/dist/src/hooks/useFilterListProps.js +67 -10
- package/dist/src/hooks/useFilterListProps.js.map +1 -1
- package/dist/src/hooks/useFilterRangeProps.d.ts +11 -0
- package/dist/src/hooks/useFilterRangeProps.js +53 -0
- package/dist/src/hooks/useFilterRangeProps.js.map +1 -0
- package/dist/src/hooks/useFilterSliderProps.d.ts +12 -0
- package/dist/src/hooks/useFilterSliderProps.js +49 -0
- package/dist/src/hooks/useFilterSliderProps.js.map +1 -0
- package/dist/src/hooks/useFilters.d.ts +5 -2
- package/dist/src/hooks/useFilters.js +45 -11
- package/dist/src/hooks/useFilters.js.map +1 -1
- package/dist/src/hooks/usePagination.d.ts +10 -0
- package/dist/src/hooks/usePagination.js.map +1 -1
- package/dist/src/hooks/usePaginationLoadMore.js +1 -1
- package/dist/src/hooks/usePaginationLoadMore.js.map +1 -1
- package/dist/src/hooks/useReactifySearchContext.d.ts +12 -20
- package/dist/src/hooks/useReactifySearchContext.js.map +1 -1
- package/dist/src/hooks/useSearch.d.ts +8 -3
- package/dist/src/hooks/useSearch.js +39 -17
- package/dist/src/hooks/useSearch.js.map +1 -1
- package/dist/src/hooks/useSortBy.d.ts +9 -0
- package/dist/src/hooks/{useSortby.js → useSortBy.js} +5 -5
- package/dist/src/hooks/useSortBy.js.map +1 -0
- package/dist/src/types/firestore.d.ts +3 -0
- package/dist/src/types/firestore.js.map +1 -1
- package/dist/src/types/reactivesearch.d.ts +2 -2
- package/dist/src/types/reactivesearch.js.map +1 -1
- package/dist/src/utility/debug.d.ts +3 -1
- package/dist/src/utility/debug.js +6 -2
- package/dist/src/utility/debug.js.map +1 -1
- package/package.json +3 -3
- package/dist/src/components/Example/ExampleFilterStack.d.ts +0 -4
- package/dist/src/components/Example/ExampleFilterStack.js.map +0 -1
- package/dist/src/components/Example/ExampleSortby.d.ts +0 -4
- package/dist/src/components/Example/ExampleSortby.js.map +0 -1
- package/dist/src/components/Filter/FilterStack.d.ts +0 -7
- package/dist/src/components/Filter/FilterStack.js +0 -17
- package/dist/src/components/Filter/FilterStack.js.map +0 -1
- package/dist/src/components/ReactifySearchBase/ReactifySearchBase.js.map +0 -1
- package/dist/src/components/ReactifySearchBase/index.d.ts +0 -1
- package/dist/src/components/ReactifySearchBase/index.js.map +0 -1
- package/dist/src/components/Result/ResultStack.js.map +0 -1
- package/dist/src/components/Search/SearchInput.d.ts +0 -8
- package/dist/src/components/Search/SearchInput.js +0 -18
- package/dist/src/components/Search/SearchInput.js.map +0 -1
- package/dist/src/components/Sensor/SensorStack.d.ts +0 -3
- package/dist/src/components/Sensor/SensorStack.js.map +0 -1
- package/dist/src/components/Sortby/Sortby.d.ts +0 -7
- package/dist/src/components/Sortby/Sortby.js +0 -17
- package/dist/src/components/Sortby/Sortby.js.map +0 -1
- package/dist/src/components/Sortby/index.d.ts +0 -1
- package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.d.ts +0 -17
- package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.js.map +0 -1
- package/dist/src/hooks/useFilterStack.d.ts +0 -4
- package/dist/src/hooks/useFilterStack.js +0 -52
- package/dist/src/hooks/useFilterStack.js.map +0 -1
- package/dist/src/hooks/useSortby.d.ts +0 -6
- package/dist/src/hooks/useSortby.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
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.FiltersActive = void 0;
|
|
7
|
+
const reactivesearch_1 = require("@appbaseio/reactivesearch");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const components_1 = require("../../components");
|
|
10
|
+
const FiltersActive = (props) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleFiltersActive;
|
|
13
|
+
return (react_1.default.createElement(reactivesearch_1.SelectedFilters, { render: ({ selectedValues, setValue }) => {
|
|
14
|
+
const selectedFilters = Object.entries(selectedValues)
|
|
15
|
+
.filter(([key, item]) => {
|
|
16
|
+
var _a, _b;
|
|
17
|
+
return (item === null || item === void 0 ? void 0 : item.URLParams) &&
|
|
18
|
+
(item === null || item === void 0 ? void 0 : item.showFilter) &&
|
|
19
|
+
(!!((_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.length) || !!((_b = item === null || item === void 0 ? void 0 : item.value) === null || _b === void 0 ? void 0 : _b.label));
|
|
20
|
+
})
|
|
21
|
+
.map(([key, item]) => ({
|
|
22
|
+
key: key,
|
|
23
|
+
label: item.label,
|
|
24
|
+
value: item.value,
|
|
25
|
+
}));
|
|
26
|
+
const handleRemove = (selectedFilterKey) => {
|
|
27
|
+
setValue(selectedFilterKey, null);
|
|
28
|
+
};
|
|
29
|
+
if (!selectedFilters.length) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
return (react_1.default.createElement(RenderComponent, { selectedFilters: selectedFilters, handleRemove: handleRemove }));
|
|
33
|
+
} }));
|
|
34
|
+
};
|
|
35
|
+
exports.FiltersActive = FiltersActive;
|
|
36
|
+
//# sourceMappingURL=FiltersActive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FiltersActive.js","sourceRoot":"","sources":["../../../../src/components/Filter/FiltersActive.tsx"],"names":[],"mappings":";;;;;;AAAA,8DAA4D;AAC5D,kDAA0B;AAE1B,iDAAwD;AAcjD,MAAM,aAAa,GAAiC,CAAC,KAAK,EAAE,EAAE;;IACnE,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,iCAAoB,CAAC;IAE7D,OAAO,CACL,8BAAC,gCAAe,IACd,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE;YACvC,MAAM,eAAe,GACnB,MAAM,CAAC,OAAO,CAAC,cAAc,CAC9B;iBACE,MAAM,CACL,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE;;gBACd,OAAA,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS;qBACf,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAA;oBAChB,CAAC,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,MAAM,CAAA,IAAI,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,KAAK,CAAA,CAAC,CAAA;aAAA,CAClD;iBACA,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;gBACrB,GAAG,EAAE,GAAG;gBACR,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC,CAAC;YAEN,MAAM,YAAY,GAAG,CAAC,iBAAyB,EAAE,EAAE;gBACjD,QAAQ,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;YACpC,CAAC,CAAC;YAEF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACb;YAED,OAAO,CACL,8BAAC,eAAe,IACd,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;QACJ,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAtCW,QAAA,aAAa,iBAsCxB","sourcesContent":["import { SelectedFilters } from \"@appbaseio/reactivesearch\";\nimport React from \"react\";\n\nimport { ExampleFiltersActive } from \"../../components\";\n\nexport type FiltersActiveProps = {\n /** Render method called once for all active filters */\n render?: React.FC<{\n selectedFilters: Array<{\n key: string;\n label: string;\n value: Array<string> | string | { start: number; end: number };\n }>;\n handleRemove: (filterKey: string) => void;\n }>;\n};\n\nexport const FiltersActive: React.FC<FiltersActiveProps> = (props) => {\n const RenderComponent = props.render ?? ExampleFiltersActive;\n\n return (\n <SelectedFilters\n render={({ selectedValues, setValue }) => {\n const selectedFilters = (\n Object.entries(selectedValues) as Array<[string, any]>\n )\n .filter(\n ([key, item]) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n )\n .map(([key, item]) => ({\n key: key,\n label: item.label,\n value: item.value,\n }));\n\n const handleRemove = (selectedFilterKey: string) => {\n setValue(selectedFilterKey, null);\n };\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return (\n <RenderComponent\n selectedFilters={selectedFilters}\n handleRemove={handleRemove}\n />\n );\n }}\n />\n );\n};\n"]}
|
|
@@ -11,5 +11,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./Filter"), exports);
|
|
14
|
-
__exportStar(require("./
|
|
14
|
+
__exportStar(require("./Filters"), exports);
|
|
15
|
+
__exportStar(require("./FiltersActive"), exports);
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Filter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Filter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,kDAAgC","sourcesContent":["export * from \"./Filter\";\nexport * from \"./Filters\";\nexport * from \"./FiltersActive\";\n"]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare type
|
|
2
|
+
export declare type ReactifySearchProviderProps = {
|
|
3
3
|
/** The search area the provider will be used in */
|
|
4
4
|
mode: "search" | "collection" | "instant-search";
|
|
5
5
|
/** Shopify store domain used to resolve the site configuration */
|
|
6
6
|
shopifyPermanentDomain: string;
|
|
7
|
-
/** Specific filter group handle, used to override automated logic */
|
|
8
|
-
filterStackHandle?: string;
|
|
9
7
|
/** Callback function for redirects, suitable for headless sites to avoid full page refresh */
|
|
10
8
|
onRedirect?: (type: "redirect" | "search", url: string) => void;
|
|
11
9
|
/** Render method to display a component when the config is loading */
|
|
12
10
|
renderBooting?: () => JSX.Element | null;
|
|
13
|
-
/** Advanced usage:
|
|
11
|
+
/** Advanced usage: Override the default Filters selection logic */
|
|
12
|
+
filtersHandle?: string;
|
|
13
|
+
/** Advanced usage: Allows you to wrap the ReactifySearchProvider in your own ReactiveBase component */
|
|
14
14
|
noReactiveBase?: boolean;
|
|
15
15
|
/** Advanced usage: Array of additional component IDs managed outside of Reactify Search */
|
|
16
16
|
additionalComponentHandles?: string[];
|
|
@@ -31,12 +31,8 @@ export declare type ReactifySearchBaseProps = {
|
|
|
31
31
|
} | {
|
|
32
32
|
mode: "collection";
|
|
33
33
|
/** Collection object that includes the handle, used to find curations */
|
|
34
|
-
|
|
35
|
-
id: number;
|
|
36
|
-
title: string;
|
|
37
|
-
handle: string;
|
|
38
|
-
};
|
|
34
|
+
collectionHandle: string;
|
|
39
35
|
} | {
|
|
40
36
|
mode: "instant-search";
|
|
41
37
|
});
|
|
42
|
-
export declare const
|
|
38
|
+
export declare const ReactifySearchProvider: React.FC<ReactifySearchProviderProps>;
|
|
@@ -22,32 +22,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
25
|
+
exports.ReactifySearchProvider = void 0;
|
|
26
26
|
const react_1 = __importDefault(require("react"));
|
|
27
27
|
const Sentry = __importStar(require("@sentry/react"));
|
|
28
28
|
const hooks_1 = require("../../hooks");
|
|
29
29
|
const components_1 = require("../../components");
|
|
30
30
|
const utility_1 = require("../../utility");
|
|
31
|
-
const
|
|
31
|
+
const ReactifySearchProvider = (props) => {
|
|
32
32
|
react_1.default.useEffect(() => {
|
|
33
|
-
utility_1.debug.log("
|
|
33
|
+
utility_1.debug.log("ReactifySearchProvider", "props", props);
|
|
34
34
|
Sentry.setTags({
|
|
35
35
|
"reactifysearch.index": props.index,
|
|
36
36
|
"reactifysearch.shop": props.shopifyPermanentDomain,
|
|
37
37
|
"reactifysearch.mode": props.mode,
|
|
38
|
-
"reactifysearch.collection": props.mode === "collection" ? props.
|
|
39
|
-
"reactifysearch.filter": props.
|
|
38
|
+
"reactifysearch.collection": props.mode === "collection" ? props.collectionHandle : undefined,
|
|
39
|
+
"reactifysearch.filter": props.filtersHandle,
|
|
40
40
|
});
|
|
41
41
|
}, [props]);
|
|
42
42
|
return (react_1.default.createElement(Sentry.ErrorBoundary, { fallback: react_1.default.createElement("p", null, "An error has occurred") },
|
|
43
43
|
react_1.default.createElement(ReactifySearchInner, Object.assign({}, props))));
|
|
44
44
|
};
|
|
45
|
-
exports.
|
|
45
|
+
exports.ReactifySearchProvider = ReactifySearchProvider;
|
|
46
46
|
const ReactifySearchInner = (props) => {
|
|
47
47
|
var _a, _b;
|
|
48
48
|
const { config } = (0, hooks_1.useConfig)(props.shopifyPermanentDomain, props.configId);
|
|
49
|
-
const [
|
|
50
|
-
const [
|
|
49
|
+
const [searchTerm, setSearchTerm] = react_1.default.useState("");
|
|
50
|
+
const [showInstantSearchResults, setShowInstantSearchResults] = react_1.default.useState(false);
|
|
51
51
|
const [sortOption, setSortOption] = react_1.default.useState("");
|
|
52
52
|
const credentials = (_a = props.credentials) !== null && _a !== void 0 ? _a : {
|
|
53
53
|
username: "guest",
|
|
@@ -60,57 +60,61 @@ const ReactifySearchInner = (props) => {
|
|
|
60
60
|
fontSize: "inherit",
|
|
61
61
|
},
|
|
62
62
|
};
|
|
63
|
-
const
|
|
63
|
+
const searchTermFromURL = react_1.default.useMemo(() => {
|
|
64
64
|
var _a;
|
|
65
|
-
if (typeof window === "undefined")
|
|
66
|
-
return
|
|
65
|
+
if (typeof window === "undefined") {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
67
68
|
const urlParams = new URLSearchParams(window.location.search);
|
|
68
69
|
return (_a = urlParams.get("q")) !== null && _a !== void 0 ? _a : undefined;
|
|
69
|
-
}, [window.location.search]);
|
|
70
|
+
}, [typeof window !== "undefined" && window.location.search]);
|
|
70
71
|
const searchSortFromURL = react_1.default.useMemo(() => {
|
|
71
72
|
var _a;
|
|
72
|
-
if (typeof window === "undefined")
|
|
73
|
-
return
|
|
73
|
+
if (typeof window === "undefined") {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
74
76
|
const urlParams = new URLSearchParams(window.location.search);
|
|
75
77
|
return (_a = urlParams.get("sort")) !== null && _a !== void 0 ? _a : undefined;
|
|
76
|
-
}, [window.location.search]);
|
|
78
|
+
}, [typeof window !== "undefined" && window.location.search]);
|
|
77
79
|
react_1.default.useEffect(() => {
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
+
if (searchTermFromURL && searchTerm !== searchTermFromURL) {
|
|
81
|
+
setSearchTerm(searchTermFromURL);
|
|
80
82
|
}
|
|
81
|
-
}, [
|
|
83
|
+
}, [searchTermFromURL]);
|
|
82
84
|
react_1.default.useEffect(() => {
|
|
83
85
|
if (searchSortFromURL && sortOption !== searchSortFromURL) {
|
|
84
86
|
setSortOption(searchSortFromURL);
|
|
85
87
|
}
|
|
86
88
|
}, [searchSortFromURL]);
|
|
87
89
|
react_1.default.useEffect(() => {
|
|
90
|
+
if (typeof window == "undefined") {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
88
93
|
if (window.location.search === "" && sortOption) {
|
|
89
94
|
setSortOption(sortOption);
|
|
90
95
|
}
|
|
91
|
-
}, [window.location.
|
|
96
|
+
}, [typeof window !== "undefined" && window.location.search]);
|
|
92
97
|
const contextValue = react_1.default.useMemo(() => {
|
|
93
98
|
var _a;
|
|
94
99
|
if (!config) {
|
|
95
100
|
return;
|
|
96
101
|
}
|
|
97
|
-
|
|
102
|
+
return {
|
|
98
103
|
config: config,
|
|
99
|
-
options: Object.assign(Object.assign({}, props), { index: (_a = props.index) !== null && _a !== void 0 ? _a : config.index,
|
|
104
|
+
options: Object.assign(Object.assign({}, props), { index: (_a = props.index) !== null && _a !== void 0 ? _a : config.index, filtersHandle: props.filtersHandle, credentials: credentials, theme: theme }),
|
|
100
105
|
search: {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
searchTerm: searchTerm,
|
|
107
|
+
setSearchTerm: setSearchTerm,
|
|
108
|
+
showInstantSearchResults: showInstantSearchResults,
|
|
109
|
+
setShowInstantSearchResults: setShowInstantSearchResults,
|
|
105
110
|
},
|
|
106
111
|
sortby: {
|
|
107
112
|
sortOption: sortOption,
|
|
108
113
|
setSortOption: setSortOption,
|
|
109
114
|
},
|
|
110
115
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, [config, props, searchQuery, instantSearchVisible, sortOption]);
|
|
116
|
+
}, [config, props, searchTerm, showInstantSearchResults, sortOption]);
|
|
117
|
+
utility_1.debug.hook("ReactifySearchProvider", "context", contextValue);
|
|
114
118
|
if (!contextValue) {
|
|
115
119
|
if (props.renderBooting) {
|
|
116
120
|
return props.renderBooting();
|
|
@@ -123,4 +127,4 @@ const ReactifySearchInner = (props) => {
|
|
|
123
127
|
return (react_1.default.createElement(hooks_1.ReactifySearchContext.Provider, { value: contextValue },
|
|
124
128
|
react_1.default.createElement(components_1.UtilityAuthenticatedReactiveBase, null, props.children)));
|
|
125
129
|
};
|
|
126
|
-
//# sourceMappingURL=
|
|
130
|
+
//# sourceMappingURL=ReactifySearchProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactifySearchProvider.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchProvider/ReactifySearchProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sDAAwC;AAExC,uCAA+D;AAC/D,iDAAoE;AACpE,2CAAsC;AA2C/B,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAK,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEpD,MAAM,CAAC,OAAO,CAAC;YACb,sBAAsB,EAAE,KAAK,CAAC,KAAK;YACnC,qBAAqB,EAAE,KAAK,CAAC,sBAAsB;YACnD,qBAAqB,EAAE,KAAK,CAAC,IAAI;YACjC,2BAA2B,EACzB,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAA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\"react\";\nimport * as Sentry from \"@sentry/react\";\n\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { debug } from \"../../utility\";\n\nexport type ReactifySearchProviderProps = {\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Callback function for redirects, suitable for headless sites to avoid full page refresh */\n onRedirect?: (type: \"redirect\" | \"search\", url: string) => void;\n /** Render method to display a component when the config is loading */\n renderBooting?: () => JSX.Element | null;\n /** Advanced usage: Override the default Filters selection logic */\n filtersHandle?: string;\n /** Advanced usage: Allows you to wrap the ReactifySearchProvider in your own ReactiveBase component */\n noReactiveBase?: boolean;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentHandles?: string[];\n /** Advanced usage: Override the default Elasticsearch index */\n index?: string;\n /** Advanced usage: Override the default Reactify Search config (for multi-instance stores) */\n configId?: string;\n /** Advanced usage: Override the default Elasticsearch credentials */\n credentials?: {\n username: string;\n password: string;\n endpoint: string;\n };\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collectionHandle: string;\n }\n | {\n mode: \"instant-search\";\n }\n);\n\nexport const ReactifySearchProvider: React.FC<ReactifySearchProviderProps> = (\n props\n) => {\n React.useEffect(() => {\n debug.log(\"ReactifySearchProvider\", \"props\", props);\n\n Sentry.setTags({\n \"reactifysearch.index\": props.index,\n \"reactifysearch.shop\": props.shopifyPermanentDomain,\n \"reactifysearch.mode\": props.mode,\n \"reactifysearch.collection\":\n props.mode === \"collection\" ? props.collectionHandle : undefined,\n \"reactifysearch.filter\": props.filtersHandle,\n });\n }, [props]);\n\n return (\n <Sentry.ErrorBoundary fallback={<p>An error has occurred</p>}>\n <ReactifySearchInner {...props} />\n </Sentry.ErrorBoundary>\n );\n};\n\nconst ReactifySearchInner: React.FC<ReactifySearchProviderProps> = (props) => {\n const { config } = useConfig(props.shopifyPermanentDomain, props.configId);\n\n const [searchTerm, setSearchTerm] = React.useState<string>(\"\");\n const [showInstantSearchResults, setShowInstantSearchResults] =\n React.useState<boolean>(false);\n const [sortOption, setSortOption] = React.useState<string>(\"\");\n\n const credentials = props.credentials ?? {\n username: \"guest\",\n password: \"password\",\n endpoint: \"https://api.search.reactify.app\",\n };\n\n const theme = props.theme ?? {\n typography: {\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n },\n };\n\n const searchTermFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"q\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const searchSortFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"sort\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n React.useEffect(() => {\n if (searchTermFromURL && searchTerm !== searchTermFromURL) {\n setSearchTerm(searchTermFromURL);\n }\n }, [searchTermFromURL]);\n\n React.useEffect(() => {\n if (searchSortFromURL && sortOption !== searchSortFromURL) {\n setSortOption(searchSortFromURL);\n }\n }, [searchSortFromURL]);\n\n React.useEffect(() => {\n if (typeof window == \"undefined\") {\n return;\n }\n\n if (window.location.search === \"\" && sortOption) {\n setSortOption(sortOption);\n }\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const contextValue = React.useMemo(() => {\n if (!config) {\n return;\n }\n\n return {\n config: config,\n options: {\n ...props,\n index: props.index ?? config.index,\n filtersHandle: props.filtersHandle,\n credentials: credentials,\n theme: theme,\n },\n search: {\n searchTerm: searchTerm,\n setSearchTerm: setSearchTerm,\n showInstantSearchResults: showInstantSearchResults,\n setShowInstantSearchResults: setShowInstantSearchResults,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n };\n }, [config, props, searchTerm, showInstantSearchResults, sortOption]);\n\n debug.hook(\"ReactifySearchProvider\", \"context\", contextValue);\n\n if (!contextValue) {\n if (props.renderBooting) {\n return props.renderBooting();\n }\n return null;\n }\n\n if (props.noReactiveBase) {\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n {props.children}\n </ReactifySearchContext.Provider>\n );\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>\n {props.children}\n </UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ReactifySearchProvider";
|
|
@@ -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("./ReactifySearchProvider"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchProvider/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAyC","sourcesContent":["export * from \"./ReactifySearchProvider\";\n"]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ElasticCallout } from "../../types";
|
|
3
|
+
import { ResultsProps } from "..";
|
|
3
4
|
export declare type ResultCardCalloutProps = {
|
|
4
5
|
pagePosition: number;
|
|
5
6
|
document: ElasticCallout;
|
|
6
7
|
callout: ElasticCallout["callout"];
|
|
7
|
-
render?:
|
|
8
|
-
itemRef: (node?: Element | null) => void;
|
|
9
|
-
handleClick: () => void;
|
|
10
|
-
}>;
|
|
8
|
+
render?: ResultsProps["renderResultCardCallout"];
|
|
11
9
|
};
|
|
12
10
|
export declare const ResultCardCallout: React.FC<ResultCardCalloutProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultCardCallout.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultCardCallout.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6EAAwD;AAGxD,uCAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"ResultCardCallout.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultCardCallout.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6EAAwD;AAGxD,uCAA2C;AAC3C,0BAA4D;AASrD,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;;IAC3E,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,uCAAS,EAAC;QAChC,SAAS,EAAE,GAAG;QACd,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACzC,KAAK,CAAC;YACJ,SAAS,EAAE,gBAAgB;YAC3B,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;gBACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;aAC3B;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,MAAM,UAAU,GAAG,eAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,KAAK,CAAC;YACJ,SAAS,EAAE,eAAe;YAC1B,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI;gBACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;aAC3B;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAE3B,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,MAAM,EAAE;YACV,UAAU,EAAE,CAAC;SACd;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,4BAAwB,CAAC;IAEjE,OAAO,8BAAC,eAAe,oBAAK,KAAK,IAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,IAAI,CAAC;AAChF,CAAC,CAAC;AApCW,QAAA,iBAAiB,qBAoC5B","sourcesContent":["import React from \"react\";\nimport { useInView } from \"react-intersection-observer\";\n\nimport { ElasticCallout } from \"../../types\";\nimport { useAnalytics } from \"../../hooks\";\nimport { ResultsProps, ExampleResultCardCallout } from \"..\";\n\nexport type ResultCardCalloutProps = {\n pagePosition: number;\n document: ElasticCallout;\n callout: ElasticCallout[\"callout\"];\n render?: ResultsProps[\"renderResultCardCallout\"];\n};\n\nexport const ResultCardCallout: React.FC<ResultCardCalloutProps> = (props) => {\n const { track } = useAnalytics();\n const { ref, inView } = useInView({\n threshold: 0.5,\n triggerOnce: true,\n });\n\n const handleClick = React.useCallback(() => {\n track({\n eventName: \"clickPromotion\",\n payload: {\n link: props.callout.link,\n title: props.callout.title,\n },\n });\n }, [track, props.callout]);\n\n const handleView = React.useCallback(() => {\n track({\n eventName: \"viewPromotion\",\n payload: {\n link: props.callout.link,\n title: props.callout.title,\n },\n });\n }, [track, props.callout]);\n\n React.useEffect(() => {\n if (inView) {\n handleView();\n }\n }, [inView]);\n\n const RenderComponent = props.render ?? ExampleResultCardCallout;\n\n return <RenderComponent {...props} itemRef={ref} handleClick={handleClick} />;\n};\n"]}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ElasticProduct } from "../../types";
|
|
3
|
-
import {
|
|
3
|
+
import { ResultsProps } from "../../components";
|
|
4
4
|
export declare type ResultCardProductProps = {
|
|
5
5
|
pagePosition: number;
|
|
6
6
|
product: ElasticProduct;
|
|
7
7
|
document: ElasticProduct;
|
|
8
|
-
render?:
|
|
9
|
-
itemRef: (node?: Element | null) => void;
|
|
10
|
-
handleClick: () => void;
|
|
11
|
-
}>;
|
|
8
|
+
render?: ResultsProps["renderResultCardProduct"];
|
|
12
9
|
};
|
|
13
10
|
export declare const ResultCardProduct: React.FC<ResultCardProductProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultCardProduct.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultCardProduct.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6EAAwD;AAGxD,uCAA4D;AAC5D,
|
|
1
|
+
{"version":3,"file":"ResultCardProduct.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultCardProduct.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,6EAAwD;AAGxD,uCAA4D;AAC5D,iDAA0E;AASnE,MAAM,iBAAiB,GAAqC,CAAC,KAAK,EAAE,EAAE;;IAC3E,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEpD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,oBAAY,GAAE,CAAC;IACjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,uCAAS,EAAC;QAChC,SAAS,EAAE,GAAG;QACd,WAAW,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n\nimport type { ElasticProduct } from \"../../types\";\nimport { useProductPrice, useAnalytics } from \"../../hooks\";\nimport { ResultsProps, ExampleResultCardProduct } from \"../../components\";\n\nexport type ResultCardProductProps = {\n pagePosition: number;\n product: ElasticProduct;\n document: ElasticProduct;\n render?: ResultsProps[\"renderResultCardProduct\"];\n};\n\nexport const ResultCardProduct: React.FC<ResultCardProductProps> = (props) => {\n const productPrice = useProductPrice(props.product);\n\n const { track } = useAnalytics();\n const { ref, inView } = useInView({\n threshold: 0.5,\n triggerOnce: true,\n });\n\n const handleClick = React.useCallback(() => {\n track({\n eventName: \"clickProduct\",\n payload: {\n elasticProduct: {\n id: props.product.id,\n title: props.product.title,\n },\n },\n });\n }, [track, props.product]);\n\n const handleView = React.useCallback(() => {\n track({\n eventName: \"viewProduct\",\n payload: {\n elasticProduct: {\n id: props.product.id,\n title: props.product.title,\n },\n },\n });\n }, [track, props.product]);\n\n React.useEffect(() => {\n if (inView) {\n handleView();\n }\n }, [inView]);\n\n const RenderComponent = props.render ?? ExampleResultCardProduct;\n\n return (\n <RenderComponent\n {...productPrice}\n pagePosition={props.pagePosition}\n product={props.product}\n document={props.document}\n itemRef={ref}\n handleClick={handleClick}\n />\n );\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ReactivesearchResultProps } from "../../types";
|
|
3
|
-
import {
|
|
3
|
+
import { ResultsProps } from "../../components";
|
|
4
4
|
export declare type ResultPaginationLoadMoreProps = ReactivesearchResultProps & {
|
|
5
|
-
render?:
|
|
5
|
+
render?: ResultsProps["renderPaginationLoadMore"];
|
|
6
6
|
};
|
|
7
7
|
export declare const ResultPaginationLoadMore: React.FC<ResultPaginationLoadMoreProps>;
|
|
@@ -11,7 +11,7 @@ const ResultPaginationLoadMore = (props) => {
|
|
|
11
11
|
var _a;
|
|
12
12
|
const paginationLoadMoreHook = (0, hooks_1.usePaginationLoadMore)(props);
|
|
13
13
|
const RenderPaginationComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleResultPaginationLoadMore;
|
|
14
|
-
return
|
|
14
|
+
return react_1.default.createElement(RenderPaginationComponent, Object.assign({}, paginationLoadMoreHook));
|
|
15
15
|
};
|
|
16
16
|
exports.ResultPaginationLoadMore = ResultPaginationLoadMore;
|
|
17
17
|
//# sourceMappingURL=ResultPaginationLoadMore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultPaginationLoadMore.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultPaginationLoadMore.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"ResultPaginationLoadMore.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultPaginationLoadMore.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAoD;AACpD,iDAG0B;AAMnB,MAAM,wBAAwB,GACnC,CAAC,KAAK,EAAE,EAAE;;IACR,MAAM,sBAAsB,GAAG,IAAA,6BAAqB,EAAC,KAAK,CAAC,CAAC;IAE5D,MAAM,yBAAyB,GAC7B,MAAA,KAAK,CAAC,MAAM,mCAAI,4CAA+B,CAAC;IAElD,OAAO,8BAAC,yBAAyB,oBAAK,sBAAsB,EAAI,CAAC;AACnE,CAAC,CAAC;AARS,QAAA,wBAAwB,4BAQjC","sourcesContent":["import React from \"react\";\n\nimport { ReactivesearchResultProps } from \"../../types\";\nimport { usePaginationLoadMore } from \"../../hooks\";\nimport {\n ResultsProps,\n ExampleResultPaginationLoadMore,\n} from \"../../components\";\n\nexport type ResultPaginationLoadMoreProps = ReactivesearchResultProps & {\n render?: ResultsProps[\"renderPaginationLoadMore\"];\n};\n\nexport const ResultPaginationLoadMore: React.FC<ResultPaginationLoadMoreProps> =\n (props) => {\n const paginationLoadMoreHook = usePaginationLoadMore(props);\n\n const RenderPaginationComponent =\n props.render ?? ExampleResultPaginationLoadMore;\n\n return <RenderPaginationComponent {...paginationLoadMoreHook} />;\n };\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { usePagination } from "../../hooks";
|
|
3
2
|
import { ReactivesearchPaginationProps } from "../../types";
|
|
3
|
+
import { ResultsProps } from "../../components";
|
|
4
4
|
export declare type ResultPaginationNextPrevProps = ReactivesearchPaginationProps & {
|
|
5
|
-
render?:
|
|
5
|
+
render?: ResultsProps["renderPaginationNextPrev"];
|
|
6
6
|
};
|
|
7
7
|
export declare const ResultPaginationNextPrev: React.FC<ResultPaginationNextPrevProps>;
|
|
@@ -11,7 +11,7 @@ const ResultPaginationNextPrev = (props) => {
|
|
|
11
11
|
var _a;
|
|
12
12
|
const paginationHook = (0, hooks_1.usePagination)(props);
|
|
13
13
|
const RenderPaginationComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleResultPaginationNextPrev;
|
|
14
|
-
return
|
|
14
|
+
return react_1.default.createElement(RenderPaginationComponent, Object.assign({}, paginationHook));
|
|
15
15
|
};
|
|
16
16
|
exports.ResultPaginationNextPrev = ResultPaginationNextPrev;
|
|
17
17
|
//# sourceMappingURL=ResultPaginationNextPrev.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultPaginationNextPrev.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultPaginationNextPrev.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAA4C;AAE5C,
|
|
1
|
+
{"version":3,"file":"ResultPaginationNextPrev.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultPaginationNextPrev.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAA4C;AAE5C,iDAG0B;AAMnB,MAAM,wBAAwB,GACnC,CAAC,KAAK,EAAE,EAAE;;IACR,MAAM,cAAc,GAAG,IAAA,qBAAa,EAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,yBAAyB,GAC7B,MAAA,KAAK,CAAC,MAAM,mCAAI,4CAA+B,CAAC;IAElD,OAAO,8BAAC,yBAAyB,oBAAK,cAAc,EAAI,CAAC;AAC3D,CAAC,CAAC;AARS,QAAA,wBAAwB,4BAQjC","sourcesContent":["import React from \"react\";\n\nimport { usePagination } from \"../../hooks\";\nimport { ReactivesearchPaginationProps } from \"../../types\";\nimport {\n ResultsProps,\n ExampleResultPaginationNextPrev,\n} from \"../../components\";\n\nexport type ResultPaginationNextPrevProps = ReactivesearchPaginationProps & {\n render?: ResultsProps[\"renderPaginationNextPrev\"];\n};\n\nexport const ResultPaginationNextPrev: React.FC<ResultPaginationNextPrevProps> =\n (props) => {\n const paginationHook = usePagination(props);\n\n const RenderPaginationComponent =\n props.render ?? ExampleResultPaginationNextPrev;\n\n return <RenderPaginationComponent {...paginationHook} />;\n };\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ReactivesearchPaginationProps } from "../../types";
|
|
3
|
-
import {
|
|
3
|
+
import { ResultsProps } from "../../components";
|
|
4
4
|
export declare type ResultPaginationNumberedProps = ReactivesearchPaginationProps & {
|
|
5
|
-
render?:
|
|
5
|
+
render?: ResultsProps["renderPaginationNumbered"];
|
|
6
6
|
};
|
|
7
7
|
export declare const ResultPaginationNumbered: React.FC<ResultPaginationNumberedProps>;
|
|
@@ -14,7 +14,7 @@ const ResultPaginationNumbered = (props) => {
|
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
const RenderPaginationComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleResultPaginationNumbered;
|
|
17
|
-
return
|
|
17
|
+
return react_1.default.createElement(RenderPaginationComponent, Object.assign({}, paginationHook));
|
|
18
18
|
};
|
|
19
19
|
exports.ResultPaginationNumbered = ResultPaginationNumbered;
|
|
20
20
|
//# sourceMappingURL=ResultPaginationNumbered.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultPaginationNumbered.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultPaginationNumbered.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"ResultPaginationNumbered.js","sourceRoot":"","sources":["../../../../src/components/Result/ResultPaginationNumbered.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAA4C;AAC5C,iDAG0B;AAMnB,MAAM,wBAAwB,GACnC,CAAC,KAAK,EAAE,EAAE;;IACR,MAAM,cAAc,GAAG,IAAA,qBAAa,EAAC,KAAK,CAAC,CAAC;IAE5C,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE;QAC9B,OAAO,IAAI,CAAC;KACb;IAED,MAAM,yBAAyB,GAC7B,MAAA,KAAK,CAAC,MAAM,mCAAI,4CAA+B,CAAC;IAElD,OAAO,8BAAC,yBAAyB,oBAAK,cAAc,EAAI,CAAC;AAC3D,CAAC,CAAC;AAZS,QAAA,wBAAwB,4BAYjC","sourcesContent":["import React from \"react\";\n\nimport { ReactivesearchPaginationProps } from \"../../types\";\nimport { usePagination } from \"../../hooks\";\nimport {\n ResultsProps,\n ExampleResultPaginationNumbered,\n} from \"../../components\";\n\nexport type ResultPaginationNumberedProps = ReactivesearchPaginationProps & {\n render?: ResultsProps[\"renderPaginationNumbered\"];\n};\n\nexport const ResultPaginationNumbered: React.FC<ResultPaginationNumberedProps> =\n (props) => {\n const paginationHook = usePagination(props);\n\n if (!paginationHook.totalPages) {\n return null;\n }\n\n const RenderPaginationComponent =\n props.render ?? ExampleResultPaginationNumbered;\n\n return <RenderPaginationComponent {...paginationHook} />;\n };\n"]}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ResultCardCallout } from "./ResultCardCallout";
|
|
3
|
-
import { ResultCardProduct } from "./ResultCardProduct";
|
|
4
|
-
import { ResultPaginationNumbered } from "./ResultPaginationNumbered";
|
|
5
|
-
import { ResultPaginationLoadMore } from "./ResultPaginationLoadMore";
|
|
6
|
-
import { ResultPaginationNextPrev } from "./ResultPaginationNextPrev";
|
|
7
2
|
import { ElasticCallout, ElasticProduct, ReactivesearchError, ReactivesearchResultProps } from "../../types";
|
|
3
|
+
import { useProductPrice, usePagination, usePaginationLoadMore } from "../../hooks";
|
|
8
4
|
export declare type ResultProps = ReactivesearchResultProps & {
|
|
9
5
|
callouts: ElasticCallout[];
|
|
10
6
|
products: ElasticProduct[];
|
|
11
7
|
};
|
|
12
|
-
export declare type
|
|
8
|
+
export declare type ResultsProps = {
|
|
13
9
|
/** Style prop for the list wrapper */
|
|
14
10
|
listStyle?: React.HTMLAttributes<HTMLElement>["style"];
|
|
15
11
|
/** Classname prop for the list wrapper */
|
|
@@ -23,18 +19,30 @@ export declare type ResultStackProps = {
|
|
|
23
19
|
/** Render method called when no results are found */
|
|
24
20
|
renderNoResults?: React.FC;
|
|
25
21
|
/** Render method called once for each product result */
|
|
26
|
-
renderResultCardProduct?: React.
|
|
22
|
+
renderResultCardProduct?: React.FC<ReturnType<typeof useProductPrice> & {
|
|
23
|
+
pagePosition: number;
|
|
24
|
+
product: ElasticProduct;
|
|
25
|
+
document: ElasticProduct;
|
|
26
|
+
itemRef: (node?: Element | null) => void;
|
|
27
|
+
handleClick: () => void;
|
|
28
|
+
}>;
|
|
27
29
|
/** Render method called once for each callout result */
|
|
28
|
-
renderResultCardCallout?: React.
|
|
30
|
+
renderResultCardCallout?: React.FC<{
|
|
31
|
+
pagePosition: number;
|
|
32
|
+
document: ElasticCallout;
|
|
33
|
+
callout: ElasticCallout["callout"];
|
|
34
|
+
itemRef: (node?: Element | null) => void;
|
|
35
|
+
handleClick: () => void;
|
|
36
|
+
}>;
|
|
29
37
|
/** Render method called for pagination type "pagination" */
|
|
30
|
-
renderPaginationNumbered?: React.
|
|
38
|
+
renderPaginationNumbered?: React.FC<ReturnType<typeof usePagination>>;
|
|
31
39
|
/** Render method called for pagination type "next_prev" */
|
|
32
|
-
renderPaginationNextPrev?: React.
|
|
40
|
+
renderPaginationNextPrev?: React.FC<ReturnType<typeof usePagination>>;
|
|
33
41
|
/** Render method called for pagination type "load_more" */
|
|
34
|
-
renderPaginationLoadMore?: React.
|
|
42
|
+
renderPaginationLoadMore?: React.FC<ReturnType<typeof usePaginationLoadMore>>;
|
|
35
43
|
/** Render method called for pagination type "infinite_scroll" */
|
|
36
|
-
renderPaginationInfiniteScroll?: React.
|
|
44
|
+
renderPaginationInfiniteScroll?: React.FC<ReturnType<typeof usePaginationLoadMore>>;
|
|
37
45
|
/** Advanced Usage: Override the default amount of results per page */
|
|
38
46
|
pageSize?: number;
|
|
39
47
|
};
|
|
40
|
-
export declare const
|
|
48
|
+
export declare const Results: React.FC<ResultsProps>;
|