@depict-ai/utilishared 0.0.65 → 0.0.67
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 +1 -1
- package/dist/main.js +16 -11
- package/dist/module.js +16 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="../jsx.d.ts" />
|
|
2
2
|
import { EUnavailabilityType } from "@depict-ai/types/api/TrackV2Request";
|
|
3
|
-
export const version = "0.0.
|
|
3
|
+
export const version = "0.0.67";
|
|
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]`.
|
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.67";
|
|
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"))();
|
|
@@ -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;
|
|
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 (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 (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
|
|
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 = (0, $7599647868f98022$export$33f937d741e49339)(this.#territory, selector);
|
|
1131
|
+
const elements = typeof document === "undefined" ? [] : (0, $7599647868f98022$export$33f937d741e49339)(this.#territory || document, selector);
|
|
1132
1132
|
for(let i = 0; i < elements.length; i++){
|
|
1133
1133
|
const element = elements[i];
|
|
1134
1134
|
our_set.add(element);
|
|
@@ -1165,8 +1165,9 @@ class $9043c64496e3375f$export$12e07a2a9f87578a {
|
|
|
1165
1165
|
}
|
|
1166
1166
|
};
|
|
1167
1167
|
#kickstart_observer() {
|
|
1168
|
+
if (typeof document === "undefined") return;
|
|
1168
1169
|
this.#the_mutation_observer = new MutationObserver(this.#observer_callback);
|
|
1169
|
-
this.#the_mutation_observer.observe(this.#territory, {
|
|
1170
|
+
this.#the_mutation_observer.observe(this.#territory || document, {
|
|
1170
1171
|
attributes: true,
|
|
1171
1172
|
childList: true,
|
|
1172
1173
|
subtree: true,
|
|
@@ -1704,7 +1705,11 @@ class $d10801050840d92b$export$1b28bc5c68cc4d77 extends EventTarget {
|
|
|
1704
1705
|
return (0, $3f34dc07544c5857$export$bb0a9c36cf454ea0)(1, 1000);
|
|
1705
1706
|
}
|
|
1706
1707
|
#connect() {
|
|
1707
|
-
this.current_socket = new WebSocket(...this.#ws_constructor_options)
|
|
1708
|
+
this.current_socket = typeof window === "object" || typeof WebSocket === "function" ? new WebSocket(...this.#ws_constructor_options) : {
|
|
1709
|
+
readyState: 0,
|
|
1710
|
+
addEventListener: ()=>{},
|
|
1711
|
+
send: ()=>{}
|
|
1712
|
+
};
|
|
1708
1713
|
this.#possible_events.forEach((name)=>{
|
|
1709
1714
|
this.current_socket.addEventListener(name, (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)((original_event)=>{
|
|
1710
1715
|
let fixed_event;
|
|
@@ -2241,7 +2246,7 @@ async function $44909e19109bf973$export$8f66c4c7fb96eda2(e, product_id) {
|
|
|
2241
2246
|
* Currently watched elements by the intersection observer with their respective callback
|
|
2242
2247
|
* */ const $72ed530554068e4f$var$watched_elements = /*@__PURE__*/ new WeakMap();
|
|
2243
2248
|
const $72ed530554068e4f$var$unwatch_element = (element)=>{
|
|
2244
|
-
$72ed530554068e4f$var$intersection_observer
|
|
2249
|
+
$72ed530554068e4f$var$intersection_observer?.unobserve(element);
|
|
2245
2250
|
$72ed530554068e4f$var$watched_elements.delete(element);
|
|
2246
2251
|
$72ed530554068e4f$var$current_intersections.delete(element);
|
|
2247
2252
|
};
|
|
@@ -2250,7 +2255,7 @@ const $72ed530554068e4f$export$4c51576248bcdf31 = (element, callback)=>{
|
|
|
2250
2255
|
(0, $e6c6e7929ea385ae$export$de56f1198d121036)("Not watching", element, "as it's already being watched");
|
|
2251
2256
|
return ()=>{};
|
|
2252
2257
|
}
|
|
2253
|
-
$72ed530554068e4f$var$intersection_observer
|
|
2258
|
+
$72ed530554068e4f$var$intersection_observer?.observe(element);
|
|
2254
2259
|
/** Calls the given callback and makes sure to stop watching the element */ const wrapped_callback = (element)=>{
|
|
2255
2260
|
callback(element);
|
|
2256
2261
|
$72ed530554068e4f$var$unwatch_element(element);
|
|
@@ -2273,7 +2278,7 @@ const $72ed530554068e4f$var$intersection_observer_callback = (entries)=>{
|
|
|
2273
2278
|
const callback = $72ed530554068e4f$var$watched_elements.get(target);
|
|
2274
2279
|
// Skip the element if it's no longer being watched.
|
|
2275
2280
|
if (!callback) {
|
|
2276
|
-
$72ed530554068e4f$var$intersection_observer
|
|
2281
|
+
$72ed530554068e4f$var$intersection_observer?.unobserve(target);
|
|
2277
2282
|
continue;
|
|
2278
2283
|
}
|
|
2279
2284
|
const currently_intersecting = $72ed530554068e4f$var$current_intersections.has(target);
|
|
@@ -2306,9 +2311,9 @@ const $72ed530554068e4f$var$intersection_observer_callback = (entries)=>{
|
|
|
2306
2311
|
/**
|
|
2307
2312
|
* Global IntersectionObserver used for all impression tracking.
|
|
2308
2313
|
* It's faster to use one observer for all elements than to create a new one for each element.
|
|
2309
|
-
*/ const $72ed530554068e4f$var$intersection_observer = /*@__PURE__*/ new IntersectionObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($72ed530554068e4f$var$intersection_observer_callback), {
|
|
2314
|
+
*/ const $72ed530554068e4f$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/ new IntersectionObserver((0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9)($72ed530554068e4f$var$intersection_observer_callback), {
|
|
2310
2315
|
threshold: /*@__PURE__*/ (0, /*@__PURE__*/$0da0cad4f39e8f32$export$f8ea2e7b15b5d129)(8)
|
|
2311
|
-
});
|
|
2316
|
+
}) : undefined;
|
|
2312
2317
|
|
|
2313
2318
|
|
|
2314
2319
|
|
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.
|
|
7
|
+
const $0766c85d387a9765$export$83d89fbfd8236492 = "0.0.67";
|
|
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"))();
|
|
@@ -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;
|
|
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 (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 (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
|
|
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 = (0, $39ef887981612535$export$33f937d741e49339)(this.#territory, selector);
|
|
861
|
+
const elements = typeof document === "undefined" ? [] : (0, $39ef887981612535$export$33f937d741e49339)(this.#territory || document, selector);
|
|
862
862
|
for(let i = 0; i < elements.length; i++){
|
|
863
863
|
const element = elements[i];
|
|
864
864
|
our_set.add(element);
|
|
@@ -895,8 +895,9 @@ class $cdca9fea6eb103e5$export$12e07a2a9f87578a {
|
|
|
895
895
|
}
|
|
896
896
|
};
|
|
897
897
|
#kickstart_observer() {
|
|
898
|
+
if (typeof document === "undefined") return;
|
|
898
899
|
this.#the_mutation_observer = new MutationObserver(this.#observer_callback);
|
|
899
|
-
this.#the_mutation_observer.observe(this.#territory, {
|
|
900
|
+
this.#the_mutation_observer.observe(this.#territory || document, {
|
|
900
901
|
attributes: true,
|
|
901
902
|
childList: true,
|
|
902
903
|
subtree: true,
|
|
@@ -1434,7 +1435,11 @@ class $4ce764ddfee055ef$export$1b28bc5c68cc4d77 extends EventTarget {
|
|
|
1434
1435
|
return (0, $d89638655e64f324$export$bb0a9c36cf454ea0)(1, 1000);
|
|
1435
1436
|
}
|
|
1436
1437
|
#connect() {
|
|
1437
|
-
this.current_socket = new WebSocket(...this.#ws_constructor_options)
|
|
1438
|
+
this.current_socket = typeof window === "object" || typeof WebSocket === "function" ? new WebSocket(...this.#ws_constructor_options) : {
|
|
1439
|
+
readyState: 0,
|
|
1440
|
+
addEventListener: ()=>{},
|
|
1441
|
+
send: ()=>{}
|
|
1442
|
+
};
|
|
1438
1443
|
this.#possible_events.forEach((name)=>{
|
|
1439
1444
|
this.current_socket.addEventListener(name, (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)((original_event)=>{
|
|
1440
1445
|
let fixed_event;
|
|
@@ -1971,7 +1976,7 @@ async function $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, product_id) {
|
|
|
1971
1976
|
* Currently watched elements by the intersection observer with their respective callback
|
|
1972
1977
|
* */ const $f24c14db771b471d$var$watched_elements = /*@__PURE__*/ new WeakMap();
|
|
1973
1978
|
const $f24c14db771b471d$var$unwatch_element = (element)=>{
|
|
1974
|
-
$f24c14db771b471d$var$intersection_observer
|
|
1979
|
+
$f24c14db771b471d$var$intersection_observer?.unobserve(element);
|
|
1975
1980
|
$f24c14db771b471d$var$watched_elements.delete(element);
|
|
1976
1981
|
$f24c14db771b471d$var$current_intersections.delete(element);
|
|
1977
1982
|
};
|
|
@@ -1980,7 +1985,7 @@ const $f24c14db771b471d$export$4c51576248bcdf31 = (element, callback)=>{
|
|
|
1980
1985
|
(0, $649f456f663da9fc$export$de56f1198d121036)("Not watching", element, "as it's already being watched");
|
|
1981
1986
|
return ()=>{};
|
|
1982
1987
|
}
|
|
1983
|
-
$f24c14db771b471d$var$intersection_observer
|
|
1988
|
+
$f24c14db771b471d$var$intersection_observer?.observe(element);
|
|
1984
1989
|
/** Calls the given callback and makes sure to stop watching the element */ const wrapped_callback = (element)=>{
|
|
1985
1990
|
callback(element);
|
|
1986
1991
|
$f24c14db771b471d$var$unwatch_element(element);
|
|
@@ -2003,7 +2008,7 @@ const $f24c14db771b471d$var$intersection_observer_callback = (entries)=>{
|
|
|
2003
2008
|
const callback = $f24c14db771b471d$var$watched_elements.get(target);
|
|
2004
2009
|
// Skip the element if it's no longer being watched.
|
|
2005
2010
|
if (!callback) {
|
|
2006
|
-
$f24c14db771b471d$var$intersection_observer
|
|
2011
|
+
$f24c14db771b471d$var$intersection_observer?.unobserve(target);
|
|
2007
2012
|
continue;
|
|
2008
2013
|
}
|
|
2009
2014
|
const currently_intersecting = $f24c14db771b471d$var$current_intersections.has(target);
|
|
@@ -2036,9 +2041,9 @@ const $f24c14db771b471d$var$intersection_observer_callback = (entries)=>{
|
|
|
2036
2041
|
/**
|
|
2037
2042
|
* Global IntersectionObserver used for all impression tracking.
|
|
2038
2043
|
* It's faster to use one observer for all elements than to create a new one for each element.
|
|
2039
|
-
*/ const $f24c14db771b471d$var$intersection_observer = /*@__PURE__*/ new IntersectionObserver((0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)($f24c14db771b471d$var$intersection_observer_callback), {
|
|
2044
|
+
*/ const $f24c14db771b471d$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/ new IntersectionObserver((0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)($f24c14db771b471d$var$intersection_observer_callback), {
|
|
2040
2045
|
threshold: /*@__PURE__*/ (0, /*@__PURE__*/$9ab9ecb74920f343$export$f8ea2e7b15b5d129)(8)
|
|
2041
|
-
});
|
|
2046
|
+
}) : undefined;
|
|
2042
2047
|
|
|
2043
2048
|
|
|
2044
2049
|
|