@depict-ai/ui 2.1.1 → 2.1.2

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/latest/index.js CHANGED
@@ -6,7 +6,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
6
6
  /*! Depict.ai search and product listing SDK */
7
7
  import { register_es_version } from "../multi_import_deduplicator.mjs";
8
8
  register_es_version("ui", "latest");
9
- const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.1";
9
+ const $ec291e0010116877$export$83d89fbfd8236492 = "2.1.2";
10
10
  const $4147651646da990a$var$fallback_operator = "in";
11
11
  const $4147651646da990a$var$fallback_token = "";
12
12
  const $4147651646da990a$var$legacy_filter_prefix = "filter_";
@@ -4568,8 +4568,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
4568
4568
  query_base_: query_base_,
4569
4569
  depict_api_: depict_api_,
4570
4570
  is_loading_: is_loading_,
4571
- content_blocks_: content_blocks_,
4572
- set_number_loaded_displays_: set_number_loaded_displays_
4571
+ content_blocks_: content_blocks_
4573
4572
  }) {
4574
4573
  // The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
4575
4574
  const target_to_index_map = new Map();
@@ -4613,7 +4612,6 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
4613
4612
  query_base_: query_base_,
4614
4613
  depict_api_: depict_api_
4615
4614
  });
4616
- $9HbP8$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
4617
4615
  return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
4618
4616
  displays_by_key_: displays_by_key_,
4619
4617
  merchant_: merchant_,
@@ -4807,26 +4805,18 @@ const $e7a7eb102ddc0c79$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=co
4807
4805
  function $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
4808
4806
  content_blocks_: incoming_content_blocks,
4809
4807
  cols_at_size_: cols_at_size_,
4810
- number_of_items_shown_: number_of_items_shown_,
4811
4808
  set_top_row_shortened_by_: set_top_row_shortened_by_
