@depict-ai/ui 1.1.3 → 1.1.5

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.
@@ -5301,7 +5301,8 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
5301
5301
  });
5302
5302
  }
5303
5303
  }
5304
- function $48567ac5b39bac56$export$e2bf8ce7779e827e({ depict_category: depict_category , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , show_breadcrumbs: show_breadcrumbs = true , show_quicklinks: show_quicklinks = true , category_title: category_title }) {
5304
+ function $48567ac5b39bac56$export$e2bf8ce7779e827e({ depict_category: depict_category , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , show_breadcrumbs: show_breadcrumbs = true , show_quicklinks: // TODO: default to false for collections
5305
+ show_quicklinks = true , category_title: category_title }) {
5305
5306
  const shared_properties = $48567ac5b39bac56$var$get_shared_properties(depict_category);
5306
5307
  const grid_spacing_override = typeof grid_spacing === "string" ? {
5307
5308
  grid_spacing: grid_spacing
@@ -2,7 +2,7 @@ import {add_to_version_info as $cV3wj$add_to_version_info, observer as $cV3wj$ob
2
2
  import {createRoot as $cV3wj$createRoot, createSignal as $cV3wj$createSignal, getOwner as $cV3wj$getOwner, runWithOwner as $cV3wj$runWithOwner, onCleanup as $cV3wj$onCleanup, createComputed as $cV3wj$createComputed, createRenderEffect as $cV3wj$createRenderEffect, createEffect as $cV3wj$createEffect, untrack as $cV3wj$untrack, batch as $cV3wj$batch, createResource as $cV3wj$createResource, createMemo as $cV3wj$createMemo, Show as $cV3wj$Show, createReaction as $cV3wj$createReaction, Suspense as $cV3wj$Suspense, on as $cV3wj$on, ErrorBoundary as $cV3wj$ErrorBoundary, For as $cV3wj$For, Index as $cV3wj$Index} from "solid-js";
3
3
  import {ssrElement as $cV3wj$ssrElement, ssr as $cV3wj$ssr, ssrHydrationKey as $cV3wj$ssrHydrationKey, ssrAttribute as $cV3wj$ssrAttribute, escape as $cV3wj$escape, isServer as $cV3wj$isServer, createComponent as $cV3wj$createComponent, ssrClassList as $cV3wj$ssrClassList, insert as $cV3wj$insert, ssrStyle as $cV3wj$ssrStyle, Dynamic as $cV3wj$Dynamic, mergeProps as $cV3wj$mergeProps} from "solid-js/web";
4
4
 
5
- /*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.1.3";
5
+ /*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.1.5";
6
6
 
7
7
 
8
8
 
@@ -252,7 +252,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
252
252
  if (this.#supports_finalization_registry) cache_obj.finalization_registry_.register(result, body); // delete key from cache when value (WeakRefs) are collected
253
253
  else // delete things from cache after 5 minutes, so it doesn't get too heavy
254
254
  setTimeout((0, $cV3wj$catchify)(()=>delete cache_obj.cache_[body]), 300000);
255
- }), 30000 // cache values for at least 30 seconds
255
+ }), 60000 // cache values for at least 60 seconds
256
256
  );
257
257
  return result;
258
258
  } finally{
@@ -906,6 +906,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({ plp_results_: plp_results_
906
906
  const record = records[i];
907
907
  const { target: target , intersectionRatio: intersectionRatio } = record;
908
908
  const index_of_target = target_to_index_map.get(target);
909
+ if (index_of_target == undefined) return; // It seems like it can happen that we get IntersectionObserverEntries after the onCleanup function for a recommendation card has run, in Firefox. Probably a bug in Firefox? If I understood the bug correctly, this is a workaround.
909
910
  const is_in_set = currently_intersecting.has(index_of_target);
910
911
  if (intersectionRatio > 0) {
911
912
  if (!is_in_set) currently_intersecting.add(index_of_target);
@@ -4305,23 +4306,30 @@ function $641bba2917fe862b$export$6e49da55e449af7c({ scroll_restoration_data_: [
4305
4306
  ]); // get rid of old data the browser saves the old state and will restore it later on
4306
4307
  };
4307
4308
  (0, $cV3wj$createComputed)((0, $cV3wj$catchify)(()=>{
4308
- const r = get_last_result_in_viewport_();
4309
- if (r == undefined || r <= 0 || r == Infinity) return;
4309
+ const last_result = get_last_result_in_viewport_();
4310
+ if (last_result == undefined || last_result <= 0 || last_result == Infinity) return;
4311
+ if (isNaN(last_result)) {
4312
+ // if last_result is NaN there's an issue somewhere, but if we store something here that's not a number the for loop further down will break, and we won't be able to load results at all, so let's just continue
4313
+ (0, $cV3wj$report)(new Error("last_result is NaN, this should not happen"), "error", {
4314
+ last_result: last_result
4315
+ });
4316
+ return;
4317
+ }
4310
4318
  // We can push to history.state max 100 times per 30 seconds (Safari) so we have to debounce/cap this at 300ms for aggressive scrolling.
4311
4319
  // Pushing to history.state right before we leave the page (onunload etc.) is unreliable, as it has to occur *before* the next page is pushed to history.
4312
- // Instead we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
4320
+ // Instead, we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
4313
4321
  const now = +new Date();
4314
4322
  const time_since_last_ran = now - last_time_history_changed;
4315
4323
  if (time_since_last_ran > $641bba2917fe862b$var$max_history_change_frequency) {
4316
4324
  // If the interval to the previous push is already long enough, it's fine to push the next value directly.
4317
- set_min_results_loaded(r);
4325
+ set_min_results_loaded(last_result);
4318
4326
  last_time_history_changed = now;
4319
4327
  // Even though the interval has passed, there could still be a delayed push timeout in flight (browser can delay timeouts at will).
4320
4328
  // We've already written the guaranteed-to-be-freshest value so we can just cancel it.
4321
4329
  clearTimeout(timeout);
4322
4330
  return;
4323
4331
  }
4324
- set_to_later = r;
4332
+ set_to_later = last_result;
4325
4333
  // If a delayed push timeout is already running, just changing the value that will be pushed is sufficient
4326
4334
  if (timeout) return;
4327
4335
  timeout = setTimeout((0, $cV3wj$catchify)(()=>{