instantsearch.js 4.79.2 → 4.81.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 (69) hide show
  1. package/cjs/components/Template/Template.js +1 -1
  2. package/cjs/connectors/chat/connectChat.js +200 -0
  3. package/cjs/connectors/index.js +7 -0
  4. package/cjs/connectors/index.umd.js +239 -0
  5. package/cjs/index.js +2 -2
  6. package/cjs/lib/InstantSearch.js +2 -10
  7. package/cjs/lib/chat/chat.js +177 -0
  8. package/cjs/lib/chat/index.js +27 -0
  9. package/cjs/lib/useStickToBottom.js +20 -0
  10. package/cjs/lib/version.js +1 -1
  11. package/cjs/templates/carousel/carousel.js +31 -4
  12. package/cjs/widgets/chat/chat.js +615 -0
  13. package/cjs/widgets/index/index.js +78 -24
  14. package/cjs/widgets/index.js +7 -0
  15. package/cjs/widgets/index.umd.js +267 -0
  16. package/dist/instantsearch.development.d.ts +123 -15
  17. package/dist/instantsearch.development.js +186 -91
  18. package/dist/instantsearch.development.js.map +1 -1
  19. package/dist/instantsearch.production.d.ts +123 -15
  20. package/dist/instantsearch.production.min.d.ts +123 -15
  21. package/dist/instantsearch.production.min.js +2 -2
  22. package/dist/instantsearch.production.min.js.map +1 -1
  23. package/es/components/Template/Template.js +1 -1
  24. package/es/connectors/chat/connectChat.d.ts +413 -0
  25. package/es/connectors/chat/connectChat.js +194 -0
  26. package/es/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.d.ts +2 -0
  27. package/es/connectors/geo-search/connectGeoSearch.d.ts +1 -0
  28. package/es/connectors/hits/connectHits.d.ts +1 -0
  29. package/es/connectors/hits/connectHitsWithInsights.d.ts +1 -0
  30. package/es/connectors/index.d.ts +1 -0
  31. package/es/connectors/index.js +2 -1
  32. package/es/connectors/index.umd.d.ts +39 -0
  33. package/es/connectors/index.umd.js +47 -0
  34. package/es/connectors/infinite-hits/connectInfiniteHits.d.ts +1 -0
  35. package/es/connectors/infinite-hits/connectInfiniteHitsWithInsights.d.ts +1 -0
  36. package/es/connectors/looking-similar/connectLookingSimilar.d.ts +2 -0
  37. package/es/connectors/related-products/connectRelatedProducts.d.ts +2 -0
  38. package/es/connectors/trending-items/connectTrendingItems.d.ts +2 -0
  39. package/es/lib/InstantSearch.d.ts +2 -2
  40. package/es/lib/InstantSearch.js +2 -10
  41. package/es/lib/chat/chat.d.ts +40 -0
  42. package/es/lib/chat/chat.js +166 -0
  43. package/es/lib/chat/index.d.ts +7 -0
  44. package/es/lib/chat/index.js +5 -0
  45. package/es/lib/useStickToBottom.d.ts +1 -0
  46. package/es/lib/useStickToBottom.js +14 -0
  47. package/es/lib/version.d.ts +1 -1
  48. package/es/lib/version.js +1 -1
  49. package/es/templates/carousel/carousel.d.ts +10 -3
  50. package/es/templates/carousel/carousel.js +32 -5
  51. package/es/types/render-state.d.ts +2 -1
  52. package/es/types/templates.d.ts +1 -1
  53. package/es/types/widget.d.ts +2 -2
  54. package/es/widgets/chat/chat.d.ts +555 -0
  55. package/es/widgets/chat/chat.js +597 -0
  56. package/es/widgets/frequently-bought-together/frequently-bought-together.d.ts +3 -1
  57. package/es/widgets/geo-search/geo-search.d.ts +1 -0
  58. package/es/widgets/hits/hits.d.ts +1 -0
  59. package/es/widgets/index/index.d.ts +46 -2
  60. package/es/widgets/index/index.js +78 -24
  61. package/es/widgets/index.d.ts +1 -0
  62. package/es/widgets/index.js +2 -1
  63. package/es/widgets/index.umd.d.ts +44 -0
  64. package/es/widgets/index.umd.js +51 -0
  65. package/es/widgets/infinite-hits/infinite-hits.d.ts +1 -0
  66. package/es/widgets/looking-similar/looking-similar.d.ts +3 -1
  67. package/es/widgets/related-products/related-products.d.ts +3 -1
  68. package/es/widgets/trending-items/trending-items.d.ts +3 -1
  69. package/package.json +11 -7
@@ -1,7 +1,45 @@
1
1
  import type { InstantSearch, UiState, IndexUiState, Widget, ScopedResult, RecommendResponse } from '../../types';
2
2
  import type { AlgoliaSearchHelper as Helper, SearchParameters, SearchResults } from 'algoliasearch-helper';
