@usereactify/search 5.0.0-beta.10 → 5.0.0-beta.13

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 (127) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +3 -21
  3. package/dist/package.json +1 -1
  4. package/dist/src/components/Example/ExampleFilterList.js +1 -1
  5. package/dist/src/components/Example/ExampleFilterList.js.map +1 -1
  6. package/dist/src/components/Example/ExampleFilterRange.js +1 -1
  7. package/dist/src/components/Example/ExampleFilterRange.js.map +1 -1
  8. package/dist/src/components/Example/ExampleFilterSlider.js +1 -1
  9. package/dist/src/components/Example/ExampleFilterSlider.js.map +1 -1
  10. package/dist/src/components/Example/ExampleFilters.d.ts +4 -0
  11. package/dist/src/components/Example/{ExampleFilterStack.js → ExampleFilters.js} +6 -5
  12. package/dist/src/components/Example/ExampleFilters.js.map +1 -0
  13. package/dist/src/components/Example/ExampleResultCardCallout.js +1 -1
  14. package/dist/src/components/Example/ExampleResultCardCallout.js.map +1 -1
  15. package/dist/src/components/Example/ExampleResultCardProduct.js +1 -1
  16. package/dist/src/components/Example/ExampleResultCardProduct.js.map +1 -1
  17. package/dist/src/components/Example/ExampleSortBy.d.ts +4 -0
  18. package/dist/src/components/Example/{ExampleSortby.js → ExampleSortBy.js} +4 -4
  19. package/dist/src/components/Example/{ExampleSortby.js.map → ExampleSortBy.js.map} +1 -1
  20. package/dist/src/components/Example/index.d.ts +2 -2
  21. package/dist/src/components/Example/index.js +2 -2
  22. package/dist/src/components/Example/index.js.map +1 -1
  23. package/dist/src/components/Filter/Filter.js +7 -19
  24. package/dist/src/components/Filter/Filter.js.map +1 -1
  25. package/dist/src/components/Filter/{FilterStack.d.ts → Filters.d.ts} +2 -2
  26. package/dist/src/components/Filter/{FilterStack.js → Filters.js} +7 -7
  27. package/dist/src/components/Filter/Filters.js.map +1 -0
  28. package/dist/src/components/Filter/index.d.ts +1 -1
  29. package/dist/src/components/Filter/index.js +1 -1
  30. package/dist/src/components/Filter/index.js.map +1 -1
  31. package/dist/src/components/{ReactifySearchBase/ReactifySearchBase.d.ts → ReactifySearchProvider/ReactifySearchProvider.d.ts} +5 -9
  32. package/dist/src/components/{ReactifySearchBase/ReactifySearchBase.js → ReactifySearchProvider/ReactifySearchProvider.js} +24 -20
  33. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -0
  34. package/dist/src/components/ReactifySearchProvider/index.d.ts +1 -0
  35. package/dist/src/components/{ReactifySearchBase → ReactifySearchProvider}/index.js +1 -1
  36. package/dist/src/components/ReactifySearchProvider/index.js.map +1 -0
  37. package/dist/src/components/Result/{ResultStack.d.ts → Results.d.ts} +2 -2
  38. package/dist/src/components/Result/{ResultStack.js → Results.js} +44 -27
  39. package/dist/src/components/Result/Results.js.map +1 -0
  40. package/dist/src/components/Result/index.d.ts +1 -1
  41. package/dist/src/components/Result/index.js +1 -1
  42. package/dist/src/components/Result/index.js.map +1 -1
  43. package/dist/src/components/Sensor/SensorCollection.js +2 -2
  44. package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
  45. package/dist/src/components/Sensor/SensorInventoryAvailable.js +1 -1
  46. package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -1
  47. package/dist/src/components/Sensor/SensorSort.js +13 -13
  48. package/dist/src/components/Sensor/SensorSort.js.map +1 -1
  49. package/dist/src/components/Sensor/Sensors.d.ts +3 -0
  50. package/dist/src/components/Sensor/{SensorStack.js → Sensors.js} +4 -4
  51. package/dist/src/components/Sensor/Sensors.js.map +1 -0
  52. package/dist/src/components/Sensor/index.d.ts +1 -1
  53. package/dist/src/components/Sensor/index.js +1 -1
  54. package/dist/src/components/Sensor/index.js.map +1 -1
  55. package/dist/src/components/SortBy/SortBy.d.ts +7 -0
  56. package/dist/src/components/{Sortby/Sortby.js → SortBy/SortBy.js} +7 -7
  57. package/dist/src/components/SortBy/SortBy.js.map +1 -0
  58. package/dist/src/components/SortBy/index.d.ts +1 -0
  59. package/dist/src/components/{Sortby → SortBy}/index.js +1 -1
  60. package/dist/src/components/{Sortby → SortBy}/index.js.map +1 -1
  61. package/dist/src/components/index.d.ts +2 -2
  62. package/dist/src/components/index.js +2 -2
  63. package/dist/src/components/index.js.map +1 -1
  64. package/dist/src/hooks/index.d.ts +2 -3
  65. package/dist/src/hooks/index.js +2 -3
  66. package/dist/src/hooks/index.js.map +1 -1
  67. package/dist/src/hooks/reactivesearch/index.d.ts +3 -3
  68. package/dist/src/hooks/reactivesearch/index.js +3 -3
  69. package/dist/src/hooks/reactivesearch/index.js.map +1 -1
  70. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js +2 -1
  71. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
  72. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.d.ts +1 -1
  73. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js +2 -1
  74. package/dist/src/hooks/reactivesearch/useReactiveDataSearchProps.js.map +1 -1
  75. package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js +2 -1
  76. package/dist/src/hooks/reactivesearch/useReactiveFilterListProps.js.map +1 -1
  77. package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js +2 -1
  78. package/dist/src/hooks/reactivesearch/useReactiveFilterRangeProps.js.map +1 -1
  79. package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js +2 -1
  80. package/dist/src/hooks/reactivesearch/useReactiveFilterSharedProps.js.map +1 -1
  81. package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js +2 -1
  82. package/dist/src/hooks/reactivesearch/useReactiveFilterSliderProps.js.map +1 -1
  83. package/dist/src/hooks/reactivesearch/useReactiveReactProp.js +4 -4
  84. package/dist/src/hooks/reactivesearch/useReactiveReactProp.js.map +1 -1
  85. package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.d.ts +5 -0
  86. package/dist/src/hooks/reactivesearch/{useReactiveResultStackProps.js → useReactiveReactiveListProps.js} +7 -6
  87. package/dist/src/hooks/reactivesearch/useReactiveReactiveListProps.js.map +1 -0
  88. package/dist/src/hooks/useCuration.js +2 -6
  89. package/dist/src/hooks/useCuration.js.map +1 -1
  90. package/dist/src/hooks/useFilterListProps.js +36 -9
  91. package/dist/src/hooks/useFilterListProps.js.map +1 -1
  92. package/dist/src/hooks/useFilters.d.ts +3 -2
  93. package/dist/src/hooks/useFilters.js +45 -11
  94. package/dist/src/hooks/useFilters.js.map +1 -1
  95. package/dist/src/hooks/usePaginationLoadMore.js +1 -1
  96. package/dist/src/hooks/usePaginationLoadMore.js.map +1 -1
  97. package/dist/src/hooks/useReactifySearchContext.d.ts +4 -12
  98. package/dist/src/hooks/useReactifySearchContext.js.map +1 -1
  99. package/dist/src/hooks/useSearch.d.ts +1 -1
  100. package/dist/src/hooks/useSearch.js +25 -5
  101. package/dist/src/hooks/useSearch.js.map +1 -1
  102. package/dist/src/hooks/{useSortby.d.ts → useSortBy.d.ts} +1 -1
  103. package/dist/src/hooks/{useSortby.js → useSortBy.js} +5 -7
  104. package/dist/src/hooks/useSortBy.js.map +1 -0
  105. package/dist/src/utility/debug.d.ts +3 -1
  106. package/dist/src/utility/debug.js +6 -2
  107. package/dist/src/utility/debug.js.map +1 -1
  108. package/package.json +1 -1
  109. package/dist/src/components/Example/ExampleFilterStack.d.ts +0 -4
  110. package/dist/src/components/Example/ExampleFilterStack.js.map +0 -1
  111. package/dist/src/components/Example/ExampleSortby.d.ts +0 -4
  112. package/dist/src/components/Filter/FilterStack.js.map +0 -1
  113. package/dist/src/components/ReactifySearchBase/ReactifySearchBase.js.map +0 -1
  114. package/dist/src/components/ReactifySearchBase/index.d.ts +0 -1
  115. package/dist/src/components/ReactifySearchBase/index.js.map +0 -1
  116. package/dist/src/components/Result/ResultStack.js.map +0 -1
  117. package/dist/src/components/Sensor/SensorStack.d.ts +0 -3
  118. package/dist/src/components/Sensor/SensorStack.js.map +0 -1
  119. package/dist/src/components/Sortby/Sortby.d.ts +0 -7
  120. package/dist/src/components/Sortby/Sortby.js.map +0 -1
  121. package/dist/src/components/Sortby/index.d.ts +0 -1
  122. package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.d.ts +0 -17
  123. package/dist/src/hooks/reactivesearch/useReactiveResultStackProps.js.map +0 -1
  124. package/dist/src/hooks/useFilterStack.d.ts +0 -4
  125. package/dist/src/hooks/useFilterStack.js +0 -52
  126. package/dist/src/hooks/useFilterStack.js.map +0 -1
  127. package/dist/src/hooks/useSortby.js.map +0 -1
