@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.
@@ -83,7 +83,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
83
83
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
84
84
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
85
85
  /*! Depict.ai search and product listing SDK */
86
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.6";
86
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.7";
87
87
  const $9d19451330d04c3c$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>'];
88
88
  function $9d19451330d04c3c$export$8be2714ec7f169ee() {
89
89
  var _$escape2, _$escape3;
@@ -4754,6 +4754,69 @@ function $b3dc12c672c9df24$export$967e966fca9515e(api_response) {
4754
4754
  // Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
4755
4755
  const $c3739e86187f2054$export$74ee7529ce0f8a00 = "listingId";
4756
4756
  const $c3739e86187f2054$export$5aae649db1b959fc = "externalId";
4757
+
4758
+ /**
4759
+ * 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.
4760
+ */
4761
+ async function $097d688689209955$export$d9792230b7c0203e(_ref) {
4762
+ let {
4763
+ input_data_: {
4764
+ ancestors: ancestors,
4765
+ children: children,
4766
+ siblings: siblings,
4767
+ ...clonedInputData
4768
+ },
4769
+ category_transformer_ = v => v.data,
4770
+ merchant_:
4771
+ // in case no display transformer just pass the data through, so we don't break
4772
+ merchant_,
4773
+ market_: market_,
4774
+ locale_: locale_
4775
+ } = _ref;
4776
+ const breadcrumbs = [];
4777
+ const clonedAncestors = [...ancestors];
4778
+ while (clonedAncestors.length) {
4779
+ const ancestor = clonedAncestors.pop();
4780
+ if (!ancestor.show_in_breadcrumbs) continue;
4781
+ breadcrumbs.push({
4782
+ ...ancestor,
4783
+ ancestors: [...clonedAncestors]
4784
+ });
4785
+ }
4786
+ breadcrumbs.reverse();
4787
+ const quicklinksIsChildren = children.length;
4788
+ const quickLinks = (quicklinksIsChildren ? children : siblings).filter(_ref2 => {
4789
+ let {
4790
+ show_in_quicklinks: show_in_quicklinks
4791
+ } = _ref2;
4792
+ return show_in_quicklinks;
4793
+ }).map(productListing => {
4794
+ const ancestorsForUs = [...ancestors];
4795
+ if (quicklinksIsChildren) ancestorsForUs.push({
4796
+ ...clonedInputData
4797
+ });
4798
+ return {
4799
+ ...productListing,
4800
+ ancestors: ancestorsForUs
4801
+ };
4802
+ });
4803
+ const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
4804
+ merchant: merchant_,
4805
+ market: market_,
4806
+ locale: locale_,
4807
+ data: breadcrumbs
4808
+ }), category_transformer_({
4809
+ merchant: merchant_,
4810
+ market: market_,
4811
+ locale: locale_,
4812
+ data: quickLinks
4813
+ })]);
4814
+ return {
4815
+ ...clonedInputData,
4816
+ breadcrumbs: transformedBreadcrumbs,
4817
+ quick_links: transformedQuickLinks
4818
+ };
4819
+ }
4757
4820
  function $e270e9f953fcbc58$var$_classPrivateMethodInitSpec(obj, privateSet) {
4758
4821
  $e270e9f953fcbc58$var$_checkPrivateRedeclaration(obj, privateSet);
4759
4822
  privateSet.add(obj);
@@ -4781,6 +4844,9 @@ var $e270e9f953fcbc58$var$_run_url_creator_for_suggest = /*#__PURE__*/new WeakSe
4781
4844
  var $e270e9f953fcbc58$var$_run_display_transformers_for_rest = /*#__PURE__*/new WeakSet();
4782
4845
  var $e270e9f953fcbc58$var$_cached_request = /*#__PURE__*/new WeakSet();
4783
4846
  class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
4847
+ /**
4848
+ * rest = everything except query suggestions
4849
+ */
4784
4850
  constructor(options) {
4785
4851
  $e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_cached_request);
4786
4852
  $e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_run_display_transformers_for_rest);
@@ -4837,7 +4903,7 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
4837
4903
  const decoded_json = await results.json();
4838
4904
  if (!Array.isArray(decoded_json === null || decoded_json === void 0 ? void 0 : decoded_json.suggestions)) break attempt_to_return_api_response;
