@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/ES10/index.cjs +47 -10
- package/ES10/index.d.ts +8 -2
- package/ES10/index.js +47 -10
- package/latest/index.cjs +47 -10
- package/latest/index.d.ts +8 -2
- package/latest/index.js +47 -10
- package/package.json +1 -1
- package/server/ES10/index.cjs +45 -8
- package/server/ES10/index.d.ts +8 -2
- package/server/ES10/index.js +45 -8
- package/server/latest/index.cjs +45 -8
- package/server/latest/index.d.ts +8 -2
- package/server/latest/index.js +45 -8
package/server/latest/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { dlog as $i7OB2$dlog, catchify as $i7OB2$catchify1, ListenableSet as $i7
|
|
|
7
7
|
/*! Depict.ai search and product listing SDK */
|
|
8
8
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
9
9
|
register_es_version("ui", "latest");
|
|
10
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.9";
|
|
11
11
|
function $a444a52bafa0dacc$export$54c6d6ff54e72743(whatToWatch) {
|
|
12
12
|
const [width, setWidth] = $i7OB2$createSignal(0);
|
|
13
13
|
const [height, setHeight] = $i7OB2$createSignal(0);
|
|
@@ -7943,7 +7943,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
7943
7943
|
/**
|
|
7944
7944
|
* rest = everything except query suggestions
|
|
7945
7945
|
*/
|
|
7946
|
-
async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
|
|
7946
|
+
async #run_display_transformers_for_rest(merchant, market, locale, input_data, currentListingForTransformer) {
|
|
7947
7947
|
const {
|
|
7948
7948
|
display_transformers: display_transformers
|
|
7949
7949
|
} = this;
|
|
@@ -7959,7 +7959,8 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
7959
7959
|
merchant: merchant,
|
|
7960
7960
|
market: market,
|
|
7961
7961
|
locale: locale,
|
|
7962
|
-
displays: [...displays]
|
|
7962
|
+
displays: [...displays],
|
|
7963
|
+
currentListing: currentListingForTransformer
|
|
7963
7964
|
});
|
|
7964
7965
|
input_data.displays = transformed_displays;
|
|
7965
7966
|
}
|
|
@@ -7982,7 +7983,8 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
7982
7983
|
endpoint_: endpoint_,
|
|
7983
7984
|
input_req_: input_req_,
|
|
7984
7985
|
fallback_response_: fallback_response_,
|
|
7985
|
-
method_ = "POST"
|
|
7986
|
+
method_ = "POST",
|
|
7987
|
+
currentListingForTransformer_: currentListingForTransformer_
|
|
7986
7988
|
}) {
|
|
7987
7989
|
const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
|
|
7988
7990
|
const with_ids = this.#add_ids_to_request(input_req_);
|
|
@@ -8012,7 +8014,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
8012
8014
|
let result;
|
|
8013
8015
|
try {
|
|
8014
8016
|
const unmodified_result = await api_response.json();
|
|
8015
|
-
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
8017
|
+
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
|
|
8016
8018
|
} catch (e) {
|
|
8017
8019
|
$i7OB2$dwarn("displayTransformer or json decoding failed", e);
|
|
8018
8020
|
break return_successfully;
|
|
@@ -8114,11 +8116,13 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
8114
8116
|
async get_listing_products({
|
|
8115
8117
|
id_to_query_for_: id_to_query_for_,
|
|
8116
8118
|
id_type_: id_type_,
|
|
8119
|
+
currentListingForTransformer_: currentListingForTransformer_,
|
|
8117
8120
|
...input_req_
|
|
8118
8121
|
}) {
|
|
8119
8122
|
return await this.#cached_request({
|
|
8120
8123
|
endpoint_: $7fa23e2a0079eca4$var$v3_base_url + "listings/" + (id_type_ === $c20599a0d81d953a$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
|
|
8121
8124
|
input_req_: input_req_,
|
|
8125
|
+
currentListingForTransformer_: currentListingForTransformer_,
|
|
8122
8126
|
fallback_response_: () => ({
|
|
8123
8127
|
"n_hits": 0,
|
|
8124
8128
|
"displays": [],
|
|
@@ -12339,8 +12343,14 @@ function $f916989c4b1be9f7$export$780a853d15174484({
|
|
|
12339
12343
|
mediaUrl_: mediaUrl_,
|
|
12340
12344
|
aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
|
|
12341
12345
|
}) {
|
|
12346
|
+
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
|
|
12342
12347
|
const [wrapperSize, setWrapperSize] = $i7OB2$createSignal();
|
|
12343
12348
|
const isImage = type_ === "image";
|
|
12349
|
+
const setAspectRatio = aspectRatio => {
|
|
12350
|
+
if (wroteAspectRatioToContainer) return;
|
|
12351
|
+
wroteAspectRatioToContainer = true;
|
|
12352
|
+
setAspectRatioWas_(aspectRatio);
|
|
12353
|
+
};
|
|
12344
12354
|
return $i7OB2$createComponent((0, $i7OB2$Dynamic), $i7OB2$mergeProps({
|
|
12345
12355
|
component: link_ ? "a" : "div",
|
|
12346
12356
|
"class": "d-standard-content-wrapper",
|
|
@@ -12430,7 +12440,7 @@ function $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_
|
|
|
12430
12440
|
...prev,
|
|
12431
12441
|
aspectRatios: {
|
|
12432
12442
|
...prev.aspectRatios,
|
|
12433
|
-
[componentCacheKey]: Math.round(aspectRatio *
|
|
12443
|
+
[componentCacheKey]: Math.round(aspectRatio * 100) / 100
|
|
12434
12444
|
}
|
|
12435
12445
|
}))
|
|
12436
12446
|
});
|
|
@@ -12502,6 +12512,10 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12502
12512
|
const all_products_loaded_ = $i7OB2$createSignal(false);
|
|
12503
12513
|
const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $i7OB2$createSignal(0);
|
|
12504
12514
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $i7OB2$createSignal(false);
|
|
12515
|
+
const owner = $i7OB2$getOwner();
|
|
12516
|
+
const [metaRequestsForQuery, setMetaRequestsForQuery] = $i7OB2$createSignal(new Map(), {
|
|
12517
|
+
equals: false
|
|
12518
|
+
});
|
|
12505
12519
|
const products_query_base_ = $587cd61972788655$export$210f130a61ac1e8d(() => {
|
|
12506
12520
|
const sort_obj = get_sorting() && {
|
|
12507
12521
|
...get_sorting()
|
|
@@ -12534,7 +12548,20 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12534
12548
|
limit: limit,
|
|
12535
12549
|
...(cursor ? {
|
|
12536
12550
|
cursor: cursor
|
|
12537
|
-
} : {})
|
|
12551
|
+
} : {}),
|
|
12552
|
+
// This gets exposed to the products display transformer and gives it information about the listing the products are in
|
|
12553
|
+
// It's very hard to implement tracking that uses the collection title without this information
|
|
12554
|
+
currentListingForTransformer_: new Promise(resolve => $i7OB2$createRoot(dispose => {
|
|
12555
|
+
$i7OB2$createEffect($i7OB2$catchify1(() => {
|
|
12556
|
+
const key = base_query.id_type_ + base_query.id_to_query_for_;
|
|
12557
|
+
const metaResponsePromise = metaRequestsForQuery().get(key);
|
|
12558
|
+
if (!metaResponsePromise) return;
|
|
12559
|
+
resolve(metaResponsePromise);
|
|
12560
|
+
dispose();
|
|
12561
|
+
setMetaRequestsForQuery(prev => (prev.delete(key), prev));
|
|
12562
|
+
}));
|
|
12563
|
+
$i7OB2$runWithOwner(owner, () => $i7OB2$onCleanup(dispose));
|
|
12564
|
+
}))
|
|
12538
12565
|
})
|
|
12539
12566
|
})));
|
|
12540
12567
|
const meta_query_base = $587cd61972788655$export$210f130a61ac1e8d(() => ({
|
|
@@ -12545,7 +12572,17 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12545
12572
|
id_type_: id_type_()
|
|
12546
12573
|
}));
|
|
12547
12574
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
12548
|
-
const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify1(query =>
|
|
12575
|
+
const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify1(async query => {
|
|
12576
|
+
const result = await depict_api_.get_listing(query);
|
|
12577
|
+
// In the following two lines, do not expose the finished breadcrumbs and quicklinks in the products display transformer since it's already exposed in the categories display transformer
|
|
12578
|
+
const {
|
|
12579
|
+
breadcrumbs: breadcrumbs,
|
|
12580
|
+
quick_links: quick_links,
|
|
12581
|
+
...listing
|
|
12582
|
+
} = result;
|
|
12583
|
+
setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
|
|
12584
|
+
return result;
|
|
12585
|
+
}));
|
|
12549
12586
|
const contentBlocksByRow = $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
|
|
12550
12587
|
const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
|
|
12551
12588
|
const available_sortings_ = $i7OB2$createMemo(() => plp_products_()?.sorts?.map(sort => ({
|