@seekora-ai/search-sdk 0.2.6 → 0.2.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/cdn/seekora-sdk.js +30 -19
- package/cdn/seekora-sdk.min.js +12 -12
- package/dist/client.d.ts +17 -0
- package/dist/client.js +10 -4
- package/dist/generated/api.d.ts +8 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -54,6 +54,18 @@ export interface SeekoraClientConfig {
|
|
|
54
54
|
* Event queue configuration
|
|
55
55
|
*/
|
|
56
56
|
eventQueue?: EventQueueConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Default options for getSuggestions(); merged with per-call options (per-call overrides).
|
|
59
|
+
* Use to set e.g. include_dropdown_product_list: false, include_filtered_tabs: false for all suggestion calls.
|
|
60
|
+
*/
|
|
61
|
+
suggestionsDefaults?: {
|
|
62
|
+
include_dropdown_recommendations?: boolean;
|
|
63
|
+
include_dropdown_product_list?: boolean;
|
|
64
|
+
include_filtered_tabs?: boolean;
|
|
65
|
+
hitsPerPage?: number;
|
|
66
|
+
time_range?: '7d' | '30d' | '90d';
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
};
|
|
57
69
|
}
|
|
58
70
|
/**
|
|
59
71
|
* Search context containing identifiers for linking events to searches
|
|
@@ -269,6 +281,7 @@ export declare class SeekoraClient {
|
|
|
269
281
|
private cachedBrowserContext;
|
|
270
282
|
private enableEventQueue;
|
|
271
283
|
private eventQueue;
|
|
284
|
+
private clientConfig;
|
|
272
285
|
constructor(config?: SeekoraClientConfig);
|
|
273
286
|
/**
|
|
274
287
|
* Search for documents
|
|
@@ -304,6 +317,10 @@ export declare class SeekoraClient {
|
|
|
304
317
|
time_range?: '7d' | '30d' | '90d';
|
|
305
318
|
disable_typo_tolerance?: boolean;
|
|
306
319
|
include_dropdown_recommendations?: boolean;
|
|
320
|
+
/** When false, omit product hits list from dropdown result (default true) */
|
|
321
|
+
include_dropdown_product_list?: boolean;
|
|
322
|
+
/** When false, omit filtered_tabs from dropdown extensions (default true) */
|
|
323
|
+
include_filtered_tabs?: boolean;
|
|
307
324
|
filtered_tabs?: Array<{
|
|
308
325
|
id?: string;
|
|
309
326
|
label: string;
|
package/dist/client.js
CHANGED
|
@@ -25,6 +25,7 @@ class SeekoraClient {
|
|
|
25
25
|
constructor(config = {}) {
|
|
26
26
|
this.cachedBrowserContext = null;
|
|
27
27
|
this.eventQueue = null;
|
|
28
|
+
this.clientConfig = config;
|
|
28
29
|
// Load configuration from file, env, and code (in that order)
|
|
29
30
|
const mergedConfig = (0, config_loader_1.loadConfig)(config);
|
|
30
31
|
this.storeId = mergedConfig.storeId;
|
|
@@ -324,20 +325,25 @@ class SeekoraClient {
|
|
|
324
325
|
if (this.sessionId)
|
|
325
326
|
headers['x-session-id'] = this.sessionId;
|
|
326
327
|
const usePost = (options?.filtered_tabs && options.filtered_tabs.length > 0) ||
|
|
327
|
-
options?.include_dropdown_recommendations === true
|
|
328
|
+
options?.include_dropdown_recommendations === true ||
|
|
329
|
+
options?.include_dropdown_product_list === false ||
|
|
330
|
+
options?.include_filtered_tabs === false;
|
|
331
|
+
const defaults = this.clientConfig?.suggestionsDefaults;
|
|
328
332
|
const buildRequestBody = () => {
|
|
329
333
|
const body = {
|
|
330
334
|
query,
|
|
331
|
-
hitsPerPage: options?.hitsPerPage
|
|
335
|
+
hitsPerPage: options?.hitsPerPage ?? defaults?.hitsPerPage ?? 5,
|
|
332
336
|
page: options?.page,
|
|
333
337
|
include_categories: options?.include_categories,
|
|
334
338
|
include_facets: options?.include_facets,
|
|
335
339
|
max_categories: options?.max_categories,
|
|
336
340
|
max_facets: options?.max_facets,
|
|
337
341
|
min_popularity: options?.min_popularity,
|
|
338
|
-
time_range: options?.time_range,
|
|
342
|
+
time_range: options?.time_range ?? defaults?.time_range,
|
|
339
343
|
disable_typo_tolerance: options?.disable_typo_tolerance,
|
|
340
|
-
include_dropdown_recommendations: options?.include_dropdown_recommendations,
|
|
344
|
+
include_dropdown_recommendations: options?.include_dropdown_recommendations ?? defaults?.include_dropdown_recommendations,
|
|
345
|
+
include_dropdown_product_list: options?.include_dropdown_product_list ?? defaults?.include_dropdown_product_list,
|
|
346
|
+
include_filtered_tabs: options?.include_filtered_tabs ?? defaults?.include_filtered_tabs,
|
|
341
347
|
filtered_tabs: options?.filtered_tabs,
|
|
342
348
|
};
|
|
343
349
|
if (options?.analytics_tags) {
|
package/dist/generated/api.d.ts
CHANGED
|
@@ -10295,6 +10295,10 @@ export interface QuerySuggestionsServiceQuerySuggestionsRequest {
|
|
|
10295
10295
|
* Include category information
|
|
10296
10296
|
*/
|
|
10297
10297
|
'include_categories'?: boolean;
|
|
10298
|
+
/**
|
|
10299
|
+
* Optional: disable parts of dropdown when include_dropdown_recommendations=true (default true = include)
|
|
10300
|
+
*/
|
|
10301
|
+
'include_dropdown_product_list'?: boolean;
|
|
10298
10302
|
/**
|
|
10299
10303
|
* Rich dropdown recommendations (optional, data-agnostic)
|
|
10300
10304
|
*/
|
|
@@ -10307,6 +10311,10 @@ export interface QuerySuggestionsServiceQuerySuggestionsRequest {
|
|
|
10307
10311
|
* Include facet information
|
|
10308
10312
|
*/
|
|
10309
10313
|
'include_facets'?: boolean;
|
|
10314
|
+
/**
|
|
10315
|
+
* When false, omit filtered_tabs from dropdown extensions (default true)
|
|
10316
|
+
*/
|
|
10317
|
+
'include_filtered_tabs'?: boolean;
|
|
10310
10318
|
/**
|
|
10311
10319
|
* Max categories per suggestion (default: 3)
|
|
10312
10320
|
*/
|