@usereactify/search 5.25.0 → 5.26.1

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.
Files changed (125) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/package.json +11 -10
  3. package/dist/src/components/ClearAll/ClearAll.js +3 -31
  4. package/dist/src/components/ClearAll/ClearAll.js.map +1 -1
  5. package/dist/src/components/Example/ExampleFilterRange.js +1 -3
  6. package/dist/src/components/Example/ExampleFilterRange.js.map +1 -1
  7. package/dist/src/components/Example/ExampleFilterSlider.js +7 -24
  8. package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -1
  9. package/dist/src/components/Example/ExampleFilters.d.ts +3 -1
  10. package/dist/src/components/Example/ExampleFilters.js +4 -8
  11. package/dist/src/components/Example/ExampleFilters.js.map +1 -1
  12. package/dist/src/components/Example/ExampleFiltersSelected.js +10 -24
  13. package/dist/src/components/Example/ExampleFiltersSelected.js.map +1 -1
  14. package/dist/src/components/Example/index.d.ts +0 -3
  15. package/dist/src/components/Example/index.js +0 -3
  16. package/dist/src/components/Example/index.js.map +1 -1
  17. package/dist/src/components/Filter/Filter.d.ts +2 -2
  18. package/dist/src/components/Filter/Filter.js +18 -91
  19. package/dist/src/components/Filter/Filter.js.map +1 -1
  20. package/dist/src/components/Filter/Filters.d.ts +3 -17
  21. package/dist/src/components/Filter/Filters.js +2 -1
  22. package/dist/src/components/Filter/Filters.js.map +1 -1
  23. package/dist/src/components/Filter/FiltersSelected.d.ts +2 -7
  24. package/dist/src/components/Filter/FiltersSelected.js +2 -45
  25. package/dist/src/components/Filter/FiltersSelected.js.map +1 -1
  26. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.d.ts +7 -5
  27. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js +24 -42
  28. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -1
  29. package/dist/src/components/Result/Results.js +9 -24
  30. package/dist/src/components/Result/Results.js.map +1 -1
  31. package/dist/src/components/Sensor/SensorCollection.js +0 -4
  32. package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
  33. package/dist/src/components/Sensor/SensorInventoryAvailable.js +1 -6
  34. package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -1
  35. package/dist/src/components/Sensor/SensorPublished.js +6 -13
  36. package/dist/src/components/Sensor/SensorPublished.js.map +1 -1
  37. package/dist/src/components/Sensor/SensorSearchTerm.js +66 -78
  38. package/dist/src/components/Sensor/SensorSearchTerm.js.map +1 -1
  39. package/dist/src/components/Sensor/SensorSort.js +65 -75
  40. package/dist/src/components/Sensor/SensorSort.js.map +1 -1
  41. package/dist/src/components/Sensor/SensorSortScore.d.ts +2 -0
  42. package/dist/src/components/Sensor/SensorSortScore.js +13 -0
  43. package/dist/src/components/Sensor/SensorSortScore.js.map +1 -0
  44. package/dist/src/components/Sensor/index.d.ts +1 -0
  45. package/dist/src/components/Sensor/index.js +2 -0
  46. package/dist/src/components/Sensor/index.js.map +1 -1
  47. package/dist/src/components/index.d.ts +0 -1
  48. package/dist/src/components/index.js +0 -1
  49. package/dist/src/components/index.js.map +1 -1
  50. package/dist/src/hooks/index.d.ts +0 -3
  51. package/dist/src/hooks/index.js +0 -3
  52. package/dist/src/hooks/index.js.map +1 -1
  53. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.d.ts +7 -2
  54. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +3 -10
  55. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
  56. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +27 -0
  57. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +71 -0
  58. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js.map +1 -0
  59. package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.d.ts +0 -1
  60. package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +5 -3
  61. package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js.map +1 -1
  62. package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.d.ts +0 -1
  63. package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +5 -3
  64. package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js.map +1 -1
  65. package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +1 -1
  66. package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js.map +1 -1
  67. package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +3 -1
  68. package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js.map +1 -1
  69. package/dist/src/hooks/reactivesearch/useReactiveReactProp.d.ts +1 -2
  70. package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +3 -8
  71. package/dist/src/hooks/reactivesearch/useReactiveReactProp.js.map +1 -1
  72. package/dist/src/hooks/useAnalytics.js +3 -23
  73. package/dist/src/hooks/useAnalytics.js.map +1 -1
  74. package/dist/src/hooks/useConfig.js +27 -9
  75. package/dist/src/hooks/useConfig.js.map +1 -1
  76. package/dist/src/hooks/useCuration.js +1 -12
  77. package/dist/src/hooks/useCuration.js.map +1 -1
  78. package/dist/src/hooks/useFilterListProps.js +2 -15
  79. package/dist/src/hooks/useFilterListProps.js.map +1 -1
  80. package/dist/src/hooks/useFilterRangeProps.d.ts +10 -1
  81. package/dist/src/hooks/useFilterRangeProps.js +47 -36
  82. package/dist/src/hooks/useFilterRangeProps.js.map +1 -1
  83. package/dist/src/hooks/useFilterSliderProps.d.ts +8 -6
  84. package/dist/src/hooks/useFilterSliderProps.js +10 -31
  85. package/dist/src/hooks/useFilterSliderProps.js.map +1 -1
  86. package/dist/src/hooks/usePaginationLoadMore.d.ts +15 -0
  87. package/dist/src/hooks/usePaginationLoadMore.js +38 -0
  88. package/dist/src/hooks/usePaginationLoadMore.js.map +1 -0
  89. package/dist/src/hooks/useReactifySearchContext.d.ts +11 -19
  90. package/dist/src/hooks/useReactifySearchContext.js.map +1 -1
  91. package/dist/src/hooks/useSearch.js +2 -4
  92. package/dist/src/hooks/useSearch.js.map +1 -1
  93. package/dist/src/types/config.d.ts +5 -11
  94. package/dist/src/types/config.js.map +1 -1
  95. package/dist/src/types/elastic.d.ts +17 -53
  96. package/dist/src/types/elastic.js.map +1 -1
  97. package/dist/src/types/firestore.d.ts +0 -3
  98. package/dist/src/types/firestore.js.map +1 -1
  99. package/dist/src/types/reactivesearch.d.ts +1 -1
  100. package/dist/src/types/reactivesearch.js.map +1 -1
  101. package/package.json +1 -1
  102. package/dist/src/components/Example/ExampleHookUseResults.d.ts +0 -2
  103. package/dist/src/components/Example/ExampleHookUseResults.js +0 -25
  104. package/dist/src/components/Example/ExampleHookUseResults.js.map +0 -1
  105. package/dist/src/components/Example/ExampleSuggestions.d.ts +0 -4
  106. package/dist/src/components/Example/ExampleSuggestions.js +0 -16
  107. package/dist/src/components/Example/ExampleSuggestions.js.map +0 -1
  108. package/dist/src/components/Suggestions/Suggestions.d.ts +0 -12
  109. package/dist/src/components/Suggestions/Suggestions.js +0 -44
  110. package/dist/src/components/Suggestions/Suggestions.js.map +0 -1
  111. package/dist/src/components/Suggestions/index.d.ts +0 -1
  112. package/dist/src/components/Suggestions/index.js +0 -14
  113. package/dist/src/components/Suggestions/index.js.map +0 -1
  114. package/dist/src/hooks/react-slider/useReactSliderProps.d.ts +0 -4
  115. package/dist/src/hooks/react-slider/useReactSliderProps.js +0 -28
  116. package/dist/src/hooks/react-slider/useReactSliderProps.js.map +0 -1
  117. package/dist/src/hooks/useFlags.d.ts +0 -17
  118. package/dist/src/hooks/useFlags.js +0 -45
  119. package/dist/src/hooks/useFlags.js.map +0 -1
  120. package/dist/src/hooks/useIndices.d.ts +0 -5
  121. package/dist/src/hooks/useIndices.js +0 -49
  122. package/dist/src/hooks/useIndices.js.map +0 -1
  123. package/dist/src/hooks/useResults.d.ts +0 -21
  124. package/dist/src/hooks/useResults.js +0 -19
  125. package/dist/src/hooks/useResults.js.map +0 -1
