@depict-ai/ui 2.1.23 → 3.0.0
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 +2428 -1803
- package/ES10/index.d.ts +305 -252
- package/ES10/index.js +2566 -1945
- package/latest/index.cjs +1997 -1380
- package/latest/index.d.ts +305 -252
- package/latest/index.js +2163 -1550
- package/locales/ES10/index.cjs +198 -62
- package/locales/ES10/index.d.ts +25 -4
- package/locales/ES10/index.js +179 -63
- package/locales/latest/index.cjs +214 -78
- package/locales/latest/index.d.ts +25 -4
- package/locales/latest/index.js +195 -79
- package/package.json +7 -7
- package/server/ES10/index.cjs +2179 -1679
- package/server/ES10/index.d.ts +305 -252
- package/server/ES10/index.js +1908 -1412
- package/server/latest/index.cjs +2008 -1512
- package/server/latest/index.d.ts +305 -252
- package/server/latest/index.js +2098 -1606
package/latest/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var $gVhhF$depictaiutilishared = require("@depict-ai/utilishared/latest");
|
|
2
2
|
var $gVhhF$solidjsweb = require("solid-js/web");
|
|
3
3
|
var $gVhhF$solidjs = require("solid-js");
|
|
4
|
+
var $gVhhF$depictaiutilisharedlatest = require("@depict-ai/utilishared/latest");
|
|
4
5
|
var $gVhhF$solidjsstore = require("solid-js/store");
|
|
5
6
|
require("../multi_import_deduplicator.cjs").register_es_version("ui", "latest");
|
|
6
7
|
function $parcel$export(e, n, v, s) {
|
|
@@ -11,6 +12,10 @@ function $parcel$export(e, n, v, s) {
|
|
|
11
12
|
configurable: true
|
|
12
13
|
});
|
|
13
14
|
}
|
|
15
|
+
$parcel$export(module.exports, "Tab", () => $8c38828ae2321937$export$3e41faf802a29e71);
|
|
16
|
+
$parcel$export(module.exports, "Tabs", () => $8c38828ae2321937$export$b2539bed5023c21c);
|
|
17
|
+
$parcel$export(module.exports, "ShopTheLookButton", () => $a5f3eaa1a24bbc1e$export$d4973c31938cbfd1);
|
|
18
|
+
$parcel$export(module.exports, "history_dot_state_to_state", () => $6e22b5314fb52f4c$export$e183a13865960371);
|
|
14
19
|
$parcel$export(module.exports, "strip_encoded_filter_and_sort", () => $1ab22f2cd39b3061$export$916e6850778505f6);
|
|
15
20
|
$parcel$export(module.exports, "encode_filters", () => $1ab22f2cd39b3061$export$58aa3f171519b6d7);
|
|
16
21
|
$parcel$export(module.exports, "decode_filters", () => $1ab22f2cd39b3061$export$f934fa24c3a86811);
|
|
@@ -37,12 +42,12 @@ $parcel$export(module.exports, "SolidLayout", () => $f48d0fbb00835aaa$export$d21
|
|
|
37
42
|
$parcel$export(module.exports, "general_modal_abstraction", () => $9abb0a35d4b60ed3$export$79b1565500412d9b);
|
|
38
43
|
$parcel$export(module.exports, "CrossIcon", () => $c77c68e559a1506c$export$3b621d86b1566b2);
|
|
39
44
|
$parcel$export(module.exports, "GenericSliderArrowButton", () => $0f313083912e447a$export$8be2714ec7f169ee);
|
|
40
|
-
$parcel$export(module.exports, "fetchDepictRecommendations", () => $
|
|
45
|
+
$parcel$export(module.exports, "fetchDepictRecommendations", () => $bd429c994399dd82$export$58e808b1db15d3bc);
|
|
41
46
|
$parcel$export(module.exports, "QuickLinks", () => $48567ac5b39bac56$export$de035477d6fef996);
|
|
42
47
|
$parcel$export(module.exports, "BreadCrumbs", () => $48567ac5b39bac56$export$5b7c3ce0ebe51f86);
|
|
43
48
|
$parcel$export(module.exports, "CategoryTitle", () => $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1);
|
|
44
49
|
$parcel$export(module.exports, "embedded_num_products", () => $85b747260aa175c9$export$824dde41348efed1);
|
|
45
|
-
$parcel$export(module.exports, "
|
|
50
|
+
$parcel$export(module.exports, "get_listings", () => $6382a1b83da39674$export$c1a6b039e689a58e);
|
|
46
51
|
$parcel$export(module.exports, "DepictCategory", () => $48567ac5b39bac56$export$f34314aa9505732e);
|
|
47
52
|
$parcel$export(module.exports, "CategoryPage", () => $48567ac5b39bac56$export$e2bf8ce7779e827e);
|
|
48
53
|
$parcel$export(module.exports, "DepictSearch", () => $2c61e4cd8229c49a$export$ac6237957a15b3f0);
|
|
@@ -72,202 +77,16 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
72
77
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
73
78
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
74
79
|
/*! Depict.ai search and product listing SDK */
|
|
75
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "
|
|
76
|
-
const $
|
|
77
|
-
|
|
78
|
-
const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
|
|
79
|
-
const $1ab22f2cd39b3061$var$operator_map = {
|
|
80
|
-
"eq": "≡",
|
|
81
|
-
"neq": "≠",
|
|
82
|
-
"in": "∈",
|
|
83
|
-
"nin": "∉",
|
|
84
|
-
"leq": "≤",
|
|
85
|
-
"geq": "≥",
|
|
86
|
-
"inrange": "\uD83D\uDD22"
|
|
87
|
-
};
|
|
88
|
-
const $1ab22f2cd39b3061$var$ascending_token = "\uD83D\uDCC8";
|
|
89
|
-
const $1ab22f2cd39b3061$var$descending_token = "\uD83D\uDCC9";
|
|
90
|
-
const $1ab22f2cd39b3061$var$range_delimiter = "-";
|
|
91
|
-
const $1ab22f2cd39b3061$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
|
|
92
|
-
const $1ab22f2cd39b3061$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
|
|
93
|
-
const $1ab22f2cd39b3061$var$empty_item_replacement = "0️⃣";
|
|
94
|
-
const $1ab22f2cd39b3061$var$op_to_token = op => {
|
|
95
|
-
if (op === $1ab22f2cd39b3061$var$fallback_operator) return $1ab22f2cd39b3061$var$fallback_token;
|
|
96
|
-
return $1ab22f2cd39b3061$var$operator_map[op];
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
|
|
100
|
-
* The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
|
|
101
|
-
* No deep or mixed nesting levels are supported.
|
|
102
|
-
*/
|
|
103
|
-
function $1ab22f2cd39b3061$var$array_is_serializable(array, is_root = true) {
|
|
104
|
-
if (array.every(item => Array.isArray(item))) {
|
|
105
|
-
if (!is_root)
|
|
106
|
-
// Deeply nested arrays are not supported, but also don't exist as filters (yet)
|
|
107
|
-
return false;
|
|
108
|
-
return array.every(item => $1ab22f2cd39b3061$var$array_is_serializable(item, false));
|
|
109
|
-
}
|
|
110
|
-
if (array.some(item => typeof item !== "string"))
|
|
111
|
-
// Numbers are not supported, since 1 and "1" would encode to the same thing
|
|
112
|
-
return false;
|
|
113
|
-
// Encoding reserved characters is not supported
|
|
114
|
-
return !array.some(item => item.includes($1ab22f2cd39b3061$var$array_item_delimiter) || item.includes($1ab22f2cd39b3061$var$string_item_delimiter) || item === $1ab22f2cd39b3061$var$empty_item_replacement);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Human readable string[] or string[][] serialization for URLs.
|
|
118
|
-
* @param array
|
|
119
|
-
* @returns
|
|
120
|
-
*/
|
|
121
|
-
function $1ab22f2cd39b3061$var$encode_array(array) {
|
|
122
|
-
const is_nested = array.every(item => Array.isArray(item));
|
|
123
|
-
if (is_nested) return array.map($1ab22f2cd39b3061$var$encode_array).join($1ab22f2cd39b3061$var$array_item_delimiter) + $1ab22f2cd39b3061$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
|
|
124
|
-
return array.map(item => item === "" ? $1ab22f2cd39b3061$var$empty_item_replacement : item).join($1ab22f2cd39b3061$var$string_item_delimiter);
|
|
125
|
-
}
|
|
126
|
-
function $1ab22f2cd39b3061$var$decode_array(encoded_array) {
|
|
127
|
-
const is_nested = encoded_array.includes($1ab22f2cd39b3061$var$array_item_delimiter);
|
|
128
|
-
if (is_nested) return encoded_array.split($1ab22f2cd39b3061$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
|
|
129
|
-
.map($1ab22f2cd39b3061$var$decode_array);
|
|
130
|
-
return encoded_array.split($1ab22f2cd39b3061$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
|
|
131
|
-
.map(item => item === $1ab22f2cd39b3061$var$empty_item_replacement ? "" : item);
|
|
132
|
-
}
|
|
133
|
-
function $1ab22f2cd39b3061$var$encode_filter_data(op, data) {
|
|
134
|
-
if (data === "true")
|
|
135
|
-
// boolean encoding
|
|
136
|
-
return "1";
|
|
137
|
-
if (data === "false")
|
|
138
|
-
// boolean encoding
|
|
139
|
-
return "0";
|
|
140
|
-
const data_is_array = Array.isArray(data);
|
|
141
|
-
if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
|
|
142
|
-
// numeric range filter encoding
|
|
143
|
-
return data.join($1ab22f2cd39b3061$var$range_delimiter);
|
|
144
|
-
if (data_is_array && $1ab22f2cd39b3061$var$array_is_serializable(data)) {
|
|
145
|
-
const encoded_data = $1ab22f2cd39b3061$var$encode_array(data);
|
|
146
|
-
if (!encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter) && !encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter))
|
|
147
|
-
// A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
|
|
148
|
-
// In that case we add a delimiter suffix at the end
|
|
149
|
-
return encoded_data + $1ab22f2cd39b3061$var$string_item_delimiter;
|
|
150
|
-
return encoded_data;
|
|
151
|
-
}
|
|
152
|
-
// Fallback encoding
|
|
153
|
-
return $gVhhF$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
|
|
154
|
-
}
|
|
155
|
-
function $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data) {
|
|
156
|
-
if (encoded_data === "1") return "true";
|
|
157
|
-
if (encoded_data === "0") return "false";
|
|
158
|
-
if (op === "inrange" && encoded_data.includes($1ab22f2cd39b3061$var$range_delimiter)) return encoded_data.split($1ab22f2cd39b3061$var$range_delimiter).map(x => parseFloat(x));
|
|
159
|
-
if (encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter) || encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter)) return $1ab22f2cd39b3061$var$decode_array(encoded_data);
|
|
160
|
-
try {
|
|
161
|
-
return JSON.parse($gVhhF$depictaiutilishared.base64_decode_unicode(encoded_data));
|
|
162
|
-
} catch (e) {
|
|
163
|
-
$gVhhF$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
|
|
164
|
-
}
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
function $1ab22f2cd39b3061$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
|
|
168
|
-
for (const filter of filters) {
|
|
169
|
-
const {
|
|
170
|
-
field: field,
|
|
171
|
-
op: op,
|
|
172
|
-
data: data
|
|
173
|
-
} = filter;
|
|
174
|
-
const encoded_data = $1ab22f2cd39b3061$var$encode_filter_data(op, data);
|
|
175
|
-
search_params.set(filter_query_param_prefix + field + $1ab22f2cd39b3061$var$op_to_token(op), encoded_data);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
|
|
179
|
-
const found_filters = [];
|
|
180
|
-
for (const key of search_params.keys()) {
|
|
181
|
-
// Allow for backwards compatibility with the old filter query param prefix
|
|
182
|
-
let chosen_prefix = filter_query_param_prefix;
|
|
183
|
-
if (!key.startsWith(chosen_prefix)) {
|
|
184
|
-
chosen_prefix = $1ab22f2cd39b3061$var$legacy_filter_prefix;
|
|
185
|
-
if (!key.startsWith(chosen_prefix)) continue;
|
|
186
|
-
}
|
|
187
|
-
const encoded_data = search_params.get(key);
|
|
188
|
-
if (!encoded_data) continue;
|
|
189
|
-
const [op, token] = Object.entries($1ab22f2cd39b3061$var$operator_map).find(([, token]) => key.endsWith(token)) || [$1ab22f2cd39b3061$var$fallback_operator, $1ab22f2cd39b3061$var$fallback_token];
|
|
190
|
-
const data = $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data);
|
|
191
|
-
if (!data) continue;
|
|
192
|
-
const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
|
|
193
|
-
found_filters.push({
|
|
194
|
-
field: field,
|
|
195
|
-
op: op,
|
|
196
|
-
data: data
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
return found_filters;
|
|
200
|
-
}
|
|
201
|
-
function $1ab22f2cd39b3061$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
|
|
202
|
-
if (!sorting) return;
|
|
203
|
-
const {
|
|
204
|
-
field: field,
|
|
205
|
-
order: order
|
|
206
|
-
} = sorting;
|
|
207
|
-
const ascending = order === "asc";
|
|
208
|
-
search_params.set(sorting_query_param, field + (ascending ? $1ab22f2cd39b3061$var$ascending_token : $1ab22f2cd39b3061$var$descending_token));
|
|
209
|
-
}
|
|
210
|
-
function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params, sorting_query_param_) {
|
|
211
|
-
const encoded_sorting = search_params.get(sorting_query_param_);
|
|
212
|
-
if (!encoded_sorting) return;
|
|
213
|
-
if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$ascending_token)) return {
|
|
214
|
-
field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$ascending_token.length),
|
|
215
|
-
order: "asc"
|
|
216
|
-
};
|
|
217
|
-
if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$descending_token)) return {
|
|
218
|
-
field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$descending_token.length),
|
|
219
|
-
order: "desc"
|
|
220
|
-
};
|
|
221
|
-
$gVhhF$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
function $1ab22f2cd39b3061$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
|
|
225
|
-
// We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
|
|
226
|
-
const keys = [...search_params.keys()];
|
|
227
|
-
for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($1ab22f2cd39b3061$var$legacy_filter_prefix)) search_params.delete(key);
|
|
228
|
-
}
|
|
229
|
-
const $1ab22f2cd39b3061$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
|
|
230
|
-
function $1ab22f2cd39b3061$export$43cd1e747fecd42e({
|
|
231
|
-
to_url_: to_url_,
|
|
232
|
-
set_clearing_flag_: set_clearing_flag_,
|
|
233
|
-
from_search_params_ = new URLSearchParams(location.search),
|
|
234
|
-
sorting_query_param_: sorting_query_param_,
|
|
235
|
-
filter_query_param_prefix_: filter_query_param_prefix_
|
|
236
|
-
}) {
|
|
237
|
-
if (!to_url_) return to_url_;
|
|
238
|
-
const was_url_object = to_url_ instanceof URL;
|
|
239
|
-
const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
|
|
240
|
-
const {
|
|
241
|
-
searchParams: searchParams
|
|
242
|
-
} = url_object;
|
|
243
|
-
if (set_clearing_flag_) searchParams.set($1ab22f2cd39b3061$export$cf5feb2102aec7f2, "true");
|
|
244
|
-
if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
|
|
245
|
-
for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
|
|
246
|
-
if (was_url_object) return url_object;
|
|
247
|
-
return url_object.href;
|
|
248
|
-
}
|
|
249
|
-
const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$gVhhF$solidjs.createContext();
|
|
250
|
-
function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
|
|
251
|
-
const our_object = {};
|
|
252
|
-
return $gVhhF$solidjsweb.createComponent($84798aaa863a4909$var$ListingContext.Provider, {
|
|
253
|
-
value: our_object,
|
|
254
|
-
get children() {
|
|
255
|
-
return props.children;
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
function $84798aaa863a4909$export$8d0c4fdbb05a2f2e() {
|
|
260
|
-
return $gVhhF$solidjs.useContext($84798aaa863a4909$var$ListingContext);
|
|
261
|
-
}
|
|
262
|
-
const $93304d59a9747aa6$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`);
|
|
263
|
-
function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
|
|
80
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.0";
|
|
81
|
+
const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
|
|
82
|
+
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
264
83
|
return (() => {
|
|
265
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($
|
|
84
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($0f313083912e447a$var$_tmpl$);
|
|
266
85
|
$gVhhF$solidjsweb.effect(_p$ => {
|
|
267
|
-
const _v$ =
|
|
268
|
-
_v$2 = props.
|
|
269
|
-
_p$._v$
|
|
270
|
-
_v$2 !== _p$._v$2 && $gVhhF$solidjsweb.
|
|
86
|
+
const _v$ = props.width_ ?? 14,
|
|
87
|
+
_v$2 = props.height_ ?? 26;
|
|
88
|
+
_v$ !== _p$._v$ && $gVhhF$solidjsweb.setAttribute(_el$, "width", _p$._v$ = _v$);
|
|
89
|
+
_v$2 !== _p$._v$2 && $gVhhF$solidjsweb.setAttribute(_el$, "height", _p$._v$2 = _v$2);
|
|
271
90
|
return _p$;
|
|
272
91
|
}, {
|
|
273
92
|
_v$: undefined,
|
|
@@ -276,207 +95,532 @@ function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
|
|
|
276
95
|
return _el$;
|
|
277
96
|
})();
|
|
278
97
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
98
|
+
const $a0e53f99354809d9$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`);
|
|
99
|
+
function $a0e53f99354809d9$export$6649caad96ef8870({
|
|
100
|
+
children: children,
|
|
101
|
+
slider_ref_: slider_ref_,
|
|
102
|
+
faded_opacity_ = 0.7,
|
|
103
|
+
mutation_plugins_ = [],
|
|
104
|
+
disable_fading_: disable_fading_,
|
|
105
|
+
arrow_width_: arrow_width_,
|
|
106
|
+
arrow_height_: arrow_height_
|
|
107
|
+
}) {
|
|
108
|
+
const slider = new (0, $gVhhF$depictaiutilishared.Amazing_Slider)({
|
|
109
|
+
button_contents: {
|
|
110
|
+
left: [(() => {
|
|
111
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
|
|
112
|
+
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {
|
|
113
|
+
height_: arrow_height_,
|
|
114
|
+
width_: arrow_width_
|
|
115
|
+
}));
|
|
116
|
+
return _el$;
|
|
117
|
+
})()],
|
|
118
|
+
right: [(() => {
|
|
119
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($a0e53f99354809d9$var$_tmpl$);
|
|
120
|
+
$gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {
|
|
121
|
+
height_: arrow_height_,
|
|
122
|
+
width_: arrow_width_
|
|
123
|
+
}));
|
|
124
|
+
return _el$2;
|
|
125
|
+
})()]
|
|
126
|
+
},
|
|
127
|
+
constructor_plugins: [$gVhhF$depictaiutilishared.slider_snap_css().constructor_plugin],
|
|
128
|
+
mutation_plugins: [...(disable_fading_ ? [] : [$gVhhF$depictaiutilishared.slider_fading_factory({
|
|
129
|
+
threshold_: 0.96,
|
|
130
|
+
faded_opacity_: faded_opacity_
|
|
131
|
+
}).mutation_plugin_]), ...mutation_plugins_]
|
|
132
|
+
});
|
|
133
|
+
$gVhhF$solidjsweb.insert(slider.insert_here, children);
|
|
134
|
+
$gVhhF$solidjs.onCleanup(() => slider.observer.disconnect());
|
|
135
|
+
slider_ref_?.(slider);
|
|
136
|
+
return slider.container;
|
|
137
|
+
}
|
|
138
|
+
const $8c38828ae2321937$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<section aria-live=polite role=region class=tabs-body>`),
|
|
139
|
+
$8c38828ae2321937$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<nav role=tablist class=tabs-bar>`),
|
|
140
|
+
$8c38828ae2321937$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<article role=tabpanel>`);
|
|
141
|
+
const $8c38828ae2321937$var$TabsContext = /*@__PURE__*/$gVhhF$solidjs.createContext();
|
|
142
|
+
const $8c38828ae2321937$var$useTabs = () => $gVhhF$solidjs.useContext($8c38828ae2321937$var$TabsContext);
|
|
143
|
+
function $8c38828ae2321937$export$b2539bed5023c21c(props) {
|
|
144
|
+
return $gVhhF$solidjsweb.createComponent($8c38828ae2321937$var$TabsContext.Provider, {
|
|
145
|
+
value: new (0, $gVhhF$depictaiutilisharedlatest.ListenableSet)(),
|
|
146
|
+
get children() {
|
|
147
|
+
return $gVhhF$solidjsweb.createComponent($8c38828ae2321937$var$ActualTabs, $gVhhF$solidjsweb.mergeProps(props, {
|
|
148
|
+
get children() {
|
|
149
|
+
return props.children;
|
|
150
|
+
}
|
|
151
|
+
}));
|
|
290
152
|
}
|
|
291
|
-
}));
|
|
292
|
-
// If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
|
|
293
|
-
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
294
|
-
const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(whatToWatch, ({
|
|
295
|
-
element: element
|
|
296
|
-
}) => requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => resizeObserver.observe(element))));
|
|
297
|
-
$gVhhF$solidjs.onCleanup(() => {
|
|
298
|
-
resizeObserver.disconnect();
|
|
299
|
-
disconnect();
|
|
300
153
|
});
|
|
301
|
-
return size;
|
|
302
154
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
...props
|
|
309
|
-
};
|
|
310
|
-
delete cloned_props.resolutions;
|
|
311
|
-
// @ts-ignore
|
|
312
|
-
delete cloned_props.size;
|
|
313
|
-
// @ts-ignore
|
|
314
|
-
delete cloned_props.src;
|
|
315
|
-
return cloned_props;
|
|
316
|
-
});
|
|
317
|
-
const src_options = $gVhhF$solidjs.createMemo(() => {
|
|
318
|
-
const src = new URL(props.src, location.origin);
|
|
319
|
-
const fallback_src = $19950faaac026e09$var$generateImageUrl(src, 400);
|
|
320
|
-
const srcset = $19950faaac026e09$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096]);
|
|
321
|
-
return {
|
|
322
|
-
src: fallback_src,
|
|
323
|
-
srcset: srcset
|
|
324
|
-
};
|
|
155
|
+
function $8c38828ae2321937$var$ActualTabs(props) {
|
|
156
|
+
const [tabsReactive, setTabsReactive] = $gVhhF$solidjs.createSignal([]); // Can't have a store since reconciling with a store would call the children getters, and we could get x-tle rendered components
|
|
157
|
+
const [currentlySelected, setCurrentlySelected] = $gVhhF$solidjs.createSignal();
|
|
158
|
+
const [tabsVisitedOnce, setTabsVisitedOnce] = $gVhhF$solidjs.createSignal(new Set(), {
|
|
159
|
+
equals: false
|
|
325
160
|
});
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
const
|
|
329
|
-
const
|
|
330
|
-
const
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
|
|
336
|
-
const existingStack = listingContext?.[$19950faaac026e09$var$onIdleFunctionsSymbol];
|
|
337
|
-
if (existingStack) return existingStack.add(fn);
|
|
338
|
-
const newStack = new Set([fn]);
|
|
339
|
-
if (listingContext) listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol] = newStack;
|
|
340
|
-
const processStackWhenIdle = () => requestIdleCallback(deadline => {
|
|
341
|
-
const start = performance.now();
|
|
342
|
-
const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
|
|
343
|
-
for (const fn of newStack) {
|
|
344
|
-
newStack.delete(fn);
|
|
345
|
-
fn();
|
|
346
|
-
const timeTaken = performance.now() - start;
|
|
347
|
-
if ((!deadline.timeRemaining() || timeTaken > thirdDeadlineTime) && newStack.size) {
|
|
348
|
-
// There's still work to be done but no time, so schedule another idle callback
|
|
349
|
-
processStackWhenIdle();
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
// Stack is empty
|
|
354
|
-
if (listingContext) delete listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol];
|
|
355
|
-
}, {
|
|
356
|
-
timeout: 15000
|
|
357
|
-
} // long timeout, better to not have images than to freeze the browser. But also we don't want to confuse user why no iamges are loading
|
|
358
|
-
);
|
|
359
|
-
|
|
360
|
-
processStackWhenIdle();
|
|
161
|
+
const isSelected = $gVhhF$solidjs.createSelector(currentlySelected);
|
|
162
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
163
|
+
const updateTabsSignal = $gVhhF$depictaiutilisharedlatest.catchify(() => $gVhhF$solidjs.runWithOwner(owner, () => setTabsReactive([...ourTabsSet])));
|
|
164
|
+
const ourTabsSet = $8c38828ae2321937$var$useTabs();
|
|
165
|
+
const location = $gVhhF$depictaiutilisharedlatest.use_href_accessor();
|
|
166
|
+
const linkWithChangedHash = hash => {
|
|
167
|
+
const u_o = new URL(location());
|
|
168
|
+
u_o.hash = hash;
|
|
169
|
+
return u_o.href;
|
|
361
170
|
};
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
171
|
+
const headerItems = $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Index), {
|
|
172
|
+
get each() {
|
|
173
|
+
return tabsReactive();
|
|
174
|
+
},
|
|
175
|
+
children: item => {
|
|
176
|
+
const weSelected = $gVhhF$solidjs.createMemo(() => isSelected(item().id));
|
|
177
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjsweb.Dynamic), $gVhhF$solidjsweb.mergeProps({
|
|
178
|
+
get component() {
|
|
179
|
+
return props.AnchorComponent;
|
|
180
|
+
},
|
|
181
|
+
get ["aria-controls"]() {
|
|
182
|
+
return item().id;
|
|
183
|
+
},
|
|
184
|
+
role: "tab",
|
|
185
|
+
get classList() {
|
|
186
|
+
return {
|
|
187
|
+
selected: weSelected()
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
}, () => weSelected() ? {} : {
|
|
191
|
+
href: linkWithChangedHash(item().id)
|
|
192
|
+
}, {
|
|
193
|
+
get children() {
|
|
194
|
+
return item().label;
|
|
195
|
+
}
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
386
198
|
});
|
|
199
|
+
// Enable nice pattern of doing <Tabs><Tab>Content</Tab><Tab>More content</Tab></Tabs>
|
|
200
|
+
$gVhhF$solidjs.children(() => props.children); // "Render" children (.children is a getter), this means that we now can connect the children with the parent
|
|
201
|
+
for (const event of ["add", "delete"]) {
|
|
202
|
+
ourTabsSet.addEventListener(event, updateTabsSignal);
|
|
203
|
+
$gVhhF$solidjs.onCleanup(() => ourTabsSet.removeEventListener(event, updateTabsSignal));
|
|
204
|
+
}
|
|
205
|
+
updateTabsSignal();
|
|
387
206
|
$gVhhF$solidjs.createEffect(() => {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
if (props.loading === "lazy") {
|
|
395
|
-
// For lazy loading there's no decoding to wait for as it only occurs when the image is visible
|
|
396
|
-
// Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
|
|
397
|
-
setHasDecoded(true);
|
|
398
|
-
hasDecodedFastPath = true;
|
|
207
|
+
const {
|
|
208
|
+
hash: hash
|
|
209
|
+
} = new URL(location());
|
|
210
|
+
const id = hash.slice(1);
|
|
211
|
+
if (tabsReactive().some(item => item.id === id)) {
|
|
212
|
+
setCurrentlySelected(id);
|
|
399
213
|
return;
|
|
400
214
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
hasDecodedFastPath = true;
|
|
408
|
-
});
|
|
409
|
-
});
|
|
410
|
-
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
411
|
-
get when() {
|
|
412
|
-
return hasDecoded();
|
|
413
|
-
},
|
|
414
|
-
children: img
|
|
215
|
+
if (!currentlySelected() || !tabsReactive().some(item => item.id === currentlySelected())) {
|
|
216
|
+
// Select first one by default if possible
|
|
217
|
+
const firstTab = tabsReactive()[0]?.id;
|
|
218
|
+
if (!firstTab) return;
|
|
219
|
+
setCurrentlySelected(firstTab);
|
|
220
|
+
}
|
|
415
221
|
});
|
|
222
|
+
return [$gVhhF$solidjsweb.memo(() => (props.wrapTabBar || (v => v))((() => {
|
|
223
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($8c38828ae2321937$var$_tmpl$2);
|
|
224
|
+
$gVhhF$solidjsweb.insert(_el$2, (() => {
|
|
225
|
+
const _c$ = $gVhhF$solidjsweb.memo(() => !!props.slidable);
|
|
226
|
+
return () => _c$() ? $gVhhF$solidjsweb.createComponent((0, $a0e53f99354809d9$export$6649caad96ef8870), {
|
|
227
|
+
children: headerItems
|
|
228
|
+
}) : headerItems;
|
|
229
|
+
})());
|
|
230
|
+
return _el$2;
|
|
231
|
+
})())), (() => {
|
|
232
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($8c38828ae2321937$var$_tmpl$);
|
|
233
|
+
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Index), {
|
|
234
|
+
get each() {
|
|
235
|
+
return tabsReactive();
|
|
236
|
+
},
|
|
237
|
+
children: item => {
|
|
238
|
+
const weSelected = $gVhhF$solidjs.createMemo(() => isSelected(item().id));
|
|
239
|
+
$gVhhF$solidjs.createEffect(() => {
|
|
240
|
+
if (weSelected()) {
|
|
241
|
+
setTabsVisitedOnce(prev => {
|
|
242
|
+
prev.add(item().id);
|
|
243
|
+
return prev;
|
|
244
|
+
});
|
|
245
|
+
$gVhhF$solidjs.untrack(() => item().onSelected?.());
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
$gVhhF$solidjs.onCleanup(() => setTabsVisitedOnce(prev => (prev.delete(item().id), prev)));
|
|
249
|
+
return (() => {
|
|
250
|
+
const _el$3 = $gVhhF$solidjsweb.getNextElement($8c38828ae2321937$var$_tmpl$3);
|
|
251
|
+
$gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
252
|
+
get when() {
|
|
253
|
+
return tabsVisitedOnce().has(item().id);
|
|
254
|
+
},
|
|
255
|
+
get children() {
|
|
256
|
+
return item().children;
|
|
257
|
+
}
|
|
258
|
+
}));
|
|
259
|
+
$gVhhF$solidjsweb.effect(_p$ => {
|
|
260
|
+
const _v$ = item().id,
|
|
261
|
+
_v$2 = !!weSelected(),
|
|
262
|
+
_v$3 = weSelected() ? "" : "none";
|
|
263
|
+
_v$ !== _p$._v$ && $gVhhF$solidjsweb.setAttribute(_el$3, "id", _p$._v$ = _v$);
|
|
264
|
+
_v$2 !== _p$._v$2 && _el$3.classList.toggle("selected", _p$._v$2 = _v$2);
|
|
265
|
+
_v$3 !== _p$._v$3 && ((_p$._v$3 = _v$3) != null ? _el$3.style.setProperty("display", _v$3) : _el$3.style.removeProperty("display"));
|
|
266
|
+
return _p$;
|
|
267
|
+
}, {
|
|
268
|
+
_v$: undefined,
|
|
269
|
+
_v$2: undefined,
|
|
270
|
+
_v$3: undefined
|
|
271
|
+
});
|
|
272
|
+
return _el$3;
|
|
273
|
+
})();
|
|
274
|
+
}
|
|
275
|
+
}));
|
|
276
|
+
return _el$;
|
|
277
|
+
})()];
|
|
416
278
|
}
|
|
417
|
-
function $
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
279
|
+
function $8c38828ae2321937$export$3e41faf802a29e71(props) {
|
|
280
|
+
const currentTabs = $8c38828ae2321937$var$useTabs();
|
|
281
|
+
if (!currentTabs) throw new Error("Tab must be a child of Tabs");
|
|
282
|
+
const id = $gVhhF$solidjs.createUniqueId();
|
|
283
|
+
const ourSet = currentTabs;
|
|
284
|
+
const extendedProps = $gVhhF$solidjs.mergeProps({
|
|
285
|
+
id: id
|
|
286
|
+
}, props);
|
|
287
|
+
ourSet.add(extendedProps);
|
|
288
|
+
$gVhhF$solidjs.onCleanup(() => ourSet.delete(extendedProps));
|
|
289
|
+
return undefined;
|
|
424
290
|
}
|
|
425
|
-
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
//
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
291
|
+
async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts, parent) {
|
|
292
|
+
const body = parent || (await (0, $gVhhF$depictaiutilishared.observer).wait_for_element("body"));
|
|
293
|
+
let dispose_and_remove;
|
|
294
|
+
const open_modal_ = $gVhhF$depictaiutilishared.catchify(async (extra_options_for_modal = {}, on_dispose) => {
|
|
295
|
+
// Below await is very intentional,
|
|
296
|
+
// The reason is that effects don't run in <Suspense> boundaries before they've resolved and this carries even through roots created, but if a modal is opened from a suspense boundary we still want the effects in it to run
|
|
297
|
+
// This is because the suspense is for the content in the page and not the modal (the modal goes above it)
|
|
298
|
+
// By having an await here, solid loses all its knowledge of the suspense boundary
|
|
299
|
+
// (there is also some bug where effects don't run when created inside a suspense boundary that is resolved)
|
|
300
|
+
if (await dispose_and_remove)
|
|
301
|
+
// modal is already open
|
|
302
|
+
return;
|
|
303
|
+
const modal_els = $gVhhF$solidjs.createRoot(dispose => {
|
|
304
|
+
let closing_animation;
|
|
305
|
+
let animation_started;
|
|
306
|
+
dispose_and_remove = () => {
|
|
307
|
+
const actually_close = () => {
|
|
308
|
+
dispose();
|
|
309
|
+
on_dispose?.();
|
|
310
|
+
modal_els.forEach(el => el.remove());
|
|
311
|
+
};
|
|
312
|
+
if (animation_started && +new Date() - animation_started > 1000)
|
|
313
|
+
// Animation broke, close it this time
|
|
314
|
+
actually_close();else if (!animation_started && closing_animation) {
|
|
315
|
+
animation_started = +new Date();
|
|
316
|
+
$gVhhF$depictaiutilishared.catchify(closing_animation)()?.then($gVhhF$depictaiutilishared.catchify(actually_close));
|
|
317
|
+
} else actually_close();
|
|
318
|
+
};
|
|
319
|
+
return search_modal({
|
|
320
|
+
...modal_fn_opts,
|
|
321
|
+
...extra_options_for_modal,
|
|
322
|
+
close_modal_: close_modal_,
|
|
323
|
+
open_modal_: open_modal_,
|
|
324
|
+
register_closing_animation_: animation => closing_animation = animation
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
body.append(...modal_els);
|
|
328
|
+
});
|
|
329
|
+
const close_modal_ = $gVhhF$depictaiutilishared.catchify(() => {
|
|
330
|
+
if (dispose_and_remove) {
|
|
331
|
+
// modal is open
|
|
332
|
+
const dispose_fn = dispose_and_remove;
|
|
333
|
+
// set dispose function to undefined in case that it triggers this dispose function itself. Not doing it leads to a bug like https://github.com/solidjs/solid/discussions/1194
|
|
334
|
+
dispose_and_remove = undefined;
|
|
335
|
+
dispose_fn();
|
|
439
336
|
}
|
|
440
337
|
});
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
338
|
+
return {
|
|
339
|
+
open_modal_: open_modal_,
|
|
340
|
+
close_modal_: close_modal_
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function $6e22b5314fb52f4c$export$e183a13865960371(params_to_default_value, router_) {
|
|
344
|
+
const signals = {};
|
|
345
|
+
const entries = Object.entries(params_to_default_value);
|
|
346
|
+
const event_handler = $gVhhF$depictaiutilishared.catchify((what_happened, args) => {
|
|
347
|
+
// Intentionally always update our signals to the history state to allow external control of SDK state for doing things like https://linear.app/depictai/issue/X-1432/is-this-possible-with-the-depict-sdk
|
|
348
|
+
if (what_happened !== "popstate") return;
|
|
349
|
+
// Had to undo the comment above,but leaving the history. Doing this because discovering why it doesn't work is a deja-vu and I don't want to have to discover it again.
|
|
350
|
+
// If we want others to interface with our state, it's better to expose it from DepictCategory/DepictSearch
|
|
351
|
+
// The reason for that is because writes to the state trigger writes to the state (something about local filter state, see the comment where `last_remote_state !== available_filters_()` happens in create_modified_filters.tsx)
|
|
352
|
+
// And can infinite loop, like in https://app.jiminny.com/playback/569c8f65-edea-4735-bd9e-4eb5a0b14cad
|
|
353
|
+
// It's the classical equilibrium problem when syncing state both down and up, and it's much easier to avoid than solve
|
|
354
|
+
$6e22b5314fb52f4c$var$history_state_change(signals, entries, args.state);
|
|
450
355
|
});
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
356
|
+
// createRenderEffect because we need the instant execution so the signals always contain values, even before solid's render phase
|
|
357
|
+
$gVhhF$solidjs.createRenderEffect(() => {
|
|
358
|
+
let signal_changed = false;
|
|
359
|
+
let {
|
|
360
|
+
state: state
|
|
361
|
+
} = globalThis?.history || {
|
|
362
|
+
state: {}
|
|
363
|
+
}; // cloning isn't necessary because we're calling replaceState on it anyway
|
|
364
|
+
if (state === null || typeof state != "object") state = {};
|
|
365
|
+
for (const [param, default_value] of entries) {
|
|
366
|
+
const [read_signal] = signals[param] ||= $gVhhF$solidjs.createSignal(state[param] ?? default_value);
|
|
367
|
+
const new_value = read_signal();
|
|
368
|
+
if (new_value !== state[param]) {
|
|
369
|
+
signal_changed = true;
|
|
370
|
+
state[param] = new_value;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (signal_changed) router_.navigate_.replace_state_(state);
|
|
455
374
|
});
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
375
|
+
// history_dot_state_to_state needs to update after its signals after url_state does BUT in the same task (might even have to be in the same tick in the microtask queue). If we'd use window.addEventListener("popstate") it would be guaranteed to be too late since each event listener has its own task
|
|
376
|
+
(0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).add(event_handler);
|
|
377
|
+
$gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.catchify(() => (0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).delete(event_handler)));
|
|
378
|
+
$gVhhF$solidjs.createEffect($gVhhF$depictaiutilishared.catchify(() => $gVhhF$solidjs.untrack($gVhhF$depictaiutilishared.catchify(() => $6e22b5314fb52f4c$var$history_state_change(signals, entries, history.state))))); // we need this to run after reading the initial state from history.state to write the defaults to history.state
|
|
379
|
+
return signals;
|
|
380
|
+
}
|
|
381
|
+
function $6e22b5314fb52f4c$var$history_state_change(signals, entries, state) {
|
|
382
|
+
$gVhhF$solidjs.batch(() => {
|
|
383
|
+
for (const [param, default_value] of entries) {
|
|
384
|
+
const [, write_signal] = signals[param];
|
|
385
|
+
const new_value = state?.[param];
|
|
386
|
+
write_signal(new_value ?? default_value);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
const $d84fe647b84b5dc5$export$3064e1e8c6513da3 = new Set();
|
|
391
|
+
let $d84fe647b84b5dc5$var$has_ran = false;
|
|
392
|
+
function $d84fe647b84b5dc5$export$5162a71f252e6122() {
|
|
393
|
+
if ($d84fe647b84b5dc5$var$has_ran || typeof history !== "object") return;
|
|
394
|
+
$d84fe647b84b5dc5$var$has_ran = true;
|
|
395
|
+
for (const function_name of ["replaceState", "pushState"]) {
|
|
396
|
+
if (Object.getOwnPropertyNames(history).includes(function_name)) $d84fe647b84b5dc5$var$proxy_push_state(function_name, history);
|
|
397
|
+
$d84fe647b84b5dc5$var$proxy_push_state(function_name, History.prototype);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function $d84fe647b84b5dc5$var$proxy_push_state(function_name, thing) {
|
|
401
|
+
thing[function_name] = new Proxy(thing[function_name], {
|
|
402
|
+
apply(target, this_arg, arg_list) {
|
|
403
|
+
try {
|
|
404
|
+
const old_state = history.state;
|
|
405
|
+
if (typeof old_state == "object" && old_state !== null) {
|
|
406
|
+
// This effectively disallows the user from passing in a string, number, null or undefined
|
|
407
|
+
const intended_new_value_as_obj = typeof arg_list[0] === "object" ? arg_list[0] ?? {} : {};
|
|
408
|
+
const cloned_object = {
|
|
409
|
+
...intended_new_value_as_obj
|
|
410
|
+
};
|
|
411
|
+
for (const key in old_state) {
|
|
412
|
+
if (!$d84fe647b84b5dc5$var$starts_with_any_prefix(key)) continue;
|
|
413
|
+
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
414
|
+
}
|
|
415
|
+
arg_list[0] = cloned_object;
|
|
416
|
+
}
|
|
417
|
+
} catch (e) {
|
|
418
|
+
$gVhhF$depictaiutilishared.report([e, "Failed to preserve items in history.state"], "error");
|
|
419
|
+
}
|
|
420
|
+
return Reflect.apply(target, this_arg, arg_list);
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
function $d84fe647b84b5dc5$var$starts_with_any_prefix(key) {
|
|
425
|
+
for (const prefix of $d84fe647b84b5dc5$export$3064e1e8c6513da3) {
|
|
426
|
+
if (key.startsWith(prefix)) return true;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
430
|
+
/**
|
|
431
|
+
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
432
|
+
*/ /**
|
|
433
|
+
* We store listing_id in history.state and do operate on this both here and in js-ui, this is the key to be used which js-ui provides
|
|
434
|
+
*/
|
|
435
|
+
#throwing_on_navigation(...args) {
|
|
436
|
+
const {
|
|
437
|
+
on_navigation_: on_navigation_
|
|
438
|
+
} = this;
|
|
439
|
+
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
440
|
+
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
441
|
+
try {
|
|
442
|
+
return on_navigation_(...args);
|
|
443
|
+
} catch (e) {
|
|
444
|
+
queueMicrotask(() => {
|
|
445
|
+
throw e;
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Checks if this tab shouldn't navigate because user wants to open in new tab
|
|
451
|
+
*/
|
|
452
|
+
#dont_attempt_navigation(ev) {
|
|
453
|
+
return ev?.button || ev?.metaKey || ev?.ctrlKey;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
457
|
+
* This standardises waiting for all kinds of routers
|
|
458
|
+
*/
|
|
459
|
+
#get_navigation_happened_promise(is_replace) {
|
|
460
|
+
return new Promise(resolve => {
|
|
461
|
+
const handler = what_happened => {
|
|
462
|
+
if (what_happened === (is_replace ? "replaceState" : "pushState")) {
|
|
463
|
+
resolve();
|
|
464
|
+
(0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
(0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).add(handler);
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
navigate_ = {
|
|
471
|
+
/**
|
|
472
|
+
* Call this if you *just* want to replace the state object in history.state
|
|
473
|
+
*/
|
|
474
|
+
replace_state_: new_state => {
|
|
475
|
+
// This doesn't break any router, so we just do this directly for now, since many don't expose an interface for changing the state
|
|
476
|
+
globalThis?.history?.replaceState(new_state, "");
|
|
461
477
|
},
|
|
462
|
-
|
|
463
|
-
|
|
478
|
+
/**
|
|
479
|
+
* Call this to change the URL
|
|
480
|
+
* @param new_url_ new URL to go to
|
|
481
|
+
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
482
|
+
* @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
|
|
483
|
+
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
484
|
+
* @param listing_id_ If you are navigating to a category and know the listing_id of, please provide it. This is for making a better devEx in js-ui
|
|
485
|
+
*/
|
|
486
|
+
go_to_: $gVhhF$depictaiutilishared.catchify(async ({
|
|
487
|
+
new_url_: raw_new_url,
|
|
488
|
+
event_: event_,
|
|
489
|
+
force_spa_navigation_: force_spa_navigation_,
|
|
490
|
+
is_replace_: is_replace_,
|
|
491
|
+
listing_id_: listing_id_,
|
|
492
|
+
scroll = true
|
|
493
|
+
}) => {
|
|
494
|
+
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
495
|
+
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
496
|
+
if (this.#dont_attempt_navigation(event_)) return;
|
|
497
|
+
const different_origin = new_url_.origin !== location.origin;
|
|
498
|
+
if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
|
|
499
|
+
if (force_spa_navigation_ && different_origin)
|
|
500
|
+
// If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
|
|
501
|
+
$gVhhF$depictaiutilishared.dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
|
|
502
|
+
if (!event_)
|
|
503
|
+
// If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
504
|
+
location.assign(new_url_);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
event_?.preventDefault();
|
|
508
|
+
const promise = this.#get_navigation_happened_promise(true);
|
|
509
|
+
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
510
|
+
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
511
|
+
const new_state = history.state;
|
|
512
|
+
if (listing_id_) {
|
|
513
|
+
// In JS-UI we need to know the listing_id of the current category, therefore push it into state
|
|
514
|
+
if (!this.listing_id_state_key) $gVhhF$depictaiutilishared.report(new Error("listing_id_state_key is not set"), "error");
|
|
515
|
+
new_state[this.listing_id_state_key] = listing_id_;
|
|
516
|
+
}
|
|
517
|
+
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
518
|
+
} else this.#throwing_on_navigation.call(this, {
|
|
519
|
+
is_replace: is_replace_,
|
|
520
|
+
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
521
|
+
scroll: scroll
|
|
522
|
+
});
|
|
523
|
+
await promise;
|
|
524
|
+
})
|
|
525
|
+
};
|
|
526
|
+
constructor(on_navigation, listing_id_state_key) {
|
|
527
|
+
this.listing_id_state_key = listing_id_state_key;
|
|
528
|
+
this.on_navigation_ = on_navigation;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function $ca1176b694a6ee2e$export$fe334901e8bebd57() {
|
|
532
|
+
const cleanup_fns = [];
|
|
533
|
+
const cleanup = () => cleanup_fns.forEach(f => f());
|
|
534
|
+
// use an animation to automatically retain the `overflow` values and all other styling
|
|
535
|
+
for (const element of [document.documentElement, document.body]) {
|
|
536
|
+
try {
|
|
537
|
+
const animation = element.animate({
|
|
538
|
+
overflow: "hidden",
|
|
539
|
+
offset: 0
|
|
540
|
+
}, 1);
|
|
541
|
+
animation.pause();
|
|
542
|
+
const fn = $gVhhF$depictaiutilishared.catchify(animation.play.bind(animation));
|
|
543
|
+
cleanup_fns.push(fn);
|
|
544
|
+
$gVhhF$solidjs.onCleanup(fn);
|
|
545
|
+
} catch (e) {
|
|
546
|
+
$gVhhF$depictaiutilishared.dlog("Probably partial keyframe error", e);
|
|
547
|
+
}
|
|
548
|
+
if (getComputedStyle(element).overflow !== "hidden") {
|
|
549
|
+
// safari gets special hacky treatment
|
|
550
|
+
const style = element.style;
|
|
551
|
+
const original_value = style.overflow;
|
|
552
|
+
style.overflow = "hidden";
|
|
553
|
+
const fn = $gVhhF$depictaiutilishared.catchify(() => style.overflow = original_value);
|
|
554
|
+
cleanup_fns.push(fn);
|
|
555
|
+
$gVhhF$solidjs.onCleanup(fn);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return cleanup;
|
|
559
|
+
} // the way that houdini does that (FYI) it fixes the page jumps
|
|
560
|
+
// const from_top = scrollY;
|
|
561
|
+
// document.body.style.position = "fixed";
|
|
562
|
+
// document.body.style.left = 0;
|
|
563
|
+
// document.body.style.right = 0;
|
|
564
|
+
// document.body.style.top = `-${from_top}px`;
|
|
565
|
+
// document.body.style.overflowY = "scroll";
|
|
566
|
+
|
|
567
|
+
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
568
|
+
class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
|
|
569
|
+
class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
|
|
570
|
+
constructor(templateError) {
|
|
571
|
+
super("Uncaught error in product card template", {
|
|
572
|
+
cause: templateError
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const $edafe91daf3091d7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div><!$><!/><!$><!/>`);
|
|
577
|
+
function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
|
|
578
|
+
return $gVhhF$solidjs.ErrorBoundary({
|
|
579
|
+
fallback(err, retry) {
|
|
580
|
+
const {
|
|
581
|
+
message_: message_,
|
|
582
|
+
severity_: severity_
|
|
583
|
+
} = props;
|
|
584
|
+
let message = message_;
|
|
585
|
+
if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
|
|
586
|
+
console.error(err.cause);
|
|
587
|
+
message = `${message}: ${err.message}`;
|
|
588
|
+
} else $gVhhF$depictaiutilishared.report([err, message_], severity_);
|
|
589
|
+
return (() => {
|
|
590
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($edafe91daf3091d7$var$_tmpl$),
|
|
591
|
+
_el$2 = _el$.firstChild,
|
|
592
|
+
[_el$3, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$2.nextSibling),
|
|
593
|
+
_el$4 = _el$3.nextSibling,
|
|
594
|
+
[_el$5, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$4.nextSibling);
|
|
595
|
+
$gVhhF$solidjsweb.insert(_el$, message, _el$3, _co$);
|
|
596
|
+
$gVhhF$solidjsweb.insert(_el$, () => props.on_error_?.(retry), _el$5, _co$2);
|
|
597
|
+
$gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
|
|
598
|
+
return _el$;
|
|
599
|
+
})();
|
|
464
600
|
},
|
|
465
|
-
get
|
|
466
|
-
return props.
|
|
601
|
+
get children() {
|
|
602
|
+
return props.children;
|
|
467
603
|
}
|
|
468
|
-
})
|
|
469
|
-
return container;
|
|
604
|
+
});
|
|
470
605
|
}
|
|
471
|
-
const $
|
|
472
|
-
function $
|
|
606
|
+
const $c77c68e559a1506c$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg width=21.064 height=21.064 viewBox="0 0 21.064 21.064"><path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z">`);
|
|
607
|
+
function $c77c68e559a1506c$export$3b621d86b1566b2(props = {}) {
|
|
473
608
|
return (() => {
|
|
474
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($
|
|
609
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($c77c68e559a1506c$var$_tmpl$);
|
|
610
|
+
$gVhhF$solidjsweb.spread(_el$, props, true, true);
|
|
611
|
+
$gVhhF$solidjsweb.runHydrationEvents();
|
|
612
|
+
return _el$;
|
|
613
|
+
})();
|
|
614
|
+
}
|
|
615
|
+
const $9fe9883b1d8ecccc$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span>`);
|
|
616
|
+
function $9fe9883b1d8ecccc$export$acb3eaade4b23afd(props) {
|
|
617
|
+
return (() => {
|
|
618
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($9fe9883b1d8ecccc$var$_tmpl$);
|
|
475
619
|
$gVhhF$solidjsweb.effect(_p$ => {
|
|
476
|
-
const _v$ = props.
|
|
477
|
-
_v$2 = props.
|
|
478
|
-
_v$ !== _p$._v$ && $gVhhF$solidjsweb.
|
|
479
|
-
|
|
620
|
+
const _v$ = `depict-placeholder ${props.class || ""}`,
|
|
621
|
+
_v$2 = props.style;
|
|
622
|
+
_v$ !== _p$._v$ && $gVhhF$solidjsweb.className(_el$, _p$._v$ = _v$);
|
|
623
|
+
_p$._v$2 = $gVhhF$solidjsweb.style(_el$, _v$2, _p$._v$2);
|
|
480
624
|
return _p$;
|
|
481
625
|
}, {
|
|
482
626
|
_v$: undefined,
|
|
@@ -485,109 +629,149 @@ function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
|
485
629
|
return _el$;
|
|
486
630
|
})();
|
|
487
631
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}));
|
|
514
|
-
return _el$2;
|
|
515
|
-
})()]
|
|
632
|
+
function $3bc4a89b971a3af5$export$3f37af283f8fb843(props) {
|
|
633
|
+
const style = $gVhhF$solidjs.createMemo(() => {
|
|
634
|
+
const {
|
|
635
|
+
style: style,
|
|
636
|
+
height: height,
|
|
637
|
+
width: width,
|
|
638
|
+
aspectRatio: aspectRatio
|
|
639
|
+
} = props;
|
|
640
|
+
const is_image = aspectRatio != undefined;
|
|
641
|
+
const size_data = is_image ? {
|
|
642
|
+
width: "100%",
|
|
643
|
+
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
644
|
+
} : {
|
|
645
|
+
width: width,
|
|
646
|
+
height: height
|
|
647
|
+
};
|
|
648
|
+
return {
|
|
649
|
+
display: "block",
|
|
650
|
+
...(style || {}),
|
|
651
|
+
...size_data
|
|
652
|
+
};
|
|
653
|
+
});
|
|
654
|
+
return $gVhhF$solidjsweb.createComponent((0, $9fe9883b1d8ecccc$export$acb3eaade4b23afd), {
|
|
655
|
+
get style() {
|
|
656
|
+
return style();
|
|
516
657
|
},
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
faded_opacity_: faded_opacity_
|
|
521
|
-
}).mutation_plugin_]), ...mutation_plugins_]
|
|
658
|
+
get ["class"]() {
|
|
659
|
+
return props.class;
|
|
660
|
+
}
|
|
522
661
|
});
|
|
523
|
-
$gVhhF$solidjsweb.insert(slider.insert_here, children);
|
|
524
|
-
$gVhhF$solidjs.onCleanup(() => slider.observer.disconnect());
|
|
525
|
-
slider_ref_?.(slider);
|
|
526
|
-
return slider.container;
|
|
527
662
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
663
|
+
const $bbe694fe824b9c78$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=image-container>`);
|
|
664
|
+
function $bbe694fe824b9c78$export$41e1a079d40a0d58(props) {
|
|
665
|
+
const [display] = $gVhhF$solidjs.createResource(() => ({
|
|
666
|
+
merchant: props.merchant_,
|
|
667
|
+
market: props.market_,
|
|
668
|
+
locale: props.locale_,
|
|
669
|
+
product_ids: [props.productId_]
|
|
670
|
+
}), async request => {
|
|
671
|
+
const response = await fetch($gVhhF$depictaiutilishared.add_version_query_params(`${(0, $gVhhF$depictaiutilishared.base_url)}/v3/get-displays`), {
|
|
672
|
+
method: "POST",
|
|
673
|
+
body: JSON.stringify(request)
|
|
674
|
+
});
|
|
675
|
+
const decoded = await response.json();
|
|
676
|
+
return decoded.displays[0];
|
|
677
|
+
});
|
|
678
|
+
const placeholder = $gVhhF$solidjsweb.createComponent((0, $3bc4a89b971a3af5$export$3f37af283f8fb843), {
|
|
679
|
+
get aspectRatio() {
|
|
680
|
+
return props.imageAspectRatio_;
|
|
537
681
|
}
|
|
538
|
-
}));
|
|
539
|
-
// If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
|
|
540
|
-
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
541
|
-
const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(what_to_watch, ({
|
|
542
|
-
element: element
|
|
543
|
-
}) => requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => {
|
|
544
|
-
const current_size = what_to_watch.getBoundingClientRect().width;
|
|
545
|
-
if (current_size)
|
|
546
|
-
// If element has size, set signal to that. ResizeObserver only triggers when the content is visible in some cases, but it might already have a size. This reduces size filter expanding animation jank in chrome.
|
|
547
|
-
setWidth(current_size);
|
|
548
|
-
resizeObserver.observe(element);
|
|
549
|
-
})));
|
|
550
|
-
$gVhhF$solidjs.onCleanup(() => {
|
|
551
|
-
resizeObserver.disconnect();
|
|
552
|
-
disconnect();
|
|
553
682
|
});
|
|
554
|
-
return
|
|
683
|
+
return (() => {
|
|
684
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($bbe694fe824b9c78$var$_tmpl$);
|
|
685
|
+
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
686
|
+
fallback: placeholder,
|
|
687
|
+
get children() {
|
|
688
|
+
return (() => {
|
|
689
|
+
const imageUrl = $gVhhF$solidjs.createMemo(() => {
|
|
690
|
+
const d = display();
|
|
691
|
+
const variant = d?.variant_displays[d?.variant_index];
|
|
692
|
+
return variant?.image_urls?.[0] || variant?.display_image_url;
|
|
693
|
+
});
|
|
694
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
695
|
+
get when() {
|
|
696
|
+
return imageUrl();
|
|
697
|
+
},
|
|
698
|
+
fallback: "Cannot load image",
|
|
699
|
+
get children() {
|
|
700
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$depictaiutilishared.ContainedImage), {
|
|
701
|
+
loading: "lazy",
|
|
702
|
+
srcset_opts: {
|
|
703
|
+
set_dataset: false
|
|
704
|
+
},
|
|
705
|
+
get src() {
|
|
706
|
+
return imageUrl();
|
|
707
|
+
},
|
|
708
|
+
get aspect_ratio() {
|
|
709
|
+
return props.imageAspectRatio_;
|
|
710
|
+
},
|
|
711
|
+
rendering_options: {},
|
|
712
|
+
alt: "Product image showing the current product with other outfits highlighted on the model"
|
|
713
|
+
});
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
})();
|
|
717
|
+
}
|
|
718
|
+
}));
|
|
719
|
+
return _el$;
|
|
720
|
+
})();
|
|
555
721
|
}
|
|
556
|
-
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
const are_arrays = cols_at_size.every(element => Array.isArray(element));
|
|
571
|
-
if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
|
|
572
|
-
// Check width duplicates
|
|
573
|
-
const widths = cols_at_size.map(([_, width]) => width);
|
|
574
|
-
const widths_set = new Set(widths);
|
|
575
|
-
if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
|
|
576
|
-
if (cols_at_size.length === 1) {
|
|
577
|
-
const [nb_cols, width] = cols_at_size[0];
|
|
578
|
-
const max_width = width !== undefined ? `${width}px` : "";
|
|
579
|
-
return [[nb_cols, "", max_width]];
|
|
580
|
-
}
|
|
581
|
-
// Sort widths in ascending order
|
|
582
|
-
const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
|
|
583
|
-
const [_b, width_A] = a;
|
|
584
|
-
const [_a, width_b] = b;
|
|
585
|
-
if (width_A === undefined) return -1;
|
|
586
|
-
if (width_b === undefined) return 1;
|
|
587
|
-
return width_b - width_A;
|
|
722
|
+
function $061ff5b4c3d36171$export$89c6019e4baa40b1(props) {
|
|
723
|
+
const style = $gVhhF$solidjs.createMemo(() => {
|
|
724
|
+
const {
|
|
725
|
+
style: style,
|
|
726
|
+
height: height,
|
|
727
|
+
width: width
|
|
728
|
+
} = props;
|
|
729
|
+
return {
|
|
730
|
+
...(style || {}),
|
|
731
|
+
height: height ?? "1em",
|
|
732
|
+
...(width && {
|
|
733
|
+
width: width
|
|
734
|
+
})
|
|
735
|
+
};
|
|
588
736
|
});
|
|
589
|
-
return $
|
|
590
|
-
|
|
737
|
+
return $gVhhF$solidjsweb.createComponent((0, $9fe9883b1d8ecccc$export$acb3eaade4b23afd), {
|
|
738
|
+
get style() {
|
|
739
|
+
return style();
|
|
740
|
+
},
|
|
741
|
+
get ["class"]() {
|
|
742
|
+
return props.class;
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
const $6b502b1b2155a0bc$export$5c28802497c8a83c = /*@__PURE__*/Symbol("category_title_type");
|
|
747
|
+
const $0b23bfd073d9a4e8$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=category-title><h1 class=title></h1><span class=explanation> \u{2014} <!$><!/>`);
|
|
748
|
+
const $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1 = /*@__PURE__*/(() => {
|
|
749
|
+
const actual_function = ({
|
|
750
|
+
category_title_: category_title_,
|
|
751
|
+
product_count_: product_count_
|
|
752
|
+
}) => {
|
|
753
|
+
return (() => {
|
|
754
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($0b23bfd073d9a4e8$var$_tmpl$),
|
|
755
|
+
_el$2 = _el$.firstChild,
|
|
756
|
+
_el$3 = _el$2.nextSibling,
|
|
757
|
+
_el$4 = _el$3.firstChild,
|
|
758
|
+
_el$5 = _el$4.nextSibling,
|
|
759
|
+
[_el$6, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
760
|
+
$gVhhF$solidjsweb.insert(_el$2, () => category_title_() || $gVhhF$solidjsweb.createComponent((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
761
|
+
height: "1em",
|
|
762
|
+
width: "10ch"
|
|
763
|
+
}));
|
|
764
|
+
$gVhhF$solidjsweb.insert(_el$3, product_count_, _el$6, _co$);
|
|
765
|
+
return _el$;
|
|
766
|
+
})();
|
|
767
|
+
};
|
|
768
|
+
// This is wrong but parcel can't build correctly, it says unexpected undefined
|
|
769
|
+
actual_function[(0, $6b502b1b2155a0bc$export$5c28802497c8a83c)] = "simple";
|
|
770
|
+
return actual_function;
|
|
771
|
+
})();
|
|
772
|
+
const $a3280f0aad997933$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
|
|
773
|
+
const $a3280f0aad997933$export$864d304a0bc46829 = "2%";
|
|
774
|
+
const $a3280f0aad997933$export$7bf543b9d9be2c22 = (0, $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1);
|
|
591
775
|
function $fc23d7668ae0011d$export$a2cc176055f8f08() {
|
|
592
776
|
const text = "Please try setting `columnsAtSize`/`gridSpacing` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `columnsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
593
777
|
return (0, $gVhhF$solidjsweb.isServer) ? {
|
|
@@ -730,8 +914,6 @@ function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
|
|
|
730
914
|
const $a73063cc642f3e5f$var$result_ids = ["search_result_id", "product_listing_result_id", "recommendation_id"];
|
|
731
915
|
function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
732
916
|
displays_by_key_: displays_by_key_,
|
|
733
|
-
merchant_: merchant_,
|
|
734
|
-
market_: market_,
|
|
735
917
|
product_card_template_: product_card_template_,
|
|
736
918
|
do_per_elements_: do_per_elements_,
|
|
737
919
|
content_blocks_: content_blocks_
|
|
@@ -752,10 +934,9 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
|
752
934
|
return prev;
|
|
753
935
|
return new_display;
|
|
754
936
|
});
|
|
755
|
-
const [product_card_resource] = $gVhhF$solidjs.createResource(
|
|
756
|
-
// re-render when the reference to the display object changes
|
|
757
|
-
|
|
758
|
-
([merchant, market, display]) => {
|
|
937
|
+
const [product_card_resource] = $gVhhF$solidjs.createResource(display_accessor,
|
|
938
|
+
// re-render when the reference to the display object changes
|
|
939
|
+
display => {
|
|
759
940
|
// It's easy for merchants to accidentally mutate the display or some sub-object thereof
|
|
760
941
|
// We had a case on singular where they popped an image url and due to use caching after some time there was no image
|
|
761
942
|
// Attempt cloning the displays if possible (99.9% of the cases probably) and if not, just use the original display
|
|
@@ -768,12 +949,9 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
|
768
949
|
}
|
|
769
950
|
}
|
|
770
951
|
return product_card_template_(display, {
|
|
771
|
-
set_on_index_change: fn => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => fn(index())))
|
|
772
|
-
merchant: merchant,
|
|
773
|
-
market: market // recommendation_grid can provide a sneaky undefined here just FYI
|
|
952
|
+
set_on_index_change: fn => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => fn(index())))
|
|
774
953
|
});
|
|
775
954
|
});
|
|
776
|
-
|
|
777
955
|
const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
|
|
778
956
|
$gVhhF$solidjs.createEffect(() => {
|
|
779
957
|
const product_card_nodes = node_accessor();
|
|
@@ -824,46 +1002,6 @@ function $a73063cc642f3e5f$var$deep_equal(obj1, obj2) {
|
|
|
824
1002
|
}
|
|
825
1003
|
return false;
|
|
826
1004
|
}
|
|
827
|
-
|
|
828
|
-
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
829
|
-
class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
|
|
830
|
-
class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
|
|
831
|
-
constructor(templateError) {
|
|
832
|
-
super("Uncaught error in product card template", {
|
|
833
|
-
cause: templateError
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
const $edafe91daf3091d7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div><!$><!/><!$><!/>`);
|
|
838
|
-
function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
|
|
839
|
-
return $gVhhF$solidjs.ErrorBoundary({
|
|
840
|
-
fallback(err, retry) {
|
|
841
|
-
const {
|
|
842
|
-
message_: message_,
|
|
843
|
-
severity_: severity_
|
|
844
|
-
} = props;
|
|
845
|
-
let message = message_;
|
|
846
|
-
if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
|
|
847
|
-
console.error(err.cause);
|
|
848
|
-
message = `${message}: ${err.message}`;
|
|
849
|
-
} else $gVhhF$depictaiutilishared.report([err, message_], severity_);
|
|
850
|
-
return (() => {
|
|
851
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($edafe91daf3091d7$var$_tmpl$),
|
|
852
|
-
_el$2 = _el$.firstChild,
|
|
853
|
-
[_el$3, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$2.nextSibling),
|
|
854
|
-
_el$4 = _el$3.nextSibling,
|
|
855
|
-
[_el$5, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$4.nextSibling);
|
|
856
|
-
$gVhhF$solidjsweb.insert(_el$, message, _el$3, _co$);
|
|
857
|
-
$gVhhF$solidjsweb.insert(_el$, () => props.on_error_?.(retry), _el$5, _co$2);
|
|
858
|
-
$gVhhF$solidjsweb.effect(_$p => $gVhhF$solidjsweb.classList(_el$, Object.fromEntries(props.class_list_?.map(c => [c, true]) || []), _$p));
|
|
859
|
-
return _el$;
|
|
860
|
-
})();
|
|
861
|
-
},
|
|
862
|
-
get children() {
|
|
863
|
-
return props.children;
|
|
864
|
-
}
|
|
865
|
-
});
|
|
866
|
-
}
|
|
867
1005
|
const $f48d0fbb00835aaa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`),
|
|
868
1006
|
$f48d0fbb00835aaa$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<style type=text/css>`);
|
|
869
1007
|
function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
|
|
@@ -943,69 +1081,1016 @@ function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
943
1081
|
const max_rows = rows_or_empty_object().max_rows;
|
|
944
1082
|
if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
|
|
945
1083
|
});
|
|
946
|
-
$gVhhF$solidjs.createEffect(() => set_force_style_update(" ")); // force style update after hydration due to https://discord.com/channels/722131463138705510/722167424186843267/1151544212517552168
|
|
947
|
-
$gVhhF$solidjs.createRenderEffect(() => {
|
|
948
|
-
// Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
|
|
949
|
-
if (show_all_rows()) {
|
|
950
|
-
// no view more functionality requested
|
|
951
|
-
set_styling(() => col_styling);
|
|
952
|
-
return;
|
|
1084
|
+
$gVhhF$solidjs.createEffect(() => set_force_style_update(" ")); // force style update after hydration due to https://discord.com/channels/722131463138705510/722167424186843267/1151544212517552168
|
|
1085
|
+
$gVhhF$solidjs.createRenderEffect(() => {
|
|
1086
|
+
// Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
|
|
1087
|
+
if (show_all_rows()) {
|
|
1088
|
+
// no view more functionality requested
|
|
1089
|
+
set_styling(() => col_styling);
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
update_children_count();
|
|
1093
|
+
if (!(0, $gVhhF$solidjsweb.isServer)) {
|
|
1094
|
+
const mutation_observer = new MutationObserver($gVhhF$depictaiutilishared.catchify(update_children_count));
|
|
1095
|
+
mutation_observer.observe(container_element, {
|
|
1096
|
+
childList: true
|
|
1097
|
+
});
|
|
1098
|
+
$gVhhF$solidjs.onCleanup(() => mutation_observer.disconnect());
|
|
1099
|
+
}
|
|
1100
|
+
set_styling(
|
|
1101
|
+
// this is needed because solid will think that the memo-accessor is a setter function otherwise
|
|
1102
|
+
() => $gVhhF$solidjs.createMemo(() => {
|
|
1103
|
+
const {
|
|
1104
|
+
rows_per_click: rows_per_click,
|
|
1105
|
+
max_rows = -1,
|
|
1106
|
+
start_rows: start_rows
|
|
1107
|
+
} = rows_or_empty_object();
|
|
1108
|
+
const rows_visible = get_rows_visible();
|
|
1109
|
+
const children_count = get_children_count();
|
|
1110
|
+
return force_style_update() + col_styling() + props.cols_at_size.map(options => {
|
|
1111
|
+
const [recs_per_row, min, max] = options;
|
|
1112
|
+
let should_hide_view_more_button;
|
|
1113
|
+
let visible_recs;
|
|
1114
|
+
if (props.disable_partial_rows) {
|
|
1115
|
+
visible_recs = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
|
|
1116
|
+
const visible_recs_next_show_more = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
|
|
1117
|
+
// Should this really be zero when we default rows_per_click to 1?
|
|
1118
|
+
children_count, options);
|
|
1119
|
+
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
1120
|
+
} else {
|
|
1121
|
+
visible_recs = $gVhhF$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
|
|
1122
|
+
should_hide_view_more_button = visible_recs >= children_count;
|
|
1123
|
+
}
|
|
1124
|
+
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
1125
|
+
// I don't really understand the logic for when the view more button gets hidden so IDK if below is correct, but it works how it should for now
|
|
1126
|
+
const should_hide_view_less_button = !should_hide_view_more_button || start_rows == undefined || rows_visible <= start_rows || children_count <= recs_per_row * start_rows;
|
|
1127
|
+
return `${$gVhhF$depictaiutilishared.layout_media_query_header(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
|
|
1128
|
+
}).join("");
|
|
1129
|
+
}));
|
|
1130
|
+
});
|
|
1131
|
+
const style_element = (() => {
|
|
1132
|
+
const _el$4 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$2);
|
|
1133
|
+
$gVhhF$solidjsweb.insert(_el$4, get_styling);
|
|
1134
|
+
return _el$4;
|
|
1135
|
+
})(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
1136
|
+
if (insert_after_container) container_element.after(style_element);
|
|
1137
|
+
return [container_element, $gVhhF$solidjsweb.memo(view_more_button_container), $gVhhF$solidjsweb.memo(view_less_button_container), style_element];
|
|
1138
|
+
}
|
|
1139
|
+
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
1140
|
+
const $b8e79813f4f7ebe4$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<h2 class=recs-title>`),
|
|
1141
|
+
$b8e79813f4f7ebe4$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=recommendation-grid><!$><!/><!$><!/>`);
|
|
1142
|
+
function $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
1143
|
+
recommendations_resource_: recommendations_resource_,
|
|
1144
|
+
product_card_template_: product_card_template_,
|
|
1145
|
+
layout_options_: layout_options_,
|
|
1146
|
+
rows_object_: rows_object_,
|
|
1147
|
+
title_: title_
|
|
1148
|
+
}) {
|
|
1149
|
+
const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
1150
|
+
const title = $gVhhF$solidjs.createMemo(() => title_?.()); // In case getter/accessor creates elements, don't create them twice
|
|
1151
|
+
const num_placeholders_ = () => 20;
|
|
1152
|
+
const elements = [$gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
1153
|
+
get when() {
|
|
1154
|
+
return title();
|
|
1155
|
+
},
|
|
1156
|
+
get children() {
|
|
1157
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($b8e79813f4f7ebe4$var$_tmpl$);
|
|
1158
|
+
$gVhhF$solidjsweb.insert(_el$, title);
|
|
1159
|
+
return _el$;
|
|
1160
|
+
}
|
|
1161
|
+
}), (() => {
|
|
1162
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($b8e79813f4f7ebe4$var$_tmpl$2),
|
|
1163
|
+
_el$3 = _el$2.firstChild,
|
|
1164
|
+
[_el$4, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$3.nextSibling),
|
|
1165
|
+
_el$5 = _el$4.nextSibling,
|
|
1166
|
+
[_el$6, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
1167
|
+
$gVhhF$solidjsweb.insert(_el$2, (0, $fc23d7668ae0011d$export$a2cc176055f8f08), _el$4, _co$);
|
|
1168
|
+
$gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $gVhhF$solidjsweb.mergeProps({
|
|
1169
|
+
get rows() {
|
|
1170
|
+
return rows_object_();
|
|
1171
|
+
},
|
|
1172
|
+
layout: "grid",
|
|
1173
|
+
element_attributes: {
|
|
1174
|
+
class: "cards"
|
|
1175
|
+
}
|
|
1176
|
+
}, layout_options_, {
|
|
1177
|
+
get children() {
|
|
1178
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
1179
|
+
get fallback() {
|
|
1180
|
+
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
1181
|
+
num_placeholders_: num_placeholders_,
|
|
1182
|
+
product_card_template_: product_card_template_
|
|
1183
|
+
});
|
|
1184
|
+
},
|
|
1185
|
+
get children() {
|
|
1186
|
+
return (() => {
|
|
1187
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
1188
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
1189
|
+
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
1190
|
+
displays_by_key_: displays_by_key_,
|
|
1191
|
+
product_card_template_: product_card_template_
|
|
1192
|
+
});
|
|
1193
|
+
})();
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
})), _el$6, _co$2);
|
|
1198
|
+
return _el$2;
|
|
1199
|
+
})()];
|
|
1200
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
1201
|
+
get when() {
|
|
1202
|
+
return is_showing_something();
|
|
1203
|
+
},
|
|
1204
|
+
children: elements
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
1208
|
+
const cols_at_size = [];
|
|
1209
|
+
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
1210
|
+
const [nb_cols, width] = sorted_cols_at_size[i];
|
|
1211
|
+
const next_width = sorted_cols_at_size[i + 1]?.[1];
|
|
1212
|
+
const max_width = i === 0 ? "" : `${width}px`;
|
|
1213
|
+
const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
|
|
1214
|
+
const col_at_size = [nb_cols, min_width, max_width];
|
|
1215
|
+
cols_at_size.push(col_at_size);
|
|
1216
|
+
}
|
|
1217
|
+
return cols_at_size;
|
|
1218
|
+
};
|
|
1219
|
+
const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
|
|
1220
|
+
// Check that every element is an array
|
|
1221
|
+
const are_arrays = cols_at_size.every(element => Array.isArray(element));
|
|
1222
|
+
if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
|
|
1223
|
+
// Check width duplicates
|
|
1224
|
+
const widths = cols_at_size.map(([_, width]) => width);
|
|
1225
|
+
const widths_set = new Set(widths);
|
|
1226
|
+
if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
|
|
1227
|
+
if (cols_at_size.length === 1) {
|
|
1228
|
+
const [nb_cols, width] = cols_at_size[0];
|
|
1229
|
+
const max_width = width !== undefined ? `${width}px` : "";
|
|
1230
|
+
return [[nb_cols, "", max_width]];
|
|
1231
|
+
}
|
|
1232
|
+
// Sort widths in ascending order
|
|
1233
|
+
const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
|
|
1234
|
+
const [_b, width_A] = a;
|
|
1235
|
+
const [_a, width_b] = b;
|
|
1236
|
+
if (width_A === undefined) return -1;
|
|
1237
|
+
if (width_b === undefined) return 1;
|
|
1238
|
+
return width_b - width_A;
|
|
1239
|
+
});
|
|
1240
|
+
return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
|
|
1241
|
+
};
|
|
1242
|
+
function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
|
|
1243
|
+
const component_in_error_boundary = do_with_elements => {
|
|
1244
|
+
const error_boundary_wrapped = $edafe91daf3091d7$export$b69d0d92862de18b({
|
|
1245
|
+
severity_: "error",
|
|
1246
|
+
message_: error_message,
|
|
1247
|
+
get children() {
|
|
1248
|
+
const elements = component();
|
|
1249
|
+
do_with_elements?.(elements);
|
|
1250
|
+
return elements;
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
// This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
|
|
1254
|
+
if (typeof error_boundary_wrapped === "function")
|
|
1255
|
+
// @ts-ignore
|
|
1256
|
+
return error_boundary_wrapped();
|
|
1257
|
+
// On the server it returns a string, so we just return that
|
|
1258
|
+
return error_boundary_wrapped;
|
|
1259
|
+
};
|
|
1260
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
1261
|
+
if (owner == null) return $gVhhF$solidjs.createRoot(dispose => {
|
|
1262
|
+
// if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
|
|
1263
|
+
return component_in_error_boundary(elements => {
|
|
1264
|
+
const have_multiple = Array.isArray(elements);
|
|
1265
|
+
if (have_multiple ? !elements?.length : !elements) return;
|
|
1266
|
+
(0, $gVhhF$depictaiutilishared.observer).onremoved(have_multiple ? elements[0] : elements, ({
|
|
1267
|
+
element: element
|
|
1268
|
+
}) => {
|
|
1269
|
+
if (document.documentElement.contains(element)) return; // If element has instantly been re-inserted, don't dispose
|
|
1270
|
+
// See https://depictaiworkspace.slack.com/archives/C050GHEPBTR/p1695809102791259?thread_ts=1695106805.459729&cid=C050GHEPBTR
|
|
1271
|
+
dispose();
|
|
1272
|
+
});
|
|
1273
|
+
});
|
|
1274
|
+
});else
|
|
1275
|
+
// we're already in a root so cleanups are handled
|
|
1276
|
+
return component_in_error_boundary();
|
|
1277
|
+
}
|
|
1278
|
+
const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$gVhhF$solidjs.createContext();
|
|
1279
|
+
function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
|
|
1280
|
+
const our_object = {};
|
|
1281
|
+
return $gVhhF$solidjsweb.createComponent($84798aaa863a4909$var$ListingContext.Provider, {
|
|
1282
|
+
value: our_object,
|
|
1283
|
+
get children() {
|
|
1284
|
+
return props.children;
|
|
1285
|
+
}
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
function $84798aaa863a4909$export$8d0c4fdbb05a2f2e() {
|
|
1289
|
+
return $gVhhF$solidjs.useContext($84798aaa863a4909$var$ListingContext);
|
|
1290
|
+
}
|
|
1291
|
+
const $1f8dbf7e28b3eff2$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="show-more major"type=button>`),
|
|
1292
|
+
$1f8dbf7e28b3eff2$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp recommendations">`);
|
|
1293
|
+
function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
1294
|
+
return $95837413165cc2df$export$23fca46f3143581f(() => {
|
|
1295
|
+
const rows_object_ = $gVhhF$solidjs.createMemo(() => {
|
|
1296
|
+
const {
|
|
1297
|
+
view_more_button: view_more_button,
|
|
1298
|
+
max_rows: max_rows
|
|
1299
|
+
} = props;
|
|
1300
|
+
if (!view_more_button) {
|
|
1301
|
+
if (max_rows) return {
|
|
1302
|
+
max_rows: max_rows
|
|
1303
|
+
};
|
|
1304
|
+
return "all";
|
|
1305
|
+
}
|
|
1306
|
+
return {
|
|
1307
|
+
max_rows: max_rows,
|
|
1308
|
+
start_rows: view_more_button.start_rows,
|
|
1309
|
+
rows_per_click: view_more_button.rows_per_click ?? 2,
|
|
1310
|
+
button: (() => {
|
|
1311
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$);
|
|
1312
|
+
$gVhhF$solidjsweb.insert(_el$, () => view_more_button.text);
|
|
1313
|
+
return _el$;
|
|
1314
|
+
})()
|
|
1315
|
+
};
|
|
1316
|
+
});
|
|
1317
|
+
const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
|
|
1318
|
+
const {
|
|
1319
|
+
grid_spacing: grid_spacing
|
|
1320
|
+
} = props; // can be reactive
|
|
1321
|
+
return typeof grid_spacing === "string" ? {
|
|
1322
|
+
grid_spacing: grid_spacing
|
|
1323
|
+
} : {
|
|
1324
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
1325
|
+
grid_spacing: grid_spacing.horizontal
|
|
1326
|
+
};
|
|
1327
|
+
});
|
|
1328
|
+
const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
1329
|
+
return (() => {
|
|
1330
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$2);
|
|
1331
|
+
$gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
1332
|
+
get children() {
|
|
1333
|
+
return $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
1334
|
+
rows_object_: rows_object_,
|
|
1335
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
1336
|
+
recommendations_resource_: recommendations_resource_,
|
|
1337
|
+
title_: () => props.title,
|
|
1338
|
+
layout_options_: $gVhhF$solidjs.createMemo(() => ({
|
|
1339
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
|
|
1340
|
+
...grid_spacing_override()
|
|
1341
|
+
}))
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
}));
|
|
1345
|
+
return _el$2;
|
|
1346
|
+
})();
|
|
1347
|
+
}, "RecommendationGrid failed");
|
|
1348
|
+
}
|
|
1349
|
+
const $f55548318724b05c$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<a>`);
|
|
1350
|
+
function $f55548318724b05c$export$6b35356958ae5587(props) {
|
|
1351
|
+
const gridSpacing = (0, $a3280f0aad997933$export$864d304a0bc46829);
|
|
1352
|
+
const columnsAtSize = [[3], [2, 901]];
|
|
1353
|
+
const href = $gVhhF$depictaiutilishared.use_href_accessor();
|
|
1354
|
+
const hrefWithoutHash = $gVhhF$solidjs.createMemo(() => {
|
|
1355
|
+
// Don't let the hash count for knowing when the user navigated away as we change the hash when different tabs are selected
|
|
1356
|
+
const url = new URL(href());
|
|
1357
|
+
url.hash = "";
|
|
1358
|
+
return "" + url;
|
|
1359
|
+
});
|
|
1360
|
+
const makeJSXElementCloseModalWhenClicked = returnValue => {
|
|
1361
|
+
const resolved = $gVhhF$solidjs.children(() => returnValue);
|
|
1362
|
+
$gVhhF$solidjs.createEffect(() => {
|
|
1363
|
+
// If someone clicks on a product card in the shop the look modal, close the modal the next time the href changes
|
|
1364
|
+
for (const item of resolved.toArray()) {
|
|
1365
|
+
if (!(item instanceof Element)) return;
|
|
1366
|
+
item.addEventListener("click", $gVhhF$depictaiutilishared.catchify(() =>
|
|
1367
|
+
// run with modal owner so we don't do stuff after the modal closes
|
|
1368
|
+
// can't have the owner of the product card as that gets disposed if the productId changes which might be too early (before location.href has changed)
|
|
1369
|
+
$gVhhF$solidjs.runWithOwner(props.modalOwner_, () => $gVhhF$solidjs.createEffect($gVhhF$solidjs.on(hrefWithoutHash, props.actually_close_modal_, {
|
|
1370
|
+
defer: true
|
|
1371
|
+
})))), {
|
|
1372
|
+
capture: true
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
});
|
|
1376
|
+
return resolved;
|
|
1377
|
+
};
|
|
1378
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
1379
|
+
get when() {
|
|
1380
|
+
return !props.products_to_shop_.error;
|
|
1381
|
+
},
|
|
1382
|
+
fallback: "Failed fetching shop by look recommendations",
|
|
1383
|
+
get children() {
|
|
1384
|
+
return $gVhhF$solidjsweb.createComponent((0, $8c38828ae2321937$export$b2539bed5023c21c), {
|
|
1385
|
+
AnchorComponent: anchorProps => (() => {
|
|
1386
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($f55548318724b05c$var$_tmpl$);
|
|
1387
|
+
_el$.$$click = e => {
|
|
1388
|
+
const {
|
|
1389
|
+
href: href
|
|
1390
|
+
} = anchorProps;
|
|
1391
|
+
if (!href) return;
|
|
1392
|
+
props.pseudo_router_.navigate_.go_to_({
|
|
1393
|
+
scroll: false,
|
|
1394
|
+
is_replace_: false,
|
|
1395
|
+
new_url_: new URL(href),
|
|
1396
|
+
event_: e
|
|
1397
|
+
});
|
|
1398
|
+
};
|
|
1399
|
+
$gVhhF$solidjsweb.spread(_el$, anchorProps, false, true);
|
|
1400
|
+
$gVhhF$solidjsweb.insert(_el$, () => anchorProps.children);
|
|
1401
|
+
$gVhhF$solidjsweb.runHydrationEvents();
|
|
1402
|
+
return _el$;
|
|
1403
|
+
})(),
|
|
1404
|
+
get children() {
|
|
1405
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
1406
|
+
get fallback() {
|
|
1407
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Index), {
|
|
1408
|
+
get each() {
|
|
1409
|
+
return Array.from({
|
|
1410
|
+
length: 2
|
|
1411
|
+
});
|
|
1412
|
+
},
|
|
1413
|
+
children: () => $gVhhF$solidjsweb.createComponent((0, $8c38828ae2321937$export$3e41faf802a29e71), {
|
|
1414
|
+
get label() {
|
|
1415
|
+
return $gVhhF$solidjsweb.createComponent((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
1416
|
+
height: "1em",
|
|
1417
|
+
width: "10ch"
|
|
1418
|
+
});
|
|
1419
|
+
},
|
|
1420
|
+
get children() {
|
|
1421
|
+
return $gVhhF$solidjsweb.createComponent((0, $1f8dbf7e28b3eff2$export$9756467d34d91cdb), {
|
|
1422
|
+
grid_spacing: gridSpacing,
|
|
1423
|
+
cols_at_size: columnsAtSize,
|
|
1424
|
+
recommendations: new Promise(r => $gVhhF$solidjs.onCleanup(() => r([]))),
|
|
1425
|
+
get product_card_template() {
|
|
1426
|
+
return props.productCardTemplate_;
|
|
1427
|
+
},
|
|
1428
|
+
max_rows: 2
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
})
|
|
1432
|
+
});
|
|
1433
|
+
},
|
|
1434
|
+
get children() {
|
|
1435
|
+
return (() => {
|
|
1436
|
+
const groups = $gVhhF$solidjs.createMemo(() => Object.keys(props.products_to_shop_()?.shop_the_look || {}));
|
|
1437
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.For), {
|
|
1438
|
+
get each() {
|
|
1439
|
+
return groups();
|
|
1440
|
+
},
|
|
1441
|
+
children: group => $gVhhF$solidjsweb.createComponent((0, $8c38828ae2321937$export$3e41faf802a29e71), {
|
|
1442
|
+
label: group,
|
|
1443
|
+
get id() {
|
|
1444
|
+
return "shop-the-look-" + group.replaceAll(" ", "-").toLowerCase();
|
|
1445
|
+
},
|
|
1446
|
+
get children() {
|
|
1447
|
+
return $gVhhF$solidjsweb.createComponent((0, $1f8dbf7e28b3eff2$export$9756467d34d91cdb), {
|
|
1448
|
+
grid_spacing: gridSpacing,
|
|
1449
|
+
cols_at_size: columnsAtSize,
|
|
1450
|
+
get recommendations() {
|
|
1451
|
+
return Promise.resolve(props.products_to_shop_().shop_the_look[group]);
|
|
1452
|
+
},
|
|
1453
|
+
product_card_template: (...args) => {
|
|
1454
|
+
const returnValue = props.productCardTemplate_(...args);
|
|
1455
|
+
// Product card template can return promise, handle that
|
|
1456
|
+
if (typeof returnValue === "object" && returnValue && "then" in returnValue) {
|
|
1457
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
1458
|
+
return returnValue.then(returnValue => $gVhhF$solidjs.runWithOwner(owner, () => makeJSXElementCloseModalWhenClicked(returnValue)));
|
|
1459
|
+
}
|
|
1460
|
+
return makeJSXElementCloseModalWhenClicked(returnValue);
|
|
1461
|
+
}
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
})
|
|
1465
|
+
});
|
|
1466
|
+
})();
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
});
|
|
1473
|
+
}
|
|
1474
|
+
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
1475
|
+
const $b0ceb08960135d83$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=top-bar><button class=close>`),
|
|
1476
|
+
$b0ceb08960135d83$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=below-top-bar><h2>Outfit recommendations</h2><div class=image-and-suggestions><!$><!/><div class=tabs>`),
|
|
1477
|
+
$b0ceb08960135d83$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div id=depict-shop-the-look-modal class="depict shop-the-look"><div class=shop-the-look-backdrop></div><div class=modal-contents>`);
|
|
1478
|
+
function $b0ceb08960135d83$export$a3cbef418994a664(props) {
|
|
1479
|
+
const pseudo_router_ = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)(props.onNavigation);
|
|
1480
|
+
const closing_animations = [];
|
|
1481
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
1482
|
+
const isBig = () => matchMedia("(min-height: 740px) and (min-width: 740px)").matches;
|
|
1483
|
+
props.register_closing_animation_(() => Promise.all(closing_animations.map(animation => animation().finished)));
|
|
1484
|
+
$ca1176b694a6ee2e$export$fe334901e8bebd57();
|
|
1485
|
+
return [(() => {
|
|
1486
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($b0ceb08960135d83$var$_tmpl$3),
|
|
1487
|
+
_el$2 = _el$.firstChild,
|
|
1488
|
+
_el$3 = _el$2.nextSibling;
|
|
1489
|
+
const _ref$ = $gVhhF$depictaiutilishared.catchify(element => {
|
|
1490
|
+
const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(element, ({
|
|
1491
|
+
element: element
|
|
1492
|
+
}) => {
|
|
1493
|
+
const animation = element.animate({
|
|
1494
|
+
opacity: [0, 1],
|
|
1495
|
+
backdropFilter: ["blur(0)", "blur(3px)"]
|
|
1496
|
+
}, {
|
|
1497
|
+
duration: 150,
|
|
1498
|
+
fill: "forwards",
|
|
1499
|
+
easing: "ease-in-out"
|
|
1500
|
+
});
|
|
1501
|
+
closing_animations.push(() => (animation.reverse(), animation));
|
|
1502
|
+
});
|
|
1503
|
+
$gVhhF$solidjs.onCleanup(disconnect);
|
|
1504
|
+
});
|
|
1505
|
+
typeof _ref$ === "function" && $gVhhF$solidjsweb.use(_ref$, _el$2);
|
|
1506
|
+
$gVhhF$solidjsweb.addEventListener(_el$2, "click", props.actually_close_modal_, true);
|
|
1507
|
+
$gVhhF$solidjsweb.use(element => {
|
|
1508
|
+
const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(element, ({
|
|
1509
|
+
element: element
|
|
1510
|
+
}) => element.animate({
|
|
1511
|
+
opacity: [0, 1],
|
|
1512
|
+
transform: isBig() ? ["translate(-50%,-150%)", "translate(-50%,-50%)"] : ["translate(-50%,80%)", "translate(-50%,0%)"]
|
|
1513
|
+
}, {
|
|
1514
|
+
duration: 250,
|
|
1515
|
+
easing: "ease-in"
|
|
1516
|
+
}));
|
|
1517
|
+
closing_animations.push(() => element.animate({
|
|
1518
|
+
opacity: [1, 0],
|
|
1519
|
+
transform: isBig() ? ["translate(-50%,-50%)", "translate(-50%,-150%)"] : ["translate(-50%,0%)", "translate(-50%,80%)"]
|
|
1520
|
+
}, {
|
|
1521
|
+
duration: 150,
|
|
1522
|
+
easing: "ease-out"
|
|
1523
|
+
}));
|
|
1524
|
+
$gVhhF$solidjs.onCleanup(disconnect);
|
|
1525
|
+
}, _el$3);
|
|
1526
|
+
$gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
1527
|
+
message_: "ShopTheLookModal failed",
|
|
1528
|
+
severity_: "error",
|
|
1529
|
+
get children() {
|
|
1530
|
+
return [(() => {
|
|
1531
|
+
const _el$4 = $gVhhF$solidjsweb.getNextElement($b0ceb08960135d83$var$_tmpl$),
|
|
1532
|
+
_el$5 = _el$4.firstChild;
|
|
1533
|
+
$gVhhF$solidjsweb.addEventListener(_el$5, "click", props.actually_close_modal_, true);
|
|
1534
|
+
$gVhhF$solidjsweb.insert(_el$5, $gVhhF$solidjsweb.createComponent((0, $c77c68e559a1506c$export$3b621d86b1566b2), {
|
|
1535
|
+
width: 16,
|
|
1536
|
+
height: 16
|
|
1537
|
+
}));
|
|
1538
|
+
$gVhhF$solidjsweb.runHydrationEvents();
|
|
1539
|
+
return _el$4;
|
|
1540
|
+
})(), (() => {
|
|
1541
|
+
const _el$6 = $gVhhF$solidjsweb.getNextElement($b0ceb08960135d83$var$_tmpl$2),
|
|
1542
|
+
_el$7 = _el$6.firstChild,
|
|
1543
|
+
_el$8 = _el$7.nextSibling,
|
|
1544
|
+
_el$10 = _el$8.firstChild,
|
|
1545
|
+
[_el$11, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$10.nextSibling),
|
|
1546
|
+
_el$9 = _el$11.nextSibling;
|
|
1547
|
+
$gVhhF$solidjsweb.insert(_el$8, $gVhhF$solidjsweb.createComponent((0, $bbe694fe824b9c78$export$41e1a079d40a0d58), {
|
|
1548
|
+
get locale_() {
|
|
1549
|
+
return props.locale;
|
|
1550
|
+
},
|
|
1551
|
+
get market_() {
|
|
1552
|
+
return props.market;
|
|
1553
|
+
},
|
|
1554
|
+
get merchant_() {
|
|
1555
|
+
return props.merchant;
|
|
1556
|
+
},
|
|
1557
|
+
get imageAspectRatio_() {
|
|
1558
|
+
return props.imageAspectRatio;
|
|
1559
|
+
},
|
|
1560
|
+
get productId_() {
|
|
1561
|
+
return props.productId;
|
|
1562
|
+
}
|
|
1563
|
+
}), _el$11, _co$);
|
|
1564
|
+
$gVhhF$solidjsweb.insert(_el$9, $gVhhF$solidjsweb.createComponent((0, $f55548318724b05c$export$6b35356958ae5587), {
|
|
1565
|
+
modalOwner_: owner,
|
|
1566
|
+
pseudo_router_: pseudo_router_,
|
|
1567
|
+
get productCardTemplate_() {
|
|
1568
|
+
return props.productCardTemplate;
|
|
1569
|
+
},
|
|
1570
|
+
get products_to_shop_() {
|
|
1571
|
+
return props.products_to_shop_;
|
|
1572
|
+
},
|
|
1573
|
+
get actually_close_modal_() {
|
|
1574
|
+
return props.actually_close_modal_;
|
|
1575
|
+
}
|
|
1576
|
+
}));
|
|
1577
|
+
return _el$6;
|
|
1578
|
+
})()];
|
|
1579
|
+
}
|
|
1580
|
+
}));
|
|
1581
|
+
$gVhhF$solidjsweb.runHydrationEvents();
|
|
1582
|
+
return _el$;
|
|
1583
|
+
})()];
|
|
1584
|
+
}
|
|
1585
|
+
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
1586
|
+
const $a5f3eaa1a24bbc1e$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>Failed fetching shop the look recommendations`),
|
|
1587
|
+
$a5f3eaa1a24bbc1e$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button>`);
|
|
1588
|
+
const $a5f3eaa1a24bbc1e$var$CANT_FETCH = "Failed fetching shop the look recommendations";
|
|
1589
|
+
let $a5f3eaa1a24bbc1e$var$setModalShouldBeOpen;
|
|
1590
|
+
let $a5f3eaa1a24bbc1e$var$modalProps;
|
|
1591
|
+
function $a5f3eaa1a24bbc1e$export$d4973c31938cbfd1(props) {
|
|
1592
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.ErrorBoundary), {
|
|
1593
|
+
fallback: () => $gVhhF$solidjsweb.getNextElement($a5f3eaa1a24bbc1e$var$_tmpl$),
|
|
1594
|
+
get children() {
|
|
1595
|
+
return $gVhhF$solidjsweb.createComponent($a5f3eaa1a24bbc1e$var$ActualShopTheLookButton, props);
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function $a5f3eaa1a24bbc1e$var$ActualShopTheLookButton(props) {
|
|
1600
|
+
const [products_to_shop_] = $gVhhF$solidjs.createResource(() => ({
|
|
1601
|
+
merchant: props.merchant,
|
|
1602
|
+
market: props.market,
|
|
1603
|
+
locale: props.locale,
|
|
1604
|
+
product_ids: [props.productId],
|
|
1605
|
+
type: "shop_the_look",
|
|
1606
|
+
session_id: $gVhhF$depictaiutilishared.get_session_id()
|
|
1607
|
+
}), async request => {
|
|
1608
|
+
const response = await fetch($gVhhF$depictaiutilishared.add_version_query_params(`${(0, $gVhhF$depictaiutilishared.base_url)}/v3/shop-the-look`), {
|
|
1609
|
+
method: "POST",
|
|
1610
|
+
body: JSON.stringify(request)
|
|
1611
|
+
});
|
|
1612
|
+
if (!response.ok) {
|
|
1613
|
+
$gVhhF$depictaiutilishared.dwarn(response);
|
|
1614
|
+
throw new Error($a5f3eaa1a24bbc1e$var$CANT_FETCH);
|
|
1615
|
+
}
|
|
1616
|
+
const decoded = await response.json();
|
|
1617
|
+
return decoded;
|
|
1618
|
+
});
|
|
1619
|
+
const [localProps, partForModal] = $gVhhF$solidjs.splitProps(props, ["buttonAttributes"]);
|
|
1620
|
+
const {
|
|
1621
|
+
openModal: openModal,
|
|
1622
|
+
closeModal: closeModal
|
|
1623
|
+
} = $a5f3eaa1a24bbc1e$var$useShopTheLookModal();
|
|
1624
|
+
const hasAnythingToShow = $gVhhF$solidjs.createMemo(() => Object.entries(products_to_shop_()?.shop_the_look || {}).length);
|
|
1625
|
+
const displayStyleValue = $gVhhF$solidjs.createMemo(() => hasAnythingToShow() ? "" : "none");
|
|
1626
|
+
const button = (() => {
|
|
1627
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($a5f3eaa1a24bbc1e$var$_tmpl$2);
|
|
1628
|
+
$gVhhF$solidjsweb.spread(_el$2, $gVhhF$solidjsweb.mergeProps(() => localProps.buttonAttributes), false, true);
|
|
1629
|
+
$gVhhF$solidjsweb.insert(_el$2, () => localProps?.buttonAttributes?.children || "Shop the look");
|
|
1630
|
+
$gVhhF$solidjsweb.runHydrationEvents();
|
|
1631
|
+
return _el$2;
|
|
1632
|
+
})();
|
|
1633
|
+
$gVhhF$solidjs.createEffect(() => button.style.display = displayStyleValue()); // Set our attributes like this, so we allow total control over the button from the outside via buttonAttributes
|
|
1634
|
+
$gVhhF$solidjs.createEffect(() => !hasAnythingToShow() && closeModal()); // close modal if we ever get into the state of having it open and not having anything to show
|
|
1635
|
+
$a5f3eaa1a24bbc1e$var$modalProps = $gVhhF$solidjs.mergeProps(partForModal, {
|
|
1636
|
+
products_to_shop_: products_to_shop_
|
|
1637
|
+
});
|
|
1638
|
+
button.addEventListener("click", openModal);
|
|
1639
|
+
return button;
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* This does not need to be run in a root at all, it will create a root every time the modal is opened and then tear it down when the modal is closed again
|
|
1643
|
+
*/
|
|
1644
|
+
function $a5f3eaa1a24bbc1e$var$useShopTheLookModal() {
|
|
1645
|
+
if ($a5f3eaa1a24bbc1e$var$setModalShouldBeOpen) return $a5f3eaa1a24bbc1e$var$setModalShouldBeOpen;
|
|
1646
|
+
return $a5f3eaa1a24bbc1e$var$setModalShouldBeOpen = $gVhhF$solidjs.createRoot(() => $a5f3eaa1a24bbc1e$var$actualSetupModal());
|
|
1647
|
+
}
|
|
1648
|
+
function $a5f3eaa1a24bbc1e$var$actualSetupModal() {
|
|
1649
|
+
// Save modal state in history so modal is still open after people go back
|
|
1650
|
+
const history_key = "depict_shop_the_look_open";
|
|
1651
|
+
const {
|
|
1652
|
+
[history_key]: [history_value, set_history_value]
|
|
1653
|
+
} = $6e22b5314fb52f4c$export$e183a13865960371({
|
|
1654
|
+
[history_key]: false
|
|
1655
|
+
}, {
|
|
1656
|
+
navigate_: {
|
|
1657
|
+
replace_state_: new_state => globalThis?.history?.replaceState(new_state, "")
|
|
1658
|
+
}
|
|
1659
|
+
});
|
|
1660
|
+
(0, $d84fe647b84b5dc5$export$3064e1e8c6513da3).add(history_key);
|
|
1661
|
+
const actually_close_modal_ = () => set_history_value(false);
|
|
1662
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
1663
|
+
$gVhhF$depictaiutilishared.catchify(async () => {
|
|
1664
|
+
const {
|
|
1665
|
+
open_modal_: open_modal_,
|
|
1666
|
+
close_modal_: close_modal_
|
|
1667
|
+
} = await $9abb0a35d4b60ed3$export$79b1565500412d9b((0, $b0ceb08960135d83$export$a3cbef418994a664), {
|
|
1668
|
+
actually_close_modal_: actually_close_modal_
|
|
1669
|
+
});
|
|
1670
|
+
$gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => {
|
|
1671
|
+
if (history_value()) open_modal_($a5f3eaa1a24bbc1e$var$modalProps);else close_modal_();
|
|
1672
|
+
}));
|
|
1673
|
+
})();
|
|
1674
|
+
return {
|
|
1675
|
+
openModal: () => set_history_value(true),
|
|
1676
|
+
closeModal: actually_close_modal_
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
const $1ab22f2cd39b3061$var$fallback_operator = "in";
|
|
1680
|
+
const $1ab22f2cd39b3061$var$fallback_token = "";
|
|
1681
|
+
const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
|
|
1682
|
+
const $1ab22f2cd39b3061$var$operator_map = {
|
|
1683
|
+
"eq": "\u2261",
|
|
1684
|
+
"neq": "\u2260",
|
|
1685
|
+
"in": "\u2208",
|
|
1686
|
+
"nin": "\u2209",
|
|
1687
|
+
"leq": "\u2264",
|
|
1688
|
+
"geq": "\u2265",
|
|
1689
|
+
"inrange": "\uD83D\uDD22"
|
|
1690
|
+
};
|
|
1691
|
+
const $1ab22f2cd39b3061$var$ascending_token = "\uD83D\uDCC8";
|
|
1692
|
+
const $1ab22f2cd39b3061$var$descending_token = "\uD83D\uDCC9";
|
|
1693
|
+
const $1ab22f2cd39b3061$var$range_delimiter = "-";
|
|
1694
|
+
const $1ab22f2cd39b3061$var$string_item_delimiter = "\u201A"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
|
|
1695
|
+
const $1ab22f2cd39b3061$var$array_item_delimiter = "\u2023"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
|
|
1696
|
+
const $1ab22f2cd39b3061$var$empty_item_replacement = "0\uFE0F\u20E3";
|
|
1697
|
+
const $1ab22f2cd39b3061$var$op_to_token = op => {
|
|
1698
|
+
if (op === $1ab22f2cd39b3061$var$fallback_operator) return $1ab22f2cd39b3061$var$fallback_token;
|
|
1699
|
+
return $1ab22f2cd39b3061$var$operator_map[op];
|
|
1700
|
+
};
|
|
1701
|
+
/**
|
|
1702
|
+
* Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
|
|
1703
|
+
* The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
|
|
1704
|
+
* No deep or mixed nesting levels are supported.
|
|
1705
|
+
*/
|
|
1706
|
+
function $1ab22f2cd39b3061$var$array_is_serializable(array, is_root = true) {
|
|
1707
|
+
if (array.every(item => Array.isArray(item))) {
|
|
1708
|
+
if (!is_root)
|
|
1709
|
+
// Deeply nested arrays are not supported, but also don't exist as filters (yet)
|
|
1710
|
+
return false;
|
|
1711
|
+
return array.every(item => $1ab22f2cd39b3061$var$array_is_serializable(item, false));
|
|
1712
|
+
}
|
|
1713
|
+
if (array.some(item => typeof item !== "string"))
|
|
1714
|
+
// Numbers are not supported, since 1 and "1" would encode to the same thing
|
|
1715
|
+
return false;
|
|
1716
|
+
// Encoding reserved characters is not supported
|
|
1717
|
+
return !array.some(item => item.includes($1ab22f2cd39b3061$var$array_item_delimiter) || item.includes($1ab22f2cd39b3061$var$string_item_delimiter) || item === $1ab22f2cd39b3061$var$empty_item_replacement);
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Human readable string[] or string[][] serialization for URLs.
|
|
1721
|
+
* @param array
|
|
1722
|
+
* @returns
|
|
1723
|
+
*/
|
|
1724
|
+
function $1ab22f2cd39b3061$var$encode_array(array) {
|
|
1725
|
+
const is_nested = array.every(item => Array.isArray(item));
|
|
1726
|
+
if (is_nested) return array.map($1ab22f2cd39b3061$var$encode_array).join($1ab22f2cd39b3061$var$array_item_delimiter) + $1ab22f2cd39b3061$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
|
|
1727
|
+
return array.map(item => item === "" ? $1ab22f2cd39b3061$var$empty_item_replacement : item).join($1ab22f2cd39b3061$var$string_item_delimiter);
|
|
1728
|
+
}
|
|
1729
|
+
function $1ab22f2cd39b3061$var$decode_array(encoded_array) {
|
|
1730
|
+
const is_nested = encoded_array.includes($1ab22f2cd39b3061$var$array_item_delimiter);
|
|
1731
|
+
if (is_nested) return encoded_array.split($1ab22f2cd39b3061$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
|
|
1732
|
+
.map($1ab22f2cd39b3061$var$decode_array);
|
|
1733
|
+
return encoded_array.split($1ab22f2cd39b3061$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
|
|
1734
|
+
.map(item => item === $1ab22f2cd39b3061$var$empty_item_replacement ? "" : item);
|
|
1735
|
+
}
|
|
1736
|
+
function $1ab22f2cd39b3061$var$encode_filter_data(op, data) {
|
|
1737
|
+
if (data === "true")
|
|
1738
|
+
// boolean encoding
|
|
1739
|
+
return "1";
|
|
1740
|
+
if (data === "false")
|
|
1741
|
+
// boolean encoding
|
|
1742
|
+
return "0";
|
|
1743
|
+
const data_is_array = Array.isArray(data);
|
|
1744
|
+
if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
|
|
1745
|
+
// numeric range filter encoding
|
|
1746
|
+
return data.join($1ab22f2cd39b3061$var$range_delimiter);
|
|
1747
|
+
if (data_is_array && $1ab22f2cd39b3061$var$array_is_serializable(data)) {
|
|
1748
|
+
const encoded_data = $1ab22f2cd39b3061$var$encode_array(data);
|
|
1749
|
+
if (!encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter) && !encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter))
|
|
1750
|
+
// A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
|
|
1751
|
+
// In that case we add a delimiter suffix at the end
|
|
1752
|
+
return encoded_data + $1ab22f2cd39b3061$var$string_item_delimiter;
|
|
1753
|
+
return encoded_data;
|
|
1754
|
+
}
|
|
1755
|
+
// Fallback encoding
|
|
1756
|
+
return $gVhhF$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
|
|
1757
|
+
}
|
|
1758
|
+
function $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data) {
|
|
1759
|
+
if (encoded_data === "1") return "true";
|
|
1760
|
+
if (encoded_data === "0") return "false";
|
|
1761
|
+
if (op === "inrange" && encoded_data.includes($1ab22f2cd39b3061$var$range_delimiter)) return encoded_data.split($1ab22f2cd39b3061$var$range_delimiter).map(x => parseFloat(x));
|
|
1762
|
+
if (encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter) || encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter)) return $1ab22f2cd39b3061$var$decode_array(encoded_data);
|
|
1763
|
+
try {
|
|
1764
|
+
return JSON.parse($gVhhF$depictaiutilishared.base64_decode_unicode(encoded_data));
|
|
1765
|
+
} catch (e) {
|
|
1766
|
+
$gVhhF$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
|
|
1767
|
+
}
|
|
1768
|
+
return null;
|
|
1769
|
+
}
|
|
1770
|
+
function $1ab22f2cd39b3061$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
|
|
1771
|
+
for (const filter of filters) {
|
|
1772
|
+
const {
|
|
1773
|
+
field: field,
|
|
1774
|
+
op: op,
|
|
1775
|
+
data: data
|
|
1776
|
+
} = filter;
|
|
1777
|
+
const encoded_data = $1ab22f2cd39b3061$var$encode_filter_data(op, data);
|
|
1778
|
+
search_params.set(filter_query_param_prefix + field + $1ab22f2cd39b3061$var$op_to_token(op), encoded_data);
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
|
|
1782
|
+
const found_filters = [];
|
|
1783
|
+
for (const key of search_params.keys()) {
|
|
1784
|
+
// Allow for backwards compatibility with the old filter query param prefix
|
|
1785
|
+
let chosen_prefix = filter_query_param_prefix;
|
|
1786
|
+
if (!key.startsWith(chosen_prefix)) {
|
|
1787
|
+
chosen_prefix = $1ab22f2cd39b3061$var$legacy_filter_prefix;
|
|
1788
|
+
if (!key.startsWith(chosen_prefix)) continue;
|
|
1789
|
+
}
|
|
1790
|
+
const encoded_data = search_params.get(key);
|
|
1791
|
+
if (!encoded_data) continue;
|
|
1792
|
+
const [op, token] = Object.entries($1ab22f2cd39b3061$var$operator_map).find(([, token]) => key.endsWith(token)) || [$1ab22f2cd39b3061$var$fallback_operator, $1ab22f2cd39b3061$var$fallback_token];
|
|
1793
|
+
const data = $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data);
|
|
1794
|
+
if (!data) continue;
|
|
1795
|
+
const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
|
|
1796
|
+
found_filters.push({
|
|
1797
|
+
field: field,
|
|
1798
|
+
op: op,
|
|
1799
|
+
data: data
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
return found_filters;
|
|
1803
|
+
}
|
|
1804
|
+
function $1ab22f2cd39b3061$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
|
|
1805
|
+
if (!sorting) return;
|
|
1806
|
+
const {
|
|
1807
|
+
field: field,
|
|
1808
|
+
order: order
|
|
1809
|
+
} = sorting;
|
|
1810
|
+
const ascending = order === "asc";
|
|
1811
|
+
search_params.set(sorting_query_param, field + (ascending ? $1ab22f2cd39b3061$var$ascending_token : $1ab22f2cd39b3061$var$descending_token));
|
|
1812
|
+
}
|
|
1813
|
+
function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params, sorting_query_param_) {
|
|
1814
|
+
const encoded_sorting = search_params.get(sorting_query_param_);
|
|
1815
|
+
if (!encoded_sorting) return;
|
|
1816
|
+
if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$ascending_token)) return {
|
|
1817
|
+
field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$ascending_token.length),
|
|
1818
|
+
order: "asc"
|
|
1819
|
+
};
|
|
1820
|
+
if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$descending_token)) return {
|
|
1821
|
+
field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$descending_token.length),
|
|
1822
|
+
order: "desc"
|
|
1823
|
+
};
|
|
1824
|
+
$gVhhF$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
|
|
1825
|
+
return;
|
|
1826
|
+
}
|
|
1827
|
+
function $1ab22f2cd39b3061$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
|
|
1828
|
+
// We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
|
|
1829
|
+
const keys = [...search_params.keys()];
|
|
1830
|
+
for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($1ab22f2cd39b3061$var$legacy_filter_prefix)) search_params.delete(key);
|
|
1831
|
+
}
|
|
1832
|
+
const $1ab22f2cd39b3061$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
|
|
1833
|
+
function $1ab22f2cd39b3061$export$43cd1e747fecd42e({
|
|
1834
|
+
to_url_: to_url_,
|
|
1835
|
+
set_clearing_flag_: set_clearing_flag_,
|
|
1836
|
+
from_search_params_ = new URLSearchParams(location.search),
|
|
1837
|
+
sorting_query_param_: sorting_query_param_,
|
|
1838
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
1839
|
+
}) {
|
|
1840
|
+
if (!to_url_) return to_url_;
|
|
1841
|
+
const was_url_object = to_url_ instanceof URL;
|
|
1842
|
+
const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
|
|
1843
|
+
const {
|
|
1844
|
+
searchParams: searchParams
|
|
1845
|
+
} = url_object;
|
|
1846
|
+
if (set_clearing_flag_) searchParams.set($1ab22f2cd39b3061$export$cf5feb2102aec7f2, "true");
|
|
1847
|
+
if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
|
|
1848
|
+
for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
|
|
1849
|
+
if (was_url_object) return url_object;
|
|
1850
|
+
return url_object.href;
|
|
1851
|
+
}
|
|
1852
|
+
const $93304d59a9747aa6$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`);
|
|
1853
|
+
function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
|
|
1854
|
+
return (() => {
|
|
1855
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($93304d59a9747aa6$var$_tmpl$);
|
|
1856
|
+
$gVhhF$solidjsweb.effect(_p$ => {
|
|
1857
|
+
const _v$ = `position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`,
|
|
1858
|
+
_v$2 = props.class;
|
|
1859
|
+
_p$._v$ = $gVhhF$solidjsweb.style(_el$, _v$, _p$._v$);
|
|
1860
|
+
_v$2 !== _p$._v$2 && $gVhhF$solidjsweb.className(_el$, _p$._v$2 = _v$2);
|
|
1861
|
+
return _p$;
|
|
1862
|
+
}, {
|
|
1863
|
+
_v$: undefined,
|
|
1864
|
+
_v$2: undefined
|
|
1865
|
+
});
|
|
1866
|
+
return _el$;
|
|
1867
|
+
})();
|
|
1868
|
+
}
|
|
1869
|
+
function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
|
|
1870
|
+
const [size, setSize] = $gVhhF$solidjs.createSignal(0);
|
|
1871
|
+
const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => {
|
|
1872
|
+
for (let j = 0; j < records.length; j++) {
|
|
1873
|
+
const {
|
|
1874
|
+
width: width
|
|
1875
|
+
} = records[j].contentRect;
|
|
1876
|
+
if (!width) continue;
|
|
1877
|
+
// add extra 5% just in case. + safari is (in some cases) acting a bit questionable and needs a third extra to fill the set width
|
|
1878
|
+
const new_size = width * 1.05 * ((0, $gVhhF$depictaiutilishared.is_safari) ? 4 / 3 : 1);
|
|
1879
|
+
setSize(Math.round(new_size));
|
|
1880
|
+
}
|
|
1881
|
+
}));
|
|
1882
|
+
// If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
|
|
1883
|
+
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
1884
|
+
const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(whatToWatch, ({
|
|
1885
|
+
element: element
|
|
1886
|
+
}) => requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => resizeObserver.observe(element))));
|
|
1887
|
+
$gVhhF$solidjs.onCleanup(() => {
|
|
1888
|
+
resizeObserver.disconnect();
|
|
1889
|
+
disconnect();
|
|
1890
|
+
});
|
|
1891
|
+
return size;
|
|
1892
|
+
}
|
|
1893
|
+
const $19950faaac026e09$var$onIdleFunctionsSymbol = /*@__PURE__*/Symbol("onIdleFunctions");
|
|
1894
|
+
function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
1895
|
+
// Enable reactive props
|
|
1896
|
+
const otherOptions = $gVhhF$solidjs.createMemo(() => {
|
|
1897
|
+
const cloned_props = {
|
|
1898
|
+
...props
|
|
1899
|
+
};
|
|
1900
|
+
delete cloned_props.resolutions;
|
|
1901
|
+
// @ts-ignore
|
|
1902
|
+
delete cloned_props.size;
|
|
1903
|
+
// @ts-ignore
|
|
1904
|
+
delete cloned_props.src;
|
|
1905
|
+
return cloned_props;
|
|
1906
|
+
});
|
|
1907
|
+
const src_options = $gVhhF$solidjs.createMemo(() => {
|
|
1908
|
+
const src = new URL(props.src, location.origin);
|
|
1909
|
+
const fallback_src = $19950faaac026e09$var$generateImageUrl(src, 400);
|
|
1910
|
+
const srcset = $19950faaac026e09$var$make_srcset(src, props.resolutions || [64, 128, 256, 300, 400, 512, 768, 1024, 1280, 1536, 2048, 4096]);
|
|
1911
|
+
return {
|
|
1912
|
+
src: fallback_src,
|
|
1913
|
+
srcset: srcset
|
|
1914
|
+
};
|
|
1915
|
+
});
|
|
1916
|
+
// Work around https://github.com/solidjs/solid/issues/1828
|
|
1917
|
+
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
1918
|
+
const [hasSetSize, setHasSetSize] = $gVhhF$solidjs.createSignal(false);
|
|
1919
|
+
const [hasDecoded, setHasDecoded] = $gVhhF$solidjs.createSignal(false);
|
|
1920
|
+
const sizePX = $gVhhF$solidjs.createMemo(() => `${props.size()}px`); // props.size could be a getter that expects a cleanup so get it in this memo instead of where we set img.sizes
|
|
1921
|
+
const listingContext = $84798aaa863a4909$export$8d0c4fdbb05a2f2e();
|
|
1922
|
+
// Batch idle callbacks so that MutationObserver can batch the resulting mutations better, so we don't lose tons of CPU time to MutationObservers doing lots of things for each image
|
|
1923
|
+
// Happened on singular, they have some weird observer (+we also have one but ours is at least 3x more efficient)
|
|
1924
|
+
const executeWhenIdleBatched = fn => {
|
|
1925
|
+
if (typeof requestIdleCallback !== "function") return setTimeout(fn); // Old browsers don't get optimisation
|
|
1926
|
+
const existingStack = listingContext?.[$19950faaac026e09$var$onIdleFunctionsSymbol];
|
|
1927
|
+
if (existingStack) return existingStack.add(fn);
|
|
1928
|
+
const newStack = new Set([fn]);
|
|
1929
|
+
if (listingContext) listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol] = newStack;
|
|
1930
|
+
const processStackWhenIdle = () => requestIdleCallback(deadline => {
|
|
1931
|
+
const start = performance.now();
|
|
1932
|
+
const thirdDeadlineTime = deadline.timeRemaining() / 3; // observers coming after this take up 2-3x the time so don't use all of it
|
|
1933
|
+
for (const fn of newStack) {
|
|
1934
|
+
newStack.delete(fn);
|
|
1935
|
+
fn();
|
|
1936
|
+
const timeTaken = performance.now() - start;
|
|
1937
|
+
if ((!deadline.timeRemaining() || timeTaken > thirdDeadlineTime) && newStack.size) {
|
|
1938
|
+
// There's still work to be done but no time, so schedule another idle callback
|
|
1939
|
+
processStackWhenIdle();
|
|
1940
|
+
return;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
// Stack is empty
|
|
1944
|
+
if (listingContext) delete listingContext[$19950faaac026e09$var$onIdleFunctionsSymbol];
|
|
1945
|
+
}, {
|
|
1946
|
+
timeout: 15000
|
|
1947
|
+
} // long timeout, better to not have images than to freeze the browser. But also we don't want to confuse user why no iamges are loading
|
|
1948
|
+
);
|
|
1949
|
+
|
|
1950
|
+
processStackWhenIdle();
|
|
1951
|
+
};
|
|
1952
|
+
let sizeSetFastPath = false;
|
|
1953
|
+
let hasDecodedFastPath = false;
|
|
1954
|
+
let timeoutSet = false;
|
|
1955
|
+
let gotCleanedUp = false;
|
|
1956
|
+
$gVhhF$solidjs.onCleanup(() => gotCleanedUp = true);
|
|
1957
|
+
$gVhhF$solidjsweb.spread(img, $gVhhF$solidjs.mergeProps(otherOptions), false, true);
|
|
1958
|
+
$gVhhF$solidjs.createEffect(() => {
|
|
1959
|
+
if (!props.size()) return; // wait until we have a size
|
|
1960
|
+
if (timeoutSet) return;
|
|
1961
|
+
const handler = $gVhhF$depictaiutilishared.catchify(() => {
|
|
1962
|
+
if (gotCleanedUp) return;
|
|
1963
|
+
img.sizes = sizePX(); // use latest available value of props.size
|
|
1964
|
+
if (!sizeSetFastPath) {
|
|
1965
|
+
setHasSetSize(true);
|
|
1966
|
+
sizeSetFastPath = true;
|
|
1967
|
+
}
|
|
1968
|
+
timeoutSet = false;
|
|
1969
|
+
});
|
|
1970
|
+
// Throttle the updating of sizes to avoid unnecessary image re-fetches during resize
|
|
1971
|
+
// And also because we first set src after sizes has been set, wait with loading and decoding images until browser is idle
|
|
1972
|
+
// This greatly improves performance when loading (more) products
|
|
1973
|
+
// See https://depictaiworkspace.slack.com/archives/C05NJ0K3WRL/p1698220617663139
|
|
1974
|
+
executeWhenIdleBatched(handler);
|
|
1975
|
+
timeoutSet = true;
|
|
1976
|
+
});
|
|
1977
|
+
$gVhhF$solidjs.createEffect(() => {
|
|
1978
|
+
if (!props.size() || !hasSetSize()) return; // If size isn't known or set, don't assign src yet since it would cause the most low res image to load
|
|
1979
|
+
Object.assign(img, src_options());
|
|
1980
|
+
// Add to DOM once decoded to not require/block any paints before image has completed loading and avoid showing broken image symbol
|
|
1981
|
+
// We can do this because there has to be a container around us giving us a size
|
|
1982
|
+
// No need to listen if we're already in the DOM
|
|
1983
|
+
if (hasDecodedFastPath) return;
|
|
1984
|
+
if (props.loading === "lazy") {
|
|
1985
|
+
// For lazy loading there's no decoding to wait for as it only occurs when the image is visible
|
|
1986
|
+
// Make sure src is set before we put the image into the DOM though so no broken image symbol is shown
|
|
1987
|
+
setHasDecoded(true);
|
|
1988
|
+
hasDecodedFastPath = true;
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
img.decode().catch(e => $gVhhF$depictaiutilishared.dwarn("Failed to decode image", e, img)) // Display the image also if loading failed so webdev can debug and doesn't get "no image"
|
|
1992
|
+
.then(async () => {
|
|
1993
|
+
// Also wait with inserting image (i.e. paint) until browser is idle
|
|
1994
|
+
await new Promise(r => executeWhenIdleBatched(r));
|
|
1995
|
+
if (gotCleanedUp) return;
|
|
1996
|
+
setHasDecoded(true);
|
|
1997
|
+
hasDecodedFastPath = true;
|
|
1998
|
+
});
|
|
1999
|
+
});
|
|
2000
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
2001
|
+
get when() {
|
|
2002
|
+
return hasDecoded();
|
|
2003
|
+
},
|
|
2004
|
+
children: img
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
function $19950faaac026e09$var$make_srcset(url, resolutions) {
|
|
2008
|
+
return resolutions.map(width => `${$19950faaac026e09$var$generateImageUrl(url, width)} ${width}w`).join(", ");
|
|
2009
|
+
}
|
|
2010
|
+
function $19950faaac026e09$var$generateImageUrl(url, width) {
|
|
2011
|
+
// This function is quite slow, we maybe could do string concat with encodeURIComponent instead if shopify handles double width params well?
|
|
2012
|
+
url.searchParams.set("width", width);
|
|
2013
|
+
return url.href;
|
|
2014
|
+
}
|
|
2015
|
+
const $a33065cfed827fc0$var$backupSizeSignal = /*@__PURE__*/$gVhhF$solidjs.createSignal();
|
|
2016
|
+
const $a33065cfed827fc0$export$d7b7ab832c20e2f4 = /*@__PURE__*/Symbol("ShopifyContainedImage");
|
|
2017
|
+
function $a33065cfed827fc0$export$e4b984597b71e989(props) {
|
|
2018
|
+
const context = $84798aaa863a4909$export$8d0c4fdbb05a2f2e();
|
|
2019
|
+
if (context && !context[$a33065cfed827fc0$export$d7b7ab832c20e2f4])
|
|
2020
|
+
// create a signal that's the same for all items in this listing
|
|
2021
|
+
context[$a33065cfed827fc0$export$d7b7ab832c20e2f4] = $gVhhF$solidjs.createSignal();
|
|
2022
|
+
const [currentImageSize, setCurrentImageSize] = context?.[$a33065cfed827fc0$export$d7b7ab832c20e2f4] || $a33065cfed827fc0$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
2023
|
+
const container = $gVhhF$solidjsweb.createComponent((0, $93304d59a9747aa6$export$94026ee33dbabc26), {
|
|
2024
|
+
get aspectRatio() {
|
|
2025
|
+
return props.aspectRatio;
|
|
2026
|
+
},
|
|
2027
|
+
get ["class"]() {
|
|
2028
|
+
return props.class;
|
|
2029
|
+
}
|
|
2030
|
+
});
|
|
2031
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
2032
|
+
let createdSizeAccessor = false;
|
|
2033
|
+
let wasCleanedUp = false;
|
|
2034
|
+
$gVhhF$solidjs.createEffect(() => {
|
|
2035
|
+
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
2036
|
+
// ensure we always have a size accessor
|
|
2037
|
+
// what this whole thing does is set the sizes attribute to the actual size of one of the existing image containers, therefore the value doesn't have to manually be specified
|
|
2038
|
+
createdSizeAccessor = true;
|
|
2039
|
+
setCurrentImageSize(() => $gVhhF$solidjs.runWithOwner(owner, () => $19950faaac026e09$export$e6fffe67d4cdd848(container)));
|
|
2040
|
+
});
|
|
2041
|
+
$gVhhF$solidjs.onCleanup(() => {
|
|
2042
|
+
wasCleanedUp = true; // important to set this before the function call below and always, so the dead effects don't create dead size accessors
|
|
2043
|
+
if (!createdSizeAccessor) return;
|
|
2044
|
+
$gVhhF$depictaiutilishared.queueMacroTask(() => setCurrentImageSize(undefined)); // unset the size accessor next event loop iteration, so that all onCleanup's have time to run, since the effects run more aggressively and can create a size accessor with a cleaned up owner otherwise
|
|
2045
|
+
});
|
|
2046
|
+
|
|
2047
|
+
$gVhhF$solidjsweb.insert(container, $gVhhF$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), {
|
|
2048
|
+
style: "width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0;",
|
|
2049
|
+
get size() {
|
|
2050
|
+
return $gVhhF$solidjs.createMemo(() => currentImageSize()?.() || 0);
|
|
2051
|
+
},
|
|
2052
|
+
get src() {
|
|
2053
|
+
return props.src;
|
|
2054
|
+
},
|
|
2055
|
+
get alt() {
|
|
2056
|
+
return props.alt;
|
|
953
2057
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
2058
|
+
}));
|
|
2059
|
+
return container;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
/** @jsxImportSource solid-js */
|
|
2063
|
+
|
|
2064
|
+
function $f13855d1b951b24a$export$ebdc3711f7e02ccd(what_to_watch) {
|
|
2065
|
+
const [width, setWidth] = $gVhhF$solidjs.createSignal();
|
|
2066
|
+
const resizeObserver = new ResizeObserver($gVhhF$depictaiutilishared.catchify(records => {
|
|
2067
|
+
for (let j = 0; j < records.length; j++) {
|
|
2068
|
+
const width = records[j].borderBoxSize?.[0]?.inlineSize ?? what_to_watch.getBoundingClientRect().width;
|
|
2069
|
+
setWidth(width);
|
|
961
2070
|
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
visible_recs = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
|
|
978
|
-
const visible_recs_next_show_more = $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
|
|
979
|
-
// Should this really be zero when we default rows_per_click to 1?
|
|
980
|
-
children_count, options);
|
|
981
|
-
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
982
|
-
} else {
|
|
983
|
-
visible_recs = $gVhhF$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
|
|
984
|
-
should_hide_view_more_button = visible_recs >= children_count;
|
|
985
|
-
}
|
|
986
|
-
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
987
|
-
// I don't really understand the logic for when the view more button gets hidden so IDK if below is correct, but it works how it should for now
|
|
988
|
-
const should_hide_view_less_button = !should_hide_view_more_button || start_rows == undefined || rows_visible <= start_rows || children_count <= recs_per_row * start_rows;
|
|
989
|
-
return `${$gVhhF$depictaiutilishared.layout_media_query_header(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
|
|
990
|
-
}).join("");
|
|
991
|
-
}));
|
|
2071
|
+
}));
|
|
2072
|
+
// If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
|
|
2073
|
+
// It doesn't seem to work even when waiting for it to be in the DOM, also wait an animation frame
|
|
2074
|
+
const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(what_to_watch, ({
|
|
2075
|
+
element: element
|
|
2076
|
+
}) => requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => {
|
|
2077
|
+
const current_size = what_to_watch.getBoundingClientRect().width;
|
|
2078
|
+
if (current_size)
|
|
2079
|
+
// If element has size, set signal to that. ResizeObserver only triggers when the content is visible in some cases, but it might already have a size. This reduces size filter expanding animation jank in chrome.
|
|
2080
|
+
setWidth(current_size);
|
|
2081
|
+
resizeObserver.observe(element);
|
|
2082
|
+
})));
|
|
2083
|
+
$gVhhF$solidjs.onCleanup(() => {
|
|
2084
|
+
resizeObserver.disconnect();
|
|
2085
|
+
disconnect();
|
|
992
2086
|
});
|
|
993
|
-
|
|
994
|
-
const _el$4 = $gVhhF$solidjsweb.getNextElement($f48d0fbb00835aaa$var$_tmpl$2);
|
|
995
|
-
$gVhhF$solidjsweb.insert(_el$4, get_styling);
|
|
996
|
-
return _el$4;
|
|
997
|
-
})(); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
998
|
-
if (insert_after_container) container_element.after(style_element);
|
|
999
|
-
return [container_element, $gVhhF$solidjsweb.memo(view_more_button_container), $gVhhF$solidjsweb.memo(view_less_button_container), style_element];
|
|
2087
|
+
return width;
|
|
1000
2088
|
}
|
|
1001
|
-
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
1002
2089
|
const $363ce4d1d71041aa$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<h2 class=recs-title>`);
|
|
1003
2090
|
function $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
1004
2091
|
recommendations_resource_: recommendations_resource_,
|
|
1005
2092
|
product_card_template_: product_card_template_,
|
|
1006
2093
|
layout_options_: layout_options_,
|
|
1007
|
-
merchant_: merchant_,
|
|
1008
|
-
market_: market_,
|
|
1009
2094
|
title_: title_
|
|
1010
2095
|
}) {
|
|
1011
2096
|
const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
@@ -1037,205 +2122,37 @@ function $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
|
1037
2122
|
$gVhhF$depictaiutilishared.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
|
|
1038
2123
|
insert_here.before($fc23d7668ae0011d$export$a2cc176055f8f08());
|
|
1039
2124
|
},
|
|
1040
|
-
get children() {
|
|
1041
|
-
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
1042
|
-
get fallback() {
|
|
1043
|
-
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
1044
|
-
num_placeholders_: num_placeholders_,
|
|
1045
|
-
product_card_template_: product_card_template_
|
|
1046
|
-
});
|
|
1047
|
-
},
|
|
1048
|
-
get children() {
|
|
1049
|
-
return (() => {
|
|
1050
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
1051
|
-
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
1052
|
-
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
1053
|
-
displays_by_key_: displays_by_key_,
|
|
1054
|
-
merchant_: merchant_,
|
|
1055
|
-
market_: market_,
|
|
1056
|
-
product_card_template_: product_card_template_
|
|
1057
|
-
});
|
|
1058
|
-
})();
|
|
1059
|
-
}
|
|
1060
|
-
});
|
|
1061
|
-
}
|
|
1062
|
-
})];
|
|
1063
|
-
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
1064
|
-
get when() {
|
|
1065
|
-
return is_showing_something();
|
|
1066
|
-
},
|
|
1067
|
-
children: slider
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
|
|
1071
|
-
const component_in_error_boundary = do_with_elements => {
|
|
1072
|
-
const error_boundary_wrapped = $edafe91daf3091d7$export$b69d0d92862de18b({
|
|
1073
|
-
severity_: "error",
|
|
1074
|
-
message_: error_message,
|
|
1075
|
-
get children() {
|
|
1076
|
-
const elements = component();
|
|
1077
|
-
do_with_elements?.(elements);
|
|
1078
|
-
return elements;
|
|
1079
|
-
}
|
|
1080
|
-
});
|
|
1081
|
-
// This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
|
|
1082
|
-
if (typeof error_boundary_wrapped === "function")
|
|
1083
|
-
// @ts-ignore
|
|
1084
|
-
return error_boundary_wrapped();
|
|
1085
|
-
// On the server it returns a string, so we just return that
|
|
1086
|
-
return error_boundary_wrapped;
|
|
1087
|
-
};
|
|
1088
|
-
const owner = $gVhhF$solidjs.getOwner();
|
|
1089
|
-
if (owner == null) return $gVhhF$solidjs.createRoot(dispose => {
|
|
1090
|
-
// if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
|
|
1091
|
-
return component_in_error_boundary(elements => {
|
|
1092
|
-
const have_multiple = Array.isArray(elements);
|
|
1093
|
-
if (have_multiple ? !elements?.length : !elements) return;
|
|
1094
|
-
(0, $gVhhF$depictaiutilishared.observer).onremoved(have_multiple ? elements[0] : elements, ({
|
|
1095
|
-
element: element
|
|
1096
|
-
}) => {
|
|
1097
|
-
if (document.documentElement.contains(element)) return; // If element has instantly been re-inserted, don't dispose
|
|
1098
|
-
// See https://depictaiworkspace.slack.com/archives/C050GHEPBTR/p1695809102791259?thread_ts=1695106805.459729&cid=C050GHEPBTR
|
|
1099
|
-
dispose();
|
|
1100
|
-
});
|
|
1101
|
-
});
|
|
1102
|
-
});else
|
|
1103
|
-
// we're already in a root so cleanups are handled
|
|
1104
|
-
return component_in_error_boundary();
|
|
1105
|
-
}
|
|
1106
|
-
const $72f96c4782db0b1b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict recommendations">`);
|
|
1107
|
-
function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
|
|
1108
|
-
return $95837413165cc2df$export$23fca46f3143581f(() => {
|
|
1109
|
-
const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
|
|
1110
|
-
const {
|
|
1111
|
-
grid_spacing: grid_spacing
|
|
1112
|
-
} = props; // can be reactive
|
|
1113
|
-
return typeof grid_spacing === "string" ? {
|
|
1114
|
-
grid_spacing: grid_spacing
|
|
1115
|
-
} : {
|
|
1116
|
-
override_vertical_spacing: grid_spacing.vertical,
|
|
1117
|
-
grid_spacing: grid_spacing.horizontal
|
|
1118
|
-
};
|
|
1119
|
-
});
|
|
1120
|
-
const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
1121
|
-
return (() => {
|
|
1122
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($72f96c4782db0b1b$var$_tmpl$);
|
|
1123
|
-
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
1124
|
-
get children() {
|
|
1125
|
-
return $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
1126
|
-
product_card_template_: (...args) => props.product_card_template(...args),
|
|
1127
|
-
recommendations_resource_: recommendations_resource_,
|
|
1128
|
-
market_: () => props.market,
|
|
1129
|
-
merchant_: () => props.merchant,
|
|
1130
|
-
title_: () => props.title,
|
|
1131
|
-
layout_options_: $gVhhF$solidjs.createMemo(() => ({
|
|
1132
|
-
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
|
|
1133
|
-
...grid_spacing_override()
|
|
1134
|
-
}))
|
|
1135
|
-
});
|
|
1136
|
-
}
|
|
1137
|
-
}));
|
|
1138
|
-
return _el$;
|
|
1139
|
-
})();
|
|
1140
|
-
}, "RecommendationSlider failed");
|
|
1141
|
-
}
|
|
1142
|
-
const $b8e79813f4f7ebe4$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<h2 class=recs-title>`),
|
|
1143
|
-
$b8e79813f4f7ebe4$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=recommendation-grid><!$><!/><!$><!/>`);
|
|
1144
|
-
function $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
1145
|
-
recommendations_resource_: recommendations_resource_,
|
|
1146
|
-
product_card_template_: product_card_template_,
|
|
1147
|
-
layout_options_: layout_options_,
|
|
1148
|
-
merchant_: merchant_,
|
|
1149
|
-
market_: market_,
|
|
1150
|
-
rows_object_: rows_object_,
|
|
1151
|
-
title_: title_
|
|
1152
|
-
}) {
|
|
1153
|
-
const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
1154
|
-
const title = $gVhhF$solidjs.createMemo(() => title_?.()); // In case getter/accessor creates elements, don't create them twice
|
|
1155
|
-
const num_placeholders_ = () => 20;
|
|
1156
|
-
const elements = [$gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
1157
|
-
get when() {
|
|
1158
|
-
return title();
|
|
1159
|
-
},
|
|
1160
|
-
get children() {
|
|
1161
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($b8e79813f4f7ebe4$var$_tmpl$);
|
|
1162
|
-
$gVhhF$solidjsweb.insert(_el$, title);
|
|
1163
|
-
return _el$;
|
|
1164
|
-
}
|
|
1165
|
-
}), (() => {
|
|
1166
|
-
const _el$2 = $gVhhF$solidjsweb.getNextElement($b8e79813f4f7ebe4$var$_tmpl$2),
|
|
1167
|
-
_el$3 = _el$2.firstChild,
|
|
1168
|
-
[_el$4, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$3.nextSibling),
|
|
1169
|
-
_el$5 = _el$4.nextSibling,
|
|
1170
|
-
[_el$6, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
1171
|
-
$gVhhF$solidjsweb.insert(_el$2, (0, $fc23d7668ae0011d$export$a2cc176055f8f08), _el$4, _co$);
|
|
1172
|
-
$gVhhF$solidjsweb.insert(_el$2, $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $gVhhF$solidjsweb.mergeProps({
|
|
1173
|
-
get rows() {
|
|
1174
|
-
return rows_object_();
|
|
1175
|
-
},
|
|
1176
|
-
layout: "grid",
|
|
1177
|
-
element_attributes: {
|
|
1178
|
-
class: "cards"
|
|
1179
|
-
}
|
|
1180
|
-
}, layout_options_, {
|
|
1181
|
-
get children() {
|
|
1182
|
-
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
1183
|
-
get fallback() {
|
|
1184
|
-
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
1185
|
-
num_placeholders_: num_placeholders_,
|
|
2125
|
+
get children() {
|
|
2126
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
2127
|
+
get fallback() {
|
|
2128
|
+
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
2129
|
+
num_placeholders_: num_placeholders_,
|
|
2130
|
+
product_card_template_: product_card_template_
|
|
2131
|
+
});
|
|
2132
|
+
},
|
|
2133
|
+
get children() {
|
|
2134
|
+
return (() => {
|
|
2135
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
2136
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
2137
|
+
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
2138
|
+
displays_by_key_: displays_by_key_,
|
|
1186
2139
|
product_card_template_: product_card_template_
|
|
1187
2140
|
});
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
1194
|
-
displays_by_key_: displays_by_key_,
|
|
1195
|
-
merchant_: merchant_,
|
|
1196
|
-
market_: market_,
|
|
1197
|
-
product_card_template_: product_card_template_
|
|
1198
|
-
});
|
|
1199
|
-
})();
|
|
1200
|
-
}
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
})), _el$6, _co$2);
|
|
1204
|
-
return _el$2;
|
|
1205
|
-
})()];
|
|
2141
|
+
})();
|
|
2142
|
+
}
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
})];
|
|
1206
2146
|
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
1207
2147
|
get when() {
|
|
1208
2148
|
return is_showing_something();
|
|
1209
2149
|
},
|
|
1210
|
-
children:
|
|
2150
|
+
children: slider
|
|
1211
2151
|
});
|
|
1212
2152
|
}
|
|
1213
|
-
const $
|
|
1214
|
-
|
|
1215
|
-
function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
2153
|
+
const $72f96c4782db0b1b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict recommendations">`);
|
|
2154
|
+
function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
|
|
1216
2155
|
return $95837413165cc2df$export$23fca46f3143581f(() => {
|
|
1217
|
-
const rows_object_ = $gVhhF$solidjs.createMemo(() => {
|
|
1218
|
-
const {
|
|
1219
|
-
view_more_button: view_more_button,
|
|
1220
|
-
max_rows: max_rows
|
|
1221
|
-
} = props;
|
|
1222
|
-
if (!view_more_button) {
|
|
1223
|
-
if (max_rows) return {
|
|
1224
|
-
max_rows: max_rows
|
|
1225
|
-
};
|
|
1226
|
-
return "all";
|
|
1227
|
-
}
|
|
1228
|
-
return {
|
|
1229
|
-
max_rows: max_rows,
|
|
1230
|
-
start_rows: view_more_button.start_rows,
|
|
1231
|
-
rows_per_click: view_more_button.rows_per_click ?? 2,
|
|
1232
|
-
button: (() => {
|
|
1233
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($1f8dbf7e28b3eff2$var$_tmpl$);
|
|
1234
|
-
$gVhhF$solidjsweb.insert(_el$, () => view_more_button.text);
|
|
1235
|
-
return _el$;
|
|
1236
|
-
})()
|
|
1237
|
-
};
|
|
1238
|
-
});
|
|
1239
2156
|
const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
|
|
1240
2157
|
const {
|
|
1241
2158
|
grid_spacing: grid_spacing
|
|
@@ -1249,15 +2166,12 @@ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
|
1249
2166
|
});
|
|
1250
2167
|
const [recommendations_resource_] = $gVhhF$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
1251
2168
|
return (() => {
|
|
1252
|
-
const _el$
|
|
1253
|
-
$gVhhF$solidjsweb.insert(_el
|
|
2169
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($72f96c4782db0b1b$var$_tmpl$);
|
|
2170
|
+
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $84798aaa863a4909$export$e68cff63f76bd15b), {
|
|
1254
2171
|
get children() {
|
|
1255
|
-
return $
|
|
1256
|
-
rows_object_: rows_object_,
|
|
2172
|
+
return $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
1257
2173
|
product_card_template_: (...args) => props.product_card_template(...args),
|
|
1258
2174
|
recommendations_resource_: recommendations_resource_,
|
|
1259
|
-
market_: () => props.market,
|
|
1260
|
-
merchant_: () => props.merchant,
|
|
1261
2175
|
title_: () => props.title,
|
|
1262
2176
|
layout_options_: $gVhhF$solidjs.createMemo(() => ({
|
|
1263
2177
|
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
|
|
@@ -1266,9 +2180,9 @@ function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
|
1266
2180
|
});
|
|
1267
2181
|
}
|
|
1268
2182
|
}));
|
|
1269
|
-
return _el
|
|
2183
|
+
return _el$;
|
|
1270
2184
|
})();
|
|
1271
|
-
}, "
|
|
2185
|
+
}, "RecommendationSlider failed");
|
|
1272
2186
|
}
|
|
1273
2187
|
function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
|
|
1274
2188
|
const {
|
|
@@ -1563,15 +2477,6 @@ function $47e2cc552c02110c$export$8895d39404bd2bb1(props) {
|
|
|
1563
2477
|
if (delay_toast_) return show_configured_toast;else show_configured_toast();
|
|
1564
2478
|
}
|
|
1565
2479
|
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
1566
|
-
const $c77c68e559a1506c$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg width=21.064 height=21.047 viewBox="0 0 21.064 21.064"><path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z">`);
|
|
1567
|
-
function $c77c68e559a1506c$export$3b621d86b1566b2(props = {}) {
|
|
1568
|
-
return (() => {
|
|
1569
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($c77c68e559a1506c$var$_tmpl$);
|
|
1570
|
-
$gVhhF$solidjsweb.spread(_el$, props, true, true);
|
|
1571
|
-
$gVhhF$solidjsweb.runHydrationEvents();
|
|
1572
|
-
return _el$;
|
|
1573
|
-
})();
|
|
1574
|
-
}
|
|
1575
2480
|
|
|
1576
2481
|
/**
|
|
1577
2482
|
* Lower cases a string if possible. Mostly used to make the filter url values case-insensitive.
|
|
@@ -1582,7 +2487,7 @@ function $daa394359b026187$export$325f75597868c4f0(stuff) {
|
|
|
1582
2487
|
}
|
|
1583
2488
|
const $235a2771a44e28e9$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="clear-all-filters minor">`),
|
|
1584
2489
|
$235a2771a44e28e9$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=inner><span class=title><!$><!/>: </span><!$><!/>`),
|
|
1585
|
-
$235a2771a44e28e9$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="clear-filter major"><!$><!/><span><!$><!/><!$><!/><!$><!/>
|
|
2490
|
+
$235a2771a44e28e9$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="clear-filter major"><!$><!/><span><!$><!/><!$><!/><!$><!/> \u{2013} <!$><!/><!$><!/><!$><!/>`),
|
|
1586
2491
|
$235a2771a44e28e9$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="clear-filter major"><!$><!/><span>`);
|
|
1587
2492
|
function $235a2771a44e28e9$export$fecbb157621501bd({
|
|
1588
2493
|
number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
|
|
@@ -2755,7 +3660,7 @@ function $5ea5a82e398f6f44$var$cut_text(segmented_text) {
|
|
|
2755
3660
|
// identical split point, or split end before split start, can't do anything
|
|
2756
3661
|
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
2757
3662
|
const dots_segment = {
|
|
2758
|
-
text_: "
|
|
3663
|
+
text_: " \u2026 ",
|
|
2759
3664
|
highlighted_: false
|
|
2760
3665
|
};
|
|
2761
3666
|
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
@@ -2847,7 +3752,7 @@ function $5ea5a82e398f6f44$var$cut_start(cut_left_of_index, segmented_text) {
|
|
|
2847
3752
|
if (character === "," || is_space)
|
|
2848
3753
|
// if we cut at a comma or psace, we add a … at the beginning
|
|
2849
3754
|
segmented_text.unshift({
|
|
2850
|
-
text_: "
|
|
3755
|
+
text_: "\u2026 ",
|
|
2851
3756
|
highlighted_: false
|
|
2852
3757
|
});
|
|
2853
3758
|
break outmost_loop;
|
|
@@ -3861,7 +4766,7 @@ function $b064919833b3e80b$export$53c59af873b303c9({
|
|
|
3861
4766
|
get price_formatting_() {
|
|
3862
4767
|
return price_formatting_();
|
|
3863
4768
|
}
|
|
3864
|
-
}), $gVhhF$solidjsweb.memo(() => price_formatting_().post_), "
|
|
4769
|
+
}), $gVhhF$solidjsweb.memo(() => price_formatting_().post_), " \u2013 ", $gVhhF$solidjsweb.memo(() => price_formatting_().pre_), $gVhhF$solidjsweb.createComponent((0, $d659702496cb72ea$export$a71e92cfbb498adc), {
|
|
3865
4770
|
get price_() {
|
|
3866
4771
|
return selected_filter.data[1];
|
|
3867
4772
|
},
|
|
@@ -3951,47 +4856,6 @@ function $8c939a05b87fbbbc$export$ab34afce88557c0e(props) {
|
|
|
3951
4856
|
}));
|
|
3952
4857
|
return is_open;
|
|
3953
4858
|
}
|
|
3954
|
-
const $9fe9883b1d8ecccc$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span>`);
|
|
3955
|
-
function $9fe9883b1d8ecccc$export$acb3eaade4b23afd(props) {
|
|
3956
|
-
return (() => {
|
|
3957
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($9fe9883b1d8ecccc$var$_tmpl$);
|
|
3958
|
-
$gVhhF$solidjsweb.effect(_p$ => {
|
|
3959
|
-
const _v$ = `depict-placeholder ${props.class || ""}`,
|
|
3960
|
-
_v$2 = props.style;
|
|
3961
|
-
_v$ !== _p$._v$ && $gVhhF$solidjsweb.className(_el$, _p$._v$ = _v$);
|
|
3962
|
-
_p$._v$2 = $gVhhF$solidjsweb.style(_el$, _v$2, _p$._v$2);
|
|
3963
|
-
return _p$;
|
|
3964
|
-
}, {
|
|
3965
|
-
_v$: undefined,
|
|
3966
|
-
_v$2: undefined
|
|
3967
|
-
});
|
|
3968
|
-
return _el$;
|
|
3969
|
-
})();
|
|
3970
|
-
}
|
|
3971
|
-
function $061ff5b4c3d36171$export$89c6019e4baa40b1(props) {
|
|
3972
|
-
const style = $gVhhF$solidjs.createMemo(() => {
|
|
3973
|
-
const {
|
|
3974
|
-
style: style,
|
|
3975
|
-
height: height,
|
|
3976
|
-
width: width
|
|
3977
|
-
} = props;
|
|
3978
|
-
return {
|
|
3979
|
-
...(style || {}),
|
|
3980
|
-
height: height ?? "1em",
|
|
3981
|
-
...(width && {
|
|
3982
|
-
width: width
|
|
3983
|
-
})
|
|
3984
|
-
};
|
|
3985
|
-
});
|
|
3986
|
-
return $gVhhF$solidjsweb.createComponent((0, $9fe9883b1d8ecccc$export$acb3eaade4b23afd), {
|
|
3987
|
-
get style() {
|
|
3988
|
-
return style();
|
|
3989
|
-
},
|
|
3990
|
-
get ["class"]() {
|
|
3991
|
-
return props.class;
|
|
3992
|
-
}
|
|
3993
|
-
});
|
|
3994
|
-
}
|
|
3995
4859
|
const $87d7574e1d89d69b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg width=20 height=22 viewBox="0 0 20 22"><path d="M19.811 20.174l-6.234-6.809a7.96 7.96 0 0 0 .923-1.179c.274-.424.502-.865.687-1.323a8.04 8.04 0 0 0 .42-1.436 7.88 7.88 0 0 0 .144-1.507c0-.526-.051-1.042-.154-1.548-.096-.506-.243-.995-.441-1.466s-.441-.919-.728-1.343a8.28 8.28 0 0 0-.984-1.21 7.86 7.86 0 0 0-1.2-.984A7.56 7.56 0 0 0 10.89.651C10.418.453 9.929.302 9.423.2S8.401.046 7.875.046 6.833.097 6.327.2 5.332.453 4.86.651a7.56 7.56 0 0 0-1.354.718c-.431.287-.831.615-1.2.984a8.28 8.28 0 0 0-.984 1.21 7.73 7.73 0 0 0-.728 1.343c-.198.472-.349.96-.451 1.466A8.31 8.31 0 0 0 0 7.921a8.31 8.31 0 0 0 .144 1.548c.103.506.253.995.451 1.466a8.08 8.08 0 0 0 .728 1.354 7.86 7.86 0 0 0 .984 1.2 7.54 7.54 0 0 0 1.2.995c.431.287.882.53 1.354.728.472.191.96.338 1.466.441a8.31 8.31 0 0 0 1.548.144c.451 0 .896-.038 1.333-.113a7.83 7.83 0 0 0 1.282-.328 7.55 7.55 0 0 0 1.2-.533 8.08 8.08 0 0 0 1.107-.749l6.245 6.809a.45.45 0 0 0 .174.123.55.55 0 0 0 .205.041.61.61 0 0 0 .195-.031c.061-.021.116-.055.164-.102.109-.096.164-.219.164-.369.007-.144-.038-.267-.133-.369zM1.046 7.921c0-.937.178-1.818.533-2.646.362-.834.851-1.559 1.466-2.174.622-.615 1.347-1.101 2.174-1.456.827-.362 1.712-.543 2.656-.543s1.829.181 2.656.543c.827.355 1.548.841 2.164 1.456.622.615 1.111 1.34 1.466 2.174a6.52 6.52 0 0 1 .543 2.646c0 .943-.181 1.829-.543 2.656a6.89 6.89 0 0 1-1.466 2.174c-.615.615-1.336 1.104-2.164 1.466-.827.356-1.712.533-2.656.533s-1.829-.178-2.656-.533c-.827-.362-1.552-.851-2.174-1.466-.615-.622-1.104-1.347-1.466-2.174-.355-.827-.533-1.712-.533-2.656z">`);
|
|
3996
4860
|
function $87d7574e1d89d69b$export$82eafebb825fc23f(props = {}) {
|
|
3997
4861
|
return (() => {
|
|
@@ -4546,150 +5410,33 @@ function $70482f04605572e2$var$modify_only_local_filter(local_filter_object, sel
|
|
|
4546
5410
|
}
|
|
4547
5411
|
return modified_filter_object;
|
|
4548
5412
|
}
|
|
4549
|
-
async function $
|
|
4550
|
-
const
|
|
4551
|
-
|
|
4552
|
-
const
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
return search_modal({
|
|
4573
|
-
...modal_fn_opts,
|
|
4574
|
-
...extra_options_for_modal,
|
|
4575
|
-
close_modal_: close_modal_,
|
|
4576
|
-
open_modal_: open_modal_,
|
|
4577
|
-
register_closing_animation_: animation => closing_animation = animation
|
|
4578
|
-
});
|
|
4579
|
-
});
|
|
4580
|
-
body.append(...modal_els);
|
|
4581
|
-
};
|
|
4582
|
-
const close_modal_ = () => {
|
|
4583
|
-
if (dispose_and_remove) {
|
|
4584
|
-
// modal is open
|
|
4585
|
-
const dispose_fn = dispose_and_remove;
|
|
4586
|
-
// set dispose function to undefined in case that it triggers this dispose function itself. Not doing it leads to a bug like https://github.com/solidjs/solid/discussions/1194
|
|
4587
|
-
dispose_and_remove = undefined;
|
|
4588
|
-
dispose_fn();
|
|
4589
|
-
}
|
|
4590
|
-
};
|
|
4591
|
-
return {
|
|
4592
|
-
open_modal_: open_modal_,
|
|
4593
|
-
close_modal_: close_modal_
|
|
4594
|
-
};
|
|
4595
|
-
}
|
|
4596
|
-
async function $bc91d938b8c601b4$export$58e808b1db15d3bc({
|
|
4597
|
-
merchant: merchant,
|
|
4598
|
-
market: market,
|
|
4599
|
-
headers: headers,
|
|
4600
|
-
...fetch_recs_options
|
|
4601
|
-
}) {
|
|
4602
|
-
return await $gVhhF$depictaiutilishared.fetch_recs({
|
|
4603
|
-
tenant: merchant,
|
|
4604
|
-
market: market
|
|
4605
|
-
}, $gVhhF$depictaiutilishared.snakeCasifyObject(fetch_recs_options), headers);
|
|
4606
|
-
}
|
|
4607
|
-
function $6e22b5314fb52f4c$export$e183a13865960371(params_to_default_value, router_) {
|
|
4608
|
-
const signals = {};
|
|
4609
|
-
const entries = Object.entries(params_to_default_value);
|
|
4610
|
-
const event_handler = $gVhhF$depictaiutilishared.catchify((what_happened, args) => {
|
|
4611
|
-
// Intentionally always update our signals to the history state to allow external control of SDK state for doing things like https://linear.app/depictai/issue/X-1432/is-this-possible-with-the-depict-sdk
|
|
4612
|
-
if (what_happened !== "popstate") return;
|
|
4613
|
-
// Had to undo the comment above,but leaving the history. Doing this because discovering why it doesn't work is a deja-vu and I don't want to have to discover it again.
|
|
4614
|
-
// If we want others to interface with our state, it's better to expose it from DepictCategory/DepictSearch
|
|
4615
|
-
// The reason for that is because writes to the state trigger writes to the state (something about local filter state, see the comment where `last_remote_state !== available_filters_()` happens in create_modified_filters.tsx)
|
|
4616
|
-
// And can infinite loop, like in https://app.jiminny.com/playback/569c8f65-edea-4735-bd9e-4eb5a0b14cad
|
|
4617
|
-
// It's the classical equilibrium problem when syncing state both down and up, and it's much easier to avoid than solve
|
|
4618
|
-
$6e22b5314fb52f4c$var$history_state_change(signals, entries, args.state);
|
|
4619
|
-
});
|
|
4620
|
-
// createRenderEffect because we need the instant execution so the signals always contain values, even before solid's render phase
|
|
4621
|
-
$gVhhF$solidjs.createRenderEffect(() => {
|
|
4622
|
-
let signal_changed = false;
|
|
4623
|
-
let {
|
|
4624
|
-
state: state
|
|
4625
|
-
} = globalThis?.history || {
|
|
4626
|
-
state: {}
|
|
4627
|
-
}; // cloning isn't necessary because we're calling replaceState on it anyway
|
|
4628
|
-
if (state === null || typeof state != "object") state = {};
|
|
4629
|
-
for (const [param, default_value] of entries) {
|
|
4630
|
-
const [read_signal] = signals[param] ||= $gVhhF$solidjs.createSignal(state[param] ?? default_value);
|
|
4631
|
-
const new_value = read_signal();
|
|
4632
|
-
if (new_value !== state[param]) {
|
|
4633
|
-
signal_changed = true;
|
|
4634
|
-
state[param] = new_value;
|
|
4635
|
-
}
|
|
4636
|
-
}
|
|
4637
|
-
if (signal_changed) router_.navigate_.replace_state_(state);
|
|
4638
|
-
});
|
|
4639
|
-
// history_dot_state_to_state needs to update after its signals after url_state does BUT in the same task (might even have to be in the same tick in the microtask queue). If we'd use window.addEventListener("popstate") it would be guaranteed to be too late since each event listener has its own task
|
|
4640
|
-
(0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).add(event_handler);
|
|
4641
|
-
$gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.catchify(() => (0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).delete(event_handler)));
|
|
4642
|
-
$gVhhF$solidjs.createEffect($gVhhF$depictaiutilishared.catchify(() => $gVhhF$solidjs.untrack($gVhhF$depictaiutilishared.catchify(() => $6e22b5314fb52f4c$var$history_state_change(signals, entries, history.state))))); // we need this to run after reading the initial state from history.state to write the defaults to history.state
|
|
4643
|
-
return signals;
|
|
4644
|
-
}
|
|
4645
|
-
function $6e22b5314fb52f4c$var$history_state_change(signals, entries, state) {
|
|
4646
|
-
$gVhhF$solidjs.batch(() => {
|
|
4647
|
-
for (const [param, default_value] of entries) {
|
|
4648
|
-
const [, write_signal] = signals[param];
|
|
4649
|
-
const new_value = state?.[param];
|
|
4650
|
-
write_signal(new_value ?? default_value);
|
|
4651
|
-
}
|
|
4652
|
-
});
|
|
4653
|
-
}
|
|
4654
|
-
const $d84fe647b84b5dc5$export$3064e1e8c6513da3 = new Set();
|
|
4655
|
-
let $d84fe647b84b5dc5$var$has_ran = false;
|
|
4656
|
-
function $d84fe647b84b5dc5$export$5162a71f252e6122() {
|
|
4657
|
-
if ($d84fe647b84b5dc5$var$has_ran || typeof history !== "object") return;
|
|
4658
|
-
$d84fe647b84b5dc5$var$has_ran = true;
|
|
4659
|
-
for (const function_name of ["replaceState", "pushState"]) {
|
|
4660
|
-
if (Object.getOwnPropertyNames(history).includes(function_name)) $d84fe647b84b5dc5$var$proxy_push_state(function_name, history);
|
|
4661
|
-
$d84fe647b84b5dc5$var$proxy_push_state(function_name, History.prototype);
|
|
4662
|
-
}
|
|
4663
|
-
}
|
|
4664
|
-
function $d84fe647b84b5dc5$var$proxy_push_state(function_name, thing) {
|
|
4665
|
-
thing[function_name] = new Proxy(thing[function_name], {
|
|
4666
|
-
apply(target, this_arg, arg_list) {
|
|
4667
|
-
try {
|
|
4668
|
-
const old_state = history.state;
|
|
4669
|
-
if (typeof old_state == "object" && old_state !== null) {
|
|
4670
|
-
// This effectively disallows the user from passing in a string, number, null or undefined
|
|
4671
|
-
const intended_new_value_as_obj = typeof arg_list[0] === "object" ? arg_list[0] ?? {} : {};
|
|
4672
|
-
const cloned_object = {
|
|
4673
|
-
...intended_new_value_as_obj
|
|
4674
|
-
};
|
|
4675
|
-
for (const key in old_state) {
|
|
4676
|
-
if (!$d84fe647b84b5dc5$var$starts_with_any_prefix(key)) continue;
|
|
4677
|
-
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
4678
|
-
}
|
|
4679
|
-
arg_list[0] = cloned_object;
|
|
4680
|
-
}
|
|
4681
|
-
} catch (e) {
|
|
4682
|
-
$gVhhF$depictaiutilishared.report([e, "Failed to preserve items in history.state"], "error");
|
|
4683
|
-
}
|
|
4684
|
-
return Reflect.apply(target, this_arg, arg_list);
|
|
5413
|
+
async function $bd429c994399dd82$export$58e808b1db15d3bc(options) {
|
|
5414
|
+
const headers = options.headers;
|
|
5415
|
+
const product_id = options.productId || options.product_id; // Second fallback here is just because there was very little missing to make this work with snake_case input and in case someone puts in snake case'd stuff already (preview browser did) we can easily not break it
|
|
5416
|
+
const cleaned_up_options = $gVhhF$depictaiutilishared.snakeCasifyObject(options);
|
|
5417
|
+
delete cleaned_up_options.headers;
|
|
5418
|
+
delete cleaned_up_options.product_id;
|
|
5419
|
+
cleaned_up_options.session_id ||= $gVhhF$depictaiutilishared.get_session_id();
|
|
5420
|
+
if (product_id && !cleaned_up_options.product_ids) cleaned_up_options.product_ids = [product_id];
|
|
5421
|
+
const options_to_send = cleaned_up_options;
|
|
5422
|
+
const url = $gVhhF$depictaiutilishared.add_version_query_params(`${(0, $gVhhF$depictaiutilishared.base_url)}/v3/recommend/products`);
|
|
5423
|
+
return await $gVhhF$depictaiutilishared.fetch_retry(url, {
|
|
5424
|
+
body: JSON.stringify(options_to_send),
|
|
5425
|
+
...(headers ? {
|
|
5426
|
+
headers: headers
|
|
5427
|
+
} : {}),
|
|
5428
|
+
method: "POST"
|
|
5429
|
+
}).catch(e => $gVhhF$depictaiutilishared.dlog("fetch_retry threw", e)).then(async maybe_response => {
|
|
5430
|
+
if (!maybe_response) return [];
|
|
5431
|
+
let decoded;
|
|
5432
|
+
try {
|
|
5433
|
+
decoded = await maybe_response.json();
|
|
5434
|
+
} catch (e) {
|
|
5435
|
+
$gVhhF$depictaiutilishared.dlog("Failed to decode JSON", e);
|
|
4685
5436
|
}
|
|
5437
|
+
return decoded?.displays || [];
|
|
4686
5438
|
});
|
|
4687
5439
|
}
|
|
4688
|
-
function $d84fe647b84b5dc5$var$starts_with_any_prefix(key) {
|
|
4689
|
-
for (const prefix of $d84fe647b84b5dc5$export$3064e1e8c6513da3) {
|
|
4690
|
-
if (key.startsWith(prefix)) return true;
|
|
4691
|
-
}
|
|
4692
|
-
}
|
|
4693
5440
|
function $26a56f6b44703084$export$9862539c89138352({
|
|
4694
5441
|
get_default_values_: get_default_values_,
|
|
4695
5442
|
router_: router_,
|
|
@@ -4745,8 +5492,8 @@ function $67dc366d96177e70$export$967e966fca9515e(api_response) {
|
|
|
4745
5492
|
}
|
|
4746
5493
|
return api_response;
|
|
4747
5494
|
}
|
|
4748
|
-
const $e1d6c0f3d89d531c$var$
|
|
4749
|
-
const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$
|
|
5495
|
+
const $e1d6c0f3d89d531c$var$v3_base_url = (0, $gVhhF$depictaiutilishared.base_url) + "/v3/";
|
|
5496
|
+
const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$v3_base_url + "search/";
|
|
4750
5497
|
class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
4751
5498
|
#supports_finalization_registry = typeof FinalizationRegistry === "function";
|
|
4752
5499
|
#cache_objs = {};
|
|
@@ -4765,18 +5512,14 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4765
5512
|
const request = {
|
|
4766
5513
|
...input_req
|
|
4767
5514
|
};
|
|
4768
|
-
request.dsid ??= $gVhhF$depictaiutilishared.get_depict_id();
|
|
4769
|
-
// Todo: remove the default user and session IDs once we've confirmed backend can handle it and do whatever fallback is necessary.
|
|
4770
|
-
request.user_id ??= this.#get_user_id?.() || $gVhhF$depictaiutilishared.get_user_id();
|
|
4771
5515
|
request.session_id ??= this.#get_session_id?.() || $gVhhF$depictaiutilishared.get_session_id();
|
|
4772
5516
|
return request;
|
|
4773
5517
|
};
|
|
4774
5518
|
#get_metadata;
|
|
4775
|
-
#get_user_id;
|
|
4776
5519
|
#get_session_id;
|
|
4777
5520
|
#guard_url_creator_length(expected, received) {
|
|
4778
5521
|
if (expected.length !== received.length) {
|
|
4779
|
-
const e = new Error("
|
|
5522
|
+
const e = new Error("displayTransformer returned wrong number of page URLs, got " + received.length + ", expected " + expected.length);
|
|
4780
5523
|
queueMicrotask(() => {
|
|
4781
5524
|
throw e;
|
|
4782
5525
|
});
|
|
@@ -4813,8 +5556,9 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4813
5556
|
const category_transformer = display_transformers?.categories;
|
|
4814
5557
|
const content_result_transformer = display_transformers?.contentResults;
|
|
4815
5558
|
const displays = input_data.displays;
|
|
5559
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
4816
5560
|
const {
|
|
4817
|
-
|
|
5561
|
+
breadcrumbs: breadcrumbs,
|
|
4818
5562
|
quick_links: quick_links,
|
|
4819
5563
|
content_search_links: content_search_links
|
|
4820
5564
|
} = input_data;
|
|
@@ -4843,7 +5587,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4843
5587
|
displays[i] = new_display_or_page_url;
|
|
4844
5588
|
}
|
|
4845
5589
|
}
|
|
4846
|
-
if (page_url_creator || category_transformer) for (const category_display_array of [
|
|
5590
|
+
if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumbs, quick_links]) {
|
|
4847
5591
|
if (!category_display_array) continue;
|
|
4848
5592
|
const page_urls = await (page_url_creator || category_transformer)({
|
|
4849
5593
|
merchant: merchant,
|
|
@@ -4859,24 +5603,32 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4859
5603
|
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
4860
5604
|
}
|
|
4861
5605
|
if (content_search_links?.length && content_result_transformer) {
|
|
4862
|
-
const result = await content_result_transformer({
|
|
5606
|
+
const result = await $gVhhF$solidjs.runWithOwner(owner, () => content_result_transformer({
|
|
4863
5607
|
merchant: merchant,
|
|
4864
5608
|
market: market,
|
|
4865
5609
|
data: [...content_search_links]
|
|
4866
|
-
});
|
|
5610
|
+
}));
|
|
4867
5611
|
this.#guard_url_creator_length(content_search_links, result);
|
|
4868
5612
|
input_data.content_search_links = result;
|
|
4869
5613
|
}
|
|
4870
5614
|
return input_data;
|
|
4871
5615
|
}
|
|
4872
|
-
async #
|
|
4873
|
-
|
|
4874
|
-
|
|
5616
|
+
async #cached_request({
|
|
5617
|
+
endpoint_: endpoint_,
|
|
5618
|
+
input_req_: input_req_,
|
|
5619
|
+
fallback_response_: fallback_response_,
|
|
5620
|
+
method_ = "POST",
|
|
5621
|
+
delete_key_before_sending_: delete_key_before_sending_ // only supported for GET requests
|
|
5622
|
+
}) {
|
|
5623
|
+
const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
|
|
5624
|
+
const with_ids = this.#add_ids_to_request(input_req_);
|
|
5625
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
4875
5626
|
const metaData = await this.#get_metadata?.();
|
|
4876
5627
|
const request = metaData ? Object.assign(with_ids, {
|
|
4877
5628
|
metadata: metaData
|
|
4878
5629
|
}) : with_ids;
|
|
4879
|
-
const
|
|
5630
|
+
const sorted_request = $gVhhF$depictaiutilishared.sort_obj(request);
|
|
5631
|
+
const body = JSON.stringify(sorted_request);
|
|
4880
5632
|
const response_from_cache = cache_obj.cache_[body]?.deref?.();
|
|
4881
5633
|
if (response_from_cache) return response_from_cache;
|
|
4882
5634
|
const in_progress_request = cache_obj.in_progress_[body];
|
|
@@ -4884,18 +5636,23 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4884
5636
|
let resolve_in_progress;
|
|
4885
5637
|
cache_obj.in_progress_[body] = new Promise(r => resolve_in_progress = r);
|
|
4886
5638
|
try {
|
|
4887
|
-
const
|
|
4888
|
-
|
|
4889
|
-
|
|
5639
|
+
const is_post = method_ === "POST";
|
|
5640
|
+
if (!is_post && delete_key_before_sending_) delete sorted_request[delete_key_before_sending_];
|
|
5641
|
+
const url_to_request = is_post ? endpoint_ : $gVhhF$depictaiutilishared.make_url_with_query_params(endpoint_, sorted_request);
|
|
5642
|
+
const api_response = await $gVhhF$depictaiutilishared.fetch_retry($gVhhF$depictaiutilishared.add_version_query_params(url_to_request), {
|
|
5643
|
+
method: method_,
|
|
5644
|
+
...(is_post ? {
|
|
5645
|
+
body: body
|
|
5646
|
+
} : {})
|
|
4890
5647
|
});
|
|
4891
5648
|
return_successfully: {
|
|
4892
5649
|
if (!api_response || api_response.status !== 200) break return_successfully;
|
|
4893
5650
|
let result;
|
|
4894
5651
|
try {
|
|
4895
5652
|
const unmodified_result = await api_response.json();
|
|
4896
|
-
result = await this.#run_display_transformers_for_rest(
|
|
5653
|
+
result = await $gVhhF$solidjs.runWithOwner(owner, () => this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, unmodified_result));
|
|
4897
5654
|
} catch (e) {
|
|
4898
|
-
$gVhhF$depictaiutilishared.dwarn("
|
|
5655
|
+
$gVhhF$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
4899
5656
|
break return_successfully;
|
|
4900
5657
|
}
|
|
4901
5658
|
// Here result actually becomes O
|
|
@@ -4913,7 +5670,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4913
5670
|
return result;
|
|
4914
5671
|
}
|
|
4915
5672
|
// If we get here, the request failed
|
|
4916
|
-
const retval =
|
|
5673
|
+
const retval = fallback_response_(input_req_);
|
|
4917
5674
|
resolve_in_progress(retval);
|
|
4918
5675
|
return retval;
|
|
4919
5676
|
} finally {
|
|
@@ -4923,19 +5680,18 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4923
5680
|
constructor(options) {
|
|
4924
5681
|
const {
|
|
4925
5682
|
get_metadata: get_metadata,
|
|
4926
|
-
get_user_id: get_user_id,
|
|
4927
5683
|
get_session_id: get_session_id,
|
|
4928
5684
|
page_url_creator: page_url_creator,
|
|
4929
5685
|
display_transformers: display_transformers
|
|
4930
5686
|
} = options ?? {};
|
|
4931
5687
|
this.#get_metadata = get_metadata;
|
|
4932
|
-
this.#get_user_id = get_user_id;
|
|
4933
5688
|
this.#get_session_id = get_session_id;
|
|
4934
5689
|
this.page_url_creator = page_url_creator;
|
|
4935
5690
|
this.display_transformers = display_transformers;
|
|
4936
5691
|
}
|
|
4937
5692
|
async suggest(input_req) {
|
|
4938
5693
|
const with_ids = this.#add_ids_to_request(input_req);
|
|
5694
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
4939
5695
|
const metaData = await this.#get_metadata?.();
|
|
4940
5696
|
const request = metaData ? Object.assign(with_ids, {
|
|
4941
5697
|
metadata: JSON.stringify(metaData)
|
|
@@ -4947,9 +5703,9 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4947
5703
|
const decoded_json = await results.json();
|
|
4948
5704
|
if (!Array.isArray(decoded_json?.suggestions)) break attempt_to_return_api_response;
|
|
4949
5705
|
try {
|
|
4950
|
-
return await this.#run_url_creator_for_suggest(input_req.
|
|
5706
|
+
return await $gVhhF$solidjs.runWithOwner(owner, () => this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, decoded_json));
|
|
4951
5707
|
} catch (e) {
|
|
4952
|
-
$gVhhF$depictaiutilishared.dwarn("
|
|
5708
|
+
$gVhhF$depictaiutilishared.dwarn("displayTransformer failed", e);
|
|
4953
5709
|
}
|
|
4954
5710
|
}
|
|
4955
5711
|
return {
|
|
@@ -4959,31 +5715,67 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4959
5715
|
};
|
|
4960
5716
|
}
|
|
4961
5717
|
async query(input_req) {
|
|
4962
|
-
return await this.#
|
|
4963
|
-
"
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
5718
|
+
return await this.#cached_request({
|
|
5719
|
+
endpoint_: $e1d6c0f3d89d531c$var$search_base_url + "results",
|
|
5720
|
+
input_req_: input_req,
|
|
5721
|
+
fallback_response_: () => ({
|
|
5722
|
+
"n_hits": 0,
|
|
5723
|
+
"displays": [],
|
|
5724
|
+
"sorts": [],
|
|
5725
|
+
"filters": [],
|
|
5726
|
+
"search_request_id": "error",
|
|
5727
|
+
failed: true
|
|
5728
|
+
})
|
|
5729
|
+
});
|
|
4970
5730
|
}
|
|
4971
|
-
async
|
|
4972
|
-
return await this.#
|
|
4973
|
-
"
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
5731
|
+
async get_listing(input_req) {
|
|
5732
|
+
return await this.#cached_request({
|
|
5733
|
+
endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + encodeURIComponent(input_req.listing_id),
|
|
5734
|
+
input_req_: input_req,
|
|
5735
|
+
fallback_response_: () => ({
|
|
5736
|
+
listing_id: "",
|
|
5737
|
+
listing_type: "category",
|
|
5738
|
+
"title": "",
|
|
5739
|
+
"description": "string",
|
|
5740
|
+
"replace_meta_tags": true,
|
|
5741
|
+
"slug": "",
|
|
5742
|
+
"updated_at": new Date().toISOString(),
|
|
5743
|
+
"breadcrumbs": [],
|
|
5744
|
+
"quick_links": [],
|
|
5745
|
+
failed: true
|
|
5746
|
+
}),
|
|
5747
|
+
method_: "GET",
|
|
5748
|
+
delete_key_before_sending_: "listing_id" // this goes into the path, but we still need to have it in the request object until the last second as we want to include it as a key when caching requests
|
|
5749
|
+
});
|
|
5750
|
+
}
|
|
5751
|
+
|
|
5752
|
+
async get_listing_products(input_req) {
|
|
5753
|
+
const listing_id = input_req.listing_id; // listing_id goes into the path
|
|
5754
|
+
const cloned_request = {
|
|
5755
|
+
...input_req
|
|
5756
|
+
};
|
|
5757
|
+
delete cloned_request["listing_id"];
|
|
5758
|
+
return await this.#cached_request({
|
|
5759
|
+
endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + encodeURIComponent(listing_id) + "/products",
|
|
5760
|
+
input_req_: input_req,
|
|
5761
|
+
fallback_response_: () => ({
|
|
5762
|
+
"n_hits": 0,
|
|
5763
|
+
"displays": [],
|
|
5764
|
+
"sorts": [],
|
|
5765
|
+
"filters": [],
|
|
5766
|
+
"product_listing_request_id": "error",
|
|
5767
|
+
failed: true
|
|
5768
|
+
})
|
|
5769
|
+
});
|
|
4982
5770
|
}
|
|
4983
5771
|
async get_recommended(input_req) {
|
|
4984
|
-
return await this.#
|
|
4985
|
-
|
|
4986
|
-
|
|
5772
|
+
return await this.#cached_request({
|
|
5773
|
+
endpoint_: $e1d6c0f3d89d531c$var$search_base_url + "related",
|
|
5774
|
+
input_req_: input_req,
|
|
5775
|
+
fallback_response_: () => ({
|
|
5776
|
+
displays: []
|
|
5777
|
+
})
|
|
5778
|
+
});
|
|
4987
5779
|
}
|
|
4988
5780
|
}
|
|
4989
5781
|
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
@@ -5082,7 +5874,7 @@ function $76b6ac05693f5c71$export$205efb947c7ffd78(handler, passive = true) {
|
|
|
5082
5874
|
$gVhhF$solidjs.onCleanup(() => removeEventListener(event, catchified_handler));
|
|
5083
5875
|
}
|
|
5084
5876
|
}
|
|
5085
|
-
const $401aee5f33dca9e2$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=scroll-status style=display:none><span class=text><b></b>
|
|
5877
|
+
const $401aee5f33dca9e2$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=scroll-status style=display:none><span class=text><b></b> \u{2013} <b></b> <!$><!/> <b>`);
|
|
5086
5878
|
function $401aee5f33dca9e2$export$83fd5de5504a7a67({
|
|
5087
5879
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
5088
5880
|
first_result_in_viewport_: [get_first_result_in_viewport],
|
|
@@ -5304,7 +6096,7 @@ function $3f08fe2992a2a8ca$export$5e4aed86c12acdd9({
|
|
|
5304
6096
|
// After first load, always just load 20 since people might just be browsing the top ones still
|
|
5305
6097
|
min_products_to_fetch_ : now - last_loaded < 10000 ? min_products_to_fetch_ * 5 : min_products_to_fetch_;
|
|
5306
6098
|
// dlog("loading ", number_of_results_to_load, "products, because it was", now - last_loaded, "ms since last load");
|
|
5307
|
-
const api_response = await depict_api_["
|
|
6099
|
+
const api_response = await depict_api_["listing_id" in base_part ? "get_listing_products" : "query"]({
|
|
5308
6100
|
cursor: get_last_cursor(),
|
|
5309
6101
|
limit: number_of_results_to_load,
|
|
5310
6102
|
...base_part
|
|
@@ -5367,8 +6159,6 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
|
5367
6159
|
product_card_template_: product_card_template_,
|
|
5368
6160
|
first_result_in_viewport_: [, set_first_result_in_viewport],
|
|
5369
6161
|
last_result_in_viewport_: [get_last_result_in_viewport_, set_last_result_in_viewport],
|
|
5370
|
-
merchant_: merchant_,
|
|
5371
|
-
market_: market_,
|
|
5372
6162
|
all_products_loaded_: all_products_loaded_,
|
|
5373
6163
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
5374
6164
|
query_base_: query_base_,
|
|
@@ -5420,8 +6210,6 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
|
5420
6210
|
});
|
|
5421
6211
|
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
5422
6212
|
displays_by_key_: displays_by_key_,
|
|
5423
|
-
merchant_: merchant_,
|
|
5424
|
-
market_: market_,
|
|
5425
6213
|
product_card_template_: product_card_template_,
|
|
5426
6214
|
content_blocks_: content_blocks_,
|
|
5427
6215
|
do_per_elements_: (elements, index_accessor) =>
|
|
@@ -5577,37 +6365,6 @@ function $055384b985678603$export$a79e666719b3647c(cols_at_size_) {
|
|
|
5577
6365
|
});
|
|
5578
6366
|
return n_cols_currently_showing;
|
|
5579
6367
|
}
|
|
5580
|
-
function $3bc4a89b971a3af5$export$3f37af283f8fb843(props) {
|
|
5581
|
-
const style = $gVhhF$solidjs.createMemo(() => {
|
|
5582
|
-
const {
|
|
5583
|
-
style: style,
|
|
5584
|
-
height: height,
|
|
5585
|
-
width: width,
|
|
5586
|
-
aspectRatio: aspectRatio
|
|
5587
|
-
} = props;
|
|
5588
|
-
const is_image = aspectRatio != undefined;
|
|
5589
|
-
const size_data = is_image ? {
|
|
5590
|
-
width: "100%",
|
|
5591
|
-
"padding-bottom": 1 / aspectRatio * 100 + "%"
|
|
5592
|
-
} : {
|
|
5593
|
-
width: width,
|
|
5594
|
-
height: height
|
|
5595
|
-
};
|
|
5596
|
-
return {
|
|
5597
|
-
display: "block",
|
|
5598
|
-
...(style || {}),
|
|
5599
|
-
...size_data
|
|
5600
|
-
};
|
|
5601
|
-
});
|
|
5602
|
-
return $gVhhF$solidjsweb.createComponent((0, $9fe9883b1d8ecccc$export$acb3eaade4b23afd), {
|
|
5603
|
-
get style() {
|
|
5604
|
-
return style();
|
|
5605
|
-
},
|
|
5606
|
-
get ["class"]() {
|
|
5607
|
-
return props.class;
|
|
5608
|
-
}
|
|
5609
|
-
});
|
|
5610
|
-
}
|
|
5611
6368
|
const $d92f338ba8f9da9b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=content-block-wrapper>`);
|
|
5612
6369
|
function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
5613
6370
|
content_blocks_: incoming_content_blocks,
|
|
@@ -5818,8 +6575,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
5818
6575
|
}) {
|
|
5819
6576
|
// The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
|
|
5820
6577
|
const is_loading_ = $gVhhF$solidjs.createMemo(() => plp_results_.loading || query_base_.loading);
|
|
5821
|
-
const merchant_ = $gVhhF$solidjs.createMemo(() => query_base_().tenant);
|
|
5822
|
-
const market_ = $gVhhF$solidjs.createMemo(() => query_base_().market);
|
|
5823
6578
|
const has_no_results_or_failed = $gVhhF$solidjs.createMemo(() => {
|
|
5824
6579
|
const displays = plp_results_()?.displays;
|
|
5825
6580
|
return !is_loading_() && (!Array.isArray(displays) || !displays.length);
|
|
@@ -5933,8 +6688,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
5933
6688
|
plp_results_: plp_results_,
|
|
5934
6689
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
5935
6690
|
first_result_in_viewport_: first_result_in_viewport_,
|
|
5936
|
-
market_: market_,
|
|
5937
|
-
merchant_: merchant_,
|
|
5938
6691
|
all_products_loaded_: all_products_loaded_,
|
|
5939
6692
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
5940
6693
|
query_base_: query_base_,
|
|
@@ -6113,42 +6866,6 @@ function $be89be42ce9ea60f$export$1f1775a58da589b5({
|
|
|
6113
6866
|
}
|
|
6114
6867
|
});
|
|
6115
6868
|
}
|
|
6116
|
-
function $ca1176b694a6ee2e$export$fe334901e8bebd57() {
|
|
6117
|
-
const cleanup_fns = [];
|
|
6118
|
-
const cleanup = () => cleanup_fns.forEach(f => f());
|
|
6119
|
-
// use an animation to automatically retain the `overflow` values and all other styling
|
|
6120
|
-
for (const element of [document.documentElement, document.body]) {
|
|
6121
|
-
try {
|
|
6122
|
-
const animation = element.animate({
|
|
6123
|
-
overflow: "hidden",
|
|
6124
|
-
offset: 0
|
|
6125
|
-
}, 1);
|
|
6126
|
-
animation.pause();
|
|
6127
|
-
const fn = $gVhhF$depictaiutilishared.catchify(animation.play.bind(animation));
|
|
6128
|
-
cleanup_fns.push(fn);
|
|
6129
|
-
$gVhhF$solidjs.onCleanup(fn);
|
|
6130
|
-
} catch (e) {
|
|
6131
|
-
$gVhhF$depictaiutilishared.dlog("Probably partial keyframe error", e);
|
|
6132
|
-
}
|
|
6133
|
-
if (getComputedStyle(element).overflow !== "hidden") {
|
|
6134
|
-
// safari gets special hacky treatment
|
|
6135
|
-
const style = element.style;
|
|
6136
|
-
const original_value = style.overflow;
|
|
6137
|
-
style.overflow = "hidden";
|
|
6138
|
-
const fn = $gVhhF$depictaiutilishared.catchify(() => style.overflow = original_value);
|
|
6139
|
-
cleanup_fns.push(fn);
|
|
6140
|
-
$gVhhF$solidjs.onCleanup(fn);
|
|
6141
|
-
}
|
|
6142
|
-
}
|
|
6143
|
-
return cleanup;
|
|
6144
|
-
} // the way that houdini does that (FYI) it fixes the page jumps
|
|
6145
|
-
// const from_top = scrollY;
|
|
6146
|
-
// document.body.style.position = "fixed";
|
|
6147
|
-
// document.body.style.left = 0;
|
|
6148
|
-
// document.body.style.right = 0;
|
|
6149
|
-
// document.body.style.top = `-${from_top}px`;
|
|
6150
|
-
// document.body.style.overflowY = "scroll";
|
|
6151
|
-
|
|
6152
6869
|
const $f958b5ac0e4a78da$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg width=14 height=14 class=sort-icon><path d="M6.199 10.254a.35.35 0 0 0-.496 0L3.5 12.453V.348a.35.35 0 0 0-.7 0v12.105L.598 10.254c-.137-.137-.359-.137-.492 0a.35.35 0 0 0 0 .492l2.797 2.801a.35.35 0 0 0 .496 0L6.2 10.746c.137-.137.137-.355 0-.492zM9.449 3.5H8.051a.35.35 0 0 1-.352-.352V1.75c0-.191.156-.352.352-.352h1.398c.195 0 .352.16.352.352v1.398a.35.35 0 0 1-.352.352zm-1.051-.699h.703v-.699h-.703zm0 0"></path><path d="M10.852 6.301H8.051a.35.35 0 0 1-.352-.352V4.551a.35.35 0 0 1 .352-.352h2.801a.35.35 0 0 1 .348.352v1.398a.35.35 0 0 1-.348.352zm-2.453-.699H10.5v-.703H8.398zm3.851 3.5H8.051c-.195 0-.352-.16-.352-.352V7.352A.35.35 0 0 1 8.051 7h4.199c.191 0 .352.156.352.352V8.75c0 .191-.16.352-.352.352zm-3.852-.703h3.5V7.7h-3.5zm5.25 3.499H8.051a.35.35 0 0 1-.352-.348v-1.402a.35.35 0 0 1 .352-.348h5.598a.35.35 0 0 1 .352.348v1.402a.35.35 0 0 1-.352.348zm-5.25-.699H13.3V10.5H8.398zm0 0">`);
|
|
6153
6870
|
function $f958b5ac0e4a78da$export$da32f7add8a22e86(props = {}) {
|
|
6154
6871
|
return (() => {
|
|
@@ -6987,7 +7704,6 @@ function $e53b2e7e632ac4cb$export$5646050d516e06bc({
|
|
|
6987
7704
|
}) {
|
|
6988
7705
|
const placeholder_crumb_data = [,,,];
|
|
6989
7706
|
const crumb_data = $gVhhF$solidjs.createMemo(() => get_api_crumb_data() || placeholder_crumb_data);
|
|
6990
|
-
const href_accessor = $gVhhF$depictaiutilishared.use_href_accessor();
|
|
6991
7707
|
return $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
6992
7708
|
severity_: "error",
|
|
6993
7709
|
message_: "BreadCrumbs failed",
|
|
@@ -6998,10 +7714,8 @@ function $e53b2e7e632ac4cb$export$5646050d516e06bc({
|
|
|
6998
7714
|
return crumb_data();
|
|
6999
7715
|
},
|
|
7000
7716
|
children: (display_accessor, index) => {
|
|
7001
|
-
const is_last = $gVhhF$solidjs.createMemo(() => index === crumb_data()?.length - 1);
|
|
7002
|
-
const url = $gVhhF$solidjs.createMemo(() => is_last() ? href_accessor() : display_accessor()?.page_url);
|
|
7003
7717
|
const href = $gVhhF$solidjs.createMemo(() => $1ab22f2cd39b3061$export$43cd1e747fecd42e({
|
|
7004
|
-
to_url_:
|
|
7718
|
+
to_url_: display_accessor()?.page_url,
|
|
7005
7719
|
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
7006
7720
|
sorting_query_param_: sorting_query_param_
|
|
7007
7721
|
}));
|
|
@@ -7022,7 +7736,7 @@ function $e53b2e7e632ac4cb$export$5646050d516e06bc({
|
|
|
7022
7736
|
is_replace_: false,
|
|
7023
7737
|
event_: ev,
|
|
7024
7738
|
force_spa_navigation_: true,
|
|
7025
|
-
|
|
7739
|
+
listing_id_: display_accessor()?.listing_id
|
|
7026
7740
|
})), true);
|
|
7027
7741
|
$gVhhF$solidjsweb.insert(_el$2, () => display_accessor().title);
|
|
7028
7742
|
$gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setAttribute(_el$2, "href", href()));
|
|
@@ -7053,42 +7767,42 @@ const $8cceb1d3a967f369$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<n
|
|
|
7053
7767
|
function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
7054
7768
|
quicklinks_data_: quicklinks_data_,
|
|
7055
7769
|
router_: router_,
|
|
7056
|
-
|
|
7770
|
+
current_listing_id_: current_listing_id_,
|
|
7057
7771
|
breadcrumb_data_: breadcrumb_data_,
|
|
7058
7772
|
i18n_: i18n_,
|
|
7059
7773
|
sorting_query_param_: sorting_query_param_,
|
|
7060
7774
|
filter_query_param_prefix_: filter_query_param_prefix_
|
|
7061
7775
|
}) {
|
|
7062
|
-
let
|
|
7776
|
+
let scrolling_logic_ran_for_listing_id = false;
|
|
7063
7777
|
let last_scroll_position;
|
|
7064
7778
|
let scroll_to_element_on_dom_insertion;
|
|
7065
7779
|
let last_was_placeholder = false;
|
|
7066
7780
|
let sliding_element;
|
|
7067
7781
|
$gVhhF$solidjs.createComputed(() => {
|
|
7068
|
-
|
|
7069
|
-
|
|
7782
|
+
current_listing_id_();
|
|
7783
|
+
scrolling_logic_ran_for_listing_id = false;
|
|
7070
7784
|
});
|
|
7071
7785
|
const place_holdey_quicklinks_data = $gVhhF$solidjs.createMemo(() => quicklinks_data_() || [,,,]);
|
|
7072
|
-
const selected_index = $gVhhF$solidjs.createMemo(() => quicklinks_data_()?.findIndex(item => item.
|
|
7073
|
-
const
|
|
7786
|
+
const selected_index = $gVhhF$solidjs.createMemo(() => quicklinks_data_()?.findIndex(item => item.listing_id === current_listing_id_())); // this will be -1 when viewing child categories
|
|
7787
|
+
const scrollpos_per_listing_id = {};
|
|
7074
7788
|
const mutation_plugins = [function () {
|
|
7075
|
-
if (!
|
|
7789
|
+
if (!scrolling_logic_ran_for_listing_id) return;
|
|
7076
7790
|
const {
|
|
7077
7791
|
scrollLeft: scrollLeft
|
|
7078
7792
|
} = this.insert_here;
|
|
7079
7793
|
if (scrollLeft > 0) {
|
|
7080
7794
|
last_scroll_position = scrollLeft;
|
|
7081
|
-
const current_id = $gVhhF$solidjs.untrack(
|
|
7795
|
+
const current_id = $gVhhF$solidjs.untrack(current_listing_id_);
|
|
7082
7796
|
// make sure to not save position where selected item isn't in viewport
|
|
7083
7797
|
const current_selected_index = $gVhhF$solidjs.untrack(selected_index);
|
|
7084
7798
|
const intersecting_thing = this.intersecting_items_object[current_selected_index];
|
|
7085
|
-
if (intersecting_thing?.intersectionRatio >= 0.95 || current_selected_index == undefined || current_selected_index < 0)
|
|
7799
|
+
if (intersecting_thing?.intersectionRatio >= 0.95 || current_selected_index == undefined || current_selected_index < 0) scrollpos_per_listing_id[current_id] = scrollLeft;else if (current_id in scrollpos_per_listing_id)
|
|
7086
7800
|
// if about to go out of view, stop saving it so that the "always show new things in view" thing can get to work
|
|
7087
|
-
delete
|
|
7801
|
+
delete scrollpos_per_listing_id[current_id];
|
|
7088
7802
|
}
|
|
7089
7803
|
}];
|
|
7090
7804
|
$gVhhF$solidjs.createComputed(() => {
|
|
7091
|
-
if (place_holdey_quicklinks_data()?.[0]?.
|
|
7805
|
+
if (place_holdey_quicklinks_data()?.[0]?.listing_id) {
|
|
7092
7806
|
if (last_was_placeholder) queueMicrotask($gVhhF$depictaiutilishared.catchify(() => {
|
|
7093
7807
|
sliding_element?.scrollTo({
|
|
7094
7808
|
left: 0
|
|
@@ -7141,13 +7855,13 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
|
7141
7855
|
equals: false
|
|
7142
7856
|
}), new_data => {
|
|
7143
7857
|
const quicklinks_data = quicklinks_data_(); // this signal should have updated by now since this is a createEffect
|
|
7144
|
-
const current_id =
|
|
7858
|
+
const current_id = current_listing_id_();
|
|
7145
7859
|
if (!new_data || !quicklinks_data || !current_id) return;
|
|
7146
7860
|
const owner = $gVhhF$solidjs.getOwner();
|
|
7147
7861
|
queueMicrotask(() => {
|
|
7148
7862
|
// has to be in microtask so that elements have rendered and are scroll-to-able
|
|
7149
|
-
|
|
7150
|
-
const saved_scroll_position =
|
|
7863
|
+
scrolling_logic_ran_for_listing_id = true;
|
|
7864
|
+
const saved_scroll_position = scrollpos_per_listing_id[current_id];
|
|
7151
7865
|
if (saved_scroll_position) {
|
|
7152
7866
|
insert_here.scrollTo({
|
|
7153
7867
|
left: saved_scroll_position
|
|
@@ -7189,10 +7903,10 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
|
7189
7903
|
// Problem: When you don't open a link in a new tab, we don't display the filter cleared toast
|
|
7190
7904
|
// Solution: instead of not adding the state to the url, add a flag to the link if it's a sibling and then display the toast on load if the flag is set
|
|
7191
7905
|
const is_sibling = $gVhhF$solidjs.createMemo(() => {
|
|
7192
|
-
const current_id =
|
|
7906
|
+
const current_id = current_listing_id_();
|
|
7193
7907
|
return quicklinks_data_()?.some(({
|
|
7194
|
-
|
|
7195
|
-
}) =>
|
|
7908
|
+
listing_id: listing_id
|
|
7909
|
+
}) => listing_id === current_id);
|
|
7196
7910
|
});
|
|
7197
7911
|
const href = $gVhhF$solidjs.createMemo(() =>
|
|
7198
7912
|
// We don't want these links to delete the sort and filter state by default, only if `clear_filters_when_going_sideways` explicitly clears them
|
|
@@ -7213,7 +7927,7 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
|
7213
7927
|
is_replace_: false,
|
|
7214
7928
|
event_: ev,
|
|
7215
7929
|
force_spa_navigation_: true,
|
|
7216
|
-
|
|
7930
|
+
listing_id_: display_accessor()?.listing_id
|
|
7217
7931
|
});
|
|
7218
7932
|
}), true);
|
|
7219
7933
|
$gVhhF$solidjsweb.insert(_el$3, () => display_accessor()?.title || $gVhhF$solidjsweb.createComponent((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
@@ -7311,10 +8025,12 @@ async function $276380e4607fb9fb$export$cc42dd29bf655ab6({
|
|
|
7311
8025
|
const total_products_to_fetch = to_fetch_according_to_state < min_products_to_fetch_ ? min_products_to_fetch_ : to_fetch_according_to_state + 20; // if we fetch according to state, fetch some more in case that the screen size increased, there's some in-accuracy or for the user to scroll. Sometimes the load more post processor will trigger to fetch more after this, but I think that's ok.
|
|
7312
8026
|
if (total_products_to_fetch <= $276380e4607fb9fb$var$api_max_products_per_request) return await make_request_(total_products_to_fetch);
|
|
7313
8027
|
const displays = [];
|
|
8028
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
7314
8029
|
let last_response;
|
|
7315
8030
|
let next_cursor;
|
|
7316
8031
|
for (let fetch_this_time = $276380e4607fb9fb$var$api_max_products_per_request; displays.length < total_products_to_fetch;) {
|
|
7317
|
-
|
|
8032
|
+
// Carry over the request when making the owner so that display transformers can use onCleanup
|
|
8033
|
+
last_response = await $gVhhF$solidjs.runWithOwner(owner, () => make_request_(fetch_this_time, next_cursor));
|
|
7318
8034
|
const new_displays = last_response.displays;
|
|
7319
8035
|
displays.push(...new_displays);
|
|
7320
8036
|
next_cursor = last_response.cursor;
|
|
@@ -7368,7 +8084,7 @@ let $0b6e2070a98de347$export$44dad306455dddf;
|
|
|
7368
8084
|
})($0b6e2070a98de347$export$44dad306455dddf || ($0b6e2070a98de347$export$44dad306455dddf = {}));
|
|
7369
8085
|
function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
7370
8086
|
crumb_data_: crumb_data_,
|
|
7371
|
-
|
|
8087
|
+
listing_id_: listing_id_,
|
|
7372
8088
|
i18n_: i18n_,
|
|
7373
8089
|
selected_filters_: selected_filters_,
|
|
7374
8090
|
local_filter_cache_: local_filter_cache_,
|
|
@@ -7387,15 +8103,15 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
|
7387
8103
|
});
|
|
7388
8104
|
// Code below is for when we're already open and the user navigates to a new category
|
|
7389
8105
|
let previous_crumb_data = $gVhhF$solidjs.untrack(crumb_data_);
|
|
7390
|
-
let
|
|
8106
|
+
let listing_id_when_we_got_previous_data = $gVhhF$solidjs.untrack(listing_id_);
|
|
7391
8107
|
let allow_filter_clearing = true; // set to false when going backwards/forwards
|
|
7392
8108
|
// temporarily disable filter clearing when going backwards/forwards
|
|
7393
8109
|
const handler = () => allow_filter_clearing = false;
|
|
7394
8110
|
window.addEventListener("popstate", handler); // popstate only gets called when using back/forwards button of browser or the history navigate to achieve the same, but not on pushState or replaceState
|
|
7395
8111
|
$gVhhF$solidjs.onCleanup(() => window.removeEventListener("popstate", handler));
|
|
7396
8112
|
$gVhhF$solidjs.createEffect($gVhhF$solidjs.on(crumb_data_, $gVhhF$depictaiutilishared.catchify(new_crumb_data => {
|
|
7397
|
-
const
|
|
7398
|
-
if (allow_filter_clearing && previous_crumb_data && new_crumb_data &&
|
|
8113
|
+
const listing_id_of_new_data = listing_id_();
|
|
8114
|
+
if (allow_filter_clearing && previous_crumb_data && new_crumb_data && listing_id_of_new_data !== listing_id_when_we_got_previous_data) {
|
|
7399
8115
|
const previous_length = previous_crumb_data.length;
|
|
7400
8116
|
const new_length = new_crumb_data.length;
|
|
7401
8117
|
const went_upwards = new_length < previous_length;
|
|
@@ -7403,8 +8119,8 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
|
7403
8119
|
const shorter_array = went_upwards ? new_crumb_data : previous_crumb_data;
|
|
7404
8120
|
const longer_array = went_upwards ? previous_crumb_data : new_crumb_data;
|
|
7405
8121
|
if (!((went_upwards || went_downwards) && shorter_array.every(({
|
|
7406
|
-
|
|
7407
|
-
}, index) => longer_array[index].
|
|
8122
|
+
listing_id: listing_id
|
|
8123
|
+
}, index) => longer_array[index].listing_id === listing_id))) {
|
|
7408
8124
|
// We went sideways, not up or down. Clear filters.
|
|
7409
8125
|
$47e2cc552c02110c$export$8895d39404bd2bb1({
|
|
7410
8126
|
user_triggered_: false,
|
|
@@ -7418,7 +8134,7 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
|
7418
8134
|
sideways_filter_clearing_flag_[1](false);
|
|
7419
8135
|
}
|
|
7420
8136
|
}
|
|
7421
|
-
|
|
8137
|
+
listing_id_when_we_got_previous_data = listing_id_of_new_data;
|
|
7422
8138
|
previous_crumb_data = new_crumb_data;
|
|
7423
8139
|
if (!allow_filter_clearing) allow_filter_clearing = true;
|
|
7424
8140
|
})));
|
|
@@ -7450,16 +8166,16 @@ function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
7450
8166
|
});
|
|
7451
8167
|
tracking_function_for_plp_results(plp_results_);
|
|
7452
8168
|
}
|
|
7453
|
-
const $
|
|
7454
|
-
$
|
|
7455
|
-
function $
|
|
8169
|
+
const $bb9760b7a8acdc18$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=statement style=white-space:pre-wrap>No category ID specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a category ID in your Depict Provider.`),
|
|
8170
|
+
$bb9760b7a8acdc18$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=buttons><button class="ok major">`);
|
|
8171
|
+
function $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id, i18n_) {
|
|
7456
8172
|
if (!(0, $gVhhF$depictaiutilishared.is_debug)) return; // Just to make sure we don't show this in production
|
|
7457
8173
|
const owner = $gVhhF$solidjs.getOwner();
|
|
7458
8174
|
const disconnect = (0, $gVhhF$depictaiutilishared.observer).onexists(el, ({
|
|
7459
8175
|
element: element
|
|
7460
8176
|
}) => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => {
|
|
7461
8177
|
if (!document.documentElement.contains(element)) return;
|
|
7462
|
-
if (!
|
|
8178
|
+
if (!listing_id()) {
|
|
7463
8179
|
const warning = "No category ID specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a category ID in your Depict Provider.";
|
|
7464
8180
|
$gVhhF$depictaiutilishared.dwarn(warning);
|
|
7465
8181
|
const {
|
|
@@ -7470,8 +8186,8 @@ function $839b3341523d31a2$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
|
7470
8186
|
style: {
|
|
7471
8187
|
background: "#ffb830"
|
|
7472
8188
|
},
|
|
7473
|
-
children: [$gVhhF$solidjsweb.getNextElement($
|
|
7474
|
-
const _el$2 = $gVhhF$solidjsweb.getNextElement($
|
|
8189
|
+
children: [$gVhhF$solidjsweb.getNextElement($bb9760b7a8acdc18$var$_tmpl$), (() => {
|
|
8190
|
+
const _el$2 = $gVhhF$solidjsweb.getNextElement($bb9760b7a8acdc18$var$_tmpl$2),
|
|
7475
8191
|
_el$3 = _el$2.firstChild;
|
|
7476
8192
|
_el$3.$$click = () => close_toast_() /* We have to wait for close_toast_ to get defined after the call to show_toast */;
|
|
7477
8193
|
$gVhhF$solidjsweb.insert(_el$3, () => i18n_.ok_());
|
|
@@ -7484,7 +8200,6 @@ function $839b3341523d31a2$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
|
7484
8200
|
$gVhhF$solidjs.onCleanup(disconnect);
|
|
7485
8201
|
}
|
|
7486
8202
|
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
7487
|
-
const $6b502b1b2155a0bc$export$5c28802497c8a83c = /*@__PURE__*/Symbol("category_title_type");
|
|
7488
8203
|
function $6a8e766e914723d8$export$d31a1a1a83ad9413(plp_results_, [get_selected_filters, set_selected_filters]) {
|
|
7489
8204
|
$gVhhF$solidjs.createComputed(() => {
|
|
7490
8205
|
const available_filters = plp_results_()?.filters;
|
|
@@ -7516,8 +8231,7 @@ const $840d88a04b2d22a7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<d
|
|
|
7516
8231
|
$840d88a04b2d22a7$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp category"><div class=listing-page><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/>`);
|
|
7517
8232
|
function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
7518
8233
|
depict_api_: depict_api_,
|
|
7519
|
-
|
|
7520
|
-
listing_type_: listing_type_,
|
|
8234
|
+
listing_id_: listing_id_,
|
|
7521
8235
|
meta_title_suffix_: meta_title_suffix_,
|
|
7522
8236
|
current_sorting_: current_sorting_,
|
|
7523
8237
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
@@ -7530,7 +8244,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7530
8244
|
get_breadcrumb_accessor_: get_breadcrumb_accessor_,
|
|
7531
8245
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7532
8246
|
local_filter_cache_: local_filter_cache_,
|
|
7533
|
-
|
|
8247
|
+
merchant_: merchant_,
|
|
7534
8248
|
market_: market_,
|
|
7535
8249
|
router_: router_,
|
|
7536
8250
|
show_quicklinks_: show_quicklinks_,
|
|
@@ -7553,22 +8267,25 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7553
8267
|
show_n_results_: incoming_i18n.show_n_products_,
|
|
7554
8268
|
no_results_text_: incoming_i18n.no_products_text_
|
|
7555
8269
|
};
|
|
8270
|
+
const {
|
|
8271
|
+
backend_locale_: backend_locale_
|
|
8272
|
+
} = i18n_;
|
|
7556
8273
|
const [get_sorting] = current_sorting_;
|
|
7557
8274
|
const number_of_rendered_selected_filters_items_ = $gVhhF$solidjs.createSignal(0);
|
|
7558
8275
|
const first_result_in_viewport_ = $gVhhF$solidjs.createSignal();
|
|
7559
8276
|
const last_result_in_viewport_ = $gVhhF$solidjs.createSignal();
|
|
7560
8277
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $gVhhF$solidjs.createSignal(false);
|
|
7561
|
-
const
|
|
8278
|
+
const products_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
|
|
7562
8279
|
const sort_obj = get_sorting() && {
|
|
7563
8280
|
...get_sorting()
|
|
7564
8281
|
};
|
|
7565
8282
|
delete sort_obj?.meta;
|
|
7566
8283
|
const f = selected_filters_[0]();
|
|
7567
8284
|
return {
|
|
7568
|
-
|
|
8285
|
+
merchant: merchant_(),
|
|
7569
8286
|
market: market_(),
|
|
7570
|
-
|
|
7571
|
-
|
|
8287
|
+
locale: backend_locale_(),
|
|
8288
|
+
listing_id: listing_id_(),
|
|
7572
8289
|
...(f.length ? {
|
|
7573
8290
|
filters: f
|
|
7574
8291
|
} : {}),
|
|
@@ -7577,13 +8294,14 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7577
8294
|
} : {})
|
|
7578
8295
|
};
|
|
7579
8296
|
});
|
|
7580
|
-
|
|
8297
|
+
// Make "Get products in listing" request to get products in listing
|
|
8298
|
+
const [plp_products_] = $gVhhF$solidjs.createResource(products_query_base_,
|
|
7581
8299
|
// only first page of results, unless the history state says we should load more (can't do that in load more thing, I tested, they need to be added at once for the browser to not give up scroll restoration)
|
|
7582
8300
|
$gVhhF$depictaiutilishared.catchify(base_query => $276380e4607fb9fb$export$cc42dd29bf655ab6({
|
|
7583
|
-
id_: $gVhhF$solidjs.untrack(
|
|
8301
|
+
id_: $gVhhF$solidjs.untrack(listing_id_),
|
|
7584
8302
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
7585
8303
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
7586
|
-
make_request_: (limit, cursor) => depict_api_.
|
|
8304
|
+
make_request_: (limit, cursor) => depict_api_.get_listing_products({
|
|
7587
8305
|
...base_query,
|
|
7588
8306
|
limit: limit,
|
|
7589
8307
|
...(cursor ? {
|
|
@@ -7591,24 +8309,33 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7591
8309
|
} : {})
|
|
7592
8310
|
})
|
|
7593
8311
|
})));
|
|
7594
|
-
const
|
|
8312
|
+
const meta_query_base = $8cd545330f2674dc$export$210f130a61ac1e8d(() => ({
|
|
8313
|
+
merchant: merchant_(),
|
|
8314
|
+
market: market_(),
|
|
8315
|
+
locale: backend_locale_(),
|
|
8316
|
+
listing_id: listing_id_()
|
|
8317
|
+
}));
|
|
8318
|
+
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
8319
|
+
const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilishared.catchify(query => depict_api_.get_listing(query)));
|
|
8320
|
+
const available_sortings_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
7595
8321
|
...sort,
|
|
7596
8322
|
order: sort.order ?? "desc"
|
|
7597
8323
|
})));
|
|
7598
|
-
const available_filters_ = $gVhhF$solidjs.createMemo(() =>
|
|
7599
|
-
const
|
|
7600
|
-
const
|
|
8324
|
+
const available_filters_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.filters);
|
|
8325
|
+
const title = $gVhhF$solidjs.createMemo(() => plp_meta()?.title);
|
|
8326
|
+
const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title);
|
|
8327
|
+
const quicklinks_data_ = $gVhhF$solidjs.createMemo(() => plp_meta()?.quick_links);
|
|
7601
8328
|
const meta_tag_data_ = $gVhhF$solidjs.createMemo(() => {
|
|
7602
|
-
if (
|
|
7603
|
-
title:
|
|
7604
|
-
description:
|
|
8329
|
+
if (plp_meta()?.replace_meta_tags) return {
|
|
8330
|
+
title: plp_meta()?.title + (meta_title_suffix_() || ""),
|
|
8331
|
+
description: plp_meta()?.description
|
|
7605
8332
|
};
|
|
7606
8333
|
});
|
|
7607
8334
|
$gVhhF$depictaiutilishared.edit_current_page_meta_tags(meta_tag_data_);
|
|
7608
8335
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $gVhhF$solidjs.createSignal(false);
|
|
7609
8336
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $gVhhF$solidjs.createSignal();
|
|
7610
8337
|
const formatted_number_of_results_ = $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
|
|
7611
|
-
number_: $gVhhF$solidjs.createMemo(() =>
|
|
8338
|
+
number_: $gVhhF$solidjs.createMemo(() => plp_products_()?.n_hits),
|
|
7612
8339
|
i18n_: i18n_
|
|
7613
8340
|
});
|
|
7614
8341
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = $gVhhF$solidjs.createSignal();
|
|
@@ -7627,7 +8354,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7627
8354
|
[_el$6, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
7628
8355
|
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
7629
8356
|
get when() {
|
|
7630
|
-
return
|
|
8357
|
+
return plp_products_.loading;
|
|
7631
8358
|
},
|
|
7632
8359
|
fallback: formatted_number_of_results_,
|
|
7633
8360
|
get children() {
|
|
@@ -7639,7 +8366,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7639
8366
|
}), _el$4, _co$);
|
|
7640
8367
|
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
7641
8368
|
get when() {
|
|
7642
|
-
return
|
|
8369
|
+
return plp_products_()?.n_hits === 1;
|
|
7643
8370
|
},
|
|
7644
8371
|
get fallback() {
|
|
7645
8372
|
return i18n_.products_();
|
|
@@ -7650,11 +8377,10 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7650
8377
|
}), _el$6, _co$2);
|
|
7651
8378
|
return _el$;
|
|
7652
8379
|
})();
|
|
7653
|
-
$6a8e766e914723d8$export$d31a1a1a83ad9413(
|
|
8380
|
+
$6a8e766e914723d8$export$d31a1a1a83ad9413(plp_products_, selected_filters_);
|
|
7654
8381
|
// aiming to have as little unneeded functionality in the bundle as possible, therefore we have two kinds of components that can "plug in" here depending on if there should be a title in the category page along with the count in a row above the buttons on mobile or if it should merge between the buttons when possible
|
|
7655
8382
|
if (category_title_type === "simple") {
|
|
7656
8383
|
const CategoryTitleComponent = category_title_;
|
|
7657
|
-
const title = $gVhhF$solidjs.createMemo(() => crumb_data_()?.at(-1)?.title ?? plp_results_()?.metadata?.title);
|
|
7658
8384
|
results_for = $gVhhF$solidjsweb.createComponent(CategoryTitleComponent, {
|
|
7659
8385
|
category_title_: title,
|
|
7660
8386
|
get product_count_() {
|
|
@@ -7700,12 +8426,12 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7700
8426
|
$gVhhF$depictaiutilishared.catchify((0, $276380e4607fb9fb$export$6e49da55e449af7c))({
|
|
7701
8427
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
7702
8428
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
7703
|
-
id_:
|
|
8429
|
+
id_: listing_id_,
|
|
7704
8430
|
can_write_scroll_restoration_: can_write_scroll_restoration_
|
|
7705
8431
|
});
|
|
7706
8432
|
on_filters_constructed_?.();
|
|
7707
8433
|
$gVhhF$solidjs.createComputed(() => {
|
|
7708
|
-
if (
|
|
8434
|
+
if (plp_products_.loading) set_can_write_scroll_restoration(false);else if (plp_products_()) set_can_write_scroll_restoration(true);
|
|
7709
8435
|
});
|
|
7710
8436
|
$gVhhF$solidjs.createRenderEffect($gVhhF$depictaiutilishared.catchify(async () => {
|
|
7711
8437
|
const slim = is_slim_();
|
|
@@ -7729,13 +8455,13 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7729
8455
|
available_filters_: available_filters_
|
|
7730
8456
|
});
|
|
7731
8457
|
$ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
7732
|
-
|
|
8458
|
+
listing_id_: listing_id_,
|
|
7733
8459
|
crumb_data_: crumb_data_,
|
|
7734
8460
|
i18n_: i18n_,
|
|
7735
8461
|
selected_filters_: selected_filters_,
|
|
7736
8462
|
local_filter_cache_: local_filter_cache_,
|
|
7737
8463
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7738
|
-
plp_results_:
|
|
8464
|
+
plp_results_: plp_products_,
|
|
7739
8465
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
|
|
7740
8466
|
});
|
|
7741
8467
|
get_breadcrumb_accessor_?.(crumb_data_);
|
|
@@ -7759,7 +8485,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7759
8485
|
[_el$28, _co$11] = $gVhhF$solidjsweb.getNextMarker(_el$27.nextSibling),
|
|
7760
8486
|
_el$29 = _el$28.nextSibling,
|
|
7761
8487
|
[_el$30, _co$12] = $gVhhF$solidjsweb.getNextMarker(_el$29.nextSibling);
|
|
7762
|
-
$gVhhF$solidjsweb.use(el => process.env.NODE_ENV === "development" && $
|
|
8488
|
+
$gVhhF$solidjsweb.use(el => process.env.NODE_ENV === "development" && $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id_, i18n_), _el$13);
|
|
7763
8489
|
$gVhhF$solidjsweb.insert(_el$14, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
7764
8490
|
get when() {
|
|
7765
8491
|
return show_breadcrumbs_();
|
|
@@ -7781,7 +8507,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7781
8507
|
get children() {
|
|
7782
8508
|
return $gVhhF$solidjsweb.createComponent((0, $8cceb1d3a967f369$export$466cdc317043f6cb), {
|
|
7783
8509
|
quicklinks_data_: quicklinks_data_,
|
|
7784
|
-
|
|
8510
|
+
current_listing_id_: listing_id_,
|
|
7785
8511
|
router_: router_,
|
|
7786
8512
|
breadcrumb_data_: crumb_data_,
|
|
7787
8513
|
i18n_: i18n_,
|
|
@@ -7824,8 +8550,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7824
8550
|
min_products_to_fetch_:
|
|
7825
8551
|
// if you want to get if all products have been loaded you can add an optional signal here, see SearchPage
|
|
7826
8552
|
min_products_to_fetch_,
|
|
7827
|
-
query_base_:
|
|
7828
|
-
plp_results_:
|
|
8553
|
+
query_base_: products_query_base_,
|
|
8554
|
+
plp_results_: plp_products_,
|
|
7829
8555
|
depict_api_: depict_api_,
|
|
7830
8556
|
first_result_in_viewport_: first_result_in_viewport_,
|
|
7831
8557
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
@@ -7835,7 +8561,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7835
8561
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
7836
8562
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
7837
8563
|
content_blocks_by_row_: content_blocks_by_row_,
|
|
7838
|
-
id_currently_querying_for_:
|
|
8564
|
+
id_currently_querying_for_: listing_id_,
|
|
7839
8565
|
no_results_options_: {
|
|
7840
8566
|
selected_filters_: selected_filters_,
|
|
7841
8567
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -7856,7 +8582,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7856
8582
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
7857
8583
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
7858
8584
|
i18n_: i18n_,
|
|
7859
|
-
number_of_results_: $gVhhF$solidjs.createMemo(() =>
|
|
8585
|
+
number_of_results_: $gVhhF$solidjs.createMemo(() => plp_products_()?.n_hits)
|
|
7860
8586
|
});
|
|
7861
8587
|
}
|
|
7862
8588
|
}), _el$28, _co$11);
|
|
@@ -7877,16 +8603,40 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7877
8603
|
return _el$13;
|
|
7878
8604
|
})()];
|
|
7879
8605
|
}
|
|
8606
|
+
/**
|
|
8607
|
+
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
8608
|
+
*/
|
|
8609
|
+
function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title) {
|
|
8610
|
+
const href_accessor = $gVhhF$depictaiutilishared.use_href_accessor();
|
|
8611
|
+
return $gVhhF$solidjs.createMemo(() => {
|
|
8612
|
+
const api_value = plp_meta()?.breadcrumbs;
|
|
8613
|
+
if (!api_value) return api_value;
|
|
8614
|
+
return [...api_value, {
|
|
8615
|
+
get listing_id() {
|
|
8616
|
+
return plp_meta().listing_id;
|
|
8617
|
+
},
|
|
8618
|
+
get title() {
|
|
8619
|
+
return title();
|
|
8620
|
+
},
|
|
8621
|
+
get page_url() {
|
|
8622
|
+
return href_accessor();
|
|
8623
|
+
},
|
|
8624
|
+
get slug() {
|
|
8625
|
+
return plp_meta().slug;
|
|
8626
|
+
}
|
|
8627
|
+
}];
|
|
8628
|
+
});
|
|
8629
|
+
}
|
|
7880
8630
|
function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
7881
8631
|
const router_ = options.router_;
|
|
7882
8632
|
const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
|
|
7883
8633
|
const search_query_ = search_query_url_param_name_ ? $gVhhF$solidjs.createSignal("") : undefined;
|
|
7884
|
-
const
|
|
7885
|
-
const
|
|
8634
|
+
const override_listing_id_query_param_names_ = "override_listing_id_query_param_names_" in options ? options.override_listing_id_query_param_names_ : undefined;
|
|
8635
|
+
const override_listing_id_ = override_listing_id_query_param_names_ ? $gVhhF$solidjs.createSignal(null) : undefined;
|
|
7886
8636
|
const get_search_query_ = search_query_?.[0];
|
|
7887
8637
|
const set_search_query = search_query_?.[1];
|
|
7888
|
-
const
|
|
7889
|
-
const
|
|
8638
|
+
const get_override_listing_id_ = override_listing_id_?.[0];
|
|
8639
|
+
const set_override_listing_id = override_listing_id_?.[1];
|
|
7890
8640
|
const current_sorting_ = $gVhhF$solidjs.createSignal();
|
|
7891
8641
|
const selected_filters_ = $gVhhF$solidjs.createSignal([]);
|
|
7892
8642
|
const sideways_filter_clearing_flag_ = $gVhhF$solidjs.createSignal(false);
|
|
@@ -7931,10 +8681,10 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
|
7931
8681
|
const found_query = searchParams.get(search_query_url_param_name_);
|
|
7932
8682
|
set_search_query(found_query || "");
|
|
7933
8683
|
}
|
|
7934
|
-
if (
|
|
7935
|
-
const
|
|
7936
|
-
|
|
7937
|
-
if (
|
|
8684
|
+
if (override_listing_id_query_param_names_) {
|
|
8685
|
+
const found_override_listing_id = override_listing_id_query_param_names_.map(n => searchParams.get(n)).find(n => n);
|
|
8686
|
+
set_override_listing_id(found_override_listing_id || null);
|
|
8687
|
+
if (found_override_listing_id) $gVhhF$depictaiutilishared.dlog("Found override query id:", found_override_listing_id); // This stuff might get confusing so better log it
|
|
7938
8688
|
}
|
|
7939
8689
|
|
|
7940
8690
|
if (searchParams.get((0, $1ab22f2cd39b3061$export$cf5feb2102aec7f2)) === "true") set_has_sideways_filter_clearing_flag(true);
|
|
@@ -7961,8 +8711,8 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
|
7961
8711
|
} : {
|
|
7962
8712
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
|
|
7963
8713
|
}),
|
|
7964
|
-
...(typeof
|
|
7965
|
-
|
|
8714
|
+
...(typeof override_listing_id_query_param_names_ === "object" ? {
|
|
8715
|
+
override_listing_id_accessor_: get_override_listing_id_
|
|
7966
8716
|
} : {})
|
|
7967
8717
|
};
|
|
7968
8718
|
}
|
|
@@ -8007,108 +8757,6 @@ function $c79fd10a3ab7d6e0$var$start_href_writer({
|
|
|
8007
8757
|
function $c79fd10a3ab7d6e0$var$delete_sideways_param_flag(searchParams) {
|
|
8008
8758
|
if (searchParams.get((0, $1ab22f2cd39b3061$export$cf5feb2102aec7f2)) === "true") searchParams.delete((0, $1ab22f2cd39b3061$export$cf5feb2102aec7f2));
|
|
8009
8759
|
}
|
|
8010
|
-
class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
8011
|
-
/**
|
|
8012
|
-
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
8013
|
-
*/ /**
|
|
8014
|
-
* We store query_id in history.state and do operate on this both here and in js-ui, this is the key to be used which js-ui provides
|
|
8015
|
-
*/
|
|
8016
|
-
#throwing_on_navigation(...args) {
|
|
8017
|
-
const {
|
|
8018
|
-
on_navigation_: on_navigation_
|
|
8019
|
-
} = this;
|
|
8020
|
-
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
8021
|
-
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
8022
|
-
try {
|
|
8023
|
-
return on_navigation_(...args);
|
|
8024
|
-
} catch (e) {
|
|
8025
|
-
queueMicrotask(() => {
|
|
8026
|
-
throw e;
|
|
8027
|
-
});
|
|
8028
|
-
}
|
|
8029
|
-
}
|
|
8030
|
-
/**
|
|
8031
|
-
* Checks if this tab shouldn't navigate because user wants to open in new tab
|
|
8032
|
-
*/
|
|
8033
|
-
#dont_attempt_navigation(ev) {
|
|
8034
|
-
return ev?.button || ev?.metaKey || ev?.ctrlKey;
|
|
8035
|
-
}
|
|
8036
|
-
/**
|
|
8037
|
-
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
8038
|
-
* This standardises waiting for all kinds of routers
|
|
8039
|
-
*/
|
|
8040
|
-
#get_navigation_happened_promise(is_replace) {
|
|
8041
|
-
return new Promise(resolve => {
|
|
8042
|
-
const handler = what_happened => {
|
|
8043
|
-
if (what_happened === (is_replace ? "replaceState" : "pushState")) {
|
|
8044
|
-
resolve();
|
|
8045
|
-
(0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
|
|
8046
|
-
}
|
|
8047
|
-
};
|
|
8048
|
-
(0, $gVhhF$depictaiutilishared.instant_exec_on_suspect_history_change).add(handler);
|
|
8049
|
-
});
|
|
8050
|
-
}
|
|
8051
|
-
navigate_ = {
|
|
8052
|
-
/**
|
|
8053
|
-
* Call this if you *just* want to replace the state object in history.state
|
|
8054
|
-
*/
|
|
8055
|
-
replace_state_: new_state => {
|
|
8056
|
-
// This doesn't break any router, so we just do this directly for now, since many don't expose an interface for changing the state
|
|
8057
|
-
globalThis?.history?.replaceState(new_state, "");
|
|
8058
|
-
},
|
|
8059
|
-
/**
|
|
8060
|
-
* Call this to change the URL
|
|
8061
|
-
* @param new_url_ new URL to go to
|
|
8062
|
-
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
8063
|
-
* @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
|
|
8064
|
-
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
8065
|
-
* @param category_query_id_ If you are navigating to a category and know the query_id of, please provide it. This is for making a better devEx in js-ui
|
|
8066
|
-
*/
|
|
8067
|
-
go_to_: $gVhhF$depictaiutilishared.catchify(async ({
|
|
8068
|
-
new_url_: raw_new_url,
|
|
8069
|
-
event_: event_,
|
|
8070
|
-
force_spa_navigation_: force_spa_navigation_,
|
|
8071
|
-
is_replace_: is_replace_,
|
|
8072
|
-
category_query_id_: category_query_id_,
|
|
8073
|
-
scroll = true
|
|
8074
|
-
}) => {
|
|
8075
|
-
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
8076
|
-
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
8077
|
-
if (this.#dont_attempt_navigation(event_)) return;
|
|
8078
|
-
const different_origin = new_url_.origin !== location.origin;
|
|
8079
|
-
if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
|
|
8080
|
-
if (force_spa_navigation_ && different_origin)
|
|
8081
|
-
// If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
|
|
8082
|
-
$gVhhF$depictaiutilishared.dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
|
|
8083
|
-
if (!event_)
|
|
8084
|
-
// If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
8085
|
-
location.assign(new_url_);
|
|
8086
|
-
return;
|
|
8087
|
-
}
|
|
8088
|
-
event_?.preventDefault();
|
|
8089
|
-
const promise = this.#get_navigation_happened_promise(true);
|
|
8090
|
-
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
8091
|
-
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
8092
|
-
const new_state = history.state;
|
|
8093
|
-
if (category_query_id_) {
|
|
8094
|
-
// In JS-UI we need to know the query_id of the current category, therefore push it into state
|
|
8095
|
-
if (!this.query_id_state_key) $gVhhF$depictaiutilishared.report(new Error("query_id_state_key is not set"), "error");
|
|
8096
|
-
new_state[this.query_id_state_key] = category_query_id_;
|
|
8097
|
-
}
|
|
8098
|
-
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
8099
|
-
} else this.#throwing_on_navigation.call(this, {
|
|
8100
|
-
is_replace: is_replace_,
|
|
8101
|
-
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
8102
|
-
scroll: scroll
|
|
8103
|
-
});
|
|
8104
|
-
await promise;
|
|
8105
|
-
})
|
|
8106
|
-
};
|
|
8107
|
-
constructor(on_navigation, query_id_state_key) {
|
|
8108
|
-
this.query_id_state_key = query_id_state_key;
|
|
8109
|
-
this.on_navigation_ = on_navigation;
|
|
8110
|
-
}
|
|
8111
|
-
}
|
|
8112
8760
|
|
|
8113
8761
|
/**
|
|
8114
8762
|
* Wraps a function in a try/catch block and throws the error globally. If undefined is provided as fn, a no-op is returned.
|
|
@@ -8144,26 +8792,25 @@ const $48567ac5b39bac56$var$InExternalAreaDiv = ({
|
|
|
8144
8792
|
})();
|
|
8145
8793
|
class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
8146
8794
|
#router;
|
|
8147
|
-
#
|
|
8795
|
+
#localization_signal = $gVhhF$solidjs.createSignal();
|
|
8148
8796
|
#merchant_signal = $gVhhF$solidjs.createSignal();
|
|
8149
8797
|
#market_signal = $gVhhF$solidjs.createSignal();
|
|
8150
|
-
#
|
|
8798
|
+
#listing_id_signal = $gVhhF$solidjs.createSignal("");
|
|
8151
8799
|
#meta_title_suffix_ = $gVhhF$solidjs.createSignal();
|
|
8152
|
-
#
|
|
8153
|
-
#listing_type_signal = $gVhhF$solidjs.createSignal();
|
|
8800
|
+
#disable_override_listing_id = $gVhhF$solidjs.createSignal();
|
|
8154
8801
|
static #keys_constructed_with = /*@__PURE__*/new Set();
|
|
8155
8802
|
get localization() {
|
|
8156
8803
|
// allow reactive access
|
|
8157
|
-
return this.#
|
|
8804
|
+
return this.#localization_signal[0]();
|
|
8158
8805
|
}
|
|
8159
8806
|
set localization(locale_obj) {
|
|
8160
|
-
this.#
|
|
8807
|
+
this.#localization_signal[1](locale_obj);
|
|
8161
8808
|
}
|
|
8162
|
-
get
|
|
8163
|
-
return this.#
|
|
8809
|
+
get listing_id() {
|
|
8810
|
+
return this.#listing_id_signal[0]();
|
|
8164
8811
|
}
|
|
8165
|
-
set
|
|
8166
|
-
this.#
|
|
8812
|
+
set listing_id(id) {
|
|
8813
|
+
this.#listing_id_signal[1](id);
|
|
8167
8814
|
}
|
|
8168
8815
|
get merchant() {
|
|
8169
8816
|
return this.#merchant_signal[0]();
|
|
@@ -8177,23 +8824,17 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
8177
8824
|
set market(market) {
|
|
8178
8825
|
this.#market_signal[1](market);
|
|
8179
8826
|
}
|
|
8180
|
-
get listing_type() {
|
|
8181
|
-
return this.#listing_type_signal[0]();
|
|
8182
|
-
}
|
|
8183
|
-
set listing_type(listing_type) {
|
|
8184
|
-
this.#listing_type_signal[1](listing_type);
|
|
8185
|
-
}
|
|
8186
8827
|
get meta_title_suffix() {
|
|
8187
8828
|
return this.#meta_title_suffix_[0]();
|
|
8188
8829
|
}
|
|
8189
8830
|
set meta_title_suffix(new_suffix) {
|
|
8190
8831
|
this.#meta_title_suffix_[1](new_suffix);
|
|
8191
8832
|
}
|
|
8192
|
-
get
|
|
8193
|
-
return this.#
|
|
8833
|
+
get disable_override_listing_id() {
|
|
8834
|
+
return this.#disable_override_listing_id[0]();
|
|
8194
8835
|
}
|
|
8195
|
-
set
|
|
8196
|
-
this.#
|
|
8836
|
+
set disable_override_listing_id(new_value) {
|
|
8837
|
+
this.#disable_override_listing_id[1](new_value);
|
|
8197
8838
|
}
|
|
8198
8839
|
get on_navigation() {
|
|
8199
8840
|
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
@@ -8208,7 +8849,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
8208
8849
|
page_url_creator: page_url_creator,
|
|
8209
8850
|
display_transformers: display_transformers,
|
|
8210
8851
|
unique_instance_key_for_state = "",
|
|
8211
|
-
|
|
8852
|
+
listing_id_state_key: listing_id_state_key,
|
|
8212
8853
|
...props_on_class
|
|
8213
8854
|
}) {
|
|
8214
8855
|
const owner = $gVhhF$solidjs.getOwner() || $gVhhF$solidjs.createRoot(() => $gVhhF$solidjs.getOwner()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
|
|
@@ -8218,21 +8859,21 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
8218
8859
|
throw new Error("You can only have one instance of DepictCategory with the same uniqueInstanceKeyForState");
|
|
8219
8860
|
Object.assign(this, props_on_class); // set initial signal values
|
|
8220
8861
|
$d84fe647b84b5dc5$export$5162a71f252e6122();
|
|
8221
|
-
this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation",
|
|
8862
|
+
this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", listing_id_state_key);
|
|
8222
8863
|
if (on_navigation) this.#router.on_navigation_ = on_navigation;
|
|
8223
|
-
const
|
|
8864
|
+
const override_listing_id_query_param_names_ = ["listing_id_" + unique_instance_key_for_state, "listing_id"]; // If you're wondering why this is an array https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7958#note_1511700842
|
|
8224
8865
|
const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
|
|
8225
8866
|
const filter_query_param_prefix_ = "f" + unique_instance_key_for_state + "_";
|
|
8226
8867
|
const {
|
|
8227
8868
|
selected_filters_: selected_filters_,
|
|
8228
8869
|
current_sorting_: current_sorting_,
|
|
8229
8870
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
8230
|
-
|
|
8871
|
+
override_listing_id_accessor_: override_listing_id_accessor_
|
|
8231
8872
|
} = $c79fd10a3ab7d6e0$export$477caf01aecaeb2a({
|
|
8232
8873
|
router_: this.#router,
|
|
8233
8874
|
sorting_query_param_: sorting_query_param_,
|
|
8234
8875
|
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
8235
|
-
|
|
8876
|
+
override_listing_id_query_param_names_: override_listing_id_query_param_names_
|
|
8236
8877
|
});
|
|
8237
8878
|
const [reset_history_state_, state_] = $26a56f6b44703084$export$9862539c89138352({
|
|
8238
8879
|
get_default_values_: () => ({
|
|
@@ -8247,7 +8888,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
8247
8888
|
router_: this.#router,
|
|
8248
8889
|
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
8249
8890
|
});
|
|
8250
|
-
const i18n_ = $0785f4c9947d9b5f$export$f091cbac892643a4(this.#
|
|
8891
|
+
const i18n_ = $0785f4c9947d9b5f$export$f091cbac892643a4(this.#localization_signal[0]);
|
|
8251
8892
|
$48567ac5b39bac56$var$privately_shared_properties.set(this, {
|
|
8252
8893
|
state_: state_,
|
|
8253
8894
|
breadcrumb_signal_: $gVhhF$solidjs.createSignal(),
|
|
@@ -8262,7 +8903,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
8262
8903
|
router_: this.#router,
|
|
8263
8904
|
selected_filters_: selected_filters_,
|
|
8264
8905
|
current_sorting_: current_sorting_,
|
|
8265
|
-
|
|
8906
|
+
override_listing_id_accessor_: override_listing_id_accessor_,
|
|
8266
8907
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
8267
8908
|
sorting_query_param_: sorting_query_param_,
|
|
8268
8909
|
filter_query_param_prefix_: filter_query_param_prefix_
|
|
@@ -8282,11 +8923,11 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
|
|
|
8282
8923
|
return $95837413165cc2df$export$23fca46f3143581f(() => {
|
|
8283
8924
|
$gVhhF$solidjs.createEffect(prev => {
|
|
8284
8925
|
// this is here (and not on DepictCategory) so that people also know when PageReplacer removes the page, it's intended to help people replace their own content when a depict page is navigated, see https://depictaiworkspace.slack.com/archives/C04M8MGCF3K/p1691670636155369
|
|
8285
|
-
const id = depict_category.
|
|
8286
|
-
$deaaf04362a1bc71$export$f50b88e2a00918b5(props.
|
|
8926
|
+
const id = depict_category.listing_id; // <- this is a reactive getter
|
|
8927
|
+
$deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_id_change)(id, prev);
|
|
8287
8928
|
return id;
|
|
8288
8929
|
});
|
|
8289
|
-
$gVhhF$solidjs.onCleanup(() => $deaaf04362a1bc71$export$f50b88e2a00918b5(props.
|
|
8930
|
+
$gVhhF$solidjs.onCleanup(() => $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_id_change)());
|
|
8290
8931
|
const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
|
|
8291
8932
|
const {
|
|
8292
8933
|
grid_spacing: grid_spacing
|
|
@@ -8309,7 +8950,7 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
|
|
|
8309
8950
|
},
|
|
8310
8951
|
current_sorting_: current_sorting_,
|
|
8311
8952
|
selected_filters_: selected_filters_,
|
|
8312
|
-
|
|
8953
|
+
override_listing_id_accessor_: override_listing_id_accessor_,
|
|
8313
8954
|
reset_history_state_: reset_history_state_,
|
|
8314
8955
|
depict_api_: depict_api_,
|
|
8315
8956
|
i18n_: i18n_,
|
|
@@ -8322,14 +8963,13 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
|
|
|
8322
8963
|
} = shared_properties;
|
|
8323
8964
|
$gVhhF$solidjs.onCleanup(reset_history_state_);
|
|
8324
8965
|
return $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
8325
|
-
|
|
8966
|
+
merchant_: () => depict_category.merchant,
|
|
8326
8967
|
market_: () => depict_category.market,
|
|
8327
8968
|
depict_api_: depict_api_,
|
|
8328
8969
|
min_products_to_fetch_: $48567ac5b39bac56$var$min_products_to_fetch_,
|
|
8329
8970
|
local_filter_cache_: local_filter_cache_,
|
|
8330
|
-
|
|
8971
|
+
listing_id_: $gVhhF$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_id),
|
|
8331
8972
|
meta_title_suffix_: () => depict_category.meta_title_suffix,
|
|
8332
|
-
listing_type_: () => depict_category.listing_type,
|
|
8333
8973
|
i18n_: i18n_,
|
|
8334
8974
|
show_quicklinks_: $gVhhF$solidjs.createMemo(() => props.show_quicklinks ?? true),
|
|
8335
8975
|
category_title_: category_title,
|
|
@@ -8395,7 +9035,7 @@ function $48567ac5b39bac56$export$de035477d6fef996({
|
|
|
8395
9035
|
i18n_: i18n_,
|
|
8396
9036
|
quicklinks_data_: quicklinks_data_,
|
|
8397
9037
|
router_: router_,
|
|
8398
|
-
|
|
9038
|
+
current_listing_id_: () => depict_category.listing_id,
|
|
8399
9039
|
breadcrumb_data_: breadcrumb_data_,
|
|
8400
9040
|
sorting_query_param_: sorting_query_param_,
|
|
8401
9041
|
filter_query_param_prefix_: filter_query_param_prefix_
|
|
@@ -8408,31 +9048,6 @@ function $48567ac5b39bac56$var$get_shared_properties(depict_category) {
|
|
|
8408
9048
|
if (!shared_properties) throw new Error("Can't connect to provided DepictCategory instance");
|
|
8409
9049
|
return shared_properties;
|
|
8410
9050
|
}
|
|
8411
|
-
const $0b23bfd073d9a4e8$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=category-title><h1 class=title></h1><span class=explanation> — <!$><!/>`);
|
|
8412
|
-
const $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1 = /*@__PURE__*/(() => {
|
|
8413
|
-
const actual_function = ({
|
|
8414
|
-
category_title_: category_title_,
|
|
8415
|
-
product_count_: product_count_
|
|
8416
|
-
}) => {
|
|
8417
|
-
return (() => {
|
|
8418
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($0b23bfd073d9a4e8$var$_tmpl$),
|
|
8419
|
-
_el$2 = _el$.firstChild,
|
|
8420
|
-
_el$3 = _el$2.nextSibling,
|
|
8421
|
-
_el$4 = _el$3.firstChild,
|
|
8422
|
-
_el$5 = _el$4.nextSibling,
|
|
8423
|
-
[_el$6, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
8424
|
-
$gVhhF$solidjsweb.insert(_el$2, () => category_title_() || $gVhhF$solidjsweb.createComponent((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
8425
|
-
height: "1em",
|
|
8426
|
-
width: "10ch"
|
|
8427
|
-
}));
|
|
8428
|
-
$gVhhF$solidjsweb.insert(_el$3, product_count_, _el$6, _co$);
|
|
8429
|
-
return _el$;
|
|
8430
|
-
})();
|
|
8431
|
-
};
|
|
8432
|
-
// This is wrong but parcel can't build correctly, it says unexpected undefined
|
|
8433
|
-
actual_function[(0, $6b502b1b2155a0bc$export$5c28802497c8a83c)] = "simple";
|
|
8434
|
-
return actual_function;
|
|
8435
|
-
})();
|
|
8436
9051
|
const $85b747260aa175c9$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="sort-and-filter-buttons fake"aria-hidden=true style=position:absolute;z-index:-1;pointer-events:none;opacity:0><div class=outer><div class=inner><!$><!/><!$><!/><!$><!/>`);
|
|
8437
9052
|
const $85b747260aa175c9$export$824dde41348efed1 = /*@__PURE__*/(() => {
|
|
8438
9053
|
const actual_function = ({
|
|
@@ -8531,11 +9146,11 @@ const $85b747260aa175c9$export$824dde41348efed1 = /*@__PURE__*/(() => {
|
|
|
8531
9146
|
actual_function[(0, $6b502b1b2155a0bc$export$5c28802497c8a83c)] = "interactive";
|
|
8532
9147
|
return actual_function;
|
|
8533
9148
|
})();
|
|
8534
|
-
const $
|
|
8535
|
-
const $
|
|
8536
|
-
async function $
|
|
9149
|
+
const $6382a1b83da39674$var$TEN_MINUTES = 600000;
|
|
9150
|
+
const $6382a1b83da39674$var$TWENTY_FOUR_HOURS = 86400000;
|
|
9151
|
+
async function $6382a1b83da39674$export$c1a6b039e689a58e(merchant, market, locale) {
|
|
8537
9152
|
let localstorage_value;
|
|
8538
|
-
const localstorage_key = `
|
|
9153
|
+
const localstorage_key = `depict_listings_${JSON.stringify([merchant, market, locale])}}`;
|
|
8539
9154
|
try {
|
|
8540
9155
|
const in_ls = localStorage[localstorage_key];
|
|
8541
9156
|
if (in_ls) localstorage_value = JSON.parse(in_ls);
|
|
@@ -8547,20 +9162,20 @@ async function $63b10c9f461e0ef6$export$643598a327b5833e(tenant, market, type) {
|
|
|
8547
9162
|
const stored_queries = localstorage_value?.queries;
|
|
8548
9163
|
if (Array.isArray(stored_queries) && typeof updated === "number") {
|
|
8549
9164
|
const age = now - updated;
|
|
8550
|
-
if (stored_queries.length && age < $
|
|
9165
|
+
if (stored_queries.length && age < $6382a1b83da39674$var$TEN_MINUTES)
|
|
8551
9166
|
// if younger than 10 minutes and probably valid data, just return stored value
|
|
8552
|
-
return stored_queries;else if (age < $
|
|
9167
|
+
return stored_queries;else if (age < $6382a1b83da39674$var$TWENTY_FOUR_HOURS) {
|
|
8553
9168
|
// if younger than a day, return stored value but still trigger re-fetch, so we have fresh data next page load (stale data this one but never a delay)
|
|
8554
|
-
$
|
|
9169
|
+
$6382a1b83da39674$var$fetch_and_store_categories(merchant, market, locale, localstorage_key).catch(e => $gVhhF$depictaiutilishared.report([e, "couldn't fetch categories"], "warning"));
|
|
8555
9170
|
return stored_queries;
|
|
8556
9171
|
}
|
|
8557
9172
|
// else: we are older and just fetch, store and return new queries
|
|
8558
9173
|
}
|
|
8559
9174
|
|
|
8560
|
-
return await $
|
|
9175
|
+
return await $6382a1b83da39674$var$fetch_and_store_categories(merchant, market, locale, localstorage_key);
|
|
8561
9176
|
}
|
|
8562
|
-
async function $
|
|
8563
|
-
const new_categories = await $
|
|
9177
|
+
async function $6382a1b83da39674$var$fetch_and_store_categories(merchant, market, locale, localstorage_key) {
|
|
9178
|
+
const new_categories = await $6382a1b83da39674$var$download_categories(merchant, market, locale);
|
|
8564
9179
|
try {
|
|
8565
9180
|
localStorage[localstorage_key] = JSON.stringify({
|
|
8566
9181
|
updated: +new Date(),
|
|
@@ -8572,24 +9187,22 @@ async function $63b10c9f461e0ef6$var$fetch_and_store_categories(tenant, market,
|
|
|
8572
9187
|
|
|
8573
9188
|
return new_categories;
|
|
8574
9189
|
}
|
|
8575
|
-
async function $
|
|
8576
|
-
const
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
})
|
|
8585
|
-
});
|
|
9190
|
+
async function $6382a1b83da39674$var$download_categories(merchant, market, locale) {
|
|
9191
|
+
const url = new URL((0, $gVhhF$depictaiutilishared.base_url) + "/v3/listings");
|
|
9192
|
+
const request = {
|
|
9193
|
+
merchant: merchant,
|
|
9194
|
+
market: market,
|
|
9195
|
+
locale: locale
|
|
9196
|
+
};
|
|
9197
|
+
url.search = "" + new URLSearchParams(request);
|
|
9198
|
+
const fetched = await $gVhhF$depictaiutilishared.fetch_retry(url.href);
|
|
8586
9199
|
if (!fetched) return [];
|
|
8587
9200
|
try {
|
|
8588
9201
|
if (fetched.status !== 200) {
|
|
8589
9202
|
$gVhhF$depictaiutilishared.dlog("failed to fetch queries, server responded with", fetched.status, fetched, await fetched.text());
|
|
8590
9203
|
return [];
|
|
8591
9204
|
}
|
|
8592
|
-
return
|
|
9205
|
+
return await fetched.json();
|
|
8593
9206
|
} catch (e) {
|
|
8594
9207
|
$gVhhF$depictaiutilishared.dlog("failed to decode queries json", fetched, e);
|
|
8595
9208
|
return [];
|
|
@@ -8840,8 +9453,6 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
8840
9453
|
}));
|
|
8841
9454
|
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
8842
9455
|
displays_by_key_: displays_by_key_,
|
|
8843
|
-
merchant_: $gVhhF$solidjs.createMemo(() => search_query_base_().tenant),
|
|
8844
|
-
market_: $gVhhF$solidjs.createMemo(() => search_query_base_().market),
|
|
8845
9456
|
product_card_template_: product_card_template_
|
|
8846
9457
|
});
|
|
8847
9458
|
})();
|
|
@@ -9157,7 +9768,7 @@ const $6ae556e536054e87$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<d
|
|
|
9157
9768
|
function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
9158
9769
|
depict_api_: depict_api_,
|
|
9159
9770
|
search_field_value_: [get_search_field_value],
|
|
9160
|
-
|
|
9771
|
+
merchant_: merchant_,
|
|
9161
9772
|
market_: market_,
|
|
9162
9773
|
render_instant_card_: render_instant_card_,
|
|
9163
9774
|
render_instant_card_placeholder_: render_instant_card_placeholder_,
|
|
@@ -9181,8 +9792,10 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
|
9181
9792
|
timeout = setTimeout($gVhhF$depictaiutilishared.catchify(() => write_current_instant_query(value)), 250);
|
|
9182
9793
|
});
|
|
9183
9794
|
const [search_results] = $gVhhF$solidjs.createResource($gVhhF$solidjs.createMemo(() => ({
|
|
9184
|
-
|
|
9795
|
+
// <-- key order important, see comment below
|
|
9796
|
+
merchant: merchant_(),
|
|
9185
9797
|
market: market_(),
|
|
9798
|
+
locale: i18n_.backend_locale_(),
|
|
9186
9799
|
query: read_current_instant_query()
|
|
9187
9800
|
})), $gVhhF$depictaiutilishared.catchify(variable_data => {
|
|
9188
9801
|
return depict_api_.query({
|
|
@@ -9230,12 +9843,12 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
|
9230
9843
|
const card = render_instant_card_ ? $gVhhF$solidjs.createMemo(() => render_instant_card_(d(), {
|
|
9231
9844
|
index: i,
|
|
9232
9845
|
i18n: $639c124c22b6cbaa$export$27b710c08412a7ad(i18n_),
|
|
9233
|
-
merchant:
|
|
9846
|
+
merchant: merchant_(),
|
|
9234
9847
|
market: market_()
|
|
9235
9848
|
})) : $6ae613870d3380fc$export$b05c0ae390cf3e06(d, {
|
|
9236
9849
|
index: i,
|
|
9237
9850
|
i18n: i18n_,
|
|
9238
|
-
merchant:
|
|
9851
|
+
merchant: merchant_(),
|
|
9239
9852
|
market: market_()
|
|
9240
9853
|
}, router_);
|
|
9241
9854
|
return card;
|
|
@@ -9872,7 +10485,7 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
9872
10485
|
previous_searches_: [unfiltered_previous_searches, set_unfiltered_previous_searches_],
|
|
9873
10486
|
previous_searches_text_: previous_searches_text_,
|
|
9874
10487
|
depict_api_: depict_api_,
|
|
9875
|
-
|
|
10488
|
+
merchant_: merchant_,
|
|
9876
10489
|
market_: market_,
|
|
9877
10490
|
input_field_: input_field_,
|
|
9878
10491
|
url_transformer_: url_transformer_,
|
|
@@ -9945,9 +10558,10 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
9945
10558
|
set_show_stale_content_results(true);else {
|
|
9946
10559
|
set_searching_for_value(field_value);
|
|
9947
10560
|
deparallelized_fn({
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
10561
|
+
merchant: merchant_(),
|
|
10562
|
+
market: market_(),
|
|
10563
|
+
locale: i18n_.backend_locale_(),
|
|
10564
|
+
query: field_value
|
|
9951
10565
|
});
|
|
9952
10566
|
set_show_stale_content_results(false);
|
|
9953
10567
|
}
|
|
@@ -10083,7 +10697,7 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
10083
10697
|
close_modal_: close_modal_,
|
|
10084
10698
|
style_props_ = $gVhhF$solidjs.createSignal({}),
|
|
10085
10699
|
depict_api_: depict_api_,
|
|
10086
|
-
|
|
10700
|
+
merchant_: merchant_,
|
|
10087
10701
|
market_: market_,
|
|
10088
10702
|
submit_query_: props_submit_query,
|
|
10089
10703
|
instant_results_options_: instant_results_options_,
|
|
@@ -10220,7 +10834,7 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
10220
10834
|
previous_searches_: previous_searches_,
|
|
10221
10835
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
10222
10836
|
market_: market_,
|
|
10223
|
-
|
|
10837
|
+
merchant_: merchant_,
|
|
10224
10838
|
selected_index_: selected_index,
|
|
10225
10839
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
10226
10840
|
depict_api_: depict_api_,
|
|
@@ -10243,7 +10857,7 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
10243
10857
|
return $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
10244
10858
|
search_field_value_: search_field_value_,
|
|
10245
10859
|
depict_api_: depict_api_,
|
|
10246
|
-
|
|
10860
|
+
merchant_: merchant_,
|
|
10247
10861
|
i18n_: i18n_,
|
|
10248
10862
|
market_: market_,
|
|
10249
10863
|
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
@@ -10725,6 +11339,9 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
10725
11339
|
const first_result_in_viewport_ = $gVhhF$solidjs.createSignal();
|
|
10726
11340
|
const last_result_in_viewport_ = $gVhhF$solidjs.createSignal();
|
|
10727
11341
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $gVhhF$solidjs.createSignal(false);
|
|
11342
|
+
const {
|
|
11343
|
+
backend_locale_: backend_locale_
|
|
11344
|
+
} = i18n_;
|
|
10728
11345
|
const search_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
|
|
10729
11346
|
const sort_obj = get_sorting() && {
|
|
10730
11347
|
...get_sorting()
|
|
@@ -10732,8 +11349,9 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
10732
11349
|
delete sort_obj?.meta;
|
|
10733
11350
|
const f = selected_filters_[0]();
|
|
10734
11351
|
return {
|
|
10735
|
-
|
|
11352
|
+
merchant: tenant_(),
|
|
10736
11353
|
market: market_(),
|
|
11354
|
+
locale: backend_locale_(),
|
|
10737
11355
|
query: get_search_query_(),
|
|
10738
11356
|
...(f.length ? {
|
|
10739
11357
|
filters: f
|
|
@@ -10759,11 +11377,12 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
10759
11377
|
})
|
|
10760
11378
|
});
|
|
10761
11379
|
}));
|
|
10762
|
-
const [suggestions] = $gVhhF$solidjs.createResource(
|
|
11380
|
+
const [suggestions] = $gVhhF$solidjs.createResource(() => ({
|
|
10763
11381
|
query: get_search_query_(),
|
|
10764
|
-
|
|
10765
|
-
market: market_()
|
|
10766
|
-
|
|
11382
|
+
merchant: tenant_(),
|
|
11383
|
+
market: market_(),
|
|
11384
|
+
locale: backend_locale_()
|
|
11385
|
+
}), opts => depict_api_.suggest(opts));
|
|
10767
11386
|
const available_sortings_ = $gVhhF$solidjs.createMemo(() => search_results_()?.sorts?.map(sort => ({
|
|
10768
11387
|
...sort,
|
|
10769
11388
|
order: sort.order ?? "desc"
|
|
@@ -11248,7 +11867,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
11248
11867
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
11249
11868
|
previous_searches_: previous_searches,
|
|
11250
11869
|
depict_api_: depict_api_,
|
|
11251
|
-
|
|
11870
|
+
merchant_: this.#merchant_signal[0],
|
|
11252
11871
|
clear_filters_: clear_filters_on_next_submit_,
|
|
11253
11872
|
market_: this.#market_signal[0],
|
|
11254
11873
|
submit_query_: configured_submit_query_,
|
|
@@ -11362,11 +11981,12 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
11362
11981
|
depict_api_: depict_api_
|
|
11363
11982
|
} = $2c61e4cd8229c49a$var$privately_shared_properties.get(this);
|
|
11364
11983
|
const result = await depict_api_.query({
|
|
11365
|
-
|
|
11984
|
+
merchant: this.merchant,
|
|
11366
11985
|
market: this.market,
|
|
11367
11986
|
query: query,
|
|
11368
11987
|
filters: filters,
|
|
11369
|
-
limit: maxResults
|
|
11988
|
+
limit: maxResults,
|
|
11989
|
+
locale: this.localization.backend_locale_
|
|
11370
11990
|
});
|
|
11371
11991
|
if (result.failed) throw new Error("Failed to fetch search results");
|
|
11372
11992
|
return result.displays;
|
|
@@ -11806,7 +12426,4 @@ function $0a6acf31d1eae57c$var$clean_url(url) {
|
|
|
11806
12426
|
url_object.hash = "";
|
|
11807
12427
|
return url_object.href;
|
|
11808
12428
|
}
|
|
11809
|
-
const $a3280f0aad997933$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
|
|
11810
|
-
const $a3280f0aad997933$export$864d304a0bc46829 = "2%";
|
|
11811
|
-
const $a3280f0aad997933$export$7bf543b9d9be2c22 = (0, $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1);
|
|
11812
12429
|
$gVhhF$depictaiutilishared.add_to_version_info("ui", (0, $b757f75811f3261f$export$83d89fbfd8236492));
|