@depict-ai/ui 1.4.4 → 1.4.6
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 +1080 -251
- package/ES10/index.d.ts +105 -24
- package/ES10/index.js +1080 -251
- package/latest/index.cjs +978 -219
- package/latest/index.d.ts +105 -24
- package/latest/index.js +978 -219
- 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 +915 -179
- package/server/ES10/index.d.ts +105 -24
- package/server/ES10/index.js +915 -179
- package/server/latest/index.cjs +822 -153
- package/server/latest/index.d.ts +105 -24
- package/server/latest/index.js +822 -153
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.6";
|
|
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"]);
|
|
@@ -2842,6 +2859,43 @@ function $6e22b5314fb52f4c$var$history_state_change(signals, entries, state) {
|
|
|
2842
2859
|
}
|
|
2843
2860
|
});
|
|
2844
2861
|
}
|
|
2862
|
+
const $d84fe647b84b5dc5$export$3064e1e8c6513da3 = new Set();
|
|
2863
|
+
let $d84fe647b84b5dc5$var$has_ran = false;
|
|
2864
|
+
function $d84fe647b84b5dc5$export$5162a71f252e6122() {
|
|
2865
|
+
if ($d84fe647b84b5dc5$var$has_ran || typeof history !== "object") return;
|
|
2866
|
+
$d84fe647b84b5dc5$var$has_ran = true;
|
|
2867
|
+
for (const function_name of ["replaceState", "pushState"]) {
|
|
2868
|
+
if (Object.getOwnPropertyNames(history).includes(function_name)) $d84fe647b84b5dc5$var$proxy_push_state(function_name, history);
|
|
2869
|
+
$d84fe647b84b5dc5$var$proxy_push_state(function_name, History.prototype);
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
function $d84fe647b84b5dc5$var$proxy_push_state(function_name, thing) {
|
|
2873
|
+
thing[function_name] = new Proxy(thing[function_name], {
|
|
2874
|
+
apply(target, this_arg, arg_list) {
|
|
2875
|
+
try {
|
|
2876
|
+
if (typeof arg_list[0] == "object") {
|
|
2877
|
+
const cloned_object = {
|
|
2878
|
+
...arg_list[0]
|
|
2879
|
+
};
|
|
2880
|
+
const old_state = history.state;
|
|
2881
|
+
for (const key in old_state) {
|
|
2882
|
+
if (!$d84fe647b84b5dc5$var$starts_with_any_prefix(key)) continue;
|
|
2883
|
+
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
2884
|
+
}
|
|
2885
|
+
arg_list[0] = cloned_object;
|
|
2886
|
+
}
|
|
2887
|
+
} catch (e) {
|
|
2888
|
+
(0, $gVhhF$depictaiutilishared.report)([e, "Failed to preserve items in history.state"], "error");
|
|
2889
|
+
}
|
|
2890
|
+
return Reflect.apply(target, this_arg, arg_list);
|
|
2891
|
+
}
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
function $d84fe647b84b5dc5$var$starts_with_any_prefix(key) {
|
|
2895
|
+
for (const prefix of $d84fe647b84b5dc5$export$3064e1e8c6513da3) {
|
|
2896
|
+
if (key.startsWith(prefix)) return true;
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2845
2899
|
function $26a56f6b44703084$export$9862539c89138352({
|
|
2846
2900
|
get_default_values_: get_default_values_,
|
|
2847
2901
|
router_: router_,
|
|
@@ -2861,6 +2915,8 @@ function $26a56f6b44703084$export$9862539c89138352({
|
|
|
2861
2915
|
};
|
|
2862
2916
|
let unprefixed_state;
|
|
2863
2917
|
unprefixed_state = Object.fromEntries(Object.entries(prefixed_state).map(([key, value]) => [key.slice(prefix_.length), value]));
|
|
2918
|
+
(0, $d84fe647b84b5dc5$export$3064e1e8c6513da3).add(prefix_);
|
|
2919
|
+
// There's intentionally no onCleanup here since we want to preserve the state even if all components (in i.e. react-ui) that use the provider running this are unmounted and the provider is destroyed, since it might be re-created and need the old state (for example for doing scroll restoration)
|
|
2864
2920
|
return [reset_state, unprefixed_state];
|
|
2865
2921
|
}
|
|
2866
2922
|
|
|
@@ -2934,14 +2990,18 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2934
2990
|
}
|
|
2935
2991
|
}
|
|
2936
2992
|
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
2937
|
-
|
|
2993
|
+
const page_url_creator = this.page_url_creator;
|
|
2994
|
+
const category_transformer = this.display_transformers?.categories;
|
|
2995
|
+
if (!page_url_creator && !category_transformer) return response;
|
|
2938
2996
|
// find category suggestions, run thing with them, and then replace them
|
|
2939
2997
|
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
|
|
2940
|
-
const page_urls = await
|
|
2941
|
-
type: "categories",
|
|
2998
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2942
2999
|
market: market,
|
|
2943
3000
|
merchant: merchant,
|
|
2944
|
-
data: [...category_suggestions]
|
|
3001
|
+
data: [...category_suggestions],
|
|
3002
|
+
...(page_url_creator ? {
|
|
3003
|
+
type: "categories"
|
|
3004
|
+
} : {})
|
|
2945
3005
|
});
|
|
2946
3006
|
this.#guard_url_creator_length(category_suggestions, page_urls);
|
|
2947
3007
|
while (page_urls.length)
|
|
@@ -2949,17 +3009,29 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2949
3009
|
Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
|
|
2950
3010
|
return response;
|
|
2951
3011
|
}
|
|
2952
|
-
async #
|
|
2953
|
-
|
|
3012
|
+
async #run_display_transformers_for_rest(merchant, market, input_data) {
|
|
3013
|
+
const {
|
|
3014
|
+
page_url_creator: page_url_creator,
|
|
3015
|
+
display_transformers: display_transformers
|
|
3016
|
+
} = this;
|
|
3017
|
+
if (!page_url_creator && !display_transformers) return input_data;
|
|
3018
|
+
const product_transformer = display_transformers?.products;
|
|
3019
|
+
const category_transformer = display_transformers?.categories;
|
|
3020
|
+
const content_result_transformer = display_transformers?.contentResults;
|
|
2954
3021
|
const displays = input_data.displays;
|
|
2955
|
-
const
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3022
|
+
const {
|
|
3023
|
+
breadcrumb: breadcrumb,
|
|
3024
|
+
quick_links: quick_links,
|
|
3025
|
+
content_search_links: content_search_links
|
|
3026
|
+
} = input_data;
|
|
3027
|
+
if (displays && (page_url_creator || product_transformer)) {
|
|
3028
|
+
const page_urls = await (page_url_creator || product_transformer)({
|
|
2960
3029
|
merchant: merchant,
|
|
2961
3030
|
market: market,
|
|
2962
|
-
displays: [...input_data.displays]
|
|
3031
|
+
displays: [...input_data.displays],
|
|
3032
|
+
...(page_url_creator ? {
|
|
3033
|
+
type: "products"
|
|
3034
|
+
} : {})
|
|
2963
3035
|
});
|
|
2964
3036
|
this.#guard_url_creator_length(displays, page_urls);
|
|
2965
3037
|
for (let i = 0; i < displays.length; i++) {
|
|
@@ -2977,19 +3049,30 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2977
3049
|
displays[i] = new_display_or_page_url;
|
|
2978
3050
|
}
|
|
2979
3051
|
}
|
|
2980
|
-
for (const category_display_array of [breadcrumb, quick_links]) {
|
|
3052
|
+
if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
|
|
2981
3053
|
if (!category_display_array) continue;
|
|
2982
|
-
const page_urls = await
|
|
2983
|
-
type: "categories",
|
|
3054
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2984
3055
|
merchant: merchant,
|
|
2985
3056
|
market: market,
|
|
2986
|
-
data: [...category_display_array]
|
|
3057
|
+
data: [...category_display_array],
|
|
3058
|
+
...(page_url_creator ? {
|
|
3059
|
+
type: "categories"
|
|
3060
|
+
} : {})
|
|
2987
3061
|
});
|
|
2988
3062
|
this.#guard_url_creator_length(category_display_array, page_urls);
|
|
2989
3063
|
for (let i = 0; i < category_display_array.length; i++)
|
|
2990
3064
|
// Copy over getters so we sneakily can make this reactive
|
|
2991
3065
|
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
2992
3066
|
}
|
|
3067
|
+
if (content_search_links?.length && content_result_transformer) {
|
|
3068
|
+
const result = await content_result_transformer({
|
|
3069
|
+
merchant: merchant,
|
|
3070
|
+
market: market,
|
|
3071
|
+
data: [...content_search_links]
|
|
3072
|
+
});
|
|
3073
|
+
this.#guard_url_creator_length(content_search_links, result);
|
|
3074
|
+
input_data.content_search_links = result;
|
|
3075
|
+
}
|
|
2993
3076
|
return input_data;
|
|
2994
3077
|
}
|
|
2995
3078
|
async #cached_post_request(endpoint, input_req, fallback_response) {
|
|
@@ -3016,7 +3099,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
3016
3099
|
let result;
|
|
3017
3100
|
try {
|
|
3018
3101
|
const unmodified_result = await api_response.json();
|
|
3019
|
-
result = await this.#
|
|
3102
|
+
result = await this.#run_display_transformers_for_rest(input_req.tenant, input_req.market, unmodified_result);
|
|
3020
3103
|
} catch (e) {
|
|
3021
3104
|
(0, $gVhhF$depictaiutilishared.dwarn)("URL creator or json decoding failed", e);
|
|
3022
3105
|
break return_successfully;
|
|
@@ -3048,12 +3131,14 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
3048
3131
|
get_metadata: get_metadata,
|
|
3049
3132
|
get_user_id: get_user_id,
|
|
3050
3133
|
get_session_id: get_session_id,
|
|
3051
|
-
page_url_creator: page_url_creator
|
|
3134
|
+
page_url_creator: page_url_creator,
|
|
3135
|
+
display_transformers: display_transformers
|
|
3052
3136
|
} = options ?? {};
|
|
3053
3137
|
this.#get_metadata = get_metadata;
|
|
3054
3138
|
this.#get_user_id = get_user_id;
|
|
3055
3139
|
this.#get_session_id = get_session_id;
|
|
3056
3140
|
this.page_url_creator = page_url_creator;
|
|
3141
|
+
this.display_transformers = display_transformers;
|
|
3057
3142
|
}
|
|
3058
3143
|
async suggest(input_req) {
|
|
3059
3144
|
const with_ids = this.#add_ids_to_request(input_req);
|
|
@@ -3163,11 +3248,11 @@ function $6b384adf40a5f4d7$var$correct_range_filter_range_once({
|
|
|
3163
3248
|
}
|
|
3164
3249
|
}
|
|
3165
3250
|
function $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
|
|
3166
|
-
|
|
3251
|
+
number_: number_,
|
|
3167
3252
|
i18n_: i18n_
|
|
3168
3253
|
}) {
|
|
3169
3254
|
return (0, $gVhhF$solidjs.createMemo)(() => {
|
|
3170
|
-
const n_hits =
|
|
3255
|
+
const n_hits = number_();
|
|
3171
3256
|
if (isNaN(n_hits)) return "";
|
|
3172
3257
|
const price_formatting = i18n_.price_formatting_();
|
|
3173
3258
|
return (0, $gVhhF$depictaiutilishared.standard_price_format)(n_hits, 0,
|
|
@@ -5649,7 +5734,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
5649
5734
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $gVhhF$solidjs.createSignal)(false);
|
|
5650
5735
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $gVhhF$solidjs.createSignal)();
|
|
5651
5736
|
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
5652
|
-
|
|
5737
|
+
number_: (0, $gVhhF$solidjs.createMemo)(() => plp_results_()?.n_hits),
|
|
5653
5738
|
i18n_: i18n_
|
|
5654
5739
|
});
|
|
5655
5740
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $gVhhF$solidjs.createSignal)();
|
|
@@ -5914,37 +5999,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
5914
5999
|
return _el$13;
|
|
5915
6000
|
})()];
|
|
5916
6001
|
}
|
|
5917
|
-
let $d84fe647b84b5dc5$var$has_ran = false;
|
|
5918
|
-
function $d84fe647b84b5dc5$export$5162a71f252e6122() {
|
|
5919
|
-
if ($d84fe647b84b5dc5$var$has_ran || typeof history !== "object") return;
|
|
5920
|
-
$d84fe647b84b5dc5$var$has_ran = true;
|
|
5921
|
-
for (const function_name of ["replaceState", "pushState"]) {
|
|
5922
|
-
if (Object.getOwnPropertyNames(history).includes(function_name)) $d84fe647b84b5dc5$var$proxy_push_state(function_name, history);
|
|
5923
|
-
$d84fe647b84b5dc5$var$proxy_push_state(function_name, History.prototype);
|
|
5924
|
-
}
|
|
5925
|
-
}
|
|
5926
|
-
function $d84fe647b84b5dc5$var$proxy_push_state(function_name, thing) {
|
|
5927
|
-
thing[function_name] = new Proxy(thing[function_name], {
|
|
5928
|
-
apply(target, this_arg, arg_list) {
|
|
5929
|
-
try {
|
|
5930
|
-
if (typeof arg_list[0] == "object") {
|
|
5931
|
-
const cloned_object = {
|
|
5932
|
-
...arg_list[0]
|
|
5933
|
-
};
|
|
5934
|
-
const old_state = history.state;
|
|
5935
|
-
for (const key in old_state) {
|
|
5936
|
-
if (!key.startsWith("category_") && !key.startsWith("search_")) continue;
|
|
5937
|
-
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
5938
|
-
}
|
|
5939
|
-
arg_list[0] = cloned_object;
|
|
5940
|
-
}
|
|
5941
|
-
} catch (e) {
|
|
5942
|
-
(0, $gVhhF$depictaiutilishared.report)([e, "Failed to preserve items in history.state"], "error");
|
|
5943
|
-
}
|
|
5944
|
-
return Reflect.apply(target, this_arg, arg_list);
|
|
5945
|
-
}
|
|
5946
|
-
});
|
|
5947
|
-
}
|
|
5948
6002
|
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
5949
6003
|
const cols_at_size = [];
|
|
5950
6004
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -6230,7 +6284,6 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
6230
6284
|
}
|
|
6231
6285
|
const $48567ac5b39bac56$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="depict plp category"></div>`, 2);
|
|
6232
6286
|
// 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
6287
|
/**
|
|
6235
6288
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions.
|
|
6236
6289
|
* SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
@@ -6295,6 +6348,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
6295
6348
|
api: api,
|
|
6296
6349
|
on_navigation: on_navigation,
|
|
6297
6350
|
page_url_creator: page_url_creator,
|
|
6351
|
+
display_transformers: display_transformers,
|
|
6298
6352
|
unique_instance_key_for_state = "",
|
|
6299
6353
|
query_id_state_key: query_id_state_key,
|
|
6300
6354
|
...props_on_class
|
|
@@ -6339,8 +6393,10 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
6339
6393
|
quicklinks_signal_: (0, $gVhhF$solidjs.createSignal)(),
|
|
6340
6394
|
i18n_: i18n_,
|
|
6341
6395
|
reset_history_state_: reset_history_state_,
|
|
6396
|
+
// @ts-ignore
|
|
6342
6397
|
depict_api_: api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)({
|
|
6343
|
-
page_url_creator: page_url_creator
|
|
6398
|
+
page_url_creator: page_url_creator,
|
|
6399
|
+
display_transformers: display_transformers
|
|
6344
6400
|
}),
|
|
6345
6401
|
router_: this.#router,
|
|
6346
6402
|
selected_filters_: selected_filters_,
|
|
@@ -6967,11 +7023,11 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
6967
7023
|
});
|
|
6968
7024
|
}
|
|
6969
7025
|
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);
|
|
7026
|
+
const currently_visible = (0, $gVhhF$solidjs.createSignal)((0, $gVhhF$solidjs.untrack)(get_showing_recommendation_rows));
|
|
6971
7027
|
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
6972
7028
|
const rows = {
|
|
6973
7029
|
currently_visible: currently_visible,
|
|
6974
|
-
start_rows:
|
|
7030
|
+
start_rows: $fb29c6201c369e39$export$1c8c715550dc689d,
|
|
6975
7031
|
rows_per_click: 3,
|
|
6976
7032
|
button: (() => {
|
|
6977
7033
|
const _el$7 = (0, $gVhhF$solidjsweb.getNextElement)($fb29c6201c369e39$var$_tmpl$2);
|
|
@@ -7137,7 +7193,7 @@ const $639c124c22b6cbaa$export$27b710c08412a7ad = obj => {
|
|
|
7137
7193
|
return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
|
|
7138
7194
|
};
|
|
7139
7195
|
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),
|
|
7196
|
+
$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
7197
|
$6ae613870d3380fc$var$_tmpl$3 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="tagline"></div>`, 2);
|
|
7142
7198
|
const $6ae613870d3380fc$export$b05c0ae390cf3e06 = (display_or_variant_container, {
|
|
7143
7199
|
i18n: i18n
|
|
@@ -7271,9 +7327,11 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
|
7271
7327
|
render_instant_card_placeholder_: render_instant_card_placeholder_,
|
|
7272
7328
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
7273
7329
|
has_sort_or_filters_: has_sort_or_filters_,
|
|
7274
|
-
|
|
7330
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
7275
7331
|
i18n_: i18n_,
|
|
7276
|
-
router_: router_
|
|
7332
|
+
router_: router_,
|
|
7333
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
7334
|
+
content_search_enabled_: content_search_enabled_
|
|
7277
7335
|
}) {
|
|
7278
7336
|
const max_cards = 4;
|
|
7279
7337
|
const [read_current_instant_query, write_current_instant_query] = (0, $gVhhF$solidjs.createSignal)("");
|
|
@@ -7298,8 +7356,17 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
|
7298
7356
|
...variable_data
|
|
7299
7357
|
});
|
|
7300
7358
|
}));
|
|
7301
|
-
|
|
7302
|
-
|
|
7359
|
+
// 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
|
|
7360
|
+
// This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
|
|
7361
|
+
set_modal_search_results_(() => search_results);
|
|
7362
|
+
(0, $gVhhF$solidjs.onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
|
|
7363
|
+
set_total_num_results_accessor_(() => (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
7364
|
+
number_: (0, $gVhhF$solidjs.createMemo)(() => {
|
|
7365
|
+
const hits = search_results()?.n_hits;
|
|
7366
|
+
const content_results = search_results()?.content_search_links?.length;
|
|
7367
|
+
if (!content_results || !content_search_enabled_()) return hits;
|
|
7368
|
+
return (hits ?? 0) + content_results;
|
|
7369
|
+
}),
|
|
7303
7370
|
i18n_: i18n_
|
|
7304
7371
|
}));
|
|
7305
7372
|
const sliced_displays = (0, $gVhhF$solidjs.createMemo)(() => search_results()?.displays?.slice(0, max_cards));
|
|
@@ -7397,7 +7464,7 @@ function $9e30168c4b1661d2$export$5d2caaa6b530761c() {
|
|
|
7397
7464
|
return (0, $gVhhF$solidjsweb.getNextElement)($9e30168c4b1661d2$var$_tmpl$);
|
|
7398
7465
|
}
|
|
7399
7466
|
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);
|
|
7467
|
+
$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
7468
|
function $9a268bf73b31a717$export$a146ac6fa8346a25({
|
|
7402
7469
|
text_: text_,
|
|
7403
7470
|
previous_searches_: previous_searches_,
|
|
@@ -7479,15 +7546,18 @@ function $9a268bf73b31a717$export$a146ac6fa8346a25({
|
|
|
7479
7546
|
(0, $gVhhF$solidjsweb.effect)(_p$ => {
|
|
7480
7547
|
const _v$ = !!(0, $gVhhF$solidjs.createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)(),
|
|
7481
7548
|
_v$2 = href(),
|
|
7482
|
-
_v$3 =
|
|
7549
|
+
_v$3 = item(),
|
|
7550
|
+
_v$4 = i18n_.previous_searches_delete_entry_from_history_();
|
|
7483
7551
|
_v$ !== _p$._v$ && _el$4.classList.toggle("selected", _p$._v$ = _v$);
|
|
7484
7552
|
_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$
|
|
7553
|
+
_v$3 !== _p$._v$3 && (0, $gVhhF$solidjsweb.setAttribute)(_el$6, "title", _p$._v$3 = _v$3);
|
|
7554
|
+
_v$4 !== _p$._v$4 && (0, $gVhhF$solidjsweb.setAttribute)(_el$9, "title", _p$._v$4 = _v$4);
|
|
7486
7555
|
return _p$;
|
|
7487
7556
|
}, {
|
|
7488
7557
|
_v$: undefined,
|
|
7489
7558
|
_v$2: undefined,
|
|
7490
|
-
_v$3: undefined
|
|
7559
|
+
_v$3: undefined,
|
|
7560
|
+
_v$4: undefined
|
|
7491
7561
|
});
|
|
7492
7562
|
return _el$4;
|
|
7493
7563
|
})();
|
|
@@ -7556,18 +7626,37 @@ function $d023ed916c84e75d$export$ba17c5b7e6dda39f({
|
|
|
7556
7626
|
const _el$2 = (0, $gVhhF$solidjsweb.getNextElement)($d023ed916c84e75d$var$_tmpl$2);
|
|
7557
7627
|
(0, $gVhhF$solidjsweb.className)(_el$2, class_);
|
|
7558
7628
|
(0, $gVhhF$solidjsweb.insert)(_el$2, text_itself);
|
|
7559
|
-
(0, $gVhhF$solidjsweb.effect)(
|
|
7629
|
+
(0, $gVhhF$solidjsweb.effect)(_p$ => {
|
|
7630
|
+
const _v$ = !!get_has_highlighted(),
|
|
7631
|
+
_v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
|
|
7632
|
+
_v$ !== _p$._v$ && _el$2.classList.toggle("has-history-match", _p$._v$ = _v$);
|
|
7633
|
+
_v$2 !== _p$._v$2 && (0, $gVhhF$solidjsweb.setAttribute)(_el$2, "title", _p$._v$2 = _v$2);
|
|
7634
|
+
return _p$;
|
|
7635
|
+
}, {
|
|
7636
|
+
_v$: undefined,
|
|
7637
|
+
_v$2: undefined
|
|
7638
|
+
});
|
|
7560
7639
|
return _el$2;
|
|
7561
7640
|
})();
|
|
7562
7641
|
}
|
|
7642
|
+
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);
|
|
7643
|
+
function $c0125412b4ea0c93$export$605674723bcc715c(props = {}) {
|
|
7644
|
+
return (() => {
|
|
7645
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($c0125412b4ea0c93$var$_tmpl$);
|
|
7646
|
+
(0, $gVhhF$solidjsweb.spread)(_el$, props, true, true);
|
|
7647
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
7648
|
+
return _el$;
|
|
7649
|
+
})();
|
|
7650
|
+
}
|
|
7563
7651
|
const $6b65ba8af12c5a26$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a class="suggestion"></a>`, 2),
|
|
7564
7652
|
$6b65ba8af12c5a26$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="search-icon"></div>`, 2),
|
|
7565
7653
|
$6b65ba8af12c5a26$var$_tmpl$3 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<span class="type"></span>`, 2),
|
|
7566
7654
|
$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="
|
|
7655
|
+
$6b65ba8af12c5a26$var$_tmpl$5 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="with-icon"><!#><!/><!#><!/></div>`, 6),
|
|
7656
|
+
$6b65ba8af12c5a26$var$_tmpl$6 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<h2 class="text"></h2>`, 2),
|
|
7657
|
+
$6b65ba8af12c5a26$var$_tmpl$7 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="suggestion-container query"><!#><!/><!#><!/></div>`, 6),
|
|
7658
|
+
$6b65ba8af12c5a26$var$_tmpl$8 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="suggestion-container page"></div>`, 2),
|
|
7659
|
+
$6b65ba8af12c5a26$var$_tmpl$9 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="suggestions"><!#><!/><!#><!/><!#><!/></div>`, 8);
|
|
7571
7660
|
function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
7572
7661
|
suggestion_memo_: suggestion_memo_,
|
|
7573
7662
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
@@ -7580,7 +7669,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7580
7669
|
include_category_suggestions_: include_category_suggestions_,
|
|
7581
7670
|
searching_for_value_: searching_for_value_,
|
|
7582
7671
|
router_: router_,
|
|
7583
|
-
submit_query_: submit_query_
|
|
7672
|
+
submit_query_: submit_query_,
|
|
7673
|
+
get_content_results_: get_content_results_
|
|
7584
7674
|
}) {
|
|
7585
7675
|
const queries_memo = (0, $gVhhF$solidjs.createMemo)(() => suggestion_memo_().filter(({
|
|
7586
7676
|
type: type,
|
|
@@ -7588,9 +7678,15 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7588
7678
|
}) => type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
7589
7679
|
));
|
|
7590
7680
|
|
|
7591
|
-
const not_queries_memo = (0, $gVhhF$solidjs.createMemo)(() =>
|
|
7592
|
-
|
|
7593
|
-
|
|
7681
|
+
const not_queries_memo = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
7682
|
+
// For the section that shows categories and content results
|
|
7683
|
+
// We want to limit to 3 items, and we want to show the categories first
|
|
7684
|
+
const content_results = get_content_results_() || [];
|
|
7685
|
+
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(({
|
|
7686
|
+
type: type
|
|
7687
|
+
}) => type !== (0, $3ec9e21d6b6debdd$export$3cf9497e790da491)) : [];
|
|
7688
|
+
return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
|
|
7689
|
+
});
|
|
7594
7690
|
const render_entry = (input_obj, autocomplete_data_index, index, is_history = false) => {
|
|
7595
7691
|
const is_query = (0, $gVhhF$solidjs.createMemo)(() => input_obj().type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491));
|
|
7596
7692
|
const href_with_changed_params_accessor = (0, $gVhhF$solidjs.createMemo)(() => is_query() ? (0, $496cde876b53ce1e$export$91c3b6774e8be0f5)({
|
|
@@ -7599,6 +7695,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7599
7695
|
url_transformer_: url_transformer_
|
|
7600
7696
|
}) : undefined);
|
|
7601
7697
|
const href = (0, $gVhhF$solidjs.createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
7698
|
+
const is_selected = (0, $gVhhF$solidjs.createMemo)(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
7602
7699
|
return (() => {
|
|
7603
7700
|
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$);
|
|
7604
7701
|
(0, $gVhhF$solidjsweb.use)(element => element.addEventListener("click", (0, $gVhhF$depictaiutilishared.catchify)(ev => {
|
|
@@ -7612,7 +7709,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7612
7709
|
return;
|
|
7613
7710
|
}
|
|
7614
7711
|
router_.navigate_.go_to_({
|
|
7615
|
-
new_url_:
|
|
7712
|
+
new_url_: href(),
|
|
7616
7713
|
is_replace_: false,
|
|
7617
7714
|
event_: ev
|
|
7618
7715
|
});
|
|
@@ -7634,20 +7731,20 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7634
7731
|
return (0, $gVhhF$solidjsweb.createComponent)((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {});
|
|
7635
7732
|
}
|
|
7636
7733
|
}), (0, $gVhhF$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
7637
|
-
class_: "value",
|
|
7734
|
+
class_: "value line-clamp",
|
|
7638
7735
|
get whole_text_to_display_() {
|
|
7639
7736
|
return (0, $gVhhF$solidjs.createMemo)(() => input_obj().title);
|
|
7640
7737
|
},
|
|
7641
7738
|
searching_for_value_: searching_for_value_
|
|
7642
7739
|
})] : [(0, $gVhhF$solidjsweb.memo)((() => {
|
|
7643
|
-
const _c$2 = (0, $gVhhF$solidjsweb.memo)(() => typeof input_obj()
|
|
7740
|
+
const _c$2 = (0, $gVhhF$solidjsweb.memo)(() => typeof input_obj() /* this is a harmless lie */.parent_title === "string");
|
|
7644
7741
|
return () => _c$2() ? (() => {
|
|
7645
7742
|
const _el$4 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$4),
|
|
7646
7743
|
_el$6 = _el$4.firstChild,
|
|
7647
7744
|
[_el$7, _co$] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$6.nextSibling),
|
|
7648
7745
|
_el$5 = _el$7.nextSibling;
|
|
7649
7746
|
(0, $gVhhF$solidjsweb.insert)(_el$4, (0, $gVhhF$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
7650
|
-
class_: "category",
|
|
7747
|
+
class_: "category line-clamp",
|
|
7651
7748
|
get whole_text_to_display_() {
|
|
7652
7749
|
return (0, $gVhhF$solidjs.createMemo)(() => input_obj().title);
|
|
7653
7750
|
},
|
|
@@ -7655,16 +7752,38 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7655
7752
|
}), _el$7, _co$);
|
|
7656
7753
|
(0, $gVhhF$solidjsweb.insert)(_el$5, () => input_obj().parent_title);
|
|
7657
7754
|
return _el$4;
|
|
7658
|
-
})() : (
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7755
|
+
})() : (() => {
|
|
7756
|
+
const _c$3 = (0, $gVhhF$solidjsweb.memo)(() => input_obj().type === "content");
|
|
7757
|
+
return () => _c$3() ? (() => {
|
|
7758
|
+
const _el$8 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$5),
|
|
7759
|
+
_el$9 = _el$8.firstChild,
|
|
7760
|
+
[_el$10, _co$2] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$9.nextSibling),
|
|
7761
|
+
_el$11 = _el$10.nextSibling,
|
|
7762
|
+
[_el$12, _co$3] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$11.nextSibling);
|
|
7763
|
+
(0, $gVhhF$solidjsweb.insert)(_el$8, (0, $gVhhF$solidjsweb.createComponent)((0, $c0125412b4ea0c93$export$605674723bcc715c), {
|
|
7764
|
+
width: "16",
|
|
7765
|
+
height: "16"
|
|
7766
|
+
}), _el$10, _co$2);
|
|
7767
|
+
(0, $gVhhF$solidjsweb.insert)(_el$8, (0, $gVhhF$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
7768
|
+
class_: "content 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
|
+
}), _el$12, _co$3);
|
|
7774
|
+
return _el$8;
|
|
7775
|
+
})() : (0, $gVhhF$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
7776
|
+
class_: "category line-clamp",
|
|
7777
|
+
get whole_text_to_display_() {
|
|
7778
|
+
return (0, $gVhhF$solidjs.createMemo)(() => input_obj().title);
|
|
7779
|
+
},
|
|
7780
|
+
searching_for_value_: searching_for_value_
|
|
7781
|
+
});
|
|
7782
|
+
})();
|
|
7665
7783
|
})()), (() => {
|
|
7666
7784
|
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$3);
|
|
7667
7785
|
(0, $gVhhF$solidjsweb.insert)(_el$3, (0, $gVhhF$solidjs.createMemo)(() => {
|
|
7786
|
+
if (input_obj().type === "content") return i18n_.content_();
|
|
7668
7787
|
if (input_obj().category_type === "BRAND") return i18n_.brand_();
|
|
7669
7788
|
return i18n_.category_();
|
|
7670
7789
|
}));
|
|
@@ -7673,7 +7792,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7673
7792
|
})());
|
|
7674
7793
|
(0, $gVhhF$solidjsweb.effect)(_p$ => {
|
|
7675
7794
|
const _v$ = {
|
|
7676
|
-
selected: (
|
|
7795
|
+
selected: is_selected(),
|
|
7677
7796
|
history: is_history,
|
|
7678
7797
|
["type-" + input_obj().type]: true
|
|
7679
7798
|
},
|
|
@@ -7699,41 +7818,41 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7699
7818
|
}));
|
|
7700
7819
|
};
|
|
7701
7820
|
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);
|
|
7821
|
+
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
7822
|
const should_show_query_part = (0, $gVhhF$solidjs.createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
|
|
7704
7823
|
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7705
7824
|
get when() {
|
|
7706
7825
|
return should_show_at_all();
|
|
7707
7826
|
},
|
|
7708
7827
|
get children() {
|
|
7709
|
-
const _el$
|
|
7710
|
-
_el$
|
|
7711
|
-
[_el$
|
|
7712
|
-
_el$
|
|
7713
|
-
[_el$
|
|
7714
|
-
_el$
|
|
7715
|
-
[_el$
|
|
7716
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7828
|
+
const _el$13 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$9),
|
|
7829
|
+
_el$21 = _el$13.firstChild,
|
|
7830
|
+
[_el$22, _co$6] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$21.nextSibling),
|
|
7831
|
+
_el$23 = _el$22.nextSibling,
|
|
7832
|
+
[_el$24, _co$7] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$23.nextSibling),
|
|
7833
|
+
_el$25 = _el$24.nextSibling,
|
|
7834
|
+
[_el$26, _co$8] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$25.nextSibling);
|
|
7835
|
+
(0, $gVhhF$solidjsweb.insert)(_el$13, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7717
7836
|
get when() {
|
|
7718
7837
|
return on_previous_searches_page_();
|
|
7719
7838
|
},
|
|
7720
7839
|
get children() {
|
|
7721
|
-
const _el$
|
|
7722
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7723
|
-
return _el$
|
|
7840
|
+
const _el$14 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$6);
|
|
7841
|
+
(0, $gVhhF$solidjsweb.insert)(_el$14, () => i18n_.suggestions_());
|
|
7842
|
+
return _el$14;
|
|
7724
7843
|
}
|
|
7725
|
-
}), _el$
|
|
7726
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7844
|
+
}), _el$22, _co$6);
|
|
7845
|
+
(0, $gVhhF$solidjsweb.insert)(_el$13, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7727
7846
|
get when() {
|
|
7728
7847
|
return should_show_query_part();
|
|
7729
7848
|
},
|
|
7730
7849
|
get children() {
|
|
7731
|
-
const _el$
|
|
7732
|
-
_el$
|
|
7733
|
-
[_el$
|
|
7734
|
-
_el$
|
|
7735
|
-
[_el$
|
|
7736
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7850
|
+
const _el$15 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$7),
|
|
7851
|
+
_el$16 = _el$15.firstChild,
|
|
7852
|
+
[_el$17, _co$4] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$16.nextSibling),
|
|
7853
|
+
_el$18 = _el$17.nextSibling,
|
|
7854
|
+
[_el$19, _co$5] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$18.nextSibling);
|
|
7855
|
+
(0, $gVhhF$solidjsweb.insert)(_el$15, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7737
7856
|
get when() {
|
|
7738
7857
|
return should_show_previous_searches_in_query_part();
|
|
7739
7858
|
},
|
|
@@ -7756,8 +7875,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7756
7875
|
});
|
|
7757
7876
|
})();
|
|
7758
7877
|
}
|
|
7759
|
-
}), _el$
|
|
7760
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7878
|
+
}), _el$17, _co$4);
|
|
7879
|
+
(0, $gVhhF$solidjsweb.insert)(_el$15, () => {
|
|
7761
7880
|
const index_in_autocomplete = 2;
|
|
7762
7881
|
set_list_until_cleanup(queries_memo, index_in_autocomplete);
|
|
7763
7882
|
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Index), {
|
|
@@ -7766,18 +7885,18 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7766
7885
|
},
|
|
7767
7886
|
children: (item, index) => render_entry(item, index_in_autocomplete, index)
|
|
7768
7887
|
});
|
|
7769
|
-
}, _el$
|
|
7770
|
-
return _el$
|
|
7888
|
+
}, _el$19, _co$5);
|
|
7889
|
+
return _el$15;
|
|
7771
7890
|
}
|
|
7772
|
-
}), _el$
|
|
7773
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7891
|
+
}), _el$24, _co$7);
|
|
7892
|
+
(0, $gVhhF$solidjsweb.insert)(_el$13, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
7774
7893
|
get when() {
|
|
7775
|
-
return not_queries_memo().length
|
|
7894
|
+
return not_queries_memo().length;
|
|
7776
7895
|
},
|
|
7777
7896
|
keyed: false,
|
|
7778
7897
|
get children() {
|
|
7779
|
-
const _el$
|
|
7780
|
-
(0, $gVhhF$solidjsweb.insert)(_el$
|
|
7898
|
+
const _el$20 = (0, $gVhhF$solidjsweb.getNextElement)($6b65ba8af12c5a26$var$_tmpl$8);
|
|
7899
|
+
(0, $gVhhF$solidjsweb.insert)(_el$20, () => {
|
|
7781
7900
|
const index_in_autocomplete = 3;
|
|
7782
7901
|
set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
|
|
7783
7902
|
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Index), {
|
|
@@ -7787,15 +7906,30 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
7787
7906
|
children: (item, index) => render_entry(item, index_in_autocomplete, index)
|
|
7788
7907
|
});
|
|
7789
7908
|
});
|
|
7790
|
-
return _el$
|
|
7909
|
+
return _el$20;
|
|
7791
7910
|
}
|
|
7792
|
-
}), _el$
|
|
7793
|
-
(0, $gVhhF$solidjsweb.effect)(() => _el$
|
|
7794
|
-
return _el$
|
|
7911
|
+
}), _el$26, _co$8);
|
|
7912
|
+
(0, $gVhhF$solidjsweb.effect)(() => _el$13.classList.toggle("compact", !!on_previous_searches_page_()));
|
|
7913
|
+
return _el$13;
|
|
7795
7914
|
}
|
|
7796
7915
|
});
|
|
7797
7916
|
}
|
|
7798
|
-
const $
|
|
7917
|
+
const $b8700779b3e745de$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a target="_blank"></a>`, 2);
|
|
7918
|
+
function $b8700779b3e745de$export$1efe1013da60d0e4(e, href) {
|
|
7919
|
+
if (e.metaKey || e.ctrlKey) {
|
|
7920
|
+
// Open link in a new tab with cmd/ctrl + enter.
|
|
7921
|
+
const link = (() => {
|
|
7922
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($b8700779b3e745de$var$_tmpl$);
|
|
7923
|
+
(0, $gVhhF$solidjsweb.setAttribute)(_el$, "href", href);
|
|
7924
|
+
return _el$;
|
|
7925
|
+
})();
|
|
7926
|
+
document.body.append(link);
|
|
7927
|
+
link.click();
|
|
7928
|
+
link.remove();
|
|
7929
|
+
return true;
|
|
7930
|
+
}
|
|
7931
|
+
return false;
|
|
7932
|
+
}
|
|
7799
7933
|
function $6a374b16bfe947d0$export$217899a935ef803b({
|
|
7800
7934
|
selected_index_: [read_selected_index, write_selected_index],
|
|
7801
7935
|
currently_showing_suggestions_: [read_currently_showing_suggestions],
|
|
@@ -7869,6 +8003,7 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
7869
8003
|
const sfv = get_search_field_value();
|
|
7870
8004
|
if (!(0, $gVhhF$solidjs.untrack)(() => read_updating_blocked())) previous_value = sfv;
|
|
7871
8005
|
});
|
|
8006
|
+
const owner = (0, $gVhhF$solidjs.getOwner)();
|
|
7872
8007
|
const handler = (0, $gVhhF$depictaiutilishared.catchify)(({
|
|
7873
8008
|
keyCode: keyCode
|
|
7874
8009
|
}) => (0, $gVhhF$solidjs.untrack)(() => {
|
|
@@ -7899,29 +8034,29 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
7899
8034
|
const {
|
|
7900
8035
|
title: title
|
|
7901
8036
|
} = selected_entry;
|
|
7902
|
-
|
|
8037
|
+
(0, $gVhhF$solidjs.runWithOwner)(owner, block_updating_for_one_change);
|
|
7903
8038
|
set_search_field_value(title);
|
|
7904
|
-
override_on_enter_for_this_entry(e => {
|
|
8039
|
+
(0, $gVhhF$solidjs.runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
7905
8040
|
// Open search query in new tab on cmd+enter
|
|
7906
8041
|
// 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
8042
|
const url = new URL(location);
|
|
7908
8043
|
url_transformer_?.(url);
|
|
7909
8044
|
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 => {
|
|
8045
|
+
return (0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, url.href);
|
|
8046
|
+
}));
|
|
8047
|
+
} else if (selected_entry?.type == "category" || selected_entry?.type === "content") (0, $gVhhF$solidjs.runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
7913
8048
|
const {
|
|
7914
8049
|
page_url: page_url
|
|
7915
8050
|
} = selected_entry;
|
|
7916
|
-
if (
|
|
8051
|
+
if (!(0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, page_url))
|
|
7917
8052
|
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
7918
8053
|
router_.navigate_.go_to_({
|
|
7919
8054
|
new_url_: page_url,
|
|
7920
8055
|
is_replace_: false
|
|
7921
8056
|
});
|
|
7922
8057
|
return true;
|
|
7923
|
-
});else if (!selected_entry) {
|
|
7924
|
-
|
|
8058
|
+
}));else if (!selected_entry) {
|
|
8059
|
+
(0, $gVhhF$solidjs.runWithOwner)(owner, block_updating_for_one_change);
|
|
7925
8060
|
set_search_field_value(previous_value);
|
|
7926
8061
|
}
|
|
7927
8062
|
}));
|
|
@@ -7932,20 +8067,37 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
7932
8067
|
(0, $gVhhF$solidjs.onCleanup)((0, $gVhhF$depictaiutilishared.catchify)(() => el.removeEventListener("keyup", handler)));
|
|
7933
8068
|
});
|
|
7934
8069
|
}
|
|
7935
|
-
function $
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
8070
|
+
function $4f0ae864ec7c394e$export$af0124069c150252({
|
|
8071
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
8072
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8073
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
8074
|
+
router_: router_,
|
|
8075
|
+
content_results_: content_results_
|
|
8076
|
+
}) {
|
|
8077
|
+
const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $gVhhF$solidjs.createSignal)(() => false);
|
|
8078
|
+
(0, $gVhhF$solidjs.createComputed)(() => {
|
|
8079
|
+
const suggestions = read_suggestion_signal_();
|
|
8080
|
+
const search_results = get_modal_search_results_()?.();
|
|
8081
|
+
const content_results = content_results_();
|
|
8082
|
+
// If we only have one content result and nothing else, go there when pressing enter
|
|
8083
|
+
if (!suggestions.length && !search_results?.displays?.length && content_results?.length === 1) {
|
|
8084
|
+
const [{
|
|
8085
|
+
page_url: page_url
|
|
8086
|
+
}] = content_results;
|
|
8087
|
+
set_override_on_enter_fn_(e => {
|
|
8088
|
+
if (!(0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, page_url))
|
|
8089
|
+
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
8090
|
+
router_.navigate_.go_to_({
|
|
8091
|
+
new_url_: page_url,
|
|
8092
|
+
is_replace_: false
|
|
8093
|
+
});
|
|
8094
|
+
return true;
|
|
8095
|
+
});
|
|
8096
|
+
return;
|
|
8097
|
+
}
|
|
8098
|
+
set_override_on_enter_fn_(get_autocomplete_wants_override_function());
|
|
8099
|
+
});
|
|
8100
|
+
return new_fn => set_autocomplete_wants_override_function(() => new_fn);
|
|
7949
8101
|
}
|
|
7950
8102
|
const $3ec9e21d6b6debdd$export$3cf9497e790da491 = "query";
|
|
7951
8103
|
function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
@@ -7965,12 +8117,15 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
7965
8117
|
i18n_: i18n_,
|
|
7966
8118
|
include_category_suggestions_: include_category_suggestions_,
|
|
7967
8119
|
submit_query_: submit_query_,
|
|
7968
|
-
router_: router_
|
|
8120
|
+
router_: router_,
|
|
8121
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8122
|
+
content_search_enabled_: content_search_enabled_
|
|
7969
8123
|
}) {
|
|
7970
8124
|
const [searching_for_value, set_searching_for_value] = (0, $gVhhF$solidjs.createSignal)();
|
|
8125
|
+
const [show_stale_content_results, set_show_stale_content_results] = (0, $gVhhF$solidjs.createSignal)(false);
|
|
7971
8126
|
const [read_search_field_value] = search_field_value_;
|
|
7972
8127
|
const updating_blocked = (0, $gVhhF$solidjs.createSignal)(false);
|
|
7973
|
-
const [
|
|
8128
|
+
const [read_suggestion_signal_, write_suggestion_signal] = (0, $gVhhF$solidjs.createSignal)([]);
|
|
7974
8129
|
const filtered_previous_searches = (0, $gVhhF$solidjs.createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
|
|
7975
8130
|
const deparallelized_fn = (0, $gVhhF$depictaiutilishared.deparallelize_no_drop)(async request_obj => {
|
|
7976
8131
|
const api_response = await depict_api_.suggest(request_obj);
|
|
@@ -7989,15 +8144,38 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
7989
8144
|
});
|
|
7990
8145
|
|
|
7991
8146
|
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));
|
|
8147
|
+
const get_content_results_ = (0, $gVhhF$solidjs.createMemo)(prev => {
|
|
8148
|
+
if (!content_search_enabled_()) return [];
|
|
8149
|
+
if (show_stale_content_results())
|
|
8150
|
+
// don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
|
|
8151
|
+
return prev;
|
|
8152
|
+
return get_modal_search_results_()?.()?.content_search_links?.map(link => ({
|
|
8153
|
+
page_url: link.page_url,
|
|
8154
|
+
type: "content",
|
|
8155
|
+
title: link.title
|
|
8156
|
+
}));
|
|
8157
|
+
});
|
|
8158
|
+
// 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.
|
|
8159
|
+
// It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
|
|
8160
|
+
const manipulated_set_override_on_enter_fn_ = (0, $4f0ae864ec7c394e$export$af0124069c150252)({
|
|
8161
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
8162
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8163
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
8164
|
+
router_: router_,
|
|
8165
|
+
content_results_: get_content_results_
|
|
8166
|
+
});
|
|
7992
8167
|
(0, $gVhhF$solidjs.createComputed)(() => {
|
|
7993
8168
|
const field_value = read_search_field_value();
|
|
7994
|
-
if (
|
|
8169
|
+
if ((0, $gVhhF$solidjs.untrack)(updating_blocked[0]))
|
|
8170
|
+
// not using updating_blocked instead of below signal since I presume they'd start updating too early then
|
|
8171
|
+
set_show_stale_content_results(true);else {
|
|
7995
8172
|
set_searching_for_value(field_value);
|
|
7996
8173
|
deparallelized_fn({
|
|
7997
8174
|
query: field_value,
|
|
7998
8175
|
tenant: tenant_(),
|
|
7999
8176
|
market: market_()
|
|
8000
8177
|
});
|
|
8178
|
+
set_show_stale_content_results(false);
|
|
8001
8179
|
}
|
|
8002
8180
|
});
|
|
8003
8181
|
(0, $gVhhF$solidjs.createComputed)((0, $gVhhF$solidjs.on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
|
|
@@ -8009,7 +8187,7 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
8009
8187
|
search_field_value_: search_field_value_,
|
|
8010
8188
|
updating_blocked_: updating_blocked,
|
|
8011
8189
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
8012
|
-
set_override_on_enter_fn_:
|
|
8190
|
+
set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
|
|
8013
8191
|
search_query_param_name_: search_query_url_param_name_,
|
|
8014
8192
|
url_transformer_: url_transformer_,
|
|
8015
8193
|
router_: router_
|
|
@@ -8048,11 +8226,12 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
8048
8226
|
},
|
|
8049
8227
|
on_previous_searches_page_: show_previous_searches_component,
|
|
8050
8228
|
i18n_: i18n_,
|
|
8229
|
+
get_content_results_: get_content_results_,
|
|
8051
8230
|
url_transformer_: url_transformer_,
|
|
8052
8231
|
searching_for_value_: searching_for_value,
|
|
8053
8232
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
8054
8233
|
selected_index_: selected_index_,
|
|
8055
|
-
suggestion_memo_:
|
|
8234
|
+
suggestion_memo_: read_suggestion_signal_,
|
|
8056
8235
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
8057
8236
|
include_category_suggestions_: include_category_suggestions_,
|
|
8058
8237
|
router_: router_,
|
|
@@ -8156,7 +8335,8 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
8156
8335
|
bottom_distance_under_modal_: bottom_distance_under_modal_,
|
|
8157
8336
|
selected_text_range_: selected_text_range_,
|
|
8158
8337
|
dont_sync_search_field_value_except_on_submit_ = false,
|
|
8159
|
-
router_: router_
|
|
8338
|
+
router_: router_,
|
|
8339
|
+
content_search_enabled_: content_search_enabled_
|
|
8160
8340
|
}) {
|
|
8161
8341
|
let on_enter_in_search_field_function;
|
|
8162
8342
|
// 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 +8353,37 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
8173
8353
|
};
|
|
8174
8354
|
const [input_field, set_input_field] = (0, $gVhhF$solidjs.createSignal)();
|
|
8175
8355
|
const [get_search_field_value_] = search_field_value_;
|
|
8176
|
-
const [
|
|
8177
|
-
const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $gVhhF$solidjs.createSignal)();
|
|
8356
|
+
const [get_modal_search_results, set_modal_search_results_] = (0, $gVhhF$solidjs.createSignal)();
|
|
8178
8357
|
const close_on_escape_handler = (0, $gVhhF$depictaiutilishared.catchify)(({
|
|
8179
8358
|
key: key
|
|
8180
8359
|
}) => {
|
|
8181
8360
|
if (key === "Escape") close_modal_();
|
|
8182
8361
|
});
|
|
8183
|
-
const [
|
|
8362
|
+
const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $gVhhF$solidjs.createSignal)();
|
|
8184
8363
|
const selected_index = (0, $gVhhF$solidjs.createSignal)();
|
|
8185
8364
|
const currently_showing_suggestions_ = (0, $gVhhF$solidjs.createSignal)([], {
|
|
8186
8365
|
equals: false
|
|
8187
8366
|
});
|
|
8367
|
+
const less_than_700_high = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height:700px)");
|
|
8368
|
+
const DiscoverMoreSection = () => (() => {
|
|
8369
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($f40a47a30a358305$var$_tmpl$),
|
|
8370
|
+
_el$2 = _el$.firstChild;
|
|
8371
|
+
(0, $gVhhF$solidjsweb.addEventListener)(_el$2, "click", (0, $gVhhF$depictaiutilishared.catchify)(() => submit_query_()), true);
|
|
8372
|
+
(0, $gVhhF$solidjsweb.insert)(_el$2, (() => {
|
|
8373
|
+
const _c$ = (0, $gVhhF$solidjsweb.memo)(() => !!get_search_field_value_());
|
|
8374
|
+
return () => _c$() ? i18n_.modal_view_all_results_()((() => {
|
|
8375
|
+
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($f40a47a30a358305$var$_tmpl$2);
|
|
8376
|
+
(0, $gVhhF$solidjsweb.insert)(_el$3, () => get_total_num_results_accessor?.());
|
|
8377
|
+
return _el$3;
|
|
8378
|
+
})()) : i18n_.modal_discover_more_();
|
|
8379
|
+
})());
|
|
8380
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
8381
|
+
return _el$;
|
|
8382
|
+
})();
|
|
8188
8383
|
if (disable_scrolling_) (0, $ca1176b694a6ee2e$export$fe334901e8bebd57)();
|
|
8189
8384
|
$f40a47a30a358305$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
|
|
8190
8385
|
window.addEventListener("keydown", close_on_escape_handler);
|
|
8191
8386
|
(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
8387
|
if (closing_animation_) register_closing_animation_(closing_animation_);
|
|
8215
8388
|
(0, $036d367ce3058351$export$3340fdd8259bd4fd)({
|
|
8216
8389
|
get_search_field_value_: get_search_field_value_,
|
|
@@ -8292,7 +8465,9 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
8292
8465
|
i18n_: i18n_,
|
|
8293
8466
|
include_category_suggestions_: enable_category_suggestions_ ?? true,
|
|
8294
8467
|
router_: router_,
|
|
8295
|
-
submit_query_: submit_query_
|
|
8468
|
+
submit_query_: submit_query_,
|
|
8469
|
+
get_modal_search_results_: get_modal_search_results,
|
|
8470
|
+
content_search_enabled_: content_search_enabled_
|
|
8296
8471
|
});
|
|
8297
8472
|
}
|
|
8298
8473
|
}), _el$8, _co$);
|
|
@@ -8306,14 +8481,30 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
8306
8481
|
tenant_: tenant_,
|
|
8307
8482
|
i18n_: i18n_,
|
|
8308
8483
|
market_: market_,
|
|
8309
|
-
|
|
8484
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
8310
8485
|
router_: router_,
|
|
8486
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
8487
|
+
content_search_enabled_: content_search_enabled_,
|
|
8311
8488
|
...instant_results_options_
|
|
8312
8489
|
});
|
|
8313
8490
|
}
|
|
8314
8491
|
}), _el$10, _co$2);
|
|
8315
|
-
(0, $gVhhF$solidjsweb.insert)(_el$6,
|
|
8316
|
-
|
|
8492
|
+
(0, $gVhhF$solidjsweb.insert)(_el$6, (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$12, _co$3);
|
|
8500
|
+
(0, $gVhhF$solidjsweb.insert)(_el$5, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8501
|
+
get when() {
|
|
8502
|
+
return !less_than_700_high();
|
|
8503
|
+
},
|
|
8504
|
+
get children() {
|
|
8505
|
+
return (0, $gVhhF$solidjsweb.createComponent)(DiscoverMoreSection, {});
|
|
8506
|
+
}
|
|
8507
|
+
}), _el$16, _co$5);
|
|
8317
8508
|
(0, $gVhhF$solidjsweb.insert)(_el$4, (0, $gVhhF$solidjsweb.createComponent)((0, $b776f25acdda22eb$export$f021bdedd3ec901a), {
|
|
8318
8509
|
styles: body_style
|
|
8319
8510
|
}), _el$18, _co$6);
|
|
@@ -8418,11 +8609,13 @@ const $65a0c4b1c2eb5d0b$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template
|
|
|
8418
8609
|
function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({
|
|
8419
8610
|
get_search_query_: get_search_query_,
|
|
8420
8611
|
i18n_: i18n_,
|
|
8421
|
-
formatted_number_of_results_: formatted_number_of_results_
|
|
8612
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
8613
|
+
number_of_results_: number_of_results_,
|
|
8614
|
+
type: type
|
|
8422
8615
|
}) {
|
|
8423
8616
|
const contents = (0, $gVhhF$solidjs.createMemo)((0, $gVhhF$depictaiutilishared.catchify)(() => {
|
|
8424
8617
|
const q = get_search_query_();
|
|
8425
|
-
return i18n_.get_showing_results_for_()((() => {
|
|
8618
|
+
return i18n_[type === $65a0c4b1c2eb5d0b$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((() => {
|
|
8426
8619
|
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($65a0c4b1c2eb5d0b$var$_tmpl$);
|
|
8427
8620
|
(0, $gVhhF$solidjsweb.insert)(_el$, q);
|
|
8428
8621
|
return _el$;
|
|
@@ -8430,7 +8623,7 @@ function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({
|
|
|
8430
8623
|
const _el$2 = (0, $gVhhF$solidjsweb.getNextElement)($65a0c4b1c2eb5d0b$var$_tmpl$);
|
|
8431
8624
|
(0, $gVhhF$solidjsweb.insert)(_el$2, formatted_number_of_results_);
|
|
8432
8625
|
return _el$2;
|
|
8433
|
-
})());
|
|
8626
|
+
})(), !!q, number_of_results_());
|
|
8434
8627
|
}));
|
|
8435
8628
|
return (() => {
|
|
8436
8629
|
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($65a0c4b1c2eb5d0b$var$_tmpl$2);
|
|
@@ -8438,6 +8631,11 @@ function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({
|
|
|
8438
8631
|
return _el$3;
|
|
8439
8632
|
})();
|
|
8440
8633
|
}
|
|
8634
|
+
let $65a0c4b1c2eb5d0b$export$2452208c79fe93ea;
|
|
8635
|
+
(function (ShowingResultsForType) {
|
|
8636
|
+
ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
|
|
8637
|
+
ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
|
|
8638
|
+
})($65a0c4b1c2eb5d0b$export$2452208c79fe93ea || ($65a0c4b1c2eb5d0b$export$2452208c79fe93ea = {}));
|
|
8441
8639
|
function $2005eec80e40088f$export$41b4894022a3580f({
|
|
8442
8640
|
style_props_ = (0, $gVhhF$solidjs.createSignal)({})
|
|
8443
8641
|
} = {}) {
|
|
@@ -8456,8 +8654,486 @@ function $2005eec80e40088f$export$41b4894022a3580f({
|
|
|
8456
8654
|
})));
|
|
8457
8655
|
return style_props_;
|
|
8458
8656
|
}
|
|
8657
|
+
const $5ea5a82e398f6f44$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<span class="highlighted-part"></span>`, 2);
|
|
8658
|
+
const $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters = 30;
|
|
8659
|
+
function $5ea5a82e398f6f44$export$e1a98a189fd2c0e7({
|
|
8660
|
+
content_result_: content_result_,
|
|
8661
|
+
key_: key_,
|
|
8662
|
+
cut_when_possible_: cut_when_possible_
|
|
8663
|
+
}) {
|
|
8664
|
+
const matched_tokens = (0, $gVhhF$solidjs.createMemo)(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
|
|
8665
|
+
const full_value = (0, $gVhhF$solidjs.createMemo)(() => content_result_()[key_]?.replaceAll("\n", " "));
|
|
8666
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8667
|
+
get when() {
|
|
8668
|
+
return matched_tokens()?.length;
|
|
8669
|
+
},
|
|
8670
|
+
get fallback() {
|
|
8671
|
+
return full_value();
|
|
8672
|
+
},
|
|
8673
|
+
get children() {
|
|
8674
|
+
return (() => {
|
|
8675
|
+
const segmented_cut_text = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
8676
|
+
const segmented_text = $5ea5a82e398f6f44$var$segment_text(full_value(), matched_tokens());
|
|
8677
|
+
if (cut_when_possible_) $5ea5a82e398f6f44$var$cut_text(segmented_text);
|
|
8678
|
+
return segmented_text;
|
|
8679
|
+
});
|
|
8680
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Index), {
|
|
8681
|
+
get each() {
|
|
8682
|
+
return segmented_cut_text();
|
|
8683
|
+
},
|
|
8684
|
+
children: item => {
|
|
8685
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8686
|
+
get when() {
|
|
8687
|
+
return item().highlighted_;
|
|
8688
|
+
},
|
|
8689
|
+
get fallback() {
|
|
8690
|
+
return item().text_;
|
|
8691
|
+
},
|
|
8692
|
+
get children() {
|
|
8693
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($5ea5a82e398f6f44$var$_tmpl$);
|
|
8694
|
+
(0, $gVhhF$solidjsweb.insert)(_el$, () => item().text_);
|
|
8695
|
+
return _el$;
|
|
8696
|
+
}
|
|
8697
|
+
});
|
|
8698
|
+
}
|
|
8699
|
+
});
|
|
8700
|
+
})();
|
|
8701
|
+
}
|
|
8702
|
+
});
|
|
8703
|
+
}
|
|
8704
|
+
function $5ea5a82e398f6f44$var$cut_text(segmented_text) {
|
|
8705
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
8706
|
+
const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
|
|
8707
|
+
if (!segmented_text || !highlighted_segments?.length) return;
|
|
8708
|
+
// We have one or more highlighted segments
|
|
8709
|
+
if (highlighted_segments.length === 1) {
|
|
8710
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
8711
|
+
$5ea5a82e398f6f44$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
8712
|
+
return;
|
|
8713
|
+
}
|
|
8714
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
8715
|
+
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
|
|
8716
|
+
);
|
|
8717
|
+
|
|
8718
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
8719
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
8720
|
+
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);
|
|
8721
|
+
$5ea5a82e398f6f44$var$cut_start(index_of_first_segment, segmented_text);
|
|
8722
|
+
// update indexes since we might have removed segments
|
|
8723
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
8724
|
+
let number_of_characters_between_segments = 0;
|
|
8725
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
8726
|
+
const segment = segmented_text[i];
|
|
8727
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
8728
|
+
}
|
|
8729
|
+
if (number_of_characters_between_segments < $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters)
|
|
8730
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
8731
|
+
return;
|
|
8732
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
8733
|
+
const [split_start_segment, split_start_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
8734
|
+
const [split_end_segment, split_end_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
8735
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
8736
|
+
// identical split point, or split end before split start, can't do anything
|
|
8737
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
8738
|
+
const dots_segment = {
|
|
8739
|
+
text_: " … ",
|
|
8740
|
+
highlighted_: false
|
|
8741
|
+
};
|
|
8742
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
8743
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
8744
|
+
const text = segment.text_;
|
|
8745
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
8746
|
+
...segment,
|
|
8747
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
8748
|
+
}, dots_segment, {
|
|
8749
|
+
...segment,
|
|
8750
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8751
|
+
}];else if (i == split_start_segment) {
|
|
8752
|
+
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
|
|
8753
|
+
return segment;
|
|
8754
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
8755
|
+
...segment,
|
|
8756
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8757
|
+
}];
|
|
8758
|
+
return []; // remove all segments inbetween
|
|
8759
|
+
});
|
|
8760
|
+
|
|
8761
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
8762
|
+
$5ea5a82e398f6f44$var$heal_holes(segmented_text);
|
|
8763
|
+
}
|
|
8764
|
+
function $5ea5a82e398f6f44$var$heal_holes(segmented_text) {
|
|
8765
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
8766
|
+
const segments_to_delete = new Set();
|
|
8767
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
8768
|
+
const segment = segmented_text[i];
|
|
8769
|
+
let previous_segment;
|
|
8770
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
8771
|
+
previous_segment = segmented_text[j];
|
|
8772
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
8773
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
8774
|
+
}
|
|
8775
|
+
if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
|
|
8776
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
8777
|
+
segments_to_delete.add(segment);
|
|
8778
|
+
}
|
|
8779
|
+
}
|
|
8780
|
+
for (const segment of segments_to_delete) {
|
|
8781
|
+
const index = segmented_text.indexOf(segment);
|
|
8782
|
+
segmented_text.splice(index, 1);
|
|
8783
|
+
}
|
|
8784
|
+
}
|
|
8785
|
+
function $5ea5a82e398f6f44$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
|
|
8786
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
8787
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
8788
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
8789
|
+
while (desperate_split_attempts.length) {
|
|
8790
|
+
const split_point_between_words = [];
|
|
8791
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
8792
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
8793
|
+
let is_first_character = true;
|
|
8794
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
8795
|
+
const segment = segmented_text[i];
|
|
8796
|
+
const text = segment.text_;
|
|
8797
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
8798
|
+
const character = text[j];
|
|
8799
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
8800
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
8801
|
+
split_point_between_words.push([i, j]);
|
|
8802
|
+
if (split_point_between_words.length > 3)
|
|
8803
|
+
// We can't find a split point, so we'll just split between words
|
|
8804
|
+
// 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
|
|
8805
|
+
return split_point_between_words[1];
|
|
8806
|
+
}
|
|
8807
|
+
}
|
|
8808
|
+
}
|
|
8809
|
+
}
|
|
8810
|
+
return [];
|
|
8811
|
+
}
|
|
8812
|
+
function $5ea5a82e398f6f44$var$cut_start(cut_left_of_index, segmented_text) {
|
|
8813
|
+
// Cut the start of the text to bring the first matching token
|
|
8814
|
+
let is_first_character = false;
|
|
8815
|
+
let words_encountered = 0;
|
|
8816
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
8817
|
+
const segment = segmented_text[i];
|
|
8818
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
8819
|
+
const text = segment.text_;
|
|
8820
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
8821
|
+
const character = text[j];
|
|
8822
|
+
const is_space = character == " ";
|
|
8823
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
8824
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
8825
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
8826
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
8827
|
+
segmented_text.splice(0, i);
|
|
8828
|
+
if (character === "," || is_space)
|
|
8829
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
8830
|
+
segmented_text.unshift({
|
|
8831
|
+
text_: "… ",
|
|
8832
|
+
highlighted_: false
|
|
8833
|
+
});
|
|
8834
|
+
break outmost_loop;
|
|
8835
|
+
}
|
|
8836
|
+
if (is_first_character) is_first_character = false;
|
|
8837
|
+
}
|
|
8838
|
+
}
|
|
8839
|
+
$5ea5a82e398f6f44$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
8840
|
+
}
|
|
8841
|
+
|
|
8842
|
+
function $5ea5a82e398f6f44$var$segment_text(text, matched_strings) {
|
|
8843
|
+
// segment text where the matched strings are highlighted sections
|
|
8844
|
+
const output = [];
|
|
8845
|
+
if (!text) return; // shouldn't happen but whatever
|
|
8846
|
+
for (let i = 0; i < text.length; i++) {
|
|
8847
|
+
const found_strings = [];
|
|
8848
|
+
if (!i || text[i - 1] == " ")
|
|
8849
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
8850
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
8851
|
+
const matched_string = matched_strings[j];
|
|
8852
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
8853
|
+
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
8854
|
+
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
|
|
8855
|
+
}
|
|
8856
|
+
|
|
8857
|
+
const last_index_in_output = output.length - 1;
|
|
8858
|
+
if (!found_strings.length) {
|
|
8859
|
+
const character = text[i];
|
|
8860
|
+
if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
|
|
8861
|
+
// 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
|
|
8862
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
8863
|
+
highlighted_: false,
|
|
8864
|
+
text_: character
|
|
8865
|
+
});
|
|
8866
|
+
} else {
|
|
8867
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
8868
|
+
if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
8869
|
+
highlighted_: true,
|
|
8870
|
+
text_: longest_found_string
|
|
8871
|
+
});
|
|
8872
|
+
i += longest_found_string.length - 1;
|
|
8873
|
+
}
|
|
8874
|
+
}
|
|
8875
|
+
return output;
|
|
8876
|
+
}
|
|
8877
|
+
const $76227de40be817e5$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<a></a>`, 2),
|
|
8878
|
+
$76227de40be817e5$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div></div>`, 2),
|
|
8879
|
+
$76227de40be817e5$var$_tmpl$3 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="description line-clamp"></div>`, 2),
|
|
8880
|
+
$76227de40be817e5$var$_tmpl$4 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="content-card"><div class="image"></div><div class="info"><!#><!/><!#><!/></div></div>`, 10);
|
|
8881
|
+
function $76227de40be817e5$export$f631859cab12b342({
|
|
8882
|
+
router_: router_,
|
|
8883
|
+
content_result_: content_result_
|
|
8884
|
+
}) {
|
|
8885
|
+
const make_link_attributes = () => {
|
|
8886
|
+
const result = content_result_?.();
|
|
8887
|
+
if (!result) return;
|
|
8888
|
+
return {
|
|
8889
|
+
href: result.page_url,
|
|
8890
|
+
onClick: (0, $gVhhF$depictaiutilishared.catchify)(ev => router_.navigate_.go_to_({
|
|
8891
|
+
new_url_: result.page_url,
|
|
8892
|
+
is_replace_: false,
|
|
8893
|
+
event_: ev
|
|
8894
|
+
}))
|
|
8895
|
+
};
|
|
8896
|
+
};
|
|
8897
|
+
const LinkIfPossible = ({
|
|
8898
|
+
children: children,
|
|
8899
|
+
...attributes
|
|
8900
|
+
}) => {
|
|
8901
|
+
if (content_result_) return (() => {
|
|
8902
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($76227de40be817e5$var$_tmpl$);
|
|
8903
|
+
(0, $gVhhF$solidjsweb.spread)(_el$, attributes, false, true);
|
|
8904
|
+
(0, $gVhhF$solidjsweb.insert)(_el$, children);
|
|
8905
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
8906
|
+
return _el$;
|
|
8907
|
+
})();
|
|
8908
|
+
return (() => {
|
|
8909
|
+
const _el$2 = (0, $gVhhF$solidjsweb.getNextElement)($76227de40be817e5$var$_tmpl$2);
|
|
8910
|
+
(0, $gVhhF$solidjsweb.spread)(_el$2, attributes, false, true);
|
|
8911
|
+
(0, $gVhhF$solidjsweb.insert)(_el$2, children);
|
|
8912
|
+
(0, $gVhhF$solidjsweb.runHydrationEvents)();
|
|
8913
|
+
return _el$2;
|
|
8914
|
+
})();
|
|
8915
|
+
};
|
|
8916
|
+
return (() => {
|
|
8917
|
+
const _el$3 = (0, $gVhhF$solidjsweb.getNextElement)($76227de40be817e5$var$_tmpl$4),
|
|
8918
|
+
_el$4 = _el$3.firstChild,
|
|
8919
|
+
_el$5 = _el$4.nextSibling,
|
|
8920
|
+
_el$7 = _el$5.firstChild,
|
|
8921
|
+
[_el$8, _co$] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$7.nextSibling),
|
|
8922
|
+
_el$9 = _el$8.nextSibling,
|
|
8923
|
+
[_el$10, _co$2] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$9.nextSibling);
|
|
8924
|
+
(0, $gVhhF$solidjsweb.insert)(_el$4, (0, $gVhhF$solidjsweb.createComponent)(LinkIfPossible, (0, $gVhhF$solidjsweb.mergeProps)(make_link_attributes, {
|
|
8925
|
+
tabIndex: "-1",
|
|
8926
|
+
get children() {
|
|
8927
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $c0125412b4ea0c93$export$605674723bcc715c), {
|
|
8928
|
+
width: "28",
|
|
8929
|
+
height: "28"
|
|
8930
|
+
});
|
|
8931
|
+
}
|
|
8932
|
+
})));
|
|
8933
|
+
(0, $gVhhF$solidjsweb.insert)(_el$5, (0, $gVhhF$solidjsweb.createComponent)(LinkIfPossible, (0, $gVhhF$solidjsweb.mergeProps)({
|
|
8934
|
+
"class": "content-title line-clamp"
|
|
8935
|
+
}, make_link_attributes, {
|
|
8936
|
+
get title() {
|
|
8937
|
+
return content_result_?.().title;
|
|
8938
|
+
},
|
|
8939
|
+
get children() {
|
|
8940
|
+
return content_result_ ? (0, $gVhhF$solidjsweb.createComponent)((0, $5ea5a82e398f6f44$export$e1a98a189fd2c0e7), {
|
|
8941
|
+
content_result_: content_result_,
|
|
8942
|
+
key_: "title",
|
|
8943
|
+
cut_when_possible_: false
|
|
8944
|
+
}) : (0, $gVhhF$solidjsweb.createComponent)((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
8945
|
+
height: "1em",
|
|
8946
|
+
width: "20ch"
|
|
8947
|
+
});
|
|
8948
|
+
}
|
|
8949
|
+
})), _el$8, _co$);
|
|
8950
|
+
(0, $gVhhF$solidjsweb.insert)(_el$5, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8951
|
+
get when() {
|
|
8952
|
+
return content_result_?.().description || !content_result_;
|
|
8953
|
+
},
|
|
8954
|
+
get children() {
|
|
8955
|
+
const _el$6 = (0, $gVhhF$solidjsweb.getNextElement)($76227de40be817e5$var$_tmpl$3);
|
|
8956
|
+
(0, $gVhhF$solidjsweb.insert)(_el$6, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8957
|
+
when: content_result_,
|
|
8958
|
+
get fallback() {
|
|
8959
|
+
return Array.from({
|
|
8960
|
+
length: 4
|
|
8961
|
+
}).map(() => (0, $gVhhF$solidjsweb.createComponent)((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
8962
|
+
height: "1em",
|
|
8963
|
+
width: "min(50ch, 100%)"
|
|
8964
|
+
}));
|
|
8965
|
+
},
|
|
8966
|
+
get children() {
|
|
8967
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $5ea5a82e398f6f44$export$e1a98a189fd2c0e7), {
|
|
8968
|
+
content_result_: content_result_,
|
|
8969
|
+
key_: "description",
|
|
8970
|
+
cut_when_possible_: true
|
|
8971
|
+
});
|
|
8972
|
+
}
|
|
8973
|
+
}));
|
|
8974
|
+
return _el$6;
|
|
8975
|
+
}
|
|
8976
|
+
}), _el$10, _co$2);
|
|
8977
|
+
return _el$3;
|
|
8978
|
+
})();
|
|
8979
|
+
}
|
|
8980
|
+
function $8781fcec27b20709$export$9ff751cd77687edc({
|
|
8981
|
+
search_results_: search_results_,
|
|
8982
|
+
router_: router_
|
|
8983
|
+
}) {
|
|
8984
|
+
const content_results = (0, $gVhhF$solidjs.createMemo)(() => search_results_()?.content_search_links);
|
|
8985
|
+
const content_results_by_page_url = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
8986
|
+
const map = new Map();
|
|
8987
|
+
const results = content_results();
|
|
8988
|
+
if (!results) return map;
|
|
8989
|
+
for (let i = 0; i < results.length; i++) {
|
|
8990
|
+
const content_result = results[i];
|
|
8991
|
+
map.set(content_result.page_url, content_result);
|
|
8992
|
+
}
|
|
8993
|
+
return map;
|
|
8994
|
+
});
|
|
8995
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.For), {
|
|
8996
|
+
get each() {
|
|
8997
|
+
return [...content_results_by_page_url().keys()];
|
|
8998
|
+
},
|
|
8999
|
+
children: page_url => {
|
|
9000
|
+
const content_result = (0, $gVhhF$solidjs.createMemo)(() => content_results_by_page_url().get(page_url));
|
|
9001
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $76227de40be817e5$export$f631859cab12b342), {
|
|
9002
|
+
content_result_: content_result,
|
|
9003
|
+
router_: router_
|
|
9004
|
+
});
|
|
9005
|
+
}
|
|
9006
|
+
});
|
|
9007
|
+
}
|
|
9008
|
+
function $c2f92eb265a14529$export$4405d077f0a20494({
|
|
9009
|
+
content_results_rows_: [get_history_state_content_results_rows],
|
|
9010
|
+
cols_at_size_: cols_at_size_
|
|
9011
|
+
}) {
|
|
9012
|
+
const largest_column = (0, $gVhhF$solidjs.createMemo)(() => {
|
|
9013
|
+
const largest_in_cols_at_size = Math.max(...cols_at_size_().map(([cols]) => cols));
|
|
9014
|
+
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
|
|
9015
|
+
return largest_in_cols_at_size;
|
|
9016
|
+
});
|
|
9017
|
+
const num_placeholders = (0, $gVhhF$solidjs.createMemo)(() => (get_history_state_content_results_rows() ?? (0, $3716b8caf7f959e2$export$70ceae36059a1036)) * largest_column());
|
|
9018
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Index), {
|
|
9019
|
+
get each() {
|
|
9020
|
+
return Array.from({
|
|
9021
|
+
length: num_placeholders()
|
|
9022
|
+
});
|
|
9023
|
+
},
|
|
9024
|
+
children: () => (0, $gVhhF$solidjsweb.createComponent)((0, $76227de40be817e5$export$f631859cab12b342), {})
|
|
9025
|
+
});
|
|
9026
|
+
}
|
|
9027
|
+
const $3716b8caf7f959e2$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="content-results"><!#><!/><!#><!/></div>`, 6),
|
|
9028
|
+
$3716b8caf7f959e2$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<button class="view-more"></button>`, 2),
|
|
9029
|
+
$3716b8caf7f959e2$var$_tmpl$3 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<button class="view-less"></button>`, 2);
|
|
9030
|
+
const $3716b8caf7f959e2$export$70ceae36059a1036 = 1;
|
|
9031
|
+
function $3716b8caf7f959e2$export$6d0c9c22f6652669({
|
|
9032
|
+
search_results_: search_results_,
|
|
9033
|
+
get_search_query_: get_search_query_,
|
|
9034
|
+
i18n_: i18n_,
|
|
9035
|
+
layout_options_: layout_options_,
|
|
9036
|
+
router_: router_,
|
|
9037
|
+
query_base_: query_base_,
|
|
9038
|
+
content_results_rows_: content_results_rows_
|
|
9039
|
+
}) {
|
|
9040
|
+
const content_results = (0, $gVhhF$solidjs.createMemo)(() => search_results_()?.content_search_links);
|
|
9041
|
+
const num_results = (0, $gVhhF$solidjs.createMemo)(() => content_results()?.length);
|
|
9042
|
+
const is_loading_ = (0, $gVhhF$solidjs.createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
|
|
9043
|
+
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
9044
|
+
number_: num_results,
|
|
9045
|
+
i18n_: i18n_
|
|
9046
|
+
});
|
|
9047
|
+
const [is_showing_placeholders, set_is_showing_placeholders] = (0, $gVhhF$solidjs.createSignal)(false);
|
|
9048
|
+
const rows_object = $3716b8caf7f959e2$var$make_state_saved_rows(content_results_rows_, i18n_);
|
|
9049
|
+
return (() => {
|
|
9050
|
+
const _el$ = (0, $gVhhF$solidjsweb.getNextElement)($3716b8caf7f959e2$var$_tmpl$),
|
|
9051
|
+
_el$2 = _el$.firstChild,
|
|
9052
|
+
[_el$3, _co$] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$2.nextSibling),
|
|
9053
|
+
_el$4 = _el$3.nextSibling,
|
|
9054
|
+
[_el$5, _co$2] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$4.nextSibling);
|
|
9055
|
+
(0, $gVhhF$solidjsweb.insert)(_el$, (0, $gVhhF$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), {
|
|
9056
|
+
get_search_query_: get_search_query_,
|
|
9057
|
+
i18n_: i18n_,
|
|
9058
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
9059
|
+
get type() {
|
|
9060
|
+
return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).content;
|
|
9061
|
+
},
|
|
9062
|
+
number_of_results_: num_results
|
|
9063
|
+
}), _el$3, _co$);
|
|
9064
|
+
(0, $gVhhF$solidjsweb.insert)(_el$, (0, $gVhhF$solidjsweb.createComponent)((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), (0, $gVhhF$solidjsweb.mergeProps)({
|
|
9065
|
+
layout: "grid",
|
|
9066
|
+
element_attributes: {
|
|
9067
|
+
class: "cards"
|
|
9068
|
+
}
|
|
9069
|
+
}, layout_options_, {
|
|
9070
|
+
rows: rows_object,
|
|
9071
|
+
get children() {
|
|
9072
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Suspense), {
|
|
9073
|
+
get fallback() {
|
|
9074
|
+
return (() => {
|
|
9075
|
+
set_is_showing_placeholders(true);
|
|
9076
|
+
(0, $gVhhF$solidjs.onCleanup)(() => set_is_showing_placeholders(false));
|
|
9077
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $c2f92eb265a14529$export$4405d077f0a20494), {
|
|
9078
|
+
content_results_rows_: content_results_rows_,
|
|
9079
|
+
get cols_at_size_() {
|
|
9080
|
+
return (0, $gVhhF$solidjs.createMemo)(() => layout_options_().cols_at_size);
|
|
9081
|
+
}
|
|
9082
|
+
});
|
|
9083
|
+
})();
|
|
9084
|
+
},
|
|
9085
|
+
get children() {
|
|
9086
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $8781fcec27b20709$export$9ff751cd77687edc), {
|
|
9087
|
+
router_: router_,
|
|
9088
|
+
search_results_: search_results_
|
|
9089
|
+
});
|
|
9090
|
+
}
|
|
9091
|
+
});
|
|
9092
|
+
}
|
|
9093
|
+
})), _el$5, _co$2);
|
|
9094
|
+
(0, $gVhhF$solidjsweb.effect)(_p$ => {
|
|
9095
|
+
const _v$ = !!is_showing_placeholders(),
|
|
9096
|
+
_v$2 = is_loading_() || content_results()?.length > 0 ? "" : "none";
|
|
9097
|
+
_v$ !== _p$._v$ && _el$.classList.toggle("loading", _p$._v$ = _v$);
|
|
9098
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("display", _p$._v$2 = _v$2);
|
|
9099
|
+
return _p$;
|
|
9100
|
+
}, {
|
|
9101
|
+
_v$: undefined,
|
|
9102
|
+
_v$2: undefined
|
|
9103
|
+
});
|
|
9104
|
+
return _el$;
|
|
9105
|
+
})();
|
|
9106
|
+
}
|
|
9107
|
+
function $3716b8caf7f959e2$var$make_state_saved_rows(
|
|
9108
|
+
// similar to the one in SearchRecommendations.tsx but not enough to warrant a shared function IMO
|
|
9109
|
+
[get_showing_content_results_rows, set_showing_content_results_rows], i18n_) {
|
|
9110
|
+
const currently_visible = (0, $gVhhF$solidjs.createSignal)((0, $gVhhF$solidjs.untrack)(get_showing_content_results_rows));
|
|
9111
|
+
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
9112
|
+
const rows = {
|
|
9113
|
+
currently_visible: currently_visible,
|
|
9114
|
+
start_rows: $3716b8caf7f959e2$export$70ceae36059a1036,
|
|
9115
|
+
button: (() => {
|
|
9116
|
+
const _el$6 = (0, $gVhhF$solidjsweb.getNextElement)($3716b8caf7f959e2$var$_tmpl$2);
|
|
9117
|
+
(0, $gVhhF$solidjsweb.insert)(_el$6, () => i18n_.view_more_());
|
|
9118
|
+
return _el$6;
|
|
9119
|
+
})(),
|
|
9120
|
+
view_less_button: (() => {
|
|
9121
|
+
const _el$7 = (0, $gVhhF$solidjsweb.getNextElement)($3716b8caf7f959e2$var$_tmpl$3);
|
|
9122
|
+
(0, $gVhhF$solidjsweb.insert)(_el$7, () => i18n_.view_less_());
|
|
9123
|
+
return _el$7;
|
|
9124
|
+
})(),
|
|
9125
|
+
rows_per_click: 3
|
|
9126
|
+
};
|
|
9127
|
+
(0, $gVhhF$solidjs.createComputed)((0, $gVhhF$solidjs.on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
|
|
9128
|
+
defer: true
|
|
9129
|
+
}));
|
|
9130
|
+
(0, $gVhhF$solidjs.createComputed)((0, $gVhhF$solidjs.on)(get_showing_content_results_rows, (new_rows = $3716b8caf7f959e2$export$70ceae36059a1036) => set_currently_visible(new_rows), {
|
|
9131
|
+
defer: true
|
|
9132
|
+
}));
|
|
9133
|
+
return rows;
|
|
9134
|
+
}
|
|
8459
9135
|
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"
|
|
9136
|
+
$f1d7cb69f839a526$var$_tmpl$2 = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="depict plp search"><div class="listing-page"><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/></div><!#><!/><!#><!/></div>`, 22);
|
|
8461
9137
|
function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
8462
9138
|
depict_api_: depict_api_,
|
|
8463
9139
|
search_field_value_: search_field_value_,
|
|
@@ -8486,7 +9162,11 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8486
9162
|
recommendations_layout_options_: recommendations_layout_options_,
|
|
8487
9163
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
8488
9164
|
product_card_template_: product_card_template_,
|
|
8489
|
-
modal_body_style_ref_: modal_body_style_ref_
|
|
9165
|
+
modal_body_style_ref_: modal_body_style_ref_,
|
|
9166
|
+
router_: router_,
|
|
9167
|
+
content_results_rows_: content_results_rows_,
|
|
9168
|
+
content_layout_options_: content_layout_options_,
|
|
9169
|
+
content_search_enabled_: content_search_enabled_
|
|
8490
9170
|
}) {
|
|
8491
9171
|
const [get_sorting] = current_sorting_;
|
|
8492
9172
|
const all_products_loaded_ = (0, $gVhhF$solidjs.createSignal)(false);
|
|
@@ -8544,16 +9224,23 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8544
9224
|
const SafeSearchField = (0, $gVhhF$depictaiutilishared.catchify)((0, $66b8b9a9613c141d$export$b94867ecbd698f21));
|
|
8545
9225
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $gVhhF$solidjs.createSignal)(false);
|
|
8546
9226
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $gVhhF$solidjs.createSignal)();
|
|
9227
|
+
const n_hits = (0, $gVhhF$solidjs.createMemo)(() => search_results_()?.n_hits);
|
|
8547
9228
|
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
8548
|
-
|
|
9229
|
+
number_: n_hits,
|
|
8549
9230
|
i18n_: i18n_
|
|
8550
9231
|
});
|
|
8551
9232
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $gVhhF$solidjs.createSignal)();
|
|
8552
|
-
const
|
|
9233
|
+
const no_results_text_ = (0, $gVhhF$solidjs.createMemo)(() => (search_results_()?.content_search_links?.length ? i18n_.no_products_ : i18n_.no_results_text_)());
|
|
9234
|
+
const results_for = (0, $gVhhF$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), (0, $gVhhF$solidjsweb.mergeProps)({
|
|
9235
|
+
get type() {
|
|
9236
|
+
return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).products;
|
|
9237
|
+
},
|
|
9238
|
+
number_of_results_: n_hits
|
|
9239
|
+
}, {
|
|
8553
9240
|
get_search_query_: get_search_query_,
|
|
8554
9241
|
i18n_: i18n_,
|
|
8555
9242
|
formatted_number_of_results_: formatted_number_of_results_
|
|
8556
|
-
});
|
|
9243
|
+
}));
|
|
8557
9244
|
const filters_opener = (0, $f8f64d05c525825b$export$d7841e452f2e59a8)({
|
|
8558
9245
|
set_sort_or_filter_open_: set_sort_or_filter_open_,
|
|
8559
9246
|
set_extra_els_in_results_container_: set_desktop_filter_elements,
|
|
@@ -8671,10 +9358,12 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8671
9358
|
[_el$17, _co$7] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$16.nextSibling),
|
|
8672
9359
|
_el$18 = _el$17.nextSibling,
|
|
8673
9360
|
[_el$19, _co$8] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$18.nextSibling),
|
|
8674
|
-
_el$20 = _el$
|
|
9361
|
+
_el$20 = _el$19.nextSibling,
|
|
8675
9362
|
[_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)
|
|
9363
|
+
_el$22 = _el$7.nextSibling,
|
|
9364
|
+
[_el$23, _co$10] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$22.nextSibling),
|
|
9365
|
+
_el$24 = _el$23.nextSibling,
|
|
9366
|
+
[_el$25, _co$11] = (0, $gVhhF$solidjsweb.getNextMarker)(_el$24.nextSibling);
|
|
8678
9367
|
(0, $gVhhF$solidjsweb.insert)(_el$7, get_search_field_elements, _el$9, _co$3);
|
|
8679
9368
|
(0, $gVhhF$solidjsweb.insert)(_el$7, make_category_suggestion_card_ ? (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
8680
9369
|
severity_: "error",
|
|
@@ -8686,7 +9375,29 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8686
9375
|
});
|
|
8687
9376
|
}
|
|
8688
9377
|
}) : null, _el$11, _co$4);
|
|
8689
|
-
(0, $gVhhF$solidjsweb.insert)(_el$7, (
|
|
9378
|
+
(0, $gVhhF$solidjsweb.insert)(_el$7, (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
9379
|
+
severity_: "error",
|
|
9380
|
+
message_: "ContentResults failed",
|
|
9381
|
+
get children() {
|
|
9382
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
9383
|
+
get when() {
|
|
9384
|
+
return content_search_enabled_();
|
|
9385
|
+
},
|
|
9386
|
+
get children() {
|
|
9387
|
+
return (0, $gVhhF$solidjsweb.createComponent)((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
|
|
9388
|
+
content_results_rows_: content_results_rows_,
|
|
9389
|
+
search_results_: search_results_,
|
|
9390
|
+
i18n_: i18n_,
|
|
9391
|
+
get_search_query_: get_search_query_,
|
|
9392
|
+
layout_options_: content_layout_options_,
|
|
9393
|
+
router_: router_,
|
|
9394
|
+
query_base_: search_query_base_
|
|
9395
|
+
});
|
|
9396
|
+
}
|
|
9397
|
+
});
|
|
9398
|
+
}
|
|
9399
|
+
}), _el$13, _co$5);
|
|
9400
|
+
(0, $gVhhF$solidjsweb.insert)(_el$7, () => results_filters[0](), _el$15, _co$6);
|
|
8690
9401
|
(0, $gVhhF$solidjsweb.insert)(_el$7, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8691
9402
|
get when() {
|
|
8692
9403
|
return selected_filters_[0]()?.length;
|
|
@@ -8709,7 +9420,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8709
9420
|
}
|
|
8710
9421
|
});
|
|
8711
9422
|
}
|
|
8712
|
-
}), _el$
|
|
9423
|
+
}), _el$17, _co$7);
|
|
8713
9424
|
(0, $gVhhF$solidjsweb.insert)(_el$7, (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
8714
9425
|
severity_: "error",
|
|
8715
9426
|
message_: "Search results failed",
|
|
@@ -8732,11 +9443,14 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8732
9443
|
selected_filters_: selected_filters_,
|
|
8733
9444
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
8734
9445
|
local_filter_cache_: local_filter_cache_,
|
|
8735
|
-
i18n_:
|
|
9446
|
+
i18n_: {
|
|
9447
|
+
...i18n_,
|
|
9448
|
+
no_results_text_: no_results_text_
|
|
9449
|
+
}
|
|
8736
9450
|
}
|
|
8737
9451
|
});
|
|
8738
9452
|
}
|
|
8739
|
-
}), _el$
|
|
9453
|
+
}), _el$19, _co$8);
|
|
8740
9454
|
(0, $gVhhF$solidjsweb.insert)(_el$7, (0, $gVhhF$solidjsweb.createComponent)((0, $gVhhF$solidjs.Show), {
|
|
8741
9455
|
get when() {
|
|
8742
9456
|
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
@@ -8761,7 +9475,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8761
9475
|
}
|
|
8762
9476
|
});
|
|
8763
9477
|
}
|
|
8764
|
-
}), _el$
|
|
9478
|
+
}), _el$21, _co$9);
|
|
8765
9479
|
(0, $gVhhF$solidjsweb.insert)(_el$6, (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
8766
9480
|
message_: "Scroll status failed",
|
|
8767
9481
|
severity_: "error",
|
|
@@ -8774,7 +9488,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8774
9488
|
number_of_results_: (0, $gVhhF$solidjs.createMemo)(() => search_results_()?.n_hits)
|
|
8775
9489
|
});
|
|
8776
9490
|
}
|
|
8777
|
-
}), _el$
|
|
9491
|
+
}), _el$23, _co$10);
|
|
8778
9492
|
(0, $gVhhF$solidjsweb.insert)(_el$6, (0, $gVhhF$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
8779
9493
|
message_: "Floating buttons failed",
|
|
8780
9494
|
severity_: "error",
|
|
@@ -8787,7 +9501,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
8787
9501
|
i18n_: i18n_
|
|
8788
9502
|
});
|
|
8789
9503
|
}
|
|
8790
|
-
}), _el$
|
|
9504
|
+
}), _el$25, _co$11);
|
|
8791
9505
|
(0, $gVhhF$solidjsweb.effect)(() => (0, $gVhhF$solidjsweb.setAttribute)(_el$6, "id", (0, $0b6e2070a98de347$export$44dad306455dddf).SEARCH_PAGE));
|
|
8792
9506
|
return _el$6;
|
|
8793
9507
|
})()];
|
|
@@ -8812,6 +9526,27 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
|
|
|
8812
9526
|
cleanup: cleanup
|
|
8813
9527
|
};
|
|
8814
9528
|
}
|
|
9529
|
+
|
|
9530
|
+
/**
|
|
9531
|
+
* 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
|
|
9532
|
+
*/
|
|
9533
|
+
function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
9534
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
9535
|
+
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
9536
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
9537
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
9538
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
9539
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
9540
|
+
const to_delete = [];
|
|
9541
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
9542
|
+
const [, max_width] = sorted_sizes[i];
|
|
9543
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
9544
|
+
to_delete.push(i);
|
|
9545
|
+
}
|
|
9546
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
9547
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
9548
|
+
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
9549
|
+
}
|
|
8815
9550
|
const $2c61e4cd8229c49a$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template)(`<div class="depict plp search"></div>`, 2);
|
|
8816
9551
|
// 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
9552
|
/**
|
|
@@ -8821,6 +9556,7 @@ const $2c61e4cd8229c49a$var$_tmpl$ = /*#__PURE__*/(0, $gVhhF$solidjsweb.template
|
|
|
8821
9556
|
* 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
9557
|
*/
|
|
8823
9558
|
const $2c61e4cd8229c49a$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
|
|
9559
|
+
const $2c61e4cd8229c49a$var$content_search_default = false;
|
|
8824
9560
|
const $2c61e4cd8229c49a$var$min_products_to_fetch_ = 20;
|
|
8825
9561
|
const $2c61e4cd8229c49a$export$bde3eb976dfded9 = depict_search => $2c61e4cd8229c49a$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
|
|
8826
9562
|
class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
@@ -8828,6 +9564,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8828
9564
|
#merchant_signal = (0, $gVhhF$solidjs.createSignal)();
|
|
8829
9565
|
#market_signal = (0, $gVhhF$solidjs.createSignal)();
|
|
8830
9566
|
#modal_open_signal = (0, $gVhhF$solidjs.createSignal)(false);
|
|
9567
|
+
#content_search_signal = (0, $gVhhF$solidjs.createSignal)();
|
|
8831
9568
|
static #keys_constructed_with = new Set();
|
|
8832
9569
|
#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
|
|
8833
9570
|
constructor({
|
|
@@ -8837,9 +9574,10 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8837
9574
|
on_navigation: on_navigation,
|
|
8838
9575
|
enable_category_suggestions = true,
|
|
8839
9576
|
page_url_creator: page_url_creator,
|
|
9577
|
+
display_transformers: display_transformers,
|
|
9578
|
+
api: api,
|
|
8840
9579
|
// Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
8841
9580
|
disable_scrolling_during_modal = true,
|
|
8842
|
-
api: api,
|
|
8843
9581
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
8844
9582
|
render_instant_card: render_instant_card,
|
|
8845
9583
|
...props_on_class
|
|
@@ -8873,6 +9611,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8873
9611
|
local_filter_cache: [],
|
|
8874
9612
|
expanded_hierarchical_filters: [],
|
|
8875
9613
|
showing_recommendation_rows: (0, $fb29c6201c369e39$export$1c8c715550dc689d),
|
|
9614
|
+
content_results_rows: (0, $3716b8caf7f959e2$export$70ceae36059a1036),
|
|
8876
9615
|
scroll_restoration_data: []
|
|
8877
9616
|
}),
|
|
8878
9617
|
router_: this.#router,
|
|
@@ -8883,12 +9622,18 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8883
9622
|
const get_search_query_ = (0, $gVhhF$solidjs.createMemo)(previous_value => {
|
|
8884
9623
|
if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
|
|
8885
9624
|
});
|
|
9625
|
+
// @ts-ignore
|
|
8886
9626
|
const depict_api_ = api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)({
|
|
8887
|
-
page_url_creator: page_url_creator
|
|
9627
|
+
page_url_creator: page_url_creator,
|
|
9628
|
+
display_transformers: display_transformers
|
|
8888
9629
|
});
|
|
8889
9630
|
const previous_searches = (0, $2b7a005a65221045$export$84bba84a7b837187)(get_search_query_);
|
|
8890
9631
|
const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
|
|
8891
|
-
const
|
|
9632
|
+
const [, set_search_content_results_rows] = state_.content_results_rows;
|
|
9633
|
+
const after_submit_ = () => {
|
|
9634
|
+
set_search_showing_recommendation_rows((0, $fb29c6201c369e39$export$1c8c715550dc689d));
|
|
9635
|
+
set_search_content_results_rows((0, $3716b8caf7f959e2$export$70ceae36059a1036));
|
|
9636
|
+
}; // 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
9637
|
const on_submit_with_unchanged_value_ = () => this.modal_open = false;
|
|
8893
9638
|
const [get_search_field_value_, set_search_field_value_] = state_.field_value;
|
|
8894
9639
|
const configured_submit_query_ = new_query => (0, $f328bd45f8ede33c$export$e16630ecb9644a1c)({
|
|
@@ -8946,6 +9691,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8946
9691
|
submit_query_: configured_submit_query_,
|
|
8947
9692
|
url_transformer_: url_transformer,
|
|
8948
9693
|
router_: this.#router,
|
|
9694
|
+
content_search_enabled_: () => this.#content_search_signal[0]() ?? $2c61e4cd8229c49a$var$content_search_default,
|
|
8949
9695
|
instant_results_options_: {
|
|
8950
9696
|
min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
|
|
8951
9697
|
render_instant_card_: render_instant_card,
|
|
@@ -9010,6 +9756,12 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
9010
9756
|
(0, $gVhhF$solidjs.onCleanup)(() => $2c61e4cd8229c49a$export$ac6237957a15b3f0.#keys_constructed_with.delete(unique_instance_key_for_state));
|
|
9011
9757
|
});
|
|
9012
9758
|
}
|
|
9759
|
+
get enable_content_search() {
|
|
9760
|
+
return this.#content_search_signal[0]();
|
|
9761
|
+
}
|
|
9762
|
+
set enable_content_search(new_state) {
|
|
9763
|
+
this.#content_search_signal[1](new_state);
|
|
9764
|
+
}
|
|
9013
9765
|
get on_navigation() {
|
|
9014
9766
|
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
9015
9767
|
return this.#router.on_navigation_;
|
|
@@ -9091,6 +9843,7 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
9091
9843
|
depict_api_: shared_properties.depict_api_,
|
|
9092
9844
|
min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
|
|
9093
9845
|
local_filter_cache_: state_.local_filter_cache,
|
|
9846
|
+
content_search_enabled_: () => depict_search.enable_content_search ?? $2c61e4cd8229c49a$var$content_search_default,
|
|
9094
9847
|
search_field_value_: state_.field_value,
|
|
9095
9848
|
get_search_query_: shared_properties.get_search_query_,
|
|
9096
9849
|
clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
|
|
@@ -9117,6 +9870,8 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
9117
9870
|
search_filters_open_: state_.filters_open,
|
|
9118
9871
|
search_sorting_open_: state_.sorting_open,
|
|
9119
9872
|
expanded_filters_: state_.expanded_filters,
|
|
9873
|
+
content_results_rows_: state_.content_results_rows,
|
|
9874
|
+
router_: shared_properties.router_,
|
|
9120
9875
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
9121
9876
|
return (0, $dae23104ba8bb78c$export$d757d54550ebfb3d)({
|
|
9122
9877
|
category_suggestion_: category_suggestion_,
|
|
@@ -9132,6 +9887,10 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
9132
9887
|
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(props.cols_at_size),
|
|
9133
9888
|
...grid_spacing_override()
|
|
9134
9889
|
})),
|
|
9890
|
+
content_layout_options_: (0, $gVhhF$solidjs.createMemo)(() => ({
|
|
9891
|
+
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)((0, $ab7c6c7911bae2f5$export$ff7109b9b2b206ba)(props.cols_at_size)),
|
|
9892
|
+
...grid_spacing_override()
|
|
9893
|
+
})),
|
|
9135
9894
|
recommendations_layout_options_: (0, $gVhhF$solidjs.createMemo)(() => {
|
|
9136
9895
|
const {
|
|
9137
9896
|
extra_depict_options: extra_depict_options
|