@findlane/server 0.19.0 → 0.21.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.cjs +2 -1
- package/dist/index.d.cts +119 -8
- package/dist/index.d.ts +119 -8
- package/dist/index.js +2 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -318,7 +318,8 @@ class SearchServerClient {
|
|
|
318
318
|
events: (options = {}) => report("events", options),
|
|
319
319
|
products: (options = {}) => report("products", options),
|
|
320
320
|
productCounts: (options = {}) => report("product-counts", options),
|
|
321
|
-
product: (objectID, options = {}) => report(`products/${encodeURIComponent(objectID)}`, options)
|
|
321
|
+
product: (objectID, options = {}) => report(`products/${encodeURIComponent(objectID)}`, options),
|
|
322
|
+
revenue: (options = {}) => report("revenue", options)
|
|
322
323
|
},
|
|
323
324
|
upsert: (records, signal) => request("/records", "POST", { records }, signal),
|
|
324
325
|
getRecord: (objectID, signal) => request(`/records/${encodeURIComponent(objectID)}`, "GET", undefined, signal),
|
package/dist/index.d.cts
CHANGED
|
@@ -121,9 +121,11 @@ export type QuerySuggestion = {
|
|
|
121
121
|
q: string;
|
|
122
122
|
typed?: [number, number];
|
|
123
123
|
};
|
|
124
|
-
/** When a
|
|
125
|
-
*
|
|
126
|
-
*
|
|
124
|
+
/** When a search meets a rule's `if`, the rule's `then` applies to that search: its words (one of the
|
|
125
|
+
* phrases), its filters (such as a category page's), the contexts it sends, and whether it has words; only
|
|
126
|
+
* between the rule's `active` times when it has them. Phrases are compared as synonyms are: without case,
|
|
127
|
+
* accents, or the index languages' stop words, and with their plurals and other spellings, so a rule for
|
|
128
|
+
* "balloon" also fires for "balloons". */
|
|
127
129
|
export type QueryRule = {
|
|
128
130
|
/** 1 to 64 letters, digits, `_`, `.`, `:`, or `-`, unique in the index. */
|
|
129
131
|
id: string;
|
|
@@ -131,25 +133,46 @@ export type QueryRule = {
|
|
|
131
133
|
description?: string;
|
|
132
134
|
/** false keeps the rule without applying it. Reading settings always returns it; true when left out. */
|
|
133
135
|
enabled?: boolean;
|
|
136
|
+
/** Fires only from `from` and before `until`, ISO 8601 times with their zone, such as
|
|
137
|
+
* "2026-11-27T00:00:00Z"; either may be left out (0.20.0). */
|
|
138
|
+
active?: {
|
|
139
|
+
from?: string;
|
|
140
|
+
until?: string;
|
|
141
|
+
};
|
|
142
|
+
/** Every condition given must hold; with none, the rule fires on every search. */
|
|
134
143
|
if: {
|
|
135
|
-
/** 1 to 20 phrases of one to four words. */
|
|
136
|
-
phrases
|
|
144
|
+
/** 1 to 20 phrases of one to four words. Reading settings returns [] for a rule without phrases. */
|
|
145
|
+
phrases?: string[];
|
|
137
146
|
/** The query is one of the phrases, starts with one, or contains one; "contains" when left out. */
|
|
138
147
|
match?: "is" | "startsWith" | "contains";
|
|
148
|
+
/** The search filters each field (1 to 10 filter fields) to one of these values, alone or in an `in`
|
|
149
|
+
* list, as a category page filters its category (0.20.0). */
|
|
150
|
+
filters?: Record<string, string | number | boolean | Array<string | number | boolean>>;
|
|
151
|
+
/** The search sends one of these contexts (its `context`), 1 to 10 names (0.20.0). */
|
|
152
|
+
context?: string[];
|
|
153
|
+
/** For a rule without phrases: only searches without words, such as a category page ("none"), or only
|
|
154
|
+
* with them ("some") (0.20.0). */
|
|
155
|
+
words?: "none" | "some";
|
|
139
156
|
};
|
|
140
157
|
/** One or more of these. `filters`, `boost` and `bury` take a search's filters, on 1 to 10 fields. */
|
|
141
158
|
then: {
|
|
142
159
|
/** Added to the search's filters, except on fields the search (or an earlier rule) already filters.
|
|
143
160
|
* Records without the field drop out, so `boost` is usually the better choice. */
|
|
144
161
|
filters?: SearchRequest["filters"];
|
|
145
|
-
/** Records matching these come before the others, after `rankFirst`'s groups, in searches
|
|
146
|
-
*
|
|
162
|
+
/** Records matching these come before the others, after `rankFirst`'s groups, in searches sorted by
|
|
163
|
+
* relevance, with words or without (0.20.0), but not named sorts or distance. Several rules' boosts add up. */
|
|
147
164
|
boost?: SearchRequest["filters"];
|
|
148
165
|
/** Records matching these come after the others, in the same searches as `boost`. */
|
|
149
166
|
bury?: SearchRequest["filters"];
|
|
150
167
|
/** Up to 100 objectIDs left out of the results. */
|
|
151
168
|
hide?: string[];
|
|
152
|
-
/**
|
|
169
|
+
/** 1 to 20 records at places from 1, on every sort, when they pass the search's filters (not necessarily its
|
|
170
|
+
* words); a later rule's pin at a taken place moves down (0.20.0). */
|
|
171
|
+
pin?: {
|
|
172
|
+
objectID: string;
|
|
173
|
+
position: number;
|
|
174
|
+
}[];
|
|
175
|
+
/** With phrases: words searched instead of the matched phrase, up to 64 characters; "" removes the phrase. */
|
|
153
176
|
replace?: string;
|
|
154
177
|
/** JSON up to 4 KB returned with the results in `appliedRules`, such as a banner or a redirect. */
|
|
155
178
|
userData?: unknown;
|
|
@@ -360,6 +383,17 @@ export type SearchRequest = {
|
|
|
360
383
|
/** With the index's `distinct` setting: false shows every record, a number 1 to 4 how many of each group's
|
|
361
384
|
* records. */
|
|
362
385
|
distinct?: boolean | number;
|
|
386
|
+
/** Contexts the page sends, which rules with a `context` condition fire on, such as "category-page": a
|
|
387
|
+
* name or up to 10, each 1 to 64 letters, digits, `_`, `:` or `-` (0.20.0). */
|
|
388
|
+
context?: string | string[];
|
|
389
|
+
/** Records matching these filters come first, after the index's rank first, in searches by relevance: filters as
|
|
390
|
+
* `filters` takes them, or a list of up to 10, each counting once, so records matching more come first (0.21.0). */
|
|
391
|
+
boost?: SearchRequest["filters"] | SearchRequest["filters"][];
|
|
392
|
+
/** Records matching these come last, the same way (0.21.0). */
|
|
393
|
+
bury?: SearchRequest["filters"] | SearchRequest["filters"][];
|
|
394
|
+
/** Checks rules as at this time, in milliseconds since 1970, such as a campaign's start, instead of now
|
|
395
|
+
* (0.20.0). Browser search doesn't take it. */
|
|
396
|
+
rulesAt?: number;
|
|
363
397
|
};
|
|
364
398
|
/** A point in degrees: lat from -90 to 90, lng from -180 to 180. */
|
|
365
399
|
export type GeoPoint = {
|
|
@@ -429,6 +463,14 @@ export type AppliedRule = {
|
|
|
429
463
|
id: string;
|
|
430
464
|
userData?: unknown;
|
|
431
465
|
};
|
|
466
|
+
/** A rule's banner: an image, where it links, its text, its place among the hits from 1, and the rule's ID. */
|
|
467
|
+
export type Banner = {
|
|
468
|
+
image: string;
|
|
469
|
+
link?: string;
|
|
470
|
+
title?: string;
|
|
471
|
+
position?: number;
|
|
472
|
+
rule: string;
|
|
473
|
+
};
|
|
432
474
|
export type SearchResponse<T> = {
|
|
433
475
|
hits: {
|
|
434
476
|
id: string;
|
|
@@ -452,6 +494,8 @@ export type SearchResponse<T> = {
|
|
|
452
494
|
variant?: {
|
|
453
495
|
index: number;
|
|
454
496
|
};
|
|
497
|
+
/** A rule pinned it at its place (0.20.0). */
|
|
498
|
+
pinned?: true;
|
|
455
499
|
}[];
|
|
456
500
|
/** The matches; with the index's `distinct` setting, the groups. */
|
|
457
501
|
total: number;
|
|
@@ -481,6 +525,11 @@ export type SearchResponse<T> = {
|
|
|
481
525
|
appliedRules?: AppliedRule[];
|
|
482
526
|
/** When a rule replaced words: the query that was searched. */
|
|
483
527
|
rewrittenQuery?: string;
|
|
528
|
+
/** Banners of the rules that fired, in their order (0.21.0): show each at its `position` among the hits (from
|
|
529
|
+
* 1; the top when left out), linking to `link`. */
|
|
530
|
+
banners?: Banner[];
|
|
531
|
+
/** A page a rule sends this search to, such as "/pages/returns" (0.21.0): go there instead of showing results. */
|
|
532
|
+
redirect?: string;
|
|
484
533
|
/** With the index's `relatedResults` on (0.18.0): when the query's words found nothing (`hits` empty,
|
|
485
534
|
* `total` 0), the products closest to it in meaning, best first, with their similarity as `score`. Show
|
|
486
535
|
* them under a heading of their own, such as "No exact matches. Related products". */
|
|
@@ -884,6 +933,65 @@ export type ProductReport = AnalyticsReport & {
|
|
|
884
933
|
together: number;
|
|
885
934
|
};
|
|
886
935
|
};
|
|
936
|
+
/** A query's search clicks, and the add-to-carts and orders of the products clicked, in the main currency.
|
|
937
|
+
* `searches` is its searches when it's one of the 1,000 most searched, else null. `typed`: shorter queries
|
|
938
|
+
* typed on the way to it, such as "perfor", whose clicks count here. */
|
|
939
|
+
export type RevenueQuery = {
|
|
940
|
+
query: string;
|
|
941
|
+
searches: number | null;
|
|
942
|
+
clicks: number;
|
|
943
|
+
carts: number;
|
|
944
|
+
orders: number;
|
|
945
|
+
revenue: number;
|
|
946
|
+
typed: string[];
|
|
947
|
+
};
|
|
948
|
+
/** A product's orders and their value, beside those found through search, and the query it was found by most. */
|
|
949
|
+
export type RevenueProduct = {
|
|
950
|
+
objectID: string;
|
|
951
|
+
title: string;
|
|
952
|
+
image: string | null;
|
|
953
|
+
orders: number;
|
|
954
|
+
revenue: number;
|
|
955
|
+
searchOrders: number;
|
|
956
|
+
searchRevenue: number;
|
|
957
|
+
topQuery: string | null;
|
|
958
|
+
};
|
|
959
|
+
/** Revenue from search (0.20.0): purchases and add-to-carts of products the shopper clicked in search results in
|
|
960
|
+
* the 24 hours before, by the same visitor ID, so it needs the index's visitor IDs on and purchases sent as
|
|
961
|
+
* events. Each order counts once; amounts are in the main `currency` (the most orders'), at the prices the
|
|
962
|
+
* events carry, and other currencies' orders are listed apart. Exact, from every event kept, like `products`. */
|
|
963
|
+
export type RevenueReport = AnalyticsReport & {
|
|
964
|
+
computedAt: string;
|
|
965
|
+
currency: string | null;
|
|
966
|
+
orders: number;
|
|
967
|
+
revenue: number;
|
|
968
|
+
searchOrders: number;
|
|
969
|
+
searchRevenue: number;
|
|
970
|
+
carts: number;
|
|
971
|
+
cartValue: number;
|
|
972
|
+
searchCarts: number;
|
|
973
|
+
searchCartValue: number;
|
|
974
|
+
searchClicks: number;
|
|
975
|
+
otherCurrencies: {
|
|
976
|
+
currency: string;
|
|
977
|
+
orders: number;
|
|
978
|
+
revenue: number;
|
|
979
|
+
searchRevenue: number;
|
|
980
|
+
}[];
|
|
981
|
+
/** Orders and search clicks with visitor IDs, the first linked search click in the window, whether the
|
|
982
|
+
* index takes visitor IDs, and purchase lines without a price. */
|
|
983
|
+
coverage: {
|
|
984
|
+
linkedOrders: number;
|
|
985
|
+
linkedClicks: number;
|
|
986
|
+
linkedSince: string | null;
|
|
987
|
+
visitorIds: boolean;
|
|
988
|
+
unpricedLines: number;
|
|
989
|
+
};
|
|
990
|
+
/** The queries, the most revenue first, up to 100. */
|
|
991
|
+
queries: RevenueQuery[];
|
|
992
|
+
/** The products bought after a search, the most revenue from search first, up to 50. */
|
|
993
|
+
products: RevenueProduct[];
|
|
994
|
+
};
|
|
887
995
|
export declare class FindlaneError extends Error {
|
|
888
996
|
status: number;
|
|
889
997
|
constructor(status: number, message: string);
|
|
@@ -1016,6 +1124,9 @@ export declare class SearchServerClient {
|
|
|
1016
1124
|
product: (objectID: string, options?: AnalyticsOptions & {
|
|
1017
1125
|
interval?: "hour" | "day";
|
|
1018
1126
|
}) => Promise<ProductReport>;
|
|
1127
|
+
/** Revenue from search: orders and add-to-carts of products found through search, per query and per
|
|
1128
|
+
* product (0.20.0). */
|
|
1129
|
+
revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
|
|
1019
1130
|
};
|
|
1020
1131
|
upsert: (records: T[], signal?: AbortSignal) => Promise<WriteReceipt>;
|
|
1021
1132
|
getRecord: (objectID: string, signal?: AbortSignal) => Promise<RecordSnapshot<T>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -121,9 +121,11 @@ export type QuerySuggestion = {
|
|
|
121
121
|
q: string;
|
|
122
122
|
typed?: [number, number];
|
|
123
123
|
};
|
|
124
|
-
/** When a
|
|
125
|
-
*
|
|
126
|
-
*
|
|
124
|
+
/** When a search meets a rule's `if`, the rule's `then` applies to that search: its words (one of the
|
|
125
|
+
* phrases), its filters (such as a category page's), the contexts it sends, and whether it has words; only
|
|
126
|
+
* between the rule's `active` times when it has them. Phrases are compared as synonyms are: without case,
|
|
127
|
+
* accents, or the index languages' stop words, and with their plurals and other spellings, so a rule for
|
|
128
|
+
* "balloon" also fires for "balloons". */
|
|
127
129
|
export type QueryRule = {
|
|
128
130
|
/** 1 to 64 letters, digits, `_`, `.`, `:`, or `-`, unique in the index. */
|
|
129
131
|
id: string;
|
|
@@ -131,25 +133,46 @@ export type QueryRule = {
|
|
|
131
133
|
description?: string;
|
|
132
134
|
/** false keeps the rule without applying it. Reading settings always returns it; true when left out. */
|
|
133
135
|
enabled?: boolean;
|
|
136
|
+
/** Fires only from `from` and before `until`, ISO 8601 times with their zone, such as
|
|
137
|
+
* "2026-11-27T00:00:00Z"; either may be left out (0.20.0). */
|
|
138
|
+
active?: {
|
|
139
|
+
from?: string;
|
|
140
|
+
until?: string;
|
|
141
|
+
};
|
|
142
|
+
/** Every condition given must hold; with none, the rule fires on every search. */
|
|
134
143
|
if: {
|
|
135
|
-
/** 1 to 20 phrases of one to four words. */
|
|
136
|
-
phrases
|
|
144
|
+
/** 1 to 20 phrases of one to four words. Reading settings returns [] for a rule without phrases. */
|
|
145
|
+
phrases?: string[];
|
|
137
146
|
/** The query is one of the phrases, starts with one, or contains one; "contains" when left out. */
|
|
138
147
|
match?: "is" | "startsWith" | "contains";
|
|
148
|
+
/** The search filters each field (1 to 10 filter fields) to one of these values, alone or in an `in`
|
|
149
|
+
* list, as a category page filters its category (0.20.0). */
|
|
150
|
+
filters?: Record<string, string | number | boolean | Array<string | number | boolean>>;
|
|
151
|
+
/** The search sends one of these contexts (its `context`), 1 to 10 names (0.20.0). */
|
|
152
|
+
context?: string[];
|
|
153
|
+
/** For a rule without phrases: only searches without words, such as a category page ("none"), or only
|
|
154
|
+
* with them ("some") (0.20.0). */
|
|
155
|
+
words?: "none" | "some";
|
|
139
156
|
};
|
|
140
157
|
/** One or more of these. `filters`, `boost` and `bury` take a search's filters, on 1 to 10 fields. */
|
|
141
158
|
then: {
|
|
142
159
|
/** Added to the search's filters, except on fields the search (or an earlier rule) already filters.
|
|
143
160
|
* Records without the field drop out, so `boost` is usually the better choice. */
|
|
144
161
|
filters?: SearchRequest["filters"];
|
|
145
|
-
/** Records matching these come before the others, after `rankFirst`'s groups, in searches
|
|
146
|
-
*
|
|
162
|
+
/** Records matching these come before the others, after `rankFirst`'s groups, in searches sorted by
|
|
163
|
+
* relevance, with words or without (0.20.0), but not named sorts or distance. Several rules' boosts add up. */
|
|
147
164
|
boost?: SearchRequest["filters"];
|
|
148
165
|
/** Records matching these come after the others, in the same searches as `boost`. */
|
|
149
166
|
bury?: SearchRequest["filters"];
|
|
150
167
|
/** Up to 100 objectIDs left out of the results. */
|
|
151
168
|
hide?: string[];
|
|
152
|
-
/**
|
|
169
|
+
/** 1 to 20 records at places from 1, on every sort, when they pass the search's filters (not necessarily its
|
|
170
|
+
* words); a later rule's pin at a taken place moves down (0.20.0). */
|
|
171
|
+
pin?: {
|
|
172
|
+
objectID: string;
|
|
173
|
+
position: number;
|
|
174
|
+
}[];
|
|
175
|
+
/** With phrases: words searched instead of the matched phrase, up to 64 characters; "" removes the phrase. */
|
|
153
176
|
replace?: string;
|
|
154
177
|
/** JSON up to 4 KB returned with the results in `appliedRules`, such as a banner or a redirect. */
|
|
155
178
|
userData?: unknown;
|
|
@@ -360,6 +383,17 @@ export type SearchRequest = {
|
|
|
360
383
|
/** With the index's `distinct` setting: false shows every record, a number 1 to 4 how many of each group's
|
|
361
384
|
* records. */
|
|
362
385
|
distinct?: boolean | number;
|
|
386
|
+
/** Contexts the page sends, which rules with a `context` condition fire on, such as "category-page": a
|
|
387
|
+
* name or up to 10, each 1 to 64 letters, digits, `_`, `:` or `-` (0.20.0). */
|
|
388
|
+
context?: string | string[];
|
|
389
|
+
/** Records matching these filters come first, after the index's rank first, in searches by relevance: filters as
|
|
390
|
+
* `filters` takes them, or a list of up to 10, each counting once, so records matching more come first (0.21.0). */
|
|
391
|
+
boost?: SearchRequest["filters"] | SearchRequest["filters"][];
|
|
392
|
+
/** Records matching these come last, the same way (0.21.0). */
|
|
393
|
+
bury?: SearchRequest["filters"] | SearchRequest["filters"][];
|
|
394
|
+
/** Checks rules as at this time, in milliseconds since 1970, such as a campaign's start, instead of now
|
|
395
|
+
* (0.20.0). Browser search doesn't take it. */
|
|
396
|
+
rulesAt?: number;
|
|
363
397
|
};
|
|
364
398
|
/** A point in degrees: lat from -90 to 90, lng from -180 to 180. */
|
|
365
399
|
export type GeoPoint = {
|
|
@@ -429,6 +463,14 @@ export type AppliedRule = {
|
|
|
429
463
|
id: string;
|
|
430
464
|
userData?: unknown;
|
|
431
465
|
};
|
|
466
|
+
/** A rule's banner: an image, where it links, its text, its place among the hits from 1, and the rule's ID. */
|
|
467
|
+
export type Banner = {
|
|
468
|
+
image: string;
|
|
469
|
+
link?: string;
|
|
470
|
+
title?: string;
|
|
471
|
+
position?: number;
|
|
472
|
+
rule: string;
|
|
473
|
+
};
|
|
432
474
|
export type SearchResponse<T> = {
|
|
433
475
|
hits: {
|
|
434
476
|
id: string;
|
|
@@ -452,6 +494,8 @@ export type SearchResponse<T> = {
|
|
|
452
494
|
variant?: {
|
|
453
495
|
index: number;
|
|
454
496
|
};
|
|
497
|
+
/** A rule pinned it at its place (0.20.0). */
|
|
498
|
+
pinned?: true;
|
|
455
499
|
}[];
|
|
456
500
|
/** The matches; with the index's `distinct` setting, the groups. */
|
|
457
501
|
total: number;
|
|
@@ -481,6 +525,11 @@ export type SearchResponse<T> = {
|
|
|
481
525
|
appliedRules?: AppliedRule[];
|
|
482
526
|
/** When a rule replaced words: the query that was searched. */
|
|
483
527
|
rewrittenQuery?: string;
|
|
528
|
+
/** Banners of the rules that fired, in their order (0.21.0): show each at its `position` among the hits (from
|
|
529
|
+
* 1; the top when left out), linking to `link`. */
|
|
530
|
+
banners?: Banner[];
|
|
531
|
+
/** A page a rule sends this search to, such as "/pages/returns" (0.21.0): go there instead of showing results. */
|
|
532
|
+
redirect?: string;
|
|
484
533
|
/** With the index's `relatedResults` on (0.18.0): when the query's words found nothing (`hits` empty,
|
|
485
534
|
* `total` 0), the products closest to it in meaning, best first, with their similarity as `score`. Show
|
|
486
535
|
* them under a heading of their own, such as "No exact matches. Related products". */
|
|
@@ -884,6 +933,65 @@ export type ProductReport = AnalyticsReport & {
|
|
|
884
933
|
together: number;
|
|
885
934
|
};
|
|
886
935
|
};
|
|
936
|
+
/** A query's search clicks, and the add-to-carts and orders of the products clicked, in the main currency.
|
|
937
|
+
* `searches` is its searches when it's one of the 1,000 most searched, else null. `typed`: shorter queries
|
|
938
|
+
* typed on the way to it, such as "perfor", whose clicks count here. */
|
|
939
|
+
export type RevenueQuery = {
|
|
940
|
+
query: string;
|
|
941
|
+
searches: number | null;
|
|
942
|
+
clicks: number;
|
|
943
|
+
carts: number;
|
|
944
|
+
orders: number;
|
|
945
|
+
revenue: number;
|
|
946
|
+
typed: string[];
|
|
947
|
+
};
|
|
948
|
+
/** A product's orders and their value, beside those found through search, and the query it was found by most. */
|
|
949
|
+
export type RevenueProduct = {
|
|
950
|
+
objectID: string;
|
|
951
|
+
title: string;
|
|
952
|
+
image: string | null;
|
|
953
|
+
orders: number;
|
|
954
|
+
revenue: number;
|
|
955
|
+
searchOrders: number;
|
|
956
|
+
searchRevenue: number;
|
|
957
|
+
topQuery: string | null;
|
|
958
|
+
};
|
|
959
|
+
/** Revenue from search (0.20.0): purchases and add-to-carts of products the shopper clicked in search results in
|
|
960
|
+
* the 24 hours before, by the same visitor ID, so it needs the index's visitor IDs on and purchases sent as
|
|
961
|
+
* events. Each order counts once; amounts are in the main `currency` (the most orders'), at the prices the
|
|
962
|
+
* events carry, and other currencies' orders are listed apart. Exact, from every event kept, like `products`. */
|
|
963
|
+
export type RevenueReport = AnalyticsReport & {
|
|
964
|
+
computedAt: string;
|
|
965
|
+
currency: string | null;
|
|
966
|
+
orders: number;
|
|
967
|
+
revenue: number;
|
|
968
|
+
searchOrders: number;
|
|
969
|
+
searchRevenue: number;
|
|
970
|
+
carts: number;
|
|
971
|
+
cartValue: number;
|
|
972
|
+
searchCarts: number;
|
|
973
|
+
searchCartValue: number;
|
|
974
|
+
searchClicks: number;
|
|
975
|
+
otherCurrencies: {
|
|
976
|
+
currency: string;
|
|
977
|
+
orders: number;
|
|
978
|
+
revenue: number;
|
|
979
|
+
searchRevenue: number;
|
|
980
|
+
}[];
|
|
981
|
+
/** Orders and search clicks with visitor IDs, the first linked search click in the window, whether the
|
|
982
|
+
* index takes visitor IDs, and purchase lines without a price. */
|
|
983
|
+
coverage: {
|
|
984
|
+
linkedOrders: number;
|
|
985
|
+
linkedClicks: number;
|
|
986
|
+
linkedSince: string | null;
|
|
987
|
+
visitorIds: boolean;
|
|
988
|
+
unpricedLines: number;
|
|
989
|
+
};
|
|
990
|
+
/** The queries, the most revenue first, up to 100. */
|
|
991
|
+
queries: RevenueQuery[];
|
|
992
|
+
/** The products bought after a search, the most revenue from search first, up to 50. */
|
|
993
|
+
products: RevenueProduct[];
|
|
994
|
+
};
|
|
887
995
|
export declare class FindlaneError extends Error {
|
|
888
996
|
status: number;
|
|
889
997
|
constructor(status: number, message: string);
|
|
@@ -1016,6 +1124,9 @@ export declare class SearchServerClient {
|
|
|
1016
1124
|
product: (objectID: string, options?: AnalyticsOptions & {
|
|
1017
1125
|
interval?: "hour" | "day";
|
|
1018
1126
|
}) => Promise<ProductReport>;
|
|
1127
|
+
/** Revenue from search: orders and add-to-carts of products found through search, per query and per
|
|
1128
|
+
* product (0.20.0). */
|
|
1129
|
+
revenue: (options?: Omit<AnalyticsOptions, "source">) => Promise<RevenueReport>;
|
|
1019
1130
|
};
|
|
1020
1131
|
upsert: (records: T[], signal?: AbortSignal) => Promise<WriteReceipt>;
|
|
1021
1132
|
getRecord: (objectID: string, signal?: AbortSignal) => Promise<RecordSnapshot<T>>;
|
package/dist/index.js
CHANGED
|
@@ -272,7 +272,8 @@ class SearchServerClient {
|
|
|
272
272
|
events: (options = {}) => report("events", options),
|
|
273
273
|
products: (options = {}) => report("products", options),
|
|
274
274
|
productCounts: (options = {}) => report("product-counts", options),
|
|
275
|
-
product: (objectID, options = {}) => report(`products/${encodeURIComponent(objectID)}`, options)
|
|
275
|
+
product: (objectID, options = {}) => report(`products/${encodeURIComponent(objectID)}`, options),
|
|
276
|
+
revenue: (options = {}) => report("revenue", options)
|
|
276
277
|
},
|
|
277
278
|
upsert: (records, signal) => request("/records", "POST", { records }, signal),
|
|
278
279
|
getRecord: (objectID, signal) => request(`/records/${encodeURIComponent(objectID)}`, "GET", undefined, signal),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@findlane/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Findlane server SDK: upload catalogs, manage index settings, and search with a secret workspace API key.",
|
|
5
5
|
"keywords": ["findlane", "search", "full-text search", "typo tolerance", "ecommerce search", "search api", "sdk"],
|
|
6
6
|
"license": "MIT",
|