4839
4905
  try {
4840
- return await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_run_url_creator_for_suggest, $e270e9f953fcbc58$var$_run_url_creator_for_suggest2).call(this, input_req.merchant, input_req.market, decoded_json);
4906
+ return await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_run_url_creator_for_suggest, $e270e9f953fcbc58$var$_run_url_creator_for_suggest2).call(this, input_req.merchant, input_req.market, input_req.locale, decoded_json);
4841
4907
  } catch (e) {
4842
4908
  $3hooq$depictaiutilishared.dwarn("displayTransformer failed", e);
4843
4909
  }
@@ -4874,13 +4940,12 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
4874
4940
  fallback_response_: () => ({
4875
4941
  listing_id: "",
4876
4942
  listing_type: "category",
4877
- "title": "",
4878
- "description": "string",
4879
- "replace_meta_tags": true,
4880
- "slug": "",
4881
- "updated_at": new Date().toISOString(),
4882
- "breadcrumbs": [],
4883
- "quick_links": [],
4943
+ title: "",
4944
+ slug: "",
4945
+ show_in_breadcrumbs: false,
4946
+ show_in_quicklinks: false,
4947
+ breadcrumbs: [],
4948
+ quick_links: [],
4884
4949
  failed: true
4885
4950
  }),
4886
4951
  method_: "GET"
@@ -4927,7 +4992,7 @@ function $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint2(endpoint) {
4927
4992
  })) : undefined
4928
4993
  });
4929
4994
  }
4930
- async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, market, response) {
4995
+ async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, market, locale, response) {
4931
4996
  var _this$display_transfo;
4932
4997
  const category_transformer = (_this$display_transfo = this.display_transformers) === null || _this$display_transfo === void 0 ? void 0 : _this$display_transfo.categories;
4933
4998
  if (!category_transformer) return response;
@@ -4936,12 +5001,13 @@ async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, mar
4936
5001
  const transformed_category_suggestions = await category_transformer({
4937
5002
  market: market,
4938
5003
  merchant: merchant,
5004
+ locale: locale,
4939
5005
  data: [...category_suggestions]
4940
5006
  });
4941
5007
  response.suggestions = transformed_category_suggestions;
4942
5008
  return response;
4943
5009
  }
4944
- async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, input_data) {
5010
+ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
4945
5011
  const {
4946
5012
  display_transformers: display_transformers
4947
5013
  } = this;
@@ -4957,25 +5023,24 @@ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchan
4957
5023
  const transformed_displays = await product_transformer({
4958
5024
  merchant: merchant,
4959
5025
  market: market,
5026
+ locale: locale,
4960
5027
  displays: [...displays]
4961
5028
  });
4962
5029
  input_data.displays = transformed_displays;
4963
5030
  }
4964
- if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
4965
- const category_display_array = input_data[key];
4966
- if (!category_display_array) continue;
4967
- const transformed_category_displays = await category_transformer({
4968
- merchant: merchant,
4969
- market: market,
4970
- data: [...category_display_array]
4971
- });
4972
- input_data[key] = transformed_category_displays;
4973
- }
4974
5031
  if (content_search_links !== null && content_search_links !== void 0 && content_search_links.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
4975
5032
  merchant: merchant,
4976
5033
  market: market,
5034
+ locale: locale,
4977
5035
  data: [...content_search_links]
4978
5036
  });
5037
+ if (input_data.ancestors) return await $097d688689209955$export$d9792230b7c0203e({
5038
+ input_data_: input_data,
5039
+ category_transformer_: category_transformer,
5040
+ merchant_: merchant,
5041
+ market_: market,
5042
+ locale_: locale
5043
+ });
4979
5044
  return input_data;
4980
5045
  }
4981
5046
  async function $e270e9f953fcbc58$var$_cached_request2(_ref3) {
@@ -5014,7 +5079,7 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref3) {
5014
5079
  let result;
5015
5080
  try {
5016
5081
  const unmodified_result = await api_response.json();
5017
- result = await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_run_display_transformers_for_rest, $e270e9f953fcbc58$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, unmodified_result);
5082
+ result = await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_run_display_transformers_for_rest, $e270e9f953fcbc58$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
5018
5083
  } catch (e) {
5019
5084
  $3hooq$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
5020
5085
  break return_successfully;
@@ -7318,7 +7383,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
7318
7383
  var _plp_meta;
7319
7384
  return (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.title;
7320
7385
  });