4812
4809
  }) {
4813
4810
  // these are by row
4814
4811
  const [content_blocks, set_content_blocks] = $9HbP8$createStore([]);
4815
4812
  const n_cols_currently_showing_ = $bed740eef1769419$export$a79e666719b3647c(cols_at_size_);
4816
- const products_to_rows = products => {
4817
- const cols_currently_showing = n_cols_currently_showing_();
4818
- if (cols_currently_showing === null) return 0;
4819
- return Math.ceil(products / cols_currently_showing);
4820
- };
4821
- const showing_rows = $9HbP8$createMemo(() => products_to_rows(number_of_items_shown_()));
4822
4813
  $9HbP8$createEffect(() => {
4823
4814
  const incoming_value = incoming_content_blocks();
4824
4815
  if (!incoming_value) {
4825
4816
  set_content_blocks([]);
4826
4817
  return;
4827
4818
  }
4828
- const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
4829
- set_content_blocks($9HbP8$reconcile(capped_value, {
4819
+ set_content_blocks($9HbP8$reconcile(incoming_value, {
4830
4820
  key: "content"
4831
4821
  })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
4832
4822
  });
@@ -4883,12 +4873,12 @@ function $e7a7eb102ddc0c79$var$remap_blocks_to_index({
4883
4873
  for (let j = 0; j < i; j++) {
4884
4874
  const row = displaced_products[j];
4885
4875
  if (row === undefined) continue; // there were no blocks in this row
4886
- let items_in_row;
4887
- if (typeof row === "number") items_in_row = row;else {
4888
- items_in_row = row.filter(item => item).length;
4889
- displaced_products[j] = items_in_row;
4876
+ let displaced_items_in_row;
4877
+ if (typeof row === "number") displaced_items_in_row = row;else {
4878
+ displaced_items_in_row = row.filter(item => item).length;
4879
+ displaced_products[j] = displaced_items_in_row;
4890
4880
  }
4891
- displacement_by_added_blocks += items_in_row;
4881
+ displacement_by_added_blocks += displaced_items_in_row;
4892
4882
  }
4893
4883
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
4894
4884
  for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products[i]?.[j])
@@ -4926,9 +4916,12 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
4926
4916
  const get_wrapped_blocks = $9HbP8$mapArray(() => rendered_content_blocks, block => {
4927
4917
  if (!block) return;
4928
4918
  const get_span_columns = () => Math.min(block.span_columns, max_span_columns() ?? Infinity);
4929
- return $9HbP8$mergeProps1(block, {
4930
- // Create content divs for the blocks with as much fine-grained diffing as possible?
4931
- content: (() => {
4919
+ const [rendering_delayed, set_rendering_delayed_] = $9HbP8$createSignal(true);
4920
+ const content = $9HbP8$createComponent((0, $9HbP8$Show), {
4921
+ get when() {
4922
+ return !rendering_delayed();
4923
+ },
4924
+ get children() {
4932
4925
  const _el$ = $9HbP8$getNextElement($e7a7eb102ddc0c79$var$_tmpl$);
4933
4926
  $9HbP8$insert(_el$, $9HbP8$createComponent($e7a7eb102ddc0c79$var$RenderContent, {
4934
4927
  get content() {
@@ -4951,7 +4944,16 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
4951
4944
  _v$3: undefined
4952
4945
  });
4953
4946
  return _el$;
4954
- })(),
4947
+ }
4948
+ });
4949
+ return $9HbP8$mergeProps1(block, {
4950
+ // Create content divs for the blocks with as much fine-grained diffing as possible?
4951
+ content: () => {
4952
+ // Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
4953
+ // However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
4954
+ set_rendering_delayed_(false);
4955
+ return content;
4956
+ },
4955
4957
  get span_columns() {
4956
4958
  // Cap max width of block to the number of columns available, for everyone downstream
4957
4959
  return get_span_columns();
@@ -5045,8 +5047,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
5045
5047
  let fallback_is_alive = false;
5046
5048
  const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $9HbP8$createSignal(true);
5047
5049
  const [top_row_shortened_by_, set_top_row_shortened_by_] = $9HbP8$createSignal(0);
5048
- const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $9HbP8$createSignal(false);
5049
- const [number_loaded_displays, set_number_loaded_displays_] = $9HbP8$createSignal(0);
5050
+ $9HbP8$createSignal(false);
5050
5051
  const modified_cols_at_size = $15aa76e6da02e5c2$export$cb5808ba002cdeed({
5051
5052
  layout_options_: layout_options_,
5052
5053
  sort_or_filter_open_: sort_or_filter_open_
@@ -5057,12 +5058,10 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
5057
5058
  for_id: for_id
5058
5059
  }) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
5059
5060
  });
5060
- const number_of_items_shown_ = $9HbP8$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
5061
5061
  const doesnt_have_content_blocks = $9HbP8$createMemo(() => !content_blocks_by_row_());
5062
5062
  const content_blocks_ = $9HbP8$createMemo(() => doesnt_have_content_blocks() ? () => [] : $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
5063
5063
  content_blocks_: content_blocks_by_row_,
5064
5064
  cols_at_size_: modified_cols_at_size,
5065
- number_of_items_shown_: number_of_items_shown_,
5066
5065
  set_top_row_shortened_by_: set_top_row_shortened_by_
5067
5066
  }));
5068
5067
  const rendered_placeholders = $9HbP8$createMemo(() => get_should_have_placeholders_rendered() ? $6e41f1fde994db72$export$f33414a4df0afd3f({
@@ -5102,8 +5101,6 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
5102
5101
  get fallback() {
5103
5102
  fallback_is_alive = true;
5104
5103
  $9HbP8$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
5105
- set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
5106
- $9HbP8$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
5107
5104
  return $9HbP8$createMemo(() => {
5108
5105
  // We need to be able to block the suspense since when async product cards are *rendering* we want to show the placeholders on initial load but not when loading more
5109
5106
  // In future we could have individual suspense's for each product card, but that's too much for now
@@ -5128,8 +5125,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
5128
5125
  query_base_: query_base_,
5129
5126
  depict_api_: depict_api_,
5130
5127
  is_loading_: is_loading_,
5131
- content_blocks_: content_blocks_,
5132
- set_number_loaded_displays_: set_number_loaded_displays_
5128
+ content_blocks_: content_blocks_
5133
5129
  });
5134
5130
  $9HbP8$onCleanup(() => suspense_contents = undefined);
5135
5131
  return suspense_contents;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "sass": "styles.scss",
@@ -76,7 +76,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
76
76
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
77
77
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
78
78
  /*! Depict.ai search and product listing SDK */
79
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.1";
79
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.2";
80
80
  const $a68b73fd7ba0853f$var$fallback_operator = "in";
81
81
  const $a68b73fd7ba0853f$var$fallback_token = "";
82
82
  const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
@@ -4056,8 +4056,7 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
4056
4056
  query_base_: query_base_,
4057
4057
  depict_api_: depict_api_,
4058
4058
  is_loading_: is_loading_,
4059
- content_blocks_: content_blocks_,
4060
- set_number_loaded_displays_: set_number_loaded_displays_
4059
+ content_blocks_: content_blocks_
4061
4060
  } = _ref;
4062
4061
  // The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
4063
4062
  const target_to_index_map = new Map();
@@ -4104,7 +4103,6 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
4104
4103
  query_base_: query_base_,
4105
4104
  depict_api_: depict_api_
4106
4105
  });
4107
- $3hooq$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
4108
4106
  return $76012c4468a53d1f$export$43f0fb951fcb0c54({
4109
4107
  displays_by_key_: displays_by_key_,
4110
4108
  merchant_: merchant_,
@@ -4299,26 +4297,18 @@ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
4299
4297
  let {
4300
4298
  content_blocks_: incoming_content_blocks,
4301
4299
  cols_at_size_: cols_at_size_,
4302
- number_of_items_shown_: number_of_items_shown_,
4303
4300
  set_top_row_shortened_by_: set_top_row_shortened_by_
4304
4301
  } = _ref;
4305
4302
  // these are by row
4306
4303
  const [content_blocks, set_content_blocks] = $3hooq$solidjsstore.createStore([]);
4307
4304
  const n_cols_currently_showing_ = $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_);
4308
- const products_to_rows = products => {
4309
- const cols_currently_showing = n_cols_currently_showing_();
4310
- if (cols_currently_showing === null) return 0;
4311
- return Math.ceil(products / cols_currently_showing);
4312
- };
4313
- const showing_rows = $3hooq$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
4314
4305
  $3hooq$solidjs.createEffect(() => {
4315
4306
  const incoming_value = incoming_content_blocks();
4316
4307
  if (!incoming_value) {
4317
4308
  set_content_blocks([]);
4318
4309
  return;
4319
4310
  }
4320
- const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
4321
- set_content_blocks($3hooq$solidjsstore.reconcile(capped_value, {
4311
+ set_content_blocks($3hooq$solidjsstore.reconcile(incoming_value, {
4322
4312
  key: "content"
4323
4313
  })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
4324
4314
  });
@@ -4376,12 +4366,12 @@ function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
4376
4366
  for (let j = 0; j < i; j++) {
4377
4367
  const row = displaced_products[j];
4378
4368
  if (row === undefined) continue; // there were no blocks in this row
4379
- let items_in_row;
4380
- if (typeof row === "number") items_in_row = row;else {
4381
- items_in_row = row.filter(item => item).length;
4382
- displaced_products[j] = items_in_row;
4369
+ let displaced_items_in_row;
4370
+ if (typeof row === "number") displaced_items_in_row = row;else {
4371
+ displaced_items_in_row = row.filter(item => item).length;
4372
+ displaced_products[j] = displaced_items_in_row;
4383
4373
  }
4384
- displacement_by_added_blocks += items_in_row;
4374
+ displacement_by_added_blocks += displaced_items_in_row;
4385
4375
  }
4386
4376
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
4387
4377
  for (let j = 0; j < index_of_us_in_row; j++) {
@@ -4426,13 +4416,27 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
4426
4416
  var _max_span_columns;
4427
4417
  return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
4428
4418
  };
4419
+ const [rendering_delayed, set_rendering_delayed_] = $3hooq$solidjs.createSignal(true);
4420
+ const content = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
4421
+ get when() {
4422
+ return !rendering_delayed();
4423
+ },
4424
+ get children() {
4425
+ return $3hooq$solidjsweb.ssr($f8f375d6245ffff2$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "grid-column:" + "span ".concat($3hooq$solidjsweb.escape(get_span_columns(), true)) + (";grid-row:" + "span ".concat($3hooq$solidjsweb.escape(block.span_rows, true))) + (";spans_columns_variable_name:" + $3hooq$solidjsweb.escape(get_span_columns(), true)), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
4426
+ get content() {
4427
+ return block.content;
4428
+ }
4429
+ })));
4430
+ }
4431
+ });
4429
4432
  return $3hooq$solidjs.mergeProps(block, {
4430
4433
  // Create content divs for the blocks with as much fine-grained diffing as possible?
4431
- content: $3hooq$solidjsweb.ssr($f8f375d6245ffff2$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "grid-column:" + "span ".concat($3hooq$solidjsweb.escape(get_span_columns(), true)) + (";grid-row:" + "span ".concat($3hooq$solidjsweb.escape(block.span_rows, true))) + (";spans_columns_variable_name:" + $3hooq$solidjsweb.escape(get_span_columns(), true)), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
4432
- get content() {
4433
- return block.content;
4434
- }
4435
- }))),
4434
+ content: () => {
4435
+ // Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
4436
+ // However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
4437
+ set_rendering_delayed_(false);
4438
+ return content;
4439
+ },
4436
4440
  get span_columns() {
4437
4441
  // Cap max width of block to the number of columns available, for everyone downstream
4438
4442
  return get_span_columns();
@@ -4523,8 +4527,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
4523
4527
  let fallback_is_alive = false;
4524
4528
  const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $3hooq$solidjs.createSignal(true);
4525
4529
  const [top_row_shortened_by_, set_top_row_shortened_by_] = $3hooq$solidjs.createSignal(0);
4526
- const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $3hooq$solidjs.createSignal(false);
4527
- const [number_loaded_displays, set_number_loaded_displays_] = $3hooq$solidjs.createSignal(0);
4530
+ $3hooq$solidjs.createSignal(false);
4528
4531
  const modified_cols_at_size = $c749e60bca5000cb$export$cb5808ba002cdeed({
4529
4532
  layout_options_: layout_options_,
4530
4533
  sort_or_filter_open_: sort_or_filter_open_
@@ -4539,12 +4542,10 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
4539
4542
  return for_id === id_currently_querying_for_();
4540
4543
  })) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
4541
4544
  });
4542
- const number_of_items_shown_ = $3hooq$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
4543
4545
  const doesnt_have_content_blocks = $3hooq$solidjs.createMemo(() => !content_blocks_by_row_());
4544
4546
  const content_blocks_ = $3hooq$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $f8f375d6245ffff2$export$791ef57e62e21c3f({
4545
4547
  content_blocks_: content_blocks_by_row_,
4546
4548
  cols_at_size_: modified_cols_at_size,
4547
- number_of_items_shown_: number_of_items_shown_,
4548
4549
  set_top_row_shortened_by_: set_top_row_shortened_by_
4549
4550
  }));
4550
4551
  const rendered_placeholders = $3hooq$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $e3915574cfd3466c$export$f33414a4df0afd3f({
@@ -4584,8 +4585,6 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
4584
4585
  get fallback() {
4585
4586
  fallback_is_alive = true;
4586
4587
  $3hooq$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
4587
- set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
4588
- $3hooq$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
4589
4588
  return $3hooq$solidjs.createMemo(() => {
4590
4589
  // We need to be able to block the suspense since when async product cards are *rendering* we want to show the placeholders on initial load but not when loading more
4591
4590
  // In future we could have individual suspense's for each product card, but that's too much for now
@@ -4610,8 +4609,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
4610
4609
  query_base_: query_base_,
4611
4610
  depict_api_: depict_api_,
4612
4611
  is_loading_: is_loading_,
4613
- content_blocks_: content_blocks_,
4614
- set_number_loaded_displays_: set_number_loaded_displays_
4612
+ content_blocks_: content_blocks_
4615
4613
  });
4616
4614
  $3hooq$solidjs.onCleanup(() => suspense_contents = undefined);
4617
4615
  return suspense_contents;
@@ -6,8 +6,8 @@ import { BaseCategoryDisplay, ProductListingResponse } from "@depict-ai/types/ap
6
6
  import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/api/SearchSuggestionsResponse";
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
- import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.1.1";
9
+ import { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
10
+ export const version = "2.1.2";
11
11
  /**
12
12
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
13
13
  */
@@ -55,7 +55,7 @@ export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlac
55
55
  * The interface for a content block.
56
56
  * Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
57
57
  * The height of the content block will be the height of the tallest item in a row, so if there are no products in a row the content block needs to "bring its own height".
58
- * If you need to load any data in the content block, please make sure to return a placeholder while you're doing so, to avoid layout shifts and ensure scroll restoration works correctly.
58
+ * If you need to load any data in the content block, please make sure to return a placeholder while you're doing so (see `ImagePlaceholder`), to avoid layout shifts and ensure scroll restoration works correctly.
59
59
  *
60
60
  * - `span_columns`: How many columns the block should span. This will be capped to the number of columns available.
61
61
  * - `span_rows`: How many rows the block should span.
@@ -670,7 +670,7 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
670
670
  query(input_req: SearchRequest): Promise<SearchResponseAfterURLCreator & {
671
671
  failed?: true;
672
672
  }>;
673
- list(input_req: ProductListingRequest): Promise<ProductListingResponseAfterURLCreator & {
673
+ list(input_req: ProductListingRequestV2): Promise<ProductListingResponseAfterURLCreator & {
674
674
  failed?: true;
675
675
  }>;
676
676
  get_recommended<T extends Display>(input_req: BaseSearchRequest): Promise<{
@@ -9,7 +9,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from
9
9
  /*! Depict.ai search and product listing SDK */
10
10
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
11
11
  register_es_version("ui", "ES10");
12
- const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.1";
12
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.2";
13
13
  const $2855bffe06ef7a03$var$fallback_operator = "in";
14
14
  const $2855bffe06ef7a03$var$fallback_token = "";
15
15
  const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
@@ -3989,8 +3989,7 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
3989
3989
  query_base_: query_base_,
3990
3990
  depict_api_: depict_api_,
3991
3991
  is_loading_: is_loading_,
3992
- content_blocks_: content_blocks_,
3993
- set_number_loaded_displays_: set_number_loaded_displays_
3992
+ content_blocks_: content_blocks_
3994
3993
  } = _ref;
3995
3994
  // The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
3996
3995
  const target_to_index_map = new Map();
@@ -4037,7 +4036,6 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
4037
4036
  query_base_: query_base_,
4038
4037
  depict_api_: depict_api_
4039
4038
  });
4040
- $b8hua$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
4041
4039
  return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
4042
4040
  displays_by_key_: displays_by_key_,
4043
4041
  merchant_: merchant_,
@@ -4232,26 +4230,18 @@ function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
4232
4230
  let {
4233
4231
  content_blocks_: incoming_content_blocks,
4234
4232
  cols_at_size_: cols_at_size_,
4235
- number_of_items_shown_: number_of_items_shown_,
4236
4233
  set_top_row_shortened_by_: set_top_row_shortened_by_
4237
4234
  } = _ref;
4238
4235
  // these are by row
4239
4236
  const [content_blocks, set_content_blocks] = $b8hua$createStore([]);
4240
4237
  const n_cols_currently_showing_ = $8244fdad249f8d5f$export$a79e666719b3647c(cols_at_size_);
4241
- const products_to_rows = products => {
4242
- const cols_currently_showing = n_cols_currently_showing_();
4243
- if (cols_currently_showing === null) return 0;
4244
- return Math.ceil(products / cols_currently_showing);
4245
- };
4246
- const showing_rows = $b8hua$createMemo(() => products_to_rows(number_of_items_shown_()));
4247
4238
  $b8hua$createEffect(() => {
4248
4239
  const incoming_value = incoming_content_blocks();
4249
4240
  if (!incoming_value) {
4250
4241
  set_content_blocks([]);
4251
4242
  return;
4252
4243
  }
4253
- const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
4254
- set_content_blocks($b8hua$reconcile(capped_value, {
4244
+ set_content_blocks($b8hua$reconcile(incoming_value, {
4255
4245
  key: "content"
4256
4246
  })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
4257
4247
  });
@@ -4309,12 +4299,12 @@ function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
4309
4299
  for (let j = 0; j < i; j++) {
4310
4300
  const row = displaced_products[j];
4311
4301
  if (row === undefined) continue; // there were no blocks in this row
4312
- let items_in_row;
4313
- if (typeof row === "number") items_in_row = row;else {
4314
- items_in_row = row.filter(item => item).length;
4315
- displaced_products[j] = items_in_row;
4302
+ let displaced_items_in_row;
4303
+ if (typeof row === "number") displaced_items_in_row = row;else {
4304
+ displaced_items_in_row = row.filter(item => item).length;
4305
+ displaced_products[j] = displaced_items_in_row;
4316
4306
  }
4317
- displacement_by_added_blocks += items_in_row;
4307
+ displacement_by_added_blocks += displaced_items_in_row;
4318
4308
  }
4319
4309
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
4320
4310
  for (let j = 0; j < index_of_us_in_row; j++) {
@@ -4359,13 +4349,27 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
4359
4349
  var _max_span_columns;
4360
4350
  return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
4361
4351
  };
4352
+ const [rendering_delayed, set_rendering_delayed_] = $b8hua$createSignal(true);
4353
+ const content = $b8hua$createComponent((0, $b8hua$Show), {
4354
+ get when() {
4355
+ return !rendering_delayed();
4356
+ },
4357
+ get children() {
4358
+ return $b8hua$ssr($ff7feae4dddd6073$var$_tmpl$, $b8hua$ssrHydrationKey(), "grid-column:" + "span ".concat($b8hua$escape(get_span_columns(), true)) + (";grid-row:" + "span ".concat($b8hua$escape(block.span_rows, true))) + (";spans_columns_variable_name:" + $b8hua$escape(get_span_columns(), true)), $b8hua$escape($b8hua$createComponent($ff7feae4dddd6073$var$RenderContent, {
4359
+ get content() {
4360
+ return block.content;
4361
+ }
4362
+ })));
4363
+ }
4364
+ });
4362
4365
  return $b8hua$mergeProps1(block, {
4363
4366
  // Create content divs for the blocks with as much fine-grained diffing as possible?
4364
- content: $b8hua$ssr($ff7feae4dddd6073$var$_tmpl$, $b8hua$ssrHydrationKey(), "grid-column:" + "span ".concat($b8hua$escape(get_span_columns(), true)) + (";grid-row:" + "span ".concat($b8hua$escape(block.span_rows, true))) + (";spans_columns_variable_name:" + $b8hua$escape(get_span_columns(), true)), $b8hua$escape($b8hua$createComponent($ff7feae4dddd6073$var$RenderContent, {
4365
- get content() {
4366
- return block.content;
4367
- }
4368
- }))),
4367
+ content: () => {
4368
+ // Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
4369
+ // However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
4370
+ set_rendering_delayed_(false);
4371
+ return content;
4372
+ },
4369
4373
  get span_columns() {
4370
4374
  // Cap max width of block to the number of columns available, for everyone downstream
4371
4375
  return get_span_columns();
@@ -4456,8 +4460,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
4456
4460
  let fallback_is_alive = false;
4457
4461
  const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $b8hua$createSignal(true);
4458
4462
  const [top_row_shortened_by_, set_top_row_shortened_by_] = $b8hua$createSignal(0);
4459
- const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $b8hua$createSignal(false);
4460
- const [number_loaded_displays, set_number_loaded_displays_] = $b8hua$createSignal(0);
4463
+ $b8hua$createSignal(false);
4461
4464
  const modified_cols_at_size = $b2dbaafb23d00c7f$export$cb5808ba002cdeed({
4462
4465
  layout_options_: layout_options_,
4463
4466
  sort_or_filter_open_: sort_or_filter_open_
@@ -4472,12 +4475,10 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
4472
4475
  return for_id === id_currently_querying_for_();
4473
4476
  })) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
4474
4477
  });
4475
- const number_of_items_shown_ = $b8hua$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
4476
4478
  const doesnt_have_content_blocks = $b8hua$createMemo(() => !content_blocks_by_row_());
4477
4479
  const content_blocks_ = $b8hua$createMemo(() => doesnt_have_content_blocks() ? () => [] : $ff7feae4dddd6073$export$791ef57e62e21c3f({
4478
4480
  content_blocks_: content_blocks_by_row_,
4479
4481
  cols_at_size_: modified_cols_at_size,
4480
- number_of_items_shown_: number_of_items_shown_,
4481
4482
  set_top_row_shortened_by_: set_top_row_shortened_by_
4482
4483
  }));
4483
4484
  const rendered_placeholders = $b8hua$createMemo(() => get_should_have_placeholders_rendered() ? $bdd80c7862246dc2$export$f33414a4df0afd3f({
@@ -4517,8 +4518,6 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
4517
4518
  get fallback() {
4518
4519
  fallback_is_alive = true;
4519
4520
  $b8hua$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
4520
- set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
4521
- $b8hua$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
4522
4521
  return $b8hua$createMemo(() => {
4523
4522
  // We need to be able to block the suspense since when async product cards are *rendering* we want to show the placeholders on initial load but not when loading more
4524
4523
  // In future we could have individual suspense's for each product card, but that's too much for now
@@ -4543,8 +4542,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
4543
4542
  query_base_: query_base_,
4544
4543
  depict_api_: depict_api_,
4545
4544
  is_loading_: is_loading_,
4546
- content_blocks_: content_blocks_,
4547
- set_number_loaded_displays_: set_number_loaded_displays_
4545
+ content_blocks_: content_blocks_
4548
4546
  });
4549
4547
  $b8hua$onCleanup(() => suspense_contents = undefined);
4550
4548
  return suspense_contents;
@@ -70,7 +70,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
70
70
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
71
71
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
72
72
  /*! Depict.ai search and product listing SDK */
73
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.1";
73
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.2";
74
74
  const $1ab22f2cd39b3061$var$fallback_operator = "in";
75
75
  const $1ab22f2cd39b3061$var$fallback_token = "";
76
76
  const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
@@ -3755,8 +3755,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
3755
3755
  query_base_: query_base_,
3756
3756
  depict_api_: depict_api_,
3757
3757
  is_loading_: is_loading_,
3758
- content_blocks_: content_blocks_,
3759
- set_number_loaded_displays_: set_number_loaded_displays_
3758
+ content_blocks_: content_blocks_
3760
3759
  }) {
3761
3760
  // The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
3762
3761
  const target_to_index_map = new Map();
@@ -3800,7 +3799,6 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
3800
3799
  query_base_: query_base_,
3801
3800
  depict_api_: depict_api_
3802
3801
  });
3803
- $5vyXB$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
3804
3802
  return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
3805
3803
  displays_by_key_: displays_by_key_,
3806
3804
  merchant_: merchant_,
@@ -3983,26 +3981,18 @@ const $d92f338ba8f9da9b$var$_tmpl$ = ["<div", ' class="content-block-wrapper" st
3983
3981
  function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
3984
3982
  content_blocks_: incoming_content_blocks,
3985
3983
  cols_at_size_: cols_at_size_,
3986
- number_of_items_shown_: number_of_items_shown_,
3987
3984
  set_top_row_shortened_by_: set_top_row_shortened_by_
3988
3985
  }) {
3989
3986
  // these are by row
3990
3987
  const [content_blocks, set_content_blocks] = $5vyXB$solidjsstore.createStore([]);
3991
3988
  const n_cols_currently_showing_ = $055384b985678603$export$a79e666719b3647c(cols_at_size_);
3992
- const products_to_rows = products => {
3993
- const cols_currently_showing = n_cols_currently_showing_();
3994
- if (cols_currently_showing === null) return 0;
3995
- return Math.ceil(products / cols_currently_showing);
3996
- };
3997
- const showing_rows = $5vyXB$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
3998
3989
  $5vyXB$solidjs.createEffect(() => {
3999
3990
  const incoming_value = incoming_content_blocks();
4000
3991
  if (!incoming_value) {
4001
3992
  set_content_blocks([]);
4002
3993
  return;
4003
3994
  }
4004
- const capped_value = incoming_value.slice(0, showing_rows()); // Don't show more content blocks than we have rows
4005
- set_content_blocks($5vyXB$solidjsstore.reconcile(capped_value, {
3995
+ set_content_blocks($5vyXB$solidjsstore.reconcile(incoming_value, {
4006
3996
  key: "content"
4007
3997
  })); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
4008
3998
  });
@@ -4059,12 +4049,12 @@ function $d92f338ba8f9da9b$var$remap_blocks_to_index({
4059
4049
  for (let j = 0; j < i; j++) {
4060
4050
  const row = displaced_products[j];
4061
4051
  if (row === undefined) continue; // there were no blocks in this row
4062
- let items_in_row;
4063
- if (typeof row === "number") items_in_row = row;else {
4064
- items_in_row = row.filter(item => item).length;
4065
- displaced_products[j] = items_in_row;
4052
+ let displaced_items_in_row;
4053
+ if (typeof row === "number") displaced_items_in_row = row;else {
4054
+ displaced_items_in_row = row.filter(item => item).length;
4055
+ displaced_products[j] = displaced_items_in_row;
4066
4056
  }
4067
- displacement_by_added_blocks += items_in_row;
4057
+ displacement_by_added_blocks += displaced_items_in_row;
4068
4058
  }
4069
4059
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
4070
4060
  for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products[i]?.[j])
@@ -4102,13 +4092,27 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
4102
4092
  const get_wrapped_blocks = $5vyXB$solidjs.mapArray(() => rendered_content_blocks, block => {
4103
4093
  if (!block) return;
4104
4094
  const get_span_columns = () => Math.min(block.span_columns, max_span_columns() ?? Infinity);
4095
+ const [rendering_delayed, set_rendering_delayed_] = $5vyXB$solidjs.createSignal(true);
4096
+ const content = $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
4097
+ get when() {
4098
+ return !rendering_delayed();
4099
+ },
4100
+ get children() {
4101
+ return $5vyXB$solidjsweb.ssr($d92f338ba8f9da9b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), "grid-column:" + `span ${$5vyXB$solidjsweb.escape(get_span_columns(), true)}` + (";grid-row:" + `span ${$5vyXB$solidjsweb.escape(block.span_rows, true)}`) + (";spans_columns_variable_name:" + $5vyXB$solidjsweb.escape(get_span_columns(), true)), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent($d92f338ba8f9da9b$var$RenderContent, {
4102
+ get content() {
4103
+ return block.content;
4104
+ }
4105
+ })));
4106
+ }
4107
+ });
4105
4108
  return $5vyXB$solidjs.mergeProps(block, {
4106
4109
  // Create content divs for the blocks with as much fine-grained diffing as possible?
4107
- content: $5vyXB$solidjsweb.ssr($d92f338ba8f9da9b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), "grid-column:" + `span ${$5vyXB$solidjsweb.escape(get_span_columns(), true)}` + (";grid-row:" + `span ${$5vyXB$solidjsweb.escape(block.span_rows, true)}`) + (";spans_columns_variable_name:" + $5vyXB$solidjsweb.escape(get_span_columns(), true)), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent($d92f338ba8f9da9b$var$RenderContent, {
4108
- get content() {
4109
- return block.content;
4110
- }
4111
- }))),
4110
+ content: () => {
4111
+ // Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
4112
+ // However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
4113
+ set_rendering_delayed_(false);
4114
+ return content;
4115
+ },
4112
4116
  get span_columns() {
4113
4117
  // Cap max width of block to the number of columns available, for everyone downstream
4114
4118
  return get_span_columns();
@@ -4196,8 +4200,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
4196
4200
  let fallback_is_alive = false;
4197
4201
  const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $5vyXB$solidjs.createSignal(true);
4198
4202
  const [top_row_shortened_by_, set_top_row_shortened_by_] = $5vyXB$solidjs.createSignal(0);
4199
- const [product_card_suspense_is_in_fallback, set_product_card_suspense_is_in_fallback] = $5vyXB$solidjs.createSignal(false);
4200
- const [number_loaded_displays, set_number_loaded_displays_] = $5vyXB$solidjs.createSignal(0);
4203
+ $5vyXB$solidjs.createSignal(false);
4201
4204
  const modified_cols_at_size = $738c3a81fc46a340$export$cb5808ba002cdeed({
4202
4205
  layout_options_: layout_options_,
4203
4206
  sort_or_filter_open_: sort_or_filter_open_
@@ -4208,12 +4211,10 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
4208
4211
  for_id: for_id
4209
4212
  }) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
4210
4213
  });
4211
- const number_of_items_shown_ = $5vyXB$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
4212
4214
  const doesnt_have_content_blocks = $5vyXB$solidjs.createMemo(() => !content_blocks_by_row_());
4213
4215
  const content_blocks_ = $5vyXB$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $d92f338ba8f9da9b$export$791ef57e62e21c3f({
4214
4216
  content_blocks_: content_blocks_by_row_,
4215
4217
  cols_at_size_: modified_cols_at_size,
4216
- number_of_items_shown_: number_of_items_shown_,
4217
4218
  set_top_row_shortened_by_: set_top_row_shortened_by_
4218
4219
  }));
4219
4220
  const rendered_placeholders = $5vyXB$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $0caf87eaa19079da$export$f33414a4df0afd3f({
@@ -4253,8 +4254,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
4253
4254
  get fallback() {
4254
4255
  fallback_is_alive = true;
4255
4256
  $5vyXB$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
4256
- set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
4257
- $5vyXB$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
4258
4257
  return $5vyXB$solidjs.createMemo(() => {
4259
4258
  // We need to be able to block the suspense since when async product cards are *rendering* we want to show the placeholders on initial load but not when loading more
4260
4259
  // In future we could have individual suspense's for each product card, but that's too much for now
@@ -4279,8 +4278,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
4279
4278
  query_base_: query_base_,
4280
4279
  depict_api_: depict_api_,
4281
4280
  is_loading_: is_loading_,
4282
- content_blocks_: content_blocks_,
4283
- set_number_loaded_displays_: set_number_loaded_displays_
4281
+ content_blocks_: content_blocks_
4284
4282
  });
4285
4283
  $5vyXB$solidjs.onCleanup(() => suspense_contents = undefined);
4286
4284
  return suspense_contents;