@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/latest/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { add_to_version_info as $i7OB2$add_to_version_info, catchify as $i7OB2$catchify, slider_fractional_factory as $i7OB2$slider_fractional_factory, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, report as $i7OB2$report, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, observer as $i7OB2$observer, is_safari as $i7OB2$is_safari, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, dlog as $i7OB2$dlog, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, javascript_media_query as $i7OB2$javascript_media_query, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, dwarn as $i7OB2$dwarn, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, use_href_accessor as $i7OB2$use_href_accessor, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, ListenableSet as $i7OB2$ListenableSet, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
|
-
import { createSignal as $i7OB2$createSignal, onCleanup as $i7OB2$onCleanup, createMemo as $i7OB2$createMemo, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, Show as $i7OB2$Show, createRenderEffect as $i7OB2$createRenderEffect, createRoot as $i7OB2$createRoot, For as $i7OB2$For, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, createEffect as $i7OB2$createEffect,
|
|
1
|
+
import { add_to_version_info as $i7OB2$add_to_version_info, catchify as $i7OB2$catchify, slider_fractional_factory as $i7OB2$slider_fractional_factory, camelCasifyObject as $i7OB2$camelCasifyObject, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, report as $i7OB2$report, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, observer as $i7OB2$observer, is_safari as $i7OB2$is_safari, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, dlog as $i7OB2$dlog, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, javascript_media_query as $i7OB2$javascript_media_query, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, dwarn as $i7OB2$dwarn, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, use_href_accessor as $i7OB2$use_href_accessor, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, ListenableSet as $i7OB2$ListenableSet, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
|
+
import { createSignal as $i7OB2$createSignal, onCleanup as $i7OB2$onCleanup, createMemo as $i7OB2$createMemo, createResource as $i7OB2$createResource, Suspense as $i7OB2$Suspense, Show as $i7OB2$Show, createRenderEffect as $i7OB2$createRenderEffect, createRoot as $i7OB2$createRoot, For as $i7OB2$For, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, createEffect as $i7OB2$createEffect, createUniqueId as $i7OB2$createUniqueId, untrack as $i7OB2$untrack, createComputed as $i7OB2$createComputed, ErrorBoundary as $i7OB2$ErrorBoundary, Index as $i7OB2$Index, on as $i7OB2$on, batch as $i7OB2$batch, createReaction as $i7OB2$createReaction } from "solid-js";
|
|
3
3
|
import { ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, escape as $i7OB2$escape, createComponent as $i7OB2$createComponent, mergeProps as $i7OB2$mergeProps, isServer as $i7OB2$isServer, ssrElement as $i7OB2$ssrElement, ssrClassList as $i7OB2$ssrClassList, insert as $i7OB2$insert, ssrAttribute as $i7OB2$ssrAttribute, ssrStyle as $i7OB2$ssrStyle, Dynamic as $i7OB2$Dynamic } from "solid-js/web";
|
|
4
4
|
|
|
5
5
|
/*! Depict.ai search and product listing SDK */
|
|
6
6
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
7
7
|
register_es_version("ui", "latest");
|
|
8
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.
|
|
8
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "2.0.9";
|
|
9
9
|
|
|
10
10
|
/** @jsxImportSource solid-js */
|
|
11
11
|
|
|
@@ -182,6 +182,7 @@ function $29ec7cddbe1d3484$export$7f8bd308237ab5a5(get_displays_) {
|
|
|
182
182
|
});
|
|
183
183
|
return displays_by_key_;
|
|
184
184
|
}
|
|
185
|
+
const $29ec7cddbe1d3484$var$result_ids = ["search_result_id", "product_listing_result_id", "recommendation_id"];
|
|
185
186
|
function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
186
187
|
displays_by_key_: displays_by_key_,
|
|
187
188
|
merchant_: merchant_,
|
|
@@ -195,17 +196,24 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
195
196
|
},
|
|
196
197
|
children: (product_id, index) => {
|
|
197
198
|
const owner = $i7OB2$getOwner();
|
|
198
|
-
const display_accessor = $i7OB2$createMemo(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
const display_accessor = $i7OB2$createMemo(prev => {
|
|
200
|
+
const new_display = displays_by_key_().get(product_id);
|
|
201
|
+
if (prev && $29ec7cddbe1d3484$var$deep_equal(prev, new_display))
|
|
202
|
+
// 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.
|
|
203
|
+
// This doesn't work if people mutate the displays from within the template but we hope they don't
|
|
204
|
+
// (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)
|
|
205
|
+
return prev;
|
|
206
|
+
return new_display;
|
|
207
|
+
});
|
|
208
|
+
const [product_card_resource] = $i7OB2$createResource(() => [merchant_(), market_(), display_accessor()],
|
|
209
|
+
// re-render when the reference to the display object changes or the merchant or market changes
|
|
210
|
+
// (We don't want to re-render if nothing has changed)
|
|
211
|
+
([merchant, market, display]) => {
|
|
203
212
|
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
204
213
|
return product_card_template_(display, {
|
|
205
214
|
set_on_index_change: fn => $i7OB2$runWithOwner(owner, () => $i7OB2$createEffect(() => fn(index()))),
|
|
206
|
-
merchant:
|
|
207
|
-
|
|
208
|
-
market: $i7OB2$untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
|
|
215
|
+
merchant: merchant,
|
|
216
|
+
market: market // recommendation_grid can provide a sneaky undefined here just FYI
|
|
209
217
|
});
|
|
210
218
|
});
|
|
211
219
|
|
|
@@ -220,15 +228,13 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
220
228
|
elements.push(element);
|
|
221
229
|
// Add tracking ids
|
|
222
230
|
if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
} = display;
|
|
231
|
-
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;
|
|
231
|
+
for (let i = 0; i < $29ec7cddbe1d3484$var$result_ids.length; i++) {
|
|
232
|
+
const id = $29ec7cddbe1d3484$var$result_ids[i];
|
|
233
|
+
const value = display[id];
|
|
234
|
+
if (value) Object.assign(element.dataset, $i7OB2$camelCasifyObject({
|
|
235
|
+
[id]: value
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
232
238
|
}
|
|
233
239
|
do_per_elements_?.(elements, index);
|
|
234
240
|
});
|
|
@@ -236,6 +242,23 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
|
236
242
|
}
|
|
237
243
|
});
|
|
238
244
|
}
|
|
245
|
+
// Source: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/
|
|
246
|
+
function $29ec7cddbe1d3484$var$deep_equal(object1, object2) {
|
|
247
|
+
const keys1 = Object.keys(object1);
|
|
248
|
+
const keys2 = Object.keys(object2);
|
|
249
|
+
if (keys1.length !== keys2.length) return false;
|
|
250
|
+
for (const key of keys1) {
|
|
251
|
+
if ($29ec7cddbe1d3484$var$result_ids.includes(key)) continue; // ignore result ids that change per response
|
|
252
|
+
const val1 = object1[key];
|
|
253
|
+
const val2 = object2[key];
|
|
254
|
+
const areObjects = $29ec7cddbe1d3484$var$is_object(val1) && $29ec7cddbe1d3484$var$is_object(val2);
|
|
255
|
+
if (areObjects && !$29ec7cddbe1d3484$var$deep_equal(val1, val2) || !areObjects && val1 !== val2) return false;
|
|
256
|
+
}
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
function $29ec7cddbe1d3484$var$is_object(object) {
|
|
260
|
+
return object != null && typeof object === "object";
|
|
261
|
+
}
|
|
239
262
|
|
|
240
263
|
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
241
264
|
class $4fd48cb976bf1789$export$e1d52e4f0c7557a1 extends Error {}
|
|
@@ -544,44 +567,43 @@ function $3da8afe3ed57cf34$export$7da560f849543dff({
|
|
|
544
567
|
}) {
|
|
545
568
|
const is_showing_something = $i7OB2$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
546
569
|
const num_placeholders_ = () => 20;
|
|
547
|
-
|
|
548
|
-
get
|
|
549
|
-
return
|
|
570
|
+
const elements = $i7OB2$ssr($3da8afe3ed57cf34$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape($a458486f22b22f63$export$a2cc176055f8f08()), $i7OB2$escape($i7OB2$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $i7OB2$mergeProps({
|
|
571
|
+
get rows() {
|
|
572
|
+
return rows_object_();
|
|
550
573
|
},
|
|
574
|
+
layout: "grid",
|
|
575
|
+
element_attributes: {
|
|
576
|
+
class: "cards"
|
|
577
|
+
}
|
|
578
|
+
}, layout_options_, {
|
|
551
579
|
get children() {
|
|
552
|
-
return $i7OB2$
|
|
553
|
-
get
|
|
554
|
-
return
|
|
580
|
+
return $i7OB2$createComponent((0, $i7OB2$Suspense), {
|
|
581
|
+
get fallback() {
|
|
582
|
+
return $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
583
|
+
num_placeholders_: num_placeholders_,
|
|
584
|
+
product_card_template_: product_card_template_
|
|
585
|
+
});
|
|
555
586
|
},
|
|
556
|
-
layout: "grid",
|
|
557
|
-
element_attributes: {
|
|
558
|
-
class: "cards"
|
|
559
|
-
}
|
|
560
|
-
}, layout_options_, {
|
|
561
587
|
get children() {
|
|
562
|
-
return
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($i7OB2$createMemo(() => recommendations_resource_() || []));
|
|
573
|
-
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
574
|
-
displays_by_key_: displays_by_key_,
|
|
575
|
-
merchant_: merchant_,
|
|
576
|
-
market_: market_,
|
|
577
|
-
product_card_template_: product_card_template_
|
|
578
|
-
});
|
|
579
|
-
})();
|
|
580
|
-
}
|
|
581
|
-
});
|
|
588
|
+
return (() => {
|
|
589
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
590
|
+
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($i7OB2$createMemo(() => recommendations_resource_() || []));
|
|
591
|
+
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
592
|
+
displays_by_key_: displays_by_key_,
|
|
593
|
+
merchant_: merchant_,
|
|
594
|
+
market_: market_,
|
|
595
|
+
product_card_template_: product_card_template_
|
|
596
|
+
});
|
|
597
|
+
})();
|
|
582
598
|
}
|
|
583
|
-
})
|
|
599
|
+
});
|
|
584
600
|
}
|
|
601
|
+
}))));
|
|
602
|
+
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
603
|
+
get when() {
|
|
604
|
+
return is_showing_something();
|
|
605
|
+
},
|
|
606
|
+
children: elements
|
|
585
607
|
});
|
|
586
608
|
}
|
|
587
609
|
const $9ea5383493360761$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
|
|
@@ -3380,7 +3402,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
3380
3402
|
const [get_extra_displays, set_extra_displays_] = $i7OB2$createSignal([], {
|
|
3381
3403
|
equals: false
|
|
3382
3404
|
});
|
|
3383
|
-
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($i7OB2$createMemo(() => [...plp_results_()
|
|
3405
|
+
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($i7OB2$createMemo(() => [...(plp_results_()?.displays || []), ...get_extra_displays()]));
|
|
3384
3406
|
const percentage_in_view_ = $0e0b96a8dc1ad492$export$63dd0350f8559dda({
|
|
3385
3407
|
get_last_result_in_viewport_: get_last_result_in_viewport_,
|
|
3386
3408
|
displays_by_key_: displays_by_key_,
|
|
@@ -3493,18 +3515,18 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
3493
3515
|
layout_options_: layout_options_,
|
|
3494
3516
|
sort_or_filter_open_: sort_or_filter_open_
|
|
3495
3517
|
});
|
|
3496
|
-
$i7OB2$createComputed(() => {
|
|
3497
|
-
if (!is_loading_()) return;
|
|
3498
|
-
set_should_have_placeholders_rendered(true);
|
|
3499
|
-
set_suspense_is_blocked(false);
|
|
3500
|
-
is_just_after_plp_results_update = true;
|
|
3501
|
-
});
|
|
3502
3518
|
const block_suspense_if_needed = () => {
|
|
3503
3519
|
if (!is_just_after_plp_results_update) return;
|
|
3504
3520
|
is_just_after_plp_results_update = false;
|
|
3505
3521
|
fallback_is_alive = false;
|
|
3506
3522
|
set_suspense_is_blocked(true);
|
|
3507
3523
|
};
|
|
3524
|
+
$i7OB2$createComputed(() => {
|
|
3525
|
+
if (!is_loading_()) return;
|
|
3526
|
+
set_should_have_placeholders_rendered(true);
|
|
3527
|
+
set_suspense_is_blocked(false);
|
|
3528
|
+
is_just_after_plp_results_update = true;
|
|
3529
|
+
});
|
|
3508
3530
|
$i7OB2$createEffect($i7OB2$on(plp_results_, () => {
|
|
3509
3531
|
if (!fallback_is_alive) {
|
|
3510
3532
|
// 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
|
|
@@ -3514,6 +3536,48 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
3514
3536
|
}, {
|
|
3515
3537
|
defer: true
|
|
3516
3538
|
}));
|
|
3539
|
+
/*
|
|
3540
|
+
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)
|
|
3541
|
+
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
3542
|
+
(For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
|
|
3543
|
+
We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
|
|
3544
|
+
*/
|
|
3545
|
+
const product_cards_when_data = $i7OB2$createComponent((0, $i7OB2$Suspense), {
|
|
3546
|
+
get fallback() {
|
|
3547
|
+
return (() => {
|
|
3548
|
+
fallback_is_alive = true;
|
|
3549
|
+
$i7OB2$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
3550
|
+
return $i7OB2$createMemo(() => {
|
|
3551
|
+
// 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
|
|
3552
|
+
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
3553
|
+
if (get_suspense_is_blocked()) return suspense_contents;
|
|
3554
|
+
set_should_have_placeholders_rendered(true); // just in case
|
|
3555
|
+
$i7OB2$onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
3556
|
+
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>
|
|
3557
|
+
});
|
|
3558
|
+
})();
|
|
3559
|
+
},
|
|
3560
|
+
|
|
3561
|
+
get children() {
|
|
3562
|
+
return (() => {
|
|
3563
|
+
suspense_contents = $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
3564
|
+
product_card_template_: product_card_template_,
|
|
3565
|
+
plp_results_: plp_results_,
|
|
3566
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
3567
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
3568
|
+
market_: market_,
|
|
3569
|
+
merchant_: merchant_,
|
|
3570
|
+
all_products_loaded_: all_products_loaded_,
|
|
3571
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
3572
|
+
query_base_: query_base_,
|
|
3573
|
+
depict_api_: depict_api_,
|
|
3574
|
+
is_loading_: is_loading_
|
|
3575
|
+
});
|
|
3576
|
+
$i7OB2$onCleanup(() => suspense_contents = undefined);
|
|
3577
|
+
return suspense_contents;
|
|
3578
|
+
})();
|
|
3579
|
+
}
|
|
3580
|
+
});
|
|
3517
3581
|
return [$a458486f22b22f63$export$a2cc176055f8f08(), $i7OB2$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), {
|
|
3518
3582
|
get cols_at_size() {
|
|
3519
3583
|
return modified_cols_at_size();
|
|
@@ -3537,44 +3601,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
3537
3601
|
get fallback() {
|
|
3538
3602
|
return rendered_placeholders();
|
|
3539
3603
|
},
|
|
3540
|
-
|
|
3541
|
-
return $i7OB2$createComponent((0, $i7OB2$Suspense), {
|
|
3542
|
-
get fallback() {
|
|
3543
|
-
return (() => {
|
|
3544
|
-
fallback_is_alive = true;
|
|
3545
|
-
$i7OB2$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
3546
|
-
return $i7OB2$createMemo(() => {
|
|
3547
|
-
// 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
|
|
3548
|
-
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
3549
|
-
if (get_suspense_is_blocked()) return suspense_contents;
|
|
3550
|
-
set_should_have_placeholders_rendered(true); // just in case
|
|
3551
|
-
$i7OB2$onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
3552
|
-
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>
|
|
3553
|
-
});
|
|
3554
|
-
})();
|
|
3555
|
-
},
|
|
3556
|
-
|
|
3557
|
-
get children() {
|
|
3558
|
-
return (() => {
|
|
3559
|
-
suspense_contents = $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
3560
|
-
product_card_template_: product_card_template_,
|
|
3561
|
-
plp_results_: plp_results_,
|
|
3562
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
3563
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
3564
|
-
market_: market_,
|
|
3565
|
-
merchant_: merchant_,
|
|
3566
|
-
all_products_loaded_: all_products_loaded_,
|
|
3567
|
-
min_products_to_fetch_: min_products_to_fetch_,
|
|
3568
|
-
query_base_: query_base_,
|
|
3569
|
-
depict_api_: depict_api_,
|
|
3570
|
-
is_loading_: is_loading_
|
|
3571
|
-
});
|
|
3572
|
-
$i7OB2$onCleanup(() => suspense_contents = undefined);
|
|
3573
|
-
return suspense_contents;
|
|
3574
|
-
})();
|
|
3575
|
-
}
|
|
3576
|
-
});
|
|
3577
|
-
}
|
|
3604
|
+
children: product_cards_when_data
|
|
3578
3605
|
});
|
|
3579
3606
|
}
|
|
3580
3607
|
})];
|
|
@@ -6021,49 +6048,50 @@ function $172e1b898d457050$export$7de92c4c2205ebf3({
|
|
|
6021
6048
|
product_card_template_: product_card_template_,
|
|
6022
6049
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
6023
6050
|
view_more_button_ = true,
|
|
6024
|
-
layout_options_: layout_options_
|
|
6051
|
+
layout_options_: layout_options_,
|
|
6052
|
+
all_products_loaded_: all_products_loaded_
|
|
6025
6053
|
}) {
|
|
6026
6054
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
6027
6055
|
const rows_object = view_more_button_ ? $172e1b898d457050$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
6028
6056
|
const [recommendations_resource] = $i7OB2$createResource(search_query_base_, query => depict_api_.get_recommended(query).then(r => r.displays));
|
|
6029
6057
|
const is_showing_something = $i7OB2$createMemo(() => recommendations_resource.loading || recommendations_resource()?.length);
|
|
6030
6058
|
const num_placeholders_ = $i7OB2$createMemo(() => (0, $7747fe1a8c5652e3$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(([per_column]) => per_column)));
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6059
|
+
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
6060
|
+
const elements = $i7OB2$ssr($172e1b898d457050$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$escape(i18n_.search_recs_title_()), $i7OB2$escape($a458486f22b22f63$export$a2cc176055f8f08()), $i7OB2$escape($i7OB2$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $i7OB2$mergeProps({
|
|
6061
|
+
rows: rows_object,
|
|
6062
|
+
layout: "grid",
|
|
6063
|
+
element_attributes: {
|
|
6064
|
+
class: "cards"
|
|
6065
|
+
}
|
|
6066
|
+
}, layout_options_, {
|
|
6035
6067
|
get children() {
|
|
6036
|
-
return $i7OB2$
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
}
|
|
6042
|
-
}, layout_options_, {
|
|
6043
|
-
get children() {
|
|
6044
|
-
return $i7OB2$createComponent((0, $i7OB2$Suspense), {
|
|
6045
|
-
get fallback() {
|
|
6046
|
-
return $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
6047
|
-
num_placeholders_: num_placeholders_,
|
|
6048
|
-
product_card_template_: product_card_template_
|
|
6049
|
-
});
|
|
6050
|
-
},
|
|
6051
|
-
get children() {
|
|
6052
|
-
return (() => {
|
|
6053
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
6054
|
-
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($i7OB2$createMemo(() => recommendations_resource() || []));
|
|
6055
|
-
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
6056
|
-
displays_by_key_: displays_by_key_,
|
|
6057
|
-
merchant_: $i7OB2$createMemo(() => search_query_base_().tenant),
|
|
6058
|
-
market_: $i7OB2$createMemo(() => search_query_base_().market),
|
|
6059
|
-
product_card_template_: product_card_template_
|
|
6060
|
-
});
|
|
6061
|
-
})();
|
|
6062
|
-
}
|
|
6068
|
+
return $i7OB2$createComponent((0, $i7OB2$Suspense), {
|
|
6069
|
+
get fallback() {
|
|
6070
|
+
return $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
6071
|
+
num_placeholders_: num_placeholders_,
|
|
6072
|
+
product_card_template_: product_card_template_
|
|
6063
6073
|
});
|
|
6074
|
+
},
|
|
6075
|
+
get children() {
|
|
6076
|
+
return (() => {
|
|
6077
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
6078
|
+
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($i7OB2$createMemo(() => recommendations_resource() || []));
|
|
6079
|
+
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
6080
|
+
displays_by_key_: displays_by_key_,
|
|
6081
|
+
merchant_: $i7OB2$createMemo(() => search_query_base_().tenant),
|
|
6082
|
+
market_: $i7OB2$createMemo(() => search_query_base_().market),
|
|
6083
|
+
product_card_template_: product_card_template_
|
|
6084
|
+
});
|
|
6085
|
+
})();
|
|
6064
6086
|
}
|
|
6065
|
-
})
|
|
6087
|
+
});
|
|
6066
6088
|
}
|
|
6089
|
+
}))));
|
|
6090
|
+
return $i7OB2$createComponent((0, $i7OB2$Show), {
|
|
6091
|
+
get when() {
|
|
6092
|
+
return is_showing_something() && all_products_loaded_();
|
|
6093
|
+
},
|
|
6094
|
+
children: elements
|
|
6067
6095
|
});
|
|
6068
6096
|
}
|
|
6069
6097
|
function $172e1b898d457050$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
|
|
@@ -8052,9 +8080,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8052
8080
|
});
|
|
8053
8081
|
}
|
|
8054
8082
|
})), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
8055
|
-
|
|
8056
|
-
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
8057
|
-
},
|
|
8083
|
+
when: !disable_search_recommendations_,
|
|
8058
8084
|
keyed: false,
|
|
8059
8085
|
get children() {
|
|
8060
8086
|
return $i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
@@ -8070,7 +8096,8 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8070
8096
|
},
|
|
8071
8097
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8072
8098
|
view_more_button_: search_recs_view_more_,
|
|
8073
|
-
product_card_template_: product_card_template_
|
|
8099
|
+
product_card_template_: product_card_template_,
|
|
8100
|
+
all_products_loaded_: get_all_products_loaded
|
|
8074
8101
|
});
|
|
8075
8102
|
}
|
|
8076
8103
|
});
|