instantsearch.js 4.46.0 → 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 (165) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +3 -1
  3. package/cjs/helpers/components/Highlight.js +7 -7
  4. package/cjs/helpers/components/ReverseHighlight.js +7 -7
  5. package/cjs/helpers/components/ReverseSnippet.js +7 -7
  6. package/cjs/helpers/components/Snippet.js +7 -7
  7. package/cjs/lib/InstantSearch.js +33 -24
  8. package/cjs/lib/utils/capitalize.js +2 -5
  9. package/cjs/lib/utils/checkIndexUiState.js +3 -5
  10. package/cjs/lib/utils/checkRendering.js +4 -9
  11. package/cjs/lib/utils/clearRefinements.js +3 -9
  12. package/cjs/lib/utils/concatHighlightedParts.js +1 -1
  13. package/cjs/lib/utils/createSendEventForFacet.js +2 -4
  14. package/cjs/lib/utils/defer.js +3 -6
  15. package/cjs/lib/utils/detect-insights-client.js +1 -1
  16. package/cjs/lib/utils/documentation.js +6 -9
  17. package/cjs/lib/utils/escape-highlight.js +4 -6
  18. package/cjs/lib/utils/escape-html.js +60 -0
  19. package/cjs/lib/utils/find.js +2 -5
  20. package/cjs/lib/utils/findIndex.js +2 -5
  21. package/cjs/lib/utils/getContainerNode.js +4 -9
  22. package/cjs/lib/utils/getHighlightFromSiblings.js +3 -5
  23. package/cjs/lib/utils/getHighlightedParts.js +1 -1
  24. package/cjs/lib/utils/getObjectType.js +2 -5
  25. package/cjs/lib/utils/getPropertyByPath.js +2 -5
  26. package/cjs/lib/utils/getRefinements.js +4 -6
  27. package/cjs/lib/utils/index.js +562 -440
  28. package/cjs/lib/utils/isDomElement.js +2 -5
  29. package/cjs/lib/utils/isEqual.js +2 -5
  30. package/cjs/lib/utils/isFacetRefined.js +1 -1
  31. package/cjs/lib/utils/isFiniteNumber.js +3 -5
  32. package/cjs/lib/utils/isIndexWidget.js +10 -0
  33. package/cjs/lib/utils/isPlainObject.js +2 -5
  34. package/cjs/lib/utils/isSpecialClick.js +2 -5
  35. package/cjs/lib/utils/logger.js +3 -5
  36. package/cjs/lib/utils/mergeSearchParameters.js +7 -10
  37. package/cjs/lib/utils/noop.js +2 -5
  38. package/cjs/lib/utils/prepareTemplateProps.js +4 -9
  39. package/cjs/lib/utils/range.js +2 -5
  40. package/cjs/lib/utils/renderTemplate.js +2 -5
  41. package/cjs/lib/utils/resolveSearchParameters.js +3 -6
  42. package/cjs/lib/utils/reverseHighlightedParts.js +3 -5
  43. package/cjs/lib/utils/setIndexHelperState.js +28 -0
  44. package/cjs/lib/utils/toArray.js +2 -5
  45. package/cjs/lib/utils/uniq.js +2 -5
  46. package/cjs/lib/version.js +1 -1
  47. package/cjs/middlewares/createInsightsMiddleware.js +23 -30
  48. package/cjs/middlewares/createMetadataMiddleware.js +1 -0
  49. package/cjs/middlewares/createRouterMiddleware.js +1 -0
  50. package/cjs/widgets/index/index.js +8 -12
  51. package/dist/instantsearch.development.d.ts +11 -3
  52. package/dist/instantsearch.development.js +2242 -2181
  53. package/dist/instantsearch.development.js.map +1 -1
  54. package/dist/instantsearch.production.d.ts +11 -3
  55. package/dist/instantsearch.production.min.d.ts +11 -3
  56. package/dist/instantsearch.production.min.js +2 -2
  57. package/dist/instantsearch.production.min.js.map +1 -1
  58. package/es/components/Breadcrumb/Breadcrumb.d.ts +1 -1
  59. package/es/components/ClearRefinements/ClearRefinements.d.ts +1 -1
  60. package/es/components/GeoSearchControls/GeoSearchControls.d.ts +1 -1
  61. package/es/components/Hits/Hits.d.ts +1 -2
  62. package/es/components/RefinementList/RefinementList.d.ts +1 -1
  63. package/es/components/Template/Template.d.ts +1 -2
  64. package/es/components/ToggleRefinement/ToggleRefinement.d.ts +1 -4
  65. package/es/components/ToggleRefinement/ToggleRefinement.js +0 -4
  66. package/es/connectors/toggle-refinement/connectToggleRefinement.d.ts +3 -2
  67. package/es/connectors/toggle-refinement/connectToggleRefinement.js +3 -1
  68. package/es/helpers/components/Highlight.js +7 -5
  69. package/es/helpers/components/ReverseHighlight.js +7 -5
  70. package/es/helpers/components/ReverseSnippet.js +7 -5
  71. package/es/helpers/components/Snippet.js +7 -5
  72. package/es/lib/InstantSearch.d.ts +6 -1
  73. package/es/lib/InstantSearch.js +34 -21
  74. package/es/lib/utils/capitalize.d.ts +1 -2
  75. package/es/lib/utils/capitalize.js +2 -4
  76. package/es/lib/utils/checkIndexUiState.js +1 -1
  77. package/es/lib/utils/checkRendering.d.ts +1 -2
  78. package/es/lib/utils/checkRendering.js +3 -6
  79. package/es/lib/utils/clearRefinements.d.ts +4 -8
  80. package/es/lib/utils/clearRefinements.js +3 -8
  81. package/es/lib/utils/concatHighlightedParts.d.ts +1 -1
  82. package/es/lib/utils/concatHighlightedParts.js +1 -1
  83. package/es/lib/utils/createSendEventForFacet.js +1 -1
  84. package/es/lib/utils/createSendEventForHits.d.ts +0 -3
  85. package/es/lib/utils/createSendEventForHits.js +0 -3
  86. package/es/lib/utils/defer.d.ts +2 -2
  87. package/es/lib/utils/defer.js +2 -5
  88. package/es/lib/utils/detect-insights-client.d.ts +1 -1
  89. package/es/lib/utils/detect-insights-client.js +1 -1
  90. package/es/lib/utils/documentation.d.ts +2 -2
  91. package/es/lib/utils/documentation.js +4 -4
  92. package/es/lib/utils/escape-highlight.js +2 -2
  93. package/es/lib/utils/{escape.d.ts → escape-html.d.ts} +6 -2
  94. package/es/lib/utils/escape-html.js +51 -0
  95. package/es/lib/utils/escapeFacetValue.d.ts +1 -1
  96. package/es/lib/utils/find.d.ts +1 -2
  97. package/es/lib/utils/find.js +2 -4
  98. package/es/lib/utils/findIndex.d.ts +1 -2
  99. package/es/lib/utils/findIndex.js +2 -4
  100. package/es/lib/utils/getContainerNode.d.ts +1 -2
  101. package/es/lib/utils/getContainerNode.js +3 -5
  102. package/es/lib/utils/getHighlightFromSiblings.d.ts +1 -1
  103. package/es/lib/utils/getHighlightFromSiblings.js +2 -2
  104. package/es/lib/utils/getHighlightedParts.d.ts +1 -1
  105. package/es/lib/utils/getHighlightedParts.js +1 -1
  106. package/es/lib/utils/getObjectType.d.ts +1 -2
  107. package/es/lib/utils/getObjectType.js +2 -4
  108. package/es/lib/utils/getPropertyByPath.d.ts +1 -2
  109. package/es/lib/utils/getPropertyByPath.js +2 -4
  110. package/es/lib/utils/getRefinements.d.ts +1 -1
  111. package/es/lib/utils/getRefinements.js +2 -2
  112. package/es/lib/utils/index.d.ts +46 -46
  113. package/es/lib/utils/index.js +46 -46
  114. package/es/lib/utils/isDomElement.d.ts +1 -2
  115. package/es/lib/utils/isDomElement.js +2 -4
  116. package/es/lib/utils/isEqual.d.ts +1 -2
  117. package/es/lib/utils/isEqual.js +2 -4
  118. package/es/lib/utils/isFacetRefined.d.ts +1 -1
  119. package/es/lib/utils/isFacetRefined.js +1 -1
  120. package/es/lib/utils/isFiniteNumber.d.ts +1 -2
  121. package/es/lib/utils/isFiniteNumber.js +3 -4
  122. package/es/lib/utils/isIndexWidget.d.ts +3 -0
  123. package/es/lib/utils/isIndexWidget.js +3 -0
  124. package/es/lib/utils/isPlainObject.d.ts +1 -2
  125. package/es/lib/utils/isPlainObject.js +2 -4
  126. package/es/lib/utils/isSpecialClick.d.ts +1 -2
  127. package/es/lib/utils/isSpecialClick.js +2 -4
  128. package/es/lib/utils/logger.js +1 -1
  129. package/es/lib/utils/mergeSearchParameters.d.ts +1 -2
  130. package/es/lib/utils/mergeSearchParameters.js +4 -6
  131. package/es/lib/utils/noop.d.ts +1 -2
  132. package/es/lib/utils/noop.js +1 -3
  133. package/es/lib/utils/prepareTemplateProps.d.ts +2 -2
  134. package/es/lib/utils/prepareTemplateProps.js +3 -5
  135. package/es/lib/utils/range.d.ts +2 -2
  136. package/es/lib/utils/range.js +2 -4
  137. package/es/lib/utils/renderTemplate.d.ts +1 -2
  138. package/es/lib/utils/renderTemplate.js +2 -4
  139. package/es/lib/utils/resolveSearchParameters.d.ts +1 -2
  140. package/es/lib/utils/resolveSearchParameters.js +2 -4
  141. package/es/lib/utils/reverseHighlightedParts.d.ts +1 -1
  142. package/es/lib/utils/reverseHighlightedParts.js +2 -2
  143. package/es/lib/utils/setIndexHelperState.d.ts +3 -0
  144. package/es/lib/utils/setIndexHelperState.js +19 -0
  145. package/es/lib/utils/toArray.d.ts +3 -2
  146. package/es/lib/utils/toArray.js +2 -4
  147. package/es/lib/utils/uniq.d.ts +1 -2
  148. package/es/lib/utils/uniq.js +2 -4
  149. package/es/lib/version.d.ts +1 -1
  150. package/es/lib/version.js +1 -1
  151. package/es/middlewares/createInsightsMiddleware.js +23 -27
  152. package/es/middlewares/createMetadataMiddleware.js +1 -0
  153. package/es/middlewares/createRouterMiddleware.js +1 -0
  154. package/es/types/middleware.d.ts +1 -0
  155. package/es/widgets/index/index.d.ts +0 -1
  156. package/es/widgets/index/index.js +5 -6
  157. package/package.json +5 -5
  158. package/cjs/lib/utils/convertNumericRefinementsToFilters.js +0 -31
  159. package/cjs/lib/utils/escape.js +0 -35
  160. package/cjs/lib/utils/unescape.js +0 -32
  161. package/es/lib/utils/convertNumericRefinementsToFilters.d.ts +0 -2
  162. package/es/lib/utils/convertNumericRefinementsToFilters.js +0 -24
  163. package/es/lib/utils/escape.js +0 -27
  164. package/es/lib/utils/unescape.d.ts +0 -9
  165. package/es/lib/utils/unescape.js +0 -25
