@searchcraft/vue-sdk 0.10.6 → 0.11.0
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 +563 -223
- package/dist/index.es.js +6311 -4378
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +64 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/themes/hologram.css +1 -1
- package/dist/themes/hologram.css.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,119 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
3
|
import { HTMLStencilElement, JSXBase } from '@stencil/core/internal';
|
|
4
|
+
import { StoreApi } from 'zustand';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
export interface ADMResponse {
|
|
7
|
+
partial_qt: string;
|
|
8
|
+
text_ads: ADMAd[];
|
|
9
|
+
product_ads: ADMAd[];
|
|
10
|
+
}
|
|
11
|
+
export interface AdClientResponseItem {
|
|
12
|
+
id: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ADMClientResponseItem extends AdClientResponseItem {
|
|
15
|
+
admAdType: "adm-text-ad" | "adm-product-ad";
|
|
16
|
+
admAd?: ADMAd;
|
|
17
|
+
}
|
|
18
|
+
export interface ADMAd {
|
|
19
|
+
adv_id: number;
|
|
20
|
+
adv_name: string;
|
|
21
|
+
click_url?: string;
|
|
22
|
+
image_url?: string;
|
|
23
|
+
impression_url?: string;
|
|
24
|
+
price?: number;
|
|
25
|
+
price_currency?: string;
|
|
26
|
+
sale_price?: number;
|
|
27
|
+
term: string;
|
|
28
|
+
}
|
|
29
|
+
export type Facet = {
|
|
30
|
+
/**
|
|
31
|
+
* The path of the facet. The path represents where in the facet tree structure
|
|
32
|
+
* this facet exists. There is an arbitrary number of levels in a facet tree.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
*
|
|
36
|
+
* '/sports/college' - Represents that this is the facet node exists at [root] -> [sports] -> [college] in the facet tree.
|
|
37
|
+
* '/weather' - Represents that this facet exists at [root] -> [weather] in the facet tree
|
|
38
|
+
* '/news/local' - [root] -> [news] -> [local]
|
|
39
|
+
*/
|
|
40
|
+
path: string;
|
|
41
|
+
/**
|
|
42
|
+
* The count value just represents an arbitrary `count` metadata for this facet node.
|
|
43
|
+
*/
|
|
44
|
+
count: number;
|
|
45
|
+
};
|
|
46
|
+
export type FacetWithChildrenArray = Facet & {
|
|
47
|
+
children: FacetWithChildrenArray[] | null | undefined;
|
|
48
|
+
};
|
|
49
|
+
export type FacetWithChildrenObject = Facet & {
|
|
50
|
+
children: Record<string, FacetWithChildrenObject>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A Facet object returned in a search response.
|
|
54
|
+
*/
|
|
55
|
+
export type FacetRoot = {
|
|
56
|
+
[key: string]: FacetWithChildrenArray[];
|
|
57
|
+
};
|
|
58
|
+
export type FacetPrime = FacetRoot[];
|
|
59
|
+
/**
|
|
60
|
+
* A structured Facet tree.
|
|
61
|
+
*
|
|
62
|
+
* A Facet tree is the root node of a "complete view" of the facet node tree.
|
|
63
|
+
* Nodes are structured based on the `path` of each facet
|
|
64
|
+
*
|
|
65
|
+
*/
|
|
66
|
+
export type FacetTree = FacetWithChildrenObject;
|
|
67
|
+
/**
|
|
68
|
+
* Types of measure requests that can be sent to the /measure/event endpoint.
|
|
69
|
+
*/
|
|
70
|
+
export type MeasureEventName = "sdk_initialized" | "search_requested" | "search_response_received" | "search_completed" | "document_clicked";
|
|
71
|
+
/**
|
|
72
|
+
* The type used for sending multiple measure events in a single network request.
|
|
73
|
+
* Uses /measure/batch request.
|
|
74
|
+
*/
|
|
75
|
+
export interface BatchMeasureRequest {
|
|
76
|
+
items: MeasureRequest[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The type representing a measure request.
|
|
80
|
+
*/
|
|
81
|
+
export interface MeasureRequest {
|
|
82
|
+
event_name: MeasureEventName;
|
|
83
|
+
properties: MeasureRequestProperties;
|
|
84
|
+
user: MeasureRequestUser;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Properties attached to a measure request.
|
|
88
|
+
*/
|
|
89
|
+
export interface MeasureRequestProperties {
|
|
90
|
+
searchcraft_organization_id?: string;
|
|
91
|
+
searchcraft_application_id?: string;
|
|
92
|
+
searchcraft_index_names: string[];
|
|
93
|
+
search_term?: string;
|
|
94
|
+
number_of_documents?: number;
|
|
95
|
+
external_document_id?: string;
|
|
96
|
+
document_position?: number;
|
|
97
|
+
session_id?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* User properties attached to a measure request.
|
|
101
|
+
*/
|
|
102
|
+
export interface MeasureRequestUser {
|
|
103
|
+
user_id: string;
|
|
104
|
+
country?: string;
|
|
105
|
+
city?: string;
|
|
106
|
+
device_id?: string;
|
|
107
|
+
client_ip?: string;
|
|
108
|
+
locale?: string;
|
|
109
|
+
os?: string;
|
|
110
|
+
platform?: string;
|
|
111
|
+
region?: string;
|
|
112
|
+
sdk_name?: string;
|
|
113
|
+
sdk_version?: string;
|
|
114
|
+
user_agent?: string;
|
|
115
|
+
latitude?: number;
|
|
116
|
+
longitude?: number;
|
|
25
117
|
}
|
|
26
118
|
/**
|
|
27
119
|
* A data type representing an index field value, along with properties
|
|
@@ -106,7 +198,7 @@ export interface DateRangeFilterItem extends FilterItem {
|
|
|
106
198
|
type: "dateRange";
|
|
107
199
|
options: {
|
|
108
200
|
minDate: Date;
|
|
109
|
-
maxDate
|
|
201
|
+
maxDate?: Date;
|
|
110
202
|
granularity: "year" | "month" | "day" | "hour";
|
|
111
203
|
};
|
|
112
204
|
}
|
|
@@ -153,192 +245,142 @@ export type PopoverButtonTemplate = (data: {
|
|
|
153
245
|
export type ADMAdTemplate = (data: ADMAd, utils: {
|
|
154
246
|
html: TemplateHtml;
|
|
155
247
|
}) => string;
|
|
156
|
-
|
|
157
|
-
* The SearchcraftConfig object is used to initialize Searchcraft in your application.
|
|
158
|
-
*/
|
|
159
|
-
export interface SearchcraftConfig {
|
|
248
|
+
export interface CustomAdConfig {
|
|
160
249
|
/**
|
|
161
|
-
*
|
|
250
|
+
* The amount of debounce delay to add before calling the ad_container_rendered event
|
|
162
251
|
*/
|
|
163
|
-
|
|
252
|
+
adContainerRenderedDebounceDelay?: number;
|
|
164
253
|
/**
|
|
165
|
-
*
|
|
254
|
+
* The number of custom ads to render at the start of the search results page.
|
|
166
255
|
*/
|
|
167
|
-
|
|
256
|
+
adStartQuantity?: number;
|
|
168
257
|
/**
|
|
169
|
-
*
|
|
258
|
+
* The number of custom ads to render at the end of the search results page.
|
|
170
259
|
*/
|
|
171
|
-
|
|
260
|
+
adEndQuantity?: number;
|
|
172
261
|
/**
|
|
173
|
-
*
|
|
262
|
+
* Renders a custom ad in between search results, at the specified interval.
|
|
174
263
|
*/
|
|
175
|
-
|
|
264
|
+
adInterstitialInterval?: number;
|
|
176
265
|
/**
|
|
177
|
-
*
|
|
266
|
+
* Specifies the number of ads to be rendered in each interstitial in between search results.
|
|
178
267
|
*/
|
|
179
|
-
|
|
268
|
+
adInterstitialQuantity?: number;
|
|
180
269
|
/**
|
|
181
|
-
*
|
|
270
|
+
* A callback function responsible for rendering the custom ad containers.
|
|
182
271
|
*/
|
|
183
|
-
|
|
272
|
+
template: CustomAdTemplate;
|
|
273
|
+
}
|
|
274
|
+
export interface NativoAdConfig {
|
|
184
275
|
/**
|
|
185
|
-
*
|
|
276
|
+
* The placement id to use for Nativo ads.
|
|
186
277
|
*/
|
|
187
|
-
|
|
278
|
+
placementId?: number;
|
|
188
279
|
/**
|
|
189
|
-
* The
|
|
280
|
+
* The class name for nativo ad containers.
|
|
190
281
|
*/
|
|
191
|
-
|
|
282
|
+
adClassName?: string;
|
|
192
283
|
/**
|
|
193
|
-
* The
|
|
284
|
+
* The number of custom ads to render at the start of the search results page.
|
|
194
285
|
*/
|
|
195
|
-
|
|
286
|
+
adStartQuantity?: number;
|
|
196
287
|
/**
|
|
197
|
-
* The
|
|
288
|
+
* The number of custom ads to render at the end of the search results page.
|
|
198
289
|
*/
|
|
199
|
-
|
|
290
|
+
adEndQuantity?: number;
|
|
200
291
|
/**
|
|
201
|
-
*
|
|
292
|
+
* Renders a custom ad in between search results, at the specified interval.
|
|
202
293
|
*/
|
|
203
|
-
|
|
294
|
+
adInterstitialInterval?: number;
|
|
204
295
|
/**
|
|
205
|
-
*
|
|
296
|
+
* Specify how many normal search results to render before rendering the first interstitial ad grouping.
|
|
206
297
|
*/
|
|
207
|
-
|
|
298
|
+
adInterstialStartIndex?: number;
|
|
208
299
|
/**
|
|
209
|
-
*
|
|
300
|
+
* Specifies the number of ads to be rendered in each interstitial in between search results.
|
|
210
301
|
*/
|
|
211
|
-
|
|
302
|
+
adInterstitialQuantity?: number;
|
|
303
|
+
}
|
|
304
|
+
export interface ADMAdConfig {
|
|
212
305
|
/**
|
|
213
|
-
* The number of
|
|
306
|
+
* The number of product ads to request.
|
|
214
307
|
*/
|
|
215
|
-
|
|
308
|
+
productAdQuantity?: number;
|
|
216
309
|
/**
|
|
217
|
-
*
|
|
310
|
+
* The number of text ads to request.
|
|
218
311
|
*/
|
|
219
|
-
|
|
312
|
+
textAdQuantity?: number;
|
|
220
313
|
/**
|
|
221
|
-
*
|
|
314
|
+
* The adm sub value.
|
|
222
315
|
*/
|
|
223
|
-
|
|
316
|
+
sub?: string;
|
|
224
317
|
/**
|
|
225
|
-
* A callback function responsible for rendering the
|
|
318
|
+
* A callback function responsible for rendering the ADM ad containers.
|
|
226
319
|
*/
|
|
227
|
-
|
|
320
|
+
template?: ADMAdTemplate;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* The SearchcraftConfig object is used to initialize the Searchcraft JavaScript SDK in your front-end application. See the [getting started page](https://docs.searchcraft.io/sdks/javascript/getting-started/) for a guide on how and where to use this configuration object.
|
|
324
|
+
*/
|
|
325
|
+
export interface SearchcraftConfig {
|
|
228
326
|
/**
|
|
229
|
-
* The
|
|
327
|
+
* The read key value to use when sending Searchcraft search requests. This value needs read key-specific permissions. If you are using Searchcraft Cloud, this value can be configured in Vektron.
|
|
230
328
|
*/
|
|
231
|
-
|
|
329
|
+
readKey: string;
|
|
232
330
|
/**
|
|
233
|
-
* The
|
|
331
|
+
* The endpoint url of your Searchcraft cluster where your specified search index exists. If you are using Searchcraft Cloud, this value can be found within the Vektron dashboard in the Code Snippets section when configuring a search index.
|
|
234
332
|
*/
|
|
235
|
-
|
|
333
|
+
endpointURL: string;
|
|
236
334
|
/**
|
|
237
|
-
*
|
|
335
|
+
* Name of the Searchcraft search index to search for results within. If you are using Searchcraft Cloud, this value can be found within the Vektron dashboard in the Code Snippets section when configuring a search index.
|
|
238
336
|
*/
|
|
239
|
-
|
|
337
|
+
indexName: string;
|
|
240
338
|
/**
|
|
241
|
-
* The
|
|
339
|
+
* The initial search query to call when Searchcraft is first initialized in your front-end application. This parameter can be used when you want to populate a page with an initial set of search results based on a query.
|
|
340
|
+
*
|
|
341
|
+
* This value is a stringified Search query object. For a more in-depth reference on search queries, see the [search endpoint documentation](https://docs.searchcraft.io/api/search/).
|
|
242
342
|
*/
|
|
243
|
-
|
|
343
|
+
initialQuery?: string;
|
|
244
344
|
/**
|
|
245
|
-
*
|
|
345
|
+
* The maximum number of documents to return per page of results.
|
|
246
346
|
*/
|
|
247
|
-
|
|
347
|
+
searchResultsPerPage?: number;
|
|
248
348
|
/**
|
|
249
|
-
*
|
|
349
|
+
* The URL pointing towards Searchcraft Cloud's semantic search and RAG summary processing layer. When using a `searchcraft-summary-box` component, this value must be specified.
|
|
250
350
|
*/
|
|
251
|
-
|
|
351
|
+
cortexURL?: string;
|
|
252
352
|
/**
|
|
253
|
-
*
|
|
353
|
+
* Instructions provided to the LLM when creating search result summaries.
|
|
254
354
|
*/
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
export type SearchcraftAdSource = "adMarketplace" | "Nativo" | "Custom" | "None";
|
|
258
|
-
/**
|
|
259
|
-
* Used internally by consuming packages as part of the core sdk constructor.
|
|
260
|
-
*/
|
|
261
|
-
export interface SearchcraftSDKInfo {
|
|
262
|
-
sdkName: string;
|
|
263
|
-
sdkVersion: string;
|
|
264
|
-
}
|
|
265
|
-
export interface AdClientResponseItem {
|
|
266
|
-
id: string;
|
|
267
|
-
adSource: SearchcraftAdSource;
|
|
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
|
-
}
|
|
280
|
-
export type Facet = {
|
|
355
|
+
summaryInstructionsPrompt?: string;
|
|
281
356
|
/**
|
|
282
|
-
* The
|
|
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]
|
|
357
|
+
* The amount of delay, in milliseconds, to debounce summary requests. Defaults to `1000`
|
|
290
358
|
*/
|
|
291
|
-
|
|
359
|
+
summaryDebounceDelay?: number;
|
|
292
360
|
/**
|
|
293
|
-
*
|
|
361
|
+
* Name of the ad source to use.
|
|
294
362
|
*/
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
*/
|
|
310
|
-
export type MeasureEventName = "sdk_initialized" | "search_requested" | "search_response_received" | "search_completed" | "document_clicked";
|
|
311
|
-
/**
|
|
312
|
-
* Properties attached to a measure request.
|
|
313
|
-
*/
|
|
314
|
-
export interface MeasureRequestProperties {
|
|
315
|
-
searchcraft_organization_id?: string;
|
|
316
|
-
searchcraft_application_id?: string;
|
|
317
|
-
searchcraft_index_names: string[];
|
|
318
|
-
search_term?: string;
|
|
319
|
-
number_of_documents?: number;
|
|
320
|
-
external_document_id?: string;
|
|
321
|
-
document_position?: number;
|
|
322
|
-
session_id?: string;
|
|
363
|
+
searchDebounceDelay?: number;
|
|
364
|
+
/**
|
|
365
|
+
* A unique user identifier for end users of your product. This would typically correspond to a user id
|
|
366
|
+
* in your consuming application's database. Used for data analysis and visualizations on Vektron.
|
|
367
|
+
*/
|
|
368
|
+
measureUserIdentifier?: string;
|
|
369
|
+
/**
|
|
370
|
+
* This object allows you to configure the quantity, number, template, and positioning of custom ad containers within your search results.
|
|
371
|
+
*
|
|
372
|
+
* To see more information on how to configure custom ads, see [the custom ads guide](https://docs.searchcraft.io/sdks/javascript/custom-ads/)
|
|
373
|
+
*/
|
|
374
|
+
customAdConfig?: CustomAdConfig;
|
|
375
|
+
nativoConfig?: NativoAdConfig;
|
|
376
|
+
admAdConfig?: ADMAdConfig;
|
|
323
377
|
}
|
|
324
378
|
/**
|
|
325
|
-
*
|
|
379
|
+
* Used internally by consuming packages as part of the core sdk constructor.
|
|
326
380
|
*/
|
|
327
|
-
export interface
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
city?: string;
|
|
331
|
-
device_id?: string;
|
|
332
|
-
client_ip?: string;
|
|
333
|
-
locale?: string;
|
|
334
|
-
os?: string;
|
|
335
|
-
platform?: string;
|
|
336
|
-
region?: string;
|
|
337
|
-
sdk_name?: string;
|
|
338
|
-
sdk_version?: string;
|
|
339
|
-
user_agent?: string;
|
|
340
|
-
latitude?: number;
|
|
341
|
-
longitude?: number;
|
|
381
|
+
export interface SearchcraftSDKInfo {
|
|
382
|
+
sdkName: string;
|
|
383
|
+
sdkVersion: string;
|
|
342
384
|
}
|
|
343
385
|
export interface FacetPathsForIndexField {
|
|
344
386
|
fieldName: string;
|
|
@@ -348,6 +390,22 @@ export interface RangeValueForIndexField {
|
|
|
348
390
|
fieldName: string;
|
|
349
391
|
value: string;
|
|
350
392
|
}
|
|
393
|
+
export interface SearchClientQuery {
|
|
394
|
+
occur?: "must" | "should";
|
|
395
|
+
exact?: {
|
|
396
|
+
ctx: string;
|
|
397
|
+
};
|
|
398
|
+
fuzzy?: {
|
|
399
|
+
ctx: string;
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
export type SearchClientRequest = {
|
|
403
|
+
limit?: number;
|
|
404
|
+
offset?: number;
|
|
405
|
+
order_by?: string;
|
|
406
|
+
sort?: "asc" | "desc";
|
|
407
|
+
query: SearchClientQuery[];
|
|
408
|
+
};
|
|
351
409
|
export interface SearchClientRequestProperties {
|
|
352
410
|
/**
|
|
353
411
|
* The search mode, which can be either 'fuzzy' or 'exact'.
|
|
@@ -453,7 +511,6 @@ export interface AdContainerRenderedSubscriptionEvent extends SubscriptionEvent
|
|
|
453
511
|
name: "ad_container_rendered";
|
|
454
512
|
data: {
|
|
455
513
|
adContainerId: string;
|
|
456
|
-
adSource: SearchcraftAdSource;
|
|
457
514
|
searchTerm: string;
|
|
458
515
|
};
|
|
459
516
|
}
|
|
@@ -461,7 +518,6 @@ export interface AdContainerViewedSubscriptionEvent extends SubscriptionEvent {
|
|
|
461
518
|
name: "ad_container_viewed";
|
|
462
519
|
data: {
|
|
463
520
|
adContainerId: string;
|
|
464
|
-
adSource: SearchcraftAdSource;
|
|
465
521
|
searchTerm: string;
|
|
466
522
|
};
|
|
467
523
|
}
|
|
@@ -502,13 +558,11 @@ declare class AdClient {
|
|
|
502
558
|
onAdContainerRendered(_data: {
|
|
503
559
|
adClientResponseItem?: AdClientResponseItem;
|
|
504
560
|
adContainerId: string;
|
|
505
|
-
adSource: SearchcraftAdSource;
|
|
506
561
|
searchTerm: string;
|
|
507
562
|
}): Promise<void>;
|
|
508
563
|
onAdContainerViewed(_data: {
|
|
509
564
|
adClientResponseItem?: AdClientResponseItem;
|
|
510
565
|
adContainerId: string;
|
|
511
|
-
adSource: SearchcraftAdSource;
|
|
512
566
|
searchTerm: string;
|
|
513
567
|
}): Promise<void>;
|
|
514
568
|
}
|
|
@@ -543,18 +597,23 @@ declare class SearchClient {
|
|
|
543
597
|
private parent;
|
|
544
598
|
private searchCompletedEventTimeout;
|
|
545
599
|
private abortController;
|
|
600
|
+
private supplementalAbortController;
|
|
546
601
|
constructor(parent: SearchcraftCore, config: SearchcraftConfig, userId: string);
|
|
547
602
|
/**
|
|
548
603
|
* Getter for the base url used by the /search endpoint.
|
|
549
604
|
*/
|
|
550
605
|
private get baseSearchUrl();
|
|
606
|
+
/**
|
|
607
|
+
* Immediately cancels all pending search requests.
|
|
608
|
+
*/
|
|
609
|
+
abortRequests: () => void;
|
|
551
610
|
/**
|
|
552
611
|
* Make the request to get the search results.
|
|
553
612
|
* @param {properties} properties - The properties for the search.
|
|
554
|
-
* @param
|
|
613
|
+
* @param isSupplemental - Whether or not this is a supplemental search request (for the purpose of getting top-level facet counts)
|
|
555
614
|
* @returns
|
|
556
615
|
*/
|
|
557
|
-
getSearchResponseItems: (properties: SearchClientRequestProperties | string,
|
|
616
|
+
getSearchResponseItems: (properties: SearchClientRequestProperties | string, isSupplemental?: boolean) => Promise<SearchcraftResponse>;
|
|
558
617
|
private handleGetSearchResponseItemsWithString;
|
|
559
618
|
private handleGetSearchResponseItemsWithObject;
|
|
560
619
|
/**
|
|
@@ -564,49 +623,13 @@ declare class SearchClient {
|
|
|
564
623
|
*/
|
|
565
624
|
private formatParamsForRequest;
|
|
566
625
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
adClient: AdClient | undefined;
|
|
575
|
-
userId: string;
|
|
576
|
-
private requestTimeout;
|
|
577
|
-
private subscriptionEvents;
|
|
578
|
-
constructor(config: SearchcraftConfig, sdkInfo: SearchcraftSDKInfo);
|
|
579
|
-
private initInputForms;
|
|
580
|
-
/**
|
|
581
|
-
* When changes happen in the DOM, we want to link any input forms found to the instance of the core.
|
|
582
|
-
*/
|
|
583
|
-
private startObservingMutations;
|
|
584
|
-
private initClients;
|
|
585
|
-
emitEvent<T extends SubscriptionEventName>(eventName: T, event: SubscriptionEventMap[T]): void;
|
|
586
|
-
subscribe<T extends SubscriptionEventName>(eventName: T, callback: SubscriptionEventCallback<T>): UnsubscribeFunction;
|
|
587
|
-
/**
|
|
588
|
-
* Called when a `<searchcraft-ad>` component is rendered
|
|
589
|
-
*/
|
|
590
|
-
handleAdContainerRendered(data: {
|
|
591
|
-
adClientResponseItem?: AdClientResponseItem;
|
|
592
|
-
adContainerId: string;
|
|
593
|
-
adSource: SearchcraftAdSource;
|
|
594
|
-
searchTerm: string;
|
|
595
|
-
}): void;
|
|
596
|
-
/**
|
|
597
|
-
* Called when a `<searchcraft-ad>` is viewed
|
|
598
|
-
*/
|
|
599
|
-
handleAdContainerViewed(data: {
|
|
600
|
-
adClientResponseItem?: AdClientResponseItem;
|
|
601
|
-
adContainerId: string;
|
|
602
|
-
adSource: SearchcraftAdSource;
|
|
603
|
-
searchTerm: string;
|
|
604
|
-
}): void;
|
|
605
|
-
/**
|
|
606
|
-
* Perform various actions when the input is cleared
|
|
607
|
-
*/
|
|
608
|
-
handleInputCleared(): void;
|
|
609
|
-
getResponseItems: (properties: SearchClientRequestProperties | string, searchCallback: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[], supplementalResponse: SearchcraftResponse | undefined) => void, adCallback: (items: AdClientResponseItem[]) => void) => void;
|
|
626
|
+
declare class SummaryClient {
|
|
627
|
+
private set;
|
|
628
|
+
private get;
|
|
629
|
+
private abortController;
|
|
630
|
+
private timeout;
|
|
631
|
+
constructor(get: SearchcraftStore["getState"], set: SearchcraftStore["setState"]);
|
|
632
|
+
streamSummaryData(): void;
|
|
610
633
|
}
|
|
611
634
|
/**
|
|
612
635
|
* Callable functions made available by the SearchcraftStore.
|
|
@@ -614,20 +637,12 @@ export declare class SearchcraftCore {
|
|
|
614
637
|
export interface SearchcraftStateFunctions {
|
|
615
638
|
addFacetPathsForIndexField: (field: FacetPathsForIndexField) => void;
|
|
616
639
|
addRangeValueForIndexField: (field: RangeValueForIndexField) => void;
|
|
617
|
-
getSearchcraftCore: () => SearchcraftCore | undefined;
|
|
618
|
-
init: (searchcraft: SearchcraftCore | undefined, debug?: boolean) => void;
|
|
619
640
|
removeFacetPathsForIndexField: (fieldName: string) => void;
|
|
620
641
|
removeRangeValueForIndexField: (fieldName: string) => void;
|
|
621
|
-
|
|
642
|
+
resetSearchValues: () => void;
|
|
622
643
|
search: () => Promise<void>;
|
|
623
|
-
set: (state: Partial<SearchcraftState> | ((state: SearchcraftState) => Partial<SearchcraftState>)) => SearchcraftState;
|
|
624
|
-
setAdClientResponseItems: (items: AdClientResponseItem[]) => void;
|
|
625
|
-
setSearchClientResponseItemsFromResponse: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[], supplementalResponse: SearchcraftResponse | undefined) => void;
|
|
626
|
-
setInitialSearchClientResponseItemsFromResponse: (request: SearchClientRequestProperties | string, response: SearchcraftResponse, items: SearchClientResponseItem[]) => void;
|
|
627
|
-
setInitialQuery: (query: string) => void;
|
|
628
644
|
setPopoverVisibility: (isVisible: boolean) => void;
|
|
629
645
|
setSearchResultsCount: (count: number) => void;
|
|
630
|
-
setSearchClientResponseItems: (items: SearchClientResponseItem[]) => void;
|
|
631
646
|
setSearchResultsPage: (page: number) => void;
|
|
632
647
|
setSearchResultsPerPage: (perPage: number) => void;
|
|
633
648
|
setSearchTerm: (searchTerm: string) => void;
|
|
@@ -643,19 +658,19 @@ export interface SearchcraftStateFunctions {
|
|
|
643
658
|
*/
|
|
644
659
|
export interface SearchcraftStateValues {
|
|
645
660
|
adClientResponseItems: AdClientResponseItem[];
|
|
661
|
+
cachedAdClientResponseItems: AdClientResponseItem[];
|
|
646
662
|
core: SearchcraftCore | undefined;
|
|
647
663
|
hotkey: string;
|
|
648
664
|
hotkeyModifier: "ctrl" | "meta" | "alt" | "option";
|
|
649
|
-
logger: Logger | undefined;
|
|
650
665
|
facetPathsForIndexFields: Record<string, FacetPathsForIndexField>;
|
|
651
|
-
initialQuery: string;
|
|
652
|
-
initialSearchClientResponseItems: SearchClientResponseItem[];
|
|
653
666
|
isPopoverVisible: boolean;
|
|
654
667
|
isSearchInProgress: boolean;
|
|
655
668
|
rangeValueForIndexFields: Record<string, RangeValueForIndexField>;
|
|
656
669
|
searchMode: "fuzzy" | "exact";
|
|
657
|
-
searchClientRequest
|
|
670
|
+
searchClientRequest?: SearchClientRequest;
|
|
671
|
+
searchClientRequestProperties: SearchClientRequestProperties | string | undefined | null;
|
|
658
672
|
searchClientResponseItems: SearchClientResponseItem[];
|
|
673
|
+
cachedSearchClientResponseItems: SearchClientResponseItem[];
|
|
659
674
|
searchResponseTimeTaken: number | undefined;
|
|
660
675
|
searchResponseFacetPrime: FacetPrime | undefined | null;
|
|
661
676
|
supplementalFacetPrime: FacetPrime | undefined | null;
|
|
@@ -665,11 +680,60 @@ export interface SearchcraftStateValues {
|
|
|
665
680
|
searchTerm: string;
|
|
666
681
|
orderByField: string | undefined | null;
|
|
667
682
|
sortType: "asc" | "desc" | undefined | null;
|
|
668
|
-
|
|
683
|
+
summary: string;
|
|
684
|
+
hasSummaryBox: boolean;
|
|
685
|
+
isSummaryLoading: boolean;
|
|
686
|
+
summaryClient?: SummaryClient;
|
|
669
687
|
}
|
|
670
688
|
export interface SearchcraftState extends SearchcraftStateFunctions, SearchcraftStateValues {
|
|
671
689
|
}
|
|
672
|
-
export
|
|
690
|
+
export type SearchcraftStore = StoreApi<SearchcraftState>;
|
|
691
|
+
/**
|
|
692
|
+
* Javascript Class providing the functionality to interact with the Searchcraft BE
|
|
693
|
+
*/
|
|
694
|
+
export declare class SearchcraftCore {
|
|
695
|
+
store: SearchcraftStore;
|
|
696
|
+
config: SearchcraftConfig;
|
|
697
|
+
measureClient: MeasureClient | undefined;
|
|
698
|
+
searchClient: SearchClient | undefined;
|
|
699
|
+
adClient: AdClient | undefined;
|
|
700
|
+
userId: string;
|
|
701
|
+
private requestTimeout;
|
|
702
|
+
private subscriptionEvents;
|
|
703
|
+
/**
|
|
704
|
+
* @param config The SearchcraftConfig object for this Searchcraft instance.
|
|
705
|
+
* @param sdkInfo The SDK info object for this searchcraft instance
|
|
706
|
+
* @param searchcraftId The identifier to use to reference this instance of SearchcraftCore.
|
|
707
|
+
*/
|
|
708
|
+
constructor(config: SearchcraftConfig, sdkInfo: SearchcraftSDKInfo, searchcraftId: string | undefined);
|
|
709
|
+
private initClients;
|
|
710
|
+
emitEvent<T extends SubscriptionEventName>(eventName: T, event: SubscriptionEventMap[T]): void;
|
|
711
|
+
subscribe<T extends SubscriptionEventName>(eventName: T, callback: SubscriptionEventCallback<T>): UnsubscribeFunction;
|
|
712
|
+
/**
|
|
713
|
+
* Called when a `<searchcraft-ad>` component is rendered
|
|
714
|
+
*/
|
|
715
|
+
handleAdContainerRendered(data: {
|
|
716
|
+
adClientResponseItem?: AdClientResponseItem;
|
|
717
|
+
adContainerId: string;
|
|
718
|
+
searchTerm: string;
|
|
719
|
+
}): void;
|
|
720
|
+
/**
|
|
721
|
+
* Called when a `<searchcraft-ad>` is viewed
|
|
722
|
+
*/
|
|
723
|
+
handleAdContainerViewed(data: {
|
|
724
|
+
adClientResponseItem?: AdClientResponseItem;
|
|
725
|
+
adContainerId: string;
|
|
726
|
+
searchTerm: string;
|
|
727
|
+
}): void;
|
|
728
|
+
/**
|
|
729
|
+
* Perform various actions when the input is cleared
|
|
730
|
+
*/
|
|
731
|
+
handleInputCleared(): void;
|
|
732
|
+
getResponseItems: (props: {
|
|
733
|
+
requestProperties: SearchClientRequestProperties | string;
|
|
734
|
+
shouldCacheResultsForEmptyState: boolean;
|
|
735
|
+
}) => void;
|
|
736
|
+
}
|
|
673
737
|
export type SearchcraftSelectOption = {
|
|
674
738
|
label: string;
|
|
675
739
|
value: string | number;
|
|
@@ -681,8 +745,15 @@ export namespace Components {
|
|
|
681
745
|
*/
|
|
682
746
|
interface SearchcraftAd {
|
|
683
747
|
"adClientResponseItem"?: AdClientResponseItem;
|
|
684
|
-
"
|
|
685
|
-
|
|
748
|
+
"adSource": "Custom" | "Nativo" | "adMarketplace";
|
|
749
|
+
/**
|
|
750
|
+
* Where the ad is being rendered within the search results div. Lifecycle behavior differs for ads being rendered in different positions, so we need to be able to handle all of those cases.
|
|
751
|
+
*/
|
|
752
|
+
"renderPosition": "interstitial" | "top" | "bottom";
|
|
753
|
+
/**
|
|
754
|
+
* The id of the Searchcraft instance that this component should use.
|
|
755
|
+
*/
|
|
756
|
+
"searchcraftId"?: string;
|
|
686
757
|
}
|
|
687
758
|
/**
|
|
688
759
|
* This web component represents a button.
|
|
@@ -748,6 +819,10 @@ export namespace Components {
|
|
|
748
819
|
* The name of the field where facets are applied.
|
|
749
820
|
*/
|
|
750
821
|
"fieldName": string;
|
|
822
|
+
/**
|
|
823
|
+
* The id of the Searchcraft instance that this component should use.
|
|
824
|
+
*/
|
|
825
|
+
"searchcraftId"?: string;
|
|
751
826
|
}
|
|
752
827
|
/**
|
|
753
828
|
* This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
|
|
@@ -780,6 +855,10 @@ export namespace Components {
|
|
|
780
855
|
* The items to filter.
|
|
781
856
|
*/
|
|
782
857
|
"items": FilterItem[];
|
|
858
|
+
/**
|
|
859
|
+
* The id of the Searchcraft instance that this component should use.
|
|
860
|
+
*/
|
|
861
|
+
"searchcraftId"?: string;
|
|
783
862
|
}
|
|
784
863
|
/**
|
|
785
864
|
* This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
|
|
@@ -813,7 +892,6 @@ export namespace Components {
|
|
|
813
892
|
* Where to place the search button.
|
|
814
893
|
*/
|
|
815
894
|
"buttonPlacement"?: "left" | "right" | "none";
|
|
816
|
-
"core"?: SearchcraftCore;
|
|
817
895
|
/**
|
|
818
896
|
* The label rendered above the input.
|
|
819
897
|
*/
|
|
@@ -826,6 +904,10 @@ export namespace Components {
|
|
|
826
904
|
* The input element's placeholder value.
|
|
827
905
|
*/
|
|
828
906
|
"placeholderValue"?: string;
|
|
907
|
+
/**
|
|
908
|
+
* The id of the Searchcraft instance that this component should use.
|
|
909
|
+
*/
|
|
910
|
+
"searchcraftId"?: string;
|
|
829
911
|
}
|
|
830
912
|
/**
|
|
831
913
|
* This web component serves as the input label for the searchcraft-input-form component.
|
|
@@ -840,6 +922,12 @@ export namespace Components {
|
|
|
840
922
|
"inputLabelClassName"?: string | undefined;
|
|
841
923
|
"label": string;
|
|
842
924
|
}
|
|
925
|
+
/**
|
|
926
|
+
* Renders a loading spinner/loading state for use in things like the summary box.
|
|
927
|
+
*/
|
|
928
|
+
interface SearchcraftLoading {
|
|
929
|
+
"label"?: string;
|
|
930
|
+
}
|
|
843
931
|
/**
|
|
844
932
|
* This web component is designed to facilitate pagination of search results. Once a query is submitted, calculates the number for pages.
|
|
845
933
|
* @react-import ```jsx
|
|
@@ -859,6 +947,10 @@ export namespace Components {
|
|
|
859
947
|
* ```
|
|
860
948
|
*/
|
|
861
949
|
interface SearchcraftPagination {
|
|
950
|
+
/**
|
|
951
|
+
* The id of the Searchcraft instance that this component should use.
|
|
952
|
+
*/
|
|
953
|
+
"searchcraftId"?: string;
|
|
862
954
|
}
|
|
863
955
|
/**
|
|
864
956
|
* Renders a button which, when clicked, turns on popover visibility.
|
|
@@ -901,6 +993,10 @@ export namespace Components {
|
|
|
901
993
|
* ```
|
|
902
994
|
*/
|
|
903
995
|
interface SearchcraftPopoverButton {
|
|
996
|
+
/**
|
|
997
|
+
* The id of the Searchcraft instance that this component should use.
|
|
998
|
+
*/
|
|
999
|
+
"searchcraftId"?: string;
|
|
904
1000
|
/**
|
|
905
1001
|
* A callback function responsible for rendering the button contents.
|
|
906
1002
|
*/
|
|
@@ -914,6 +1010,10 @@ export namespace Components {
|
|
|
914
1010
|
* Renders the footer for the searchcraft-popover-form.
|
|
915
1011
|
*/
|
|
916
1012
|
interface SearchcraftPopoverFooter {
|
|
1013
|
+
/**
|
|
1014
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1015
|
+
*/
|
|
1016
|
+
"searchcraftId"?: string;
|
|
917
1017
|
}
|
|
918
1018
|
/**
|
|
919
1019
|
* This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
|
|
@@ -952,6 +1052,10 @@ export namespace Components {
|
|
|
952
1052
|
* Formats the content rendered for each result.
|
|
953
1053
|
*/
|
|
954
1054
|
"popoverResultMappings"?: PopoverResultMappings;
|
|
1055
|
+
/**
|
|
1056
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1057
|
+
*/
|
|
1058
|
+
"searchcraftId"?: string;
|
|
955
1059
|
/**
|
|
956
1060
|
* The type of popover form to render. - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content. - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component. - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
|
|
957
1061
|
*/
|
|
@@ -967,6 +1071,10 @@ export namespace Components {
|
|
|
967
1071
|
"documentPosition": number;
|
|
968
1072
|
"item": SearchClientResponseItem | undefined;
|
|
969
1073
|
"popoverResultMappings": PopoverResultMappings | undefined;
|
|
1074
|
+
/**
|
|
1075
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1076
|
+
*/
|
|
1077
|
+
"searchcraftId"?: string;
|
|
970
1078
|
}
|
|
971
1079
|
/**
|
|
972
1080
|
* This web component is designed to display a list of results within a popover interface.
|
|
@@ -987,6 +1095,10 @@ export namespace Components {
|
|
|
987
1095
|
"searchClientResponseItems": SearchClientResponseItem[] | undefined;
|
|
988
1096
|
"searchResultsPage": number;
|
|
989
1097
|
"searchResultsPerPage": number;
|
|
1098
|
+
/**
|
|
1099
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1100
|
+
*/
|
|
1101
|
+
"searchcraftId"?: string;
|
|
990
1102
|
}
|
|
991
1103
|
/**
|
|
992
1104
|
* This web component is designed to display the number of results returned from a search query.
|
|
@@ -1023,6 +1135,10 @@ export namespace Components {
|
|
|
1023
1135
|
* ```
|
|
1024
1136
|
*/
|
|
1025
1137
|
interface SearchcraftResultsInfo {
|
|
1138
|
+
/**
|
|
1139
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1140
|
+
*/
|
|
1141
|
+
"searchcraftId"?: string;
|
|
1026
1142
|
/**
|
|
1027
1143
|
* A callback function responsible for rendering the results info.
|
|
1028
1144
|
*/
|
|
@@ -1041,6 +1157,10 @@ export namespace Components {
|
|
|
1041
1157
|
*/
|
|
1042
1158
|
"index": number;
|
|
1043
1159
|
"item"?: SearchClientResponseItem;
|
|
1160
|
+
/**
|
|
1161
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1162
|
+
*/
|
|
1163
|
+
"searchcraftId"?: string;
|
|
1044
1164
|
/**
|
|
1045
1165
|
* A callback function responsible for rendering a result.
|
|
1046
1166
|
*/
|
|
@@ -1092,6 +1212,10 @@ export namespace Components {
|
|
|
1092
1212
|
* A query that will appears when the component initializes or the search term is ''..
|
|
1093
1213
|
*/
|
|
1094
1214
|
"initialQuery"?: string;
|
|
1215
|
+
/**
|
|
1216
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1217
|
+
*/
|
|
1218
|
+
"searchcraftId"?: string;
|
|
1095
1219
|
/**
|
|
1096
1220
|
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
1097
1221
|
*/
|
|
@@ -1121,6 +1245,10 @@ export namespace Components {
|
|
|
1121
1245
|
* The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]). The base value is defined by the `searchResultsPerPage` option in the configuration.
|
|
1122
1246
|
*/
|
|
1123
1247
|
"increment": string | number;
|
|
1248
|
+
/**
|
|
1249
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1250
|
+
*/
|
|
1251
|
+
"searchcraftId"?: string;
|
|
1124
1252
|
}
|
|
1125
1253
|
/**
|
|
1126
1254
|
* This web component is designed to allow users to select between a group of options.
|
|
@@ -1188,6 +1316,33 @@ export namespace Components {
|
|
|
1188
1316
|
*/
|
|
1189
1317
|
"step": number;
|
|
1190
1318
|
}
|
|
1319
|
+
/**
|
|
1320
|
+
* This component renders a summary box for RAG search result summaries.
|
|
1321
|
+
* When the user makes a search, a network call is made to retrieve the summary content, which is then
|
|
1322
|
+
* rendered in this box.
|
|
1323
|
+
* NOTE: This component requires the usage of a read key that has "SUMMARY" permissions.
|
|
1324
|
+
* @react-import ```jsx
|
|
1325
|
+
* import { SearchcraftSummaryBox } from "@searchcraft/react-sdk";
|
|
1326
|
+
* ```
|
|
1327
|
+
* @vue-import ```jsx
|
|
1328
|
+
* import { SearchcraftSummaryBox } from "@searchcraft/vue-sdk";
|
|
1329
|
+
* ```
|
|
1330
|
+
* @js-example ```html
|
|
1331
|
+
* <searchcraft-summary-box />
|
|
1332
|
+
* ```
|
|
1333
|
+
* @react-example ```jsx
|
|
1334
|
+
* <SearchcraftSummaryBox />
|
|
1335
|
+
* ```
|
|
1336
|
+
* @vue-example ```jsx
|
|
1337
|
+
* <SearchcraftSummaryBox />
|
|
1338
|
+
* ```
|
|
1339
|
+
*/
|
|
1340
|
+
interface SearchcraftSummaryBox {
|
|
1341
|
+
/**
|
|
1342
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1343
|
+
*/
|
|
1344
|
+
"searchcraftId"?: string;
|
|
1345
|
+
}
|
|
1191
1346
|
/**
|
|
1192
1347
|
* 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.'
|
|
1193
1348
|
* @react-import ```jsx
|
|
@@ -1216,6 +1371,10 @@ export namespace Components {
|
|
|
1216
1371
|
* The label.
|
|
1217
1372
|
*/
|
|
1218
1373
|
"label": string;
|
|
1374
|
+
/**
|
|
1375
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1376
|
+
*/
|
|
1377
|
+
"searchcraftId"?: string;
|
|
1219
1378
|
/**
|
|
1220
1379
|
* The secondary label displayed below the main label.
|
|
1221
1380
|
*/
|
|
@@ -1407,6 +1566,15 @@ declare global {
|
|
|
1407
1566
|
prototype: HTMLSearchcraftInputLabelElement;
|
|
1408
1567
|
new (): HTMLSearchcraftInputLabelElement;
|
|
1409
1568
|
};
|
|
1569
|
+
/**
|
|
1570
|
+
* Renders a loading spinner/loading state for use in things like the summary box.
|
|
1571
|
+
*/
|
|
1572
|
+
interface HTMLSearchcraftLoadingElement extends Components.SearchcraftLoading, HTMLStencilElement {
|
|
1573
|
+
}
|
|
1574
|
+
var HTMLSearchcraftLoadingElement: {
|
|
1575
|
+
prototype: HTMLSearchcraftLoadingElement;
|
|
1576
|
+
new (): HTMLSearchcraftLoadingElement;
|
|
1577
|
+
};
|
|
1410
1578
|
/**
|
|
1411
1579
|
* This web component is designed to facilitate pagination of search results. Once a query is submitted, calculates the number for pages.
|
|
1412
1580
|
* @react-import ```jsx
|
|
@@ -1707,6 +1875,33 @@ declare global {
|
|
|
1707
1875
|
prototype: HTMLSearchcraftSliderElement;
|
|
1708
1876
|
new (): HTMLSearchcraftSliderElement;
|
|
1709
1877
|
};
|
|
1878
|
+
/**
|
|
1879
|
+
* This component renders a summary box for RAG search result summaries.
|
|
1880
|
+
* When the user makes a search, a network call is made to retrieve the summary content, which is then
|
|
1881
|
+
* rendered in this box.
|
|
1882
|
+
* NOTE: This component requires the usage of a read key that has "SUMMARY" permissions.
|
|
1883
|
+
* @react-import ```jsx
|
|
1884
|
+
* import { SearchcraftSummaryBox } from "@searchcraft/react-sdk";
|
|
1885
|
+
* ```
|
|
1886
|
+
* @vue-import ```jsx
|
|
1887
|
+
* import { SearchcraftSummaryBox } from "@searchcraft/vue-sdk";
|
|
1888
|
+
* ```
|
|
1889
|
+
* @js-example ```html
|
|
1890
|
+
* <searchcraft-summary-box />
|
|
1891
|
+
* ```
|
|
1892
|
+
* @react-example ```jsx
|
|
1893
|
+
* <SearchcraftSummaryBox />
|
|
1894
|
+
* ```
|
|
1895
|
+
* @vue-example ```jsx
|
|
1896
|
+
* <SearchcraftSummaryBox />
|
|
1897
|
+
* ```
|
|
1898
|
+
*/
|
|
1899
|
+
interface HTMLSearchcraftSummaryBoxElement extends Components.SearchcraftSummaryBox, HTMLStencilElement {
|
|
1900
|
+
}
|
|
1901
|
+
var HTMLSearchcraftSummaryBoxElement: {
|
|
1902
|
+
prototype: HTMLSearchcraftSummaryBoxElement;
|
|
1903
|
+
new (): HTMLSearchcraftSummaryBoxElement;
|
|
1904
|
+
};
|
|
1710
1905
|
/**
|
|
1711
1906
|
* 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.'
|
|
1712
1907
|
* @react-import ```jsx
|
|
@@ -1759,6 +1954,7 @@ declare global {
|
|
|
1759
1954
|
"searchcraft-filter-panel": HTMLSearchcraftFilterPanelElement;
|
|
1760
1955
|
"searchcraft-input-form": HTMLSearchcraftInputFormElement;
|
|
1761
1956
|
"searchcraft-input-label": HTMLSearchcraftInputLabelElement;
|
|
1957
|
+
"searchcraft-loading": HTMLSearchcraftLoadingElement;
|
|
1762
1958
|
"searchcraft-pagination": HTMLSearchcraftPaginationElement;
|
|
1763
1959
|
"searchcraft-popover-button": HTMLSearchcraftPopoverButtonElement;
|
|
1764
1960
|
"searchcraft-popover-footer": HTMLSearchcraftPopoverFooterElement;
|
|
@@ -1771,6 +1967,7 @@ declare global {
|
|
|
1771
1967
|
"searchcraft-search-results-per-page": HTMLSearchcraftSearchResultsPerPageElement;
|
|
1772
1968
|
"searchcraft-select": HTMLSearchcraftSelectElement;
|
|
1773
1969
|
"searchcraft-slider": HTMLSearchcraftSliderElement;
|
|
1970
|
+
"searchcraft-summary-box": HTMLSearchcraftSummaryBoxElement;
|
|
1774
1971
|
"searchcraft-theme": HTMLSearchcraftThemeElement;
|
|
1775
1972
|
"searchcraft-toggle-button": HTMLSearchcraftToggleButtonElement;
|
|
1776
1973
|
}
|
|
@@ -1781,8 +1978,15 @@ declare namespace LocalJSX {
|
|
|
1781
1978
|
*/
|
|
1782
1979
|
interface SearchcraftAd {
|
|
1783
1980
|
"adClientResponseItem"?: AdClientResponseItem;
|
|
1784
|
-
"
|
|
1785
|
-
|
|
1981
|
+
"adSource"?: "Custom" | "Nativo" | "adMarketplace";
|
|
1982
|
+
/**
|
|
1983
|
+
* Where the ad is being rendered within the search results div. Lifecycle behavior differs for ads being rendered in different positions, so we need to be able to handle all of those cases.
|
|
1984
|
+
*/
|
|
1985
|
+
"renderPosition"?: "interstitial" | "top" | "bottom";
|
|
1986
|
+
/**
|
|
1987
|
+
* The id of the Searchcraft instance that this component should use.
|
|
1988
|
+
*/
|
|
1989
|
+
"searchcraftId"?: string;
|
|
1786
1990
|
}
|
|
1787
1991
|
/**
|
|
1788
1992
|
* This web component represents a button.
|
|
@@ -1858,6 +2062,10 @@ declare namespace LocalJSX {
|
|
|
1858
2062
|
"onFacetSelectionUpdated"?: (event: SearchcraftFacetListCustomEvent<{
|
|
1859
2063
|
paths: string[];
|
|
1860
2064
|
}>) => void;
|
|
2065
|
+
/**
|
|
2066
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2067
|
+
*/
|
|
2068
|
+
"searchcraftId"?: string;
|
|
1861
2069
|
}
|
|
1862
2070
|
/**
|
|
1863
2071
|
* This web component represents a series of filters that allows users to refine and control their search queries by applying various filter criteria.
|
|
@@ -1890,6 +2098,10 @@ declare namespace LocalJSX {
|
|
|
1890
2098
|
* The items to filter.
|
|
1891
2099
|
*/
|
|
1892
2100
|
"items"?: FilterItem[];
|
|
2101
|
+
/**
|
|
2102
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2103
|
+
*/
|
|
2104
|
+
"searchcraftId"?: string;
|
|
1893
2105
|
}
|
|
1894
2106
|
/**
|
|
1895
2107
|
* This web component provides a user-friendly interface for querying an indexed dataset, enabling users to easily search large collections of data.
|
|
@@ -1923,7 +2135,6 @@ declare namespace LocalJSX {
|
|
|
1923
2135
|
* Where to place the search button.
|
|
1924
2136
|
*/
|
|
1925
2137
|
"buttonPlacement"?: "left" | "right" | "none";
|
|
1926
|
-
"core"?: SearchcraftCore;
|
|
1927
2138
|
/**
|
|
1928
2139
|
* The label rendered above the input.
|
|
1929
2140
|
*/
|
|
@@ -1948,6 +2159,10 @@ declare namespace LocalJSX {
|
|
|
1948
2159
|
* The input element's placeholder value.
|
|
1949
2160
|
*/
|
|
1950
2161
|
"placeholderValue"?: string;
|
|
2162
|
+
/**
|
|
2163
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2164
|
+
*/
|
|
2165
|
+
"searchcraftId"?: string;
|
|
1951
2166
|
}
|
|
1952
2167
|
/**
|
|
1953
2168
|
* This web component serves as the input label for the searchcraft-input-form component.
|
|
@@ -1962,6 +2177,12 @@ declare namespace LocalJSX {
|
|
|
1962
2177
|
"inputLabelClassName"?: string | undefined;
|
|
1963
2178
|
"label"?: string;
|
|
1964
2179
|
}
|
|
2180
|
+
/**
|
|
2181
|
+
* Renders a loading spinner/loading state for use in things like the summary box.
|
|
2182
|
+
*/
|
|
2183
|
+
interface SearchcraftLoading {
|
|
2184
|
+
"label"?: string;
|
|
2185
|
+
}
|
|
1965
2186
|
/**
|
|
1966
2187
|
* This web component is designed to facilitate pagination of search results. Once a query is submitted, calculates the number for pages.
|
|
1967
2188
|
* @react-import ```jsx
|
|
@@ -1981,6 +2202,10 @@ declare namespace LocalJSX {
|
|
|
1981
2202
|
* ```
|
|
1982
2203
|
*/
|
|
1983
2204
|
interface SearchcraftPagination {
|
|
2205
|
+
/**
|
|
2206
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2207
|
+
*/
|
|
2208
|
+
"searchcraftId"?: string;
|
|
1984
2209
|
}
|
|
1985
2210
|
/**
|
|
1986
2211
|
* Renders a button which, when clicked, turns on popover visibility.
|
|
@@ -2023,6 +2248,10 @@ declare namespace LocalJSX {
|
|
|
2023
2248
|
* ```
|
|
2024
2249
|
*/
|
|
2025
2250
|
interface SearchcraftPopoverButton {
|
|
2251
|
+
/**
|
|
2252
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2253
|
+
*/
|
|
2254
|
+
"searchcraftId"?: string;
|
|
2026
2255
|
/**
|
|
2027
2256
|
* A callback function responsible for rendering the button contents.
|
|
2028
2257
|
*/
|
|
@@ -2036,6 +2265,10 @@ declare namespace LocalJSX {
|
|
|
2036
2265
|
* Renders the footer for the searchcraft-popover-form.
|
|
2037
2266
|
*/
|
|
2038
2267
|
interface SearchcraftPopoverFooter {
|
|
2268
|
+
/**
|
|
2269
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2270
|
+
*/
|
|
2271
|
+
"searchcraftId"?: string;
|
|
2039
2272
|
}
|
|
2040
2273
|
/**
|
|
2041
2274
|
* This web component is designed to display search results in a popover container that dynamically appears when the user interacts with a search input field, or when a popover-button is pressed.
|
|
@@ -2074,6 +2307,10 @@ declare namespace LocalJSX {
|
|
|
2074
2307
|
* Formats the content rendered for each result.
|
|
2075
2308
|
*/
|
|
2076
2309
|
"popoverResultMappings"?: PopoverResultMappings;
|
|
2310
|
+
/**
|
|
2311
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2312
|
+
*/
|
|
2313
|
+
"searchcraftId"?: string;
|
|
2077
2314
|
/**
|
|
2078
2315
|
* The type of popover form to render. - `inline` - Renders inline with the rest of the content on the page. The search results pop over the page content. - `fullscreen` - Renders in fullscreen view. Used together with the `searchcraft-popover-button` component. - `modal` - Renders in a modal view. Used together with the `searchcraft-popover-button` component.
|
|
2079
2316
|
*/
|
|
@@ -2089,6 +2326,10 @@ declare namespace LocalJSX {
|
|
|
2089
2326
|
"documentPosition"?: number;
|
|
2090
2327
|
"item"?: SearchClientResponseItem | undefined;
|
|
2091
2328
|
"popoverResultMappings"?: PopoverResultMappings | undefined;
|
|
2329
|
+
/**
|
|
2330
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2331
|
+
*/
|
|
2332
|
+
"searchcraftId"?: string;
|
|
2092
2333
|
}
|
|
2093
2334
|
/**
|
|
2094
2335
|
* This web component is designed to display a list of results within a popover interface.
|
|
@@ -2109,6 +2350,10 @@ declare namespace LocalJSX {
|
|
|
2109
2350
|
"searchClientResponseItems"?: SearchClientResponseItem[] | undefined;
|
|
2110
2351
|
"searchResultsPage": number;
|
|
2111
2352
|
"searchResultsPerPage": number;
|
|
2353
|
+
/**
|
|
2354
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2355
|
+
*/
|
|
2356
|
+
"searchcraftId"?: string;
|
|
2112
2357
|
}
|
|
2113
2358
|
/**
|
|
2114
2359
|
* This web component is designed to display the number of results returned from a search query.
|
|
@@ -2145,6 +2390,10 @@ declare namespace LocalJSX {
|
|
|
2145
2390
|
* ```
|
|
2146
2391
|
*/
|
|
2147
2392
|
interface SearchcraftResultsInfo {
|
|
2393
|
+
/**
|
|
2394
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2395
|
+
*/
|
|
2396
|
+
"searchcraftId"?: string;
|
|
2148
2397
|
/**
|
|
2149
2398
|
* A callback function responsible for rendering the results info.
|
|
2150
2399
|
*/
|
|
@@ -2163,6 +2412,10 @@ declare namespace LocalJSX {
|
|
|
2163
2412
|
*/
|
|
2164
2413
|
"index": number;
|
|
2165
2414
|
"item"?: SearchClientResponseItem;
|
|
2415
|
+
/**
|
|
2416
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2417
|
+
*/
|
|
2418
|
+
"searchcraftId"?: string;
|
|
2166
2419
|
/**
|
|
2167
2420
|
* A callback function responsible for rendering a result.
|
|
2168
2421
|
*/
|
|
@@ -2214,6 +2467,10 @@ declare namespace LocalJSX {
|
|
|
2214
2467
|
* A query that will appears when the component initializes or the search term is ''..
|
|
2215
2468
|
*/
|
|
2216
2469
|
"initialQuery"?: string;
|
|
2470
|
+
/**
|
|
2471
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2472
|
+
*/
|
|
2473
|
+
"searchcraftId"?: string;
|
|
2217
2474
|
/**
|
|
2218
2475
|
* A callback function responsible for rendering a result. Passed to `searchcraft-search-result`.
|
|
2219
2476
|
*/
|
|
@@ -2243,6 +2500,10 @@ declare namespace LocalJSX {
|
|
|
2243
2500
|
* The amount the options will increase (e.g. 20 = [20, 40, 60, 80, 100]). The base value is defined by the `searchResultsPerPage` option in the configuration.
|
|
2244
2501
|
*/
|
|
2245
2502
|
"increment"?: string | number;
|
|
2503
|
+
/**
|
|
2504
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2505
|
+
*/
|
|
2506
|
+
"searchcraftId"?: string;
|
|
2246
2507
|
}
|
|
2247
2508
|
/**
|
|
2248
2509
|
* This web component is designed to allow users to select between a group of options.
|
|
@@ -2318,6 +2579,33 @@ declare namespace LocalJSX {
|
|
|
2318
2579
|
*/
|
|
2319
2580
|
"step"?: number;
|
|
2320
2581
|
}
|
|
2582
|
+
/**
|
|
2583
|
+
* This component renders a summary box for RAG search result summaries.
|
|
2584
|
+
* When the user makes a search, a network call is made to retrieve the summary content, which is then
|
|
2585
|
+
* rendered in this box.
|
|
2586
|
+
* NOTE: This component requires the usage of a read key that has "SUMMARY" permissions.
|
|
2587
|
+
* @react-import ```jsx
|
|
2588
|
+
* import { SearchcraftSummaryBox } from "@searchcraft/react-sdk";
|
|
2589
|
+
* ```
|
|
2590
|
+
* @vue-import ```jsx
|
|
2591
|
+
* import { SearchcraftSummaryBox } from "@searchcraft/vue-sdk";
|
|
2592
|
+
* ```
|
|
2593
|
+
* @js-example ```html
|
|
2594
|
+
* <searchcraft-summary-box />
|
|
2595
|
+
* ```
|
|
2596
|
+
* @react-example ```jsx
|
|
2597
|
+
* <SearchcraftSummaryBox />
|
|
2598
|
+
* ```
|
|
2599
|
+
* @vue-example ```jsx
|
|
2600
|
+
* <SearchcraftSummaryBox />
|
|
2601
|
+
* ```
|
|
2602
|
+
*/
|
|
2603
|
+
interface SearchcraftSummaryBox {
|
|
2604
|
+
/**
|
|
2605
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2606
|
+
*/
|
|
2607
|
+
"searchcraftId"?: string;
|
|
2608
|
+
}
|
|
2321
2609
|
/**
|
|
2322
2610
|
* 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.'
|
|
2323
2611
|
* @react-import ```jsx
|
|
@@ -2350,6 +2638,10 @@ declare namespace LocalJSX {
|
|
|
2350
2638
|
* When the toggle element is changed.
|
|
2351
2639
|
*/
|
|
2352
2640
|
"onToggleUpdated"?: (event: SearchcraftToggleButtonCustomEvent<boolean>) => void;
|
|
2641
|
+
/**
|
|
2642
|
+
* The id of the Searchcraft instance that this component should use.
|
|
2643
|
+
*/
|
|
2644
|
+
"searchcraftId"?: string;
|
|
2353
2645
|
/**
|
|
2354
2646
|
* The secondary label displayed below the main label.
|
|
2355
2647
|
*/
|
|
@@ -2363,6 +2655,7 @@ declare namespace LocalJSX {
|
|
|
2363
2655
|
"searchcraft-filter-panel": SearchcraftFilterPanel;
|
|
2364
2656
|
"searchcraft-input-form": SearchcraftInputForm;
|
|
2365
2657
|
"searchcraft-input-label": SearchcraftInputLabel;
|
|
2658
|
+
"searchcraft-loading": SearchcraftLoading;
|
|
2366
2659
|
"searchcraft-pagination": SearchcraftPagination;
|
|
2367
2660
|
"searchcraft-popover-button": SearchcraftPopoverButton;
|
|
2368
2661
|
"searchcraft-popover-footer": SearchcraftPopoverFooter;
|
|
@@ -2375,6 +2668,7 @@ declare namespace LocalJSX {
|
|
|
2375
2668
|
"searchcraft-search-results-per-page": SearchcraftSearchResultsPerPage;
|
|
2376
2669
|
"searchcraft-select": SearchcraftSelect;
|
|
2377
2670
|
"searchcraft-slider": SearchcraftSlider;
|
|
2671
|
+
"searchcraft-summary-box": SearchcraftSummaryBox;
|
|
2378
2672
|
"searchcraft-theme": SearchcraftTheme;
|
|
2379
2673
|
"searchcraft-toggle-button": SearchcraftToggleButton;
|
|
2380
2674
|
}
|
|
@@ -2470,6 +2764,10 @@ declare module "@stencil/core" {
|
|
|
2470
2764
|
* ```
|
|
2471
2765
|
*/
|
|
2472
2766
|
"searchcraft-input-label": LocalJSX.SearchcraftInputLabel & JSXBase.HTMLAttributes<HTMLSearchcraftInputLabelElement>;
|
|
2767
|
+
/**
|
|
2768
|
+
* Renders a loading spinner/loading state for use in things like the summary box.
|
|
2769
|
+
*/
|
|
2770
|
+
"searchcraft-loading": LocalJSX.SearchcraftLoading & JSXBase.HTMLAttributes<HTMLSearchcraftLoadingElement>;
|
|
2473
2771
|
/**
|
|
2474
2772
|
* This web component is designed to facilitate pagination of search results. Once a query is submitted, calculates the number for pages.
|
|
2475
2773
|
* @react-import ```jsx
|
|
@@ -2688,6 +2986,28 @@ declare module "@stencil/core" {
|
|
|
2688
2986
|
* This web component is designed to allow users to select a value from a range defined by a minimum and maximum value. The component renders a slider interface, which can be used to visually choose a value between two boundaries.
|
|
2689
2987
|
*/
|
|
2690
2988
|
"searchcraft-slider": LocalJSX.SearchcraftSlider & JSXBase.HTMLAttributes<HTMLSearchcraftSliderElement>;
|
|
2989
|
+
/**
|
|
2990
|
+
* This component renders a summary box for RAG search result summaries.
|
|
2991
|
+
* When the user makes a search, a network call is made to retrieve the summary content, which is then
|
|
2992
|
+
* rendered in this box.
|
|
2993
|
+
* NOTE: This component requires the usage of a read key that has "SUMMARY" permissions.
|
|
2994
|
+
* @react-import ```jsx
|
|
2995
|
+
* import { SearchcraftSummaryBox } from "@searchcraft/react-sdk";
|
|
2996
|
+
* ```
|
|
2997
|
+
* @vue-import ```jsx
|
|
2998
|
+
* import { SearchcraftSummaryBox } from "@searchcraft/vue-sdk";
|
|
2999
|
+
* ```
|
|
3000
|
+
* @js-example ```html
|
|
3001
|
+
* <searchcraft-summary-box />
|
|
3002
|
+
* ```
|
|
3003
|
+
* @react-example ```jsx
|
|
3004
|
+
* <SearchcraftSummaryBox />
|
|
3005
|
+
* ```
|
|
3006
|
+
* @vue-example ```jsx
|
|
3007
|
+
* <SearchcraftSummaryBox />
|
|
3008
|
+
* ```
|
|
3009
|
+
*/
|
|
3010
|
+
"searchcraft-summary-box": LocalJSX.SearchcraftSummaryBox & JSXBase.HTMLAttributes<HTMLSearchcraftSummaryBoxElement>;
|
|
2691
3011
|
/**
|
|
2692
3012
|
* 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.'
|
|
2693
3013
|
* @react-import ```jsx
|
|
@@ -2948,11 +3268,31 @@ export interface SearchcraftSearchResultsPerPageProps extends Components.Searchc
|
|
|
2948
3268
|
* ```
|
|
2949
3269
|
*/
|
|
2950
3270
|
export declare const SearchcraftSearchResultsPerPage: import("vue").DefineSetupFnComponent<LocalJSX.SearchcraftSearchResultsPerPage & import("@stencil/vue-output-target/runtime").InputProps<string | number | boolean>, {}, {}, LocalJSX.SearchcraftSearchResultsPerPage & import("@stencil/vue-output-target/runtime").InputProps<string | number | boolean>, import("vue").PublicProps>;
|
|
3271
|
+
/**
|
|
3272
|
+
* The Props Used by the `SearchcraftSummaryBox` Component.
|
|
3273
|
+
*/
|
|
3274
|
+
export interface SearchcraftSummaryBoxProps extends Components.SearchcraftSummaryBox {
|
|
3275
|
+
}
|
|
3276
|
+
/**
|
|
3277
|
+
* This React component displays an ai-generated summary of the given search term.
|
|
3278
|
+
*
|
|
3279
|
+
* @example
|
|
3280
|
+
* ```vue
|
|
3281
|
+
* <script setup>
|
|
3282
|
+
* import SearchcraftSummaryBox from '@searchcraft/vue-sdk';
|
|
3283
|
+
* </script>
|
|
3284
|
+
*
|
|
3285
|
+
* <template>
|
|
3286
|
+
* <SearchcraftSummaryBox />
|
|
3287
|
+
* </template>
|
|
3288
|
+
* ```
|
|
3289
|
+
*/
|
|
3290
|
+
export declare const SearchcraftSummaryBox: import("vue").DefineSetupFnComponent<LocalJSX.SearchcraftSummaryBox & import("@stencil/vue-output-target/runtime").InputProps<string | number | boolean>, {}, {}, LocalJSX.SearchcraftSummaryBox & import("@stencil/vue-output-target/runtime").InputProps<string | number | boolean>, import("vue").PublicProps>;
|
|
2951
3291
|
/**
|
|
2952
3292
|
* The consumer-facing Searchcraft class.
|
|
2953
3293
|
*/
|
|
2954
3294
|
export declare class Searchcraft extends SearchcraftCore {
|
|
2955
|
-
constructor(config: SearchcraftConfig);
|
|
3295
|
+
constructor(config: SearchcraftConfig, searchcraftId?: string | undefined);
|
|
2956
3296
|
}
|
|
2957
3297
|
|
|
2958
3298
|
export {
|