@depict-ai/ui 4.8.8 → 4.8.9

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 CHANGED
@@ -114,7 +114,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
114
114
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
115
115
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
116
116
  /*! Depict.ai search and product listing SDK */
117
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.8.8";
117
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.8.9";
118
118
  function $054b1113e4897051$export$54c6d6ff54e72743(whatToWatch) {
119
119
  const [width, setWidth] = $52FdA$solidjs.createSignal(0);
120
120
  const [height, setHeight] = $52FdA$solidjs.createSignal(0);
@@ -10752,11 +10752,13 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
10752
10752
  let {
10753
10753
  id_to_query_for_: id_to_query_for_,
10754
10754
  id_type_: id_type_,
10755
+ currentListingForTransformer_: currentListingForTransformer_,
10755
10756
  ...input_req_
10756
10757
  } = _ref2;
10757
10758
  return await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_cached_request, $e270e9f953fcbc58$var$_cached_request2).call(this, {
10758
10759
  endpoint_: $e270e9f953fcbc58$var$v3_base_url + "listings/" + (id_type_ === $c3739e86187f2054$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
10759
10760
  input_req_: input_req_,
10761
+ currentListingForTransformer_: currentListingForTransformer_,
10760
10762
  fallback_response_: () => ({
10761
10763
  "n_hits": 0,
10762
10764
  "displays": [],
@@ -10841,7 +10843,7 @@ async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, mar
10841
10843
  response.suggestions = transformedSuggestions;
10842
10844
  return response;
10843
10845
  }
10844
- async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
10846
+ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data, currentListingForTransformer) {
10845
10847
  const {
10846
10848
  display_transformers: display_transformers
10847
10849
  } = this;
@@ -10857,7 +10859,8 @@ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchan
10857
10859
  merchant: merchant,
10858
10860
  market: market,
10859
10861
  locale: locale,
10860
- displays: [...displays]
10862
+ displays: [...displays],
10863
+ currentListing: currentListingForTransformer
10861
10864
  });
10862
10865
  input_data.displays = transformed_displays;
10863
10866
  }
@@ -10882,7 +10885,8 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref4) {
10882
10885
  endpoint_: endpoint_,
10883
10886
  input_req_: input_req_,
10884
10887
  fallback_response_: fallback_response_,
10885
- method_ = "POST"
10888
+ method_ = "POST",
10889
+ currentListingForTransformer_: currentListingForTransformer_
10886
10890
  } = _ref4;
10887
10891
  const cache_obj = $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint2).call(this, endpoint_);
10888
10892
  const with_ids = $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $e270e9f953fcbc58$var$_add_ids_to_request).call(this, input_req_);
@@ -10912,7 +10916,7 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref4) {
10912
10916
  let result;
10913
10917
  try {
10914
10918
  const unmodified_result = await api_response.json();
10915
- 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);
10919
+ 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, currentListingForTransformer_);
10916
10920
  } catch (e) {
10917
10921
  $52FdA$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
10918
10922
  break return_successfully;
@@ -16237,6 +16241,10 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16237
16241
  const all_products_loaded_ = $52FdA$solidjs.createSignal(false);
16238
16242
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $52FdA$solidjs.createSignal(0);
16239
16243
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $52FdA$solidjs.createSignal(false);
16244
+ const owner = $52FdA$solidjs.getOwner();
16245
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $52FdA$solidjs.createSignal(new Map(), {
16246
+ equals: false
16247
+ });
16240
16248
  const products_query_base_ = $e4bc31358c414b18$export$210f130a61ac1e8d(() => {
16241
16249
  const sort_obj = get_sorting() && {
16242
16250
  ...get_sorting()
@@ -16269,7 +16277,20 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16269
16277
  limit: limit,
16270
16278
  ...(cursor ? {
16271
16279
  cursor: cursor
16272
- } : {})
16280
+ } : {}),
16281
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
16282
+ // It's very hard to implement tracking that uses the collection title without this information
16283
+ currentListingForTransformer_: new Promise(resolve => $52FdA$solidjs.createRoot(dispose => {
16284
+ $52FdA$solidjs.createEffect($52FdA$depictaiutilisharedlatest.catchify(() => {
16285
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
16286
+ const metaResponsePromise = metaRequestsForQuery().get(key);
16287
+ if (!metaResponsePromise) return;
16288
+ resolve(metaResponsePromise);
16289
+ dispose();
16290
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
16291
+ }));
16292
+ $52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.onCleanup(dispose));
16293
+ }))
16273
16294
  })
16274
16295
  })));
16275
16296
  const meta_query_base = $e4bc31358c414b18$export$210f130a61ac1e8d(() => ({
@@ -16280,7 +16301,17 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16280
16301
  id_type_: id_type_()
16281
16302
  }));
