@usereactify/search 5.53.0 → 5.55.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/package.json +2 -2
  3. package/dist/src/components/ClearAll/ClearAll.d.ts +1 -1
  4. package/dist/src/components/ClearAll/ClearAll.js +3 -2
  5. package/dist/src/components/ClearAll/ClearAll.js.map +1 -1
  6. package/dist/src/components/ClearAll/index.js +5 -1
  7. package/dist/src/components/ClearAll/index.js.map +1 -1
  8. package/dist/src/components/CustomComponent/CustomComponent.d.ts +1 -1
  9. package/dist/src/components/CustomComponent/index.js +5 -1
  10. package/dist/src/components/CustomComponent/index.js.map +1 -1
  11. package/dist/src/components/Example/ExampleClearAll.d.ts +1 -1
  12. package/dist/src/components/Example/ExampleFilterList.d.ts +1 -1
  13. package/dist/src/components/Example/ExampleFilterRange.d.ts +1 -1
  14. package/dist/src/components/Example/ExampleFilterSlider.d.ts +1 -1
  15. package/dist/src/components/Example/ExampleFiltersSelected.d.ts +1 -1
  16. package/dist/src/components/Example/ExampleHookUseResults.js.map +1 -1
  17. package/dist/src/components/Example/ExampleResultCardCallout.d.ts +1 -1
  18. package/dist/src/components/Example/ExampleResultCardProduct.d.ts +1 -1
  19. package/dist/src/components/Example/ExampleResultPaginationInfiniteScroll.d.ts +1 -1
  20. package/dist/src/components/Example/ExampleResultPaginationInfiniteScroll.js.map +1 -1
  21. package/dist/src/components/Example/ExampleResultPaginationLoadMore.d.ts +1 -1
  22. package/dist/src/components/Example/ExampleResultPaginationNextPrev.d.ts +1 -1
  23. package/dist/src/components/Example/ExampleResultPaginationNumbered.d.ts +1 -1
  24. package/dist/src/components/Example/ExampleSearch.d.ts +1 -1
  25. package/dist/src/components/Example/ExampleSortBy.d.ts +1 -1
  26. package/dist/src/components/Example/ExampleStats.d.ts +1 -1
  27. package/dist/src/components/Example/ExampleSuggestions.d.ts +1 -1
  28. package/dist/src/components/Example/index.js +5 -1
  29. package/dist/src/components/Example/index.js.map +1 -1
  30. package/dist/src/components/Filter/Filter.d.ts +1 -1
  31. package/dist/src/components/Filter/Filter.js.map +1 -1
  32. package/dist/src/components/Filter/Filters.d.ts +1 -1
  33. package/dist/src/components/Filter/FiltersSelected.d.ts +1 -1
  34. package/dist/src/components/Filter/FiltersSelected.js +3 -2
  35. package/dist/src/components/Filter/FiltersSelected.js.map +1 -1
  36. package/dist/src/components/Filter/index.js +5 -1
  37. package/dist/src/components/Filter/index.js.map +1 -1
  38. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.d.ts +1 -1
  39. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js +5 -1
  40. package/dist/src/components/ReactifySearchProvider/ReactifySearchProvider.js.map +1 -1
  41. package/dist/src/components/ReactifySearchProvider/index.js +5 -1
  42. package/dist/src/components/ReactifySearchProvider/index.js.map +1 -1
  43. package/dist/src/components/Result/ResultCardCallout.d.ts +1 -1
  44. package/dist/src/components/Result/ResultCardCallout.js.map +1 -1
  45. package/dist/src/components/Result/ResultCardProduct.d.ts +1 -1
  46. package/dist/src/components/Result/ResultCardProduct.js.map +1 -1
  47. package/dist/src/components/Result/ResultPaginationInfiniteScroll.d.ts +1 -1
  48. package/dist/src/components/Result/ResultPaginationLoadMore.d.ts +1 -1
  49. package/dist/src/components/Result/ResultPaginationNextPrev.d.ts +1 -1
  50. package/dist/src/components/Result/ResultPaginationNumbered.d.ts +1 -1
  51. package/dist/src/components/Result/ResultPaginationNumbered.js.map +1 -1
  52. package/dist/src/components/Result/ResultStateProvider.d.ts +1 -1
  53. package/dist/src/components/Result/Results.d.ts +2 -2
  54. package/dist/src/components/Result/Results.js.map +1 -1
  55. package/dist/src/components/Result/index.js +5 -1
  56. package/dist/src/components/Result/index.js.map +1 -1
  57. package/dist/src/components/Search/Search.d.ts +1 -1
  58. package/dist/src/components/Search/index.js +5 -1
  59. package/dist/src/components/Search/index.js.map +1 -1
  60. package/dist/src/components/Sensor/SensorCollection.js.map +1 -1
  61. package/dist/src/components/Sensor/SensorInventoryAvailable.js.map +1 -1
  62. package/dist/src/components/Sensor/SensorPublished.js.map +1 -1
  63. package/dist/src/components/Sensor/SensorSearchTerm.js.map +1 -1
  64. package/dist/src/components/Sensor/SensorSort.js.map +1 -1
  65. package/dist/src/components/Sensor/Sensors.d.ts +1 -1
  66. package/dist/src/components/Sensor/Sensors.js.map +1 -1
  67. package/dist/src/components/Sensor/index.js +5 -1
  68. package/dist/src/components/Sensor/index.js.map +1 -1
  69. package/dist/src/components/SortBy/SortBy.d.ts +1 -1
  70. package/dist/src/components/SortBy/index.js +5 -1
  71. package/dist/src/components/SortBy/index.js.map +1 -1
  72. package/dist/src/components/Stats/Stats.d.ts +1 -1
  73. package/dist/src/components/Stats/index.js +5 -1
  74. package/dist/src/components/Stats/index.js.map +1 -1
  75. package/dist/src/components/Suggestions/Suggestions.d.ts +1 -1
  76. package/dist/src/components/Suggestions/Suggestions.js.map +1 -1
  77. package/dist/src/components/Suggestions/index.js +5 -1
  78. package/dist/src/components/Suggestions/index.js.map +1 -1
  79. package/dist/src/components/Utility/UtilityAuthenticatedReactiveBase.d.ts +1 -1
  80. package/dist/src/components/Utility/index.js +5 -1
  81. package/dist/src/components/Utility/index.js.map +1 -1
  82. package/dist/src/components/index.js +5 -1
  83. package/dist/src/components/index.js.map +1 -1
  84. package/dist/src/hooks/index.js +5 -1
  85. package/dist/src/hooks/index.js.map +1 -1
  86. package/dist/src/hooks/reactivesearch/index.js +5 -1
  87. package/dist/src/hooks/reactivesearch/index.js.map +1 -1
  88. package/dist/src/hooks/reactivesearch/useReactiveBaseProps.js.map +1 -1
  89. package/dist/src/hooks/useAnalytics.d.ts +1 -1
  90. package/dist/src/hooks/useAnalytics.js +2 -2
  91. package/dist/src/hooks/useAnalytics.js.map +1 -1
  92. package/dist/src/hooks/useConfig.d.ts +1 -1
  93. package/dist/src/hooks/useConfig.js +1 -12
  94. package/dist/src/hooks/useConfig.js.map +1 -1
  95. package/dist/src/hooks/useCuration.d.ts +1 -1
  96. package/dist/src/hooks/useCuration.js.map +1 -1
  97. package/dist/src/hooks/useDebugger.d.ts +1 -0
  98. package/dist/src/hooks/useDebugger.js +12 -1
  99. package/dist/src/hooks/useDebugger.js.map +1 -1
  100. package/dist/src/hooks/useFilterListProps.js.map +1 -1
  101. package/dist/src/hooks/useFilterRangeProps.js +4 -3
  102. package/dist/src/hooks/useFilterRangeProps.js.map +1 -1
  103. package/dist/src/hooks/useFilterSliderProps.js +4 -3
  104. package/dist/src/hooks/useFilterSliderProps.js.map +1 -1
  105. package/dist/src/hooks/useFilters.d.ts +2 -2
  106. package/dist/src/hooks/useFilters.js +0 -3
  107. package/dist/src/hooks/useFilters.js.map +1 -1
  108. package/dist/src/hooks/useFlags.js +2 -4
  109. package/dist/src/hooks/useFlags.js.map +1 -1
  110. package/dist/src/hooks/useIndices.d.ts +1 -1
  111. package/dist/src/hooks/useIndices.js.map +1 -1
  112. package/dist/src/hooks/usePagination.d.ts +3 -3
  113. package/dist/src/hooks/usePagination.js.map +1 -1
  114. package/dist/src/hooks/usePaginationLoadable.js.map +1 -1
  115. package/dist/src/hooks/useProductPrice.js.map +1 -1
  116. package/dist/src/hooks/useReactifySearchContext.d.ts +21 -21
  117. package/dist/src/hooks/useResults.d.ts +1 -9
  118. package/dist/src/hooks/useResults.js +9 -7
  119. package/dist/src/hooks/useResults.js.map +1 -1
  120. package/dist/src/hooks/useSearch.d.ts +10 -3
  121. package/dist/src/hooks/useSearch.js +11 -5
  122. package/dist/src/hooks/useSearch.js.map +1 -1
  123. package/dist/src/hooks/useSortBy.d.ts +2 -2
  124. package/dist/src/hooks/useSortBy.js +0 -2
  125. package/dist/src/hooks/useSortBy.js.map +1 -1
  126. package/dist/src/index.js +5 -1
  127. package/dist/src/index.js.map +1 -1
  128. package/dist/src/types/config.d.ts +10 -10
  129. package/dist/src/types/elastic.d.ts +6 -6
  130. package/dist/src/types/elastic.js +2 -2
  131. package/dist/src/types/elastic.js.map +1 -1
  132. package/dist/src/types/firestore.d.ts +6 -6
  133. package/dist/src/types/firestore.js +15 -15
  134. package/dist/src/types/firestore.js.map +1 -1
  135. package/dist/src/types/graphql.d.ts +3204 -3204
  136. package/dist/src/types/graphql.js +445 -445
  137. package/dist/src/types/graphql.js.map +1 -1
  138. package/dist/src/types/index.js +5 -1
  139. package/dist/src/types/index.js.map +1 -1
  140. package/dist/src/types/shopify.d.ts +14 -14
  141. package/dist/src/types/shopify.js +7 -7
  142. package/dist/src/types/shopify.js.map +1 -1
  143. package/dist/src/utility/config.js.map +1 -1
  144. package/dist/src/utility/curation.js.map +1 -1
  145. package/dist/src/utility/debug.d.ts +2 -1
  146. package/dist/src/utility/debug.js +1 -0
  147. package/dist/src/utility/debug.js.map +1 -1
  148. package/dist/src/utility/filters.js.map +1 -1
  149. package/dist/src/utility/index.js +5 -1
  150. package/dist/src/utility/index.js.map +1 -1
  151. package/dist/src/utility/liquid.js +3 -3
  152. package/dist/src/utility/liquid.js.map +1 -1
  153. package/dist/src/utility/props.d.ts +7 -8
  154. package/dist/src/utility/props.js +6 -6
  155. package/dist/src/utility/props.js.map +1 -1
  156. package/dist/src/utility/sortOption.js.map +1 -1
  157. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [5.55.0-beta.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/beta-v5.53.0-beta.3...beta-v5.55.0-beta.0) (2024-11-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * expose resultStats when using submitSearchQuery ([8bf0e5c](https://bitbucket.org/usereactify/reactify-search-ui/commit/8bf0e5cc218882c280b5e56e9b157c5ea46cf0d2))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * isolate window events to specific ReactifySearchProviders, reduce noisy logs ([c736499](https://bitbucket.org/usereactify/reactify-search-ui/commit/c73649997275513bfbbcc6581a7d1dfce4641c91))
16
+
17
+ ## [5.54.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.53.0...release-v5.54.0) (2024-10-23)
18
+
19
+
20
+ ### Features
21
+
22
+ * expose resultStats when using submitSearchQuery ([8bf0e5c](https://bitbucket.org/usereactify/reactify-search-ui/commit/8bf0e5cc218882c280b5e56e9b157c5ea46cf0d2))
23
+
5
24
  ## [5.53.0](https://bitbucket.org/usereactify/reactify-search-ui/compare/release-v5.52.0...release-v5.53.0) (2024-10-16)
6
25
 
7
26
 
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usereactify/search",
3
3
  "description": "React UI library for Reactify Search",
4
- "version": "5.53.0",
4
+ "version": "5.55.0-beta.0",
5
5
  "license": "MIT",
6
6
  "main": "dist/src/index.js",
7
7
  "types": "dist/src/index.d.ts",
@@ -63,6 +63,6 @@
63
63
  "react-dom": "18.2.0",
64
64
  "rimraf": "3.0.2",
65
65
  "standard-version": "9.3.1",
66
- "typescript": "4.4.3"
66
+ "typescript": "5.6.3"
67
67
  }
68
68
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- export declare type ClearAllProps = {
2
+ export type ClearAllProps = {
3
3
  /** Render method */
4
4
  render?: React.FC<{
5
5
  clearAll: () => void;
@@ -10,6 +10,7 @@ const components_1 = require("../../components");
10
10
  const hooks_1 = require("../../hooks");
11
11
  const ClearAll = (props) => {
12
12
  var _a;
13
+ const context = (0, hooks_1.useReactifySearchContext)();
13
14
  const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleClearAll;
14
15
  const filtersHook = (0, hooks_1.useFilters)();
15
16
  return (react_1.default.createElement(SelectedFilters_1.default, { render: (renderProps) => {
@@ -25,7 +26,7 @@ const ClearAll = (props) => {
25
26
  var _a;
26
27
  for (const filter of (_a = filtersHook.filters) !== null && _a !== void 0 ? _a : []) {
27
28
  if (filter.displayType === "slider") {
28
- const event = new CustomEvent(`@usereactify/search:filter:${filter.handle}:update`, {
29
+ const event = new CustomEvent(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {
29
30
  detail: {
30
31
  handle: filter.handle,
31
32
  value: [],
@@ -35,7 +36,7 @@ const ClearAll = (props) => {
35
36
  }
36
37
  if (filter.displayType === "multi") {
37
38
  if (filter.displayView === "range") {
38
- const event = new CustomEvent(`@usereactify/search:filter:${filter.handle}:update`, {
39
+ const event = new CustomEvent(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {
39
40
  detail: {
40
41
  handle: filter.handle,
41
42
  value: [],
@@ -1 +1 @@
1
- {"version":3,"file":"ClearAll.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/ClearAll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAEjG,iDAAmD;AACnD,uCAAyC;AAWlC,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;;IACzD,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,4BAAe,CAAC;IAExD,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,OAAO,CACL,8BAAC,yBAAe,IACd,MAAM,EAAE,CAAC,WAAW,EAAE,EAAE;YACtB,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC;iBAC9D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC;iBACrB,MAAM,CACL,CAAC,IAAS,EAAE,EAAE;;gBACZ,OAAA,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS;qBACf,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,UAAU,CAAA;oBAChB,CAAC,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,MAAM,CAAA,IAAI,CAAC,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,KAAK,CAAA,CAAC,CAAA;aAAA,CAClD,CAAC;YAEJ,MAAM,cAAc,GAAG,GAAG,EAAE;;gBAC1B,KAAK,MAAM,MAAM,IAAI,MAAA,WAAW,CAAC,OAAO,mCAAI,EAAE,EAAE;oBAC9C,IAAI,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE;wBACnC,MAAM,KAAK,GAAG,IAAI,WAAW,CAG1B,8BAA8B,MAAM,CAAC,MAAM,SAAS,EAAE;4BACvD,MAAM,EAAE;gCACN,MAAM,EAAE,MAAM,CAAC,MAAM;gCACrB,KAAK,EAAE,EAAE;6BACV;yBACF,CAAC,CAAC;wBACH,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;qBAC7B;oBACD,IAAI,MAAM,CAAC,WAAW,KAAK,OAAO,EAAE;wBAClC,IAAI,MAAM,CAAC,WAAW,KAAK,OAAO,EAAE;4BAClC,MAAM,KAAK,GAAG,IAAI,WAAW,CAG1B,8BAA8B,MAAM,CAAC,MAAM,SAAS,EAAE;gCACvD,MAAM,EAAE;oCACN,MAAM,EAAE,MAAM,CAAC,MAAM;oCACrB,KAAK,EAAE,EAAE;iCACV;6BACF,CAAC,CAAC;4BACH,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;yBAC7B;qBACF;iBACF;gBACD,WAAW,CAAC,WAAW,EAAE,CAAC;YAC5B,CAAC,CAAC;YAEF,IAAI,KAAK,CAAC,aAAa,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBAC3D,OAAO,IAAI,CAAC;aACb;YAED,OAAO,8BAAC,eAAe,IAAC,QAAQ,EAAE,cAAc,GAAI,CAAC;QACvD,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,QAAQ,YAyDnB","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@usereactify/search-internals/lib/components/basic/SelectedFilters\";\n\nimport { ExampleClearAll } from \"../../components\";\nimport { useFilters } from \"../../hooks\";\n\nexport type ClearAllProps = {\n /** Render method */\n render?: React.FC<{\n clearAll: () => void;\n }>;\n /** Render the component even when there are no filters selected (default: false) */\n showWhenEmpty?: boolean;\n};\n\nexport const ClearAll: React.FC<ClearAllProps> = (props) => {\n const RenderComponent = props.render ?? ExampleClearAll;\n\n const filtersHook = useFilters();\n\n return (\n <SelectedFilters\n render={(renderProps) => {\n const selectedFilters = Object.values(renderProps.selectedValues)\n .map((value) => value)\n .filter(\n (item: any) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n );\n\n const handleClearAll = () => {\n for (const filter of filtersHook.filters ?? []) {\n if (filter.displayType === \"slider\") {\n const event = new CustomEvent<{\n handle: string;\n value: [];\n }>(`@usereactify/search:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n }\n if (filter.displayType === \"multi\") {\n if (filter.displayView === \"range\") {\n const event = new CustomEvent<{\n handle: string;\n value: Array<string>;\n }>(`@usereactify/search:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n }\n }\n }\n renderProps.clearValues();\n };\n\n if (props.showWhenEmpty !== true && !selectedFilters.length) {\n return null;\n }\n\n return <RenderComponent clearAll={handleClearAll} />;\n }}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"ClearAll.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/ClearAll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAEjG,iDAAmD;AACnD,uCAAmE;AAW5D,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,EAAE;;IACzD,MAAM,OAAO,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC3C,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,4BAAe,CAAC;IAExD,MAAM,WAAW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G,IAAI,WAAW,CAG1B,uBAAuB,OAAO,CAAC,OAAO,CAAC,IAAI,WAAW,MAAM,CAAC,MAAM,SAAS,EAAE;gCAC/E,MAAM,EAAE;oCACN,MAAM,EAAE,MAAM,CAAC,MAAM;oCACrB,KAAK,EAAE,EAAE;iCACV;6BACF,CAAC,CAAC;4BACH,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;wBAC9B,CAAC;oBACH,CAAC;gBACH,CAAC;gBACD,WAAW,CAAC,WAAW,EAAE,CAAC;YAC5B,CAAC,CAAC;YAEF,IAAI,KAAK,CAAC,aAAa,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;gBAC5D,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,8BAAC,eAAe,IAAC,QAAQ,EAAE,cAAc,GAAI,CAAC;QACvD,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,QAAQ,YA0DnB","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@usereactify/search-internals/lib/components/basic/SelectedFilters\";\n\nimport { ExampleClearAll } from \"../../components\";\nimport { useFilters, useReactifySearchContext } from \"../../hooks\";\n\nexport type ClearAllProps = {\n /** Render method */\n render?: React.FC<{\n clearAll: () => void;\n }>;\n /** Render the component even when there are no filters selected (default: false) */\n showWhenEmpty?: boolean;\n};\n\nexport const ClearAll: React.FC<ClearAllProps> = (props) => {\n const context = useReactifySearchContext();\n const RenderComponent = props.render ?? ExampleClearAll;\n\n const filtersHook = useFilters();\n\n return (\n <SelectedFilters\n render={(renderProps) => {\n const selectedFilters = Object.values(renderProps.selectedValues)\n .map((value) => value)\n .filter(\n (item: any) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n );\n\n const handleClearAll = () => {\n for (const filter of filtersHook.filters ?? []) {\n if (filter.displayType === \"slider\") {\n const event = new CustomEvent<{\n handle: string;\n value: [];\n }>(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n }\n if (filter.displayType === \"multi\") {\n if (filter.displayView === \"range\") {\n const event = new CustomEvent<{\n handle: string;\n value: Array<string>;\n }>(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n }\n }\n }\n renderProps.clearValues();\n };\n\n if (props.showWhenEmpty !== true && !selectedFilters.length) {\n return null;\n }\n\n return <RenderComponent clearAll={handleClearAll} />;\n }}\n />\n );\n};\n"]}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA2B","sourcesContent":["export * from \"./ClearAll\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ClearAll/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B","sourcesContent":["export * from \"./ClearAll\";\n"]}
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import ReactiveComponent from "@usereactify/search-internals/lib/components/basic/ReactiveComponent";
3
- export declare type CustomComponentProps = React.ComponentProps<typeof ReactiveComponent>;
3
+ export type CustomComponentProps = React.ComponentProps<typeof ReactiveComponent>;
4
4
  export declare const CustomComponent: React.FC<CustomComponentProps>;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/CustomComponent/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC","sourcesContent":["export * from \"./CustomComponent\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/CustomComponent/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC","sourcesContent":["export * from \"./CustomComponent\";\n"]}
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { ClearAllProps } from "../../components";
3
- export declare type ExampleClearAllProps = React.ComponentProps<NonNullable<ClearAllProps["render"]>>;
3
+ export type ExampleClearAllProps = React.ComponentProps<NonNullable<ClearAllProps["render"]>>;
4
4
  export declare const ExampleClearAll: React.FC<ExampleClearAllProps>;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { FilterProps } from "../../components";
3
- export declare type ExampleFilterListProps = React.ComponentProps<NonNullable<FilterProps["renderFilterList"]>>;
3
+ export type ExampleFilterListProps = React.ComponentProps<NonNullable<FilterProps["renderFilterList"]>>;
4
4
  export declare const ExampleFilterList: React.FC<ExampleFilterListProps>;
5
5
  export declare const ExampleFilterListList: React.FC<ExampleFilterListProps>;
6
6
  export declare const ExampleFilterListRadio: React.FC<ExampleFilterListProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { FilterProps } from "../../components";
3
- export declare type ExampleFilterRangeProps = React.ComponentProps<NonNullable<FilterProps["renderFilterRange"]>>;
3
+ export type ExampleFilterRangeProps = React.ComponentProps<NonNullable<FilterProps["renderFilterRange"]>>;
4
4
  export declare const ExampleFilterRange: React.FC<ExampleFilterRangeProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { FilterProps } from "../../components";
3
- export declare type ExampleFilterSliderProps = React.ComponentProps<NonNullable<FilterProps["renderFilterSlider"]>>;
3
+ export type ExampleFilterSliderProps = React.ComponentProps<NonNullable<FilterProps["renderFilterSlider"]>>;
4
4
  export declare const ExampleFilterSlider: React.FC<ExampleFilterSliderProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { FiltersSelectedProps } from "../../components";
3
- export declare type ExampleFiltersSelectedProps = React.ComponentProps<NonNullable<FiltersSelectedProps["render"]>>;
3
+ export type ExampleFiltersSelectedProps = React.ComponentProps<NonNullable<FiltersSelectedProps["render"]>>;
4
4
  export declare const ExampleFiltersSelected: React.FC<ExampleFiltersSelectedProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleHookUseResults.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleHookUseResults.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAyC;AACzC,uCAAkD;AAE3C,MAAM,qBAAqB,GAAa,GAAG,EAAE;IAClD,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO;SACpC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACd,IAAI,MAAM,CAAC,IAAI,KAAK,2BAAmB,CAAC,OAAO,EAAE;YAC/C,OAAO,MAAM,CAAC,WAAW,CAAC;SAC3B;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;SACD,IAAI,EAAE;SACN,MAAM,CACL,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACpB,IAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,EAAE,OAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAA,CAAC,KAAK,KAAK,CACxE,CAAC;IAEJ,OAAO,CACL,0CACG,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAC/B;QACE,qCAAG,IAAI,EAAE,gBAAgB,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,EAAE,IAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAK,CACnE,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,qBAAqB,yBA0BhC","sourcesContent":["import React from \"react\";\n\nimport { useResults } from \"../../hooks\";\nimport { ElasticDocumentType } from \"../../types\";\n\nexport const ExampleHookUseResults: React.FC = () => {\n const resultsHook = useResults();\n\n const collections = resultsHook.results\n .map((result) => {\n if (result.type === ElasticDocumentType.Product) {\n return result.collections;\n }\n\n return [];\n })\n .flat()\n .filter(\n (item, index, self) =>\n self.findIndex((itemNested) => itemNested?.id === item?.id) === index\n );\n\n return (\n <ul>\n {collections.map((collection) => (\n <li>\n <a href={`/collections/${collection?.handle}`}>{collection?.title}</a>\n </li>\n ))}\n </ul>\n );\n};\n"]}
1
+ {"version":3,"file":"ExampleHookUseResults.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleHookUseResults.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,uCAAyC;AACzC,uCAAkD;AAE3C,MAAM,qBAAqB,GAAa,GAAG,EAAE;IAClD,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO;SACpC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACd,IAAI,MAAM,CAAC,IAAI,KAAK,2BAAmB,CAAC,OAAO,EAAE,CAAC;YAChD,OAAO,MAAM,CAAC,WAAW,CAAC;QAC5B,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;SACD,IAAI,EAAE;SACN,MAAM,CACL,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CACpB,IAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,EAAE,OAAK,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAA,CAAC,KAAK,KAAK,CACxE,CAAC;IAEJ,OAAO,CACL,0CACG,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAC/B;QACE,qCAAG,IAAI,EAAE,gBAAgB,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,EAAE,IAAG,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAK,CACnE,CACN,CAAC,CACC,CACN,CAAC;AACJ,CAAC,CAAC;AA1BW,QAAA,qBAAqB,yBA0BhC","sourcesContent":["import React from \"react\";\n\nimport { useResults } from \"../../hooks\";\nimport { ElasticDocumentType } from \"../../types\";\n\nexport const ExampleHookUseResults: React.FC = () => {\n const resultsHook = useResults();\n\n const collections = resultsHook.results\n .map((result) => {\n if (result.type === ElasticDocumentType.Product) {\n return result.collections;\n }\n\n return [];\n })\n .flat()\n .filter(\n (item, index, self) =>\n self.findIndex((itemNested) => itemNested?.id === item?.id) === index\n );\n\n return (\n <ul>\n {collections.map((collection) => (\n <li>\n <a href={`/collections/${collection?.handle}`}>{collection?.title}</a>\n </li>\n ))}\n </ul>\n );\n};\n"]}
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { ResultCardCalloutProps } from "../../components";
3
- export declare type ExampleResultCardCalloutProps = React.ComponentProps<NonNullable<ResultCardCalloutProps["render"]>>;
3
+ export type ExampleResultCardCalloutProps = React.ComponentProps<NonNullable<ResultCardCalloutProps["render"]>>;
4
4
  export declare const ExampleResultCardCallout: React.FC<ExampleResultCardCalloutProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { ResultCardProductProps } from "../../components";
3
- export declare type ExampleResultCardProductProps = React.ComponentProps<NonNullable<ResultCardProductProps["render"]>>;
3
+ export type ExampleResultCardProductProps = React.ComponentProps<NonNullable<ResultCardProductProps["render"]>>;
4
4
  export declare const ExampleResultCardProduct: React.FC<ExampleResultCardProductProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { ResultPaginationInfiniteScrollProps } from "../../components";
3
- export declare type ExampleResultPaginationInfiniteScrollProps = React.ComponentProps<NonNullable<ResultPaginationInfiniteScrollProps["render"]>>;
3
+ export type ExampleResultPaginationInfiniteScrollProps = React.ComponentProps<NonNullable<ResultPaginationInfiniteScrollProps["render"]>>;
4
4
  export declare const ExampleResultPaginationInfiniteScroll: React.FC<ExampleResultPaginationInfiniteScrollProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResultPaginationInfiniteScroll.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleResultPaginationInfiniteScroll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,qCAAqC,GAChD,CAAC,KAAK,EAAE,EAAE;IACR,IAAI,KAAK,CAAC,OAAO,EAAE;QACjB,OAAO,CACL,uCAAK,SAAS,EAAC,wCAAwC,IACpD,YAAY,CACT,CACP,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVS,QAAA,qCAAqC,yCAU9C","sourcesContent":["import React from \"react\";\n\nimport { ResultPaginationInfiniteScrollProps } from \"../../components\";\n\nexport type ExampleResultPaginationInfiniteScrollProps = React.ComponentProps<\n NonNullable<ResultPaginationInfiniteScrollProps[\"render\"]>\n>;\n\nexport const ExampleResultPaginationInfiniteScroll: React.FC<ExampleResultPaginationInfiniteScrollProps> =\n (props) => {\n if (props.loading) {\n return (\n <div className=\"rs__pagination__infinitescroll-loading\">\n {\"Loading...\"}\n </div>\n );\n }\n return null;\n };\n"]}
1
+ {"version":3,"file":"ExampleResultPaginationInfiniteScroll.js","sourceRoot":"","sources":["../../../../src/components/Example/ExampleResultPaginationInfiniteScroll.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,qCAAqC,GAChD,CAAC,KAAK,EAAE,EAAE;IACR,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,CACL,uCAAK,SAAS,EAAC,wCAAwC,IACpD,YAAY,CACT,CACP,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAVS,QAAA,qCAAqC,yCAU9C","sourcesContent":["import React from \"react\";\n\nimport { ResultPaginationInfiniteScrollProps } from \"../../components\";\n\nexport type ExampleResultPaginationInfiniteScrollProps = React.ComponentProps<\n NonNullable<ResultPaginationInfiniteScrollProps[\"render\"]>\n>;\n\nexport const ExampleResultPaginationInfiniteScroll: React.FC<ExampleResultPaginationInfiniteScrollProps> =\n (props) => {\n if (props.loading) {\n return (\n <div className=\"rs__pagination__infinitescroll-loading\">\n {\"Loading...\"}\n </div>\n );\n }\n return null;\n };\n"]}
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { ResultPaginationLoadMoreProps } from "../../components";
3
- export declare type ExampleResultPaginationLoadMoreProps = React.ComponentProps<NonNullable<ResultPaginationLoadMoreProps["render"]>>;
3
+ export type ExampleResultPaginationLoadMoreProps = React.ComponentProps<NonNullable<ResultPaginationLoadMoreProps["render"]>>;
4
4
  export declare const ExampleResultPaginationLoadMore: React.FC<ExampleResultPaginationLoadMoreProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { ResultPaginationNextPrevProps } from "../../components";
3
- export declare type ExampleResultPaginationNextPrevProps = React.ComponentProps<NonNullable<ResultPaginationNextPrevProps["render"]>>;
3
+ export type ExampleResultPaginationNextPrevProps = React.ComponentProps<NonNullable<ResultPaginationNextPrevProps["render"]>>;
4
4
  export declare const ExampleResultPaginationNextPrev: React.FC<ExampleResultPaginationNextPrevProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { ResultPaginationNumberedProps } from "../../components";
3
- export declare type ExampleResultPaginationNumberedProps = React.ComponentProps<NonNullable<ResultPaginationNumberedProps["render"]>>;
3
+ export type ExampleResultPaginationNumberedProps = React.ComponentProps<NonNullable<ResultPaginationNumberedProps["render"]>>;
4
4
  export declare const ExampleResultPaginationNumbered: React.FC<ExampleResultPaginationNumberedProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { SearchProps } from "../../components";
3
- export declare type ExampleSearchProps = React.ComponentProps<NonNullable<SearchProps["render"]>>;
3
+ export type ExampleSearchProps = React.ComponentProps<NonNullable<SearchProps["render"]>>;
4
4
  export declare const ExampleSearch: React.FC<ExampleSearchProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { SortByProps } from "../../components";
3
- export declare type ExampleSortByProps = React.ComponentProps<NonNullable<SortByProps["render"]>>;
3
+ export type ExampleSortByProps = React.ComponentProps<NonNullable<SortByProps["render"]>>;
4
4
  export declare const ExampleSortBy: React.FC<ExampleSortByProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { StatsProps } from "../../components";
3
- export declare type ExampleStatsProps = React.ComponentProps<NonNullable<StatsProps["render"]>>;
3
+ export type ExampleStatsProps = React.ComponentProps<NonNullable<StatsProps["render"]>>;
4
4
  export declare const ExampleStats: React.FC<ExampleStatsProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { SuggestionsProps } from "../../components";
3
- export declare type ExampleSuggestionsProps = React.ComponentProps<NonNullable<SuggestionsProps["render"]>>;
3
+ export type ExampleSuggestionsProps = React.ComponentProps<NonNullable<SuggestionsProps["render"]>>;
4
4
  export declare const ExampleSuggestions: React.FC<ExampleSuggestionsProps>;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Example/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,mDAAiC;AACjC,2DAAyC;AACzC,4EAA0D;AAC1D,+EAA6D;AAC7D,wEAAsD;AACtD,6DAA2C;AAC3C,6DAA2C;AAC3C,oEAAkD;AAClD,oEAAkD;AAClD,0EAAwD;AACxD,oEAAkD;AAClD,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;AAC/B,uDAAqC;AAErC,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;AACvC,yDAAuC","sourcesContent":["export * from \"./ExampleClearAll\";\nexport * from \"./ExampleCustomComponent\";\nexport * from \"./ExampleFilterList\";\nexport * from \"./ExampleFilterRange\";\nexport * from \"./ExampleFilterSlider\";\nexport * from \"./ExampleFilters\";\nexport * from \"./ExampleFiltersSelected\";\nexport * from \"./ExampleReactiveSearchProviderCollection\";\nexport * from \"./ExampleReactiveSearchProviderInstantSearch\";\nexport * from \"./ExampleReactiveSearchProviderSearch\";\nexport * from \"./ExampleResultCardCallout\";\nexport * from \"./ExampleResultCardProduct\";\nexport * from \"./ExampleResultPaginationNumbered\";\nexport * from \"./ExampleResultPaginationLoadMore\";\nexport * from \"./ExampleResultPaginationInfiniteScroll\";\nexport * from \"./ExampleResultPaginationNextPrev\";\nexport * from \"./ExampleSearch\";\nexport * from \"./ExampleSortBy\";\nexport * from \"./ExampleStats\";\nexport * from \"./ExampleSuggestions\";\n\nexport * from \"./ExampleHookUseFilters\";\nexport * from \"./ExampleHookUseResults\";\nexport * from \"./ExampleHookUseSearch\";\nexport * from \"./ExampleHookUseSortBy\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Example/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,2DAAyC;AACzC,sDAAoC;AACpC,uDAAqC;AACrC,wDAAsC;AACtC,mDAAiC;AACjC,2DAAyC;AACzC,4EAA0D;AAC1D,+EAA6D;AAC7D,wEAAsD;AACtD,6DAA2C;AAC3C,6DAA2C;AAC3C,oEAAkD;AAClD,oEAAkD;AAClD,0EAAwD;AACxD,oEAAkD;AAClD,kDAAgC;AAChC,kDAAgC;AAChC,iDAA+B;AAC/B,uDAAqC;AAErC,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;AACvC,yDAAuC","sourcesContent":["export * from \"./ExampleClearAll\";\nexport * from \"./ExampleCustomComponent\";\nexport * from \"./ExampleFilterList\";\nexport * from \"./ExampleFilterRange\";\nexport * from \"./ExampleFilterSlider\";\nexport * from \"./ExampleFilters\";\nexport * from \"./ExampleFiltersSelected\";\nexport * from \"./ExampleReactiveSearchProviderCollection\";\nexport * from \"./ExampleReactiveSearchProviderInstantSearch\";\nexport * from \"./ExampleReactiveSearchProviderSearch\";\nexport * from \"./ExampleResultCardCallout\";\nexport * from \"./ExampleResultCardProduct\";\nexport * from \"./ExampleResultPaginationNumbered\";\nexport * from \"./ExampleResultPaginationLoadMore\";\nexport * from \"./ExampleResultPaginationInfiniteScroll\";\nexport * from \"./ExampleResultPaginationNextPrev\";\nexport * from \"./ExampleSearch\";\nexport * from \"./ExampleSortBy\";\nexport * from \"./ExampleStats\";\nexport * from \"./ExampleSuggestions\";\n\nexport * from \"./ExampleHookUseFilters\";\nexport * from \"./ExampleHookUseResults\";\nexport * from \"./ExampleHookUseSearch\";\nexport * from \"./ExampleHookUseSortBy\";\n"]}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import type { ConfigFilterFacet } from "../../types";
3
3
  import { useFilterListProps, useFilterRangeProps, useFilterSliderProps } from "../../hooks";
4
- export declare type FilterProps = {
4
+ export type FilterProps = {
5
5
  /** The filter option being rendered */
6
6
  filter: ConfigFilterFacet;
7
7
  /** Render method for List filters */
@@ -1 +1 @@
1
- {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,6HAAqG;AACrG,4GAAoF;AACpF,8GAAsF;AACtF,iHAAyF;AACzF,+GAAuF;AAMvF,uCAMqB;AACrB,iDAI0B;AAC1B,+CAA8F;AAyBvF,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACzC,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;YACxC,OAAO,8BAAC,iBAAiB,oBAAK,KAAK,EAAI,CAAC;SACzC;QACD,OAAO,8BAAC,gBAAgB,oBAAK,KAAK,EAAI,CAAC;KACxC;IAED,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;QACxC,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;YACxC,OAAO,8BAAC,gBAAgB,oBAAK,KAAK,EAAI,CAAC;SACxC;QACD,OAAO,8BAAC,eAAe,oBAAK,KAAK,EAAI,CAAC;KACvC;IAED,IAAI,QAAQ,KAAK,KAAK,CAAC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CAAC,CAAC;IACL,CAAC,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9B,MAAM,mBAAmB,GAAG,MAAA,KAAK,CAAC,kBAAkB,mCAAI,gCAAmB,CAAC;IAE5E,OAAO,CACL,8BAAC,mBAAmB,kBAClB,iBAAiB,EAAE,iBAAiB,EACpC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,qFAAqF;AACrF,MAAM,eAAe,GAEjB,CAAC,KAAK,EAAE,EAAE;;IACZ,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,yBAAyB,KACzD,KAAK,EADyD,UAAU,UACxE,KAAK,EADD,2DAAsE,CACrE,CAAC;IAER,MAAM,eAAe,GAAG,IAAA,0BAAkB,EAAC,MAAM,EAAE,yBAAyB,CAAC,CAAC;IAE9E,+CAA+C;IAC/C,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAAC,KAAK,eAAe,CAAC,OAAO,CAAC,MAAM,EAAE;QACnE,OAAO,IAAI,CAAC;KACb;IAED,MAAM,mBAAmB,GAAG,MAAA,KAAK,CAAC,gBAAgB,mCAAI,8BAAiB,CAAC;IAExE,OAAO,CACL,8BAAC,mBAAmB,kBAClB,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,IACV,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport ReactiveComponent from \"@usereactify/search-internals/lib/components/basic/ReactiveComponent\";\nimport MultiList from \"@usereactify/search-internals/lib/components/list/MultiList\";\nimport SingleList from \"@usereactify/search-internals/lib/components/list/SingleList\";\nimport SingleRange from \"@usereactify/search-internals/lib/components/range/SingleRange\";\nimport MultiRange from \"@usereactify/search-internals/lib/components/range/MultiRange\";\n\nimport type {\n ConfigFilterFacet,\n ReactivesearchFilterListProps,\n} from \"../../types\";\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilterSliderProps,\n useFilters,\n useReactifySearchContext,\n} from \"../../hooks\";\nimport {\n ExampleFilterList,\n ExampleFilterRange,\n ExampleFilterSlider,\n} from \"../../components\";\nimport { getPropsFilterList, getPropsFilterRange, getPropsShared } from \"../../utility/props\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterFacet;\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterFacet;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterFacet;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterFacet;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n // reactSliderProps: ReturnType<typeof useReactSliderProps>;\n }>;\n /** Show filters even when no options are available */\n showEmptyFilters?: boolean;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeSingle {...props} />;\n }\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeMulti {...props} />;\n }\n return <FilterMultiList {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n // TODO: Legacy range filter, migrate to new single and multi ranges\n if (\"range\" === props.filter.displayType) {\n return <FilterRangeSingle {...props} />;\n }\n\n console.warn(\n `filter with display type \"${props.filter.displayType}\" not yet supported`\n );\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterList(props.filter);\n\n return (\n <SingleList\n {...sharedProps}\n {...reactiveProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterList(props.filter);\n\n return (\n <MultiList\n {...sharedProps}\n {...reactiveProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterRangeSingle: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterRange(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <SingleRange\n {...sharedProps}\n {...reactiveProps}\n value={filterRangeProps.values[0]}\n onChange={filterRangeProps.handleChange}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterRangeMulti: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterRange(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <MultiRange\n {...sharedProps}\n {...reactiveProps}\n value={filterRangeProps.values}\n // @note: onChange handler must be defined for controlled component to work correctly\n onChange={() => {}}\n onValueChange={(values) => {\n if (values.length === 0) {\n filterRangeProps.handleClear();\n }\n }}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n\n return (\n <ReactiveComponent\n {...sharedProps}\n defaultQuery={() => ({\n aggs: {\n min: {\n min: {\n field: props.filter.field,\n },\n },\n max: {\n max: {\n field: props.filter.field,\n },\n },\n },\n })}\n render={(reactivesearchFilterProps) => {\n if (\n !props.showEmptyFilters &&\n reactivesearchFilterProps?.aggregations?.min?.value ===\n reactivesearchFilterProps?.aggregations?.max?.value\n ) {\n return null;\n }\n\n return (\n <FilterSliderInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n );\n }}\n />\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterSliderInner: React.FC<\n FilterProps & { reactivesearchFilterProps: any }\n> = (props) => {\n const {\n filter,\n renderFilterSlider,\n reactivesearchFilterProps,\n ...otherProps\n } = props;\n\n const filterSliderProps = useFilterSliderProps(filter);\n\n React.useEffect(() => {\n if (reactivesearchFilterProps.aggregations) {\n filterSliderProps.handleRange([\n reactivesearchFilterProps.aggregations.min.value,\n reactivesearchFilterProps.aggregations.max.value,\n ]);\n }\n }, [\n reactivesearchFilterProps.aggregations?.min.value,\n reactivesearchFilterProps.aggregations?.max.value,\n ]);\n\n React.useEffect(() => {\n if (filterSliderProps.value[0] === 0 && filterSliderProps.value[1] === 0) {\n return;\n }\n\n props.reactivesearchFilterProps.setQuery({\n query: {\n query: {\n bool: {\n must: [\n {\n bool: {\n must: [\n {\n match: {\n published: true,\n },\n },\n {\n range: {\n [props.filter.field]: {\n gte: filterSliderProps.value[0],\n lte: filterSliderProps.value[1],\n boost: 2,\n },\n },\n },\n ],\n },\n },\n ],\n },\n },\n },\n value: filterSliderProps.value,\n });\n }, [filterSliderProps.value]);\n\n const RenderListComponent = props.renderFilterSlider ?? ExampleFilterSlider;\n\n return (\n <RenderListComponent\n filterSliderProps={filterSliderProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterListProps }\n> = (props) => {\n const { filter, renderFilterList, reactivesearchFilterProps, ...otherProps } =\n props;\n\n const filterListProps = useFilterListProps(filter, reactivesearchFilterProps);\n\n // hide entire filter when no options available\n if (!props.showEmptyFilters && 0 === filterListProps.options.length) {\n return null;\n }\n\n const RenderListComponent = props.renderFilterList ?? ExampleFilterList;\n\n return (\n <RenderListComponent\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"Filter.js","sourceRoot":"","sources":["../../../../src/components/Filter/Filter.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,6HAAqG;AACrG,4GAAoF;AACpF,8GAAsF;AACtF,iHAAyF;AACzF,+GAAuF;AAMvF,uCAMqB;AACrB,iDAI0B;AAC1B,+CAA8F;AAyBvF,MAAM,MAAM,GAA0B,CAAC,KAAK,EAAE,EAAE;IACrD,IAAI,QAAQ,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,OAAO,KAAK,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YACzC,OAAO,8BAAC,iBAAiB,oBAAK,KAAK,EAAI,CAAC;QAC1C,CAAC;QACD,OAAO,8BAAC,gBAAgB,oBAAK,KAAK,EAA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,UAAU,EACd,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport ReactiveComponent from \"@usereactify/search-internals/lib/components/basic/ReactiveComponent\";\nimport MultiList from \"@usereactify/search-internals/lib/components/list/MultiList\";\nimport SingleList from \"@usereactify/search-internals/lib/components/list/SingleList\";\nimport SingleRange from \"@usereactify/search-internals/lib/components/range/SingleRange\";\nimport MultiRange from \"@usereactify/search-internals/lib/components/range/MultiRange\";\n\nimport type {\n ConfigFilterFacet,\n ReactivesearchFilterListProps,\n} from \"../../types\";\nimport {\n useFilterListProps,\n useFilterRangeProps,\n useFilterSliderProps,\n useFilters,\n useReactifySearchContext,\n} from \"../../hooks\";\nimport {\n ExampleFilterList,\n ExampleFilterRange,\n ExampleFilterSlider,\n} from \"../../components\";\nimport { getPropsFilterList, getPropsFilterRange, getPropsShared } from \"../../utility/props\";\n\nexport type FilterProps = {\n /** The filter option being rendered */\n filter: ConfigFilterFacet;\n /** Render method for List filters */\n renderFilterList?: React.FC<{\n filter: ConfigFilterFacet;\n filterListProps: ReturnType<typeof useFilterListProps>;\n }>;\n /** Render method for Range filters */\n renderFilterRange?: React.FC<{\n filter: ConfigFilterFacet;\n filterRangeProps: ReturnType<typeof useFilterRangeProps>;\n }>;\n /** Render method for Slider filters */\n renderFilterSlider?: React.FC<{\n filter: ConfigFilterFacet;\n filterSliderProps: ReturnType<typeof useFilterSliderProps>;\n // reactSliderProps: ReturnType<typeof useReactSliderProps>;\n }>;\n /** Show filters even when no options are available */\n showEmptyFilters?: boolean;\n};\n\nexport const Filter: React.FC<FilterProps> = (props) => {\n if (\"single\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeSingle {...props} />;\n }\n return <FilterSingleList {...props} />;\n }\n\n if (\"multi\" === props.filter.displayType) {\n if (\"range\" === props.filter.displayView) {\n return <FilterRangeMulti {...props} />;\n }\n return <FilterMultiList {...props} />;\n }\n\n if (\"slider\" === props.filter.displayType) {\n return <FilterSlider {...props} />;\n }\n\n // TODO: Legacy range filter, migrate to new single and multi ranges\n if (\"range\" === props.filter.displayType) {\n return <FilterRangeSingle {...props} />;\n }\n\n console.warn(\n `filter with display type \"${props.filter.displayType}\" not yet supported`\n );\n\n return null;\n};\n\nconst FilterSingleList: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterList(props.filter);\n\n return (\n <SingleList\n {...sharedProps}\n {...reactiveProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterMultiList: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterList(props.filter);\n\n return (\n <MultiList\n {...sharedProps}\n {...reactiveProps}\n render={(reactivesearchFilterProps: ReactivesearchFilterListProps) => (\n <FilterListInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n )}\n />\n );\n};\n\nconst FilterRangeSingle: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterRange(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <SingleRange\n {...sharedProps}\n {...reactiveProps}\n value={filterRangeProps.values[0]}\n onChange={filterRangeProps.handleChange}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterRangeMulti: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n const reactiveProps = getPropsFilterRange(props.filter);\n\n const filterRangeProps = useFilterRangeProps(props.filter);\n\n const RenderRangeComponent = props.renderFilterRange ?? ExampleFilterRange;\n\n return (\n <>\n <div\n style={{\n display: \"none\",\n }}\n >\n <MultiRange\n {...sharedProps}\n {...reactiveProps}\n value={filterRangeProps.values}\n // @note: onChange handler must be defined for controlled component to work correctly\n onChange={() => {}}\n onValueChange={(values) => {\n if (values.length === 0) {\n filterRangeProps.handleClear();\n }\n }}\n />\n </div>\n <RenderRangeComponent\n filterRangeProps={filterRangeProps}\n filter={props.filter}\n />\n </>\n );\n};\n\nconst FilterSlider: React.FC<FilterProps> = (props) => {\n const reactifySearchContext = useReactifySearchContext();\n const filtersHook = useFilters();\n const sharedProps = getPropsShared({\n provider: reactifySearchContext.options,\n config: reactifySearchContext.config,\n filterGroup: filtersHook.filterStack,\n }, props.filter);\n\n return (\n <ReactiveComponent\n {...sharedProps}\n defaultQuery={() => ({\n aggs: {\n min: {\n min: {\n field: props.filter.field,\n },\n },\n max: {\n max: {\n field: props.filter.field,\n },\n },\n },\n })}\n render={(reactivesearchFilterProps) => {\n if (\n !props.showEmptyFilters &&\n reactivesearchFilterProps?.aggregations?.min?.value ===\n reactivesearchFilterProps?.aggregations?.max?.value\n ) {\n return null;\n }\n\n return (\n <FilterSliderInner\n {...props}\n reactivesearchFilterProps={reactivesearchFilterProps}\n />\n );\n }}\n />\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterSliderInner: React.FC<\n FilterProps & { reactivesearchFilterProps: any }\n> = (props) => {\n const {\n filter,\n renderFilterSlider,\n reactivesearchFilterProps,\n ...otherProps\n } = props;\n\n const filterSliderProps = useFilterSliderProps(filter);\n\n React.useEffect(() => {\n if (reactivesearchFilterProps.aggregations) {\n filterSliderProps.handleRange([\n reactivesearchFilterProps.aggregations.min.value,\n reactivesearchFilterProps.aggregations.max.value,\n ]);\n }\n }, [\n reactivesearchFilterProps.aggregations?.min.value,\n reactivesearchFilterProps.aggregations?.max.value,\n ]);\n\n React.useEffect(() => {\n if (filterSliderProps.value[0] === 0 && filterSliderProps.value[1] === 0) {\n return;\n }\n\n props.reactivesearchFilterProps.setQuery({\n query: {\n query: {\n bool: {\n must: [\n {\n bool: {\n must: [\n {\n match: {\n published: true,\n },\n },\n {\n range: {\n [props.filter.field]: {\n gte: filterSliderProps.value[0],\n lte: filterSliderProps.value[1],\n boost: 2,\n },\n },\n },\n ],\n },\n },\n ],\n },\n },\n },\n value: filterSliderProps.value,\n });\n }, [filterSliderProps.value]);\n\n const RenderListComponent = props.renderFilterSlider ?? ExampleFilterSlider;\n\n return (\n <RenderListComponent\n filterSliderProps={filterSliderProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n\n// inner component exists only so we can use memos in reactivesearch render functions\nconst FilterListInner: React.FC<\n FilterProps & { reactivesearchFilterProps: ReactivesearchFilterListProps }\n> = (props) => {\n const { filter, renderFilterList, reactivesearchFilterProps, ...otherProps } =\n props;\n\n const filterListProps = useFilterListProps(filter, reactivesearchFilterProps);\n\n // hide entire filter when no options available\n if (!props.showEmptyFilters && 0 === filterListProps.options.length) {\n return null;\n }\n\n const RenderListComponent = props.renderFilterList ?? ExampleFilterList;\n\n return (\n <RenderListComponent\n filterListProps={filterListProps}\n filter={filter}\n {...otherProps}\n />\n );\n};\n"]}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { useFilterListProps, useFilterRangeProps, useFilterSliderProps } from "../../hooks";
3
3
  import { ConfigFilterFacet } from "../../types";
4
- export declare type FiltersProps = {
4
+ export type FiltersProps = {
5
5
  /** Render method for List filters */
6
6
  renderFilterList?: React.FC<{
7
7
  filter: ConfigFilterFacet;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- export declare type FiltersSelectedProps = {
2
+ export type FiltersSelectedProps = {
3
3
  /** Render method called once for all active filters */
4
4
  render?: React.FC<{
5
5
  selectedFilters: Array<{
@@ -10,6 +10,7 @@ const components_1 = require("../../components");
10
10
  const hooks_1 = require("../../hooks");
11
11
  const FiltersSelected = (props) => {
12
12
  var _a;
13
+ const context = (0, hooks_1.useReactifySearchContext)();
13
14
  const filtersHook = (0, hooks_1.useFilters)();
14
15
  const RenderComponent = (_a = props.render) !== null && _a !== void 0 ? _a : components_1.ExampleFiltersSelected;
15
16
  return (react_1.default.createElement(SelectedFilters_1.default, { render: ({ selectedValues, setValue }) => {
@@ -32,7 +33,7 @@ const FiltersSelected = (props) => {
32
33
  return;
33
34
  }
34
35
  if (filter.displayType === "slider") {
35
- const event = new CustomEvent(`@usereactify/search:filter:${filter.handle}:update`, {
36
+ const event = new CustomEvent(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {
36
37
  detail: {
37
38
  handle: filter.handle,
38
39
  value: [],
@@ -54,7 +55,7 @@ const FiltersSelected = (props) => {
54
55
  const values = selectedValues[selectedFilterKey].value
55
56
  .filter((value) => !selectedFilterValues.includes(value.label))
56
57
  .map((value) => value.label);
57
- const event = new CustomEvent(`@usereactify/search:filter:${filter.handle}:update`, {
58
+ const event = new CustomEvent(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {
58
59
  detail: {
59
60
  handle: filter.handle,
60
61
  value: values,
@@ -1 +1 @@
1
- {"version":3,"file":"FiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Filter/FiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAEjG,iDAA0D;AAC1D,uCAAyC;AAqBlC,MAAM,eAAe,GAAmC,CAAC,KAAK,E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K,CAAC,MAAM,CAC3D,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzD,CAAC;4BACF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;yBACrC;qBACF;iBACF;YACH,CAAC,CAAC;YAEF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACb;YAED,OAAO,CACL,8BAAC,eAAe,IACd,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;QACJ,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAtGW,QAAA,eAAe,mBAsG1B","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@usereactify/search-internals/lib/components/basic/SelectedFilters\";\n\nimport { ExampleFiltersSelected } from \"../../components\";\nimport { useFilters } from \"../../hooks\";\n\nexport type FiltersSelectedProps = {\n /** Render method called once for all active filters */\n render?: React.FC<{\n selectedFilters: Array<{\n key: string;\n label: string;\n value:\n | Array<string>\n | string\n | { label: string; start: number; end: number }\n | Array<{ label: string; start: number; end: number }>;\n }>;\n handleRemove: (\n filterKey: string,\n filterValues?: Array<string | number>\n ) => void;\n }>;\n};\n\nexport const FiltersSelected: React.FC<FiltersSelectedProps> = (props) => {\n const filtersHook = useFilters();\n\n const RenderComponent = props.render ?? ExampleFiltersSelected;\n\n return (\n <SelectedFilters\n render={({ selectedValues, setValue }) => {\n const selectedFilters = (\n Object.entries(selectedValues) as Array<[string, any]>\n )\n .filter(\n ([key, item]) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n )\n .map(([key, item]) => ({\n key: key,\n label: item.label,\n value: item.value,\n }));\n\n const handleRemove = (\n selectedFilterKey: string,\n selectedFilterValues: Array<string | number> = []\n ) => {\n const filter = filtersHook.filters?.find(\n (filter) => filter.handle === selectedFilterKey\n );\n if (!filter) {\n return;\n }\n\n if (filter.displayType === \"slider\") {\n const event = new CustomEvent<{\n handle: string;\n value: [];\n }>(`@usereactify/search:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n\n return;\n }\n\n if (selectedFilterValues.length === 0) {\n setValue(selectedFilterKey, null);\n\n return;\n }\n\n if (selectedFilterValues.length > 0) {\n if (filter.displayType === \"single\") {\n setValue(selectedFilterKey, null);\n }\n if (filter.displayType === \"multi\") {\n if (filter.displayView === \"range\") {\n const values = selectedValues[selectedFilterKey].value\n .filter(\n (value: { label: string }) =>\n !selectedFilterValues.includes(value.label)\n )\n .map((value: { label: string }) => value.label);\n\n const event = new CustomEvent<{\n handle: string;\n value: Array<string>;\n }>(`@usereactify/search:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: values,\n },\n });\n window.dispatchEvent(event);\n }\n if (filter.displayView !== \"range\") {\n const values = selectedValues[selectedFilterKey].value.filter(\n (value: string) => !selectedFilterValues.includes(value)\n );\n setValue(selectedFilterKey, values);\n }\n }\n }\n };\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return (\n <RenderComponent\n selectedFilters={selectedFilters}\n handleRemove={handleRemove}\n />\n );\n }}\n />\n );\n};\n"]}
1
+ {"version":3,"file":"FiltersSelected.js","sourceRoot":"","sources":["../../../../src/components/Filter/FiltersSelected.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,yHAAiG;AAEjG,iDAA0D;AAC1D,uCAAmE;AAqB5D,MAAM,eAAe,GAAmC,CAAC,KAAK,EAAE,EAAE;;IACvE,MAAM,OAAO,GAAG,IAAA,gCAAwB,GAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,IAAA,kBAAU,GAAE,CAAC;IAEjC,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,mCAAsB,CAAC;IAE/D,OAAO,CACL,8BAAC,yBAAe,IACd,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ,E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AAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzD,CAAC;4BACF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;wBACtC,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC,CAAC;YAEF,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;gBAC5B,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO,CACL,8BAAC,eAAe,IACd,eAAe,EAAE,eAAe,EAChC,YAAY,EAAE,YAAY,GAC1B,CACH,CAAC;QACJ,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAvGW,QAAA,eAAe,mBAuG1B","sourcesContent":["import React from \"react\";\nimport SelectedFilters from \"@usereactify/search-internals/lib/components/basic/SelectedFilters\";\n\nimport { ExampleFiltersSelected } from \"../../components\";\nimport { useFilters, useReactifySearchContext } from \"../../hooks\";\n\nexport type FiltersSelectedProps = {\n /** Render method called once for all active filters */\n render?: React.FC<{\n selectedFilters: Array<{\n key: string;\n label: string;\n value:\n | Array<string>\n | string\n | { label: string; start: number; end: number }\n | Array<{ label: string; start: number; end: number }>;\n }>;\n handleRemove: (\n filterKey: string,\n filterValues?: Array<string | number>\n ) => void;\n }>;\n};\n\nexport const FiltersSelected: React.FC<FiltersSelectedProps> = (props) => {\n const context = useReactifySearchContext();\n const filtersHook = useFilters();\n\n const RenderComponent = props.render ?? ExampleFiltersSelected;\n\n return (\n <SelectedFilters\n render={({ selectedValues, setValue }) => {\n const selectedFilters = (\n Object.entries(selectedValues) as Array<[string, any]>\n )\n .filter(\n ([key, item]) =>\n item?.URLParams &&\n item?.showFilter &&\n (!!item?.value?.length || !!item?.value?.label)\n )\n .map(([key, item]) => ({\n key: key,\n label: item.label,\n value: item.value,\n }));\n\n const handleRemove = (\n selectedFilterKey: string,\n selectedFilterValues: Array<string | number> = []\n ) => {\n const filter = filtersHook.filters?.find(\n (filter) => filter.handle === selectedFilterKey\n );\n if (!filter) {\n return;\n }\n\n if (filter.displayType === \"slider\") {\n const event = new CustomEvent<{\n handle: string;\n value: [];\n }>(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: [],\n },\n });\n window.dispatchEvent(event);\n\n return;\n }\n\n if (selectedFilterValues.length === 0) {\n setValue(selectedFilterKey, null);\n\n return;\n }\n\n if (selectedFilterValues.length > 0) {\n if (filter.displayType === \"single\") {\n setValue(selectedFilterKey, null);\n }\n if (filter.displayType === \"multi\") {\n if (filter.displayView === \"range\") {\n const values = selectedValues[selectedFilterKey].value\n .filter(\n (value: { label: string }) =>\n !selectedFilterValues.includes(value.label)\n )\n .map((value: { label: string }) => value.label);\n\n const event = new CustomEvent<{\n handle: string;\n value: Array<string>;\n }>(`@usereactify/search:${context.options.mode}:filter:${filter.handle}:update`, {\n detail: {\n handle: filter.handle,\n value: values,\n },\n });\n window.dispatchEvent(event);\n }\n if (filter.displayView !== \"range\") {\n const values = selectedValues[selectedFilterKey].value.filter(\n (value: string) => !selectedFilterValues.includes(value)\n );\n setValue(selectedFilterKey, values);\n }\n }\n }\n };\n\n if (!selectedFilters.length) {\n return null;\n }\n\n return (\n <RenderComponent\n selectedFilters={selectedFilters}\n handleRemove={handleRemove}\n />\n );\n }}\n />\n );\n};\n"]}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Filter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,oDAAkC","sourcesContent":["export * from \"./Filter\";\nexport * from \"./Filters\";\nexport * from \"./FiltersSelected\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Filter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,oDAAkC","sourcesContent":["export * from \"./Filter\";\nexport * from \"./Filters\";\nexport * from \"./FiltersSelected\";\n"]}
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { Config } from "../../types";
3
- export declare type ReactifySearchProviderProps = {
3
+ export type ReactifySearchProviderProps = {
4
4
  /** Standard react children */
5
5
  children?: React.ReactNode | undefined;
6
6
  /** The search area the provider will be used in */
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1 +1 @@
1
- {"version":3,"file":"ReactifySearchProvider.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchProvider/ReactifySearchProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iCAAiC;AACjC,gDAAkC;AAElC,yEAAwC;AAExC,uCAA+D;AAC/D,iDAAoE;AACpE,2CAAsC;AAwD/B,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,e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AM,EAAE;gBACN,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,aAAa;gBAC5B,wBAAwB,EAAE,wBAAwB;gBAClD,2BAA2B,EAAE,2BAA2B;gBACxD,cAAc,EAAE,cAAc;aAC/B;YACD,MAAM,EAAE;gBACN,UAAU,EAAE,UAAU;gBACtB,aAAa,EAAE,aAAa;aAC7B;YACD,OAAO,EAAE;gBACP,OAAO,EAAE,OAAO;gBAChB,UAAU,EAAE,UAAU;gBACtB,WAAW,EAAE,WAAW;gBACxB,cAAc,EAAE,cAAc;aAC/B;SACF,CAAC;IACJ,CAAC,EAAE;QACD,MAAM;QACN,KAAK;QACL,UAAU;QACV,wBAAwB;QACxB,cAAc;QACd,UAAU;QACV,OAAO;QACP,WAAW;KACZ,CAAC,CAAC;IAEH,eAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IAE9D,IAAI,CAAC,YAAY,EAAE;QACjB,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC;SAC9B;QACD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;QACjD,8BAAC,6CAAgC,QAC9B,KAAK,CAAC,QAAQ,CACkB,CACJ,CAClC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\n// @ts-expect-error missing types\nimport * as GaGtag from \"ga-gtag\";\n\nimport pkg from \"../../../package.json\";\n\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { debug } from \"../../utility\";\nimport { Config, ConfigRedirect, ReactivesearchResultProps } from \"../../types\";\n\nexport type ReactifySearchProviderProps = {\n /** Standard react children */\n children?: React.ReactNode | undefined;\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Market ID used to change merchandising based on market e.g. 7494533198 */\n market?: string;\n /** Callback function for redirects, suitable for headless sites to avoid full page refresh */\n onRedirect?: (type: \"redirect\" | \"search\", url: string) => void;\n /** Render method to display a component when the config is loading */\n renderBooting?: () => JSX.Element | null;\n /** Advanced usage: Override the default Reactify Search id (for telemetry) */\n clientId?: string;\n /** Advanced usage: Override the default Filters selection logic */\n filtersHandle?: string;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentIds?: Array<string>;\n /** Advanced usage: Override the default Elasticsearch index */\n index?: string;\n /** Advanced usage: Override the default Reactify Search config (for multi-instance stores) */\n configId?: string;\n /** Advanced usage: Override the default Elasticsearch credentials */\n credentials?: string;\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n /** Advanced usage: Fields to include in the Elasticsearch response e.g. [\"title\"] */\n includeFields?: Array<string>;\n /** Advanced usage: Fields to exclude from the Elasticsearch response e.g. [\"variant_skus\", \"*price*\"] */\n excludeFields?: Array<string>;\n /** Advanced usage: Flags are used to enable or disable specific features within Reactify Search */\n flags?: Record<string, boolean>;\n /** Advanced usage: Server content for SSR */\n query?: Record<string, string>;\n preload?: {\n config: Config;\n state: unknown;\n }\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collectionHandle: string;\n }\n | {\n mode: \"instant-search\";\n }\n);\n\nexport const ReactifySearchProvider: React.FC<ReactifySearchProviderProps> = (\n props\n) => {\n React.useEffect(() => {\n debug.log(\"ReactifySearchProvider\", \"props\", props);\n\n GaGtag.install(\"G-DV00Z0X5VP\", {\n cookie_prefix: \"_rs\",\n user_properties: {\n shop: props.shopifyPermanentDomain,\n version: pkg.version,\n },\n });\n }, [props]);\n\n return <ReactifySearchInner {...props} />;\n};\n\nconst ReactifySearchInner: React.FC<ReactifySearchProviderProps> = (props) => {\n const { config } = useConfig(props.shopifyPermanentDomain, props.preload?.config);\n\n const theme = props.theme ?? {\n typography: {\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n },\n };\n\n const searchTermFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"q\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const searchSortFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return props.query?.sort;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"sort\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const indexFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"index\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const [searchTerm, setSearchTerm] = React.useState<string>(\n searchTermFromURL ?? \"\"\n );\n const searchRedirect = React.useMemo<ConfigRedirect | undefined>(() => {\n return config?.redirects.find((redirect) => redirect.query.trim().toLowerCase() === searchTerm.trim().toLowerCase());\n }, [config?.redirects, searchTerm]);\n const [showInstantSearchResults, setShowInstantSearchResults] =\n React.useState<boolean>(false);\n const [sortOption, setSortOption] = React.useState<string>(\n searchSortFromURL ?? \"\"\n );\n\n const [results, setResults] = React.useState<\n ReactivesearchResultProps[\"data\"]\n >([]);\n const [resultStats, setResultStats] =\n React.useState<ReactivesearchResultProps[\"resultStats\"]>();\n\n React.useEffect(() => {\n if (searchTermFromURL && searchTerm !== searchTermFromURL) {\n setSearchTerm(searchTermFromURL);\n }\n }, [searchTermFromURL]);\n\n React.useEffect(() => {\n if (searchSortFromURL && sortOption !== searchSortFromURL) {\n setSortOption(searchSortFromURL);\n }\n }, [searchSortFromURL]);\n\n const contextValue = React.useMemo(() => {\n if (!config) {\n return;\n }\n\n return {\n config: config,\n options: {\n ...props,\n clientId: props.clientId ?? \"theme\",\n index: props.index ?? indexFromURL ?? config.index,\n filtersHandle: props.filtersHandle,\n credentials: props.credentials,\n theme: theme,\n },\n search: {\n searchTerm: searchTerm,\n setSearchTerm: setSearchTerm,\n showInstantSearchResults: showInstantSearchResults,\n setShowInstantSearchResults: setShowInstantSearchResults,\n searchRedirect: searchRedirect,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n results: {\n results: results,\n setResults: setResults,\n resultStats: resultStats,\n setResultStats: setResultStats,\n },\n };\n }, [\n config,\n props,\n searchTerm,\n showInstantSearchResults,\n searchRedirect,\n sortOption,\n results,\n resultStats,\n ]);\n\n debug.hook(\"ReactifySearchProvider\", \"context\", contextValue);\n\n if (!contextValue) {\n if (props.renderBooting) {\n return props.renderBooting();\n }\n return null;\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>\n {props.children}\n </UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n};\n"]}
1
+ {"version":3,"file":"ReactifySearchProvider.js","sourceRoot":"","sources":["../../../../src/components/ReactifySearchProvider/ReactifySearchProvider.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iCAAiC;AACjC,gDAAkC;AAElC,yEAAwC;AAExC,uCAA+D;AAC/D,iDAAoE;AACpE,2CAAsC;AAwD/B,MAAM,sBAAsB,GAA0C,CAC3E,KAAK,EACL,EAAE;IACF,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,eAAK,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAEpD,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE;YAC7B,aAAa,EAAE,KAAK;YACpB,eAAe,EAAE;gBACf,IAAI,EAAE,KAAK,CAAC,sBAAsB;gBAClC,OAAO,EAAE,sBAAG,CAAC,OAAO;aACrB;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,8BAAC,mBAA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gBACtB,WAAW,EAAE,WAAW;gBACxB,cAAc,EAAE,cAAc;aAC/B;SACF,CAAC;IACJ,CAAC,EAAE;QACD,MAAM;QACN,KAAK;QACL,UAAU;QACV,wBAAwB;QACxB,cAAc;QACd,UAAU;QACV,OAAO;QACP,WAAW;KACZ,CAAC,CAAC;IAEH,eAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;IAE9D,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,8BAAC,6BAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;QACjD,8BAAC,6CAAgC,QAC9B,KAAK,CAAC,QAAQ,CACkB,CACJ,CAClC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from \"react\";\n// @ts-expect-error missing types\nimport * as GaGtag from \"ga-gtag\";\n\nimport pkg from \"../../../package.json\";\n\nimport { ReactifySearchContext, useConfig } from \"../../hooks\";\nimport { UtilityAuthenticatedReactiveBase } from \"../../components\";\nimport { debug } from \"../../utility\";\nimport { Config, ConfigRedirect, ReactivesearchResultProps } from \"../../types\";\n\nexport type ReactifySearchProviderProps = {\n /** Standard react children */\n children?: React.ReactNode | undefined;\n /** The search area the provider will be used in */\n mode: \"search\" | \"collection\" | \"instant-search\";\n /** Shopify store domain used to resolve the site configuration */\n shopifyPermanentDomain: string;\n /** Market ID used to change merchandising based on market e.g. 7494533198 */\n market?: string;\n /** Callback function for redirects, suitable for headless sites to avoid full page refresh */\n onRedirect?: (type: \"redirect\" | \"search\", url: string) => void;\n /** Render method to display a component when the config is loading */\n renderBooting?: () => JSX.Element | null;\n /** Advanced usage: Override the default Reactify Search id (for telemetry) */\n clientId?: string;\n /** Advanced usage: Override the default Filters selection logic */\n filtersHandle?: string;\n /** Advanced usage: Array of additional component IDs managed outside of Reactify Search */\n additionalComponentIds?: Array<string>;\n /** Advanced usage: Override the default Elasticsearch index */\n index?: string;\n /** Advanced usage: Override the default Reactify Search config (for multi-instance stores) */\n configId?: string;\n /** Advanced usage: Override the default Elasticsearch credentials */\n credentials?: string;\n /** Advanced usage: Override the default ReactiveBase theme */\n theme?: Record<string, unknown>;\n /** Advanced usage: Fields to include in the Elasticsearch response e.g. [\"title\"] */\n includeFields?: Array<string>;\n /** Advanced usage: Fields to exclude from the Elasticsearch response e.g. [\"variant_skus\", \"*price*\"] */\n excludeFields?: Array<string>;\n /** Advanced usage: Flags are used to enable or disable specific features within Reactify Search */\n flags?: Record<string, boolean>;\n /** Advanced usage: Server content for SSR */\n query?: Record<string, string>;\n preload?: {\n config: Config;\n state: unknown;\n }\n} & (\n | {\n mode: \"search\";\n }\n | {\n mode: \"collection\";\n /** Collection object that includes the handle, used to find curations */\n collectionHandle: string;\n }\n | {\n mode: \"instant-search\";\n }\n);\n\nexport const ReactifySearchProvider: React.FC<ReactifySearchProviderProps> = (\n props\n) => {\n React.useEffect(() => {\n debug.log(\"ReactifySearchProvider\", \"props\", props);\n\n GaGtag.install(\"G-DV00Z0X5VP\", {\n cookie_prefix: \"_rs\",\n user_properties: {\n shop: props.shopifyPermanentDomain,\n version: pkg.version,\n },\n });\n }, [props]);\n\n return <ReactifySearchInner {...props} />;\n};\n\nconst ReactifySearchInner: React.FC<ReactifySearchProviderProps> = (props) => {\n const { config } = useConfig(props.shopifyPermanentDomain, props.preload?.config);\n\n const theme = props.theme ?? {\n typography: {\n fontFamily: \"inherit\",\n fontSize: \"inherit\",\n },\n };\n\n const searchTermFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"q\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const searchSortFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return props.query?.sort;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"sort\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const indexFromURL = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n const urlParams = new URLSearchParams(window.location.search);\n return urlParams.get(\"index\") ?? undefined;\n }, [typeof window !== \"undefined\" && window.location.search]);\n\n const [searchTerm, setSearchTerm] = React.useState<string>(\n searchTermFromURL ?? \"\"\n );\n const searchRedirect = React.useMemo<ConfigRedirect | undefined>(() => {\n return config?.redirects.find((redirect) => redirect.query.trim().toLowerCase() === searchTerm.trim().toLowerCase());\n }, [config?.redirects, searchTerm]);\n const [showInstantSearchResults, setShowInstantSearchResults] =\n React.useState<boolean>(false);\n const [sortOption, setSortOption] = React.useState<string>(\n searchSortFromURL ?? \"\"\n );\n\n const [results, setResults] = React.useState<\n ReactivesearchResultProps[\"data\"]\n >([]);\n const [resultStats, setResultStats] =\n React.useState<ReactivesearchResultProps[\"resultStats\"]>();\n\n React.useEffect(() => {\n if (searchTermFromURL && searchTerm !== searchTermFromURL) {\n setSearchTerm(searchTermFromURL);\n }\n }, [searchTermFromURL]);\n\n React.useEffect(() => {\n if (searchSortFromURL && sortOption !== searchSortFromURL) {\n setSortOption(searchSortFromURL);\n }\n }, [searchSortFromURL]);\n\n const contextValue = React.useMemo(() => {\n if (!config) {\n return;\n }\n\n return {\n config: config,\n options: {\n ...props,\n clientId: props.clientId ?? \"theme\",\n index: props.index ?? indexFromURL ?? config.index,\n filtersHandle: props.filtersHandle,\n credentials: props.credentials,\n theme: theme,\n },\n search: {\n searchTerm: searchTerm,\n setSearchTerm: setSearchTerm,\n showInstantSearchResults: showInstantSearchResults,\n setShowInstantSearchResults: setShowInstantSearchResults,\n searchRedirect: searchRedirect,\n },\n sortby: {\n sortOption: sortOption,\n setSortOption: setSortOption,\n },\n results: {\n results: results,\n setResults: setResults,\n resultStats: resultStats,\n setResultStats: setResultStats,\n },\n };\n }, [\n config,\n props,\n searchTerm,\n showInstantSearchResults,\n searchRedirect,\n sortOption,\n results,\n resultStats,\n ]);\n\n debug.hook(\"ReactifySearchProvider\", \"context\", contextValue);\n\n if (!contextValue) {\n if (props.renderBooting) {\n return props.renderBooting();\n }\n return null;\n }\n\n return (\n <ReactifySearchContext.Provider value={contextValue}>\n <UtilityAuthenticatedReactiveBase>\n {props.children}\n </UtilityAuthenticatedReactiveBase>\n </ReactifySearchContext.Provider>\n );\n};\n"]}