@depict-ai/ui 1.4.24 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,11 @@
1
- import { add_to_version_info as $i7OB2$add_to_version_info, 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, is_safari as $i7OB2$is_safari, observer as $i7OB2$observer, 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, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
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";
4
- import { slider_fractional_factory as $i7OB2$slider_fractional_factory } from "@depict-ai/utilishared/latest/latest";
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";
5
4
 
6
5
  /*! Depict.ai search and product listing SDK */
7
6
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
8
7
  register_es_version("ui", "latest");
9
- const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.24";
8
+ const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.0";
10
9
  const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
11
10
  const cols_at_size = [];
12
11
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -65,7 +64,9 @@ function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_f
65
64
  }
66
65
  function $a458486f22b22f63$export$a2cc176055f8f08() {
67
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.";
68
- return (0, $i7OB2$isServer) ? `<!-- ${text} -->` : document.createComment(text);
67
+ return (0, $i7OB2$isServer) ? {
68
+ t: `<!-- ${text} -->`
69
+ } : document.createComment(text);
69
70
  }
70
71
  function $a52235d12ccf9c88$export$2f0cbfbb4354bb52(elements) {
71
72
  // FYI this probably doesn't work on hugely deep nestings or large amount of elements
@@ -272,21 +273,32 @@ function $b7436a6d1fd64e3b$export$b69d0d92862de18b(props) {
272
273
  }
273
274
  });
274
275
  }
275
- const $c8d5ff4524619fcd$var$_tmpl$ = ["<style", ' type="text/css">', "</style>"],
276
- $c8d5ff4524619fcd$var$_tmpl$2 = ["<div", ' class="', '">', "</div>"];
276
+ const $c8d5ff4524619fcd$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
277
+ $c8d5ff4524619fcd$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
277
278
  function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
278
- const container_element_ = $i7OB2$ssrElement("div", props.element_attributes, () => $i7OB2$escape(props.children), true); // Don't want this in the error boundary below, it should only be for the actual layouting
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
279
286
  return $i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
280
287
  get message_() {
281
288
  return "Failed calculating " + props.layout + " layout";
282
289
  },
283
290
  severity_: "error",
284
291
  get children() {
285
- return $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element_);
292
+ return $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element_, false, container_class);
286
293
  }
287
294
  });
288
295
  }
289
- 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
+ }
290
302
  // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
291
303
  const show_all_rows = $i7OB2$createMemo(() => props.rows === "all");
292
304
  const rows_or_empty_object = $i7OB2$createMemo(() => show_all_rows() ? {} : props.rows);
@@ -301,28 +313,27 @@ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, ins
301
313
  return !(!button || Array.isArray(button) && !button.length);
302
314
  });
303
315
  const [get_styling, set_styling] = $i7OB2$createSignal();
304
- const container_class = $i7OB2$make_random_classname();
305
316
  const selector_beginning = `.depict .${container_class}>`; // class so ppl can have id if needed
306
317
  const [get_children_count, set_children_count] = $i7OB2$createSignal(0);
307
- 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);
308
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));
309
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
310
321
  const rows_visible_signal = $i7OB2$createMemo(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
311
322
  const get_rows_visible = $i7OB2$createMemo(() => rows_visible_signal()[0]());
312
323
  const set_rows_visible = $i7OB2$createMemo(() => rows_visible_signal()[1]);
313
- const view_more_button_class = $i7OB2$make_random_classname();
314
- const view_less_button_class = $i7OB2$make_random_classname();
315
- const style_element = $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$, $i7OB2$ssrHydrationKey(), get_styling);
316
- 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)));
317
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
318
- const view_less_button_container = $i7OB2$createMemo(() => have_a_view_less_button() && $i7OB2$ssr($c8d5ff4524619fcd$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `load-less-container ${$i7OB2$escape(view_less_button_class, true)}`, $i7OB2$escape(rows_or_empty_object().view_less_button)));
319
- container_element.classList.add(container_class);
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("");
320
330
  $i7OB2$createComputed(() => {
321
331
  // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
322
332
  const rows_visible = get_rows_visible();
323
333
  const max_rows = rows_or_empty_object().max_rows;
324
334
  if (!isNaN(max_rows) && max_rows >= 0 && rows_visible > max_rows) set_rows_visible()(max_rows);
325
335
  });
