@seekora-ai/search-sdk 0.2.21 → 0.2.23
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/analytics/activeFilters.d.ts +33 -0
- package/dist/analytics/activeFilters.js +145 -0
- package/dist/analytics/events.d.ts +26 -0
- package/dist/analytics/events.js +38 -0
- package/dist/analytics/index.d.ts +6 -0
- package/dist/analytics/index.js +55 -0
- package/dist/analytics/loadAnalytics.d.ts +37 -0
- package/dist/analytics/loadAnalytics.js +70 -0
- package/dist/analytics/searchId.d.ts +26 -0
- package/dist/analytics/searchId.js +102 -0
- package/dist/analytics/track.d.ts +59 -0
- package/dist/analytics/track.js +130 -0
- package/dist/analytics/types.gen.d.ts +781 -0
- package/dist/analytics/types.gen.js +6 -0
- package/dist/client.d.ts +82 -17
- package/dist/client.js +588 -414
- package/dist/index.d.ts +13 -12
- package/dist/index.js +39 -1
- package/package.json +9 -3
package/dist/client.d.ts
CHANGED
|
@@ -2,16 +2,36 @@
|
|
|
2
2
|
* Seekora SDK Client
|
|
3
3
|
* High-level wrapper around generated OpenAPI client
|
|
4
4
|
*/
|
|
5
|
-
import type { DataTypesIndexConfig, DataTypesEventPayload, DataTypesFiltersResponse, DataTypesFacetValuesSearchResponse, DataTypesFiltersSchemaResponse, DataTypesFilterField, DataTypesFilterValue, DataTypesFilterStats, DataTypesFilterSchemaField } from
|
|
6
|
-
import { type SeekoraEnvironment } from
|
|
7
|
-
import { Logger, type LogLevel, type LoggerConfig } from
|
|
8
|
-
import { type ContextCollectorConfig, type BrowserContext } from
|
|
9
|
-
import { EventQueue, type EventQueueConfig } from
|
|
5
|
+
import type { DataTypesIndexConfig, DataTypesEventPayload, DataTypesFiltersResponse, DataTypesFacetValuesSearchResponse, DataTypesFiltersSchemaResponse, DataTypesFilterField, DataTypesFilterValue, DataTypesFilterStats, DataTypesFilterSchemaField } from "./generated";
|
|
6
|
+
import { type SeekoraEnvironment } from "./config";
|
|
7
|
+
import { Logger, type LogLevel, type LoggerConfig } from "./logger";
|
|
8
|
+
import { type ContextCollectorConfig, type BrowserContext } from "./context-collector";
|
|
9
|
+
import { EventQueue, type EventQueueConfig } from "./event-queue";
|
|
10
10
|
export interface SeekoraClientConfig {
|
|
11
11
|
storeId?: string;
|
|
12
|
+
/** Alias for readSecret — accepted for convenience */
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
/** Alias for baseUrl host — accepted for convenience */
|
|
15
|
+
apiHost?: string;
|
|
12
16
|
readSecret?: string;
|
|
13
17
|
writeSecret?: string;
|
|
14
18
|
baseUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Jitsu per-site analytics write key (from tjitsu_sites.write_key on the
|
|
21
|
+
* Seekora backend). When unset, all track/identify calls become no-ops
|
|
22
|
+
* — events are NOT sent to the Seekora backend or anywhere else.
|
|
23
|
+
* SCRUM-259 V4 analytics: this is distinct from writeSecret (which is
|
|
24
|
+
* the Seekora store API write secret).
|
|
25
|
+
*/
|
|
26
|
+
jitsuWriteKey?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Jitsu Ingest endpoint base URL (e.g. https://jitsu.seekora.ai). Used
|
|
29
|
+
* as the analytics-next cdnURL so events flow to the correct CDP.
|
|
30
|
+
* When unset, analytics-next defaults to its hosted endpoint which is
|
|
31
|
+
* NOT where Seekora events should land — pair with jitsuWriteKey.
|
|
32
|
+
* SCRUM-259 V4 analytics.
|
|
33
|
+
*/
|
|
34
|
+
jitsuIngestUrl?: string;
|
|
15
35
|
environment?: SeekoraEnvironment;
|
|
16
36
|
timeout?: number;
|
|
17
37
|
logLevel?: LogLevel;
|
|
@@ -64,7 +84,7 @@ export interface SeekoraClientConfig {
|
|
|
64
84
|
include_dropdown_product_list?: boolean;
|
|
65
85
|
include_filtered_tabs?: boolean;
|
|
66
86
|
hitsPerPage?: number;
|
|
67
|
-
time_range?:
|
|
87
|
+
time_range?: "7d" | "30d" | "90d";
|
|
68
88
|
[key: string]: unknown;
|
|
69
89
|
};
|
|
70
90
|
/**
|
|
@@ -190,8 +210,8 @@ export interface SearchOptions {
|
|
|
190
210
|
include_snippets?: boolean;
|
|
191
211
|
group_field?: string;
|
|
192
212
|
group_size?: number;
|
|
193
|
-
prefix_mode?:
|
|
194
|
-
infix_mode?:
|
|
213
|
+
prefix_mode?: "always" | "fallback" | "false";
|
|
214
|
+
infix_mode?: "always" | "fallback" | "false";
|
|
195
215
|
typo_max?: number;
|
|
196
216
|
typo_min_len_1?: number;
|
|
197
217
|
typo_min_len_2?: number;
|
|
@@ -312,7 +332,7 @@ export interface DeleteDocumentResponse {
|
|
|
312
332
|
*/
|
|
313
333
|
export interface SchemaField {
|
|
314
334
|
name: string;
|
|
315
|
-
type:
|
|
335
|
+
type: "string" | "int32" | "int64" | "float" | "bool" | "string[]" | "int32[]" | "int64[]" | "float[]" | "bool[]" | "object" | "object[]" | "auto" | "geopoint" | "geopoint[]";
|
|
316
336
|
facet?: boolean;
|
|
317
337
|
index?: boolean;
|
|
318
338
|
optional?: boolean;
|
|
@@ -325,7 +345,7 @@ export interface SchemaField {
|
|
|
325
345
|
*/
|
|
326
346
|
export interface CreateSchemaRequest {
|
|
327
347
|
fields: SchemaField[];
|
|
328
|
-
mode?:
|
|
348
|
+
mode?: "additive" | "replace";
|
|
329
349
|
confirmDelete?: boolean;
|
|
330
350
|
defaultSortingField?: string;
|
|
331
351
|
enableNestedFields?: boolean;
|
|
@@ -377,6 +397,13 @@ export declare class SeekoraClient {
|
|
|
377
397
|
private deduplicationWindow;
|
|
378
398
|
private abTestId?;
|
|
379
399
|
private abVariant?;
|
|
400
|
+
private _analytics;
|
|
401
|
+
/**
|
|
402
|
+
* Lazy-init analytics-next. Returns null when Jitsu config is incomplete
|
|
403
|
+
* (jitsuWriteKey missing) so callers no-op rather than firing events
|
|
404
|
+
* with the wrong credential to the wrong endpoint. SCRUM-259.
|
|
405
|
+
*/
|
|
406
|
+
private getAnalytics;
|
|
380
407
|
constructor(config?: SeekoraClientConfig);
|
|
381
408
|
/**
|
|
382
409
|
* Search for documents
|
|
@@ -420,13 +447,13 @@ export declare class SeekoraClient {
|
|
|
420
447
|
hitsPerPage?: number;
|
|
421
448
|
page?: number;
|
|
422
449
|
analytics_tags?: string | string[];
|
|
423
|
-
tags_match_mode?:
|
|
450
|
+
tags_match_mode?: "any" | "all";
|
|
424
451
|
include_categories?: boolean;
|
|
425
452
|
include_facets?: boolean;
|
|
426
453
|
max_categories?: number;
|
|
427
454
|
max_facets?: number;
|
|
428
455
|
min_popularity?: number;
|
|
429
|
-
time_range?:
|
|
456
|
+
time_range?: "7d" | "30d" | "90d";
|
|
430
457
|
disable_typo_tolerance?: boolean;
|
|
431
458
|
include_dropdown_recommendations?: boolean;
|
|
432
459
|
/** When false, omit product hits list from dropdown result (default true) */
|
|
@@ -636,16 +663,54 @@ export declare class SeekoraClient {
|
|
|
636
663
|
event_name?: string;
|
|
637
664
|
})[], context?: SearchContext): Promise<void>;
|
|
638
665
|
/**
|
|
639
|
-
* Track a search event
|
|
666
|
+
* Track a search event (Segment "Products Searched" spec)
|
|
640
667
|
*
|
|
641
668
|
* @param params - Search tracking parameters
|
|
642
669
|
*/
|
|
643
670
|
trackSearch(params: {
|
|
644
671
|
query: string;
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
672
|
+
/** Segment Spec field name */
|
|
673
|
+
numFound?: number;
|
|
674
|
+
/** Legacy alias from V3-era seekora-ui-sdk — still accepted */
|
|
675
|
+
resultsCount?: number;
|
|
676
|
+
results?: Array<{
|
|
677
|
+
id: string;
|
|
678
|
+
sku?: string;
|
|
679
|
+
category?: string;
|
|
680
|
+
[key: string]: any;
|
|
681
|
+
}>;
|
|
682
|
+
searchId?: string;
|
|
683
|
+
latencyMs?: number;
|
|
684
|
+
engine?: string;
|
|
685
|
+
/** Legacy V3 fields tolerated for backward compat */
|
|
686
|
+
context?: unknown;
|
|
687
|
+
analyticsTags?: unknown;
|
|
688
|
+
metadata?: unknown;
|
|
689
|
+
}): Promise<void>;
|
|
690
|
+
/**
|
|
691
|
+
* Track a product click event (Segment "Product Clicked" spec)
|
|
692
|
+
*
|
|
693
|
+
* @param params - Product click parameters
|
|
694
|
+
*/
|
|
695
|
+
trackProductClick(params: {
|
|
696
|
+
productId: string;
|
|
697
|
+
sku?: string;
|
|
698
|
+
position?: number;
|
|
699
|
+
searchId?: string;
|
|
700
|
+
[key: string]: any;
|
|
701
|
+
}): Promise<void>;
|
|
702
|
+
/**
|
|
703
|
+
* Track a product impression event (Segment "Product Viewed" spec)
|
|
704
|
+
*
|
|
705
|
+
* @param params - Product impression parameters
|
|
706
|
+
*/
|
|
707
|
+
trackProductImpression(params: {
|
|
708
|
+
productId: string;
|
|
709
|
+
sku?: string;
|
|
710
|
+
position?: number;
|
|
711
|
+
searchId?: string;
|
|
712
|
+
category?: string;
|
|
713
|
+
[key: string]: any;
|
|
649
714
|
}): Promise<void>;
|
|
650
715
|
/**
|
|
651
716
|
* Track an impression event
|