@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.
Files changed (5) hide show
  1. package/README.md +130 -130
  2. package/dist/index.d.ts +2403 -2403
  3. package/dist/main.js +155 -144
  4. package/dist/module.js +155 -144
  5. package/package.json +2 -2
package/dist/module.js CHANGED
@@ -4,7 +4,7 @@ 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.74";
7
+ const $0766c85d387a9765$export$83d89fbfd8236492 = "0.0.76";
8
8
 
9
9
 
10
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.currentScript?.dataset?.debug === "true" || localStorage.getItem("debug") === "true"))();
@@ -48,8 +48,8 @@ function $f564adbc4675ceaf$export$fe609f0216e4ebef(url) {
48
48
 
49
49
 
50
50
 
51
- /**
52
- * @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
51
+ /**
52
+ * @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
53
53
  */ function $a1c80794e6bf4cc2$export$6e7454c733fa1fb2(fn, ...args) {
54
54
  return function(...unimportant_args) {
55
55
  return fn.apply(this, [
@@ -63,13 +63,13 @@ function $f564adbc4675ceaf$export$fe609f0216e4ebef(url) {
63
63
 
64
64
 
65
65
 
66
- /**
67
- * 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.
68
- * 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
69
- * queue is the queue of values that subscribers gets called with
70
- * last_processed_value is the last value that the subscribers were called with
71
- * push_value adds a new value to the queue and triggers the calling of the subscribers if they're done
72
- * 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
66
+ /**
67
+ * 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.
68
+ * 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
69
+ * queue is the queue of values that subscribers gets called with
70
+ * last_processed_value is the last value that the subscribers were called with
71
+ * push_value adds a new value to the queue and triggers the calling of the subscribers if they're done
72
+ * 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
73
73
  */ class $ec58be30798d6e95$export$e2c811ae0eb35313 {
74
74
  subscribers_ = [];
75
75
  waiting_for_update_ = 0;
@@ -145,10 +145,10 @@ function $ec58be30798d6e95$export$3e42f5078e3abfc0(state) {
145
145
  }
146
146
 
147
147
 
148
- /**
149
- * 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.
150
- * @param async_iterable The async iterable you want to make exitable
151
- * @return An array containing a function, the exit function, and a wrapped async iterable
148
+ /**
149
+ * 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.
150
+ * @param async_iterable The async iterable you want to make exitable
151
+ * @return An array containing a function, the exit function, and a wrapped async iterable
152
152
  */ function $b8270fcf290bb3af$export$927664b47117acb0(async_iterable) {
153
153
  const promise_result_setting_functions = new Map();
154
154
  const exit_function = ()=>{
@@ -1402,11 +1402,11 @@ const $6c2b49f3f564b0d1$export$362abebb4b313340 = process.env.BASE_URL || "https
1402
1402
 
1403
1403
 
1404
1404
 
1405
- /**
1406
- * Gives a random number between min and max (potentially including min and max).
1407
- * @param min The minimum number.
1408
- * @param max The maximum number.
1409
- * @returns a random number
1405
+ /**
1406
+ * Gives a random number between min and max (potentially including min and max).
1407
+ * @param min The minimum number.
1408
+ * @param max The maximum number.
1409
+ * @returns a random number
1410
1410
  */ function $d89638655e64f324$export$bb0a9c36cf454ea0(min, max) {
1411
1411
  return Math.floor(Math.random() * (max - min + 1)) + min;
1412
1412
  }
@@ -1660,9 +1660,9 @@ class $4ce764ddfee055ef$export$1d9c6fddbff3441f extends $4ce764ddfee055ef$export
1660
1660
  }
1661
1661
 
1662
1662
 
1663
- /**
1664
- * Returns a random string
1665
- * @return A random string, containing a-z, 0-9 and occasionally a dot (`.`)
1663
+ /**
1664
+ * Returns a random string
1665
+ * @return A random string, containing a-z, 0-9 and occasionally a dot (`.`)
1666
1666
  */ function $460df8550f9d084d$export$656831b7e9c341c3() {
1667
1667
  return (Math.random() * 2e17).toString(36);
1668
1668
  }
@@ -1948,10 +1948,10 @@ async function $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, product_id) {
1948
1948
 
1949
1949
 
1950
1950
 
1951
- /**
1952
- * 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
1953
- * @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
1954
- * @return Stuff to give to IntersectionObserver
1951
+ /**
1952
+ * 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
1953
+ * @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
1954
+ * @return Stuff to give to IntersectionObserver
1955
1955
  */ function $9ab9ecb74920f343$export$f8ea2e7b15b5d129(numSteps) {
1956
1956
  const thresholds = [];
1957
1957
  for(let i = 1.0; i <= numSteps; i++){
@@ -1963,12 +1963,12 @@ async function $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, product_id) {
1963
1963
  }
1964
1964
 
1965
1965
 
1966
- /**
1967
- * Elements currently intersecting with the viewport.
1968
- * If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
1966
+ /**
1967
+ * Elements currently intersecting with the viewport.
1968
+ * If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
1969
1969
  */ const $f24c14db771b471d$var$current_intersections = /*@__PURE__*/ new WeakMap();
1970
- /**
1971
- * Currently watched elements by the intersection observer with their respective callback
1970
+ /**
1971
+ * Currently watched elements by the intersection observer with their respective callback
1972
1972
  * */ const $f24c14db771b471d$var$watched_elements = /*@__PURE__*/ new WeakMap();
1973
1973
  const $f24c14db771b471d$var$unwatch_element = (element)=>{
1974
1974
  $f24c14db771b471d$var$intersection_observer.unobserve(element);
@@ -2033,9 +2033,9 @@ const $f24c14db771b471d$var$intersection_observer_callback = (entries)=>{
2033
2033
  }
2034
2034
  }
2035
2035
  };
2036
- /**
2037
- * Global IntersectionObserver used for all impression tracking.
2038
- * It's faster to use one observer for all elements than to create a new one for each element.
2036
+ /**
2037
+ * Global IntersectionObserver used for all impression tracking.
2038
+ * It's faster to use one observer for all elements than to create a new one for each element.
2039
2039
  */ const $f24c14db771b471d$var$intersection_observer = /*@__PURE__*/ new IntersectionObserver((0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)($f24c14db771b471d$var$intersection_observer_callback), {
2040
2040
  threshold: /*@__PURE__*/ (0, /*@__PURE__*/$9ab9ecb74920f343$export$f8ea2e7b15b5d129)(8)
2041
2041
  });
@@ -2055,6 +2055,10 @@ const $405969d60b37fdac$export$d0efd8ed14f5c33 = (items, display, info)=>{
2055
2055
  (0, $649f456f663da9fc$export$de56f1198d121036)("Impression tracking: Can't observe", items, display);
2056
2056
  return items;
2057
2057
  }
2058
+ if (!info.t) {
2059
+ (0, $649f456f663da9fc$export$de56f1198d121036)("Impression tracking: No tenant instance, can't track", items, display);
2060
+ return items;
2061
+ }
2058
2062
  (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(first_watchable_el, ({ element: element })=>{
2059
2063
  (0, $f24c14db771b471d$export$4c51576248bcdf31)(element, ()=>{
2060
2064
  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;
@@ -2376,17 +2380,17 @@ const $155540b3b8aca771$export$abec7fd9f0b9cc22 = /*@__PURE__*/ (0, /*@__PURE__*
2376
2380
 
2377
2381
 
2378
2382
  const $5dbacdc6a3feeb15$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
2379
- /*
2380
- The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
2381
- visit their web, finish the consent dialog, then run
2382
- new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
2383
- in the console. You should see something like
2384
- 'NECES:1,ANALY:1,PERON:1,MARKE:1'
2385
- Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
2386
- as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
2387
- OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
2388
- If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
2389
- then check the cookie value again.
2383
+ /*
2384
+ The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
2385
+ visit their web, finish the consent dialog, then run
2386
+ new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
2387
+ in the console. You should see something like
2388
+ 'NECES:1,ANALY:1,PERON:1,MARKE:1'
2389
+ Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
2390
+ as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
2391
+ OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
2392
+ If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
2393
+ then check the cookie value again.
2390
2394
  */ const $5dbacdc6a3feeb15$var$KEY_ORDER = [
2391
2395
  "necessary",
2392
2396
  "statistics",
@@ -2747,8 +2751,8 @@ class $26eaaddf434c84f1$export$8d42ce4827f43582 {
2747
2751
  });
2748
2752
  })();
2749
2753
  }
2750
- } /**
2751
- * This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
2754
+ } /**
2755
+ * This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
2752
2756
  */ // albania
2753
2757
 
2754
2758
 
@@ -2971,11 +2975,11 @@ const $d4ffde0b9fca0369$export$6ebd242c09192cec = /*@__PURE__*/ (0, /*@__PURE__*
2971
2975
 
2972
2976
 
2973
2977
  // not ideal but can help when debugging via sentry
2974
- /**
2975
- * A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
2976
- * @param anything Something to try to serialize - this function is crappy and your mileage may vary
2977
- * @param depth How deep to go when recursing
2978
- * @return An object that is somehow closer to text (better serializable by sentry) or text
2978
+ /**
2979
+ * A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
2980
+ * @param anything Something to try to serialize - this function is crappy and your mileage may vary
2981
+ * @param depth How deep to go when recursing
2982
+ * @return An object that is somehow closer to text (better serializable by sentry) or text
2979
2983
  */ function $5c4afc453f904a1f$export$39d526a1194b6499(anything, depth) {
2980
2984
  depth ??= 0;
2981
2985
  depth++;
@@ -3102,7 +3106,7 @@ async function $5cbe24d064a033ed$export$a9fc160c5ed83bd7(t, rendering_options) {
3102
3106
  }
3103
3107
  // return if too few displays
3104
3108
  const { min_items_to_run: min_items_to_run } = rendering_options;
3105
- const good_displays = await $5cbe24d064a033ed$var$check_displays(t, displays, min_items_to_run).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
3109
+ const good_displays = await $5cbe24d064a033ed$var$check_displays(displays, min_items_to_run).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
3106
3110
  if (!good_displays) return {};
3107
3111
  const processed_displays = await $5cbe24d064a033ed$export$c22e610107c5a15a(t, rendering_options, displays);
3108
3112
  if (!processed_displays.length) {
@@ -3177,7 +3181,6 @@ function $5cbe24d064a033ed$export$c42139a43c877ecd(obj) {
3177
3181
  return obj;
3178
3182
  }
3179
3183
  async function $5cbe24d064a033ed$export$cf7cbc6b76039101(t, rendering_options, displays, index, functions, elements, event_listeners = []) {
3180
- let b;
3181
3184
  let keep = true;
3182
3185
  const info = new $5cbe24d064a033ed$export$da854280fb61cd32(t, rendering_options, displays, index, ()=>keep = false, event_listeners);
3183
3186
  for(let i = 0; i < functions.length; i++){
@@ -3212,6 +3215,7 @@ async function $5cbe24d064a033ed$export$c22e610107c5a15a(t, rendering_options, d
3212
3215
  }
3213
3216
  class $5cbe24d064a033ed$export$da854280fb61cd32 {
3214
3217
  constructor(t, rendering_options, displays, index, remove_display, event_listeners){
3218
+ // @ts-ignore Support for no-tenant recommendation rendering for js-ui/react-ui
3215
3219
  this.t = t;
3216
3220
  this.rendering_options = rendering_options;
3217
3221
  this.displays = displays;
@@ -3223,7 +3227,7 @@ class $5cbe24d064a033ed$export$da854280fb61cd32 {
3223
3227
  }
3224
3228
  }
3225
3229
  }
3226
- async function $5cbe24d064a033ed$var$check_displays(t, displays, min_items_to_run) {
3230
+ async function $5cbe24d064a033ed$var$check_displays(displays, min_items_to_run) {
3227
3231
  // don't run if too few recs
3228
3232
  if (min_items_to_run && displays.length < min_items_to_run) {
3229
3233
  (0, $649f456f663da9fc$export$de56f1198d121036)("RR: Got too few displays, exiting");
@@ -3234,6 +3238,8 @@ async function $5cbe24d064a033ed$var$check_displays(t, displays, min_items_to_ru
3234
3238
  async function $5cbe24d064a033ed$var$make_sure_we_have_displays(t, rendering_options) {
3235
3239
  const recs = await rendering_options.recs;
3236
3240
  if (Array.isArray(recs)) return $5cbe24d064a033ed$export$c42139a43c877ecd(recs);
3241
+ if (!t) // No recs and no tenant, so we can't get any. Should never happen.
3242
+ return [];
3237
3243
  // get displays with get_displays if none are provided
3238
3244
  const get_displays_options = {
3239
3245
  type: rendering_options.type,
@@ -3458,8 +3464,8 @@ function $ea554f5a28904975$var$find_last_visible(items) {
3458
3464
 
3459
3465
 
3460
3466
 
3461
- /**
3462
- * @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
3467
+ /**
3468
+ * @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
3463
3469
  */ function $92b7ea2cf75c4aec$export$55621c1ce3cd536b() {
3464
3470
  // the idea is to have a new promise available immediately before one resolves, so to say an infinite promise
3465
3471
  let internal_resolve; // copy and pasted from iconbeauty
@@ -3571,12 +3577,12 @@ async function $efda45906c6cbac7$export$9eae832ae57fbf(t, css, extra_html) {
3571
3577
 
3572
3578
  // TODO: Move ArrayElement<> to better util place
3573
3579
  // All the supported markets of all the Tenants (all possible markets).
3574
- /**
3575
- * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3580
+ /**
3581
+ * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3576
3582
  */ let $a40013fcba50c9ee$export$3db8c5834c5aa726;
3577
3583
  // All the known locales (add more)
3578
- /**
3579
- * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3584
+ /**
3585
+ * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3580
3586
  */ (function(Market) {
3581
3587
  Market["dk"] = "dk";
3582
3588
  Market["uk"] = "uk";
@@ -3689,8 +3695,8 @@ function $a40013fcba50c9ee$export$47340c0b196bc0f8(market) {
3689
3695
  }
3690
3696
  function $a40013fcba50c9ee$export$c5b68ecd5c37aa6c(market) {
3691
3697
  return $a40013fcba50c9ee$export$6eea148df5c7117c[market].currency;
3692
- } /**
3693
- * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3698
+ } /**
3699
+ * @deprecated please use TwoLetterMarket / readonly arrays/objects instead
3694
3700
  */
3695
3701
 
3696
3702
 
@@ -4501,6 +4507,7 @@ const $c1503704e45e6a15$export$ed8a68dacd075983 = /*@__PURE__*/ new Map();
4501
4507
  const $c1503704e45e6a15$export$4b50a4de9c6bbe09 = /*@__PURE__*/ new WeakSet();
4502
4508
  function $c1503704e45e6a15$export$fb9afe9f540ae069(elements, _display, info) {
4503
4509
  if (!elements?.length) return elements;
4510
+ if (!info.t) return elements;
4504
4511
  const elements_as_array = [
4505
4512
  ...elements
4506
4513
  ];
@@ -4526,6 +4533,8 @@ const $c1503704e45e6a15$export$3777a14dd8c2363d = /*@__PURE__*/ new WeakSet();
4526
4533
  function $c1503704e45e6a15$export$1bffac19f9f0d6fc(elements, _display, info) {
4527
4534
  if (!elements?.length) // don't make it hurt even more that rendering failed
4528
4535
  return elements;
4536
+ if (!info.t) // GTAG tracking is deprecated, if we're doing no-tenant recommendation rendering it's SDK anyway.
4537
+ return elements;
4529
4538
  const [first_element] = elements;
4530
4539
  const handler = (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)(()=>{
4531
4540
  const { rendering_options: rendering_options , displays: displays } = info;
@@ -4544,6 +4553,7 @@ function $c1503704e45e6a15$export$1bffac19f9f0d6fc(elements, _display, info) {
4544
4553
  }
4545
4554
  function $c1503704e45e6a15$export$9e1caada6901f552(elements, _display, info) {
4546
4555
  const { t: t } = info;
4556
+ if (!t) return elements;
4547
4557
  (async ()=>{
4548
4558
  (0, $aa0140679dc70b7a$export$eee4c4d924348b05)({
4549
4559
  tenant: t.tenant,
@@ -4927,8 +4937,8 @@ class $366fff12da348e66$export$1a8782481a9af507 {
4927
4937
  }
4928
4938
 
4929
4939
 
4930
- var /**
4931
- * @deprecated Please use RecommendationRenderer instead
4940
+ var /**
4941
+ * @deprecated Please use RecommendationRenderer instead
4932
4942
  */ $51bbc74e39f5e5c6$export$2e2bcd8739ae039 = async (options)=>{
4933
4943
  const depict = new (0, $366fff12da348e66$export$1a8782481a9af507)(options.options), done = new Promise((itsdone)=>{
4934
4944
  document._depict_modify = true;
@@ -5204,14 +5214,14 @@ function $f494377581cfb2b4$export$c410ce1205e5118a(_t, itms, d, slider) {
5204
5214
 
5205
5215
 
5206
5216
 
5207
- var /**
5208
- * @deprecated please use `fetch_retry()` instead
5209
- *
5210
- * 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
5211
- * (Note: this thing really should be rewritten with exponential backoff and a better API)
5212
- * @param dlog logging function to use
5213
- * @param error_log an array to which errors will be pushed
5214
- * @return a windows proof fetch function
5217
+ var /**
5218
+ * @deprecated please use `fetch_retry()` instead
5219
+ *
5220
+ * 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
5221
+ * (Note: this thing really should be rewritten with exponential backoff and a better API)
5222
+ * @param dlog logging function to use
5223
+ * @param error_log an array to which errors will be pushed
5224
+ * @return a windows proof fetch function
5215
5225
  */ $acf11540344875ed$export$2e2bcd8739ae039 = (dlog, error_log)=>{
5216
5226
  // https://sentry.io/organizations/depictai-0o/issues/2025371462/?project=5476183&query=is%3Aunresolved
5217
5227
  // https://stackoverflow.com/a/52947884
@@ -5423,10 +5433,10 @@ async function $30e801eaa3dc319e$export$c84671f46d6a1ca({ rows: rows , container
5423
5433
  }
5424
5434
  });
5425
5435
  }
5426
- /** Getting how many recs should be displayed for a certain row (while taking override rules into account)
5427
- * This returns number of recs for this row and all the previous ones
5428
- * @param row The "index" of the row (counting from the top). Starts at 1.
5429
- * @param options Your cols_at_size layout option
5436
+ /** Getting how many recs should be displayed for a certain row (while taking override rules into account)
5437
+ * This returns number of recs for this row and all the previous ones
5438
+ * @param row The "index" of the row (counting from the top). Starts at 1.
5439
+ * @param options Your cols_at_size layout option
5430
5440
  */ function $30e801eaa3dc319e$var$get_total_rec_amount_for_row(row, options) {
5431
5441
  const [default_cols, , , , override_obj] = options;
5432
5442
  const overrides = override_obj?.overrides || {};
@@ -5437,8 +5447,8 @@ async function $30e801eaa3dc319e$export$c84671f46d6a1ca({ rows: rows , container
5437
5447
  }
5438
5448
  return total;
5439
5449
  }
5440
- /**
5441
- * Same as `get_total_rec_amount_for_row` but caps the result to never exceed @param max_recs
5450
+ /**
5451
+ * Same as `get_total_rec_amount_for_row` but caps the result to never exceed @param max_recs
5442
5452
  */ function $30e801eaa3dc319e$var$get_visible_recs_without_partial_rows(rows, max_recs, options) {
5443
5453
  let visible_recs;
5444
5454
  while((visible_recs = $30e801eaa3dc319e$var$get_total_rec_amount_for_row(rows--, options)) > max_recs);
@@ -5477,13 +5487,13 @@ function $30e801eaa3dc319e$export$17c3166a7ebd4688(selector_beginning, default_g
5477
5487
  const overrides = override?.overrides || {};
5478
5488
  const sorted = Object.keys(overrides).sort((r1, r2)=>parseInt(r1) - parseInt(r2));
5479
5489
  const last_override_row = sorted.at(-1);
5480
- /** We run this loop up until the last override rule + 1.
5481
- * The last iteration will create styling rules that apply to every row that comes after it.
5482
- * Let's say we have one override rule for row 2.
5483
- * We:
5484
- * 1. Create styling for row 1
5485
- * 2. Create styling for row 2
5486
- * 3. Create styling for row 3 which will apply to the rest of the rows. Every row will be the same from now on.
5490
+ /** We run this loop up until the last override rule + 1.
5491
+ * The last iteration will create styling rules that apply to every row that comes after it.
5492
+ * Let's say we have one override rule for row 2.
5493
+ * We:
5494
+ * 1. Create styling for row 1
5495
+ * 2. Create styling for row 2
5496
+ * 3. Create styling for row 3 which will apply to the rest of the rows. Every row will be the same from now on.
5487
5497
  */ const max_row = last_override_row ? parseInt(last_override_row) + 1 : 1;
5488
5498
  for(let row = 1; row <= max_row; row++){
5489
5499
  const real_n_cols = overrides[row] || n_cols;
@@ -6436,12 +6446,12 @@ function $49c4fa2e27e642fa$export$3d04c40e7acc1a32(initial_value) {
6436
6446
 
6437
6447
 
6438
6448
 
6439
- /**
6440
- * A wrapper around window.matchMedia, basically cross browser compatibly adds an event listener to a media query that triggers when it changes
6441
- * @param query The media query (without `@media`)
6442
- * @param catchified_handler The function to execute
6443
- * @param initial_call If the handler should be called instantly with the current state of the media query
6444
- * @return An object containing `remove`, a function which removes the event listener again
6449
+ /**
6450
+ * A wrapper around window.matchMedia, basically cross browser compatibly adds an event listener to a media query that triggers when it changes
6451
+ * @param query The media query (without `@media`)
6452
+ * @param catchified_handler The function to execute
6453
+ * @param initial_call If the handler should be called instantly with the current state of the media query
6454
+ * @return An object containing `remove`, a function which removes the event listener again
6445
6455
  */
6446
6456
  function $29407d8301dc2f23$export$515c3ea4d599b05a(// inspired by code in houdinisportswear modify script
6447
6457
  query, handler, initial_call = true) {
@@ -6711,9 +6721,9 @@ async function $54793663e06a1437$export$d63b08f4f29ddba5(t, unavailability_type)
6711
6721
 
6712
6722
 
6713
6723
 
6714
- /**
6715
- * Set but you can listen for values being added or removed
6716
- * i.e. my_set.addEventListener("add", ({detail}) => console.log(detail, "was added to", my_set));
6724
+ /**
6725
+ * Set but you can listen for values being added or removed
6726
+ * i.e. my_set.addEventListener("add", ({detail}) => console.log(detail, "was added to", my_set));
6717
6727
  */ class $2030306bed68a8c7$export$74108888f38788f3 extends Set {
6718
6728
  #et = new EventTarget();
6719
6729
  addEventListener(event, callback, options) {
@@ -6741,12 +6751,12 @@ async function $54793663e06a1437$export$d63b08f4f29ddba5(t, unavailability_type)
6741
6751
 
6742
6752
 
6743
6753
 
6744
- /**
6745
- * 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.
6746
- * @param element Element to start out at
6747
- * @param selector Selector to search for
6748
- * @param start_right=true In what direction to start: true = right, false = left
6749
- * @return The found element or undefined
6754
+ /**
6755
+ * 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.
6756
+ * @param element Element to start out at
6757
+ * @param selector Selector to search for
6758
+ * @param start_right=true In what direction to start: true = right, false = left
6759
+ * @return The found element or undefined
6750
6760
  */ function $1ce9aeebfbcb93f9$export$d9fdc6ce2907f95b(element, selector, start_right = true) {
6751
6761
  for(; element; element = element.parentNode){
6752
6762
  if (element?.matches?.(selector)) return element;
@@ -6799,10 +6809,10 @@ function $ead1f6ae93c69da9$export$82539d9817116aff(e, url) {
6799
6809
  }
6800
6810
 
6801
6811
 
6802
- /**
6803
- * This module contains utillities for working with ecom sites using shoppify.
6804
- *
6805
- * Shopify cart API reference: https://shopify.dev/api/ajax/reference/cart
6812
+ /**
6813
+ * This module contains utillities for working with ecom sites using shoppify.
6814
+ *
6815
+ * Shopify cart API reference: https://shopify.dev/api/ajax/reference/cart
6806
6816
  */
6807
6817
 
6808
6818
  async function $b6f5b218b1a73900$export$85be83e1935d93c2(fetch_proxy_handler, // we assume fetch is actually fetch, therefore proxy handler is typed like this
@@ -7544,9 +7554,10 @@ function $bbb9f33eb5feb86a$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
7544
7554
 
7545
7555
 
7546
7556
 
7547
- /**
7548
- * 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.
7557
+ /**
7558
+ * 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.
7549
7559
  */ function $8d4dfadc5e12c7fb$export$12b4c6cbc6b8b4e4(maybe_obj) {
7560
+ if (!maybe_obj) return maybe_obj;
7550
7561
  if (typeof maybe_obj != "object") return maybe_obj;
7551
7562
  if (maybe_obj.constructor !== Object) {
7552
7563
  if (Array.isArray(maybe_obj)) return maybe_obj.map((item)=>$8d4dfadc5e12c7fb$export$12b4c6cbc6b8b4e4(item));
@@ -7563,18 +7574,18 @@ function $bbb9f33eb5feb86a$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
7563
7574
  }
7564
7575
 
7565
7576
 
7566
- /**
7567
- * Tries to figure out the tenant's market (`TwoLetterMarket` for new integrations) through various means.
7568
- *
7569
- * 1. Checks if there is a market in one of the url segments (www.tentant.se/foo/se/bar)
7570
- * 2. Checks if the market is specified in the tenant's domain name (www.tenant-se.com)
7571
- * 3. Checks the toplevel domain (www.tenant.se/foo/bar)
7572
- *
7573
- * @param allowed_markets An array the possible markets for the tenant.
7574
- * Dont forget to specify the allowed market as const (`["se", "en"] as const`) to get the best typing
7575
- * @param url Specify this to overide the url to check, defaults to the current url
7576
- * @param tenant The tenant's name
7577
- * @returns If a market specified in `allowed_markets`was found that is returned, `undefined` otherwise
7577
+ /**
7578
+ * Tries to figure out the tenant's market (`TwoLetterMarket` for new integrations) through various means.
7579
+ *
7580
+ * 1. Checks if there is a market in one of the url segments (www.tentant.se/foo/se/bar)
7581
+ * 2. Checks if the market is specified in the tenant's domain name (www.tenant-se.com)
7582
+ * 3. Checks the toplevel domain (www.tenant.se/foo/bar)
7583
+ *
7584
+ * @param allowed_markets An array the possible markets for the tenant.
7585
+ * Dont forget to specify the allowed market as const (`["se", "en"] as const`) to get the best typing
7586
+ * @param url Specify this to overide the url to check, defaults to the current url
7587
+ * @param tenant The tenant's name
7588
+ * @returns If a market specified in `allowed_markets`was found that is returned, `undefined` otherwise
7578
7589
  */ function $eda086e0899e75b0$export$a422d714c8cb1a5d(allowed_markets, url, tenant = process.env.TENANT) {
7579
7590
  const u_o = url ? new URL(url) : location;
7580
7591
  const { hostname: hostname } = u_o;
@@ -7691,9 +7702,9 @@ function $e72f2f1d48dc3a53$export$3427ec8268623f1(listener) {
7691
7702
 
7692
7703
 
7693
7704
 
7694
- /**
7695
- * Timeout a promise after `ms` milliseconds.
7696
- * If the promise is timed out this function will return `undefined` and not throw.
7705
+ /**
7706
+ * Timeout a promise after `ms` milliseconds.
7707
+ * If the promise is timed out this function will return `undefined` and not throw.
7697
7708
  */ function $55698e6e298abcb0$export$cd1adfb8059b5fcd(promise, ms) {
7698
7709
  const timeout = new Promise((res)=>setTimeout(res, ms));
7699
7710
  return Promise.race([
@@ -7976,9 +7987,9 @@ const $7693290d077384da$export$ddd70fdae1b350e6 = ()=>(0, $63cbb5de51d11596$expo
7976
7987
 
7977
7988
 
7978
7989
 
7979
- /**
7980
- * Internal color circle used in ColorPicker
7981
- * @see {createColorPicker}
7990
+ /**
7991
+ * Internal color circle used in ColorPicker
7992
+ * @see {createColorPicker}
7982
7993
  */ function $6f1582c15e13f2f0$var$ColorCircle({ color: color , onClick: onClick , onHoverUpdate: onHoverUpdate }) {
7983
7994
  const button = (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("button", {
7984
7995
  class: "color-circle-container",
@@ -8005,9 +8016,9 @@ function $6f1582c15e13f2f0$export$590326cc34f49e2d({ colors: colors , initialCol
8005
8016
  ColorPicker () {
8006
8017
  /** The currently active ColorCircle */ let activeCircle = null;
8007
8018
  /** The currently active color object */ let activeColor = null;
8008
- /**
8009
- * Update the currently active color object and HTMLElement
8010
- * Toggles the active class.
8019
+ /**
8020
+ * Update the currently active color object and HTMLElement
8021
+ * Toggles the active class.
8011
8022
  */ const setActive = (e, color)=>{
8012
8023
  if (e !== activeCircle) {
8013
8024
  if (activeCircle) activeCircle.classList.remove("active");
@@ -8020,8 +8031,8 @@ function $6f1582c15e13f2f0$export$590326cc34f49e2d({ colors: colors , initialCol
8020
8031
  if (!dontSetActiveOnClick) setActive(clicked, color);
8021
8032
  onSelect(color);
8022
8033
  };
8023
- /**
8024
- * Handles the preview logic.
8034
+ /**
8035
+ * Handles the preview logic.
8025
8036
  */ const handleSelectOnHover = (hovered, color, hovering)=>{
8026
8037
  // Don't do any selection if the hovered circle is already selected
8027
8038
  if (hovered === activeCircle) return;
@@ -8214,9 +8225,9 @@ function $45af9e834781a9bc$export$a62825542f1bfcf5({ what_to_watch: what_to_watc
8214
8225
  2048,
8215
8226
  4096
8216
8227
  ] , sizes_communicator: sizes_communicator , resolution_factor: resolution_factor , market_: market_ , sizes_setter_: sizes_setter_ } = {}) {
8217
- /**
8218
- * We support what_to_watch being optional, meaning we will take the first image we get.
8219
- * For that we need to have created the image before being able to create the sizes setter.
8228
+ /**
8229
+ * We support what_to_watch being optional, meaning we will take the first image we get.
8230
+ * For that we need to have created the image before being able to create the sizes setter.
8220
8231
  */ const local_base_url = market_ ? $45af9e834781a9bc$export$3d13beba9b52c947 + "/" + market_ : $45af9e834781a9bc$export$3d13beba9b52c947;
8221
8232
  return (image_options)=>{
8222
8233
  const raw_src = image_options?.src || image_options?.["data-src"]; // get wanted src
@@ -8396,9 +8407,9 @@ const $8483d1d9fcee52ec$var$TOUCHCANCEL = "touchcancel";
8396
8407
  const $8483d1d9fcee52ec$var$MOUSEOVER = "mouseover";
8397
8408
  const $8483d1d9fcee52ec$var$MOUSELEAVE = "mouseleave";
8398
8409
  const $8483d1d9fcee52ec$var$HOVER_CLASS = "hovering";
8399
- /** This number represents how many elements are in front of div.images-container
8400
- * 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
8401
- * This number is not very dynamic but much more performant than iterating
8410
+ /** This number represents how many elements are in front of div.images-container
8411
+ * 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
8412
+ * This number is not very dynamic but much more performant than iterating
8402
8413
  */ const $8483d1d9fcee52ec$var$HOVER_IMAGE_DEPTH = 7;
8403
8414
  const $8483d1d9fcee52ec$var$MAX_COLLISION_DETECTION_RATE = 70; // ms
8404
8415
  const $8483d1d9fcee52ec$var$touch_hover_elements = /*@__PURE__*/ new WeakMap();
@@ -8698,11 +8709,11 @@ function $f5ca01afd4680bdd$export$f2ca6fc699ca1fb4(props = {}) {
8698
8709
 
8699
8710
 
8700
8711
 
8701
- /**
8702
- * Shallowly converts all keys in an object from snake_case to camelCase.
8703
- * Does not support symbol keys.
8704
- *
8705
- * @param obj the object. It will be cloned and not modified in-place.
8712
+ /**
8713
+ * Shallowly converts all keys in an object from snake_case to camelCase.
8714
+ * Does not support symbol keys.
8715
+ *
8716
+ * @param obj the object. It will be cloned and not modified in-place.
8706
8717
  */ function $4d49697a7a9a77a6$export$9dc8f3a0aa3efc85(obj) {
8707
8718
  return Object.fromEntries(Object.entries(obj).map(([key, value])=>[
8708
8719
  key.split("_").map((part, index)=>index ? part[0].toUpperCase() + part.slice(1) : part).join(""),
@@ -8717,9 +8728,9 @@ function $4d49697a7a9a77a6$export$b481488de1caa85(obj) {
8717
8728
  }
8718
8729
 
8719
8730
 
8720
- /**
8721
- * Converts RGB to HSL
8722
- * Source of function: https://www.30secondsofcode.org/js/s/rgb-to-hsl
8731
+ /**
8732
+ * Converts RGB to HSL
8733
+ * Source of function: https://www.30secondsofcode.org/js/s/rgb-to-hsl
8723
8734
  */ function $b828952b0fe1df8f$export$499ef00a6a3417f8(r, g, b) {
8724
8735
  r /= 255;
8725
8736
  g /= 255;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/utilishared",
3
- "version": "0.0.74",
3
+ "version": "0.0.76",
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.22",
46
+ "@depict-ai/types": "^0.0.24",
47
47
  "@parcel/resolver-default": "^2.8.0",
48
48
  "@sentry/cli": "latest",
49
49
  "@sentry/types": "^7.13.0",