16282
16303
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
16283
- const [plp_meta] = $52FdA$solidjs.createResource(meta_query_base, $52FdA$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
16304
+ const [plp_meta] = $52FdA$solidjs.createResource(meta_query_base, $52FdA$depictaiutilisharedlatest.catchify(async query => {
16305
+ const result = await depict_api_.get_listing(query);
16306
+ // In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
16307
+ const {
16308
+ breadcrumbs: breadcrumbs,
16309
+ quick_links: quick_links,
16310
+ ...listing
16311
+ } = result;
16312
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
16313
+ return result;
16314
+ }));
16284
16315
  const contentBlocksByRow = $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
16285
16316
  const countOfProductsForUI = $e335e2ff536c1a0b$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
16286
16317
  const available_sortings_ = $52FdA$solidjs.createMemo(() => {
package/ES10/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Accessor, JSX, Setter, Signal } from "solid-js";
2
2
  import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer, ColsAtSize, Elem, Node_Array } from "@depict-ai/utilishared/ES10";
3
3
  import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
4
- import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
4
+ import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3, ProductListing as _ProductListing1 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
5
5
  import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
6
6
  import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
7
7
  import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.8.8";
14
+ export const version = "4.8.9";
15
15
  /**
16
16
  * Returns two accessors (one width and one height) that will update when the size of the provided element changes, to be used with ResponsiveImg
17
17
  */
@@ -46,6 +46,10 @@ type ListingSuggestionForTransformer = (ListingSuggestion & {
46
46
  export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
47
47
  products?: (options: DisplayTransformerAlwaysThereData & {
48
48
  displays: InputDisplay[];
49
+ /**
50
+ * If the category display transformer was called due to navigating to a listing using a <CategoryPage> component, currentListing will be set and contain a promise that can be used to get information of said listing.
51
+ */
52
+ currentListing?: Promise<ProductListing>;
49
53
  }) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
50
54
  categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
51
55
  data: T[];
@@ -551,10 +555,12 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
551
555
  get_listing_products({
552
556
  id_to_query_for_,
553
557
  id_type_,
558
+ currentListingForTransformer_,
554
559
  ...input_req_
555
560
  }: ProductListingRequestV3 & {
556
561
  id_to_query_for_: string;
557
562
  id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
563
+ currentListingForTransformer_: Promise<_ProductListing1>;
558
564
  }): Promise<ProductListingResponseAfterDisplayTransformer & {
559
565
  failed?: true;
560
566
  }>;
package/ES10/index.js CHANGED
@@ -10,7 +10,7 @@ import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
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 = "4.8.8";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.8.9";
14
14
  function $4be619ec2cd7bba3$export$54c6d6ff54e72743(whatToWatch) {
15
15
  const [width, setWidth] = $8tj43$createSignal(0);
16
16
  const [height, setHeight] = $8tj43$createSignal(0);
@@ -10648,11 +10648,13 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
10648
10648
  let {
10649
10649
  id_to_query_for_: id_to_query_for_,
10650
10650
  id_type_: id_type_,
10651
+ currentListingForTransformer_: currentListingForTransformer_,
10651
10652
  ...input_req_
10652
10653
  } = _ref2;
10653
10654
  return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_cached_request, $284849364a6ef73a$var$_cached_request2).call(this, {
10654
10655
  endpoint_: $284849364a6ef73a$var$v3_base_url + "listings/" + (id_type_ === $397620a4d7958ed1$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
10655
10656
  input_req_: input_req_,
10657
+ currentListingForTransformer_: currentListingForTransformer_,
10656
10658
  fallback_response_: () => ({
10657
10659
  "n_hits": 0,
10658
10660
  "displays": [],
@@ -10737,7 +10739,7 @@ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, mar
10737
10739
  response.suggestions = transformedSuggestions;
10738
10740
  return response;
10739
10741
  }
10740
- async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
10742
+ async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data, currentListingForTransformer) {
10741
10743
  const {
10742
10744
  display_transformers: display_transformers
10743
10745
  } = this;
@@ -10753,7 +10755,8 @@ async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchan
10753
10755
  merchant: merchant,
10754
10756
  market: market,
10755
10757
  locale: locale,
10756
- displays: [...displays]
10758
+ displays: [...displays],
10759
+ currentListing: currentListingForTransformer
10757
10760
  });
10758
10761
  input_data.displays = transformed_displays;
10759
10762
  }
@@ -10778,7 +10781,8 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
10778
10781
  endpoint_: endpoint_,
10779
10782
  input_req_: input_req_,
10780
10783
  fallback_response_: fallback_response_,
10781
- method_ = "POST"
10784
+ method_ = "POST",
10785
+ currentListingForTransformer_: currentListingForTransformer_
10782
10786
  } = _ref4;
10783
10787
  const cache_obj = $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_get_cache_obj_for_endpoint, $284849364a6ef73a$var$_get_cache_obj_for_endpoint2).call(this, endpoint_);
10784
10788
  const with_ids = $8tj43$babelruntimehelpersclassPrivateFieldGet(this, $284849364a6ef73a$var$_add_ids_to_request).call(this, input_req_);
@@ -10808,7 +10812,7 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
10808
10812
  let result;
10809
10813
  try {
10810
10814
  const unmodified_result = await api_response.json();
10811
- 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);
10815
+ 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, currentListingForTransformer_);
10812
10816
  } catch (e) {
10813
10817
  $8tj43$dwarn("displayTransformer or json decoding failed", e);
10814
10818
  break return_successfully;
@@ -16133,6 +16137,10 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
16133
16137
  const all_products_loaded_ = $8tj43$createSignal(false);
16134
16138
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $8tj43$createSignal(0);
16135
16139
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $8tj43$createSignal(false);
16140
+ const owner = $8tj43$getOwner();
16141
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $8tj43$createSignal(new Map(), {
16142
+ equals: false
16143
+ });
16136
16144
  const products_query_base_ = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => {
16137
16145
  const sort_obj = get_sorting() && {
16138
16146
  ...get_sorting()
@@ -16165,7 +16173,20 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
16165
16173
  limit: limit,
16166
16174
  ...(cursor ? {
16167
16175
  cursor: cursor
16168
- } : {})
16176
+ } : {}),
16177
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
16178
+ // It's very hard to implement tracking that uses the collection title without this information
16179
+ currentListingForTransformer_: new Promise(resolve => $8tj43$createRoot(dispose => {
16180
+ $8tj43$createEffect($8tj43$catchify1(() => {
16181
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
16182
+ const metaResponsePromise = metaRequestsForQuery().get(key);
16183
+ if (!metaResponsePromise) return;
16184
+ resolve(metaResponsePromise);
16185
+ dispose();
16186
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
16187
+ }));
16188
+ $8tj43$runWithOwner(owner, () => $8tj43$onCleanup(dispose));
16189
+ }))
16169
16190
  })
16170
16191
  })));
16171
16192
  const meta_query_base = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => ({
@@ -16176,7 +16197,17 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
16176
16197
  id_type_: id_type_()
16177
16198
  }));
