@depict-ai/ui 0.0.80 → 0.0.81

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/dist/main.js CHANGED
@@ -35,7 +35,7 @@ $parcel$export(module.exports, "SolidFormatPrice", () => $5fc9fc23df1591db$expor
35
35
  $parcel$export(module.exports, "connect_search_field_height_to_aligner_height", () => $246e3e89a097f014$export$828dcdd425fd3231);
36
36
  $parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
37
37
  $parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
38
- /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.80";
38
+ /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.81";
39
39
 
40
40
 
41
41
 
@@ -463,134 +463,6 @@ function $08fa9d20f7ec85af$export$83fd5de5504a7a67({ formatted_number_of_results
463
463
 
464
464
 
465
465
 
466
- /** @jsxImportSource solid-js */
467
- function $1089684cb32bf922$export$daf1a0aef2143a61({ first_result_in_viewport_: [, set_first_result_in_viewport_] , last_result_in_viewport_: [, set_last_result_in_viewport_] }) {
468
- const intersecting = new Set();
469
- const counting_is = new IntersectionObserver((records)=>{
470
- let kids;
471
- for (const { intersectionRatio: intersectionRatio , target: target } of records){
472
- const intersects = intersectionRatio > 0;
473
- const has_target = intersecting.has(target);
474
- if (intersects && !has_target) intersecting.add(target);
475
- else if (!intersects && has_target) intersecting.delete(target);
476
- }
477
- const numbers = [
478
- ...intersecting
479
- ].map((el)=>{
480
- const index = (kids ||= [
481
- ...el.parentElement?.children || []
482
- ]).indexOf(el);
483
- if (index < 0) return undefined;
484
- return index + 1;
485
- }).filter((item)=>item != undefined);
486
- set_first_result_in_viewport_(Math.min(...numbers));
487
- set_last_result_in_viewport_(Math.max(...numbers));
488
- });
489
- (0, $46MJV$solidjs.onCleanup)(()=>counting_is.disconnect());
490
- return (els)=>{
491
- for(let i = 0; i < els?.length; i++){
492
- const el = els[i];
493
- if (el instanceof Element) counting_is.observe(el);
494
- }
495
- };
496
- }
497
-
498
-
499
- /** @jsxImportSource solid-js */
500
-
501
- function $6154d0a3d9e9b16e$export$36aef51ac7a64eae({ depict_api_: depict_api_ , min_products_to_fetch_: min_products_to_fetch_ , all_products_loaded_: all_products_loaded_ , query_base_: query_base_ , observe_for_counting_: observe_for_counting_ , start_cursor_: start_cursor_ }) {
502
- let last_loaded = +new Date();
503
- let dead = false;
504
- let current_cursor = start_cursor_;
505
- const target_to_info = new Map();
506
- const tear_down = (0, $46MJV$depictaiutilishared.catchify)((loaded_all_products)=>{
507
- intersection_observer.disconnect();
508
- target_to_info.clear();
509
- dead = true;
510
- if (loaded_all_products) all_products_loaded_?.[1]?.(true);
511
- });
512
- const deduped_load_more = (0, $46MJV$depictaiutilishared.deparallelize)(async (...args)=>{
513
- const now = +new Date();
514
- // load faster if someone is scrolling aggressively
515
- const num_to_load = now - last_loaded < 10000 ? min_products_to_fetch_ * 5 : min_products_to_fetch_;
516
- const new_cursor = await $6154d0a3d9e9b16e$var$load_more(...args, num_to_load);
517
- if (new_cursor) current_cursor = new_cursor;
518
- last_loaded = now;
519
- });
520
- const intersection_observer = new IntersectionObserver((0, $46MJV$depictaiutilishared.catchify)((records)=>{
521
- let num_children;
522
- for(let i = 0; i < records.length; i++){
523
- // we assume they all have the same parent 👀
524
- const record = records[i];
525
- if (record.intersectionRatio <= 0) continue;
526
- const { target: target } = record;
527
- const parent = target.parentElement;
528
- if (!parent) continue; // we're not in DOM or something funky
529
- if (num_children == undefined) {
530
- const kids = parent.childElementCount;
531
- if (isNaN(kids)) continue;
532
- num_children = kids;
533
- }
534
- const info = target_to_info.get(target);
535
- if (!info) continue; // How did this happen?
536
- let actual_index_;
537
- for(let i = 0; i < num_children; i++){
538
- const child = parent.children[i];
539
- if (child === target) {
540
- actual_index_ = i;
541
- break;
542
- }
543
- }
544
- if (actual_index_ == undefined) continue;
545
- const in_range = actual_index_ / num_children * 100;
546
- const range_to_load_at = current_cursor === start_cursor_ ? 50 : 75; // if first load, load earlier
547
- if (in_range > range_to_load_at) {
548
- // load if more than 75% of elements are in view, this will make so that we load sooner and sooner which maybe (?) will adjust to people scrolling quickly :)
549
- intersection_observer.disconnect(); // no need to watch these els anymore
550
- deduped_load_more({
551
- depict_api_: depict_api_,
552
- info_: info,
553
- container_: parent,
554
- query_base_: query_base_,
555
- on_reached_end_: ()=>tear_down(true),
556
- cursor_: current_cursor
557
- });
558
- }
559
- }
560
- }));
561
- (0, $46MJV$solidjs.onCleanup)(tear_down);
562
- return (items, _display, info_)=>{
563
- observe_for_counting_(items);
564
- if (dead) return items;
565
- for(let i = 0; i < items?.length; i++){
566
- const item = items[i];
567
- if (item instanceof Element) {
568
- target_to_info.set(item, info_);
569
- intersection_observer.observe(item);
570
- }
571
- }
572
- return items;
573
- };
574
- }
575
- async function $6154d0a3d9e9b16e$var$load_more({ depict_api_: depict_api_ , query_base_: query_base_ , container_: container_ , on_reached_end_: on_reached_end_ , info_: { rendering_options: rendering_options , t: t } , cursor_: cursor_ }, num_results_to_load) {
576
- (0, $46MJV$depictaiutilishared.dlog)("SearchResults: Loading more");
577
- const base_part = (0, $46MJV$solidjs.untrack)(query_base_);
578
- const api_response = await depict_api_["query_id" in base_part ? "list" : "query"]({
579
- cursor: cursor_,
580
- limit: num_results_to_load,
581
- ...base_part
582
- });
583
- const new_displays = api_response?.displays || [];
584
- const { elements: elements } = await (0, $46MJV$depictaiutilishared.Rec_Renderer)(t, {
585
- ...rendering_options,
586
- recs: new_displays || []
587
- });
588
- if (elements) container_.append(...elements);
589
- else (0, $46MJV$depictaiutilishared.dlog)("SearchResults: Got no elements, that's weird", api_response);
590
- if ("cursor" in api_response) return api_response.cursor;
591
- else if (!api_response?.failed) on_reached_end_();
592
- }
593
-
594
466
 
595
467
 
596
468
 
@@ -826,13 +698,8 @@ function $2b4e3538e183d885$export$ef6006467f04ee41({ i18n_: i18n_ , expanded_hie
826
698
  ]);
827
699
 
828
700
 
829
- /*
830
- * Usually product templates are somewhat height-elastic depending on the content, i.e. if the title is longer we might up to two extra rows for this. That means that the placeholders almost never will reflect the size of the actual content when we do scroll restoration. This magic number specifies how many extra placeholders we should render everytime to compensate for this, since if the placeholders are in total shorter than the old scroll location the scroll restoration won't work.
831
- */ const $39d15a684cb3e309$export$6c9030e511152266 = 30;
832
-
833
-
834
701
  function $8e863dc22b06b688$export$a2cc176055f8f08() {
835
- return document.createComment("Please try setting `colsAtSize` on `DepictProvider`/`DepictSearch` to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.");
702
+ return document.createComment("Please try setting `colsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.");
836
703
  }
837
704
 
838
705
 
@@ -885,77 +752,347 @@ function $0f2f58dd60b11888$export$b69d0d92862de18b(props) {
885
752
  }
886
753
 
887
754
 
888
- const $8d94abc871e13baf$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="PLP-results"></div>`, 2), $8d94abc871e13baf$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="cards"></div>`, 2);
889
- let $8d94abc871e13baf$var$cached_placeholder_element;
890
- function $8d94abc871e13baf$export$3925f87b1545cfc6({ plp_results_: plp_results_ , depict_api_: depict_api_ , all_products_loaded_: all_products_loaded_ , min_products_to_fetch_: min_products_to_fetch_ , query_base_: query_base_ , first_result_in_viewport_: first_result_in_viewport_ , last_result_in_viewport_: last_result_in_viewport_ , scroll_restoration_data_: scroll_restoration_data_ , no_results_options_: no_results_options_ , desktop_filter_elements_: desktop_filter_elements_ , sort_or_filter_open_: sort_or_filter_open_ , rr_options_: rr_options_ , layout_options_: layout_options_ , tenant_object_: tenant_object_ , type_for_tracking_: type_for_tracking_ , id_currently_querying_for_: id_currently_querying_for_ }) {
891
- // 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
892
- const is_loading = (0, $46MJV$solidjs.createMemo)(()=>plp_results_.loading || query_base_.loading);
893
- const cleanup_old_cards = [];
894
- const render_and_insert_results = (0, $46MJV$depictaiutilishared.deparallelize_no_drop)(async (insert_into, owner)=>{
895
- const fallback_to_no_results = ()=>(0, $46MJV$solidjs.runWithOwner)(owner, ()=>insert_into.replaceChildren(...(0, $2b4e3538e183d885$export$ef6006467f04ee41)(no_results_options_)));
896
- const observe_for_counting_ = (0, $46MJV$solidjs.runWithOwner)(owner, ()=>(0, $1089684cb32bf922$export$daf1a0aef2143a61)({
897
- last_result_in_viewport_: last_result_in_viewport_,
898
- first_result_in_viewport_: first_result_in_viewport_
899
- }));
900
- const current_results = (0, $46MJV$solidjs.untrack)(plp_results_);
901
- const current_cursor = current_results.cursor;
902
- const load_more_post_processor = current_cursor // if we already got everything, don't make actual load more post processor.
903
- ? (0, $6154d0a3d9e9b16e$export$36aef51ac7a64eae)({
904
- depict_api_: depict_api_,
905
- min_products_to_fetch_: min_products_to_fetch_,
906
- all_products_loaded_: all_products_loaded_,
907
- query_base_: query_base_,
908
- observe_for_counting_: observe_for_counting_,
909
- start_cursor_: current_cursor
910
- }) : function(items) {
911
- observe_for_counting_(items);
912
- return items;
913
- };
914
- // create owner to run product cards with an Owner, so they know when they've gotten removed
915
- const [owner_for_cards, dispose_our_cards] = (0, $46MJV$solidjs.createRoot)((dispose)=>[
916
- (0, $46MJV$solidjs.getOwner)(),
917
- dispose
755
+
756
+
757
+ function $f93412cebc8f7bac$export$2f0cbfbb4354bb52(elements) {
758
+ // FYI this probably doesn't work on hugely deep nestings or large amount of elements
759
+ return (0, $46MJV$solidjs.createMemo)(()=>$f93412cebc8f7bac$var$unwrapping_helper(elements));
760
+ }
761
+ function $f93412cebc8f7bac$var$unwrapping_helper(elements) {
762
+ const result = [];
763
+ if (Array.isArray(elements)) for(let i = 0; i < elements.length; i++){
764
+ const element = elements[i];
765
+ result.push(...$f93412cebc8f7bac$var$unwrapping_helper(element));
766
+ }
767
+ else if (typeof elements == "function") result.push(...$f93412cebc8f7bac$var$unwrapping_helper(elements()));
768
+ else if (elements != undefined && typeof elements != "boolean") result.push(elements);
769
+ return result;
770
+ }
771
+
772
+
773
+ let $7b0b7e887b485a91$var$cached_placeholder_element;
774
+ let $7b0b7e887b485a91$var$rendering_cached_placeholder_element;
775
+ function $7b0b7e887b485a91$export$f33414a4df0afd3f({ product_card_template_: product_card_template_ , num_placeholders_: num_placeholders_ }) {
776
+ const [get_elements, set_elements] = (0, $46MJV$solidjs.createSignal)([]);
777
+ let existing_num = 0;
778
+ (0, $46MJV$solidjs.createRenderEffect)(()=>{
779
+ const to_add = num_placeholders_() - existing_num;
780
+ if (to_add <= 0) return;
781
+ // Below comment is from when we used recommendation renderer and manual DOM manipulation for this, but I'm still scared to remove placeholders and mess up scroll restoration, so I'm keeping the way it worked. Otherwise, <Index> could be used which would be far more elegant.
782
+ // We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
783
+ // The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
784
+ set_elements((prev)=>[
785
+ ...prev,
786
+ ...Array.from({
787
+ length: to_add
788
+ }).map(()=>$7b0b7e887b485a91$var$Placeholder({
789
+ product_card_template_: product_card_template_
790
+ }))
918
791
  ]);
919
- const rendering_result = await (0, $46MJV$depictaiutilishared.default_rr)(tenant_object_, {
920
- type: type_for_tracking_,
921
- recs: current_results.displays,
922
- ...rr_options_,
923
- ...typeof rr_options_.template === "function" ? {
924
- template: $8d94abc871e13baf$var$wrap_template_to_throw_into_error_boundary(rr_options_.template, owner_for_cards)
925
- } : {},
926
- post_processors: [
927
- ...rr_options_.post_processors || [],
928
- load_more_post_processor
929
- ]
792
+ existing_num += to_add;
793
+ });
794
+ return get_elements; // https://github.com/solidjs/solid/releases/tag/v1.7.0
795
+ }
796
+ /**
797
+ * Get one placeholder element. It will be cloned for each placeholder for ultimate performance even when solid-js isn't rendering the placeholders.
798
+ */ function $7b0b7e887b485a91$var$Placeholder({ product_card_template_: product_card_template_ }) {
799
+ const get_cloned_placeholders = (element_to_clone = $7b0b7e887b485a91$var$cached_placeholder_element)=>Array.isArray(element_to_clone) ? element_to_clone.map((el)=>el instanceof Node ? el.cloneNode(true) : el) : element_to_clone;
800
+ if ($7b0b7e887b485a91$var$cached_placeholder_element) return get_cloned_placeholders();
801
+ let dispose_original_copy;
802
+ const get_unwrapped_element = (0, $46MJV$solidjs.createRoot)((dispose)=>{
803
+ dispose_original_copy = dispose;
804
+ // if product_card_template_ is async and rejects the resource will take care of throwing upwards here in the solid-js error handling system
805
+ const [resource] = (0, $46MJV$solidjs.createResource)(()=>{
806
+ if ($7b0b7e887b485a91$var$rendering_cached_placeholder_element) return $7b0b7e887b485a91$var$rendering_cached_placeholder_element;
807
+ const return_value = product_card_template_(null, undefined);
808
+ if (typeof return_value === "object" && typeof return_value?.then === "function") // Is Promise or promise-like object
809
+ $7b0b7e887b485a91$var$rendering_cached_placeholder_element = return_value;
810
+ return return_value;
930
811
  });
931
- // check if we still should insert or something new happened while we were rendering
932
- if ((0, $46MJV$solidjs.untrack)(has_no_results_or_failed) || (0, $46MJV$solidjs.untrack)(is_loading)) {
933
- (0, $46MJV$depictaiutilishared.dlog)("PLPResults: Not inserting rendered results because we became loading or switched to no results");
934
- return;
935
- }
936
- const { elements: elements , should_stay_inserted: should_stay_inserted } = rendering_result;
937
- if (!elements) {
938
- fallback_to_no_results(); // rendering failed at this point but just pretend it's no results
812
+ return (0, $46MJV$solidjs.createMemo)(()=>{
813
+ if (resource.loading) return ()=>[];
814
+ return (0, $f93412cebc8f7bac$export$2f0cbfbb4354bb52)(resource);
815
+ });
816
+ });
817
+ (0, $46MJV$solidjs.onCleanup)(()=>{
818
+ if ($7b0b7e887b485a91$var$rendering_cached_placeholder_element) {
819
+ // If we're still rendering in our separate root, let the rendering finish or other <Placeholder> components waiting for it might get an incomplete result
820
+ const unset_current_rendering = ()=>{
821
+ dispose_original_copy();
822
+ $7b0b7e887b485a91$var$rendering_cached_placeholder_element = undefined;
823
+ };
824
+ $7b0b7e887b485a91$var$rendering_cached_placeholder_element?.then(unset_current_rendering, unset_current_rendering);
825
+ } else // Otherwise, just make sure we've disposed our root
826
+ dispose_original_copy();
827
+ });
828
+ return (0, $46MJV$solidjs.createMemo)(()=>{
829
+ const unwrapped_array = get_unwrapped_element()();
830
+ if (!unwrapped_array?.length || !unwrapped_array.every((item)=>item)) // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
831
+ return;
832
+ // placeholders have finished rendering, freeze the elements
833
+ $7b0b7e887b485a91$var$cached_placeholder_element = get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
834
+ $7b0b7e887b485a91$var$rendering_cached_placeholder_element = undefined;
835
+ dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
836
+ return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
837
+ });
838
+ }
839
+
840
+
841
+ /*
842
+ * Usually product templates are somewhat height-elastic depending on the content, i.e. if the title is longer we might up to two extra rows for this. That means that the placeholders almost never will reflect the size of the actual content when we do scroll restoration. This magic number specifies how many extra placeholders we should render everytime to compensate for this, since if the placeholders are in total shorter than the old scroll location the scroll restoration won't work.
843
+ */ const $39d15a684cb3e309$export$6c9030e511152266 = 30;
844
+
845
+
846
+ /** @jsxImportSource solid-js */
847
+
848
+
849
+
850
+ function $20717024e763c0fa$export$5e4aed86c12acdd9({ percentage_in_view_: percentage_in_view_ , set_extra_displays_: set_extra_displays_ , all_products_loaded_: all_products_loaded_ , plp_results_: plp_results_ , min_products_to_fetch_: min_products_to_fetch_ , query_base_: query_base_ , depict_api_: depict_api_ }) {
851
+ let last_loaded = +new Date();
852
+ let is_loading_more = false;
853
+ let is_first_load = true;
854
+ const [get_last_cursor, set_last_cursor] = (0, $46MJV$solidjs.createSignal)();
855
+ (0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)(plp_results_, ()=>set_extra_displays_([]), {
856
+ defer: true
857
+ })); // empty array when a new request has completed (don't run this initially since it will already be empty)
858
+ (0, $46MJV$solidjs.createComputed)(()=>{
859
+ set_last_cursor(plp_results_()?.cursor);
860
+ last_loaded = +new Date();
861
+ is_first_load = true;
862
+ });
863
+ (0, $46MJV$solidjs.createEffect)((0, $46MJV$depictaiutilishared.catchify)(async ()=>{
864
+ const be_above_percentage = is_first_load ? 50 : 75; // if first load, load earlier
865
+ if (percentage_in_view_() < be_above_percentage || is_loading_more) return;
866
+ if (!get_last_cursor()) {
867
+ // dlog("All results loaded, can't load more");
868
+ all_products_loaded_?.[1](true); // This is unset in SearchPage as we start fetching new results
939
869
  return;
940
870
  }
941
- insert_into.replaceChildren(...elements);
942
- // Dispose the old cards just after the cards have been removed from the DOM
943
- cleanup_old_cards.forEach((cleanup_function)=>cleanup_function());
944
- cleanup_old_cards.push(dispose_our_cards); // push after calling, so that we don't instantly demolish ourselves lol
945
- should_stay_inserted?.then((should)=>{
946
- // If we shouldn't stay inserted for some reason, switch back to no results
947
- if (!should) fallback_to_no_results();
871
+ // dlog("More than ", be_above_percentage, "% in view, ", percentage_in_view_(), "%, loading more");
872
+ is_loading_more = true;
873
+ const base_part = (0, $46MJV$solidjs.untrack)(query_base_);
874
+ const now = +new Date();
875
+ // load faster if someone is scrolling aggressively
876
+ const number_of_results_to_load = is_first_load ? // After first load, always just load 20 since people might just be browsing the top ones still
877
+ min_products_to_fetch_ : now - last_loaded < 10000 ? min_products_to_fetch_ * 5 : min_products_to_fetch_;
878
+ // dlog("loading ", number_of_results_to_load, "products, because it was", now - last_loaded, "ms since last load");
879
+ const api_response = await depict_api_["query_id" in base_part ? "list" : "query"]({
880
+ cursor: get_last_cursor(),
881
+ limit: number_of_results_to_load,
882
+ ...base_part
948
883
  });
884
+ const new_displays = api_response?.displays || [];
885
+ set_extra_displays_((old_value)=>{
886
+ // We want this to go fast. The apply method is the fastest way to add to an array, and AFAIK it's faster to add than to create a new one.
887
+ // eslint-disable-next-line prefer-spread
888
+ old_value.push.apply(old_value, new_displays);
889
+ return old_value;
890
+ });
891
+ set_last_cursor(api_response.cursor);
892
+ is_loading_more = false;
893
+ last_loaded = +new Date();
894
+ is_first_load = false;
895
+ }));
896
+ }
897
+
898
+
899
+
900
+ function $ef82a1d4fac1efad$export$63dd0350f8559dda({ displays_by_key_: displays_by_key_ , get_last_result_in_viewport_: get_last_result_in_viewport_ , index_to_target_map_: index_to_target_map_ , is_loading_: is_loading_ , get_extra_displays: get_extra_displays }) {
901
+ const [get_has_rendered_toggle, set_has_rendered_toggle] = (0, $46MJV$solidjs.createSignal)(false);
902
+ (0, $46MJV$solidjs.createEffect)(()=>{
903
+ // We need this to run after the "render phase"
904
+ get_extra_displays();
905
+ set_has_rendered_toggle((old)=>!old);
949
906
  });
907
+ return (0, $46MJV$solidjs.createMemo)(()=>{
908
+ const last = get_last_result_in_viewport_();
909
+ // Check if we are past the last result, in that case we want it to count as 100% for a better infinite scroll experience
910
+ past_last_result_check: {
911
+ const elements_of_last_result = index_to_target_map_.get(index_to_target_map_.size - 1);
912
+ if (elements_of_last_result) {
913
+ if ((0, $46MJV$solidjs.untrack)(is_loading_)) {
914
+ // We're loading, wait check again after we have inserted our new results
915
+ get_has_rendered_toggle();
916
+ break past_last_result_check;
917
+ }
918
+ for (const element of elements_of_last_result){
919
+ if (document.documentElement.contains(element) && element.getBoundingClientRect().top <= 0) // dlog(element, "which is of last product card is in or above viewport, probably loading more");
920
+ return 100;
921
+ }
922
+ }
923
+ }
924
+ if (isNaN(last)) return 0;
925
+ if (Math.abs(last) === Infinity) // No product card in view and not after last card, assume first card
926
+ return 0;
927
+ return last / displays_by_key_().size * 100;
928
+ });
929
+ }
930
+
931
+
932
+
933
+
934
+ /**
935
+ * Gets product_id (the thing we key the rendering on) from a display
936
+ */ function $f1ea6fcde8fab269$export$548d053aba053d79(display) {
937
+ if ("variant_index" in display) {
938
+ const actual_display = display.variant_displays[display.variant_index];
939
+ return actual_display.product_id;
940
+ }
941
+ return display.product_id;
942
+ }
943
+
944
+
945
+
946
+ function $ea6c1dd5af2900d8$export$7f8bd308237ab5a5(get_displays_) {
947
+ const displays_by_key_ = (0, $46MJV$solidjs.createMemo)(()=>{
948
+ const displays = get_displays_();
949
+ // We key by product_id because that's what can be used to uniquely identify products
950
+ // This way <For> can optimize the rendering
951
+ const map = new Map();
952
+ for(let i = 0; i < displays.length; i++){
953
+ const display = displays[i];
954
+ const product_id = (0, $f1ea6fcde8fab269$export$548d053aba053d79)(display);
955
+ map.set(product_id, display);
956
+ }
957
+ return map;
958
+ });
959
+ return displays_by_key_;
960
+ }
961
+ function $ea6c1dd5af2900d8$export$43f0fb951fcb0c54({ displays_by_key_: displays_by_key_ , merchant_: merchant_ , market_: market_ , product_card_template_: product_card_template_ , do_per_elements_: do_per_elements_ }) {
962
+ return (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.For), {
963
+ get each () {
964
+ return [
965
+ ...displays_by_key_().keys()
966
+ ];
967
+ },
968
+ children: (product_id, index)=>{
969
+ // We're using `untrack` here since we don't want to react in here to displays_by_key changing
970
+ // As long as our key stays the same we assume that the display hasn't changed, so we don't want to rerender
971
+ // If the key gets removed, <For> will remove us
972
+ const owner = (0, $46MJV$solidjs.getOwner)();
973
+ const display_accessor = (0, $46MJV$solidjs.createMemo)(()=>displays_by_key_().get(product_id));
974
+ const [product_card_resource] = (0, $46MJV$solidjs.createResource)((0, $46MJV$solidjs.createMemo)(()=>[
975
+ merchant_(),
976
+ market_()
977
+ ]), // re-render when merchant or market changes
978
+ ([merchant, market])=>{
979
+ // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
980
+ const display = (0, $46MJV$solidjs.untrack)(display_accessor);
981
+ return product_card_template_(display, {
982
+ set_on_index_change: (fn)=>(0, $46MJV$solidjs.runWithOwner)(owner, ()=>(0, $46MJV$solidjs.createEffect)(()=>fn(index()))),
983
+ merchant: merchant,
984
+ market: market
985
+ });
986
+ });
987
+ const node_accessor = (0, $f93412cebc8f7bac$export$2f0cbfbb4354bb52)(product_card_resource);
988
+ (0, $46MJV$solidjs.createEffect)(()=>{
989
+ const product_card_nodes = node_accessor();
990
+ const display = display_accessor();
991
+ const elements = [];
992
+ for(let i = 0; i < product_card_nodes.length; i++){
993
+ const element = product_card_nodes[i];
994
+ if (!(element instanceof Element)) continue;
995
+ elements.push(element);
996
+ // Add tracking ids
997
+ if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
998
+ const { dataset: dataset } = element;
999
+ const { search_result_id: search_result_id , product_listing_result_id: product_listing_result_id , recommendation_id: recommendation_id } = display;
1000
+ if (search_result_id) dataset.searchResultId = search_result_id;
1001
+ else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;
1002
+ else if (recommendation_id) dataset.recommendationId = recommendation_id;
1003
+ }
1004
+ do_per_elements_?.(elements, index);
1005
+ });
1006
+ return product_card_resource; // https://github.com/solidjs/solid/releases/tag/v1.7.0
1007
+ }
1008
+ });
1009
+ }
1010
+
1011
+
1012
+ function $f67fba44c7515f35$export$a1fd619a4743ca08({ plp_results_: plp_results_ , product_card_template_: product_card_template_ , first_result_in_viewport_: [, set_first_result_in_viewport] , last_result_in_viewport_: [get_last_result_in_viewport_, set_last_result_in_viewport] , merchant_: merchant_ , market_: market_ , all_products_loaded_: all_products_loaded_ , min_products_to_fetch_: min_products_to_fetch_ , query_base_: query_base_ , depict_api_: depict_api_ , is_loading_: is_loading_ }) {
1013
+ // 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
1014
+ const target_to_index_map = new Map();
1015
+ const index_to_target_map_ = new Map();
1016
+ const currently_intersecting = new Set();
1017
+ const intersection_observer = new IntersectionObserver((0, $46MJV$depictaiutilishared.catchify)((records)=>{
1018
+ for(let i = 0; i < records.length; i++){
1019
+ const record = records[i];
1020
+ const { target: target , intersectionRatio: intersectionRatio } = record;
1021
+ const index_of_target = target_to_index_map.get(target);
1022
+ const is_in_set = currently_intersecting.has(index_of_target);
1023
+ if (intersectionRatio > 0) {
1024
+ if (!is_in_set) currently_intersecting.add(index_of_target);
1025
+ } else if (is_in_set) currently_intersecting.delete(index_of_target);
1026
+ }
1027
+ set_first_result_in_viewport(Math.min(...currently_intersecting) + 1); // +1 because we want to start counting at 1
1028
+ set_last_result_in_viewport(Math.max(...currently_intersecting) + 1);
1029
+ }, "PLPResults IO failed"));
1030
+ // Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
1031
+ const [get_extra_displays, set_extra_displays_] = (0, $46MJV$solidjs.createSignal)([], {
1032
+ equals: false
1033
+ });
1034
+ const displays_by_key_ = (0, $ea6c1dd5af2900d8$export$7f8bd308237ab5a5)((0, $46MJV$solidjs.createMemo)(()=>[
1035
+ ...plp_results_().displays,
1036
+ ...get_extra_displays()
1037
+ ]));
1038
+ const percentage_in_view_ = (0, $ef82a1d4fac1efad$export$63dd0350f8559dda)({
1039
+ get_last_result_in_viewport_: get_last_result_in_viewport_,
1040
+ displays_by_key_: displays_by_key_,
1041
+ index_to_target_map_: index_to_target_map_,
1042
+ is_loading_: is_loading_,
1043
+ get_extra_displays: get_extra_displays
1044
+ });
1045
+ (0, $20717024e763c0fa$export$5e4aed86c12acdd9)({
1046
+ percentage_in_view_: percentage_in_view_,
1047
+ set_extra_displays_: set_extra_displays_,
1048
+ all_products_loaded_: all_products_loaded_,
1049
+ plp_results_: plp_results_,
1050
+ min_products_to_fetch_: min_products_to_fetch_,
1051
+ query_base_: query_base_,
1052
+ depict_api_: depict_api_
1053
+ });
1054
+ return (0, $ea6c1dd5af2900d8$export$43f0fb951fcb0c54)({
1055
+ displays_by_key_: displays_by_key_,
1056
+ merchant_: merchant_,
1057
+ market_: market_,
1058
+ product_card_template_: product_card_template_,
1059
+ do_per_elements_: (elements, index_accessor)=>// Adds/removes elements from the "results in viewport" intersection observer above
1060
+ (0, $46MJV$solidjs.createEffect)(()=>{
1061
+ const display_index = index_accessor();
1062
+ // Nested createEffect because we only want to re-run this when the index changes
1063
+ // We need to save in a map which index the elements of this template are so that we can know that in the IntersectionObserver callback
1064
+ for(let i = 0; i < elements.length; i++){
1065
+ const element = elements[i];
1066
+ target_to_index_map.set(element, display_index);
1067
+ intersection_observer.observe(element);
1068
+ (0, $46MJV$solidjs.onCleanup)(()=>{
1069
+ intersection_observer.unobserve(element);
1070
+ target_to_index_map.delete(element);
1071
+ currently_intersecting.delete(display_index);
1072
+ });
1073
+ }
1074
+ index_to_target_map_.set(display_index, elements);
1075
+ (0, $46MJV$solidjs.onCleanup)(()=>index_to_target_map_.delete(display_index));
1076
+ })
1077
+ });
1078
+ }
1079
+
1080
+
1081
+ const $8d94abc871e13baf$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="PLP-results"></div>`, 2), $8d94abc871e13baf$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="cards"></div>`, 2), $8d94abc871e13baf$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<style></style>`, 2);
1082
+ function $8d94abc871e13baf$export$3925f87b1545cfc6({ plp_results_: plp_results_ , depict_api_: depict_api_ , all_products_loaded_: all_products_loaded_ , min_products_to_fetch_: min_products_to_fetch_ , query_base_: query_base_ , first_result_in_viewport_: first_result_in_viewport_ , last_result_in_viewport_: last_result_in_viewport_ , scroll_restoration_data_: [get_scroll_restoration_data] , no_results_options_: no_results_options_ , desktop_filter_elements_: desktop_filter_elements_ , sort_or_filter_open_: sort_or_filter_open_ , product_card_template_: product_card_template_ , layout_options_: layout_options_ , id_currently_querying_for_: id_currently_querying_for_ }) {
1083
+ // 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
1084
+ const is_loading_ = (0, $46MJV$solidjs.createMemo)(()=>plp_results_.loading || query_base_.loading);
1085
+ const merchant_ = (0, $46MJV$solidjs.createMemo)(()=>query_base_().tenant);
1086
+ const market_ = (0, $46MJV$solidjs.createMemo)(()=>query_base_().market);
950
1087
  const has_no_results_or_failed = (0, $46MJV$solidjs.createMemo)(()=>{
951
1088
  const displays = plp_results_()?.displays;
952
- return !is_loading() && (!Array.isArray(displays) || !displays.length);
1089
+ return !is_loading_() && (!Array.isArray(displays) || !displays.length);
953
1090
  });
954
- if (all_products_loaded_) (0, $46MJV$solidjs.createComputed)(()=>{
1091
+ if (all_products_loaded_) // This is for the case that all products were loaded in the first result I think?
1092
+ (0, $46MJV$solidjs.createComputed)(()=>{
955
1093
  const is_at_end = !plp_results_()?.cursor; // or failed, but we don't wanna / it's not easy to retry
956
- if (!is_loading() && is_at_end) all_products_loaded_[1](true);
1094
+ if (!is_loading_() && is_at_end) all_products_loaded_[1](true);
957
1095
  });
958
- (0, $46MJV$solidjs.onCleanup)(()=>cleanup_old_cards.forEach((fn)=>fn())); // if everything gets cleaned up without new cards replacing the old ones, clean up the last cards
959
1096
  return (()=>{
960
1097
  const _el$ = $8d94abc871e13baf$var$_tmpl$.cloneNode(true);
961
1098
  (0, $46MJV$solidjsweb.insert)(_el$, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
@@ -969,7 +1106,7 @@ function $8d94abc871e13baf$export$3925f87b1545cfc6({ plp_results_: plp_results_
969
1106
  return (0, $0f2f58dd60b11888$export$b69d0d92862de18b)({
970
1107
  severity_: "error",
971
1108
  // More granular error handling
972
- // This _also_ fails when a product card rendering fails due to the runWithOwner with a root that was created inside the "root"/"context" of this ErrorBoundary
1109
+ // This _also_ fails when a product card rendering fails
973
1110
  on_error_: (retry)=>{
974
1111
  // re-try / reset ErrorBoundary next time we're getting product cards
975
1112
  const track = (0, $46MJV$solidjs.createReaction)(retry);
@@ -981,83 +1118,108 @@ function $8d94abc871e13baf$export$3925f87b1545cfc6({ plp_results_: plp_results_
981
1118
  // So that the styling looks pretty when we've failed
982
1119
  message_: "Result rendering failed",
983
1120
  get children () {
1121
+ let suspense_contents;
1122
+ let is_just_after_plp_results_update = false;
1123
+ let fallback_is_alive = false;
984
1124
  const random_id = (0, $46MJV$depictaiutilishared.make_random_classname)();
985
- const selector_beginning = `.depict.plp #${random_id}>`;
986
- const cards = (()=>{
987
- const _el$2 = $8d94abc871e13baf$var$_tmpl$2.cloneNode(true);
988
- (0, $46MJV$solidjsweb.setAttribute)(_el$2, "id", random_id);
989
- return _el$2;
990
- })();
991
- const style = document.createElement("style");
992
- (0, $46MJV$solidjs.createRenderEffect)(()=>{
993
- // Add grid styling that changes when filters get opened/closed
994
- const when_filters_closed_cols = layout_options_.cols_at_size;
995
- const cols_at_size = sort_or_filter_open_() ? when_filters_closed_cols.map((row)=>{
996
- const [num_cols_default, , , , override_cols] = row;
997
- const cloned_row = [
998
- ...row
999
- ];
1000
- // @ts-ignore
1001
- cloned_row[0] = num_cols_default - 1;
1002
- if (override_cols) // @ts-ignore
1003
- cloned_row[4] = {
1004
- overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column])=>[
1005
- row,
1006
- column - 1
1007
- ]))
1008
- };
1009
- return cloned_row;
1010
- }) : when_filters_closed_cols;
1011
- const css = (0, $46MJV$depictaiutilishared.n_col_styling_with_dist)(selector_beginning, layout_options_.grid_spacing, cols_at_size, "grid", layout_options_.override_vertical_spacing);
1012
- style.replaceChildren(css);
1125
+ const selector_beginning_ = `.depict.plp #${random_id}>`;
1126
+ const [get_styling, set_styling_] = (0, $46MJV$solidjs.createSignal)("");
1127
+ const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = (0, $46MJV$solidjs.createSignal)(false);
1128
+ const rendered_placeholders = (0, $46MJV$solidjs.createMemo)(()=>get_should_have_placeholders_rendered() ? (0, $7b0b7e887b485a91$export$f33414a4df0afd3f)({
1129
+ product_card_template_: product_card_template_,
1130
+ num_placeholders_: (0, $46MJV$solidjs.createMemo)(()=>{
1131
+ // Can't use the data out of request_base for the id because request_base is too late, we need the correct amount of placeholders before the browser has restored the scroll state after processing all popstate events
1132
+ return (0, $39d15a684cb3e309$export$6c9030e511152266) + (get_scroll_restoration_data().find(({ for_id: for_id })=>for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
1133
+ })
1134
+ }) : undefined);
1135
+ const [get_suspense_is_blocked, set_suspense_is_blocked] = (0, $46MJV$solidjs.createSignal)(false);
1136
+ (0, $46MJV$solidjs.createComputed)(()=>{
1137
+ if (!is_loading_()) return;
1138
+ set_should_have_placeholders_rendered(true);
1139
+ set_suspense_is_blocked(false);
1140
+ is_just_after_plp_results_update = true;
1013
1141
  });
1014
- (0, $46MJV$solidjs.createRenderEffect)(// render placeholders / product cards
1015
- (0, $46MJV$depictaiutilishared.catchify)(async ()=>{
1016
- const owner_ = (0, $46MJV$solidjs.getOwner)();
1017
- if (is_loading()) await $8d94abc871e13baf$var$insert_placeholders({
1018
- scroll_restoration_data_: scroll_restoration_data_,
1019
- id_currently_querying_for_: id_currently_querying_for_,
1020
- rr_options_: rr_options_,
1021
- tenant_object_: tenant_object_,
1022
- min_products_to_fetch_: min_products_to_fetch_,
1023
- owner_: owner_,
1024
- cards_element_: cards
1025
- });
1026
- else if (!has_no_results_or_failed()) {
1027
- plp_results_(); // re-run render_and_insert_results when results change
1028
- render_and_insert_results(cards, owner_);
1029
- }
1030
- }));
1031
- // copied from RecommendationGrid
1032
- // convoluted lazy loading that
1033
- // when the elements are in the DOM starts IntersectionObserver on whole grid
1034
- // when grid intersects starts Lazyfier
1035
- // this is because Lazyfier is fucking stupid
1036
- (0, $46MJV$depictaiutilishared.observer).wait_for_element(cards).then((0, $46MJV$depictaiutilishared.catchify)((element)=>{
1037
- let start_lazy_loading;
1038
- const lazy_loading_promise = new Promise((r)=>start_lazy_loading = r);
1039
- const lf = new (0, $46MJV$depictaiutilishared.Lazyfier)({
1040
- only_load_intersecting: true,
1041
- wait_for_dominsertion: lazy_loading_promise,
1042
- ignore_data_urls: true,
1043
- lazyfinder: {
1044
- unload () {}
1045
- }
1046
- });
1047
- lf.start_observing_for_new_children_(element);
1048
- const i_o = new IntersectionObserver((0, $46MJV$depictaiutilishared.catchify)((records)=>{
1049
- for (const record of records)if (record.intersectionRatio > 0) {
1050
- start_lazy_loading();
1051
- i_o.disconnect();
1052
- return;
1142
+ $8d94abc871e13baf$var$results_grid_styling_generator({
1143
+ layout_options_: layout_options_,
1144
+ set_styling_: set_styling_,
1145
+ sort_or_filter_open_: sort_or_filter_open_,
1146
+ selector_beginning_: selector_beginning_
1147
+ });
1148
+ const has_at_least_one_display = (0, $46MJV$solidjs.createMemo)(()=>!!plp_results_()?.displays?.length); // Only de-construct below stuff if we get 0 displays. Important that this returns boolean so that below Suspense only gets re-created if it actually changes
1149
+ const block_suspense_if_needed = ()=>{
1150
+ if (!is_just_after_plp_results_update) return;
1151
+ is_just_after_plp_results_update = false;
1152
+ fallback_is_alive = false;
1153
+ set_suspense_is_blocked(true);
1154
+ };
1155
+ const non_placeholder_product_cards = (0, $46MJV$solidjs.createMemo)(()=>has_at_least_one_display() && // This suspense ensures that if someone has async templates, we still show placeholders until the product cards actually have finished rendering (automagically since they're createResource's)
1156
+ // We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
1157
+ // (For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
1158
+ // We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
1159
+ (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Suspense), {
1160
+ get fallback () {
1161
+ return (()=>{
1162
+ fallback_is_alive = true;
1163
+ (0, $46MJV$solidjs.onCleanup)(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
1164
+ return (0, $46MJV$solidjs.createMemo)(()=>{
1165
+ // 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
1166
+ // In future we could have individual suspense's for each product card, but that's too much for now
1167
+ if (get_suspense_is_blocked()) return suspense_contents;
1168
+ set_should_have_placeholders_rendered(true); // just in case
1169
+ (0, $46MJV$solidjs.onCleanup)(()=>set_should_have_placeholders_rendered(false));
1170
+ return rendered_placeholders; // I lifted the placeholders into the memo since we don't want to re-render them when switching from <Show> to <Suspense>
1171
+ });
1172
+ })();
1173
+ },
1174
+ get children () {
1175
+ return (()=>{
1176
+ suspense_contents = (0, $f67fba44c7515f35$export$a1fd619a4743ca08)({
1177
+ product_card_template_: product_card_template_,
1178
+ plp_results_: plp_results_,
1179
+ last_result_in_viewport_: last_result_in_viewport_,
1180
+ first_result_in_viewport_: first_result_in_viewport_,
1181
+ market_: market_,
1182
+ merchant_: merchant_,
1183
+ all_products_loaded_: all_products_loaded_,
1184
+ min_products_to_fetch_: min_products_to_fetch_,
1185
+ query_base_: query_base_,
1186
+ depict_api_: depict_api_,
1187
+ is_loading_: is_loading_
1188
+ });
1189
+ (0, $46MJV$solidjs.onCleanup)(()=>suspense_contents = undefined);
1190
+ return suspense_contents;
1191
+ })();
1053
1192
  }
1054
1193
  }));
1055
- i_o.observe(cards);
1194
+ (0, $46MJV$solidjs.createEffect)((0, $46MJV$solidjs.on)(plp_results_, ()=>{
1195
+ if (!fallback_is_alive) // if all product card rendering functions after the initial rendering are synchronous the suspense boundary will never go into the fallback, so we don't know when they have finished rendering, and we can block the suspense. Therefore, we're just doing it with this effect
1196
+ block_suspense_if_needed();
1197
+ }, {
1198
+ defer: true
1056
1199
  }));
1057
1200
  return [
1058
- (0, $8e863dc22b06b688$export$a2cc176055f8f08)(),
1059
- cards,
1060
- style
1201
+ (0, $46MJV$solidjsweb.memo)((0, $8e863dc22b06b688$export$a2cc176055f8f08)),
1202
+ (()=>{
1203
+ const _el$2 = $8d94abc871e13baf$var$_tmpl$2.cloneNode(true);
1204
+ (0, $46MJV$solidjsweb.setAttribute)(_el$2, "id", random_id);
1205
+ (0, $46MJV$solidjsweb.insert)(_el$2, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
1206
+ get when () {
1207
+ return !is_loading_();
1208
+ },
1209
+ get fallback () {
1210
+ return rendered_placeholders();
1211
+ },
1212
+ get children () {
1213
+ return non_placeholder_product_cards();
1214
+ }
1215
+ }));
1216
+ return _el$2;
1217
+ })(),
1218
+ (()=>{
1219
+ const _el$3 = $8d94abc871e13baf$var$_tmpl$3.cloneNode(true);
1220
+ (0, $46MJV$solidjsweb.insert)(_el$3, get_styling);
1221
+ return _el$3;
1222
+ })()
1061
1223
  ];
1062
1224
  }
1063
1225
  });
@@ -1068,63 +1230,32 @@ function $8d94abc871e13baf$export$3925f87b1545cfc6({ plp_results_: plp_results_
1068
1230
  return _el$;
1069
1231
  })();
1070
1232
  }
1071
- async function $8d94abc871e13baf$var$insert_placeholders({ scroll_restoration_data_: [get_scroll_restoration_data] , min_products_to_fetch_: min_products_to_fetch_ , tenant_object_: tenant_object_ , rr_options_: rr_options_ , owner_: owner_ , cards_element_: cards_element_ , id_currently_querying_for_: id_currently_querying_for_ }) {
1072
- const num_placeholders = // we don't need runWithOwner here because we haven't had an await yet, so we haven't lost the owner
1073
- (0, $46MJV$solidjs.createMemo)(()=>{
1074
- // Can't use the data out of request_base for the id because request_base is too late, we need the correct amount of placeholders before the browser has restored the scroll state after processing all popstate events
1075
- return (0, $39d15a684cb3e309$export$6c9030e511152266) + (get_scroll_restoration_data().find(({ for_id: for_id })=>for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
1233
+ /**
1234
+ * Sets styling to styling generated by "Layout" (n_col_styling_with_dist) depending on if filters are open or not
1235
+ * This function is special to the actual PLPResults.
1236
+ */ function $8d94abc871e13baf$var$results_grid_styling_generator({ layout_options_: layout_options_ , sort_or_filter_open_: sort_or_filter_open_ , set_styling_: set_styling_ , selector_beginning_: selector_beginning_ }) {
1237
+ (0, $46MJV$solidjs.createRenderEffect)(()=>{
1238
+ // Add grid styling that changes when filters get opened/closed
1239
+ const when_filters_closed_cols = layout_options_.cols_at_size;
1240
+ const cols_at_size = sort_or_filter_open_() ? when_filters_closed_cols.map((row)=>{
1241
+ const [num_cols_default, , , , override_cols] = row;
1242
+ const cloned_row = [
1243
+ ...row
1244
+ ];
1245
+ // @ts-ignore
1246
+ cloned_row[0] = num_cols_default - 1;
1247
+ if (override_cols) // @ts-ignore
1248
+ cloned_row[4] = {
1249
+ overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column])=>[
1250
+ row,
1251
+ column - 1
1252
+ ]))
1253
+ };
1254
+ return cloned_row;
1255
+ }) : when_filters_closed_cols;
1256
+ const css = (0, $46MJV$depictaiutilishared.n_col_styling_with_dist)(selector_beginning_, layout_options_.grid_spacing, cols_at_size, "grid", layout_options_.override_vertical_spacing);
1257
+ set_styling_(css);
1076
1258
  });
1077
- let existing_num = 0;
1078
- let removed_old_children = false;
1079
- if (!$8d94abc871e13baf$var$cached_placeholder_element) {
1080
- const [dispose_card, root_in_root] = (0, $46MJV$solidjs.createRoot)((dispose)=>[
1081
- dispose,
1082
- (0, $46MJV$solidjs.getOwner)()
1083
- ]);
1084
- const { elements: elements } = await (0, $46MJV$depictaiutilishared.default_rr)(tenant_object_, {
1085
- ...rr_options_,
1086
- type: "placeholder",
1087
- pre_processors: [],
1088
- post_processors: [],
1089
- ...typeof rr_options_.template === "function" ? {
1090
- template: $8d94abc871e13baf$var$wrap_template_to_throw_into_error_boundary(rr_options_.template, root_in_root, ()=>(0, $46MJV$depictaiutilishared.queueMacroTask)((0, $46MJV$depictaiutilishared.catchify)(dispose_card)) // we just want it cloned and dead
1091
- )
1092
- } : {},
1093
- recs: [
1094
- {
1095
- page_url: "javascript:void(0)"
1096
- }
1097
- ] // This later gets ignored and turned into `null` by the SDK functions in the @depict-ai/ui package
1098
- });
1099
- const element = elements?.find((e)=>e instanceof HTMLElement || e instanceof SVGElement);
1100
- if (!element) return [];
1101
- $8d94abc871e13baf$var$cached_placeholder_element = element.cloneNode(true); // don't save the actual element, clone it directly so that the who provided it can't modify it later (this has caused a bug before with react)
1102
- }
1103
- (0, $46MJV$solidjs.runWithOwner)(owner_, ()=>(0, $46MJV$solidjs.createRenderEffect)(()=>{
1104
- const to_add = num_placeholders() - existing_num;
1105
- if (to_add <= 0) return;
1106
- // We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
1107
- // The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
1108
- cards_element_[removed_old_children ? "append" : (removed_old_children = true, "replaceChildren")](...Array.from({
1109
- length: to_add
1110
- }).map(()=>$8d94abc871e13baf$var$cached_placeholder_element.cloneNode(true)));
1111
- existing_num += to_add;
1112
- }));
1113
- }
1114
- function $8d94abc871e13baf$var$wrap_template_to_throw_into_error_boundary(template, root_in_root, on_finally) {
1115
- return async (...args)=>{
1116
- try {
1117
- return await (0, $46MJV$solidjs.runWithOwner)(root_in_root, ()=>template(...args)) || [];
1118
- } catch (e) {
1119
- (0, $46MJV$solidjs.runWithOwner)(root_in_root, ()=>{
1120
- // Throw in case of promise rejection, ultimately into ErrorBoundary
1121
- throw e;
1122
- });
1123
- return [];
1124
- } finally{
1125
- on_finally?.();
1126
- }
1127
- };
1128
1259
  }
1129
1260
 
1130
1261
 
@@ -1713,7 +1844,7 @@ function $76bb4acbbb94c2c6$export$ca21a16d65b3dd8({ show_extras_: [get_show_extr
1713
1844
  const $8984a0a949b1c852$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<form class="checkboxes"></form>`, 2);
1714
1845
  const $8984a0a949b1c852$var$max_visible_without_collapsing = 7;
1715
1846
  const $8984a0a949b1c852$var$show_non_collapsible_when_collapsed = 4;
1716
- function $8984a0a949b1c852$export$dd948f91abc3a1c4({ filter_: filter_ , selected_filters_: [get_selected_filters, set_selected_filters] , i18n_: i18n_ , view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_] }) {
1847
+ function $8984a0a949b1c852$export$dd948f91abc3a1c4({ filter_: filter_ , selected_filters_: [get_selected_filters, set_selected_filters] , i18n_: i18n_ , view_more_button_below_group_: [, set_view_more_button_below_group_] }) {
1717
1848
  const existing_filter = (0, $46MJV$solidjs.createMemo)(()=>{
1718
1849
  const { field: field , op: op } = filter_();
1719
1850
  return get_selected_filters().find(({ field: checking_field , op: checking_op })=>checking_field === field && checking_op === op);
@@ -1794,7 +1925,7 @@ function $8984a0a949b1c852$export$dd948f91abc3a1c4({ filter_: filter_ , selected
1794
1925
  ...base_object,
1795
1926
  data: [
1796
1927
  ...new FormData(form)
1797
- ].filter(([_key, value])=>value === "on").map(([key])=>key)
1928
+ ].filter(([, value])=>value === "on").map(([key])=>key)
1798
1929
  };
1799
1930
  const selected_filters = [
1800
1931
  ...get_selected_filters()
@@ -4628,90 +4759,6 @@ function $cdc2c00c0a7da86e$export$466cdc317043f6cb({ quicklinks_data_: quicklink
4628
4759
 
4629
4760
 
4630
4761
 
4631
-
4632
-
4633
- function $207f7b30db90d048$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ , query_id_: query_id_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , plp_results_: plp_results_ , router_: router_ }) {
4634
- // If we just got opened in a new tab, clear filters instantly and remove the flag
4635
- $207f7b30db90d048$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
4636
- plp_results_: plp_results_,
4637
- local_filter_cache_: local_filter_cache_,
4638
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
4639
- selected_filters_: selected_filters_,
4640
- i18n_: i18n_,
4641
- router_: router_
4642
- });
4643
- // Code below is for when we're already open and the user navigates to a new category
4644
- let previous_crumb_data = (0, $46MJV$solidjs.untrack)(crumb_data_);
4645
- let query_id_when_we_got_previous_data = (0, $46MJV$solidjs.untrack)(query_id_);
4646
- let allow_filter_clearing = true; // set to false when going backwards/forwards
4647
- // temporarily disable filter clearing when going backwards/forwards
4648
- const handler = ()=>allow_filter_clearing = false;
4649
- window.addEventListener("popstate", handler); // popstate only gets called when using back/forwards button of browser or the history navigate to achieve the same, but not on pushState or replaceState
4650
- (0, $46MJV$solidjs.onCleanup)(()=>window.removeEventListener("popstate", handler));
4651
- (0, $46MJV$solidjs.createEffect)((0, $46MJV$solidjs.on)(crumb_data_, (0, $46MJV$depictaiutilishared.catchify)((new_crumb_data)=>{
4652
- const query_id_of_new_data = query_id_();
4653
- if (allow_filter_clearing && previous_crumb_data && new_crumb_data && query_id_of_new_data !== query_id_when_we_got_previous_data) {
4654
- const previous_length = previous_crumb_data.length;
4655
- const new_length = new_crumb_data.length;
4656
- const went_upwards = new_length < previous_length;
4657
- const went_downwards = previous_length < new_length;
4658
- const shorter_array = went_upwards ? new_crumb_data : previous_crumb_data;
4659
- const longer_array = went_upwards ? previous_crumb_data : new_crumb_data;
4660
- if (!((went_upwards || went_downwards) && shorter_array.every(({ query_id: query_id }, index)=>longer_array[index].query_id === query_id))) {
4661
- // We went sideways, not up or down. Clear filters.
4662
- (0, $92e4e7906daa1ff8$export$8895d39404bd2bb1)({
4663
- user_triggered_: false,
4664
- i18n_: i18n_,
4665
- also_clear_sorting_: false,
4666
- selected_filters_: selected_filters_,
4667
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
4668
- local_filter_cache_: local_filter_cache_
4669
- });
4670
- // Also ensure we don't have `sideways_url_params_flag` set anymore
4671
- $207f7b30db90d048$var$delete_sideways_param_flag(router_);
4672
- }
4673
- }
4674
- query_id_when_we_got_previous_data = query_id_of_new_data;
4675
- previous_crumb_data = new_crumb_data;
4676
- if (!allow_filter_clearing) allow_filter_clearing = true;
4677
- })));
4678
- }
4679
- function $207f7b30db90d048$var$clear_if_opened_new_tab_with_sideways_url_params_flag({ plp_results_: plp_results_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , router_: router_ }) {
4680
- const tracking_function_for_plp_results = (0, $46MJV$solidjs.createReaction)(()=>{
4681
- // On first rendering of the CategoryPage (after we have results), check if we got to this URL by going sideways in QuickLinks and clear filters with toast if so
4682
- const had_flag = $207f7b30db90d048$var$delete_sideways_param_flag(router_);
4683
- if (!had_flag) return;
4684
- (0, $46MJV$depictaiutilishared.dlog)("Flag to clear filters was set, clearing filters");
4685
- (0, $46MJV$depictaiutilishared.queueMacroTask)(()=>{
4686
- // Do it next task so that all the filters have time to populate
4687
- (0, $92e4e7906daa1ff8$export$8895d39404bd2bb1)({
4688
- user_triggered_: false,
4689
- i18n_: i18n_,
4690
- also_clear_sorting_: false,
4691
- selected_filters_: selected_filters_,
4692
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
4693
- local_filter_cache_: local_filter_cache_
4694
- });
4695
- });
4696
- });
4697
- tracking_function_for_plp_results(plp_results_);
4698
- }
4699
- function $207f7b30db90d048$var$delete_sideways_param_flag(router) {
4700
- const url_object = new URL(location.href);
4701
- const { searchParams: searchParams } = url_object;
4702
- if (searchParams.get((0, $c6a04c153e9853a7$export$e2cf3f19dd3f8aac)) !== "true") return false;
4703
- searchParams.delete((0, $c6a04c153e9853a7$export$e2cf3f19dd3f8aac));
4704
- router.navigate_.go_to_({
4705
- new_url_: url_object,
4706
- is_replace_: true,
4707
- force_spa_navigation_: true
4708
- });
4709
- return true;
4710
- }
4711
-
4712
-
4713
-
4714
-
4715
4762
  const $151280ad98f4438b$var$max_history_change_frequency = 300;
4716
4763
  const $151280ad98f4438b$var$api_max_products_per_request = 100;
4717
4764
  function $151280ad98f4438b$export$6e49da55e449af7c({ scroll_restoration_data_: [, set_scroll_restoration_data] , last_result_in_viewport_: [get_last_result_in_viewport_] , id_: id_ , can_write_scroll_restoration_: can_write_scroll_restoration_ }) {
@@ -4824,8 +4871,92 @@ let $29b757e2ae26852c$export$44dad306455dddf;
4824
4871
  })($29b757e2ae26852c$export$44dad306455dddf || ($29b757e2ae26852c$export$44dad306455dddf = {}));
4825
4872
 
4826
4873
 
4874
+
4875
+
4876
+
4877
+
4878
+ function $207f7b30db90d048$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ , query_id_: query_id_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , plp_results_: plp_results_ , router_: router_ }) {
4879
+ // If we just got opened in a new tab, clear filters instantly and remove the flag
4880
+ $207f7b30db90d048$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
4881
+ plp_results_: plp_results_,
4882
+ local_filter_cache_: local_filter_cache_,
4883
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
4884
+ selected_filters_: selected_filters_,
4885
+ i18n_: i18n_,
4886
+ router_: router_
4887
+ });
4888
+ // Code below is for when we're already open and the user navigates to a new category
4889
+ let previous_crumb_data = (0, $46MJV$solidjs.untrack)(crumb_data_);
4890
+ let query_id_when_we_got_previous_data = (0, $46MJV$solidjs.untrack)(query_id_);
4891
+ let allow_filter_clearing = true; // set to false when going backwards/forwards
4892
+ // temporarily disable filter clearing when going backwards/forwards
4893
+ const handler = ()=>allow_filter_clearing = false;
4894
+ window.addEventListener("popstate", handler); // popstate only gets called when using back/forwards button of browser or the history navigate to achieve the same, but not on pushState or replaceState
4895
+ (0, $46MJV$solidjs.onCleanup)(()=>window.removeEventListener("popstate", handler));
4896
+ (0, $46MJV$solidjs.createEffect)((0, $46MJV$solidjs.on)(crumb_data_, (0, $46MJV$depictaiutilishared.catchify)((new_crumb_data)=>{
4897
+ const query_id_of_new_data = query_id_();
4898
+ if (allow_filter_clearing && previous_crumb_data && new_crumb_data && query_id_of_new_data !== query_id_when_we_got_previous_data) {
4899
+ const previous_length = previous_crumb_data.length;
4900
+ const new_length = new_crumb_data.length;
4901
+ const went_upwards = new_length < previous_length;
4902
+ const went_downwards = previous_length < new_length;
4903
+ const shorter_array = went_upwards ? new_crumb_data : previous_crumb_data;
4904
+ const longer_array = went_upwards ? previous_crumb_data : new_crumb_data;
4905
+ if (!((went_upwards || went_downwards) && shorter_array.every(({ query_id: query_id }, index)=>longer_array[index].query_id === query_id))) {
4906
+ // We went sideways, not up or down. Clear filters.
4907
+ (0, $92e4e7906daa1ff8$export$8895d39404bd2bb1)({
4908
+ user_triggered_: false,
4909
+ i18n_: i18n_,
4910
+ also_clear_sorting_: false,
4911
+ selected_filters_: selected_filters_,
4912
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
4913
+ local_filter_cache_: local_filter_cache_
4914
+ });
4915
+ // Also ensure we don't have `sideways_url_params_flag` set anymore
4916
+ $207f7b30db90d048$var$delete_sideways_param_flag(router_);
4917
+ }
4918
+ }
4919
+ query_id_when_we_got_previous_data = query_id_of_new_data;
4920
+ previous_crumb_data = new_crumb_data;
4921
+ if (!allow_filter_clearing) allow_filter_clearing = true;
4922
+ })));
4923
+ }
4924
+ function $207f7b30db90d048$var$clear_if_opened_new_tab_with_sideways_url_params_flag({ plp_results_: plp_results_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , router_: router_ }) {
4925
+ const tracking_function_for_plp_results = (0, $46MJV$solidjs.createReaction)(()=>{
4926
+ // On first rendering of the CategoryPage (after we have results), check if we got to this URL by going sideways in QuickLinks and clear filters with toast if so
4927
+ const had_flag = $207f7b30db90d048$var$delete_sideways_param_flag(router_);
4928
+ if (!had_flag) return;
4929
+ (0, $46MJV$depictaiutilishared.dlog)("Flag to clear filters was set, clearing filters");
4930
+ (0, $46MJV$depictaiutilishared.queueMacroTask)(()=>{
4931
+ // Do it next task so that all the filters have time to populate
4932
+ (0, $92e4e7906daa1ff8$export$8895d39404bd2bb1)({
4933
+ user_triggered_: false,
4934
+ i18n_: i18n_,
4935
+ also_clear_sorting_: false,
4936
+ selected_filters_: selected_filters_,
4937
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
4938
+ local_filter_cache_: local_filter_cache_
4939
+ });
4940
+ });
4941
+ });
4942
+ tracking_function_for_plp_results(plp_results_);
4943
+ }
4944
+ function $207f7b30db90d048$var$delete_sideways_param_flag(router) {
4945
+ const url_object = new URL(location.href);
4946
+ const { searchParams: searchParams } = url_object;
4947
+ if (searchParams.get((0, $c6a04c153e9853a7$export$e2cf3f19dd3f8aac)) !== "true") return false;
4948
+ searchParams.delete((0, $c6a04c153e9853a7$export$e2cf3f19dd3f8aac));
4949
+ router.navigate_.go_to_({
4950
+ new_url_: url_object,
4951
+ is_replace_: true,
4952
+ force_spa_navigation_: true
4953
+ });
4954
+ return true;
4955
+ }
4956
+
4957
+
4827
4958
  const $671632478f2a7ce7$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="product-count"> </div>`, 2), $671632478f2a7ce7$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div></div>`, 2), $671632478f2a7ce7$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $671632478f2a7ce7$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp category"><div class="listing-page"></div></div>`, 4);
4828
- function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , slider_arrow_button_: slider_arrow_button_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , rr_options_: rr_options_ , get_product_id_: get_product_id_ }) {
4959
+ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , slider_arrow_button_: slider_arrow_button_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ }) {
4829
4960
  let results_for;
4830
4961
  let only_show_filters_opener_;
4831
4962
  let middle_elements_;
@@ -4835,12 +4966,6 @@ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
4835
4966
  show_n_results_: incoming_i18n.show_n_products_,
4836
4967
  no_results_text_: incoming_i18n.no_products_text_
4837
4968
  };
4838
- const tenant_object_ = new (0, $46MJV$depictaiutilishared.Tenant)({
4839
- TENANT: (0, $46MJV$solidjs.untrack)(tenant_),
4840
- MARKET: (0, $46MJV$solidjs.untrack)(market_),
4841
- GA_ID: "",
4842
- get_product_id: get_product_id_
4843
- });
4844
4969
  const [get_sorting] = current_sorting_;
4845
4970
  const number_of_rendered_selected_filters_items_ = (0, $46MJV$solidjs.createSignal)(0);
4846
4971
  const first_result_in_viewport_ = (0, $46MJV$solidjs.createSignal)();
@@ -5077,11 +5202,9 @@ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
5077
5202
  last_result_in_viewport_: last_result_in_viewport_,
5078
5203
  scroll_restoration_data_: scroll_restoration_data_,
5079
5204
  layout_options_: layout_options_,
5080
- rr_options_: rr_options_,
5205
+ product_card_template_: product_card_template_,
5081
5206
  sort_or_filter_open_: sort_or_filter_open_,
5082
5207
  desktop_filter_elements_: desktop_filter_elements_,
5083
- tenant_object_: tenant_object_,
5084
- type_for_tracking_: "category",
5085
5208
  id_currently_querying_for_: query_id_,
5086
5209
  no_results_options_: {
5087
5210
  selected_filters_: selected_filters_,
@@ -5520,7 +5643,7 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
5520
5643
  });
5521
5644
  }
5522
5645
  }
5523
- function $068a627cc18f7bb6$export$e2bf8ce7779e827e({ depict_category: depict_category , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , get_product_id: get_product_id , show_breadcrumbs: show_breadcrumbs = true , show_quicklinks: show_quicklinks = true , category_title: category_title }) {
5646
+ function $068a627cc18f7bb6$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 }) {
5524
5647
  const shared_properties = $068a627cc18f7bb6$var$get_shared_properties(depict_category);
5525
5648
  const grid_spacing_override = typeof grid_spacing === "string" ? {
5526
5649
  grid_spacing: grid_spacing
@@ -5553,17 +5676,11 @@ function $068a627cc18f7bb6$export$e2bf8ce7779e827e({ depict_category: depict_cat
5553
5676
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
5554
5677
  selected_filters_: selected_filters_,
5555
5678
  scroll_restoration_data_: scroll_restoration_data_,
5556
- get_product_id_: get_product_id,
5557
5679
  layout_options_: {
5558
5680
  cols_at_size: (0, $7958d3dbd96a4f87$export$6daf8749b65a1b77)(cols_at_size),
5559
5681
  ...grid_spacing_override
5560
5682
  },
5561
- rr_options_: {
5562
- template: (display, info)=>{
5563
- const is_placeholder = info.rendering_options.type === "placeholder";
5564
- return product_card_template(is_placeholder ? null : display, info);
5565
- }
5566
- }
5683
+ product_card_template_: product_card_template
5567
5684
  });
5568
5685
  }, "Entire CategoryPage failed");
5569
5686
  }
@@ -5969,22 +6086,48 @@ function $2989e355f64e18e1$export$b94867ecbd698f21({ search_field_value_: search
5969
6086
 
5970
6087
 
5971
6088
 
6089
+
6090
+
5972
6091
  const $9f81b7ced87aabf2$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="cards"></div>`, 2), $9f81b7ced87aabf2$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="search-recs"><h3 class="search-recs-title"></h3></div>`, 4), $9f81b7ced87aabf2$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<button class="show-more major" type="button"></button>`, 2);
5973
6092
  const $9f81b7ced87aabf2$export$1c8c715550dc689d = 2;
5974
- function $9f81b7ced87aabf2$export$7de92c4c2205ebf3({ depict_api_: depict_api_ , i18n_: i18n_ , tenant_object_: tenant_object_ , search_query_base_: search_query_base_ , rr_options_: rr_options_ , showing_recommendation_rows_: showing_recommendation_rows_ , view_more_button_: view_more_button_ = true , layout_options_: layout_options_ }) {
5975
- const [is_showing_something, set_is_showing_something] = (0, $46MJV$solidjs.createSignal)(false);
5976
- const cards = $9f81b7ced87aabf2$var$_tmpl$.cloneNode(true);
5977
- const on_next_render = [];
5978
- const main_element = (()=>{
6093
+ function $9f81b7ced87aabf2$export$7de92c4c2205ebf3({ depict_api_: depict_api_ , i18n_: i18n_ , search_query_base_: search_query_base_ , product_card_template_: product_card_template_ , showing_recommendation_rows_: showing_recommendation_rows_ , view_more_button_: view_more_button_ = true , layout_options_: layout_options_ }) {
6094
+ const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
6095
+ const rows_object = view_more_button_ ? $9f81b7ced87aabf2$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
6096
+ const [recommendations_resource] = (0, $46MJV$solidjs.createResource)(search_query_base_, (query)=>depict_api_.get_recommended(query).then((r)=>r.displays));
6097
+ const is_showing_something = (0, $46MJV$solidjs.createMemo)(()=>recommendations_resource.loading || recommendations_resource()?.length);
6098
+ const num_placeholders_ = (0, $46MJV$solidjs.createMemo)(()=>(0, $39d15a684cb3e309$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_.cols_at_size.map(([per_column])=>per_column)));
6099
+ const cards = (()=>{
6100
+ const _el$ = $9f81b7ced87aabf2$var$_tmpl$.cloneNode(true);
6101
+ (0, $46MJV$solidjsweb.insert)(_el$, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Suspense), {
6102
+ get fallback () {
6103
+ return (0, $7b0b7e887b485a91$export$f33414a4df0afd3f)({
6104
+ num_placeholders_: num_placeholders_,
6105
+ product_card_template_: product_card_template_
6106
+ });
6107
+ },
6108
+ get children () {
6109
+ return (()=>{
6110
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
6111
+ const displays_by_key_ = (0, $ea6c1dd5af2900d8$export$7f8bd308237ab5a5)((0, $46MJV$solidjs.createMemo)(()=>recommendations_resource() || []));
6112
+ return (0, $ea6c1dd5af2900d8$export$43f0fb951fcb0c54)({
6113
+ displays_by_key_: displays_by_key_,
6114
+ merchant_: (0, $46MJV$solidjs.createMemo)(()=>search_query_base_().tenant),
6115
+ market_: (0, $46MJV$solidjs.createMemo)(()=>search_query_base_().market),
6116
+ product_card_template_: product_card_template_
6117
+ });
6118
+ })();
6119
+ }
6120
+ }));
6121
+ return _el$;
6122
+ })();
6123
+ const search_recs_elements = (()=>{
5979
6124
  const _el$2 = $9f81b7ced87aabf2$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
5980
6125
  (0, $46MJV$solidjsweb.insert)(_el$3, ()=>i18n_.search_recs_title_());
5981
6126
  (0, $46MJV$solidjsweb.insert)(_el$2, (0, $8e863dc22b06b688$export$a2cc176055f8f08), null);
5982
6127
  (0, $46MJV$solidjsweb.insert)(_el$2, cards, null);
5983
6128
  return _el$2;
5984
6129
  })();
5985
- const [get_showing_recommendation_rows] = showing_recommendation_rows_;
5986
- const rows_object = view_more_button_ ? $9f81b7ced87aabf2$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
5987
- const cleanup_old_cards = [];
6130
+ // the cards element must have a parent for Layout to work, therefore we're inserting it into a div above
5988
6131
  (0, $46MJV$depictaiutilishared.Layout)({
5989
6132
  container_element: cards,
5990
6133
  layout: "grid",
@@ -5994,77 +6137,11 @@ function $9f81b7ced87aabf2$export$7de92c4c2205ebf3({ depict_api_: depict_api_ ,
5994
6137
  e,
5995
6138
  "Layout failed"
5996
6139
  ], "error"));
5997
- // copied from RecommendationGrid
5998
- // convoluted lazy loading that
5999
- // when the elements are in the DOM starts IntersectionObserver on whole grid
6000
- // when grid intersects starts Lazyfier
6001
- // this is because Lazyfier is fucking stupid
6002
- (0, $46MJV$depictaiutilishared.observer).wait_for_element(cards).then((0, $46MJV$depictaiutilishared.catchify)((element)=>{
6003
- let start_lazy_loading;
6004
- const lazy_loading_promise = new Promise((r)=>start_lazy_loading = r);
6005
- const lf = new (0, $46MJV$depictaiutilishared.Lazyfier)({
6006
- only_load_intersecting: true,
6007
- wait_for_dominsertion: lazy_loading_promise,
6008
- ignore_data_urls: true,
6009
- lazyfinder: {
6010
- unload () {}
6011
- }
6012
- });
6013
- lf.start_observing_for_new_children_(element);
6014
- const i_o = new IntersectionObserver((0, $46MJV$depictaiutilishared.catchify)((records)=>{
6015
- for (const record of records)if (record.intersectionRatio > 0) {
6016
- start_lazy_loading();
6017
- i_o.disconnect();
6018
- return;
6019
- }
6020
- }));
6021
- i_o.observe(cards);
6022
- }));
6023
- const deparallelized_recs_fetcher = (0, $46MJV$depictaiutilishared.deparallelize_no_drop)((0, $46MJV$depictaiutilishared.catchify)(async (base_query)=>{
6024
- const recs_promise = depict_api_.get_recommended(base_query).then((r)=>r.displays);
6025
- // create owner to run product cards with an Owner, so they know when they've gotten removed
6026
- const [owner_for_cards, dispose_our_cards] = (0, $46MJV$solidjs.createRoot)((dispose)=>[
6027
- (0, $46MJV$solidjs.getOwner)(),
6028
- dispose
6029
- ]);
6030
- const rendering_result = await (await (0, $46MJV$depictaiutilishared.make_placeholder_rr)({
6031
- // render the max amount of elements that there could be, to make sure scroll restoration works (placeholders can't be shorter than actual content)
6032
- num_items: (0, $39d15a684cb3e309$export$6c9030e511152266) + (0, $46MJV$solidjs.untrack)(get_showing_recommendation_rows) * Math.max(...layout_options_.cols_at_size.map(([per_column])=>per_column))
6033
- }))(tenant_object_, // @ts-ignore - make_placeholder_rr types is a touchy subject
6034
- {
6035
- type: "search_recs",
6036
- recs: recs_promise,
6037
- ...rr_options_,
6038
- ...typeof rr_options_.template === "function" ? {
6039
- template: (...args)=>(0, $46MJV$solidjs.runWithOwner)(owner_for_cards, ()=>// give template the possibility to know when it gets removed from the DOM by using solid-js onCleanup
6040
- // @ts-ignore
6041
- rr_options_.template(...args))
6042
- } : {}
6043
- });
6044
- const { elements: elements , should_stay_inserted: should_stay_inserted } = rendering_result;
6045
- let dead = false;
6046
- while(on_next_render.length)on_next_render.pop()();
6047
- on_next_render.push(()=>dead = true);
6048
- if (!elements) {
6049
- set_is_showing_something(false);
6050
- return;
6051
- }
6052
- cards.replaceChildren(...elements);
6053
- // Dispose the old cards just after the cards have been removed from the DOM
6054
- cleanup_old_cards.forEach((cleanup_function)=>cleanup_function());
6055
- cleanup_old_cards.push(dispose_our_cards); // push after calling, so that we don't instantly demolish ourselves lol
6056
- set_is_showing_something(true);
6057
- should_stay_inserted?.then((should)=>{
6058
- if (!should && !dead /* just in case */ ) set_is_showing_something(false);
6059
- });
6060
- }));
6061
- (0, $46MJV$solidjs.createRenderEffect)(()=>deparallelized_recs_fetcher(search_query_base_()));
6062
- (0, $46MJV$solidjs.onCleanup)(()=>cleanup_old_cards.forEach((fn)=>fn())); // if everything gets cleaned up without new cards replacing the old ones, clean up the last cards
6063
6140
  return (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
6064
6141
  get when () {
6065
6142
  return is_showing_something();
6066
6143
  },
6067
- children: main_element
6144
+ children: search_recs_elements
6068
6145
  });
6069
6146
  }
6070
6147
  function $9f81b7ced87aabf2$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
@@ -6276,7 +6353,8 @@ async function $1c323edfb89c9dca$export$e16630ecb9644a1c({ on_submit_with_unchan
6276
6353
 
6277
6354
 
6278
6355
  const $1bf0125991f2d39b$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="orig price"></span>`, 2), $1bf0125991f2d39b$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title"></span></div><div class="price-container"><span class="price"></span></div></div></a>`, 16), $1bf0125991f2d39b$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="tagline"></div>`, 2);
6279
- const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market }, router_)=>{
6356
+ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n }, router_)=>{
6357
+ const search_result_id = (0, $46MJV$solidjs.createMemo)(()=>display_or_variant_container().search_result_id);
6280
6358
  const display = (0, $46MJV$solidjs.createMemo)(()=>{
6281
6359
  const display = display_or_variant_container();
6282
6360
  // Support for backend's new display format
@@ -6294,19 +6372,19 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6294
6372
  });
6295
6373
  const image_url = (0, $46MJV$solidjs.createMemo)(()=>display().image_url);
6296
6374
  const contained_image = (0, $46MJV$solidjs.createMemo)(()=>(0, $46MJV$depictaiutilishared.ContainedImage)({
6375
+ loading: "lazy",
6297
6376
  aspect_ratio: 1,
6298
6377
  alt: "",
6299
6378
  rendering_options: {},
6300
- // @ts-ignore
6301
- "data-src": image_url(),
6379
+ "src": image_url(),
6302
6380
  srcset_opts: {
6303
- set_dataset: true
6381
+ set_dataset: false
6304
6382
  },
6305
- init_with_placeholder: true
6383
+ sizes: "0px"
6306
6384
  }));
6307
6385
  const is_sale = (0, $46MJV$solidjs.createMemo)(()=>display().sale_price !== display().original_price);
6308
6386
  const href = (0, $46MJV$solidjs.createMemo)(()=>display().page_url);
6309
- const returnVal = (()=>{
6387
+ return (()=>{
6310
6388
  const _el$ = $1bf0125991f2d39b$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
6311
6389
  (0, $46MJV$solidjsweb.addEventListener)(_el$, "click", (0, $46MJV$depictaiutilishared.catchify)((event_)=>router_.navigate_.go_to_({
6312
6390
  new_url_: href(),
@@ -6357,18 +6435,18 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6357
6435
  }), null);
6358
6436
  (0, $46MJV$solidjsweb.insert)(_el$9, ()=>i18n.price_formatting_().post_, null);
6359
6437
  (0, $46MJV$solidjsweb.effect)((_p$)=>{
6360
- const _v$ = href(), _v$2 = !!is_sale();
6438
+ const _v$ = href(), _v$2 = search_result_id(), _v$3 = !!is_sale();
6361
6439
  _v$ !== _p$._v$ && (0, $46MJV$solidjsweb.setAttribute)(_el$, "href", _p$._v$ = _v$);
6362
- _v$2 !== _p$._v$2 && _el$9.classList.toggle("sales-price", _p$._v$2 = _v$2);
6440
+ _v$2 !== _p$._v$2 && (0, $46MJV$solidjsweb.setAttribute)(_el$, "data-search-result-id", _p$._v$2 = _v$2);
6441
+ _v$3 !== _p$._v$3 && _el$9.classList.toggle("sales-price", _p$._v$3 = _v$3);
6363
6442
  return _p$;
6364
6443
  }, {
6365
6444
  _v$: undefined,
6366
- _v$2: undefined
6445
+ _v$2: undefined,
6446
+ _v$3: undefined
6367
6447
  });
6368
6448
  return _el$;
6369
6449
  })();
6370
- // This solves a JSX type issue where the return value does not match with the explicit JSX.Element type for some reason
6371
- return returnVal;
6372
6450
  };
6373
6451
  (0, $46MJV$solidjsweb.delegateEvents)([
6374
6452
  "click"
@@ -6405,7 +6483,7 @@ function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ ,
6405
6483
  }));
6406
6484
  const sliced_displays = (0, $46MJV$solidjs.createMemo)(()=>search_results()?.displays?.slice(0, max_cards));
6407
6485
  let placeholder;
6408
- const container = (()=>{
6486
+ return (()=>{
6409
6487
  const _el$ = $4cadf33fd6aaf4b6$var$_tmpl$.cloneNode(true);
6410
6488
  (0, $46MJV$solidjsweb.insert)(_el$, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
6411
6489
  get when () {
@@ -6423,8 +6501,8 @@ function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ ,
6423
6501
  get each () {
6424
6502
  return sliced_displays();
6425
6503
  },
6426
- children: (d, i)=>$4cadf33fd6aaf4b6$var$track_elements(d, i, // Custom instant card requires a re-render on every display or i18n update
6427
- render_instant_card_ ? (0, $46MJV$solidjs.createMemo)(()=>render_instant_card_(d(), {
6504
+ children: (d, i)=>{
6505
+ const card = render_instant_card_ ? (0, $46MJV$solidjs.createMemo)(()=>render_instant_card_(d(), {
6428
6506
  index: i,
6429
6507
  i18n: (0, $850f0c7c629012e3$export$27b710c08412a7ad)(i18n_),
6430
6508
  merchant: tenant_(),
@@ -6434,79 +6512,14 @@ function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ ,
6434
6512
  i18n: i18n_,
6435
6513
  merchant: tenant_(),
6436
6514
  market: market_()
6437
- }, router_), tenant_, market_)
6515
+ }, router_);
6516
+ return card;
6517
+ }
6438
6518
  });
6439
6519
  }
6440
6520
  }));
6441
6521
  return _el$;
6442
6522
  })();
6443
- new (0, $46MJV$depictaiutilishared.Lazyfier)({
6444
- container: container,
6445
- lazyfinder: {
6446
- unload () {}
6447
- },
6448
- ignore_data_urls: true
6449
- });
6450
- return container;
6451
- }
6452
- function $4cadf33fd6aaf4b6$var$track_elements(display, index, elements, tenant, market) {
6453
- const type = "instant_result";
6454
- const unwrapped_elements = $4cadf33fd6aaf4b6$var$unwrap_solid_jsx_element(elements);
6455
- const disconnectors = [];
6456
- (0, $46MJV$solidjs.createComputed)(()=>{
6457
- let stop = false;
6458
- const modern_or_legacy_d = display(); // For every display
6459
- const d = "variant_index" in modern_or_legacy_d ? modern_or_legacy_d.variant_displays[modern_or_legacy_d.variant_index] : modern_or_legacy_d;
6460
- const t = tenant(); // and tenant
6461
- const m = market(); // / market combination
6462
- const click_handler = ()=>{
6463
- (0, $46MJV$depictaiutilishared.depict_click)({
6464
- tenant: (0, $46MJV$solidjs.untrack)(tenant),
6465
- market: (0, $46MJV$solidjs.untrack)(market),
6466
- ...d,
6467
- click_location: type + "_" + (index + 1),
6468
- recommendation_type: type
6469
- });
6470
- localStorage.setItem(`depict_attribution_${d.product_id}`, d.search_result_id);
6471
- };
6472
- while(disconnectors.length)// disconnect stuff from old display
6473
- disconnectors.pop()();
6474
- disconnectors.push(()=>stop = true);
6475
- (0, $46MJV$solidjs.createComputed)(()=>{
6476
- if (stop) return;
6477
- const filtered_els = unwrapped_elements().filter((el)=>el instanceof Element);
6478
- for (const element of filtered_els){
6479
- element.addEventListener("click", click_handler);
6480
- disconnectors.push((0, $46MJV$depictaiutilishared.impression_track_element)({
6481
- element: element,
6482
- data: {
6483
- tenant: t,
6484
- market: m,
6485
- recommendation_type: type,
6486
- recommendation_id: d.recommendation_id,
6487
- product_id: d.product_id,
6488
- entity_price: d.entity_price
6489
- }
6490
- }), ()=>element.removeEventListener("click", click_handler));
6491
- }
6492
- (0, $46MJV$depictaiutilishared.add_new_tab_listener)(filtered_els, d, 1, (disconnector)=>disconnectors.push(disconnector));
6493
- });
6494
- });
6495
- return elements;
6496
- }
6497
- function $4cadf33fd6aaf4b6$var$unwrap_solid_jsx_element(elements) {
6498
- // FYI this probably doesn't work on hugely deep nestings or large amount of elements
6499
- return (0, $46MJV$solidjs.createMemo)(()=>$4cadf33fd6aaf4b6$var$unwrapping_helper(elements));
6500
- }
6501
- function $4cadf33fd6aaf4b6$var$unwrapping_helper(elements) {
6502
- const result = [];
6503
- if (Array.isArray(elements)) for(let i = 0; i < elements.length; i++){
6504
- const element = elements[i];
6505
- result.push(...$4cadf33fd6aaf4b6$var$unwrapping_helper(element));
6506
- }
6507
- else if (typeof elements == "function") result.push(...$4cadf33fd6aaf4b6$var$unwrapping_helper(elements()));
6508
- else if (elements != undefined && typeof elements != "boolean") result.push(elements);
6509
- return result;
6510
6523
  }
6511
6524
 
6512
6525
 
@@ -7547,13 +7560,7 @@ function $297ca03cb5dd5701$export$9dd50d35b9d94fdf({ get_search_query_: get_sear
7547
7560
 
7548
7561
  const $93779a41dce11249$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $93779a41dce11249$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp search"><div class="listing-page"></div></div>`, 4);
7549
7562
  function $93779a41dce11249$export$a54ec244c8863715(opts) {
7550
- const { depict_api_: depict_api_ , search_field_value_: search_field_value_ , get_search_query_: get_search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , rr_options_: rr_options_ , recommendations_rr_options_: recommendations_rr_options_ = rr_options_ , search_recs_view_more_: search_recs_view_more_ , get_product_id_: get_product_id_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ } = opts;
7551
- const tenant_object_ = new (0, $46MJV$depictaiutilishared.Tenant)({
7552
- TENANT: (0, $46MJV$solidjs.untrack)(tenant_),
7553
- MARKET: (0, $46MJV$solidjs.untrack)(market_),
7554
- GA_ID: "",
7555
- get_product_id: get_product_id_
7556
- });
7563
+ const { depict_api_: depict_api_ , search_field_value_: search_field_value_ , get_search_query_: get_search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , search_recs_view_more_: search_recs_view_more_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ } = opts;
7557
7564
  const [get_sorting] = current_sorting_;
7558
7565
  const all_products_loaded_ = (0, $46MJV$solidjs.createSignal)(false);
7559
7566
  const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
@@ -7704,10 +7711,6 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7704
7711
  get_search_query_();
7705
7712
  (0, $fe1bd893954cc9ca$export$c7e181728ad525f)(location);
7706
7713
  });
7707
- (0, $46MJV$solidjs.createComputed)(()=>{
7708
- tenant_object_.tenant = tenant_object_.TENANT = tenant_();
7709
- tenant_object_.market = tenant_object_.MARKET = market_();
7710
- });
7711
7714
  return [
7712
7715
  document.createComment("Search page based on Depict SDK"),
7713
7716
  (()=>{
@@ -7763,11 +7766,9 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7763
7766
  last_result_in_viewport_: last_result_in_viewport_,
7764
7767
  scroll_restoration_data_: scroll_restoration_data_,
7765
7768
  desktop_filter_elements_: desktop_filter_elements_,
7766
- rr_options_: rr_options_,
7769
+ product_card_template_: product_card_template_,
7767
7770
  layout_options_: layout_options_,
7768
7771
  sort_or_filter_open_: sort_or_filter_open_,
7769
- tenant_object_: tenant_object_,
7770
- type_for_tracking_: "search",
7771
7772
  id_currently_querying_for_: get_search_query_,
7772
7773
  no_results_options_: {
7773
7774
  selected_filters_: selected_filters_,
@@ -7794,9 +7795,8 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7794
7795
  search_query_base_: search_query_base_,
7795
7796
  layout_options_: recommendations_layout_options_,
7796
7797
  showing_recommendation_rows_: showing_recommendation_rows_,
7797
- rr_options_: recommendations_rr_options_,
7798
7798
  view_more_button_: search_recs_view_more_,
7799
- tenant_object_: tenant_object_
7799
+ product_card_template_: product_card_template_
7800
7800
  });
7801
7801
  }
7802
7802
  });
@@ -8086,7 +8086,7 @@ function $79fbf145b15af988$var$get_shared_properties(depict_search) {
8086
8086
  if (!shared_properties) throw new Error("Can't connect to provided DepictSearch instance");
8087
8087
  return shared_properties;
8088
8088
  }
8089
- function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_search , include_input_field: include_input_field , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , get_product_id: get_product_id = (0, $46MJV$depictaiutilishared.normal_get_product_id) , extra_depict_options: extra_depict_options }) {
8089
+ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_search , include_input_field: include_input_field , grid_spacing: grid_spacing , cols_at_size: cols_at_size , product_card_template: product_card_template , extra_depict_options: extra_depict_options }) {
8090
8090
  const shared_properties = $79fbf145b15af988$var$get_shared_properties(depict_search);
8091
8091
  const grid_spacing_override = typeof grid_spacing === "string" ? {
8092
8092
  grid_spacing: grid_spacing
@@ -8153,15 +8153,7 @@ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
8153
8153
  height_: 12,
8154
8154
  width_: 6.46
8155
8155
  }),
8156
- rr_options_: {
8157
- template: (display, info)=>{
8158
- const is_placeholder = info.rendering_options.type === "placeholder";
8159
- return product_card_template(is_placeholder ? null : display, info);
8160
- },
8161
- pre_processors: extra_depict_options?.pre_processors,
8162
- post_processors: extra_depict_options?.post_processors
8163
- },
8164
- get_product_id_: get_product_id
8156
+ product_card_template_: product_card_template
8165
8157
  });
8166
8158
  }, "Entire SearchPage failed");
8167
8159
  }