@searchcraft/vue-sdk 0.10.4 → 0.10.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
@@ -277,21 +277,33 @@ export interface ADMAd {
277
277
  sale_price?: number;
278
278
  term: string;
279
279
  }
280
+ export type Facet = {
281
+ /**
282
+ * The path of the facet. The path represents where in the facet tree structure
283
+ * this facet exists. There is an arbitrary number of levels in a facet tree.
284
+ *
285
+ * @example
286
+ *
287
+ * '/sports/college' - Represents that this is the facet node exists at [root] -> [sports] -> [college] in the facet tree.
288
+ * '/weather' - Represents that this facet exists at [root] -> [weather] in the facet tree
289
+ * '/news/local' - [root] -> [news] -> [local]
290
+ */
291
+ path: string;
292
+ /**
293
+ * The count value just represents an arbitrary `count` metadata for this facet node.
294
+ */
295
+ count: number;
296
+ };
297
+ export type FacetWithChildrenArray = Facet & {
298
+ children: FacetWithChildrenArray[] | null | undefined;
299
+ };
280
300
  /**
281
301
  * A Facet object returned in a search response.
282
302
  */
283
303
  export type FacetRoot = {
284
- [key: string]: FacetChild[];
304
+ [key: string]: FacetWithChildrenArray[];
285
305
  };
286
306
  export type FacetPrime = FacetRoot[];
287
- /**
288
- * Represents the structure of facets, which group search results into categories.
289
- */
290
- export interface FacetChild {
291
- count: number;
292
- path: string;
293
- children?: FacetChild[];
294
- }
295
307
  /**
296
308
  * Types of measure requests that can be sent to the /measure/event endpoint.
297
309
  */
@@ -530,6 +542,7 @@ declare class SearchClient {
530
542
  private userId;
531
543
  private parent;
532
544
  private searchCompletedEventTimeout;
545
+ private abortController;
533
546
  constructor(parent: SearchcraftCore, config: SearchcraftConfig, userId: string);
534
547
  /**
535
548
  * Getter for the base url used by the /search endpoint.
@@ -538,9 +551,10 @@ declare class SearchClient {
538
551
  /**
539
552
  * Make the request to get the search results.
540
553
  * @param {properties} properties - The properties for the search.
554
+ * @param sendTelemetry - Whether or not to emit measure and subscription events for this search.
541
555
  * @returns
542
556
  */
543
- getSearchResponseItems: (properties: SearchClientRequestProperties | string) => Promise<SearchcraftResponse>;
557
+ getSearchResponseItems: (properties: SearchClientRequestProperties | string, sendTelemetry?: boolean) => Promise<SearchcraftResponse>;
544
558
  private handleGetSearchResponseItemsWithString;
545
559
  private handleGetSearchResponseItemsWithObject;
546
560
  /**
@@ -592,7 +606,7 @@ export declare class SearchcraftCore {
592
606
  * Perform various actions when the input is cleared
593
607
  */
594
608
  handleInputCleared(): void;
595
- getResponseItems: (properties: SearchClientRequestProperties | string, searchCallback: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void, adCallback: (items: AdClientResponseItem[]) => void) => void;
609
+ getResponseItems: (properties: SearchClientRequestProperties | string, searchCallback: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[], supplementalResponse: SearchcraftResponse | undefined) => void, adCallback: (items: AdClientResponseItem[]) => void) => void;
596
610
  }
597
611
  /**
598
612
  * Callable functions made available by the SearchcraftStore.
@@ -608,8 +622,8 @@ export interface SearchcraftStateFunctions {
608
622
  search: () => Promise<void>;
609
623
  set: (state: Partial<SearchcraftState> | ((state: SearchcraftState) => Partial<SearchcraftState>)) => SearchcraftState;
610
624
  setAdClientResponseItems: (items: AdClientResponseItem[]) => void;
611
- setSearchClientResponseItemsFromResponse: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
612
- setInitialSearchClientResponseItemsFromResponse: (response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
625
+ setSearchClientResponseItemsFromResponse: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[], supplementalResponse: SearchcraftResponse | undefined) => void;
626
+ setInitialSearchClientResponseItemsFromResponse: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
613
627
  setInitialQuery: (query: string) => void;
614
628
  setPopoverVisibility: (isVisible: boolean) => void;
615
629
  setSearchResultsCount: (count: number) => void;
@@ -640,9 +654,11 @@ export interface SearchcraftStateValues {
640
654
  isSearchInProgress: boolean;
641
655
  rangeValueForIndexFields: Record<string, RangeValueForIndexField>;
642
656
  searchMode: "fuzzy" | "exact";
657
+ searchClientRequest: SearchClientRequestProperties | string | undefined | null;
643
658
  searchClientResponseItems: SearchClientResponseItem[];
644
659
  searchResponseTimeTaken: number | undefined;
645
660
  searchResponseFacetPrime: FacetPrime | undefined | null;
661
+ supplementalFacetPrime: FacetPrime | undefined | null;
646
662
  searchResultsCount: number;
647
663
  searchResultsPage: number;
648
664
  searchResultsPerPage: number;
@@ -802,6 +818,10 @@ export namespace Components {
802
818
  * The label rendered above the input.
803
819
  */
