@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/server/ES10/index.cjs
CHANGED
|
@@ -83,7 +83,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
83
83
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
84
84
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
85
85
|
/*! Depict.ai search and product listing SDK */
|
|
86
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.
|
|
86
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "3.0.8";
|
|
87
87
|
const $9d19451330d04c3c$var$_tmpl$ = ["<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"></path></svg>'];
|
|
88
88
|
function $9d19451330d04c3c$export$8be2714ec7f169ee() {
|
|
89
89
|
var _$escape2, _$escape3;
|
|
@@ -4754,6 +4754,69 @@ function $b3dc12c672c9df24$export$967e966fca9515e(api_response) {
|
|
|
4754
4754
|
// Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
|
|
4755
4755
|
const $c3739e86187f2054$export$74ee7529ce0f8a00 = "listingId";
|
|
4756
4756
|
const $c3739e86187f2054$export$5aae649db1b959fc = "externalId";
|
|
4757
|
+
|
|
4758
|
+
/**
|
|
4759
|
+
* 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.
|
|
4760
|
+
*/
|
|
4761
|
+
async function $097d688689209955$export$d9792230b7c0203e(_ref) {
|
|
4762
|
+
let {
|
|
4763
|
+
input_data_: {
|
|
4764
|
+
ancestors: ancestors,
|
|
4765
|
+
children: children,
|
|
4766
|
+
siblings: siblings,
|
|
4767
|
+
...clonedInputData
|
|
4768
|
+
},
|
|
4769
|
+
category_transformer_ = v => v.data,
|
|
4770
|
+
merchant_:
|
|
4771
|
+
// in case no display transformer just pass the data through, so we don't break
|
|
4772
|
+
merchant_,
|
|
4773
|
+
market_: market_,
|
|
4774
|
+
locale_: locale_
|
|
4775
|
+
} = _ref;
|
|
4776
|
+
const breadcrumbs = [];
|
|
4777
|
+
const clonedAncestors = [...ancestors];
|
|
4778
|
+
while (clonedAncestors.length) {
|
|
4779
|
+
const ancestor = clonedAncestors.pop();
|
|
4780
|
+
if (!ancestor.show_in_breadcrumbs) continue;
|
|
4781
|
+
breadcrumbs.push({
|
|
4782
|
+
...ancestor,
|
|
4783
|
+
ancestors: [...clonedAncestors]
|
|
4784
|
+
});
|
|
4785
|
+
}
|
|
4786
|
+
breadcrumbs.reverse();
|
|
4787
|
+
const quicklinksIsChildren = children.length;
|
|
4788
|
+
const quickLinks = (quicklinksIsChildren ? children : siblings).filter(_ref2 => {
|
|
4789
|
+
let {
|
|
4790
|
+
show_in_quicklinks: show_in_quicklinks
|
|
4791
|
+
} = _ref2;
|
|
4792
|
+
return show_in_quicklinks;
|
|
4793
|
+
}).map(productListing => {
|
|
4794
|
+
const ancestorsForUs = [...ancestors];
|
|
4795
|
+
if (quicklinksIsChildren) ancestorsForUs.push({
|
|
4796
|
+
...clonedInputData
|
|
4797
|
+
});
|
|
4798
|
+
return {
|
|
4799
|
+
...productListing,
|
|
4800
|
+
ancestors: ancestorsForUs
|
|
4801
|
+
};
|
|
4802
|
+
});
|
|
4803
|
+
const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
|
|
4804
|
+
merchant: merchant_,
|
|
4805
|
+
market: market_,
|
|
4806
|
+
locale: locale_,
|
|
4807
|
+
data: breadcrumbs
|
|
4808
|
+
}), category_transformer_({
|
|
4809
|
+
merchant: merchant_,
|
|
4810
|
+
market: market_,
|
|
4811
|
+
locale: locale_,
|
|
4812
|
+
data: quickLinks
|
|
4813
|
+
})]);
|
|
4814
|
+
return {
|
|
4815
|
+
...clonedInputData,
|
|
4816
|
+
breadcrumbs: transformedBreadcrumbs,
|
|
4817
|
+
quick_links: transformedQuickLinks
|
|
4818
|
+
};
|
|
4819
|
+
}
|
|
4757
4820
|
function $e270e9f953fcbc58$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
4758
4821
|
$e270e9f953fcbc58$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
4759
4822
|
privateSet.add(obj);
|
|
@@ -4781,6 +4844,9 @@ var $e270e9f953fcbc58$var$_run_url_creator_for_suggest = /*#__PURE__*/new WeakSe
|
|
|
4781
4844
|
var $e270e9f953fcbc58$var$_run_display_transformers_for_rest = /*#__PURE__*/new WeakSet();
|
|
4782
4845
|
var $e270e9f953fcbc58$var$_cached_request = /*#__PURE__*/new WeakSet();
|
|
4783
4846
|
class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
4847
|
+
/**
|
|
4848
|
+
* rest = everything except query suggestions
|
|
4849
|
+
*/
|
|
4784
4850
|
constructor(options) {
|
|
4785
4851
|
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_cached_request);
|
|
4786
4852
|
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_run_display_transformers_for_rest);
|
|
@@ -4837,7 +4903,7 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
|
4837
4903
|
const decoded_json = await results.json();
|
|
4838
4904
|
if (!Array.isArray(decoded_json === null || decoded_json === void 0 ? void 0 : decoded_json.suggestions)) break attempt_to_return_api_response;
|
|
4839
4905
|
try {
|
|
4840
|
-
return await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_run_url_creator_for_suggest, $e270e9f953fcbc58$var$_run_url_creator_for_suggest2).call(this, input_req.merchant, input_req.market, decoded_json);
|
|
4906
|
+
return await $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_run_url_creator_for_suggest, $e270e9f953fcbc58$var$_run_url_creator_for_suggest2).call(this, input_req.merchant, input_req.market, input_req.locale, decoded_json);
|
|
4841
4907
|
} catch (e) {
|
|
4842
4908
|
$3hooq$depictaiutilishared.dwarn("displayTransformer failed", e);
|
|
4843
4909
|
}
|
|
@@ -4874,13 +4940,12 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
|
4874
4940
|
fallback_response_: () => ({
|
|
4875
4941
|
listing_id: "",
|
|
4876
4942
|
listing_type: "category",
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
"quick_links": [],
|
|
4943
|
+
title: "",
|
|
4944
|
+
slug: "",
|
|
4945
|
+
show_in_breadcrumbs: false,
|
|
4946
|
+
show_in_quicklinks: false,
|
|
4947
|
+
breadcrumbs: [],
|
|
4948
|
+
quick_links: [],
|
|
4884
4949
|
failed: true
|
|
4885
4950
|
}),
|
|
4886
4951
|
method_: "GET"
|
|
@@ -4927,21 +4992,30 @@ function $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint2(endpoint) {
|
|
|
4927
4992
|
})) : undefined
|
|
4928
4993
|
});
|
|
4929
4994
|
}
|
|
4930
|
-
async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, market, response) {
|
|
4995
|
+
async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, market, locale, response) {
|
|
4931
4996
|
var _this$display_transfo;
|
|
4932
4997
|
const category_transformer = (_this$display_transfo = this.display_transformers) === null || _this$display_transfo === void 0 ? void 0 : _this$display_transfo.categories;
|
|
4933
4998
|
if (!category_transformer) return response;
|
|
4999
|
+
const incoming_suggestions = response.suggestions;
|
|
5000
|
+
const type_to_transform = "listing";
|
|
4934
5001
|
// find category suggestions, run thing with them, and then replace them
|
|
4935
|
-
const category_suggestions =
|
|
4936
|
-
const
|
|
5002
|
+
const category_suggestions = incoming_suggestions.filter(suggestion => suggestion.type === type_to_transform);
|
|
5003
|
+
const transformed_suggestions = [...(await category_transformer({
|
|
4937
5004
|
market: market,
|
|
4938
5005
|
merchant: merchant,
|
|
5006
|
+
locale: locale,
|
|
4939
5007
|
data: [...category_suggestions]
|
|
4940
|
-
});
|
|
4941
|
-
|
|
5008
|
+
}))];
|
|
5009
|
+
// Then add-back query suggestions at their original indices
|
|
5010
|
+
for (let i = 0; i < incoming_suggestions.length; i++) {
|
|
5011
|
+
const item = incoming_suggestions[i];
|
|
5012
|
+
if (item.type === type_to_transform) continue;
|
|
5013
|
+
transformed_suggestions.splice(i, 0, item);
|
|
5014
|
+
}
|
|
5015
|
+
response.suggestions = transformed_suggestions;
|
|
4942
5016
|
return response;
|
|
4943
5017
|
}
|
|
4944
|
-
async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, input_data) {
|
|
5018
|
+
async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
|
|
4945
5019
|
const {
|
|
4946
5020
|
display_transformers: display_transformers
|
|
4947
5021
|
} = this;
|
|
@@ -4957,25 +5031,24 @@ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchan
|
|
|
4957
5031
|
const transformed_displays = await product_transformer({
|
|
4958
5032
|
merchant: merchant,
|
|
4959
5033
|
market: market,
|
|
5034
|
+
locale: locale,
|
|
4960
5035
|
displays: [...displays]
|
|
4961
5036
|
});
|
|
4962
5037
|
input_data.displays = transformed_displays;
|
|
4963
5038
|
}
|
|
4964
|
-
if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
|
|
4965
|
-
const category_display_array = input_data[key];
|
|
4966
|
-
if (!category_display_array) continue;
|
|
4967
|
-
const transformed_category_displays = await category_transformer({
|
|
4968
|
-
merchant: merchant,
|
|
4969
|
-
market: market,
|
|
4970
|
-
data: [...category_display_array]
|
|
4971
|
-
});
|
|
4972
|
-
input_data[key] = transformed_category_displays;
|
|
4973
|
-
}
|
|
4974
5039
|
if (content_search_links !== null && content_search_links !== void 0 && content_search_links.length && content_result_transformer) input_data.content_search_links = await content_result_transformer({
|
|
4975
5040
|
merchant: merchant,
|
|
4976
5041
|
market: market,
|
|
5042
|
+
locale: locale,
|
|
4977
5043
|
data: [...content_search_links]
|
|
4978
5044
|
});
|
|
5045
|
+
if (input_data.ancestors) return await $097d688689209955$export$d9792230b7c0203e({
|
|
5046
|
+
input_data_: input_data,
|
|
5047
|
+
category_transformer_: category_transformer,
|
|
5048
|
+
merchant_: merchant,
|
|
5049
|
+
market_: market,
|
|
5050
|
+
locale_: locale
|
|
5051
|
+
});
|
|
4979
5052
|
return input_data;
|
|
4980
5053
|
}
|
|
4981
5054
|
async function $e270e9f953fcbc58$var$_cached_request2(_ref3) {
|
|
@@ -5014,7 +5087,7 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref3) {
|
|
|
5014
5087
|
let result;
|
|
5015
5088
|
try {
|
|
5016
5089
|
const unmodified_result = await api_response.json();
|
|
5017
|
-
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, unmodified_result);
|
|
5090
|
+
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);
|
|
5018
5091
|
} catch (e) {
|
|
5019
5092
|
$3hooq$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
5020
5093
|
break return_successfully;
|
|
@@ -7318,7 +7391,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
7318
7391
|
var _plp_meta;
|
|
7319
7392
|
return (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.title;
|
|
7320
7393
|
});
|
|
7321
|
-
const crumb_data_ = $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta
|
|
7394
|
+
const crumb_data_ = $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta);
|
|
7322
7395
|
const quicklinks_data_ = $3hooq$solidjs.createMemo(() => {
|
|
7323
7396
|
var _plp_meta2;
|
|
7324
7397
|
return (_plp_meta2 = plp_meta()) === null || _plp_meta2 === void 0 ? void 0 : _plp_meta2.quick_links;
|
|
@@ -7559,32 +7632,17 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
7559
7632
|
/**
|
|
7560
7633
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
7561
7634
|
*/
|
|
7562
|
-
function $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta
|
|
7635
|
+
function $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta) {
|
|
7563
7636
|
const href_accessor = $3hooq$depictaiutilisharedlatest.use_href_accessor();
|
|
7564
7637
|
return $3hooq$solidjs.createMemo(() => {
|
|
7565
7638
|
var _plp_meta3;
|
|
7566
7639
|
const api_value = (_plp_meta3 = plp_meta()) === null || _plp_meta3 === void 0 ? void 0 : _plp_meta3.breadcrumbs;
|
|
7567
7640
|
if (!api_value) return api_value;
|
|
7568
|
-
return [...api_value, {
|
|
7569
|
-
get listing_id() {
|
|
7570
|
-
return plp_meta().listing_id;
|
|
7571
|
-
},
|
|
7572
|
-
get title() {
|
|
7573
|
-
return title();
|
|
7574
|
-
},
|
|
7641
|
+
return [...api_value, $3hooq$solidjs.mergeProps(plp_meta(), {
|
|
7575
7642
|
get page_url() {
|
|
7576
7643
|
return href_accessor();
|
|
7577
|
-
},
|
|
7578
|
-
get slug() {
|
|
7579
|
-
return plp_meta().slug;
|
|
7580
|
-
},
|
|
7581
|
-
get listing_type() {
|
|
7582
|
-
return plp_meta().listing_type;
|
|
7583
|
-
},
|
|
7584
|
-
get external_id() {
|
|
7585
|
-
return plp_meta().external_id;
|
|
7586
7644
|
}
|
|
7587
|
-
}];
|
|
7645
|
+
})];
|
|
7588
7646
|
});
|
|
7589
7647
|
}
|
|
7590
7648
|
function $5dd9d0d3ea82e2dd$export$477caf01aecaeb2a(options) {
|
|
@@ -8247,7 +8305,7 @@ function $3001ad378baf39dc$export$d757d54550ebfb3d(_ref) {
|
|
|
8247
8305
|
} = _ref;
|
|
8248
8306
|
const parentTitle = $3hooq$solidjs.createMemo(() => {
|
|
8249
8307
|
var _category_suggestion_;
|
|
8250
|
-
return (_category_suggestion_ = category_suggestion_().
|
|
8308
|
+
return (_category_suggestion_ = category_suggestion_().ancestors.at(-1)) === null || _category_suggestion_ === void 0 ? void 0 : _category_suggestion_.title;
|
|
8251
8309
|
});
|
|
8252
8310
|
return $3hooq$solidjsweb.ssr($3001ad378baf39dc$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrAttribute("href", $3hooq$solidjsweb.escape(category_suggestion_().page_url, true), false), $3hooq$solidjsweb.escape(category_suggestion_().title), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
8253
8311
|
get when() {
|
|
@@ -8739,7 +8797,7 @@ function $4edbc04f5c5a1843$export$a146ac6fa8346a25(_ref) {
|
|
|
8739
8797
|
currently_showing_suggestions_[1](value => {
|
|
8740
8798
|
value[0] = $3hooq$solidjs.createMemo(() => previous_searches_().map(result => ({
|
|
8741
8799
|
type: (0, $ce079d50d380ee11$export$3cf9497e790da491),
|
|
8742
|
-
|
|
8800
|
+
query: result,
|
|
8743
8801
|
suggestions_result_id: "history"
|
|
8744
8802
|
})));
|
|
8745
8803
|
return value;
|
|
@@ -8807,23 +8865,17 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
8807
8865
|
submit_query_: submit_query_,
|
|
8808
8866
|
get_content_results_: get_content_results_
|
|
8809
8867
|
} = _ref;
|
|
8810
|
-
const queries_memo = $3hooq$solidjs.createMemo(() => suggestion_memo_().filter(
|
|
8811
|
-
let {
|
|
8812
|
-
type: type,
|
|
8813
|
-
title: title
|
|
8814
|
-
} = _ref2;
|
|
8815
|
-
return type === (0, $ce079d50d380ee11$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title);
|
|
8816
|
-
} // don't show the ones we already show from the history
|
|
8868
|
+
const queries_memo = $3hooq$solidjs.createMemo(() => suggestion_memo_().filter(suggestion => suggestion.type === (0, $ce079d50d380ee11$export$3cf9497e790da491) && !filtered_previous_searches_().includes(suggestion.query) // don't show the ones we already show from the history
|
|
8817
8869
|
) // + limit to three query suggestions, API sends more sometimes
|
|
8818
8870
|
.slice(0, 3));
|
|
8819
8871
|
const not_queries_memo = $3hooq$solidjs.createMemo(() => {
|
|
8820
8872
|
// For the section that shows categories and content results
|
|
8821
8873
|
// We want to limit to 3 items, and we want to show the categories first
|
|
8822
8874
|
const content_results = get_content_results_() || [];
|
|
8823
|
-
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(
|
|
8875
|
+
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(_ref2 => {
|
|
8824
8876
|
let {
|
|
8825
8877
|
type: type
|
|
8826
|
-
} =
|
|
8878
|
+
} = _ref2;
|
|
8827
8879
|
return type !== (0, $ce079d50d380ee11$export$3cf9497e790da491);
|
|
8828
8880
|
}) : [];
|
|
8829
8881
|
return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
|
|
@@ -8833,7 +8885,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
8833
8885
|
const is_query = $3hooq$solidjs.createMemo(() => input_obj().type === (0, $ce079d50d380ee11$export$3cf9497e790da491));
|
|
8834
8886
|
const href_with_changed_params_accessor = $3hooq$solidjs.createMemo(() => is_query() ? $77fe1b91e837c071$export$91c3b6774e8be0f5({
|
|
8835
8887
|
param_: search_query_url_param_name_,
|
|
8836
|
-
value_: $3hooq$solidjs.createMemo(() => input_obj().
|
|
8888
|
+
value_: $3hooq$solidjs.createMemo(() => input_obj().query),
|
|
8837
8889
|
url_transformer_: url_transformer_
|
|
8838
8890
|
}) : undefined);
|
|
8839
8891
|
const href = $3hooq$solidjs.createMemo(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
@@ -8842,10 +8894,10 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
8842
8894
|
return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === autocomplete_data_index && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
|
|
8843
8895
|
});
|
|
8844
8896
|
const parent_title_if_exists = $3hooq$solidjs.createMemo(() => {
|
|
8845
|
-
var _item$
|
|
8897
|
+
var _item$ancestors$at;
|
|
8846
8898
|
const item = input_obj();
|
|
8847
|
-
if (!("
|
|
8848
|
-
return (_item$
|
|
8899
|
+
if (!("ancestors" in item)) return;
|
|
8900
|
+
return (_item$ancestors$at = item.ancestors.at(-1)) === null || _item$ancestors$at === void 0 ? void 0 : _item$ancestors$at.title;
|
|
8849
8901
|
});
|
|
8850
8902
|
return $3hooq$solidjsweb.ssr($0677d509ad208e22$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "suggestion ".concat(is_selected() ? "selected" : "", " ").concat(is_history ? "history" : "", " ").concat($3hooq$solidjsweb.escape($3hooq$solidjsweb.escape("type-" + input_obj().type, true), true)), $3hooq$solidjsweb.ssrAttribute("href", $3hooq$solidjsweb.escape(href(), true), false), is_query() ? $3hooq$solidjsweb.escape([$3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
8851
8903
|
when: is_history,
|
|
@@ -8858,7 +8910,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
8858
8910
|
}), $3hooq$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
|
|
8859
8911
|
class_: "value line-clamp",
|
|
8860
8912
|
get whole_text_to_display_() {
|
|
8861
|
-
return $3hooq$solidjs.createMemo(() => input_obj().
|
|
8913
|
+
return $3hooq$solidjs.createMemo(() => input_obj().query);
|
|
8862
8914
|
},
|
|
8863
8915
|
searching_for_value_: searching_for_value_
|
|
8864
8916
|
})]) : $3hooq$solidjsweb.escape([parent_title_if_exists() ? $3hooq$solidjsweb.ssr($0677d509ad208e22$var$_tmpl$4, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
|
|
@@ -8930,7 +8982,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
8930
8982
|
return (() => {
|
|
8931
8983
|
const mapped_history_results = $3hooq$solidjs.createMemo(() => filtered_previous_searches_().map(result => ({
|
|
8932
8984
|
type: (0, $ce079d50d380ee11$export$3cf9497e790da491),
|
|
8933
|
-
|
|
8985
|
+
query: result,
|
|
8934
8986
|
suggestions_result_id: "history" // worthless to fix typing
|
|
8935
8987
|
})));
|
|
8936
8988
|
|
|
@@ -9096,16 +9148,16 @@ function $1a7b2e0cdf65293a$var$actual_navigation_working_on_fake_data(_ref2) {
|
|
|
9096
9148
|
// update text field value if needed
|
|
9097
9149
|
if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "query") {
|
|
9098
9150
|
const {
|
|
9099
|
-
|
|
9151
|
+
query: query
|
|
9100
9152
|
} = selected_entry;
|
|
9101
9153
|
$3hooq$solidjs.runWithOwner(owner, block_updating_for_one_change);
|
|
9102
|
-
set_search_field_value(
|
|
9154
|
+
set_search_field_value(query);
|
|
9103
9155
|
$3hooq$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|
|
9104
9156
|
// Open search query in new tab on cmd+enter
|
|
9105
9157
|
// 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 ;)
|
|
9106
9158
|
const url = new URL(location);
|
|
9107
9159
|
url_transformer_ === null || url_transformer_ === void 0 || url_transformer_(url);
|
|
9108
|
-
url.searchParams.set(search_query_param_name_,
|
|
9160
|
+
url.searchParams.set(search_query_param_name_, query);
|
|
9109
9161
|
return $1730e5b4d47679a3$export$1efe1013da60d0e4(e, url.href);
|
|
9110
9162
|
}));
|
|
9111
9163
|
} else if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "listing" || (selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) === "content") $3hooq$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|
package/server/ES10/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;
|