@depict-ai/ui 3.0.6 → 3.0.7
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 +95 -45
- package/ES10/index.d.ts +12 -4
- package/ES10/index.js +95 -45
- package/latest/index.cjs +90 -44
- package/latest/index.d.ts +12 -4
- package/latest/index.js +90 -44
- package/package.json +4 -4
- package/server/ES10/index.cjs +95 -45
- package/server/ES10/index.d.ts +12 -4
- package/server/ES10/index.js +95 -45
- package/server/latest/index.cjs +90 -44
- package/server/latest/index.d.ts +12 -4
- package/server/latest/index.js +90 -44
package/server/latest/index.cjs
CHANGED
|
@@ -77,7 +77,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
77
77
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
78
78
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
79
79
|
/*! Depict.ai search and product listing SDK */
|
|
80
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.
|
|
80
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.7";
|
|
81
81
|
const $0f313083912e447a$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>'];
|
|
82
82
|
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
83
83
|
return $5vyXB$solidjsweb.ssr($0f313083912e447a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("width", $5vyXB$solidjsweb.escape(props.width_, true) ?? 14, false) + $5vyXB$solidjsweb.ssrAttribute("height", $5vyXB$solidjsweb.escape(props.height_, true) ?? 26, false));
|
|
@@ -4459,6 +4459,65 @@ function $67dc366d96177e70$export$967e966fca9515e(api_response) {
|
|
|
4459
4459
|
// Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
|
|
4460
4460
|
const $779741d0f266ea8c$export$74ee7529ce0f8a00 = "listingId";
|
|
4461
4461
|
const $779741d0f266ea8c$export$5aae649db1b959fc = "externalId";
|
|
4462
|
+
|
|
4463
|
+
/**
|
|
4464
|
+
* 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.
|
|
4465
|
+
*/
|
|
4466
|
+
async function $3a9f9f260c9bfc55$export$d9792230b7c0203e({
|
|
4467
|
+
input_data_: {
|
|
4468
|
+
ancestors: ancestors,
|
|
4469
|
+
children: children,
|
|
4470
|
+
siblings: siblings,
|
|
4471
|
+
...clonedInputData
|
|
4472
|
+
},
|
|
4473
|
+
category_transformer_ = v => v.data,
|
|
4474
|
+
merchant_:
|
|
4475
|
+
// in case no display transformer just pass the data through, so we don't break
|
|
4476
|
+
merchant_,
|
|
4477
|
+
market_: market_,
|
|
4478
|
+
locale_: locale_
|
|
4479
|
+
}) {
|
|
4480
|
+
const breadcrumbs = [];
|
|
4481
|
+
const clonedAncestors = [...ancestors];
|
|
4482
|
+
while (clonedAncestors.length) {
|
|
4483
|
+
const ancestor = clonedAncestors.pop();
|
|
4484
|
+
if (!ancestor.show_in_breadcrumbs) continue;
|
|
4485
|
+
breadcrumbs.push({
|
|
4486
|
+
...ancestor,
|
|
4487
|
+
ancestors: [...clonedAncestors]
|
|
4488
|
+
});
|
|
4489
|
+
}
|
|
4490
|
+
breadcrumbs.reverse();
|
|
4491
|
+
const quicklinksIsChildren = children.length;
|
|
4492
|
+
const quickLinks = (quicklinksIsChildren ? children : siblings).filter(({
|
|
4493
|
+
show_in_quicklinks: show_in_quicklinks
|
|
4494
|
+
}) => show_in_quicklinks).map(productListing => {
|
|
4495
|
+
const ancestorsForUs = [...ancestors];
|
|
4496
|
+
if (quicklinksIsChildren) ancestorsForUs.push({
|
|
4497
|
+
...clonedInputData
|
|
4498
|
+
});
|
|
4499
|
+
return {
|
|
4500
|
+
...productListing,
|
|
4501
|
+
ancestors: ancestorsForUs
|
|
4502
|
+
};
|
|
4503
|
+
});
|
|
4504
|
+
const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
|
|
4505
|
+
merchant: merchant_,
|
|
4506
|
+
market: market_,
|
|
4507
|
+
locale: locale_,
|
|
4508
|
+
data: breadcrumbs
|
|
4509
|
+
}), category_transformer_({
|
|
4510
|
+
merchant: merchant_,
|
|
4511
|
+
market: market_,
|
|
4512
|
+
locale: locale_,
|
|
4513
|
+
data: quickLinks
|
|
4514
|
+
})]);
|
|
4515
|
+
return {
|
|
4516
|
+
...clonedInputData,
|
|
4517
|
+
breadcrumbs: transformedBreadcrumbs,
|
|
4518
|
+
quick_links: transformedQuickLinks
|
|
4519
|
+
};
|
|
4520
|
+
}
|
|
4462
4521
|
const $e1d6c0f3d89d531c$var$v3_base_url = (0, $5vyXB$depictaiutilishared.base_url) + "/v3/";
|
|
4463
4522
|
const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$v3_base_url + "search/";
|
|
4464
4523
|
class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
@@ -4484,7 +4543,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4484
4543
|
};
|
|
4485
4544
|
#get_metadata;
|
|
4486
4545
|
#get_session_id;
|
|
4487
|
-
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
4546
|
+
async #run_url_creator_for_suggest(merchant, market, locale, response) {
|
|
4488
4547
|
const category_transformer = this.display_transformers?.categories;
|
|
4489
4548
|
if (!category_transformer) return response;
|
|
4490
4549
|
// find category suggestions, run thing with them, and then replace them
|
|
@@ -4492,12 +4551,16 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4492
4551
|
const transformed_category_suggestions = await category_transformer({
|
|
4493
4552
|
market: market,
|
|
4494
4553
|
merchant: merchant,
|
|
4554
|
+
locale: locale,
|
|
4495
4555
|
data: [...category_suggestions]
|
|
4496
4556
|
});
|
|
4497
4557
|
response.suggestions = transformed_category_suggestions;
|
|
4498
4558
|
return response;
|
|
4499
4559
|
}
|
|
4500
|
-
|
|
4560
|
+
/**
|
|
4561
|
+
* rest = everything except query suggestions
|
|
4562
|
+
*/
|
|
4563
|
+
async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
|
|
4501
4564
|
const {
|
|
4502
4565
|
display_transformers: display_transformers
|
|
4503
4566
|
} = this;
|
|
@@ -4513,25 +4576,24 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4513
4576
|
const transformed_displays = await product_transformer({
|
|
4514
4577
|
merchant: merchant,
|
|
4515
4578
|
market: market,
|
|
4579
|
+
locale: locale,
|
|
4516
4580
|
displays: [...displays]
|
|
4517
4581
|
});
|
|
4518
4582
|
input_data.displays = transformed_displays;
|
|
4519
4583
|
}
|
|
4520
|
-
if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
|
|
4521
|
-
const category_display_array = input_data[key];
|
|
4522
|
-
if (!category_display_array) continue;
|
|
4523
|
-
const transformed_category_displays = await category_transformer({
|
|
4524
|
-
merchant: merchant,
|
|
4525
|
-
market: market,
|
|
4526
|
-
data: [...category_display_array]
|
|
4527
|
-
});
|
|
4528
|
-
input_data[key] = transformed_category_displays;
|
|
4529
|
-
}
|
|
4530
4584
|
if (content_search_links?.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
|
|
4531
4585
|
merchant: merchant,
|
|
4532
4586
|
market: market,
|
|
4587
|
+
locale: locale,
|
|
4533
4588
|
data: [...content_search_links]
|
|
4534
4589
|
});
|
|
4590
|
+
if (input_data.ancestors) return await $3a9f9f260c9bfc55$export$d9792230b7c0203e({
|
|
4591
|
+
input_data_: input_data,
|
|
4592
|
+
category_transformer_: category_transformer,
|
|
4593
|
+
merchant_: merchant,
|
|
4594
|
+
market_: market,
|
|
4595
|
+
locale_: locale
|
|
4596
|
+
});
|
|
4535
4597
|
return input_data;
|
|
4536
4598
|
}
|
|
4537
4599
|
async #cached_request({
|
|
@@ -4568,7 +4630,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4568
4630
|
let result;
|
|
4569
4631
|
try {
|
|
4570
4632
|
const unmodified_result = await api_response.json();
|
|
4571
|
-
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, unmodified_result);
|
|
4633
|
+
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
4572
4634
|
} catch (e) {
|
|
4573
4635
|
$5vyXB$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
4574
4636
|
break return_successfully;
|
|
@@ -4618,7 +4680,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4618
4680
|
const decoded_json = await results.json();
|
|
4619
4681
|
if (!Array.isArray(decoded_json?.suggestions)) break attempt_to_return_api_response;
|
|
4620
4682
|
try {
|
|
4621
|
-
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, decoded_json);
|
|
4683
|
+
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, input_req.locale, decoded_json);
|
|
4622
4684
|
} catch (e) {
|
|
4623
4685
|
$5vyXB$depictaiutilishared.dwarn("displayTransformer failed", e);
|
|
4624
4686
|
}
|
|
@@ -4654,13 +4716,12 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4654
4716
|
fallback_response_: () => ({
|
|
4655
4717
|
listing_id: "",
|
|
4656
4718
|
listing_type: "category",
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
"quick_links": [],
|
|
4719
|
+
title: "",
|
|
4720
|
+
slug: "",
|
|
4721
|
+
show_in_breadcrumbs: false,
|
|
4722
|
+
show_in_quicklinks: false,
|
|
4723
|
+
breadcrumbs: [],
|
|
4724
|
+
quick_links: [],
|
|
4664
4725
|
failed: true
|
|
4665
4726
|
}),
|
|
4666
4727
|
method_: "GET"
|
|
@@ -6827,7 +6888,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6827
6888
|
})));
|
|
6828
6889
|
const available_filters_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.filters);
|
|
6829
6890
|
const title = $5vyXB$solidjs.createMemo(() => plp_meta()?.title);
|
|
6830
|
-
const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta
|
|
6891
|
+
const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta);
|
|
6831
6892
|
const quicklinks_data_ = $5vyXB$solidjs.createMemo(() => plp_meta()?.quick_links);
|
|
6832
6893
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $5vyXB$solidjs.createSignal(false);
|
|
6833
6894
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $5vyXB$solidjs.createSignal();
|
|
@@ -7056,31 +7117,16 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7056
7117
|
/**
|
|
7057
7118
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
7058
7119
|
*/
|
|
7059
|
-
function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta
|
|
7120
|
+
function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta) {
|
|
7060
7121
|
const href_accessor = $5vyXB$depictaiutilisharedlatest.use_href_accessor();
|
|
7061
7122
|
return $5vyXB$solidjs.createMemo(() => {
|
|
7062
7123
|
const api_value = plp_meta()?.breadcrumbs;
|
|
7063
7124
|
if (!api_value) return api_value;
|
|
7064
|
-
return [...api_value, {
|
|
7065
|
-
get listing_id() {
|
|
7066
|
-
return plp_meta().listing_id;
|
|
7067
|
-
},
|
|
7068
|
-
get title() {
|
|
7069
|
-
return title();
|
|
7070
|
-
},
|
|
7125
|
+
return [...api_value, $5vyXB$solidjs.mergeProps(plp_meta(), {
|
|
7071
7126
|
get page_url() {
|
|
7072
7127
|
return href_accessor();
|
|
7073
|
-
},
|
|
7074
|
-
get slug() {
|
|
7075
|
-
return plp_meta().slug;
|
|
7076
|
-
},
|
|
7077
|
-
get listing_type() {
|
|
7078
|
-
return plp_meta().listing_type;
|
|
7079
|
-
},
|
|
7080
|
-
get external_id() {
|
|
7081
|
-
return plp_meta().external_id;
|
|
7082
7128
|
}
|
|
7083
|
-
}];
|
|
7129
|
+
})];
|
|
7084
7130
|
});
|
|
7085
7131
|
}
|
|
7086
7132
|
function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
@@ -7659,7 +7705,7 @@ function $dae23104ba8bb78c$export$d757d54550ebfb3d({
|
|
|
7659
7705
|
category_suggestion_: category_suggestion_,
|
|
7660
7706
|
router_: router_
|
|
7661
7707
|
}) {
|
|
7662
|
-
const parentTitle = $5vyXB$solidjs.createMemo(() => category_suggestion_().
|
|
7708
|
+
const parentTitle = $5vyXB$solidjs.createMemo(() => category_suggestion_().ancestors.at(-1)?.title);
|
|
7663
7709
|
return $5vyXB$solidjsweb.ssr($dae23104ba8bb78c$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(category_suggestion_().page_url, true), false), $5vyXB$solidjsweb.escape(category_suggestion_().title), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
7664
7710
|
get when() {
|
|
7665
7711
|
return parentTitle();
|
|
@@ -8211,8 +8257,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
8211
8257
|
const is_selected = $5vyXB$solidjs.createMemo(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
8212
8258
|
const parent_title_if_exists = $5vyXB$solidjs.createMemo(() => {
|
|
8213
8259
|
const item = input_obj();
|
|
8214
|
-
if (!("
|
|
8215
|
-
return item.
|
|
8260
|
+
if (!("ancestors" in item)) return;
|
|
8261
|
+
return item.ancestors.at(-1)?.title;
|
|
8216
8262
|
});
|
|
8217
8263
|
return $5vyXB$solidjsweb.ssr($6b65ba8af12c5a26$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `suggestion ${is_selected() ? "selected" : ""} ${is_history ? "history" : ""} ${$5vyXB$solidjsweb.escape($5vyXB$solidjsweb.escape("type-" + input_obj().type, true), true)}`, $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(href(), true), false), is_query() ? $5vyXB$solidjsweb.escape([$5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
8218
8264
|
when: is_history,
|
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.7";
|
|
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;
|
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.7";
|
|
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,7 +4473,7 @@ 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;
|
|
4420
4479
|
// find category suggestions, run thing with them, and then replace them
|
|
@@ -4422,12 +4481,16 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4422
4481
|
const transformed_category_suggestions = await category_transformer({
|
|
4423
4482
|
market: market,
|
|
4424
4483
|
merchant: merchant,
|
|
4484
|
+
locale: locale,
|
|
4425
4485
|
data: [...category_suggestions]
|
|
4426
4486
|
});
|
|
4427
4487
|
response.suggestions = transformed_category_suggestions;
|
|
4428
4488
|
return response;
|
|
4429
4489
|
}
|
|
4430
|
-
|
|
4490
|
+
/**
|
|
4491
|
+
* rest = everything except query suggestions
|
|
4492
|
+
*/
|
|
4493
|
+
async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
|
|
4431
4494
|
const {
|
|
4432
4495
|
display_transformers: display_transformers
|
|
4433
4496
|
} = this;
|
|
@@ -4443,25 +4506,24 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4443
4506
|
const transformed_displays = await product_transformer({
|
|
4444
4507
|
merchant: merchant,
|
|
4445
4508
|
market: market,
|
|
4509
|
+
locale: locale,
|
|
4446
4510
|
displays: [...displays]
|
|
4447
4511
|
});
|
|
4448
4512
|
input_data.displays = transformed_displays;
|
|
4449
4513
|
}
|
|
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
4514
|
if (content_search_links?.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
|
|
4461
4515
|
merchant: merchant,
|
|
4462
4516
|
market: market,
|
|
4517
|
+
locale: locale,
|
|
4463
4518
|
data: [...content_search_links]
|
|
4464
4519
|
});
|
|
4520
|
+
if (input_data.ancestors) return await $23f4eb8487f328d9$export$d9792230b7c0203e({
|
|
4521
|
+
input_data_: input_data,
|
|
4522
|
+
category_transformer_: category_transformer,
|
|
4523
|
+
merchant_: merchant,
|
|
4524
|
+
market_: market,
|
|
4525
|
+
locale_: locale
|
|
4526
|
+
});
|
|
4465
4527
|
return input_data;
|
|
4466
4528
|
}
|
|
4467
4529
|
async #cached_request({
|
|
@@ -4498,7 +4560,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4498
4560
|
let result;
|
|
4499
4561
|
try {
|
|
4500
4562
|
const unmodified_result = await api_response.json();
|
|
4501
|
-
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, unmodified_result);
|
|
4563
|
+
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
4502
4564
|
} catch (e) {
|
|
4503
4565
|
$i7OB2$dwarn("displayTransformer or json decoding failed", e);
|
|
4504
4566
|
break return_successfully;
|
|
@@ -4548,7 +4610,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4548
4610
|
const decoded_json = await results.json();
|
|
4549
4611
|
if (!Array.isArray(decoded_json?.suggestions)) break attempt_to_return_api_response;
|
|
4550
4612
|
try {
|
|
4551
|
-
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, decoded_json);
|
|
4613
|
+
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, input_req.locale, decoded_json);
|
|
4552
4614
|
} catch (e) {
|
|
4553
4615
|
$i7OB2$dwarn("displayTransformer failed", e);
|
|
4554
4616
|
}
|
|
@@ -4584,13 +4646,12 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
4584
4646
|
fallback_response_: () => ({
|
|
4585
4647
|
listing_id: "",
|
|
4586
4648
|
listing_type: "category",
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
"quick_links": [],
|
|
4649
|
+
title: "",
|
|
4650
|
+
slug: "",
|
|
4651
|
+
show_in_breadcrumbs: false,
|
|
4652
|
+
show_in_quicklinks: false,
|
|
4653
|
+
breadcrumbs: [],
|
|
4654
|
+
quick_links: [],
|
|
4594
4655
|
failed: true
|
|
4595
4656
|
}),
|
|
4596
4657
|
method_: "GET"
|
|
@@ -6757,7 +6818,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
6757
6818
|
})));
|
|
6758
6819
|
const available_filters_ = $i7OB2$createMemo(() => plp_products_()?.filters);
|
|
6759
6820
|
const title = $i7OB2$createMemo(() => plp_meta()?.title);
|
|
6760
|
-
const crumb_data_ = $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta
|
|
6821
|
+
const crumb_data_ = $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta);
|
|
6761
6822
|
const quicklinks_data_ = $i7OB2$createMemo(() => plp_meta()?.quick_links);
|
|
6762
6823
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $i7OB2$createSignal(false);
|
|
6763
6824
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $i7OB2$createSignal();
|
|
@@ -6986,31 +7047,16 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
6986
7047
|
/**
|
|
6987
7048
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
6988
7049
|
*/
|
|
6989
|
-
function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta
|
|
7050
|
+
function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta) {
|
|
6990
7051
|
const href_accessor = $i7OB2$use_href_accessor();
|
|
6991
7052
|
return $i7OB2$createMemo(() => {
|
|
6992
7053
|
const api_value = plp_meta()?.breadcrumbs;
|
|
6993
7054
|
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
|
-
},
|
|
7055
|
+
return [...api_value, $i7OB2$mergeProps1(plp_meta(), {
|
|
7001
7056
|
get page_url() {
|
|
7002
7057
|
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
7058
|
}
|
|
7013
|
-
}];
|
|
7059
|
+
})];
|
|
7014
7060
|
});
|
|
7015
7061
|
}
|
|
7016
7062
|
function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
|
|
@@ -7589,7 +7635,7 @@ function $897bd4a76f611b38$export$d757d54550ebfb3d({
|
|
|
7589
7635
|
category_suggestion_: category_suggestion_,
|
|
7590
7636
|
router_: router_
|
|
7591
7637
|
}) {
|
|
7592
|
-
const parentTitle = $i7OB2$createMemo(() => category_suggestion_().
|
|
7638
|
+
const parentTitle = $i7OB2$createMemo(() => category_suggestion_().ancestors.at(-1)?.title);
|
|
7593
7639
|
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
7640
|
get when() {
|
|
7595
7641
|
return parentTitle();
|
|
@@ -8141,8 +8187,8 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
8141
8187
|
const is_selected = $i7OB2$createMemo(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
8142
8188
|
const parent_title_if_exists = $i7OB2$createMemo(() => {
|
|
8143
8189
|
const item = input_obj();
|
|
8144
|
-
if (!("
|
|
8145
|
-
return item.
|
|
8190
|
+
if (!("ancestors" in item)) return;
|
|
8191
|
+
return item.ancestors.at(-1)?.title;
|
|
8146
8192
|
});
|
|
8147
8193
|
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
8194
|
when: is_history,
|