instantsearch.js 4.58.0 → 4.59.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 (37) hide show
  1. package/README.md +1 -1
  2. package/cjs/components/Pagination/Pagination.js +4 -4
  3. package/cjs/components/RefinementList/RefinementList.js +2 -1
  4. package/cjs/components/SearchBox/SearchBox.js +5 -2
  5. package/cjs/components/Selector/Selector.js +4 -2
  6. package/cjs/components/Slider/Slider.js +3 -1
  7. package/cjs/lib/InstantSearch.js +26 -5
  8. package/cjs/lib/utils/createSendEventForFacet.js +12 -5
  9. package/cjs/lib/utils/createSendEventForHits.js +12 -6
  10. package/cjs/lib/version.js +1 -1
  11. package/cjs/middlewares/createInsightsMiddleware.js +15 -4
  12. package/cjs/widgets/sort-by/sort-by.js +2 -1
  13. package/dist/instantsearch.development.d.ts +4 -3
  14. package/dist/instantsearch.development.js +78 -34
  15. package/dist/instantsearch.development.js.map +1 -1
  16. package/dist/instantsearch.production.d.ts +4 -3
  17. package/dist/instantsearch.production.min.d.ts +4 -3
  18. package/dist/instantsearch.production.min.js +2 -2
  19. package/dist/instantsearch.production.min.js.map +1 -1
  20. package/es/components/Pagination/Pagination.js +4 -4
  21. package/es/components/RefinementList/RefinementList.js +2 -1
  22. package/es/components/SearchBox/SearchBox.d.ts +3 -0
  23. package/es/components/SearchBox/SearchBox.js +5 -2
  24. package/es/components/Selector/Selector.d.ts +2 -1
  25. package/es/components/Selector/Selector.js +4 -2
  26. package/es/components/Slider/Slider.js +3 -1
  27. package/es/lib/InstantSearch.d.ts +1 -0
  28. package/es/lib/InstantSearch.js +26 -5
  29. package/es/lib/utils/createSendEventForFacet.d.ts +1 -1
  30. package/es/lib/utils/createSendEventForFacet.js +12 -5
  31. package/es/lib/utils/createSendEventForHits.d.ts +2 -2
  32. package/es/lib/utils/createSendEventForHits.js +12 -6
  33. package/es/lib/version.d.ts +1 -1
  34. package/es/lib/version.js +1 -1
  35. package/es/middlewares/createInsightsMiddleware.js +15 -4
  36. package/es/widgets/sort-by/sort-by.js +2 -1
  37. package/package.json +6 -6
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/">
3
- <img alt="InstantSearch.js" src=".github/banner.png">
3
+ <img alt="InstantSearch.js" src="https://github.com/algolia/instantsearch/blob/master/.github/banner.png?raw=true">
4
4
  </a>
5
5
 
6
6
  <p align="center">
