@depict-ai/ui 4.8.4 → 4.8.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.
@@ -10,7 +10,7 @@ import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.8.4";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.8.5";
14
14
  function $4be619ec2cd7bba3$export$54c6d6ff54e72743(whatToWatch) {
15
15
  const [width, setWidth] = $b8hua$createSignal(0);
16
16
  const [height, setHeight] = $b8hua$createSignal(0);
@@ -2660,10 +2660,10 @@ function $43fbdca0f726a34b$export$92f2da32c6e7e7ee(_ref) {
2660
2660
  i18n_: i18n_
2661
2661
  } = _ref;
2662
2662
  return $b8hua$createMemo(() => {
2663
- const n_hits = number_();
2664
- if (isNaN(n_hits)) return "";
2663
+ const numberToFormat = number_();
2664
+ if (isNaN(numberToFormat)) return "";
2665
2665
  const price_formatting = i18n_.price_formatting_();
2666
- return $b8hua$standard_price_format(n_hits, 0,
2666
+ return $b8hua$standard_price_format(numberToFormat, 0,
2667
2667
  // we never want places after comma here it looks weird as hell
2668
2668
  price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
2669
2669
  });
@@ -4619,9 +4619,10 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
4619
4619
  });
4620
4620
  // total number of results = content results + product results + category suggestions
4621
4621
  const totalNumberResults = $b8hua$createMemo(() => {
4622
- var _get_modal_search_res4, _results$content_sear, _listing_suggestions_;
4622
+ var _get_modal_search_res4, _results$displays, _results$content_sear, _listing_suggestions_;
4623
4623
  const results = (_get_modal_search_res4 = get_modal_search_results_()) === null || _get_modal_search_res4 === void 0 ? void 0 : _get_modal_search_res4();
4624
- const hits = results === null || results === void 0 ? void 0 : results.n_hits;
4624
+ // Show actual number of result (more accurate) if there's no cursor (backend doesn't have more products)
4625
+ const hits = results !== null && results !== void 0 && results.cursor ? results === null || results === void 0 ? void 0 : results.n_hits : results === null || results === void 0 ? void 0 : (_results$displays = results.displays) === null || _results$displays === void 0 ? void 0 : _results$displays.length;
4625
4626
  const content_results = content_search_enabled_() && (results === null || results === void 0 ? void 0 : (_results$content_sear = results.content_search_links) === null || _results$content_sear === void 0 ? void 0 : _results$content_sear.length) || 0;
4626
4627
  const category_results = ((_listing_suggestions_ = listing_suggestions_()) === null || _listing_suggestions_ === void 0 ? void 0 : _listing_suggestions_.length) || 0;
4627
4628
  return (hits !== null && hits !== void 0 ? hits : 0) + content_results + category_results;
@@ -9826,7 +9827,8 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
9826
9827
  query_base_: query_base_,
9827
9828
  depict_api_: depict_api_,
9828
9829
  is_loading_: is_loading_,
9829
- content_blocks_: content_blocks_
9830
+ content_blocks_: content_blocks_,
9831
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
9830
9832
  } = _ref;
9831
9833
  // Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
9832
9834
  const [get_extra_displays, set_extra_displays_] = $b8hua$createSignal([], {
@@ -9853,6 +9855,7 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
9853
9855
  is_loading_: is_loading_,
9854
9856
  get_extra_displays: get_extra_displays
9855
9857
  });
9858
+ $b8hua$createComputed(() => setCurrentlyLoadedDisplays_(displays_by_key_().size));
9856
9859
  $6d2962bc9370f884$export$5e4aed86c12acdd9({
9857
9860
  percentage_in_view_: percentage_in_view_,
9858
9861
  set_extra_displays_: set_extra_displays_,
@@ -9998,7 +10001,8 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
9998
10001
  layout_options_: layout_options_,
9999
10002
  id_currently_querying_for_: id_currently_querying_for_,
10000
10003
  content_blocks_by_row_: content_blocks_by_row_,
10001
- ConfiguredScrollStatus_: ConfiguredScrollStatus_
10004
+ ConfiguredScrollStatus_: ConfiguredScrollStatus_,
10005
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
10002
10006
  } = _ref;
10003
10007
  // The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
10004
10008
  const is_loading_ = $b8hua$createMemo(() => plp_results_.loading || query_base_.loading);
@@ -10129,7 +10133,8 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
10129
10133
  query_base_: query_base_,
10130
10134
  depict_api_: depict_api_,
10131
10135
  is_loading_: is_loading_,
10132
- content_blocks_: content_blocks_
10136
+ content_blocks_: content_blocks_,
10137
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
10133
10138
  });
10134
10139
  $b8hua$onCleanup(() => suspense_contents = undefined);
10135
10140
  return suspense_contents;
@@ -11502,6 +11507,17 @@ function $937791b86d3d1509$export$44f738469d5570cf(_ref) {
11502
11507
  };
11503
11508
  });