804
820
  "inputLabel"?: string;
821
+ /**
822
+ * The placeholder's render behavior. 'hide-on-focus' - Hide the placeholder text immediately when the input form gains focus. 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.
823
+ */
824
+ "placeholderBehavior"?: "hide-on-focus" | "hide-on-text-entered";
805
825
  /**
806
826
  * The input element's placeholder value.
807
827
  */
@@ -1148,13 +1168,13 @@ export namespace Components {
1148
1168
  */
1149
1169
  interface SearchcraftSlider {
1150
1170
  /**
1151
- * The type of data allowed.
1171
+ * The type of data the sliders are using.
1152
1172
  */
1153
1173
  "dataType": "number" | "date";
1154
1174
  /**
1155
- * The granularity that the value must adhere to.
1175
+ * The date granularity to use. Used to format date labels.
1156
1176
  */
1157
- "granularity": number;
1177
+ "dateGranularity"?: "year" | "month" | "day" | "hour";
1158
1178
  /**
1159
1179
  * The maximum value allowed.
1160
1180
  */
@@ -1163,6 +1183,10 @@ export namespace Components {
1163
1183
  * The minimum value allowed.
1164
1184
  */
1165
1185
  "min": number;
1186
+ /**
1187
+ * The step amount for the slider inputs.
1188
+ */
1189
+ "step": number;
1166
1190
  }
1167
1191
  /**
1168
1192
  * This web component adds Searchcraft's built-in css theme to your page. It does not render anything visible, its only function is to manage the css styles on the page.'
@@ -1829,7 +1853,7 @@ declare namespace LocalJSX {
1829
1853
  */
1830
1854
  "fieldName"?: string;
1831
1855
  /**
1832
- * When the facets are updated.
1856
+ * Emitted when the facets are updated.
1833
1857
  */
1834
1858
  "onFacetSelectionUpdated"?: (event: SearchcraftFacetListCustomEvent<{
1835
1859
  paths: string[];
@@ -1916,6 +1940,10 @@ declare namespace LocalJSX {
1916
1940
  * Event emitted when input initializes.
1917
1941
  */
1918
1942
  "onInputInit"?: (event: SearchcraftInputFormCustomEvent<void>) => void;
1943
+ /**
1944
+ * The placeholder's render behavior. 'hide-on-focus' - Hide the placeholder text immediately when the input form gains focus. 'hide-on-text-entered' - Only hide the placeholder when the input form has text entered into it.
1945
+ */
1946
+ "placeholderBehavior"?: "hide-on-focus" | "hide-on-text-entered";
1919
1947
  /**
1920
1948
  * The input element's placeholder value.
1921
1949
  */
@@ -2266,13 +2294,13 @@ declare namespace LocalJSX {
2266
2294
  */
2267
2295
  interface SearchcraftSlider {
2268
2296
  /**
2269
- * The type of data allowed.
2297
+ * The type of data the sliders are using.
2270
2298
  */
2271
2299
  "dataType"?: "number" | "date";
2272
2300
  /**
2273
- * The granularity that the value must adhere to.
2301
+ * The date granularity to use. Used to format date labels.
2274
2302
  */
2275
- "granularity"?: number;
2303
+ "dateGranularity"?: "year" | "month" | "day" | "hour";
2276
2304
  /**
2277
2305
  * The maximum value allowed.
2278
2306
  */
@@ -2285,6 +2313,10 @@ declare namespace LocalJSX {
2285
2313
  * When the range has changed.
2286
2314
  */
2287
2315
  "onRangeChanged"?: (event: SearchcraftSliderCustomEvent<any>) => void;
2316
+ /**
2317
+ * The step amount for the slider inputs.
2318
+ */
2319
+ "step"?: number;
2288
2320
  }
2289
2321
  /**
2290
2322
  * This web component adds Searchcraft's built-in css theme to your page. It does not render anything visible, its only function is to manage the css styles on the page.'