7321
- const crumb_data_ = $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta, title);
7386
+ const crumb_data_ = $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta);
7322
7387
  const quicklinks_data_ = $3hooq$solidjs.createMemo(() => {
7323
7388
  var _plp_meta2;
7324
7389
  return (_plp_meta2 = plp_meta()) === null || _plp_meta2 === void 0 ? void 0 : _plp_meta2.quick_links;
@@ -7559,32 +7624,17 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
7559
7624
  /**
7560
7625
  * Adds the current page as last breadcrumb to the breadcrumb trail
7561
7626
  */
7562
- function $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta, title) {
7627
+ function $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta) {
7563
7628
  const href_accessor = $3hooq$depictaiutilisharedlatest.use_href_accessor();
7564
7629
  return $3hooq$solidjs.createMemo(() => {
7565
7630
  var _plp_meta3;
7566
7631
  const api_value = (_plp_meta3 = plp_meta()) === null || _plp_meta3 === void 0 ? void 0 : _plp_meta3.breadcrumbs;
7567
7632
  if (!api_value) return api_value;
7568
- return [...api_value, {
7569
- get listing_id() {
7570
- return plp_meta().listing_id;
7571
- },
7572
- get title() {
7573
- return title();
7574
- },
7633
+ return [...api_value, $3hooq$solidjs.mergeProps(plp_meta(), {
7575
7634
  get page_url() {
7576
7635
  return href_accessor();
7577
- },
7578
- get slug() {
7579
- return plp_meta().slug;
7580
- },
7581
- get listing_type() {
7582
- return plp_meta().listing_type;
7583
- },
7584
- get external_id() {
7585
- return plp_meta().external_id;
7586
7636
  }
7587
- }];
7637
+ })];
7588
7638
  });
7589
7639
  }
7590
7640
  function $5dd9d0d3ea82e2dd$export$477caf01aecaeb2a(options) {
@@ -8247,7 +8297,7 @@ function $3001ad378baf39dc$export$d757d54550ebfb3d(_ref) {
8247
8297
  } = _ref;
8248
8298
  const parentTitle = $3hooq$solidjs.createMemo(() => {
8249
8299
  var _category_suggestion_;
8250
- return (_category_suggestion_ = category_suggestion_().breadcrumbs.at(-1)) === null || _category_suggestion_ === void 0 ? void 0 : _category_suggestion_.title;
8300
+ return (_category_suggestion_ = category_suggestion_().ancestors.at(-1)) === null || _category_suggestion_ === void 0 ? void 0 : _category_suggestion_.title;
8251
8301
  });
8252
8302
  return $3hooq$solidjsweb.ssr($3001ad378baf39dc$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrAttribute("href", $3hooq$solidjsweb.escape(category_suggestion_().page_url, true), false), $3hooq$solidjsweb.escape(category_suggestion_().title), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
8253
8303
  get when() {
@@ -8842,10 +8892,10 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
8842
8892
  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;
8843
8893
  });
8844
8894
  const parent_title_if_exists = $3hooq$solidjs.createMemo(() => {
8845
- var _item$breadcrumbs$at;
8895
+ var _item$ancestors$at;
8846
8896
  const item = input_obj();
8847
- if (!("breadcrumbs" in item)) return;
8848
- return (_item$breadcrumbs$at = item.breadcrumbs.at(-1)) === null || _item$breadcrumbs$at === void 0 ? void 0 : _item$breadcrumbs$at.title;
8897
+ if (!("ancestors" in item)) return;
8898
+ return (_item$ancestors$at = item.ancestors.at(-1)) === null || _item$ancestors$at === void 0 ? void 0 : _item$ancestors$at.title;
8849
8899
  });
8850
8900
  return $3hooq$solidjsweb.ssr($0677d509ad208e22$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "suggestion ".concat(is_selected() ? "selected" : "", " ").concat(is_history ? "history" : "", " ").concat($3hooq$solidjsweb.escape($3hooq$solidjsweb.escape("type-" + input_obj().type, true), true)), $3hooq$solidjsweb.ssrAttribute("href", $3hooq$solidjsweb.escape(href(), true), false), is_query() ? $3hooq$solidjsweb.escape([$3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
8851
8901
  when: is_history,
@@ -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.6";
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 ProductListing | ListingSuggestion>(options: DisplayTransformerAlwaysThereData & {
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 GetListingResponse]: K extends "breadcrumbs" ? ProductListingWithPageURL[] : K extends "quick_links" ? ProductListingWithPageURL[] : GetListingResponse[K] };
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;
@@ -10,7 +10,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.6";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "3.0.7";
14
14
  const $ca6ab5f08bd28bca$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>'];
15
15
  function $ca6ab5f08bd28bca$export$8be2714ec7f169ee() {
16
16
  var _$escape2, _$escape3;
@@ -4681,6 +4681,69 @@ function $ed0fefda39a0f15d$export$967e966fca9515e(api_response) {
4681
4681
  // Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
4682
4682
  const $397620a4d7958ed1$export$74ee7529ce0f8a00 = "listingId";
4683
4683
  const $397620a4d7958ed1$export$5aae649db1b959fc = "externalId";
4684
+
4685
+ /**
4686
+ * 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.
4687
+ */
4688
+ async function $f454ce4c74ef4dc0$export$d9792230b7c0203e(_ref) {
4689
+ let {
4690
+ input_data_: {
4691
+ ancestors: ancestors,
4692
+ children: children,
4693
+ siblings: siblings,
4694
+ ...clonedInputData
4695
+ },
4696
+ category_transformer_ = v => v.data,
4697
+ merchant_:
4698
+ // in case no display transformer just pass the data through, so we don't break
4699
+ merchant_,
4700
+ market_: market_,
4701
+ locale_: locale_
4702
+ } = _ref;
4703
+ const breadcrumbs = [];
4704
+ const clonedAncestors = [...ancestors];
4705
+ while (clonedAncestors.length) {
4706
+ const ancestor = clonedAncestors.pop();
4707
+ if (!ancestor.show_in_breadcrumbs) continue;
4708
+ breadcrumbs.push({
4709
+ ...ancestor,
4710
+ ancestors: [...clonedAncestors]
4711
+ });
4712
+ }
4713
+ breadcrumbs.reverse();
4714
+ const quicklinksIsChildren = children.length;
4715
+ const quickLinks = (quicklinksIsChildren ? children : siblings).filter(_ref2 => {
4716
+ let {
4717
+ show_in_quicklinks: show_in_quicklinks
4718
+ } = _ref2;
4719
+ return show_in_quicklinks;
4720
+ }).map(productListing => {
4721
+ const ancestorsForUs = [...ancestors];
4722
+ if (quicklinksIsChildren) ancestorsForUs.push({
4723
+ ...clonedInputData
4724
+ });
4725
+ return {
4726
+ ...productListing,
4727
+ ancestors: ancestorsForUs
4728
+ };
4729
+ });
4730
+ const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
4731
+ merchant: merchant_,
4732
+ market: market_,
4733
+ locale: locale_,
4734
+ data: breadcrumbs
4735
+ }), category_transformer_({
4736
+ merchant: merchant_,
4737
+ market: market_,
4738
+ locale: locale_,
4739
+ data: quickLinks
4740
+ })]);
4741
+ return {
4742
+ ...clonedInputData,
4743
+ breadcrumbs: transformedBreadcrumbs,
4744
+ quick_links: transformedQuickLinks
4745
+ };
4746
+ }
4684
4747
  function $284849364a6ef73a$var$_classPrivateMethodInitSpec(obj, privateSet) {
4685
4748
  $284849364a6ef73a$var$_checkPrivateRedeclaration(obj, privateSet);
4686
4749
  privateSet.add(obj);
@@ -4708,6 +4771,9 @@ var $284849364a6ef73a$var$_run_url_creator_for_suggest = /*#__PURE__*/new WeakSe
4708
4771
  var $284849364a6ef73a$var$_run_display_transformers_for_rest = /*#__PURE__*/new WeakSet();
4709
4772
  var $284849364a6ef73a$var$_cached_request = /*#__PURE__*/new WeakSet();
4710
4773
  class $284849364a6ef73a$export$e015ed2f2950f2e3 {
4774
+ /**
4775
+ * rest = everything except query suggestions
4776
+ */
4711
4777
  constructor(options) {
4712
4778
  $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_cached_request);
4713
4779
  $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_display_transformers_for_rest);
@@ -4764,7 +4830,7 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
4764
4830
  const decoded_json = await results.json();
4765
4831
  if (!Array.isArray(decoded_json === null || decoded_json === void 0 ? void 0 : decoded_json.suggestions)) break attempt_to_return_api_response;
4766
4832
  try {
4767
- return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_url_creator_for_suggest, $284849364a6ef73a$var$_run_url_creator_for_suggest2).call(this, input_req.merchant, input_req.market, decoded_json);
4833
+ return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_url_creator_for_suggest, $284849364a6ef73a$var$_run_url_creator_for_suggest2).call(this, input_req.merchant, input_req.market, input_req.locale, decoded_json);
4768
4834
  } catch (e) {
4769
4835
  $b8hua$dwarn("displayTransformer failed", e);
4770
4836
  }
@@ -4801,13 +4867,12 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
4801
4867
  fallback_response_: () => ({
4802
4868
  listing_id: "",
4803
4869
  listing_type: "category",
4804
- "title": "",
4805
- "description": "string",
4806
- "replace_meta_tags": true,
4807
- "slug": "",
4808
- "updated_at": new Date().toISOString(),
4809
- "breadcrumbs": [],
4810
- "quick_links": [],
4870
+ title: "",
4871
+ slug: "",
4872
+ show_in_breadcrumbs: false,
4873
+ show_in_quicklinks: false,
4874
+ breadcrumbs: [],
4875
+ quick_links: [],
4811
4876
  failed: true
4812
4877
  }),
4813
4878
  method_: "GET"
@@ -4854,7 +4919,7 @@ function $284849364a6ef73a$var$_get_cache_obj_for_endpoint2(endpoint) {
4854
4919
  })) : undefined