16178
16199
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
16179
- const [plp_meta] = $8tj43$createResource(meta_query_base, $8tj43$catchify1(query => depict_api_.get_listing(query)));
16200
+ const [plp_meta] = $8tj43$createResource(meta_query_base, $8tj43$catchify1(async query => {
16201
+ const result = await depict_api_.get_listing(query);
16202
+ // In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
16203
+ const {
16204
+ breadcrumbs: breadcrumbs,
16205
+ quick_links: quick_links,
16206
+ ...listing
16207
+ } = result;
16208
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
16209
+ return result;
16210
+ }));
16180
16211
  const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
16181
16212
  const countOfProductsForUI = $0728458b46ee9d32$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
16182
16213
  const available_sortings_ = $8tj43$createMemo(() => {
package/latest/index.cjs CHANGED
@@ -108,7 +108,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
108
108
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
109
109
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
110
110
  /*! Depict.ai search and product listing SDK */
111
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.8";
111
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.9";
112
112
  function $128302ab61dab8f1$export$54c6d6ff54e72743(whatToWatch) {
113
113
  const [width, setWidth] = $gVhhF$solidjs.createSignal(0);
114
114
  const [height, setHeight] = $gVhhF$solidjs.createSignal(0);
@@ -10147,7 +10147,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
10147
10147
  /**
10148
10148
  * rest = everything except query suggestions
10149
10149
  */
10150
- async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
10150
+ async #run_display_transformers_for_rest(merchant, market, locale, input_data, currentListingForTransformer) {
10151
10151
  const {
10152
10152
  display_transformers: display_transformers
10153
10153
  } = this;
@@ -10163,7 +10163,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
10163
10163
  merchant: merchant,
10164
10164
  market: market,
10165
10165
  locale: locale,
10166
- displays: [...displays]
10166
+ displays: [...displays],
10167
+ currentListing: currentListingForTransformer
10167
10168
  });
10168
10169
  input_data.displays = transformed_displays;
10169
10170
  }
@@ -10186,7 +10187,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
10186
10187
  endpoint_: endpoint_,
10187
10188
  input_req_: input_req_,
10188
10189
  fallback_response_: fallback_response_,
10189
- method_ = "POST"
10190
+ method_ = "POST",
10191
+ currentListingForTransformer_: currentListingForTransformer_
10190
10192
  }) {
10191
10193
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
10192
10194
  const with_ids = this.#add_ids_to_request(input_req_);
@@ -10216,7 +10218,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
10216
10218
  let result;
10217
10219
  try {
10218
10220
  const unmodified_result = await api_response.json();
10219
- result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
10221
+ result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
10220
10222
  } catch (e) {
10221
10223
  $gVhhF$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
10222
10224
  break return_successfully;
@@ -10318,11 +10320,13 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
10318
10320
  async get_listing_products({
10319
10321
  id_to_query_for_: id_to_query_for_,
10320
10322
  id_type_: id_type_,
10323
+ currentListingForTransformer_: currentListingForTransformer_,
10321
10324
  ...input_req_
10322
10325
  }) {
10323
10326
  return await this.#cached_request({
10324
10327
  endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
10325
10328
  input_req_: input_req_,
10329
+ currentListingForTransformer_: currentListingForTransformer_,
10326
10330
  fallback_response_: () => ({
10327
10331
  "n_hits": 0,
10328
10332
  "displays": [],
@@ -15182,6 +15186,10 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
15182
15186
  const all_products_loaded_ = $gVhhF$solidjs.createSignal(false);
15183
15187
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $gVhhF$solidjs.createSignal(0);
15184
15188
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $gVhhF$solidjs.createSignal(false);
15189
+ const owner = $gVhhF$solidjs.getOwner();
15190
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $gVhhF$solidjs.createSignal(new Map(), {
15191
+ equals: false
15192
+ });
15185
15193
  const products_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
15186
15194
  const sort_obj = get_sorting() && {
15187
15195
  ...get_sorting()
@@ -15214,7 +15222,20 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
15214
15222
  limit: limit,
15215
15223
  ...(cursor ? {
15216
15224
  cursor: cursor
15217
- } : {})
15225
+ } : {}),
15226
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
15227
+ // It's very hard to implement tracking that uses the collection title without this information
15228
+ currentListingForTransformer_: new Promise(resolve => $gVhhF$solidjs.createRoot(dispose => {
15229
+ $gVhhF$solidjs.createEffect($gVhhF$depictaiutilisharedlatest.catchify(() => {
15230
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
15231
+ const metaResponsePromise = metaRequestsForQuery().get(key);
15232
+ if (!metaResponsePromise) return;
15233
+ resolve(metaResponsePromise);
15234
+ dispose();
15235
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
15236
+ }));
15237
+ $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.onCleanup(dispose));
15238
+ }))
15218
15239
  })
15219
15240
  })));
15220
15241
  const meta_query_base = $8cd545330f2674dc$export$210f130a61ac1e8d(() => ({
@@ -15225,7 +15246,17 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
15225
15246
  id_type_: id_type_()
15226
15247
  }));
15227
15248
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
15228
- const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
15249
+ const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilisharedlatest.catchify(async query => {
15250
+ const result = await depict_api_.get_listing(query);
15251
+ // In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
15252
+ const {
15253
+ breadcrumbs: breadcrumbs,
15254
+ quick_links: quick_links,
15255
+ ...listing
15256
+ } = result;
15257
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
15258
+ return result;
15259
+ }));
15229
15260
  const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
15230
15261
  const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
15231
15262
  const available_sortings_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
package/latest/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Accessor, JSX, Setter, Signal } from "solid-js";
2
2
  import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer, ColsAtSize, Elem, Node_Array } from "@depict-ai/utilishared/latest";
3
3
  import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
4
- import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
4
+ import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3, ProductListing as _ProductListing1 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
5
5
  import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
6
6
  import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
7
7
  import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.8.8";
14
+ export const version = "4.8.9";
15
15
  /**
16
16
  * Returns two accessors (one width and one height) that will update when the size of the provided element changes, to be used with ResponsiveImg
17
17
  */
