instantsearch.js 4.42.0 → 4.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/cjs/components/Highlight/Highlight.js +33 -0
  3. package/cjs/components/InternalHighlight/InternalHighlight.js +16 -0
  4. package/cjs/components/ReverseHighlight/ReverseHighlight.js +33 -0
  5. package/cjs/components/ReverseSnippet/ReverseSnippet.js +33 -0
  6. package/cjs/components/Snippet/Snippet.js +33 -0
  7. package/cjs/connectors/rating-menu/connectRatingMenu.js +1 -1
  8. package/cjs/helpers/components/Highlight.js +45 -0
  9. package/cjs/helpers/components/ReverseHighlight.js +58 -0
  10. package/cjs/helpers/components/ReverseSnippet.js +58 -0
  11. package/cjs/helpers/components/Snippet.js +45 -0
  12. package/cjs/helpers/components/index.js +57 -0
  13. package/cjs/lib/InstantSearch.js +11 -1
  14. package/cjs/lib/version.js +1 -1
  15. package/cjs/types/algoliasearch.js +18 -1
  16. package/dist/instantsearch.development.d.ts +12 -31
  17. package/dist/instantsearch.development.js +20 -10
  18. package/dist/instantsearch.development.js.map +1 -1
  19. package/dist/instantsearch.production.d.ts +12 -31
  20. package/dist/instantsearch.production.min.d.ts +12 -31
  21. package/dist/instantsearch.production.min.js +2 -2
  22. package/dist/instantsearch.production.min.js.map +1 -1
  23. package/es/components/Highlight/Highlight.d.ts +7 -0
  24. package/es/components/Highlight/Highlight.js +24 -0
  25. package/es/components/InternalHighlight/InternalHighlight.d.ts +2 -0
  26. package/es/components/InternalHighlight/InternalHighlight.js +6 -0
  27. package/es/components/ReverseHighlight/ReverseHighlight.d.ts +7 -0
  28. package/es/components/ReverseHighlight/ReverseHighlight.js +24 -0
  29. package/es/components/ReverseSnippet/ReverseSnippet.d.ts +7 -0
  30. package/es/components/ReverseSnippet/ReverseSnippet.js +24 -0
  31. package/es/components/Snippet/Snippet.d.ts +7 -0
  32. package/es/components/Snippet/Snippet.js +24 -0
  33. package/es/connectors/geo-search/connectGeoSearch.d.ts +10 -10
  34. package/es/connectors/rating-menu/connectRatingMenu.js +1 -1
  35. package/es/helpers/components/Highlight.d.ts +10 -0
  36. package/es/helpers/components/Highlight.js +31 -0
  37. package/es/helpers/components/ReverseHighlight.d.ts +10 -0
  38. package/es/helpers/components/ReverseHighlight.js +44 -0
  39. package/es/helpers/components/ReverseSnippet.d.ts +10 -0
  40. package/es/helpers/components/ReverseSnippet.js +44 -0
  41. package/es/helpers/components/Snippet.d.ts +10 -0
  42. package/es/helpers/components/Snippet.js +31 -0
  43. package/es/helpers/components/index.d.ts +4 -0
  44. package/es/helpers/components/index.js +4 -0
  45. package/es/lib/InstantSearch.js +11 -1
  46. package/es/lib/version.d.ts +1 -1
  47. package/es/lib/version.js +1 -1
  48. package/es/types/algoliasearch.d.ts +1 -40
  49. package/es/types/algoliasearch.js +2 -0
  50. package/es/types/index.js +1 -0
  51. package/es/types/results.d.ts +1 -1
  52. package/es/types/utils.d.ts +4 -0
  53. package/package.json +6 -3
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # [4.44.0](https://github.com/algolia/instantsearch.js/compare/v4.43.1...v4.44.0) (2022-08-08)
2
+
3
+
4
+ ### Features
5
+
6
+ * **geo-search:** make `GeoHit` type generic ([#5083](https://github.com/algolia/instantsearch.js/issues/5083)) ([3d3c7b2](https://github.com/algolia/instantsearch.js/commit/3d3c7b298b74effe9bb722a04fbb47dc39a4bd95))
7
+
8
+
9
+
10
+ ## [4.43.1](https://github.com/algolia/instantsearch.js/compare/v4.43.0...v4.43.1) (2022-07-11)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **errors:** rethrow error as error if it's an object ([#5075](https://github.com/algolia/instantsearch.js/issues/5075)) ([34132bb](https://github.com/algolia/instantsearch.js/commit/34132bba38c05fa2f5e4e54c6889e9335e62e4f4))
16
+ * **ratingMenu:** don't warn if results are artificial ([#5073](https://github.com/algolia/instantsearch.js/issues/5073)) ([d747d23](https://github.com/algolia/instantsearch.js/commit/d747d23b28c380fe82a40eeab06c57359af8004a))
17
+ * **types:** use correct case for _geoloc property ([#5074](https://github.com/algolia/instantsearch.js/issues/5074)) ([6fed7d8](https://github.com/algolia/instantsearch.js/commit/6fed7d870c3607980776d33a3697f8e2789aa08b))
18
+
19
+
20
+
21
+ # [4.43.0](https://github.com/algolia/instantsearch.js/compare/v4.42.0...v4.43.0) (2022-06-28)
22
+
23
+
24
+ ### Features
25
+
26
+ * **types:** support algoliasearch v5 ([#5066](https://github.com/algolia/instantsearch.js/issues/5066)) ([3eb4dc7](https://github.com/algolia/instantsearch.js/commit/3eb4dc75a5935f2ee4fead8787f39af0150b24c4))
27
+
28
+
29
+
1
30
  # [4.42.0](https://github.com/algolia/instantsearch.js/compare/v4.41.2...v4.42.0) (2022-06-21)
2
31
 
3
32
 
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Highlight = Highlight;
7
+
8
+ var _uiComponentsShared = require("@algolia/ui-components-shared");
9
+
10
+ var _preact = require("preact");
11
+
12
+ var _InternalHighlight = require("../InternalHighlight/InternalHighlight.js");
13
+
14
+ 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); }
15
+
16
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
+
18
+ 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; }
19
+
20
+ function Highlight(_ref) {
21
+ var _ref$classNames = _ref.classNames,
22
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
23
+ props = _objectWithoutProperties(_ref, ["classNames"]);
24
+
25
+ return (0, _preact.h)(_InternalHighlight.InternalHighlight, _extends({
26
+ classNames: {
27
+ root: (0, _uiComponentsShared.cx)('ais-Highlight', classNames.root),
28
+ highlighted: (0, _uiComponentsShared.cx)('ais-Highlight-highlighted', classNames.highlighted),
29
+ nonHighlighted: (0, _uiComponentsShared.cx)('ais-Highlight-nonHighlighted', classNames.nonHighlighted),
30
+ separator: (0, _uiComponentsShared.cx)('ais-Highlight-separator', classNames.separator)
31
+ }
32
+ }, props));
33
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.InternalHighlight = void 0;
7
+
8
+ var _uiComponentsHighlightVdom = require("@algolia/ui-components-highlight-vdom");
9
+
10
+ var _preact = require("preact");
11
+
12
+ var InternalHighlight = (0, _uiComponentsHighlightVdom.createHighlightComponent)({
13
+ createElement: _preact.createElement,
14
+ Fragment: _preact.Fragment
15
+ });
16
+ exports.InternalHighlight = InternalHighlight;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ReverseHighlight = ReverseHighlight;
7
+
8
+ var _uiComponentsShared = require("@algolia/ui-components-shared");
9
+
10
+ var _preact = require("preact");
11
+
12
+ var _InternalHighlight = require("../InternalHighlight/InternalHighlight.js");
13
+
14
+ 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); }
15
+
16
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
+
18
+ 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; }
19
+
20
+ function ReverseHighlight(_ref) {
21
+ var _ref$classNames = _ref.classNames,
22
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
23
+ props = _objectWithoutProperties(_ref, ["classNames"]);
24
+
25
+ return (0, _preact.h)(_InternalHighlight.InternalHighlight, _extends({
26
+ classNames: {
27
+ root: (0, _uiComponentsShared.cx)('ais-ReverseHighlight', classNames.root),
28
+ highlighted: (0, _uiComponentsShared.cx)('ais-ReverseHighlight-highlighted', classNames.highlighted),
29
+ nonHighlighted: (0, _uiComponentsShared.cx)('ais-ReverseHighlight-nonHighlighted', classNames.nonHighlighted),
30
+ separator: (0, _uiComponentsShared.cx)('ais-ReverseHighlight-separator', classNames.separator)
31
+ }
32
+ }, props));
33
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ReverseSnippet = ReverseSnippet;
7
+
8
+ var _uiComponentsShared = require("@algolia/ui-components-shared");
9
+
10
+ var _preact = require("preact");
11
+
12
+ var _InternalHighlight = require("../InternalHighlight/InternalHighlight.js");
13
+
14
+ 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); }
15
+
16
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
+
18
+ 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; }
19
+
20
+ function ReverseSnippet(_ref) {
21
+ var _ref$classNames = _ref.classNames,
22
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
23
+ props = _objectWithoutProperties(_ref, ["classNames"]);
24
+
25
+ return (0, _preact.h)(_InternalHighlight.InternalHighlight, _extends({
26
+ classNames: {
27
+ root: (0, _uiComponentsShared.cx)('ais-ReverseSnippet', classNames.root),
28
+ highlighted: (0, _uiComponentsShared.cx)('ais-ReverseSnippet-highlighted', classNames.highlighted),
29
+ nonHighlighted: (0, _uiComponentsShared.cx)('ais-ReverseSnippet-nonHighlighted', classNames.nonHighlighted),
30
+ separator: (0, _uiComponentsShared.cx)('ais-ReverseSnippet-separator', classNames.separator)
31
+ }
32
+ }, props));
33
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Snippet = Snippet;
7
+
8
+ var _uiComponentsShared = require("@algolia/ui-components-shared");
9
+
10
+ var _preact = require("preact");
11
+
12
+ var _InternalHighlight = require("../InternalHighlight/InternalHighlight.js");
13
+
14
+ 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); }
15
+
16
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
17
+
18
+ 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; }
19
+
20
+ function Snippet(_ref) {
21
+ var _ref$classNames = _ref.classNames,
22
+ classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
23
+ props = _objectWithoutProperties(_ref, ["classNames"]);
24
+
25
+ return (0, _preact.h)(_InternalHighlight.InternalHighlight, _extends({
26
+ classNames: {
27
+ root: (0, _uiComponentsShared.cx)('ais-Snippet', classNames.root),
28
+ highlighted: (0, _uiComponentsShared.cx)('ais-Snippet-highlighted', classNames.highlighted),
29
+ nonHighlighted: (0, _uiComponentsShared.cx)('ais-Snippet-nonHighlighted', classNames.nonHighlighted),
30
+ separator: (0, _uiComponentsShared.cx)('ais-Snippet-separator', classNames.separator)
31
+ }
32
+ }, props));
33
+ }
@@ -223,7 +223,7 @@ var connectRatingMenu = function connectRatingMenu(renderFn) {
223
223
  var maxValuesPerFacet = facetResults.length;
224
224
  var maxDecimalPlaces = getFacetsMaxDecimalPlaces(facetResults);
225
225
  var maxFacets = Math.pow(10, maxDecimalPlaces) * max;
226
- process.env.NODE_ENV === 'development' ? (0, _index.warning)(maxFacets <= maxValuesPerFacet, getFacetValuesWarningMessage({
226
+ process.env.NODE_ENV === 'development' ? (0, _index.warning)(maxFacets <= maxValuesPerFacet || Boolean(results.__isArtificial), getFacetValuesWarningMessage({
227
227
  maxDecimalPlaces: maxDecimalPlaces,
228
228
  maxFacets: maxFacets,
229
229
  maxValuesPerFacet: maxValuesPerFacet
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Highlight = Highlight;
7
+
8
+ var _preact = require("preact");
9
+
10
+ var _Highlight = require("../../components/Highlight/Highlight.js");
11
+
12
+ var _getHighlightedParts = _interopRequireDefault(require("../../lib/utils/getHighlightedParts.js"));
13
+
14
+ var _getPropertyByPath = _interopRequireDefault(require("../../lib/utils/getPropertyByPath.js"));
15
+
16
+ var _unescape = _interopRequireDefault(require("../../lib/utils/unescape.js"));
17
+
18
+ var _logger = require("../../lib/utils/logger.js");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ 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); }
23
+
24
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
+
26
+ 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; }
27
+
28
+ function Highlight(_ref) {
29
+ var hit = _ref.hit,
30
+ attribute = _ref.attribute,
31
+ cssClasses = _ref.cssClasses,
32
+ props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
33
+
34
+ var property = (0, _getPropertyByPath.default)(hit._highlightResult, attribute) || [];
35
+ var properties = Array.isArray(property) ? property : [property];
36
+ process.env.NODE_ENV === 'development' ? (0, _logger.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;
37
+ var parts = properties.map(function (_ref2) {
38
+ var value = _ref2.value;
39
+ return (0, _getHighlightedParts.default)((0, _unescape.default)(value || ''));
40
+ });
41
+ return (0, _preact.h)(_Highlight.Highlight, _extends({}, props, {
42
+ parts: parts,
43
+ classNames: cssClasses
44
+ }));
45
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ReverseHighlight = ReverseHighlight;
7
+
8
+ var _preact = require("preact");
9
+
10
+ var _ReverseHighlight = require("../../components/ReverseHighlight/ReverseHighlight.js");
11
+
12
+ var _getHighlightedParts = _interopRequireDefault(require("../../lib/utils/getHighlightedParts.js"));
13
+
14
+ var _getPropertyByPath = _interopRequireDefault(require("../../lib/utils/getPropertyByPath.js"));
15
+
16
+ var _unescape = _interopRequireDefault(require("../../lib/utils/unescape.js"));
17
+
18
+ var _logger = require("../../lib/utils/logger.js");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ 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); }
23
+
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25
+
26
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
+
28
+ 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; }
29
+
30
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
31
+
32
+ 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; }
33
+
34
+ function ReverseHighlight(_ref) {
35
+ var hit = _ref.hit,
36
+ attribute = _ref.attribute,
37
+ cssClasses = _ref.cssClasses,
38
+ props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
39
+
40
+ var property = (0, _getPropertyByPath.default)(hit._highlightResult, attribute) || [];
41
+ var properties = Array.isArray(property) ? property : [property];
42
+ process.env.NODE_ENV === 'development' ? (0, _logger.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;
43
+ var parts = properties.map(function (_ref2) {
44
+ var value = _ref2.value;
45
+ return (0, _getHighlightedParts.default)((0, _unescape.default)(value || '')).map(function (_ref3) {
46
+ var isHighlighted = _ref3.isHighlighted,
47
+ rest = _objectWithoutProperties(_ref3, ["isHighlighted"]);
48
+
49
+ return _objectSpread(_objectSpread({}, rest), {}, {
50
+ isHighlighted: !isHighlighted
51
+ });
52
+ });
53
+ });
54
+ return (0, _preact.h)(_ReverseHighlight.ReverseHighlight, _extends({}, props, {
55
+ parts: parts,
56
+ classNames: cssClasses
57
+ }));
58
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ReverseSnippet = ReverseSnippet;
7
+
8
+ var _preact = require("preact");
9
+
10
+ var _ReverseSnippet = require("../../components/ReverseSnippet/ReverseSnippet.js");
11
+
12
+ var _getHighlightedParts = _interopRequireDefault(require("../../lib/utils/getHighlightedParts.js"));
13
+
14
+ var _getPropertyByPath = _interopRequireDefault(require("../../lib/utils/getPropertyByPath.js"));
15
+
16
+ var _unescape = _interopRequireDefault(require("../../lib/utils/unescape.js"));
17
+
18
+ var _logger = require("../../lib/utils/logger.js");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ 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); }
23
+
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25
+
26
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
+
28
+ 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; }
29
+
30
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
31
+
32
+ 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; }
33
+
34
+ function ReverseSnippet(_ref) {
35
+ var hit = _ref.hit,
36
+ attribute = _ref.attribute,
37
+ cssClasses = _ref.cssClasses,
38
+ props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
39
+
40
+ var property = (0, _getPropertyByPath.default)(hit._snippetResult, attribute) || [];
41
+ var properties = Array.isArray(property) ? property : [property];
42
+ process.env.NODE_ENV === 'development' ? (0, _logger.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;
43
+ var parts = properties.map(function (_ref2) {
44
+ var value = _ref2.value;
45
+ return (0, _getHighlightedParts.default)((0, _unescape.default)(value || '')).map(function (_ref3) {
46
+ var isHighlighted = _ref3.isHighlighted,
47
+ rest = _objectWithoutProperties(_ref3, ["isHighlighted"]);
48
+
49
+ return _objectSpread(_objectSpread({}, rest), {}, {
50
+ isHighlighted: !isHighlighted
51
+ });
52
+ });
53
+ });
54
+ return (0, _preact.h)(_ReverseSnippet.ReverseSnippet, _extends({}, props, {
55
+ parts: parts,
56
+ classNames: cssClasses
57
+ }));
58
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Snippet = Snippet;
7
+
8
+ var _preact = require("preact");
9
+
10
+ var _Snippet = require("../../components/Snippet/Snippet.js");
11
+
12
+ var _getHighlightedParts = _interopRequireDefault(require("../../lib/utils/getHighlightedParts.js"));
13
+
14
+ var _getPropertyByPath = _interopRequireDefault(require("../../lib/utils/getPropertyByPath.js"));
15
+
16
+ var _unescape = _interopRequireDefault(require("../../lib/utils/unescape.js"));
17
+
18
+ var _logger = require("../../lib/utils/logger.js");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ 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); }
23
+
24
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
+
26
+ 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; }
27
+
28
+ function Snippet(_ref) {
29
+ var hit = _ref.hit,
30
+ attribute = _ref.attribute,
31
+ cssClasses = _ref.cssClasses,
32
+ props = _objectWithoutProperties(_ref, ["hit", "attribute", "cssClasses"]);
33
+
34
+ var property = (0, _getPropertyByPath.default)(hit._snippetResult, attribute) || [];
35
+ var properties = Array.isArray(property) ? property : [property];
36
+ process.env.NODE_ENV === 'development' ? (0, _logger.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;
37
+ var parts = properties.map(function (_ref2) {
38
+ var value = _ref2.value;
39
+ return (0, _getHighlightedParts.default)((0, _unescape.default)(value || ''));
40
+ });
41
+ return (0, _preact.h)(_Snippet.Snippet, _extends({}, props, {
42
+ parts: parts,
43
+ classNames: cssClasses
44
+ }));
45
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _Highlight = require("./Highlight.js");
8
+
9
+ Object.keys(_Highlight).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _Highlight[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _Highlight[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _ReverseHighlight = require("./ReverseHighlight.js");
21
+
22
+ Object.keys(_ReverseHighlight).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _ReverseHighlight[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _ReverseHighlight[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _ReverseSnippet = require("./ReverseSnippet.js");
34
+
35
+ Object.keys(_ReverseSnippet).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _ReverseSnippet[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function get() {
41
+ return _ReverseSnippet[key];
42
+ }
43
+ });
44
+ });
45
+
46
+ var _Snippet = require("./Snippet.js");
47
+
48
+ Object.keys(_Snippet).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _Snippet[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function get() {
54
+ return _Snippet[key];
55
+ }
56
+ });
57
+ });
@@ -445,12 +445,22 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
445
445
 