336
+ $i7OB2$createEffect(() => set_force_style_update(" ")); // force style update after hydration due to https://discord.com/channels/722131463138705510/722167424186843267/1151544212517552168
326
337
  $i7OB2$createRenderEffect(() => {
327
338
  // Be careful to only read show_all_rows in here (ofc doesn't apply to nested effects)
328
339
  if (show_all_rows()) {
@@ -331,11 +342,13 @@ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, ins
331
342
  return;
332
343
  }
333
344
  update_children_count();
334
- const mutation_observer = new MutationObserver($i7OB2$catchify(update_children_count));
335
- mutation_observer.observe(container_element, {
336
- childList: true
337
- });
338
- $i7OB2$onCleanup(() => mutation_observer.disconnect());
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
+ }
339
352
  set_styling(
340
353
  // this is needed because solid will think that the memo-accessor is a setter function otherwise
341
354
  () => $i7OB2$createMemo(() => {
@@ -346,7 +359,7 @@ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, ins
346
359
  } = rows_or_empty_object();
347
360
  const rows_visible = get_rows_visible();
348
361
  const children_count = get_children_count();
349
- return col_styling() + props.cols_at_size.map(options => {
362
+ return force_style_update() + col_styling() + props.cols_at_size.map(options => {
350
363
  const [recs_per_row, min, max] = options;
351
364
  let should_hide_view_more_button;
352
365
  let visible_recs;
@@ -367,6 +380,7 @@ function $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, container_element, ins
367
380
  }).join("");
368
381
  }));
369
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
370
384
  if (insert_after_container) container_element.after(style_element);
371
385
  return [container_element, view_more_button_container(), view_less_button_container(), style_element];
372
386
  }
@@ -380,12 +394,20 @@ function $f32e14878e75af51$export$6649caad96ef8870({
380
394
  slider_ref_: slider_ref_,
381
395
  faded_opacity_ = 0.7,
382
396
  mutation_plugins_ = [],
383
- disable_fading_: disable_fading_
397
+ disable_fading_: disable_fading_,
398
+ arrow_width_: arrow_width_,
399
+ arrow_height_: arrow_height_
384
400
  }) {
385
401
  const slider = new (0, $i7OB2$Amazing_Slider)({
386
402
  button_contents: {
387
- left: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {})))],
388
- right: [$i7OB2$ssr($f32e14878e75af51$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $fbbadcb080ad1d4a$export$8be2714ec7f169ee), {})))]
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
+ })))]
389
411
  },
390
412
  constructor_plugins: [$i7OB2$slider_snap_css().constructor_plugin],