11504
11509
  }
11510
+ function $0728458b46ee9d32$export$a86bc18439445599(plp_products_, _ref, currentlyLoadedDisplays) {
11511
+ let [allProductsLoaded] = _ref;
11512
+ return $b8hua$createMemo(() => {
11513
+ var _plp_products_;
11514
+ const backendSays = (_plp_products_ = plp_products_()) === null || _plp_products_ === void 0 ? void 0 : _plp_products_.n_hits;
11515
+ const loadedAll = allProductsLoaded();
11516
+ if (!backendSays || !loadedAll) return backendSays;
11517
+ // People can remove displays in the displayTransformers, for example houdini do it (https://depictaiworkspace.slack.com/archives/C061H2TF7K4/p1713261063439089). Correct the n_hits as well as possible in that case.
11518
+ return currentlyLoadedDisplays();
11519
+ });
11520
+ }
11505
11521
  var $da279c5a540c6846$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
11506
11522
  $da279c5a540c6846$var$_tmpl$2 = ["<div", ' class="', '"><div class="listing-page"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
11507
11523
  function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
@@ -11543,6 +11559,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
11543
11559
  } = _ref;
11544
11560
  const [get_sorting] = current_sorting_;
11545
11561
  const all_products_loaded_ = $b8hua$createSignal(false);
11562
+ const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $b8hua$createSignal(0);
11546
11563
  const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
11547
11564
  const number_of_rendered_selected_filters_items_ = $b8hua$createSignal(0);
11548
11565
  const first_result_in_viewport_ = $b8hua$createSignal();
@@ -11621,24 +11638,21 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
11621
11638
  const SafeSearchField = $b8hua$catchify((0, $584c06c09cf4609d$export$b94867ecbd698f21));
11622
11639
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $b8hua$createSignal(false);
11623
11640
  const [desktop_filter_elements_, set_desktop_filter_elements] = $b8hua$createSignal();
11624
- const n_hits = $b8hua$createMemo(() => {
11625
- var _search_results_3;
11626
- return (_search_results_3 = search_results_()) === null || _search_results_3 === void 0 ? void 0 : _search_results_3.n_hits;
11627
- });
11641
+ const countOfProductsForUI = $0728458b46ee9d32$export$a86bc18439445599(search_results_, all_products_loaded_, currentlyLoadedDisplays);
11628
11642
  const formatted_number_of_results_ = $43fbdca0f726a34b$export$92f2da32c6e7e7ee({
11629
- number_: n_hits,
11643
+ number_: countOfProductsForUI,
11630
11644
  i18n_: i18n_
11631
11645
  });
11632
11646
  const [sort_and_filter_element_, set_sort_and_filter_element_] = $b8hua$createSignal();
11633
11647
  const no_results_text_ = $b8hua$createMemo(() => {
11634
- var _search_results_4, _search_results_4$con;
11635
- return ((_search_results_4 = search_results_()) !== null && _search_results_4 !== void 0 && (_search_results_4$con = _search_results_4.content_search_links) !== null && _search_results_4$con !== void 0 && _search_results_4$con.length ? i18n_.no_products_ : i18n_.no_results_text_)();
11648
+ var _search_results_3, _search_results_3$con;
11649
+ return ((_search_results_3 = search_results_()) !== null && _search_results_3 !== void 0 && (_search_results_3$con = _search_results_3.content_search_links) !== null && _search_results_3$con !== void 0 && _search_results_3$con.length ? i18n_.no_products_ : i18n_.no_results_text_)();
11636
11650
  });
