@depict-ai/ui 0.0.62 → 0.0.64
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 +6 -6
- package/dist/main.js +458 -226
- package/dist/module.js +460 -228
- package/dist/moduule.js +7872 -0
- package/package.json +5 -4
package/dist/main.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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");
|
|
4
5
|
|
|
5
6
|
function $parcel$export(e, n, v, s) {
|
|
6
7
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
@@ -34,7 +35,7 @@ $parcel$export(module.exports, "solid_format_price", () => $5fc9fc23df1591db$exp
|
|
|
34
35
|
$parcel$export(module.exports, "connect_search_field_height_to_aligner_height", () => $246e3e89a097f014$export$828dcdd425fd3231);
|
|
35
36
|
$parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
|
|
36
37
|
$parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
|
|
37
|
-
/*! 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.64";
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
|
|
@@ -88,14 +89,16 @@ function $1ee6da2465098194$var$history_state_change(signals, entries, state) {
|
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
|
|
91
|
-
function $
|
|
92
|
-
const state = (0, $1ee6da2465098194$export$e183a13865960371)(
|
|
92
|
+
function $92acef13f7f7585b$export$90a2b6b3fb2a1455({ get_default_values_: get_default_values_ , current_sorting_: [, set_current_sorting] , selected_filters_: [get_selected_filters, set_selected_filters] }) {
|
|
93
|
+
const state = (0, $1ee6da2465098194$export$e183a13865960371)(get_default_values_());
|
|
93
94
|
const reset_state = ()=>{
|
|
94
|
-
const new_defaults =
|
|
95
|
+
const new_defaults = get_default_values_();
|
|
95
96
|
for(const key in state){
|
|
96
97
|
const new_value = new_defaults[key];
|
|
97
98
|
state[key][1](new_value);
|
|
98
99
|
}
|
|
100
|
+
set_current_sorting();
|
|
101
|
+
if (get_selected_filters().length > 0) set_selected_filters([]);
|
|
99
102
|
};
|
|
100
103
|
return [
|
|
101
104
|
reset_state,
|
|
@@ -2778,156 +2781,6 @@ var $6865c7388a79e957$export$2e2bcd8739ae039 = {
|
|
|
2778
2781
|
|
|
2779
2782
|
|
|
2780
2783
|
|
|
2781
|
-
function $0bc45cf6753f874a$export$b288c38ae3fddb56({ available_filters_: available_filters_ , local_filter_cache_: [read_local_cache, write_local_cache] , selected_filters_: [read_selected_filters] }) {
|
|
2782
|
-
let last_remote_state;
|
|
2783
|
-
(0, $46MJV$solidjs.createComputed)(()=>{
|
|
2784
|
-
const remote_filters = Object.fromEntries(available_filters_()?.map((filter)=>[
|
|
2785
|
-
JSON.stringify([
|
|
2786
|
-
filter.field,
|
|
2787
|
-
filter.op,
|
|
2788
|
-
filter?.meta?.type
|
|
2789
|
-
]),
|
|
2790
|
-
filter
|
|
2791
|
-
]) || []);
|
|
2792
|
-
const local_filters = Object.fromEntries(read_local_cache().map((filter)=>[
|
|
2793
|
-
JSON.stringify([
|
|
2794
|
-
filter.field,
|
|
2795
|
-
filter.op,
|
|
2796
|
-
filter?.meta?.type
|
|
2797
|
-
]),
|
|
2798
|
-
filter
|
|
2799
|
-
]));
|
|
2800
|
-
const selected_filters = Object.fromEntries(read_selected_filters().map((filter_obj)=>[
|
|
2801
|
-
JSON.stringify([
|
|
2802
|
-
filter_obj.field,
|
|
2803
|
-
filter_obj.op
|
|
2804
|
-
]),
|
|
2805
|
-
filter_obj
|
|
2806
|
-
]));
|
|
2807
|
-
const new_local_filter_state = [];
|
|
2808
|
-
// 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
|
|
2809
|
-
for (const filter_id of [
|
|
2810
|
-
...Object.keys(local_filters).filter((key)=>!(key in remote_filters)),
|
|
2811
|
-
...Object.keys(remote_filters)
|
|
2812
|
-
]){
|
|
2813
|
-
const local_filter = local_filters[filter_id];
|
|
2814
|
-
const remote_filter = remote_filters[filter_id];
|
|
2815
|
-
const filter_id_without_meta_type = JSON.stringify(JSON.parse(filter_id).slice(0, 2));
|
|
2816
|
-
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
|
|
2817
|
-
{
|
|
2818
|
-
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]));
|
|
2819
|
-
} else if (!local_filter) // just take the remote one
|
|
2820
|
-
new_local_filter_state.push(remote_filter);
|
|
2821
|
-
else {
|
|
2822
|
-
// both exist, merge them if needed
|
|
2823
|
-
const remote_meta = remote_filter.meta;
|
|
2824
|
-
const local_meta = local_filter.meta;
|
|
2825
|
-
const this_applied_filter = selected_filters[filter_id_without_meta_type];
|
|
2826
|
-
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
|
|
2827
|
-
new_local_filter_state.push(remote_filter);
|
|
2828
|
-
else {
|
|
2829
|
-
const data_objs_in_remote = Object.fromEntries(remote_meta.values.map((value, index)=>[
|
|
2830
|
-
JSON.stringify(value),
|
|
2831
|
-
{
|
|
2832
|
-
value_: value,
|
|
2833
|
-
count_: remote_meta.counts?.[index],
|
|
2834
|
-
name_: remote_meta.names?.[index]
|
|
2835
|
-
}
|
|
2836
|
-
]));
|
|
2837
|
-
const data_objs_in_local = Object.fromEntries(local_meta.values.map((value, index)=>[
|
|
2838
|
-
JSON.stringify(value),
|
|
2839
|
-
{
|
|
2840
|
-
value_: value,
|
|
2841
|
-
count_: 0,
|
|
2842
|
-
name_: local_meta.names?.[index]
|
|
2843
|
-
}
|
|
2844
|
-
]));
|
|
2845
|
-
const new_data = [
|
|
2846
|
-
...Object.keys(data_objs_in_local).filter((key)=>{
|
|
2847
|
-
// put data entries that are selected and don't exist in new remote state first
|
|
2848
|
-
if (key in data_objs_in_remote) return false;
|
|
2849
|
-
const selected_values = this_applied_filter.data;
|
|
2850
|
-
return selected_values.some((value)=>{
|
|
2851
|
-
const is_equal = JSON.stringify(value) === key;
|
|
2852
|
-
if (is_equal) return true;
|
|
2853
|
-
if (local_meta.type === remote_meta.type && local_meta.type === "checkbox-hierarchical") {
|
|
2854
|
-
// 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.
|
|
2855
|
-
const selected_values = data_objs_in_local[key].value_;
|
|
2856
|
-
const values_length = value?.length;
|
|
2857
|
-
if (values_length > 1 && values_length - 1 === selected_values.length) {
|
|
2858
|
-
let is_parent = true;
|
|
2859
|
-
for(let i = 0; i < selected_values.length; i++)if (selected_values[i] !== value[i]) is_parent = false;
|
|
2860
|
-
return is_parent;
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
return false;
|
|
2864
|
-
});
|
|
2865
|
-
}).map((key)=>data_objs_in_local[key]),
|
|
2866
|
-
...Object.values(data_objs_in_remote)
|
|
2867
|
-
];
|
|
2868
|
-
const new_values = new_data.map(({ value_: value_ })=>value_);
|
|
2869
|
-
const result = {
|
|
2870
|
-
...remote_filter,
|
|
2871
|
-
meta: {
|
|
2872
|
-
...remote_filter.meta,
|
|
2873
|
-
values: new_values,
|
|
2874
|
-
names: new_data.map(({ name_: name_ })=>name_),
|
|
2875
|
-
counts: new_data.map(({ count_: count_ })=>count_)
|
|
2876
|
-
}
|
|
2877
|
-
};
|
|
2878
|
-
new_local_filter_state.push(result);
|
|
2879
|
-
}
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
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
|
|
2883
|
-
JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) // Sorry……… They're not that big
|
|
2884
|
-
write_local_cache(new_local_filter_state);
|
|
2885
|
-
last_remote_state = available_filters_();
|
|
2886
|
-
});
|
|
2887
|
-
return read_local_cache;
|
|
2888
|
-
}
|
|
2889
|
-
/**
|
|
2890
|
-
* 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.
|
|
2891
|
-
* This sets the counts to 0 (if applicable) and removes non-selected options (if applicable)
|
|
2892
|
-
*/ function $0bc45cf6753f874a$var$modify_only_local_filter(local_filter_object, selected_filter) {
|
|
2893
|
-
const old_meta = local_filter_object.meta;
|
|
2894
|
-
const selected_filter_data = selected_filter.data;
|
|
2895
|
-
const modified_filter_object = {
|
|
2896
|
-
...local_filter_object
|
|
2897
|
-
};
|
|
2898
|
-
if (old_meta) {
|
|
2899
|
-
const new_meta = {
|
|
2900
|
-
...old_meta
|
|
2901
|
-
};
|
|
2902
|
-
modified_filter_object.meta = new_meta;
|
|
2903
|
-
// set counts to 0
|
|
2904
|
-
if ("counts" in new_meta) {
|
|
2905
|
-
const counts = new_meta.counts;
|
|
2906
|
-
if (counts) new_meta.counts = counts.map(()=>0);
|
|
2907
|
-
}
|
|
2908
|
-
if (Array.isArray(selected_filter_data) && "values" in new_meta) {
|
|
2909
|
-
// we have an array of values and want to strip the ones from the available ones that aren't selected
|
|
2910
|
-
const values = new_meta.values;
|
|
2911
|
-
if (Array.isArray(values)) {
|
|
2912
|
-
const jsond_set_values = selected_filter_data.map((data)=>JSON.stringify(data));
|
|
2913
|
-
const indexes_to_remove = new Set();
|
|
2914
|
-
for(let i = 0; i < values.length; i++){
|
|
2915
|
-
const value = values[i];
|
|
2916
|
-
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
|
|
2917
|
-
indexes_to_remove.add(i);
|
|
2918
|
-
}
|
|
2919
|
-
new_meta.values = values.filter((_, index)=>!indexes_to_remove.has(index));
|
|
2920
|
-
if (new_meta.names) new_meta.names = new_meta.names.filter((_, index)=>!indexes_to_remove.has(index));
|
|
2921
|
-
if (new_meta.counts) // remove counts that are too much, they're all zero anyway if they exist
|
|
2922
|
-
new_meta.counts.length -= indexes_to_remove.size;
|
|
2923
|
-
}
|
|
2924
|
-
}
|
|
2925
|
-
}
|
|
2926
|
-
return modified_filter_object;
|
|
2927
|
-
}
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
2784
|
|
|
2932
2785
|
|
|
2933
2786
|
|
|
@@ -3094,11 +2947,7 @@ function $1587765bd31f3722$export$3f1a388cc0d8fed7(props) {
|
|
|
3094
2947
|
});
|
|
3095
2948
|
}
|
|
3096
2949
|
function $1587765bd31f3722$var$ActualFilterBody(props) {
|
|
3097
|
-
const modified_available_filters_with_selected_unexisting_ones_injected_from_local_state =
|
|
3098
|
-
available_filters_: props.available_filters_,
|
|
3099
|
-
selected_filters_: props.selected_filters_,
|
|
3100
|
-
local_filter_cache_: props.local_filter_cache_
|
|
3101
|
-
});
|
|
2950
|
+
const [modified_available_filters_with_selected_unexisting_ones_injected_from_local_state] = props.local_filter_cache_;
|
|
3102
2951
|
const togglable_filters = (0, $46MJV$solidjs.createMemo)(()=>modified_available_filters_with_selected_unexisting_ones_injected_from_local_state().filter((item)=>item?.meta?.group_title));
|
|
3103
2952
|
const untogglable_filters = (0, $46MJV$solidjs.createMemo)(()=>modified_available_filters_with_selected_unexisting_ones_injected_from_local_state().filter((item)=>!item?.meta?.group_title));
|
|
3104
2953
|
const togglable_filters_grouped_by_collapsible = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
@@ -3299,9 +3148,10 @@ function $1587765bd31f3722$var$ActualFilterBody(props) {
|
|
|
3299
3148
|
|
|
3300
3149
|
|
|
3301
3150
|
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);
|
|
3302
|
-
function $cc8aaf130b1dc1ea$export$1f1775a58da589b5({ available_sortings_: available_sortings_ , current_sorting_:
|
|
3151
|
+
function $cc8aaf130b1dc1ea$export$1f1775a58da589b5({ available_sortings_: available_sortings_ , current_sorting_: [get_current_sorting, set_current_sorting] }) {
|
|
3303
3152
|
const title_radio_name = (0, $46MJV$depictaiutilishared.make_random_classname)();
|
|
3304
3153
|
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);
|
|
3305
3155
|
return (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
|
|
3306
3156
|
get when () {
|
|
3307
3157
|
return available_sortings_()?.length;
|
|
@@ -3333,14 +3183,14 @@ function $cc8aaf130b1dc1ea$export$1f1775a58da589b5({ available_sortings_: availa
|
|
|
3333
3183
|
},
|
|
3334
3184
|
children: (item, index)=>{
|
|
3335
3185
|
const is_checked = (0, $46MJV$solidjs.createMemo)(()=>{
|
|
3336
|
-
const sort =
|
|
3186
|
+
const sort = get_current_sorting();
|
|
3337
3187
|
if (!sort) // if no sortings are selected, "select" first sort
|
|
3338
3188
|
return index === 0;
|
|
3339
3189
|
return sort.field === item().field && (sort.order === item().order || item().meta.values?.length > 1);
|
|
3340
3190
|
});
|
|
3341
3191
|
return /* wrapping div for flex gap polyfill scss mixin */ (()=>{
|
|
3342
3192
|
const _el$8 = $cc8aaf130b1dc1ea$var$_tmpl$4.cloneNode(true), _el$9 = _el$8.firstChild, _el$10 = _el$9.firstChild, _el$11 = _el$10.nextSibling;
|
|
3343
|
-
(0, $46MJV$solidjsweb.addEventListener)(_el$10, "change", (0, $46MJV$depictaiutilishared.catchify)(()=>
|
|
3193
|
+
(0, $46MJV$solidjsweb.addEventListener)(_el$10, "change", (0, $46MJV$depictaiutilishared.catchify)(()=>set_current_sorting(item())));
|
|
3344
3194
|
(0, $46MJV$solidjsweb.setAttribute)(_el$10, "name", title_radio_name);
|
|
3345
3195
|
(0, $46MJV$solidjsweb.insert)(_el$9, ()=>item().meta.title, null);
|
|
3346
3196
|
(0, $46MJV$solidjsweb.effect)(()=>_el$10.checked = is_checked());
|
|
@@ -3352,27 +3202,25 @@ function $cc8aaf130b1dc1ea$export$1f1775a58da589b5({ available_sortings_: availa
|
|
|
3352
3202
|
})(),
|
|
3353
3203
|
(0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
|
|
3354
3204
|
get when () {
|
|
3355
|
-
return
|
|
3205
|
+
return meta_of_currently_selected_sorting()?.values?.length > 1;
|
|
3356
3206
|
},
|
|
3357
3207
|
get children () {
|
|
3358
3208
|
const _el$2 = $cc8aaf130b1dc1ea$var$_tmpl$2.cloneNode(true);
|
|
3359
3209
|
(0, $46MJV$solidjsweb.insert)(_el$2, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Index), {
|
|
3360
3210
|
get each () {
|
|
3361
|
-
return
|
|
3211
|
+
return meta_of_currently_selected_sorting()?.values;
|
|
3362
3212
|
},
|
|
3363
3213
|
children: (order_value, index)=>{
|
|
3214
|
+
const is_checked = (0, $46MJV$solidjs.createMemo)(()=>get_current_sorting()?.order === order_value());
|
|
3364
3215
|
return (()=>{
|
|
3365
3216
|
const _el$12 = $cc8aaf130b1dc1ea$var$_tmpl$4.cloneNode(true), _el$13 = _el$12.firstChild, _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling;
|
|
3366
|
-
(0, $46MJV$solidjsweb.addEventListener)(_el$14, "change", (0, $46MJV$depictaiutilishared.catchify)(()=>
|
|
3217
|
+
(0, $46MJV$solidjsweb.addEventListener)(_el$14, "change", (0, $46MJV$depictaiutilishared.catchify)(()=>set_current_sorting((c)=>c && {
|
|
3367
3218
|
...c,
|
|
3368
3219
|
order: order_value()
|
|
3369
3220
|
})));
|
|
3370
3221
|
(0, $46MJV$solidjsweb.setAttribute)(_el$14, "name", order_radio_name);
|
|
3371
|
-
(0, $46MJV$solidjsweb.insert)(_el$13, ()=>
|
|
3372
|
-
(0, $46MJV$solidjsweb.effect)(()=>_el$14.checked = (
|
|
3373
|
-
const sort = current_sorting_[0]();
|
|
3374
|
-
return sort?.order === order_value();
|
|
3375
|
-
})());
|
|
3222
|
+
(0, $46MJV$solidjsweb.insert)(_el$13, ()=>meta_of_currently_selected_sorting()?.names?.[index], null);
|
|
3223
|
+
(0, $46MJV$solidjsweb.effect)(()=>_el$14.checked = is_checked());
|
|
3376
3224
|
return _el$12;
|
|
3377
3225
|
})();
|
|
3378
3226
|
}
|
|
@@ -3717,12 +3565,167 @@ function $66ddbcbc40487f95$export$9bf11afa910f536e({ args_for_sorting_: args_for
|
|
|
3717
3565
|
|
|
3718
3566
|
|
|
3719
3567
|
|
|
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
|
+
|
|
3720
3717
|
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);
|
|
3721
3718
|
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_ }) {
|
|
3722
3719
|
return (0, $0f2f58dd60b11888$export$b69d0d92862de18b)({
|
|
3723
3720
|
severity_: "error",
|
|
3724
3721
|
message_: "Sorting and filters failed",
|
|
3725
3722
|
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
|
+
});
|
|
3726
3729
|
const cleanup_promise = new Promise((r)=>(0, $46MJV$solidjs.onCleanup)(r));
|
|
3727
3730
|
const [filters_open, set_filters_open] = search_filters_open_;
|
|
3728
3731
|
const [sorting_open, set_sorting_open] = search_sorting_open_;
|
|
@@ -4093,6 +4096,166 @@ function $fd64465f894d1f29$var$ActualFloatingButtons({ search_filters_open_: [ge
|
|
|
4093
4096
|
|
|
4094
4097
|
|
|
4095
4098
|
|
|
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
|
+
|
|
4096
4259
|
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);
|
|
4097
4260
|
function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_data , on_crumb_click_: on_crumb_click_ , i18n_: i18n_ }) {
|
|
4098
4261
|
const placeholder_crumb_data = [
|
|
@@ -4110,11 +4273,20 @@ function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4110
4273
|
get each () {
|
|
4111
4274
|
return crumb_data();
|
|
4112
4275
|
},
|
|
4113
|
-
children: (
|
|
4276
|
+
children: (unmodified_display_accessor, index)=>{
|
|
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
|
+
});
|
|
4114
4286
|
return [
|
|
4115
4287
|
(0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
|
|
4116
4288
|
get when () {
|
|
4117
|
-
return
|
|
4289
|
+
return modified_display_accessor();
|
|
4118
4290
|
},
|
|
4119
4291
|
get fallback () {
|
|
4120
4292
|
return (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$depictaiutilishared.Placeholder), {
|
|
@@ -4124,9 +4296,9 @@ function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4124
4296
|
},
|
|
4125
4297
|
get children () {
|
|
4126
4298
|
const _el$2 = $495e9998757c5d32$var$_tmpl$2.cloneNode(true);
|
|
4127
|
-
(0, $46MJV$solidjsweb.addEventListener)(_el$2, "click", (0, $46MJV$depictaiutilishared.catchify)((ev)=>on_crumb_click_(ev,
|
|
4128
|
-
(0, $46MJV$solidjsweb.insert)(_el$2, ()=>
|
|
4129
|
-
(0, $46MJV$solidjsweb.effect)(()=>(0, $46MJV$solidjsweb.setAttribute)(_el$2, "href",
|
|
4299
|
+
(0, $46MJV$solidjsweb.addEventListener)(_el$2, "click", (0, $46MJV$depictaiutilishared.catchify)((ev)=>on_crumb_click_(ev, modified_display_accessor())), true);
|
|
4300
|
+
(0, $46MJV$solidjsweb.insert)(_el$2, ()=>modified_display_accessor().title);
|
|
4301
|
+
(0, $46MJV$solidjsweb.effect)(()=>(0, $46MJV$solidjsweb.setAttribute)(_el$2, "href", modified_display_accessor().page_url));
|
|
4130
4302
|
return _el$2;
|
|
4131
4303
|
}
|
|
4132
4304
|
}),
|
|
@@ -4163,7 +4335,9 @@ function $495e9998757c5d32$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4163
4335
|
|
|
4164
4336
|
|
|
4165
4337
|
|
|
4338
|
+
|
|
4166
4339
|
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";
|
|
4167
4341
|
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_ }) {
|
|
4168
4342
|
let scrolling_logic_ran_for_query_id = false;
|
|
4169
4343
|
let last_scroll_position;
|
|
@@ -4285,20 +4459,43 @@ function $cdc2c00c0a7da86e$export$466cdc317043f6cb({ quicklinks_data_: quicklink
|
|
|
4285
4459
|
get each () {
|
|
4286
4460
|
return place_holdey_quicklinks_data();
|
|
4287
4461
|
},
|
|
4288
|
-
children: (
|
|
4462
|
+
children: (unmodified_display_accessor, index)=>{
|
|
4289
4463
|
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
|
+
});
|
|
4290
4487
|
return (()=>{
|
|
4291
4488
|
const _el$3 = $cdc2c00c0a7da86e$var$_tmpl$3.cloneNode(true);
|
|
4292
4489
|
(0, $46MJV$solidjsweb.addEventListener)(_el$3, "click", (0, $46MJV$depictaiutilishared.catchify)((ev)=>{
|
|
4293
4490
|
if (is_selected() && !ev.metaKey && !ev.ctrlKey && !ev.button) ev.preventDefault();
|
|
4294
|
-
else if (
|
|
4491
|
+
else if (modified_display_accessor()) on_link_click_(ev, modified_display_accessor());
|
|
4295
4492
|
}), true);
|
|
4296
|
-
(0, $46MJV$solidjsweb.insert)(_el$3, ()=>
|
|
4493
|
+
(0, $46MJV$solidjsweb.insert)(_el$3, ()=>modified_display_accessor()?.title || (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$depictaiutilishared.Placeholder), {
|
|
4297
4494
|
height: "1em",
|
|
4298
4495
|
width: "10ch"
|
|
4299
4496
|
}));
|
|
4300
4497
|
(0, $46MJV$solidjsweb.effect)((_p$)=>{
|
|
4301
|
-
const _v$ = !!is_selected(), _v$2 =
|
|
4498
|
+
const _v$ = !!is_selected(), _v$2 = modified_display_accessor()?.page_url || "javascript:void(0)";
|
|
4302
4499
|
_v$ !== _p$._v$ && _el$3.classList.toggle("selected", _p$._v$ = _v$);
|
|
4303
4500
|
_v$2 !== _p$._v$2 && (0, $46MJV$solidjsweb.setAttribute)(_el$3, "href", _p$._v$2 = _v$2);
|
|
4304
4501
|
return _p$;
|
|
@@ -4473,6 +4670,7 @@ let $29b757e2ae26852c$export$44dad306455dddf;
|
|
|
4473
4670
|
})($29b757e2ae26852c$export$44dad306455dddf || ($29b757e2ae26852c$export$44dad306455dddf = {}));
|
|
4474
4671
|
|
|
4475
4672
|
|
|
4673
|
+
|
|
4476
4674
|
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);
|
|
4477
4675
|
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_ }) {
|
|
4478
4676
|
let results_for;
|
|
@@ -4495,6 +4693,26 @@ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4495
4693
|
const first_result_in_viewport_ = (0, $46MJV$solidjs.createSignal)();
|
|
4496
4694
|
const last_result_in_viewport_ = (0, $46MJV$solidjs.createSignal)();
|
|
4497
4695
|
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
|
+
});
|
|
4498
4716
|
const query_base_ = (0, $08349e39f239a034$export$210f130a61ac1e8d)(()=>{
|
|
4499
4717
|
const sort_obj = get_sorting() && {
|
|
4500
4718
|
...get_sorting()
|
|
@@ -4526,6 +4744,7 @@ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4526
4744
|
} : {}
|
|
4527
4745
|
})
|
|
4528
4746
|
})));
|
|
4747
|
+
tracking_function_for_plp_results(plp_results_);
|
|
4529
4748
|
const available_sortings_ = (0, $46MJV$solidjs.createMemo)(()=>plp_results_()?.sorts?.map((sort)=>({
|
|
4530
4749
|
...sort,
|
|
4531
4750
|
order: sort.order ?? "desc"
|
|
@@ -4902,6 +5121,7 @@ function $f27b0b326e0a87e2$export$23fca46f3143581f(component, error_message) {
|
|
|
4902
5121
|
}
|
|
4903
5122
|
|
|
4904
5123
|
|
|
5124
|
+
|
|
4905
5125
|
const $068a627cc18f7bb6$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp category"></div>`, 2);
|
|
4906
5126
|
const $068a627cc18f7bb6$var$min_products_to_fetch_ = 20;
|
|
4907
5127
|
const $068a627cc18f7bb6$var$privately_shared_properties = /*@__PURE__*/ new WeakMap();
|
|
@@ -4947,17 +5167,20 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
|
|
|
4947
5167
|
$068a627cc18f7bb6$export$f34314aa9505732e.#has_been_constructed = true;
|
|
4948
5168
|
Object.assign(this, props_on_class); // set initial signal values
|
|
4949
5169
|
(0, $33815c5a406b6cc0$export$5162a71f252e6122)();
|
|
4950
|
-
const
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
5170
|
+
const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ } = (0, $49bdb822440abcec$export$7bcff1eb3eca57d7)();
|
|
5171
|
+
const [reset_history_state_, state_] = (0, $92acef13f7f7585b$export$90a2b6b3fb2a1455)({
|
|
5172
|
+
selected_filters_: selected_filters_,
|
|
5173
|
+
current_sorting_: current_sorting_,
|
|
5174
|
+
get_default_values_: ()=>({
|
|
5175
|
+
category_filters_open: false,
|
|
5176
|
+
category_sorting_open: false,
|
|
5177
|
+
category_expanded_filters: [],
|
|
5178
|
+
// 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
|
|
5179
|
+
category_local_filter_cache: [],
|
|
5180
|
+
category_expanded_hierarchical_filters: [],
|
|
5181
|
+
category_scroll_restoration_data: []
|
|
5182
|
+
})
|
|
5183
|
+
});
|
|
4961
5184
|
const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
|
|
4962
5185
|
const on_category_link_click_ = (e, d)=>{
|
|
4963
5186
|
if (e.button || e.metaKey || e.ctrlKey) // Not single page navigating because button is not 0 or ctrl/command click
|
|
@@ -4982,6 +5205,8 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
|
|
|
4982
5205
|
reset_history_state_: reset_history_state_,
|
|
4983
5206
|
depict_api_: api ?? new (0, $9ce64f69303c371e$export$e015ed2f2950f2e3)(),
|
|
4984
5207
|
on_category_link_click_: on_category_link_click_,
|
|
5208
|
+
selected_filters_: selected_filters_,
|
|
5209
|
+
current_sorting_: current_sorting_,
|
|
4985
5210
|
slider_arrow_button_: (0, $46MJV$depictaiutilishared.GenericSliderArrowButton)({
|
|
4986
5211
|
height_: 12,
|
|
4987
5212
|
width_: 6.46
|
|
@@ -4998,7 +5223,7 @@ function $068a627cc18f7bb6$export$e2bf8ce7779e827e({ depict_category: depict_cat
|
|
|
4998
5223
|
grid_spacing: grid_spacing.horizontal
|
|
4999
5224
|
};
|
|
5000
5225
|
return (0, $f27b0b326e0a87e2$export$23fca46f3143581f)(()=>{
|
|
5001
|
-
const { state_: { category_local_filter_cache: local_filter_cache_ ,
|
|
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_ , category_scroll_restoration_data: scroll_restoration_data_ } , current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , 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;
|
|
5002
5227
|
(0, $46MJV$solidjs.onCleanup)(reset_history_state_);
|
|
5003
5228
|
return (0, $671632478f2a7ce7$export$f7d2f673fc2f091d)({
|
|
5004
5229
|
tenant_: ()=>depict_category.merchant,
|
|
@@ -5352,14 +5577,15 @@ function $2989e355f64e18e1$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5352
5577
|
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
|
|
5353
5578
|
{
|
|
5354
5579
|
if (input_field.selectionStart === 0 && input_field.selectionEnd === input_field.value.length) // everything was selected, clear filters on next submit on next input
|
|
5355
|
-
input_field.addEventListener("input", (0, $46MJV$depictaiutilishared.catchify)(clear_filters_),
|
|
5580
|
+
input_field.addEventListener("input", (0, $46MJV$depictaiutilishared.catchify)(()=>clear_filters_(false)), // We don't count this as user triggered since it wasn't explicit
|
|
5581
|
+
{
|
|
5356
5582
|
once: true
|
|
5357
5583
|
});
|
|
5358
5584
|
}
|
|
5359
5585
|
}));
|
|
5360
5586
|
(0, $46MJV$solidjsweb.addEventListener)(_el$4, "input", (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
5361
5587
|
const { value: value } = input_field;
|
|
5362
|
-
if (!disabled_ && !value.length) clear_filters_(); // if the user clears the whole field, reset filters on next submit
|
|
5588
|
+
if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
|
|
5363
5589
|
search_field_value_[1](value);
|
|
5364
5590
|
}), true);
|
|
5365
5591
|
(0, $46MJV$solidjsweb.addEventListener)(_el$4, "keydown", (0, $46MJV$depictaiutilishared.catchify)((e)=>{
|
|
@@ -5385,7 +5611,7 @@ function $2989e355f64e18e1$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5385
5611
|
_el$4.classList.toggle("has-adjacent-back-button", !!on_back_);
|
|
5386
5612
|
(0, $46MJV$solidjsweb.addEventListener)(_el$5, "click", (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
5387
5613
|
search_field_value_[1]("");
|
|
5388
|
-
clear_filters_();
|
|
5614
|
+
clear_filters_(true);
|
|
5389
5615
|
if (disabled_) return;
|
|
5390
5616
|
input_field.focus();
|
|
5391
5617
|
}), true);
|
|
@@ -5603,27 +5829,27 @@ function $67b60b572b7b7059$export$b3ad617e9036868(modal_body_style, input_field,
|
|
|
5603
5829
|
|
|
5604
5830
|
|
|
5605
5831
|
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_ }) {
|
|
5606
|
-
const [get_selected_filters
|
|
5607
|
-
|
|
5832
|
+
const [get_selected_filters] = selected_filters_;
|
|
5833
|
+
// Possible values:
|
|
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
|
|
5608
5838
|
const [get_clear_filters_next_submit, set_clear_filters_next_submit] = clear_filters_next_submit_;
|
|
5609
|
-
const clear_filters = ()=>set_clear_filters_next_submit(
|
|
5839
|
+
const clear_filters = (user_triggered)=>set_clear_filters_next_submit(user_triggered ? 2 : 1);
|
|
5610
5840
|
(0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)(get_selected_filters, ()=>{
|
|
5611
5841
|
// if the selected filters update, clear the clearing signal
|
|
5612
|
-
set_clear_filters_next_submit(
|
|
5842
|
+
set_clear_filters_next_submit(0);
|
|
5613
5843
|
}, {
|
|
5614
5844
|
defer: true
|
|
5615
5845
|
}));
|
|
5616
5846
|
(0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)(get_search_query, (0, $46MJV$depictaiutilishared.catchify)(()=>{
|
|
5617
5847
|
// when a query was submitted, clear filters if clear was pressed before
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
// also collapse expanded filters in hierarchical filter tree again
|
|
5622
|
-
expanded_hierarchical_filters_[1]([]);
|
|
5623
|
-
// also clear sorting
|
|
5624
|
-
current_sorting_[1](undefined);
|
|
5848
|
+
const clear_value = (0, $46MJV$solidjs.untrack)(get_clear_filters_next_submit);
|
|
5849
|
+
if (clear_value) {
|
|
5850
|
+
set_clear_filters_next_submit(0);
|
|
5625
5851
|
(0, $92e4e7906daa1ff8$export$8895d39404bd2bb1)({
|
|
5626
|
-
user_triggered_:
|
|
5852
|
+
user_triggered_: clear_value === 2,
|
|
5627
5853
|
selected_filters_: selected_filters_,
|
|
5628
5854
|
i18n_: i18n_,
|
|
5629
5855
|
also_clear_sorting_: true,
|
|
@@ -7349,6 +7575,7 @@ function $246e3e89a097f014$export$828dcdd425fd3231(aligner) {
|
|
|
7349
7575
|
}
|
|
7350
7576
|
|
|
7351
7577
|
|
|
7578
|
+
|
|
7352
7579
|
const $79fbf145b15af988$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp search"></div>`, 2);
|
|
7353
7580
|
/**
|
|
7354
7581
|
* 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.
|
|
@@ -7361,7 +7588,7 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7361
7588
|
#market_signal = (0, $46MJV$solidjs.createSignal)();
|
|
7362
7589
|
#modal_open_signal = (0, $46MJV$solidjs.createSignal)(false);
|
|
7363
7590
|
static #has_been_constructed = false;
|
|
7364
|
-
constructor({ search_query_url_param_name: search_query_url_param_name = "
|
|
7591
|
+
constructor({ search_query_url_param_name: search_query_url_param_name = "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
|
|
7365
7592
|
disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , render_instant_card: render_instant_card , ...props_on_class }){
|
|
7366
7593
|
if ($79fbf145b15af988$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
|
|
7367
7594
|
Object.assign(this, props_on_class);
|
|
@@ -7383,19 +7610,22 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7383
7610
|
target_url.searchParams.set(search_param_name, new_search_query);
|
|
7384
7611
|
on_navigation(target_url.href);
|
|
7385
7612
|
});
|
|
7386
|
-
const
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7613
|
+
const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ } = (0, $49bdb822440abcec$export$7bcff1eb3eca57d7)();
|
|
7614
|
+
const [reset_history_state_, state_] = (0, $92acef13f7f7585b$export$90a2b6b3fb2a1455)({
|
|
7615
|
+
selected_filters_: selected_filters_,
|
|
7616
|
+
current_sorting_: current_sorting_,
|
|
7617
|
+
get_default_values_: ()=>({
|
|
7618
|
+
search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name) ?? "",
|
|
7619
|
+
search_filters_open: false,
|
|
7620
|
+
search_sorting_open: false,
|
|
7621
|
+
search_expanded_filters: [],
|
|
7622
|
+
// 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
|
|
7623
|
+
search_local_filter_cache: [],
|
|
7624
|
+
search_expanded_hierarchical_filters: [],
|
|
7625
|
+
search_showing_recommendation_rows: (0, $9f81b7ced87aabf2$export$1c8c715550dc689d),
|
|
7626
|
+
search_scroll_restoration_data: []
|
|
7627
|
+
})
|
|
7628
|
+
});
|
|
7399
7629
|
const search_query_updating_blocked_ = (0, $46MJV$solidjs.createSignal)(false);
|
|
7400
7630
|
const { [search_query_url_param_name]: raw_search_query_signal } = (0, $690220645373c65e$export$2542ffb77b620b02)({
|
|
7401
7631
|
[search_query_url_param_name]: ""
|
|
@@ -7417,9 +7647,9 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7417
7647
|
});
|
|
7418
7648
|
const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
|
|
7419
7649
|
const clear_filters_on_next_submit_ = (0, $8b282f736ce4f3b8$export$e026af0c7b64ea5f)({
|
|
7420
|
-
selected_filters_:
|
|
7650
|
+
selected_filters_: selected_filters_,
|
|
7421
7651
|
search_query_: search_query_signal_,
|
|
7422
|
-
current_sorting_:
|
|
7652
|
+
current_sorting_: current_sorting_,
|
|
7423
7653
|
expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
|
|
7424
7654
|
i18n_: i18n_,
|
|
7425
7655
|
local_filter_cache_: state_.search_local_filter_cache
|
|
@@ -7442,7 +7672,9 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7442
7672
|
configured_submit_query_: configured_submit_query_,
|
|
7443
7673
|
search_query_signal_: search_query_signal_,
|
|
7444
7674
|
i18n_: i18n_,
|
|
7445
|
-
search_query_updating_blocked_: search_query_updating_blocked_
|
|
7675
|
+
search_query_updating_blocked_: search_query_updating_blocked_,
|
|
7676
|
+
current_sorting_: current_sorting_,
|
|
7677
|
+
selected_filters_: selected_filters_
|
|
7446
7678
|
});
|
|
7447
7679
|
(0, $33815c5a406b6cc0$export$5162a71f252e6122)();
|
|
7448
7680
|
(0, $46MJV$depictaiutilishared.catchify)(async ()=>{
|
|
@@ -7469,7 +7701,7 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
|
|
|
7469
7701
|
min_products_to_fetch_: $79fbf145b15af988$var$min_products_to_fetch_,
|
|
7470
7702
|
render_instant_card_: render_instant_card,
|
|
7471
7703
|
render_instant_card_placeholder_: (0, $17c49340edfdbb31$export$ee1733d9a8495996),
|
|
7472
|
-
has_sort_or_filters_: (0, $46MJV$solidjs.createMemo)(()=>!!(Object.keys(
|
|
7704
|
+
has_sort_or_filters_: (0, $46MJV$solidjs.createMemo)(()=>!!(Object.keys(selected_filters_[0]())?.length || current_sorting_[0]()))
|
|
7473
7705
|
},
|
|
7474
7706
|
i18n_: i18n_,
|
|
7475
7707
|
enable_category_suggestions_: enable_category_suggestions,
|
|
@@ -7609,7 +7841,7 @@ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
7609
7841
|
});
|
|
7610
7842
|
});
|
|
7611
7843
|
},
|
|
7612
|
-
current_sorting_:
|
|
7844
|
+
current_sorting_: shared_properties.current_sorting_,
|
|
7613
7845
|
search_filters_open_: state_.search_filters_open,
|
|
7614
7846
|
search_sorting_open_: state_.search_sorting_open,
|
|
7615
7847
|
expanded_filters_: state_.search_expanded_filters,
|
|
@@ -7620,7 +7852,7 @@ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
7620
7852
|
});
|
|
7621
7853
|
} : false,
|
|
7622
7854
|
expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
|
|
7623
|
-
selected_filters_:
|
|
7855
|
+
selected_filters_: shared_properties.selected_filters_,
|
|
7624
7856
|
showing_recommendation_rows_: state_.search_showing_recommendation_rows,
|
|
7625
7857
|
scroll_restoration_data_: state_.search_scroll_restoration_data,
|
|
7626
7858
|
include_input_field_: include_input_field,
|