@@ -26,7 +26,7 @@ function Pagination(props) {
26
26
  }, (0, _preact.h)("ul", {
27
27
  className: props.cssClasses.list
28
28
  }, props.showFirst && (0, _preact.h)(PaginationLink, {
29
- ariaLabel: "First",
29
+ ariaLabel: "First Page",
30
30
  className: props.cssClasses.firstPageItem,
31
31
  isDisabled: props.isFirstPage,
32
32
  templates: props.templates,
@@ -36,7 +36,7 @@ function Pagination(props) {
36
36
  cssClasses: props.cssClasses,
37
37
  createClickHandler: createClickHandler
38
38
  }), props.showPrevious && (0, _preact.h)(PaginationLink, {
39
- ariaLabel: "Previous",
39
+ ariaLabel: "Previous Page",
40
40
  className: props.cssClasses.previousPageItem,
41
41
  isDisabled: props.isFirstPage,
42
42
  templates: props.templates,
@@ -59,7 +59,7 @@ function Pagination(props) {
59
59
  createClickHandler: createClickHandler
60
60
  });
61
61
  }), props.showNext && (0, _preact.h)(PaginationLink, {
62
- ariaLabel: "Next",
62
+ ariaLabel: "Next Page",
63
63
  className: props.cssClasses.nextPageItem,
64
64
  isDisabled: props.isLastPage,
65
65
  templates: props.templates,
@@ -69,7 +69,7 @@ function Pagination(props) {
69
69
  cssClasses: props.cssClasses,
70
70
  createClickHandler: createClickHandler
71
71
  }), props.showLast && (0, _preact.h)(PaginationLink, {
72
- ariaLabel: "Last",
72
+ ariaLabel: "Last Page, Page ".concat(props.nbPages),
73
73
  className: props.cssClasses.lastPageItem,
74
74
  isDisabled: props.isLastPage,
75
75
  templates: props.templates,
@@ -209,7 +209,8 @@ var RefinementList = /*#__PURE__*/function (_Component) {
209
209
  // This sets the search box to a controlled state because
210
210
  // we don't rely on the `refine` prop but on `onChange`.
211
211
  ,
212
- searchAsYouType: false
212
+ searchAsYouType: false,
213
+ ariaLabel: "Search for filters"
213
214
  }));
214
215
  var facetValues = this.props.facetValues && this.props.facetValues.length > 0 && (0, _preact.h)("ul", {
215
216
  className: this.props.cssClasses.list
@@ -31,6 +31,7 @@ var defaultProps = {
31
31
  searchAsYouType: true,
32
32
  isSearchStalled: false,
33
33
  disabled: false,
34
+ ariaLabel: 'Search',
34
35
  onChange: _utils.noop,
35
36
  onSubmit: _utils.noop,
36
37
  onReset: _utils.noop,
@@ -147,7 +148,8 @@ var SearchBox = /*#__PURE__*/function (_Component) {
147
148
  showReset = _this$props4.showReset,
148
149
  showLoadingIndicator = _this$props4.showLoadingIndicator,
149
150
  templates = _this$props4.templates,
150
- isSearchStalled = _this$props4.isSearchStalled;
151
+ isSearchStalled = _this$props4.isSearchStalled,
152
+ ariaLabel = _this$props4.ariaLabel;
151
153
  return (0, _preact.h)("div", {
152
154
  className: cssClasses.root
153
155
  }, (0, _preact.h)("form", {
@@ -174,7 +176,8 @@ var SearchBox = /*#__PURE__*/function (_Component) {
174
176
  maxLength: 512,
175
177
  onInput: this.onInput,
176
178
  onBlur: this.onBlur,
177
- onFocus: this.onFocus
179
+ onFocus: this.onFocus,
180
+ "aria-label": ariaLabel
178
181
  }), (0, _preact.h)(_Template.default, {
179
182
  templateKey: "submit",
180
183
  rootTagName: "button",
@@ -10,13 +10,15 @@ function Selector(_ref) {
10
10
  var currentValue = _ref.currentValue,
11
11
  options = _ref.options,
12
12
  cssClasses = _ref.cssClasses,
13
- setValue = _ref.setValue;
13
+ setValue = _ref.setValue,
14
+ ariaLabel = _ref.ariaLabel;
14
15
  return (0, _preact.h)("select", {
15
16
  className: (0, _uiComponentsShared.cx)(cssClasses.select),
16
17
  onChange: function onChange(event) {
17
18
  return setValue(event.target.value);
18
19
  },
19
- value: "".concat(currentValue)
20
+ value: "".concat(currentValue),
21
+ "aria-label": ariaLabel
20
22
  }, options.map(function (option) {
21
23
  return (0, _preact.h)("option", {
22
24
  className: (0, _uiComponentsShared.cx)(cssClasses.option),
@@ -56,8 +56,10 @@ var Slider = /*#__PURE__*/function (_Component) {
56
56
  parseFloat(props['aria-valuenow']) * 100) / 100;
57
57
  var value = _typeof(tooltips) === 'object' && tooltips.format ? tooltips.format(roundedValue) : roundedValue;
58
58
  var className = (0, _uiComponentsShared.cx)(props.className, props['data-handle-key'] === 0 && 'rheostat-handle-lower', props['data-handle-key'] === 1 && 'rheostat-handle-upper');
59
+ var ariaLabel = props['data-handle-key'] === 0 ? 'Minimum Filter Handle' : 'Maximum Filter Handle';
59
60
  return (0, _preact.h)("div", _extends({}, props, {
60
- className: className
61
+ className: className,
62
+ "aria-label": ariaLabel
61
63
  }), tooltips && (0, _preact.h)("div", {
62
64
  className: "rheostat-tooltip"
63
65
  }, value));
@@ -81,6 +81,7 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
81
81
  _defineProperty(_assertThisInitialized(_this), "_createURL", void 0);
82
82
  _defineProperty(_assertThisInitialized(_this), "_searchFunction", void 0);
83
83
  _defineProperty(_assertThisInitialized(_this), "_mainHelperSearch", void 0);
84
+ _defineProperty(_assertThisInitialized(_this), "_insights", void 0);
84
85
  _defineProperty(_assertThisInitialized(_this), "middleware", []);
85
86
  _defineProperty(_assertThisInitialized(_this), "sendEventToInsights", void 0);
86
87
  /**
@@ -131,7 +132,7 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
131
132
  _options$routing = options.routing,
132
133
  routing = _options$routing === void 0 ? null : _options$routing,
133
134
  _options$insights = options.insights,
134
- insights = _options$insights === void 0 ? false : _options$insights,
135
+ insights = _options$insights === void 0 ? undefined : _options$insights,
135
136
  searchFunction = options.searchFunction,
136
137
  _options$stalledSearc = options.stalledSearchDelay,
137
138
  stalledSearchDelay = _options$stalledSearc === void 0 ? 200 : _options$stalledSearc,
@@ -187,6 +188,7 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
187
188
  _this._createURL = defaultCreateURL;
188
189
  _this._initialUiState = initialUiState;
189
190
  _this._initialResults = null;
191
+ _this._insights = insights;
190
192
  if (searchFunction) {
191
193
  process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "The `searchFunction` option is deprecated. Use `onStateChange` instead.") : void 0;
192
194
  _this._searchFunction = searchFunction;
@@ -198,8 +200,9 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
198
200
  _this.use((0, _createRouterMiddleware.createRouterMiddleware)(routerOptions));
199
201
  }
200
202
 
201
- // This is the default middleware,
202
- // any user-provided middleware will be added later and override this one.
203
+ // This is the default Insights middleware,
204
+ // added when `insights` is set to true by the user.
205
+ // Any user-provided middleware will be added later and override this one.
203
206
  if (insights) {
204
207
  var insightsOptions = typeof insights === 'boolean' ? {} : insights;
205
208
  insightsOptions.$$internal = true;
@@ -491,6 +494,24 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
491
494
  var instance = _ref6.instance;
492
495
  instance.started();
493
496
  });
497
+
498
+ // This is the automatic Insights middleware,
499
+ // added when `insights` is unset and the initial results possess `queryID`.
500
+ // Any user-provided middleware will be added later and override this one.
501
+ if (typeof this._insights === 'undefined') {
502
+ mainHelper.derivedHelpers[0].once('result', function () {
503
+ var hasAutomaticInsights = _this3.mainIndex.getScopedResults().some(function (_ref7) {
504
+ var results = _ref7.results;
505
+ return results === null || results === void 0 ? void 0 : results._automaticInsights;
506
+ });
507
+ if (hasAutomaticInsights) {
508
+ _this3.use((0, _createInsightsMiddleware.createInsightsMiddleware)({
509
+ $$internal: true,
510
+ $$automatic: true
511
+ }));
512
+ }
513
+ });
514
+ }
494
515
  }
495
516
 
496
517
  /**
@@ -520,8 +541,8 @@ var InstantSearch = /*#__PURE__*/function (_EventEmitter) {
520
541
  (_this$mainHelper2 = this.mainHelper) === null || _this$mainHelper2 === void 0 ? void 0 : _this$mainHelper2.removeAllListeners();
521
542
  this.mainHelper = null;
522
543
  this.helper = null;
523
- this.middleware.forEach(function (_ref7) {
524
- var instance = _ref7.instance;
544
+ this.middleware.forEach(function (_ref8) {
545
+ var instance = _ref8.instance;
525
546
  instance.unsubscribe();
526
547
  });
527
548
  }
@@ -5,6 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.createSendEventForFacet = createSendEventForFacet;
7
7
  var _isFacetRefined = require("./isFacetRefined");
8
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
13
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
14
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
15
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -23,7 +28,9 @@ function createSendEventForFacet(_ref) {
23
28
  }
24
29
  var facetValue = args[1],
25
30
  _args$ = args[2],
26
- eventName = _args$ === void 0 ? 'Filter Applied' : _args$;
31
+ eventName = _args$ === void 0 ? 'Filter Applied' : _args$,
32
+ _args$2 = args[3],
33
+ additionalData = _args$2 === void 0 ? {} : _args$2;
27
34
  var _args$0$split = args[0].split(':'),
28
35
  _args$0$split2 = _slicedToArray(_args$0$split, 2),
29
36
  eventType = _args$0$split2[0],
@@ -31,7 +38,7 @@ function createSendEventForFacet(_ref) {
31
38
  var attribute = typeof attr === 'string' ? attr : attr(facetValue);
32
39
  if (args.length === 1 && _typeof(args[0]) === 'object') {
33
40
  instantSearchInstance.sendEventToInsights(args[0]);
34
- } else if (eventType === 'click' && (args.length === 2 || args.length === 3)) {
41
+ } else if (eventType === 'click' && args.length >= 2 && args.length <= 4) {
35
42
  if (!(0, _isFacetRefined.isFacetRefined)(helper, attribute, facetValue)) {
36
43
  // send event only when the facet is being checked "ON"
37
44
  instantSearchInstance.sendEventToInsights({
@@ -39,16 +46,16 @@ function createSendEventForFacet(_ref) {
39
46
  widgetType: widgetType,
40
47
  eventType: eventType,
41
48
  eventModifier: eventModifier,
42
- payload: {
49
+ payload: _objectSpread({
43
50
  eventName: eventName,
44
51
  index: helper.getIndex(),
45
52
  filters: ["".concat(attribute, ":").concat(facetValue)]
46
- },
53
+ }, additionalData),
47
54
  attribute: attribute
48
55
  });
49
56
  }
50
57
  } else if (process.env.NODE_ENV === 'development') {
51
- throw new Error("You need to pass two arguments like:\n sendEvent('click', facetValue);\n\nIf you want to send a custom payload, you can pass one object: sendEvent(customPayload);\n");
58
+ throw new Error("You need to pass between two and four arguments like:\n sendEvent('click', facetValue, eventName?, additionalData?);\n\nIf you want to send a custom payload, you can pass one object: sendEvent(customPayload);\n");
52
59
  }
53
60
  };
54
61
  return sendEventForFacet;
@@ -7,6 +7,11 @@ exports._buildEventPayloadsForHits = _buildEventPayloadsForHits;
7
7
  exports.createBindEventForHits = createBindEventForHits;
8
8
  exports.createSendEventForHits = createSendEventForHits;
9
9
  var _serializer = require("./serializer");
10
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
15
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
16
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
17
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -38,6 +43,7 @@ function _buildEventPayloadsForHits(_ref) {
38
43
  eventModifier = _args$0$split2[1];
39
44
  var hits = args[1];
40
45
  var eventName = args[2];
46
+ var additionalData = args[3] || {};
41
47
  if (!hits) {
42
48
  if (process.env.NODE_ENV === 'development') {
43
49
  throw new Error("You need to pass hit or hits as the second argument like:\n ".concat(methodName, "(eventType, hit);\n "));
@@ -77,11 +83,11 @@ function _buildEventPayloadsForHits(_ref) {
77
83
  insightsMethod: 'viewedObjectIDs',
78
84
  widgetType: widgetType,
79
85
  eventType: eventType,
80
- payload: {
86
+ payload: _objectSpread({
81
87
  eventName: eventName || 'Hits Viewed',
82
88
  index: index,
83
89
  objectIDs: objectIDsByChunk[i]
84
- },
90
+ }, additionalData),
85
91
  hits: batch,
86
92
  eventModifier: eventModifier
87
93
  };
@@ -92,13 +98,13 @@ function _buildEventPayloadsForHits(_ref) {
92
98
  insightsMethod: 'clickedObjectIDsAfterSearch',
93
99
  widgetType: widgetType,
94
100
  eventType: eventType,
95
- payload: {
101
+ payload: _objectSpread({
96
102
  eventName: eventName || 'Hit Clicked',
97
103
  index: index,
98
104
  queryID: queryID,
99
105
  objectIDs: objectIDsByChunk[i],
100
106
  positions: positionsByChunk[i]
101
- },
107
+ }, additionalData),
102
108
  hits: batch,
103
109
  eventModifier: eventModifier
104
110
  };
@@ -109,12 +115,12 @@ function _buildEventPayloadsForHits(_ref) {
109
115
  insightsMethod: 'convertedObjectIDsAfterSearch',
110
116
  widgetType: widgetType,
111
117
  eventType: eventType,
112
- payload: {
118
+ payload: _objectSpread({
113
119
  eventName: eventName || 'Hit Converted',
114
120
  index: index,
115
121
  queryID: queryID,
116
122
  objectIDs: objectIDsByChunk[i]
117
- },
123
+ }, additionalData),
118
124
  hits: batch,
119
125
  eventModifier: eventModifier
120
126
  };
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.58.0';
7
+ var _default = '4.59.0';
8
8
  exports.default = _default;
@@ -30,7 +30,9 @@ function createInsightsMiddleware() {
30
30
  insightsInitParams = props.insightsInitParams,
31
31
  onEvent = props.onEvent,
32
32
  _props$$$internal = props.$$internal,
33
- $$internal = _props$$$internal === void 0 ? false : _props$$$internal;
33
+ $$internal = _props$$$internal === void 0 ? false : _props$$$internal,
34
+ _props$$$automatic = props.$$automatic,
35
+ $$automatic = _props$$$automatic === void 0 ? false : _props$$$automatic;
34
36
  var potentialInsightsClient = _insightsClient;
35
37
  if (!_insightsClient && _insightsClient !== null) {
36
38
  (0, _utils.safelyRunOnBrowser)(function (_ref) {
@@ -121,6 +123,7 @@ function createInsightsMiddleware() {
121
123
  return {
122
124
  $$type: 'ais.insights',
123
125
  $$internal: $$internal,
126
+ $$automatic: $$automatic,
124
127
  onStateChange: function onStateChange() {},
125
128
  subscribe: function subscribe() {
126
129
  if (!insightsClient.shouldAddScript) return;
@@ -146,9 +149,14 @@ function createInsightsMiddleware() {
146
149
  userToken: helper.state.userToken,
147
150
  clickAnalytics: helper.state.clickAnalytics
148
151
  };
149
- helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
150
- clickAnalytics: true
151
- }));
152
+
153
+ // We don't want to force clickAnalytics when the insights is enabled from the search response.
154
+ // This means we don't enable insights for indices that don't opt in
155
+ if (!$$automatic) {
156
+ helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
157
+ clickAnalytics: true
158
+ }));
159
+ }
152
160
  if (!$$internal) {
153
161
  instantSearchInstance.scheduleSearch();
154
162
  }
@@ -215,6 +223,9 @@ function createInsightsMiddleware() {
215
223
  } else if (event.insightsMethod) {
216
224
  // Source is used to differentiate events sent by instantsearch from those sent manually.
217
225
  event.payload.algoliaSource = ['instantsearch'];
226
+ if ($$automatic) {
227
+ event.payload.algoliaSource.push('instantsearch-automatic');
228
+ }
218
229
  if (event.eventModifier === 'internal') {
219
230
  event.payload.algoliaSource.push('instantsearch-internal');
220
231
  }
@@ -37,7 +37,8 @@ var renderer = function renderer(_ref) {
37
37
  cssClasses: cssClasses,
38
38
  currentValue: currentRefinement,
39
39
  options: options,
40
- setValue: refine
40
+ setValue: refine,
41
+ ariaLabel: "Sort results by"
41
42
  })), containerNode);
42
43
  };
43
44
  };
@@ -531,11 +531,11 @@ declare type BrowserHistoryArgs<TRouteState> = {
531
531
  push?: (url: string) => void;
532
532
  };
533
533
 
534
- declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => string;
534
+ declare type BuiltInBindEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string, additionalData?: Record<string, any>) => string;
535
535
 
536
- declare type BuiltInSendEventForFacet = (eventType: string, facetValue: string, eventName?: string) => void;
536
+ declare type BuiltInSendEventForFacet = (eventType: string, facetValue: string, eventName?: string, additionalData?: Record<string, any>) => void;
537
537
 
538
- declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string) => void;
538
+ declare type BuiltInSendEventForHits = (eventType: string, hits: Hit | Hit[], eventName?: string, additionalData?: Record<string, any>) => void;
539
539
 
540
540
  declare type BuiltInSendEventForToggle = (eventType: string, isRefined: boolean, eventName?: string) => void;
541
541
 
@@ -2377,6 +2377,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2377
2377
  _createURL: CreateURL<TUiState>;
2378
2378
  _searchFunction?: InstantSearchOptions['searchFunction'];
2379
2379
  _mainHelperSearch?: AlgoliaSearchHelper['search'];
2380
+ _insights: InstantSearchOptions['insights'];
2380
2381
  middleware: Array<{
2381
2382
  creator: Middleware<TUiState>;
2382
2383
  instance: MiddlewareDefinition<TUiState>;