instantsearch.js 4.54.0 → 4.55.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 (104) hide show
  1. package/cjs/components/Hits/Hits.js +16 -7
  2. package/cjs/components/InfiniteHits/InfiniteHits.js +13 -2
  3. package/cjs/components/Pagination/Pagination.js +35 -17
  4. package/cjs/components/Template/Template.js +6 -3
  5. package/cjs/connectors/autocomplete/connectAutocomplete.js +1 -1
  6. package/cjs/connectors/geo-search/connectGeoSearch.js +1 -1
  7. package/cjs/connectors/hierarchical-menu/connectHierarchicalMenu.js +1 -1
  8. package/cjs/connectors/hits/connectHits.js +1 -1
  9. package/cjs/connectors/infinite-hits/connectInfiniteHits.js +39 -31
  10. package/cjs/connectors/menu/connectMenu.js +1 -1
  11. package/cjs/connectors/numeric-menu/connectNumericMenu.js +1 -1
  12. package/cjs/connectors/rating-menu/connectRatingMenu.js +7 -3
  13. package/cjs/connectors/refinement-list/connectRefinementList.js +1 -1
  14. package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +14 -4
  15. package/cjs/helpers/highlight.js +5 -0
  16. package/cjs/helpers/insights.js +3 -4
  17. package/cjs/helpers/reverseHighlight.js +5 -0
  18. package/cjs/helpers/reverseSnippet.js +5 -0
  19. package/cjs/helpers/snippet.js +5 -0
  20. package/cjs/lib/InstantSearch.js +18 -2
  21. package/cjs/lib/insights/listener.js +43 -36
  22. package/cjs/lib/routers/history.js +1 -0
  23. package/cjs/lib/server.js +60 -0
  24. package/cjs/lib/stateMappings/simple.js +1 -0
  25. package/cjs/lib/stateMappings/singleIndex.js +1 -0
  26. package/cjs/lib/utils/createSendEventForFacet.js +12 -2
  27. package/cjs/lib/utils/createSendEventForHits.js +34 -11
  28. package/cjs/lib/utils/index.js +11 -0
  29. package/cjs/lib/utils/walkIndex.js +18 -0
  30. package/cjs/lib/version.js +1 -1
  31. package/cjs/middlewares/createInsightsMiddleware.js +135 -33
  32. package/cjs/middlewares/createMetadataMiddleware.js +17 -5
  33. package/cjs/middlewares/createRouterMiddleware.js +5 -1
  34. package/cjs/widgets/hits/hits.js +1 -2
  35. package/cjs/widgets/infinite-hits/infinite-hits.js +1 -2
  36. package/cjs/widgets/pagination/pagination.js +51 -39
  37. package/cjs/widgets/panel/panel.js +0 -2
  38. package/dist/instantsearch.development.d.ts +94 -12
  39. package/dist/instantsearch.development.js +543 -312
  40. package/dist/instantsearch.development.js.map +1 -1
  41. package/dist/instantsearch.production.d.ts +94 -12
  42. package/dist/instantsearch.production.min.d.ts +94 -12
  43. package/dist/instantsearch.production.min.js +2 -2
  44. package/dist/instantsearch.production.min.js.map +1 -1
  45. package/es/components/Hits/Hits.d.ts +5 -5
  46. package/es/components/Hits/Hits.js +15 -5
  47. package/es/components/InfiniteHits/InfiniteHits.d.ts +3 -2
  48. package/es/components/InfiniteHits/InfiniteHits.js +13 -2
  49. package/es/components/Pagination/Pagination.js +34 -17
  50. package/es/components/Panel/Panel.d.ts +1 -1
  51. package/es/components/Template/Template.js +6 -3
  52. package/es/connectors/autocomplete/connectAutocomplete.js +1 -1
  53. package/es/connectors/geo-search/connectGeoSearch.js +1 -1
  54. package/es/connectors/hierarchical-menu/connectHierarchicalMenu.js +1 -1
  55. package/es/connectors/hits/connectHits.js +1 -1
  56. package/es/connectors/infinite-hits/connectInfiniteHits.js +39 -31
  57. package/es/connectors/menu/connectMenu.js +1 -1
  58. package/es/connectors/numeric-menu/connectNumericMenu.js +1 -1
  59. package/es/connectors/rating-menu/connectRatingMenu.js +7 -3
  60. package/es/connectors/refinement-list/connectRefinementList.js +1 -1
  61. package/es/connectors/toggle-refinement/connectToggleRefinement.js +13 -3
  62. package/es/helpers/highlight.d.ts +3 -0
  63. package/es/helpers/highlight.js +5 -0
  64. package/es/helpers/insights.d.ts +2 -1
  65. package/es/helpers/insights.js +3 -3
  66. package/es/helpers/reverseHighlight.d.ts +3 -0
  67. package/es/helpers/reverseHighlight.js +5 -0
  68. package/es/helpers/reverseSnippet.d.ts +3 -0
  69. package/es/helpers/reverseSnippet.js +5 -0
  70. package/es/helpers/snippet.d.ts +3 -0
  71. package/es/helpers/snippet.js +5 -0
  72. package/es/lib/InstantSearch.d.ts +11 -1
  73. package/es/lib/InstantSearch.js +18 -2
  74. package/es/lib/insights/listener.d.ts +10 -6
  75. package/es/lib/insights/listener.js +42 -36
  76. package/es/lib/routers/history.d.ts +1 -0
  77. package/es/lib/routers/history.js +1 -0
  78. package/es/lib/server.d.ts +10 -0
  79. package/es/lib/server.js +53 -0
  80. package/es/lib/stateMappings/simple.js +1 -0
  81. package/es/lib/stateMappings/singleIndex.js +1 -0
  82. package/es/lib/utils/createSendEventForFacet.js +12 -2
  83. package/es/lib/utils/createSendEventForHits.d.ts +8 -0
  84. package/es/lib/utils/createSendEventForHits.js +33 -11
  85. package/es/lib/utils/index.d.ts +1 -0
  86. package/es/lib/utils/index.js +1 -0
  87. package/es/lib/utils/walkIndex.d.ts +5 -0
  88. package/es/lib/utils/walkIndex.js +12 -0
  89. package/es/lib/version.d.ts +1 -1
  90. package/es/lib/version.js +1 -1
  91. package/es/middlewares/createInsightsMiddleware.d.ts +12 -12
  92. package/es/middlewares/createInsightsMiddleware.js +136 -34
  93. package/es/middlewares/createMetadataMiddleware.d.ts +3 -1
  94. package/es/middlewares/createMetadataMiddleware.js +17 -5
  95. package/es/middlewares/createRouterMiddleware.js +5 -1
  96. package/es/types/insights.d.ts +19 -1
  97. package/es/types/middleware.d.ts +16 -0
  98. package/es/types/router.d.ts +8 -0
  99. package/es/widgets/hits/hits.js +2 -3
  100. package/es/widgets/infinite-hits/infinite-hits.js +2 -3
  101. package/es/widgets/pagination/pagination.d.ts +12 -5
  102. package/es/widgets/pagination/pagination.js +51 -39
  103. package/es/widgets/panel/panel.js +0 -2
  104. package/package.json +6 -6