@@ -46,6 +46,10 @@ type ListingSuggestionForTransformer = (ListingSuggestion & {
46
46
  export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
47
47
  products?: (options: DisplayTransformerAlwaysThereData & {
48
48
  displays: InputDisplay[];
49
+ /**
50
+ * If the category display transformer was called due to navigating to a listing using a <CategoryPage> component, currentListing will be set and contain a promise that can be used to get information of said listing.
51
+ */
52
+ currentListing?: Promise<ProductListing>;
49
53
  }) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
50
54
  categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
51
55
  data: T[];
@@ -551,10 +555,12 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
551
555
  get_listing_products({
552
556
  id_to_query_for_,
553
557
  id_type_,
558
+ currentListingForTransformer_,
554
559
  ...input_req_
555
560
  }: ProductListingRequestV3 & {
556
561
  id_to_query_for_: string;
557
562
  id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
563
+ currentListingForTransformer_: Promise<_ProductListing1>;
558
564
  }): Promise<ProductListingResponseAfterDisplayTransformer & {
559
565
  failed?: true;
560
566
  }>;
package/latest/index.js CHANGED
@@ -7,7 +7,7 @@ import { dlog as $9HbP8$dlog, catchify as $9HbP8$catchify1, ListenableSet as $9H
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 = "4.8.8";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.9";
11
11
  function $a444a52bafa0dacc$export$54c6d6ff54e72743(whatToWatch) {
12
12
  const [width, setWidth] = $9HbP8$createSignal(0);
13
13
  const [height, setHeight] = $9HbP8$createSignal(0);
@@ -10046,7 +10046,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
10046
10046
  /**
10047
10047
  * rest = everything except query suggestions
10048
10048
  */
10049
- async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
10049
+ async #run_display_transformers_for_rest(merchant, market, locale, input_data, currentListingForTransformer) {
10050
10050
  const {
10051
10051
  display_transformers: display_transformers
10052
10052
  } = this;
@@ -10062,7 +10062,8 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
10062
10062
  merchant: merchant,
10063
10063
  market: market,
10064
10064
  locale: locale,
10065
- displays: [...displays]
10065
+ displays: [...displays],
10066
+ currentListing: currentListingForTransformer
10066
10067
  });
10067
10068
  input_data.displays = transformed_displays;
10068
10069
  }
@@ -10085,7 +10086,8 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
10085
10086
  endpoint_: endpoint_,
10086
10087
  input_req_: input_req_,
10087
10088
  fallback_response_: fallback_response_,
10088
- method_ = "POST"
10089
+ method_ = "POST",
10090
+ currentListingForTransformer_: currentListingForTransformer_
10089
10091
  }) {
10090
10092
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
10091
10093
  const with_ids = this.#add_ids_to_request(input_req_);
@@ -10115,7 +10117,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
10115
10117
  let result;
10116
10118
  try {
10117
10119
  const unmodified_result = await api_response.json();
10118
- result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
10120
+ result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
10119
10121
  } catch (e) {
10120
10122
  $9HbP8$dwarn("displayTransformer or json decoding failed", e);
10121
10123
  break return_successfully;
@@ -10217,11 +10219,13 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
10217
10219
  async get_listing_products({
10218
10220
  id_to_query_for_: id_to_query_for_,
10219
10221
  id_type_: id_type_,
10222
+ currentListingForTransformer_: currentListingForTransformer_,
10220
10223
  ...input_req_
10221
10224
  }) {
10222
10225
  return await this.#cached_request({
10223
10226
  endpoint_: $7fa23e2a0079eca4$var$v3_base_url + "listings/" + (id_type_ === $c20599a0d81d953a$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
10224
10227
  input_req_: input_req_,
10228
+ currentListingForTransformer_: currentListingForTransformer_,
10225
10229
  fallback_response_: () => ({
10226
10230
  "n_hits": 0,
10227
10231
  "displays": [],
@@ -15081,6 +15085,10 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15081
15085
  const all_products_loaded_ = $9HbP8$createSignal(false);
15082
15086
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $9HbP8$createSignal(0);
15083
15087
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $9HbP8$createSignal(false);
15088
+ const owner = $9HbP8$getOwner();
15089
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $9HbP8$createSignal(new Map(), {
15090
+ equals: false
15091
+ });
15084
15092
  const products_query_base_ = $587cd61972788655$export$210f130a61ac1e8d(() => {
15085
15093
  const sort_obj = get_sorting() && {
15086
15094
  ...get_sorting()
@@ -15113,7 +15121,20 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15113
15121
  limit: limit,
15114
15122
  ...(cursor ? {
15115
15123
  cursor: cursor
15116
- } : {})
15124
+ } : {}),
15125
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
15126
+ // It's very hard to implement tracking that uses the collection title without this information
15127
+ currentListingForTransformer_: new Promise(resolve => $9HbP8$createRoot(dispose => {
15128
+ $9HbP8$createEffect($9HbP8$catchify1(() => {
15129
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
15130
+ const metaResponsePromise = metaRequestsForQuery().get(key);
15131
+ if (!metaResponsePromise) return;
15132
+ resolve(metaResponsePromise);
15133
+ dispose();
15134
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
15135
+ }));
15136
+ $9HbP8$runWithOwner(owner, () => $9HbP8$onCleanup(dispose));
15137
+ }))
15117
15138
  })
15118
15139
  })));
15119
15140
  const meta_query_base = $587cd61972788655$export$210f130a61ac1e8d(() => ({
@@ -15124,7 +15145,17 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15124
15145
  id_type_: id_type_()
15125
15146
  }));
15126
15147
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
15127
- const [plp_meta] = $9HbP8$createResource(meta_query_base, $9HbP8$catchify1(query => depict_api_.get_listing(query)));
15148
+ const [plp_meta] = $9HbP8$createResource(meta_query_base, $9HbP8$catchify1(async query => {
15149
+ const result = await depict_api_.get_listing(query);
15150
+ // In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
15151
+ const {
15152
+ breadcrumbs: breadcrumbs,
15153
+ quick_links: quick_links,
15154
+ ...listing
15155
+ } = result;
15156
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
15157
+ return result;
15158
+ }));
15128
15159
  const contentBlocksByRow = $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
15129
15160
  const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
15130
15161
  const available_sortings_ = $9HbP8$createMemo(() => plp_products_()?.sorts?.map(sort => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.8.8",
3
+ "version": "4.8.9",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "sass": "styles.scss",
@@ -114,7 +114,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
114
114
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
115
115
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
116
116
  /*! Depict.ai search and product listing SDK */
117
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.8.8";
117
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.8.9";
118
118
  function $054b1113e4897051$export$54c6d6ff54e72743(whatToWatch) {
119
119
  const [width, setWidth] = $3hooq$solidjs.createSignal(0);
120
120
  const [height, setHeight] = $3hooq$solidjs.createSignal(0);
@@ -8582,11 +8582,13 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
8582
8582
  let {
8583
8583
  id_to_query_for_: id_to_query_for_,
8584
8584
  id_type_: id_type_,
8585
+ currentListingForTransformer_: currentListingForTransformer_,
8585
8586
  ...input_req_
8586
8587
  } = _ref2;
8587
8588
  return await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_cached_request, $e270e9f953fcbc58$var$_cached_request2).call(this, {
8588
8589
  endpoint_: $e270e9f953fcbc58$var$v3_base_url + "listings/" + (id_type_ === $c3739e86187f2054$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
8589
8590
  input_req_: input_req_,
8591
+ currentListingForTransformer_: currentListingForTransformer_,
8590
8592
  fallback_response_: () => ({
8591
8593
  "n_hits": 0,
8592
8594
  "displays": [],
@@ -8671,7 +8673,7 @@ async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, mar
8671
8673
  response.suggestions = transformedSuggestions;
8672
8674
  return response;
8673
8675
  }
8674
- async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
8676
+ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data, currentListingForTransformer) {
8675
8677
  const {
8676
8678
  display_transformers: display_transformers
8677
8679
  } = this;
@@ -8687,7 +8689,8 @@ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchan
8687
8689
  merchant: merchant,
8688
8690
  market: market,
8689
8691
  locale: locale,
8690
- displays: [...displays]
8692
+ displays: [...displays],
8693
+ currentListing: currentListingForTransformer
8691
8694
  });
8692
8695
  input_data.displays = transformed_displays;
8693
8696
  }
@@ -8712,7 +8715,8 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref4) {
8712
8715
  endpoint_: endpoint_,
8713
8716
  input_req_: input_req_,
8714
8717
  fallback_response_: fallback_response_,
8715
- method_ = "POST"
8718
+ method_ = "POST",
8719
+ currentListingForTransformer_: currentListingForTransformer_
8716
8720
  } = _ref4;
8717
8721
  const cache_obj = $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint2).call(this, endpoint_);
8718
8722
  const with_ids = $parcel$interopDefault($3hooq$babelruntimehelpersclassPrivateFieldGet)(this, $e270e9f953fcbc58$var$_add_ids_to_request).call(this, input_req_);
@@ -8742,7 +8746,7 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref4) {
8742
8746
  let result;
8743
8747
  try {
8744
8748
  const unmodified_result = await api_response.json();
8745
- 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);
8749
+ 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, currentListingForTransformer_);
8746
8750
  } catch (e) {
8747
8751
  $3hooq$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
8748
8752
  break return_successfully;
@@ -13583,6 +13587,10 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13583
13587
  const all_products_loaded_ = $3hooq$solidjs.createSignal(false);
13584
13588
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $3hooq$solidjs.createSignal(0);
13585
13589
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $3hooq$solidjs.createSignal(false);
13590
+ const owner = $3hooq$solidjs.getOwner();
13591
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $3hooq$solidjs.createSignal(new Map(), {
13592
+ equals: false
13593
+ });
13586
13594
  const products_query_base_ = $e4bc31358c414b18$export$210f130a61ac1e8d(() => {
13587
13595
  const sort_obj = get_sorting() && {
13588
13596
  ...get_sorting()
@@ -13615,7 +13623,20 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13615
13623
  limit: limit,
13616
13624
  ...(cursor ? {
13617
13625
  cursor: cursor
13618
- } : {})
13626
+ } : {}),
13627
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
13628
+ // It's very hard to implement tracking that uses the collection title without this information
13629
+ currentListingForTransformer_: new Promise(resolve => $3hooq$solidjs.createRoot(dispose => {
13630
+ $3hooq$solidjs.createEffect($3hooq$depictaiutilisharedlatest.catchify(() => {
13631
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
13632
+ const metaResponsePromise = metaRequestsForQuery().get(key);
13633
+ if (!metaResponsePromise) return;
13634
+ resolve(metaResponsePromise);
13635
+ dispose();
13636
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
13637
+ }));
13638
+ $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.onCleanup(dispose));
13639
+ }))
13619
13640
  })