446
446
  mainHelper.on('error', function (_ref4) {
447
447
  var error = _ref4.error;
448
- // If an error is emitted, it is re-thrown by events. In previous versions
448
+
449
+ if (!(error instanceof Error)) {
450
+ // typescript lies here, error is in some cases { name: string, message: string }
451
+ var err = error;
452
+ error = Object.keys(err).reduce(function (acc, key) {
453
+ acc[key] = err[key];
454
+ return acc;
455
+ }, new Error(err.message));
456
+ } // If an error is emitted, it is re-thrown by events. In previous versions
449
457
  // we emitted {error}, which is thrown as:
450
458
  // "Uncaught, unspecified \"error\" event. ([object Object])"
451
459
  // To avoid breaking changes, we make the error available in both
452
460
  // `error` and `error.error`
453
461
  // @MAJOR emit only error
462
+
463
+
454
464
  error.error = error;
455
465
 
456
466
  _this3.emit('error', error);
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.42.0';
7
+ var _default = '4.44.0';
8
8
  exports.default = _default;
@@ -1 +1,18 @@
1
- "use strict";
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _algoliasearch = require("algoliasearch-helper/types/algoliasearch.js");
8
+
9
+ Object.keys(_algoliasearch).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _algoliasearch[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _algoliasearch[key];
16
+ }
17
+ });
18
+ });
@@ -1,14 +1,14 @@
1
1
  /// <reference types="google.maps" />
