@depict-ai/ui 2.0.8 → 2.0.10
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 +190 -154
- package/ES10/index.d.ts +5 -2
- package/ES10/index.js +192 -156
- package/latest/index.cjs +186 -154
- package/latest/index.d.ts +5 -2
- package/latest/index.js +188 -156
- package/package.json +2 -2
- package/server/ES10/index.cjs +167 -135
- package/server/ES10/index.d.ts +5 -2
- package/server/ES10/index.js +169 -137
- package/server/latest/index.cjs +163 -135
- package/server/latest/index.d.ts +5 -2
- package/server/latest/index.js +165 -137
package/ES10/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { add_to_version_info as $8tj43$add_to_version_info, catchify as $8tj43$catchify, slider_fractional_factory as $8tj43$slider_fractional_factory, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, observer as $8tj43$observer, is_safari as $8tj43$is_safari, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, dlog as $8tj43$dlog, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, javascript_media_query as $8tj43$javascript_media_query, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, use_href_accessor as $8tj43$use_href_accessor, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, queueMacroTask as $8tj43$queueMacroTask, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ListenableSet as $8tj43$ListenableSet, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
|
|
2
|
-
import { createSignal as $8tj43$createSignal, onCleanup as $8tj43$onCleanup, createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, createRenderEffect as $8tj43$createRenderEffect, createRoot as $8tj43$createRoot, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createEffect as $8tj43$createEffect,
|
|
1
|
+
import { add_to_version_info as $8tj43$add_to_version_info, catchify as $8tj43$catchify, slider_fractional_factory as $8tj43$slider_fractional_factory, camelCasifyObject as $8tj43$camelCasifyObject, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, observer as $8tj43$observer, is_safari as $8tj43$is_safari, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, dlog as $8tj43$dlog, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, javascript_media_query as $8tj43$javascript_media_query, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, dwarn as $8tj43$dwarn, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, use_href_accessor as $8tj43$use_href_accessor, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, queueMacroTask as $8tj43$queueMacroTask, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ListenableSet as $8tj43$ListenableSet, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
|
|
2
|
+
import { createSignal as $8tj43$createSignal, onCleanup as $8tj43$onCleanup, createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, Show as $8tj43$Show, createRenderEffect as $8tj43$createRenderEffect, createRoot as $8tj43$createRoot, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createEffect as $8tj43$createEffect, createUniqueId as $8tj43$createUniqueId, untrack as $8tj43$untrack, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, Index as $8tj43$Index, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction } from "solid-js";
|
|
3
3
|
import { template as $8tj43$template, getNextElement as $8tj43$getNextElement, insert as $8tj43$insert, createComponent as $8tj43$createComponent, mergeProps as $8tj43$mergeProps, isServer as $8tj43$isServer, spread as $8tj43$spread, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, effect as $8tj43$effect, classList as $8tj43$classList, setAttribute as $8tj43$setAttribute, getNextMarker as $8tj43$getNextMarker, style as $8tj43$style, Dynamic as $8tj43$Dynamic, use as $8tj43$use } from "solid-js/web";
|
|
4
4
|
import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
|
|
5
5
|
import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
|
|
@@ -8,7 +8,7 @@ import $8tj43$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.10";
|
|
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 = $8tj43$getOwner();
|
|
213
|
-
const display_accessor = $8tj43$createMemo(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
const display_accessor = $8tj43$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] = $8tj43$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 => $8tj43$runWithOwner(owner, () => $8tj43$createEffect(() => fn(index()))),
|
|
221
|
-
merchant:
|
|
222
|
-
|
|
223
|
-
market: $8tj43$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, $8tj43$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 {}
|
|
@@ -642,51 +666,52 @@ function $e3efeb558d952696$export$7da560f849543dff(_ref) {
|
|
|
642
666
|
return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
|
|
643
667
|
});
|
|
644
668
|
const num_placeholders_ = () => 20;
|
|
669
|
+
const elements = (() => {
|
|
670
|
+
const _el$ = $8tj43$getNextElement($e3efeb558d952696$var$_tmpl$),
|
|
671
|
+
_el$2 = _el$.firstChild,
|
|
672
|
+
[_el$3, _co$] = $8tj43$getNextMarker(_el$2.nextSibling),
|
|
673
|
+
_el$4 = _el$3.nextSibling,
|
|
674
|
+
[_el$5, _co$2] = $8tj43$getNextMarker(_el$4.nextSibling);
|
|
675
|
+
$8tj43$insert(_el$, (0, $ca55612a53dbbdd2$export$a2cc176055f8f08), _el$3, _co$);
|
|
676
|
+
$8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps({
|
|
677
|
+
get rows() {
|
|
678
|
+
return rows_object_();
|
|
679
|
+
},
|
|
680
|
+
layout: "grid",
|
|
681
|
+
element_attributes: {
|
|
682
|
+
class: "cards"
|
|
683
|
+
}
|
|
684
|
+
}, layout_options_, {
|
|
685
|
+
get children() {
|
|
686
|
+
return $8tj43$createComponent((0, $8tj43$Suspense), {
|
|
687
|
+
get fallback() {
|
|
688
|
+
return $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
689
|
+
num_placeholders_: num_placeholders_,
|
|
690
|
+
product_card_template_: product_card_template_
|
|
691
|
+
});
|
|
692
|
+
},
|
|
693
|
+
get children() {
|
|
694
|
+
return (() => {
|
|
695
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
696
|
+
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => recommendations_resource_() || []));
|
|
697
|
+
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
698
|
+
displays_by_key_: displays_by_key_,
|
|
699
|
+
merchant_: merchant_,
|
|
700
|
+
market_: market_,
|
|
701
|
+
product_card_template_: product_card_template_
|
|
702
|
+
});
|
|
703
|
+
})();
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
})), _el$5, _co$2);
|
|
708
|
+
return _el$;
|
|
709
|
+
})();
|
|
645
710
|
return $8tj43$createComponent((0, $8tj43$Show), {
|
|
646
711
|
get when() {
|
|
647
712
|
return is_showing_something();
|
|
648
713
|
},
|
|
649
|
-
|
|
650
|
-
const _el$ = $8tj43$getNextElement($e3efeb558d952696$var$_tmpl$),
|
|
651
|
-
_el$2 = _el$.firstChild,
|
|
652
|
-
[_el$3, _co$] = $8tj43$getNextMarker(_el$2.nextSibling),
|
|
653
|
-
_el$4 = _el$3.nextSibling,
|
|
654
|
-
[_el$5, _co$2] = $8tj43$getNextMarker(_el$4.nextSibling);
|
|
655
|
-
$8tj43$insert(_el$, (0, $ca55612a53dbbdd2$export$a2cc176055f8f08), _el$3, _co$);
|
|
656
|
-
$8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps({
|
|
657
|
-
get rows() {
|
|
658
|
-
return rows_object_();
|
|
659
|
-
},
|
|
660
|
-
layout: "grid",
|
|
661
|
-
element_attributes: {
|
|
662
|
-
class: "cards"
|
|
663
|
-
}
|
|
664
|
-
}, layout_options_, {
|
|
665
|
-
get children() {
|
|
666
|
-
return $8tj43$createComponent((0, $8tj43$Suspense), {
|
|
667
|
-
get fallback() {
|
|
668
|
-
return $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
669
|
-
num_placeholders_: num_placeholders_,
|
|
670
|
-
product_card_template_: product_card_template_
|
|
671
|
-
});
|
|
672
|
-
},
|
|
673
|
-
get children() {
|
|
674
|
-
return (() => {
|
|
675
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
676
|
-
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => recommendations_resource_() || []));
|
|
677
|
-
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
678
|
-
displays_by_key_: displays_by_key_,
|
|
679
|
-
merchant_: merchant_,
|
|
680
|
-
market_: market_,
|
|
681
|
-
product_card_template_: product_card_template_
|
|
682
|
-
});
|
|
683
|
-
})();
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
})), _el$5, _co$2);
|
|
688
|
-
return _el$;
|
|
689
|
-
}
|
|
714
|
+
children: elements
|
|
690
715
|
});
|
|
691
716
|
}
|
|
692
717
|
const $b432b11321ad4c97$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class="show-more major" type="button"></button>`, 2),
|
|
@@ -3643,8 +3668,8 @@ function $44aa24b1bb793549$var$modify_only_local_filter(local_filter_object, sel
|
|
|
3643
3668
|
}
|
|
3644
3669
|
return modified_filter_object;
|
|
3645
3670
|
}
|
|
3646
|
-
async function $d5f1e6a0f9117286$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
3647
|
-
const body = await (0, $8tj43$observer).wait_for_element("body");
|
|
3671
|
+
async function $d5f1e6a0f9117286$export$79b1565500412d9b(search_modal, modal_fn_opts, parent) {
|
|
3672
|
+
const body = parent || (await (0, $8tj43$observer).wait_for_element("body"));
|
|
3648
3673
|
let dispose_and_remove;
|
|
3649
3674
|
const open_modal_ = function () {
|
|
3650
3675
|
let extra_options_for_modal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -4565,7 +4590,10 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4565
4590
|
const [get_extra_displays, set_extra_displays_] = $8tj43$createSignal([], {
|
|
4566
4591
|
equals: false
|
|
4567
4592
|
});
|
|
4568
|
-
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() =>
|
|
4593
|
+
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => {
|
|
4594
|
+
var _plp_results_;
|
|
4595
|
+
return [...(((_plp_results_ = plp_results_()) === null || _plp_results_ === void 0 ? void 0 : _plp_results_.displays) || []), ...get_extra_displays()];
|
|
4596
|
+
}));
|
|
4569
4597
|
const percentage_in_view_ = $e6dd9dfff4603d8c$export$63dd0350f8559dda({
|
|
4570
4598
|
get_last_result_in_viewport_: get_last_result_in_viewport_,
|
|
4571
4599
|
displays_by_key_: displays_by_key_,
|
|
@@ -4691,18 +4719,18 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4691
4719
|
layout_options_: layout_options_,
|
|
4692
4720
|
sort_or_filter_open_: sort_or_filter_open_
|
|
4693
4721
|
});
|
|
4694
|
-
$8tj43$createComputed(() => {
|
|
4695
|
-
if (!is_loading_()) return;
|
|
4696
|
-
set_should_have_placeholders_rendered(true);
|
|
4697
|
-
set_suspense_is_blocked(false);
|
|
4698
|
-
is_just_after_plp_results_update = true;
|
|
4699
|
-
});
|
|
4700
4722
|
const block_suspense_if_needed = () => {
|
|
4701
4723
|
if (!is_just_after_plp_results_update) return;
|
|
4702
4724
|
is_just_after_plp_results_update = false;
|
|
4703
4725
|
fallback_is_alive = false;
|
|
4704
4726
|
set_suspense_is_blocked(true);
|
|
4705
4727
|
};
|
|
4728
|
+
$8tj43$createComputed(() => {
|
|
4729
|
+
if (!is_loading_()) return;
|
|
4730
|
+
set_should_have_placeholders_rendered(true);
|
|
4731
|
+
set_suspense_is_blocked(false);
|
|
4732
|
+
is_just_after_plp_results_update = true;
|
|
4733
|
+
});
|
|
4706
4734
|
$8tj43$createEffect($8tj43$on(plp_results_, () => {
|
|
4707
4735
|
if (!fallback_is_alive) {
|
|
4708
4736
|
// 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
|
|
@@ -4712,6 +4740,48 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4712
4740
|
}, {
|
|
4713
4741
|
defer: true
|
|
4714
4742
|
}));
|
|
4743
|
+
/*
|
|
4744
|
+
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)
|
|
4745
|
+
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
4746
|
+
(For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
|
|
4747
|
+
We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
|
|
4748
|
+
*/
|
|
4749
|
+
const product_cards_when_data = $8tj43$createComponent((0, $8tj43$Suspense), {
|
|
4750
|
+
get fallback() {
|
|
4751
|
+
return (() => {
|
|
4752
|
+
fallback_is_alive = true;
|
|
4753
|
+
$8tj43$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4754
|
+
return $8tj43$createMemo(() => {
|
|
4755
|
+
// 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
|
|
4756
|
+
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
4757
|
+
if (get_suspense_is_blocked()) return suspense_contents;
|
|
4758
|
+
set_should_have_placeholders_rendered(true); // just in case
|
|
4759
|
+
$8tj43$onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
4760
|
+
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>
|
|
4761
|
+
});
|
|
4762
|
+
})();
|
|
4763
|
+
},
|
|
4764
|
+
|
|
4765
|
+
get children() {
|
|
4766
|
+
return (() => {
|
|
4767
|
+
suspense_contents = $45a8953d760b5e58$export$a1fd619a4743ca08({
|
|
4768
|
+
product_card_template_: product_card_template_,
|
|
4769
|
+
plp_results_: plp_results_,
|
|
4770
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
4771
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
4772
|
+
market_: market_,
|
|
4773
|
+
merchant_: merchant_,
|
|
4774
|
+
all_products_loaded_: all_products_loaded_,
|
|
4775
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
4776
|
+
query_base_: query_base_,
|
|
4777
|
+
depict_api_: depict_api_,
|
|
4778
|
+
is_loading_: is_loading_
|
|
4779
|
+
});
|
|
4780
|
+
$8tj43$onCleanup(() => suspense_contents = undefined);
|
|
4781
|
+
return suspense_contents;
|
|
4782
|
+
})();
|
|
4783
|
+
}
|
|
4784
|
+
});
|
|
4715
4785
|
return [$8tj43$memo((0, $ca55612a53dbbdd2$export$a2cc176055f8f08)), $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
|
|
4716
4786
|
get cols_at_size() {
|
|
4717
4787
|
return modified_cols_at_size();
|
|
@@ -4735,44 +4805,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
4735
4805
|
get fallback() {
|
|
4736
4806
|
return rendered_placeholders();
|
|
4737
4807
|
},
|
|
4738
|
-
|
|
4739
|
-
return $8tj43$createComponent((0, $8tj43$Suspense), {
|
|
4740
|
-
get fallback() {
|
|
4741
|
-
return (() => {
|
|
4742
|
-
fallback_is_alive = true;
|
|
4743
|
-
$8tj43$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4744
|
-
return $8tj43$createMemo(() => {
|
|
4745
|
-
// 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
|
|
4746
|
-
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
4747
|
-
if (get_suspense_is_blocked()) return suspense_contents;
|
|
4748
|
-
set_should_have_placeholders_rendered(true); // just in case
|
|
4749
|
-
$8tj43$onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
4750
|
-
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>
|
|
4751
|
-
});
|
|
4752
|
-
})();
|
|
4753
|
-
},
|
|
4754
|
-
|
|
4755
|
-
get children() {
|
|
4756
|
-
return (() => {
|
|
4757
|
-
suspense_contents = $45a8953d760b5e58$export$a1fd619a4743ca08({
|
|
4758
|
-
product_card_template_: product_card_template_,
|
|
4759
|
-
plp_results_: plp_results_,
|
|
4760
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
4761
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
4762
|
-
market_: market_,
|
|
4763
|
-
merchant_: merchant_,
|
|
4764
|
-
all_products_loaded_: all_products_loaded_,
|
|
4765
|
-
min_products_to_fetch_: min_products_to_fetch_,
|
|
4766
|
-
query_base_: query_base_,
|
|
4767
|
-
depict_api_: depict_api_,
|
|
4768
|
-
is_loading_: is_loading_
|
|
4769
|
-
});
|
|
4770
|
-
$8tj43$onCleanup(() => suspense_contents = undefined);
|
|
4771
|
-
return suspense_contents;
|
|
4772
|
-
})();
|
|
4773
|
-
}
|
|
4774
|
-
});
|
|
4775
|
-
}
|
|
4808
|
+
children: product_cards_when_data
|
|
4776
4809
|
});
|
|
4777
4810
|
}
|
|
4778
4811
|
})];
|
|
@@ -8047,7 +8080,8 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
|
|
|
8047
8080
|
product_card_template_: product_card_template_,
|
|
8048
8081
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8049
8082
|
view_more_button_ = true,
|
|
8050
|
-
layout_options_: layout_options_
|
|
8083
|
+
layout_options_: layout_options_,
|
|
8084
|
+
all_products_loaded_: all_products_loaded_
|
|
8051
8085
|
} = _ref;
|
|
8052
8086
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
8053
8087
|
const rows_object = view_more_button_ ? $8ef6232475d44150$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
@@ -8060,51 +8094,53 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
|
|
|
8060
8094
|
let [per_column] = _ref2;
|
|
8061
8095
|
return per_column;
|
|
8062
8096
|
})));
|
|
8097
|
+
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
8098
|
+
const elements = (() => {
|
|
8099
|
+
const _el$ = $8tj43$getNextElement($8ef6232475d44150$var$_tmpl$),
|
|
8100
|
+
_el$2 = _el$.firstChild,
|
|
8101
|
+
_el$3 = _el$2.nextSibling,
|
|
8102
|
+
[_el$4, _co$] = $8tj43$getNextMarker(_el$3.nextSibling),
|
|
8103
|
+
_el$5 = _el$4.nextSibling,
|
|
8104
|
+
[_el$6, _co$2] = $8tj43$getNextMarker(_el$5.nextSibling);
|
|
8105
|
+
$8tj43$insert(_el$2, () => i18n_.search_recs_title_());
|
|
8106
|
+
$8tj43$insert(_el$, (0, $ca55612a53dbbdd2$export$a2cc176055f8f08), _el$4, _co$);
|
|
8107
|
+
$8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps({
|
|
8108
|
+
rows: rows_object,
|
|
8109
|
+
layout: "grid",
|
|
8110
|
+
element_attributes: {
|
|
8111
|
+
class: "cards"
|
|
8112
|
+
}
|
|
8113
|
+
}, layout_options_, {
|
|
8114
|
+
get children() {
|
|
8115
|
+
return $8tj43$createComponent((0, $8tj43$Suspense), {
|
|
8116
|
+
get fallback() {
|
|
8117
|
+
return $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
8118
|
+
num_placeholders_: num_placeholders_,
|
|
8119
|
+
product_card_template_: product_card_template_
|
|
8120
|
+
});
|
|
8121
|
+
},
|
|
8122
|
+
get children() {
|
|
8123
|
+
return (() => {
|
|
8124
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
8125
|
+
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => recommendations_resource() || []));
|
|
8126
|
+
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
8127
|
+
displays_by_key_: displays_by_key_,
|
|
8128
|
+
merchant_: $8tj43$createMemo(() => search_query_base_().tenant),
|
|
8129
|
+
market_: $8tj43$createMemo(() => search_query_base_().market),
|
|
8130
|
+
product_card_template_: product_card_template_
|
|
8131
|
+
});
|
|
8132
|
+
})();
|
|
8133
|
+
}
|
|
8134
|
+
});
|
|
8135
|
+
}
|
|
8136
|
+
})), _el$6, _co$2);
|
|
8137
|
+
return _el$;
|
|
8138
|
+
})();
|
|
8063
8139
|
return $8tj43$createComponent((0, $8tj43$Show), {
|
|
8064
8140
|
get when() {
|
|
8065
|
-
return is_showing_something();
|
|
8141
|
+
return $8tj43$memo(() => !!is_showing_something())() && all_products_loaded_();
|
|
8066
8142
|
},
|
|
8067
|
-
|
|
8068
|
-
const _el$ = $8tj43$getNextElement($8ef6232475d44150$var$_tmpl$),
|
|
8069
|
-
_el$2 = _el$.firstChild,
|
|
8070
|
-
_el$3 = _el$2.nextSibling,
|
|
8071
|
-
[_el$4, _co$] = $8tj43$getNextMarker(_el$3.nextSibling),
|
|
8072
|
-
_el$5 = _el$4.nextSibling,
|
|
8073
|
-
[_el$6, _co$2] = $8tj43$getNextMarker(_el$5.nextSibling);
|
|
8074
|
-
$8tj43$insert(_el$2, () => i18n_.search_recs_title_());
|
|
8075
|
-
$8tj43$insert(_el$, (0, $ca55612a53dbbdd2$export$a2cc176055f8f08), _el$4, _co$);
|
|
8076
|
-
$8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps({
|
|
8077
|
-
rows: rows_object,
|
|
8078
|
-
layout: "grid",
|
|
8079
|
-
element_attributes: {
|
|
8080
|
-
class: "cards"
|
|
8081
|
-
}
|
|
8082
|
-
}, layout_options_, {
|
|
8083
|
-
get children() {
|
|
8084
|
-
return $8tj43$createComponent((0, $8tj43$Suspense), {
|
|
8085
|
-
get fallback() {
|
|
8086
|
-
return $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
8087
|
-
num_placeholders_: num_placeholders_,
|
|
8088
|
-
product_card_template_: product_card_template_
|
|
8089
|
-
});
|
|
8090
|
-
},
|
|
8091
|
-
get children() {
|
|
8092
|
-
return (() => {
|
|
8093
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
8094
|
-
const displays_by_key_ = $2d7bad8684bc7f44$export$7f8bd308237ab5a5($8tj43$createMemo(() => recommendations_resource() || []));
|
|
8095
|
-
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
8096
|
-
displays_by_key_: displays_by_key_,
|
|
8097
|
-
merchant_: $8tj43$createMemo(() => search_query_base_().tenant),
|
|
8098
|
-
market_: $8tj43$createMemo(() => search_query_base_().market),
|
|
8099
|
-
product_card_template_: product_card_template_
|
|
8100
|
-
});
|
|
8101
|
-
})();
|
|
8102
|
-
}
|
|
8103
|
-
});
|
|
8104
|
-
}
|
|
8105
|
-
})), _el$6, _co$2);
|
|
8106
|
-
return _el$;
|
|
8107
|
-
}
|
|
8143
|
+
children: elements
|
|
8108
8144
|
});
|
|
8109
8145
|
}
|
|
8110
8146
|
function $8ef6232475d44150$var$make_state_saved_rows(_ref3, i18n_) {
|
|
@@ -10677,9 +10713,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
10677
10713
|
}
|
|
10678
10714
|
}), _el$19, _co$8);
|
|
10679
10715
|
$8tj43$insert(_el$7, $8tj43$createComponent((0, $8tj43$Show), {
|
|
10680
|
-
|
|
10681
|
-
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
10682
|
-
},
|
|
10716
|
+
when: !disable_search_recommendations_,
|
|
10683
10717
|
keyed: false,
|
|
10684
10718
|
get children() {
|
|
10685
10719
|
return $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
@@ -10698,7 +10732,8 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
10698
10732
|
},
|
|
10699
10733
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
10700
10734
|
view_more_button_: search_recs_view_more_,
|
|
10701
|
-
product_card_template_: product_card_template_
|
|
10735
|
+
product_card_template_: product_card_template_,
|
|
10736
|
+
all_products_loaded_: get_all_products_loaded
|
|
10702
10737
|
});
|
|
10703
10738
|
}
|
|
10704
10739
|
});
|
|
@@ -10848,6 +10883,7 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
10848
10883
|
disable_scrolling_during_modal = true,
|
|
10849
10884
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
10850
10885
|
render_instant_card: render_instant_card,
|
|
10886
|
+
override_modal_element: override_modal_element,
|
|
10851
10887
|
...props_on_class
|
|
10852
10888
|
} = _ref;
|
|
10853
10889
|
$eb064bc3350276c1$var$_classPrivateFieldInitSpec(this, $eb064bc3350276c1$var$_locale_signal, {
|
|
@@ -11003,7 +11039,7 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
11003
11039
|
enable_category_suggestions_: enable_category_suggestions,
|
|
11004
11040
|
disable_scrolling_: disable_scrolling_during_modal,
|
|
11005
11041
|
bottom_distance_under_modal_: bottom_distance_under_modal
|
|
11006
|
-
});
|
|
11042
|
+
}, override_modal_element);
|
|
11007
11043
|
// This will add some default behaviour to open_modal_ if no style_props_ are supplied
|
|
11008
11044
|
// The default behaviour is to align the modal with the input field if possible
|
|
11009
11045
|
const modal_opening_effect = () => {
|