@searchcraft/vue-sdk 0.10.2 → 0.10.4

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
@@ -117,6 +117,7 @@ export interface ExactMatchToggleFilterItem extends FilterItem {
117
117
  };
118
118
  }
119
119
  export interface MostRecentToggleFilterItem extends FilterItem {
120
+ fieldName: string;
120
121
  type: "mostRecentToggle";
121
122
  options: {
122
123
  subLabel?: string;
@@ -125,6 +126,7 @@ export interface MostRecentToggleFilterItem extends FilterItem {
125
126
  export type TemplateHtml = (strings: TemplateStringsArray, ...values: (string | number | undefined)[]) => string;
126
127
  export type SearchResultTemplate<T> = (data: T, index: number, utils: {
127
128
  html: TemplateHtml;
129
+ source_index?: string;
128
130
  }) => string;
129
131
  export type SearchResultTemplateData = any;
130
132
  export type ResultsInfoTemplate = (data: {
@@ -148,6 +150,9 @@ export type PopoverButtonTemplate = (data: {
148
150
  }, utils: {
149
151
  html: TemplateHtml;
150
152
  }) => string;
153
+ export type ADMAdTemplate = (data: ADMAd, utils: {
154
+ html: TemplateHtml;
155
+ }) => string;
151
156
  /**
152
157
  * The SearchcraftConfig object is used to initialize Searchcraft in your application.
153
158
  */
@@ -176,10 +181,6 @@ export interface SearchcraftConfig {
176
181
  * The maximum number of results to return per page.
177
182
  */
178
183
  searchResultsPerPage?: number;
179
- /**
180
- * The name of the field to use for `order_by` when sorting.
181
- */
182
- indexFieldName?: string;
183
184
  /**
184
185
  * Name of the ad source to use.
185
186
  */
@@ -200,6 +201,10 @@ export interface SearchcraftConfig {
200
201
  * The amount of debounce delay to add before calling the ad_container_rendered event
201
202
  */
202
203
  adContainerRenderedDebounceDelay?: number;
204
+ /**
205
+ * A callback function responsible for rendering the ADM ad containers.
206
+ */
207
+ admAdTemplate?: ADMAdTemplate;
203
208
  /**
204
209
  * The number of custom ads to render at the start of the search results page.
205
210
  */
@@ -261,6 +266,17 @@ export interface AdClientResponseItem {
261
266
  id: string;
262
267
  adSource: SearchcraftAdSource;
263
268
  }
269
+ export interface ADMAd {
270
+ adv_id: number;
271
+ adv_name: string;
272
+ click_url?: string;
273
+ image_url?: string;
274
+ impression_url?: string;
275
+ price?: number;
276
+ price_currency?: string;
277
+ sale_price?: number;
278
+ term: string;
279
+ }
264
280
  /**
265
281
  * A Facet object returned in a search response.
266
282
  */
@@ -339,7 +355,7 @@ export interface SearchClientRequestProperties {
339
355
  * The field to order the results by (e.g., 'date_published', 'title', etc.).
340
356
  * Optional parameter.
341
357
  */
342
- order_by?: string;
358
+ order_by?: string | null;
343
359
  /**
344
360
  * The search term provided by the user.
345
361
  */
@@ -348,7 +364,7 @@ export interface SearchClientRequestProperties {
348
364
  * The sort order, which can be either 'asc' or 'desc'.
349
365
  * Optional parameter.
350
366
  */
351
- sort?: "asc" | "desc";
367
+ sort?: "asc" | "desc" | null;
352
368
  /**
353
369
  * The facet path value(s) specified by the `facets` filter items that the `searchcraft-filter-panel` renders.
354
370
  * There may be multiple rendered within a single filter panel.
@@ -398,6 +414,7 @@ export interface SearchIndexHit {
398
414
  doc?: SearchDocument;
399
415
  document_id?: string;
400
416
  score?: number;
417
+ source_index?: string;
401
418
  }
402
419
  /**
403
420
  * Data document returned within a SearchResult.
@@ -409,6 +426,7 @@ export interface SearchDocument extends Record<string, string | number> {
409
426
  export interface SearchClientResponseItem {
410
427
  id: string;
411
428
  document: SearchDocument;
429
+ source_index?: string;
412
430
  }
413
431
  export interface SubscriptionEventMap {
414
432
  ad_container_rendered: AdContainerRenderedSubscriptionEvent;
@@ -488,7 +506,7 @@ declare class MeasureClient {
488
506
  private config;
489
507
  private sdkInfo;
490
508
  private userId;
491
- private sessionId;
509
+ sessionId: string;
492
510
  constructor(config: SearchcraftConfig, sdkInfo: SearchcraftSDKInfo, userId: string);
493
511
  /**
494
512
  * Getter for the base url used by the /measure endpoints.
@@ -600,7 +618,10 @@ export interface SearchcraftStateFunctions {
600
618
  setSearchResultsPerPage: (perPage: number) => void;
601
619
  setSearchTerm: (searchTerm: string) => void;
602
620
  setSearchMode: (mode: "fuzzy" | "exact") => void;
603
- setSortType: (type: "asc" | "desc") => void;
621
+ setSortOrder: (props: {
622
+ orderByField: string | null;
623
+ sortType: "asc" | "desc" | null;
624
+ }) => void;
604
625
  setHotKeyAndHotKeyModifier: (hotkey?: string, hotkeyModifier?: "ctrl" | "meta" | "alt" | "option") => void;
605
626
  }
606
627
  /**
@@ -621,12 +642,13 @@ export interface SearchcraftStateValues {
621
642
  searchMode: "fuzzy" | "exact";
622
643
  searchClientResponseItems: SearchClientResponseItem[];
623
644
  searchResponseTimeTaken: number | undefined;
624
- searchResponseFacetPrime: FacetPrime | undefined;
645
+ searchResponseFacetPrime: FacetPrime | undefined | null;
625
646
  searchResultsCount: number;
626
647
  searchResultsPage: number;
627
648
  searchResultsPerPage: number;
628
649
  searchTerm: string;
629
- sortType: "asc" | "desc";
650
+ orderByField: string | undefined | null;
651
+ sortType: "asc" | "desc" | undefined | null;
630
652
  afterInit: (state: SearchcraftState) => void;
631
653
  }
632
654
  export interface SearchcraftState extends SearchcraftStateFunctions, SearchcraftStateValues {