@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.
@@ -6038,7 +6038,8 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
6038
6038
  });
6039
6039
  }
6040
6040
  }
6041
- 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 }) {
6041
+ 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
6042
+ show_quicklinks = true , category_title: category_title }) {
6042
6043
  const shared_properties = $48567ac5b39bac56$var$get_shared_properties(depict_category);
6043
6044
  const grid_spacing_override = typeof grid_spacing === "string" ? {
6044
6045
  grid_spacing: grid_spacing
@@ -2,7 +2,7 @@ import {add_to_version_info as $gco9i$add_to_version_info, observer as $gco9i$ob
2
2
  import {createRoot as $gco9i$createRoot, createSignal as $gco9i$createSignal, getOwner as $gco9i$getOwner, runWithOwner as $gco9i$runWithOwner, onCleanup as $gco9i$onCleanup, createComputed as $gco9i$createComputed, createRenderEffect as $gco9i$createRenderEffect, createEffect as $gco9i$createEffect, untrack as $gco9i$untrack, batch as $gco9i$batch, createResource as $gco9i$createResource, createMemo as $gco9i$createMemo, Show as $gco9i$Show, createReaction as $gco9i$createReaction, Suspense as $gco9i$Suspense, on as $gco9i$on, ErrorBoundary as $gco9i$ErrorBoundary, For as $gco9i$For, Index as $gco9i$Index} from "solid-js";
3
3
  import {template as $gco9i$template, getNextElement as $gco9i$getNextElement, spread as $gco9i$spread, mergeProps as $gco9i$mergeProps, runHydrationEvents as $gco9i$runHydrationEvents, effect as $gco9i$effect, setAttribute as $gco9i$setAttribute, insert as $gco9i$insert, isServer as $gco9i$isServer, createComponent as $gco9i$createComponent, getNextMarker as $gco9i$getNextMarker, use as $gco9i$use, memo as $gco9i$memo, addEventListener as $gco9i$addEventListener, delegateEvents as $gco9i$delegateEvents, classList as $gco9i$classList, style as $gco9i$style, className as $gco9i$className, Dynamic as $gco9i$Dynamic} 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
 
@@ -268,7 +268,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
268
268
  if (this.#supports_finalization_registry) cache_obj.finalization_registry_.register(result, body); // delete key from cache when value (WeakRefs) are collected
269
269
  else // delete things from cache after 5 minutes, so it doesn't get too heavy
270
270
  setTimeout((0, $gco9i$catchify)(()=>delete cache_obj.cache_[body]), 300000);
271
- }), 30000 // cache values for at least 30 seconds
271
+ }), 60000 // cache values for at least 60 seconds
272
272
  );
273
273
  return result;
274
274
  } finally{
@@ -1148,6 +1148,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({ plp_results_: plp_results_
1148
1148
  const record = records[i];
1149
1149
  const { target: target , intersectionRatio: intersectionRatio } = record;
1150
1150
  const index_of_target = target_to_index_map.get(target);
1151
+ 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.
1151
1152
  const is_in_set = currently_intersecting.has(index_of_target);
1152
1153
  if (intersectionRatio > 0) {
1153
1154
  if (!is_in_set) currently_intersecting.add(index_of_target);
@@ -5067,23 +5068,30 @@ function $641bba2917fe862b$export$6e49da55e449af7c({ scroll_restoration_data_: [
5067
5068
  ]); // get rid of old data the browser saves the old state and will restore it later on
5068
5069
  };
5069
5070
  (0, $gco9i$createComputed)((0, $gco9i$catchify)(()=>{
5070
- const r = get_last_result_in_viewport_();
5071
- if (r == undefined || r <= 0 || r == Infinity) return;
5071
+ const last_result = get_last_result_in_viewport_();
5072
+ if (last_result == undefined || last_result <= 0 || last_result == Infinity) return;
5073
+ if (isNaN(last_result)) {
5074
+ // 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
5075
+ (0, $gco9i$report)(new Error("last_result is NaN, this should not happen"), "error", {
5076
+ last_result: last_result
5077
+ });
5078
+ return;
5079
+ }
5072
5080
  // 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.
5073
5081
  // 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.
5074
- // Instead we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
5082
+ // Instead, we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
5075
5083
  const now = +new Date();
5076
5084
  const time_since_last_ran = now - last_time_history_changed;
5077
5085
  if (time_since_last_ran > $641bba2917fe862b$var$max_history_change_frequency) {
5078
5086
  // If the interval to the previous push is already long enough, it's fine to push the next value directly.
5079
- set_min_results_loaded(r);
5087
+ set_min_results_loaded(last_result);
5080
5088
  last_time_history_changed = now;
5081
5089
  // Even though the interval has passed, there could still be a delayed push timeout in flight (browser can delay timeouts at will).
5082
5090
  // We've already written the guaranteed-to-be-freshest value so we can just cancel it.
5083
5091
  clearTimeout(timeout);
5084
5092
  return;
5085
5093
  }
5086
- set_to_later = r;
5094
+ set_to_later = last_result;
5087
5095
  // If a delayed push timeout is already running, just changing the value that will be pushed is sufficient
5088
5096
  if (timeout) return;
5089
5097
  timeout = setTimeout((0, $gco9i$catchify)(()=>{
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ import { SearchSuggestionsResponse, CategorySuggestion } from "@depict-ai/types/
7
7
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
8
8
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
9
9
  import { ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
10
- export const version = "1.1.3";
10
+ export const version = "1.1.5";
11
11
  /**
12
12
  * Basically allows you to use SearchModal
13
13
  * So the idea is to have a modal. It should either be rendered and exist, in which case it is in the foreground and open, or it's completely gone. This makes things easier.