@@ -3,15 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Sortby = void 0;
6
+ exports.SortBy = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const hooks_1 = require("../../hooks");
9
9
  const components_1 = require("../../components");
10
- const Sortby = (props) => {
10
+ const SortBy = (props) => {
11
11
  var _a;
12
- const sortbyData = (0, hooks_1.useSortby)();
13
- const RenderSortOptionsComponent = (_a = props.renderSortOptions) !== null && _a !== void 0 ? _a : components_1.ExampleSortby;
14
- return (react_1.default.createElement(RenderSortOptionsComponent, Object.assign({}, sortbyData)));
12
+ const sortbyData = (0, hooks_1.useSortBy)();
13
+ const RenderSortOptionsComponent = (_a = props.renderSortOptions) !== null && _a !== void 0 ? _a : components_1.ExampleSortBy;
14
+ return react_1.default.createElement(RenderSortOptionsComponent, Object.assign({}, sortbyData));
15
15
  };
16
- exports.Sortby = Sortby;
17
- //# sourceMappingURL=Sortby.js.map
16
+ exports.SortBy = SortBy;
17
+ //# sourceMappingURL=SortBy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SortBy.js","sourceRoot":"","sources":["../../../../src/components/SortBy/SortBy.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAwC;AACxC,iDAAiD;AAO1C,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;;IACrD,MAAM,UAAU,GAAG,IAAA,iBAAS,GAAE,CAAC;IAE/B,MAAM,0BAA0B,GAAG,MAAA,KAAK,CAAC,iBAAiB,mCAAI,0BAAa,CAAC;IAE5E,OAAO,8BAAC,0BAA0B,oBAAK,UAAU,EAAI,CAAC;AACxD,CAAC,CAAC;AANW,QAAA,MAAM,UAMjB","sourcesContent":["import React from \"react\";\n\nimport { useSortBy } from \"../../hooks\";\nimport { ExampleSortBy } from \"../../components\";\n\nexport type SortByProps = {\n /** Render method called once for all sort options */\n renderSortOptions?: React.FC<ReturnType<typeof useSortBy>>;\n};\n\nexport const SortBy: React.FC<SortByProps> = (props) => {\n const sortbyData = useSortBy();\n\n const RenderSortOptionsComponent = props.renderSortOptions ?? ExampleSortBy;\n\n return <RenderSortOptionsComponent {...sortbyData} />;\n};\n"]}
@@ -0,0 +1 @@
1
+ export * from "./SortBy";
@@ -10,5 +10,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./Sortby"), exports);
13
+ __exportStar(require("./SortBy"), exports);
14
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Sortby/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB","sourcesContent":["export * from \"./Sortby\";"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/SortBy/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB","sourcesContent":["export * from \"./SortBy\";\n"]}
@@ -1,8 +1,8 @@
1
1
  export * from "./Example";
2
2
  export * from "./Filter";
3
- export * from "./ReactifySearchBase";
3
+ export * from "./ReactifySearchProvider";
4
4
  export * from "./Result";
5
5
  export * from "./Search";
6
6
  export * from "./Sensor";
7
- export * from "./Sortby";
7
+ export * from "./SortBy";
8
8
  export * from "./Utility";
@@ -12,10 +12,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./Example"), exports);
14
14
  __exportStar(require("./Filter"), exports);
15
- __exportStar(require("./ReactifySearchBase"), exports);
15
+ __exportStar(require("./ReactifySearchProvider"), exports);
16
16
  __exportStar(require("./Result"), exports);
17
17
  __exportStar(require("./Search"), exports);
18
18
  __exportStar(require("./Sensor"), exports);
19
- __exportStar(require("./Sortby"), exports);
19
+ __exportStar(require("./SortBy"), exports);
20
20
  __exportStar(require("./Utility"), exports);
21
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,uDAAqC;AACrC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,4CAAyB","sourcesContent":["export * from \"./Example\";\nexport * from \"./Filter\";\nexport * from \"./ReactifySearchBase\";\nexport * from \"./Result\";\nexport * from \"./Search\";\nexport * from \"./Sensor\";\nexport * from \"./Sortby\";\nexport * from \"./Utility\""]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,2DAAyC;AACzC,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B","sourcesContent":["export * from \"./Example\";\nexport * from \"./Filter\";\nexport * from \"./ReactifySearchProvider\";\nexport * from \"./Result\";\nexport * from \"./Search\";\nexport * from \"./Sensor\";\nexport * from \"./SortBy\";\nexport * from \"./Utility\";\n"]}
@@ -1,13 +1,12 @@
1
1
  export * from "./reactivesearch";
2
2
  export * from "./useDebugger";
3
- export * from "./useSortby";
3
+ export * from "./useSortBy";
4
4
  export * from "./usePagination";
5
5
  export * from "./usePaginationLoadMore";
6
6
  export * from "./useSearch";
7
- export * from "./useFilters";
8
7
  export * from "./useCuration";
9
8
  export * from "./useAnalytics";
10
- export * from "./useFilterStack";
9
+ export * from "./useFilters";
11
10
  export * from "./useProductPrice";
12
11
  export * from "./useFilterListProps";
13
12
  export * from "./useFilterCollapsedState";
@@ -12,14 +12,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./reactivesearch"), exports);
14
14
  __exportStar(require("./useDebugger"), exports);
15
- __exportStar(require("./useSortby"), exports);
15
+ __exportStar(require("./useSortBy"), exports);
16
16
  __exportStar(require("./usePagination"), exports);
17
17
  __exportStar(require("./usePaginationLoadMore"), exports);
18
18
  __exportStar(require("./useSearch"), exports);
19
- __exportStar(require("./useFilters"), exports);
20
19
  __exportStar(require("./useCuration"), exports);
21
20
  __exportStar(require("./useAnalytics"), exports);
22
- __exportStar(require("./useFilterStack"), exports);
21
+ __exportStar(require("./useFilters"), exports);
23
22
  __exportStar(require("./useProductPrice"), exports);
24
23
  __exportStar(require("./useFilterListProps"), exports);