@@ -10,7 +10,7 @@ import type { HighlightProps as HighlightProps_3 } from '@algolia/ui-components-
10
10
  import type { HoganOptions } from 'hogan.js';
11
11
  import type { html } from 'htm/preact';
12
12
  import type { InsightsClient as InsightsClient_2 } from 'search-insights';
13
- import type { InsightsMethodMap } from 'search-insights';
13
+ import type { InsightsMethodMap as InsightsMethodMap_2 } from 'search-insights';
14
14
  import type * as Places from 'places.js';
15
15
  import type { PlainSearchParameters } from 'algoliasearch-helper';
16
16
  import { default as qs_2 } from 'qs';
@@ -438,6 +438,7 @@ declare type BreadcrumbWidgetParams = {
438
438
  };
439
439
 
440
440
  declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
441
+ $$type: string;
441
442
  /**
442
443
  * Transforms a UI state into a title for the page.
443
444
  */
@@ -901,7 +902,7 @@ declare function createInfiniteHitsSessionStorageCache(): InfiniteHitsCache;
901
902
 
902
903
  declare type CreateInsightsMiddleware = typeof createInsightsMiddleware;
903
904
 
904
- declare function createInsightsMiddleware<TInsightsClient extends null | InsightsClient>(props: InsightsProps<TInsightsClient>): InternalMiddleware;
905
+ declare function createInsightsMiddleware<TInsightsClient extends ProvidedInsightsClient>(props?: InsightsProps<TInsightsClient>): InternalMiddleware;
905
906
 