3
3
  export type IndexWidgetParams = {
4
+ /**
5
+ * The index or composition id to target.
6
+ */
4
7
  indexName: string;
8
+ /**
9
+ * Id to use for the index if there are multiple indices with the same name.
10
+ * This will be used to create the URL and the render state.
11
+ */
12
+ indexId?: string;
13
+ /**
14
+ * If `true`, the index will not be merged with the main helper's state.
15
+ * This means that the index will not be part of the main search request.
16
+ *
17
+ * @default false
18
+ */
19
+ EXPERIMENTAL_isolated?: false;
20
+ } | {
21
+ /**
22
+ * If `true`, the index will not be merged with the main helper's state.
23
+ * This means that the index will not be part of the main search request.
24
+ *
25
+ * This option is EXPERIMENTAL, and implementation details may change in the future.
26
+ * Things that could change are:
27
+ * - which widgets get rendered when a change happens
28
+ * - whether the index searches automatically
29
+ * - whether the index is included in the URL / UiState
30
+ * - whether the index is included in server-side rendering
31
+ *
32
+ * @default false
33
+ */
34
+ EXPERIMENTAL_isolated: true;
35
+ /**
36
+ * The index or composition id to target.
37
+ */
38
+ indexName?: string;
39
+ /**
40
+ * Id to use for the index if there are multiple indices with the same name.
41
+ * This will be used to create the URL and the render state.
42
+ */
5
43
  indexId?: string;
6
44
  };
7
45
  export type IndexInitOptions = {
@@ -29,8 +67,8 @@ export type IndexWidget<TUiState extends UiState = UiState> = Omit<Widget<IndexW
29
67
  getParent: () => IndexWidget | null;
30
68
  getWidgets: () => Array<Widget | IndexWidget>;
31
69
  createURL: (nextState: SearchParameters | ((state: IndexUiState) => IndexUiState)) => string;
32
- addWidgets: (widgets: Array<Widget | IndexWidget>) => IndexWidget;
33
- removeWidgets: (widgets: Array<Widget | IndexWidget>) => IndexWidget;
70
+ addWidgets: (widgets: Array<Widget | IndexWidget | Widget[]>) => IndexWidget;
71
+ removeWidgets: (widgets: Array<Widget | IndexWidget | Widget[]>) => IndexWidget;
34
72
  init: (options: IndexInitOptions) => void;
35
73
  render: (options: IndexRenderOptions) => void;
36
74
  dispose: () => void;
@@ -53,6 +91,12 @@ export type IndexWidget<TUiState extends UiState = UiState> = Omit<Widget<IndexW
53
91
  * Can only be called after `init`.
54
92
  */
55
93
  setIndexUiState: (indexUiState: TUiState[string] | ((previousIndexUiState: TUiState[string]) => TUiState[string])) => void;
94
+ /**
95
+ * This index is isolated, meaning it will not be merged with the main
96
+ * helper's state.
97
+ * @private
98
+ */
99
+ _isolated: boolean;
56
100
  };
57
101
  declare const index: (widgetParams: IndexWidgetParams) => IndexWidget;
58
102
  export default index;
@@ -110,12 +110,18 @@ function resolveScopedResultsFromWidgets(widgets) {
110
110
  }, []);
111
111
  }