11637
11651
  const results_for = $b8hua$createComponent((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), $b8hua$mergeProps({
11638
11652
  get type() {
11639
11653
  return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).products;
11640
11654
  },
11641
- number_of_results_: n_hits
11655
+ number_of_results_: countOfProductsForUI
11642
11656
  }, {
11643
11657
  get_search_query_: get_search_query_,
11644
11658
  i18n_: i18n_,
@@ -11864,6 +11878,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
11864
11878
  sort_or_filter_open_: sort_or_filter_open_,
11865
11879
  id_currently_querying_for_: get_search_query_,
11866
11880
  content_blocks_by_row_: content_blocks_by_row_,
11881
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
11867
11882
  no_results_options_: {
11868
11883
  selected_filters_: selected_filters_,
11869
11884
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -11904,10 +11919,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
11904
11919
  last_result_in_viewport_: last_result_in_viewport_,
11905
11920
  formatted_number_of_results_: formatted_number_of_results_,
11906
11921
  i18n_: i18n_,
11907
- number_of_results_: $b8hua$createMemo(() => {
11908
- var _search_results_5;
11909
- return (_search_results_5 = search_results_()) === null || _search_results_5 === void 0 ? void 0 : _search_results_5.n_hits;
11910
- })
11922
+ number_of_results_: countOfProductsForUI
11911
11923
  });
11912
11924
  }
11913
11925
  })), $b8hua$escape($b8hua$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
@@ -13417,6 +13429,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13417
13429
  const number_of_rendered_selected_filters_items_ = $b8hua$createSignal(0);
13418
13430
  const first_result_in_viewport_ = $b8hua$createSignal();
13419
13431
  const last_result_in_viewport_ = $b8hua$createSignal();
13432
+ const all_products_loaded_ = $b8hua$createSignal(false);
13433
+ const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $b8hua$createSignal(0);
13420
13434
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $b8hua$createSignal(false);
13421
13435
  const products_query_base_ = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => {
13422
13436
  const sort_obj = get_sorting() && {
@@ -13463,6 +13477,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13463
13477
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
13464
13478
  const [plp_meta] = $b8hua$createResource(meta_query_base, $b8hua$catchify1(query => depict_api_.get_listing(query)));
13465
13479
  const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
13480
+ const countOfProductsForUI = $0728458b46ee9d32$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
13466
13481
  const available_sortings_ = $b8hua$createMemo(() => {
13467
13482
  var _plp_products_, _plp_products_$sorts;
13468
13483
  return (_plp_products_ = plp_products_()) === null || _plp_products_ === void 0 ? void 0 : (_plp_products_$sorts = _plp_products_.sorts) === null || _plp_products_$sorts === void 0 ? void 0 : _plp_products_$sorts.map(sort => {
@@ -13489,10 +13504,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13489
13504
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $b8hua$createSignal(false);
13490
13505
  const [desktop_filter_elements_, set_desktop_filter_elements] = $b8hua$createSignal();
13491
13506
  const formatted_number_of_results_ = $43fbdca0f726a34b$export$92f2da32c6e7e7ee({
13492
- number_: $b8hua$createMemo(() => {
13493
- var _plp_products_3;
13494
- return (_plp_products_3 = plp_products_()) === null || _plp_products_3 === void 0 ? void 0 : _plp_products_3.n_hits;
13495
- }),
13507
+ number_: countOfProductsForUI,
13496
13508
  i18n_: i18n_
13497
13509
  });
13498
13510
  const [sort_and_filter_element_, set_sort_and_filter_element_] = $b8hua$createSignal();
@@ -13515,10 +13527,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13515
13527
  last_result_in_viewport_: last_result_in_viewport_,
13516
13528
  formatted_number_of_results_: formatted_number_of_results_,
13517
13529
  i18n_: i18n_,
13518
- number_of_results_: $b8hua$createMemo(() => {
13519
- var _plp_products_4;
13520
- return (_plp_products_4 = plp_products_()) === null || _plp_products_4 === void 0 ? void 0 : _plp_products_4.n_hits;
13521
- }),
13530
+ number_of_results_: countOfProductsForUI,
13522
13531
  ...extraProps
13523
13532
  });
13524
13533
  }
@@ -13537,8 +13546,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13537
13546
  }
13538
13547
  })), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
13539
13548
  get when() {
13540
- var _plp_products_5;
13541
- return ((_plp_products_5 = plp_products_()) === null || _plp_products_5 === void 0 ? void 0 : _plp_products_5.n_hits) === 1;
13549
+ return countOfProductsForUI() === 1;
13542
13550
  },
