@depict-ai/utilishared 0.0.74 → 0.0.76
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/README.md +130 -130
- package/dist/index.d.ts +2403 -2403
- package/dist/main.js +155 -144
- package/dist/module.js +155 -144
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -274,7 +274,7 @@ $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.76";
|
|
278
278
|
|
|
279
279
|
|
|
280
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.currentScript?.dataset?.debug === "true" || localStorage.getItem("debug") === "true"))();
|
|
@@ -318,8 +318,8 @@ function $e4a18bf12ad092d9$export$fe609f0216e4ebef(url) {
|
|
|
318
318
|
|
|
319
319
|
|
|
320
320
|
|
|
321
|
-
/**
|
|
322
|
-
* @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
|
|
321
|
+
/**
|
|
322
|
+
* @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
|
|
323
323
|
*/ function $ee1d22bd1fcdd4e1$export$6e7454c733fa1fb2(fn, ...args) {
|
|
324
324
|
return function(...unimportant_args) {
|
|
325
325
|
return fn.apply(this, [
|
|
@@ -333,13 +333,13 @@ function $e4a18bf12ad092d9$export$fe609f0216e4ebef(url) {
|
|
|
333
333
|
|
|
334
334
|
|
|
335
335
|
|
|
336
|
-
/**
|
|
337
|
-
* 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.
|
|
338
|
-
* 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
|
|
339
|
-
* queue is the queue of values that subscribers gets called with
|
|
340
|
-
* last_processed_value is the last value that the subscribers were called with
|
|
341
|
-
* push_value adds a new value to the queue and triggers the calling of the subscribers if they're done
|
|
342
|
-
* subscriber_done decrements the number of subscribers we are waiting for, if this isn't called call_subscribers will get stuck. It also triggers a new call to call_subscribers
|
|
336
|
+
/**
|
|
337
|
+
* 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.
|
|
338
|
+
* 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
|
|
339
|
+
* queue is the queue of values that subscribers gets called with
|
|
340
|
+
* last_processed_value is the last value that the subscribers were called with
|
|
341
|
+
* push_value adds a new value to the queue and triggers the calling of the subscribers if they're done
|
|
342
|
+
* subscriber_done decrements the number of subscribers we are waiting for, if this isn't called call_subscribers will get stuck. It also triggers a new call to call_subscribers
|
|
343
343
|
*/ class $5a591e8156b1128c$export$e2c811ae0eb35313 {
|
|
344
344
|
subscribers_ = [];
|
|
345
345
|
waiting_for_update_ = 0;
|
|
@@ -415,10 +415,10 @@ function $5a591e8156b1128c$export$3e42f5078e3abfc0(state) {
|
|
|
415
415
|
}
|
|
416
416
|
|
|
417
417
|
|
|
418
|
-
/**
|
|
419
|
-
* You know how you can write `break` inside of a `for await` loop to exit it? Well, this lets you break the loop from outside. Pass any async iterable that never throws and you will get back a function and a specially proxied async iterable. Whenever you call the function all for await loops iterating the returned iterable will break. Note: This will add some extra ticks because awaiting thenable objects takes more ticks than awaiting promises.
|
|
420
|
-
* @param async_iterable The async iterable you want to make exitable
|
|
421
|
-
* @return An array containing a function, the exit function, and a wrapped async iterable
|
|
418
|
+
/**
|
|
419
|
+
* You know how you can write `break` inside of a `for await` loop to exit it? Well, this lets you break the loop from outside. Pass any async iterable that never throws and you will get back a function and a specially proxied async iterable. Whenever you call the function all for await loops iterating the returned iterable will break. Note: This will add some extra ticks because awaiting thenable objects takes more ticks than awaiting promises.
|
|
420
|
+
* @param async_iterable The async iterable you want to make exitable
|
|
421
|
+
* @return An array containing a function, the exit function, and a wrapped async iterable
|
|
422
422
|
*/ function $bbe52965151ee7f0$export$927664b47117acb0(async_iterable) {
|
|
423
423
|
const promise_result_setting_functions = new Map();
|
|
424
424
|
const exit_function = ()=>{
|
|
@@ -1672,11 +1672,11 @@ const $4c6861fbcd3a0611$export$362abebb4b313340 = process.env.BASE_URL || "https
|
|
|
1672
1672
|
|
|
1673
1673
|
|
|
1674
1674
|
|
|
1675
|
-
/**
|
|
1676
|
-
* Gives a random number between min and max (potentially including min and max).
|
|
1677
|
-
* @param min The minimum number.
|
|
1678
|
-
* @param max The maximum number.
|
|
1679
|
-
* @returns a random number
|
|
1675
|
+
/**
|
|
1676
|
+
* Gives a random number between min and max (potentially including min and max).
|
|
1677
|
+
* @param min The minimum number.
|
|
1678
|
+
* @param max The maximum number.
|
|
1679
|
+
* @returns a random number
|
|
1680
1680
|
*/ function $3f34dc07544c5857$export$bb0a9c36cf454ea0(min, max) {
|
|
1681
1681
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
1682
1682
|
}
|
|
@@ -1930,9 +1930,9 @@ class $d10801050840d92b$export$1d9c6fddbff3441f extends $d10801050840d92b$export
|
|
|
1930
1930
|
}
|
|
1931
1931
|
|
|
1932
1932
|
|
|
1933
|
-
/**
|
|
1934
|
-
* Returns a random string
|
|
1935
|
-
* @return A random string, containing a-z, 0-9 and occasionally a dot (`.`)
|
|
1933
|
+
/**
|
|
1934
|
+
* Returns a random string
|
|
1935
|
+
* @return A random string, containing a-z, 0-9 and occasionally a dot (`.`)
|
|
1936
1936
|
*/ function $650b64c1b384c895$export$656831b7e9c341c3() {
|
|
1937
1937
|
return (Math.random() * 2e17).toString(36);
|
|
1938
1938
|
}
|
|
@@ -2218,10 +2218,10 @@ async function $44909e19109bf973$export$8f66c4c7fb96eda2(e, product_id) {
|
|
|
2218
2218
|
|
|
2219
2219
|
|
|
2220
2220
|
|
|
2221
|
-
/**
|
|
2222
|
-
* Useful for the `thresholds` option of IntersectionObserver - if you want to be notified at a 10% change, call this and set num_steps to 10. Pls see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds
|
|
2223
|
-
* @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
|
|
2224
|
-
* @return Stuff to give to IntersectionObserver
|
|
2221
|
+
/**
|
|
2222
|
+
* Useful for the `thresholds` option of IntersectionObserver - if you want to be notified at a 10% change, call this and set num_steps to 10. Pls see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds
|
|
2223
|
+
* @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
|
|
2224
|
+
* @return Stuff to give to IntersectionObserver
|
|
2225
2225
|
*/ function $0da0cad4f39e8f32$export$f8ea2e7b15b5d129(numSteps) {
|
|
2226
2226
|
const thresholds = [];
|
|
2227
2227
|
for(let i = 1.0; i <= numSteps; i++){
|
|
@@ -2233,12 +2233,12 @@ async function $44909e19109bf973$export$8f66c4c7fb96eda2(e, product_id) {
|
|
|
2233
2233
|
}
|
|
2234
2234
|
|
|
2235
2235
|
|
|
2236
|
-
/**
|
|
2237
|
-
* Elements currently intersecting with the viewport.
|
|
2238
|
-
* If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
|
|
2236
|
+
/**
|
|
2237
|
+
* Elements currently intersecting with the viewport.
|
|
2238
|
+
* If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
|
|
2239
2239
|
*/ const $72ed530554068e4f$var$current_intersections = /*@__PURE__*/ new WeakMap();
|
|
2240
|
-
/**
|
|
2241
|
-
* Currently watched elements by the intersection observer with their respective callback
|
|
2240
|
+
/**
|
|
2241
|
+
* Currently watched elements by the intersection observer with their respective callback
|
|
2242
2242
|
* */ const $72ed530554068e4f$var$watched_elements = /*@__PURE__*/ new WeakMap();
|
|
2243
2243
|
const $72ed530554068e4f$var$unwatch_element = (element)=>{
|
|
2244
2244
|
$72ed530554068e4f$var$intersection_observer.unobserve(element);
|
|
@@ -2303,9 +2303,9 @@ const $72ed530554068e4f$var$intersection_observer_callback = (entries)=>{
|
|
|
2303
2303
|
}
|
|
2304
2304
|
}
|
|
2305
2305
|
};
|
|
2306
|
-
/**
|
|
2307
|
-
* Global IntersectionObserver used for all impression tracking.
|
|
2308
|
-
* It's faster to use one observer for all elements than to create a new one for each element.
|
|
2306
|
+
/**
|
|
2307
|
+
* Global IntersectionObserver used for all impression tracking.
|
|
2308
|
+
* It's faster to use one observer for all elements than to create a new one for each element.
|
|
2309
2309
|
*/ const $72ed530554068e4f$var$intersection_observer = /*@__PURE__*/ new IntersectionObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($72ed530554068e4f$var$intersection_observer_callback), {
|
|
2310
2310
|
threshold: /*@__PURE__*/ (0, /*@__PURE__*/$0da0cad4f39e8f32$export$f8ea2e7b15b5d129)(8)
|
|
2311
2311
|
});
|
|
@@ -2325,6 +2325,10 @@ const $11ff7b46c1fb674c$export$d0efd8ed14f5c33 = (items, display, info)=>{
|
|
|
2325
2325
|
(0, $e6c6e7929ea385ae$export$de56f1198d121036)("Impression tracking: Can't observe", items, display);
|
|
2326
2326
|
return items;
|
|
2327
2327
|
}
|
|
2328
|
+
if (!info.t) {
|
|
2329
|
+
(0, $e6c6e7929ea385ae$export$de56f1198d121036)("Impression tracking: No tenant instance, can't track", items, display);
|
|
2330
|
+
return items;
|
|
2331
|
+
}
|
|
2328
2332
|
(0, $2a1cbc63a04d4a2d$export$b6ae1bc530f4c149).onexists(first_watchable_el, ({ element: element })=>{
|
|
2329
2333
|
(0, $72ed530554068e4f$export$4c51576248bcdf31)(element, ()=>{
|
|
2330
2334
|
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;
|
|
@@ -2646,17 +2650,17 @@ const $28e42b0009d694b2$export$abec7fd9f0b9cc22 = /*@__PURE__*/ (0, /*@__PURE__*
|
|
|
2646
2650
|
|
|
2647
2651
|
|
|
2648
2652
|
const $2026711c6c2d6204$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
|
|
2649
|
-
/*
|
|
2650
|
-
The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
|
|
2651
|
-
visit their web, finish the consent dialog, then run
|
|
2652
|
-
new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
|
|
2653
|
-
in the console. You should see something like
|
|
2654
|
-
'NECES:1,ANALY:1,PERON:1,MARKE:1'
|
|
2655
|
-
Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
|
|
2656
|
-
as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
|
|
2657
|
-
OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
|
|
2658
|
-
If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
|
|
2659
|
-
then check the cookie value again.
|
|
2653
|
+
/*
|
|
2654
|
+
The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
|
|
2655
|
+
visit their web, finish the consent dialog, then run
|
|
2656
|
+
new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
|
|
2657
|
+
in the console. You should see something like
|
|
2658
|
+
'NECES:1,ANALY:1,PERON:1,MARKE:1'
|
|
2659
|
+
Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
|
|
2660
|
+
as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
|
|
2661
|
+
OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
|
|
2662
|
+
If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
|
|
2663
|
+
then check the cookie value again.
|
|
2660
2664
|
*/ const $2026711c6c2d6204$var$KEY_ORDER = [
|
|
2661
2665
|
"necessary",
|
|
2662
2666
|
"statistics",
|
|
@@ -3017,8 +3021,8 @@ class $16f3a26cfac77a4c$export$8d42ce4827f43582 {
|
|
|
3017
3021
|
});
|
|
3018
3022
|
})();
|
|
3019
3023
|
}
|
|
3020
|
-
} /**
|
|
3021
|
-
* This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
|
|
3024
|
+
} /**
|
|
3025
|
+
* This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
|
|
3022
3026
|
*/ // albania
|
|
3023
3027
|
|
|
3024
3028
|
|
|
@@ -3241,11 +3245,11 @@ const $fbb09973782881cb$export$6ebd242c09192cec = /*@__PURE__*/ (0, /*@__PURE__*
|
|
|
3241
3245
|
|
|
3242
3246
|
|
|
3243
3247
|
// not ideal but can help when debugging via sentry
|
|
3244
|
-
/**
|
|
3245
|
-
* A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
|
|
3246
|
-
* @param anything Something to try to serialize - this function is crappy and your mileage may vary
|
|
3247
|
-
* @param depth How deep to go when recursing
|
|
3248
|
-
* @return An object that is somehow closer to text (better serializable by sentry) or text
|
|
3248
|
+
/**
|
|
3249
|
+
* A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
|
|
3250
|
+
* @param anything Something to try to serialize - this function is crappy and your mileage may vary
|
|
3251
|
+
* @param depth How deep to go when recursing
|
|
3252
|
+
* @return An object that is somehow closer to text (better serializable by sentry) or text
|
|
3249
3253
|
*/ function $45e05ec4fd7f1ee7$export$39d526a1194b6499(anything, depth) {
|
|
3250
3254
|
depth ??= 0;
|
|
3251
3255
|
depth++;
|
|
@@ -3372,7 +3376,7 @@ async function $558ccd2de887e6d9$export$a9fc160c5ed83bd7(t, rendering_options) {
|
|
|
3372
3376
|
}
|
|
3373
3377
|
// return if too few displays
|
|
3374
3378
|
const { min_items_to_run: min_items_to_run } = rendering_options;
|
|
3375
|
-
const good_displays = await $558ccd2de887e6d9$var$check_displays(
|
|
3379
|
+
const good_displays = await $558ccd2de887e6d9$var$check_displays(displays, min_items_to_run).catch((0, $548fd58b14b25a52$export$8048b892d651b310));
|
|
3376
3380
|
if (!good_displays) return {};
|
|
3377
3381
|
const processed_displays = await $558ccd2de887e6d9$export$c22e610107c5a15a(t, rendering_options, displays);
|
|
3378
3382
|
if (!processed_displays.length) {
|
|
@@ -3447,7 +3451,6 @@ function $558ccd2de887e6d9$export$c42139a43c877ecd(obj) {
|
|
|
3447
3451
|
return obj;
|
|
3448
3452
|
}
|
|
3449
3453
|
async function $558ccd2de887e6d9$export$cf7cbc6b76039101(t, rendering_options, displays, index, functions, elements, event_listeners = []) {
|
|
3450
|
-
let b;
|
|
3451
3454
|
let keep = true;
|
|
3452
3455
|
const info = new $558ccd2de887e6d9$export$da854280fb61cd32(t, rendering_options, displays, index, ()=>keep = false, event_listeners);
|
|
3453
3456
|
for(let i = 0; i < functions.length; i++){
|
|
@@ -3482,6 +3485,7 @@ async function $558ccd2de887e6d9$export$c22e610107c5a15a(t, rendering_options, d
|
|
|
3482
3485
|
}
|
|
3483
3486
|
class $558ccd2de887e6d9$export$da854280fb61cd32 {
|
|
3484
3487
|
constructor(t, rendering_options, displays, index, remove_display, event_listeners){
|
|
3488
|
+
// @ts-ignore Support for no-tenant recommendation rendering for js-ui/react-ui
|
|
3485
3489
|
this.t = t;
|
|
3486
3490
|
this.rendering_options = rendering_options;
|
|
3487
3491
|
this.displays = displays;
|
|
@@ -3493,7 +3497,7 @@ class $558ccd2de887e6d9$export$da854280fb61cd32 {
|
|
|
3493
3497
|
}
|
|
3494
3498
|
}
|
|
3495
3499
|
}
|
|
3496
|
-
async function $558ccd2de887e6d9$var$check_displays(
|
|
3500
|
+
async function $558ccd2de887e6d9$var$check_displays(displays, min_items_to_run) {
|
|
3497
3501
|
// don't run if too few recs
|
|
3498
3502
|
if (min_items_to_run && displays.length < min_items_to_run) {
|
|
3499
3503
|
(0, $e6c6e7929ea385ae$export$de56f1198d121036)("RR: Got too few displays, exiting");
|
|
@@ -3504,6 +3508,8 @@ async function $558ccd2de887e6d9$var$check_displays(t, displays, min_items_to_ru
|
|
|
3504
3508
|
async function $558ccd2de887e6d9$var$make_sure_we_have_displays(t, rendering_options) {
|
|
3505
3509
|
const recs = await rendering_options.recs;
|
|
3506
3510
|
if (Array.isArray(recs)) return $558ccd2de887e6d9$export$c42139a43c877ecd(recs);
|
|
3511
|
+
if (!t) // No recs and no tenant, so we can't get any. Should never happen.
|
|
3512
|
+
return [];
|
|
3507
3513
|
// get displays with get_displays if none are provided
|
|
3508
3514
|
const get_displays_options = {
|
|
3509
3515
|
type: rendering_options.type,
|
|
@@ -3728,8 +3734,8 @@ function $d1ef5fbddf08305d$var$find_last_visible(items) {
|
|
|
3728
3734
|
|
|
3729
3735
|
|
|
3730
3736
|
|
|
3731
|
-
/**
|
|
3732
|
-
* @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
|
|
3737
|
+
/**
|
|
3738
|
+
* @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
|
|
3733
3739
|
*/ function $7198207999c01453$export$55621c1ce3cd536b() {
|
|
3734
3740
|
// the idea is to have a new promise available immediately before one resolves, so to say an infinite promise
|
|
3735
3741
|
let internal_resolve; // copy and pasted from iconbeauty
|
|
@@ -3841,12 +3847,12 @@ async function $8686e45614d71607$export$9eae832ae57fbf(t, css, extra_html) {
|
|
|
3841
3847
|
|
|
3842
3848
|
// TODO: Move ArrayElement<> to better util place
|
|
3843
3849
|
// All the supported markets of all the Tenants (all possible markets).
|
|
3844
|
-
/**
|
|
3845
|
-
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3850
|
+
/**
|
|
3851
|
+
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3846
3852
|
*/ let $e86d825ce508e342$export$3db8c5834c5aa726;
|
|
3847
3853
|
// All the known locales (add more)
|
|
3848
|
-
/**
|
|
3849
|
-
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3854
|
+
/**
|
|
3855
|
+
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3850
3856
|
*/ (function(Market) {
|
|
3851
3857
|
Market["dk"] = "dk";
|
|
3852
3858
|
Market["uk"] = "uk";
|
|
@@ -3959,8 +3965,8 @@ function $e86d825ce508e342$export$47340c0b196bc0f8(market) {
|
|
|
3959
3965
|
}
|
|
3960
3966
|
function $e86d825ce508e342$export$c5b68ecd5c37aa6c(market) {
|
|
3961
3967
|
return $e86d825ce508e342$export$6eea148df5c7117c[market].currency;
|
|
3962
|
-
} /**
|
|
3963
|
-
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3968
|
+
} /**
|
|
3969
|
+
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3964
3970
|
*/
|
|
3965
3971
|
|
|
3966
3972
|
|
|
@@ -4771,6 +4777,7 @@ const $04d2f7d9126af667$export$ed8a68dacd075983 = /*@__PURE__*/ new Map();
|
|
|
4771
4777
|
const $04d2f7d9126af667$export$4b50a4de9c6bbe09 = /*@__PURE__*/ new WeakSet();
|
|
4772
4778
|
function $04d2f7d9126af667$export$fb9afe9f540ae069(elements, _display, info) {
|
|
4773
4779
|
if (!elements?.length) return elements;
|
|
4780
|
+
if (!info.t) return elements;
|
|
4774
4781
|
const elements_as_array = [
|
|
4775
4782
|
...elements
|
|
4776
4783
|
];
|
|
@@ -4796,6 +4803,8 @@ const $04d2f7d9126af667$export$3777a14dd8c2363d = /*@__PURE__*/ new WeakSet();
|
|
|
4796
4803
|
function $04d2f7d9126af667$export$1bffac19f9f0d6fc(elements, _display, info) {
|
|
4797
4804
|
if (!elements?.length) // don't make it hurt even more that rendering failed
|
|
4798
4805
|
return elements;
|
|
4806
|
+
if (!info.t) // GTAG tracking is deprecated, if we're doing no-tenant recommendation rendering it's SDK anyway.
|
|
4807
|
+
return elements;
|
|
4799
4808
|
const [first_element] = elements;
|
|
4800
4809
|
const handler = (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)(()=>{
|
|
4801
4810
|
const { rendering_options: rendering_options , displays: displays } = info;
|
|
@@ -4814,6 +4823,7 @@ function $04d2f7d9126af667$export$1bffac19f9f0d6fc(elements, _display, info) {
|
|
|
4814
4823
|
}
|
|
4815
4824
|
function $04d2f7d9126af667$export$9e1caada6901f552(elements, _display, info) {
|
|
4816
4825
|
const { t: t } = info;
|
|
4826
|
+
if (!t) return elements;
|
|
4817
4827
|
(async ()=>{
|
|
4818
4828
|
(0, $72ee205b59322497$export$eee4c4d924348b05)({
|
|
4819
4829
|
tenant: t.tenant,
|
|
@@ -5197,8 +5207,8 @@ class $0b6a8303b64cced1$export$1a8782481a9af507 {
|
|
|
5197
5207
|
}
|
|
5198
5208
|
|
|
5199
5209
|
|
|
5200
|
-
var /**
|
|
5201
|
-
* @deprecated Please use RecommendationRenderer instead
|
|
5210
|
+
var /**
|
|
5211
|
+
* @deprecated Please use RecommendationRenderer instead
|
|
5202
5212
|
*/ $52d3be7ce5146924$export$2e2bcd8739ae039 = async (options)=>{
|
|
5203
5213
|
const depict = new (0, $0b6a8303b64cced1$export$1a8782481a9af507)(options.options), done = new Promise((itsdone)=>{
|
|
5204
5214
|
document._depict_modify = true;
|
|
@@ -5474,14 +5484,14 @@ function $765ddca135d7ab33$export$c410ce1205e5118a(_t, itms, d, slider) {
|
|
|
5474
5484
|
|
|
5475
5485
|
|
|
5476
5486
|
|
|
5477
|
-
var /**
|
|
5478
|
-
* @deprecated please use `fetch_retry()` instead
|
|
5479
|
-
*
|
|
5480
|
-
* Windows proof fetch factory: windows proof fetch is a utility which retries fetch requests 10 times when they fail. Reason for this is a certain windows 10 build where the network stack randomly breaks 20% of https connections
|
|
5481
|
-
* (Note: this thing really should be rewritten with exponential backoff and a better API)
|
|
5482
|
-
* @param dlog logging function to use
|
|
5483
|
-
* @param error_log an array to which errors will be pushed
|
|
5484
|
-
* @return a windows proof fetch function
|
|
5487
|
+
var /**
|
|
5488
|
+
* @deprecated please use `fetch_retry()` instead
|
|
5489
|
+
*
|
|
5490
|
+
* Windows proof fetch factory: windows proof fetch is a utility which retries fetch requests 10 times when they fail. Reason for this is a certain windows 10 build where the network stack randomly breaks 20% of https connections
|
|
5491
|
+
* (Note: this thing really should be rewritten with exponential backoff and a better API)
|
|
5492
|
+
* @param dlog logging function to use
|
|
5493
|
+
* @param error_log an array to which errors will be pushed
|
|
5494
|
+
* @return a windows proof fetch function
|
|
5485
5495
|
*/ $c413c7798924612a$export$2e2bcd8739ae039 = (dlog, error_log)=>{
|
|
5486
5496
|
// https://sentry.io/organizations/depictai-0o/issues/2025371462/?project=5476183&query=is%3Aunresolved
|
|
5487
5497
|
// https://stackoverflow.com/a/52947884
|
|
@@ -5693,10 +5703,10 @@ async function $1cc2444a0f1b992e$export$c84671f46d6a1ca({ rows: rows , container
|
|
|
5693
5703
|
}
|
|
5694
5704
|
});
|
|
5695
5705
|
}
|
|
5696
|
-
/** Getting how many recs should be displayed for a certain row (while taking override rules into account)
|
|
5697
|
-
* This returns number of recs for this row and all the previous ones
|
|
5698
|
-
* @param row The "index" of the row (counting from the top). Starts at 1.
|
|
5699
|
-
* @param options Your cols_at_size layout option
|
|
5706
|
+
/** Getting how many recs should be displayed for a certain row (while taking override rules into account)
|
|
5707
|
+
* This returns number of recs for this row and all the previous ones
|
|
5708
|
+
* @param row The "index" of the row (counting from the top). Starts at 1.
|
|
5709
|
+
* @param options Your cols_at_size layout option
|
|
5700
5710
|
*/ function $1cc2444a0f1b992e$var$get_total_rec_amount_for_row(row, options) {
|
|
5701
5711
|
const [default_cols, , , , override_obj] = options;
|
|
5702
5712
|
const overrides = override_obj?.overrides || {};
|
|
@@ -5707,8 +5717,8 @@ async function $1cc2444a0f1b992e$export$c84671f46d6a1ca({ rows: rows , container
|
|
|
5707
5717
|
}
|
|
5708
5718
|
return total;
|
|
5709
5719
|
}
|
|
5710
|
-
/**
|
|
5711
|
-
* Same as `get_total_rec_amount_for_row` but caps the result to never exceed @param max_recs
|
|
5720
|
+
/**
|
|
5721
|
+
* Same as `get_total_rec_amount_for_row` but caps the result to never exceed @param max_recs
|
|
5712
5722
|
*/ function $1cc2444a0f1b992e$var$get_visible_recs_without_partial_rows(rows, max_recs, options) {
|
|
5713
5723
|
let visible_recs;
|
|
5714
5724
|
while((visible_recs = $1cc2444a0f1b992e$var$get_total_rec_amount_for_row(rows--, options)) > max_recs);
|
|
@@ -5747,13 +5757,13 @@ function $1cc2444a0f1b992e$export$17c3166a7ebd4688(selector_beginning, default_g
|
|
|
5747
5757
|
const overrides = override?.overrides || {};
|
|
5748
5758
|
const sorted = Object.keys(overrides).sort((r1, r2)=>parseInt(r1) - parseInt(r2));
|
|
5749
5759
|
const last_override_row = sorted.at(-1);
|
|
5750
|
-
/** We run this loop up until the last override rule + 1.
|
|
5751
|
-
* The last iteration will create styling rules that apply to every row that comes after it.
|
|
5752
|
-
* Let's say we have one override rule for row 2.
|
|
5753
|
-
* We:
|
|
5754
|
-
* 1. Create styling for row 1
|
|
5755
|
-
* 2. Create styling for row 2
|
|
5756
|
-
* 3. Create styling for row 3 which will apply to the rest of the rows. Every row will be the same from now on.
|
|
5760
|
+
/** We run this loop up until the last override rule + 1.
|
|
5761
|
+
* The last iteration will create styling rules that apply to every row that comes after it.
|
|
5762
|
+
* Let's say we have one override rule for row 2.
|
|
5763
|
+
* We:
|
|
5764
|
+
* 1. Create styling for row 1
|
|
5765
|
+
* 2. Create styling for row 2
|
|
5766
|
+
* 3. Create styling for row 3 which will apply to the rest of the rows. Every row will be the same from now on.
|
|
5757
5767
|
*/ const max_row = last_override_row ? parseInt(last_override_row) + 1 : 1;
|
|
5758
5768
|
for(let row = 1; row <= max_row; row++){
|
|
5759
5769
|
const real_n_cols = overrides[row] || n_cols;
|
|
@@ -6706,12 +6716,12 @@ function $3721a5ccba25c247$export$3d04c40e7acc1a32(initial_value) {
|
|
|
6706
6716
|
|
|
6707
6717
|
|
|
6708
6718
|
|
|
6709
|
-
/**
|
|
6710
|
-
* A wrapper around window.matchMedia, basically cross browser compatibly adds an event listener to a media query that triggers when it changes
|
|
6711
|
-
* @param query The media query (without `@media`)
|
|
6712
|
-
* @param catchified_handler The function to execute
|
|
6713
|
-
* @param initial_call If the handler should be called instantly with the current state of the media query
|
|
6714
|
-
* @return An object containing `remove`, a function which removes the event listener again
|
|
6719
|
+
/**
|
|
6720
|
+
* A wrapper around window.matchMedia, basically cross browser compatibly adds an event listener to a media query that triggers when it changes
|
|
6721
|
+
* @param query The media query (without `@media`)
|
|
6722
|
+
* @param catchified_handler The function to execute
|
|
6723
|
+
* @param initial_call If the handler should be called instantly with the current state of the media query
|
|
6724
|
+
* @return An object containing `remove`, a function which removes the event listener again
|
|
6715
6725
|
*/
|
|
6716
6726
|
function $93c499898a1702c7$export$515c3ea4d599b05a(// inspired by code in houdinisportswear modify script
|
|
6717
6727
|
query, handler, initial_call = true) {
|
|
@@ -6981,9 +6991,9 @@ async function $8594d423459ba80c$export$d63b08f4f29ddba5(t, unavailability_type)
|
|
|
6981
6991
|
|
|
6982
6992
|
|
|
6983
6993
|
|
|
6984
|
-
/**
|
|
6985
|
-
* Set but you can listen for values being added or removed
|
|
6986
|
-
* i.e. my_set.addEventListener("add", ({detail}) => console.log(detail, "was added to", my_set));
|
|
6994
|
+
/**
|
|
6995
|
+
* Set but you can listen for values being added or removed
|
|
6996
|
+
* i.e. my_set.addEventListener("add", ({detail}) => console.log(detail, "was added to", my_set));
|
|
6987
6997
|
*/ class $d343f609f5a6614f$export$74108888f38788f3 extends Set {
|
|
6988
6998
|
#et = new EventTarget();
|
|
6989
6999
|
addEventListener(event, callback, options) {
|
|
@@ -7011,12 +7021,12 @@ async function $8594d423459ba80c$export$d63b08f4f29ddba5(t, unavailability_type)
|
|
|
7011
7021
|
|
|
7012
7022
|
|
|
7013
7023
|
|
|
7014
|
-
/**
|
|
7015
|
-
* This does what you'd think Element.closest does. It finds the closest node in the DOM tree matching a selector. So it starts out with the siblings and then goes upwards in the DOM and checks the siblings and their children of the parent until there's no parent anymore.
|
|
7016
|
-
* @param element Element to start out at
|
|
7017
|
-
* @param selector Selector to search for
|
|
7018
|
-
* @param start_right=true In what direction to start: true = right, false = left
|
|
7019
|
-
* @return The found element or undefined
|
|
7024
|
+
/**
|
|
7025
|
+
* This does what you'd think Element.closest does. It finds the closest node in the DOM tree matching a selector. So it starts out with the siblings and then goes upwards in the DOM and checks the siblings and their children of the parent until there's no parent anymore.
|
|
7026
|
+
* @param element Element to start out at
|
|
7027
|
+
* @param selector Selector to search for
|
|
7028
|
+
* @param start_right=true In what direction to start: true = right, false = left
|
|
7029
|
+
* @return The found element or undefined
|
|
7020
7030
|
*/ function $14d244e5a13fa0df$export$d9fdc6ce2907f95b(element, selector, start_right = true) {
|
|
7021
7031
|
for(; element; element = element.parentNode){
|
|
7022
7032
|
if (element?.matches?.(selector)) return element;
|
|
@@ -7069,10 +7079,10 @@ function $1e9d51e365c02476$export$82539d9817116aff(e, url) {
|
|
|
7069
7079
|
}
|
|
7070
7080
|
|
|
7071
7081
|
|
|
7072
|
-
/**
|
|
7073
|
-
* This module contains utillities for working with ecom sites using shoppify.
|
|
7074
|
-
*
|
|
7075
|
-
* Shopify cart API reference: https://shopify.dev/api/ajax/reference/cart
|
|
7082
|
+
/**
|
|
7083
|
+
* This module contains utillities for working with ecom sites using shoppify.
|
|
7084
|
+
*
|
|
7085
|
+
* Shopify cart API reference: https://shopify.dev/api/ajax/reference/cart
|
|
7076
7086
|
*/
|
|
7077
7087
|
|
|
7078
7088
|
async function $7ccebf01cfe4f824$export$85be83e1935d93c2(fetch_proxy_handler, // we assume fetch is actually fetch, therefore proxy handler is typed like this
|
|
@@ -7814,9 +7824,10 @@ function $2780129735dc272e$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
|
|
|
7814
7824
|
|
|
7815
7825
|
|
|
7816
7826
|
|
|
7817
|
-
/**
|
|
7818
|
-
* Recursively sorts the keys in an object (NOT in-place, returns a new object). Do not provide objects containing anything other than primitives or other objects. Do not provide objects that have cyclical values.
|
|
7827
|
+
/**
|
|
7828
|
+
* Recursively sorts the keys in an object (NOT in-place, returns a new object). Do not provide objects containing anything other than primitives or other objects. Do not provide objects that have cyclical values.
|
|
7819
7829
|
*/ function $24daf6f6e6529b9f$export$12b4c6cbc6b8b4e4(maybe_obj) {
|
|
7830
|
+
if (!maybe_obj) return maybe_obj;
|
|
7820
7831
|
if (typeof maybe_obj != "object") return maybe_obj;
|
|
7821
7832
|
if (maybe_obj.constructor !== Object) {
|
|
7822
7833
|
if (Array.isArray(maybe_obj)) return maybe_obj.map((item)=>$24daf6f6e6529b9f$export$12b4c6cbc6b8b4e4(item));
|
|
@@ -7833,18 +7844,18 @@ function $2780129735dc272e$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
|
|
|
7833
7844
|
}
|
|
7834
7845
|
|
|
7835
7846
|
|
|
7836
|
-
/**
|
|
7837
|
-
* Tries to figure out the tenant's market (`TwoLetterMarket` for new integrations) through various means.
|
|
7838
|
-
*
|
|
7839
|
-
* 1. Checks if there is a market in one of the url segments (www.tentant.se/foo/se/bar)
|
|
7840
|
-
* 2. Checks if the market is specified in the tenant's domain name (www.tenant-se.com)
|
|
7841
|
-
* 3. Checks the toplevel domain (www.tenant.se/foo/bar)
|
|
7842
|
-
*
|
|
7843
|
-
* @param allowed_markets An array the possible markets for the tenant.
|
|
7844
|
-
* Dont forget to specify the allowed market as const (`["se", "en"] as const`) to get the best typing
|
|
7845
|
-
* @param url Specify this to overide the url to check, defaults to the current url
|
|
7846
|
-
* @param tenant The tenant's name
|
|
7847
|
-
* @returns If a market specified in `allowed_markets`was found that is returned, `undefined` otherwise
|
|
7847
|
+
/**
|
|
7848
|
+
* Tries to figure out the tenant's market (`TwoLetterMarket` for new integrations) through various means.
|
|
7849
|
+
*
|
|
7850
|
+
* 1. Checks if there is a market in one of the url segments (www.tentant.se/foo/se/bar)
|
|
7851
|
+
* 2. Checks if the market is specified in the tenant's domain name (www.tenant-se.com)
|
|
7852
|
+
* 3. Checks the toplevel domain (www.tenant.se/foo/bar)
|
|
7853
|
+
*
|
|
7854
|
+
* @param allowed_markets An array the possible markets for the tenant.
|
|
7855
|
+
* Dont forget to specify the allowed market as const (`["se", "en"] as const`) to get the best typing
|
|
7856
|
+
* @param url Specify this to overide the url to check, defaults to the current url
|
|
7857
|
+
* @param tenant The tenant's name
|
|
7858
|
+
* @returns If a market specified in `allowed_markets`was found that is returned, `undefined` otherwise
|
|
7848
7859
|
*/ function $02a3425594231893$export$a422d714c8cb1a5d(allowed_markets, url, tenant = process.env.TENANT) {
|
|
7849
7860
|
const u_o = url ? new URL(url) : location;
|
|
7850
7861
|
const { hostname: hostname } = u_o;
|
|
@@ -7961,9 +7972,9 @@ function $05802e6cb0fdbdcd$export$3427ec8268623f1(listener) {
|
|
|
7961
7972
|
|
|
7962
7973
|
|
|
7963
7974
|
|
|
7964
|
-
/**
|
|
7965
|
-
* Timeout a promise after `ms` milliseconds.
|
|
7966
|
-
* If the promise is timed out this function will return `undefined` and not throw.
|
|
7975
|
+
/**
|
|
7976
|
+
* Timeout a promise after `ms` milliseconds.
|
|
7977
|
+
* If the promise is timed out this function will return `undefined` and not throw.
|
|
7967
7978
|
*/ function $9ed7c4b0fbf9ccd8$export$cd1adfb8059b5fcd(promise, ms) {
|
|
7968
7979
|
const timeout = new Promise((res)=>setTimeout(res, ms));
|
|
7969
7980
|
return Promise.race([
|
|
@@ -8246,9 +8257,9 @@ const $69accc27bcbd6972$export$ddd70fdae1b350e6 = ()=>(0, $107a74aa4ea5902d$expo
|
|
|
8246
8257
|
|
|
8247
8258
|
|
|
8248
8259
|
|
|
8249
|
-
/**
|
|
8250
|
-
* Internal color circle used in ColorPicker
|
|
8251
|
-
* @see {createColorPicker}
|
|
8260
|
+
/**
|
|
8261
|
+
* Internal color circle used in ColorPicker
|
|
8262
|
+
* @see {createColorPicker}
|
|
8252
8263
|
*/ function $af92e61c7dfccf01$var$ColorCircle({ color: color , onClick: onClick , onHoverUpdate: onHoverUpdate }) {
|
|
8253
8264
|
const button = (0, $107a74aa4ea5902d$export$34b9dba7ce09269b)("button", {
|
|
8254
8265
|
class: "color-circle-container",
|
|
@@ -8275,9 +8286,9 @@ function $af92e61c7dfccf01$export$590326cc34f49e2d({ colors: colors , initialCol
|
|
|
8275
8286
|
ColorPicker () {
|
|
8276
8287
|
/** The currently active ColorCircle */ let activeCircle = null;
|
|
8277
8288
|
/** The currently active color object */ let activeColor = null;
|
|
8278
|
-
/**
|
|
8279
|
-
* Update the currently active color object and HTMLElement
|
|
8280
|
-
* Toggles the active class.
|
|
8289
|
+
/**
|
|
8290
|
+
* Update the currently active color object and HTMLElement
|
|
8291
|
+
* Toggles the active class.
|
|
8281
8292
|
*/ const setActive = (e, color)=>{
|
|
8282
8293
|
if (e !== activeCircle) {
|
|
8283
8294
|
if (activeCircle) activeCircle.classList.remove("active");
|
|
@@ -8290,8 +8301,8 @@ function $af92e61c7dfccf01$export$590326cc34f49e2d({ colors: colors , initialCol
|
|
|
8290
8301
|
if (!dontSetActiveOnClick) setActive(clicked, color);
|
|
8291
8302
|
onSelect(color);
|
|
8292
8303
|
};
|
|
8293
|
-
/**
|
|
8294
|
-
* Handles the preview logic.
|
|
8304
|
+
/**
|
|
8305
|
+
* Handles the preview logic.
|
|
8295
8306
|
*/ const handleSelectOnHover = (hovered, color, hovering)=>{
|
|
8296
8307
|
// Don't do any selection if the hovered circle is already selected
|
|
8297
8308
|
if (hovered === activeCircle) return;
|
|
@@ -8484,9 +8495,9 @@ function $ff973b2032639b5f$export$a62825542f1bfcf5({ what_to_watch: what_to_watc
|
|
|
8484
8495
|
2048,
|
|
8485
8496
|
4096
|
|
8486
8497
|
] , sizes_communicator: sizes_communicator , resolution_factor: resolution_factor , market_: market_ , sizes_setter_: sizes_setter_ } = {}) {
|
|
8487
|
-
/**
|
|
8488
|
-
* We support what_to_watch being optional, meaning we will take the first image we get.
|
|
8489
|
-
* For that we need to have created the image before being able to create the sizes setter.
|
|
8498
|
+
/**
|
|
8499
|
+
* We support what_to_watch being optional, meaning we will take the first image we get.
|
|
8500
|
+
* For that we need to have created the image before being able to create the sizes setter.
|
|
8490
8501
|
*/ const local_base_url = market_ ? $ff973b2032639b5f$export$3d13beba9b52c947 + "/" + market_ : $ff973b2032639b5f$export$3d13beba9b52c947;
|
|
8491
8502
|
return (image_options)=>{
|
|
8492
8503
|
const raw_src = image_options?.src || image_options?.["data-src"]; // get wanted src
|
|
@@ -8666,9 +8677,9 @@ const $a656daa2fa8c279a$var$TOUCHCANCEL = "touchcancel";
|
|
|
8666
8677
|
const $a656daa2fa8c279a$var$MOUSEOVER = "mouseover";
|
|
8667
8678
|
const $a656daa2fa8c279a$var$MOUSELEAVE = "mouseleave";
|
|
8668
8679
|
const $a656daa2fa8c279a$var$HOVER_CLASS = "hovering";
|
|
8669
|
-
/** This number represents how many elements are in front of div.images-container
|
|
8670
|
-
* Here are the elements: img.depict-img-mod, div, img.depict-img-mod, div, div.second-image-container, div.main-image-container, div.images-container
|
|
8671
|
-
* This number is not very dynamic but much more performant than iterating
|
|
8680
|
+
/** This number represents how many elements are in front of div.images-container
|
|
8681
|
+
* Here are the elements: img.depict-img-mod, div, img.depict-img-mod, div, div.second-image-container, div.main-image-container, div.images-container
|
|
8682
|
+
* This number is not very dynamic but much more performant than iterating
|
|
8672
8683
|
*/ const $a656daa2fa8c279a$var$HOVER_IMAGE_DEPTH = 7;
|
|
8673
8684
|
const $a656daa2fa8c279a$var$MAX_COLLISION_DETECTION_RATE = 70; // ms
|
|
8674
8685
|
const $a656daa2fa8c279a$var$touch_hover_elements = /*@__PURE__*/ new WeakMap();
|
|
@@ -8968,11 +8979,11 @@ function $12c29616944c2fb7$export$f2ca6fc699ca1fb4(props = {}) {
|
|
|
8968
8979
|
|
|
8969
8980
|
|
|
8970
8981
|
|
|
8971
|
-
/**
|
|
8972
|
-
* Shallowly converts all keys in an object from snake_case to camelCase.
|
|
8973
|
-
* Does not support symbol keys.
|
|
8974
|
-
*
|
|
8975
|
-
* @param obj the object. It will be cloned and not modified in-place.
|
|
8982
|
+
/**
|
|
8983
|
+
* Shallowly converts all keys in an object from snake_case to camelCase.
|
|
8984
|
+
* Does not support symbol keys.
|
|
8985
|
+
*
|
|
8986
|
+
* @param obj the object. It will be cloned and not modified in-place.
|
|
8976
8987
|
*/ function $89758b55120b0cbd$export$9dc8f3a0aa3efc85(obj) {
|
|
8977
8988
|
return Object.fromEntries(Object.entries(obj).map(([key, value])=>[
|
|
8978
8989
|
key.split("_").map((part, index)=>index ? part[0].toUpperCase() + part.slice(1) : part).join(""),
|
|
@@ -8987,9 +8998,9 @@ function $89758b55120b0cbd$export$b481488de1caa85(obj) {
|
|
|
8987
8998
|
}
|
|
8988
8999
|
|
|
8989
9000
|
|
|
8990
|
-
/**
|
|
8991
|
-
* Converts RGB to HSL
|
|
8992
|
-
* Source of function: https://www.30secondsofcode.org/js/s/rgb-to-hsl
|
|
9001
|
+
/**
|
|
9002
|
+
* Converts RGB to HSL
|
|
9003
|
+
* Source of function: https://www.30secondsofcode.org/js/s/rgb-to-hsl
|
|
8993
9004
|
*/ function $d73746ee466f09ca$export$499ef00a6a3417f8(r, g, b) {
|
|
8994
9005
|
r /= 255;
|
|
8995
9006
|
g /= 255;
|