13620
13641
  })));
13621
13642
  const meta_query_base = $e4bc31358c414b18$export$210f130a61ac1e8d(() => ({
@@ -13626,7 +13647,17 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13626
13647
  id_type_: id_type_()
13627
13648
  }));
13628
13649
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
13629
- const [plp_meta] = $3hooq$solidjs.createResource(meta_query_base, $3hooq$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
13650
+ const [plp_meta] = $3hooq$solidjs.createResource(meta_query_base, $3hooq$depictaiutilisharedlatest.catchify(async query => {
13651
+ const result = await depict_api_.get_listing(query);
13652
+ // In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
13653
+ const {
13654
+ breadcrumbs: breadcrumbs,
13655
+ quick_links: quick_links,
13656
+ ...listing
13657
+ } = result;
13658
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
13659
+ return result;
13660
+ }));
13630
13661
  const contentBlocksByRow = $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
13631
13662
  const countOfProductsForUI = $e335e2ff536c1a0b$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
13632
13663
  const available_sortings_ = $3hooq$solidjs.createMemo(() => {
@@ -1,7 +1,7 @@
1
1
  import { Accessor, JSX, Setter, Signal } from "solid-js";
2
2
  import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer, ColsAtSize, Elem, Node_Array } from "@depict-ai/utilishared/ES10";
3
3
  import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
4
- import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
4
+ import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3, ProductListing as _ProductListing1 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
5
5
  import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
6
6
  import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
7
7
  import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.8.8";
14
+ export const version = "4.8.9";
15
15
  /**
16
16
  * Returns two accessors (one width and one height) that will update when the size of the provided element changes, to be used with ResponsiveImg
17
17
  */
@@ -46,6 +46,10 @@ type ListingSuggestionForTransformer = (ListingSuggestion & {
46
46
  export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
47
47
  products?: (options: DisplayTransformerAlwaysThereData & {
48
48
  displays: InputDisplay[];
49
+ /**
50
+ * If the category display transformer was called due to navigating to a listing using a <CategoryPage> component, currentListing will be set and contain a promise that can be used to get information of said listing.
51
+ */
52
+ currentListing?: Promise<ProductListing>;
49
53
  }) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
50
54
  categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
51
55
  data: T[];
@@ -551,10 +555,12 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
551
555
  get_listing_products({
552
556
  id_to_query_for_,
553
557
  id_type_,
558
+ currentListingForTransformer_,
554
559
  ...input_req_
555
560
  }: ProductListingRequestV3 & {
556
561
  id_to_query_for_: string;
557
562
  id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
563
+ currentListingForTransformer_: Promise<_ProductListing1>;
558
564
  }): Promise<ProductListingResponseAfterDisplayTransformer & {
559
565
  failed?: true;
560
566
  }>;
@@ -10,7 +10,7 @@ import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
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 = "4.8.8";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.8.9";
14
14
  function $4be619ec2cd7bba3$export$54c6d6ff54e72743(whatToWatch) {
15
15
  const [width, setWidth] = $b8hua$createSignal(0);
16
16
  const [height, setHeight] = $b8hua$createSignal(0);
@@ -8478,11 +8478,13 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
8478
8478
  let {
8479
8479
  id_to_query_for_: id_to_query_for_,
8480
8480
  id_type_: id_type_,
8481
+ currentListingForTransformer_: currentListingForTransformer_,
8481
8482
  ...input_req_
8482
8483
  } = _ref2;
8483
8484
  return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_cached_request, $284849364a6ef73a$var$_cached_request2).call(this, {
8484
8485
  endpoint_: $284849364a6ef73a$var$v3_base_url + "listings/" + (id_type_ === $397620a4d7958ed1$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
8485
8486
  input_req_: input_req_,
8487
+ currentListingForTransformer_: currentListingForTransformer_,
8486
8488
  fallback_response_: () => ({
8487
8489
  "n_hits": 0,
8488
8490
  "displays": [],
@@ -8567,7 +8569,7 @@ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, mar
8567
8569
  response.suggestions = transformedSuggestions;
8568
8570
  return response;
8569
8571
  }
8570
- async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
8572
+ async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data, currentListingForTransformer) {
8571
8573
  const {
8572
8574
  display_transformers: display_transformers
8573
8575
  } = this;
@@ -8583,7 +8585,8 @@ async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchan
8583
8585
  merchant: merchant,
8584
8586
  market: market,
8585
8587
  locale: locale,
8586
- displays: [...displays]
8588
+ displays: [...displays],
8589
+ currentListing: currentListingForTransformer
8587
8590
  });
8588
8591
  input_data.displays = transformed_displays;
8589
8592
  }
@@ -8608,7 +8611,8 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
8608
8611
  endpoint_: endpoint_,
8609
8612
  input_req_: input_req_,
8610
8613
  fallback_response_: fallback_response_,
8611
- method_ = "POST"
8614
+ method_ = "POST",
8615
+ currentListingForTransformer_: currentListingForTransformer_
8612
8616
  } = _ref4;
8613
8617
  const cache_obj = $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_get_cache_obj_for_endpoint, $284849364a6ef73a$var$_get_cache_obj_for_endpoint2).call(this, endpoint_);
8614
8618
  const with_ids = $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $284849364a6ef73a$var$_add_ids_to_request).call(this, input_req_);
@@ -8638,7 +8642,7 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
8638
8642
  let result;
8639
8643
  try {
8640
8644
  const unmodified_result = await api_response.json();
8641
- 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);
8645
+ 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, currentListingForTransformer_);
8642
8646
  } catch (e) {
8643
8647
  $b8hua$dwarn("displayTransformer or json decoding failed", e);
8644
8648
  break return_successfully;
@@ -13479,6 +13483,10 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13479
13483
  const all_products_loaded_ = $b8hua$createSignal(false);
13480
13484
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $b8hua$createSignal(0);
13481
13485
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $b8hua$createSignal(false);
13486
+ const owner = $b8hua$getOwner();
13487
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $b8hua$createSignal(new Map(), {
13488
+ equals: false
13489
+ });
13482
13490
  const products_query_base_ = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => {
13483
13491
  const sort_obj = get_sorting() && {
13484
13492
  ...get_sorting()
@@ -13511,7 +13519,20 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13511
13519
  limit: limit,
13512
13520
  ...(cursor ? {
13513
13521
  cursor: cursor
13514
- } : {})
13522
+ } : {}),
13523
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
13524
+ // It's very hard to implement tracking that uses the collection title without this information
13525
+ currentListingForTransformer_: new Promise(resolve => $b8hua$createRoot(dispose => {
13526
+ $b8hua$createEffect($b8hua$catchify1(() => {
13527
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
13528
+ const metaResponsePromise = metaRequestsForQuery().get(key);
13529
+ if (!metaResponsePromise) return;
13530
+ resolve(metaResponsePromise);
13531
+ dispose();
13532
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
13533
+ }));
13534
+ $b8hua$runWithOwner(owner, () => $b8hua$onCleanup(dispose));
13535
+ }))
13515
13536
  })
