@depict-ai/ui 4.8.7 → 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/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.7";
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": [],
@@ -14897,8 +14901,14 @@ function $f916989c4b1be9f7$export$780a853d15174484({
14897
14901
  mediaUrl_: mediaUrl_,
14898
14902
  aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
14899
14903
  }) {
14904
+ let wroteAspectRatioToContainer = false; // Only write this once so we don't get into a aspect ratio changed -> size changed -> image source changed -> aspect ratio slightly changed infinite loop
14900
14905
  const [wrapperSize, setWrapperSize] = $9HbP8$createSignal();
14901
14906
  const isImage = type_ === "image";
14907
+ const setAspectRatio = aspectRatio => {
14908
+ if (wroteAspectRatioToContainer) return;
14909
+ wroteAspectRatioToContainer = true;
14910
+ setAspectRatioWas_(aspectRatio);
14911
+ };
14902
14912
  return $9HbP8$createComponent((0, $9HbP8$Dynamic), $9HbP8$mergeProps({
14903
14913
  component: link_ ? "a" : "div",
14904
14914
  "class": "d-standard-content-wrapper",
@@ -14927,7 +14937,7 @@ function $f916989c4b1be9f7$export$780a853d15174484({
14927
14937
  sizeHeight: () => wrapperSize()?.[1]?.() || 0,
14928
14938
  src: mediaUrl_,
14929
14939
  "class": "d-standard-content",
14930
- ref: el => el.addEventListener("load", $9HbP8$catchify1(() => setAspectRatioWas_(el.naturalWidth / el.naturalHeight)))
14940
+ ref: el => el.addEventListener("load", $9HbP8$catchify1(() => setAspectRatio(el.naturalWidth / el.naturalHeight)))
14931
14941
  });
14932
14942
  }
14933
14943
  }), $9HbP8$createComponent((0, $9HbP8$Match), {
@@ -14936,7 +14946,7 @@ function $f916989c4b1be9f7$export$780a853d15174484({
14936
14946
  var _el$ = $9HbP8$getNextElement($f916989c4b1be9f7$var$_tmpl$);
14937
14947
  $9HbP8$use(element => {
14938
14948
  const pageVisible = $5e3d278ef4c80cd7$export$54299a3c81f5425();
14939
- element.addEventListener("loadedmetadata", $9HbP8$catchify1(() => setAspectRatioWas_(element.videoWidth / element.videoHeight)));
14949
+ element.addEventListener("loadedmetadata", $9HbP8$catchify1(() => setAspectRatio(element.videoWidth / element.videoHeight)));
14940
14950
  $9HbP8$createEffect(() => {
14941
14951
  if (pageVisible()) element.play().catch(e => $9HbP8$dlog1("Failed to play", e));else element.pause();
14942
14952
  });
@@ -15003,7 +15013,7 @@ function $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_
15003
15013
  ...prev,
15004
15014
  aspectRatios: {
15005
15015
  ...prev.aspectRatios,
15006
- [componentCacheKey]: Math.round(aspectRatio * 10) / 10
15016
+ [componentCacheKey]: Math.round(aspectRatio * 100) / 100
15007
15017
  }
15008
15018
  }))
15009
15019
  });
@@ -15075,6 +15085,10 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15075
15085
  const all_products_loaded_ = $9HbP8$createSignal(false);
15076
15086
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $9HbP8$createSignal(0);
15077
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
+ });
15078
15092
  const products_query_base_ = $587cd61972788655$export$210f130a61ac1e8d(() => {
15079
15093
  const sort_obj = get_sorting() && {
15080
15094
  ...get_sorting()
@@ -15107,7 +15121,20 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15107
15121
  limit: limit,
15108
15122
  ...(cursor ? {
15109
15123
  cursor: cursor
15110
- } : {})
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
+ }))
15111
15138
  })
15112
15139
  })));
