@searchcraft/react-sdk 0.9.4 → 0.9.5

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/dist/index.d.ts CHANGED
@@ -66,6 +66,34 @@ export interface SearchcraftConfig {
66
66
  * A callback function responsible for rendering the custom ad containers.
67
67
  */
68
68
  customAdTemplate?: CustomAdTemplateRenderFunction;
69
+ /**
70
+ * The placement id to use for Nativo ads.
71
+ */
72
+ nativoPlacementId?: number;
73
+ /**
74
+ * The class name for nativo ad containers.
75
+ */
76
+ nativoAdClassName?: string;
77
+ /**
78
+ * The number of custom ads to render at the start of the search results page.
79
+ */
80
+ nativoAdStartQuantity?: number;
81
+ /**
82
+ * The number of custom ads to render at the end of the search results page.
83
+ */
84
+ nativoAdEndQuantity?: number;
85
+ /**
86
+ * Renders a custom ad in between search results, at the specified interval.
87
+ */
88
+ nativoAdInterstitialInterval?: number;
89
+ /**
90
+ * Specify how many normal search results to render before rendering the first interstitial ad grouping.
91
+ */
92
+ nativoAdInterstialStartIndex?: number;
93
+ /**
94
+ * Specifies the number of ads to be rendered in each interstitial in between search results.
95
+ */
96
+ nativoAdInterstitialQuantity?: number;
69
97
  }
70
98
  export type SearchcraftAdSource = "adMarketplace" | "Nativo" | "Custom" | "None";
71
99
  /**
@@ -228,6 +256,7 @@ export type SearchParams = {
228
256
  };
229
257
  export interface SubscriptionEventMap {
230
258
  ad_container_rendered: AdContainerSubscriptionEvent;
259
+ query_fetched: QueryFetchedEvent;
231
260
  query_submitted: QuerySubmittedEvent;
232
261
  input_cleared: InputClearedEvent;
233
262
  no_results_returned: NoResultsReturnedEvent;
@@ -246,6 +275,12 @@ export interface QuerySubmittedEvent extends SubscriptionEvent {
246
275
  searchTerm: string;
247
276
  };
248
277
  }
278
+ export interface QueryFetchedEvent extends SubscriptionEvent {
279
+ name: "query_fetched";
280
+ data: {
281
+ searchTerm: string;
282
+ };
283
+ }
249
284
  export interface InputClearedEvent extends SubscriptionEvent {
250
285
  name: "input_cleared";
251
286
  }
@@ -365,6 +400,9 @@ declare class AdClient {
365
400
  config: SearchcraftConfig;
366
401
  constructor(config: SearchcraftConfig);
367
402
  getAdsForSearchParams(_params: SearchParams): Promise<AdClientResponseItem[]>;
403
+ onQuerySubmitted(_params: SearchParams): Promise<void>;
404
+ onQueryFetched(_params: SearchParams, _response: SearchcraftResponse): Promise<void>;
405
+ onInputCleared(): Promise<void>;
368
406
  }
369
407
  declare class MeasureClient {
370
408
  private measureRequestTimeout;
@@ -423,6 +461,19 @@ declare class SearchcraftCore {
423
461
  private initClients;
424
462
  emitEvent<T extends SubscriptionEventName>(eventName: T, event: SubscriptionEventMap[T]): void;
425
463
  subscribe<T extends SubscriptionEventName>(eventName: T, callback: SubscriptionEventCallback<T>): UnsubscribeFunction;
464
+ /**
465
+ * Called when a `<searchcraft-ad>` component is rendered
466
+ */
467
+ handleAdContainerRendered(data: {
468
+ adClientResponseItem?: AdClientResponseItem;
469
+ adContainerId: string;
470
+ adSource: SearchcraftAdSource;
471
+ searchTerm: string;
472
+ }): void;
473
+ /**
474
+ * Perform various actions when the input is cleared
475
+ */
476
+ handleInputCleared(): void;
426
477
  /**
427
478
  * Gets items from the SearchClient and the AdClient.
428
479
  */
@@ -1749,10 +1800,6 @@ declare namespace Components {
1749
1800
  * The input element's placeholder value.
1750
1801
  */
1751
1802
  "placeholderValue": string;
1752
- /**
1753
- * The starting value of the input element.
1754
- */
1755
- "searchTerm": string;
1756
1803
  }
1757
1804
  /**
1758
1805
  * This web component serves as the input label for the searchcraft-input-form component.
@@ -2690,10 +2737,6 @@ declare namespace LocalJSX {
2690
2737
  * The input element's placeholder value.
2691
2738
  */
2692
2739
  "placeholderValue"?: string;
2693
- /**
2694
- * The starting value of the input element.
2695
- */
2696
- "searchTerm"?: string;
2697
2740
  }
2698
2741
  /**
2699
2742
  * This web component serves as the input label for the searchcraft-input-form component.