@depict-ai/utilishared 1.0.51 → 2.0.1
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/ES10/index.cjs +55 -183
- package/ES10/index.d.ts +9 -25
- package/ES10/index.js +52 -174
- package/latest/index.cjs +54 -183
- package/latest/index.d.ts +9 -25
- package/latest/index.js +51 -174
- package/package.json +4 -4
package/latest/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ var $z0IcO$solidjs = require("solid-js");
|
|
|
2
2
|
require("../multi_import_deduplicator.cjs").register_es_version("utilishared", "latest");
|
|
3
3
|
function $parcel$exportWildcard(dest, source) {
|
|
4
4
|
Object.keys(source).forEach(function (key) {
|
|
5
|
-
if (key === 'default' || key === '__esModule' ||
|
|
5
|
+
if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
|
|
6
6
|
return;
|
|
7
7
|
}
|
|
8
8
|
Object.defineProperty(dest, key, {
|
|
@@ -46,9 +46,9 @@ $parcel$export(module.exports, "simplified_template_tool", () => $52d3be7ce51469
|
|
|
46
46
|
$parcel$export(module.exports, "insert_styling_into_slider", () => $e090b20cef3f0516$export$f1b8b9fd75ddcab1);
|
|
47
47
|
$parcel$export(module.exports, "RR_Slider", () => $7af744346f17bf99$export$cd12721587f4f16d);
|
|
48
48
|
$parcel$export(module.exports, "Depict", () => $0b6a8303b64cced1$export$1a8782481a9af507);
|
|
49
|
-
$parcel$export(module.exports, "get_recs_with_template", () => $
|
|
50
|
-
$parcel$export(module.exports, "default_post_processor", () => $
|
|
51
|
-
$parcel$export(module.exports, "default_pre_processor", () => $
|
|
49
|
+
$parcel$export(module.exports, "get_recs_with_template", () => $66a2a93dfa520bc6$export$30933c637c977eef);
|
|
50
|
+
$parcel$export(module.exports, "default_post_processor", () => $66a2a93dfa520bc6$export$c410ce1205e5118a);
|
|
51
|
+
$parcel$export(module.exports, "default_pre_processor", () => $66a2a93dfa520bc6$export$4f39078bdc72ecd0);
|
|
52
52
|
$parcel$export(module.exports, "wpff", () => $c413c7798924612a$export$2e2bcd8739ae039);
|
|
53
53
|
$parcel$export(module.exports, "ElementObserver", () => $9043c64496e3375f$export$12e07a2a9f87578a);
|
|
54
54
|
$parcel$export(module.exports, "observer", () => $2a1cbc63a04d4a2d$export$b6ae1bc530f4c149);
|
|
@@ -116,10 +116,6 @@ $parcel$export(module.exports, "AIO", () => $fbb09973782881cb$export$29a6094e0bd
|
|
|
116
116
|
$parcel$export(module.exports, "paint_red", () => $fbb09973782881cb$export$6ebd242c09192cec);
|
|
117
117
|
$parcel$export(module.exports, "bind_to_a2c_button", () => $c8263a2185830bf1$export$2c34560c3749dc63);
|
|
118
118
|
$parcel$export(module.exports, "bind_tracking_to_link", () => $c8263a2185830bf1$export$82a685f2da2fb027);
|
|
119
|
-
$parcel$export(module.exports, "set_depict_id_fn", () => $e0a87646d12cb987$export$336e7ad40bae0652);
|
|
120
|
-
$parcel$export(module.exports, "set_user_id_fn", () => $e0a87646d12cb987$export$8a96793bf9f87d90);
|
|
121
|
-
$parcel$export(module.exports, "get_depict_id", () => $e0a87646d12cb987$export$6399bdb2291895e0);
|
|
122
|
-
$parcel$export(module.exports, "get_user_id", () => $e0a87646d12cb987$export$adc61a405a4cabed);
|
|
123
119
|
$parcel$export(module.exports, "depict_click", () => $e0a87646d12cb987$export$15f8a0cd5a8c0ebb);
|
|
124
120
|
$parcel$export(module.exports, "depict_prefilled", () => $e0a87646d12cb987$export$82badda1f9923310);
|
|
125
121
|
$parcel$export(module.exports, "depict_add_to_cart", () => $e0a87646d12cb987$export$9028351cb994757e);
|
|
@@ -161,7 +157,6 @@ $parcel$export(module.exports, "datalayer_interceptor", () => $0c9d834f187cc4ff$
|
|
|
161
157
|
$parcel$export(module.exports, "datalayer_transaction_id_extractor", () => $0c9d834f187cc4ff$export$b11248fa13a8a86c);
|
|
162
158
|
$parcel$export(module.exports, "orderpage_transaction_id_extractor", () => $0c9d834f187cc4ff$export$3ebd86018b39d9d2);
|
|
163
159
|
$parcel$export(module.exports, "url_transaction_id_extractor", () => $0c9d834f187cc4ff$export$ff8673d5dea82bd4);
|
|
164
|
-
$parcel$export(module.exports, "send_product_unavailable_to_depict", () => $8594d423459ba80c$export$d63b08f4f29ddba5);
|
|
165
160
|
$parcel$export(module.exports, "send_page_view_if_needed", () => $72ee205b59322497$export$eee4c4d924348b05);
|
|
166
161
|
$parcel$export(module.exports, "send_page_view_on_navigation", () => $72ee205b59322497$export$f7cb1bd47199ec38);
|
|
167
162
|
$parcel$export(module.exports, "DepictAPIWS", () => $d10801050840d92b$export$1d9c6fddbff3441f);
|
|
@@ -273,10 +268,9 @@ $parcel$export(module.exports, "hsb_to_rgb", () => $d73746ee466f09ca$export$486b
|
|
|
273
268
|
$parcel$export(module.exports, "hex_to_rgb", () => $d73746ee466f09ca$export$ca305c142c6fc3cf);
|
|
274
269
|
$parcel$export(module.exports, "version", () => $815f67c61b4c0a42$export$83d89fbfd8236492);
|
|
275
270
|
$parcel$export(module.exports, "add_to_version_info", () => $e4a18bf12ad092d9$export$2cefb7e61fcbae00);
|
|
276
|
-
$parcel$export(module.exports, "edit_current_page_meta_tags", () => $8838e3e61b748a8b$export$ef73ea4f975745ba);
|
|
277
271
|
$parcel$export(module.exports, "sync_el_content_with_accessor", () => $35303d72263038db$export$c3f56a35e076f139);
|
|
278
272
|
$parcel$export(module.exports, "use_href_accessor", () => $da35c7e27be2a442$export$e35115e6d0715f77);
|
|
279
|
-
const $815f67c61b4c0a42$export$83d89fbfd8236492 = "
|
|
273
|
+
const $815f67c61b4c0a42$export$83d89fbfd8236492 = "2.0.1";
|
|
280
274
|
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" && (globalThis?.document?.currentScript?.dataset?.debug === "true" || globalThis?.localStorage?.getItem?.("debug") === "true"))();
|
|
281
275
|
const $e6c6e7929ea385ae$var$browser_prefix_styling = "color: #fff;";
|
|
282
276
|
let $e6c6e7929ea385ae$var$browser_prefix = "[Depict]";
|
|
@@ -1154,7 +1148,7 @@ function $650b64c1b384c895$export$a6db784f019668ba() {
|
|
|
1154
1148
|
const $4c6861fbcd3a0611$export$362abebb4b313340 = process.env.BASE_URL || "https://api.depict.ai";
|
|
1155
1149
|
const $0c84f8e99aac5765$var$c = (0, $268cbd9e4ade92db$export$b3bbfd758f11cfa9);
|
|
1156
1150
|
const $0c84f8e99aac5765$var$ws_instance = /*@__PURE__*/$0c84f8e99aac5765$var$c(() => new (0, $d10801050840d92b$export$1d9c6fddbff3441f)("wss://ws.depict.ai/ws/create-events"))();
|
|
1157
|
-
const $0c84f8e99aac5765$var$allowed_keys = ["tenant", "market", "type", "
|
|
1151
|
+
const $0c84f8e99aac5765$var$allowed_keys = ["tenant", "market", "type", "session_id", "product_id", "entity_identifiers", "url", "entity_price", "currency", "document_referrer", "document_width", "attribution_id", "recommendation_id", "click_location", "ab_test_group", "variant_ids", "transaction_id", "error_type", "detail", "recommendation_type", "search_result_id", "product_listing_result_id"];
|
|
1158
1152
|
const $0c84f8e99aac5765$export$72036d950e1fae95 = /*@__PURE__*/$0c84f8e99aac5765$var$c(payload => {
|
|
1159
1153
|
if (process.env.DEPICT === "false") return;
|
|
1160
1154
|
return payload.map(body => Object.fromEntries(Object.entries(body).filter(([key, value]) => $0c84f8e99aac5765$var$allowed_keys.includes(key) && value != null)));
|
|
@@ -1225,12 +1219,13 @@ const $0c84f8e99aac5765$export$28cacbd9b4306ffc = /*@__PURE__*/$0c84f8e99aac5765
|
|
|
1225
1219
|
// filter_depict_payload will only return undefined if process.env.DEPICT === "false"
|
|
1226
1220
|
return $0c84f8e99aac5765$export$608478473a3304a0($0c84f8e99aac5765$export$72036d950e1fae95(payload), use_ws);
|
|
1227
1221
|
});
|
|
1228
|
-
let $e0a87646d12cb987$export$
|
|
1222
|
+
let $e0a87646d12cb987$export$61e7e1f11e96692f = () => {
|
|
1229
1223
|
if (typeof document === "undefined") return "server";
|
|
1230
1224
|
let id = "";
|
|
1231
1225
|
let localstorage_error;
|
|
1232
1226
|
let cookie_error;
|
|
1233
1227
|
try {
|
|
1228
|
+
// localStorage._dep_id also accessed directly by depict-purchase-tracking Shopify web pixel
|
|
1234
1229
|
id = localStorage._dep_id ||= $650b64c1b384c895$export$656831b7e9c341c3();
|
|
1235
1230
|
} catch (e) {
|
|
1236
1231
|
$e6c6e7929ea385ae$export$de56f1198d121036("Can't use localStorage", e);
|
|
@@ -1264,16 +1259,10 @@ let $e0a87646d12cb987$export$6399bdb2291895e0 = () => {
|
|
|
1264
1259
|
if (!id) id = $650b64c1b384c895$export$656831b7e9c341c3();
|
|
1265
1260
|
return id;
|
|
1266
1261
|
};
|
|
1267
|
-
let $e0a87646d12cb987$export$adc61a405a4cabed = $e0a87646d12cb987$export$6399bdb2291895e0;
|
|
1268
|
-
let $e0a87646d12cb987$export$61e7e1f11e96692f = () => undefined;
|
|
1269
|
-
const $e0a87646d12cb987$export$336e7ad40bae0652 = /*@__PURE__*/$268cbd9e4ade92db$export$b3bbfd758f11cfa9(newfn => $e0a87646d12cb987$export$6399bdb2291895e0 = newfn);
|
|
1270
|
-
const $e0a87646d12cb987$export$8a96793bf9f87d90 = /*@__PURE__*/$268cbd9e4ade92db$export$b3bbfd758f11cfa9(newfn => $e0a87646d12cb987$export$adc61a405a4cabed = newfn);
|
|
1271
1262
|
const $e0a87646d12cb987$export$93ae15b1ae509334 = /*@__PURE__*/$268cbd9e4ade92db$export$b3bbfd758f11cfa9(newfn => $e0a87646d12cb987$export$61e7e1f11e96692f = newfn);
|
|
1272
1263
|
const $e0a87646d12cb987$export$8c6f26a5b6921b95 = /*@__PURE__*/() => {
|
|
1273
1264
|
return {
|
|
1274
1265
|
session_id: $e0a87646d12cb987$export$61e7e1f11e96692f(),
|
|
1275
|
-
user_id: $e0a87646d12cb987$export$adc61a405a4cabed(),
|
|
1276
|
-
dsid: $e0a87646d12cb987$export$6399bdb2291895e0(),
|
|
1277
1266
|
url: document.location.href,
|
|
1278
1267
|
document_width: window.innerWidth,
|
|
1279
1268
|
document_referrer: document?.referrer
|
|
@@ -2525,14 +2514,12 @@ function $28e42b0009d694b2$export$8827362e5e938d26() {
|
|
|
2525
2514
|
const $28e42b0009d694b2$export$abec7fd9f0b9cc22 = /*@__PURE__*/$268cbd9e4ade92db$export$b3bbfd758f11cfa9(async (anon_id = "anonymous") => {
|
|
2526
2515
|
$e6c6e7929ea385ae$export$de56f1198d121036("Initializing Cookiebot tracking");
|
|
2527
2516
|
if (!$28e42b0009d694b2$var$required_consent_level) return $e6c6e7929ea385ae$export$de56f1198d121036("No consent level set for Depict tracking. Ignoring consent and tracking everything.");
|
|
2528
|
-
const
|
|
2529
|
-
|
|
2530
|
-
$e0a87646d12cb987$export$336e7ad40bae0652(() => $28e42b0009d694b2$var$has_consent ? original_get_depict_id() : anon_id);
|
|
2531
|
-
$e0a87646d12cb987$export$8a96793bf9f87d90(() => $28e42b0009d694b2$var$has_consent ? original_get_user_id() : anon_id);
|
|
2517
|
+
const original_get_session_id = (0, $e0a87646d12cb987$export$61e7e1f11e96692f);
|
|
2518
|
+
$e0a87646d12cb987$export$93ae15b1ae509334(() => $28e42b0009d694b2$var$has_consent ? original_get_session_id() : anon_id);
|
|
2532
2519
|
for await (const consent_obj of $28e42b0009d694b2$export$8827362e5e938d26()) {
|
|
2533
2520
|
// Changing this will change the return value of function given to set_depict_id_fn above
|
|
2534
2521
|
$28e42b0009d694b2$var$has_consent = consent_obj[$28e42b0009d694b2$var$required_consent_level];
|
|
2535
|
-
if (!$28e42b0009d694b2$var$has_consent) $e6c6e7929ea385ae$export$de56f1198d121036(`dsid
|
|
2522
|
+
if (!$28e42b0009d694b2$var$has_consent) $e6c6e7929ea385ae$export$de56f1198d121036(`dsid will be set to, "${anon_id}", until Cookiebot has consent for "${$28e42b0009d694b2$var$required_consent_level}"`);else $e6c6e7929ea385ae$export$de56f1198d121036(`Cookiebot obtained consent for "${$28e42b0009d694b2$var$required_consent_level}", will use true dsid/session_id`);
|
|
2536
2523
|
}
|
|
2537
2524
|
});
|
|
2538
2525
|
const $2026711c6c2d6204$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
|
|
@@ -2591,14 +2578,12 @@ function $2026711c6c2d6204$export$7e4427e80d5fc619() {
|
|
|
2591
2578
|
const $2026711c6c2d6204$export$f0f6c846d96fdbec = /*@__PURE__*/$268cbd9e4ade92db$export$b3bbfd758f11cfa9(async (anon_id = "anonymous") => {
|
|
2592
2579
|
$e6c6e7929ea385ae$export$de56f1198d121036("Initializing OptAnon tracking");
|
|
2593
2580
|
if (!$2026711c6c2d6204$var$required_consent_level) return $e6c6e7929ea385ae$export$de56f1198d121036("No consent level set for Depict tracking. Ignoring consent and tracking everything.");
|
|
2594
|
-
const
|
|
2595
|
-
|
|
2596
|
-
$e0a87646d12cb987$export$336e7ad40bae0652(() => $2026711c6c2d6204$var$has_consent ? original_get_depict_id() : anon_id);
|
|
2597
|
-
$e0a87646d12cb987$export$8a96793bf9f87d90(() => $2026711c6c2d6204$var$has_consent ? original_get_user_id() : anon_id);
|
|
2581
|
+
const original_get_session_id = (0, $e0a87646d12cb987$export$61e7e1f11e96692f);
|
|
2582
|
+
$e0a87646d12cb987$export$93ae15b1ae509334(() => $2026711c6c2d6204$var$has_consent ? original_get_session_id() : anon_id);
|
|
2598
2583
|
for await (const consent_obj of $2026711c6c2d6204$export$7e4427e80d5fc619()) {
|
|
2599
2584
|
// Changing this will change the return value of function given to set_depict_id_fn above
|
|
2600
2585
|
$2026711c6c2d6204$var$has_consent = consent_obj[$2026711c6c2d6204$var$required_consent_level];
|
|
2601
|
-
if (!$2026711c6c2d6204$var$has_consent) $e6c6e7929ea385ae$export$de56f1198d121036(`dsid/
|
|
2586
|
+
if (!$2026711c6c2d6204$var$has_consent) $e6c6e7929ea385ae$export$de56f1198d121036(`dsid/session_id will be set to, "${anon_id}", until Optanon has consent for "${$2026711c6c2d6204$var$required_consent_level}"`);else $e6c6e7929ea385ae$export$de56f1198d121036(`Optanon obtained consent for "${$2026711c6c2d6204$var$required_consent_level}", will use true dsid/session_id`);
|
|
2602
2587
|
}
|
|
2603
2588
|
});
|
|
2604
2589
|
const $d3d8549954e0318e$var$g = typeof globalThis == "object" && globalThis || window;
|
|
@@ -3177,15 +3162,11 @@ async function $94edfb6d9c42a288$export$1bc0df10745d5412(t, options, headers, ge
|
|
|
3177
3162
|
return res?.displays || [];
|
|
3178
3163
|
}
|
|
3179
3164
|
async function $94edfb6d9c42a288$export$d40679eb4cf32f09(t, options, headers, get_url = $94edfb6d9c42a288$var$default_get_fetch_url) {
|
|
3180
|
-
const dsid = $e0a87646d12cb987$export$6399bdb2291895e0();
|
|
3181
3165
|
const session_id = options.session_id || $e0a87646d12cb987$export$61e7e1f11e96692f();
|
|
3182
|
-
const user_id = options.user_id || dsid;
|
|
3183
3166
|
const body = {
|
|
3184
3167
|
tenant: t.tenant,
|
|
3185
3168
|
market: t.market,
|
|
3186
|
-
user_id: user_id,
|
|
3187
3169
|
session_id: session_id,
|
|
3188
|
-
dsid: dsid,
|
|
3189
3170
|
document_referrer: document.referrer,
|
|
3190
3171
|
...options
|
|
3191
3172
|
};
|
|
@@ -3871,7 +3852,7 @@ class $1da560af170fb839$export$3be7054c61590ee3 {
|
|
|
3871
3852
|
for (let i = 0; i < mutations.length; i++) {
|
|
3872
3853
|
const matching_added_els = $bf7f12fe044e41b2$export$5e63aea0cac01fa0(mutations[i].addedNodes, this.selector);
|
|
3873
3854
|
if (matching_added_els.length) {
|
|
3874
|
-
if (this.#verbose) $e6c6e7929ea385ae$export$de56f1198d121036("New elements", matching_added_els, " matching selector", this.selector, "were aded to", container, "lazyloading
|
|
3855
|
+
if (this.#verbose) $e6c6e7929ea385ae$export$de56f1198d121036("New elements", matching_added_els, " matching selector", this.selector, "were aded to", container, "lazyloading\u2026");
|
|
3875
3856
|
this.lazyfinder.elements.push(...matching_added_els);
|
|
3876
3857
|
matching_added_els.forEach(this.#initiate_new_image.bind(this));
|
|
3877
3858
|
}
|
|
@@ -4872,7 +4853,7 @@ class $0b6a8303b64cced1$export$1a8782481a9af507 {
|
|
|
4872
4853
|
let itemTemplate;
|
|
4873
4854
|
if (item.sale_price !== item.original_price) {
|
|
4874
4855
|
itemTemplate = template.replaceAll($0b6a8303b64cced1$var$discountMatcher, "$1").replaceAll($0b6a8303b64cced1$var$noDiscountMatcher, "");
|
|
4875
|
-
item.discount =
|
|
4856
|
+
item.discount = `\u{2013}${Math.round(100 * (1 - item.sale_price / item.original_price))}%`;
|
|
4876
4857
|
} else {
|
|
4877
4858
|
itemTemplate = template.replaceAll($0b6a8303b64cced1$var$discountMatcher, "").replaceAll($0b6a8303b64cced1$var$noDiscountMatcher, "$1");
|
|
4878
4859
|
item.discount = "";
|
|
@@ -4966,8 +4947,8 @@ $52d3be7ce5146924$export$2e2bcd8739ae039 = async options => {
|
|
|
4966
4947
|
};
|
|
4967
4948
|
|
|
4968
4949
|
// @ts-ignore
|
|
4969
|
-
var $
|
|
4970
|
-
$
|
|
4950
|
+
var $1c4a3b6d660e3905$exports = {};
|
|
4951
|
+
$1c4a3b6d660e3905$exports = ".depict .rec_outer.noautospacing {\n width: 6cm;\n max-width: 46vw;\n margin-left: 1%;\n margin-right: 1%;\n}\n\n.depict .rec_outer.noautospacing:nth-child(1) {\n margin-left: 0;\n}\n\n.depict .rec_outer.noautospacing:nth-last-child(1) {\n margin-right: 0;\n}\n\n.depict-slider .slider_snap {\n scroll-snap-type: x mandatory;\n}\n\n.depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n margin-top: -1%;\n margin-bottom: -2%;\n padding-top: 1%;\n padding-bottom: 2%;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n.depict-slider button.right {\n right: 0;\n}\n\n.depict-slider button.left, .depict-slider button.right {\n z-index: 2;\n touch-action: manipulation;\n width: 1cm;\n height: 1cm;\n cursor: pointer;\n background: #fff;\n border: none;\n padding: .5%;\n transition-duration: .2s;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.depict-slider button.left.hidden, .depict-slider button.right.hidden {\n opacity: 0;\n cursor: default;\n}\n\n.depict-slider button.left {\n left: 0;\n transform: translateY(-50%)rotate(180deg);\n}\n\n.depict-slider button.left img, .depict-slider button.right img {\n width: 100%;\n height: 100%;\n}\n\n.depict-slider .rec_outer {\n margin-top: 0 !important;\n}\n\n";
|
|
4971
4952
|
const $e090b20cef3f0516$var$default_image_src = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjYsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5Z29uIHBvaW50cz0iOSwyLjYgOC4zLDMuNCAxMi40LDcuNSAxLjYsNy41IDEuNiw4LjUgMTIuNCw4LjUgOC4zLDEyLjYgOSwxMy40IDE0LjQsOCAiLz4NCjwvc3ZnPg0K";
|
|
4972
4953
|
class $e090b20cef3f0516$export$4d41c6499d53639c extends (0, $a69a5236b5814082$export$68babfc5be0de5da) {
|
|
4973
4954
|
constructor(static_options, override_lazyfier_options) {
|
|
@@ -4998,7 +4979,7 @@ class $e090b20cef3f0516$export$4d41c6499d53639c extends (0, $a69a5236b5814082$ex
|
|
|
4998
4979
|
function $e090b20cef3f0516$export$f1b8b9fd75ddcab1(slider) {
|
|
4999
4980
|
const style_elem = document.createElement("style");
|
|
5000
4981
|
style_elem.type = "text/css";
|
|
5001
|
-
style_elem.append((0, /*@__PURE__*/$parcel$interopDefault($
|
|
4982
|
+
style_elem.append((0, /*@__PURE__*/$parcel$interopDefault($1c4a3b6d660e3905$exports)));
|
|
5002
4983
|
slider.container.appendChild(style_elem);
|
|
5003
4984
|
}
|
|
5004
4985
|
async function $7af744346f17bf99$export$cd12721587f4f16d(t, rendering_options, options_for_us, slider_options, override_lazyfier_options) {
|
|
@@ -5046,7 +5027,7 @@ async function $7af744346f17bf99$export$cd12721587f4f16d(t, rendering_options, o
|
|
|
5046
5027
|
elements: container ? container : [slider.container]
|
|
5047
5028
|
};
|
|
5048
5029
|
}
|
|
5049
|
-
async function $
|
|
5030
|
+
async function $66a2a93dfa520bc6$export$30933c637c977eef({
|
|
5050
5031
|
t: t,
|
|
5051
5032
|
recs: recs,
|
|
5052
5033
|
title: title,
|
|
@@ -5063,7 +5044,8 @@ async function $765ddca135d7ab33$export$30933c637c977eef({
|
|
|
5063
5044
|
template,
|
|
5064
5045
|
// recommendation template
|
|
5065
5046
|
chunk_size_for_load_more = 4,
|
|
5066
|
-
insertion_promise: insertion_promise
|
|
5047
|
+
insertion_promise: insertion_promise,
|
|
5048
|
+
view_more_text: view_more_text
|
|
5067
5049
|
}) {
|
|
5068
5050
|
const {
|
|
5069
5051
|
catchify: catchify,
|
|
@@ -5135,8 +5117,8 @@ async function $765ddca135d7ab33$export$30933c637c977eef({
|
|
|
5135
5117
|
}, items);
|
|
5136
5118
|
}
|
|
5137
5119
|
});
|
|
5138
|
-
if (with_loadmore) catchify($
|
|
5139
|
-
if (infinite_scroll) catchify($
|
|
5120
|
+
if (with_loadmore) catchify($66a2a93dfa520bc6$var$setup_load_more)(t, root, chunk_size_for_load_more, view_more_text);
|
|
5121
|
+
if (infinite_scroll) catchify($66a2a93dfa520bc6$var$setup_infinite_scroll)(t, root);
|
|
5140
5122
|
if (title) {
|
|
5141
5123
|
const [title_element] = $bf7f12fe044e41b2$export$5e63aea0cac01fa0(container, "h1.title, h2.title, h3.title, h4.title, h5.title, h6.title");
|
|
5142
5124
|
if (title_element) {
|
|
@@ -5145,7 +5127,7 @@ async function $765ddca135d7ab33$export$30933c637c977eef({
|
|
|
5145
5127
|
}
|
|
5146
5128
|
if (template_tool?.data?.length) return container;else dlog("Didn't get recs from API", template_tool);
|
|
5147
5129
|
}
|
|
5148
|
-
function $
|
|
5130
|
+
function $66a2a93dfa520bc6$var$setup_infinite_scroll(t, root) {
|
|
5149
5131
|
const {
|
|
5150
5132
|
dlog: dlog,
|
|
5151
5133
|
catchify: catchify
|
|
@@ -5161,14 +5143,14 @@ function $765ddca135d7ab33$var$setup_infinite_scroll(t, root) {
|
|
|
5161
5143
|
records.forEach(record => {
|
|
5162
5144
|
if (record.isIntersecting && record.target == get_last_visible_el()) {
|
|
5163
5145
|
dlog("Loading more recs because of", record);
|
|
5164
|
-
if ($
|
|
5146
|
+
if ($66a2a93dfa520bc6$var$load_more_elements(root)) $66a2a93dfa520bc6$var$setup_infinite_scroll(t, root);
|
|
5165
5147
|
}
|
|
5166
5148
|
});
|
|
5167
5149
|
}));
|
|
5168
5150
|
dlog("starting to intersection observe", last_visible_el, "for infinite scroll");
|
|
5169
5151
|
intersection_observer.observe(last_visible_el);
|
|
5170
5152
|
}
|
|
5171
|
-
function $
|
|
5153
|
+
function $66a2a93dfa520bc6$var$load_more_elements(root, chunk_size = 4) {
|
|
5172
5154
|
const hidden_elements = root.querySelectorAll("a.rec_outer.not_visible");
|
|
5173
5155
|
let i = 0;
|
|
5174
5156
|
for (; i < Math.min(hidden_elements.length, chunk_size); i++) {
|
|
@@ -5179,22 +5161,25 @@ function $765ddca135d7ab33$var$load_more_elements(root, chunk_size = 4) {
|
|
|
5179
5161
|
const has_more = i >= chunk_size && hidden_elements.length > chunk_size;
|
|
5180
5162
|
return has_more;
|
|
5181
5163
|
}
|
|
5182
|
-
function $
|
|
5164
|
+
function $66a2a93dfa520bc6$var$setup_load_more(t, root, chunk_size, view_more_text = "Visa mer") {
|
|
5183
5165
|
const {
|
|
5184
5166
|
catchify: catchify
|
|
5185
5167
|
} = t,
|
|
5186
5168
|
load_more_cont = $bf7f12fe044e41b2$export$d3e2a0560cbf4787(`<div class="load-more-container"></div>`),
|
|
5187
|
-
load_button = load_more_cont.appendChild($
|
|
5169
|
+
load_button = load_more_cont.appendChild($107a74aa4ea5902d$export$34b9dba7ce09269b("button", {
|
|
5170
|
+
class: "load_more",
|
|
5171
|
+
children: view_more_text
|
|
5172
|
+
}));
|
|
5188
5173
|
load_button.addEventListener("click", catchify(load_more_recs_and_hide_button_if_needed));
|
|
5189
5174
|
root.after(load_more_cont);
|
|
5190
5175
|
load_more_recs_and_hide_button_if_needed();
|
|
5191
5176
|
function load_more_recs_and_hide_button_if_needed() {
|
|
5192
|
-
if (!$
|
|
5177
|
+
if (!$66a2a93dfa520bc6$var$load_more_elements(root, chunk_size))
|
|
5193
5178
|
// there aren't any recs left to display
|
|
5194
5179
|
load_button.classList.add("not_visible");
|
|
5195
5180
|
}
|
|
5196
5181
|
}
|
|
5197
|
-
function $
|
|
5182
|
+
function $66a2a93dfa520bc6$export$4f39078bdc72ecd0(_t, d, i, with_loadmore, with_slider, infinite_scroll) {
|
|
5198
5183
|
d.class ||= "";
|
|
5199
5184
|
if (infinite_scroll) d.class = i >= 4 ? "not_visible" : ""; // this will make it hold image loading until .load_image is called on .rec_outer
|
|
5200
5185
|
if (with_loadmore) d.class = "not_visible";
|
|
@@ -5202,7 +5187,7 @@ function $765ddca135d7ab33$export$4f39078bdc72ecd0(_t, d, i, with_loadmore, with
|
|
|
5202
5187
|
if (!d.percentage_off || d.percentage_off < 10) d.percentage_off = "";
|
|
5203
5188
|
return d;
|
|
5204
5189
|
}
|
|
5205
|
-
function $
|
|
5190
|
+
function $66a2a93dfa520bc6$export$c410ce1205e5118a(_t, itms, d, slider) {
|
|
5206
5191
|
for (const item of itms) {
|
|
5207
5192
|
const {
|
|
5208
5193
|
image_url: image_url
|
|
@@ -5611,8 +5596,8 @@ async function $a7315720bf2a1638$export$b0a773486c1c2312(t, recommendation_rende
|
|
|
5611
5596
|
}
|
|
5612
5597
|
|
|
5613
5598
|
// @ts-ignore
|
|
5614
|
-
var $
|
|
5615
|
-
$
|
|
5599
|
+
var $a1e0549e8669396a$exports = {};
|
|
5600
|
+
$a1e0549e8669396a$exports = ".depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n";
|
|
5616
5601
|
let $79804e8d76404ae4$var$slider_styling_was_inserted = false;
|
|
5617
5602
|
async function $79804e8d76404ae4$export$82cfdc85a4d15688(t, recommendation_renderer_options, {
|
|
5618
5603
|
container_elements: container_elements,
|
|
@@ -5635,7 +5620,7 @@ async function $79804e8d76404ae4$export$82cfdc85a4d15688(t, recommendation_rende
|
|
|
5635
5620
|
if (!elements) return rendering_result;
|
|
5636
5621
|
if (!$79804e8d76404ae4$var$slider_styling_was_inserted) {
|
|
5637
5622
|
$79804e8d76404ae4$var$slider_styling_was_inserted = true;
|
|
5638
|
-
$e4bebbfa0f0b1454$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($
|
|
5623
|
+
$e4bebbfa0f0b1454$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($a1e0549e8669396a$exports)));
|
|
5639
5624
|
}
|
|
5640
5625
|
insertion_point.replaceWith(slider.container);
|
|
5641
5626
|
slider.insert_here.append(...elements);
|
|
@@ -6522,7 +6507,7 @@ function $0c9d834f187cc4ff$export$3ebd86018b39d9d2(t, selector, filter) {
|
|
|
6522
6507
|
element: element
|
|
6523
6508
|
} = eoe;
|
|
6524
6509
|
const the_id = element.innerText;
|
|
6525
|
-
$0c9d834f187cc4ff$export$1ac466d53a6636ac(t, the_id, $e0a87646d12cb987$export$
|
|
6510
|
+
$0c9d834f187cc4ff$export$1ac466d53a6636ac(t, the_id, $e0a87646d12cb987$export$61e7e1f11e96692f(), filter);
|
|
6526
6511
|
});
|
|
6527
6512
|
}
|
|
6528
6513
|
function $0c9d834f187cc4ff$export$b11248fa13a8a86c(tenant, id_extractor) {
|
|
@@ -6558,7 +6543,7 @@ function $0c9d834f187cc4ff$export$ff8673d5dea82bd4(tenant, id_extractor) {
|
|
|
6558
6543
|
}
|
|
6559
6544
|
})().catch(e => $268cbd9e4ade92db$export$f18d5b0af29128b7([e, "Extracting and sending transaction IDs from URL failed"], "warning"));
|
|
6560
6545
|
}
|
|
6561
|
-
function $0c9d834f187cc4ff$export$1ac466d53a6636ac(t, input_id,
|
|
6546
|
+
function $0c9d834f187cc4ff$export$1ac466d53a6636ac(t, input_id, session_id = $e0a87646d12cb987$export$61e7e1f11e96692f(), filter) {
|
|
6562
6547
|
const transaction_id = typeof filter == "function" ? filter(input_id) : input_id;
|
|
6563
6548
|
if (!transaction_id) {
|
|
6564
6549
|
$e6c6e7929ea385ae$export$de56f1198d121036("Not sending", transaction_id, "because it didn't pass filter");
|
|
@@ -6571,7 +6556,7 @@ function $0c9d834f187cc4ff$export$1ac466d53a6636ac(t, input_id, dsid = $e0a87646
|
|
|
6571
6556
|
events: [{
|
|
6572
6557
|
event_type: "transaction_mapping",
|
|
6573
6558
|
transaction_id: transaction_id,
|
|
6574
|
-
|
|
6559
|
+
session_id: session_id
|
|
6575
6560
|
}]
|
|
6576
6561
|
};
|
|
6577
6562
|
$0c84f8e99aac5765$export$cc3b6ddf805f6156((0, $4c6861fbcd3a0611$export$362abebb4b313340) + "/v2/track", payload);
|
|
@@ -6615,7 +6600,7 @@ function $5a44db2d2c8361b9$var$make_tracker_send_to_depict(ga_tracker, t, filter
|
|
|
6615
6600
|
originalSendHitTask(model);
|
|
6616
6601
|
// console.log('Sent original hit, now sending to depict');
|
|
6617
6602
|
try {
|
|
6618
|
-
const dsid = $e0a87646d12cb987$export$
|
|
6603
|
+
const dsid = $e0a87646d12cb987$export$61e7e1f11e96692f();
|
|
6619
6604
|
const payload = model.get("hitPayload");
|
|
6620
6605
|
const sp = new URLSearchParams(payload);
|
|
6621
6606
|
const id = sp.get("ti");
|
|
@@ -6628,22 +6613,6 @@ function $5a44db2d2c8361b9$var$make_tracker_send_to_depict(ga_tracker, t, filter
|
|
|
6628
6613
|
}
|
|
6629
6614
|
});
|
|
6630
6615
|
}
|
|
6631
|
-
async function $8594d423459ba80c$export$d63b08f4f29ddba5(t, unavailability_type) {
|
|
6632
|
-
const product_id = await t.get_product_id();
|
|
6633
|
-
$e6c6e7929ea385ae$export$de56f1198d121036(`Notifying Depict that product id: ${product_id} is ${unavailability_type}`);
|
|
6634
|
-
const payload = {
|
|
6635
|
-
"tenant": t.tenant,
|
|
6636
|
-
"market": t.market,
|
|
6637
|
-
"events": [{
|
|
6638
|
-
event_type: "product_unavailable",
|
|
6639
|
-
product_id: product_id,
|
|
6640
|
-
unavailability_type: unavailability_type,
|
|
6641
|
-
user_id: $e0a87646d12cb987$export$adc61a405a4cabed(),
|
|
6642
|
-
dsid: $e0a87646d12cb987$export$6399bdb2291895e0()
|
|
6643
|
-
}]
|
|
6644
|
-
};
|
|
6645
|
-
$0c84f8e99aac5765$export$cc3b6ddf805f6156((0, $4c6861fbcd3a0611$export$362abebb4b313340) + "/v2/track", payload);
|
|
6646
|
-
}
|
|
6647
6616
|
|
|
6648
6617
|
/**
|
|
6649
6618
|
* Set but you can listen for values being added or removed
|
|
@@ -7121,7 +7090,7 @@ function $c693a2d89c78efe6$var$deal_w_removal_of_node_array(node_array, push_dis
|
|
|
7121
7090
|
push_disconnector(disconnect_observer);
|
|
7122
7091
|
}
|
|
7123
7092
|
}
|
|
7124
|
-
const $fac9c96b6bbe43cd$export$3b75288f46cadd96 = () => new Array($3f34dc07544c5857$export$bb0a9c36cf454ea0(3, 8)).fill("
|
|
7093
|
+
const $fac9c96b6bbe43cd$export$3b75288f46cadd96 = () => new Array($3f34dc07544c5857$export$bb0a9c36cf454ea0(3, 8)).fill("\u2B1C").join("");
|
|
7125
7094
|
const $fac9c96b6bbe43cd$var$make_sel = (image_url, attribute) => `[${attribute}=${JSON.stringify(image_url)}]`;
|
|
7126
7095
|
const $fac9c96b6bbe43cd$export$a4eccf92efefa04d = (image_width, image_height, color = "#f6f7f8") => `data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='${image_width}' height='${image_height}' xmlns:v='https://vecta.io/nano'%3e%3cpath d='M0 0h${image_width}.016v${image_height}.01H0' fill='${encodeURIComponent(color)}'/%3e%3c/svg%3e`;
|
|
7127
7096
|
async function $fac9c96b6bbe43cd$export$2dd69958012e3e49({
|
|
@@ -7539,10 +7508,10 @@ function $9ed7c4b0fbf9ccd8$export$cd1adfb8059b5fcd(promise, ms) {
|
|
|
7539
7508
|
}
|
|
7540
7509
|
const $5185cc9bd668b8f9$var$get_voyado_id = () => {
|
|
7541
7510
|
const va = /\b_vaI=([^;]+)/.exec(document.cookie)?.[1];
|
|
7542
|
-
return va || $e0a87646d12cb987$export$
|
|
7511
|
+
return va || $e0a87646d12cb987$export$61e7e1f11e96692f();
|
|
7543
7512
|
};
|
|
7544
7513
|
const $5185cc9bd668b8f9$export$a739d9a07da7f9ce = /*@__PURE__*/$268cbd9e4ade92db$export$b3bbfd758f11cfa9(() => {
|
|
7545
|
-
$e0a87646d12cb987$export$
|
|
7514
|
+
$e0a87646d12cb987$export$93ae15b1ae509334($5185cc9bd668b8f9$var$get_voyado_id);
|
|
7546
7515
|
});
|
|
7547
7516
|
function $dba3e72fb3e5c53d$export$4a3043e508dd72f0({
|
|
7548
7517
|
children: children,
|
|
@@ -7685,8 +7654,8 @@ async function $bd0fccdac6624b01$export$c068ad5361be7646({
|
|
|
7685
7654
|
on_close_(exit_oos_iterator);
|
|
7686
7655
|
}));
|
|
7687
7656
|
}
|
|
7688
|
-
var $
|
|
7689
|
-
$
|
|
7657
|
+
var $dcdbfd7a994587c9$exports = {};
|
|
7658
|
+
$dcdbfd7a994587c9$exports = ".depict-placeholder {\n will-change: mask, -webkit-mask;\n mask-position-x: 125%;\n mask-position-y: center;\n background: #ddd;\n animation: 1.5s linear infinite depict-placeholder;\n display: inline-block;\n position: relative;\n overflow: hidden;\n -webkit-mask: linear-gradient(-60deg, #000 30%, #0005, #000 70%) 125% / 300% 100%;\n -webkit-mask-image: ;\n mask-image: ;\n -webkit-mask-size: ;\n mask-size: ;\n}\n\n@keyframes depict-placeholder {\n 0% {\n mask-position-x: 125%;\n -webkit-mask-position-x: 125%;\n }\n\n 10% {\n mask-position-x: 125%;\n -webkit-mask-position-x: 125%;\n }\n\n 90% {\n mask-position-x: -25%;\n -webkit-mask-position-x: -25%;\n }\n\n 100% {\n mask-position-x: -25%;\n -webkit-mask-position-x: -25%;\n }\n}\n\n";
|
|
7690
7659
|
let $e587cb3b31b82f43$var$inserted = false;
|
|
7691
7660
|
const $e587cb3b31b82f43$export$84712d0562a614b8 = ({
|
|
7692
7661
|
width: width,
|
|
@@ -7697,7 +7666,7 @@ const $e587cb3b31b82f43$export$84712d0562a614b8 = ({
|
|
|
7697
7666
|
}) => {
|
|
7698
7667
|
if (!$e587cb3b31b82f43$var$inserted) {
|
|
7699
7668
|
// Insert styling on first import
|
|
7700
|
-
$e4bebbfa0f0b1454$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($
|
|
7669
|
+
$e4bebbfa0f0b1454$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($dcdbfd7a994587c9$exports)));
|
|
7701
7670
|
$e587cb3b31b82f43$var$inserted = true;
|
|
7702
7671
|
}
|
|
7703
7672
|
return (
|
|
@@ -7919,8 +7888,8 @@ const $b25f388f0fe2f1b3$export$237455ad7e59d4e5 = ({
|
|
|
7919
7888
|
collapse: collapse
|
|
7920
7889
|
};
|
|
7921
7890
|
};
|
|
7922
|
-
var $
|
|
7923
|
-
$
|
|
7891
|
+
var $aa123ed8001baa5e$exports = {};
|
|
7892
|
+
$aa123ed8001baa5e$exports = ".depict-img-cont {\n width: 100%;\n height: 100%;\n position: absolute;\n}\n\n.depict-img-filler {\n width: 100%;\n height: auto;\n display: inline-block;\n}\n\n.depict-img-comp {\n width: auto;\n height: auto;\n max-width: 100%;\n max-height: 100%;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n\n.depict-img-mod {\n width: 100%;\n height: 100%;\n object-fit: contain;\n position: absolute;\n inset: 0;\n}\n\n";
|
|
7924
7893
|
const $ff973b2032639b5f$export$3d13beba9b52c947 = "https://img.depict.ai/ResizeImage" + (process.env.TENANT ? "/" + process.env.TENANT : "");
|
|
7925
7894
|
const $ff973b2032639b5f$export$a98fc8a2c818d3d8 = /*@__PURE__*/(() => typeof navigator === "undefined" ? false : /^((?!chrome|android).)*safari/i.test(navigator.userAgent))(); // https://stackoverflow.com/a/23522755
|
|
7926
7895
|
function $ff973b2032639b5f$export$f39a7d0667e924a(what_to_watch, sizes_communicator = $9a42a570de51ea3d$export$e806c6c1615a59ae(), resolution_factor = 1) {
|
|
@@ -8076,7 +8045,7 @@ const $a312bccd722ac9e4$export$788756b42446dc2d = ({
|
|
|
8076
8045
|
}) => {
|
|
8077
8046
|
if (!$a312bccd722ac9e4$var$inserted) {
|
|
8078
8047
|
// Insert styling on first import
|
|
8079
|
-
$e4bebbfa0f0b1454$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($
|
|
8048
|
+
$e4bebbfa0f0b1454$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($aa123ed8001baa5e$exports)));
|
|
8080
8049
|
$a312bccd722ac9e4$var$inserted = true;
|
|
8081
8050
|
}
|
|
8082
8051
|
const img = process.env.BUILD_TARGET === "modern" || process.env.BUILD_TARGET === "dev" ? $a312bccd722ac9e4$var$Image(options) : $a312bccd722ac9e4$var$CompatibleImage(options);
|
|
@@ -8156,8 +8125,8 @@ function $a312bccd722ac9e4$var$srcset_comp_from_map_or_new(rendering_options, sr
|
|
|
8156
8125
|
}
|
|
8157
8126
|
return sourceset_component;
|
|
8158
8127
|
}
|
|
8159
|
-
var $
|
|
8160
|
-
$
|
|
8128
|
+
var $db57c943efeaebed$exports = {};
|
|
8129
|
+
$db57c943efeaebed$exports = ".depict .images-container {\n position: relative;\n}\n\n.depict .second-image-container {\n width: 100%;\n opacity: 0;\n position: absolute;\n top: 0;\n}\n\n.depict .hovering .main-image-container {\n opacity: 0;\n}\n\n.depict .hovering .second-image-container {\n opacity: 1;\n}\n\n";
|
|
8161
8130
|
|
|
8162
8131
|
// Saving bytez
|
|
8163
8132
|
// Maybe? @Daniel
|
|
@@ -8285,7 +8254,7 @@ const $a656daa2fa8c279a$export$2369f6fc1c911576 = ({
|
|
|
8285
8254
|
...options
|
|
8286
8255
|
}) => {
|
|
8287
8256
|
if (!$a656daa2fa8c279a$var$styling_inserted) {
|
|
8288
|
-
$e4bebbfa0f0b1454$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($
|
|
8257
|
+
$e4bebbfa0f0b1454$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($db57c943efeaebed$exports)));
|
|
8289
8258
|
$a656daa2fa8c279a$var$styling_inserted = true;
|
|
8290
8259
|
}
|
|
8291
8260
|
const main_image = $a312bccd722ac9e4$export$788756b42446dc2d({
|
|
@@ -8386,104 +8355,6 @@ function $d73746ee466f09ca$export$ca305c142c6fc3cf(hex) {
|
|
|
8386
8355
|
if (!(rgb?.length === 3 && rgb.every(x => typeof x === "number" && x >= 0 && x <= 255))) return null;
|
|
8387
8356
|
return rgb;
|
|
8388
8357
|
}
|
|
8389
|
-
const $8838e3e61b748a8b$var$MAX_SYNC_RETRIES = 10;
|
|
8390
|
-
/*
|
|
8391
|
-
# Reference material:
|
|
8392
|
-
|
|
8393
|
-
Google has some mixed communication around editing meta tags with JavaScript, as seen in these quotes:
|
|
8394
|
-
|
|
8395
|
-
https://developers.google.com/search/docs/crawling-indexing/special-tags#other-points-to-note
|
|
8396
|
-
> If you're considering using JavaScript to inject or change meta tags, proceed with caution. We recommend that you avoid using JavaScript to inject or change meta tags whenever possible ...
|
|
8397
|
-
https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics#titles-and-snippets
|
|
8398
|
-
> You can use JavaScript to set or change the meta description as well as the <title> element.
|
|
8399
|
-
|
|
8400
|
-
The only thing we can do is test that it works.
|
|
8401
|
-
|
|
8402
|
-
This page has a really nice table that describes the different meta tags used by Google: https://developers.google.com/search/docs/crawling-indexing/special-tags#meta-tags
|
|
8403
|
-
*/
|
|
8404
|
-
const $8838e3e61b748a8b$var$tags = {
|
|
8405
|
-
title: [{
|
|
8406
|
-
selector: 'meta[name="twitter:title"]',
|
|
8407
|
-
create: () => document.createElement("meta"),
|
|
8408
|
-
configure: (element, value) => {
|
|
8409
|
-
element.name = "twitter:title";
|
|
8410
|
-
element.content = value;
|
|
8411
|
-
},
|
|
8412
|
-
isConfigured: (element, value) => element.content === value && element.name === "twitter:title"
|
|
8413
|
-
}, {
|
|
8414
|
-
selector: 'meta[property="og:title"]',
|
|
8415
|
-
create: () => document.createElement("meta"),
|
|
8416
|
-
configure: (element, value) => {
|
|
8417
|
-
element.setAttribute("property", "og:title");
|
|
8418
|
-
element.content = value;
|
|
8419
|
-
},
|
|
8420
|
-
isConfigured: (element, value) => element.content === value && element.getAttribute("property") === "og:title"
|
|
8421
|
-
}, {
|
|
8422
|
-
selector: "title",
|
|
8423
|
-
create: () => document.createElement("title"),
|
|
8424
|
-
configure: (element, value) => element.textContent = value,
|
|
8425
|
-
isConfigured: (element, value) => element.textContent === value
|
|
8426
|
-
}],
|
|
8427
|
-
description: [{
|
|
8428
|
-
selector: 'meta[name="description"]',
|
|
8429
|
-
create: () => document.createElement("meta"),
|
|
8430
|
-
configure: (element, value) => {
|
|
8431
|
-
element.name = "description";
|
|
8432
|
-
element.content = value;
|
|
8433
|
-
},
|
|
8434
|
-
isConfigured: (element, value) => element.content === value && element.name === "description"
|
|
8435
|
-
}, {
|
|
8436
|
-
selector: 'meta[property="og:description"]',
|
|
8437
|
-
create: () => document.createElement("meta"),
|
|
8438
|
-
configure: (element, value) => {
|
|
8439
|
-
element.setAttribute("property", "og:description");
|
|
8440
|
-
element.content = value;
|
|
8441
|
-
},
|
|
8442
|
-
isConfigured: (element, value) => element.content === value && element.getAttribute("property") === "og:description"
|
|
8443
|
-
}]
|
|
8444
|
-
};
|
|
8445
|
-
let $8838e3e61b748a8b$var$running_writers = 0;
|
|
8446
|
-
function $8838e3e61b748a8b$export$ef73ea4f975745ba(meta_data) {
|
|
8447
|
-
if ($8838e3e61b748a8b$var$running_writers >= 1) return;
|
|
8448
|
-
$8838e3e61b748a8b$var$running_writers++;
|
|
8449
|
-
$z0IcO$solidjs.onCleanup(() => $8838e3e61b748a8b$var$running_writers--);
|
|
8450
|
-
const disconnectors = [];
|
|
8451
|
-
$z0IcO$solidjs.createEffect($268cbd9e4ade92db$export$b3bbfd758f11cfa9(() => {
|
|
8452
|
-
if (!meta_data()) return;
|
|
8453
|
-
$z0IcO$solidjs.onCleanup(() => {
|
|
8454
|
-
disconnectors.forEach(d => d());
|
|
8455
|
-
});
|
|
8456
|
-
for (const [type, content] of Object.entries(meta_data())) for (const opts of $8838e3e61b748a8b$var$tags[type]) {
|
|
8457
|
-
if (!type || !content) return;
|
|
8458
|
-
let retries = 0;
|
|
8459
|
-
/** Ensures that there is at least one occurrence of the element. Multiple are allowed, 0 is not.
|
|
8460
|
-
* Also ensures that each occurrence is configured (has correct content)
|
|
8461
|
-
* It's preferred not to kill any conflicting meta tags because frameworks might go apeshit.
|
|
8462
|
-
* Things seem to work when only changing the meta values though */
|
|
8463
|
-
const sync_elements_to_head = () => {
|
|
8464
|
-
if (retries++ > $8838e3e61b748a8b$var$MAX_SYNC_RETRIES) return $e6c6e7929ea385ae$export$de56f1198d121036("Failed to sync meta tag to head. Hit max retries.", opts.selector, content);
|
|
8465
|
-
const existing_elements = document.head.querySelectorAll(opts.selector);
|
|
8466
|
-
const elements = existing_elements.length ? existing_elements : [opts.create()];
|
|
8467
|
-
elements.forEach(el => {
|
|
8468
|
-
if (!opts.isConfigured(el, content)) opts.configure(el, content);
|
|
8469
|
-
});
|
|
8470
|
-
if (!existing_elements.length) {
|
|
8471
|
-
elements[0].dataset.depictMeta = "1";
|
|
8472
|
-
document.head.appendChild(elements[0]);
|
|
8473
|
-
} else if (existing_elements.length > 1) {
|
|
8474
|
-
// In this case, we should try to remove our own tag if it exists.
|
|
8475
|
-
// This is to avoid duplicate meta tags, which might be bad for SEO
|
|
8476
|
-
// We can't remove the other tags because they might be used by frameworks
|
|
8477
|
-
const depict_elements = Array.from(existing_elements).filter(el => el.dataset.depictMeta);
|
|
8478
|
-
// We only want to remove the Depict elements if there are other elements
|
|
8479
|
-
if (depict_elements.length && depict_elements.length < existing_elements.length) depict_elements.forEach(el => el.remove());
|
|
8480
|
-
}
|
|
8481
|
-
};
|
|
8482
|
-
sync_elements_to_head();
|
|
8483
|
-
disconnectors.push((0, $2a1cbc63a04d4a2d$export$b6ae1bc530f4c149).onremoved(opts.selector, sync_elements_to_head), (0, $2a1cbc63a04d4a2d$export$b6ae1bc530f4c149).onchange(opts.selector, sync_elements_to_head), (0, $2a1cbc63a04d4a2d$export$b6ae1bc530f4c149).onexists(opts.selector, sync_elements_to_head));
|
|
8484
|
-
}
|
|
8485
|
-
}, "Meta tag writing crashed"));
|
|
8486
|
-
}
|
|
8487
8358
|
const $35303d72263038db$var$MAX_SYNC_RETRIES = 15;
|
|
8488
8359
|
function $35303d72263038db$export$c3f56a35e076f139(selector, data, opts) {
|
|
8489
8360
|
const {
|