@depict-ai/ui 4.7.31 → 4.7.33

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.cjs CHANGED
@@ -12,6 +12,8 @@ function $parcel$export(e, n, v, s) {
12
12
  configurable: true
13
13
  });
14
14
  }
15
+ $parcel$export(module.exports, "setExtraDisplayTransformers", () => $606c221d98ba4d92$export$f98b8d5ea7207a1);
16
+ $parcel$export(module.exports, "getExtraDisplayTransformers", () => $606c221d98ba4d92$export$b2d94be4f02525b2);
15
17
  $parcel$export(module.exports, "remap_blocks_to_index", () => $d92f338ba8f9da9b$export$92aa5d691d588f3f);
16
18
  $parcel$export(module.exports, "useMobileHover", () => $8bf678c45948a297$export$d4d96868197be50e);
17
19
  $parcel$export(module.exports, "useVisibilityState", () => $55cbacb79d3e0cea$export$54299a3c81f5425);
@@ -105,7 +107,14 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
105
107
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
106
108
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
107
109
  /*! Depict.ai search and product listing SDK */
108
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.7.31";
110
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.7.33";
111
+
112
+ // Value first so shopify merchants can set (extra) display transformers in the shopify app
113
+ // Calling these functions normally doesn't do anything, but our shopify app respects them
114
+ // Them being here is value first too because this can be easily imported in the product card editor
115
+ let $606c221d98ba4d92$var$extraDisplayTransformers;
116
+ const $606c221d98ba4d92$export$b2d94be4f02525b2 = () => $606c221d98ba4d92$var$extraDisplayTransformers;
117
+ const $606c221d98ba4d92$export$f98b8d5ea7207a1 = displayTransformers => $606c221d98ba4d92$var$extraDisplayTransformers = displayTransformers;
109
118
  function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
110
119
  const signal = $gVhhF$solidjs.createSignal(false);
111
120
  $gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
@@ -454,19 +463,22 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
454
463
  }
455
464
  }));
456
465
  $gVhhF$solidjsweb.effect(_p$ => {
457
- var _v$ = {
466
+ var _v$ = !!(final_span_columns() === max_span_columns()),
467
+ _v$2 = {
458
468
  [(0, $75777da1687ba3f6$export$c500183c31c2b22e)]: final_span_columns()
459
469
  },
460
- _v$2 = `span ${final_span_columns()}`,
461
- _v$3 = `span ${final_span_rows()}`;
462
- _p$.e = $gVhhF$solidjsweb.style(_el$, _v$, _p$.e);
463
- _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
464
- _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
470
+ _v$3 = `span ${final_span_columns()}`,
471
+ _v$4 = `span ${final_span_rows()}`;
472
+ _v$ !== _p$.e && _el$.classList.toggle("spans-whole-row", _p$.e = _v$);
473
+ _p$.t = $gVhhF$solidjsweb.style(_el$, _v$2, _p$.t);
474
+ _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-column", _v$3) : _el$.style.removeProperty("grid-column"));
475
+ _v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$.style.setProperty("grid-row", _v$4) : _el$.style.removeProperty("grid-row"));
465
476
  return _p$;
466
477
  }, {
467
478
  e: undefined,
468
479
  t: undefined,
469
- a: undefined
480
+ a: undefined,
481
+ o: undefined
470
482
  });
471
483
  return _el$;
472
484
  }
@@ -1767,24 +1779,29 @@ function $a33065cfed827fc0$export$e4b984597b71e989(props) {
1767
1779
  })));
1768
1780
  return container;
1769
1781
  }
