@depict-ai/ui 1.4.22 → 1.4.24
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 +699 -495
- package/ES10/index.d.ts +131 -74
- package/ES10/index.js +701 -499
- package/latest/index.cjs +661 -470
- package/latest/index.d.ts +131 -74
- package/latest/index.js +663 -474
- package/package.json +4 -4
- package/server/ES10/index.cjs +621 -436
- package/server/ES10/index.d.ts +131 -74
- package/server/ES10/index.js +623 -440
- package/server/latest/index.cjs +594 -422
- package/server/latest/index.d.ts +131 -74
- package/server/latest/index.js +596 -426
package/server/latest/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var $5vyXB$depictaiutilishared = require("@depict-ai/utilishared/latest");
|
|
2
2
|
var $5vyXB$solidjsweb = require("solid-js/web");
|
|
3
3
|
var $5vyXB$solidjs = require("solid-js");
|
|
4
|
+
var $5vyXB$depictaiutilisharedlatest = require("@depict-ai/utilishared/latest/latest");
|
|
4
5
|
require("../../multi_import_deduplicator.cjs").register_es_version("ui", "latest");
|
|
5
6
|
function $parcel$export(e, n, v, s) {
|
|
6
7
|
Object.defineProperty(e, n, {
|
|
@@ -10,6 +11,8 @@ function $parcel$export(e, n, v, s) {
|
|
|
10
11
|
configurable: true
|
|
11
12
|
});
|
|
12
13
|
}
|
|
14
|
+
$parcel$export(module.exports, "RecommendationSlider", () => $72f96c4782db0b1b$export$9574e176201e5e8d);
|
|
15
|
+
$parcel$export(module.exports, "RecommendationGrid", () => $1f8dbf7e28b3eff2$export$9756467d34d91cdb);
|
|
13
16
|
$parcel$export(module.exports, "ShopifyResponsiveImg", () => $19950faaac026e09$export$6e5611bc7e57e477);
|
|
14
17
|
$parcel$export(module.exports, "makeSizeAccessor", () => $19950faaac026e09$export$e6fffe67d4cdd848);
|
|
15
18
|
$parcel$export(module.exports, "ImageContainer", () => $93304d59a9747aa6$export$94026ee33dbabc26);
|
|
@@ -58,7 +61,564 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
58
61
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
59
62
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
60
63
|
/*! Depict.ai search and product listing SDK */
|
|
61
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.
|
|
64
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.24";
|
|
65
|
+
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
66
|
+
const cols_at_size = [];
|
|
67
|
+
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
68
|
+
const [nb_cols, width] = sorted_cols_at_size[i];
|
|
69
|
+
const next_width = sorted_cols_at_size[i + 1]?.[1];
|
|
70
|
+
const max_width = i === 0 ? "" : `${width}px`;
|
|
71
|
+
const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
|
|
72
|
+
const col_at_size = [nb_cols, min_width, max_width];
|
|
73
|
+
cols_at_size.push(col_at_size);
|
|
74
|
+
}
|
|
75
|
+
return cols_at_size;
|
|
76
|
+
};
|
|
77
|
+
const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
|
|
78
|
+
// Check that every element is an array
|
|
79
|
+
const are_arrays = cols_at_size.every(element => Array.isArray(element));
|
|
80
|
+
if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
|
|
81
|
+
// Check width duplicates
|
|
82
|
+
const widths = cols_at_size.map(([_, width]) => width);
|
|
83
|
+
const widths_set = new Set(widths);
|
|
84
|
+
if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
|
|
85
|
+
if (cols_at_size.length === 1) {
|
|
86
|
+
const [nb_cols, width] = cols_at_size[0];
|
|
87
|
+
const max_width = width !== undefined ? `${width}px` : "";
|
|
88
|
+
return [[nb_cols, "", max_width]];
|
|
89
|
+
}
|
|
90
|
+
// Sort widths in ascending order
|
|
91
|
+
const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
|
|
92
|
+
const [_b, width_A] = a;
|
|
93
|
+
const [_a, width_b] = b;
|
|
94
|
+
if (width_A === undefined) return -1;
|
|
95
|
+
if (width_b === undefined) return 1;
|
|
96
|
+
return width_b - width_A;
|
|
97
|
+
});
|
|
98
|
+
return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
|
|
103
|
+
*/
|
|
104
|
+
function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
105
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
106
|
+
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
107
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
108
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
109
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
110
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
111
|
+
const to_delete = [];
|
|
112
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
113
|
+
const [, max_width] = sorted_sizes[i];
|
|
114
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
115
|
+
to_delete.push(i);
|
|
116
|
+
}
|
|
117
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
118
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
119
|
+
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
120
|
+
}
|
|
121
|
+
function $fc23d7668ae0011d$export$a2cc176055f8f08() {
|
|
122
|
+
const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
123
|
+
return (0, $5vyXB$solidjsweb.isServer) ? `<!-- ${text} -->` : document.createComment(text);
|
|
124
|
+
}
|
|
125
|
+
function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
|
|
126
|
+
// FYI this probably doesn't work on hugely deep nestings or large amount of elements
|
|
127
|
+
return $5vyXB$solidjs.createMemo(() => $5f7d55c710fd1bc2$var$unwrapping_helper(elements));
|
|
128
|
+
}
|
|
129
|
+
function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
|
|
130
|
+
const result = [];
|
|
131
|
+
if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
|
|
132
|
+
const element = elements[i];
|
|
133
|
+
result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
|
|
134
|
+
} else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
let $0caf87eaa19079da$var$cached_placeholder_element;
|
|
138
|
+
let $0caf87eaa19079da$var$rendering_cached_placeholder_element;
|
|
139
|
+
function $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
140
|
+
product_card_template_: product_card_template_,
|
|
141
|
+
num_placeholders_: num_placeholders_
|
|
142
|
+
}) {
|
|
143
|
+
const [get_elements, set_elements] = $5vyXB$solidjs.createSignal([]);
|
|
144
|
+
let existing_num = 0;
|
|
145
|
+
if (0, $5vyXB$solidjsweb.isServer)
|
|
146
|
+
// want to render simple placeholders on server, effects don't run there
|
|
147
|
+
return $5vyXB$solidjs.createMemo(() => Array.from({
|
|
148
|
+
length: num_placeholders_()
|
|
149
|
+
}).map(() => {
|
|
150
|
+
const template_result = product_card_template_(null, undefined);
|
|
151
|
+
// @ts-ignore
|
|
152
|
+
if (typeof template_result?.then !== "function") return template_result;
|
|
153
|
+
}));
|
|
154
|
+
$5vyXB$solidjs.createRenderEffect(() => {
|
|
155
|
+
const to_add = num_placeholders_() - existing_num;
|
|
156
|
+
if (to_add <= 0) return;
|
|
157
|
+
// Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
|
|
158
|
+
// We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
|
|
159
|
+
// The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
|
|
160
|
+
set_elements(prev => [...prev, ...Array.from({
|
|
161
|
+
length: to_add
|
|
162
|
+
}).map(() => $0caf87eaa19079da$var$Placeholder({
|
|
163
|
+
product_card_template_: product_card_template_
|
|
164
|
+
}))]);
|
|
165
|
+
existing_num += to_add;
|
|
166
|
+
});
|
|
167
|
+
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
171
|
+
*/
|
|
172
|
+
function $0caf87eaa19079da$var$Placeholder({
|
|
173
|
+
product_card_template_: product_card_template_
|
|
174
|
+
}) {
|
|
175
|
+
const get_cloned_placeholders = (element_to_clone = $0caf87eaa19079da$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
|
|
176
|
+
if ($0caf87eaa19079da$var$cached_placeholder_element) return get_cloned_placeholders();
|
|
177
|
+
let dispose_original_copy;
|
|
178
|
+
const get_unwrapped_element = $5vyXB$solidjs.createRoot(dispose => {
|
|
179
|
+
dispose_original_copy = dispose;
|
|
180
|
+
// if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
|
|
181
|
+
const [resource] = $5vyXB$solidjs.createResource(() => {
|
|
182
|
+
if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) return $0caf87eaa19079da$var$rendering_cached_placeholder_element;
|
|
183
|
+
const return_value = product_card_template_(null, undefined);
|
|
184
|
+
if (typeof return_value === "object" && typeof return_value?.then === "function")
|
|
185
|
+
// Is Promise or promise-like object
|
|
186
|
+
$0caf87eaa19079da$var$rendering_cached_placeholder_element = return_value;
|
|
187
|
+
return return_value;
|
|
188
|
+
});
|
|
189
|
+
return $5vyXB$solidjs.createMemo(() => {
|
|
190
|
+
if (resource.loading) return () => [];
|
|
191
|
+
return $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(resource);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
$5vyXB$solidjs.onCleanup(() => {
|
|
195
|
+
if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) {
|
|
196
|
+
// If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
|
|
197
|
+
const unset_current_rendering = () => {
|
|
198
|
+
dispose_original_copy();
|
|
199
|
+
$0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
|
|
200
|
+
};
|
|
201
|
+
$0caf87eaa19079da$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
|
|
202
|
+
} else
|
|
203
|
+
// Otherwise, just make sure we've disposed our root
|
|
204
|
+
dispose_original_copy();
|
|
205
|
+
});
|
|
206
|
+
return $5vyXB$solidjs.createMemo(() => {
|
|
207
|
+
const unwrapped_array = get_unwrapped_element()();
|
|
208
|
+
if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
|
|
209
|
+
// Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
|
|
210
|
+
return;
|
|
211
|
+
// placeholders have finished rendering, freeze the elements
|
|
212
|
+
// here we might receive the result of a promise that has already been received, tore down and put into cached_placeholder_element, so don't overwrite that more valid result if it's already set
|
|
213
|
+
$0caf87eaa19079da$var$cached_placeholder_element ||= get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
|
|
214
|
+
$0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
|
|
215
|
+
dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
|
|
216
|
+
return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Gets product_id (the thing we key the rendering on) from a display
|
|
222
|
+
*/
|
|
223
|
+
function $a5871dacf261adf8$export$548d053aba053d79(display) {
|
|
224
|
+
if ("variant_index" in display) {
|
|
225
|
+
const actual_display = display.variant_displays[display.variant_index];
|
|
226
|
+
return actual_display.product_id;
|
|
227
|
+
}
|
|
228
|
+
return display.product_id;
|
|
229
|
+
}
|
|
230
|
+
function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
|
|
231
|
+
const displays_by_key_ = $5vyXB$solidjs.createMemo(() => {
|
|
232
|
+
const displays = get_displays_();
|
|
233
|
+
// We key by product_id because that's what can be used to uniquely identify products
|
|
234
|
+
// This way <For> can optimize the rendering
|
|
235
|
+
const map = new Map();
|
|
236
|
+
for (let i = 0; i < displays.length; i++) {
|
|
237
|
+
const display = displays[i];
|
|
238
|
+
const product_id = $a5871dacf261adf8$export$548d053aba053d79(display);
|
|
239
|
+
map.set(product_id, display);
|
|
240
|
+
}
|
|
241
|
+
return map;
|
|
242
|
+
});
|
|
243
|
+
return displays_by_key_;
|
|
244
|
+
}
|
|
245
|
+
function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
246
|
+
displays_by_key_: displays_by_key_,
|
|
247
|
+
merchant_: merchant_,
|
|
248
|
+
market_: market_,
|
|
249
|
+
product_card_template_: product_card_template_,
|
|
250
|
+
do_per_elements_: do_per_elements_
|
|
251
|
+
}) {
|
|
252
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.For), {
|
|
253
|
+
get each() {
|
|
254
|
+
return [...displays_by_key_().keys()];
|
|
255
|
+
},
|
|
256
|
+
children: (product_id, index) => {
|
|
257
|
+
const owner = $5vyXB$solidjs.getOwner();
|
|
258
|
+
const display_accessor = $5vyXB$solidjs.createMemo(() => displays_by_key_().get(product_id));
|
|
259
|
+
const [product_card_resource] = $5vyXB$solidjs.createResource(display_accessor,
|
|
260
|
+
// re-render when the reference to the display object changes
|
|
261
|
+
// this should only be the case when the merchant or market changes and the new request has completed
|
|
262
|
+
display => {
|
|
263
|
+
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
264
|
+
return product_card_template_(display, {
|
|
265
|
+
set_on_index_change: fn => $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.createEffect(() => fn(index()))),
|
|
266
|
+
merchant: $5vyXB$solidjs.untrack(merchant_),
|
|
267
|
+
// this means that the merchant and market provided to the template is wrong while we do another fetch, but I don't see how anyone would need to know the correct market there
|
|
268
|
+
market: $5vyXB$solidjs.untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
|
|
273
|
+
$5vyXB$solidjs.createEffect(() => {
|
|
274
|
+
const product_card_nodes = node_accessor();
|
|
275
|
+
const display = display_accessor();
|
|
276
|
+
const elements = [];
|
|
277
|
+
for (let i = 0; i < product_card_nodes.length; i++) {
|
|
278
|
+
const element = product_card_nodes[i];
|
|
279
|
+
if (!(element instanceof Element)) continue;
|
|
280
|
+
elements.push(element);
|
|
281
|
+
// Add tracking ids
|
|
282
|
+
if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
|
|
283
|
+
const {
|
|
284
|
+
dataset: dataset
|
|
285
|
+
} = element;
|
|
286
|
+
const {
|
|
287
|
+
search_result_id: search_result_id,
|
|
288
|
+
product_listing_result_id: product_listing_result_id,
|
|
289
|
+
recommendation_id: recommendation_id
|
|
290
|
+
} = display;
|
|
291
|
+
if (search_result_id) dataset.searchResultId = search_result_id;else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;else if (recommendation_id) dataset.recommendationId = recommendation_id;
|
|
292
|
+
}
|
|
293
|
+
do_per_elements_?.(elements, index);
|
|
294
|
+
});
|
|
295
|
+
return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
301
|
+
class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
|
|
302
|
+
class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
|
|
303
|
+
constructor(templateError) {
|
|
304
|
+
super("Uncaught error in product card template", {
|
|
305
|
+
cause: templateError
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
const $edafe91daf3091d7$var$_tmpl$ = ["<div", ' class="', '">', "</div>"];
|
|
310
|
+
function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
|
|
311
|
+
return $5vyXB$solidjs.ErrorBoundary({
|
|
312
|
+
fallback(err, retry) {
|
|
313
|
+
const {
|
|
314
|
+
message_: message_,
|
|
315
|
+
severity_: severity_
|
|
316
|
+
} = props;
|
|
317
|
+
let message = message_;
|
|
318
|
+
if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
|
|
319
|
+
console.error(err.cause);
|
|
320
|
+
message = `${message}: ${err.message}`;
|
|
321
|
+
} else $5vyXB$depictaiutilishared.report([err, message_], severity_);
|
|
322
|
+
props.on_error_?.(retry);
|
|
323
|
+
return $5vyXB$solidjsweb.ssr($edafe91daf3091d7$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrClassList(Object.fromEntries(props.class_list_?.map(c => [c, true]) || [])), $5vyXB$solidjsweb.escape(message));
|
|
324
|
+
},
|
|
325
|
+
get children() {
|
|
326
|
+
return props.children;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
const $f48d0fbb00835aaa$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"],
|
|
331
|
+
$f48d0fbb00835aaa$var$_tmpl$2 = ["<div", ' class="', '">', "</div>"];
|
|
332
|
+
function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
|
|
333
|
+
const container_element_ = $5vyXB$solidjsweb.ssrElement("div", props.element_attributes, () => $5vyXB$solidjsweb.escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
334
|
+
return $5vyXB$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
335
|
+
get message_() {
|
|
336
|
+
return "Failed calculating " + props.layout + " layout";
|
|
337
|
+
},
|
|
338
|
+
severity_: "error",
|
|
339
|
+
get children() {
|
|
340
|
+
return $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element_);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
|
|
345
|
+
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
346
|
+
const show_all_rows = $5vyXB$solidjs.createMemo(() => props.rows === "all");
|
|
347
|
+
const rows_or_empty_object = $5vyXB$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
|
|
348
|
+
const view_more_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($5vyXB$solidjs.createMemo(() => rows_or_empty_object().button));
|
|
349
|
+
const view_less_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($5vyXB$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
|
|
350
|
+
const have_a_view_more_button = $5vyXB$solidjs.createMemo(() => {
|
|
351
|
+
const button = view_more_button_elements();
|
|
352
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
353
|
+
});
|
|
354
|
+
const have_a_view_less_button = $5vyXB$solidjs.createMemo(() => {
|
|
355
|
+
const button = view_less_button_elements();
|
|
356
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
357
|
+
});
|
|
358
|
+
const [get_styling, set_styling] = $5vyXB$solidjs.createSignal();
|
|
359
|
+
const container_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
360
|
+
const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
|
|
361
|
+
const [get_children_count, set_children_count] = $5vyXB$solidjs.createSignal(0);
|
|
362
|
+
const update_children_count = () => set_children_count(container_element.children.length);
|
|
363
|
+
const col_styling = $5vyXB$solidjs.createMemo(() => $5vyXB$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
364
|
+
const default_currently_visible_signal = $5vyXB$solidjs.createSignal($5vyXB$solidjs.untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
|
|
365
|
+
const rows_visible_signal = $5vyXB$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
366
|
+
const get_rows_visible = $5vyXB$solidjs.createMemo(() => rows_visible_signal()[0]());
|
|
367
|
+
const set_rows_visible = $5vyXB$solidjs.createMemo(() => rows_visible_signal()[1]);
|
|
368
|
+
const view_more_button_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
369
|
+
const view_less_button_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
370
|
+
const style_element = $5vyXB$solidjsweb.ssr($f48d0fbb00835aaa$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), get_styling);
|
|
371
|
+
const view_more_button_container = $5vyXB$solidjs.createMemo(() => have_a_view_more_button() && $5vyXB$solidjsweb.ssr($f48d0fbb00835aaa$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `load-more-container ${$5vyXB$solidjsweb.escape(view_more_button_class, true)}`, $5vyXB$solidjsweb.escape(rows_or_empty_object().button)));
|
|
372
|
+
// We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
|
|
373
|
+
const view_less_button_container = $5vyXB$solidjs.createMemo(() => have_a_view_less_button() && $5vyXB$solidjsweb.ssr($f48d0fbb00835aaa$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), `load-less-container ${$5vyXB$solidjsweb.escape(view_less_button_class, true)}`, $5vyXB$solidjsweb.escape(rows_or_empty_object().view_less_button)));
|
|
374
|
+
container_element.classList.add(container_class);
|
|
375
|
+
$5vyXB$solidjs.createComputed(() => {
|
|
376
|
+
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
377
|
+
const rows_visible = get_rows_visible();
|
|
378
|
+
const max_rows = rows_or_empty_object().max_rows;
|
|
379
|
+
if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
|
|
380
|
+
});
|
|
381
|
+
$5vyXB$solidjs.createRenderEffect(() => {
|
|
382
|
+
// Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
|
|
383
|
+
if (show_all_rows()) {
|
|
384
|
+
// no view more functionality requested
|
|
385
|
+
set_styling(() => col_styling);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
update_children_count();
|
|
389
|
+
const mutation_observer = new MutationObserver($5vyXB$depictaiutilishared.catchify(update_children_count));
|
|
390
|
+
mutation_observer.observe(container_element, {
|
|
391
|
+
childList: true
|
|
392
|
+
});
|
|
393
|
+
$5vyXB$solidjs.onCleanup(() => mutation_observer.disconnect());
|
|
394
|
+
set_styling(
|
|
395
|
+
// this is needed because solid will think that the memo-accessor is a setter function otherwise
|
|
396
|
+
() => $5vyXB$solidjs.createMemo(() => {
|
|
397
|
+
const {
|
|
398
|
+
rows_per_click: rows_per_click,
|
|
399
|
+
max_rows = -1,
|
|
400
|
+
start_rows: start_rows
|
|
401
|
+
} = rows_or_empty_object();
|
|
402
|
+
const rows_visible = get_rows_visible();
|
|
403
|
+
const children_count = get_children_count();
|
|
404
|
+
return col_styling() + props.cols_at_size.map(options => {
|
|
405
|
+
const [recs_per_row, min, max] = options;
|
|
406
|
+
let should_hide_view_more_button;
|
|
407
|
+
let visible_recs;
|
|
408
|
+
if (props.disable_partial_rows) {
|
|
409
|
+
visible_recs = $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
|
|
410
|
+
const visible_recs_next_show_more = $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
|
|
411
|
+
// Should this really be zero when we default rows_per_click to 1?
|
|
412
|
+
children_count, options);
|
|
413
|
+
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
414
|
+
} else {
|
|
415
|
+
visible_recs = $5vyXB$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
|
|
416
|
+
should_hide_view_more_button = visible_recs >= children_count;
|
|
417
|
+
}
|
|
418
|
+
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
419
|
+
// 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
|
|
420
|
+
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;
|
|
421
|
+
return `${$5vyXB$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}` : ``}}`;
|
|
422
|
+
}).join("");
|
|
423
|
+
}));
|
|
424
|
+
});
|
|
425
|
+
if (insert_after_container) container_element.after(style_element);
|
|
426
|
+
return [container_element, view_more_button_container(), view_less_button_container(), style_element];
|
|
427
|
+
}
|
|
428
|
+
const $0f313083912e447a$var$_tmpl$ = ["<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"></path></svg>'];
|
|
429
|
+
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
430
|
+
return $5vyXB$solidjsweb.ssr($0f313083912e447a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("width", $5vyXB$solidjsweb.escape(props.width_, true) ?? 14, false) + $5vyXB$solidjsweb.ssrAttribute("height", $5vyXB$solidjsweb.escape(props.height_, true) ?? 26, false));
|
|
431
|
+
}
|
|
432
|
+
const $a0e53f99354809d9$var$_tmpl$ = ["<div", ">", "</div>"];
|
|
433
|
+
function $a0e53f99354809d9$export$6649caad96ef8870({
|
|
434
|
+
children: children,
|
|
435
|
+
slider_ref_: slider_ref_,
|
|
436
|
+
faded_opacity_ = 0.7,
|
|
437
|
+
mutation_plugins_ = [],
|
|
438
|
+
disable_fading_: disable_fading_
|
|
439
|
+
}) {
|
|
440
|
+
const slider = new (0, $5vyXB$depictaiutilishared.Amazing_Slider)({
|
|
441
|
+
button_contents: {
|
|
442
|
+
left: [$5vyXB$solidjsweb.ssr($a0e53f99354809d9$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {})))],
|
|
443
|
+
right: [$5vyXB$solidjsweb.ssr($a0e53f99354809d9$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {})))]
|
|
444
|
+
},
|
|
445
|
+
constructor_plugins: [$5vyXB$depictaiutilishared.slider_snap_css().constructor_plugin],
|
|
446
|
+
mutation_plugins: [...(disable_fading_ ? [] : [$5vyXB$depictaiutilishared.slider_fading_factory({
|
|
447
|
+
threshold_: 0.96,
|
|
448
|
+
faded_opacity_: faded_opacity_
|
|
449
|
+
}).mutation_plugin_]), ...mutation_plugins_]
|
|
450
|
+
});
|
|
451
|
+
$5vyXB$solidjsweb.insert(slider.insert_here, children);
|
|
452
|
+
$5vyXB$solidjs.onCleanup(() => slider.observer.disconnect());
|
|
453
|
+
slider_ref_?.(slider);
|
|
454
|
+
return slider.container;
|
|
455
|
+
}
|
|
456
|
+
function $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
457
|
+
recommendations_resource_: recommendations_resource_,
|
|
458
|
+
product_card_template_: product_card_template_,
|
|
459
|
+
layout_options_: layout_options_,
|
|
460
|
+
merchant_: merchant_,
|
|
461
|
+
market_: market_
|
|
462
|
+
}) {
|
|
463
|
+
const is_showing_something = $5vyXB$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
464
|
+
const num_placeholders_ = () => 20;
|
|
465
|
+
const slider = $5vyXB$solidjsweb.createComponent((0, $a0e53f99354809d9$export$6649caad96ef8870), {
|
|
466
|
+
disable_fading_: true,
|
|
467
|
+
slider_ref_: slider => {
|
|
468
|
+
const {
|
|
469
|
+
insert_here: insert_here
|
|
470
|
+
} = slider;
|
|
471
|
+
const Layout = props => $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, insert_here, true);
|
|
472
|
+
// Do like this, so we don't have to call mergeProps ourselves
|
|
473
|
+
$5vyXB$solidjsweb.createComponent(Layout, $5vyXB$solidjsweb.mergeProps({
|
|
474
|
+
rows: "all",
|
|
475
|
+
layout: "slider"
|
|
476
|
+
}, layout_options_));
|
|
477
|
+
$5vyXB$depictaiutilisharedlatest.slider_fractional_factory(0, 0.75).constructor_plugin.call(slider, {}); // enable fractional scrolling
|
|
478
|
+
insert_here.before($fc23d7668ae0011d$export$a2cc176055f8f08());
|
|
479
|
+
},
|
|
480
|
+
get children() {
|
|
481
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
|
|
482
|
+
get fallback() {
|
|
483
|
+
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
484
|
+
num_placeholders_: num_placeholders_,
|
|
485
|
+
product_card_template_: product_card_template_
|
|
486
|
+
});
|
|
487
|
+
},
|
|
488
|
+
get children() {
|
|
489
|
+
return (() => {
|
|
490
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
491
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
492
|
+
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
493
|
+
displays_by_key_: displays_by_key_,
|
|
494
|
+
merchant_: merchant_,
|
|
495
|
+
market_: market_,
|
|
496
|
+
product_card_template_: product_card_template_
|
|
497
|
+
});
|
|
498
|
+
})();
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
504
|
+
get when() {
|
|
505
|
+
return is_showing_something();
|
|
506
|
+
},
|
|
507
|
+
children: slider
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
const $72f96c4782db0b1b$var$_tmpl$ = ["<div", ' class="depict recommendations">', "</div>"];
|
|
511
|
+
function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
|
|
512
|
+
const grid_spacing_override = $5vyXB$solidjs.createMemo(() => {
|
|
513
|
+
const {
|
|
514
|
+
grid_spacing: grid_spacing
|
|
515
|
+
} = props; // can be reactive
|
|
516
|
+
return typeof grid_spacing === "string" ? {
|
|
517
|
+
grid_spacing: grid_spacing
|
|
518
|
+
} : {
|
|
519
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
520
|
+
grid_spacing: grid_spacing.horizontal
|
|
521
|
+
};
|
|
522
|
+
});
|
|
523
|
+
const [recommendations_resource_] = $5vyXB$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
524
|
+
return $5vyXB$solidjsweb.ssr($72f96c4782db0b1b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
525
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
526
|
+
recommendations_resource_: recommendations_resource_,
|
|
527
|
+
market_: () => props.market,
|
|
528
|
+
merchant_: () => props.merchant,
|
|
529
|
+
layout_options_: $5vyXB$solidjs.createMemo(() => ({
|
|
530
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
|
|
531
|
+
...grid_spacing_override()
|
|
532
|
+
}))
|
|
533
|
+
})));
|
|
534
|
+
}
|
|
535
|
+
const $b8e79813f4f7ebe4$var$_tmpl$ = ["<div", ' class="recommendation-grid"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
|
|
536
|
+
function $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
537
|
+
recommendations_resource_: recommendations_resource_,
|
|
538
|
+
product_card_template_: product_card_template_,
|
|
539
|
+
layout_options_: layout_options_,
|
|
540
|
+
merchant_: merchant_,
|
|
541
|
+
market_: market_,
|
|
542
|
+
rows_object_: rows_object_
|
|
543
|
+
}) {
|
|
544
|
+
const is_showing_something = $5vyXB$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
545
|
+
const num_placeholders_ = () => 20;
|
|
546
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
547
|
+
get when() {
|
|
548
|
+
return is_showing_something();
|
|
549
|
+
},
|
|
550
|
+
get children() {
|
|
551
|
+
return $5vyXB$solidjsweb.ssr($b8e79813f4f7ebe4$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($fc23d7668ae0011d$export$a2cc176055f8f08()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $5vyXB$solidjsweb.mergeProps({
|
|
552
|
+
get rows() {
|
|
553
|
+
return rows_object_();
|
|
554
|
+
},
|
|
555
|
+
layout: "grid",
|
|
556
|
+
element_attributes: {
|
|
557
|
+
class: "cards"
|
|
558
|
+
}
|
|
559
|
+
}, layout_options_, {
|
|
560
|
+
get children() {
|
|
561
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
|
|
562
|
+
get fallback() {
|
|
563
|
+
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
564
|
+
num_placeholders_: num_placeholders_,
|
|
565
|
+
product_card_template_: product_card_template_
|
|
566
|
+
});
|
|
567
|
+
},
|
|
568
|
+
get children() {
|
|
569
|
+
return (() => {
|
|
570
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
571
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
572
|
+
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
573
|
+
displays_by_key_: displays_by_key_,
|
|
574
|
+
merchant_: merchant_,
|
|
575
|
+
market_: market_,
|
|
576
|
+
product_card_template_: product_card_template_
|
|
577
|
+
});
|
|
578
|
+
})();
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
}))));
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
const $1f8dbf7e28b3eff2$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
|
|
587
|
+
$1f8dbf7e28b3eff2$var$_tmpl$2 = ["<div", ' class="depict plp recommendations">', "</div>"];
|
|
588
|
+
function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
589
|
+
const rows_object_ = $5vyXB$solidjs.createMemo(() => {
|
|
590
|
+
const view_more_button = props.view_more_button;
|
|
591
|
+
if (!view_more_button) return "all";
|
|
592
|
+
return {
|
|
593
|
+
start_rows: view_more_button.start_rows,
|
|
594
|
+
rows_per_click: view_more_button.rows_per_click,
|
|
595
|
+
button: $5vyXB$solidjsweb.ssr($1f8dbf7e28b3eff2$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(view_more_button.text))
|
|
596
|
+
};
|
|
597
|
+
});
|
|
598
|
+
const grid_spacing_override = $5vyXB$solidjs.createMemo(() => {
|
|
599
|
+
const {
|
|
600
|
+
grid_spacing: grid_spacing
|
|
601
|
+
} = props; // can be reactive
|
|
602
|
+
return typeof grid_spacing === "string" ? {
|
|
603
|
+
grid_spacing: grid_spacing
|
|
604
|
+
} : {
|
|
605
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
606
|
+
grid_spacing: grid_spacing.horizontal
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
const [recommendations_resource_] = $5vyXB$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
610
|
+
return $5vyXB$solidjsweb.ssr($1f8dbf7e28b3eff2$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
611
|
+
rows_object_: rows_object_,
|
|
612
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
613
|
+
recommendations_resource_: recommendations_resource_,
|
|
614
|
+
market_: () => props.market,
|
|
615
|
+
merchant_: () => props.merchant,
|
|
616
|
+
layout_options_: $5vyXB$solidjs.createMemo(() => ({
|
|
617
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
|
|
618
|
+
...grid_spacing_override()
|
|
619
|
+
}))
|
|
620
|
+
})));
|
|
621
|
+
}
|
|
62
622
|
function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
|
|
63
623
|
const [size, setSize] = $5vyXB$solidjs.createSignal(0);
|
|
64
624
|
const resizeObserver = new ResizeObserver($5vyXB$depictaiutilishared.catchify(records => {
|
|
@@ -103,37 +663,6 @@ const $93304d59a9747aa6$var$_tmpl$ = ["<div", ' style="', '"></div>'];
|
|
|
103
663
|
function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
|
|
104
664
|
return $5vyXB$solidjsweb.ssr($93304d59a9747aa6$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrStyle(`position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`));
|
|
105
665
|
}
|
|
106
|
-
|
|
107
|
-
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
108
|
-
class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
|
|
109
|
-
class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
|
|
110
|
-
constructor(templateError) {
|
|
111
|
-
super("Uncaught error in product card template", {
|
|
112
|
-
cause: templateError
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const $edafe91daf3091d7$var$_tmpl$ = ["<div", ' class="', '">', "</div>"];
|
|
117
|
-
function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
|
|
118
|
-
return $5vyXB$solidjs.ErrorBoundary({
|
|
119
|
-
fallback(err, retry) {
|
|
120
|
-
const {
|
|
121
|
-
message_: message_,
|
|
122
|
-
severity_: severity_
|
|
123
|
-
} = props;
|
|
124
|
-
let message = message_;
|
|
125
|
-
if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
|
|
126
|
-
console.error(err.cause);
|
|
127
|
-
message = `${message}: ${err.message}`;
|
|
128
|
-
} else $5vyXB$depictaiutilishared.report([err, message_], severity_);
|
|
129
|
-
props.on_error_?.(retry);
|
|
130
|
-
return $5vyXB$solidjsweb.ssr($edafe91daf3091d7$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrClassList(Object.fromEntries(props.class_list_?.map(c => [c, true]) || [])), $5vyXB$solidjsweb.escape(message));
|
|
131
|
-
},
|
|
132
|
-
get children() {
|
|
133
|
-
return props.children;
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
666
|
function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
|
|
138
667
|
const {
|
|
139
668
|
collapse: collapse,
|
|
@@ -252,33 +781,6 @@ function $d659702496cb72ea$export$a71e92cfbb498adc(props) {
|
|
|
252
781
|
return $5vyXB$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
253
782
|
});
|
|
254
783
|
}
|
|
255
|
-
const $0f313083912e447a$var$_tmpl$ = ["<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"></path></svg>'];
|
|
256
|
-
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
257
|
-
return $5vyXB$solidjsweb.ssr($0f313083912e447a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("width", $5vyXB$solidjsweb.escape(props.width_, true) ?? 14, false) + $5vyXB$solidjsweb.ssrAttribute("height", $5vyXB$solidjsweb.escape(props.height_, true) ?? 26, false));
|
|
258
|
-
}
|
|
259
|
-
const $a0e53f99354809d9$var$_tmpl$ = ["<div", ">", "</div>"];
|
|
260
|
-
function $a0e53f99354809d9$export$6649caad96ef8870({
|
|
261
|
-
children: children,
|
|
262
|
-
slider_ref_: slider_ref_,
|
|
263
|
-
faded_opacity_ = 0.7,
|
|
264
|
-
mutation_plugins_ = []
|
|
265
|
-
}) {
|
|
266
|
-
const slider = new (0, $5vyXB$depictaiutilishared.Amazing_Slider)({
|
|
267
|
-
button_contents: {
|
|
268
|
-
left: [$5vyXB$solidjsweb.ssr($a0e53f99354809d9$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {})))],
|
|
269
|
-
right: [$5vyXB$solidjsweb.ssr($a0e53f99354809d9$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {})))]
|
|
270
|
-
},
|
|
271
|
-
constructor_plugins: [$5vyXB$depictaiutilishared.slider_snap_css().constructor_plugin],
|
|
272
|
-
mutation_plugins: [$5vyXB$depictaiutilishared.slider_fading_factory({
|
|
273
|
-
threshold_: 0.96,
|
|
274
|
-
faded_opacity_: faded_opacity_
|
|
275
|
-
}).mutation_plugin_, ...mutation_plugins_]
|
|
276
|
-
});
|
|
277
|
-
$5vyXB$solidjsweb.insert(slider.insert_here, children);
|
|
278
|
-
$5vyXB$solidjs.onCleanup(() => slider.observer.disconnect());
|
|
279
|
-
slider_ref_?.(slider);
|
|
280
|
-
return slider.container;
|
|
281
|
-
}
|
|
282
784
|
const $c77c68e559a1506c$var$_tmpl$ = '<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"></path>';
|
|
283
785
|
function $c77c68e559a1506c$export$3b621d86b1566b2(props = {}) {
|
|
284
786
|
return $5vyXB$solidjsweb.ssrElement("svg", () => ({
|
|
@@ -1893,143 +2395,35 @@ function $70482f04605572e2$var$modify_only_local_filter(local_filter_object, sel
|
|
|
1893
2395
|
};
|
|
1894
2396
|
if (old_meta) {
|
|
1895
2397
|
const new_meta = {
|
|
1896
|
-
...old_meta
|
|
1897
|
-
};
|
|
1898
|
-
modified_filter_object.meta = new_meta;
|
|
1899
|
-
// set counts to 0
|
|
1900
|
-
if ("counts" in new_meta) {
|
|
1901
|
-
const counts = new_meta.counts;
|
|
1902
|
-
if (counts) new_meta.counts = counts.map(() => 0);
|
|
1903
|
-
}
|
|
1904
|
-
if (Array.isArray(selected_filter_data) && "values" in new_meta) {
|
|
1905
|
-
// we have an array of values and want to strip the ones from the available ones that aren't selected
|
|
1906
|
-
const values = new_meta.values;
|
|
1907
|
-
if (Array.isArray(values)) {
|
|
1908
|
-
const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
|
|
1909
|
-
const indexes_to_remove = new Set();
|
|
1910
|
-
for (let i = 0; i < values.length; i++) {
|
|
1911
|
-
const value = values[i];
|
|
1912
|
-
if (!jsond_set_values.includes(JSON.stringify(value)))
|
|
1913
|
-
// We want to remove the entry with this value from the filter object because it's not selected
|
|
1914
|
-
indexes_to_remove.add(i);
|
|
1915
|
-
}
|
|
1916
|
-
new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
|
|
1917
|
-
if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
|
|
1918
|
-
if (new_meta.counts)
|
|
1919
|
-
// remove counts that are too much, they're all zero anyway if they exist
|
|
1920
|
-
new_meta.counts.length -= indexes_to_remove.size;
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
}
|
|
1924
|
-
return modified_filter_object;
|
|
1925
|
-
}
|
|
1926
|
-
function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
|
|
1927
|
-
// FYI this probably doesn't work on hugely deep nestings or large amount of elements
|
|
1928
|
-
return $5vyXB$solidjs.createMemo(() => $5f7d55c710fd1bc2$var$unwrapping_helper(elements));
|
|
1929
|
-
}
|
|
1930
|
-
function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
|
|
1931
|
-
const result = [];
|
|
1932
|
-
if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
|
|
1933
|
-
const element = elements[i];
|
|
1934
|
-
result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
|
|
1935
|
-
} else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
|
|
1936
|
-
return result;
|
|
1937
|
-
}
|
|
1938
|
-
const $f48d0fbb00835aaa$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
|
|
1939
|
-
$f48d0fbb00835aaa$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
|
|
1940
|
-
function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
|
|
1941
|
-
const container_element_ = $5vyXB$solidjsweb.ssrElement("div", props.element_attributes, () => $5vyXB$solidjsweb.escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
1942
|
-
return $5vyXB$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
1943
|
-
get message_() {
|
|
1944
|
-
return "Failed calculating " + props.layout + " layout";
|
|
1945
|
-
},
|
|
1946
|
-
severity_: "error",
|
|
1947
|
-
get children() {
|
|
1948
|
-
return $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element_);
|
|
1949
|
-
}
|
|
1950
|
-
});
|
|
1951
|
-
}
|
|
1952
|
-
function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
1953
|
-
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
1954
|
-
const show_all_rows = $5vyXB$solidjs.createMemo(() => props.rows === "all");
|
|
1955
|
-
const rows_or_empty_object = $5vyXB$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
|
|
1956
|
-
const view_more_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($5vyXB$solidjs.createMemo(() => rows_or_empty_object().button));
|
|
1957
|
-
const view_less_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($5vyXB$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
|
|
1958
|
-
const have_a_view_more_button = $5vyXB$solidjs.createMemo(() => {
|
|
1959
|
-
const button = view_more_button_elements();
|
|
1960
|
-
return !(!button || Array.isArray(button) && !button.length);
|
|
1961
|
-
});
|
|
1962
|
-
const have_a_view_less_button = $5vyXB$solidjs.createMemo(() => {
|
|
1963
|
-
const button = view_less_button_elements();
|
|
1964
|
-
return !(!button || Array.isArray(button) && !button.length);
|
|
1965
|
-
});
|
|
1966
|
-
const [get_styling, set_styling] = $5vyXB$solidjs.createSignal();
|
|
1967
|
-
const container_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
1968
|
-
const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
|
|
1969
|
-
const [get_children_count, set_children_count] = $5vyXB$solidjs.createSignal(0);
|
|
1970
|
-
const update_children_count = () => set_children_count(container_element.children.length);
|
|
1971
|
-
const col_styling = $5vyXB$solidjs.createMemo(() => $5vyXB$depictaiutilishared.n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
1972
|
-
const default_currently_visible_signal = $5vyXB$solidjs.createSignal($5vyXB$solidjs.untrack(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
|
|
1973
|
-
const rows_visible_signal = $5vyXB$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
1974
|
-
const get_rows_visible = $5vyXB$solidjs.createMemo(() => rows_visible_signal()[0]());
|
|
1975
|
-
const set_rows_visible = $5vyXB$solidjs.createMemo(() => rows_visible_signal()[1]);
|
|
1976
|
-
const view_more_button_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
1977
|
-
const view_less_button_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
1978
|
-
const view_more_button_container = $5vyXB$solidjs.createMemo(() => have_a_view_more_button() && $5vyXB$solidjsweb.ssr($f48d0fbb00835aaa$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `load-more-container ${$5vyXB$solidjsweb.escape(view_more_button_class, true)}`, $5vyXB$solidjsweb.escape(rows_or_empty_object().button)));
|
|
1979
|
-
// We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
|
|
1980
|
-
const view_less_button_container = $5vyXB$solidjs.createMemo(() => have_a_view_less_button() && $5vyXB$solidjsweb.ssr($f48d0fbb00835aaa$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `load-less-container ${$5vyXB$solidjsweb.escape(view_less_button_class, true)}`, $5vyXB$solidjsweb.escape(rows_or_empty_object().view_less_button)));
|
|
1981
|
-
container_element.classList.add(container_class);
|
|
1982
|
-
$5vyXB$solidjs.createComputed(() => {
|
|
1983
|
-
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
1984
|
-
const rows_visible = get_rows_visible();
|
|
1985
|
-
const max_rows = rows_or_empty_object().max_rows;
|
|
1986
|
-
if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
|
|
1987
|
-
});
|
|
1988
|
-
$5vyXB$solidjs.createRenderEffect(() => {
|
|
1989
|
-
// Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
|
|
1990
|
-
if (show_all_rows()) {
|
|
1991
|
-
// no view more functionality requested
|
|
1992
|
-
set_styling(() => col_styling);
|
|
1993
|
-
return;
|
|
1994
|
-
}
|
|
1995
|
-
update_children_count();
|
|
1996
|
-
const mutation_observer = new MutationObserver($5vyXB$depictaiutilishared.catchify(update_children_count));
|
|
1997
|
-
mutation_observer.observe(container_element, {
|
|
1998
|
-
childList: true
|
|
1999
|
-
});
|
|
2000
|
-
$5vyXB$solidjs.onCleanup(() => mutation_observer.disconnect());
|
|
2001
|
-
set_styling(
|
|
2002
|
-
// this is needed because solid will think that the memo-accessor is a setter function otherwise
|
|
2003
|
-
() => $5vyXB$solidjs.createMemo(() => {
|
|
2004
|
-
const {
|
|
2005
|
-
rows_per_click: rows_per_click,
|
|
2006
|
-
max_rows = -1,
|
|
2007
|
-
start_rows: start_rows
|
|
2008
|
-
} = rows_or_empty_object();
|
|
2009
|
-
const rows_visible = get_rows_visible();
|
|
2010
|
-
const children_count = get_children_count();
|
|
2011
|
-
return col_styling() + props.cols_at_size.map(options => {
|
|
2012
|
-
const [recs_per_row, min, max] = options;
|
|
2013
|
-
let should_hide_view_more_button;
|
|
2014
|
-
let visible_recs;
|
|
2015
|
-
if (props.disable_partial_rows) {
|
|
2016
|
-
visible_recs = $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
|
|
2017
|
-
const visible_recs_next_show_more = $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
|
|
2018
|
-
// Should this really be zero when we default rows_per_click to 1?
|
|
2019
|
-
children_count, options);
|
|
2020
|
-
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
2021
|
-
} else {
|
|
2022
|
-
visible_recs = $5vyXB$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
|
|
2023
|
-
should_hide_view_more_button = visible_recs >= children_count;
|
|
2398
|
+
...old_meta
|
|
2399
|
+
};
|
|
2400
|
+
modified_filter_object.meta = new_meta;
|
|
2401
|
+
// set counts to 0
|
|
2402
|
+
if ("counts" in new_meta) {
|
|
2403
|
+
const counts = new_meta.counts;
|
|
2404
|
+
if (counts) new_meta.counts = counts.map(() => 0);
|
|
2405
|
+
}
|
|
2406
|
+
if (Array.isArray(selected_filter_data) && "values" in new_meta) {
|
|
2407
|
+
// we have an array of values and want to strip the ones from the available ones that aren't selected
|
|
2408
|
+
const values = new_meta.values;
|
|
2409
|
+
if (Array.isArray(values)) {
|
|
2410
|
+
const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
|
|
2411
|
+
const indexes_to_remove = new Set();
|
|
2412
|
+
for (let i = 0; i < values.length; i++) {
|
|
2413
|
+
const value = values[i];
|
|
2414
|
+
if (!jsond_set_values.includes(JSON.stringify(value)))
|
|
2415
|
+
// We want to remove the entry with this value from the filter object because it's not selected
|
|
2416
|
+
indexes_to_remove.add(i);
|
|
2024
2417
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2418
|
+
new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
|
|
2419
|
+
if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
|
|
2420
|
+
if (new_meta.counts)
|
|
2421
|
+
// remove counts that are too much, they're all zero anyway if they exist
|
|
2422
|
+
new_meta.counts.length -= indexes_to_remove.size;
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
return modified_filter_object;
|
|
2033
2427
|
}
|
|
2034
2428
|
async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
2035
2429
|
const body = await (0, $5vyXB$depictaiutilishared.observer).wait_for_element("body");
|
|
@@ -2688,92 +3082,6 @@ function $0d0b172488865048$export$ef6006467f04ee41({
|
|
|
2688
3082
|
}
|
|
2689
3083
|
})))];
|
|
2690
3084
|
}
|
|
2691
|
-
function $fc23d7668ae0011d$export$a2cc176055f8f08() {
|
|
2692
|
-
const text = "Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
2693
|
-
return (0, $5vyXB$solidjsweb.isServer) ? `<!-- ${text} -->` : document.createComment(text);
|
|
2694
|
-
}
|
|
2695
|
-
let $0caf87eaa19079da$var$cached_placeholder_element;
|
|
2696
|
-
let $0caf87eaa19079da$var$rendering_cached_placeholder_element;
|
|
2697
|
-
function $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
2698
|
-
product_card_template_: product_card_template_,
|
|
2699
|
-
num_placeholders_: num_placeholders_
|
|
2700
|
-
}) {
|
|
2701
|
-
const [get_elements, set_elements] = $5vyXB$solidjs.createSignal([]);
|
|
2702
|
-
let existing_num = 0;
|
|
2703
|
-
if (0, $5vyXB$solidjsweb.isServer)
|
|
2704
|
-
// want to render simple placeholders on server, effects don't run there
|
|
2705
|
-
return $5vyXB$solidjs.createMemo(() => Array.from({
|
|
2706
|
-
length: num_placeholders_()
|
|
2707
|
-
}).map(() => {
|
|
2708
|
-
const template_result = product_card_template_(null, undefined);
|
|
2709
|
-
// @ts-ignore
|
|
2710
|
-
if (typeof template_result?.then !== "function") return template_result;
|
|
2711
|
-
}));
|
|
2712
|
-
$5vyXB$solidjs.createRenderEffect(() => {
|
|
2713
|
-
const to_add = num_placeholders_() - existing_num;
|
|
2714
|
-
if (to_add <= 0) return;
|
|
2715
|
-
// Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
|
|
2716
|
-
// We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
|
|
2717
|
-
// The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
|
|
2718
|
-
set_elements(prev => [...prev, ...Array.from({
|
|
2719
|
-
length: to_add
|
|
2720
|
-
}).map(() => $0caf87eaa19079da$var$Placeholder({
|
|
2721
|
-
product_card_template_: product_card_template_
|
|
2722
|
-
}))]);
|
|
2723
|
-
existing_num += to_add;
|
|
2724
|
-
});
|
|
2725
|
-
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
2726
|
-
}
|
|
2727
|
-
/**
|
|
2728
|
-
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
2729
|
-
*/
|
|
2730
|
-
function $0caf87eaa19079da$var$Placeholder({
|
|
2731
|
-
product_card_template_: product_card_template_
|
|
2732
|
-
}) {
|
|
2733
|
-
const get_cloned_placeholders = (element_to_clone = $0caf87eaa19079da$var$cached_placeholder_element) => Array.isArray(element_to_clone) ? element_to_clone.map(el => el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
|
|
2734
|
-
if ($0caf87eaa19079da$var$cached_placeholder_element) return get_cloned_placeholders();
|
|
2735
|
-
let dispose_original_copy;
|
|
2736
|
-
const get_unwrapped_element = $5vyXB$solidjs.createRoot(dispose => {
|
|
2737
|
-
dispose_original_copy = dispose;
|
|
2738
|
-
// if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
|
|
2739
|
-
const [resource] = $5vyXB$solidjs.createResource(() => {
|
|
2740
|
-
if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) return $0caf87eaa19079da$var$rendering_cached_placeholder_element;
|
|
2741
|
-
const return_value = product_card_template_(null, undefined);
|
|
2742
|
-
if (typeof return_value === "object" && typeof return_value?.then === "function")
|
|
2743
|
-
// Is Promise or promise-like object
|
|
2744
|
-
$0caf87eaa19079da$var$rendering_cached_placeholder_element = return_value;
|
|
2745
|
-
return return_value;
|
|
2746
|
-
});
|
|
2747
|
-
return $5vyXB$solidjs.createMemo(() => {
|
|
2748
|
-
if (resource.loading) return () => [];
|
|
2749
|
-
return $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(resource);
|
|
2750
|
-
});
|
|
2751
|
-
});
|
|
2752
|
-
$5vyXB$solidjs.onCleanup(() => {
|
|
2753
|
-
if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) {
|
|
2754
|
-
// If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
|
|
2755
|
-
const unset_current_rendering = () => {
|
|
2756
|
-
dispose_original_copy();
|
|
2757
|
-
$0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
|
|
2758
|
-
};
|
|
2759
|
-
$0caf87eaa19079da$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
|
|
2760
|
-
} else
|
|
2761
|
-
// Otherwise, just make sure we've disposed our root
|
|
2762
|
-
dispose_original_copy();
|
|
2763
|
-
});
|
|
2764
|
-
return $5vyXB$solidjs.createMemo(() => {
|
|
2765
|
-
const unwrapped_array = get_unwrapped_element()();
|
|
2766
|
-
if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
|
|
2767
|
-
// Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
|
|
2768
|
-
return;
|
|
2769
|
-
// placeholders have finished rendering, freeze the elements
|
|
2770
|
-
// here we might receive the result of a promise that has already been received, tore down and put into cached_placeholder_element, so don't overwrite that more valid result if it's already set
|
|
2771
|
-
$0caf87eaa19079da$var$cached_placeholder_element ||= get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
|
|
2772
|
-
$0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
|
|
2773
|
-
dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
|
|
2774
|
-
return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
|
|
2775
|
-
});
|
|
2776
|
-
}
|
|
2777
3085
|
|
|
2778
3086
|
/*
|
|
2779
3087
|
* Usually product templates are somewhat height-elastic depending on the content, i.e. if the title is longer we might up to two extra rows for this. That means that the placeholders almost never will reflect the size of the actual content when we do scroll restoration. This magic number specifies how many extra placeholders we should render everytime to compensate for this, since if the placeholders are in total shorter than the old scroll location the scroll restoration won't work.
|
|
@@ -2879,86 +3187,6 @@ function $4117463e2939f5f4$export$63dd0350f8559dda({
|
|
|
2879
3187
|
equals: false
|
|
2880
3188
|
});
|
|
2881
3189
|
}
|
|
2882
|
-
|
|
2883
|
-
/**
|
|
2884
|
-
* Gets product_id (the thing we key the rendering on) from a display
|
|
2885
|
-
*/
|
|
2886
|
-
function $a5871dacf261adf8$export$548d053aba053d79(display) {
|
|
2887
|
-
if ("variant_index" in display) {
|
|
2888
|
-
const actual_display = display.variant_displays[display.variant_index];
|
|
2889
|
-
return actual_display.product_id;
|
|
2890
|
-
}
|
|
2891
|
-
return display.product_id;
|
|
2892
|
-
}
|
|
2893
|
-
function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
|
|
2894
|
-
const displays_by_key_ = $5vyXB$solidjs.createMemo(() => {
|
|
2895
|
-
const displays = get_displays_();
|
|
2896
|
-
// We key by product_id because that's what can be used to uniquely identify products
|
|
2897
|
-
// This way <For> can optimize the rendering
|
|
2898
|
-
const map = new Map();
|
|
2899
|
-
for (let i = 0; i < displays.length; i++) {
|
|
2900
|
-
const display = displays[i];
|
|
2901
|
-
const product_id = $a5871dacf261adf8$export$548d053aba053d79(display);
|
|
2902
|
-
map.set(product_id, display);
|
|
2903
|
-
}
|
|
2904
|
-
return map;
|
|
2905
|
-
});
|
|
2906
|
-
return displays_by_key_;
|
|
2907
|
-
}
|
|
2908
|
-
function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
2909
|
-
displays_by_key_: displays_by_key_,
|
|
2910
|
-
merchant_: merchant_,
|
|
2911
|
-
market_: market_,
|
|
2912
|
-
product_card_template_: product_card_template_,
|
|
2913
|
-
do_per_elements_: do_per_elements_
|
|
2914
|
-
}) {
|
|
2915
|
-
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.For), {
|
|
2916
|
-
get each() {
|
|
2917
|
-
return [...displays_by_key_().keys()];
|
|
2918
|
-
},
|
|
2919
|
-
children: (product_id, index) => {
|
|
2920
|
-
const owner = $5vyXB$solidjs.getOwner();
|
|
2921
|
-
const display_accessor = $5vyXB$solidjs.createMemo(() => displays_by_key_().get(product_id));
|
|
2922
|
-
const [product_card_resource] = $5vyXB$solidjs.createResource(display_accessor,
|
|
2923
|
-
// re-render when the reference to the display object changes
|
|
2924
|
-
// this should only be the case when the merchant or market changes and the new request has completed
|
|
2925
|
-
display => {
|
|
2926
|
-
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
2927
|
-
return product_card_template_(display, {
|
|
2928
|
-
set_on_index_change: fn => $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.createEffect(() => fn(index()))),
|
|
2929
|
-
merchant: $5vyXB$solidjs.untrack(merchant_),
|
|
2930
|
-
// this means that the merchant and market provided to the template is wrong while we do another fetch, but I don't see how anyone would need to know the correct market there
|
|
2931
|
-
market: $5vyXB$solidjs.untrack(market_)
|
|
2932
|
-
});
|
|
2933
|
-
});
|
|
2934
|
-
const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
|
|
2935
|
-
$5vyXB$solidjs.createEffect(() => {
|
|
2936
|
-
const product_card_nodes = node_accessor();
|
|
2937
|
-
const display = display_accessor();
|
|
2938
|
-
const elements = [];
|
|
2939
|
-
for (let i = 0; i < product_card_nodes.length; i++) {
|
|
2940
|
-
const element = product_card_nodes[i];
|
|
2941
|
-
if (!(element instanceof Element)) continue;
|
|
2942
|
-
elements.push(element);
|
|
2943
|
-
// Add tracking ids
|
|
2944
|
-
if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
|
|
2945
|
-
const {
|
|
2946
|
-
dataset: dataset
|
|
2947
|
-
} = element;
|
|
2948
|
-
const {
|
|
2949
|
-
search_result_id: search_result_id,
|
|
2950
|
-
product_listing_result_id: product_listing_result_id,
|
|
2951
|
-
recommendation_id: recommendation_id
|
|
2952
|
-
} = display;
|
|
2953
|
-
if (search_result_id) dataset.searchResultId = search_result_id;else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;else if (recommendation_id) dataset.recommendationId = recommendation_id;
|
|
2954
|
-
}
|
|
2955
|
-
do_per_elements_?.(elements, index);
|
|
2956
|
-
});
|
|
2957
|
-
return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
2958
|
-
}
|
|
2959
|
-
});
|
|
2960
|
-
}
|
|
2961
|
-
|
|
2962
3190
|
function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
2963
3191
|
plp_results_: plp_results_,
|
|
2964
3192
|
product_card_template_: product_card_template_,
|
|
@@ -4840,41 +5068,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
4840
5068
|
}
|
|
4841
5069
|
})))];
|
|
4842
5070
|
}
|
|
4843
|
-
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
4844
|
-
const cols_at_size = [];
|
|
4845
|
-
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
4846
|
-
const [nb_cols, width] = sorted_cols_at_size[i];
|
|
4847
|
-
const next_width = sorted_cols_at_size[i + 1]?.[1];
|
|
4848
|
-
const max_width = i === 0 ? "" : `${width}px`;
|
|
4849
|
-
const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
|
|
4850
|
-
const col_at_size = [nb_cols, min_width, max_width];
|
|
4851
|
-
cols_at_size.push(col_at_size);
|
|
4852
|
-
}
|
|
4853
|
-
return cols_at_size;
|
|
4854
|
-
};
|
|
4855
|
-
const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
|
|
4856
|
-
// Check that every element is an array
|
|
4857
|
-
const are_arrays = cols_at_size.every(element => Array.isArray(element));
|
|
4858
|
-
if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
|
|
4859
|
-
// Check width duplicates
|
|
4860
|
-
const widths = cols_at_size.map(([_, width]) => width);
|
|
4861
|
-
const widths_set = new Set(widths);
|
|
4862
|
-
if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
|
|
4863
|
-
if (cols_at_size.length === 1) {
|
|
4864
|
-
const [nb_cols, width] = cols_at_size[0];
|
|
4865
|
-
const max_width = width !== undefined ? `${width}px` : "";
|
|
4866
|
-
return [[nb_cols, "", max_width]];
|
|
4867
|
-
}
|
|
4868
|
-
// Sort widths in ascending order
|
|
4869
|
-
const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
|
|
4870
|
-
const [_b, width_A] = a;
|
|
4871
|
-
const [_a, width_b] = b;
|
|
4872
|
-
if (width_A === undefined) return -1;
|
|
4873
|
-
if (width_b === undefined) return 1;
|
|
4874
|
-
return width_b - width_A;
|
|
4875
|
-
});
|
|
4876
|
-
return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
|
|
4877
|
-
};
|
|
4878
5071
|
function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
|
|
4879
5072
|
const component_in_error_boundary = do_with_elements => {
|
|
4880
5073
|
const error_boundary_wrapped = $edafe91daf3091d7$export$b69d0d92862de18b({
|
|
@@ -5173,7 +5366,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
5173
5366
|
#meta_title_suffix_ = $5vyXB$solidjs.createSignal();
|
|
5174
5367
|
#disable_override_query_id = $5vyXB$solidjs.createSignal();
|
|
5175
5368
|
#listing_type_signal = $5vyXB$solidjs.createSignal();
|
|
5176
|
-
static #keys_constructed_with = new Set();
|
|
5369
|
+
static #keys_constructed_with = /*@__PURE__*/new Set();
|
|
5177
5370
|
get localization() {
|
|
5178
5371
|
// allow reactive access
|
|
5179
5372
|
return this.#locale_signal[0]();
|
|
@@ -7791,27 +7984,6 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
|
|
|
7791
7984
|
cleanup: cleanup
|
|
7792
7985
|
};
|
|
7793
7986
|
}
|
|
7794
|
-
|
|
7795
|
-
/**
|
|
7796
|
-
* Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
|
|
7797
|
-
*/
|
|
7798
|
-
function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
7799
|
-
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
7800
|
-
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
7801
|
-
const [[, smallest_max_width]] = sorted_sizes;
|
|
7802
|
-
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
7803
|
-
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
7804
|
-
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
7805
|
-
const to_delete = [];
|
|
7806
|
-
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
7807
|
-
const [, max_width] = sorted_sizes[i];
|
|
7808
|
-
if (max_width > min_width_for_more_than_one_column) continue;
|
|
7809
|
-
to_delete.push(i);
|
|
7810
|
-
}
|
|
7811
|
-
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
7812
|
-
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
7813
|
-
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
7814
|
-
}
|
|
7815
7987
|
const $2c61e4cd8229c49a$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
|
|
7816
7988
|
// We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
|
|
7817
7989
|
/**
|
|
@@ -7830,7 +8002,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
7830
8002
|
#market_signal = $5vyXB$solidjs.createSignal();
|
|
7831
8003
|
#modal_open_signal = $5vyXB$solidjs.createSignal(false);
|
|
7832
8004
|
#content_search_signal = $5vyXB$solidjs.createSignal();
|
|
7833
|
-
static #keys_constructed_with = new Set();
|
|
8005
|
+
static #keys_constructed_with = /*@__PURE__*/new Set();
|
|
7834
8006
|
#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
|
|
7835
8007
|
constructor({
|
|
7836
8008
|
unique_instance_key_for_state = "",
|
|
@@ -8344,7 +8516,7 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8344
8516
|
#revert_fns = [];
|
|
8345
8517
|
#is_open = false;
|
|
8346
8518
|
static #reverting_permitted = true;
|
|
8347
|
-
static #visited_urls = (() => {
|
|
8519
|
+
static #visited_urls = /*@__PURE__*/(() => {
|
|
8348
8520
|
// Keep track of all URLs that have been visited since the document that was initially loaded (loaded means the process where the browser creates a new `document` and `window` object).
|
|
8349
8521
|
$5vyXB$depictaiutilishared.catchify(async () => {
|
|
8350
8522
|
// Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
|
|
@@ -8385,14 +8557,14 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8385
8557
|
return $5vyXB$depictaiutilishared.catchify(this.render_, "rendering failed")() || [];
|
|
8386
8558
|
});
|
|
8387
8559
|
}
|
|
8388
|
-
#unload =
|
|
8560
|
+
#unload = /*@__PURE__*/$5vyXB$depictaiutilishared.catchify(() => {
|
|
8389
8561
|
if (!this.#is_open) return;
|
|
8390
8562
|
this.#disconnect_observer?.();
|
|
8391
8563
|
if ($0a6acf31d1eae57c$export$3ccaa27d81dd8556.#reverting_permitted) while (this.#revert_fns.length) this.#revert_fns.pop()?.();
|
|
8392
8564
|
this.#is_open = false;
|
|
8393
8565
|
this.dispatchEvent(new CustomEvent("close"));
|
|
8394
8566
|
}, "failed to close page");
|
|
8395
|
-
#load =
|
|
8567
|
+
#load = /*@__PURE__*/$5vyXB$depictaiutilishared.catchify(async els => {
|
|
8396
8568
|
this.#is_open = true;
|
|
8397
8569
|
// So that #load doesn't get called again
|
|
8398
8570
|
let set_should_stay_inserted;
|