@searchcraft/react-sdk 0.9.4 → 0.9.6

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
  /**
@@ -227,12 +255,14 @@ export type SearchParams = {
227
255
  rangeValueForIndexFields?: Record<string, RangeValueForIndexField>;
228
256
  };
229
257
  export interface SubscriptionEventMap {
230
- ad_container_rendered: AdContainerSubscriptionEvent;
258
+ ad_container_rendered: AdContainerRenderedSubscriptionEvent;
259
+ ad_container_viewed: AdContainerViewedSubscriptionEvent;
260
+ query_fetched: QueryFetchedEvent;
231
261
  query_submitted: QuerySubmittedEvent;
232
262
  input_cleared: InputClearedEvent;
233
263
  no_results_returned: NoResultsReturnedEvent;
234
264
  }
235
- export interface AdContainerSubscriptionEvent extends SubscriptionEvent {
265
+ export interface AdContainerRenderedSubscriptionEvent extends SubscriptionEvent {
236
266
  name: "ad_container_rendered";
237
267
  data: {
238
268
  adContainerId: string;
@@ -240,12 +270,26 @@ export interface AdContainerSubscriptionEvent extends SubscriptionEvent {
240
270
  searchTerm: string;
241
271
  };
242
272
  }
273
+ export interface AdContainerViewedSubscriptionEvent extends SubscriptionEvent {
274
+ name: "ad_container_viewed";
275
+ data: {
276
+ adContainerId: string;
277
+ adSource: SearchcraftAdSource;
278
+ searchTerm: string;
279
+ };
280
+ }
243
281
  export interface QuerySubmittedEvent extends SubscriptionEvent {
244
282
  name: "query_submitted";
245
283
  data: {
246
284
  searchTerm: string;
247
285
  };
248
286
  }
287
+ export interface QueryFetchedEvent extends SubscriptionEvent {
288
+ name: "query_fetched";
289
+ data: {
290
+ searchTerm: string;
291
+ };
292
+ }
249
293
  export interface InputClearedEvent extends SubscriptionEvent {
250
294
  name: "input_cleared";
251
295
  }
@@ -365,6 +409,21 @@ declare class AdClient {
365
409
  config: SearchcraftConfig;
366
410
  constructor(config: SearchcraftConfig);
367
411
  getAdsForSearchParams(_params: SearchParams): Promise<AdClientResponseItem[]>;
412
+ onQuerySubmitted(_params: SearchParams): Promise<void>;
413
+ onQueryFetched(_params: SearchParams, _response: SearchcraftResponse): Promise<void>;
414
+ onInputCleared(): Promise<void>;
415
+ onAdContainerRendered(_data: {
416
+ adClientResponseItem?: AdClientResponseItem;
417
+ adContainerId: string;
418
+ adSource: SearchcraftAdSource;
419
+ searchTerm: string;
420
+ }): Promise<void>;
421
+ onAdContainerViewed(_data: {
422
+ adClientResponseItem?: AdClientResponseItem;
423
+ adContainerId: string;
424
+ adSource: SearchcraftAdSource;
425
+ searchTerm: string;
426
+ }): Promise<void>;
368
427
  }
369
428
  declare class MeasureClient {
370
429
  private measureRequestTimeout;
@@ -423,6 +482,28 @@ declare class SearchcraftCore {
423
482
  private initClients;
424
483
  emitEvent<T extends SubscriptionEventName>(eventName: T, event: SubscriptionEventMap[T]): void;
425
484
  subscribe<T extends SubscriptionEventName>(eventName: T, callback: SubscriptionEventCallback<T>): UnsubscribeFunction;
485
+ /**
486
+ * Called when a `<searchcraft-ad>` component is rendered
487
+ */
488
+ handleAdContainerRendered(data: {
489
+ adClientResponseItem?: AdClientResponseItem;
490
+ adContainerId: string;
491
+ adSource: SearchcraftAdSource;
492
+ searchTerm: string;
493
+ }): void;
494
+ /**
495
+ * Called when a `<searchcraft-ad>` is viewed
496
+ */
497
+ handleAdContainerViewed(data: {
498
+ adClientResponseItem?: AdClientResponseItem;
499
+ adContainerId: string;
500
+ adSource: SearchcraftAdSource;
501
+ searchTerm: string;
502
+ }): void;
503
+ /**
504
+ * Perform various actions when the input is cleared
505
+ */
506
+ handleInputCleared(): void;
426
507
  /**
427
508
  * Gets items from the SearchClient and the AdClient.
428
509
  */
@@ -1749,10 +1830,6 @@ declare namespace Components {
1749
1830
  * The input element's placeholder value.
1750
1831
  */
1751
1832
  "placeholderValue": string;
1752
- /**
1753
- * The starting value of the input element.
1754
- */
1755
- "searchTerm": string;
1756
1833
  }
1757
1834
  /**
1758
1835
  * This web component serves as the input label for the searchcraft-input-form component.
@@ -2690,10 +2767,6 @@ declare namespace LocalJSX {
2690
2767
  * The input element's placeholder value.
2691
2768
  */
2692
2769
  "placeholderValue"?: string;
2693
- /**
2694
- * The starting value of the input element.
2695
- */
2696
- "searchTerm"?: string;
2697
2770
  }
2698
2771
  /**
2699
2772
  * This web component serves as the input label for the searchcraft-input-form component.