@depict-ai/ui 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +1041 -220
- package/ES10/index.d.ts +105 -24
- package/ES10/index.js +1041 -220
- package/latest/index.cjs +939 -188
- package/latest/index.d.ts +105 -24
- package/latest/index.js +939 -188
- package/locales/ES10/index.cjs +128 -26
- package/locales/ES10/index.d.ts +4 -1
- package/locales/ES10/index.js +128 -26
- package/locales/latest/index.cjs +128 -26
- package/locales/latest/index.d.ts +4 -1
- package/locales/latest/index.js +128 -26
- package/package.json +4 -4
- package/server/ES10/index.cjs +876 -148
- package/server/ES10/index.d.ts +105 -24
- package/server/ES10/index.js +876 -148
- package/server/latest/index.cjs +783 -122
- package/server/latest/index.d.ts +105 -24
- package/server/latest/index.js +783 -122
package/server/ES10/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
|
|
|
8
8
|
/*! Depict.ai search and product listing SDK */
|
|
9
9
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
10
10
|
register_es_version("ui", "ES10");
|
|
11
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.
|
|
11
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.5";
|
|
12
12
|
function $8e8b179489080711$export$5bad61ecde080b1f() {
|
|
13
13
|
const {
|
|
14
14
|
collapse: collapse,
|
|
@@ -387,7 +387,7 @@ function $4711a82d08d2021b$export$fecbb157621501bd(_ref) {
|
|
|
387
387
|
return outmost_element;
|
|
388
388
|
}
|
|
389
389
|
const $6b73914551534ea8$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
|
|
390
|
-
$6b73914551534ea8$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text">', "</span></div><!--#-->", "<!--/--></label>"];
|
|
390
|
+
$6b73914551534ea8$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
|
|
391
391
|
const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
|
|
392
392
|
// 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
|
|
393
393
|
const count = (0, $b8hua$createMemo)(() => props.count_);
|
|
@@ -2021,9 +2021,14 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
|
|
|
2021
2021
|
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
2022
2022
|
const show_all_rows = (0, $b8hua$createMemo)(() => props.rows === "all");
|
|
2023
2023
|
const rows_or_empty_object = (0, $b8hua$createMemo)(() => show_all_rows() ? {} : props.rows);
|
|
2024
|
-
const
|
|
2025
|
-
const
|
|
2026
|
-
|
|
2024
|
+
const view_more_button_elements = (0, $cb64b315b25cfc59$export$2f0cbfbb4354bb52)((0, $b8hua$createMemo)(() => rows_or_empty_object().button));
|
|
2025
|
+
const view_less_button_elements = (0, $cb64b315b25cfc59$export$2f0cbfbb4354bb52)((0, $b8hua$createMemo)(() => rows_or_empty_object().view_less_button));
|
|
2026
|
+
const have_a_view_more_button = (0, $b8hua$createMemo)(() => {
|
|
2027
|
+
const button = view_more_button_elements();
|
|
2028
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
2029
|
+
});
|
|
2030
|
+
const have_a_view_less_button = (0, $b8hua$createMemo)(() => {
|
|
2031
|
+
const button = view_less_button_elements();
|
|
2027
2032
|
return !(!button || Array.isArray(button) && !button.length);
|
|
2028
2033
|
});
|
|
2029
2034
|
const [get_styling, set_styling] = (0, $b8hua$createSignal)();
|
|
@@ -2032,12 +2037,18 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
|
|
|
2032
2037
|
const [get_children_count, set_children_count] = (0, $b8hua$createSignal)(0);
|
|
2033
2038
|
const update_children_count = () => set_children_count(container_element.children.length);
|
|
2034
2039
|
const col_styling = (0, $b8hua$createMemo)(() => (0, $b8hua$n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
2035
|
-
const default_currently_visible_signal = (0, $b8hua$createSignal)(0)
|
|
2040
|
+
const default_currently_visible_signal = (0, $b8hua$createSignal)((0, $b8hua$untrack)(() => {
|
|
2041
|
+
var _rows_or_empty_object;
|
|
2042
|
+
return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
|
|
2043
|
+
})); // 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
|
|
2036
2044
|
const rows_visible_signal = (0, $b8hua$createMemo)(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
2037
2045
|
const get_rows_visible = (0, $b8hua$createMemo)(() => rows_visible_signal()[0]());
|
|
2038
2046
|
const set_rows_visible = (0, $b8hua$createMemo)(() => rows_visible_signal()[1]);
|
|
2039
|
-
const
|
|
2040
|
-
const
|
|
2047
|
+
const view_more_button_class = (0, $b8hua$make_random_classname)();
|
|
2048
|
+
const view_less_button_class = (0, $b8hua$make_random_classname)();
|
|
2049
|
+
const view_more_button_container = (0, $b8hua$createMemo)(() => have_a_view_more_button() && (0, $b8hua$ssr)($63f1f8dbcd07d3b0$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "load-more-container ".concat((0, $b8hua$escape)(view_more_button_class, true)), (0, $b8hua$escape)(rows_or_empty_object().button)));
|
|
2050
|
+
// 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
|
|
2051
|
+
const view_less_button_container = (0, $b8hua$createMemo)(() => have_a_view_less_button() && (0, $b8hua$ssr)($63f1f8dbcd07d3b0$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "load-less-container ".concat((0, $b8hua$escape)(view_less_button_class, true)), (0, $b8hua$escape)(rows_or_empty_object().view_less_button)));
|
|
2041
2052
|
container_element.classList.add(container_class);
|
|
2042
2053
|
(0, $b8hua$createComputed)(() => {
|
|
2043
2054
|
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
@@ -2052,10 +2063,6 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
|
|
|
2052
2063
|
set_styling(() => col_styling);
|
|
2053
2064
|
return;
|
|
2054
2065
|
}
|
|
2055
|
-
(0, $b8hua$untrack)(() => {
|
|
2056
|
-
var _rows_or_empty_object;
|
|
2057
|
-
return set_rows_visible()((_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1);
|
|
2058
|
-
});
|
|
2059
2066
|
update_children_count();
|
|
2060
2067
|
const mutation_observer = new MutationObserver((0, $b8hua$catchify)(update_children_count));
|
|
2061
2068
|
mutation_observer.observe(container_element, {
|
|
@@ -2067,30 +2074,33 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
|
|
|
2067
2074
|
() => (0, $b8hua$createMemo)(() => {
|
|
2068
2075
|
const {
|
|
2069
2076
|
rows_per_click: rows_per_click,
|
|
2070
|
-
max_rows = -1
|
|
2077
|
+
max_rows = -1,
|
|
2078
|
+
start_rows: start_rows
|
|
2071
2079
|
} = rows_or_empty_object();
|
|
2072
2080
|
const rows_visible = get_rows_visible();
|
|
2073
2081
|
const children_count = get_children_count();
|
|
2074
2082
|
return col_styling() + props.cols_at_size.map(options => {
|
|
2075
|
-
const [, min, max] = options;
|
|
2076
|
-
let
|
|
2083
|
+
const [recs_per_row, min, max] = options;
|
|
2084
|
+
let should_hide_view_more_button;
|
|
2077
2085
|
let visible_recs;
|
|
2078
2086
|
if (props.disable_partial_rows) {
|
|
2079
2087
|
visible_recs = (0, $b8hua$layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
|
|
2080
2088
|
const visible_recs_next_show_more = (0, $b8hua$layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0),
|
|
2081
2089
|
// Should this really be zero when we default rows_per_click to 1?
|
|
2082
2090
|
children_count, options);
|
|
2083
|
-
|
|
2091
|
+
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
2084
2092
|
} else {
|
|
2085
2093
|
visible_recs = (0, $b8hua$layout_get_total_rec_amount_for_row)(rows_visible, options);
|
|
2086
|
-
|
|
2094
|
+
should_hide_view_more_button = visible_recs >= children_count;
|
|
2087
2095
|
}
|
|
2088
|
-
const should_hide_button_final =
|
|
2089
|
-
|
|
2096
|
+
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
2097
|
+
// 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
|
|
2098
|
+
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;
|
|
2099
|
+
return "".concat((0, $b8hua$layout_media_query_header)(min, max), "{").concat(selector_beginning, ":nth-child(n+").concat(visible_recs + 1, "){display:none}").concat(props.layout == "slider" ? "".concat(selector_beginning, ":nth-child(n+").concat(visible_recs, "){margin-right:0}") : "").concat(should_hide_button_final ? ".depict .".concat(view_more_button_class, "{display:none!important}") : "").concat(should_hide_view_less_button ? ".depict .".concat(view_less_button_class, "{display:none!important}") : "", "}");
|
|
2090
2100
|
}).join("");
|
|
2091
2101
|
}));
|
|
2092
2102
|
});
|
|
2093
|
-
return [container_element,
|
|
2103
|
+
return [container_element, view_more_button_container(), view_less_button_container(), (0, $b8hua$ssr)($63f1f8dbcd07d3b0$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), get_styling)];
|
|
2094
2104
|
}
|
|
2095
2105
|
async function $d5f1e6a0f9117286$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
2096
2106
|
const body = await (0, $b8hua$observer).wait_for_element("body");
|
|
@@ -2282,16 +2292,17 @@ var $284849364a6ef73a$var$_get_user_id = /*#__PURE__*/new WeakMap();
|
|
|
2282
2292
|
var $284849364a6ef73a$var$_get_session_id = /*#__PURE__*/new WeakMap();
|
|
2283
2293
|
var $284849364a6ef73a$var$_guard_url_creator_length = /*#__PURE__*/new WeakSet();
|
|
2284
2294
|
var $284849364a6ef73a$var$_run_url_creator_for_suggest = /*#__PURE__*/new WeakSet();
|
|
2285
|
-
var $284849364a6ef73a$var$
|
|
2295
|
+
var $284849364a6ef73a$var$_run_display_transformers_for_rest = /*#__PURE__*/new WeakSet();
|
|
2286
2296
|
var $284849364a6ef73a$var$_cached_post_request = /*#__PURE__*/new WeakSet();
|
|
2287
2297
|
class $284849364a6ef73a$export$e015ed2f2950f2e3 {
|
|
2288
2298
|
constructor(options) {
|
|
2289
2299
|
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_cached_post_request);
|
|
2290
|
-
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$
|
|
2300
|
+
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_display_transformers_for_rest);
|
|
2291
2301
|
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_url_creator_for_suggest);
|
|
2292
2302
|
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_guard_url_creator_length);
|
|
2293
2303
|
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_get_cache_obj_for_endpoint);
|
|
2294
2304
|
(0, $b8hua$babelruntimehelpersdefineProperty)(this, "page_url_creator", void 0);
|
|
2305
|
+
(0, $b8hua$babelruntimehelpersdefineProperty)(this, "display_transformers", void 0);
|
|
2295
2306
|
$284849364a6ef73a$var$_classPrivateFieldInitSpec(this, $284849364a6ef73a$var$_supports_finalization_registry, {
|
|
2296
2307
|
writable: true,
|
|
2297
2308
|
value: typeof FinalizationRegistry === "function"
|
|
@@ -2330,12 +2341,14 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
|
|
|
2330
2341
|
get_metadata: get_metadata,
|
|
2331
2342
|
get_user_id: _get_user_id2,
|
|
2332
2343
|
get_session_id: _get_session_id2,
|
|
2333
|
-
page_url_creator:
|
|
2344
|
+
page_url_creator: _page_url_creator,
|
|
2345
|
+
display_transformers: _display_transformers
|
|
2334
2346
|
} = options !== null && options !== void 0 ? options : {};
|
|
2335
2347
|
(0, $b8hua$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_metadata, get_metadata);
|
|
2336
2348
|
(0, $b8hua$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_user_id, _get_user_id2);
|
|
2337
2349
|
(0, $b8hua$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_session_id, _get_session_id2);
|
|
2338
|
-
this.page_url_creator =
|
|
2350
|
+
this.page_url_creator = _page_url_creator;
|
|
2351
|
+
this.display_transformers = _display_transformers;
|
|
2339
2352
|
}
|
|
2340
2353
|
async suggest(input_req) {
|
|
2341
2354
|
var _classPrivateFieldGet4;
|
|
@@ -2412,14 +2425,19 @@ function $284849364a6ef73a$var$_guard_url_creator_length2(expected, received) {
|
|
|
2412
2425
|
}
|
|
2413
2426
|
}
|
|
2414
2427
|
async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, market, response) {
|
|
2415
|
-
|
|
2428
|
+
var _this$display_transfo;
|
|
2429
|
+
const page_url_creator = this.page_url_creator;
|
|
2430
|
+
const category_transformer = (_this$display_transfo = this.display_transformers) === null || _this$display_transfo === void 0 ? void 0 : _this$display_transfo.categories;
|
|
2431
|
+
if (!page_url_creator && !category_transformer) return response;
|
|
2416
2432
|
// find category suggestions, run thing with them, and then replace them
|
|
2417
2433
|
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
|
|
2418
|
-
const page_urls = await
|
|
2419
|
-
type: "categories",
|
|
2434
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2420
2435
|
market: market,
|
|
2421
2436
|
merchant: merchant,
|
|
2422
|
-
data: [...category_suggestions]
|
|
2437
|
+
data: [...category_suggestions],
|
|
2438
|
+
...(page_url_creator ? {
|
|
2439
|
+
type: "categories"
|
|
2440
|
+
} : {})
|
|
2423
2441
|
});
|
|
2424
2442
|
$284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, category_suggestions, page_urls);
|
|
2425
2443
|
while (page_urls.length)
|
|
@@ -2427,17 +2445,29 @@ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, mar
|
|
|
2427
2445
|
Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
|
|
2428
2446
|
return response;
|
|
2429
2447
|
}
|
|
2430
|
-
async function $284849364a6ef73a$var$
|
|
2431
|
-
|
|
2448
|
+
async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, input_data) {
|
|
2449
|
+
const {
|
|
2450
|
+
page_url_creator: page_url_creator,
|
|
2451
|
+
display_transformers: display_transformers
|
|
2452
|
+
} = this;
|
|
2453
|
+
if (!page_url_creator && !display_transformers) return input_data;
|
|
2454
|
+
const product_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.products;
|
|
2455
|
+
const category_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.categories;
|
|
2456
|
+
const content_result_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.contentResults;
|
|
2432
2457
|
const displays = input_data.displays;
|
|
2433
|
-
const
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2458
|
+
const {
|
|
2459
|
+
breadcrumb: breadcrumb,
|
|
2460
|
+
quick_links: quick_links,
|
|
2461
|
+
content_search_links: content_search_links
|
|
2462
|
+
} = input_data;
|
|
2463
|
+
if (displays && (page_url_creator || product_transformer)) {
|
|
2464
|
+
const page_urls = await (page_url_creator || product_transformer)({
|
|
2438
2465
|
merchant: merchant,
|
|
2439
2466
|
market: market,
|
|
2440
|
-
displays: [...input_data.displays]
|
|
2467
|
+
displays: [...input_data.displays],
|
|
2468
|
+
...(page_url_creator ? {
|
|
2469
|
+
type: "products"
|
|
2470
|
+
} : {})
|
|
2441
2471
|
});
|
|
2442
2472
|
$284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, displays, page_urls);
|
|
2443
2473
|
for (let i = 0; i < displays.length; i++) {
|
|
@@ -2455,19 +2485,30 @@ async function $284849364a6ef73a$var$_run_url_creator_for_rest2(merchant, market
|
|
|
2455
2485
|
displays[i] = new_display_or_page_url;
|
|
2456
2486
|
}
|
|
2457
2487
|
}
|
|
2458
|
-
for (const category_display_array of [breadcrumb, quick_links]) {
|
|
2488
|
+
if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
|
|
2459
2489
|
if (!category_display_array) continue;
|
|
2460
|
-
const page_urls = await
|
|
2461
|
-
type: "categories",
|
|
2490
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2462
2491
|
merchant: merchant,
|
|
2463
2492
|
market: market,
|
|
2464
|
-
data: [...category_display_array]
|
|
2493
|
+
data: [...category_display_array],
|
|
2494
|
+
...(page_url_creator ? {
|
|
2495
|
+
type: "categories"
|
|
2496
|
+
} : {})
|
|
2465
2497
|
});
|
|
2466
2498
|
$284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, category_display_array, page_urls);
|
|
2467
2499
|
for (let i = 0; i < category_display_array.length; i++)
|
|
2468
2500
|
// Copy over getters so we sneakily can make this reactive
|
|
2469
2501
|
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
2470
2502
|
}
|
|
2503
|
+
if (content_search_links !== null && content_search_links !== void 0 && content_search_links.length && content_result_transformer) {
|
|
2504
|
+
const result = await content_result_transformer({
|
|
2505
|
+
merchant: merchant,
|
|
2506
|
+
market: market,
|
|
2507
|
+
data: [...content_search_links]
|
|
2508
|
+
});
|
|
2509
|
+
$284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, content_search_links, result);
|
|
2510
|
+
input_data.content_search_links = result;
|
|
2511
|
+
}
|
|
2471
2512
|
return input_data;
|
|
2472
2513
|
}
|
|
2473
2514
|
async function $284849364a6ef73a$var$_cached_post_request2(endpoint, input_req, fallback_response) {
|
|
@@ -2495,7 +2536,7 @@ async function $284849364a6ef73a$var$_cached_post_request2(endpoint, input_req,
|
|
|
2495
2536
|
let result;
|
|
2496
2537
|
try {
|
|
2497
2538
|
const unmodified_result = await api_response.json();
|
|
2498
|
-
result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$
|
|
2539
|
+
result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_display_transformers_for_rest, $284849364a6ef73a$var$_run_display_transformers_for_rest2).call(this, input_req.tenant, input_req.market, unmodified_result);
|
|
2499
2540
|
} catch (e) {
|
|
2500
2541
|
(0, $b8hua$dwarn)("URL creator or json decoding failed", e);
|
|
2501
2542
|
break return_successfully;
|
|
@@ -2585,12 +2626,11 @@ function $9b5022ae72f56399$var$correct_range_filter_range_once(_ref3) {
|
|
|
2585
2626
|
}
|
|
2586
2627
|
function $43fbdca0f726a34b$export$92f2da32c6e7e7ee(_ref) {
|
|
2587
2628
|
let {
|
|
2588
|
-
|
|
2629
|
+
number_: number_,
|
|
2589
2630
|
i18n_: i18n_
|
|
2590
2631
|
} = _ref;
|
|
2591
2632
|
return (0, $b8hua$createMemo)(() => {
|
|
2592
|
-
|
|
2593
|
-
const n_hits = (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.n_hits;
|
|
2633
|
+
const n_hits = number_();
|
|
2594
2634
|
if (isNaN(n_hits)) return "";
|
|
2595
2635
|
const price_formatting = i18n_.price_formatting_();
|
|
2596
2636
|
return (0, $b8hua$standard_price_format)(n_hits, 0,
|
|
@@ -4811,7 +4851,10 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
4811
4851
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $b8hua$createSignal)(false);
|
|
4812
4852
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $b8hua$createSignal)();
|
|
4813
4853
|
const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
|
|
4814
|
-
|
|
4854
|
+
number_: (0, $b8hua$createMemo)(() => {
|
|
4855
|
+
var _plp_results_5;
|
|
4856
|
+
return (_plp_results_5 = plp_results_()) === null || _plp_results_5 === void 0 ? void 0 : _plp_results_5.n_hits;
|
|
4857
|
+
}),
|
|
4815
4858
|
i18n_: i18n_
|
|
4816
4859
|
});
|
|
4817
4860
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $b8hua$createSignal)();
|
|
@@ -4834,8 +4877,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
4834
4877
|
}
|
|
4835
4878
|
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
4836
4879
|
get when() {
|
|
4837
|
-
var
|
|
4838
|
-
return ((
|
|
4880
|
+
var _plp_results_6;
|
|
4881
|
+
return ((_plp_results_6 = plp_results_()) === null || _plp_results_6 === void 0 ? void 0 : _plp_results_6.n_hits) === 1;
|
|
4839
4882
|
},
|
|
4840
4883
|
get fallback() {
|
|
4841
4884
|
return i18n_.products_();
|
|
@@ -5017,8 +5060,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
5017
5060
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
5018
5061
|
i18n_: i18n_,
|
|
5019
5062
|
number_of_results_: (0, $b8hua$createMemo)(() => {
|
|
5020
|
-
var
|
|
5021
|
-
return (
|
|
5063
|
+
var _plp_results_7;
|
|
5064
|
+
return (_plp_results_7 = plp_results_()) === null || _plp_results_7 === void 0 ? void 0 : _plp_results_7.n_hits;
|
|
5022
5065
|
})
|
|
5023
5066
|
});
|
|
5024
5067
|
}
|
|
@@ -5409,7 +5452,6 @@ function $f5f54892fd0c7d9f$var$_classApplyDescriptorGet(receiver, descriptor) {
|
|
|
5409
5452
|
return descriptor.value;
|
|
5410
5453
|
}
|
|
5411
5454
|
// 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
|
|
5412
|
-
// on old displays, no page_url_creator can be specified
|
|
5413
5455
|
/**
|
|
5414
5456
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions.
|
|
5415
5457
|
* SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
@@ -5472,6 +5514,7 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
|
|
|
5472
5514
|
api: api,
|
|
5473
5515
|
on_navigation: on_navigation,
|
|
5474
5516
|
page_url_creator: page_url_creator,
|
|
5517
|
+
display_transformers: display_transformers,
|
|
5475
5518
|
unique_instance_key_for_state = "",
|
|
5476
5519
|
query_id_state_key: query_id_state_key,
|
|
5477
5520
|
...props_on_class
|
|
@@ -5540,8 +5583,10 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
|
|
|
5540
5583
|
quicklinks_signal_: (0, $b8hua$createSignal)(),
|
|
5541
5584
|
i18n_: i18n_,
|
|
5542
5585
|
reset_history_state_: reset_history_state_,
|
|
5586
|
+
// @ts-ignore
|
|
5543
5587
|
depict_api_: api !== null && api !== void 0 ? api : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)({
|
|
5544
|
-
page_url_creator: page_url_creator
|
|
5588
|
+
page_url_creator: page_url_creator,
|
|
5589
|
+
display_transformers: display_transformers
|
|
5545
5590
|
}),
|
|
5546
5591
|
router_: (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_router),
|
|
5547
5592
|
selected_filters_: selected_filters_,
|
|
@@ -6026,13 +6071,12 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
|
|
|
6026
6071
|
});
|
|
6027
6072
|
}
|
|
6028
6073
|
function $8ef6232475d44150$var$make_state_saved_rows(_ref3, i18n_) {
|
|
6029
|
-
var _untrack;
|
|
6030
6074
|
let [get_showing_recommendation_rows, set_showing_recommendation_rows] = _ref3;
|
|
6031
|
-
const currently_visible = (0, $b8hua$createSignal)(0);
|
|
6075
|
+
const currently_visible = (0, $b8hua$createSignal)((0, $b8hua$untrack)(get_showing_recommendation_rows));
|
|
6032
6076
|
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
6033
6077
|
const rows = {
|
|
6034
6078
|
currently_visible: currently_visible,
|
|
6035
|
-
start_rows:
|
|
6079
|
+
start_rows: $8ef6232475d44150$export$1c8c715550dc689d,
|
|
6036
6080
|
rows_per_click: 3,
|
|
6037
6081
|
button: (0, $b8hua$ssr)($8ef6232475d44150$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.view_more_()))
|
|
6038
6082
|
};
|
|
@@ -6201,7 +6245,7 @@ const $b65f93acbf91da56$export$27b710c08412a7ad = obj => {
|
|
|
6201
6245
|
return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
|
|
6202
6246
|
};
|
|
6203
6247
|
const $9a693c7e832d3f18$var$_tmpl$ = ["<span", ' class="orig price"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span>"],
|
|
6204
|
-
$9a693c7e832d3f18$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>"],
|
|
6248
|
+
$9a693c7e832d3f18$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>"],
|
|
6205
6249
|
$9a693c7e832d3f18$var$_tmpl$3 = ["<div", ' class="tagline">', "</div>"];
|
|
6206
6250
|
const $9a693c7e832d3f18$export$b05c0ae390cf3e06 = (display_or_variant_container, _ref, router_) => {
|
|
6207
6251
|
let {
|
|
@@ -6274,9 +6318,11 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
|
|
|
6274
6318
|
render_instant_card_placeholder_: render_instant_card_placeholder_,
|
|
6275
6319
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
6276
6320
|
has_sort_or_filters_: has_sort_or_filters_,
|
|
6277
|
-
|
|
6321
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
6278
6322
|
i18n_: i18n_,
|
|
6279
|
-
router_: router_
|
|
6323
|
+
router_: router_,
|
|
6324
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
6325
|
+
content_search_enabled_: content_search_enabled_
|
|
6280
6326
|
} = _ref;
|
|
6281
6327
|
const max_cards = 4;
|
|
6282
6328
|
const [read_current_instant_query, write_current_instant_query] = (0, $b8hua$createSignal)("");
|
|
@@ -6301,13 +6347,23 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
|
|
|
6301
6347
|
...variable_data
|
|
6302
6348
|
});
|
|
6303
6349
|
}));
|
|
6304
|
-
|
|
6305
|
-
|
|
6350
|
+
// 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
|
|
6351
|
+
// This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
|
|
6352
|
+
set_modal_search_results_(() => search_results);
|
|
6353
|
+
(0, $b8hua$onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
|
|
6354
|
+
set_total_num_results_accessor_(() => (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
|
|
6355
|
+
number_: (0, $b8hua$createMemo)(() => {
|
|
6356
|
+
var _search_results, _search_results2, _search_results2$cont;
|
|
6357
|
+
const hits = (_search_results = search_results()) === null || _search_results === void 0 ? void 0 : _search_results.n_hits;
|
|
6358
|
+
const content_results = (_search_results2 = search_results()) === null || _search_results2 === void 0 ? void 0 : (_search_results2$cont = _search_results2.content_search_links) === null || _search_results2$cont === void 0 ? void 0 : _search_results2$cont.length;
|
|
6359
|
+
if (!content_results || !content_search_enabled_()) return hits;
|
|
6360
|
+
return (hits !== null && hits !== void 0 ? hits : 0) + content_results;
|
|
6361
|
+
}),
|
|
6306
6362
|
i18n_: i18n_
|
|
6307
6363
|
}));
|
|
6308
6364
|
const sliced_displays = (0, $b8hua$createMemo)(() => {
|
|
6309
|
-
var
|
|
6310
|
-
return (
|
|
6365
|
+
var _search_results3, _search_results3$disp;
|
|
6366
|
+
return (_search_results3 = search_results()) === null || _search_results3 === void 0 ? void 0 : (_search_results3$disp = _search_results3.displays) === null || _search_results3$disp === void 0 ? void 0 : _search_results3$disp.slice(0, max_cards);
|
|
6311
6367
|
});
|
|
6312
6368
|
let placeholder;
|
|
6313
6369
|
return (0, $b8hua$ssr)($f7414b949aeabc90$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
@@ -6317,8 +6373,8 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
|
|
|
6317
6373
|
},
|
|
6318
6374
|
get fallback() {
|
|
6319
6375
|
return (0, $b8hua$createMemo)(() => {
|
|
6320
|
-
var
|
|
6321
|
-
if (Array.isArray((
|
|
6376
|
+
var _search_results4;
|
|
6377
|
+
if (Array.isArray((_search_results4 = search_results()) === null || _search_results4 === void 0 ? void 0 : _search_results4.displays))
|
|
6322
6378
|
// remove placeholders if we have a response but no results
|
|
6323
6379
|
return undefined;
|
|
6324
6380
|
return new Array(max_cards).fill(1).map(() => (placeholder || (placeholder = render_instant_card_placeholder_())).cloneNode(true));
|
|
@@ -6373,7 +6429,7 @@ function $6d95ef50ee01d5a1$export$5d2caaa6b530761c() {
|
|
|
6373
6429
|
return (0, $b8hua$ssr)($6d95ef50ee01d5a1$var$_tmpl$, (0, $b8hua$ssrHydrationKey)());
|
|
6374
6430
|
}
|
|
6375
6431
|
const $494c9ad553139dbc$var$_tmpl$ = ["<div", ' class="previous-searches"><h2 class="text">', '</h2><div class="list">', "</div></div>"],
|
|
6376
|
-
$494c9ad553139dbc$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->',
|
|
6432
|
+
$494c9ad553139dbc$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->', '<!--/--><span class="line-clamp"', ">", '</span></div><button class="delete"', ">", "</button></a>"];
|
|
6377
6433
|
function $494c9ad553139dbc$export$a146ac6fa8346a25(_ref) {
|
|
6378
6434
|
let {
|
|
6379
6435
|
text_: text_,
|
|
@@ -6417,14 +6473,14 @@ function $494c9ad553139dbc$export$a146ac6fa8346a25(_ref) {
|
|
|
6417
6473
|
return (0, $b8hua$ssr)($494c9ad553139dbc$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), "".concat("item", " ").concat((0, $b8hua$createMemo)(() => {
|
|
6418
6474
|
var _read_selected_index_, _read_selected_index_2;
|
|
6419
6475
|
return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === 0 && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
|
|
6420
|
-
})() ? "selected" : ""), (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href(), true), false), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $6d95ef50ee01d5a1$export$5d2caaa6b530761c), {})), (0, $b8hua$escape)(item()), (0, $b8hua$ssrAttribute)("title", (0, $b8hua$escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $9783d437ad61594c$export$3b621d86b1566b2), {})));
|
|
6476
|
+
})() ? "selected" : ""), (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href(), true), false), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $6d95ef50ee01d5a1$export$5d2caaa6b530761c), {})), (0, $b8hua$ssrAttribute)("title", (0, $b8hua$escape)(item(), true), false), (0, $b8hua$escape)(item()), (0, $b8hua$ssrAttribute)("title", (0, $b8hua$escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $9783d437ad61594c$export$3b621d86b1566b2), {})));
|
|
6421
6477
|
}
|
|
6422
6478
|
})));
|
|
6423
6479
|
}
|
|
6424
6480
|
});
|
|
6425
6481
|
}
|
|
6426
6482
|
const $02b6641aa50ce528$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
|
|
6427
|
-
$02b6641aa50ce528$var$_tmpl$2 = ["<span", ' class="', '"
|
|
6483
|
+
$02b6641aa50ce528$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
|
|
6428
6484
|
function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
|
|
6429
6485
|
let {
|
|
6430
6486
|
whole_text_to_display_: whole_text_to_display_memo,
|
|
@@ -6475,16 +6531,28 @@ function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
|
|
|
6475
6531
|
}
|
|
6476
6532
|
return output;
|
|
6477
6533
|
}));
|
|
6478
|
-
return (0, $b8hua$ssr)($02b6641aa50ce528$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), "".concat((0, $b8hua$escape)(class_, true) || "", " ").concat(get_has_highlighted() ? "has-history-match" : ""), (0, $b8hua$escape)(text_itself()));
|
|
6534
|
+
return (0, $b8hua$ssr)($02b6641aa50ce528$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), "".concat((0, $b8hua$escape)(class_, true) || "", " ").concat(get_has_highlighted() ? "has-history-match" : ""), (0, $b8hua$ssrAttribute)("title", (0, $b8hua$escape)(whole_text_to_display_memo(), true), false), (0, $b8hua$escape)(text_itself()));
|
|
6535
|
+
}
|
|
6536
|
+
const $3c5e15c6ee4227a9$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>';
|
|
6537
|
+
function $3c5e15c6ee4227a9$export$605674723bcc715c() {
|
|
6538
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6539
|
+
return (0, $b8hua$ssrElement)("svg", () => ({
|
|
6540
|
+
"xmlns": "http://www.w3.org/2000/svg",
|
|
6541
|
+
"width": "32",
|
|
6542
|
+
"height": "32",
|
|
6543
|
+
"viewBox": "0 0 256 256",
|
|
6544
|
+
...props
|
|
6545
|
+
}), () => (0, $b8hua$ssr)($3c5e15c6ee4227a9$var$_tmpl$), true);
|
|
6479
6546
|
}
|
|
6480
6547
|
const $40dd3f46f55d62ba$var$_tmpl$ = ["<a", ' class="', '"', ">", "</a>"],
|
|
6481
6548
|
$40dd3f46f55d62ba$var$_tmpl$2 = ["<div", ' class="search-icon">', "</div>"],
|
|
6482
6549
|
$40dd3f46f55d62ba$var$_tmpl$3 = ["<span", ' class="type">', "</span>"],
|
|
6483
6550
|
$40dd3f46f55d62ba$var$_tmpl$4 = ["<div", "><!--#-->", '<!--/--><span class="value">', "</span></div>"],
|
|
6484
|
-
$40dd3f46f55d62ba$var$_tmpl$5 = ["<
|
|
6485
|
-
$40dd3f46f55d62ba$var$_tmpl$6 = ["<
|
|
6486
|
-
$40dd3f46f55d62ba$var$_tmpl$7 = ["<div", ' class="suggestion-container
|
|
6487
|
-
$40dd3f46f55d62ba$var$_tmpl$8 = ["<div", ' class="
|
|
6551
|
+
$40dd3f46f55d62ba$var$_tmpl$5 = ["<div", ' class="with-icon"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
6552
|
+
$40dd3f46f55d62ba$var$_tmpl$6 = ["<h2", ' class="text">', "</h2>"],
|
|
6553
|
+
$40dd3f46f55d62ba$var$_tmpl$7 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
6554
|
+
$40dd3f46f55d62ba$var$_tmpl$8 = ["<div", ' class="suggestion-container page">', "</div>"],
|
|
6555
|
+
$40dd3f46f55d62ba$var$_tmpl$9 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
|
|
6488
6556
|
function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
6489
6557
|
let {
|
|
6490
6558
|
suggestion_memo_: suggestion_memo_,
|
|
@@ -6498,7 +6566,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
6498
6566
|
include_category_suggestions_: include_category_suggestions_,
|
|
6499
6567
|
searching_for_value_: searching_for_value_,
|
|
6500
6568
|
router_: router_,
|
|
6501
|
-
submit_query_: submit_query_
|
|
6569
|
+
submit_query_: submit_query_,
|
|
6570
|
+
get_content_results_: get_content_results_
|
|
6502
6571
|
} = _ref;
|
|
6503
6572
|
const queries_memo = (0, $b8hua$createMemo)(() => suggestion_memo_().filter(_ref2 => {
|
|
6504
6573
|
let {
|
|
@@ -6509,12 +6578,18 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
6509
6578
|
} // don't show the ones we already show from the history
|
|
6510
6579
|
));
|
|
6511
6580
|
|
|
6512
|
-
const not_queries_memo = (0, $b8hua$createMemo)(() =>
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6581
|
+
const not_queries_memo = (0, $b8hua$createMemo)(() => {
|
|
6582
|
+
// For the section that shows categories and content results
|
|
6583
|
+
// We want to limit to 3 items, and we want to show the categories first
|
|
6584
|
+
const content_results = get_content_results_() || [];
|
|
6585
|
+
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(_ref3 => {
|
|
6586
|
+
let {
|
|
6587
|
+
type: type
|
|
6588
|
+
} = _ref3;
|
|
6589
|
+
return type !== (0, $7cd4d275a9f8d600$export$3cf9497e790da491);
|
|
6590
|
+
}) : [];
|
|
6591
|
+
return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
|
|
6592
|
+
});
|
|
6518
6593
|
const render_entry = function (input_obj, autocomplete_data_index, index) {
|
|
6519
6594
|
let is_history = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
6520
6595
|
const is_query = (0, $b8hua$createMemo)(() => input_obj().type === (0, $7cd4d275a9f8d600$export$3cf9497e790da491));
|
|
@@ -6524,10 +6599,11 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
6524
6599
|
url_transformer_: url_transformer_
|
|
6525
6600
|
}) : undefined);
|
|
6526
6601
|
const href = (0, $b8hua$createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
6527
|
-
|
|
6602
|
+
const is_selected = (0, $b8hua$createMemo)(() => {
|
|
6528
6603
|
var _read_selected_index_, _read_selected_index_2;
|
|
6529
6604
|
return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === autocomplete_data_index && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
|
|
6530
|
-
})
|
|
6605
|
+
});
|
|
6606
|
+
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "suggestion ".concat(is_selected() ? "selected" : "", " ").concat(is_history ? "history" : "", " ").concat((0, $b8hua$escape)((0, $b8hua$escape)("type-" + input_obj().type, true), true)), (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href(), true), false), is_query() ? (0, $b8hua$escape)([(0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
6531
6607
|
when: is_history,
|
|
6532
6608
|
get fallback() {
|
|
6533
6609
|
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $ef0f18a578b32578$export$82eafebb825fc23f), {})));
|
|
@@ -6536,24 +6612,34 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
6536
6612
|
return (0, $b8hua$createComponent)((0, $6d95ef50ee01d5a1$export$5d2caaa6b530761c), {});
|
|
6537
6613
|
}
|
|
6538
6614
|
}), (0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
|
|
6539
|
-
class_: "value",
|
|
6615
|
+
class_: "value line-clamp",
|
|
6540
6616
|
get whole_text_to_display_() {
|
|
6541
6617
|
return (0, $b8hua$createMemo)(() => input_obj().title);
|
|
6542
6618
|
},
|
|
6543
6619
|
searching_for_value_: searching_for_value_
|
|
6544
|
-
})]) : (0, $b8hua$escape)([typeof input_obj()
|
|
6545
|
-
class_: "category",
|
|
6620
|
+
})]) : (0, $b8hua$escape)([typeof input_obj() /* this is a harmless lie */.parent_title === "string" ? (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$4, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
|
|
6621
|
+
class_: "category line-clamp",
|
|
6546
6622
|
get whole_text_to_display_() {
|
|
6547
6623
|
return (0, $b8hua$createMemo)(() => input_obj().title);
|
|
6548
6624
|
},
|
|
6549
6625
|
searching_for_value_: searching_for_value_
|
|
6550
|
-
})), (0, $b8hua$escape)(input_obj().parent_title)) : (0, $b8hua$createComponent)((0, $
|
|
6551
|
-
|
|
6626
|
+
})), (0, $b8hua$escape)(input_obj().parent_title)) : input_obj().type === "content" ? (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$5, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $3c5e15c6ee4227a9$export$605674723bcc715c), {
|
|
6627
|
+
width: "16",
|
|
6628
|
+
height: "16"
|
|
6629
|
+
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
|
|
6630
|
+
class_: "content line-clamp",
|
|
6631
|
+
get whole_text_to_display_() {
|
|
6632
|
+
return (0, $b8hua$createMemo)(() => input_obj().title);
|
|
6633
|
+
},
|
|
6634
|
+
searching_for_value_: searching_for_value_
|
|
6635
|
+
}))) : (0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
|
|
6636
|
+
class_: "category line-clamp",
|
|
6552
6637
|
get whole_text_to_display_() {
|
|
6553
6638
|
return (0, $b8hua$createMemo)(() => input_obj().title);
|
|
6554
6639
|
},
|
|
6555
6640
|
searching_for_value_: searching_for_value_
|
|
6556
6641
|
}), (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$3, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createMemo)(() => {
|
|
6642
|
+
if (input_obj().type === "content") return i18n_.content_();
|
|
6557
6643
|
if (input_obj().category_type === "BRAND") return i18n_.brand_();
|
|
6558
6644
|
return i18n_.category_();
|
|
6559
6645
|
})()))]));
|
|
@@ -6570,8 +6656,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
6570
6656
|
};
|
|
6571
6657
|
const should_show_previous_searches_in_query_part = (0, $b8hua$createMemo)(() => !on_previous_searches_page_());
|
|
6572
6658
|
const should_show_at_all = (0, $b8hua$createMemo)(() => {
|
|
6573
|
-
var _suggestion_memo_;
|
|
6574
|
-
return ((_suggestion_memo_ = suggestion_memo_()) === null || _suggestion_memo_ === void 0 ? void 0 : _suggestion_memo_.length) || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length;
|
|
6659
|
+
var _suggestion_memo_, _get_content_results_;
|
|
6660
|
+
return ((_suggestion_memo_ = suggestion_memo_()) === null || _suggestion_memo_ === void 0 ? void 0 : _suggestion_memo_.length) || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length || ((_get_content_results_ = get_content_results_()) === null || _get_content_results_ === void 0 ? void 0 : _get_content_results_.length);
|
|
6575
6661
|
});
|
|
6576
6662
|
const should_show_query_part = (0, $b8hua$createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
|
|
6577
6663
|
return (0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
@@ -6579,19 +6665,19 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
6579
6665
|
return should_show_at_all();
|
|
6580
6666
|
},
|
|
6581
6667
|
get children() {
|
|
6582
|
-
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$
|
|
6668
|
+
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$9, (0, $b8hua$ssrHydrationKey)(), "suggestions ".concat(on_previous_searches_page_() ? "compact" : ""), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
6583
6669
|
get when() {
|
|
6584
6670
|
return on_previous_searches_page_();
|
|
6585
6671
|
},
|
|
6586
6672
|
get children() {
|
|
6587
|
-
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$
|
|
6673
|
+
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$6, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.suggestions_()));
|
|
6588
6674
|
}
|
|
6589
6675
|
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
6590
6676
|
get when() {
|
|
6591
6677
|
return should_show_query_part();
|
|
6592
6678
|
},
|
|
6593
6679
|
get children() {
|
|
6594
|
-
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$
|
|
6680
|
+
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$7, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
6595
6681
|
get when() {
|
|
6596
6682
|
return should_show_previous_searches_in_query_part();
|
|
6597
6683
|
},
|
|
@@ -6627,11 +6713,11 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
6627
6713
|
}
|
|
6628
6714
|
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
6629
6715
|
get when() {
|
|
6630
|
-
return not_queries_memo().length
|
|
6716
|
+
return not_queries_memo().length;
|
|
6631
6717
|
},
|
|
6632
6718
|
keyed: false,
|
|
6633
6719
|
get children() {
|
|
6634
|
-
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$
|
|
6720
|
+
return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$8, (0, $b8hua$ssrHydrationKey)(), (() => {
|
|
6635
6721
|
const index_in_autocomplete = 3;
|
|
6636
6722
|
set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
|
|
6637
6723
|
return (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Index), {
|
|
@@ -6646,7 +6732,18 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
6646
6732
|
}
|
|
6647
6733
|
});
|
|
6648
6734
|
}
|
|
6649
|
-
const $
|
|
6735
|
+
const $76b6e14a50da4597$var$_tmpl$ = ["<a", ' target="_blank"></a>'];
|
|
6736
|
+
function $76b6e14a50da4597$export$1efe1013da60d0e4(e, href) {
|
|
6737
|
+
if (e.metaKey || e.ctrlKey) {
|
|
6738
|
+
// Open link in a new tab with cmd/ctrl + enter.
|
|
6739
|
+
const link = (0, $b8hua$ssr)($76b6e14a50da4597$var$_tmpl$, (0, $b8hua$ssrHydrationKey)() + (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href, true), false));
|
|
6740
|
+
document.body.append(link);
|
|
6741
|
+
link.click();
|
|
6742
|
+
link.remove();
|
|
6743
|
+
return true;
|
|
6744
|
+
}
|
|
6745
|
+
return false;
|
|
6746
|
+
}
|
|
6650
6747
|
function $2ebb1d6ae6763f7a$export$217899a935ef803b(_ref) {
|
|
6651
6748
|
let {
|
|
6652
6749
|
selected_index_: [read_selected_index, write_selected_index],
|
|
@@ -6724,6 +6821,7 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
|
|
|
6724
6821
|
const sfv = get_search_field_value();
|
|
6725
6822
|
if (!(0, $b8hua$untrack)(() => read_updating_blocked())) previous_value = sfv;
|
|
6726
6823
|
});
|
|
6824
|
+
const owner = (0, $b8hua$getOwner)();
|
|
6727
6825
|
const handler = (0, $b8hua$catchify)(_ref3 => {
|
|
6728
6826
|
let {
|
|
6729
6827
|
keyCode: keyCode
|
|
@@ -6756,29 +6854,29 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
|
|
|
6756
6854
|
const {
|
|
6757
6855
|
title: title
|
|
6758
6856
|
} = selected_entry;
|
|
6759
|
-
|
|
6857
|
+
(0, $b8hua$runWithOwner)(owner, block_updating_for_one_change);
|
|
6760
6858
|
set_search_field_value(title);
|
|
6761
|
-
override_on_enter_for_this_entry(e => {
|
|
6859
|
+
(0, $b8hua$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
6762
6860
|
// Open search query in new tab on cmd+enter
|
|
6763
6861
|
// 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 ;)
|
|
6764
6862
|
const url = new URL(location);
|
|
6765
6863
|
url_transformer_ === null || url_transformer_ === void 0 || url_transformer_(url);
|
|
6766
6864
|
url.searchParams.set(search_query_param_name_, title);
|
|
6767
|
-
return $
|
|
6768
|
-
});
|
|
6769
|
-
} else if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "category") override_on_enter_for_this_entry(e => {
|
|
6865
|
+
return (0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, url.href);
|
|
6866
|
+
}));
|
|
6867
|
+
} else if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "category" || (selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) === "content") (0, $b8hua$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
6770
6868
|
const {
|
|
6771
6869
|
page_url: page_url
|
|
6772
6870
|
} = selected_entry;
|
|
6773
|
-
if (
|
|
6871
|
+
if (!(0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, page_url))
|
|
6774
6872
|
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
6775
6873
|
router_.navigate_.go_to_({
|
|
6776
6874
|
new_url_: page_url,
|
|
6777
6875
|
is_replace_: false
|
|
6778
6876
|
});
|
|
6779
6877
|
return true;
|
|
6780
|
-
});else if (!selected_entry) {
|
|
6781
|
-
|
|
6878
|
+
}));else if (!selected_entry) {
|
|
6879
|
+
(0, $b8hua$runWithOwner)(owner, block_updating_for_one_change);
|
|
6782
6880
|
set_search_field_value(previous_value);
|
|
6783
6881
|
}
|
|
6784
6882
|
});
|
|
@@ -6790,16 +6888,39 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
|
|
|
6790
6888
|
(0, $b8hua$onCleanup)((0, $b8hua$catchify)(() => el.removeEventListener("keyup", handler)));
|
|
6791
6889
|
});
|
|
6792
6890
|
}
|
|
6793
|
-
function $
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6891
|
+
function $c4dee1ef44de29ca$export$af0124069c150252(_ref) {
|
|
6892
|
+
let {
|
|
6893
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
6894
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
6895
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
6896
|
+
router_: router_,
|
|
6897
|
+
content_results_: content_results_
|
|
6898
|
+
} = _ref;
|
|
6899
|
+
const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $b8hua$createSignal)(() => false);
|
|
6900
|
+
(0, $b8hua$createComputed)(() => {
|
|
6901
|
+
var _get_modal_search_res, _search_results$displ;
|
|
6902
|
+
const suggestions = read_suggestion_signal_();
|
|
6903
|
+
const search_results = (_get_modal_search_res = get_modal_search_results_()) === null || _get_modal_search_res === void 0 ? void 0 : _get_modal_search_res();
|
|
6904
|
+
const content_results = content_results_();
|
|
6905
|
+
// If we only have one content result and nothing else, go there when pressing enter
|
|
6906
|
+
if (!suggestions.length && !(search_results !== null && search_results !== void 0 && (_search_results$displ = search_results.displays) !== null && _search_results$displ !== void 0 && _search_results$displ.length) && (content_results === null || content_results === void 0 ? void 0 : content_results.length) === 1) {
|
|
6907
|
+
const [{
|
|
6908
|
+
page_url: page_url
|
|
6909
|
+
}] = content_results;
|
|
6910
|
+
set_override_on_enter_fn_(e => {
|
|
6911
|
+
if (!(0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, page_url))
|
|
6912
|
+
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
6913
|
+
router_.navigate_.go_to_({
|
|
6914
|
+
new_url_: page_url,
|
|
6915
|
+
is_replace_: false
|
|
6916
|
+
});
|
|
6917
|
+
return true;
|
|
6918
|
+
});
|
|
6919
|
+
return;
|
|
6920
|
+
}
|
|
6921
|
+
set_override_on_enter_fn_(get_autocomplete_wants_override_function());
|
|
6922
|
+
});
|
|
6923
|
+
return new_fn => set_autocomplete_wants_override_function(() => new_fn);
|
|
6803
6924
|
}
|
|
6804
6925
|
const $7cd4d275a9f8d600$export$3cf9497e790da491 = "query";
|
|
6805
6926
|
function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
@@ -6820,12 +6941,15 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
|
6820
6941
|
i18n_: i18n_,
|
|
6821
6942
|
include_category_suggestions_: include_category_suggestions_,
|
|
6822
6943
|
submit_query_: submit_query_,
|
|
6823
|
-
router_: router_
|
|
6944
|
+
router_: router_,
|
|
6945
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
6946
|
+
content_search_enabled_: content_search_enabled_
|
|
6824
6947
|
} = _ref;
|
|
6825
6948
|
const [searching_for_value, set_searching_for_value] = (0, $b8hua$createSignal)();
|
|
6949
|
+
const [show_stale_content_results, set_show_stale_content_results] = (0, $b8hua$createSignal)(false);
|
|
6826
6950
|
const [read_search_field_value] = search_field_value_;
|
|
6827
6951
|
const updating_blocked = (0, $b8hua$createSignal)(false);
|
|
6828
|
-
const [
|
|
6952
|
+
const [read_suggestion_signal_, write_suggestion_signal] = (0, $b8hua$createSignal)([]);
|
|
6829
6953
|
const filtered_previous_searches = (0, $b8hua$createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
|
|
6830
6954
|
const deparallelized_fn = (0, $b8hua$deparallelize_no_drop)(async request_obj => {
|
|
6831
6955
|
var _api_response$suggest;
|
|
@@ -6849,15 +6973,39 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
|
6849
6973
|
});
|
|
6850
6974
|
|
|
6851
6975
|
const show_previous_searches_component = (0, $b8hua$createMemo)(() => !read_search_field_value() || (0, $b8hua$untrack)(updating_blocked[0]) && !(0, $b8hua$untrack)(searching_for_value));
|
|
6976
|
+
const get_content_results_ = (0, $b8hua$createMemo)(prev => {
|
|
6977
|
+
var _get_modal_search_res, _get_modal_search_res2, _get_modal_search_res3;
|
|
6978
|
+
if (!content_search_enabled_()) return [];
|
|
6979
|
+
if (show_stale_content_results())
|
|
6980
|
+
// don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
|
|
6981
|
+
return prev;
|
|
6982
|
+
return (_get_modal_search_res = get_modal_search_results_()) === null || _get_modal_search_res === void 0 ? void 0 : (_get_modal_search_res2 = _get_modal_search_res()) === null || _get_modal_search_res2 === void 0 ? void 0 : (_get_modal_search_res3 = _get_modal_search_res2.content_search_links) === null || _get_modal_search_res3 === void 0 ? void 0 : _get_modal_search_res3.map(link => ({
|
|
6983
|
+
page_url: link.page_url,
|
|
6984
|
+
type: "content",
|
|
6985
|
+
title: link.title
|
|
6986
|
+
}));
|
|
6987
|
+
});
|
|
6988
|
+
// 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.
|
|
6989
|
+
// It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
|
|
6990
|
+
const manipulated_set_override_on_enter_fn_ = (0, $c4dee1ef44de29ca$export$af0124069c150252)({
|
|
6991
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
6992
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
6993
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
6994
|
+
router_: router_,
|
|
6995
|
+
content_results_: get_content_results_
|
|
6996
|
+
});
|
|
6852
6997
|
(0, $b8hua$createComputed)(() => {
|
|
6853
6998
|
const field_value = read_search_field_value();
|
|
6854
|
-
if (
|
|
6999
|
+
if ((0, $b8hua$untrack)(updating_blocked[0]))
|
|
7000
|
+
// not using updating_blocked instead of below signal since I presume they'd start updating too early then
|
|
7001
|
+
set_show_stale_content_results(true);else {
|
|
6855
7002
|
set_searching_for_value(field_value);
|
|
6856
7003
|
deparallelized_fn({
|
|
6857
7004
|
query: field_value,
|
|
6858
7005
|
tenant: tenant_(),
|
|
6859
7006
|
market: market_()
|
|
6860
7007
|
});
|
|
7008
|
+
set_show_stale_content_results(false);
|
|
6861
7009
|
}
|
|
6862
7010
|
});
|
|
6863
7011
|
(0, $b8hua$createComputed)((0, $b8hua$on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
|
|
@@ -6869,7 +7017,7 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
|
6869
7017
|
search_field_value_: search_field_value_,
|
|
6870
7018
|
updating_blocked_: updating_blocked,
|
|
6871
7019
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
6872
|
-
set_override_on_enter_fn_:
|
|
7020
|
+
set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
|
|
6873
7021
|
search_query_param_name_: search_query_url_param_name_,
|
|
6874
7022
|
url_transformer_: url_transformer_,
|
|
6875
7023
|
router_: router_
|
|
@@ -6909,11 +7057,12 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
|
6909
7057
|
},
|
|
6910
7058
|
on_previous_searches_page_: show_previous_searches_component,
|
|
6911
7059
|
i18n_: i18n_,
|
|
7060
|
+
get_content_results_: get_content_results_,
|
|
6912
7061
|
url_transformer_: url_transformer_,
|
|
6913
7062
|
searching_for_value_: searching_for_value,
|
|
6914
7063
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
6915
7064
|
selected_index_: selected_index_,
|
|
6916
|
-
suggestion_memo_:
|
|
7065
|
+
suggestion_memo_: read_suggestion_signal_,
|
|
6917
7066
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
6918
7067
|
include_category_suggestions_: include_category_suggestions_,
|
|
6919
7068
|
router_: router_,
|
|
@@ -7021,7 +7170,8 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
7021
7170
|
bottom_distance_under_modal_: bottom_distance_under_modal_,
|
|
7022
7171
|
selected_text_range_: selected_text_range_,
|
|
7023
7172
|
dont_sync_search_field_value_except_on_submit_ = false,
|
|
7024
|
-
router_: router_
|
|
7173
|
+
router_: router_,
|
|
7174
|
+
content_search_enabled_: content_search_enabled_
|
|
7025
7175
|
} = _ref;
|
|
7026
7176
|
let on_enter_in_search_field_function;
|
|
7027
7177
|
// 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.
|
|
@@ -7038,34 +7188,24 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
7038
7188
|
};
|
|
7039
7189
|
const [input_field, set_input_field] = (0, $b8hua$createSignal)();
|
|
7040
7190
|
const [get_search_field_value_] = search_field_value_;
|
|
7041
|
-
const [
|
|
7042
|
-
const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $b8hua$createSignal)();
|
|
7191
|
+
const [get_modal_search_results, set_modal_search_results_] = (0, $b8hua$createSignal)();
|
|
7043
7192
|
const close_on_escape_handler = (0, $b8hua$catchify)(_ref2 => {
|
|
7044
7193
|
let {
|
|
7045
7194
|
key: key
|
|
7046
7195
|
} = _ref2;
|
|
7047
7196
|
if (key === "Escape") close_modal_();
|
|
7048
7197
|
});
|
|
7049
|
-
const [
|
|
7198
|
+
const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $b8hua$createSignal)();
|
|
7050
7199
|
const selected_index = (0, $b8hua$createSignal)();
|
|
7051
7200
|
const currently_showing_suggestions_ = (0, $b8hua$createSignal)([], {
|
|
7052
7201
|
equals: false
|
|
7053
7202
|
});
|
|
7203
|
+
const less_than_700_high = (0, $00a5b94f0c11efbb$export$d9f36cf74e24d595)("(max-height:700px)");
|
|
7204
|
+
const DiscoverMoreSection = () => (0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), get_search_field_value_() ? (0, $b8hua$escape)(i18n_.modal_view_all_results_()((0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(get_total_num_results_accessor === null || get_total_num_results_accessor === void 0 ? void 0 : get_total_num_results_accessor())))) : (0, $b8hua$escape)(i18n_.modal_discover_more_()));
|
|
7054
7205
|
if (disable_scrolling_) (0, $e56d241d0f33d459$export$fe334901e8bebd57)();
|
|
7055
7206
|
$e82132ed97521828$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
|
|
7056
7207
|
window.addEventListener("keydown", close_on_escape_handler);
|
|
7057
7208
|
(0, $b8hua$onCleanup)((0, $b8hua$catchify)(() => window.removeEventListener("keydown", close_on_escape_handler)));
|
|
7058
|
-
const owner = (0, $b8hua$getOwner)();
|
|
7059
|
-
(0, $b8hua$onCleanup)((0, $b8hua$javascript_media_query)("(max-height:700px)", _ref3 => {
|
|
7060
|
-
let {
|
|
7061
|
-
matches: matches
|
|
7062
|
-
} = _ref3;
|
|
7063
|
-
return (0, $b8hua$runWithOwner)(owner, () => {
|
|
7064
|
-
// the if below is reactive so we need an owner
|
|
7065
|
-
(matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
|
|
7066
|
-
(matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), get_search_field_value_() ? (0, $b8hua$escape)(i18n_.modal_view_all_results_()((0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(get_num_results_accessor === null || get_num_results_accessor === void 0 ? void 0 : get_num_results_accessor())))) : (0, $b8hua$escape)(i18n_.modal_discover_more_())));
|
|
7067
|
-
});
|
|
7068
|
-
}).remove);
|
|
7069
7209
|
if (closing_animation_) register_closing_animation_(closing_animation_);
|
|
7070
7210
|
(0, $a09bb7c652acf957$export$3340fdd8259bd4fd)({
|
|
7071
7211
|
get_search_field_value_: get_search_field_value_,
|
|
@@ -7127,7 +7267,9 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
7127
7267
|
i18n_: i18n_,
|
|
7128
7268
|
include_category_suggestions_: enable_category_suggestions_ !== null && enable_category_suggestions_ !== void 0 ? enable_category_suggestions_ : true,
|
|
7129
7269
|
router_: router_,
|
|
7130
|
-
submit_query_: submit_query_
|
|
7270
|
+
submit_query_: submit_query_,
|
|
7271
|
+
get_modal_search_results_: get_modal_search_results,
|
|
7272
|
+
content_search_enabled_: content_search_enabled_
|
|
7131
7273
|
});
|
|
7132
7274
|
}
|
|
7133
7275
|
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
@@ -7140,12 +7282,28 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
7140
7282
|
tenant_: tenant_,
|
|
7141
7283
|
i18n_: i18n_,
|
|
7142
7284
|
market_: market_,
|
|
7143
|
-
|
|
7285
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
7144
7286
|
router_: router_,
|
|
7287
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
7288
|
+
content_search_enabled_: content_search_enabled_,
|
|
7145
7289
|
...instant_results_options_
|
|
7146
7290
|
});
|
|
7147
7291
|
}
|
|
7148
|
-
})), (0, $b8hua$escape)(
|
|
7292
|
+
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
7293
|
+
get when() {
|
|
7294
|
+
return less_than_700_high();
|
|
7295
|
+
},
|
|
7296
|
+
get children() {
|
|
7297
|
+
return (0, $b8hua$createComponent)(DiscoverMoreSection, {});
|
|
7298
|
+
}
|
|
7299
|
+
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
7300
|
+
get when() {
|
|
7301
|
+
return !less_than_700_high();
|
|
7302
|
+
},
|
|
7303
|
+
get children() {
|
|
7304
|
+
return (0, $b8hua$createComponent)(DiscoverMoreSection, {});
|
|
7305
|
+
}
|
|
7306
|
+
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $a86e71c0015bd8ab$export$f021bdedd3ec901a), {
|
|
7149
7307
|
styles: body_style
|
|
7150
7308
|
})));
|
|
7151
7309
|
return [(0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$4, (0, $b8hua$ssrHydrationKey)() + (0, $b8hua$ssrAttribute)("id", (0, $b8hua$escape)((0, $c3820807ac1e6fd7$export$44dad306455dddf).SEARCH_MODAL, true), false), "depict plp search ".concat((0, $b8hua$escape)((0, $b8hua$ssrClassList)(class_list_ === null || class_list_ === void 0 ? void 0 : class_list_()), true) || ""), (0, $b8hua$escape)(modal_element))];
|
|
@@ -7223,14 +7381,21 @@ function $69602b3d8fd54c38$export$9dd50d35b9d94fdf(_ref) {
|
|
|
7223
7381
|
let {
|
|
7224
7382
|
get_search_query_: get_search_query_,
|
|
7225
7383
|
i18n_: i18n_,
|
|
7226
|
-
formatted_number_of_results_: formatted_number_of_results_
|
|
7384
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
7385
|
+
number_of_results_: number_of_results_,
|
|
7386
|
+
type: type
|
|
7227
7387
|
} = _ref;
|
|
7228
7388
|
const contents = (0, $b8hua$createMemo)((0, $b8hua$catchify)(() => {
|
|
7229
7389
|
const q = get_search_query_();
|
|
7230
|
-
return i18n_.get_showing_results_for_()((0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(q)), (0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(formatted_number_of_results_())));
|
|
7390
|
+
return i18n_[type === $69602b3d8fd54c38$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(q)), (0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(formatted_number_of_results_())), !!q, number_of_results_());
|
|
7231
7391
|
}));
|
|
7232
7392
|
return (0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(contents()));
|
|
7233
7393
|
}
|
|
7394
|
+
let $69602b3d8fd54c38$export$2452208c79fe93ea;
|
|
7395
|
+
(function (ShowingResultsForType) {
|
|
7396
|
+
ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
|
|
7397
|
+
ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
|
|
7398
|
+
})($69602b3d8fd54c38$export$2452208c79fe93ea || ($69602b3d8fd54c38$export$2452208c79fe93ea = {}));
|
|
7234
7399
|
function $8e8ce3f7a5eb11a6$export$41b4894022a3580f() {
|
|
7235
7400
|
let {
|
|
7236
7401
|
style_props_ = (0, $b8hua$createSignal)({})
|
|
@@ -7250,8 +7415,464 @@ function $8e8ce3f7a5eb11a6$export$41b4894022a3580f() {
|
|
|
7250
7415
|
})));
|
|
7251
7416
|
return style_props_;
|
|
7252
7417
|
}
|
|
7418
|
+
const $f3a159279dc1a8fb$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
|
|
7419
|
+
const $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters = 30;
|
|
7420
|
+
function $f3a159279dc1a8fb$export$e1a98a189fd2c0e7(_ref) {
|
|
7421
|
+
let {
|
|
7422
|
+
content_result_: content_result_,
|
|
7423
|
+
key_: key_,
|
|
7424
|
+
cut_when_possible_: cut_when_possible_
|
|
7425
|
+
} = _ref;
|
|
7426
|
+
const matched_tokens = (0, $b8hua$createMemo)(() => {
|
|
7427
|
+
var _content_result_$high, _content_result_$high2;
|
|
7428
|
+
return (_content_result_$high = content_result_().highlights) === null || _content_result_$high === void 0 ? void 0 : (_content_result_$high2 = _content_result_$high.find(highlight => highlight.field == key_)) === null || _content_result_$high2 === void 0 ? void 0 : _content_result_$high2.matched_tokens;
|
|
7429
|
+
});
|
|
7430
|
+
const full_value = (0, $b8hua$createMemo)(() => {
|
|
7431
|
+
var _content_result_$key_;
|
|
7432
|
+
return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
|
|
7433
|
+
});
|
|
7434
|
+
return (0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
7435
|
+
get when() {
|
|
7436
|
+
var _matched_tokens;
|
|
7437
|
+
return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
|
|
7438
|
+
},
|
|
7439
|
+
get fallback() {
|
|
7440
|
+
return full_value();
|
|
7441
|
+
},
|
|
7442
|
+
get children() {
|
|
7443
|
+
return (() => {
|
|
7444
|
+
const segmented_cut_text = (0, $b8hua$createMemo)(() => {
|
|
7445
|
+
const segmented_text = $f3a159279dc1a8fb$var$segment_text(full_value(), matched_tokens());
|
|
7446
|
+
if (cut_when_possible_) $f3a159279dc1a8fb$var$cut_text(segmented_text);
|
|
7447
|
+
return segmented_text;
|
|
7448
|
+
});
|
|
7449
|
+
return (0, $b8hua$createComponent)((0, $b8hua$Index), {
|
|
7450
|
+
get each() {
|
|
7451
|
+
return segmented_cut_text();
|
|
7452
|
+
},
|
|
7453
|
+
children: item => {
|
|
7454
|
+
return (0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
7455
|
+
get when() {
|
|
7456
|
+
return item().highlighted_;
|
|
7457
|
+
},
|
|
7458
|
+
get fallback() {
|
|
7459
|
+
return item().text_;
|
|
7460
|
+
},
|
|
7461
|
+
get children() {
|
|
7462
|
+
return (0, $b8hua$ssr)($f3a159279dc1a8fb$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(item().text_));
|
|
7463
|
+
}
|
|
7464
|
+
});
|
|
7465
|
+
}
|
|
7466
|
+
});
|
|
7467
|
+
})();
|
|
7468
|
+
}
|
|
7469
|
+
});
|
|
7470
|
+
}
|
|
7471
|
+
function $f3a159279dc1a8fb$var$cut_text(segmented_text) {
|
|
7472
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
7473
|
+
const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
|
|
7474
|
+
if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
|
|
7475
|
+
// We have one or more highlighted segments
|
|
7476
|
+
if (highlighted_segments.length === 1) {
|
|
7477
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
7478
|
+
$f3a159279dc1a8fb$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
7479
|
+
return;
|
|
7480
|
+
}
|
|
7481
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
7482
|
+
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
|
|
7483
|
+
);
|
|
7484
|
+
|
|
7485
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
7486
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
7487
|
+
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);
|
|
7488
|
+
$f3a159279dc1a8fb$var$cut_start(index_of_first_segment, segmented_text);
|
|
7489
|
+
// update indexes since we might have removed segments
|
|
7490
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
7491
|
+
let number_of_characters_between_segments = 0;
|
|
7492
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
7493
|
+
const segment = segmented_text[i];
|
|
7494
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
7495
|
+
}
|
|
7496
|
+
if (number_of_characters_between_segments < $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters)
|
|
7497
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
7498
|
+
return;
|
|
7499
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
7500
|
+
const [split_start_segment, split_start_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
7501
|
+
const [split_end_segment, split_end_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
7502
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
7503
|
+
// identical split point, or split end before split start, can't do anything
|
|
7504
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
7505
|
+
const dots_segment = {
|
|
7506
|
+
text_: " … ",
|
|
7507
|
+
highlighted_: false
|
|
7508
|
+
};
|
|
7509
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
7510
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
7511
|
+
const text = segment.text_;
|
|
7512
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
7513
|
+
...segment,
|
|
7514
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
7515
|
+
}, dots_segment, {
|
|
7516
|
+
...segment,
|
|
7517
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
7518
|
+
}];else if (i == split_start_segment) {
|
|
7519
|
+
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
|
|
7520
|
+
return segment;
|
|
7521
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
7522
|
+
...segment,
|
|
7523
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
7524
|
+
}];
|
|
7525
|
+
return []; // remove all segments inbetween
|
|
7526
|
+
});
|
|
7527
|
+
|
|
7528
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
7529
|
+
$f3a159279dc1a8fb$var$heal_holes(segmented_text);
|
|
7530
|
+
}
|
|
7531
|
+
function $f3a159279dc1a8fb$var$heal_holes(segmented_text) {
|
|
7532
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
7533
|
+
const segments_to_delete = new Set();
|
|
7534
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
7535
|
+
var _previous_segment, _previous_segment2;
|
|
7536
|
+
const segment = segmented_text[i];
|
|
7537
|
+
let previous_segment;
|
|
7538
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
7539
|
+
previous_segment = segmented_text[j];
|
|
7540
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
7541
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
7542
|
+
}
|
|
7543
|
+
if ((_previous_segment = previous_segment) !== null && _previous_segment !== void 0 && _previous_segment.highlighted_ && segment.highlighted_ || ((_previous_segment2 = previous_segment) === null || _previous_segment2 === void 0 ? void 0 : _previous_segment2.highlighted_) === false && segment.highlighted_ === false) {
|
|
7544
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
7545
|
+
segments_to_delete.add(segment);
|
|
7546
|
+
}
|
|
7547
|
+
}
|
|
7548
|
+
for (const segment of segments_to_delete) {
|
|
7549
|
+
const index = segmented_text.indexOf(segment);
|
|
7550
|
+
segmented_text.splice(index, 1);
|
|
7551
|
+
}
|
|
7552
|
+
}
|
|
7553
|
+
function $f3a159279dc1a8fb$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
|
|
7554
|
+
let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
7555
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
7556
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
7557
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
7558
|
+
while (desperate_split_attempts.length) {
|
|
7559
|
+
const split_point_between_words = [];
|
|
7560
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
7561
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
7562
|
+
let is_first_character = true;
|
|
7563
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
7564
|
+
const segment = segmented_text[i];
|
|
7565
|
+
const text = segment.text_;
|
|
7566
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
7567
|
+
const character = text[j];
|
|
7568
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
7569
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
7570
|
+
split_point_between_words.push([i, j]);
|
|
7571
|
+
if (split_point_between_words.length > 3)
|
|
7572
|
+
// We can't find a split point, so we'll just split between words
|
|
7573
|
+
// 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
|
|
7574
|
+
return split_point_between_words[1];
|
|
7575
|
+
}
|
|
7576
|
+
}
|
|
7577
|
+
}
|
|
7578
|
+
}
|
|
7579
|
+
return [];
|
|
7580
|
+
}
|
|
7581
|
+
function $f3a159279dc1a8fb$var$cut_start(cut_left_of_index, segmented_text) {
|
|
7582
|
+
// Cut the start of the text to bring the first matching token
|
|
7583
|
+
let is_first_character = false;
|
|
7584
|
+
let words_encountered = 0;
|
|
7585
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
7586
|
+
const segment = segmented_text[i];
|
|
7587
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
7588
|
+
const text = segment.text_;
|
|
7589
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
7590
|
+
const character = text[j];
|
|
7591
|
+
const is_space = character == " ";
|
|
7592
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
7593
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
7594
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
7595
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
7596
|
+
segmented_text.splice(0, i);
|
|
7597
|
+
if (character === "," || is_space)
|
|
7598
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
7599
|
+
segmented_text.unshift({
|
|
7600
|
+
text_: "… ",
|
|
7601
|
+
highlighted_: false
|
|
7602
|
+
});
|
|
7603
|
+
break outmost_loop;
|
|
7604
|
+
}
|
|
7605
|
+
if (is_first_character) is_first_character = false;
|
|
7606
|
+
}
|
|
7607
|
+
}
|
|
7608
|
+
$f3a159279dc1a8fb$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
7609
|
+
}
|
|
7610
|
+
|
|
7611
|
+
function $f3a159279dc1a8fb$var$segment_text(text, matched_strings) {
|
|
7612
|
+
// segment text where the matched strings are highlighted sections
|
|
7613
|
+
const output = [];
|
|
7614
|
+
if (!text) return; // shouldn't happen but whatever
|
|
7615
|
+
for (let i = 0; i < text.length; i++) {
|
|
7616
|
+
const found_strings = [];
|
|
7617
|
+
if (!i || text[i - 1] == " ")
|
|
7618
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
7619
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
7620
|
+
const matched_string = matched_strings[j];
|
|
7621
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
7622
|
+
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
7623
|
+
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
|
|
7624
|
+
}
|
|
7625
|
+
|
|
7626
|
+
const last_index_in_output = output.length - 1;
|
|
7627
|
+
if (!found_strings.length) {
|
|
7628
|
+
var _output$last_index_in;
|
|
7629
|
+
const character = text[i];
|
|
7630
|
+
if (((_output$last_index_in = output[last_index_in_output]) === null || _output$last_index_in === void 0 ? void 0 : _output$last_index_in.highlighted_) === false || output.length && /\s/.test(character))
|
|
7631
|
+
// 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
|
|
7632
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
7633
|
+
highlighted_: false,
|
|
7634
|
+
text_: character
|
|
7635
|
+
});
|
|
7636
|
+
} else {
|
|
7637
|
+
var _output$last_index_in2;
|
|
7638
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
7639
|
+
if ((_output$last_index_in2 = output[last_index_in_output]) !== null && _output$last_index_in2 !== void 0 && _output$last_index_in2.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
7640
|
+
highlighted_: true,
|
|
7641
|
+
text_: longest_found_string
|
|
7642
|
+
});
|
|
7643
|
+
i += longest_found_string.length - 1;
|
|
7644
|
+
}
|
|
7645
|
+
}
|
|
7646
|
+
return output;
|
|
7647
|
+
}
|
|
7648
|
+
const $22470de5f42cc35d$var$_tmpl$ = ["<div", ' class="description line-clamp">', "</div>"],
|
|
7649
|
+
$22470de5f42cc35d$var$_tmpl$2 = ["<div", ' class="content-card"><div class="image">', '</div><div class="info"><!--#-->', "<!--/--><!--#-->", "<!--/--></div></div>"];
|
|
7650
|
+
function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
|
|
7651
|
+
let {
|
|
7652
|
+
router_: router_,
|
|
7653
|
+
content_result_: content_result_
|
|
7654
|
+
} = _ref;
|
|
7655
|
+
const make_link_attributes = () => {
|
|
7656
|
+
const result = content_result_ === null || content_result_ === void 0 ? void 0 : content_result_();
|
|
7657
|
+
if (!result) return;
|
|
7658
|
+
return {
|
|
7659
|
+
href: result.page_url,
|
|
7660
|
+
onClick: (0, $b8hua$catchify)(ev => router_.navigate_.go_to_({
|
|
7661
|
+
new_url_: result.page_url,
|
|
7662
|
+
is_replace_: false,
|
|
7663
|
+
event_: ev
|
|
7664
|
+
}))
|
|
7665
|
+
};
|
|
7666
|
+
};
|
|
7667
|
+
const LinkIfPossible = _ref2 => {
|
|
7668
|
+
let {
|
|
7669
|
+
children: children,
|
|
7670
|
+
...attributes
|
|
7671
|
+
} = _ref2;
|
|
7672
|
+
if (content_result_) return (0, $b8hua$ssrElement)("a", attributes, () => (0, $b8hua$escape)(children), true);
|
|
7673
|
+
return (0, $b8hua$ssrElement)("div", attributes, () => (0, $b8hua$escape)(children), true);
|
|
7674
|
+
};
|
|
7675
|
+
return (0, $b8hua$ssr)($22470de5f42cc35d$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)(LinkIfPossible, (0, $b8hua$mergeProps)(make_link_attributes, {
|
|
7676
|
+
tabIndex: "-1",
|
|
7677
|
+
get children() {
|
|
7678
|
+
return (0, $b8hua$createComponent)((0, $3c5e15c6ee4227a9$export$605674723bcc715c), {
|
|
7679
|
+
width: "28",
|
|
7680
|
+
height: "28"
|
|
7681
|
+
});
|
|
7682
|
+
}
|
|
7683
|
+
}))), (0, $b8hua$escape)((0, $b8hua$createComponent)(LinkIfPossible, (0, $b8hua$mergeProps)({
|
|
7684
|
+
"class": "content-title line-clamp"
|
|
7685
|
+
}, make_link_attributes, {
|
|
7686
|
+
get title() {
|
|
7687
|
+
return content_result_ === null || content_result_ === void 0 ? void 0 : content_result_().title;
|
|
7688
|
+
},
|
|
7689
|
+
get children() {
|
|
7690
|
+
return content_result_ ? (0, $b8hua$createComponent)((0, $f3a159279dc1a8fb$export$e1a98a189fd2c0e7), {
|
|
7691
|
+
content_result_: content_result_,
|
|
7692
|
+
key_: "title",
|
|
7693
|
+
cut_when_possible_: false
|
|
7694
|
+
}) : (0, $b8hua$createComponent)((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
|
|
7695
|
+
height: "1em",
|
|
7696
|
+
width: "20ch"
|
|
7697
|
+
});
|
|
7698
|
+
}
|
|
7699
|
+
}))), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
7700
|
+
get when() {
|
|
7701
|
+
return (content_result_ === null || content_result_ === void 0 ? void 0 : content_result_().description) || !content_result_;
|
|
7702
|
+
},
|
|
7703
|
+
get children() {
|
|
7704
|
+
return (0, $b8hua$ssr)($22470de5f42cc35d$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
7705
|
+
when: content_result_,
|
|
7706
|
+
get fallback() {
|
|
7707
|
+
return Array.from({
|
|
7708
|
+
length: 4
|
|
7709
|
+
}).map(() => (0, $b8hua$createComponent)((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
|
|
7710
|
+
height: "1em",
|
|
7711
|
+
width: "min(50ch, 100%)"
|
|
7712
|
+
}));
|
|
7713
|
+
},
|
|
7714
|
+
get children() {
|
|
7715
|
+
return (0, $b8hua$createComponent)((0, $f3a159279dc1a8fb$export$e1a98a189fd2c0e7), {
|
|
7716
|
+
content_result_: content_result_,
|
|
7717
|
+
key_: "description",
|
|
7718
|
+
cut_when_possible_: true
|
|
7719
|
+
});
|
|
7720
|
+
}
|
|
7721
|
+
})));
|
|
7722
|
+
}
|
|
7723
|
+
})));
|
|
7724
|
+
}
|
|
7725
|
+
function $881e8953a9103f10$export$9ff751cd77687edc(_ref) {
|
|
7726
|
+
let {
|
|
7727
|
+
search_results_: search_results_,
|
|
7728
|
+
router_: router_
|
|
7729
|
+
} = _ref;
|
|
7730
|
+
const content_results = (0, $b8hua$createMemo)(() => {
|
|
7731
|
+
var _search_results_;
|
|
7732
|
+
return (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.content_search_links;
|
|
7733
|
+
});
|
|
7734
|
+
const content_results_by_page_url = (0, $b8hua$createMemo)(() => {
|
|
7735
|
+
const map = new Map();
|
|
7736
|
+
const results = content_results();
|
|
7737
|
+
if (!results) return map;
|
|
7738
|
+
for (let i = 0; i < results.length; i++) {
|
|
7739
|
+
const content_result = results[i];
|
|
7740
|
+
map.set(content_result.page_url, content_result);
|
|
7741
|
+
}
|
|
7742
|
+
return map;
|
|
7743
|
+
});
|
|
7744
|
+
return (0, $b8hua$createComponent)((0, $b8hua$For), {
|
|
7745
|
+
get each() {
|
|
7746
|
+
return [...content_results_by_page_url().keys()];
|
|
7747
|
+
},
|
|
7748
|
+
children: page_url => {
|
|
7749
|
+
const content_result = (0, $b8hua$createMemo)(() => content_results_by_page_url().get(page_url));
|
|
7750
|
+
return (0, $b8hua$createComponent)((0, $22470de5f42cc35d$export$f631859cab12b342), {
|
|
7751
|
+
content_result_: content_result,
|
|
7752
|
+
router_: router_
|
|
7753
|
+
});
|
|
7754
|
+
}
|
|
7755
|
+
});
|
|
7756
|
+
}
|
|
7757
|
+
function $ad4f3c9872fbeb48$export$4405d077f0a20494(_ref) {
|
|
7758
|
+
let {
|
|
7759
|
+
content_results_rows_: [get_history_state_content_results_rows],
|
|
7760
|
+
cols_at_size_: cols_at_size_
|
|
7761
|
+
} = _ref;
|
|
7762
|
+
const largest_column = (0, $b8hua$createMemo)(() => {
|
|
7763
|
+
const largest_in_cols_at_size = Math.max(...cols_at_size_().map(_ref2 => {
|
|
7764
|
+
let [cols] = _ref2;
|
|
7765
|
+
return cols;
|
|
7766
|
+
}));
|
|
7767
|
+
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
|
|
7768
|
+
return largest_in_cols_at_size;
|
|
7769
|
+
});
|
|
7770
|
+
const num_placeholders = (0, $b8hua$createMemo)(() => {
|
|
7771
|
+
var _get_history_state_co;
|
|
7772
|
+
return ((_get_history_state_co = get_history_state_content_results_rows()) !== null && _get_history_state_co !== void 0 ? _get_history_state_co : (0, $d53ebed6f63304e4$export$70ceae36059a1036)) * largest_column();
|
|
7773
|
+
});
|
|
7774
|
+
return (0, $b8hua$createComponent)((0, $b8hua$Index), {
|
|
7775
|
+
get each() {
|
|
7776
|
+
return Array.from({
|
|
7777
|
+
length: num_placeholders()
|
|
7778
|
+
});
|
|
7779
|
+
},
|
|
7780
|
+
children: () => (0, $b8hua$createComponent)((0, $22470de5f42cc35d$export$f631859cab12b342), {})
|
|
7781
|
+
});
|
|
7782
|
+
}
|
|
7783
|
+
const $d53ebed6f63304e4$var$_tmpl$ = ["<div", ' class="', '" style="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
7784
|
+
$d53ebed6f63304e4$var$_tmpl$2 = ["<button", ' class="view-more">', "</button>"],
|
|
7785
|
+
$d53ebed6f63304e4$var$_tmpl$3 = ["<button", ' class="view-less">', "</button>"];
|
|
7786
|
+
const $d53ebed6f63304e4$export$70ceae36059a1036 = 1;
|
|
7787
|
+
function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
|
|
7788
|
+
var _content_results2;
|
|
7789
|
+
let {
|
|
7790
|
+
search_results_: search_results_,
|
|
7791
|
+
get_search_query_: get_search_query_,
|
|
7792
|
+
i18n_: i18n_,
|
|
7793
|
+
layout_options_: layout_options_,
|
|
7794
|
+
router_: router_,
|
|
7795
|
+
query_base_: query_base_,
|
|
7796
|
+
content_results_rows_: content_results_rows_
|
|
7797
|
+
} = _ref;
|
|
7798
|
+
const content_results = (0, $b8hua$createMemo)(() => {
|
|
7799
|
+
var _search_results_;
|
|
7800
|
+
return (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.content_search_links;
|
|
7801
|
+
});
|
|
7802
|
+
const num_results = (0, $b8hua$createMemo)(() => {
|
|
7803
|
+
var _content_results;
|
|
7804
|
+
return (_content_results = content_results()) === null || _content_results === void 0 ? void 0 : _content_results.length;
|
|
7805
|
+
});
|
|
7806
|
+
const is_loading_ = (0, $b8hua$createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
|
|
7807
|
+
const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
|
|
7808
|
+
number_: num_results,
|
|
7809
|
+
i18n_: i18n_
|
|
7810
|
+
});
|
|
7811
|
+
const [is_showing_placeholders, set_is_showing_placeholders] = (0, $b8hua$createSignal)(false);
|
|
7812
|
+
const rows_object = $d53ebed6f63304e4$var$make_state_saved_rows(content_results_rows_, i18n_);
|
|
7813
|
+
return (0, $b8hua$ssr)($d53ebed6f63304e4$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "content-results ".concat(is_showing_placeholders() ? "loading" : ""), "display:" + (is_loading_() || ((_content_results2 = content_results()) === null || _content_results2 === void 0 ? void 0 : _content_results2.length) > 0 ? "" : "none"), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), {
|
|
7814
|
+
get_search_query_: get_search_query_,
|
|
7815
|
+
i18n_: i18n_,
|
|
7816
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
7817
|
+
get type() {
|
|
7818
|
+
return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).content;
|
|
7819
|
+
},
|
|
7820
|
+
number_of_results_: num_results
|
|
7821
|
+
})), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), (0, $b8hua$mergeProps)({
|
|
7822
|
+
layout: "grid",
|
|
7823
|
+
element_attributes: {
|
|
7824
|
+
class: "cards"
|
|
7825
|
+
}
|
|
7826
|
+
}, layout_options_, {
|
|
7827
|
+
rows: rows_object,
|
|
7828
|
+
get children() {
|
|
7829
|
+
return (0, $b8hua$createComponent)((0, $b8hua$Suspense), {
|
|
7830
|
+
get fallback() {
|
|
7831
|
+
return (() => {
|
|
7832
|
+
set_is_showing_placeholders(true);
|
|
7833
|
+
(0, $b8hua$onCleanup)(() => set_is_showing_placeholders(false));
|
|
7834
|
+
return (0, $b8hua$createComponent)((0, $ad4f3c9872fbeb48$export$4405d077f0a20494), {
|
|
7835
|
+
content_results_rows_: content_results_rows_,
|
|
7836
|
+
get cols_at_size_() {
|
|
7837
|
+
return (0, $b8hua$createMemo)(() => layout_options_().cols_at_size);
|
|
7838
|
+
}
|
|
7839
|
+
});
|
|
7840
|
+
})();
|
|
7841
|
+
},
|
|
7842
|
+
get children() {
|
|
7843
|
+
return (0, $b8hua$createComponent)((0, $881e8953a9103f10$export$9ff751cd77687edc), {
|
|
7844
|
+
router_: router_,
|
|
7845
|
+
search_results_: search_results_
|
|
7846
|
+
});
|
|
7847
|
+
}
|
|
7848
|
+
});
|
|
7849
|
+
}
|
|
7850
|
+
}))));
|
|
7851
|
+
}
|
|
7852
|
+
function $d53ebed6f63304e4$var$make_state_saved_rows(_ref2, i18n_) {
|
|
7853
|
+
let [get_showing_content_results_rows, set_showing_content_results_rows] = _ref2;
|
|
7854
|
+
const currently_visible = (0, $b8hua$createSignal)((0, $b8hua$untrack)(get_showing_content_results_rows));
|
|
7855
|
+
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
7856
|
+
const rows = {
|
|
7857
|
+
currently_visible: currently_visible,
|
|
7858
|
+
start_rows: $d53ebed6f63304e4$export$70ceae36059a1036,
|
|
7859
|
+
button: (0, $b8hua$ssr)($d53ebed6f63304e4$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.view_more_())),
|
|
7860
|
+
view_less_button: (0, $b8hua$ssr)($d53ebed6f63304e4$var$_tmpl$3, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.view_less_())),
|
|
7861
|
+
rows_per_click: 3
|
|
7862
|
+
};
|
|
7863
|
+
(0, $b8hua$createComputed)((0, $b8hua$on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
|
|
7864
|
+
defer: true
|
|
7865
|
+
}));
|
|
7866
|
+
(0, $b8hua$createComputed)((0, $b8hua$on)(get_showing_content_results_rows, function () {
|
|
7867
|
+
let new_rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $d53ebed6f63304e4$export$70ceae36059a1036;
|
|
7868
|
+
return set_currently_visible(new_rows);
|
|
7869
|
+
}, {
|
|
7870
|
+
defer: true
|
|
7871
|
+
}));
|
|
7872
|
+
return rows;
|
|
7873
|
+
}
|
|
7253
7874
|
const $da279c5a540c6846$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
|
|
7254
|
-
$da279c5a540c6846$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
|
|
7875
|
+
$da279c5a540c6846$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
|
|
7255
7876
|
function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
7256
7877
|
let {
|
|
7257
7878
|
depict_api_: depict_api_,
|
|
@@ -7281,7 +7902,11 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
7281
7902
|
recommendations_layout_options_: recommendations_layout_options_,
|
|
7282
7903
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
7283
7904
|
product_card_template_: product_card_template_,
|
|
7284
|
-
modal_body_style_ref_: modal_body_style_ref_
|
|
7905
|
+
modal_body_style_ref_: modal_body_style_ref_,
|
|
7906
|
+
router_: router_,
|
|
7907
|
+
content_results_rows_: content_results_rows_,
|
|
7908
|
+
content_layout_options_: content_layout_options_,
|
|
7909
|
+
content_search_enabled_: content_search_enabled_
|
|
7285
7910
|
} = _ref;
|
|
7286
7911
|
const [get_sorting] = current_sorting_;
|
|
7287
7912
|
const all_products_loaded_ = (0, $b8hua$createSignal)(false);
|
|
@@ -7348,16 +7973,29 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
7348
7973
|
const SafeSearchField = (0, $b8hua$catchify)((0, $584c06c09cf4609d$export$b94867ecbd698f21));
|
|
7349
7974
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $b8hua$createSignal)(false);
|
|
7350
7975
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $b8hua$createSignal)();
|
|
7976
|
+
const n_hits = (0, $b8hua$createMemo)(() => {
|
|
7977
|
+
var _search_results_3;
|
|
7978
|
+
return (_search_results_3 = search_results_()) === null || _search_results_3 === void 0 ? void 0 : _search_results_3.n_hits;
|
|
7979
|
+
});
|
|
7351
7980
|
const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
|
|
7352
|
-
|
|
7981
|
+
number_: n_hits,
|
|
7353
7982
|
i18n_: i18n_
|
|
7354
7983
|
});
|
|
7355
7984
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $b8hua$createSignal)();
|
|
7356
|
-
const
|
|
7985
|
+
const no_results_text_ = (0, $b8hua$createMemo)(() => {
|
|
7986
|
+
var _search_results_4, _search_results_4$con;
|
|
7987
|
+
return ((_search_results_4 = search_results_()) !== null && _search_results_4 !== void 0 && (_search_results_4$con = _search_results_4.content_search_links) !== null && _search_results_4$con !== void 0 && _search_results_4$con.length ? i18n_.no_products_ : i18n_.no_results_text_)();
|
|
7988
|
+
});
|
|
7989
|
+
const results_for = (0, $b8hua$createComponent)((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), (0, $b8hua$mergeProps)({
|
|
7990
|
+
get type() {
|
|
7991
|
+
return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).products;
|
|
7992
|
+
},
|
|
7993
|
+
number_of_results_: n_hits
|
|
7994
|
+
}, {
|
|
7357
7995
|
get_search_query_: get_search_query_,
|
|
7358
7996
|
i18n_: i18n_,
|
|
7359
7997
|
formatted_number_of_results_: formatted_number_of_results_
|
|
7360
|
-
});
|
|
7998
|
+
}));
|
|
7361
7999
|
const filters_opener = (0, $7396052a1484264f$export$d7841e452f2e59a8)({
|
|
7362
8000
|
set_sort_or_filter_open_: set_sort_or_filter_open_,
|
|
7363
8001
|
set_extra_els_in_results_container_: set_desktop_filter_elements,
|
|
@@ -7466,7 +8104,28 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
7466
8104
|
children: make_category_suggestion_card_
|
|
7467
8105
|
});
|
|
7468
8106
|
}
|
|
7469
|
-
})) : (0, $b8hua$escape)(null), (0, $b8hua$escape)(
|
|
8107
|
+
})) : (0, $b8hua$escape)(null), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
8108
|
+
severity_: "error",
|
|
8109
|
+
message_: "ContentResults failed",
|
|
8110
|
+
get children() {
|
|
8111
|
+
return (0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
8112
|
+
get when() {
|
|
8113
|
+
return content_search_enabled_();
|
|
8114
|
+
},
|
|
8115
|
+
get children() {
|
|
8116
|
+
return (0, $b8hua$createComponent)((0, $d53ebed6f63304e4$export$6d0c9c22f6652669), {
|
|
8117
|
+
content_results_rows_: content_results_rows_,
|
|
8118
|
+
search_results_: search_results_,
|
|
8119
|
+
i18n_: i18n_,
|
|
8120
|
+
get_search_query_: get_search_query_,
|
|
8121
|
+
layout_options_: content_layout_options_,
|
|
8122
|
+
router_: router_,
|
|
8123
|
+
query_base_: search_query_base_
|
|
8124
|
+
});
|
|
8125
|
+
}
|
|
8126
|
+
});
|
|
8127
|
+
}
|
|
8128
|
+
})), (0, $b8hua$escape)(results_filters[0]()), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
|
|
7470
8129
|
get when() {
|
|
7471
8130
|
var _selected_filters_$;
|
|
7472
8131
|
return (_selected_filters_$ = selected_filters_[0]()) === null || _selected_filters_$ === void 0 ? void 0 : _selected_filters_$.length;
|
|
@@ -7511,7 +8170,10 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
7511
8170
|
selected_filters_: selected_filters_,
|
|
7512
8171
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
7513
8172
|
local_filter_cache_: local_filter_cache_,
|
|
7514
|
-
i18n_:
|
|
8173
|
+
i18n_: {
|
|
8174
|
+
...i18n_,
|
|
8175
|
+
no_results_text_: no_results_text_
|
|
8176
|
+
}
|
|
7515
8177
|
}
|
|
7516
8178
|
});
|
|
7517
8179
|
}
|
|
@@ -7552,8 +8214,8 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
7552
8214
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
7553
8215
|
i18n_: i18n_,
|
|
7554
8216
|
number_of_results_: (0, $b8hua$createMemo)(() => {
|
|
7555
|
-
var
|
|
7556
|
-
return (
|
|
8217
|
+
var _search_results_5;
|
|
8218
|
+
return (_search_results_5 = search_results_()) === null || _search_results_5 === void 0 ? void 0 : _search_results_5.n_hits;
|
|
7557
8219
|
})
|
|
7558
8220
|
});
|
|
7559
8221
|
}
|
|
@@ -7591,6 +8253,38 @@ function $37e8c97bb6876197$export$828dcdd425fd3231(aligner) {
|
|
|
7591
8253
|
cleanup: cleanup
|
|
7592
8254
|
};
|
|
7593
8255
|
}
|
|
8256
|
+
|
|
8257
|
+
/**
|
|
8258
|
+
* 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
|
|
8259
|
+
*/
|
|
8260
|
+
function $3f7203368ad0d3ca$export$ff7109b9b2b206ba(sdk_cols_at_size) {
|
|
8261
|
+
let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
8262
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
8263
|
+
const sorted_sizes = sdk_cols_at_size.map(_ref => {
|
|
8264
|
+
let [cols, max_width] = _ref;
|
|
8265
|
+
return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
|
|
8266
|
+
}).sort((_ref2, _ref3) => {
|
|
8267
|
+
let [, a] = _ref2;
|
|
8268
|
+
let [, b] = _ref3;
|
|
8269
|
+
return a - b;
|
|
8270
|
+
});
|
|
8271
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
8272
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
8273
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
8274
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
8275
|
+
const to_delete = [];
|
|
8276
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
8277
|
+
const [, max_width] = sorted_sizes[i];
|
|
8278
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
8279
|
+
to_delete.push(i);
|
|
8280
|
+
}
|
|
8281
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
8282
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
8283
|
+
return sorted_sizes.map(_ref4 => {
|
|
8284
|
+
let [cols, max_width] = _ref4;
|
|
8285
|
+
return max_width == Infinity ? [cols] : [cols, max_width];
|
|
8286
|
+
});
|
|
8287
|
+
}
|
|
7594
8288
|
const $eb064bc3350276c1$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
|
|
7595
8289
|
function $eb064bc3350276c1$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
7596
8290
|
$eb064bc3350276c1$var$_checkPrivateRedeclaration(obj, privateMap);
|
|
@@ -7622,6 +8316,7 @@ function $eb064bc3350276c1$var$_classApplyDescriptorGet(receiver, descriptor) {
|
|
|
7622
8316
|
* 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.
|
|
7623
8317
|
*/
|
|
7624
8318
|
const $eb064bc3350276c1$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
|
|
8319
|
+
const $eb064bc3350276c1$var$content_search_default = false;
|
|
7625
8320
|
const $eb064bc3350276c1$var$min_products_to_fetch_ = 20;
|
|
7626
8321
|
const $eb064bc3350276c1$export$bde3eb976dfded9 = depict_search => {
|
|
7627
8322
|
var _privately_shared_pro;
|
|
@@ -7631,6 +8326,7 @@ var $eb064bc3350276c1$var$_locale_signal = /*#__PURE__*/new WeakMap();
|
|
|
7631
8326
|
var $eb064bc3350276c1$var$_merchant_signal = /*#__PURE__*/new WeakMap();
|
|
7632
8327
|
var $eb064bc3350276c1$var$_market_signal = /*#__PURE__*/new WeakMap();
|
|
7633
8328
|
var $eb064bc3350276c1$var$_modal_open_signal = /*#__PURE__*/new WeakMap();
|
|
8329
|
+
var $eb064bc3350276c1$var$_content_search_signal = /*#__PURE__*/new WeakMap();
|
|
7634
8330
|
var $eb064bc3350276c1$var$_router = /*#__PURE__*/new WeakMap();
|
|
7635
8331
|
class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
7636
8332
|
constructor(_ref) {
|
|
@@ -7642,9 +8338,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
7642
8338
|
on_navigation: on_navigation,
|
|
7643
8339
|
enable_category_suggestions = true,
|
|
7644
8340
|
page_url_creator: page_url_creator,
|
|
8341
|
+
display_transformers: display_transformers,
|
|
8342
|
+
api: api,
|
|
7645
8343
|
// Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
7646
8344
|
disable_scrolling_during_modal = true,
|
|
7647
|
-
api: api,
|
|
7648
8345
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
7649
8346
|
render_instant_card: render_instant_card,
|
|
7650
8347
|
...props_on_class
|
|
@@ -7665,6 +8362,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
7665
8362
|
writable: true,
|
|
7666
8363
|
value: (0, $b8hua$createSignal)(false)
|
|
7667
8364
|
});
|
|
8365
|
+
$eb064bc3350276c1$var$_classPrivateFieldInitSpec(this, $eb064bc3350276c1$var$_content_search_signal, {
|
|
8366
|
+
writable: true,
|
|
8367
|
+
value: (0, $b8hua$createSignal)()
|
|
8368
|
+
});
|
|
7668
8369
|
$eb064bc3350276c1$var$_classPrivateFieldInitSpec(this, $eb064bc3350276c1$var$_router, {
|
|
7669
8370
|
writable: true,
|
|
7670
8371
|
value: new (0, $ac571292d606f30b$export$7e1297a3a19f10d8)("hard_navigation")
|
|
@@ -7700,6 +8401,7 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
7700
8401
|
local_filter_cache: [],
|
|
7701
8402
|
expanded_hierarchical_filters: [],
|
|
7702
8403
|
showing_recommendation_rows: (0, $8ef6232475d44150$export$1c8c715550dc689d),
|
|
8404
|
+
content_results_rows: (0, $d53ebed6f63304e4$export$70ceae36059a1036),
|
|
7703
8405
|
scroll_restoration_data: []
|
|
7704
8406
|
};
|
|
7705
8407
|
},
|
|
@@ -7711,12 +8413,18 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
7711
8413
|
const get_search_query_ = (0, $b8hua$createMemo)(previous_value => {
|
|
7712
8414
|
if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
|
|
7713
8415
|
});
|
|
8416
|
+
// @ts-ignore
|
|
7714
8417
|
const depict_api_ = api !== null && api !== void 0 ? api : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)({
|
|
7715
|
-
page_url_creator: page_url_creator
|
|
8418
|
+
page_url_creator: page_url_creator,
|
|
8419
|
+
display_transformers: display_transformers
|
|
7716
8420
|
});
|
|
7717
8421
|
const previous_searches = (0, $07d90b8270ece8de$export$84bba84a7b837187)(get_search_query_);
|
|
7718
8422
|
const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
|
|
7719
|
-
const
|
|
8423
|
+
const [, set_search_content_results_rows] = state_.content_results_rows;
|
|
8424
|
+
const after_submit_ = () => {
|
|
8425
|
+
set_search_showing_recommendation_rows((0, $8ef6232475d44150$export$1c8c715550dc689d));
|
|
8426
|
+
set_search_content_results_rows((0, $d53ebed6f63304e4$export$70ceae36059a1036));
|
|
8427
|
+
}; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
7720
8428
|
const on_submit_with_unchanged_value_ = () => this.modal_open = false;
|
|
7721
8429
|
const [get_search_field_value_, set_search_field_value_] = state_.field_value;
|
|
7722
8430
|
const configured_submit_query_ = new_query => (0, $86b0ff0c85e5fc6c$export$e16630ecb9644a1c)({
|
|
@@ -7774,6 +8482,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
7774
8482
|
submit_query_: configured_submit_query_,
|
|
7775
8483
|
url_transformer_: url_transformer,
|
|
7776
8484
|
router_: (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_router),
|
|
8485
|
+
content_search_enabled_: () => {
|
|
8486
|
+
var _classPrivateFieldGet2;
|
|
8487
|
+
return (_classPrivateFieldGet2 = (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[0]()) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : $eb064bc3350276c1$var$content_search_default;
|
|
8488
|
+
},
|
|
7777
8489
|
instant_results_options_: {
|
|
7778
8490
|
min_products_to_fetch_: $eb064bc3350276c1$var$min_products_to_fetch_,
|
|
7779
8491
|
render_instant_card_: render_instant_card,
|
|
@@ -7842,6 +8554,12 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
7842
8554
|
(0, $b8hua$onCleanup)(() => $eb064bc3350276c1$var$_classStaticPrivateFieldSpecGet($eb064bc3350276c1$export$ac6237957a15b3f0, $eb064bc3350276c1$export$ac6237957a15b3f0, $eb064bc3350276c1$var$_keys_constructed_with).delete(unique_instance_key_for_state));
|
|
7843
8555
|
});
|
|
7844
8556
|
}
|
|
8557
|
+
get enable_content_search() {
|
|
8558
|
+
return (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[0]();
|
|
8559
|
+
}
|
|
8560
|
+
set enable_content_search(new_state) {
|
|
8561
|
+
(0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[1](new_state);
|
|
8562
|
+
}
|
|
7845
8563
|
get on_navigation() {
|
|
7846
8564
|
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
7847
8565
|
return (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_router).on_navigation_;
|
|
@@ -7928,6 +8646,10 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
|
|
|
7928
8646
|
depict_api_: shared_properties.depict_api_,
|
|
7929
8647
|
min_products_to_fetch_: $eb064bc3350276c1$var$min_products_to_fetch_,
|
|
7930
8648
|
local_filter_cache_: state_.local_filter_cache,
|
|
8649
|
+
content_search_enabled_: () => {
|
|
8650
|
+
var _depict_search$enable;
|
|
8651
|
+
return (_depict_search$enable = depict_search.enable_content_search) !== null && _depict_search$enable !== void 0 ? _depict_search$enable : $eb064bc3350276c1$var$content_search_default;
|
|
8652
|
+
},
|
|
7931
8653
|
search_field_value_: state_.field_value,
|
|
7932
8654
|
get_search_query_: shared_properties.get_search_query_,
|
|
7933
8655
|
clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
|
|
@@ -7957,6 +8679,8 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
|
|
|
7957
8679
|
search_filters_open_: state_.filters_open,
|
|
7958
8680
|
search_sorting_open_: state_.sorting_open,
|
|
7959
8681
|
expanded_filters_: state_.expanded_filters,
|
|
8682
|
+
content_results_rows_: state_.content_results_rows,
|
|
8683
|
+
router_: shared_properties.router_,
|
|
7960
8684
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
7961
8685
|
return (0, $dea31647b99a443b$export$d757d54550ebfb3d)({
|
|
7962
8686
|
category_suggestion_: category_suggestion_,
|
|
@@ -7972,6 +8696,10 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
|
|
|
7972
8696
|
cols_at_size: (0, $a9c7ba6087881ac2$export$6daf8749b65a1b77)(props.cols_at_size),
|
|
7973
8697
|
...grid_spacing_override()
|
|
7974
8698
|
})),
|
|
8699
|
+
content_layout_options_: (0, $b8hua$createMemo)(() => ({
|
|
8700
|
+
cols_at_size: (0, $a9c7ba6087881ac2$export$6daf8749b65a1b77)((0, $3f7203368ad0d3ca$export$ff7109b9b2b206ba)(props.cols_at_size)),
|
|
8701
|
+
...grid_spacing_override()
|
|
8702
|
+
})),
|
|
7975
8703
|
recommendations_layout_options_: (0, $b8hua$createMemo)(() => {
|
|
7976
8704
|
const {
|
|
7977
8705
|
extra_depict_options: extra_depict_options
|