13516
13537
  })));
13517
13538
  const meta_query_base = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => ({
@@ -13522,7 +13543,17 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13522
13543
  id_type_: id_type_()
13523
13544
  }));
13524
13545
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
13525
- const [plp_meta] = $b8hua$createResource(meta_query_base, $b8hua$catchify1(query => depict_api_.get_listing(query)));
13546
+ const [plp_meta] = $b8hua$createResource(meta_query_base, $b8hua$catchify1(async query => {
13547
+ const result = await depict_api_.get_listing(query);
13548
+ // In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
13549
+ const {
13550
+ breadcrumbs: breadcrumbs,
13551
+ quick_links: quick_links,
13552
+ ...listing
13553
+ } = result;
13554
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
13555
+ return result;
13556
+ }));
13526
13557
  const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
13527
13558
  const countOfProductsForUI = $0728458b46ee9d32$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
13528
13559
  const available_sortings_ = $b8hua$createMemo(() => {
@@ -108,7 +108,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
108
108
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
109
109
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
110
110
  /*! Depict.ai search and product listing SDK */
111
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.8";
111
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.9";
112
112
  function $128302ab61dab8f1$export$54c6d6ff54e72743(whatToWatch) {
113
113
  const [width, setWidth] = $5vyXB$solidjs.createSignal(0);
114
114
  const [height, setHeight] = $5vyXB$solidjs.createSignal(0);
@@ -8044,7 +8044,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
8044
8044
  /**
8045
8045
  * rest = everything except query suggestions
8046
8046
  */
8047
- async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
8047
+ async #run_display_transformers_for_rest(merchant, market, locale, input_data, currentListingForTransformer) {
8048
8048
  const {
8049
8049
  display_transformers: display_transformers
8050
8050
  } = this;
@@ -8060,7 +8060,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
8060
8060
  merchant: merchant,
8061
8061
  market: market,
8062
8062
  locale: locale,
8063
- displays: [...displays]
8063
+ displays: [...displays],
8064
+ currentListing: currentListingForTransformer
8064
8065
  });
8065
8066
  input_data.displays = transformed_displays;
8066
8067
  }