1782
+ const $d212a67662c5cf38$var$customUrls = (url, width) => {
1783
+ if (url?.startsWith?.("https://cdn.shopify.com"))
1784
+ // The shopify image resizing CDN blocks Cloudflare's image resizer. It's possible that we can't detect shopify image URLs sometimes because they go to the merchant's domain,
1785
+ // but it seems like the URLs returned by the Depict API always goes to the cdn.shopify.com version of an image, so this simple workaround works.
1786
+ return $19950faaac026e09$export$1d6267828870adda(url, width);
1787
+ // Use cloudflare image resizer instead of img.depict.ai because it's a lot faster (and also auto-chooses other formats if webp is not supported)
1788
+ return `https://app.depict.ai/cdn-cgi/image/width=${width},format=auto/${url}`;
1789
+ };
1770
1790
  function $d212a67662c5cf38$export$9d4a4b669b1929ab(props) {
1771
1791
  return $gVhhF$solidjsweb.createComponent((0, $a33065cfed827fc0$export$e4b984597b71e989), $gVhhF$solidjsweb.mergeProps(props, {
1772
1792
  get imgProps() {
1773
1793
  return {
1774
1794
  ...props.imgProps,
1775
- customUrls: (url, width // Apparently don't have to encode url for CF's service
1776
- ) => {
1777
- if (url?.startsWith?.("https://cdn.shopify.com"))
1778
- // The shopify image resizing CDN blocks Cloudflare's image resizer. It's possible that we can't detect shopify image URLs sometimes because they go to the merchant's domain,
1779
- // but it seems like the URLs returned by the Depict API always goes to the cdn.shopify.com version of an image, so this simple workaround works.
1780
- return $19950faaac026e09$export$1d6267828870adda(url, width);
1781
- // Use cloudflare image resizer instead of img.depict.ai because it's a lot faster (and also auto-chooses other formats if webp is not supported)
1782
- return `https://app.depict.ai/cdn-cgi/image/width=${width},format=auto/${url}`;
1783
- }
1795
+ customUrls: $d212a67662c5cf38$var$customUrls
1784
1796
  };
1785
1797
  }
1786
1798
  }));
1787
1799
  }
1800
+ function $d212a67662c5cf38$export$140423fa4bfb6d63(props) {
1801
+ return $gVhhF$solidjsweb.createComponent((0, $19950faaac026e09$export$6e5611bc7e57e477), $gVhhF$solidjsweb.mergeProps(props, {
1802
+ customUrls: $d212a67662c5cf38$var$customUrls
1803
+ }));
1804
+ }
1788
1805
  function $d659702496cb72ea$export$a71e92cfbb498adc(props) {
1789
1806
  return $gVhhF$solidjs.createMemo(() => {
1790
1807
  const price_formatting = props.price_formatting_;
@@ -10494,7 +10511,8 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
10494
10511
  // Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
10495
10512
  local_filter_cache: [],
10496
10513
  expanded_hierarchical_filters: [],
10497
- scroll_restoration_data: []
10514
+ scroll_restoration_data: [],
10515
+ history_content_blocks: []
10498
10516
  }),
10499
10517
  router_: this.#router,
10500
10518
  prefix_: "category" + unique_instance_key_for_state + "_"
@@ -14887,70 +14905,94 @@ function $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id, i18n_) {
14887
14905
  $gVhhF$solidjs.onCleanup(disconnect);
14888
14906
  }
14889
14907
  $gVhhF$solidjsweb.delegateEvents(["click"]);
