@depict-ai/utilishared 0.0.87 → 1.0.2
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 +29 -9
- package/dist/main.js +1174 -1125
- package/dist/module.js +1172 -1126
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="../jsx.d.ts" />
|
|
2
2
|
import { EUnavailabilityType } from "@depict-ai/types/api/TrackV2Request";
|
|
3
|
-
export const version = "
|
|
3
|
+
export const version = "1.0.2";
|
|
4
4
|
export const is_debug: boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Sets the prefix of dlog, dwarn, and derror messages in the browser console. Defaults to `[Depict]`.
|
|
@@ -23,9 +23,13 @@ export function add_to_version_info(package_name: string, version: string): void
|
|
|
23
23
|
*/
|
|
24
24
|
export function add_version_query_params<T extends string | URL>(url: T): T;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Encoding UTF8 ⇢ base64
|
|
27
27
|
*/
|
|
28
|
-
export function
|
|
28
|
+
export function base64_encode_unicode(str: any): string;
|
|
29
|
+
/**
|
|
30
|
+
* Decoding base64 ⇢ UTF8
|
|
31
|
+
*/
|
|
32
|
+
export function base64_decode_unicode(str: any): string;
|
|
29
33
|
/**
|
|
30
34
|
* Class containing state that an IPNS operates on. It's only exported for type info and in case that you want to use it for instanceof checks.
|
|
31
35
|
* subscribers is an array of functions that get called every time push_value is called with a new value AND all previous subscribers are done
|
|
@@ -154,7 +158,6 @@ export function report(msg: Error | [Error, string], severity: Severity, input_d
|
|
|
154
158
|
[key: string]: any;
|
|
155
159
|
stack?: never;
|
|
156
160
|
}): void;
|
|
157
|
-
export const base_url: string;
|
|
158
161
|
/**
|
|
159
162
|
* Gives a random number between min and max (potentially including min and max).
|
|
160
163
|
* @param min The minimum number.
|
|
@@ -219,6 +222,7 @@ export class DepictAPIWS extends AutoReconnectingWS {
|
|
|
219
222
|
*/
|
|
220
223
|
export function random_string(): string;
|
|
221
224
|
export function make_random_classname(): string;
|
|
225
|
+
export const base_url: string;
|
|
222
226
|
export type event_types = "page_view" | "click" | "add_to_cart" | "purchase" | "element_visible";
|
|
223
227
|
declare const allowed_keys: readonly ["tenant", "market", "type", "user_id", "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", "dsid", "transaction_id", "error_type", "detail", "recommendation_type", "search_result_id", "product_listing_result_id"];
|
|
224
228
|
export type depict_body = Partial<{
|
|
@@ -989,6 +993,8 @@ type ExclusiveId = {
|
|
|
989
993
|
};
|
|
990
994
|
type FetchRecsOptions = {
|
|
991
995
|
type: string;
|
|
996
|
+
user_id?: string;
|
|
997
|
+
session_id?: string;
|
|
992
998
|
} & ExclusiveId;
|
|
993
999
|
/**
|
|
994
1000
|
* Fetches recommendations from the depict v2 recommendation api.
|
|
@@ -1139,6 +1145,25 @@ export type RecRendererResult<T extends Display> = Record<string, never> | {
|
|
|
1139
1145
|
elements: Node_Array;
|
|
1140
1146
|
displays: T[];
|
|
1141
1147
|
};
|
|
1148
|
+
/**
|
|
1149
|
+
* Queues a task in the event queue without a timeout like setTimeout does, see https://www.youtube.com/watch?v=cCOL7MC4Pl0
|
|
1150
|
+
* @param callback callback function that gets queued as a task
|
|
1151
|
+
*/
|
|
1152
|
+
export function queueMacroTask(callback: VoidFunction): void;
|
|
1153
|
+
interface SDKRenderingInfo {
|
|
1154
|
+
set_on_index_change: (fn: (index: number) => void) => void;
|
|
1155
|
+
merchant: string;
|
|
1156
|
+
market: string;
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Creates a handler for sending the "recommendations_inserted" event on new results.
|
|
1160
|
+
* Usage: call make_plp_recommendations_inserted_handler with options and then call the returned functions in your productCardTemplate
|
|
1161
|
+
*/
|
|
1162
|
+
export function make_plp_recommendations_inserted_handler(tenant: string, market: string, type: "search" | "category"): <T extends Display>(display: T | null, info?: SDKRenderingInfo) => void;
|
|
1163
|
+
/**
|
|
1164
|
+
* @deprecated this was a stupid idea, it's much easier to read if one just does a quick arrow function that provides the wanted arguments
|
|
1165
|
+
*/
|
|
1166
|
+
export function cache_args(fn: any, ...args: any[]): (...unimportant_args: any[]) => any;
|
|
1142
1167
|
export const check_displays: (args_0: {
|
|
1143
1168
|
recs: Display[] | {
|
|
1144
1169
|
displays: Display[];
|
|
@@ -2088,11 +2113,6 @@ export function make_placeholder_rr<T extends Display>({ override_rec_renderer,
|
|
|
2088
2113
|
elements: Node_Array;
|
|
2089
2114
|
displays: T[];
|
|
2090
2115
|
}>>;
|
|
2091
|
-
/**
|
|
2092
|
-
* Queues a task in the event queue without a timeout like setTimeout does, see https://www.youtube.com/watch?v=cCOL7MC4Pl0
|
|
2093
|
-
* @param callback callback function that gets queued as a task
|
|
2094
|
-
*/
|
|
2095
|
-
export function queueMacroTask(callback: VoidFunction): void;
|
|
2096
2116
|
/**
|
|
2097
2117
|
* Makes Node.prototype.removeChild not throw and emulate correct removal when a node is being removed by React's VDOM diffing that we have already removed before
|
|
2098
2118
|
* @return a WeakSet to add nodes to which you remove and want to ignore removal errors for
|