@@ -8083,7 +8084,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
8083
8084
  endpoint_: endpoint_,
8084
8085
  input_req_: input_req_,
8085
8086
  fallback_response_: fallback_response_,
8086
- method_ = "POST"
8087
+ method_ = "POST",
8088
+ currentListingForTransformer_: currentListingForTransformer_
8087
8089
  }) {
8088
8090
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
8089
8091
  const with_ids = this.#add_ids_to_request(input_req_);
@@ -8113,7 +8115,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
8113
8115
  let result;
8114
8116
  try {
8115
8117
  const unmodified_result = await api_response.json();
8116
- result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
8118
+ result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
8117
8119
  } catch (e) {
8118
8120
  $5vyXB$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
8119
8121
  break return_successfully;
@@ -8215,11 +8217,13 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
8215
8217
  async get_listing_products({
8216
8218
  id_to_query_for_: id_to_query_for_,
8217
8219
  id_type_: id_type_,
8220
+ currentListingForTransformer_: currentListingForTransformer_,
8218
8221
  ...input_req_
8219
8222
  }) {
8220
8223
  return await this.#cached_request({
8221
8224
  endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
8222
8225
  input_req_: input_req_,
8226
+ currentListingForTransformer_: currentListingForTransformer_,
8223
8227
  fallback_response_: () => ({
8224
8228
  "n_hits": 0,
8225
8229
  "displays": [],
@@ -12609,6 +12613,10 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12609
12613
  const all_products_loaded_ = $5vyXB$solidjs.createSignal(false);
12610
12614
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $5vyXB$solidjs.createSignal(0);
12611
12615
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $5vyXB$solidjs.createSignal(false);
12616
+ const owner = $5vyXB$solidjs.getOwner();
12617
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $5vyXB$solidjs.createSignal(new Map(), {
12618
+ equals: false
12619
+ });
12612
12620
  const products_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
12613
12621
  const sort_obj = get_sorting() && {
12614
12622
  ...get_sorting()
@@ -12641,7 +12649,20 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12641
12649
  limit: limit,
12642
12650
  ...(cursor ? {
12643
12651
  cursor: cursor
12644
- } : {})
12652
+ } : {}),
12653
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
12654
+ // It's very hard to implement tracking that uses the collection title without this information
12655
+ currentListingForTransformer_: new Promise(resolve => $5vyXB$solidjs.createRoot(dispose => {
12656
+ $5vyXB$solidjs.createEffect($5vyXB$depictaiutilisharedlatest.catchify(() => {
12657
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
12658
+ const metaResponsePromise = metaRequestsForQuery().get(key);
12659
+ if (!metaResponsePromise) return;
12660
+ resolve(metaResponsePromise);
12661
+ dispose();
12662
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
12663
+ }));
12664
+ $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.onCleanup(dispose));
12665
+ }))
12645
12666
  })
12646
12667
  })));
12647
12668
  const meta_query_base = $8cd545330f2674dc$export$210f130a61ac1e8d(() => ({
@@ -12652,7 +12673,17 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12652
12673
  id_type_: id_type_()
12653
12674
  }));
12654
12675
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
12655
- const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
12676
+ const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(async query => {
12677
+ const result = await depict_api_.get_listing(query);
12678
+ // In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
12679
+ const {
12680
+ breadcrumbs: breadcrumbs,
12681
+ quick_links: quick_links,
12682
+ ...listing
12683
+ } = result;
12684
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
12685
+ return result;
12686
+ }));
12656
12687
  const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
12657
12688
  const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
12658
12689
  const available_sortings_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
@@ -1,7 +1,7 @@
1
1
  import { Accessor, JSX, Setter, Signal } from "solid-js";
2
2
  import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer, ColsAtSize, Elem, Node_Array } from "@depict-ai/utilishared/latest";
3
3
  import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
4
- import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
4
+ import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3, ProductListing as _ProductListing1 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
5
5
  import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
6
6
  import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
7
7
  import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.8.8";
14
+ export const version = "4.8.9";
15
15
  /**
16
16
  * Returns two accessors (one width and one height) that will update when the size of the provided element changes, to be used with ResponsiveImg
17
17
  */
