@depict-ai/ui 1.4.22 → 1.4.23
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 +692 -495
- package/ES10/index.d.ts +131 -74
- package/ES10/index.js +694 -499
- package/latest/index.cjs +654 -470
- package/latest/index.d.ts +131 -74
- package/latest/index.js +656 -474
- package/package.json +4 -4
- package/server/ES10/index.cjs +614 -436
- package/server/ES10/index.d.ts +131 -74
- package/server/ES10/index.js +616 -440
- package/server/latest/index.cjs +587 -422
- package/server/latest/index.d.ts +131 -74
- package/server/latest/index.js +589 -426
package/server/latest/index.cjs
CHANGED
|
@@ -10,6 +10,8 @@ function $parcel$export(e, n, v, s) {
|
|
|
10
10
|
configurable: true
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
+
$parcel$export(module.exports, "RecommendationSlider", () => $72f96c4782db0b1b$export$9574e176201e5e8d);
|
|
14
|
+
$parcel$export(module.exports, "RecommendationGrid", () => $1f8dbf7e28b3eff2$export$9756467d34d91cdb);
|
|
13
15
|
$parcel$export(module.exports, "ShopifyResponsiveImg", () => $19950faaac026e09$export$6e5611bc7e57e477);
|
|
14
16
|
$parcel$export(module.exports, "makeSizeAccessor", () => $19950faaac026e09$export$e6fffe67d4cdd848);
|
|
15
17
|
$parcel$export(module.exports, "ImageContainer", () => $93304d59a9747aa6$export$94026ee33dbabc26);
|
|
@@ -58,7 +60,558 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
58
60
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
59
61
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
60
62
|
/*! Depict.ai search and product listing SDK */
|
|
61
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.
|
|
63
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.23";
|
|
64
|
+
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
65
|
+
const cols_at_size = [];
|
|
66
|
+
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
67
|
+
const [nb_cols, width] = sorted_cols_at_size[i];
|
|
68
|
+
const next_width = sorted_cols_at_size[i + 1]?.[1];
|
|
69
|
+
const max_width = i === 0 ? "" : `${width}px`;
|
|
70
|
+
const min_width = next_width !== undefined ? `${next_width + 1}px` : "";
|
|
71
|
+
const col_at_size = [nb_cols, min_width, max_width];
|
|
72
|
+
cols_at_size.push(col_at_size);
|
|
73
|
+
}
|
|
74
|
+
return cols_at_size;
|
|
75
|
+
};
|
|
76
|
+
const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
|
|
77
|
+
// Check that every element is an array
|
|
78
|
+
const are_arrays = cols_at_size.every(element => Array.isArray(element));
|
|
79
|
+
if (!are_arrays) throw new Error("Every element in cols_at_size must be an array");
|
|
80
|
+
// Check width duplicates
|
|
81
|
+
const widths = cols_at_size.map(([_, width]) => width);
|
|
82
|
+
const widths_set = new Set(widths);
|
|
83
|
+
if (widths_set.size < widths.length) throw new Error("There are duplicate widths in cols_at_size");
|
|
84
|
+
if (cols_at_size.length === 1) {
|
|
85
|
+
const [nb_cols, width] = cols_at_size[0];
|
|
86
|
+
const max_width = width !== undefined ? `${width}px` : "";
|
|
87
|
+
return [[nb_cols, "", max_width]];
|
|
88
|
+
}
|
|
89
|
+
// Sort widths in ascending order
|
|
90
|
+
const sorted_cols_at_size = [...cols_at_size].sort((a, b) => {
|
|
91
|
+
const [_b, width_A] = a;
|
|
92
|
+
const [_a, width_b] = b;
|
|
93
|
+
if (width_A === undefined) return -1;
|
|
94
|
+
if (width_b === undefined) return 1;
|
|
95
|
+
return width_b - width_A;
|
|
96
|
+
});
|
|
97
|
+
return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 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
|
|
102
|
+
*/
|
|
103
|
+
function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
104
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
105
|
+
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
106
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
107
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
108
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
109
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
110
|
+
const to_delete = [];
|
|
111
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
112
|
+
const [, max_width] = sorted_sizes[i];
|
|
113
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
114
|
+
to_delete.push(i);
|
|
115
|
+
}
|
|
116
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
117
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
118
|
+
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
119
|
+
}
|
|
120
|
+
function $fc23d7668ae0011d$export$a2cc176055f8f08() {
|
|
121
|
+
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.";
|
|
122
|
+
return (0, $5vyXB$solidjsweb.isServer) ? `<!-- ${text} -->` : document.createComment(text);
|
|
123
|
+
}
|
|
124
|
+
function $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(elements) {
|
|
125
|
+
// FYI this probably doesn't work on hugely deep nestings or large amount of elements
|
|
126
|
+
return $5vyXB$solidjs.createMemo(() => $5f7d55c710fd1bc2$var$unwrapping_helper(elements));
|
|
127
|
+
}
|
|
128
|
+
function $5f7d55c710fd1bc2$var$unwrapping_helper(elements) {
|
|
129
|
+
const result = [];
|
|
130
|
+
if (Array.isArray(elements)) for (let i = 0; i < elements.length; i++) {
|
|
131
|
+
const element = elements[i];
|
|
132
|
+
result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(element));
|
|
133
|
+
} else if (typeof elements == "function") result.push(...$5f7d55c710fd1bc2$var$unwrapping_helper(elements()));else if (elements != undefined && typeof elements != "boolean") result.push(elements);
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
let $0caf87eaa19079da$var$cached_placeholder_element;
|
|
137
|
+
let $0caf87eaa19079da$var$rendering_cached_placeholder_element;
|
|
138
|
+
function $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
139
|
+
product_card_template_: product_card_template_,
|
|
140
|
+
num_placeholders_: num_placeholders_
|
|
141
|
+
}) {
|
|
142
|
+
const [get_elements, set_elements] = $5vyXB$solidjs.createSignal([]);
|
|
143
|
+
let existing_num = 0;
|
|
144
|
+
if (0, $5vyXB$solidjsweb.isServer)
|
|
145
|
+
// want to render simple placeholders on server, effects don't run there
|
|
146
|
+
return $5vyXB$solidjs.createMemo(() => Array.from({
|
|
147
|
+
length: num_placeholders_()
|
|
148
|
+
}).map(() => {
|
|
149
|
+
const template_result = product_card_template_(null, undefined);
|
|
150
|
+
// @ts-ignore
|
|
151
|
+
if (typeof template_result?.then !== "function") return template_result;
|
|
152
|
+
}));
|
|
153
|
+
$5vyXB$solidjs.createRenderEffect(() => {
|
|
154
|
+
const to_add = num_placeholders_() - existing_num;
|
|
155
|
+
if (to_add <= 0) return;
|
|
156
|
+
// 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.
|
|
157
|
+
// 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.
|
|
158
|
+
// 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.
|
|
159
|
+
set_elements(prev => [...prev, ...Array.from({
|
|
160
|
+
length: to_add
|
|
161
|
+
}).map(() => $0caf87eaa19079da$var$Placeholder({
|
|
162
|
+
product_card_template_: product_card_template_
|
|
163
|
+
}))]);
|
|
164
|
+
existing_num += to_add;
|
|
165
|
+
});
|
|
166
|
+
return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
|
|
170
|
+
*/
|
|
171
|
+
function $0caf87eaa19079da$var$Placeholder({
|
|
172
|
+
product_card_template_: product_card_template_
|
|
173
|
+
}) {
|
|
174
|
+
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;
|
|
175
|
+
if ($0caf87eaa19079da$var$cached_placeholder_element) return get_cloned_placeholders();
|
|
176
|
+
let dispose_original_copy;
|
|
177
|
+
const get_unwrapped_element = $5vyXB$solidjs.createRoot(dispose => {
|
|
178
|
+
dispose_original_copy = dispose;
|
|
179
|
+
// if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
|
|
180
|
+
const [resource] = $5vyXB$solidjs.createResource(() => {
|
|
181
|
+
if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) return $0caf87eaa19079da$var$rendering_cached_placeholder_element;
|
|
182
|
+
const return_value = product_card_template_(null, undefined);
|
|
183
|
+
if (typeof return_value === "object" && typeof return_value?.then === "function")
|
|
184
|
+
// Is Promise or promise-like object
|
|
185
|
+
$0caf87eaa19079da$var$rendering_cached_placeholder_element = return_value;
|
|
186
|
+
return return_value;
|
|
187
|
+
});
|
|
188
|
+
return $5vyXB$solidjs.createMemo(() => {
|
|
189
|
+
if (resource.loading) return () => [];
|
|
190
|
+
return $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(resource);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
$5vyXB$solidjs.onCleanup(() => {
|
|
194
|
+
if ($0caf87eaa19079da$var$rendering_cached_placeholder_element) {
|
|
195
|
+
// 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
|
|
196
|
+
const unset_current_rendering = () => {
|
|
197
|
+
dispose_original_copy();
|
|
198
|
+
$0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
|
|
199
|
+
};
|
|
200
|
+
$0caf87eaa19079da$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
|
|
201
|
+
} else
|
|
202
|
+
// Otherwise, just make sure we've disposed our root
|
|
203
|
+
dispose_original_copy();
|
|
204
|
+
});
|
|
205
|
+
return $5vyXB$solidjs.createMemo(() => {
|
|
206
|
+
const unwrapped_array = get_unwrapped_element()();
|
|
207
|
+
if (!unwrapped_array?.length || !unwrapped_array.every(item => item))
|
|
208
|
+
// Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
|
|
209
|
+
return;
|
|
210
|
+
// placeholders have finished rendering, freeze the elements
|
|
211
|
+
// 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
|
|
212
|
+
$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
|
|
213
|
+
$0caf87eaa19079da$var$rendering_cached_placeholder_element = undefined;
|
|
214
|
+
dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
|
|
215
|
+
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
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Gets product_id (the thing we key the rendering on) from a display
|
|
221
|
+
*/
|
|
222
|
+
function $a5871dacf261adf8$export$548d053aba053d79(display) {
|
|
223
|
+
if ("variant_index" in display) {
|
|
224
|
+
const actual_display = display.variant_displays[display.variant_index];
|
|
225
|
+
return actual_display.product_id;
|
|
226
|
+
}
|
|
227
|
+
return display.product_id;
|
|
228
|
+
}
|
|
229
|
+
function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
|
|
230
|
+
const displays_by_key_ = $5vyXB$solidjs.createMemo(() => {
|
|
231
|
+
const displays = get_displays_();
|
|
232
|
+
// We key by product_id because that's what can be used to uniquely identify products
|
|
233
|
+
// This way <For> can optimize the rendering
|
|
234
|
+
const map = new Map();
|
|
235
|
+
for (let i = 0; i < displays.length; i++) {
|
|
236
|
+
const display = displays[i];
|
|
237
|
+
const product_id = $a5871dacf261adf8$export$548d053aba053d79(display);
|
|
238
|
+
map.set(product_id, display);
|
|
239
|
+
}
|
|
240
|
+
return map;
|
|
241
|
+
});
|
|
242
|
+
return displays_by_key_;
|
|
243
|
+
}
|
|
244
|
+
function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
245
|
+
displays_by_key_: displays_by_key_,
|
|
246
|
+
merchant_: merchant_,
|
|
247
|
+
market_: market_,
|
|
248
|
+
product_card_template_: product_card_template_,
|
|
249
|
+
do_per_elements_: do_per_elements_
|
|
250
|
+
}) {
|
|
251
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.For), {
|
|
252
|
+
get each() {
|
|
253
|
+
return [...displays_by_key_().keys()];
|
|
254
|
+
},
|
|
255
|
+
children: (product_id, index) => {
|
|
256
|
+
const owner = $5vyXB$solidjs.getOwner();
|
|
257
|
+
const display_accessor = $5vyXB$solidjs.createMemo(() => displays_by_key_().get(product_id));
|
|
258
|
+
const [product_card_resource] = $5vyXB$solidjs.createResource(display_accessor,
|
|
259
|
+
// re-render when the reference to the display object changes
|
|
260
|
+
// this should only be the case when the merchant or market changes and the new request has completed
|
|
261
|
+
display => {
|
|
262
|
+
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
263
|
+
return product_card_template_(display, {
|
|
264
|
+
set_on_index_change: fn => $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.createEffect(() => fn(index()))),
|
|
265
|
+
merchant: $5vyXB$solidjs.untrack(merchant_),
|
|
266
|
+
// 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
|
|
267
|
+
market: $5vyXB$solidjs.untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
const node_accessor = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52(product_card_resource);
|
|
272
|
+
$5vyXB$solidjs.createEffect(() => {
|
|
273
|
+
const product_card_nodes = node_accessor();
|
|
274
|
+
const display = display_accessor();
|
|
275
|
+
const elements = [];
|
|
276
|
+
for (let i = 0; i < product_card_nodes.length; i++) {
|
|
277
|
+
const element = product_card_nodes[i];
|
|
278
|
+
if (!(element instanceof Element)) continue;
|
|
279
|
+
elements.push(element);
|
|
280
|
+
// Add tracking ids
|
|
281
|
+
if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
|
|
282
|
+
const {
|
|
283
|
+
dataset: dataset
|
|
284
|
+
} = element;
|
|
285
|
+
const {
|
|
286
|
+
search_result_id: search_result_id,
|
|
287
|
+
product_listing_result_id: product_listing_result_id,
|
|
288
|
+
recommendation_id: recommendation_id
|
|
289
|
+
} = display;
|
|
290
|
+
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;
|
|
291
|
+
}
|
|
292
|
+
do_per_elements_?.(elements, index);
|
|
293
|
+
});
|
|
294
|
+
return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
300
|
+
class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
|
|
301
|
+
class $7dd1edb2ee2b43ad$export$aa14a9f43128f61f extends $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 {
|
|
302
|
+
constructor(templateError) {
|
|
303
|
+
super("Uncaught error in product card template", {
|
|
304
|
+
cause: templateError
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const $edafe91daf3091d7$var$_tmpl$ = ["<div", ' class="', '">', "</div>"];
|
|
309
|
+
function $edafe91daf3091d7$export$b69d0d92862de18b(props) {
|
|
310
|
+
return $5vyXB$solidjs.ErrorBoundary({
|
|
311
|
+
fallback(err, retry) {
|
|
312
|
+
const {
|
|
313
|
+
message_: message_,
|
|
314
|
+
severity_: severity_
|
|
315
|
+
} = props;
|
|
316
|
+
let message = message_;
|
|
317
|
+
if (err instanceof (0, $7dd1edb2ee2b43ad$export$aa14a9f43128f61f)) {
|
|
318
|
+
console.error(err.cause);
|
|
319
|
+
message = `${message}: ${err.message}`;
|
|
320
|
+
} else $5vyXB$depictaiutilishared.report([err, message_], severity_);
|
|
321
|
+
props.on_error_?.(retry);
|
|
322
|
+
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));
|
|
323
|
+
},
|
|
324
|
+
get children() {
|
|
325
|
+
return props.children;
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
const $f48d0fbb00835aaa$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"],
|
|
330
|
+
$f48d0fbb00835aaa$var$_tmpl$2 = ["<div", ' class="', '">', "</div>"];
|
|
331
|
+
function $f48d0fbb00835aaa$export$d21e32dfedac04be(props) {
|
|
332
|
+
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
|
|
333
|
+
return $5vyXB$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
334
|
+
get message_() {
|
|
335
|
+
return "Failed calculating " + props.layout + " layout";
|
|
336
|
+
},
|
|
337
|
+
severity_: "error",
|
|
338
|
+
get children() {
|
|
339
|
+
return $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element_);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
|
|
344
|
+
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
345
|
+
const show_all_rows = $5vyXB$solidjs.createMemo(() => props.rows === "all");
|
|
346
|
+
const rows_or_empty_object = $5vyXB$solidjs.createMemo(() => show_all_rows() ? {} : props.rows);
|
|
347
|
+
const view_more_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($5vyXB$solidjs.createMemo(() => rows_or_empty_object().button));
|
|
348
|
+
const view_less_button_elements = $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52($5vyXB$solidjs.createMemo(() => rows_or_empty_object().view_less_button));
|
|
349
|
+
const have_a_view_more_button = $5vyXB$solidjs.createMemo(() => {
|
|
350
|
+
const button = view_more_button_elements();
|
|
351
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
352
|
+
});
|
|
353
|
+
const have_a_view_less_button = $5vyXB$solidjs.createMemo(() => {
|
|
354
|
+
const button = view_less_button_elements();
|
|
355
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
356
|
+
});
|
|
357
|
+
const [get_styling, set_styling] = $5vyXB$solidjs.createSignal();
|
|
358
|
+
const container_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
359
|
+
const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
|
|
360
|
+
const [get_children_count, set_children_count] = $5vyXB$solidjs.createSignal(0);
|
|
361
|
+
const update_children_count = () => set_children_count(container_element.children.length);
|
|
362
|
+
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));
|
|
363
|
+
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
|
|
364
|
+
const rows_visible_signal = $5vyXB$solidjs.createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
365
|
+
const get_rows_visible = $5vyXB$solidjs.createMemo(() => rows_visible_signal()[0]());
|
|
366
|
+
const set_rows_visible = $5vyXB$solidjs.createMemo(() => rows_visible_signal()[1]);
|
|
367
|
+
const view_more_button_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
368
|
+
const view_less_button_class = $5vyXB$depictaiutilishared.make_random_classname();
|
|
369
|
+
const style_element = $5vyXB$solidjsweb.ssr($f48d0fbb00835aaa$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), get_styling);
|
|
370
|
+
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)));
|
|
371
|
+
// 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
|
|
372
|
+
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)));
|
|
373
|
+
container_element.classList.add(container_class);
|
|
374
|
+
$5vyXB$solidjs.createComputed(() => {
|
|
375
|
+
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
376
|
+
const rows_visible = get_rows_visible();
|
|
377
|
+
const max_rows = rows_or_empty_object().max_rows;
|
|
378
|
+
if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
|
|
379
|
+
});
|
|
380
|
+
$5vyXB$solidjs.createRenderEffect(() => {
|
|
381
|
+
// Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
|
|
382
|
+
if (show_all_rows()) {
|
|
383
|
+
// no view more functionality requested
|
|
384
|
+
set_styling(() => col_styling);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
update_children_count();
|
|
388
|
+
const mutation_observer = new MutationObserver($5vyXB$depictaiutilishared.catchify(update_children_count));
|
|
389
|
+
mutation_observer.observe(container_element, {
|
|
390
|
+
childList: true
|
|
391
|
+
});
|
|
392
|
+
$5vyXB$solidjs.onCleanup(() => mutation_observer.disconnect());
|
|
393
|
+
set_styling(
|
|
394
|
+
// this is needed because solid will think that the memo-accessor is a setter function otherwise
|
|
395
|
+
() => $5vyXB$solidjs.createMemo(() => {
|
|
396
|
+
const {
|
|
397
|
+
rows_per_click: rows_per_click,
|
|
398
|
+
max_rows = -1,
|
|
399
|
+
start_rows: start_rows
|
|
400
|
+
} = rows_or_empty_object();
|
|
401
|
+
const rows_visible = get_rows_visible();
|
|
402
|
+
const children_count = get_children_count();
|
|
403
|
+
return col_styling() + props.cols_at_size.map(options => {
|
|
404
|
+
const [recs_per_row, min, max] = options;
|
|
405
|
+
let should_hide_view_more_button;
|
|
406
|
+
let visible_recs;
|
|
407
|
+
if (props.disable_partial_rows) {
|
|
408
|
+
visible_recs = $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible, children_count, options);
|
|
409
|
+
const visible_recs_next_show_more = $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows(rows_visible + (rows_per_click || 0),
|
|
410
|
+
// Should this really be zero when we default rows_per_click to 1?
|
|
411
|
+
children_count, options);
|
|
412
|
+
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
413
|
+
} else {
|
|
414
|
+
visible_recs = $5vyXB$depictaiutilishared.layout_get_total_rec_amount_for_row(rows_visible, options);
|
|
415
|
+
should_hide_view_more_button = visible_recs >= children_count;
|
|
416
|
+
}
|
|
417
|
+
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
418
|
+
// 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
|
|
419
|
+
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;
|
|
420
|
+
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}` : ``}}`;
|
|
421
|
+
}).join("");
|
|
422
|
+
}));
|
|
423
|
+
});
|
|
424
|
+
if (insert_after_container) container_element.after(style_element);
|
|
425
|
+
return [container_element, view_more_button_container(), view_less_button_container(), style_element];
|
|
426
|
+
}
|
|
427
|
+
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>'];
|
|
428
|
+
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
429
|
+
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));
|
|
430
|
+
}
|
|
431
|
+
const $a0e53f99354809d9$var$_tmpl$ = ["<div", ">", "</div>"];
|
|
432
|
+
function $a0e53f99354809d9$export$6649caad96ef8870({
|
|
433
|
+
children: children,
|
|
434
|
+
slider_ref_: slider_ref_,
|
|
435
|
+
faded_opacity_ = 0.7,
|
|
436
|
+
mutation_plugins_ = []
|
|
437
|
+
}) {
|
|
438
|
+
const slider = new (0, $5vyXB$depictaiutilishared.Amazing_Slider)({
|
|
439
|
+
button_contents: {
|
|
440
|
+
left: [$5vyXB$solidjsweb.ssr($a0e53f99354809d9$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {})))],
|
|
441
|
+
right: [$5vyXB$solidjsweb.ssr($a0e53f99354809d9$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $0f313083912e447a$export$8be2714ec7f169ee), {})))]
|
|
442
|
+
},
|
|
443
|
+
constructor_plugins: [$5vyXB$depictaiutilishared.slider_snap_css().constructor_plugin],
|
|
444
|
+
mutation_plugins: [$5vyXB$depictaiutilishared.slider_fading_factory({
|
|
445
|
+
threshold_: 0.96,
|
|
446
|
+
faded_opacity_: faded_opacity_
|
|
447
|
+
}).mutation_plugin_, ...mutation_plugins_]
|
|
448
|
+
});
|
|
449
|
+
$5vyXB$solidjsweb.insert(slider.insert_here, children);
|
|
450
|
+
$5vyXB$solidjs.onCleanup(() => slider.observer.disconnect());
|
|
451
|
+
slider_ref_?.(slider);
|
|
452
|
+
return slider.container;
|
|
453
|
+
}
|
|
454
|
+
function $363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
455
|
+
recommendations_resource_: recommendations_resource_,
|
|
456
|
+
product_card_template_: product_card_template_,
|
|
457
|
+
layout_options_: layout_options_,
|
|
458
|
+
merchant_: merchant_,
|
|
459
|
+
market_: market_
|
|
460
|
+
}) {
|
|
461
|
+
const is_showing_something = $5vyXB$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
462
|
+
const num_placeholders_ = () => 20;
|
|
463
|
+
const slider = $5vyXB$solidjsweb.createComponent((0, $a0e53f99354809d9$export$6649caad96ef8870), {
|
|
464
|
+
slider_ref_: slider => {
|
|
465
|
+
const Layout = props => $f48d0fbb00835aaa$export$445d8d3f5f706a40(props, slider.insert_here, true);
|
|
466
|
+
// Do like this, so we don't have to call mergeProps ourselves
|
|
467
|
+
$5vyXB$solidjsweb.createComponent(Layout, $5vyXB$solidjsweb.mergeProps({
|
|
468
|
+
rows: "all",
|
|
469
|
+
layout: "slider"
|
|
470
|
+
}, layout_options_));
|
|
471
|
+
slider.insert_here.before($fc23d7668ae0011d$export$a2cc176055f8f08());
|
|
472
|
+
},
|
|
473
|
+
get children() {
|
|
474
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
|
|
475
|
+
get fallback() {
|
|
476
|
+
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
477
|
+
num_placeholders_: num_placeholders_,
|
|
478
|
+
product_card_template_: product_card_template_
|
|
479
|
+
});
|
|
480
|
+
},
|
|
481
|
+
get children() {
|
|
482
|
+
return (() => {
|
|
483
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
484
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
485
|
+
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
486
|
+
displays_by_key_: displays_by_key_,
|
|
487
|
+
merchant_: merchant_,
|
|
488
|
+
market_: market_,
|
|
489
|
+
product_card_template_: product_card_template_
|
|
490
|
+
});
|
|
491
|
+
})();
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
497
|
+
get when() {
|
|
498
|
+
return is_showing_something();
|
|
499
|
+
},
|
|
500
|
+
children: slider
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
const $72f96c4782db0b1b$var$_tmpl$ = ["<div", ' class="depict plp">', "</div>"];
|
|
504
|
+
function $72f96c4782db0b1b$export$9574e176201e5e8d(props) {
|
|
505
|
+
const grid_spacing_override = $5vyXB$solidjs.createMemo(() => {
|
|
506
|
+
const {
|
|
507
|
+
grid_spacing: grid_spacing
|
|
508
|
+
} = props; // can be reactive
|
|
509
|
+
return typeof grid_spacing === "string" ? {
|
|
510
|
+
grid_spacing: grid_spacing
|
|
511
|
+
} : {
|
|
512
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
513
|
+
grid_spacing: grid_spacing.horizontal
|
|
514
|
+
};
|
|
515
|
+
});
|
|
516
|
+
const [recommendations_resource_] = $5vyXB$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
517
|
+
return $5vyXB$solidjsweb.ssr($72f96c4782db0b1b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($363ce4d1d71041aa$export$d41d19e89346fa2({
|
|
518
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
519
|
+
recommendations_resource_: recommendations_resource_,
|
|
520
|
+
market_: () => props.market,
|
|
521
|
+
merchant_: () => props.merchant,
|
|
522
|
+
layout_options_: $5vyXB$solidjs.createMemo(() => ({
|
|
523
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
|
|
524
|
+
...grid_spacing_override()
|
|
525
|
+
}))
|
|
526
|
+
})));
|
|
527
|
+
}
|
|
528
|
+
const $b8e79813f4f7ebe4$var$_tmpl$ = ["<div", ' class="recommendation-grid"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
|
|
529
|
+
function $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
530
|
+
recommendations_resource_: recommendations_resource_,
|
|
531
|
+
product_card_template_: product_card_template_,
|
|
532
|
+
layout_options_: layout_options_,
|
|
533
|
+
merchant_: merchant_,
|
|
534
|
+
market_: market_,
|
|
535
|
+
rows_object_: rows_object_
|
|
536
|
+
}) {
|
|
537
|
+
const is_showing_something = $5vyXB$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
538
|
+
const num_placeholders_ = () => 20;
|
|
539
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
540
|
+
get when() {
|
|
541
|
+
return is_showing_something();
|
|
542
|
+
},
|
|
543
|
+
get children() {
|
|
544
|
+
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({
|
|
545
|
+
get rows() {
|
|
546
|
+
return rows_object_();
|
|
547
|
+
},
|
|
548
|
+
layout: "grid",
|
|
549
|
+
element_attributes: {
|
|
550
|
+
class: "cards"
|
|
551
|
+
}
|
|
552
|
+
}, layout_options_, {
|
|
553
|
+
get children() {
|
|
554
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
|
|
555
|
+
get fallback() {
|
|
556
|
+
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
557
|
+
num_placeholders_: num_placeholders_,
|
|
558
|
+
product_card_template_: product_card_template_
|
|
559
|
+
});
|
|
560
|
+
},
|
|
561
|
+
get children() {
|
|
562
|
+
return (() => {
|
|
563
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
564
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
565
|
+
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
566
|
+
displays_by_key_: displays_by_key_,
|
|
567
|
+
merchant_: merchant_,
|
|
568
|
+
market_: market_,
|
|
569
|
+
product_card_template_: product_card_template_
|
|
570
|
+
});
|
|
571
|
+
})();
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}))));
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
const $1f8dbf7e28b3eff2$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
|
|
580
|
+
$1f8dbf7e28b3eff2$var$_tmpl$2 = ["<div", ' class="depict plp">', "</div>"];
|
|
581
|
+
function $1f8dbf7e28b3eff2$export$9756467d34d91cdb(props) {
|
|
582
|
+
const rows_object_ = $5vyXB$solidjs.createMemo(() => {
|
|
583
|
+
const view_more_button = props.view_more_button;
|
|
584
|
+
if (!view_more_button) return "all";
|
|
585
|
+
return {
|
|
586
|
+
start_rows: view_more_button.start_rows,
|
|
587
|
+
rows_per_click: view_more_button.rows_per_click,
|
|
588
|
+
button: $5vyXB$solidjsweb.ssr($1f8dbf7e28b3eff2$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(view_more_button.text))
|
|
589
|
+
};
|
|
590
|
+
});
|
|
591
|
+
const grid_spacing_override = $5vyXB$solidjs.createMemo(() => {
|
|
592
|
+
const {
|
|
593
|
+
grid_spacing: grid_spacing
|
|
594
|
+
} = props; // can be reactive
|
|
595
|
+
return typeof grid_spacing === "string" ? {
|
|
596
|
+
grid_spacing: grid_spacing
|
|
597
|
+
} : {
|
|
598
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
599
|
+
grid_spacing: grid_spacing.horizontal
|
|
600
|
+
};
|
|
601
|
+
});
|
|
602
|
+
const [recommendations_resource_] = $5vyXB$solidjs.createResource(() => props.recommendations, recs => recs);
|
|
603
|
+
return $5vyXB$solidjsweb.ssr($1f8dbf7e28b3eff2$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
604
|
+
rows_object_: rows_object_,
|
|
605
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
606
|
+
recommendations_resource_: recommendations_resource_,
|
|
607
|
+
market_: () => props.market,
|
|
608
|
+
merchant_: () => props.merchant,
|
|
609
|
+
layout_options_: $5vyXB$solidjs.createMemo(() => ({
|
|
610
|
+
cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77($ab7c6c7911bae2f5$export$ff7109b9b2b206ba(props.cols_at_size)),
|
|
611
|
+
...grid_spacing_override()
|
|
612
|
+
}))
|
|
613
|
+
})));
|
|
614
|
+
}
|
|
62
615
|
function $19950faaac026e09$export$e6fffe67d4cdd848(whatToWatch) {
|
|
63
616
|
const [size, setSize] = $5vyXB$solidjs.createSignal(0);
|
|
64
617
|
const resizeObserver = new ResizeObserver($5vyXB$depictaiutilishared.catchify(records => {
|
|
@@ -103,37 +656,6 @@ const $93304d59a9747aa6$var$_tmpl$ = ["<div", ' style="', '"></div>'];
|
|
|
103
656
|
function $93304d59a9747aa6$export$94026ee33dbabc26(props) {
|
|
104
657
|
return $5vyXB$solidjsweb.ssr($93304d59a9747aa6$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrStyle(`position:relative;width:100%;padding-bottom:${1 / props.aspectRatio * 100}%`));
|
|
105
658
|
}
|
|
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
659
|
function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
|
|
138
660
|
const {
|
|
139
661
|
collapse: collapse,
|
|
@@ -252,33 +774,6 @@ function $d659702496cb72ea$export$a71e92cfbb498adc(props) {
|
|
|
252
774
|
return $5vyXB$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
253
775
|
});
|
|
254
776
|
}
|
|
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
777
|
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
778
|
function $c77c68e559a1506c$export$3b621d86b1566b2(props = {}) {
|
|
284
779
|
return $5vyXB$solidjsweb.ssrElement("svg", () => ({
|
|
@@ -1893,143 +2388,35 @@ function $70482f04605572e2$var$modify_only_local_filter(local_filter_object, sel
|
|
|
1893
2388
|
};
|
|
1894
2389
|
if (old_meta) {
|
|
1895
2390
|
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;
|
|
2391
|
+
...old_meta
|
|
2392
|
+
};
|
|
2393
|
+
modified_filter_object.meta = new_meta;
|
|
2394
|
+
// set counts to 0
|
|
2395
|
+
if ("counts" in new_meta) {
|
|
2396
|
+
const counts = new_meta.counts;
|
|
2397
|
+
if (counts) new_meta.counts = counts.map(() => 0);
|
|
2398
|
+
}
|
|
2399
|
+
if (Array.isArray(selected_filter_data) && "values" in new_meta) {
|
|
2400
|
+
// we have an array of values and want to strip the ones from the available ones that aren't selected
|
|
2401
|
+
const values = new_meta.values;
|
|
2402
|
+
if (Array.isArray(values)) {
|
|
2403
|
+
const jsond_set_values = selected_filter_data.map(data => JSON.stringify(data));
|
|
2404
|
+
const indexes_to_remove = new Set();
|
|
2405
|
+
for (let i = 0; i < values.length; i++) {
|
|
2406
|
+
const value = values[i];
|
|
2407
|
+
if (!jsond_set_values.includes(JSON.stringify(value)))
|
|
2408
|
+
// We want to remove the entry with this value from the filter object because it's not selected
|
|
2409
|
+
indexes_to_remove.add(i);
|
|
2024
2410
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2411
|
+
new_meta.values = values.filter((_, index) => !indexes_to_remove.has(index));
|
|
2412
|
+
if (new_meta.names) new_meta.names = new_meta.names.filter((_, index) => !indexes_to_remove.has(index));
|
|
2413
|
+
if (new_meta.counts)
|
|
2414
|
+
// remove counts that are too much, they're all zero anyway if they exist
|
|
2415
|
+
new_meta.counts.length -= indexes_to_remove.size;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
return modified_filter_object;
|
|
2033
2420
|
}
|
|
2034
2421
|
async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
2035
2422
|
const body = await (0, $5vyXB$depictaiutilishared.observer).wait_for_element("body");
|
|
@@ -2688,92 +3075,6 @@ function $0d0b172488865048$export$ef6006467f04ee41({
|
|
|
2688
3075
|
}
|
|
2689
3076
|
})))];
|
|
2690
3077
|
}
|
|
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
3078
|
|
|
2778
3079
|
/*
|
|
2779
3080
|
* 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 +3180,6 @@ function $4117463e2939f5f4$export$63dd0350f8559dda({
|
|
|
2879
3180
|
equals: false
|
|
2880
3181
|
});
|
|
2881
3182
|
}
|
|
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
3183
|
function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
2963
3184
|
plp_results_: plp_results_,
|
|
2964
3185
|
product_card_template_: product_card_template_,
|
|
@@ -4840,41 +5061,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
4840
5061
|
}
|
|
4841
5062
|
})))];
|
|
4842
5063
|
}
|
|
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
5064
|
function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
|
|
4879
5065
|
const component_in_error_boundary = do_with_elements => {
|
|
4880
5066
|
const error_boundary_wrapped = $edafe91daf3091d7$export$b69d0d92862de18b({
|
|
@@ -5173,7 +5359,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
5173
5359
|
#meta_title_suffix_ = $5vyXB$solidjs.createSignal();
|
|
5174
5360
|
#disable_override_query_id = $5vyXB$solidjs.createSignal();
|
|
5175
5361
|
#listing_type_signal = $5vyXB$solidjs.createSignal();
|
|
5176
|
-
static #keys_constructed_with = new Set();
|
|
5362
|
+
static #keys_constructed_with = /*@__PURE__*/new Set();
|
|
5177
5363
|
get localization() {
|
|
5178
5364
|
// allow reactive access
|
|
5179
5365
|
return this.#locale_signal[0]();
|
|
@@ -7791,27 +7977,6 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
|
|
|
7791
7977
|
cleanup: cleanup
|
|
7792
7978
|
};
|
|
7793
7979
|
}
|
|
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
7980
|
const $2c61e4cd8229c49a$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
|
|
7816
7981
|
// 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
7982
|
/**
|
|
@@ -7830,7 +7995,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
7830
7995
|
#market_signal = $5vyXB$solidjs.createSignal();
|
|
7831
7996
|
#modal_open_signal = $5vyXB$solidjs.createSignal(false);
|
|
7832
7997
|
#content_search_signal = $5vyXB$solidjs.createSignal();
|
|
7833
|
-
static #keys_constructed_with = new Set();
|
|
7998
|
+
static #keys_constructed_with = /*@__PURE__*/new Set();
|
|
7834
7999
|
#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
|
|
7835
8000
|
constructor({
|
|
7836
8001
|
unique_instance_key_for_state = "",
|
|
@@ -8344,7 +8509,7 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8344
8509
|
#revert_fns = [];
|
|
8345
8510
|
#is_open = false;
|
|
8346
8511
|
static #reverting_permitted = true;
|
|
8347
|
-
static #visited_urls = (() => {
|
|
8512
|
+
static #visited_urls = /*@__PURE__*/(() => {
|
|
8348
8513
|
// 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
8514
|
$5vyXB$depictaiutilishared.catchify(async () => {
|
|
8350
8515
|
// Static initialization blocks aren't supported in MobileSafari yet, otherwise this would be one.
|
|
@@ -8385,14 +8550,14 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8385
8550
|
return $5vyXB$depictaiutilishared.catchify(this.render_, "rendering failed")() || [];
|
|
8386
8551
|
});
|
|
8387
8552
|
}
|
|
8388
|
-
#unload =
|
|
8553
|
+
#unload = /*@__PURE__*/$5vyXB$depictaiutilishared.catchify(() => {
|
|
8389
8554
|
if (!this.#is_open) return;
|
|
8390
8555
|
this.#disconnect_observer?.();
|
|
8391
8556
|
if ($0a6acf31d1eae57c$export$3ccaa27d81dd8556.#reverting_permitted) while (this.#revert_fns.length) this.#revert_fns.pop()?.();
|
|
8392
8557
|
this.#is_open = false;
|
|
8393
8558
|
this.dispatchEvent(new CustomEvent("close"));
|
|
8394
8559
|
}, "failed to close page");
|
|
8395
|
-
#load =
|
|
8560
|
+
#load = /*@__PURE__*/$5vyXB$depictaiutilishared.catchify(async els => {
|
|
8396
8561
|
this.#is_open = true;
|
|
8397
8562
|
// So that #load doesn't get called again
|
|
8398
8563
|
let set_should_stay_inserted;
|