instantsearch.js 4.34.0 → 4.37.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/cjs/components/Answers/Answers.js +1 -1
  3. package/cjs/components/Breadcrumb/Breadcrumb.js +1 -1
  4. package/cjs/components/ClearRefinements/ClearRefinements.js +1 -1
  5. package/cjs/components/CurrentRefinements/CurrentRefinements.js +3 -3
  6. package/cjs/components/GeoSearchControls/GeoSearchControls.js +3 -3
  7. package/cjs/components/Hits/Hits.js +1 -1
  8. package/cjs/components/InfiniteHits/InfiniteHits.js +1 -1
  9. package/cjs/components/MenuSelect/MenuSelect.js +3 -3
  10. package/cjs/components/Pagination/Pagination.js +71 -161
  11. package/cjs/components/Pagination/PaginationLink.js +26 -13
  12. package/cjs/components/Panel/Panel.js +1 -1
  13. package/cjs/components/QueryRuleCustomData/QueryRuleCustomData.js +1 -1
  14. package/cjs/components/RangeInput/RangeInput.js +1 -1
  15. package/cjs/components/RefinementList/RefinementList.js +6 -6
  16. package/cjs/components/RefinementList/RefinementListItem.js +1 -1
  17. package/cjs/components/RelevantSort/RelevantSort.js +1 -1
  18. package/cjs/components/SearchBox/SearchBox.js +9 -10
  19. package/cjs/components/Slider/Slider.js +5 -5
  20. package/cjs/components/Stats/Stats.js +1 -1
  21. package/cjs/components/Template/Template.js +3 -3
  22. package/cjs/components/ToggleRefinement/ToggleRefinement.js +1 -1
  23. package/cjs/components/VoiceSearch/VoiceSearch.js +1 -1
  24. package/cjs/connectors/answers/connectAnswers.js +10 -10
  25. package/cjs/connectors/autocomplete/connectAutocomplete.js +9 -9
  26. package/cjs/connectors/breadcrumb/connectBreadcrumb.js +9 -7
  27. package/cjs/connectors/clear-refinements/connectClearRefinements.js +9 -9
  28. package/cjs/connectors/configure/connectConfigure.js +8 -8
  29. package/cjs/connectors/configure-related-items/connectConfigureRelatedItems.js +5 -5
  30. package/cjs/connectors/current-refinements/connectCurrentRefinements.js +6 -6
  31. package/cjs/connectors/dynamic-widgets/connectDynamicWidgets.js +35 -10
  32. package/cjs/connectors/geo-search/connectGeoSearch.js +11 -11
  33. package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +6 -6
  34. package/cjs/connectors/hits/connectHits.js +11 -11
  35. package/cjs/connectors/hits/connectHitsWithInsights.js +3 -3
  36. package/cjs/connectors/hits-per-page/connectHitsPerPage.js +6 -6
  37. package/cjs/connectors/index.js +31 -31
  38. package/cjs/connectors/infinite-hits/connectInfiniteHits.js +12 -12
  39. package/cjs/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +3 -3
  40. package/cjs/connectors/menu/connectMenu.js +5 -5
  41. package/cjs/connectors/numeric-menu/connectNumericMenu.js +7 -7
  42. package/cjs/connectors/pagination/Paginator.js +3 -3
  43. package/cjs/connectors/pagination/connectPagination.js +5 -5
  44. package/cjs/connectors/powered-by/connectPoweredBy.js +5 -5
  45. package/cjs/connectors/query-rules/connectQueryRules.js +7 -7
  46. package/cjs/connectors/range/connectRange.js +27 -27
  47. package/cjs/connectors/rating-menu/connectRatingMenu.js +6 -6
  48. package/cjs/connectors/refinement-list/connectRefinementList.js +8 -8
  49. package/cjs/connectors/relevant-sort/connectRelevantSort.js +3 -3
  50. package/cjs/connectors/search-box/connectSearchBox.js +4 -4
  51. package/cjs/connectors/sort-by/connectSortBy.js +6 -6
  52. package/cjs/connectors/stats/connectStats.js +4 -4
  53. package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +11 -11
  54. package/cjs/connectors/voice-search/connectVoiceSearch.js +6 -6
  55. package/cjs/helpers/get-insights-anonymous-user-token.js +2 -2
  56. package/cjs/helpers/highlight.js +4 -4
  57. package/cjs/helpers/index.js +6 -6
  58. package/cjs/helpers/insights.js +4 -4
  59. package/cjs/helpers/reverseHighlight.js +5 -5
  60. package/cjs/helpers/reverseSnippet.js +5 -5
  61. package/cjs/helpers/snippet.js +4 -4
  62. package/cjs/index.js +9 -9
  63. package/cjs/lib/InstantSearch.js +33 -28
  64. package/cjs/lib/createHelpers.js +6 -6
  65. package/cjs/lib/infiniteHitsCache/index.js +1 -1
  66. package/cjs/lib/infiniteHitsCache/sessionStorage.js +4 -4
  67. package/cjs/lib/insights/client.js +5 -5
  68. package/cjs/lib/insights/index.js +2 -2
  69. package/cjs/lib/insights/listener.js +3 -3
  70. package/cjs/lib/routers/history.js +6 -6
  71. package/cjs/lib/routers/index.js +1 -1
  72. package/cjs/lib/stateMappings/index.js +2 -2
  73. package/cjs/lib/utils/checkIndexUiState.js +3 -3
  74. package/cjs/lib/utils/checkRendering.js +1 -1
  75. package/cjs/lib/utils/concatHighlightedParts.js +1 -1
  76. package/cjs/lib/utils/createSendEventForFacet.js +1 -1
  77. package/cjs/lib/utils/createSendEventForHits.js +1 -1
  78. package/cjs/lib/utils/detect-insights-client.js +1 -1
  79. package/cjs/lib/utils/escape-highlight.js +2 -2
  80. package/cjs/lib/utils/getContainerNode.js +1 -1
  81. package/cjs/lib/utils/getHighlightFromSiblings.js +1 -1
  82. package/cjs/lib/utils/getHighlightedParts.js +1 -1
  83. package/cjs/lib/utils/getRefinements.js +2 -2
  84. package/cjs/lib/utils/index.js +48 -48
  85. package/cjs/lib/utils/logger.js +1 -1
  86. package/cjs/lib/utils/mergeSearchParameters.js +2 -2
  87. package/cjs/lib/utils/prepareTemplateProps.js +1 -1
  88. package/cjs/lib/utils/reverseHighlightedParts.js +1 -1
  89. package/cjs/lib/version.js +1 -1
  90. package/cjs/middlewares/createInsightsMiddleware.js +11 -11
  91. package/cjs/middlewares/createMetadataMiddleware.js +2 -2
  92. package/cjs/middlewares/createRouterMiddleware.js +4 -4
  93. package/cjs/middlewares/index.js +3 -3
  94. package/cjs/types/index.js +14 -14
  95. package/cjs/widgets/analytics/analytics.js +3 -3
  96. package/cjs/widgets/answers/answers.js +8 -8
  97. package/cjs/widgets/breadcrumb/breadcrumb.js +8 -8
  98. package/cjs/widgets/clear-refinements/clear-refinements.js +8 -8
  99. package/cjs/widgets/configure/configure.js +3 -3
  100. package/cjs/widgets/configure-related-items/configure-related-items.js +3 -3
  101. package/cjs/widgets/current-refinements/current-refinements.js +6 -6
  102. package/cjs/widgets/dynamic-widgets/dynamic-widgets.js +14 -11
  103. package/cjs/widgets/geo-search/GeoSearchRenderer.js +3 -3
  104. package/cjs/widgets/geo-search/geo-search.js +9 -9
  105. package/cjs/widgets/hierarchical-menu/hierarchical-menu.js +8 -8
  106. package/cjs/widgets/hits/hits.js +11 -11
  107. package/cjs/widgets/hits-per-page/hits-per-page.js +7 -7
  108. package/cjs/widgets/index/index.js +6 -6
  109. package/cjs/widgets/index.js +36 -36
  110. package/cjs/widgets/infinite-hits/infinite-hits.js +11 -11
  111. package/cjs/widgets/menu/menu.js +8 -8
  112. package/cjs/widgets/menu-select/menu-select.js +8 -8
  113. package/cjs/widgets/numeric-menu/numeric-menu.js +8 -8
  114. package/cjs/widgets/pagination/pagination.js +7 -7
  115. package/cjs/widgets/panel/panel.js +7 -7
  116. package/cjs/widgets/powered-by/powered-by.js +6 -6
  117. package/cjs/widgets/query-rule-context/query-rule-context.js +4 -4
  118. package/cjs/widgets/query-rule-custom-data/query-rule-custom-data.js +6 -6
  119. package/cjs/widgets/range-input/range-input.js +7 -7
  120. package/cjs/widgets/range-slider/range-slider.js +6 -6
  121. package/cjs/widgets/rating-menu/rating-menu.js +8 -8
  122. package/cjs/widgets/refinement-list/refinement-list.js +10 -10
  123. package/cjs/widgets/relevant-sort/relevant-sort.js +7 -7
  124. package/cjs/widgets/search-box/search-box.js +7 -7
  125. package/cjs/widgets/sort-by/sort-by.js +6 -6
  126. package/cjs/widgets/stats/defaultTemplates.js +1 -1
  127. package/cjs/widgets/stats/stats.js +7 -7
  128. package/cjs/widgets/toggle-refinement/toggle-refinement.js +8 -8
  129. package/cjs/widgets/voice-search/voice-search.js +7 -7
  130. package/dist/instantsearch.development.d.ts +15 -2
  131. package/dist/instantsearch.development.js +337 -365
  132. package/dist/instantsearch.development.js.map +1 -1
  133. package/dist/instantsearch.development.min.d.ts +15 -2
  134. package/dist/instantsearch.production.d.ts +15 -2
  135. package/dist/instantsearch.production.min.d.ts +15 -2
  136. package/dist/instantsearch.production.min.js +2 -2
  137. package/dist/instantsearch.production.min.js.map +1 -1
  138. package/es/components/Answers/Answers.js +1 -1
  139. package/es/components/Breadcrumb/Breadcrumb.js +1 -1
  140. package/es/components/ClearRefinements/ClearRefinements.js +1 -1
  141. package/es/components/CurrentRefinements/CurrentRefinements.js +1 -1
  142. package/es/components/GeoSearchControls/GeoSearchControls.js +3 -3
  143. package/es/components/Hits/Hits.js +1 -1
  144. package/es/components/InfiniteHits/InfiniteHits.js +1 -1
  145. package/es/components/MenuSelect/MenuSelect.js +2 -2
  146. package/es/components/Pagination/Pagination.d.ts +4 -11
  147. package/es/components/Pagination/Pagination.js +72 -162
  148. package/es/components/Pagination/PaginationLink.d.ts +10 -11
  149. package/es/components/Pagination/PaginationLink.js +23 -13
  150. package/es/components/Panel/Panel.js +1 -1
  151. package/es/components/QueryRuleCustomData/QueryRuleCustomData.js +1 -1
  152. package/es/components/RangeInput/RangeInput.js +1 -1
  153. package/es/components/RefinementList/RefinementList.js +4 -4
  154. package/es/components/RefinementList/RefinementListItem.js +1 -1
  155. package/es/components/RelevantSort/RelevantSort.js +1 -1
  156. package/es/components/SearchBox/SearchBox.js +5 -6
  157. package/es/components/Slider/Slider.js +3 -3
  158. package/es/components/Stats/Stats.js +1 -1
  159. package/es/components/Template/Template.js +1 -1
  160. package/es/components/ToggleRefinement/ToggleRefinement.js +1 -1
  161. package/es/components/VoiceSearch/VoiceSearch.js +1 -1
  162. package/es/connectors/answers/connectAnswers.js +1 -1
  163. package/es/connectors/autocomplete/connectAutocomplete.js +1 -1
  164. package/es/connectors/breadcrumb/connectBreadcrumb.js +5 -3
  165. package/es/connectors/clear-refinements/connectClearRefinements.js +1 -1
  166. package/es/connectors/configure/connectConfigure.js +1 -1
  167. package/es/connectors/configure-related-items/connectConfigureRelatedItems.js +2 -2
  168. package/es/connectors/current-refinements/connectCurrentRefinements.js +1 -1
  169. package/es/connectors/dynamic-widgets/connectDynamicWidgets.d.ts +14 -0
  170. package/es/connectors/dynamic-widgets/connectDynamicWidgets.js +31 -6
  171. package/es/connectors/geo-search/connectGeoSearch.js +1 -1
  172. package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +1 -1
  173. package/es/connectors/hits/connectHits.js +1 -1
  174. package/es/connectors/hits/connectHitsWithInsights.js +2 -2
  175. package/es/connectors/hits-per-page/connectHitsPerPage.js +1 -1
  176. package/es/connectors/index.js +30 -30
  177. package/es/connectors/infinite-hits/connectInfiniteHits.js +1 -1
  178. package/es/connectors/infinite-hits/connectInfiniteHitsWithInsights.js +2 -2
  179. package/es/connectors/menu/connectMenu.js +1 -1
  180. package/es/connectors/numeric-menu/connectNumericMenu.js +1 -1
  181. package/es/connectors/pagination/Paginator.js +1 -1
  182. package/es/connectors/pagination/connectPagination.js +2 -2
  183. package/es/connectors/powered-by/connectPoweredBy.js +1 -1
  184. package/es/connectors/query-rules/connectQueryRules.js +1 -1
  185. package/es/connectors/range/connectRange.js +1 -1
  186. package/es/connectors/rating-menu/connectRatingMenu.js +1 -1
  187. package/es/connectors/refinement-list/connectRefinementList.js +1 -1
  188. package/es/connectors/relevant-sort/connectRelevantSort.js +1 -1
  189. package/es/connectors/search-box/connectSearchBox.js +1 -1
  190. package/es/connectors/sort-by/connectSortBy.js +1 -1
  191. package/es/connectors/stats/connectStats.js +1 -1
  192. package/es/connectors/toggle-refinement/connectToggleRefinement.js +1 -1
  193. package/es/connectors/voice-search/connectVoiceSearch.js +2 -2
  194. package/es/helpers/get-insights-anonymous-user-token.js +1 -1
  195. package/es/helpers/highlight.js +2 -2
  196. package/es/helpers/index.js +10 -10
  197. package/es/helpers/insights.js +1 -1
  198. package/es/helpers/reverseHighlight.js +2 -2
  199. package/es/helpers/reverseSnippet.js +2 -2
  200. package/es/helpers/snippet.js +2 -2
  201. package/es/index.js +6 -6
  202. package/es/lib/InstantSearch.d.ts +1 -2
  203. package/es/lib/InstantSearch.js +16 -11
  204. package/es/lib/createHelpers.js +1 -1
  205. package/es/lib/infiniteHitsCache/index.js +1 -1
  206. package/es/lib/infiniteHitsCache/sessionStorage.js +1 -1
  207. package/es/lib/insights/client.js +1 -1
  208. package/es/lib/insights/index.js +2 -2
  209. package/es/lib/insights/listener.js +2 -2
  210. package/es/lib/routers/history.js +1 -1
  211. package/es/lib/routers/index.js +1 -1
  212. package/es/lib/stateMappings/index.js +2 -2
  213. package/es/lib/utils/checkIndexUiState.js +3 -3
  214. package/es/lib/utils/checkRendering.js +1 -1
  215. package/es/lib/utils/concatHighlightedParts.js +1 -1
  216. package/es/lib/utils/createSendEventForFacet.js +1 -1
  217. package/es/lib/utils/createSendEventForHits.js +1 -1
  218. package/es/lib/utils/detect-insights-client.js +1 -1
  219. package/es/lib/utils/escape-highlight.js +2 -2
  220. package/es/lib/utils/getContainerNode.js +1 -1
  221. package/es/lib/utils/getHighlightFromSiblings.js +1 -1
  222. package/es/lib/utils/getHighlightedParts.js +1 -1
  223. package/es/lib/utils/getRefinements.js +2 -2
  224. package/es/lib/utils/index.js +48 -48
  225. package/es/lib/utils/logger.js +1 -1
  226. package/es/lib/utils/mergeSearchParameters.js +2 -2
  227. package/es/lib/utils/prepareTemplateProps.js +1 -1
  228. package/es/lib/utils/reverseHighlightedParts.js +1 -1
  229. package/es/lib/version.d.ts +1 -1
  230. package/es/lib/version.js +1 -1
  231. package/es/middlewares/createInsightsMiddleware.js +3 -3
  232. package/es/middlewares/createMetadataMiddleware.js +1 -1
  233. package/es/middlewares/createRouterMiddleware.js +3 -3
  234. package/es/middlewares/index.js +3 -3
  235. package/es/package.json +1 -0
  236. package/es/types/index.js +14 -14
  237. package/es/widgets/analytics/analytics.js +1 -1
  238. package/es/widgets/answers/answers.js +5 -5
  239. package/es/widgets/breadcrumb/breadcrumb.js +5 -5
  240. package/es/widgets/clear-refinements/clear-refinements.js +5 -5
  241. package/es/widgets/configure/configure.js +2 -2
  242. package/es/widgets/configure-related-items/configure-related-items.js +2 -2
  243. package/es/widgets/current-refinements/current-refinements.js +4 -4
  244. package/es/widgets/dynamic-widgets/dynamic-widgets.js +11 -8
  245. package/es/widgets/geo-search/GeoSearchRenderer.js +2 -2
  246. package/es/widgets/geo-search/geo-search.js +6 -6
  247. package/es/widgets/hierarchical-menu/hierarchical-menu.js +5 -5
  248. package/es/widgets/hits/hits.js +6 -6
  249. package/es/widgets/hits-per-page/hits-per-page.js +4 -4
  250. package/es/widgets/index/index.js +1 -1
  251. package/es/widgets/index.js +34 -34
  252. package/es/widgets/infinite-hits/infinite-hits.js +6 -6
  253. package/es/widgets/menu/menu.js +5 -5
  254. package/es/widgets/menu-select/menu-select.js +5 -5
  255. package/es/widgets/numeric-menu/numeric-menu.js +5 -5
  256. package/es/widgets/pagination/pagination.js +4 -4
  257. package/es/widgets/panel/panel.js +3 -3
  258. package/es/widgets/powered-by/powered-by.js +4 -4
  259. package/es/widgets/query-rule-context/query-rule-context.js +2 -2
  260. package/es/widgets/query-rule-custom-data/query-rule-custom-data.js +4 -4
  261. package/es/widgets/range-input/range-input.js +4 -4
  262. package/es/widgets/range-slider/range-slider.js +4 -4
  263. package/es/widgets/rating-menu/rating-menu.js +5 -5
  264. package/es/widgets/refinement-list/refinement-list.js +6 -6
  265. package/es/widgets/relevant-sort/relevant-sort.js +5 -5
  266. package/es/widgets/search-box/search-box.js +5 -5
  267. package/es/widgets/sort-by/sort-by.js +4 -4
  268. package/es/widgets/stats/defaultTemplates.js +1 -1
  269. package/es/widgets/stats/stats.js +4 -4
  270. package/es/widgets/toggle-refinement/toggle-refinement.js +5 -5
  271. package/es/widgets/voice-search/voice-search.js +5 -5
  272. package/package.json +10 -6