15113
15140
  const meta_query_base = $587cd61972788655$export$210f130a61ac1e8d(() => ({
@@ -15118,7 +15145,17 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15118
15145
  id_type_: id_type_()
15119
15146
  }));
15120
15147
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
15121
- 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
+ }));
15122
15159
  const contentBlocksByRow = $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
15123
15160
  const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
15124
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.7",
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.7";
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;
@@ -13406,8 +13410,14 @@ function $c19709057a32b2e7$export$780a853d15174484(_ref) {
13406
13410
  mediaUrl_: mediaUrl_,
13407
13411
  aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
13408
13412
  } = _ref;
13413
+ let wroteAspectRatioToContainer = false; // Only write this once so we don't get into a aspect ratio changed -> size changed -> image source changed -> aspect ratio slightly changed infinite loop
13409
13414
  const [wrapperSize, setWrapperSize] = $3hooq$solidjs.createSignal();
13410
13415
  const isImage = type_ === "image";
13416
+ const setAspectRatio = aspectRatio => {
13417
+ if (wroteAspectRatioToContainer) return;
13418
+ wroteAspectRatioToContainer = true;
13419
+ setAspectRatioWas_(aspectRatio);
13420
+ };
13411
13421
  return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjsweb.Dynamic), $3hooq$solidjsweb.mergeProps({
13412
13422
  component: link_ ? "a" : "div",
13413
13423
  "class": "d-standard-content-wrapper",
@@ -13504,7 +13514,7 @@ function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_
13504
13514
  ...prev,
13505
13515
  aspectRatios: {
13506
13516
  ...prev.aspectRatios,
13507
- [componentCacheKey]: Math.round(aspectRatio * 10) / 10
13517
+ [componentCacheKey]: Math.round(aspectRatio * 100) / 100
13508
13518
  }
13509
13519
  }))
13510
13520
  });
@@ -13577,6 +13587,10 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13577
13587
  const all_products_loaded_ = $3hooq$solidjs.createSignal(false);
13578
13588
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $3hooq$solidjs.createSignal(0);
13579
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
+ });
13580
13594
  const products_query_base_ = $e4bc31358c414b18$export$210f130a61ac1e8d(() => {
13581
13595
  const sort_obj = get_sorting() && {
13582
13596
  ...get_sorting()
@@ -13609,7 +13623,20 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13609
13623
  limit: limit,
13610
13624
  ...(cursor ? {
13611
13625
  cursor: cursor
13612
- } : {})
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
+ }))
13613
13640
  })
13614
13641
  })));
13615
13642
  const meta_query_base = $e4bc31358c414b18$export$210f130a61ac1e8d(() => ({
@@ -13620,7 +13647,17 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13620
13647
  id_type_: id_type_()
13621
13648
  }));
13622
13649
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
13623
- 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
+ }));
13624
13661
  const contentBlocksByRow = $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
13625
13662
  const countOfProductsForUI = $e335e2ff536c1a0b$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
13626
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.7";
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.7";
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;
@@ -13302,8 +13306,14 @@ function $3b772ef9a35560fe$export$780a853d15174484(_ref) {
13302
13306
  mediaUrl_: mediaUrl_,
13303
13307
  aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
13304
13308
  } = _ref;
13309
+ let wroteAspectRatioToContainer = false; // Only write this once so we don't get into a aspect ratio changed -> size changed -> image source changed -> aspect ratio slightly changed infinite loop
13305
13310
  const [wrapperSize, setWrapperSize] = $b8hua$createSignal();
13306
13311
  const isImage = type_ === "image";