13543
13551
  get fallback() {
13544
13552
  return i18n_.products_();
@@ -13712,6 +13720,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13712
13720
  content_blocks_by_row_: contentBlocksByRow,
13713
13721
  ConfiguredScrollStatus_: ConfiguredScrollStatus_,
13714
13722
  id_currently_querying_for_: id_to_query_for_,
13723
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
13724
+ all_products_loaded_: all_products_loaded_,
13715
13725
  no_results_options_: {
13716
13726
  selected_filters_: selected_filters_,
13717
13727
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -108,7 +108,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
108
108
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
109
109
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
110
110
  /*! Depict.ai search and product listing SDK */
111
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.4";
111
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.5";
112
112
  function $128302ab61dab8f1$export$54c6d6ff54e72743(whatToWatch) {
113
113
  const [width, setWidth] = $5vyXB$solidjs.createSignal(0);
114
114
  const [height, setHeight] = $5vyXB$solidjs.createSignal(0);
@@ -2616,10 +2616,10 @@ function $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
2616
2616
  i18n_: i18n_
2617
2617
  }) {
2618
2618
  return $5vyXB$solidjs.createMemo(() => {
2619
- const n_hits = number_();
2620
- if (isNaN(n_hits)) return "";
2619
+ const numberToFormat = number_();
2620
+ if (isNaN(numberToFormat)) return "";
2621
2621
  const price_formatting = i18n_.price_formatting_();
2622
- return $5vyXB$depictaiutilishared.standard_price_format(n_hits, 0,
2622
+ return $5vyXB$depictaiutilishared.standard_price_format(numberToFormat, 0,
2623
2623
  // we never want places after comma here it looks weird as hell
2624
2624
  price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
2625
2625
  });
@@ -4480,7 +4480,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
4480
4480
  // total number of results = content results + product results + category suggestions
4481
4481
  const totalNumberResults = $5vyXB$solidjs.createMemo(() => {
4482
4482
  const results = get_modal_search_results_()?.();
4483
- const hits = results?.n_hits;
4483
+ // Show actual number of result (more accurate) if there's no cursor (backend doesn't have more products)
4484
+ const hits = results?.cursor ? results?.n_hits : results?.displays?.length;
4484
4485
  const content_results = content_search_enabled_() && results?.content_search_links?.length || 0;
4485
4486
  const category_results = listing_suggestions_()?.length || 0;
4486
4487
  return (hits ?? 0) + content_results + category_results;
@@ -9291,7 +9292,8 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
9291
9292
  query_base_: query_base_,
9292
9293
  depict_api_: depict_api_,
9293
9294
  is_loading_: is_loading_,
9294
- content_blocks_: content_blocks_
9295
+ content_blocks_: content_blocks_,
9296
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
9295
9297
  }) {
9296
9298
  // Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
9297
9299
  const [get_extra_displays, set_extra_displays_] = $5vyXB$solidjs.createSignal([], {
@@ -9315,6 +9317,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
9315
9317
  is_loading_: is_loading_,
9316
9318
  get_extra_displays: get_extra_displays
9317
9319
  });
9320
+ $5vyXB$solidjs.createComputed(() => setCurrentlyLoadedDisplays_(displays_by_key_().size));
9318
9321
  $3f08fe2992a2a8ca$export$5e4aed86c12acdd9({
9319
9322
  percentage_in_view_: percentage_in_view_,
9320
9323
  set_extra_displays_: set_extra_displays_,
@@ -9452,7 +9455,8 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
9452
9455
  layout_options_: layout_options_,
9453
9456
  id_currently_querying_for_: id_currently_querying_for_,
9454
9457
  content_blocks_by_row_: content_blocks_by_row_,
9455
- ConfiguredScrollStatus_: ConfiguredScrollStatus_
9458
+ ConfiguredScrollStatus_: ConfiguredScrollStatus_,
9459
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
9456
9460
  }) {
9457
9461
  // The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
9458
9462
  const is_loading_ = $5vyXB$solidjs.createMemo(() => plp_results_.loading || query_base_.loading);
@@ -9577,7 +9581,8 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
9577
9581
  query_base_: query_base_,
9578
9582
  depict_api_: depict_api_,
9579
9583
  is_loading_: is_loading_,
9580
- content_blocks_: content_blocks_
9584
+ content_blocks_: content_blocks_,
9585
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
9581
9586
  });
9582
9587
  $5vyXB$solidjs.onCleanup(() => suspense_contents = undefined);
9583
9588
  return suspense_contents;
@@ -10869,6 +10874,15 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
10869
10874
  };
10870
10875
  });
10871
10876
  }