2
2
 
3
- import type algoliasearch from 'algoliasearch/lite';
4
3
  import type { AlgoliaSearchHelper } from 'algoliasearch-helper';
5
- import type * as ClientSearch from '@algolia/client-search';
6
4
  import EventEmitter from '@algolia/events';
5
+ import { FindAnswersOptions } from 'algoliasearch-helper/types/algoliasearch.js';
7
6
  import type { InsightsClient as InsightsClient_2 } from 'search-insights';
8
7
  import type { InsightsMethodMap } from 'search-insights';
9
8
  import type * as Places from 'places.js';
10
9
  import type { PlainSearchParameters } from 'algoliasearch-helper';
11
10
  import { default as qs_2 } from 'qs';
11
+ import { SearchClient } from 'algoliasearch-helper/types/algoliasearch.js';
12
12
  import type { SearchParameters } from 'algoliasearch-helper';
13
13
  import type { SearchResults } from 'algoliasearch-helper';
14
14
 
@@ -34,7 +34,7 @@ declare type AlgoliaHit<THit extends BaseHit = Record<string, any>> = {
34
34
  };
35
35
  };
36
36
  _distinctSeqID?: number;
37
- _geoLoc?: GeoLoc;
37
+ _geoloc?: GeoLoc;
38
38
  } & THit;