@@ -46,6 +46,10 @@ type ListingSuggestionForTransformer = (ListingSuggestion & {
46
46
  export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
47
47
  products?: (options: DisplayTransformerAlwaysThereData & {
48
48
  displays: InputDisplay[];
49
+ /**
50
+ * If the category display transformer was called due to navigating to a listing using a <CategoryPage> component, currentListing will be set and contain a promise that can be used to get information of said listing.
51
+ */
52
+ currentListing?: Promise<ProductListing>;
49
53
  }) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
50
54
  categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
51
55
  data: T[];
@@ -551,10 +555,12 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
551
555
  get_listing_products({
552
556
  id_to_query_for_,
553
557
  id_type_,
558
+ currentListingForTransformer_,
554
559
  ...input_req_
555
560
  }: ProductListingRequestV3 & {
556
561
  id_to_query_for_: string;
557
562
  id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
563
+ currentListingForTransformer_: Promise<_ProductListing1>;
558
564
  }): Promise<ProductListingResponseAfterDisplayTransformer & {
559
565
  failed?: true;
560
566
  }>;
@@ -7,7 +7,7 @@ import { dlog as $i7OB2$dlog, catchify as $i7OB2$catchify1, ListenableSet as $i7
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 = "4.8.8";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.9";
11
11
  function $a444a52bafa0dacc$export$54c6d6ff54e72743(whatToWatch) {
12
12
  const [width, setWidth] = $i7OB2$createSignal(0);
13
13
  const [height, setHeight] = $i7OB2$createSignal(0);
@@ -7943,7 +7943,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
7943
7943
  /**
7944
7944
  * rest = everything except query suggestions
7945
7945
  */
7946
- async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
7946
+ async #run_display_transformers_for_rest(merchant, market, locale, input_data, currentListingForTransformer) {
7947
7947
  const {
7948
7948
  display_transformers: display_transformers
7949
7949
  } = this;
@@ -7959,7 +7959,8 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
7959
7959
  merchant: merchant,
7960
7960
  market: market,
7961
7961
  locale: locale,
7962
- displays: [...displays]
7962
+ displays: [...displays],
7963
+ currentListing: currentListingForTransformer
7963
7964
  });
7964
7965
  input_data.displays = transformed_displays;
7965
7966
  }
@@ -7982,7 +7983,8 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
7982
7983
  endpoint_: endpoint_,
7983
7984
  input_req_: input_req_,
7984
7985
  fallback_response_: fallback_response_,
7985
- method_ = "POST"
7986
+ method_ = "POST",
7987
+ currentListingForTransformer_: currentListingForTransformer_
7986
7988
  }) {
7987
7989
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
7988
7990
  const with_ids = this.#add_ids_to_request(input_req_);
@@ -8012,7 +8014,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
8012
8014
  let result;
8013
8015
  try {
8014
8016
  const unmodified_result = await api_response.json();
8015
- result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
8017
+ result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
8016
8018
  } catch (e) {
8017
8019
  $i7OB2$dwarn("displayTransformer or json decoding failed", e);
8018
8020
  break return_successfully;
@@ -8114,11 +8116,13 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
8114
8116
  async get_listing_products({
8115
8117
  id_to_query_for_: id_to_query_for_,
8116
8118
  id_type_: id_type_,
8119
+ currentListingForTransformer_: currentListingForTransformer_,
8117
8120
  ...input_req_
8118
8121
  }) {
8119
8122
  return await this.#cached_request({
8120
8123
  endpoint_: $7fa23e2a0079eca4$var$v3_base_url + "listings/" + (id_type_ === $c20599a0d81d953a$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
8121
8124
  input_req_: input_req_,
8125
+ currentListingForTransformer_: currentListingForTransformer_,
8122
8126
  fallback_response_: () => ({
8123
8127
  "n_hits": 0,
8124
8128
  "displays": [],
@@ -12508,6 +12512,10 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12508
12512
  const all_products_loaded_ = $i7OB2$createSignal(false);
12509
12513
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $i7OB2$createSignal(0);
12510
12514
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $i7OB2$createSignal(false);
12515
+ const owner = $i7OB2$getOwner();
12516
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $i7OB2$createSignal(new Map(), {
12517
+ equals: false
12518
+ });
12511
12519
  const products_query_base_ = $587cd61972788655$export$210f130a61ac1e8d(() => {
12512
12520
  const sort_obj = get_sorting() && {
12513
12521
  ...get_sorting()
@@ -12540,7 +12548,20 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12540
12548
  limit: limit,
12541
12549
  ...(cursor ? {
12542
12550
  cursor: cursor
12543
- } : {})
12551
+ } : {}),
12552
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
12553
+ // It's very hard to implement tracking that uses the collection title without this information
12554
+ currentListingForTransformer_: new Promise(resolve => $i7OB2$createRoot(dispose => {
12555
+ $i7OB2$createEffect($i7OB2$catchify1(() => {
12556
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
12557
+ const metaResponsePromise = metaRequestsForQuery().get(key);
12558
+ if (!metaResponsePromise) return;
12559
+ resolve(metaResponsePromise);
12560
+ dispose();
12561
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
12562
+ }));
12563
+ $i7OB2$runWithOwner(owner, () => $i7OB2$onCleanup(dispose));
12564
+ }))
12544
12565
  })
12545
12566
  })));
12546
12567
  const meta_query_base = $587cd61972788655$export$210f130a61ac1e8d(() => ({
@@ -12551,7 +12572,17 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
12551
12572
  id_type_: id_type_()
12552
12573
  }));
12553
12574
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
12554
- const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify1(query => depict_api_.get_listing(query)));
12575
+ const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify1(async query => {
12576
+ const result = await depict_api_.get_listing(query);
12577
+ // In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
12578
+ const {
12579
+ breadcrumbs: breadcrumbs,
12580
+ quick_links: quick_links,
12581
+ ...listing
12582
+ } = result;
12583
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
12584
+ return result;
12585
+ }));
12555
12586
  const contentBlocksByRow = $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
12556
12587
  const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
12557
12588
  const available_sortings_ = $i7OB2$createMemo(() => plp_products_()?.sorts?.map(sort => ({