@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/ES10/index.cjs +42 -9
- package/ES10/index.d.ts +10 -4
- package/ES10/index.js +42 -9
- package/latest/index.cjs +42 -9
- package/latest/index.d.ts +10 -4
- package/latest/index.js +42 -9
- package/package.json +1 -1
- package/server/ES10/index.cjs +42 -9
- package/server/ES10/index.d.ts +10 -4
- package/server/ES10/index.js +42 -9
- package/server/latest/index.cjs +42 -9
- package/server/latest/index.d.ts +10 -4
- package/server/latest/index.js +42 -9
package/ES10/index.cjs
CHANGED
|
@@ -114,7 +114,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
|
|
|
114
114
|
$parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
|
|
115
115
|
$parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
|
|
116
116
|
/*! Depict.ai search and product listing SDK */
|
|
117
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.8.
|
|
117
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.8.10";
|
|
118
118
|
function $054b1113e4897051$export$54c6d6ff54e72743(whatToWatch) {
|
|
119
119
|
const [width, setWidth] = $52FdA$solidjs.createSignal(0);
|
|
120
120
|
const [height, setHeight] = $52FdA$solidjs.createSignal(0);
|
|
@@ -10217,7 +10217,7 @@ function $a162c9a08dc208c2$export$b288c38ae3fddb56(_ref) {
|
|
|
10217
10217
|
var _sources, _sources$find;
|
|
10218
10218
|
const owner = $52FdA$solidjs.getOwner();
|
|
10219
10219
|
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());
|
|
10220
|
-
if (executions >
|
|
10220
|
+
if (executions > 50) {
|
|
10221
10221
|
var _signal$observers, _signal$observers$map;
|
|
10222
10222
|
// We're probably in an infinite loop, let's just stop
|
|
10223
10223
|
$52FdA$depictaiutilishared.report(new Error("Infinite loop detected in create_modified_filters"), "error", {
|
|
@@ -10752,11 +10752,13 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
|
10752
10752
|
let {
|
|
10753
10753
|
id_to_query_for_: id_to_query_for_,
|
|
10754
10754
|
id_type_: id_type_,
|
|
10755
|
+
currentListingForTransformer_: currentListingForTransformer_,
|
|
10755
10756
|
...input_req_
|
|
10756
10757
|
} = _ref2;
|
|
10757
10758
|
return await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_cached_request, $e270e9f953fcbc58$var$_cached_request2).call(this, {
|
|
10758
10759
|
endpoint_: $e270e9f953fcbc58$var$v3_base_url + "listings/" + (id_type_ === $c3739e86187f2054$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
|
|
10759
10760
|
input_req_: input_req_,
|
|
10761
|
+
currentListingForTransformer_: currentListingForTransformer_,
|
|
10760
10762
|
fallback_response_: () => ({
|
|
10761
10763
|
"n_hits": 0,
|
|
10762
10764
|
"displays": [],
|
|
@@ -10841,7 +10843,7 @@ async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, mar
|
|
|
10841
10843
|
response.suggestions = transformedSuggestions;
|
|
10842
10844
|
return response;
|
|
10843
10845
|
}
|
|
10844
|
-
async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
|
|
10846
|
+
async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data, currentListingForTransformer) {
|
|
10845
10847
|
const {
|
|
10846
10848
|
display_transformers: display_transformers
|
|
10847
10849
|
} = this;
|
|
@@ -10857,7 +10859,8 @@ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchan
|
|
|
10857
10859
|
merchant: merchant,
|
|
10858
10860
|
market: market,
|
|
10859
10861
|
locale: locale,
|
|
10860
|
-
displays: [...displays]
|
|
10862
|
+
displays: [...displays],
|
|
10863
|
+
currentListing: currentListingForTransformer
|
|
10861
10864
|
});
|
|
10862
10865
|
input_data.displays = transformed_displays;
|
|
10863
10866
|
}
|
|
@@ -10882,7 +10885,8 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref4) {
|
|
|
10882
10885
|
endpoint_: endpoint_,
|
|
10883
10886
|
input_req_: input_req_,
|
|
10884
10887
|
fallback_response_: fallback_response_,
|
|
10885
|
-
method_ = "POST"
|
|
10888
|
+
method_ = "POST",
|
|
10889
|
+
currentListingForTransformer_: currentListingForTransformer_
|
|
10886
10890
|
} = _ref4;
|
|
10887
10891
|
const cache_obj = $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint2).call(this, endpoint_);
|
|
10888
10892
|
const with_ids = $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $e270e9f953fcbc58$var$_add_ids_to_request).call(this, input_req_);
|
|
@@ -10912,7 +10916,7 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref4) {
|
|
|
10912
10916
|
let result;
|
|
10913
10917
|
try {
|
|
10914
10918
|
const unmodified_result = await api_response.json();
|
|
10915
|
-
result = await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_run_display_transformers_for_rest, $e270e9f953fcbc58$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
10919
|
+
result = await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_run_display_transformers_for_rest, $e270e9f953fcbc58$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
|
|
10916
10920
|
} catch (e) {
|
|
10917
10921
|
$52FdA$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
10918
10922
|
break return_successfully;
|
|
@@ -11616,10 +11620,12 @@ function $d6ed4dbb6507996d$export$b3ad617e9036868(_ref, input_field, alignment,
|
|
|
11616
11620
|
const rect = input_field.getBoundingClientRect(); /* for some reason contentRect.top and contentRect.left is 0 from the RO */
|
|
11617
11621
|
const addToLeftValue = alignment & $d6ed4dbb6507996d$export$6060bc6bee850eb6 ? rect.width / 2 : 0;
|
|
11618
11622
|
const leftWithoutScroll = rect.left + addToLeftValue;
|
|
11623
|
+
const topValue = rect.top + (includeScroll ? scrollY : 0);
|
|
11619
11624
|
setModalBodyStyle(old_value => ({
|
|
11620
11625
|
...old_value,
|
|
11626
|
+
// 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
|
|
11621
11627
|
...(alignment & $d6ed4dbb6507996d$export$3f238c96c45e6cc6 ? {
|
|
11622
|
-
top: "".concat(
|
|
11628
|
+
top: "".concat(topValue >= 0 ? topValue : 0, "px")
|
|
11623
11629
|
} : {}),
|
|
11624
11630
|
...(alignment & $d6ed4dbb6507996d$export$7895aadd1956b1c7 ? {
|
|
11625
11631
|
left: "".concat(leftWithoutScroll + (includeScroll ? scrollX : 0), "px")
|
|
@@ -16237,6 +16243,10 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
16237
16243
|
const all_products_loaded_ = $52FdA$solidjs.createSignal(false);
|
|
16238
16244
|
const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $52FdA$solidjs.createSignal(0);
|
|
16239
16245
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $52FdA$solidjs.createSignal(false);
|
|
16246
|
+
const owner = $52FdA$solidjs.getOwner();
|
|
16247
|
+
const [metaRequestsForQuery, setMetaRequestsForQuery] = $52FdA$solidjs.createSignal(new Map(), {
|
|
16248
|
+
equals: false
|
|
16249
|
+
});
|
|
16240
16250
|
const products_query_base_ = $e4bc31358c414b18$export$210f130a61ac1e8d(() => {
|
|
16241
16251
|
const sort_obj = get_sorting() && {
|
|
16242
16252
|
...get_sorting()
|
|
@@ -16269,7 +16279,20 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
16269
16279
|
limit: limit,
|
|
16270
16280
|
...(cursor ? {
|
|
16271
16281
|
cursor: cursor
|
|
16272
|
-
} : {})
|
|
16282
|
+
} : {}),
|
|
16283
|
+
// This gets exposed to the products display transformer and gives it information about the listing the products are in
|
|
16284
|
+
// It's very hard to implement tracking that uses the collection title without this information
|
|
16285
|
+
currentListingForTransformer_: new Promise(resolve => $52FdA$solidjs.createRoot(dispose => {
|
|
16286
|
+
$52FdA$solidjs.createEffect($52FdA$depictaiutilisharedlatest.catchify(() => {
|
|
16287
|
+
const key = base_query.id_type_ + base_query.id_to_query_for_;
|
|
16288
|
+
const metaResponsePromise = metaRequestsForQuery().get(key);
|
|
16289
|
+
if (!metaResponsePromise) return;
|
|
16290
|
+
resolve(metaResponsePromise);
|
|
16291
|
+
dispose();
|
|
16292
|
+
setMetaRequestsForQuery(prev => (prev.delete(key), prev));
|
|
16293
|
+
}));
|
|
16294
|
+
$52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.onCleanup(dispose));
|
|
16295
|
+
}))
|
|
16273
16296
|
})
|
|
16274
16297
|
})));
|
|
16275
16298
|
const meta_query_base = $e4bc31358c414b18$export$210f130a61ac1e8d(() => ({
|
|
@@ -16280,7 +16303,17 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
16280
16303
|
id_type_: id_type_()
|
|
16281
16304
|
}));
|
|
16282
16305
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
16283
|
-
const [plp_meta] = $52FdA$solidjs.createResource(meta_query_base, $52FdA$depictaiutilisharedlatest.catchify(query =>
|
|
16306
|
+
const [plp_meta] = $52FdA$solidjs.createResource(meta_query_base, $52FdA$depictaiutilisharedlatest.catchify(async query => {
|
|
16307
|
+
const result = await depict_api_.get_listing(query);
|
|
16308
|
+
// 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
|
|
16309
|
+
const {
|
|
16310
|
+
breadcrumbs: breadcrumbs,
|
|
16311
|
+
quick_links: quick_links,
|
|
16312
|
+
...listing
|
|
16313
|
+
} = result;
|
|
16314
|
+
setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
|
|
16315
|
+
return result;
|
|
16316
|
+
}));
|
|
16284
16317
|
const contentBlocksByRow = $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
|
|
16285
16318
|
const countOfProductsForUI = $e335e2ff536c1a0b$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
|
|
16286
16319
|
const available_sortings_ = $52FdA$solidjs.createMemo(() => {
|
package/ES10/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Accessor, JSX, Setter, Signal } from "solid-js";
|
|
2
2
|
import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer, ColsAtSize, Elem, Node_Array } from "@depict-ai/utilishared/ES10";
|
|
3
3
|
import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
|
|
4
|
-
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
4
|
+
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3, ProductListing as _ProductListing1 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
5
5
|
import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
|
|
6
6
|
import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
|
|
7
7
|
import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
|
|
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
|
|
13
13
|
import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
14
|
-
export const version = "4.8.
|
|
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
|
|
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";
|
package/ES10/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
|
|
|
10
10
|
/*! Depict.ai search and product listing SDK */
|
|
11
11
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
12
12
|
register_es_version("ui", "ES10");
|
|
13
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.8.
|
|
13
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.8.10";
|
|
14
14
|
function $4be619ec2cd7bba3$export$54c6d6ff54e72743(whatToWatch) {
|
|
15
15
|
const [width, setWidth] = $8tj43$createSignal(0);
|
|
16
16
|
const [height, setHeight] = $8tj43$createSignal(0);
|
|
@@ -10113,7 +10113,7 @@ function $44aa24b1bb793549$export$b288c38ae3fddb56(_ref) {
|
|
|
10113
10113
|
var _sources, _sources$find;
|
|
10114
10114
|
const owner = $8tj43$getOwner();
|
|
10115
10115
|
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());
|
|
10116
|
-
if (executions >
|
|
10116
|
+
if (executions > 50) {
|
|
10117
10117
|
var _signal$observers, _signal$observers$map;
|
|
10118
10118
|
// We're probably in an infinite loop, let's just stop
|
|
10119
10119
|
$8tj43$report(new Error("Infinite loop detected in create_modified_filters"), "error", {
|
|
@@ -10648,11 +10648,13 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
|
|
|
10648
10648
|
let {
|
|
10649
10649
|
id_to_query_for_: id_to_query_for_,
|
|
10650
10650
|
id_type_: id_type_,
|
|
10651
|
+
currentListingForTransformer_: currentListingForTransformer_,
|
|
10651
10652
|
...input_req_
|
|
10652
10653
|
} = _ref2;
|
|
10653
10654
|
return await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_cached_request, $284849364a6ef73a$var$_cached_request2).call(this, {
|
|
10654
10655
|
endpoint_: $284849364a6ef73a$var$v3_base_url + "listings/" + (id_type_ === $397620a4d7958ed1$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
|
|
10655
10656
|
input_req_: input_req_,
|
|
10657
|
+
currentListingForTransformer_: currentListingForTransformer_,
|
|
10656
10658
|
fallback_response_: () => ({
|
|
10657
10659
|
"n_hits": 0,
|
|
10658
10660
|
"displays": [],
|
|
@@ -10737,7 +10739,7 @@ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, mar
|
|
|
10737
10739
|
response.suggestions = transformedSuggestions;
|
|
10738
10740
|
return response;
|
|
10739
10741
|
}
|
|
10740
|
-
async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
|
|
10742
|
+
async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data, currentListingForTransformer) {
|
|
10741
10743
|
const {
|
|
10742
10744
|
display_transformers: display_transformers
|
|
10743
10745
|
} = this;
|
|
@@ -10753,7 +10755,8 @@ async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchan
|
|
|
10753
10755
|
merchant: merchant,
|
|
10754
10756
|
market: market,
|
|
10755
10757
|
locale: locale,
|
|
10756
|
-
displays: [...displays]
|
|
10758
|
+
displays: [...displays],
|
|
10759
|
+
currentListing: currentListingForTransformer
|
|
10757
10760
|
});
|
|
10758
10761
|
input_data.displays = transformed_displays;
|
|
10759
10762
|
}
|
|
@@ -10778,7 +10781,8 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
|
|
|
10778
10781
|
endpoint_: endpoint_,
|
|
10779
10782
|
input_req_: input_req_,
|
|
10780
10783
|
fallback_response_: fallback_response_,
|
|
10781
|
-
method_ = "POST"
|
|
10784
|
+
method_ = "POST",
|
|
10785
|
+
currentListingForTransformer_: currentListingForTransformer_
|
|
10782
10786
|
} = _ref4;
|
|
10783
10787
|
const cache_obj = $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_get_cache_obj_for_endpoint, $284849364a6ef73a$var$_get_cache_obj_for_endpoint2).call(this, endpoint_);
|
|
10784
10788
|
const with_ids = $8tj43$babelruntimehelpersclassPrivateFieldGet(this, $284849364a6ef73a$var$_add_ids_to_request).call(this, input_req_);
|
|
@@ -10808,7 +10812,7 @@ async function $284849364a6ef73a$var$_cached_request2(_ref4) {
|
|
|
10808
10812
|
let result;
|
|
10809
10813
|
try {
|
|
10810
10814
|
const unmodified_result = await api_response.json();
|
|
10811
|
-
result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_display_transformers_for_rest, $284849364a6ef73a$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
10815
|
+
result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_display_transformers_for_rest, $284849364a6ef73a$var$_run_display_transformers_for_rest2).call(this, input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
|
|
10812
10816
|
} catch (e) {
|
|
10813
10817
|
$8tj43$dwarn("displayTransformer or json decoding failed", e);
|
|
10814
10818
|
break return_successfully;
|
|
@@ -11512,10 +11516,12 @@ function $1308a7816c3d4f2d$export$b3ad617e9036868(_ref, input_field, alignment,
|
|
|
11512
11516
|
const rect = input_field.getBoundingClientRect(); /* for some reason contentRect.top and contentRect.left is 0 from the RO */
|
|
11513
11517
|
const addToLeftValue = alignment & $1308a7816c3d4f2d$export$6060bc6bee850eb6 ? rect.width / 2 : 0;
|
|
11514
11518
|
const leftWithoutScroll = rect.left + addToLeftValue;
|
|
11519
|
+
const topValue = rect.top + (includeScroll ? scrollY : 0);
|
|
11515
11520
|
setModalBodyStyle(old_value => ({
|
|
11516
11521
|
...old_value,
|
|
11522
|
+
// 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
|
|
11517
11523
|
...(alignment & $1308a7816c3d4f2d$export$3f238c96c45e6cc6 ? {
|
|
11518
|
-
top: "".concat(
|
|
11524
|
+
top: "".concat(topValue >= 0 ? topValue : 0, "px")
|
|
11519
11525
|
} : {}),
|
|
11520
11526
|
...(alignment & $1308a7816c3d4f2d$export$7895aadd1956b1c7 ? {
|
|
11521
11527
|
left: "".concat(leftWithoutScroll + (includeScroll ? scrollX : 0), "px")
|
|
@@ -16133,6 +16139,10 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
16133
16139
|
const all_products_loaded_ = $8tj43$createSignal(false);
|
|
16134
16140
|
const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $8tj43$createSignal(0);
|
|
16135
16141
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $8tj43$createSignal(false);
|
|
16142
|
+
const owner = $8tj43$getOwner();
|
|
16143
|
+
const [metaRequestsForQuery, setMetaRequestsForQuery] = $8tj43$createSignal(new Map(), {
|
|
16144
|
+
equals: false
|
|
16145
|
+
});
|
|
16136
16146
|
const products_query_base_ = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => {
|
|
16137
16147
|
const sort_obj = get_sorting() && {
|
|
16138
16148
|
...get_sorting()
|
|
@@ -16165,7 +16175,20 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
16165
16175
|
limit: limit,
|
|
16166
16176
|
...(cursor ? {
|
|
16167
16177
|
cursor: cursor
|
|
16168
|
-
} : {})
|
|
16178
|
+
} : {}),
|
|
16179
|
+
// This gets exposed to the products display transformer and gives it information about the listing the products are in
|
|
16180
|
+
// It's very hard to implement tracking that uses the collection title without this information
|
|
16181
|
+
currentListingForTransformer_: new Promise(resolve => $8tj43$createRoot(dispose => {
|
|
16182
|
+
$8tj43$createEffect($8tj43$catchify1(() => {
|
|
16183
|
+
const key = base_query.id_type_ + base_query.id_to_query_for_;
|
|
16184
|
+
const metaResponsePromise = metaRequestsForQuery().get(key);
|
|
16185
|
+
if (!metaResponsePromise) return;
|
|
16186
|
+
resolve(metaResponsePromise);
|
|
16187
|
+
dispose();
|
|
16188
|
+
setMetaRequestsForQuery(prev => (prev.delete(key), prev));
|
|
16189
|
+
}));
|
|
16190
|
+
$8tj43$runWithOwner(owner, () => $8tj43$onCleanup(dispose));
|
|
16191
|
+
}))
|
|
16169
16192
|
})
|
|
16170
16193
|
})));
|
|
16171
16194
|
const meta_query_base = $ec225bf1f1627ea8$export$210f130a61ac1e8d(() => ({
|
|
@@ -16176,7 +16199,17 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
16176
16199
|
id_type_: id_type_()
|
|
16177
16200
|
}));
|
|
16178
16201
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
16179
|
-
const [plp_meta] = $8tj43$createResource(meta_query_base, $8tj43$catchify1(query =>
|
|
16202
|
+
const [plp_meta] = $8tj43$createResource(meta_query_base, $8tj43$catchify1(async query => {
|
|
16203
|
+
const result = await depict_api_.get_listing(query);
|
|
16204
|
+
// 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
|
|
16205
|
+
const {
|
|
16206
|
+
breadcrumbs: breadcrumbs,
|
|
16207
|
+
quick_links: quick_links,
|
|
16208
|
+
...listing
|
|
16209
|
+
} = result;
|
|
16210
|
+
setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
|
|
16211
|
+
return result;
|
|
16212
|
+
}));
|
|
16180
16213
|
const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
|
|
16181
16214
|
const countOfProductsForUI = $0728458b46ee9d32$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
|
|
16182
16215
|
const available_sortings_ = $8tj43$createMemo(() => {
|
package/latest/index.cjs
CHANGED
|
@@ -108,7 +108,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
|
|
|
108
108
|
$parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
|
|
109
109
|
$parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
|
|
110
110
|
/*! Depict.ai search and product listing SDK */
|
|
111
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.
|
|
111
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.10";
|
|
112
112
|
function $128302ab61dab8f1$export$54c6d6ff54e72743(whatToWatch) {
|
|
113
113
|
const [width, setWidth] = $gVhhF$solidjs.createSignal(0);
|
|
114
114
|
const [height, setHeight] = $gVhhF$solidjs.createSignal(0);
|
|
@@ -9691,7 +9691,7 @@ function $70482f04605572e2$export$b288c38ae3fddb56({
|
|
|
9691
9691
|
JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) {
|
|
9692
9692
|
const owner = $gVhhF$solidjs.getOwner();
|
|
9693
9693
|
const signal = owner?.sources?.find?.(source => source.value === read_local_cache());
|
|
9694
|
-
if (executions >
|
|
9694
|
+
if (executions > 50) {
|
|
9695
9695
|
// We're probably in an infinite loop, let's just stop
|
|
9696
9696
|
$gVhhF$depictaiutilishared.report(new Error("Infinite loop detected in create_modified_filters"), "error", {
|
|
9697
9697
|
executions: executions,
|
|
@@ -10147,7 +10147,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
10147
10147
|
/**
|
|
10148
10148
|
* rest = everything except query suggestions
|
|
10149
10149
|
*/
|
|
10150
|
-
async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
|
|
10150
|
+
async #run_display_transformers_for_rest(merchant, market, locale, input_data, currentListingForTransformer) {
|
|
10151
10151
|
const {
|
|
10152
10152
|
display_transformers: display_transformers
|
|
10153
10153
|
} = this;
|
|
@@ -10163,7 +10163,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
10163
10163
|
merchant: merchant,
|
|
10164
10164
|
market: market,
|
|
10165
10165
|
locale: locale,
|
|
10166
|
-
displays: [...displays]
|
|
10166
|
+
displays: [...displays],
|
|
10167
|
+
currentListing: currentListingForTransformer
|
|
10167
10168
|
});
|
|
10168
10169
|
input_data.displays = transformed_displays;
|
|
10169
10170
|
}
|
|
@@ -10186,7 +10187,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
10186
10187
|
endpoint_: endpoint_,
|
|
10187
10188
|
input_req_: input_req_,
|
|
10188
10189
|
fallback_response_: fallback_response_,
|
|
10189
|
-
method_ = "POST"
|
|
10190
|
+
method_ = "POST",
|
|
10191
|
+
currentListingForTransformer_: currentListingForTransformer_
|
|
10190
10192
|
}) {
|
|
10191
10193
|
const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
|
|
10192
10194
|
const with_ids = this.#add_ids_to_request(input_req_);
|
|
@@ -10216,7 +10218,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
10216
10218
|
let result;
|
|
10217
10219
|
try {
|
|
10218
10220
|
const unmodified_result = await api_response.json();
|
|
10219
|
-
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
10221
|
+
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result, currentListingForTransformer_);
|
|
10220
10222
|
} catch (e) {
|
|
10221
10223
|
$gVhhF$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
10222
10224
|
break return_successfully;
|
|
@@ -10318,11 +10320,13 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
10318
10320
|
async get_listing_products({
|
|
10319
10321
|
id_to_query_for_: id_to_query_for_,
|
|
10320
10322
|
id_type_: id_type_,
|
|
10323
|
+
currentListingForTransformer_: currentListingForTransformer_,
|
|
10321
10324
|
...input_req_
|
|
10322
10325
|
}) {
|
|
10323
10326
|
return await this.#cached_request({
|
|
10324
10327
|
endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
|
|
10325
10328
|
input_req_: input_req_,
|
|
10329
|
+
currentListingForTransformer_: currentListingForTransformer_,
|
|
10326
10330
|
fallback_response_: () => ({
|
|
10327
10331
|
"n_hits": 0,
|
|
10328
10332
|
"displays": [],
|
|
@@ -10931,10 +10935,12 @@ function $fd463ff0edb29915$export$b3ad617e9036868({
|
|
|
10931
10935
|
const rect = input_field.getBoundingClientRect(); /* for some reason contentRect.top and contentRect.left is 0 from the RO */
|
|
10932
10936
|
const addToLeftValue = alignment & $fd463ff0edb29915$export$6060bc6bee850eb6 ? rect.width / 2 : 0;
|
|
10933
10937
|
const leftWithoutScroll = rect.left + addToLeftValue;
|
|
10938
|
+
const topValue = rect.top + (includeScroll ? scrollY : 0);
|
|
10934
10939
|
setModalBodyStyle(old_value => ({
|
|
10935
10940
|
...old_value,
|
|
10941
|
+
// 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
|
|
10936
10942
|
...(alignment & $fd463ff0edb29915$export$3f238c96c45e6cc6 ? {
|
|
10937
|
-
top: `${
|
|
10943
|
+
top: `${topValue >= 0 ? topValue : 0}px`
|
|
10938
10944
|
} : {}),
|
|
10939
10945
|
...(alignment & $fd463ff0edb29915$export$7895aadd1956b1c7 ? {
|
|
10940
10946
|
left: `${leftWithoutScroll + (includeScroll ? scrollX : 0)}px`
|
|
@@ -15182,6 +15188,10 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
15182
15188
|
const all_products_loaded_ = $gVhhF$solidjs.createSignal(false);
|
|
15183
15189
|
const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $gVhhF$solidjs.createSignal(0);
|
|
15184
15190
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $gVhhF$solidjs.createSignal(false);
|
|
15191
|
+
const owner = $gVhhF$solidjs.getOwner();
|
|
15192
|
+
const [metaRequestsForQuery, setMetaRequestsForQuery] = $gVhhF$solidjs.createSignal(new Map(), {
|
|
15193
|
+
equals: false
|
|
15194
|
+
});
|
|
15185
15195
|
const products_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
|
|
15186
15196
|
const sort_obj = get_sorting() && {
|
|
15187
15197
|
...get_sorting()
|
|
@@ -15214,7 +15224,20 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
15214
15224
|
limit: limit,
|
|
15215
15225
|
...(cursor ? {
|
|
15216
15226
|
cursor: cursor
|
|
15217
|
-
} : {})
|
|
15227
|
+
} : {}),
|
|
15228
|
+
// This gets exposed to the products display transformer and gives it information about the listing the products are in
|
|
15229
|
+
// It's very hard to implement tracking that uses the collection title without this information
|
|
15230
|
+
currentListingForTransformer_: new Promise(resolve => $gVhhF$solidjs.createRoot(dispose => {
|
|
15231
|
+
$gVhhF$solidjs.createEffect($gVhhF$depictaiutilisharedlatest.catchify(() => {
|
|
15232
|
+
const key = base_query.id_type_ + base_query.id_to_query_for_;
|
|
15233
|
+
const metaResponsePromise = metaRequestsForQuery().get(key);
|
|
15234
|
+
if (!metaResponsePromise) return;
|
|
15235
|
+
resolve(metaResponsePromise);
|
|
15236
|
+
dispose();
|
|
15237
|
+
setMetaRequestsForQuery(prev => (prev.delete(key), prev));
|
|
15238
|
+
}));
|
|
15239
|
+
$gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.onCleanup(dispose));
|
|
15240
|
+
}))
|
|
15218
15241
|
})
|
|
15219
15242
|
})));
|
|
15220
15243
|
const meta_query_base = $8cd545330f2674dc$export$210f130a61ac1e8d(() => ({
|
|
@@ -15225,7 +15248,17 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
15225
15248
|
id_type_: id_type_()
|
|
15226
15249
|
}));
|
|
15227
15250
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
15228
|
-
const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilisharedlatest.catchify(query =>
|
|
15251
|
+
const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilisharedlatest.catchify(async query => {
|
|
15252
|
+
const result = await depict_api_.get_listing(query);
|
|
15253
|
+
// 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
|
|
15254
|
+
const {
|
|
15255
|
+
breadcrumbs: breadcrumbs,
|
|
15256
|
+
quick_links: quick_links,
|
|
15257
|
+
...listing
|
|
15258
|
+
} = result;
|
|
15259
|
+
setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
|
|
15260
|
+
return result;
|
|
15261
|
+
}));
|
|
15229
15262
|
const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
|
|
15230
15263
|
const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
|
|
15231
15264
|
const available_sortings_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
package/latest/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Accessor, JSX, Setter, Signal } from "solid-js";
|
|
2
2
|
import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer, ColsAtSize, Elem, Node_Array } from "@depict-ai/utilishared/latest";
|
|
3
3
|
import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
|
|
4
|
-
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
4
|
+
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3, ProductListing as _ProductListing1 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
5
5
|
import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
|
|
6
6
|
import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
|
|
7
7
|
import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
|
|
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
|
|
13
13
|
import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
14
|
-
export const version = "4.8.
|
|
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
|
|
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";
|