instantsearch.js 4.45.1 → 4.46.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 (230) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/cjs/components/Hits/Hits.js +3 -1
  3. package/cjs/components/InfiniteHits/InfiniteHits.js +3 -1
  4. package/cjs/components/Template/Template.js +13 -3
  5. package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +3 -1
  6. package/cjs/helpers/components/Highlight.js +7 -7
  7. package/cjs/helpers/components/ReverseHighlight.js +7 -7
  8. package/cjs/helpers/components/ReverseSnippet.js +7 -7
  9. package/cjs/helpers/components/Snippet.js +7 -7
  10. package/cjs/lib/InstantSearch.js +33 -24
  11. package/cjs/lib/createHelpers.js +3 -1
  12. package/cjs/lib/formatNumber.js +10 -0
  13. package/cjs/lib/utils/capitalize.js +2 -5
  14. package/cjs/lib/utils/checkIndexUiState.js +3 -5
  15. package/cjs/lib/utils/checkRendering.js +4 -9
  16. package/cjs/lib/utils/clearRefinements.js +3 -9
  17. package/cjs/lib/utils/concatHighlightedParts.js +1 -1
  18. package/cjs/lib/utils/createSendEventForFacet.js +2 -4
  19. package/cjs/lib/utils/cx.js +10 -0
  20. package/cjs/lib/utils/defer.js +3 -6
  21. package/cjs/lib/utils/detect-insights-client.js +1 -1
  22. package/cjs/lib/utils/documentation.js +6 -9
  23. package/cjs/lib/utils/escape-highlight.js +4 -6
  24. package/cjs/lib/utils/escape-html.js +60 -0
  25. package/cjs/lib/utils/find.js +2 -5
  26. package/cjs/lib/utils/findIndex.js +2 -5
  27. package/cjs/lib/utils/getContainerNode.js +4 -9
  28. package/cjs/lib/utils/getHighlightFromSiblings.js +3 -5
  29. package/cjs/lib/utils/getHighlightedParts.js +1 -1
  30. package/cjs/lib/utils/getObjectType.js +2 -5
  31. package/cjs/lib/utils/getPropertyByPath.js +2 -5
  32. package/cjs/lib/utils/getRefinements.js +4 -6
  33. package/cjs/lib/utils/index.js +563 -432
  34. package/cjs/lib/utils/isDomElement.js +2 -5
  35. package/cjs/lib/utils/isEqual.js +2 -5
  36. package/cjs/lib/utils/isFacetRefined.js +1 -1
  37. package/cjs/lib/utils/isFiniteNumber.js +3 -5
  38. package/cjs/lib/utils/isIndexWidget.js +10 -0
  39. package/cjs/lib/utils/isPlainObject.js +2 -5
  40. package/cjs/lib/utils/isSpecialClick.js +2 -5
  41. package/cjs/lib/utils/logger.js +3 -5
  42. package/cjs/lib/utils/mergeSearchParameters.js +7 -10
  43. package/cjs/lib/utils/noop.js +2 -5
  44. package/cjs/lib/utils/prepareTemplateProps.js +4 -9
  45. package/cjs/lib/utils/range.js +2 -5
  46. package/cjs/lib/utils/renderTemplate.js +19 -7
  47. package/cjs/lib/utils/resolveSearchParameters.js +3 -6
  48. package/cjs/lib/utils/reverseHighlightedParts.js +3 -5
  49. package/cjs/lib/utils/setIndexHelperState.js +28 -0
  50. package/cjs/lib/utils/toArray.js +2 -5
  51. package/cjs/lib/utils/uniq.js +2 -5
  52. package/cjs/lib/version.js +1 -1
  53. package/cjs/middlewares/createInsightsMiddleware.js +23 -30
  54. package/cjs/middlewares/createMetadataMiddleware.js +1 -0
  55. package/cjs/middlewares/createRouterMiddleware.js +1 -0
  56. package/cjs/widgets/answers/defaultTemplates.js +6 -2
  57. package/cjs/widgets/breadcrumb/defaultTemplates.js +6 -2
  58. package/cjs/widgets/clear-refinements/defaultTemplates.js +3 -1
  59. package/cjs/widgets/geo-search/createHTMLMarker.js +10 -4
  60. package/cjs/widgets/geo-search/defaultTemplates.js +18 -4
  61. package/cjs/widgets/hierarchical-menu/defaultTemplates.js +26 -2
  62. package/cjs/widgets/hits/defaultTemplates.js +3 -1
  63. package/cjs/widgets/index/index.js +8 -12
  64. package/cjs/widgets/infinite-hits/defaultTemplates.js +9 -3
  65. package/cjs/widgets/menu/defaultTemplates.js +26 -2
  66. package/cjs/widgets/menu-select/defaultTemplates.js +11 -2
  67. package/cjs/widgets/numeric-menu/defaultTemplates.js +20 -1
  68. package/cjs/widgets/range-input/range-input.js +6 -2
  69. package/cjs/widgets/rating-menu/defaultTemplates.js +57 -1
  70. package/cjs/widgets/refinement-list/defaultTemplates.js +38 -3
  71. package/cjs/widgets/relevant-sort/defaultTemplates.js +3 -1
  72. package/cjs/widgets/search-box/defaultTemplates.js +62 -3
  73. package/cjs/widgets/stats/stats.js +70 -22
  74. package/cjs/widgets/toggle-refinement/defaultTemplates.js +4 -1
  75. package/cjs/widgets/voice-search/defaultTemplates.js +81 -9
  76. package/dist/instantsearch.development.d.ts +153 -22
  77. package/dist/instantsearch.development.js +2842 -2112
  78. package/dist/instantsearch.development.js.map +1 -1
  79. package/dist/instantsearch.production.d.ts +153 -22
  80. package/dist/instantsearch.production.min.d.ts +153 -22
  81. package/dist/instantsearch.production.min.js +2 -2
  82. package/dist/instantsearch.production.min.js.map +1 -1
  83. package/es/components/Breadcrumb/Breadcrumb.d.ts +1 -1
  84. package/es/components/ClearRefinements/ClearRefinements.d.ts +1 -1
  85. package/es/components/GeoSearchControls/GeoSearchControls.d.ts +1 -1
  86. package/es/components/Hits/Hits.d.ts +2 -3
  87. package/es/components/Hits/Hits.js +3 -1
  88. package/es/components/InfiniteHits/InfiniteHits.d.ts +1 -1
  89. package/es/components/InfiniteHits/InfiniteHits.js +3 -1
  90. package/es/components/RefinementList/RefinementList.d.ts +1 -1
  91. package/es/components/Template/Template.d.ts +4 -3
  92. package/es/components/Template/Template.js +14 -4
  93. package/es/components/ToggleRefinement/ToggleRefinement.d.ts +1 -4
  94. package/es/components/ToggleRefinement/ToggleRefinement.js +0 -4
  95. package/es/connectors/toggle-refinement/connectToggleRefinement.d.ts +3 -2
  96. package/es/connectors/toggle-refinement/connectToggleRefinement.js +3 -1
  97. package/es/helpers/components/Highlight.js +7 -5
  98. package/es/helpers/components/ReverseHighlight.js +7 -5
  99. package/es/helpers/components/ReverseSnippet.js +7 -5
  100. package/es/helpers/components/Snippet.js +7 -5
  101. package/es/lib/InstantSearch.d.ts +6 -1
  102. package/es/lib/InstantSearch.js +34 -21
  103. package/es/lib/createHelpers.js +2 -1
  104. package/es/lib/formatNumber.d.ts +1 -0
  105. package/es/lib/formatNumber.js +3 -0
  106. package/es/lib/utils/capitalize.d.ts +1 -2
  107. package/es/lib/utils/capitalize.js +2 -4
  108. package/es/lib/utils/checkIndexUiState.js +1 -1
  109. package/es/lib/utils/checkRendering.d.ts +1 -2
  110. package/es/lib/utils/checkRendering.js +3 -6
  111. package/es/lib/utils/clearRefinements.d.ts +4 -8
  112. package/es/lib/utils/clearRefinements.js +3 -8
  113. package/es/lib/utils/concatHighlightedParts.d.ts +1 -1
  114. package/es/lib/utils/concatHighlightedParts.js +1 -1
  115. package/es/lib/utils/createSendEventForFacet.js +1 -1
  116. package/es/lib/utils/createSendEventForHits.d.ts +0 -3
  117. package/es/lib/utils/createSendEventForHits.js +0 -3
  118. package/es/lib/utils/cx.d.ts +1 -0
  119. package/es/lib/utils/cx.js +3 -0
  120. package/es/lib/utils/defer.d.ts +2 -2
  121. package/es/lib/utils/defer.js +2 -5
  122. package/es/lib/utils/detect-insights-client.d.ts +1 -1
  123. package/es/lib/utils/detect-insights-client.js +1 -1
  124. package/es/lib/utils/documentation.d.ts +2 -2
  125. package/es/lib/utils/documentation.js +4 -4
  126. package/es/lib/utils/escape-highlight.js +2 -2
  127. package/es/lib/utils/{escape.d.ts → escape-html.d.ts} +6 -2
  128. package/es/lib/utils/escape-html.js +51 -0
  129. package/es/lib/utils/escapeFacetValue.d.ts +1 -1
  130. package/es/lib/utils/find.d.ts +1 -2
  131. package/es/lib/utils/find.js +2 -4
  132. package/es/lib/utils/findIndex.d.ts +1 -2
  133. package/es/lib/utils/findIndex.js +2 -4
  134. package/es/lib/utils/getContainerNode.d.ts +1 -2
  135. package/es/lib/utils/getContainerNode.js +3 -5
  136. package/es/lib/utils/getHighlightFromSiblings.d.ts +1 -1
  137. package/es/lib/utils/getHighlightFromSiblings.js +2 -2
  138. package/es/lib/utils/getHighlightedParts.d.ts +1 -1
  139. package/es/lib/utils/getHighlightedParts.js +1 -1
  140. package/es/lib/utils/getObjectType.d.ts +1 -2
  141. package/es/lib/utils/getObjectType.js +2 -4
  142. package/es/lib/utils/getPropertyByPath.d.ts +1 -2
  143. package/es/lib/utils/getPropertyByPath.js +2 -4
  144. package/es/lib/utils/getRefinements.d.ts +1 -1
  145. package/es/lib/utils/getRefinements.js +2 -2
  146. package/es/lib/utils/index.d.ts +46 -45
  147. package/es/lib/utils/index.js +46 -45
  148. package/es/lib/utils/isDomElement.d.ts +1 -2
  149. package/es/lib/utils/isDomElement.js +2 -4
  150. package/es/lib/utils/isEqual.d.ts +1 -2
  151. package/es/lib/utils/isEqual.js +2 -4
  152. package/es/lib/utils/isFacetRefined.d.ts +1 -1
  153. package/es/lib/utils/isFacetRefined.js +1 -1
  154. package/es/lib/utils/isFiniteNumber.d.ts +1 -2
  155. package/es/lib/utils/isFiniteNumber.js +3 -4
  156. package/es/lib/utils/isIndexWidget.d.ts +3 -0
  157. package/es/lib/utils/isIndexWidget.js +3 -0
  158. package/es/lib/utils/isPlainObject.d.ts +1 -2
  159. package/es/lib/utils/isPlainObject.js +2 -4
  160. package/es/lib/utils/isSpecialClick.d.ts +1 -2
  161. package/es/lib/utils/isSpecialClick.js +2 -4
  162. package/es/lib/utils/logger.js +1 -1
  163. package/es/lib/utils/mergeSearchParameters.d.ts +1 -2
  164. package/es/lib/utils/mergeSearchParameters.js +4 -6
  165. package/es/lib/utils/noop.d.ts +1 -2
  166. package/es/lib/utils/noop.js +1 -3
  167. package/es/lib/utils/prepareTemplateProps.d.ts +2 -2
  168. package/es/lib/utils/prepareTemplateProps.js +3 -5
  169. package/es/lib/utils/range.d.ts +2 -2
  170. package/es/lib/utils/range.js +2 -4
  171. package/es/lib/utils/renderTemplate.d.ts +4 -4
  172. package/es/lib/utils/renderTemplate.js +17 -6
  173. package/es/lib/utils/resolveSearchParameters.d.ts +1 -2
  174. package/es/lib/utils/resolveSearchParameters.js +2 -4
  175. package/es/lib/utils/reverseHighlightedParts.d.ts +1 -1
  176. package/es/lib/utils/reverseHighlightedParts.js +2 -2
  177. package/es/lib/utils/setIndexHelperState.d.ts +3 -0
  178. package/es/lib/utils/setIndexHelperState.js +19 -0
  179. package/es/lib/utils/toArray.d.ts +3 -2
  180. package/es/lib/utils/toArray.js +2 -4
  181. package/es/lib/utils/uniq.d.ts +1 -2
  182. package/es/lib/utils/uniq.js +2 -4
  183. package/es/lib/version.d.ts +1 -1
  184. package/es/lib/version.js +1 -1
  185. package/es/middlewares/createInsightsMiddleware.js +23 -27
  186. package/es/middlewares/createMetadataMiddleware.js +1 -0
  187. package/es/middlewares/createRouterMiddleware.js +1 -0
  188. package/es/types/middleware.d.ts +1 -0
  189. package/es/types/templates.d.ts +16 -3
  190. package/es/widgets/answers/defaultTemplates.js +6 -2
  191. package/es/widgets/breadcrumb/defaultTemplates.js +6 -2
  192. package/es/widgets/clear-refinements/clear-refinements.d.ts +3 -1
  193. package/es/widgets/clear-refinements/defaultTemplates.js +3 -1
  194. package/es/widgets/geo-search/createHTMLMarker.d.ts +2 -1
  195. package/es/widgets/geo-search/createHTMLMarker.js +8 -1
  196. package/es/widgets/geo-search/defaultTemplates.d.ts +1 -0
  197. package/es/widgets/geo-search/defaultTemplates.js +17 -4
  198. package/es/widgets/hierarchical-menu/defaultTemplates.js +22 -2
  199. package/es/widgets/hierarchical-menu/hierarchical-menu.d.ts +2 -0
  200. package/es/widgets/hits/defaultTemplates.js +3 -1
  201. package/es/widgets/hits/hits.d.ts +2 -1
  202. package/es/widgets/index/index.d.ts +0 -1
  203. package/es/widgets/index/index.js +5 -6
  204. package/es/widgets/infinite-hits/defaultTemplates.js +9 -3
  205. package/es/widgets/infinite-hits/infinite-hits.d.ts +1 -3
  206. package/es/widgets/menu/defaultTemplates.js +22 -2
  207. package/es/widgets/menu-select/defaultTemplates.js +9 -2
  208. package/es/widgets/numeric-menu/defaultTemplates.js +18 -1
  209. package/es/widgets/range-input/range-input.js +6 -2
  210. package/es/widgets/rating-menu/defaultTemplates.js +54 -1
  211. package/es/widgets/rating-menu/rating-menu.d.ts +6 -0
  212. package/es/widgets/refinement-list/defaultTemplates.js +34 -3
  213. package/es/widgets/refinement-list/refinement-list.d.ts +7 -1
  214. package/es/widgets/relevant-sort/defaultTemplates.js +3 -1
  215. package/es/widgets/search-box/defaultTemplates.js +61 -3
  216. package/es/widgets/search-box/search-box.d.ts +10 -3
  217. package/es/widgets/stats/stats.d.ts +10 -6
  218. package/es/widgets/stats/stats.js +69 -22
  219. package/es/widgets/toggle-refinement/defaultTemplates.js +4 -1
  220. package/es/widgets/toggle-refinement/toggle-refinement.d.ts +3 -1
  221. package/es/widgets/voice-search/defaultTemplates.js +81 -9
  222. package/package.json +8 -7
  223. package/cjs/lib/utils/convertNumericRefinementsToFilters.js +0 -31
  224. package/cjs/lib/utils/escape.js +0 -35
  225. package/cjs/lib/utils/unescape.js +0 -32
  226. package/es/lib/utils/convertNumericRefinementsToFilters.d.ts +0 -2
  227. package/es/lib/utils/convertNumericRefinementsToFilters.js +0 -24
  228. package/es/lib/utils/escape.js +0 -27
  229. package/es/lib/utils/unescape.d.ts +0 -9
  230. package/es/lib/utils/unescape.js +0 -25