14890
- var $32c662f618f5d80d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<a><img>`),
14891
- $32c662f618f5d80d$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<a><video loop>`);
14908
+ var $32c662f618f5d80d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<a class=d-standard-content-wrapper><video loop class=d-standard-content>`);
14892
14909
  function $32c662f618f5d80d$export$780a853d15174484({
14893
- contentBlock: contentBlock,
14910
+ contentBlock_: {
14911
+ content: {
14912
+ link: link,
14913
+ type: type,
14914
+ url: mediaUrl
14915
+ }
14916
+ },
14894
14917
  router_: router_
14895
14918
  }) {
14896
- if (contentBlock.content.type === "image") return () => (() => {
14897
- var _el$ = $gVhhF$solidjsweb.getNextElement($32c662f618f5d80d$var$_tmpl$),
14898
- _el$2 = _el$.firstChild;
14899
- $gVhhF$solidjsweb.addEventListener(_el$, "click", $gVhhF$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
14900
- new_url_: contentBlock.content.link,
14901
- is_replace_: false,
14902
- event_: ev
14903
- })), true);
14904
- _el$2.style.setProperty("width", "100%");
14905
- _el$2.style.setProperty("height", "100%");
14906
- _el$2.style.setProperty("object-fit", "cover");
14907
- _el$2.style.setProperty("position", "absolute");
14908
- _el$2.style.setProperty("inset", "0");
14909
- $gVhhF$solidjsweb.effect(_p$ => {
14910
- var _v$ = contentBlock.content.link,
14911
- _v$2 = contentBlock.content.url;
14912
- _v$ !== _p$.e && $gVhhF$solidjsweb.setAttribute(_el$, "href", _p$.e = _v$);
14913
- _v$2 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$2, "src", _p$.t = _v$2);
14914
- return _p$;
14915
- }, {
14916
- e: undefined,
14917
- t: undefined
14918
- });
14919
- $gVhhF$solidjsweb.runHydrationEvents();
14920
- return _el$;
14921
- })();
14922
- if (contentBlock.content.type === "video") return () => (() => {
14923
- var _el$3 = $gVhhF$solidjsweb.getNextElement($32c662f618f5d80d$var$_tmpl$2),
14924
- _el$4 = _el$3.firstChild;
14925
- $gVhhF$solidjsweb.addEventListener(_el$3, "click", $gVhhF$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
14926
- new_url_: contentBlock.content.link,
14927
- is_replace_: false,
14928
- event_: ev
14929
- })), true);
14930
- $gVhhF$solidjsweb.setProperty(_el$4, "controls", false);
14931
- $gVhhF$solidjsweb.setProperty(_el$4, "muted", true);
14932
- $gVhhF$solidjsweb.setProperty(_el$4, "autoplay", true);
14933
- $gVhhF$solidjsweb.setProperty(_el$4, "playsinline", true);
14934
- _el$4.style.setProperty("width", "100%");
14935
- _el$4.style.setProperty("height", "100%");
14936
- _el$4.style.setProperty("object-fit", "cover");
14937
- _el$4.style.setProperty("position", "absolute");
14938
- _el$4.style.setProperty("inset", "0");
14939
- $gVhhF$solidjsweb.effect(_p$ => {
14940
- var _v$3 = contentBlock.content.link,
14941
- _v$4 = contentBlock.content.url;
14942
- _v$3 !== _p$.e && $gVhhF$solidjsweb.setAttribute(_el$3, "href", _p$.e = _v$3);
14943
- _v$4 !== _p$.t && $gVhhF$solidjsweb.setAttribute(_el$4, "src", _p$.t = _v$4);
14944
- return _p$;
14919
+ if (type === "image") {
14920
+ const [wrapperSize, setWrapperSize] = $gVhhF$solidjs.createSignal();
14921
+ return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjsweb.Dynamic), $gVhhF$solidjsweb.mergeProps({
14922
+ component: link ? "a" : "div",
14923
+ "class": "d-standard-content-wrapper",
14924
+ ref: el => setWrapperSize(() => $19950faaac026e09$export$e6fffe67d4cdd848(el)),
14925
+ get onClick() {
14926
+ return $gVhhF$depictaiutilisharedlatest.catchify(ev => link && router_.navigate_.go_to_({
14927
+ new_url_: link,
14928
+ is_replace_: false,
14929
+ event_: ev
14930
+ }));
14931
+ }
14932
+ }, link && {
14933
+ href: link
14945
14934
  }, {
14946
- e: undefined,
14947
- t: undefined
14948
- });
14949
- $gVhhF$solidjsweb.runHydrationEvents();
14950
- return _el$3;
14951
- })();
14935
+ get children() {
14936
+ return $gVhhF$solidjsweb.createComponent((0, $d212a67662c5cf38$export$140423fa4bfb6d63), {
14937
+ get size() {
14938
+ return $gVhhF$solidjs.createMemo(() => wrapperSize()?.() || 0);
14939
+ },
14940
+ src: mediaUrl,
14941
+ "class": "d-standard-content"
14942
+ });
14943
+ }
14944
+ }));
14945
+ }
14946
+ if (type === "video") {
14947
+ const pageVisible = $55cbacb79d3e0cea$export$54299a3c81f5425();
14948
+ return (() => {
14949
+ var _el$ = $gVhhF$solidjsweb.getNextElement($32c662f618f5d80d$var$_tmpl$),
14950
+ _el$2 = _el$.firstChild;
14951
+ $gVhhF$solidjsweb.addEventListener(_el$, "click", $gVhhF$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
14952
+ new_url_: link,
14953
+ is_replace_: false,
14954
+ event_: ev
14955
+ })), true);
14956
+ $gVhhF$solidjsweb.setAttribute(_el$, "href", link);
14957
+ $gVhhF$solidjsweb.use(element => $gVhhF$solidjs.createEffect(() => {
14958
+ if (pageVisible()) element.play().catch(e => $gVhhF$depictaiutilishared.dlog("Failed to play", e));else element.pause();
14959
+ }), _el$2);
14960
+ $gVhhF$solidjsweb.setAttribute(_el$2, "src", mediaUrl);
14961
+ $gVhhF$solidjsweb.setProperty(_el$2, "controls", false);
14962
+ $gVhhF$solidjsweb.setProperty(_el$2, "muted", true);
14963
+ $gVhhF$solidjsweb.setProperty(_el$2, "autoplay", true);
14964
+ $gVhhF$solidjsweb.setProperty(_el$2, "playsinline", true);
14965
+ $gVhhF$solidjsweb.runHydrationEvents();
14966
+ return _el$;
14967
+ })();
14968
+ }
14952
14969
  }
14953
14970
  $gVhhF$solidjsweb.delegateEvents(["click"]);
14971
+ function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
14972
+ const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
14973
+ $gVhhF$solidjs.createEffect(() => {
14974
+ const serverContentBlock = plp_meta()?.content_blocks;
14975
+ if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(historyContentBlocks())) setHistoryContentBlocks(serverContentBlock);
14976
+ });
14977
+ const contentBlocksByRow = $gVhhF$solidjs.createMemo(() => {
14978
+ if (content_blocks_by_row_()) return content_blocks_by_row_();
14979
+ const content = [];
14980
+ historyContentBlocks().forEach(row => {
14981
+ const contentBlock = {
14982
+ span_columns: row.span_columns,
14983
+ span_rows: row.span_rows,
14984
+ position: row.position,
14985
+ content: () => $gVhhF$solidjsweb.createComponent((0, $32c662f618f5d80d$export$780a853d15174484), {
14986
+ contentBlock_: row,
14987
+ router_: router_
14988
+ })
14989
+ };
14990
+ content[row.row] = contentBlock;
14991
+ });
14992
+ return content;
14993
+ });
14994
+ return contentBlocksByRow;
14995
+ }
14954
14996
  var $840d88a04b2d22a7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=product-count><!$><!/> <!$><!/>`),
