@depict-ai/utilishared 0.0.83 → 0.0.85
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 +16 -16
- package/dist/main.js +18 -6
- package/dist/module.js +18 -6
- package/package.json +2 -2
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 = "0.0.
|
|
3
|
+
export const version = "0.0.85";
|
|
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]`.
|
|
@@ -1019,13 +1019,13 @@ export function querySelectorAllElements<T extends Element>(elements: Node_Itera
|
|
|
1019
1019
|
export function standard_price_format(price: number, places_after_comma?: number | "auto", decimal_delimiter?: string, thousands_delimiter?: string): string;
|
|
1020
1020
|
export function intl_number_format_with_fallback(bcp47_country_code: string, number: number, numberformat_options?: Parameters<typeof Intl.NumberFormat>[1]): string;
|
|
1021
1021
|
export function ensure_object_path(obj: object, step1: string, ...path: string[]): any;
|
|
1022
|
-
export function Rec_Renderer<T extends Display>(t: Tenant, rendering_options: RR_Options<T>): Promise<RecRendererResult<T>>;
|
|
1022
|
+
export function Rec_Renderer<T extends Display>(t: Tenant | null, rendering_options: RR_Options<T>): Promise<RecRendererResult<T>>;
|
|
1023
1023
|
export function regex_templating(template: string, display?: Display | {
|
|
1024
1024
|
[key: string]: any;
|
|
1025
1025
|
}): string;
|
|
1026
1026
|
export function clone_deep<T>(obj: T): T;
|
|
1027
1027
|
export class InfoForProcessing<T extends Display> {
|
|
1028
|
-
constructor(t: Tenant, rendering_options: RR_Options<T>, displays: T[], index?: number, remove_display?: () => void, event_listeners?: [
|
|
1028
|
+
constructor(t: Tenant | null, rendering_options: RR_Options<T>, displays: T[], index?: number, remove_display?: () => void, event_listeners?: [
|
|
1029
1029
|
type: keyof HTMLElementEventMap,
|
|
1030
1030
|
listener: (this: HTMLElement, ev: HTMLElementEventMap[keyof HTMLElementEventMap]) => any,
|
|
1031
1031
|
options?: boolean | AddEventListenerOptions
|
|
@@ -1088,14 +1088,14 @@ export interface LegacyDisplay {
|
|
|
1088
1088
|
ga_product_ids?: string[];
|
|
1089
1089
|
/** The variation IDs */
|
|
1090
1090
|
variant_ids?: string[];
|
|
1091
|
+
/** The title */
|
|
1092
|
+
title: string;
|
|
1093
|
+
/** Unique recommendation result ID used by Depict */
|
|
1094
|
+
recommendation_id?: string;
|
|
1091
1095
|
/** Unique search result ID used by Depict */
|
|
1092
1096
|
search_result_id?: string;
|
|
1093
1097
|
/** Unique product listing result ID used by Depict */
|
|
1094
1098
|
product_listing_result_id?: string;
|
|
1095
|
-
/** Unique recommendation result ID used by Depict */
|
|
1096
|
-
recommendation_id?: string;
|
|
1097
|
-
/** The title */
|
|
1098
|
-
title: string;
|
|
1099
1099
|
[key: string]: any;
|
|
1100
1100
|
}
|
|
1101
1101
|
interface ModernDisplay {
|
|
@@ -1111,23 +1111,23 @@ interface ModernDisplay {
|
|
|
1111
1111
|
variant_skus: string[];
|
|
1112
1112
|
/** Product of the different variants */
|
|
1113
1113
|
variant_product_ids: string[];
|
|
1114
|
+
/** Unique recommendation result ID used by Depict */
|
|
1115
|
+
recommendation_id?: string;
|
|
1114
1116
|
/** Unique search result ID used by Depict */
|
|
1115
1117
|
search_result_id?: string;
|
|
1116
1118
|
/** Unique product listing result ID used by Depict */
|
|
1117
1119
|
product_listing_result_id?: string;
|
|
1118
|
-
/** Unique recommendation result ID used by Depict */
|
|
1119
|
-
recommendation_id?: string;
|
|
1120
1120
|
/** Recommendation type logic used by Depict */
|
|
1121
1121
|
logic?: string;
|
|
1122
1122
|
}
|
|
1123
1123
|
interface BasicDisplay {
|
|
1124
1124
|
product_id: string;
|
|
1125
|
+
/** Unique recommendation result ID used by Depict */
|
|
1126
|
+
recommendation_id?: string;
|
|
1125
1127
|
/** Unique search result ID used by Depict */
|
|
1126
1128
|
search_result_id?: string;
|
|
1127
1129
|
/** Unique product listing result ID used by Depict */
|
|
1128
1130
|
product_listing_result_id?: string;
|
|
1129
|
-
/** Unique recommendation result ID used by Depict */
|
|
1130
|
-
recommendation_id?: string;
|
|
1131
1131
|
/** Recommendation type logic used by Depict */
|
|
1132
1132
|
logic?: string;
|
|
1133
1133
|
[key: string]: any;
|
|
@@ -1170,7 +1170,7 @@ type Extended_RR_Options<T extends Display> = {
|
|
|
1170
1170
|
view_tracking?: RR_PostProcessor<T>[];
|
|
1171
1171
|
click_tracking?: RR_PostProcessor<T>[];
|
|
1172
1172
|
} & RR_Options<T>;
|
|
1173
|
-
export function default_rr<T extends Display>(t: Tenant, rendering_options: Extended_RR_Options<T>): Promise<RecRendererResult<T>>;
|
|
1173
|
+
export function default_rr<T extends Display>(t: Tenant | null, rendering_options: Extended_RR_Options<T>): Promise<RecRendererResult<T>>;
|
|
1174
1174
|
type GWVM_Options = {
|
|
1175
1175
|
container_selector?: string;
|
|
1176
1176
|
start_rows?: number;
|
|
@@ -1646,7 +1646,7 @@ export interface RecommendationGridOptions<T extends Display> extends Omit<Layou
|
|
|
1646
1646
|
* @param ...options_for_grid Options for Grid. See documentation of Grid.
|
|
1647
1647
|
* @constructor
|
|
1648
1648
|
*/
|
|
1649
|
-
export function RecommendationGrid<T extends Display>(t: Tenant, recommendation_renderer_options: Extended_RR_Options<T>, { container_elements, container_selector, override_rec_renderer, lazyfier_options, eager_images, ...options_for_grid }: RecommendationGridOptions<T>): Promise<RecRendererResult<T>>;
|
|
1649
|
+
export function RecommendationGrid<T extends Display>(t: Tenant | null, recommendation_renderer_options: Extended_RR_Options<T>, { container_elements, container_selector, override_rec_renderer, lazyfier_options, eager_images, ...options_for_grid }: RecommendationGridOptions<T>): Promise<RecRendererResult<T>>;
|
|
1650
1650
|
export interface EasySliderOptions<T extends Display> extends Omit<LayoutOptions, "container_element" | "rows" | "layout"> {
|
|
1651
1651
|
rows?: {
|
|
1652
1652
|
start_rows?: number;
|
|
@@ -1686,7 +1686,7 @@ export type RecommendationSliderSurface<T extends Display> = Record<string, neve
|
|
|
1686
1686
|
* @param RecommendationGrid_options Similar options object to RecommendationGrid except that it also contains options to Amazing_Slider
|
|
1687
1687
|
* @return a Surface (object) that contains displays, elements and the instance of the slider class (as `slider`)
|
|
1688
1688
|
*/
|
|
1689
|
-
export function RecommendationSlider<T extends Display>(t: Tenant, recommendation_renderer_options: Extended_RR_Options<T>, { container_elements, container_selector, override_rec_renderer, lazyfier_options, eager_images, grid_spacing, cols_at_size, override_vertical_spacing, rows, ...slider_options }: EasySliderOptions<T>): Promise<RecommendationSliderSurface<T> | RecRendererResult<T> | Surface<T>>;
|
|
1689
|
+
export function RecommendationSlider<T extends Display>(t: Tenant | null, recommendation_renderer_options: Extended_RR_Options<T>, { container_elements, container_selector, override_rec_renderer, lazyfier_options, eager_images, grid_spacing, cols_at_size, override_vertical_spacing, rows, ...slider_options }: EasySliderOptions<T>): Promise<RecommendationSliderSurface<T> | RecRendererResult<T> | Surface<T>>;
|
|
1690
1690
|
export function slider_autoscroll_factory(interval?: number): {
|
|
1691
1691
|
constructor_plugin(this: Amazing_Slider): void;
|
|
1692
1692
|
mutation_plugin: (this: Amazing_Slider, _intersections: IntersectionObserverEntry[], intersecting_mutations: Record<number, IntersectionObserverEntry>) => void;
|
|
@@ -2050,7 +2050,7 @@ export function insert_surfaces<T extends Display>({ surfaces: input_surfaces, v
|
|
|
2050
2050
|
}>[];
|
|
2051
2051
|
export const revertable_remove: (target: string | Element | Node_Array, should_stay_inserted: Promise<boolean>) => Promise<void | undefined>;
|
|
2052
2052
|
type MakePlaceholderRROption<T extends Display> = {
|
|
2053
|
-
override_rec_renderer?: (t: Tenant, rendering_options: Extended_RR_Options<T>) => Promise<RecRendererResult<T>>;
|
|
2053
|
+
override_rec_renderer?: (t: Tenant | null, rendering_options: Extended_RR_Options<T>) => Promise<RecRendererResult<T>>;
|
|
2054
2054
|
image_width?: number;
|
|
2055
2055
|
image_height?: number;
|
|
2056
2056
|
color?: string;
|
|
@@ -2084,7 +2084,7 @@ export const placeholder_svg: (image_width: number, image_height: number, color?
|
|
|
2084
2084
|
* @param [post_rendering] Will be called and awaited after rendering of actual recommendations, has a chance to change them before they get inserted into the DOM
|
|
2085
2085
|
* @return It returns the same as a normal recommenation renderer would, meaning an object that might contain `displays` and `elements`
|
|
2086
2086
|
*/
|
|
2087
|
-
export function make_placeholder_rr<T extends Display>({ override_rec_renderer, image_width, image_height, num_items, color, on_no_rendering_result, post_rendering, }?: MakePlaceholderRROption<T>): Promise<(t: Tenant, rendering_options: Extended_RR_Options<T | PlaceholderRenderingDisplay>) => Promise<Record<string, never> | {
|
|
2087
|
+
export function make_placeholder_rr<T extends Display>({ override_rec_renderer, image_width, image_height, num_items, color, on_no_rendering_result, post_rendering, }?: MakePlaceholderRROption<T>): Promise<(t: Tenant | null, rendering_options: Extended_RR_Options<T | PlaceholderRenderingDisplay>) => Promise<Record<string, never> | {
|
|
2088
2088
|
elements: Node_Array;
|
|
2089
2089
|
displays: T[];
|
|
2090
2090
|
}>>;
|
package/dist/main.js
CHANGED
|
@@ -274,10 +274,10 @@ $parcel$export(module.exports, "hsl_to_rgb", () => $d73746ee466f09ca$export$e4fd
|
|
|
274
274
|
$parcel$export(module.exports, "relative_luminance_from_rgb", () => $d73746ee466f09ca$export$98c2b3491e76c1f);
|
|
275
275
|
$parcel$export(module.exports, "version", () => $815f67c61b4c0a42$export$83d89fbfd8236492);
|
|
276
276
|
$parcel$export(module.exports, "add_to_version_info", () => $e4a18bf12ad092d9$export$2cefb7e61fcbae00);
|
|
277
|
-
const $815f67c61b4c0a42$export$83d89fbfd8236492 = "0.0.
|
|
277
|
+
const $815f67c61b4c0a42$export$83d89fbfd8236492 = "0.0.85";
|
|
278
278
|
|
|
279
279
|
|
|
280
|
-
const $7b5e577a60b81e60$export$55fe61489d2c7417 = /*@__PURE__*/ (()=>process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && (document
|
|
280
|
+
const $7b5e577a60b81e60$export$55fe61489d2c7417 = /*@__PURE__*/ (()=>process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && (globalThis?.document?.currentScript?.dataset?.debug === "true" || globalThis?.localStorage?.getItem?.("debug") === "true"))();
|
|
281
281
|
|
|
282
282
|
|
|
283
283
|
const $e6c6e7929ea385ae$var$browser_prefix_styling = "color: #fff;";
|
|
@@ -2331,6 +2331,10 @@ const $11ff7b46c1fb674c$export$d0efd8ed14f5c33 = (items, display, info)=>{
|
|
|
2331
2331
|
(0, $e6c6e7929ea385ae$export$de56f1198d121036)("Impression tracking: Can't observe", items, display);
|
|
2332
2332
|
return items;
|
|
2333
2333
|
}
|
|
2334
|
+
if (!info.t) {
|
|
2335
|
+
(0, $e6c6e7929ea385ae$export$de56f1198d121036)("Impression tracking: No tenant instance, can't track", items, display);
|
|
2336
|
+
return items;
|
|
2337
|
+
}
|
|
2334
2338
|
(0, $2a1cbc63a04d4a2d$export$b6ae1bc530f4c149).onexists(first_watchable_el, ({ element: element })=>{
|
|
2335
2339
|
(0, $72ed530554068e4f$export$4c51576248bcdf31)(element, ()=>{
|
|
2336
2340
|
const { recommendation_id: recommendation_id , search_result_id: search_result_id , product_listing_result_id: product_listing_result_id , suggestions_result_id: suggestions_result_id } = display;
|
|
@@ -3377,7 +3381,7 @@ async function $558ccd2de887e6d9$export$a9fc160c5ed83bd7(t, rendering_options) {
|
|
|
3377
3381
|
}
|
|
3378
3382
|
// return if too few displays
|
|
3379
3383
|
const { min_items_to_run: min_items_to_run } = rendering_options;
|
|
3380
|
-
const good_displays = await $558ccd2de887e6d9$var$check_displays(
|
|
3384
|
+
const good_displays = await $558ccd2de887e6d9$var$check_displays(displays, min_items_to_run).catch((0, $548fd58b14b25a52$export$8048b892d651b310));
|
|
3381
3385
|
if (!good_displays) return {};
|
|
3382
3386
|
const processed_displays = await $558ccd2de887e6d9$export$c22e610107c5a15a(t, rendering_options, displays);
|
|
3383
3387
|
if (!processed_displays.length) {
|
|
@@ -3452,7 +3456,6 @@ function $558ccd2de887e6d9$export$c42139a43c877ecd(obj) {
|
|
|
3452
3456
|
return obj;
|
|
3453
3457
|
}
|
|
3454
3458
|
async function $558ccd2de887e6d9$export$cf7cbc6b76039101(t, rendering_options, displays, index, functions, elements, event_listeners = []) {
|
|
3455
|
-
let b;
|
|
3456
3459
|
let keep = true;
|
|
3457
3460
|
const info = new $558ccd2de887e6d9$export$da854280fb61cd32(t, rendering_options, displays, index, ()=>keep = false, event_listeners);
|
|
3458
3461
|
for(let i = 0; i < functions.length; i++){
|
|
@@ -3487,6 +3490,7 @@ async function $558ccd2de887e6d9$export$c22e610107c5a15a(t, rendering_options, d
|
|
|
3487
3490
|
}
|
|
3488
3491
|
class $558ccd2de887e6d9$export$da854280fb61cd32 {
|
|
3489
3492
|
constructor(t, rendering_options, displays, index, remove_display, event_listeners){
|
|
3493
|
+
// @ts-ignore Support for no-tenant recommendation rendering for js-ui/react-ui
|
|
3490
3494
|
this.t = t;
|
|
3491
3495
|
this.rendering_options = rendering_options;
|
|
3492
3496
|
this.displays = displays;
|
|
@@ -3498,7 +3502,7 @@ class $558ccd2de887e6d9$export$da854280fb61cd32 {
|
|
|
3498
3502
|
}
|
|
3499
3503
|
}
|
|
3500
3504
|
}
|
|
3501
|
-
async function $558ccd2de887e6d9$var$check_displays(
|
|
3505
|
+
async function $558ccd2de887e6d9$var$check_displays(displays, min_items_to_run) {
|
|
3502
3506
|
// don't run if too few recs
|
|
3503
3507
|
if (min_items_to_run && displays.length < min_items_to_run) {
|
|
3504
3508
|
(0, $e6c6e7929ea385ae$export$de56f1198d121036)("RR: Got too few displays, exiting");
|
|
@@ -3509,6 +3513,8 @@ async function $558ccd2de887e6d9$var$check_displays(t, displays, min_items_to_ru
|
|
|
3509
3513
|
async function $558ccd2de887e6d9$var$make_sure_we_have_displays(t, rendering_options) {
|
|
3510
3514
|
const recs = await rendering_options.recs;
|
|
3511
3515
|
if (Array.isArray(recs)) return $558ccd2de887e6d9$export$c42139a43c877ecd(recs);
|
|
3516
|
+
if (!t) // No recs and no tenant, so we can't get any. Should never happen.
|
|
3517
|
+
return [];
|
|
3512
3518
|
// get displays with get_displays if none are provided
|
|
3513
3519
|
const get_displays_options = {
|
|
3514
3520
|
type: rendering_options.type,
|
|
@@ -4778,6 +4784,7 @@ const $04d2f7d9126af667$export$ed8a68dacd075983 = /*@__PURE__*/ new Map();
|
|
|
4778
4784
|
const $04d2f7d9126af667$export$4b50a4de9c6bbe09 = /*@__PURE__*/ new WeakSet();
|
|
4779
4785
|
function $04d2f7d9126af667$export$fb9afe9f540ae069(elements, _display, info) {
|
|
4780
4786
|
if (!elements?.length) return elements;
|
|
4787
|
+
if (!info.t) return elements;
|
|
4781
4788
|
const elements_as_array = [
|
|
4782
4789
|
...elements
|
|
4783
4790
|
];
|
|
@@ -4803,6 +4810,8 @@ const $04d2f7d9126af667$export$3777a14dd8c2363d = /*@__PURE__*/ new WeakSet();
|
|
|
4803
4810
|
function $04d2f7d9126af667$export$1bffac19f9f0d6fc(elements, _display, info) {
|
|
4804
4811
|
if (!elements?.length) // don't make it hurt even more that rendering failed
|
|
4805
4812
|
return elements;
|
|
4813
|
+
if (!info.t) // GTAG tracking is deprecated, if we're doing no-tenant recommendation rendering it's SDK anyway.
|
|
4814
|
+
return elements;
|
|
4806
4815
|
const [first_element] = elements;
|
|
4807
4816
|
const handler = (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)(()=>{
|
|
4808
4817
|
const { rendering_options: rendering_options , displays: displays } = info;
|
|
@@ -4821,6 +4830,7 @@ function $04d2f7d9126af667$export$1bffac19f9f0d6fc(elements, _display, info) {
|
|
|
4821
4830
|
}
|
|
4822
4831
|
function $04d2f7d9126af667$export$9e1caada6901f552(elements, _display, info) {
|
|
4823
4832
|
const { t: t } = info;
|
|
4833
|
+
if (!t) return elements;
|
|
4824
4834
|
(async ()=>{
|
|
4825
4835
|
(0, $72ee205b59322497$export$eee4c4d924348b05)({
|
|
4826
4836
|
tenant: t.tenant,
|
|
@@ -8513,7 +8523,9 @@ function $ff973b2032639b5f$export$a62825542f1bfcf5({ what_to_watch: what_to_watc
|
|
|
8513
8523
|
// Much faster than .map and this will run kinda often
|
|
8514
8524
|
const format = formats[i];
|
|
8515
8525
|
const srcset = $ff973b2032639b5f$var$make_srcset(src, format, resolutions);
|
|
8516
|
-
sources.push(
|
|
8526
|
+
sources.push(// 0px important because chrome will load the biggest size otherwise until sizes attribute is set to the correct value
|
|
8527
|
+
(0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("source", {
|
|
8528
|
+
sizes: "0px",
|
|
8517
8529
|
type: `image/${format}`,
|
|
8518
8530
|
...set_dataset ? {
|
|
8519
8531
|
"data-srcset": srcset
|
package/dist/module.js
CHANGED
|
@@ -4,10 +4,10 @@ function $parcel$export(e, n, v, s) {
|
|
|
4
4
|
function $parcel$interopDefault(a) {
|
|
5
5
|
return a && a.__esModule ? a.default : a;
|
|
6
6
|
}
|
|
7
|
-
const $0766c85d387a9765$export$83d89fbfd8236492 = "0.0.
|
|
7
|
+
const $0766c85d387a9765$export$83d89fbfd8236492 = "0.0.85";
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
const $571bce04eb920cd8$export$55fe61489d2c7417 = /*@__PURE__*/ (()=>process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && (document
|
|
10
|
+
const $571bce04eb920cd8$export$55fe61489d2c7417 = /*@__PURE__*/ (()=>process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && (globalThis?.document?.currentScript?.dataset?.debug === "true" || globalThis?.localStorage?.getItem?.("debug") === "true"))();
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
const $649f456f663da9fc$var$browser_prefix_styling = "color: #fff;";
|
|
@@ -2061,6 +2061,10 @@ const $405969d60b37fdac$export$d0efd8ed14f5c33 = (items, display, info)=>{
|
|
|
2061
2061
|
(0, $649f456f663da9fc$export$de56f1198d121036)("Impression tracking: Can't observe", items, display);
|
|
2062
2062
|
return items;
|
|
2063
2063
|
}
|
|
2064
|
+
if (!info.t) {
|
|
2065
|
+
(0, $649f456f663da9fc$export$de56f1198d121036)("Impression tracking: No tenant instance, can't track", items, display);
|
|
2066
|
+
return items;
|
|
2067
|
+
}
|
|
2064
2068
|
(0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(first_watchable_el, ({ element: element })=>{
|
|
2065
2069
|
(0, $f24c14db771b471d$export$4c51576248bcdf31)(element, ()=>{
|
|
2066
2070
|
const { recommendation_id: recommendation_id , search_result_id: search_result_id , product_listing_result_id: product_listing_result_id , suggestions_result_id: suggestions_result_id } = display;
|
|
@@ -3107,7 +3111,7 @@ async function $5cbe24d064a033ed$export$a9fc160c5ed83bd7(t, rendering_options) {
|
|
|
3107
3111
|
}
|
|
3108
3112
|
// return if too few displays
|
|
3109
3113
|
const { min_items_to_run: min_items_to_run } = rendering_options;
|
|
3110
|
-
const good_displays = await $5cbe24d064a033ed$var$check_displays(
|
|
3114
|
+
const good_displays = await $5cbe24d064a033ed$var$check_displays(displays, min_items_to_run).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
|
|
3111
3115
|
if (!good_displays) return {};
|
|
3112
3116
|
const processed_displays = await $5cbe24d064a033ed$export$c22e610107c5a15a(t, rendering_options, displays);
|
|
3113
3117
|
if (!processed_displays.length) {
|
|
@@ -3182,7 +3186,6 @@ function $5cbe24d064a033ed$export$c42139a43c877ecd(obj) {
|
|
|
3182
3186
|
return obj;
|
|
3183
3187
|
}
|
|
3184
3188
|
async function $5cbe24d064a033ed$export$cf7cbc6b76039101(t, rendering_options, displays, index, functions, elements, event_listeners = []) {
|
|
3185
|
-
let b;
|
|
3186
3189
|
let keep = true;
|
|
3187
3190
|
const info = new $5cbe24d064a033ed$export$da854280fb61cd32(t, rendering_options, displays, index, ()=>keep = false, event_listeners);
|
|
3188
3191
|
for(let i = 0; i < functions.length; i++){
|
|
@@ -3217,6 +3220,7 @@ async function $5cbe24d064a033ed$export$c22e610107c5a15a(t, rendering_options, d
|
|
|
3217
3220
|
}
|
|
3218
3221
|
class $5cbe24d064a033ed$export$da854280fb61cd32 {
|
|
3219
3222
|
constructor(t, rendering_options, displays, index, remove_display, event_listeners){
|
|
3223
|
+
// @ts-ignore Support for no-tenant recommendation rendering for js-ui/react-ui
|
|
3220
3224
|
this.t = t;
|
|
3221
3225
|
this.rendering_options = rendering_options;
|
|
3222
3226
|
this.displays = displays;
|
|
@@ -3228,7 +3232,7 @@ class $5cbe24d064a033ed$export$da854280fb61cd32 {
|
|
|
3228
3232
|
}
|
|
3229
3233
|
}
|
|
3230
3234
|
}
|
|
3231
|
-
async function $5cbe24d064a033ed$var$check_displays(
|
|
3235
|
+
async function $5cbe24d064a033ed$var$check_displays(displays, min_items_to_run) {
|
|
3232
3236
|
// don't run if too few recs
|
|
3233
3237
|
if (min_items_to_run && displays.length < min_items_to_run) {
|
|
3234
3238
|
(0, $649f456f663da9fc$export$de56f1198d121036)("RR: Got too few displays, exiting");
|
|
@@ -3239,6 +3243,8 @@ async function $5cbe24d064a033ed$var$check_displays(t, displays, min_items_to_ru
|
|
|
3239
3243
|
async function $5cbe24d064a033ed$var$make_sure_we_have_displays(t, rendering_options) {
|
|
3240
3244
|
const recs = await rendering_options.recs;
|
|
3241
3245
|
if (Array.isArray(recs)) return $5cbe24d064a033ed$export$c42139a43c877ecd(recs);
|
|
3246
|
+
if (!t) // No recs and no tenant, so we can't get any. Should never happen.
|
|
3247
|
+
return [];
|
|
3242
3248
|
// get displays with get_displays if none are provided
|
|
3243
3249
|
const get_displays_options = {
|
|
3244
3250
|
type: rendering_options.type,
|
|
@@ -4508,6 +4514,7 @@ const $c1503704e45e6a15$export$ed8a68dacd075983 = /*@__PURE__*/ new Map();
|
|
|
4508
4514
|
const $c1503704e45e6a15$export$4b50a4de9c6bbe09 = /*@__PURE__*/ new WeakSet();
|
|
4509
4515
|
function $c1503704e45e6a15$export$fb9afe9f540ae069(elements, _display, info) {
|
|
4510
4516
|
if (!elements?.length) return elements;
|
|
4517
|
+
if (!info.t) return elements;
|
|
4511
4518
|
const elements_as_array = [
|
|
4512
4519
|
...elements
|
|
4513
4520
|
];
|
|
@@ -4533,6 +4540,8 @@ const $c1503704e45e6a15$export$3777a14dd8c2363d = /*@__PURE__*/ new WeakSet();
|
|
|
4533
4540
|
function $c1503704e45e6a15$export$1bffac19f9f0d6fc(elements, _display, info) {
|
|
4534
4541
|
if (!elements?.length) // don't make it hurt even more that rendering failed
|
|
4535
4542
|
return elements;
|
|
4543
|
+
if (!info.t) // GTAG tracking is deprecated, if we're doing no-tenant recommendation rendering it's SDK anyway.
|
|
4544
|
+
return elements;
|
|
4536
4545
|
const [first_element] = elements;
|
|
4537
4546
|
const handler = (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)(()=>{
|
|
4538
4547
|
const { rendering_options: rendering_options , displays: displays } = info;
|
|
@@ -4551,6 +4560,7 @@ function $c1503704e45e6a15$export$1bffac19f9f0d6fc(elements, _display, info) {
|
|
|
4551
4560
|
}
|
|
4552
4561
|
function $c1503704e45e6a15$export$9e1caada6901f552(elements, _display, info) {
|
|
4553
4562
|
const { t: t } = info;
|
|
4563
|
+
if (!t) return elements;
|
|
4554
4564
|
(async ()=>{
|
|
4555
4565
|
(0, $aa0140679dc70b7a$export$eee4c4d924348b05)({
|
|
4556
4566
|
tenant: t.tenant,
|
|
@@ -8243,7 +8253,9 @@ function $45af9e834781a9bc$export$a62825542f1bfcf5({ what_to_watch: what_to_watc
|
|
|
8243
8253
|
// Much faster than .map and this will run kinda often
|
|
8244
8254
|
const format = formats[i];
|
|
8245
8255
|
const srcset = $45af9e834781a9bc$var$make_srcset(src, format, resolutions);
|
|
8246
|
-
sources.push(
|
|
8256
|
+
sources.push(// 0px important because chrome will load the biggest size otherwise until sizes attribute is set to the correct value
|
|
8257
|
+
(0, $63cbb5de51d11596$export$34b9dba7ce09269b)("source", {
|
|
8258
|
+
sizes: "0px",
|
|
8247
8259
|
type: `image/${format}`,
|
|
8248
8260
|
...set_dataset ? {
|
|
8249
8261
|
"data-srcset": srcset
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/utilishared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.85",
|
|
4
4
|
"packageManager": "yarn@3.2.2",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@babel/core": "latest",
|
|
44
44
|
"@babel/runtime": "latest",
|
|
45
45
|
"@babel/runtime-corejs3": "latest",
|
|
46
|
-
"@depict-ai/types": "^0.0.
|
|
46
|
+
"@depict-ai/types": "^0.0.33",
|
|
47
47
|
"@parcel/resolver-default": "^2.8.0",
|
|
48
48
|
"@sentry/cli": "latest",
|
|
49
49
|
"@sentry/types": "^7.13.0",
|