@depict-ai/utilishared 0.0.73 → 0.0.75

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 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.73";
3
+ export const version = "0.0.75";
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]`.
@@ -1087,12 +1087,14 @@ export interface LegacyDisplay {
1087
1087
  ga_product_ids?: string[];
1088
1088
  /** The variation IDs */
1089
1089
  variant_ids?: string[];
1090
- /** The recommendation ID */
1091
- recommendation_id: string;
1090
+ /** Unique search result ID used by Depict */
1091
+ search_result_id?: string;
1092
+ /** Unique product listing result ID used by Depict */
1093
+ product_listing_result_id?: string;
1094
+ /** Unique recommendation result ID used by Depict */
1095
+ recommendation_id?: string;
1092
1096
  /** The title */
1093
1097
  title: string;
1094
- /** The search result ID */
1095
- search_result_id?: string;
1096
1098
  [key: string]: any;
1097
1099
  }
1098
1100
  interface ModernDisplay {
@@ -1109,16 +1111,22 @@ interface ModernDisplay {
1109
1111
  /** Product of the different variants */
1110
1112
  variant_product_ids: string[];
1111
1113
  /** Unique search result ID used by Depict */
1112
- search_result_id: string;
1114
+ search_result_id?: string;
1115
+ /** Unique product listing result ID used by Depict */
1116
+ product_listing_result_id?: string;
1117
+ /** Unique recommendation result ID used by Depict */
1118
+ recommendation_id?: string;
1113
1119
  /** Recommendation type logic used by Depict */
1114
1120
  logic?: string;
1115
1121
  }
1116
1122
  interface BasicDisplay {
1117
1123
  product_id: string;
1118
- /** Unique recommendation ID used by Depict */
1119
- recommendation_id?: string;
1120
1124
  /** Unique search result ID used by Depict */
1121
1125
  search_result_id?: string;
1126
+ /** Unique product listing result ID used by Depict */
1127
+ product_listing_result_id?: string;
1128
+ /** Unique recommendation result ID used by Depict */
1129
+ recommendation_id?: string;
1122
1130
  /** Recommendation type logic used by Depict */
1123
1131
  logic?: string;
1124
1132
  [key: string]: any;
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.73";
277
+ const $815f67c61b4c0a42$export$83d89fbfd8236492 = "0.0.75";
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"))();
@@ -998,7 +998,7 @@ class $04a37742898e4bd5$export$32ccf3a614c84258 {
998
998
  }
999
999
 
1000
1000
 
1001
- const $7599647868f98022$var$needs_patching = typeof window === "object" ? /*@__PURE__*/ $7599647868f98022$var$check_if_querySelectorAll_needs_patching() : false;
1001
+ const $7599647868f98022$var$needs_patching = /*@__PURE__*/ $7599647868f98022$var$check_if_querySelectorAll_needs_patching();
1002
1002
  function $7599647868f98022$export$33f937d741e49339(element, selector) {
1003
1003
  if (!(element instanceof Element) || !$7599647868f98022$var$needs_patching || !selector.includes("#") || !selector.includes("+")) // covers most cases, we don't need patching or don't hit the bug
1004
1004
  return element?.querySelectorAll?.(selector);
@@ -1099,7 +1099,7 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
1099
1099
  #observer_callback_running = false;
1100
1100
  #execute_after_callback_ran = [];
1101
1101
  #attribute_attribution_map_object = {};
1102
- #territory;
1102
+ #territory = document;
1103
1103
  #listeners = [
1104
1104
  "exists",
1105
1105
  "creation",
@@ -1112,7 +1112,7 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
1112
1112
  ifexists: (selector, callback)=>{
1113
1113
  this.#check_observer_args(selector, callback, true);
1114
1114
  if (selector instanceof Node) {
1115
- if (typeof document === "object" && document.documentElement.contains(selector)) // When the selector is a node the selector and the element are the same, dunno how we could reflect that in the typing though
1115
+ if (document.documentElement.contains(selector)) // When the selector is a node the selector and the element are the same, dunno how we could reflect that in the typing though
1116
1116
  this.#call_callbacks([
1117
1117
  callback
1118
1118
  ], (callback_)=>({
@@ -1128,7 +1128,7 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
1128
1128
  return;
1129
1129
  }
1130
1130
  const our_set = this.#attribute_attribution_map_object[selector] ||= new WeakSet();
1131
- const elements = typeof document === "undefined" ? [] : (0, $7599647868f98022$export$33f937d741e49339)(this.#territory || document, selector);
1131
+ const elements = (0, $7599647868f98022$export$33f937d741e49339)(this.#territory, selector);
1132
1132
  for(let i = 0; i < elements.length; i++){
1133
1133
  const element = elements[i];
1134
1134
  our_set.add(element);
@@ -1165,9 +1165,8 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
1165
1165
  }
1166
1166
  };
1167
1167
  #kickstart_observer() {
1168
- if (typeof document === "undefined") return;
1169
1168
  this.#the_mutation_observer = new MutationObserver(this.#observer_callback);
1170
- this.#the_mutation_observer.observe(this.#territory || document, {
1169
+ this.#the_mutation_observer.observe(this.#territory, {
1171
1170
  attributes: true,
1172
1171
  childList: true,
1173
1172
  subtree: true,
@@ -1705,11 +1704,7 @@ class $d10801050840d92b$export$1b28bc5c68cc4d77 extends EventTarget {
1705
1704
  return (0, $3f34dc07544c5857$export$bb0a9c36cf454ea0)(1, 1000);
1706
1705
  }
1707
1706
  #connect() {
1708
- this.current_socket = typeof window === "object" || typeof WebSocket === "function" ? new WebSocket(...this.#ws_constructor_options) : {
1709
- readyState: 0,
1710
- addEventListener: ()=>{},
1711
- send: ()=>{}
1712
- };
1707
+ this.current_socket = new WebSocket(...this.#ws_constructor_options);
1713
1708
  this.#possible_events.forEach((name)=>{
1714
1709
  this.current_socket.addEventListener(name, (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((original_event)=>{
1715
1710
  let fixed_event;
@@ -2057,7 +2052,6 @@ const $0c84f8e99aac5765$export$28cacbd9b4306ffc = /*@__PURE__*/ $0c84f8e99aac576
2057
2052
 
2058
2053
 
2059
2054
  let $e0a87646d12cb987$export$6399bdb2291895e0 = ()=>{
2060
- if (typeof document === "undefined") return "server";
2061
2055
  let id = "";
2062
2056
  let localstorage_error;
2063
2057
  let cookie_error;
@@ -2247,7 +2241,7 @@ async function $44909e19109bf973$export$8f66c4c7fb96eda2(e, product_id) {
2247
2241
  * Currently watched elements by the intersection observer with their respective callback
2248
2242
  * */ const $72ed530554068e4f$var$watched_elements = /*@__PURE__*/ new WeakMap();
2249
2243
  const $72ed530554068e4f$var$unwatch_element = (element)=>{
2250
- $72ed530554068e4f$var$intersection_observer?.unobserve(element);
2244
+ $72ed530554068e4f$var$intersection_observer.unobserve(element);
2251
2245
  $72ed530554068e4f$var$watched_elements.delete(element);
2252
2246
  $72ed530554068e4f$var$current_intersections.delete(element);
2253
2247
  };
@@ -2256,7 +2250,7 @@ const $72ed530554068e4f$export$4c51576248bcdf31 = (element, callback)=>{
2256
2250
  (0, $e6c6e7929ea385ae$export$de56f1198d121036)("Not watching", element, "as it's already being watched");
2257
2251
  return ()=>{};
2258
2252
  }
2259
- $72ed530554068e4f$var$intersection_observer?.observe(element);
2253
+ $72ed530554068e4f$var$intersection_observer.observe(element);
2260
2254
  /** Calls the given callback and makes sure to stop watching the element */ const wrapped_callback = (element)=>{
2261
2255
  callback(element);
2262
2256
  $72ed530554068e4f$var$unwatch_element(element);
@@ -2279,7 +2273,7 @@ const $72ed530554068e4f$var$intersection_observer_callback = (entries)=>{
2279
2273
  const callback = $72ed530554068e4f$var$watched_elements.get(target);
2280
2274
  // Skip the element if it's no longer being watched.
2281
2275
  if (!callback) {
2282
- $72ed530554068e4f$var$intersection_observer?.unobserve(target);
2276
+ $72ed530554068e4f$var$intersection_observer.unobserve(target);
2283
2277
  continue;
2284
2278
  }
2285
2279
  const currently_intersecting = $72ed530554068e4f$var$current_intersections.has(target);
@@ -2312,9 +2306,9 @@ const $72ed530554068e4f$var$intersection_observer_callback = (entries)=>{
2312
2306
  /**
2313
2307
  * Global IntersectionObserver used for all impression tracking.
2314
2308
  * It's faster to use one observer for all elements than to create a new one for each element.
2315
- */ const $72ed530554068e4f$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/ new IntersectionObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($72ed530554068e4f$var$intersection_observer_callback), {
2309
+ */ const $72ed530554068e4f$var$intersection_observer = /*@__PURE__*/ new IntersectionObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($72ed530554068e4f$var$intersection_observer_callback), {
2316
2310
  threshold: /*@__PURE__*/ (0, /*@__PURE__*/$0da0cad4f39e8f32$export$f8ea2e7b15b5d129)(8)
2317
- }) : undefined;
2311
+ });
2318
2312
 
2319
2313
 
2320
2314
 
@@ -2449,7 +2443,6 @@ const $69f7524c8bdd85b4$export$a9d39e43ae273d26 = /*@__PURE__*/ (0, /*@__PURE__*
2449
2443
  const $69f7524c8bdd85b4$export$446840cab57eeedb = /*@__PURE__*/ new Set();
2450
2444
  let $69f7524c8bdd85b4$var$old_url;
2451
2445
  const $69f7524c8bdd85b4$var$maybe_navigation = ()=>{
2452
- if (typeof location === "undefined") return;
2453
2446
  const new_url = location.href;
2454
2447
  if ($69f7524c8bdd85b4$var$old_url !== new_url) {
2455
2448
  $69f7524c8bdd85b4$export$a9d39e43ae273d26(new_url);
@@ -2460,7 +2453,7 @@ const $69f7524c8bdd85b4$var$maybe_navigation = ()=>{
2460
2453
  };
2461
2454
  $69f7524c8bdd85b4$export$baccefee4a395d8f($69f7524c8bdd85b4$var$maybe_navigation);
2462
2455
  $69f7524c8bdd85b4$var$maybe_navigation();
2463
- globalThis?.window?.addEventListener("popstate", (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((e)=>{
2456
+ window.addEventListener("popstate", (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((e)=>{
2464
2457
  for (const fn of $69f7524c8bdd85b4$export$446840cab57eeedb)(0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)(fn)(e);
2465
2458
  $69f7524c8bdd85b4$var$maybe_navigation();
2466
2459
  }));
@@ -2472,7 +2465,6 @@ async function $69f7524c8bdd85b4$export$1cd22bab0d2c3b0b(callback) {
2472
2465
  }
2473
2466
  }
2474
2467
  async function $69f7524c8bdd85b4$export$baccefee4a395d8f(after_navigation, replace_replaceState = true) {
2475
- if (typeof History === "undefined") return;
2476
2468
  const { prototype: prototype } = History;
2477
2469
  const instance = history;
2478
2470
  const polyfill_dance = (the_thing)=>{
@@ -4315,7 +4307,6 @@ const $107a74aa4ea5902d$export$34b9dba7ce09269b = (tag, { children: children , .
4315
4307
  // Exhaustive list (I think) for these checks should be ["svg","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","stop","switch","symbol","text","textPath","tspan","use","view"]
4316
4308
  const is_svg = props?.xmlns || tag == "defs" || tag == "filter" || tag == "fecolormatrix" || tag == "g" || tag == "circle" || tag == "circle" || tag == "svg" || tag == "path" || tag == "polygon";
4317
4309
  if (is_svg) var namespace = props?.xmlns || "http://www.w3.org/2000/svg";
4318
- if (typeof document === "undefined") return {};
4319
4310
  const element = is_svg ? document.createElementNS(namespace, tag) : document.createElement(tag);
4320
4311
  for(const key in props){
4321
4312
  const value = props[key];
@@ -4332,7 +4323,6 @@ const $107a74aa4ea5902d$export$34b9dba7ce09269b = (tag, { children: children , .
4332
4323
  };
4333
4324
  const $107a74aa4ea5902d$export$25062201e9e25d76 = $107a74aa4ea5902d$export$34b9dba7ce09269b;
4334
4325
  const $107a74aa4ea5902d$export$ffb0004e005737fa = ({ children: children }, _unknown)=>{
4335
- if (typeof document === "undefined") return {};
4336
4326
  const df = document.createDocumentFragment();
4337
4327
  $107a74aa4ea5902d$var$appendChild(df, children);
4338
4328
  return df;
@@ -4895,7 +4885,7 @@ function $04d2f7d9126af667$var$push_function(fn1, handler) {
4895
4885
 
4896
4886
 
4897
4887
 
4898
- const $f3f05d97149aec76$export$deca40f48c0569f8 = typeof window === "undefined" ? false : /*@__PURE__*/ localStorage.getItem("colorize-logics") === "true";
4888
+ const $f3f05d97149aec76$export$deca40f48c0569f8 = /*@__PURE__*/ localStorage.getItem("colorize-logics") === "true";
4899
4889
  function $f3f05d97149aec76$export$16501883f477737a(elements, display) {
4900
4890
  elements.forEach((elem)=>{
4901
4891
  if (elem.nodeType !== Node.TEXT_NODE) {
@@ -7663,14 +7653,14 @@ function $bd274a272f8400ec$export$4fbbab6c30e664d5(value) {
7663
7653
 
7664
7654
 
7665
7655
  const $6d0c26cd36f5eeff$var$promise_as_string = "Promise";
7656
+ const $6d0c26cd36f5eeff$var$w = window;
7666
7657
  function $6d0c26cd36f5eeff$export$38e89c688f9d553a() {
7667
7658
  try {
7668
- const w = window;
7669
- let da_promise = w[$6d0c26cd36f5eeff$var$promise_as_string];
7659
+ let da_promise = $6d0c26cd36f5eeff$var$w[$6d0c26cd36f5eeff$var$promise_as_string];
7670
7660
  let iframe_promise;
7671
7661
  if ((typeof da_promise.allSettled !== "function" || typeof da_promise?.prototype?.finally !== "function") && !(0, $bd274a272f8400ec$export$4fbbab6c30e664d5)(da_promise) && (iframe_promise = $6d0c26cd36f5eeff$export$e647444ed9403635())) da_promise = iframe_promise;
7672
7662
  if (da_promise) {
7673
- if (Object.getOwnPropertyDescriptor(w, $6d0c26cd36f5eeff$var$promise_as_string)?.configurable !== false) Object.defineProperty(w, $6d0c26cd36f5eeff$var$promise_as_string, {
7663
+ if (Object.getOwnPropertyDescriptor($6d0c26cd36f5eeff$var$w, $6d0c26cd36f5eeff$var$promise_as_string)?.configurable !== false) Object.defineProperty($6d0c26cd36f5eeff$var$w, $6d0c26cd36f5eeff$var$promise_as_string, {
7674
7664
  configurable: false,
7675
7665
  enumerable: true,
7676
7666
  get () {
@@ -7827,6 +7817,7 @@ function $2780129735dc272e$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
7827
7817
  /**
7828
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.
7829
7819
  */ function $24daf6f6e6529b9f$export$12b4c6cbc6b8b4e4(maybe_obj) {
7820
+ if (!maybe_obj) return maybe_obj;
7830
7821
  if (typeof maybe_obj != "object") return maybe_obj;
7831
7822
  if (maybe_obj.constructor !== Object) {
7832
7823
  if (Array.isArray(maybe_obj)) return maybe_obj.map((item)=>$24daf6f6e6529b9f$export$12b4c6cbc6b8b4e4(item));
@@ -8432,7 +8423,7 @@ $80ae37b75f3a6ec8$exports = ".depict-img-cont {\n width: 100%;\n height: 100%;
8432
8423
 
8433
8424
 
8434
8425
  const $ff973b2032639b5f$export$3d13beba9b52c947 = "https://img.depict.ai/ResizeImage" + (process.env.TENANT ? "/" + process.env.TENANT : "");
8435
- const $ff973b2032639b5f$export$a98fc8a2c818d3d8 = /*@__PURE__*/ (()=>typeof navigator === "undefined" ? false : /^((?!chrome|android).)*safari/i.test(navigator.userAgent))(); // https://stackoverflow.com/a/23522755
8426
+ const $ff973b2032639b5f$export$a98fc8a2c818d3d8 = /*@__PURE__*/ (()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent))(); // https://stackoverflow.com/a/23522755
8436
8427
  function $ff973b2032639b5f$export$f39a7d0667e924a(what_to_watch, sizes_communicator = (0, $9a42a570de51ea3d$export$e806c6c1615a59ae)(), resolution_factor = 1) {
8437
8428
  let currently_live = false;
8438
8429
  const ro = new ResizeObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((records)=>{
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.73";
7
+ const $0766c85d387a9765$export$83d89fbfd8236492 = "0.0.75";
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"))();
@@ -728,7 +728,7 @@ class $09ff985c7c424fb3$export$32ccf3a614c84258 {
728
728
  }
729
729
 
730
730
 
731
- const $39ef887981612535$var$needs_patching = typeof window === "object" ? /*@__PURE__*/ $39ef887981612535$var$check_if_querySelectorAll_needs_patching() : false;
731
+ const $39ef887981612535$var$needs_patching = /*@__PURE__*/ $39ef887981612535$var$check_if_querySelectorAll_needs_patching();
732
732
  function $39ef887981612535$export$33f937d741e49339(element, selector) {
733
733
  if (!(element instanceof Element) || !$39ef887981612535$var$needs_patching || !selector.includes("#") || !selector.includes("+")) // covers most cases, we don't need patching or don't hit the bug
734
734
  return element?.querySelectorAll?.(selector);
@@ -829,7 +829,7 @@ class $cdca9fea6eb103e5$export$12e07a2a9f87578a {
829
829
  #observer_callback_running = false;
830
830
  #execute_after_callback_ran = [];
831
831
  #attribute_attribution_map_object = {};
832
- #territory;
832
+ #territory = document;
833
833
  #listeners = [
834
834
  "exists",
835
835
  "creation",
@@ -842,7 +842,7 @@ class $cdca9fea6eb103e5$export$12e07a2a9f87578a {
842
842
  ifexists: (selector, callback)=>{
843
843
  this.#check_observer_args(selector, callback, true);
844
844
  if (selector instanceof Node) {
845
- if (typeof document === "object" && document.documentElement.contains(selector)) // When the selector is a node the selector and the element are the same, dunno how we could reflect that in the typing though
845
+ if (document.documentElement.contains(selector)) // When the selector is a node the selector and the element are the same, dunno how we could reflect that in the typing though
846
846
  this.#call_callbacks([
847
847
  callback
848
848
  ], (callback_)=>({
@@ -858,7 +858,7 @@ class $cdca9fea6eb103e5$export$12e07a2a9f87578a {
858
858
  return;
859
859
  }
860
860
  const our_set = this.#attribute_attribution_map_object[selector] ||= new WeakSet();
861
- const elements = typeof document === "undefined" ? [] : (0, $39ef887981612535$export$33f937d741e49339)(this.#territory || document, selector);
861
+ const elements = (0, $39ef887981612535$export$33f937d741e49339)(this.#territory, selector);
862
862
  for(let i = 0; i < elements.length; i++){
863
863
  const element = elements[i];
864
864
  our_set.add(element);
@@ -895,9 +895,8 @@ class $cdca9fea6eb103e5$export$12e07a2a9f87578a {
895
895
  }
896
896
  };
897
897
  #kickstart_observer() {
898
- if (typeof document === "undefined") return;
899
898
  this.#the_mutation_observer = new MutationObserver(this.#observer_callback);
900
- this.#the_mutation_observer.observe(this.#territory || document, {
899
+ this.#the_mutation_observer.observe(this.#territory, {
901
900
  attributes: true,
902
901
  childList: true,
903
902
  subtree: true,
@@ -1435,11 +1434,7 @@ class $4ce764ddfee055ef$export$1b28bc5c68cc4d77 extends EventTarget {
1435
1434
  return (0, $d89638655e64f324$export$bb0a9c36cf454ea0)(1, 1000);
1436
1435
  }
1437
1436
  #connect() {
1438
- this.current_socket = typeof window === "object" || typeof WebSocket === "function" ? new WebSocket(...this.#ws_constructor_options) : {
1439
- readyState: 0,
1440
- addEventListener: ()=>{},
1441
- send: ()=>{}
1442
- };
1437
+ this.current_socket = new WebSocket(...this.#ws_constructor_options);
1443
1438
  this.#possible_events.forEach((name)=>{
1444
1439
  this.current_socket.addEventListener(name, (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)((original_event)=>{
1445
1440
  let fixed_event;
@@ -1787,7 +1782,6 @@ const $cafa1ff1049985c2$export$28cacbd9b4306ffc = /*@__PURE__*/ $cafa1ff1049985c
1787
1782
 
1788
1783
 
1789
1784
  let $43683b1103edab15$export$6399bdb2291895e0 = ()=>{
1790
- if (typeof document === "undefined") return "server";
1791
1785
  let id = "";
1792
1786
  let localstorage_error;
1793
1787
  let cookie_error;
@@ -1977,7 +1971,7 @@ async function $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, product_id) {
1977
1971
  * Currently watched elements by the intersection observer with their respective callback
1978
1972
  * */ const $f24c14db771b471d$var$watched_elements = /*@__PURE__*/ new WeakMap();
1979
1973
  const $f24c14db771b471d$var$unwatch_element = (element)=>{
1980
- $f24c14db771b471d$var$intersection_observer?.unobserve(element);
1974
+ $f24c14db771b471d$var$intersection_observer.unobserve(element);
1981
1975
  $f24c14db771b471d$var$watched_elements.delete(element);
1982
1976
  $f24c14db771b471d$var$current_intersections.delete(element);
1983
1977
  };
@@ -1986,7 +1980,7 @@ const $f24c14db771b471d$export$4c51576248bcdf31 = (element, callback)=>{
1986
1980
  (0, $649f456f663da9fc$export$de56f1198d121036)("Not watching", element, "as it's already being watched");
1987
1981
  return ()=>{};
1988
1982
  }
1989
- $f24c14db771b471d$var$intersection_observer?.observe(element);
1983
+ $f24c14db771b471d$var$intersection_observer.observe(element);
1990
1984
  /** Calls the given callback and makes sure to stop watching the element */ const wrapped_callback = (element)=>{
1991
1985
  callback(element);
1992
1986
  $f24c14db771b471d$var$unwatch_element(element);
@@ -2009,7 +2003,7 @@ const $f24c14db771b471d$var$intersection_observer_callback = (entries)=>{
2009
2003
  const callback = $f24c14db771b471d$var$watched_elements.get(target);
2010
2004
  // Skip the element if it's no longer being watched.
2011
2005
  if (!callback) {
2012
- $f24c14db771b471d$var$intersection_observer?.unobserve(target);
2006
+ $f24c14db771b471d$var$intersection_observer.unobserve(target);
2013
2007
  continue;
2014
2008
  }
2015
2009
  const currently_intersecting = $f24c14db771b471d$var$current_intersections.has(target);
@@ -2042,9 +2036,9 @@ const $f24c14db771b471d$var$intersection_observer_callback = (entries)=>{
2042
2036
  /**
2043
2037
  * Global IntersectionObserver used for all impression tracking.
2044
2038
  * It's faster to use one observer for all elements than to create a new one for each element.
2045
- */ const $f24c14db771b471d$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/ new IntersectionObserver((0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)($f24c14db771b471d$var$intersection_observer_callback), {
2039
+ */ const $f24c14db771b471d$var$intersection_observer = /*@__PURE__*/ new IntersectionObserver((0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)($f24c14db771b471d$var$intersection_observer_callback), {
2046
2040
  threshold: /*@__PURE__*/ (0, /*@__PURE__*/$9ab9ecb74920f343$export$f8ea2e7b15b5d129)(8)
2047
- }) : undefined;
2041
+ });
2048
2042
 
2049
2043
 
2050
2044
 
@@ -2179,7 +2173,6 @@ const $0d2acf276472ebf7$export$a9d39e43ae273d26 = /*@__PURE__*/ (0, /*@__PURE__*
2179
2173
  const $0d2acf276472ebf7$export$446840cab57eeedb = /*@__PURE__*/ new Set();
2180
2174
  let $0d2acf276472ebf7$var$old_url;
2181
2175
  const $0d2acf276472ebf7$var$maybe_navigation = ()=>{
2182
- if (typeof location === "undefined") return;
2183
2176
  const new_url = location.href;
2184
2177
  if ($0d2acf276472ebf7$var$old_url !== new_url) {
2185
2178
  $0d2acf276472ebf7$export$a9d39e43ae273d26(new_url);
@@ -2190,7 +2183,7 @@ const $0d2acf276472ebf7$var$maybe_navigation = ()=>{
2190
2183
  };
2191
2184
  $0d2acf276472ebf7$export$baccefee4a395d8f($0d2acf276472ebf7$var$maybe_navigation);
2192
2185
  $0d2acf276472ebf7$var$maybe_navigation();
2193
- globalThis?.window?.addEventListener("popstate", (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)((e)=>{
2186
+ window.addEventListener("popstate", (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)((e)=>{
2194
2187
  for (const fn of $0d2acf276472ebf7$export$446840cab57eeedb)(0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)(fn)(e);
2195
2188
  $0d2acf276472ebf7$var$maybe_navigation();
2196
2189
  }));
@@ -2202,7 +2195,6 @@ async function $0d2acf276472ebf7$export$1cd22bab0d2c3b0b(callback) {
2202
2195
  }
2203
2196
  }
2204
2197
  async function $0d2acf276472ebf7$export$baccefee4a395d8f(after_navigation, replace_replaceState = true) {
2205
- if (typeof History === "undefined") return;
2206
2198
  const { prototype: prototype } = History;
2207
2199
  const instance = history;
2208
2200
  const polyfill_dance = (the_thing)=>{
@@ -4045,7 +4037,6 @@ const $63cbb5de51d11596$export$34b9dba7ce09269b = (tag, { children: children , .
4045
4037
  // Exhaustive list (I think) for these checks should be ["svg","animate","animateMotion","animateTransform","circle","clipPath","defs","desc","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","metadata","path","pattern","polygon","polyline","radialGradient","rect","stop","switch","symbol","text","textPath","tspan","use","view"]
4046
4038
  const is_svg = props?.xmlns || tag == "defs" || tag == "filter" || tag == "fecolormatrix" || tag == "g" || tag == "circle" || tag == "circle" || tag == "svg" || tag == "path" || tag == "polygon";
4047
4039
  if (is_svg) var namespace = props?.xmlns || "http://www.w3.org/2000/svg";
4048
- if (typeof document === "undefined") return {};
4049
4040
  const element = is_svg ? document.createElementNS(namespace, tag) : document.createElement(tag);
4050
4041
  for(const key in props){
4051
4042
  const value = props[key];
@@ -4062,7 +4053,6 @@ const $63cbb5de51d11596$export$34b9dba7ce09269b = (tag, { children: children , .
4062
4053
  };
4063
4054
  const $63cbb5de51d11596$export$25062201e9e25d76 = $63cbb5de51d11596$export$34b9dba7ce09269b;
4064
4055
  const $63cbb5de51d11596$export$ffb0004e005737fa = ({ children: children }, _unknown)=>{
4065
- if (typeof document === "undefined") return {};
4066
4056
  const df = document.createDocumentFragment();
4067
4057
  $63cbb5de51d11596$var$appendChild(df, children);
4068
4058
  return df;
@@ -4625,7 +4615,7 @@ function $c1503704e45e6a15$var$push_function(fn1, handler) {
4625
4615
 
4626
4616
 
4627
4617
 
4628
- const $893f9af5dbae6bc8$export$deca40f48c0569f8 = typeof window === "undefined" ? false : /*@__PURE__*/ localStorage.getItem("colorize-logics") === "true";
4618
+ const $893f9af5dbae6bc8$export$deca40f48c0569f8 = /*@__PURE__*/ localStorage.getItem("colorize-logics") === "true";
4629
4619
  function $893f9af5dbae6bc8$export$16501883f477737a(elements, display) {
4630
4620
  elements.forEach((elem)=>{
4631
4621
  if (elem.nodeType !== Node.TEXT_NODE) {
@@ -7393,14 +7383,14 @@ function $67acdcc7df099ae4$export$4fbbab6c30e664d5(value) {
7393
7383
 
7394
7384
 
7395
7385
  const $1dd4146ad893cfb2$var$promise_as_string = "Promise";
7386
+ const $1dd4146ad893cfb2$var$w = window;
7396
7387
  function $1dd4146ad893cfb2$export$38e89c688f9d553a() {
7397
7388
  try {
7398
- const w = window;
7399
- let da_promise = w[$1dd4146ad893cfb2$var$promise_as_string];
7389
+ let da_promise = $1dd4146ad893cfb2$var$w[$1dd4146ad893cfb2$var$promise_as_string];
7400
7390
  let iframe_promise;
7401
7391
  if ((typeof da_promise.allSettled !== "function" || typeof da_promise?.prototype?.finally !== "function") && !(0, $67acdcc7df099ae4$export$4fbbab6c30e664d5)(da_promise) && (iframe_promise = $1dd4146ad893cfb2$export$e647444ed9403635())) da_promise = iframe_promise;
7402
7392
  if (da_promise) {
7403
- if (Object.getOwnPropertyDescriptor(w, $1dd4146ad893cfb2$var$promise_as_string)?.configurable !== false) Object.defineProperty(w, $1dd4146ad893cfb2$var$promise_as_string, {
7393
+ if (Object.getOwnPropertyDescriptor($1dd4146ad893cfb2$var$w, $1dd4146ad893cfb2$var$promise_as_string)?.configurable !== false) Object.defineProperty($1dd4146ad893cfb2$var$w, $1dd4146ad893cfb2$var$promise_as_string, {
7404
7394
  configurable: false,
7405
7395
  enumerable: true,
7406
7396
  get () {
@@ -7557,6 +7547,7 @@ function $bbb9f33eb5feb86a$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
7557
7547
  /**
7558
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.
7559
7549
  */ function $8d4dfadc5e12c7fb$export$12b4c6cbc6b8b4e4(maybe_obj) {
7550
+ if (!maybe_obj) return maybe_obj;
7560
7551
  if (typeof maybe_obj != "object") return maybe_obj;
7561
7552
  if (maybe_obj.constructor !== Object) {
7562
7553
  if (Array.isArray(maybe_obj)) return maybe_obj.map((item)=>$8d4dfadc5e12c7fb$export$12b4c6cbc6b8b4e4(item));
@@ -8162,7 +8153,7 @@ $0643fffeaad31076$exports = ".depict-img-cont {\n width: 100%;\n height: 100%;
8162
8153
 
8163
8154
 
8164
8155
  const $45af9e834781a9bc$export$3d13beba9b52c947 = "https://img.depict.ai/ResizeImage" + (process.env.TENANT ? "/" + process.env.TENANT : "");
8165
- const $45af9e834781a9bc$export$a98fc8a2c818d3d8 = /*@__PURE__*/ (()=>typeof navigator === "undefined" ? false : /^((?!chrome|android).)*safari/i.test(navigator.userAgent))(); // https://stackoverflow.com/a/23522755
8156
+ const $45af9e834781a9bc$export$a98fc8a2c818d3d8 = /*@__PURE__*/ (()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent))(); // https://stackoverflow.com/a/23522755
8166
8157
  function $45af9e834781a9bc$export$f39a7d0667e924a(what_to_watch, sizes_communicator = (0, $607fc90221d440a6$export$e806c6c1615a59ae)(), resolution_factor = 1) {
8167
8158
  let currently_live = false;
8168
8159
  const ro = new ResizeObserver((0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)((records)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/utilishared",
3
- "version": "0.0.73",
3
+ "version": "0.0.75",
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.19",
46
+ "@depict-ai/types": "^0.0.23",
47
47
  "@parcel/resolver-default": "^2.8.0",
48
48
  "@sentry/cli": "latest",
49
49
  "@sentry/types": "^7.13.0",