@@ -2,7 +2,7 @@
2
2
  import { h } from 'preact';
3
3
  import type { BreadcrumbCSSClasses, BreadcrumbTemplates } from '../../widgets/breadcrumb/breadcrumb';
4
4
  import type { ComponentCSSClasses } from '../../types';
5
- import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
5
+ import type { PreparedTemplateProps } from '../../lib/utils';
6
6
  import type { BreadcrumbConnectorParamsItem } from '../../connectors/breadcrumb/connectBreadcrumb';
7
7
  export declare type BreadcrumbComponentCSSClasses = ComponentCSSClasses<BreadcrumbCSSClasses>;
8
8
  export declare type BreadcrumbComponentTemplates = Required<BreadcrumbTemplates>;
@@ -3,7 +3,7 @@ import { h } from 'preact';
3
3
  import type { ClearRefinementsRenderState } from '../../connectors/clear-refinements/connectClearRefinements';
4
4
  import type { ClearRefinementsCSSClasses, ClearRefinementsTemplates } from '../../widgets/clear-refinements/clear-refinements';
5
5
  import type { ComponentCSSClasses } from '../../types';
6
- import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
6
+ import type { PreparedTemplateProps } from '../../lib/utils';
7
7
  export declare type ClearRefinementsComponentCSSClasses = ComponentCSSClasses<ClearRefinementsCSSClasses>;