13312
+ const setAspectRatio = aspectRatio => {
13313
+ if (wroteAspectRatioToContainer) return;
13314
+ wroteAspectRatioToContainer = true;
13315
+ setAspectRatioWas_(aspectRatio);
13316
+ };
13307
13317
  return $b8hua$createComponent((0, $b8hua$Dynamic), $b8hua$mergeProps({
13308
13318
  component: link_ ? "a" : "div",
13309
13319
  "class": "d-standard-content-wrapper",
@@ -13400,7 +13410,7 @@ function $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_
13400
13410
  ...prev,
13401
13411
  aspectRatios: {
13402
13412
  ...prev.aspectRatios,
13403
- [componentCacheKey]: Math.round(aspectRatio * 10) / 10
13413
+ [componentCacheKey]: Math.round(aspectRatio * 100) / 100
13404
13414
  }
13405
13415
  }))
13406
13416
  });
@@ -13473,6 +13483,10 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13473
13483
  const all_products_loaded_ = $b8hua$createSignal(false);
13474
13484
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $b8hua$createSignal(0);
13475
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
+ });
13476
13490
  const products_query_base_ = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => {
13477
13491
  const sort_obj = get_sorting() && {
13478
13492
  ...get_sorting()
@@ -13505,7 +13519,20 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13505
13519
  limit: limit,
13506
13520
  ...(cursor ? {
13507
13521
  cursor: cursor
13508
- } : {})
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
+ }))
13509
13536
  })
13510
13537
  })));
13511
13538
  const meta_query_base = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => ({
@@ -13516,7 +13543,17 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13516
13543
  id_type_: id_type_()
13517
13544
  }));
13518
13545
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
13519
- 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
+ }));
13520
13557
  const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
13521
13558
  const countOfProductsForUI = $0728458b46ee9d32$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
13522
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.7";
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": [],
@@ -12440,8 +12444,14 @@ function $32c662f618f5d80d$export$780a853d15174484({
12440
12444
  mediaUrl_: mediaUrl_,
12441
12445
  aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
12442
12446
  }) {
12447
+ let wroteAspectRatioToContainer = false; // Only write this once so we don't get into a aspect ratio changed -> size changed -> image source changed -> aspect ratio slightly changed infinite loop
12443
12448
  const [wrapperSize, setWrapperSize] = $5vyXB$solidjs.createSignal();
12444
12449
  const isImage = type_ === "image";
12450
+ const setAspectRatio = aspectRatio => {
12451
+ if (wroteAspectRatioToContainer) return;
12452
+ wroteAspectRatioToContainer = true;
12453
+ setAspectRatioWas_(aspectRatio);
12454
+ };
12445
12455
  return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjsweb.Dynamic), $5vyXB$solidjsweb.mergeProps({
12446
12456
  component: link_ ? "a" : "div",
12447
12457
  "class": "d-standard-content-wrapper",
@@ -12531,7 +12541,7 @@ function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_
12531
12541
  ...prev,
12532
12542
  aspectRatios: {
12533
12543
  ...prev.aspectRatios,
12534
- [componentCacheKey]: Math.round(aspectRatio * 10) / 10
12544
+ [componentCacheKey]: Math.round(aspectRatio * 100) / 100
12535
12545
  }
12536
12546
  }))
12537
12547
  });
@@ -12603,6 +12613,10 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12603
12613
  const all_products_loaded_ = $5vyXB$solidjs.createSignal(false);
12604
12614
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $5vyXB$solidjs.createSignal(0);
12605
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
+ });
12606
12620
  const products_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
12607
12621
  const sort_obj = get_sorting() && {
12608
12622
  ...get_sorting()
@@ -12635,7 +12649,20 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12635
12649
  limit: limit,
12636
12650
  ...(cursor ? {
12637
12651
  cursor: cursor
12638
- } : {})
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
+ }))
12639
12666
  })
12640
12667
  })));
12641
12668
  const meta_query_base = $8cd545330f2674dc$export$210f130a61ac1e8d(() => ({
@@ -12646,7 +12673,17 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12646
12673
  id_type_: id_type_()
12647
12674
  }));
12648
12675
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
12649
- 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
+ }));
12650
12687
  const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
12651
12688
  const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
12652
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.7";
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
  }>;