@@ -1,10 +1,9 @@
1
1
  /// <reference types="google.maps" />
2
- /// <reference types="node" />
3
2
 
4
3
  import type algoliasearch from 'algoliasearch/lite';
5
4
  import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
6
5
  import type * as ClientSearch from '@algolia/client-search';
7
- import EventEmitter from 'events';
6
+ import EventEmitter from '@algolia/events';
8
7
  import type { InsightsClient as InsightsClient_2 } from 'search-insights';
9
8
  import type { InsightsMethodMap } from 'search-insights';
10
9
  import type * as Places from 'places.js';
@@ -1102,6 +1101,20 @@ declare type DynamicWidgetsConnectorParams = {
1102
1101
  transformItems?(items: string[], metadata: {
1103
1102
  results: SearchResults;
1104
1103
  }): string[];
1104
+ /**
1105
+ * To prevent unneeded extra network requests when widgets mount or unmount,
1106
+ * we request all facet values.
1107
+ *
1108
+ * @default ['*']
1109
+ */
1110
+ facets?: ['*'] | never[];
1111
+ /**
1112
+ * If you have more than 20 facet values pinned, you need to increase the
1113
+ * maxValuesPerFacet to at least that value.
1114
+ *
1115
+ * @default 20
1116
+ */
1117
+ maxValuesPerFacet?: number;
1105
1118
  };