10877
+ function $13796d59ea8af231$export$a86bc18439445599(plp_products_, [allProductsLoaded], currentlyLoadedDisplays) {
10878
+ return $5vyXB$solidjs.createMemo(() => {
10879
+ const backendSays = plp_products_()?.n_hits;
10880
+ const loadedAll = allProductsLoaded();
10881
+ if (!backendSays || !loadedAll) return backendSays;
10882
+ // People can remove displays in the displayTransformers, for example houdini do it (https://depictaiworkspace.slack.com/archives/C061H2TF7K4/p1713261063439089). Correct the n_hits as well as possible in that case.
10883
+ return currentlyLoadedDisplays();
10884
+ });
10885
+ }
10872
10886
  var $f1d7cb69f839a526$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
10873
10887
  $f1d7cb69f839a526$var$_tmpl$2 = ["<div", ' class="', '"><div class="listing-page"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
10874
10888
  function $f1d7cb69f839a526$export$a54ec244c8863715({
@@ -10909,6 +10923,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
10909
10923
  }) {
10910
10924
  const [get_sorting] = current_sorting_;
10911
10925
  const all_products_loaded_ = $5vyXB$solidjs.createSignal(false);
10926
+ const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $5vyXB$solidjs.createSignal(0);
10912
10927
  const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
10913
10928
  const number_of_rendered_selected_filters_items_ = $5vyXB$solidjs.createSignal(0);
10914
10929
  const first_result_in_viewport_ = $5vyXB$solidjs.createSignal();
@@ -10978,9 +10993,9 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
10978
10993
  const SafeSearchField = $5vyXB$depictaiutilishared.catchify((0, $66b8b9a9613c141d$export$b94867ecbd698f21));
10979
10994
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $5vyXB$solidjs.createSignal(false);
10980
10995
  const [desktop_filter_elements_, set_desktop_filter_elements] = $5vyXB$solidjs.createSignal();
10981
- const n_hits = $5vyXB$solidjs.createMemo(() => search_results_()?.n_hits);
10996
+ const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(search_results_, all_products_loaded_, currentlyLoadedDisplays);
10982
10997
  const formatted_number_of_results_ = $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
10983
- number_: n_hits,
10998
+ number_: countOfProductsForUI,
10984
10999
  i18n_: i18n_
10985
11000
  });
10986
11001
  const [sort_and_filter_element_, set_sort_and_filter_element_] = $5vyXB$solidjs.createSignal();
@@ -10989,7 +11004,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
10989
11004
  get type() {
10990
11005
  return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).products;
10991
11006
  },
10992
- number_of_results_: n_hits
11007
+ number_of_results_: countOfProductsForUI
10993
11008
  }, {
10994
11009
  get_search_query_: get_search_query_,
10995
11010
  i18n_: i18n_,
@@ -11208,6 +11223,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
11208
11223
  sort_or_filter_open_: sort_or_filter_open_,
11209
11224
  id_currently_querying_for_: get_search_query_,
11210
11225
  content_blocks_by_row_: content_blocks_by_row_,
11226
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
11211
11227
  no_results_options_: {
11212
11228
  selected_filters_: selected_filters_,
11213
11229
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -11248,7 +11264,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
11248
11264
  last_result_in_viewport_: last_result_in_viewport_,
11249
11265
  formatted_number_of_results_: formatted_number_of_results_,
11250
11266
  i18n_: i18n_,
11251
- number_of_results_: $5vyXB$solidjs.createMemo(() => search_results_()?.n_hits)
11267
+ number_of_results_: countOfProductsForUI
11252
11268
  });
11253
11269
  }
11254
11270
  })), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
@@ -12545,6 +12561,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12545
12561
  const number_of_rendered_selected_filters_items_ = $5vyXB$solidjs.createSignal(0);
12546
12562
  const first_result_in_viewport_ = $5vyXB$solidjs.createSignal();
12547
12563
  const last_result_in_viewport_ = $5vyXB$solidjs.createSignal();
12564
+ const all_products_loaded_ = $5vyXB$solidjs.createSignal(false);
12565
+ const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $5vyXB$solidjs.createSignal(0);
12548
12566
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $5vyXB$solidjs.createSignal(false);
12549
12567
  const products_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