8
8
  export declare type ClearRefinementsComponentTemplates = Required<ClearRefinementsTemplates>;
9
9
  export declare type ClearRefinementsProps = {
@@ -2,7 +2,7 @@
2
2
  import { h } from 'preact';
3
3
  import type { GeoSearchCSSClasses, GeoSearchTemplates } from '../../widgets/geo-search/geo-search';
4
4
  import type { ComponentCSSClasses } from '../../types';
5
- import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
5
+ import type { PreparedTemplateProps } from '../../lib/utils';
6
6
  declare type Props = {
7
7
  cssClasses: ComponentCSSClasses<GeoSearchCSSClasses>;
8
8
  enableRefine: boolean;
@@ -1,10 +1,9 @@
1
1
  /** @jsx h */
2
2
  import { h } from 'preact';
3
3
  import type { SearchResults } from 'algoliasearch-helper';
4
- import type { BindEventForHits, SendEventForHits } from '../../lib/utils';
4
+ import type { BindEventForHits, SendEventForHits, PreparedTemplateProps } from '../../lib/utils';
5
5
  import type { ComponentCSSClasses, Hit } from '../../types';
6
6
  import type { HitsCSSClasses, HitsTemplates } from '../../widgets/hits/hits';
7
- import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
8
7
  export declare type HitsComponentCSSClasses = ComponentCSSClasses<HitsCSSClasses>;
9
8
  export declare type HitsComponentTemplates = Required<HitsTemplates>;
10
9
  export declare type HitsProps = {
@@ -15,5 +14,5 @@ export declare type HitsProps = {
15
14
  cssClasses: HitsComponentCSSClasses;
16
15
  templateProps: PreparedTemplateProps<HitsComponentTemplates>;
17
16
  };
18
- declare const Hits: ({ results, hits, bindEvent, cssClasses, templateProps, }: HitsProps) => h.JSX.Element;
17
+ declare const Hits: ({ results, hits, bindEvent, sendEvent, cssClasses, templateProps, }: HitsProps) => h.JSX.Element;
19
18
  export default Hits;
@@ -15,6 +15,7 @@ var Hits = function Hits(_ref) {
15
15
  var results = _ref.results,
16
16
  hits = _ref.hits,
17
17
  bindEvent = _ref.bindEvent,
18
+ sendEvent = _ref.sendEvent,
18
19
  cssClasses = _ref.cssClasses,
19
20
  templateProps = _ref.templateProps;
20
21
 
@@ -43,7 +44,8 @@ var Hits = function Hits(_ref) {
43
44
  data: _objectSpread(_objectSpread({}, hit), {}, {
44
45
  __hitIndex: index
45
46
  }),
46
- bindEvent: bindEvent
47
+ bindEvent: bindEvent,
48
+ sendEvent: sendEvent
47
49
  }));
48
50
  })));