1106
1119
 
1107
1120
  declare type DynamicWidgetsRenderState = {
@@ -1,10 +1,9 @@
1
1
  /// <reference types="google.maps" />
2
- /// <reference types="node" />
3
2
 
4
3
  import type algoliasearch from 'algoliasearch/lite';
5
4
  import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
6
5
  import type * as ClientSearch from '@algolia/client-search';
7
- import EventEmitter from 'events';
6
+ import EventEmitter from '@algolia/events';
8
7
  import type { InsightsClient as InsightsClient_2 } from 'search-insights';
9
8
  import type { InsightsMethodMap } from 'search-insights';
10
9
  import type * as Places from 'places.js';
@@ -1102,6 +1101,20 @@ declare type DynamicWidgetsConnectorParams = {
1102
1101
  transformItems?(items: string[], metadata: {
1103
1102
  results: SearchResults;
1104
1103
  }): string[];
1104
+ /**
1105
+ * To prevent unneeded extra network requests when widgets mount or unmount,
1106
+ * we request all facet values.
1107
+ *
1108
+ * @default ['*']
1109
+ */
1110
+ facets?: ['*'] | never[];
1111
+ /**
1112
+ * If you have more than 20 facet values pinned, you need to increase the
1113
+ * maxValuesPerFacet to at least that value.
1114
+ *
1115
+ * @default 20
1116
+ */
1117
+ maxValuesPerFacet?: number;
1105
1118
  };
1106
1119
 
1107
1120
  declare type DynamicWidgetsRenderState = {
@@ -1,10 +1,9 @@
1
1
  /// <reference types="google.maps" />
2
- /// <reference types="node" />
3
2
 
4
3
  import type algoliasearch from 'algoliasearch/lite';
5
4
  import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
6
5
  import type * as ClientSearch from '@algolia/client-search';
7
- import EventEmitter from 'events';
6
+ import EventEmitter from '@algolia/events';
8
7
  import type { InsightsClient as InsightsClient_2 } from 'search-insights';
9
8
  import type { InsightsMethodMap } from 'search-insights';
10
9
  import type * as Places from 'places.js';
@@ -1102,6 +1101,20 @@ declare type DynamicWidgetsConnectorParams = {
1102
1101
  transformItems?(items: string[], metadata: {
1103
1102
  results: SearchResults;
1104
1103
  }): string[];
1104
+ /**
1105
+ * To prevent unneeded extra network requests when widgets mount or unmount,
1106
+ * we request all facet values.
1107
+ *
1108
+ * @default ['*']
1109
+ */
1110
+ facets?: ['*'] | never[];
1111
+ /**
1112
+ * If you have more than 20 facet values pinned, you need to increase the
1113
+ * maxValuesPerFacet to at least that value.
1114
+ *
1115
+ * @default 20
1116
+ */
1117
+ maxValuesPerFacet?: number;
1105
1118
  };
1106
1119
 
1107
1120
  declare type DynamicWidgetsRenderState = {