@searchcraft/react-sdk 0.9.5 → 0.9.7

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
@@ -46,6 +46,10 @@ export interface SearchcraftConfig {
46
46
  * The adm sub value.
47
47
  */
48
48
  admSub?: string;
49
+ /**
50
+ * The amount of debounce delay to add before calling the ad_container_rendered event
51
+ */
52
+ adContainerRenderedDebounceDelay?: number;
49
53
  /**
50
54
  * The number of custom ads to render at the start of the search results page.
51
55
  */
@@ -255,13 +259,14 @@ export type SearchParams = {
255
259
  rangeValueForIndexFields?: Record<string, RangeValueForIndexField>;
256
260
  };
257
261
  export interface SubscriptionEventMap {
258
- ad_container_rendered: AdContainerSubscriptionEvent;
262
+ ad_container_rendered: AdContainerRenderedSubscriptionEvent;
263
+ ad_container_viewed: AdContainerViewedSubscriptionEvent;
259
264
  query_fetched: QueryFetchedEvent;
260
265
  query_submitted: QuerySubmittedEvent;
261
266
  input_cleared: InputClearedEvent;
262
267
  no_results_returned: NoResultsReturnedEvent;
263
268
  }
264
- export interface AdContainerSubscriptionEvent extends SubscriptionEvent {
269
+ export interface AdContainerRenderedSubscriptionEvent extends SubscriptionEvent {
265
270
  name: "ad_container_rendered";
266
271
  data: {
267
272
  adContainerId: string;
@@ -269,6 +274,14 @@ export interface AdContainerSubscriptionEvent extends SubscriptionEvent {
269
274
  searchTerm: string;
270
275
  };
271
276
  }
277
+ export interface AdContainerViewedSubscriptionEvent extends SubscriptionEvent {
278
+ name: "ad_container_viewed";
279
+ data: {
280
+ adContainerId: string;
281
+ adSource: SearchcraftAdSource;
282
+ searchTerm: string;
283
+ };
284
+ }
272
285
  export interface QuerySubmittedEvent extends SubscriptionEvent {
273
286
  name: "query_submitted";
274
287
  data: {
@@ -403,6 +416,18 @@ declare class AdClient {
403
416
  onQuerySubmitted(_params: SearchParams): Promise<void>;
404
417
  onQueryFetched(_params: SearchParams, _response: SearchcraftResponse): Promise<void>;
405
418
  onInputCleared(): Promise<void>;
419
+ onAdContainerRendered(_data: {
420
+ adClientResponseItem?: AdClientResponseItem;
421
+ adContainerId: string;
422
+ adSource: SearchcraftAdSource;
423
+ searchTerm: string;
424
+ }): Promise<void>;
425
+ onAdContainerViewed(_data: {
426
+ adClientResponseItem?: AdClientResponseItem;
427
+ adContainerId: string;
428
+ adSource: SearchcraftAdSource;
429
+ searchTerm: string;
430
+ }): Promise<void>;
406
431
  }
407
432
  declare class MeasureClient {
408
433
  private measureRequestTimeout;
@@ -470,6 +495,15 @@ declare class SearchcraftCore {
470
495
  adSource: SearchcraftAdSource;
471
496
  searchTerm: string;
472
497
  }): void;
498
+ /**
499
+ * Called when a `<searchcraft-ad>` is viewed
500
+ */
501
+ handleAdContainerViewed(data: {
502
+ adClientResponseItem?: AdClientResponseItem;
503
+ adContainerId: string;
504
+ adSource: SearchcraftAdSource;
505
+ searchTerm: string;
506
+ }): void;
473
507
  /**
474
508
  * Perform various actions when the input is cleared
475
509
  */
@@ -1575,6 +1609,7 @@ declare namespace Components {
1575
1609
  */
1576
1610
  interface SearchcraftAd {
1577
1611
  "adClientResponseItem"?: AdClientResponseItem;
1612
+ "adContainerId": string;
1578
1613
  "adSource": SearchcraftAdSource;
1579
1614
  }
1580
1615
  /**
@@ -2490,6 +2525,7 @@ declare namespace LocalJSX {
2490
2525
  */
2491
2526
  interface SearchcraftAd {
2492
2527
  "adClientResponseItem"?: AdClientResponseItem;
2528
+ "adContainerId"?: string;
2493
2529
  "adSource"?: SearchcraftAdSource;
2494
2530
  }
2495
2531
  /**