@depict-ai/ui 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +1041 -220
- package/ES10/index.d.ts +105 -24
- package/ES10/index.js +1041 -220
- package/latest/index.cjs +939 -188
- package/latest/index.d.ts +105 -24
- package/latest/index.js +939 -188
- package/locales/ES10/index.cjs +128 -26
- package/locales/ES10/index.d.ts +4 -1
- package/locales/ES10/index.js +128 -26
- package/locales/latest/index.cjs +128 -26
- package/locales/latest/index.d.ts +4 -1
- package/locales/latest/index.js +128 -26
- package/package.json +4 -4
- package/server/ES10/index.cjs +876 -148
- package/server/ES10/index.d.ts +105 -24
- package/server/ES10/index.js +876 -148
- package/server/latest/index.cjs +783 -122
- package/server/latest/index.d.ts +105 -24
- package/server/latest/index.js +783 -122
package/latest/index.cjs
CHANGED
|
@@ -54,7 +54,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
54
54
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
55
55
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
56
56
|
/*! Depict.ai search and product listing SDK */
|
|
57
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.
|
|
57
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.5";
|
|
58
58
|
function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
|
|
59
59
|
const {
|
|
60
60
|
collapse: collapse,
|
|
@@ -711,7 +711,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
|
|
|
711
711
|
}
|
|
712
712
|
(0, $gVhhF$solidjsweb.delegateEvents)(["click"]);
|
|
713
713
|
const $b3cf6ca8dc0e9998$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<span class="count"></span>`, 2),
|
|
714
|
-
$b3cf6ca8dc0e9998$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text"></span></div><!#><!/></label>`, 11);
|
|
714
|
+
$b3cf6ca8dc0e9998$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text line-clamp"></span></div><!#><!/></label>`, 11);
|
|
715
715
|
const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = props => {
|
|
716
716
|
// It seems like there's no diffing without memos here (since we often just have computations in the getters above that update to the same result often because their dependencies change with unrelated changes often), so put memos here to avoid unneeded DOM changes
|
|
717
717
|
const count = (0, $gVhhF$solidjs.createMemo)(() => props.count_);
|
|
@@ -2664,9 +2664,14 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
|
2664
2664
|
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
2665
2665
|
const show_all_rows = (0, $gVhhF$solidjs.createMemo)(() => props.rows === "all");
|
|
2666
2666
|
const rows_or_empty_object = (0, $gVhhF$solidjs.createMemo)(() => show_all_rows() ? {} : props.rows);
|
|
2667
|
-
const
|
|
2668
|
-
const
|
|
2669
|
-
|
|
2667
|
+
const view_more_button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $gVhhF$solidjs.createMemo)(() => rows_or_empty_object().button));
|
|
2668
|
+
const view_less_button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $gVhhF$solidjs.createMemo)(() => rows_or_empty_object().view_less_button));
|
|
2669
|
+
const have_a_view_more_button = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
2670
|
+
const button = view_more_button_elements();
|
|
2671
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
2672
|
+
});
|
|
2673
|
+
const have_a_view_less_button = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
2674
|
+
const button = view_less_button_elements();
|
|
2670
2675
|
return !(!button || Array.isArray(button) && !button.length);
|
|
2671
2676
|
});
|
|
2672
2677
|
const [get_styling, set_styling] = (0, $gVhhF$solidjs.createSignal)();
|
|
@@ -2675,19 +2680,29 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
|
2675
2680
|
const [get_children_count, set_children_count] = (0, $gVhhF$solidjs.createSignal)(0);
|
|
2676
2681
|
const update_children_count = () => set_children_count(container_element.children.length);
|
|
2677
2682
|
const col_styling = (0, $gVhhF$solidjs.createMemo)(() => (0, $gVhhF$depictaiutilishared.n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
2678
|
-
const default_currently_visible_signal = (0, $gVhhF$solidjs.createSignal)(0); // Keep this signal here so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
|
|
2683
|
+
const default_currently_visible_signal = (0, $gVhhF$solidjs.createSignal)((0, $gVhhF$solidjs.untrack)(() => rows_or_empty_object().start_rows ?? 1)); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
|
|
2679
2684
|
const rows_visible_signal = (0, $gVhhF$solidjs.createMemo)(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
2680
2685
|
const get_rows_visible = (0, $gVhhF$solidjs.createMemo)(() => rows_visible_signal()[0]());
|
|
2681
2686
|
const set_rows_visible = (0, $gVhhF$solidjs.createMemo)(() => rows_visible_signal()[1]);
|
|
2682
|
-
const
|
|
2683
|
-
const
|
|
2687
|
+
const view_more_button_class = (0, $gVhhF$depictaiutilishared.make_random_classname)();
|
|
2688
|
+
const view_less_button_class = (0, $gVhhF$depictaiutilishared.make_random_classname)();
|
|
2689
|
+
const view_more_button_container = (0, $gVhhF$solidjs.createMemo)(() => have_a_view_more_button() && (() => {
|
|
2684
2690
|
const _el$2 = (0, $gVhhF$solidjsweb.getNextElement)($f48d0fbb00835aaa$var$_tmpl$);
|
|
2685
2691
|
(0, $gVhhF$solidjsweb.addEventListener)(_el$2, "click", (0, $gVhhF$depictaiutilishared.catchify)(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
|
|
2686
|
-
(0, $gVhhF$solidjsweb.className)(_el$2,
|
|
2692
|
+
(0, $gVhhF$solidjsweb.className)(_el$2, `load-more-container ${view_more_button_class}`);
|
|
2687
2693
|
(0, $gVhhF$solidjsweb.insert)(_el$2, () => rows_or_empty_object().button);
|
|
2688
2694
|
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
2689
2695
|
return _el$2;
|
|
2690
2696
|
})());
|
|
2697
|
+
// We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
|
|
2698
|
+
const view_less_button_container = (0, $gVhhF$solidjs.createMemo)(() => have_a_view_less_button() && (() => {
|
|
2699
|
+
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($f48d0fbb00835aaa$var$_tmpl$);
|
|
2700
|
+
(0, $gVhhF$solidjsweb.addEventListener)(_el$3, "click", (0, $gVhhF$depictaiutilishared.catchify)(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
|
|
2701
|
+
(0, $gVhhF$solidjsweb.className)(_el$3, `load-less-container ${view_less_button_class}`);
|
|
2702
|
+
(0, $gVhhF$solidjsweb.insert)(_el$3, () => rows_or_empty_object().view_less_button);
|
|
2703
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
2704
|
+
return _el$3;
|
|
2705
|
+
})());
|
|
2691
2706
|
container_element.classList.add(container_class);
|
|
2692
2707
|
(0, $gVhhF$solidjs.createComputed)(() => {
|
|
2693
2708
|
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
@@ -2702,7 +2717,6 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
|
2702
2717
|
set_styling(() => col_styling);
|
|
2703
2718
|
return;
|
|
2704
2719
|
}
|
|
2705
|
-
(0, $gVhhF$solidjs.untrack)(() => set_rows_visible()(rows_or_empty_object().start_rows ?? 1));
|
|
2706
2720
|
update_children_count();
|
|
2707
2721
|
const mutation_observer = new MutationObserver((0, $gVhhF$depictaiutilishared.catchify)(update_children_count));
|
|
2708
2722
|
mutation_observer.observe(container_element, {
|
|
@@ -2714,33 +2728,36 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
|
2714
2728
|
() => (0, $gVhhF$solidjs.createMemo)(() => {
|
|
2715
2729
|
const {
|
|
2716
2730
|
rows_per_click: rows_per_click,
|
|
2717
|
-
max_rows = -1
|
|
2731
|
+
max_rows = -1,
|
|
2732
|
+
start_rows: start_rows
|
|
2718
2733
|
} = rows_or_empty_object();
|
|
2719
2734
|
const rows_visible = get_rows_visible();
|
|
2720
2735
|
const children_count = get_children_count();
|
|
2721
2736
|
return col_styling() + props.cols_at_size.map(options => {
|
|
2722
|
-
const [, min, max] = options;
|
|
2723
|
-
let
|
|
2737
|
+
const [recs_per_row, min, max] = options;
|
|
2738
|
+
let should_hide_view_more_button;
|
|
2724
2739
|
let visible_recs;
|
|
2725
2740
|
if (props.disable_partial_rows) {
|
|
2726
2741
|
visible_recs = (0, $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
|
|
2727
2742
|
const visible_recs_next_show_more = (0, $gVhhF$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0),
|
|
2728
2743
|
// Should this really be zero when we default rows_per_click to 1?
|
|
2729
2744
|
children_count, options);
|
|
2730
|
-
|
|
2745
|
+
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
2731
2746
|
} else {
|
|
2732
2747
|
visible_recs = (0, $gVhhF$depictaiutilishared.layout_get_total_rec_amount_for_row)(rows_visible, options);
|
|
2733
|
-
|
|
2748
|
+
should_hide_view_more_button = visible_recs >= children_count;
|
|
2734
2749
|
}
|
|
2735
|
-
const should_hide_button_final =
|
|
2736
|
-
|
|
2750
|
+
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
2751
|
+
// I don't really understand the logic for when the view more button gets hidden so IDK if below is correct, but it works how it should for now
|
|
2752
|
+
const should_hide_view_less_button = !should_hide_view_more_button || start_rows == undefined || rows_visible <= start_rows || children_count <= recs_per_row * start_rows;
|
|
2753
|
+
return `${(0, $gVhhF$depictaiutilishared.layout_media_query_header)(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
|
|
2737
2754
|
}).join("");
|
|
2738
2755
|
}));
|
|
2739
2756
|
});
|
|
2740
|
-
return [container_element, (0, $gVhhF$solidjsweb.memo)(
|
|
2741
|
-
const _el$
|
|
2742
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
2743
|
-
return _el$
|
|
2757
|
+
return [container_element, (0, $gVhhF$solidjsweb.memo)(view_more_button_container), (0, $gVhhF$solidjsweb.memo)(view_less_button_container), (() => {
|
|
2758
|
+
const _el$4 = (0, $gVhhF$solidjsweb.getNextElement)($f48d0fbb00835aaa$var$_tmpl$2);
|
|
2759
|
+
(0, $gVhhF$solidjsweb.insert)(_el$4, get_styling);
|
|
2760
|
+
return _el$4;
|
|
2744
2761
|
})()];
|
|
2745
2762
|
}
|
|
2746
2763
|
(0, $gVhhF$solidjsweb.delegateEvents)(["click"]);
|
|
@@ -2934,14 +2951,18 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2934
2951
|
}
|
|
2935
2952
|
}
|
|
2936
2953
|
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
2937
|
-
|
|
2954
|
+
const page_url_creator = this.page_url_creator;
|
|
2955
|
+
const category_transformer = this.display_transformers?.categories;
|
|
2956
|
+
if (!page_url_creator && !category_transformer) return response;
|
|
2938
2957
|
// find category suggestions, run thing with them, and then replace them
|
|
2939
2958
|
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
|
|
2940
|
-
const page_urls = await
|
|
2941
|
-
type: "categories",
|
|
2959
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2942
2960
|
market: market,
|
|
2943
2961
|
merchant: merchant,
|
|
2944
|
-
data: [...category_suggestions]
|
|
2962
|
+
data: [...category_suggestions],
|
|
2963
|
+
...(page_url_creator ? {
|
|
2964
|
+
type: "categories"
|
|
2965
|
+
} : {})
|
|
2945
2966
|
});
|
|
2946
2967
|
this.#guard_url_creator_length(category_suggestions, page_urls);
|
|
2947
2968
|
while (page_urls.length)
|
|
@@ -2949,17 +2970,29 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2949
2970
|
Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
|
|
2950
2971
|
return response;
|
|
2951
2972
|
}
|
|
2952
|
-
async #
|
|
2953
|
-
|
|
2973
|
+
async #run_display_transformers_for_rest(merchant, market, input_data) {
|
|
2974
|
+
const {
|
|
2975
|
+
page_url_creator: page_url_creator,
|
|
2976
|
+
display_transformers: display_transformers
|
|
2977
|
+
} = this;
|
|
2978
|
+
if (!page_url_creator && !display_transformers) return input_data;
|
|
2979
|
+
const product_transformer = display_transformers?.products;
|
|
2980
|
+
const category_transformer = display_transformers?.categories;
|
|
2981
|
+
const content_result_transformer = display_transformers?.contentResults;
|
|
2954
2982
|
const displays = input_data.displays;
|
|
2955
|
-
const
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2983
|
+
const {
|
|
2984
|
+
breadcrumb: breadcrumb,
|
|
2985
|
+
quick_links: quick_links,
|
|
2986
|
+
content_search_links: content_search_links
|
|
2987
|
+
} = input_data;
|
|
2988
|
+
if (displays && (page_url_creator || product_transformer)) {
|
|
2989
|
+
const page_urls = await (page_url_creator || product_transformer)({
|
|
2960
2990
|
merchant: merchant,
|
|
2961
2991
|
market: market,
|
|
2962
|
-
displays: [...input_data.displays]
|
|
2992
|
+
displays: [...input_data.displays],
|
|
2993
|
+
...(page_url_creator ? {
|
|
2994
|
+
type: "products"
|
|
2995
|
+
} : {})
|
|
2963
2996
|
});
|
|
2964
2997
|
this.#guard_url_creator_length(displays, page_urls);
|
|
2965
2998
|
for (let i = 0; i < displays.length; i++) {
|
|
@@ -2977,19 +3010,30 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2977
3010
|
displays[i] = new_display_or_page_url;
|
|
2978
3011
|
}
|
|
2979
3012
|
}
|
|
2980
|
-
for (const category_display_array of [breadcrumb, quick_links]) {
|
|
3013
|
+
if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
|
|
2981
3014
|
if (!category_display_array) continue;
|
|
2982
|
-
const page_urls = await
|
|
2983
|
-
type: "categories",
|
|
3015
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2984
3016
|
merchant: merchant,
|
|
2985
3017
|
market: market,
|
|
2986
|
-
data: [...category_display_array]
|
|
3018
|
+
data: [...category_display_array],
|
|
3019
|
+
...(page_url_creator ? {
|
|
3020
|
+
type: "categories"
|
|
3021
|
+
} : {})
|
|
2987
3022
|
});
|
|
2988
3023
|
this.#guard_url_creator_length(category_display_array, page_urls);
|
|
2989
3024
|
for (let i = 0; i < category_display_array.length; i++)
|
|
2990
3025
|
// Copy over getters so we sneakily can make this reactive
|
|
2991
3026
|
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
2992
3027
|
}
|
|
3028
|
+
if (content_search_links?.length && content_result_transformer) {
|
|
3029
|
+
const result = await content_result_transformer({
|
|
3030
|
+
merchant: merchant,
|
|
3031
|
+
market: market,
|
|
3032
|
+
data: [...content_search_links]
|
|
3033
|
+
});
|
|
3034
|
+
this.#guard_url_creator_length(content_search_links, result);
|
|
3035
|
+
input_data.content_search_links = result;
|
|
3036
|
+
}
|
|
2993
3037
|
return input_data;
|
|
2994
3038
|
}
|
|
2995
3039
|
async #cached_post_request(endpoint, input_req, fallback_response) {
|
|
@@ -3016,7 +3060,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
3016
3060
|
let result;
|
|
3017
3061
|
try {
|
|
3018
3062
|
const unmodified_result = await api_response.json();
|
|
3019
|
-
result = await this.#
|
|
3063
|
+
result = await this.#run_display_transformers_for_rest(input_req.tenant, input_req.market, unmodified_result);
|
|
3020
3064
|
} catch (e) {
|
|
3021
3065
|
(0, $gVhhF$depictaiutilishared.dwarn)("URL creator or json decoding failed", e);
|
|
3022
3066
|
break return_successfully;
|
|
@@ -3048,12 +3092,14 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
3048
3092
|
get_metadata: get_metadata,
|
|
3049
3093
|
get_user_id: get_user_id,
|
|
3050
3094
|
get_session_id: get_session_id,
|
|
3051
|
-
page_url_creator: page_url_creator
|
|
3095
|
+
page_url_creator: page_url_creator,
|
|
3096
|
+
display_transformers: display_transformers
|
|
3052
3097
|
} = options ?? {};
|
|
3053
3098
|
this.#get_metadata = get_metadata;
|
|
3054
3099
|
this.#get_user_id = get_user_id;
|
|
3055
3100
|
this.#get_session_id = get_session_id;
|
|
3056
3101
|
this.page_url_creator = page_url_creator;
|
|
3102
|
+
this.display_transformers = display_transformers;
|
|
3057
3103
|
}
|
|
3058
3104
|
async suggest(input_req) {
|
|
3059
3105
|
const with_ids = this.#add_ids_to_request(input_req);
|
|
@@ -3163,11 +3209,11 @@ function $6b384adf40a5f4d7$var$correct_range_filter_range_once({
|
|
|
3163
3209
|
}
|
|
3164
3210
|
}
|
|
3165
3211
|
function $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
|
|
3166
|
-
|
|
3212
|
+
number_: number_,
|
|
3167
3213
|
i18n_: i18n_
|
|
3168
3214
|
}) {
|
|
3169
3215
|
return (0, $gVhhF$solidjs.createMemo)(() => {
|
|
3170
|
-
const n_hits =
|
|
3216
|
+
const n_hits = number_();
|
|
3171
3217
|
if (isNaN(n_hits)) return "";
|
|
3172
3218
|
const price_formatting = i18n_.price_formatting_();
|
|
3173
3219
|
return (0, $gVhhF$depictaiutilishared.standard_price_format)(n_hits, 0,
|
|
@@ -5649,7 +5695,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
5649
5695
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $gVhhF$solidjs.createSignal)(false);
|
|
5650
5696
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $gVhhF$solidjs.createSignal)();
|
|
5651
5697
|
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
5652
|
-
|
|
5698
|
+
number_: (0, $gVhhF$solidjs.createMemo)(() => plp_results_()?.n_hits),
|
|
5653
5699
|
i18n_: i18n_
|
|
5654
5700
|
});
|
|
5655
5701
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $gVhhF$solidjs.createSignal)();
|
|
@@ -6230,7 +6276,6 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
6230
6276
|
}
|
|
6231
6277
|
const $48567ac5b39bac56$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="depict plp category"></div>`, 2);
|
|
6232
6278
|
// We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
|
|
6233
|
-
// on old displays, no page_url_creator can be specified
|
|
6234
6279
|
/**
|
|
6235
6280
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions.
|
|
6236
6281
|
* SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
@@ -6295,6 +6340,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
6295
6340
|
api: api,
|
|
6296
6341
|
on_navigation: on_navigation,
|
|
6297
6342
|
page_url_creator: page_url_creator,
|
|
6343
|
+
display_transformers: display_transformers,
|
|
6298
6344
|
unique_instance_key_for_state = "",
|
|
6299
6345
|
query_id_state_key: query_id_state_key,
|
|
6300
6346
|
...props_on_class
|
|
@@ -6339,8 +6385,10 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
6339
6385
|
quicklinks_signal_: (0, $gVhhF$solidjs.createSignal)(),
|
|
6340
6386
|
i18n_: i18n_,
|
|
6341
6387
|
reset_history_state_: reset_history_state_,
|
|
6388
|
+
// @ts-ignore
|
|
6342
6389
|
depict_api_: api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)({
|
|
6343
|
-
page_url_creator: page_url_creator
|
|
6390
|
+
page_url_creator: page_url_creator,
|
|
6391
|
+
display_transformers: display_transformers
|
|
6344
6392
|
}),
|
|
6345
6393
|
router_: this.#router,
|
|
6346
6394
|
selected_filters_: selected_filters_,
|
|
@@ -6967,11 +7015,11 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
6967
7015
|
});
|
|
6968
7016
|
}
|
|
6969
7017
|
function $fb29c6201c369e39$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
|
|
6970
|
-
const currently_visible = (0, $gVhhF$solidjs.createSignal)(0);
|
|
7018
|
+
const currently_visible = (0, $gVhhF$solidjs.createSignal)((0, $gVhhF$solidjs.untrack)(get_showing_recommendation_rows));
|
|
6971
7019
|
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
6972
7020
|
const rows = {
|
|
6973
7021
|
currently_visible: currently_visible,
|
|
6974
|
-
start_rows:
|
|
7022
|
+
start_rows: $fb29c6201c369e39$export$1c8c715550dc689d,
|
|
6975
7023
|
rows_per_click: 3,
|
|
6976
7024
|
button: (() => {
|
|
6977
7025
|
const _el$7 = (0, $gVhhF$solidjsweb.getNextElement)($fb29c6201c369e39$var$_tmpl$2);
|
|
@@ -7137,7 +7185,7 @@ const $639c124c22b6cbaa$export$27b710c08412a7ad = obj => {
|
|
|
7137
7185
|
return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
|
|
7138
7186
|
};
|
|
7139
7187
|
const $6ae613870d3380fc$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<span class="orig price"><!#><!/><!#><!/><!#><!/></span>`, 8),
|
|
7140
|
-
$6ae613870d3380fc$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title"></span><!#><!/></div><div class="price-container"><!#><!/><span class="price"><!#><!/><!#><!/><!#><!/></span></div></div></a>`, 26),
|
|
7188
|
+
$6ae613870d3380fc$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title line-clamp"></span><!#><!/></div><div class="price-container"><!#><!/><span class="price"><!#><!/><!#><!/><!#><!/></span></div></div></a>`, 26),
|
|
7141
7189
|
$6ae613870d3380fc$var$_tmpl$3 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="tagline"></div>`, 2);
|
|
7142
7190
|
const $6ae613870d3380fc$export$b05c0ae390cf3e06 = (display_or_variant_container, {
|
|
7143
7191
|
i18n: i18n
|
|
@@ -7271,9 +7319,11 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
|
7271
7319
|
render_instant_card_placeholder_: render_instant_card_placeholder_,
|
|
7272
7320
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
7273
7321
|
has_sort_or_filters_: has_sort_or_filters_,
|
|
7274
|
-
|
|
7322
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
7275
7323
|
i18n_: i18n_,
|
|
7276
|
-
router_: router_
|
|
7324
|
+
router_: router_,
|
|
7325
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
7326
|
+
content_search_enabled_: content_search_enabled_
|
|
7277
7327
|
}) {
|
|
7278
7328
|
const max_cards = 4;
|
|
7279
7329
|
const [read_current_instant_query, write_current_instant_query] = (0, $gVhhF$solidjs.createSignal)("");
|
|
@@ -7298,8 +7348,17 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
|
7298
7348
|
...variable_data
|
|
7299
7349
|
});
|
|
7300
7350
|
}));
|
|
7301
|
-
|
|
7302
|
-
|
|
7351
|
+
// Maybe we should move this createResoure out of this component, on the other hand it bloats the parent component and if it fails it takes more than needed with it, so I think writing the content results from here is better
|
|
7352
|
+
// This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
|
|
7353
|
+
set_modal_search_results_(() => search_results);
|
|
7354
|
+
(0, $gVhhF$solidjs.onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
|
|
7355
|
+
set_total_num_results_accessor_(() => (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
7356
|
+
number_: (0, $gVhhF$solidjs.createMemo)(() => {
|
|
7357
|
+
const hits = search_results()?.n_hits;
|
|
7358
|
+
const content_results = search_results()?.content_search_links?.length;
|
|
7359
|
+
if (!content_results || !content_search_enabled_()) return hits;
|
|
7360
|
+
return (hits ?? 0) + content_results;
|
|
7361
|
+
}),
|
|
7303
7362
|
i18n_: i18n_
|
|
7304
7363
|
}));
|
|
7305
7364
|
const sliced_displays = (0, $gVhhF$solidjs.createMemo)(() => search_results()?.displays?.slice(0, max_cards));
|
|
@@ -7397,7 +7456,7 @@ function $9e30168c4b1661d2$export$5d2caaa6b530761c() {
|
|
|
7397
7456
|
return (0, $gVhhF$solidjsweb.getNextElement)($9e30168c4b1661d2$var$_tmpl$);
|
|
7398
7457
|
}
|
|
7399
7458
|
const $9a268bf73b31a717$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="previous-searches"><h2 class="text"></h2><div class="list"></div></div>`, 6),
|
|
7400
|
-
$9a268bf73b31a717$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a class="item"><div class="left"><!#><!/><span></span></div><button class="delete"></button></a>`, 10);
|
|
7459
|
+
$9a268bf73b31a717$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a class="item"><div class="left"><!#><!/><span class="line-clamp"></span></div><button class="delete"></button></a>`, 10);
|
|
7401
7460
|
function $9a268bf73b31a717$export$a146ac6fa8346a25({
|
|
7402
7461
|
text_: text_,
|
|
7403
7462
|
previous_searches_: previous_searches_,
|
|
@@ -7479,15 +7538,18 @@ function $9a268bf73b31a717$export$a146ac6fa8346a25({
|
|
|
7479
7538
|
(0, $gVhhF$solidjsweb.effect)(_p$ => {
|
|
7480
7539
|
const _v$ = !!(0, $gVhhF$solidjs.createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)(),
|
|
7481
7540
|
_v$2 = href(),
|
|
7482
|
-
_v$3 =
|
|
7541
|
+
_v$3 = item(),
|
|
7542
|
+
_v$4 = i18n_.previous_searches_delete_entry_from_history_();
|
|
7483
7543
|
_v$ !== _p$._v$ && _el$4.classList.toggle("selected", _p$._v$ = _v$);
|
|
7484
7544
|
_v$2 !== _p$._v$2 && (0, $gVhhF$solidjsweb.setAttribute)(_el$4, "href", _p$._v$2 = _v$2);
|
|
7485
|
-
_v$3 !== _p$._v$3 && (0, $gVhhF$solidjsweb.setAttribute)(_el$
|
|
7545
|
+
_v$3 !== _p$._v$3 && (0, $gVhhF$solidjsweb.setAttribute)(_el$6, "title", _p$._v$3 = _v$3);
|
|
7546
|
+
_v$4 !== _p$._v$4 && (0, $gVhhF$solidjsweb.setAttribute)(_el$9, "title", _p$._v$4 = _v$4);
|
|
7486
7547
|
return _p$;
|
|
7487
7548
|
}, {
|
|
7488
7549
|
_v$: undefined,
|
|
7489
7550
|
_v$2: undefined,
|
|
7490
|
-
_v$3: undefined
|
|
7551
|
+
_v$3: undefined,
|
|
7552
|
+
_v$4: undefined
|
|
7491
7553
|
});
|
|
7492
7554
|
return _el$4;
|
|
7493
7555
|
})();
|
|
@@ -7556,18 +7618,37 @@ function $d023ed916c84e75d$export$ba17c5b7e6dda39f({
|
|
|
7556
7618
|
const _el$2 = (0, $gVhhF$solidjsweb.getNextElement)($d023ed916c84e75d$var$_tmpl$2);
|
|
7557
7619
|
(0, $gVhhF$solidjsweb.className)(_el$2, class_);
|
|
7558
7620
|
(0, $gVhhF$solidjsweb.insert)(_el$2, text_itself);
|
|
7559
|
-
(0, $gVhhF$solidjsweb.effect)(
|
|
7621
|
+
(0, $gVhhF$solidjsweb.effect)(_p$ => {
|
|
7622
|
+
const _v$ = !!get_has_highlighted(),
|
|
7623
|
+
_v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
|
|
7624
|
+
_v$ !== _p$._v$ && _el$2.classList.toggle("has-history-match", _p$._v$ = _v$);
|
|
7625
|
+
_v$2 !== _p$._v$2 && (0, $gVhhF$solidjsweb.setAttribute)(_el$2, "title", _p$._v$2 = _v$2);
|
|
7626
|
+
return _p$;
|
|
7627
|
+
}, {
|
|
7628
|
+
_v$: undefined,
|
|
7629
|
+
_v$2: undefined
|
|
7630
|
+
});
|
|
7560
7631
|
return _el$2;
|
|
7561
7632
|
})();
|
|
7562
7633
|
}
|
|
7634
|
+
const $c0125412b4ea0c93$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path d="M56 26.455a13.71 13.71 0 0 0-9.578 3.967A13.71 13.71 0 0 0 42.455 40v176a13.71 13.71 0 0 0 3.967 9.578A13.71 13.71 0 0 0 56 229.545h144A13.71 13.71 0 0 0 213.545 216V88a2.456 2.456 0 0 1 0-.002c.001-1.452-.597-2.895-1.623-3.922l-55.998-55.998a5.61 5.61 0 0 0-3.922-1.623 2.456 2.456 0 0 1-.002 0zm0 11.09h88A2.456 2.456 0 0 1 146.455 40v48c0 2.903 2.642 5.545 5.545 5.545h48A2.456 2.456 0 0 1 202.455 96v120a2.456 2.456 0 0 1-2.455 2.455H56A2.456 2.456 0 0 1 53.545 216V40A2.456 2.456 0 0 1 56 37.545zm103.061 11.498a2.456 2.456 0 0 1 2.676.531l28.689 28.689a2.456 2.456 0 0 1-1.736 4.191H160A2.456 2.456 0 0 1 157.545 80V51.311a2.456 2.456 0 0 1 1.516-2.268zM96 130.455c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545zm0 32c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545z"></path></svg>`, 4);
|
|
7635
|
+
function $c0125412b4ea0c93$export$605674723bcc715c(props = {}) {
|
|
7636
|
+
return (() => {
|
|
7637
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($c0125412b4ea0c93$var$_tmpl$);
|
|
7638
|
+
(0, $gVhhF$solidjsweb.spread)(_el$, props, true, true);
|
|
7639
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
7640
|
+
return _el$;
|
|
7641
|
+
})();
|
|
7642
|
+
}
|
|
7563
7643
|
const $6b65ba8af12c5a26$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a class="suggestion"></a>`, 2),
|
|
7564
7644
|
$6b65ba8af12c5a26$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="search-icon"></div>`, 2),
|
|
7565
7645
|
$6b65ba8af12c5a26$var$_tmpl$3 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<span class="type"></span>`, 2),
|
|
7566
7646
|
$6b65ba8af12c5a26$var$_tmpl$4 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div><!#><!/><span class="value"></span></div>`, 6),
|
|
7567
|
-
$6b65ba8af12c5a26$var$_tmpl$5 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<
|
|
7568
|
-
$6b65ba8af12c5a26$var$_tmpl$6 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<
|
|
7569
|
-
$6b65ba8af12c5a26$var$_tmpl$7 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="suggestion-container
|
|
7570
|
-
$6b65ba8af12c5a26$var$_tmpl$8 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="
|
|
7647
|
+
$6b65ba8af12c5a26$var$_tmpl$5 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="with-icon"><!#><!/><!#><!/></div>`, 6),
|
|
7648
|
+
$6b65ba8af12c5a26$var$_tmpl$6 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<h2 class="text"></h2>`, 2),
|
|
7649
|
+
$6b65ba8af12c5a26$var$_tmpl$7 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="suggestion-container query"><!#><!/><!#><!/></div>`, 6),
|
|
7650
|
+
$6b65ba8af12c5a26$var$_tmpl$8 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="suggestion-container page"></div>`, 2),
|
|
7651
|
+
$6b65ba8af12c5a26$var$_tmpl$9 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="suggestions"><!#><!/><!#><!/><!#><!/></div>`, 8);
|
|
7571
7652
|
function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
7572
7653
|
suggestion_memo_: suggestion_memo_,
|
|
7573
7654
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
@@ -7580,7 +7661,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7580
7661
|
include_category_suggestions_: include_category_suggestions_,
|
|
7581
7662
|
searching_for_value_: searching_for_value_,
|
|
7582
7663
|
router_: router_,
|
|
7583
|
-
submit_query_: submit_query_
|
|
7664
|
+
submit_query_: submit_query_,
|
|
7665
|
+
get_content_results_: get_content_results_
|
|
7584
7666
|
}) {
|
|
7585
7667
|
const queries_memo = (0, $gVhhF$solidjs.createMemo)(() => suggestion_memo_().filter(({
|
|
7586
7668
|
type: type,
|
|
@@ -7588,9 +7670,15 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7588
7670
|
}) => type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
7589
7671
|
));
|
|
7590
7672
|
|
|
7591
|
-
const not_queries_memo = (0, $gVhhF$solidjs.createMemo)(() =>
|
|
7592
|
-
|
|
7593
|
-
|
|
7673
|
+
const not_queries_memo = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
7674
|
+
// For the section that shows categories and content results
|
|
7675
|
+
// We want to limit to 3 items, and we want to show the categories first
|
|
7676
|
+
const content_results = get_content_results_() || [];
|
|
7677
|
+
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(({
|
|
7678
|
+
type: type
|
|
7679
|
+
}) => type !== (0, $3ec9e21d6b6debdd$export$3cf9497e790da491)) : [];
|
|
7680
|
+
return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
|
|
7681
|
+
});
|
|
7594
7682
|
const render_entry = (input_obj, autocomplete_data_index, index, is_history = false) => {
|
|
7595
7683
|
const is_query = (0, $gVhhF$solidjs.createMemo)(() => input_obj().type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491));
|
|
7596
7684
|
const href_with_changed_params_accessor = (0, $gVhhF$solidjs.createMemo)(() => is_query() ? (0, $496cde876b53ce1e$export$91c3b6774e8be0f5)({
|
|
@@ -7599,6 +7687,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7599
7687
|
url_transformer_: url_transformer_
|
|
7600
7688
|
}) : undefined);
|
|
7601
7689
|
const href = (0, $gVhhF$solidjs.createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
7690
|
+
const is_selected = (0, $gVhhF$solidjs.createMemo)(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
7602
7691
|
return (() => {
|
|
7603
7692
|
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$);
|
|
7604
7693
|
(0, $gVhhF$solidjsweb.use)(element => element.addEventListener("click", (0, $gVhhF$depictaiutilishared.catchify)(ev => {
|
|
@@ -7612,7 +7701,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7612
7701
|
return;
|
|
7613
7702
|
}
|
|
7614
7703
|
router_.navigate_.go_to_({
|
|
7615
|
-
new_url_:
|
|
7704
|
+
new_url_: href(),
|
|
7616
7705
|
is_replace_: false,
|
|
7617
7706
|
event_: ev
|
|
7618
7707
|
});
|
|
@@ -7634,20 +7723,20 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7634
7723
|
return (0, $gVhhF$solidjsweb.createComponent)((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {});
|
|
7635
7724
|
}
|
|
7636
7725
|
}), (0, $gVhhF$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
7637
|
-
class_: "value",
|
|
7726
|
+
class_: "value line-clamp",
|
|
7638
7727
|
get whole_text_to_display_() {
|
|
7639
7728
|
return (0, $gVhhF$solidjs.createMemo)(() => input_obj().title);
|
|
7640
7729
|
},
|
|
7641
7730
|
searching_for_value_: searching_for_value_
|
|
7642
7731
|
})] : [(0, $gVhhF$solidjsweb.memo)((() => {
|
|
7643
|
-
const _c$2 = (0, $gVhhF$solidjsweb.memo)(() => typeof input_obj()
|
|
7732
|
+
const _c$2 = (0, $gVhhF$solidjsweb.memo)(() => typeof input_obj() /* this is a harmless lie */.parent_title === "string");
|
|
7644
7733
|
return () => _c$2() ? (() => {
|
|
7645
7734
|
const _el$4 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$4),
|
|
7646
7735
|
_el$6 = _el$4.firstChild,
|
|
7647
7736
|
[_el$7, _co$] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$6.nextSibling),
|
|
7648
7737
|
_el$5 = _el$7.nextSibling;
|
|
7649
7738
|
(0, $gVhhF$solidjsweb.insert)(_el$4, (0, $gVhhF$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
7650
|
-
class_: "category",
|
|
7739
|
+
class_: "category line-clamp",
|
|
7651
7740
|
get whole_text_to_display_() {
|
|
7652
7741
|
return (0, $gVhhF$solidjs.createMemo)(() => input_obj().title);
|
|
7653
7742
|
},
|
|
@@ -7655,16 +7744,38 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7655
7744
|
}), _el$7, _co$);
|
|
7656
7745
|
(0, $gVhhF$solidjsweb.insert)(_el$5, () => input_obj().parent_title);
|
|
7657
7746
|
return _el$4;
|
|
7658
|
-
})() : (
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7747
|
+
})() : (() => {
|
|
7748
|
+
const _c$3 = (0, $gVhhF$solidjsweb.memo)(() => input_obj().type === "content");
|
|
7749
|
+
return () => _c$3() ? (() => {
|
|
7750
|
+
const _el$8 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$5),
|
|
7751
|
+
_el$9 = _el$8.firstChild,
|
|
7752
|
+
[_el$10, _co$2] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$9.nextSibling),
|
|
7753
|
+
_el$11 = _el$10.nextSibling,
|
|
7754
|
+
[_el$12, _co$3] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$11.nextSibling);
|
|
7755
|
+
(0, $gVhhF$solidjsweb.insert)(_el$8, (0, $gVhhF$solidjsweb.createComponent)((0, $c0125412b4ea0c93$export$605674723bcc715c), {
|
|
7756
|
+
width: "16",
|
|
7757
|
+
height: "16"
|
|
7758
|
+
}), _el$10, _co$2);
|
|
7759
|
+
(0, $gVhhF$solidjsweb.insert)(_el$8, (0, $gVhhF$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
7760
|
+
class_: "content line-clamp",
|
|
7761
|
+
get whole_text_to_display_() {
|
|
7762
|
+
return (0, $gVhhF$solidjs.createMemo)(() => input_obj().title);
|
|
7763
|
+
},
|
|
7764
|
+
searching_for_value_: searching_for_value_
|
|
7765
|
+
}), _el$12, _co$3);
|
|
7766
|
+
return _el$8;
|
|
7767
|
+
})() : (0, $gVhhF$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
7768
|
+
class_: "category line-clamp",
|
|
7769
|
+
get whole_text_to_display_() {
|
|
7770
|
+
return (0, $gVhhF$solidjs.createMemo)(() => input_obj().title);
|
|
7771
|
+
},
|
|
7772
|
+
searching_for_value_: searching_for_value_
|
|
7773
|
+
});
|
|
7774
|
+
})();
|
|
7665
7775
|
})()), (() => {
|
|
7666
7776
|
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$3);
|
|
7667
7777
|
(0, $gVhhF$solidjsweb.insert)(_el$3, (0, $gVhhF$solidjs.createMemo)(() => {
|
|
7778
|
+
if (input_obj().type === "content") return i18n_.content_();
|
|
7668
7779
|
if (input_obj().category_type === "BRAND") return i18n_.brand_();
|
|
7669
7780
|
return i18n_.category_();
|
|
7670
7781
|
}));
|
|
@@ -7673,7 +7784,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7673
7784
|
})());
|
|
7674
7785
|
(0, $gVhhF$solidjsweb.effect)(_p$ => {
|
|
7675
7786
|
const _v$ = {
|
|
7676
|
-
selected: (
|
|
7787
|
+
selected: is_selected(),
|
|
7677
7788
|
history: is_history,
|
|
7678
7789
|
["type-" + input_obj().type]: true
|
|
7679
7790
|
},
|
|
@@ -7699,41 +7810,41 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7699
7810
|
}));
|
|
7700
7811
|
};
|
|
7701
7812
|
const should_show_previous_searches_in_query_part = (0, $gVhhF$solidjs.createMemo)(() => !on_previous_searches_page_());
|
|
7702
|
-
const should_show_at_all = (0, $gVhhF$solidjs.createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length);
|
|
7813
|
+
const should_show_at_all = (0, $gVhhF$solidjs.createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length || get_content_results_()?.length);
|
|
7703
7814
|
const should_show_query_part = (0, $gVhhF$solidjs.createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
|
|
7704
7815
|
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7705
7816
|
get when() {
|
|
7706
7817
|
return should_show_at_all();
|
|
7707
7818
|
},
|
|
7708
7819
|
get children() {
|
|
7709
|
-
const _el$
|
|
7710
|
-
_el$
|
|
7711
|
-
[_el$
|
|
7712
|
-
_el$
|
|
7713
|
-
[_el$
|
|
7714
|
-
_el$
|
|
7715
|
-
[_el$
|
|
7716
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7820
|
+
const _el$13 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$9),
|
|
7821
|
+
_el$21 = _el$13.firstChild,
|
|
7822
|
+
[_el$22, _co$6] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$21.nextSibling),
|
|
7823
|
+
_el$23 = _el$22.nextSibling,
|
|
7824
|
+
[_el$24, _co$7] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$23.nextSibling),
|
|
7825
|
+
_el$25 = _el$24.nextSibling,
|
|
7826
|
+
[_el$26, _co$8] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$25.nextSibling);
|
|
7827
|
+
(0, $gVhhF$solidjsweb.insert)(_el$13, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7717
7828
|
get when() {
|
|
7718
7829
|
return on_previous_searches_page_();
|
|
7719
7830
|
},
|
|
7720
7831
|
get children() {
|
|
7721
|
-
const _el$
|
|
7722
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7723
|
-
return _el$
|
|
7832
|
+
const _el$14 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$6);
|
|
7833
|
+
(0, $gVhhF$solidjsweb.insert)(_el$14, () => i18n_.suggestions_());
|
|
7834
|
+
return _el$14;
|
|
7724
7835
|
}
|
|
7725
|
-
}), _el$
|
|
7726
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7836
|
+
}), _el$22, _co$6);
|
|
7837
|
+
(0, $gVhhF$solidjsweb.insert)(_el$13, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7727
7838
|
get when() {
|
|
7728
7839
|
return should_show_query_part();
|
|
7729
7840
|
},
|
|
7730
7841
|
get children() {
|
|
7731
|
-
const _el$
|
|
7732
|
-
_el$
|
|
7733
|
-
[_el$
|
|
7734
|
-
_el$
|
|
7735
|
-
[_el$
|
|
7736
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7842
|
+
const _el$15 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$7),
|
|
7843
|
+
_el$16 = _el$15.firstChild,
|
|
7844
|
+
[_el$17, _co$4] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$16.nextSibling),
|
|
7845
|
+
_el$18 = _el$17.nextSibling,
|
|
7846
|
+
[_el$19, _co$5] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$18.nextSibling);
|
|
7847
|
+
(0, $gVhhF$solidjsweb.insert)(_el$15, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7737
7848
|
get when() {
|
|
7738
7849
|
return should_show_previous_searches_in_query_part();
|
|
7739
7850
|
},
|
|
@@ -7756,8 +7867,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7756
7867
|
});
|
|
7757
7868
|
})();
|
|
7758
7869
|
}
|
|
7759
|
-
}), _el$
|
|
7760
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7870
|
+
}), _el$17, _co$4);
|
|
7871
|
+
(0, $gVhhF$solidjsweb.insert)(_el$15, () => {
|
|
7761
7872
|
const index_in_autocomplete = 2;
|
|
7762
7873
|
set_list_until_cleanup(queries_memo, index_in_autocomplete);
|
|
7763
7874
|
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Index), {
|
|
@@ -7766,18 +7877,18 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7766
7877
|
},
|
|
7767
7878
|
children: (item, index) => render_entry(item, index_in_autocomplete, index)
|
|
7768
7879
|
});
|
|
7769
|
-
}, _el$
|
|
7770
|
-
return _el$
|
|
7880
|
+
}, _el$19, _co$5);
|
|
7881
|
+
return _el$15;
|
|
7771
7882
|
}
|
|
7772
|
-
}), _el$
|
|
7773
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7883
|
+
}), _el$24, _co$7);
|
|
7884
|
+
(0, $gVhhF$solidjsweb.insert)(_el$13, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7774
7885
|
get when() {
|
|
7775
|
-
return not_queries_memo().length
|
|
7886
|
+
return not_queries_memo().length;
|
|
7776
7887
|
},
|
|
7777
7888
|
keyed: false,
|
|
7778
7889
|
get children() {
|
|
7779
|
-
const _el$
|
|
7780
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7890
|
+
const _el$20 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$8);
|
|
7891
|
+
(0, $gVhhF$solidjsweb.insert)(_el$20, () => {
|
|
7781
7892
|
const index_in_autocomplete = 3;
|
|
7782
7893
|
set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
|
|
7783
7894
|
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Index), {
|
|
@@ -7787,15 +7898,30 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7787
7898
|
children: (item, index) => render_entry(item, index_in_autocomplete, index)
|
|
7788
7899
|
});
|
|
7789
7900
|
});
|
|
7790
|
-
return _el$
|
|
7901
|
+
return _el$20;
|
|
7791
7902
|
}
|
|
7792
|
-
}), _el$
|
|
7793
|
-
(0, $gVhhF$solidjsweb.effect)(() => _el$
|
|
7794
|
-
return _el$
|
|
7903
|
+
}), _el$26, _co$8);
|
|
7904
|
+
(0, $gVhhF$solidjsweb.effect)(() => _el$13.classList.toggle("compact", !!on_previous_searches_page_()));
|
|
7905
|
+
return _el$13;
|
|
7795
7906
|
}
|
|
7796
7907
|
});
|
|
7797
7908
|
}
|
|
7798
|
-
const $
|
|
7909
|
+
const $b8700779b3e745de$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a target="_blank"></a>`, 2);
|
|
7910
|
+
function $b8700779b3e745de$export$1efe1013da60d0e4(e, href) {
|
|
7911
|
+
if (e.metaKey || e.ctrlKey) {
|
|
7912
|
+
// Open link in a new tab with cmd/ctrl + enter.
|
|
7913
|
+
const link = (() => {
|
|
7914
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($b8700779b3e745de$var$_tmpl$);
|
|
7915
|
+
(0, $gVhhF$solidjsweb.setAttribute)(_el$, "href", href);
|
|
7916
|
+
return _el$;
|
|
7917
|
+
})();
|
|
7918
|
+
document.body.append(link);
|
|
7919
|
+
link.click();
|
|
7920
|
+
link.remove();
|
|
7921
|
+
return true;
|
|
7922
|
+
}
|
|
7923
|
+
return false;
|
|
7924
|
+
}
|
|
7799
7925
|
function $6a374b16bfe947d0$export$217899a935ef803b({
|
|
7800
7926
|
selected_index_: [read_selected_index, write_selected_index],
|
|
7801
7927
|
currently_showing_suggestions_: [read_currently_showing_suggestions],
|
|
@@ -7869,6 +7995,7 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
7869
7995
|
const sfv = get_search_field_value();
|
|
7870
7996
|
if (!(0, $gVhhF$solidjs.untrack)(() => read_updating_blocked())) previous_value = sfv;
|
|
7871
7997
|
});
|
|
7998
|
+
const owner = (0, $gVhhF$solidjs.getOwner)();
|
|
7872
7999
|
const handler = (0, $gVhhF$depictaiutilishared.catchify)(({
|
|
7873
8000
|
keyCode: keyCode
|
|
7874
8001
|
}) => (0, $gVhhF$solidjs.untrack)(() => {
|
|
@@ -7899,29 +8026,29 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
7899
8026
|
const {
|
|
7900
8027
|
title: title
|
|
7901
8028
|
} = selected_entry;
|
|
7902
|
-
|
|
8029
|
+
(0, $gVhhF$solidjs.runWithOwner)(owner, block_updating_for_one_change);
|
|
7903
8030
|
set_search_field_value(title);
|
|
7904
|
-
override_on_enter_for_this_entry(e => {
|
|
8031
|
+
(0, $gVhhF$solidjs.runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
7905
8032
|
// Open search query in new tab on cmd+enter
|
|
7906
8033
|
// 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 ;)
|
|
7907
8034
|
const url = new URL(location);
|
|
7908
8035
|
url_transformer_?.(url);
|
|
7909
8036
|
url.searchParams.set(search_query_param_name_, title);
|
|
7910
|
-
return $
|
|
7911
|
-
});
|
|
7912
|
-
} else if (selected_entry?.type == "category") override_on_enter_for_this_entry(e => {
|
|
8037
|
+
return (0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, url.href);
|
|
8038
|
+
}));
|
|
8039
|
+
} else if (selected_entry?.type == "category" || selected_entry?.type === "content") (0, $gVhhF$solidjs.runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
7913
8040
|
const {
|
|
7914
8041
|
page_url: page_url
|
|
7915
8042
|
} = selected_entry;
|
|
7916
|
-
if (
|
|
8043
|
+
if (!(0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, page_url))
|
|
7917
8044
|
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
7918
8045
|
router_.navigate_.go_to_({
|
|
7919
8046
|
new_url_: page_url,
|
|
7920
8047
|
is_replace_: false
|
|
7921
8048
|
});
|
|
7922
8049
|
return true;
|
|
7923
|
-
});else if (!selected_entry) {
|
|
7924
|
-
|
|
8050
|
+
}));else if (!selected_entry) {
|
|
8051
|
+
(0, $gVhhF$solidjs.runWithOwner)(owner, block_updating_for_one_change);
|
|
7925
8052
|
set_search_field_value(previous_value);
|
|
7926
8053
|
}
|
|
7927
8054
|
}));
|
|
@@ -7932,20 +8059,37 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
7932
8059
|
(0, $gVhhF$solidjs.onCleanup)((0, $gVhhF$depictaiutilishared.catchify)(() => el.removeEventListener("keyup", handler)));
|
|
7933
8060
|
});
|
|
7934
8061
|
}
|
|
7935
|
-
function $
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
8062
|
+
function $4f0ae864ec7c394e$export$af0124069c150252({
|
|
8063
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
8064
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8065
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
8066
|
+
router_: router_,
|
|
8067
|
+
content_results_: content_results_
|
|
8068
|
+
}) {
|
|
8069
|
+
const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $gVhhF$solidjs.createSignal)(() => false);
|
|
8070
|
+
(0, $gVhhF$solidjs.createComputed)(() => {
|
|
8071
|
+
const suggestions = read_suggestion_signal_();
|
|
8072
|
+
const search_results = get_modal_search_results_()?.();
|
|
8073
|
+
const content_results = content_results_();
|
|
8074
|
+
// If we only have one content result and nothing else, go there when pressing enter
|
|
8075
|
+
if (!suggestions.length && !search_results?.displays?.length && content_results?.length === 1) {
|
|
8076
|
+
const [{
|
|
8077
|
+
page_url: page_url
|
|
8078
|
+
}] = content_results;
|
|
8079
|
+
set_override_on_enter_fn_(e => {
|
|
8080
|
+
if (!(0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, page_url))
|
|
8081
|
+
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
8082
|
+
router_.navigate_.go_to_({
|
|
8083
|
+
new_url_: page_url,
|
|
8084
|
+
is_replace_: false
|
|
8085
|
+
});
|
|
8086
|
+
return true;
|
|
8087
|
+
});
|
|
8088
|
+
return;
|
|
8089
|
+
}
|
|
8090
|
+
set_override_on_enter_fn_(get_autocomplete_wants_override_function());
|
|
8091
|
+
});
|
|
8092
|
+
return new_fn => set_autocomplete_wants_override_function(() => new_fn);
|
|
7949
8093
|
}
|
|
7950
8094
|
const $3ec9e21d6b6debdd$export$3cf9497e790da491 = "query";
|
|
7951
8095
|
function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
@@ -7965,12 +8109,15 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
7965
8109
|
i18n_: i18n_,
|
|
7966
8110
|
include_category_suggestions_: include_category_suggestions_,
|
|
7967
8111
|
submit_query_: submit_query_,
|
|
7968
|
-
router_: router_
|
|
8112
|
+
router_: router_,
|
|
8113
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8114
|
+
content_search_enabled_: content_search_enabled_
|
|
7969
8115
|
}) {
|
|
7970
8116
|
const [searching_for_value, set_searching_for_value] = (0, $gVhhF$solidjs.createSignal)();
|
|
8117
|
+
const [show_stale_content_results, set_show_stale_content_results] = (0, $gVhhF$solidjs.createSignal)(false);
|
|
7971
8118
|
const [read_search_field_value] = search_field_value_;
|
|
7972
8119
|
const updating_blocked = (0, $gVhhF$solidjs.createSignal)(false);
|
|
7973
|
-
const [
|
|
8120
|
+
const [read_suggestion_signal_, write_suggestion_signal] = (0, $gVhhF$solidjs.createSignal)([]);
|
|
7974
8121
|
const filtered_previous_searches = (0, $gVhhF$solidjs.createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
|
|
7975
8122
|
const deparallelized_fn = (0, $gVhhF$depictaiutilishared.deparallelize_no_drop)(async request_obj => {
|
|
7976
8123
|
const api_response = await depict_api_.suggest(request_obj);
|
|
@@ -7989,15 +8136,38 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
7989
8136
|
});
|
|
7990
8137
|
|
|
7991
8138
|
const show_previous_searches_component = (0, $gVhhF$solidjs.createMemo)(() => !read_search_field_value() || (0, $gVhhF$solidjs.untrack)(updating_blocked[0]) && !(0, $gVhhF$solidjs.untrack)(searching_for_value));
|
|
8139
|
+
const get_content_results_ = (0, $gVhhF$solidjs.createMemo)(prev => {
|
|
8140
|
+
if (!content_search_enabled_()) return [];
|
|
8141
|
+
if (show_stale_content_results())
|
|
8142
|
+
// don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
|
|
8143
|
+
return prev;
|
|
8144
|
+
return get_modal_search_results_()?.()?.content_search_links?.map(link => ({
|
|
8145
|
+
page_url: link.page_url,
|
|
8146
|
+
type: "content",
|
|
8147
|
+
title: link.title
|
|
8148
|
+
}));
|
|
8149
|
+
});
|
|
8150
|
+
// Ideally we'd propagate up the suggestion signal too and call this from SearchModal.tsx? Because it's not super related with autocomplete, but it's not a huge feature, and it's easier here so keeping it.
|
|
8151
|
+
// It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
|
|
8152
|
+
const manipulated_set_override_on_enter_fn_ = (0, $4f0ae864ec7c394e$export$af0124069c150252)({
|
|
8153
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
8154
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8155
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
8156
|
+
router_: router_,
|
|
8157
|
+
content_results_: get_content_results_
|
|
8158
|
+
});
|
|
7992
8159
|
(0, $gVhhF$solidjs.createComputed)(() => {
|
|
7993
8160
|
const field_value = read_search_field_value();
|
|
7994
|
-
if (
|
|
8161
|
+
if ((0, $gVhhF$solidjs.untrack)(updating_blocked[0]))
|
|
8162
|
+
// not using updating_blocked instead of below signal since I presume they'd start updating too early then
|
|
8163
|
+
set_show_stale_content_results(true);else {
|
|
7995
8164
|
set_searching_for_value(field_value);
|
|
7996
8165
|
deparallelized_fn({
|
|
7997
8166
|
query: field_value,
|
|
7998
8167
|
tenant: tenant_(),
|
|
7999
8168
|
market: market_()
|
|
8000
8169
|
});
|
|
8170
|
+
set_show_stale_content_results(false);
|
|
8001
8171
|
}
|
|
8002
8172
|
});
|
|
8003
8173
|
(0, $gVhhF$solidjs.createComputed)((0, $gVhhF$solidjs.on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
|
|
@@ -8009,7 +8179,7 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
8009
8179
|
search_field_value_: search_field_value_,
|
|
8010
8180
|
updating_blocked_: updating_blocked,
|
|
8011
8181
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
8012
|
-
set_override_on_enter_fn_:
|
|
8182
|
+
set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
|
|
8013
8183
|
search_query_param_name_: search_query_url_param_name_,
|
|
8014
8184
|
url_transformer_: url_transformer_,
|
|
8015
8185
|
router_: router_
|
|
@@ -8048,11 +8218,12 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
8048
8218
|
},
|
|
8049
8219
|
on_previous_searches_page_: show_previous_searches_component,
|
|
8050
8220
|
i18n_: i18n_,
|
|
8221
|
+
get_content_results_: get_content_results_,
|
|
8051
8222
|
url_transformer_: url_transformer_,
|
|
8052
8223
|
searching_for_value_: searching_for_value,
|
|
8053
8224
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
8054
8225
|
selected_index_: selected_index_,
|
|
8055
|
-
suggestion_memo_:
|
|
8226
|
+
suggestion_memo_: read_suggestion_signal_,
|
|
8056
8227
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
8057
8228
|
include_category_suggestions_: include_category_suggestions_,
|
|
8058
8229
|
router_: router_,
|
|
@@ -8156,7 +8327,8 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
8156
8327
|
bottom_distance_under_modal_: bottom_distance_under_modal_,
|
|
8157
8328
|
selected_text_range_: selected_text_range_,
|
|
8158
8329
|
dont_sync_search_field_value_except_on_submit_ = false,
|
|
8159
|
-
router_: router_
|
|
8330
|
+
router_: router_,
|
|
8331
|
+
content_search_enabled_: content_search_enabled_
|
|
8160
8332
|
}) {
|
|
8161
8333
|
let on_enter_in_search_field_function;
|
|
8162
8334
|
// 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.
|
|
@@ -8173,44 +8345,37 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
8173
8345
|
};
|
|
8174
8346
|
const [input_field, set_input_field] = (0, $gVhhF$solidjs.createSignal)();
|
|
8175
8347
|
const [get_search_field_value_] = search_field_value_;
|
|
8176
|
-
const [
|
|
8177
|
-
const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $gVhhF$solidjs.createSignal)();
|
|
8348
|
+
const [get_modal_search_results, set_modal_search_results_] = (0, $gVhhF$solidjs.createSignal)();
|
|
8178
8349
|
const close_on_escape_handler = (0, $gVhhF$depictaiutilishared.catchify)(({
|
|
8179
8350
|
key: key
|
|
8180
8351
|
}) => {
|
|
8181
8352
|
if (key === "Escape") close_modal_();
|
|
8182
8353
|
});
|
|
8183
|
-
const [
|
|
8354
|
+
const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $gVhhF$solidjs.createSignal)();
|
|
8184
8355
|
const selected_index = (0, $gVhhF$solidjs.createSignal)();
|
|
8185
8356
|
const currently_showing_suggestions_ = (0, $gVhhF$solidjs.createSignal)([], {
|
|
8186
8357
|
equals: false
|
|
8187
8358
|
});
|
|
8359
|
+
const less_than_700_high = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height:700px)");
|
|
8360
|
+
const DiscoverMoreSection = () => (() => {
|
|
8361
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($f40a47a30a358305$var$_tmpl$),
|
|
8362
|
+
_el$2 = _el$.firstChild;
|
|
8363
|
+
(0, $gVhhF$solidjsweb.addEventListener)(_el$2, "click", (0, $gVhhF$depictaiutilishared.catchify)(() => submit_query_()), true);
|
|
8364
|
+
(0, $gVhhF$solidjsweb.insert)(_el$2, (() => {
|
|
8365
|
+
const _c$ = (0, $gVhhF$solidjsweb.memo)(() => !!get_search_field_value_());
|
|
8366
|
+
return () => _c$() ? i18n_.modal_view_all_results_()((() => {
|
|
8367
|
+
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($f40a47a30a358305$var$_tmpl$2);
|
|
8368
|
+
(0, $gVhhF$solidjsweb.insert)(_el$3, () => get_total_num_results_accessor?.());
|
|
8369
|
+
return _el$3;
|
|
8370
|
+
})()) : i18n_.modal_discover_more_();
|
|
8371
|
+
})());
|
|
8372
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
8373
|
+
return _el$;
|
|
8374
|
+
})();
|
|
8188
8375
|
if (disable_scrolling_) (0, $ca1176b694a6ee2e$export$fe334901e8bebd57)();
|
|
8189
8376
|
$f40a47a30a358305$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
|
|
8190
8377
|
window.addEventListener("keydown", close_on_escape_handler);
|
|
8191
8378
|
(0, $gVhhF$solidjs.onCleanup)((0, $gVhhF$depictaiutilishared.catchify)(() => window.removeEventListener("keydown", close_on_escape_handler)));
|
|
8192
|
-
const owner = (0, $gVhhF$solidjs.getOwner)();
|
|
8193
|
-
(0, $gVhhF$solidjs.onCleanup)((0, $gVhhF$depictaiutilishared.javascript_media_query)("(max-height:700px)", ({
|
|
8194
|
-
matches: matches
|
|
8195
|
-
}) => (0, $gVhhF$solidjs.runWithOwner)(owner, () => {
|
|
8196
|
-
// the if below is reactive so we need an owner
|
|
8197
|
-
(matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
|
|
8198
|
-
(matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((() => {
|
|
8199
|
-
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($f40a47a30a358305$var$_tmpl$),
|
|
8200
|
-
_el$2 = _el$.firstChild;
|
|
8201
|
-
(0, $gVhhF$solidjsweb.addEventListener)(_el$2, "click", (0, $gVhhF$depictaiutilishared.catchify)(() => submit_query_()), true);
|
|
8202
|
-
(0, $gVhhF$solidjsweb.insert)(_el$2, (() => {
|
|
8203
|
-
const _c$ = (0, $gVhhF$solidjsweb.memo)(() => !!get_search_field_value_());
|
|
8204
|
-
return () => _c$() ? i18n_.modal_view_all_results_()((() => {
|
|
8205
|
-
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($f40a47a30a358305$var$_tmpl$2);
|
|
8206
|
-
(0, $gVhhF$solidjsweb.insert)(_el$3, () => get_num_results_accessor?.());
|
|
8207
|
-
return _el$3;
|
|
8208
|
-
})()) : i18n_.modal_discover_more_();
|
|
8209
|
-
})());
|
|
8210
|
-
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
8211
|
-
return _el$;
|
|
8212
|
-
})());
|
|
8213
|
-
})).remove);
|
|
8214
8379
|
if (closing_animation_) register_closing_animation_(closing_animation_);
|
|
8215
8380
|
(0, $036d367ce3058351$export$3340fdd8259bd4fd)({
|
|
8216
8381
|
get_search_field_value_: get_search_field_value_,
|
|
@@ -8292,7 +8457,9 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
8292
8457
|
i18n_: i18n_,
|
|
8293
8458
|
include_category_suggestions_: enable_category_suggestions_ ?? true,
|
|
8294
8459
|
router_: router_,
|
|
8295
|
-
submit_query_: submit_query_
|
|
8460
|
+
submit_query_: submit_query_,
|
|
8461
|
+
get_modal_search_results_: get_modal_search_results,
|
|
8462
|
+
content_search_enabled_: content_search_enabled_
|
|
8296
8463
|
});
|
|
8297
8464
|
}
|
|
8298
8465
|
}), _el$8, _co$);
|
|
@@ -8306,14 +8473,30 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
8306
8473
|
tenant_: tenant_,
|
|
8307
8474
|
i18n_: i18n_,
|
|
8308
8475
|
market_: market_,
|
|
8309
|
-
|
|
8476
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
8310
8477
|
router_: router_,
|
|
8478
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
8479
|
+
content_search_enabled_: content_search_enabled_,
|
|
8311
8480
|
...instant_results_options_
|
|
8312
8481
|
});
|
|
8313
8482
|
}
|
|
8314
8483
|
}), _el$10, _co$2);
|
|
8315
|
-
(0, $gVhhF$solidjsweb.insert)(_el$6,
|
|
8316
|
-
|
|
8484
|
+
(0, $gVhhF$solidjsweb.insert)(_el$6, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8485
|
+
get when() {
|
|
8486
|
+
return less_than_700_high();
|
|
8487
|
+
},
|
|
8488
|
+
get children() {
|
|
8489
|
+
return (0, $gVhhF$solidjsweb.createComponent)(DiscoverMoreSection, {});
|
|
8490
|
+
}
|
|
8491
|
+
}), _el$12, _co$3);
|
|
8492
|
+
(0, $gVhhF$solidjsweb.insert)(_el$5, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8493
|
+
get when() {
|
|
8494
|
+
return !less_than_700_high();
|
|
8495
|
+
},
|
|
8496
|
+
get children() {
|
|
8497
|
+
return (0, $gVhhF$solidjsweb.createComponent)(DiscoverMoreSection, {});
|
|
8498
|
+
}
|
|
8499
|
+
}), _el$16, _co$5);
|
|
8317
8500
|
(0, $gVhhF$solidjsweb.insert)(_el$4, (0, $gVhhF$solidjsweb.createComponent)((0, $b776f25acdda22eb$export$f021bdedd3ec901a), {
|
|
8318
8501
|
styles: body_style
|
|
8319
8502
|
}), _el$18, _co$6);
|
|
@@ -8418,11 +8601,13 @@ const $65a0c4b1c2eb5d0b$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template
|
|
|
8418
8601
|
function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({
|
|
8419
8602
|
get_search_query_: get_search_query_,
|
|
8420
8603
|
i18n_: i18n_,
|
|
8421
|
-
formatted_number_of_results_: formatted_number_of_results_
|
|
8604
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
8605
|
+
number_of_results_: number_of_results_,
|
|
8606
|
+
type: type
|
|
8422
8607
|
}) {
|
|
8423
8608
|
const contents = (0, $gVhhF$solidjs.createMemo)((0, $gVhhF$depictaiutilishared.catchify)(() => {
|
|
8424
8609
|
const q = get_search_query_();
|
|
8425
|
-
return i18n_.get_showing_results_for_()((() => {
|
|
8610
|
+
return i18n_[type === $65a0c4b1c2eb5d0b$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((() => {
|
|
8426
8611
|
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($65a0c4b1c2eb5d0b$var$_tmpl$);
|
|
8427
8612
|
(0, $gVhhF$solidjsweb.insert)(_el$, q);
|
|
8428
8613
|
return _el$;
|
|
@@ -8430,7 +8615,7 @@ function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({
|
|
|
8430
8615
|
const _el$2 = (0, $gVhhF$solidjsweb.getNextElement)($65a0c4b1c2eb5d0b$var$_tmpl$);
|
|
8431
8616
|
(0, $gVhhF$solidjsweb.insert)(_el$2, formatted_number_of_results_);
|
|
8432
8617
|
return _el$2;
|
|
8433
|
-
})());
|
|
8618
|
+
})(), !!q, number_of_results_());
|
|
8434
8619
|
}));
|
|
8435
8620
|
return (() => {
|
|
8436
8621
|
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($65a0c4b1c2eb5d0b$var$_tmpl$2);
|
|
@@ -8438,6 +8623,11 @@ function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({
|
|
|
8438
8623
|
return _el$3;
|
|
8439
8624
|
})();
|
|
8440
8625
|
}
|
|
8626
|
+
let $65a0c4b1c2eb5d0b$export$2452208c79fe93ea;
|
|
8627
|
+
(function (ShowingResultsForType) {
|
|
8628
|
+
ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
|
|
8629
|
+
ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
|
|
8630
|
+
})($65a0c4b1c2eb5d0b$export$2452208c79fe93ea || ($65a0c4b1c2eb5d0b$export$2452208c79fe93ea = {}));
|
|
8441
8631
|
function $2005eec80e40088f$export$41b4894022a3580f({
|
|
8442
8632
|
style_props_ = (0, $gVhhF$solidjs.createSignal)({})
|
|
8443
8633
|
} = {}) {
|
|
@@ -8456,8 +8646,486 @@ function $2005eec80e40088f$export$41b4894022a3580f({
|
|
|
8456
8646
|
})));
|
|
8457
8647
|
return style_props_;
|
|
8458
8648
|
}
|
|
8649
|
+
const $5ea5a82e398f6f44$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<span class="highlighted-part"></span>`, 2);
|
|
8650
|
+
const $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters = 30;
|
|
8651
|
+
function $5ea5a82e398f6f44$export$e1a98a189fd2c0e7({
|
|
8652
|
+
content_result_: content_result_,
|
|
8653
|
+
key_: key_,
|
|
8654
|
+
cut_when_possible_: cut_when_possible_
|
|
8655
|
+
}) {
|
|
8656
|
+
const matched_tokens = (0, $gVhhF$solidjs.createMemo)(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
|
|
8657
|
+
const full_value = (0, $gVhhF$solidjs.createMemo)(() => content_result_()[key_]?.replaceAll("\n", " "));
|
|
8658
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8659
|
+
get when() {
|
|
8660
|
+
return matched_tokens()?.length;
|
|
8661
|
+
},
|
|
8662
|
+
get fallback() {
|
|
8663
|
+
return full_value();
|
|
8664
|
+
},
|
|
8665
|
+
get children() {
|
|
8666
|
+
return (() => {
|
|
8667
|
+
const segmented_cut_text = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
8668
|
+
const segmented_text = $5ea5a82e398f6f44$var$segment_text(full_value(), matched_tokens());
|
|
8669
|
+
if (cut_when_possible_) $5ea5a82e398f6f44$var$cut_text(segmented_text);
|
|
8670
|
+
return segmented_text;
|
|
8671
|
+
});
|
|
8672
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Index), {
|
|
8673
|
+
get each() {
|
|
8674
|
+
return segmented_cut_text();
|
|
8675
|
+
},
|
|
8676
|
+
children: item => {
|
|
8677
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8678
|
+
get when() {
|
|
8679
|
+
return item().highlighted_;
|
|
8680
|
+
},
|
|
8681
|
+
get fallback() {
|
|
8682
|
+
return item().text_;
|
|
8683
|
+
},
|
|
8684
|
+
get children() {
|
|
8685
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($5ea5a82e398f6f44$var$_tmpl$);
|
|
8686
|
+
(0, $gVhhF$solidjsweb.insert)(_el$, () => item().text_);
|
|
8687
|
+
return _el$;
|
|
8688
|
+
}
|
|
8689
|
+
});
|
|
8690
|
+
}
|
|
8691
|
+
});
|
|
8692
|
+
})();
|
|
8693
|
+
}
|
|
8694
|
+
});
|
|
8695
|
+
}
|
|
8696
|
+
function $5ea5a82e398f6f44$var$cut_text(segmented_text) {
|
|
8697
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
8698
|
+
const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
|
|
8699
|
+
if (!segmented_text || !highlighted_segments?.length) return;
|
|
8700
|
+
// We have one or more highlighted segments
|
|
8701
|
+
if (highlighted_segments.length === 1) {
|
|
8702
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
8703
|
+
$5ea5a82e398f6f44$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
8704
|
+
return;
|
|
8705
|
+
}
|
|
8706
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
8707
|
+
const sorted_highlighted_segments = [...highlighted_segments].sort((a, b) => b.text_.trim().length - a.text_.trim().length // trim to avoid unfair comparisons due to whitespace
|
|
8708
|
+
);
|
|
8709
|
+
|
|
8710
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
8711
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
8712
|
+
let [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
8713
|
+
$5ea5a82e398f6f44$var$cut_start(index_of_first_segment, segmented_text);
|
|
8714
|
+
// update indexes since we might have removed segments
|
|
8715
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
8716
|
+
let number_of_characters_between_segments = 0;
|
|
8717
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
8718
|
+
const segment = segmented_text[i];
|
|
8719
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
8720
|
+
}
|
|
8721
|
+
if (number_of_characters_between_segments < $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters)
|
|
8722
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
8723
|
+
return;
|
|
8724
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
8725
|
+
const [split_start_segment, split_start_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
8726
|
+
const [split_end_segment, split_end_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
8727
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
8728
|
+
// identical split point, or split end before split start, can't do anything
|
|
8729
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
8730
|
+
const dots_segment = {
|
|
8731
|
+
text_: " … ",
|
|
8732
|
+
highlighted_: false
|
|
8733
|
+
};
|
|
8734
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
8735
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
8736
|
+
const text = segment.text_;
|
|
8737
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
8738
|
+
...segment,
|
|
8739
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
8740
|
+
}, dots_segment, {
|
|
8741
|
+
...segment,
|
|
8742
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8743
|
+
}];else if (i == split_start_segment) {
|
|
8744
|
+
segment.text_ = text.slice(0, split_start_character).trimEnd(); // this would be split_start_character + 1, but we want to remove the last "dot" because . ... looks weird
|
|
8745
|
+
return segment;
|
|
8746
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
8747
|
+
...segment,
|
|
8748
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8749
|
+
}];
|
|
8750
|
+
return []; // remove all segments inbetween
|
|
8751
|
+
});
|
|
8752
|
+
|
|
8753
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
8754
|
+
$5ea5a82e398f6f44$var$heal_holes(segmented_text);
|
|
8755
|
+
}
|
|
8756
|
+
function $5ea5a82e398f6f44$var$heal_holes(segmented_text) {
|
|
8757
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
8758
|
+
const segments_to_delete = new Set();
|
|
8759
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
8760
|
+
const segment = segmented_text[i];
|
|
8761
|
+
let previous_segment;
|
|
8762
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
8763
|
+
previous_segment = segmented_text[j];
|
|
8764
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
8765
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
8766
|
+
}
|
|
8767
|
+
if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
|
|
8768
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
8769
|
+
segments_to_delete.add(segment);
|
|
8770
|
+
}
|
|
8771
|
+
}
|
|
8772
|
+
for (const segment of segments_to_delete) {
|
|
8773
|
+
const index = segmented_text.indexOf(segment);
|
|
8774
|
+
segmented_text.splice(index, 1);
|
|
8775
|
+
}
|
|
8776
|
+
}
|
|
8777
|
+
function $5ea5a82e398f6f44$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
|
|
8778
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
8779
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
8780
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
8781
|
+
while (desperate_split_attempts.length) {
|
|
8782
|
+
const split_point_between_words = [];
|
|
8783
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
8784
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
8785
|
+
let is_first_character = true;
|
|
8786
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
8787
|
+
const segment = segmented_text[i];
|
|
8788
|
+
const text = segment.text_;
|
|
8789
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
8790
|
+
const character = text[j];
|
|
8791
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
8792
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
8793
|
+
split_point_between_words.push([i, j]);
|
|
8794
|
+
if (split_point_between_words.length > 3)
|
|
8795
|
+
// We can't find a split point, so we'll just split between words
|
|
8796
|
+
// This is because for UI reasons we only want to show 2 lines of text, so we need to be very aggressive with getting the second match soon
|
|
8797
|
+
return split_point_between_words[1];
|
|
8798
|
+
}
|
|
8799
|
+
}
|
|
8800
|
+
}
|
|
8801
|
+
}
|
|
8802
|
+
return [];
|
|
8803
|
+
}
|
|
8804
|
+
function $5ea5a82e398f6f44$var$cut_start(cut_left_of_index, segmented_text) {
|
|
8805
|
+
// Cut the start of the text to bring the first matching token
|
|
8806
|
+
let is_first_character = false;
|
|
8807
|
+
let words_encountered = 0;
|
|
8808
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
8809
|
+
const segment = segmented_text[i];
|
|
8810
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
8811
|
+
const text = segment.text_;
|
|
8812
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
8813
|
+
const character = text[j];
|
|
8814
|
+
const is_space = character == " ";
|
|
8815
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
8816
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
8817
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
8818
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
8819
|
+
segmented_text.splice(0, i);
|
|
8820
|
+
if (character === "," || is_space)
|
|
8821
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
8822
|
+
segmented_text.unshift({
|
|
8823
|
+
text_: "… ",
|
|
8824
|
+
highlighted_: false
|
|
8825
|
+
});
|
|
8826
|
+
break outmost_loop;
|
|
8827
|
+
}
|
|
8828
|
+
if (is_first_character) is_first_character = false;
|
|
8829
|
+
}
|
|
8830
|
+
}
|
|
8831
|
+
$5ea5a82e398f6f44$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
8832
|
+
}
|
|
8833
|
+
|
|
8834
|
+
function $5ea5a82e398f6f44$var$segment_text(text, matched_strings) {
|
|
8835
|
+
// segment text where the matched strings are highlighted sections
|
|
8836
|
+
const output = [];
|
|
8837
|
+
if (!text) return; // shouldn't happen but whatever
|
|
8838
|
+
for (let i = 0; i < text.length; i++) {
|
|
8839
|
+
const found_strings = [];
|
|
8840
|
+
if (!i || text[i - 1] == " ")
|
|
8841
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
8842
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
8843
|
+
const matched_string = matched_strings[j];
|
|
8844
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
8845
|
+
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
8846
|
+
if (part_in_text.toLowerCase() === matched_string.toLowerCase()) found_strings.push(part_in_text); // use the casing from the text, not from typesense, can look weird otherwise
|
|
8847
|
+
}
|
|
8848
|
+
|
|
8849
|
+
const last_index_in_output = output.length - 1;
|
|
8850
|
+
if (!found_strings.length) {
|
|
8851
|
+
const character = text[i];
|
|
8852
|
+
if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
|
|
8853
|
+
// always push whitespace characters to the last segment, this is because typesense doesn't see them as part of the matched tokens but we want to be able to detect "phat" matched segments
|
|
8854
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
8855
|
+
highlighted_: false,
|
|
8856
|
+
text_: character
|
|
8857
|
+
});
|
|
8858
|
+
} else {
|
|
8859
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
8860
|
+
if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
8861
|
+
highlighted_: true,
|
|
8862
|
+
text_: longest_found_string
|
|
8863
|
+
});
|
|
8864
|
+
i += longest_found_string.length - 1;
|
|
8865
|
+
}
|
|
8866
|
+
}
|
|
8867
|
+
return output;
|
|
8868
|
+
}
|
|
8869
|
+
const $76227de40be817e5$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a></a>`, 2),
|
|
8870
|
+
$76227de40be817e5$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div></div>`, 2),
|
|
8871
|
+
$76227de40be817e5$var$_tmpl$3 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="description line-clamp"></div>`, 2),
|
|
8872
|
+
$76227de40be817e5$var$_tmpl$4 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="content-card"><div class="image"></div><div class="info"><!#><!/><!#><!/></div></div>`, 10);
|
|
8873
|
+
function $76227de40be817e5$export$f631859cab12b342({
|
|
8874
|
+
router_: router_,
|
|
8875
|
+
content_result_: content_result_
|
|
8876
|
+
}) {
|
|
8877
|
+
const make_link_attributes = () => {
|
|
8878
|
+
const result = content_result_?.();
|
|
8879
|
+
if (!result) return;
|
|
8880
|
+
return {
|
|
8881
|
+
href: result.page_url,
|
|
8882
|
+
onClick: (0, $gVhhF$depictaiutilishared.catchify)(ev => router_.navigate_.go_to_({
|
|
8883
|
+
new_url_: result.page_url,
|
|
8884
|
+
is_replace_: false,
|
|
8885
|
+
event_: ev
|
|
8886
|
+
}))
|
|
8887
|
+
};
|
|
8888
|
+
};
|
|
8889
|
+
const LinkIfPossible = ({
|
|
8890
|
+
children: children,
|
|
8891
|
+
...attributes
|
|
8892
|
+
}) => {
|
|
8893
|
+
if (content_result_) return (() => {
|
|
8894
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($76227de40be817e5$var$_tmpl$);
|
|
8895
|
+
(0, $gVhhF$solidjsweb.spread)(_el$, attributes, false, true);
|
|
8896
|
+
(0, $gVhhF$solidjsweb.insert)(_el$, children);
|
|
8897
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
8898
|
+
return _el$;
|
|
8899
|
+
})();
|
|
8900
|
+
return (() => {
|
|
8901
|
+
const _el$2 = (0, $gVhhF$solidjsweb.getNextElement)($76227de40be817e5$var$_tmpl$2);
|
|
8902
|
+
(0, $gVhhF$solidjsweb.spread)(_el$2, attributes, false, true);
|
|
8903
|
+
(0, $gVhhF$solidjsweb.insert)(_el$2, children);
|
|
8904
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
8905
|
+
return _el$2;
|
|
8906
|
+
})();
|
|
8907
|
+
};
|
|
8908
|
+
return (() => {
|
|
8909
|
+
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($76227de40be817e5$var$_tmpl$4),
|
|
8910
|
+
_el$4 = _el$3.firstChild,
|
|
8911
|
+
_el$5 = _el$4.nextSibling,
|
|
8912
|
+
_el$7 = _el$5.firstChild,
|
|
8913
|
+
[_el$8, _co$] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$7.nextSibling),
|
|
8914
|
+
_el$9 = _el$8.nextSibling,
|
|
8915
|
+
[_el$10, _co$2] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$9.nextSibling);
|
|
8916
|
+
(0, $gVhhF$solidjsweb.insert)(_el$4, (0, $gVhhF$solidjsweb.createComponent)(LinkIfPossible, (0, $gVhhF$solidjsweb.mergeProps)(make_link_attributes, {
|
|
8917
|
+
tabIndex: "-1",
|
|
8918
|
+
get children() {
|
|
8919
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $c0125412b4ea0c93$export$605674723bcc715c), {
|
|
8920
|
+
width: "28",
|
|
8921
|
+
height: "28"
|
|
8922
|
+
});
|
|
8923
|
+
}
|
|
8924
|
+
})));
|
|
8925
|
+
(0, $gVhhF$solidjsweb.insert)(_el$5, (0, $gVhhF$solidjsweb.createComponent)(LinkIfPossible, (0, $gVhhF$solidjsweb.mergeProps)({
|
|
8926
|
+
"class": "content-title line-clamp"
|
|
8927
|
+
}, make_link_attributes, {
|
|
8928
|
+
get title() {
|
|
8929
|
+
return content_result_?.().title;
|
|
8930
|
+
},
|
|
8931
|
+
get children() {
|
|
8932
|
+
return content_result_ ? (0, $gVhhF$solidjsweb.createComponent)((0, $5ea5a82e398f6f44$export$e1a98a189fd2c0e7), {
|
|
8933
|
+
content_result_: content_result_,
|
|
8934
|
+
key_: "title",
|
|
8935
|
+
cut_when_possible_: false
|
|
8936
|
+
}) : (0, $gVhhF$solidjsweb.createComponent)((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
8937
|
+
height: "1em",
|
|
8938
|
+
width: "20ch"
|
|
8939
|
+
});
|
|
8940
|
+
}
|
|
8941
|
+
})), _el$8, _co$);
|
|
8942
|
+
(0, $gVhhF$solidjsweb.insert)(_el$5, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8943
|
+
get when() {
|
|
8944
|
+
return content_result_?.().description || !content_result_;
|
|
8945
|
+
},
|
|
8946
|
+
get children() {
|
|
8947
|
+
const _el$6 = (0, $gVhhF$solidjsweb.getNextElement)($76227de40be817e5$var$_tmpl$3);
|
|
8948
|
+
(0, $gVhhF$solidjsweb.insert)(_el$6, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8949
|
+
when: content_result_,
|
|
8950
|
+
get fallback() {
|
|
8951
|
+
return Array.from({
|
|
8952
|
+
length: 4
|
|
8953
|
+
}).map(() => (0, $gVhhF$solidjsweb.createComponent)((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
8954
|
+
height: "1em",
|
|
8955
|
+
width: "min(50ch, 100%)"
|
|
8956
|
+
}));
|
|
8957
|
+
},
|
|
8958
|
+
get children() {
|
|
8959
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $5ea5a82e398f6f44$export$e1a98a189fd2c0e7), {
|
|
8960
|
+
content_result_: content_result_,
|
|
8961
|
+
key_: "description",
|
|
8962
|
+
cut_when_possible_: true
|
|
8963
|
+
});
|
|
8964
|
+
}
|
|
8965
|
+
}));
|
|
8966
|
+
return _el$6;
|
|
8967
|
+
}
|
|
8968
|
+
}), _el$10, _co$2);
|
|
8969
|
+
return _el$3;
|
|
8970
|
+
})();
|
|
8971
|
+
}
|
|
8972
|
+
function $8781fcec27b20709$export$9ff751cd77687edc({
|
|
8973
|
+
search_results_: search_results_,
|
|
8974
|
+
router_: router_
|
|
8975
|
+
}) {
|
|
8976
|
+
const content_results = (0, $gVhhF$solidjs.createMemo)(() => search_results_()?.content_search_links);
|
|
8977
|
+
const content_results_by_page_url = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
8978
|
+
const map = new Map();
|
|
8979
|
+
const results = content_results();
|
|
8980
|
+
if (!results) return map;
|
|
8981
|
+
for (let i = 0; i < results.length; i++) {
|
|
8982
|
+
const content_result = results[i];
|
|
8983
|
+
map.set(content_result.page_url, content_result);
|
|
8984
|
+
}
|
|
8985
|
+
return map;
|
|
8986
|
+
});
|
|
8987
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.For), {
|
|
8988
|
+
get each() {
|
|
8989
|
+
return [...content_results_by_page_url().keys()];
|
|
8990
|
+
},
|
|
8991
|
+
children: page_url => {
|
|
8992
|
+
const content_result = (0, $gVhhF$solidjs.createMemo)(() => content_results_by_page_url().get(page_url));
|
|
8993
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $76227de40be817e5$export$f631859cab12b342), {
|
|
8994
|
+
content_result_: content_result,
|
|
8995
|
+
router_: router_
|
|
8996
|
+
});
|
|
8997
|
+
}
|
|
8998
|
+
});
|
|
8999
|
+
}
|
|
9000
|
+
function $c2f92eb265a14529$export$4405d077f0a20494({
|
|
9001
|
+
content_results_rows_: [get_history_state_content_results_rows],
|
|
9002
|
+
cols_at_size_: cols_at_size_
|
|
9003
|
+
}) {
|
|
9004
|
+
const largest_column = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
9005
|
+
const largest_in_cols_at_size = Math.max(...cols_at_size_().map(([cols]) => cols));
|
|
9006
|
+
if (isNaN(largest_in_cols_at_size) || Math.abs(largest_in_cols_at_size) === Infinity) return 4; // fallback to something big so we always have the right amount of placeholders
|
|
9007
|
+
return largest_in_cols_at_size;
|
|
9008
|
+
});
|
|
9009
|
+
const num_placeholders = (0, $gVhhF$solidjs.createMemo)(() => (get_history_state_content_results_rows() ?? (0, $3716b8caf7f959e2$export$70ceae36059a1036)) * largest_column());
|
|
9010
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Index), {
|
|
9011
|
+
get each() {
|
|
9012
|
+
return Array.from({
|
|
9013
|
+
length: num_placeholders()
|
|
9014
|
+
});
|
|
9015
|
+
},
|
|
9016
|
+
children: () => (0, $gVhhF$solidjsweb.createComponent)((0, $76227de40be817e5$export$f631859cab12b342), {})
|
|
9017
|
+
});
|
|
9018
|
+
}
|
|
9019
|
+
const $3716b8caf7f959e2$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="content-results"><!#><!/><!#><!/></div>`, 6),
|
|
9020
|
+
$3716b8caf7f959e2$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<button class="view-more"></button>`, 2),
|
|
9021
|
+
$3716b8caf7f959e2$var$_tmpl$3 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<button class="view-less"></button>`, 2);
|
|
9022
|
+
const $3716b8caf7f959e2$export$70ceae36059a1036 = 1;
|
|
9023
|
+
function $3716b8caf7f959e2$export$6d0c9c22f6652669({
|
|
9024
|
+
search_results_: search_results_,
|
|
9025
|
+
get_search_query_: get_search_query_,
|
|
9026
|
+
i18n_: i18n_,
|
|
9027
|
+
layout_options_: layout_options_,
|
|
9028
|
+
router_: router_,
|
|
9029
|
+
query_base_: query_base_,
|
|
9030
|
+
content_results_rows_: content_results_rows_
|
|
9031
|
+
}) {
|
|
9032
|
+
const content_results = (0, $gVhhF$solidjs.createMemo)(() => search_results_()?.content_search_links);
|
|
9033
|
+
const num_results = (0, $gVhhF$solidjs.createMemo)(() => content_results()?.length);
|
|
9034
|
+
const is_loading_ = (0, $gVhhF$solidjs.createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
|
|
9035
|
+
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
9036
|
+
number_: num_results,
|
|
9037
|
+
i18n_: i18n_
|
|
9038
|
+
});
|
|
9039
|
+
const [is_showing_placeholders, set_is_showing_placeholders] = (0, $gVhhF$solidjs.createSignal)(false);
|
|
9040
|
+
const rows_object = $3716b8caf7f959e2$var$make_state_saved_rows(content_results_rows_, i18n_);
|
|
9041
|
+
return (() => {
|
|
9042
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($3716b8caf7f959e2$var$_tmpl$),
|
|
9043
|
+
_el$2 = _el$.firstChild,
|
|
9044
|
+
[_el$3, _co$] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$2.nextSibling),
|
|
9045
|
+
_el$4 = _el$3.nextSibling,
|
|
9046
|
+
[_el$5, _co$2] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$4.nextSibling);
|
|
9047
|
+
(0, $gVhhF$solidjsweb.insert)(_el$, (0, $gVhhF$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), {
|
|
9048
|
+
get_search_query_: get_search_query_,
|
|
9049
|
+
i18n_: i18n_,
|
|
9050
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
9051
|
+
get type() {
|
|
9052
|
+
return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).content;
|
|
9053
|
+
},
|
|
9054
|
+
number_of_results_: num_results
|
|
9055
|
+
}), _el$3, _co$);
|
|
9056
|
+
(0, $gVhhF$solidjsweb.insert)(_el$, (0, $gVhhF$solidjsweb.createComponent)((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), (0, $gVhhF$solidjsweb.mergeProps)({
|
|
9057
|
+
layout: "grid",
|
|
9058
|
+
element_attributes: {
|
|
9059
|
+
class: "cards"
|
|
9060
|
+
}
|
|
9061
|
+
}, layout_options_, {
|
|
9062
|
+
rows: rows_object,
|
|
9063
|
+
get children() {
|
|
9064
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Suspense), {
|
|
9065
|
+
get fallback() {
|
|
9066
|
+
return (() => {
|
|
9067
|
+
set_is_showing_placeholders(true);
|
|
9068
|
+
(0, $gVhhF$solidjs.onCleanup)(() => set_is_showing_placeholders(false));
|
|
9069
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $c2f92eb265a14529$export$4405d077f0a20494), {
|
|
9070
|
+
content_results_rows_: content_results_rows_,
|
|
9071
|
+
get cols_at_size_() {
|
|
9072
|
+
return (0, $gVhhF$solidjs.createMemo)(() => layout_options_().cols_at_size);
|
|
9073
|
+
}
|
|
9074
|
+
});
|
|
9075
|
+
})();
|
|
9076
|
+
},
|
|
9077
|
+
get children() {
|
|
9078
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $8781fcec27b20709$export$9ff751cd77687edc), {
|
|
9079
|
+
router_: router_,
|
|
9080
|
+
search_results_: search_results_
|
|
9081
|
+
});
|
|
9082
|
+
}
|
|
9083
|
+
});
|
|
9084
|
+
}
|
|
9085
|
+
})), _el$5, _co$2);
|
|
9086
|
+
(0, $gVhhF$solidjsweb.effect)(_p$ => {
|
|
9087
|
+
const _v$ = !!is_showing_placeholders(),
|
|
9088
|
+
_v$2 = is_loading_() || content_results()?.length > 0 ? "" : "none";
|
|
9089
|
+
_v$ !== _p$._v$ && _el$.classList.toggle("loading", _p$._v$ = _v$);
|
|
9090
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("display", _p$._v$2 = _v$2);
|
|
9091
|
+
return _p$;
|
|
9092
|
+
}, {
|
|
9093
|
+
_v$: undefined,
|
|
9094
|
+
_v$2: undefined
|
|
9095
|
+
});
|
|
9096
|
+
return _el$;
|
|
9097
|
+
})();
|
|
9098
|
+
}
|
|
9099
|
+
function $3716b8caf7f959e2$var$make_state_saved_rows(
|
|
9100
|
+
// similar to the one in SearchRecommendations.tsx but not enough to warrant a shared function IMO
|
|
9101
|
+
[get_showing_content_results_rows, set_showing_content_results_rows], i18n_) {
|
|
9102
|
+
const currently_visible = (0, $gVhhF$solidjs.createSignal)((0, $gVhhF$solidjs.untrack)(get_showing_content_results_rows));
|
|
9103
|
+
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
9104
|
+
const rows = {
|
|
9105
|
+
currently_visible: currently_visible,
|
|
9106
|
+
start_rows: $3716b8caf7f959e2$export$70ceae36059a1036,
|
|
9107
|
+
button: (() => {
|
|
9108
|
+
const _el$6 = (0, $gVhhF$solidjsweb.getNextElement)($3716b8caf7f959e2$var$_tmpl$2);
|
|
9109
|
+
(0, $gVhhF$solidjsweb.insert)(_el$6, () => i18n_.view_more_());
|
|
9110
|
+
return _el$6;
|
|
9111
|
+
})(),
|
|
9112
|
+
view_less_button: (() => {
|
|
9113
|
+
const _el$7 = (0, $gVhhF$solidjsweb.getNextElement)($3716b8caf7f959e2$var$_tmpl$3);
|
|
9114
|
+
(0, $gVhhF$solidjsweb.insert)(_el$7, () => i18n_.view_less_());
|
|
9115
|
+
return _el$7;
|
|
9116
|
+
})(),
|
|
9117
|
+
rows_per_click: 3
|
|
9118
|
+
};
|
|
9119
|
+
(0, $gVhhF$solidjs.createComputed)((0, $gVhhF$solidjs.on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
|
|
9120
|
+
defer: true
|
|
9121
|
+
}));
|
|
9122
|
+
(0, $gVhhF$solidjs.createComputed)((0, $gVhhF$solidjs.on)(get_showing_content_results_rows, (new_rows = $3716b8caf7f959e2$export$70ceae36059a1036) => set_currently_visible(new_rows), {
|
|
9123
|
+
defer: true
|
|
9124
|
+
}));
|
|
9125
|
+
return rows;
|
|
9126
|
+
}
|
|
8459
9127
|
const $f1d7cb69f839a526$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="filter-results-for-one-row"><!#><!/><!#><!/></div>`, 6),
|
|
8460
|
-
$f1d7cb69f839a526$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="depict plp search"><div class="listing-page"
|
|
9128
|
+
$f1d7cb69f839a526$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="depict plp search"><div class="listing-page"><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/></div><!#><!/><!#><!/></div>`, 22);
|
|
8461
9129
|
function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
8462
9130
|
depict_api_: depict_api_,
|
|
8463
9131
|
search_field_value_: search_field_value_,
|
|
@@ -8486,7 +9154,11 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8486
9154
|
recommendations_layout_options_: recommendations_layout_options_,
|
|
8487
9155
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
8488
9156
|
product_card_template_: product_card_template_,
|
|
8489
|
-
modal_body_style_ref_: modal_body_style_ref_
|
|
9157
|
+
modal_body_style_ref_: modal_body_style_ref_,
|
|
9158
|
+
router_: router_,
|
|
9159
|
+
content_results_rows_: content_results_rows_,
|
|
9160
|
+
content_layout_options_: content_layout_options_,
|
|
9161
|
+
content_search_enabled_: content_search_enabled_
|
|
8490
9162
|
}) {
|
|
8491
9163
|
const [get_sorting] = current_sorting_;
|
|
8492
9164
|
const all_products_loaded_ = (0, $gVhhF$solidjs.createSignal)(false);
|
|
@@ -8544,16 +9216,23 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8544
9216
|
const SafeSearchField = (0, $gVhhF$depictaiutilishared.catchify)((0, $66b8b9a9613c141d$export$b94867ecbd698f21));
|
|
8545
9217
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $gVhhF$solidjs.createSignal)(false);
|
|
8546
9218
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $gVhhF$solidjs.createSignal)();
|
|
9219
|
+
const n_hits = (0, $gVhhF$solidjs.createMemo)(() => search_results_()?.n_hits);
|
|
8547
9220
|
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
8548
|
-
|
|
9221
|
+
number_: n_hits,
|
|
8549
9222
|
i18n_: i18n_
|
|
8550
9223
|
});
|
|
8551
9224
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $gVhhF$solidjs.createSignal)();
|
|
8552
|
-
const
|
|
9225
|
+
const no_results_text_ = (0, $gVhhF$solidjs.createMemo)(() => (search_results_()?.content_search_links?.length ? i18n_.no_products_ : i18n_.no_results_text_)());
|
|
9226
|
+
const results_for = (0, $gVhhF$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), (0, $gVhhF$solidjsweb.mergeProps)({
|
|
9227
|
+
get type() {
|
|
9228
|
+
return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).products;
|
|
9229
|
+
},
|
|
9230
|
+
number_of_results_: n_hits
|
|
9231
|
+
}, {
|
|
8553
9232
|
get_search_query_: get_search_query_,
|
|
8554
9233
|
i18n_: i18n_,
|
|
8555
9234
|
formatted_number_of_results_: formatted_number_of_results_
|
|
8556
|
-
});
|
|
9235
|
+
}));
|
|
8557
9236
|
const filters_opener = (0, $f8f64d05c525825b$export$d7841e452f2e59a8)({
|
|
8558
9237
|
set_sort_or_filter_open_: set_sort_or_filter_open_,
|
|
8559
9238
|
set_extra_els_in_results_container_: set_desktop_filter_elements,
|
|
@@ -8671,10 +9350,12 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8671
9350
|
[_el$17, _co$7] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$16.nextSibling),
|
|
8672
9351
|
_el$18 = _el$17.nextSibling,
|
|
8673
9352
|
[_el$19, _co$8] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$18.nextSibling),
|
|
8674
|
-
_el$20 = _el$
|
|
9353
|
+
_el$20 = _el$19.nextSibling,
|
|
8675
9354
|
[_el$21, _co$9] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$20.nextSibling),
|
|
8676
|
-
_el$22 = _el$
|
|
8677
|
-
[_el$23, _co$10] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$22.nextSibling)
|
|
9355
|
+
_el$22 = _el$7.nextSibling,
|
|
9356
|
+
[_el$23, _co$10] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$22.nextSibling),
|
|
9357
|
+
_el$24 = _el$23.nextSibling,
|
|
9358
|
+
[_el$25, _co$11] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$24.nextSibling);
|
|
8678
9359
|
(0, $gVhhF$solidjsweb.insert)(_el$7, get_search_field_elements, _el$9, _co$3);
|
|
8679
9360
|
(0, $gVhhF$solidjsweb.insert)(_el$7, make_category_suggestion_card_ ? (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
8680
9361
|
severity_: "error",
|
|
@@ -8686,7 +9367,29 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8686
9367
|
});
|
|
8687
9368
|
}
|
|
8688
9369
|
}) : null, _el$11, _co$4);
|
|
8689
|
-
(0, $gVhhF$solidjsweb.insert)(_el$7, (
|
|
9370
|
+
(0, $gVhhF$solidjsweb.insert)(_el$7, (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
9371
|
+
severity_: "error",
|
|
9372
|
+
message_: "ContentResults failed",
|
|
9373
|
+
get children() {
|
|
9374
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
9375
|
+
get when() {
|
|
9376
|
+
return content_search_enabled_();
|
|
9377
|
+
},
|
|
9378
|
+
get children() {
|
|
9379
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
|
|
9380
|
+
content_results_rows_: content_results_rows_,
|
|
9381
|
+
search_results_: search_results_,
|
|
9382
|
+
i18n_: i18n_,
|
|
9383
|
+
get_search_query_: get_search_query_,
|
|
9384
|
+
layout_options_: content_layout_options_,
|
|
9385
|
+
router_: router_,
|
|
9386
|
+
query_base_: search_query_base_
|
|
9387
|
+
});
|
|
9388
|
+
}
|
|
9389
|
+
});
|
|
9390
|
+
}
|
|
9391
|
+
}), _el$13, _co$5);
|
|
9392
|
+
(0, $gVhhF$solidjsweb.insert)(_el$7, () => results_filters[0](), _el$15, _co$6);
|
|
8690
9393
|
(0, $gVhhF$solidjsweb.insert)(_el$7, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8691
9394
|
get when() {
|
|
8692
9395
|
return selected_filters_[0]()?.length;
|
|
@@ -8709,7 +9412,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8709
9412
|
}
|
|
8710
9413
|
});
|
|
8711
9414
|
}
|
|
8712
|
-
}), _el$
|
|
9415
|
+
}), _el$17, _co$7);
|
|
8713
9416
|
(0, $gVhhF$solidjsweb.insert)(_el$7, (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
8714
9417
|
severity_: "error",
|
|
8715
9418
|
message_: "Search results failed",
|
|
@@ -8732,11 +9435,14 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8732
9435
|
selected_filters_: selected_filters_,
|
|
8733
9436
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
8734
9437
|
local_filter_cache_: local_filter_cache_,
|
|
8735
|
-
i18n_:
|
|
9438
|
+
i18n_: {
|
|
9439
|
+
...i18n_,
|
|
9440
|
+
no_results_text_: no_results_text_
|
|
9441
|
+
}
|
|
8736
9442
|
}
|
|
8737
9443
|
});
|
|
8738
9444
|
}
|
|
8739
|
-
}), _el$
|
|
9445
|
+
}), _el$19, _co$8);
|
|
8740
9446
|
(0, $gVhhF$solidjsweb.insert)(_el$7, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8741
9447
|
get when() {
|
|
8742
9448
|
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
@@ -8761,7 +9467,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8761
9467
|
}
|
|
8762
9468
|
});
|
|
8763
9469
|
}
|
|
8764
|
-
}), _el$
|
|
9470
|
+
}), _el$21, _co$9);
|
|
8765
9471
|
(0, $gVhhF$solidjsweb.insert)(_el$6, (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
8766
9472
|
message_: "Scroll status failed",
|
|
8767
9473
|
severity_: "error",
|
|
@@ -8774,7 +9480,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8774
9480
|
number_of_results_: (0, $gVhhF$solidjs.createMemo)(() => search_results_()?.n_hits)
|
|
8775
9481
|
});
|
|
8776
9482
|
}
|
|
8777
|
-
}), _el$
|
|
9483
|
+
}), _el$23, _co$10);
|
|
8778
9484
|
(0, $gVhhF$solidjsweb.insert)(_el$6, (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
8779
9485
|
message_: "Floating buttons failed",
|
|
8780
9486
|
severity_: "error",
|
|
@@ -8787,7 +9493,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8787
9493
|
i18n_: i18n_
|
|
8788
9494
|
});
|
|
8789
9495
|
}
|
|
8790
|
-
}), _el$
|
|
9496
|
+
}), _el$25, _co$11);
|
|
8791
9497
|
(0, $gVhhF$solidjsweb.effect)(() => (0, $gVhhF$solidjsweb.setAttribute)(_el$6, "id", (0, $0b6e2070a98de347$export$44dad306455dddf).SEARCH_PAGE));
|
|
8792
9498
|
return _el$6;
|
|
8793
9499
|
})()];
|
|
@@ -8812,6 +9518,27 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
|
|
|
8812
9518
|
cleanup: cleanup
|
|
8813
9519
|
};
|
|
8814
9520
|
}
|
|
9521
|
+
|
|
9522
|
+
/**
|
|
9523
|
+
* Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
|
|
9524
|
+
*/
|
|
9525
|
+
function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
9526
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
9527
|
+
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
9528
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
9529
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
9530
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
9531
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
9532
|
+
const to_delete = [];
|
|
9533
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
9534
|
+
const [, max_width] = sorted_sizes[i];
|
|
9535
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
9536
|
+
to_delete.push(i);
|
|
9537
|
+
}
|
|
9538
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
9539
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
9540
|
+
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
9541
|
+
}
|
|
8815
9542
|
const $2c61e4cd8229c49a$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="depict plp search"></div>`, 2);
|
|
8816
9543
|
// We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
|
|
8817
9544
|
/**
|
|
@@ -8821,6 +9548,7 @@ const $2c61e4cd8229c49a$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template
|
|
|
8821
9548
|
* 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.
|
|
8822
9549
|
*/
|
|
8823
9550
|
const $2c61e4cd8229c49a$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
|
|
9551
|
+
const $2c61e4cd8229c49a$var$content_search_default = false;
|
|
8824
9552
|
const $2c61e4cd8229c49a$var$min_products_to_fetch_ = 20;
|
|
8825
9553
|
const $2c61e4cd8229c49a$export$bde3eb976dfded9 = depict_search => $2c61e4cd8229c49a$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
|
|
8826
9554
|
class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
@@ -8828,6 +9556,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8828
9556
|
#merchant_signal = (0, $gVhhF$solidjs.createSignal)();
|
|
8829
9557
|
#market_signal = (0, $gVhhF$solidjs.createSignal)();
|
|
8830
9558
|
#modal_open_signal = (0, $gVhhF$solidjs.createSignal)(false);
|
|
9559
|
+
#content_search_signal = (0, $gVhhF$solidjs.createSignal)();
|
|
8831
9560
|
static #keys_constructed_with = new Set();
|
|
8832
9561
|
#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
|
|
8833
9562
|
constructor({
|
|
@@ -8837,9 +9566,10 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8837
9566
|
on_navigation: on_navigation,
|
|
8838
9567
|
enable_category_suggestions = true,
|
|
8839
9568
|
page_url_creator: page_url_creator,
|
|
9569
|
+
display_transformers: display_transformers,
|
|
9570
|
+
api: api,
|
|
8840
9571
|
// Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
8841
9572
|
disable_scrolling_during_modal = true,
|
|
8842
|
-
api: api,
|
|
8843
9573
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
8844
9574
|
render_instant_card: render_instant_card,
|
|
8845
9575
|
...props_on_class
|
|
@@ -8873,6 +9603,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8873
9603
|
local_filter_cache: [],
|
|
8874
9604
|
expanded_hierarchical_filters: [],
|
|
8875
9605
|
showing_recommendation_rows: (0, $fb29c6201c369e39$export$1c8c715550dc689d),
|
|
9606
|
+
content_results_rows: (0, $3716b8caf7f959e2$export$70ceae36059a1036),
|
|
8876
9607
|
scroll_restoration_data: []
|
|
8877
9608
|
}),
|
|
8878
9609
|
router_: this.#router,
|
|
@@ -8883,12 +9614,18 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8883
9614
|
const get_search_query_ = (0, $gVhhF$solidjs.createMemo)(previous_value => {
|
|
8884
9615
|
if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
|
|
8885
9616
|
});
|
|
9617
|
+
// @ts-ignore
|
|
8886
9618
|
const depict_api_ = api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)({
|
|
8887
|
-
page_url_creator: page_url_creator
|
|
9619
|
+
page_url_creator: page_url_creator,
|
|
9620
|
+
display_transformers: display_transformers
|
|
8888
9621
|
});
|
|
8889
9622
|
const previous_searches = (0, $2b7a005a65221045$export$84bba84a7b837187)(get_search_query_);
|
|
8890
9623
|
const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
|
|
8891
|
-
const
|
|
9624
|
+
const [, set_search_content_results_rows] = state_.content_results_rows;
|
|
9625
|
+
const after_submit_ = () => {
|
|
9626
|
+
set_search_showing_recommendation_rows((0, $fb29c6201c369e39$export$1c8c715550dc689d));
|
|
9627
|
+
set_search_content_results_rows((0, $3716b8caf7f959e2$export$70ceae36059a1036));
|
|
9628
|
+
}; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
8892
9629
|
const on_submit_with_unchanged_value_ = () => this.modal_open = false;
|
|
8893
9630
|
const [get_search_field_value_, set_search_field_value_] = state_.field_value;
|
|
8894
9631
|
const configured_submit_query_ = new_query => (0, $f328bd45f8ede33c$export$e16630ecb9644a1c)({
|
|
@@ -8946,6 +9683,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8946
9683
|
submit_query_: configured_submit_query_,
|
|
8947
9684
|
url_transformer_: url_transformer,
|
|
8948
9685
|
router_: this.#router,
|
|
9686
|
+
content_search_enabled_: () => this.#content_search_signal[0]() ?? $2c61e4cd8229c49a$var$content_search_default,
|
|
8949
9687
|
instant_results_options_: {
|
|
8950
9688
|
min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
|
|
8951
9689
|
render_instant_card_: render_instant_card,
|
|
@@ -9010,6 +9748,12 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
9010
9748
|
(0, $gVhhF$solidjs.onCleanup)(() => $2c61e4cd8229c49a$export$ac6237957a15b3f0.#keys_constructed_with.delete(unique_instance_key_for_state));
|
|
9011
9749
|
});
|
|
9012
9750
|
}
|
|
9751
|
+
get enable_content_search() {
|
|
9752
|
+
return this.#content_search_signal[0]();
|
|
9753
|
+
}
|
|
9754
|
+
set enable_content_search(new_state) {
|
|
9755
|
+
this.#content_search_signal[1](new_state);
|
|
9756
|
+
}
|
|
9013
9757
|
get on_navigation() {
|
|
9014
9758
|
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
9015
9759
|
return this.#router.on_navigation_;
|
|
@@ -9091,6 +9835,7 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
9091
9835
|
depict_api_: shared_properties.depict_api_,
|
|
9092
9836
|
min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
|
|
9093
9837
|
local_filter_cache_: state_.local_filter_cache,
|
|
9838
|
+
content_search_enabled_: () => depict_search.enable_content_search ?? $2c61e4cd8229c49a$var$content_search_default,
|
|
9094
9839
|
search_field_value_: state_.field_value,
|
|
9095
9840
|
get_search_query_: shared_properties.get_search_query_,
|
|
9096
9841
|
clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
|
|
@@ -9117,6 +9862,8 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
9117
9862
|
search_filters_open_: state_.filters_open,
|
|
9118
9863
|
search_sorting_open_: state_.sorting_open,
|
|
9119
9864
|
expanded_filters_: state_.expanded_filters,
|
|
9865
|
+
content_results_rows_: state_.content_results_rows,
|
|
9866
|
+
router_: shared_properties.router_,
|
|
9120
9867
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
9121
9868
|
return (0, $dae23104ba8bb78c$export$d757d54550ebfb3d)({
|
|
9122
9869
|
category_suggestion_: category_suggestion_,
|
|
@@ -9132,6 +9879,10 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
9132
9879
|
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(props.cols_at_size),
|
|
9133
9880
|
...grid_spacing_override()
|
|
9134
9881
|
})),
|
|
9882
|
+
content_layout_options_: (0, $gVhhF$solidjs.createMemo)(() => ({
|
|
9883
|
+
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)((0, $ab7c6c7911bae2f5$export$ff7109b9b2b206ba)(props.cols_at_size)),
|
|
9884
|
+
...grid_spacing_override()
|
|
9885
|
+
})),
|
|
9135
9886
|
recommendations_layout_options_: (0, $gVhhF$solidjs.createMemo)(() => {
|
|
9136
9887
|
const {
|
|
9137
9888
|
extra_depict_options: extra_depict_options
|