@@ -0,0 +1,51 @@
1
+ /**
2
+ * This implementation is taken from Lodash implementation.
3
+ * See: https://github.com/lodash/lodash/blob/4.17.11-npm/escape.js
4
+ */
5
+ // Used to map characters to HTML entities.
6
+ var htmlEntities = {
7
+ '&': '&',
8
+ '<': '&lt;',
9
+ '>': '&gt;',
10
+ '"': '&quot;',
11
+ "'": '&#39;'
12
+ }; // Used to match HTML entities and HTML characters.
13
+
14
+ var regexUnescapedHtml = /[&<>"']/g;
15
+ var regexHasUnescapedHtml = RegExp(regexUnescapedHtml.source);
16
+ /**
17
+ * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
18
+ * corresponding HTML entities.
19
+ */
20
+
21
+ export function escape(value) {
22
+ return value && regexHasUnescapedHtml.test(value) ? value.replace(regexUnescapedHtml, function (character) {
23
+ return htmlEntities[character];
24
+ }) : value;
25
+ }
26
+ /**
27
+ * This implementation is taken from Lodash implementation.
28
+ * See: https://github.com/lodash/lodash/blob/4.17.11-npm/unescape.js
29
+ */
30
+ // Used to map HTML entities to characters.
31
+
32
+ var htmlCharacters = {
33
+ '&amp;': '&',
34
+ '&lt;': '<',
35
+ '&gt;': '>',
36
+ '&quot;': '"',
37
+ '&#39;': "'"
38
+ }; // Used to match HTML entities and HTML characters.
39
+
40
+ var regexEscapedHtml = /&(amp|quot|lt|gt|#39);/g;
41
+ var regexHasEscapedHtml = RegExp(regexEscapedHtml.source);
42
+ /**
43
+ * Converts the HTML entities "&", "<", ">", '"', and "'" in `string` to their
44
+ * characters.
45
+ */
46
+
47
+ export function unescape(value) {
48
+ return value && regexHasEscapedHtml.test(value) ? value.replace(regexEscapedHtml, function (character) {
49
+ return htmlCharacters[character];
50
+ }) : value;
51
+ }
@@ -1,4 +1,4 @@
1
- declare type FacetValue = string | number | undefined;
1
+ declare type FacetValue = string | number | boolean | undefined;
2
2
  export declare function unescapeFacetValue<TFacetValue extends FacetValue>(value: TFacetValue): TFacetValue;
3
3
  export declare function escapeFacetValue<TFacetValue extends FacetValue>(value: TFacetValue): TFacetValue;
4
4
  export {};
@@ -1,2 +1 @@
1
- declare function find<TItem>(items: TItem[], predicate: (value: TItem, index: number, obj: TItem[]) => boolean): TItem | undefined;
2
- export default find;
1
+ export declare function find<TItem>(items: TItem[], predicate: (value: TItem, index: number, obj: TItem[]) => boolean): TItem | undefined;
@@ -4,7 +4,7 @@
4
4
  // was decided as too risky.
5
5
  // @MAJOR Replace with the native `Array.prototype.find` method
6
6
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
7
- function find(items, predicate) {
7
+ export function find(items, predicate) {
8
8
  var value;
9
9
 
10
10
  for (var i = 0; i < items.length; i++) {
@@ -16,6 +16,4 @@ function find(items, predicate) {
16
16
  }
17
17
 
18
18
  return undefined;
19
- }
20
-
21
- export default find;
19
+ }
@@ -1,2 +1 @@
1
- declare function findIndex<TItem>(array: TItem[], comparator: (value: TItem) => boolean): number;
2
- export default findIndex;
1
+ export declare function findIndex<TItem>(array: TItem[], comparator: (value: TItem) => boolean): number;
@@ -4,7 +4,7 @@
4
4
  // was decided as too risky.
5
5
  // @MAJOR Replace with the native `Array.prototype.findIndex` method
6
6
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex
7
- function findIndex(array, comparator) {
7
+ export function findIndex(array, comparator) {
8
8
  if (!Array.isArray(array)) {
9
9
  return -1;
10
10
  }
@@ -16,6 +16,4 @@ function findIndex(array, comparator) {
16
16
  }
17
17
 
18
18
  return -1;
19
- }
20
-
21
- export default findIndex;
19
+ }
@@ -7,5 +7,4 @@
7
7
  * @return {HTMLElement} Container node
8
8
  * @throws Error when the type is not correct
9
9
  */
10
- declare function getContainerNode(selectorOrHTMLElement: string | HTMLElement): HTMLElement;
11
- export default getContainerNode;
10
+ export declare function getContainerNode(selectorOrHTMLElement: string | HTMLElement): HTMLElement;
@@ -1,4 +1,4 @@
1
- import isDomElement from "./isDomElement.js";
1
+ import { isDomElement } from "./isDomElement.js";
2
2
  /**
3
3
  * Return the container. If it's a string, it is considered a
4
4
  * css selector and retrieves the first matching element. Otherwise
@@ -9,7 +9,7 @@ import isDomElement from "./isDomElement.js";
9
9
  * @throws Error when the type is not correct
10
10
  */
11
11
 
12
- function getContainerNode(selectorOrHTMLElement) {
12
+ export function getContainerNode(selectorOrHTMLElement) {
13
13
  var isSelectorString = typeof selectorOrHTMLElement === 'string';
14
14
  var domElement = isSelectorString ? document.querySelector(selectorOrHTMLElement) : selectorOrHTMLElement;
15
15
 
@@ -24,6 +24,4 @@ function getContainerNode(selectorOrHTMLElement) {
24
24
  }
25
25
 
26
26
  return domElement;
27
- }
28
-
29
- export default getContainerNode;
27
+ }
@@ -1,2 +1,2 @@
1
1
  import type { HighlightedParts } from '../../types';
2
- export default function getHighlightFromSiblings(parts: HighlightedParts[], i: number): boolean;
2
+ export declare function getHighlightFromSiblings(parts: HighlightedParts[], i: number): boolean;
@@ -1,6 +1,6 @@
1
- import unescape from "./unescape.js";
1
+ import { unescape } from "./escape-html.js";
2
2
  var hasAlphanumeric = new RegExp(/\w/i);
3
- export default function getHighlightFromSiblings(parts, i) {
3
+ export function getHighlightFromSiblings(parts, i) {
4
4
  var _parts, _parts2;
5
5
 
6
6
  var current = parts[i];
@@ -1,4 +1,4 @@
1
- export default function getHighlightedParts(highlightedValue: string): {
1
+ export declare function getHighlightedParts(highlightedValue: string): {
2
2
  value: string;
3
3
  isHighlighted: boolean;
4
4
  }[];
@@ -1,5 +1,5 @@
1
1
  import { TAG_REPLACEMENT } from "./escape-highlight.js";
2
- export default function getHighlightedParts(highlightedValue) {
2
+ export function getHighlightedParts(highlightedValue) {
3
3
  var highlightPostTag = TAG_REPLACEMENT.highlightPostTag,
4
4
  highlightPreTag = TAG_REPLACEMENT.highlightPreTag;
5
5
  var splitByPreTag = highlightedValue.split(highlightPreTag);
@@ -1,2 +1 @@
1
- declare function getObjectType(object: unknown): string;
2
- export default getObjectType;
1
+ export declare function getObjectType(object: unknown): string;
@@ -1,5 +1,3 @@
1
- function getObjectType(object) {
1
+ export function getObjectType(object) {
2
2
  return Object.prototype.toString.call(object).slice(8, -1);
3
- }
4
-
5
- export default getObjectType;
3
+ }
@@ -1,2 +1 @@
1
- declare function getPropertyByPath(object: Record<string, any> | undefined, path: string | string[]): any;
2
- export default getPropertyByPath;
1
+ export declare function getPropertyByPath(object: Record<string, any> | undefined, path: string | string[]): any;
@@ -1,8 +1,6 @@
1
- function getPropertyByPath(object, path) {
1
+ export function getPropertyByPath(object, path) {
2
2
  var parts = Array.isArray(path) ? path : path.split('.');
3
3
  return parts.reduce(function (current, key) {
4
4
  return current && current[key];
5
5
  }, object);
6
- }
7
-
8
- export default getPropertyByPath;
6
+ }
@@ -36,4 +36,4 @@ export declare type FacetExcludeRefinement = {
36
36
  exhaustive?: boolean;
37
37
  };
38
38
  export declare type Refinement = FacetRefinement | QueryRefinement | NumericRefinement | FacetExcludeRefinement | TagRefinement;
39
- export default function getRefinements(results: SearchResults | Record<string, never>, state: SearchParameters, includesQuery?: boolean): Refinement[];
39
+ export declare function getRefinements(results: SearchResults | Record<string, never>, state: SearchParameters, includesQuery?: boolean): Refinement[];
@@ -1,4 +1,4 @@
1
- import find from "./find.js";
1
+ import { find } from "./find.js";
2
2
  import { unescapeFacetValue, escapeFacetValue } from "./escapeFacetValue.js";
3
3
 
4
4
  function getRefinement(state, type, attribute, name) {
@@ -52,7 +52,7 @@ function getRefinement(state, type, attribute, name) {
52
52
  return res;
53
53
  }
54
54
 
55
- export default function getRefinements(results, state) {
55
+ export function getRefinements(results, state) {
56
56
  var includesQuery = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
57
57
  var refinements = [];
58
58
  var _state$facetsRefineme = state.facetsRefinements,
@@ -1,48 +1,48 @@
1
- export { default as capitalize } from './capitalize';
2
- export { default as defer } from './defer';
3
- export { default as isDomElement } from './isDomElement';
4
- export { default as getContainerNode } from './getContainerNode';
5
- export { default as isSpecialClick } from './isSpecialClick';
6
- export { default as prepareTemplateProps } from './prepareTemplateProps';
7
- export { default as renderTemplate } from './renderTemplate';
8
- export { default as getRefinements } from './getRefinements';
9
- export { default as clearRefinements } from './clearRefinements';
10
- export { escapeFacetValue, unescapeFacetValue } from './escapeFacetValue';
11
- export { default as checkRendering } from './checkRendering';
12
- export { checkIndexUiState } from './checkIndexUiState';
13
- export { default as getPropertyByPath } from './getPropertyByPath';
14
- export { default as getObjectType } from './getObjectType';
15
- export { default as noop } from './noop';
16
- export { default as isFiniteNumber } from './isFiniteNumber';
17
- export { default as isPlainObject } from './isPlainObject';
18
- export { default as uniq } from './uniq';
19
- export { default as range } from './range';
20
- export { default as isEqual } from './isEqual';
21
- export { default as escape } from './escape';
22
- export { default as unescape } from './unescape';
23
- export { default as concatHighlightedParts } from './concatHighlightedParts';
24
- export { default as getHighlightedParts } from './getHighlightedParts';
25
- export { default as getHighlightFromSiblings } from './getHighlightFromSiblings';
26
- export { default as reverseHighlightedParts } from './reverseHighlightedParts';
27
- export { default as find } from './find';
28
- export { default as findIndex } from './findIndex';
29
- export { default as mergeSearchParameters } from './mergeSearchParameters';
30
- export { default as resolveSearchParameters } from './resolveSearchParameters';
31
- export { default as toArray } from './toArray';
32
- export { warning, deprecate } from './logger';
33
- export { escapeHits, TAG_PLACEHOLDER, TAG_REPLACEMENT, escapeFacets, } from './escape-highlight';
34
- export { createDocumentationLink, createDocumentationMessageGenerator, } from './documentation';
35
- export { aroundLatLngToPosition, insideBoundingBoxToBoundingBox, } from './geo-search';
36
- export { addAbsolutePosition } from './hits-absolute-position';
37
- export { addQueryID } from './hits-query-id';
38
- export { default as isFacetRefined } from './isFacetRefined';
1
+ export * from './capitalize';
2
+ export * from './checkIndexUiState';
3
+ export * from './checkRendering';
4
+ export * from './clearRefinements';
5
+ export * from './concatHighlightedParts';
6
+ export * from './createConcurrentSafePromise';
39
7
  export * from './createSendEventForFacet';
40
8
  export * from './createSendEventForHits';
41
- export { getAppIdAndApiKey } from './getAppIdAndApiKey';
42
- export { convertNumericRefinementsToFilters } from './convertNumericRefinementsToFilters';
43
- export { createConcurrentSafePromise } from './createConcurrentSafePromise';
44
- export { debounce } from './debounce';
45
- export { serializePayload, deserializePayload } from './serializer';
46
- export { getWidgetAttribute } from './getWidgetAttribute';
47
- export { safelyRunOnBrowser } from './safelyRunOnBrowser';
48
- export { cx } from './cx';
9
+ export * from './setIndexHelperState';
10
+ export * from './isIndexWidget';
11
+ export * from './cx';
12
+ export * from './debounce';
13
+ export * from './defer';
14
+ export * from './documentation';
15
+ export * from './escape-highlight';
16
+ export * from './escape-html';
17
+ export * from './escapeFacetValue';
18
+ export * from './find';
19
+ export * from './findIndex';
20
+ export * from './geo-search';
21
+ export * from './getAppIdAndApiKey';
22
+ export * from './getContainerNode';
23
+ export * from './getHighlightedParts';
24
+ export * from './getHighlightFromSiblings';
25
+ export * from './getObjectType';
26
+ export * from './getPropertyByPath';
27
+ export * from './getRefinements';
28
+ export * from './getWidgetAttribute';
29
+ export * from './hits-absolute-position';
30
+ export * from './hits-query-id';
31
+ export * from './isDomElement';
32
+ export * from './isEqual';
33
+ export * from './isFacetRefined';
34
+ export * from './isFiniteNumber';
35
+ export * from './isPlainObject';
36
+ export * from './isSpecialClick';
37
+ export * from './logger';
38
+ export * from './mergeSearchParameters';
39
+ export * from './noop';
40
+ export * from './prepareTemplateProps';
41
+ export * from './range';
42
+ export * from './renderTemplate';
43
+ export * from './resolveSearchParameters';
44
+ export * from './reverseHighlightedParts';
45
+ export * from './safelyRunOnBrowser';
46
+ export * from './serializer';
47
+ export * from './toArray';
48
+ export * from './uniq';
@@ -1,48 +1,48 @@
1
- export { default as capitalize } from "./capitalize.js";
2
- export { default as defer } from "./defer.js";
3
- export { default as isDomElement } from "./isDomElement.js";
4
- export { default as getContainerNode } from "./getContainerNode.js";
5
- export { default as isSpecialClick } from "./isSpecialClick.js";
6
- export { default as prepareTemplateProps } from "./prepareTemplateProps.js";
7
- export { default as renderTemplate } from "./renderTemplate.js";
8
- export { default as getRefinements } from "./getRefinements.js";
9
- export { default as clearRefinements } from "./clearRefinements.js";
10
- export { escapeFacetValue, unescapeFacetValue } from "./escapeFacetValue.js";
11
- export { default as checkRendering } from "./checkRendering.js";
12
- export { checkIndexUiState } from "./checkIndexUiState.js";
13
- export { default as getPropertyByPath } from "./getPropertyByPath.js";
14
- export { default as getObjectType } from "./getObjectType.js";
15
- export { default as noop } from "./noop.js";
16
- export { default as isFiniteNumber } from "./isFiniteNumber.js";
17
- export { default as isPlainObject } from "./isPlainObject.js";
18
- export { default as uniq } from "./uniq.js";
19
- export { default as range } from "./range.js";
20
- export { default as isEqual } from "./isEqual.js";
21
- export { default as escape } from "./escape.js";
22
- export { default as unescape } from "./unescape.js";
23
- export { default as concatHighlightedParts } from "./concatHighlightedParts.js";
24
- export { default as getHighlightedParts } from "./getHighlightedParts.js";
25
- export { default as getHighlightFromSiblings } from "./getHighlightFromSiblings.js";
26
- export { default as reverseHighlightedParts } from "./reverseHighlightedParts.js";
27
- export { default as find } from "./find.js";
28
- export { default as findIndex } from "./findIndex.js";
29
- export { default as mergeSearchParameters } from "./mergeSearchParameters.js";
30
- export { default as resolveSearchParameters } from "./resolveSearchParameters.js";
31
- export { default as toArray } from "./toArray.js";
32
- export { warning, deprecate } from "./logger.js";
33
- export { escapeHits, TAG_PLACEHOLDER, TAG_REPLACEMENT, escapeFacets } from "./escape-highlight.js";
34
- export { createDocumentationLink, createDocumentationMessageGenerator } from "./documentation.js";
35
- export { aroundLatLngToPosition, insideBoundingBoxToBoundingBox } from "./geo-search.js";
36
- export { addAbsolutePosition } from "./hits-absolute-position.js";
37
- export { addQueryID } from "./hits-query-id.js";
38
- export { default as isFacetRefined } from "./isFacetRefined.js";
1
+ export * from "./capitalize.js";
2
+ export * from "./checkIndexUiState.js";
3
+ export * from "./checkRendering.js";
4
+ export * from "./clearRefinements.js";
5
+ export * from "./concatHighlightedParts.js";
6
+ export * from "./createConcurrentSafePromise.js";
39
7
  export * from "./createSendEventForFacet.js";
40
8
  export * from "./createSendEventForHits.js";
41
- export { getAppIdAndApiKey } from "./getAppIdAndApiKey.js";
42
- export { convertNumericRefinementsToFilters } from "./convertNumericRefinementsToFilters.js";
43
- export { createConcurrentSafePromise } from "./createConcurrentSafePromise.js";
44
- export { debounce } from "./debounce.js";
45
- export { serializePayload, deserializePayload } from "./serializer.js";
46
- export { getWidgetAttribute } from "./getWidgetAttribute.js";
47
- export { safelyRunOnBrowser } from "./safelyRunOnBrowser.js";
48
- export { cx } from "./cx.js";
9
+ export * from "./setIndexHelperState.js";
10
+ export * from "./isIndexWidget.js";
11
+ export * from "./cx.js";
12
+ export * from "./debounce.js";
13
+ export * from "./defer.js";
14
+ export * from "./documentation.js";
15
+ export * from "./escape-highlight.js";
16
+ export * from "./escape-html.js";
17
+ export * from "./escapeFacetValue.js";
18
+ export * from "./find.js";
19
+ export * from "./findIndex.js";
20
+ export * from "./geo-search.js";
21
+ export * from "./getAppIdAndApiKey.js";
22
+ export * from "./getContainerNode.js";
23
+ export * from "./getHighlightedParts.js";
24
+ export * from "./getHighlightFromSiblings.js";
25
+ export * from "./getObjectType.js";
26
+ export * from "./getPropertyByPath.js";
27
+ export * from "./getRefinements.js";
28
+ export * from "./getWidgetAttribute.js";
29
+ export * from "./hits-absolute-position.js";
30
+ export * from "./hits-query-id.js";
31
+ export * from "./isDomElement.js";
32
+ export * from "./isEqual.js";
33
+ export * from "./isFacetRefined.js";
34
+ export * from "./isFiniteNumber.js";
35
+ export * from "./isPlainObject.js";
36
+ export * from "./isSpecialClick.js";
37
+ export * from "./logger.js";
38
+ export * from "./mergeSearchParameters.js";
39
+ export * from "./noop.js";
40
+ export * from "./prepareTemplateProps.js";
41
+ export * from "./range.js";
42
+ export * from "./renderTemplate.js";
43
+ export * from "./resolveSearchParameters.js";
44
+ export * from "./reverseHighlightedParts.js";
45
+ export * from "./safelyRunOnBrowser.js";
46
+ export * from "./serializer.js";
47
+ export * from "./toArray.js";
48
+ export * from "./uniq.js";
@@ -1,2 +1 @@
1
- declare function isDomElement(object: any): object is HTMLElement;
2
- export default isDomElement;
1
+ export declare function isDomElement(object: any): object is HTMLElement;
@@ -1,5 +1,3 @@
1
- function isDomElement(object) {
1
+ export function isDomElement(object) {
2
2
  return object instanceof HTMLElement || Boolean(object) && object.nodeType > 0;
3
- }
4
-
5
- export default isDomElement;
3
+ }
@@ -1,2 +1 @@
1
- declare function isEqual(first: any, second: any): boolean;
2
- export default isEqual;
1
+ export declare function isEqual(first: any, second: any): boolean;
@@ -2,7 +2,7 @@ function isPrimitive(obj) {
2
2
  return obj !== Object(obj);
3
3
  }
4
4
 
5
- function isEqual(first, second) {
5
+ export function isEqual(first, second) {
6
6
  if (first === second) {
7
7
  return true;
8
8
  }
@@ -28,6 +28,4 @@ function isEqual(first, second) {
28
28
  }
29
29
 
30
30
  return true;
31
- }
32
-
33
- export default isEqual;
31
+ }
@@ -1,2 +1,2 @@
1
1
  import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
2
- export default function isFacetRefined(helper: AlgoliaSearchHelper, facet: string, value: string): boolean;
2
+ export declare function isFacetRefined(helper: AlgoliaSearchHelper, facet: string, value: string): boolean;
@@ -1,4 +1,4 @@
1
- export default function isFacetRefined(helper, facet, value) {
1
+ export function isFacetRefined(helper, facet, value) {
2
2
  if (helper.state.isHierarchicalFacet(facet)) {
3
3
  return helper.state.isHierarchicalFacetRefined(facet, value);
4
4
  } else if (helper.state.isConjunctiveFacet(facet)) {
@@ -1,2 +1 @@
1
- declare function isFiniteNumber(value: any): value is number;
2
- export default isFiniteNumber;
1
+ export declare function isFiniteNumber(value: any): value is number;
@@ -1,8 +1,7 @@
1
1
  // This is the `Number.isFinite()` polyfill recommended by MDN.
2
2
  // We do not provide any tests for this function.
3
3
  // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite#Polyfill
4
- function isFiniteNumber(value) {
4
+ // @MAJOR Replace with the native `Number.isFinite` method
5
+ export function isFiniteNumber(value) {
5
6
  return typeof value === 'number' && isFinite(value);
6
- }
7
-
8
- export default isFiniteNumber;
7
+ }
@@ -0,0 +1,3 @@
1
+ import type { Widget } from '../../types';
2
+ import type { IndexWidget } from '../../widgets/index/index';
3
+ export declare function isIndexWidget(widget: Widget | IndexWidget): widget is IndexWidget;
@@ -0,0 +1,3 @@
1
+ export function isIndexWidget(widget) {
2
+ return widget.$$type === 'ais.index';
3
+ }
@@ -8,5 +8,4 @@
8
8
  * A plain object is an object created by the `Object`
9
9
  * constructor or with a `[[Prototype]]` of `null`.
10
10
  */
11
- declare function isPlainObject(value: any): boolean;
12
- export default isPlainObject;
11
+ export declare function isPlainObject(value: any): boolean;
@@ -23,7 +23,7 @@ function isObjectLike(value) {
23
23
  */
24
24
 
25
25
 
26
- function isPlainObject(value) {
26
+ export function isPlainObject(value) {
27
27
  if (!isObjectLike(value) || getTag(value) !== '[object Object]') {
28
28
  return false;
29
29
  }
@@ -39,6 +39,4 @@ function isPlainObject(value) {
39
39
  }
40
40
 
41
41
  return Object.getPrototypeOf(value) === proto;
42
- }
43
-
44
- export default isPlainObject;
42
+ }
@@ -1,2 +1 @@
1
- declare function isSpecialClick(event: MouseEvent): boolean;
2
- export default isSpecialClick;
1
+ export declare function isSpecialClick(event: MouseEvent): boolean;
@@ -1,6 +1,4 @@
1
- function isSpecialClick(event) {
1
+ export function isSpecialClick(event) {
2
2
  var isMiddleClick = event.button === 1;
3
3
  return isMiddleClick || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
4
- }
5
-
6
- export default isSpecialClick;
4
+ }
@@ -1,4 +1,4 @@
1
- import noop from "./noop.js";
1
+ import { noop } from "./noop.js";
2
2
 
3
3
  /**
4
4
  * Logs a warning when this function is called, in development environment only.
@@ -1,3 +1,2 @@
1
1
  import type { SearchParameters } from 'algoliasearch-helper';
2
- declare const merge: (...parameters: SearchParameters[]) => SearchParameters;
3
- export default merge;
2
+ export declare const mergeSearchParameters: (...parameters: SearchParameters[]) => SearchParameters;
@@ -8,8 +8,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
8
8
 
9
9
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
10
10
 
11
- import findIndex from "./findIndex.js";
12
- import uniq from "./uniq.js";
11
+ import { findIndex } from "./findIndex.js";
12
+ import { uniq } from "./uniq.js";
13
13
 
14
14
  var mergeWithRest = function mergeWithRest(left, right) {
15
15
  var facets = right.facets,
@@ -107,7 +107,7 @@ var mergeRuleContexts = function mergeRuleContexts(left, right) {
107
107
  return left;
108
108
  };
109
109
 
110
- var merge = function merge() {
110
+ export var mergeSearchParameters = function mergeSearchParameters() {
111
111
  for (var _len = arguments.length, parameters = new Array(_len), _key = 0; _key < _len; _key++) {
112
112
  parameters[_key] = arguments[_key];
113
113
  }
@@ -125,6 +125,4 @@ var merge = function merge() {
125
125
  var facetsMerged = mergeFacets(ruleContextsMerged, right);
126
126
  return mergeWithRest(facetsMerged, right);
127
127
  });
128
- };
129
-
130
- export default merge;
128
+ };
@@ -1,2 +1 @@
1
- declare function noop(..._args: any[]): void;
2
- export default noop;
1
+ export declare function noop(..._args: any[]): void;
@@ -1,3 +1 @@
1
- function noop() {}
2
-
3
- export default noop;
1
+ export function noop() {}
@@ -14,9 +14,9 @@ export declare type PreparedTemplateProps<TTemplates extends Templates> = {
14
14
  /**
15
15
  * Prepares an object to be passed to the Template widget
16
16
  */
17
- declare function prepareTemplateProps<TTemplates extends Templates>({ defaultTemplates, templates, templatesConfig, }: {
17
+ export declare function prepareTemplateProps<TTemplates extends Templates>({ defaultTemplates, templates, templatesConfig, }: {
18
18
  defaultTemplates: TTemplates;
19
19
  templates?: Partial<TTemplates>;
20
20
  templatesConfig: TemplatesConfig;
21
21
  }): PreparedTemplateProps<TTemplates>;
22
- export default prepareTemplateProps;
22
+ export {};
@@ -16,7 +16,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
16
16
 
17
17
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
18
18
 
19
- import uniq from "./uniq.js";
19
+ import { uniq } from "./uniq.js";
20
20
 
21
21
  function prepareTemplates( // can not use = {} here, since the template could have different constraints
22
22
  defaultTemplates) {
@@ -42,7 +42,7 @@ defaultTemplates) {
42
42
  */
43
43
 
44
44
 
45
- function prepareTemplateProps(_ref) {
45
+ export function prepareTemplateProps(_ref) {
46
46
  var defaultTemplates = _ref.defaultTemplates,
47
47
  templates = _ref.templates,
48
48
  templatesConfig = _ref.templatesConfig;
@@ -50,6 +50,4 @@ function prepareTemplateProps(_ref) {
50
50
  return _objectSpread({
51
51
  templatesConfig: templatesConfig
52
52
  }, preparedTemplates);
53
- }
54
-
55
- export default prepareTemplateProps;
53
+ }
@@ -3,5 +3,5 @@ declare type RangeOptions = {
3
3
  end: number;
4
4
  step?: number;
5
5
  };
6
- declare function range({ start, end, step }: RangeOptions): number[];
7
- export default range;
6
+ export declare function range({ start, end, step }: RangeOptions): number[];
7
+ export {};