12550
12568
  const sort_obj = get_sorting() && {
@@ -12591,6 +12609,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12591
12609
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
12592
12610
  const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
12593
12611
  const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
12612
+ const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
12594
12613
  const available_sortings_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
12595
12614
  ...sort,
12596
12615
  order: sort.order ?? "desc"
@@ -12602,7 +12621,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12602
12621
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $5vyXB$solidjs.createSignal(false);
12603
12622
  const [desktop_filter_elements_, set_desktop_filter_elements] = $5vyXB$solidjs.createSignal();
12604
12623
  const formatted_number_of_results_ = $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
12605
- number_: $5vyXB$solidjs.createMemo(() => plp_products_()?.n_hits),
12624
+ number_: countOfProductsForUI,
12606
12625
  i18n_: i18n_
12607
12626
  });
12608
12627
  const [sort_and_filter_element_, set_sort_and_filter_element_] = $5vyXB$solidjs.createSignal();
@@ -12623,7 +12642,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12623
12642
  last_result_in_viewport_: last_result_in_viewport_,
12624
12643
  formatted_number_of_results_: formatted_number_of_results_,
12625
12644
  i18n_: i18n_,
12626
- number_of_results_: $5vyXB$solidjs.createMemo(() => plp_products_()?.n_hits),
12645
+ number_of_results_: countOfProductsForUI,
12627
12646
  ...extraProps
12628
12647
  });
12629
12648
  }
@@ -12641,7 +12660,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12641
12660
  }
12642
12661
  })), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
12643
12662
  get when() {
12644
- return plp_products_()?.n_hits === 1;
12663
+ return countOfProductsForUI() === 1;
12645
12664
  },
12646
12665
  get fallback() {
12647
12666
  return i18n_.products_();
@@ -12812,6 +12831,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12812
12831
  content_blocks_by_row_: contentBlocksByRow,
12813
12832
  ConfiguredScrollStatus_: ConfiguredScrollStatus_,
12814
12833
  id_currently_querying_for_: id_to_query_for_,
12834
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
12835
+ all_products_loaded_: all_products_loaded_,
12815
12836
  no_results_options_: {
12816
12837
  selected_filters_: selected_filters_,
12817
12838
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.8.4";
14
+ export const version = "4.8.5";
15
15
  /**
16
16
  * Returns two accessors (one width and one height) that will update when the size of the provided element changes, to be used with ResponsiveImg
17
17
  */
@@ -1506,7 +1506,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1506
1506
  * Open the modal with support for alignment.
1507
1507
  * @returns {void}
1508
1508
  */
1509
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1509
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1510
1510
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1511
1511
  export interface PageReplacer {
1512
1512
  readonly render_: () => Node_Array;
@@ -1585,5 +1585,5 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1585
1585
  content_blocks_by_row?: ContentBlocksByRow;
1586
1586
  layout?: PossibleLayout;
1587
1587
  filterModalParent_?: HTMLElement | ShadowRoot;
1588
- }): import("@depict-ai/utilishared").Node_Array;
1588
+ }): import("@depict-ai/utilishared/latest").Node_Array;
1589
1589
  export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";
