@depict-ai/utilishared 1.0.51 → 2.0.1
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/ES10/index.cjs +55 -183
- package/ES10/index.d.ts +9 -25
- package/ES10/index.js +52 -174
- package/latest/index.cjs +54 -183
- package/latest/index.d.ts +9 -25
- package/latest/index.js +51 -174
- package/package.json +4 -4
package/latest/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference path="../jsx.d.ts" />
|
|
2
|
-
import { EUnavailabilityType } from "@depict-ai/types/api/TrackV2Request";
|
|
3
2
|
import { Accessor } from "solid-js";
|
|
4
|
-
export const version = "
|
|
3
|
+
export const version = "2.0.1";
|
|
5
4
|
export const is_debug: boolean;
|
|
6
5
|
/**
|
|
7
6
|
* Sets the prefix of dlog, dwarn, and derror messages in the browser console. Defaults to `[Depict]`.
|
|
@@ -221,7 +220,7 @@ export function random_string(): string;
|
|
|
221
220
|
export function make_random_classname(): string;
|
|
222
221
|
export const base_url: string;
|
|
223
222
|
export type event_types = "page_view" | "click" | "add_to_cart" | "purchase" | "element_visible";
|
|
224
|
-
declare const allowed_keys: readonly ["tenant", "market", "type", "
|
|
223
|
+
declare const allowed_keys: readonly ["tenant", "market", "type", "session_id", "product_id", "entity_identifiers", "url", "entity_price", "currency", "document_referrer", "document_width", "attribution_id", "recommendation_id", "click_location", "ab_test_group", "variant_ids", "transaction_id", "error_type", "detail", "recommendation_type", "search_result_id", "product_listing_result_id"];
|
|
225
224
|
export type depict_body = Partial<{ [K in (typeof allowed_keys)[number]]: any }>;
|
|
226
225
|
export type depict_payload = depict_body[];
|
|
227
226
|
type any_properties = {
|
|
@@ -235,16 +234,10 @@ export const foolproof_send_beacon: (url: string, payload: {
|
|
|
235
234
|
[key: string]: any;
|
|
236
235
|
}) => boolean | undefined;
|
|
237
236
|
export const send_depict: (payload: noisy_depict_payload, use_ws?: boolean | undefined) => boolean | Promise<void | undefined> | undefined;
|
|
238
|
-
export let
|
|
239
|
-
export let get_user_id: () => string;
|
|
240
|
-
export let get_session_id: () => string | undefined;
|
|
241
|
-
export const set_depict_id_fn: (newfn: () => string) => (() => string) | undefined;
|
|
242
|
-
export const set_user_id_fn: (newfn: () => string) => (() => string) | undefined;
|
|
237
|
+
export let get_session_id: () => string;
|
|
243
238
|
export const set_session_id_fn: (newfn: () => string) => (() => string) | undefined;
|
|
244
239
|
export type TrackingEventContextData = {
|
|
245
|
-
|
|
246
|
-
dsid: string;
|
|
247
|
-
session_id?: string;
|
|
240
|
+
session_id: string;
|
|
248
241
|
url: string;
|
|
249
242
|
document_width: number;
|
|
250
243
|
document_referrer: string;
|
|
@@ -260,7 +253,6 @@ export const depict_prefilled: (vars: Partial<{
|
|
|
260
253
|
currency: any;
|
|
261
254
|
tenant: any;
|
|
262
255
|
market: any;
|
|
263
|
-
user_id: any;
|
|
264
256
|
session_id: any;
|
|
265
257
|
product_id: any;
|
|
266
258
|
entity_identifiers: any;
|
|
@@ -272,7 +264,6 @@ export const depict_prefilled: (vars: Partial<{
|
|
|
272
264
|
click_location: any;
|
|
273
265
|
ab_test_group: any;
|
|
274
266
|
variant_ids: any;
|
|
275
|
-
dsid: any;
|
|
276
267
|
transaction_id: any;
|
|
277
268
|
error_type: any;
|
|
278
269
|
recommendation_type: any;
|
|
@@ -288,7 +279,6 @@ export const depict_click: (vars: Partial<{
|
|
|
288
279
|
currency: any;
|
|
289
280
|
tenant: any;
|
|
290
281
|
market: any;
|
|
291
|
-
user_id: any;
|
|
292
282
|
session_id: any;
|
|
293
283
|
product_id: any;
|
|
294
284
|
entity_identifiers: any;
|
|
@@ -300,7 +290,6 @@ export const depict_click: (vars: Partial<{
|
|
|
300
290
|
click_location: any;
|
|
301
291
|
ab_test_group: any;
|
|
302
292
|
variant_ids: any;
|
|
303
|
-
dsid: any;
|
|
304
293
|
transaction_id: any;
|
|
305
294
|
error_type: any;
|
|
306
295
|
recommendation_type: any;
|
|
@@ -316,7 +305,6 @@ export const depict_add_to_cart: (vars: Partial<{
|
|
|
316
305
|
currency: any;
|
|
317
306
|
tenant: any;
|
|
318
307
|
market: any;
|
|
319
|
-
user_id: any;
|
|
320
308
|
session_id: any;
|
|
321
309
|
product_id: any;
|
|
322
310
|
entity_identifiers: any;
|
|
@@ -328,7 +316,6 @@ export const depict_add_to_cart: (vars: Partial<{
|
|
|
328
316
|
click_location: any;
|
|
329
317
|
ab_test_group: any;
|
|
330
318
|
variant_ids: any;
|
|
331
|
-
dsid: any;
|
|
332
319
|
transaction_id: any;
|
|
333
320
|
error_type: any;
|
|
334
321
|
recommendation_type: any;
|
|
@@ -1006,6 +993,7 @@ type FetchRecsOptions = {
|
|
|
1006
993
|
metadata?: Record<string, any>;
|
|
1007
994
|
} & ExclusiveId;
|
|
1008
995
|
/**
|
|
996
|
+
* @deprecated, use fetchDepictRecommendations instead
|
|
1009
997
|
* Fetches recommendations from the depict v2 recommendation api.
|
|
1010
998
|
* Will select the endpoint after which id property is given.
|
|
1011
999
|
*
|
|
@@ -1153,8 +1141,6 @@ export type RecRendererResult<T extends Display> = Record<string, never> | {
|
|
|
1153
1141
|
export function queueMacroTask(callback: VoidFunction): void;
|
|
1154
1142
|
interface SDKRenderingInfo {
|
|
1155
1143
|
set_on_index_change: (fn: (index: number) => void) => void;
|
|
1156
|
-
merchant: string;
|
|
1157
|
-
market: string;
|
|
1158
1144
|
}
|
|
1159
1145
|
/**
|
|
1160
1146
|
* Creates a handler for sending the "recommendations_inserted" event on new results.
|
|
@@ -1528,7 +1514,8 @@ export function get_recs_with_template({
|
|
|
1528
1514
|
template,
|
|
1529
1515
|
// recommendation template
|
|
1530
1516
|
chunk_size_for_load_more,
|
|
1531
|
-
insertion_promise
|
|
1517
|
+
insertion_promise,
|
|
1518
|
+
view_more_text
|
|
1532
1519
|
}: {
|
|
1533
1520
|
t: Tenant;
|
|
1534
1521
|
recs?: any[];
|
|
@@ -1544,6 +1531,7 @@ export function get_recs_with_template({
|
|
|
1544
1531
|
template: string;
|
|
1545
1532
|
chunk_size_for_load_more?: number;
|
|
1546
1533
|
insertion_promise?: Promise<void | unknown>;
|
|
1534
|
+
view_more_text?: string;
|
|
1547
1535
|
}): Promise<ChildNode[] | void>;
|
|
1548
1536
|
export function default_pre_processor(_t: any, d: any, i: number, with_loadmore: boolean, with_slider: boolean, infinite_scroll: boolean): any;
|
|
1549
1537
|
export function default_post_processor(_t: any, itms: HTMLCollection, d: any, slider: Deprecated_Amazing_Slider | null): HTMLCollection;
|
|
@@ -1907,12 +1895,11 @@ export function datalayer_interceptor(interception_callback: (layer_entry: any)
|
|
|
1907
1895
|
* For example: url => url.searchParams.get("orderId")
|
|
1908
1896
|
*/
|
|
1909
1897
|
export function url_transaction_id_extractor(tenant: Tenant, id_extractor: (url: URL) => unknown): void;
|
|
1910
|
-
export function send_transaction_id_to_depict(t: Tenant, input_id: string,
|
|
1898
|
+
export function send_transaction_id_to_depict(t: Tenant, input_id: string, session_id?: string, filter?: (text: string) => string | undefined): void;
|
|
1911
1899
|
/**
|
|
1912
1900
|
* Intercepts google analytics events for transactions (e.g when payment is made) and also sends it to depict.
|
|
1913
1901
|
* */
|
|
1914
1902
|
export function ga_to_transaction_api(t: Tenant, filter?: (text: string) => string | undefined): void;
|
|
1915
|
-
export function send_product_unavailable_to_depict(t: Tenant, unavailability_type: EUnavailabilityType): Promise<void>;
|
|
1916
1903
|
export interface ListenableSetEvent<T> extends CustomEvent {
|
|
1917
1904
|
detail: T;
|
|
1918
1905
|
}
|
|
@@ -2567,9 +2554,6 @@ export function relative_luminance_from_rgb(R8bit: number, G8bit: number, B8bit:
|
|
|
2567
2554
|
* Source: https://stackoverflow.com/a/39077686
|
|
2568
2555
|
*/
|
|
2569
2556
|
export function hex_to_rgb(hex: string): [number, number, number] | null;
|
|
2570
|
-
type meta_info_type = "title" | "description";
|
|
2571
|
-
/** Edits the meta tags in the head of the document */
|
|
2572
|
-
export function edit_current_page_meta_tags(meta_data: Accessor<{ [type in meta_info_type]?: string } | undefined>): void;
|
|
2573
2557
|
/**
|
|
2574
2558
|
* Synchronizes an HTML element's content with a provided Solid.js accessor's value. You can decide what "content" means.
|
|
2575
2559
|
*
|