391
413
  mutation_plugins: [...(disable_fading_ ? [] : [$i7OB2$slider_fading_factory({
@@ -408,6 +430,8 @@ function $c4492d24952ed731$export$d41d19e89346fa2({
408
430
  const is_showing_something = $i7OB2$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
409
431
  const num_placeholders_ = () => 20;
410
432
  const slider = $i7OB2$createComponent((0, $f32e14878e75af51$export$6649caad96ef8870), {
433
+ arrow_height_: 25,
434
+ arrow_width_: 12.5,
411
435
  disable_fading_: true,
412
436
  slider_ref_: slider => {
413
437
  const {
@@ -452,30 +476,62 @@ function $c4492d24952ed731$export$d41d19e89346fa2({
452
476
  children: slider
453
477
  });
454
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
+ }
455
509
  const $ee116da074deb002$var$_tmpl$ = ["<div", ' class="depict recommendations">', "</div>"];
456
510
  function $ee116da074deb002$export$9574e176201e5e8d(props) {
457
- const grid_spacing_override = $i7OB2$createMemo(() => {
458
- const {
459
- grid_spacing: grid_spacing
460
- } = props; // can be reactive
461
- return typeof grid_spacing === "string" ? {
462
- grid_spacing: grid_spacing
463
- } : {
464
- override_vertical_spacing: grid_spacing.vertical,
465
- grid_spacing: grid_spacing.horizontal
466
- };
467
- });
468
- const [recommendations_resource_] = $i7OB2$createResource(() => props.recommendations, recs => recs);
469
- return $i7OB2$ssr($ee116da074deb002$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($c4492d24952ed731$export$d41d19e89346fa2({
470
- product_card_template_: (...args) => props.product_card_template(...args),
471
- recommendations_resource_: recommendations_resource_,
472
- market_: () => props.market,
473
- merchant_: () => props.merchant,
474
- layout_options_: $i7OB2$createMemo(() => ({
475
- cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
476
- ...grid_spacing_override()
477
- }))
478
- })));
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");
479
535
  }
480
536
  const $3da8afe3ed57cf34$var$_tmpl$ = ["<div", ' class="recommendation-grid"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"];
481
537
  function $3da8afe3ed57cf34$export$7da560f849543dff({
@@ -531,38 +587,40 @@ function $3da8afe3ed57cf34$export$7da560f849543dff({
531
587
  const $9ea5383493360761$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
532
588
  $9ea5383493360761$var$_tmpl$2 = ["<div", ' class="depict plp recommendations">', "</div>"];
533
589
  function $9ea5383493360761$export$9756467d34d91cdb(props) {
534
- const rows_object_ = $i7OB2$createMemo(() => {
535
- const view_more_button = props.view_more_button;
536
- if (!view_more_button) return "all";
537
- return {
538
- start_rows: view_more_button.start_rows,
539
- rows_per_click: view_more_button.rows_per_click,
540
- button: $i7OB2$ssr($9ea5383493360761$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(view_more_button.text))
541
- };
542
- });
543
- const grid_spacing_override = $i7OB2$createMemo(() => {
544
- const {
545
- grid_spacing: grid_spacing
546
- } = props; // can be reactive
547
- return typeof grid_spacing === "string" ? {
548
- grid_spacing: grid_spacing
549
- } : {
550
- override_vertical_spacing: grid_spacing.vertical,
551
- grid_spacing: grid_spacing.horizontal
552
- };
553
- });
554
- const [recommendations_resource_] = $i7OB2$createResource(() => props.recommendations, recs => recs);
555
- return $i7OB2$ssr($9ea5383493360761$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape($3da8afe3ed57cf34$export$7da560f849543dff({
556
- rows_object_: rows_object_,
557
- product_card_template_: (...args) => props.product_card_template(...args),
558
- recommendations_resource_: recommendations_resource_,
559
- market_: () => props.market,
560
- merchant_: () => props.merchant,
561
- layout_options_: $i7OB2$createMemo(() => ({
562
- cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
563
- ...grid_spacing_override()
564
- }))
565
- })));
590
+ return $16b52438165aafe2$export$23fca46f3143581f(() => {
591
+ const rows_object_ = $i7OB2$createMemo(() => {
592
+ const view_more_button = props.view_more_button;
593
+ if (!view_more_button) return "all";
594
+ return {
595
+ start_rows: view_more_button.start_rows,
596
+ rows_per_click: view_more_button.rows_per_click ?? 2,
597
+ button: $i7OB2$ssr($9ea5383493360761$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(view_more_button.text))
598
+ };
599
+ });
600
+ const grid_spacing_override = $i7OB2$createMemo(() => {
601
+ const {
602
+ grid_spacing: grid_spacing
603
+ } = props; // can be reactive
604
+ return typeof grid_spacing === "string" ? {
605
+ grid_spacing: grid_spacing
606
+ } : {
607
+ override_vertical_spacing: grid_spacing.vertical,
608
+ grid_spacing: grid_spacing.horizontal
609
+ };
610
+ });
611
+ const [recommendations_resource_] = $i7OB2$createResource(() => props.recommendations, recs => recs);
612
+ return $i7OB2$ssr($9ea5383493360761$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape($3da8afe3ed57cf34$export$7da560f849543dff({
613
+ rows_object_: rows_object_,
614
+ product_card_template_: (...args) => props.product_card_template(...args),
615
+ recommendations_resource_: recommendations_resource_,
616
+ market_: () => props.market,
617
+ merchant_: () => props.merchant,
618
+ layout_options_: $i7OB2$createMemo(() => ({
619
+ cols_at_size: $b5cccc8ee7d24677$export$6daf8749b65a1b77($1848f7cca286fbab$export$ff7109b9b2b206ba(props.cols_at_size)),
620
+ ...grid_spacing_override()
621
+ }))
622
+ })));
623
+ }, "RecommendationGrid failed");
566
624
  }
567
625
  function $e8ffe11ed01df0fe$export$e6fffe67d4cdd848(whatToWatch) {
568
626
  const [size, setSize] = $i7OB2$createSignal(0);
@@ -940,16 +998,16 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
940
998
  return outmost_element;
941
999
  }
942
1000
  const $87c712b5b33f24f7$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
943
- $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>"];
1001
+ $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>"];
944
1002
  const $87c712b5b33f24f7$export$48513f6b9f8ce62d = props => {
945
1003
  // 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
946
1004
  const count = $i7OB2$createMemo(() => props.count_);
947
1005
  const label = $i7OB2$createMemo(() => props.label_);
948
1006
  const checked = $i7OB2$createMemo(() => props.checked_);
949
1007
  const value = $i7OB2$createMemo(() => props.value_);
950
- const is_count_zero = $i7OB2$createMemo(() => props.is_count_zero_);
1008
+ const is_count_zero = $i7OB2$createMemo(() => props.is_count_zero_ || count() === 0);
951
1009
  const id = $i7OB2$make_random_classname();
952
- 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 ? "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$escape(label()) || $i7OB2$escape(value()), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
1010
+ 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), {
953
1011
  get when() {
954
1012
  return count() != undefined;
955
1013
  },
@@ -1326,7 +1384,7 @@ function $0b6bc2f8309efa8a$export$e5c2828934226505({
1326
1384
  const $1c8cac76cb67e9af$var$_tmpl$ = ["<form", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></form>"],
1327
1385
  $1c8cac76cb67e9af$var$_tmpl$2 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
1328
1386
  $1c8cac76cb67e9af$var$_tmpl$3 = ["<details", "></details>"],
1329
- $1c8cac76cb67e9af$var$_tmpl$4 = ["<summary", ' class="category-parent"><div class="summary"><span class="count">', "</span><!--#-->", "<!--/--></div></summary>"];
1387
+ $1c8cac76cb67e9af$var$_tmpl$4 = ["<summary", ' class="category-parent"><div class="summary"><span class="', '">', "</span><!--#-->", "<!--/--></div></summary>"];
1330
1388
  const $1c8cac76cb67e9af$var$max_visible_without_collapsing = 15;
1331
1389
  const $1c8cac76cb67e9af$var$show_non_collapsible_when_collapsed = 4;
1332
1390
  function $1c8cac76cb67e9af$export$a32086fa6616eafd({
@@ -1528,7 +1586,7 @@ function $1c8cac76cb67e9af$var$render_stuff(data, existing_filter, i18n_) {
1528
1586
  return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$3, $i7OB2$ssrHydrationKey());
1529
1587
  },
1530
1588
  get summary_() {
1531
- return $i7OB2$ssr($1c8cac76cb67e9af$var$_tmpl$4, $i7OB2$ssrHydrationKey(), $i7OB2$escape(value()?.count_), $i7OB2$escape($i7OB2$createComponent((0, $0b6bc2f8309efa8a$export$e5c2828934226505), {
1589
+ 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), {
1532
1590
  i18n_: i18n_,
1533
1591
  get expanded_() {
1534
1592
  return $i7OB2$createMemo(() => value()?.is_expanded_?.ui_should_show_expanded_?.() ?? false);
@@ -1720,7 +1778,8 @@ function $1c8cac76cb67e9af$var$expand_until_choice(data_structure) {
1720
1778
  });
1721
1779
  }
1722
1780
  const $93716a9ad0dea854$var$_tmpl$ = ["<div", ' class="checkbox-grid">', "</div>"],
1723
- $93716a9ad0dea854$var$_tmpl$2 = ["<button", ' class="', '">', "</button>"];
1781
+ $93716a9ad0dea854$var$_tmpl$2 = ["<span", ' class="count-wrapper"><span class="count">', "</span></span>"],
1782
+ $93716a9ad0dea854$var$_tmpl$3 = ["<button", "", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></button>"];
1724
1783
  const $93716a9ad0dea854$export$414f6a19d38e655c = ({
1725
1784
  filter_: filter_,
1726
1785
  selected_filters_: [get_selected_filters, set_selected_filters]
@@ -1749,7 +1808,14 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
1749
1808
  },
1750
1809
  children: value => {
1751
1810
  const is_selected = $i7OB2$createMemo(() => existing_filter()?.data?.includes(value().value_));
1752
- return $i7OB2$ssr($93716a9ad0dea854$var$_tmpl$2, $i7OB2$ssrHydrationKey(), `${!is_selected() ? "minor" : ""} ${is_selected() ? "major" : ""} major-minor-transition`, $i7OB2$escape(value().value_));
1811
+ 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), {
1812
+ get when() {
1813
+ return value().count_ != undefined;
1814
+ },
1815
+ get children() {
1816
+ return $i7OB2$ssr($93716a9ad0dea854$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$escape(value().count_));
1817
+ }
1818
+ })));
1753
1819
  }
1754
1820
  })));
1755
1821
  };
@@ -5013,35 +5079,6 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
5013
5079
  }
5014
5080
  })))];
5015
5081
  }
5016
- function $16b52438165aafe2$export$23fca46f3143581f(component, error_message) {
5017
- const component_in_error_boundary = do_with_elements => {
5018
- const error_boundary_wrapped = $b7436a6d1fd64e3b$export$b69d0d92862de18b({
5019
- severity_: "error",
5020
- message_: error_message,
5021
- get children() {
5022
- const elements = component();
5023
- do_with_elements?.(elements);
5024
- return elements;
5025
- }
5026
- });
5027
- // This might return an accessor, in that case we need to "unwrap" it since our SDK consumers expect HTML elements or arrays thereof
5028
- if (typeof error_boundary_wrapped === "function")
5029
- // @ts-ignore
5030
- return error_boundary_wrapped();
5031
- // On the server it returns a string, so we just return that
5032
- return error_boundary_wrapped;
5033
- };
5034
- const owner = $i7OB2$getOwner();
5035
- if (owner == null) return $i7OB2$createRoot(dispose => {
5036
- // 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
5037
- return component_in_error_boundary(elements => {
5038
- if (!elements?.length) return;
5039
- (0, $i7OB2$observer).onremoved(elements[0], dispose);
5040
- });
5041
- });else
5042
- // we're already in a root so cleanups are handled
5043
- return component_in_error_boundary();
5044
- }
5045
5082
  function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
5046
5083
  const router_ = options.router_;
5047
5084
  const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
@@ -6337,7 +6374,7 @@ function $190927650b4840eb$export$605674723bcc715c(props = {}) {
6337
6374
  const $cea52f6b24092f05$var$_tmpl$ = ["<a", ' class="', '"', ">", "</a>"],
6338
6375
  $cea52f6b24092f05$var$_tmpl$2 = ["<div", ' class="search-icon">', "</div>"],
6339
6376
  $cea52f6b24092f05$var$_tmpl$3 = ["<span", ' class="type">', "</span>"],
6340
- $cea52f6b24092f05$var$_tmpl$4 = ["<div", "><!--#-->", '<!--/--><span class="value">', "</span></div>"],
6377
+ $cea52f6b24092f05$var$_tmpl$4 = ["<div", ' class="with-parent-title"><!--#-->', '<!--/--><span class="value line-clamp">', "</span></div>"],
6341
6378
  $cea52f6b24092f05$var$_tmpl$5 = ["<div", ' class="with-icon"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6342
6379
  $cea52f6b24092f05$var$_tmpl$6 = ["<h2", ' class="text">', "</h2>"],
6343
6380
  $cea52f6b24092f05$var$_tmpl$7 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
@@ -7450,7 +7487,9 @@ function $b2bf2cdcff8142d8$export$f631859cab12b342({
7450
7487
  }
7451
7488
  function $b26bdbd081f63e3f$export$9ff751cd77687edc({
7452
7489
  search_results_: search_results_,
7453
- router_: router_
7490
+ router_: router_,
7491
+ queries_without_content_results_: queries_without_content_results_,
7492
+ get_search_query_: get_search_query_
7454
7493
  }) {
7455
7494
  const content_results = $i7OB2$createMemo(() => search_results_()?.content_search_links);
7456
7495
  const content_results_by_page_url = $i7OB2$createMemo(() => {
@@ -7463,6 +7502,10 @@ function $b26bdbd081f63e3f$export$9ff751cd77687edc({
7463
7502
  }
7464
7503
  return map;
7465
7504
  });
7505
+ $i7OB2$createEffect(() => {
7506
+ const results = content_results();
7507
+ if (Array.isArray(results) && results.length === 0) queries_without_content_results_.add($i7OB2$untrack(get_search_query_));
7508
+ });
7466
7509
  return $i7OB2$createComponent((0, $i7OB2$For), {
7467
7510
  get each() {
7468
7511
  return [...content_results_by_page_url().keys()];
@@ -7495,7 +7538,7 @@ function $9d5b3ed1fc91c672$export$4405d077f0a20494({
7495
7538
  children: () => $i7OB2$createComponent((0, $b2bf2cdcff8142d8$export$f631859cab12b342), {})
7496
7539
  });
7497
7540
  }
7498
- const $49de9d31aeea1b5e$var$_tmpl$ = ["<div", ' class="', '" style="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
7541
+ const $49de9d31aeea1b5e$var$_tmpl$ = ["<div", ' class="content-results" style="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
7499
7542
  $49de9d31aeea1b5e$var$_tmpl$2 = ["<button", ' class="view-more">', "</button>"],
7500
7543
  $49de9d31aeea1b5e$var$_tmpl$3 = ["<button", ' class="view-less">', "</button>"];
7501
7544
  const $49de9d31aeea1b5e$export$70ceae36059a1036 = 1;
@@ -7515,9 +7558,16 @@ function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
7515
7558
  number_: num_results,
7516
7559
  i18n_: i18n_
7517
7560
  });
7518
- const [is_showing_placeholders, set_is_showing_placeholders] = $i7OB2$createSignal(false);
7561
+ const queries_without_content_results_ = new (0, $i7OB2$ListenableSet)();
7562
+ const [check_query, set_check_query] = $i7OB2$createSignal(false);
7563
+ const placeholders_enabled = $i7OB2$createMemo(() => {
7564
+ // don't show placeholders when the user toggles filters
7565
+ check_query();
7566
+ return !queries_without_content_results_.has(get_search_query_());
7567
+ });
7519
7568
  const rows_object = $49de9d31aeea1b5e$var$make_state_saved_rows(content_results_rows_, i18n_);
7520
- return $i7OB2$ssr($49de9d31aeea1b5e$var$_tmpl$, $i7OB2$ssrHydrationKey(), `content-results ${is_showing_placeholders() ? "loading" : ""}`, "display:" + (is_loading_() || content_results()?.length > 0 ? "" : "none"), $i7OB2$escape($i7OB2$createComponent((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), {
7569
+ for (const ev of ["add", "delete"]) queries_without_content_results_.addEventListener(ev, () => set_check_query(prev => !prev));
7570
+ 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), {
7521
7571
  get_search_query_: get_search_query_,
7522
7572
  i18n_: i18n_,
7523
7573
  formatted_number_of_results_: formatted_number_of_results_,
@@ -7535,21 +7585,19 @@ function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
7535
7585
  get children() {
7536
7586
  return $i7OB2$createComponent((0, $i7OB2$Suspense), {
7537
7587
  get fallback() {
7538
- return (() => {
7539
- set_is_showing_placeholders(true);
7540
- $i7OB2$onCleanup(() => set_is_showing_placeholders(false));
7541
- return $i7OB2$createComponent((0, $9d5b3ed1fc91c672$export$4405d077f0a20494), {
7542
- content_results_rows_: content_results_rows_,
7543
- get cols_at_size_() {
7544
- return $i7OB2$createMemo(() => layout_options_().cols_at_size);
7545
- }
7546
- });
7547
- })();
7588
+ return $i7OB2$createComponent((0, $9d5b3ed1fc91c672$export$4405d077f0a20494), {
7589
+ content_results_rows_: content_results_rows_,
7590
+ get cols_at_size_() {
7591
+ return $i7OB2$createMemo(() => layout_options_().cols_at_size);
7592
+ }
7593
+ });
7548
7594
  },
7549
7595
  get children() {
7550
7596
  return $i7OB2$createComponent((0, $b26bdbd081f63e3f$export$9ff751cd77687edc), {
7551
7597
  router_: router_,
7552
- search_results_: search_results_
7598
+ search_results_: search_results_,
7599
+ queries_without_content_results_: queries_without_content_results_,
7600
+ get_search_query_: get_search_query_
7553
7601
  });
7554
7602
  }
7555
7603
  });
@@ -7938,7 +7986,7 @@ const $806c97b931758897$var$_tmpl$ = ["<div", ' class="depict plp search">', "</
7938
7986
  * 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.
7939
7987
  */
7940
7988
  const $806c97b931758897$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
7941
- const $806c97b931758897$var$content_search_default = false;
7989
+ const $806c97b931758897$var$content_search_default = true;
7942
7990
  const $806c97b931758897$var$min_products_to_fetch_ = 20;
7943
7991
  const $806c97b931758897$export$bde3eb976dfded9 = depict_search => $806c97b931758897$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
7944
7992
  class $806c97b931758897$export$ac6237957a15b3f0 {