49
51
  };
@@ -22,5 +22,5 @@ export declare type InfiniteHitsProps = {
22
22
  sendEvent: SendEventForHits;
23
23
  bindEvent: BindEventForHits;
24
24
  };
25
- declare const InfiniteHits: ({ results, hits, bindEvent, hasShowPrevious, showPrevious, showMore, isFirstPage, isLastPage, cssClasses, templateProps, }: InfiniteHitsProps) => h.JSX.Element;
25
+ declare const InfiniteHits: ({ results, hits, bindEvent, sendEvent, hasShowPrevious, showPrevious, showMore, isFirstPage, isLastPage, cssClasses, templateProps, }: InfiniteHitsProps) => h.JSX.Element;
26
26
  export default InfiniteHits;
@@ -15,6 +15,7 @@ var InfiniteHits = function InfiniteHits(_ref) {
15
15
  var results = _ref.results,
16
16
  hits = _ref.hits,
17
17
  bindEvent = _ref.bindEvent,
18
+ sendEvent = _ref.sendEvent,
18
19
  hasShowPrevious = _ref.hasShowPrevious,
19
20
  showPrevious = _ref.showPrevious,
20
21
  showMore = _ref.showMore,
@@ -56,7 +57,8 @@ var InfiniteHits = function InfiniteHits(_ref) {
56
57
  data: _objectSpread(_objectSpread({}, hit), {}, {
57
58
  __hitIndex: position
58
59
  }),
59
- bindEvent: bindEvent
60
+ bindEvent: bindEvent,
61
+ sendEvent: sendEvent
60
62
  }));
