@depict-ai/ui 0.0.64 → 0.0.66
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 +13 -7
- package/dist/main.js +487 -614
- package/dist/module.js +490 -618
- package/dist/typescript_schema/BaseSearchRequest.d.ts +197 -0
- package/dist/typescript_schema/ProductListingQueriesRequest.d.ts +14 -0
- package/dist/typescript_schema/ProductListingQueriesResponse.d.ts +10 -0
- package/dist/typescript_schema/ProductListingRequest.d.ts +221 -0
- package/dist/typescript_schema/ProductListingResponse.d.ts +232 -0
- package/dist/typescript_schema/RecommendResponse.d.ts +15 -0
- package/dist/typescript_schema/SearchRequest.d.ts +213 -0
- package/dist/typescript_schema/SearchResponse.d.ts +192 -0
- package/dist/typescript_schema/SearchSuggestionsRequest.d.ts +18 -0
- package/dist/typescript_schema/SearchSuggestionsResponse.d.ts +182 -0
- package/dist/typescript_schema/TrackV2Request.d.ts +115 -0
- package/package.json +5 -5
- package/dist/moduule.js +0 -7872
package/dist/main.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
var $46MJV$depictaiutilishared = require("@depict-ai/utilishared");
|
|
2
2
|
var $46MJV$solidjsweb = require("solid-js/web");
|
|
3
3
|
var $46MJV$solidjs = require("solid-js");
|
|
4
|
-
var $46MJV$lzstring = require("lz-string");
|
|
5
4
|
|
|
6
5
|
function $parcel$export(e, n, v, s) {
|
|
7
6
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -19,6 +18,7 @@ $parcel$export(module.exports, "DepictSearch", () => $79fbf145b15af988$export$ac
|
|
|
19
18
|
$parcel$export(module.exports, "get_search_query_updating_blocked_signal", () => $79fbf145b15af988$export$bde3eb976dfded9);
|
|
20
19
|
$parcel$export(module.exports, "SearchPage", () => $79fbf145b15af988$export$f2dc7e4e4aa11abb);
|
|
21
20
|
$parcel$export(module.exports, "SearchField", () => $79fbf145b15af988$export$316f6f283ae64765);
|
|
21
|
+
$parcel$export(module.exports, "ProductCardError", () => $99a365f2a6c66061$export$aa14a9f43128f61f);
|
|
22
22
|
$parcel$export(module.exports, "open_modal_with_alignment", () => $9c5a1d57540c06e5$export$d86a33413558014e);
|
|
23
23
|
$parcel$export(module.exports, "DefaultInstantCardPlaceholder", () => $17c49340edfdbb31$export$ee1733d9a8495996);
|
|
24
24
|
$parcel$export(module.exports, "align_field", () => $67b60b572b7b7059$export$b3ad617e9036868);
|
|
@@ -35,7 +35,7 @@ $parcel$export(module.exports, "solid_format_price", () => $5fc9fc23df1591db$exp
|
|
|
35
35
|
$parcel$export(module.exports, "connect_search_field_height_to_aligner_height", () => $246e3e89a097f014$export$828dcdd425fd3231);
|
|
36
36
|
$parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
|
|
37
37
|
$parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
|
|
38
|
-
/*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.
|
|
38
|
+
/*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.66";
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
|
|
@@ -89,16 +89,14 @@ function $1ee6da2465098194$var$history_state_change(signals, entries, state) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
function $
|
|
93
|
-
const state = (0, $1ee6da2465098194$export$e183a13865960371)(
|
|
92
|
+
function $0de081f67b6d15b5$export$9862539c89138352(get_default_values) {
|
|
93
|
+
const state = (0, $1ee6da2465098194$export$e183a13865960371)(get_default_values());
|
|
94
94
|
const reset_state = ()=>{
|
|
95
|
-
const new_defaults =
|
|
95
|
+
const new_defaults = get_default_values();
|
|
96
96
|
for(const key in state){
|
|
97
97
|
const new_value = new_defaults[key];
|
|
98
98
|
state[key][1](new_value);
|
|
99
99
|
}
|
|
100
|
-
set_current_sorting();
|
|
101
|
-
if (get_selected_filters().length > 0) set_selected_filters([]);
|
|
102
100
|
};
|
|
103
101
|
return [
|
|
104
102
|
reset_state,
|
|
@@ -156,8 +154,9 @@ class $9ce64f69303c371e$export$e015ed2f2950f2e3 {
|
|
|
156
154
|
async #cached_post_request(endpoint1, input_req, fallback_response) {
|
|
157
155
|
const cache_obj = this.#get_cache_obj_for_endpoint(endpoint1);
|
|
158
156
|
const with_ids = $9ce64f69303c371e$var$add_ids_to_request(input_req);
|
|
159
|
-
const
|
|
160
|
-
|
|
157
|
+
const metaData = await this.#get_metadata?.();
|
|
158
|
+
const request = metaData ? Object.assign(with_ids, {
|
|
159
|
+
metadata: metaData
|
|
161
160
|
}) : with_ids;
|
|
162
161
|
const body = JSON.stringify((0, $46MJV$depictaiutilishared.sort_obj)(request));
|
|
163
162
|
const response_from_cache = cache_obj.cache_[body]?.deref?.();
|
|
@@ -821,6 +820,55 @@ function $8e863dc22b06b688$export$a2cc176055f8f08() {
|
|
|
821
820
|
}
|
|
822
821
|
|
|
823
822
|
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
830
|
+
class $99a365f2a6c66061$export$e1d52e4f0c7557a1 extends Error {
|
|
831
|
+
}
|
|
832
|
+
class $99a365f2a6c66061$export$aa14a9f43128f61f extends $99a365f2a6c66061$export$e1d52e4f0c7557a1 {
|
|
833
|
+
constructor(templateError){
|
|
834
|
+
super("Uncaught error in product card template", {
|
|
835
|
+
cause: templateError
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
const $0f2f58dd60b11888$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div></div>`, 2);
|
|
842
|
+
function $0f2f58dd60b11888$export$b69d0d92862de18b(props) {
|
|
843
|
+
return (0, $46MJV$solidjs.ErrorBoundary)({
|
|
844
|
+
fallback (err, retry) {
|
|
845
|
+
const { message_: message_ , severity_: severity_ } = props;
|
|
846
|
+
let message = message_;
|
|
847
|
+
if (err instanceof (0, $99a365f2a6c66061$export$aa14a9f43128f61f)) {
|
|
848
|
+
console.error(err.cause);
|
|
849
|
+
message = `${message}: ${err.message}`;
|
|
850
|
+
} else (0, $46MJV$depictaiutilishared.report)([
|
|
851
|
+
err,
|
|
852
|
+
message_
|
|
853
|
+
], severity_);
|
|
854
|
+
props.on_error_?.(retry);
|
|
855
|
+
return (()=>{
|
|
856
|
+
const _el$ = $0f2f58dd60b11888$var$_tmpl$.cloneNode(true);
|
|
857
|
+
(0, $46MJV$solidjsweb.insert)(_el$, message);
|
|
858
|
+
(0, $46MJV$solidjsweb.effect)((_$p)=>(0, $46MJV$solidjsweb.classList)(_el$, Object.fromEntries(props.class_list_?.map((c)=>[
|
|
859
|
+
c,
|
|
860
|
+
true
|
|
861
|
+
]) || []), _$p));
|
|
862
|
+
return _el$;
|
|
863
|
+
})();
|
|
864
|
+
},
|
|
865
|
+
get children () {
|
|
866
|
+
return props.children;
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
|
|
824
872
|
const $8d94abc871e13baf$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="PLP-results"></div>`, 2), $8d94abc871e13baf$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="cards"></div>`, 2);
|
|
825
873
|
let $8d94abc871e13baf$var$cached_placeholder_element;
|
|
826
874
|
function $8d94abc871e13baf$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_ }) {
|
|
@@ -857,8 +905,7 @@ function $8d94abc871e13baf$export$3925f87b1545cfc6({ plp_results_: plp_results_
|
|
|
857
905
|
recs: current_results.displays,
|
|
858
906
|
...rr_options_,
|
|
859
907
|
...typeof rr_options_.template === "function" ? {
|
|
860
|
-
template:
|
|
861
|
-
rr_options_.template(...args))
|
|
908
|
+
template: $8d94abc871e13baf$var$wrap_template_to_throw_into_error_boundary(rr_options_.template, owner_for_cards)
|
|
862
909
|
} : {},
|
|
863
910
|
post_processors: [
|
|
864
911
|
...rr_options_.post_processors || [],
|
|
@@ -903,86 +950,101 @@ function $8d94abc871e13baf$export$3925f87b1545cfc6({ plp_results_: plp_results_
|
|
|
903
950
|
return (0, $46MJV$solidjsweb.createComponent)((0, $2b4e3538e183d885$export$ef6006467f04ee41), no_results_options_);
|
|
904
951
|
},
|
|
905
952
|
get children () {
|
|
906
|
-
return ((
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
plp_results_(); // re-run render_and_insert_results when results change
|
|
951
|
-
render_and_insert_results(cards, owner_);
|
|
952
|
-
}
|
|
953
|
-
}));
|
|
954
|
-
// copied from RecommendationGrid
|
|
955
|
-
// convoluted lazy loading that
|
|
956
|
-
// when the elements are in the DOM starts IntersectionObserver on whole grid
|
|
957
|
-
// when grid intersects starts Lazyfier
|
|
958
|
-
// this is because Lazyfier is fucking stupid
|
|
959
|
-
(0, $46MJV$depictaiutilishared.observer).wait_for_element(cards).then((0, $46MJV$depictaiutilishared.catchify)((element)=>{
|
|
960
|
-
let start_lazy_loading;
|
|
961
|
-
const lazy_loading_promise = new Promise((r)=>start_lazy_loading = r);
|
|
962
|
-
const lf = new (0, $46MJV$depictaiutilishared.Lazyfier)({
|
|
963
|
-
only_load_intersecting: true,
|
|
964
|
-
wait_for_dominsertion: lazy_loading_promise,
|
|
965
|
-
ignore_data_urls: true,
|
|
966
|
-
lazyfinder: {
|
|
967
|
-
unload () {}
|
|
968
|
-
}
|
|
953
|
+
return (0, $0f2f58dd60b11888$export$b69d0d92862de18b)({
|
|
954
|
+
severity_: "error",
|
|
955
|
+
// More granular error handling
|
|
956
|
+
// 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
|
|
957
|
+
on_error_: (retry)=>{
|
|
958
|
+
// re-try / reset ErrorBoundary next time we're getting product cards
|
|
959
|
+
const track = (0, $46MJV$solidjs.createReaction)(retry);
|
|
960
|
+
track(plp_results_);
|
|
961
|
+
},
|
|
962
|
+
class_list_: [
|
|
963
|
+
"cards"
|
|
964
|
+
],
|
|
965
|
+
// So that the styling looks pretty when we've failed
|
|
966
|
+
message_: "Result rendering failed",
|
|
967
|
+
get children () {
|
|
968
|
+
const random_id = (0, $46MJV$depictaiutilishared.make_random_classname)();
|
|
969
|
+
const selector_beginning = `.depict.plp #${random_id}>`;
|
|
970
|
+
const cards = (()=>{
|
|
971
|
+
const _el$2 = $8d94abc871e13baf$var$_tmpl$2.cloneNode(true);
|
|
972
|
+
(0, $46MJV$solidjsweb.setAttribute)(_el$2, "id", random_id);
|
|
973
|
+
return _el$2;
|
|
974
|
+
})();
|
|
975
|
+
const style = document.createElement("style");
|
|
976
|
+
(0, $46MJV$solidjs.createRenderEffect)(()=>{
|
|
977
|
+
// Add grid styling that changes when filters get opened/closed
|
|
978
|
+
const when_filters_closed_cols = layout_options_.cols_at_size;
|
|
979
|
+
const cols_at_size = sort_or_filter_open_() ? when_filters_closed_cols.map((row)=>{
|
|
980
|
+
const [num_cols_default, , , , override_cols] = row;
|
|
981
|
+
const cloned_row = [
|
|
982
|
+
...row
|
|
983
|
+
];
|
|
984
|
+
// @ts-ignore
|
|
985
|
+
cloned_row[0] = num_cols_default - 1;
|
|
986
|
+
if (override_cols) // @ts-ignore
|
|
987
|
+
cloned_row[4] = {
|
|
988
|
+
overrides: Object.fromEntries(Object.entries(override_cols.overrides).map(([row, column])=>[
|
|
989
|
+
row,
|
|
990
|
+
column - 1
|
|
991
|
+
]))
|
|
992
|
+
};
|
|
993
|
+
return cloned_row;
|
|
994
|
+
}) : when_filters_closed_cols;
|
|
995
|
+
const css = (0, $46MJV$depictaiutilishared.n_col_styling_with_dist)(selector_beginning, layout_options_.grid_spacing, cols_at_size, "grid", layout_options_.override_vertical_spacing);
|
|
996
|
+
style.replaceChildren(css);
|
|
969
997
|
});
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
998
|
+
(0, $46MJV$solidjs.createRenderEffect)(// render placeholders / product cards
|
|
999
|
+
(0, $46MJV$depictaiutilishared.catchify)(async ()=>{
|
|
1000
|
+
const owner_ = (0, $46MJV$solidjs.getOwner)();
|
|
1001
|
+
if (is_loading()) await $8d94abc871e13baf$var$insert_placeholders({
|
|
1002
|
+
scroll_restoration_data_: scroll_restoration_data_,
|
|
1003
|
+
id_currently_querying_for_: id_currently_querying_for_,
|
|
1004
|
+
rr_options_: rr_options_,
|
|
1005
|
+
tenant_object_: tenant_object_,
|
|
1006
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
1007
|
+
owner_: owner_,
|
|
1008
|
+
cards_element_: cards
|
|
1009
|
+
});
|
|
1010
|
+
else if (!has_no_results_or_failed()) {
|
|
1011
|
+
plp_results_(); // re-run render_and_insert_results when results change
|
|
1012
|
+
render_and_insert_results(cards, owner_);
|
|
976
1013
|
}
|
|
977
1014
|
}));
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1015
|
+
// copied from RecommendationGrid
|
|
1016
|
+
// convoluted lazy loading that
|
|
1017
|
+
// when the elements are in the DOM starts IntersectionObserver on whole grid
|
|
1018
|
+
// when grid intersects starts Lazyfier
|
|
1019
|
+
// this is because Lazyfier is fucking stupid
|
|
1020
|
+
(0, $46MJV$depictaiutilishared.observer).wait_for_element(cards).then((0, $46MJV$depictaiutilishared.catchify)((element)=>{
|
|
1021
|
+
let start_lazy_loading;
|
|
1022
|
+
const lazy_loading_promise = new Promise((r)=>start_lazy_loading = r);
|
|
1023
|
+
const lf = new (0, $46MJV$depictaiutilishared.Lazyfier)({
|
|
1024
|
+
only_load_intersecting: true,
|
|
1025
|
+
wait_for_dominsertion: lazy_loading_promise,
|
|
1026
|
+
ignore_data_urls: true,
|
|
1027
|
+
lazyfinder: {
|
|
1028
|
+
unload () {}
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
lf.start_observing_for_new_children_(element);
|
|
1032
|
+
const i_o = new IntersectionObserver((0, $46MJV$depictaiutilishared.catchify)((records)=>{
|
|
1033
|
+
for (const record of records)if (record.intersectionRatio > 0) {
|
|
1034
|
+
start_lazy_loading();
|
|
1035
|
+
i_o.disconnect();
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
}));
|
|
1039
|
+
i_o.observe(cards);
|
|
1040
|
+
}));
|
|
1041
|
+
return [
|
|
1042
|
+
(0, $8e863dc22b06b688$export$a2cc176055f8f08)(),
|
|
1043
|
+
cards,
|
|
1044
|
+
style
|
|
1045
|
+
];
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
986
1048
|
}
|
|
987
1049
|
}), null);
|
|
988
1050
|
(0, $46MJV$solidjsweb.insert)(_el$, desktop_filter_elements_, null);
|
|
@@ -999,19 +1061,18 @@ async function $8d94abc871e13baf$var$insert_placeholders({ scroll_restoration_da
|
|
|
999
1061
|
let existing_num = 0;
|
|
1000
1062
|
let removed_old_children = false;
|
|
1001
1063
|
if (!$8d94abc871e13baf$var$cached_placeholder_element) {
|
|
1064
|
+
const [dispose_card, root_in_root] = (0, $46MJV$solidjs.createRoot)((dispose)=>[
|
|
1065
|
+
dispose,
|
|
1066
|
+
(0, $46MJV$solidjs.getOwner)()
|
|
1067
|
+
]);
|
|
1002
1068
|
const { elements: elements } = await (0, $46MJV$depictaiutilishared.default_rr)(tenant_object_, {
|
|
1003
1069
|
...rr_options_,
|
|
1004
1070
|
type: "placeholder",
|
|
1005
1071
|
pre_processors: [],
|
|
1006
1072
|
post_processors: [],
|
|
1007
1073
|
...typeof rr_options_.template === "function" ? {
|
|
1008
|
-
template: (
|
|
1009
|
-
|
|
1010
|
-
return await rr_options_.template(...args);
|
|
1011
|
-
} finally{
|
|
1012
|
-
(0, $46MJV$depictaiutilishared.queueMacroTask)((0, $46MJV$depictaiutilishared.catchify)(dispose)); // we just want it cloned and dead
|
|
1013
|
-
}
|
|
1014
|
-
})
|
|
1074
|
+
template: $8d94abc871e13baf$var$wrap_template_to_throw_into_error_boundary(rr_options_.template, root_in_root, ()=>(0, $46MJV$depictaiutilishared.queueMacroTask)((0, $46MJV$depictaiutilishared.catchify)(dispose_card)) // we just want it cloned and dead
|
|
1075
|
+
)
|
|
1015
1076
|
} : {},
|
|
1016
1077
|
recs: [
|
|
1017
1078
|
{
|
|
@@ -1027,13 +1088,28 @@ async function $8d94abc871e13baf$var$insert_placeholders({ scroll_restoration_da
|
|
|
1027
1088
|
const to_add = num_placeholders() - existing_num;
|
|
1028
1089
|
if (to_add <= 0) return;
|
|
1029
1090
|
// 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.
|
|
1030
|
-
// 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
|
|
1091
|
+
// 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.
|
|
1031
1092
|
cards_element_[removed_old_children ? "append" : (removed_old_children = true, "replaceChildren")](...Array.from({
|
|
1032
1093
|
length: to_add
|
|
1033
1094
|
}).map(()=>$8d94abc871e13baf$var$cached_placeholder_element.cloneNode(true)));
|
|
1034
1095
|
existing_num += to_add;
|
|
1035
1096
|
}));
|
|
1036
1097
|
}
|
|
1098
|
+
function $8d94abc871e13baf$var$wrap_template_to_throw_into_error_boundary(template, root_in_root, on_finally) {
|
|
1099
|
+
return async (...args)=>{
|
|
1100
|
+
try {
|
|
1101
|
+
return await (0, $46MJV$solidjs.runWithOwner)(root_in_root, ()=>template(...args)) || [];
|
|
1102
|
+
} catch (e) {
|
|
1103
|
+
(0, $46MJV$solidjs.runWithOwner)(root_in_root, ()=>{
|
|
1104
|
+
// Throw in case of promise rejection, ultimately into ErrorBoundary
|
|
1105
|
+
throw e;
|
|
1106
|
+
});
|
|
1107
|
+
return [];
|
|
1108
|
+
} finally{
|
|
1109
|
+
on_finally?.();
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1037
1113
|
|
|
1038
1114
|
|
|
1039
1115
|
|
|
@@ -2669,7 +2745,7 @@ function $cd6cdf2099e918a4$export$82ed4b28ecb67608({ filter_: filter_ , selected
|
|
|
2669
2745
|
// lighten or darken (+/- 10) depending on it's over or under 50 lightness
|
|
2670
2746
|
// lighten under 25 lightness by 20
|
|
2671
2747
|
const target_lightness = is_hovered ? is_light ? lightness() - 10 : lightness() < 25 ? lightness() + 20 : lightness() + 10 : lightness();
|
|
2672
|
-
classList.toggle("check-dark",
|
|
2748
|
+
classList.toggle("check-dark", $cd6cdf2099e918a4$var$black_contrast_better(hue(), saturation(), lightness())); // Decide between black/white checkmark based on which one has better contrast according to WCAG contrast guidelines
|
|
2673
2749
|
style.backgroundColor = `hsl(${hue()}, ${saturation()}%, ${target_lightness}%)`;
|
|
2674
2750
|
}
|
|
2675
2751
|
});
|
|
@@ -2766,6 +2842,15 @@ function $cd6cdf2099e918a4$export$82ed4b28ecb67608({ filter_: filter_ , selected
|
|
|
2766
2842
|
return _el$;
|
|
2767
2843
|
})();
|
|
2768
2844
|
}
|
|
2845
|
+
function $cd6cdf2099e918a4$var$black_contrast_better(hue, saturation, lightness) {
|
|
2846
|
+
const as_rgb = (0, $46MJV$depictaiutilishared.hsl_to_rgb)(hue, saturation, lightness);
|
|
2847
|
+
const luminance_color = (0, $46MJV$depictaiutilishared.relative_luminance_from_rgb)(...as_rgb);
|
|
2848
|
+
const luminance_white = 1;
|
|
2849
|
+
const luminance_black = 0;
|
|
2850
|
+
const contrast_ratio_if_white = (luminance_white + 0.05) / (luminance_color + 0.05);
|
|
2851
|
+
const contrast_ratio_if_black = (luminance_color + 0.05) / (luminance_black + 0.05);
|
|
2852
|
+
return contrast_ratio_if_black > contrast_ratio_if_white;
|
|
2853
|
+
}
|
|
2769
2854
|
|
|
2770
2855
|
|
|
2771
2856
|
var $6865c7388a79e957$export$2e2bcd8739ae039 = {
|
|
@@ -2781,6 +2866,156 @@ var $6865c7388a79e957$export$2e2bcd8739ae039 = {
|
|
|
2781
2866
|
|
|
2782
2867
|
|
|
2783
2868
|
|
|
2869
|
+
function $0bc45cf6753f874a$export$b288c38ae3fddb56({ available_filters_: available_filters_ , local_filter_cache_: [read_local_cache, write_local_cache] , selected_filters_: [read_selected_filters] }) {
|
|
2870
|
+
let last_remote_state;
|
|
2871
|
+
(0, $46MJV$solidjs.createComputed)(()=>{
|
|
2872
|
+
const remote_filters = Object.fromEntries(available_filters_()?.map((filter)=>[
|
|
2873
|
+
JSON.stringify([
|
|
2874
|
+
filter.field,
|
|
2875
|
+
filter.op,
|
|
2876
|
+
filter?.meta?.type
|
|
2877
|
+
]),
|
|
2878
|
+
filter
|
|
2879
|
+
]) || []);
|
|
2880
|
+
const local_filters = Object.fromEntries(read_local_cache().map((filter)=>[
|
|
2881
|
+
JSON.stringify([
|
|
2882
|
+
filter.field,
|
|
2883
|
+
filter.op,
|
|
2884
|
+
filter?.meta?.type
|
|
2885
|
+
]),
|
|
2886
|
+
filter
|
|
2887
|
+
]));
|
|
2888
|
+
const selected_filters = Object.fromEntries(read_selected_filters().map((filter_obj)=>[
|
|
2889
|
+
JSON.stringify([
|
|
2890
|
+
filter_obj.field,
|
|
2891
|
+
filter_obj.op
|
|
2892
|
+
]),
|
|
2893
|
+
filter_obj
|
|
2894
|
+
]));
|
|
2895
|
+
const new_local_filter_state = [];
|
|
2896
|
+
// we want to be as close as possible to available_filters_ in local_filters except that we want to keep values from previous available_filters_ as long as they're selected
|
|
2897
|
+
for (const filter_id of [
|
|
2898
|
+
...Object.keys(local_filters).filter((key)=>!(key in remote_filters)),
|
|
2899
|
+
...Object.keys(remote_filters)
|
|
2900
|
+
]){
|
|
2901
|
+
const local_filter = local_filters[filter_id];
|
|
2902
|
+
const remote_filter = remote_filters[filter_id];
|
|
2903
|
+
const filter_id_without_meta_type = JSON.stringify(JSON.parse(filter_id).slice(0, 2));
|
|
2904
|
+
if (!remote_filter) // check if this filter is selected, if it is just take the local one but set counts to 0 and remove non-selected options
|
|
2905
|
+
{
|
|
2906
|
+
if (filter_id_without_meta_type in selected_filters) new_local_filter_state.push($0bc45cf6753f874a$var$modify_only_local_filter(local_filter, selected_filters[filter_id_without_meta_type]));
|
|
2907
|
+
} else if (!local_filter) // just take the remote one
|
|
2908
|
+
new_local_filter_state.push(remote_filter);
|
|
2909
|
+
else {
|
|
2910
|
+
// both exist, merge them if needed
|
|
2911
|
+
const remote_meta = remote_filter.meta;
|
|
2912
|
+
const local_meta = local_filter.meta;
|
|
2913
|
+
const this_applied_filter = selected_filters[filter_id_without_meta_type];
|
|
2914
|
+
if (!remote_meta || !local_meta || !("values" in remote_meta) || !("values" in local_meta) || !Array.isArray(this_applied_filter?.data)) // can't or shouldn't be merged due to not being selected, just take remote one
|
|
2915
|
+
new_local_filter_state.push(remote_filter);
|
|
2916
|
+
else {
|
|
2917
|
+
const data_objs_in_remote = Object.fromEntries(remote_meta.values.map((value, index)=>[
|
|
2918
|
+
JSON.stringify(value),
|
|
2919
|
+
{
|
|
2920
|
+
value_: value,
|
|
2921
|
+
count_: remote_meta.counts?.[index],
|
|
2922
|
+
name_: remote_meta.names?.[index]
|
|
2923
|
+
}
|
|
2924
|
+
]));
|
|
2925
|
+
const data_objs_in_local = Object.fromEntries(local_meta.values.map((value, index)=>[
|
|
2926
|
+
JSON.stringify(value),
|
|
2927
|
+
{
|
|
2928
|
+
value_: value,
|
|
2929
|
+
count_: 0,
|
|
2930
|
+
name_: local_meta.names?.[index]
|
|
2931
|
+
}
|
|
2932
|
+
]));
|
|
2933
|
+
const new_data = [
|
|
2934
|
+
...Object.keys(data_objs_in_local).filter((key)=>{
|
|
2935
|
+
// put data entries that are selected and don't exist in new remote state first
|
|
2936
|
+
if (key in data_objs_in_remote) return false;
|
|
2937
|
+
const selected_values = this_applied_filter.data;
|
|
2938
|
+
return selected_values.some((value)=>{
|
|
2939
|
+
const is_equal = JSON.stringify(value) === key;
|
|
2940
|
+
if (is_equal) return true;
|
|
2941
|
+
if (local_meta.type === remote_meta.type && local_meta.type === "checkbox-hierarchical") {
|
|
2942
|
+
// Very special case for hierarchical checkboxes - when a parent has all kids checked and a kid is deselected, the parent gets deselected. But since if it still has selected children we don't want to remove it from the filter state, even though it isn't selected, as the UI won't know the correct title of the parent category otherwise. This keeps it in that case.
|
|
2943
|
+
const selected_values = data_objs_in_local[key].value_;
|
|
2944
|
+
const values_length = value?.length;
|
|
2945
|
+
if (values_length > 1 && values_length - 1 === selected_values.length) {
|
|
2946
|
+
let is_parent = true;
|
|
2947
|
+
for(let i = 0; i < selected_values.length; i++)if (selected_values[i] !== value[i]) is_parent = false;
|
|
2948
|
+
return is_parent;
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
return false;
|
|
2952
|
+
});
|
|
2953
|
+
}).map((key)=>data_objs_in_local[key]),
|
|
2954
|
+
...Object.values(data_objs_in_remote)
|
|
2955
|
+
];
|
|
2956
|
+
const new_values = new_data.map(({ value_: value_ })=>value_);
|
|
2957
|
+
const result = {
|
|
2958
|
+
...remote_filter,
|
|
2959
|
+
meta: {
|
|
2960
|
+
...remote_filter.meta,
|
|
2961
|
+
values: new_values,
|
|
2962
|
+
names: new_data.map(({ name_: name_ })=>name_),
|
|
2963
|
+
counts: new_data.map(({ count_: count_ })=>count_)
|
|
2964
|
+
}
|
|
2965
|
+
};
|
|
2966
|
+
new_local_filter_state.push(result);
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
if (last_remote_state !== available_filters_() || // we HAVE to update the local filter state (it can contain same info but needs to be different object reference) every time the API state changes, otherwise the CheckboxHierarchicalFilter component doesn't update
|
|
2971
|
+
JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) // Sorry……… They're not that big
|
|
2972
|
+
write_local_cache(new_local_filter_state);
|
|
2973
|
+
last_remote_state = available_filters_();
|
|
2974
|
+
});
|
|
2975
|
+
return read_local_cache;
|
|
2976
|
+
}
|
|
2977
|
+
/**
|
|
2978
|
+
* When a filter is only available locally due to being selected in a previous navigation, we want to make that clear and prevent further "invalid" choices.
|
|
2979
|
+
* This sets the counts to 0 (if applicable) and removes non-selected options (if applicable)
|
|
2980
|
+
*/ function $0bc45cf6753f874a$var$modify_only_local_filter(local_filter_object, selected_filter) {
|
|
2981
|
+
const old_meta = local_filter_object.meta;
|
|
2982
|
+
const selected_filter_data = selected_filter.data;
|
|
2983
|
+
const modified_filter_object = {
|
|
2984
|
+
...local_filter_object
|
|
2985
|
+
};
|
|
2986
|
+
if (old_meta) {
|
|
2987
|
+
const new_meta = {
|
|
2988
|
+
...old_meta
|
|
2989
|
+
};
|
|
2990
|
+
modified_filter_object.meta = new_meta;
|
|
2991
|
+
// set counts to 0
|
|
2992
|
+
if ("counts" in new_meta) {
|
|
2993
|
+
const counts = new_meta.counts;
|
|
2994
|
+
if (counts) new_meta.counts = counts.map(()=>0);
|
|
2995
|
+
}
|
|
2996
|
+
if (Array.isArray(selected_filter_data) && "values" in new_meta) {
|
|
2997
|
+
// we have an array of values and want to strip the ones from the available ones that aren't selected
|
|
2998
|
+
const values = new_meta.values;
|
|
2999
|
+
if (Array.isArray(values)) {
|
|
3000
|
+
const jsond_set_values = selected_filter_data.map((data)=>JSON.stringify(data));
|
|
3001
|
+
const indexes_to_remove = new Set();
|
|
3002
|
+
for(let i = 0; i < values.length; i++){
|
|
3003
|
+
const value = values[i];
|
|
3004
|
+
if (!jsond_set_values.includes(JSON.stringify(value))) // We want to remove the entry with this value from the filter object because it's not selected
|
|
3005
|
+
indexes_to_remove.add(i);
|
|
3006
|
+
}
|
|
3007
|
+
new_meta.values = values.filter((_, index)=>!indexes_to_remove.has(index));
|
|
3008
|
+
if (new_meta.names) new_meta.names = new_meta.names.filter((_, index)=>!indexes_to_remove.has(index));
|
|
3009
|
+
if (new_meta.counts) // remove counts that are too much, they're all zero anyway if they exist
|
|
3010
|
+
new_meta.counts.length -= indexes_to_remove.size;
|
|
3011
|
+
}
|
|
3012
|
+
}
|
|
3013
|
+
}
|
|
3014
|
+
return modified_filter_object;
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
|
|
3018
|
+
|
|
2784
3019
|
|
|
2785
3020
|
|
|
2786
3021
|
|
|
@@ -2897,31 +3132,6 @@ function $5804fd6cbfb7160f$export$ab34afce88557c0e(props) {
|
|
|
2897
3132
|
|
|
2898
3133
|
|
|
2899
3134
|
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
const $0f2f58dd60b11888$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div></div>`, 2);
|
|
2903
|
-
function $0f2f58dd60b11888$export$b69d0d92862de18b(props) {
|
|
2904
|
-
return (0, $46MJV$solidjs.ErrorBoundary)({
|
|
2905
|
-
fallback (err) {
|
|
2906
|
-
const { message_: message_ , severity_: severity_ } = props;
|
|
2907
|
-
(0, $46MJV$depictaiutilishared.report)([
|
|
2908
|
-
err,
|
|
2909
|
-
message_
|
|
2910
|
-
], severity_);
|
|
2911
|
-
return (()=>{
|
|
2912
|
-
const _el$ = $0f2f58dd60b11888$var$_tmpl$.cloneNode(true);
|
|
2913
|
-
(0, $46MJV$solidjsweb.insert)(_el$, message_);
|
|
2914
|
-
return _el$;
|
|
2915
|
-
})();
|
|
2916
|
-
},
|
|
2917
|
-
get children () {
|
|
2918
|
-
return props.children;
|
|
2919
|
-
}
|
|
2920
|
-
});
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
3135
|
const $1587765bd31f3722$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-collapsible"></div>`, 2), $1587765bd31f3722$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<button class="clear-group"><span></span></button>`, 4), $1587765bd31f3722$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="view-more-clear"></div>`, 2), $1587765bd31f3722$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-collapsible-body"><div class="filter-part"></div></div>`, 4), $1587765bd31f3722$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<details class="filter-collapsible"></details>`, 2), $1587765bd31f3722$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<summary class="filter-group-summary"><div class="summary"><span></span><div class="selected-w-sign"></div></div></summary>`, 8), $1587765bd31f3722$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="ungrouped"></div>`, 2), $1587765bd31f3722$var$_tmpl$8 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<button class="clear-all-filters major"></button>`, 2);
|
|
2926
3136
|
function $1587765bd31f3722$export$3f1a388cc0d8fed7(props) {
|
|
2927
3137
|
// Split like this to make placeholder wrapping more visible & this component is exported and used in MobileModal
|
|
@@ -2947,7 +3157,11 @@ function $1587765bd31f3722$export$3f1a388cc0d8fed7(props) {
|
|
|
2947
3157
|
});
|
|
2948
3158
|
}
|
|
2949
3159
|
function $1587765bd31f3722$var$ActualFilterBody(props) {
|
|
2950
|
-
const
|
|
3160
|
+
const modified_available_filters_with_selected_unexisting_ones_injected_from_local_state = (0, $0bc45cf6753f874a$export$b288c38ae3fddb56)({
|
|
3161
|
+
available_filters_: props.available_filters_,
|
|
3162
|
+
selected_filters_: props.selected_filters_,
|
|
3163
|
+
local_filter_cache_: props.local_filter_cache_
|
|
3164
|
+
});
|
|
2951
3165
|
const togglable_filters = (0, $46MJV$solidjs.createMemo)(()=>modified_available_filters_with_selected_unexisting_ones_injected_from_local_state().filter((item)=>item?.meta?.group_title));
|
|
2952
3166
|
const untogglable_filters = (0, $46MJV$solidjs.createMemo)(()=>modified_available_filters_with_selected_unexisting_ones_injected_from_local_state().filter((item)=>!item?.meta?.group_title));
|
|
2953
3167
|
const togglable_filters_grouped_by_collapsible = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
@@ -3148,10 +3362,9 @@ function $1587765bd31f3722$var$ActualFilterBody(props) {
|
|
|
3148
3362
|
|
|
3149
3363
|
|
|
3150
3364
|
const $cc8aaf130b1dc1ea$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="sorting-attributes"></div>`, 2), $cc8aaf130b1dc1ea$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="sorting-direction"></div>`, 2), $cc8aaf130b1dc1ea$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div><div class="input-row"><input type="radio"><span class="custom-indicator"></span></div></div>`, 7), $cc8aaf130b1dc1ea$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div><label class="input-row"><input type="radio"><span class="custom-indicator"></span></label></div>`, 7);
|
|
3151
|
-
function $cc8aaf130b1dc1ea$export$1f1775a58da589b5({ available_sortings_: available_sortings_ , current_sorting_:
|
|
3365
|
+
function $cc8aaf130b1dc1ea$export$1f1775a58da589b5({ available_sortings_: available_sortings_ , current_sorting_: current_sorting_ }) {
|
|
3152
3366
|
const title_radio_name = (0, $46MJV$depictaiutilishared.make_random_classname)();
|
|
3153
3367
|
const order_radio_name = (0, $46MJV$depictaiutilishared.make_random_classname)();
|
|
3154
|
-
const meta_of_currently_selected_sorting = (0, $46MJV$solidjs.createMemo)(()=>available_sortings_()?.find?.((sorting)=>sorting.field === get_current_sorting()?.field)?.meta);
|
|
3155
3368
|
return (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
|
|
3156
3369
|
get when () {
|
|
3157
3370
|
return available_sortings_()?.length;
|
|
@@ -3183,14 +3396,14 @@ function $cc8aaf130b1dc1ea$export$1f1775a58da589b5({ available_sortings_: availa
|
|
|
3183
3396
|
},
|
|
3184
3397
|
children: (item, index)=>{
|
|
3185
3398
|
const is_checked = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
3186
|
-
const sort =
|
|
3399
|
+
const sort = current_sorting_[0]();
|
|
3187
3400
|
if (!sort) // if no sortings are selected, "select" first sort
|
|
3188
3401
|
return index === 0;
|
|
3189
3402
|
return sort.field === item().field && (sort.order === item().order || item().meta.values?.length > 1);
|
|
3190
3403
|
});
|
|
3191
3404
|
return /* wrapping div for flex gap polyfill scss mixin */ (()=>{
|
|
3192
3405
|
const _el$8 = $cc8aaf130b1dc1ea$var$_tmpl$4.cloneNode(true), _el$9 = _el$8.firstChild, _el$10 = _el$9.firstChild, _el$11 = _el$10.nextSibling;
|
|
3193
|
-
(0, $46MJV$solidjsweb.addEventListener)(_el$10, "change", (0, $46MJV$depictaiutilishared.catchify)(()=>
|
|
3406
|
+
(0, $46MJV$solidjsweb.addEventListener)(_el$10, "change", (0, $46MJV$depictaiutilishared.catchify)(()=>current_sorting_[1](item())));
|
|
3194
3407
|
(0, $46MJV$solidjsweb.setAttribute)(_el$10, "name", title_radio_name);
|
|
3195
3408
|
(0, $46MJV$solidjsweb.insert)(_el$9, ()=>item().meta.title, null);
|
|
3196
3409
|
(0, $46MJV$solidjsweb.effect)(()=>_el$10.checked = is_checked());
|
|
@@ -3202,25 +3415,27 @@ function $cc8aaf130b1dc1ea$export$1f1775a58da589b5({ available_sortings_: availa
|
|
|
3202
3415
|
})(),
|
|
3203
3416
|
(0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
|
|
3204
3417
|
get when () {
|
|
3205
|
-
return
|
|
3418
|
+
return current_sorting_[0]()?.meta?.values?.length > 1;
|
|
3206
3419
|
},
|
|
3207
3420
|
get children () {
|
|
3208
3421
|
const _el$2 = $cc8aaf130b1dc1ea$var$_tmpl$2.cloneNode(true);
|
|
3209
3422
|
(0, $46MJV$solidjsweb.insert)(_el$2, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Index), {
|
|
3210
3423
|
get each () {
|
|
3211
|
-
return
|
|
3424
|
+
return current_sorting_[0]().meta.values;
|
|
3212
3425
|
},
|
|
3213
3426
|
children: (order_value, index)=>{
|
|
3214
|
-
const is_checked = (0, $46MJV$solidjs.createMemo)(()=>get_current_sorting()?.order === order_value());
|
|
3215
3427
|
return (()=>{
|
|
3216
3428
|
const _el$12 = $cc8aaf130b1dc1ea$var$_tmpl$4.cloneNode(true), _el$13 = _el$12.firstChild, _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling;
|
|
3217
|
-
(0, $46MJV$solidjsweb.addEventListener)(_el$14, "change", (0, $46MJV$depictaiutilishared.catchify)(()=>
|
|
3429
|
+
(0, $46MJV$solidjsweb.addEventListener)(_el$14, "change", (0, $46MJV$depictaiutilishared.catchify)(()=>current_sorting_[1]((c)=>c && {
|
|
3218
3430
|
...c,
|
|
3219
3431
|
order: order_value()
|
|
3220
3432
|
})));
|
|
3221
3433
|
(0, $46MJV$solidjsweb.setAttribute)(_el$14, "name", order_radio_name);
|
|
3222
|
-
(0, $46MJV$solidjsweb.insert)(_el$13, ()=>
|
|
3223
|
-
(0, $46MJV$solidjsweb.effect)(()=>_el$14.checked =
|
|
3434
|
+
(0, $46MJV$solidjsweb.insert)(_el$13, ()=>current_sorting_[0]()?.meta?.names?.[index], null);
|
|
3435
|
+
(0, $46MJV$solidjsweb.effect)(()=>_el$14.checked = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
3436
|
+
const sort = current_sorting_[0]();
|
|
3437
|
+
return sort?.order === order_value();
|
|
3438
|
+
})());
|
|
3224
3439
|
return _el$12;
|
|
3225
3440
|
})();
|
|
3226
3441
|
}
|
|
@@ -3565,167 +3780,12 @@ function $66ddbcbc40487f95$export$9bf11afa910f536e({ args_for_sorting_: args_for
|
|
|
3565
3780
|
|
|
3566
3781
|
|
|
3567
3782
|
|
|
3568
|
-
|
|
3569
|
-
function $0bc45cf6753f874a$export$b288c38ae3fddb56({ available_filters_: available_filters_ , local_filter_cache_: [read_local_cache, write_local_cache] , selected_filters_: [read_selected_filters] }) {
|
|
3570
|
-
let last_remote_state;
|
|
3571
|
-
(0, $46MJV$solidjs.createComputed)(()=>{
|
|
3572
|
-
const remote_filters = Object.fromEntries(available_filters_()?.map((filter)=>[
|
|
3573
|
-
JSON.stringify([
|
|
3574
|
-
filter.field,
|
|
3575
|
-
filter.op,
|
|
3576
|
-
filter?.meta?.type
|
|
3577
|
-
]),
|
|
3578
|
-
filter
|
|
3579
|
-
]) || []);
|
|
3580
|
-
const local_filters = Object.fromEntries(read_local_cache().map((filter)=>[
|
|
3581
|
-
JSON.stringify([
|
|
3582
|
-
filter.field,
|
|
3583
|
-
filter.op,
|
|
3584
|
-
filter?.meta?.type
|
|
3585
|
-
]),
|
|
3586
|
-
filter
|
|
3587
|
-
]));
|
|
3588
|
-
const selected_filters = Object.fromEntries(read_selected_filters().map((filter_obj)=>[
|
|
3589
|
-
JSON.stringify([
|
|
3590
|
-
filter_obj.field,
|
|
3591
|
-
filter_obj.op
|
|
3592
|
-
]),
|
|
3593
|
-
filter_obj
|
|
3594
|
-
]));
|
|
3595
|
-
const new_local_filter_state = [];
|
|
3596
|
-
// we want to be as close as possible to available_filters_ in local_filters except that we want to keep values from previous available_filters_ as long as they're selected
|
|
3597
|
-
for (const filter_id of [
|
|
3598
|
-
...Object.keys(local_filters).filter((key)=>!(key in remote_filters)),
|
|
3599
|
-
...Object.keys(remote_filters)
|
|
3600
|
-
]){
|
|
3601
|
-
const local_filter = local_filters[filter_id];
|
|
3602
|
-
const remote_filter = remote_filters[filter_id];
|
|
3603
|
-
const filter_id_without_meta_type = JSON.stringify(JSON.parse(filter_id).slice(0, 2));
|
|
3604
|
-
if (!remote_filter) // check if this filter is selected, if it is just take the local one but set counts to 0 and remove non-selected options
|
|
3605
|
-
{
|
|
3606
|
-
if (filter_id_without_meta_type in selected_filters) new_local_filter_state.push($0bc45cf6753f874a$var$modify_only_local_filter(local_filter, selected_filters[filter_id_without_meta_type]));
|
|
3607
|
-
} else if (!local_filter) // just take the remote one
|
|
3608
|
-
new_local_filter_state.push(remote_filter);
|
|
3609
|
-
else {
|
|
3610
|
-
// both exist, merge them if needed
|
|
3611
|
-
const remote_meta = remote_filter.meta;
|
|
3612
|
-
const local_meta = local_filter.meta;
|
|
3613
|
-
const this_applied_filter = selected_filters[filter_id_without_meta_type];
|
|
3614
|
-
if (!remote_meta || !local_meta || !("values" in remote_meta) || !("values" in local_meta) || !Array.isArray(this_applied_filter?.data)) // can't or shouldn't be merged due to not being selected, just take remote one
|
|
3615
|
-
new_local_filter_state.push(remote_filter);
|
|
3616
|
-
else {
|
|
3617
|
-
const data_objs_in_remote = Object.fromEntries(remote_meta.values.map((value, index)=>[
|
|
3618
|
-
JSON.stringify(value),
|
|
3619
|
-
{
|
|
3620
|
-
value_: value,
|
|
3621
|
-
count_: remote_meta.counts?.[index],
|
|
3622
|
-
name_: remote_meta.names?.[index]
|
|
3623
|
-
}
|
|
3624
|
-
]));
|
|
3625
|
-
const data_objs_in_local = Object.fromEntries(local_meta.values.map((value, index)=>[
|
|
3626
|
-
JSON.stringify(value),
|
|
3627
|
-
{
|
|
3628
|
-
value_: value,
|
|
3629
|
-
count_: 0,
|
|
3630
|
-
name_: local_meta.names?.[index]
|
|
3631
|
-
}
|
|
3632
|
-
]));
|
|
3633
|
-
const new_data = [
|
|
3634
|
-
...Object.keys(data_objs_in_local).filter((key)=>{
|
|
3635
|
-
// put data entries that are selected and don't exist in new remote state first
|
|
3636
|
-
if (key in data_objs_in_remote) return false;
|
|
3637
|
-
const selected_values = this_applied_filter.data;
|
|
3638
|
-
return selected_values.some((value)=>{
|
|
3639
|
-
const is_equal = JSON.stringify(value) === key;
|
|
3640
|
-
if (is_equal) return true;
|
|
3641
|
-
if (local_meta.type === remote_meta.type && local_meta.type === "checkbox-hierarchical") {
|
|
3642
|
-
// Very special case for hierarchical checkboxes - when a parent has all kids checked and a kid is deselected, the parent gets deselected. But since if it still has selected children we don't want to remove it from the filter state, even though it isn't selected, as the UI won't know the correct title of the parent category otherwise. This keeps it in that case.
|
|
3643
|
-
const selected_values = data_objs_in_local[key].value_;
|
|
3644
|
-
const values_length = value?.length;
|
|
3645
|
-
if (values_length > 1 && values_length - 1 === selected_values.length) {
|
|
3646
|
-
let is_parent = true;
|
|
3647
|
-
for(let i = 0; i < selected_values.length; i++)if (selected_values[i] !== value[i]) is_parent = false;
|
|
3648
|
-
return is_parent;
|
|
3649
|
-
}
|
|
3650
|
-
}
|
|
3651
|
-
return false;
|
|
3652
|
-
});
|
|
3653
|
-
}).map((key)=>data_objs_in_local[key]),
|
|
3654
|
-
...Object.values(data_objs_in_remote)
|
|
3655
|
-
];
|
|
3656
|
-
const new_values = new_data.map(({ value_: value_ })=>value_);
|
|
3657
|
-
const result = {
|
|
3658
|
-
...remote_filter,
|
|
3659
|
-
meta: {
|
|
3660
|
-
...remote_filter.meta,
|
|
3661
|
-
values: new_values,
|
|
3662
|
-
names: new_data.map(({ name_: name_ })=>name_),
|
|
3663
|
-
counts: new_data.map(({ count_: count_ })=>count_)
|
|
3664
|
-
}
|
|
3665
|
-
};
|
|
3666
|
-
new_local_filter_state.push(result);
|
|
3667
|
-
}
|
|
3668
|
-
}
|
|
3669
|
-
}
|
|
3670
|
-
if (last_remote_state !== available_filters_() || // we HAVE to update the local filter state (it can contain same info but needs to be different object reference) every time the API state changes, otherwise the CheckboxHierarchicalFilter component doesn't update
|
|
3671
|
-
JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) // Sorry……… They're not that big
|
|
3672
|
-
write_local_cache(new_local_filter_state);
|
|
3673
|
-
last_remote_state = available_filters_();
|
|
3674
|
-
});
|
|
3675
|
-
}
|
|
3676
|
-
/**
|
|
3677
|
-
* When a filter is only available locally due to being selected in a previous navigation, we want to make that clear and prevent further "invalid" choices.
|
|
3678
|
-
* This sets the counts to 0 (if applicable) and removes non-selected options (if applicable)
|
|
3679
|
-
*/ function $0bc45cf6753f874a$var$modify_only_local_filter(local_filter_object, selected_filter) {
|
|
3680
|
-
const old_meta = local_filter_object.meta;
|
|
3681
|
-
const selected_filter_data = selected_filter.data;
|
|
3682
|
-
const modified_filter_object = {
|
|
3683
|
-
...local_filter_object
|
|
3684
|
-
};
|
|
3685
|
-
if (old_meta) {
|
|
3686
|
-
const new_meta = {
|
|
3687
|
-
...old_meta
|
|
3688
|
-
};
|
|
3689
|
-
modified_filter_object.meta = new_meta;
|
|
3690
|
-
// set counts to 0
|
|
3691
|
-
if ("counts" in new_meta) {
|
|
3692
|
-
const counts = new_meta.counts;
|
|
3693
|
-
if (counts) new_meta.counts = counts.map(()=>0);
|
|
3694
|
-
}
|
|
3695
|
-
if (Array.isArray(selected_filter_data) && "values" in new_meta) {
|
|
3696
|
-
// we have an array of values and want to strip the ones from the available ones that aren't selected
|
|
3697
|
-
const values = new_meta.values;
|
|
3698
|
-
if (Array.isArray(values)) {
|
|
3699
|
-
const jsond_set_values = selected_filter_data.map((data)=>JSON.stringify(data));
|
|
3700
|
-
const indexes_to_remove = new Set();
|
|
3701
|
-
for(let i = 0; i < values.length; i++){
|
|
3702
|
-
const value = values[i];
|
|
3703
|
-
if (!jsond_set_values.includes(JSON.stringify(value))) // We want to remove the entry with this value from the filter object because it's not selected
|
|
3704
|
-
indexes_to_remove.add(i);
|
|
3705
|
-
}
|
|
3706
|
-
new_meta.values = values.filter((_, index)=>!indexes_to_remove.has(index));
|
|
3707
|
-
if (new_meta.names) new_meta.names = new_meta.names.filter((_, index)=>!indexes_to_remove.has(index));
|
|
3708
|
-
if (new_meta.counts) // remove counts that are too much, they're all zero anyway if they exist
|
|
3709
|
-
new_meta.counts.length -= indexes_to_remove.size;
|
|
3710
|
-
}
|
|
3711
|
-
}
|
|
3712
|
-
}
|
|
3713
|
-
return modified_filter_object;
|
|
3714
|
-
}
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
3783
|
const $881cb1745bafff7a$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filters"><div class="body"></div></div>`, 4), $881cb1745bafff7a$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="sorting"><div class="body"></div></div>`, 4), $881cb1745bafff7a$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="sort-and-filter-buttons"><div class="outer"><div class="inner"></div></div></div>`, 6), $881cb1745bafff7a$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="num-filters"></span>`, 2), $881cb1745bafff7a$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="open-filters-button-container"><button class="filter toggle-button major-minor-transition" type="button"><span></span></button></div>`, 6), $881cb1745bafff7a$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<button class="toggle-button for-sorting major-minor-transition"><span></span></button>`, 4);
|
|
3718
3784
|
function $881cb1745bafff7a$export$d7841e452f2e59a8({ current_sorting_: current_sorting_ , set_extra_els_in_results_container_: set_extra_els_in_results_container_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , set_sort_or_filter_open_: set_sort_or_filter_open_ , i18n_: i18n_ , available_sortings_: available_sortings_ , available_filters_: available_filters_ , expanded_filters_: expanded_filters_ , middle_elements_: middle_elements_ , input_modal_open_: input_modal_open_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_ , set_sort_and_filter_element_: set_sort_and_filter_element_ , formatted_number_of_results_: formatted_number_of_results_ , filter_button_width_: filter_button_width_ , sort_button_width_: sort_button_width_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , get_extra_filters_button_: get_extra_filters_button_ , get_extra_sorting_button_: get_extra_sorting_button_ }) {
|
|
3719
3785
|
return (0, $0f2f58dd60b11888$export$b69d0d92862de18b)({
|
|
3720
3786
|
severity_: "error",
|
|
3721
3787
|
message_: "Sorting and filters failed",
|
|
3722
3788
|
get children () {
|
|
3723
|
-
// This could technically be in SearchPage and CategoryPage and would be better suited there since it writes into local_filter_cache_ which i.e. SelectedFilters uses, but it's better suited here IMO due to DRY and being inside the correct error boundary here
|
|
3724
|
-
(0, $0bc45cf6753f874a$export$b288c38ae3fddb56)({
|
|
3725
|
-
available_filters_: available_filters_,
|
|
3726
|
-
selected_filters_: selected_filters_,
|
|
3727
|
-
local_filter_cache_: local_filter_cache_
|
|
3728
|
-
});
|
|
3729
3789
|
const cleanup_promise = new Promise((r)=>(0, $46MJV$solidjs.onCleanup)(r));
|
|
3730
3790
|
const [filters_open, set_filters_open] = search_filters_open_;
|
|
3731
3791
|
const [sorting_open, set_sorting_open] = search_sorting_open_;
|
|
@@ -4096,166 +4156,6 @@ function $fd64465f894d1f29$var$ActualFloatingButtons({ search_filters_open_: [ge
|
|
|
4096
4156
|
|
|
4097
4157
|
|
|
4098
4158
|
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
const $49bdb822440abcec$var$operator_map = {
|
|
4104
|
-
"eq": "≡",
|
|
4105
|
-
"neq": "≠",
|
|
4106
|
-
"in": "∈",
|
|
4107
|
-
"nin": "∉",
|
|
4108
|
-
"leq": "≤",
|
|
4109
|
-
"geq": "≥",
|
|
4110
|
-
"inrange": "\uD83D\uDD22"
|
|
4111
|
-
};
|
|
4112
|
-
const $49bdb822440abcec$var$ascending_token = "\uD83D\uDCC8";
|
|
4113
|
-
const $49bdb822440abcec$var$descending_token = "\uD83D\uDCC9";
|
|
4114
|
-
const $49bdb822440abcec$export$4f506378e99f23dd = "filter_";
|
|
4115
|
-
const $49bdb822440abcec$export$196aa1ee621a9930 = "sorting";
|
|
4116
|
-
const $49bdb822440abcec$var$range_delimiter = "-";
|
|
4117
|
-
function $49bdb822440abcec$export$7bcff1eb3eca57d7() {
|
|
4118
|
-
const current_sorting_ = (0, $46MJV$solidjs.createSignal)();
|
|
4119
|
-
const selected_filters_ = (0, $46MJV$solidjs.createSignal)([]);
|
|
4120
|
-
const [get_sorting, set_sorting] = current_sorting_;
|
|
4121
|
-
const [get_selected_filters, set_selected_filters] = selected_filters_;
|
|
4122
|
-
const [get_current_href, set_current_href] = (0, $46MJV$solidjs.createSignal)(location.href);
|
|
4123
|
-
const history_change_handler = ()=>set_current_href(location.href);
|
|
4124
|
-
let writer_started = false;
|
|
4125
|
-
(0, $46MJV$depictaiutilishared.instant_exec_on_suspect_history_change).add(history_change_handler);
|
|
4126
|
-
(0, $46MJV$solidjs.onCleanup)(()=>(0, $46MJV$depictaiutilishared.instant_exec_on_suspect_history_change).delete(history_change_handler));
|
|
4127
|
-
(0, $46MJV$solidjs.createComputed)(()=>{
|
|
4128
|
-
const { searchParams: searchParams } = new URL(get_current_href());
|
|
4129
|
-
const sorting = searchParams.get($49bdb822440abcec$export$196aa1ee621a9930);
|
|
4130
|
-
(0, $46MJV$solidjs.batch)(()=>{
|
|
4131
|
-
set_sorting: {
|
|
4132
|
-
if (!sorting) {
|
|
4133
|
-
set_sorting();
|
|
4134
|
-
break set_sorting;
|
|
4135
|
-
}
|
|
4136
|
-
let target_field;
|
|
4137
|
-
let target_order;
|
|
4138
|
-
if (sorting.endsWith($49bdb822440abcec$var$ascending_token)) {
|
|
4139
|
-
target_field = sorting.slice(0, -$49bdb822440abcec$var$ascending_token.length);
|
|
4140
|
-
target_order = "asc";
|
|
4141
|
-
} else if (sorting.endsWith($49bdb822440abcec$var$descending_token)) {
|
|
4142
|
-
target_field = sorting.slice(0, -$49bdb822440abcec$var$descending_token.length);
|
|
4143
|
-
target_order = "desc";
|
|
4144
|
-
} else {
|
|
4145
|
-
(0, $46MJV$depictaiutilishared.dlog)("Invalid sorting query param value", sorting);
|
|
4146
|
-
break set_sorting;
|
|
4147
|
-
}
|
|
4148
|
-
const current_sorting = (0, $46MJV$solidjs.untrack)(get_sorting);
|
|
4149
|
-
// Do some diffing since we might assume in certain places of the code that if the signal changes it means the sorting has changed
|
|
4150
|
-
if (current_sorting?.field !== target_field || current_sorting?.order !== target_order) set_sorting({
|
|
4151
|
-
field: target_field,
|
|
4152
|
-
order: target_order
|
|
4153
|
-
});
|
|
4154
|
-
}
|
|
4155
|
-
const found_filters = [];
|
|
4156
|
-
for (const key of searchParams.keys()){
|
|
4157
|
-
if (!key.startsWith($49bdb822440abcec$export$4f506378e99f23dd)) continue;
|
|
4158
|
-
for (const op of Object.keys($49bdb822440abcec$var$operator_map)){
|
|
4159
|
-
const token = $49bdb822440abcec$var$operator_map[op];
|
|
4160
|
-
if (!key.endsWith(token)) continue;
|
|
4161
|
-
const field = key.slice($49bdb822440abcec$export$4f506378e99f23dd.length, -token.length);
|
|
4162
|
-
const data = searchParams.get(key);
|
|
4163
|
-
if (data) {
|
|
4164
|
-
let parsed_data;
|
|
4165
|
-
if (op === "inrange") parsed_data = data.split($49bdb822440abcec$var$range_delimiter).map((x)=>parseFloat(x));
|
|
4166
|
-
else if (data === "1") parsed_data = "true";
|
|
4167
|
-
else if (data === "0") parsed_data = "false";
|
|
4168
|
-
else try {
|
|
4169
|
-
parsed_data = JSON.parse((0, $46MJV$lzstring.decompressFromBase64)(data));
|
|
4170
|
-
} catch (e) {
|
|
4171
|
-
(0, $46MJV$depictaiutilishared.dlog)("Failed to parse filter data", key, data, e);
|
|
4172
|
-
continue;
|
|
4173
|
-
}
|
|
4174
|
-
found_filters.push({
|
|
4175
|
-
field: field,
|
|
4176
|
-
op: op,
|
|
4177
|
-
data: parsed_data
|
|
4178
|
-
});
|
|
4179
|
-
}
|
|
4180
|
-
}
|
|
4181
|
-
}
|
|
4182
|
-
const selected_filters = (0, $46MJV$solidjs.untrack)(get_selected_filters);
|
|
4183
|
-
const found_filters_map = new Map(found_filters.map(({ field: field , op: op , data: data })=>[
|
|
4184
|
-
JSON.stringify([
|
|
4185
|
-
field,
|
|
4186
|
-
op
|
|
4187
|
-
]),
|
|
4188
|
-
data
|
|
4189
|
-
]));
|
|
4190
|
-
// Sorry for this diffing algorithm lol. Looking forwards to Records and Tuples.
|
|
4191
|
-
if (selected_filters.length !== found_filters.length || !selected_filters.every(({ field: field , op: op , data: data })=>JSON.stringify(found_filters_map.get(JSON.stringify([
|
|
4192
|
-
field,
|
|
4193
|
-
op
|
|
4194
|
-
]))) === JSON.stringify(data))) set_selected_filters(found_filters);
|
|
4195
|
-
if (!writer_started) {
|
|
4196
|
-
$49bdb822440abcec$var$start_href_writer(get_sorting, get_selected_filters);
|
|
4197
|
-
writer_started = true;
|
|
4198
|
-
}
|
|
4199
|
-
});
|
|
4200
|
-
});
|
|
4201
|
-
return {
|
|
4202
|
-
current_sorting_: current_sorting_,
|
|
4203
|
-
selected_filters_: selected_filters_
|
|
4204
|
-
};
|
|
4205
|
-
}
|
|
4206
|
-
function $49bdb822440abcec$var$start_href_writer(get_sorting, get_selected_filters) {
|
|
4207
|
-
// This has to be a createComputed because there can be some kind of URL query bouncing back and forwards otherwise (observed when clearing filters by making a new search)
|
|
4208
|
-
(0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)([
|
|
4209
|
-
get_sorting,
|
|
4210
|
-
get_selected_filters
|
|
4211
|
-
], ([sorting, filters])=>{
|
|
4212
|
-
const current_href = location.href;
|
|
4213
|
-
const url_object = new URL(current_href);
|
|
4214
|
-
const { searchParams: searchParams } = url_object;
|
|
4215
|
-
const keys = [
|
|
4216
|
-
...searchParams.keys()
|
|
4217
|
-
]; // get keys here to be able to iterate over it later while modifying the search params
|
|
4218
|
-
if (sorting) {
|
|
4219
|
-
const { field: field , order: order } = sorting;
|
|
4220
|
-
const ascending = order === "asc";
|
|
4221
|
-
searchParams.set($49bdb822440abcec$export$196aa1ee621a9930, field + (ascending ? $49bdb822440abcec$var$ascending_token : $49bdb822440abcec$var$descending_token));
|
|
4222
|
-
} else searchParams.delete($49bdb822440abcec$export$196aa1ee621a9930);
|
|
4223
|
-
for (const key of keys)if (key.startsWith($49bdb822440abcec$export$4f506378e99f23dd)) searchParams.delete(key);
|
|
4224
|
-
for (const filter of filters){
|
|
4225
|
-
const { field: field , op: op , data: data } = filter;
|
|
4226
|
-
let value;
|
|
4227
|
-
if (op === "inrange" && Array.isArray(data)) value = data.join($49bdb822440abcec$var$range_delimiter);
|
|
4228
|
-
else if (data === "true") value = "1";
|
|
4229
|
-
else if (data === "false") value = "0";
|
|
4230
|
-
else value = (0, $46MJV$lzstring.compressToBase64)(JSON.stringify(data));
|
|
4231
|
-
searchParams.set($49bdb822440abcec$export$4f506378e99f23dd + field + $49bdb822440abcec$var$operator_map[op], value);
|
|
4232
|
-
}
|
|
4233
|
-
// We can't just check if the URL is equal since sometimes the order of the parameters in the URL changes (randomly?) so we need to compare them one by one
|
|
4234
|
-
const unmodified_search_params = [
|
|
4235
|
-
...new URL(current_href).searchParams
|
|
4236
|
-
];
|
|
4237
|
-
const new_search_params = new Map(searchParams);
|
|
4238
|
-
if (unmodified_search_params.length !== new_search_params.size || !unmodified_search_params.every(([key, value])=>new_search_params.get(key) === value)) // Only update URL if it actually changed
|
|
4239
|
-
history.replaceState({}, "", url_object.href);
|
|
4240
|
-
}, {
|
|
4241
|
-
defer: true
|
|
4242
|
-
}));
|
|
4243
|
-
}
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
function $88b2d66be18220f6$export$bca5a41ac5ef1190(url) {
|
|
4247
|
-
if (!url) return url;
|
|
4248
|
-
const got_u_o = url instanceof URL;
|
|
4249
|
-
const u_o = got_u_o ? url : new URL(url);
|
|
4250
|
-
const { searchParams: searchParams } = u_o;
|
|
4251
|
-
const current_search_params = new URLSearchParams(location.search);
|
|
4252
|
-
if (current_search_params.has((0, $49bdb822440abcec$export$196aa1ee621a9930))) searchParams.set((0, $49bdb822440abcec$export$196aa1ee621a9930), current_search_params.get((0, $49bdb822440abcec$export$196aa1ee621a9930)));
|
|
4253
|
-
for (const key of current_search_params.keys())if (key.startsWith((0, $49bdb822440abcec$export$4f506378e99f23dd))) searchParams.set(key, current_search_params.get(key));
|
|
4254
|
-
if (got_u_o) return u_o;
|
|
4255
|
-
return u_o.href;
|
|
4256
|
-
}
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
4159
|
const $495e9998757c5d32$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<nav class="crumbs"></nav>`, 2), $495e9998757c5d32$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<a class="crumb"></a>`, 2), $495e9998757c5d32$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="separator"></span>`, 2);
|
|
4260
4160
|
function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_data , on_crumb_click_: on_crumb_click_ , i18n_: i18n_ }) {
|
|
4261
4161
|
const placeholder_crumb_data = [
|
|
@@ -4273,20 +4173,11 @@ function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4273
4173
|
get each () {
|
|
4274
4174
|
return crumb_data();
|
|
4275
4175
|
},
|
|
4276
|
-
children: (
|
|
4277
|
-
const modified_display_accessor = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
4278
|
-
const value = unmodified_display_accessor();
|
|
4279
|
-
if (!value) return value;
|
|
4280
|
-
return {
|
|
4281
|
-
...value,
|
|
4282
|
-
// We don't want these links to delete the sort and filter state by default, only if `clear_filters_when_going_sideways` explicitly clears them
|
|
4283
|
-
page_url: (0, $88b2d66be18220f6$export$bca5a41ac5ef1190)(value.page_url)
|
|
4284
|
-
};
|
|
4285
|
-
});
|
|
4176
|
+
children: (display_accessor, index)=>{
|
|
4286
4177
|
return [
|
|
4287
4178
|
(0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
|
|
4288
4179
|
get when () {
|
|
4289
|
-
return
|
|
4180
|
+
return display_accessor();
|
|
4290
4181
|
},
|
|
4291
4182
|
get fallback () {
|
|
4292
4183
|
return (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$depictaiutilishared.Placeholder), {
|
|
@@ -4296,9 +4187,9 @@ function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4296
4187
|
},
|
|
4297
4188
|
get children () {
|
|
4298
4189
|
const _el$2 = $495e9998757c5d32$var$_tmpl$2.cloneNode(true);
|
|
4299
|
-
(0, $46MJV$solidjsweb.addEventListener)(_el$2, "click", (0, $46MJV$depictaiutilishared.catchify)((ev)=>on_crumb_click_(ev,
|
|
4300
|
-
(0, $46MJV$solidjsweb.insert)(_el$2, ()=>
|
|
4301
|
-
(0, $46MJV$solidjsweb.effect)(()=>(0, $46MJV$solidjsweb.setAttribute)(_el$2, "href",
|
|
4190
|
+
(0, $46MJV$solidjsweb.addEventListener)(_el$2, "click", (0, $46MJV$depictaiutilishared.catchify)((ev)=>on_crumb_click_(ev, display_accessor())), true);
|
|
4191
|
+
(0, $46MJV$solidjsweb.insert)(_el$2, ()=>display_accessor().title);
|
|
4192
|
+
(0, $46MJV$solidjsweb.effect)(()=>(0, $46MJV$solidjsweb.setAttribute)(_el$2, "href", display_accessor().page_url));
|
|
4302
4193
|
return _el$2;
|
|
4303
4194
|
}
|
|
4304
4195
|
}),
|
|
@@ -4335,9 +4226,7 @@ function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4335
4226
|
|
|
4336
4227
|
|
|
4337
4228
|
|
|
4338
|
-
|
|
4339
4229
|
const $cdc2c00c0a7da86e$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<nav class="quicklinks"></nav>`, 2), $cdc2c00c0a7da86e$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div>QuickLinks failed</div>`, 2), $cdc2c00c0a7da86e$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<a class="quicklink"></a>`, 2);
|
|
4340
|
-
const $cdc2c00c0a7da86e$export$e2cf3f19dd3f8aac = "went_sideways_clear_filters";
|
|
4341
4230
|
function $cdc2c00c0a7da86e$export$466cdc317043f6cb({ quicklinks_data_: quicklinks_data_ , on_link_click_: on_link_click_ , current_query_id_: current_query_id_ , slider_arrow_button_: slider_arrow_button_ , breadcrumb_data_: breadcrumb_data_ , i18n_: i18n_ }) {
|
|
4342
4231
|
let scrolling_logic_ran_for_query_id = false;
|
|
4343
4232
|
let last_scroll_position;
|
|
@@ -4459,43 +4348,20 @@ function $cdc2c00c0a7da86e$export$466cdc317043f6cb({ quicklinks_data_: quicklink
|
|
|
4459
4348
|
get each () {
|
|
4460
4349
|
return place_holdey_quicklinks_data();
|
|
4461
4350
|
},
|
|
4462
|
-
children: (
|
|
4351
|
+
children: (display_accessor, index)=>{
|
|
4463
4352
|
const is_selected = (0, $46MJV$solidjs.createMemo)(()=>selected_index() === index);
|
|
4464
|
-
// Problem: if opening a sibling link in a new tab, filter clearing behavior is no longer consistent
|
|
4465
|
-
// Solution:
|
|
4466
|
-
// If current one in quick links they're siblings, don't add state to the url
|
|
4467
|
-
// If it's not in it, it's a child of the current one, so add state
|
|
4468
|
-
// (This brought up the issue on what happens if someone links to a filter that no longer exists, I chose to ignore that for now)
|
|
4469
|
-
// Problem: When you don't open a link in a new tab, we don't display the filter cleared toast
|
|
4470
|
-
// Solution: instead of not adding the state to the url, add a flag to the link if it's a sibling and then display the toast on load if the flag is set
|
|
4471
|
-
const is_child = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
4472
|
-
const current_id = current_query_id_();
|
|
4473
|
-
return !quicklinks_data_()?.find(({ query_id: query_id })=>query_id === current_id);
|
|
4474
|
-
});
|
|
4475
|
-
const modified_display_accessor = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
4476
|
-
const value = unmodified_display_accessor();
|
|
4477
|
-
if (!value) return value;
|
|
4478
|
-
const new_page_url = new URL(value.page_url, location.origin);
|
|
4479
|
-
(0, $88b2d66be18220f6$export$bca5a41ac5ef1190)(new_page_url);
|
|
4480
|
-
if (!is_child()) new_page_url.searchParams.set($cdc2c00c0a7da86e$export$e2cf3f19dd3f8aac, "true");
|
|
4481
|
-
return {
|
|
4482
|
-
...value,
|
|
4483
|
-
// We don't want these links to delete the sort and filter state by default, only if `clear_filters_when_going_sideways` explicitly clears them
|
|
4484
|
-
page_url: new_page_url.href
|
|
4485
|
-
};
|
|
4486
|
-
});
|
|
4487
4353
|
return (()=>{
|
|
4488
4354
|
const _el$3 = $cdc2c00c0a7da86e$var$_tmpl$3.cloneNode(true);
|
|
4489
4355
|
(0, $46MJV$solidjsweb.addEventListener)(_el$3, "click", (0, $46MJV$depictaiutilishared.catchify)((ev)=>{
|
|
4490
4356
|
if (is_selected() && !ev.metaKey && !ev.ctrlKey && !ev.button) ev.preventDefault();
|
|
4491
|
-
else if (
|
|
4357
|
+
else if (display_accessor()) on_link_click_(ev, display_accessor());
|
|
4492
4358
|
}), true);
|
|
4493
|
-
(0, $46MJV$solidjsweb.insert)(_el$3, ()=>
|
|
4359
|
+
(0, $46MJV$solidjsweb.insert)(_el$3, ()=>display_accessor()?.title || (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$depictaiutilishared.Placeholder), {
|
|
4494
4360
|
height: "1em",
|
|
4495
4361
|
width: "10ch"
|
|
4496
4362
|
}));
|
|
4497
4363
|
(0, $46MJV$solidjsweb.effect)((_p$)=>{
|
|
4498
|
-
const _v$ = !!is_selected(), _v$2 =
|
|
4364
|
+
const _v$ = !!is_selected(), _v$2 = display_accessor()?.page_url || "javascript:void(0)";
|
|
4499
4365
|
_v$ !== _p$._v$ && _el$3.classList.toggle("selected", _p$._v$ = _v$);
|
|
4500
4366
|
_v$2 !== _p$._v$2 && (0, $46MJV$solidjsweb.setAttribute)(_el$3, "href", _p$._v$2 = _v$2);
|
|
4501
4367
|
return _p$;
|
|
@@ -4670,7 +4536,6 @@ let $29b757e2ae26852c$export$44dad306455dddf;
|
|
|
4670
4536
|
})($29b757e2ae26852c$export$44dad306455dddf || ($29b757e2ae26852c$export$44dad306455dddf = {}));
|
|
4671
4537
|
|
|
4672
4538
|
|
|
4673
|
-
|
|
4674
4539
|
const $671632478f2a7ce7$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="product-count"> </div>`, 2), $671632478f2a7ce7$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div></div>`, 2), $671632478f2a7ce7$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $671632478f2a7ce7$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp category"><div class="listing-page"></div></div>`, 4);
|
|
4675
4540
|
function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , slider_arrow_button_: slider_arrow_button_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , on_category_link_click_: on_category_link_click_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , rr_options_: rr_options_ , get_product_id_: get_product_id_ }) {
|
|
4676
4541
|
let results_for;
|
|
@@ -4693,26 +4558,6 @@ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4693
4558
|
const first_result_in_viewport_ = (0, $46MJV$solidjs.createSignal)();
|
|
4694
4559
|
const last_result_in_viewport_ = (0, $46MJV$solidjs.createSignal)();
|
|
4695
4560
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = (0, $46MJV$solidjs.createSignal)(false);
|
|
4696
|
-
const tracking_function_for_plp_results = (0, $46MJV$solidjs.createReaction)(()=>{
|
|
4697
|
-
// On first rendering of the CategoryPage (after we have results), check if we got to this URL by going sideways in QuickLinks and clear filters with toast if so
|
|
4698
|
-
const url_object = new URL(location.href);
|
|
4699
|
-
const { searchParams: searchParams } = url_object;
|
|
4700
|
-
if (searchParams.get((0, $cdc2c00c0a7da86e$export$e2cf3f19dd3f8aac)) !== "true") return;
|
|
4701
|
-
searchParams.delete((0, $cdc2c00c0a7da86e$export$e2cf3f19dd3f8aac));
|
|
4702
|
-
history.pushState(history.state, "", url_object.href);
|
|
4703
|
-
(0, $46MJV$depictaiutilishared.dlog)("Flag to clear filters was set, clearing filters");
|
|
4704
|
-
(0, $46MJV$depictaiutilishared.queueMacroTask)(()=>{
|
|
4705
|
-
// Do it next task so that all the filters have time to populate
|
|
4706
|
-
(0, $92e4e7906daa1ff8$export$8895d39404bd2bb1)({
|
|
4707
|
-
user_triggered_: false,
|
|
4708
|
-
i18n_: i18n_,
|
|
4709
|
-
also_clear_sorting_: false,
|
|
4710
|
-
selected_filters_: selected_filters_,
|
|
4711
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
4712
|
-
local_filter_cache_: local_filter_cache_
|
|
4713
|
-
});
|
|
4714
|
-
});
|
|
4715
|
-
});
|
|
4716
4561
|
const query_base_ = (0, $08349e39f239a034$export$210f130a61ac1e8d)(()=>{
|
|
4717
4562
|
const sort_obj = get_sorting() && {
|
|
4718
4563
|
...get_sorting()
|
|
@@ -4744,7 +4589,6 @@ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4744
4589
|
} : {}
|
|
4745
4590
|
})
|
|
4746
4591
|
})));
|
|
4747
|
-
tracking_function_for_plp_results(plp_results_);
|
|
4748
4592
|
const available_sortings_ = (0, $46MJV$solidjs.createMemo)(()=>plp_results_()?.sorts?.map((sort)=>({
|
|
4749
4593
|
...sort,
|
|
4750
4594
|
order: sort.order ?? "desc"
|
|
@@ -5121,7 +4965,6 @@ function $f27b0b326e0a87e2$export$23fca46f3143581f(component, error_message) {
|
|
|
5121
4965
|
}
|
|
5122
4966
|
|
|
5123
4967
|
|
|
5124
|
-
|
|
5125
4968
|
const $068a627cc18f7bb6$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp category"></div>`, 2);
|
|
5126
4969
|
const $068a627cc18f7bb6$var$min_products_to_fetch_ = 20;
|
|
5127
4970
|
const $068a627cc18f7bb6$var$privately_shared_properties = /*@__PURE__*/ new WeakMap();
|
|
@@ -5167,20 +5010,17 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
|
|
|
5167
5010
|
$068a627cc18f7bb6$export$f34314aa9505732e.#has_been_constructed = true;
|
|
5168
5011
|
Object.assign(this, props_on_class); // set initial signal values
|
|
5169
5012
|
(0, $33815c5a406b6cc0$export$5162a71f252e6122)();
|
|
5170
|
-
const
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
category_scroll_restoration_data: []
|
|
5182
|
-
})
|
|
5183
|
-
});
|
|
5013
|
+
const [reset_history_state_, state_] = (0, $0de081f67b6d15b5$export$9862539c89138352)(()=>({
|
|
5014
|
+
category_sorting: undefined,
|
|
5015
|
+
category_filters_open: false,
|
|
5016
|
+
category_sorting_open: false,
|
|
5017
|
+
category_expanded_filters: [],
|
|
5018
|
+
// WARNING, it is insanely important, when creating the signals like this using make_resettable_history_state, that the two lines below are in *precisely that order*. The reason for that is that make_resettable_history_state will write the values of the signals in the order that they are written here when a "popstate" event occurs. If the filter cache is popped before the selected filters are the code in create_modified_filters() in FilterBody.tsx is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters and we'll end up with too few filters in search_local_filter_cache in some cases
|
|
5019
|
+
category_selected_filters: [],
|
|
5020
|
+
category_local_filter_cache: [],
|
|
5021
|
+
category_expanded_hierarchical_filters: [],
|
|
5022
|
+
category_scroll_restoration_data: []
|
|
5023
|
+
}));
|
|
5184
5024
|
const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
|
|
5185
5025
|
const on_category_link_click_ = (e, d)=>{
|
|
5186
5026
|
if (e.button || e.metaKey || e.ctrlKey) // Not single page navigating because button is not 0 or ctrl/command click
|
|
@@ -5205,8 +5045,6 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
|
|
|
5205
5045
|
reset_history_state_: reset_history_state_,
|
|
5206
5046
|
depict_api_: api ?? new (0, $9ce64f69303c371e$export$e015ed2f2950f2e3)(),
|
|
5207
5047
|
on_category_link_click_: on_category_link_click_,
|
|
5208
|
-
selected_filters_: selected_filters_,
|
|
5209
|
-
current_sorting_: current_sorting_,
|
|
5210
5048
|
slider_arrow_button_: (0, $46MJV$depictaiutilishared.GenericSliderArrowButton)({
|
|
5211
5049
|
height_: 12,
|
|
5212
5050
|
width_: 6.46
|
|
@@ -5223,7 +5061,7 @@ function $068a627cc18f7bb6$export$e2bf8ce7779e827e({ depict_category: depict_cat
|
|
|
5223
5061
|
grid_spacing: grid_spacing.horizontal
|
|
5224
5062
|
};
|
|
5225
5063
|
return (0, $f27b0b326e0a87e2$export$23fca46f3143581f)(()=>{
|
|
5226
|
-
const { state_: { category_local_filter_cache: local_filter_cache_ , category_filters_open: category_filters_open_ , category_sorting_open: category_sorting_open_ , category_expanded_filters: expanded_filters_ , category_expanded_hierarchical_filters: expanded_hierarchical_filters_ ,
|
|
5064
|
+
const { state_: { category_local_filter_cache: local_filter_cache_ , category_sorting: current_sorting_ , category_filters_open: category_filters_open_ , category_sorting_open: category_sorting_open_ , category_expanded_filters: expanded_filters_ , category_expanded_hierarchical_filters: expanded_hierarchical_filters_ , category_selected_filters: selected_filters_ , category_scroll_restoration_data: scroll_restoration_data_ } , reset_history_state_: reset_history_state_ , depict_api_: depict_api_ , i18n_: i18n_ , on_category_link_click_: on_category_link_click_ , breadcrumb_signal_: breadcrumb_signal_ , quicklinks_signal_: quicklinks_signal_ , slider_arrow_button_: slider_arrow_button_ } = shared_properties;
|
|
5227
5065
|
(0, $46MJV$solidjs.onCleanup)(reset_history_state_);
|
|
5228
5066
|
return (0, $671632478f2a7ce7$export$f7d2f673fc2f091d)({
|
|
5229
5067
|
tenant_: ()=>depict_category.merchant,
|
|
@@ -5552,14 +5390,18 @@ function $67892c03cd3dfa66$export$d757d54550ebfb3d({ category_suggestion_: categ
|
|
|
5552
5390
|
|
|
5553
5391
|
|
|
5554
5392
|
const $2989e355f64e18e1$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<button class="back" type="button"></button>`, 2), $2989e355f64e18e1$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.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);
|
|
5555
|
-
function $2989e355f64e18e1$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_ }) {
|
|
5556
|
-
let
|
|
5393
|
+
function $2989e355f64e18e1$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_ }) {
|
|
5394
|
+
let input_element;
|
|
5395
|
+
// This is the div where we recommend (and ourselves do) attach the event listener to that opens the search modal.
|
|
5396
|
+
let field_div;
|
|
5557
5397
|
(0, $46MJV$solidjs.createEffect)((0, $46MJV$depictaiutilishared.catchify)(async ()=>{
|
|
5558
5398
|
if (disabled_) return;
|
|
5559
5399
|
// we aren't in DOM yet unfortunately, wouldn't even be with onMount
|
|
5560
|
-
await (0, $46MJV$depictaiutilishared.observer).wait_for_element(
|
|
5561
|
-
|
|
5400
|
+
await (0, $46MJV$depictaiutilishared.observer).wait_for_element(input_element);
|
|
5401
|
+
input_element.focus();
|
|
5402
|
+
after_focusing_?.(input_element);
|
|
5562
5403
|
})); // focus field on render
|
|
5404
|
+
const owner_of_field_element = (0, $46MJV$solidjs.getOwner)();
|
|
5563
5405
|
return (()=>{
|
|
5564
5406
|
const _el$ = $2989e355f64e18e1$var$_tmpl$2.cloneNode(true), _el$3 = _el$.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$4.nextSibling, _el$6 = _el$3.nextSibling;
|
|
5565
5407
|
(0, $46MJV$solidjsweb.insert)(_el$, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
|
|
@@ -5572,48 +5414,55 @@ function $2989e355f64e18e1$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5572
5414
|
return _el$2;
|
|
5573
5415
|
}
|
|
5574
5416
|
}), _el$3);
|
|
5575
|
-
(0, $46MJV$solidjsweb.use)((el)=>
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5417
|
+
(0, $46MJV$solidjsweb.use)((el)=>{
|
|
5418
|
+
field_div = el;
|
|
5419
|
+
field_element_ref_?.(el);
|
|
5420
|
+
}, _el$3);
|
|
5421
|
+
_el$4.$$pointerdown = ({ pointerType: pointerType })=>{
|
|
5422
|
+
// 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).
|
|
5423
|
+
if (pointerType === "mouse") {
|
|
5424
|
+
const handler = (0, $46MJV$depictaiutilishared.catchify)(({ pointerType: pointerType , target: target })=>{
|
|
5425
|
+
if (pointerType !== "mouse" || !(target instanceof Node) || target === field_div || field_div.contains(target)) return;
|
|
5426
|
+
input_element.click();
|
|
5427
|
+
});
|
|
5428
|
+
window.addEventListener("pointerup", handler, {
|
|
5582
5429
|
once: true
|
|
5583
5430
|
});
|
|
5431
|
+
if (owner_of_field_element) (0, $46MJV$solidjs.runWithOwner)(owner_of_field_element, ()=>(0, $46MJV$solidjs.onCleanup)(()=>window.removeEventListener("pointerup", handler)));
|
|
5584
5432
|
}
|
|
5433
|
+
};
|
|
5434
|
+
(0, $46MJV$solidjsweb.addEventListener)(_el$4, "select", (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
5435
|
+
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
|
|
5436
|
+
return;
|
|
5437
|
+
if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length) // everything was selected, clear filters on next submit on next input
|
|
5438
|
+
input_element.addEventListener("input", (0, $46MJV$depictaiutilishared.catchify)(clear_filters_), {
|
|
5439
|
+
once: true
|
|
5440
|
+
});
|
|
5585
5441
|
}));
|
|
5586
5442
|
(0, $46MJV$solidjsweb.addEventListener)(_el$4, "input", (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
5587
|
-
const { value: value } =
|
|
5588
|
-
if (!disabled_ && !value.length) clear_filters_(
|
|
5443
|
+
const { value: value } = input_element;
|
|
5444
|
+
if (!disabled_ && !value.length) clear_filters_(); // if the user clears the whole field, reset filters on next submit
|
|
5589
5445
|
search_field_value_[1](value);
|
|
5590
5446
|
}), true);
|
|
5591
5447
|
(0, $46MJV$solidjsweb.addEventListener)(_el$4, "keydown", (0, $46MJV$depictaiutilishared.catchify)((e)=>{
|
|
5592
5448
|
if (disabled_) {
|
|
5593
5449
|
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
|
|
5594
|
-
|
|
5450
|
+
input_element.click();
|
|
5595
5451
|
} else if (e.key === "Enter") {
|
|
5596
5452
|
const dont_submit = override_on_enter_?.(e);
|
|
5597
5453
|
if (!dont_submit) submit_query_();
|
|
5598
5454
|
}
|
|
5599
5455
|
}), true);
|
|
5600
|
-
(0, $46MJV$solidjsweb.addEventListener)(_el$4, "focus", (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
5601
|
-
if (disabled_) {
|
|
5602
|
-
const last_pos = input_field.value.length;
|
|
5603
|
-
input_field.setSelectionRange(last_pos, last_pos);
|
|
5604
|
-
}
|
|
5605
|
-
}));
|
|
5606
5456
|
const _ref$ = (0, $46MJV$depictaiutilishared.catchify)((el)=>{
|
|
5607
|
-
|
|
5457
|
+
input_element = el;
|
|
5608
5458
|
input_field_ref_?.(el);
|
|
5609
5459
|
});
|
|
5610
5460
|
typeof _ref$ === "function" && (0, $46MJV$solidjsweb.use)(_ref$, _el$4);
|
|
5611
5461
|
_el$4.classList.toggle("has-adjacent-back-button", !!on_back_);
|
|
5612
5462
|
(0, $46MJV$solidjsweb.addEventListener)(_el$5, "click", (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
5613
5463
|
search_field_value_[1]("");
|
|
5614
|
-
clear_filters_(
|
|
5615
|
-
if (disabled_)
|
|
5616
|
-
input_field.focus();
|
|
5464
|
+
clear_filters_();
|
|
5465
|
+
if (!disabled_) input_element.focus();
|
|
5617
5466
|
}), true);
|
|
5618
5467
|
(0, $46MJV$solidjsweb.insert)(_el$5, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$depictaiutilishared.CrossIcon), {}));
|
|
5619
5468
|
(0, $46MJV$solidjsweb.addEventListener)(_el$6, "click", (0, $46MJV$depictaiutilishared.catchify)(()=>submit_query_()), true);
|
|
@@ -5640,7 +5489,8 @@ function $2989e355f64e18e1$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5640
5489
|
(0, $46MJV$solidjsweb.delegateEvents)([
|
|
5641
5490
|
"click",
|
|
5642
5491
|
"keydown",
|
|
5643
|
-
"input"
|
|
5492
|
+
"input",
|
|
5493
|
+
"pointerdown"
|
|
5644
5494
|
]);
|
|
5645
5495
|
|
|
5646
5496
|
|
|
@@ -5829,27 +5679,27 @@ function $67b60b572b7b7059$export$b3ad617e9036868(modal_body_style, input_field,
|
|
|
5829
5679
|
|
|
5830
5680
|
|
|
5831
5681
|
function $8b282f736ce4f3b8$export$e026af0c7b64ea5f({ selected_filters_: selected_filters_ , search_query_: [get_search_query] , current_sorting_: current_sorting_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , local_filter_cache_: local_filter_cache_ }) {
|
|
5832
|
-
const [get_selected_filters] = selected_filters_;
|
|
5833
|
-
//
|
|
5834
|
-
// 0 - we should not clear next submit
|
|
5835
|
-
// 1 - we should clear next submit due to internal heuristics
|
|
5836
|
-
// 2 - we should clear next submit due to EXPLICIT user action (i.e. clear button pressed)
|
|
5837
|
-
const clear_filters_next_submit_ = (0, $46MJV$solidjs.createSignal)(0); // we store this here (and not in history.state) (maybe there's a better place) because it's a very temporary thing. I.e. as soon as anything breaks the "flow of intent" to make a new search we want this reset
|
|
5682
|
+
const [get_selected_filters, set_selected_filters] = selected_filters_;
|
|
5683
|
+
const clear_filters_next_submit_ = (0, $46MJV$solidjs.createSignal)(false); // we store this here (and not in history.state) (maybe there's a better place) because it's a very temporary thing. I.e. as soon as anything breaks the "flow of intent" to make a new search we want this reset
|
|
5838
5684
|
const [get_clear_filters_next_submit, set_clear_filters_next_submit] = clear_filters_next_submit_;
|
|
5839
|
-
const clear_filters = (
|
|
5685
|
+
const clear_filters = ()=>set_clear_filters_next_submit(true);
|
|
5840
5686
|
(0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)(get_selected_filters, ()=>{
|
|
5841
5687
|
// if the selected filters update, clear the clearing signal
|
|
5842
|
-
set_clear_filters_next_submit(
|
|
5688
|
+
set_clear_filters_next_submit(false);
|
|
5843
5689
|
}, {
|
|
5844
5690
|
defer: true
|
|
5845
5691
|
}));
|
|
5846
5692
|
(0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)(get_search_query, (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
5847
5693
|
// when a query was submitted, clear filters if clear was pressed before
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5694
|
+
if ((0, $46MJV$solidjs.untrack)(get_clear_filters_next_submit)) {
|
|
5695
|
+
set_clear_filters_next_submit(false);
|
|
5696
|
+
set_selected_filters([]);
|
|
5697
|
+
// also collapse expanded filters in hierarchical filter tree again
|
|
5698
|
+
expanded_hierarchical_filters_[1]([]);
|
|
5699
|
+
// also clear sorting
|
|
5700
|
+
current_sorting_[1](undefined);
|
|
5851
5701
|
(0, $92e4e7906daa1ff8$export$8895d39404bd2bb1)({
|
|
5852
|
-
user_triggered_:
|
|
5702
|
+
user_triggered_: true,
|
|
5853
5703
|
selected_filters_: selected_filters_,
|
|
5854
5704
|
i18n_: i18n_,
|
|
5855
5705
|
also_clear_sorting_: true,
|
|
@@ -5992,7 +5842,7 @@ function $690220645373c65e$export$2542ffb77b620b02(params_to_default_value) {
|
|
|
5992
5842
|
|
|
5993
5843
|
|
|
5994
5844
|
const $1bf0125991f2d39b$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="orig price"></span>`, 2), $1bf0125991f2d39b$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.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), $1bf0125991f2d39b$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="tagline"></div>`, 2);
|
|
5995
|
-
const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n })=>{
|
|
5845
|
+
const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market })=>{
|
|
5996
5846
|
const display = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
5997
5847
|
const display = display_or_variant_container();
|
|
5998
5848
|
// Support for backend's new display format
|
|
@@ -6004,7 +5854,12 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
|
|
|
6004
5854
|
};
|
|
6005
5855
|
}
|
|
6006
5856
|
if (display.page_url) return display;
|
|
6007
|
-
// Support for
|
|
5857
|
+
// Support for post-migration (but still old basic format) Stronger displays, with slug but without page_url
|
|
5858
|
+
if (display.slug) {
|
|
5859
|
+
display.page_url = `/${market}/` + display.slug;
|
|
5860
|
+
return display;
|
|
5861
|
+
}
|
|
5862
|
+
// Support for Spendrups displays, used by our frontend script and Spendrups coming react-ui integration.
|
|
6008
5863
|
if (!display?.variants?.length) return;
|
|
6009
5864
|
return display.variants.filter((v)=>v.product_id == display.product_id)[0];
|
|
6010
5865
|
});
|
|
@@ -6991,7 +6846,7 @@ function $4a976b492943589f$export$f021bdedd3ec901a(props) {
|
|
|
6991
6846
|
|
|
6992
6847
|
|
|
6993
6848
|
const $121d25ca6af2898f$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $121d25ca6af2898f$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<b></b>`, 2), $121d25ca6af2898f$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $121d25ca6af2898f$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
|
|
6994
|
-
function $121d25ca6af2898f$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, $46MJV$solidjs.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_ }) {
|
|
6849
|
+
function $121d25ca6af2898f$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, $46MJV$solidjs.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_ }) {
|
|
6995
6850
|
let on_enter_in_search_field_function;
|
|
6996
6851
|
const [input_field, set_input_field] = (0, $46MJV$solidjs.createSignal)();
|
|
6997
6852
|
const [get_search_field_value_] = search_field_value_;
|
|
@@ -7053,7 +6908,14 @@ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: search
|
|
|
7053
6908
|
search_field_value_: search_field_value_,
|
|
7054
6909
|
submit_query_: submit_query_,
|
|
7055
6910
|
clear_filters_: clear_filters_,
|
|
7056
|
-
i18n_: i18n_
|
|
6911
|
+
i18n_: i18n_,
|
|
6912
|
+
after_focusing_: (input_el)=>{
|
|
6913
|
+
// Restore the selection range from the SearchField that was used to open the modal, if it was saved.
|
|
6914
|
+
if (!selected_text_range_) return;
|
|
6915
|
+
const [start, end] = selected_text_range_;
|
|
6916
|
+
if (start === null || end === null) return;
|
|
6917
|
+
input_el.setSelectionRange(start, end);
|
|
6918
|
+
}
|
|
7057
6919
|
});
|
|
7058
6920
|
search_field.classList.add("in-modal");
|
|
7059
6921
|
const modal_element = (()=>{
|
|
@@ -7323,28 +7185,38 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
|
|
|
7323
7185
|
})));
|
|
7324
7186
|
const available_filters_ = (0, $46MJV$solidjs.createMemo)(()=>search_results_()?.filters);
|
|
7325
7187
|
const modal_body_style = (0, $46MJV$solidjs.createSignal)({});
|
|
7326
|
-
let
|
|
7188
|
+
let search_field;
|
|
7327
7189
|
if (include_input_field_) {
|
|
7328
7190
|
const SafeSearchField = (0, $46MJV$depictaiutilishared.catchify)((0, $2989e355f64e18e1$export$b94867ecbd698f21));
|
|
7329
|
-
|
|
7191
|
+
let input_element;
|
|
7192
|
+
let div_with_field_class;
|
|
7193
|
+
search_field = SafeSearchField({
|
|
7330
7194
|
i18n_: i18n_,
|
|
7331
|
-
disabled_: true,
|
|
7332
7195
|
search_query_: search_query_,
|
|
7333
7196
|
search_field_value_: search_field_value_,
|
|
7334
7197
|
submit_query_: submit_query_,
|
|
7335
|
-
clear_filters_: clear_filters_on_next_submit_
|
|
7198
|
+
clear_filters_: clear_filters_on_next_submit_,
|
|
7199
|
+
input_field_ref_: (el)=>input_element = el,
|
|
7200
|
+
field_element_ref_: (el)=>div_with_field_class = el,
|
|
7201
|
+
disabled_: true
|
|
7336
7202
|
});
|
|
7337
|
-
if (
|
|
7203
|
+
if (search_field) {
|
|
7338
7204
|
opts?.modal_body_style_ref_?.(modal_body_style);
|
|
7339
|
-
const align_position = (0, $46MJV$depictaiutilishared.catchify)((0, $67b60b572b7b7059$export$b3ad617e9036868))(modal_body_style,
|
|
7340
|
-
|
|
7205
|
+
const align_position = (0, $46MJV$depictaiutilishared.catchify)((0, $67b60b572b7b7059$export$b3ad617e9036868))(modal_body_style, search_field, undefined, true);
|
|
7206
|
+
div_with_field_class.addEventListener("click", (0, $46MJV$depictaiutilishared.catchify)((e)=>{
|
|
7341
7207
|
const target = e.target;
|
|
7342
7208
|
const sel = ".submit";
|
|
7343
7209
|
if (target?.matches?.(sel) || target?.closest?.(sel)) // the search button is just decor, don't do anything when clicked
|
|
7344
7210
|
return;
|
|
7211
|
+
// 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.
|
|
7212
|
+
const selected_text_range_ = [
|
|
7213
|
+
input_element.selectionStart,
|
|
7214
|
+
input_element.selectionEnd
|
|
7215
|
+
];
|
|
7345
7216
|
align_position?.();
|
|
7346
7217
|
open_modal_({
|
|
7347
|
-
style_props_: modal_body_style
|
|
7218
|
+
style_props_: modal_body_style,
|
|
7219
|
+
selected_text_range_: selected_text_range_
|
|
7348
7220
|
}, ()=>include_input_field_?.on_close_?.());
|
|
7349
7221
|
include_input_field_?.on_open_?.();
|
|
7350
7222
|
}));
|
|
@@ -7420,7 +7292,7 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
|
|
|
7420
7292
|
document.createComment("Search page based on Depict SDK"),
|
|
7421
7293
|
(()=>{
|
|
7422
7294
|
const _el$2 = $93779a41dce11249$var$_tmpl$2.cloneNode(true), _el$3 = _el$2.firstChild;
|
|
7423
|
-
(0, $46MJV$solidjsweb.insert)(_el$3,
|
|
7295
|
+
(0, $46MJV$solidjsweb.insert)(_el$3, search_field, null);
|
|
7424
7296
|
(0, $46MJV$solidjsweb.insert)(_el$3, make_category_suggestion_card_ ? (0, $46MJV$solidjsweb.createComponent)((0, $0f2f58dd60b11888$export$b69d0d92862de18b), {
|
|
7425
7297
|
severity_: "error",
|
|
7426
7298
|
message_: "Category suggestions failed",
|
|
@@ -7575,7 +7447,6 @@ function $246e3e89a097f014$export$828dcdd425fd3231(aligner) {
|
|
|
7575
7447
|
}
|
|
7576
7448
|
|
|
7577
7449
|
|
|
7578
|
-
|
|
7579
7450
|
const $79fbf145b15af988$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp search"></div>`, 2);
|
|
7580
7451
|
/**
|
|
7581
7452
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
@@ -7588,7 +7459,7 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7588
7459
|
#market_signal = (0, $46MJV$solidjs.createSignal)();
|
|
7589
7460
|
#modal_open_signal = (0, $46MJV$solidjs.createSignal)(false);
|
|
7590
7461
|
static #has_been_constructed = false;
|
|
7591
|
-
constructor({ search_query_url_param_name: search_query_url_param_name = "
|
|
7462
|
+
constructor({ search_query_url_param_name: search_query_url_param_name = "search_query" , url_transformer: url_transformer , on_navigation: raw_on_navigation , enable_category_suggestions: enable_category_suggestions = true , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
7592
7463
|
disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , render_instant_card: render_instant_card , ...props_on_class }){
|
|
7593
7464
|
if ($79fbf145b15af988$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
|
|
7594
7465
|
Object.assign(this, props_on_class);
|
|
@@ -7610,22 +7481,19 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7610
7481
|
target_url.searchParams.set(search_param_name, new_search_query);
|
|
7611
7482
|
on_navigation(target_url.href);
|
|
7612
7483
|
});
|
|
7613
|
-
const
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
search_scroll_restoration_data: []
|
|
7627
|
-
})
|
|
7628
|
-
});
|
|
7484
|
+
const [reset_history_state_, state_] = (0, $0de081f67b6d15b5$export$9862539c89138352)(()=>({
|
|
7485
|
+
search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name) ?? "",
|
|
7486
|
+
search_sorting: undefined,
|
|
7487
|
+
search_filters_open: false,
|
|
7488
|
+
search_sorting_open: false,
|
|
7489
|
+
search_expanded_filters: [],
|
|
7490
|
+
// WARNING, it is insanely important, when creating the signals like this using make_resettable_history_state, that the two lines below are in *precisely that order*. The reason for that is that make_resettable_history_state will write the values of the signals in the order that they are written here when a "popstate" event occurs. If the filter cache is popped before the selected filters are the code in create_modified_filters() in FilterBody.tsx is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
|
|
7491
|
+
search_selected_filters: [],
|
|
7492
|
+
search_local_filter_cache: [],
|
|
7493
|
+
search_expanded_hierarchical_filters: [],
|
|
7494
|
+
search_showing_recommendation_rows: (0, $9f81b7ced87aabf2$export$1c8c715550dc689d),
|
|
7495
|
+
search_scroll_restoration_data: []
|
|
7496
|
+
}));
|
|
7629
7497
|
const search_query_updating_blocked_ = (0, $46MJV$solidjs.createSignal)(false);
|
|
7630
7498
|
const { [search_query_url_param_name]: raw_search_query_signal } = (0, $690220645373c65e$export$2542ffb77b620b02)({
|
|
7631
7499
|
[search_query_url_param_name]: ""
|
|
@@ -7647,9 +7515,9 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7647
7515
|
});
|
|
7648
7516
|
const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
|
|
7649
7517
|
const clear_filters_on_next_submit_ = (0, $8b282f736ce4f3b8$export$e026af0c7b64ea5f)({
|
|
7650
|
-
selected_filters_:
|
|
7518
|
+
selected_filters_: state_.search_selected_filters,
|
|
7651
7519
|
search_query_: search_query_signal_,
|
|
7652
|
-
current_sorting_:
|
|
7520
|
+
current_sorting_: state_.search_sorting,
|
|
7653
7521
|
expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
|
|
7654
7522
|
i18n_: i18n_,
|
|
7655
7523
|
local_filter_cache_: state_.search_local_filter_cache
|
|
@@ -7672,9 +7540,7 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7672
7540
|
configured_submit_query_: configured_submit_query_,
|
|
7673
7541
|
search_query_signal_: search_query_signal_,
|
|
7674
7542
|
i18n_: i18n_,
|
|
7675
|
-
search_query_updating_blocked_: search_query_updating_blocked_
|
|
7676
|
-
current_sorting_: current_sorting_,
|
|
7677
|
-
selected_filters_: selected_filters_
|
|
7543
|
+
search_query_updating_blocked_: search_query_updating_blocked_
|
|
7678
7544
|
});
|
|
7679
7545
|
(0, $33815c5a406b6cc0$export$5162a71f252e6122)();
|
|
7680
7546
|
(0, $46MJV$depictaiutilishared.catchify)(async ()=>{
|
|
@@ -7701,7 +7567,7 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7701
7567
|
min_products_to_fetch_: $79fbf145b15af988$var$min_products_to_fetch_,
|
|
7702
7568
|
render_instant_card_: render_instant_card,
|
|
7703
7569
|
render_instant_card_placeholder_: (0, $17c49340edfdbb31$export$ee1733d9a8495996),
|
|
7704
|
-
has_sort_or_filters_: (0, $46MJV$solidjs.createMemo)(()=>!!(Object.keys(
|
|
7570
|
+
has_sort_or_filters_: (0, $46MJV$solidjs.createMemo)(()=>!!(Object.keys(state_.search_selected_filters[0]())?.length || state_.search_sorting[0]()))
|
|
7705
7571
|
},
|
|
7706
7572
|
i18n_: i18n_,
|
|
7707
7573
|
enable_category_suggestions_: enable_category_suggestions,
|
|
@@ -7841,7 +7707,7 @@ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
7841
7707
|
});
|
|
7842
7708
|
});
|
|
7843
7709
|
},
|
|
7844
|
-
current_sorting_:
|
|
7710
|
+
current_sorting_: state_.search_sorting,
|
|
7845
7711
|
search_filters_open_: state_.search_filters_open,
|
|
7846
7712
|
search_sorting_open_: state_.search_sorting_open,
|
|
7847
7713
|
expanded_filters_: state_.search_expanded_filters,
|
|
@@ -7852,7 +7718,7 @@ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
7852
7718
|
});
|
|
7853
7719
|
} : false,
|
|
7854
7720
|
expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
|
|
7855
|
-
selected_filters_:
|
|
7721
|
+
selected_filters_: state_.search_selected_filters,
|
|
7856
7722
|
showing_recommendation_rows_: state_.search_showing_recommendation_rows,
|
|
7857
7723
|
scroll_restoration_data_: state_.search_scroll_restoration_data,
|
|
7858
7724
|
include_input_field_: include_input_field,
|
|
@@ -7883,7 +7749,8 @@ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
7883
7749
|
function $79fbf145b15af988$export$316f6f283ae64765({ depict_search: depict_search , modal_dispose_handler: modal_dispose_handler , click_handler: click_handler , aligner_ref: aligner_ref }) {
|
|
7884
7750
|
const shared_properties = $79fbf145b15af988$var$get_shared_properties(depict_search);
|
|
7885
7751
|
return (0, $f27b0b326e0a87e2$export$23fca46f3143581f)(()=>{
|
|
7886
|
-
|
|
7752
|
+
let input_element;
|
|
7753
|
+
const search_field = (0, $46MJV$solidjsweb.createComponent)((0, $2989e355f64e18e1$export$b94867ecbd698f21), {
|
|
7887
7754
|
get search_query_ () {
|
|
7888
7755
|
return shared_properties.search_query_signal_;
|
|
7889
7756
|
},
|
|
@@ -7900,35 +7767,40 @@ function $79fbf145b15af988$export$316f6f283ae64765({ depict_search: depict_searc
|
|
|
7900
7767
|
return shared_properties.i18n_;
|
|
7901
7768
|
},
|
|
7902
7769
|
disabled_: true,
|
|
7770
|
+
input_field_ref_: (el)=>input_element = el,
|
|
7903
7771
|
field_element_ref_: (field)=>{
|
|
7904
7772
|
const style_props_ = (0, $46MJV$solidjs.createSignal)({
|
|
7905
7773
|
position: "fixed"
|
|
7906
7774
|
});
|
|
7907
7775
|
const defaultHandler = (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
7908
|
-
|
|
7776
|
+
// 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.
|
|
7777
|
+
const selected_text_range_ = [
|
|
7778
|
+
input_element.selectionStart,
|
|
7779
|
+
input_element.selectionEnd
|
|
7780
|
+
];
|
|
7781
|
+
const { cleanup: cleanup } = $79fbf145b15af988$var$align_field_modal(style_props_, search_field, aligner_ref);
|
|
7909
7782
|
const complete_modal_dispose_handler = ()=>{
|
|
7910
7783
|
modal_dispose_handler?.();
|
|
7911
7784
|
cleanup();
|
|
7912
7785
|
};
|
|
7913
7786
|
depict_search.modal_open = [
|
|
7914
7787
|
{
|
|
7915
|
-
style_props_: style_props_
|
|
7788
|
+
style_props_: style_props_,
|
|
7789
|
+
selected_text_range_: selected_text_range_
|
|
7916
7790
|
},
|
|
7917
7791
|
complete_modal_dispose_handler
|
|
7918
7792
|
];
|
|
7919
7793
|
});
|
|
7920
7794
|
const handler = click_handler ?? defaultHandler;
|
|
7921
7795
|
field.addEventListener("click", handler);
|
|
7922
|
-
(0, $46MJV$solidjs.onCleanup)(()=>
|
|
7923
|
-
field.removeEventListener("click", handler);
|
|
7924
|
-
});
|
|
7796
|
+
(0, $46MJV$solidjs.onCleanup)(()=>field.removeEventListener("click", handler));
|
|
7925
7797
|
}
|
|
7926
7798
|
});
|
|
7927
7799
|
// We assume this to be an array containing exactly on div in js-ui
|
|
7928
7800
|
return [
|
|
7929
7801
|
(()=>{
|
|
7930
7802
|
const _el$ = $79fbf145b15af988$var$_tmpl$.cloneNode(true);
|
|
7931
|
-
(0, $46MJV$solidjsweb.insert)(_el$,
|
|
7803
|
+
(0, $46MJV$solidjsweb.insert)(_el$, search_field);
|
|
7932
7804
|
return _el$;
|
|
7933
7805
|
})()
|
|
7934
7806
|
];
|
|
@@ -7958,6 +7830,7 @@ function $79fbf145b15af988$var$align_field_modal(style_props_, input, aligner_re
|
|
|
7958
7830
|
|
|
7959
7831
|
|
|
7960
7832
|
|
|
7833
|
+
|
|
7961
7834
|
const $9c5a1d57540c06e5$export$d86a33413558014e = (openModalParams)=>{
|
|
7962
7835
|
const { search: search } = openModalParams;
|
|
7963
7836
|
openModalParams.location ||= "centered";
|