906
907
  /**
907
908
  * Exposes the metadata of mounted widgets in a custom
@@ -910,7 +911,9 @@ declare function createInsightsMiddleware<TInsightsClient extends null | Insight
910
911
  * - widget name
911
912
  * - connector name
912
913
  */
913
- declare function createMetadataMiddleware(): InternalMiddleware;
914
+ declare function createMetadataMiddleware({ $$internal, }?: {
915
+ $$internal?: boolean;
916
+ }): InternalMiddleware;
914
917
 
915
918
  declare const createRouterMiddleware: <TUiState extends UiState = UiState, TRouteState = TUiState>(props?: RouterProps<TUiState, TRouteState>) => InternalMiddleware<TUiState>;
916
919
 
@@ -1774,6 +1777,9 @@ declare type HierarchicalMenuWidgetParams = {
1774
1777
 
1775
1778
  declare function Highlight<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: HighlightProps<THit>): h.JSX.Element;
1776
1779
 
1780
+ /**
1781
+ * @deprecated use html tagged templates and the Highlight component instead
1782
+ */
1777
1783
  declare function highlight({ attribute, highlightedTagName, hit, cssClasses, }: HighlightOptions): string;
1778
1784
 
1779
1785
  declare type HighlightClassNames = HighlightClassNames_2;
@@ -2310,20 +2316,39 @@ declare type InsightsClientPayload = {
2310
2316
  positions?: number[];
2311
2317
  };
2312
2318
 
