@depict-ai/ui 1.4.25 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +240 -170
- package/ES10/index.d.ts +28 -31
- package/ES10/index.js +242 -172
- package/README.md +2 -1
- package/latest/index.cjs +229 -166
- package/latest/index.d.ts +28 -31
- package/latest/index.js +231 -168
- package/locales/require.js +1152 -0
- package/package.json +7 -7
- package/server/ES10/index.cjs +199 -139
- package/server/ES10/index.d.ts +28 -31
- package/server/ES10/index.js +201 -141
- package/server/latest/index.cjs +189 -131
- package/server/latest/index.d.ts +28 -31
- package/server/latest/index.js +191 -133
package/server/latest/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { add_to_version_info as $i7OB2$add_to_version_info, slider_fractional_factory as $i7OB2$slider_fractional_factory, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, catchify as $i7OB2$catchify, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, report as $i7OB2$report, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory,
|
|
1
|
+
import { add_to_version_info as $i7OB2$add_to_version_info, slider_fractional_factory as $i7OB2$slider_fractional_factory, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, catchify as $i7OB2$catchify, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, report as $i7OB2$report, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, observer as $i7OB2$observer, is_safari as $i7OB2$is_safari, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, dlog as $i7OB2$dlog, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, javascript_media_query as $i7OB2$javascript_media_query, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, dwarn as $i7OB2$dwarn, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, use_href_accessor as $i7OB2$use_href_accessor, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, ListenableSet as $i7OB2$ListenableSet, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
2
|
import { ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, escape as $i7OB2$escape, createComponent as $i7OB2$createComponent, mergeProps as $i7OB2$mergeProps, isServer as $i7OB2$isServer, ssrElement as $i7OB2$ssrElement, ssrClassList as $i7OB2$ssrClassList, insert as $i7OB2$insert, ssrAttribute as $i7OB2$ssrAttribute, ssrStyle as $i7OB2$ssrStyle, Dynamic as $i7OB2$Dynamic } from "solid-js/web";
|
|
3
|
-
import { createMemo as $i7OB2$createMemo, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, Show as $i7OB2$Show, createSignal as $i7OB2$createSignal, createRenderEffect as $i7OB2$createRenderEffect, createRoot as $i7OB2$createRoot, onCleanup as $i7OB2$onCleanup, For as $i7OB2$For, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, createEffect as $i7OB2$createEffect, untrack as $i7OB2$untrack, createComputed as $i7OB2$createComputed, ErrorBoundary as $i7OB2$ErrorBoundary, Index as $i7OB2$Index, on as $i7OB2$on, batch as $i7OB2$batch, createReaction as $i7OB2$createReaction } from "solid-js";
|
|
3
|
+
import { createMemo as $i7OB2$createMemo, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, Show as $i7OB2$Show, createSignal as $i7OB2$createSignal, createRenderEffect as $i7OB2$createRenderEffect, createRoot as $i7OB2$createRoot, onCleanup as $i7OB2$onCleanup, For as $i7OB2$For, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, createEffect as $i7OB2$createEffect, untrack as $i7OB2$untrack, createUniqueId as $i7OB2$createUniqueId, createComputed as $i7OB2$createComputed, ErrorBoundary as $i7OB2$ErrorBoundary, Index as $i7OB2$Index, on as $i7OB2$on, batch as $i7OB2$batch, createReaction as $i7OB2$createReaction } from "solid-js";
|
|
4
4
|
|
|
5
5
|
/*! Depict.ai search and product listing SDK */
|
|
6
6
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
7
7
|
register_es_version("ui", "latest");
|
|
8
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "
|
|
8
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.1";
|
|
9
9
|
const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
|
|
10
10
|
const cols_at_size = [];
|
|
11
11
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -64,7 +64,9 @@ function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_f
|
|
|
64
64
|
}
|
|
65
65
|
function $a458486f22b22f63$export$a2cc176055f8f08() {
|
|
66
66
|
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.";
|
|
67
|
-
return (0, $i7OB2$isServer) ?
|
|
67
|
+
return (0, $i7OB2$isServer) ? {
|
|
68
|
+
t: `<!-- ${text} -->`
|
|
69
|
+
} : document.createComment(text);
|
|
68
70
|
}
|
|
69
71
|
function $a52235d12ccf9c88$export$2f0cbfbb4354bb52(elements) {
|
|
70
72
|
// FYI this probably doesn't work on hugely deep nestings or large amount of elements
|
|
@@ -271,21 +273,32 @@ function $b7436a6d1fd64e3b$export$b69d0d92862de18b(props) {
|
|
|
271
273
|
}
|
|
272
274
|
});
|
|
273
275
|
}
|
|
274
|
-
const $c8d5ff4524619fcd$var$_tmpl$ = ["<
|
|
275
|
-
$c8d5ff4524619fcd$var$_tmpl$2 = ["<
|
|
276
|
+
const $c8d5ff4524619fcd$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
|
|
277
|
+
$c8d5ff4524619fcd$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
|
|
276
278
|
function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
|
|
277
|
-
const
|
|
279
|
+
const container_class = "x" + $i7OB2$createUniqueId();
|
|
280
|
+
const container_element_ = $i7OB2$ssrElement("div", () => ({
|
|
281
|
+
...props.element_attributes,
|
|
282
|
+
"classList": {
|
|
283
|
+
[container_class]: true
|
|
284
|
+
}
|
|
285
|
+
}), () => $i7OB2$escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
|
|
278
286
|
return $i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
279
287
|
get message_() {
|
|
280
288
|
return "Failed calculating " + props.layout + " layout";
|
|
281
289
|
},
|
|
282
290
|
severity_: "error",
|
|
283
291
|
get children() {
|
|
284
|
-
return $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element_);
|
|
292
|
+
return $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element_, false, container_class);
|
|
285
293
|
}
|
|
286
294
|
});
|
|
287
295
|
}
|
|
288
|
-
function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, insert_after_container = false) {
|
|
296
|
+
function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, insert_after_container = false, container_class) {
|
|
297
|
+
if (!container_class) {
|
|
298
|
+
// only try to add if it wasn't provided, so that we have a code path without classList when doing SSR
|
|
299
|
+
container_class = $i7OB2$make_random_classname();
|
|
300
|
+
container_element.classList.add(container_class);
|
|
301
|
+
}
|
|
289
302
|
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
290
303
|
const show_all_rows = $i7OB2$createMemo(() => props.rows === "all");
|
|
291
304
|
const rows_or_empty_object = $i7OB2$createMemo(() => show_all_rows() ? {} : props.rows);
|
|
@@ -300,28 +313,27 @@ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
300
313
|
return !(!button || Array.isArray(button) && !button.length);
|
|
301
314
|
});
|
|
302
315
|
const [get_styling, set_styling] = $i7OB2$createSignal();
|
|
303
|
-
const container_class = $i7OB2$make_random_classname();
|
|
304
316
|
const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
|
|
305
317
|
const [get_children_count, set_children_count] = $i7OB2$createSignal(0);
|
|
306
|
-
const update_children_count = () => set_children_count(container_element.children.length);
|
|
318
|
+
const update_children_count = () => (0, $i7OB2$isServer) ? 20 : set_children_count(container_element.children.length);
|
|
307
319
|
const col_styling = $i7OB2$createMemo(() => $i7OB2$n_col_styling_with_dist(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
308
320
|
const default_currently_visible_signal = $i7OB2$createSignal($i7OB2$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
|
|
309
321
|
const rows_visible_signal = $i7OB2$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
310
322
|
const get_rows_visible = $i7OB2$createMemo(() => rows_visible_signal()[0]());
|
|
311
323
|
const set_rows_visible = $i7OB2$createMemo(() => rows_visible_signal()[1]);
|
|
312
|
-
const view_more_button_class = $i7OB2$
|
|
313
|
-
const view_less_button_class = $i7OB2$
|
|
314
|
-
const
|
|
315
|
-
const view_more_button_container = $i7OB2$createMemo(() => have_a_view_more_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `load-more-container ${$i7OB2$escape(view_more_button_class, true)}`, $i7OB2$escape(rows_or_empty_object().button)));
|
|
324
|
+
const view_more_button_class = "m" + $i7OB2$createUniqueId();
|
|
325
|
+
const view_less_button_class = "l" + $i7OB2$createUniqueId(); // https://github.com/solidjs/solid-docs/issues/263#issuecomment-1622388079
|
|
326
|
+
const view_more_button_container = $i7OB2$createMemo(() => have_a_view_more_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$, $i7OB2$ssrHydrationKey(), `load-more-container ${$i7OB2$escape(view_more_button_class, true)}`, $i7OB2$escape(rows_or_empty_object().button)));
|
|
316
327
|
// 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
|
|
317
|
-
const view_less_button_container = $i7OB2$createMemo(() => have_a_view_less_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl
|
|
318
|
-
|
|
328
|
+
const view_less_button_container = $i7OB2$createMemo(() => have_a_view_less_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$, $i7OB2$ssrHydrationKey(), `load-less-container ${$i7OB2$escape(view_less_button_class, true)}`, $i7OB2$escape(rows_or_empty_object().view_less_button)));
|
|
329
|
+
const [force_style_update, set_force_style_update] = $i7OB2$createSignal("");
|
|
319
330
|
$i7OB2$createComputed(() => {
|
|
320
331
|
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
321
332
|
const rows_visible = get_rows_visible();
|
|
322
333
|
const max_rows = rows_or_empty_object().max_rows;
|
|
323
334
|
if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
|
|
324
335
|
});
|
|
336
|
+
$i7OB2$createEffect(() => set_force_style_update(" ")); // force style update after hydration due to https://discord.com/channels/722131463138705510/722167424186843267/1151544212517552168
|
|
325
337
|
$i7OB2$createRenderEffect(() => {
|
|
326
338
|
// Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
|
|
327
339
|
if (show_all_rows()) {
|
|
@@ -330,11 +342,13 @@ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
330
342
|
return;
|
|
331
343
|
}
|
|
332
344
|
update_children_count();
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
345
|
+
if (!(0, $i7OB2$isServer)) {
|
|
346
|
+
const mutation_observer = new MutationObserver($i7OB2$catchify(update_children_count));
|
|
347
|
+
mutation_observer.observe(container_element, {
|
|
348
|
+
childList: true
|
|
349
|
+
});
|
|
350
|
+
$i7OB2$onCleanup(() => mutation_observer.disconnect());
|
|
351
|
+
}
|
|
338
352
|
set_styling(
|
|
339
353
|
// this is needed because solid will think that the memo-accessor is a setter function otherwise
|
|
340
354
|
() => $i7OB2$createMemo(() => {
|
|
@@ -345,7 +359,7 @@ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
345
359
|
} = rows_or_empty_object();
|
|
346
360
|
const rows_visible = get_rows_visible();
|
|
347
361
|
const children_count = get_children_count();
|
|
348
|
-
return col_styling() + props.cols_at_size.map(options => {
|
|
362
|
+
return force_style_update() + col_styling() + props.cols_at_size.map(options => {
|
|
349
363
|
const [recs_per_row, min, max] = options;
|
|
350
364
|
let should_hide_view_more_button;
|
|
351
365
|
let visible_recs;
|
|
@@ -366,6 +380,7 @@ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, ins
|
|
|
366
380
|
}).join("");
|
|
367
381
|
}));
|
|
368
382
|
});
|
|
383
|
+
const style_element = $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$2, $i7OB2$ssrHydrationKey(), get_styling); // need to create this after set_styling has been called or else there will be no styling in the SSR'd output
|
|
369
384
|
if (insert_after_container) container_element.after(style_element);
|
|
370
385
|
return [container_element, view_more_button_container(), view_less_button_container(), style_element];
|
|
371
386
|
}
|
|
@@ -379,12 +394,20 @@ function $f32e14878e75af51$export$6649caad96ef8870({
|
|
|
379
394
|
slider_ref_: slider_ref_,
|
|
380
395
|
faded_opacity_ = 0.7,
|
|
381
396
|
mutation_plugins_ = [],
|
|
382
|
-
disable_fading_: disable_fading_
|
|
397
|
+
disable_fading_: disable_fading_,
|
|
398
|
+
arrow_width_: arrow_width_,
|
|
399
|
+
arrow_height_: arrow_height_
|
|
383
400
|
}) {
|
|
384
401
|
const slider = new (0, $i7OB2$Amazing_Slider)({
|
|
385
402
|
button_contents: {
|
|
386
|
-
left: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {
|
|
387
|
-
|
|
403
|
+
left: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {
|
|
404
|
+
height_: arrow_height_,
|
|
405
|
+
width_: arrow_width_
|
|
406
|
+
})))],
|
|
407
|
+
right: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {
|
|
408
|
+
height_: arrow_height_,
|
|
409
|
+
width_: arrow_width_
|
|
410
|
+
})))]
|
|
388
411
|
},
|
|
389
412
|
constructor_plugins: [$i7OB2$slider_snap_css().constructor_plugin],
|
|
390
413
|
mutation_plugins: [...(disable_fading_ ? [] : [$i7OB2$slider_fading_factory({
|
|
@@ -407,6 +430,8 @@ function $c4492d24952ed731$export$d41d19e89346fa2({
|
|
|
407
430
|
const is_showing_something = $i7OB2$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
408
431
|
const num_placeholders_ = () => 20;
|
|
409
432
|
const slider = $i7OB2$createComponent((0, $f32e14878e75af51$export$6649caad96ef8870), {
|
|
433
|
+
arrow_height_: 25,
|
|
434
|
+
arrow_width_: 12.5,
|
|
410
435
|
disable_fading_: true,
|
|
411
436
|
slider_ref_: slider => {
|
|
412
437
|
const {
|
|
@@ -451,30 +476,62 @@ function $c4492d24952ed731$export$d41d19e89346fa2({
|
|
|
451
476
|
children: slider
|
|
452
477
|
});
|
|
453
478
|
}
|
|
479
|
+
function $16b52438165aafe2$export$23fca46f3143581f(component, error_message) {
|
|
480
|
+
const component_in_error_boundary = do_with_elements => {
|
|
481
|
+
const error_boundary_wrapped = $b7436a6d1fd64e3b$export$b69d0d92862de18b({
|
|
482
|
+
severity_: "error",
|
|
483
|
+
message_: error_message,
|
|
484
|
+
get children() {
|
|
485
|
+
const elements = component();
|
|
486
|
+
do_with_elements?.(elements);
|
|
487
|
+
return elements;
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
// This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
|
|
491
|
+
if (typeof error_boundary_wrapped === "function")
|
|
492
|
+
// @ts-ignore
|
|
493
|
+
return error_boundary_wrapped();
|
|
494
|
+
// On the server it returns a string, so we just return that
|
|
495
|
+
return error_boundary_wrapped;
|
|
496
|
+
};
|
|
497
|
+
const owner = $i7OB2$getOwner();
|
|
498
|
+
if (owner == null) return $i7OB2$createRoot(dispose => {
|
|
499
|
+
// if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
|
|
500
|
+
return component_in_error_boundary(elements => {
|
|
501
|
+
const have_multiple = Array.isArray(elements);
|
|
502
|
+
if (have_multiple ? !elements?.length : !elements) return;
|
|
503
|
+
(0, $i7OB2$observer).onremoved(have_multiple ? elements[0] : elements, dispose);
|
|
504
|
+
});
|
|
505
|
+
});else
|
|
506
|
+
// we're already in a root so cleanups are handled
|
|
507
|
+
return component_in_error_boundary();
|
|
508
|
+
}
|
|
454
509
|
const $ee116da074deb002$var$_tmpl$ = ["<div", ' class="depict recommendations">', "</div>"];
|
|
455
510
|
function $ee116da074deb002$export$9574e176201e5e8d(props) {
|
|
456
|
-
|
|
457
|
-
const {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
grid_spacing
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
511
|
+
return $16b52438165aafe2$export$23fca46f3143581f(() => {
|
|
512
|
+
const grid_spacing_override = $i7OB2$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_] = $i7OB2$createResource(() => props.recommendations, recs => recs);
|
|
524
|
+
return $i7OB2$ssr($ee116da074deb002$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($c4492d24952ed731$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_: $i7OB2$createMemo(() => ({
|
|
530
|
+
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
|
|
531
|
+
...grid_spacing_override()
|
|
532
|
+
}))
|
|
533
|
+
})));
|
|
534
|
+
}, "RecommendationSlider failed");
|
|
478
535
|
}
|
|
479
536
|
const $3da8afe3ed57cf34$var$_tmpl$ = ["<div", ' class="recommendation-grid"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
|
|
480
537
|
function $3da8afe3ed57cf34$export$7da560f849543dff({
|
|
@@ -530,38 +587,49 @@ function $3da8afe3ed57cf34$export$7da560f849543dff({
|
|
|
530
587
|
const $9ea5383493360761$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
|
|
531
588
|
$9ea5383493360761$var$_tmpl$2 = ["<div", ' class="depict plp recommendations">', "</div>"];
|
|
532
589
|
function $9ea5383493360761$export$9756467d34d91cdb(props) {
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
590
|
+
return $16b52438165aafe2$export$23fca46f3143581f(() => {
|
|
591
|
+
const rows_object_ = $i7OB2$createMemo(() => {
|
|
592
|
+
const {
|
|
593
|
+
view_more_button: view_more_button,
|
|
594
|
+
max_rows: max_rows
|
|
595
|
+
} = props;
|
|
596
|
+
if (!view_more_button) {
|
|
597
|
+
if (max_rows) return {
|
|
598
|
+
max_rows: max_rows
|
|
599
|
+
};
|
|
600
|
+
return "all";
|
|
601
|
+
}
|
|
602
|
+
return {
|
|
603
|
+
max_rows: max_rows,
|
|
604
|
+
start_rows: view_more_button.start_rows,
|
|
605
|
+
rows_per_click: view_more_button.rows_per_click ?? 2,
|
|
606
|
+
button: $i7OB2$ssr($9ea5383493360761$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(view_more_button.text))
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
const grid_spacing_override = $i7OB2$createMemo(() => {
|
|
610
|
+
const {
|
|
611
|
+
grid_spacing: grid_spacing
|
|
612
|
+
} = props; // can be reactive
|
|
613
|
+
return typeof grid_spacing === "string" ? {
|
|
614
|
+
grid_spacing: grid_spacing
|
|
615
|
+
} : {
|
|
616
|
+
override_vertical_spacing: grid_spacing.vertical,
|
|
617
|
+
grid_spacing: grid_spacing.horizontal
|
|
618
|
+
};
|
|
619
|
+
});
|
|
620
|
+
const [recommendations_resource_] = $i7OB2$createResource(() => props.recommendations, recs => recs);
|
|
621
|
+
return $i7OB2$ssr($9ea5383493360761$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape($3da8afe3ed57cf34$export$7da560f849543dff({
|
|
622
|
+
rows_object_: rows_object_,
|
|
623
|
+
product_card_template_: (...args) => props.product_card_template(...args),
|
|
624
|
+
recommendations_resource_: recommendations_resource_,
|
|
625
|
+
market_: () => props.market,
|
|
626
|
+
merchant_: () => props.merchant,
|
|
627
|
+
layout_options_: $i7OB2$createMemo(() => ({
|
|
628
|
+
cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
|
|
629
|
+
...grid_spacing_override()
|
|
630
|
+
}))
|
|
631
|
+
})));
|
|
632
|
+
}, "RecommendationGrid failed");
|
|
565
633
|
}
|
|
566
634
|
function $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(whatToWatch) {
|
|
567
635
|
const [size, setSize] = $i7OB2$createSignal(0);
|
|
@@ -939,16 +1007,16 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
|
|
|
939
1007
|
return outmost_element;
|
|
940
1008
|
}
|
|
941
1009
|
const $87c712b5b33f24f7$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
|
|
942
|
-
$87c712b5b33f24f7$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
|
|
1010
|
+
$87c712b5b33f24f7$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
|
|
943
1011
|
const $87c712b5b33f24f7$export$48513f6b9f8ce62d = props => {
|
|
944
1012
|
// It seems like there's no diffing without memos here (since we often just have computations in the getters above that update to the same result often because their dependencies change with unrelated changes often), so put memos here to avoid unneeded DOM changes
|
|
945
1013
|
const count = $i7OB2$createMemo(() => props.count_);
|
|
946
1014
|
const label = $i7OB2$createMemo(() => props.label_);
|
|
947
1015
|
const checked = $i7OB2$createMemo(() => props.checked_);
|
|
948
1016
|
const value = $i7OB2$createMemo(() => props.value_);
|
|
949
|
-
const is_count_zero = $i7OB2$createMemo(() => props.is_count_zero_);
|
|
1017
|
+
const is_count_zero = $i7OB2$createMemo(() => props.is_count_zero_ || count() === 0);
|
|
950
1018
|
const id = $i7OB2$make_random_classname();
|
|
951
|
-
return (/* We can't use actual margin because ExpandingContainer gets messed up */$i7OB2$ssr($87c712b5b33f24f7$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `input-row ${is_count_zero()
|
|
1019
|
+
return (/* We can't use actual margin because ExpandingContainer gets messed up */$i7OB2$ssr($87c712b5b33f24f7$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `input-row ${is_count_zero() ? "count-0" : ""}`, $i7OB2$ssrAttribute("for", $i7OB2$escape(id, true), false), $i7OB2$ssrAttribute("name", $i7OB2$escape(value(), true), false) + $i7OB2$ssrAttribute("id", $i7OB2$escape(id, true), false), $i7OB2$ssrAttribute("checked", checked(), true), $i7OB2$ssrAttribute("disabled", !checked() && is_count_zero(), true), $i7OB2$escape(label()) || $i7OB2$escape(value()), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
952
1020
|
get when() {
|
|
953
1021
|
return count() != undefined;
|
|
954
1022
|
},
|
|
@@ -1325,7 +1393,7 @@ function $0b6bc2f8309efa8a$export$e5c2828934226505({
|
|
|
1325
1393
|
const $1c8cac76cb67e9af$var$_tmpl$ = ["<form", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></form>"],
|
|
1326
1394
|
$1c8cac76cb67e9af$var$_tmpl$2 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
1327
1395
|
$1c8cac76cb67e9af$var$_tmpl$3 = ["<details", "></details>"],
|
|
1328
|
-
$1c8cac76cb67e9af$var$_tmpl$4 = ["<summary", ' class="category-parent"><div class="summary"><span class="
|
|
1396
|
+
$1c8cac76cb67e9af$var$_tmpl$4 = ["<summary", ' class="category-parent"><div class="summary"><span class="', '">', "</span><!--#-->", "<!--/--></div></summary>"];
|
|
1329
1397
|
const $1c8cac76cb67e9af$var$max_visible_without_collapsing = 15;
|
|
1330
1398
|
const $1c8cac76cb67e9af$var$show_non_collapsible_when_collapsed = 4;
|
|
1331
1399
|
function $1c8cac76cb67e9af$export$a32086fa6616eafd({
|
|
@@ -1527,7 +1595,7 @@ function $1c8cac76cb67e9af$var$render_stuff(data, existing_filter, i18n_) {
|
|
|
1527
1595
|
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$3, $i7OB2$ssrHydrationKey());
|
|
1528
1596
|
},
|
|
1529
1597
|
get summary_() {
|
|
1530
|
-
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$4, $i7OB2$ssrHydrationKey(), $i7OB2$escape(value()?.count_), $i7OB2$escape($i7OB2$createComponent((0, $0b6bc2f8309efa8a$export$e5c2828934226505), {
|
|
1598
|
+
return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$4, $i7OB2$ssrHydrationKey(), `count ${value()?.count_ === 0 ? "count-0" : ""}`, $i7OB2$escape(value()?.count_), $i7OB2$escape($i7OB2$createComponent((0, $0b6bc2f8309efa8a$export$e5c2828934226505), {
|
|
1531
1599
|
i18n_: i18n_,
|
|
1532
1600
|
get expanded_() {
|
|
1533
1601
|
return $i7OB2$createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
|
|
@@ -1719,7 +1787,8 @@ function $1c8cac76cb67e9af$var$expand_until_choice(data_structure) {
|
|
|
1719
1787
|
});
|
|
1720
1788
|
}
|
|
1721
1789
|
const $93716a9ad0dea854$var$_tmpl$ = ["<div", ' class="checkbox-grid">', "</div>"],
|
|
1722
|
-
$93716a9ad0dea854$var$_tmpl$2 = ["<
|
|
1790
|
+
$93716a9ad0dea854$var$_tmpl$2 = ["<span", ' class="count-wrapper"><span class="count">', "</span></span>"],
|
|
1791
|
+
$93716a9ad0dea854$var$_tmpl$3 = ["<button", "", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></button>"];
|
|
1723
1792
|
const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
1724
1793
|
filter_: filter_,
|
|
1725
1794
|
selected_filters_: [get_selected_filters, set_selected_filters]
|
|
@@ -1748,7 +1817,14 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
|
|
|
1748
1817
|
},
|
|
1749
1818
|
children: value => {
|
|
1750
1819
|
const is_selected = $i7OB2$createMemo(() => existing_filter()?.data?.includes(value().value_));
|
|
1751
|
-
return $i7OB2$ssr($93716a9ad0dea854$var$_tmpl$
|
|
1820
|
+
return $i7OB2$ssr($93716a9ad0dea854$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("disabled", value().count_ === 0 && !is_selected(), true), `${!is_selected() ? "minor" : ""} ${is_selected() ? "major" : ""} major-minor-transition`, $i7OB2$escape(value().value_), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
1821
|
+
get when() {
|
|
1822
|
+
return value().count_ != undefined;
|
|
1823
|
+
},
|
|
1824
|
+
get children() {
|
|
1825
|
+
return $i7OB2$ssr($93716a9ad0dea854$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape(value().count_));
|
|
1826
|
+
}
|
|
1827
|
+
})));
|
|
1752
1828
|
}
|
|
1753
1829
|
})));
|
|
1754
1830
|
};
|
|
@@ -5012,35 +5088,6 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
5012
5088
|
}
|
|
5013
5089
|
})))];
|
|
5014
5090
|
}
|
|
5015
|
-
function $16b52438165aafe2$export$23fca46f3143581f(component, error_message) {
|
|
5016
|
-
const component_in_error_boundary = do_with_elements => {
|
|
5017
|
-
const error_boundary_wrapped = $b7436a6d1fd64e3b$export$b69d0d92862de18b({
|
|
5018
|
-
severity_: "error",
|
|
5019
|
-
message_: error_message,
|
|
5020
|
-
get children() {
|
|
5021
|
-
const elements = component();
|
|
5022
|
-
do_with_elements?.(elements);
|
|
5023
|
-
return elements;
|
|
5024
|
-
}
|
|
5025
|
-
});
|
|
5026
|
-
// This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
|
|
5027
|
-
if (typeof error_boundary_wrapped === "function")
|
|
5028
|
-
// @ts-ignore
|
|
5029
|
-
return error_boundary_wrapped();
|
|
5030
|
-
// On the server it returns a string, so we just return that
|
|
5031
|
-
return error_boundary_wrapped;
|
|
5032
|
-
};
|
|
5033
|
-
const owner = $i7OB2$getOwner();
|
|
5034
|
-
if (owner == null) return $i7OB2$createRoot(dispose => {
|
|
5035
|
-
// if we're not already run in a root, create a root and automatically dispose it when the first returned element is removed from the DOM
|
|
5036
|
-
return component_in_error_boundary(elements => {
|
|
5037
|
-
if (!elements?.length) return;
|
|
5038
|
-
(0, $i7OB2$observer).onremoved(elements[0], dispose);
|
|
5039
|
-
});
|
|
5040
|
-
});else
|
|
5041
|
-
// we're already in a root so cleanups are handled
|
|
5042
|
-
return component_in_error_boundary();
|
|
5043
|
-
}
|
|
5044
5091
|
function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
|
|
5045
5092
|
const router_ = options.router_;
|
|
5046
5093
|
const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
|
|
@@ -6336,7 +6383,7 @@ function $190927650b4840eb$export$605674723bcc715c(props = {}) {
|
|
|
6336
6383
|
const $cea52f6b24092f05$var$_tmpl$ = ["<a", ' class="', '"', ">", "</a>"],
|
|
6337
6384
|
$cea52f6b24092f05$var$_tmpl$2 = ["<div", ' class="search-icon">', "</div>"],
|
|
6338
6385
|
$cea52f6b24092f05$var$_tmpl$3 = ["<span", ' class="type">', "</span>"],
|
|
6339
|
-
$cea52f6b24092f05$var$_tmpl$4 = ["<div", "><!--#-->
|
|
6386
|
+
$cea52f6b24092f05$var$_tmpl$4 = ["<div", ' class="with-parent-title"><!--#-->', '<!--/--><span class="value line-clamp">', "</span></div>"],
|
|
6340
6387
|
$cea52f6b24092f05$var$_tmpl$5 = ["<div", ' class="with-icon"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
6341
6388
|
$cea52f6b24092f05$var$_tmpl$6 = ["<h2", ' class="text">', "</h2>"],
|
|
6342
6389
|
$cea52f6b24092f05$var$_tmpl$7 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
@@ -7449,7 +7496,9 @@ function $b2bf2cdcff8142d8$export$f631859cab12b342({
|
|
|
7449
7496
|
}
|
|
7450
7497
|
function $b26bdbd081f63e3f$export$9ff751cd77687edc({
|
|
7451
7498
|
search_results_: search_results_,
|
|
7452
|
-
router_: router_
|
|
7499
|
+
router_: router_,
|
|
7500
|
+
queries_without_content_results_: queries_without_content_results_,
|
|
7501
|
+
get_search_query_: get_search_query_
|
|
7453
7502
|
}) {
|
|
7454
7503
|
const content_results = $i7OB2$createMemo(() => search_results_()?.content_search_links);
|
|
7455
7504
|
const content_results_by_page_url = $i7OB2$createMemo(() => {
|
|
@@ -7462,6 +7511,10 @@ function $b26bdbd081f63e3f$export$9ff751cd77687edc({
|
|
|
7462
7511
|
}
|
|
7463
7512
|
return map;
|
|
7464
7513
|
});
|
|
7514
|
+
$i7OB2$createEffect(() => {
|
|
7515
|
+
const results = content_results();
|
|
7516
|
+
if (Array.isArray(results) && results.length === 0) queries_without_content_results_.add($i7OB2$untrack(get_search_query_));
|
|
7517
|
+
});
|
|
7465
7518
|
return $i7OB2$createComponent((0, $i7OB2$For), {
|
|
7466
7519
|
get each() {
|
|
7467
7520
|
return [...content_results_by_page_url().keys()];
|
|
@@ -7494,7 +7547,7 @@ function $9d5b3ed1fc91c672$export$4405d077f0a20494({
|
|
|
7494
7547
|
children: () => $i7OB2$createComponent((0, $b2bf2cdcff8142d8$export$f631859cab12b342), {})
|
|
7495
7548
|
});
|
|
7496
7549
|
}
|
|
7497
|
-
const $49de9d31aeea1b5e$var$_tmpl$ = ["<div", ' class="
|
|
7550
|
+
const $49de9d31aeea1b5e$var$_tmpl$ = ["<div", ' class="content-results" style="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
7498
7551
|
$49de9d31aeea1b5e$var$_tmpl$2 = ["<button", ' class="view-more">', "</button>"],
|
|
7499
7552
|
$49de9d31aeea1b5e$var$_tmpl$3 = ["<button", ' class="view-less">', "</button>"];
|
|
7500
7553
|
const $49de9d31aeea1b5e$export$70ceae36059a1036 = 1;
|
|
@@ -7514,9 +7567,16 @@ function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
|
|
|
7514
7567
|
number_: num_results,
|
|
7515
7568
|
i18n_: i18n_
|
|
7516
7569
|
});
|
|
7517
|
-
const
|
|
7570
|
+
const queries_without_content_results_ = new (0, $i7OB2$ListenableSet)();
|
|
7571
|
+
const [check_query, set_check_query] = $i7OB2$createSignal(false);
|
|
7572
|
+
const placeholders_enabled = $i7OB2$createMemo(() => {
|
|
7573
|
+
// don't show placeholders when the user toggles filters
|
|
7574
|
+
check_query();
|
|
7575
|
+
return !queries_without_content_results_.has(get_search_query_());
|
|
7576
|
+
});
|
|
7518
7577
|
const rows_object = $49de9d31aeea1b5e$var$make_state_saved_rows(content_results_rows_, i18n_);
|
|
7519
|
-
|
|
7578
|
+
for (const ev of ["add", "delete"]) queries_without_content_results_.addEventListener(ev, () => set_check_query(prev => !prev));
|
|
7579
|
+
return $i7OB2$ssr($49de9d31aeea1b5e$var$_tmpl$, $i7OB2$ssrHydrationKey(), "display:" + (is_loading_() && placeholders_enabled() || content_results()?.length > 0 ? "" : "none"), $i7OB2$escape($i7OB2$createComponent((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), {
|
|
7520
7580
|
get_search_query_: get_search_query_,
|
|
7521
7581
|
i18n_: i18n_,
|
|
7522
7582
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
@@ -7534,21 +7594,19 @@ function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
|
|
|
7534
7594
|
get children() {
|
|
7535
7595
|
return $i7OB2$createComponent((0, $i7OB2$Suspense), {
|
|
7536
7596
|
get fallback() {
|
|
7537
|
-
return (()
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
return $i7OB2$createMemo(() => layout_options_().cols_at_size);
|
|
7544
|
-
}
|
|
7545
|
-
});
|
|
7546
|
-
})();
|
|
7597
|
+
return $i7OB2$createComponent((0, $9d5b3ed1fc91c672$export$4405d077f0a20494), {
|
|
7598
|
+
content_results_rows_: content_results_rows_,
|
|
7599
|
+
get cols_at_size_() {
|
|
7600
|
+
return $i7OB2$createMemo(() => layout_options_().cols_at_size);
|
|
7601
|
+
}
|
|
7602
|
+
});
|
|
7547
7603
|
},
|
|
7548
7604
|
get children() {
|
|
7549
7605
|
return $i7OB2$createComponent((0, $b26bdbd081f63e3f$export$9ff751cd77687edc), {
|
|
7550
7606
|
router_: router_,
|
|
7551
|
-
search_results_: search_results_
|
|
7607
|
+
search_results_: search_results_,
|
|
7608
|
+
queries_without_content_results_: queries_without_content_results_,
|
|
7609
|
+
get_search_query_: get_search_query_
|
|
7552
7610
|
});
|
|
7553
7611
|
}
|
|
7554
7612
|
});
|
|
@@ -7937,7 +7995,7 @@ const $806c97b931758897$var$_tmpl$ = ["<div", ' class="depict plp search">', "</
|
|
|
7937
7995
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
7938
7996
|
*/
|
|
7939
7997
|
const $806c97b931758897$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
|
|
7940
|
-
const $806c97b931758897$var$content_search_default =
|
|
7998
|
+
const $806c97b931758897$var$content_search_default = true;
|
|
7941
7999
|
const $806c97b931758897$var$min_products_to_fetch_ = 20;
|
|
7942
8000
|
const $806c97b931758897$export$bde3eb976dfded9 = depict_search => $806c97b931758897$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
|
|
7943
8001
|
class $806c97b931758897$export$ac6237957a15b3f0 {
|