61
63
  })), h(Template, _extends({}, templateProps, {
62
64
  templateKey: "showMoreText",
@@ -1,7 +1,7 @@
1
1
  /** @jsx h */
2
2
  import type { JSX } from 'preact';
3
3
  import { Component } from 'preact';
4
- import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
4
+ import type { PreparedTemplateProps } from '../../lib/utils';
5
5
  import type { SearchBoxComponentCSSClasses, SearchBoxComponentTemplates } from '../SearchBox/SearchBox';
6
6
  import type { HierarchicalMenuItem } from '../../connectors/hierarchical-menu/connectHierarchicalMenu';
7
7
  import type { ComponentCSSClasses, CreateURL, Templates } from '../../types';
@@ -1,7 +1,7 @@
1
1
  /** @jsx h */
2
2
  import type { JSX } from 'preact';
3
3
  import { Component } from 'preact';
4
- import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
4
+ import type { BindEventForHits, SendEventForHits, PreparedTemplateProps } from '../../lib/utils';
5
5
  import type { Templates } from '../../types';
6
6
  declare const defaultProps: {
7
7
  data: {};
@@ -10,12 +10,13 @@ declare const defaultProps: {
10
10
  templates: {};
11
11
  templatesConfig: {};
12
12
  };
13
- declare type TemplateProps = {
13
+ export declare type TemplateProps = {
14
14
  data?: Record<string, any>;
15
15
  rootProps?: Record<string, any>;
16
16
  rootTagName?: keyof JSX.IntrinsicElements;
17
17
  templateKey: string;
18
- bindEvent?: (...args: any[]) => string;
18
+ bindEvent?: BindEventForHits;
19
+ sendEvent?: SendEventForHits;
19
20
  } & PreparedTemplateProps<Templates> & Readonly<typeof defaultProps>;
20
21
  declare class Template extends Component<TemplateProps> {
21
22
  static readonly defaultProps: {
@@ -1,7 +1,7 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
5
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
6
 
7
7
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -26,7 +26,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
26
26
 
27
27
  /** @jsx h */
28
28
  import { h, Component } from 'preact';
29
- import { renderTemplate, isEqual } from "../../lib/utils/index.js";
29
+ import { warning, renderTemplate, isEqual } from "../../lib/utils/index.js";
30
30
  var defaultProps = {
31
31
  data: {},
32
32
  rootTagName: 'div',
@@ -55,6 +55,11 @@ var Template = /*#__PURE__*/function (_Component) {
55
55
  }, {
56
56
  key: "render",
57
57
  value: function render() {
58
+ var _this = this;
59
+
60
+ process.env.NODE_ENV === 'development' ? warning(Object.keys(this.props.templates).every(function (key) {
61
+ return typeof _this.props.templates[key] === 'function';
62
+ }), "Hogan.js and string-based templates are deprecated and will not be supported in InstantSearch.js 5.x.\n\nYou can replace them with function-form templates and use either the provided `html` function or JSX templates.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/#upgrade-templates") : void 0;
58
63
  var RootTagName = this.props.rootTagName;
59
64
  var useCustomCompileOptions = this.props.useCustomCompileOptions[this.props.templateKey];
60
65
  var compileOptions = useCustomCompileOptions ? this.props.templatesConfig.compileOptions : {};
@@ -64,7 +69,8 @@ var Template = /*#__PURE__*/function (_Component) {
64
69
  compileOptions: compileOptions,
65
70
  helpers: this.props.templatesConfig.helpers,
66
71
  data: this.props.data,
67
- bindEvent: this.props.bindEvent
72
+ bindEvent: this.props.bindEvent,
73
+ sendEvent: this.props.sendEvent
68
74
  });
69
75
 
70
76
  if (content === null) {
@@ -73,6 +79,10 @@ var Template = /*#__PURE__*/function (_Component) {
73
79
  return null;
74
80
  }
75
81
 
82
+ if (_typeof(content) === 'object') {
83
+ return h(RootTagName, this.props.rootProps, content);
84
+ }
85
+
76
86
  return h(RootTagName, _extends({}, this.props.rootProps, {
77
87
  dangerouslySetInnerHTML: {
78
88
  __html: content
@@ -1,10 +1,7 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
1
  /** @jsx h */
5
2
  import { h } from 'preact';
6
3
  import type { ToggleRefinementRenderState, ToggleRefinementValue } from '../../connectors/toggle-refinement/connectToggleRefinement';
7
- import type { PreparedTemplateProps } from '../../lib/utils/prepareTemplateProps';
4
+ import type { PreparedTemplateProps } from '../../lib/utils';
8
5
  import type { ComponentCSSClasses } from '../../types';
9
6
  import type { ToggleRefinementTemplates, ToggleRefinementCSSClasses } from '../../widgets/toggle-refinement/toggle-refinement';
10
7
  export declare type ToggleRefinementComponentCSSClasses = ComponentCSSClasses<ToggleRefinementCSSClasses>;
@@ -1,9 +1,5 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- /**
4
- * @jest-environment jsdom
5
- */
6
-
7
3
  /** @jsx h */
8
4
  import { h } from 'preact';
9
5
  import Template from "../Template/Template.js";
@@ -21,12 +21,13 @@ export declare type ToggleRefinementConnectorParams = {
21
21
  * Value to filter on when toggled.
22
22
  * @default "true"
23
23
  */
24
- on?: string | string[] | boolean | boolean[] | number | number[];
24
+ on?: FacetValue | FacetValue[];
25
25
  /**
26
26
  * Value to filter on when not toggled.
27
27
  */
28
- off?: string | string[] | boolean | boolean[] | number | number[];
28
+ off?: FacetValue | FacetValue[];
29
29
  };
30
+ declare type FacetValue = string | boolean | number;
30
31
  export declare type ToggleRefinementRenderState = {
31
32
  /** The current toggle value */
32
33
  value: {
@@ -80,7 +80,9 @@ var connectToggleRefinement = function connectToggleRefinement(renderFn) {
80
80
  throw new Error(withUsage('The `attribute` option is required.'));
81
81
  }
82
82
 
83
- var hasAnOffValue = userOff !== undefined;
83
+ var hasAnOffValue = userOff !== undefined; // even though facet values can be numbers and boolean,
84
+ // the helper methods only accept string in the type
85
+
84
86
  var on = toArray(userOn).map(escapeFacetValue);
85
87
  var off = hasAnOffValue ? toArray(userOff).map(escapeFacetValue) : undefined;
86
88
  var sendEvent;
@@ -6,11 +6,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
6
6
 
7
7
  /** @jsx h */
8
8
  import { h } from 'preact';
9
- import { Highlight as HighlightUiComponent } from "../../components/Highlight/Highlight.js";
10
- import getHighlightedParts from "../../lib/utils/getHighlightedParts.js";
11
- import getPropertyByPath from "../../lib/utils/getPropertyByPath.js";
12
- import unescape from "../../lib/utils/unescape.js";
9
+ import { Highlight as HighlightUiComponent } from "../../components/Highlight/Highlight.js"; // These utils are individually imported, as utils/renderTemplate imports helpers/components, importing lib/utils would create a circular dependency.
10
+
11
+ import { getPropertyByPath } from "../../lib/utils/getPropertyByPath.js";
12
+ import { unescape } from "../../lib/utils/escape-html.js";
13
+ import { toArray } from "../../lib/utils/toArray.js";
13
14
  import { warning } from "../../lib/utils/logger.js";
15
+ import { getHighlightedParts } from "../../lib/utils/getHighlightedParts.js";
14
16
  export function Highlight(_ref) {
15
17
  var hit = _ref.hit,
16
18
  attribute = _ref.attribute,
@@ -18,7 +20,7 @@ export function Highlight(_ref) {
18
20
  props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
19
21
 
20
22
  var property = getPropertyByPath(hit._highlightResult, attribute) || [];
21
- var properties = Array.isArray(property) ? property : [property];
23
+ var properties = toArray(property);
22
24
  process.env.NODE_ENV === 'development' ? warning(Boolean(properties.length), "Could not enable highlight for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
23
25
  var parts = properties.map(function (_ref2) {
24
26
  var value = _ref2.value;
@@ -12,11 +12,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
12
 
13
13
  /** @jsx h */
14
14
  import { h } from 'preact';
15
- import { ReverseHighlight as ReverseHighlightUiComponent } from "../../components/ReverseHighlight/ReverseHighlight.js";
16
- import getHighlightedParts from "../../lib/utils/getHighlightedParts.js";
17
- import getPropertyByPath from "../../lib/utils/getPropertyByPath.js";
18
- import unescape from "../../lib/utils/unescape.js";
15
+ import { ReverseHighlight as ReverseHighlightUiComponent } from "../../components/ReverseHighlight/ReverseHighlight.js"; // These utils are individually imported, as utils/renderTemplate imports helpers/components, importing lib/utils would create a circular dependency.
16
+
17
+ import { getPropertyByPath } from "../../lib/utils/getPropertyByPath.js";
18
+ import { unescape } from "../../lib/utils/escape-html.js";
19
+ import { toArray } from "../../lib/utils/toArray.js";
19
20
  import { warning } from "../../lib/utils/logger.js";
21
+ import { getHighlightedParts } from "../../lib/utils/getHighlightedParts.js";
20
22
  export function ReverseHighlight(_ref) {
21
23
  var hit = _ref.hit,
22
24
  attribute = _ref.attribute,
@@ -24,7 +26,7 @@ export function ReverseHighlight(_ref) {
24
26
  props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
25
27
 
26
28
  var property = getPropertyByPath(hit._highlightResult, attribute) || [];
27
- var properties = Array.isArray(property) ? property : [property];
29
+ var properties = toArray(property);
28
30
  process.env.NODE_ENV === 'development' ? warning(Boolean(properties.length), "Could not enable highlight for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
29
31
  var parts = properties.map(function (_ref2) {
30
32
  var value = _ref2.value;
@@ -12,11 +12,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
12
 
13
13
  /** @jsx h */
14
14
  import { h } from 'preact';
15
- import { ReverseSnippet as ReverseSnippetUiComponent } from "../../components/ReverseSnippet/ReverseSnippet.js";
16
- import getHighlightedParts from "../../lib/utils/getHighlightedParts.js";
17
- import getPropertyByPath from "../../lib/utils/getPropertyByPath.js";
18
- import unescape from "../../lib/utils/unescape.js";
15
+ import { ReverseSnippet as ReverseSnippetUiComponent } from "../../components/ReverseSnippet/ReverseSnippet.js"; // These utils are individually imported, as utils/renderTemplate imports helpers/components, importing lib/utils would create a circular dependency.
16
+
17
+ import { getPropertyByPath } from "../../lib/utils/getPropertyByPath.js";
18
+ import { unescape } from "../../lib/utils/escape-html.js";
19
+ import { toArray } from "../../lib/utils/toArray.js";
19
20
  import { warning } from "../../lib/utils/logger.js";
21
+ import { getHighlightedParts } from "../../lib/utils/getHighlightedParts.js";
20
22
  export function ReverseSnippet(_ref) {
21
23
  var hit = _ref.hit,
22
24
  attribute = _ref.attribute,
@@ -24,7 +26,7 @@ export function ReverseSnippet(_ref) {
24
26
  props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
25
27
 
26
28
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
27
- var properties = Array.isArray(property) ? property : [property];
29
+ var properties = toArray(property);
28
30
  process.env.NODE_ENV === 'development' ? warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
29
31
  var parts = properties.map(function (_ref2) {
30
32
  var value = _ref2.value;
@@ -6,11 +6,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
6
6
 
7
7
  /** @jsx h */
8
8
  import { h } from 'preact';
9
- import { Snippet as SnippetUiComponent } from "../../components/Snippet/Snippet.js";
10
- import getHighlightedParts from "../../lib/utils/getHighlightedParts.js";
11
- import getPropertyByPath from "../../lib/utils/getPropertyByPath.js";
12
- import unescape from "../../lib/utils/unescape.js";
9
+ import { Snippet as SnippetUiComponent } from "../../components/Snippet/Snippet.js"; // These utils are individually imported, as utils/renderTemplate imports helpers/components, importing lib/utils would create a circular dependency.
10
+
11
+ import { getPropertyByPath } from "../../lib/utils/getPropertyByPath.js";
12
+ import { toArray } from "../../lib/utils/toArray.js";
13
+ import { unescape } from "../../lib/utils/escape-html.js";
13
14
  import { warning } from "../../lib/utils/logger.js";
15
+ import { getHighlightedParts } from "../../lib/utils/getHighlightedParts.js";
14
16
  export function Snippet(_ref) {
15
17
  var hit = _ref.hit,
16
18
  attribute = _ref.attribute,
@@ -18,7 +20,7 @@ export function Snippet(_ref) {
18
20
  props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
19
21
 
20
22
  var property = getPropertyByPath(hit._snippetResult, attribute) || [];
21
- var properties = Array.isArray(property) ? property : [property];
23
+ var properties = toArray(property);
22
24
  process.env.NODE_ENV === 'development' ? warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) : void 0;
23
25
  var parts = properties.map(function (_ref2) {
24
26
  var value = _ref2.value;
@@ -177,7 +177,12 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
177
177
  cancel(): void;
178
178
  };
179
179
  scheduleStalledRender(): void;
180
- setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState)): void;
180
+ /**
181
+ * Set the UI state and trigger a search.
182
+ * @param uiState The next UI state or a function computing it from the current state
183
+ * @param callOnStateChange private parameter used to know if the method is called from a state change
184
+ */
185
+ setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState), callOnStateChange?: boolean): void;
181
186
  getUiState(): TUiState;
182
187
  onInternalStateChange: ((...args: any[]) => void) & {
183
188
  wait(): Promise<void>;
@@ -28,10 +28,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
28
28
 
29
29
  import algoliasearchHelper from 'algoliasearch-helper';
30
30
  import EventEmitter from '@algolia/events';
31
- import index, { isIndexWidget } from "../widgets/index/index.js";
31
+ import index from "../widgets/index/index.js";
32
32
  import version from "./version.js";
33
33
  import createHelpers from "./createHelpers.js";
34
- import { createDocumentationMessageGenerator, createDocumentationLink, defer, noop, warning, checkIndexUiState } from "./utils/index.js";
34
+ import { createDocumentationMessageGenerator, createDocumentationLink, defer, noop, warning, setIndexHelperState } from "./utils/index.js";
35
35
  import { createRouterMiddleware } from "../middlewares/createRouterMiddleware.js";
36
36
  import { createMetadataMiddleware, isMetadataEnabled } from "../middlewares/createMetadataMiddleware.js";
37
37
  var withUsage = createDocumentationMessageGenerator({
@@ -233,6 +233,7 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
233
233
  var newMiddlewareList = middleware.map(function (fn) {
234
234
  var newMiddleware = _objectSpread({
235
235
  subscribe: noop,
236
+ started: noop,
236
237
  unsubscribe: noop,
237
238
  onStateChange: noop
238
239
  }, fn({
@@ -251,6 +252,7 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
251
252
  if (this.started) {
252
253
  newMiddlewareList.forEach(function (m) {
253
254
  m.subscribe();
255
+ m.started();
254
256
  });
255
257
  }
256
258
 
@@ -487,6 +489,10 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
487
489
  // to init them directly after add
488
490
 
489
491
  this.started = true;
492
+ this.middleware.forEach(function (_ref6) {
493
+ var instance = _ref6.instance;
494
+ instance.started();
495
+ });
490
496
  }
491
497
  /**
492
498
  * Removes all widgets without triggering a search afterwards. This is an **EXPERIMENTAL** feature,
@@ -513,8 +519,8 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
513
519
  this.mainHelper.removeAllListeners();
514
520
  this.mainHelper = null;
515
521
  this.helper = null;
516
- this.middleware.forEach(function (_ref6) {
517
- var instance = _ref6.instance;
522
+ this.middleware.forEach(function (_ref7) {
523
+ var instance = _ref7.instance;
518
524
  instance.unsubscribe();
519
525
  });
520
526
  }
@@ -531,9 +537,19 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
531
537
  }, this._stalledSearchDelay);
532
538
  }
533
539
  }
540
+ /**
541
+ * Set the UI state and trigger a search.
542
+ * @param uiState The next UI state or a function computing it from the current state
543
+ * @param callOnStateChange private parameter used to know if the method is called from a state change
544
+ */
545
+
534
546
  }, {
535
547
  key: "setUiState",
536
548
  value: function setUiState(uiState) {
549
+ var _this5 = this;
550
+
551
+ var callOnStateChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
552
+
537
553
  if (!this.mainHelper) {
538
554
  throw new Error(withUsage('The `start` method needs to be called before `setUiState`.'));
539
555
  } // We refresh the index UI state to update the local UI state that the
@@ -543,25 +559,22 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
543
559
  this.mainIndex.refreshUiState();
544
560
  var nextUiState = typeof uiState === 'function' ? uiState(this.mainIndex.getWidgetUiState({})) : uiState;
545
561
 
546
- var setIndexHelperState = function setIndexHelperState(indexWidget) {
547
- var nextIndexUiState = nextUiState[indexWidget.getIndexId()] || {};
548
-
549
- if (process.env.NODE_ENV === 'development') {
550
- checkIndexUiState({
551
- index: indexWidget,
552
- indexUiState: nextIndexUiState
553
- });
554
- }
562
+ if (this.onStateChange && callOnStateChange) {
563
+ this.onStateChange({
564
+ uiState: nextUiState,
565
+ setUiState: function setUiState(finalUiState) {
566
+ setIndexHelperState(typeof finalUiState === 'function' ? finalUiState(nextUiState) : finalUiState, _this5.mainIndex);
555
567
 
556
- indexWidget.getHelper().setState(indexWidget.getWidgetSearchParameters(indexWidget.getHelper().state, {
557
- uiState: nextIndexUiState
558
- }));
559
- indexWidget.getWidgets().filter(isIndexWidget).forEach(setIndexHelperState);
560
- };
568
+ _this5.scheduleSearch();
561
569
 
562
- setIndexHelperState(this.mainIndex);
563
- this.scheduleSearch();
564
- this.onInternalStateChange();
570
+ _this5.onInternalStateChange();
571
+ }
572
+ });
573
+ } else {
574
+ setIndexHelperState(nextUiState, this.mainIndex);
575
+ this.scheduleSearch();
576
+ this.onInternalStateChange();
577
+ }
565
578
  }
566
579
  }, {
567
580
  key: "getUiState",
@@ -5,11 +5,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import { highlight as _highlight, reverseHighlight as _reverseHighlight, snippet as _snippet, reverseSnippet as _reverseSnippet, insights as _insights } from "../helpers/index.js";
8
+ import { formatNumber as _formatNumber } from "./formatNumber.js";
8
9
  export default function hoganHelpers(_ref) {
9
10
  var numberLocale = _ref.numberLocale;
10
11
  return {
11
12
  formatNumber: function formatNumber(value, render) {
12
- return Number(render(value)).toLocaleString(numberLocale);
13
+ return _formatNumber(Number(render(value)), numberLocale);
13
14
  },
14
15
  highlight: function highlight(options, render) {
15
16
  try {
@@ -0,0 +1 @@
1
+ export declare function formatNumber(value: number, numberLocale?: string): string;
@@ -0,0 +1,3 @@
1
+ export function formatNumber(value, numberLocale) {
2
+ return value.toLocaleString(numberLocale);
3
+ }
@@ -1,2 +1 @@
1
- declare function capitalize(text: string): string;
2
- export default capitalize;
1
+ export declare function capitalize(text: string): string;
@@ -1,5 +1,3 @@
1
- function capitalize(text) {
1
+ export function capitalize(text) {
2
2
  return text.toString().charAt(0).toUpperCase() + text.toString().slice(1);
3
- }
4
-
5
- export default capitalize;
3
+ }
@@ -18,7 +18,7 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
18
18
 
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
20
 
21
- import capitalize from "./capitalize.js";
21
+ import { capitalize } from "./capitalize.js";
22
22
  import { warning } from "./logger.js";
23
23
  import { keys } from "./typedObject.js"; // Some connectors are responsible for multiple widgets so we need
24
24
  // to map them.
@@ -1,3 +1,2 @@
1
1
  import type { Renderer } from '../../types/connector';
2
- declare function checkRendering<TRenderOptions, TWidgetParams>(rendering: Renderer<TRenderOptions, TWidgetParams>, usage: string): void;
3
- export default checkRendering;
2
+ export declare function checkRendering<TRenderOptions, TWidgetParams>(rendering: Renderer<TRenderOptions, TWidgetParams>, usage: string): void;
@@ -1,9 +1,6 @@
1
- import getObjectType from "./getObjectType.js";
2
-
3
- function checkRendering(rendering, usage) {
1
+ import { getObjectType } from "./getObjectType.js";
2
+ export function checkRendering(rendering, usage) {
4
3
  if (rendering === undefined || typeof rendering !== 'function') {
5
4
  throw new Error("The render function is not valid (received type ".concat(getObjectType(rendering), ").\n\n").concat(usage));
6
5
  }
7
- }
8
-
9
- export default checkRendering;
6
+ }
@@ -1,15 +1,11 @@
1
- import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
1
+ import type { AlgoliaSearchHelper, SearchParameters } from 'algoliasearch-helper';
2
2
  /**
3
3
  * Clears the refinements of a SearchParameters object based on rules provided.
4
4
  * The included attributes list is applied before the excluded attributes list. If the list
5
5
  * is not provided, this list of all the currently refined attributes is used as included attributes.
6
- * @param {object} $0 parameters
7
- * @param {Helper} $0.helper instance of the Helper
8
- * @param {string[]} [$0.attributesToClear = []] list of parameters to clear
9
- * @returns {SearchParameters} search parameters with refinements cleared
6
+ * @returns search parameters with refinements cleared
10
7
  */
11
- declare function clearRefinements({ helper, attributesToClear, }: {
8
+ export declare function clearRefinements({ helper, attributesToClear, }: {
12
9
  helper: AlgoliaSearchHelper;
13
10
  attributesToClear?: string[];
14
- }): import("algoliasearch-helper").SearchParameters;
15
- export default clearRefinements;
11
+ }): SearchParameters;
@@ -2,12 +2,9 @@
2
2
  * Clears the refinements of a SearchParameters object based on rules provided.
3
3
  * The included attributes list is applied before the excluded attributes list. If the list
4
4
  * is not provided, this list of all the currently refined attributes is used as included attributes.
5
- * @param {object} $0 parameters
6
- * @param {Helper} $0.helper instance of the Helper
7
- * @param {string[]} [$0.attributesToClear = []] list of parameters to clear
8
- * @returns {SearchParameters} search parameters with refinements cleared
5
+ * @returns search parameters with refinements cleared
9
6
  */
10
- function clearRefinements(_ref) {
7
+ export function clearRefinements(_ref) {
11
8
  var helper = _ref.helper,
12
9
  _ref$attributesToClea = _ref.attributesToClear,
13
10
  attributesToClear = _ref$attributesToClea === void 0 ? [] : _ref$attributesToClea;
@@ -37,6 +34,4 @@ function clearRefinements(_ref) {
37
34
  }
38
35
 
39
36
  return finalState;
40
- }
41
-
42
- export default clearRefinements;
37
+ }
@@ -1,2 +1,2 @@
1
1
  import type { HighlightedParts } from '../../types';
2
- export default function concatHighlightedParts(parts: HighlightedParts[]): string;
2
+ export declare function concatHighlightedParts(parts: HighlightedParts[]): string;
@@ -1,5 +1,5 @@
1
1
  import { TAG_REPLACEMENT } from "./escape-highlight.js";
2
- export default function concatHighlightedParts(parts) {
2
+ export function concatHighlightedParts(parts) {
3
3
  var highlightPreTag = TAG_REPLACEMENT.highlightPreTag,
4
4
  highlightPostTag = TAG_REPLACEMENT.highlightPostTag;
5
5
  return parts.map(function (part) {
@@ -1,6 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
2
 
3
- import isFacetRefined from "./isFacetRefined.js";
3
+ import { isFacetRefined } from "./isFacetRefined.js";
4
4
  export function createSendEventForFacet(_ref) {
5
5
  var instantSearchInstance = _ref.instantSearchInstance,
6
6
  helper = _ref.helper,
@@ -1,6 +1,3 @@
1
- /**
2
- * @jest-environment jsdom
3
- */
4
1
  import type { InstantSearch, Hit } from '../../types';
5
2
  declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => void;
6
3
  declare type CustomSendEventForHits = (customPayload: any) => void;