112
112
  var index = function index(widgetParams) {
113
- if (widgetParams === undefined || widgetParams.indexName === undefined) {
113
+ if (widgetParams === undefined || widgetParams.indexName === undefined && !widgetParams.EXPERIMENTAL_isolated) {
114
114
  throw new Error(withUsage('The `indexName` option is required.'));
115
115
  }
116
- var indexName = widgetParams.indexName,
116
+
117
+ // When isolated=true, we use an empty string as the default indexName.
118
+ // This is intentional: isolated indices do not require a real index name.
119
+ var _widgetParams$indexNa = widgetParams.indexName,
120
+ indexName = _widgetParams$indexNa === void 0 ? '' : _widgetParams$indexNa,
117
121
  _widgetParams$indexId = widgetParams.indexId,
118
- indexId = _widgetParams$indexId === void 0 ? indexName : _widgetParams$indexId;
122
+ indexId = _widgetParams$indexId === void 0 ? indexName : _widgetParams$indexId,
123
+ _widgetParams$EXPERIM = widgetParams.EXPERIMENTAL_isolated,
124
+ isolated = _widgetParams$EXPERIM === void 0 ? false : _widgetParams$EXPERIM;
119
125
  var localWidgets = [];
120
126
  var localUiState = {};
121
127
  var localInstantSearchInstance = null;
@@ -128,6 +134,7 @@ var index = function index(widgetParams) {
128
134
  return {
129
135
  $$type: 'ais.index',
130
136
  $$widgetType: 'ais.index',
137
+ _isolated: isolated,
131
138
  getIndexName: function getIndexName() {
132
139
  return indexName;
133
140
  },
@@ -179,7 +186,7 @@ var index = function index(widgetParams) {
179
186
  return resolveScopedResultsFromWidgets(widgetSiblings);
180
187
  },
181
188
  getParent: function getParent() {
182
- return localParent;
189
+ return isolated ? null : localParent;
183
190
  },
184
191
  createURL: function createURL(nextState) {
185
192
  if (typeof nextState === 'function') {
@@ -198,12 +205,15 @@ var index = function index(widgetParams) {
198
205
  if (!Array.isArray(widgets)) {
199
206
  throw new Error(withUsage('The `addWidgets` method expects an array of widgets.'));
200
207
  }
201
- if (widgets.some(function (widget) {
208
+ var flatWidgets = widgets.reduce(function (acc, w) {
209
+ return acc.concat(Array.isArray(w) ? w : [w]);
210
+ }, []);
211
+ if (flatWidgets.some(function (widget) {
202
212
  return typeof widget.init !== 'function' && typeof widget.render !== 'function';
203
213
  })) {
204
214
  throw new Error(withUsage('The widget definition expects a `render` and/or an `init` method.'));
205
215
  }
206
- widgets.forEach(function (widget) {
216
+ flatWidgets.forEach(function (widget) {
207
217
  if (isIndexWidget(widget)) {
208
218
  return;
209
219
  }
@@ -218,8 +228,8 @@ var index = function index(widgetParams) {
218
228
  }
219
229
  addWidgetId(widget);
220
230
  });
221
- localWidgets = localWidgets.concat(widgets);
222
- if (localInstantSearchInstance && Boolean(widgets.length)) {
231
+ localWidgets = localWidgets.concat(flatWidgets);
232
+ if (localInstantSearchInstance && Boolean(flatWidgets.length)) {
223
233
  privateHelperSetState(helper, {
224
234
  state: getLocalWidgetsSearchParameters(localWidgets, {
225
235
  uiState: localUiState,
@@ -235,7 +245,7 @@ var index = function index(widgetParams) {
235
245
  // We compute the render state before calling `init` in a separate loop
236
246
  // to construct the whole render state object that is then passed to
237
247
  // `init`.
238
- widgets.forEach(function (widget) {
248
+ flatWidgets.forEach(function (widget) {
239
249
  if (widget.getRenderState) {
240
250
  var renderState = widget.getRenderState(localInstantSearchInstance.renderState[_this.getIndexId()] || {}, createInitArgs(localInstantSearchInstance, _this, localInstantSearchInstance._initialUiState));
241
251
  storeRenderState({
@@ -245,12 +255,17 @@ var index = function index(widgetParams) {
245
255
  });
246
256
  }
247
257
  });
248
- widgets.forEach(function (widget) {
258
+ flatWidgets.forEach(function (widget) {
249
259
  if (widget.init) {
250
260
  widget.init(createInitArgs(localInstantSearchInstance, _this, localInstantSearchInstance._initialUiState));
251
261
  }
252
262
  });
253
- localInstantSearchInstance.scheduleSearch();
263
+ if (isolated) {
264
+ var _helper2;
265
+ (_helper2 = helper) === null || _helper2 === void 0 ? void 0 : _helper2.search();
266
+ } else {
267
+ localInstantSearchInstance.scheduleSearch();
268
+ }
254
269
  }
255
270
  return this;
256
271
  },
@@ -259,13 +274,16 @@ var index = function index(widgetParams) {
259
274
  if (!Array.isArray(widgets)) {
260
275
  throw new Error(withUsage('The `removeWidgets` method expects an array of widgets.'));
261
276
  }
262
- if (widgets.some(function (widget) {
277
+ var flatWidgets = widgets.reduce(function (acc, w) {
278
+ return acc.concat(Array.isArray(w) ? w : [w]);
279
+ }, []);
280
+ if (flatWidgets.some(function (widget) {
263
281
  return typeof widget.dispose !== 'function';
264
282
  })) {
265
283
  throw new Error(withUsage('The widget definition expects a `dispose` method.'));
266
284
  }
267
285
  localWidgets = localWidgets.filter(function (widget) {
268
- return widgets.indexOf(widget) === -1;
286
+ return flatWidgets.indexOf(widget) === -1;
269
287
  });
270
288
  localWidgets.forEach(function (widget) {
271
289
  if (isIndexWidget(widget)) {
@@ -281,8 +299,8 @@ var index = function index(widgetParams) {
281
299
  hasSearchWidget = true;
282
300
  }
283
301
  });
284
- if (localInstantSearchInstance && Boolean(widgets.length)) {
285
- var _widgets$reduce = widgets.reduce(function (states, widget) {
302
+ if (localInstantSearchInstance && Boolean(flatWidgets.length)) {
303
+ var _flatWidgets$reduce = flatWidgets.reduce(function (states, widget) {
286
304
  // the `dispose` method exists at this point we already assert it
287
305
  var next = widget.dispose({
288
306
  helper: helper,
@@ -300,8 +318,8 @@ var index = function index(widgetParams) {
300
318
  cleanedSearchState: helper.state,
301
319
  cleanedRecommendState: helper.recommendState
302
320
  }),
303
- cleanedSearchState = _widgets$reduce.cleanedSearchState,
304
- cleanedRecommendState = _widgets$reduce.cleanedRecommendState;
321
+ cleanedSearchState = _flatWidgets$reduce.cleanedSearchState,
322
+ cleanedRecommendState = _flatWidgets$reduce.cleanedRecommendState;
305
323
  var newState = localInstantSearchInstance.future.preserveSharedStateOnUnmount ? getLocalWidgetsSearchParameters(localWidgets, {
306
324
  uiState: localUiState,
307
325
  initialSearchParameters: new algoliasearchHelper.SearchParameters({
@@ -321,7 +339,12 @@ var index = function index(widgetParams) {
321
339
  helper.setState(newState);
322
340
  helper.recommendState = cleanedRecommendState;
323
341
  if (localWidgets.length) {
324
- localInstantSearchInstance.scheduleSearch();
342
+ if (isolated) {
343
+ var _helper3;
344
+ (_helper3 = helper) === null || _helper3 === void 0 ? void 0 : _helper3.search();
345
+ } else {
346
+ localInstantSearchInstance.scheduleSearch();
347
+ }
325
348
  }
326
349
  }
327
350
  return this;
@@ -359,13 +382,20 @@ var index = function index(widgetParams) {
359
382
  // This Helper is only used for state management we do not care about the
360
383
  // `searchClient`. Only the "main" Helper created at the `InstantSearch`
361
384
  // level is aware of the client.
362
- helper = algoliasearchHelper({}, parameters.index, parameters);
385
+ helper = algoliasearchHelper(mainHelper.getClient(), parameters.index, parameters);
363
386
  helper.recommendState = recommendParameters;
364
387
 
365
388
  // We forward the call to `search` to the "main" instance of the Helper
366
389
  // which is responsible for managing the queries (it's the only one that is
367
390
  // aware of the `searchClient`).
368
391
  helper.search = function () {
392
+ if (isolated) {
393
+ instantSearchInstance.status = 'loading';
394
+ _this3.render({
395
+ instantSearchInstance: instantSearchInstance
396
+ });
397
+ return instantSearchInstance.compositionID ? helper.searchWithComposition() : helper.searchOnlyWithDerivedHelpers();
398
+ }
369
399
  if (instantSearchInstance.onStateChange) {
370
400
  instantSearchInstance.onStateChange({
371
401
  uiState: instantSearchInstance.mainIndex.getWidgetUiState({}),
@@ -389,7 +419,9 @@ var index = function index(widgetParams) {
389
419
  var state = helper.state.setQueryParameters(userState);
390
420
  return mainHelper.searchForFacetValues(facetName, facetValue, maxFacetHits, state);
391
421
  };
392
- derivedHelper = mainHelper.derive(function () {
422
+ var isolatedHelper = indexName ? helper : algoliasearchHelper({}, '__empty_index__', {});
423
+ var derivingHelper = isolated ? isolatedHelper : nearestIsolatedHelper(parent, mainHelper);
424
+ derivedHelper = derivingHelper.derive(function () {
393
425
  return mergeSearchParameters.apply(void 0, [mainHelper.state].concat(_toConsumableArray(resolveSearchParameters(_this3))));
394
426
  }, function () {
395
427
  return _this3.getHelper().recommendState;
@@ -531,7 +563,11 @@ var index = function index(widgetParams) {
531
563
 
532
564
  // We only render index widgets if there are no results.
533
565
  // This makes sure `render` is never called with `results` being `null`.
534
- var widgetsToRender = this.getResults() || (_derivedHelper2 = derivedHelper) !== null && _derivedHelper2 !== void 0 && _derivedHelper2.lastRecommendResults ? localWidgets : localWidgets.filter(isIndexWidget);
566
+ // If it's an isolated index without an index name, we render all widgets,
567
+ // as there are no results to display for the isolated index itself.
568
+ var widgetsToRender = this.getResults() || (_derivedHelper2 = derivedHelper) !== null && _derivedHelper2 !== void 0 && _derivedHelper2.lastRecommendResults || isolated && !indexName ? localWidgets : localWidgets.filter(function (widget) {
569
+ return widget.shouldRender;
570
+ });
535
571
  widgetsToRender = widgetsToRender.filter(function (widget) {
536
572
  if (!widget.shouldRender) {
537
573
  return true;
@@ -565,7 +601,7 @@ var index = function index(widgetParams) {
565
601
  },
566
602
  dispose: function dispose() {
567
603
  var _this5 = this,
568
- _helper2,
604
+ _helper4,
569
605
  _derivedHelper3;
570
606
  localWidgets.forEach(function (widget) {
571
607
  if (widget.dispose && helper) {
@@ -585,13 +621,15 @@ var index = function index(widgetParams) {
585
621
  });
586
622
  localInstantSearchInstance = null;
587
623
  localParent = null;
588
- (_helper2 = helper) === null || _helper2 === void 0 ? void 0 : _helper2.removeAllListeners();
624
+ (_helper4 = helper) === null || _helper4 === void 0 ? void 0 : _helper4.removeAllListeners();
589
625
  helper = null;
590
626
  (_derivedHelper3 = derivedHelper) === null || _derivedHelper3 === void 0 ? void 0 : _derivedHelper3.detach();
591
627
  derivedHelper = null;
592
628
  },
593
629
  getWidgetUiState: function getWidgetUiState(uiState) {
594
- return localWidgets.filter(isIndexWidget).reduce(function (previousUiState, innerIndex) {
630
+ return localWidgets.filter(isIndexWidget).filter(function (w) {
631
+ return !w._isolated;
632
+ }).reduce(function (previousUiState, innerIndex) {
595
633
  return innerIndex.getWidgetUiState(previousUiState);
596
634
  }, _objectSpread(_objectSpread({}, uiState), {}, _defineProperty({}, indexId, _objectSpread(_objectSpread({}, uiState[indexId]), localUiState))));
597
635
  },
@@ -606,6 +644,9 @@ var index = function index(widgetParams) {
606
644
  initialSearchParameters: searchParameters
607
645
  });
608
646
  },
647
+ shouldRender: function shouldRender() {
648
+ return true;
649
+ },
609
650
  refreshUiState: function refreshUiState() {
610
651
  localUiState = getLocalWidgetsUiState(localWidgets, {
611
652
  searchParameters: this.getHelper().state,
@@ -627,4 +668,17 @@ function storeRenderState(_ref8) {
627
668
  parent = _ref8.parent;
628
669
  var parentIndexName = parent ? parent.getIndexId() : instantSearchInstance.mainIndex.getIndexId();
629
670
  instantSearchInstance.renderState = _objectSpread(_objectSpread({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread(_objectSpread({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
671
+ }
672
+
673
+ /**
674
+ * Walk up the parent chain to find the closest isolated index, or fall back to mainHelper
675
+ */
676
+ function nearestIsolatedHelper(current, mainHelper) {
677
+ while (current) {
678
+ if (current._isolated) {
679
+ return current.getHelper();
680
+ }
681
+ current = current.getParent();
682
+ }
683
+ return mainHelper;
630
684
  }
@@ -41,3 +41,4 @@ export { default as trendingItems } from './trending-items/trending-items';
41
41
  export { default as voiceSearch } from './voice-search/voice-search';
42
42
  export { default as frequentlyBoughtTogether } from './frequently-bought-together/frequently-bought-together';
43
43
  export { default as lookingSimilar } from './looking-similar/looking-similar';
44
+ export { default as chat } from './chat/chat';
@@ -45,4 +45,5 @@ export { default as toggleRefinement } from "./toggle-refinement/toggle-refineme
45
45
  export { default as trendingItems } from "./trending-items/trending-items.js";
46
46
  export { default as voiceSearch } from "./voice-search/voice-search.js";
47
47
  export { default as frequentlyBoughtTogether } from "./frequently-bought-together/frequently-bought-together.js";
48
- export { default as lookingSimilar } from "./looking-similar/looking-similar.js";
48
+ export { default as lookingSimilar } from "./looking-similar/looking-similar.js";
49
+ export { default as chat } from "./chat/chat.js";
@@ -0,0 +1,44 @@
1
+ import dynamicWidgets from './dynamic-widgets/dynamic-widgets';
2
+ /** @deprecated answers is no longer supported */
3
+ export declare const EXPERIMENTAL_answers: import("./answers/answers").AnswersWidget;
4
+ /** @deprecated use relatedItems instead */
5
+ export declare const EXPERIMENTAL_configureRelatedItems: import("./configure-related-items/configure-related-items").ConfigureRelatedItemsWidget;
6
+ /** @deprecated use dynamicWidgets */
7
+ export declare const EXPERIMENTAL_dynamicWidgets: import("./dynamic-widgets/dynamic-widgets").DynamicWidgetsWidget;
8
+ export { dynamicWidgets };
9
+ export { default as analytics } from './analytics/analytics';
10
+ export { default as breadcrumb } from './breadcrumb/breadcrumb';
11
+ export { default as clearRefinements } from './clear-refinements/clear-refinements';
12
+ export { default as configure } from './configure/configure';
13
+ export { default as currentRefinements } from './current-refinements/current-refinements';
14
+ export { default as geoSearch } from './geo-search/geo-search';
15
+ export { default as hierarchicalMenu } from './hierarchical-menu/hierarchical-menu';
16
+ export { default as hits } from './hits/hits';
17
+ export { default as hitsPerPage } from './hits-per-page/hits-per-page';
18
+ export { default as index } from './index/index';
19
+ export type { IndexWidget } from './index/index';
20
+ export { default as infiniteHits } from './infinite-hits/infinite-hits';
21
+ export { default as menu } from './menu/menu';
22
+ export { default as menuSelect } from './menu-select/menu-select';
23
+ export { default as numericMenu } from './numeric-menu/numeric-menu';
24
+ export { default as pagination } from './pagination/pagination';
25
+ export { default as panel } from './panel/panel';
26
+ export { default as places } from './places/places';
27
+ export { default as poweredBy } from './powered-by/powered-by';
28
+ export { default as queryRuleContext } from './query-rule-context/query-rule-context';
29
+ export { default as queryRuleCustomData } from './query-rule-custom-data/query-rule-custom-data';
30
+ export { default as relatedProducts } from './related-products/related-products';
31
+ export { default as rangeInput } from './range-input/range-input';
32
+ export { default as rangeSlider } from './range-slider/range-slider';
33
+ export { default as ratingMenu } from './rating-menu/rating-menu';
34
+ export { default as refinementList } from './refinement-list/refinement-list';
35
+ export { default as relevantSort } from './relevant-sort/relevant-sort';
36
+ export { default as searchBox } from './search-box/search-box';
37
+ export { default as sortBy } from './sort-by/sort-by';
38
+ export { default as stats } from './stats/stats';
39
+ export { default as toggleRefinement } from './toggle-refinement/toggle-refinement';
40
+ export { default as trendingItems } from './trending-items/trending-items';
41
+ export { default as voiceSearch } from './voice-search/voice-search';
42
+ export { default as frequentlyBoughtTogether } from './frequently-bought-together/frequently-bought-together';
43
+ export { default as lookingSimilar } from './looking-similar/looking-similar';
44
+ export declare const chat: () => never;
@@ -0,0 +1,51 @@
1
+ import { deprecate } from "../lib/utils/index.js";
2
+ import answers from "./answers/answers.js";
3
+ import configureRelatedItems from "./configure-related-items/configure-related-items.js";
4
+ import dynamicWidgets from "./dynamic-widgets/dynamic-widgets.js";
5
+
6
+ /** @deprecated answers is no longer supported */
7
+ export var EXPERIMENTAL_answers = deprecate(answers, 'answers is no longer supported');
8
+
9
+ /** @deprecated use relatedItems instead */
10
+ export var EXPERIMENTAL_configureRelatedItems = deprecate(configureRelatedItems, 'EXPERIMENTAL_configureRelatedItems is deprecated and will be removed in a next minor version of InstantSearch. Please use relatedItems instead.');
11
+
12
+ /** @deprecated use dynamicWidgets */
13
+ export var EXPERIMENTAL_dynamicWidgets = deprecate(dynamicWidgets, 'use dynamicWidgets');
14
+ export { dynamicWidgets };
15
+ export { default as analytics } from "./analytics/analytics.js";
16
+ export { default as breadcrumb } from "./breadcrumb/breadcrumb.js";
17
+ export { default as clearRefinements } from "./clear-refinements/clear-refinements.js";
18
+ export { default as configure } from "./configure/configure.js";
19
+ export { default as currentRefinements } from "./current-refinements/current-refinements.js";
20
+ export { default as geoSearch } from "./geo-search/geo-search.js";
21
+ export { default as hierarchicalMenu } from "./hierarchical-menu/hierarchical-menu.js";
22
+ export { default as hits } from "./hits/hits.js";
23
+ export { default as hitsPerPage } from "./hits-per-page/hits-per-page.js";
24
+ export { default as index } from "./index/index.js";
25
+ export { default as infiniteHits } from "./infinite-hits/infinite-hits.js";
26
+ export { default as menu } from "./menu/menu.js";
27
+ export { default as menuSelect } from "./menu-select/menu-select.js";
28
+ export { default as numericMenu } from "./numeric-menu/numeric-menu.js";
29
+ export { default as pagination } from "./pagination/pagination.js";
30
+ export { default as panel } from "./panel/panel.js";
31
+ export { default as places } from "./places/places.js";
32
+ export { default as poweredBy } from "./powered-by/powered-by.js";
33
+ export { default as queryRuleContext } from "./query-rule-context/query-rule-context.js";
34
+ export { default as queryRuleCustomData } from "./query-rule-custom-data/query-rule-custom-data.js";
35
+ export { default as relatedProducts } from "./related-products/related-products.js";
36
+ export { default as rangeInput } from "./range-input/range-input.js";
37
+ export { default as rangeSlider } from "./range-slider/range-slider.js";
38
+ export { default as ratingMenu } from "./rating-menu/rating-menu.js";
39
+ export { default as refinementList } from "./refinement-list/refinement-list.js";
40
+ export { default as relevantSort } from "./relevant-sort/relevant-sort.js";
41
+ export { default as searchBox } from "./search-box/search-box.js";
42
+ export { default as sortBy } from "./sort-by/sort-by.js";
43
+ export { default as stats } from "./stats/stats.js";
44
+ export { default as toggleRefinement } from "./toggle-refinement/toggle-refinement.js";
45
+ export { default as trendingItems } from "./trending-items/trending-items.js";
46
+ export { default as voiceSearch } from "./voice-search/voice-search.js";
47
+ export { default as frequentlyBoughtTogether } from "./frequently-bought-together/frequently-bought-together.js";
48
+ export { default as lookingSimilar } from "./looking-similar/looking-similar.js";
49
+ export var chat = function chat() {
50
+ throw new Error("\"chat\" is not available from the UMD build.\n\nPlease use InstantSearch.js with a packaging system:\nhttps://www.algolia.com/doc/guides/building-search-ui/installation/js/#with-a-packaging-system");
51
+ };
@@ -105,6 +105,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
105
105
  init(initOptions: import("../../types").InitOptions): void;
106
106
  render(renderOptions: import("../../types").RenderOptions): void;
107
107
  getRenderState(renderState: {
108
+ [x: string]: unknown;
108
109
  answers?: import("../../types").WidgetRenderState<import("../../connectors/answers/connectAnswers").AnswersRenderState, import("../../connectors/answers/connectAnswers").AnswersConnectorParams> | undefined;
109
110
  autocomplete?: import("../../types").WidgetRenderState<import("../../connectors/autocomplete/connectAutocomplete").AutocompleteRenderState, import("../../connectors/autocomplete/connectAutocomplete").AutocompleteConnectorParams> | undefined;
110
111
  breadcrumb?: {
@@ -52,6 +52,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
52
52
  init(initOptions: import("../../types").InitOptions): void;
53
53
  render(renderOptions: import("../../types").RenderOptions): void;
54
54
  getRenderState(renderState: {
55
+ [x: string]: unknown;
55
56
  answers?: import("../../types").WidgetRenderState<import("../../connectors/answers/connectAnswers").AnswersRenderState, import("../../connectors/answers/connectAnswers").AnswersConnectorParams> | undefined;
56
57
  autocomplete?: import("../../types").WidgetRenderState<import("../../connectors/autocomplete/connectAutocomplete").AutocompleteRenderState, import("../../connectors/autocomplete/connectAutocomplete").AutocompleteConnectorParams> | undefined;
57
58
  breadcrumb?: {
@@ -96,6 +97,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
96
97
  analytics?: import("../../types").WidgetRenderState<Record<string, unknown>, import("../analytics/analytics").AnalyticsWidgetParams> | undefined;
97
98
  places?: import("../../types").WidgetRenderState<Record<string, unknown>, import("../places/places").PlacesWidgetParams> | undefined;
98
99
  }): {
100
+ [x: string]: unknown;
99
101
  answers?: import("../../types").WidgetRenderState<import("../../connectors/answers/connectAnswers").AnswersRenderState, import("../../connectors/answers/connectAnswers").AnswersConnectorParams> | undefined;
100
102
  autocomplete?: import("../../types").WidgetRenderState<import("../../connectors/autocomplete/connectAutocomplete").AutocompleteRenderState, import("../../connectors/autocomplete/connectAutocomplete").AutocompleteConnectorParams> | undefined;
101
103
  breadcrumb?: {
@@ -154,7 +156,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
154
156
  breadcrumb: {
155
157
  [rootAttribute: string]: import("../../types").WidgetRenderState<import("../../connectors/breadcrumb/connectBreadcrumb").BreadcrumbRenderState, import("../../connectors/breadcrumb/connectBreadcrumb").BreadcrumbConnectorParams>;
156
158
  };
157
- } & {
159
+ } & Record<string, unknown> & {
158
160
  clearRefinements: import("../../types").WidgetRenderState<import("../../connectors/clear-refinements/connectClearRefinements").ClearRefinementsRenderState, import("../../connectors/clear-refinements/connectClearRefinements").ClearRefinementsConnectorParams>;
159
161
  } & {
160
162
  configure: import("../../types").WidgetRenderState<import("../../connectors/configure/connectConfigure").ConfigureRenderState, import("../../connectors/configure/connectConfigure").ConfigureConnectorParams>;
@@ -52,6 +52,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
52
52
  init(initOptions: import("../../types").InitOptions): void;
53
53
  render(renderOptions: import("../../types").RenderOptions): void;
54
54
  getRenderState(renderState: {
55
+ [x: string]: unknown;
55
56
  answers?: import("../../types").WidgetRenderState<import("../../connectors/answers/connectAnswers").AnswersRenderState, import("../../connectors/answers/connectAnswers").AnswersConnectorParams> | undefined;
56
57
  autocomplete?: import("../../types").WidgetRenderState<import("../../connectors/autocomplete/connectAutocomplete").AutocompleteRenderState, import("../../connectors/autocomplete/connectAutocomplete").AutocompleteConnectorParams> | undefined;
57
58
  breadcrumb?: {
@@ -96,6 +97,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
96
97
  analytics?: import("../../types").WidgetRenderState<Record<string, unknown>, import("../analytics/analytics").AnalyticsWidgetParams> | undefined;
97
98
  places?: import("../../types").WidgetRenderState<Record<string, unknown>, import("../places/places").PlacesWidgetParams> | undefined;
98
99
  }): {
100
+ [x: string]: unknown;
99
101
  answers?: import("../../types").WidgetRenderState<import("../../connectors/answers/connectAnswers").AnswersRenderState, import("../../connectors/answers/connectAnswers").AnswersConnectorParams> | undefined;
100
102
  autocomplete?: import("../../types").WidgetRenderState<import("../../connectors/autocomplete/connectAutocomplete").AutocompleteRenderState, import("../../connectors/autocomplete/connectAutocomplete").AutocompleteConnectorParams> | undefined;
101
103
  breadcrumb?: {
@@ -154,7 +156,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
154
156
  breadcrumb: {
155
157
  [rootAttribute: string]: import("../../types").WidgetRenderState<import("../../connectors/breadcrumb/connectBreadcrumb").BreadcrumbRenderState, import("../../connectors/breadcrumb/connectBreadcrumb").BreadcrumbConnectorParams>;
156
158
  };
157
- } & {
159
+ } & Record<string, unknown> & {
158
160
  clearRefinements: import("../../types").WidgetRenderState<import("../../connectors/clear-refinements/connectClearRefinements").ClearRefinementsRenderState, import("../../connectors/clear-refinements/connectClearRefinements").ClearRefinementsConnectorParams>;
159
161
  } & {
160
162
  configure: import("../../types").WidgetRenderState<import("../../connectors/configure/connectConfigure").ConfigureRenderState, import("../../connectors/configure/connectConfigure").ConfigureConnectorParams>;
@@ -52,6 +52,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
52
52
  init(initOptions: import("../../types").InitOptions): void;
53
53
  render(renderOptions: import("../../types").RenderOptions): void;
54
54
  getRenderState(renderState: {
55
+ [x: string]: unknown;
55
56
  answers?: import("../../types").WidgetRenderState<import("../../connectors/answers/connectAnswers").AnswersRenderState, import("../../connectors/answers/connectAnswers").AnswersConnectorParams> | undefined;
56
57
  autocomplete?: import("../../types").WidgetRenderState<import("../../connectors/autocomplete/connectAutocomplete").AutocompleteRenderState, import("../../connectors/autocomplete/connectAutocomplete").AutocompleteConnectorParams> | undefined;
57
58
  breadcrumb?: {
@@ -96,6 +97,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
96
97
  analytics?: import("../../types").WidgetRenderState<Record<string, unknown>, import("../analytics/analytics").AnalyticsWidgetParams> | undefined;
97
98
  places?: import("../../types").WidgetRenderState<Record<string, unknown>, import("../places/places").PlacesWidgetParams> | undefined;
98
99
  }): {
100
+ [x: string]: unknown;
99
101
  answers?: import("../../types").WidgetRenderState<import("../../connectors/answers/connectAnswers").AnswersRenderState, import("../../connectors/answers/connectAnswers").AnswersConnectorParams> | undefined;
100
102
  autocomplete?: import("../../types").WidgetRenderState<import("../../connectors/autocomplete/connectAutocomplete").AutocompleteRenderState, import("../../connectors/autocomplete/connectAutocomplete").AutocompleteConnectorParams> | undefined;
101
103
  breadcrumb?: {
@@ -154,7 +156,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
154
156
  breadcrumb: {
155
157
  [rootAttribute: string]: import("../../types").WidgetRenderState<import("../../connectors/breadcrumb/connectBreadcrumb").BreadcrumbRenderState, import("../../connectors/breadcrumb/connectBreadcrumb").BreadcrumbConnectorParams>;
156
158
  };
157
- } & {
159
+ } & Record<string, unknown> & {
158
160
  clearRefinements: import("../../types").WidgetRenderState<import("../../connectors/clear-refinements/connectClearRefinements").ClearRefinementsRenderState, import("../../connectors/clear-refinements/connectClearRefinements").ClearRefinementsConnectorParams>;
159
161
  } & {
160
162
  configure: import("../../types").WidgetRenderState<import("../../connectors/configure/connectConfigure").ConfigureRenderState, import("../../connectors/configure/connectConfigure").ConfigureConnectorParams>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instantsearch.js",
3
- "version": "4.79.2",
3
+ "version": "4.81.0",
4
4
  "description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
5
5
  "homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
6
6
  "types": "es/index.d.ts",
@@ -31,13 +31,17 @@
31
31
  "@types/google.maps": "^3.55.12",
32
32
  "@types/hogan.js": "^3.0.0",
33
33
  "@types/qs": "^6.5.3",
34
+ "ai": "^5.0.18",
34
35
  "algoliasearch-helper": "3.26.0",
35
36
  "hogan.js": "^3.0.2",
36
37
  "htm": "^3.0.0",
37
- "instantsearch-ui-components": "0.11.2",
38
+ "instantsearch-ui-components": "0.12.0",
38
39
  "preact": "^10.10.0",
39
40
  "qs": "^6.5.1 < 6.10",
40
- "search-insights": "^2.17.2"
41
+ "react": ">= 0.14.0",
42
+ "search-insights": "^2.17.2",
43
+ "zod": "^3.25.76 || ^4",
44
+ "zod-to-json-schema": "3.24.6"
41
45
  },
42
46
  "peerDependencies": {
43
47
  "algoliasearch": ">= 3.1 < 6"
@@ -56,9 +60,9 @@
56
60
  "watch:es": "yarn --silent build:es:base --watch"
57
61
  },
58
62
  "devDependencies": {
59
- "@instantsearch/mocks": "1.77.0",
60
- "@instantsearch/tests": "1.77.0",
61
- "@instantsearch/testutils": "1.66.0",
63
+ "@instantsearch/mocks": "1.79.0",
64
+ "@instantsearch/tests": "1.79.0",
65
+ "@instantsearch/testutils": "1.68.0",
62
66
  "@storybook/html": "5.3.9",
63
67
  "@types/scriptjs": "0.0.2",
64
68
  "algoliasearch": "5.1.1",
@@ -66,5 +70,5 @@
66
70
  "scriptjs": "2.5.9",
67
71
  "webpack": "4.47.0"
68
72
  },
69
- "gitHead": "4170d7c9a3ee4adc729330a7cba90527aca2dbc5"
73
+ "gitHead": "7cc565086f06a9ec74155002c26596b68efc53bc"
70
74
  }