instantsearch.js 4.47.0 → 4.48.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [4.48.0](https://github.com/algolia/instantsearch.js/compare/v4.47.0...v4.48.0) (2022-10-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **insightsMiddleware:** infer type of insightsClient for onEvent ([#5130](https://github.com/algolia/instantsearch.js/issues/5130)) ([dd5fca4](https://github.com/algolia/instantsearch.js/commit/dd5fca4c185c66f1e31ebe9c0568bcad48e062f3)), closes [#5129](https://github.com/algolia/instantsearch.js/issues/5129)
7
+
8
+
9
+ ### Features
10
+
11
+ * **routing:** include repeated indexId in URL correctly ([#5134](https://github.com/algolia/instantsearch.js/issues/5134)) ([679f5da](https://github.com/algolia/instantsearch.js/commit/679f5dad839536def6ae9c3a18416296d40ed49a))
12
+
13
+
14
+
1
15
  # [4.47.0](https://github.com/algolia/instantsearch.js/compare/v4.46.3...v4.47.0) (2022-10-03)
2
16
 
3
17
 
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.47.0';
7
+ var _default = '4.48.0';
8
8
  exports.default = _default;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createInsightsMiddleware = void 0;
6
+ exports.createInsightsMiddleware = createInsightsMiddleware;
7
7
 
8
8
  var _index = require("../helpers/index.js");
9
9
 
@@ -27,7 +27,7 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
27
27
 
28
28
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
29
 
30
- var createInsightsMiddleware = function createInsightsMiddleware(props) {
30
+ function createInsightsMiddleware(props) {
31
31
  var _ref = props || {},
32
32
  _insightsClient = _ref.insightsClient,
33
33
  insightsInitParams = _ref.insightsInitParams,
@@ -166,6 +166,4 @@ var createInsightsMiddleware = function createInsightsMiddleware(props) {
166
166
  }
167
167
  };
168
168
  };
169
- };
170
-
171
- exports.createInsightsMiddleware = createInsightsMiddleware;
169
+ }
@@ -474,7 +474,7 @@ var index = function index(widgetParams) {
474
474
  getWidgetUiState: function getWidgetUiState(uiState) {
475
475
  return localWidgets.filter(_index.isIndexWidget).reduce(function (previousUiState, innerIndex) {
476
476
  return innerIndex.getWidgetUiState(previousUiState);
477
- }, _objectSpread(_objectSpread({}, uiState), {}, _defineProperty({}, this.getIndexId(), localUiState)));
477
+ }, _objectSpread(_objectSpread({}, uiState), {}, _defineProperty({}, indexId, _objectSpread(_objectSpread({}, uiState[indexId]), localUiState))));
478
478
  },
