@depict-ai/ui 3.0.6 → 3.0.8
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 +119 -66
- package/ES10/index.d.ts +14 -6
- package/ES10/index.js +119 -66
- package/latest/index.cjs +112 -60
- package/latest/index.d.ts +14 -6
- package/latest/index.js +112 -60
- package/package.json +4 -4
- package/server/ES10/index.cjs +117 -65
- package/server/ES10/index.d.ts +14 -6
- package/server/ES10/index.js +117 -65
- package/server/latest/index.cjs +110 -59
- package/server/latest/index.d.ts +14 -6
- package/server/latest/index.js +110 -59
package/server/latest/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ColsAtSize, Display, ModernDisplay, Amazing_Slider, Node_Array, report,
|
|
|
2
2
|
import { JSX, Signal, Accessor, Setter } from "solid-js";
|
|
3
3
|
import { SearchFilter, SortModel, SearchRequestV3 } from "@depict-ai/types/api/SearchRequestV3";
|
|
4
4
|
import { ContentLink, SearchFilter as _SearchFilter1, SearchResponse } from "@depict-ai/types/api/SearchResponse";
|
|
5
|
-
import { ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
5
|
+
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
6
6
|
import { ProductListing, GetListingResponse } from "@depict-ai/types/api/GetListingResponse";
|
|
7
7
|
import { ProductListingResponseV3 } from "@depict-ai/types/api/ProductListingResponseV3";
|
|
8
8
|
import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
|
|
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
|
|
|
10
10
|
import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
|
|
13
|
-
export const version = "3.0.
|
|
13
|
+
export const version = "3.0.8";
|
|
14
14
|
export type SDKColsAtSize = [number, number?][];
|
|
15
15
|
/**
|
|
16
16
|
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
@@ -40,11 +40,15 @@ type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends u
|
|
|
40
40
|
type DisplayTransformerAlwaysThereData = {
|
|
41
41
|
merchant: string;
|
|
42
42
|
market: string;
|
|
43
|
+
locale: string;
|
|
43
44
|
};
|
|
44
45
|
type CanBePromiseWrapped<T> = T | Promise<T>;
|
|
45
46
|
export type ModernDisplayWithPageUrl<T extends ModernDisplay> = { [K in keyof T]: K extends "variant_displays" ? (T[K][number] & {
|
|
46
47
|
page_url: string;
|
|
47
48
|
})[] : T[K] };
|
|
49
|
+
type ProductListingWithAncestors = ProductListing & {
|
|
50
|
+
ancestors: Ancestors;
|
|
51
|
+
};
|
|
48
52
|
/**
|
|
49
53
|
* DisplayTransformers supersede pageURLCreator
|
|
50
54
|
* DisplayTransformers are functions that take in a list of categories, content search results or products and then can transform or enrich the data for each category, content search result or product card in a batched way.
|
|
@@ -53,7 +57,7 @@ export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDispla
|
|
|
53
57
|
products?: (options: DisplayTransformerAlwaysThereData & {
|
|
54
58
|
displays: InputDisplay[];
|
|
55
59
|
}) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
|
|
56
|
-
categories?: <T extends
|
|
60
|
+
categories?: <T extends ProductListingWithAncestors | ListingSuggestion>(options: DisplayTransformerAlwaysThereData & {
|
|
57
61
|
data: T[];
|
|
58
62
|
}) => CanBePromiseWrapped<(T & {
|
|
59
63
|
page_url: string;
|
|
@@ -825,7 +829,11 @@ type _AddPageUrlToDisplay1<T extends any[]> = (T[number] & {
|
|
|
825
829
|
page_url: string;
|
|
826
830
|
})[];
|
|
827
831
|
type ProductListingResponseAfterDisplayTransformer = { [K in keyof ProductListingResponseV3]: K extends "displays" ? _AddPageUrlToDisplay1<ProductListingResponseV3[K]> : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV3[K]> : ProductListingResponseV3[K] };
|
|
828
|
-
type GetListingResponseAfterDisplayTransformer = { [K in keyof
|
|
832
|
+
type GetListingResponseAfterDisplayTransformer = { [K in keyof GetListingResponseWithQuicklinksAndBreadcrumbs]: K extends "breadcrumbs" ? ProductListingWithPageURL[] : K extends "quick_links" ? ProductListingWithPageURL[] : GetListingResponseWithQuicklinksAndBreadcrumbs[K] };
|
|
833
|
+
type GetListingResponseWithQuicklinksAndBreadcrumbs = Omit<GetListingResponse, "siblings" | "ancestors" | "children"> & {
|
|
834
|
+
quick_links: ProductListingWithAncestors[];
|
|
835
|
+
breadcrumbs: ProductListingWithAncestors[];
|
|
836
|
+
};
|
|
829
837
|
type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
|
|
830
838
|
get_metadata?: () => Promise<{
|
|
831
839
|
[k: string]: string;
|
|
@@ -957,7 +965,7 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
|
|
|
957
965
|
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
958
966
|
on_listing_query_change?: (new_listing_query?: ListingQuery | undefined, old_listing_query?: ListingQuery | undefined) => void;
|
|
959
967
|
content_blocks_by_row?: ContentBlocksByRow;
|
|
960
|
-
}): import("@depict-ai/utilishared
|
|
968
|
+
}): import("@depict-ai/utilishared").Node_Array;
|
|
961
969
|
export function BreadCrumbs<T extends Display>({
|
|
962
970
|
depict_category
|
|
963
971
|
}: {
|
|
@@ -1109,7 +1117,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
|
|
|
1109
1117
|
* Open the modal with support for alignment.
|
|
1110
1118
|
* @returns {void}
|
|
1111
1119
|
*/
|
|
1112
|
-
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends
|
|
1120
|
+
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
|
|
1113
1121
|
export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
|
|
1114
1122
|
export interface PageReplacer {
|
|
1115
1123
|
readonly render_: () => Node_Array;
|
package/server/latest/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from
|
|
|
7
7
|
/*! Depict.ai search and product listing SDK */
|
|
8
8
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
9
9
|
register_es_version("ui", "latest");
|
|
10
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.8";
|
|
11
11
|
const $fbbadcb080ad1d4a$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
|
|
12
12
|
function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
|
|
13
13
|
return $i7OB2$ssr($fbbadcb080ad1d4a$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("width", $i7OB2$escape(props.width_, true) ?? 14, false) + $i7OB2$ssrAttribute("height", $i7OB2$escape(props.height_, true) ?? 26, false));
|
|
@@ -4389,6 +4389,65 @@ function $e5014ccd0b76d9f4$export$967e966fca9515e(api_response) {
|
|
|
4389
4389
|
// Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
|
|
4390
4390
|
const $c20599a0d81d953a$export$74ee7529ce0f8a00 = "listingId";
|
|
4391
4391
|
const $c20599a0d81d953a$export$5aae649db1b959fc = "externalId";
|
|
4392
|
+
|
|
4393
|
+
/**
|
|
4394
|
+
* Converts a v3 API response into something that has quick_links and breadcrumbs that behave as in v2 instead of ancestors, children and siblings, but gives every quicklink and breadcrumb's transformer the ancestors of the listing they are for.
|
|
4395
|
+
*/
|
|
4396
|
+
async function $23f4eb8487f328d9$export$d9792230b7c0203e({
|
|
4397
|
+
input_data_: {
|
|
4398
|
+
ancestors: ancestors,
|
|
4399
|
+
children: children,
|
|
4400
|
+
siblings: siblings,
|
|
4401
|
+
...clonedInputData
|
|
4402
|
+
},
|
|
4403
|
+
category_transformer_ = v => v.data,
|
|
4404
|
+
merchant_:
|
|
4405
|
+
// in case no display transformer just pass the data through, so we don't break
|
|
4406
|
+
merchant_,
|
|
4407
|
+
market_: market_,
|
|
4408
|
+
locale_: locale_
|
|
4409
|
+
}) {
|
|
4410
|
+
const breadcrumbs = [];
|
|
4411
|
+
const clonedAncestors = [...ancestors];
|
|
4412
|
+
while (clonedAncestors.length) {
|
|
4413
|
+
const ancestor = clonedAncestors.pop();
|
|
4414
|
+
if (!ancestor.show_in_breadcrumbs) continue;
|
|
4415
|
+
breadcrumbs.push({
|
|
4416
|
+
...ancestor,
|
|
4417
|
+
ancestors: [...clonedAncestors]
|
|
4418
|
+
});
|
|
4419
|
+
}
|
|
4420
|
+
breadcrumbs.reverse();
|
|
4421
|
+
const quicklinksIsChildren = children.length;
|
|
4422
|
+
const quickLinks = (quicklinksIsChildren ? children : siblings).filter(({
|
|
4423
|
+
show_in_quicklinks: show_in_quicklinks
|
|
4424
|
+
}) => show_in_quicklinks).map(productListing => {
|
|
4425
|
+
const ancestorsForUs = [...ancestors];
|
|
4426
|
+
if (quicklinksIsChildren) ancestorsForUs.push({
|
|
4427
|
+
...clonedInputData
|
|
4428
|
+
});
|
|
4429
|
+
return {
|
|
4430
|
+
...productListing,
|
|
4431
|
+
ancestors: ancestorsForUs
|
|
4432
|
+
};
|
|
4433
|
+
});
|
|
4434
|
+
const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
|
|
4435
|
+
merchant: merchant_,
|
|
4436
|
+
market: market_,
|
|
4437
|
+
locale: locale_,
|
|
4438
|
+
data: breadcrumbs
|
|
4439
|
+
}), category_transformer_({
|
|
4440
|
+
merchant: merchant_,
|
|
4441
|
+
market: market_,
|
|
4442
|
+
locale: locale_,
|
|
4443
|
+
data: quickLinks
|
|
4444
|
+
})]);
|
|
4445
|
+
return {
|
|
4446
|
+
...clonedInputData,
|
|
4447
|
+
breadcrumbs: transformedBreadcrumbs,
|
|
4448
|
+
quick_links: transformedQuickLinks
|
|
4449
|
+
};
|
|
4450
|
+
}
|
|
4392
4451
|
const $7fa23e2a0079eca4$var$v3_base_url = (0, $i7OB2$base_url) + "/v3/";
|
|
4393
4452
|
const $7fa23e2a0079eca4$var$search_base_url = $7fa23e2a0079eca4$var$v3_base_url + "search/";
|
|
4394
4453
|
class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
@@ -4414,20 +4473,32 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4414
4473
|
};
|
|
4415
4474
|
#get_metadata;
|
|
4416
4475
|
#get_session_id;
|
|
4417
|
-
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
4476
|
+
async #run_url_creator_for_suggest(merchant, market, locale, response) {
|
|
4418
4477
|
const category_transformer = this.display_transformers?.categories;
|
|
4419
4478
|
if (!category_transformer) return response;
|
|
4479
|
+
const incoming_suggestions = response.suggestions;
|
|
4480
|
+
const type_to_transform = "listing";
|
|
4420
4481
|
// find category suggestions, run thing with them, and then replace them
|
|
4421
|
-
const category_suggestions =
|
|
4422
|
-
const
|
|
4482
|
+
const category_suggestions = incoming_suggestions.filter(suggestion => suggestion.type === type_to_transform);
|
|
4483
|
+
const transformed_suggestions = [...(await category_transformer({
|
|
4423
4484
|
market: market,
|
|
4424
4485
|
merchant: merchant,
|
|
4486
|
+
locale: locale,
|
|
4425
4487
|
data: [...category_suggestions]
|
|
4426
|
-
});
|
|
4427
|
-
|
|
4488
|
+
}))];
|
|
4489
|
+
// Then add-back query suggestions at their original indices
|
|
4490
|
+
for (let i = 0; i < incoming_suggestions.length; i++) {
|
|
4491
|
+
const item = incoming_suggestions[i];
|
|
4492
|
+
if (item.type === type_to_transform) continue;
|
|
4493
|
+
transformed_suggestions.splice(i, 0, item);
|
|
4494
|
+
}
|
|
4495
|
+
response.suggestions = transformed_suggestions;
|
|
4428
4496
|
return response;
|
|
4429
4497
|
}
|
|
4430
|
-
|
|
4498
|
+
/**
|
|
4499
|
+
* rest = everything except query suggestions
|
|
4500
|
+
*/
|
|
4501
|
+
async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
|
|
4431
4502
|
const {
|
|
4432
4503
|
display_transformers: display_transformers
|
|
4433
4504
|
} = this;
|
|
@@ -4443,25 +4514,24 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4443
4514
|
const transformed_displays = await product_transformer({
|
|
4444
4515
|
merchant: merchant,
|
|
4445
4516
|
market: market,
|
|
4517
|
+
locale: locale,
|
|
4446
4518
|
displays: [...displays]
|
|
4447
4519
|
});
|
|
4448
4520
|
input_data.displays = transformed_displays;
|
|
4449
4521
|
}
|
|
4450
|
-
if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
|
|
4451
|
-
const category_display_array = input_data[key];
|
|
4452
|
-
if (!category_display_array) continue;
|
|
4453
|
-
const transformed_category_displays = await category_transformer({
|
|
4454
|
-
merchant: merchant,
|
|
4455
|
-
market: market,
|
|
4456
|
-
data: [...category_display_array]
|
|
4457
|
-
});
|
|
4458
|
-
input_data[key] = transformed_category_displays;
|
|
4459
|
-
}
|
|
4460
4522
|
if (content_search_links?.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
|
|
4461
4523
|
merchant: merchant,
|
|
4462
4524
|
market: market,
|
|
4525
|
+
locale: locale,
|
|
4463
4526
|
data: [...content_search_links]
|
|
4464
4527
|
});
|
|
4528
|
+
if (input_data.ancestors) return await $23f4eb8487f328d9$export$d9792230b7c0203e({
|
|
4529
|
+
input_data_: input_data,
|
|
4530
|
+
category_transformer_: category_transformer,
|
|
4531
|
+
merchant_: merchant,
|
|
4532
|
+
market_: market,
|
|
4533
|
+
locale_: locale
|
|
4534
|
+
});
|
|
4465
4535
|
return input_data;
|
|
4466
4536
|
}
|
|
4467
4537
|
async #cached_request({
|
|
@@ -4498,7 +4568,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4498
4568
|
let result;
|
|
4499
4569
|
try {
|
|
4500
4570
|
const unmodified_result = await api_response.json();
|
|
4501
|
-
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, unmodified_result);
|
|
4571
|
+
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
4502
4572
|
} catch (e) {
|
|
4503
4573
|
$i7OB2$dwarn("displayTransformer or json decoding failed", e);
|
|
4504
4574
|
break return_successfully;
|
|
@@ -4548,7 +4618,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4548
4618
|
const decoded_json = await results.json();
|
|
4549
4619
|
if (!Array.isArray(decoded_json?.suggestions)) break attempt_to_return_api_response;
|
|
4550
4620
|
try {
|
|
4551
|
-
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, decoded_json);
|
|
4621
|
+
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, input_req.locale, decoded_json);
|
|
4552
4622
|
} catch (e) {
|
|
4553
4623
|
$i7OB2$dwarn("displayTransformer failed", e);
|
|
4554
4624
|
}
|
|
@@ -4584,13 +4654,12 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4584
4654
|
fallback_response_: () => ({
|
|
4585
4655
|
listing_id: "",
|
|
4586
4656
|
listing_type: "category",
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
"quick_links": [],
|
|
4657
|
+
title: "",
|
|
4658
|
+
slug: "",
|
|
4659
|
+
show_in_breadcrumbs: false,
|
|
4660
|
+
show_in_quicklinks: false,
|
|
4661
|
+
breadcrumbs: [],
|
|
4662
|
+
quick_links: [],
|
|
4594
4663
|
failed: true
|
|
4595
4664
|
}),
|
|
4596
4665
|
method_: "GET"
|
|
@@ -6757,7 +6826,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
6757
6826
|
})));
|
|
6758
6827
|
const available_filters_ = $i7OB2$createMemo(() => plp_products_()?.filters);
|
|
6759
6828
|
const title = $i7OB2$createMemo(() => plp_meta()?.title);
|
|
6760
|
-
const crumb_data_ = $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta
|
|
6829
|
+
const crumb_data_ = $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta);
|
|
6761
6830
|
const quicklinks_data_ = $i7OB2$createMemo(() => plp_meta()?.quick_links);
|
|
6762
6831
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $i7OB2$createSignal(false);
|
|
6763
6832
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $i7OB2$createSignal();
|
|
@@ -6986,31 +7055,16 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
6986
7055
|
/**
|
|
6987
7056
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
6988
7057
|
*/
|
|
6989
|
-
function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta
|
|
7058
|
+
function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta) {
|
|
6990
7059
|
const href_accessor = $i7OB2$use_href_accessor();
|
|
6991
7060
|
return $i7OB2$createMemo(() => {
|
|
6992
7061
|
const api_value = plp_meta()?.breadcrumbs;
|
|
6993
7062
|
if (!api_value) return api_value;
|
|
6994
|
-
return [...api_value, {
|
|
6995
|
-
get listing_id() {
|
|
6996
|
-
return plp_meta().listing_id;
|
|
6997
|
-
},
|
|
6998
|
-
get title() {
|
|
6999
|
-
return title();
|
|
7000
|
-
},
|
|
7063
|
+
return [...api_value, $i7OB2$mergeProps1(plp_meta(), {
|
|
7001
7064
|
get page_url() {
|
|
7002
7065
|
return href_accessor();
|
|
7003
|
-
},
|
|
7004
|
-
get slug() {
|
|
7005
|
-
return plp_meta().slug;
|
|
7006
|
-
},
|
|
7007
|
-
get listing_type() {
|
|
7008
|
-
return plp_meta().listing_type;
|
|
7009
|
-
},
|
|
7010
|
-
get external_id() {
|
|
7011
|
-
return plp_meta().external_id;
|
|
7012
7066
|
}
|
|
7013
|
-
}];
|
|
7067
|
+
})];
|
|
7014
7068
|
});
|
|
7015
7069
|
}
|
|
7016
7070
|
function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
|
|
@@ -7589,7 +7643,7 @@ function $897bd4a76f611b38$export$d757d54550ebfb3d({
|
|
|
7589
7643
|
category_suggestion_: category_suggestion_,
|
|
7590
7644
|
router_: router_
|
|
7591
7645
|
}) {
|
|
7592
|
-
const parentTitle = $i7OB2$createMemo(() => category_suggestion_().
|
|
7646
|
+
const parentTitle = $i7OB2$createMemo(() => category_suggestion_().ancestors.at(-1)?.title);
|
|
7593
7647
|
return $i7OB2$ssr($897bd4a76f611b38$var$_tmpl$2, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("href", $i7OB2$escape(category_suggestion_().page_url, true), false), $i7OB2$escape(category_suggestion_().title), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
7594
7648
|
get when() {
|
|
7595
7649
|
return parentTitle();
|
|
@@ -8052,7 +8106,7 @@ function $7ad3a93cbe6fa208$export$a146ac6fa8346a25({
|
|
|
8052
8106
|
currently_showing_suggestions_[1](value => {
|
|
8053
8107
|
value[0] = $i7OB2$createMemo(() => previous_searches_().map(result => ({
|
|
8054
8108
|
type: (0, $a0eb8b431ec1f87b$export$3cf9497e790da491),
|
|
8055
|
-
|
|
8109
|
+
query: result,
|
|
8056
8110
|
suggestions_result_id: "history"
|
|
8057
8111
|
})));
|
|
8058
8112
|
return value;
|
|
@@ -8115,10 +8169,7 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
8115
8169
|
submit_query_: submit_query_,
|
|
8116
8170
|
get_content_results_: get_content_results_
|
|
8117
8171
|
}) {
|
|
8118
|
-
const queries_memo = $i7OB2$createMemo(() => suggestion_memo_().filter((
|
|
8119
|
-
type: type,
|
|
8120
|
-
title: title
|
|
8121
|
-
}) => type === (0, $a0eb8b431ec1f87b$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
8172
|
+
const queries_memo = $i7OB2$createMemo(() => suggestion_memo_().filter(suggestion => suggestion.type === (0, $a0eb8b431ec1f87b$export$3cf9497e790da491) && !filtered_previous_searches_().includes(suggestion.query) // don't show the ones we already show from the history
|
|
8122
8173
|
) // + limit to three query suggestions, API sends more sometimes
|
|
8123
8174
|
.slice(0, 3));
|
|
8124
8175
|
const not_queries_memo = $i7OB2$createMemo(() => {
|
|
@@ -8134,15 +8185,15 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
8134
8185
|
const is_query = $i7OB2$createMemo(() => input_obj().type === (0, $a0eb8b431ec1f87b$export$3cf9497e790da491));
|
|
8135
8186
|
const href_with_changed_params_accessor = $i7OB2$createMemo(() => is_query() ? $a36cbc4f68bfd590$export$91c3b6774e8be0f5({
|
|
8136
8187
|
param_: search_query_url_param_name_,
|
|
8137
|
-
value_: $i7OB2$createMemo(() => input_obj().
|
|
8188
|
+
value_: $i7OB2$createMemo(() => input_obj().query),
|
|
8138
8189
|
url_transformer_: url_transformer_
|
|
8139
8190
|
}) : undefined);
|
|
8140
8191
|
const href = $i7OB2$createMemo(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
8141
8192
|
const is_selected = $i7OB2$createMemo(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
8142
8193
|
const parent_title_if_exists = $i7OB2$createMemo(() => {
|
|
8143
8194
|
const item = input_obj();
|
|
8144
|
-
if (!("
|
|
8145
|
-
return item.
|
|
8195
|
+
if (!("ancestors" in item)) return;
|
|
8196
|
+
return item.ancestors.at(-1)?.title;
|
|
8146
8197
|
});
|
|
8147
8198
|
return $i7OB2$ssr($cea52f6b24092f05$var$_tmpl$, $i7OB2$ssrHydrationKey(), `suggestion ${is_selected() ? "selected" : ""} ${is_history ? "history" : ""} ${$i7OB2$escape($i7OB2$escape("type-" + input_obj().type, true), true)}`, $i7OB2$ssrAttribute("href", $i7OB2$escape(href(), true), false), is_query() ? $i7OB2$escape([$i7OB2$createComponent((0, $i7OB2$Show), {
|
|
8148
8199
|
when: is_history,
|
|
@@ -8155,7 +8206,7 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
8155
8206
|
}), $i7OB2$createComponent((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
8156
8207
|
class_: "value line-clamp",
|
|
8157
8208
|
get whole_text_to_display_() {
|
|
8158
|
-
return $i7OB2$createMemo(() => input_obj().
|
|
8209
|
+
return $i7OB2$createMemo(() => input_obj().query);
|
|
8159
8210
|
},
|
|
8160
8211
|
searching_for_value_: searching_for_value_
|
|
8161
8212
|
})]) : $i7OB2$escape([parent_title_if_exists() ? $i7OB2$ssr($cea52f6b24092f05$var$_tmpl$4, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createComponent((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
@@ -8224,7 +8275,7 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
8224
8275
|
return (() => {
|
|
8225
8276
|
const mapped_history_results = $i7OB2$createMemo(() => filtered_previous_searches_().map(result => ({
|
|
8226
8277
|
type: (0, $a0eb8b431ec1f87b$export$3cf9497e790da491),
|
|
8227
|
-
|
|
8278
|
+
query: result,
|
|
8228
8279
|
suggestions_result_id: "history" // worthless to fix typing
|
|
8229
8280
|
})));
|
|
8230
8281
|
|
|
@@ -8384,16 +8435,16 @@ function $15f380f0ce2812cc$var$actual_navigation_working_on_fake_data({
|
|
|
8384
8435
|
// update text field value if needed
|
|
8385
8436
|
if (selected_entry?.type == "query") {
|
|
8386
8437
|
const {
|
|
8387
|
-
|
|
8438
|
+
query: query
|
|
8388
8439
|
} = selected_entry;
|
|
8389
8440
|
$i7OB2$runWithOwner(owner, block_updating_for_one_change);
|
|
8390
|
-
set_search_field_value(
|
|
8441
|
+
set_search_field_value(query);
|
|
8391
8442
|
$i7OB2$runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|
|
8392
8443
|
// Open search query in new tab on cmd+enter
|
|
8393
8444
|
// 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 ;)
|
|
8394
8445
|
const url = new URL(location);
|
|
8395
8446
|
url_transformer_?.(url);
|
|
8396
|
-
url.searchParams.set(search_query_param_name_,
|
|
8447
|
+
url.searchParams.set(search_query_param_name_, query);
|
|
8397
8448
|
return $92a48aea6a9364d8$export$1efe1013da60d0e4(e, url.href);
|
|
8398
8449
|
}));
|
|
8399
8450
|
} else if (selected_entry?.type == "listing" || selected_entry?.type === "content") $i7OB2$runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|