14955
14997
  $840d88a04b2d22a7$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div>`),
14956
14998
  $840d88a04b2d22a7$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
@@ -14978,6 +15020,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
14978
15020
  show_breadcrumbs_: show_breadcrumbs_,
14979
15021
  layout_options_: layout_options_,
14980
15022
  scroll_restoration_data_: scroll_restoration_data_,
15023
+ history_content_blocks_: history_content_blocks_,
14981
15024
  product_card_template_: product_card_template_,
14982
15025
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
14983
15026
  sorting_query_param_: sorting_query_param_,
@@ -15046,23 +15089,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
15046
15089
  }));
15047
15090
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
15048
15091
  const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
15049
- const contentBlocksByRow = $gVhhF$solidjs.createMemo(() => {
15050
- if (content_blocks_by_row_()) return content_blocks_by_row_();
15051
- const content = [];
15052
- plp_meta()?.content_blocks?.forEach(row => {
15053
- const contentBlock = {
15054
- span_columns: row.span_columns,
15055
- span_rows: row.span_rows,
15056
- position: row.position,
15057
- content: $32c662f618f5d80d$export$780a853d15174484({
15058
- contentBlock: row,
15059
- router_: router_
15060
- })
15061
- };
15062
- content[row.row] = contentBlock;
15063
- });
15064
- return content;
15065
- });
15092
+ const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
15066
15093
  const available_sortings_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
15067
15094
  ...sort,
15068
15095
  order: sort.order ?? "desc"
@@ -15417,7 +15444,8 @@ function $14f289047713d67a$export$e2bf8ce7779e827e(props) {
15417
15444
  sorting_open: category_sorting_open_,
15418
15445
  expanded_filters: expanded_filters_,
15419
15446
  expanded_hierarchical_filters: expanded_hierarchical_filters_,
15420
- scroll_restoration_data: scroll_restoration_data_
15447
+ scroll_restoration_data: scroll_restoration_data_,
15448
+ history_content_blocks: history_content_blocks_
15421
15449
  } = depict_category.historyStateSignals_;
15422
15450
  const {
15423
15451
  current_sorting_: current_sorting_,
@@ -15463,6 +15491,7 @@ function $14f289047713d67a$export$e2bf8ce7779e827e(props) {
15463
15491
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
15464
15492
  content_blocks_by_row_: () => props.content_blocks_by_row,
15465
15493
  scroll_restoration_data_: scroll_restoration_data_,
15494
+ history_content_blocks_: history_content_blocks_,
15466
15495
  layout_options_: $gVhhF$solidjs.createMemo(() => ({
15467
15496
  cols_at_size: $4e04be41243c3d80$export$6daf8749b65a1b77(props.cols_at_size),
15468
15497
  ...grid_spacing_override(),
package/latest/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { JSX, Accessor, Setter, Signal } from "solid-js";
2
- import { report, Amazing_Slider, Display, useExpandingContainer, ColsAtSize, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/latest";
3
- import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
1
+ import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer, ColsAtSize, Elem, Node_Array } from "@depict-ai/utilishared/latest";
4
2
  import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
5
3
  import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
6
- import { ProductListing, GetListingResponse } from "@depict-ai/types/api/GetListingResponse";
4
+ import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
5
+ import { JSX, Accessor, Setter, Signal } from "solid-js";
6
+ import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
7
7
  import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
8
8
  import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
9
9
  import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequestV3";
@@ -11,7 +11,61 @@ 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.7.31";
14
+ export const version = "4.7.33";
15
+ type DisplayTransformerAlwaysThereData = {
16
+ merchant: string;
17
+ market: string;
18
+ locale: string;
19
+ };
20
+ type CanBePromiseWrapped<T> = T | Promise<T>;
21
+ export type ModernDisplayWithPageUrl<T extends ModernDisplay> = { [K in keyof T]: K extends "variant_displays" ? (T[K][number] & {
22
+ page_url: string;
23
+ })[] : T[K] };
24
+ /**
25
+ * A ProductListing with ancestors added in, this is what we pass to the display transformers as the ancestors might be required to construct the URL
26
+ */
27
+ type ProductListingWithAncestors = ProductListing & {
28
+ ancestors: Ancestors;
29
+ };
30
+ /**
31
+ * The displayTransformer for categories does not only get a list of ListingSuggestions, when a search query has listing suggestions, but also their ancestors since we show breadcrumbs for the listing suggestions. To let the user differentiate (since the suggestion ones can be added/removed but not the ancestors) we add a boolean is_suggestion to the listing suggestions passed to the displayTransformer.
32
+ */
33
+ type ListingSuggestionForTransformer = (ListingSuggestion & {
34
+ is_suggestion: true;
35
+ }) | (Omit<ListingSuggestion, "suggestions_result_id"> & {
36
+ is_suggestion: false;
37
+ });
38
+ /**
39
+ * DisplayTransformers supersede pageURLCreator
40
+ * DisplayTransformers are functions that take in a list of categories, content search results or products and then can transform or enrich the data for each category, content search result or product card in a batched way.
41
+ */
42
+ export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
43
+ products?: (options: DisplayTransformerAlwaysThereData & {
44
+ displays: InputDisplay[];
45
+ }) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
46
+ categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
47
+ data: T[];
48
+ }) => CanBePromiseWrapped<(T & {
49
+ page_url: string;
50
+ })[]>;
51
+ contentResults?: (options: DisplayTransformerAlwaysThereData & {
52
+ data: ContentLink[];
53
+ }) => CanBePromiseWrapped<ContentLink[]>;
54
+ };
55
+ export type SomethingTakingADisplayTransformers<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = InputDisplay extends ModernDisplay ? "page_url" extends keyof InputDisplay["variant_displays"][number] ? {
56
+ display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
57
+ } : {
58
+ display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
59
+ } : {
60
+ page_url_creator?: never;
61
+ display_transformers?: never;
62
+ };
63
+ export const getExtraDisplayTransformers: () => DisplayTransformers<any, any> | undefined;
64
+ /**
65
+ *
66
+ * @param displayTransformers
67
+ */
68
+ export const setExtraDisplayTransformers: <InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay = ModernDisplayWithPageUrl<InputDisplay>>(displayTransformers: DisplayTransformers<InputDisplay, OutputDisplay>) => DisplayTransformers<InputDisplay, OutputDisplay>;
15
69
  /**
16
70
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
71
  */
@@ -108,10 +162,10 @@ export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Elemen
108
162
  })[];
109
163
  n_cols_currently_showing_: number | null;
110
164
  }): {
111
- content_blocks_by_index_: JSX.Element[];
165
+ content_blocks_by_index_: (Awaited<T> | T[])[];
112
166
  readonly displaced_products_?: undefined;
113
167
  } | {
114
- readonly content_blocks_by_index_: JSX.Element[];
168
+ readonly content_blocks_by_index_: (Awaited<T> | T[])[];
115
169
  readonly displaced_products_: (number | (true | undefined)[])[];
116
170
  };
117
171
  /**
@@ -434,54 +488,6 @@ export function SolidFormatPrice(props: {
434
488
  places_after_comma_: number | "auto";
435
489
  };
436
490
  }): JSX.Element;
437
- type DisplayTransformerAlwaysThereData = {
438
- merchant: string;
439
- market: string;
440
- locale: string;
441
- };
442
- type CanBePromiseWrapped<T> = T | Promise<T>;
443
- export type ModernDisplayWithPageUrl<T extends ModernDisplay> = { [K in keyof T]: K extends "variant_displays" ? (T[K][number] & {
444
- page_url: string;
445
- })[] : T[K] };
446
- /**
447
- * A ProductListing with ancestors added in, this is what we pass to the display transformers as the ancestors might be required to construct the URL
448
- */
449
- type ProductListingWithAncestors = ProductListing & {
450
- ancestors: Ancestors;
451
- };
452
- /**
453
- * The displayTransformer for categories does not only get a list of ListingSuggestions, when a search query has listing suggestions, but also their ancestors since we show breadcrumbs for the listing suggestions. To let the user differentiate (since the suggestion ones can be added/removed but not the ancestors) we add a boolean is_suggestion to the listing suggestions passed to the displayTransformer.
454
- */
455
- type ListingSuggestionForTransformer = (ListingSuggestion & {
456
- is_suggestion: true;
457
- }) | (Omit<ListingSuggestion, "suggestions_result_id"> & {
458
- is_suggestion: false;
459
- });
460
- /**
461
- * DisplayTransformers supersede pageURLCreator
462
- * DisplayTransformers are functions that take in a list of categories, content search results or products and then can transform or enrich the data for each category, content search result or product card in a batched way.
463
- */
464
- export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
465
- products?: (options: DisplayTransformerAlwaysThereData & {
466
- displays: InputDisplay[];
467
- }) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
468
- categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
469
- data: T[];
470
- }) => CanBePromiseWrapped<(T & {
471
- page_url: string;
472
- })[]>;
473
- contentResults?: (options: DisplayTransformerAlwaysThereData & {
474
- data: ContentLink[];
475
- }) => CanBePromiseWrapped<ContentLink[]>;
476
- };
477
- export type SomethingTakingADisplayTransformers<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = InputDisplay extends ModernDisplay ? "page_url" extends keyof InputDisplay["variant_displays"][number] ? {
478
- display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
479
- } : {
480
- display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
481
- } : {
482
- page_url_creator?: never;
483
- display_transformers?: never;
484
- };
485
491
  type ListingSuggestionAfterURLCreator = { [K in keyof ListingSuggestion]: K extends "ancestors" ? (ListingSuggestion & {
486
492
  page_url: string;
487
493
  })[] : ListingSuggestion[K] } & {
@@ -1334,6 +1340,7 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
1334
1340
  expanded_: boolean;
1335
1341
  }[]>;
1336
1342
  scroll_restoration_data: Signal<ScrollRestorationData>;
1343
+ history_content_blocks: Signal<_ContentBlock1[]>;
1337
1344
  };
1338
1345
  /**
1339
1346
  * Signal representing the currently selected filters. Will update to always reflect the state of the current URL. Calling the setter triggers a navigation (replaceState) to an updated URL.
@@ -1484,7 +1491,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1484
1491
  * Open the modal with support for alignment.
1485
1492
  * @returns {void}
1486
1493
  */
1487
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1494
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1488
1495
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1489
1496
  export interface PageReplacer {
1490
1497
  readonly render_: () => Node_Array;
@@ -1563,5 +1570,5 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1563
1570
  content_blocks_by_row?: ContentBlocksByRow;
1564
1571
  layout?: PossibleLayout;
1565
1572
  filterModalParent_?: HTMLElement | ShadowRoot;
1566
- }): import("@depict-ai/utilishared").Node_Array;
1573
+ }): import("@depict-ai/utilishared/latest").Node_Array;
1567
1574
  export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";