@depict-ai/ui 3.0.5 → 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/locales/ES10/index.cjs +12 -12
- package/locales/ES10/index.js +12 -12
- package/locales/latest/index.cjs +12 -12
- package/locales/latest/index.js +12 -12
- 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/locales/require.js +0 -1152
package/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$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<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>`);
|
|
82
82
|
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
83
83
|
return (() => {
|
|
@@ -5501,6 +5501,65 @@ function $67dc366d96177e70$export$967e966fca9515e(api_response) {
|
|
|
5501
5501
|
// Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
|
|
5502
5502
|
const $779741d0f266ea8c$export$74ee7529ce0f8a00 = "listingId";
|
|
5503
5503
|
const $779741d0f266ea8c$export$5aae649db1b959fc = "externalId";
|
|
5504
|
+
|
|
5505
|
+
/**
|
|
5506
|
+
* 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.
|
|
5507
|
+
*/
|
|
5508
|
+
async function $3a9f9f260c9bfc55$export$d9792230b7c0203e({
|
|
5509
|
+
input_data_: {
|
|
5510
|
+
ancestors: ancestors,
|
|
5511
|
+
children: children,
|
|
5512
|
+
siblings: siblings,
|
|
5513
|
+
...clonedInputData
|
|
5514
|
+
},
|
|
5515
|
+
category_transformer_ = v => v.data,
|
|
5516
|
+
merchant_:
|
|
5517
|
+
// in case no display transformer just pass the data through, so we don't break
|
|
5518
|
+
merchant_,
|
|
5519
|
+
market_: market_,
|
|
5520
|
+
locale_: locale_
|
|
5521
|
+
}) {
|
|
5522
|
+
const breadcrumbs = [];
|
|
5523
|
+
const clonedAncestors = [...ancestors];
|
|
5524
|
+
while (clonedAncestors.length) {
|
|
5525
|
+
const ancestor = clonedAncestors.pop();
|
|
5526
|
+
if (!ancestor.show_in_breadcrumbs) continue;
|
|
5527
|
+
breadcrumbs.push({
|
|
5528
|
+
...ancestor,
|
|
5529
|
+
ancestors: [...clonedAncestors]
|
|
5530
|
+
});
|
|
5531
|
+
}
|
|
5532
|
+
breadcrumbs.reverse();
|
|
5533
|
+
const quicklinksIsChildren = children.length;
|
|
5534
|
+
const quickLinks = (quicklinksIsChildren ? children : siblings).filter(({
|
|
5535
|
+
show_in_quicklinks: show_in_quicklinks
|
|
5536
|
+
}) => show_in_quicklinks).map(productListing => {
|
|
5537
|
+
const ancestorsForUs = [...ancestors];
|
|
5538
|
+
if (quicklinksIsChildren) ancestorsForUs.push({
|
|
5539
|
+
...clonedInputData
|
|
5540
|
+
});
|
|
5541
|
+
return {
|
|
5542
|
+
...productListing,
|
|
5543
|
+
ancestors: ancestorsForUs
|
|
5544
|
+
};
|
|
5545
|
+
});
|
|
5546
|
+
const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
|
|
5547
|
+
merchant: merchant_,
|
|
5548
|
+
market: market_,
|
|
5549
|
+
locale: locale_,
|
|
5550
|
+
data: breadcrumbs
|
|
5551
|
+
}), category_transformer_({
|
|
5552
|
+
merchant: merchant_,
|
|
5553
|
+
market: market_,
|
|
5554
|
+
locale: locale_,
|
|
5555
|
+
data: quickLinks
|
|
5556
|
+
})]);
|
|
5557
|
+
return {
|
|
5558
|
+
...clonedInputData,
|
|
5559
|
+
breadcrumbs: transformedBreadcrumbs,
|
|
5560
|
+
quick_links: transformedQuickLinks
|
|
5561
|
+
};
|
|
5562
|
+
}
|
|
5504
5563
|
const $e1d6c0f3d89d531c$var$v3_base_url = (0, $gVhhF$depictaiutilishared.base_url) + "/v3/";
|
|
5505
5564
|
const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$v3_base_url + "search/";
|
|
5506
5565
|
class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
@@ -5526,7 +5585,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5526
5585
|
};
|
|
5527
5586
|
#get_metadata;
|
|
5528
5587
|
#get_session_id;
|
|
5529
|
-
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
5588
|
+
async #run_url_creator_for_suggest(merchant, market, locale, response) {
|
|
5530
5589
|
const category_transformer = this.display_transformers?.categories;
|
|
5531
5590
|
if (!category_transformer) return response;
|
|
5532
5591
|
// find category suggestions, run thing with them, and then replace them
|
|
@@ -5534,12 +5593,16 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5534
5593
|
const transformed_category_suggestions = await category_transformer({
|
|
5535
5594
|
market: market,
|
|
5536
5595
|
merchant: merchant,
|
|
5596
|
+
locale: locale,
|
|
5537
5597
|
data: [...category_suggestions]
|
|
5538
5598
|
});
|
|
5539
5599
|
response.suggestions = transformed_category_suggestions;
|
|
5540
5600
|
return response;
|
|
5541
5601
|
}
|
|
5542
|
-
|
|
5602
|
+
/**
|
|
5603
|
+
* rest = everything except query suggestions
|
|
5604
|
+
*/
|
|
5605
|
+
async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
|
|
5543
5606
|
const {
|
|
5544
5607
|
display_transformers: display_transformers
|
|
5545
5608
|
} = this;
|
|
@@ -5555,25 +5618,24 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5555
5618
|
const transformed_displays = await product_transformer({
|
|
5556
5619
|
merchant: merchant,
|
|
5557
5620
|
market: market,
|
|
5621
|
+
locale: locale,
|
|
5558
5622
|
displays: [...displays]
|
|
5559
5623
|
});
|
|
5560
5624
|
input_data.displays = transformed_displays;
|
|
5561
5625
|
}
|
|
5562
|
-
if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
|
|
5563
|
-
const category_display_array = input_data[key];
|
|
5564
|
-
if (!category_display_array) continue;
|
|
5565
|
-
const transformed_category_displays = await category_transformer({
|
|
5566
|
-
merchant: merchant,
|
|
5567
|
-
market: market,
|
|
5568
|
-
data: [...category_display_array]
|
|
5569
|
-
});
|
|
5570
|
-
input_data[key] = transformed_category_displays;
|
|
5571
|
-
}
|
|
5572
5626
|
if (content_search_links?.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
|
|
5573
5627
|
merchant: merchant,
|
|
5574
5628
|
market: market,
|
|
5629
|
+
locale: locale,
|
|
5575
5630
|
data: [...content_search_links]
|
|
5576
5631
|
});
|
|
5632
|
+
if (input_data.ancestors) return await $3a9f9f260c9bfc55$export$d9792230b7c0203e({
|
|
5633
|
+
input_data_: input_data,
|
|
5634
|
+
category_transformer_: category_transformer,
|
|
5635
|
+
merchant_: merchant,
|
|
5636
|
+
market_: market,
|
|
5637
|
+
locale_: locale
|
|
5638
|
+
});
|
|
5577
5639
|
return input_data;
|
|
5578
5640
|
}
|
|
5579
5641
|
async #cached_request({
|
|
@@ -5610,7 +5672,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5610
5672
|
let result;
|
|
5611
5673
|
try {
|
|
5612
5674
|
const unmodified_result = await api_response.json();
|
|
5613
|
-
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, unmodified_result);
|
|
5675
|
+
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
5614
5676
|
} catch (e) {
|
|
5615
5677
|
$gVhhF$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
5616
5678
|
break return_successfully;
|
|
@@ -5660,7 +5722,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5660
5722
|
const decoded_json = await results.json();
|
|
5661
5723
|
if (!Array.isArray(decoded_json?.suggestions)) break attempt_to_return_api_response;
|
|
5662
5724
|
try {
|
|
5663
|
-
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, decoded_json);
|
|
5725
|
+
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, input_req.locale, decoded_json);
|
|
5664
5726
|
} catch (e) {
|
|
5665
5727
|
$gVhhF$depictaiutilishared.dwarn("displayTransformer failed", e);
|
|
5666
5728
|
}
|
|
@@ -5696,13 +5758,12 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5696
5758
|
fallback_response_: () => ({
|
|
5697
5759
|
listing_id: "",
|
|
5698
5760
|
listing_type: "category",
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
"quick_links": [],
|
|
5761
|
+
title: "",
|
|
5762
|
+
slug: "",
|
|
5763
|
+
show_in_breadcrumbs: false,
|
|
5764
|
+
show_in_quicklinks: false,
|
|
5765
|
+
breadcrumbs: [],
|
|
5766
|
+
quick_links: [],
|
|
5706
5767
|
failed: true
|
|
5707
5768
|
}),
|
|
5708
5769
|
method_: "GET"
|
|
@@ -8299,7 +8360,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
8299
8360
|
})));
|
|
8300
8361
|
const available_filters_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.filters);
|
|
8301
8362
|
const title = $gVhhF$solidjs.createMemo(() => plp_meta()?.title);
|
|
8302
|
-
const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta
|
|
8363
|
+
const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta);
|
|
8303
8364
|
const quicklinks_data_ = $gVhhF$solidjs.createMemo(() => plp_meta()?.quick_links);
|
|
8304
8365
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $gVhhF$solidjs.createSignal(false);
|
|
8305
8366
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $gVhhF$solidjs.createSignal();
|
|
@@ -8577,31 +8638,16 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
8577
8638
|
/**
|
|
8578
8639
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
8579
8640
|
*/
|
|
8580
|
-
function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta
|
|
8641
|
+
function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta) {
|
|
8581
8642
|
const href_accessor = $gVhhF$depictaiutilisharedlatest.use_href_accessor();
|
|
8582
8643
|
return $gVhhF$solidjs.createMemo(() => {
|
|
8583
8644
|
const api_value = plp_meta()?.breadcrumbs;
|
|
8584
8645
|
if (!api_value) return api_value;
|
|
8585
|
-
return [...api_value, {
|
|
8586
|
-
get listing_id() {
|
|
8587
|
-
return plp_meta().listing_id;
|
|
8588
|
-
},
|
|
8589
|
-
get title() {
|
|
8590
|
-
return title();
|
|
8591
|
-
},
|
|
8646
|
+
return [...api_value, $gVhhF$solidjs.mergeProps(plp_meta(), {
|
|
8592
8647
|
get page_url() {
|
|
8593
8648
|
return href_accessor();
|
|
8594
|
-
},
|
|
8595
|
-
get slug() {
|
|
8596
|
-
return plp_meta().slug;
|
|
8597
|
-
},
|
|
8598
|
-
get listing_type() {
|
|
8599
|
-
return plp_meta().listing_type;
|
|
8600
|
-
},
|
|
8601
|
-
get external_id() {
|
|
8602
|
-
return plp_meta().external_id;
|
|
8603
8649
|
}
|
|
8604
|
-
}];
|
|
8650
|
+
})];
|
|
8605
8651
|
});
|
|
8606
8652
|
}
|
|
8607
8653
|
function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
@@ -9208,7 +9254,7 @@ function $dae23104ba8bb78c$export$d757d54550ebfb3d({
|
|
|
9208
9254
|
category_suggestion_: category_suggestion_,
|
|
9209
9255
|
router_: router_
|
|
9210
9256
|
}) {
|
|
9211
|
-
const parentTitle = $gVhhF$solidjs.createMemo(() => category_suggestion_().
|
|
9257
|
+
const parentTitle = $gVhhF$solidjs.createMemo(() => category_suggestion_().ancestors.at(-1)?.title);
|
|
9212
9258
|
return (() => {
|
|
9213
9259
|
const _el$ = $gVhhF$solidjsweb.getNextElement($dae23104ba8bb78c$var$_tmpl$2),
|
|
9214
9260
|
_el$2 = _el$.firstChild,
|
|
@@ -10052,8 +10098,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
10052
10098
|
const is_selected = $gVhhF$solidjs.createMemo(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
10053
10099
|
const parent_title_if_exists = $gVhhF$solidjs.createMemo(() => {
|
|
10054
10100
|
const item = input_obj();
|
|
10055
|
-
if (!("
|
|
10056
|
-
return item.
|
|
10101
|
+
if (!("ancestors" in item)) return;
|
|
10102
|
+
return item.ancestors.at(-1)?.title;
|
|
10057
10103
|
});
|
|
10058
10104
|
return (() => {
|
|
10059
10105
|
const _el$ = $gVhhF$solidjsweb.getNextElement($6b65ba8af12c5a26$var$_tmpl$);
|
package/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/latest/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$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$ = /*#__PURE__*/$9HbP8$template(`<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>`);
|
|
12
12
|
function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
|
|
13
13
|
return (() => {
|
|
@@ -5431,6 +5431,65 @@ function $e5014ccd0b76d9f4$export$967e966fca9515e(api_response) {
|
|
|
5431
5431
|
// Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
|
|
5432
5432
|
const $c20599a0d81d953a$export$74ee7529ce0f8a00 = "listingId";
|
|
5433
5433
|
const $c20599a0d81d953a$export$5aae649db1b959fc = "externalId";
|
|
5434
|
+
|
|
5435
|
+
/**
|
|
5436
|
+
* 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.
|
|
5437
|
+
*/
|
|
5438
|
+
async function $23f4eb8487f328d9$export$d9792230b7c0203e({
|
|
5439
|
+
input_data_: {
|
|
5440
|
+
ancestors: ancestors,
|
|
5441
|
+
children: children,
|
|
5442
|
+
siblings: siblings,
|
|
5443
|
+
...clonedInputData
|
|
5444
|
+
},
|
|
5445
|
+
category_transformer_ = v => v.data,
|
|
5446
|
+
merchant_:
|
|
5447
|
+
// in case no display transformer just pass the data through, so we don't break
|
|
5448
|
+
merchant_,
|
|
5449
|
+
market_: market_,
|
|
5450
|
+
locale_: locale_
|
|
5451
|
+
}) {
|
|
5452
|
+
const breadcrumbs = [];
|
|
5453
|
+
const clonedAncestors = [...ancestors];
|
|
5454
|
+
while (clonedAncestors.length) {
|
|
5455
|
+
const ancestor = clonedAncestors.pop();
|
|
5456
|
+
if (!ancestor.show_in_breadcrumbs) continue;
|
|
5457
|
+
breadcrumbs.push({
|
|
5458
|
+
...ancestor,
|
|
5459
|
+
ancestors: [...clonedAncestors]
|
|
5460
|
+
});
|
|
5461
|
+
}
|
|
5462
|
+
breadcrumbs.reverse();
|
|
5463
|
+
const quicklinksIsChildren = children.length;
|
|
5464
|
+
const quickLinks = (quicklinksIsChildren ? children : siblings).filter(({
|
|
5465
|
+
show_in_quicklinks: show_in_quicklinks
|
|
5466
|
+
}) => show_in_quicklinks).map(productListing => {
|
|
5467
|
+
const ancestorsForUs = [...ancestors];
|
|
5468
|
+
if (quicklinksIsChildren) ancestorsForUs.push({
|
|
5469
|
+
...clonedInputData
|
|
5470
|
+
});
|
|
5471
|
+
return {
|
|
5472
|
+
...productListing,
|
|
5473
|
+
ancestors: ancestorsForUs
|
|
5474
|
+
};
|
|
5475
|
+
});
|
|
5476
|
+
const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
|
|
5477
|
+
merchant: merchant_,
|
|
5478
|
+
market: market_,
|
|
5479
|
+
locale: locale_,
|
|
5480
|
+
data: breadcrumbs
|
|
5481
|
+
}), category_transformer_({
|
|
5482
|
+
merchant: merchant_,
|
|
5483
|
+
market: market_,
|
|
5484
|
+
locale: locale_,
|
|
5485
|
+
data: quickLinks
|
|
5486
|
+
})]);
|
|
5487
|
+
return {
|
|
5488
|
+
...clonedInputData,
|
|
5489
|
+
breadcrumbs: transformedBreadcrumbs,
|
|
5490
|
+
quick_links: transformedQuickLinks
|
|
5491
|
+
};
|
|
5492
|
+
}
|
|
5434
5493
|
const $7fa23e2a0079eca4$var$v3_base_url = (0, $9HbP8$base_url) + "/v3/";
|
|
5435
5494
|
const $7fa23e2a0079eca4$var$search_base_url = $7fa23e2a0079eca4$var$v3_base_url + "search/";
|
|
5436
5495
|
class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
@@ -5456,7 +5515,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
5456
5515
|
};
|
|
5457
5516
|
#get_metadata;
|
|
5458
5517
|
#get_session_id;
|
|
5459
|
-
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
5518
|
+
async #run_url_creator_for_suggest(merchant, market, locale, response) {
|
|
5460
5519
|
const category_transformer = this.display_transformers?.categories;
|
|
5461
5520
|
if (!category_transformer) return response;
|
|
5462
5521
|
// find category suggestions, run thing with them, and then replace them
|
|
@@ -5464,12 +5523,16 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
5464
5523
|
const transformed_category_suggestions = await category_transformer({
|
|
5465
5524
|
market: market,
|
|
5466
5525
|
merchant: merchant,
|
|
5526
|
+
locale: locale,
|
|
5467
5527
|
data: [...category_suggestions]
|
|
5468
5528
|
});
|
|
5469
5529
|
response.suggestions = transformed_category_suggestions;
|
|
5470
5530
|
return response;
|
|
5471
5531
|
}
|
|
5472
|
-
|
|
5532
|
+
/**
|
|
5533
|
+
* rest = everything except query suggestions
|
|
5534
|
+
*/
|
|
5535
|
+
async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
|
|
5473
5536
|
const {
|
|
5474
5537
|
display_transformers: display_transformers
|
|
5475
5538
|
} = this;
|
|
@@ -5485,25 +5548,24 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
5485
5548
|
const transformed_displays = await product_transformer({
|
|
5486
5549
|
merchant: merchant,
|
|
5487
5550
|
market: market,
|
|
5551
|
+
locale: locale,
|
|
5488
5552
|
displays: [...displays]
|
|
5489
5553
|
});
|
|
5490
5554
|
input_data.displays = transformed_displays;
|
|
5491
5555
|
}
|
|
5492
|
-
if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
|
|
5493
|
-
const category_display_array = input_data[key];
|
|
5494
|
-
if (!category_display_array) continue;
|
|
5495
|
-
const transformed_category_displays = await category_transformer({
|
|
5496
|
-
merchant: merchant,
|
|
5497
|
-
market: market,
|
|
5498
|
-
data: [...category_display_array]
|
|
5499
|
-
});
|
|
5500
|
-
input_data[key] = transformed_category_displays;
|
|
5501
|
-
}
|
|
5502
5556
|
if (content_search_links?.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
|
|
5503
5557
|
merchant: merchant,
|
|
5504
5558
|
market: market,
|
|
5559
|
+
locale: locale,
|
|
5505
5560
|
data: [...content_search_links]
|
|
5506
5561
|
});
|
|
5562
|
+
if (input_data.ancestors) return await $23f4eb8487f328d9$export$d9792230b7c0203e({
|
|
5563
|
+
input_data_: input_data,
|
|
5564
|
+
category_transformer_: category_transformer,
|
|
5565
|
+
merchant_: merchant,
|
|
5566
|
+
market_: market,
|
|
5567
|
+
locale_: locale
|
|
5568
|
+
});
|
|
5507
5569
|
return input_data;
|
|
5508
5570
|
}
|
|
5509
5571
|
async #cached_request({
|
|
@@ -5540,7 +5602,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
5540
5602
|
let result;
|
|
5541
5603
|
try {
|
|
5542
5604
|
const unmodified_result = await api_response.json();
|
|
5543
|
-
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, unmodified_result);
|
|
5605
|
+
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
5544
5606
|
} catch (e) {
|
|
5545
5607
|
$9HbP8$dwarn("displayTransformer or json decoding failed", e);
|
|
5546
5608
|
break return_successfully;
|
|
@@ -5590,7 +5652,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
5590
5652
|
const decoded_json = await results.json();
|
|
5591
5653
|
if (!Array.isArray(decoded_json?.suggestions)) break attempt_to_return_api_response;
|
|
5592
5654
|
try {
|
|
5593
|
-
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, decoded_json);
|
|
5655
|
+
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, input_req.locale, decoded_json);
|
|
5594
5656
|
} catch (e) {
|
|
5595
5657
|
$9HbP8$dwarn("displayTransformer failed", e);
|
|
5596
5658
|
}
|
|
@@ -5626,13 +5688,12 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
5626
5688
|
fallback_response_: () => ({
|
|
5627
5689
|
listing_id: "",
|
|
5628
5690
|
listing_type: "category",
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
"quick_links": [],
|
|
5691
|
+
title: "",
|
|
5692
|
+
slug: "",
|
|
5693
|
+
show_in_breadcrumbs: false,
|
|
5694
|
+
show_in_quicklinks: false,
|
|
5695
|
+
breadcrumbs: [],
|
|
5696
|
+
quick_links: [],
|
|
5636
5697
|
failed: true
|
|
5637
5698
|
}),
|
|
5638
5699
|
method_: "GET"
|
|
@@ -8229,7 +8290,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
8229
8290
|
})));
|
|
8230
8291
|
const available_filters_ = $9HbP8$createMemo(() => plp_products_()?.filters);
|
|
8231
8292
|
const title = $9HbP8$createMemo(() => plp_meta()?.title);
|
|
8232
|
-
const crumb_data_ = $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta
|
|
8293
|
+
const crumb_data_ = $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta);
|
|
8233
8294
|
const quicklinks_data_ = $9HbP8$createMemo(() => plp_meta()?.quick_links);
|
|
8234
8295
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $9HbP8$createSignal(false);
|
|
8235
8296
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $9HbP8$createSignal();
|
|
@@ -8507,31 +8568,16 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
8507
8568
|
/**
|
|
8508
8569
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
8509
8570
|
*/
|
|
8510
|
-
function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta
|
|
8571
|
+
function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta) {
|
|
8511
8572
|
const href_accessor = $9HbP8$use_href_accessor();
|
|
8512
8573
|
return $9HbP8$createMemo(() => {
|
|
8513
8574
|
const api_value = plp_meta()?.breadcrumbs;
|
|
8514
8575
|
if (!api_value) return api_value;
|
|
8515
|
-
return [...api_value, {
|
|
8516
|
-
get listing_id() {
|
|
8517
|
-
return plp_meta().listing_id;
|
|
8518
|
-
},
|
|
8519
|
-
get title() {
|
|
8520
|
-
return title();
|
|
8521
|
-
},
|
|
8576
|
+
return [...api_value, $9HbP8$mergeProps1(plp_meta(), {
|
|
8522
8577
|
get page_url() {
|
|
8523
8578
|
return href_accessor();
|
|
8524
|
-
},
|
|
8525
|
-
get slug() {
|
|
8526
|
-
return plp_meta().slug;
|
|
8527
|
-
},
|
|
8528
|
-
get listing_type() {
|
|
8529
|
-
return plp_meta().listing_type;
|
|
8530
|
-
},
|
|
8531
|
-
get external_id() {
|
|
8532
|
-
return plp_meta().external_id;
|
|
8533
8579
|
}
|
|
8534
|
-
}];
|
|
8580
|
+
})];
|
|
8535
8581
|
});
|
|
8536
8582
|
}
|
|
8537
8583
|
function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
|
|
@@ -9138,7 +9184,7 @@ function $897bd4a76f611b38$export$d757d54550ebfb3d({
|
|
|
9138
9184
|
category_suggestion_: category_suggestion_,
|
|
9139
9185
|
router_: router_
|
|
9140
9186
|
}) {
|
|
9141
|
-
const parentTitle = $9HbP8$createMemo(() => category_suggestion_().
|
|
9187
|
+
const parentTitle = $9HbP8$createMemo(() => category_suggestion_().ancestors.at(-1)?.title);
|
|
9142
9188
|
return (() => {
|
|
9143
9189
|
const _el$ = $9HbP8$getNextElement($897bd4a76f611b38$var$_tmpl$2),
|
|
9144
9190
|
_el$2 = _el$.firstChild,
|
|
@@ -9982,8 +10028,8 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
9982
10028
|
const is_selected = $9HbP8$createMemo(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
9983
10029
|
const parent_title_if_exists = $9HbP8$createMemo(() => {
|
|
9984
10030
|
const item = input_obj();
|
|
9985
|
-
if (!("
|
|
9986
|
-
return item.
|
|
10031
|
+
if (!("ancestors" in item)) return;
|
|
10032
|
+
return item.ancestors.at(-1)?.title;
|
|
9987
10033
|
});
|
|
9988
10034
|
return (() => {
|
|
9989
10035
|
const _el$ = $9HbP8$getNextElement($cea52f6b24092f05$var$_tmpl$);
|
package/locales/ES10/index.cjs
CHANGED
|
@@ -985,33 +985,33 @@ const $50cd633c714251ff$export$84584c2a98eb6753 = {
|
|
|
985
985
|
backend_locale_: "en"
|
|
986
986
|
};
|
|
987
987
|
const $50cd633c714251ff$export$c8af9ccf06a8b16a = {
|
|
988
|
-
...(0, $
|
|
989
|
-
...(0, $
|
|
988
|
+
...(0, $37232ce8fd20bb15$export$61b15fe6451cdba0),
|
|
989
|
+
...(0, $37232ce8fd20bb15$export$434b5d2e9cbbcde1),
|
|
990
990
|
backend_locale_: "en_AU"
|
|
991
991
|
};
|
|
992
992
|
const $50cd633c714251ff$export$a2bced10ed717c1f = {
|
|
993
|
-
...(0, $
|
|
994
|
-
...(0, $
|
|
993
|
+
...(0, $37232ce8fd20bb15$export$61b15fe6451cdba0),
|
|
994
|
+
...(0, $37232ce8fd20bb15$export$434b5d2e9cbbcde1),
|
|
995
995
|
backend_locale_: "en_CA"
|
|
996
996
|
};
|
|
997
997
|
const $50cd633c714251ff$export$6ac7ea553f9cecc6 = {
|
|
998
|
-
...(0, $
|
|
999
|
-
...(0, $
|
|
998
|
+
...(0, $37232ce8fd20bb15$export$61b15fe6451cdba0),
|
|
999
|
+
...(0, $37232ce8fd20bb15$export$434b5d2e9cbbcde1),
|
|
1000
1000
|
backend_locale_: "en_EU"
|
|
1001
1001
|
};
|
|
1002
1002
|
const $50cd633c714251ff$export$b76508d27899e649 = {
|
|
1003
|
-
...(0, $
|
|
1004
|
-
...(0, $
|
|
1003
|
+
...(0, $37232ce8fd20bb15$export$61b15fe6451cdba0),
|
|
1004
|
+
...(0, $37232ce8fd20bb15$export$434b5d2e9cbbcde1),
|
|
1005
1005
|
backend_locale_: "en_GB"
|
|
1006
1006
|
};
|
|
1007
1007
|
const $50cd633c714251ff$export$df031397bb44d506 = {
|
|
1008
|
-
...(0, $
|
|
1009
|
-
...(0, $
|
|
1008
|
+
...(0, $37232ce8fd20bb15$export$61b15fe6451cdba0),
|
|
1009
|
+
...(0, $37232ce8fd20bb15$export$434b5d2e9cbbcde1),
|
|
1010
1010
|
backend_locale_: "en_IE"
|
|
1011
1011
|
};
|
|
1012
1012
|
const $50cd633c714251ff$export$25dc44e90bc68e13 = {
|
|
1013
|
-
...(0, $
|
|
1014
|
-
...(0, $
|
|
1013
|
+
...(0, $37232ce8fd20bb15$export$61b15fe6451cdba0),
|
|
1014
|
+
...(0, $37232ce8fd20bb15$export$434b5d2e9cbbcde1),
|
|
1015
1015
|
backend_locale_: "en_US"
|
|
1016
1016
|
};
|
|
1017
1017
|
const $50cd633c714251ff$export$ed5179c818622fb = {
|
package/locales/ES10/index.js
CHANGED
|
@@ -944,33 +944,33 @@ const $72b32e7f8dfbdf34$export$84584c2a98eb6753 = {
|
|
|
944
944
|
backend_locale_: "en"
|
|
945
945
|
};
|
|
946
946
|
const $72b32e7f8dfbdf34$export$c8af9ccf06a8b16a = {
|
|
947
|
-
...(0, $
|
|
948
|
-
...(0, $
|
|
947
|
+
...(0, $3ae9d5d3dda72bac$export$61b15fe6451cdba0),
|
|
948
|
+
...(0, $3ae9d5d3dda72bac$export$434b5d2e9cbbcde1),
|
|
949
949
|
backend_locale_: "en_AU"
|
|
950
950
|
};
|
|
951
951
|
const $72b32e7f8dfbdf34$export$a2bced10ed717c1f = {
|
|
952
|
-
...(0, $
|
|
953
|
-
...(0, $
|
|
952
|
+
...(0, $3ae9d5d3dda72bac$export$61b15fe6451cdba0),
|
|
953
|
+
...(0, $3ae9d5d3dda72bac$export$434b5d2e9cbbcde1),
|
|
954
954
|
backend_locale_: "en_CA"
|
|
955
955
|
};
|
|
956
956
|
const $72b32e7f8dfbdf34$export$6ac7ea553f9cecc6 = {
|
|
957
|
-
...(0, $
|
|
958
|
-
...(0, $
|
|
957
|
+
...(0, $3ae9d5d3dda72bac$export$61b15fe6451cdba0),
|
|
958
|
+
...(0, $3ae9d5d3dda72bac$export$434b5d2e9cbbcde1),
|
|
959
959
|
backend_locale_: "en_EU"
|
|
960
960
|
};
|
|
961
961
|
const $72b32e7f8dfbdf34$export$b76508d27899e649 = {
|
|
962
|
-
...(0, $
|
|
963
|
-
...(0, $
|
|
962
|
+
...(0, $3ae9d5d3dda72bac$export$61b15fe6451cdba0),
|
|
963
|
+
...(0, $3ae9d5d3dda72bac$export$434b5d2e9cbbcde1),
|
|
964
964
|
backend_locale_: "en_GB"
|
|
965
965
|
};
|
|
966
966
|
const $72b32e7f8dfbdf34$export$df031397bb44d506 = {
|
|
967
|
-
...(0, $
|
|
968
|
-
...(0, $
|
|
967
|
+
...(0, $3ae9d5d3dda72bac$export$61b15fe6451cdba0),
|
|
968
|
+
...(0, $3ae9d5d3dda72bac$export$434b5d2e9cbbcde1),
|
|
969
969
|
backend_locale_: "en_IE"
|
|
970
970
|
};
|
|
971
971
|
const $72b32e7f8dfbdf34$export$25dc44e90bc68e13 = {
|
|
972
|
-
...(0, $
|
|
973
|
-
...(0, $
|
|
972
|
+
...(0, $3ae9d5d3dda72bac$export$61b15fe6451cdba0),
|
|
973
|
+
...(0, $3ae9d5d3dda72bac$export$434b5d2e9cbbcde1),
|
|
974
974
|
backend_locale_: "en_US"
|
|
975
975
|
};
|
|
976
976
|
const $72b32e7f8dfbdf34$export$ed5179c818622fb = {
|
package/locales/latest/index.cjs
CHANGED
|
@@ -985,33 +985,33 @@ const $2d187e768d780a64$export$84584c2a98eb6753 = {
|
|
|
985
985
|
backend_locale_: "en"
|
|
986
986
|
};
|
|
987
987
|
const $2d187e768d780a64$export$c8af9ccf06a8b16a = {
|
|
988
|
-
...(0, $
|
|
989
|
-
...(0, $
|
|
988
|
+
...(0, $f1b6d8431ecd6285$export$61b15fe6451cdba0),
|
|
989
|
+
...(0, $f1b6d8431ecd6285$export$434b5d2e9cbbcde1),
|
|
990
990
|
backend_locale_: "en_AU"
|
|
991
991
|
};
|
|
992
992
|
const $2d187e768d780a64$export$a2bced10ed717c1f = {
|
|
993
|
-
...(0, $
|
|
994
|
-
...(0, $
|
|
993
|
+
...(0, $f1b6d8431ecd6285$export$61b15fe6451cdba0),
|
|
994
|
+
...(0, $f1b6d8431ecd6285$export$434b5d2e9cbbcde1),
|
|
995
995
|
backend_locale_: "en_CA"
|
|
996
996
|
};
|
|
997
997
|
const $2d187e768d780a64$export$6ac7ea553f9cecc6 = {
|
|
998
|
-
...(0, $
|
|
999
|
-
...(0, $
|
|
998
|
+
...(0, $f1b6d8431ecd6285$export$61b15fe6451cdba0),
|
|
999
|
+
...(0, $f1b6d8431ecd6285$export$434b5d2e9cbbcde1),
|
|
1000
1000
|
backend_locale_: "en_EU"
|
|
1001
1001
|
};
|
|
1002
1002
|
const $2d187e768d780a64$export$b76508d27899e649 = {
|
|
1003
|
-
...(0, $
|
|
1004
|
-
...(0, $
|
|
1003
|
+
...(0, $f1b6d8431ecd6285$export$61b15fe6451cdba0),
|
|
1004
|
+
...(0, $f1b6d8431ecd6285$export$434b5d2e9cbbcde1),
|
|
1005
1005
|
backend_locale_: "en_GB"
|
|
1006
1006
|
};
|
|
1007
1007
|
const $2d187e768d780a64$export$df031397bb44d506 = {
|
|
1008
|
-
...(0, $
|
|
1009
|
-
...(0, $
|
|
1008
|
+
...(0, $f1b6d8431ecd6285$export$61b15fe6451cdba0),
|
|
1009
|
+
...(0, $f1b6d8431ecd6285$export$434b5d2e9cbbcde1),
|
|
1010
1010
|
backend_locale_: "en_IE"
|
|
1011
1011
|
};
|
|
1012
1012
|
const $2d187e768d780a64$export$25dc44e90bc68e13 = {
|
|
1013
|
-
...(0, $
|
|
1014
|
-
...(0, $
|
|
1013
|
+
...(0, $f1b6d8431ecd6285$export$61b15fe6451cdba0),
|
|
1014
|
+
...(0, $f1b6d8431ecd6285$export$434b5d2e9cbbcde1),
|
|
1015
1015
|
backend_locale_: "en_US"
|
|
1016
1016
|
};
|
|
1017
1017
|
const $2d187e768d780a64$export$ed5179c818622fb = {
|