@depict-ai/ui 2.0.8 → 2.0.9
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/ES10/index.cjs +186 -151
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +188 -153
- package/latest/index.cjs +182 -151
- package/latest/index.d.ts +1 -1
- package/latest/index.js +184 -153
- package/package.json +1 -1
- package/server/ES10/index.cjs +163 -132
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +165 -134
- package/server/latest/index.cjs +159 -132
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +161 -134
package/server/ES10/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { add_to_version_info as $b8hua$add_to_version_info, catchify as $b8hua$catchify, slider_fractional_factory as $b8hua$slider_fractional_factory, make_random_classname as $b8hua$make_random_classname, n_col_styling_with_dist as $b8hua$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $b8hua$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $b8hua$layout_get_total_rec_amount_for_row, layout_media_query_header as $b8hua$layout_media_query_header, report as $b8hua$report, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, slider_fading_factory as $b8hua$slider_fading_factory, observer as $b8hua$observer, is_safari as $b8hua$is_safari, useExpandingContainer as $b8hua$useExpandingContainer, standard_price_format as $b8hua$standard_price_format, dlog as $b8hua$dlog, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, javascript_media_query as $b8hua$javascript_media_query, fetch_recs as $b8hua$fetch_recs, snakeCasifyObject as $b8hua$snakeCasifyObject, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, base_url as $b8hua$base_url, get_depict_id as $b8hua$get_depict_id, get_user_id as $b8hua$get_user_id, get_session_id as $b8hua$get_session_id, make_url_with_query_params as $b8hua$make_url_with_query_params, fetch_retry as $b8hua$fetch_retry, add_version_query_params as $b8hua$add_version_query_params, dwarn as $b8hua$dwarn, sort_obj as $b8hua$sort_obj, edit_current_page_meta_tags as $b8hua$edit_current_page_meta_tags, use_href_accessor as $b8hua$use_href_accessor, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, queueMacroTask as $b8hua$queueMacroTask, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, ContainedImage as $b8hua$ContainedImage, deparallelize_no_drop as $b8hua$deparallelize_no_drop, ListenableSet as $b8hua$ListenableSet, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
|
|
2
|
-
import { createSignal as $b8hua$createSignal, onCleanup as $b8hua$onCleanup, createMemo as $b8hua$createMemo, createResource as $b8hua$createResource, Suspense as $b8hua$Suspense, Show as $b8hua$Show, createRenderEffect as $b8hua$createRenderEffect, createRoot as $b8hua$createRoot, For as $b8hua$For, getOwner as $b8hua$getOwner, runWithOwner as $b8hua$runWithOwner, createEffect as $b8hua$createEffect,
|
|
1
|
+
import { add_to_version_info as $b8hua$add_to_version_info, catchify as $b8hua$catchify, slider_fractional_factory as $b8hua$slider_fractional_factory, camelCasifyObject as $b8hua$camelCasifyObject, make_random_classname as $b8hua$make_random_classname, n_col_styling_with_dist as $b8hua$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $b8hua$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $b8hua$layout_get_total_rec_amount_for_row, layout_media_query_header as $b8hua$layout_media_query_header, report as $b8hua$report, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, slider_fading_factory as $b8hua$slider_fading_factory, observer as $b8hua$observer, is_safari as $b8hua$is_safari, useExpandingContainer as $b8hua$useExpandingContainer, standard_price_format as $b8hua$standard_price_format, dlog as $b8hua$dlog, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, javascript_media_query as $b8hua$javascript_media_query, fetch_recs as $b8hua$fetch_recs, snakeCasifyObject as $b8hua$snakeCasifyObject, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, base_url as $b8hua$base_url, get_depict_id as $b8hua$get_depict_id, get_user_id as $b8hua$get_user_id, get_session_id as $b8hua$get_session_id, make_url_with_query_params as $b8hua$make_url_with_query_params, fetch_retry as $b8hua$fetch_retry, add_version_query_params as $b8hua$add_version_query_params, dwarn as $b8hua$dwarn, sort_obj as $b8hua$sort_obj, edit_current_page_meta_tags as $b8hua$edit_current_page_meta_tags, use_href_accessor as $b8hua$use_href_accessor, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, queueMacroTask as $b8hua$queueMacroTask, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, ContainedImage as $b8hua$ContainedImage, deparallelize_no_drop as $b8hua$deparallelize_no_drop, ListenableSet as $b8hua$ListenableSet, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
|
|
2
|
+
import { createSignal as $b8hua$createSignal, onCleanup as $b8hua$onCleanup, createMemo as $b8hua$createMemo, createResource as $b8hua$createResource, Suspense as $b8hua$Suspense, Show as $b8hua$Show, createRenderEffect as $b8hua$createRenderEffect, createRoot as $b8hua$createRoot, For as $b8hua$For, getOwner as $b8hua$getOwner, runWithOwner as $b8hua$runWithOwner, createEffect as $b8hua$createEffect, createUniqueId as $b8hua$createUniqueId, untrack as $b8hua$untrack, createComputed as $b8hua$createComputed, ErrorBoundary as $b8hua$ErrorBoundary, Index as $b8hua$Index, on as $b8hua$on, batch as $b8hua$batch, createReaction as $b8hua$createReaction } from "solid-js";
|
|
3
3
|
import { ssr as $b8hua$ssr, ssrHydrationKey as $b8hua$ssrHydrationKey, escape as $b8hua$escape, createComponent as $b8hua$createComponent, mergeProps as $b8hua$mergeProps, isServer as $b8hua$isServer, ssrElement as $b8hua$ssrElement, ssrClassList as $b8hua$ssrClassList, insert as $b8hua$insert, ssrAttribute as $b8hua$ssrAttribute, ssrStyle as $b8hua$ssrStyle, Dynamic as $b8hua$Dynamic } from "solid-js/web";
|
|
4
4
|
import $b8hua$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
|
|
5
5
|
import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
|
|
@@ -8,7 +8,7 @@ import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
|
|
|
8
8
|
/*! Depict.ai search and product listing SDK */
|
|
9
9
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
10
10
|
register_es_version("ui", "ES10");
|
|
11
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.
|
|
11
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.0.9";
|
|
12
12
|
|
|
13
13
|
/** @jsxImportSource solid-js */
|
|
14
14
|
|
|
@@ -196,6 +196,7 @@ function $2d7bad8684bc7f44$export$7f8bd308237ab5a5(get_displays_) {
|
|
|
196
196
|
});
|
|
197
197
|
return displays_by_key_;
|
|
198
198
|
}
|
|
199
|
+
const $2d7bad8684bc7f44$var$result_ids = ["search_result_id", "product_listing_result_id", "recommendation_id"];
|
|
199
200
|
function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
200
201
|
let {
|
|
201
202
|
displays_by_key_: displays_by_key_,
|
|
@@ -210,17 +211,25 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
210
211
|
},
|
|
211
212
|
children: (product_id, index) => {
|
|
212
213
|
const owner = $b8hua$getOwner();
|
|
213
|
-
const display_accessor = $b8hua$createMemo(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
const display_accessor = $b8hua$createMemo(prev => {
|
|
215
|
+
const new_display = displays_by_key_().get(product_id);
|
|
216
|
+
if (prev && $2d7bad8684bc7f44$var$deep_equal(prev, new_display))
|
|
217
|
+
// If displays are identical, they haven't changed due to merchant/market changing OR we made a new query and the displays are the same. Return the old display (same object reference) to avoid re-rendering.
|
|
218
|
+
// This doesn't work if people mutate the displays from within the template but we hope they don't
|
|
219
|
+
// (We can't know if the display changing is due to merchant/market changing or a new query otherwise and don't want to run into https://gitlab.com/depict-ai/depict.ai/-/merge_requests/6890/diffs)
|
|
220
|
+
return prev;
|
|
221
|
+
return new_display;
|
|
222
|
+
});
|
|
223
|
+
const [product_card_resource] = $b8hua$createResource(() => [merchant_(), market_(), display_accessor()],
|
|
224
|
+
// re-render when the reference to the display object changes or the merchant or market changes
|
|
225
|
+
// (We don't want to re-render if nothing has changed)
|
|
226
|
+
_ref2 => {
|
|
227
|
+
let [merchant, market, display] = _ref2;
|
|
218
228
|
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
219
229
|
return product_card_template_(display, {
|
|
220
230
|
set_on_index_change: fn => $b8hua$runWithOwner(owner, () => $b8hua$createEffect(() => fn(index()))),
|
|
221
|
-
merchant:
|
|
222
|
-
|
|
223
|
-
market: $b8hua$untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
|
|
231
|
+
merchant: merchant,
|
|
232
|
+
market: market // recommendation_grid can provide a sneaky undefined here just FYI
|
|
224
233
|
});
|
|
225
234
|
});
|
|
226
235
|
|
|
@@ -235,15 +244,13 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
235
244
|
elements.push(element);
|
|
236
245
|
// Add tracking ids
|
|
237
246
|
if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
} = display;
|
|
246
|
-
if (search_result_id) dataset.searchResultId = search_result_id;else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;else if (recommendation_id) dataset.recommendationId = recommendation_id;
|
|
247
|
+
for (let i = 0; i < $2d7bad8684bc7f44$var$result_ids.length; i++) {
|
|
248
|
+
const id = $2d7bad8684bc7f44$var$result_ids[i];
|
|
249
|
+
const value = display[id];
|
|
250
|
+
if (value) Object.assign(element.dataset, $b8hua$camelCasifyObject({
|
|
251
|
+
[id]: value
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
247
254
|
}
|
|
248
255
|
do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
|
|
249
256
|
});
|
|
@@ -251,6 +258,23 @@ function $2d7bad8684bc7f44$export$43f0fb951fcb0c54(_ref) {
|
|
|
251
258
|
}
|
|
252
259
|
});
|
|
253
260
|
}
|
|
261
|
+
// Source: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/
|
|
262
|
+
function $2d7bad8684bc7f44$var$deep_equal(object1, object2) {
|
|
263
|
+
const keys1 = Object.keys(object1);
|
|
264
|
+
const keys2 = Object.keys(object2);
|
|
265
|
+
if (keys1.length !== keys2.length) return false;
|
|
266
|
+
for (const key of keys1) {
|
|
267
|
+
if ($2d7bad8684bc7f44$var$result_ids.includes(key)) continue; // ignore result ids that change per response
|
|
268
|
+
const val1 = object1[key];
|
|
269
|
+
const val2 = object2[key];
|
|
270
|
+
const areObjects = $2d7bad8684bc7f44$var$is_object(val1) && $2d7bad8684bc7f44$var$is_object(val2);
|
|
271
|
+
if (areObjects && !$2d7bad8684bc7f44$var$deep_equal(val1, val2) || !areObjects && val1 !== val2) return false;
|
|
272
|
+
}
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
function $2d7bad8684bc7f44$var$is_object(object) {
|
|
276
|
+
return object != null && typeof object === "object";
|
|
277
|
+
}
|
|
254
278
|
|
|
255
279
|
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
256
280
|
class $f3b7124b76123e44$export$e1d52e4f0c7557a1 extends Error {}
|
|
@@ -579,44 +603,43 @@ function $e3efeb558d952696$export$7da560f849543dff(_ref) {
|
|
|
579
603
|
return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
|
|
580
604
|
});
|
|
581
605
|
const num_placeholders_ = () => 20;
|
|
582
|
-
|
|
583
|
-
get
|
|
584
|
-
return
|
|
606
|
+
const elements = $b8hua$ssr($e3efeb558d952696$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape($ca55612a53dbbdd2$export$a2cc176055f8f08()), $b8hua$escape($b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $b8hua$mergeProps({
|
|
607
|
+
get rows() {
|
|
608
|
+
return rows_object_();
|
|
585
609
|
},
|
|
610
|
+
layout: "grid",
|
|
611
|
+
element_attributes: {
|
|
612
|
+
class: "cards"
|
|
613
|
+
}
|
|
614
|
+
}, layout_options_, {
|
|
586
615
|
get children() {
|
|
587
|
-
return $b8hua$
|
|
588
|
-
get
|
|
589
|
-
return
|
|
616
|
+
return $b8hua$createComponent((0, $b8hua$Suspense), {
|
|
617
|
+
get fallback() {
|
|
618
|
+
return $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
619
|
+
num_placeholders_: num_placeholders_,
|
|
620
|
+
product_card_template_: product_card_template_
|
|
621
|
+
});
|
|
590
622
|
},
|
|
591
|
-
layout: "grid",
|
|
592
|
-
element_attributes: {
|
|
593
|
-
class: "cards"
|
|
594
|
-
}
|
|
595
|
-
}, layout_options_, {
|
|
596
623
|
get children() {
|
|
597
|
-
return
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($b8hua$createMemo(() => recommendations_resource_() || []));
|
|
608
|
-
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
609
|
-
displays_by_key_: displays_by_key_,
|
|
610
|
-
merchant_: merchant_,
|
|
611
|
-
market_: market_,
|
|
612
|
-
product_card_template_: product_card_template_
|
|
613
|
-
});
|
|
614
|
-
})();
|
|
615
|
-
}
|
|
616
|
-
});
|
|
624
|
+
return (() => {
|
|
625
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
626
|
+
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($b8hua$createMemo(() => recommendations_resource_() || []));
|
|
627
|
+
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
628
|
+
displays_by_key_: displays_by_key_,
|
|
629
|
+
merchant_: merchant_,
|
|
630
|
+
market_: market_,
|
|
631
|
+
product_card_template_: product_card_template_
|
|
632
|
+
});
|
|
633
|
+
})();
|
|
617
634
|
}
|
|
618
|
-
})
|
|
635
|
+
});
|
|
619
636
|
}
|
|
637
|
+
}))));
|
|
638
|
+
return $b8hua$createComponent((0, $b8hua$Show), {
|
|
639
|
+
get when() {
|
|
640
|
+
return is_showing_something();
|
|
641
|
+
},
|
|
642
|
+
children: elements
|
|
620
643
|
});
|
|
621
644
|
}
|
|
622
645
|
const $b432b11321ad4c97$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
|
|
@@ -3660,7 +3683,10 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
3660
3683
|
const [get_extra_displays, set_extra_displays_] = $b8hua$createSignal([], {
|
|
3661
3684
|
equals: false
|
|
3662
3685
|
});
|
|
3663
|
-
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($b8hua$createMemo(() =>
|
|
3686
|
+
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($b8hua$createMemo(() => {
|
|
3687
|
+
var _plp_results_;
|
|
3688
|
+
return [...(((_plp_results_ = plp_results_()) === null || _plp_results_ === void 0 ? void 0 : _plp_results_.displays) || []), ...get_extra_displays()];
|
|
3689
|
+
}));
|
|
3664
3690
|
const percentage_in_view_ = $e6dd9dfff4603d8c$export$63dd0350f8559dda({
|
|
3665
3691
|
get_last_result_in_viewport_: get_last_result_in_viewport_,
|
|
3666
3692
|
displays_by_key_: displays_by_key_,
|
|
@@ -3780,18 +3806,18 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
3780
3806
|
layout_options_: layout_options_,
|
|
3781
3807
|
sort_or_filter_open_: sort_or_filter_open_
|
|
3782
3808
|
});
|
|
3783
|
-
$b8hua$createComputed(() => {
|
|
3784
|
-
if (!is_loading_()) return;
|
|
3785
|
-
set_should_have_placeholders_rendered(true);
|
|
3786
|
-
set_suspense_is_blocked(false);
|
|
3787
|
-
is_just_after_plp_results_update = true;
|
|
3788
|
-
});
|
|
3789
3809
|
const block_suspense_if_needed = () => {
|
|
3790
3810
|
if (!is_just_after_plp_results_update) return;
|
|
3791
3811
|
is_just_after_plp_results_update = false;
|
|
3792
3812
|
fallback_is_alive = false;
|
|
3793
3813
|
set_suspense_is_blocked(true);
|
|
3794
3814
|
};
|
|
3815
|
+
$b8hua$createComputed(() => {
|
|
3816
|
+
if (!is_loading_()) return;
|
|
3817
|
+
set_should_have_placeholders_rendered(true);
|
|
3818
|
+
set_suspense_is_blocked(false);
|
|
3819
|
+
is_just_after_plp_results_update = true;
|
|
3820
|
+
});
|
|
3795
3821
|
$b8hua$createEffect($b8hua$on(plp_results_, () => {
|
|
3796
3822
|
if (!fallback_is_alive) {
|
|
3797
3823
|
// 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't block the suspense. Therefore, we're just doing it with this effect
|
|
@@ -3801,6 +3827,48 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
3801
3827
|
}, {
|
|
3802
3828
|
defer: true
|
|
3803
3829
|
}));
|
|
3830
|
+
/*
|
|
3831
|
+
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)
|
|
3832
|
+
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
3833
|
+
(For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
|
|
3834
|
+
We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
|
|
3835
|
+
*/
|
|
3836
|
+
const product_cards_when_data = $b8hua$createComponent((0, $b8hua$Suspense), {
|
|
3837
|
+
get fallback() {
|
|
3838
|
+
return (() => {
|
|
3839
|
+
fallback_is_alive = true;
|
|
3840
|
+
$b8hua$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
3841
|
+
return $b8hua$createMemo(() => {
|
|
3842
|
+
// 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
|
|
3843
|
+
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
3844
|
+
if (get_suspense_is_blocked()) return suspense_contents;
|
|
3845
|
+
set_should_have_placeholders_rendered(true); // just in case
|
|
3846
|
+
$b8hua$onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
3847
|
+
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>
|
|
3848
|
+
});
|
|
3849
|
+
})();
|
|
3850
|
+
},
|
|
3851
|
+
|
|
3852
|
+
get children() {
|
|
3853
|
+
return (() => {
|
|
3854
|
+
suspense_contents = $45a8953d760b5e58$export$a1fd619a4743ca08({
|
|
3855
|
+
product_card_template_: product_card_template_,
|
|
3856
|
+
plp_results_: plp_results_,
|
|
3857
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
3858
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
3859
|
+
market_: market_,
|
|
3860
|
+
merchant_: merchant_,
|
|
3861
|
+
all_products_loaded_: all_products_loaded_,
|
|
3862
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
3863
|
+
query_base_: query_base_,
|
|
3864
|
+
depict_api_: depict_api_,
|
|
3865
|
+
is_loading_: is_loading_
|
|
3866
|
+
});
|
|
3867
|
+
$b8hua$onCleanup(() => suspense_contents = undefined);
|
|
3868
|
+
return suspense_contents;
|
|
3869
|
+
})();
|
|
3870
|
+
}
|
|
3871
|
+
});
|
|
3804
3872
|
return [$ca55612a53dbbdd2$export$a2cc176055f8f08(), $b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
|
|
3805
3873
|
get cols_at_size() {
|
|
3806
3874
|
return modified_cols_at_size();
|
|
@@ -3824,44 +3892,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
3824
3892
|
get fallback() {
|
|
3825
3893
|
return rendered_placeholders();
|
|
3826
3894
|
},
|
|
3827
|
-
|
|
3828
|
-
return $b8hua$createComponent((0, $b8hua$Suspense), {
|
|
3829
|
-
get fallback() {
|
|
3830
|
-
return (() => {
|
|
3831
|
-
fallback_is_alive = true;
|
|
3832
|
-
$b8hua$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
3833
|
-
return $b8hua$createMemo(() => {
|
|
3834
|
-
// 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
|
|
3835
|
-
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
3836
|
-
if (get_suspense_is_blocked()) return suspense_contents;
|
|
3837
|
-
set_should_have_placeholders_rendered(true); // just in case
|
|
3838
|
-
$b8hua$onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
3839
|
-
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>
|
|
3840
|
-
});
|
|
3841
|
-
})();
|
|
3842
|
-
},
|
|
3843
|
-
|
|
3844
|
-
get children() {
|
|
3845
|
-
return (() => {
|
|
3846
|
-
suspense_contents = $45a8953d760b5e58$export$a1fd619a4743ca08({
|
|
3847
|
-
product_card_template_: product_card_template_,
|
|
3848
|
-
plp_results_: plp_results_,
|
|
3849
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
3850
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
3851
|
-
market_: market_,
|
|
3852
|
-
merchant_: merchant_,
|
|
3853
|
-
all_products_loaded_: all_products_loaded_,
|
|
3854
|
-
min_products_to_fetch_: min_products_to_fetch_,
|
|
3855
|
-
query_base_: query_base_,
|
|
3856
|
-
depict_api_: depict_api_,
|
|
3857
|
-
is_loading_: is_loading_
|
|
3858
|
-
});
|
|
3859
|
-
$b8hua$onCleanup(() => suspense_contents = undefined);
|
|
3860
|
-
return suspense_contents;
|
|
3861
|
-
})();
|
|
3862
|
-
}
|
|
3863
|
-
});
|
|
3864
|
-
}
|
|
3895
|
+
children: product_cards_when_data
|
|
3865
3896
|
});
|
|
3866
3897
|
}
|
|
3867
3898
|
})];
|
|
@@ -6551,7 +6582,8 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
|
|
|
6551
6582
|
product_card_template_: product_card_template_,
|
|
6552
6583
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
6553
6584
|
view_more_button_ = true,
|
|
6554
|
-
layout_options_: layout_options_
|
|
6585
|
+
layout_options_: layout_options_,
|
|
6586
|
+
all_products_loaded_: all_products_loaded_
|
|
6555
6587
|
} = _ref;
|
|
6556
6588
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
6557
6589
|
const rows_object = view_more_button_ ? $8ef6232475d44150$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
@@ -6564,42 +6596,42 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
|
|
|
6564
6596
|
let [per_column] = _ref2;
|
|
6565
6597
|
return per_column;
|
|
6566
6598
|
})));
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6599
|
+
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
6600
|
+
const elements = $b8hua$ssr($8ef6232475d44150$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$escape(i18n_.search_recs_title_()), $b8hua$escape($ca55612a53dbbdd2$export$a2cc176055f8f08()), $b8hua$escape($b8hua$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $b8hua$mergeProps({
|
|
6601
|
+
rows: rows_object,
|
|
6602
|
+
layout: "grid",
|
|
6603
|
+
element_attributes: {
|
|
6604
|
+
class: "cards"
|
|
6605
|
+
}
|
|
6606
|
+
}, layout_options_, {
|
|
6571
6607
|
get children() {
|
|
6572
|
-
return $b8hua$
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
}
|
|
6578
|
-
}, layout_options_, {
|
|
6579
|
-
get children() {
|
|
6580
|
-
return $b8hua$createComponent((0, $b8hua$Suspense), {
|
|
6581
|
-
get fallback() {
|
|
6582
|
-
return $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
6583
|
-
num_placeholders_: num_placeholders_,
|
|
6584
|
-
product_card_template_: product_card_template_
|
|
6585
|
-
});
|
|
6586
|
-
},
|
|
6587
|
-
get children() {
|
|
6588
|
-
return (() => {
|
|
6589
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
6590
|
-
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($b8hua$createMemo(() => recommendations_resource() || []));
|
|
6591
|
-
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
6592
|
-
displays_by_key_: displays_by_key_,
|
|
6593
|
-
merchant_: $b8hua$createMemo(() => search_query_base_().tenant),
|
|
6594
|
-
market_: $b8hua$createMemo(() => search_query_base_().market),
|
|
6595
|
-
product_card_template_: product_card_template_
|
|
6596
|
-
});
|
|
6597
|
-
})();
|
|
6598
|
-
}
|
|
6608
|
+
return $b8hua$createComponent((0, $b8hua$Suspense), {
|
|
6609
|
+
get fallback() {
|
|
6610
|
+
return $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
6611
|
+
num_placeholders_: num_placeholders_,
|
|
6612
|
+
product_card_template_: product_card_template_
|
|
6599
6613
|
});
|
|
6614
|
+
},
|
|
6615
|
+
get children() {
|
|
6616
|
+
return (() => {
|
|
6617
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
6618
|
+
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($b8hua$createMemo(() => recommendations_resource() || []));
|
|
6619
|
+
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
6620
|
+
displays_by_key_: displays_by_key_,
|
|
6621
|
+
merchant_: $b8hua$createMemo(() => search_query_base_().tenant),
|
|
6622
|
+
market_: $b8hua$createMemo(() => search_query_base_().market),
|
|
6623
|
+
product_card_template_: product_card_template_
|
|
6624
|
+
});
|
|
6625
|
+
})();
|
|
6600
6626
|
}
|
|
6601
|
-
})
|
|
6627
|
+
});
|
|
6602
6628
|
}
|
|
6629
|
+
}))));
|
|
6630
|
+
return $b8hua$createComponent((0, $b8hua$Show), {
|
|
6631
|
+
get when() {
|
|
6632
|
+
return is_showing_something() && all_products_loaded_();
|
|
6633
|
+
},
|
|
6634
|
+
children: elements
|
|
6603
6635
|
});
|
|
6604
6636
|
}
|
|
6605
6637
|
function $8ef6232475d44150$var$make_state_saved_rows(_ref3, i18n_) {
|
|
@@ -8721,9 +8753,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
8721
8753
|
});
|
|
8722
8754
|
}
|
|
8723
8755
|
})), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
|
|
8724
|
-
|
|
8725
|
-
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
8726
|
-
},
|
|
8756
|
+
when: !disable_search_recommendations_,
|
|
8727
8757
|
keyed: false,
|
|
8728
8758
|
get children() {
|
|
8729
8759
|
return $b8hua$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
@@ -8742,7 +8772,8 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
8742
8772
|
},
|
|
8743
8773
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8744
8774
|
view_more_button_: search_recs_view_more_,
|
|
8745
|
-
product_card_template_: product_card_template_
|
|
8775
|
+
product_card_template_: product_card_template_,
|
|
8776
|
+
all_products_loaded_: get_all_products_loaded
|
|
8746
8777
|
});
|
|
8747
8778
|
}
|
|
8748
8779
|
});
|