@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/latest/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { add_to_version_info as $9HbP8$add_to_version_info, catchify as $9HbP8$catchify, slider_fractional_factory as $9HbP8$slider_fractional_factory, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, observer as $9HbP8$observer, is_safari as $9HbP8$is_safari, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ListenableSet as $9HbP8$ListenableSet, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
|
-
import { createSignal as $9HbP8$createSignal, onCleanup as $9HbP8$onCleanup, createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, createRenderEffect as $9HbP8$createRenderEffect, createRoot as $9HbP8$createRoot, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createEffect as $9HbP8$createEffect,
|
|
1
|
+
import { add_to_version_info as $9HbP8$add_to_version_info, catchify as $9HbP8$catchify, slider_fractional_factory as $9HbP8$slider_fractional_factory, camelCasifyObject as $9HbP8$camelCasifyObject, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, observer as $9HbP8$observer, is_safari as $9HbP8$is_safari, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, use_href_accessor as $9HbP8$use_href_accessor, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ListenableSet as $9HbP8$ListenableSet, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
|
|
2
|
+
import { createSignal as $9HbP8$createSignal, onCleanup as $9HbP8$onCleanup, createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, Suspense as $9HbP8$Suspense, Show as $9HbP8$Show, createRenderEffect as $9HbP8$createRenderEffect, createRoot as $9HbP8$createRoot, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createEffect as $9HbP8$createEffect, createUniqueId as $9HbP8$createUniqueId, untrack as $9HbP8$untrack, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, Index as $9HbP8$Index, on as $9HbP8$on, batch as $9HbP8$batch, createReaction as $9HbP8$createReaction } from "solid-js";
|
|
3
3
|
import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, insert as $9HbP8$insert, createComponent as $9HbP8$createComponent, mergeProps as $9HbP8$mergeProps, isServer as $9HbP8$isServer, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, addEventListener as $9HbP8$addEventListener, className as $9HbP8$className, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, effect as $9HbP8$effect, classList as $9HbP8$classList, setAttribute as $9HbP8$setAttribute, getNextMarker as $9HbP8$getNextMarker, style as $9HbP8$style, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use } 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.10";
|
|
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 = $9HbP8$getOwner();
|
|
198
|
-
const display_accessor = $9HbP8$createMemo(
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
const display_accessor = $9HbP8$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] = $9HbP8$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 => $9HbP8$runWithOwner(owner, () => $9HbP8$createEffect(() => fn(index()))),
|
|
206
|
-
merchant:
|
|
207
|
-
|
|
208
|
-
market: $9HbP8$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, $9HbP8$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 {}
|
|
@@ -598,51 +621,52 @@ function $3da8afe3ed57cf34$export$7da560f849543dff({
|
|
|
598
621
|
}) {
|
|
599
622
|
const is_showing_something = $9HbP8$createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
600
623
|
const num_placeholders_ = () => 20;
|
|
624
|
+
const elements = (() => {
|
|
625
|
+
const _el$ = $9HbP8$getNextElement($3da8afe3ed57cf34$var$_tmpl$),
|
|
626
|
+
_el$2 = _el$.firstChild,
|
|
627
|
+
[_el$3, _co$] = $9HbP8$getNextMarker(_el$2.nextSibling),
|
|
628
|
+
_el$4 = _el$3.nextSibling,
|
|
629
|
+
[_el$5, _co$2] = $9HbP8$getNextMarker(_el$4.nextSibling);
|
|
630
|
+
$9HbP8$insert(_el$, (0, $a458486f22b22f63$export$a2cc176055f8f08), _el$3, _co$);
|
|
631
|
+
$9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
|
|
632
|
+
get rows() {
|
|
633
|
+
return rows_object_();
|
|
634
|
+
},
|
|
635
|
+
layout: "grid",
|
|
636
|
+
element_attributes: {
|
|
637
|
+
class: "cards"
|
|
638
|
+
}
|
|
639
|
+
}, layout_options_, {
|
|
640
|
+
get children() {
|
|
641
|
+
return $9HbP8$createComponent((0, $9HbP8$Suspense), {
|
|
642
|
+
get fallback() {
|
|
643
|
+
return $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
644
|
+
num_placeholders_: num_placeholders_,
|
|
645
|
+
product_card_template_: product_card_template_
|
|
646
|
+
});
|
|
647
|
+
},
|
|
648
|
+
get children() {
|
|
649
|
+
return (() => {
|
|
650
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
651
|
+
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => recommendations_resource_() || []));
|
|
652
|
+
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
653
|
+
displays_by_key_: displays_by_key_,
|
|
654
|
+
merchant_: merchant_,
|
|
655
|
+
market_: market_,
|
|
656
|
+
product_card_template_: product_card_template_
|
|
657
|
+
});
|
|
658
|
+
})();
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
})), _el$5, _co$2);
|
|
663
|
+
return _el$;
|
|
664
|
+
})();
|
|
601
665
|
return $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
602
666
|
get when() {
|
|
603
667
|
return is_showing_something();
|
|
604
668
|
},
|
|
605
|
-
|
|
606
|
-
const _el$ = $9HbP8$getNextElement($3da8afe3ed57cf34$var$_tmpl$),
|
|
607
|
-
_el$2 = _el$.firstChild,
|
|
608
|
-
[_el$3, _co$] = $9HbP8$getNextMarker(_el$2.nextSibling),
|
|
609
|
-
_el$4 = _el$3.nextSibling,
|
|
610
|
-
[_el$5, _co$2] = $9HbP8$getNextMarker(_el$4.nextSibling);
|
|
611
|
-
$9HbP8$insert(_el$, (0, $a458486f22b22f63$export$a2cc176055f8f08), _el$3, _co$);
|
|
612
|
-
$9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
|
|
613
|
-
get rows() {
|
|
614
|
-
return rows_object_();
|
|
615
|
-
},
|
|
616
|
-
layout: "grid",
|
|
617
|
-
element_attributes: {
|
|
618
|
-
class: "cards"
|
|
619
|
-
}
|
|
620
|
-
}, layout_options_, {
|
|
621
|
-
get children() {
|
|
622
|
-
return $9HbP8$createComponent((0, $9HbP8$Suspense), {
|
|
623
|
-
get fallback() {
|
|
624
|
-
return $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
625
|
-
num_placeholders_: num_placeholders_,
|
|
626
|
-
product_card_template_: product_card_template_
|
|
627
|
-
});
|
|
628
|
-
},
|
|
629
|
-
get children() {
|
|
630
|
-
return (() => {
|
|
631
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
632
|
-
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => recommendations_resource_() || []));
|
|
633
|
-
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
634
|
-
displays_by_key_: displays_by_key_,
|
|
635
|
-
merchant_: merchant_,
|
|
636
|
-
market_: market_,
|
|
637
|
-
product_card_template_: product_card_template_
|
|
638
|
-
});
|
|
639
|
-
})();
|
|
640
|
-
}
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
})), _el$5, _co$2);
|
|
644
|
-
return _el$;
|
|
645
|
-
}
|
|
669
|
+
children: elements
|
|
646
670
|
});
|
|
647
671
|
}
|
|
648
672
|
const $9ea5383493360761$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<button class="show-more major" type="button"></button>`, 2),
|
|
@@ -3410,8 +3434,8 @@ function $5efb5894079b220e$var$modify_only_local_filter(local_filter_object, sel
|
|
|
3410
3434
|
}
|
|
3411
3435
|
return modified_filter_object;
|
|
3412
3436
|
}
|
|
3413
|
-
async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
3414
|
-
const body = await (0, $9HbP8$observer).wait_for_element("body");
|
|
3437
|
+
async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_opts, parent) {
|
|
3438
|
+
const body = parent || (await (0, $9HbP8$observer).wait_for_element("body"));
|
|
3415
3439
|
let dispose_and_remove;
|
|
3416
3440
|
const open_modal_ = (extra_options_for_modal = {}, on_dispose) => {
|
|
3417
3441
|
if (dispose_and_remove)
|
|
@@ -4248,7 +4272,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
4248
4272
|
const [get_extra_displays, set_extra_displays_] = $9HbP8$createSignal([], {
|
|
4249
4273
|
equals: false
|
|
4250
4274
|
});
|
|
4251
|
-
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => [...plp_results_()
|
|
4275
|
+
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => [...(plp_results_()?.displays || []), ...get_extra_displays()]));
|
|
4252
4276
|
const percentage_in_view_ = $0e0b96a8dc1ad492$export$63dd0350f8559dda({
|
|
4253
4277
|
get_last_result_in_viewport_: get_last_result_in_viewport_,
|
|
4254
4278
|
displays_by_key_: displays_by_key_,
|
|
@@ -4367,18 +4391,18 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4367
4391
|
layout_options_: layout_options_,
|
|
4368
4392
|
sort_or_filter_open_: sort_or_filter_open_
|
|
4369
4393
|
});
|
|
4370
|
-
$9HbP8$createComputed(() => {
|
|
4371
|
-
if (!is_loading_()) return;
|
|
4372
|
-
set_should_have_placeholders_rendered(true);
|
|
4373
|
-
set_suspense_is_blocked(false);
|
|
4374
|
-
is_just_after_plp_results_update = true;
|
|
4375
|
-
});
|
|
4376
4394
|
const block_suspense_if_needed = () => {
|
|
4377
4395
|
if (!is_just_after_plp_results_update) return;
|
|
4378
4396
|
is_just_after_plp_results_update = false;
|
|
4379
4397
|
fallback_is_alive = false;
|
|
4380
4398
|
set_suspense_is_blocked(true);
|
|
4381
4399
|
};
|
|
4400
|
+
$9HbP8$createComputed(() => {
|
|
4401
|
+
if (!is_loading_()) return;
|
|
4402
|
+
set_should_have_placeholders_rendered(true);
|
|
4403
|
+
set_suspense_is_blocked(false);
|
|
4404
|
+
is_just_after_plp_results_update = true;
|
|
4405
|
+
});
|
|
4382
4406
|
$9HbP8$createEffect($9HbP8$on(plp_results_, () => {
|
|
4383
4407
|
if (!fallback_is_alive) {
|
|
4384
4408
|
// 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
|
|
@@ -4388,6 +4412,48 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4388
4412
|
}, {
|
|
4389
4413
|
defer: true
|
|
4390
4414
|
}));
|
|
4415
|
+
/*
|
|
4416
|
+
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)
|
|
4417
|
+
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
4418
|
+
(For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
|
|
4419
|
+
We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
|
|
4420
|
+
*/
|
|
4421
|
+
const product_cards_when_data = $9HbP8$createComponent((0, $9HbP8$Suspense), {
|
|
4422
|
+
get fallback() {
|
|
4423
|
+
return (() => {
|
|
4424
|
+
fallback_is_alive = true;
|
|
4425
|
+
$9HbP8$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4426
|
+
return $9HbP8$createMemo(() => {
|
|
4427
|
+
// 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
|
|
4428
|
+
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
4429
|
+
if (get_suspense_is_blocked()) return suspense_contents;
|
|
4430
|
+
set_should_have_placeholders_rendered(true); // just in case
|
|
4431
|
+
$9HbP8$onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
4432
|
+
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>
|
|
4433
|
+
});
|
|
4434
|
+
})();
|
|
4435
|
+
},
|
|
4436
|
+
|
|
4437
|
+
get children() {
|
|
4438
|
+
return (() => {
|
|
4439
|
+
suspense_contents = $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
4440
|
+
product_card_template_: product_card_template_,
|
|
4441
|
+
plp_results_: plp_results_,
|
|
4442
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
4443
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
4444
|
+
market_: market_,
|
|
4445
|
+
merchant_: merchant_,
|
|
4446
|
+
all_products_loaded_: all_products_loaded_,
|
|
4447
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
4448
|
+
query_base_: query_base_,
|
|
4449
|
+
depict_api_: depict_api_,
|
|
4450
|
+
is_loading_: is_loading_
|
|
4451
|
+
});
|
|
4452
|
+
$9HbP8$onCleanup(() => suspense_contents = undefined);
|
|
4453
|
+
return suspense_contents;
|
|
4454
|
+
})();
|
|
4455
|
+
}
|
|
4456
|
+
});
|
|
4391
4457
|
return [$9HbP8$memo((0, $a458486f22b22f63$export$a2cc176055f8f08)), $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), {
|
|
4392
4458
|
get cols_at_size() {
|
|
4393
4459
|
return modified_cols_at_size();
|
|
@@ -4411,44 +4477,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
4411
4477
|
get fallback() {
|
|
4412
4478
|
return rendered_placeholders();
|
|
4413
4479
|
},
|
|
4414
|
-
|
|
4415
|
-
return $9HbP8$createComponent((0, $9HbP8$Suspense), {
|
|
4416
|
-
get fallback() {
|
|
4417
|
-
return (() => {
|
|
4418
|
-
fallback_is_alive = true;
|
|
4419
|
-
$9HbP8$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4420
|
-
return $9HbP8$createMemo(() => {
|
|
4421
|
-
// 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
|
|
4422
|
-
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
4423
|
-
if (get_suspense_is_blocked()) return suspense_contents;
|
|
4424
|
-
set_should_have_placeholders_rendered(true); // just in case
|
|
4425
|
-
$9HbP8$onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
4426
|
-
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>
|
|
4427
|
-
});
|
|
4428
|
-
})();
|
|
4429
|
-
},
|
|
4430
|
-
|
|
4431
|
-
get children() {
|
|
4432
|
-
return (() => {
|
|
4433
|
-
suspense_contents = $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
4434
|
-
product_card_template_: product_card_template_,
|
|
4435
|
-
plp_results_: plp_results_,
|
|
4436
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
4437
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
4438
|
-
market_: market_,
|
|
4439
|
-
merchant_: merchant_,
|
|
4440
|
-
all_products_loaded_: all_products_loaded_,
|
|
4441
|
-
min_products_to_fetch_: min_products_to_fetch_,
|
|
4442
|
-
query_base_: query_base_,
|
|
4443
|
-
depict_api_: depict_api_,
|
|
4444
|
-
is_loading_: is_loading_
|
|
4445
|
-
});
|
|
4446
|
-
$9HbP8$onCleanup(() => suspense_contents = undefined);
|
|
4447
|
-
return suspense_contents;
|
|
4448
|
-
})();
|
|
4449
|
-
}
|
|
4450
|
-
});
|
|
4451
|
-
}
|
|
4480
|
+
children: product_cards_when_data
|
|
4452
4481
|
});
|
|
4453
4482
|
}
|
|
4454
4483
|
})];
|
|
@@ -7457,58 +7486,61 @@ function $172e1b898d457050$export$7de92c4c2205ebf3({
|
|
|
7457
7486
|
product_card_template_: product_card_template_,
|
|
7458
7487
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
7459
7488
|
view_more_button_ = true,
|
|
7460
|
-
layout_options_: layout_options_
|
|
7489
|
+
layout_options_: layout_options_,
|
|
7490
|
+
all_products_loaded_: all_products_loaded_
|
|
7461
7491
|
}) {
|
|
7462
7492
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
7463
7493
|
const rows_object = view_more_button_ ? $172e1b898d457050$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
7464
7494
|
const [recommendations_resource] = $9HbP8$createResource(search_query_base_, query => depict_api_.get_recommended(query).then(r => r.displays));
|
|
7465
7495
|
const is_showing_something = $9HbP8$createMemo(() => recommendations_resource.loading || recommendations_resource()?.length);
|
|
7466
7496
|
const num_placeholders_ = $9HbP8$createMemo(() => (0, $7747fe1a8c5652e3$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(([per_column]) => per_column)));
|
|
7497
|
+
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
7498
|
+
const elements = (() => {
|
|
7499
|
+
const _el$ = $9HbP8$getNextElement($172e1b898d457050$var$_tmpl$),
|
|
7500
|
+
_el$2 = _el$.firstChild,
|
|
7501
|
+
_el$3 = _el$2.nextSibling,
|
|
7502
|
+
[_el$4, _co$] = $9HbP8$getNextMarker(_el$3.nextSibling),
|
|
7503
|
+
_el$5 = _el$4.nextSibling,
|
|
7504
|
+
[_el$6, _co$2] = $9HbP8$getNextMarker(_el$5.nextSibling);
|
|
7505
|
+
$9HbP8$insert(_el$2, () => i18n_.search_recs_title_());
|
|
7506
|
+
$9HbP8$insert(_el$, (0, $a458486f22b22f63$export$a2cc176055f8f08), _el$4, _co$);
|
|
7507
|
+
$9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
|
|
7508
|
+
rows: rows_object,
|
|
7509
|
+
layout: "grid",
|
|
7510
|
+
element_attributes: {
|
|
7511
|
+
class: "cards"
|
|
7512
|
+
}
|
|
7513
|
+
}, layout_options_, {
|
|
7514
|
+
get children() {
|
|
7515
|
+
return $9HbP8$createComponent((0, $9HbP8$Suspense), {
|
|
7516
|
+
get fallback() {
|
|
7517
|
+
return $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
7518
|
+
num_placeholders_: num_placeholders_,
|
|
7519
|
+
product_card_template_: product_card_template_
|
|
7520
|
+
});
|
|
7521
|
+
},
|
|
7522
|
+
get children() {
|
|
7523
|
+
return (() => {
|
|
7524
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
7525
|
+
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => recommendations_resource() || []));
|
|
7526
|
+
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
7527
|
+
displays_by_key_: displays_by_key_,
|
|
7528
|
+
merchant_: $9HbP8$createMemo(() => search_query_base_().tenant),
|
|
7529
|
+
market_: $9HbP8$createMemo(() => search_query_base_().market),
|
|
7530
|
+
product_card_template_: product_card_template_
|
|
7531
|
+
});
|
|
7532
|
+
})();
|
|
7533
|
+
}
|
|
7534
|
+
});
|
|
7535
|
+
}
|
|
7536
|
+
})), _el$6, _co$2);
|
|
7537
|
+
return _el$;
|
|
7538
|
+
})();
|
|
7467
7539
|
return $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
7468
7540
|
get when() {
|
|
7469
|
-
return is_showing_something();
|
|
7541
|
+
return $9HbP8$memo(() => !!is_showing_something())() && all_products_loaded_();
|
|
7470
7542
|
},
|
|
7471
|
-
|
|
7472
|
-
const _el$ = $9HbP8$getNextElement($172e1b898d457050$var$_tmpl$),
|
|
7473
|
-
_el$2 = _el$.firstChild,
|
|
7474
|
-
_el$3 = _el$2.nextSibling,
|
|
7475
|
-
[_el$4, _co$] = $9HbP8$getNextMarker(_el$3.nextSibling),
|
|
7476
|
-
_el$5 = _el$4.nextSibling,
|
|
7477
|
-
[_el$6, _co$2] = $9HbP8$getNextMarker(_el$5.nextSibling);
|
|
7478
|
-
$9HbP8$insert(_el$2, () => i18n_.search_recs_title_());
|
|
7479
|
-
$9HbP8$insert(_el$, (0, $a458486f22b22f63$export$a2cc176055f8f08), _el$4, _co$);
|
|
7480
|
-
$9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
|
|
7481
|
-
rows: rows_object,
|
|
7482
|
-
layout: "grid",
|
|
7483
|
-
element_attributes: {
|
|
7484
|
-
class: "cards"
|
|
7485
|
-
}
|
|
7486
|
-
}, layout_options_, {
|
|
7487
|
-
get children() {
|
|
7488
|
-
return $9HbP8$createComponent((0, $9HbP8$Suspense), {
|
|
7489
|
-
get fallback() {
|
|
7490
|
-
return $6e41f1fde994db72$export$f33414a4df0afd3f({
|
|
7491
|
-
num_placeholders_: num_placeholders_,
|
|
7492
|
-
product_card_template_: product_card_template_
|
|
7493
|
-
});
|
|
7494
|
-
},
|
|
7495
|
-
get children() {
|
|
7496
|
-
return (() => {
|
|
7497
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
7498
|
-
const displays_by_key_ = $29ec7cddbe1d3484$export$7f8bd308237ab5a5($9HbP8$createMemo(() => recommendations_resource() || []));
|
|
7499
|
-
return $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
|
|
7500
|
-
displays_by_key_: displays_by_key_,
|
|
7501
|
-
merchant_: $9HbP8$createMemo(() => search_query_base_().tenant),
|
|
7502
|
-
market_: $9HbP8$createMemo(() => search_query_base_().market),
|
|
7503
|
-
product_card_template_: product_card_template_
|
|
7504
|
-
});
|
|
7505
|
-
})();
|
|
7506
|
-
}
|
|
7507
|
-
});
|
|
7508
|
-
}
|
|
7509
|
-
})), _el$6, _co$2);
|
|
7510
|
-
return _el$;
|
|
7511
|
-
}
|
|
7543
|
+
children: elements
|
|
7512
7544
|
});
|
|
7513
7545
|
}
|
|
7514
7546
|
function $172e1b898d457050$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
|
|
@@ -9943,9 +9975,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
9943
9975
|
}
|
|
9944
9976
|
}), _el$19, _co$8);
|
|
9945
9977
|
$9HbP8$insert(_el$7, $9HbP8$createComponent((0, $9HbP8$Show), {
|
|
9946
|
-
|
|
9947
|
-
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
9948
|
-
},
|
|
9978
|
+
when: !disable_search_recommendations_,
|
|
9949
9979
|
keyed: false,
|
|
9950
9980
|
get children() {
|
|
9951
9981
|
return $9HbP8$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
@@ -9961,7 +9991,8 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
9961
9991
|
},
|
|
9962
9992
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
9963
9993
|
view_more_button_: search_recs_view_more_,
|
|
9964
|
-
product_card_template_: product_card_template_
|
|
9994
|
+
product_card_template_: product_card_template_,
|
|
9995
|
+
all_products_loaded_: get_all_products_loaded
|
|
9965
9996
|
});
|
|
9966
9997
|
}
|
|
9967
9998
|
});
|
|
@@ -10071,6 +10102,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
10071
10102
|
disable_scrolling_during_modal = true,
|
|
10072
10103
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
10073
10104
|
render_instant_card: render_instant_card,
|
|
10105
|
+
override_modal_element: override_modal_element,
|
|
10074
10106
|
...props_on_class
|
|
10075
10107
|
}) {
|
|
10076
10108
|
const owner = $9HbP8$getOwner() || $9HbP8$createRoot(() => $9HbP8$getOwner()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
|
|
@@ -10193,7 +10225,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
10193
10225
|
enable_category_suggestions_: enable_category_suggestions,
|
|
10194
10226
|
disable_scrolling_: disable_scrolling_during_modal,
|
|
10195
10227
|
bottom_distance_under_modal_: bottom_distance_under_modal
|
|
10196
|
-
});
|
|
10228
|
+
}, override_modal_element);
|
|
10197
10229
|
// This will add some default behaviour to open_modal_ if no style_props_ are supplied
|
|
10198
10230
|
// The default behaviour is to align the modal with the input field if possible
|
|
10199
10231
|
const modal_opening_effect = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
|
|
5
5
|
"packageManager": "yarn@3.2.2",
|
|
6
6
|
"sass": "styles.scss",
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
"@babel/runtime-corejs3": "^7.22.6",
|
|
239
239
|
"@depict-ai/plp-styling": "^1.2.5",
|
|
240
240
|
"@depict-ai/types": "^1.0.39",
|
|
241
|
-
"@depict-ai/utilishared": "^1.0.
|
|
241
|
+
"@depict-ai/utilishared": "^1.0.43",
|
|
242
242
|
"solid-js": "^1.7.3"
|
|
243
243
|
},
|
|
244
244
|
"type": "module",
|