@depict-ai/ui 4.8.8 → 4.8.10

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.8";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.10";
11
11
  function $a444a52bafa0dacc$export$54c6d6ff54e72743(whatToWatch) {
12
12
  const [width, setWidth] = $9HbP8$createSignal(0);
13
13
  const [height, setHeight] = $9HbP8$createSignal(0);
@@ -9590,7 +9590,7 @@ function $5efb5894079b220e$export$b288c38ae3fddb56({
9590
9590
  JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) {
9591
9591
  const owner = $9HbP8$getOwner();
9592
9592
  const signal = owner?.sources?.find?.(source => source.value === read_local_cache());
9593
- if (executions > 30) {
9593
+ if (executions > 50) {
9594
9594
  // We're probably in an infinite loop, let's just stop
9595
9595
  $9HbP8$report(new Error("Infinite loop detected in create_modified_filters"), "error", {
9596
9596
  executions: executions,
@@ -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": [],
@@ -10830,10 +10834,12 @@ function $b6d5529b253681aa$export$b3ad617e9036868({
10830
10834
  const rect = input_field.getBoundingClientRect(); /* for some reason contentRect.top and contentRect.left is 0 from the RO */
10831
10835
  const addToLeftValue = alignment & $b6d5529b253681aa$export$6060bc6bee850eb6 ? rect.width / 2 : 0;
10832
10836
  const leftWithoutScroll = rect.left + addToLeftValue;
10837
+ const topValue = rect.top + (includeScroll ? scrollY : 0);
10833
10838
  setModalBodyStyle(old_value => ({
10834
10839
  ...old_value,
10840
+ // Do not allow top values under 0, this usually happens when aligning to an element that's absolutely positioned and the user is scrolled down - in that case we want to sacrifice alignment for the modal being visible
10835
10841
  ...(alignment & $b6d5529b253681aa$export$3f238c96c45e6cc6 ? {
10836
- top: `${rect.top + (includeScroll ? scrollY : 0)}px`
10842
+ top: `${topValue >= 0 ? topValue : 0}px`
10837
10843
  } : {}),
10838
10844
  ...(alignment & $b6d5529b253681aa$export$7895aadd1956b1c7 ? {
10839
10845
  left: `${leftWithoutScroll + (includeScroll ? scrollX : 0)}px`
@@ -15081,6 +15087,10 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15081
15087
  const all_products_loaded_ = $9HbP8$createSignal(false);
15082
15088
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $9HbP8$createSignal(0);
15083
15089
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $9HbP8$createSignal(false);
15090
+ const owner = $9HbP8$getOwner();
15091
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $9HbP8$createSignal(new Map(), {
15092
+ equals: false
15093
+ });
15084
15094
  const products_query_base_ = $587cd61972788655$export$210f130a61ac1e8d(() => {
15085
15095
  const sort_obj = get_sorting() && {
15086
15096
  ...get_sorting()
@@ -15113,7 +15123,20 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15113
15123
  limit: limit,
15114
15124
  ...(cursor ? {
15115
15125
  cursor: cursor
15116
- } : {})
15126
+ } : {}),
15127
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
15128
+ // It's very hard to implement tracking that uses the collection title without this information
15129
+ currentListingForTransformer_: new Promise(resolve => $9HbP8$createRoot(dispose => {
15130
+ $9HbP8$createEffect($9HbP8$catchify1(() => {
15131
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
15132
+ const metaResponsePromise = metaRequestsForQuery().get(key);
15133
+ if (!metaResponsePromise) return;
15134
+ resolve(metaResponsePromise);
15135
+ dispose();
15136
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
15137
+ }));
15138
+ $9HbP8$runWithOwner(owner, () => $9HbP8$onCleanup(dispose));
15139
+ }))
15117
15140
  })
15118
15141
  })));
15119
15142
  const meta_query_base = $587cd61972788655$export$210f130a61ac1e8d(() => ({
@@ -15124,7 +15147,17 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
15124
15147
  id_type_: id_type_()
15125
15148
  }));
15126
15149
  // 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)));
15150
+ const [plp_meta] = $9HbP8$createResource(meta_query_base, $9HbP8$catchify1(async query => {
15151
+ const result = await depict_api_.get_listing(query);
15152
+ // 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
15153
+ const {
15154
+ breadcrumbs: breadcrumbs,
15155
+ quick_links: quick_links,
15156
+ ...listing
15157
+ } = result;
15158
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
15159
+ return result;
15160
+ }));
15128
15161
  const contentBlocksByRow = $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
15129
15162
  const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
15130
15163
  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.10",
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.10";
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);
@@ -8056,7 +8056,7 @@ function $a162c9a08dc208c2$export$b288c38ae3fddb56(_ref) {
8056
8056
  var _sources, _sources$find;
8057
8057
  const owner = $3hooq$solidjs.getOwner();
8058
8058
  const signal = owner === null || owner === void 0 ? void 0 : (_sources = owner.sources) === null || _sources === void 0 ? void 0 : (_sources$find = _sources.find) === null || _sources$find === void 0 ? void 0 : _sources$find.call(_sources, source => source.value === read_local_cache());
8059
- if (executions > 30) {
8059
+ if (executions > 50) {
8060
8060
  var _signal$observers, _signal$observers$map;
8061
8061
  // We're probably in an infinite loop, let's just stop
8062
8062
  $3hooq$depictaiutilishared.report(new Error("Infinite loop detected in create_modified_filters"), "error", {
@@ -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;
@@ -9563,10 +9567,12 @@ function $d6ed4dbb6507996d$export$b3ad617e9036868(_ref, input_field, alignment,
9563
9567
  const rect = input_field.getBoundingClientRect(); /* for some reason contentRect.top and contentRect.left is 0 from the RO */
9564
9568
  const addToLeftValue = alignment & $d6ed4dbb6507996d$export$6060bc6bee850eb6 ? rect.width / 2 : 0;
9565
9569
  const leftWithoutScroll = rect.left + addToLeftValue;
9570
+ const topValue = rect.top + (includeScroll ? scrollY : 0);
9566
9571
  setModalBodyStyle(old_value => ({
9567
9572
  ...old_value,
9573
+ // Do not allow top values under 0, this usually happens when aligning to an element that's absolutely positioned and the user is scrolled down - in that case we want to sacrifice alignment for the modal being visible
9568
9574
  ...(alignment & $d6ed4dbb6507996d$export$3f238c96c45e6cc6 ? {
9569
- top: "".concat(rect.top + (includeScroll ? scrollY : 0), "px")
9575
+ top: "".concat(topValue >= 0 ? topValue : 0, "px")
9570
9576
  } : {}),
9571
9577
  ...(alignment & $d6ed4dbb6507996d$export$7895aadd1956b1c7 ? {
9572
9578
  left: "".concat(leftWithoutScroll + (includeScroll ? scrollX : 0), "px")
@@ -13583,6 +13589,10 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13583
13589
  const all_products_loaded_ = $3hooq$solidjs.createSignal(false);
13584
13590
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $3hooq$solidjs.createSignal(0);
13585
13591
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $3hooq$solidjs.createSignal(false);
13592
+ const owner = $3hooq$solidjs.getOwner();
13593
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $3hooq$solidjs.createSignal(new Map(), {
13594
+ equals: false
13595
+ });
13586
13596
  const products_query_base_ = $e4bc31358c414b18$export$210f130a61ac1e8d(() => {
13587
13597
  const sort_obj = get_sorting() && {
13588
13598
  ...get_sorting()
@@ -13615,7 +13625,20 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13615
13625
  limit: limit,
13616
13626
  ...(cursor ? {
13617
13627
  cursor: cursor
13618
- } : {})
13628
+ } : {}),
13629
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
13630
+ // It's very hard to implement tracking that uses the collection title without this information
13631
+ currentListingForTransformer_: new Promise(resolve => $3hooq$solidjs.createRoot(dispose => {
13632
+ $3hooq$solidjs.createEffect($3hooq$depictaiutilisharedlatest.catchify(() => {
13633
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
13634
+ const metaResponsePromise = metaRequestsForQuery().get(key);
13635
+ if (!metaResponsePromise) return;
13636
+ resolve(metaResponsePromise);
13637
+ dispose();
13638
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
13639
+ }));
13640
+ $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.onCleanup(dispose));
13641
+ }))
13619
13642
  })
13620
13643
  })));
13621
13644
  const meta_query_base = $e4bc31358c414b18$export$210f130a61ac1e8d(() => ({
@@ -13626,7 +13649,17 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
13626
13649
  id_type_: id_type_()
13627
13650
  }));
13628
13651
  // 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)));
13652
+ const [plp_meta] = $3hooq$solidjs.createResource(meta_query_base, $3hooq$depictaiutilisharedlatest.catchify(async query => {
13653
+ const result = await depict_api_.get_listing(query);
13654
+ // 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
13655
+ const {
13656
+ breadcrumbs: breadcrumbs,
13657
+ quick_links: quick_links,
13658
+ ...listing
13659
+ } = result;
13660
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
13661
+ return result;
13662
+ }));
13630
13663
  const contentBlocksByRow = $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
13631
13664
  const countOfProductsForUI = $e335e2ff536c1a0b$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
13632
13665
  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.10";
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
  }>;
@@ -1506,7 +1512,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1506
1512
  * Open the modal with support for alignment.
1507
1513
  * @returns {void}
1508
1514
  */
1509
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1515
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1510
1516
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1511
1517
  export interface PageReplacer {
1512
1518
  readonly render_: () => Node_Array;
@@ -1585,5 +1591,5 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1585
1591
  content_blocks_by_row?: ContentBlocksByRow;
1586
1592
  layout?: PossibleLayout;
1587
1593
  filterModalParent_?: HTMLElement | ShadowRoot;
1588
- }): import("@depict-ai/utilishared").Node_Array;
1594
+ }): import("@depict-ai/utilishared/latest").Node_Array;
1589
1595
  export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";
@@ -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.10";
14
14
  function $4be619ec2cd7bba3$export$54c6d6ff54e72743(whatToWatch) {
15
15
  const [width, setWidth] = $b8hua$createSignal(0);
16
16
  const [height, setHeight] = $b8hua$createSignal(0);
@@ -7952,7 +7952,7 @@ function $44aa24b1bb793549$export$b288c38ae3fddb56(_ref) {
7952
7952
  var _sources, _sources$find;
7953
7953
  const owner = $b8hua$getOwner();
7954
7954
  const signal = owner === null || owner === void 0 ? void 0 : (_sources = owner.sources) === null || _sources === void 0 ? void 0 : (_sources$find = _sources.find) === null || _sources$find === void 0 ? void 0 : _sources$find.call(_sources, source => source.value === read_local_cache());
7955
- if (executions > 30) {
7955
+ if (executions > 50) {
7956
7956
  var _signal$observers, _signal$observers$map;
7957
7957
  // We're probably in an infinite loop, let's just stop
7958
7958
  $b8hua$report(new Error("Infinite loop detected in create_modified_filters"), "error", {
@@ -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;
@@ -9459,10 +9463,12 @@ function $1308a7816c3d4f2d$export$b3ad617e9036868(_ref, input_field, alignment,
9459
9463
  const rect = input_field.getBoundingClientRect(); /* for some reason contentRect.top and contentRect.left is 0 from the RO */
9460
9464
  const addToLeftValue = alignment & $1308a7816c3d4f2d$export$6060bc6bee850eb6 ? rect.width / 2 : 0;
9461
9465
  const leftWithoutScroll = rect.left + addToLeftValue;
9466
+ const topValue = rect.top + (includeScroll ? scrollY : 0);
9462
9467
  setModalBodyStyle(old_value => ({
9463
9468
  ...old_value,
9469
+ // Do not allow top values under 0, this usually happens when aligning to an element that's absolutely positioned and the user is scrolled down - in that case we want to sacrifice alignment for the modal being visible
9464
9470
  ...(alignment & $1308a7816c3d4f2d$export$3f238c96c45e6cc6 ? {
9465
- top: "".concat(rect.top + (includeScroll ? scrollY : 0), "px")
9471
+ top: "".concat(topValue >= 0 ? topValue : 0, "px")
9466
9472
  } : {}),
9467
9473
  ...(alignment & $1308a7816c3d4f2d$export$7895aadd1956b1c7 ? {
9468
9474
  left: "".concat(leftWithoutScroll + (includeScroll ? scrollX : 0), "px")
@@ -13479,6 +13485,10 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13479
13485
  const all_products_loaded_ = $b8hua$createSignal(false);
13480
13486
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $b8hua$createSignal(0);
13481
13487
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $b8hua$createSignal(false);
13488
+ const owner = $b8hua$getOwner();
13489
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $b8hua$createSignal(new Map(), {
13490
+ equals: false
13491
+ });
13482
13492
  const products_query_base_ = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => {
13483
13493
  const sort_obj = get_sorting() && {
13484
13494
  ...get_sorting()
@@ -13511,7 +13521,20 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13511
13521
  limit: limit,
13512
13522
  ...(cursor ? {
13513
13523
  cursor: cursor
13514
- } : {})
13524
+ } : {}),
13525
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
13526
+ // It's very hard to implement tracking that uses the collection title without this information
13527
+ currentListingForTransformer_: new Promise(resolve => $b8hua$createRoot(dispose => {
13528
+ $b8hua$createEffect($b8hua$catchify1(() => {
13529
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
13530
+ const metaResponsePromise = metaRequestsForQuery().get(key);
13531
+ if (!metaResponsePromise) return;
13532
+ resolve(metaResponsePromise);
13533
+ dispose();
13534
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
13535
+ }));
13536
+ $b8hua$runWithOwner(owner, () => $b8hua$onCleanup(dispose));
13537
+ }))
13515
13538
  })
13516
13539
  })));
13517
13540
  const meta_query_base = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => ({
@@ -13522,7 +13545,17 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
13522
13545
  id_type_: id_type_()
13523
13546
  }));
13524
13547
  // 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)));
13548
+ const [plp_meta] = $b8hua$createResource(meta_query_base, $b8hua$catchify1(async query => {
13549
+ const result = await depict_api_.get_listing(query);
13550
+ // 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
13551
+ const {
13552
+ breadcrumbs: breadcrumbs,
13553
+ quick_links: quick_links,
13554
+ ...listing
13555
+ } = result;
13556
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
13557
+ return result;
13558
+ }));
13526
13559
  const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
13527
13560
  const countOfProductsForUI = $0728458b46ee9d32$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
13528
13561
  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.10";
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);
@@ -7597,7 +7597,7 @@ function $70482f04605572e2$export$b288c38ae3fddb56({
7597
7597
  JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) {
7598
7598
  const owner = $5vyXB$solidjs.getOwner();
7599
7599
  const signal = owner?.sources?.find?.(source => source.value === read_local_cache());
7600
- if (executions > 30) {
7600
+ if (executions > 50) {
7601
7601
  // We're probably in an infinite loop, let's just stop
7602
7602
  $5vyXB$depictaiutilishared.report(new Error("Infinite loop detected in create_modified_filters"), "error", {
7603
7603
  executions: executions,
@@ -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": [],
@@ -8943,10 +8947,12 @@ function $fd463ff0edb29915$export$b3ad617e9036868({
8943
8947
  const rect = input_field.getBoundingClientRect(); /* for some reason contentRect.top and contentRect.left is 0 from the RO */
8944
8948
  const addToLeftValue = alignment & $fd463ff0edb29915$export$6060bc6bee850eb6 ? rect.width / 2 : 0;
8945
8949
  const leftWithoutScroll = rect.left + addToLeftValue;
8950
+ const topValue = rect.top + (includeScroll ? scrollY : 0);
8946
8951
  setModalBodyStyle(old_value => ({
8947
8952
  ...old_value,
8953
+ // Do not allow top values under 0, this usually happens when aligning to an element that's absolutely positioned and the user is scrolled down - in that case we want to sacrifice alignment for the modal being visible
8948
8954
  ...(alignment & $fd463ff0edb29915$export$3f238c96c45e6cc6 ? {
8949
- top: `${rect.top + (includeScroll ? scrollY : 0)}px`
8955
+ top: `${topValue >= 0 ? topValue : 0}px`
8950
8956
  } : {}),
8951
8957
  ...(alignment & $fd463ff0edb29915$export$7895aadd1956b1c7 ? {
8952
8958
  left: `${leftWithoutScroll + (includeScroll ? scrollX : 0)}px`
@@ -12609,6 +12615,10 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12609
12615
  const all_products_loaded_ = $5vyXB$solidjs.createSignal(false);
12610
12616
  const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $5vyXB$solidjs.createSignal(0);
12611
12617
  const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $5vyXB$solidjs.createSignal(false);
12618
+ const owner = $5vyXB$solidjs.getOwner();
12619
+ const [metaRequestsForQuery, setMetaRequestsForQuery] = $5vyXB$solidjs.createSignal(new Map(), {
12620
+ equals: false
12621
+ });
12612
12622
  const products_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
12613
12623
  const sort_obj = get_sorting() && {
12614
12624
  ...get_sorting()
@@ -12641,7 +12651,20 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12641
12651
  limit: limit,
12642
12652
  ...(cursor ? {
12643
12653
  cursor: cursor
12644
- } : {})
12654
+ } : {}),
12655
+ // This gets exposed to the products display transformer and gives it information about the listing the products are in
12656
+ // It's very hard to implement tracking that uses the collection title without this information
12657
+ currentListingForTransformer_: new Promise(resolve => $5vyXB$solidjs.createRoot(dispose => {
12658
+ $5vyXB$solidjs.createEffect($5vyXB$depictaiutilisharedlatest.catchify(() => {
12659
+ const key = base_query.id_type_ + base_query.id_to_query_for_;
12660
+ const metaResponsePromise = metaRequestsForQuery().get(key);
12661
+ if (!metaResponsePromise) return;
12662
+ resolve(metaResponsePromise);
12663
+ dispose();
12664
+ setMetaRequestsForQuery(prev => (prev.delete(key), prev));
12665
+ }));
12666
+ $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.onCleanup(dispose));
12667
+ }))
12645
12668
  })
12646
12669
  })));
12647
12670
  const meta_query_base = $8cd545330f2674dc$export$210f130a61ac1e8d(() => ({
@@ -12652,7 +12675,17 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
12652
12675
  id_type_: id_type_()
12653
12676
  }));
12654
12677
  // 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)));
12678
+ const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(async query => {
12679
+ const result = await depict_api_.get_listing(query);
12680
+ // 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
12681
+ const {
12682
+ breadcrumbs: breadcrumbs,
12683
+ quick_links: quick_links,
12684
+ ...listing
12685
+ } = result;
12686
+ setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
12687
+ return result;
12688
+ }));
12656
12689
  const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
12657
12690
  const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
12658
12691
  const available_sortings_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({