@depict-ai/ui 0.0.65 → 0.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -1
- package/dist/main.js +260 -156
- package/dist/module.js +263 -160
- package/package.json +5 -4
package/dist/module.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {add_to_version_info as $g9l4l$add_to_version_info, fetch_recs as $g9l4l$fetch_recs, snakeCasifyObject as $g9l4l$snakeCasifyObject, GenericSliderArrowButton as $g9l4l$GenericSliderArrowButton, catchify as $g9l4l$catchify, base_url as $g9l4l$base_url, get_depict_id as $g9l4l$get_depict_id, get_user_id as $g9l4l$get_user_id, get_session_id as $g9l4l$get_session_id, dlog as $g9l4l$dlog, make_url_with_query_params as $g9l4l$make_url_with_query_params, fetch_retry as $g9l4l$fetch_retry, add_version_query_params as $g9l4l$add_version_query_params, sort_obj as $g9l4l$sort_obj, Tenant as $g9l4l$Tenant, Placeholder as $g9l4l$Placeholder, report as $g9l4l$report, javascript_media_query as $g9l4l$javascript_media_query, standard_price_format as $g9l4l$standard_price_format, deparallelize_no_drop as $g9l4l$deparallelize_no_drop, default_rr as $g9l4l$default_rr, make_random_classname as $g9l4l$make_random_classname, n_col_styling_with_dist as $g9l4l$n_col_styling_with_dist, observer as $g9l4l$observer, Lazyfier as $g9l4l$Lazyfier, queueMacroTask as $g9l4l$queueMacroTask, deparallelize as $g9l4l$deparallelize, Rec_Renderer as $g9l4l$Rec_Renderer, CrossIcon as $g9l4l$CrossIcon, useExpandingContainer as $g9l4l$useExpandingContainer, Amazing_Slider as $g9l4l$Amazing_Slider, slider_snap_css as $g9l4l$slider_snap_css, slider_fading_factory as $g9l4l$slider_fading_factory, MinusIcon as $g9l4l$MinusIcon, FilterIcon as $g9l4l$FilterIcon, SortIconAsc as $g9l4l$SortIconAsc, SortIconDesc as $g9l4l$SortIconDesc, PlusIcon as $g9l4l$PlusIcon, TickIcon as $g9l4l$TickIcon, ArrowUp as $g9l4l$ArrowUp, normal_get_product_id as $g9l4l$normal_get_product_id, ContainedPlaceholderImage as $g9l4l$ContainedPlaceholderImage, BackIcon as $g9l4l$BackIcon, SearchIcon as $g9l4l$SearchIcon, Layout as $g9l4l$Layout, make_placeholder_rr as $g9l4l$make_placeholder_rr, async_iterable_ipns as $g9l4l$async_iterable_ipns, make_asyncIterable_exiter as $g9l4l$make_asyncIterable_exiter, href_change_ipns as $g9l4l$href_change_ipns, depict_click as $g9l4l$depict_click, impression_track_element as $g9l4l$impression_track_element, add_new_tab_listener as $g9l4l$add_new_tab_listener, ContainedImage as $g9l4l$ContainedImage, buildThresholdList as $g9l4l$buildThresholdList, PreviousSearchIcon as $g9l4l$PreviousSearchIcon, insert_surfaces as $g9l4l$insert_surfaces, instant_exec_on_popstate_before_ipns_update as $g9l4l$instant_exec_on_popstate_before_ipns_update} from "@depict-ai/utilishared";
|
|
2
|
-
import {template as $g9l4l$template, insert as $g9l4l$insert, effect as $g9l4l$effect, setAttribute as $g9l4l$setAttribute, createComponent as $g9l4l$createComponent, use as $g9l4l$use, addEventListener as $g9l4l$addEventListener, delegateEvents as $g9l4l$delegateEvents, spread as $g9l4l$spread,
|
|
3
|
-
import {createSignal as $g9l4l$createSignal, onCleanup as $g9l4l$onCleanup, createComputed as $g9l4l$createComputed, createEffect as $g9l4l$createEffect, untrack as $g9l4l$untrack, batch as $g9l4l$batch, createResource as $g9l4l$createResource, createMemo as $g9l4l$createMemo, Show as $g9l4l$Show, createRenderEffect as $g9l4l$createRenderEffect, runWithOwner as $g9l4l$runWithOwner, createRoot as $g9l4l$createRoot, getOwner as $g9l4l$getOwner, on as $g9l4l$on,
|
|
1
|
+
import {add_to_version_info as $g9l4l$add_to_version_info, fetch_recs as $g9l4l$fetch_recs, snakeCasifyObject as $g9l4l$snakeCasifyObject, GenericSliderArrowButton as $g9l4l$GenericSliderArrowButton, catchify as $g9l4l$catchify, base_url as $g9l4l$base_url, get_depict_id as $g9l4l$get_depict_id, get_user_id as $g9l4l$get_user_id, get_session_id as $g9l4l$get_session_id, dlog as $g9l4l$dlog, make_url_with_query_params as $g9l4l$make_url_with_query_params, fetch_retry as $g9l4l$fetch_retry, add_version_query_params as $g9l4l$add_version_query_params, sort_obj as $g9l4l$sort_obj, Tenant as $g9l4l$Tenant, Placeholder as $g9l4l$Placeholder, report as $g9l4l$report, javascript_media_query as $g9l4l$javascript_media_query, standard_price_format as $g9l4l$standard_price_format, deparallelize_no_drop as $g9l4l$deparallelize_no_drop, default_rr as $g9l4l$default_rr, make_random_classname as $g9l4l$make_random_classname, n_col_styling_with_dist as $g9l4l$n_col_styling_with_dist, observer as $g9l4l$observer, Lazyfier as $g9l4l$Lazyfier, queueMacroTask as $g9l4l$queueMacroTask, deparallelize as $g9l4l$deparallelize, Rec_Renderer as $g9l4l$Rec_Renderer, CrossIcon as $g9l4l$CrossIcon, useExpandingContainer as $g9l4l$useExpandingContainer, Amazing_Slider as $g9l4l$Amazing_Slider, slider_snap_css as $g9l4l$slider_snap_css, slider_fading_factory as $g9l4l$slider_fading_factory, MinusIcon as $g9l4l$MinusIcon, FilterIcon as $g9l4l$FilterIcon, SortIconAsc as $g9l4l$SortIconAsc, SortIconDesc as $g9l4l$SortIconDesc, PlusIcon as $g9l4l$PlusIcon, hsl_to_rgb as $g9l4l$hsl_to_rgb, relative_luminance_from_rgb as $g9l4l$relative_luminance_from_rgb, TickIcon as $g9l4l$TickIcon, ArrowUp as $g9l4l$ArrowUp, normal_get_product_id as $g9l4l$normal_get_product_id, ContainedPlaceholderImage as $g9l4l$ContainedPlaceholderImage, BackIcon as $g9l4l$BackIcon, SearchIcon as $g9l4l$SearchIcon, Layout as $g9l4l$Layout, make_placeholder_rr as $g9l4l$make_placeholder_rr, async_iterable_ipns as $g9l4l$async_iterable_ipns, make_asyncIterable_exiter as $g9l4l$make_asyncIterable_exiter, href_change_ipns as $g9l4l$href_change_ipns, depict_click as $g9l4l$depict_click, impression_track_element as $g9l4l$impression_track_element, add_new_tab_listener as $g9l4l$add_new_tab_listener, ContainedImage as $g9l4l$ContainedImage, buildThresholdList as $g9l4l$buildThresholdList, PreviousSearchIcon as $g9l4l$PreviousSearchIcon, insert_surfaces as $g9l4l$insert_surfaces, instant_exec_on_popstate_before_ipns_update as $g9l4l$instant_exec_on_popstate_before_ipns_update} from "@depict-ai/utilishared";
|
|
2
|
+
import {template as $g9l4l$template, insert as $g9l4l$insert, effect as $g9l4l$effect, setAttribute as $g9l4l$setAttribute, createComponent as $g9l4l$createComponent, use as $g9l4l$use, addEventListener as $g9l4l$addEventListener, delegateEvents as $g9l4l$delegateEvents, spread as $g9l4l$spread, classList as $g9l4l$classList, memo as $g9l4l$memo, style as $g9l4l$style, mergeProps as $g9l4l$mergeProps, className as $g9l4l$className} from "solid-js/web";
|
|
3
|
+
import {createSignal as $g9l4l$createSignal, onCleanup as $g9l4l$onCleanup, createComputed as $g9l4l$createComputed, createEffect as $g9l4l$createEffect, untrack as $g9l4l$untrack, batch as $g9l4l$batch, createResource as $g9l4l$createResource, createMemo as $g9l4l$createMemo, Show as $g9l4l$Show, createRenderEffect as $g9l4l$createRenderEffect, runWithOwner as $g9l4l$runWithOwner, createRoot as $g9l4l$createRoot, getOwner as $g9l4l$getOwner, createReaction as $g9l4l$createReaction, on as $g9l4l$on, ErrorBoundary as $g9l4l$ErrorBoundary, Index as $g9l4l$Index, For as $g9l4l$For} from "solid-js";
|
|
4
4
|
|
|
5
|
-
/*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.
|
|
5
|
+
/*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.67";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -787,6 +787,55 @@ function $ed06bb0bb83a46b3$export$a2cc176055f8f08() {
|
|
|
787
787
|
}
|
|
788
788
|
|
|
789
789
|
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
797
|
+
class $22d7fd594100c3d0$export$e1d52e4f0c7557a1 extends Error {
|
|
798
|
+
}
|
|
799
|
+
class $22d7fd594100c3d0$export$aa14a9f43128f61f extends $22d7fd594100c3d0$export$e1d52e4f0c7557a1 {
|
|
800
|
+
constructor(templateError){
|
|
801
|
+
super("Uncaught error in product card template", {
|
|
802
|
+
cause: templateError
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
const $a406ebe9523f192f$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div></div>`, 2);
|
|
809
|
+
function $a406ebe9523f192f$export$b69d0d92862de18b(props) {
|
|
810
|
+
return (0, $g9l4l$ErrorBoundary)({
|
|
811
|
+
fallback (err, retry) {
|
|
812
|
+
const { message_: message_ , severity_: severity_ } = props;
|
|
813
|
+
let message = message_;
|
|
814
|
+
if (err instanceof (0, $22d7fd594100c3d0$export$aa14a9f43128f61f)) {
|
|
815
|
+
console.error(err.cause);
|
|
816
|
+
message = `${message}: ${err.message}`;
|
|
817
|
+
} else (0, $g9l4l$report)([
|
|
818
|
+
err,
|
|
819
|
+
message_
|
|
820
|
+
], severity_);
|
|
821
|
+
props.on_error_?.(retry);
|
|
822
|
+
return (()=>{
|
|
823
|
+
const _el$ = $a406ebe9523f192f$var$_tmpl$.cloneNode(true);
|
|
824
|
+
(0, $g9l4l$insert)(_el$, message);
|
|
825
|
+
(0, $g9l4l$effect)((_$p)=>(0, $g9l4l$classList)(_el$, Object.fromEntries(props.class_list_?.map((c)=>[
|
|
826
|
+
c,
|
|
827
|
+
true
|
|
828
|
+
]) || []), _$p));
|
|
829
|
+
return _el$;
|
|
830
|
+
})();
|
|
831
|
+
},
|
|
832
|
+
get children () {
|
|
833
|
+
return props.children;
|
|
834
|
+
}
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
|
|
790
839
|
const $57363319986950eb$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="PLP-results"></div>`, 2), $57363319986950eb$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="cards"></div>`, 2);
|
|
791
840
|
let $57363319986950eb$var$cached_placeholder_element;
|
|
792
841
|
function $57363319986950eb$export$3925f87b1545cfc6({ plp_results_: plp_results_ , depict_api_: depict_api_ , all_products_loaded_: all_products_loaded_ , min_products_to_fetch_: min_products_to_fetch_ , query_base_: query_base_ , first_result_in_viewport_: first_result_in_viewport_ , last_result_in_viewport_: last_result_in_viewport_ , scroll_restoration_data_: scroll_restoration_data_ , no_results_options_: no_results_options_ , desktop_filter_elements_: desktop_filter_elements_ , sort_or_filter_open_: sort_or_filter_open_ , rr_options_: rr_options_ , layout_options_: layout_options_ , tenant_object_: tenant_object_ , type_for_tracking_: type_for_tracking_ , id_currently_querying_for_: id_currently_querying_for_ }) {
|
|
@@ -823,8 +872,7 @@ function $57363319986950eb$export$3925f87b1545cfc6({ plp_results_: plp_results_
|
|
|
823
872
|
recs: current_results.displays,
|
|
824
873
|
...rr_options_,
|
|
825
874
|
...typeof rr_options_.template === "function" ? {
|
|
826
|
-
template:
|
|
827
|
-
rr_options_.template(...args))
|
|
875
|
+
template: $57363319986950eb$var$wrap_template_to_throw_into_error_boundary(rr_options_.template, owner_for_cards)
|
|
828
876
|
} : {},
|
|
829
877
|
post_processors: [
|
|
830
878
|
...rr_options_.post_processors || [],
|
|
@@ -869,86 +917,101 @@ function $57363319986950eb$export$3925f87b1545cfc6({ plp_results_: plp_results_
|
|
|
869
917
|
return (0, $g9l4l$createComponent)((0, $a20b0ecfca7ab32d$export$ef6006467f04ee41), no_results_options_);
|
|
870
918
|
},
|
|
871
919
|
get children () {
|
|
872
|
-
return ((
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
plp_results_(); // re-run render_and_insert_results when results change
|
|
917
|
-
render_and_insert_results(cards, owner_);
|
|
918
|
-
}
|
|
919
|
-
}));
|
|
920
|
-
// copied from RecommendationGrid
|
|
921
|
-
// convoluted lazy loading that
|
|
922
|
-
// when the elements are in the DOM starts IntersectionObserver on whole grid
|
|
923
|
-
// when grid intersects starts Lazyfier
|
|
924
|
-
// this is because Lazyfier is fucking stupid
|
|
925
|
-
(0, $g9l4l$observer).wait_for_element(cards).then((0, $g9l4l$catchify)((element)=>{
|
|
926
|
-
let start_lazy_loading;
|
|
927
|
-
const lazy_loading_promise = new Promise((r)=>start_lazy_loading = r);
|
|
928
|
-
const lf = new (0, $g9l4l$Lazyfier)({
|
|
929
|
-
only_load_intersecting: true,
|
|
930
|
-
wait_for_dominsertion: lazy_loading_promise,
|
|
931
|
-
ignore_data_urls: true,
|
|
932
|
-
lazyfinder: {
|
|
933
|
-
unload () {}
|
|
934
|
-
}
|
|
920
|
+
return (0, $a406ebe9523f192f$export$b69d0d92862de18b)({
|
|
921
|
+
severity_: "error",
|
|
922
|
+
// More granular error handling
|
|
923
|
+
// This _also_ fails when a product card rendering fails due to the runWithOwner with a root that was created inside the "root"/"context" of this ErrorBoundary
|
|
924
|
+
on_error_: (retry)=>{
|
|
925
|
+
// re-try / reset ErrorBoundary next time we're getting product cards
|
|
926
|
+
const track = (0, $g9l4l$createReaction)(retry);
|
|
927
|
+
track(plp_results_);
|
|
928
|
+
},
|
|
929
|
+
class_list_: [
|
|
930
|
+
"cards"
|
|
931
|
+
],
|
|
932
|
+
// So that the styling looks pretty when we've failed
|
|
933
|
+
message_: "Result rendering failed",
|
|
934
|
+
get children () {
|
|
935
|
+
const random_id = (0, $g9l4l$make_random_classname)();
|
|
936
|
+
const selector_beginning = `.depict.plp #${random_id}>`;
|
|
937
|
+
const cards = (()=>{
|
|
938
|
+
const _el$2 = $57363319986950eb$var$_tmpl$2.cloneNode(true);
|
|
939
|
+
(0, $g9l4l$setAttribute)(_el$2, "id", random_id);
|
|
940
|
+
return _el$2;
|
|
941
|
+
})();
|
|
942
|
+
const style = document.createElement("style");
|
|
943
|
+
(0, $g9l4l$createRenderEffect)(()=>{
|
|
944
|
+
// Add grid styling that changes when filters get opened/closed
|
|
945
|
+
const when_filters_closed_cols = layout_options_.cols_at_size;
|
|
946
|
+
const cols_at_size = sort_or_filter_open_() ? when_filters_closed_cols.map((row)=>{
|
|
947
|
+
const [num_cols_default, , , , override_cols] = row;
|
|
948
|
+
const cloned_row = [
|
|
949
|
+
...row
|
|
950
|
+
];
|
|
951
|
+
// @ts-ignore
|
|
952
|
+
cloned_row[0] = num_cols_default - 1;
|
|
953
|
+
if (override_cols) // @ts-ignore
|
|
954
|
+
cloned_row[4] = {
|
|
955
|
+
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column])=>[
|
|
956
|
+
row,
|
|
957
|
+
column - 1
|
|
958
|
+
]))
|
|
959
|
+
};
|
|
960
|
+
return cloned_row;
|
|
961
|
+
}) : when_filters_closed_cols;
|
|
962
|
+
const css = (0, $g9l4l$n_col_styling_with_dist)(selector_beginning, layout_options_.grid_spacing, cols_at_size, "grid", layout_options_.override_vertical_spacing);
|
|
963
|
+
style.replaceChildren(css);
|
|
935
964
|
});
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
965
|
+
(0, $g9l4l$createRenderEffect)(// render placeholders / product cards
|
|
966
|
+
(0, $g9l4l$catchify)(async ()=>{
|
|
967
|
+
const owner_ = (0, $g9l4l$getOwner)();
|
|
968
|
+
if (is_loading()) await $57363319986950eb$var$insert_placeholders({
|
|
969
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
970
|
+
id_currently_querying_for_: id_currently_querying_for_,
|
|
971
|
+
rr_options_: rr_options_,
|
|
972
|
+
tenant_object_: tenant_object_,
|
|
973
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
974
|
+
owner_: owner_,
|
|
975
|
+
cards_element_: cards
|
|
976
|
+
});
|
|
977
|
+
else if (!has_no_results_or_failed()) {
|
|
978
|
+
plp_results_(); // re-run render_and_insert_results when results change
|
|
979
|
+
render_and_insert_results(cards, owner_);
|
|
942
980
|
}
|
|
943
981
|
}));
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
982
|
+
// copied from RecommendationGrid
|
|
983
|
+
// convoluted lazy loading that
|
|
984
|
+
// when the elements are in the DOM starts IntersectionObserver on whole grid
|
|
985
|
+
// when grid intersects starts Lazyfier
|
|
986
|
+
// this is because Lazyfier is fucking stupid
|
|
987
|
+
(0, $g9l4l$observer).wait_for_element(cards).then((0, $g9l4l$catchify)((element)=>{
|
|
988
|
+
let start_lazy_loading;
|
|
989
|
+
const lazy_loading_promise = new Promise((r)=>start_lazy_loading = r);
|
|
990
|
+
const lf = new (0, $g9l4l$Lazyfier)({
|
|
991
|
+
only_load_intersecting: true,
|
|
992
|
+
wait_for_dominsertion: lazy_loading_promise,
|
|
993
|
+
ignore_data_urls: true,
|
|
994
|
+
lazyfinder: {
|
|
995
|
+
unload () {}
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
lf.start_observing_for_new_children_(element);
|
|
999
|
+
const i_o = new IntersectionObserver((0, $g9l4l$catchify)((records)=>{
|
|
1000
|
+
for (const record of records)if (record.intersectionRatio > 0) {
|
|
1001
|
+
start_lazy_loading();
|
|
1002
|
+
i_o.disconnect();
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
1005
|
+
}));
|
|
1006
|
+
i_o.observe(cards);
|
|
1007
|
+
}));
|
|
1008
|
+
return [
|
|
1009
|
+
(0, $ed06bb0bb83a46b3$export$a2cc176055f8f08)(),
|
|
1010
|
+
cards,
|
|
1011
|
+
style
|
|
1012
|
+
];
|
|
1013
|
+
}
|
|
1014
|
+
});
|
|
952
1015
|
}
|
|
953
1016
|
}), null);
|
|
954
1017
|
(0, $g9l4l$insert)(_el$, desktop_filter_elements_, null);
|
|
@@ -965,19 +1028,18 @@ async function $57363319986950eb$var$insert_placeholders({ scroll_restoration_da
|
|
|
965
1028
|
let existing_num = 0;
|
|
966
1029
|
let removed_old_children = false;
|
|
967
1030
|
if (!$57363319986950eb$var$cached_placeholder_element) {
|
|
1031
|
+
const [dispose_card, root_in_root] = (0, $g9l4l$createRoot)((dispose)=>[
|
|
1032
|
+
dispose,
|
|
1033
|
+
(0, $g9l4l$getOwner)()
|
|
1034
|
+
]);
|
|
968
1035
|
const { elements: elements } = await (0, $g9l4l$default_rr)(tenant_object_, {
|
|
969
1036
|
...rr_options_,
|
|
970
1037
|
type: "placeholder",
|
|
971
1038
|
pre_processors: [],
|
|
972
1039
|
post_processors: [],
|
|
973
1040
|
...typeof rr_options_.template === "function" ? {
|
|
974
|
-
template: (
|
|
975
|
-
|
|
976
|
-
return await rr_options_.template(...args);
|
|
977
|
-
} finally{
|
|
978
|
-
(0, $g9l4l$queueMacroTask)((0, $g9l4l$catchify)(dispose)); // we just want it cloned and dead
|
|
979
|
-
}
|
|
980
|
-
})
|
|
1041
|
+
template: $57363319986950eb$var$wrap_template_to_throw_into_error_boundary(rr_options_.template, root_in_root, ()=>(0, $g9l4l$queueMacroTask)((0, $g9l4l$catchify)(dispose_card)) // we just want it cloned and dead
|
|
1042
|
+
)
|
|
981
1043
|
} : {},
|
|
982
1044
|
recs: [
|
|
983
1045
|
{
|
|
@@ -993,13 +1055,28 @@ async function $57363319986950eb$var$insert_placeholders({ scroll_restoration_da
|
|
|
993
1055
|
const to_add = num_placeholders() - existing_num;
|
|
994
1056
|
if (to_add <= 0) return;
|
|
995
1057
|
// We don't need to remove placeholders, only need to add. The reason for that is that chrome restores the scroll position once all tasks queued as reaction of the "popstate" events have been completed in the task queue. That means that we need to get the placeholders in fast, or we might lose scroll position if the previous site was shorter.
|
|
996
|
-
// The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work
|
|
1058
|
+
// The query id and the amount might update in separate tasks because one comes from href_change_ipns and the other one from another "popstate" listener. Therefore, we need to be able to dynamically add more placeholders. I'm not entirely sure about this anymore though, since we have the scroll position on a per-id basis it might work anyway but THIS WORKS, and I've been working on this bug for 3 hours so let's just keep it this way.
|
|
997
1059
|
cards_element_[removed_old_children ? "append" : (removed_old_children = true, "replaceChildren")](...Array.from({
|
|
998
1060
|
length: to_add
|
|
999
1061
|
}).map(()=>$57363319986950eb$var$cached_placeholder_element.cloneNode(true)));
|
|
1000
1062
|
existing_num += to_add;
|
|
1001
1063
|
}));
|
|
1002
1064
|
}
|
|
1065
|
+
function $57363319986950eb$var$wrap_template_to_throw_into_error_boundary(template, root_in_root, on_finally) {
|
|
1066
|
+
return async (...args)=>{
|
|
1067
|
+
try {
|
|
1068
|
+
return await (0, $g9l4l$runWithOwner)(root_in_root, ()=>template(...args)) || [];
|
|
1069
|
+
} catch (e) {
|
|
1070
|
+
(0, $g9l4l$runWithOwner)(root_in_root, ()=>{
|
|
1071
|
+
// Throw in case of promise rejection, ultimately into ErrorBoundary
|
|
1072
|
+
throw e;
|
|
1073
|
+
});
|
|
1074
|
+
return [];
|
|
1075
|
+
} finally{
|
|
1076
|
+
on_finally?.();
|
|
1077
|
+
}
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1003
1080
|
|
|
1004
1081
|
|
|
1005
1082
|
|
|
@@ -2635,7 +2712,7 @@ function $b114513503b25433$export$82ed4b28ecb67608({ filter_: filter_ , selected
|
|
|
2635
2712
|
// lighten or darken (+/- 10) depending on it's over or under 50 lightness
|
|
2636
2713
|
// lighten under 25 lightness by 20
|
|
2637
2714
|
const target_lightness = is_hovered ? is_light ? lightness() - 10 : lightness() < 25 ? lightness() + 20 : lightness() + 10 : lightness();
|
|
2638
|
-
classList.toggle("check-dark",
|
|
2715
|
+
classList.toggle("check-dark", $b114513503b25433$var$black_contrast_better(hue(), saturation(), lightness())); // Decide between black/white checkmark based on which one has better contrast according to WCAG contrast guidelines
|
|
2639
2716
|
style.backgroundColor = `hsl(${hue()}, ${saturation()}%, ${target_lightness}%)`;
|
|
2640
2717
|
}
|
|
2641
2718
|
});
|
|
@@ -2732,6 +2809,15 @@ function $b114513503b25433$export$82ed4b28ecb67608({ filter_: filter_ , selected
|
|
|
2732
2809
|
return _el$;
|
|
2733
2810
|
})();
|
|
2734
2811
|
}
|
|
2812
|
+
function $b114513503b25433$var$black_contrast_better(hue, saturation, lightness) {
|
|
2813
|
+
const as_rgb = (0, $g9l4l$hsl_to_rgb)(hue, saturation, lightness);
|
|
2814
|
+
const luminance_color = (0, $g9l4l$relative_luminance_from_rgb)(...as_rgb);
|
|
2815
|
+
const luminance_white = 1;
|
|
2816
|
+
const luminance_black = 0;
|
|
2817
|
+
const contrast_ratio_if_white = (luminance_white + 0.05) / (luminance_color + 0.05);
|
|
2818
|
+
const contrast_ratio_if_black = (luminance_color + 0.05) / (luminance_black + 0.05);
|
|
2819
|
+
return contrast_ratio_if_black > contrast_ratio_if_white;
|
|
2820
|
+
}
|
|
2735
2821
|
|
|
2736
2822
|
|
|
2737
2823
|
var $7b224b353182ce9a$export$2e2bcd8739ae039 = {
|
|
@@ -3013,31 +3099,6 @@ function $a2432c33d88ec427$export$ab34afce88557c0e(props) {
|
|
|
3013
3099
|
|
|
3014
3100
|
|
|
3015
3101
|
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
const $a406ebe9523f192f$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div></div>`, 2);
|
|
3019
|
-
function $a406ebe9523f192f$export$b69d0d92862de18b(props) {
|
|
3020
|
-
return (0, $g9l4l$ErrorBoundary)({
|
|
3021
|
-
fallback (err) {
|
|
3022
|
-
const { message_: message_ , severity_: severity_ } = props;
|
|
3023
|
-
(0, $g9l4l$report)([
|
|
3024
|
-
err,
|
|
3025
|
-
message_
|
|
3026
|
-
], severity_);
|
|
3027
|
-
return (()=>{
|
|
3028
|
-
const _el$ = $a406ebe9523f192f$var$_tmpl$.cloneNode(true);
|
|
3029
|
-
(0, $g9l4l$insert)(_el$, message_);
|
|
3030
|
-
return _el$;
|
|
3031
|
-
})();
|
|
3032
|
-
},
|
|
3033
|
-
get children () {
|
|
3034
|
-
return props.children;
|
|
3035
|
-
}
|
|
3036
|
-
});
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
3102
|
const $8aff437d739a524d$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="filter-collapsible"></div>`, 2), $8aff437d739a524d$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<button class="clear-group"><span></span></button>`, 4), $8aff437d739a524d$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="view-more-clear"></div>`, 2), $8aff437d739a524d$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="filter-collapsible-body"><div class="filter-part"></div></div>`, 4), $8aff437d739a524d$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<details class="filter-collapsible"></details>`, 2), $8aff437d739a524d$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<summary class="filter-group-summary"><div class="summary"><span></span><div class="selected-w-sign"></div></div></summary>`, 8), $8aff437d739a524d$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="ungrouped"></div>`, 2), $8aff437d739a524d$var$_tmpl$8 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<button class="clear-all-filters major"></button>`, 2);
|
|
3042
3103
|
function $8aff437d739a524d$export$3f1a388cc0d8fed7(props) {
|
|
3043
3104
|
// Split like this to make placeholder wrapping more visible & this component is exported and used in MobileModal
|
|
@@ -5296,14 +5357,18 @@ function $7a7079d66c12b788$export$d757d54550ebfb3d({ category_suggestion_: categ
|
|
|
5296
5357
|
|
|
5297
5358
|
|
|
5298
5359
|
const $6ded59a142c93078$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<button class="back" type="button"></button>`, 2), $6ded59a142c93078$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="search-field"><div class="field"><input class="query" tabindex="0"><button type="button" class="clear"></button></div><button class="submit major" type="button"></button></div>`, 9);
|
|
5299
|
-
function $6ded59a142c93078$export$b94867ecbd698f21({ search_field_value_: search_field_value_ , input_field_ref_: input_field_ref_ , field_element_ref_: field_element_ref_ , submit_query_: submit_query_ , override_on_enter_: override_on_enter_ , clear_filters_: clear_filters_ , disabled_: disabled_ = false , on_back_: on_back_ , i18n_: i18n_ }) {
|
|
5300
|
-
let
|
|
5360
|
+
function $6ded59a142c93078$export$b94867ecbd698f21({ search_field_value_: search_field_value_ , input_field_ref_: input_field_ref_ , field_element_ref_: field_element_ref_ , submit_query_: submit_query_ , override_on_enter_: override_on_enter_ , clear_filters_: clear_filters_ , disabled_: disabled_ = false , on_back_: on_back_ , i18n_: i18n_ , after_focusing_: after_focusing_ }) {
|
|
5361
|
+
let input_element;
|
|
5362
|
+
// This is the div where we recommend (and ourselves do) attach the event listener to that opens the search modal.
|
|
5363
|
+
let field_div;
|
|
5301
5364
|
(0, $g9l4l$createEffect)((0, $g9l4l$catchify)(async ()=>{
|
|
5302
5365
|
if (disabled_) return;
|
|
5303
5366
|
// we aren't in DOM yet unfortunately, wouldn't even be with onMount
|
|
5304
|
-
await (0, $g9l4l$observer).wait_for_element(
|
|
5305
|
-
|
|
5367
|
+
await (0, $g9l4l$observer).wait_for_element(input_element);
|
|
5368
|
+
input_element.focus();
|
|
5369
|
+
after_focusing_?.(input_element);
|
|
5306
5370
|
})); // focus field on render
|
|
5371
|
+
const owner_of_field_element = (0, $g9l4l$getOwner)();
|
|
5307
5372
|
return (()=>{
|
|
5308
5373
|
const _el$ = $6ded59a142c93078$var$_tmpl$2.cloneNode(true), _el$3 = _el$.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$6 = _el$3.nextSibling;
|
|
5309
5374
|
(0, $g9l4l$insert)(_el$, (0, $g9l4l$createComponent)((0, $g9l4l$Show), {
|
|
@@ -5316,38 +5381,47 @@ function $6ded59a142c93078$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5316
5381
|
return _el$2;
|
|
5317
5382
|
}
|
|
5318
5383
|
}), _el$3);
|
|
5319
|
-
(0, $g9l4l$use)((el)=>
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5384
|
+
(0, $g9l4l$use)((el)=>{
|
|
5385
|
+
field_div = el;
|
|
5386
|
+
field_element_ref_?.(el);
|
|
5387
|
+
}, _el$3);
|
|
5388
|
+
_el$4.$$pointerdown = ({ pointerType: pointerType })=>{
|
|
5389
|
+
// When selecting text with a mouse we want a SearchField to be focussed even when releasing the mouse outside the .field element (we assume the event listener which opens the modal is attached to that).
|
|
5390
|
+
if (pointerType === "mouse") {
|
|
5391
|
+
const handler = (0, $g9l4l$catchify)(({ pointerType: pointerType , target: target })=>{
|
|
5392
|
+
if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
|
|
5393
|
+
input_element.click();
|
|
5394
|
+
});
|
|
5395
|
+
window.addEventListener("pointerup", handler, {
|
|
5325
5396
|
once: true
|
|
5326
5397
|
});
|
|
5398
|
+
if (owner_of_field_element) (0, $g9l4l$runWithOwner)(owner_of_field_element, ()=>(0, $g9l4l$onCleanup)(()=>window.removeEventListener("pointerup", handler)));
|
|
5327
5399
|
}
|
|
5400
|
+
};
|
|
5401
|
+
(0, $g9l4l$addEventListener)(_el$4, "select", (0, $g9l4l$catchify)(()=>{
|
|
5402
|
+
if (disabled_) // just in case. The field not actually being disabled when being disabled_ is so that you can focus it and open the modal. We don't want any of the other input-field-interaction features to work
|
|
5403
|
+
return;
|
|
5404
|
+
if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length) // everything was selected, clear filters on next submit on next input
|
|
5405
|
+
input_element.addEventListener("input", (0, $g9l4l$catchify)(clear_filters_), {
|
|
5406
|
+
once: true
|
|
5407
|
+
});
|
|
5328
5408
|
}));
|
|
5329
5409
|
(0, $g9l4l$addEventListener)(_el$4, "input", (0, $g9l4l$catchify)(()=>{
|
|
5330
|
-
const { value: value } =
|
|
5410
|
+
const { value: value } = input_element;
|
|
5331
5411
|
if (!disabled_ && !value.length) clear_filters_(); // if the user clears the whole field, reset filters on next submit
|
|
5332
5412
|
search_field_value_[1](value);
|
|
5333
5413
|
}), true);
|
|
5334
5414
|
(0, $g9l4l$addEventListener)(_el$4, "keydown", (0, $g9l4l$catchify)((e)=>{
|
|
5335
5415
|
if (disabled_) {
|
|
5336
5416
|
if (e.key !== "Tab" && e.key !== "Shift") // alow tab-selecting the input field and then open the modal when the user start writing but also to move past the field with tab
|
|
5337
|
-
|
|
5417
|
+
input_element.click();
|
|
5338
5418
|
} else if (e.key === "Enter") {
|
|
5339
5419
|
const dont_submit = override_on_enter_?.(e);
|
|
5340
5420
|
if (!dont_submit) submit_query_();
|
|
5341
5421
|
}
|
|
5342
5422
|
}), true);
|
|
5343
|
-
(0, $g9l4l$addEventListener)(_el$4, "focus", (0, $g9l4l$catchify)(()=>{
|
|
5344
|
-
if (disabled_) {
|
|
5345
|
-
const last_pos = input_field.value.length;
|
|
5346
|
-
input_field.setSelectionRange(last_pos, last_pos);
|
|
5347
|
-
}
|
|
5348
|
-
}));
|
|
5349
5423
|
const _ref$ = (0, $g9l4l$catchify)((el)=>{
|
|
5350
|
-
|
|
5424
|
+
input_element = el;
|
|
5351
5425
|
input_field_ref_?.(el);
|
|
5352
5426
|
});
|
|
5353
5427
|
typeof _ref$ === "function" && (0, $g9l4l$use)(_ref$, _el$4);
|
|
@@ -5355,8 +5429,7 @@ function $6ded59a142c93078$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5355
5429
|
(0, $g9l4l$addEventListener)(_el$5, "click", (0, $g9l4l$catchify)(()=>{
|
|
5356
5430
|
search_field_value_[1]("");
|
|
5357
5431
|
clear_filters_();
|
|
5358
|
-
if (disabled_)
|
|
5359
|
-
input_field.focus();
|
|
5432
|
+
if (!disabled_) input_element.focus();
|
|
5360
5433
|
}), true);
|
|
5361
5434
|
(0, $g9l4l$insert)(_el$5, (0, $g9l4l$createComponent)((0, $g9l4l$CrossIcon), {}));
|
|
5362
5435
|
(0, $g9l4l$addEventListener)(_el$6, "click", (0, $g9l4l$catchify)(()=>submit_query_()), true);
|
|
@@ -5383,7 +5456,8 @@ function $6ded59a142c93078$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5383
5456
|
(0, $g9l4l$delegateEvents)([
|
|
5384
5457
|
"click",
|
|
5385
5458
|
"keydown",
|
|
5386
|
-
"input"
|
|
5459
|
+
"input",
|
|
5460
|
+
"pointerdown"
|
|
5387
5461
|
]);
|
|
5388
5462
|
|
|
5389
5463
|
|
|
@@ -5735,7 +5809,7 @@ function $4ad18a8b237ff7f6$export$2542ffb77b620b02(params_to_default_value) {
|
|
|
5735
5809
|
|
|
5736
5810
|
|
|
5737
5811
|
const $d3c0043bb23a833f$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<span class="orig price"></span>`, 2), $d3c0043bb23a833f$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title"></span></div><div class="price-container"><span class="price"></span></div></div></a>`, 16), $d3c0043bb23a833f$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="tagline"></div>`, 2);
|
|
5738
|
-
const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n })=>{
|
|
5812
|
+
const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market })=>{
|
|
5739
5813
|
const display = (0, $g9l4l$createMemo)(()=>{
|
|
5740
5814
|
const display = display_or_variant_container();
|
|
5741
5815
|
// Support for backend's new display format
|
|
@@ -5747,7 +5821,12 @@ const $d3c0043bb23a833f$export$b05c0ae390cf3e06 = (display_or_variant_container,
|
|
|
5747
5821
|
};
|
|
5748
5822
|
}
|
|
5749
5823
|
if (display.page_url) return display;
|
|
5750
|
-
// Support for
|
|
5824
|
+
// Support for post-migration (but still old basic format) Stronger displays, with slug but without page_url
|
|
5825
|
+
if (display.slug) {
|
|
5826
|
+
display.page_url = `/${market}/` + display.slug;
|
|
5827
|
+
return display;
|
|
5828
|
+
}
|
|
5829
|
+
// Support for Spendrups displays, used by our frontend script and Spendrups coming react-ui integration.
|
|
5751
5830
|
if (!display?.variants?.length) return;
|
|
5752
5831
|
return display.variants.filter((v)=>v.product_id == display.product_id)[0];
|
|
5753
5832
|
});
|
|
@@ -6734,7 +6813,7 @@ function $b24f16c875c2baa6$export$f021bdedd3ec901a(props) {
|
|
|
6734
6813
|
|
|
6735
6814
|
|
|
6736
6815
|
const $a9f6faeac82c322b$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $a9f6faeac82c322b$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<b></b>`, 2), $a9f6faeac82c322b$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $a9f6faeac82c322b$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
|
|
6737
|
-
function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: search_field_value_ , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $g9l4l$createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: submit_query_ , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , after_submit_: after_submit_ , bottom_distance_under_modal_: bottom_distance_under_modal_ , navigate_page_to_href_: navigate_page_to_href_ , on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ }) {
|
|
6816
|
+
function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: search_field_value_ , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $g9l4l$createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: submit_query_ , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , after_submit_: after_submit_ , bottom_distance_under_modal_: bottom_distance_under_modal_ , navigate_page_to_href_: navigate_page_to_href_ , on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ , selected_text_range_: selected_text_range_ }) {
|
|
6738
6817
|
let on_enter_in_search_field_function;
|
|
6739
6818
|
const [input_field, set_input_field] = (0, $g9l4l$createSignal)();
|
|
6740
6819
|
const [get_search_field_value_] = search_field_value_;
|
|
@@ -6796,7 +6875,14 @@ function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: search
|
|
|
6796
6875
|
search_field_value_: search_field_value_,
|
|
6797
6876
|
submit_query_: submit_query_,
|
|
6798
6877
|
clear_filters_: clear_filters_,
|
|
6799
|
-
i18n_: i18n_
|
|
6878
|
+
i18n_: i18n_,
|
|
6879
|
+
after_focusing_: (input_el)=>{
|
|
6880
|
+
// Restore the selection range from the SearchField that was used to open the modal, if it was saved.
|
|
6881
|
+
if (!selected_text_range_) return;
|
|
6882
|
+
const [start, end] = selected_text_range_;
|
|
6883
|
+
if (start === null || end === null) return;
|
|
6884
|
+
input_el.setSelectionRange(start, end);
|
|
6885
|
+
}
|
|
6800
6886
|
});
|
|
6801
6887
|
search_field.classList.add("in-modal");
|
|
6802
6888
|
const modal_element = (()=>{
|
|
@@ -7066,28 +7152,38 @@ function $b76e8f62b1f313ef$export$a54ec244c8863715(opts) {
|
|
|
7066
7152
|
})));
|
|
7067
7153
|
const available_filters_ = (0, $g9l4l$createMemo)(()=>search_results_()?.filters);
|
|
7068
7154
|
const modal_body_style = (0, $g9l4l$createSignal)({});
|
|
7069
|
-
let
|
|
7155
|
+
let search_field;
|
|
7070
7156
|
if (include_input_field_) {
|
|
7071
7157
|
const SafeSearchField = (0, $g9l4l$catchify)((0, $6ded59a142c93078$export$b94867ecbd698f21));
|
|
7072
|
-
|
|
7158
|
+
let input_element;
|
|
7159
|
+
let div_with_field_class;
|
|
7160
|
+
search_field = SafeSearchField({
|
|
7073
7161
|
i18n_: i18n_,
|
|
7074
|
-
disabled_: true,
|
|
7075
7162
|
search_query_: search_query_,
|
|
7076
7163
|
search_field_value_: search_field_value_,
|
|
7077
7164
|
submit_query_: submit_query_,
|
|
7078
|
-
clear_filters_: clear_filters_on_next_submit_
|
|
7165
|
+
clear_filters_: clear_filters_on_next_submit_,
|
|
7166
|
+
input_field_ref_: (el)=>input_element = el,
|
|
7167
|
+
field_element_ref_: (el)=>div_with_field_class = el,
|
|
7168
|
+
disabled_: true
|
|
7079
7169
|
});
|
|
7080
|
-
if (
|
|
7170
|
+
if (search_field) {
|
|
7081
7171
|
opts?.modal_body_style_ref_?.(modal_body_style);
|
|
7082
|
-
const align_position = (0, $g9l4l$catchify)((0, $079defea521d5e2a$export$b3ad617e9036868))(modal_body_style,
|
|
7083
|
-
|
|
7172
|
+
const align_position = (0, $g9l4l$catchify)((0, $079defea521d5e2a$export$b3ad617e9036868))(modal_body_style, search_field, undefined, true);
|
|
7173
|
+
div_with_field_class.addEventListener("click", (0, $g9l4l$catchify)((e)=>{
|
|
7084
7174
|
const target = e.target;
|
|
7085
7175
|
const sel = ".submit";
|
|
7086
7176
|
if (target?.matches?.(sel) || target?.closest?.(sel)) // the search button is just decor, don't do anything when clicked
|
|
7087
7177
|
return;
|
|
7178
|
+
// When selecting text in the SearchField that's in the page we want the same selection to persist. It doesn't by itself, since the SearchModal has an entirely different SearchField. Therefore, we manually copy the selection over.
|
|
7179
|
+
const selected_text_range_ = [
|
|
7180
|
+
input_element.selectionStart,
|
|
7181
|
+
input_element.selectionEnd
|
|
7182
|
+
];
|
|
7088
7183
|
align_position?.();
|
|
7089
7184
|
open_modal_({
|
|
7090
|
-
style_props_: modal_body_style
|
|
7185
|
+
style_props_: modal_body_style,
|
|
7186
|
+
selected_text_range_: selected_text_range_
|
|
7091
7187
|
}, ()=>include_input_field_?.on_close_?.());
|
|
7092
7188
|
include_input_field_?.on_open_?.();
|
|
7093
7189
|
}));
|
|
@@ -7163,7 +7259,7 @@ function $b76e8f62b1f313ef$export$a54ec244c8863715(opts) {
|
|
|
7163
7259
|
document.createComment("Search page based on Depict SDK"),
|
|
7164
7260
|
(()=>{
|
|
7165
7261
|
const _el$2 = $b76e8f62b1f313ef$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
|
|
7166
|
-
(0, $g9l4l$insert)(_el$3,
|
|
7262
|
+
(0, $g9l4l$insert)(_el$3, search_field, null);
|
|
7167
7263
|
(0, $g9l4l$insert)(_el$3, make_category_suggestion_card_ ? (0, $g9l4l$createComponent)((0, $a406ebe9523f192f$export$b69d0d92862de18b), {
|
|
7168
7264
|
severity_: "error",
|
|
7169
7265
|
message_: "Category suggestions failed",
|
|
@@ -7620,7 +7716,8 @@ function $540e930c58500cbe$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
7620
7716
|
function $540e930c58500cbe$export$316f6f283ae64765({ depict_search: depict_search , modal_dispose_handler: modal_dispose_handler , click_handler: click_handler , aligner_ref: aligner_ref }) {
|
|
7621
7717
|
const shared_properties = $540e930c58500cbe$var$get_shared_properties(depict_search);
|
|
7622
7718
|
return (0, $c7f938ac40924f3b$export$23fca46f3143581f)(()=>{
|
|
7623
|
-
|
|
7719
|
+
let input_element;
|
|
7720
|
+
const search_field = (0, $g9l4l$createComponent)((0, $6ded59a142c93078$export$b94867ecbd698f21), {
|
|
7624
7721
|
get search_query_ () {
|
|
7625
7722
|
return shared_properties.search_query_signal_;
|
|
7626
7723
|
},
|
|
@@ -7637,35 +7734,40 @@ function $540e930c58500cbe$export$316f6f283ae64765({ depict_search: depict_searc
|
|
|
7637
7734
|
return shared_properties.i18n_;
|
|
7638
7735
|
},
|
|
7639
7736
|
disabled_: true,
|
|
7737
|
+
input_field_ref_: (el)=>input_element = el,
|
|
7640
7738
|
field_element_ref_: (field)=>{
|
|
7641
7739
|
const style_props_ = (0, $g9l4l$createSignal)({
|
|
7642
7740
|
position: "fixed"
|
|
7643
7741
|
});
|
|
7644
7742
|
const defaultHandler = (0, $g9l4l$catchify)(()=>{
|
|
7645
|
-
|
|
7743
|
+
// When selecting text in the SearchField that's in the page we want the same selection to persist. It doesn't by itself, since the SearchModal has an entirely different SearchField. Therefore, we manually copy the selection over.
|
|
7744
|
+
const selected_text_range_ = [
|
|
7745
|
+
input_element.selectionStart,
|
|
7746
|
+
input_element.selectionEnd
|
|
7747
|
+
];
|
|
7748
|
+
const { cleanup: cleanup } = $540e930c58500cbe$var$align_field_modal(style_props_, search_field, aligner_ref);
|
|
7646
7749
|
const complete_modal_dispose_handler = ()=>{
|
|
7647
7750
|
modal_dispose_handler?.();
|
|
7648
7751
|
cleanup();
|
|
7649
7752
|
};
|
|
7650
7753
|
depict_search.modal_open = [
|
|
7651
7754
|
{
|
|
7652
|
-
style_props_: style_props_
|
|
7755
|
+
style_props_: style_props_,
|
|
7756
|
+
selected_text_range_: selected_text_range_
|
|
7653
7757
|
},
|
|
7654
7758
|
complete_modal_dispose_handler
|
|
7655
7759
|
];
|
|
7656
7760
|
});
|
|
7657
7761
|
const handler = click_handler ?? defaultHandler;
|
|
7658
7762
|
field.addEventListener("click", handler);
|
|
7659
|
-
(0, $g9l4l$onCleanup)(()=>
|
|
7660
|
-
field.removeEventListener("click", handler);
|
|
7661
|
-
});
|
|
7763
|
+
(0, $g9l4l$onCleanup)(()=>field.removeEventListener("click", handler));
|
|
7662
7764
|
}
|
|
7663
7765
|
});
|
|
7664
7766
|
// We assume this to be an array containing exactly on div in js-ui
|
|
7665
7767
|
return [
|
|
7666
7768
|
(()=>{
|
|
7667
7769
|
const _el$ = $540e930c58500cbe$var$_tmpl$.cloneNode(true);
|
|
7668
|
-
(0, $g9l4l$insert)(_el$,
|
|
7770
|
+
(0, $g9l4l$insert)(_el$, search_field);
|
|
7669
7771
|
return _el$;
|
|
7670
7772
|
})()
|
|
7671
7773
|
];
|
|
@@ -7695,6 +7797,7 @@ function $540e930c58500cbe$var$align_field_modal(style_props_, input, aligner_re
|
|
|
7695
7797
|
|
|
7696
7798
|
|
|
7697
7799
|
|
|
7800
|
+
|
|
7698
7801
|
const $7cbfd6122dbaf087$export$d86a33413558014e = (openModalParams)=>{
|
|
7699
7802
|
const { search: search } = openModalParams;
|
|
7700
7803
|
openModalParams.location ||= "centered";
|
|
@@ -7952,4 +8055,4 @@ class $ba6c9609228edf6b$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
7952
8055
|
(0, $g9l4l$add_to_version_info)("ui", (0, $18bf1d29fb889cca$export$83d89fbfd8236492));
|
|
7953
8056
|
|
|
7954
8057
|
|
|
7955
|
-
export {$e95f1855a5e3864f$export$58e808b1db15d3bc as fetchDepictRecommendations, $ec52ef1e6c117813$export$de035477d6fef996 as QuickLinks, $ec52ef1e6c117813$export$5b7c3ce0ebe51f86 as BreadCrumbs, $6340962f8bafd049$export$b91cec6bdc6b32a1 as CategoryTitle, $9b693ea3ff420de6$export$824dde41348efed1 as embedded_num_products, $80a49d3809ecb080$export$643598a327b5833e as get_categories, $ec52ef1e6c117813$export$f34314aa9505732e as DepictCategory, $ec52ef1e6c117813$export$e2bf8ce7779e827e as CategoryPage, $540e930c58500cbe$export$ac6237957a15b3f0 as DepictSearch, $540e930c58500cbe$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $540e930c58500cbe$export$f2dc7e4e4aa11abb as SearchPage, $540e930c58500cbe$export$316f6f283ae64765 as SearchField, $7cbfd6122dbaf087$export$d86a33413558014e as open_modal_with_alignment, $aaacfac0064e97d9$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $079defea521d5e2a$export$b3ad617e9036868 as align_field, $b4e6a093ae83373b$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $246aa49a8f85c7f3$export$1233ca167bf71f9a as styles_to_valid_css_string, $a1123c5ed9b0ee29$export$fe334901e8bebd57 as disable_scrolling, $a3e81b85527bc866$export$d0596b5cae35ad4 as open_search_with_shift_slash, $972ebf2641490830$export$26df08e242fe83a3 as push_state_with_query_param_value, $3846bb34098c738f$export$e015ed2f2950f2e3 as DepictAPI, $fefe7683325039b3$export$d9f36cf74e24d595 as media_query_to_accessor, $36316d7b4c897a03$export$689e204eadb33baf as setup_fast_leave, $886fa987db4f3805$export$5196e4c01fa56fcb as show_toast, $5178263ed1e394ca$export$469c7af753d08925 as solid_format_price, $a79ffb1cbfbd2a09$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $ba6c9609228edf6b$export$3ccaa27d81dd8556 as PageReplacer, $18bf1d29fb889cca$export$83d89fbfd8236492 as version};
|
|
8058
|
+
export {$e95f1855a5e3864f$export$58e808b1db15d3bc as fetchDepictRecommendations, $ec52ef1e6c117813$export$de035477d6fef996 as QuickLinks, $ec52ef1e6c117813$export$5b7c3ce0ebe51f86 as BreadCrumbs, $6340962f8bafd049$export$b91cec6bdc6b32a1 as CategoryTitle, $9b693ea3ff420de6$export$824dde41348efed1 as embedded_num_products, $80a49d3809ecb080$export$643598a327b5833e as get_categories, $ec52ef1e6c117813$export$f34314aa9505732e as DepictCategory, $ec52ef1e6c117813$export$e2bf8ce7779e827e as CategoryPage, $540e930c58500cbe$export$ac6237957a15b3f0 as DepictSearch, $540e930c58500cbe$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $540e930c58500cbe$export$f2dc7e4e4aa11abb as SearchPage, $540e930c58500cbe$export$316f6f283ae64765 as SearchField, $22d7fd594100c3d0$export$aa14a9f43128f61f as ProductCardError, $7cbfd6122dbaf087$export$d86a33413558014e as open_modal_with_alignment, $aaacfac0064e97d9$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $079defea521d5e2a$export$b3ad617e9036868 as align_field, $b4e6a093ae83373b$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $246aa49a8f85c7f3$export$1233ca167bf71f9a as styles_to_valid_css_string, $a1123c5ed9b0ee29$export$fe334901e8bebd57 as disable_scrolling, $a3e81b85527bc866$export$d0596b5cae35ad4 as open_search_with_shift_slash, $972ebf2641490830$export$26df08e242fe83a3 as push_state_with_query_param_value, $3846bb34098c738f$export$e015ed2f2950f2e3 as DepictAPI, $fefe7683325039b3$export$d9f36cf74e24d595 as media_query_to_accessor, $36316d7b4c897a03$export$689e204eadb33baf as setup_fast_leave, $886fa987db4f3805$export$5196e4c01fa56fcb as show_toast, $5178263ed1e394ca$export$469c7af753d08925 as solid_format_price, $a79ffb1cbfbd2a09$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $ba6c9609228edf6b$export$3ccaa27d81dd8556 as PageReplacer, $18bf1d29fb889cca$export$83d89fbfd8236492 as version};
|