2313
- declare type InsightsEvent = {
2314
- insightsMethod?: InsightsClientMethod;
2315
- payload: any;
2319
+ declare type InsightsClientWithGlobals = InsightsClient & {
2320
+ shouldAddScript?: boolean;
2321
+ version?: string;
2322
+ };
2323
+
2324
+ declare type InsightsEvent<TMethod extends InsightsMethod = InsightsMethod> = InsightsEvent_2<TMethod>;
2325
+
2326
+ /**
2327
+ * The event sent to the insights middleware.
2328
+ */
2329
+ declare type InsightsEvent_2<TMethod extends InsightsMethod = InsightsMethod> = {
2330
+ insightsMethod?: TMethod;
2331
+ payload: InsightsMethodMap[TMethod][0];
2316
2332
  widgetType: string;
2317
2333
  eventType: string;
2334
+ eventModifier?: string;
2318
2335
  hits?: Hit[];
2319
2336
  attribute?: string;
2320
2337
  };
2321
2338
 
2322
- declare type InsightsProps<TInsightsClient extends null | InsightsClient = InsightsClient | null> = {
2323
- insightsClient: TInsightsClient;
2339
+ /**
2340
+ * Method allowed by the insights middleware.
2341
+ */
2342
+ declare type InsightsMethod = 'clickedObjectIDsAfterSearch' | 'clickedObjectIDs' | 'clickedFilters' | 'convertedObjectIDsAfterSearch' | 'convertedObjectIDs' | 'convertedFilters' | 'viewedObjectIDs' | 'viewedFilters';
2343
+
2344
+ declare type InsightsMethodMap = InsightsMethodMap_2;
2345
+
2346
+ declare type InsightsProps<TInsightsClient extends ProvidedInsightsClient = ProvidedInsightsClient> = {
2347
+ insightsClient?: TInsightsClient;
2324
2348
  insightsInitParams?: {
2325
2349
  userHasOptedOut?: boolean;
2326
2350
  useCookie?: boolean;
2351
+ anonymousUserToken?: boolean;
2327
2352
  cookieDuration?: number;
2328
2353
  region?: 'de' | 'us';
2329
2354
  };
@@ -2475,9 +2500,13 @@ declare type InstantSearchModule = {
2475
2500
  routers: typeof routers;
2476
2501
  stateMappings: typeof stateMappings;
2477
2502
  createInfiniteHitsSessionStorageCache: typeof createInfiniteHitsSessionStorageCache;
2503
+ /** @deprecated use html tagged templates and the Highlight component instead */
2478
2504
  highlight: typeof helpers.highlight;
2505
+ /** @deprecated use html tagged templates and the ReverseHighlight component instead */
2479
2506
  reverseHighlight: typeof helpers.reverseHighlight;
2507
+ /** @deprecated use html tagged templates and the Snippet component instead */
2480
2508
  snippet: typeof helpers.snippet;
2509
+ /** @deprecated use html tagged templates and the ReverseSnippet component instead */
2481
2510
  reverseSnippet: typeof helpers.reverseSnippet;
2482
2511
  /**
2483
2512
  * @deprecated use createInsightsMiddleware
@@ -2560,6 +2589,16 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2560
2589
  * client side persistence. Passing `true` will use the default URL options.
2561
2590
  */
2562
2591
  routing?: RouterProps<TUiState, TRouteState> | boolean;
2592
+ /**
2593
+ * Enables the Insights middleware and loads the Insights library
2594
+ * if not already loaded.
2595
+ *
2596
+ * The Insights middleware sends view and click events automatically, and lets
2597
+ * you set up your own events.
2598
+ *
2599
+ * @default false
2600
+ */
2601
+ insights?: InsightsProps | boolean;
2563
2602
  /**
2564
2603
  * the instance of search-insights to use for sending insights events inside
2565
2604
  * widgets like `hits`.
@@ -2832,11 +2871,27 @@ declare type MenuWidgetParams = {
2832
2871
  declare type Middleware = (options: MiddlewareOptions) => AtLeastOne<MiddlewareDefinition>;
2833
2872
 
2834
2873
  declare type MiddlewareDefinition<TUiState extends UiState = UiState> = {
2874
+ /**
2875
+ * string to identify the middleware
2876
+ */
2877
+ $$type: string;
2878
+ /**
2879
+ * Change handler called on every UiState change
2880
+ */
2835
2881
  onStateChange(options: {
2836
2882
  uiState: TUiState;
2837
2883
  }): void;
2884
+ /**
2885
+ * Called when the middleware is added to InstantSearch
2886
+ */
2838
2887
  subscribe(): void;
2888
+ /**
2889
+ * Called when InstantSearch is started
2890
+ */
2839
2891
  started(): void;
2892
+ /**
2893
+ * Called when the middleware is removed from InstantSearch
2894
+ */
2840
2895
  unsubscribe(): void;
2841
2896
  };
2842
2897
 
@@ -2849,6 +2904,7 @@ declare namespace middlewares {
2849
2904
  createInsightsMiddleware,
2850
2905
  InsightsEvent,
2851
2906
  InsightsProps,
2907
+ InsightsClientWithGlobals,
2852
2908
  CreateInsightsMiddleware,
2853
2909
  RouterProps,
2854
2910
  createRouterMiddleware,
@@ -3140,19 +3196,26 @@ declare type PaginationTemplates = Partial<{
3140
3196
  /**
3141
3197
  * Label for the Previous link.
3142
3198
  */
3143
- previous: string;
3199
+ previous: Template;
3144
3200
  /**
3145
3201
  * Label for the Next link.
3146
3202
  */
3147
- next: string;
3203
+ next: Template;
3204
+ /**
3205
+ * Label for the link of a certain page
3206
+ * Page is one-based, so `page` will be `1` for the first page.
3207
+ */
3208
+ page: Template<{
3209
+ page: number;
3210
+ }>;
3148
3211
  /**
3149
3212
  * Label for the First link.
3150
3213
  */
3151
- first: string;
3214
+ first: Template;
3152
3215
  /**
3153
3216
  * Label for the Last link.
3154
3217
  */
3155
- last: string;
3218
+ last: Template;
3156
3219
  }>;
3157
3220
 
3158
3221
  declare type PaginationWidget = WidgetFactory<PaginationWidgetDescription & {
@@ -3417,6 +3480,8 @@ declare type PoweredByWidgetParams = {
3417
3480
  cssClasses?: PoweredByCSSClasses;
3418
3481
  };
3419
3482
 
3483
+ declare type ProvidedInsightsClient = InsightsClient | null | undefined;
3484
+
3420
3485
  declare const queryRuleContext: QueryRuleContextWidget;
3421
3486
 
3422
3487
  declare type QueryRuleContextWidget = WidgetFactory<QueryRulesWidgetDescription & {
@@ -4459,6 +4524,9 @@ declare type RequiredWidgetType<TWidgetDescription extends WidgetDescription> =
4459
4524
 
4460
4525
  declare function ReverseHighlight<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: ReverseHighlightProps<THit>): h.JSX.Element;
4461
4526
 
4527
+ /**
4528
+ * @deprecated use html tagged templates and the ReverseHighlight component instead
4529
+ */
4462
4530
  declare function reverseHighlight({ attribute, highlightedTagName, hit, cssClasses, }: ReverseHighlightOptions): string;
4463
4531
 
4464
4532
  declare type ReverseHighlightClassNames = HighlightClassNames_2;
@@ -4484,6 +4552,9 @@ declare type ReverseHighlightProps_2 = Omit<HighlightProps_3, 'classNames'> & {
4484
4552
 
4485
4553
  declare function ReverseSnippet<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: ReverseSnippetProps<THit>): h.JSX.Element;
4486
4554
 
4555
+ /**
4556
+ * @deprecated use html tagged templates and the ReverseSnippet component instead
4557
+ */
4487
4558
  declare function reverseSnippet({ attribute, highlightedTagName, hit, cssClasses, }: ReverseSnippetOptions): string;
4488
4559
 
4489
4560
  declare type ReverseSnippetClassNames = HighlightClassNames_2;
@@ -4542,6 +4613,10 @@ declare type Router<TRouteState = UiState> = {
4542
4613
  * Called when InstantSearch is started.
4543
4614
  */
4544
4615
  start?: () => void;
4616
+ /**
4617
+ * Identifier for this router. Used to differentiate between routers.
4618
+ */
4619
+ $$type?: string;
4545
4620
  };
4546
4621
 
4547
4622
  declare type RouterProps<TUiState extends UiState = UiState, TRouteState = TUiState> = {
@@ -4770,6 +4845,9 @@ declare function singleIndexStateMapping<TUiState extends UiState = UiState>(ind
4770
4845
 
4771
4846
  declare function Snippet<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: SnippetProps<THit>): h.JSX.Element;
4772
4847
 
4848
+ /**
4849
+ * @deprecated use html tagged templates and the Snippet component instead
4850
+ */
4773
4851
  declare function snippet({ attribute, highlightedTagName, hit, cssClasses, }: SnippetOptions): string;
4774
4852
 
4775
4853
  declare type SnippetClassNames = HighlightClassNames_2;
@@ -4970,6 +5048,10 @@ declare type StateMapping<TUiState = UiState, TRouteState = TUiState> = {
4970
5048
  * The format is the output of `stateToRoute`.
4971
5049
  */
4972
5050
  routeToState(routeState: TRouteState): TUiState;
5051
+ /**
5052
+ * Identifier for this stateMapping. Used to differentiate between stateMappings.
5053
+ */
5054
+ $$type?: string;
4973
5055
  };
4974
5056
 
4975
5057
  declare namespace stateMappings {
@@ -10,7 +10,7 @@ import type { HighlightProps as HighlightProps_3 } from '@algolia/ui-components-
10
10
  import type { HoganOptions } from 'hogan.js';
11
11
  import type { html } from 'htm/preact';
12
12
  import type { InsightsClient as InsightsClient_2 } from 'search-insights';
13
- import type { InsightsMethodMap } from 'search-insights';
13
+ import type { InsightsMethodMap as InsightsMethodMap_2 } from 'search-insights';
14
14
  import type * as Places from 'places.js';
15
15
  import type { PlainSearchParameters } from 'algoliasearch-helper';
16
16
  import { default as qs_2 } from 'qs';
@@ -438,6 +438,7 @@ declare type BreadcrumbWidgetParams = {
438
438
  };
439
439
 
440
440
  declare class BrowserHistory<TRouteState> implements Router<TRouteState> {
441
+ $$type: string;
441
442
  /**
442
443
  * Transforms a UI state into a title for the page.
443
444
  */
@@ -901,7 +902,7 @@ declare function createInfiniteHitsSessionStorageCache(): InfiniteHitsCache;
901
902
 
902
903
  declare type CreateInsightsMiddleware = typeof createInsightsMiddleware;
903
904
 
904
- declare function createInsightsMiddleware<TInsightsClient extends null | InsightsClient>(props: InsightsProps<TInsightsClient>): InternalMiddleware;
905
+ declare function createInsightsMiddleware<TInsightsClient extends ProvidedInsightsClient>(props?: InsightsProps<TInsightsClient>): InternalMiddleware;
905
906
 
906
907
  /**
907
908
  * Exposes the metadata of mounted widgets in a custom
@@ -910,7 +911,9 @@ declare function createInsightsMiddleware<TInsightsClient extends null | Insight
910
911
  * - widget name
911
912
  * - connector name
912
913
  */
913
- declare function createMetadataMiddleware(): InternalMiddleware;
914
+ declare function createMetadataMiddleware({ $$internal, }?: {
915
+ $$internal?: boolean;
916
+ }): InternalMiddleware;
914
917
 
915
918
  declare const createRouterMiddleware: <TUiState extends UiState = UiState, TRouteState = TUiState>(props?: RouterProps<TUiState, TRouteState>) => InternalMiddleware<TUiState>;
916
919
 
@@ -1774,6 +1777,9 @@ declare type HierarchicalMenuWidgetParams = {
1774
1777
 
1775
1778
  declare function Highlight<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: HighlightProps<THit>): h.JSX.Element;
1776
1779
 
1780
+ /**
1781
+ * @deprecated use html tagged templates and the Highlight component instead
1782
+ */
1777
1783
  declare function highlight({ attribute, highlightedTagName, hit, cssClasses, }: HighlightOptions): string;
1778
1784
 
1779
1785
  declare type HighlightClassNames = HighlightClassNames_2;
@@ -2310,20 +2316,39 @@ declare type InsightsClientPayload = {
2310
2316
  positions?: number[];
2311
2317
  };
2312
2318
 
2313
- declare type InsightsEvent = {
2314
- insightsMethod?: InsightsClientMethod;
2315
- payload: any;
2319
+ declare type InsightsClientWithGlobals = InsightsClient & {
2320
+ shouldAddScript?: boolean;
2321
+ version?: string;
2322
+ };
2323
+
2324
+ declare type InsightsEvent<TMethod extends InsightsMethod = InsightsMethod> = InsightsEvent_2<TMethod>;
2325
+
2326
+ /**
2327
+ * The event sent to the insights middleware.
2328
+ */
2329
+ declare type InsightsEvent_2<TMethod extends InsightsMethod = InsightsMethod> = {
2330
+ insightsMethod?: TMethod;
2331
+ payload: InsightsMethodMap[TMethod][0];
2316
2332
  widgetType: string;
2317
2333
  eventType: string;
2334
+ eventModifier?: string;
2318
2335
  hits?: Hit[];
2319
2336
  attribute?: string;
2320
2337
  };
2321
2338
 
2322
- declare type InsightsProps<TInsightsClient extends null | InsightsClient = InsightsClient | null> = {
2323
- insightsClient: TInsightsClient;
2339
+ /**
2340
+ * Method allowed by the insights middleware.
2341
+ */
2342
+ declare type InsightsMethod = 'clickedObjectIDsAfterSearch' | 'clickedObjectIDs' | 'clickedFilters' | 'convertedObjectIDsAfterSearch' | 'convertedObjectIDs' | 'convertedFilters' | 'viewedObjectIDs' | 'viewedFilters';
2343
+
2344
+ declare type InsightsMethodMap = InsightsMethodMap_2;
2345
+
2346
+ declare type InsightsProps<TInsightsClient extends ProvidedInsightsClient = ProvidedInsightsClient> = {
2347
+ insightsClient?: TInsightsClient;
2324
2348
  insightsInitParams?: {
2325
2349
  userHasOptedOut?: boolean;
2326
2350
  useCookie?: boolean;
2351
+ anonymousUserToken?: boolean;
2327
2352
  cookieDuration?: number;
2328
2353
  region?: 'de' | 'us';
2329
2354
  };
@@ -2475,9 +2500,13 @@ declare type InstantSearchModule = {
2475
2500
  routers: typeof routers;
2476
2501
  stateMappings: typeof stateMappings;
2477
2502
  createInfiniteHitsSessionStorageCache: typeof createInfiniteHitsSessionStorageCache;
2503
+ /** @deprecated use html tagged templates and the Highlight component instead */
2478
2504
  highlight: typeof helpers.highlight;
2505
+ /** @deprecated use html tagged templates and the ReverseHighlight component instead */
2479
2506
  reverseHighlight: typeof helpers.reverseHighlight;
2507
+ /** @deprecated use html tagged templates and the Snippet component instead */
2480
2508
  snippet: typeof helpers.snippet;
2509
+ /** @deprecated use html tagged templates and the ReverseSnippet component instead */
2481
2510
  reverseSnippet: typeof helpers.reverseSnippet;
2482
2511
  /**
2483
2512
  * @deprecated use createInsightsMiddleware
@@ -2560,6 +2589,16 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2560
2589
  * client side persistence. Passing `true` will use the default URL options.
2561
2590
  */
2562
2591
  routing?: RouterProps<TUiState, TRouteState> | boolean;
2592
+ /**
2593
+ * Enables the Insights middleware and loads the Insights library
2594
+ * if not already loaded.
2595
+ *
2596
+ * The Insights middleware sends view and click events automatically, and lets
2597
+ * you set up your own events.
2598
+ *
2599
+ * @default false
2600
+ */
2601
+ insights?: InsightsProps | boolean;
2563
2602
  /**
2564
2603
  * the instance of search-insights to use for sending insights events inside
2565
2604
  * widgets like `hits`.
@@ -2832,11 +2871,27 @@ declare type MenuWidgetParams = {
2832
2871
  declare type Middleware = (options: MiddlewareOptions) => AtLeastOne<MiddlewareDefinition>;
2833
2872
 
2834
2873
  declare type MiddlewareDefinition<TUiState extends UiState = UiState> = {
2874
+ /**
2875
+ * string to identify the middleware
2876
+ */
2877
+ $$type: string;
2878
+ /**
2879
+ * Change handler called on every UiState change
2880
+ */
2835
2881
  onStateChange(options: {
2836
2882
  uiState: TUiState;
2837
2883
  }): void;
2884
+ /**
2885
+ * Called when the middleware is added to InstantSearch
2886
+ */
2838
2887
  subscribe(): void;
2888
+ /**
2889
+ * Called when InstantSearch is started
2890
+ */
2839
2891
  started(): void;
2892
+ /**
2893
+ * Called when the middleware is removed from InstantSearch
2894
+ */
2840
2895
  unsubscribe(): void;
2841
2896
  };
2842
2897
 
@@ -2849,6 +2904,7 @@ declare namespace middlewares {
2849
2904
  createInsightsMiddleware,
2850
2905
  InsightsEvent,
2851
2906
  InsightsProps,
2907
+ InsightsClientWithGlobals,
2852
2908
  CreateInsightsMiddleware,
2853
2909
  RouterProps,
2854
2910
  createRouterMiddleware,
@@ -3140,19 +3196,26 @@ declare type PaginationTemplates = Partial<{
3140
3196
  /**
3141
3197
  * Label for the Previous link.
3142
3198
  */
3143
- previous: string;
3199
+ previous: Template;
3144
3200
  /**
3145
3201
  * Label for the Next link.
3146
3202
  */
3147
- next: string;
3203
+ next: Template;
3204
+ /**
3205
+ * Label for the link of a certain page
3206
+ * Page is one-based, so `page` will be `1` for the first page.
3207
+ */
3208
+ page: Template<{
3209
+ page: number;
3210
+ }>;
3148
3211
  /**
3149
3212
  * Label for the First link.
3150
3213
  */
3151
- first: string;
3214
+ first: Template;
3152
3215
  /**
3153
3216
  * Label for the Last link.
3154
3217
  */
3155
- last: string;
3218
+ last: Template;
3156
3219
  }>;
3157
3220
 
3158
3221
  declare type PaginationWidget = WidgetFactory<PaginationWidgetDescription & {
@@ -3417,6 +3480,8 @@ declare type PoweredByWidgetParams = {
3417
3480
  cssClasses?: PoweredByCSSClasses;
3418
3481
  };
3419
3482
 
3483
+ declare type ProvidedInsightsClient = InsightsClient | null | undefined;
3484
+
3420
3485
  declare const queryRuleContext: QueryRuleContextWidget;
3421
3486
 
3422
3487
  declare type QueryRuleContextWidget = WidgetFactory<QueryRulesWidgetDescription & {
@@ -4459,6 +4524,9 @@ declare type RequiredWidgetType<TWidgetDescription extends WidgetDescription> =
4459
4524
 
4460
4525
  declare function ReverseHighlight<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: ReverseHighlightProps<THit>): h.JSX.Element;
4461
4526
 
4527
+ /**
4528
+ * @deprecated use html tagged templates and the ReverseHighlight component instead
4529
+ */
4462
4530
  declare function reverseHighlight({ attribute, highlightedTagName, hit, cssClasses, }: ReverseHighlightOptions): string;
4463
4531
 
4464
4532
  declare type ReverseHighlightClassNames = HighlightClassNames_2;
@@ -4484,6 +4552,9 @@ declare type ReverseHighlightProps_2 = Omit<HighlightProps_3, 'classNames'> & {
4484
4552
 
4485
4553
  declare function ReverseSnippet<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: ReverseSnippetProps<THit>): h.JSX.Element;
4486
4554
 
4555
+ /**
4556
+ * @deprecated use html tagged templates and the ReverseSnippet component instead
4557
+ */
4487
4558
  declare function reverseSnippet({ attribute, highlightedTagName, hit, cssClasses, }: ReverseSnippetOptions): string;
4488
4559
 
4489
4560
  declare type ReverseSnippetClassNames = HighlightClassNames_2;
@@ -4542,6 +4613,10 @@ declare type Router<TRouteState = UiState> = {
4542
4613
  * Called when InstantSearch is started.
4543
4614
  */
4544
4615
  start?: () => void;
4616
+ /**
4617
+ * Identifier for this router. Used to differentiate between routers.
4618
+ */
4619
+ $$type?: string;
4545
4620
  };
4546
4621
 
4547
4622
  declare type RouterProps<TUiState extends UiState = UiState, TRouteState = TUiState> = {
@@ -4770,6 +4845,9 @@ declare function singleIndexStateMapping<TUiState extends UiState = UiState>(ind
4770
4845
 
4771
4846
  declare function Snippet<THit extends Hit<BaseHit>>({ hit, attribute, cssClasses, ...props }: SnippetProps<THit>): h.JSX.Element;
4772
4847
 
4848
+ /**
4849
+ * @deprecated use html tagged templates and the Snippet component instead
4850
+ */
4773
4851
  declare function snippet({ attribute, highlightedTagName, hit, cssClasses, }: SnippetOptions): string;
4774
4852
 
4775
4853
  declare type SnippetClassNames = HighlightClassNames_2;
@@ -4970,6 +5048,10 @@ declare type StateMapping<TUiState = UiState, TRouteState = TUiState> = {
4970
5048
  * The format is the output of `stateToRoute`.
4971
5049
  */
4972
5050
  routeToState(routeState: TRouteState): TUiState;
5051
+ /**
5052
+ * Identifier for this stateMapping. Used to differentiate between stateMappings.
5053
+ */
5054
+ $$type?: string;
4973
5055
  };
4974
5056
 
4975
5057
  declare namespace stateMappings {