instantsearch.js 4.57.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 (40) hide show
  1. package/README.md +1 -2
  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 +44 -7
  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 +16 -5
  12. package/cjs/widgets/index/index.js +16 -7
  13. package/cjs/widgets/sort-by/sort-by.js +2 -1
  14. package/dist/instantsearch.development.d.ts +17 -3
  15. package/dist/instantsearch.development.js +125 -56
  16. package/dist/instantsearch.development.js.map +1 -1
  17. package/dist/instantsearch.production.d.ts +17 -3
  18. package/dist/instantsearch.production.min.d.ts +17 -3
  19. package/dist/instantsearch.production.min.js +2 -2
  20. package/dist/instantsearch.production.min.js.map +1 -1
  21. package/es/components/InternalHighlight/InternalHighlight.d.ts +1 -1
  22. package/es/components/Pagination/Pagination.js +4 -4
  23. package/es/components/RefinementList/RefinementList.js +2 -1
  24. package/es/components/SearchBox/SearchBox.d.ts +3 -0
  25. package/es/components/SearchBox/SearchBox.js +5 -2
  26. package/es/components/Selector/Selector.d.ts +2 -1
  27. package/es/components/Selector/Selector.js +4 -2
  28. package/es/components/Slider/Slider.js +3 -1
  29. package/es/lib/InstantSearch.d.ts +15 -0
  30. package/es/lib/InstantSearch.js +42 -6
  31. package/es/lib/utils/createSendEventForFacet.d.ts +1 -1
  32. package/es/lib/utils/createSendEventForFacet.js +12 -5
  33. package/es/lib/utils/createSendEventForHits.d.ts +2 -2
  34. package/es/lib/utils/createSendEventForHits.js +12 -6
  35. package/es/lib/version.d.ts +1 -1
  36. package/es/lib/version.js +1 -1
  37. package/es/middlewares/createInsightsMiddleware.js +16 -5
  38. package/es/widgets/index/index.js +16 -7
  39. package/es/widgets/sort-by/sort-by.js +2 -1
  40. package/package.json +8 -8
@@ -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
 
@@ -2363,6 +2363,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2363
2363
  indexName: string;
2364
2364
  insightsClient: InsightsClient | null;
2365
2365
  onStateChange: InstantSearchOptions<TUiState>['onStateChange'] | null;
2366
+ future: NonNullable<InstantSearchOptions<TUiState>['future']>;
2366
2367
  helper: AlgoliaSearchHelper | null;
2367
2368
  mainHelper: AlgoliaSearchHelper | null;
2368
2369
  mainIndex: IndexWidget;
@@ -2376,6 +2377,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2376
2377
  _createURL: CreateURL<TUiState>;
2377
2378
  _searchFunction?: InstantSearchOptions['searchFunction'];
2378
2379
  _mainHelperSearch?: AlgoliaSearchHelper['search'];
2380
+ _insights: InstantSearchOptions['insights'];
2379
2381
  middleware: Array<{
2380
2382
  creator: Middleware<TUiState>;
2381
2383
  instance: MiddlewareDefinition<TUiState>;
@@ -2604,6 +2606,18 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2604
2606
  * @deprecated This property will be still supported in 4.x releases, but not further. It is replaced by the `insights` middleware. For more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/
2605
2607
  */
2606
2608
  insightsClient?: InsightsClient;
2609
+ future?: {
2610
+ /**
2611
+ * Changes the way `dispose` is used in InstantSearch lifecycle.
2612
+ *
2613
+ * If `false` (by default), each widget unmounting will remove its state as well, even if there are multiple widgets reading that UI State.
2614
+ *
2615
+ * If `true`, each widget unmounting will only remove its own state if it's the last of its type. This allows for dynamically adding and removing widgets without losing their state.
2616
+ *
2617
+ * @default false
2618
+ */
2619
+ preserveSharedStateOnUnmount?: boolean;
2620
+ };
2607
2621
  };
2608
2622
 
2609
2623
  declare type InstantSearchStatus = 'idle' | 'loading' | 'stalled' | 'error';
@@ -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
 
@@ -2363,6 +2363,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2363
2363
  indexName: string;
2364
2364
  insightsClient: InsightsClient | null;
2365
2365
  onStateChange: InstantSearchOptions<TUiState>['onStateChange'] | null;
2366
+ future: NonNullable<InstantSearchOptions<TUiState>['future']>;
2366
2367
  helper: AlgoliaSearchHelper | null;
2367
2368
  mainHelper: AlgoliaSearchHelper | null;
2368
2369
  mainIndex: IndexWidget;
@@ -2376,6 +2377,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
2376
2377
  _createURL: CreateURL<TUiState>;
2377
2378
  _searchFunction?: InstantSearchOptions['searchFunction'];
2378
2379
  _mainHelperSearch?: AlgoliaSearchHelper['search'];
2380
+ _insights: InstantSearchOptions['insights'];
2379
2381
  middleware: Array<{
2380
2382
  creator: Middleware<TUiState>;
2381
2383
  instance: MiddlewareDefinition<TUiState>;
@@ -2604,6 +2606,18 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
2604
2606
  * @deprecated This property will be still supported in 4.x releases, but not further. It is replaced by the `insights` middleware. For more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/
2605
2607
  */
2606
2608
  insightsClient?: InsightsClient;
2609
+ future?: {
2610
+ /**
2611
+ * Changes the way `dispose` is used in InstantSearch lifecycle.
2612
+ *
2613
+ * If `false` (by default), each widget unmounting will remove its state as well, even if there are multiple widgets reading that UI State.
2614
+ *
2615
+ * If `true`, each widget unmounting will only remove its own state if it's the last of its type. This allows for dynamically adding and removing widgets without losing their state.
2616
+ *
2617
+ * @default false
2618
+ */
2619
+ preserveSharedStateOnUnmount?: boolean;
2620
+ };
2607
2621
  };
2608
2622
 
2609
2623
  declare type InstantSearchStatus = 'idle' | 'loading' | 'stalled' | 'error';