@@ -1,5 +0,0 @@
1
- export declare type UseIndices = {
2
- indices: Array<string>;
3
- indexNameFormat: (indexName: string) => string;
4
- };
5
- export declare const useIndices: () => UseIndices;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.useIndices = void 0;
16
- const react_1 = __importDefault(require("react"));
17
- const useReactifySearchContext_1 = require("./useReactifySearchContext");
18
- const useIndices = () => {
19
- const { config, options } = (0, useReactifySearchContext_1.useReactifySearchContext)();
20
- const shopName = options.shopifyPermanentDomain.replace(".myshopify.com", "");
21
- const [indices, setIndices] = react_1.default.useState([]);
22
- const indexNameFormat = (indexName) => {
23
- let indexNameFormatted = indexName;
24
- try {
25
- const indexDate = indexName.split(`${shopName}-`)[1];
26
- indexNameFormatted = `${shopName} ${new Date(parseInt(indexDate)).toLocaleString()} (${indexDate})`;
27
- }
28
- catch (error) {
29
- console.error(error);
30
- }
31
- return indexNameFormatted;
32
- };
33
- react_1.default.useEffect(() => {
34
- (() => __awaiter(void 0, void 0, void 0, function* () {
35
- const response = yield fetch(`https://${config.endpoint}/_cat/indices?format=json`).then((response) => response.json());
36
- const regexp = new RegExp(`${shopName}-[0-9]`);
37
- setIndices(response
38
- .map((item) => item.index)
39
- .filter((item) => regexp.test(item))
40
- .sort((a, b) => (a > b ? -1 : 1)));
41
- }))();
42
- }, [config.endpoint]);
43
- return {
44
- indices: indices,
45
- indexNameFormat: indexNameFormat,
46
- };
47
- };
48
- exports.useIndices = useIndices;
49
- //# sourceMappingURL=useIndices.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useIndices.js","sourceRoot":"","sources":["../../../src/hooks/useIndices.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,yEAAsE;AAO/D,MAAM,UAAU,GAAG,GAAe,EAAE;IACzC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,mDAAwB,GAAE,CAAC;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,sBAAsB,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAE9E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAwB,EAAE,CAAC,CAAC;IAExE,MAAM,eAAe,GAAkC,CAAC,SAAS,EAAE,EAAE;QACnE,IAAI,kBAAkB,GAAG,SAAS,CAAC;QACnC,IAAI;YACF,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAErD,kBAAkB,GAAG,GAAG,QAAQ,IAAI,IAAI,IAAI,CAC1C,QAAQ,CAAC,SAAS,CAAC,CACpB,CAAC,cAAc,EAAE,KAAK,SAAS,GAAG,CAAC;SACrC;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACtB;QAED,OAAO,kBAAkB,CAAC;IAC5B,CAAC,CAAC;IAEF,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,CAAC,GAAS,EAAE;YACV,MAAM,QAAQ,GAA6B,MAAM,KAAK,CACpD,WAAW,MAAM,CAAC,QAAQ,2BAA2B,CACtD,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;YAEtC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,GAAG,QAAQ,QAAQ,CAAC,CAAC;YAE/C,UAAU,CACR,QAAQ;iBACL,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;iBACzB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACnC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACpC,CAAC;QACJ,CAAC,CAAA,CAAC,EAAE,CAAC;IACP,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEtB,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,eAAe,EAAE,eAAe;KACjC,CAAC;AACJ,CAAC,CAAC;AA1CW,QAAA,UAAU,cA0CrB","sourcesContent":["import React from \"react\";\nimport { useReactifySearchContext } from \"./useReactifySearchContext\";\n\nexport type UseIndices = {\n indices: Array<string>;\n indexNameFormat: (indexName: string) => string;\n};\n\nexport const useIndices = (): UseIndices => {\n const { config, options } = useReactifySearchContext();\n const shopName = options.shopifyPermanentDomain.replace(\".myshopify.com\", \"\");\n\n const [indices, setIndices] = React.useState<UseIndices[\"indices\"]>([]);\n\n const indexNameFormat: UseIndices[\"indexNameFormat\"] = (indexName) => {\n let indexNameFormatted = indexName;\n try {\n const indexDate = indexName.split(`${shopName}-`)[1];\n\n indexNameFormatted = `${shopName} ${new Date(\n parseInt(indexDate)\n ).toLocaleString()} (${indexDate})`;\n } catch (error) {\n console.error(error);\n }\n\n return indexNameFormatted;\n };\n\n React.useEffect(() => {\n (async () => {\n const response: Array<{ index: string }> = await fetch(\n `https://${config.endpoint}/_cat/indices?format=json`\n ).then((response) => response.json());\n\n const regexp = new RegExp(`${shopName}-[0-9]`);\n\n setIndices(\n response\n .map((item) => item.index)\n .filter((item) => regexp.test(item))\n .sort((a, b) => (a > b ? -1 : 1))\n );\n })();\n }, [config.endpoint]);\n\n return {\n indices: indices,\n indexNameFormat: indexNameFormat,\n };\n};\n"]}
@@ -1,21 +0,0 @@
1
- import React from "react";
2
- import { ReactivesearchResultProps } from "../types";
3
- /** This hook must never be used to render results */
4
- export declare const useResults: () => {
5
- /** All of the current results */
6
- results: ReactivesearchResultProps["data"];
7
- /** Function for setting the current results */
8
- setResults: React.Dispatch<React.SetStateAction<ReactivesearchResultProps["data"]>>;
9
- /** All of the current result stats */
10
- resultStats?: {
11
- time: number;
12
- hidden: number;
13
- promoted: number;
14
- currentPage: number;
15
- numberOfPages: number;
16
- numberOfResults?: number | undefined;
17
- displayedResults: number;
18
- } | undefined;
19
- /** Function for setting the current result stats */
20
- setResultStats: React.Dispatch<React.SetStateAction<ReactivesearchResultProps["resultStats"] | undefined>>;
21
- };
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useResults = void 0;
4
- const hooks_1 = require("../hooks");
5
- const utility_1 = require("../utility");
6
- /** This hook must never be used to render results */
7
- const useResults = () => {
8
- const { results } = (0, hooks_1.useReactifySearchContext)();
9
- utility_1.debug.hook("useResults", "results", results.results);
10
- utility_1.debug.hook("useResults", "resultStats", results.resultStats);
11
- return {
12
- results: results.results,
13
- setResults: results.setResults,
14
- resultStats: results.resultStats,
15
- setResultStats: results.setResultStats,
16
- };
17
- };
18
- exports.useResults = useResults;
19
- //# sourceMappingURL=useResults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useResults.js","sourceRoot":"","sources":["../../../src/hooks/useResults.ts"],"names":[],"mappings":";;;AAGA,oCAAoD;AACpD,wCAAmC;AAEnC,qDAAqD;AAC9C,MAAM,UAAU,GAAG,GAaxB,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,eAAK,CAAC,IAAI,CAAC,YAAY,EAAE,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAE7D,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC;AACJ,CAAC,CAAC;AAzBW,QAAA,UAAU,cAyBrB","sourcesContent":["import React from \"react\";\n\nimport { ReactivesearchResultProps } from \"../types\";\nimport { useReactifySearchContext } from \"../hooks\";\nimport { debug } from \"../utility\";\n\n/** This hook must never be used to render results */\nexport const useResults = (): {\n /** All of the current results */\n results: ReactivesearchResultProps[\"data\"];\n /** Function for setting the current results */\n setResults: React.Dispatch<\n React.SetStateAction<ReactivesearchResultProps[\"data\"]>\n >;\n /** All of the current result stats */\n resultStats?: ReactivesearchResultProps[\"resultStats\"];\n /** Function for setting the current result stats */\n setResultStats: React.Dispatch<\n React.SetStateAction<ReactivesearchResultProps[\"resultStats\"] | undefined>\n >;\n} => {\n const { results } = useReactifySearchContext();\n\n debug.hook(\"useResults\", \"results\", results.results);\n debug.hook(\"useResults\", \"resultStats\", results.resultStats);\n\n return {\n results: results.results,\n setResults: results.setResults,\n resultStats: results.resultStats,\n setResultStats: results.setResultStats,\n };\n};\n"]}