@@ -7,7 +7,7 @@ import { dlog as $i7OB2$dlog, catchify as $i7OB2$catchify1, ListenableSet as $i7
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.4";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.5";
11
11
  function $a444a52bafa0dacc$export$54c6d6ff54e72743(whatToWatch) {
12
12
  const [width, setWidth] = $i7OB2$createSignal(0);
13
13
  const [height, setHeight] = $i7OB2$createSignal(0);
@@ -2515,10 +2515,10 @@ function $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
2515
2515
  i18n_: i18n_
2516
2516
  }) {
2517
2517
  return $i7OB2$createMemo(() => {
2518
- const n_hits = number_();
2519
- if (isNaN(n_hits)) return "";
2518
+ const numberToFormat = number_();
2519
+ if (isNaN(numberToFormat)) return "";
2520
2520
  const price_formatting = i18n_.price_formatting_();
2521
- return $i7OB2$standard_price_format(n_hits, 0,
2521
+ return $i7OB2$standard_price_format(numberToFormat, 0,
2522
2522
  // we never want places after comma here it looks weird as hell
2523
2523
  price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
2524
2524
  });
@@ -4379,7 +4379,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
4379
4379
  // total number of results = content results + product results + category suggestions
4380
4380
  const totalNumberResults = $i7OB2$createMemo(() => {
4381
4381
  const results = get_modal_search_results_()?.();
4382
- const hits = results?.n_hits;
4382
+ // Show actual number of result (more accurate) if there's no cursor (backend doesn't have more products)
4383
+ const hits = results?.cursor ? results?.n_hits : results?.displays?.length;
4383
4384
  const content_results = content_search_enabled_() && results?.content_search_links?.length || 0;
4384
4385
  const category_results = listing_suggestions_()?.length || 0;
4385
4386
  return (hits ?? 0) + content_results + category_results;
@@ -9190,7 +9191,8 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
9190
9191
  query_base_: query_base_,
9191
9192
  depict_api_: depict_api_,
9192
9193
  is_loading_: is_loading_,
9193
- content_blocks_: content_blocks_
9194
+ content_blocks_: content_blocks_,
9195
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
9194
9196
  }) {
9195
9197
  // Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
9196
9198
  const [get_extra_displays, set_extra_displays_] = $i7OB2$createSignal([], {
@@ -9214,6 +9216,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
9214
9216
  is_loading_: is_loading_,
9215
9217
  get_extra_displays: get_extra_displays
9216
9218
  });
9219
+ $i7OB2$createComputed(() => setCurrentlyLoadedDisplays_(displays_by_key_().size));
9217
9220
  $056f6ac0a6caa919$export$5e4aed86c12acdd9({
9218
9221
  percentage_in_view_: percentage_in_view_,
9219
9222
  set_extra_displays_: set_extra_displays_,
@@ -9351,7 +9354,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
9351
9354
  layout_options_: layout_options_,
9352
9355
  id_currently_querying_for_: id_currently_querying_for_,
9353
9356
  content_blocks_by_row_: content_blocks_by_row_,
9354
- ConfiguredScrollStatus_: ConfiguredScrollStatus_
9357
+ ConfiguredScrollStatus_: ConfiguredScrollStatus_,
9358
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
9355
9359
  }) {
9356
9360
  // The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
9357
9361
  const is_loading_ = $i7OB2$createMemo(() => plp_results_.loading || query_base_.loading);
@@ -9476,7 +9480,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
9476
9480
  query_base_: query_base_,
9477
9481
  depict_api_: depict_api_,
9478
9482
  is_loading_: is_loading_,
9479
- content_blocks_: content_blocks_
9483
+ content_blocks_: content_blocks_,
9484
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
9480
9485
  });
9481
9486
  $i7OB2$onCleanup(() => suspense_contents = undefined);
9482
9487
  return suspense_contents;
@@ -10768,6 +10773,15 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
10768
10773
  };
10769
10774
  });
10770
10775
  }
10776
+ function $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, [allProductsLoaded], currentlyLoadedDisplays) {
10777
+ return $i7OB2$createMemo(() => {
10778
+ const backendSays = plp_products_()?.n_hits;
10779
+ const loadedAll = allProductsLoaded();
10780
+ if (!backendSays || !loadedAll) return backendSays;
10781
+ // People can remove displays in the displayTransformers, for example houdini do it (https://depictaiworkspace.slack.com/archives/C061H2TF7K4/p1713261063439089). Correct the n_hits as well as possible in that case.
10782
+ return currentlyLoadedDisplays();
10783
+ });
10784
+ }
10771
10785
  var $7097477c78a89208$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
