@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/server/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,
|
|
@@ -414,7 +414,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
|
|
|
414
414
|
return outmost_element;
|
|
415
415
|
}
|
|
416
416
|
const $b3cf6ca8dc0e9998$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
|
|
417
|
-
$b3cf6ca8dc0e9998$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text">', "</span></div><!--#-->", "<!--/--></label>"];
|
|
417
|
+
$b3cf6ca8dc0e9998$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
|
|
418
418
|
const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = props => {
|
|
419
419
|
// 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
|
|
420
420
|
const count = (0, $5vyXB$solidjs.createMemo)(() => props.count_);
|
|
@@ -1905,9 +1905,14 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
|
1905
1905
|
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
1906
1906
|
const show_all_rows = (0, $5vyXB$solidjs.createMemo)(() => props.rows === "all");
|
|
1907
1907
|
const rows_or_empty_object = (0, $5vyXB$solidjs.createMemo)(() => show_all_rows() ? {} : props.rows);
|
|
1908
|
-
const
|
|
1909
|
-
const
|
|
1910
|
-
|
|
1908
|
+
const view_more_button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $5vyXB$solidjs.createMemo)(() => rows_or_empty_object().button));
|
|
1909
|
+
const view_less_button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $5vyXB$solidjs.createMemo)(() => rows_or_empty_object().view_less_button));
|
|
1910
|
+
const have_a_view_more_button = (0, $5vyXB$solidjs.createMemo)(() => {
|
|
1911
|
+
const button = view_more_button_elements();
|
|
1912
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
1913
|
+
});
|
|
1914
|
+
const have_a_view_less_button = (0, $5vyXB$solidjs.createMemo)(() => {
|
|
1915
|
+
const button = view_less_button_elements();
|
|
1911
1916
|
return !(!button || Array.isArray(button) && !button.length);
|
|
1912
1917
|
});
|
|
1913
1918
|
const [get_styling, set_styling] = (0, $5vyXB$solidjs.createSignal)();
|
|
@@ -1916,12 +1921,15 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
|
1916
1921
|
const [get_children_count, set_children_count] = (0, $5vyXB$solidjs.createSignal)(0);
|
|
1917
1922
|
const update_children_count = () => set_children_count(container_element.children.length);
|
|
1918
1923
|
const col_styling = (0, $5vyXB$solidjs.createMemo)(() => (0, $5vyXB$depictaiutilishared.n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
1919
|
-
const default_currently_visible_signal = (0, $5vyXB$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
|
|
1924
|
+
const default_currently_visible_signal = (0, $5vyXB$solidjs.createSignal)((0, $5vyXB$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
|
|
1920
1925
|
const rows_visible_signal = (0, $5vyXB$solidjs.createMemo)(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
1921
1926
|
const get_rows_visible = (0, $5vyXB$solidjs.createMemo)(() => rows_visible_signal()[0]());
|
|
1922
1927
|
const set_rows_visible = (0, $5vyXB$solidjs.createMemo)(() => rows_visible_signal()[1]);
|
|
1923
|
-
const
|
|
1924
|
-
const
|
|
1928
|
+
const view_more_button_class = (0, $5vyXB$depictaiutilishared.make_random_classname)();
|
|
1929
|
+
const view_less_button_class = (0, $5vyXB$depictaiutilishared.make_random_classname)();
|
|
1930
|
+
const view_more_button_container = (0, $5vyXB$solidjs.createMemo)(() => have_a_view_more_button() && (0, $5vyXB$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `load-more-container ${(0, $5vyXB$solidjsweb.escape)(view_more_button_class, true)}`, (0, $5vyXB$solidjsweb.escape)(rows_or_empty_object().button)));
|
|
1931
|
+
// 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
|
|
1932
|
+
const view_less_button_container = (0, $5vyXB$solidjs.createMemo)(() => have_a_view_less_button() && (0, $5vyXB$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `load-less-container ${(0, $5vyXB$solidjsweb.escape)(view_less_button_class, true)}`, (0, $5vyXB$solidjsweb.escape)(rows_or_empty_object().view_less_button)));
|
|
1925
1933
|
container_element.classList.add(container_class);
|
|
1926
1934
|
(0, $5vyXB$solidjs.createComputed)(() => {
|
|
1927
1935
|
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
@@ -1936,7 +1944,6 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
|
1936
1944
|
set_styling(() => col_styling);
|
|
1937
1945
|
return;
|
|
1938
1946
|
}
|
|
1939
|
-
(0, $5vyXB$solidjs.untrack)(() => set_rows_visible()(rows_or_empty_object().start_rows ?? 1));
|
|
1940
1947
|
update_children_count();
|
|
1941
1948
|
const mutation_observer = new MutationObserver((0, $5vyXB$depictaiutilishared.catchify)(update_children_count));
|
|
1942
1949
|
mutation_observer.observe(container_element, {
|
|
@@ -1948,30 +1955,33 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
|
|
|
1948
1955
|
() => (0, $5vyXB$solidjs.createMemo)(() => {
|
|
1949
1956
|
const {
|
|
1950
1957
|
rows_per_click: rows_per_click,
|
|
1951
|
-
max_rows = -1
|
|
1958
|
+
max_rows = -1,
|
|
1959
|
+
start_rows: start_rows
|
|
1952
1960
|
} = rows_or_empty_object();
|
|
1953
1961
|
const rows_visible = get_rows_visible();
|
|
1954
1962
|
const children_count = get_children_count();
|
|
1955
1963
|
return col_styling() + props.cols_at_size.map(options => {
|
|
1956
|
-
const [, min, max] = options;
|
|
1957
|
-
let
|
|
1964
|
+
const [recs_per_row, min, max] = options;
|
|
1965
|
+
let should_hide_view_more_button;
|
|
1958
1966
|
let visible_recs;
|
|
1959
1967
|
if (props.disable_partial_rows) {
|
|
1960
1968
|
visible_recs = (0, $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
|
|
1961
1969
|
const visible_recs_next_show_more = (0, $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0),
|
|
1962
1970
|
// Should this really be zero when we default rows_per_click to 1?
|
|
1963
1971
|
children_count, options);
|
|
1964
|
-
|
|
1972
|
+
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
1965
1973
|
} else {
|
|
1966
1974
|
visible_recs = (0, $5vyXB$depictaiutilishared.layout_get_total_rec_amount_for_row)(rows_visible, options);
|
|
1967
|
-
|
|
1975
|
+
should_hide_view_more_button = visible_recs >= children_count;
|
|
1968
1976
|
}
|
|
1969
|
-
const should_hide_button_final =
|
|
1970
|
-
|
|
1977
|
+
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
1978
|
+
// 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
|
|
1979
|
+
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;
|
|
1980
|
+
return `${(0, $5vyXB$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}` : ``}}`;
|
|
1971
1981
|
}).join("");
|
|
1972
1982
|
}));
|
|
1973
1983
|
});
|
|
1974
|
-
return [container_element,
|
|
1984
|
+
return [container_element, view_more_button_container(), view_less_button_container(), (0, $5vyXB$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), get_styling)];
|
|
1975
1985
|
}
|
|
1976
1986
|
async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
1977
1987
|
const body = await (0, $5vyXB$depictaiutilishared.observer).wait_for_element("body");
|
|
@@ -2071,6 +2081,43 @@ function $6e22b5314fb52f4c$var$history_state_change(signals, entries, state) {
|
|
|
2071
2081
|
}
|
|
2072
2082
|
});
|
|
2073
2083
|
}
|
|
2084
|
+
const $d84fe647b84b5dc5$export$3064e1e8c6513da3 = new Set();
|
|
2085
|
+
let $d84fe647b84b5dc5$var$has_ran = false;
|
|
2086
|
+
function $d84fe647b84b5dc5$export$5162a71f252e6122() {
|
|
2087
|
+
if ($d84fe647b84b5dc5$var$has_ran || typeof history !== "object") return;
|
|
2088
|
+
$d84fe647b84b5dc5$var$has_ran = true;
|
|
2089
|
+
for (const function_name of ["replaceState", "pushState"]) {
|
|
2090
|
+
if (Object.getOwnPropertyNames(history).includes(function_name)) $d84fe647b84b5dc5$var$proxy_push_state(function_name, history);
|
|
2091
|
+
$d84fe647b84b5dc5$var$proxy_push_state(function_name, History.prototype);
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
function $d84fe647b84b5dc5$var$proxy_push_state(function_name, thing) {
|
|
2095
|
+
thing[function_name] = new Proxy(thing[function_name], {
|
|
2096
|
+
apply(target, this_arg, arg_list) {
|
|
2097
|
+
try {
|
|
2098
|
+
if (typeof arg_list[0] == "object") {
|
|
2099
|
+
const cloned_object = {
|
|
2100
|
+
...arg_list[0]
|
|
2101
|
+
};
|
|
2102
|
+
const old_state = history.state;
|
|
2103
|
+
for (const key in old_state) {
|
|
2104
|
+
if (!$d84fe647b84b5dc5$var$starts_with_any_prefix(key)) continue;
|
|
2105
|
+
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
2106
|
+
}
|
|
2107
|
+
arg_list[0] = cloned_object;
|
|
2108
|
+
}
|
|
2109
|
+
} catch (e) {
|
|
2110
|
+
(0, $5vyXB$depictaiutilishared.report)([e, "Failed to preserve items in history.state"], "error");
|
|
2111
|
+
}
|
|
2112
|
+
return Reflect.apply(target, this_arg, arg_list);
|
|
2113
|
+
}
|
|
2114
|
+
});
|
|
2115
|
+
}
|
|
2116
|
+
function $d84fe647b84b5dc5$var$starts_with_any_prefix(key) {
|
|
2117
|
+
for (const prefix of $d84fe647b84b5dc5$export$3064e1e8c6513da3) {
|
|
2118
|
+
if (key.startsWith(prefix)) return true;
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2074
2121
|
function $26a56f6b44703084$export$9862539c89138352({
|
|
2075
2122
|
get_default_values_: get_default_values_,
|
|
2076
2123
|
router_: router_,
|
|
@@ -2090,6 +2137,8 @@ function $26a56f6b44703084$export$9862539c89138352({
|
|
|
2090
2137
|
};
|
|
2091
2138
|
let unprefixed_state;
|
|
2092
2139
|
unprefixed_state = Object.fromEntries(Object.entries(prefixed_state).map(([key, value]) => [key.slice(prefix_.length), value]));
|
|
2140
|
+
(0, $d84fe647b84b5dc5$export$3064e1e8c6513da3).add(prefix_);
|
|
2141
|
+
// 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)
|
|
2093
2142
|
return [reset_state, unprefixed_state];
|
|
2094
2143
|
}
|
|
2095
2144
|
|
|
@@ -2163,14 +2212,18 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2163
2212
|
}
|
|
2164
2213
|
}
|
|
2165
2214
|
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
2166
|
-
|
|
2215
|
+
const page_url_creator = this.page_url_creator;
|
|
2216
|
+
const category_transformer = this.display_transformers?.categories;
|
|
2217
|
+
if (!page_url_creator && !category_transformer) return response;
|
|
2167
2218
|
// find category suggestions, run thing with them, and then replace them
|
|
2168
2219
|
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
|
|
2169
|
-
const page_urls = await
|
|
2170
|
-
type: "categories",
|
|
2220
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2171
2221
|
market: market,
|
|
2172
2222
|
merchant: merchant,
|
|
2173
|
-
data: [...category_suggestions]
|
|
2223
|
+
data: [...category_suggestions],
|
|
2224
|
+
...(page_url_creator ? {
|
|
2225
|
+
type: "categories"
|
|
2226
|
+
} : {})
|
|
2174
2227
|
});
|
|
2175
2228
|
this.#guard_url_creator_length(category_suggestions, page_urls);
|
|
2176
2229
|
while (page_urls.length)
|
|
@@ -2178,17 +2231,29 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2178
2231
|
Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
|
|
2179
2232
|
return response;
|
|
2180
2233
|
}
|
|
2181
|
-
async #
|
|
2182
|
-
|
|
2234
|
+
async #run_display_transformers_for_rest(merchant, market, input_data) {
|
|
2235
|
+
const {
|
|
2236
|
+
page_url_creator: page_url_creator,
|
|
2237
|
+
display_transformers: display_transformers
|
|
2238
|
+
} = this;
|
|
2239
|
+
if (!page_url_creator && !display_transformers) return input_data;
|
|
2240
|
+
const product_transformer = display_transformers?.products;
|
|
2241
|
+
const category_transformer = display_transformers?.categories;
|
|
2242
|
+
const content_result_transformer = display_transformers?.contentResults;
|
|
2183
2243
|
const displays = input_data.displays;
|
|
2184
|
-
const
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2244
|
+
const {
|
|
2245
|
+
breadcrumb: breadcrumb,
|
|
2246
|
+
quick_links: quick_links,
|
|
2247
|
+
content_search_links: content_search_links
|
|
2248
|
+
} = input_data;
|
|
2249
|
+
if (displays && (page_url_creator || product_transformer)) {
|
|
2250
|
+
const page_urls = await (page_url_creator || product_transformer)({
|
|
2189
2251
|
merchant: merchant,
|
|
2190
2252
|
market: market,
|
|
2191
|
-
displays: [...input_data.displays]
|
|
2253
|
+
displays: [...input_data.displays],
|
|
2254
|
+
...(page_url_creator ? {
|
|
2255
|
+
type: "products"
|
|
2256
|
+
} : {})
|
|
2192
2257
|
});
|
|
2193
2258
|
this.#guard_url_creator_length(displays, page_urls);
|
|
2194
2259
|
for (let i = 0; i < displays.length; i++) {
|
|
@@ -2206,19 +2271,30 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2206
2271
|
displays[i] = new_display_or_page_url;
|
|
2207
2272
|
}
|
|
2208
2273
|
}
|
|
2209
|
-
for (const category_display_array of [breadcrumb, quick_links]) {
|
|
2274
|
+
if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
|
|
2210
2275
|
if (!category_display_array) continue;
|
|
2211
|
-
const page_urls = await
|
|
2212
|
-
type: "categories",
|
|
2276
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2213
2277
|
merchant: merchant,
|
|
2214
2278
|
market: market,
|
|
2215
|
-
data: [...category_display_array]
|
|
2279
|
+
data: [...category_display_array],
|
|
2280
|
+
...(page_url_creator ? {
|
|
2281
|
+
type: "categories"
|
|
2282
|
+
} : {})
|
|
2216
2283
|
});
|
|
2217
2284
|
this.#guard_url_creator_length(category_display_array, page_urls);
|
|
2218
2285
|
for (let i = 0; i < category_display_array.length; i++)
|
|
2219
2286
|
// Copy over getters so we sneakily can make this reactive
|
|
2220
2287
|
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
2221
2288
|
}
|
|
2289
|
+
if (content_search_links?.length && content_result_transformer) {
|
|
2290
|
+
const result = await content_result_transformer({
|
|
2291
|
+
merchant: merchant,
|
|
2292
|
+
market: market,
|
|
2293
|
+
data: [...content_search_links]
|
|
2294
|
+
});
|
|
2295
|
+
this.#guard_url_creator_length(content_search_links, result);
|
|
2296
|
+
input_data.content_search_links = result;
|
|
2297
|
+
}
|
|
2222
2298
|
return input_data;
|
|
2223
2299
|
}
|
|
2224
2300
|
async #cached_post_request(endpoint, input_req, fallback_response) {
|
|
@@ -2245,7 +2321,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2245
2321
|
let result;
|
|
2246
2322
|
try {
|
|
2247
2323
|
const unmodified_result = await api_response.json();
|
|
2248
|
-
result = await this.#
|
|
2324
|
+
result = await this.#run_display_transformers_for_rest(input_req.tenant, input_req.market, unmodified_result);
|
|
2249
2325
|
} catch (e) {
|
|
2250
2326
|
(0, $5vyXB$depictaiutilishared.dwarn)("URL creator or json decoding failed", e);
|
|
2251
2327
|
break return_successfully;
|
|
@@ -2277,12 +2353,14 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
2277
2353
|
get_metadata: get_metadata,
|
|
2278
2354
|
get_user_id: get_user_id,
|
|
2279
2355
|
get_session_id: get_session_id,
|
|
2280
|
-
page_url_creator: page_url_creator
|
|
2356
|
+
page_url_creator: page_url_creator,
|
|
2357
|
+
display_transformers: display_transformers
|
|
2281
2358
|
} = options ?? {};
|
|
2282
2359
|
this.#get_metadata = get_metadata;
|
|
2283
2360
|
this.#get_user_id = get_user_id;
|
|
2284
2361
|
this.#get_session_id = get_session_id;
|
|
2285
2362
|
this.page_url_creator = page_url_creator;
|
|
2363
|
+
this.display_transformers = display_transformers;
|
|
2286
2364
|
}
|
|
2287
2365
|
async suggest(input_req) {
|
|
2288
2366
|
const with_ids = this.#add_ids_to_request(input_req);
|
|
@@ -2392,11 +2470,11 @@ function $6b384adf40a5f4d7$var$correct_range_filter_range_once({
|
|
|
2392
2470
|
}
|
|
2393
2471
|
}
|
|
2394
2472
|
function $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
|
|
2395
|
-
|
|
2473
|
+
number_: number_,
|
|
2396
2474
|
i18n_: i18n_
|
|
2397
2475
|
}) {
|
|
2398
2476
|
return (0, $5vyXB$solidjs.createMemo)(() => {
|
|
2399
|
-
const n_hits =
|
|
2477
|
+
const n_hits = number_();
|
|
2400
2478
|
if (isNaN(n_hits)) return "";
|
|
2401
2479
|
const price_formatting = i18n_.price_formatting_();
|
|
2402
2480
|
return (0, $5vyXB$depictaiutilishared.standard_price_format)(n_hits, 0,
|
|
@@ -4485,7 +4563,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
4485
4563
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $5vyXB$solidjs.createSignal)(false);
|
|
4486
4564
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $5vyXB$solidjs.createSignal)();
|
|
4487
4565
|
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
4488
|
-
|
|
4566
|
+
number_: (0, $5vyXB$solidjs.createMemo)(() => plp_results_()?.n_hits),
|
|
4489
4567
|
i18n_: i18n_
|
|
4490
4568
|
});
|
|
4491
4569
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $5vyXB$solidjs.createSignal)();
|
|
@@ -4701,37 +4779,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
4701
4779
|
}
|
|
4702
4780
|
})))];
|
|
4703
4781
|
}
|
|
4704
|
-
let $d84fe647b84b5dc5$var$has_ran = false;
|
|
4705
|
-
function $d84fe647b84b5dc5$export$5162a71f252e6122() {
|
|
4706
|
-
if ($d84fe647b84b5dc5$var$has_ran || typeof history !== "object") return;
|
|
4707
|
-
$d84fe647b84b5dc5$var$has_ran = true;
|
|
4708
|
-
for (const function_name of ["replaceState", "pushState"]) {
|
|
4709
|
-
if (Object.getOwnPropertyNames(history).includes(function_name)) $d84fe647b84b5dc5$var$proxy_push_state(function_name, history);
|
|
4710
|
-
$d84fe647b84b5dc5$var$proxy_push_state(function_name, History.prototype);
|
|
4711
|
-
}
|
|
4712
|
-
}
|
|
4713
|
-
function $d84fe647b84b5dc5$var$proxy_push_state(function_name, thing) {
|
|
4714
|
-
thing[function_name] = new Proxy(thing[function_name], {
|
|
4715
|
-
apply(target, this_arg, arg_list) {
|
|
4716
|
-
try {
|
|
4717
|
-
if (typeof arg_list[0] == "object") {
|
|
4718
|
-
const cloned_object = {
|
|
4719
|
-
...arg_list[0]
|
|
4720
|
-
};
|
|
4721
|
-
const old_state = history.state;
|
|
4722
|
-
for (const key in old_state) {
|
|
4723
|
-
if (!key.startsWith("category_") && !key.startsWith("search_")) continue;
|
|
4724
|
-
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
4725
|
-
}
|
|
4726
|
-
arg_list[0] = cloned_object;
|
|
4727
|
-
}
|
|
4728
|
-
} catch (e) {
|
|
4729
|
-
(0, $5vyXB$depictaiutilishared.report)([e, "Failed to preserve items in history.state"], "error");
|
|
4730
|
-
}
|
|
4731
|
-
return Reflect.apply(target, this_arg, arg_list);
|
|
4732
|
-
}
|
|
4733
|
-
});
|
|
4734
|
-
}
|
|
4735
4782
|
const $4e04be41243c3d80$var$transform_elements = sorted_cols_at_size => {
|
|
4736
4783
|
const cols_at_size = [];
|
|
4737
4784
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -5017,7 +5064,6 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
5017
5064
|
}
|
|
5018
5065
|
const $48567ac5b39bac56$var$_tmpl$ = ["<div", ' class="depict plp category">', "</div>"];
|
|
5019
5066
|
// 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
|
|
5020
|
-
// on old displays, no page_url_creator can be specified
|
|
5021
5067
|
/**
|
|
5022
5068
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions.
|
|
5023
5069
|
* SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
@@ -5077,6 +5123,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
5077
5123
|
api: api,
|
|
5078
5124
|
on_navigation: on_navigation,
|
|
5079
5125
|
page_url_creator: page_url_creator,
|
|
5126
|
+
display_transformers: display_transformers,
|
|
5080
5127
|
unique_instance_key_for_state = "",
|
|
5081
5128
|
query_id_state_key: query_id_state_key,
|
|
5082
5129
|
...props_on_class
|
|
@@ -5121,8 +5168,10 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
5121
5168
|
quicklinks_signal_: (0, $5vyXB$solidjs.createSignal)(),
|
|
5122
5169
|
i18n_: i18n_,
|
|
5123
5170
|
reset_history_state_: reset_history_state_,
|
|
5171
|
+
// @ts-ignore
|
|
5124
5172
|
depict_api_: api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)({
|
|
5125
|
-
page_url_creator: page_url_creator
|
|
5173
|
+
page_url_creator: page_url_creator,
|
|
5174
|
+
display_transformers: display_transformers
|
|
5126
5175
|
}),
|
|
5127
5176
|
router_: this.#router,
|
|
5128
5177
|
selected_filters_: selected_filters_,
|
|
@@ -5581,11 +5630,11 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
5581
5630
|
});
|
|
5582
5631
|
}
|
|
5583
5632
|
function $fb29c6201c369e39$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
|
|
5584
|
-
const currently_visible = (0, $5vyXB$solidjs.createSignal)(0);
|
|
5633
|
+
const currently_visible = (0, $5vyXB$solidjs.createSignal)((0, $5vyXB$solidjs.untrack)(get_showing_recommendation_rows));
|
|
5585
5634
|
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
5586
5635
|
const rows = {
|
|
5587
5636
|
currently_visible: currently_visible,
|
|
5588
|
-
start_rows:
|
|
5637
|
+
start_rows: $fb29c6201c369e39$export$1c8c715550dc689d,
|
|
5589
5638
|
rows_per_click: 3,
|
|
5590
5639
|
button: (0, $5vyXB$solidjsweb.ssr)($fb29c6201c369e39$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.view_more_()))
|
|
5591
5640
|
};
|
|
@@ -5747,7 +5796,7 @@ const $639c124c22b6cbaa$export$27b710c08412a7ad = obj => {
|
|
|
5747
5796
|
return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
|
|
5748
5797
|
};
|
|
5749
5798
|
const $6ae613870d3380fc$var$_tmpl$ = ["<span", ' class="orig price"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span>"],
|
|
5750
|
-
$6ae613870d3380fc$var$_tmpl$2 = ["<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="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div></a>"],
|
|
5799
|
+
$6ae613870d3380fc$var$_tmpl$2 = ["<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="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div></a>"],
|
|
5751
5800
|
$6ae613870d3380fc$var$_tmpl$3 = ["<div", ' class="tagline">', "</div>"];
|
|
5752
5801
|
const $6ae613870d3380fc$export$b05c0ae390cf3e06 = (display_or_variant_container, {
|
|
5753
5802
|
i18n: i18n
|
|
@@ -5816,9 +5865,11 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
|
5816
5865
|
render_instant_card_placeholder_: render_instant_card_placeholder_,
|
|
5817
5866
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
5818
5867
|
has_sort_or_filters_: has_sort_or_filters_,
|
|
5819
|
-
|
|
5868
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
5820
5869
|
i18n_: i18n_,
|
|
5821
|
-
router_: router_
|
|
5870
|
+
router_: router_,
|
|
5871
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
5872
|
+
content_search_enabled_: content_search_enabled_
|
|
5822
5873
|
}) {
|
|
5823
5874
|
const max_cards = 4;
|
|
5824
5875
|
const [read_current_instant_query, write_current_instant_query] = (0, $5vyXB$solidjs.createSignal)("");
|
|
@@ -5843,8 +5894,17 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
|
|
|
5843
5894
|
...variable_data
|
|
5844
5895
|
});
|
|
5845
5896
|
}));
|
|
5846
|
-
|
|
5847
|
-
|
|
5897
|
+
// 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
|
|
5898
|
+
// This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
|
|
5899
|
+
set_modal_search_results_(() => search_results);
|
|
5900
|
+
(0, $5vyXB$solidjs.onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
|
|
5901
|
+
set_total_num_results_accessor_(() => (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
5902
|
+
number_: (0, $5vyXB$solidjs.createMemo)(() => {
|
|
5903
|
+
const hits = search_results()?.n_hits;
|
|
5904
|
+
const content_results = search_results()?.content_search_links?.length;
|
|
5905
|
+
if (!content_results || !content_search_enabled_()) return hits;
|
|
5906
|
+
return (hits ?? 0) + content_results;
|
|
5907
|
+
}),
|
|
5848
5908
|
i18n_: i18n_
|
|
5849
5909
|
}));
|
|
5850
5910
|
const sliced_displays = (0, $5vyXB$solidjs.createMemo)(() => search_results()?.displays?.slice(0, max_cards));
|
|
@@ -5909,7 +5969,7 @@ function $9e30168c4b1661d2$export$5d2caaa6b530761c() {
|
|
|
5909
5969
|
return (0, $5vyXB$solidjsweb.ssr)($9e30168c4b1661d2$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)());
|
|
5910
5970
|
}
|
|
5911
5971
|
const $9a268bf73b31a717$var$_tmpl$ = ["<div", ' class="previous-searches"><h2 class="text">', '</h2><div class="list">', "</div></div>"],
|
|
5912
|
-
$9a268bf73b31a717$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->',
|
|
5972
|
+
$9a268bf73b31a717$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->', '<!--/--><span class="line-clamp"', ">", '</span></div><button class="delete"', ">", "</button></a>"];
|
|
5913
5973
|
function $9a268bf73b31a717$export$a146ac6fa8346a25({
|
|
5914
5974
|
text_: text_,
|
|
5915
5975
|
previous_searches_: previous_searches_,
|
|
@@ -5949,14 +6009,14 @@ function $9a268bf73b31a717$export$a146ac6fa8346a25({
|
|
|
5949
6009
|
value_: item,
|
|
5950
6010
|
url_transformer_: url_transformer_
|
|
5951
6011
|
});
|
|
5952
|
-
return (0, $5vyXB$solidjsweb.ssr)($9a268bf73b31a717$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `${`item` || ""} ${(0, $5vyXB$solidjs.createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href(), true), false), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {})), (0, $5vyXB$solidjsweb.escape)(item()), (0, $5vyXB$solidjsweb.ssrAttribute)("title", (0, $5vyXB$solidjsweb.escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $c77c68e559a1506c$export$3b621d86b1566b2), {})));
|
|
6012
|
+
return (0, $5vyXB$solidjsweb.ssr)($9a268bf73b31a717$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `${`item` || ""} ${(0, $5vyXB$solidjs.createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href(), true), false), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {})), (0, $5vyXB$solidjsweb.ssrAttribute)("title", (0, $5vyXB$solidjsweb.escape)(item(), true), false), (0, $5vyXB$solidjsweb.escape)(item()), (0, $5vyXB$solidjsweb.ssrAttribute)("title", (0, $5vyXB$solidjsweb.escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $c77c68e559a1506c$export$3b621d86b1566b2), {})));
|
|
5953
6013
|
}
|
|
5954
6014
|
})));
|
|
5955
6015
|
}
|
|
5956
6016
|
});
|
|
5957
6017
|
}
|
|
5958
6018
|
const $d023ed916c84e75d$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
5959
|
-
$d023ed916c84e75d$var$_tmpl$2 = ["<span", ' class="', '"
|
|
6019
|
+
$d023ed916c84e75d$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
5960
6020
|
function $d023ed916c84e75d$export$ba17c5b7e6dda39f({
|
|
5961
6021
|
whole_text_to_display_: whole_text_to_display_memo,
|
|
5962
6022
|
searching_for_value_: searching_for_value_memo,
|
|
@@ -6006,16 +6066,27 @@ function $d023ed916c84e75d$export$ba17c5b7e6dda39f({
|
|
|
6006
6066
|
}
|
|
6007
6067
|
return output;
|
|
6008
6068
|
}));
|
|
6009
|
-
return (0, $5vyXB$solidjsweb.ssr)($d023ed916c84e75d$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `${(0, $5vyXB$solidjsweb.escape)(class_, true) || ""} ${get_has_highlighted() ? "has-history-match" : ""}`, (0, $5vyXB$solidjsweb.escape)(text_itself()));
|
|
6069
|
+
return (0, $5vyXB$solidjsweb.ssr)($d023ed916c84e75d$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `${(0, $5vyXB$solidjsweb.escape)(class_, true) || ""} ${get_has_highlighted() ? "has-history-match" : ""}`, (0, $5vyXB$solidjsweb.ssrAttribute)("title", (0, $5vyXB$solidjsweb.escape)(whole_text_to_display_memo(), true), false), (0, $5vyXB$solidjsweb.escape)(text_itself()));
|
|
6070
|
+
}
|
|
6071
|
+
const $c0125412b4ea0c93$var$_tmpl$ = '<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>';
|
|
6072
|
+
function $c0125412b4ea0c93$export$605674723bcc715c(props = {}) {
|
|
6073
|
+
return (0, $5vyXB$solidjsweb.ssrElement)("svg", () => ({
|
|
6074
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
6075
|
+
"width": "32",
|
|
6076
|
+
"height": "32",
|
|
6077
|
+
"viewBox": "0 0 256 256",
|
|
6078
|
+
...props
|
|
6079
|
+
}), () => (0, $5vyXB$solidjsweb.ssr)($c0125412b4ea0c93$var$_tmpl$), true);
|
|
6010
6080
|
}
|
|
6011
6081
|
const $6b65ba8af12c5a26$var$_tmpl$ = ["<a", ' class="', '"', ">", "</a>"],
|
|
6012
6082
|
$6b65ba8af12c5a26$var$_tmpl$2 = ["<div", ' class="search-icon">', "</div>"],
|
|
6013
6083
|
$6b65ba8af12c5a26$var$_tmpl$3 = ["<span", ' class="type">', "</span>"],
|
|
6014
6084
|
$6b65ba8af12c5a26$var$_tmpl$4 = ["<div", "><!--#-->", '<!--/--><span class="value">', "</span></div>"],
|
|
6015
|
-
$6b65ba8af12c5a26$var$_tmpl$5 = ["<
|
|
6016
|
-
$6b65ba8af12c5a26$var$_tmpl$6 = ["<
|
|
6017
|
-
$6b65ba8af12c5a26$var$_tmpl$7 = ["<div", ' class="suggestion-container
|
|
6018
|
-
$6b65ba8af12c5a26$var$_tmpl$8 = ["<div", ' class="
|
|
6085
|
+
$6b65ba8af12c5a26$var$_tmpl$5 = ["<div", ' class="with-icon"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
6086
|
+
$6b65ba8af12c5a26$var$_tmpl$6 = ["<h2", ' class="text">', "</h2>"],
|
|
6087
|
+
$6b65ba8af12c5a26$var$_tmpl$7 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
6088
|
+
$6b65ba8af12c5a26$var$_tmpl$8 = ["<div", ' class="suggestion-container page">', "</div>"],
|
|
6089
|
+
$6b65ba8af12c5a26$var$_tmpl$9 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
|
|
6019
6090
|
function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
6020
6091
|
suggestion_memo_: suggestion_memo_,
|
|
6021
6092
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
@@ -6028,7 +6099,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
6028
6099
|
include_category_suggestions_: include_category_suggestions_,
|
|
6029
6100
|
searching_for_value_: searching_for_value_,
|
|
6030
6101
|
router_: router_,
|
|
6031
|
-
submit_query_: submit_query_
|
|
6102
|
+
submit_query_: submit_query_,
|
|
6103
|
+
get_content_results_: get_content_results_
|
|
6032
6104
|
}) {
|
|
6033
6105
|
const queries_memo = (0, $5vyXB$solidjs.createMemo)(() => suggestion_memo_().filter(({
|
|
6034
6106
|
type: type,
|
|
@@ -6036,9 +6108,15 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
6036
6108
|
}) => type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
6037
6109
|
));
|
|
6038
6110
|
|
|
6039
|
-
const not_queries_memo = (0, $5vyXB$solidjs.createMemo)(() =>
|
|
6040
|
-
|
|
6041
|
-
|
|
6111
|
+
const not_queries_memo = (0, $5vyXB$solidjs.createMemo)(() => {
|
|
6112
|
+
// For the section that shows categories and content results
|
|
6113
|
+
// We want to limit to 3 items, and we want to show the categories first
|
|
6114
|
+
const content_results = get_content_results_() || [];
|
|
6115
|
+
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(({
|
|
6116
|
+
type: type
|
|
6117
|
+
}) => type !== (0, $3ec9e21d6b6debdd$export$3cf9497e790da491)) : [];
|
|
6118
|
+
return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
|
|
6119
|
+
});
|
|
6042
6120
|
const render_entry = (input_obj, autocomplete_data_index, index, is_history = false) => {
|
|
6043
6121
|
const is_query = (0, $5vyXB$solidjs.createMemo)(() => input_obj().type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491));
|
|
6044
6122
|
const href_with_changed_params_accessor = (0, $5vyXB$solidjs.createMemo)(() => is_query() ? (0, $496cde876b53ce1e$export$91c3b6774e8be0f5)({
|
|
@@ -6047,7 +6125,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
6047
6125
|
url_transformer_: url_transformer_
|
|
6048
6126
|
}) : undefined);
|
|
6049
6127
|
const href = (0, $5vyXB$solidjs.createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
6050
|
-
|
|
6128
|
+
const is_selected = (0, $5vyXB$solidjs.createMemo)(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
6129
|
+
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `suggestion ${is_selected() ? "selected" : ""} ${is_history ? "history" : ""} ${(0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.escape)("type-" + input_obj().type, true), true)}`, (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href(), true), false), is_query() ? (0, $5vyXB$solidjsweb.escape)([(0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6051
6130
|
when: is_history,
|
|
6052
6131
|
get fallback() {
|
|
6053
6132
|
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $87d7574e1d89d69b$export$82eafebb825fc23f), {})));
|
|
@@ -6056,24 +6135,34 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
6056
6135
|
return (0, $5vyXB$solidjsweb.createComponent)((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {});
|
|
6057
6136
|
}
|
|
6058
6137
|
}), (0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
6059
|
-
class_: "value",
|
|
6138
|
+
class_: "value line-clamp",
|
|
6139
|
+
get whole_text_to_display_() {
|
|
6140
|
+
return (0, $5vyXB$solidjs.createMemo)(() => input_obj().title);
|
|
6141
|
+
},
|
|
6142
|
+
searching_for_value_: searching_for_value_
|
|
6143
|
+
})]) : (0, $5vyXB$solidjsweb.escape)([typeof input_obj() /* this is a harmless lie */.parent_title === "string" ? (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$4, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
6144
|
+
class_: "category line-clamp",
|
|
6060
6145
|
get whole_text_to_display_() {
|
|
6061
6146
|
return (0, $5vyXB$solidjs.createMemo)(() => input_obj().title);
|
|
6062
6147
|
},
|
|
6063
6148
|
searching_for_value_: searching_for_value_
|
|
6064
|
-
})
|
|
6065
|
-
|
|
6149
|
+
})), (0, $5vyXB$solidjsweb.escape)(input_obj().parent_title)) : input_obj().type === "content" ? (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$5, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $c0125412b4ea0c93$export$605674723bcc715c), {
|
|
6150
|
+
width: "16",
|
|
6151
|
+
height: "16"
|
|
6152
|
+
})), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
6153
|
+
class_: "content line-clamp",
|
|
6066
6154
|
get whole_text_to_display_() {
|
|
6067
6155
|
return (0, $5vyXB$solidjs.createMemo)(() => input_obj().title);
|
|
6068
6156
|
},
|
|
6069
6157
|
searching_for_value_: searching_for_value_
|
|
6070
|
-
}))
|
|
6071
|
-
class_: "category",
|
|
6158
|
+
}))) : (0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
6159
|
+
class_: "category line-clamp",
|
|
6072
6160
|
get whole_text_to_display_() {
|
|
6073
6161
|
return (0, $5vyXB$solidjs.createMemo)(() => input_obj().title);
|
|
6074
6162
|
},
|
|
6075
6163
|
searching_for_value_: searching_for_value_
|
|
6076
6164
|
}), (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$3, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjs.createMemo)(() => {
|
|
6165
|
+
if (input_obj().type === "content") return i18n_.content_();
|
|
6077
6166
|
if (input_obj().category_type === "BRAND") return i18n_.brand_();
|
|
6078
6167
|
return i18n_.category_();
|
|
6079
6168
|
})()))]));
|
|
@@ -6089,26 +6178,26 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
6089
6178
|
}));
|
|
6090
6179
|
};
|
|
6091
6180
|
const should_show_previous_searches_in_query_part = (0, $5vyXB$solidjs.createMemo)(() => !on_previous_searches_page_());
|
|
6092
|
-
const should_show_at_all = (0, $5vyXB$solidjs.createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length);
|
|
6181
|
+
const should_show_at_all = (0, $5vyXB$solidjs.createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length || get_content_results_()?.length);
|
|
6093
6182
|
const should_show_query_part = (0, $5vyXB$solidjs.createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
|
|
6094
6183
|
return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6095
6184
|
get when() {
|
|
6096
6185
|
return should_show_at_all();
|
|
6097
6186
|
},
|
|
6098
6187
|
get children() {
|
|
6099
|
-
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$
|
|
6188
|
+
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$9, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `suggestions ${on_previous_searches_page_() ? "compact" : ""}`, (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6100
6189
|
get when() {
|
|
6101
6190
|
return on_previous_searches_page_();
|
|
6102
6191
|
},
|
|
6103
6192
|
get children() {
|
|
6104
|
-
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$
|
|
6193
|
+
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$6, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.suggestions_()));
|
|
6105
6194
|
}
|
|
6106
6195
|
})), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6107
6196
|
get when() {
|
|
6108
6197
|
return should_show_query_part();
|
|
6109
6198
|
},
|
|
6110
6199
|
get children() {
|
|
6111
|
-
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$
|
|
6200
|
+
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$7, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6112
6201
|
get when() {
|
|
6113
6202
|
return should_show_previous_searches_in_query_part();
|
|
6114
6203
|
},
|
|
@@ -6144,11 +6233,11 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
6144
6233
|
}
|
|
6145
6234
|
})), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6146
6235
|
get when() {
|
|
6147
|
-
return not_queries_memo().length
|
|
6236
|
+
return not_queries_memo().length;
|
|
6148
6237
|
},
|
|
6149
6238
|
keyed: false,
|
|
6150
6239
|
get children() {
|
|
6151
|
-
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$
|
|
6240
|
+
return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$8, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (() => {
|
|
6152
6241
|
const index_in_autocomplete = 3;
|
|
6153
6242
|
set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
|
|
6154
6243
|
return (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Index), {
|
|
@@ -6163,7 +6252,18 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
6163
6252
|
}
|
|
6164
6253
|
});
|
|
6165
6254
|
}
|
|
6166
|
-
const $
|
|
6255
|
+
const $b8700779b3e745de$var$_tmpl$ = ["<a", ' target="_blank"></a>'];
|
|
6256
|
+
function $b8700779b3e745de$export$1efe1013da60d0e4(e, href) {
|
|
6257
|
+
if (e.metaKey || e.ctrlKey) {
|
|
6258
|
+
// Open link in a new tab with cmd/ctrl + enter.
|
|
6259
|
+
const link = (0, $5vyXB$solidjsweb.ssr)($b8700779b3e745de$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)() + (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href, true), false));
|
|
6260
|
+
document.body.append(link);
|
|
6261
|
+
link.click();
|
|
6262
|
+
link.remove();
|
|
6263
|
+
return true;
|
|
6264
|
+
}
|
|
6265
|
+
return false;
|
|
6266
|
+
}
|
|
6167
6267
|
function $6a374b16bfe947d0$export$217899a935ef803b({
|
|
6168
6268
|
selected_index_: [read_selected_index, write_selected_index],
|
|
6169
6269
|
currently_showing_suggestions_: [read_currently_showing_suggestions],
|
|
@@ -6237,6 +6337,7 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
6237
6337
|
const sfv = get_search_field_value();
|
|
6238
6338
|
if (!(0, $5vyXB$solidjs.untrack)(() => read_updating_blocked())) previous_value = sfv;
|
|
6239
6339
|
});
|
|
6340
|
+
const owner = (0, $5vyXB$solidjs.getOwner)();
|
|
6240
6341
|
const handler = (0, $5vyXB$depictaiutilishared.catchify)(({
|
|
6241
6342
|
keyCode: keyCode
|
|
6242
6343
|
}) => (0, $5vyXB$solidjs.untrack)(() => {
|
|
@@ -6267,29 +6368,29 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
6267
6368
|
const {
|
|
6268
6369
|
title: title
|
|
6269
6370
|
} = selected_entry;
|
|
6270
|
-
|
|
6371
|
+
(0, $5vyXB$solidjs.runWithOwner)(owner, block_updating_for_one_change);
|
|
6271
6372
|
set_search_field_value(title);
|
|
6272
|
-
override_on_enter_for_this_entry(e => {
|
|
6373
|
+
(0, $5vyXB$solidjs.runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
6273
6374
|
// Open search query in new tab on cmd+enter
|
|
6274
6375
|
// 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 ;)
|
|
6275
6376
|
const url = new URL(location);
|
|
6276
6377
|
url_transformer_?.(url);
|
|
6277
6378
|
url.searchParams.set(search_query_param_name_, title);
|
|
6278
|
-
return $
|
|
6279
|
-
});
|
|
6280
|
-
} else if (selected_entry?.type == "category") override_on_enter_for_this_entry(e => {
|
|
6379
|
+
return (0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, url.href);
|
|
6380
|
+
}));
|
|
6381
|
+
} else if (selected_entry?.type == "category" || selected_entry?.type === "content") (0, $5vyXB$solidjs.runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
6281
6382
|
const {
|
|
6282
6383
|
page_url: page_url
|
|
6283
6384
|
} = selected_entry;
|
|
6284
|
-
if (
|
|
6385
|
+
if (!(0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, page_url))
|
|
6285
6386
|
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
6286
6387
|
router_.navigate_.go_to_({
|
|
6287
6388
|
new_url_: page_url,
|
|
6288
6389
|
is_replace_: false
|
|
6289
6390
|
});
|
|
6290
6391
|
return true;
|
|
6291
|
-
});else if (!selected_entry) {
|
|
6292
|
-
|
|
6392
|
+
}));else if (!selected_entry) {
|
|
6393
|
+
(0, $5vyXB$solidjs.runWithOwner)(owner, block_updating_for_one_change);
|
|
6293
6394
|
set_search_field_value(previous_value);
|
|
6294
6395
|
}
|
|
6295
6396
|
}));
|
|
@@ -6300,16 +6401,37 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
6300
6401
|
(0, $5vyXB$solidjs.onCleanup)((0, $5vyXB$depictaiutilishared.catchify)(() => el.removeEventListener("keyup", handler)));
|
|
6301
6402
|
});
|
|
6302
6403
|
}
|
|
6303
|
-
function $
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6404
|
+
function $4f0ae864ec7c394e$export$af0124069c150252({
|
|
6405
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
6406
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
6407
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
6408
|
+
router_: router_,
|
|
6409
|
+
content_results_: content_results_
|
|
6410
|
+
}) {
|
|
6411
|
+
const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $5vyXB$solidjs.createSignal)(() => false);
|
|
6412
|
+
(0, $5vyXB$solidjs.createComputed)(() => {
|
|
6413
|
+
const suggestions = read_suggestion_signal_();
|
|
6414
|
+
const search_results = get_modal_search_results_()?.();
|
|
6415
|
+
const content_results = content_results_();
|
|
6416
|
+
// If we only have one content result and nothing else, go there when pressing enter
|
|
6417
|
+
if (!suggestions.length && !search_results?.displays?.length && content_results?.length === 1) {
|
|
6418
|
+
const [{
|
|
6419
|
+
page_url: page_url
|
|
6420
|
+
}] = content_results;
|
|
6421
|
+
set_override_on_enter_fn_(e => {
|
|
6422
|
+
if (!(0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, page_url))
|
|
6423
|
+
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
6424
|
+
router_.navigate_.go_to_({
|
|
6425
|
+
new_url_: page_url,
|
|
6426
|
+
is_replace_: false
|
|
6427
|
+
});
|
|
6428
|
+
return true;
|
|
6429
|
+
});
|
|
6430
|
+
return;
|
|
6431
|
+
}
|
|
6432
|
+
set_override_on_enter_fn_(get_autocomplete_wants_override_function());
|
|
6433
|
+
});
|
|
6434
|
+
return new_fn => set_autocomplete_wants_override_function(() => new_fn);
|
|
6313
6435
|
}
|
|
6314
6436
|
const $3ec9e21d6b6debdd$export$3cf9497e790da491 = "query";
|
|
6315
6437
|
function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
@@ -6329,12 +6451,15 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
6329
6451
|
i18n_: i18n_,
|
|
6330
6452
|
include_category_suggestions_: include_category_suggestions_,
|
|
6331
6453
|
submit_query_: submit_query_,
|
|
6332
|
-
router_: router_
|
|
6454
|
+
router_: router_,
|
|
6455
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
6456
|
+
content_search_enabled_: content_search_enabled_
|
|
6333
6457
|
}) {
|
|
6334
6458
|
const [searching_for_value, set_searching_for_value] = (0, $5vyXB$solidjs.createSignal)();
|
|
6459
|
+
const [show_stale_content_results, set_show_stale_content_results] = (0, $5vyXB$solidjs.createSignal)(false);
|
|
6335
6460
|
const [read_search_field_value] = search_field_value_;
|
|
6336
6461
|
const updating_blocked = (0, $5vyXB$solidjs.createSignal)(false);
|
|
6337
|
-
const [
|
|
6462
|
+
const [read_suggestion_signal_, write_suggestion_signal] = (0, $5vyXB$solidjs.createSignal)([]);
|
|
6338
6463
|
const filtered_previous_searches = (0, $5vyXB$solidjs.createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
|
|
6339
6464
|
const deparallelized_fn = (0, $5vyXB$depictaiutilishared.deparallelize_no_drop)(async request_obj => {
|
|
6340
6465
|
const api_response = await depict_api_.suggest(request_obj);
|
|
@@ -6353,15 +6478,38 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
6353
6478
|
});
|
|
6354
6479
|
|
|
6355
6480
|
const show_previous_searches_component = (0, $5vyXB$solidjs.createMemo)(() => !read_search_field_value() || (0, $5vyXB$solidjs.untrack)(updating_blocked[0]) && !(0, $5vyXB$solidjs.untrack)(searching_for_value));
|
|
6481
|
+
const get_content_results_ = (0, $5vyXB$solidjs.createMemo)(prev => {
|
|
6482
|
+
if (!content_search_enabled_()) return [];
|
|
6483
|
+
if (show_stale_content_results())
|
|
6484
|
+
// don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
|
|
6485
|
+
return prev;
|
|
6486
|
+
return get_modal_search_results_()?.()?.content_search_links?.map(link => ({
|
|
6487
|
+
page_url: link.page_url,
|
|
6488
|
+
type: "content",
|
|
6489
|
+
title: link.title
|
|
6490
|
+
}));
|
|
6491
|
+
});
|
|
6492
|
+
// 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.
|
|
6493
|
+
// It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
|
|
6494
|
+
const manipulated_set_override_on_enter_fn_ = (0, $4f0ae864ec7c394e$export$af0124069c150252)({
|
|
6495
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
6496
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
6497
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
6498
|
+
router_: router_,
|
|
6499
|
+
content_results_: get_content_results_
|
|
6500
|
+
});
|
|
6356
6501
|
(0, $5vyXB$solidjs.createComputed)(() => {
|
|
6357
6502
|
const field_value = read_search_field_value();
|
|
6358
|
-
if (
|
|
6503
|
+
if ((0, $5vyXB$solidjs.untrack)(updating_blocked[0]))
|
|
6504
|
+
// not using updating_blocked instead of below signal since I presume they'd start updating too early then
|
|
6505
|
+
set_show_stale_content_results(true);else {
|
|
6359
6506
|
set_searching_for_value(field_value);
|
|
6360
6507
|
deparallelized_fn({
|
|
6361
6508
|
query: field_value,
|
|
6362
6509
|
tenant: tenant_(),
|
|
6363
6510
|
market: market_()
|
|
6364
6511
|
});
|
|
6512
|
+
set_show_stale_content_results(false);
|
|
6365
6513
|
}
|
|
6366
6514
|
});
|
|
6367
6515
|
(0, $5vyXB$solidjs.createComputed)((0, $5vyXB$solidjs.on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
|
|
@@ -6373,7 +6521,7 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
6373
6521
|
search_field_value_: search_field_value_,
|
|
6374
6522
|
updating_blocked_: updating_blocked,
|
|
6375
6523
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
6376
|
-
set_override_on_enter_fn_:
|
|
6524
|
+
set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
|
|
6377
6525
|
search_query_param_name_: search_query_url_param_name_,
|
|
6378
6526
|
url_transformer_: url_transformer_,
|
|
6379
6527
|
router_: router_
|
|
@@ -6412,11 +6560,12 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
|
|
|
6412
6560
|
},
|
|
6413
6561
|
on_previous_searches_page_: show_previous_searches_component,
|
|
6414
6562
|
i18n_: i18n_,
|
|
6563
|
+
get_content_results_: get_content_results_,
|
|
6415
6564
|
url_transformer_: url_transformer_,
|
|
6416
6565
|
searching_for_value_: searching_for_value,
|
|
6417
6566
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
6418
6567
|
selected_index_: selected_index_,
|
|
6419
|
-
suggestion_memo_:
|
|
6568
|
+
suggestion_memo_: read_suggestion_signal_,
|
|
6420
6569
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
6421
6570
|
include_category_suggestions_: include_category_suggestions_,
|
|
6422
6571
|
router_: router_,
|
|
@@ -6516,7 +6665,8 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
6516
6665
|
bottom_distance_under_modal_: bottom_distance_under_modal_,
|
|
6517
6666
|
selected_text_range_: selected_text_range_,
|
|
6518
6667
|
dont_sync_search_field_value_except_on_submit_ = false,
|
|
6519
|
-
router_: router_
|
|
6668
|
+
router_: router_,
|
|
6669
|
+
content_search_enabled_: content_search_enabled_
|
|
6520
6670
|
}) {
|
|
6521
6671
|
let on_enter_in_search_field_function;
|
|
6522
6672
|
// 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.
|
|
@@ -6533,30 +6683,23 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
6533
6683
|
};
|
|
6534
6684
|
const [input_field, set_input_field] = (0, $5vyXB$solidjs.createSignal)();
|
|
6535
6685
|
const [get_search_field_value_] = search_field_value_;
|
|
6536
|
-
const [
|
|
6537
|
-
const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $5vyXB$solidjs.createSignal)();
|
|
6686
|
+
const [get_modal_search_results, set_modal_search_results_] = (0, $5vyXB$solidjs.createSignal)();
|
|
6538
6687
|
const close_on_escape_handler = (0, $5vyXB$depictaiutilishared.catchify)(({
|
|
6539
6688
|
key: key
|
|
6540
6689
|
}) => {
|
|
6541
6690
|
if (key === "Escape") close_modal_();
|
|
6542
6691
|
});
|
|
6543
|
-
const [
|
|
6692
|
+
const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $5vyXB$solidjs.createSignal)();
|
|
6544
6693
|
const selected_index = (0, $5vyXB$solidjs.createSignal)();
|
|
6545
6694
|
const currently_showing_suggestions_ = (0, $5vyXB$solidjs.createSignal)([], {
|
|
6546
6695
|
equals: false
|
|
6547
6696
|
});
|
|
6697
|
+
const less_than_700_high = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height:700px)");
|
|
6698
|
+
const DiscoverMoreSection = () => (0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), get_search_field_value_() ? (0, $5vyXB$solidjsweb.escape)(i18n_.modal_view_all_results_()((0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(get_total_num_results_accessor?.())))) : (0, $5vyXB$solidjsweb.escape)(i18n_.modal_discover_more_()));
|
|
6548
6699
|
if (disable_scrolling_) (0, $ca1176b694a6ee2e$export$fe334901e8bebd57)();
|
|
6549
6700
|
$f40a47a30a358305$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
|
|
6550
6701
|
window.addEventListener("keydown", close_on_escape_handler);
|
|
6551
6702
|
(0, $5vyXB$solidjs.onCleanup)((0, $5vyXB$depictaiutilishared.catchify)(() => window.removeEventListener("keydown", close_on_escape_handler)));
|
|
6552
|
-
const owner = (0, $5vyXB$solidjs.getOwner)();
|
|
6553
|
-
(0, $5vyXB$solidjs.onCleanup)((0, $5vyXB$depictaiutilishared.javascript_media_query)("(max-height:700px)", ({
|
|
6554
|
-
matches: matches
|
|
6555
|
-
}) => (0, $5vyXB$solidjs.runWithOwner)(owner, () => {
|
|
6556
|
-
// the if below is reactive so we need an owner
|
|
6557
|
-
(matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
|
|
6558
|
-
(matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), get_search_field_value_() ? (0, $5vyXB$solidjsweb.escape)(i18n_.modal_view_all_results_()((0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(get_num_results_accessor?.())))) : (0, $5vyXB$solidjsweb.escape)(i18n_.modal_discover_more_())));
|
|
6559
|
-
})).remove);
|
|
6560
6703
|
if (closing_animation_) register_closing_animation_(closing_animation_);
|
|
6561
6704
|
(0, $036d367ce3058351$export$3340fdd8259bd4fd)({
|
|
6562
6705
|
get_search_field_value_: get_search_field_value_,
|
|
@@ -6615,7 +6758,9 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
6615
6758
|
i18n_: i18n_,
|
|
6616
6759
|
include_category_suggestions_: enable_category_suggestions_ ?? true,
|
|
6617
6760
|
router_: router_,
|
|
6618
|
-
submit_query_: submit_query_
|
|
6761
|
+
submit_query_: submit_query_,
|
|
6762
|
+
get_modal_search_results_: get_modal_search_results,
|
|
6763
|
+
content_search_enabled_: content_search_enabled_
|
|
6619
6764
|
});
|
|
6620
6765
|
}
|
|
6621
6766
|
})), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
@@ -6628,12 +6773,28 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
|
|
|
6628
6773
|
tenant_: tenant_,
|
|
6629
6774
|
i18n_: i18n_,
|
|
6630
6775
|
market_: market_,
|
|
6631
|
-
|
|
6776
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
6632
6777
|
router_: router_,
|
|
6778
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
6779
|
+
content_search_enabled_: content_search_enabled_,
|
|
6633
6780
|
...instant_results_options_
|
|
6634
6781
|
});
|
|
6635
6782
|
}
|
|
6636
|
-
})), (0, $5vyXB$solidjsweb.escape)(
|
|
6783
|
+
})), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6784
|
+
get when() {
|
|
6785
|
+
return less_than_700_high();
|
|
6786
|
+
},
|
|
6787
|
+
get children() {
|
|
6788
|
+
return (0, $5vyXB$solidjsweb.createComponent)(DiscoverMoreSection, {});
|
|
6789
|
+
}
|
|
6790
|
+
})), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6791
|
+
get when() {
|
|
6792
|
+
return !less_than_700_high();
|
|
6793
|
+
},
|
|
6794
|
+
get children() {
|
|
6795
|
+
return (0, $5vyXB$solidjsweb.createComponent)(DiscoverMoreSection, {});
|
|
6796
|
+
}
|
|
6797
|
+
})), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $b776f25acdda22eb$export$f021bdedd3ec901a), {
|
|
6637
6798
|
styles: body_style
|
|
6638
6799
|
})));
|
|
6639
6800
|
return [(0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$4, (0, $5vyXB$solidjsweb.ssrHydrationKey)() + (0, $5vyXB$solidjsweb.ssrAttribute)("id", (0, $5vyXB$solidjsweb.escape)((0, $0b6e2070a98de347$export$44dad306455dddf).SEARCH_MODAL, true), false), `depict plp search ${(0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.ssrClassList)(class_list_?.()), true) || ""}`, (0, $5vyXB$solidjsweb.escape)(modal_element))];
|
|
@@ -6705,14 +6866,21 @@ const $65a0c4b1c2eb5d0b$var$_tmpl$ = ["<b", ">", "</b>"],
|
|
|
6705
6866
|
function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({
|
|
6706
6867
|
get_search_query_: get_search_query_,
|
|
6707
6868
|
i18n_: i18n_,
|
|
6708
|
-
formatted_number_of_results_: formatted_number_of_results_
|
|
6869
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
6870
|
+
number_of_results_: number_of_results_,
|
|
6871
|
+
type: type
|
|
6709
6872
|
}) {
|
|
6710
6873
|
const contents = (0, $5vyXB$solidjs.createMemo)((0, $5vyXB$depictaiutilishared.catchify)(() => {
|
|
6711
6874
|
const q = get_search_query_();
|
|
6712
|
-
return i18n_.get_showing_results_for_()((0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(q)), (0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(formatted_number_of_results_())));
|
|
6875
|
+
return i18n_[type === $65a0c4b1c2eb5d0b$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(q)), (0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(formatted_number_of_results_())), !!q, number_of_results_());
|
|
6713
6876
|
}));
|
|
6714
6877
|
return (0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(contents()));
|
|
6715
6878
|
}
|
|
6879
|
+
let $65a0c4b1c2eb5d0b$export$2452208c79fe93ea;
|
|
6880
|
+
(function (ShowingResultsForType) {
|
|
6881
|
+
ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
|
|
6882
|
+
ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
|
|
6883
|
+
})($65a0c4b1c2eb5d0b$export$2452208c79fe93ea || ($65a0c4b1c2eb5d0b$export$2452208c79fe93ea = {}));
|
|
6716
6884
|
function $2005eec80e40088f$export$41b4894022a3580f({
|
|
6717
6885
|
style_props_ = (0, $5vyXB$solidjs.createSignal)({})
|
|
6718
6886
|
} = {}) {
|
|
@@ -6731,8 +6899,429 @@ function $2005eec80e40088f$export$41b4894022a3580f({
|
|
|
6731
6899
|
})));
|
|
6732
6900
|
return style_props_;
|
|
6733
6901
|
}
|
|
6902
|
+
const $5ea5a82e398f6f44$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
|
|
6903
|
+
const $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters = 30;
|
|
6904
|
+
function $5ea5a82e398f6f44$export$e1a98a189fd2c0e7({
|
|
6905
|
+
content_result_: content_result_,
|
|
6906
|
+
key_: key_,
|
|
6907
|
+
cut_when_possible_: cut_when_possible_
|
|
6908
|
+
}) {
|
|
6909
|
+
const matched_tokens = (0, $5vyXB$solidjs.createMemo)(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
|
|
6910
|
+
const full_value = (0, $5vyXB$solidjs.createMemo)(() => content_result_()[key_]?.replaceAll("\n", " "));
|
|
6911
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6912
|
+
get when() {
|
|
6913
|
+
return matched_tokens()?.length;
|
|
6914
|
+
},
|
|
6915
|
+
get fallback() {
|
|
6916
|
+
return full_value();
|
|
6917
|
+
},
|
|
6918
|
+
get children() {
|
|
6919
|
+
return (() => {
|
|
6920
|
+
const segmented_cut_text = (0, $5vyXB$solidjs.createMemo)(() => {
|
|
6921
|
+
const segmented_text = $5ea5a82e398f6f44$var$segment_text(full_value(), matched_tokens());
|
|
6922
|
+
if (cut_when_possible_) $5ea5a82e398f6f44$var$cut_text(segmented_text);
|
|
6923
|
+
return segmented_text;
|
|
6924
|
+
});
|
|
6925
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Index), {
|
|
6926
|
+
get each() {
|
|
6927
|
+
return segmented_cut_text();
|
|
6928
|
+
},
|
|
6929
|
+
children: item => {
|
|
6930
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6931
|
+
get when() {
|
|
6932
|
+
return item().highlighted_;
|
|
6933
|
+
},
|
|
6934
|
+
get fallback() {
|
|
6935
|
+
return item().text_;
|
|
6936
|
+
},
|
|
6937
|
+
get children() {
|
|
6938
|
+
return (0, $5vyXB$solidjsweb.ssr)($5ea5a82e398f6f44$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(item().text_));
|
|
6939
|
+
}
|
|
6940
|
+
});
|
|
6941
|
+
}
|
|
6942
|
+
});
|
|
6943
|
+
})();
|
|
6944
|
+
}
|
|
6945
|
+
});
|
|
6946
|
+
}
|
|
6947
|
+
function $5ea5a82e398f6f44$var$cut_text(segmented_text) {
|
|
6948
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
6949
|
+
const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
|
|
6950
|
+
if (!segmented_text || !highlighted_segments?.length) return;
|
|
6951
|
+
// We have one or more highlighted segments
|
|
6952
|
+
if (highlighted_segments.length === 1) {
|
|
6953
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
6954
|
+
$5ea5a82e398f6f44$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
6955
|
+
return;
|
|
6956
|
+
}
|
|
6957
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
6958
|
+
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
|
|
6959
|
+
);
|
|
6960
|
+
|
|
6961
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
6962
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
6963
|
+
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);
|
|
6964
|
+
$5ea5a82e398f6f44$var$cut_start(index_of_first_segment, segmented_text);
|
|
6965
|
+
// update indexes since we might have removed segments
|
|
6966
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
6967
|
+
let number_of_characters_between_segments = 0;
|
|
6968
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
6969
|
+
const segment = segmented_text[i];
|
|
6970
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
6971
|
+
}
|
|
6972
|
+
if (number_of_characters_between_segments < $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters)
|
|
6973
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
6974
|
+
return;
|
|
6975
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
6976
|
+
const [split_start_segment, split_start_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
6977
|
+
const [split_end_segment, split_end_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
6978
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
6979
|
+
// identical split point, or split end before split start, can't do anything
|
|
6980
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
6981
|
+
const dots_segment = {
|
|
6982
|
+
text_: " … ",
|
|
6983
|
+
highlighted_: false
|
|
6984
|
+
};
|
|
6985
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
6986
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
6987
|
+
const text = segment.text_;
|
|
6988
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
6989
|
+
...segment,
|
|
6990
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
6991
|
+
}, dots_segment, {
|
|
6992
|
+
...segment,
|
|
6993
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
6994
|
+
}];else if (i == split_start_segment) {
|
|
6995
|
+
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
|
|
6996
|
+
return segment;
|
|
6997
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
6998
|
+
...segment,
|
|
6999
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
7000
|
+
}];
|
|
7001
|
+
return []; // remove all segments inbetween
|
|
7002
|
+
});
|
|
7003
|
+
|
|
7004
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
7005
|
+
$5ea5a82e398f6f44$var$heal_holes(segmented_text);
|
|
7006
|
+
}
|
|
7007
|
+
function $5ea5a82e398f6f44$var$heal_holes(segmented_text) {
|
|
7008
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
7009
|
+
const segments_to_delete = new Set();
|
|
7010
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
7011
|
+
const segment = segmented_text[i];
|
|
7012
|
+
let previous_segment;
|
|
7013
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
7014
|
+
previous_segment = segmented_text[j];
|
|
7015
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
7016
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
7017
|
+
}
|
|
7018
|
+
if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
|
|
7019
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
7020
|
+
segments_to_delete.add(segment);
|
|
7021
|
+
}
|
|
7022
|
+
}
|
|
7023
|
+
for (const segment of segments_to_delete) {
|
|
7024
|
+
const index = segmented_text.indexOf(segment);
|
|
7025
|
+
segmented_text.splice(index, 1);
|
|
7026
|
+
}
|
|
7027
|
+
}
|
|
7028
|
+
function $5ea5a82e398f6f44$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
|
|
7029
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
7030
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
7031
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
7032
|
+
while (desperate_split_attempts.length) {
|
|
7033
|
+
const split_point_between_words = [];
|
|
7034
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
7035
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
7036
|
+
let is_first_character = true;
|
|
7037
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
7038
|
+
const segment = segmented_text[i];
|
|
7039
|
+
const text = segment.text_;
|
|
7040
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
7041
|
+
const character = text[j];
|
|
7042
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
7043
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
7044
|
+
split_point_between_words.push([i, j]);
|
|
7045
|
+
if (split_point_between_words.length > 3)
|
|
7046
|
+
// We can't find a split point, so we'll just split between words
|
|
7047
|
+
// 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
|
|
7048
|
+
return split_point_between_words[1];
|
|
7049
|
+
}
|
|
7050
|
+
}
|
|
7051
|
+
}
|
|
7052
|
+
}
|
|
7053
|
+
return [];
|
|
7054
|
+
}
|
|
7055
|
+
function $5ea5a82e398f6f44$var$cut_start(cut_left_of_index, segmented_text) {
|
|
7056
|
+
// Cut the start of the text to bring the first matching token
|
|
7057
|
+
let is_first_character = false;
|
|
7058
|
+
let words_encountered = 0;
|
|
7059
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
7060
|
+
const segment = segmented_text[i];
|
|
7061
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
7062
|
+
const text = segment.text_;
|
|
7063
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
7064
|
+
const character = text[j];
|
|
7065
|
+
const is_space = character == " ";
|
|
7066
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
7067
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
7068
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
7069
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
7070
|
+
segmented_text.splice(0, i);
|
|
7071
|
+
if (character === "," || is_space)
|
|
7072
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
7073
|
+
segmented_text.unshift({
|
|
7074
|
+
text_: "… ",
|
|
7075
|
+
highlighted_: false
|
|
7076
|
+
});
|
|
7077
|
+
break outmost_loop;
|
|
7078
|
+
}
|
|
7079
|
+
if (is_first_character) is_first_character = false;
|
|
7080
|
+
}
|
|
7081
|
+
}
|
|
7082
|
+
$5ea5a82e398f6f44$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
7083
|
+
}
|
|
7084
|
+
|
|
7085
|
+
function $5ea5a82e398f6f44$var$segment_text(text, matched_strings) {
|
|
7086
|
+
// segment text where the matched strings are highlighted sections
|
|
7087
|
+
const output = [];
|
|
7088
|
+
if (!text) return; // shouldn't happen but whatever
|
|
7089
|
+
for (let i = 0; i < text.length; i++) {
|
|
7090
|
+
const found_strings = [];
|
|
7091
|
+
if (!i || text[i - 1] == " ")
|
|
7092
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
7093
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
7094
|
+
const matched_string = matched_strings[j];
|
|
7095
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
7096
|
+
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
7097
|
+
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
|
|
7098
|
+
}
|
|
7099
|
+
|
|
7100
|
+
const last_index_in_output = output.length - 1;
|
|
7101
|
+
if (!found_strings.length) {
|
|
7102
|
+
const character = text[i];
|
|
7103
|
+
if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
|
|
7104
|
+
// 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
|
|
7105
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
7106
|
+
highlighted_: false,
|
|
7107
|
+
text_: character
|
|
7108
|
+
});
|
|
7109
|
+
} else {
|
|
7110
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
7111
|
+
if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
7112
|
+
highlighted_: true,
|
|
7113
|
+
text_: longest_found_string
|
|
7114
|
+
});
|
|
7115
|
+
i += longest_found_string.length - 1;
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
return output;
|
|
7119
|
+
}
|
|
7120
|
+
const $76227de40be817e5$var$_tmpl$ = ["<div", ' class="description line-clamp">', "</div>"],
|
|
7121
|
+
$76227de40be817e5$var$_tmpl$2 = ["<div", ' class="content-card"><div class="image">', '</div><div class="info"><!--#-->', "<!--/--><!--#-->", "<!--/--></div></div>"];
|
|
7122
|
+
function $76227de40be817e5$export$f631859cab12b342({
|
|
7123
|
+
router_: router_,
|
|
7124
|
+
content_result_: content_result_
|
|
7125
|
+
}) {
|
|
7126
|
+
const make_link_attributes = () => {
|
|
7127
|
+
const result = content_result_?.();
|
|
7128
|
+
if (!result) return;
|
|
7129
|
+
return {
|
|
7130
|
+
href: result.page_url,
|
|
7131
|
+
onClick: (0, $5vyXB$depictaiutilishared.catchify)(ev => router_.navigate_.go_to_({
|
|
7132
|
+
new_url_: result.page_url,
|
|
7133
|
+
is_replace_: false,
|
|
7134
|
+
event_: ev
|
|
7135
|
+
}))
|
|
7136
|
+
};
|
|
7137
|
+
};
|
|
7138
|
+
const LinkIfPossible = ({
|
|
7139
|
+
children: children,
|
|
7140
|
+
...attributes
|
|
7141
|
+
}) => {
|
|
7142
|
+
if (content_result_) return (0, $5vyXB$solidjsweb.ssrElement)("a", attributes, () => (0, $5vyXB$solidjsweb.escape)(children), true);
|
|
7143
|
+
return (0, $5vyXB$solidjsweb.ssrElement)("div", attributes, () => (0, $5vyXB$solidjsweb.escape)(children), true);
|
|
7144
|
+
};
|
|
7145
|
+
return (0, $5vyXB$solidjsweb.ssr)($76227de40be817e5$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)(LinkIfPossible, (0, $5vyXB$solidjsweb.mergeProps)(make_link_attributes, {
|
|
7146
|
+
tabIndex: "-1",
|
|
7147
|
+
get children() {
|
|
7148
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $c0125412b4ea0c93$export$605674723bcc715c), {
|
|
7149
|
+
width: "28",
|
|
7150
|
+
height: "28"
|
|
7151
|
+
});
|
|
7152
|
+
}
|
|
7153
|
+
}))), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)(LinkIfPossible, (0, $5vyXB$solidjsweb.mergeProps)({
|
|
7154
|
+
"class": "content-title line-clamp"
|
|
7155
|
+
}, make_link_attributes, {
|
|
7156
|
+
get title() {
|
|
7157
|
+
return content_result_?.().title;
|
|
7158
|
+
},
|
|
7159
|
+
get children() {
|
|
7160
|
+
return content_result_ ? (0, $5vyXB$solidjsweb.createComponent)((0, $5ea5a82e398f6f44$export$e1a98a189fd2c0e7), {
|
|
7161
|
+
content_result_: content_result_,
|
|
7162
|
+
key_: "title",
|
|
7163
|
+
cut_when_possible_: false
|
|
7164
|
+
}) : (0, $5vyXB$solidjsweb.createComponent)((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
7165
|
+
height: "1em",
|
|
7166
|
+
width: "20ch"
|
|
7167
|
+
});
|
|
7168
|
+
}
|
|
7169
|
+
}))), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
7170
|
+
get when() {
|
|
7171
|
+
return content_result_?.().description || !content_result_;
|
|
7172
|
+
},
|
|
7173
|
+
get children() {
|
|
7174
|
+
return (0, $5vyXB$solidjsweb.ssr)($76227de40be817e5$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
7175
|
+
when: content_result_,
|
|
7176
|
+
get fallback() {
|
|
7177
|
+
return Array.from({
|
|
7178
|
+
length: 4
|
|
7179
|
+
}).map(() => (0, $5vyXB$solidjsweb.createComponent)((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
7180
|
+
height: "1em",
|
|
7181
|
+
width: "min(50ch, 100%)"
|
|
7182
|
+
}));
|
|
7183
|
+
},
|
|
7184
|
+
get children() {
|
|
7185
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $5ea5a82e398f6f44$export$e1a98a189fd2c0e7), {
|
|
7186
|
+
content_result_: content_result_,
|
|
7187
|
+
key_: "description",
|
|
7188
|
+
cut_when_possible_: true
|
|
7189
|
+
});
|
|
7190
|
+
}
|
|
7191
|
+
})));
|
|
7192
|
+
}
|
|
7193
|
+
})));
|
|
7194
|
+
}
|
|
7195
|
+
function $8781fcec27b20709$export$9ff751cd77687edc({
|
|
7196
|
+
search_results_: search_results_,
|
|
7197
|
+
router_: router_
|
|
7198
|
+
}) {
|
|
7199
|
+
const content_results = (0, $5vyXB$solidjs.createMemo)(() => search_results_()?.content_search_links);
|
|
7200
|
+
const content_results_by_page_url = (0, $5vyXB$solidjs.createMemo)(() => {
|
|
7201
|
+
const map = new Map();
|
|
7202
|
+
const results = content_results();
|
|
7203
|
+
if (!results) return map;
|
|
7204
|
+
for (let i = 0; i < results.length; i++) {
|
|
7205
|
+
const content_result = results[i];
|
|
7206
|
+
map.set(content_result.page_url, content_result);
|
|
7207
|
+
}
|
|
7208
|
+
return map;
|
|
7209
|
+
});
|
|
7210
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.For), {
|
|
7211
|
+
get each() {
|
|
7212
|
+
return [...content_results_by_page_url().keys()];
|
|
7213
|
+
},
|
|
7214
|
+
children: page_url => {
|
|
7215
|
+
const content_result = (0, $5vyXB$solidjs.createMemo)(() => content_results_by_page_url().get(page_url));
|
|
7216
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $76227de40be817e5$export$f631859cab12b342), {
|
|
7217
|
+
content_result_: content_result,
|
|
7218
|
+
router_: router_
|
|
7219
|
+
});
|
|
7220
|
+
}
|
|
7221
|
+
});
|
|
7222
|
+
}
|
|
7223
|
+
function $c2f92eb265a14529$export$4405d077f0a20494({
|
|
7224
|
+
content_results_rows_: [get_history_state_content_results_rows],
|
|
7225
|
+
cols_at_size_: cols_at_size_
|
|
7226
|
+
}) {
|
|
7227
|
+
const largest_column = (0, $5vyXB$solidjs.createMemo)(() => {
|
|
7228
|
+
const largest_in_cols_at_size = Math.max(...cols_at_size_().map(([cols]) => cols));
|
|
7229
|
+
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
|
|
7230
|
+
return largest_in_cols_at_size;
|
|
7231
|
+
});
|
|
7232
|
+
const num_placeholders = (0, $5vyXB$solidjs.createMemo)(() => (get_history_state_content_results_rows() ?? (0, $3716b8caf7f959e2$export$70ceae36059a1036)) * largest_column());
|
|
7233
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Index), {
|
|
7234
|
+
get each() {
|
|
7235
|
+
return Array.from({
|
|
7236
|
+
length: num_placeholders()
|
|
7237
|
+
});
|
|
7238
|
+
},
|
|
7239
|
+
children: () => (0, $5vyXB$solidjsweb.createComponent)((0, $76227de40be817e5$export$f631859cab12b342), {})
|
|
7240
|
+
});
|
|
7241
|
+
}
|
|
7242
|
+
const $3716b8caf7f959e2$var$_tmpl$ = ["<div", ' class="', '" style="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
7243
|
+
$3716b8caf7f959e2$var$_tmpl$2 = ["<button", ' class="view-more">', "</button>"],
|
|
7244
|
+
$3716b8caf7f959e2$var$_tmpl$3 = ["<button", ' class="view-less">', "</button>"];
|
|
7245
|
+
const $3716b8caf7f959e2$export$70ceae36059a1036 = 1;
|
|
7246
|
+
function $3716b8caf7f959e2$export$6d0c9c22f6652669({
|
|
7247
|
+
search_results_: search_results_,
|
|
7248
|
+
get_search_query_: get_search_query_,
|
|
7249
|
+
i18n_: i18n_,
|
|
7250
|
+
layout_options_: layout_options_,
|
|
7251
|
+
router_: router_,
|
|
7252
|
+
query_base_: query_base_,
|
|
7253
|
+
content_results_rows_: content_results_rows_
|
|
7254
|
+
}) {
|
|
7255
|
+
const content_results = (0, $5vyXB$solidjs.createMemo)(() => search_results_()?.content_search_links);
|
|
7256
|
+
const num_results = (0, $5vyXB$solidjs.createMemo)(() => content_results()?.length);
|
|
7257
|
+
const is_loading_ = (0, $5vyXB$solidjs.createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
|
|
7258
|
+
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
7259
|
+
number_: num_results,
|
|
7260
|
+
i18n_: i18n_
|
|
7261
|
+
});
|
|
7262
|
+
const [is_showing_placeholders, set_is_showing_placeholders] = (0, $5vyXB$solidjs.createSignal)(false);
|
|
7263
|
+
const rows_object = $3716b8caf7f959e2$var$make_state_saved_rows(content_results_rows_, i18n_);
|
|
7264
|
+
return (0, $5vyXB$solidjsweb.ssr)($3716b8caf7f959e2$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `content-results ${is_showing_placeholders() ? "loading" : ""}`, "display:" + (is_loading_() || content_results()?.length > 0 ? "" : "none"), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), {
|
|
7265
|
+
get_search_query_: get_search_query_,
|
|
7266
|
+
i18n_: i18n_,
|
|
7267
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
7268
|
+
get type() {
|
|
7269
|
+
return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).content;
|
|
7270
|
+
},
|
|
7271
|
+
number_of_results_: num_results
|
|
7272
|
+
})), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), (0, $5vyXB$solidjsweb.mergeProps)({
|
|
7273
|
+
layout: "grid",
|
|
7274
|
+
element_attributes: {
|
|
7275
|
+
class: "cards"
|
|
7276
|
+
}
|
|
7277
|
+
}, layout_options_, {
|
|
7278
|
+
rows: rows_object,
|
|
7279
|
+
get children() {
|
|
7280
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Suspense), {
|
|
7281
|
+
get fallback() {
|
|
7282
|
+
return (() => {
|
|
7283
|
+
set_is_showing_placeholders(true);
|
|
7284
|
+
(0, $5vyXB$solidjs.onCleanup)(() => set_is_showing_placeholders(false));
|
|
7285
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $c2f92eb265a14529$export$4405d077f0a20494), {
|
|
7286
|
+
content_results_rows_: content_results_rows_,
|
|
7287
|
+
get cols_at_size_() {
|
|
7288
|
+
return (0, $5vyXB$solidjs.createMemo)(() => layout_options_().cols_at_size);
|
|
7289
|
+
}
|
|
7290
|
+
});
|
|
7291
|
+
})();
|
|
7292
|
+
},
|
|
7293
|
+
get children() {
|
|
7294
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $8781fcec27b20709$export$9ff751cd77687edc), {
|
|
7295
|
+
router_: router_,
|
|
7296
|
+
search_results_: search_results_
|
|
7297
|
+
});
|
|
7298
|
+
}
|
|
7299
|
+
});
|
|
7300
|
+
}
|
|
7301
|
+
}))));
|
|
7302
|
+
}
|
|
7303
|
+
function $3716b8caf7f959e2$var$make_state_saved_rows(
|
|
7304
|
+
// similar to the one in SearchRecommendations.tsx but not enough to warrant a shared function IMO
|
|
7305
|
+
[get_showing_content_results_rows, set_showing_content_results_rows], i18n_) {
|
|
7306
|
+
const currently_visible = (0, $5vyXB$solidjs.createSignal)((0, $5vyXB$solidjs.untrack)(get_showing_content_results_rows));
|
|
7307
|
+
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
7308
|
+
const rows = {
|
|
7309
|
+
currently_visible: currently_visible,
|
|
7310
|
+
start_rows: $3716b8caf7f959e2$export$70ceae36059a1036,
|
|
7311
|
+
button: (0, $5vyXB$solidjsweb.ssr)($3716b8caf7f959e2$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.view_more_())),
|
|
7312
|
+
view_less_button: (0, $5vyXB$solidjsweb.ssr)($3716b8caf7f959e2$var$_tmpl$3, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.view_less_())),
|
|
7313
|
+
rows_per_click: 3
|
|
7314
|
+
};
|
|
7315
|
+
(0, $5vyXB$solidjs.createComputed)((0, $5vyXB$solidjs.on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
|
|
7316
|
+
defer: true
|
|
7317
|
+
}));
|
|
7318
|
+
(0, $5vyXB$solidjs.createComputed)((0, $5vyXB$solidjs.on)(get_showing_content_results_rows, (new_rows = $3716b8caf7f959e2$export$70ceae36059a1036) => set_currently_visible(new_rows), {
|
|
7319
|
+
defer: true
|
|
7320
|
+
}));
|
|
7321
|
+
return rows;
|
|
7322
|
+
}
|
|
6734
7323
|
const $f1d7cb69f839a526$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
6735
|
-
$f1d7cb69f839a526$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
|
|
7324
|
+
$f1d7cb69f839a526$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
|
|
6736
7325
|
function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
6737
7326
|
depict_api_: depict_api_,
|
|
6738
7327
|
search_field_value_: search_field_value_,
|
|
@@ -6761,7 +7350,11 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
6761
7350
|
recommendations_layout_options_: recommendations_layout_options_,
|
|
6762
7351
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
6763
7352
|
product_card_template_: product_card_template_,
|
|
6764
|
-
modal_body_style_ref_: modal_body_style_ref_
|
|
7353
|
+
modal_body_style_ref_: modal_body_style_ref_,
|
|
7354
|
+
router_: router_,
|
|
7355
|
+
content_results_rows_: content_results_rows_,
|
|
7356
|
+
content_layout_options_: content_layout_options_,
|
|
7357
|
+
content_search_enabled_: content_search_enabled_
|
|
6765
7358
|
}) {
|
|
6766
7359
|
const [get_sorting] = current_sorting_;
|
|
6767
7360
|
const all_products_loaded_ = (0, $5vyXB$solidjs.createSignal)(false);
|
|
@@ -6819,16 +7412,23 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
6819
7412
|
const SafeSearchField = (0, $5vyXB$depictaiutilishared.catchify)((0, $66b8b9a9613c141d$export$b94867ecbd698f21));
|
|
6820
7413
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $5vyXB$solidjs.createSignal)(false);
|
|
6821
7414
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $5vyXB$solidjs.createSignal)();
|
|
7415
|
+
const n_hits = (0, $5vyXB$solidjs.createMemo)(() => search_results_()?.n_hits);
|
|
6822
7416
|
const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
|
|
6823
|
-
|
|
7417
|
+
number_: n_hits,
|
|
6824
7418
|
i18n_: i18n_
|
|
6825
7419
|
});
|
|
6826
7420
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $5vyXB$solidjs.createSignal)();
|
|
6827
|
-
const
|
|
7421
|
+
const no_results_text_ = (0, $5vyXB$solidjs.createMemo)(() => (search_results_()?.content_search_links?.length ? i18n_.no_products_ : i18n_.no_results_text_)());
|
|
7422
|
+
const results_for = (0, $5vyXB$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), (0, $5vyXB$solidjsweb.mergeProps)({
|
|
7423
|
+
get type() {
|
|
7424
|
+
return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).products;
|
|
7425
|
+
},
|
|
7426
|
+
number_of_results_: n_hits
|
|
7427
|
+
}, {
|
|
6828
7428
|
get_search_query_: get_search_query_,
|
|
6829
7429
|
i18n_: i18n_,
|
|
6830
7430
|
formatted_number_of_results_: formatted_number_of_results_
|
|
6831
|
-
});
|
|
7431
|
+
}));
|
|
6832
7432
|
const filters_opener = (0, $f8f64d05c525825b$export$d7841e452f2e59a8)({
|
|
6833
7433
|
set_sort_or_filter_open_: set_sort_or_filter_open_,
|
|
6834
7434
|
set_extra_els_in_results_container_: set_desktop_filter_elements,
|
|
@@ -6931,7 +7531,28 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
6931
7531
|
children: make_category_suggestion_card_
|
|
6932
7532
|
});
|
|
6933
7533
|
}
|
|
6934
|
-
})) : (0, $5vyXB$solidjsweb.escape)(null), (0, $5vyXB$solidjsweb.escape)(
|
|
7534
|
+
})) : (0, $5vyXB$solidjsweb.escape)(null), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
7535
|
+
severity_: "error",
|
|
7536
|
+
message_: "ContentResults failed",
|
|
7537
|
+
get children() {
|
|
7538
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
7539
|
+
get when() {
|
|
7540
|
+
return content_search_enabled_();
|
|
7541
|
+
},
|
|
7542
|
+
get children() {
|
|
7543
|
+
return (0, $5vyXB$solidjsweb.createComponent)((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
|
|
7544
|
+
content_results_rows_: content_results_rows_,
|
|
7545
|
+
search_results_: search_results_,
|
|
7546
|
+
i18n_: i18n_,
|
|
7547
|
+
get_search_query_: get_search_query_,
|
|
7548
|
+
layout_options_: content_layout_options_,
|
|
7549
|
+
router_: router_,
|
|
7550
|
+
query_base_: search_query_base_
|
|
7551
|
+
});
|
|
7552
|
+
}
|
|
7553
|
+
});
|
|
7554
|
+
}
|
|
7555
|
+
})), (0, $5vyXB$solidjsweb.escape)(results_filters[0]()), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
|
|
6935
7556
|
get when() {
|
|
6936
7557
|
return selected_filters_[0]()?.length;
|
|
6937
7558
|
},
|
|
@@ -6975,7 +7596,10 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
6975
7596
|
selected_filters_: selected_filters_,
|
|
6976
7597
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
6977
7598
|
local_filter_cache_: local_filter_cache_,
|
|
6978
|
-
i18n_:
|
|
7599
|
+
i18n_: {
|
|
7600
|
+
...i18n_,
|
|
7601
|
+
no_results_text_: no_results_text_
|
|
7602
|
+
}
|
|
6979
7603
|
}
|
|
6980
7604
|
});
|
|
6981
7605
|
}
|
|
@@ -7049,6 +7673,27 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
|
|
|
7049
7673
|
cleanup: cleanup
|
|
7050
7674
|
};
|
|
7051
7675
|
}
|
|
7676
|
+
|
|
7677
|
+
/**
|
|
7678
|
+
* 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
|
|
7679
|
+
*/
|
|
7680
|
+
function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
7681
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
7682
|
+
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
7683
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
7684
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
7685
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
7686
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
7687
|
+
const to_delete = [];
|
|
7688
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
7689
|
+
const [, max_width] = sorted_sizes[i];
|
|
7690
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
7691
|
+
to_delete.push(i);
|
|
7692
|
+
}
|
|
7693
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
7694
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
7695
|
+
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
7696
|
+
}
|
|
7052
7697
|
const $2c61e4cd8229c49a$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
|
|
7053
7698
|
// 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
|
|
7054
7699
|
/**
|
|
@@ -7058,6 +7703,7 @@ const $2c61e4cd8229c49a$var$_tmpl$ = ["<div", ' class="depict plp search">', "</
|
|
|
7058
7703
|
* 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.
|
|
7059
7704
|
*/
|
|
7060
7705
|
const $2c61e4cd8229c49a$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
|
|
7706
|
+
const $2c61e4cd8229c49a$var$content_search_default = false;
|
|
7061
7707
|
const $2c61e4cd8229c49a$var$min_products_to_fetch_ = 20;
|
|
7062
7708
|
const $2c61e4cd8229c49a$export$bde3eb976dfded9 = depict_search => $2c61e4cd8229c49a$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
|
|
7063
7709
|
class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
@@ -7065,6 +7711,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
7065
7711
|
#merchant_signal = (0, $5vyXB$solidjs.createSignal)();
|
|
7066
7712
|
#market_signal = (0, $5vyXB$solidjs.createSignal)();
|
|
7067
7713
|
#modal_open_signal = (0, $5vyXB$solidjs.createSignal)(false);
|
|
7714
|
+
#content_search_signal = (0, $5vyXB$solidjs.createSignal)();
|
|
7068
7715
|
static #keys_constructed_with = new Set();
|
|
7069
7716
|
#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
|
|
7070
7717
|
constructor({
|
|
@@ -7074,9 +7721,10 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
7074
7721
|
on_navigation: on_navigation,
|
|
7075
7722
|
enable_category_suggestions = true,
|
|
7076
7723
|
page_url_creator: page_url_creator,
|
|
7724
|
+
display_transformers: display_transformers,
|
|
7725
|
+
api: api,
|
|
7077
7726
|
// Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
7078
7727
|
disable_scrolling_during_modal = true,
|
|
7079
|
-
api: api,
|
|
7080
7728
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
7081
7729
|
render_instant_card: render_instant_card,
|
|
7082
7730
|
...props_on_class
|
|
@@ -7110,6 +7758,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
7110
7758
|
local_filter_cache: [],
|
|
7111
7759
|
expanded_hierarchical_filters: [],
|
|
7112
7760
|
showing_recommendation_rows: (0, $fb29c6201c369e39$export$1c8c715550dc689d),
|
|
7761
|
+
content_results_rows: (0, $3716b8caf7f959e2$export$70ceae36059a1036),
|
|
7113
7762
|
scroll_restoration_data: []
|
|
7114
7763
|
}),
|
|
7115
7764
|
router_: this.#router,
|
|
@@ -7120,12 +7769,18 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
7120
7769
|
const get_search_query_ = (0, $5vyXB$solidjs.createMemo)(previous_value => {
|
|
7121
7770
|
if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
|
|
7122
7771
|
});
|
|
7772
|
+
// @ts-ignore
|
|
7123
7773
|
const depict_api_ = api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)({
|
|
7124
|
-
page_url_creator: page_url_creator
|
|
7774
|
+
page_url_creator: page_url_creator,
|
|
7775
|
+
display_transformers: display_transformers
|
|
7125
7776
|
});
|
|
7126
7777
|
const previous_searches = (0, $2b7a005a65221045$export$84bba84a7b837187)(get_search_query_);
|
|
7127
7778
|
const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
|
|
7128
|
-
const
|
|
7779
|
+
const [, set_search_content_results_rows] = state_.content_results_rows;
|
|
7780
|
+
const after_submit_ = () => {
|
|
7781
|
+
set_search_showing_recommendation_rows((0, $fb29c6201c369e39$export$1c8c715550dc689d));
|
|
7782
|
+
set_search_content_results_rows((0, $3716b8caf7f959e2$export$70ceae36059a1036));
|
|
7783
|
+
}; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
7129
7784
|
const on_submit_with_unchanged_value_ = () => this.modal_open = false;
|
|
7130
7785
|
const [get_search_field_value_, set_search_field_value_] = state_.field_value;
|
|
7131
7786
|
const configured_submit_query_ = new_query => (0, $f328bd45f8ede33c$export$e16630ecb9644a1c)({
|
|
@@ -7183,6 +7838,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
7183
7838
|
submit_query_: configured_submit_query_,
|
|
7184
7839
|
url_transformer_: url_transformer,
|
|
7185
7840
|
router_: this.#router,
|
|
7841
|
+
content_search_enabled_: () => this.#content_search_signal[0]() ?? $2c61e4cd8229c49a$var$content_search_default,
|
|
7186
7842
|
instant_results_options_: {
|
|
7187
7843
|
min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
|
|
7188
7844
|
render_instant_card_: render_instant_card,
|
|
@@ -7247,6 +7903,12 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
7247
7903
|
(0, $5vyXB$solidjs.onCleanup)(() => $2c61e4cd8229c49a$export$ac6237957a15b3f0.#keys_constructed_with.delete(unique_instance_key_for_state));
|
|
7248
7904
|
});
|
|
7249
7905
|
}
|
|
7906
|
+
get enable_content_search() {
|
|
7907
|
+
return this.#content_search_signal[0]();
|
|
7908
|
+
}
|
|
7909
|
+
set enable_content_search(new_state) {
|
|
7910
|
+
this.#content_search_signal[1](new_state);
|
|
7911
|
+
}
|
|
7250
7912
|
get on_navigation() {
|
|
7251
7913
|
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
7252
7914
|
return this.#router.on_navigation_;
|
|
@@ -7328,6 +7990,7 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
7328
7990
|
depict_api_: shared_properties.depict_api_,
|
|
7329
7991
|
min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
|
|
7330
7992
|
local_filter_cache_: state_.local_filter_cache,
|
|
7993
|
+
content_search_enabled_: () => depict_search.enable_content_search ?? $2c61e4cd8229c49a$var$content_search_default,
|
|
7331
7994
|
search_field_value_: state_.field_value,
|
|
7332
7995
|
get_search_query_: shared_properties.get_search_query_,
|
|
7333
7996
|
clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
|
|
@@ -7354,6 +8017,8 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
7354
8017
|
search_filters_open_: state_.filters_open,
|
|
7355
8018
|
search_sorting_open_: state_.sorting_open,
|
|
7356
8019
|
expanded_filters_: state_.expanded_filters,
|
|
8020
|
+
content_results_rows_: state_.content_results_rows,
|
|
8021
|
+
router_: shared_properties.router_,
|
|
7357
8022
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
7358
8023
|
return (0, $dae23104ba8bb78c$export$d757d54550ebfb3d)({
|
|
7359
8024
|
category_suggestion_: category_suggestion_,
|
|
@@ -7369,6 +8034,10 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
7369
8034
|
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(props.cols_at_size),
|
|
7370
8035
|
...grid_spacing_override()
|
|
7371
8036
|
})),
|
|
8037
|
+
content_layout_options_: (0, $5vyXB$solidjs.createMemo)(() => ({
|
|
8038
|
+
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)((0, $ab7c6c7911bae2f5$export$ff7109b9b2b206ba)(props.cols_at_size)),
|
|
8039
|
+
...grid_spacing_override()
|
|
8040
|
+
})),
|
|
7372
8041
|
recommendations_layout_options_: (0, $5vyXB$solidjs.createMemo)(() => {
|
|
7373
8042
|
const {
|
|
7374
8043
|
extra_depict_options: extra_depict_options
|