@depict-ai/ui 0.0.71 → 0.0.73
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 +19 -19
- package/dist/main.js +725 -412
- package/dist/module.js +727 -413
- package/jest.setup.js +7 -0
- package/package.json +6 -4
- package/dist/typescript_schema/BaseSearchRequest.d.ts +0 -197
- package/dist/typescript_schema/ProductListingQueriesRequest.d.ts +0 -14
- package/dist/typescript_schema/ProductListingQueriesResponse.d.ts +0 -10
- package/dist/typescript_schema/ProductListingRequest.d.ts +0 -221
- package/dist/typescript_schema/ProductListingResponse.d.ts +0 -232
- package/dist/typescript_schema/RecommendResponse.d.ts +0 -15
- package/dist/typescript_schema/SearchRequest.d.ts +0 -213
- package/dist/typescript_schema/SearchResponse.d.ts +0 -192
- package/dist/typescript_schema/SearchSuggestionsRequest.d.ts +0 -18
- package/dist/typescript_schema/SearchSuggestionsResponse.d.ts +0 -182
- package/dist/typescript_schema/TrackV2Request.d.ts +0 -115
package/dist/module.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {add_to_version_info as $g9l4l$add_to_version_info, fetch_recs as $g9l4l$fetch_recs, snakeCasifyObject as $g9l4l$snakeCasifyObject, GenericSliderArrowButton as $g9l4l$GenericSliderArrowButton, catchify as $g9l4l$catchify, base_url as $g9l4l$base_url, get_depict_id as $g9l4l$get_depict_id, get_user_id as $g9l4l$get_user_id, get_session_id as $g9l4l$get_session_id, dlog as $g9l4l$dlog, make_url_with_query_params as $g9l4l$make_url_with_query_params, fetch_retry as $g9l4l$fetch_retry, add_version_query_params as $g9l4l$add_version_query_params, sort_obj as $g9l4l$sort_obj, Tenant as $g9l4l$Tenant, Placeholder as $g9l4l$Placeholder, report as $g9l4l$report, javascript_media_query as $g9l4l$javascript_media_query, standard_price_format as $g9l4l$standard_price_format, deparallelize_no_drop as $g9l4l$deparallelize_no_drop, default_rr as $g9l4l$default_rr, make_random_classname as $g9l4l$make_random_classname, n_col_styling_with_dist as $g9l4l$n_col_styling_with_dist, observer as $g9l4l$observer, Lazyfier as $g9l4l$Lazyfier, queueMacroTask as $g9l4l$queueMacroTask, deparallelize as $g9l4l$deparallelize, Rec_Renderer as $g9l4l$Rec_Renderer, CrossIcon as $g9l4l$CrossIcon, useExpandingContainer as $g9l4l$useExpandingContainer, Amazing_Slider as $g9l4l$Amazing_Slider, slider_snap_css as $g9l4l$slider_snap_css, slider_fading_factory as $g9l4l$slider_fading_factory, MinusIcon as $g9l4l$MinusIcon, FilterIcon as $g9l4l$FilterIcon, SortIconAsc as $g9l4l$SortIconAsc, SortIconDesc as $g9l4l$SortIconDesc, PlusIcon as $g9l4l$PlusIcon, hsl_to_rgb as $g9l4l$hsl_to_rgb, relative_luminance_from_rgb as $g9l4l$relative_luminance_from_rgb, TickIcon as $g9l4l$TickIcon, ArrowUp as $g9l4l$ArrowUp, normal_get_product_id as $g9l4l$normal_get_product_id, ContainedPlaceholderImage as $g9l4l$ContainedPlaceholderImage, BackIcon as $g9l4l$BackIcon, SearchIcon as $g9l4l$SearchIcon, Layout as $g9l4l$Layout, make_placeholder_rr as $g9l4l$make_placeholder_rr, async_iterable_ipns as $g9l4l$async_iterable_ipns, make_asyncIterable_exiter as $g9l4l$make_asyncIterable_exiter, href_change_ipns as $g9l4l$href_change_ipns, depict_click as $g9l4l$depict_click, impression_track_element as $g9l4l$impression_track_element, add_new_tab_listener as $g9l4l$add_new_tab_listener, ContainedImage as $g9l4l$ContainedImage, buildThresholdList as $g9l4l$buildThresholdList, PreviousSearchIcon as $g9l4l$PreviousSearchIcon, insert_surfaces as $g9l4l$insert_surfaces
|
|
1
|
+
import {add_to_version_info as $g9l4l$add_to_version_info, fetch_recs as $g9l4l$fetch_recs, snakeCasifyObject as $g9l4l$snakeCasifyObject, GenericSliderArrowButton as $g9l4l$GenericSliderArrowButton, catchify as $g9l4l$catchify, base_url as $g9l4l$base_url, get_depict_id as $g9l4l$get_depict_id, get_user_id as $g9l4l$get_user_id, get_session_id as $g9l4l$get_session_id, dlog as $g9l4l$dlog, make_url_with_query_params as $g9l4l$make_url_with_query_params, fetch_retry as $g9l4l$fetch_retry, add_version_query_params as $g9l4l$add_version_query_params, sort_obj as $g9l4l$sort_obj, Tenant as $g9l4l$Tenant, Placeholder as $g9l4l$Placeholder, report as $g9l4l$report, javascript_media_query as $g9l4l$javascript_media_query, standard_price_format as $g9l4l$standard_price_format, deparallelize_no_drop as $g9l4l$deparallelize_no_drop, default_rr as $g9l4l$default_rr, make_random_classname as $g9l4l$make_random_classname, n_col_styling_with_dist as $g9l4l$n_col_styling_with_dist, observer as $g9l4l$observer, Lazyfier as $g9l4l$Lazyfier, queueMacroTask as $g9l4l$queueMacroTask, deparallelize as $g9l4l$deparallelize, Rec_Renderer as $g9l4l$Rec_Renderer, CrossIcon as $g9l4l$CrossIcon, useExpandingContainer as $g9l4l$useExpandingContainer, Amazing_Slider as $g9l4l$Amazing_Slider, slider_snap_css as $g9l4l$slider_snap_css, slider_fading_factory as $g9l4l$slider_fading_factory, MinusIcon as $g9l4l$MinusIcon, FilterIcon as $g9l4l$FilterIcon, SortIconAsc as $g9l4l$SortIconAsc, SortIconDesc as $g9l4l$SortIconDesc, PlusIcon as $g9l4l$PlusIcon, hsl_to_rgb as $g9l4l$hsl_to_rgb, relative_luminance_from_rgb as $g9l4l$relative_luminance_from_rgb, TickIcon as $g9l4l$TickIcon, ArrowUp as $g9l4l$ArrowUp, instant_exec_on_suspect_history_change as $g9l4l$instant_exec_on_suspect_history_change, normal_get_product_id as $g9l4l$normal_get_product_id, ContainedPlaceholderImage as $g9l4l$ContainedPlaceholderImage, BackIcon as $g9l4l$BackIcon, SearchIcon as $g9l4l$SearchIcon, Layout as $g9l4l$Layout, make_placeholder_rr as $g9l4l$make_placeholder_rr, async_iterable_ipns as $g9l4l$async_iterable_ipns, make_asyncIterable_exiter as $g9l4l$make_asyncIterable_exiter, href_change_ipns as $g9l4l$href_change_ipns, depict_click as $g9l4l$depict_click, impression_track_element as $g9l4l$impression_track_element, add_new_tab_listener as $g9l4l$add_new_tab_listener, ContainedImage as $g9l4l$ContainedImage, buildThresholdList as $g9l4l$buildThresholdList, PreviousSearchIcon as $g9l4l$PreviousSearchIcon, insert_surfaces as $g9l4l$insert_surfaces} from "@depict-ai/utilishared";
|
|
2
2
|
import {template as $g9l4l$template, insert as $g9l4l$insert, effect as $g9l4l$effect, setAttribute as $g9l4l$setAttribute, createComponent as $g9l4l$createComponent, use as $g9l4l$use, addEventListener as $g9l4l$addEventListener, delegateEvents as $g9l4l$delegateEvents, spread as $g9l4l$spread, classList as $g9l4l$classList, memo as $g9l4l$memo, style as $g9l4l$style, mergeProps as $g9l4l$mergeProps, className as $g9l4l$className} from "solid-js/web";
|
|
3
3
|
import {createSignal as $g9l4l$createSignal, onCleanup as $g9l4l$onCleanup, createComputed as $g9l4l$createComputed, createEffect as $g9l4l$createEffect, untrack as $g9l4l$untrack, batch as $g9l4l$batch, createResource as $g9l4l$createResource, createMemo as $g9l4l$createMemo, Show as $g9l4l$Show, createRenderEffect as $g9l4l$createRenderEffect, runWithOwner as $g9l4l$runWithOwner, createRoot as $g9l4l$createRoot, getOwner as $g9l4l$getOwner, createReaction as $g9l4l$createReaction, on as $g9l4l$on, ErrorBoundary as $g9l4l$ErrorBoundary, Index as $g9l4l$Index, For as $g9l4l$For} from "solid-js";
|
|
4
|
+
import {compressToBase64 as $g9l4l$compressToBase64, decompressFromBase64 as $g9l4l$decompressFromBase64} from "lz-string";
|
|
4
5
|
|
|
5
|
-
/*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.
|
|
6
|
+
/*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.73";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -56,10 +57,10 @@ function $014a147d094b0d08$var$history_state_change(signals, entries, state) {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
|
|
59
|
-
function $3075a4497054bec6$export$9862539c89138352(
|
|
60
|
-
const state = (0, $014a147d094b0d08$export$e183a13865960371)(
|
|
60
|
+
function $3075a4497054bec6$export$9862539c89138352(get_default_values_) {
|
|
61
|
+
const state = (0, $014a147d094b0d08$export$e183a13865960371)(get_default_values_());
|
|
61
62
|
const reset_state = ()=>{
|
|
62
|
-
const new_defaults =
|
|
63
|
+
const new_defaults = get_default_values_();
|
|
63
64
|
for(const key in state){
|
|
64
65
|
const new_value = new_defaults[key];
|
|
65
66
|
state[key][1](new_value);
|
|
@@ -2833,156 +2834,6 @@ var $7b224b353182ce9a$export$2e2bcd8739ae039 = {
|
|
|
2833
2834
|
|
|
2834
2835
|
|
|
2835
2836
|
|
|
2836
|
-
function $dd3727f29e682893$export$b288c38ae3fddb56({ available_filters_: available_filters_ , local_filter_cache_: [read_local_cache, write_local_cache] , selected_filters_: [read_selected_filters] }) {
|
|
2837
|
-
let last_remote_state;
|
|
2838
|
-
(0, $g9l4l$createComputed)(()=>{
|
|
2839
|
-
const remote_filters = Object.fromEntries(available_filters_()?.map((filter)=>[
|
|
2840
|
-
JSON.stringify([
|
|
2841
|
-
filter.field,
|
|
2842
|
-
filter.op,
|
|
2843
|
-
filter?.meta?.type
|
|
2844
|
-
]),
|
|
2845
|
-
filter
|
|
2846
|
-
]) || []);
|
|
2847
|
-
const local_filters = Object.fromEntries(read_local_cache().map((filter)=>[
|
|
2848
|
-
JSON.stringify([
|
|
2849
|
-
filter.field,
|
|
2850
|
-
filter.op,
|
|
2851
|
-
filter?.meta?.type
|
|
2852
|
-
]),
|
|
2853
|
-
filter
|
|
2854
|
-
]));
|
|
2855
|
-
const selected_filters = Object.fromEntries(read_selected_filters().map((filter_obj)=>[
|
|
2856
|
-
JSON.stringify([
|
|
2857
|
-
filter_obj.field,
|
|
2858
|
-
filter_obj.op
|
|
2859
|
-
]),
|
|
2860
|
-
filter_obj
|
|
2861
|
-
]));
|
|
2862
|
-
const new_local_filter_state = [];
|
|
2863
|
-
// 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
|
|
2864
|
-
for (const filter_id of [
|
|
2865
|
-
...Object.keys(local_filters).filter((key)=>!(key in remote_filters)),
|
|
2866
|
-
...Object.keys(remote_filters)
|
|
2867
|
-
]){
|
|
2868
|
-
const local_filter = local_filters[filter_id];
|
|
2869
|
-
const remote_filter = remote_filters[filter_id];
|
|
2870
|
-
const filter_id_without_meta_type = JSON.stringify(JSON.parse(filter_id).slice(0, 2));
|
|
2871
|
-
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
|
|
2872
|
-
{
|
|
2873
|
-
if (filter_id_without_meta_type in selected_filters) new_local_filter_state.push($dd3727f29e682893$var$modify_only_local_filter(local_filter, selected_filters[filter_id_without_meta_type]));
|
|
2874
|
-
} else if (!local_filter) // just take the remote one
|
|
2875
|
-
new_local_filter_state.push(remote_filter);
|
|
2876
|
-
else {
|
|
2877
|
-
// both exist, merge them if needed
|
|
2878
|
-
const remote_meta = remote_filter.meta;
|
|
2879
|
-
const local_meta = local_filter.meta;
|
|
2880
|
-
const this_applied_filter = selected_filters[filter_id_without_meta_type];
|
|
2881
|
-
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
|
|
2882
|
-
new_local_filter_state.push(remote_filter);
|
|
2883
|
-
else {
|
|
2884
|
-
const data_objs_in_remote = Object.fromEntries(remote_meta.values.map((value, index)=>[
|
|
2885
|
-
JSON.stringify(value),
|
|
2886
|
-
{
|
|
2887
|
-
value_: value,
|
|
2888
|
-
count_: remote_meta.counts?.[index],
|
|
2889
|
-
name_: remote_meta.names?.[index]
|
|
2890
|
-
}
|
|
2891
|
-
]));
|
|
2892
|
-
const data_objs_in_local = Object.fromEntries(local_meta.values.map((value, index)=>[
|
|
2893
|
-
JSON.stringify(value),
|
|
2894
|
-
{
|
|
2895
|
-
value_: value,
|
|
2896
|
-
count_: 0,
|
|
2897
|
-
name_: local_meta.names?.[index]
|
|
2898
|
-
}
|
|
2899
|
-
]));
|
|
2900
|
-
const new_data = [
|
|
2901
|
-
...Object.keys(data_objs_in_local).filter((key)=>{
|
|
2902
|
-
// put data entries that are selected and don't exist in new remote state first
|
|
2903
|
-
if (key in data_objs_in_remote) return false;
|
|
2904
|
-
const selected_values = this_applied_filter.data;
|
|
2905
|
-
return selected_values.some((value)=>{
|
|
2906
|
-
const is_equal = JSON.stringify(value) === key;
|
|
2907
|
-
if (is_equal) return true;
|
|
2908
|
-
if (local_meta.type === remote_meta.type && local_meta.type === "checkbox-hierarchical") {
|
|
2909
|
-
// 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.
|
|
2910
|
-
const selected_values = data_objs_in_local[key].value_;
|
|
2911
|
-
const values_length = value?.length;
|
|
2912
|
-
if (values_length > 1 && values_length - 1 === selected_values.length) {
|
|
2913
|
-
let is_parent = true;
|
|
2914
|
-
for(let i = 0; i < selected_values.length; i++)if (selected_values[i] !== value[i]) is_parent = false;
|
|
2915
|
-
return is_parent;
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
return false;
|
|
2919
|
-
});
|
|
2920
|
-
}).map((key)=>data_objs_in_local[key]),
|
|
2921
|
-
...Object.values(data_objs_in_remote)
|
|
2922
|
-
];
|
|
2923
|
-
const new_values = new_data.map(({ value_: value_ })=>value_);
|
|
2924
|
-
const result = {
|
|
2925
|
-
...remote_filter,
|
|
2926
|
-
meta: {
|
|
2927
|
-
...remote_filter.meta,
|
|
2928
|
-
values: new_values,
|
|
2929
|
-
names: new_data.map(({ name_: name_ })=>name_),
|
|
2930
|
-
counts: new_data.map(({ count_: count_ })=>count_)
|
|
2931
|
-
}
|
|
2932
|
-
};
|
|
2933
|
-
new_local_filter_state.push(result);
|
|
2934
|
-
}
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
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
|
|
2938
|
-
JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) // Sorry……… They're not that big
|
|
2939
|
-
write_local_cache(new_local_filter_state);
|
|
2940
|
-
last_remote_state = available_filters_();
|
|
2941
|
-
});
|
|
2942
|
-
return read_local_cache;
|
|
2943
|
-
}
|
|
2944
|
-
/**
|
|
2945
|
-
* 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.
|
|
2946
|
-
* This sets the counts to 0 (if applicable) and removes non-selected options (if applicable)
|
|
2947
|
-
*/ function $dd3727f29e682893$var$modify_only_local_filter(local_filter_object, selected_filter) {
|
|
2948
|
-
const old_meta = local_filter_object.meta;
|
|
2949
|
-
const selected_filter_data = selected_filter.data;
|
|
2950
|
-
const modified_filter_object = {
|
|
2951
|
-
...local_filter_object
|
|
2952
|
-
};
|
|
2953
|
-
if (old_meta) {
|
|
2954
|
-
const new_meta = {
|
|
2955
|
-
...old_meta
|
|
2956
|
-
};
|
|
2957
|
-
modified_filter_object.meta = new_meta;
|
|
2958
|
-
// set counts to 0
|
|
2959
|
-
if ("counts" in new_meta) {
|
|
2960
|
-
const counts = new_meta.counts;
|
|
2961
|
-
if (counts) new_meta.counts = counts.map(()=>0);
|
|
2962
|
-
}
|
|
2963
|
-
if (Array.isArray(selected_filter_data) && "values" in new_meta) {
|
|
2964
|
-
// we have an array of values and want to strip the ones from the available ones that aren't selected
|
|
2965
|
-
const values = new_meta.values;
|
|
2966
|
-
if (Array.isArray(values)) {
|
|
2967
|
-
const jsond_set_values = selected_filter_data.map((data)=>JSON.stringify(data));
|
|
2968
|
-
const indexes_to_remove = new Set();
|
|
2969
|
-
for(let i = 0; i < values.length; i++){
|
|
2970
|
-
const value = values[i];
|
|
2971
|
-
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
|
|
2972
|
-
indexes_to_remove.add(i);
|
|
2973
|
-
}
|
|
2974
|
-
new_meta.values = values.filter((_, index)=>!indexes_to_remove.has(index));
|
|
2975
|
-
if (new_meta.names) new_meta.names = new_meta.names.filter((_, index)=>!indexes_to_remove.has(index));
|
|
2976
|
-
if (new_meta.counts) // remove counts that are too much, they're all zero anyway if they exist
|
|
2977
|
-
new_meta.counts.length -= indexes_to_remove.size;
|
|
2978
|
-
}
|
|
2979
|
-
}
|
|
2980
|
-
}
|
|
2981
|
-
return modified_filter_object;
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
2837
|
|
|
2987
2838
|
|
|
2988
2839
|
|
|
@@ -3124,11 +2975,7 @@ function $8aff437d739a524d$export$3f1a388cc0d8fed7(props) {
|
|
|
3124
2975
|
});
|
|
3125
2976
|
}
|
|
3126
2977
|
function $8aff437d739a524d$var$ActualFilterBody(props) {
|
|
3127
|
-
const modified_available_filters_with_selected_unexisting_ones_injected_from_local_state =
|
|
3128
|
-
available_filters_: props.available_filters_,
|
|
3129
|
-
selected_filters_: props.selected_filters_,
|
|
3130
|
-
local_filter_cache_: props.local_filter_cache_
|
|
3131
|
-
});
|
|
2978
|
+
const [modified_available_filters_with_selected_unexisting_ones_injected_from_local_state] = props.local_filter_cache_;
|
|
3132
2979
|
const togglable_filters = (0, $g9l4l$createMemo)(()=>modified_available_filters_with_selected_unexisting_ones_injected_from_local_state().filter((item)=>item?.meta?.group_title));
|
|
3133
2980
|
const untogglable_filters = (0, $g9l4l$createMemo)(()=>modified_available_filters_with_selected_unexisting_ones_injected_from_local_state().filter((item)=>!item?.meta?.group_title));
|
|
3134
2981
|
const togglable_filters_grouped_by_collapsible = (0, $g9l4l$createMemo)(()=>{
|
|
@@ -3329,7 +3176,7 @@ function $8aff437d739a524d$var$ActualFilterBody(props) {
|
|
|
3329
3176
|
|
|
3330
3177
|
|
|
3331
3178
|
const $c23bd3d951eee1f2$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="sorting-attributes"></div>`, 2), $c23bd3d951eee1f2$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="sorting-direction"></div>`, 2), $c23bd3d951eee1f2$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div><div class="input-row"><input type="radio"><span class="custom-indicator"></span></div></div>`, 7), $c23bd3d951eee1f2$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div><label class="input-row"><input type="radio"><span class="custom-indicator"></span></label></div>`, 7);
|
|
3332
|
-
function $c23bd3d951eee1f2$export$1f1775a58da589b5({ available_sortings_: available_sortings_ , current_sorting_:
|
|
3179
|
+
function $c23bd3d951eee1f2$export$1f1775a58da589b5({ available_sortings_: available_sortings_ , current_sorting_: [get_current_sorting, set_current_sorting] , meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_ }) {
|
|
3333
3180
|
const title_radio_name = (0, $g9l4l$make_random_classname)();
|
|
3334
3181
|
const order_radio_name = (0, $g9l4l$make_random_classname)();
|
|
3335
3182
|
return (0, $g9l4l$createComponent)((0, $g9l4l$Show), {
|
|
@@ -3363,14 +3210,14 @@ function $c23bd3d951eee1f2$export$1f1775a58da589b5({ available_sortings_: availa
|
|
|
3363
3210
|
},
|
|
3364
3211
|
children: (item, index)=>{
|
|
3365
3212
|
const is_checked = (0, $g9l4l$createMemo)(()=>{
|
|
3366
|
-
const sort =
|
|
3213
|
+
const sort = get_current_sorting();
|
|
3367
3214
|
if (!sort) // if no sortings are selected, "select" first sort
|
|
3368
3215
|
return index === 0;
|
|
3369
3216
|
return sort.field === item().field && (sort.order === item().order || item().meta.values?.length > 1);
|
|
3370
3217
|
});
|
|
3371
3218
|
return /* wrapping div for flex gap polyfill scss mixin */ (()=>{
|
|
3372
3219
|
const _el$8 = $c23bd3d951eee1f2$var$_tmpl$4.cloneNode(true), _el$9 = _el$8.firstChild, _el$10 = _el$9.firstChild, _el$11 = _el$10.nextSibling;
|
|
3373
|
-
(0, $g9l4l$addEventListener)(_el$10, "change", (0, $g9l4l$catchify)(()=>
|
|
3220
|
+
(0, $g9l4l$addEventListener)(_el$10, "change", (0, $g9l4l$catchify)(()=>set_current_sorting(item())));
|
|
3374
3221
|
(0, $g9l4l$setAttribute)(_el$10, "name", title_radio_name);
|
|
3375
3222
|
(0, $g9l4l$insert)(_el$9, ()=>item().meta.title, null);
|
|
3376
3223
|
(0, $g9l4l$effect)(()=>_el$10.checked = is_checked());
|
|
@@ -3382,27 +3229,25 @@ function $c23bd3d951eee1f2$export$1f1775a58da589b5({ available_sortings_: availa
|
|
|
3382
3229
|
})(),
|
|
3383
3230
|
(0, $g9l4l$createComponent)((0, $g9l4l$Show), {
|
|
3384
3231
|
get when () {
|
|
3385
|
-
return
|
|
3232
|
+
return meta_of_currently_selected_sorting_()?.values?.length > 1;
|
|
3386
3233
|
},
|
|
3387
3234
|
get children () {
|
|
3388
3235
|
const _el$2 = $c23bd3d951eee1f2$var$_tmpl$2.cloneNode(true);
|
|
3389
3236
|
(0, $g9l4l$insert)(_el$2, (0, $g9l4l$createComponent)((0, $g9l4l$Index), {
|
|
3390
3237
|
get each () {
|
|
3391
|
-
return
|
|
3238
|
+
return meta_of_currently_selected_sorting_()?.values;
|
|
3392
3239
|
},
|
|
3393
3240
|
children: (order_value, index)=>{
|
|
3241
|
+
const is_checked = (0, $g9l4l$createMemo)(()=>get_current_sorting()?.order === order_value());
|
|
3394
3242
|
return (()=>{
|
|
3395
3243
|
const _el$12 = $c23bd3d951eee1f2$var$_tmpl$4.cloneNode(true), _el$13 = _el$12.firstChild, _el$14 = _el$13.firstChild, _el$15 = _el$14.nextSibling;
|
|
3396
|
-
(0, $g9l4l$addEventListener)(_el$14, "change", (0, $g9l4l$catchify)(()=>
|
|
3244
|
+
(0, $g9l4l$addEventListener)(_el$14, "change", (0, $g9l4l$catchify)(()=>set_current_sorting((c)=>c && {
|
|
3397
3245
|
...c,
|
|
3398
3246
|
order: order_value()
|
|
3399
3247
|
})));
|
|
3400
3248
|
(0, $g9l4l$setAttribute)(_el$14, "name", order_radio_name);
|
|
3401
|
-
(0, $g9l4l$insert)(_el$13, ()=>
|
|
3402
|
-
(0, $g9l4l$effect)(()=>_el$14.checked = (
|
|
3403
|
-
const sort = current_sorting_[0]();
|
|
3404
|
-
return sort?.order === order_value();
|
|
3405
|
-
})());
|
|
3249
|
+
(0, $g9l4l$insert)(_el$13, ()=>meta_of_currently_selected_sorting_()?.names?.[index], null);
|
|
3250
|
+
(0, $g9l4l$effect)(()=>_el$14.checked = is_checked());
|
|
3406
3251
|
return _el$12;
|
|
3407
3252
|
})();
|
|
3408
3253
|
}
|
|
@@ -3747,20 +3592,177 @@ function $fd7da6fb3e08aa40$export$9bf11afa910f536e({ args_for_sorting_: args_for
|
|
|
3747
3592
|
|
|
3748
3593
|
|
|
3749
3594
|
|
|
3595
|
+
|
|
3596
|
+
function $dd3727f29e682893$export$b288c38ae3fddb56({ available_filters_: available_filters_ , local_filter_cache_: [read_local_cache, write_local_cache] , selected_filters_: [read_selected_filters] }) {
|
|
3597
|
+
let last_remote_state;
|
|
3598
|
+
(0, $g9l4l$createComputed)(()=>{
|
|
3599
|
+
const remote_filters = Object.fromEntries(available_filters_()?.map((filter)=>[
|
|
3600
|
+
JSON.stringify([
|
|
3601
|
+
filter.field,
|
|
3602
|
+
filter.op,
|
|
3603
|
+
filter?.meta?.type
|
|
3604
|
+
]),
|
|
3605
|
+
filter
|
|
3606
|
+
]) || []);
|
|
3607
|
+
const local_filters = Object.fromEntries(read_local_cache().map((filter)=>[
|
|
3608
|
+
JSON.stringify([
|
|
3609
|
+
filter.field,
|
|
3610
|
+
filter.op,
|
|
3611
|
+
filter?.meta?.type
|
|
3612
|
+
]),
|
|
3613
|
+
filter
|
|
3614
|
+
]));
|
|
3615
|
+
const selected_filters = Object.fromEntries(read_selected_filters().map((filter_obj)=>[
|
|
3616
|
+
JSON.stringify([
|
|
3617
|
+
filter_obj.field,
|
|
3618
|
+
filter_obj.op
|
|
3619
|
+
]),
|
|
3620
|
+
filter_obj
|
|
3621
|
+
]));
|
|
3622
|
+
const new_local_filter_state = [];
|
|
3623
|
+
// 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
|
|
3624
|
+
for (const filter_id of [
|
|
3625
|
+
...Object.keys(local_filters).filter((key)=>!(key in remote_filters)),
|
|
3626
|
+
...Object.keys(remote_filters)
|
|
3627
|
+
]){
|
|
3628
|
+
const local_filter = local_filters[filter_id];
|
|
3629
|
+
const remote_filter = remote_filters[filter_id];
|
|
3630
|
+
const filter_id_without_meta_type = JSON.stringify(JSON.parse(filter_id).slice(0, 2));
|
|
3631
|
+
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
|
|
3632
|
+
{
|
|
3633
|
+
if (filter_id_without_meta_type in selected_filters) new_local_filter_state.push($dd3727f29e682893$var$modify_only_local_filter(local_filter, selected_filters[filter_id_without_meta_type]));
|
|
3634
|
+
} else if (!local_filter) // just take the remote one
|
|
3635
|
+
new_local_filter_state.push(remote_filter);
|
|
3636
|
+
else {
|
|
3637
|
+
// both exist, merge them if needed
|
|
3638
|
+
const remote_meta = remote_filter.meta;
|
|
3639
|
+
const local_meta = local_filter.meta;
|
|
3640
|
+
const this_applied_filter = selected_filters[filter_id_without_meta_type];
|
|
3641
|
+
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
|
|
3642
|
+
new_local_filter_state.push(remote_filter);
|
|
3643
|
+
else {
|
|
3644
|
+
const data_objs_in_remote = Object.fromEntries(remote_meta.values.map((value, index)=>[
|
|
3645
|
+
JSON.stringify(value),
|
|
3646
|
+
{
|
|
3647
|
+
value_: value,
|
|
3648
|
+
count_: remote_meta.counts?.[index],
|
|
3649
|
+
name_: remote_meta.names?.[index]
|
|
3650
|
+
}
|
|
3651
|
+
]));
|
|
3652
|
+
const data_objs_in_local = Object.fromEntries(local_meta.values.map((value, index)=>[
|
|
3653
|
+
JSON.stringify(value),
|
|
3654
|
+
{
|
|
3655
|
+
value_: value,
|
|
3656
|
+
count_: 0,
|
|
3657
|
+
name_: local_meta.names?.[index]
|
|
3658
|
+
}
|
|
3659
|
+
]));
|
|
3660
|
+
const new_data = [
|
|
3661
|
+
...Object.keys(data_objs_in_local).filter((key)=>{
|
|
3662
|
+
// put data entries that are selected and don't exist in new remote state first
|
|
3663
|
+
if (key in data_objs_in_remote) return false;
|
|
3664
|
+
const selected_values = this_applied_filter.data;
|
|
3665
|
+
return selected_values.some((value)=>{
|
|
3666
|
+
const is_equal = JSON.stringify(value) === key;
|
|
3667
|
+
if (is_equal) return true;
|
|
3668
|
+
if (local_meta.type === remote_meta.type && local_meta.type === "checkbox-hierarchical") {
|
|
3669
|
+
// 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.
|
|
3670
|
+
const selected_values = data_objs_in_local[key].value_;
|
|
3671
|
+
const values_length = value?.length;
|
|
3672
|
+
if (values_length > 1 && values_length - 1 === selected_values.length) {
|
|
3673
|
+
let is_parent = true;
|
|
3674
|
+
for(let i = 0; i < selected_values.length; i++)if (selected_values[i] !== value[i]) is_parent = false;
|
|
3675
|
+
return is_parent;
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
return false;
|
|
3679
|
+
});
|
|
3680
|
+
}).map((key)=>data_objs_in_local[key]),
|
|
3681
|
+
...Object.values(data_objs_in_remote)
|
|
3682
|
+
];
|
|
3683
|
+
const new_values = new_data.map(({ value_: value_ })=>value_);
|
|
3684
|
+
const result = {
|
|
3685
|
+
...remote_filter,
|
|
3686
|
+
meta: {
|
|
3687
|
+
...remote_filter.meta,
|
|
3688
|
+
values: new_values,
|
|
3689
|
+
names: new_data.map(({ name_: name_ })=>name_),
|
|
3690
|
+
counts: new_data.map(({ count_: count_ })=>count_)
|
|
3691
|
+
}
|
|
3692
|
+
};
|
|
3693
|
+
new_local_filter_state.push(result);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
}
|
|
3697
|
+
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
|
|
3698
|
+
JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) // Sorry……… They're not that big
|
|
3699
|
+
write_local_cache(new_local_filter_state);
|
|
3700
|
+
last_remote_state = available_filters_();
|
|
3701
|
+
});
|
|
3702
|
+
}
|
|
3703
|
+
/**
|
|
3704
|
+
* 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.
|
|
3705
|
+
* This sets the counts to 0 (if applicable) and removes non-selected options (if applicable)
|
|
3706
|
+
*/ function $dd3727f29e682893$var$modify_only_local_filter(local_filter_object, selected_filter) {
|
|
3707
|
+
const old_meta = local_filter_object.meta;
|
|
3708
|
+
const selected_filter_data = selected_filter.data;
|
|
3709
|
+
const modified_filter_object = {
|
|
3710
|
+
...local_filter_object
|
|
3711
|
+
};
|
|
3712
|
+
if (old_meta) {
|
|
3713
|
+
const new_meta = {
|
|
3714
|
+
...old_meta
|
|
3715
|
+
};
|
|
3716
|
+
modified_filter_object.meta = new_meta;
|
|
3717
|
+
// set counts to 0
|
|
3718
|
+
if ("counts" in new_meta) {
|
|
3719
|
+
const counts = new_meta.counts;
|
|
3720
|
+
if (counts) new_meta.counts = counts.map(()=>0);
|
|
3721
|
+
}
|
|
3722
|
+
if (Array.isArray(selected_filter_data) && "values" in new_meta) {
|
|
3723
|
+
// we have an array of values and want to strip the ones from the available ones that aren't selected
|
|
3724
|
+
const values = new_meta.values;
|
|
3725
|
+
if (Array.isArray(values)) {
|
|
3726
|
+
const jsond_set_values = selected_filter_data.map((data)=>JSON.stringify(data));
|
|
3727
|
+
const indexes_to_remove = new Set();
|
|
3728
|
+
for(let i = 0; i < values.length; i++){
|
|
3729
|
+
const value = values[i];
|
|
3730
|
+
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
|
|
3731
|
+
indexes_to_remove.add(i);
|
|
3732
|
+
}
|
|
3733
|
+
new_meta.values = values.filter((_, index)=>!indexes_to_remove.has(index));
|
|
3734
|
+
if (new_meta.names) new_meta.names = new_meta.names.filter((_, index)=>!indexes_to_remove.has(index));
|
|
3735
|
+
if (new_meta.counts) // remove counts that are too much, they're all zero anyway if they exist
|
|
3736
|
+
new_meta.counts.length -= indexes_to_remove.size;
|
|
3737
|
+
}
|
|
3738
|
+
}
|
|
3739
|
+
}
|
|
3740
|
+
return modified_filter_object;
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
|
|
3750
3744
|
const $bf7fe049e78f975a$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="filters"><div class="body"></div></div>`, 4), $bf7fe049e78f975a$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="sorting"><div class="body"></div></div>`, 4), $bf7fe049e78f975a$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="sort-and-filter-buttons"><div class="outer"><div class="inner"></div></div></div>`, 6), $bf7fe049e78f975a$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<span class="num-filters"></span>`, 2), $bf7fe049e78f975a$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="open-filters-button-container"><button class="filter toggle-button major-minor-transition" type="button"><span></span></button></div>`, 6), $bf7fe049e78f975a$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<button class="toggle-button for-sorting major-minor-transition"><span></span></button>`, 4);
|
|
3751
3745
|
function $bf7fe049e78f975a$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_ }) {
|
|
3752
3746
|
return (0, $a406ebe9523f192f$export$b69d0d92862de18b)({
|
|
3753
3747
|
severity_: "error",
|
|
3754
3748
|
message_: "Sorting and filters failed",
|
|
3755
3749
|
get children () {
|
|
3750
|
+
// 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
|
|
3751
|
+
(0, $dd3727f29e682893$export$b288c38ae3fddb56)({
|
|
3752
|
+
available_filters_: available_filters_,
|
|
3753
|
+
selected_filters_: selected_filters_,
|
|
3754
|
+
local_filter_cache_: local_filter_cache_
|
|
3755
|
+
});
|
|
3756
3756
|
const cleanup_promise = new Promise((r)=>(0, $g9l4l$onCleanup)(r));
|
|
3757
3757
|
const [filters_open, set_filters_open] = search_filters_open_;
|
|
3758
3758
|
const [sorting_open, set_sorting_open] = search_sorting_open_;
|
|
3759
|
+
const [get_current_sorting_] = current_sorting_;
|
|
3759
3760
|
const [is_small, set_is_small] = (0, $g9l4l$createSignal)(false);
|
|
3760
3761
|
const dismiss_modal_ = (0, $g9l4l$catchify)(()=>{
|
|
3761
3762
|
set_filters_open(false);
|
|
3762
3763
|
set_sorting_open(false);
|
|
3763
3764
|
});
|
|
3765
|
+
const meta_of_currently_selected_sorting_ = (0, $g9l4l$createMemo)(()=>available_sortings_()?.find?.((sorting)=>sorting.field === get_current_sorting_()?.field)?.meta);
|
|
3764
3766
|
const filter_options = {
|
|
3765
3767
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
3766
3768
|
local_filter_cache_: local_filter_cache_,
|
|
@@ -3771,7 +3773,8 @@ function $bf7fe049e78f975a$export$d7841e452f2e59a8({ current_sorting_: current_s
|
|
|
3771
3773
|
};
|
|
3772
3774
|
const sorting_options = {
|
|
3773
3775
|
current_sorting_: current_sorting_,
|
|
3774
|
-
available_sortings_: available_sortings_
|
|
3776
|
+
available_sortings_: available_sortings_,
|
|
3777
|
+
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
3775
3778
|
};
|
|
3776
3779
|
const make_open_filters_button = (adhere_to_width = false, is_tabbable = false)=>(0, $g9l4l$createComponent)($bf7fe049e78f975a$var$OpenFiltersButton, {
|
|
3777
3780
|
tabindex_: is_tabbable ? 0 : -1,
|
|
@@ -3784,11 +3787,12 @@ function $bf7fe049e78f975a$export$d7841e452f2e59a8({ current_sorting_: current_s
|
|
|
3784
3787
|
const make_open_sorting_button = (adhere_to_width = false, is_tabbable = false)=>(0, $g9l4l$createComponent)($bf7fe049e78f975a$var$OpenSortingButton, {
|
|
3785
3788
|
tabindex_: is_tabbable ? 0 : -1,
|
|
3786
3789
|
i18n_: i18n_,
|
|
3787
|
-
|
|
3790
|
+
get_current_sorting_: get_current_sorting_,
|
|
3788
3791
|
search_filters_open_: search_filters_open_,
|
|
3789
3792
|
search_sorting_open_: search_sorting_open_,
|
|
3790
3793
|
available_sortings_: available_sortings_,
|
|
3791
|
-
sort_button_width_: adhere_to_width ? sort_button_width_ : undefined
|
|
3794
|
+
sort_button_width_: adhere_to_width ? sort_button_width_ : undefined,
|
|
3795
|
+
meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
|
|
3792
3796
|
});
|
|
3793
3797
|
let open_modal_;
|
|
3794
3798
|
let close_modal_;
|
|
@@ -3916,7 +3920,7 @@ function $bf7fe049e78f975a$var$OpenFiltersButton({ i18n_: i18n_ , search_filters
|
|
|
3916
3920
|
return _el$8;
|
|
3917
3921
|
})();
|
|
3918
3922
|
}
|
|
3919
|
-
function $bf7fe049e78f975a$var$OpenSortingButton({ i18n_: i18n_ ,
|
|
3923
|
+
function $bf7fe049e78f975a$var$OpenSortingButton({ i18n_: i18n_ , get_current_sorting_: get_current_sorting_ , search_filters_open_: search_filters_open_ , available_sortings_: available_sortings_ , search_sorting_open_: search_sorting_open_ , sort_button_width_: sort_button_width_ , tabindex_: tabindex_ , meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_ }) {
|
|
3920
3924
|
const sorting_closed = (0, $g9l4l$createMemo)(()=>!search_sorting_open_[0]());
|
|
3921
3925
|
// We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
|
|
3922
3926
|
return (()=>{
|
|
@@ -3932,7 +3936,7 @@ function $bf7fe049e78f975a$var$OpenSortingButton({ i18n_: i18n_ , current_sortin
|
|
|
3932
3936
|
(0, $g9l4l$setAttribute)(_el$12, "tabindex", tabindex_);
|
|
3933
3937
|
(0, $g9l4l$insert)(_el$13, (()=>{
|
|
3934
3938
|
const _c$ = (0, $g9l4l$memo)(()=>!!sorting_closed());
|
|
3935
|
-
return ()=>_c$() && (
|
|
3939
|
+
return ()=>_c$() && (meta_of_currently_selected_sorting_()?.title || available_sortings_()?.[0]?.meta?.title) || i18n_.sorting_text_();
|
|
3936
3940
|
})());
|
|
3937
3941
|
(0, $g9l4l$insert)(_el$12, (0, $g9l4l$createComponent)((0, $g9l4l$Show), {
|
|
3938
3942
|
get when () {
|
|
@@ -3942,7 +3946,7 @@ function $bf7fe049e78f975a$var$OpenSortingButton({ i18n_: i18n_ , current_sortin
|
|
|
3942
3946
|
return (0, $g9l4l$createComponent)((0, $g9l4l$MinusIcon), {});
|
|
3943
3947
|
},
|
|
3944
3948
|
get children () {
|
|
3945
|
-
return (0, $g9l4l$memo)(()=>
|
|
3949
|
+
return (0, $g9l4l$memo)(()=>get_current_sorting_()?.order === "asc")() ? (0, $g9l4l$createComponent)((0, $g9l4l$SortIconAsc), {}) : (0, $g9l4l$createComponent)((0, $g9l4l$SortIconDesc), {});
|
|
3946
3950
|
}
|
|
3947
3951
|
}), null);
|
|
3948
3952
|
(0, $g9l4l$effect)((_p$)=>{
|
|
@@ -4123,8 +4127,157 @@ function $4a2667e8d77eb55a$var$ActualFloatingButtons({ search_filters_open_: [ge
|
|
|
4123
4127
|
|
|
4124
4128
|
|
|
4125
4129
|
|
|
4130
|
+
|
|
4131
|
+
|
|
4132
|
+
const $73294c7089bfc7c9$var$operator_map = {
|
|
4133
|
+
"eq": "≡",
|
|
4134
|
+
"neq": "≠",
|
|
4135
|
+
"in": "∈",
|
|
4136
|
+
"nin": "∉",
|
|
4137
|
+
"leq": "≤",
|
|
4138
|
+
"geq": "≥",
|
|
4139
|
+
"inrange": "\uD83D\uDD22"
|
|
4140
|
+
};
|
|
4141
|
+
const $73294c7089bfc7c9$var$sorting_query_param = "sorting";
|
|
4142
|
+
const $73294c7089bfc7c9$var$ascending_token = "\uD83D\uDCC8";
|
|
4143
|
+
const $73294c7089bfc7c9$var$descending_token = "\uD83D\uDCC9";
|
|
4144
|
+
const $73294c7089bfc7c9$var$filter_query_param_prefix = "filter_";
|
|
4145
|
+
const $73294c7089bfc7c9$var$range_delimiter = "-";
|
|
4146
|
+
const $73294c7089bfc7c9$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
|
|
4147
|
+
const $73294c7089bfc7c9$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
|
|
4148
|
+
const $73294c7089bfc7c9$var$empty_item_replacement = "0️⃣";
|
|
4149
|
+
/**
|
|
4150
|
+
* Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
|
|
4151
|
+
* The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
|
|
4152
|
+
* No deep or mixed nesting levels are supported.
|
|
4153
|
+
*/ function $73294c7089bfc7c9$var$array_is_serializable(array, is_root = true) {
|
|
4154
|
+
if (array.every((item)=>Array.isArray(item))) {
|
|
4155
|
+
if (!is_root) // Deeply nested arrays are not supported, but also don't exist as filters (yet)
|
|
4156
|
+
return false;
|
|
4157
|
+
return array.every((item)=>$73294c7089bfc7c9$var$array_is_serializable(item, false));
|
|
4158
|
+
}
|
|
4159
|
+
if (array.some((item)=>typeof item !== "string")) // Numbers are not supported, since 1 and "1" would encode to the same thing
|
|
4160
|
+
return false;
|
|
4161
|
+
// Encoding reserved characters is not supported
|
|
4162
|
+
return !array.some((item)=>item.includes($73294c7089bfc7c9$var$array_item_delimiter) || item.includes($73294c7089bfc7c9$var$string_item_delimiter) || item === $73294c7089bfc7c9$var$empty_item_replacement);
|
|
4163
|
+
}
|
|
4164
|
+
/**
|
|
4165
|
+
* Human readable string[] or string[][] serialization for URLs.
|
|
4166
|
+
* @param array
|
|
4167
|
+
* @returns
|
|
4168
|
+
*/ function $73294c7089bfc7c9$var$encode_array(array) {
|
|
4169
|
+
const is_nested = array.every((item)=>Array.isArray(item));
|
|
4170
|
+
if (is_nested) return array.map($73294c7089bfc7c9$var$encode_array).join($73294c7089bfc7c9$var$array_item_delimiter) + $73294c7089bfc7c9$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
|
|
4171
|
+
return array.map((item)=>item === "" ? $73294c7089bfc7c9$var$empty_item_replacement : item).join($73294c7089bfc7c9$var$string_item_delimiter);
|
|
4172
|
+
}
|
|
4173
|
+
function $73294c7089bfc7c9$var$decode_array(encoded_array) {
|
|
4174
|
+
const is_nested = encoded_array.includes($73294c7089bfc7c9$var$array_item_delimiter);
|
|
4175
|
+
if (is_nested) return encoded_array.split($73294c7089bfc7c9$var$array_item_delimiter).filter((s)=>s !== "") // Remove empty segments, caused by trailing delimiter
|
|
4176
|
+
.map($73294c7089bfc7c9$var$decode_array);
|
|
4177
|
+
return encoded_array.split($73294c7089bfc7c9$var$string_item_delimiter).filter((s)=>s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
|
|
4178
|
+
.map((item)=>item === $73294c7089bfc7c9$var$empty_item_replacement ? "" : item);
|
|
4179
|
+
}
|
|
4180
|
+
function $73294c7089bfc7c9$var$encode_filter_data(op, data) {
|
|
4181
|
+
if (data === "true") // boolean encoding
|
|
4182
|
+
return "1";
|
|
4183
|
+
if (data === "false") // boolean encoding
|
|
4184
|
+
return "0";
|
|
4185
|
+
const data_is_array = Array.isArray(data);
|
|
4186
|
+
if (op === "inrange" && data_is_array && data.every((item)=>typeof item === "number")) // numeric range filter encoding
|
|
4187
|
+
return data.join($73294c7089bfc7c9$var$range_delimiter);
|
|
4188
|
+
if (data_is_array && $73294c7089bfc7c9$var$array_is_serializable(data)) {
|
|
4189
|
+
const encoded_data = $73294c7089bfc7c9$var$encode_array(data);
|
|
4190
|
+
if (!encoded_data.includes($73294c7089bfc7c9$var$array_item_delimiter) && !encoded_data.includes($73294c7089bfc7c9$var$string_item_delimiter)) // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
|
|
4191
|
+
// In that case we add a delimiter suffix at the end
|
|
4192
|
+
return encoded_data + $73294c7089bfc7c9$var$string_item_delimiter;
|
|
4193
|
+
return encoded_data;
|
|
4194
|
+
}
|
|
4195
|
+
// Fallback encoding
|
|
4196
|
+
return (0, $g9l4l$compressToBase64)(JSON.stringify(data));
|
|
4197
|
+
}
|
|
4198
|
+
function $73294c7089bfc7c9$var$decode_filter_data(op, encoded_data) {
|
|
4199
|
+
if (encoded_data === "1") return "true";
|
|
4200
|
+
if (encoded_data === "0") return "false";
|
|
4201
|
+
if (op === "inrange" && encoded_data.includes($73294c7089bfc7c9$var$range_delimiter)) return encoded_data.split($73294c7089bfc7c9$var$range_delimiter).map((x)=>parseFloat(x));
|
|
4202
|
+
if (encoded_data.includes($73294c7089bfc7c9$var$string_item_delimiter) || encoded_data.includes($73294c7089bfc7c9$var$array_item_delimiter)) return $73294c7089bfc7c9$var$decode_array(encoded_data);
|
|
4203
|
+
try {
|
|
4204
|
+
return JSON.parse((0, $g9l4l$decompressFromBase64)(encoded_data));
|
|
4205
|
+
} catch (e) {
|
|
4206
|
+
(0, $g9l4l$dlog)("Failed to fallback parse filter data", op, encoded_data, e);
|
|
4207
|
+
}
|
|
4208
|
+
return null;
|
|
4209
|
+
}
|
|
4210
|
+
function $73294c7089bfc7c9$export$58aa3f171519b6d7(filters, search_params) {
|
|
4211
|
+
for (const filter of filters){
|
|
4212
|
+
const { field: field , op: op , data: data } = filter;
|
|
4213
|
+
const encoded_data = $73294c7089bfc7c9$var$encode_filter_data(op, data);
|
|
4214
|
+
search_params.set($73294c7089bfc7c9$var$filter_query_param_prefix + field + $73294c7089bfc7c9$var$operator_map[op], encoded_data);
|
|
4215
|
+
}
|
|
4216
|
+
}
|
|
4217
|
+
function $73294c7089bfc7c9$export$f934fa24c3a86811(search_params) {
|
|
4218
|
+
const found_filters = [];
|
|
4219
|
+
for (const key of search_params.keys()){
|
|
4220
|
+
if (!key.startsWith($73294c7089bfc7c9$var$filter_query_param_prefix)) continue;
|
|
4221
|
+
const encoded_data = search_params.get(key);
|
|
4222
|
+
if (!encoded_data) continue;
|
|
4223
|
+
for (const op of Object.keys($73294c7089bfc7c9$var$operator_map)){
|
|
4224
|
+
const token = $73294c7089bfc7c9$var$operator_map[op];
|
|
4225
|
+
if (!key.endsWith(token)) continue;
|
|
4226
|
+
const data = $73294c7089bfc7c9$var$decode_filter_data(op, encoded_data);
|
|
4227
|
+
if (!data) continue;
|
|
4228
|
+
const field = key.slice($73294c7089bfc7c9$var$filter_query_param_prefix.length, -token.length);
|
|
4229
|
+
found_filters.push({
|
|
4230
|
+
field: field,
|
|
4231
|
+
op: op,
|
|
4232
|
+
data: data
|
|
4233
|
+
});
|
|
4234
|
+
}
|
|
4235
|
+
}
|
|
4236
|
+
return found_filters;
|
|
4237
|
+
}
|
|
4238
|
+
function $73294c7089bfc7c9$export$62acb285a7579555(sorting, search_params) {
|
|
4239
|
+
if (!sorting) return;
|
|
4240
|
+
const { field: field , order: order } = sorting;
|
|
4241
|
+
const ascending = order === "asc";
|
|
4242
|
+
search_params.set($73294c7089bfc7c9$var$sorting_query_param, field + (ascending ? $73294c7089bfc7c9$var$ascending_token : $73294c7089bfc7c9$var$descending_token));
|
|
4243
|
+
}
|
|
4244
|
+
function $73294c7089bfc7c9$export$766e9676e74997d3(search_params) {
|
|
4245
|
+
const encoded_sorting = search_params.get($73294c7089bfc7c9$var$sorting_query_param);
|
|
4246
|
+
if (!encoded_sorting) return;
|
|
4247
|
+
if (encoded_sorting.endsWith($73294c7089bfc7c9$var$ascending_token)) return {
|
|
4248
|
+
field: encoded_sorting.slice(0, -$73294c7089bfc7c9$var$ascending_token.length),
|
|
4249
|
+
order: "asc"
|
|
4250
|
+
};
|
|
4251
|
+
if (encoded_sorting.endsWith($73294c7089bfc7c9$var$descending_token)) return {
|
|
4252
|
+
field: encoded_sorting.slice(0, -$73294c7089bfc7c9$var$descending_token.length),
|
|
4253
|
+
order: "desc"
|
|
4254
|
+
};
|
|
4255
|
+
(0, $g9l4l$dlog)("Invalid sorting query param value", encoded_sorting);
|
|
4256
|
+
return;
|
|
4257
|
+
}
|
|
4258
|
+
function $73294c7089bfc7c9$export$af4a870a0ee262c4(search_params) {
|
|
4259
|
+
// We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
|
|
4260
|
+
const keys = [
|
|
4261
|
+
...search_params.keys()
|
|
4262
|
+
];
|
|
4263
|
+
for (const key of keys)if (key.startsWith($73294c7089bfc7c9$var$filter_query_param_prefix) || key === $73294c7089bfc7c9$var$sorting_query_param) search_params.delete(key);
|
|
4264
|
+
}
|
|
4265
|
+
const $73294c7089bfc7c9$export$e2cf3f19dd3f8aac = "went_sideways_clear_filters";
|
|
4266
|
+
function $73294c7089bfc7c9$export$43cd1e747fecd42e(to_url, set_clearing_flag, from_search_params = new URLSearchParams(location.search)) {
|
|
4267
|
+
if (!to_url) return to_url;
|
|
4268
|
+
const was_url_object = to_url instanceof URL;
|
|
4269
|
+
const url_object = was_url_object ? to_url : new URL(to_url);
|
|
4270
|
+
const { searchParams: searchParams } = url_object;
|
|
4271
|
+
if (set_clearing_flag) searchParams.set($73294c7089bfc7c9$export$e2cf3f19dd3f8aac, "true");
|
|
4272
|
+
if (from_search_params.has($73294c7089bfc7c9$var$sorting_query_param)) searchParams.set($73294c7089bfc7c9$var$sorting_query_param, from_search_params.get($73294c7089bfc7c9$var$sorting_query_param));
|
|
4273
|
+
for (const key of from_search_params.keys())if (key.startsWith($73294c7089bfc7c9$var$filter_query_param_prefix)) searchParams.set(key, from_search_params.get(key));
|
|
4274
|
+
if (was_url_object) return url_object;
|
|
4275
|
+
return url_object.href;
|
|
4276
|
+
}
|
|
4277
|
+
|
|
4278
|
+
|
|
4126
4279
|
const $1b5a927e48d892a1$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<nav class="crumbs"></nav>`, 2), $1b5a927e48d892a1$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<a class="crumb"></a>`, 2), $1b5a927e48d892a1$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<span class="separator"></span>`, 2);
|
|
4127
|
-
function $1b5a927e48d892a1$export$5646050d516e06bc({ crumb_data_: get_api_crumb_data ,
|
|
4280
|
+
function $1b5a927e48d892a1$export$5646050d516e06bc({ crumb_data_: get_api_crumb_data , router_: router_ , i18n_: i18n_ }) {
|
|
4128
4281
|
const placeholder_crumb_data = [
|
|
4129
4282
|
,
|
|
4130
4283
|
,
|
|
@@ -4141,6 +4294,7 @@ function $1b5a927e48d892a1$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4141
4294
|
return crumb_data();
|
|
4142
4295
|
},
|
|
4143
4296
|
children: (display_accessor, index)=>{
|
|
4297
|
+
const href = (0, $g9l4l$createMemo)(()=>(0, $73294c7089bfc7c9$export$43cd1e747fecd42e)(display_accessor()?.page_url));
|
|
4144
4298
|
return [
|
|
4145
4299
|
(0, $g9l4l$createComponent)((0, $g9l4l$Show), {
|
|
4146
4300
|
get when () {
|
|
@@ -4154,9 +4308,13 @@ function $1b5a927e48d892a1$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4154
4308
|
},
|
|
4155
4309
|
get children () {
|
|
4156
4310
|
const _el$2 = $1b5a927e48d892a1$var$_tmpl$2.cloneNode(true);
|
|
4157
|
-
(0, $g9l4l$addEventListener)(_el$2, "click", (0, $g9l4l$catchify)((ev)=>
|
|
4311
|
+
(0, $g9l4l$addEventListener)(_el$2, "click", (0, $g9l4l$catchify)((ev)=>router_.navigate_.go_to_({
|
|
4312
|
+
new_url_: href(),
|
|
4313
|
+
is_replace_: false,
|
|
4314
|
+
event_: ev
|
|
4315
|
+
})), true);
|
|
4158
4316
|
(0, $g9l4l$insert)(_el$2, ()=>display_accessor().title);
|
|
4159
|
-
(0, $g9l4l$effect)(()=>(0, $g9l4l$setAttribute)(_el$2, "href",
|
|
4317
|
+
(0, $g9l4l$effect)(()=>(0, $g9l4l$setAttribute)(_el$2, "href", href()));
|
|
4160
4318
|
return _el$2;
|
|
4161
4319
|
}
|
|
4162
4320
|
}),
|
|
@@ -4193,8 +4351,9 @@ function $1b5a927e48d892a1$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
4193
4351
|
|
|
4194
4352
|
|
|
4195
4353
|
|
|
4354
|
+
|
|
4196
4355
|
const $6af87e1502f04aa3$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<nav class="quicklinks"></nav>`, 2), $6af87e1502f04aa3$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div>QuickLinks failed</div>`, 2), $6af87e1502f04aa3$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<a class="quicklink"></a>`, 2);
|
|
4197
|
-
function $6af87e1502f04aa3$export$466cdc317043f6cb({ quicklinks_data_: quicklinks_data_ ,
|
|
4356
|
+
function $6af87e1502f04aa3$export$466cdc317043f6cb({ quicklinks_data_: quicklinks_data_ , router_: router_ , current_query_id_: current_query_id_ , slider_arrow_button_: slider_arrow_button_ , breadcrumb_data_: breadcrumb_data_ , i18n_: i18n_ }) {
|
|
4198
4357
|
let scrolling_logic_ran_for_query_id = false;
|
|
4199
4358
|
let last_scroll_position;
|
|
4200
4359
|
let scroll_to_element_on_dom_insertion;
|
|
@@ -4317,18 +4476,37 @@ function $6af87e1502f04aa3$export$466cdc317043f6cb({ quicklinks_data_: quicklink
|
|
|
4317
4476
|
},
|
|
4318
4477
|
children: (display_accessor, index)=>{
|
|
4319
4478
|
const is_selected = (0, $g9l4l$createMemo)(()=>selected_index() === index);
|
|
4479
|
+
// Problem: if opening a sibling link in a new tab, filter clearing behavior is no longer consistent
|
|
4480
|
+
// Solution:
|
|
4481
|
+
// If id of current category is in quick links they're siblings, don't add state to the url
|
|
4482
|
+
// If it's not in it, it's a child of the current one, so add state
|
|
4483
|
+
// (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)
|
|
4484
|
+
// Problem: When you don't open a link in a new tab, we don't display the filter cleared toast
|
|
4485
|
+
// 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
|
|
4486
|
+
const is_sibling = (0, $g9l4l$createMemo)(()=>{
|
|
4487
|
+
const current_id = current_query_id_();
|
|
4488
|
+
return quicklinks_data_()?.some(({ query_id: query_id })=>query_id === current_id);
|
|
4489
|
+
});
|
|
4490
|
+
const href = (0, $g9l4l$createMemo)(()=>// 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
|
|
4491
|
+
(0, $73294c7089bfc7c9$export$43cd1e747fecd42e)(display_accessor()?.page_url, is_sibling()));
|
|
4320
4492
|
return (()=>{
|
|
4321
4493
|
const _el$3 = $6af87e1502f04aa3$var$_tmpl$3.cloneNode(true);
|
|
4322
4494
|
(0, $g9l4l$addEventListener)(_el$3, "click", (0, $g9l4l$catchify)((ev)=>{
|
|
4323
|
-
|
|
4324
|
-
|
|
4495
|
+
const url = href();
|
|
4496
|
+
if (is_selected() && !ev.metaKey && !ev.ctrlKey && !ev.button || !url) // allow open currently selected one in new tab but otherwise prevent clicks
|
|
4497
|
+
ev.preventDefault();
|
|
4498
|
+
else if (href()) router_.navigate_.go_to_({
|
|
4499
|
+
new_url_: url,
|
|
4500
|
+
is_replace_: false,
|
|
4501
|
+
event_: ev
|
|
4502
|
+
});
|
|
4325
4503
|
}), true);
|
|
4326
4504
|
(0, $g9l4l$insert)(_el$3, ()=>display_accessor()?.title || (0, $g9l4l$createComponent)((0, $g9l4l$Placeholder), {
|
|
4327
4505
|
height: "1em",
|
|
4328
4506
|
width: "10ch"
|
|
4329
4507
|
}));
|
|
4330
4508
|
(0, $g9l4l$effect)((_p$)=>{
|
|
4331
|
-
const _v$ = !!is_selected(), _v$2 =
|
|
4509
|
+
const _v$ = !!is_selected(), _v$2 = href();
|
|
4332
4510
|
_v$ !== _p$._v$ && _el$3.classList.toggle("selected", _p$._v$ = _v$);
|
|
4333
4511
|
_v$2 !== _p$._v$2 && (0, $g9l4l$setAttribute)(_el$3, "href", _p$._v$2 = _v$2);
|
|
4334
4512
|
return _p$;
|
|
@@ -4355,7 +4533,17 @@ function $6af87e1502f04aa3$export$466cdc317043f6cb({ quicklinks_data_: quicklink
|
|
|
4355
4533
|
|
|
4356
4534
|
|
|
4357
4535
|
|
|
4358
|
-
|
|
4536
|
+
|
|
4537
|
+
function $cb20e79516018342$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ , query_id_: query_id_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , plp_results_: plp_results_ }) {
|
|
4538
|
+
// If we just got opened in a new tab, clear filters instantly and remove the flag
|
|
4539
|
+
$cb20e79516018342$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
|
|
4540
|
+
plp_results_: plp_results_,
|
|
4541
|
+
local_filter_cache_: local_filter_cache_,
|
|
4542
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
4543
|
+
selected_filters_: selected_filters_,
|
|
4544
|
+
i18n_: i18n_
|
|
4545
|
+
});
|
|
4546
|
+
// Code below is for when we're already open and the user navigates to a new category
|
|
4359
4547
|
let previous_crumb_data = (0, $g9l4l$untrack)(crumb_data_);
|
|
4360
4548
|
let query_id_when_we_got_previous_data = (0, $g9l4l$untrack)(query_id_);
|
|
4361
4549
|
let allow_filter_clearing = true; // set to false when going backwards/forwards
|
|
@@ -4372,7 +4560,41 @@ function $2bdb723d3eb0e5b3$export$3fe6942dd2836d9d({ crumb_data_: crumb_data_ ,
|
|
|
4372
4560
|
const went_downwards = previous_length < new_length;
|
|
4373
4561
|
const shorter_array = went_upwards ? new_crumb_data : previous_crumb_data;
|
|
4374
4562
|
const longer_array = went_upwards ? previous_crumb_data : new_crumb_data;
|
|
4375
|
-
if (!((went_upwards || went_downwards) && shorter_array.every(({ query_id: query_id }, index)=>longer_array[index].query_id === query_id)))
|
|
4563
|
+
if (!((went_upwards || went_downwards) && shorter_array.every(({ query_id: query_id }, index)=>longer_array[index].query_id === query_id))) {
|
|
4564
|
+
// We went sideways, not up or down. Clear filters.
|
|
4565
|
+
(0, $af89070cc0052779$export$8895d39404bd2bb1)({
|
|
4566
|
+
user_triggered_: false,
|
|
4567
|
+
i18n_: i18n_,
|
|
4568
|
+
also_clear_sorting_: false,
|
|
4569
|
+
selected_filters_: selected_filters_,
|
|
4570
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
4571
|
+
local_filter_cache_: local_filter_cache_
|
|
4572
|
+
});
|
|
4573
|
+
// Also ensure we don't have `sideways_url_params_flag` set anymore
|
|
4574
|
+
const url = new URL(location.href);
|
|
4575
|
+
const { searchParams: searchParams } = url;
|
|
4576
|
+
if (searchParams.has((0, $73294c7089bfc7c9$export$e2cf3f19dd3f8aac))) {
|
|
4577
|
+
searchParams.delete((0, $73294c7089bfc7c9$export$e2cf3f19dd3f8aac));
|
|
4578
|
+
history.replaceState(history.state, "", url.href);
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4582
|
+
query_id_when_we_got_previous_data = query_id_of_new_data;
|
|
4583
|
+
previous_crumb_data = new_crumb_data;
|
|
4584
|
+
if (!allow_filter_clearing) allow_filter_clearing = true;
|
|
4585
|
+
})));
|
|
4586
|
+
}
|
|
4587
|
+
function $cb20e79516018342$var$clear_if_opened_new_tab_with_sideways_url_params_flag({ plp_results_: plp_results_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ }) {
|
|
4588
|
+
const tracking_function_for_plp_results = (0, $g9l4l$createReaction)(()=>{
|
|
4589
|
+
// 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
|
|
4590
|
+
const url_object = new URL(location.href);
|
|
4591
|
+
const { searchParams: searchParams } = url_object;
|
|
4592
|
+
if (searchParams.get((0, $73294c7089bfc7c9$export$e2cf3f19dd3f8aac)) !== "true") return;
|
|
4593
|
+
searchParams.delete((0, $73294c7089bfc7c9$export$e2cf3f19dd3f8aac));
|
|
4594
|
+
history.replaceState(history.state, "", url_object.href);
|
|
4595
|
+
(0, $g9l4l$dlog)("Flag to clear filters was set, clearing filters");
|
|
4596
|
+
(0, $g9l4l$queueMacroTask)(()=>{
|
|
4597
|
+
// Do it next task so that all the filters have time to populate
|
|
4376
4598
|
(0, $af89070cc0052779$export$8895d39404bd2bb1)({
|
|
4377
4599
|
user_triggered_: false,
|
|
4378
4600
|
i18n_: i18n_,
|
|
@@ -4381,11 +4603,9 @@ function $2bdb723d3eb0e5b3$export$3fe6942dd2836d9d({ crumb_data_: crumb_data_ ,
|
|
|
4381
4603
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
4382
4604
|
local_filter_cache_: local_filter_cache_
|
|
4383
4605
|
});
|
|
4384
|
-
}
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
if (!allow_filter_clearing) allow_filter_clearing = true;
|
|
4388
|
-
})));
|
|
4606
|
+
});
|
|
4607
|
+
});
|
|
4608
|
+
tracking_function_for_plp_results(plp_results_);
|
|
4389
4609
|
}
|
|
4390
4610
|
|
|
4391
4611
|
|
|
@@ -4504,7 +4724,7 @@ let $01115659405f3c64$export$44dad306455dddf;
|
|
|
4504
4724
|
|
|
4505
4725
|
|
|
4506
4726
|
const $1ae892b13d7746ab$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="product-count"> </div>`, 2), $1ae892b13d7746ab$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div></div>`, 2), $1ae892b13d7746ab$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="filter-results-for-one-row"></div>`, 2), $1ae892b13d7746ab$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict plp category"><div class="listing-page"></div></div>`, 4);
|
|
4507
|
-
function $1ae892b13d7746ab$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_ ,
|
|
4727
|
+
function $1ae892b13d7746ab$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_ , router_: router_ , 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_ }) {
|
|
4508
4728
|
let results_for;
|
|
4509
4729
|
let only_show_filters_opener_;
|
|
4510
4730
|
let middle_elements_;
|
|
@@ -4678,13 +4898,14 @@ function $1ae892b13d7746ab$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4678
4898
|
selected_filters_: selected_filters_,
|
|
4679
4899
|
available_filters_: available_filters_
|
|
4680
4900
|
});
|
|
4681
|
-
(0, $
|
|
4901
|
+
(0, $cb20e79516018342$export$3945d6db2dfd3d12)({
|
|
4682
4902
|
query_id_: query_id_,
|
|
4683
4903
|
crumb_data_: crumb_data_,
|
|
4684
4904
|
i18n_: i18n_,
|
|
4685
4905
|
selected_filters_: selected_filters_,
|
|
4686
4906
|
local_filter_cache_: local_filter_cache_,
|
|
4687
|
-
expanded_hierarchical_filters_: expanded_hierarchical_filters_
|
|
4907
|
+
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
4908
|
+
plp_results_: plp_results_
|
|
4688
4909
|
});
|
|
4689
4910
|
get_breadcrumb_accessor_?.(crumb_data_);
|
|
4690
4911
|
get_quicklinks_accessor_?.(quicklinks_data_);
|
|
@@ -4697,7 +4918,7 @@ function $1ae892b13d7746ab$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4697
4918
|
get children () {
|
|
4698
4919
|
return (0, $g9l4l$createComponent)((0, $1b5a927e48d892a1$export$5646050d516e06bc), {
|
|
4699
4920
|
crumb_data_: crumb_data_,
|
|
4700
|
-
|
|
4921
|
+
router_: router_,
|
|
4701
4922
|
i18n_: i18n_
|
|
4702
4923
|
});
|
|
4703
4924
|
}
|
|
@@ -4708,7 +4929,7 @@ function $1ae892b13d7746ab$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4708
4929
|
return (0, $g9l4l$createComponent)((0, $6af87e1502f04aa3$export$466cdc317043f6cb), {
|
|
4709
4930
|
quicklinks_data_: quicklinks_data_,
|
|
4710
4931
|
current_query_id_: query_id_,
|
|
4711
|
-
|
|
4932
|
+
router_: router_,
|
|
4712
4933
|
slider_arrow_button_: slider_arrow_button_,
|
|
4713
4934
|
breadcrumb_data_: crumb_data_,
|
|
4714
4935
|
i18n_: i18n_
|
|
@@ -4932,6 +5153,166 @@ function $c7f938ac40924f3b$export$23fca46f3143581f(component, error_message) {
|
|
|
4932
5153
|
}
|
|
4933
5154
|
|
|
4934
5155
|
|
|
5156
|
+
|
|
5157
|
+
|
|
5158
|
+
|
|
5159
|
+
function $b4291f5d2e6b2fae$export$7bcff1eb3eca57d7(router) {
|
|
5160
|
+
const current_sorting_ = (0, $g9l4l$createSignal)();
|
|
5161
|
+
const selected_filters_ = (0, $g9l4l$createSignal)([]);
|
|
5162
|
+
const [get_sorting, set_sorting] = current_sorting_;
|
|
5163
|
+
const [get_selected_filters, set_selected_filters] = selected_filters_;
|
|
5164
|
+
const [get_current_href, set_current_href] = (0, $g9l4l$createSignal)(location.href);
|
|
5165
|
+
const history_change_handler = ()=>set_current_href(location.href);
|
|
5166
|
+
const owner = (0, $g9l4l$getOwner)() || (0, $g9l4l$createRoot)(()=>(0, $g9l4l$getOwner)());
|
|
5167
|
+
let writer_started = false;
|
|
5168
|
+
(0, $g9l4l$instant_exec_on_suspect_history_change).add(history_change_handler);
|
|
5169
|
+
(0, $g9l4l$onCleanup)(()=>(0, $g9l4l$instant_exec_on_suspect_history_change).delete(history_change_handler));
|
|
5170
|
+
(0, $g9l4l$createComputed)(()=>{
|
|
5171
|
+
const { searchParams: searchParams } = new URL(get_current_href());
|
|
5172
|
+
(0, $g9l4l$batch)(()=>{
|
|
5173
|
+
const found_sorting = (0, $73294c7089bfc7c9$export$766e9676e74997d3)(searchParams);
|
|
5174
|
+
if (found_sorting) {
|
|
5175
|
+
const current_sorting = (0, $g9l4l$untrack)(get_sorting);
|
|
5176
|
+
// Do some diffing since we might assume in certain places of the code that if the signal changes it means the sorting has changed
|
|
5177
|
+
if (current_sorting?.field !== found_sorting.field || current_sorting?.order !== found_sorting.order) set_sorting(found_sorting);
|
|
5178
|
+
} else set_sorting();
|
|
5179
|
+
const found_filters = (0, $73294c7089bfc7c9$export$f934fa24c3a86811)(searchParams);
|
|
5180
|
+
const selected_filters = (0, $g9l4l$untrack)(get_selected_filters);
|
|
5181
|
+
const found_filters_map = new Map(found_filters.map(({ field: field , op: op , data: data })=>[
|
|
5182
|
+
JSON.stringify([
|
|
5183
|
+
field,
|
|
5184
|
+
op
|
|
5185
|
+
]),
|
|
5186
|
+
data
|
|
5187
|
+
]));
|
|
5188
|
+
// Sorry for this diffing algorithm lol. Looking forwards to Records and Tuples.
|
|
5189
|
+
if (selected_filters.length !== found_filters.length || !selected_filters.every(({ field: field , op: op , data: data })=>JSON.stringify(found_filters_map.get(JSON.stringify([
|
|
5190
|
+
field,
|
|
5191
|
+
op
|
|
5192
|
+
]))) === JSON.stringify(data))) set_selected_filters(found_filters);
|
|
5193
|
+
if (!writer_started) {
|
|
5194
|
+
// The owner here is the createComputed which gets disposed the next time the computation runs - but we actually just want to delay the start of the href_writer until our signals contain the current value of the URL, therefore the runWithOwner
|
|
5195
|
+
(0, $g9l4l$runWithOwner)(owner, ()=>$b4291f5d2e6b2fae$var$start_href_writer(get_sorting, get_selected_filters, router));
|
|
5196
|
+
writer_started = true;
|
|
5197
|
+
}
|
|
5198
|
+
});
|
|
5199
|
+
});
|
|
5200
|
+
return {
|
|
5201
|
+
current_sorting_: current_sorting_,
|
|
5202
|
+
selected_filters_: selected_filters_
|
|
5203
|
+
};
|
|
5204
|
+
}
|
|
5205
|
+
/**
|
|
5206
|
+
* Writes the sorting and filters to the URL query parameters when they change.
|
|
5207
|
+
*/ function $b4291f5d2e6b2fae$var$start_href_writer(get_sorting, get_selected_filters, router) {
|
|
5208
|
+
// 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)
|
|
5209
|
+
(0, $g9l4l$createComputed)((0, $g9l4l$on)([
|
|
5210
|
+
get_sorting,
|
|
5211
|
+
get_selected_filters
|
|
5212
|
+
], ([sorting, filters])=>{
|
|
5213
|
+
const current_href = location.href;
|
|
5214
|
+
const url_object = new URL(current_href);
|
|
5215
|
+
const { searchParams: searchParams } = url_object;
|
|
5216
|
+
(0, $73294c7089bfc7c9$export$af4a870a0ee262c4)(searchParams);
|
|
5217
|
+
(0, $73294c7089bfc7c9$export$62acb285a7579555)(sorting, searchParams);
|
|
5218
|
+
(0, $73294c7089bfc7c9$export$58aa3f171519b6d7)(filters, searchParams);
|
|
5219
|
+
// 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
|
|
5220
|
+
const unmodified_search_params = [
|
|
5221
|
+
...new URL(current_href).searchParams
|
|
5222
|
+
];
|
|
5223
|
+
const new_search_params = [
|
|
5224
|
+
...searchParams
|
|
5225
|
+
];
|
|
5226
|
+
// Having the array middle step because if we'd check the "size" property of the map the algorithm could be fooled if there were two query parameters with the same key
|
|
5227
|
+
const new_search_params_map = new Map(new_search_params);
|
|
5228
|
+
if (unmodified_search_params.length !== new_search_params.length || !unmodified_search_params.every(([key, value])=>new_search_params_map.get(key) === value)) // Only update URL if it actually changed
|
|
5229
|
+
router.navigate_.go_to_({
|
|
5230
|
+
is_replace_: true,
|
|
5231
|
+
new_url_: url_object.href,
|
|
5232
|
+
force_spa_navigation_: true
|
|
5233
|
+
});
|
|
5234
|
+
}, {
|
|
5235
|
+
defer: true
|
|
5236
|
+
}));
|
|
5237
|
+
}
|
|
5238
|
+
|
|
5239
|
+
|
|
5240
|
+
|
|
5241
|
+
class $cfa2761d36e5714c$export$7e1297a3a19f10d8 {
|
|
5242
|
+
#forced_default_on_navigation({ is_replace: is_replace , new_url: new_url }) {
|
|
5243
|
+
history[is_replace ? "replaceState" : "pushState"](history.state, "", new_url);
|
|
5244
|
+
}
|
|
5245
|
+
/**
|
|
5246
|
+
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
5247
|
+
*/ #throwing_on_navigation(...args) {
|
|
5248
|
+
const { on_navigation_: on_navigation_ } = this;
|
|
5249
|
+
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
5250
|
+
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
5251
|
+
try {
|
|
5252
|
+
return on_navigation_(...args);
|
|
5253
|
+
} catch (e) {
|
|
5254
|
+
queueMicrotask(()=>{
|
|
5255
|
+
throw e;
|
|
5256
|
+
});
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
5259
|
+
/**
|
|
5260
|
+
* Checks if this tab shouldn't navigate because user wants to open in new tab
|
|
5261
|
+
*/ #dont_attempt_navigation(ev) {
|
|
5262
|
+
return ev?.button || ev?.metaKey || ev?.ctrlKey;
|
|
5263
|
+
}
|
|
5264
|
+
/**
|
|
5265
|
+
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
5266
|
+
* This standardises waiting for all kinds of routers
|
|
5267
|
+
*/ #get_navigation_happened_promise(is_replace1) {
|
|
5268
|
+
return new Promise((resolve)=>{
|
|
5269
|
+
const handler = (what_happened)=>{
|
|
5270
|
+
if (what_happened === (is_replace1 ? "replaceState" : "pushState")) {
|
|
5271
|
+
resolve();
|
|
5272
|
+
(0, $g9l4l$instant_exec_on_suspect_history_change).delete(handler);
|
|
5273
|
+
}
|
|
5274
|
+
};
|
|
5275
|
+
(0, $g9l4l$instant_exec_on_suspect_history_change).add(handler);
|
|
5276
|
+
});
|
|
5277
|
+
}
|
|
5278
|
+
navigate_ = {
|
|
5279
|
+
/**
|
|
5280
|
+
* Call this if you *just* want to replace the state object in history.state
|
|
5281
|
+
*/ replace_state_: (new_state)=>{
|
|
5282
|
+
// This doesn't break any router, so we just do this directly for now, since many don't expose an interface for changing the state
|
|
5283
|
+
history.replaceState(new_state, "");
|
|
5284
|
+
},
|
|
5285
|
+
/**
|
|
5286
|
+
* Call this to change the URL
|
|
5287
|
+
* @param new_url_ new URL to go to
|
|
5288
|
+
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
5289
|
+
* @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
|
|
5290
|
+
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
5291
|
+
*/ go_to_: async ({ new_url_: new_url_ , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ })=>{
|
|
5292
|
+
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
5293
|
+
if (this.#dont_attempt_navigation(event_)) return;
|
|
5294
|
+
if (wants_hard_navigation && !force_spa_navigation_) {
|
|
5295
|
+
if (!event_) // If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
5296
|
+
location.assign(new_url_);
|
|
5297
|
+
return;
|
|
5298
|
+
}
|
|
5299
|
+
event_?.preventDefault();
|
|
5300
|
+
const promise = this.#get_navigation_happened_promise(true);
|
|
5301
|
+
const navigation_function = // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
5302
|
+
force_spa_navigation_ && wants_hard_navigation ? this.#forced_default_on_navigation : this.#throwing_on_navigation;
|
|
5303
|
+
navigation_function.call(this, {
|
|
5304
|
+
is_replace: is_replace_,
|
|
5305
|
+
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_)
|
|
5306
|
+
});
|
|
5307
|
+
await promise;
|
|
5308
|
+
}
|
|
5309
|
+
};
|
|
5310
|
+
constructor(on_navigation){
|
|
5311
|
+
this.on_navigation_ = on_navigation;
|
|
5312
|
+
}
|
|
5313
|
+
}
|
|
5314
|
+
|
|
5315
|
+
|
|
4935
5316
|
const $ec52ef1e6c117813$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict plp category"></div>`, 2);
|
|
4936
5317
|
const $ec52ef1e6c117813$var$min_products_to_fetch_ = 20;
|
|
4937
5318
|
const $ec52ef1e6c117813$var$privately_shared_properties = /*@__PURE__*/ new WeakMap();
|
|
@@ -4942,6 +5323,7 @@ const $ec52ef1e6c117813$var$InExternalAreaDiv = ({ children: children })=>(()=>
|
|
|
4942
5323
|
return _el$;
|
|
4943
5324
|
})();
|
|
4944
5325
|
class $ec52ef1e6c117813$export$f34314aa9505732e {
|
|
5326
|
+
#router = new (0, $cfa2761d36e5714c$export$7e1297a3a19f10d8)("hard_navigation");
|
|
4945
5327
|
#locale_signal = (0, $g9l4l$createSignal)();
|
|
4946
5328
|
#merchant_signal = (0, $g9l4l$createSignal)();
|
|
4947
5329
|
#market_signal = (0, $g9l4l$createSignal)();
|
|
@@ -4972,38 +5354,30 @@ class $ec52ef1e6c117813$export$f34314aa9505732e {
|
|
|
4972
5354
|
set market(market) {
|
|
4973
5355
|
this.#market_signal[1](market);
|
|
4974
5356
|
}
|
|
5357
|
+
get on_navigation() {
|
|
5358
|
+
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
5359
|
+
return this.#router.on_navigation_;
|
|
5360
|
+
}
|
|
5361
|
+
set on_navigation(new_function) {
|
|
5362
|
+
this.#router.on_navigation_ = new_function;
|
|
5363
|
+
}
|
|
4975
5364
|
constructor({ api: api , on_navigation: on_navigation , ...props_on_class }){
|
|
4976
5365
|
if ($ec52ef1e6c117813$export$f34314aa9505732e.#has_been_constructed) throw new Error("You can only have one instance of DepictCategory due to state limitations");
|
|
4977
5366
|
$ec52ef1e6c117813$export$f34314aa9505732e.#has_been_constructed = true;
|
|
4978
5367
|
Object.assign(this, props_on_class); // set initial signal values
|
|
4979
5368
|
(0, $2864fd26f57ff474$export$5162a71f252e6122)();
|
|
5369
|
+
if (on_navigation) this.#router.on_navigation_ = on_navigation;
|
|
5370
|
+
const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ } = (0, $b4291f5d2e6b2fae$export$7bcff1eb3eca57d7)(this.#router);
|
|
4980
5371
|
const [reset_history_state_, state_] = (0, $3075a4497054bec6$export$9862539c89138352)(()=>({
|
|
4981
|
-
category_sorting: undefined,
|
|
4982
5372
|
category_filters_open: false,
|
|
4983
5373
|
category_sorting_open: false,
|
|
4984
5374
|
category_expanded_filters: [],
|
|
4985
|
-
//
|
|
4986
|
-
category_selected_filters: [],
|
|
5375
|
+
// Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() 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
|
|
4987
5376
|
category_local_filter_cache: [],
|
|
4988
5377
|
category_expanded_hierarchical_filters: [],
|
|
4989
5378
|
category_scroll_restoration_data: []
|
|
4990
5379
|
}));
|
|
4991
5380
|
const i18n_ = (0, $0466953901b38f18$export$f091cbac892643a4)(this.#locale_signal[0]);
|
|
4992
|
-
const on_category_link_click_ = (e, d)=>{
|
|
4993
|
-
if (e.button || e.metaKey || e.ctrlKey) // Not single page navigating because button is not 0 or ctrl/command click
|
|
4994
|
-
return;
|
|
4995
|
-
try {
|
|
4996
|
-
const url_object = new URL(d.page_url);
|
|
4997
|
-
const relative_url = url_object.pathname + url_object.search + url_object.hash;
|
|
4998
|
-
on_navigation(relative_url, e, d);
|
|
4999
|
-
e.preventDefault();
|
|
5000
|
-
} catch (e) {
|
|
5001
|
-
queueMicrotask(()=>{
|
|
5002
|
-
// make sure to throw into the global scope if on_navigation throws
|
|
5003
|
-
throw e;
|
|
5004
|
-
});
|
|
5005
|
-
}
|
|
5006
|
-
};
|
|
5007
5381
|
$ec52ef1e6c117813$var$privately_shared_properties.set(this, {
|
|
5008
5382
|
state_: state_,
|
|
5009
5383
|
breadcrumb_signal_: (0, $g9l4l$createSignal)(),
|
|
@@ -5011,7 +5385,9 @@ class $ec52ef1e6c117813$export$f34314aa9505732e {
|
|
|
5011
5385
|
i18n_: i18n_,
|
|
5012
5386
|
reset_history_state_: reset_history_state_,
|
|
5013
5387
|
depict_api_: api ?? new (0, $3846bb34098c738f$export$e015ed2f2950f2e3)(),
|
|
5014
|
-
|
|
5388
|
+
router_: this.#router,
|
|
5389
|
+
selected_filters_: selected_filters_,
|
|
5390
|
+
current_sorting_: current_sorting_,
|
|
5015
5391
|
slider_arrow_button_: (0, $g9l4l$GenericSliderArrowButton)({
|
|
5016
5392
|
height_: 12,
|
|
5017
5393
|
width_: 6.46
|
|
@@ -5028,7 +5404,7 @@ function $ec52ef1e6c117813$export$e2bf8ce7779e827e({ depict_category: depict_cat
|
|
|
5028
5404
|
grid_spacing: grid_spacing.horizontal
|
|
5029
5405
|
};
|
|
5030
5406
|
return (0, $c7f938ac40924f3b$export$23fca46f3143581f)(()=>{
|
|
5031
|
-
const { state_: { category_local_filter_cache: local_filter_cache_ ,
|
|
5407
|
+
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_ , router_: router_ , breadcrumb_signal_: breadcrumb_signal_ , quicklinks_signal_: quicklinks_signal_ , slider_arrow_button_: slider_arrow_button_ } = shared_properties;
|
|
5032
5408
|
(0, $g9l4l$onCleanup)(reset_history_state_);
|
|
5033
5409
|
return (0, $1ae892b13d7746ab$export$f7d2f673fc2f091d)({
|
|
5034
5410
|
tenant_: ()=>depict_category.merchant,
|
|
@@ -5042,7 +5418,7 @@ function $ec52ef1e6c117813$export$e2bf8ce7779e827e({ depict_category: depict_cat
|
|
|
5042
5418
|
category_title_: category_title,
|
|
5043
5419
|
show_breadcrumbs_: show_breadcrumbs,
|
|
5044
5420
|
current_sorting_: current_sorting_,
|
|
5045
|
-
|
|
5421
|
+
router_: router_,
|
|
5046
5422
|
get_breadcrumb_accessor_: (accessor)=>(0, $g9l4l$createComputed)(()=>breadcrumb_signal_[1](accessor())),
|
|
5047
5423
|
get_quicklinks_accessor_: (accessor)=>(0, $g9l4l$createComputed)(()=>quicklinks_signal_[1](accessor())),
|
|
5048
5424
|
category_filters_open_: category_filters_open_,
|
|
@@ -5067,25 +5443,25 @@ function $ec52ef1e6c117813$export$e2bf8ce7779e827e({ depict_category: depict_cat
|
|
|
5067
5443
|
}, "Entire CategoryPage failed");
|
|
5068
5444
|
}
|
|
5069
5445
|
function $ec52ef1e6c117813$export$5b7c3ce0ebe51f86({ depict_category: depict_category }) {
|
|
5070
|
-
const { i18n_: i18n_ , breadcrumb_signal_: [crumb_data_] ,
|
|
5446
|
+
const { i18n_: i18n_ , breadcrumb_signal_: [crumb_data_] , router_: router_ } = $ec52ef1e6c117813$var$get_shared_properties(depict_category);
|
|
5071
5447
|
return (0, $g9l4l$createComponent)($ec52ef1e6c117813$var$InExternalAreaDiv, {
|
|
5072
5448
|
get children () {
|
|
5073
5449
|
return (0, $1b5a927e48d892a1$export$5646050d516e06bc)({
|
|
5074
5450
|
i18n_: i18n_,
|
|
5075
5451
|
crumb_data_: crumb_data_,
|
|
5076
|
-
|
|
5452
|
+
router_: router_
|
|
5077
5453
|
});
|
|
5078
5454
|
}
|
|
5079
5455
|
});
|
|
5080
5456
|
}
|
|
5081
5457
|
function $ec52ef1e6c117813$export$de035477d6fef996({ depict_category: depict_category }) {
|
|
5082
|
-
const { i18n_: i18n_ , quicklinks_signal_: [quicklinks_data_] , breadcrumb_signal_: [breadcrumb_data_] ,
|
|
5458
|
+
const { i18n_: i18n_ , quicklinks_signal_: [quicklinks_data_] , breadcrumb_signal_: [breadcrumb_data_] , router_: router_ , slider_arrow_button_: slider_arrow_button_ } = $ec52ef1e6c117813$var$get_shared_properties(depict_category);
|
|
5083
5459
|
return (0, $g9l4l$createComponent)($ec52ef1e6c117813$var$InExternalAreaDiv, {
|
|
5084
5460
|
get children () {
|
|
5085
5461
|
return (0, $6af87e1502f04aa3$export$466cdc317043f6cb)({
|
|
5086
5462
|
i18n_: i18n_,
|
|
5087
5463
|
quicklinks_data_: quicklinks_data_,
|
|
5088
|
-
|
|
5464
|
+
router_: router_,
|
|
5089
5465
|
current_query_id_: ()=>depict_category.category_id,
|
|
5090
5466
|
slider_arrow_button_: slider_arrow_button_,
|
|
5091
5467
|
breadcrumb_data_: breadcrumb_data_
|
|
@@ -5314,17 +5690,14 @@ function $aaacfac0064e97d9$export$ee1733d9a8495996() {
|
|
|
5314
5690
|
|
|
5315
5691
|
|
|
5316
5692
|
const $7a7079d66c12b788$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<span class="parent-title"></span>`, 2), $7a7079d66c12b788$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<a class="category-suggestion"><span class="title"></span></a>`, 4);
|
|
5317
|
-
function $7a7079d66c12b788$export$d757d54550ebfb3d({ category_suggestion_: category_suggestion_ ,
|
|
5693
|
+
function $7a7079d66c12b788$export$d757d54550ebfb3d({ category_suggestion_: category_suggestion_ , router_: router_ }) {
|
|
5318
5694
|
return (()=>{
|
|
5319
5695
|
const _el$ = $7a7079d66c12b788$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild;
|
|
5320
|
-
(0, $g9l4l$addEventListener)(_el$, "click", (0, $g9l4l$catchify)((e)=>{
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
return on_navigation_(category_suggestion_().page_url);
|
|
5326
|
-
}
|
|
5327
|
-
}), true);
|
|
5696
|
+
(0, $g9l4l$addEventListener)(_el$, "click", (0, $g9l4l$catchify)((e)=>router_.navigate_.go_to_({
|
|
5697
|
+
new_url_: category_suggestion_().page_url,
|
|
5698
|
+
is_replace_: false,
|
|
5699
|
+
event_: e
|
|
5700
|
+
})), true);
|
|
5328
5701
|
(0, $g9l4l$insert)(_el$2, ()=>category_suggestion_().title);
|
|
5329
5702
|
(0, $g9l4l$insert)(_el$, (0, $g9l4l$createComponent)((0, $g9l4l$Show), {
|
|
5330
5703
|
get when () {
|
|
@@ -5402,13 +5775,14 @@ function $6ded59a142c93078$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5402
5775
|
if (disabled_) // just in case. The field not actually being disabled when being disabled_ is so that you can focus it and open the modal. We don't want any of the other input-field-interaction features to work
|
|
5403
5776
|
return;
|
|
5404
5777
|
if (input_element.selectionStart === 0 && input_element.selectionEnd === input_element.value.length) // everything was selected, clear filters on next submit on next input
|
|
5405
|
-
input_element.addEventListener("input", (0, $g9l4l$catchify)(clear_filters_),
|
|
5778
|
+
input_element.addEventListener("input", (0, $g9l4l$catchify)(()=>clear_filters_(false)), // We don't count this as user triggered since it wasn't explicit
|
|
5779
|
+
{
|
|
5406
5780
|
once: true
|
|
5407
5781
|
});
|
|
5408
5782
|
}));
|
|
5409
5783
|
(0, $g9l4l$addEventListener)(_el$4, "input", (0, $g9l4l$catchify)(()=>{
|
|
5410
5784
|
const { value: value } = input_element;
|
|
5411
|
-
if (!disabled_ && !value.length) clear_filters_(); // if the user clears the whole field, reset filters on next submit
|
|
5785
|
+
if (!disabled_ && !value.length) clear_filters_(false); // if the user clears the whole field, reset filters on next submit
|
|
5412
5786
|
search_field_value_[1](value);
|
|
5413
5787
|
}), true);
|
|
5414
5788
|
(0, $g9l4l$addEventListener)(_el$4, "keydown", (0, $g9l4l$catchify)((e)=>{
|
|
@@ -5428,7 +5802,7 @@ function $6ded59a142c93078$export$b94867ecbd698f21({ search_field_value_: search
|
|
|
5428
5802
|
_el$4.classList.toggle("has-adjacent-back-button", !!on_back_);
|
|
5429
5803
|
(0, $g9l4l$addEventListener)(_el$5, "click", (0, $g9l4l$catchify)(()=>{
|
|
5430
5804
|
search_field_value_[1]("");
|
|
5431
|
-
clear_filters_();
|
|
5805
|
+
clear_filters_(true);
|
|
5432
5806
|
if (!disabled_) input_element.focus();
|
|
5433
5807
|
}), true);
|
|
5434
5808
|
(0, $g9l4l$insert)(_el$5, (0, $g9l4l$createComponent)((0, $g9l4l$CrossIcon), {}));
|
|
@@ -5646,27 +6020,27 @@ function $079defea521d5e2a$export$b3ad617e9036868(modal_body_style, input_field,
|
|
|
5646
6020
|
|
|
5647
6021
|
|
|
5648
6022
|
function $a0d89ff25220eb8d$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_ }) {
|
|
5649
|
-
const [get_selected_filters
|
|
5650
|
-
|
|
6023
|
+
const [get_selected_filters] = selected_filters_;
|
|
6024
|
+
// Possible values:
|
|
6025
|
+
// 0 - we should not clear next submit
|
|
6026
|
+
// 1 - we should clear next submit due to internal heuristics
|
|
6027
|
+
// 2 - we should clear next submit due to EXPLICIT user action (i.e. clear button pressed)
|
|
6028
|
+
const clear_filters_next_submit_ = (0, $g9l4l$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
|
|
5651
6029
|
const [get_clear_filters_next_submit, set_clear_filters_next_submit] = clear_filters_next_submit_;
|
|
5652
|
-
const clear_filters = ()=>set_clear_filters_next_submit(
|
|
6030
|
+
const clear_filters = (user_triggered)=>set_clear_filters_next_submit(user_triggered ? 2 : 1);
|
|
5653
6031
|
(0, $g9l4l$createComputed)((0, $g9l4l$on)(get_selected_filters, ()=>{
|
|
5654
6032
|
// if the selected filters update, clear the clearing signal
|
|
5655
|
-
set_clear_filters_next_submit(
|
|
6033
|
+
set_clear_filters_next_submit(0);
|
|
5656
6034
|
}, {
|
|
5657
6035
|
defer: true
|
|
5658
6036
|
}));
|
|
5659
6037
|
(0, $g9l4l$createComputed)((0, $g9l4l$on)(get_search_query, (0, $g9l4l$catchify)(()=>{
|
|
5660
6038
|
// when a query was submitted, clear filters if clear was pressed before
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
// also collapse expanded filters in hierarchical filter tree again
|
|
5665
|
-
expanded_hierarchical_filters_[1]([]);
|
|
5666
|
-
// also clear sorting
|
|
5667
|
-
current_sorting_[1](undefined);
|
|
6039
|
+
const clear_value = (0, $g9l4l$untrack)(get_clear_filters_next_submit);
|
|
6040
|
+
if (clear_value) {
|
|
6041
|
+
set_clear_filters_next_submit(0);
|
|
5668
6042
|
(0, $af89070cc0052779$export$8895d39404bd2bb1)({
|
|
5669
|
-
user_triggered_:
|
|
6043
|
+
user_triggered_: clear_value === 2,
|
|
5670
6044
|
selected_filters_: selected_filters_,
|
|
5671
6045
|
i18n_: i18n_,
|
|
5672
6046
|
also_clear_sorting_: true,
|
|
@@ -5711,26 +6085,8 @@ function $4d62f5daa51642fe$export$84bba84a7b837187(search_query) {
|
|
|
5711
6085
|
|
|
5712
6086
|
|
|
5713
6087
|
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
*/ function $972ebf2641490830$export$26df08e242fe83a3(url_param_name, value, url_transformer) {
|
|
5717
|
-
$972ebf2641490830$var$set_param(false, url_param_name, value, url_transformer);
|
|
5718
|
-
}
|
|
5719
|
-
function $972ebf2641490830$export$7a053411c76081d8(url_param_name, value, url_transformer) {
|
|
5720
|
-
$972ebf2641490830$var$set_param(true, url_param_name, value, url_transformer);
|
|
5721
|
-
}
|
|
5722
|
-
function $972ebf2641490830$var$set_param(replace, url_param_name, value, url_transformer) {
|
|
5723
|
-
const u_o = new URL(location.href);
|
|
5724
|
-
url_transformer?.(u_o);
|
|
5725
|
-
const { searchParams: searchParams } = u_o;
|
|
5726
|
-
if (value !== undefined) searchParams.set(url_param_name, value);
|
|
5727
|
-
else searchParams.delete(url_param_name);
|
|
5728
|
-
history[replace ? "replaceState" : "pushState"](history.state, "", u_o.href);
|
|
5729
|
-
}
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
function $7f6ddd9a7e868c4d$export$e16630ecb9644a1c({ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ , search_param_name_: search_param_name_ , search_field_value_: [read_field_value, write_field_value] , search_query_: [read_search_query] , url_transformer_: url_transformer_ , on_submit_: on_submit_ = (0, $972ebf2641490830$export$26df08e242fe83a3) , after_submit_: after_submit_ }) {
|
|
5733
|
-
const new_search_query = (0, $g9l4l$untrack)(read_field_value);
|
|
6088
|
+
async function $7f6ddd9a7e868c4d$export$e16630ecb9644a1c({ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ , search_param_name_: search_param_name_ , set_search_field_value_: set_search_field_value_ , search_query_: [read_search_query] , url_transformer_: url_transformer_ , router_: router_ , after_submit_: after_submit_ , get_new_query: get_new_query }) {
|
|
6089
|
+
const new_search_query = get_new_query();
|
|
5734
6090
|
const previous_query = (0, $g9l4l$untrack)(read_search_query);
|
|
5735
6091
|
if (previous_query === new_search_query && new URLSearchParams(location.search).has(search_param_name_)) {
|
|
5736
6092
|
// don't push a history entry / re-search if someone submits a search again
|
|
@@ -5738,9 +6094,16 @@ function $7f6ddd9a7e868c4d$export$e16630ecb9644a1c({ on_submit_with_unchanged_va
|
|
|
5738
6094
|
on_submit_with_unchanged_value_?.();
|
|
5739
6095
|
return;
|
|
5740
6096
|
}
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
6097
|
+
set_search_field_value_(previous_query); // restore the value to the previous query since this one goes to the new history entry
|
|
6098
|
+
const target_url = new URL(location.href);
|
|
6099
|
+
url_transformer_?.(target_url);
|
|
6100
|
+
target_url.searchParams.set(search_param_name_, new_search_query);
|
|
6101
|
+
await router_.navigate_.go_to_({
|
|
6102
|
+
new_url_: target_url,
|
|
6103
|
+
is_replace_: false,
|
|
6104
|
+
force_spa_navigation_: true
|
|
6105
|
+
});
|
|
6106
|
+
set_search_field_value_(new_search_query);
|
|
5744
6107
|
scrollTo(0, 0);
|
|
5745
6108
|
after_submit_?.();
|
|
5746
6109
|
}
|
|
@@ -5749,6 +6112,8 @@ function $7f6ddd9a7e868c4d$export$e16630ecb9644a1c({ on_submit_with_unchanged_va
|
|
|
5749
6112
|
|
|
5750
6113
|
|
|
5751
6114
|
function $4ad18a8b237ff7f6$export$2542ffb77b620b02(params_to_default_value) {
|
|
6115
|
+
// TODO: remove this abstraction, put it in same place as filters
|
|
6116
|
+
// TODO: make it only return an accessor
|
|
5752
6117
|
const signals = {};
|
|
5753
6118
|
const entries = Object.entries(params_to_default_value);
|
|
5754
6119
|
for (const [param, default_value] of entries)signals[param] = (0, $g9l4l$createSignal)(default_value ?? "");
|
|
@@ -6079,47 +6444,26 @@ function $ced3551536e52fa1$export$50b90be27d8502d9(el, [get_style_props, set_sty
|
|
|
6079
6444
|
|
|
6080
6445
|
|
|
6081
6446
|
|
|
6082
|
-
function $8fee64e5ff6fd014$export$91c3b6774e8be0f5({ param_: param_ , value_: value_ , url_transformer_: url_transformer_
|
|
6083
|
-
const [
|
|
6447
|
+
function $8fee64e5ff6fd014$export$91c3b6774e8be0f5({ param_: param_ , value_: value_ , url_transformer_: url_transformer_ }) {
|
|
6448
|
+
const [get_current_href, set_current_href] = (0, $g9l4l$createSignal)(location.href);
|
|
6084
6449
|
const [exit_iterable, exitable_iterable] = (0, $g9l4l$make_asyncIterable_exiter)((0, $g9l4l$href_change_ipns));
|
|
6085
6450
|
(0, $g9l4l$onCleanup)(exit_iterable);
|
|
6086
6451
|
(0, $g9l4l$catchify)(async ()=>{
|
|
6087
|
-
for await (const href of exitable_iterable)
|
|
6088
|
-
|
|
6089
|
-
const u_o = new URL(href);
|
|
6090
|
-
url_transformer_?.(u_o);
|
|
6091
|
-
u_o.searchParams.set(param_, value_);
|
|
6092
|
-
write_link(u_o.href);
|
|
6093
|
-
}
|
|
6452
|
+
for await (const href of exitable_iterable)// use native links so ppl can cmdclick/right click and open in new tab and see target URL
|
|
6453
|
+
set_current_href(href);
|
|
6094
6454
|
})();
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
on_submit_with_unchanged_value_?.();
|
|
6102
|
-
return;
|
|
6103
|
-
}
|
|
6104
|
-
set_search_field_value_((0, $g9l4l$untrack)(get_search_query_)); // fill in old query in previous history entry before making new one, like we do in submit_query
|
|
6105
|
-
if (typeof alternative_query_submitter_for_spas_ === "function") alternative_query_submitter_for_spas_(param_, value_, url_transformer_);
|
|
6106
|
-
else {
|
|
6107
|
-
history.pushState(history.state, "", (0, $g9l4l$untrack)((0, $g9l4l$catchify)(()=>read_link())));
|
|
6108
|
-
scrollTo(0, 0);
|
|
6109
|
-
}
|
|
6110
|
-
set_search_field_value_(value_);
|
|
6111
|
-
after_submit_?.();
|
|
6112
|
-
};
|
|
6113
|
-
return {
|
|
6114
|
-
read_link_: read_link,
|
|
6115
|
-
on_click_handler_: on_click_handler_
|
|
6116
|
-
};
|
|
6455
|
+
return (0, $g9l4l$createMemo)(()=>{
|
|
6456
|
+
const u_o = new URL(get_current_href());
|
|
6457
|
+
url_transformer_?.(u_o);
|
|
6458
|
+
u_o.searchParams.set(param_, value_());
|
|
6459
|
+
return u_o.href;
|
|
6460
|
+
});
|
|
6117
6461
|
}
|
|
6118
6462
|
|
|
6119
6463
|
|
|
6120
6464
|
|
|
6121
6465
|
const $dd44dd5f5011ac6f$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="previous-searches"><h2 class="text"></h2><div class="list"></div></div>`, 6), $dd44dd5f5011ac6f$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<a class="item"><div class="left"><span></span></div><button class="delete"></button></a>`, 8);
|
|
6122
|
-
function $dd44dd5f5011ac6f$export$a146ac6fa8346a25({ text_: text_ , previous_searches_: previous_searches_ , search_query_param_name_: search_query_param_name_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_unfiltered_previous_searches_: set_unfiltered_previous_searches_ ,
|
|
6466
|
+
function $dd44dd5f5011ac6f$export$a146ac6fa8346a25({ text_: text_ , previous_searches_: previous_searches_ , search_query_param_name_: search_query_param_name_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_unfiltered_previous_searches_: set_unfiltered_previous_searches_ , selected_index_: [read_selected_index_, write_selected_index_] , url_transformer_: url_transformer_ , i18n_: i18n_ , submit_query_: submit_query_ }) {
|
|
6123
6467
|
const has_entries = (0, $g9l4l$createMemo)(()=>previous_searches_().length >= 1);
|
|
6124
6468
|
currently_showing_suggestions_[1]((value)=>{
|
|
6125
6469
|
value[0] = (0, $g9l4l$createMemo)(()=>previous_searches_().map((result)=>({
|
|
@@ -6145,20 +6489,20 @@ function $dd44dd5f5011ac6f$export$a146ac6fa8346a25({ text_: text_ , previous_sea
|
|
|
6145
6489
|
return previous_searches_();
|
|
6146
6490
|
},
|
|
6147
6491
|
children: (item, index)=>{
|
|
6148
|
-
const
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
set_search_field_value_: search_field_value_[1],
|
|
6154
|
-
get_search_query_: get_search_query_,
|
|
6155
|
-
after_submit_: after_submit_,
|
|
6156
|
-
on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
|
|
6157
|
-
}));
|
|
6492
|
+
const href = (0, $8fee64e5ff6fd014$export$91c3b6774e8be0f5)({
|
|
6493
|
+
param_: search_query_param_name_,
|
|
6494
|
+
value_: item,
|
|
6495
|
+
url_transformer_: url_transformer_
|
|
6496
|
+
});
|
|
6158
6497
|
return (()=>{
|
|
6159
6498
|
const _el$4 = $dd44dd5f5011ac6f$var$_tmpl$2.cloneNode(true), _el$5 = _el$4.firstChild, _el$6 = _el$5.firstChild, _el$7 = _el$5.nextSibling;
|
|
6160
6499
|
(0, $g9l4l$use)((element)=>element.addEventListener(// Viskan's Oscar Jacobson site requires us to add the event listener normally here. They do too much when this element is clicked. We work around it by blocking the event and just dispatching it non-bubbling on this element.
|
|
6161
|
-
"click", (0, $g9l4l$catchify)((
|
|
6500
|
+
"click", (0, $g9l4l$catchify)((ev)=>{
|
|
6501
|
+
if (ev.button || ev.metaKey || ev.ctrlKey) // not button 0 or cmd/ctrl click
|
|
6502
|
+
return;
|
|
6503
|
+
ev.preventDefault();
|
|
6504
|
+
submit_query_(item());
|
|
6505
|
+
})), _el$4);
|
|
6162
6506
|
(0, $g9l4l$addEventListener)(_el$4, "mouseleave", (0, $g9l4l$catchify)(()=>write_selected_index_(undefined)));
|
|
6163
6507
|
(0, $g9l4l$addEventListener)(_el$4, "mouseenter", (0, $g9l4l$catchify)(()=>write_selected_index_([
|
|
6164
6508
|
0,
|
|
@@ -6183,7 +6527,7 @@ function $dd44dd5f5011ac6f$export$a146ac6fa8346a25({ text_: text_ , previous_sea
|
|
|
6183
6527
|
})), _el$7);
|
|
6184
6528
|
(0, $g9l4l$insert)(_el$7, (0, $g9l4l$createComponent)((0, $g9l4l$CrossIcon), {}));
|
|
6185
6529
|
(0, $g9l4l$effect)((_p$)=>{
|
|
6186
|
-
const _v$ = !!(0, $g9l4l$createMemo)(()=>read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)(), _v$2 =
|
|
6530
|
+
const _v$ = !!(0, $g9l4l$createMemo)(()=>read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)(), _v$2 = href(), _v$3 = i18n_.previous_searches_delete_entry_from_history_();
|
|
6187
6531
|
_v$ !== _p$._v$ && _el$4.classList.toggle("selected", _p$._v$ = _v$);
|
|
6188
6532
|
_v$2 !== _p$._v$2 && (0, $g9l4l$setAttribute)(_el$4, "href", _p$._v$2 = _v$2);
|
|
6189
6533
|
_v$3 !== _p$._v$3 && (0, $g9l4l$setAttribute)(_el$7, "title", _p$._v$3 = _v$3);
|
|
@@ -6282,41 +6626,34 @@ function $54eb3ff8b0c7c7b8$export$ba17c5b7e6dda39f({ whole_text_to_display_: who
|
|
|
6282
6626
|
|
|
6283
6627
|
|
|
6284
6628
|
const $f19e81a7eecb0aac$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<a class="suggestion"></a>`, 2), $f19e81a7eecb0aac$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="search-icon"></div>`, 2), $f19e81a7eecb0aac$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<span class="type"></span>`, 2), $f19e81a7eecb0aac$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div><span class="value"></span></div>`, 4), $f19e81a7eecb0aac$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<h2 class="text"></h2>`, 2), $f19e81a7eecb0aac$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="suggestion-container query"></div>`, 2), $f19e81a7eecb0aac$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="suggestion-container page"></div>`, 2), $f19e81a7eecb0aac$var$_tmpl$8 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="suggestions"></div>`, 2);
|
|
6285
|
-
function $f19e81a7eecb0aac$export$e872e2339fb04a7f({ suggestion_memo_: suggestion_memo_ ,
|
|
6629
|
+
function $f19e81a7eecb0aac$export$e872e2339fb04a7f({ suggestion_memo_: suggestion_memo_ , search_page_url_param_name_: search_page_url_param_name_ , selected_index_: [read_selected_index_, write_selected_index_] , url_transformer_: url_transformer_ , filtered_previous_searches_: filtered_previous_searches_ , currently_showing_suggestions_: currently_showing_suggestions_ , on_previous_searches_page_: on_previous_searches_page_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , searching_for_value_: searching_for_value_ , router_: router_ , submit_query_: submit_query_ }) {
|
|
6286
6630
|
const queries_memo = (0, $g9l4l$createMemo)(()=>suggestion_memo_().filter(({ type: type , title: title })=>type === (0, $c7bc9269d29d4bdc$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
6287
6631
|
));
|
|
6288
6632
|
const not_queries_memo = (0, $g9l4l$createMemo)(()=>suggestion_memo_().filter(({ type: type })=>type !== (0, $c7bc9269d29d4bdc$export$3cf9497e790da491)));
|
|
6289
6633
|
const render_entry = (input_obj, autocomplete_data_index, index, is_history = false)=>{
|
|
6290
6634
|
const is_query = (0, $g9l4l$createMemo)(()=>input_obj().type === (0, $c7bc9269d29d4bdc$export$3cf9497e790da491));
|
|
6291
|
-
const
|
|
6635
|
+
const href_with_changed_params_accessor = (0, $g9l4l$createMemo)(()=>is_query() ? (0, $8fee64e5ff6fd014$export$91c3b6774e8be0f5)({
|
|
6292
6636
|
param_: search_page_url_param_name_,
|
|
6293
|
-
value_: input_obj().title,
|
|
6294
|
-
url_transformer_: url_transformer_
|
|
6295
|
-
alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
|
|
6296
|
-
get_search_query_: get_search_query_,
|
|
6297
|
-
set_search_field_value_: search_field_value_[1],
|
|
6298
|
-
after_submit_: after_submit_,
|
|
6299
|
-
on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
|
|
6637
|
+
value_: (0, $g9l4l$createMemo)(()=>input_obj().title),
|
|
6638
|
+
url_transformer_: url_transformer_
|
|
6300
6639
|
}) : undefined);
|
|
6301
|
-
const
|
|
6302
|
-
(0, $g9l4l$createComputed)(()=>{
|
|
6303
|
-
const new_href = is_query() ? param_change_obj().read_link_() : input_obj().page_url;
|
|
6304
|
-
// href will first show up in a tick from input_obj() updating, we don't want to assign undefined in the meantime
|
|
6305
|
-
if (new_href) set_href(new_href);
|
|
6306
|
-
});
|
|
6640
|
+
const href = (0, $g9l4l$createMemo)(()=>is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
6307
6641
|
return (()=>{
|
|
6308
6642
|
const _el$ = $f19e81a7eecb0aac$var$_tmpl$.cloneNode(true);
|
|
6309
6643
|
(0, $g9l4l$use)((element)=>element.addEventListener("click", (0, $g9l4l$catchify)((ev)=>{
|
|
6310
6644
|
// Viskan's Oscar Jacobson site requires us to add the event listener normally here. They do too much when this element is clicked. We work around it by blocking the event and just dispatching it non-bubbling on this element.
|
|
6311
|
-
if (is_query())
|
|
6312
|
-
else if (navigate_page_to_href_) {
|
|
6313
|
-
// single page navigate to category suggestions if enabled
|
|
6314
|
-
// object should have a href where we want to go
|
|
6645
|
+
if (is_query()) {
|
|
6315
6646
|
if (ev.button || ev.metaKey || ev.ctrlKey) // not button 0 or cmd/ctrl click
|
|
6316
6647
|
return;
|
|
6317
6648
|
ev.preventDefault();
|
|
6318
|
-
|
|
6649
|
+
submit_query_(input_obj().title);
|
|
6650
|
+
return;
|
|
6319
6651
|
}
|
|
6652
|
+
router_.navigate_.go_to_({
|
|
6653
|
+
new_url_: input_obj().page_url,
|
|
6654
|
+
is_replace_: false,
|
|
6655
|
+
event_: ev
|
|
6656
|
+
});
|
|
6320
6657
|
})), _el$);
|
|
6321
6658
|
(0, $g9l4l$addEventListener)(_el$, "mouseleave", (0, $g9l4l$catchify)(()=>write_selected_index_(undefined)));
|
|
6322
6659
|
(0, $g9l4l$addEventListener)(_el$, "mouseenter", (0, $g9l4l$catchify)(()=>write_selected_index_([
|
|
@@ -6541,6 +6878,7 @@ function $a817d06dc1c5911c$export$217899a935ef803b({ selected_index_: [read_sele
|
|
|
6541
6878
|
}
|
|
6542
6879
|
};
|
|
6543
6880
|
// TODO: if selected item stops existing, remove it
|
|
6881
|
+
// Is above actually not done???
|
|
6544
6882
|
$a817d06dc1c5911c$var$actual_navigation_working_on_fake_data({
|
|
6545
6883
|
...rest_of_props,
|
|
6546
6884
|
last_suggestion_index_: last_suggestion_index_,
|
|
@@ -6548,7 +6886,7 @@ function $a817d06dc1c5911c$export$217899a935ef803b({ selected_index_: [read_sele
|
|
|
6548
6886
|
write_selected_fake_index_: write_selected_fake_index_
|
|
6549
6887
|
});
|
|
6550
6888
|
}
|
|
6551
|
-
function $a817d06dc1c5911c$var$actual_navigation_working_on_fake_data({ element_: element_ , search_field_value_: [get_search_field_value, set_search_field_value] , updating_blocked_: [read_updating_blocked, write_updating_blocked] , last_suggestion_index_: last_suggestion_index_ , read_selected_fake_index_: read_selected_fake_index_ , write_selected_fake_index_: write_selected_fake_index_ , set_override_on_enter_fn_: set_override_on_enter_fn_ ,
|
|
6889
|
+
function $a817d06dc1c5911c$var$actual_navigation_working_on_fake_data({ element_: element_ , search_field_value_: [get_search_field_value, set_search_field_value] , updating_blocked_: [read_updating_blocked, write_updating_blocked] , last_suggestion_index_: last_suggestion_index_ , read_selected_fake_index_: read_selected_fake_index_ , write_selected_fake_index_: write_selected_fake_index_ , set_override_on_enter_fn_: set_override_on_enter_fn_ , url_transformer_: url_transformer_ , search_query_param_name_: search_query_param_name_ , router_: router_ }) {
|
|
6552
6890
|
let previous_value;
|
|
6553
6891
|
(0, $g9l4l$createEffect)(()=>{
|
|
6554
6892
|
const sfv = get_search_field_value();
|
|
@@ -6586,6 +6924,7 @@ function $a817d06dc1c5911c$var$actual_navigation_working_on_fake_data({ element_
|
|
|
6586
6924
|
set_search_field_value(title);
|
|
6587
6925
|
override_on_enter_for_this_entry((e)=>{
|
|
6588
6926
|
// Open search query in new tab on cmd+enter
|
|
6927
|
+
// If it's not cmd+enter, pressing enter will just submit the value that was put into the field while selecting with the arrow keys ;)
|
|
6589
6928
|
const url = new URL(location);
|
|
6590
6929
|
url_transformer_?.(url);
|
|
6591
6930
|
url.searchParams.set(search_query_param_name_, title);
|
|
@@ -6593,11 +6932,11 @@ function $a817d06dc1c5911c$var$actual_navigation_working_on_fake_data({ element_
|
|
|
6593
6932
|
});
|
|
6594
6933
|
} else if (selected_entry?.type == "category") override_on_enter_for_this_entry((e)=>{
|
|
6595
6934
|
const { page_url: page_url } = selected_entry;
|
|
6596
|
-
if (!$a817d06dc1c5911c$var$open_link_on_cmd_pressed(e, page_url))
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
}
|
|
6935
|
+
if (!$a817d06dc1c5911c$var$open_link_on_cmd_pressed(e, page_url)) // Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
6936
|
+
router_.navigate_.go_to_({
|
|
6937
|
+
new_url_: page_url,
|
|
6938
|
+
is_replace_: false
|
|
6939
|
+
});
|
|
6601
6940
|
return true;
|
|
6602
6941
|
});
|
|
6603
6942
|
else if (!selected_entry) {
|
|
@@ -6630,7 +6969,7 @@ function $a817d06dc1c5911c$var$open_link_on_cmd_pressed(e, href) {
|
|
|
6630
6969
|
|
|
6631
6970
|
|
|
6632
6971
|
const $c7bc9269d29d4bdc$export$3cf9497e790da491 = "query";
|
|
6633
|
-
function $c7bc9269d29d4bdc$export$2f2b9559550c7bbc({ search_field_value_: search_field_value_ , search_query_: [get_search_query_] , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: unfiltered_previous_searches , previous_searches_text_: previous_searches_text_ , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , input_field_: input_field_ , url_transformer_: url_transformer_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_override_on_enter_fn_: set_override_on_enter_fn_ , selected_index_: selected_index_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ ,
|
|
6972
|
+
function $c7bc9269d29d4bdc$export$2f2b9559550c7bbc({ search_field_value_: search_field_value_ , search_query_: [get_search_query_] , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: unfiltered_previous_searches , previous_searches_text_: previous_searches_text_ , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , input_field_: input_field_ , url_transformer_: url_transformer_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_override_on_enter_fn_: set_override_on_enter_fn_ , selected_index_: selected_index_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , submit_query_: submit_query_ , router_: router_ }) {
|
|
6634
6973
|
const [searching_for_value, set_searching_for_value] = (0, $g9l4l$createSignal)();
|
|
6635
6974
|
const [read_search_field_value] = search_field_value_;
|
|
6636
6975
|
const updating_blocked = (0, $g9l4l$createSignal)(false);
|
|
@@ -6673,7 +7012,7 @@ function $c7bc9269d29d4bdc$export$2f2b9559550c7bbc({ search_field_value_: search
|
|
|
6673
7012
|
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
6674
7013
|
search_query_param_name_: search_page_url_param_name_,
|
|
6675
7014
|
url_transformer_: url_transformer_,
|
|
6676
|
-
|
|
7015
|
+
router_: router_
|
|
6677
7016
|
});
|
|
6678
7017
|
return [
|
|
6679
7018
|
(0, $g9l4l$createComponent)((0, $g9l4l$Show), {
|
|
@@ -6691,14 +7030,10 @@ function $c7bc9269d29d4bdc$export$2f2b9559550c7bbc({ search_field_value_: search
|
|
|
6691
7030
|
get previous_searches_ () {
|
|
6692
7031
|
return (0, $g9l4l$createMemo)(()=>filtered_previous_searches().slice(0, 5));
|
|
6693
7032
|
},
|
|
6694
|
-
search_field_value_: search_field_value_,
|
|
6695
7033
|
selected_index_: selected_index_,
|
|
6696
7034
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
6697
7035
|
url_transformer_: url_transformer_,
|
|
6698
|
-
|
|
6699
|
-
alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
|
|
6700
|
-
after_submit_: after_submit_,
|
|
6701
|
-
on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
|
|
7036
|
+
submit_query_: submit_query_
|
|
6702
7037
|
});
|
|
6703
7038
|
}
|
|
6704
7039
|
}),
|
|
@@ -6716,18 +7051,14 @@ function $c7bc9269d29d4bdc$export$2f2b9559550c7bbc({ search_field_value_: search
|
|
|
6716
7051
|
on_previous_searches_page_: show_previous_searches_component,
|
|
6717
7052
|
i18n_: i18n_,
|
|
6718
7053
|
url_transformer_: url_transformer_,
|
|
6719
|
-
search_field_value_: search_field_value_,
|
|
6720
7054
|
searching_for_value_: searching_for_value,
|
|
6721
7055
|
search_page_url_param_name_: search_page_url_param_name_,
|
|
6722
|
-
alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
|
|
6723
7056
|
selected_index_: selected_index_,
|
|
6724
7057
|
suggestion_memo_: read_suggestion_signal,
|
|
6725
7058
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
6726
|
-
get_search_query_: get_search_query_,
|
|
6727
7059
|
include_category_suggestions_: include_category_suggestions_,
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
|
|
7060
|
+
router_: router_,
|
|
7061
|
+
submit_query_: submit_query_
|
|
6731
7062
|
})
|
|
6732
7063
|
];
|
|
6733
7064
|
}
|
|
@@ -6813,7 +7144,7 @@ function $b24f16c875c2baa6$export$f021bdedd3ec901a(props) {
|
|
|
6813
7144
|
|
|
6814
7145
|
|
|
6815
7146
|
const $a9f6faeac82c322b$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $a9f6faeac82c322b$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<b></b>`, 2), $a9f6faeac82c322b$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $a9f6faeac82c322b$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
|
|
6816
|
-
function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: props_search_field_value , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $g9l4l$createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: props_submit_query , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ ,
|
|
7147
|
+
function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: props_search_field_value , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $g9l4l$createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: props_submit_query , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , bottom_distance_under_modal_: bottom_distance_under_modal_ , selected_text_range_: selected_text_range_ , dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_ = false , router_: router_ }) {
|
|
6817
7148
|
let on_enter_in_search_field_function;
|
|
6818
7149
|
// As per feedback from stronger we sometimes want a modal with the search field value disconnected from the one in the rest of the UI, see https://depictaiworkspace.slack.com/archives/C02J16R9XEH/p1679065878487709.
|
|
6819
7150
|
// This is desired for when the modal is opened from a UI element that visually does not look connected with the search page or current query
|
|
@@ -6827,12 +7158,6 @@ function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: props_
|
|
|
6827
7158
|
propagate_search_field_value_back?.();
|
|
6828
7159
|
return props_submit_query(...args);
|
|
6829
7160
|
};
|
|
6830
|
-
const after_submit_ = props_after_submit && ((...args)=>{
|
|
6831
|
-
// This will be called by link_to_param_change when clicking on a suggestion
|
|
6832
|
-
// the logic in link_to_param_change doesn't need to read the search field value before submitting, so we can just propagate the changes after submitting
|
|
6833
|
-
propagate_search_field_value_back?.();
|
|
6834
|
-
return props_after_submit(...args);
|
|
6835
|
-
});
|
|
6836
7161
|
const [input_field, set_input_field] = (0, $g9l4l$createSignal)();
|
|
6837
7162
|
const [get_search_field_value_] = search_field_value_;
|
|
6838
7163
|
const [elements_outside_scrollable, set_elements_outside_scrollable] = (0, $g9l4l$createSignal)();
|
|
@@ -6855,7 +7180,7 @@ function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: props_
|
|
|
6855
7180
|
(matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
|
|
6856
7181
|
(matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((()=>{
|
|
6857
7182
|
const _el$ = $a9f6faeac82c322b$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild;
|
|
6858
|
-
_el$2
|
|
7183
|
+
(0, $g9l4l$addEventListener)(_el$2, "click", (0, $g9l4l$catchify)(()=>submit_query_()), true);
|
|
6859
7184
|
(0, $g9l4l$insert)(_el$2, (()=>{
|
|
6860
7185
|
const _c$ = (0, $g9l4l$memo)(()=>!!get_search_field_value_());
|
|
6861
7186
|
return ()=>_c$() ? i18n_.modal_view_all_results_()((()=>{
|
|
@@ -6929,13 +7254,11 @@ function $a9f6faeac82c322b$export$1c593cbd6f1e10bc({ search_field_value_: props_
|
|
|
6929
7254
|
selected_index_: selected_index,
|
|
6930
7255
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
6931
7256
|
depict_api_: depict_api_,
|
|
6932
|
-
alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
|
|
6933
7257
|
url_transformer_: url_transformer_,
|
|
6934
7258
|
i18n_: i18n_,
|
|
6935
7259
|
include_category_suggestions_: enable_category_suggestions_ ?? true,
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
on_submit_with_unchanged_value_: on_submit_with_unchanged_value_
|
|
7260
|
+
router_: router_,
|
|
7261
|
+
submit_query_: submit_query_
|
|
6939
7262
|
});
|
|
6940
7263
|
}
|
|
6941
7264
|
}), null);
|
|
@@ -7027,7 +7350,7 @@ function $a9f6faeac82c322b$var$close_modal_when_navigating_away(close_modal, sea
|
|
|
7027
7350
|
|
|
7028
7351
|
|
|
7029
7352
|
const $71cf2f71a46bffea$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="category-suggestions"></div>`, 2), $71cf2f71a46bffea$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="category-suggestion"></div>`, 2);
|
|
7030
|
-
function $71cf2f71a46bffea$export$c05a196222ba1302({ suggestions_: suggestions_ , children: children ,
|
|
7353
|
+
function $71cf2f71a46bffea$export$c05a196222ba1302({ suggestions_: suggestions_ , children: children , slider_arrow_button_: slider_arrow_button_ }) {
|
|
7031
7354
|
const category_suggestions_ = (0, $g9l4l$createMemo)(()=>suggestions_()?.suggestions.filter((s)=>s.type === "category"));
|
|
7032
7355
|
return (0, $g9l4l$createComponent)((0, $g9l4l$Show), {
|
|
7033
7356
|
get when () {
|
|
@@ -7058,7 +7381,7 @@ function $71cf2f71a46bffea$export$c05a196222ba1302({ suggestions_: suggestions_
|
|
|
7058
7381
|
get each () {
|
|
7059
7382
|
return category_suggestions_();
|
|
7060
7383
|
},
|
|
7061
|
-
children: (suggestion, index)=>children(suggestion, index
|
|
7384
|
+
children: (suggestion, index)=>children(suggestion, index)
|
|
7062
7385
|
});
|
|
7063
7386
|
}
|
|
7064
7387
|
});
|
|
@@ -7283,7 +7606,6 @@ function $b76e8f62b1f313ef$export$a54ec244c8863715(opts) {
|
|
|
7283
7606
|
message_: "Category suggestions failed",
|
|
7284
7607
|
get children () {
|
|
7285
7608
|
return (0, $g9l4l$createComponent)((0, $71cf2f71a46bffea$export$c05a196222ba1302), {
|
|
7286
|
-
selected_filters_: selected_filters_,
|
|
7287
7609
|
suggestions_: suggestions,
|
|
7288
7610
|
slider_arrow_button_: slider_arrow_button_,
|
|
7289
7611
|
children: make_category_suggestion_card_
|
|
@@ -7432,6 +7754,8 @@ function $a79ffb1cbfbd2a09$export$828dcdd425fd3231(aligner) {
|
|
|
7432
7754
|
}
|
|
7433
7755
|
|
|
7434
7756
|
|
|
7757
|
+
|
|
7758
|
+
|
|
7435
7759
|
const $540e930c58500cbe$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict plp search"></div>`, 2);
|
|
7436
7760
|
/**
|
|
7437
7761
|
* 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.
|
|
@@ -7444,36 +7768,18 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
|
|
|
7444
7768
|
#market_signal = (0, $g9l4l$createSignal)();
|
|
7445
7769
|
#modal_open_signal = (0, $g9l4l$createSignal)(false);
|
|
7446
7770
|
static #has_been_constructed = false;
|
|
7447
|
-
|
|
7771
|
+
#router = new (0, $cfa2761d36e5714c$export$7e1297a3a19f10d8)("hard_navigation");
|
|
7772
|
+
constructor({ search_query_url_param_name: search_query_url_param_name = "query" , url_transformer: url_transformer , on_navigation: 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
|
|
7448
7773
|
disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , render_instant_card: render_instant_card , ...props_on_class }){
|
|
7449
7774
|
if ($540e930c58500cbe$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
|
|
7450
7775
|
Object.assign(this, props_on_class);
|
|
7451
|
-
const
|
|
7452
|
-
const u_o = new URL(absolute_href);
|
|
7453
|
-
const relative_href = u_o.pathname + u_o.search + u_o.hash;
|
|
7454
|
-
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
7455
|
-
try {
|
|
7456
|
-
return raw_on_navigation(relative_href);
|
|
7457
|
-
} catch (e) {
|
|
7458
|
-
queueMicrotask(()=>{
|
|
7459
|
-
throw e;
|
|
7460
|
-
});
|
|
7461
|
-
}
|
|
7462
|
-
});
|
|
7463
|
-
const alternative_query_submitter_for_spas_ = on_navigation && ((search_param_name, new_search_query, url_transformer)=>{
|
|
7464
|
-
const target_url = new URL(location.href);
|
|
7465
|
-
url_transformer?.(target_url);
|
|
7466
|
-
target_url.searchParams.set(search_param_name, new_search_query);
|
|
7467
|
-
on_navigation(target_url.href);
|
|
7468
|
-
});
|
|
7776
|
+
const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ } = (0, $b4291f5d2e6b2fae$export$7bcff1eb3eca57d7)(this.#router);
|
|
7469
7777
|
const [reset_history_state_, state_] = (0, $3075a4497054bec6$export$9862539c89138352)(()=>({
|
|
7470
7778
|
search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name) ?? "",
|
|
7471
|
-
search_sorting: undefined,
|
|
7472
7779
|
search_filters_open: false,
|
|
7473
7780
|
search_sorting_open: false,
|
|
7474
7781
|
search_expanded_filters: [],
|
|
7475
|
-
//
|
|
7476
|
-
search_selected_filters: [],
|
|
7782
|
+
// Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() 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
|
|
7477
7783
|
search_local_filter_cache: [],
|
|
7478
7784
|
search_expanded_hierarchical_filters: [],
|
|
7479
7785
|
search_showing_recommendation_rows: (0, $aee0c68312d971f4$export$1c8c715550dc689d),
|
|
@@ -7489,24 +7795,27 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
|
|
|
7489
7795
|
const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
|
|
7490
7796
|
const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $aee0c68312d971f4$export$1c8c715550dc689d)); // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
7491
7797
|
const on_submit_with_unchanged_value_ = ()=>this.modal_open = false;
|
|
7492
|
-
const
|
|
7798
|
+
const [get_search_field_value_, set_search_field_value_] = state_.search_field_value;
|
|
7799
|
+
const configured_submit_query_ = (new_query)=>(0, $7f6ddd9a7e868c4d$export$e16630ecb9644a1c)({
|
|
7493
7800
|
on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
|
|
7494
|
-
|
|
7801
|
+
set_search_field_value_: set_search_field_value_,
|
|
7495
7802
|
search_query_: search_query_signal_,
|
|
7496
7803
|
search_param_name_: search_query_url_param_name,
|
|
7497
7804
|
url_transformer_: url_transformer,
|
|
7498
|
-
|
|
7499
|
-
|
|
7805
|
+
after_submit_: after_submit_,
|
|
7806
|
+
get_new_query: ()=>new_query || (0, $g9l4l$untrack)(get_search_field_value_),
|
|
7807
|
+
router_: this.#router
|
|
7500
7808
|
});
|
|
7501
7809
|
const i18n_ = (0, $0466953901b38f18$export$f091cbac892643a4)(this.#locale_signal[0]);
|
|
7502
7810
|
const clear_filters_on_next_submit_ = (0, $a0d89ff25220eb8d$export$e026af0c7b64ea5f)({
|
|
7503
|
-
selected_filters_:
|
|
7811
|
+
selected_filters_: selected_filters_,
|
|
7504
7812
|
search_query_: search_query_signal_,
|
|
7505
|
-
current_sorting_:
|
|
7813
|
+
current_sorting_: current_sorting_,
|
|
7506
7814
|
expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
|
|
7507
7815
|
i18n_: i18n_,
|
|
7508
7816
|
local_filter_cache_: state_.search_local_filter_cache
|
|
7509
7817
|
});
|
|
7818
|
+
if (on_navigation) this.#router.on_navigation_ = on_navigation;
|
|
7510
7819
|
(0, $g9l4l$createComputed)(()=>{
|
|
7511
7820
|
const [get_search_query_updating_blocked] = search_query_updating_blocked_;
|
|
7512
7821
|
const [get_raw_search_query_signal] = raw_search_query_signal;
|
|
@@ -7517,7 +7826,7 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
|
|
|
7517
7826
|
search_query_url_param_name_: search_query_url_param_name,
|
|
7518
7827
|
reset_history_state_: reset_history_state_,
|
|
7519
7828
|
state_: state_,
|
|
7520
|
-
|
|
7829
|
+
router_: this.#router,
|
|
7521
7830
|
url_transformer_: url_transformer,
|
|
7522
7831
|
depict_api_: depict_api_,
|
|
7523
7832
|
enable_category_suggestions_: enable_category_suggestions,
|
|
@@ -7525,16 +7834,17 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
|
|
|
7525
7834
|
configured_submit_query_: configured_submit_query_,
|
|
7526
7835
|
search_query_signal_: search_query_signal_,
|
|
7527
7836
|
i18n_: i18n_,
|
|
7528
|
-
search_query_updating_blocked_: search_query_updating_blocked_
|
|
7837
|
+
search_query_updating_blocked_: search_query_updating_blocked_,
|
|
7838
|
+
current_sorting_: current_sorting_,
|
|
7839
|
+
selected_filters_: selected_filters_
|
|
7529
7840
|
});
|
|
7530
7841
|
(0, $2864fd26f57ff474$export$5162a71f252e6122)();
|
|
7531
7842
|
(0, $g9l4l$catchify)(async ()=>{
|
|
7532
|
-
const owner = (0, $g9l4l$getOwner)(); // we might have an owner, if so, pass it on
|
|
7843
|
+
const owner = (0, $g9l4l$getOwner)() || (0, $g9l4l$createRoot)(()=>(0, $g9l4l$getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
|
|
7533
7844
|
const { open_modal_: open_modal_ , close_modal_: close_modal_ } = await (0, $3786428a06ed81c4$export$79b1565500412d9b)((...args)=>{
|
|
7534
7845
|
(0, $g9l4l$onCleanup)(()=>this.modal_open = false);
|
|
7535
7846
|
return (0, $a9f6faeac82c322b$export$1c593cbd6f1e10bc)(...args);
|
|
7536
7847
|
}, {
|
|
7537
|
-
after_submit_: after_submit_,
|
|
7538
7848
|
search_field_value_: state_.search_field_value,
|
|
7539
7849
|
search_query_: search_query_signal_,
|
|
7540
7850
|
search_page_url_param_name_: search_query_url_param_name,
|
|
@@ -7544,15 +7854,13 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
|
|
|
7544
7854
|
clear_filters_: clear_filters_on_next_submit_,
|
|
7545
7855
|
market_: this.#market_signal[0],
|
|
7546
7856
|
submit_query_: configured_submit_query_,
|
|
7547
|
-
alternative_query_submitter_for_spas_: alternative_query_submitter_for_spas_,
|
|
7548
7857
|
url_transformer_: url_transformer,
|
|
7549
|
-
|
|
7550
|
-
on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
|
|
7858
|
+
router_: this.#router,
|
|
7551
7859
|
instant_results_options_: {
|
|
7552
7860
|
min_products_to_fetch_: $540e930c58500cbe$var$min_products_to_fetch_,
|
|
7553
7861
|
render_instant_card_: render_instant_card,
|
|
7554
7862
|
render_instant_card_placeholder_: (0, $aaacfac0064e97d9$export$ee1733d9a8495996),
|
|
7555
|
-
has_sort_or_filters_: (0, $g9l4l$createMemo)(()=>!!(Object.keys(
|
|
7863
|
+
has_sort_or_filters_: (0, $g9l4l$createMemo)(()=>!!(Object.keys(selected_filters_[0]())?.length || current_sorting_[0]()))
|
|
7556
7864
|
},
|
|
7557
7865
|
i18n_: i18n_,
|
|
7558
7866
|
enable_category_suggestions_: enable_category_suggestions,
|
|
@@ -7561,7 +7869,7 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
|
|
|
7561
7869
|
});
|
|
7562
7870
|
// This will add some default behaviour to open_modal_ if no style_props_ are supplied
|
|
7563
7871
|
// The default behaviour is to align the modal with the input field if possible
|
|
7564
|
-
const
|
|
7872
|
+
const modal_opening_effect = ()=>{
|
|
7565
7873
|
const open_signal_value = this.modal_open;
|
|
7566
7874
|
const signal_value_is_options = Array.isArray(open_signal_value);
|
|
7567
7875
|
// Close modal if signal is false
|
|
@@ -7615,11 +7923,17 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
|
|
|
7615
7923
|
style_props_: style_props_
|
|
7616
7924
|
});
|
|
7617
7925
|
};
|
|
7618
|
-
|
|
7619
|
-
else (0, $g9l4l$createComputed)(computation);
|
|
7926
|
+
(0, $g9l4l$runWithOwner)(owner, ()=>(0, $g9l4l$createEffect)(modal_opening_effect));
|
|
7620
7927
|
})();
|
|
7621
7928
|
$540e930c58500cbe$export$ac6237957a15b3f0.#has_been_constructed = true;
|
|
7622
7929
|
}
|
|
7930
|
+
get on_navigation() {
|
|
7931
|
+
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
7932
|
+
return this.#router.on_navigation_;
|
|
7933
|
+
}
|
|
7934
|
+
set on_navigation(new_function) {
|
|
7935
|
+
this.#router.on_navigation_ = new_function;
|
|
7936
|
+
}
|
|
7623
7937
|
get localization() {
|
|
7624
7938
|
// allow reactive access
|
|
7625
7939
|
return this.#locale_signal[0]();
|
|
@@ -7702,18 +8016,18 @@ function $540e930c58500cbe$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
|
|
|
7702
8016
|
});
|
|
7703
8017
|
});
|
|
7704
8018
|
},
|
|
7705
|
-
current_sorting_:
|
|
8019
|
+
current_sorting_: shared_properties.current_sorting_,
|
|
7706
8020
|
search_filters_open_: state_.search_filters_open,
|
|
7707
8021
|
search_sorting_open_: state_.search_sorting_open,
|
|
7708
8022
|
expanded_filters_: state_.search_expanded_filters,
|
|
7709
8023
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? (category_suggestion_)=>{
|
|
7710
8024
|
return (0, $7a7079d66c12b788$export$d757d54550ebfb3d)({
|
|
7711
8025
|
category_suggestion_: category_suggestion_,
|
|
7712
|
-
|
|
8026
|
+
router_: shared_properties.router_
|
|
7713
8027
|
});
|
|
7714
8028
|
} : false,
|
|
7715
8029
|
expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
|
|
7716
|
-
selected_filters_:
|
|
8030
|
+
selected_filters_: shared_properties.selected_filters_,
|
|
7717
8031
|
showing_recommendation_rows_: state_.search_showing_recommendation_rows,
|
|
7718
8032
|
scroll_restoration_data_: state_.search_scroll_restoration_data,
|
|
7719
8033
|
include_input_field_: include_input_field,
|
|
@@ -7896,7 +8210,6 @@ function $a3e81b85527bc866$export$d0596b5cae35ad4(open_search) {
|
|
|
7896
8210
|
|
|
7897
8211
|
|
|
7898
8212
|
|
|
7899
|
-
|
|
7900
8213
|
function $36316d7b4c897a03$export$689e204eadb33baf(pr) {
|
|
7901
8214
|
let old_url;
|
|
7902
8215
|
let disconnect_link_observer;
|
|
@@ -8031,7 +8344,8 @@ class $ba6c9609228edf6b$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8031
8344
|
}, "failed to open page");
|
|
8032
8345
|
#empty_page_bugfix() {
|
|
8033
8346
|
// Called when a "page" is "opened" using PageReplacer
|
|
8034
|
-
const
|
|
8347
|
+
const on_maybe_popstate = (what_happened)=>{
|
|
8348
|
+
if (what_happened !== "popstate") return;
|
|
8035
8349
|
const cleaned_current_url = $ba6c9609228edf6b$var$clean_url(location.href);
|
|
8036
8350
|
if (!$ba6c9609228edf6b$export$3ccaa27d81dd8556.#visited_urls.has(cleaned_current_url)) {
|
|
8037
8351
|
/*
|
|
@@ -8059,8 +8373,8 @@ class $ba6c9609228edf6b$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8059
8373
|
this.#unload(); // Call unload to "kill" the solid-js stuff quicker so that it stops updating - the user is expecting the next thing that happens to be a navigation to the actual page the URL says they're on.
|
|
8060
8374
|
}
|
|
8061
8375
|
};
|
|
8062
|
-
(0, $g9l4l$
|
|
8063
|
-
this.#revert_fns.push(()=>(0, $g9l4l$
|
|
8376
|
+
(0, $g9l4l$instant_exec_on_suspect_history_change).add(on_maybe_popstate);
|
|
8377
|
+
this.#revert_fns.push(()=>(0, $g9l4l$instant_exec_on_suspect_history_change).delete(on_maybe_popstate)); // Don't run the bugfixer if there isn't a PageReplacer page open since I assume the bug only happens when going back from a PageReplace'd page
|
|
8064
8378
|
}
|
|
8065
8379
|
/**
|
|
8066
8380
|
* Stops listening to URL changes and closes the page (if it is currently open)
|
|
@@ -8092,4 +8406,4 @@ class $ba6c9609228edf6b$export$3ccaa27d81dd8556 extends EventTarget {
|
|
|
8092
8406
|
(0, $g9l4l$add_to_version_info)("ui", (0, $18bf1d29fb889cca$export$83d89fbfd8236492));
|
|
8093
8407
|
|
|
8094
8408
|
|
|
8095
|
-
export {$e95f1855a5e3864f$export$58e808b1db15d3bc as fetchDepictRecommendations, $ec52ef1e6c117813$export$de035477d6fef996 as QuickLinks, $ec52ef1e6c117813$export$5b7c3ce0ebe51f86 as BreadCrumbs, $6340962f8bafd049$export$b91cec6bdc6b32a1 as CategoryTitle, $9b693ea3ff420de6$export$824dde41348efed1 as embedded_num_products, $80a49d3809ecb080$export$643598a327b5833e as get_categories, $ec52ef1e6c117813$export$f34314aa9505732e as DepictCategory, $ec52ef1e6c117813$export$e2bf8ce7779e827e as CategoryPage, $540e930c58500cbe$export$ac6237957a15b3f0 as DepictSearch, $540e930c58500cbe$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $540e930c58500cbe$export$f2dc7e4e4aa11abb as SearchPage, $540e930c58500cbe$export$316f6f283ae64765 as SearchField, $22d7fd594100c3d0$export$aa14a9f43128f61f as ProductCardError, $7cbfd6122dbaf087$export$d86a33413558014e as open_modal_with_alignment, $aaacfac0064e97d9$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $079defea521d5e2a$export$b3ad617e9036868 as align_field, $b4e6a093ae83373b$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $246aa49a8f85c7f3$export$1233ca167bf71f9a as styles_to_valid_css_string, $a1123c5ed9b0ee29$export$fe334901e8bebd57 as disable_scrolling, $a3e81b85527bc866$export$d0596b5cae35ad4 as open_search_with_shift_slash, $
|
|
8409
|
+
export {$e95f1855a5e3864f$export$58e808b1db15d3bc as fetchDepictRecommendations, $ec52ef1e6c117813$export$de035477d6fef996 as QuickLinks, $ec52ef1e6c117813$export$5b7c3ce0ebe51f86 as BreadCrumbs, $6340962f8bafd049$export$b91cec6bdc6b32a1 as CategoryTitle, $9b693ea3ff420de6$export$824dde41348efed1 as embedded_num_products, $80a49d3809ecb080$export$643598a327b5833e as get_categories, $ec52ef1e6c117813$export$f34314aa9505732e as DepictCategory, $ec52ef1e6c117813$export$e2bf8ce7779e827e as CategoryPage, $540e930c58500cbe$export$ac6237957a15b3f0 as DepictSearch, $540e930c58500cbe$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $540e930c58500cbe$export$f2dc7e4e4aa11abb as SearchPage, $540e930c58500cbe$export$316f6f283ae64765 as SearchField, $22d7fd594100c3d0$export$aa14a9f43128f61f as ProductCardError, $7cbfd6122dbaf087$export$d86a33413558014e as open_modal_with_alignment, $aaacfac0064e97d9$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $079defea521d5e2a$export$b3ad617e9036868 as align_field, $b4e6a093ae83373b$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $246aa49a8f85c7f3$export$1233ca167bf71f9a as styles_to_valid_css_string, $a1123c5ed9b0ee29$export$fe334901e8bebd57 as disable_scrolling, $a3e81b85527bc866$export$d0596b5cae35ad4 as open_search_with_shift_slash, $3846bb34098c738f$export$e015ed2f2950f2e3 as DepictAPI, $fefe7683325039b3$export$d9f36cf74e24d595 as media_query_to_accessor, $36316d7b4c897a03$export$689e204eadb33baf as setup_fast_leave, $886fa987db4f3805$export$5196e4c01fa56fcb as show_toast, $5178263ed1e394ca$export$469c7af753d08925 as solid_format_price, $a79ffb1cbfbd2a09$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $ba6c9609228edf6b$export$3ccaa27d81dd8556 as PageReplacer, $18bf1d29fb889cca$export$83d89fbfd8236492 as version};
|