39
39
 
40
40
  declare const analytics: AnalyticsWidget;
@@ -1075,18 +1075,12 @@ declare type CustomSendEventForHits = (customPayload: any) => void;
1075
1075
 
1076
1076
  declare type CustomSendEventForToggle = (customPayload: any) => void;
1077
1077
 
1078
- declare type DefaultSearchClient = ReturnType<typeof algoliasearch>;
1079
-
1080
1078
  declare type DisposeOptions = {
1081
1079
  helper: AlgoliaSearchHelper;
1082
1080
  state: SearchParameters;
1083
1081
  parent: IndexWidget;
1084
1082
  };
1085
1083
 
1086
- declare type DummySearchClientV4 = {
1087
- readonly transporter: any;
1088
- };
1089
-
1090
1084
  declare const dynamicWidgets: DynamicWidgetsWidget;
1091
1085
 
1092
1086
  declare type DynamicWidgetsConnector = Connector<DynamicWidgetsWidgetDescription, DynamicWidgetsConnectorParams>;
@@ -1175,9 +1169,7 @@ declare const EXPERIMENTAL_connectDynamicWidgets: DynamicWidgetsConnector;
1175
1169
  /** @deprecated use dynamicWidgets */
1176
1170
  declare const EXPERIMENTAL_dynamicWidgets: DynamicWidgetsWidget;
