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.
@@ -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,
@@ -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,