10772
10786
  $7097477c78a89208$var$_tmpl$2 = ["<div", ' class="', '"><div class="listing-page"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
10773
10787
  function $7097477c78a89208$export$a54ec244c8863715({
@@ -10808,6 +10822,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
10808
10822
  }) {
10809
10823
  const [get_sorting] = current_sorting_;
10810
10824
  const all_products_loaded_ = $i7OB2$createSignal(false);
10825
+ const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $i7OB2$createSignal(0);
10811
10826
  const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
10812
10827
  const number_of_rendered_selected_filters_items_ = $i7OB2$createSignal(0);
10813
10828
  const first_result_in_viewport_ = $i7OB2$createSignal();
@@ -10877,9 +10892,9 @@ function $7097477c78a89208$export$a54ec244c8863715({
10877
10892
  const SafeSearchField = $i7OB2$catchify((0, $5285d2814d0fac0c$export$b94867ecbd698f21));
10878
10893
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $i7OB2$createSignal(false);
10879
10894
  const [desktop_filter_elements_, set_desktop_filter_elements] = $i7OB2$createSignal();
10880
- const n_hits = $i7OB2$createMemo(() => search_results_()?.n_hits);
10895
+ const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(search_results_, all_products_loaded_, currentlyLoadedDisplays);
10881
10896
  const formatted_number_of_results_ = $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
10882
- number_: n_hits,
10897
+ number_: countOfProductsForUI,
10883
10898
  i18n_: i18n_
10884
10899
  });
10885
10900
  const [sort_and_filter_element_, set_sort_and_filter_element_] = $i7OB2$createSignal();
@@ -10888,7 +10903,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
10888
10903
  get type() {
10889
10904
  return (0, $f8c929beb82c512b$export$2452208c79fe93ea).products;
10890
10905
  },
10891
- number_of_results_: n_hits
10906
+ number_of_results_: countOfProductsForUI
10892
10907
  }, {
10893
10908
  get_search_query_: get_search_query_,
10894
10909
  i18n_: i18n_,
@@ -11107,6 +11122,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
11107
11122
  sort_or_filter_open_: sort_or_filter_open_,
11108
11123
  id_currently_querying_for_: get_search_query_,
11109
11124
  content_blocks_by_row_: content_blocks_by_row_,
11125
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
11110
11126
  no_results_options_: {
11111
11127
  selected_filters_: selected_filters_,
11112
11128
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -11147,7 +11163,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
11147
11163
  last_result_in_viewport_: last_result_in_viewport_,
11148
11164
  formatted_number_of_results_: formatted_number_of_results_,
11149
11165
  i18n_: i18n_,
11150
- number_of_results_: $i7OB2$createMemo(() => search_results_()?.n_hits)
11166
+ number_of_results_: countOfProductsForUI
11151
11167
  });
11152
11168
  }
11153
11169
  })), $i7OB2$escape($i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
@@ -12444,6 +12460,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12444
12460
  const number_of_rendered_selected_filters_items_ = $i7OB2$createSignal(0);
12445
12461
  const first_result_in_viewport_ = $i7OB2$createSignal();
12446
12462
  const last_result_in_viewport_ = $i7OB2$createSignal();
12463
+ const all_products_loaded_ = $i7OB2$createSignal(false);
12464
+ const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $i7OB2$createSignal(0);
12447
12465
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $i7OB2$createSignal(false);
12448
12466
  const products_query_base_ = $587cd61972788655$export$210f130a61ac1e8d(() => {
12449
12467
  const sort_obj = get_sorting() && {
@@ -12490,6 +12508,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12490
12508
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
12491
12509
  const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify1(query => depict_api_.get_listing(query)));
12492
12510
  const contentBlocksByRow = $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
12511
+ const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
12493
12512
  const available_sortings_ = $i7OB2$createMemo(() => plp_products_()?.sorts?.map(sort => ({
12494
12513
  ...sort,
12495
12514
  order: sort.order ?? "desc"
@@ -12501,7 +12520,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12501
12520
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $i7OB2$createSignal(false);
12502
12521
  const [desktop_filter_elements_, set_desktop_filter_elements] = $i7OB2$createSignal();
12503
12522
  const formatted_number_of_results_ = $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
12504
- number_: $i7OB2$createMemo(() => plp_products_()?.n_hits),
12523
+ number_: countOfProductsForUI,
12505
12524
  i18n_: i18n_
12506
12525
  });
12507
12526
  const [sort_and_filter_element_, set_sort_and_filter_element_] = $i7OB2$createSignal();
@@ -12522,7 +12541,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12522
12541
  last_result_in_viewport_: last_result_in_viewport_,
12523
12542
  formatted_number_of_results_: formatted_number_of_results_,
12524
12543
  i18n_: i18n_,
12525
- number_of_results_: $i7OB2$createMemo(() => plp_products_()?.n_hits),
12544
+ number_of_results_: countOfProductsForUI,
12526
12545
  ...extraProps
12527
12546
  });
12528
12547
  }
@@ -12540,7 +12559,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12540
12559
  }
12541
12560
  })), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
12542
12561
  get when() {
12543
- return plp_products_()?.n_hits === 1;
12562
+ return countOfProductsForUI() === 1;
12544
12563
  },
12545
12564
  get fallback() {
12546
12565
  return i18n_.products_();
@@ -12711,6 +12730,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12711
12730
  content_blocks_by_row_: contentBlocksByRow,
12712
12731
  ConfiguredScrollStatus_: ConfiguredScrollStatus_,
12713
12732
  id_currently_querying_for_: id_to_query_for_,
12733
+ setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
12734
+ all_products_loaded_: all_products_loaded_,
12714
12735
  no_results_options_: {
12715
12736
  selected_filters_: selected_filters_,
12716
12737
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,