25
24
  __exportStar(require("./useFilterCollapsedState"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AAEjC,gDAA8B;AAC9B,8CAA4B;AAC5B,kDAAgC;AAChC,0DAAwC;AACxC,8CAA4B;AAC5B,+CAA6B;AAC7B,gDAA8B;AAC9B,iDAA+B;AAC/B,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,4DAA0C;AAC1C,8CAA4B;AAC5B,6DAA2C","sourcesContent":["export * from \"./reactivesearch\";\n\nexport * from \"./useDebugger\";\nexport * from \"./useSortby\";\nexport * from \"./usePagination\";\nexport * from \"./usePaginationLoadMore\";\nexport * from \"./useSearch\";\nexport * from \"./useFilters\";\nexport * from \"./useCuration\";\nexport * from \"./useAnalytics\";\nexport * from \"./useFilterStack\";\nexport * from \"./useProductPrice\";\nexport * from \"./useFilterListProps\";\nexport * from \"./useFilterCollapsedState\";\nexport * from \"./useConfig\";\nexport * from \"./useReactifySearchContext\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAiC;AAEjC,gDAA8B;AAC9B,8CAA4B;AAC5B,kDAAgC;AAChC,0DAAwC;AACxC,8CAA4B;AAC5B,gDAA8B;AAC9B,iDAA+B;AAC/B,+CAA6B;AAC7B,oDAAkC;AAClC,uDAAqC;AACrC,4DAA0C;AAC1C,8CAA4B;AAC5B,6DAA2C","sourcesContent":["export * from \"./reactivesearch\";\n\nexport * from \"./useDebugger\";\nexport * from \"./useSortBy\";\nexport * from \"./usePagination\";\nexport * from \"./usePaginationLoadMore\";\nexport * from \"./useSearch\";\nexport * from \"./useCuration\";\nexport * from \"./useAnalytics\";\nexport * from \"./useFilters\";\nexport * from \"./useProductPrice\";\nexport * from \"./useFilterListProps\";\nexport * from \"./useFilterCollapsedState\";\nexport * from \"./useConfig\";\nexport * from \"./useReactifySearchContext\";\n"]}
@@ -1,8 +1,8 @@
1
1
  export * from "./useReactiveBaseProps";
2
- export * from "./useReactiveReactProp";
2
+ export * from "./useReactiveDataSearchProps";
3
3
  export * from "./useReactiveFilterListProps";
4
4
  export * from "./useReactiveFilterRangeProps";
5
5
  export * from "./useReactiveFilterSliderProps";
6
6
  export * from "./useReactiveFilterSharedProps";
7
- export * from "./useReactiveResultStackProps";
8
- export * from "./useReactiveDataSearchProps";
7
+ export * from "./useReactiveReactProp";
8
+ export * from "./useReactiveReactiveListProps";
@@ -11,11 +11,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./useReactiveBaseProps"), exports);
14
- __exportStar(require("./useReactiveReactProp"), exports);
14
+ __exportStar(require("./useReactiveDataSearchProps"), exports);
15
15
  __exportStar(require("./useReactiveFilterListProps"), exports);
16
16
  __exportStar(require("./useReactiveFilterRangeProps"), exports);
17
17
  __exportStar(require("./useReactiveFilterSliderProps"), exports);
18
18
  __exportStar(require("./useReactiveFilterSharedProps"), exports);
19
- __exportStar(require("./useReactiveResultStackProps"), exports);
20
- __exportStar(require("./useReactiveDataSearchProps"), exports);
19
+ __exportStar(require("./useReactiveReactProp"), exports);
20
+ __exportStar(require("./useReactiveReactiveListProps"), exports);
21
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuC;AACvC,yDAAuC;AACvC,+DAA6C;AAC7C,gEAA8C;AAC9C,iEAA+C;AAC/C,iEAA+C;AAC/C,gEAA8C;AAC9C,+DAA6C","sourcesContent":["export * from \"./useReactiveBaseProps\";\nexport * from \"./useReactiveReactProp\";\nexport * from \"./useReactiveFilterListProps\";\nexport * from \"./useReactiveFilterRangeProps\";\nexport * from \"./useReactiveFilterSliderProps\";\nexport * from \"./useReactiveFilterSharedProps\";\nexport * from \"./useReactiveResultStackProps\";\nexport * from \"./useReactiveDataSearchProps\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAAuC;AACvC,+DAA6C;AAC7C,+DAA6C;AAC7C,gEAA8C;AAC9C,iEAA+C;AAC/C,iEAA+C;AAC/C,yDAAuC;AACvC,iEAA+C","sourcesContent":["export * from \"./useReactiveBaseProps\";\nexport * from \"./useReactiveDataSearchProps\";\nexport * from \"./useReactiveFilterListProps\";\nexport * from \"./useReactiveFilterRangeProps\";\nexport * from \"./useReactiveFilterSliderProps\";\nexport * from \"./useReactiveFilterSharedProps\";\nexport * from \"./useReactiveReactProp\";\nexport * from \"./useReactiveReactiveListProps\";\n"]}
@@ -17,7 +17,7 @@ const react_1 = __importDefault(require("react"));
17
17
  const hooks_1 = require("../../hooks");