479
479
  getWidgetState: function getWidgetState(uiState) {
480
480
  process.env.NODE_ENV === 'development' ? (0, _index.warning)(false, 'The `getWidgetState` method is renamed `getWidgetUiState` and will no longer exist under that name in InstantSearch.js 5.x. Please use `getWidgetUiState` instead.') : void 0;
@@ -895,9 +895,9 @@ declare const connectVoiceSearch: VoiceSearchConnector;
895
895
 
896
896
  declare function createInfiniteHitsSessionStorageCache(): InfiniteHitsCache;
897
897
 
898
- declare type CreateInsightsMiddleware = (props: InsightsProps) => InternalMiddleware;
898
+ declare type CreateInsightsMiddleware = typeof createInsightsMiddleware;
899
899
 
900
- declare const createInsightsMiddleware: CreateInsightsMiddleware;
900
+ declare function createInsightsMiddleware<TInsightsClient extends null | InsightsClient>(props: InsightsProps<TInsightsClient>): InternalMiddleware;
901
901
 
902
902
  /**
903
903
  * Exposes the metadata of mounted widgets in a custom
@@ -2065,7 +2065,7 @@ declare type IndexWidget = Omit<Widget<IndexWidgetDescription & {
2065
2065
  * @deprecated
2066
2066
  */
2067
2067
  getWidgetState(uiState: UiState): UiState;
2068
- getWidgetUiState<TUiState = UiState>(uiState: TUiState): TUiState;
2068
+ getWidgetUiState<TUiState extends UiState = UiState>(uiState: TUiState): TUiState;
2069
2069
  getWidgetSearchParameters(searchParameters: SearchParameters, searchParametersOptions: {
2070
2070
  uiState: IndexUiState;
2071
2071
  }): SearchParameters;
@@ -2292,15 +2292,15 @@ declare type InsightsEvent = {
2292
2292
  attribute?: string;
2293
2293
  };
2294
2294
 
2295
- declare type InsightsProps = {
2296
- insightsClient: null | InsightsClient;
2295
+ declare type InsightsProps<TInsightsClient extends null | InsightsClient = InsightsClient | null> = {
2296
+ insightsClient: TInsightsClient;
2297
2297
  insightsInitParams?: {
2298
2298
  userHasOptedOut?: boolean;
2299
2299
  useCookie?: boolean;
2300
2300
  cookieDuration?: number;
2301
2301
  region?: 'de' | 'us';
2302
2302
  };
2303
- onEvent?: (event: InsightsEvent, insightsClient: null | InsightsClient) => void;
2303
+ onEvent?: (event: InsightsEvent, insightsClient: TInsightsClient) => void;
2304
2304
  };
2305
2305
 
2306
2306
  /**
@@ -2818,10 +2818,10 @@ declare type MiddlewareOptions = {
2818
2818
 
2819
2819
  declare namespace middlewares {
2820
2820
  export {
2821
+ createInsightsMiddleware,
2821
2822
  InsightsEvent,
2822
2823
  InsightsProps,
2823
2824
  CreateInsightsMiddleware,
2824
- createInsightsMiddleware,
2825
2825
  RouterProps,
2826
2826
  createRouterMiddleware,
2827
2827
  isMetadataEnabled,
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.47.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.48.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -7758,7 +7758,7 @@
7758
7758
  getWidgetUiState: function getWidgetUiState(uiState) {
7759
7759
  return localWidgets.filter(isIndexWidget).reduce(function (previousUiState, innerIndex) {
7760
7760
  return innerIndex.getWidgetUiState(previousUiState);
7761
- }, _objectSpread2(_objectSpread2({}, uiState), {}, _defineProperty({}, this.getIndexId(), localUiState)));
7761
+ }, _objectSpread2(_objectSpread2({}, uiState), {}, _defineProperty({}, indexId, _objectSpread2(_objectSpread2({}, uiState[indexId]), localUiState))));
7762
7762
  },
7763
7763
  getWidgetState: function getWidgetState(uiState) {
7764
7764
  _warning(false, 'The `getWidgetState` method is renamed `getWidgetUiState` and will no longer exist under that name in InstantSearch.js 5.x. Please use `getWidgetUiState` instead.') ;
@@ -7788,7 +7788,7 @@
7788
7788
  instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
7789
7789
  }
7790
7790
 
7791
- var version$1 = '4.47.0';
7791
+ var version$1 = '4.48.0';
7792
7792
 
7793
7793
  var NAMESPACE = 'ais';
7794
7794
  var component = function component(componentName) {
@@ -22285,7 +22285,7 @@
22285
22285
  voiceSearch: voiceSearch
22286
22286
  });
22287
22287
 
22288
- var createInsightsMiddleware = function createInsightsMiddleware(props) {
22288
+ function createInsightsMiddleware(props) {
22289
22289
  var _ref = props || {},
22290
22290
  _insightsClient = _ref.insightsClient,
22291
22291
  insightsInitParams = _ref.insightsInitParams,
@@ -22422,7 +22422,7 @@
22422
22422
  }
22423
22423
  };
22424
22424
  };
22425
- };
22425
+ }
22426
22426
 
22427
22427
 
22428
22428