@depict-ai/utilishared 2.2.0 → 2.3.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 +774 -3236
- package/ES10/index.d.ts +340 -1116
- package/ES10/index.js +775 -3175
- package/latest/index.cjs +817 -3180
- package/latest/index.d.ts +340 -1116
- package/latest/index.js +818 -3119
- package/package.json +2 -2
- package/server/ES10/index.cjs +775 -3233
- package/server/ES10/index.d.ts +340 -1116
- package/server/ES10/index.js +776 -3172
- package/server/latest/index.cjs +818 -3177
- package/server/latest/index.d.ts +340 -1116
- package/server/latest/index.js +819 -3116
package/server/ES10/index.cjs
CHANGED
|
@@ -4,20 +4,6 @@ var $lMD39$babelruntimehelpersclassPrivateFieldSet = require("@babel/runtime/hel
|
|
|
4
4
|
var $lMD39$babelruntimehelpersclassPrivateFieldGet = require("@babel/runtime/helpers/classPrivateFieldGet");
|
|
5
5
|
var $lMD39$solidjsweb = require("solid-js/web");
|
|
6
6
|
require("../../multi_import_deduplicator.cjs").register_es_version("utilishared", "ES10");
|
|
7
|
-
function $parcel$exportWildcard(dest, source) {
|
|
8
|
-
Object.keys(source).forEach(function (key) {
|
|
9
|
-
if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(dest, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return source[key];
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
return dest;
|
|
20
|
-
}
|
|
21
7
|
function $parcel$export(e, n, v, s) {
|
|
22
8
|
Object.defineProperty(e, n, {
|
|
23
9
|
get: v,
|
|
@@ -40,21 +26,10 @@ $parcel$export(module.exports, "cache_args", () => $ca65e31d7f756206$export$6e74
|
|
|
40
26
|
$parcel$export(module.exports, "check_displays", () => $954922240a743f34$export$8582cf3716962dc2);
|
|
41
27
|
$parcel$export(module.exports, "err", () => $46b94b232dc792af$export$8048b892d651b310);
|
|
42
28
|
$parcel$export(module.exports, "require_event_listener", () => $bada18c179c0c105$export$16d7c76794a38a4);
|
|
43
|
-
$parcel$export(module.exports, "Auto_GWVM", () => $8cdb31ce9b00f5a0$export$41de2959a8dd405d);
|
|
44
|
-
$parcel$export(module.exports, "GWVM_Renderer", () => $b764ad4e777fb225$export$c83d8da642b5104a);
|
|
45
29
|
$parcel$export(module.exports, "infinite_promise_creator", () => $b54a733b523aa99d$export$55621c1ce3cd536b);
|
|
46
30
|
$parcel$export(module.exports, "infinite_promise_no_skip", () => $f3ec1bb29cf43251$export$32ccf3a614c84258);
|
|
47
|
-
$parcel$export(module.exports, "infinite_renderer", () => $a0ab88605730ded3$export$c0a4d29bc45a38c6);
|
|
48
|
-
$parcel$export(module.exports, "deprecated_insert_styling", () => $033efa5601489887$export$9eae832ae57fbf);
|
|
49
31
|
$parcel$export(module.exports, "placeholder", () => $628cae9fd43bb48b$export$c7187bbd1a7a9244);
|
|
50
|
-
$parcel$export(module.exports, "Pro_Slider", () => $61a203c77123a21c$export$cab8bc58c64c2013);
|
|
51
|
-
$parcel$export(module.exports, "simplified_template_tool", () => $ebe64dbcfb106f16$export$2e2bcd8739ae039);
|
|
52
32
|
$parcel$export(module.exports, "insert_styling_into_slider", () => $3f49f9b73bfc2a38$export$f1b8b9fd75ddcab1);
|
|
53
|
-
$parcel$export(module.exports, "RR_Slider", () => $bbf8331c74194de9$export$cd12721587f4f16d);
|
|
54
|
-
$parcel$export(module.exports, "Depict", () => $a782ed55f4206a68$export$1a8782481a9af507);
|
|
55
|
-
$parcel$export(module.exports, "get_recs_with_template", () => $14c1124272475590$export$30933c637c977eef);
|
|
56
|
-
$parcel$export(module.exports, "default_post_processor", () => $14c1124272475590$export$c410ce1205e5118a);
|
|
57
|
-
$parcel$export(module.exports, "default_pre_processor", () => $14c1124272475590$export$4f39078bdc72ecd0);
|
|
58
33
|
$parcel$export(module.exports, "wpff", () => $a68e8b02bee90bb2$export$2e2bcd8739ae039);
|
|
59
34
|
$parcel$export(module.exports, "ElementObserver", () => $523564fcfb9c3bb9$export$12e07a2a9f87578a);
|
|
60
35
|
$parcel$export(module.exports, "observer", () => $03c157d68c9fcbac$export$b6ae1bc530f4c149);
|
|
@@ -79,28 +54,11 @@ $parcel$export(module.exports, "test_array_proxy_support", () => $bc463df3122a41
|
|
|
79
54
|
$parcel$export(module.exports, "Amazing_Slider", () => $08a94efe56c2b35f$export$692b27c28639e5b9);
|
|
80
55
|
$parcel$export(module.exports, "colorize_elements", () => $8884ea38c83d7452$export$16501883f477737a);
|
|
81
56
|
$parcel$export(module.exports, "should_colorizeLogics", () => $8884ea38c83d7452$export$deca40f48c0569f8);
|
|
82
|
-
$parcel$export(module.exports, "default_rr", () => $9eba3ee394000bb7$export$50ce83ace0cdd87e);
|
|
83
|
-
$parcel$export(module.exports, "fetch_recs", () => $d72c9a0d8e9c5a95$export$1bc0df10745d5412);
|
|
84
|
-
$parcel$export(module.exports, "fetch_recs_whole_response", () => $d72c9a0d8e9c5a95$export$d40679eb4cf32f09);
|
|
85
|
-
$parcel$export(module.exports, "clone_deep", () => $8f0d01ff20cfba68$export$c42139a43c877ecd);
|
|
86
|
-
$parcel$export(module.exports, "regex_templating", () => $8f0d01ff20cfba68$export$e0009e7da572f99b);
|
|
87
|
-
$parcel$export(module.exports, "Rec_Renderer", () => $8f0d01ff20cfba68$export$a9fc160c5ed83bd7);
|
|
88
57
|
$parcel$export(module.exports, "n_col_styling_with_dist", () => $0c2e69f971c62390$export$17c3166a7ebd4688);
|
|
89
58
|
$parcel$export(module.exports, "Layout", () => $0c2e69f971c62390$export$c84671f46d6a1ca);
|
|
90
59
|
$parcel$export(module.exports, "layout_get_visible_recs_without_partial_rows", () => $0c2e69f971c62390$export$483bdd1f1186de13);
|
|
91
60
|
$parcel$export(module.exports, "layout_get_total_rec_amount_for_row", () => $0c2e69f971c62390$export$3dc5e2383c924ebf);
|
|
92
61
|
$parcel$export(module.exports, "layout_media_query_header", () => $0c2e69f971c62390$export$717f13d9ba00ca19);
|
|
93
|
-
$parcel$export(module.exports, "RecommendationGrid", () => $79e67f88d50f1879$export$b0a773486c1c2312);
|
|
94
|
-
$parcel$export(module.exports, "RecommendationSlider", () => $87dd73b8c244f3d2$export$82cfdc85a4d15688);
|
|
95
|
-
$parcel$export(module.exports, "default_click_tracking", () => $7fe962cfdca74c2f$export$6830ae1fbe21e589);
|
|
96
|
-
$parcel$export(module.exports, "default_view_tracking", () => $7fe962cfdca74c2f$export$f37c58ab3d3e3b75);
|
|
97
|
-
$parcel$export(module.exports, "ga_click", () => $7fe962cfdca74c2f$export$dd32cb565eae0a1f);
|
|
98
|
-
$parcel$export(module.exports, "gtag_click_post_processor", () => $7fe962cfdca74c2f$export$8d72437623fef90c);
|
|
99
|
-
$parcel$export(module.exports, "gtag_view_post_processor", () => $7fe962cfdca74c2f$export$1bffac19f9f0d6fc);
|
|
100
|
-
$parcel$export(module.exports, "depict_click_tracking_post_processor", () => $7fe962cfdca74c2f$export$e9106d6e723510d2);
|
|
101
|
-
$parcel$export(module.exports, "recs_inserted_tracking", () => $7fe962cfdca74c2f$export$fb9afe9f540ae069);
|
|
102
|
-
$parcel$export(module.exports, "add_to_localstorage", () => $7fe962cfdca74c2f$export$32eb5dd18e963410);
|
|
103
|
-
$parcel$export(module.exports, "depict_page_view", () => $7fe962cfdca74c2f$export$9e1caada6901f552);
|
|
104
62
|
$parcel$export(module.exports, "slider_autoscroll_factory", () => $87effbd9207038ed$export$8cbd8aa1c70f9a13);
|
|
105
63
|
$parcel$export(module.exports, "make_button1", () => $554d31c9eaabf6ae$export$80039a49055269fb);
|
|
106
64
|
$parcel$export(module.exports, "make_button2", () => $e193cbc89f3a1c6f$export$af88b4929c2dc86);
|
|
@@ -114,12 +72,9 @@ $parcel$export(module.exports, "slider_snap_css", () => $d46a5140a5630463$export
|
|
|
114
72
|
$parcel$export(module.exports, "can_use_snapping_and_still_scroll", () => $d46a5140a5630463$export$49b950309ab787ad);
|
|
115
73
|
$parcel$export(module.exports, "slider_snapping_factory", () => $4d2c7d8b06c8c95a$export$dac64fd35a4805a4);
|
|
116
74
|
$parcel$export(module.exports, "Amazing_Lazy_Slider", () => $817cb0cb4b98187e$export$68babfc5be0de5da);
|
|
117
|
-
$parcel$export(module.exports, "slider_wraparound_factory", () => $69c09f3898892de3$export$53306504b987cbf7);
|
|
118
75
|
$parcel$export(module.exports, "sizes_to_surface", () => $e1cfe4c7c02bb32a$export$419f84efad7d9fe);
|
|
119
76
|
$parcel$export(module.exports, "surface_mixer", () => $e1cfe4c7c02bb32a$export$417ef0ab13d8b984);
|
|
120
77
|
$parcel$export(module.exports, "promise_until_next_navigation", () => $e1cfe4c7c02bb32a$export$be95cb0e8cfd099e);
|
|
121
|
-
$parcel$export(module.exports, "AIO", () => $7c971cc277292c10$export$29a6094e0bd8bc5f);
|
|
122
|
-
$parcel$export(module.exports, "paint_red", () => $7c971cc277292c10$export$6ebd242c09192cec);
|
|
123
78
|
$parcel$export(module.exports, "bind_to_a2c_button", () => $1ea91dfed6983398$export$2c34560c3749dc63);
|
|
124
79
|
$parcel$export(module.exports, "bind_tracking_to_link", () => $1ea91dfed6983398$export$82a685f2da2fb027);
|
|
125
80
|
$parcel$export(module.exports, "depict_click", () => $335c248bb07a3509$export$15f8a0cd5a8c0ebb);
|
|
@@ -136,15 +91,6 @@ $parcel$export(module.exports, "send_depict_unfiltered", () => $49880c4ce4bb7db2
|
|
|
136
91
|
$parcel$export(module.exports, "send_websocket", () => $49880c4ce4bb7db2$export$aa26019042811d4f);
|
|
137
92
|
$parcel$export(module.exports, "create_ga_queue", () => $f812c921818adbe0$export$674d8cd8b6868154);
|
|
138
93
|
$parcel$export(module.exports, "make_tracker_send_to_depict", () => $f812c921818adbe0$export$edfedd0557ca5a2d);
|
|
139
|
-
$parcel$export(module.exports, "ga_to_transaction_api", () => $138f1061348967b4$export$1ff14fec60ed5697);
|
|
140
|
-
$parcel$export(module.exports, "send_ga", () => $99b61a0622560fcf$export$f75172d2e289cd02);
|
|
141
|
-
$parcel$export(module.exports, "setup_ga", () => $99b61a0622560fcf$export$ac7296527cb52311);
|
|
142
|
-
$parcel$export(module.exports, "setup_gtag", () => $99b61a0622560fcf$export$d031e55ccd4c52dc);
|
|
143
|
-
$parcel$export(module.exports, "gtag_click", () => $99b61a0622560fcf$export$f522672c9379e339);
|
|
144
|
-
$parcel$export(module.exports, "ga_purchase_click", () => $99b61a0622560fcf$export$bf205937e5e012cb);
|
|
145
|
-
$parcel$export(module.exports, "ga_rec_click", () => $99b61a0622560fcf$export$127751e82111fcf);
|
|
146
|
-
$parcel$export(module.exports, "gtag_view", () => $99b61a0622560fcf$export$7babcd5d4056b2ca);
|
|
147
|
-
$parcel$export(module.exports, "load_gtag", () => $99b61a0622560fcf$export$f3354ec2ce95ebd9);
|
|
148
94
|
$parcel$export(module.exports, "send_impression_event", () => $4b9808e8f3ab50d9$export$4205dc6835bc0d9f);
|
|
149
95
|
$parcel$export(module.exports, "impression_track_element", () => $89969f18db4020d7$export$37125ccc5dd98050);
|
|
150
96
|
$parcel$export(module.exports, "impression_tracking_post_processor", () => $e61e4fdc357cece9$export$d0efd8ed14f5c33);
|
|
@@ -154,15 +100,6 @@ $parcel$export(module.exports, "has_to_be_intersecting_for", () => $4b9808e8f3ab
|
|
|
154
100
|
$parcel$export(module.exports, "add_new_tab_listener", () => $04bba294678834bc$export$58c56fe2313fdbe3);
|
|
155
101
|
$parcel$export(module.exports, "broadcast_product_id", () => $04bba294678834bc$export$836f70a28c317905);
|
|
156
102
|
$parcel$export(module.exports, "contextmenu_callback", () => $04bba294678834bc$export$8f66c4c7fb96eda2);
|
|
157
|
-
$parcel$export(module.exports, "optanon_get_cookie_ipns", () => $e9ab1681652f3fca$export$7e4427e80d5fc619);
|
|
158
|
-
$parcel$export(module.exports, "init_optanon_tracking", () => $e9ab1681652f3fca$export$f0f6c846d96fdbec);
|
|
159
|
-
$parcel$export(module.exports, "optanon_get_consent", () => $e9ab1681652f3fca$export$1dd9ce50e201eff1);
|
|
160
|
-
$parcel$export(module.exports, "optanon_wait_for_consent", () => $e9ab1681652f3fca$export$7a6d436e0782c6ed);
|
|
161
|
-
$parcel$export(module.exports, "send_transaction_id_to_depict", () => $78fd85c1f4513422$export$1ac466d53a6636ac);
|
|
162
|
-
$parcel$export(module.exports, "datalayer_interceptor", () => $78fd85c1f4513422$export$9ed4fbc47d558f94);
|
|
163
|
-
$parcel$export(module.exports, "datalayer_transaction_id_extractor", () => $78fd85c1f4513422$export$b11248fa13a8a86c);
|
|
164
|
-
$parcel$export(module.exports, "orderpage_transaction_id_extractor", () => $78fd85c1f4513422$export$3ebd86018b39d9d2);
|
|
165
|
-
$parcel$export(module.exports, "url_transaction_id_extractor", () => $78fd85c1f4513422$export$ff8673d5dea82bd4);
|
|
166
103
|
$parcel$export(module.exports, "send_page_view_if_needed", () => $c15d2edce69e632a$export$eee4c4d924348b05);
|
|
167
104
|
$parcel$export(module.exports, "send_page_view_on_navigation", () => $c15d2edce69e632a$export$f7cb1bd47199ec38);
|
|
168
105
|
$parcel$export(module.exports, "DepictAPIWS", () => $bd0a305620de4c2a$export$1d9c6fddbff3441f);
|
|
@@ -190,7 +127,6 @@ $parcel$export(module.exports, "intercept", () => $675e948221f082fe$export$ab0f8
|
|
|
190
127
|
$parcel$export(module.exports, "fetch_replacer", () => $fe05042754d72fbc$export$85be83e1935d93c2);
|
|
191
128
|
$parcel$export(module.exports, "FakeResponse", () => $fe05042754d72fbc$export$f8da66bc4f1d059e);
|
|
192
129
|
$parcel$export(module.exports, "fetch_retry", () => $8f0b9bb45dd059c3$export$bcd70d5ed1cf6313);
|
|
193
|
-
$parcel$export(module.exports, "get_optimize_variant", () => $62dc027339ca682b$export$b404e20f3c4a490e);
|
|
194
130
|
$parcel$export(module.exports, "stateless_href_change_ipns", () => $8b0f4f54739f2574$export$20e9533e68ee72e7);
|
|
195
131
|
$parcel$export(module.exports, "href_change_ipns", () => $8b0f4f54739f2574$export$a9d39e43ae273d26);
|
|
196
132
|
$parcel$export(module.exports, "history_replacer", () => $8b0f4f54739f2574$export$baccefee4a395d8f);
|
|
@@ -212,12 +148,8 @@ $parcel$export(module.exports, "insert_styling", () => $e45474c7d6e21cfa$export$
|
|
|
212
148
|
$parcel$export(module.exports, "depict_init", () => $e45474c7d6e21cfa$export$692b606677218a16);
|
|
213
149
|
$parcel$export(module.exports, "depict_init_with_market_logic", () => $e45474c7d6e21cfa$export$328e81c44cddf3c0);
|
|
214
150
|
$parcel$export(module.exports, "normal_get_product_id", () => $e45474c7d6e21cfa$export$a4f97b27a0592e6c);
|
|
215
|
-
$parcel$export(module.exports, "track_a2c", () => $e45474c7d6e21cfa$export$a96c18473f2af463);
|
|
216
151
|
$parcel$export(module.exports, "javascript_media_query", () => $afa8ff8cb08175b9$export$515c3ea4d599b05a);
|
|
217
152
|
$parcel$export(module.exports, "patched_querySelectorAll", () => $c64b3d92c99cdd73$export$33f937d741e49339);
|
|
218
|
-
$parcel$export(module.exports, "placeholder_svg", () => $bb8d2c77db19a4c0$export$a4eccf92efefa04d);
|
|
219
|
-
$parcel$export(module.exports, "make_placeholder_rr", () => $bb8d2c77db19a4c0$export$2dd69958012e3e49);
|
|
220
|
-
$parcel$export(module.exports, "random_text_placeholder", () => $bb8d2c77db19a4c0$export$3b75288f46cadd96);
|
|
221
153
|
$parcel$export(module.exports, "Promise_Any", () => $ca80d3a3f70d4752$export$947a20746936143d);
|
|
222
154
|
$parcel$export(module.exports, "queueMacroTask", () => $dde98b3a25fbc838$export$c50e1901e8ed0615);
|
|
223
155
|
$parcel$export(module.exports, "rand", () => $c0c9a890763623b3$export$bb0a9c36cf454ea0);
|
|
@@ -235,7 +167,6 @@ $parcel$export(module.exports, "serialize_object", () => $a1dd43178e1da976$expor
|
|
|
235
167
|
$parcel$export(module.exports, "sort_obj", () => $904c2495a24615b6$export$12b4c6cbc6b8b4e4);
|
|
236
168
|
$parcel$export(module.exports, "standard_get_market", () => $82e4feda1a863e5a$export$a422d714c8cb1a5d);
|
|
237
169
|
$parcel$export(module.exports, "listenToLocalStorage", () => $84f9aef36e5f9e6e$export$3427ec8268623f1);
|
|
238
|
-
$parcel$export(module.exports, "Tenant", () => $db6c2abf3fef4d7d$export$8d42ce4827f43582);
|
|
239
170
|
$parcel$export(module.exports, "timeout_promise", () => $dc92594b01eacde3$export$cd1adfb8059b5fcd);
|
|
240
171
|
$parcel$export(module.exports, "variable_setter_to_ipns", () => $6bf620c74776aef6$export$79f910a98828378d);
|
|
241
172
|
$parcel$export(module.exports, "find_descriptor", () => $6bf620c74776aef6$export$d5062f468a0454f3);
|
|
@@ -276,7 +207,7 @@ $parcel$export(module.exports, "version", () => $ce0ab19b284b64fa$export$83d89fb
|
|
|
276
207
|
$parcel$export(module.exports, "add_to_version_info", () => $045fb30107c9eecc$export$2cefb7e61fcbae00);
|
|
277
208
|
$parcel$export(module.exports, "sync_el_content_with_accessor", () => $84d13ab567309a50$export$c3f56a35e076f139);
|
|
278
209
|
$parcel$export(module.exports, "use_href_accessor", () => $59b7011b96010a8e$export$e35115e6d0715f77);
|
|
279
|
-
const $ce0ab19b284b64fa$export$83d89fbfd8236492 = "2.
|
|
210
|
+
const $ce0ab19b284b64fa$export$83d89fbfd8236492 = "2.3.1";
|
|
280
211
|
const $9e9538f4aff6f83c$export$55fe61489d2c7417 = /*@__PURE__*/((_globalThis$document, _globalThis$document$, _globalThis$document$2, _globalThis$localStor, _globalThis$localStor2) => process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && ((globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : (_globalThis$document$ = _globalThis$document.currentScript) === null || _globalThis$document$ === void 0 ? void 0 : (_globalThis$document$2 = _globalThis$document$.dataset) === null || _globalThis$document$2 === void 0 ? void 0 : _globalThis$document$2.debug) === "true" || (globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$localStor = globalThis.localStorage) === null || _globalThis$localStor === void 0 ? void 0 : (_globalThis$localStor2 = _globalThis$localStor.getItem) === null || _globalThis$localStor2 === void 0 ? void 0 : _globalThis$localStor2.call(_globalThis$localStor, "debug")) === "true"))();
|
|
281
212
|
const $7f95f77417d06249$var$browser_prefix_styling = "color: #fff;";
|
|
282
213
|
let $7f95f77417d06249$var$browser_prefix = "[Depict]";
|
|
@@ -1559,41 +1490,85 @@ function $bada18c179c0c105$export$16d7c76794a38a4(element, event, track_id, func
|
|
|
1559
1490
|
}
|
|
1560
1491
|
}
|
|
1561
1492
|
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
function $
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
return result;
|
|
1493
|
+
/**
|
|
1494
|
+
* @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
|
|
1495
|
+
*/
|
|
1496
|
+
function $b54a733b523aa99d$export$55621c1ce3cd536b() {
|
|
1497
|
+
// the idea is to have a new promise available immediately before one resolves, so to say an infinite promise
|
|
1498
|
+
let internal_resolve; // copy and pasted from iconbeauty
|
|
1499
|
+
const cart_promise_object = {
|
|
1500
|
+
// I feel like Anton is not going to like this extremely awesome approach
|
|
1501
|
+
promise: new Promise(r => internal_resolve = r),
|
|
1502
|
+
// which is why I'm reluctant with making it a library
|
|
1503
|
+
internal_resolve: internal_resolve,
|
|
1504
|
+
// Edit from later on: I have realised that this is actually very useful, it just has a steep learning curve.
|
|
1505
|
+
resolve: argument => {
|
|
1506
|
+
// it allows both not having to call functions in a loop and instead just awaiting the promise from multiple places
|
|
1507
|
+
const oldresolve = cart_promise_object.internal_resolve; // and to effortlessly ensure a process is never running twice with 100% reliability
|
|
1508
|
+
cart_promise_object.promise = new Promise(r => cart_promise_object.internal_resolve = r); // it could be made a class, but I already know this works, so I'll leave it as is
|
|
1509
|
+
oldresolve(argument);
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
return cart_promise_object;
|
|
1583
1513
|
}
|
|
1584
|
-
function $
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1514
|
+
function $628cae9fd43bb48b$export$c7187bbd1a7a9244() {
|
|
1515
|
+
$628cae9fd43bb48b$var$placeholder_worker(...arguments).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
1516
|
+
return arguments.length <= 0 ? undefined : arguments[0];
|
|
1517
|
+
}
|
|
1518
|
+
async function $628cae9fd43bb48b$var$placeholder_worker(placeholder_elements, final_elements, switching_trigger) {
|
|
1519
|
+
let state = false;
|
|
1520
|
+
let has_sanitized_elements = false;
|
|
1521
|
+
const sanit_el_if_needed = async () => {
|
|
1522
|
+
if (!has_sanitized_elements) {
|
|
1523
|
+
has_sanitized_elements = true;
|
|
1524
|
+
placeholder_elements = await $628cae9fd43bb48b$var$convert_to_node_array(placeholder_elements);
|
|
1525
|
+
final_elements = await $628cae9fd43bb48b$var$convert_to_node_array(final_elements);
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
if (switching_trigger instanceof (0, $f3ec1bb29cf43251$export$32ccf3a614c84258)) while (true) {
|
|
1529
|
+
const new_state = await switching_trigger.promise;
|
|
1530
|
+
if (new_state != state) {
|
|
1531
|
+
await sanit_el_if_needed();
|
|
1532
|
+
await $628cae9fd43bb48b$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
|
|
1533
|
+
state = new_state;
|
|
1534
|
+
}
|
|
1535
|
+
} else if (switching_trigger instanceof Promise) {
|
|
1536
|
+
const new_state = await switching_trigger;
|
|
1537
|
+
if (state != new_state) {
|
|
1538
|
+
await sanit_el_if_needed();
|
|
1539
|
+
await $628cae9fd43bb48b$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
|
|
1540
|
+
state = new_state;
|
|
1541
|
+
}
|
|
1542
|
+
} else {
|
|
1543
|
+
await sanit_el_if_needed();
|
|
1544
|
+
placeholder_elements[0].addEventListener("placeholder_switch", $9cefb304a1734a6b$export$535946eb77c946dd(async e => {
|
|
1545
|
+
const new_state = e.detail.state;
|
|
1546
|
+
if (state != new_state) {
|
|
1547
|
+
await sanit_el_if_needed();
|
|
1548
|
+
await $628cae9fd43bb48b$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
|
|
1549
|
+
state = new_state;
|
|
1550
|
+
}
|
|
1551
|
+
}));
|
|
1595
1552
|
}
|
|
1596
1553
|
}
|
|
1554
|
+
async function $628cae9fd43bb48b$var$convert_to_node_array(elements) {
|
|
1555
|
+
if (typeof elements == "function") elements = elements();
|
|
1556
|
+
elements = await elements;
|
|
1557
|
+
if (typeof elements[Symbol.iterator] != "function") elements = [elements];
|
|
1558
|
+
return elements;
|
|
1559
|
+
}
|
|
1560
|
+
async function $628cae9fd43bb48b$var$decide_direction_and_switch(placeholder_elements, final_elements, switch_to_final) {
|
|
1561
|
+
if (switch_to_final) $628cae9fd43bb48b$var$switch_elements(placeholder_elements, final_elements);else $628cae9fd43bb48b$var$switch_elements(final_elements, placeholder_elements);
|
|
1562
|
+
}
|
|
1563
|
+
function $628cae9fd43bb48b$var$switch_elements(from, to) {
|
|
1564
|
+
if (!from.length || !to.length) $7f95f77417d06249$export$c2363754d4758444("Cannot switch elements as from or to is empty", from, to);
|
|
1565
|
+
from[0].replaceWith(...to);
|
|
1566
|
+
for (let i = 1; i < from.length; i++) from[i].remove();
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// @ts-ignore
|
|
1570
|
+
var $22c667835a3196a9$exports = {};
|
|
1571
|
+
$22c667835a3196a9$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";
|
|
1597
1572
|
let $5e0fc3a8b68f26c7$var$has_queued_microtask = false;
|
|
1598
1573
|
const $5e0fc3a8b68f26c7$var$queued_callbacks = /*@__PURE__*/new Map();
|
|
1599
1574
|
const $5e0fc3a8b68f26c7$var$catchified_deduplicate_and_dispatch = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9($5e0fc3a8b68f26c7$var$deduplicate_and_dispatch, "error in observer event processing", "error");
|
|
@@ -1652,6 +1627,39 @@ class $d82393b9dfe50322$export$ea60432919e69303 {
|
|
|
1652
1627
|
opts.event_ && (this.event = opts.event_);
|
|
1653
1628
|
}
|
|
1654
1629
|
}
|
|
1630
|
+
const $c64b3d92c99cdd73$var$needs_patching = typeof window === "object" ? /*@__PURE__*/$c64b3d92c99cdd73$var$check_if_querySelectorAll_needs_patching() : false;
|
|
1631
|
+
function $c64b3d92c99cdd73$export$33f937d741e49339(element, selector) {
|
|
1632
|
+
if (!(element instanceof Element) || !$c64b3d92c99cdd73$var$needs_patching || !selector.includes("#") || !selector.includes("+")) {
|
|
1633
|
+
var _element$querySelecto;
|
|
1634
|
+
// covers most cases, we don't need patching or don't hit the bug
|
|
1635
|
+
return element === null || element === void 0 ? void 0 : (_element$querySelecto = element.querySelectorAll) === null || _element$querySelecto === void 0 ? void 0 : _element$querySelecto.call(element, selector);
|
|
1636
|
+
}
|
|
1637
|
+
const result = [];
|
|
1638
|
+
const elements_to_check = [];
|
|
1639
|
+
// intentionally not recursive since it's possible to have deeper nested elements than max stack size
|
|
1640
|
+
for (let i = element.children.length; i--;) elements_to_check.push(element.children[i]);
|
|
1641
|
+
while (elements_to_check.length) {
|
|
1642
|
+
const child_element = elements_to_check.pop();
|
|
1643
|
+
if (child_element.matches(selector)) result.push(child_element);
|
|
1644
|
+
for (let i = child_element.children.length; i--;)
|
|
1645
|
+
// kudos to Karl for algorithm help
|
|
1646
|
+
elements_to_check.push(child_element.children[i]);
|
|
1647
|
+
}
|
|
1648
|
+
return result;
|
|
1649
|
+
}
|
|
1650
|
+
function $c64b3d92c99cdd73$var$check_if_querySelectorAll_needs_patching() {
|
|
1651
|
+
const id_div = document.createElement("div");
|
|
1652
|
+
const element = document.createElement("section");
|
|
1653
|
+
const selector = "#a+*";
|
|
1654
|
+
id_div.id = "a";
|
|
1655
|
+
document.documentElement.append(id_div, element);
|
|
1656
|
+
try {
|
|
1657
|
+
return element === element.querySelectorAll(selector)[0];
|
|
1658
|
+
} finally {
|
|
1659
|
+
id_div.remove();
|
|
1660
|
+
element.remove();
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1655
1663
|
function $523564fcfb9c3bb9$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
1656
1664
|
$523564fcfb9c3bb9$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
1657
1665
|
privateSet.add(obj);
|
|
@@ -2239,6 +2247,21 @@ function $03c157d68c9fcbac$var$make_default_observer() {
|
|
|
2239
2247
|
$3b52ccc10510b32a$export$f18d5b0af29128b7([error, "error starting ElementObserver"], "error");
|
|
2240
2248
|
}
|
|
2241
2249
|
}
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* 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
|
|
2253
|
+
* @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
|
|
2254
|
+
* @return Stuff to give to IntersectionObserver
|
|
2255
|
+
*/
|
|
2256
|
+
function $4e1f5263dceb9802$export$f8ea2e7b15b5d129(numSteps) {
|
|
2257
|
+
const thresholds = [];
|
|
2258
|
+
for (let i = 1.0; i <= numSteps; i++) {
|
|
2259
|
+
const ratio = i / numSteps;
|
|
2260
|
+
thresholds.push(ratio);
|
|
2261
|
+
}
|
|
2262
|
+
thresholds.push(0);
|
|
2263
|
+
return thresholds;
|
|
2264
|
+
}
|
|
2242
2265
|
function $8b27923e1d1e6b99$export$925772df9b4d16e5(url, param, value) {
|
|
2243
2266
|
const url_object = new URL(url),
|
|
2244
2267
|
search_params = new URLSearchParams(url_object.search);
|
|
@@ -2351,1835 +2374,57 @@ function $8b27923e1d1e6b99$export$9590700a594aef08(obj, step1) {
|
|
|
2351
2374
|
for (var _len = arguments.length, path = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) path[_key - 2] = arguments[_key];
|
|
2352
2375
|
if (path.length) return $8b27923e1d1e6b99$export$9590700a594aef08(obj[step1], ...path);else return obj[step1];
|
|
2353
2376
|
}
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
return new Promise((res, rej) => promise.then(rej, res));
|
|
2377
|
+
function $bc463df3122a418b$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
2378
|
+
$bc463df3122a418b$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
2379
|
+
privateSet.add(obj);
|
|
2358
2380
|
}
|
|
2359
|
-
function $
|
|
2360
|
-
var
|
|
2361
|
-
|
|
2381
|
+
function $bc463df3122a418b$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
2382
|
+
$bc463df3122a418b$var$_checkPrivateRedeclaration(obj, privateMap);
|
|
2383
|
+
privateMap.set(obj, value);
|
|
2362
2384
|
}
|
|
2363
|
-
|
|
2364
|
-
if (
|
|
2365
|
-
const bc = new BroadcastChannel("right_click_attribution");
|
|
2366
|
-
$7f95f77417d06249$export$de56f1198d121036("Broadcasting", product_id, "to", bc);
|
|
2367
|
-
bc.postMessage(product_id);
|
|
2368
|
-
bc.close();
|
|
2385
|
+
function $bc463df3122a418b$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
2386
|
+
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
2369
2387
|
}
|
|
2370
|
-
function $
|
|
2371
|
-
if (
|
|
2372
|
-
|
|
2373
|
-
const handler = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => $04bba294678834bc$export$8f66c4c7fb96eda2(e, ("variant_index" in display ? display.variant_displays[display.variant_index] : display).product_id));
|
|
2374
|
-
const auxclick_handler = e => e.button === 1 && handler(e);
|
|
2375
|
-
for (let i = 0; i < (elements === null || elements === void 0 ? void 0 : elements.length); i++) {
|
|
2376
|
-
const element = elements[i];
|
|
2377
|
-
element.addEventListener("contextmenu", handler);
|
|
2378
|
-
element.addEventListener("auxclick", auxclick_handler); // actual wheel click - some mouses / OS:es also dispatch auxclick on rightclick
|
|
2379
|
-
if (get_event_listener_remover) disconnectors.push(() => {
|
|
2380
|
-
element.removeEventListener("contextmenu", handler);
|
|
2381
|
-
element.removeEventListener("auxclick", auxclick_handler);
|
|
2382
|
-
});
|
|
2383
|
-
}
|
|
2384
|
-
get_event_listener_remover === null || get_event_listener_remover === void 0 || get_event_listener_remover(() => disconnectors.forEach(disconnector => disconnector()));
|
|
2385
|
-
return elements;
|
|
2388
|
+
function $bc463df3122a418b$var$_classPrivateMethodGet(receiver, privateSet, fn) {
|
|
2389
|
+
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
2390
|
+
return fn;
|
|
2386
2391
|
}
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2392
|
+
var $bc463df3122a418b$var$_verbose = /*#__PURE__*/new WeakMap();
|
|
2393
|
+
var $bc463df3122a418b$var$_images_on_first_page = /*#__PURE__*/new WeakMap();
|
|
2394
|
+
var $bc463df3122a418b$var$_default_lazyfinder = /*#__PURE__*/new WeakMap();
|
|
2395
|
+
var $bc463df3122a418b$var$_initiate_new_image = /*#__PURE__*/new WeakSet();
|
|
2396
|
+
var $bc463df3122a418b$var$_add_load_event_listener = /*#__PURE__*/new WeakSet();
|
|
2397
|
+
var $bc463df3122a418b$var$_unload_images_and_add_load_listeners = /*#__PURE__*/new WeakSet();
|
|
2398
|
+
var $bc463df3122a418b$var$_start_observer = /*#__PURE__*/new WeakSet();
|
|
2399
|
+
var $bc463df3122a418b$var$_check_if_first_page_has_loaded = /*#__PURE__*/new WeakSet();
|
|
2400
|
+
class $bc463df3122a418b$export$3be7054c61590ee3 {
|
|
2401
|
+
start_observing_for_new_children_(override_container) {
|
|
2402
|
+
// should ONLY run on our "stock" elements array and is therefore called if "elements" is get in it - which means it's being used
|
|
2403
|
+
// it allows us to just add elements to the observed container and have them added to the elements array if they or their children match the selector
|
|
2404
|
+
if (!this.container && !override_container) return;
|
|
2405
|
+
const container = override_container !== null && override_container !== void 0 ? override_container : this.container;
|
|
2406
|
+
const mutation_observer = new MutationObserver($3b52ccc10510b32a$export$b3bbfd758f11cfa9(mutations => {
|
|
2407
|
+
for (let i = 0; i < mutations.length; i++) {
|
|
2408
|
+
const matching_added_els = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(mutations[i].addedNodes, this.selector);
|
|
2409
|
+
if (matching_added_els.length) {
|
|
2410
|
+
if ($parcel$interopDefault($lMD39$babelruntimehelpersclassPrivateFieldGet)(this, $bc463df3122a418b$var$_verbose)) $7f95f77417d06249$export$de56f1198d121036("New elements", matching_added_els, " matching selector", this.selector, "were aded to", container, "lazyloading\u2026");
|
|
2411
|
+
this.lazyfinder.elements.push(...matching_added_els);
|
|
2412
|
+
matching_added_els.forEach($bc463df3122a418b$var$_classPrivateMethodGet(this, $bc463df3122a418b$var$_initiate_new_image, $bc463df3122a418b$var$_initiate_new_image2).bind(this));
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2398
2415
|
}));
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
element.dispatchEvent(click);
|
|
2412
|
-
} else $7f95f77417d06249$export$de56f1198d121036("Our product_id did not get broadcasted, closing channel");
|
|
2413
|
-
bc.close();
|
|
2414
|
-
}
|
|
2415
|
-
|
|
2416
|
-
/**
|
|
2417
|
-
* 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
|
|
2418
|
-
* @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
|
|
2419
|
-
* @return Stuff to give to IntersectionObserver
|
|
2420
|
-
*/
|
|
2421
|
-
function $4e1f5263dceb9802$export$f8ea2e7b15b5d129(numSteps) {
|
|
2422
|
-
const thresholds = [];
|
|
2423
|
-
for (let i = 1.0; i <= numSteps; i++) {
|
|
2424
|
-
const ratio = i / numSteps;
|
|
2425
|
-
thresholds.push(ratio);
|
|
2426
|
-
}
|
|
2427
|
-
thresholds.push(0);
|
|
2428
|
-
return thresholds;
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
/**
|
|
2432
|
-
* Elements currently intersecting with the viewport.
|
|
2433
|
-
* If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
|
|
2434
|
-
*/
|
|
2435
|
-
const $6221808291a088c4$var$current_intersections = /*@__PURE__*/new WeakMap();
|
|
2436
|
-
/**
|
|
2437
|
-
* Currently watched elements by the intersection observer with their respective callback
|
|
2438
|
-
* */
|
|
2439
|
-
const $6221808291a088c4$var$watched_elements = /*@__PURE__*/new WeakMap();
|
|
2440
|
-
const $6221808291a088c4$var$unwatch_element = element => {
|
|
2441
|
-
$6221808291a088c4$var$intersection_observer === null || $6221808291a088c4$var$intersection_observer === void 0 || $6221808291a088c4$var$intersection_observer.unobserve(element);
|
|
2442
|
-
$6221808291a088c4$var$watched_elements.delete(element);
|
|
2443
|
-
$6221808291a088c4$var$current_intersections.delete(element);
|
|
2444
|
-
};
|
|
2445
|
-
const $6221808291a088c4$export$4c51576248bcdf31 = (element, callback) => {
|
|
2446
|
-
if ($6221808291a088c4$var$watched_elements.has(element)) {
|
|
2447
|
-
$7f95f77417d06249$export$de56f1198d121036("Not watching", element, "as it's already being watched");
|
|
2448
|
-
return () => {};
|
|
2449
|
-
}
|
|
2450
|
-
$6221808291a088c4$var$intersection_observer === null || $6221808291a088c4$var$intersection_observer === void 0 || $6221808291a088c4$var$intersection_observer.observe(element);
|
|
2451
|
-
/** Calls the given callback and makes sure to stop watching the element */
|
|
2452
|
-
const wrapped_callback = element => {
|
|
2453
|
-
callback(element);
|
|
2454
|
-
$6221808291a088c4$var$unwatch_element(element);
|
|
2455
|
-
};
|
|
2456
|
-
$6221808291a088c4$var$watched_elements.set(element, wrapped_callback);
|
|
2457
|
-
const disconnect_observer = (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onremoved(element, () => {
|
|
2458
|
-
// Sometimes it has already rapidly been reinserted. The observer events lag by one tick.
|
|
2459
|
-
// For that case, make sure we're really out of the DOM
|
|
2460
|
-
if (document.documentElement.contains(element)) return;
|
|
2461
|
-
$6221808291a088c4$var$unwatch_element(element);
|
|
2462
|
-
});
|
|
2463
|
-
return () => {
|
|
2464
|
-
disconnect_observer();
|
|
2465
|
-
$6221808291a088c4$var$unwatch_element(element);
|
|
2466
|
-
};
|
|
2467
|
-
};
|
|
2468
|
-
const $6221808291a088c4$var$intersection_observer_callback = entries => {
|
|
2469
|
-
for (const record of entries) {
|
|
2470
|
-
const {
|
|
2471
|
-
target: target
|
|
2472
|
-
} = record;
|
|
2473
|
-
const callback = $6221808291a088c4$var$watched_elements.get(target);
|
|
2474
|
-
// Skip the element if it's no longer being watched.
|
|
2475
|
-
if (!callback) {
|
|
2476
|
-
$6221808291a088c4$var$intersection_observer === null || $6221808291a088c4$var$intersection_observer === void 0 || $6221808291a088c4$var$intersection_observer.unobserve(target);
|
|
2477
|
-
continue;
|
|
2478
|
-
}
|
|
2479
|
-
const currently_intersecting = $6221808291a088c4$var$current_intersections.has(target);
|
|
2480
|
-
if (!currently_intersecting && record.intersectionRatio >= (0, $4b9808e8f3ab50d9$export$135da44d0ba958bc)[0]) {
|
|
2481
|
-
// we're intersecting enough and not already in the process of "measuring"
|
|
2482
|
-
const started_intersecting_at_ = +new Date(); // save start time
|
|
2483
|
-
// Schedule the callback function to be called after the element has been intersecting for the required duration
|
|
2484
|
-
const callback_timeout_ = setTimeout(callback, (0, $4b9808e8f3ab50d9$export$ca8321ea61dc2544), target);
|
|
2485
|
-
$6221808291a088c4$var$current_intersections.set(target, {
|
|
2486
|
-
started_intersecting_at_: started_intersecting_at_,
|
|
2487
|
-
callback_timeout_: callback_timeout_
|
|
2488
|
-
});
|
|
2489
|
-
} else if (currently_intersecting && record.intersectionRatio < (0, $4b9808e8f3ab50d9$export$135da44d0ba958bc)[1]) {
|
|
2490
|
-
// we are in the process of "measuring" and went below the threshold
|
|
2491
|
-
const {
|
|
2492
|
-
started_intersecting_at_: started_intersecting_at_,
|
|
2493
|
-
callback_timeout_: callback_timeout_
|
|
2494
|
-
} = $6221808291a088c4$var$current_intersections.get(target);
|
|
2495
|
-
const time_elapsed = +new Date() - started_intersecting_at_;
|
|
2496
|
-
// If we stopped intersecting too early we want to abort our timeout.
|
|
2497
|
-
// if we did not we also want to abort the timeout since it's been lagging and just instantly send the event
|
|
2498
|
-
// (the browser can delay setTimeout timers)
|
|
2499
|
-
clearTimeout(callback_timeout_);
|
|
2500
|
-
if (time_elapsed <= (0, $4b9808e8f3ab50d9$export$ca8321ea61dc2544)) $6221808291a088c4$var$current_intersections.delete(target);else {
|
|
2501
|
-
// we intersected long enough
|
|
2502
|
-
$7f95f77417d06249$export$de56f1198d121036("intersection_observer: setTimeout lagged", time_elapsed, (0, $4b9808e8f3ab50d9$export$ca8321ea61dc2544), "ms", target);
|
|
2503
|
-
callback(target);
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
}
|
|
2507
|
-
};
|
|
2508
|
-
/**
|
|
2509
|
-
* Global IntersectionObserver used for all impression tracking.
|
|
2510
|
-
* It's faster to use one observer for all elements than to create a new one for each element.
|
|
2511
|
-
*/
|
|
2512
|
-
const $6221808291a088c4$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/new IntersectionObserver( /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9($6221808291a088c4$var$intersection_observer_callback), {
|
|
2513
|
-
threshold: /*@__PURE__*/$4e1f5263dceb9802$export$f8ea2e7b15b5d129(8)
|
|
2514
|
-
}) : undefined;
|
|
2515
|
-
const $e61e4fdc357cece9$export$d0efd8ed14f5c33 = (items, display, info) => {
|
|
2516
|
-
if (!(items !== null && items !== void 0 && items.length)) return items;
|
|
2517
|
-
const node_array = Array.isArray(items) ? items : [...items]; // if it's a NodeList convert it to an array
|
|
2518
|
-
const first_watchable_el = node_array.find(el => el instanceof Element);
|
|
2519
|
-
if (!first_watchable_el) {
|
|
2520
|
-
$7f95f77417d06249$export$de56f1198d121036("Impression tracking: Can't observe", items, display);
|
|
2521
|
-
return items;
|
|
2522
|
-
}
|
|
2523
|
-
if (!info.t) {
|
|
2524
|
-
$7f95f77417d06249$export$de56f1198d121036("Impression tracking: No tenant instance, can't track", items, display);
|
|
2525
|
-
return items;
|
|
2526
|
-
}
|
|
2527
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(first_watchable_el, _ref => {
|
|
2528
|
-
let {
|
|
2529
|
-
element: element
|
|
2530
|
-
} = _ref;
|
|
2531
|
-
$6221808291a088c4$export$4c51576248bcdf31(element, () => {
|
|
2532
|
-
const {
|
|
2533
|
-
recommendation_id: recommendation_id,
|
|
2534
|
-
search_result_id: search_result_id,
|
|
2535
|
-
product_listing_result_id: product_listing_result_id,
|
|
2536
|
-
suggestions_result_id: suggestions_result_id
|
|
2537
|
-
} = display;
|
|
2538
|
-
$4b9808e8f3ab50d9$export$4205dc6835bc0d9f({
|
|
2539
|
-
...$335c248bb07a3509$export$8c6f26a5b6921b95(),
|
|
2540
|
-
recommendation_type: info.rendering_options.type,
|
|
2541
|
-
entity_price: display.sale_price,
|
|
2542
|
-
market: info.t.market,
|
|
2543
|
-
tenant: info.t.tenant,
|
|
2544
|
-
product_id: display.product_id,
|
|
2545
|
-
recommendation_id: recommendation_id,
|
|
2546
|
-
search_result_id: search_result_id,
|
|
2547
|
-
product_listing_result_id: product_listing_result_id,
|
|
2548
|
-
suggestions_result_id: suggestions_result_id
|
|
2549
|
-
});
|
|
2550
|
-
});
|
|
2551
|
-
});
|
|
2552
|
-
return items;
|
|
2553
|
-
};
|
|
2554
|
-
const $89969f18db4020d7$export$37125ccc5dd98050 = _ref => {
|
|
2555
|
-
let {
|
|
2556
|
-
element: element,
|
|
2557
|
-
data: data,
|
|
2558
|
-
wait_for_dom_insertion = true
|
|
2559
|
-
} = _ref;
|
|
2560
|
-
const disconnectors = [];
|
|
2561
|
-
const impression_track = () => {
|
|
2562
|
-
const disconnector = $6221808291a088c4$export$4c51576248bcdf31(element, () => {
|
|
2563
|
-
$4b9808e8f3ab50d9$export$4205dc6835bc0d9f({
|
|
2564
|
-
...$335c248bb07a3509$export$8c6f26a5b6921b95(),
|
|
2565
|
-
...data
|
|
2566
|
-
});
|
|
2567
|
-
});
|
|
2568
|
-
disconnectors.push(disconnector);
|
|
2569
|
-
};
|
|
2570
|
-
if (wait_for_dom_insertion) disconnectors.push((0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(element, impression_track));else impression_track();
|
|
2571
|
-
return () => disconnectors.forEach(disconnector => disconnector());
|
|
2572
|
-
};
|
|
2573
|
-
let $4b9808e8f3ab50d9$export$135da44d0ba958bc = [0.6, 0.5];
|
|
2574
|
-
const $4b9808e8f3ab50d9$export$c543ee4cdb0d0964 = (start, end) => $4b9808e8f3ab50d9$export$135da44d0ba958bc = [start, end];
|
|
2575
|
-
const $4b9808e8f3ab50d9$export$ca8321ea61dc2544 = 500;
|
|
2576
|
-
const $4b9808e8f3ab50d9$export$4205dc6835bc0d9f = data => {
|
|
2577
|
-
data.type = "element_visible"; // Set the type to element_visible as this is optional to pass here.
|
|
2578
|
-
$49880c4ce4bb7db2$export$28cacbd9b4306ffc([data], true);
|
|
2579
|
-
};
|
|
2580
|
-
function $1ea91dfed6983398$export$82a685f2da2fb027(a_element, product_id, recommendation_id, additional_listener) {
|
|
2581
|
-
var _a_element$depict_tra, _a_element$depict_tra2;
|
|
2582
|
-
if (!a_element ||
|
|
2583
|
-
// @ts-ignore
|
|
2584
|
-
!a_element.depict_tracked ||
|
|
2585
|
-
// @ts-ignore
|
|
2586
|
-
(a_element === null || a_element === void 0 ? void 0 : (_a_element$depict_tra = a_element.depict_tracked) === null || _a_element$depict_tra === void 0 ? void 0 : _a_element$depict_tra.recommendation_id) != recommendation_id ||
|
|
2587
|
-
// @ts-ignore
|
|
2588
|
-
(a_element === null || a_element === void 0 ? void 0 : (_a_element$depict_tra2 = a_element.depict_tracked) === null || _a_element$depict_tra2 === void 0 ? void 0 : _a_element$depict_tra2.product_id) != product_id) {
|
|
2589
|
-
const listener = e => {
|
|
2590
|
-
localStorage.setItem("depict_attribution_".concat(product_id), recommendation_id);
|
|
2591
|
-
if (additional_listener) additional_listener(e, product_id, recommendation_id);
|
|
2592
|
-
};
|
|
2593
|
-
// @ts-ignore
|
|
2594
|
-
if (a_element.depict_tracked) {
|
|
2595
|
-
var _a_element$depict_tra3;
|
|
2596
|
-
// @ts-ignore
|
|
2597
|
-
a_element.removeEventListener("click", (_a_element$depict_tra3 = a_element.depict_tracked) === null || _a_element$depict_tra3 === void 0 ? void 0 : _a_element$depict_tra3.listener);
|
|
2598
|
-
}
|
|
2599
|
-
// @ts-ignore
|
|
2600
|
-
a_element.depict_tracked = {
|
|
2601
|
-
product_id: product_id,
|
|
2602
|
-
recommendation_id: recommendation_id,
|
|
2603
|
-
listener: listener
|
|
2604
|
-
};
|
|
2605
|
-
a_element.addEventListener("click", listener);
|
|
2606
|
-
return listener;
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
|
-
async function $1ea91dfed6983398$export$2c34560c3749dc63(button, get_product_id, tracking_fn, unmatching_tracking, event) {
|
|
2610
|
-
// @ts-ignore
|
|
2611
|
-
if (!button || button.depict_tracked) return;
|
|
2612
|
-
button.addEventListener(event ? event : "click", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(async e => {
|
|
2613
|
-
if (!e.isTrusted) {
|
|
2614
|
-
$7f95f77417d06249$export$de56f1198d121036("ignoring event", e, "because it's not user generated");
|
|
2615
|
-
return;
|
|
2616
|
-
}
|
|
2617
|
-
const product_id = await get_product_id(undefined, e);
|
|
2618
|
-
if (product_id) {
|
|
2619
|
-
const item_name = "depict_attribution_".concat(product_id);
|
|
2620
|
-
const recommendation_id = localStorage.getItem(item_name);
|
|
2621
|
-
if (recommendation_id) {
|
|
2622
|
-
localStorage.removeItem(item_name);
|
|
2623
|
-
tracking_fn(product_id, recommendation_id, false, e);
|
|
2624
|
-
} else if (unmatching_tracking) tracking_fn(product_id, recommendation_id, true, e);
|
|
2625
|
-
}
|
|
2626
|
-
}));
|
|
2627
|
-
// @ts-ignore
|
|
2628
|
-
button.depict_tracked = true;
|
|
2629
|
-
}
|
|
2630
|
-
var $8b0f4f54739f2574$var$_globalThis$window;
|
|
2631
|
-
const $8b0f4f54739f2574$export$20e9533e68ee72e7 = /*@__PURE__*/$76a59c6ce18c8fd3$export$e806c6c1615a59ae(false);
|
|
2632
|
-
const $8b0f4f54739f2574$export$a9d39e43ae273d26 = /*@__PURE__*/$76a59c6ce18c8fd3$export$e806c6c1615a59ae();
|
|
2633
|
-
const $8b0f4f54739f2574$export$7500cdfd37aafd43 = /*@__PURE__*/new Set();
|
|
2634
|
-
let $8b0f4f54739f2574$var$old_url;
|
|
2635
|
-
const $8b0f4f54739f2574$var$maybe_navigation = (what_happened, args) => {
|
|
2636
|
-
if (typeof location === "undefined") return;
|
|
2637
|
-
const new_url = location.href;
|
|
2638
|
-
if ($8b0f4f54739f2574$var$old_url !== new_url) {
|
|
2639
|
-
$8b0f4f54739f2574$export$a9d39e43ae273d26(new_url);
|
|
2640
|
-
if ($8b0f4f54739f2574$var$old_url !== undefined)
|
|
2641
|
-
// don't resolve stateless href change ipns with the initial value - it's not a navigation
|
|
2642
|
-
$8b0f4f54739f2574$export$20e9533e68ee72e7(new_url);
|
|
2643
|
-
$8b0f4f54739f2574$var$old_url = new_url;
|
|
2644
|
-
}
|
|
2645
|
-
for (const fn of $8b0f4f54739f2574$export$7500cdfd37aafd43) fn(what_happened, args);
|
|
2646
|
-
};
|
|
2647
|
-
$8b0f4f54739f2574$export$baccefee4a395d8f((args, what_happened) => $8b0f4f54739f2574$var$maybe_navigation(what_happened, args));
|
|
2648
|
-
$8b0f4f54739f2574$var$maybe_navigation();
|
|
2649
|
-
globalThis === null || globalThis === void 0 || ($8b0f4f54739f2574$var$_globalThis$window = globalThis.window) === null || $8b0f4f54739f2574$var$_globalThis$window === void 0 || $8b0f4f54739f2574$var$_globalThis$window.addEventListener("popstate", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => $8b0f4f54739f2574$var$maybe_navigation("popstate", e)));
|
|
2650
|
-
async function $8b0f4f54739f2574$export$1cd22bab0d2c3b0b(callback) {
|
|
2651
|
-
const catchified_callback = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(callback);
|
|
2652
|
-
for await (const href of $8b0f4f54739f2574$export$20e9533e68ee72e7) {
|
|
2653
|
-
catchified_callback(href);
|
|
2654
|
-
break;
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
async function $8b0f4f54739f2574$export$baccefee4a395d8f(after_navigation) {
|
|
2658
|
-
let replace_replaceState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2659
|
-
if (typeof History === "undefined") return;
|
|
2660
|
-
const {
|
|
2661
|
-
prototype: prototype
|
|
2662
|
-
} = History;
|
|
2663
|
-
const instance = history;
|
|
2664
|
-
const polyfill_dance = the_thing => {
|
|
2665
|
-
const proxy_the_thing = obj => {
|
|
2666
|
-
const orig_pushState = obj[the_thing];
|
|
2667
|
-
obj[the_thing] = new Proxy(orig_pushState, {
|
|
2668
|
-
apply: (target, this_arg, arguments_list) => {
|
|
2669
|
-
const nav_result = Reflect.apply(target, this_arg, arguments_list);
|
|
2670
|
-
try {
|
|
2671
|
-
after_navigation(arguments_list, the_thing);
|
|
2672
|
-
} catch (e) {
|
|
2673
|
-
$46b94b232dc792af$export$8048b892d651b310(e);
|
|
2674
|
-
}
|
|
2675
|
-
return nav_result;
|
|
2676
|
-
}
|
|
2677
|
-
});
|
|
2678
|
-
};
|
|
2679
|
-
proxy_the_thing(prototype);
|
|
2680
|
-
if (Object.getOwnPropertyNames(instance).includes(the_thing))
|
|
2681
|
-
// we don't want to just change the instance because that's not the way to do it, but we don't want to not work because someone else did it wrong
|
|
2682
|
-
proxy_the_thing(instance);
|
|
2683
|
-
};
|
|
2684
|
-
polyfill_dance("pushState");
|
|
2685
|
-
if (replace_replaceState) polyfill_dance("replaceState");
|
|
2686
|
-
}
|
|
2687
|
-
let $c15d2edce69e632a$var$last_page_pageview_sent_for;
|
|
2688
|
-
async function $c15d2edce69e632a$export$eee4c4d924348b05(data) {
|
|
2689
|
-
// Send page view to depict if needed
|
|
2690
|
-
try {
|
|
2691
|
-
const {
|
|
2692
|
-
href: href
|
|
2693
|
-
} = location;
|
|
2694
|
-
if ($c15d2edce69e632a$var$last_page_pageview_sent_for !== href) {
|
|
2695
|
-
$c15d2edce69e632a$var$last_page_pageview_sent_for = href;
|
|
2696
|
-
$335c248bb07a3509$export$82badda1f9923310({
|
|
2697
|
-
...data,
|
|
2698
|
-
type: "page_view"
|
|
2699
|
-
});
|
|
2700
|
-
if (data.product_id) await $04bba294678834bc$export$836f70a28c317905(data.product_id); // this takes care of right click click attribution - broadcasts the URL of the current page
|
|
2701
|
-
}
|
|
2702
|
-
} catch (error) {
|
|
2703
|
-
$3b52ccc10510b32a$export$f18d5b0af29128b7([error, "Sending page view failed"], "warning");
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
let $c15d2edce69e632a$var$sending_on_navigation = false;
|
|
2707
|
-
async function $c15d2edce69e632a$export$f7cb1bd47199ec38(data) {
|
|
2708
|
-
if (!$c15d2edce69e632a$var$sending_on_navigation) {
|
|
2709
|
-
$c15d2edce69e632a$var$sending_on_navigation = true;
|
|
2710
|
-
$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async () => {
|
|
2711
|
-
for await (const _href of (0, $8b0f4f54739f2574$export$a9d39e43ae273d26)) $c15d2edce69e632a$export$eee4c4d924348b05({
|
|
2712
|
-
tenant: data.tenant,
|
|
2713
|
-
market: data.market,
|
|
2714
|
-
product_id: await data.get_product_id(_href)
|
|
2715
|
-
});
|
|
2716
|
-
})();
|
|
2717
|
-
}
|
|
2718
|
-
}
|
|
2719
|
-
function $f812c921818adbe0$export$edfedd0557ca5a2d(ga_tracker, append_to_url) {
|
|
2720
|
-
if (!ga_tracker) return;
|
|
2721
|
-
// Docs for analytics.js Tasks:
|
|
2722
|
-
// https://developers.google.com/analytics/devguides/collection/analyticsjs/tasks
|
|
2723
|
-
const sendHitTask = "sendHitTask";
|
|
2724
|
-
const originalSendHitTask = ga_tracker.get(sendHitTask);
|
|
2725
|
-
ga_tracker.set(sendHitTask, model => {
|
|
2726
|
-
originalSendHitTask(model);
|
|
2727
|
-
// console.log('Sent original hit, now sending to depict');
|
|
2728
|
-
try {
|
|
2729
|
-
const payLoad = model.get("hitPayload");
|
|
2730
|
-
const path = (0, $62869a3ed703f236$export$362abebb4b313340) + "/collect-ga";
|
|
2731
|
-
let url = path + "?" + payLoad;
|
|
2732
|
-
if (append_to_url) url += append_to_url;
|
|
2733
|
-
const n = navigator;
|
|
2734
|
-
const sb = "sendBeacon";
|
|
2735
|
-
if (n[sb])
|
|
2736
|
-
// this is actually smaller, I tested
|
|
2737
|
-
n[sb](url);else {
|
|
2738
|
-
const xhttp = new XMLHttpRequest();
|
|
2739
|
-
xhttp.open("GET", url);
|
|
2740
|
-
xhttp.send();
|
|
2741
|
-
}
|
|
2742
|
-
} catch (e) {
|
|
2743
|
-
// console.log('Could not send beacon to /collect-ga', e);
|
|
2744
|
-
}
|
|
2745
|
-
});
|
|
2746
|
-
}
|
|
2747
|
-
function $f812c921818adbe0$export$674d8cd8b6868154() {
|
|
2748
|
-
// Snippet to load GA async
|
|
2749
|
-
const w = window;
|
|
2750
|
-
// @ts-ignore
|
|
2751
|
-
w.ga || (w.ga = function () {
|
|
2752
|
-
var _w$ga;
|
|
2753
|
-
((_w$ga = w.ga).q || (_w$ga.q = [])).push(arguments);
|
|
2754
|
-
});
|
|
2755
|
-
w.ga.l = +new Date();
|
|
2756
|
-
}
|
|
2757
|
-
var $2e81c18d82b25372$exports = {};
|
|
2758
|
-
$parcel$export($2e81c18d82b25372$exports, "cookiebot_get_consent", () => $2e81c18d82b25372$export$fce59460a1699957);
|
|
2759
|
-
$parcel$export($2e81c18d82b25372$exports, "cookiebot_wait_for_consent", () => $2e81c18d82b25372$export$56c2e8be65fb14ae);
|
|
2760
|
-
$parcel$export($2e81c18d82b25372$exports, "cookiebot_get_cookie_ipns", () => $2e81c18d82b25372$export$8827362e5e938d26);
|
|
2761
|
-
$parcel$export($2e81c18d82b25372$exports, "init_cookiebot_tracking", () => $2e81c18d82b25372$export$abec7fd9f0b9cc22);
|
|
2762
|
-
const $2e81c18d82b25372$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
|
|
2763
|
-
function $2e81c18d82b25372$var$consent_from_cookie() {
|
|
2764
|
-
const cookie = $335c248bb07a3509$export$622991c71a1f52b3("CookieConsent");
|
|
2765
|
-
if (!cookie) return;
|
|
2766
|
-
const consent_json = cookie.replace(/%2C/g, ",").replace(/%27/g, "'").replace(/'/g, '"').replace(/([{[,])\s*([\w]+?):/g, '$1"$2":');
|
|
2767
|
-
try {
|
|
2768
|
-
return JSON.parse(consent_json);
|
|
2769
|
-
} catch ({
|
|
2770
|
-
message: message
|
|
2771
|
-
}) {
|
|
2772
|
-
$7f95f77417d06249$export$de56f1198d121036("Error parsing cookie json", consent_json, message);
|
|
2773
|
-
return;
|
|
2774
|
-
}
|
|
2775
|
-
}
|
|
2776
|
-
let $2e81c18d82b25372$var$cookie_ipns;
|
|
2777
|
-
let $2e81c18d82b25372$var$has_consent = /*@__PURE__*/(_consent_from_cookie => $2e81c18d82b25372$var$required_consent_level ? ((_consent_from_cookie = $2e81c18d82b25372$var$consent_from_cookie()) === null || _consent_from_cookie === void 0 ? void 0 : _consent_from_cookie[$2e81c18d82b25372$var$required_consent_level]) || false : true)();
|
|
2778
|
-
const $2e81c18d82b25372$export$fce59460a1699957 = () => $2e81c18d82b25372$var$has_consent;
|
|
2779
|
-
async function $2e81c18d82b25372$export$56c2e8be65fb14ae() {
|
|
2780
|
-
for await (const consent_obj of $2e81c18d82b25372$export$8827362e5e938d26()) return consent_obj[process.env.DEPICT_TRACKING_CONSENT_LEVEL];
|
|
2781
|
-
// Impossible
|
|
2782
|
-
return false;
|
|
2783
|
-
}
|
|
2784
|
-
function $2e81c18d82b25372$export$8827362e5e938d26() {
|
|
2785
|
-
if ($2e81c18d82b25372$var$cookie_ipns) return $2e81c18d82b25372$var$cookie_ipns;
|
|
2786
|
-
$2e81c18d82b25372$var$cookie_ipns = $76a59c6ce18c8fd3$export$e806c6c1615a59ae();
|
|
2787
|
-
const existing_consent = $2e81c18d82b25372$var$consent_from_cookie();
|
|
2788
|
-
if (existing_consent) $2e81c18d82b25372$var$cookie_ipns(existing_consent);
|
|
2789
|
-
const consent_maybe_changed = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(() => {
|
|
2790
|
-
const {
|
|
2791
|
-
consent: {
|
|
2792
|
-
marketing: marketing,
|
|
2793
|
-
necessary: necessary,
|
|
2794
|
-
preferences: preferences,
|
|
2795
|
-
statistics: statistics
|
|
2796
|
-
}
|
|
2797
|
-
} = window.Cookiebot;
|
|
2798
|
-
const new_consent_obj = {
|
|
2799
|
-
marketing: marketing,
|
|
2800
|
-
necessary: necessary,
|
|
2801
|
-
preferences: preferences,
|
|
2802
|
-
statistics: statistics
|
|
2803
|
-
};
|
|
2804
|
-
if (!Object.keys(new_consent_obj).every(k => {
|
|
2805
|
-
var _cookie_ipns$latest_c;
|
|
2806
|
-
return ((_cookie_ipns$latest_c = $2e81c18d82b25372$var$cookie_ipns.latest_call_value) === null || _cookie_ipns$latest_c === void 0 ? void 0 : _cookie_ipns$latest_c[k]) === new_consent_obj[k];
|
|
2807
|
-
})) {
|
|
2808
|
-
$7f95f77417d06249$export$de56f1198d121036("Consent changed", new_consent_obj);
|
|
2809
|
-
$2e81c18d82b25372$var$cookie_ipns(new_consent_obj);
|
|
2810
|
-
}
|
|
2811
|
-
}, "extracting consent failed");
|
|
2812
|
-
$6bf620c74776aef6$export$2fc1a072736ae2f6(window, "Cookiebot", "consent").then(consent_maybe_changed);
|
|
2813
|
-
["CookiebotOnAccept", "CookiebotOnDecline"].forEach(e => window.addEventListener(e, consent_maybe_changed, false));
|
|
2814
|
-
return $2e81c18d82b25372$var$cookie_ipns;
|
|
2815
|
-
}
|
|
2816
|
-
const $2e81c18d82b25372$export$abec7fd9f0b9cc22 = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async function () {
|
|
2817
|
-
let anon_id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "anonymous";
|
|
2818
|
-
$7f95f77417d06249$export$de56f1198d121036("Initializing Cookiebot tracking");
|
|
2819
|
-
if (!$2e81c18d82b25372$var$required_consent_level) return $7f95f77417d06249$export$de56f1198d121036("No consent level set for Depict tracking. Ignoring consent and tracking everything.");
|
|
2820
|
-
const original_get_session_id = (0, $335c248bb07a3509$export$61e7e1f11e96692f);
|
|
2821
|
-
$335c248bb07a3509$export$93ae15b1ae509334(() => $2e81c18d82b25372$var$has_consent ? original_get_session_id() : anon_id);
|
|
2822
|
-
for await (const consent_obj of $2e81c18d82b25372$export$8827362e5e938d26()) {
|
|
2823
|
-
// Changing this will change the return value of function given to set_depict_id_fn above
|
|
2824
|
-
$2e81c18d82b25372$var$has_consent = consent_obj[$2e81c18d82b25372$var$required_consent_level];
|
|
2825
|
-
if (!$2e81c18d82b25372$var$has_consent) $7f95f77417d06249$export$de56f1198d121036('dsid will be set to, "'.concat(anon_id, '", until Cookiebot has consent for "').concat($2e81c18d82b25372$var$required_consent_level, '"'));else $7f95f77417d06249$export$de56f1198d121036('Cookiebot obtained consent for "'.concat($2e81c18d82b25372$var$required_consent_level, '", will use true dsid/session_id'));
|
|
2826
|
-
}
|
|
2827
|
-
});
|
|
2828
|
-
const $e9ab1681652f3fca$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
|
|
2829
|
-
/*
|
|
2830
|
-
The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
|
|
2831
|
-
visit their web, finish the consent dialog, then run
|
|
2832
|
-
new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
|
|
2833
|
-
in the console. You should see something like
|
|
2834
|
-
'NECES:1,ANALY:1,PERON:1,MARKE:1'
|
|
2835
|
-
Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
|
|
2836
|
-
as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
|
|
2837
|
-
OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
|
|
2838
|
-
If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
|
|
2839
|
-
then check the cookie value again.
|
|
2840
|
-
*/
|
|
2841
|
-
const $e9ab1681652f3fca$var$KEY_ORDER = ["necessary", "statistics", "preferences", "marketing"];
|
|
2842
|
-
const $e9ab1681652f3fca$var$OPTANON_TO_COOKIEBOT = Object.fromEntries((process.env.OPTANON_KEYS || "").split(",").filter(k => k).map((k, i) => [k, $e9ab1681652f3fca$var$KEY_ORDER[i]]));
|
|
2843
|
-
function $e9ab1681652f3fca$var$consent_from_cookie() {
|
|
2844
|
-
const cookie = $335c248bb07a3509$export$622991c71a1f52b3("OptanonConsent");
|
|
2845
|
-
if (!cookie) return;
|
|
2846
|
-
const groups = new URLSearchParams(cookie).get("groups") || "";
|
|
2847
|
-
const matches = groups.matchAll(/(\w+):(\d)/g);
|
|
2848
|
-
const consent = {};
|
|
2849
|
-
for (const match of matches) consent[$e9ab1681652f3fca$var$OPTANON_TO_COOKIEBOT[match[1]]] = match[2] == "1";
|
|
2850
|
-
return consent;
|
|
2851
|
-
}
|
|
2852
|
-
let $e9ab1681652f3fca$var$cookie_ipns;
|
|
2853
|
-
let $e9ab1681652f3fca$var$has_consent = /*@__PURE__*/(_consent_from_cookie => $e9ab1681652f3fca$var$required_consent_level ? ((_consent_from_cookie = $e9ab1681652f3fca$var$consent_from_cookie()) === null || _consent_from_cookie === void 0 ? void 0 : _consent_from_cookie[$e9ab1681652f3fca$var$required_consent_level]) || false : true)();
|
|
2854
|
-
const $e9ab1681652f3fca$export$1dd9ce50e201eff1 = () => $e9ab1681652f3fca$var$has_consent;
|
|
2855
|
-
async function $e9ab1681652f3fca$export$7a6d436e0782c6ed() {
|
|
2856
|
-
for await (const consent_obj of $e9ab1681652f3fca$export$7e4427e80d5fc619()) return consent_obj[process.env.DEPICT_TRACKING_CONSENT_LEVEL];
|
|
2857
|
-
// Impossible
|
|
2858
|
-
return false;
|
|
2859
|
-
}
|
|
2860
|
-
function $e9ab1681652f3fca$export$7e4427e80d5fc619() {
|
|
2861
|
-
if ($e9ab1681652f3fca$var$cookie_ipns) return $e9ab1681652f3fca$var$cookie_ipns;
|
|
2862
|
-
$e9ab1681652f3fca$var$cookie_ipns = $76a59c6ce18c8fd3$export$e806c6c1615a59ae();
|
|
2863
|
-
const existing_consent = $e9ab1681652f3fca$var$consent_from_cookie();
|
|
2864
|
-
if (existing_consent !== null && existing_consent !== void 0 && existing_consent.necessary)
|
|
2865
|
-
// If "necessary" isn't set, user hasn't actually given/withold consent yet.
|
|
2866
|
-
$e9ab1681652f3fca$var$cookie_ipns(existing_consent);
|
|
2867
|
-
window.addEventListener("consent.onetrust", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(evt => {
|
|
2868
|
-
const c = evt;
|
|
2869
|
-
// Cast because TS doesn't know about the forEach coming up
|
|
2870
|
-
const consent_obj = {};
|
|
2871
|
-
Object.keys($e9ab1681652f3fca$var$OPTANON_TO_COOKIEBOT).forEach(k => {
|
|
2872
|
-
consent_obj[$e9ab1681652f3fca$var$OPTANON_TO_COOKIEBOT[k]] = c.detail.includes(k);
|
|
2873
|
-
});
|
|
2874
|
-
if (!consent_obj.necessary)
|
|
2875
|
-
// If "necessary" isn't set, user hasn't actually given/withold consent yet.
|
|
2876
|
-
return;
|
|
2877
|
-
if (!Object.keys(consent_obj).every(k => {
|
|
2878
|
-
var _cookie_ipns$latest_c;
|
|
2879
|
-
return ((_cookie_ipns$latest_c = $e9ab1681652f3fca$var$cookie_ipns.latest_call_value) === null || _cookie_ipns$latest_c === void 0 ? void 0 : _cookie_ipns$latest_c[k]) === consent_obj[k];
|
|
2880
|
-
})) $e9ab1681652f3fca$var$cookie_ipns(consent_obj);
|
|
2881
|
-
}));
|
|
2882
|
-
return $e9ab1681652f3fca$var$cookie_ipns;
|
|
2883
|
-
}
|
|
2884
|
-
const $e9ab1681652f3fca$export$f0f6c846d96fdbec = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async function () {
|
|
2885
|
-
let anon_id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "anonymous";
|
|
2886
|
-
$7f95f77417d06249$export$de56f1198d121036("Initializing OptAnon tracking");
|
|
2887
|
-
if (!$e9ab1681652f3fca$var$required_consent_level) return $7f95f77417d06249$export$de56f1198d121036("No consent level set for Depict tracking. Ignoring consent and tracking everything.");
|
|
2888
|
-
const original_get_session_id = (0, $335c248bb07a3509$export$61e7e1f11e96692f);
|
|
2889
|
-
$335c248bb07a3509$export$93ae15b1ae509334(() => $e9ab1681652f3fca$var$has_consent ? original_get_session_id() : anon_id);
|
|
2890
|
-
for await (const consent_obj of $e9ab1681652f3fca$export$7e4427e80d5fc619()) {
|
|
2891
|
-
// Changing this will change the return value of function given to set_depict_id_fn above
|
|
2892
|
-
$e9ab1681652f3fca$var$has_consent = consent_obj[$e9ab1681652f3fca$var$required_consent_level];
|
|
2893
|
-
if (!$e9ab1681652f3fca$var$has_consent) $7f95f77417d06249$export$de56f1198d121036('dsid/session_id will be set to, "'.concat(anon_id, '", until Optanon has consent for "').concat($e9ab1681652f3fca$var$required_consent_level, '"'));else $7f95f77417d06249$export$de56f1198d121036('Optanon obtained consent for "'.concat($e9ab1681652f3fca$var$required_consent_level, '", will use true dsid/session_id'));
|
|
2894
|
-
}
|
|
2895
|
-
});
|
|
2896
|
-
const $99b61a0622560fcf$var$g = typeof globalThis == "object" && globalThis || window;
|
|
2897
|
-
const $99b61a0622560fcf$export$f3354ec2ce95ebd9 = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async (GA_ID, strict) => {
|
|
2898
|
-
var _g$performance, _g$performance$getEnt, _g$performance$getEnt2, _g$performance$getEnt3;
|
|
2899
|
-
if (process.env.GTAG === "false") return;
|
|
2900
|
-
if (!GA_ID) {
|
|
2901
|
-
$7f95f77417d06249$export$c2363754d4758444("Couldn't load gtag, GA_ID not specified", GA_ID);
|
|
2902
|
-
return;
|
|
2903
|
-
}
|
|
2904
|
-
const required_consent_level = process.env.GTAG_LOADING_CONSENT_LEVEL;
|
|
2905
|
-
if (required_consent_level !== undefined) {
|
|
2906
|
-
$7f95f77417d06249$export$de56f1198d121036("GTag loading waiting for consent level ".concat(required_consent_level));
|
|
2907
|
-
const ipns = process.env.CONSENT_FRAMEWORK == "optanon" ? $e9ab1681652f3fca$export$7e4427e80d5fc619() : $2e81c18d82b25372$export$8827362e5e938d26();
|
|
2908
|
-
for await (const consent_status of ipns) {
|
|
2909
|
-
const status_for_level = consent_status[required_consent_level];
|
|
2910
|
-
if (status_for_level) {
|
|
2911
|
-
$7f95f77417d06249$export$de56f1198d121036("got consent for", required_consent_level, "loading gtag");
|
|
2912
|
-
break;
|
|
2913
|
-
}
|
|
2914
|
-
}
|
|
2915
|
-
}
|
|
2916
|
-
// delay loading of script because it's huge and slow according to nordiska galleriet
|
|
2917
|
-
// @ts-ignore
|
|
2918
|
-
const page_hasnt_loaded = ($99b61a0622560fcf$var$g === null || $99b61a0622560fcf$var$g === void 0 ? void 0 : (_g$performance = $99b61a0622560fcf$var$g.performance) === null || _g$performance === void 0 ? void 0 : (_g$performance$getEnt = _g$performance.getEntriesByType) === null || _g$performance$getEnt === void 0 ? void 0 : (_g$performance$getEnt2 = _g$performance$getEnt.call(_g$performance, "navigation")) === null || _g$performance$getEnt2 === void 0 ? void 0 : (_g$performance$getEnt3 = _g$performance$getEnt2.every) === null || _g$performance$getEnt3 === void 0 ? void 0 : _g$performance$getEnt3.call(_g$performance$getEnt2, e => e === null || e === void 0 ? void 0 : e.loadEventEnd)) === false;
|
|
2919
|
-
// Source: comment on https://stackoverflow.com/a/53525488
|
|
2920
|
-
// don't use readyState, source: personal experience and comment on https://stackoverflow.com/a/28093606
|
|
2921
|
-
$7f95f77417d06249$export$de56f1198d121036("Loading gtag after " + (page_hasnt_loaded ? "pageload and " : "") + "3s" + (strict ? "" : ", but setting up queues already"));
|
|
2922
|
-
if (!strict) $99b61a0622560fcf$export$d031e55ccd4c52dc(GA_ID);
|
|
2923
|
-
if (page_hasnt_loaded) {
|
|
2924
|
-
const load_event = await new Promise(r => window.addEventListener("load", r, {
|
|
2925
|
-
once: true
|
|
2926
|
-
}));
|
|
2927
|
-
$7f95f77417d06249$export$de56f1198d121036("page has loaded", load_event);
|
|
2928
|
-
}
|
|
2929
|
-
await new Promise(r => setTimeout(r, 3000));
|
|
2930
|
-
const script = document.createElement("script"),
|
|
2931
|
-
head = document.head;
|
|
2932
|
-
script.async = true;
|
|
2933
|
-
script.src = "https://www.googletagmanager.com/gtag/js?id=" + GA_ID;
|
|
2934
|
-
head.appendChild(script);
|
|
2935
|
-
$7f95f77417d06249$export$de56f1198d121036("Loading gtag now", script);
|
|
2936
|
-
});
|
|
2937
|
-
const $99b61a0622560fcf$export$d031e55ccd4c52dc = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(GA_ID => {
|
|
2938
|
-
if (process.env.GTAG === "false") return;
|
|
2939
|
-
$99b61a0622560fcf$var$g.dataLayer || ($99b61a0622560fcf$var$g.dataLayer = []);
|
|
2940
|
-
function gtag() {
|
|
2941
|
-
$99b61a0622560fcf$var$g.dataLayer.push(arguments);
|
|
2942
|
-
}
|
|
2943
|
-
$99b61a0622560fcf$var$g.gtag = gtag;
|
|
2944
|
-
$99b61a0622560fcf$var$g.gtag("js", new Date());
|
|
2945
|
-
$99b61a0622560fcf$var$g.gtag("config", GA_ID, {
|
|
2946
|
-
"send_page_view": false
|
|
2947
|
-
});
|
|
2948
|
-
$7f95f77417d06249$export$de56f1198d121036("configuring gtag with", GA_ID);
|
|
2949
|
-
});
|
|
2950
|
-
const $99b61a0622560fcf$export$7babcd5d4056b2ca = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async (raw_displays, get_product_id, more) => {
|
|
2951
|
-
const displays = raw_displays; // gtag tracking is "obsolete" and we don't expect any customers using something else than LegacyDisplay to use it
|
|
2952
|
-
if (process.env.GTAG === "false") return;
|
|
2953
|
-
if (process.env.GTAG_VIEW === "false") return;
|
|
2954
|
-
if (process.env.GTAG_EVENT_CONSENT_LEVEL !== undefined && !(await $99b61a0622560fcf$var$can_send_gtag_events(displays, get_product_id, more))) return;
|
|
2955
|
-
if (typeof $99b61a0622560fcf$var$g.gtag == "function") {
|
|
2956
|
-
const make_item = (display, index, id) => ({
|
|
2957
|
-
id: id,
|
|
2958
|
-
"list_name": "depict",
|
|
2959
|
-
"list_position": (display === null || display === void 0 ? void 0 : display.index) || index + 1,
|
|
2960
|
-
...(typeof more === "function" ? more(display) : more)
|
|
2961
|
-
});
|
|
2962
|
-
const gtag_items = [
|
|
2963
|
-
// spread works around safari 11 bug where Array returned by Promise.all is not an instance of the global Array
|
|
2964
|
-
// https://sentry.io/organizations/depictai-0o/issues/2794688692/?project=5476183
|
|
2965
|
-
...(await Promise.all(displays.map(async (display, index) => display.ga_product_ids ? display.ga_product_ids.map(id => make_item(display, index, id)) : make_item(display, index, display.ga_product_id || display.product_id || (await get_product_id(display.page_url)) || (await get_product_id(display)) // the last statement is this row allows for special product_id getter functions that not only use the page_url. They need to check the typeof their argument tho and ignore the first calls
|
|
2966
|
-
))))].flat();
|
|
2967
|
-
const max_products_per_request = 100;
|
|
2968
|
-
for (let i = 0; i < gtag_items.length; i += max_products_per_request) {
|
|
2969
|
-
const gtag_args = ["event", "view_item_list", {
|
|
2970
|
-
"items": gtag_items.slice(i, i + max_products_per_request)
|
|
2971
|
-
}];
|
|
2972
|
-
$7f95f77417d06249$export$de56f1198d121036("Sending product view to gtag", gtag_args);
|
|
2973
|
-
$99b61a0622560fcf$var$g.gtag(...gtag_args);
|
|
2974
|
-
}
|
|
2975
|
-
} else $7f95f77417d06249$export$c2363754d4758444("not sending gtag tracking as there is no gtag");
|
|
2976
|
-
});
|
|
2977
|
-
const $99b61a0622560fcf$export$f522672c9379e339 = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async (product_id, index, more) => {
|
|
2978
|
-
if (process.env.GTAG === "false") return;
|
|
2979
|
-
if (process.env.GTAG_EVENT_CONSENT_LEVEL !== undefined && !(await $99b61a0622560fcf$var$can_send_gtag_events(product_id, index, more))) return;
|
|
2980
|
-
if (typeof $99b61a0622560fcf$var$g.gtag == "function") {
|
|
2981
|
-
const gtag_args = ["event", "select_content", {
|
|
2982
|
-
"content_type": "product",
|
|
2983
|
-
"items": [{
|
|
2984
|
-
"id": product_id,
|
|
2985
|
-
"list_name": "depict",
|
|
2986
|
-
"list_position": index + 1,
|
|
2987
|
-
...more
|
|
2988
|
-
}]
|
|
2989
|
-
}];
|
|
2990
|
-
$7f95f77417d06249$export$de56f1198d121036("calling gtag with arguments", gtag_args);
|
|
2991
|
-
return $99b61a0622560fcf$var$g.gtag(...gtag_args);
|
|
2992
|
-
} else $7f95f77417d06249$export$c2363754d4758444("not sending gtag tracking as there is no gtag");
|
|
2993
|
-
});
|
|
2994
|
-
const $99b61a0622560fcf$export$f75172d2e289cd02 = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(action => {
|
|
2995
|
-
if (process.env.GA === "false") return;
|
|
2996
|
-
if (typeof $99b61a0622560fcf$var$g.ga != "function") {
|
|
2997
|
-
$7f95f77417d06249$export$c2363754d4758444("Not sending to ga as there is no ga");
|
|
2998
|
-
return;
|
|
2999
|
-
}
|
|
3000
|
-
$7f95f77417d06249$export$de56f1198d121036("sending", action, "to GA");
|
|
3001
|
-
return $99b61a0622560fcf$var$g.ga("depict.send", {
|
|
3002
|
-
hitType: "event",
|
|
3003
|
-
eventCategory: "Depict",
|
|
3004
|
-
eventAction: action,
|
|
3005
|
-
eventLabel: "rec-bar-tracking",
|
|
3006
|
-
nonInteraction: 1
|
|
3007
|
-
});
|
|
3008
|
-
});
|
|
3009
|
-
const $99b61a0622560fcf$export$ac7296527cb52311 = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(GAID => {
|
|
3010
|
-
if (process.env.GA === "false") return;
|
|
3011
|
-
if (!GAID) {
|
|
3012
|
-
$7f95f77417d06249$export$c2363754d4758444(new Error("No GAID specified"));
|
|
3013
|
-
return;
|
|
3014
|
-
}
|
|
3015
|
-
if (typeof $99b61a0622560fcf$var$g.ga != "function") {
|
|
3016
|
-
$7f95f77417d06249$export$de56f1198d121036("Creating GA queue");
|
|
3017
|
-
$f812c921818adbe0$export$674d8cd8b6868154();
|
|
3018
|
-
}
|
|
3019
|
-
$7f95f77417d06249$export$de56f1198d121036("Creating ga with GA-ID", GAID);
|
|
3020
|
-
$99b61a0622560fcf$var$g.ga("create", GAID, "auto", "depict");
|
|
3021
|
-
$99b61a0622560fcf$export$f3354ec2ce95ebd9(GAID, false);
|
|
3022
|
-
});
|
|
3023
|
-
const $99b61a0622560fcf$export$127751e82111fcf = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(() => $99b61a0622560fcf$export$f75172d2e289cd02("rec_bar_click"));
|
|
3024
|
-
const $99b61a0622560fcf$export$bf205937e5e012cb = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(() => $99b61a0622560fcf$export$f75172d2e289cd02("add_to_cart_after_rec_bar_click"));
|
|
3025
|
-
async function $99b61a0622560fcf$var$can_send_gtag_events() {
|
|
3026
|
-
const required_consent_level = process.env.GTAG_LOADING_CONSENT_LEVEL;
|
|
3027
|
-
if (required_consent_level !== undefined) return true; // just in case
|
|
3028
|
-
const ipns = process.env.CONSENT_FRAMEWORK == "optanon" ? $e9ab1681652f3fca$export$7e4427e80d5fc619() : $2e81c18d82b25372$export$8827362e5e938d26();
|
|
3029
|
-
for (var _len = arguments.length, stuff_to_log = new Array(_len), _key = 0; _key < _len; _key++) stuff_to_log[_key] = arguments[_key];
|
|
3030
|
-
for await (const consent_obj of ipns) {
|
|
3031
|
-
const can_send = consent_obj[required_consent_level];
|
|
3032
|
-
if (!can_send) $7f95f77417d06249$export$de56f1198d121036("Got no consent for", required_consent_level, "not sending gtag event for", ...stuff_to_log);
|
|
3033
|
-
return can_send;
|
|
3034
|
-
}
|
|
3035
|
-
}
|
|
3036
|
-
let $e45474c7d6e21cfa$var$existing_style_tag;
|
|
3037
|
-
let $e45474c7d6e21cfa$var$reactions_in_last_s = 0;
|
|
3038
|
-
const $e45474c7d6e21cfa$export$59ba1eb2c083f0cd = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async css => {
|
|
3039
|
-
const style_tag = await ($e45474c7d6e21cfa$var$existing_style_tag || ($e45474c7d6e21cfa$var$existing_style_tag = (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element("head").then(head => {
|
|
3040
|
-
const tag = document.createElement("style");
|
|
3041
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onremoved(
|
|
3042
|
-
// reinsertion for next.js's "portable" <head>
|
|
3043
|
-
tag, eoe => {
|
|
3044
|
-
if (document.head.contains(tag))
|
|
3045
|
-
// just make sure to not freak out if it's already been added again
|
|
3046
|
-
return;
|
|
3047
|
-
if ($e45474c7d6e21cfa$var$reactions_in_last_s >= 10) {
|
|
3048
|
-
$3b52ccc10510b32a$export$f18d5b0af29128b7(new Error("Someone removed our styling but insists on it (10 removals in previous second). Giving up \uD83D\uDE2B"), "error");
|
|
3049
|
-
return;
|
|
3050
|
-
}
|
|
3051
|
-
$7f95f77417d06249$export$de56f1198d121036("Someone removed our styling \uD83D\uDE24, reinserting", eoe);
|
|
3052
|
-
$e45474c7d6e21cfa$var$reactions_in_last_s++;
|
|
3053
|
-
setTimeout(() => $e45474c7d6e21cfa$var$reactions_in_last_s--, 1000);
|
|
3054
|
-
document.head.append(tag); // we're sure that head exists now since we inserted it there previously
|
|
3055
|
-
});
|
|
3056
|
-
|
|
3057
|
-
$7f95f77417d06249$export$de56f1198d121036("inserting", tag, "into", head);
|
|
3058
|
-
return head.appendChild(tag);
|
|
3059
|
-
})));
|
|
3060
|
-
style_tag.append(css);
|
|
3061
|
-
});
|
|
3062
|
-
const $e45474c7d6e21cfa$export$a96c18473f2af463 = (tenant, selector, validator) => {
|
|
3063
|
-
return (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(selector, _ref => {
|
|
3064
|
-
let {
|
|
3065
|
-
element: element
|
|
3066
|
-
} = _ref;
|
|
3067
|
-
return $1ea91dfed6983398$export$2c34560c3749dc63(element, tenant.get_product_id, (p_id, r_id, was_unmatching, event) => {
|
|
3068
|
-
if (typeof validator === "function" && !validator(event)) return;
|
|
3069
|
-
if (!was_unmatching) $99b61a0622560fcf$export$bf205937e5e012cb();
|
|
3070
|
-
$335c248bb07a3509$export$9028351cb994757e({
|
|
3071
|
-
...tenant,
|
|
3072
|
-
product_id: p_id,
|
|
3073
|
-
...(was_unmatching ? {
|
|
3074
|
-
attribution_id: "recommendation"
|
|
3075
|
-
} : {
|
|
3076
|
-
recommendation_id: r_id
|
|
3077
|
-
})
|
|
3078
|
-
});
|
|
3079
|
-
}, true);
|
|
3080
|
-
});
|
|
3081
|
-
};
|
|
3082
|
-
const $e45474c7d6e21cfa$export$a4f97b27a0592e6c = url => {
|
|
3083
|
-
var _pathname$split$filte;
|
|
3084
|
-
return ((_pathname$split$filte = (url ? new URL(url, window.location.origin) : window.location).pathname.split("/").filter(a => a).pop()) === null || _pathname$split$filte === void 0 ? void 0 : _pathname$split$filte.replace(/\.html?$/i, "")) || "";
|
|
3085
|
-
};
|
|
3086
|
-
const $e45474c7d6e21cfa$export$692b606677218a16 = callback => {
|
|
3087
|
-
if (document.depictwashere) {
|
|
3088
|
-
if (process.env.BUILD_TARGET === "dev") {
|
|
3089
|
-
$7f95f77417d06249$export$de56f1198d121036("HMR tried to rerun us, reloading page");
|
|
3090
|
-
/* eslint-disable no-self-assign */
|
|
3091
|
-
location.href = location.href;
|
|
3092
|
-
}
|
|
3093
|
-
$7f95f77417d06249$export$de56f1198d121036("Script has already ran", document.currentScript, "is exiting");
|
|
3094
|
-
return;
|
|
3095
|
-
}
|
|
3096
|
-
if (process.env.BUILD_TARGET === "dev") /* eslint-disable no-console */console.clear = new Proxy(console.clear, {
|
|
3097
|
-
apply(target, this_arg, arg_list) {
|
|
3098
|
-
var _Error$stack;
|
|
3099
|
-
if ((_Error$stack = new Error().stack) !== null && _Error$stack !== void 0 && _Error$stack.split("\n").filter(Boolean).some(s => s.includes("http://localhost:1234/depict-ai.js"))) {
|
|
3100
|
-
/* eslint-disable no-console */console.log("CSS change detected through hack, reloading");
|
|
3101
|
-
location.reload();
|
|
3102
|
-
}
|
|
3103
|
-
return target.apply(this_arg, arg_list);
|
|
3104
|
-
}
|
|
3105
|
-
});
|
|
3106
|
-
document.depictwashere = true;
|
|
3107
|
-
callback().catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
3108
|
-
};
|
|
3109
|
-
function $e45474c7d6e21cfa$export$328e81c44cddf3c0(callback, get_market, supported_markets, unsupported_markets, preferred_demo_market) {
|
|
3110
|
-
$e45474c7d6e21cfa$export$692b606677218a16(async () => {
|
|
3111
|
-
// Handle override for debug scripts (could be used on demo pages too)
|
|
3112
|
-
if (process.env.DEBUG === "true") {
|
|
3113
|
-
let localstorage_override;
|
|
3114
|
-
const query_param_override = new URLSearchParams(location.search).get("depict-override-market");
|
|
3115
|
-
if (query_param_override !== null) {
|
|
3116
|
-
$7f95f77417d06249$export$de56f1198d121036("Found ?depict-override-market=".concat(query_param_override, ". Using that as the market"));
|
|
3117
|
-
get_market = () => query_param_override;
|
|
3118
|
-
localStorage.setItem("depict-override-market", query_param_override);
|
|
3119
|
-
} else if ((localstorage_override = localStorage.getItem("depict-override-market")) !== null) {
|
|
3120
|
-
$7f95f77417d06249$export$de56f1198d121036('Found depict-override-market="'.concat(localstorage_override, '" in localStorage. Using that as the market'));
|
|
3121
|
-
get_market = () => localstorage_override;
|
|
3122
|
-
}
|
|
3123
|
-
}
|
|
3124
|
-
const market = await get_market();
|
|
3125
|
-
if (supported_markets.includes(market)) {
|
|
3126
|
-
$7f95f77417d06249$export$de56f1198d121036("Initializing with market: ".concat(market));
|
|
3127
|
-
return callback(market).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
3128
|
-
} else if (unsupported_markets.includes(market)) {
|
|
3129
|
-
$7f95f77417d06249$export$de56f1198d121036("Unsupported market: ".concat(market, ". Exiting..."));
|
|
3130
|
-
return;
|
|
3131
|
-
} else if (process.env.DEBUG === "true" && location.host.endsWith(".demo.depict.ai") && preferred_demo_market) {
|
|
3132
|
-
$7f95f77417d06249$export$de56f1198d121036("On demosite with default market override. Setting market to ".concat(preferred_demo_market));
|
|
3133
|
-
return callback(preferred_demo_market).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
3134
|
-
} else {
|
|
3135
|
-
$46b94b232dc792af$export$8048b892d651b310(new Error('Unknown market: "'.concat(market, '". Exiting...')));
|
|
3136
|
-
return;
|
|
3137
|
-
}
|
|
3138
|
-
});
|
|
3139
|
-
}
|
|
3140
|
-
class $db6c2abf3fef4d7d$export$8d42ce4827f43582 {
|
|
3141
|
-
constructor(options) {
|
|
3142
|
-
var _options$GA_ID, _options$pageview_tra;
|
|
3143
|
-
this.dataset = {
|
|
3144
|
-
...((options.current_script_override || document.currentScript || {}).dataset || {})
|
|
3145
|
-
};
|
|
3146
|
-
this.modify = this.dataset.modify === "true";
|
|
3147
|
-
this.is_debug = (0, $9e9538f4aff6f83c$export$55fe61489d2c7417);
|
|
3148
|
-
this.dlog = (0, $7f95f77417d06249$export$de56f1198d121036);
|
|
3149
|
-
this.TENANT = options.TENANT || process.env.TENANT || "sandbox";
|
|
3150
|
-
this.MARKET = options.MARKET;
|
|
3151
|
-
this.Sentry = (0, $902c0e005afb7319$export$af2e17a20c2ea3c5);
|
|
3152
|
-
this.GA_ID = (_options$GA_ID = options.GA_ID) !== null && _options$GA_ID !== void 0 ? _options$GA_ID : "";
|
|
3153
|
-
this.TYPE = options.TYPE || "normal";
|
|
3154
|
-
this.catchify = (0, $3b52ccc10510b32a$export$b3bbfd758f11cfa9);
|
|
3155
|
-
this.err = (0, $46b94b232dc792af$export$8048b892d651b310);
|
|
3156
|
-
if (this.GA_ID) $99b61a0622560fcf$export$ac7296527cb52311(this.GA_ID);
|
|
3157
|
-
// https://gitlab.com/depict-ai/depict.ai/-/merge_requests/2318#note_927887712
|
|
3158
|
-
this.get_product_id = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(function () {
|
|
3159
|
-
const id = options.get_product_id(...arguments);
|
|
3160
|
-
if (id instanceof Promise) return id.then(id => id || "");
|
|
3161
|
-
return id || "";
|
|
3162
|
-
});
|
|
3163
|
-
this.product_id = this.get_product_id; // template tool compatible alias
|
|
3164
|
-
this.tenant = this.TENANT;
|
|
3165
|
-
this.market = this.MARKET;
|
|
3166
|
-
this.gaid = this.GA_ID; // template tool compatible alias
|
|
3167
|
-
this.type = this.TYPE;
|
|
3168
|
-
this.catchify = (0, $3b52ccc10510b32a$export$b3bbfd758f11cfa9);
|
|
3169
|
-
this.err = (0, $46b94b232dc792af$export$8048b892d651b310);
|
|
3170
|
-
if (localStorage.getItem("highlight-depict") === "true") $e45474c7d6e21cfa$export$59ba1eb2c083f0cd(".depict { background: #f00a !important; }");
|
|
3171
|
-
if ((_options$pageview_tra = options.pageview_tracking) !== null && _options$pageview_tra !== void 0 ? _options$pageview_tra : true) (async () => {
|
|
3172
|
-
$c15d2edce69e632a$export$f7cb1bd47199ec38({
|
|
3173
|
-
market: this.market,
|
|
3174
|
-
tenant: this.tenant,
|
|
3175
|
-
get_product_id: this.get_product_id
|
|
3176
|
-
});
|
|
3177
|
-
})();
|
|
3178
|
-
}
|
|
3179
|
-
} /**
|
|
3180
|
-
* This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
|
|
3181
|
-
*/ // albania
|
|
3182
|
-
|
|
3183
|
-
const $7c971cc277292c10$var$default_get_rec_id = elem => {
|
|
3184
|
-
var _elem$dataset, _elem$dataset2;
|
|
3185
|
-
return (elem === null || elem === void 0 ? void 0 : (_elem$dataset = elem.dataset) === null || _elem$dataset === void 0 ? void 0 : _elem$dataset.depict_recommendation_id) || (elem === null || elem === void 0 ? void 0 : (_elem$dataset2 = elem.dataset) === null || _elem$dataset2 === void 0 ? void 0 : _elem$dataset2.recommendationId);
|
|
3186
|
-
};
|
|
3187
|
-
const $7c971cc277292c10$var$default_get_prod_id = elem => {
|
|
3188
|
-
var _elem$dataset3, _elem$dataset4;
|
|
3189
|
-
return (elem === null || elem === void 0 ? void 0 : (_elem$dataset3 = elem.dataset) === null || _elem$dataset3 === void 0 ? void 0 : _elem$dataset3.depict_product_id) || (elem === null || elem === void 0 ? void 0 : (_elem$dataset4 = elem.dataset) === null || _elem$dataset4 === void 0 ? void 0 : _elem$dataset4.productId);
|
|
3190
|
-
};
|
|
3191
|
-
const $7c971cc277292c10$var$default_get_ga_prod_id = elem => {
|
|
3192
|
-
var _elem$dataset5;
|
|
3193
|
-
return elem === null || elem === void 0 ? void 0 : (_elem$dataset5 = elem.dataset) === null || _elem$dataset5 === void 0 ? void 0 : _elem$dataset5.ga_ids;
|
|
3194
|
-
};
|
|
3195
|
-
const $7c971cc277292c10$var$get_index_in_children_of_el = el => {
|
|
3196
|
-
var _el$parentElement;
|
|
3197
|
-
return [...((el === null || el === void 0 ? void 0 : (_el$parentElement = el.parentElement) === null || _el$parentElement === void 0 ? void 0 : _el$parentElement.children) || [])].indexOf(el);
|
|
3198
|
-
};
|
|
3199
|
-
const $7c971cc277292c10$export$29a6094e0bd8bc5f = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async (options, gtag_options) => {
|
|
3200
|
-
var _options$t;
|
|
3201
|
-
const {
|
|
3202
|
-
product_selector: product_selector,
|
|
3203
|
-
a2c_selector: a2c_selector,
|
|
3204
|
-
rec_a2c_selector: rec_a2c_selector,
|
|
3205
|
-
rec_a2c_unbubbled: rec_a2c_unbubbled,
|
|
3206
|
-
get_product_id = (_options$t = options.t) === null || _options$t === void 0 ? void 0 : _options$t.get_product_id,
|
|
3207
|
-
get_rec_id = $7c971cc277292c10$var$default_get_rec_id,
|
|
3208
|
-
get_prod_id = $7c971cc277292c10$var$default_get_prod_id,
|
|
3209
|
-
get_ga_prod_id = $7c971cc277292c10$var$default_get_ga_prod_id,
|
|
3210
|
-
get_display: get_display,
|
|
3211
|
-
impression_tracking: impression_tracking,
|
|
3212
|
-
a2c_elements: a2c_elements,
|
|
3213
|
-
product_elements: product_elements,
|
|
3214
|
-
t: t,
|
|
3215
|
-
click_location_prefix = elem => {
|
|
3216
|
-
var _elem$parentElement, _elem$parentElement$d;
|
|
3217
|
-
return (elem === null || elem === void 0 ? void 0 : (_elem$parentElement = elem.parentElement) === null || _elem$parentElement === void 0 ? void 0 : (_elem$parentElement$d = _elem$parentElement.dataset) === null || _elem$parentElement$d === void 0 ? void 0 : _elem$parentElement$d.type) + "_";
|
|
3218
|
-
}
|
|
3219
|
-
} = options;
|
|
3220
|
-
const get_display_data = async elem => {
|
|
3221
|
-
var _elem$querySelector;
|
|
3222
|
-
const data = {};
|
|
3223
|
-
if (get_prod_id) data.product_id = (await get_prod_id(elem)) || (get_product_id ? await get_product_id(((_elem$querySelector = elem.querySelector("a")) === null || _elem$querySelector === void 0 ? void 0 : _elem$querySelector.href) || (elem === null || elem === void 0 ? void 0 : elem.href)) : undefined);
|
|
3224
|
-
if (get_ga_prod_id) data.ga_product_id = await get_ga_prod_id(elem);
|
|
3225
|
-
if (get_rec_id) data.recommendation_id = get_rec_id(elem);
|
|
3226
|
-
if (get_display) Object.assign(data, get_display(elem));
|
|
3227
|
-
return data;
|
|
3228
|
-
};
|
|
3229
|
-
const impression_tracked_els = new WeakSet();
|
|
3230
|
-
const view_tracked_els = new WeakSet();
|
|
3231
|
-
const a2c_tracked_els = new WeakSet();
|
|
3232
|
-
const click_tracked_els = new WeakSet();
|
|
3233
|
-
const gtag_view_product_ids = {};
|
|
3234
|
-
// Page view
|
|
3235
|
-
if (t instanceof (0, $db6c2abf3fef4d7d$export$8d42ce4827f43582)) (async () => {
|
|
3236
|
-
$c15d2edce69e632a$export$eee4c4d924348b05({
|
|
3237
|
-
tenant: t.tenant,
|
|
3238
|
-
market: t.market,
|
|
3239
|
-
product_id: await t.get_product_id()
|
|
3240
|
-
});
|
|
3241
|
-
})();
|
|
3242
|
-
// Product card
|
|
3243
|
-
const add_tracking_to_product_card = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(async _ref => {
|
|
3244
|
-
var _Object$keys;
|
|
3245
|
-
let {
|
|
3246
|
-
element: elem
|
|
3247
|
-
} = _ref;
|
|
3248
|
-
const index = $7c971cc277292c10$var$get_index_in_children_of_el(elem);
|
|
3249
|
-
const data = await get_display_data(elem);
|
|
3250
|
-
const prefix = typeof click_location_prefix === "function" && click_location_prefix(elem) || "depict_";
|
|
3251
|
-
const gtag_list_name = "depict_" + (prefix[prefix.length - 1] == "_" ? prefix.substr(0, prefix.length - 1) : prefix);
|
|
3252
|
-
// Impression tracking
|
|
3253
|
-
if (impression_tracking && !impression_tracked_els.has(elem)) {
|
|
3254
|
-
impression_tracked_els.add(elem);
|
|
3255
|
-
$89969f18db4020d7$export$37125ccc5dd98050({
|
|
3256
|
-
element: elem,
|
|
3257
|
-
data: {
|
|
3258
|
-
recommendation_id: data.recommendation_id,
|
|
3259
|
-
product_id: data.product_id,
|
|
3260
|
-
tenant: t.tenant,
|
|
3261
|
-
recommendation_type: prefix.slice(-1) === "_" ? prefix.slice(0, -1) : prefix,
|
|
3262
|
-
entity_price: data.entity_price,
|
|
3263
|
-
market: t.market
|
|
3264
|
-
},
|
|
3265
|
-
wait_for_dom_insertion: false
|
|
3266
|
-
});
|
|
3267
|
-
}
|
|
3268
|
-
// Gtag view tracking
|
|
3269
|
-
if (data.product_id && options.attempt_gtag_view_tracking && !view_tracked_els.has(elem)) {
|
|
3270
|
-
view_tracked_els.add(elem);
|
|
3271
|
-
const gtag_view_product_ids_for_product = gtag_view_product_ids[gtag_list_name] || (gtag_view_product_ids[gtag_list_name] = []);
|
|
3272
|
-
gtag_view_product_ids_for_product.push({
|
|
3273
|
-
product_id: data.ga_product_id || data.product_id,
|
|
3274
|
-
index: index
|
|
3275
|
-
});
|
|
3276
|
-
if (data.ga_product_ids) gtag_view_product_ids_for_product.push(...data.ga_product_ids.map(product_id => ({
|
|
3277
|
-
product_id: product_id,
|
|
3278
|
-
index: index
|
|
3279
|
-
})));
|
|
3280
|
-
try {
|
|
3281
|
-
var _elem$dataset6;
|
|
3282
|
-
const ga_ids = elem === null || elem === void 0 ? void 0 : (_elem$dataset6 = elem.dataset) === null || _elem$dataset6 === void 0 ? void 0 : _elem$dataset6.ga_ids;
|
|
3283
|
-
if (ga_ids) gtag_view_product_ids_for_product.push(...ga_ids.split(",").map(id => ({
|
|
3284
|
-
product_id: id,
|
|
3285
|
-
index: index
|
|
3286
|
-
})));
|
|
3287
|
-
} catch (e) {
|
|
3288
|
-
$7f95f77417d06249$export$c2363754d4758444("Something went wrong on a product with multiple ga_ids", e);
|
|
3289
|
-
}
|
|
3290
|
-
}
|
|
3291
|
-
if (typeof BroadcastChannel == "function") {
|
|
3292
|
-
// right click and mouse wheel click tracking
|
|
3293
|
-
const handler = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => $04bba294678834bc$export$8f66c4c7fb96eda2(e, data.product_id));
|
|
3294
|
-
elem.addEventListener("contextmenu", handler);
|
|
3295
|
-
elem.addEventListener("auxclick", e => e.button === 1 && handler(e)); // actual wheel click - some mouses / OS:es also dispatch auxclick on rightclick
|
|
3296
|
-
}
|
|
3297
|
-
|
|
3298
|
-
click_tracking: {
|
|
3299
|
-
if (click_tracked_els.has(elem)) break click_tracking;
|
|
3300
|
-
click_tracked_els.add(elem);
|
|
3301
|
-
elem.addEventListener("click", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(() => {
|
|
3302
|
-
const product_id = data.product_id || "DNT";
|
|
3303
|
-
const recommendation_id = data.recommendation_id || "not_depict";
|
|
3304
|
-
localStorage.setItem("depict_attribution_".concat(product_id), recommendation_id);
|
|
3305
|
-
const index = $7c971cc277292c10$var$get_index_in_children_of_el(elem);
|
|
3306
|
-
const click_location = prefix + (index + 1);
|
|
3307
|
-
$99b61a0622560fcf$export$127751e82111fcf();
|
|
3308
|
-
$335c248bb07a3509$export$15f8a0cd5a8c0ebb({
|
|
3309
|
-
...(options.t || {}),
|
|
3310
|
-
...options,
|
|
3311
|
-
...data,
|
|
3312
|
-
...(data.recommendation_id ? {} : {
|
|
3313
|
-
attribution_id: "recommendation"
|
|
3314
|
-
}),
|
|
3315
|
-
click_location: click_location
|
|
3316
|
-
});
|
|
3317
|
-
if (!options.no_gtag) {
|
|
3318
|
-
const gtag_options_with_click_location = {
|
|
3319
|
-
list_name: gtag_list_name,
|
|
3320
|
-
...gtag_options
|
|
3321
|
-
};
|
|
3322
|
-
$99b61a0622560fcf$export$f522672c9379e339(data.product_id, index, gtag_options_with_click_location);
|
|
3323
|
-
try {
|
|
3324
|
-
const to_iterate = [];
|
|
3325
|
-
if (data.ga_product_id) {
|
|
3326
|
-
var _data$ga_product_id$t, _data$ga_product_id$t2, _data$ga_product_id;
|
|
3327
|
-
to_iterate.push(...((_data$ga_product_id$t = (_data$ga_product_id$t2 = (_data$ga_product_id = data.ga_product_id).toString) === null || _data$ga_product_id$t2 === void 0 ? void 0 : _data$ga_product_id$t2.call(_data$ga_product_id).split(",")) !== null && _data$ga_product_id$t !== void 0 ? _data$ga_product_id$t : []));
|
|
3328
|
-
}
|
|
3329
|
-
to_iterate.push(...(data.ga_product_ids || []));
|
|
3330
|
-
to_iterate.forEach(id => $99b61a0622560fcf$export$f522672c9379e339(id, index, gtag_options_with_click_location));
|
|
3331
|
-
} catch (e) {
|
|
3332
|
-
$7f95f77417d06249$export$c2363754d4758444("Something went wrong when sending gtag click tracking on a product with multiple ga_ids");
|
|
3333
|
-
$3b52ccc10510b32a$export$f18d5b0af29128b7(e, "error");
|
|
3334
|
-
}
|
|
3335
|
-
}
|
|
3336
|
-
}), {
|
|
3337
|
-
once: true
|
|
3338
|
-
});
|
|
3339
|
-
}
|
|
3340
|
-
// Product card A2C button tracking
|
|
3341
|
-
if (rec_a2c_selector && !a2c_tracked_els.has(elem)) {
|
|
3342
|
-
const track_rec_a2c = async element => {
|
|
3343
|
-
const rec_a2c_button = element.querySelector(rec_a2c_selector);
|
|
3344
|
-
if (!rec_a2c_button) return;
|
|
3345
|
-
const data = await get_display_data(element);
|
|
3346
|
-
rec_a2c_button.addEventListener("click", () => {
|
|
3347
|
-
if (rec_a2c_unbubbled) {
|
|
3348
|
-
// If their script cancels the event before it reaches the rec card,
|
|
3349
|
-
// we will only attribute an a2c but not a click. This is inconsistent with what we usually do.
|
|
3350
|
-
// Create a fake click event on the main rec card,
|
|
3351
|
-
// so our click_tracking above can send tracking for a click as well.
|
|
3352
|
-
const click = new MouseEvent("click", {
|
|
3353
|
-
view: window,
|
|
3354
|
-
bubbles: true,
|
|
3355
|
-
cancelable: true,
|
|
3356
|
-
metaKey: true
|
|
3357
|
-
});
|
|
3358
|
-
element.addEventListener("click", e => (e.preventDefault(), false), {
|
|
3359
|
-
once: true
|
|
3360
|
-
});
|
|
3361
|
-
element.dispatchEvent(click);
|
|
3362
|
-
}
|
|
3363
|
-
$99b61a0622560fcf$export$bf205937e5e012cb();
|
|
3364
|
-
$335c248bb07a3509$export$9028351cb994757e({
|
|
3365
|
-
...(options.t || {}),
|
|
3366
|
-
...options,
|
|
3367
|
-
...data
|
|
3368
|
-
});
|
|
3369
|
-
});
|
|
3370
|
-
a2c_tracked_els.add(elem);
|
|
3371
|
-
};
|
|
3372
|
-
track_rec_a2c(elem);
|
|
3373
|
-
}
|
|
3374
|
-
if (options.shade) $7c971cc277292c10$export$6ebd242c09192cec(elem);
|
|
3375
|
-
if (options.attempt_gtag_view_tracking && (_Object$keys = Object.keys(gtag_view_product_ids)) !== null && _Object$keys !== void 0 && _Object$keys.length)
|
|
3376
|
-
// setTimeout to batch the requests / put it all into one gtag view event
|
|
3377
|
-
setTimeout($3b52ccc10510b32a$export$b3bbfd758f11cfa9(() => {
|
|
3378
|
-
for (const key in gtag_view_product_ids) {
|
|
3379
|
-
const product_ids = gtag_view_product_ids[key];
|
|
3380
|
-
if (product_ids !== null && product_ids !== void 0 && product_ids.length) {
|
|
3381
|
-
$99b61a0622560fcf$export$7babcd5d4056b2ca(product_ids, () => "", {
|
|
3382
|
-
list_name: key,
|
|
3383
|
-
...gtag_options
|
|
3384
|
-
});
|
|
3385
|
-
delete gtag_view_product_ids[key];
|
|
3386
|
-
}
|
|
3387
|
-
}
|
|
3388
|
-
}));
|
|
3389
|
-
});
|
|
3390
|
-
if (typeof product_selector == "string") (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(product_selector, add_tracking_to_product_card);else if (product_elements && typeof (product_elements === null || product_elements === void 0 ? void 0 : product_elements[Symbol.iterator]) == "function") for (const element of product_elements) add_tracking_to_product_card({
|
|
3391
|
-
element: element
|
|
3392
|
-
});else $7f95f77417d06249$export$c2363754d4758444(new Error("AIO can't find elements, try adding a selector or els")); // don't throw so that a2c tracking keeps working
|
|
3393
|
-
// Page A2C button tracking
|
|
3394
|
-
const a2c_handler = _ref2 => {
|
|
3395
|
-
let {
|
|
3396
|
-
element: element
|
|
3397
|
-
} = _ref2;
|
|
3398
|
-
$1ea91dfed6983398$export$2c34560c3749dc63(element, get_product_id, (product_id, recommendation_id, was_unmatching) => {
|
|
3399
|
-
if (!was_unmatching) $99b61a0622560fcf$export$bf205937e5e012cb();
|
|
3400
|
-
$335c248bb07a3509$export$9028351cb994757e({
|
|
3401
|
-
...(options.t || {}),
|
|
3402
|
-
...options,
|
|
3403
|
-
product_id: product_id,
|
|
3404
|
-
...(recommendation_id == "not_depict" || was_unmatching ? {
|
|
3405
|
-
attribution_id: "recommendation"
|
|
3406
|
-
} : {
|
|
3407
|
-
recommendation_id: recommendation_id
|
|
3408
|
-
})
|
|
3409
|
-
});
|
|
3410
|
-
}, options.always_track_a2c);
|
|
3411
|
-
if (options.shade) $7c971cc277292c10$export$6ebd242c09192cec(element);
|
|
3412
|
-
};
|
|
3413
|
-
if (typeof a2c_selector == "string") (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(a2c_selector, a2c_handler);else if (a2c_elements && typeof (a2c_elements === null || a2c_elements === void 0 ? void 0 : a2c_elements[Symbol.iterator]) == "function") for (const element of a2c_elements) a2c_handler({
|
|
3414
|
-
element: element
|
|
3415
|
-
});else $7f95f77417d06249$export$c2363754d4758444(new Error("Can't find a2c button, try adding a selector or els"));
|
|
3416
|
-
return {
|
|
3417
|
-
add_a2c_element: element => a2c_handler({
|
|
3418
|
-
element: element
|
|
3419
|
-
}),
|
|
3420
|
-
add_product_element: element => add_tracking_to_product_card({
|
|
3421
|
-
element: element
|
|
3422
|
-
})
|
|
3423
|
-
};
|
|
3424
|
-
});
|
|
3425
|
-
const $7c971cc277292c10$export$6ebd242c09192cec = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(element => {
|
|
3426
|
-
element.style.boxShadow = "rgba(255,0,0,0.5) 10px 10px 30px 40px";
|
|
3427
|
-
element.style.background = "rgba(255,0,0,0.5)";
|
|
3428
|
-
element.style.color = "white";
|
|
3429
|
-
});
|
|
3430
|
-
|
|
3431
|
-
// not ideal but can help when debugging via sentry
|
|
3432
|
-
/**
|
|
3433
|
-
* A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
|
|
3434
|
-
* @param anything Something to try to serialize - this function is crappy and your mileage may vary
|
|
3435
|
-
* @param depth How deep to go when recursing
|
|
3436
|
-
* @return An object that is somehow closer to text (better serializable by sentry) or text
|
|
3437
|
-
*/
|
|
3438
|
-
function $a1dd43178e1da976$export$39d526a1194b6499(anything, depth) {
|
|
3439
|
-
var _depth;
|
|
3440
|
-
(_depth = depth) !== null && _depth !== void 0 ? _depth : depth = 0;
|
|
3441
|
-
depth++;
|
|
3442
|
-
if (depth > 30) return anything;
|
|
3443
|
-
const output = {};
|
|
3444
|
-
for (const key in anything) {
|
|
3445
|
-
const value = anything[key];
|
|
3446
|
-
let serialized_value;
|
|
3447
|
-
if (value instanceof Element) serialized_value = value.cloneNode(false).outerHTML;else if (value instanceof Headers) serialized_value = Object.fromEntries(value.entries());else if (typeof value == "object" && value != null && (typeof value[Symbol.iterator] === "function" || value instanceof Response)) serialized_value = $a1dd43178e1da976$export$39d526a1194b6499(value, depth);else {
|
|
3448
|
-
var _value$toString;
|
|
3449
|
-
serialized_value = value === null || value === void 0 ? void 0 : (_value$toString = value.toString) === null || _value$toString === void 0 ? void 0 : _value$toString.call(value);
|
|
3450
|
-
}
|
|
3451
|
-
output[key] = serialized_value;
|
|
3452
|
-
}
|
|
3453
|
-
return output;
|
|
3454
|
-
}
|
|
3455
|
-
const $1a15d4d13e0d0cf9$export$5c069c93d2b7493f = delay => new Promise(resolve => setTimeout(resolve, delay));
|
|
3456
|
-
async function $8f0b9bb45dd059c3$export$bcd70d5ed1cf6313(url, options) {
|
|
3457
|
-
let max_retries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
|
|
3458
|
-
let useFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
|
|
3459
|
-
const ONE_MINUTE = 60000;
|
|
3460
|
-
const max_backoff_ms = ONE_MINUTE;
|
|
3461
|
-
const {
|
|
3462
|
-
stack: stack
|
|
3463
|
-
} = new Error();
|
|
3464
|
-
const calculate_retry = delay => {
|
|
3465
|
-
delay *= 2 + Math.random();
|
|
3466
|
-
if (delay > max_backoff_ms) delay = max_backoff_ms * (1 + Math.random() / 10);
|
|
3467
|
-
return delay;
|
|
3468
|
-
};
|
|
3469
|
-
let try_again_in_ms = 100;
|
|
3470
|
-
let has_succeeded = false;
|
|
3471
|
-
let result = false;
|
|
3472
|
-
while (max_retries && !has_succeeded) try {
|
|
3473
|
-
const response = await useFetch(url, options);
|
|
3474
|
-
const {
|
|
3475
|
-
status: status,
|
|
3476
|
-
ok: ok
|
|
3477
|
-
} = response;
|
|
3478
|
-
if (!response || !ok || status !== 200) {
|
|
3479
|
-
if (status >= 400 && status < 500) {
|
|
3480
|
-
$3b52ccc10510b32a$export$b3bbfd758f11cfa9($8f0b9bb45dd059c3$var$send_sentry_4xx)(response, (options === null || options === void 0 ? void 0 : options.body) || {}, stack);
|
|
3481
|
-
has_succeeded = true;
|
|
3482
|
-
} else if (status === 404) has_succeeded = true;
|
|
3483
|
-
$7f95f77417d06249$export$de56f1198d121036("Response not ok", response);
|
|
3484
|
-
} else has_succeeded = true;
|
|
3485
|
-
result = response;
|
|
3486
|
-
} catch (error) {
|
|
3487
|
-
$7f95f77417d06249$export$de56f1198d121036("Error while fetching: ", error, url, options);
|
|
3488
|
-
// Don't retry CORS
|
|
3489
|
-
if (error.message.includes("CORS") && error.name.includes("CORS")) has_succeeded = true;
|
|
3490
|
-
} finally {
|
|
3491
|
-
if (!has_succeeded) await $1a15d4d13e0d0cf9$export$5c069c93d2b7493f(try_again_in_ms);
|
|
3492
|
-
try_again_in_ms = calculate_retry(try_again_in_ms);
|
|
3493
|
-
max_retries -= 1;
|
|
3494
|
-
}
|
|
3495
|
-
return result;
|
|
3496
|
-
}
|
|
3497
|
-
async function $8f0b9bb45dd059c3$var$send_sentry_4xx(response, body, stack) {
|
|
3498
|
-
if (process.env.TENANT === "shopify-config" && response.status === 403)
|
|
3499
|
-
// Don't send requests in the shopify admin that say we need to re-authorize to sentry
|
|
3500
|
-
return;
|
|
3501
|
-
const msg = "Validation error: got 4XX from API";
|
|
3502
|
-
const text = await response.clone().text();
|
|
3503
|
-
$7f95f77417d06249$export$de56f1198d121036(msg, "body", body, "response", response, "text", text, "stack", stack);
|
|
3504
|
-
(0, $902c0e005afb7319$export$af2e17a20c2ea3c5).withScope(function (scope) {
|
|
3505
|
-
scope.setExtra("stack", stack);
|
|
3506
|
-
scope.setExtra("request_body", body);
|
|
3507
|
-
scope.setExtra("response", response);
|
|
3508
|
-
scope.setExtra("serialized_response", $a1dd43178e1da976$export$39d526a1194b6499(response));
|
|
3509
|
-
scope.setExtra("response_text", text);
|
|
3510
|
-
scope.setLevel("error");
|
|
3511
|
-
this.captureException(new Error(msg));
|
|
3512
|
-
});
|
|
3513
|
-
}
|
|
3514
|
-
async function $d72c9a0d8e9c5a95$export$1bc0df10745d5412(t, options, headers) {
|
|
3515
|
-
let get_url = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : $d72c9a0d8e9c5a95$var$default_get_fetch_url;
|
|
3516
|
-
const res = await $d72c9a0d8e9c5a95$export$d40679eb4cf32f09(t, options, headers, get_url);
|
|
3517
|
-
return (res === null || res === void 0 ? void 0 : res.displays) || [];
|
|
3518
|
-
}
|
|
3519
|
-
async function $d72c9a0d8e9c5a95$export$d40679eb4cf32f09(t, options, headers) {
|
|
3520
|
-
let get_url = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : $d72c9a0d8e9c5a95$var$default_get_fetch_url;
|
|
3521
|
-
const session_id = options.session_id || $335c248bb07a3509$export$61e7e1f11e96692f();
|
|
3522
|
-
const body = {
|
|
3523
|
-
tenant: t.tenant,
|
|
3524
|
-
market: t.market,
|
|
3525
|
-
session_id: session_id,
|
|
3526
|
-
document_referrer: document.referrer,
|
|
3527
|
-
...options
|
|
3528
|
-
};
|
|
3529
|
-
const endpoint = $d72c9a0d8e9c5a95$var$get_fetch_endpoint_from_options(options);
|
|
3530
|
-
return await $8f0b9bb45dd059c3$export$bcd70d5ed1cf6313(get_url(endpoint), {
|
|
3531
|
-
body: JSON.stringify(body),
|
|
3532
|
-
...(headers ? {
|
|
3533
|
-
headers: headers
|
|
3534
|
-
} : {}),
|
|
3535
|
-
method: "POST"
|
|
3536
|
-
}) // @ts-ignore
|
|
3537
|
-
.then(r => r.json()).catch(e => $7f95f77417d06249$export$de56f1198d121036("fetch_retry threw", e));
|
|
3538
|
-
}
|
|
3539
|
-
function $d72c9a0d8e9c5a95$var$default_get_fetch_url(type) {
|
|
3540
|
-
return $045fb30107c9eecc$export$fe609f0216e4ebef("".concat((0, $62869a3ed703f236$export$362abebb4b313340), "/v2/recommend/products/").concat(type));
|
|
3541
|
-
}
|
|
3542
|
-
function $d72c9a0d8e9c5a95$var$get_fetch_endpoint_from_options(options) {
|
|
3543
|
-
if (options["category_id"] !== undefined) return "category";else if (options["product_id"] !== undefined) return "product";else if (options["product_ids"] !== undefined) return "products";
|
|
3544
|
-
return "general";
|
|
3545
|
-
}
|
|
3546
|
-
async function $8f0d01ff20cfba68$export$a9fc160c5ed83bd7(t, rendering_options) {
|
|
3547
|
-
// clone options to prevent nasty bugs where changes of options change the options somewhere else too
|
|
3548
|
-
rendering_options = $8f0d01ff20cfba68$export$c42139a43c877ecd(rendering_options);
|
|
3549
|
-
const {
|
|
3550
|
-
type: type
|
|
3551
|
-
} = rendering_options;
|
|
3552
|
-
const displays = await $8f0d01ff20cfba68$var$make_sure_we_have_displays(t, rendering_options);
|
|
3553
|
-
if (!(displays !== null && displays !== void 0 && displays.length)) {
|
|
3554
|
-
$7f95f77417d06249$export$de56f1198d121036("RR: Got no displays for type " + type + ", can't recover.", t, rendering_options);
|
|
3555
|
-
return {};
|
|
3556
|
-
}
|
|
3557
|
-
// return if too few displays
|
|
3558
|
-
const {
|
|
3559
|
-
min_items_to_run: min_items_to_run
|
|
3560
|
-
} = rendering_options;
|
|
3561
|
-
const good_displays = await $8f0d01ff20cfba68$var$check_displays(displays, min_items_to_run).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
3562
|
-
if (!good_displays) return {};
|
|
3563
|
-
const processed_displays = await $8f0d01ff20cfba68$export$c22e610107c5a15a(t, rendering_options, displays);
|
|
3564
|
-
if (!processed_displays.length) {
|
|
3565
|
-
$7f95f77417d06249$export$de56f1198d121036("RR: No displays left after preprocessing");
|
|
3566
|
-
return {};
|
|
3567
|
-
}
|
|
3568
|
-
const {
|
|
3569
|
-
template: template,
|
|
3570
|
-
post_processors = []
|
|
3571
|
-
} = rendering_options;
|
|
3572
|
-
const caught_post_processing_functions = post_processors.map(post_pro => $3b52ccc10510b32a$export$b3bbfd758f11cfa9(post_pro));
|
|
3573
|
-
let a;
|
|
3574
|
-
const caught_html2elems = $3b52ccc10510b32a$export$b3bbfd758f11cfa9((0, $8b27923e1d1e6b99$export$44951404cb8d0583));
|
|
3575
|
-
let output_elements;
|
|
3576
|
-
if (typeof template === "function") {
|
|
3577
|
-
const caught_template = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(template);
|
|
3578
|
-
output_elements = (await Promise.allSettled(processed_displays.map(async (display, index) => {
|
|
3579
|
-
const event_listeners = [];
|
|
3580
|
-
let keep = true;
|
|
3581
|
-
const info = new $8f0d01ff20cfba68$export$da854280fb61cd32(t, rendering_options, displays, index, () => keep = false, event_listeners);
|
|
3582
|
-
const template_result = await caught_template(display, info);
|
|
3583
|
-
if (!keep) throw keep;
|
|
3584
|
-
const elements = (typeof template_result == "string" ? caught_html2elems(template_result) : template_result) || [];
|
|
3585
|
-
const post_processed_elements = await $8f0d01ff20cfba68$export$cf7cbc6b76039101(t, rendering_options, processed_displays, index, caught_post_processing_functions, elements, event_listeners);
|
|
3586
|
-
return Array.from(post_processed_elements);
|
|
3587
|
-
}))).filter(p => p.status === "fulfilled").map(p => p.value).flat();
|
|
3588
|
-
// I don't want to use anything using spread since spread is a nice form of apply and
|
|
3589
|
-
// there's a - browser engine dependant - limit of arguments that can be applied to a function
|
|
3590
|
-
// we don't know how this will be used and want it to be robust
|
|
3591
|
-
} else output_elements = (await Promise.all(processed_displays.map(async (display, index) => {
|
|
3592
|
-
const html = $8f0d01ff20cfba68$export$e0009e7da572f99b(template, display);
|
|
3593
|
-
const elements = caught_html2elems(html) || [];
|
|
3594
|
-
const post_processed_elements = await $8f0d01ff20cfba68$export$cf7cbc6b76039101(t, rendering_options, processed_displays, index, caught_post_processing_functions, elements);
|
|
3595
|
-
return Array.from(post_processed_elements);
|
|
3596
|
-
}))).flat();
|
|
3597
|
-
if (!output_elements.length) {
|
|
3598
|
-
$7f95f77417d06249$export$de56f1198d121036("RR: No displays left after postprocessing/rendering");
|
|
3599
|
-
return {};
|
|
3600
|
-
}
|
|
3601
|
-
return {
|
|
3602
|
-
elements: output_elements,
|
|
3603
|
-
displays: processed_displays
|
|
3604
|
-
};
|
|
3605
|
-
}
|
|
3606
|
-
function $8f0d01ff20cfba68$export$e0009e7da572f99b(template) {
|
|
3607
|
-
let display = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3608
|
-
const discount_matcher = /{DISCOUNT{([\s\S]+?)}}/g;
|
|
3609
|
-
const no_discount_matcher = /{NODISCOUNT{([\s\S]+?)}}/g;
|
|
3610
|
-
if ("variant_index" in display) throw new Error("Modern display in ancient templating");
|
|
3611
|
-
const {
|
|
3612
|
-
sale_price: sale_price,
|
|
3613
|
-
original_price: original_price
|
|
3614
|
-
} = display;
|
|
3615
|
-
if (sale_price !== original_price) template = template.replaceAll(discount_matcher, "$1").replaceAll(no_discount_matcher, "");else template = template.replaceAll(discount_matcher, "").replaceAll(no_discount_matcher, "$1");
|
|
3616
|
-
// Conditional statements
|
|
3617
|
-
// {if VAR_NAME}
|
|
3618
|
-
// print this if true
|
|
3619
|
-
// {else}
|
|
3620
|
-
// print this if false
|
|
3621
|
-
// {end}
|
|
3622
|
-
// Note: these can't be nested. Else statement is optional
|
|
3623
|
-
template = template.replace(/{if\s+(.+?)}([\S\s]*?)(?:{else}([\S\s]*?))?{end}/g, (_, variable, if_yes, if_no) => {
|
|
3624
|
-
if (typeof if_no !== "string")
|
|
3625
|
-
// if_no is a number if there's no {else} statement
|
|
3626
|
-
if_no = "";
|
|
3627
|
-
return display[variable] ? if_yes : if_no;
|
|
3628
|
-
});
|
|
3629
|
-
return template.replace(/\${(.*?)}/g, (_, g) => {
|
|
3630
|
-
var _display$g;
|
|
3631
|
-
return (_display$g = display[g]) !== null && _display$g !== void 0 ? _display$g : "";
|
|
3632
|
-
});
|
|
3633
|
-
// this is copied from here, I hope I'm not breaking any licenses. Need it to transpile for IE11 compatiblity:
|
|
3634
|
-
// https://github.com/mikemaccana/dynamic-template/blob/master/index.js
|
|
3635
|
-
}
|
|
3636
|
-
|
|
3637
|
-
function $8f0d01ff20cfba68$export$c42139a43c877ecd(obj) {
|
|
3638
|
-
if (obj && typeof obj === "object" && !(obj instanceof Promise)) {
|
|
3639
|
-
// @ts-ignore (I don't know how to type this)
|
|
3640
|
-
const new_obj = Object.assign(new obj.constructor(), obj);
|
|
3641
|
-
for (const key in new_obj) if (typeof new_obj[key] === "object") new_obj[key] = $8f0d01ff20cfba68$export$c42139a43c877ecd(new_obj[key]);
|
|
3642
|
-
return new_obj;
|
|
3643
|
-
}
|
|
3644
|
-
return obj;
|
|
3645
|
-
}
|
|
3646
|
-
async function $8f0d01ff20cfba68$export$cf7cbc6b76039101(t, rendering_options, displays, index, functions, elements) {
|
|
3647
|
-
let event_listeners = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
|
|
3648
|
-
let keep = true;
|
|
3649
|
-
const info = new $8f0d01ff20cfba68$export$da854280fb61cd32(t, rendering_options, displays, index, () => keep = false, event_listeners);
|
|
3650
|
-
for (let i = 0; i < functions.length; i++) {
|
|
3651
|
-
const result = await functions[i](elements, displays[index], info);
|
|
3652
|
-
if (result) elements = result;
|
|
3653
|
-
if (!keep) break;
|
|
3654
|
-
}
|
|
3655
|
-
if (keep) {
|
|
3656
|
-
for (let i = 0; i < event_listeners.length; i++) for (let j = 0; j < elements.length; j++) elements[j].addEventListener(...event_listeners[i]);
|
|
3657
|
-
}
|
|
3658
|
-
return keep ? elements : [];
|
|
3659
|
-
}
|
|
3660
|
-
async function $8f0d01ff20cfba68$export$c22e610107c5a15a(t, rendering_options, displays) {
|
|
3661
|
-
const {
|
|
3662
|
-
max_items: max_items,
|
|
3663
|
-
pre_processors = []
|
|
3664
|
-
} = rendering_options;
|
|
3665
|
-
const caught_pre_processors = pre_processors.map(pre_pro => $3b52ccc10510b32a$export$b3bbfd758f11cfa9(pre_pro));
|
|
3666
|
-
const processed_displays = [];
|
|
3667
|
-
for (let i = 0; i < displays.length; i++) {
|
|
3668
|
-
// classic for loop is both fast and can be stopped with break
|
|
3669
|
-
let keep = true;
|
|
3670
|
-
const info_for_pre_pro = new $8f0d01ff20cfba68$export$da854280fb61cd32(t, rendering_options, displays, i, () => keep = false);
|
|
3671
|
-
let display = displays[i];
|
|
3672
|
-
for (let j = 0; j < caught_pre_processors.length; j++) {
|
|
3673
|
-
const pre_processor = caught_pre_processors[j];
|
|
3674
|
-
const result = await pre_processor(display, info_for_pre_pro);
|
|
3675
|
-
if (result) display = result; // Don't understand why this cast is needed
|
|
3676
|
-
if (!keep) break;
|
|
3677
|
-
}
|
|
3678
|
-
if (keep) processed_displays.push(display);
|
|
3679
|
-
if (processed_displays.length >= max_items) break;
|
|
3680
|
-
}
|
|
3681
|
-
return processed_displays;
|
|
3682
|
-
}
|
|
3683
|
-
class $8f0d01ff20cfba68$export$da854280fb61cd32 {
|
|
3684
|
-
constructor(t, rendering_options, displays, index, remove_display, event_listeners) {
|
|
3685
|
-
var _this = this;
|
|
3686
|
-
// @ts-ignore Support for no-tenant recommendation rendering for js-ui/react-ui
|
|
3687
|
-
this.t = t;
|
|
3688
|
-
this.rendering_options = rendering_options;
|
|
3689
|
-
this.displays = displays;
|
|
3690
|
-
if (index != null) this.index = index;
|
|
3691
|
-
if (remove_display) this.remove_display = remove_display;
|
|
3692
|
-
if (event_listeners) {
|
|
3693
|
-
this.event_listeners = event_listeners;
|
|
3694
|
-
this.register_event_listener = function () {
|
|
3695
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
|
|
3696
|
-
return _this.event_listeners.push(args);
|
|
3697
|
-
};
|
|
3698
|
-
}
|
|
3699
|
-
}
|
|
3700
|
-
}
|
|
3701
|
-
async function $8f0d01ff20cfba68$var$check_displays(displays, min_items_to_run) {
|
|
3702
|
-
// don't run if too few recs
|
|
3703
|
-
if (min_items_to_run && displays.length < min_items_to_run) {
|
|
3704
|
-
$7f95f77417d06249$export$de56f1198d121036("RR: Got too few displays, exiting");
|
|
3705
|
-
return false;
|
|
3706
|
-
}
|
|
3707
|
-
return true;
|
|
3708
|
-
}
|
|
3709
|
-
async function $8f0d01ff20cfba68$var$make_sure_we_have_displays(t, rendering_options) {
|
|
3710
|
-
const recs = await rendering_options.recs;
|
|
3711
|
-
if (Array.isArray(recs)) return $8f0d01ff20cfba68$export$c42139a43c877ecd(recs);
|
|
3712
|
-
if (!t)
|
|
3713
|
-
// No recs and no tenant, so we can't get any. Should never happen.
|
|
3714
|
-
return [];
|
|
3715
|
-
// get displays with get_displays if none are provided
|
|
3716
|
-
const get_displays_options = {
|
|
3717
|
-
type: rendering_options.type,
|
|
3718
|
-
...(rendering_options.extra_api_options || {})
|
|
3719
|
-
};
|
|
3720
|
-
for (const key of ["product_ids", "category_id", "product_id"]) if (key in rendering_options) get_displays_options[key] = rendering_options[key];
|
|
3721
|
-
return await $d72c9a0d8e9c5a95$export$1bc0df10745d5412(t, get_displays_options, rendering_options.headers || {}).catch(t.err);
|
|
3722
|
-
}
|
|
3723
|
-
async function $b764ad4e777fb225$export$c83d8da642b5104a(t, options, GWVM_opts) {
|
|
3724
|
-
const {
|
|
3725
|
-
catchify: catchify,
|
|
3726
|
-
dlog: dlog,
|
|
3727
|
-
is_debug: is_debug
|
|
3728
|
-
} = t;
|
|
3729
|
-
const {
|
|
3730
|
-
container_selector = ".grid",
|
|
3731
|
-
container_template: container_template,
|
|
3732
|
-
start_rows = 1,
|
|
3733
|
-
rows_per_click = 1,
|
|
3734
|
-
override_rec_renderer: override_rec_renderer,
|
|
3735
|
-
button: button,
|
|
3736
|
-
title: title,
|
|
3737
|
-
title_selector: title_selector,
|
|
3738
|
-
only_full_rows = false,
|
|
3739
|
-
should_preload = true
|
|
3740
|
-
} = GWVM_opts;
|
|
3741
|
-
const outer_els = typeof container_template === "string" ? [...$8b27923e1d1e6b99$export$44951404cb8d0583(container_template)] : container_template;
|
|
3742
|
-
const [root] = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(outer_els, container_selector);
|
|
3743
|
-
const cut_off_promise_obj = /*@__PURE__*/new (0, $f3ec1bb29cf43251$export$32ccf3a614c84258)();
|
|
3744
|
-
const i_observer = new IntersectionObserver(catchify($b764ad4e777fb225$var$observer_callback));
|
|
3745
|
-
let cut_off_point = 0;
|
|
3746
|
-
const recs_per_row = () => {
|
|
3747
|
-
var _GWVM_opts$recs_per_r;
|
|
3748
|
-
return typeof GWVM_opts.recs_per_row === "function" ? GWVM_opts.recs_per_row(cut_off_point) : (_GWVM_opts$recs_per_r = GWVM_opts.recs_per_row) !== null && _GWVM_opts$recs_per_r !== void 0 ? _GWVM_opts$recs_per_r : 6;
|
|
3749
|
-
};
|
|
3750
|
-
cut_off_point = recs_per_row() * start_rows;
|
|
3751
|
-
const get_show_next_num = () => recs_per_row() * rows_per_click;
|
|
3752
|
-
const preload_next_row = catchify(() => {
|
|
3753
|
-
const preload_these = [...rendering_results.displays].slice(cut_off_point, cut_off_point + get_show_next_num());
|
|
3754
|
-
for (const elem of preload_these) {
|
|
3755
|
-
const img = new Image();
|
|
3756
|
-
img.src = elem.image_url;
|
|
3757
|
-
// Element should be garbage collected, and the image source put in cache
|
|
3758
|
-
// https://stackoverflow.com/questions/3646036/preloading-images-with-javascript
|
|
3759
|
-
}
|
|
3760
|
-
});
|
|
3761
|
-
|
|
3762
|
-
const load_more = catchify(num => {
|
|
3763
|
-
const adds = typeof num == "number" ? num : get_show_next_num();
|
|
3764
|
-
cut_off_point += adds;
|
|
3765
|
-
cut_off_promise_obj.resolve(cut_off_point);
|
|
3766
|
-
if ((only_full_rows ? cut_off_point + adds : cut_off_point) >= displays.length)
|
|
3767
|
-
// TODO: make it remove/add back the button depending on viewport
|
|
3768
|
-
load_more_cont.remove();
|
|
3769
|
-
if (adds > 0 && should_preload) preload_next_row();
|
|
3770
|
-
});
|
|
3771
|
-
const our_post_pro = (elements, display, info) => $b764ad4e777fb225$var$post_processor(elements, display, info, cut_off_point, i_observer, cut_off_promise_obj, load_more);
|
|
3772
|
-
const rendering_results = await (override_rec_renderer || (0, $8f0d01ff20cfba68$export$a9fc160c5ed83bd7))(t, {
|
|
3773
|
-
...options,
|
|
3774
|
-
post_processors: [our_post_pro, ...(options.post_processors || [])]
|
|
3775
|
-
});
|
|
3776
|
-
const {
|
|
3777
|
-
elements: rendered_elements,
|
|
3778
|
-
displays: displays
|
|
3779
|
-
} = rendering_results;
|
|
3780
|
-
if (!rendered_elements) {
|
|
3781
|
-
dlog("Grid with view more is stopping because it got no elements");
|
|
3782
|
-
return rendering_results;
|
|
3783
|
-
}
|
|
3784
|
-
root.append(...rendered_elements);
|
|
3785
|
-
const load_more_cont = $8b27923e1d1e6b99$export$d3e2a0560cbf4787('<div class="load-more-container"></div>');
|
|
3786
|
-
const button_element = button instanceof Element ? button : $8b27923e1d1e6b99$export$d3e2a0560cbf4787('<button class="load_more">'.concat(button || "Visa mer", "</button>"));
|
|
3787
|
-
button_element.addEventListener("click", load_more);
|
|
3788
|
-
load_more_cont.append(button_element);
|
|
3789
|
-
root.after(load_more_cont);
|
|
3790
|
-
if (should_preload) {
|
|
3791
|
-
const load_more_intersection = async (entries, intersection_observer) => {
|
|
3792
|
-
// Multiple observe calls could potentially (?) be batched into one fn call, so check everything
|
|
3793
|
-
let intersected = false;
|
|
3794
|
-
for (let i = 0; i < entries.length; i++) if (entries[i].isIntersecting) {
|
|
3795
|
-
intersected = true;
|
|
3796
|
-
break;
|
|
3797
|
-
}
|
|
3798
|
-
if (!intersected) return;
|
|
3799
|
-
preload_next_row();
|
|
3800
|
-
intersection_observer.disconnect(); // The load_more button has its own preload call, so this only needs to happen the first time.
|
|
3801
|
-
};
|
|
3802
|
-
|
|
3803
|
-
const load_more_observer = new IntersectionObserver(catchify(load_more_intersection));
|
|
3804
|
-
load_more_observer.observe(load_more_cont);
|
|
3805
|
-
}
|
|
3806
|
-
if (title) {
|
|
3807
|
-
const [title_el] = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(outer_els, title_selector || "h1.title");
|
|
3808
|
-
if (title_el) {
|
|
3809
|
-
if (title instanceof Element) title_el.replaceWith(title);else title_el.innerText = title;
|
|
3810
|
-
} else if (is_debug) {
|
|
3811
|
-
console.error("GWVM: Title set but couldn't find title element. Please specify title_selector", () => {});
|
|
3812
|
-
console.trace();
|
|
3813
|
-
}
|
|
3814
|
-
}
|
|
3815
|
-
return {
|
|
3816
|
-
...rendering_results,
|
|
3817
|
-
elements: outer_els,
|
|
3818
|
-
load_more: load_more
|
|
3819
|
-
};
|
|
3820
|
-
}
|
|
3821
|
-
function $b764ad4e777fb225$var$observer_callback(entries) {
|
|
3822
|
-
for (let i = 0; i < entries.length; i++) if (entries[i].isIntersecting) {
|
|
3823
|
-
var _target$src, _target$dataset, _target$dataset$src;
|
|
3824
|
-
const target = entries[i].target;
|
|
3825
|
-
if (!((_target$src = target.src) !== null && _target$src !== void 0 && _target$src.length) && (_target$dataset = target.dataset) !== null && _target$dataset !== void 0 && (_target$dataset$src = _target$dataset.src) !== null && _target$dataset$src !== void 0 && _target$dataset$src.length) {
|
|
3826
|
-
target.src = target.dataset.src;
|
|
3827
|
-
target.removeAttribute("data-src");
|
|
3828
|
-
}
|
|
3829
|
-
}
|
|
3830
|
-
}
|
|
3831
|
-
function $b764ad4e777fb225$var$post_processor(elements, _,
|
|
3832
|
-
//display: display,
|
|
3833
|
-
info, cut_off_point, i_observer, cut_off_promise_obj, load_more) {
|
|
3834
|
-
const {
|
|
3835
|
-
catchify: catchify,
|
|
3836
|
-
err: err,
|
|
3837
|
-
dlog: dlog
|
|
3838
|
-
} = info.t;
|
|
3839
|
-
const {
|
|
3840
|
-
index: index
|
|
3841
|
-
} = info;
|
|
3842
|
-
const elements_arr = [...elements];
|
|
3843
|
-
const [an_element_node] = elements_arr.filter(node => node.nodeType == Node.ELEMENT_NODE);
|
|
3844
|
-
const is_initially_hidden = index + 1 > cut_off_point;
|
|
3845
|
-
const extras = info.extras || (info.extras = {});
|
|
3846
|
-
extras.load_more || (extras.load_more = load_more);
|
|
3847
|
-
extras.load_more_ipo || (extras.load_more_ipo = cut_off_promise_obj);
|
|
3848
|
-
$8b27923e1d1e6b99$export$5e63aea0cac01fa0(elements_arr, "img:not(.filler):not(.ngl):not(.nolazy)").forEach(image => {
|
|
3849
|
-
var _image$src, _image$dataset, _image$src2, _image$src2$substr;
|
|
3850
|
-
// "img" also selects "image" in IE11 which can be an SVG element which doesn't have a src property, therefore optional chaining
|
|
3851
|
-
if ((image !== null && image !== void 0 && (_image$src = image.src) !== null && _image$src !== void 0 && _image$src.length || image !== null && image !== void 0 && (_image$dataset = image.dataset) !== null && _image$dataset !== void 0 && _image$dataset.src) && (image === null || image === void 0 ? void 0 : (_image$src2 = image.src) === null || _image$src2 === void 0 ? void 0 : (_image$src2$substr = _image$src2.substr) === null || _image$src2$substr === void 0 ? void 0 : _image$src2$substr.call(_image$src2, 0, 6)) != "data:") {
|
|
3852
|
-
if (is_initially_hidden && !(image !== null && image !== void 0 && image.dataset.src)) {
|
|
3853
|
-
image.dataset.src = image.src;
|
|
3854
|
-
image.removeAttribute("src");
|
|
3855
|
-
}
|
|
3856
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element(an_element_node).then(catchify(el => {
|
|
3857
|
-
if ((el === null || el === void 0 ? void 0 : el.offsetParent) !== null) image.src || (image.src = image.dataset.src);else i_observer.observe(image);
|
|
3858
|
-
}));
|
|
3859
|
-
}
|
|
3860
|
-
});
|
|
3861
|
-
(async function () {
|
|
3862
|
-
if (is_initially_hidden) for (let i = 0; i < elements_arr.length; i++) {
|
|
3863
|
-
// HTMLElement is a lie, but TS is too dumb to understand that we check for it being a Node the line below this
|
|
3864
|
-
const {
|
|
3865
|
-
style: style
|
|
3866
|
-
} = elements_arr[i];
|
|
3867
|
-
if (style) style.display = "none";
|
|
3868
|
-
}
|
|
3869
|
-
while (true) {
|
|
3870
|
-
cut_off_point = await cut_off_promise_obj.promise;
|
|
3871
|
-
extras.load_more_currently_showing = cut_off_point;
|
|
3872
|
-
if (index + 1 <= cut_off_point) {
|
|
3873
|
-
for (let i = 0; i < elements_arr.length; i++) {
|
|
3874
|
-
const {
|
|
3875
|
-
style: style
|
|
3876
|
-
} = elements_arr[i];
|
|
3877
|
-
if (style) style.display = "";
|
|
3878
|
-
}
|
|
3879
|
-
break;
|
|
3880
|
-
}
|
|
3881
|
-
}
|
|
3882
|
-
})().catch(err);
|
|
3883
|
-
return elements;
|
|
3884
|
-
}
|
|
3885
|
-
async function $8cdb31ce9b00f5a0$export$41de2959a8dd405d(t, options, GWVM_opts) {
|
|
3886
|
-
var _result4, _result5;
|
|
3887
|
-
let {
|
|
3888
|
-
rec_selector = ".rec_outer"
|
|
3889
|
-
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
3890
|
-
const {
|
|
3891
|
-
start_rows: wished_start_rows = 1
|
|
3892
|
-
} = GWVM_opts;
|
|
3893
|
-
const {
|
|
3894
|
-
dlog: dlog,
|
|
3895
|
-
err: err,
|
|
3896
|
-
catchify: catchify
|
|
3897
|
-
} = t;
|
|
3898
|
-
let result;
|
|
3899
|
-
let rec;
|
|
3900
|
-
let first = true;
|
|
3901
|
-
const modified_GWVM_opts = {
|
|
3902
|
-
...GWVM_opts,
|
|
3903
|
-
start_rows: 1 / 6,
|
|
3904
|
-
recs_per_row(num) {
|
|
3905
|
-
try {
|
|
3906
|
-
var _result;
|
|
3907
|
-
if ((_result = result) !== null && _result !== void 0 && _result.elements && rec) {
|
|
3908
|
-
let {
|
|
3909
|
-
parentElement: parentElement
|
|
3910
|
-
} = rec;
|
|
3911
|
-
if (!parentElement) {
|
|
3912
|
-
var _result2, _rec;
|
|
3913
|
-
// first rec was removed
|
|
3914
|
-
[rec] = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(((_result2 = result) === null || _result2 === void 0 ? void 0 : _result2.elements) || [], rec_selector);
|
|
3915
|
-
parentElement = (_rec = rec) === null || _rec === void 0 ? void 0 : _rec.parentElement;
|
|
3916
|
-
if (!parentElement) throw new Error("Could not find element matching " + rec_selector + "to calculate width");
|
|
3917
|
-
}
|
|
3918
|
-
const recs_fitting_in_row = Math.floor(parentElement.getBoundingClientRect().width / Math.floor(rec.getBoundingClientRect().width));
|
|
3919
|
-
// this is not entirely accurate because of margins but seems to work 100% of the time for our use case
|
|
3920
|
-
if (recs_fitting_in_row != Infinity) {
|
|
3921
|
-
dlog("We think there are currently", recs_fitting_in_row, "columns");
|
|
3922
|
-
const {
|
|
3923
|
-
children: children
|
|
3924
|
-
} = parentElement;
|
|
3925
|
-
const last_visible = $8cdb31ce9b00f5a0$var$find_last_visible(children);
|
|
3926
|
-
if (!last_visible) {
|
|
3927
|
-
dlog("It seems like no elements are visible, not loading any");
|
|
3928
|
-
return 0;
|
|
3929
|
-
}
|
|
3930
|
-
if (num % recs_fitting_in_row !== 0) {
|
|
3931
|
-
var _result$load_more, _result3;
|
|
3932
|
-
// X % 0 is NaN, prevent this from happening
|
|
3933
|
-
const fill_last_row = recs_fitting_in_row === 0 ? 0 : recs_fitting_in_row - num % recs_fitting_in_row;
|
|
3934
|
-
(_result$load_more = (_result3 = result).load_more) === null || _result$load_more === void 0 || _result$load_more.call(_result3, fill_last_row + recs_fitting_in_row * (wished_start_rows - 1));
|
|
3935
|
-
}
|
|
3936
|
-
// Special case for when it's the first "load more" (which is automatically triggered)
|
|
3937
|
-
if (num === 1 && first) {
|
|
3938
|
-
first = false;
|
|
3939
|
-
return 0;
|
|
3940
|
-
}
|
|
3941
|
-
return recs_fitting_in_row;
|
|
3942
|
-
}
|
|
3943
|
-
}
|
|
3944
|
-
} catch (e) {
|
|
3945
|
-
err(e);
|
|
3946
|
-
}
|
|
3947
|
-
return 6;
|
|
3948
|
-
}
|
|
3949
|
-
};
|
|
3950
|
-
// @ts-ignore
|
|
3951
|
-
result = await $b764ad4e777fb225$export$c83d8da642b5104a(t, options, modified_GWVM_opts);
|
|
3952
|
-
if (!((_result4 = result) !== null && _result4 !== void 0 && _result4.elements))
|
|
3953
|
-
// no chance in finding any elements, API didn't return recs
|
|
3954
|
-
return result;
|
|
3955
|
-
if (typeof ((_result5 = result) === null || _result5 === void 0 ? void 0 : _result5.load_more) == "function") (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element(rec_selector).then(() => {
|
|
3956
|
-
var _result$load_more2, _result6;
|
|
3957
|
-
// we load 1 card to be able to determine the width
|
|
3958
|
-
// in this situation recs_per_row will not return actual recs per row but recs_to_complete_row, so we add one card to get actual recs per row
|
|
3959
|
-
// then we remove the one card again from total calculation
|
|
3960
|
-
(_result$load_more2 = (_result6 = result).load_more) === null || _result$load_more2 === void 0 || _result$load_more2.call(_result6);
|
|
3961
|
-
});else err("Could not find recommendation to calculate recs per row. rec_selector: " + rec_selector);
|
|
3962
|
-
return result;
|
|
3963
|
-
}
|
|
3964
|
-
function $8cdb31ce9b00f5a0$var$find_last_visible(items) {
|
|
3965
|
-
for (let i = items.length - 1; i > -1; i--) {
|
|
3966
|
-
var _items$i;
|
|
3967
|
-
// @ts-ignore
|
|
3968
|
-
if (((_items$i = items[i]) === null || _items$i === void 0 ? void 0 : _items$i.offsetParent) !== null) return items[i];
|
|
3969
|
-
}
|
|
3970
|
-
}
|
|
3971
|
-
|
|
3972
|
-
/**
|
|
3973
|
-
* @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
|
|
3974
|
-
*/
|
|
3975
|
-
function $b54a733b523aa99d$export$55621c1ce3cd536b() {
|
|
3976
|
-
// the idea is to have a new promise available immediately before one resolves, so to say an infinite promise
|
|
3977
|
-
let internal_resolve; // copy and pasted from iconbeauty
|
|
3978
|
-
const cart_promise_object = {
|
|
3979
|
-
// I feel like Anton is not going to like this extremely awesome approach
|
|
3980
|
-
promise: new Promise(r => internal_resolve = r),
|
|
3981
|
-
// which is why I'm reluctant with making it a library
|
|
3982
|
-
internal_resolve: internal_resolve,
|
|
3983
|
-
// Edit from later on: I have realised that this is actually very useful, it just has a steep learning curve.
|
|
3984
|
-
resolve: argument => {
|
|
3985
|
-
// it allows both not having to call functions in a loop and instead just awaiting the promise from multiple places
|
|
3986
|
-
const oldresolve = cart_promise_object.internal_resolve; // and to effortlessly ensure a process is never running twice with 100% reliability
|
|
3987
|
-
cart_promise_object.promise = new Promise(r => cart_promise_object.internal_resolve = r); // it could be made a class, but I already know this works, so I'll leave it as is
|
|
3988
|
-
oldresolve(argument);
|
|
3989
|
-
}
|
|
3990
|
-
};
|
|
3991
|
-
return cart_promise_object;
|
|
3992
|
-
}
|
|
3993
|
-
|
|
3994
|
-
// import { buildThresholdList } from "../../helpers/build_threshold_list";
|
|
3995
|
-
|
|
3996
|
-
async function $a0ab88605730ded3$export$c0a4d29bc45a38c6(t, options, GWVM_opts) {
|
|
3997
|
-
let {
|
|
3998
|
-
rec_selector = ".rec_outer"
|
|
3999
|
-
} = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
4000
|
-
const options_for_auto_gwvm = {
|
|
4001
|
-
...GWVM_opts,
|
|
4002
|
-
start_rows: 1
|
|
4003
|
-
};
|
|
4004
|
-
let all_rendered_elements = [];
|
|
4005
|
-
options.post_processors = [...(options.post_processors || []), (elements, display, info) => {
|
|
4006
|
-
all_rendered_elements.push(elements);
|
|
4007
|
-
if (!info.index)
|
|
4008
|
-
// the plan:
|
|
4009
|
-
// observe first element - after dom insertion, count the visible elements and observe the last one thereof
|
|
4010
|
-
// once it enters the view port, unobserve it
|
|
4011
|
-
// once new elements have been loaded, count the visible elements - only once tho, in response of the first one being visible
|
|
4012
|
-
// then attach to last element again and repeat
|
|
4013
|
-
$a0ab88605730ded3$var$observe_first_el_after_dominsertion(all_rendered_elements, elements, info.extras.load_more);
|
|
4014
|
-
return elements;
|
|
4015
|
-
}];
|
|
4016
|
-
return await $8cdb31ce9b00f5a0$export$41de2959a8dd405d(t, options, options_for_auto_gwvm, {
|
|
4017
|
-
rec_selector: rec_selector
|
|
4018
|
-
});
|
|
4019
|
-
}
|
|
4020
|
-
function $a0ab88605730ded3$var$observe_first_el_after_dominsertion(all_rendered_elements, elements, load_more) {
|
|
4021
|
-
const element = $a0ab88605730ded3$var$find_html_element(elements);
|
|
4022
|
-
if (!element) {
|
|
4023
|
-
$7f95f77417d06249$export$de56f1198d121036("Infinite scroll won't work, couldn't find element to observe", elements);
|
|
4024
|
-
return;
|
|
4025
|
-
}
|
|
4026
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element(element).then($3b52ccc10510b32a$export$b3bbfd758f11cfa9(() => {
|
|
4027
|
-
$a0ab88605730ded3$var$find_last_el_and_observe(all_rendered_elements, load_more);
|
|
4028
|
-
}));
|
|
4029
|
-
}
|
|
4030
|
-
function $a0ab88605730ded3$var$find_last_el_and_observe(all_rendered_elements, load_more) {
|
|
4031
|
-
const last_visible_el = $a0ab88605730ded3$var$find_last_visible(all_rendered_elements);
|
|
4032
|
-
if (!last_visible_el) return;
|
|
4033
|
-
const i_o = new IntersectionObserver($3b52ccc10510b32a$export$b3bbfd758f11cfa9(records => {
|
|
4034
|
-
for (const record of records) if (record.isIntersecting) {
|
|
4035
|
-
$7f95f77417d06249$export$de56f1198d121036("loading more because of", record);
|
|
4036
|
-
load_more();
|
|
4037
|
-
setTimeout($3b52ccc10510b32a$export$b3bbfd758f11cfa9($a0ab88605730ded3$var$find_last_el_and_observe), 0, all_rendered_elements, load_more);
|
|
4038
|
-
i_o.disconnect();
|
|
4039
|
-
}
|
|
4040
|
-
}));
|
|
4041
|
-
i_o.observe(last_visible_el);
|
|
4042
|
-
}
|
|
4043
|
-
function $a0ab88605730ded3$var$find_html_element(elements) {
|
|
4044
|
-
// intersection observers don't work on text nodes
|
|
4045
|
-
let element;
|
|
4046
|
-
for (let i = 0; !((element = elements[i++]) instanceof HTMLElement) && element;);
|
|
4047
|
-
return element;
|
|
4048
|
-
}
|
|
4049
|
-
function $a0ab88605730ded3$var$find_last_visible(bunch_of_elements) {
|
|
4050
|
-
const considered_elements = bunch_of_elements.map(els => $a0ab88605730ded3$var$find_html_element(els));
|
|
4051
|
-
// this is a potentially dangerous assumption - that the visibility status of the first element is the same as all other elements, but it should be true 100% of the time right now since GWVM sets display: none uniformally and why tf would you want it differently?
|
|
4052
|
-
for (let i = 0; i < considered_elements.length; i++) {
|
|
4053
|
-
const respected_element = considered_elements[i];
|
|
4054
|
-
if (!respected_element) {
|
|
4055
|
-
$7f95f77417d06249$export$de56f1198d121036("Infinite scroll error: couldn't find last visible element", bunch_of_elements);
|
|
4056
|
-
return;
|
|
4057
|
-
}
|
|
4058
|
-
if (respected_element.offsetParent === null) {
|
|
4059
|
-
if (!i) {
|
|
4060
|
-
// if index is 0 and we are not visible don't return the element at index -1 from the array - shit will hit the fan. Return the first one and everything should work out fine
|
|
4061
|
-
$7f95f77417d06249$export$de56f1198d121036("Inf scroll: No elements visible, ", considered_elements, "will attach to first el", respected_element);
|
|
4062
|
-
return considered_elements[i];
|
|
4063
|
-
}
|
|
4064
|
-
return considered_elements[i - 1];
|
|
4065
|
-
}
|
|
4066
|
-
}
|
|
4067
|
-
$7f95f77417d06249$export$de56f1198d121036("Seems like all elements are loaded");
|
|
4068
|
-
}
|
|
4069
|
-
async function $033efa5601489887$export$9eae832ae57fbf(t, css, extra_html) {
|
|
4070
|
-
const head = await (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element("head"),
|
|
4071
|
-
{
|
|
4072
|
-
dlog: dlog
|
|
4073
|
-
} = t,
|
|
4074
|
-
elems = $8b27923e1d1e6b99$export$44951404cb8d0583('<style type="text/css">'.concat(css, "</style>") + (extra_html ? extra_html : ""));
|
|
4075
|
-
dlog("inserting", ...elems, "into", head);
|
|
4076
|
-
head.append(...elems);
|
|
4077
|
-
}
|
|
4078
|
-
function $628cae9fd43bb48b$export$c7187bbd1a7a9244() {
|
|
4079
|
-
$628cae9fd43bb48b$var$placeholder_worker(...arguments).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
4080
|
-
return arguments.length <= 0 ? undefined : arguments[0];
|
|
4081
|
-
}
|
|
4082
|
-
async function $628cae9fd43bb48b$var$placeholder_worker(placeholder_elements, final_elements, switching_trigger) {
|
|
4083
|
-
let state = false;
|
|
4084
|
-
let has_sanitized_elements = false;
|
|
4085
|
-
const sanit_el_if_needed = async () => {
|
|
4086
|
-
if (!has_sanitized_elements) {
|
|
4087
|
-
has_sanitized_elements = true;
|
|
4088
|
-
placeholder_elements = await $628cae9fd43bb48b$var$convert_to_node_array(placeholder_elements);
|
|
4089
|
-
final_elements = await $628cae9fd43bb48b$var$convert_to_node_array(final_elements);
|
|
4090
|
-
}
|
|
4091
|
-
};
|
|
4092
|
-
if (switching_trigger instanceof (0, $f3ec1bb29cf43251$export$32ccf3a614c84258)) while (true) {
|
|
4093
|
-
const new_state = await switching_trigger.promise;
|
|
4094
|
-
if (new_state != state) {
|
|
4095
|
-
await sanit_el_if_needed();
|
|
4096
|
-
await $628cae9fd43bb48b$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
|
|
4097
|
-
state = new_state;
|
|
4098
|
-
}
|
|
4099
|
-
} else if (switching_trigger instanceof Promise) {
|
|
4100
|
-
const new_state = await switching_trigger;
|
|
4101
|
-
if (state != new_state) {
|
|
4102
|
-
await sanit_el_if_needed();
|
|
4103
|
-
await $628cae9fd43bb48b$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
|
|
4104
|
-
state = new_state;
|
|
4105
|
-
}
|
|
4106
|
-
} else {
|
|
4107
|
-
await sanit_el_if_needed();
|
|
4108
|
-
placeholder_elements[0].addEventListener("placeholder_switch", $9cefb304a1734a6b$export$535946eb77c946dd(async e => {
|
|
4109
|
-
const new_state = e.detail.state;
|
|
4110
|
-
if (state != new_state) {
|
|
4111
|
-
await sanit_el_if_needed();
|
|
4112
|
-
await $628cae9fd43bb48b$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
|
|
4113
|
-
state = new_state;
|
|
4114
|
-
}
|
|
4115
|
-
}));
|
|
4116
|
-
}
|
|
4117
|
-
}
|
|
4118
|
-
async function $628cae9fd43bb48b$var$convert_to_node_array(elements) {
|
|
4119
|
-
if (typeof elements == "function") elements = elements();
|
|
4120
|
-
elements = await elements;
|
|
4121
|
-
if (typeof elements[Symbol.iterator] != "function") elements = [elements];
|
|
4122
|
-
return elements;
|
|
4123
|
-
}
|
|
4124
|
-
async function $628cae9fd43bb48b$var$decide_direction_and_switch(placeholder_elements, final_elements, switch_to_final) {
|
|
4125
|
-
if (switch_to_final) $628cae9fd43bb48b$var$switch_elements(placeholder_elements, final_elements);else $628cae9fd43bb48b$var$switch_elements(final_elements, placeholder_elements);
|
|
4126
|
-
}
|
|
4127
|
-
function $628cae9fd43bb48b$var$switch_elements(from, to) {
|
|
4128
|
-
if (!from.length || !to.length) $7f95f77417d06249$export$c2363754d4758444("Cannot switch elements as from or to is empty", from, to);
|
|
4129
|
-
from[0].replaceWith(...to);
|
|
4130
|
-
for (let i = 1; i < from.length; i++) from[i].remove();
|
|
4131
|
-
}
|
|
4132
|
-
function $bc463df3122a418b$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
4133
|
-
$bc463df3122a418b$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
4134
|
-
privateSet.add(obj);
|
|
4135
|
-
}
|
|
4136
|
-
function $bc463df3122a418b$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
4137
|
-
$bc463df3122a418b$var$_checkPrivateRedeclaration(obj, privateMap);
|
|
4138
|
-
privateMap.set(obj, value);
|
|
4139
|
-
}
|
|
4140
|
-
function $bc463df3122a418b$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
4141
|
-
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
4142
|
-
}
|
|
4143
|
-
function $bc463df3122a418b$var$_classPrivateMethodGet(receiver, privateSet, fn) {
|
|
4144
|
-
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
4145
|
-
return fn;
|
|
4146
|
-
}
|
|
4147
|
-
var $bc463df3122a418b$var$_verbose = /*#__PURE__*/new WeakMap();
|
|
4148
|
-
var $bc463df3122a418b$var$_images_on_first_page = /*#__PURE__*/new WeakMap();
|
|
4149
|
-
var $bc463df3122a418b$var$_default_lazyfinder = /*#__PURE__*/new WeakMap();
|
|
4150
|
-
var $bc463df3122a418b$var$_initiate_new_image = /*#__PURE__*/new WeakSet();
|
|
4151
|
-
var $bc463df3122a418b$var$_add_load_event_listener = /*#__PURE__*/new WeakSet();
|
|
4152
|
-
var $bc463df3122a418b$var$_unload_images_and_add_load_listeners = /*#__PURE__*/new WeakSet();
|
|
4153
|
-
var $bc463df3122a418b$var$_start_observer = /*#__PURE__*/new WeakSet();
|
|
4154
|
-
var $bc463df3122a418b$var$_check_if_first_page_has_loaded = /*#__PURE__*/new WeakSet();
|
|
4155
|
-
class $bc463df3122a418b$export$3be7054c61590ee3 {
|
|
4156
|
-
start_observing_for_new_children_(override_container) {
|
|
4157
|
-
// should ONLY run on our "stock" elements array and is therefore called if "elements" is get in it - which means it's being used
|
|
4158
|
-
// it allows us to just add elements to the observed container and have them added to the elements array if they or their children match the selector
|
|
4159
|
-
if (!this.container && !override_container) return;
|
|
4160
|
-
const container = override_container !== null && override_container !== void 0 ? override_container : this.container;
|
|
4161
|
-
const mutation_observer = new MutationObserver($3b52ccc10510b32a$export$b3bbfd758f11cfa9(mutations => {
|
|
4162
|
-
for (let i = 0; i < mutations.length; i++) {
|
|
4163
|
-
const matching_added_els = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(mutations[i].addedNodes, this.selector);
|
|
4164
|
-
if (matching_added_els.length) {
|
|
4165
|
-
if ($parcel$interopDefault($lMD39$babelruntimehelpersclassPrivateFieldGet)(this, $bc463df3122a418b$var$_verbose)) $7f95f77417d06249$export$de56f1198d121036("New elements", matching_added_els, " matching selector", this.selector, "were aded to", container, "lazyloading\u2026");
|
|
4166
|
-
this.lazyfinder.elements.push(...matching_added_els);
|
|
4167
|
-
matching_added_els.forEach($bc463df3122a418b$var$_classPrivateMethodGet(this, $bc463df3122a418b$var$_initiate_new_image, $bc463df3122a418b$var$_initiate_new_image2).bind(this));
|
|
4168
|
-
}
|
|
4169
|
-
}
|
|
4170
|
-
}));
|
|
4171
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(container, _ref => {
|
|
4172
|
-
var _element$querySelecto;
|
|
4173
|
-
let {
|
|
4174
|
-
element: element
|
|
4175
|
-
} = _ref;
|
|
4176
|
-
const new_els = (element === null || element === void 0 ? void 0 : (_element$querySelecto = element.querySelectorAll) === null || _element$querySelecto === void 0 ? void 0 : _element$querySelecto.call(element, this.selector)) || [];
|
|
4177
|
-
this.lazyfinder.elements.push(...new_els);
|
|
4178
|
-
new_els.forEach($bc463df3122a418b$var$_classPrivateMethodGet(this, $bc463df3122a418b$var$_initiate_new_image, $bc463df3122a418b$var$_initiate_new_image2).bind(this));
|
|
4179
|
-
mutation_observer.observe(element, {
|
|
4180
|
-
subtree: true,
|
|
4181
|
-
childList: true
|
|
4182
|
-
});
|
|
2416
|
+
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(container, _ref => {
|
|
2417
|
+
var _element$querySelecto;
|
|
2418
|
+
let {
|
|
2419
|
+
element: element
|
|
2420
|
+
} = _ref;
|
|
2421
|
+
const new_els = (element === null || element === void 0 ? void 0 : (_element$querySelecto = element.querySelectorAll) === null || _element$querySelecto === void 0 ? void 0 : _element$querySelecto.call(element, this.selector)) || [];
|
|
2422
|
+
this.lazyfinder.elements.push(...new_els);
|
|
2423
|
+
new_els.forEach($bc463df3122a418b$var$_classPrivateMethodGet(this, $bc463df3122a418b$var$_initiate_new_image, $bc463df3122a418b$var$_initiate_new_image2).bind(this));
|
|
2424
|
+
mutation_observer.observe(element, {
|
|
2425
|
+
subtree: true,
|
|
2426
|
+
childList: true
|
|
2427
|
+
});
|
|
4183
2428
|
});
|
|
4184
2429
|
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onremoved(container, _ref2 => {
|
|
4185
2430
|
let {
|
|
@@ -4879,536 +3124,37 @@ function $08a94efe56c2b35f$var$_scroll_to2(offset) {
|
|
|
4879
3124
|
behavior: harsh ? "auto" : "smooth"
|
|
4880
3125
|
});
|
|
4881
3126
|
}
|
|
4882
|
-
class $817cb0cb4b98187e$export$68babfc5be0de5da extends (0, $08a94efe56c2b35f$export$692b27c28639e5b9) {
|
|
4883
|
-
constructor(options, lazyfier_options) {
|
|
4884
|
-
super(options);
|
|
4885
|
-
const lazy_promise = new Promise(r => {
|
|
4886
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(this.insert_here, _ref => {
|
|
4887
|
-
let {
|
|
4888
|
-
element: element,
|
|
4889
|
-
disconnector: disconnector
|
|
4890
|
-
} = _ref;
|
|
4891
|
-
const i_o = new IntersectionObserver($3b52ccc10510b32a$export$b3bbfd758f11cfa9(records => {
|
|
4892
|
-
for (const record of records) if (record.intersectionRatio > 0) {
|
|
4893
|
-
r(true);
|
|
4894
|
-
i_o.disconnect();
|
|
4895
|
-
disconnector();
|
|
4896
|
-
return;
|
|
4897
|
-
}
|
|
4898
|
-
}),
|
|
4899
|
-
// Fixes https://gitlab.com/depict-ai/depict.ai/-/merge_requests/5816/diffs, don't understand why
|
|
4900
|
-
{
|
|
4901
|
-
threshold: $4e1f5263dceb9802$export$f8ea2e7b15b5d129(10)
|
|
4902
|
-
});
|
|
4903
|
-
i_o.observe(element);
|
|
4904
|
-
});
|
|
4905
|
-
});
|
|
4906
|
-
this.lazyfier = new (0, $bc463df3122a418b$export$3be7054c61590ee3)({
|
|
4907
|
-
container: this.insert_here,
|
|
4908
|
-
wait_for_dominsertion: lazy_promise,
|
|
4909
|
-
...(lazyfier_options || {})
|
|
4910
|
-
});
|
|
4911
|
-
}
|
|
4912
|
-
}
|
|
4913
|
-
const $7fe962cfdca74c2f$export$f37c58ab3d3e3b75 = [$7fe962cfdca74c2f$export$9e1caada6901f552, (0, $e61e4fdc357cece9$export$d0efd8ed14f5c33), $7fe962cfdca74c2f$export$fb9afe9f540ae069, ...(process.env.GTAG_VIEW === "true" ? [$7fe962cfdca74c2f$export$1bffac19f9f0d6fc] : [])];
|
|
4914
|
-
const $7fe962cfdca74c2f$export$6830ae1fbe21e589 = [$7fe962cfdca74c2f$export$e9106d6e723510d2, $7fe962cfdca74c2f$export$32eb5dd18e963410, (0, $04bba294678834bc$export$58c56fe2313fdbe3), ...(process.env.GTAG === "true" ? [$7fe962cfdca74c2f$export$8d72437623fef90c] : [])];
|
|
4915
|
-
const $7fe962cfdca74c2f$export$ed8a68dacd075983 = /*@__PURE__*/new Map();
|
|
4916
|
-
const $7fe962cfdca74c2f$export$4b50a4de9c6bbe09 = /*@__PURE__*/new WeakSet();
|
|
4917
|
-
function $7fe962cfdca74c2f$export$fb9afe9f540ae069(elements, _display, info) {
|
|
4918
|
-
if (!(elements !== null && elements !== void 0 && elements.length)) return elements;
|
|
4919
|
-
if (!info.t) return elements;
|
|
4920
|
-
const elements_as_array = [...elements];
|
|
4921
|
-
const handler = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(async () => {
|
|
4922
|
-
const {
|
|
4923
|
-
rendering_options: rendering_options,
|
|
4924
|
-
t: t
|
|
4925
|
-
} = info;
|
|
4926
|
-
if (!$7fe962cfdca74c2f$export$4b50a4de9c6bbe09.has(rendering_options) && elements_as_array.some(e => document.documentElement.contains(e)) // check, just in case
|
|
4927
|
-
) {
|
|
4928
|
-
$7fe962cfdca74c2f$export$4b50a4de9c6bbe09.add(rendering_options);
|
|
4929
|
-
$335c248bb07a3509$export$82badda1f9923310({
|
|
4930
|
-
...t,
|
|
4931
|
-
product_id: await t.get_product_id(),
|
|
4932
|
-
recommendation_type: info.rendering_options.type,
|
|
4933
|
-
type: "recommendations_inserted"
|
|
4934
|
-
});
|
|
4935
|
-
}
|
|
4936
|
-
});
|
|
4937
|
-
$7fe962cfdca74c2f$var$push_function($7fe962cfdca74c2f$export$fb9afe9f540ae069, handler);
|
|
4938
|
-
const first_el = elements_as_array === null || elements_as_array === void 0 ? void 0 : elements_as_array[0];
|
|
4939
|
-
if (first_el instanceof Node) (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element(first_el).then(handler);
|
|
4940
|
-
return elements;
|
|
4941
|
-
}
|
|
4942
|
-
const $7fe962cfdca74c2f$export$3777a14dd8c2363d = /*@__PURE__*/new WeakSet();
|
|
4943
|
-
function $7fe962cfdca74c2f$export$1bffac19f9f0d6fc(elements, _display, info) {
|
|
4944
|
-
if (!(elements !== null && elements !== void 0 && elements.length))
|
|
4945
|
-
// don't make it hurt even more that rendering failed
|
|
4946
|
-
return elements;
|
|
4947
|
-
if (!info.t)
|
|
4948
|
-
// GTAG tracking is deprecated, if we're doing no-tenant recommendation rendering it's SDK anyway.
|
|
4949
|
-
return elements;
|
|
4950
|
-
const [first_element] = elements;
|
|
4951
|
-
const handler = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(() => {
|
|
4952
|
-
const {
|
|
4953
|
-
rendering_options: rendering_options,
|
|
4954
|
-
displays: displays
|
|
4955
|
-
} = info;
|
|
4956
|
-
if (!$7fe962cfdca74c2f$export$3777a14dd8c2363d.has(displays)) {
|
|
4957
|
-
$7fe962cfdca74c2f$export$3777a14dd8c2363d.add(displays);
|
|
4958
|
-
const {
|
|
4959
|
-
get_product_id: get_product_id
|
|
4960
|
-
} = info.t;
|
|
4961
|
-
const {
|
|
4962
|
-
type: type
|
|
4963
|
-
} = rendering_options;
|
|
4964
|
-
$99b61a0622560fcf$export$7babcd5d4056b2ca(displays, get_product_id /* yes this might create errors if there's no page_url in the display but don't have time to fix, sorry */, {
|
|
4965
|
-
list_name: "depict_" + type
|
|
4966
|
-
});
|
|
4967
|
-
}
|
|
4968
|
-
});
|
|
4969
|
-
$7fe962cfdca74c2f$var$push_function($7fe962cfdca74c2f$export$1bffac19f9f0d6fc, handler);
|
|
4970
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(first_element, handler);
|
|
4971
|
-
return elements;
|
|
4972
|
-
}
|
|
4973
|
-
function $7fe962cfdca74c2f$export$9e1caada6901f552(elements, _display, info) {
|
|
4974
|
-
const {
|
|
4975
|
-
t: t
|
|
4976
|
-
} = info;
|
|
4977
|
-
if (!t) return elements;
|
|
4978
|
-
(async () => {
|
|
4979
|
-
$c15d2edce69e632a$export$eee4c4d924348b05({
|
|
4980
|
-
tenant: t.tenant,
|
|
4981
|
-
market: t.market,
|
|
4982
|
-
product_id: await t.get_product_id()
|
|
4983
|
-
}).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
4984
|
-
})();
|
|
4985
|
-
return elements;
|
|
4986
|
-
}
|
|
4987
|
-
function $7fe962cfdca74c2f$export$8d72437623fef90c(elements, display, info) {
|
|
4988
|
-
const handler = () => {
|
|
4989
|
-
const {
|
|
4990
|
-
ga_product_ids: ga_product_ids,
|
|
4991
|
-
ga_product_id: ga_product_id,
|
|
4992
|
-
product_id: product_id
|
|
4993
|
-
} = display;
|
|
4994
|
-
if (Array.isArray(ga_product_ids)) for (let i = 0; i < ga_product_ids.length; i++) $99b61a0622560fcf$export$f522672c9379e339(ga_product_ids[i], info.index, {
|
|
4995
|
-
list_name: "depict_" + info.rendering_options.type
|
|
4996
|
-
});else $99b61a0622560fcf$export$f522672c9379e339(ga_product_id || product_id, info.index, {
|
|
4997
|
-
list_name: "depict_" + info.rendering_options.type
|
|
4998
|
-
});
|
|
4999
|
-
};
|
|
5000
|
-
$7fe962cfdca74c2f$var$push_function($7fe962cfdca74c2f$export$8d72437623fef90c, handler);
|
|
5001
|
-
info.register_event_listener("click", handler, {
|
|
5002
|
-
once: true
|
|
5003
|
-
});
|
|
5004
|
-
return elements;
|
|
5005
|
-
}
|
|
5006
|
-
function $7fe962cfdca74c2f$export$e9106d6e723510d2(elements, display, info) {
|
|
5007
|
-
const handler = () => {
|
|
5008
|
-
const {
|
|
5009
|
-
t: t,
|
|
5010
|
-
index: index,
|
|
5011
|
-
rendering_options: rendering_options
|
|
5012
|
-
} = info;
|
|
5013
|
-
return $335c248bb07a3509$export$15f8a0cd5a8c0ebb({
|
|
5014
|
-
...t,
|
|
5015
|
-
...rendering_options,
|
|
5016
|
-
...display,
|
|
5017
|
-
click_location: rendering_options.type + "_" + (index + 1),
|
|
5018
|
-
recommendation_type: rendering_options.type,
|
|
5019
|
-
product_id: "variant_index" in display ? display.variant_displays[display.variant_index].product_id : display.product_id
|
|
5020
|
-
});
|
|
5021
|
-
};
|
|
5022
|
-
$7fe962cfdca74c2f$var$push_function($7fe962cfdca74c2f$export$e9106d6e723510d2, handler);
|
|
5023
|
-
info.register_event_listener("click", handler, {
|
|
5024
|
-
once: true
|
|
5025
|
-
});
|
|
5026
|
-
return elements;
|
|
5027
|
-
}
|
|
5028
|
-
function $7fe962cfdca74c2f$export$32eb5dd18e963410(elements, display, info) {
|
|
5029
|
-
const {
|
|
5030
|
-
search_result_id: search_result_id
|
|
5031
|
-
} = display;
|
|
5032
|
-
const {
|
|
5033
|
-
product_id: product_id,
|
|
5034
|
-
recommendation_id: recommendation_id
|
|
5035
|
-
} = "variant_index" in display ? display.variant_displays[display.variant_index] : display;
|
|
5036
|
-
if (!(elements !== null && elements !== void 0 && elements.length)) return elements;
|
|
5037
|
-
for (const element of elements) {
|
|
5038
|
-
const handler = $1ea91dfed6983398$export$82a685f2da2fb027(element, product_id, recommendation_id || search_result_id);
|
|
5039
|
-
if (handler) $7fe962cfdca74c2f$var$push_function($7fe962cfdca74c2f$export$32eb5dd18e963410, handler);
|
|
5040
|
-
}
|
|
5041
|
-
return elements;
|
|
5042
|
-
}
|
|
5043
|
-
function $7fe962cfdca74c2f$export$dd32cb565eae0a1f(elements, display, info) {
|
|
5044
|
-
const handler = () => {
|
|
5045
|
-
$99b61a0622560fcf$export$127751e82111fcf();
|
|
5046
|
-
};
|
|
5047
|
-
$7fe962cfdca74c2f$var$push_function($7fe962cfdca74c2f$export$dd32cb565eae0a1f, handler);
|
|
5048
|
-
info.register_event_listener("click", handler, {
|
|
5049
|
-
once: true
|
|
5050
|
-
});
|
|
5051
|
-
return elements;
|
|
5052
|
-
}
|
|
5053
|
-
function $7fe962cfdca74c2f$var$push_function(fn1, handler) {
|
|
5054
|
-
const fn_array = $7fe962cfdca74c2f$export$ed8a68dacd075983.get(fn1) || [];
|
|
5055
|
-
fn_array.push(new WeakRef(handler));
|
|
5056
|
-
$7fe962cfdca74c2f$export$ed8a68dacd075983.set(fn1, fn_array);
|
|
5057
|
-
}
|
|
5058
|
-
const $8884ea38c83d7452$export$deca40f48c0569f8 = typeof window === "undefined" ? false : /*@__PURE__*/localStorage.getItem("colorize-logics") === "true";
|
|
5059
|
-
function $8884ea38c83d7452$export$16501883f477737a(elements, display) {
|
|
5060
|
-
elements.forEach(elem => {
|
|
5061
|
-
if (elem.nodeType !== Node.TEXT_NODE) {
|
|
5062
|
-
var _elem$setAttribute, _elem$setAttribute2;
|
|
5063
|
-
// calc a hash for given string
|
|
5064
|
-
const hc = function () {
|
|
5065
|
-
let str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
5066
|
-
let hash = 0;
|
|
5067
|
-
if (str.length === 0) return hash;
|
|
5068
|
-
for (let i = 0; i < str.length; i++) {
|
|
5069
|
-
const chr = str.charCodeAt(i);
|
|
5070
|
-
hash = (hash << 5) - hash + chr;
|
|
5071
|
-
hash |= 0;
|
|
5072
|
-
}
|
|
5073
|
-
return hash;
|
|
5074
|
-
};
|
|
5075
|
-
const hash = hc(display.logic);
|
|
5076
|
-
// Change hue based on hash
|
|
5077
|
-
const color = "hsl(" + hash % 360 + ",100%,75%)";
|
|
5078
|
-
if ("style" in elem) elem.style.background = color;
|
|
5079
|
-
// @ts-ignore
|
|
5080
|
-
elem === null || elem === void 0 || (_elem$setAttribute = elem.setAttribute) === null || _elem$setAttribute === void 0 || _elem$setAttribute.call(elem, "data-logic", display.logic);
|
|
5081
|
-
// @ts-ignore
|
|
5082
|
-
elem === null || elem === void 0 || (_elem$setAttribute2 = elem.setAttribute) === null || _elem$setAttribute2 === void 0 || _elem$setAttribute2.call(elem, "title", "Logic: " + display.logic);
|
|
5083
|
-
}
|
|
5084
|
-
});
|
|
5085
|
-
return elements;
|
|
5086
|
-
}
|
|
5087
|
-
var $9eba3ee394000bb7$export$2e2bcd8739ae039 = $9eba3ee394000bb7$export$50ce83ace0cdd87e;
|
|
5088
|
-
async function $9eba3ee394000bb7$export$50ce83ace0cdd87e(t, rendering_options) {
|
|
5089
|
-
const {
|
|
5090
|
-
view_tracking: view_tracking,
|
|
5091
|
-
click_tracking: click_tracking
|
|
5092
|
-
} = rendering_options;
|
|
5093
|
-
return await $8f0d01ff20cfba68$export$a9fc160c5ed83bd7(t, {
|
|
5094
|
-
...rendering_options,
|
|
5095
|
-
headers: {
|
|
5096
|
-
...((0, $8884ea38c83d7452$export$deca40f48c0569f8) ? {
|
|
5097
|
-
"x-debug": "true"
|
|
5098
|
-
} : {}),
|
|
5099
|
-
...(rendering_options.headers || {})
|
|
5100
|
-
},
|
|
5101
|
-
pre_processors: [...(rendering_options.pre_processors || [])],
|
|
5102
|
-
post_processors: [...(Array.isArray(view_tracking) ? view_tracking : (0, $7fe962cfdca74c2f$export$f37c58ab3d3e3b75)), ...(Array.isArray(click_tracking) ? click_tracking : (0, $7fe962cfdca74c2f$export$6830ae1fbe21e589)), ...((0, $8884ea38c83d7452$export$deca40f48c0569f8) ? [(0, $8884ea38c83d7452$export$16501883f477737a)] : []), ...(rendering_options.post_processors || [])]
|
|
5103
|
-
});
|
|
5104
|
-
}
|
|
5105
|
-
async function $61a203c77123a21c$export$cab8bc58c64c2013(t, rendering_options, options_for_us, slider_options) {
|
|
5106
|
-
options_for_us || (options_for_us = {});
|
|
5107
|
-
const {
|
|
5108
|
-
root_selector: root_selector,
|
|
5109
|
-
override_rec_renderer: local_rr = (0, $9eba3ee394000bb7$export$2e2bcd8739ae039),
|
|
5110
|
-
insertion_verb = "replaceWith",
|
|
5111
|
-
lazyfier_options: lazyfier_options
|
|
5112
|
-
} = options_for_us;
|
|
5113
|
-
let {
|
|
5114
|
-
container: container
|
|
5115
|
-
} = options_for_us;
|
|
5116
|
-
if (typeof container == "string") container = [...$8b27923e1d1e6b99$export$44951404cb8d0583(container)];
|
|
5117
|
-
if (container && !Array.isArray(container)) container = [...container];
|
|
5118
|
-
const slider = new (0, $817cb0cb4b98187e$export$68babfc5be0de5da)({
|
|
5119
|
-
dist_to_hide_left: 10,
|
|
5120
|
-
dist_to_hide_right: 10,
|
|
5121
|
-
...slider_options
|
|
5122
|
-
}, lazyfier_options);
|
|
5123
|
-
const recs = await local_rr(t, {
|
|
5124
|
-
...rendering_options,
|
|
5125
|
-
post_processors: [(elements, display) => {
|
|
5126
|
-
$8b27923e1d1e6b99$export$5e63aea0cac01fa0(elements, ".rec_outer").forEach(ro => ro.classList.add("noautospacing"));
|
|
5127
|
-
return elements;
|
|
5128
|
-
}, ...(rendering_options.post_processors || [])]
|
|
5129
|
-
});
|
|
5130
|
-
if (!recs.elements) {
|
|
5131
|
-
$7f95f77417d06249$export$de56f1198d121036("Pro_Slider says bye bye cuz no recs");
|
|
5132
|
-
return {};
|
|
5133
|
-
}
|
|
5134
|
-
slider.insert_here.append(...recs.elements);
|
|
5135
|
-
if (container) {
|
|
5136
|
-
const [root] = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(container, root_selector || ".grid");
|
|
5137
|
-
root[insertion_verb](slider.container);
|
|
5138
|
-
}
|
|
5139
|
-
return {
|
|
5140
|
-
...recs,
|
|
5141
|
-
displays: recs.displays,
|
|
5142
|
-
elements: container ? container : [slider.container]
|
|
5143
|
-
};
|
|
5144
|
-
}
|
|
5145
|
-
function $a782ed55f4206a68$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
5146
|
-
$a782ed55f4206a68$var$_checkPrivateRedeclaration(obj, privateMap);
|
|
5147
|
-
privateMap.set(obj, value);
|
|
5148
|
-
}
|
|
5149
|
-
function $a782ed55f4206a68$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
5150
|
-
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
5151
|
-
}
|
|
5152
|
-
const $a782ed55f4206a68$var$discountMatcher = /{DISCOUNT{([\s\S]+?)}}/g;
|
|
5153
|
-
const $a782ed55f4206a68$var$noDiscountMatcher = /{NODISCOUNT{([\s\S]+?)}}/g;
|
|
5154
|
-
let $a782ed55f4206a68$var$pageview_sent = false;
|
|
5155
|
-
/**
|
|
5156
|
-
* @deprecated Please use recommendation renderer instead
|
|
5157
|
-
*/
|
|
5158
|
-
var $a782ed55f4206a68$var$_dispatched_recs_inserted = /*#__PURE__*/new WeakMap();
|
|
5159
|
-
class $a782ed55f4206a68$export$1a8782481a9af507 {
|
|
5160
|
-
constructor(settings) {
|
|
5161
|
-
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "settings", void 0);
|
|
5162
|
-
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "data", void 0);
|
|
5163
|
-
$parcel$interopDefault($lMD39$babelruntimehelpersdefineProperty)(this, "tracker", void 0);
|
|
5164
|
-
$a782ed55f4206a68$var$_classPrivateFieldInitSpec(this, $a782ed55f4206a68$var$_dispatched_recs_inserted, {
|
|
5165
|
-
writable: true,
|
|
5166
|
-
value: false
|
|
5167
|
-
});
|
|
5168
|
-
this.settings = settings;
|
|
5169
|
-
}
|
|
5170
|
-
init(callback, existingDisplays) {
|
|
5171
|
-
if (!this.settings.DNT) this.trackPageView();
|
|
5172
|
-
if (!existingDisplays) this.loadRecommendations(callback);else {
|
|
5173
|
-
this.data = existingDisplays;
|
|
5174
|
-
callback();
|
|
5175
|
-
}
|
|
5176
|
-
}
|
|
5177
|
-
loadRecommendations(callback) {
|
|
5178
|
-
const {
|
|
5179
|
-
tenant: tenant,
|
|
5180
|
-
product_id: product_id,
|
|
5181
|
-
type: type,
|
|
5182
|
-
market: market
|
|
5183
|
-
} = this.settings;
|
|
5184
|
-
$d72c9a0d8e9c5a95$export$1bc0df10745d5412(
|
|
5185
|
-
// @ts-ignore - Quick workaround, as we don't have a tenant object here
|
|
5186
|
-
{
|
|
5187
|
-
tenant: tenant,
|
|
5188
|
-
market: market
|
|
5189
|
-
}, {
|
|
5190
|
-
type: type,
|
|
5191
|
-
product_id: product_id()
|
|
5192
|
-
}).then(recs => {
|
|
5193
|
-
this.data = recs;
|
|
5194
|
-
$954922240a743f34$export$8582cf3716962dc2({
|
|
5195
|
-
...this.settings,
|
|
5196
|
-
recs: this.data,
|
|
5197
|
-
min_recs: this.settings.min_items || this.settings.max_items
|
|
5198
|
-
});
|
|
5199
|
-
}).catch(e => {
|
|
5200
|
-
if (this.settings.debug) console.warn("template-tool: error fetching: ", e);
|
|
5201
|
-
}).finally(() => callback());
|
|
5202
|
-
}
|
|
5203
|
-
trackGAEvent(action, index, product_id, ga_product_ids) {
|
|
5204
|
-
if (this.settings.sendGa === false) return;
|
|
5205
|
-
// @ts-ignore
|
|
5206
|
-
if (typeof ga !== "function") {
|
|
5207
|
-
console.log("Could not send", action, "to GA. analytics.js not loaded.");
|
|
5208
|
-
return;
|
|
5209
|
-
}
|
|
5210
|
-
if (!action || action instanceof Event) action = "rec_bar_click";
|
|
5211
|
-
if (action == "rec_bar_click" && typeof index != "undefined" && product_id) {
|
|
5212
|
-
if (Array.isArray(ga_product_ids)) for (const id of ga_product_ids) $99b61a0622560fcf$export$f522672c9379e339(id, index, {
|
|
5213
|
-
list_name: "depict_" + this.settings.type
|
|
5214
|
-
});else $99b61a0622560fcf$export$f522672c9379e339(product_id, index, {
|
|
5215
|
-
list_name: "depict_" + this.settings.type
|
|
5216
|
-
});
|
|
5217
|
-
}
|
|
5218
|
-
if (this.tracker === undefined)
|
|
5219
|
-
// @ts-ignore
|
|
5220
|
-
this.tracker = ga("create", this.settings.gaid, "auto", "depict");
|
|
5221
|
-
$99b61a0622560fcf$export$f75172d2e289cd02(action);
|
|
5222
|
-
}
|
|
5223
|
-
trackPageView() {
|
|
5224
|
-
if ($a782ed55f4206a68$var$pageview_sent) {
|
|
5225
|
-
if (this.settings.debug) console.log("template-tool: not sending page view tracking to depict as it has already been sent");
|
|
5226
|
-
return;
|
|
5227
|
-
}
|
|
5228
|
-
$a782ed55f4206a68$var$pageview_sent = true;
|
|
5229
|
-
const {
|
|
5230
|
-
product_id: product_id
|
|
5231
|
-
} = this.settings;
|
|
5232
|
-
$c15d2edce69e632a$export$eee4c4d924348b05(typeof product_id === "function" ? product_id() : product_id);
|
|
5233
|
-
}
|
|
5234
|
-
trackClick(index) {
|
|
5235
|
-
const item = this.data[index];
|
|
5236
|
-
if (item === undefined) return;
|
|
5237
|
-
return $335c248bb07a3509$export$15f8a0cd5a8c0ebb({
|
|
5238
|
-
...this.settings,
|
|
5239
|
-
...item,
|
|
5240
|
-
click_location: "".concat(this.settings.type, "_").concat(index + 1),
|
|
5241
|
-
product_id: item.product_id || this.settings.product_id(item.page_url)
|
|
5242
|
-
});
|
|
5243
|
-
}
|
|
5244
|
-
trackAddToCart(pId) {
|
|
5245
|
-
return $335c248bb07a3509$export$9028351cb994757e({
|
|
5246
|
-
...this.settings,
|
|
5247
|
-
product_id: pId && !(pId instanceof Event) ? pId : this.settings.product_id()
|
|
5248
|
-
});
|
|
5249
|
-
}
|
|
5250
|
-
createContainer(root, container) {
|
|
5251
|
-
let prepend = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
5252
|
-
function htmlToElements(html) {
|
|
5253
|
-
const template = document.createElement("template");
|
|
5254
|
-
template.innerHTML = html;
|
|
5255
|
-
return template.content.childNodes;
|
|
5256
|
-
}
|
|
5257
|
-
const elements = Array.from(htmlToElements(container));
|
|
5258
|
-
if (prepend) {
|
|
5259
|
-
elements.reverse();
|
|
5260
|
-
for (const el of elements) root.prepend(el);
|
|
5261
|
-
} else for (const el of elements) root.appendChild(el);
|
|
5262
|
-
}
|
|
5263
|
-
renderTemplate() {
|
|
5264
|
-
let {
|
|
5265
|
-
prep: prep,
|
|
5266
|
-
root: root,
|
|
5267
|
-
template: template,
|
|
5268
|
-
itemPreprocessor: itemPreprocessor,
|
|
5269
|
-
itemPostprocessor: itemPostprocessor
|
|
5270
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.settings;
|
|
5271
|
-
if (document._depict_modify !== true) {
|
|
5272
|
-
if (this.settings.debug) console.warn("Template-tool: not running because document._depict_modify is false!", this);
|
|
5273
|
-
return;
|
|
5274
|
-
}
|
|
5275
|
-
if (!this.data) return;
|
|
5276
|
-
const product_id_at_rendering = this.settings.product_id();
|
|
5277
|
-
if (typeof prep === "function") prep();
|
|
5278
|
-
const interpolator = t => {
|
|
5279
|
-
return function (item) {
|
|
5280
|
-
// Conditional statements
|
|
5281
|
-
// {if VAR_NAME}
|
|
5282
|
-
// print this if true
|
|
5283
|
-
// {else}
|
|
5284
|
-
// print this if false
|
|
5285
|
-
// {end}
|
|
5286
|
-
// Note: these can't be nested
|
|
5287
|
-
t = t.replace(/{if\s+(.+?)}([\S\s]*?)(?:{else}([\S\s]*?))?{end}/g, (_, variable, if_yes, if_no) => {
|
|
5288
|
-
if (typeof if_no !== "string")
|
|
5289
|
-
// if_no is a number if there's no {else} statement
|
|
5290
|
-
if_no = "";
|
|
5291
|
-
return item[variable] ? if_yes : if_no;
|
|
5292
|
-
});
|
|
5293
|
-
return t.replace(/\${(.*?)}/g, (_, g) => item[g]); // this is copied from here, I hope I'm not breaking any licenses. Need it to transpile for IE11 compatiblity: https://github.com/mikemaccana/dynamic-template/blob/master/index.js
|
|
5294
|
-
// if you need variables that go over multiple lines:
|
|
5295
|
-
// const matcher = /\${([^}]+)}/g;
|
|
5296
|
-
};
|
|
5297
|
-
};
|
|
5298
|
-
|
|
5299
|
-
const elementsFromHTML = html => new DOMParser().parseFromString(html, "text/html").body.children;
|
|
5300
|
-
const getContent = () => {
|
|
5301
|
-
const recsArray = [];
|
|
5302
|
-
const resultingElements = [];
|
|
5303
|
-
this.data.forEach((item, rec_index) => {
|
|
5304
|
-
if (typeof itemPreprocessor === "function") {
|
|
5305
|
-
item = itemPreprocessor(item, rec_index);
|
|
5306
|
-
if (!Object.keys(item).length) {
|
|
5307
|
-
if (this.settings.debug) console.info("template-tool: discarding display", item, "because it is empty");
|
|
3127
|
+
class $817cb0cb4b98187e$export$68babfc5be0de5da extends (0, $08a94efe56c2b35f$export$692b27c28639e5b9) {
|
|
3128
|
+
constructor(options, lazyfier_options) {
|
|
3129
|
+
super(options);
|
|
3130
|
+
const lazy_promise = new Promise(r => {
|
|
3131
|
+
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(this.insert_here, _ref => {
|
|
3132
|
+
let {
|
|
3133
|
+
element: element,
|
|
3134
|
+
disconnector: disconnector
|
|
3135
|
+
} = _ref;
|
|
3136
|
+
const i_o = new IntersectionObserver($3b52ccc10510b32a$export$b3bbfd758f11cfa9(records => {
|
|
3137
|
+
for (const record of records) if (record.intersectionRatio > 0) {
|
|
3138
|
+
r(true);
|
|
3139
|
+
i_o.disconnect();
|
|
3140
|
+
disconnector();
|
|
5308
3141
|
return;
|
|
5309
3142
|
}
|
|
5310
|
-
}
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
item.discount = "\u2013".concat(Math.round(100 * (1 - item.sale_price / item.original_price)), "%");
|
|
5317
|
-
} else {
|
|
5318
|
-
itemTemplate = template.replaceAll($a782ed55f4206a68$var$discountMatcher, "").replaceAll($a782ed55f4206a68$var$noDiscountMatcher, "$1");
|
|
5319
|
-
item.discount = "";
|
|
5320
|
-
}
|
|
5321
|
-
const resultHTML = interpolator(itemTemplate)(item);
|
|
5322
|
-
let elements = elementsFromHTML(resultHTML);
|
|
5323
|
-
if (!this.settings.DNT) for (const element of elements) {
|
|
5324
|
-
// recommendations_inserted event
|
|
5325
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).oncreation(element, () => {
|
|
5326
|
-
if (!$parcel$interopDefault($lMD39$babelruntimehelpersclassPrivateFieldGet)(this, $a782ed55f4206a68$var$_dispatched_recs_inserted)) {
|
|
5327
|
-
$parcel$interopDefault($lMD39$babelruntimehelpersclassPrivateFieldSet)(this, $a782ed55f4206a68$var$_dispatched_recs_inserted, true);
|
|
5328
|
-
$335c248bb07a3509$export$82badda1f9923310({
|
|
5329
|
-
...this.settings,
|
|
5330
|
-
product_id: product_id_at_rendering,
|
|
5331
|
-
recommendation_type: this.settings.type,
|
|
5332
|
-
type: "recommendations_inserted"
|
|
5333
|
-
});
|
|
5334
|
-
}
|
|
5335
|
-
});
|
|
5336
|
-
const listener = e => {
|
|
5337
|
-
this.trackClick(rec_index);
|
|
5338
|
-
this.trackGAEvent("rec_bar_click", rec_index, item.ga_product_id || item.product_id || this.settings.product_id(item.page_url), item.ga_product_ids);
|
|
5339
|
-
};
|
|
5340
|
-
element.addEventListener("click", listener);
|
|
5341
|
-
$1ea91dfed6983398$export$82a685f2da2fb027(element, item.product_id, item.recommendation_id);
|
|
5342
|
-
if (this.settings.shade) $7c971cc277292c10$export$6ebd242c09192cec(element);
|
|
5343
|
-
// @ts-ignore
|
|
5344
|
-
if (!element.depict_event_listeners)
|
|
5345
|
-
// @ts-ignore
|
|
5346
|
-
element.depict_event_listeners = [];
|
|
5347
|
-
// @ts-ignore
|
|
5348
|
-
element.depict_event_listeners.push(listener);
|
|
5349
|
-
}
|
|
5350
|
-
if (typeof itemPostprocessor === "function") elements = itemPostprocessor(elements, item);
|
|
5351
|
-
resultingElements.push(...elements);
|
|
5352
|
-
});
|
|
5353
|
-
this.data = recsArray;
|
|
5354
|
-
if (!this.settings.DNT) $99b61a0622560fcf$export$7babcd5d4056b2ca(recsArray, this.settings.product_id, {
|
|
5355
|
-
list_name: "depict_" + this.settings.type
|
|
3143
|
+
}),
|
|
3144
|
+
// Fixes https://gitlab.com/depict-ai/depict.ai/-/merge_requests/5816/diffs, don't understand why
|
|
3145
|
+
{
|
|
3146
|
+
threshold: $4e1f5263dceb9802$export$f8ea2e7b15b5d129(10)
|
|
3147
|
+
});
|
|
3148
|
+
i_o.observe(element);
|
|
5356
3149
|
});
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
let MAX_RETRY = Math.round(10000 / SLEEP_TIME_MS);
|
|
5364
|
-
const tick = setInterval(() => {
|
|
5365
|
-
const r = root();
|
|
5366
|
-
if (MAX_RETRY === 0) clearInterval(tick);
|
|
5367
|
-
MAX_RETRY--;
|
|
5368
|
-
if (r !== null) {
|
|
5369
|
-
r.append(...renderedContent);
|
|
5370
|
-
clearInterval(tick);
|
|
5371
|
-
}
|
|
5372
|
-
}, SLEEP_TIME_MS);
|
|
5373
|
-
} else if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", () => {
|
|
5374
|
-
const r = root();
|
|
5375
|
-
r.append(...renderedContent);
|
|
5376
|
-
}, {
|
|
5377
|
-
once: true
|
|
5378
|
-
});else {
|
|
5379
|
-
const r = root();
|
|
5380
|
-
r.append(...renderedContent);
|
|
5381
|
-
}
|
|
5382
|
-
return;
|
|
5383
|
-
}
|
|
5384
|
-
root.append(...renderedContent);
|
|
3150
|
+
});
|
|
3151
|
+
this.lazyfier = new (0, $bc463df3122a418b$export$3be7054c61590ee3)({
|
|
3152
|
+
container: this.insert_here,
|
|
3153
|
+
wait_for_dominsertion: lazy_promise,
|
|
3154
|
+
...(lazyfier_options || {})
|
|
3155
|
+
});
|
|
5385
3156
|
}
|
|
5386
3157
|
}
|
|
5387
|
-
var
|
|
5388
|
-
/**
|
|
5389
|
-
* @deprecated Please use RecommendationRenderer instead
|
|
5390
|
-
*/
|
|
5391
|
-
$ebe64dbcfb106f16$export$2e2bcd8739ae039 = async options => {
|
|
5392
|
-
const depict = new (0, $a782ed55f4206a68$export$1a8782481a9af507)(options.options),
|
|
5393
|
-
done = new Promise(itsdone => {
|
|
5394
|
-
document._depict_modify = true;
|
|
5395
|
-
depict.init(() => {
|
|
5396
|
-
depict.renderTemplate({
|
|
5397
|
-
itemPostprocessor: options.postProcessor,
|
|
5398
|
-
itemPreprocessor: options.preProcessor,
|
|
5399
|
-
root: options.root,
|
|
5400
|
-
template: options.template
|
|
5401
|
-
});
|
|
5402
|
-
itsdone();
|
|
5403
|
-
}, options.recs);
|
|
5404
|
-
});
|
|
5405
|
-
await done;
|
|
5406
|
-
return depict;
|
|
5407
|
-
};
|
|
5408
|
-
|
|
5409
|
-
// @ts-ignore
|
|
5410
|
-
var $d64ae53fcd29bba1$exports = {};
|
|
5411
|
-
$d64ae53fcd29bba1$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";
|
|
5412
3158
|
const $3f49f9b73bfc2a38$var$default_image_src = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjYsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5Z29uIHBvaW50cz0iOSwyLjYgOC4zLDMuNCAxMi40LDcuNSAxLjYsNy41IDEuNiw4LjUgMTIuNCw4LjUgOC4zLDEyLjYgOSwxMy40IDE0LjQsOCAiLz4NCjwvc3ZnPg0K";
|
|
5413
3159
|
class $3f49f9b73bfc2a38$export$4d41c6499d53639c extends (0, $817cb0cb4b98187e$export$68babfc5be0de5da) {
|
|
5414
3160
|
constructor(static_options, override_lazyfier_options) {
|
|
@@ -5440,233 +3186,33 @@ class $3f49f9b73bfc2a38$export$4d41c6499d53639c extends (0, $817cb0cb4b98187e$ex
|
|
|
5440
3186
|
function $3f49f9b73bfc2a38$export$f1b8b9fd75ddcab1(slider) {
|
|
5441
3187
|
const style_elem = document.createElement("style");
|
|
5442
3188
|
style_elem.type = "text/css";
|
|
5443
|
-
style_elem.append((0, /*@__PURE__*/$parcel$interopDefault($
|
|
3189
|
+
style_elem.append((0, /*@__PURE__*/$parcel$interopDefault($22c667835a3196a9$exports)));
|
|
5444
3190
|
slider.container.appendChild(style_elem);
|
|
5445
3191
|
}
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
dist_to_hide_right: 6,
|
|
5467
|
-
...slider_options
|
|
5468
|
-
}, override_lazyfier_options);
|
|
5469
|
-
const recs = await local_rr(t, {
|
|
5470
|
-
...rendering_options,
|
|
5471
|
-
post_processors: [(elements, display) => {
|
|
5472
|
-
$8b27923e1d1e6b99$export$5e63aea0cac01fa0(elements, "a.rec_outer").forEach(ro => ro.classList.add("noautospacing"));
|
|
5473
|
-
return elements;
|
|
5474
|
-
}, ...(rendering_options.post_processors || [])]
|
|
5475
|
-
});
|
|
5476
|
-
if (!recs.elements) {
|
|
5477
|
-
dlog("RR_Slider says bye bye cuz no recs");
|
|
5478
|
-
return {};
|
|
5479
|
-
}
|
|
5480
|
-
slider.insert_here.append(...recs.elements);
|
|
5481
|
-
if (container) {
|
|
5482
|
-
const [root] = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(container, root_selector || ".grid");
|
|
5483
|
-
root[insertion_verb](slider.container);
|
|
5484
|
-
}
|
|
5485
|
-
return {
|
|
5486
|
-
...recs,
|
|
5487
|
-
displays: recs.displays,
|
|
5488
|
-
elements: container ? container : [slider.container]
|
|
5489
|
-
};
|
|
5490
|
-
}
|
|
5491
|
-
var $14c1124272475590$var$_tmpl$ = ["<button", ' class="load_more">', "</button>"];
|
|
5492
|
-
async function $14c1124272475590$export$30933c637c977eef(_ref) {
|
|
5493
|
-
var _template_tool$data;
|
|
5494
|
-
let {
|
|
5495
|
-
t: t,
|
|
5496
|
-
recs: recs,
|
|
5497
|
-
title: title,
|
|
5498
|
-
infinite_scroll = false,
|
|
5499
|
-
with_slider = false,
|
|
5500
|
-
with_loadmore = false,
|
|
5501
|
-
template_tool_options: template_tool_options,
|
|
5502
|
-
slider_options = {},
|
|
5503
|
-
pre_processors = [],
|
|
5504
|
-
post_processors = [],
|
|
5505
|
-
container_template: container_template,
|
|
5506
|
-
template:
|
|
5507
|
-
// container template
|
|
5508
|
-
template,
|
|
5509
|
-
// recommendation template
|
|
5510
|
-
chunk_size_for_load_more = 4,
|
|
5511
|
-
insertion_promise: insertion_promise,
|
|
5512
|
-
view_more_text: view_more_text
|
|
5513
|
-
} = _ref;
|
|
5514
|
-
const {
|
|
5515
|
-
catchify: catchify,
|
|
5516
|
-
dlog: dlog
|
|
5517
|
-
} = t,
|
|
5518
|
-
container = [...$8b27923e1d1e6b99$export$44951404cb8d0583(container_template)],
|
|
5519
|
-
root = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(container, ".grid")[0],
|
|
5520
|
-
internal_pre_processors = [...pre_processors],
|
|
5521
|
-
// copy arrays so we don't unintentionally modify an array of a script calling us when doing auto postprocessor for slider if insertion_promise is defined
|
|
5522
|
-
internal_post_processors = [...post_processors];
|
|
5523
|
-
if (with_slider) var slider = catchify(() => new (0, $3f49f9b73bfc2a38$export$4d41c6499d53639c)({
|
|
5524
|
-
...t,
|
|
5525
|
-
arrow_image: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJkaXNwbGF5OiBpbmxpbmUtYmxvY2s7IHZlcnRpY2FsLWFsaWduOiBtaWRkbGU7IiB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgOCAxNSI+PHBhdGggc3R5bGU9ImZpbGw6IHJnYigwLCAwLCAwKTsiIGQ9Ik0uNjI5LjAwMWMuMTUuMDA4LjI5My4wNzIuMzk4LjE4bDYuNzkyIDYuODlhLjYwMS42MDEgMCAwIDEgMCAuODZsLTYuNzkyIDYuODg4YS41ODYuNTg2IDAgMCAxLS44NDYgMCAuNjAxLjYwMSAwIDAgMSAwLS44Nkw2LjU1NCA3LjUuMjExIDEuMDAxYS42MDEuNjAxIDAgMCAxIDAtLjg2Yy4xMTUtLjEuMjY2LS4xNS40MTgtLjE0Ij48L3BhdGg+PC9zdmc+",
|
|
5526
|
-
...slider_options
|
|
5527
|
-
}))();
|
|
5528
|
-
if (slider) {
|
|
5529
|
-
root.replaceWith(slider.container);
|
|
5530
|
-
if (insertion_promise) internal_post_processors.push((t, items, d) => {
|
|
5531
|
-
for (const item of items) insertion_promise.then(() => {
|
|
5532
|
-
$89969f18db4020d7$export$37125ccc5dd98050({
|
|
5533
|
-
element: item,
|
|
5534
|
-
data: {
|
|
5535
|
-
tenant: t.tenant,
|
|
5536
|
-
entity_price: d.entity_price,
|
|
5537
|
-
recommendation_id: d.recommendation_id,
|
|
5538
|
-
market: t.market,
|
|
5539
|
-
product_id: d.product_id,
|
|
5540
|
-
recommendation_type: d.recommendation_type
|
|
5541
|
-
},
|
|
5542
|
-
wait_for_dom_insertion: false
|
|
5543
|
-
});
|
|
5544
|
-
});
|
|
5545
|
-
return items;
|
|
5546
|
-
});
|
|
5547
|
-
}
|
|
5548
|
-
if (!slider || !insertion_promise) internal_post_processors.push((t, items, d) => {
|
|
5549
|
-
for (const item of items) $89969f18db4020d7$export$37125ccc5dd98050({
|
|
5550
|
-
element: item,
|
|
5551
|
-
data: {
|
|
5552
|
-
tenant: t.tenant,
|
|
5553
|
-
entity_price: d.entity_price,
|
|
5554
|
-
recommendation_id: d.recommendation_id,
|
|
5555
|
-
market: t.market,
|
|
5556
|
-
product_id: d.product_id,
|
|
5557
|
-
recommendation_type: d.recommendation_type
|
|
5558
|
-
},
|
|
5559
|
-
wait_for_dom_insertion: false
|
|
5560
|
-
});
|
|
5561
|
-
return items;
|
|
5562
|
-
});
|
|
5563
|
-
const template_tool = await $ebe64dbcfb106f16$export$2e2bcd8739ae039({
|
|
5564
|
-
options: {
|
|
5565
|
-
...t,
|
|
5566
|
-
...(template_tool_options || {})
|
|
5567
|
-
},
|
|
5568
|
-
root: slider ? slider.insert_here : root,
|
|
5569
|
-
recs: recs,
|
|
5570
|
-
template: template,
|
|
5571
|
-
preProcessor: (d, i) => {
|
|
5572
|
-
return internal_pre_processors.reduce((accumulator, currentValue) => {
|
|
5573
|
-
// basic pre processor pipeline
|
|
5574
|
-
return catchify(currentValue)(t, accumulator, i, with_loadmore, with_slider, infinite_scroll) || accumulator;
|
|
5575
|
-
}, d);
|
|
5576
|
-
},
|
|
5577
|
-
postProcessor: (items, d) => {
|
|
5578
|
-
return internal_post_processors.reduce((accumulator, currentValue) => {
|
|
5579
|
-
// basic post processor pipeline
|
|
5580
|
-
return catchify(currentValue)(t, accumulator, d, slider) || accumulator;
|
|
5581
|
-
}, items);
|
|
5582
|
-
}
|
|
5583
|
-
});
|
|
5584
|
-
if (with_loadmore) catchify($14c1124272475590$var$setup_load_more)(t, root, chunk_size_for_load_more, view_more_text);
|
|
5585
|
-
if (infinite_scroll) catchify($14c1124272475590$var$setup_infinite_scroll)(t, root);
|
|
5586
|
-
if (title) {
|
|
5587
|
-
const [title_element] = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(container, "h1.title, h2.title, h3.title, h4.title, h5.title, h6.title");
|
|
5588
|
-
if (title_element) {
|
|
5589
|
-
if (typeof title == "string") title_element.innerText = title;else title_element.replaceWith(...title);
|
|
3192
|
+
|
|
3193
|
+
// not ideal but can help when debugging via sentry
|
|
3194
|
+
/**
|
|
3195
|
+
* A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
|
|
3196
|
+
* @param anything Something to try to serialize - this function is crappy and your mileage may vary
|
|
3197
|
+
* @param depth How deep to go when recursing
|
|
3198
|
+
* @return An object that is somehow closer to text (better serializable by sentry) or text
|
|
3199
|
+
*/
|
|
3200
|
+
function $a1dd43178e1da976$export$39d526a1194b6499(anything, depth) {
|
|
3201
|
+
var _depth;
|
|
3202
|
+
(_depth = depth) !== null && _depth !== void 0 ? _depth : depth = 0;
|
|
3203
|
+
depth++;
|
|
3204
|
+
if (depth > 30) return anything;
|
|
3205
|
+
const output = {};
|
|
3206
|
+
for (const key in anything) {
|
|
3207
|
+
const value = anything[key];
|
|
3208
|
+
let serialized_value;
|
|
3209
|
+
if (value instanceof Element) serialized_value = value.cloneNode(false).outerHTML;else if (value instanceof Headers) serialized_value = Object.fromEntries(value.entries());else if (typeof value == "object" && value != null && (typeof value[Symbol.iterator] === "function" || value instanceof Response)) serialized_value = $a1dd43178e1da976$export$39d526a1194b6499(value, depth);else {
|
|
3210
|
+
var _value$toString;
|
|
3211
|
+
serialized_value = value === null || value === void 0 ? void 0 : (_value$toString = value.toString) === null || _value$toString === void 0 ? void 0 : _value$toString.call(value);
|
|
5590
3212
|
}
|
|
3213
|
+
output[key] = serialized_value;
|
|
5591
3214
|
}
|
|
5592
|
-
|
|
5593
|
-
}
|
|
5594
|
-
function $14c1124272475590$var$setup_infinite_scroll(t, root) {
|
|
5595
|
-
const {
|
|
5596
|
-
dlog: dlog,
|
|
5597
|
-
catchify: catchify
|
|
5598
|
-
} = t,
|
|
5599
|
-
get_last_visible_el = () => [...root.querySelectorAll("a.rec_outer:not(.not_visible)")].slice(-1)[0],
|
|
5600
|
-
last_visible_el = get_last_visible_el();
|
|
5601
|
-
if (!last_visible_el) {
|
|
5602
|
-
dlog("not setting up infinite scroll as there are no elements");
|
|
5603
|
-
return;
|
|
5604
|
-
}
|
|
5605
|
-
const intersection_observer = new IntersectionObserver(catchify(records => {
|
|
5606
|
-
dlog("Intersection observer for", last_visible_el, "has records", records);
|
|
5607
|
-
records.forEach(record => {
|
|
5608
|
-
if (record.isIntersecting && record.target == get_last_visible_el()) {
|
|
5609
|
-
dlog("Loading more recs because of", record);
|
|
5610
|
-
if ($14c1124272475590$var$load_more_elements(root)) $14c1124272475590$var$setup_infinite_scroll(t, root);
|
|
5611
|
-
}
|
|
5612
|
-
});
|
|
5613
|
-
}));
|
|
5614
|
-
dlog("starting to intersection observe", last_visible_el, "for infinite scroll");
|
|
5615
|
-
intersection_observer.observe(last_visible_el);
|
|
5616
|
-
}
|
|
5617
|
-
function $14c1124272475590$var$load_more_elements(root) {
|
|
5618
|
-
let chunk_size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
|
|
5619
|
-
const hidden_elements = root.querySelectorAll("a.rec_outer.not_visible");
|
|
5620
|
-
let i = 0;
|
|
5621
|
-
for (; i < Math.min(hidden_elements.length, chunk_size); i++) {
|
|
5622
|
-
// @ts-ignore
|
|
5623
|
-
hidden_elements[i].load_image();
|
|
5624
|
-
hidden_elements[i].classList.remove("not_visible");
|
|
5625
|
-
}
|
|
5626
|
-
const has_more = i >= chunk_size && hidden_elements.length > chunk_size;
|
|
5627
|
-
return has_more;
|
|
5628
|
-
}
|
|
5629
|
-
function $14c1124272475590$var$setup_load_more(t, root, chunk_size) {
|
|
5630
|
-
let view_more_text = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "Visa mer";
|
|
5631
|
-
const {
|
|
5632
|
-
catchify: catchify
|
|
5633
|
-
} = t,
|
|
5634
|
-
load_more_cont = $8b27923e1d1e6b99$export$d3e2a0560cbf4787('<div class="load-more-container"></div>'),
|
|
5635
|
-
load_button = load_more_cont.appendChild($lMD39$solidjsweb.ssr($14c1124272475590$var$_tmpl$, $lMD39$solidjsweb.ssrHydrationKey(), $lMD39$solidjsweb.escape(view_more_text)));
|
|
5636
|
-
load_button.addEventListener("click", catchify(load_more_recs_and_hide_button_if_needed));
|
|
5637
|
-
root.after(load_more_cont);
|
|
5638
|
-
load_more_recs_and_hide_button_if_needed();
|
|
5639
|
-
function load_more_recs_and_hide_button_if_needed() {
|
|
5640
|
-
if (!$14c1124272475590$var$load_more_elements(root, chunk_size))
|
|
5641
|
-
// there aren't any recs left to display
|
|
5642
|
-
load_button.classList.add("not_visible");
|
|
5643
|
-
}
|
|
5644
|
-
}
|
|
5645
|
-
function $14c1124272475590$export$4f39078bdc72ecd0(_t, d, i, with_loadmore, with_slider, infinite_scroll) {
|
|
5646
|
-
d.class || (d.class = "");
|
|
5647
|
-
if (infinite_scroll) d.class = i >= 4 ? "not_visible" : ""; // this will make it hold image loading until .load_image is called on .rec_outer
|
|
5648
|
-
if (with_loadmore) d.class = "not_visible";
|
|
5649
|
-
d.percentage_off = Math.round(100 - d.sale_price / d.original_price * 100);
|
|
5650
|
-
if (!d.percentage_off || d.percentage_off < 10) d.percentage_off = "";
|
|
5651
|
-
return d;
|
|
5652
|
-
}
|
|
5653
|
-
function $14c1124272475590$export$c410ce1205e5118a(_t, itms, d, slider) {
|
|
5654
|
-
for (const item of itms) {
|
|
5655
|
-
const {
|
|
5656
|
-
image_url: image_url
|
|
5657
|
-
} = d,
|
|
5658
|
-
img = item.querySelector("img.image"),
|
|
5659
|
-
load_image = () => {
|
|
5660
|
-
var _slider$observe;
|
|
5661
|
-
img.src = image_url;
|
|
5662
|
-
slider === null || slider === void 0 || (_slider$observe = slider.observe) === null || _slider$observe === void 0 || _slider$observe.call(slider, img);
|
|
5663
|
-
};
|
|
5664
|
-
if (item.classList.contains("not_visible") || slider)
|
|
5665
|
-
// @ts-ignore
|
|
5666
|
-
item.load_image = load_image;else load_image();
|
|
5667
|
-
if (slider) item.classList.add("noautospacing");
|
|
5668
|
-
}
|
|
5669
|
-
return itms;
|
|
3215
|
+
return output;
|
|
5670
3216
|
}
|
|
5671
3217
|
var
|
|
5672
3218
|
/**
|
|
@@ -5812,6 +3358,35 @@ const $591ebabd2d3823ef$export$68c017fd93791405 = function () {
|
|
|
5812
3358
|
container: container
|
|
5813
3359
|
};
|
|
5814
3360
|
};
|
|
3361
|
+
const $8884ea38c83d7452$export$deca40f48c0569f8 = typeof window === "undefined" ? false : /*@__PURE__*/localStorage.getItem("colorize-logics") === "true";
|
|
3362
|
+
function $8884ea38c83d7452$export$16501883f477737a(elements, display) {
|
|
3363
|
+
elements.forEach(elem => {
|
|
3364
|
+
if (elem.nodeType !== Node.TEXT_NODE) {
|
|
3365
|
+
var _elem$setAttribute, _elem$setAttribute2;
|
|
3366
|
+
// calc a hash for given string
|
|
3367
|
+
const hc = function () {
|
|
3368
|
+
let str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
3369
|
+
let hash = 0;
|
|
3370
|
+
if (str.length === 0) return hash;
|
|
3371
|
+
for (let i = 0; i < str.length; i++) {
|
|
3372
|
+
const chr = str.charCodeAt(i);
|
|
3373
|
+
hash = (hash << 5) - hash + chr;
|
|
3374
|
+
hash |= 0;
|
|
3375
|
+
}
|
|
3376
|
+
return hash;
|
|
3377
|
+
};
|
|
3378
|
+
const hash = hc(display.logic);
|
|
3379
|
+
// Change hue based on hash
|
|
3380
|
+
const color = "hsl(" + hash % 360 + ",100%,75%)";
|
|
3381
|
+
if ("style" in elem) elem.style.background = color;
|
|
3382
|
+
// @ts-ignore
|
|
3383
|
+
elem === null || elem === void 0 || (_elem$setAttribute = elem.setAttribute) === null || _elem$setAttribute === void 0 || _elem$setAttribute.call(elem, "data-logic", display.logic);
|
|
3384
|
+
// @ts-ignore
|
|
3385
|
+
elem === null || elem === void 0 || (_elem$setAttribute2 = elem.setAttribute) === null || _elem$setAttribute2 === void 0 || _elem$setAttribute2.call(elem, "title", "Logic: " + display.logic);
|
|
3386
|
+
}
|
|
3387
|
+
});
|
|
3388
|
+
return elements;
|
|
3389
|
+
}
|
|
5815
3390
|
function $12a8c4258d1dd80f$export$f8913c8a18f7ca21(iterables) {
|
|
5816
3391
|
const ourselves = $76a59c6ce18c8fd3$export$e806c6c1615a59ae();
|
|
5817
3392
|
const values = new Array(iterables.length);
|
|
@@ -6058,100 +3633,6 @@ class $0c2e69f971c62390$var$CSSMeasurement {
|
|
|
6058
3633
|
this.u = unit;
|
|
6059
3634
|
}
|
|
6060
3635
|
}
|
|
6061
|
-
async function $79e67f88d50f1879$export$b0a773486c1c2312(t, recommendation_renderer_options, _ref) {
|
|
6062
|
-
let {
|
|
6063
|
-
container_elements: container_elements,
|
|
6064
|
-
container_selector: container_selector,
|
|
6065
|
-
override_rec_renderer: override_rec_renderer,
|
|
6066
|
-
lazyfier_options = {},
|
|
6067
|
-
eager_images: eager_images,
|
|
6068
|
-
...options_for_grid
|
|
6069
|
-
} = _ref;
|
|
6070
|
-
const [insertion_point] = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(container_elements, container_selector || ".grid");
|
|
6071
|
-
const rendering_result = await (override_rec_renderer || (0, $9eba3ee394000bb7$export$2e2bcd8739ae039))(t, recommendation_renderer_options);
|
|
6072
|
-
const {
|
|
6073
|
-
elements: elements
|
|
6074
|
-
} = rendering_result;
|
|
6075
|
-
if (!elements) return rendering_result;
|
|
6076
|
-
if (!eager_images)
|
|
6077
|
-
// convoluted lazy loading that
|
|
6078
|
-
// when the elements are in the DOM starts IntersectionObserver on whole grid
|
|
6079
|
-
// when grid intersects starts Lazyfier
|
|
6080
|
-
// this is because Lazyfier is fucking stupid
|
|
6081
|
-
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element(insertion_point).then($3b52ccc10510b32a$export$b3bbfd758f11cfa9(element => {
|
|
6082
|
-
let start_lazy_loading;
|
|
6083
|
-
const lazy_loading_promise = new Promise(r => start_lazy_loading = r);
|
|
6084
|
-
const lf = new (0, $bc463df3122a418b$export$3be7054c61590ee3)({
|
|
6085
|
-
only_load_intersecting: true,
|
|
6086
|
-
wait_for_dominsertion: lazy_loading_promise,
|
|
6087
|
-
...lazyfier_options
|
|
6088
|
-
});
|
|
6089
|
-
lf.start_observing_for_new_children_(element);
|
|
6090
|
-
const i_o = new IntersectionObserver($3b52ccc10510b32a$export$b3bbfd758f11cfa9(records => {
|
|
6091
|
-
for (const record of records) if (record.intersectionRatio > 0) {
|
|
6092
|
-
start_lazy_loading();
|
|
6093
|
-
i_o.disconnect();
|
|
6094
|
-
return;
|
|
6095
|
-
}
|
|
6096
|
-
}));
|
|
6097
|
-
i_o.observe(insertion_point);
|
|
6098
|
-
}));
|
|
6099
|
-
insertion_point.append(...elements);
|
|
6100
|
-
$0c2e69f971c62390$export$c84671f46d6a1ca({
|
|
6101
|
-
...options_for_grid,
|
|
6102
|
-
container_element: insertion_point,
|
|
6103
|
-
layout: "grid"
|
|
6104
|
-
}).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
6105
|
-
return {
|
|
6106
|
-
...rendering_result,
|
|
6107
|
-
elements: container_elements
|
|
6108
|
-
};
|
|
6109
|
-
}
|
|
6110
|
-
|
|
6111
|
-
// @ts-ignore
|
|
6112
|
-
var $2f73869d45c5c974$exports = {};
|
|
6113
|
-
$2f73869d45c5c974$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";
|
|
6114
|
-
let $87dd73b8c244f3d2$var$slider_styling_was_inserted = false;
|
|
6115
|
-
async function $87dd73b8c244f3d2$export$82cfdc85a4d15688(t, recommendation_renderer_options, _ref) {
|
|
6116
|
-
let {
|
|
6117
|
-
container_elements: container_elements,
|
|
6118
|
-
container_selector: container_selector,
|
|
6119
|
-
override_rec_renderer: override_rec_renderer,
|
|
6120
|
-
lazyfier_options = {},
|
|
6121
|
-
eager_images: eager_images,
|
|
6122
|
-
grid_spacing: grid_spacing,
|
|
6123
|
-
cols_at_size: cols_at_size,
|
|
6124
|
-
override_vertical_spacing: override_vertical_spacing,
|
|
6125
|
-
rows = "all",
|
|
6126
|
-
...slider_options
|
|
6127
|
-
} = _ref;
|
|
6128
|
-
const [insertion_point] = $8b27923e1d1e6b99$export$5e63aea0cac01fa0(container_elements, container_selector || ".grid");
|
|
6129
|
-
const slider = eager_images ? new (0, $08a94efe56c2b35f$export$692b27c28639e5b9)(slider_options) : new (0, $817cb0cb4b98187e$export$68babfc5be0de5da)(slider_options, lazyfier_options);
|
|
6130
|
-
const rendering_result = await (override_rec_renderer || (0, $9eba3ee394000bb7$export$2e2bcd8739ae039))(t, recommendation_renderer_options);
|
|
6131
|
-
const {
|
|
6132
|
-
elements: elements
|
|
6133
|
-
} = rendering_result;
|
|
6134
|
-
if (!elements) return rendering_result;
|
|
6135
|
-
if (!$87dd73b8c244f3d2$var$slider_styling_was_inserted) {
|
|
6136
|
-
$87dd73b8c244f3d2$var$slider_styling_was_inserted = true;
|
|
6137
|
-
$e45474c7d6e21cfa$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($2f73869d45c5c974$exports)));
|
|
6138
|
-
}
|
|
6139
|
-
insertion_point.replaceWith(slider.container);
|
|
6140
|
-
slider.insert_here.append(...elements);
|
|
6141
|
-
$0c2e69f971c62390$export$c84671f46d6a1ca({
|
|
6142
|
-
grid_spacing: grid_spacing,
|
|
6143
|
-
cols_at_size: cols_at_size,
|
|
6144
|
-
container_element: slider.insert_here,
|
|
6145
|
-
rows: rows,
|
|
6146
|
-
layout: "slider",
|
|
6147
|
-
override_vertical_spacing: override_vertical_spacing
|
|
6148
|
-
}).catch(e => $3b52ccc10510b32a$export$f18d5b0af29128b7([e, "Grid had an error"], "warning"));
|
|
6149
|
-
return {
|
|
6150
|
-
...rendering_result,
|
|
6151
|
-
slider: slider,
|
|
6152
|
-
elements: container_elements
|
|
6153
|
-
};
|
|
6154
|
-
}
|
|
6155
3636
|
function $87effbd9207038ed$export$8cbd8aa1c70f9a13() {
|
|
6156
3637
|
let interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5000;
|
|
6157
3638
|
let timer;
|
|
@@ -6201,16 +3682,11 @@ function $e193cbc89f3a1c6f$export$af88b4929c2dc86() {
|
|
|
6201
3682
|
var $6f926ca76dc3b69a$var$_tmpl$ = ["<label", ' class="checkbox_container"><input type="radio" name="', '"><span class="checkmark"></span></label>'];
|
|
6202
3683
|
function $6f926ca76dc3b69a$export$1d17a045bcc711b1(_ref) {
|
|
6203
3684
|
let {
|
|
6204
|
-
t: t,
|
|
6205
3685
|
navcont_insertion_fn: navcont_insertion_fn,
|
|
6206
3686
|
navdot: navdot,
|
|
6207
3687
|
dontshowonedot = false,
|
|
6208
3688
|
bitesize: bitesize
|
|
6209
3689
|
} = _ref;
|
|
6210
|
-
const {
|
|
6211
|
-
dlog: dlog,
|
|
6212
|
-
catchify: catchify
|
|
6213
|
-
} = t;
|
|
6214
3690
|
const button_states = [];
|
|
6215
3691
|
const unique_name = Math.round(Math.random() * 1000000);
|
|
6216
3692
|
function constructor_plugin() {
|
|
@@ -6251,14 +3727,14 @@ function $6f926ca76dc3b69a$export$1d17a045bcc711b1(_ref) {
|
|
|
6251
3727
|
const position = Math.round(first_shown_element / amount_of_elements * number_of_slides);
|
|
6252
3728
|
const get_inputs = () => navcont.querySelectorAll("input");
|
|
6253
3729
|
if (number_of_radio_buttons != number_of_slides) {
|
|
6254
|
-
|
|
3730
|
+
$7f95f77417d06249$export$de56f1198d121036("Number of buttons doesn't match number of slides, rerendering buttons", button_states);
|
|
6255
3731
|
navcont.innerHTML = "";
|
|
6256
3732
|
if (number_of_slides === 1 && dontshowonedot) {
|
|
6257
|
-
|
|
3733
|
+
$7f95f77417d06249$export$de56f1198d121036("dontshowonedot is on, not rendering any dots");
|
|
6258
3734
|
return;
|
|
6259
3735
|
}
|
|
6260
3736
|
if (number_of_slides == Infinity) {
|
|
6261
|
-
|
|
3737
|
+
$7f95f77417d06249$export$de56f1198d121036("Infinite number of slides, wtf", number_of_slides);
|
|
6262
3738
|
return;
|
|
6263
3739
|
}
|
|
6264
3740
|
for (let i = 0; i < number_of_slides; i++) {
|
|
@@ -6266,10 +3742,10 @@ function $6f926ca76dc3b69a$export$1d17a045bcc711b1(_ref) {
|
|
|
6266
3742
|
const input = a_navdot.querySelector("input");
|
|
6267
3743
|
if (process.env.DEBUG === "true" && !input) throw new Error("You need to provide a navdot that contains an <input> element to slider_dots");
|
|
6268
3744
|
input.checked = button_states[i];
|
|
6269
|
-
input.addEventListener("click",
|
|
3745
|
+
input.addEventListener("click", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => {
|
|
6270
3746
|
e.preventDefault();
|
|
6271
3747
|
e.stopPropagation();
|
|
6272
|
-
|
|
3748
|
+
$7f95f77417d06249$export$de56f1198d121036("Someone checked a box", e);
|
|
6273
3749
|
this.scroll_to_abs(Math.round(amount_of_visible_elements * i));
|
|
6274
3750
|
return false;
|
|
6275
3751
|
}));
|
|
@@ -6304,12 +3780,7 @@ function $6f926ca76dc3b69a$export$a09282b33e69b43f(unique_name) {
|
|
|
6304
3780
|
// });
|
|
6305
3781
|
// });
|
|
6306
3782
|
|
|
6307
|
-
function $c99b1fa9d6971fd3$export$411b0f20794697ce(
|
|
6308
|
-
const {
|
|
6309
|
-
dlog: dlog,
|
|
6310
|
-
catchify: catchify,
|
|
6311
|
-
err: err
|
|
6312
|
-
} = t;
|
|
3783
|
+
function $c99b1fa9d6971fd3$export$411b0f20794697ce() {
|
|
6313
3784
|
function constructor_plugin(slider_options) {
|
|
6314
3785
|
const {
|
|
6315
3786
|
insert_here: sliding
|
|
@@ -6317,7 +3788,7 @@ function $c99b1fa9d6971fd3$export$411b0f20794697ce(t) {
|
|
|
6317
3788
|
let last_mouse_position = 0;
|
|
6318
3789
|
let starting_position = 0;
|
|
6319
3790
|
let block_anchor_clicks = false;
|
|
6320
|
-
sliding.addEventListener("mousedown",
|
|
3791
|
+
sliding.addEventListener("mousedown", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => {
|
|
6321
3792
|
sliding.classList.remove("slider_snap");
|
|
6322
3793
|
const {
|
|
6323
3794
|
snap_style: snap_style
|
|
@@ -6327,7 +3798,7 @@ function $c99b1fa9d6971fd3$export$411b0f20794697ce(t) {
|
|
|
6327
3798
|
last_mouse_position = starting_position = e.clientX;
|
|
6328
3799
|
sliding.addEventListener("mousemove", scroll_on_mousemove);
|
|
6329
3800
|
}));
|
|
6330
|
-
window.addEventListener("mouseup",
|
|
3801
|
+
window.addEventListener("mouseup", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => {
|
|
6331
3802
|
// use window to prevent dragging from getting stuck
|
|
6332
3803
|
sliding.classList.remove("grabbing");
|
|
6333
3804
|
sliding.classList.add("slider_snap");
|
|
@@ -6347,9 +3818,9 @@ function $c99b1fa9d6971fd3$export$411b0f20794697ce(t) {
|
|
|
6347
3818
|
});
|
|
6348
3819
|
}
|
|
6349
3820
|
}));
|
|
6350
|
-
sliding.addEventListener("click",
|
|
3821
|
+
sliding.addEventListener("click", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => {
|
|
6351
3822
|
if (block_anchor_clicks) {
|
|
6352
|
-
|
|
3823
|
+
$7f95f77417d06249$export$de56f1198d121036("Block anchor clicks is true, blocking click", e);
|
|
6353
3824
|
block_anchor_clicks = false;
|
|
6354
3825
|
e.preventDefault();
|
|
6355
3826
|
return false;
|
|
@@ -6366,7 +3837,7 @@ function $c99b1fa9d6971fd3$export$411b0f20794697ce(t) {
|
|
|
6366
3837
|
});
|
|
6367
3838
|
last_mouse_position = clientX;
|
|
6368
3839
|
} catch (e) {
|
|
6369
|
-
|
|
3840
|
+
$46b94b232dc792af$export$8048b892d651b310(e);
|
|
6370
3841
|
}
|
|
6371
3842
|
}
|
|
6372
3843
|
}
|
|
@@ -6650,233 +4121,63 @@ function $4d2c7d8b06c8c95a$export$dac64fd35a4805a4() {
|
|
|
6650
4121
|
mutation_plugin: $3b52ccc10510b32a$export$b3bbfd758f11cfa9(mutation_plugin)
|
|
6651
4122
|
};
|
|
6652
4123
|
}
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
const
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
let touches = 0;
|
|
6668
|
-
let inactive_checker_running = false;
|
|
6669
|
-
let smallest_seen_intersection_ratio = 0.1;
|
|
6670
|
-
let largest_seen_interection_ratio = 0.9;
|
|
6671
|
-
let are_far_right = false;
|
|
6672
|
-
let inactive_checker_timeout;
|
|
6673
|
-
// let elgreen;
|
|
6674
|
-
const check_if_we_inactive = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(function () {
|
|
6675
|
-
var _window2, _window2$performance, _window2$performance$;
|
|
6676
|
-
// const { insert_here: sliding } = this;
|
|
6677
|
-
const now = ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$performance = _window2.performance) === null || _window2$performance === void 0 ? void 0 : (_window2$performance$ = _window2$performance.now) === null || _window2$performance$ === void 0 ? void 0 : _window2$performance$.call(_window2$performance)) || +new Date();
|
|
6678
|
-
const time_since_ran = now - last_move;
|
|
6679
|
-
const last_left_intersection = this.first_intersecting;
|
|
6680
|
-
// dlog(last_left_intersection.intersectionRatio, smallest_seen_intersection_ratio, largest_seen_interection_ratio);
|
|
6681
|
-
if (time_since_ran > time_of_no_events_to_count_as_scroll_idle && !touches && last_left_intersection && (last_left_intersection.intersectionRatio <= smallest_seen_intersection_ratio || last_left_intersection.intersectionRatio >= largest_seen_interection_ratio || are_far_right)) {
|
|
6682
|
-
// if (!elgreen) {
|
|
6683
|
-
// sliding.style.background = "green";
|
|
6684
|
-
// elgreen = true;
|
|
6685
|
-
// }
|
|
6686
|
-
$3b52ccc10510b32a$export$b3bbfd758f11cfa9($69c09f3898892de3$var$scroll_idle)(this, originally_rendered_elements.length, clones_per_side);
|
|
6687
|
-
inactive_checker_running = false;
|
|
6688
|
-
} else {
|
|
6689
|
-
// if (elgreen !== false) {
|
|
6690
|
-
// sliding.style.background = "red";
|
|
6691
|
-
// elgreen = false;
|
|
6692
|
-
// }
|
|
6693
|
-
const timeleft = time_of_no_events_to_count_as_scroll_idle - time_since_ran;
|
|
6694
|
-
if (timeleft < 1) requestAnimationFrame(check_if_we_inactive.bind(this));else setTimeout(check_if_we_inactive.bind(this), timeleft);
|
|
6695
|
-
}
|
|
6696
|
-
});
|
|
6697
|
-
function constructor_plugin() {
|
|
6698
|
-
window.addEventListener("touchstart", () => touches++);
|
|
6699
|
-
window.addEventListener("touchend", () => touches--);
|
|
6700
|
-
this.insert_here.addEventListener("scroll", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(() => {
|
|
6701
|
-
var _window3, _window3$performance, _window3$performance$;
|
|
6702
|
-
last_move = ((_window3 = window) === null || _window3 === void 0 ? void 0 : (_window3$performance = _window3.performance) === null || _window3$performance === void 0 ? void 0 : (_window3$performance$ = _window3$performance.now) === null || _window3$performance$ === void 0 ? void 0 : _window3$performance$.call(_window3$performance)) || +new Date();
|
|
6703
|
-
}));
|
|
6704
|
-
const mo = new MutationObserver($3b52ccc10510b32a$export$b3bbfd758f11cfa9(records => {
|
|
6705
|
-
for (const record of records) for (const node of record.removedNodes) {
|
|
6706
|
-
if (removed_by_us.has(node)) {
|
|
6707
|
-
removed_by_us.delete(node);
|
|
6708
|
-
continue;
|
|
6709
|
-
}
|
|
6710
|
-
for (const a_set of sets_of_els) {
|
|
6711
|
-
const index_in_el_set = a_set.indexOf(node);
|
|
6712
|
-
if (index_in_el_set >= 0) {
|
|
6713
|
-
$7f95f77417d06249$export$de56f1198d121036("Removing", node, "from el set", a_set);
|
|
6714
|
-
a_set.splice(index_in_el_set, 1);
|
|
6715
|
-
}
|
|
6716
|
-
}
|
|
6717
|
-
}
|
|
6718
|
-
}));
|
|
6719
|
-
mo.observe(this.insert_here, {
|
|
6720
|
-
childList: true
|
|
6721
|
-
});
|
|
6722
|
-
}
|
|
6723
|
-
function mutation_plugin(intersections, intersecting_mutations) {
|
|
6724
|
-
var _window4, _window4$performance, _window4$performance$, _intersecting_mutatio;
|
|
6725
|
-
for (let i = 0; i < intersections.length; i++) {
|
|
6726
|
-
const {
|
|
6727
|
-
intersectionRatio: intersectionRatio
|
|
6728
|
-
} = intersections[i];
|
|
6729
|
-
const target_large = intersectionRatio * 0.95;
|
|
6730
|
-
const target_small = intersectionRatio * 1.05;
|
|
6731
|
-
if (target_large > largest_seen_interection_ratio && target_large < 0.999) largest_seen_interection_ratio = target_large;else if (intersectionRatio && target_small < smallest_seen_intersection_ratio && target_small > 0.0001) smallest_seen_intersection_ratio = target_small;
|
|
6732
|
-
}
|
|
6733
|
-
if (mutation_busy) return;
|
|
6734
|
-
mutation_busy = true;
|
|
6735
|
-
last_move = ((_window4 = window) === null || _window4 === void 0 ? void 0 : (_window4$performance = _window4.performance) === null || _window4$performance === void 0 ? void 0 : (_window4$performance$ = _window4$performance.now) === null || _window4$performance$ === void 0 ? void 0 : _window4$performance$.call(_window4$performance)) || +new Date();
|
|
6736
|
-
const first_element = this.element_by_index(0);
|
|
6737
|
-
const second_element = this.element_by_index(1);
|
|
6738
|
-
let dont_wraparound = false;
|
|
6739
|
-
if (!first_element || !second_element) dont_wraparound = true;else {
|
|
6740
|
-
// calculate how many cards including margin the slider fits
|
|
6741
|
-
const first_rect = first_element.getBoundingClientRect();
|
|
6742
|
-
if (!first_rect.width) {
|
|
6743
|
-
$7f95f77417d06249$export$de56f1198d121036(first_rect);
|
|
6744
|
-
throw new Error("First rect doesn't have width");
|
|
6745
|
-
}
|
|
6746
|
-
const second_rect = second_element.getBoundingClientRect();
|
|
6747
|
-
const container_rect = this.insert_here.getBoundingClientRect();
|
|
6748
|
-
const margin = second_rect.left - first_rect.right;
|
|
6749
|
-
let width = 0;
|
|
6750
|
-
let amount = 0;
|
|
6751
|
-
while (width < container_rect.width) {
|
|
6752
|
-
if (width < 0) throw new Error("width can't be < 0");
|
|
6753
|
-
width += first_rect.width + margin;
|
|
6754
|
-
amount++;
|
|
6755
|
-
}
|
|
6756
|
-
// dlog(originally_rendered_elements.length, amount);
|
|
6757
|
-
if (originally_rendered_elements.length <= amount) dont_wraparound = true;
|
|
6758
|
-
}
|
|
6759
|
-
if (dont_wraparound) {
|
|
6760
|
-
if (surplus_in_body) {
|
|
6761
|
-
$7f95f77417d06249$export$de56f1198d121036("Removing surplus of els. Total els: ", sets_of_els);
|
|
6762
|
-
// @ts-ignore
|
|
6763
|
-
for (let i = (sets_of_els.length || 1) - 1; i--;) for (let j = 0; j < sets_of_els[i].length; j++) {
|
|
6764
|
-
const el = sets_of_els[i][j];
|
|
6765
|
-
if ("remove" in el) {
|
|
6766
|
-
removed_by_us.add(el);
|
|
6767
|
-
el.remove();
|
|
6768
|
-
}
|
|
6769
|
-
}
|
|
6770
|
-
this.invalidate_cache();
|
|
6771
|
-
surplus_in_body = false;
|
|
6772
|
-
}
|
|
6773
|
-
mutation_busy = false;
|
|
6774
|
-
return;
|
|
6775
|
-
}
|
|
6776
|
-
if (!surplus_in_body) {
|
|
6777
|
-
$7f95f77417d06249$export$de56f1198d121036("Adding surplus of els");
|
|
6778
|
-
this.insert_here.append(...sets_of_els.slice(0, -1).flat());
|
|
6779
|
-
this.invalidate_cache();
|
|
6780
|
-
surplus_in_body = true;
|
|
6781
|
-
}
|
|
6782
|
-
are_far_right = ((_intersecting_mutatio = intersecting_mutations[this.index_of_last_element]) === null || _intersecting_mutatio === void 0 ? void 0 : _intersecting_mutatio.intersectionRatio) >= largest_seen_interection_ratio;
|
|
6783
|
-
clearTimeout(inactive_checker_timeout);
|
|
6784
|
-
inactive_checker_timeout = setTimeout(function () {
|
|
6785
|
-
if (!inactive_checker_running) {
|
|
6786
|
-
inactive_checker_running = true;
|
|
6787
|
-
check_if_we_inactive.call(this);
|
|
6788
|
-
}
|
|
6789
|
-
}.bind(this), time_of_no_events_to_count_as_scroll_idle * 0.8 // schedule a bit earlier so we hit our target
|
|
6790
|
-
);
|
|
6791
|
-
|
|
6792
|
-
mutation_busy = false;
|
|
4124
|
+
var $8b0f4f54739f2574$var$_globalThis$window;
|
|
4125
|
+
const $8b0f4f54739f2574$export$20e9533e68ee72e7 = /*@__PURE__*/$76a59c6ce18c8fd3$export$e806c6c1615a59ae(false);
|
|
4126
|
+
const $8b0f4f54739f2574$export$a9d39e43ae273d26 = /*@__PURE__*/$76a59c6ce18c8fd3$export$e806c6c1615a59ae();
|
|
4127
|
+
const $8b0f4f54739f2574$export$7500cdfd37aafd43 = /*@__PURE__*/new Set();
|
|
4128
|
+
let $8b0f4f54739f2574$var$old_url;
|
|
4129
|
+
const $8b0f4f54739f2574$var$maybe_navigation = (what_happened, args) => {
|
|
4130
|
+
if (typeof location === "undefined") return;
|
|
4131
|
+
const new_url = location.href;
|
|
4132
|
+
if ($8b0f4f54739f2574$var$old_url !== new_url) {
|
|
4133
|
+
$8b0f4f54739f2574$export$a9d39e43ae273d26(new_url);
|
|
4134
|
+
if ($8b0f4f54739f2574$var$old_url !== undefined)
|
|
4135
|
+
// don't resolve stateless href change ipns with the initial value - it's not a navigation
|
|
4136
|
+
$8b0f4f54739f2574$export$20e9533e68ee72e7(new_url);
|
|
4137
|
+
$8b0f4f54739f2574$var$old_url = new_url;
|
|
6793
4138
|
}
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
while (event_listeners !== null && event_listeners !== void 0 && event_listeners.length) {
|
|
6805
|
-
// order shouldn't matter, this is fast
|
|
6806
|
-
const event_listener = event_listeners.pop();
|
|
6807
|
-
for (let i = 0; i < elements.length; i++) elements[i].addEventListener(...event_listener);
|
|
6808
|
-
}
|
|
6809
|
-
// render all elements again four times and adds them to the beginning
|
|
6810
|
-
const post_processors = [...(rendering_options.post_processors || [])];
|
|
6811
|
-
const our_index = post_processors.indexOf(post_processor);
|
|
6812
|
-
if (our_index >= 0) post_processors.splice(our_index, 1);else {
|
|
6813
|
-
const msg = "Couldn't find ourselves in post processors, infinite loop might ensue. Exiting. Wraparound will be broken.";
|
|
6814
|
-
(0, $902c0e005afb7319$export$af2e17a20c2ea3c5).captureException(new Error(msg));
|
|
6815
|
-
$7f95f77417d06249$export$de56f1198d121036(msg, () => {});
|
|
6816
|
-
return elements;
|
|
6817
|
-
}
|
|
6818
|
-
for (let i = 0; i < clones_per_side * 2; i++) {
|
|
6819
|
-
const additional_render = await $8f0d01ff20cfba68$export$a9fc160c5ed83bd7(info.t, {
|
|
6820
|
-
...rendering_options,
|
|
6821
|
-
post_processors: post_processors,
|
|
6822
|
-
pre_processors: [],
|
|
6823
|
-
// don't need to execute pre processors again, displays are already pre-processed
|
|
6824
|
-
recs: info.displays
|
|
6825
|
-
});
|
|
6826
|
-
sets_of_els.push([...additional_render.elements]);
|
|
6827
|
-
}
|
|
6828
|
-
sets_of_els.reverse(); // here sets_of_els gets modified and reversed
|
|
6829
|
-
const sets_of_els_without_items_1_plus_n_from_first_render = [...sets_of_els];
|
|
6830
|
-
const index_of_first_render = sets_of_els_without_items_1_plus_n_from_first_render.indexOf(originally_rendered_elements);
|
|
6831
|
-
if (index_of_first_render < 0) throw new Error("Something's weird, pls check");
|
|
6832
|
-
sets_of_els_without_items_1_plus_n_from_first_render[index_of_first_render] = elements;
|
|
6833
|
-
// we cannot return the array that _might_ contain the elements from the other rendering passes that run asynchronously, this might lead to duplicated event listeners
|
|
6834
|
-
return sets_of_els_without_items_1_plus_n_from_first_render.flat();
|
|
6835
|
-
} else return elements;
|
|
4139
|
+
for (const fn of $8b0f4f54739f2574$export$7500cdfd37aafd43) fn(what_happened, args);
|
|
4140
|
+
};
|
|
4141
|
+
$8b0f4f54739f2574$export$baccefee4a395d8f((args, what_happened) => $8b0f4f54739f2574$var$maybe_navigation(what_happened, args));
|
|
4142
|
+
$8b0f4f54739f2574$var$maybe_navigation();
|
|
4143
|
+
globalThis === null || globalThis === void 0 || ($8b0f4f54739f2574$var$_globalThis$window = globalThis.window) === null || $8b0f4f54739f2574$var$_globalThis$window === void 0 || $8b0f4f54739f2574$var$_globalThis$window.addEventListener("popstate", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => $8b0f4f54739f2574$var$maybe_navigation("popstate", e)));
|
|
4144
|
+
async function $8b0f4f54739f2574$export$1cd22bab0d2c3b0b(callback) {
|
|
4145
|
+
const catchified_callback = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(callback);
|
|
4146
|
+
for await (const href of $8b0f4f54739f2574$export$20e9533e68ee72e7) {
|
|
4147
|
+
catchified_callback(href);
|
|
4148
|
+
break;
|
|
6836
4149
|
}
|
|
6837
|
-
return {
|
|
6838
|
-
constructor_plugin: constructor_plugin,
|
|
6839
|
-
mutation_plugin: mutation_plugin,
|
|
6840
|
-
post_processor: post_processor
|
|
6841
|
-
};
|
|
6842
4150
|
}
|
|
6843
|
-
function $
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
} = slider;
|
|
6847
|
-
const slider_box = sliding.getBoundingClientRect();
|
|
6848
|
-
const leftmost_rect = slider.element_by_index(0).getBoundingClientRect();
|
|
6849
|
-
const rightmost_rect = slider.element_by_index(slider.index_of_last_element).getBoundingClientRect();
|
|
6850
|
-
const leftmost_card_to_left_viewport_edge = slider_box.left - leftmost_rect.left;
|
|
6851
|
-
const rightmost_card_to_right_viewport_edge = rightmost_rect.right - slider_box.right;
|
|
6852
|
-
const children = [...sliding.children];
|
|
4151
|
+
async function $8b0f4f54739f2574$export$baccefee4a395d8f(after_navigation) {
|
|
4152
|
+
let replace_replaceState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
4153
|
+
if (typeof History === "undefined") return;
|
|
6853
4154
|
const {
|
|
6854
|
-
|
|
6855
|
-
} =
|
|
6856
|
-
const
|
|
6857
|
-
const
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
4155
|
+
prototype: prototype
|
|
4156
|
+
} = History;
|
|
4157
|
+
const instance = history;
|
|
4158
|
+
const polyfill_dance = the_thing => {
|
|
4159
|
+
const proxy_the_thing = obj => {
|
|
4160
|
+
const orig_pushState = obj[the_thing];
|
|
4161
|
+
obj[the_thing] = new Proxy(orig_pushState, {
|
|
4162
|
+
apply: (target, this_arg, arguments_list) => {
|
|
4163
|
+
const nav_result = Reflect.apply(target, this_arg, arguments_list);
|
|
4164
|
+
try {
|
|
4165
|
+
after_navigation(arguments_list, the_thing);
|
|
4166
|
+
} catch (e) {
|
|
4167
|
+
$46b94b232dc792af$export$8048b892d651b310(e);
|
|
4168
|
+
}
|
|
4169
|
+
return nav_result;
|
|
4170
|
+
}
|
|
4171
|
+
});
|
|
4172
|
+
};
|
|
4173
|
+
proxy_the_thing(prototype);
|
|
4174
|
+
if (Object.getOwnPropertyNames(instance).includes(the_thing))
|
|
4175
|
+
// we don't want to just change the instance because that's not the way to do it, but we don't want to not work because someone else did it wrong
|
|
4176
|
+
proxy_the_thing(instance);
|
|
6866
4177
|
};
|
|
6867
|
-
|
|
6868
|
-
if (
|
|
6869
|
-
if (leftmost_card_to_left_viewport_edge > rightmost_card_to_right_viewport_edge * 1.1 /* add 10% margin */)
|
|
6870
|
-
// dlog("Moving", chunk_size, "to the right");
|
|
6871
|
-
// sliding.append(...children.slice(0, chunk_size));
|
|
6872
|
-
post_move(1);else if (rightmost_card_to_right_viewport_edge > leftmost_card_to_left_viewport_edge * 1.1)
|
|
6873
|
-
// dlog("Moving", chunk_size, "to the left");
|
|
6874
|
-
// sliding.prepend(...children.slice(-chunk_size));
|
|
6875
|
-
post_move(-1);
|
|
6876
|
-
}
|
|
6877
|
-
// dlog("Scroll idle", leftmost_card_to_left_viewport_edge, rightmost_card_to_right_viewport_edge);
|
|
4178
|
+
polyfill_dance("pushState");
|
|
4179
|
+
if (replace_replaceState) polyfill_dance("replaceState");
|
|
6878
4180
|
}
|
|
6879
|
-
|
|
6880
4181
|
const $12ec80c27422ece4$var$connection_map = /*@__PURE__*/new WeakMap();
|
|
6881
4182
|
function $12ec80c27422ece4$export$3d04c40e7acc1a32(initial_value) {
|
|
6882
4183
|
let subscribed = false;
|
|
@@ -7049,125 +4350,336 @@ function $e1cfe4c7c02bb32a$export$419f84efad7d9fe(surface_per_size, cleanup_prom
|
|
|
7049
4350
|
function $e1cfe4c7c02bb32a$export$be95cb0e8cfd099e() {
|
|
7050
4351
|
return new Promise(r => $8b0f4f54739f2574$export$1cd22bab0d2c3b0b(r));
|
|
7051
4352
|
}
|
|
7052
|
-
function $
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
4353
|
+
function $1ea91dfed6983398$export$82a685f2da2fb027(a_element, product_id, recommendation_id, additional_listener) {
|
|
4354
|
+
var _a_element$depict_tra, _a_element$depict_tra2;
|
|
4355
|
+
if (!a_element ||
|
|
4356
|
+
// @ts-ignore
|
|
4357
|
+
!a_element.depict_tracked ||
|
|
4358
|
+
// @ts-ignore
|
|
4359
|
+
(a_element === null || a_element === void 0 ? void 0 : (_a_element$depict_tra = a_element.depict_tracked) === null || _a_element$depict_tra === void 0 ? void 0 : _a_element$depict_tra.recommendation_id) != recommendation_id ||
|
|
4360
|
+
// @ts-ignore
|
|
4361
|
+
(a_element === null || a_element === void 0 ? void 0 : (_a_element$depict_tra2 = a_element.depict_tracked) === null || _a_element$depict_tra2 === void 0 ? void 0 : _a_element$depict_tra2.product_id) != product_id) {
|
|
4362
|
+
const listener = e => {
|
|
4363
|
+
localStorage.setItem("depict_attribution_".concat(product_id), recommendation_id);
|
|
4364
|
+
if (additional_listener) additional_listener(e, product_id, recommendation_id);
|
|
4365
|
+
};
|
|
4366
|
+
// @ts-ignore
|
|
4367
|
+
if (a_element.depict_tracked) {
|
|
4368
|
+
var _a_element$depict_tra3;
|
|
4369
|
+
// @ts-ignore
|
|
4370
|
+
a_element.removeEventListener("click", (_a_element$depict_tra3 = a_element.depict_tracked) === null || _a_element$depict_tra3 === void 0 ? void 0 : _a_element$depict_tra3.listener);
|
|
4371
|
+
}
|
|
4372
|
+
// @ts-ignore
|
|
4373
|
+
a_element.depict_tracked = {
|
|
4374
|
+
product_id: product_id,
|
|
4375
|
+
recommendation_id: recommendation_id,
|
|
4376
|
+
listener: listener
|
|
4377
|
+
};
|
|
4378
|
+
a_element.addEventListener("click", listener);
|
|
4379
|
+
return listener;
|
|
4380
|
+
}
|
|
4381
|
+
}
|
|
4382
|
+
async function $1ea91dfed6983398$export$2c34560c3749dc63(button, get_product_id, tracking_fn, unmatching_tracking, event) {
|
|
4383
|
+
// @ts-ignore
|
|
4384
|
+
if (!button || button.depict_tracked) return;
|
|
4385
|
+
button.addEventListener(event ? event : "click", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(async e => {
|
|
4386
|
+
if (!e.isTrusted) {
|
|
4387
|
+
$7f95f77417d06249$export$de56f1198d121036("ignoring event", e, "because it's not user generated");
|
|
4388
|
+
return;
|
|
4389
|
+
}
|
|
4390
|
+
const product_id = await get_product_id(undefined, e);
|
|
4391
|
+
if (product_id) {
|
|
4392
|
+
const item_name = "depict_attribution_".concat(product_id);
|
|
4393
|
+
const recommendation_id = localStorage.getItem(item_name);
|
|
4394
|
+
if (recommendation_id) {
|
|
4395
|
+
localStorage.removeItem(item_name);
|
|
4396
|
+
tracking_fn(product_id, recommendation_id, false, e);
|
|
4397
|
+
} else if (unmatching_tracking) tracking_fn(product_id, recommendation_id, true, e);
|
|
4398
|
+
}
|
|
4399
|
+
}));
|
|
4400
|
+
// @ts-ignore
|
|
4401
|
+
button.depict_tracked = true;
|
|
4402
|
+
}
|
|
4403
|
+
function $f812c921818adbe0$export$edfedd0557ca5a2d(ga_tracker, append_to_url) {
|
|
4404
|
+
if (!ga_tracker) return;
|
|
4405
|
+
// Docs for analytics.js Tasks:
|
|
4406
|
+
// https://developers.google.com/analytics/devguides/collection/analyticsjs/tasks
|
|
4407
|
+
const sendHitTask = "sendHitTask";
|
|
4408
|
+
const originalSendHitTask = ga_tracker.get(sendHitTask);
|
|
4409
|
+
ga_tracker.set(sendHitTask, model => {
|
|
4410
|
+
originalSendHitTask(model);
|
|
4411
|
+
// console.log('Sent original hit, now sending to depict');
|
|
4412
|
+
try {
|
|
4413
|
+
const payLoad = model.get("hitPayload");
|
|
4414
|
+
const path = (0, $62869a3ed703f236$export$362abebb4b313340) + "/collect-ga";
|
|
4415
|
+
let url = path + "?" + payLoad;
|
|
4416
|
+
if (append_to_url) url += append_to_url;
|
|
4417
|
+
const n = navigator;
|
|
4418
|
+
const sb = "sendBeacon";
|
|
4419
|
+
if (n[sb])
|
|
4420
|
+
// this is actually smaller, I tested
|
|
4421
|
+
n[sb](url);else {
|
|
4422
|
+
const xhttp = new XMLHttpRequest();
|
|
4423
|
+
xhttp.open("GET", url);
|
|
4424
|
+
xhttp.send();
|
|
4425
|
+
}
|
|
4426
|
+
} catch (e) {
|
|
4427
|
+
// console.log('Could not send beacon to /collect-ga', e);
|
|
4428
|
+
}
|
|
7060
4429
|
});
|
|
7061
4430
|
}
|
|
7062
|
-
function $
|
|
7063
|
-
//
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
4431
|
+
function $f812c921818adbe0$export$674d8cd8b6868154() {
|
|
4432
|
+
// Snippet to load GA async
|
|
4433
|
+
const w = window;
|
|
4434
|
+
// @ts-ignore
|
|
4435
|
+
w.ga || (w.ga = function () {
|
|
4436
|
+
var _w$ga;
|
|
4437
|
+
((_w$ga = w.ga).q || (_w$ga.q = [])).push(arguments);
|
|
7068
4438
|
});
|
|
4439
|
+
w.ga.l = +new Date();
|
|
7069
4440
|
}
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
4441
|
+
|
|
4442
|
+
/**
|
|
4443
|
+
* Elements currently intersecting with the viewport.
|
|
4444
|
+
* If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
|
|
4445
|
+
*/
|
|
4446
|
+
const $6221808291a088c4$var$current_intersections = /*@__PURE__*/new WeakMap();
|
|
4447
|
+
/**
|
|
4448
|
+
* Currently watched elements by the intersection observer with their respective callback
|
|
4449
|
+
* */
|
|
4450
|
+
const $6221808291a088c4$var$watched_elements = /*@__PURE__*/new WeakMap();
|
|
4451
|
+
const $6221808291a088c4$var$unwatch_element = element => {
|
|
4452
|
+
$6221808291a088c4$var$intersection_observer === null || $6221808291a088c4$var$intersection_observer === void 0 || $6221808291a088c4$var$intersection_observer.unobserve(element);
|
|
4453
|
+
$6221808291a088c4$var$watched_elements.delete(element);
|
|
4454
|
+
$6221808291a088c4$var$current_intersections.delete(element);
|
|
4455
|
+
};
|
|
4456
|
+
const $6221808291a088c4$export$4c51576248bcdf31 = (element, callback) => {
|
|
4457
|
+
if ($6221808291a088c4$var$watched_elements.has(element)) {
|
|
4458
|
+
$7f95f77417d06249$export$de56f1198d121036("Not watching", element, "as it's already being watched");
|
|
4459
|
+
return () => {};
|
|
4460
|
+
}
|
|
4461
|
+
$6221808291a088c4$var$intersection_observer === null || $6221808291a088c4$var$intersection_observer === void 0 || $6221808291a088c4$var$intersection_observer.observe(element);
|
|
4462
|
+
/** Calls the given callback and makes sure to stop watching the element */
|
|
4463
|
+
const wrapped_callback = element => {
|
|
4464
|
+
callback(element);
|
|
4465
|
+
$6221808291a088c4$var$unwatch_element(element);
|
|
4466
|
+
};
|
|
4467
|
+
$6221808291a088c4$var$watched_elements.set(element, wrapped_callback);
|
|
4468
|
+
const disconnect_observer = (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onremoved(element, () => {
|
|
4469
|
+
// Sometimes it has already rapidly been reinserted. The observer events lag by one tick.
|
|
4470
|
+
// For that case, make sure we're really out of the DOM
|
|
4471
|
+
if (document.documentElement.contains(element)) return;
|
|
4472
|
+
$6221808291a088c4$var$unwatch_element(element);
|
|
4473
|
+
});
|
|
4474
|
+
return () => {
|
|
4475
|
+
disconnect_observer();
|
|
4476
|
+
$6221808291a088c4$var$unwatch_element(element);
|
|
4477
|
+
};
|
|
4478
|
+
};
|
|
4479
|
+
const $6221808291a088c4$var$intersection_observer_callback = entries => {
|
|
4480
|
+
for (const record of entries) {
|
|
4481
|
+
const {
|
|
4482
|
+
target: target
|
|
4483
|
+
} = record;
|
|
4484
|
+
const callback = $6221808291a088c4$var$watched_elements.get(target);
|
|
4485
|
+
// Skip the element if it's no longer being watched.
|
|
4486
|
+
if (!callback) {
|
|
4487
|
+
$6221808291a088c4$var$intersection_observer === null || $6221808291a088c4$var$intersection_observer === void 0 || $6221808291a088c4$var$intersection_observer.unobserve(target);
|
|
4488
|
+
continue;
|
|
4489
|
+
}
|
|
4490
|
+
const currently_intersecting = $6221808291a088c4$var$current_intersections.has(target);
|
|
4491
|
+
if (!currently_intersecting && record.intersectionRatio >= (0, $4b9808e8f3ab50d9$export$135da44d0ba958bc)[0]) {
|
|
4492
|
+
// we're intersecting enough and not already in the process of "measuring"
|
|
4493
|
+
const started_intersecting_at_ = +new Date(); // save start time
|
|
4494
|
+
// Schedule the callback function to be called after the element has been intersecting for the required duration
|
|
4495
|
+
const callback_timeout_ = setTimeout(callback, (0, $4b9808e8f3ab50d9$export$ca8321ea61dc2544), target);
|
|
4496
|
+
$6221808291a088c4$var$current_intersections.set(target, {
|
|
4497
|
+
started_intersecting_at_: started_intersecting_at_,
|
|
4498
|
+
callback_timeout_: callback_timeout_
|
|
4499
|
+
});
|
|
4500
|
+
} else if (currently_intersecting && record.intersectionRatio < (0, $4b9808e8f3ab50d9$export$135da44d0ba958bc)[1]) {
|
|
4501
|
+
// we are in the process of "measuring" and went below the threshold
|
|
4502
|
+
const {
|
|
4503
|
+
started_intersecting_at_: started_intersecting_at_,
|
|
4504
|
+
callback_timeout_: callback_timeout_
|
|
4505
|
+
} = $6221808291a088c4$var$current_intersections.get(target);
|
|
4506
|
+
const time_elapsed = +new Date() - started_intersecting_at_;
|
|
4507
|
+
// If we stopped intersecting too early we want to abort our timeout.
|
|
4508
|
+
// if we did not we also want to abort the timeout since it's been lagging and just instantly send the event
|
|
4509
|
+
// (the browser can delay setTimeout timers)
|
|
4510
|
+
clearTimeout(callback_timeout_);
|
|
4511
|
+
if (time_elapsed <= (0, $4b9808e8f3ab50d9$export$ca8321ea61dc2544)) $6221808291a088c4$var$current_intersections.delete(target);else {
|
|
4512
|
+
// we intersected long enough
|
|
4513
|
+
$7f95f77417d06249$export$de56f1198d121036("intersection_observer: setTimeout lagged", time_elapsed, (0, $4b9808e8f3ab50d9$export$ca8321ea61dc2544), "ms", target);
|
|
4514
|
+
callback(target);
|
|
7082
4515
|
}
|
|
7083
|
-
return target.apply(this_arg, args_list);
|
|
7084
4516
|
}
|
|
4517
|
+
}
|
|
4518
|
+
};
|
|
4519
|
+
/**
|
|
4520
|
+
* Global IntersectionObserver used for all impression tracking.
|
|
4521
|
+
* It's faster to use one observer for all elements than to create a new one for each element.
|
|
4522
|
+
*/
|
|
4523
|
+
const $6221808291a088c4$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/new IntersectionObserver( /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9($6221808291a088c4$var$intersection_observer_callback), {
|
|
4524
|
+
threshold: /*@__PURE__*/$4e1f5263dceb9802$export$f8ea2e7b15b5d129(8)
|
|
4525
|
+
}) : undefined;
|
|
4526
|
+
const $e61e4fdc357cece9$export$d0efd8ed14f5c33 = (items, display, info) => {
|
|
4527
|
+
if (!(items !== null && items !== void 0 && items.length)) return items;
|
|
4528
|
+
const node_array = Array.isArray(items) ? items : [...items]; // if it's a NodeList convert it to an array
|
|
4529
|
+
const first_watchable_el = node_array.find(el => el instanceof Element);
|
|
4530
|
+
if (!first_watchable_el) {
|
|
4531
|
+
$7f95f77417d06249$export$de56f1198d121036("Impression tracking: Can't observe", items, display);
|
|
4532
|
+
return items;
|
|
4533
|
+
}
|
|
4534
|
+
if (!info.t) {
|
|
4535
|
+
$7f95f77417d06249$export$de56f1198d121036("Impression tracking: No tenant instance, can't track", items, display);
|
|
4536
|
+
return items;
|
|
4537
|
+
}
|
|
4538
|
+
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(first_watchable_el, _ref => {
|
|
4539
|
+
let {
|
|
4540
|
+
element: element
|
|
4541
|
+
} = _ref;
|
|
4542
|
+
$6221808291a088c4$export$4c51576248bcdf31(element, () => {
|
|
4543
|
+
const {
|
|
4544
|
+
recommendation_id: recommendation_id,
|
|
4545
|
+
search_result_id: search_result_id,
|
|
4546
|
+
product_listing_result_id: product_listing_result_id,
|
|
4547
|
+
suggestions_result_id: suggestions_result_id
|
|
4548
|
+
} = display;
|
|
4549
|
+
$4b9808e8f3ab50d9$export$4205dc6835bc0d9f({
|
|
4550
|
+
...$335c248bb07a3509$export$8c6f26a5b6921b95(),
|
|
4551
|
+
recommendation_type: info.rendering_options.type,
|
|
4552
|
+
entity_price: display.sale_price,
|
|
4553
|
+
market: info.t.market,
|
|
4554
|
+
tenant: info.t.tenant,
|
|
4555
|
+
product_id: display.product_id,
|
|
4556
|
+
recommendation_id: recommendation_id,
|
|
4557
|
+
search_result_id: search_result_id,
|
|
4558
|
+
product_listing_result_id: product_listing_result_id,
|
|
4559
|
+
suggestions_result_id: suggestions_result_id
|
|
4560
|
+
});
|
|
4561
|
+
});
|
|
7085
4562
|
});
|
|
4563
|
+
return items;
|
|
4564
|
+
};
|
|
4565
|
+
const $89969f18db4020d7$export$37125ccc5dd98050 = _ref => {
|
|
4566
|
+
let {
|
|
4567
|
+
element: element,
|
|
4568
|
+
data: data,
|
|
4569
|
+
wait_for_dom_insertion = true
|
|
4570
|
+
} = _ref;
|
|
4571
|
+
const disconnectors = [];
|
|
4572
|
+
const impression_track = () => {
|
|
4573
|
+
const disconnector = $6221808291a088c4$export$4c51576248bcdf31(element, () => {
|
|
4574
|
+
$4b9808e8f3ab50d9$export$4205dc6835bc0d9f({
|
|
4575
|
+
...$335c248bb07a3509$export$8c6f26a5b6921b95(),
|
|
4576
|
+
...data
|
|
4577
|
+
});
|
|
4578
|
+
});
|
|
4579
|
+
disconnectors.push(disconnector);
|
|
4580
|
+
};
|
|
4581
|
+
if (wait_for_dom_insertion) disconnectors.push((0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onexists(element, impression_track));else impression_track();
|
|
4582
|
+
return () => disconnectors.forEach(disconnector => disconnector());
|
|
4583
|
+
};
|
|
4584
|
+
let $4b9808e8f3ab50d9$export$135da44d0ba958bc = [0.6, 0.5];
|
|
4585
|
+
const $4b9808e8f3ab50d9$export$c543ee4cdb0d0964 = (start, end) => $4b9808e8f3ab50d9$export$135da44d0ba958bc = [start, end];
|
|
4586
|
+
const $4b9808e8f3ab50d9$export$ca8321ea61dc2544 = 500;
|
|
4587
|
+
const $4b9808e8f3ab50d9$export$4205dc6835bc0d9f = data => {
|
|
4588
|
+
data.type = "element_visible"; // Set the type to element_visible as this is optional to pass here.
|
|
4589
|
+
$49880c4ce4bb7db2$export$28cacbd9b4306ffc([data], true);
|
|
4590
|
+
};
|
|
4591
|
+
|
|
4592
|
+
// https://stackoverflow.com/a/39941616
|
|
4593
|
+
function $ca80d3a3f70d4752$var$invert_promise(promise) {
|
|
4594
|
+
return new Promise((res, rej) => promise.then(rej, res));
|
|
4595
|
+
}
|
|
4596
|
+
function $ca80d3a3f70d4752$export$947a20746936143d(promises) {
|
|
4597
|
+
var _Promise$any, _Promise$any2;
|
|
4598
|
+
return (_Promise$any = Promise === null || Promise === void 0 ? void 0 : (_Promise$any2 = Promise.any) === null || _Promise$any2 === void 0 ? void 0 : _Promise$any2.call(Promise, promises)) !== null && _Promise$any !== void 0 ? _Promise$any : $ca80d3a3f70d4752$var$invert_promise(Promise.all([...promises].map($ca80d3a3f70d4752$var$invert_promise)));
|
|
7086
4599
|
}
|
|
7087
|
-
function $
|
|
7088
|
-
(
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
const
|
|
7099
|
-
|
|
7100
|
-
|
|
7101
|
-
|
|
4600
|
+
async function $04bba294678834bc$export$836f70a28c317905(product_id) {
|
|
4601
|
+
if (typeof BroadcastChannel != "function") return;
|
|
4602
|
+
const bc = new BroadcastChannel("right_click_attribution");
|
|
4603
|
+
$7f95f77417d06249$export$de56f1198d121036("Broadcasting", product_id, "to", bc);
|
|
4604
|
+
bc.postMessage(product_id);
|
|
4605
|
+
bc.close();
|
|
4606
|
+
}
|
|
4607
|
+
function $04bba294678834bc$export$58c56fe2313fdbe3(elements, display, info, get_event_listener_remover) {
|
|
4608
|
+
if (typeof BroadcastChannel != "function") return elements;
|
|
4609
|
+
const disconnectors = [];
|
|
4610
|
+
const handler = $3b52ccc10510b32a$export$b3bbfd758f11cfa9(e => $04bba294678834bc$export$8f66c4c7fb96eda2(e, ("variant_index" in display ? display.variant_displays[display.variant_index] : display).product_id));
|
|
4611
|
+
const auxclick_handler = e => e.button === 1 && handler(e);
|
|
4612
|
+
for (let i = 0; i < (elements === null || elements === void 0 ? void 0 : elements.length); i++) {
|
|
4613
|
+
const element = elements[i];
|
|
4614
|
+
element.addEventListener("contextmenu", handler);
|
|
4615
|
+
element.addEventListener("auxclick", auxclick_handler); // actual wheel click - some mouses / OS:es also dispatch auxclick on rightclick
|
|
4616
|
+
if (get_event_listener_remover) disconnectors.push(() => {
|
|
4617
|
+
element.removeEventListener("contextmenu", handler);
|
|
4618
|
+
element.removeEventListener("auxclick", auxclick_handler);
|
|
4619
|
+
});
|
|
7102
4620
|
}
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
tenant: t.tenant,
|
|
7106
|
-
market: t.market,
|
|
7107
|
-
events: [{
|
|
7108
|
-
event_type: "transaction_mapping",
|
|
7109
|
-
transaction_id: transaction_id,
|
|
7110
|
-
session_id: session_id
|
|
7111
|
-
}]
|
|
7112
|
-
};
|
|
7113
|
-
$49880c4ce4bb7db2$export$cc3b6ddf805f6156((0, $62869a3ed703f236$export$362abebb4b313340) + "/v2/track", payload);
|
|
4621
|
+
get_event_listener_remover === null || get_event_listener_remover === void 0 || get_event_listener_remover(() => disconnectors.forEach(disconnector => disconnector()));
|
|
4622
|
+
return elements;
|
|
7114
4623
|
}
|
|
7115
|
-
function $
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
let get_all_function = (_window = window) === null || _window === void 0 ? void 0 : (_window$ga = _window.ga) === null || _window$ga === void 0 ? void 0 : _window$ga.getAll; // https://sentry.io/organizations/depictai-0o/issues/3621911835/?project=5476183&referrer=slack
|
|
7122
|
-
if (typeof get_all_function !== "function") get_all_function = await $6bf620c74776aef6$export$2fc1a072736ae2f6(window, "ga", "getAll");
|
|
7123
|
-
// @ts-ignore
|
|
7124
|
-
const all_trackers = get_all_function.call(ga);
|
|
7125
|
-
$7f95f77417d06249$export$de56f1198d121036("we have trackers", all_trackers);
|
|
7126
|
-
// @ts-ignore
|
|
4624
|
+
async function $04bba294678834bc$export$8f66c4c7fb96eda2(e, product_id) {
|
|
4625
|
+
$7f95f77417d06249$export$de56f1198d121036("Contextmenu was invoked", e);
|
|
4626
|
+
const element = e.currentTarget || e.target;
|
|
4627
|
+
const bc = new BroadcastChannel("right_click_attribution");
|
|
4628
|
+
const got_wanted_event = await $ca80d3a3f70d4752$export$947a20746936143d([new Promise(resolve => {
|
|
4629
|
+
bc.addEventListener("message", $3b52ccc10510b32a$export$b3bbfd758f11cfa9(msg => {
|
|
7127
4630
|
const {
|
|
7128
|
-
|
|
7129
|
-
} =
|
|
7130
|
-
$
|
|
7131
|
-
if (
|
|
7132
|
-
// this check is just so we don't fail if this doesn't exist for some reason, but it always should
|
|
7133
|
-
P.push = new Proxy(P.push, {
|
|
7134
|
-
apply(target, this_arg, args_list) {
|
|
7135
|
-
const retval = target.apply(this_arg, args_list);
|
|
7136
|
-
$3b52ccc10510b32a$export$b3bbfd758f11cfa9(modify_trackers_of_iterable)(args_list);
|
|
7137
|
-
return retval;
|
|
7138
|
-
}
|
|
7139
|
-
});
|
|
7140
|
-
function modify_trackers_of_iterable(array) {
|
|
7141
|
-
for (const tracker of array) $3b52ccc10510b32a$export$b3bbfd758f11cfa9($138f1061348967b4$var$make_tracker_send_to_depict)(tracker, t, filter);
|
|
7142
|
-
}
|
|
4631
|
+
data: data
|
|
4632
|
+
} = msg;
|
|
4633
|
+
$7f95f77417d06249$export$de56f1198d121036("Recieved broadcast channel event", data, msg);
|
|
4634
|
+
if (data == product_id) resolve(true);
|
|
7143
4635
|
}));
|
|
4636
|
+
}), new Promise(r => setTimeout(r, 60000, false))]);
|
|
4637
|
+
if (got_wanted_event) {
|
|
4638
|
+
const click = new MouseEvent("click", {
|
|
4639
|
+
view: window,
|
|
4640
|
+
bubbles: true,
|
|
4641
|
+
cancelable: true,
|
|
4642
|
+
metaKey: true
|
|
4643
|
+
});
|
|
4644
|
+
$7f95f77417d06249$export$de56f1198d121036("Someone broadcasted our product_id! Simulating a click event on the element that was contextmenu'd", element, click);
|
|
4645
|
+
element.addEventListener("click", e => (e.preventDefault(), false), {
|
|
4646
|
+
once: true
|
|
4647
|
+
});
|
|
4648
|
+
element.dispatchEvent(click);
|
|
4649
|
+
} else $7f95f77417d06249$export$de56f1198d121036("Our product_id did not get broadcasted, closing channel");
|
|
4650
|
+
bc.close();
|
|
4651
|
+
}
|
|
4652
|
+
let $c15d2edce69e632a$var$last_page_pageview_sent_for;
|
|
4653
|
+
async function $c15d2edce69e632a$export$eee4c4d924348b05(data) {
|
|
4654
|
+
// Send page view to depict if needed
|
|
4655
|
+
try {
|
|
4656
|
+
const {
|
|
4657
|
+
href: href
|
|
4658
|
+
} = location;
|
|
4659
|
+
if ($c15d2edce69e632a$var$last_page_pageview_sent_for !== href) {
|
|
4660
|
+
$c15d2edce69e632a$var$last_page_pageview_sent_for = href;
|
|
4661
|
+
$335c248bb07a3509$export$82badda1f9923310({
|
|
4662
|
+
...data,
|
|
4663
|
+
type: "page_view"
|
|
4664
|
+
});
|
|
4665
|
+
if (data.product_id) await $04bba294678834bc$export$836f70a28c317905(data.product_id); // this takes care of right click click attribution - broadcasts the URL of the current page
|
|
4666
|
+
}
|
|
7144
4667
|
} catch (error) {
|
|
7145
|
-
$3b52ccc10510b32a$export$f18d5b0af29128b7(error, "
|
|
4668
|
+
$3b52ccc10510b32a$export$f18d5b0af29128b7([error, "Sending page view failed"], "warning");
|
|
7146
4669
|
}
|
|
7147
4670
|
}
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
const payload = model.get("hitPayload");
|
|
7161
|
-
const sp = new URLSearchParams(payload);
|
|
7162
|
-
const id = sp.get("ti");
|
|
7163
|
-
if (id) {
|
|
7164
|
-
$7f95f77417d06249$export$de56f1198d121036("Got interesting analytics request", payload, id);
|
|
7165
|
-
$78fd85c1f4513422$export$1ac466d53a6636ac(t, id, dsid, filter);
|
|
7166
|
-
}
|
|
7167
|
-
} catch (e) {
|
|
7168
|
-
$3b52ccc10510b32a$export$f18d5b0af29128b7(e, "error");
|
|
7169
|
-
}
|
|
7170
|
-
});
|
|
4671
|
+
let $c15d2edce69e632a$var$sending_on_navigation = false;
|
|
4672
|
+
async function $c15d2edce69e632a$export$f7cb1bd47199ec38(data) {
|
|
4673
|
+
if (!$c15d2edce69e632a$var$sending_on_navigation) {
|
|
4674
|
+
$c15d2edce69e632a$var$sending_on_navigation = true;
|
|
4675
|
+
$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async () => {
|
|
4676
|
+
for await (const _href of (0, $8b0f4f54739f2574$export$a9d39e43ae273d26)) $c15d2edce69e632a$export$eee4c4d924348b05({
|
|
4677
|
+
tenant: data.tenant,
|
|
4678
|
+
market: data.market,
|
|
4679
|
+
product_id: await data.get_product_id(_href)
|
|
4680
|
+
});
|
|
4681
|
+
})();
|
|
4682
|
+
}
|
|
7171
4683
|
}
|
|
7172
4684
|
function $89eca8044393f350$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
7173
4685
|
$89eca8044393f350$var$_checkPrivateRedeclaration(obj, privateMap);
|
|
@@ -7383,41 +4895,64 @@ const $675e948221f082fe$export$783ef16647773b3d = /*@__PURE__*/$9cefb304a1734a6b
|
|
|
7383
4895
|
const meta = await $6bf620c74776aef6$export$2fc1a072736ae2f6(window, "ShopifyAnalytics", "meta");
|
|
7384
4896
|
return meta === null || meta === void 0 ? void 0 : meta.product;
|
|
7385
4897
|
}));
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
4898
|
+
const $1a15d4d13e0d0cf9$export$5c069c93d2b7493f = delay => new Promise(resolve => setTimeout(resolve, delay));
|
|
4899
|
+
async function $8f0b9bb45dd059c3$export$bcd70d5ed1cf6313(url, options) {
|
|
4900
|
+
let max_retries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
|
|
4901
|
+
let useFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
|
|
4902
|
+
const ONE_MINUTE = 60000;
|
|
4903
|
+
const max_backoff_ms = ONE_MINUTE;
|
|
7392
4904
|
const {
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
4905
|
+
stack: stack
|
|
4906
|
+
} = new Error();
|
|
4907
|
+
const calculate_retry = delay => {
|
|
4908
|
+
delay *= 2 + Math.random();
|
|
4909
|
+
if (delay > max_backoff_ms) delay = max_backoff_ms * (1 + Math.random() / 10);
|
|
4910
|
+
return delay;
|
|
4911
|
+
};
|
|
4912
|
+
let try_again_in_ms = 100;
|
|
4913
|
+
let has_succeeded = false;
|
|
4914
|
+
let result = false;
|
|
4915
|
+
while (max_retries && !has_succeeded) try {
|
|
4916
|
+
const response = await useFetch(url, options);
|
|
4917
|
+
const {
|
|
4918
|
+
status: status,
|
|
4919
|
+
ok: ok
|
|
4920
|
+
} = response;
|
|
4921
|
+
if (!response || !ok || status !== 200) {
|
|
4922
|
+
if (status >= 400 && status < 500) {
|
|
4923
|
+
$3b52ccc10510b32a$export$b3bbfd758f11cfa9($8f0b9bb45dd059c3$var$send_sentry_4xx)(response, (options === null || options === void 0 ? void 0 : options.body) || {}, stack);
|
|
4924
|
+
has_succeeded = true;
|
|
4925
|
+
} else if (status === 404) has_succeeded = true;
|
|
4926
|
+
$7f95f77417d06249$export$de56f1198d121036("Response not ok", response);
|
|
4927
|
+
} else has_succeeded = true;
|
|
4928
|
+
result = response;
|
|
4929
|
+
} catch (error) {
|
|
4930
|
+
$7f95f77417d06249$export$de56f1198d121036("Error while fetching: ", error, url, options);
|
|
4931
|
+
// Don't retry CORS
|
|
4932
|
+
if (error.message.includes("CORS") && error.name.includes("CORS")) has_succeeded = true;
|
|
4933
|
+
} finally {
|
|
4934
|
+
if (!has_succeeded) await $1a15d4d13e0d0cf9$export$5c069c93d2b7493f(try_again_in_ms);
|
|
4935
|
+
try_again_in_ms = calculate_retry(try_again_in_ms);
|
|
4936
|
+
max_retries -= 1;
|
|
7409
4937
|
}
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
4938
|
+
return result;
|
|
4939
|
+
}
|
|
4940
|
+
async function $8f0b9bb45dd059c3$var$send_sentry_4xx(response, body, stack) {
|
|
4941
|
+
if (process.env.TENANT === "shopify-config" && response.status === 403)
|
|
4942
|
+
// Don't send requests in the shopify admin that say we need to re-authorize to sentry
|
|
7413
4943
|
return;
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
function
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
4944
|
+
const msg = "Validation error: got 4XX from API";
|
|
4945
|
+
const text = await response.clone().text();
|
|
4946
|
+
$7f95f77417d06249$export$de56f1198d121036(msg, "body", body, "response", response, "text", text, "stack", stack);
|
|
4947
|
+
(0, $902c0e005afb7319$export$af2e17a20c2ea3c5).withScope(function (scope) {
|
|
4948
|
+
scope.setExtra("stack", stack);
|
|
4949
|
+
scope.setExtra("request_body", body);
|
|
4950
|
+
scope.setExtra("response", response);
|
|
4951
|
+
scope.setExtra("serialized_response", $a1dd43178e1da976$export$39d526a1194b6499(response));
|
|
4952
|
+
scope.setExtra("response_text", text);
|
|
4953
|
+
scope.setLevel("error");
|
|
4954
|
+
this.captureException(new Error(msg));
|
|
4955
|
+
});
|
|
7421
4956
|
}
|
|
7422
4957
|
function $31fdda675c3d3017$export$2c2f50b30b7b2576(el, attribute_name, async_iterable) {
|
|
7423
4958
|
let quit_after_navigation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
@@ -7679,85 +5214,89 @@ function $51fea29d5f0a339b$var$deal_w_removal_of_node_array(node_array, push_dis
|
|
|
7679
5214
|
push_disconnector(disconnect_observer);
|
|
7680
5215
|
}
|
|
7681
5216
|
}
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
const $
|
|
7685
|
-
|
|
7686
|
-
|
|
5217
|
+
let $e45474c7d6e21cfa$var$existing_style_tag;
|
|
5218
|
+
let $e45474c7d6e21cfa$var$reactions_in_last_s = 0;
|
|
5219
|
+
const $e45474c7d6e21cfa$export$59ba1eb2c083f0cd = /*@__PURE__*/$3b52ccc10510b32a$export$b3bbfd758f11cfa9(async css => {
|
|
5220
|
+
const style_tag = await ($e45474c7d6e21cfa$var$existing_style_tag || ($e45474c7d6e21cfa$var$existing_style_tag = (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element("head").then(head => {
|
|
5221
|
+
const tag = document.createElement("style");
|
|
5222
|
+
(0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).onremoved(
|
|
5223
|
+
// reinsertion for next.js's "portable" <head>
|
|
5224
|
+
tag, eoe => {
|
|
5225
|
+
if (document.head.contains(tag))
|
|
5226
|
+
// just make sure to not freak out if it's already been added again
|
|
5227
|
+
return;
|
|
5228
|
+
if ($e45474c7d6e21cfa$var$reactions_in_last_s >= 10) {
|
|
5229
|
+
$3b52ccc10510b32a$export$f18d5b0af29128b7(new Error("Someone removed our styling but insists on it (10 removals in previous second). Giving up \uD83D\uDE2B"), "error");
|
|
5230
|
+
return;
|
|
5231
|
+
}
|
|
5232
|
+
$7f95f77417d06249$export$de56f1198d121036("Someone removed our styling \uD83D\uDE24, reinserting", eoe);
|
|
5233
|
+
$e45474c7d6e21cfa$var$reactions_in_last_s++;
|
|
5234
|
+
setTimeout(() => $e45474c7d6e21cfa$var$reactions_in_last_s--, 1000);
|
|
5235
|
+
document.head.append(tag); // we're sure that head exists now since we inserted it there previously
|
|
5236
|
+
});
|
|
5237
|
+
|
|
5238
|
+
$7f95f77417d06249$export$de56f1198d121036("inserting", tag, "into", head);
|
|
5239
|
+
return head.appendChild(tag);
|
|
5240
|
+
})));
|
|
5241
|
+
style_tag.append(css);
|
|
5242
|
+
});
|
|
5243
|
+
const $e45474c7d6e21cfa$export$a4f97b27a0592e6c = url => {
|
|
5244
|
+
var _pathname$split$filte;
|
|
5245
|
+
return ((_pathname$split$filte = (url ? new URL(url, window.location.origin) : window.location).pathname.split("/").filter(a => a).pop()) === null || _pathname$split$filte === void 0 ? void 0 : _pathname$split$filte.replace(/\.html?$/i, "")) || "";
|
|
7687
5246
|
};
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
}
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
type: "placeholder",
|
|
7705
|
-
recs: Array(num_items).fill(1).map(_ => ({
|
|
7706
|
-
sale_price: NaN,
|
|
7707
|
-
page_url: "#",
|
|
7708
|
-
image_url: image_url,
|
|
7709
|
-
original_price: NaN,
|
|
7710
|
-
product_id: "placeholder",
|
|
7711
|
-
recommendation_id: "placeholder",
|
|
7712
|
-
title: $bb8d2c77db19a4c0$export$3b75288f46cadd96(),
|
|
7713
|
-
brand: $bb8d2c77db19a4c0$export$3b75288f46cadd96()
|
|
7714
|
-
})),
|
|
7715
|
-
view_tracking: [],
|
|
7716
|
-
click_tracking: [],
|
|
7717
|
-
pre_processors: [],
|
|
7718
|
-
post_processors: [elems => {
|
|
7719
|
-
if (!(elems !== null && elems !== void 0 && elems.length)) return elems;
|
|
7720
|
-
for (const elem of elems) {
|
|
7721
|
-
var _classList, _classList$add, _classList2;
|
|
7722
|
-
if (elem instanceof HTMLElement) elem.style.cursor = "default";
|
|
7723
|
-
elem === null || elem === void 0 || (_classList = elem.classList) === null || _classList === void 0 || (_classList$add = (_classList2 = _classList).add) === null || _classList$add === void 0 || _classList$add.call(_classList2, "placeholder");
|
|
7724
|
-
elem.addEventListener("click", e => ($7f95f77417d06249$export$de56f1198d121036("Supressing placeholder click", e), e.preventDefault(), e.stopPropagation(), false), true);
|
|
7725
|
-
}
|
|
7726
|
-
for (const img of $8b27923e1d1e6b99$export$5e63aea0cac01fa0(elems, ["src", "srcset", "data-src", "data-srcset"].map(attribute => $bb8d2c77db19a4c0$var$make_sel(image_url, attribute)).join(", "))) img.classList.add("nolazy"); // this gets ignored by all lazyloaders
|
|
7727
|
-
return elems;
|
|
7728
|
-
}]
|
|
7729
|
-
};
|
|
7730
|
-
// @ts-ignore FIXME: this is a hack to make the type checker happy
|
|
7731
|
-
const placeholder_rendering = await override_rec_renderer(t, placeholder_opts).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
7732
|
-
let set_should_stay_inserted;
|
|
7733
|
-
const should_stay_inserted = new Promise(r => set_should_stay_inserted = r);
|
|
7734
|
-
if (placeholder_rendering !== null && placeholder_rendering !== void 0 && placeholder_rendering.elements) {
|
|
7735
|
-
const [template_els, _get_state, set_state] = $12ec80c27422ece4$export$3d04c40e7acc1a32(placeholder_rendering.elements);
|
|
7736
|
-
actual_rendering.then(async rendering_result => {
|
|
7737
|
-
if (typeof post_rendering == "function") await $3b52ccc10510b32a$export$b3bbfd758f11cfa9(post_rendering)(rendering_result);
|
|
7738
|
-
const {
|
|
7739
|
-
elements: elements
|
|
7740
|
-
} = rendering_result || {};
|
|
7741
|
-
await (0, $03c157d68c9fcbac$export$b6ae1bc530f4c149).wait_for_element(placeholder_rendering.elements[0]);
|
|
7742
|
-
// await new Promise(r => window.addEventListener("contextmenu", r, { once: true }));
|
|
7743
|
-
// it's possible that something after this ruins the array reference (aka [...elements]) and therefore it's not safe to call set_state again before the elements are sure to have a parentElement aka being in the DOM
|
|
7744
|
-
set_state(elements !== null && elements !== void 0 ? elements : "");
|
|
7745
|
-
if (!elements) {
|
|
7746
|
-
on_no_rendering_result === null || on_no_rendering_result === void 0 || on_no_rendering_result(rendering_result);
|
|
7747
|
-
set_should_stay_inserted(false);
|
|
5247
|
+
const $e45474c7d6e21cfa$export$692b606677218a16 = callback => {
|
|
5248
|
+
if (document.depictwashere) {
|
|
5249
|
+
if (process.env.BUILD_TARGET === "dev") {
|
|
5250
|
+
$7f95f77417d06249$export$de56f1198d121036("HMR tried to rerun us, reloading page");
|
|
5251
|
+
/* eslint-disable no-self-assign */
|
|
5252
|
+
location.href = location.href;
|
|
5253
|
+
}
|
|
5254
|
+
$7f95f77417d06249$export$de56f1198d121036("Script has already ran", document.currentScript, "is exiting");
|
|
5255
|
+
return;
|
|
5256
|
+
}
|
|
5257
|
+
if (process.env.BUILD_TARGET === "dev") /* eslint-disable no-console */console.clear = new Proxy(console.clear, {
|
|
5258
|
+
apply(target, this_arg, arg_list) {
|
|
5259
|
+
var _Error$stack;
|
|
5260
|
+
if ((_Error$stack = new Error().stack) !== null && _Error$stack !== void 0 && _Error$stack.split("\n").filter(Boolean).some(s => s.includes("http://localhost:1234/depict-ai.js"))) {
|
|
5261
|
+
/* eslint-disable no-console */console.log("CSS change detected through hack, reloading");
|
|
5262
|
+
location.reload();
|
|
7748
5263
|
}
|
|
7749
|
-
|
|
7750
|
-
}
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
5264
|
+
return target.apply(this_arg, arg_list);
|
|
5265
|
+
}
|
|
5266
|
+
});
|
|
5267
|
+
document.depictwashere = true;
|
|
5268
|
+
callback().catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
5269
|
+
};
|
|
5270
|
+
function $e45474c7d6e21cfa$export$328e81c44cddf3c0(callback, get_market, supported_markets, unsupported_markets, preferred_demo_market) {
|
|
5271
|
+
$e45474c7d6e21cfa$export$692b606677218a16(async () => {
|
|
5272
|
+
// Handle override for debug scripts (could be used on demo pages too)
|
|
5273
|
+
if (process.env.DEBUG === "true") {
|
|
5274
|
+
let localstorage_override;
|
|
5275
|
+
const query_param_override = new URLSearchParams(location.search).get("depict-override-market");
|
|
5276
|
+
if (query_param_override !== null) {
|
|
5277
|
+
$7f95f77417d06249$export$de56f1198d121036("Found ?depict-override-market=".concat(query_param_override, ". Using that as the market"));
|
|
5278
|
+
get_market = () => query_param_override;
|
|
5279
|
+
localStorage.setItem("depict-override-market", query_param_override);
|
|
5280
|
+
} else if ((localstorage_override = localStorage.getItem("depict-override-market")) !== null) {
|
|
5281
|
+
$7f95f77417d06249$export$de56f1198d121036('Found depict-override-market="'.concat(localstorage_override, '" in localStorage. Using that as the market'));
|
|
5282
|
+
get_market = () => localstorage_override;
|
|
5283
|
+
}
|
|
5284
|
+
}
|
|
5285
|
+
const market = await get_market();
|
|
5286
|
+
if (supported_markets.includes(market)) {
|
|
5287
|
+
$7f95f77417d06249$export$de56f1198d121036("Initializing with market: ".concat(market));
|
|
5288
|
+
return callback(market).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
5289
|
+
} else if (unsupported_markets.includes(market)) {
|
|
5290
|
+
$7f95f77417d06249$export$de56f1198d121036("Unsupported market: ".concat(market, ". Exiting..."));
|
|
5291
|
+
return;
|
|
5292
|
+
} else if (process.env.DEBUG === "true" && location.host.endsWith(".demo.depict.ai") && preferred_demo_market) {
|
|
5293
|
+
$7f95f77417d06249$export$de56f1198d121036("On demosite with default market override. Setting market to ".concat(preferred_demo_market));
|
|
5294
|
+
return callback(preferred_demo_market).catch((0, $46b94b232dc792af$export$8048b892d651b310));
|
|
7756
5295
|
} else {
|
|
7757
|
-
$
|
|
7758
|
-
return
|
|
5296
|
+
$46b94b232dc792af$export$8048b892d651b310(new Error('Unknown market: "'.concat(market, '". Exiting...')));
|
|
5297
|
+
return;
|
|
7759
5298
|
}
|
|
7760
|
-
};
|
|
5299
|
+
});
|
|
7761
5300
|
}
|
|
7762
5301
|
function $1d2ed456f93472ff$export$8ec5c86406f333ff() {
|
|
7763
5302
|
const element_weak_set = new WeakSet();
|
|
@@ -8227,8 +5766,8 @@ async function $468dbae10b24d59f$export$c068ad5361be7646(_ref) {
|
|
|
8227
5766
|
on_close_(exit_oos_iterator);
|
|
8228
5767
|
}));
|
|
8229
5768
|
}
|
|
8230
|
-
var $
|
|
8231
|
-
$
|
|
5769
|
+
var $46b697935d651c75$exports = {};
|
|
5770
|
+
$46b697935d651c75$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";
|
|
8232
5771
|
let $ba9b4cd7e24de87e$var$inserted = false;
|
|
8233
5772
|
const $ba9b4cd7e24de87e$export$84712d0562a614b8 = _ref => {
|
|
8234
5773
|
let {
|
|
@@ -8240,7 +5779,7 @@ const $ba9b4cd7e24de87e$export$84712d0562a614b8 = _ref => {
|
|
|
8240
5779
|
} = _ref;
|
|
8241
5780
|
if (!$ba9b4cd7e24de87e$var$inserted) {
|
|
8242
5781
|
// Insert styling on first import
|
|
8243
|
-
$e45474c7d6e21cfa$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($
|
|
5782
|
+
$e45474c7d6e21cfa$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($46b697935d651c75$exports)));
|
|
8244
5783
|
$ba9b4cd7e24de87e$var$inserted = true;
|
|
8245
5784
|
}
|
|
8246
5785
|
return $lMD39$solidjsweb.ssrElement("div", $lMD39$solidjsweb.mergeProps({
|
|
@@ -8436,8 +5975,8 @@ const $151f8676c5d42e80$export$237455ad7e59d4e5 = function () {
|
|
|
8436
5975
|
collapse: collapse
|
|
8437
5976
|
};
|
|
8438
5977
|
};
|
|
8439
|
-
var $
|
|
8440
|
-
$
|
|
5978
|
+
var $40bc83c42fbfc3cd$exports = {};
|
|
5979
|
+
$40bc83c42fbfc3cd$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 top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n}\n\n";
|
|
8441
5980
|
var $b42b9f62e8b6cb2d$var$_tmpl$ = ["<picture", ">", "</picture>"];
|
|
8442
5981
|
const $b42b9f62e8b6cb2d$export$3d13beba9b52c947 = "https://img.depict.ai/ResizeImage" + (process.env.TENANT ? "/" + process.env.TENANT : "");
|
|
8443
5982
|
const $b42b9f62e8b6cb2d$export$a98fc8a2c818d3d8 = /*@__PURE__*/(() => typeof navigator === "undefined" ? false : /^((?!chrome|android).)*safari/i.test(navigator.userAgent))(); // https://stackoverflow.com/a/23522755
|
|
@@ -8587,6 +6126,10 @@ var $dfce76a4aeb41067$var$_tmpl$ = ["<div", ' style="', '"></div>'],
|
|
|
8587
6126
|
const $dfce76a4aeb41067$var$rendering_options_to_sourceset_component = /*@__PURE__*/new WeakMap();
|
|
8588
6127
|
// Add nolazy to placeholders to avoid errors with the stupid lazyfier
|
|
8589
6128
|
const $dfce76a4aeb41067$var$add_nolazy_to_placeholder = type => type === "placeholder" ? "nolazy" : "";
|
|
6129
|
+
const $dfce76a4aeb41067$export$a4eccf92efefa04d = function (image_width, image_height) {
|
|
6130
|
+
let color = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "#f6f7f8";
|
|
6131
|
+
return "data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='".concat(image_width, "' height='").concat(image_height, "' xmlns:v='https://vecta.io/nano'%3e%3cpath d='M0 0h").concat(image_width, ".016v").concat(image_height, ".01H0' fill='").concat(encodeURIComponent(color), "'/%3e%3c/svg%3e");
|
|
6132
|
+
};
|
|
8590
6133
|
let $dfce76a4aeb41067$var$inserted = false;
|
|
8591
6134
|
const $dfce76a4aeb41067$export$788756b42446dc2d = _ref => {
|
|
8592
6135
|
let {
|
|
@@ -8595,13 +6138,13 @@ const $dfce76a4aeb41067$export$788756b42446dc2d = _ref => {
|
|
|
8595
6138
|
} = _ref;
|
|
8596
6139
|
if (!$dfce76a4aeb41067$var$inserted) {
|
|
8597
6140
|
// Insert styling on first import
|
|
8598
|
-
$e45474c7d6e21cfa$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($
|
|
6141
|
+
$e45474c7d6e21cfa$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($40bc83c42fbfc3cd$exports)));
|
|
8599
6142
|
$dfce76a4aeb41067$var$inserted = true;
|
|
8600
6143
|
}
|
|
8601
6144
|
const img = process.env.BUILD_TARGET === "modern" || process.env.BUILD_TARGET === "dev" ? $dfce76a4aeb41067$var$Image(options) : $dfce76a4aeb41067$var$CompatibleImage(options);
|
|
8602
6145
|
if (init_with_placeholder)
|
|
8603
6146
|
// 10000 is a magic value, that is just supposed to be bigger than the size of the actual image.
|
|
8604
|
-
img.querySelectorAll("img").forEach(i => i.src = $
|
|
6147
|
+
img.querySelectorAll("img").forEach(i => i.src = $dfce76a4aeb41067$export$a4eccf92efefa04d(10000 * options.aspect_ratio, 10000));
|
|
8605
6148
|
return img;
|
|
8606
6149
|
};
|
|
8607
6150
|
function $dfce76a4aeb41067$var$Image(_ref2) {
|
|
@@ -8670,8 +6213,8 @@ function $dfce76a4aeb41067$var$srcset_comp_from_map_or_new(rendering_options) {
|
|
|
8670
6213
|
}
|
|
8671
6214
|
return sourceset_component;
|
|
8672
6215
|
}
|
|
8673
|
-
var $
|
|
8674
|
-
$
|
|
6216
|
+
var $f90bbaa8a24d72ca$exports = {};
|
|
6217
|
+
$f90bbaa8a24d72ca$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";
|
|
8675
6218
|
var $8928a1027461fba4$var$_tmpl$ = ["<div", ' class="images-container"><!--$-->', '<!--/--><div class="main-image-container">', "</div></div>"],
|
|
8676
6219
|
$8928a1027461fba4$var$_tmpl$2 = ["<div", ' class="second-image-container">', "</div>"];
|
|
8677
6220
|
// Saving bytez
|
|
@@ -8806,7 +6349,7 @@ const $8928a1027461fba4$export$2369f6fc1c911576 = _ref => {
|
|
|
8806
6349
|
...options
|
|
8807
6350
|
} = _ref;
|
|
8808
6351
|
if (!$8928a1027461fba4$var$styling_inserted) {
|
|
8809
|
-
$e45474c7d6e21cfa$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($
|
|
6352
|
+
$e45474c7d6e21cfa$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($f90bbaa8a24d72ca$exports)));
|
|
8810
6353
|
$8928a1027461fba4$var$styling_inserted = true;
|
|
8811
6354
|
}
|
|
8812
6355
|
const main_image = $dfce76a4aeb41067$export$788756b42446dc2d({
|
|
@@ -8941,5 +6484,4 @@ function $59b7011b96010a8e$export$e35115e6d0715f77() {
|
|
|
8941
6484
|
$lMD39$solidjs.onCleanup(() => (0, $8b0f4f54739f2574$export$7500cdfd37aafd43).delete(handler));
|
|
8942
6485
|
return href;
|
|
8943
6486
|
}
|
|
8944
|
-
$045fb30107c9eecc$export$2cefb7e61fcbae00("utilishared", (0, $ce0ab19b284b64fa$export$83d89fbfd8236492));
|
|
8945
|
-
$parcel$exportWildcard(module.exports, $2e81c18d82b25372$exports);
|
|
6487
|
+
$045fb30107c9eecc$export$2cefb7e61fcbae00("utilishared", (0, $ce0ab19b284b64fa$export$83d89fbfd8236492));
|