4855
4920
  });
4856
4921
  }
4857
- async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, market, response) {
4922
+ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, market, locale, response) {
4858
4923
  var _this$display_transfo;
4859
4924
  const category_transformer = (_this$display_transfo = this.display_transformers) === null || _this$display_transfo === void 0 ? void 0 : _this$display_transfo.categories;
4860
4925
  if (!category_transformer) return response;
@@ -4863,12 +4928,13 @@ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, mar
4863
4928
  const transformed_category_suggestions = await category_transformer({
4864
4929
  market: market,
4865
4930
  merchant: merchant,
4931
+ locale: locale,
4866
4932
  data: [...category_suggestions]
4867
4933
  });
4868
4934
  response.suggestions = transformed_category_suggestions;
4869
4935
  return response;
4870
4936
  }
4871
- async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, input_data) {
4937
+ async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
4872
4938
  const {
4873
4939
  display_transformers: display_transformers
4874
4940
  } = this;
@@ -4884,25 +4950,24 @@ async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchan
4884
4950
  const transformed_displays = await product_transformer({
4885
4951
  merchant: merchant,
4886
4952
  market: market,
4953
+ locale: locale,
4887
4954
  displays: [...displays]
4888
4955
  });
4889
4956
  input_data.displays = transformed_displays;
4890
4957
  }