18
18
  const useReactiveBaseProps = () => {
19
19
  const { options } = (0, hooks_1.useReactifySearchContext)();
20
- return react_1.default.useMemo(() => ({
20
+ const reactiveBaseProps = react_1.default.useMemo(() => ({
21
21
  app: options.index,
22
22
  url: options.credentials.endpoint,
23
23
  credentials: `${options.credentials.username}:${options.credentials.password}`,
@@ -39,6 +39,7 @@ const useReactiveBaseProps = () => {
39
39
  return response;
40
40
  }),
41
41
  }), [options.credentials, options.theme]);
42
+ return reactiveBaseProps;
42
43
  };
43
44
  exports.useReactiveBaseProps = useReactiveBaseProps;
44
45
  //# sourceMappingURL=useReactiveBaseProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uCAAuD;AAEhD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,EAAE,OAAO,CAAC,KAAK;QAClB,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ;QACjC,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;QAC9E,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,iBAAiB,EAAE,CAAO,QAAa,EAAE,EAAE;;YACzC,+EAA+E;YAC/E,uDAAuD;YACvD,EAAE;YACF,qFAAqF;YACrF,qFAAqF;YACrF,kEAAkE;YAClE,EAAE;YACF,0DAA0D;YAC1D,IACE,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,EACpE;gBACA,QAAQ,CAAC,YAAY,CAAC,qBAAqB;oBACzC,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,CAAC;aACxE;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA;KACF,CAAC,EACF,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CACrC,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,oBAAoB,wBA8B/B","sourcesContent":["import React from \"react\";\nimport { useReactifySearchContext } from \"../../hooks\";\n\nexport const useReactiveBaseProps = () => {\n const { options } = useReactifySearchContext();\n\n return React.useMemo(\n () => ({\n app: options.index,\n url: options.credentials.endpoint,\n credentials: `${options.credentials.username}:${options.credentials.password}`,\n theme: options.theme,\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n response.aggregations.reactivesearch_nested =\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer;\n }\n\n return response;\n },\n }),\n [options.credentials, options.theme]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveBaseProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveBaseProps.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,uCAAuD;AAEhD,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAE/C,MAAM,iBAAiB,GAAG,eAAK,CAAC,OAAO,CACrC,GAAG,EAAE,CAAC,CAAC;QACL,GAAG,EAAE,OAAO,CAAC,KAAK;QAClB,GAAG,EAAE,OAAO,CAAC,WAAW,CAAC,QAAQ;QACjC,WAAW,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE;QAC9E,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,iBAAiB,EAAE,CAAO,QAAa,EAAE,EAAE;;YACzC,+EAA+E;YAC/E,uDAAuD;YACvD,EAAE;YACF,qFAAqF;YACrF,qFAAqF;YACrF,kEAAkE;YAClE,EAAE;YACF,0DAA0D;YAC1D,IACE,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,EACpE;gBACA,QAAQ,CAAC,YAAY,CAAC,qBAAqB;oBACzC,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,YAAY,0CAAE,qBAAqB,0CAAE,qBAAqB,CAAC;aACxE;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC,CAAA;KACF,CAAC,EACF,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CACrC,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC,CAAC;AAhCW,QAAA,oBAAoB,wBAgC/B","sourcesContent":["import React from \"react\";\nimport { useReactifySearchContext } from \"../../hooks\";\n\nexport const useReactiveBaseProps = () => {\n const { options } = useReactifySearchContext();\n\n const reactiveBaseProps = React.useMemo(\n () => ({\n app: options.index,\n url: options.credentials.endpoint,\n credentials: `${options.credentials.username}:${options.credentials.password}`,\n theme: options.theme,\n transformResponse: async (response: any) => {\n // support filtering inside nested aggregations by moving the inner aggregation\n // up one level such that reactivesearch understands it\n //\n // see useReactiveFilterListProps > defaultQuery to see how a filter is being applied\n // to variant aggregations to ensure that only in stock sizes are displayed as filter\n // options, this involves a nested filter, which requires this fix\n //\n // https://github.com/appbaseio/reactivesearch/issues/1530\n if (\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer\n ) {\n response.aggregations.reactivesearch_nested =\n response?.aggregations?.reactivesearch_nested?.reactify_nested_outer;\n }\n\n return response;\n },\n }),\n [options.credentials, options.theme]\n );\n\n return reactiveBaseProps;\n};\n"]}
@@ -9,7 +9,7 @@ export declare const useReactiveDataSearchProps: (options: {
9
9
  inputClassName?: string | undefined;
10
10
  type: string;
11
11
  showIcon: boolean;
12
- fuzziness: 0 | 2 | 1 | "AUTO";
12
+ fuzziness: 0 | 1 | 2 | "AUTO";
13
13
  queryFormat: "and" | "or";
14
14
  autosuggest: boolean;
15
15
  value: string;
@@ -38,7 +38,7 @@ const useReactiveDataSearchProps = (options) => {
38
38
  }, {
39
39
  wait: (_a = options.debounce) !== null && _a !== void 0 ? _a : 300,
40
40
  });
41
- return react_1.default.useMemo(() => {
41
+ const reactiveDataSearchProps = react_1.default.useMemo(() => {
42
42
  var _a;
43
43
  return (Object.assign({ type: "search", showIcon: false, fuzziness: 1, queryFormat: "and", autosuggest: false, value: searchQuery !== null && searchQuery !== void 0 ? searchQuery : "", onKeyUp: handleKeyPress, componentId: "SearchInput", placeholder: (_a = options.placeholder) !== null && _a !== void 0 ? _a : "Search for a product...", dataField: searchFields.map((field) => field.field), fieldWeights: searchFields.map((field) => field.importance), onChange: (value, triggerQuery) => {
44
44
  setSearchQuery(value);
@@ -65,6 +65,7 @@ const useReactiveDataSearchProps = (options) => {
65
65
  runDebouncedTriggerQuery,
66
66
  cancelDebouncedTriggerQuery,
67
67
  ]);
68
+ return reactiveDataSearchProps;
68
69
  };
69
70
  exports.useReactiveDataSearchProps = useReactiveDataSearchProps;
70
71
  //# sourceMappingURL=useReactiveDataSearchProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveDataSearchProps.js","sour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,GAAG,EAAE;gBACX,mEAAmE;gBACnE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;YAC5D,CAAC,EACD,OAAO,EAAE,GAAG,EAAE;gBACZ,2BAA2B,CAAC,IAAI,CAAC,CAAC;YACpC,CAAC,EACD,UAAU,EAAE;gBACV,KAAK,EAAE,OAAO,CAAC,cAAc;aAC9B,IACE,OAAO,EACV,CAAA;KAAA,EACF;QACE,WAAW;QACX,cAAc;QACd,OAAO,CAAC,WAAW;QACnB,YAAY;QACZ,cAAc;QACd,wBAAwB;QACxB,2BAA2B;KAC5B,CACF,CAAC;AACJ,CAAC,CAAC;AA7FW,QAAA,0BAA0B,8BA6FrC","sourcesContent":["import React from \"react\";\nimport { useDebounceFn } from \"ahooks\";\n\nimport type { ConfigField } from \"../../types/config\";\n\nimport { useReactifySearchContext, useSearch, useAnalytics } from \"../../hooks\";\n\n// default field for when zero search fields have been configured in Reactify\nconst defaultSearchField: ConfigField = {\n id: \"title\",\n field: \"title\",\n importance: 0,\n searchType: \"instant_search\",\n};\n\nexport const useReactiveDataSearchProps = (options: {\n [key: string]: any;\n debounce?: number;\n placeholder?: string;\n inputClassName?: string;\n}) => {\n const { config } = useReactifySearchContext();\n const {\n searchQuery,\n submitSearch,\n setSearchQuery,\n setShowInstantSearchResults,\n } = useSearch();\n\n const searchFields = React.useMemo(\n () =>\n 0 < config.fields.length\n ? config.fields.filter((field) =>\n [\"always_search\", \"instant_search\"].includes(field.searchType)\n )\n : [defaultSearchField],\n []\n );\n\n const handleKeyPress = React.useCallback(\n (e) => {\n if (\"Enter\" !== e.key) return;\n submitSearch();\n },\n [submitSearch]\n );\n\n const { track } = useAnalytics();\n\n const trackQuery = React.useCallback(() => {\n if (!searchQuery || (searchQuery && searchQuery.length < 3)) return;\n track({ eventName: \"search\", payload: { searchTerm: searchQuery } });\n }, [searchQuery, track]);\n\n const { run: runDebouncedTriggerQuery, cancel: cancelDebouncedTriggerQuery } =\n useDebounceFn(\n (triggerQuery: () => void) => {\n triggerQuery();\n trackQuery();\n },\n {\n wait: options.debounce ?? 300,\n }\n );\n\n return React.useMemo(\n () => ({\n type: \"search\",\n showIcon: false,\n fuzziness: 1 as 0 | 1 | 2 | \"AUTO\",\n queryFormat: \"and\" as \"and\" | \"or\",\n autosuggest: false,\n value: searchQuery ?? \"\",\n onKeyUp: handleKeyPress,\n componentId: \"SearchInput\",\n placeholder: options.placeholder ?? \"Search for a product...\",\n dataField: searchFields.map((field) => field.field),\n fieldWeights: searchFields.map((field) => field.importance),\n onChange: (value: string, triggerQuery: () => {}) => {\n setSearchQuery(value);\n if (!!value) {\n runDebouncedTriggerQuery(triggerQuery);\n } else {\n cancelDebouncedTriggerQuery();\n }\n },\n onBlur: () => {\n // setTimeout ensures that results are still clickable before close\n setTimeout(() => setShowInstantSearchResults(false), 300);\n },\n onFocus: () => {\n setShowInstantSearchResults(true);\n },\n innerClass: {\n input: options.inputClassName,\n },\n ...options,\n }),\n [\n searchQuery,\n handleKeyPress,\n options.placeholder,\n searchFields,\n setSearchQuery,\n runDebouncedTriggerQuery,\n cancelDebouncedTriggerQuery,\n ]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveDataSearchProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveDataSearchProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,mCAAuC;AAIvC,uCAAgF;AAEhF,6EAA6E;AAC7E,MAAM,kBAAkB,GAAgB;IACtC,EAAE,EAAE,OAAO;IACX,KAAK,EAAE,OAAO;IACd,UAAU,EAAE,CAAC;IACb,UAAU,EAAE,gBAAgB;CAC7B,CAAC;AAEK,MAAM,0BAA0B,GAAG,CAAC,OAK1C,EAAE,EAAE;;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC9C,MAAM,EACJ,WAAW,EACX,YAAY,EACZ,cAAc,EACd,2BAA2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BAAuB,CAAC;AACjC,CAAC,CAAC;AA/FW,QAAA,0BAA0B,8BA+FrC","sourcesContent":["import React from \"react\";\nimport { useDebounceFn } from \"ahooks\";\n\nimport type { ConfigField } from \"../../types/config\";\n\nimport { useReactifySearchContext, useSearch, useAnalytics } from \"../../hooks\";\n\n// default field for when zero search fields have been configured in Reactify\nconst defaultSearchField: ConfigField = {\n id: \"title\",\n field: \"title\",\n importance: 0,\n searchType: \"instant_search\",\n};\n\nexport const useReactiveDataSearchProps = (options: {\n [key: string]: any;\n debounce?: number;\n placeholder?: string;\n inputClassName?: string;\n}) => {\n const { config } = useReactifySearchContext();\n const {\n searchQuery,\n submitSearch,\n setSearchQuery,\n setShowInstantSearchResults,\n } = useSearch();\n\n const searchFields = React.useMemo(\n () =>\n 0 < config.fields.length\n ? config.fields.filter((field) =>\n [\"always_search\", \"instant_search\"].includes(field.searchType)\n )\n : [defaultSearchField],\n []\n );\n\n const handleKeyPress = React.useCallback(\n (e) => {\n if (\"Enter\" !== e.key) return;\n submitSearch();\n },\n [submitSearch]\n );\n\n const { track } = useAnalytics();\n\n const trackQuery = React.useCallback(() => {\n if (!searchQuery || (searchQuery && searchQuery.length < 3)) return;\n track({ eventName: \"search\", payload: { searchTerm: searchQuery } });\n }, [searchQuery, track]);\n\n const { run: runDebouncedTriggerQuery, cancel: cancelDebouncedTriggerQuery } =\n useDebounceFn(\n (triggerQuery: () => void) => {\n triggerQuery();\n trackQuery();\n },\n {\n wait: options.debounce ?? 300,\n }\n );\n\n const reactiveDataSearchProps = React.useMemo(\n () => ({\n type: \"search\",\n showIcon: false,\n fuzziness: 1 as 0 | 1 | 2 | \"AUTO\",\n queryFormat: \"and\" as \"and\" | \"or\",\n autosuggest: false,\n value: searchQuery ?? \"\",\n onKeyUp: handleKeyPress,\n componentId: \"SearchInput\",\n placeholder: options.placeholder ?? \"Search for a product...\",\n dataField: searchFields.map((field) => field.field),\n fieldWeights: searchFields.map((field) => field.importance),\n onChange: (value: string, triggerQuery: () => {}) => {\n setSearchQuery(value);\n if (!!value) {\n runDebouncedTriggerQuery(triggerQuery);\n } else {\n cancelDebouncedTriggerQuery();\n }\n },\n onBlur: () => {\n // setTimeout ensures that results are still clickable before close\n setTimeout(() => setShowInstantSearchResults(false), 300);\n },\n onFocus: () => {\n setShowInstantSearchResults(true);\n },\n innerClass: {\n input: options.inputClassName,\n },\n ...options,\n }),\n [\n searchQuery,\n handleKeyPress,\n options.placeholder,\n searchFields,\n setSearchQuery,\n runDebouncedTriggerQuery,\n cancelDebouncedTriggerQuery,\n ]\n );\n\n return reactiveDataSearchProps;\n};\n"]}
@@ -13,10 +13,11 @@ const useReactiveReactProp_1 = require("./useReactiveReactProp");
13
13
  const useReactiveFilterListProps = (filter) => {
14
14
  const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
15
15
  const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
16
- return react_1.default.useMemo(() => {
16
+ const reactiveFilterListProps = react_1.default.useMemo(() => {
17
17
  var _a, _b, _c;
18
18
  return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { size: parseInt(filter.displaySize) || undefined, showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true, showLoadMore: (_b = filter.settingsShowMore) !== null && _b !== void 0 ? _b : false, showSearch: (_c = filter.settingsShowSearch) !== null && _c !== void 0 ? _c : false, showRadio: false, showCheckbox: false }));
19
19
  }, [filter, reactiveReactProp]);
20
+ return reactiveFilterListProps;
20
21
  };
21
22
  exports.useReactiveFilterListProps = useReactiveFilterListProps;
22
23
  //# sourceMappingURL=useReactiveFilterListProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveFilterListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACvE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,SAAS,EAC/C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,YAAY,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,KAAK,EAC9C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,KAAK,EAC9C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAhBW,QAAA,0BAA0B,8BAgBrC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleList and MultiList components\n */\nexport const useReactiveFilterListProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n return React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n size: parseInt(filter.displaySize) || undefined,\n showFilter: filter.settingsShowFilter ?? true,\n showLoadMore: filter.settingsShowMore ?? false,\n showSearch: filter.settingsShowSearch ?? false,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveReactProp]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACvE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,uBAAuB,GAAG,eAAK,CAAC,OAAO,CAC3C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,SAAS,EAC/C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,YAAY,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,KAAK,EAC9C,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,KAAK,EAC9C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,uBAAuB,CAAC;AACjC,CAAC,CAAC;AAlBW,QAAA,0BAA0B,8BAkBrC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleList and MultiList components\n */\nexport const useReactiveFilterListProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const reactiveFilterListProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n size: parseInt(filter.displaySize) || undefined,\n showFilter: filter.settingsShowFilter ?? true,\n showLoadMore: filter.settingsShowMore ?? false,\n showSearch: filter.settingsShowSearch ?? false,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterListProps;\n};\n"]}
@@ -13,10 +13,11 @@ const useReactiveReactProp_1 = require("./useReactiveReactProp");
13
13
  const useReactiveFilterRangeProps = (filter) => {
14
14
  const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
15
15
  const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
16
- return react_1.default.useMemo(() => {
16
+ const reactiveFilterRangeProps = react_1.default.useMemo(() => {
17
17
  var _a;
18
18
  return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true, showRadio: false, showCheckbox: false }));
19
19
  }, [filter, reactiveReactProp]);
20
+ return reactiveFilterRangeProps;
20
21
  };
21
22
  exports.useReactiveFilterRangeProps = useReactiveFilterRangeProps;
22
23
  //# sourceMappingURL=useReactiveFilterRangeProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveFilterRangeProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterRangeProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,2BAA2B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACxE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,2BAA2B,+BAatC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleRange and MultiRange components\n */\nexport const useReactiveFilterRangeProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n return React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveReactProp]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterRangeProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterRangeProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,2BAA2B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACxE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,wBAAwB,GAAG,eAAK,CAAC,OAAO,CAC5C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,EAC7C,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,KAAK,IACnB,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,wBAAwB,CAAC;AAClC,CAAC,CAAC;AAfW,QAAA,2BAA2B,+BAetC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch SingleRange and MultiRange components\n */\nexport const useReactiveFilterRangeProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const reactiveFilterRangeProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n showRadio: false,\n showCheckbox: false,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterRangeProps;\n};\n"]}
@@ -91,7 +91,7 @@ const useReactiveFilterSharedProps = (filter) => {
91
91
  };
92
92
  };
93
93
  }, [filter]);
94
- return react_1.default.useMemo(() => ({
94
+ const reactiveFilterSharedProps = react_1.default.useMemo(() => ({
95
95
  nestedField,
96
96
  customQuery,
97
97
  defaultQuery,
@@ -101,6 +101,7 @@ const useReactiveFilterSharedProps = (filter) => {
101
101
  filterLabel: filter.name,
102
102
  react: reactiveReactProp,
103
103
  }), [filter, reactiveReactProp]);
104
+ return reactiveFilterSharedProps;
104
105
  };
105
106
  exports.useReactiveFilterSharedProps = useReactiveFilterSharedProps;
106
107
  //# sourceMappingURL=useReactiveFilterSharedProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveFilterSharedProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSharedProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC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CAAC,CAAC,CAAC;IAEb,6GAA6G;IAC7G,iFAAiF;IACjF,MAAM,YAAY,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtC,IACE,CAAC,MAAM,CAAC,uBAAuB;YAC/B,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;YAErC,OAAO,SAAS,CAAC;QAEnB,2FAA2F;QAC3F,OAAO,GAAG,EAAE;YACV,OAAO;gBACL,IAAI,EAAE;oBACJ,qBAAqB,EAAE;wBACrB,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE;wBAC5B,IAAI,EAAE;4BACJ,qBAAqB,EAAE;gCACrB,MAAM,EAAE;oCACN,KAAK,EAAE;wCACL,oBAAoB,EAAE,MAAM;qCAC7B;iCACF;gCACD,IAAI,EAAE;oCACJ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;wCACd,KAAK,EAAE;4CACL,KAAK,EAAE,MAAM,CAAC,KAAK;4CACnB,IAAI,EAAE,GAAG;4CACT,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;yCAC1B;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE,CAAC,CAAC;QACL,WAAW;QACX,WAAW;QACX,YAAY;QACZ,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,MAAM,CAAC,MAAM;QAC1B,SAAS,EAAE,MAAM,CAAC,KAAK;QACvB,WAAW,EAAE,MAAM,CAAC,IAAI;QACxB,KAAK,EAAE,iBAAiB;KACzB,CAAC,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAzGW,QAAA,4BAA4B,gCAyGvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with all @appbaseio/reactivesearch filter components\n */\nexport const useReactiveFilterSharedProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n\n const nestedField = React.useMemo(() => {\n const nestedFields = [\"variants\"];\n const topField = filter.field.split(\".\")[0];\n if (nestedFields.includes(topField)) return topField;\n return undefined;\n }, [filter]);\n\n // define a custom query for when settingsHideUnavailable is enabled and the target field is inside variants\n // customQuery defines how this filter affects *other* components like the results component\n const customQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n return (value?: string | string[]) => {\n if (!value) return {};\n\n // reactivesearch sometimes returns string, sometimes string[]\n const valueArray = \"string\" === typeof value ? [value] : value;\n\n if (0 === valueArray.length) return {};\n\n return {\n query: {\n nested: {\n path: \"variants\",\n query: {\n bool: {\n must: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n terms: {\n [filter.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n // define a default query for when settingsHideUnavailable is enabled and the target field is inside variants\n // defaultQuery defines how this filter affects itself i.e. the options displayed\n const defaultQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n // override the aggregation query to filter the results by the variants.available attribute\n return () => {\n return {\n aggs: {\n reactivesearch_nested: {\n nested: { path: \"variants\" },\n aggs: {\n reactify_nested_outer: {\n filter: {\n match: {\n \"variants.available\": \"true\",\n },\n },\n aggs: {\n [filter.field]: {\n terms: {\n field: filter.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n return React.useMemo(\n () => ({\n nestedField,\n customQuery,\n defaultQuery,\n URLParams: true,\n componentId: filter.handle,\n dataField: filter.field,\n filterLabel: filter.name,\n react: reactiveReactProp,\n }),\n [filter, reactiveReactProp]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterSharedProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSharedProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAI1B,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE9D,MAAM,WAAW,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,CAAC;QAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5C,IAAI,YAAY,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAAE,OAAO,QAAQ,CAAC;QACrD,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,4GAA4G;IAC5G,4FAA4F;IAC5F,MAAM,WAAW,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACrC,IACE,CAAC,MAAM,CAAC,uBAAuB;YAC/B,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC;YAErC,OAAO,SAAS,CAAC;QAEnB,OAAO,CAAC,KAAyB,EAAE,EAAE;YACnC,IAAI,CAAC,KAAK;gBAAE,OAAO,EAAE,CAAC;YAEtB,8DAA8D;YAC9D,MAAM,UAAU,GAAG,QAAQ,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAE/D,IAAI,CAAC,KAAK,UAAU,CAAC,MAAM;gBAAE,OAAO,EAAE,CAAC;YAEvC,OAAO;gBACL,KAAK,EAAE;oBACL,MAAM,EAAE;wBACN,IAAI,E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EAAE,IAAI;QACf,WAAW,EAAE,MAAM,CAAC,MAAM;QAC1B,SAAS,EAAE,MAAM,CAAC,KAAK;QACvB,WAAW,EAAE,MAAM,CAAC,IAAI;QACxB,KAAK,EAAE,iBAAiB;KACzB,CAAC,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AA3GW,QAAA,4BAA4B,gCA2GvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with all @appbaseio/reactivesearch filter components\n */\nexport const useReactiveFilterSharedProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n\n const nestedField = React.useMemo(() => {\n const nestedFields = [\"variants\"];\n const topField = filter.field.split(\".\")[0];\n if (nestedFields.includes(topField)) return topField;\n return undefined;\n }, [filter]);\n\n // define a custom query for when settingsHideUnavailable is enabled and the target field is inside variants\n // customQuery defines how this filter affects *other* components like the results component\n const customQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n return (value?: string | string[]) => {\n if (!value) return {};\n\n // reactivesearch sometimes returns string, sometimes string[]\n const valueArray = \"string\" === typeof value ? [value] : value;\n\n if (0 === valueArray.length) return {};\n\n return {\n query: {\n nested: {\n path: \"variants\",\n query: {\n bool: {\n must: [\n {\n match: {\n \"variants.available\": \"true\",\n },\n },\n {\n terms: {\n [filter.field]: valueArray,\n },\n },\n ],\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n // define a default query for when settingsHideUnavailable is enabled and the target field is inside variants\n // defaultQuery defines how this filter affects itself i.e. the options displayed\n const defaultQuery = React.useMemo(() => {\n if (\n !filter.settingsHideUnavailable ||\n !filter.field.startsWith(\"variants.\")\n )\n return undefined;\n\n // override the aggregation query to filter the results by the variants.available attribute\n return () => {\n return {\n aggs: {\n reactivesearch_nested: {\n nested: { path: \"variants\" },\n aggs: {\n reactify_nested_outer: {\n filter: {\n match: {\n \"variants.available\": \"true\",\n },\n },\n aggs: {\n [filter.field]: {\n terms: {\n field: filter.field,\n size: 100,\n order: { _count: \"desc\" },\n },\n },\n },\n },\n },\n },\n },\n };\n };\n }, [filter]);\n\n const reactiveFilterSharedProps = React.useMemo(\n () => ({\n nestedField,\n customQuery,\n defaultQuery,\n URLParams: true,\n componentId: filter.handle,\n dataField: filter.field,\n filterLabel: filter.name,\n react: reactiveReactProp,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterSharedProps;\n};\n"]}
@@ -13,10 +13,11 @@ const useReactiveReactProp_1 = require("./useReactiveReactProp");
13
13
  const useReactiveFilterSliderProps = (filter) => {
14
14
  const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)(filter.handle);
15
15
  const reactiveFilterSharedProps = (0, useReactiveFilterSharedProps_1.useReactiveFilterSharedProps)(filter);
16
- return react_1.default.useMemo(() => {
16
+ const reactiveFilterSliderProps = react_1.default.useMemo(() => {
17
17
  var _a;
18
18
  return (Object.assign(Object.assign({}, reactiveFilterSharedProps), { showFilter: (_a = filter.settingsShowFilter) !== null && _a !== void 0 ? _a : true }));
19
19
  }, [filter, reactiveReactProp]);
20
+ return reactiveFilterSliderProps;
20
21
  };
21
22
  exports.useReactiveFilterSliderProps = useReactiveFilterSliderProps;
22
23
  //# sourceMappingURL=useReactiveFilterSliderProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveFilterSliderProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,OAAO,eAAK,CAAC,OAAO,CAClB,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,IAC7C,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;AACJ,CAAC,CAAC;AAXW,QAAA,4BAA4B,gCAWvC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch RangeSlider component\n */\nexport const useReactiveFilterSliderProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n return React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n }),\n [filter, reactiveReactProp]\n );\n};\n"]}
1
+ {"version":3,"file":"useReactiveFilterSliderProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveFilterSliderProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,iFAA8E;AAE9E,iEAA8D;AAE9D;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,MAA0B,EAAE,EAAE;IACzE,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,yBAAyB,GAAG,IAAA,2DAA4B,EAAC,MAAM,CAAC,CAAC;IAEvE,MAAM,yBAAyB,GAAG,eAAK,CAAC,OAAO,CAC7C,GAAG,EAAE;;QAAC,OAAA,iCACD,yBAAyB,KAC5B,UAAU,EAAE,MAAA,MAAM,CAAC,kBAAkB,mCAAI,IAAI,IAC7C,CAAA;KAAA,EACF,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAC5B,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AAbW,QAAA,4BAA4B,gCAavC","sourcesContent":["import React from \"react\";\n\nimport type { ConfigFilterOption } from \"../../types/config\";\nimport { useReactiveFilterSharedProps } from \"./useReactiveFilterSharedProps\";\n\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\n/**\n * For use with @appbaseio/reactivesearch RangeSlider component\n */\nexport const useReactiveFilterSliderProps = (filter: ConfigFilterOption) => {\n const reactiveReactProp = useReactiveReactProp(filter.handle);\n const reactiveFilterSharedProps = useReactiveFilterSharedProps(filter);\n\n const reactiveFilterSliderProps = React.useMemo(\n () => ({\n ...reactiveFilterSharedProps,\n showFilter: filter.settingsShowFilter ?? true,\n }),\n [filter, reactiveReactProp]\n );\n\n return reactiveFilterSliderProps;\n};\n"]}
@@ -9,18 +9,18 @@ const hooks_1 = require("../../hooks");
9
9
  const components_1 = require("../../components");
10
10
  const useReactiveReactProp = (currentHandle) => {
11
11
  const { options } = (0, hooks_1.useReactifySearchContext)();
12
- const { filters } = (0, hooks_1.useFilters)();
12
+ const { filterStack } = (0, hooks_1.useFilters)();
13
13
  return react_1.default.useMemo(() => {
14
- var _a;
14
+ var _a, _b;
15
15
  return {
16
16
  and: [
17
17
  "SearchInput",
18
18
  ...components_1.SENSOR_IDS,
19
19
  ...((_a = options.additionalComponentHandles) !== null && _a !== void 0 ? _a : []),
20
- ...filters.map((filter) => filter.handle),
20
+ ...((_b = filterStack === null || filterStack === void 0 ? void 0 : filterStack.options.map((filter) => filter.handle)) !== null && _b !== void 0 ? _b : []),
21
21
  ].filter((handle) => handle !== currentHandle),
22
22
  };
23
- }, [filters, currentHandle, options.additionalComponentHandles]);
23
+ }, [filterStack, currentHandle, options.additionalComponentHandles]);
24
24
  };
25
25
  exports.useReactiveReactProp = useReactiveReactProp;
26
26
  //# sourceMappingURL=useReactiveReactProp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactiveReactProp.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveReactProp.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAmE;AACnE,iDAA8C;AAEvC,MAAM,oBAAoB,GAAG,CAAC,aAAsB,EAAE,EAAE;IAC7D,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,OAAO,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QACxB,OAAO;YACL,GAAG,EAAE;gBACH,aAAa;gBACb,GAAG,uBAAU;gBACb,GAAG,CAAC,MAAA,OAAO,CAAC,0BAA0B,mCAAI,EAAE,CAAC;gBAC7C,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;aAC1C,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,aAAa,CAAC;SAC/C,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC;AAdW,QAAA,oBAAoB,wBAc/B","sourcesContent":["import React from \"react\";\n\nimport { useReactifySearchContext, useFilters } from \"../../hooks\";\nimport { SENSOR_IDS } from \"../../components\";\n\nexport const useReactiveReactProp = (currentHandle?: string) => {\n const { options } = useReactifySearchContext();\n const { filters } = useFilters();\n\n return React.useMemo(() => {\n return {\n and: [\n \"SearchInput\",\n ...SENSOR_IDS,\n ...(options.additionalComponentHandles ?? []),\n ...filters.map((filter) => filter.handle),\n ].filter((handle) => handle !== currentHandle),\n };\n }, [filters, currentHandle, options.additionalComponentHandles]);\n};\n"]}
1
+ {"version":3,"file":"useReactiveReactProp.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveReactProp.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAmE;AACnE,iDAA8C;AAEvC,MAAM,oBAAoB,GAAG,CAAC,aAAsB,EAAE,EAAE;IAC7D,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC/C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;IAErC,OAAO,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QACxB,OAAO;YACL,GAAG,EAAE;gBACH,aAAa;gBACb,GAAG,uBAAU;gBACb,GAAG,CAAC,MAAA,OAAO,CAAC,0BAA0B,mCAAI,EAAE,CAAC;gBAC7C,GAAG,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,mCAAI,EAAE,CAAC;aAC/D,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,aAAa,CAAC;SAC/C,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC;AACvE,CAAC,CAAC;AAdW,QAAA,oBAAoB,wBAc/B","sourcesContent":["import React from \"react\";\n\nimport { useReactifySearchContext, useFilters } from \"../../hooks\";\nimport { SENSOR_IDS } from \"../../components\";\n\nexport const useReactiveReactProp = (currentHandle?: string) => {\n const { options } = useReactifySearchContext();\n const { filterStack } = useFilters();\n\n return React.useMemo(() => {\n return {\n and: [\n \"SearchInput\",\n ...SENSOR_IDS,\n ...(options.additionalComponentHandles ?? []),\n ...(filterStack?.options.map((filter) => filter.handle) ?? []),\n ].filter((handle) => handle !== currentHandle),\n };\n }, [filterStack, currentHandle, options.additionalComponentHandles]);\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import ReactiveList from "@appbaseio/reactivesearch/lib/components/result/ReactiveList";
3
+ export declare const useReactiveReactiveListProps: (options: {
4
+ pageSize?: number;
5
+ }) => React.ComponentProps<typeof ReactiveList>;
@@ -3,18 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useReactiveResultStackProps = void 0;
6
+ exports.useReactiveReactiveListProps = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const hooks_1 = require("../../hooks");
9
9
  const useReactiveReactProp_1 = require("./useReactiveReactProp");
10
- const useReactiveResultStackProps = (options) => {
11
- const { filterStack } = (0, hooks_1.useFilterStack)();
10
+ const useReactiveReactiveListProps = (options) => {
11
+ const { filterStack } = (0, hooks_1.useFilters)();
12
12
  const reactiveReactProp = (0, useReactiveReactProp_1.useReactiveReactProp)();
13
13
  const size = react_1.default.useMemo(() => {
14
14
  var _a, _b;
15
15
  return (_b = (_a = options.pageSize) !== null && _a !== void 0 ? _a : filterStack === null || filterStack === void 0 ? void 0 : filterStack.pageSize) !== null && _b !== void 0 ? _b : 20;
16
16
  }, [options.pageSize, filterStack]);
17
- return react_1.default.useMemo(() => ({
17
+ const reactiveReactiveListProps = react_1.default.useMemo(() => ({
18
18
  size,
19
19
  URLParams: true,
20
20
  showLoader: false,
@@ -27,6 +27,7 @@ const useReactiveResultStackProps = (options) => {
27
27
  infiniteScroll: (filterStack === null || filterStack === void 0 ? void 0 : filterStack.paginationType) === "infinite_scroll",
28
28
  renderNoResults: () => null, // always use only render, otherwise both are shown
29
29
  }), [filterStack, reactiveReactProp, options.pageSize]);
30
+ return reactiveReactiveListProps;
30
31
  };
31
- exports.useReactiveResultStackProps = useReactiveResultStackProps;
32
- //# sourceMappingURL=useReactiveResultStackProps.js.map
32
+ exports.useReactiveReactiveListProps = useReactiveReactiveListProps;
33
+ //# sourceMappingURL=useReactiveReactiveListProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReactiveReactiveListProps.js","sourceRoot":"","sources":["../../../../src/hooks/reactivesearch/useReactiveReactiveListProps.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAG1B,uCAAyC;AACzC,iEAA8D;AAEvD,MAAM,4BAA4B,GAAG,CAAC,OAE5C,EAA6C,EAAE;IAC9C,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,GAAE,CAAC;IACrC,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,GAAE,CAAC;IAEjD,MAAM,IAAI,GAAG,eAAK,CAAC,OAAO,CAAC,GAAG,EAAE;;QAC9B,OAAO,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,mCAAI,EAAE,CAAC;IACzD,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;IAEpC,MAAM,yBAAyB,GAAG,eAAK,CAAC,OAAO,CAC7C,GAAG,EAAE,CAAC,CAAC;QACL,IAAI;QACJ,SAAS,EAAE,IAAI;QACf,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,OAAO;QAClB,eAAe,EAAE,KAAK;QACtB,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,MAAM;QACnB,cAAc,EAAE,KAAK;QACrB,UAAU,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,MAAK,iBAAiB;QAC7D,cAAc,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,MAAK,iBAAiB;QACjE,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,mDAAmD;KACjF,CAAC,EACF,CAAC,WAAW,EAAE,iBAAiB,EAAE,OAAO,CAAC,QAAQ,CAAC,CACnD,CAAC;IAEF,OAAO,yBAAyB,CAAC;AACnC,CAAC,CAAC;AA5BW,QAAA,4BAA4B,gCA4BvC","sourcesContent":["import React from \"react\";\nimport ReactiveList from \"@appbaseio/reactivesearch/lib/components/result/ReactiveList\";\n\nimport { useFilters } from \"../../hooks\";\nimport { useReactiveReactProp } from \"./useReactiveReactProp\";\n\nexport const useReactiveReactiveListProps = (options: {\n pageSize?: number;\n}): React.ComponentProps<typeof ReactiveList> => {\n const { filterStack } = useFilters();\n const reactiveReactProp = useReactiveReactProp();\n\n const size = React.useMemo(() => {\n return options.pageSize ?? filterStack?.pageSize ?? 20;\n }, [options.pageSize, filterStack]);\n\n const reactiveReactiveListProps = React.useMemo(\n () => ({\n size,\n URLParams: true,\n showLoader: false,\n dataField: \"title\",\n showResultStats: false,\n react: reactiveReactProp,\n componentId: \"page\", // this sets ?page= in the URL\n scrollOnChange: false, // @todo make this better, it's really janky when enabled\n pagination: filterStack?.paginationType !== \"infinite_scroll\",\n infiniteScroll: filterStack?.paginationType === \"infinite_scroll\",\n renderNoResults: () => null, // always use only render, otherwise both are shown\n }),\n [filterStack, reactiveReactProp, options.pageSize]\n );\n\n return reactiveReactiveListProps;\n};\n"]}
@@ -11,11 +11,7 @@ const useCuration = () => {
11
11
  const { options, config } = (0, hooks_1.useReactifySearchContext)();
12
12
  const { searchQuery } = (0, hooks_1.useSearch)();
13
13
  const curation = react_1.default.useMemo(() => {
14
- const handleOrSearchTerm = options.mode === "collection"
15
- ? options.collection
16
- ? options.collection.handle
17
- : searchQuery
18
- : "";
14
+ const handleOrSearchTerm = options.mode === "collection" ? options.collectionHandle : searchQuery;
19
15
  const normalisedHandleOrSearchTerm = handleOrSearchTerm
20
16
  .toLowerCase()
21
17
  .trim();
@@ -54,7 +50,7 @@ const useCuration = () => {
54
50
  : undefined;
55
51
  }, [
56
52
  config,
57
- options.mode === "collection" ? options.collection : undefined,
53
+ options.mode === "collection" ? options.collectionHandle : undefined,
58
54
  searchQuery,
59
55
  ]);
60
56
  react_1.default.useEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"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B,CAAC,CAAC;AAjFW,QAAA,WAAW,eAiFtB","sourcesContent":["import React from \"react\";\n\nimport { ConfigCuration } from \"../types\";\nimport { useReactifySearchContext, useSearch } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nexport const useCuration = (): ConfigCuration | undefined => {\n const { options, config } = useReactifySearchContext();\n const { searchQuery } = useSearch();\n\n const curation = React.useMemo(() => {\n const handleOrSearchTerm =\n options.mode === \"collection\"\n ? options.collection\n ? options.collection.handle\n : searchQuery\n : \"\";\n\n const normalisedHandleOrSearchTerm = handleOrSearchTerm\n .toLowerCase()\n .trim();\n\n const globalCuration = config.curations.find(\n (curation) => curation.id === \"global\" && curation.type === options.mode\n );\n\n const curation = config.curations.find((curation) => {\n const normalisedSearchTerm = curation.searchTerm?.toLowerCase().trim();\n const normalisedCollectionHandle = curation.collectionHandle\n ?.toLowerCase()\n .trim();\n\n if (\"search\" === options.mode) {\n return (\n \"search\" === curation.type &&\n normalisedHandleOrSearchTerm === normalisedSearchTerm\n );\n }\n\n if (\"collection\" === options.mode) {\n return (\n \"collection\" === curation.type &&\n normalisedHandleOrSearchTerm === normalisedCollectionHandle\n );\n }\n\n return false;\n });\n\n const addGlobalBoosting = (curation: ConfigCuration) => {\n const curationIsCollection = curation.type === \"collection\";\n if (!curationIsCollection) {\n return curation;\n }\n\n const curationHasRules =\n !!curation.boosting.groupings.length ||\n !!curation.boosting.sortings.length;\n\n if (curationHasRules || !globalCuration) {\n return curation;\n }\n\n const curationWithGlobalBoosting = {\n ...curation,\n boosting: globalCuration.boosting,\n } as ConfigCuration;\n\n return curationWithGlobalBoosting;\n };\n\n return curation\n ? addGlobalBoosting(curation)\n : globalCuration\n ? globalCuration\n : undefined;\n }, [\n config,\n options.mode === \"collection\" ? options.collection : undefined,\n searchQuery,\n ]);\n\n React.useEffect(() => {\n debug.log(\"useCuration\", \"curation\", curation);\n }, [curation]);\n\n return curation;\n};\n"]}
1
+ {"version":3,"file":"useCuration.js","sourceRoot":"","sources":["../../../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chContext, useSearch } from \"../hooks\";\nimport { debug } from \"../utility\";\n\nexport const useCuration = (): ConfigCuration | undefined => {\n const { options, config } = useReactifySearchContext();\n const { searchQuery } = useSearch();\n\n const curation = React.useMemo(() => {\n const handleOrSearchTerm =\n options.mode === \"collection\" ? options.collectionHandle : searchQuery;\n\n const normalisedHandleOrSearchTerm = handleOrSearchTerm\n .toLowerCase()\n .trim();\n\n const globalCuration = config.curations.find(\n (curation) => curation.id === \"global\" && curation.type === options.mode\n );\n\n const curation = config.curations.find((curation) => {\n const normalisedSearchTerm = curation.searchTerm?.toLowerCase().trim();\n const normalisedCollectionHandle = curation.collectionHandle\n ?.toLowerCase()\n .trim();\n\n if (\"search\" === options.mode) {\n return (\n \"search\" === curation.type &&\n normalisedHandleOrSearchTerm === normalisedSearchTerm\n );\n }\n\n if (\"collection\" === options.mode) {\n return (\n \"collection\" === curation.type &&\n normalisedHandleOrSearchTerm === normalisedCollectionHandle\n );\n }\n\n return false;\n });\n\n const addGlobalBoosting = (curation: ConfigCuration) => {\n const curationIsCollection = curation.type === \"collection\";\n if (!curationIsCollection) {\n return curation;\n }\n\n const curationHasRules =\n !!curation.boosting.groupings.length ||\n !!curation.boosting.sortings.length;\n\n if (curationHasRules || !globalCuration) {\n return curation;\n }\n\n const curationWithGlobalBoosting = {\n ...curation,\n boosting: globalCuration.boosting,\n } as ConfigCuration;\n\n return curationWithGlobalBoosting;\n };\n\n return curation\n ? addGlobalBoosting(curation)\n : globalCuration\n ? globalCuration\n : undefined;\n }, [\n config,\n options.mode === \"collection\" ? options.collectionHandle : undefined,\n searchQuery,\n ]);\n\n React.useEffect(() => {\n debug.log(\"useCuration\", \"curation\", curation);\n }, [curation]);\n\n return curation;\n};\n"]}
@@ -5,12 +5,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.useFilterListProps = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
+ const hooks_1 = require("../hooks");
9
+ const utility_1 = require("../utility");
8
10
  // converts reactivesearch props returned in filters to a cleaned up/filtered version
9
11
  const useFilterListProps = (filter, reactivesearchFilterProps) => {
10
- return react_1.default.useMemo(() => {
11
- const { data, value } = reactivesearchFilterProps;
12
+ const { track } = (0, hooks_1.useAnalytics)();
13
+ const handleChange = react_1.default.useCallback((value) => {
14
+ utility_1.debug.breadcrumb({
15
+ category: "filter",
16
+ message: "filter option changed",
17
+ data: {
18
+ filter: filter.name,
19
+ field: filter.field,
20
+ value: value,
21
+ },
22
+ });
23
+ utility_1.debug.log("useFilterListProps", "handleChange[value]", value);
24
+ reactivesearchFilterProps.handleChange(value);
25
+ track({
26
+ eventName: "filterChange",
27
+ payload: {
28
+ name: filter.name,
29
+ value: value,
30
+ },
31
+ });
32
+ }, [filter]);
33
+ const filterListProps = react_1.default.useMemo(() => {
12
34
  // remove excluded options, sort alphabeticaly, map checked boolean
13
- const options = data
35
+ const options = reactivesearchFilterProps.data
14
36
  .filter(({ key }) => {
15
37
  var _a, _b;
16
38
  if ((_a = filter.valuesExclude) === null || _a === void 0 ? void 0 : _a.includes(key))
@@ -20,17 +42,22 @@ const useFilterListProps = (filter, reactivesearchFilterProps) => {
20
42
  return true;
21
43
  })
22
44
  .sort((a, b) => a.key.localeCompare(b.key))
23
- .map((option) => (Object.assign(Object.assign({}, option), { checked: (typeof value === "object" && value[option.key]) ||
24
- value === option.key })));
45
+ .map((option) => (Object.assign(Object.assign({}, option), { checked: (typeof reactivesearchFilterProps.value === "object" &&
46
+ reactivesearchFilterProps.value[option.key]) ||
47
+ reactivesearchFilterProps.value === option.key })));
25
48
  // work out if at least one option selected
26
- const hasSelected = (typeof value === "object" && 0 < Object.keys(value).length) ||
27
- (typeof value !== "object" && !!value);
49
+ const hasSelected = (typeof reactivesearchFilterProps.value === "object" &&
50
+ 0 < Object.keys(reactivesearchFilterProps.value).length) ||
51
+ (typeof reactivesearchFilterProps.value !== "object" &&
52
+ !!reactivesearchFilterProps.value);
28
53
  const totalSelected = options.filter((option) => option.checked).length;
29
- return Object.assign(Object.assign({}, reactivesearchFilterProps), { filter,
54
+ return Object.assign(Object.assign({}, reactivesearchFilterProps), { handleChange,
55
+ filter,
30
56
  options,
31
57
  hasSelected,
32
58
  totalSelected });
33
- }, [filter, reactivesearchFilterProps]);
59
+ }, [filter, handleChange, reactivesearchFilterProps]);
60
+ return filterListProps;
34
61
  };
35
62
  exports.useFilterListProps = useFilterListProps;
36
63
  //# sourceMappingURL=useFilterListProps.js.map