@usereactify/search 5.59.0 → 5.59.1-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 +8 -0
- package/dist/package.json +7 -5
- package/dist/src/components/ClearAll/ClearAll.d.ts +1 -1
- package/dist/src/components/ClearAll/ClearAll.js +4 -9
- package/dist/src/components/ClearAll/ClearAll.js.map +1 -1
- package/dist/src/components/CustomComponent/CustomComponent.d.ts +1 -1
- package/dist/src/components/CustomComponent/CustomComponent.js +2 -2
- package/dist/src/components/CustomComponent/CustomComponent.js.map +1 -1
- package/dist/src/components/Example/ExampleClearAll.d.ts +2 -2
- package/dist/src/components/Example/ExampleClearAll.js +2 -5
- package/dist/src/components/Example/ExampleClearAll.js.map +1 -1
- package/dist/src/components/Example/ExampleCustomComponent.d.ts +1 -1
- package/dist/src/components/Example/ExampleCustomComponent.js +3 -7
- package/dist/src/components/Example/ExampleCustomComponent.js.map +1 -1
- package/dist/src/components/Example/ExampleFilterList.d.ts +2 -2
- package/dist/src/components/Example/ExampleFilterList.js +31 -66
- package/dist/src/components/Example/ExampleFilterList.js.map +1 -1
- package/dist/src/components/Example/ExampleFilterRange.d.ts +2 -2
- package/dist/src/components/Example/ExampleFilterRange.js +2 -12
- package/dist/src/components/Example/ExampleFilterRange.js.map +1 -1
- package/dist/src/components/Example/ExampleFilterSlider.d.ts +2 -2
- package/dist/src/components/Example/ExampleFilterSlider.js +11 -18
- package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -1
- package/dist/src/components/Example/ExampleFilters.d.ts +1 -1
- package/dist/src/components/Example/ExampleFilters.js +3 -8
- package/dist/src/components/Example/ExampleFilters.js.map +1 -1
- package/dist/src/components/Example/ExampleFiltersSelected.d.ts +2 -2
- package/dist/src/components/Example/ExampleFiltersSelected.js +3 -24
- package/dist/src/components/Example/ExampleFiltersSelected.js.map +1 -1
- package/dist/src/components/Example/ExampleHookUseFilters.d.ts +1 -1
- package/dist/src/components/Example/ExampleHookUseFilters.js +3 -10
- package/dist/src/components/Example/ExampleHookUseFilters.js.map +1 -1
- package/dist/src/components/Example/ExampleHookUseResults.d.ts +1 -1
- package/dist/src/components/Example/ExampleHookUseResults.js +3 -8
- package/dist/src/components/Example/ExampleHookUseResults.js.map +1 -1
- package/dist/src/components/Example/ExampleHookUseSearch.js +2 -2
- package/dist/src/components/Example/ExampleHookUseSearch.js.map +1 -1
- package/dist/src/components/Example/ExampleHookUseSortBy.js +2 -1
- package/dist/src/components/Example/ExampleHookUseSortBy.js.map +1 -1
- package/dist/src/components/Example/ExampleProductCardWeight.d.ts +1 -1
- package/dist/src/components/Example/ExampleProductCardWeight.js +14 -47
- package/dist/src/components/Example/ExampleProductCardWeight.js.map +1 -1
- package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.d.ts +1 -1
- package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.js +2 -6
- package/dist/src/components/Example/ExampleReactiveSearchProviderCollection.js.map +1 -1
- package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.d.ts +1 -1
- package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.js +2 -6
- package/dist/src/components/Example/ExampleReactiveSearchProviderInstantSearch.js.map +1 -1
- package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.d.ts +1 -1
- package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.js +2 -6
- package/dist/src/components/Example/ExampleReactiveSearchProviderSearch.js.map +1 -1
- package/dist/src/components/Example/ExampleResultCardCallout.d.ts +1 -1
- package/dist/src/components/Example/ExampleResultCardCallout.js +2 -4
- package/dist/src/components/Example/ExampleResultCardCallout.js.map +1 -1
- package/dist/src/components/Example/ExampleResultCardProduct.d.ts +2 -2
- package/dist/src/components/Example/ExampleResultCardProduct.js +2 -12
- package/dist/src/components/Example/ExampleResultCardProduct.js.map +1 -1
- package/dist/src/components/Example/ExampleResultPaginationInfiniteScroll.d.ts +2 -2
- package/dist/src/components/Example/ExampleResultPaginationInfiniteScroll.js +2 -5
- package/dist/src/components/Example/ExampleResultPaginationInfiniteScroll.js.map +1 -1
- package/dist/src/components/Example/ExampleResultPaginationLoadMore.d.ts +2 -2
- package/dist/src/components/Example/ExampleResultPaginationLoadMore.js +2 -5
- package/dist/src/components/Example/ExampleResultPaginationLoadMore.js.map +1 -1
- package/dist/src/components/Example/ExampleResultPaginationNextPrev.d.ts +2 -2
- package/dist/src/components/Example/ExampleResultPaginationNextPrev.js +2 -7
- package/dist/src/components/Example/ExampleResultPaginationNextPrev.js.map +1 -1
- package/dist/src/components/Example/ExampleResultPaginationNumbered.d.ts +2 -2
- package/dist/src/components/Example/ExampleResultPaginationNumbered.js +6 -20
- package/dist/src/components/Example/ExampleResultPaginationNumbered.js.map +1 -1
- package/dist/src/components/Example/ExampleResults.d.ts +1 -1
- package/dist/src/components/Example/ExampleResults.js +7 -10
- package/dist/src/components/Example/ExampleResults.js.map +1 -1
- package/dist/src/components/Example/ExampleSearch.d.ts +1 -1
- package/dist/src/components/Example/ExampleSearch.js +2 -2
- package/dist/src/components/Example/ExampleSearch.js.map +1 -1
- package/dist/src/components/Example/ExampleSortBy.d.ts +2 -2
- package/dist/src/components/Example/ExampleSortBy.js +2 -5
- package/dist/src/components/Example/ExampleSortBy.js.map +1 -1
- package/dist/src/components/Example/ExampleStats.d.ts +2 -2
- package/dist/src/components/Example/ExampleStats.js +2 -8
- package/dist/src/components/Example/ExampleStats.js.map +1 -1
- package/dist/src/components/Example/ExampleSuggestions.d.ts +2 -2
- package/dist/src/components/Example/ExampleSuggestions.js +2 -7
- package/dist/src/components/Example/ExampleSuggestions.js.map +1 -1
- package/dist/src/components/Example/index.d.ts +6 -6
- package/dist/src/components/Example/index.js +6 -6
- package/dist/src/components/Example/index.js.map +1 -1
- package/dist/src/components/Filter/Filter.d.ts +1 -1
- package/dist/src/components/Filter/Filter.js +30 -35
- package/dist/src/components/Filter/Filter.js.map +1 -1
- package/dist/src/components/Filter/Filters.d.ts +4 -4
- package/dist/src/components/Filter/Filters.js +3 -6
- package/dist/src/components/Filter/Filters.js.map +1 -1
- package/dist/src/components/Filter/FiltersSelected.d.ts +1 -1
- package/dist/src/components/Filter/FiltersSelected.js +4 -9
- package/dist/src/components/Filter/FiltersSelected.js.map +1 -1
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.d.ts +2 -2
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js +20 -8
- package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -1
- package/dist/src/components/Result/ResultCardCallout.d.ts +2 -2
- package/dist/src/components/Result/ResultCardCallout.js +3 -2
- package/dist/src/components/Result/ResultCardCallout.js.map +1 -1
- package/dist/src/components/Result/ResultCardProduct.d.ts +1 -1
- package/dist/src/components/Result/ResultCardProduct.js +4 -3
- package/dist/src/components/Result/ResultCardProduct.js.map +1 -1
- package/dist/src/components/Result/ResultPaginationInfiniteScroll.d.ts +3 -3
- package/dist/src/components/Result/ResultPaginationInfiniteScroll.js +3 -6
- package/dist/src/components/Result/ResultPaginationInfiniteScroll.js.map +1 -1
- package/dist/src/components/Result/ResultPaginationLoadMore.d.ts +3 -3
- package/dist/src/components/Result/ResultPaginationLoadMore.js +3 -6
- package/dist/src/components/Result/ResultPaginationLoadMore.js.map +1 -1
- package/dist/src/components/Result/ResultPaginationNextPrev.d.ts +3 -3
- package/dist/src/components/Result/ResultPaginationNextPrev.js +3 -6
- package/dist/src/components/Result/ResultPaginationNextPrev.js.map +1 -1
- package/dist/src/components/Result/ResultPaginationNumbered.d.ts +3 -3
- package/dist/src/components/Result/ResultPaginationNumbered.js +3 -6
- package/dist/src/components/Result/ResultPaginationNumbered.js.map +1 -1
- package/dist/src/components/Result/ResultStateProvider.d.ts +2 -2
- package/dist/src/components/Result/ResultStateProvider.js +3 -3
- package/dist/src/components/Result/ResultStateProvider.js.map +1 -1
- package/dist/src/components/Result/Results.d.ts +2 -2
- package/dist/src/components/Result/Results.js +50 -52
- package/dist/src/components/Result/Results.js.map +1 -1
- package/dist/src/components/Result/index.d.ts +4 -4
- package/dist/src/components/Result/index.js +4 -4
- package/dist/src/components/Result/index.js.map +1 -1
- package/dist/src/components/Search/Search.d.ts +1 -1
- package/dist/src/components/Search/Search.js +3 -6
- package/dist/src/components/Search/Search.js.map +1 -1
- package/dist/src/components/Sensor/SensorCollection.d.ts +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/SensorCustom.d.ts +1 -2
- package/dist/src/components/Sensor/SensorCustom.js +5 -6
- package/dist/src/components/Sensor/SensorCustom.js.map +1 -1
- package/dist/src/components/Sensor/SensorExplain.js +2 -2
- package/dist/src/components/Sensor/SensorExplain.js.map +1 -1
- package/dist/src/components/Sensor/SensorInventoryAvailable.d.ts +1 -1
- package/dist/src/components/Sensor/SensorInventoryAvailable.js +2 -2
- package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -1
- package/dist/src/components/Sensor/SensorPublished.d.ts +1 -1
- package/dist/src/components/Sensor/SensorPublished.js +2 -2
- package/dist/src/components/Sensor/SensorPublished.js.map +1 -1
- package/dist/src/components/Sensor/SensorSearchTerm.d.ts +1 -2
- package/dist/src/components/Sensor/SensorSearchTerm.js +19 -124
- package/dist/src/components/Sensor/SensorSearchTerm.js.map +1 -1
- package/dist/src/components/Sensor/SensorSort.d.ts +1 -1
- package/dist/src/components/Sensor/SensorSort.js +2 -2
- package/dist/src/components/Sensor/SensorSort.js.map +1 -1
- package/dist/src/components/Sensor/Sensors.d.ts +1 -3
- package/dist/src/components/Sensor/Sensors.js +13 -46
- package/dist/src/components/Sensor/Sensors.js.map +1 -1
- package/dist/src/components/Sensor/index.d.ts +7 -9
- package/dist/src/components/Sensor/index.js +6 -10
- package/dist/src/components/Sensor/index.js.map +1 -1
- package/dist/src/components/SortBy/SortBy.d.ts +1 -1
- package/dist/src/components/SortBy/SortBy.js +3 -6
- package/dist/src/components/SortBy/SortBy.js.map +1 -1
- package/dist/src/components/Stats/Stats.d.ts +2 -2
- package/dist/src/components/Stats/Stats.js +2 -5
- package/dist/src/components/Stats/Stats.js.map +1 -1
- package/dist/src/components/Suggestions/Suggestions.d.ts +1 -1
- package/dist/src/components/Suggestions/Suggestions.js +7 -8
- package/dist/src/components/Suggestions/Suggestions.js.map +1 -1
- package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.d.ts +1 -1
- package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js +3 -3
- package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.js.map +1 -1
- package/dist/src/components/Utility/index.js.map +1 -1
- package/dist/src/components/index.d.ts +2 -2
- package/dist/src/components/index.js +2 -2
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/hooks/index.d.ts +11 -11
- package/dist/src/hooks/index.js +11 -11
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/react-slider/useReactSliderProps.d.ts +2 -2
- package/dist/src/hooks/react-slider/useReactSliderProps.js +6 -6
- package/dist/src/hooks/react-slider/useReactSliderProps.js.map +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.d.ts +1 -1
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +2 -2
- package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
- package/dist/src/hooks/useAnalytics.js.map +1 -1
- package/dist/src/hooks/useConfig.d.ts +1 -1
- package/dist/src/hooks/useConfig.js +1 -1
- package/dist/src/hooks/useConfig.js.map +1 -1
- package/dist/src/hooks/useCuration.d.ts +1 -1
- package/dist/src/hooks/useCuration.js +9 -25
- package/dist/src/hooks/useCuration.js.map +1 -1
- package/dist/src/hooks/useDebugger.js +3 -3
- package/dist/src/hooks/useDebugger.js.map +1 -1
- package/dist/src/hooks/useFilterCollapsedState.d.ts +1 -1
- package/dist/src/hooks/useFilterCollapsedState.js.map +1 -1
- package/dist/src/hooks/useFilterListProps.d.ts +2 -2
- package/dist/src/hooks/useFilterListProps.js +7 -11
- package/dist/src/hooks/useFilterListProps.js.map +1 -1
- package/dist/src/hooks/useFilterRangeProps.d.ts +1 -1
- package/dist/src/hooks/useFilterRangeProps.js +11 -14
- package/dist/src/hooks/useFilterRangeProps.js.map +1 -1
- package/dist/src/hooks/useFilterSliderProps.d.ts +1 -1
- package/dist/src/hooks/useFilterSliderProps.js +10 -9
- package/dist/src/hooks/useFilterSliderProps.js.map +1 -1
- package/dist/src/hooks/useFilters.d.ts +1 -1
- package/dist/src/hooks/useFilters.js +4 -7
- package/dist/src/hooks/useFilters.js.map +1 -1
- package/dist/src/hooks/useIndices.js +2 -2
- package/dist/src/hooks/useIndices.js.map +1 -1
- package/dist/src/hooks/usePagination.d.ts +1 -1
- package/dist/src/hooks/usePagination.js +6 -14
- package/dist/src/hooks/usePagination.js.map +1 -1
- package/dist/src/hooks/usePaginationLoadable.d.ts +1 -1
- package/dist/src/hooks/usePaginationLoadable.js +3 -5
- package/dist/src/hooks/usePaginationLoadable.js.map +1 -1
- package/dist/src/hooks/useProductPrice.d.ts +1 -1
- package/dist/src/hooks/useProductPrice.js +3 -1
- package/dist/src/hooks/useProductPrice.js.map +1 -1
- package/dist/src/hooks/useReactifySearchContext.d.ts +1 -1
- package/dist/src/hooks/useReactifySearchContext.js.map +1 -1
- package/dist/src/hooks/useResults.d.ts +1 -1
- package/dist/src/hooks/useResults.js +4 -4
- package/dist/src/hooks/useResults.js.map +1 -1
- package/dist/src/hooks/useSearch.d.ts +1 -1
- package/dist/src/hooks/useSearch.js +8 -9
- package/dist/src/hooks/useSearch.js.map +1 -1
- package/dist/src/hooks/useSortBy.d.ts +1 -1
- package/dist/src/hooks/useSortBy.js +1 -1
- package/dist/src/hooks/useSortBy.js.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/search-request-builder/base-builders.d.ts +18 -0
- package/dist/src/search-request-builder/base-builders.js +184 -0
- package/dist/src/search-request-builder/base-builders.js.map +1 -0
- package/dist/src/search-request-builder/curation-builders.d.ts +2 -0
- package/dist/src/search-request-builder/curation-builders.js +44 -0
- package/dist/src/search-request-builder/curation-builders.js.map +1 -0
- package/dist/src/search-request-builder/index.d.ts +3 -0
- package/dist/src/search-request-builder/index.js +12 -0
- package/dist/src/search-request-builder/index.js.map +1 -0
- package/dist/src/search-request-builder/search-request-builder.d.ts +3 -0
- package/dist/src/search-request-builder/search-request-builder.js +54 -0
- package/dist/src/search-request-builder/search-request-builder.js.map +1 -0
- package/dist/src/search-request-builder/types.d.ts +105 -0
- package/dist/src/search-request-builder/types.js +30 -0
- package/dist/src/search-request-builder/types.js.map +1 -0
- package/dist/src/search-request-builder/utils.d.ts +27 -0
- package/dist/src/search-request-builder/utils.js +144 -0
- package/dist/src/search-request-builder/utils.js.map +1 -0
- package/dist/src/types/config.d.ts +1 -1
- package/dist/src/types/config.js.map +1 -1
- package/dist/src/types/elastic.d.ts +8 -11
- package/dist/src/types/elastic.js.map +1 -1
- package/dist/src/types/firestore.d.ts +5 -5
- package/dist/src/types/firestore.js.map +1 -1
- package/dist/src/types/index.js.map +1 -1
- package/dist/src/types/reactivesearch.d.ts +1 -1
- package/dist/src/types/reactivesearch.js.map +1 -1
- package/dist/src/types/shopify.d.ts +1 -1
- package/dist/src/types/shopify.js.map +1 -1
- package/dist/src/utility/config.d.ts +1 -1
- package/dist/src/utility/config.js +1 -1
- package/dist/src/utility/config.js.map +1 -1
- package/dist/src/utility/curation.d.ts +2 -2
- package/dist/src/utility/curation.js +1 -1
- package/dist/src/utility/curation.js.map +1 -1
- package/dist/src/utility/debug.js +1 -1
- package/dist/src/utility/debug.js.map +1 -1
- package/dist/src/utility/filters.d.ts +2 -2
- package/dist/src/utility/filters.js.map +1 -1
- package/dist/src/utility/liquid.d.ts +2 -2
- package/dist/src/utility/liquid.js +2 -5
- package/dist/src/utility/liquid.js.map +1 -1
- package/dist/src/utility/props.d.ts +7 -226
- package/dist/src/utility/props.js +61 -108
- package/dist/src/utility/props.js.map +1 -1
- package/dist/src/utility/server.d.ts +1 -1
- package/dist/src/utility/server.js +3 -3
- package/dist/src/utility/server.js.map +1 -1
- package/dist/src/utility/sortOption.d.ts +2 -2
- package/dist/src/utility/sortOption.js.map +1 -1
- package/package.json +7 -5
- package/dist/src/components/Sensor/SensorCollectionWeighted.d.ts +0 -1
- package/dist/src/components/Sensor/SensorCollectionWeighted.js +0 -21
- package/dist/src/components/Sensor/SensorCollectionWeighted.js.map +0 -1
- package/dist/src/components/Sensor/SensorSearchWeighted.d.ts +0 -1
- package/dist/src/components/Sensor/SensorSearchWeighted.js +0 -22
- package/dist/src/components/Sensor/SensorSearchWeighted.js.map +0 -1
- package/dist/src/utility/queries.d.ts +0 -393
- package/dist/src/utility/queries.js +0 -197
- package/dist/src/utility/queries.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sensor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sensor/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,qDAAmC;AACnC,kDAAgC;AAChC,6DAA2C;AAC3C,oDAAkC;AAClC,qDAAmC;AACnC,+CAA6B;AAC7B,4CAA0B;AAE1B,2DAA2D;AACpD,MAAM,UAAU,GAAG,CAAC,IAAwB,EAAE,MAAc,EAAE,UAAmB,EAAE,EAAE;IAC1F,MAAM,SAAS,GAAG;QAChB,YAAY;QACZ,iBAAiB;QACjB,kBAAkB;QAClB,kBAAkB;QAClB,0BAA0B;QAC1B,eAAe;KAChB,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEnE,MAAM,aAAa,GAAG,UAAU,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;IACtG,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,SAAS,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,gBAAgB,KAAK,EAAE,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAlBW,QAAA,UAAU,cAkBrB","sourcesContent":["import type { ReactifySearchMode } from \"../../hooks\";\nimport type { Config } from \"../../types\";\n\nexport * from \"./SensorCollection\";\nexport * from \"./SensorExplain\";\nexport * from \"./SensorInventoryAvailable\";\nexport * from \"./SensorPublished\";\nexport * from \"./SensorSearchTerm\";\nexport * from \"./SensorSort\";\nexport * from \"./Sensors\";\n\n// This is consumed by the react prop in various components\nexport const SENSOR_IDS = (mode: ReactifySearchMode, config: Config, _variation?: string) => {\n const sensorIds = [\n \"SensorSort\",\n \"SensorPublished\",\n \"SensorCollection\",\n \"SensorSearchTerm\",\n \"SensorInventoryAvailable\",\n \"SensorExplain\",\n ];\n\n const sensorType = mode === \"collection\" ? \"collection\" : \"search\";\n\n const customSensors = sensorType === \"collection\" ? config.sensors.collection : config.sensors.search;\n if (customSensors.length > 0) {\n sensorIds.push(...customSensors.map((_item, index) => `SensorCustom_${index}`));\n }\n\n return sensorIds;\n};\n"]}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.SortBy = void 0;
|
|
7
|
-
const
|
|
8
|
-
const hooks_1 = require("../../hooks");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
5
|
const components_1 = require("../../components");
|
|
6
|
+
const hooks_1 = require("../../hooks");
|
|
10
7
|
const SortBy = (props) => {
|
|
11
8
|
var _a;
|
|
12
9
|
const sortByHook = (0, hooks_1.useSortBy)();
|
|
13
10
|
const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleSortBy;
|
|
14
|
-
return
|
|
11
|
+
return (0, jsx_runtime_1.jsx)(RenderComponent, Object.assign({}, sortByHook));
|
|
15
12
|
};
|
|
16
13
|
exports.SortBy = SortBy;
|
|
17
14
|
//# sourceMappingURL=SortBy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SortBy.js","sourceRoot":"","sources":["../../../../src/components/SortBy/SortBy.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SortBy.js","sourceRoot":"","sources":["../../../../src/components/SortBy/SortBy.tsx"],"names":[],"mappings":";;;;AACA,iDAAiD;AACjD,uCAAwC;AAOjC,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;;IACrD,MAAM,UAAU,GAAG,IAAA,iBAAS,GAAE,CAAC;IAE/B,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,0BAAa,CAAC;IAEtD,OAAO,uBAAC,eAAe,oBAAK,UAAU,EAAI,CAAC;AAC7C,CAAC,CAAC;AANW,QAAA,MAAM,UAMjB","sourcesContent":["import type React from \"react\";\nimport { ExampleSortBy } from \"../../components\";\nimport { useSortBy } from \"../../hooks\";\n\nexport type SortByProps = {\n /** Render method called once for all sort options */\n render?: React.FC<ReturnType<typeof useSortBy>>;\n};\n\nexport const SortBy: React.FC<SortByProps> = (props) => {\n const sortByHook = useSortBy();\n\n const RenderComponent = props.render ?? ExampleSortBy;\n\n return <RenderComponent {...sortByHook} />;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ElasticHit, ReactivesearchError } from "../../types";
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ElasticHit, ReactivesearchError } from "../../types";
|
|
3
3
|
export type StatsProps = {
|
|
4
4
|
/** Render method */
|
|
5
5
|
render?: React.FC<{
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Stats = void 0;
|
|
7
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const components_1 = require("../../components");
|
|
9
6
|
const Stats = (props) => {
|
|
10
7
|
var _a;
|
|
11
8
|
const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleStats;
|
|
12
|
-
return (
|
|
9
|
+
return (0, jsx_runtime_1.jsx)(components_1.ResultStateProvider, { render: (renderProps) => (0, jsx_runtime_1.jsx)(RenderComponent, Object.assign({}, renderProps)) });
|
|
13
10
|
};
|
|
14
11
|
exports.Stats = Stats;
|
|
15
12
|
//# sourceMappingURL=Stats.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stats.js","sourceRoot":"","sources":["../../../../src/components/Stats/Stats.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Stats.js","sourceRoot":"","sources":["../../../../src/components/Stats/Stats.tsx"],"names":[],"mappings":";;;;AACA,iDAAqE;AAuB9D,MAAM,KAAK,GAAyB,CAAC,KAAK,EAAE,EAAE;;IACnD,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,yBAAY,CAAC;IAErD,OAAO,uBAAC,gCAAmB,IAAC,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,uBAAC,eAAe,oBAAK,WAAW,EAAI,GAAI,CAAC;AAChG,CAAC,CAAC;AAJW,QAAA,KAAK,SAIhB","sourcesContent":["import type React from \"react\";\nimport { ExampleStats, ResultStateProvider } from \"../../components\";\nimport type { ElasticHit, ReactivesearchError } from \"../../types\";\n\nexport type StatsProps = {\n /** Render method */\n render?: React.FC<{\n isLoading: boolean;\n hits: {\n hidden: number;\n time: number;\n total: number;\n hits: Array<ElasticHit>;\n };\n resultStats: {\n hidden: number;\n numberOfResults?: number;\n promoted: number;\n time: number;\n };\n error?: ReactivesearchError;\n }>;\n};\n\nexport const Stats: React.FC<StatsProps> = (props) => {\n const RenderComponent = props.render ?? ExampleStats;\n\n return <ResultStateProvider render={(renderProps) => <RenderComponent {...renderProps} />} />;\n};\n"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Suggestions = void 0;
|
|
7
|
-
const
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const components_1 = require("../../components");
|
|
9
6
|
const hooks_1 = require("../../hooks");
|
|
10
7
|
const Suggestions = (props) => {
|
|
@@ -13,7 +10,7 @@ const Suggestions = (props) => {
|
|
|
13
10
|
const reactifySearchContext = (0, hooks_1.useReactifySearchContext)();
|
|
14
11
|
const { searchTerm } = (0, hooks_1.useSearch)();
|
|
15
12
|
const sensorIds = (0, components_1.SENSOR_IDS)(reactifySearchContext.options.mode, reactifySearchContext.config);
|
|
16
|
-
return (
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(components_1.CustomComponent, { componentId: "SensorSuggestions", defaultQuery: () => {
|
|
17
14
|
return {
|
|
18
15
|
suggest: {
|
|
19
16
|
suggestions: {
|
|
@@ -22,11 +19,13 @@ const Suggestions = (props) => {
|
|
|
22
19
|
field: props.field,
|
|
23
20
|
gram_size: 2,
|
|
24
21
|
confidence: 0,
|
|
25
|
-
direct_generator: [
|
|
22
|
+
direct_generator: [
|
|
23
|
+
{
|
|
26
24
|
field: props.field,
|
|
27
25
|
suggest_mode: "always",
|
|
28
26
|
min_word_length: 1,
|
|
29
|
-
}
|
|
27
|
+
},
|
|
28
|
+
],
|
|
30
29
|
},
|
|
31
30
|
},
|
|
32
31
|
},
|
|
@@ -47,7 +46,7 @@ const Suggestions = (props) => {
|
|
|
47
46
|
text: option.text,
|
|
48
47
|
}));
|
|
49
48
|
}
|
|
50
|
-
return
|
|
49
|
+
return (0, jsx_runtime_1.jsx)(RenderComponent, Object.assign({}, props));
|
|
51
50
|
} }));
|
|
52
51
|
};
|
|
53
52
|
exports.Suggestions = Suggestions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Suggestions.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Suggestions.js","sourceRoot":"","sources":["../../../../src/components/Suggestions/Suggestions.tsx"],"names":[],"mappings":";;;;AACA,iDAAmF;AACnF,uCAAkE;AAa3D,MAAM,WAAW,GAA+B,CAAC,KAAK,EAAE,EAAE;;IAC/D,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,+BAAkB,CAAC;IAE3D,MAAM,qBAAqB,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAEzD,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,iBAAS,GAAE,CAAC;IAEnC,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE/F,OAAO,CACL,uBAAC,4BAAe,IACd,WAAW,EAAC,mBAAmB,EAC/B,YAAY,EAAE,GAAG,EAAE;YACjB,OAAO;gBACL,OAAO,EAAE;oBACP,WAAW,EAAE;wBACX,IAAI,EAAE,UAAU;wBAChB,MAAM,EAAE;4BACN,KAAK,EAAE,KAAK,CAAC,KAAK;4BAClB,SAAS,EAAE,CAAC;4BACZ,U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} from \"../../components\";\nimport { useReactifySearchContext, useSearch } from \"../../hooks\";\n\nexport type SuggestionsProps = {\n /** The field which should be used for autocompletion */\n field: \"title\";\n /** Render method */\n render?: React.FC<{\n suggestions: Array<{\n text: string;\n }>;\n }>;\n};\n\nexport const Suggestions: React.FC<SuggestionsProps> = (props) => {\n const RenderComponent = props.render ?? ExampleSuggestions;\n\n const reactifySearchContext = useReactifySearchContext();\n\n const { searchTerm } = useSearch();\n\n const sensorIds = SENSOR_IDS(reactifySearchContext.options.mode, reactifySearchContext.config);\n\n return (\n <CustomComponent\n componentId=\"SensorSuggestions\"\n defaultQuery={() => {\n return {\n suggest: {\n suggestions: {\n text: searchTerm,\n phrase: {\n field: props.field,\n gram_size: 2,\n confidence: 0,\n direct_generator: [\n {\n field: props.field,\n suggest_mode: \"always\",\n min_word_length: 1,\n },\n ],\n },\n },\n },\n };\n }}\n react={{\n and: sensorIds,\n }}\n render={(renderProps) => {\n const props: React.ComponentProps<NonNullable<SuggestionsProps[\"render\"]>> = {\n suggestions: [],\n };\n\n if (renderProps.rawData?.suggest?.suggestions.length) {\n const options =\n renderProps.rawData.suggest.suggestions[renderProps.rawData.suggest.suggestions.length - 1]?.options;\n props.suggestions = (options as Array<{ text: string; freq: number }>)\n .filter((option) => option.text !== searchTerm)\n .filter((option) => !(reactifySearchContext.config.suggestions.exclude ?? []).includes(option.text))\n .map((option) => ({\n text: option.text,\n }));\n }\n\n return <RenderComponent {...props} />;\n }}\n />\n );\n};\n"]}
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.UtilityAuthenticatedReactiveBase = void 0;
|
|
7
|
-
const
|
|
8
|
-
const hooks_1 = require("../../hooks");
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
8
|
const ReactiveBase_1 = __importDefault(require("@usereactify/search-internals/lib/components/basic/ReactiveBase"));
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
10
|
const UtilityAuthenticatedReactiveBase = (props) => {
|
|
11
11
|
const reactiveBaseProps = (0, hooks_1.useReactiveBaseProps)();
|
|
12
|
-
return
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(ReactiveBase_1.default, Object.assign({}, reactiveBaseProps, { children: props.children }));
|
|
13
13
|
};
|
|
14
14
|
exports.UtilityAuthenticatedReactiveBase = UtilityAuthenticatedReactiveBase;
|
|
15
15
|
//# sourceMappingURL=UtilityAuthenticatedReactiveBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityAuthenticatedReactiveBase.js","sourceRoot":"","sources":["../../../../src/components/Utility/UtilityAuthenticatedReactiveBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UtilityAuthenticatedReactiveBase.js","sourceRoot":"","sources":["../../../../src/components/Utility/UtilityAuthenticatedReactiveBase.tsx"],"names":[],"mappings":";;;;;;;AACA,mHAA2F;AAC3F,uCAAmD;AAO5C,MAAM,gCAAgC,GAAoD,CAAC,KAAK,EAAE,EAAE;IACzG,MAAM,iBAAiB,GAAG,IAAA,4BAAoB,GAAE,CAAC;IAEjD,OAAO,uBAAC,sBAAY,oBAAK,iBAAiB,cAAG,KAAK,CAAC,QAAQ,IAAgB,CAAC;AAC9E,CAAC,CAAC;AAJW,QAAA,gCAAgC,oCAI3C","sourcesContent":["import type React from \"react\";\nimport ReactiveBase from \"@usereactify/search-internals/lib/components/basic/ReactiveBase\";\nimport { useReactiveBaseProps } from \"../../hooks\";\n\nexport type UtilityAuthenticatedReactiveBaseProps = {\n /** Standard react children */\n children?: React.ReactNode | undefined;\n};\n\nexport const UtilityAuthenticatedReactiveBase: React.FC<UtilityAuthenticatedReactiveBaseProps> = (props) => {\n const reactiveBaseProps = useReactiveBaseProps();\n\n return <ReactiveBase {...reactiveBaseProps}>{props.children}</ReactiveBase>;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Utility/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAmD","sourcesContent":["export * from \"./UtilityAuthenticatedReactiveBase\"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Utility/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAmD","sourcesContent":["export * from \"./UtilityAuthenticatedReactiveBase\";\n"]}
|
|
@@ -14,9 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Example"), exports);
|
|
18
|
-
__exportStar(require("./CustomComponent"), exports);
|
|
19
17
|
__exportStar(require("./ClearAll"), exports);
|
|
18
|
+
__exportStar(require("./CustomComponent"), exports);
|
|
19
|
+
__exportStar(require("./Example"), exports);
|
|
20
20
|
__exportStar(require("./Filter"), exports);
|
|
21
21
|
__exportStar(require("./ReactifySearchProvider"), exports);
|
|
22
22
|
__exportStar(require("./Result"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,oDAAkC;AAClC,4CAA0B;AAC1B,2CAAyB;AACzB,2DAAyC;AACzC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,gDAA8B;AAC9B,4CAA0B","sourcesContent":["export * from \"./ClearAll\";\nexport * from \"./CustomComponent\";\nexport * from \"./Example\";\nexport * from \"./Filter\";\nexport * from \"./ReactifySearchProvider\";\nexport * from \"./Result\";\nexport * from \"./Search\";\nexport * from \"./Sensor\";\nexport * from \"./SortBy\";\nexport * from \"./Stats\";\nexport * from \"./Suggestions\";\nexport * from \"./Utility\";\n"]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export * from "./reactivesearch";
|
|
2
|
-
export * from "./useDebugger";
|
|
3
|
-
export * from "./useSortBy";
|
|
4
|
-
export * from "./usePagination";
|
|
5
|
-
export * from "./usePaginationLoadable";
|
|
6
|
-
export * from "./useSearch";
|
|
7
|
-
export * from "./useCuration";
|
|
8
2
|
export * from "./useAnalytics";
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
3
|
+
export * from "./useConfig";
|
|
4
|
+
export * from "./useCuration";
|
|
5
|
+
export * from "./useDebugger";
|
|
6
|
+
export * from "./useFilterCollapsedState";
|
|
11
7
|
export * from "./useFilterListProps";
|
|
12
8
|
export * from "./useFilterRangeProps";
|
|
13
9
|
export * from "./useFilterSliderProps";
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
10
|
+
export * from "./useFilters";
|
|
11
|
+
export * from "./useIndices";
|
|
12
|
+
export * from "./usePagination";
|
|
13
|
+
export * from "./usePaginationLoadable";
|
|
14
|
+
export * from "./useProductPrice";
|
|
16
15
|
export * from "./useReactifySearchContext";
|
|
17
16
|
export * from "./useResults";
|
|
18
|
-
export * from "./
|
|
17
|
+
export * from "./useSearch";
|
|
18
|
+
export * from "./useSortBy";
|
package/dist/src/hooks/index.js
CHANGED
|
@@ -15,21 +15,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./reactivesearch"), exports);
|
|
18
|
-
__exportStar(require("./useDebugger"), exports);
|
|
19
|
-
__exportStar(require("./useSortBy"), exports);
|
|
20
|
-
__exportStar(require("./usePagination"), exports);
|
|
21
|
-
__exportStar(require("./usePaginationLoadable"), exports);
|
|
22
|
-
__exportStar(require("./useSearch"), exports);
|
|
23
|
-
__exportStar(require("./useCuration"), exports);
|
|
24
18
|
__exportStar(require("./useAnalytics"), exports);
|
|
25
|
-
__exportStar(require("./
|
|
26
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./useConfig"), exports);
|
|
20
|
+
__exportStar(require("./useCuration"), exports);
|
|
21
|
+
__exportStar(require("./useDebugger"), exports);
|
|
22
|
+
__exportStar(require("./useFilterCollapsedState"), exports);
|
|
27
23
|
__exportStar(require("./useFilterListProps"), exports);
|
|
28
24
|
__exportStar(require("./useFilterRangeProps"), exports);
|
|
29
25
|
__exportStar(require("./useFilterSliderProps"), exports);
|
|
30
|
-
__exportStar(require("./
|
|
31
|
-
__exportStar(require("./
|
|
26
|
+
__exportStar(require("./useFilters"), exports);
|
|
27
|
+
__exportStar(require("./useIndices"), exports);
|
|
28
|
+
__exportStar(require("./usePagination"), exports);
|
|
29
|
+
__exportStar(require("./usePaginationLoadable"), exports);
|
|
30
|
+
__exportStar(require("./useProductPrice"), exports);
|
|
32
31
|
__exportStar(require("./useReactifySearchContext"), exports);
|
|
33
32
|
__exportStar(require("./useResults"), exports);
|
|
34
|
-
__exportStar(require("./
|
|
33
|
+
__exportStar(require("./useSearch"), exports);
|
|
34
|
+
__exportStar(require("./useSortBy"), exports);
|
|
35
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,iDAA+B;AAC/B,8CAA4B;AAC5B,gDAA8B;AAC9B,gDAA8B;AAC9B,4DAA0C;AAC1C,uDAAqC;AACrC,wDAAsC;AACtC,yDAAuC;AACvC,+CAA6B;AAC7B,+CAA6B;AAC7B,kDAAgC;AAChC,0DAAwC;AACxC,oDAAkC;AAClC,6DAA2C;AAC3C,+CAA6B;AAC7B,8CAA4B;AAC5B,8CAA4B","sourcesContent":["export * from \"./reactivesearch\";\nexport * from \"./useAnalytics\";\nexport * from \"./useConfig\";\nexport * from \"./useCuration\";\nexport * from \"./useDebugger\";\nexport * from \"./useFilterCollapsedState\";\nexport * from \"./useFilterListProps\";\nexport * from \"./useFilterRangeProps\";\nexport * from \"./useFilterSliderProps\";\nexport * from \"./useFilters\";\nexport * from \"./useIndices\";\nexport * from \"./usePagination\";\nexport * from \"./usePaginationLoadable\";\nexport * from \"./useProductPrice\";\nexport * from \"./useReactifySearchContext\";\nexport * from \"./useResults\";\nexport * from \"./useSearch\";\nexport * from \"./useSortBy\";\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import type ReactSlider from "react-slider";
|
|
3
|
+
import type { ConfigFilterFacet } from "../../types";
|
|
4
4
|
export declare const useReactSliderProps: (filter: ConfigFilterFacet, filterValue: [number, number] | [], filterRange: [number, number], handleChange: (value: [number, number]) => void) => Pick<React.ComponentProps<typeof ReactSlider>, "value" | "defaultValue" | "min" | "max" | "step" | "pearling" | "minDistance" | "onChange">;
|
|
@@ -9,22 +9,22 @@ const useReactSliderProps = (filter, filterValue, filterRange, handleChange) =>
|
|
|
9
9
|
const reactSliderProps = react_1.default.useMemo(() => {
|
|
10
10
|
var _a;
|
|
11
11
|
const filterValueParsed = [
|
|
12
|
-
parseInt((filterValue[0] ? filterValue[0] : filterRange[0]).toFixed(0)),
|
|
13
|
-
parseInt((filterValue[1] ? filterValue[1] : filterRange[1]).toFixed(0)),
|
|
12
|
+
parseInt((filterValue[0] ? filterValue[0] : filterRange[0]).toFixed(0), 10),
|
|
13
|
+
parseInt((filterValue[1] ? filterValue[1] : filterRange[1]).toFixed(0), 10),
|
|
14
14
|
];
|
|
15
15
|
const filterRangeParsed = [
|
|
16
|
-
parseInt(filterRange[0].toFixed(0)),
|
|
17
|
-
parseInt(filterRange[1].toFixed(0)),
|
|
16
|
+
parseInt(filterRange[0].toFixed(0), 10),
|
|
17
|
+
parseInt(filterRange[1].toFixed(0), 10),
|
|
18
18
|
];
|
|
19
19
|
return {
|
|
20
20
|
value: filterValueParsed,
|
|
21
21
|
defaultValue: [filterRangeParsed[0], filterRangeParsed[1]],
|
|
22
22
|
min: filterRangeParsed[0],
|
|
23
23
|
max: filterRangeParsed[1],
|
|
24
|
-
step: parseInt((_a = filter.displaySliderStep) !== null && _a !== void 0 ? _a : "5"),
|
|
24
|
+
step: parseInt((_a = filter.displaySliderStep) !== null && _a !== void 0 ? _a : "5", 10),
|
|
25
25
|
pearling: true,
|
|
26
26
|
minDistance: 0,
|
|
27
|
-
onChange: (value) => Array.isArray(value) ? handleChange([value[0], value[1]]) : {},
|
|
27
|
+
onChange: (value) => (Array.isArray(value) ? handleChange([value[0], value[1]]) : {}),
|
|
28
28
|
};
|
|
29
29
|
}, [filter.displaySliderStep, filterValue, filterRange, handleChange]);
|
|
30
30
|
return reactSliderProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactSliderProps.js","sourceRoot":"","sources":["../../../../src/hooks/react-slider/useReactSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAInB,MAAM,mBAAmB,GAAG,CACjC,MAAyB,EACzB,WAAkC,EAClC,WAA6B,EAC7B,YAA+C,
|
|
1
|
+
{"version":3,"file":"useReactSliderProps.js","sourceRoot":"","sources":["../../../../src/hooks/react-slider/useReactSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAInB,MAAM,mBAAmB,GAAG,CACjC,MAAyB,EACzB,WAAkC,EAClC,WAA6B,EAC7B,YAA+C,EAI/C,EAAE;IACF,MAAM,g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,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACtF,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC,CAAC;IAEvE,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAhCW,QAAA,mBAAmB,uBAgC9B","sourcesContent":["import React from \"react\";\nimport type ReactSlider from \"react-slider\";\nimport type { ConfigFilterFacet } from \"../../types\";\n\nexport const useReactSliderProps = (\n filter: ConfigFilterFacet,\n filterValue: [number, number] | [],\n filterRange: [number, number],\n handleChange: (value: [number, number]) => void\n): Pick<\n React.ComponentProps<typeof ReactSlider>,\n \"value\" | \"defaultValue\" | \"min\" | \"max\" | \"step\" | \"pearling\" | \"minDistance\" | \"onChange\"\n> => {\n const reactSliderProps = React.useMemo<ReturnType<typeof useReactSliderProps>>(() => {\n const filterValueParsed: [number, number] = [\n parseInt((filterValue[0] ? filterValue[0] : filterRange[0]).toFixed(0), 10),\n parseInt((filterValue[1] ? filterValue[1] : filterRange[1]).toFixed(0), 10),\n ];\n const filterRangeParsed: [number, number] = [\n parseInt(filterRange[0].toFixed(0), 10),\n parseInt(filterRange[1].toFixed(0), 10),\n ];\n\n return {\n value: filterValueParsed,\n defaultValue: [filterRangeParsed[0], filterRangeParsed[1]],\n min: filterRangeParsed[0],\n max: filterRangeParsed[1],\n step: parseInt(filter.displaySliderStep ?? \"5\", 10),\n pearling: true,\n minDistance: 0,\n onChange: (value) => (Array.isArray(value) ? handleChange([value[0], value[1]]) : {}),\n };\n }, [filter.displaySliderStep, filterValue, filterRange, handleChange]);\n\n return reactSliderProps;\n};\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReactiveBaseProps } from "@usereactify/search-internals/lib/components/basic/ReactiveBase";
|
|
1
|
+
import type { ReactiveBaseProps } from "@usereactify/search-internals/lib/components/basic/ReactiveBase";
|
|
2
2
|
export declare const replaceDocCountWithParent: (response: any) => any;
|
|
3
3
|
export declare const useReactiveBaseProps: () => ReactiveBaseProps;
|
|
@@ -10,7 +10,7 @@ const props_1 = require("../../utility/props");
|
|
|
10
10
|
const replaceDocCountWithParent = (response) => {
|
|
11
11
|
Object.entries(response)
|
|
12
12
|
.filter(([key]) => key !== "doc_count")
|
|
13
|
-
.forEach(([
|
|
13
|
+
.forEach(([_key, value]) => {
|
|
14
14
|
var _a;
|
|
15
15
|
(_a = value.buckets) === null || _a === void 0 ? void 0 : _a.forEach((bucket) => {
|
|
16
16
|
if (bucket.parent_docs) {
|
|
@@ -33,7 +33,7 @@ const useReactiveBaseProps = () => {
|
|
|
33
33
|
const reactiveBaseProps = react_1.default.useMemo(() => {
|
|
34
34
|
var _a;
|
|
35
35
|
return (Object.assign(Object.assign({}, reactiveBasePropsShared), { initialState: (_a = options.preload) === null || _a === void 0 ? void 0 : _a.state, headers: Object.assign(Object.assign({}, reactiveBasePropsShared.headers), { "x-reactify-ga": (0, hooks_1.getCookie)("_rs_ga") }) }));
|
|
36
|
-
}, [
|
|
36
|
+
}, [(_a = options.preload) === null || _a === void 0 ? void 0 : _a.state, reactiveBasePropsShared]);
|
|
37
37
|
return reactiveBaseProps;
|
|
38
38
|
};
|
|
39
39
|
exports.useReactiveBaseProps = useReactiveBaseProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAkE;AAClE,+CAAmD;AAE5C,MAAM,yBAAyB,GAAG,CAAC,QAAa,EAAE,EAAE;IACzD,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;SACrB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,WAAW,CAAC;SACtC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAgB,EAAE,EAAE;;QACxC,MAAA,KAAK,CAAC,OAAO,0CAAE,OAAO,CAAC,CAAC,MAAW,EAAE,EAAE;YACrC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBACvB,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC;gBAChD,OAAO,MAAM,CAAC,WAAW,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAbW,QAAA,yBAAyB,6BAapC;AAEK,MAAM,oBAAoB,GAAG,GAAsB,EAAE;;IAC1D,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAEvD,MAAM,uBAAuB,GAAG,IAAA,oBAAY,EAAC;QAC3C,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,eAAK,CAAC,OAAO,CACrC,GAAG,EAAE;;QAAC,OAAA,iCACD,uBAAuB,KAC1B,YAAY,EAAE,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,EACpC,OAAO,kCACF,uBAAuB,CAAC,OAAO,KAClC,eAAe,EAAE,IAAA,iBAAS,EAAC,QAAQ,CAAC,OAEtC,CAAA;KAAA,EACF,CAAC,MAAA,OAAO,CAAC,OAAO,0CAAE,KAAK,EAAE,uBAAuB,CAAC,CAClD,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAtBW,QAAA,oBAAoB,wBAsB/B","sourcesContent":["import React from \"react\";\nimport type { ReactiveBaseProps } from \"@usereactify/search-internals/lib/components/basic/ReactiveBase\";\nimport { getCookie, useReactifySearchContext } from \"../../hooks\";\nimport { getPropsBase } from \"../../utility/props\";\n\nexport const replaceDocCountWithParent = (response: any) => {\n Object.entries(response)\n .filter(([key]) => key !== \"doc_count\")\n .forEach(([_key, value]: [string, any]) => {\n value.buckets?.forEach((bucket: any) => {\n if (bucket.parent_docs) {\n bucket.doc_count = bucket.parent_docs.doc_count;\n delete bucket.parent_docs;\n }\n });\n });\n\n return response;\n};\n\nexport const useReactiveBaseProps = (): ReactiveBaseProps => {\n const { options, config } = useReactifySearchContext();\n\n const reactiveBasePropsShared = getPropsBase({\n provider: options,\n config: config,\n query: options.query,\n });\n\n const reactiveBaseProps = React.useMemo<ReactiveBaseProps>(\n () => ({\n ...reactiveBasePropsShared,\n initialState: options.preload?.state,\n headers: {\n ...reactiveBasePropsShared.headers,\n \"x-reactify-ga\": getCookie(\"_rs_ga\"),\n },\n }),\n [options.preload?.state, reactiveBasePropsShared]\n );\n\n return reactiveBaseProps;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAnalytics.js","sourceRoot":"","sources":["../../../src/hooks/useAnalytics.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useAnalytics.js","sourceRoot":"","sources":["../../../src/hooks/useAnalytics.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,8BAeC;AApBD,kDAA0B;AAC1B,sEAAqC;AACrC,oCAAoD;AACpD,wCAAmC;AAEnC,SAAgB,SAAS,CAAC,IAAY;;IACpC,IAAI,CAAC;QACH,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,MAAM,GAAG,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC;QAC1D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO,MAAA,MAAA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C,OAAO;iBACvB;aACF,CAAC;YAEF,MAAM;QAER,KAAK,kBAAkB;YACrB,MAAM,GAAG;gBACP;oBACE,SAAS;oBACT,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB;aACF,CAAC;YAEF,MAAM;QAER,KAAK,YAAY;YACf,MAAM,GAAG;gBACP;oBACE,SAAS;oBACT,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB;aACF,CAAC;YAEF,MAAM;QAER,KAAK,cAAc;YACjB,MAAM,GAAG;gBACP;oBACE,SAAS;oBACT,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB;aACF,CAAC;YAEF,MAAM;IACV,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import axios from \"axios\";\nimport pkg from \"../../package.json\";\nimport { useReactifySearchContext } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nexport function getCookie(name: string): string {\n try {\n if (typeof window === \"undefined\") {\n return \"\";\n }\n\n const cookie = `; ${document.cookie}`.split(`; ${name}=`);\n if (cookie.length === 2) {\n return cookie.pop()?.split(\";\").shift() ?? \"\";\n }\n } catch (error) {\n console.error(error);\n }\n\n return \"\";\n}\n\nexport const useAnalytics = () => {\n const { options, search, curation } = useReactifySearchContext();\n const track = async (event: TrackEvent) => {\n if (!options.shopifyPermanentDomain) {\n console.warn(new Error('Unable to send tracking event, missing value for \"shopifyPermanentDomain\".'));\n\n return;\n }\n\n const attribution: TrackEvent.Attribution = {\n market: options.market,\n curation: curation?.id ?? \"\",\n searchTerm: search.searchTerm ?? \"\",\n collectionHandle: options.mode === \"collection\" ? options.collectionHandle : \"\",\n recommendation: \"\",\n };\n\n debug.log(\"useAnalytics\", \"track\", event, attribution);\n\n const events = getTrackEvents(event);\n return axios.post(\n `https://analytics.usereactify.com/record/`,\n {\n events,\n attribution,\n },\n {\n headers: {\n \"x-reactify-shop\": options.shopifyPermanentDomain,\n \"x-reactify-mode\": options.mode,\n \"x-reactify-client-id\": options.clientId,\n \"x-reactify-client-version\": pkg.version,\n \"x-reactify-ga\": getCookie(\"_rs_ga\"),\n },\n }\n );\n };\n\n return { track };\n};\n\nfunction getTrackEvents(event: TrackEvent): TrackEvent[] {\n const { eventName } = event;\n let events: TrackEvent[] = [];\n\n switch (eventName) {\n case \"search\":\n events = [\n {\n eventName,\n payload: {\n ...event.payload,\n searchTerm: event.payload.searchTerm.trim(),\n },\n },\n ];\n\n break;\n\n case \"zeroResults\":\n events = [\n {\n eventName,\n payload: {\n ...event.payload,\n searchTerm: event.payload.searchTerm.trim(),\n },\n },\n ];\n\n break;\n\n case \"viewProduct\":\n events = [\n {\n eventName,\n payload: event.payload,\n },\n ];\n\n break;\n\n case \"clickProduct\":\n events = [\n {\n eventName,\n payload: event.payload,\n },\n ];\n\n break;\n\n case \"viewPromotion\":\n events = [\n {\n eventName,\n payload: event.payload,\n },\n ];\n\n break;\n\n case \"clickPromotion\":\n events = [\n {\n eventName,\n payload: event.payload,\n },\n ];\n\n break;\n\n case \"paginationChange\":\n events = [\n {\n eventName,\n payload: event.payload,\n },\n ];\n\n break;\n\n case \"sortChange\":\n events = [\n {\n eventName,\n payload: event.payload,\n },\n ];\n\n break;\n\n case \"filterChange\":\n events = [\n {\n eventName,\n payload: event.payload,\n },\n ];\n\n break;\n }\n\n return events;\n}\n\nexport type TrackEvent =\n | TrackEvent.SearchEvent\n | TrackEvent.ZeroResultsEvent\n | TrackEvent.ViewProductEvent\n | TrackEvent.ClickProductEvent\n | TrackEvent.ViewPromotionEvent\n | TrackEvent.ClickPromotionEvent\n | TrackEvent.PaginationChangeEvent\n | TrackEvent.SortChangeEvent\n | TrackEvent.FilterChangeEvent;\n\nexport namespace TrackEvent {\n export interface SearchEvent {\n eventName: \"search\";\n payload: SearchEvent.Payload;\n }\n\n export namespace SearchEvent {\n export interface Payload {\n searchTerm: string;\n }\n }\n\n export interface ZeroResultsEvent {\n eventName: \"zeroResults\";\n payload: ZeroResultsEvent.Payload;\n }\n\n export namespace ZeroResultsEvent {\n export interface Payload {\n searchTerm: string;\n }\n }\n\n export interface ViewProductEvent {\n eventName: \"viewProduct\";\n payload: ViewProductEvent.Payload;\n }\n\n export namespace ViewProductEvent {\n export interface Payload {\n elasticProduct: Product;\n }\n }\n\n export interface ClickProductEvent {\n eventName: \"clickProduct\";\n payload: ClickProductEvent.Payload;\n }\n\n export namespace ClickProductEvent {\n export interface Payload {\n elasticProduct: Product;\n }\n }\n\n export interface ViewPromotionEvent {\n eventName: \"viewPromotion\";\n payload: ViewPromotionEvent.Payload;\n }\n\n export namespace ViewPromotionEvent {\n export interface Payload {\n link: string;\n title: string;\n }\n }\n\n export interface ClickPromotionEvent {\n eventName: \"clickPromotion\";\n payload: ClickPromotionEvent.Payload;\n }\n\n export namespace ClickPromotionEvent {\n export interface Payload {\n link: string;\n title: string;\n }\n }\n\n export interface PaginationChangeEvent {\n eventName: \"paginationChange\";\n payload: PaginationChangeEvent.Payload;\n }\n\n export namespace PaginationChangeEvent {\n export interface Payload {\n page: number;\n source: \"search\" | \"collection\";\n }\n }\n\n export interface SortChangeEvent {\n eventName: \"sortChange\";\n payload: SortChangeEvent.Payload;\n }\n\n export namespace SortChangeEvent {\n export interface Payload {\n type: string;\n }\n }\n\n export interface FilterChangeEvent {\n eventName: \"filterChange\";\n payload: FilterChangeEvent.Payload;\n }\n\n export namespace FilterChangeEvent {\n export interface Payload {\n name: string;\n value: string;\n }\n }\n\n export interface Product {\n id: number;\n title: string;\n }\n export interface Attribution {\n market?: string;\n curation?: string;\n searchTerm?: string;\n collectionHandle?: string;\n recommendation?: string;\n }\n}\n"]}
|
|
@@ -42,7 +42,7 @@ const useConfig = (shopifyPermanentDomain, preloadedConfig, configBaseUrl) => {
|
|
|
42
42
|
try {
|
|
43
43
|
json = yield fetch(url).then((response) => response.json());
|
|
44
44
|
}
|
|
45
|
-
catch (
|
|
45
|
+
catch (_error) {
|
|
46
46
|
json = yield fetch(url).then((response) => response.json());
|
|
47
47
|
}
|
|
48
48
|
setConfig(json.body);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfig.js","sourceRoot":"","sources":["../../../src/hooks/useConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"useConfig.js","sourceRoot":"","sources":["../../../src/hooks/useConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAE1B,wCAAmC;AAE5B,MAAM,SAAS,GAAG,CACvB,sBAA8B,EAC9B,eAAwB,EACxB,aAAsB,EAGtB,EAAE;IACF,2EAA2E;IAC3E,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QACtC,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO;QACT,CAAC;QAED,MAAM,aAAa,GAER,IAAI,CAAC,KAAK,CAAC,MAAA,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,wBAAwB,CAAC,mCAAI,MAAM,CAAC,CAAC;QAEzF,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAA,MAAA,aAAa,CAAC,MAAM,CAAC,KAAK,0CAAE,OAAO,MAAK,KAAK,EAAE,CAAC;gBAClD,OAAO;YACT,CAAC;YAED,OAAO,aAAa,CAAC,MAAM,CAAC;QAC9B,CAAC;QAED,OAAO;IACT,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAqB,YAAY,CAAC,CAAC;IAE7E,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,CAAC,GAAS,EAAE;YACV,MAAM,YAAY,GAAG,IAAI,eAAe,EAAE,CAAC;YAC3C,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;YAEjD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,aAAa,IAAI,iCAAiC,CAAC,CAAC;YACxE,GAAG,CAAC,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;YAErC,IAAI,IAAS,CAAC;YACd,IAAI,CAAC;gBACH,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAC9D,CAAC;YAAC,OAAO,MAAM,EAAE,CAAC;gBAChB,IAAI,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAC9D,CAAC;YAED,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACjG,CAAC,CAAA,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,CAAC,sBAAsB,EAAE,aAAa,CAAC,CAAC,CAAC;IAE5C,eAAK,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE1C,OAAO;QACL,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,eAAe;KAClC,CAAC;AACJ,CAAC,CAAC;AAvDW,QAAA,SAAS,aAuDpB","sourcesContent":["import React from \"react\";\nimport type { Config } from \"../types/config\";\nimport { debug } from \"../utility\";\n\nexport const useConfig = (\n shopifyPermanentDomain: string,\n preloadedConfig?: Config,\n configBaseUrl?: string\n): {\n config: Config | undefined;\n} => {\n // synchronously returns cached and non-expired config from session storage\n const cachedConfig = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const sessionConfig: {\n config: Config;\n } | null = JSON.parse(window.sessionStorage.getItem(\"reactify-search:config\") ?? \"null\");\n\n if (sessionConfig) {\n if (sessionConfig.config.cache?.enabled === false) {\n return;\n }\n\n return sessionConfig.config;\n }\n\n return;\n }, []);\n\n const [config, setConfig] = React.useState<Config | undefined>(cachedConfig);\n\n React.useEffect(() => {\n (async () => {\n const searchParams = new URLSearchParams();\n searchParams.set(\"shop\", shopifyPermanentDomain);\n\n const url = new URL(configBaseUrl || \"https://config.usereactify.com/\");\n url.search = searchParams.toString();\n\n let json: any;\n try {\n json = await fetch(url).then((response) => response.json());\n } catch (_error) {\n json = await fetch(url).then((response) => response.json());\n }\n\n setConfig(json.body);\n window.sessionStorage.setItem(\"reactify-search:config\", JSON.stringify({ config: json.body }));\n })();\n }, [shopifyPermanentDomain, configBaseUrl]);\n\n debug.hook(\"useConfig\", \"config\", config);\n\n return {\n config: config ?? preloadedConfig,\n };\n};\n"]}
|
|
@@ -12,9 +12,7 @@ const useCuration = () => {
|
|
|
12
12
|
const { searchTerm } = (0, hooks_1.useSearch)();
|
|
13
13
|
const curation = react_1.default.useMemo(() => {
|
|
14
14
|
const handleOrSearchTerm = options.mode === "collection" ? options.collectionHandle : searchTerm;
|
|
15
|
-
const normalisedHandleOrSearchTerm = handleOrSearchTerm
|
|
16
|
-
.toLowerCase()
|
|
17
|
-
.trim();
|
|
15
|
+
const normalisedHandleOrSearchTerm = handleOrSearchTerm.toLowerCase().trim();
|
|
18
16
|
const globalCuration = config.curations.find((curation) => {
|
|
19
17
|
if (options.mode === "search") {
|
|
20
18
|
if (options.market) {
|
|
@@ -52,41 +50,27 @@ const useCuration = () => {
|
|
|
52
50
|
const normalisedSearchTerm = (_a = curation.searchTerm) === null || _a === void 0 ? void 0 : _a.toLowerCase().trim();
|
|
53
51
|
const normalisedCollectionHandle = (_b = curation.collectionHandle) === null || _b === void 0 ? void 0 : _b.toLowerCase().trim();
|
|
54
52
|
if ("instant-search" === options.mode) {
|
|
55
|
-
return
|
|
56
|
-
normalisedHandleOrSearchTerm === normalisedSearchTerm);
|
|
53
|
+
return "search" === curation.type && normalisedHandleOrSearchTerm === normalisedSearchTerm;
|
|
57
54
|
}
|
|
58
55
|
if ("search" === options.mode) {
|
|
59
|
-
return
|
|
60
|
-
normalisedHandleOrSearchTerm === normalisedSearchTerm);
|
|
56
|
+
return "search" === curation.type && normalisedHandleOrSearchTerm === normalisedSearchTerm;
|
|
61
57
|
}
|
|
62
58
|
if ("collection" === options.mode) {
|
|
63
|
-
return
|
|
64
|
-
normalisedHandleOrSearchTerm === normalisedCollectionHandle);
|
|
59
|
+
return "collection" === curation.type && normalisedHandleOrSearchTerm === normalisedCollectionHandle;
|
|
65
60
|
}
|
|
66
61
|
return false;
|
|
67
62
|
});
|
|
68
63
|
const addGlobalBoosting = (curation) => {
|
|
69
|
-
if (!globalCuration)
|
|
64
|
+
if (!globalCuration)
|
|
70
65
|
return curation;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
!!curation.boosting.sortings.length;
|
|
74
|
-
if (curationHasRules) {
|
|
66
|
+
const curationHasRules = !!curation.boosting.groupings.length || !!curation.boosting.sortings.length;
|
|
67
|
+
if (curationHasRules)
|
|
75
68
|
return curation;
|
|
76
|
-
}
|
|
77
69
|
const curationWithGlobalBoosting = Object.assign(Object.assign({}, curation), { boosting: globalCuration.boosting });
|
|
78
70
|
return curationWithGlobalBoosting;
|
|
79
71
|
};
|
|
80
|
-
return curation
|
|
81
|
-
|
|
82
|
-
: globalCuration
|
|
83
|
-
? globalCuration
|
|
84
|
-
: undefined;
|
|
85
|
-
}, [
|
|
86
|
-
config,
|
|
87
|
-
options.mode === "collection" ? options.collectionHandle : undefined,
|
|
88
|
-
searchTerm,
|
|
89
|
-
]);
|
|
72
|
+
return curation ? addGlobalBoosting(curation) : globalCuration ? globalCuration : undefined;
|
|
73
|
+
}, [config, searchTerm, options]);
|
|
90
74
|
react_1.default.useEffect(() => {
|
|
91
75
|
utility_1.debug.log("useCuration", "curation", curation);
|
|
92
76
|
}, [curation]);
|