4891
- if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
4892
- const category_display_array = input_data[key];
4893
- if (!category_display_array) continue;
4894
- const transformed_category_displays = await category_transformer({
4895
- merchant: merchant,
4896
- market: market,
4897
- data: [...category_display_array]
4898
- });
4899
- input_data[key] = transformed_category_displays;
4900
- }
4901
4958
  if (content_search_links !== null && content_search_links !== void 0 && content_search_links.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
4902
4959
  merchant: merchant,
4903
4960
  market: market,
4961
+ locale: locale,
4904
4962
  data: [...content_search_links]
4905
4963
  });
4964
+ if (input_data.ancestors) return await $f454ce4c74ef4dc0$export$d9792230b7c0203e({
4965
+ input_data_: input_data,
4966
+ category_transformer_: category_transformer,
4967
+ merchant_: merchant,
4968
+ market_: market,
4969
+ locale_: locale
4970
+ });
4906
4971
  return input_data;
4907
4972
  }
4908
4973
  async function $284849364a6ef73a$var$_cached_request2(_ref3) {
@@ -4941,7 +5006,7 @@ async function $284849364a6ef73a$var$_cached_request2(_ref3) {
4941
5006
  let result;
4942
5007
  try {
4943
5008
  const unmodified_result = await api_response.json();
4944
- result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_display_transformers_for_rest, $284849364a6ef73a$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, unmodified_result);
5009
+ result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_display_transformers_for_rest, $284849364a6ef73a$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
4945
5010
  } catch (e) {
4946
5011
  $b8hua$dwarn("displayTransformer or json decoding failed", e);
4947
5012
  break return_successfully;
@@ -7245,7 +7310,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
7245
7310
  var _plp_meta;
7246
7311
  return (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.title;
7247
7312
  });
7248
- const crumb_data_ = $4b4b262708b516ee$var$add_us_to_crumbs(plp_meta, title);
7313
+ const crumb_data_ = $4b4b262708b516ee$var$add_us_to_crumbs(plp_meta);
7249
7314
  const quicklinks_data_ = $b8hua$createMemo(() => {
7250
7315
  var _plp_meta2;
7251
7316
  return (_plp_meta2 = plp_meta()) === null || _plp_meta2 === void 0 ? void 0 : _plp_meta2.quick_links;
@@ -7486,32 +7551,17 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
7486
7551
  /**
7487
7552
  * Adds the current page as last breadcrumb to the breadcrumb trail
7488
7553
  */
7489
- function $4b4b262708b516ee$var$add_us_to_crumbs(plp_meta, title) {
7554
+ function $4b4b262708b516ee$var$add_us_to_crumbs(plp_meta) {
7490
7555
  const href_accessor = $b8hua$use_href_accessor();
7491
7556
  return $b8hua$createMemo(() => {
7492
7557
  var _plp_meta3;
7493
7558
  const api_value = (_plp_meta3 = plp_meta()) === null || _plp_meta3 === void 0 ? void 0 : _plp_meta3.breadcrumbs;
7494
7559
  if (!api_value) return api_value;
7495
- return [...api_value, {
7496
- get listing_id() {
7497
- return plp_meta().listing_id;
7498
- },
7499
- get title() {
7500
- return title();
7501
- },
7560
+ return [...api_value, $b8hua$mergeProps1(plp_meta(), {
7502
7561
  get page_url() {
7503
7562
  return href_accessor();
7504
- },
7505
- get slug() {
7506
- return plp_meta().slug;
7507
- },
7508
- get listing_type() {
7509
- return plp_meta().listing_type;
7510
- },
7511
- get external_id() {
7512
- return plp_meta().external_id;
7513
7563
  }
7514
- }];
7564
+ })];
7515
7565
  });
7516
7566
  }
7517
7567
  function $9d3d794b62318ecc$export$477caf01aecaeb2a(options) {
@@ -8174,7 +8224,7 @@ function $dea31647b99a443b$export$d757d54550ebfb3d(_ref) {
8174
8224
  } = _ref;
8175
8225
  const parentTitle = $b8hua$createMemo(() => {
8176
8226
  var _category_suggestion_;
8177
- return (_category_suggestion_ = category_suggestion_().breadcrumbs.at(-1)) === null || _category_suggestion_ === void 0 ? void 0 : _category_suggestion_.title;
8227
+ return (_category_suggestion_ = category_suggestion_().ancestors.at(-1)) === null || _category_suggestion_ === void 0 ? void 0 : _category_suggestion_.title;
8178
8228
  });
8179
8229
  return $b8hua$ssr($dea31647b99a443b$var$_tmpl$2, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("href", $b8hua$escape(category_suggestion_().page_url, true), false), $b8hua$escape(category_suggestion_().title), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
8180
8230
  get when() {
@@ -8769,10 +8819,10 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
8769
8819
  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;
8770
8820
  });
8771
8821
  const parent_title_if_exists = $b8hua$createMemo(() => {
8772
- var _item$breadcrumbs$at;
8822
+ var _item$ancestors$at;
8773
8823
  const item = input_obj();
8774
- if (!("breadcrumbs" in item)) return;
8775
- return (_item$breadcrumbs$at = item.breadcrumbs.at(-1)) === null || _item$breadcrumbs$at === void 0 ? void 0 : _item$breadcrumbs$at.title;
8824
+ if (!("ancestors" in item)) return;
8825
+ return (_item$ancestors$at = item.ancestors.at(-1)) === null || _item$ancestors$at === void 0 ? void 0 : _item$ancestors$at.title;
8776
8826
  });
8777
8827
  return $b8hua$ssr($40dd3f46f55d62ba$var$_tmpl$, $b8hua$ssrHydrationKey(), "suggestion ".concat(is_selected() ? "selected" : "", " ").concat(is_history ? "history" : "", " ").concat($b8hua$escape($b8hua$escape("type-" + input_obj().type, true), true)), $b8hua$ssrAttribute("href", $b8hua$escape(href(), true), false), is_query() ? $b8hua$escape([$b8hua$createComponent((0, $b8hua$Show), {
8778
8828
  when: is_history,