1177
1171
 
1178
- declare type FindAnswersOptions = DefaultSearchClient extends DummySearchClientV4 ? ClientSearch.FindAnswersOptions : any;
1179
-
1180
- declare type GeoHit = Hit & Required<Pick<Hit, '_geoLoc'>>;
1172
+ declare type GeoHit<THit extends BaseHit = Record<string, any>> = Hit<THit> & Required<Pick<Hit, '_geoloc'>>;
1181
1173
 
1182
1174
  declare type GeoLoc = {
1183
1175
  lat: number;
@@ -1199,9 +1191,9 @@ declare type GeoLoc = {
1199
1191
  */
1200
1192
  declare const geoSearch: GeoSearchWidget;
1201
1193
 
1202
- declare type GeoSearchConnector = Connector<GeoSearchWidgetDescription, GeoSearchConnectorParams>;
1194
+ declare type GeoSearchConnector<THit extends BaseHit = Record<string, any>> = Connector<GeoSearchWidgetDescription<THit>, GeoSearchConnectorParams<THit>>;
1203
1195
 
1204
- declare type GeoSearchConnectorParams = {
1196
+ declare type GeoSearchConnectorParams<THit extends BaseHit = Record<string, any>> = {
1205
1197
  /**
1206
1198
  * If true, refine will be triggered as you move the map.
1207
1199
  * @default true
@@ -1211,7 +1203,7 @@ declare type GeoSearchConnectorParams = {
1211
1203
  * Function to transform the items passed to the templates.
1212
1204
  * @default items => items
1213
1205
  */
1214
- transformItems?: TransformItems<GeoHit>;
1206
+ transformItems?: TransformItems<GeoHit<THit>>;
1215
1207
  };
1216
1208
 
1217
1209
  declare type GeoSearchCSSClasses = Partial<{
@@ -1257,7 +1249,7 @@ declare type GeoSearchMarker<TOptions> = {
1257
1249
  };
1258
1250
  };
1259
1251
 
1260
- declare type GeoSearchRenderState = {
1252
+ declare type GeoSearchRenderState<THit extends BaseHit = Record<string, any>> = {
1261
1253
  /**
1262
1254
  * Reset the current bounding box refinement.
1263
1255
  */
@@ -1281,7 +1273,7 @@ declare type GeoSearchRenderState = {
1281
1273
  /**
1282
1274
  * The matched hits from Algolia API.
1283
1275
  */
1284
- items: GeoHit[];
1276
+ items: Array<GeoHit<THit>>;
1285
1277
  /**
1286
1278
  * The current position of the search.
1287
1279
  */
@@ -1321,11 +1313,11 @@ declare type GeoSearchWidget = WidgetFactory<GeoSearchWidgetDescription & {
1321
1313
  $$widgetType: 'ais.geoSearch';
1322
1314
  }, GeoSearchConnectorParams, GeoSearchWidgetParams>;
1323
1315
 
1324
- declare type GeoSearchWidgetDescription = {
1316
+ declare type GeoSearchWidgetDescription<THit extends BaseHit = Record<string, any>> = {
1325
1317
  $$type: 'ais.geoSearch';
1326
- renderState: GeoSearchRenderState;
1318
+ renderState: GeoSearchRenderState<THit>;
1327
1319
  indexRenderState: {
1328
- geoSearch: WidgetRenderState<GeoSearchRenderState, GeoSearchConnectorParams>;
1320
+ geoSearch: WidgetRenderState<GeoSearchRenderState<THit>, GeoSearchConnectorParams<THit>>;
1329
1321
  };
1330
1322
  indexUiState: {
1331
1323
  geoSearch: {
@@ -4582,17 +4574,6 @@ declare type SearchBoxWidgetParams = {
4582
4574
  queryHook?: (query: string, hook: (value: string) => void) => void;
4583
4575
  };
4584
4576
 
4585
- declare type SearchClient = {
4586
- search: DefaultSearchClient['search'];
4587
- searchForFacetValues: DefaultSearchClient['searchForFacetValues'];
4588
- addAlgoliaAgent?: DefaultSearchClient['addAlgoliaAgent'];
4589
- initIndex?: (indexName: string) => SearchIndex extends {
4590
- findAnswers: any;
4591
- } ? Partial<Pick<SearchIndex, 'findAnswers'>> : SearchIndex;
4592
- };
4593
-
4594
- declare type SearchIndex = ReturnType<DefaultSearchClient['initIndex']>;
4595
-
4596
4577
  declare type SendEvent = (...args: [InsightsEvent] | [string, string, string?]) => void;
4597
4578
 
4598
4579
  declare type SendEventForFacet = BuiltInSendEventForFacet & CustomSendEventForFacet;