@depict-ai/utilishared 1.0.6 → 1.0.8
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 +2424 -2424
- package/dist/main.js +143 -143
- package/dist/module.js +143 -143
- package/package.json +2 -2
package/dist/module.js
CHANGED
|
@@ -6,7 +6,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
6
6
|
function $parcel$interopDefault(a) {
|
|
7
7
|
return a && a.__esModule ? a.default : a;
|
|
8
8
|
}
|
|
9
|
-
const $0766c85d387a9765$export$83d89fbfd8236492 = "1.0.
|
|
9
|
+
const $0766c85d387a9765$export$83d89fbfd8236492 = "1.0.8";
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
const $571bce04eb920cd8$export$55fe61489d2c7417 = /*@__PURE__*/ (()=>process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && (globalThis?.document?.currentScript?.dataset?.debug === "true" || globalThis?.localStorage?.getItem?.("debug") === "true"))();
|
|
@@ -50,8 +50,8 @@ function $f564adbc4675ceaf$export$fe609f0216e4ebef(url) {
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
// Source: https://stackoverflow.com/a/30106551
|
|
53
|
-
/**
|
|
54
|
-
* Encoding UTF8 ⇢ base64
|
|
53
|
+
/**
|
|
54
|
+
* Encoding UTF8 ⇢ base64
|
|
55
55
|
*/ function $5ea3131c5e08d52e$export$a1893782a2a6be0d(str) {
|
|
56
56
|
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
|
|
57
57
|
return String.fromCharCode(parseInt(p1, 16));
|
|
@@ -66,13 +66,13 @@ function $5ea3131c5e08d52e$export$a7e53ec3b3fdd030(str) {
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
* 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.
|
|
71
|
-
* 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
|
|
72
|
-
* queue is the queue of values that subscribers gets called with
|
|
73
|
-
* last_processed_value is the last value that the subscribers were called with
|
|
74
|
-
* push_value adds a new value to the queue and triggers the calling of the subscribers if they're done
|
|
75
|
-
* 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
|
|
69
|
+
/**
|
|
70
|
+
* 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.
|
|
71
|
+
* 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
|
|
72
|
+
* queue is the queue of values that subscribers gets called with
|
|
73
|
+
* last_processed_value is the last value that the subscribers were called with
|
|
74
|
+
* push_value adds a new value to the queue and triggers the calling of the subscribers if they're done
|
|
75
|
+
* 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
|
|
76
76
|
*/ class $ec58be30798d6e95$export$e2c811ae0eb35313 {
|
|
77
77
|
subscribers_ = [];
|
|
78
78
|
waiting_for_update_ = 0;
|
|
@@ -148,10 +148,10 @@ function $ec58be30798d6e95$export$3e42f5078e3abfc0(state) {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
/**
|
|
152
|
-
* 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.
|
|
153
|
-
* @param async_iterable The async iterable you want to make exitable
|
|
154
|
-
* @return An array containing a function, the exit function, and a wrapped async iterable
|
|
151
|
+
/**
|
|
152
|
+
* 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.
|
|
153
|
+
* @param async_iterable The async iterable you want to make exitable
|
|
154
|
+
* @return An array containing a function, the exit function, and a wrapped async iterable
|
|
155
155
|
*/ function $b8270fcf290bb3af$export$927664b47117acb0(async_iterable) {
|
|
156
156
|
const promise_result_setting_functions = new Map();
|
|
157
157
|
const exit_function = ()=>{
|
|
@@ -632,11 +632,11 @@ function $b04e44fad5ea42c7$export$f18d5b0af29128b7(msg, severity, input_data = {
|
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
|
|
635
|
-
/**
|
|
636
|
-
* Gives a random number between min and max (potentially including min and max).
|
|
637
|
-
* @param min The minimum number.
|
|
638
|
-
* @param max The maximum number.
|
|
639
|
-
* @returns a random number
|
|
635
|
+
/**
|
|
636
|
+
* Gives a random number between min and max (potentially including min and max).
|
|
637
|
+
* @param min The minimum number.
|
|
638
|
+
* @param max The maximum number.
|
|
639
|
+
* @returns a random number
|
|
640
640
|
*/ function $d89638655e64f324$export$bb0a9c36cf454ea0(min, max) {
|
|
641
641
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
642
642
|
}
|
|
@@ -959,9 +959,9 @@ class $4ce764ddfee055ef$export$1d9c6fddbff3441f extends $4ce764ddfee055ef$export
|
|
|
959
959
|
}
|
|
960
960
|
|
|
961
961
|
|
|
962
|
-
/**
|
|
963
|
-
* Returns a random string
|
|
964
|
-
* @return A random string, containing a-z, 0-9 and occasionally a dot (`.`)
|
|
962
|
+
/**
|
|
963
|
+
* Returns a random string
|
|
964
|
+
* @return A random string, containing a-z, 0-9 and occasionally a dot (`.`)
|
|
965
965
|
*/ function $460df8550f9d084d$export$656831b7e9c341c3() {
|
|
966
966
|
return (Math.random() * 2e17).toString(36);
|
|
967
967
|
}
|
|
@@ -1213,8 +1213,8 @@ function $f809bc98a1cb5f92$export$6f051469dd676a8b(tenant, market, type) {
|
|
|
1213
1213
|
|
|
1214
1214
|
|
|
1215
1215
|
|
|
1216
|
-
/**
|
|
1217
|
-
* @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
|
|
1216
|
+
/**
|
|
1217
|
+
* @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
|
|
1218
1218
|
*/ function $a1c80794e6bf4cc2$export$6e7454c733fa1fb2(fn, ...args) {
|
|
1219
1219
|
return function(...unimportant_args) {
|
|
1220
1220
|
return fn.apply(this, [
|
|
@@ -2007,10 +2007,10 @@ async function $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, product_id) {
|
|
|
2007
2007
|
|
|
2008
2008
|
|
|
2009
2009
|
|
|
2010
|
-
/**
|
|
2011
|
-
* 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
|
|
2012
|
-
* @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
|
|
2013
|
-
* @return Stuff to give to IntersectionObserver
|
|
2010
|
+
/**
|
|
2011
|
+
* 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
|
|
2012
|
+
* @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
|
|
2013
|
+
* @return Stuff to give to IntersectionObserver
|
|
2014
2014
|
*/ function $9ab9ecb74920f343$export$f8ea2e7b15b5d129(numSteps) {
|
|
2015
2015
|
const thresholds = [];
|
|
2016
2016
|
for(let i = 1.0; i <= numSteps; i++){
|
|
@@ -2022,12 +2022,12 @@ async function $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, product_id) {
|
|
|
2022
2022
|
}
|
|
2023
2023
|
|
|
2024
2024
|
|
|
2025
|
-
/**
|
|
2026
|
-
* Elements currently intersecting with the viewport.
|
|
2027
|
-
* If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
|
|
2025
|
+
/**
|
|
2026
|
+
* Elements currently intersecting with the viewport.
|
|
2027
|
+
* If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
|
|
2028
2028
|
*/ const $f24c14db771b471d$var$current_intersections = /*@__PURE__*/ new WeakMap();
|
|
2029
|
-
/**
|
|
2030
|
-
* Currently watched elements by the intersection observer with their respective callback
|
|
2029
|
+
/**
|
|
2030
|
+
* Currently watched elements by the intersection observer with their respective callback
|
|
2031
2031
|
* */ const $f24c14db771b471d$var$watched_elements = /*@__PURE__*/ new WeakMap();
|
|
2032
2032
|
const $f24c14db771b471d$var$unwatch_element = (element)=>{
|
|
2033
2033
|
$f24c14db771b471d$var$intersection_observer?.unobserve(element);
|
|
@@ -2092,9 +2092,9 @@ const $f24c14db771b471d$var$intersection_observer_callback = (entries)=>{
|
|
|
2092
2092
|
}
|
|
2093
2093
|
}
|
|
2094
2094
|
};
|
|
2095
|
-
/**
|
|
2096
|
-
* Global IntersectionObserver used for all impression tracking.
|
|
2097
|
-
* It's faster to use one observer for all elements than to create a new one for each element.
|
|
2095
|
+
/**
|
|
2096
|
+
* Global IntersectionObserver used for all impression tracking.
|
|
2097
|
+
* It's faster to use one observer for all elements than to create a new one for each element.
|
|
2098
2098
|
*/ const $f24c14db771b471d$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/ new IntersectionObserver((0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9)($f24c14db771b471d$var$intersection_observer_callback), {
|
|
2099
2099
|
threshold: /*@__PURE__*/ (0, /*@__PURE__*/$9ab9ecb74920f343$export$f8ea2e7b15b5d129)(8)
|
|
2100
2100
|
}) : undefined;
|
|
@@ -2438,17 +2438,17 @@ const $155540b3b8aca771$export$abec7fd9f0b9cc22 = /*@__PURE__*/ (0, /*@__PURE__*
|
|
|
2438
2438
|
|
|
2439
2439
|
|
|
2440
2440
|
const $5dbacdc6a3feeb15$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
|
|
2441
|
-
/*
|
|
2442
|
-
The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
|
|
2443
|
-
visit their web, finish the consent dialog, then run
|
|
2444
|
-
new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
|
|
2445
|
-
in the console. You should see something like
|
|
2446
|
-
'NECES:1,ANALY:1,PERON:1,MARKE:1'
|
|
2447
|
-
Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
|
|
2448
|
-
as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
|
|
2449
|
-
OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
|
|
2450
|
-
If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
|
|
2451
|
-
then check the cookie value again.
|
|
2441
|
+
/*
|
|
2442
|
+
The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
|
|
2443
|
+
visit their web, finish the consent dialog, then run
|
|
2444
|
+
new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
|
|
2445
|
+
in the console. You should see something like
|
|
2446
|
+
'NECES:1,ANALY:1,PERON:1,MARKE:1'
|
|
2447
|
+
Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
|
|
2448
|
+
as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
|
|
2449
|
+
OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
|
|
2450
|
+
If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
|
|
2451
|
+
then check the cookie value again.
|
|
2452
2452
|
*/ const $5dbacdc6a3feeb15$var$KEY_ORDER = [
|
|
2453
2453
|
"necessary",
|
|
2454
2454
|
"statistics",
|
|
@@ -2809,8 +2809,8 @@ class $26eaaddf434c84f1$export$8d42ce4827f43582 {
|
|
|
2809
2809
|
});
|
|
2810
2810
|
})();
|
|
2811
2811
|
}
|
|
2812
|
-
} /**
|
|
2813
|
-
* This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
|
|
2812
|
+
} /**
|
|
2813
|
+
* This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
|
|
2814
2814
|
*/ // albania
|
|
2815
2815
|
|
|
2816
2816
|
|
|
@@ -3033,11 +3033,11 @@ const $d4ffde0b9fca0369$export$6ebd242c09192cec = /*@__PURE__*/ (0, /*@__PURE__*
|
|
|
3033
3033
|
|
|
3034
3034
|
|
|
3035
3035
|
// not ideal but can help when debugging via sentry
|
|
3036
|
-
/**
|
|
3037
|
-
* A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
|
|
3038
|
-
* @param anything Something to try to serialize - this function is crappy and your mileage may vary
|
|
3039
|
-
* @param depth How deep to go when recursing
|
|
3040
|
-
* @return An object that is somehow closer to text (better serializable by sentry) or text
|
|
3036
|
+
/**
|
|
3037
|
+
* A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
|
|
3038
|
+
* @param anything Something to try to serialize - this function is crappy and your mileage may vary
|
|
3039
|
+
* @param depth How deep to go when recursing
|
|
3040
|
+
* @return An object that is somehow closer to text (better serializable by sentry) or text
|
|
3041
3041
|
*/ function $5c4afc453f904a1f$export$39d526a1194b6499(anything, depth) {
|
|
3042
3042
|
depth ??= 0;
|
|
3043
3043
|
depth++;
|
|
@@ -3523,8 +3523,8 @@ function $ea554f5a28904975$var$find_last_visible(items) {
|
|
|
3523
3523
|
|
|
3524
3524
|
|
|
3525
3525
|
|
|
3526
|
-
/**
|
|
3527
|
-
* @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
|
|
3526
|
+
/**
|
|
3527
|
+
* @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
|
|
3528
3528
|
*/ function $92b7ea2cf75c4aec$export$55621c1ce3cd536b() {
|
|
3529
3529
|
// the idea is to have a new promise available immediately before one resolves, so to say an infinite promise
|
|
3530
3530
|
let internal_resolve; // copy and pasted from iconbeauty
|
|
@@ -3636,12 +3636,12 @@ async function $efda45906c6cbac7$export$9eae832ae57fbf(t, css, extra_html) {
|
|
|
3636
3636
|
|
|
3637
3637
|
// TODO: Move ArrayElement<> to better util place
|
|
3638
3638
|
// All the supported markets of all the Tenants (all possible markets).
|
|
3639
|
-
/**
|
|
3640
|
-
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3639
|
+
/**
|
|
3640
|
+
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3641
3641
|
*/ let $a40013fcba50c9ee$export$3db8c5834c5aa726;
|
|
3642
3642
|
// All the known locales (add more)
|
|
3643
|
-
/**
|
|
3644
|
-
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3643
|
+
/**
|
|
3644
|
+
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3645
3645
|
*/ (function(Market) {
|
|
3646
3646
|
Market["dk"] = "dk";
|
|
3647
3647
|
Market["uk"] = "uk";
|
|
@@ -3754,8 +3754,8 @@ function $a40013fcba50c9ee$export$47340c0b196bc0f8(market) {
|
|
|
3754
3754
|
}
|
|
3755
3755
|
function $a40013fcba50c9ee$export$c5b68ecd5c37aa6c(market) {
|
|
3756
3756
|
return $a40013fcba50c9ee$export$6eea148df5c7117c[market].currency;
|
|
3757
|
-
} /**
|
|
3758
|
-
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3757
|
+
} /**
|
|
3758
|
+
* @deprecated please use TwoLetterMarket / readonly arrays/objects instead
|
|
3759
3759
|
*/
|
|
3760
3760
|
|
|
3761
3761
|
|
|
@@ -4998,8 +4998,8 @@ class $366fff12da348e66$export$1a8782481a9af507 {
|
|
|
4998
4998
|
}
|
|
4999
4999
|
|
|
5000
5000
|
|
|
5001
|
-
var /**
|
|
5002
|
-
* @deprecated Please use RecommendationRenderer instead
|
|
5001
|
+
var /**
|
|
5002
|
+
* @deprecated Please use RecommendationRenderer instead
|
|
5003
5003
|
*/ $51bbc74e39f5e5c6$export$2e2bcd8739ae039 = async (options)=>{
|
|
5004
5004
|
const depict = new (0, $366fff12da348e66$export$1a8782481a9af507)(options.options), done = new Promise((itsdone)=>{
|
|
5005
5005
|
document._depict_modify = true;
|
|
@@ -5275,14 +5275,14 @@ function $f494377581cfb2b4$export$c410ce1205e5118a(_t, itms, d, slider) {
|
|
|
5275
5275
|
|
|
5276
5276
|
|
|
5277
5277
|
|
|
5278
|
-
var /**
|
|
5279
|
-
* @deprecated please use `fetch_retry()` instead
|
|
5280
|
-
*
|
|
5281
|
-
* 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
|
|
5282
|
-
* (Note: this thing really should be rewritten with exponential backoff and a better API)
|
|
5283
|
-
* @param dlog logging function to use
|
|
5284
|
-
* @param error_log an array to which errors will be pushed
|
|
5285
|
-
* @return a windows proof fetch function
|
|
5278
|
+
var /**
|
|
5279
|
+
* @deprecated please use `fetch_retry()` instead
|
|
5280
|
+
*
|
|
5281
|
+
* 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
|
|
5282
|
+
* (Note: this thing really should be rewritten with exponential backoff and a better API)
|
|
5283
|
+
* @param dlog logging function to use
|
|
5284
|
+
* @param error_log an array to which errors will be pushed
|
|
5285
|
+
* @return a windows proof fetch function
|
|
5286
5286
|
*/ $acf11540344875ed$export$2e2bcd8739ae039 = (dlog, error_log)=>{
|
|
5287
5287
|
// https://sentry.io/organizations/depictai-0o/issues/2025371462/?project=5476183&query=is%3Aunresolved
|
|
5288
5288
|
// https://stackoverflow.com/a/52947884
|
|
@@ -5494,10 +5494,10 @@ async function $30e801eaa3dc319e$export$c84671f46d6a1ca({ rows: rows , container
|
|
|
5494
5494
|
}
|
|
5495
5495
|
});
|
|
5496
5496
|
}
|
|
5497
|
-
/** Getting how many recs should be displayed for a certain row (while taking override rules into account)
|
|
5498
|
-
* This returns number of recs for this row and all the previous ones
|
|
5499
|
-
* @param row The "index" of the row (counting from the top). Starts at 1.
|
|
5500
|
-
* @param options Your cols_at_size layout option
|
|
5497
|
+
/** Getting how many recs should be displayed for a certain row (while taking override rules into account)
|
|
5498
|
+
* This returns number of recs for this row and all the previous ones
|
|
5499
|
+
* @param row The "index" of the row (counting from the top). Starts at 1.
|
|
5500
|
+
* @param options Your cols_at_size layout option
|
|
5501
5501
|
*/ function $30e801eaa3dc319e$var$get_total_rec_amount_for_row(row, options) {
|
|
5502
5502
|
const [default_cols, , , , override_obj] = options;
|
|
5503
5503
|
const overrides = override_obj?.overrides || {};
|
|
@@ -5508,8 +5508,8 @@ async function $30e801eaa3dc319e$export$c84671f46d6a1ca({ rows: rows , container
|
|
|
5508
5508
|
}
|
|
5509
5509
|
return total;
|
|
5510
5510
|
}
|
|
5511
|
-
/**
|
|
5512
|
-
* Same as `get_total_rec_amount_for_row` but caps the result to never exceed @param max_recs
|
|
5511
|
+
/**
|
|
5512
|
+
* Same as `get_total_rec_amount_for_row` but caps the result to never exceed @param max_recs
|
|
5513
5513
|
*/ function $30e801eaa3dc319e$var$get_visible_recs_without_partial_rows(rows, max_recs, options) {
|
|
5514
5514
|
let visible_recs;
|
|
5515
5515
|
while((visible_recs = $30e801eaa3dc319e$var$get_total_rec_amount_for_row(rows--, options)) > max_recs);
|
|
@@ -5548,13 +5548,13 @@ function $30e801eaa3dc319e$export$17c3166a7ebd4688(selector_beginning, default_g
|
|
|
5548
5548
|
const overrides = override?.overrides || {};
|
|
5549
5549
|
const sorted = Object.keys(overrides).sort((r1, r2)=>parseInt(r1) - parseInt(r2));
|
|
5550
5550
|
const last_override_row = sorted.at(-1);
|
|
5551
|
-
/** We run this loop up until the last override rule + 1.
|
|
5552
|
-
* The last iteration will create styling rules that apply to every row that comes after it.
|
|
5553
|
-
* Let's say we have one override rule for row 2.
|
|
5554
|
-
* We:
|
|
5555
|
-
* 1. Create styling for row 1
|
|
5556
|
-
* 2. Create styling for row 2
|
|
5557
|
-
* 3. Create styling for row 3 which will apply to the rest of the rows. Every row will be the same from now on.
|
|
5551
|
+
/** We run this loop up until the last override rule + 1.
|
|
5552
|
+
* The last iteration will create styling rules that apply to every row that comes after it.
|
|
5553
|
+
* Let's say we have one override rule for row 2.
|
|
5554
|
+
* We:
|
|
5555
|
+
* 1. Create styling for row 1
|
|
5556
|
+
* 2. Create styling for row 2
|
|
5557
|
+
* 3. Create styling for row 3 which will apply to the rest of the rows. Every row will be the same from now on.
|
|
5558
5558
|
*/ const max_row = last_override_row ? parseInt(last_override_row) + 1 : 1;
|
|
5559
5559
|
for(let row = 1; row <= max_row; row++){
|
|
5560
5560
|
const real_n_cols = overrides[row] || n_cols;
|
|
@@ -6507,12 +6507,12 @@ function $49c4fa2e27e642fa$export$3d04c40e7acc1a32(initial_value) {
|
|
|
6507
6507
|
|
|
6508
6508
|
|
|
6509
6509
|
|
|
6510
|
-
/**
|
|
6511
|
-
* A wrapper around window.matchMedia, basically cross browser compatibly adds an event listener to a media query that triggers when it changes
|
|
6512
|
-
* @param query The media query (without `@media`)
|
|
6513
|
-
* @param catchified_handler The function to execute
|
|
6514
|
-
* @param initial_call If the handler should be called instantly with the current state of the media query
|
|
6515
|
-
* @return An object containing `remove`, a function which removes the event listener again
|
|
6510
|
+
/**
|
|
6511
|
+
* A wrapper around window.matchMedia, basically cross browser compatibly adds an event listener to a media query that triggers when it changes
|
|
6512
|
+
* @param query The media query (without `@media`)
|
|
6513
|
+
* @param catchified_handler The function to execute
|
|
6514
|
+
* @param initial_call If the handler should be called instantly with the current state of the media query
|
|
6515
|
+
* @return An object containing `remove`, a function which removes the event listener again
|
|
6516
6516
|
*/
|
|
6517
6517
|
function $29407d8301dc2f23$export$515c3ea4d599b05a(// inspired by code in houdinisportswear modify script
|
|
6518
6518
|
query, handler, initial_call = true) {
|
|
@@ -6782,9 +6782,9 @@ async function $54793663e06a1437$export$d63b08f4f29ddba5(t, unavailability_type)
|
|
|
6782
6782
|
|
|
6783
6783
|
|
|
6784
6784
|
|
|
6785
|
-
/**
|
|
6786
|
-
* Set but you can listen for values being added or removed
|
|
6787
|
-
* i.e. my_set.addEventListener("add", ({detail}) => console.log(detail, "was added to", my_set));
|
|
6785
|
+
/**
|
|
6786
|
+
* Set but you can listen for values being added or removed
|
|
6787
|
+
* i.e. my_set.addEventListener("add", ({detail}) => console.log(detail, "was added to", my_set));
|
|
6788
6788
|
*/ class $2030306bed68a8c7$export$74108888f38788f3 extends Set {
|
|
6789
6789
|
#et = new EventTarget();
|
|
6790
6790
|
addEventListener(event, callback, options) {
|
|
@@ -6812,12 +6812,12 @@ async function $54793663e06a1437$export$d63b08f4f29ddba5(t, unavailability_type)
|
|
|
6812
6812
|
|
|
6813
6813
|
|
|
6814
6814
|
|
|
6815
|
-
/**
|
|
6816
|
-
* 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.
|
|
6817
|
-
* @param element Element to start out at
|
|
6818
|
-
* @param selector Selector to search for
|
|
6819
|
-
* @param start_right=true In what direction to start: true = right, false = left
|
|
6820
|
-
* @return The found element or undefined
|
|
6815
|
+
/**
|
|
6816
|
+
* 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.
|
|
6817
|
+
* @param element Element to start out at
|
|
6818
|
+
* @param selector Selector to search for
|
|
6819
|
+
* @param start_right=true In what direction to start: true = right, false = left
|
|
6820
|
+
* @return The found element or undefined
|
|
6821
6821
|
*/ function $1ce9aeebfbcb93f9$export$d9fdc6ce2907f95b(element, selector, start_right = true) {
|
|
6822
6822
|
for(; element; element = element.parentNode){
|
|
6823
6823
|
if (element?.matches?.(selector)) return element;
|
|
@@ -6870,10 +6870,10 @@ function $ead1f6ae93c69da9$export$82539d9817116aff(e, url) {
|
|
|
6870
6870
|
}
|
|
6871
6871
|
|
|
6872
6872
|
|
|
6873
|
-
/**
|
|
6874
|
-
* This module contains utillities for working with ecom sites using shoppify.
|
|
6875
|
-
*
|
|
6876
|
-
* Shopify cart API reference: https://shopify.dev/api/ajax/reference/cart
|
|
6873
|
+
/**
|
|
6874
|
+
* This module contains utillities for working with ecom sites using shoppify.
|
|
6875
|
+
*
|
|
6876
|
+
* Shopify cart API reference: https://shopify.dev/api/ajax/reference/cart
|
|
6877
6877
|
*/
|
|
6878
6878
|
|
|
6879
6879
|
async function $b6f5b218b1a73900$export$85be83e1935d93c2(fetch_proxy_handler, // we assume fetch is actually fetch, therefore proxy handler is typed like this
|
|
@@ -7607,8 +7607,8 @@ function $bbb9f33eb5feb86a$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
|
|
|
7607
7607
|
|
|
7608
7608
|
|
|
7609
7609
|
|
|
7610
|
-
/**
|
|
7611
|
-
* 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.
|
|
7610
|
+
/**
|
|
7611
|
+
* 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.
|
|
7612
7612
|
*/ function $8d4dfadc5e12c7fb$export$12b4c6cbc6b8b4e4(maybe_obj) {
|
|
7613
7613
|
if (!maybe_obj) return maybe_obj;
|
|
7614
7614
|
if (typeof maybe_obj != "object") return maybe_obj;
|
|
@@ -7627,18 +7627,18 @@ function $bbb9f33eb5feb86a$export$2a38b176ce969e2c(orig_url_with_trailing_slash)
|
|
|
7627
7627
|
}
|
|
7628
7628
|
|
|
7629
7629
|
|
|
7630
|
-
/**
|
|
7631
|
-
* Tries to figure out the tenant's market (`TwoLetterMarket` for new integrations) through various means.
|
|
7632
|
-
*
|
|
7633
|
-
* 1. Checks if there is a market in one of the url segments (www.tentant.se/foo/se/bar)
|
|
7634
|
-
* 2. Checks if the market is specified in the tenant's domain name (www.tenant-se.com)
|
|
7635
|
-
* 3. Checks the toplevel domain (www.tenant.se/foo/bar)
|
|
7636
|
-
*
|
|
7637
|
-
* @param allowed_markets An array the possible markets for the tenant.
|
|
7638
|
-
* Dont forget to specify the allowed market as const (`["se", "en"] as const`) to get the best typing
|
|
7639
|
-
* @param url Specify this to overide the url to check, defaults to the current url
|
|
7640
|
-
* @param tenant The tenant's name
|
|
7641
|
-
* @returns If a market specified in `allowed_markets`was found that is returned, `undefined` otherwise
|
|
7630
|
+
/**
|
|
7631
|
+
* Tries to figure out the tenant's market (`TwoLetterMarket` for new integrations) through various means.
|
|
7632
|
+
*
|
|
7633
|
+
* 1. Checks if there is a market in one of the url segments (www.tentant.se/foo/se/bar)
|
|
7634
|
+
* 2. Checks if the market is specified in the tenant's domain name (www.tenant-se.com)
|
|
7635
|
+
* 3. Checks the toplevel domain (www.tenant.se/foo/bar)
|
|
7636
|
+
*
|
|
7637
|
+
* @param allowed_markets An array the possible markets for the tenant.
|
|
7638
|
+
* Dont forget to specify the allowed market as const (`["se", "en"] as const`) to get the best typing
|
|
7639
|
+
* @param url Specify this to overide the url to check, defaults to the current url
|
|
7640
|
+
* @param tenant The tenant's name
|
|
7641
|
+
* @returns If a market specified in `allowed_markets`was found that is returned, `undefined` otherwise
|
|
7642
7642
|
*/ function $eda086e0899e75b0$export$a422d714c8cb1a5d(allowed_markets, url, tenant = process.env.TENANT) {
|
|
7643
7643
|
const u_o = url ? new URL(url) : location;
|
|
7644
7644
|
const { hostname: hostname } = u_o;
|
|
@@ -7755,9 +7755,9 @@ function $e72f2f1d48dc3a53$export$3427ec8268623f1(listener) {
|
|
|
7755
7755
|
|
|
7756
7756
|
|
|
7757
7757
|
|
|
7758
|
-
/**
|
|
7759
|
-
* Timeout a promise after `ms` milliseconds.
|
|
7760
|
-
* If the promise is timed out this function will return `undefined` and not throw.
|
|
7758
|
+
/**
|
|
7759
|
+
* Timeout a promise after `ms` milliseconds.
|
|
7760
|
+
* If the promise is timed out this function will return `undefined` and not throw.
|
|
7761
7761
|
*/ function $55698e6e298abcb0$export$cd1adfb8059b5fcd(promise, ms) {
|
|
7762
7762
|
const timeout = new Promise((res)=>setTimeout(res, ms));
|
|
7763
7763
|
return Promise.race([
|
|
@@ -8040,9 +8040,9 @@ const $7693290d077384da$export$ddd70fdae1b350e6 = ()=>(0, $63cbb5de51d11596$expo
|
|
|
8040
8040
|
|
|
8041
8041
|
|
|
8042
8042
|
|
|
8043
|
-
/**
|
|
8044
|
-
* Internal color circle used in ColorPicker
|
|
8045
|
-
* @see {createColorPicker}
|
|
8043
|
+
/**
|
|
8044
|
+
* Internal color circle used in ColorPicker
|
|
8045
|
+
* @see {createColorPicker}
|
|
8046
8046
|
*/ function $6f1582c15e13f2f0$var$ColorCircle({ color: color , onClick: onClick , onHoverUpdate: onHoverUpdate }) {
|
|
8047
8047
|
const button = (0, $63cbb5de51d11596$export$34b9dba7ce09269b)("button", {
|
|
8048
8048
|
class: "color-circle-container",
|
|
@@ -8069,9 +8069,9 @@ function $6f1582c15e13f2f0$export$590326cc34f49e2d({ colors: colors , initialCol
|
|
|
8069
8069
|
ColorPicker () {
|
|
8070
8070
|
/** The currently active ColorCircle */ let activeCircle = null;
|
|
8071
8071
|
/** The currently active color object */ let activeColor = null;
|
|
8072
|
-
/**
|
|
8073
|
-
* Update the currently active color object and HTMLElement
|
|
8074
|
-
* Toggles the active class.
|
|
8072
|
+
/**
|
|
8073
|
+
* Update the currently active color object and HTMLElement
|
|
8074
|
+
* Toggles the active class.
|
|
8075
8075
|
*/ const setActive = (e, color)=>{
|
|
8076
8076
|
if (e !== activeCircle) {
|
|
8077
8077
|
if (activeCircle) activeCircle.classList.remove("active");
|
|
@@ -8084,8 +8084,8 @@ function $6f1582c15e13f2f0$export$590326cc34f49e2d({ colors: colors , initialCol
|
|
|
8084
8084
|
if (!dontSetActiveOnClick) setActive(clicked, color);
|
|
8085
8085
|
onSelect(color);
|
|
8086
8086
|
};
|
|
8087
|
-
/**
|
|
8088
|
-
* Handles the preview logic.
|
|
8087
|
+
/**
|
|
8088
|
+
* Handles the preview logic.
|
|
8089
8089
|
*/ const handleSelectOnHover = (hovered, color, hovering)=>{
|
|
8090
8090
|
// Don't do any selection if the hovered circle is already selected
|
|
8091
8091
|
if (hovered === activeCircle) return;
|
|
@@ -8278,9 +8278,9 @@ function $45af9e834781a9bc$export$a62825542f1bfcf5({ what_to_watch: what_to_watc
|
|
|
8278
8278
|
2048,
|
|
8279
8279
|
4096
|
|
8280
8280
|
] , sizes_communicator: sizes_communicator , resolution_factor: resolution_factor , market_: market_ , sizes_setter_: sizes_setter_ } = {}) {
|
|
8281
|
-
/**
|
|
8282
|
-
* We support what_to_watch being optional, meaning we will take the first image we get.
|
|
8283
|
-
* For that we need to have created the image before being able to create the sizes setter.
|
|
8281
|
+
/**
|
|
8282
|
+
* We support what_to_watch being optional, meaning we will take the first image we get.
|
|
8283
|
+
* For that we need to have created the image before being able to create the sizes setter.
|
|
8284
8284
|
*/ const local_base_url = market_ ? $45af9e834781a9bc$export$3d13beba9b52c947 + "/" + market_ : $45af9e834781a9bc$export$3d13beba9b52c947;
|
|
8285
8285
|
return (image_options)=>{
|
|
8286
8286
|
const raw_src = image_options?.src || image_options?.["data-src"]; // get wanted src
|
|
@@ -8462,9 +8462,9 @@ const $8483d1d9fcee52ec$var$TOUCHCANCEL = "touchcancel";
|
|
|
8462
8462
|
const $8483d1d9fcee52ec$var$MOUSEOVER = "mouseover";
|
|
8463
8463
|
const $8483d1d9fcee52ec$var$MOUSELEAVE = "mouseleave";
|
|
8464
8464
|
const $8483d1d9fcee52ec$var$HOVER_CLASS = "hovering";
|
|
8465
|
-
/** This number represents how many elements are in front of div.images-container
|
|
8466
|
-
* 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
|
|
8467
|
-
* This number is not very dynamic but much more performant than iterating
|
|
8465
|
+
/** This number represents how many elements are in front of div.images-container
|
|
8466
|
+
* 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
|
|
8467
|
+
* This number is not very dynamic but much more performant than iterating
|
|
8468
8468
|
*/ const $8483d1d9fcee52ec$var$HOVER_IMAGE_DEPTH = 7;
|
|
8469
8469
|
const $8483d1d9fcee52ec$var$MAX_COLLISION_DETECTION_RATE = 70; // ms
|
|
8470
8470
|
const $8483d1d9fcee52ec$var$touch_hover_elements = /*@__PURE__*/ new WeakMap();
|
|
@@ -8764,11 +8764,11 @@ function $f5ca01afd4680bdd$export$f2ca6fc699ca1fb4(props = {}) {
|
|
|
8764
8764
|
|
|
8765
8765
|
|
|
8766
8766
|
|
|
8767
|
-
/**
|
|
8768
|
-
* Shallowly converts all keys in an object from snake_case to camelCase.
|
|
8769
|
-
* Does not support symbol keys.
|
|
8770
|
-
*
|
|
8771
|
-
* @param obj the object. It will be cloned and not modified in-place.
|
|
8767
|
+
/**
|
|
8768
|
+
* Shallowly converts all keys in an object from snake_case to camelCase.
|
|
8769
|
+
* Does not support symbol keys.
|
|
8770
|
+
*
|
|
8771
|
+
* @param obj the object. It will be cloned and not modified in-place.
|
|
8772
8772
|
*/ function $4d49697a7a9a77a6$export$9dc8f3a0aa3efc85(obj) {
|
|
8773
8773
|
return Object.fromEntries(Object.entries(obj).map(([key, value])=>[
|
|
8774
8774
|
key.split("_").map((part, index)=>index ? part[0].toUpperCase() + part.slice(1) : part).join(""),
|
|
@@ -8783,9 +8783,9 @@ function $4d49697a7a9a77a6$export$b481488de1caa85(obj) {
|
|
|
8783
8783
|
}
|
|
8784
8784
|
|
|
8785
8785
|
|
|
8786
|
-
/**
|
|
8787
|
-
* Converts RGB to HSL
|
|
8788
|
-
* Source of function: https://www.30secondsofcode.org/js/s/rgb-to-hsl
|
|
8786
|
+
/**
|
|
8787
|
+
* Converts RGB to HSL
|
|
8788
|
+
* Source of function: https://www.30secondsofcode.org/js/s/rgb-to-hsl
|
|
8789
8789
|
*/ function $b828952b0fe1df8f$export$499ef00a6a3417f8(r, g, b) {
|
|
8790
8790
|
r /= 255;
|
|
8791
8791
|
g /= 255;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/utilishared",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
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": "^1.0.
|
|
46
|
+
"@depict-ai/types": "^1.0.8",
|
|
47
47
|
"@parcel/resolver-default": "^2.8.0",
|
|
48
48
|
"@sentry/cli": "latest",
|
|
49
49
|
"@sentry/types": "^7.13.0",
|