@depict-ai/ui 3.0.6 → 3.0.8
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 +119 -66
- package/ES10/index.d.ts +14 -6
- package/ES10/index.js +119 -66
- package/latest/index.cjs +112 -60
- package/latest/index.d.ts +14 -6
- package/latest/index.js +112 -60
- package/package.json +4 -4
- package/server/ES10/index.cjs +117 -65
- package/server/ES10/index.d.ts +14 -6
- package/server/ES10/index.js +117 -65
- package/server/latest/index.cjs +110 -59
- package/server/latest/index.d.ts +14 -6
- package/server/latest/index.js +110 -59
package/latest/index.cjs
CHANGED
|
@@ -77,7 +77,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
77
77
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
78
78
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
79
79
|
/*! Depict.ai search and product listing SDK */
|
|
80
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.
|
|
80
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.8";
|
|
81
81
|
const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0"fill=#0f0f0f>`);
|
|
82
82
|
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
83
83
|
return (() => {
|
|
@@ -5501,6 +5501,65 @@ function $67dc366d96177e70$export$967e966fca9515e(api_response) {
|
|
|
5501
5501
|
// Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
|
|
5502
5502
|
const $779741d0f266ea8c$export$74ee7529ce0f8a00 = "listingId";
|
|
5503
5503
|
const $779741d0f266ea8c$export$5aae649db1b959fc = "externalId";
|
|
5504
|
+
|
|
5505
|
+
/**
|
|
5506
|
+
* Converts a v3 API response into something that has quick_links and breadcrumbs that behave as in v2 instead of ancestors, children and siblings, but gives every quicklink and breadcrumb's transformer the ancestors of the listing they are for.
|
|
5507
|
+
*/
|
|
5508
|
+
async function $3a9f9f260c9bfc55$export$d9792230b7c0203e({
|
|
5509
|
+
input_data_: {
|
|
5510
|
+
ancestors: ancestors,
|
|
5511
|
+
children: children,
|
|
5512
|
+
siblings: siblings,
|
|
5513
|
+
...clonedInputData
|
|
5514
|
+
},
|
|
5515
|
+
category_transformer_ = v => v.data,
|
|
5516
|
+
merchant_:
|
|
5517
|
+
// in case no display transformer just pass the data through, so we don't break
|
|
5518
|
+
merchant_,
|
|
5519
|
+
market_: market_,
|
|
5520
|
+
locale_: locale_
|
|
5521
|
+
}) {
|
|
5522
|
+
const breadcrumbs = [];
|
|
5523
|
+
const clonedAncestors = [...ancestors];
|
|
5524
|
+
while (clonedAncestors.length) {
|
|
5525
|
+
const ancestor = clonedAncestors.pop();
|
|
5526
|
+
if (!ancestor.show_in_breadcrumbs) continue;
|
|
5527
|
+
breadcrumbs.push({
|
|
5528
|
+
...ancestor,
|
|
5529
|
+
ancestors: [...clonedAncestors]
|
|
5530
|
+
});
|
|
5531
|
+
}
|
|
5532
|
+
breadcrumbs.reverse();
|
|
5533
|
+
const quicklinksIsChildren = children.length;
|
|
5534
|
+
const quickLinks = (quicklinksIsChildren ? children : siblings).filter(({
|
|
5535
|
+
show_in_quicklinks: show_in_quicklinks
|
|
5536
|
+
}) => show_in_quicklinks).map(productListing => {
|
|
5537
|
+
const ancestorsForUs = [...ancestors];
|
|
5538
|
+
if (quicklinksIsChildren) ancestorsForUs.push({
|
|
5539
|
+
...clonedInputData
|
|
5540
|
+
});
|
|
5541
|
+
return {
|
|
5542
|
+
...productListing,
|
|
5543
|
+
ancestors: ancestorsForUs
|
|
5544
|
+
};
|
|
5545
|
+
});
|
|
5546
|
+
const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
|
|
5547
|
+
merchant: merchant_,
|
|
5548
|
+
market: market_,
|
|
5549
|
+
locale: locale_,
|
|
5550
|
+
data: breadcrumbs
|
|
5551
|
+
}), category_transformer_({
|
|
5552
|
+
merchant: merchant_,
|
|
5553
|
+
market: market_,
|
|
5554
|
+
locale: locale_,
|
|
5555
|
+
data: quickLinks
|
|
5556
|
+
})]);
|
|
5557
|
+
return {
|
|
5558
|
+
...clonedInputData,
|
|
5559
|
+
breadcrumbs: transformedBreadcrumbs,
|
|
5560
|
+
quick_links: transformedQuickLinks
|
|
5561
|
+
};
|
|
5562
|
+
}
|
|
5504
5563
|
const $e1d6c0f3d89d531c$var$v3_base_url = (0, $gVhhF$depictaiutilishared.base_url) + "/v3/";
|
|
5505
5564
|
const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$v3_base_url + "search/";
|
|
5506
5565
|
class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
@@ -5526,20 +5585,32 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5526
5585
|
};
|
|
5527
5586
|
#get_metadata;
|
|
5528
5587
|
#get_session_id;
|
|
5529
|
-
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
5588
|
+
async #run_url_creator_for_suggest(merchant, market, locale, response) {
|
|
5530
5589
|
const category_transformer = this.display_transformers?.categories;
|
|
5531
5590
|
if (!category_transformer) return response;
|
|
5591
|
+
const incoming_suggestions = response.suggestions;
|
|
5592
|
+
const type_to_transform = "listing";
|
|
5532
5593
|
// find category suggestions, run thing with them, and then replace them
|
|
5533
|
-
const category_suggestions =
|
|
5534
|
-
const
|
|
5594
|
+
const category_suggestions = incoming_suggestions.filter(suggestion => suggestion.type === type_to_transform);
|
|
5595
|
+
const transformed_suggestions = [...(await category_transformer({
|
|
5535
5596
|
market: market,
|
|
5536
5597
|
merchant: merchant,
|
|
5598
|
+
locale: locale,
|
|
5537
5599
|
data: [...category_suggestions]
|
|
5538
|
-
});
|
|
5539
|
-
|
|
5600
|
+
}))];
|
|
5601
|
+
// Then add-back query suggestions at their original indices
|
|
5602
|
+
for (let i = 0; i < incoming_suggestions.length; i++) {
|
|
5603
|
+
const item = incoming_suggestions[i];
|
|
5604
|
+
if (item.type === type_to_transform) continue;
|
|
5605
|
+
transformed_suggestions.splice(i, 0, item);
|
|
5606
|
+
}
|
|
5607
|
+
response.suggestions = transformed_suggestions;
|
|
5540
5608
|
return response;
|
|
5541
5609
|
}
|
|
5542
|
-
|
|
5610
|
+
/**
|
|
5611
|
+
* rest = everything except query suggestions
|
|
5612
|
+
*/
|
|
5613
|
+
async #run_display_transformers_for_rest(merchant, market, locale, input_data) {
|
|
5543
5614
|
const {
|
|
5544
5615
|
display_transformers: display_transformers
|
|
5545
5616
|
} = this;
|
|
@@ -5555,25 +5626,24 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5555
5626
|
const transformed_displays = await product_transformer({
|
|
5556
5627
|
merchant: merchant,
|
|
5557
5628
|
market: market,
|
|
5629
|
+
locale: locale,
|
|
5558
5630
|
displays: [...displays]
|
|
5559
5631
|
});
|
|
5560
5632
|
input_data.displays = transformed_displays;
|
|
5561
5633
|
}
|
|
5562
|
-
if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
|
|
5563
|
-
const category_display_array = input_data[key];
|
|
5564
|
-
if (!category_display_array) continue;
|
|
5565
|
-
const transformed_category_displays = await category_transformer({
|
|
5566
|
-
merchant: merchant,
|
|
5567
|
-
market: market,
|
|
5568
|
-
data: [...category_display_array]
|
|
5569
|
-
});
|
|
5570
|
-
input_data[key] = transformed_category_displays;
|
|
5571
|
-
}
|
|
5572
5634
|
if (content_search_links?.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
|
|
5573
5635
|
merchant: merchant,
|
|
5574
5636
|
market: market,
|
|
5637
|
+
locale: locale,
|
|
5575
5638
|
data: [...content_search_links]
|
|
5576
5639
|
});
|
|
5640
|
+
if (input_data.ancestors) return await $3a9f9f260c9bfc55$export$d9792230b7c0203e({
|
|
5641
|
+
input_data_: input_data,
|
|
5642
|
+
category_transformer_: category_transformer,
|
|
5643
|
+
merchant_: merchant,
|
|
5644
|
+
market_: market,
|
|
5645
|
+
locale_: locale
|
|
5646
|
+
});
|
|
5577
5647
|
return input_data;
|
|
5578
5648
|
}
|
|
5579
5649
|
async #cached_request({
|
|
@@ -5610,7 +5680,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5610
5680
|
let result;
|
|
5611
5681
|
try {
|
|
5612
5682
|
const unmodified_result = await api_response.json();
|
|
5613
|
-
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, unmodified_result);
|
|
5683
|
+
result = await this.#run_display_transformers_for_rest(input_req_.merchant, input_req_.market, input_req_.locale, unmodified_result);
|
|
5614
5684
|
} catch (e) {
|
|
5615
5685
|
$gVhhF$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
5616
5686
|
break return_successfully;
|
|
@@ -5660,7 +5730,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5660
5730
|
const decoded_json = await results.json();
|
|
5661
5731
|
if (!Array.isArray(decoded_json?.suggestions)) break attempt_to_return_api_response;
|
|
5662
5732
|
try {
|
|
5663
|
-
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, decoded_json);
|
|
5733
|
+
return await this.#run_url_creator_for_suggest(input_req.merchant, input_req.market, input_req.locale, decoded_json);
|
|
5664
5734
|
} catch (e) {
|
|
5665
5735
|
$gVhhF$depictaiutilishared.dwarn("displayTransformer failed", e);
|
|
5666
5736
|
}
|
|
@@ -5696,13 +5766,12 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
5696
5766
|
fallback_response_: () => ({
|
|
5697
5767
|
listing_id: "",
|
|
5698
5768
|
listing_type: "category",
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
"quick_links": [],
|
|
5769
|
+
title: "",
|
|
5770
|
+
slug: "",
|
|
5771
|
+
show_in_breadcrumbs: false,
|
|
5772
|
+
show_in_quicklinks: false,
|
|
5773
|
+
breadcrumbs: [],
|
|
5774
|
+
quick_links: [],
|
|
5706
5775
|
failed: true
|
|
5707
5776
|
}),
|
|
5708
5777
|
method_: "GET"
|
|
@@ -8299,7 +8368,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
8299
8368
|
})));
|
|
8300
8369
|
const available_filters_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.filters);
|
|
8301
8370
|
const title = $gVhhF$solidjs.createMemo(() => plp_meta()?.title);
|
|
8302
|
-
const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta
|
|
8371
|
+
const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta);
|
|
8303
8372
|
const quicklinks_data_ = $gVhhF$solidjs.createMemo(() => plp_meta()?.quick_links);
|
|
8304
8373
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $gVhhF$solidjs.createSignal(false);
|
|
8305
8374
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $gVhhF$solidjs.createSignal();
|
|
@@ -8577,31 +8646,16 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
8577
8646
|
/**
|
|
8578
8647
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
8579
8648
|
*/
|
|
8580
|
-
function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta
|
|
8649
|
+
function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta) {
|
|
8581
8650
|
const href_accessor = $gVhhF$depictaiutilisharedlatest.use_href_accessor();
|
|
8582
8651
|
return $gVhhF$solidjs.createMemo(() => {
|
|
8583
8652
|
const api_value = plp_meta()?.breadcrumbs;
|
|
8584
8653
|
if (!api_value) return api_value;
|
|
8585
|
-
return [...api_value, {
|
|
8586
|
-
get listing_id() {
|
|
8587
|
-
return plp_meta().listing_id;
|
|
8588
|
-
},
|
|
8589
|
-
get title() {
|
|
8590
|
-
return title();
|
|
8591
|
-
},
|
|
8654
|
+
return [...api_value, $gVhhF$solidjs.mergeProps(plp_meta(), {
|
|
8592
8655
|
get page_url() {
|
|
8593
8656
|
return href_accessor();
|
|
8594
|
-
},
|
|
8595
|
-
get slug() {
|
|
8596
|
-
return plp_meta().slug;
|
|
8597
|
-
},
|
|
8598
|
-
get listing_type() {
|
|
8599
|
-
return plp_meta().listing_type;
|
|
8600
|
-
},
|
|
8601
|
-
get external_id() {
|
|
8602
|
-
return plp_meta().external_id;
|
|
8603
8657
|
}
|
|
8604
|
-
}];
|
|
8658
|
+
})];
|
|
8605
8659
|
});
|
|
8606
8660
|
}
|
|
8607
8661
|
function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
@@ -9208,7 +9262,7 @@ function $dae23104ba8bb78c$export$d757d54550ebfb3d({
|
|
|
9208
9262
|
category_suggestion_: category_suggestion_,
|
|
9209
9263
|
router_: router_
|
|
9210
9264
|
}) {
|
|
9211
|
-
const parentTitle = $gVhhF$solidjs.createMemo(() => category_suggestion_().
|
|
9265
|
+
const parentTitle = $gVhhF$solidjs.createMemo(() => category_suggestion_().ancestors.at(-1)?.title);
|
|
9212
9266
|
return (() => {
|
|
9213
9267
|
const _el$ = $gVhhF$solidjsweb.getNextElement($dae23104ba8bb78c$var$_tmpl$2),
|
|
9214
9268
|
_el$2 = _el$.firstChild,
|
|
@@ -9906,7 +9960,7 @@ function $9a268bf73b31a717$export$a146ac6fa8346a25({
|
|
|
9906
9960
|
currently_showing_suggestions_[1](value => {
|
|
9907
9961
|
value[0] = $gVhhF$solidjs.createMemo(() => previous_searches_().map(result => ({
|
|
9908
9962
|
type: (0, $3ec9e21d6b6debdd$export$3cf9497e790da491),
|
|
9909
|
-
|
|
9963
|
+
query: result,
|
|
9910
9964
|
suggestions_result_id: "history"
|
|
9911
9965
|
})));
|
|
9912
9966
|
return value;
|
|
@@ -10026,10 +10080,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
10026
10080
|
submit_query_: submit_query_,
|
|
10027
10081
|
get_content_results_: get_content_results_
|
|
10028
10082
|
}) {
|
|
10029
|
-
const queries_memo = $gVhhF$solidjs.createMemo(() => suggestion_memo_().filter((
|
|
10030
|
-
type: type,
|
|
10031
|
-
title: title
|
|
10032
|
-
}) => type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
10083
|
+
const queries_memo = $gVhhF$solidjs.createMemo(() => suggestion_memo_().filter(suggestion => suggestion.type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491) && !filtered_previous_searches_().includes(suggestion.query) // don't show the ones we already show from the history
|
|
10033
10084
|
) // + limit to three query suggestions, API sends more sometimes
|
|
10034
10085
|
.slice(0, 3));
|
|
10035
10086
|
const not_queries_memo = $gVhhF$solidjs.createMemo(() => {
|
|
@@ -10045,15 +10096,15 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
10045
10096
|
const is_query = $gVhhF$solidjs.createMemo(() => input_obj().type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491));
|
|
10046
10097
|
const href_with_changed_params_accessor = $gVhhF$solidjs.createMemo(() => is_query() ? $496cde876b53ce1e$export$91c3b6774e8be0f5({
|
|
10047
10098
|
param_: search_query_url_param_name_,
|
|
10048
|
-
value_: $gVhhF$solidjs.createMemo(() => input_obj().
|
|
10099
|
+
value_: $gVhhF$solidjs.createMemo(() => input_obj().query),
|
|
10049
10100
|
url_transformer_: url_transformer_
|
|
10050
10101
|
}) : undefined);
|
|
10051
10102
|
const href = $gVhhF$solidjs.createMemo(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
10052
10103
|
const is_selected = $gVhhF$solidjs.createMemo(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
10053
10104
|
const parent_title_if_exists = $gVhhF$solidjs.createMemo(() => {
|
|
10054
10105
|
const item = input_obj();
|
|
10055
|
-
if (!("
|
|
10056
|
-
return item.
|
|
10106
|
+
if (!("ancestors" in item)) return;
|
|
10107
|
+
return item.ancestors.at(-1)?.title;
|
|
10057
10108
|
});
|
|
10058
10109
|
return (() => {
|
|
10059
10110
|
const _el$ = $gVhhF$solidjsweb.getNextElement($6b65ba8af12c5a26$var$_tmpl$);
|
|
@@ -10063,8 +10114,9 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
10063
10114
|
if (ev.button || ev.metaKey || ev.ctrlKey)
|
|
10064
10115
|
// not button 0 or cmd/ctrl click
|
|
10065
10116
|
return;
|
|
10117
|
+
const input = input_obj();
|
|
10066
10118
|
ev.preventDefault();
|
|
10067
|
-
submit_query_(
|
|
10119
|
+
submit_query_(is_query() ? input.query : input.title);
|
|
10068
10120
|
return;
|
|
10069
10121
|
}
|
|
10070
10122
|
router_.navigate_.go_to_({
|
|
@@ -10092,7 +10144,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
10092
10144
|
}), $gVhhF$solidjsweb.createComponent((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
|
|
10093
10145
|
class_: "value line-clamp",
|
|
10094
10146
|
get whole_text_to_display_() {
|
|
10095
|
-
return $gVhhF$solidjs.createMemo(() => input_obj().
|
|
10147
|
+
return $gVhhF$solidjs.createMemo(() => input_obj().query);
|
|
10096
10148
|
},
|
|
10097
10149
|
searching_for_value_: searching_for_value_
|
|
10098
10150
|
})] : [$gVhhF$solidjsweb.memo((() => {
|
|
@@ -10220,7 +10272,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
10220
10272
|
return (() => {
|
|
10221
10273
|
const mapped_history_results = $gVhhF$solidjs.createMemo(() => filtered_previous_searches_().map(result => ({
|
|
10222
10274
|
type: (0, $3ec9e21d6b6debdd$export$3cf9497e790da491),
|
|
10223
|
-
|
|
10275
|
+
query: result,
|
|
10224
10276
|
suggestions_result_id: "history" // worthless to fix typing
|
|
10225
10277
|
})));
|
|
10226
10278
|
|
|
@@ -10391,16 +10443,16 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
10391
10443
|
// update text field value if needed
|
|
10392
10444
|
if (selected_entry?.type == "query") {
|
|
10393
10445
|
const {
|
|
10394
|
-
|
|
10446
|
+
query: query
|
|
10395
10447
|
} = selected_entry;
|
|
10396
10448
|
$gVhhF$solidjs.runWithOwner(owner, block_updating_for_one_change);
|
|
10397
|
-
set_search_field_value(
|
|
10449
|
+
set_search_field_value(query);
|
|
10398
10450
|
$gVhhF$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|
|
10399
10451
|
// Open search query in new tab on cmd+enter
|
|
10400
10452
|
// If it's not cmd+enter, pressing enter will just submit the value that was put into the field while selecting with the arrow keys ;)
|
|
10401
10453
|
const url = new URL(location);
|
|
10402
10454
|
url_transformer_?.(url);
|
|
10403
|
-
url.searchParams.set(search_query_param_name_,
|
|
10455
|
+
url.searchParams.set(search_query_param_name_, query);
|
|
10404
10456
|
return $b8700779b3e745de$export$1efe1013da60d0e4(e, url.href);
|
|
10405
10457
|
}));
|
|
10406
10458
|
} else if (selected_entry?.type == "listing" || selected_entry?.type === "content") $gVhhF$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|
package/latest/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ColsAtSize, Display, ModernDisplay, Amazing_Slider, Node_Array, report,
|
|
|
2
2
|
import { JSX, Signal, Accessor, Setter } from "solid-js";
|
|
3
3
|
import { SearchFilter, SortModel, SearchRequestV3 } from "@depict-ai/types/api/SearchRequestV3";
|
|
4
4
|
import { ContentLink, SearchFilter as _SearchFilter1, SearchResponse } from "@depict-ai/types/api/SearchResponse";
|
|
5
|
-
import { ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
5
|
+
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
6
6
|
import { ProductListing, GetListingResponse } from "@depict-ai/types/api/GetListingResponse";
|
|
7
7
|
import { ProductListingResponseV3 } from "@depict-ai/types/api/ProductListingResponseV3";
|
|
8
8
|
import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
|
|
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
|
|
|
10
10
|
import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
|
|
13
|
-
export const version = "3.0.
|
|
13
|
+
export const version = "3.0.8";
|
|
14
14
|
export type SDKColsAtSize = [number, number?][];
|
|
15
15
|
/**
|
|
16
16
|
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
@@ -40,11 +40,15 @@ type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends u
|
|
|
40
40
|
type DisplayTransformerAlwaysThereData = {
|
|
41
41
|
merchant: string;
|
|
42
42
|
market: string;
|
|
43
|
+
locale: string;
|
|
43
44
|
};
|
|
44
45
|
type CanBePromiseWrapped<T> = T | Promise<T>;
|
|
45
46
|
export type ModernDisplayWithPageUrl<T extends ModernDisplay> = { [K in keyof T]: K extends "variant_displays" ? (T[K][number] & {
|
|
46
47
|
page_url: string;
|
|
47
48
|
})[] : T[K] };
|
|
49
|
+
type ProductListingWithAncestors = ProductListing & {
|
|
50
|
+
ancestors: Ancestors;
|
|
51
|
+
};
|
|
48
52
|
/**
|
|
49
53
|
* DisplayTransformers supersede pageURLCreator
|
|
50
54
|
* 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.
|
|
@@ -53,7 +57,7 @@ export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDispla
|
|
|
53
57
|
products?: (options: DisplayTransformerAlwaysThereData & {
|
|
54
58
|
displays: InputDisplay[];
|
|
55
59
|
}) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
|
|
56
|
-
categories?: <T extends
|
|
60
|
+
categories?: <T extends ProductListingWithAncestors | ListingSuggestion>(options: DisplayTransformerAlwaysThereData & {
|
|
57
61
|
data: T[];
|
|
58
62
|
}) => CanBePromiseWrapped<(T & {
|
|
59
63
|
page_url: string;
|
|
@@ -825,7 +829,11 @@ type _AddPageUrlToDisplay1<T extends any[]> = (T[number] & {
|
|
|
825
829
|
page_url: string;
|
|
826
830
|
})[];
|
|
827
831
|
type ProductListingResponseAfterDisplayTransformer = { [K in keyof ProductListingResponseV3]: K extends "displays" ? _AddPageUrlToDisplay1<ProductListingResponseV3[K]> : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV3[K]> : ProductListingResponseV3[K] };
|
|
828
|
-
type GetListingResponseAfterDisplayTransformer = { [K in keyof
|
|
832
|
+
type GetListingResponseAfterDisplayTransformer = { [K in keyof GetListingResponseWithQuicklinksAndBreadcrumbs]: K extends "breadcrumbs" ? ProductListingWithPageURL[] : K extends "quick_links" ? ProductListingWithPageURL[] : GetListingResponseWithQuicklinksAndBreadcrumbs[K] };
|
|
833
|
+
type GetListingResponseWithQuicklinksAndBreadcrumbs = Omit<GetListingResponse, "siblings" | "ancestors" | "children"> & {
|
|
834
|
+
quick_links: ProductListingWithAncestors[];
|
|
835
|
+
breadcrumbs: ProductListingWithAncestors[];
|
|
836
|
+
};
|
|
829
837
|
type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
|
|
830
838
|
get_metadata?: () => Promise<{
|
|
831
839
|
[k: string]: string;
|
|
@@ -957,7 +965,7 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
|
|
|
957
965
|
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
958
966
|
on_listing_query_change?: (new_listing_query?: ListingQuery | undefined, old_listing_query?: ListingQuery | undefined) => void;
|
|
959
967
|
content_blocks_by_row?: ContentBlocksByRow;
|
|
960
|
-
}): import("@depict-ai/utilishared
|
|
968
|
+
}): import("@depict-ai/utilishared").Node_Array;
|
|
961
969
|
export function BreadCrumbs<T extends Display>({
|
|
962
970
|
depict_category
|
|
963
971
|
}: {
|
|
@@ -1109,7 +1117,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
|
|
|
1109
1117
|
* Open the modal with support for alignment.
|
|
1110
1118
|
* @returns {void}
|
|
1111
1119
|
*/
|
|
1112
|
-
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends
|
|
1120
|
+
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
|
|
1113
1121
|
export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
|
|
1114
1122
|
export interface PageReplacer {
|
|
1115
1123
|
readonly render_: () => Node_Array;
|