@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/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$ = /*#__PURE__*/$52FdA$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>`);
|
|
88
88
|
function $9d19451330d04c3c$export$8be2714ec7f169ee() {
|
|
89
89
|
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -5839,6 +5839,69 @@ function $b3dc12c672c9df24$export$967e966fca9515e(api_response) {
|
|
|
5839
5839
|
// Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
|
|
5840
5840
|
const $c3739e86187f2054$export$74ee7529ce0f8a00 = "listingId";
|
|
5841
5841
|
const $c3739e86187f2054$export$5aae649db1b959fc = "externalId";
|
|
5842
|
+
|
|
5843
|
+
/**
|
|
5844
|
+
* 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.
|
|
5845
|
+
*/
|
|
5846
|
+
async function $097d688689209955$export$d9792230b7c0203e(_ref) {
|
|
5847
|
+
let {
|
|
5848
|
+
input_data_: {
|
|
5849
|
+
ancestors: ancestors,
|
|
5850
|
+
children: children,
|
|
5851
|
+
siblings: siblings,
|
|
5852
|
+
...clonedInputData
|
|
5853
|
+
},
|
|
5854
|
+
category_transformer_ = v => v.data,
|
|
5855
|
+
merchant_:
|
|
5856
|
+
// in case no display transformer just pass the data through, so we don't break
|
|
5857
|
+
merchant_,
|
|
5858
|
+
market_: market_,
|
|
5859
|
+
locale_: locale_
|
|
5860
|
+
} = _ref;
|
|
5861
|
+
const breadcrumbs = [];
|
|
5862
|
+
const clonedAncestors = [...ancestors];
|
|
5863
|
+
while (clonedAncestors.length) {
|
|
5864
|
+
const ancestor = clonedAncestors.pop();
|
|
5865
|
+
if (!ancestor.show_in_breadcrumbs) continue;
|
|
5866
|
+
breadcrumbs.push({
|
|
5867
|
+
...ancestor,
|
|
5868
|
+
ancestors: [...clonedAncestors]
|
|
5869
|
+
});
|
|
5870
|
+
}
|
|
5871
|
+
breadcrumbs.reverse();
|
|
5872
|
+
const quicklinksIsChildren = children.length;
|
|
5873
|
+
const quickLinks = (quicklinksIsChildren ? children : siblings).filter(_ref2 => {
|
|
5874
|
+
let {
|
|
5875
|
+
show_in_quicklinks: show_in_quicklinks
|
|
5876
|
+
} = _ref2;
|
|
5877
|
+
return show_in_quicklinks;
|
|
5878
|
+
}).map(productListing => {
|
|
5879
|
+
const ancestorsForUs = [...ancestors];
|
|
5880
|
+
if (quicklinksIsChildren) ancestorsForUs.push({
|
|
5881
|
+
...clonedInputData
|
|
5882
|
+
});
|
|
5883
|
+
return {
|
|
5884
|
+
...productListing,
|
|
5885
|
+
ancestors: ancestorsForUs
|
|
5886
|
+
};
|
|
5887
|
+
});
|
|
5888
|
+
const [transformedBreadcrumbs, transformedQuickLinks] = await Promise.all([category_transformer_({
|
|
5889
|
+
merchant: merchant_,
|
|
5890
|
+
market: market_,
|
|
5891
|
+
locale: locale_,
|
|
5892
|
+
data: breadcrumbs
|
|
5893
|
+
}), category_transformer_({
|
|
5894
|
+
merchant: merchant_,
|
|
5895
|
+
market: market_,
|
|
5896
|
+
locale: locale_,
|
|
5897
|
+
data: quickLinks
|
|
5898
|
+
})]);
|
|
5899
|
+
return {
|
|
5900
|
+
...clonedInputData,
|
|
5901
|
+
breadcrumbs: transformedBreadcrumbs,
|
|
5902
|
+
quick_links: transformedQuickLinks
|
|
5903
|
+
};
|
|
5904
|
+
}
|
|
5842
5905
|
function $e270e9f953fcbc58$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
5843
5906
|
$e270e9f953fcbc58$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
5844
5907
|
privateSet.add(obj);
|
|
@@ -5866,6 +5929,9 @@ var $e270e9f953fcbc58$var$_run_url_creator_for_suggest = /*#__PURE__*/new WeakSe
|
|
|
5866
5929
|
var $e270e9f953fcbc58$var$_run_display_transformers_for_rest = /*#__PURE__*/new WeakSet();
|
|
5867
5930
|
var $e270e9f953fcbc58$var$_cached_request = /*#__PURE__*/new WeakSet();
|
|
5868
5931
|
class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
5932
|
+
/**
|
|
5933
|
+
* rest = everything except query suggestions
|
|
5934
|
+
*/
|
|
5869
5935
|
constructor(options) {
|
|
5870
5936
|
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_cached_request);
|
|
5871
5937
|
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_run_display_transformers_for_rest);
|
|
@@ -5922,7 +5988,7 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
|
5922
5988
|
const decoded_json = await results.json();
|
|
5923
5989
|
if (!Array.isArray(decoded_json === null || decoded_json === void 0 ? void 0 : decoded_json.suggestions)) break attempt_to_return_api_response;
|
|
5924
5990
|
try {
|
|
5925
|
-
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);
|
|
5991
|
+
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);
|
|
5926
5992
|
} catch (e) {
|
|
5927
5993
|
$52FdA$depictaiutilishared.dwarn("displayTransformer failed", e);
|
|
5928
5994
|
}
|
|
@@ -5959,13 +6025,12 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
|
5959
6025
|
fallback_response_: () => ({
|
|
5960
6026
|
listing_id: "",
|
|
5961
6027
|
listing_type: "category",
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
"quick_links": [],
|
|
6028
|
+
title: "",
|
|
6029
|
+
slug: "",
|
|
6030
|
+
show_in_breadcrumbs: false,
|
|
6031
|
+
show_in_quicklinks: false,
|
|
6032
|
+
breadcrumbs: [],
|
|
6033
|
+
quick_links: [],
|
|
5969
6034
|
failed: true
|
|
5970
6035
|
}),
|
|
5971
6036
|
method_: "GET"
|
|
@@ -6012,21 +6077,30 @@ function $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint2(endpoint) {
|
|
|
6012
6077
|
})) : undefined
|
|
6013
6078
|
});
|
|
6014
6079
|
}
|
|
6015
|
-
async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, market, response) {
|
|
6080
|
+
async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, market, locale, response) {
|
|
6016
6081
|
var _this$display_transfo;
|
|
6017
6082
|
const category_transformer = (_this$display_transfo = this.display_transformers) === null || _this$display_transfo === void 0 ? void 0 : _this$display_transfo.categories;
|
|
6018
6083
|
if (!category_transformer) return response;
|
|
6084
|
+
const incoming_suggestions = response.suggestions;
|
|
6085
|
+
const type_to_transform = "listing";
|
|
6019
6086
|
// find category suggestions, run thing with them, and then replace them
|
|
6020
|
-
const category_suggestions =
|
|
6021
|
-
const
|
|
6087
|
+
const category_suggestions = incoming_suggestions.filter(suggestion => suggestion.type === type_to_transform);
|
|
6088
|
+
const transformed_suggestions = [...(await category_transformer({
|
|
6022
6089
|
market: market,
|
|
6023
6090
|
merchant: merchant,
|
|
6091
|
+
locale: locale,
|
|
6024
6092
|
data: [...category_suggestions]
|
|
6025
|
-
});
|
|
6026
|
-
|
|
6093
|
+
}))];
|
|
6094
|
+
// Then add-back query suggestions at their original indices
|
|
6095
|
+
for (let i = 0; i < incoming_suggestions.length; i++) {
|
|
6096
|
+
const item = incoming_suggestions[i];
|
|
6097
|
+
if (item.type === type_to_transform) continue;
|
|
6098
|
+
transformed_suggestions.splice(i, 0, item);
|
|
6099
|
+
}
|
|
6100
|
+
response.suggestions = transformed_suggestions;
|
|
6027
6101
|
return response;
|
|
6028
6102
|
}
|
|
6029
|
-
async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, input_data) {
|
|
6103
|
+
async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, locale, input_data) {
|
|
6030
6104
|
const {
|
|
6031
6105
|
display_transformers: display_transformers
|
|
6032
6106
|
} = this;
|
|
@@ -6042,25 +6116,24 @@ async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchan
|
|
|
6042
6116
|
const transformed_displays = await product_transformer({
|
|
6043
6117
|
merchant: merchant,
|
|
6044
6118
|
market: market,
|
|
6119
|
+
locale: locale,
|
|
6045
6120
|
displays: [...displays]
|
|
6046
6121
|
});
|
|
6047
6122
|
input_data.displays = transformed_displays;
|
|
6048
6123
|
}
|
|
6049
|
-
if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
|
|
6050
|
-
const category_display_array = input_data[key];
|
|
6051
|
-
if (!category_display_array) continue;
|
|
6052
|
-
const transformed_category_displays = await category_transformer({
|
|
6053
|
-
merchant: merchant,
|
|
6054
|
-
market: market,
|
|
6055
|
-
data: [...category_display_array]
|
|
6056
|
-
});
|
|
6057
|
-
input_data[key] = transformed_category_displays;
|
|
6058
|
-
}
|
|
6059
6124
|
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({
|
|
6060
6125
|
merchant: merchant,
|
|
6061
6126
|
market: market,
|
|
6127
|
+
locale: locale,
|
|
6062
6128
|
data: [...content_search_links]
|
|
6063
6129
|
});
|
|
6130
|
+
if (input_data.ancestors) return await $097d688689209955$export$d9792230b7c0203e({
|
|
6131
|
+
input_data_: input_data,
|
|
6132
|
+
category_transformer_: category_transformer,
|
|
6133
|
+
merchant_: merchant,
|
|
6134
|
+
market_: market,
|
|
6135
|
+
locale_: locale
|
|
6136
|
+
});
|
|
6064
6137
|
return input_data;
|
|
6065
6138
|
}
|
|
6066
6139
|
async function $e270e9f953fcbc58$var$_cached_request2(_ref3) {
|
|
@@ -6099,7 +6172,7 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref3) {
|
|
|
6099
6172
|
let result;
|
|
6100
6173
|
try {
|
|
6101
6174
|
const unmodified_result = await api_response.json();
|
|
6102
|
-
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);
|
|
6175
|
+
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);
|
|
6103
6176
|
} catch (e) {
|
|
6104
6177
|
$52FdA$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
6105
6178
|
break return_successfully;
|
|
@@ -8848,7 +8921,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
8848
8921
|
var _plp_meta;
|
|
8849
8922
|
return (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.title;
|
|
8850
8923
|
});
|
|
8851
|
-
const crumb_data_ = $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta
|
|
8924
|
+
const crumb_data_ = $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta);
|
|
8852
8925
|
const quicklinks_data_ = $52FdA$solidjs.createMemo(() => {
|
|
8853
8926
|
var _plp_meta2;
|
|
8854
8927
|
return (_plp_meta2 = plp_meta()) === null || _plp_meta2 === void 0 ? void 0 : _plp_meta2.quick_links;
|
|
@@ -9138,32 +9211,17 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
|
|
|
9138
9211
|
/**
|
|
9139
9212
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
9140
9213
|
*/
|
|
9141
|
-
function $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta
|
|
9214
|
+
function $ede6c70ecdca46fe$var$add_us_to_crumbs(plp_meta) {
|
|
9142
9215
|
const href_accessor = $52FdA$depictaiutilisharedlatest.use_href_accessor();
|
|
9143
9216
|
return $52FdA$solidjs.createMemo(() => {
|
|
9144
9217
|
var _plp_meta3;
|
|
9145
9218
|
const api_value = (_plp_meta3 = plp_meta()) === null || _plp_meta3 === void 0 ? void 0 : _plp_meta3.breadcrumbs;
|
|
9146
9219
|
if (!api_value) return api_value;
|
|
9147
|
-
return [...api_value, {
|
|
9148
|
-
get listing_id() {
|
|
9149
|
-
return plp_meta().listing_id;
|
|
9150
|
-
},
|
|
9151
|
-
get title() {
|
|
9152
|
-
return title();
|
|
9153
|
-
},
|
|
9220
|
+
return [...api_value, $52FdA$solidjs.mergeProps(plp_meta(), {
|
|
9154
9221
|
get page_url() {
|
|
9155
9222
|
return href_accessor();
|
|
9156
|
-
},
|
|
9157
|
-
get slug() {
|
|
9158
|
-
return plp_meta().slug;
|
|
9159
|
-
},
|
|
9160
|
-
get listing_type() {
|
|
9161
|
-
return plp_meta().listing_type;
|
|
9162
|
-
},
|
|
9163
|
-
get external_id() {
|
|
9164
|
-
return plp_meta().external_id;
|
|
9165
9223
|
}
|
|
9166
|
-
}];
|
|
9224
|
+
})];
|
|
9167
9225
|
});
|
|
9168
9226
|
}
|
|
9169
9227
|
function $5dd9d0d3ea82e2dd$export$477caf01aecaeb2a(options) {
|
|
@@ -9854,7 +9912,7 @@ function $3001ad378baf39dc$export$d757d54550ebfb3d(_ref) {
|
|
|
9854
9912
|
} = _ref;
|
|
9855
9913
|
const parentTitle = $52FdA$solidjs.createMemo(() => {
|
|
9856
9914
|
var _category_suggestion_;
|
|
9857
|
-
return (_category_suggestion_ = category_suggestion_().
|
|
9915
|
+
return (_category_suggestion_ = category_suggestion_().ancestors.at(-1)) === null || _category_suggestion_ === void 0 ? void 0 : _category_suggestion_.title;
|
|
9858
9916
|
});
|
|
9859
9917
|
return (() => {
|
|
9860
9918
|
const _el$ = $52FdA$solidjsweb.getNextElement($3001ad378baf39dc$var$_tmpl$2),
|
|
@@ -10585,7 +10643,7 @@ function $4edbc04f5c5a1843$export$a146ac6fa8346a25(_ref) {
|
|
|
10585
10643
|
currently_showing_suggestions_[1](value => {
|
|
10586
10644
|
value[0] = $52FdA$solidjs.createMemo(() => previous_searches_().map(result => ({
|
|
10587
10645
|
type: (0, $ce079d50d380ee11$export$3cf9497e790da491),
|
|
10588
|
-
|
|
10646
|
+
query: result,
|
|
10589
10647
|
suggestions_result_id: "history"
|
|
10590
10648
|
})));
|
|
10591
10649
|
return value;
|
|
@@ -10710,23 +10768,17 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10710
10768
|
submit_query_: submit_query_,
|
|
10711
10769
|
get_content_results_: get_content_results_
|
|
10712
10770
|
} = _ref;
|
|
10713
|
-
const queries_memo = $52FdA$solidjs.createMemo(() => suggestion_memo_().filter(
|
|
10714
|
-
let {
|
|
10715
|
-
type: type,
|
|
10716
|
-
title: title
|
|
10717
|
-
} = _ref2;
|
|
10718
|
-
return type === (0, $ce079d50d380ee11$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title);
|
|
10719
|
-
} // don't show the ones we already show from the history
|
|
10771
|
+
const queries_memo = $52FdA$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
|
|
10720
10772
|
) // + limit to three query suggestions, API sends more sometimes
|
|
10721
10773
|
.slice(0, 3));
|
|
10722
10774
|
const not_queries_memo = $52FdA$solidjs.createMemo(() => {
|
|
10723
10775
|
// For the section that shows categories and content results
|
|
10724
10776
|
// We want to limit to 3 items, and we want to show the categories first
|
|
10725
10777
|
const content_results = get_content_results_() || [];
|
|
10726
|
-
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(
|
|
10778
|
+
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(_ref2 => {
|
|
10727
10779
|
let {
|
|
10728
10780
|
type: type
|
|
10729
|
-
} =
|
|
10781
|
+
} = _ref2;
|
|
10730
10782
|
return type !== (0, $ce079d50d380ee11$export$3cf9497e790da491);
|
|
10731
10783
|
}) : [];
|
|
10732
10784
|
return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
|
|
@@ -10736,7 +10788,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10736
10788
|
const is_query = $52FdA$solidjs.createMemo(() => input_obj().type === (0, $ce079d50d380ee11$export$3cf9497e790da491));
|
|
10737
10789
|
const href_with_changed_params_accessor = $52FdA$solidjs.createMemo(() => is_query() ? $77fe1b91e837c071$export$91c3b6774e8be0f5({
|
|
10738
10790
|
param_: search_query_url_param_name_,
|
|
10739
|
-
value_: $52FdA$solidjs.createMemo(() => input_obj().
|
|
10791
|
+
value_: $52FdA$solidjs.createMemo(() => input_obj().query),
|
|
10740
10792
|
url_transformer_: url_transformer_
|
|
10741
10793
|
}) : undefined);
|
|
10742
10794
|
const href = $52FdA$solidjs.createMemo(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
@@ -10745,10 +10797,10 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10745
10797
|
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;
|
|
10746
10798
|
});
|
|
10747
10799
|
const parent_title_if_exists = $52FdA$solidjs.createMemo(() => {
|
|
10748
|
-
var _item$
|
|
10800
|
+
var _item$ancestors$at;
|
|
10749
10801
|
const item = input_obj();
|
|
10750
|
-
if (!("
|
|
10751
|
-
return (_item$
|
|
10802
|
+
if (!("ancestors" in item)) return;
|
|
10803
|
+
return (_item$ancestors$at = item.ancestors.at(-1)) === null || _item$ancestors$at === void 0 ? void 0 : _item$ancestors$at.title;
|
|
10752
10804
|
});
|
|
10753
10805
|
return (() => {
|
|
10754
10806
|
const _el$ = $52FdA$solidjsweb.getNextElement($0677d509ad208e22$var$_tmpl$);
|
|
@@ -10758,8 +10810,9 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10758
10810
|
if (ev.button || ev.metaKey || ev.ctrlKey)
|
|
10759
10811
|
// not button 0 or cmd/ctrl click
|
|
10760
10812
|
return;
|
|
10813
|
+
const input = input_obj();
|
|
10761
10814
|
ev.preventDefault();
|
|
10762
|
-
submit_query_(
|
|
10815
|
+
submit_query_(is_query() ? input.query : input.title);
|
|
10763
10816
|
return;
|
|
10764
10817
|
}
|
|
10765
10818
|
router_.navigate_.go_to_({
|
|
@@ -10787,7 +10840,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10787
10840
|
}), $52FdA$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
|
|
10788
10841
|
class_: "value line-clamp",
|
|
10789
10842
|
get whole_text_to_display_() {
|
|
10790
|
-
return $52FdA$solidjs.createMemo(() => input_obj().
|
|
10843
|
+
return $52FdA$solidjs.createMemo(() => input_obj().query);
|
|
10791
10844
|
},
|
|
10792
10845
|
searching_for_value_: searching_for_value_
|
|
10793
10846
|
})] : [$52FdA$solidjsweb.memo((() => {
|
|
@@ -10918,7 +10971,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10918
10971
|
return (() => {
|
|
10919
10972
|
const mapped_history_results = $52FdA$solidjs.createMemo(() => filtered_previous_searches_().map(result => ({
|
|
10920
10973
|
type: (0, $ce079d50d380ee11$export$3cf9497e790da491),
|
|
10921
|
-
|
|
10974
|
+
query: result,
|
|
10922
10975
|
suggestions_result_id: "history" // worthless to fix typing
|
|
10923
10976
|
})));
|
|
10924
10977
|
|
|
@@ -11095,16 +11148,16 @@ function $1a7b2e0cdf65293a$var$actual_navigation_working_on_fake_data(_ref2) {
|
|
|
11095
11148
|
// update text field value if needed
|
|
11096
11149
|
if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "query") {
|
|
11097
11150
|
const {
|
|
11098
|
-
|
|
11151
|
+
query: query
|
|
11099
11152
|
} = selected_entry;
|
|
11100
11153
|
$52FdA$solidjs.runWithOwner(owner, block_updating_for_one_change);
|
|
11101
|
-
set_search_field_value(
|
|
11154
|
+
set_search_field_value(query);
|
|
11102
11155
|
$52FdA$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|
|
11103
11156
|
// Open search query in new tab on cmd+enter
|
|
11104
11157
|
// 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 ;)
|
|
11105
11158
|
const url = new URL(location);
|
|
11106
11159
|
url_transformer_ === null || url_transformer_ === void 0 || url_transformer_(url);
|
|
11107
|
-
url.searchParams.set(search_query_param_name_,
|
|
11160
|
+
url.searchParams.set(search_query_param_name_, query);
|
|
11108
11161
|
return $1730e5b4d47679a3$export$1efe1013da60d0e4(e, url.href);
|
|
11109
11162
|
}));
|
|
11110
11163
|
} 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") $52FdA$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|
package/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;
|