@depict-ai/ui 3.0.1 → 3.0.3
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 +38 -85
- package/ES10/index.d.ts +21 -88
- package/ES10/index.js +38 -85
- package/latest/index.cjs +34 -82
- package/latest/index.d.ts +21 -88
- package/latest/index.js +34 -82
- package/package.json +1 -1
- package/server/ES10/index.cjs +38 -85
- package/server/ES10/index.d.ts +21 -88
- package/server/ES10/index.js +38 -85
- package/server/latest/index.cjs +34 -82
- package/server/latest/index.d.ts +21 -88
- package/server/latest/index.js +34 -82
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.3";
|
|
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] : {};
|
|
@@ -5853,7 +5853,6 @@ var $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint = /*#__PURE__*/new WeakSet
|
|
|
5853
5853
|
var $e270e9f953fcbc58$var$_add_ids_to_request = /*#__PURE__*/new WeakMap();
|
|
5854
5854
|
var $e270e9f953fcbc58$var$_get_metadata = /*#__PURE__*/new WeakMap();
|
|
5855
5855
|
var $e270e9f953fcbc58$var$_get_session_id = /*#__PURE__*/new WeakMap();
|
|
5856
|
-
var $e270e9f953fcbc58$var$_guard_url_creator_length = /*#__PURE__*/new WeakSet();
|
|
5857
5856
|
var $e270e9f953fcbc58$var$_run_url_creator_for_suggest = /*#__PURE__*/new WeakSet();
|
|
5858
5857
|
var $e270e9f953fcbc58$var$_run_display_transformers_for_rest = /*#__PURE__*/new WeakSet();
|
|
5859
5858
|
var $e270e9f953fcbc58$var$_cached_request = /*#__PURE__*/new WeakSet();
|
|
@@ -5862,9 +5861,7 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
|
5862
5861
|
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_cached_request);
|
|
5863
5862
|
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_run_display_transformers_for_rest);
|
|
5864
5863
|
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_run_url_creator_for_suggest);
|
|
5865
|
-
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_guard_url_creator_length);
|
|
5866
5864
|
$e270e9f953fcbc58$var$_classPrivateMethodInitSpec(this, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint);
|
|
5867
|
-
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "page_url_creator", void 0);
|
|
5868
5865
|
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "display_transformers", void 0);
|
|
5869
5866
|
$e270e9f953fcbc58$var$_classPrivateFieldInitSpec(this, $e270e9f953fcbc58$var$_supports_finalization_registry, {
|
|
5870
5867
|
writable: true,
|
|
@@ -5896,18 +5893,15 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
|
5896
5893
|
const {
|
|
5897
5894
|
get_metadata: get_metadata,
|
|
5898
5895
|
get_session_id: _get_session_id2,
|
|
5899
|
-
page_url_creator: _page_url_creator,
|
|
5900
5896
|
display_transformers: _display_transformers
|
|
5901
5897
|
} = options !== null && options !== void 0 ? options : {};
|
|
5902
5898
|
$parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldSet)(this, $e270e9f953fcbc58$var$_get_metadata, get_metadata);
|
|
5903
5899
|
$parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldSet)(this, $e270e9f953fcbc58$var$_get_session_id, _get_session_id2);
|
|
5904
|
-
this.page_url_creator = _page_url_creator;
|
|
5905
5900
|
this.display_transformers = _display_transformers;
|
|
5906
5901
|
}
|
|
5907
5902
|
async suggest(input_req) {
|
|
5908
5903
|
var _classPrivateFieldGet3;
|
|
5909
5904
|
const with_ids = $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $e270e9f953fcbc58$var$_add_ids_to_request).call(this, input_req);
|
|
5910
|
-
const owner = $52FdA$solidjs.getOwner();
|
|
5911
5905
|
const metaData = await ((_classPrivateFieldGet3 = $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $e270e9f953fcbc58$var$_get_metadata)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.call(this));
|
|
5912
5906
|
const request = metaData ? Object.assign(with_ids, {
|
|
5913
5907
|
metadata: JSON.stringify(metaData)
|
|
@@ -5919,7 +5913,7 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
|
|
|
5919
5913
|
const decoded_json = await results.json();
|
|
5920
5914
|
if (!Array.isArray(decoded_json === null || decoded_json === void 0 ? void 0 : decoded_json.suggestions)) break attempt_to_return_api_response;
|
|
5921
5915
|
try {
|
|
5922
|
-
return await $
|
|
5916
|
+
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);
|
|
5923
5917
|
} catch (e) {
|
|
5924
5918
|
$52FdA$depictaiutilishared.dwarn("displayTransformer failed", e);
|
|
5925
5919
|
}
|
|
@@ -6006,101 +6000,55 @@ function $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint2(endpoint) {
|
|
|
6006
6000
|
})) : undefined
|
|
6007
6001
|
});
|
|
6008
6002
|
}
|
|
6009
|
-
function $e270e9f953fcbc58$var$_guard_url_creator_length2(expected, received) {
|
|
6010
|
-
if (expected.length !== received.length) {
|
|
6011
|
-
const e = new Error("displayTransformer returned wrong number of page URLs, got " + received.length + ", expected " + expected.length);
|
|
6012
|
-
queueMicrotask(() => {
|
|
6013
|
-
throw e;
|
|
6014
|
-
});
|
|
6015
|
-
throw e;
|
|
6016
|
-
}
|
|
6017
|
-
}
|
|
6018
6003
|
async function $e270e9f953fcbc58$var$_run_url_creator_for_suggest2(merchant, market, response) {
|
|
6019
6004
|
var _this$display_transfo;
|
|
6020
|
-
const page_url_creator = this.page_url_creator;
|
|
6021
6005
|
const category_transformer = (_this$display_transfo = this.display_transformers) === null || _this$display_transfo === void 0 ? void 0 : _this$display_transfo.categories;
|
|
6022
|
-
if (!
|
|
6006
|
+
if (!category_transformer) return response;
|
|
6023
6007
|
// find category suggestions, run thing with them, and then replace them
|
|
6024
6008
|
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
|
|
6025
|
-
const
|
|
6009
|
+
const transformed_category_suggestions = await category_transformer({
|
|
6026
6010
|
market: market,
|
|
6027
6011
|
merchant: merchant,
|
|
6028
|
-
data: [...category_suggestions]
|
|
6029
|
-
...(page_url_creator ? {
|
|
6030
|
-
type: "categories"
|
|
6031
|
-
} : {})
|
|
6012
|
+
data: [...category_suggestions]
|
|
6032
6013
|
});
|
|
6033
|
-
|
|
6034
|
-
while (page_urls.length)
|
|
6035
|
-
// Copy over getters so we sneakily can make this reactive
|
|
6036
|
-
Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
|
|
6014
|
+
response.suggestions = transformed_category_suggestions;
|
|
6037
6015
|
return response;
|
|
6038
6016
|
}
|
|
6039
6017
|
async function $e270e9f953fcbc58$var$_run_display_transformers_for_rest2(merchant, market, input_data) {
|
|
6040
6018
|
const {
|
|
6041
|
-
page_url_creator: page_url_creator,
|
|
6042
6019
|
display_transformers: display_transformers
|
|
6043
6020
|
} = this;
|
|
6044
|
-
if (!
|
|
6021
|
+
if (!display_transformers) return input_data;
|
|
6045
6022
|
const product_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.products;
|
|
6046
6023
|
const category_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.categories;
|
|
6047
6024
|
const content_result_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.contentResults;
|
|
6048
6025
|
const displays = input_data.displays;
|
|
6049
|
-
const owner = $52FdA$solidjs.getOwner();
|
|
6050
6026
|
const {
|
|
6051
|
-
breadcrumbs: breadcrumbs,
|
|
6052
|
-
quick_links: quick_links,
|
|
6053
6027
|
content_search_links: content_search_links
|
|
6054
6028
|
} = input_data;
|
|
6055
|
-
if (displays &&
|
|
6056
|
-
const
|
|
6029
|
+
if (displays && product_transformer) {
|
|
6030
|
+
const transformed_displays = await product_transformer({
|
|
6057
6031
|
merchant: merchant,
|
|
6058
6032
|
market: market,
|
|
6059
|
-
displays: [...
|
|
6060
|
-
...(page_url_creator ? {
|
|
6061
|
-
type: "products"
|
|
6062
|
-
} : {})
|
|
6033
|
+
displays: [...displays]
|
|
6063
6034
|
});
|
|
6064
|
-
|
|
6065
|
-
for (let i = 0; i < displays.length; i++) {
|
|
6066
|
-
const new_display_or_page_url = page_urls[i];
|
|
6067
|
-
const old_display = displays[i];
|
|
6068
|
-
if ("page_url" in new_display_or_page_url && Object.keys(new_display_or_page_url).length === 1) {
|
|
6069
|
-
// they only returned page_url, let's put it into the display
|
|
6070
|
-
const old_display_was_modern = ("variant_index" in old_display);
|
|
6071
|
-
if (old_display_was_modern) {
|
|
6072
|
-
const variant_displays = old_display.variant_displays;
|
|
6073
|
-
for (let i = 0; i < variant_displays.length; i++) variant_displays[i].page_url = new_display_or_page_url.page_url;
|
|
6074
|
-
} else old_display.page_url = new_display_or_page_url.page_url;
|
|
6075
|
-
} else
|
|
6076
|
-
// We got a whole new display, let's replace it
|
|
6077
|
-
displays[i] = new_display_or_page_url;
|
|
6078
|
-
}
|
|
6035
|
+
input_data.displays = transformed_displays;
|
|
6079
6036
|
}
|
|
6080
|
-
if (
|
|
6037
|
+
if (category_transformer) for (const key of ["breadcrumbs", "quick_links"]) {
|
|
6038
|
+
const category_display_array = input_data[key];
|
|
6081
6039
|
if (!category_display_array) continue;
|
|
6082
|
-
const
|
|
6083
|
-
merchant: merchant,
|
|
6084
|
-
market: market,
|
|
6085
|
-
data: [...category_display_array],
|
|
6086
|
-
...(page_url_creator ? {
|
|
6087
|
-
type: "categories"
|
|
6088
|
-
} : {})
|
|
6089
|
-
}));
|
|
6090
|
-
$e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_guard_url_creator_length, $e270e9f953fcbc58$var$_guard_url_creator_length2).call(this, category_display_array, page_urls);
|
|
6091
|
-
for (let i = 0; i < category_display_array.length; i++)
|
|
6092
|
-
// Copy over getters so we sneakily can make this reactive
|
|
6093
|
-
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
6094
|
-
}
|
|
6095
|
-
if (content_search_links !== null && content_search_links !== void 0 && content_search_links.length && content_result_transformer) {
|
|
6096
|
-
const result = await $52FdA$solidjs.runWithOwner(owner, () => content_result_transformer({
|
|
6040
|
+
const transformed_category_displays = await category_transformer({
|
|
6097
6041
|
merchant: merchant,
|
|
6098
6042
|
market: market,
|
|
6099
|
-
data: [...
|
|
6100
|
-
})
|
|
6101
|
-
|
|
6102
|
-
input_data.content_search_links = result;
|
|
6043
|
+
data: [...category_display_array]
|
|
6044
|
+
});
|
|
6045
|
+
input_data[key] = transformed_category_displays;
|
|
6103
6046
|
}
|
|
6047
|
+
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({
|
|
6048
|
+
merchant: merchant,
|
|
6049
|
+
market: market,
|
|
6050
|
+
data: [...content_search_links]
|
|
6051
|
+
});
|
|
6104
6052
|
return input_data;
|
|
6105
6053
|
}
|
|
6106
6054
|
async function $e270e9f953fcbc58$var$_cached_request2(_ref) {
|
|
@@ -6114,7 +6062,6 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref) {
|
|
|
6114
6062
|
} = _ref;
|
|
6115
6063
|
const cache_obj = $e270e9f953fcbc58$var$_classPrivateMethodGet(this, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint, $e270e9f953fcbc58$var$_get_cache_obj_for_endpoint2).call(this, endpoint_);
|
|
6116
6064
|
const with_ids = $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $e270e9f953fcbc58$var$_add_ids_to_request).call(this, input_req_);
|
|
6117
|
-
const owner = $52FdA$solidjs.getOwner();
|
|
6118
6065
|
const metaData = await ((_classPrivateFieldGet5 = $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $e270e9f953fcbc58$var$_get_metadata)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.call(this));
|
|
6119
6066
|
const request = metaData ? Object.assign(with_ids, {
|
|
6120
6067
|
metadata: metaData
|
|
@@ -6142,7 +6089,7 @@ async function $e270e9f953fcbc58$var$_cached_request2(_ref) {
|
|
|
6142
6089
|
let result;
|
|
6143
6090
|
try {
|
|
6144
6091
|
const unmodified_result = await api_response.json();
|
|
6145
|
-
result = await $
|
|
6092
|
+
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);
|
|
6146
6093
|
} catch (e) {
|
|
6147
6094
|
$52FdA$depictaiutilishared.dwarn("displayTransformer or json decoding failed", e);
|
|
6148
6095
|
break return_successfully;
|
|
@@ -9462,7 +9409,6 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
|
|
|
9462
9409
|
let {
|
|
9463
9410
|
api: api,
|
|
9464
9411
|
on_navigation: on_navigation,
|
|
9465
|
-
page_url_creator: page_url_creator,
|
|
9466
9412
|
display_transformers: display_transformers,
|
|
9467
9413
|
unique_instance_key_for_state = "",
|
|
9468
9414
|
listing_id_state_key: listing_id_state_key,
|
|
@@ -9541,7 +9487,6 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
|
|
|
9541
9487
|
reset_history_state_: reset_history_state_,
|
|
9542
9488
|
// @ts-ignore
|
|
9543
9489
|
depict_api_: api !== null && api !== void 0 ? api : new (0, $e270e9f953fcbc58$export$e015ed2f2950f2e3)({
|
|
9544
|
-
page_url_creator: page_url_creator,
|
|
9545
9490
|
display_transformers: display_transformers
|
|
9546
9491
|
}),
|
|
9547
9492
|
router_: $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $9cbefc32b9dab36d$var$_router),
|
|
@@ -9896,6 +9841,10 @@ function $3001ad378baf39dc$export$d757d54550ebfb3d(_ref) {
|
|
|
9896
9841
|
category_suggestion_: category_suggestion_,
|
|
9897
9842
|
router_: router_
|
|
9898
9843
|
} = _ref;
|
|
9844
|
+
const parentTitle = $52FdA$solidjs.createMemo(() => {
|
|
9845
|
+
var _category_suggestion_;
|
|
9846
|
+
return (_category_suggestion_ = category_suggestion_().breadcrumbs.at(-1)) === null || _category_suggestion_ === void 0 ? void 0 : _category_suggestion_.title;
|
|
9847
|
+
});
|
|
9899
9848
|
return (() => {
|
|
9900
9849
|
const _el$ = $52FdA$solidjsweb.getNextElement($3001ad378baf39dc$var$_tmpl$2),
|
|
9901
9850
|
_el$2 = _el$.firstChild,
|
|
@@ -9911,11 +9860,11 @@ function $3001ad378baf39dc$export$d757d54550ebfb3d(_ref) {
|
|
|
9911
9860
|
$52FdA$solidjsweb.insert(_el$2, () => category_suggestion_().title);
|
|
9912
9861
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
9913
9862
|
get when() {
|
|
9914
|
-
return
|
|
9863
|
+
return parentTitle();
|
|
9915
9864
|
},
|
|
9916
9865
|
get children() {
|
|
9917
9866
|
const _el$3 = $52FdA$solidjsweb.getNextElement($3001ad378baf39dc$var$_tmpl$);
|
|
9918
|
-
$52FdA$solidjsweb.insert(_el$3,
|
|
9867
|
+
$52FdA$solidjsweb.insert(_el$3, parentTitle);
|
|
9919
9868
|
return _el$3;
|
|
9920
9869
|
}
|
|
9921
9870
|
}), _el$5, _co$);
|
|
@@ -10784,6 +10733,12 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10784
10733
|
var _read_selected_index_, _read_selected_index_2;
|
|
10785
10734
|
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;
|
|
10786
10735
|
});
|
|
10736
|
+
const parent_title_if_exists = $52FdA$solidjs.createMemo(() => {
|
|
10737
|
+
var _item$breadcrumbs$at;
|
|
10738
|
+
const item = input_obj();
|
|
10739
|
+
if (!("breadcrumbs" in item)) return;
|
|
10740
|
+
return (_item$breadcrumbs$at = item.breadcrumbs.at(-1)) === null || _item$breadcrumbs$at === void 0 ? void 0 : _item$breadcrumbs$at.title;
|
|
10741
|
+
});
|
|
10787
10742
|
return (() => {
|
|
10788
10743
|
const _el$ = $52FdA$solidjsweb.getNextElement($0677d509ad208e22$var$_tmpl$);
|
|
10789
10744
|
$52FdA$solidjsweb.use(element => element.addEventListener("click", $52FdA$depictaiutilishared.catchify(ev => {
|
|
@@ -10825,7 +10780,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10825
10780
|
},
|
|
10826
10781
|
searching_for_value_: searching_for_value_
|
|
10827
10782
|
})] : [$52FdA$solidjsweb.memo((() => {
|
|
10828
|
-
const _c$2 = $52FdA$solidjsweb.memo(() =>
|
|
10783
|
+
const _c$2 = $52FdA$solidjsweb.memo(() => !!parent_title_if_exists());
|
|
10829
10784
|
return () => _c$2() ? (() => {
|
|
10830
10785
|
const _el$4 = $52FdA$solidjsweb.getNextElement($0677d509ad208e22$var$_tmpl$4),
|
|
10831
10786
|
_el$6 = _el$4.firstChild,
|
|
@@ -10838,7 +10793,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10838
10793
|
},
|
|
10839
10794
|
searching_for_value_: searching_for_value_
|
|
10840
10795
|
}), _el$7, _co$);
|
|
10841
|
-
$52FdA$solidjsweb.insert(_el$5,
|
|
10796
|
+
$52FdA$solidjsweb.insert(_el$5, parent_title_if_exists);
|
|
10842
10797
|
return _el$4;
|
|
10843
10798
|
})() : (() => {
|
|
10844
10799
|
const _c$3 = $52FdA$solidjsweb.memo(() => input_obj().type === "content");
|
|
@@ -10872,7 +10827,7 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
|
|
|
10872
10827
|
const _el$3 = $52FdA$solidjsweb.getNextElement($0677d509ad208e22$var$_tmpl$3);
|
|
10873
10828
|
$52FdA$solidjsweb.insert(_el$3, $52FdA$solidjs.createMemo(() => {
|
|
10874
10829
|
if (input_obj().type === "content") return i18n_.content_();
|
|
10875
|
-
if (input_obj().category_type === "
|
|
10830
|
+
if (input_obj().category_type === "brand") return i18n_.brand_();
|
|
10876
10831
|
return i18n_.category_();
|
|
10877
10832
|
}));
|
|
10878
10833
|
return _el$3;
|
|
@@ -12596,7 +12551,6 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
|
|
|
12596
12551
|
url_transformer: url_transformer,
|
|
12597
12552
|
on_navigation: on_navigation,
|
|
12598
12553
|
enable_category_suggestions = true,
|
|
12599
|
-
page_url_creator: page_url_creator,
|
|
12600
12554
|
display_transformers: display_transformers,
|
|
12601
12555
|
api: api,
|
|
12602
12556
|
// Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
@@ -12675,7 +12629,6 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
|
|
|
12675
12629
|
});
|
|
12676
12630
|
// @ts-ignore
|
|
12677
12631
|
const depict_api_ = api !== null && api !== void 0 ? api : new (0, $e270e9f953fcbc58$export$e015ed2f2950f2e3)({
|
|
12678
|
-
page_url_creator: page_url_creator,
|
|
12679
12632
|
display_transformers: display_transformers
|
|
12680
12633
|
});
|
|
12681
12634
|
const previous_searches = $cfeb65948dbdcaab$export$84bba84a7b837187(get_search_query_);
|
package/ES10/index.d.ts
CHANGED
|
@@ -2,16 +2,15 @@ import { JSX, Signal, Accessor, Setter } from "solid-js";
|
|
|
2
2
|
import { Amazing_Slider, Node_Array, Display, report, ColsAtSize, Elem, ModernDisplay } from "@depict-ai/utilishared/ES10";
|
|
3
3
|
import { SearchFilter, SortModel, SearchRequestV3 } from "@depict-ai/types/api/SearchRequestV3";
|
|
4
4
|
import { SearchFilter as _SearchFilter1, ContentLink, SearchResponse } from "@depict-ai/types/api/SearchResponse";
|
|
5
|
-
import { CategorySuggestion } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
5
|
+
import { CategorySuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
6
6
|
import { Breadcrumb, Quicklink, GetListingResponse } from "@depict-ai/types/api/GetListingResponse";
|
|
7
|
-
import { LegacyCategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/api/SearchSuggestionsResponse";
|
|
8
7
|
import { ProductListingResponseV3 } from "@depict-ai/types/api/ProductListingResponseV3";
|
|
9
8
|
import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
|
|
10
9
|
import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequestV3";
|
|
11
10
|
import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
12
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
13
12
|
import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
|
|
14
|
-
export const version = "3.0.
|
|
13
|
+
export const version = "3.0.3";
|
|
15
14
|
/** @jsxImportSource solid-js */
|
|
16
15
|
export function GenericSliderArrowButton(props?: {
|
|
17
16
|
width_?: number;
|
|
@@ -603,56 +602,23 @@ export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDispla
|
|
|
603
602
|
products?: (options: DisplayTransformerAlwaysThereData & {
|
|
604
603
|
displays: InputDisplay[];
|
|
605
604
|
}) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
|
|
606
|
-
categories?: (options: DisplayTransformerAlwaysThereData & {
|
|
607
|
-
data:
|
|
608
|
-
}) => CanBePromiseWrapped<{
|
|
605
|
+
categories?: <T extends Breadcrumb | Quicklink | CategorySuggestion>(options: DisplayTransformerAlwaysThereData & {
|
|
606
|
+
data: T[];
|
|
607
|
+
}) => CanBePromiseWrapped<(T & {
|
|
609
608
|
page_url: string;
|
|
610
|
-
}[]>;
|
|
609
|
+
})[]>;
|
|
611
610
|
contentResults?: (options: DisplayTransformerAlwaysThereData & {
|
|
612
611
|
data: ContentLink[];
|
|
613
612
|
}) => CanBePromiseWrapped<ContentLink[]>;
|
|
614
613
|
};
|
|
615
|
-
export type
|
|
616
|
-
page_url_creator?: PageURLCreator<InputDisplay, OutputDisplay>;
|
|
617
|
-
display_transformers?: never;
|
|
618
|
-
} | {
|
|
619
|
-
page_url_creator?: never;
|
|
614
|
+
export type SomethingTakingADisplayTransformers<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = InputDisplay extends ModernDisplay ? "page_url" extends keyof InputDisplay["variant_displays"][number] ? {
|
|
620
615
|
display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
|
|
621
616
|
} : {
|
|
622
|
-
page_url_creator: PageURLCreator<InputDisplay, OutputDisplay>;
|
|
623
|
-
display_transformers?: never;
|
|
624
|
-
} | {
|
|
625
617
|
display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
|
|
626
|
-
page_url_creator?: never;
|
|
627
618
|
} : {
|
|
628
619
|
page_url_creator?: never;
|
|
629
620
|
display_transformers?: never;
|
|
630
621
|
};
|
|
631
|
-
type PageURLCreatorAlwaysThereData = {
|
|
632
|
-
merchant: string;
|
|
633
|
-
market: string;
|
|
634
|
-
};
|
|
635
|
-
type PageURLCreatorCategoryData = {
|
|
636
|
-
type: "categories";
|
|
637
|
-
data: (Breadcrumb | Quicklink | CategorySuggestion)[];
|
|
638
|
-
};
|
|
639
|
-
type PageURLCreatorProductData<T extends ModernDisplay> = {
|
|
640
|
-
displays: T[];
|
|
641
|
-
type: "products";
|
|
642
|
-
};
|
|
643
|
-
type PageURLCreatorOptions<InputDisplay extends ModernDisplay> = PageURLCreatorAlwaysThereData & (PageURLCreatorCategoryData | PageURLCreatorProductData<InputDisplay>);
|
|
644
|
-
/**
|
|
645
|
-
* @deprecated use DisplayTransformers instead
|
|
646
|
-
* PageUrlCreator is, in its most basic form, a function that takes in a list of categories or products and returns a list of page_urls for the provided categories or products.
|
|
647
|
-
* It's main use case is to allow for the creation of links to the product or category pages on the merchant's site.
|
|
648
|
-
* It can also be used for the depict customers which already have links to change those links (i.e. for staging sites).
|
|
649
|
-
* Also, it can be used to enrich the data for each product card in a batched way, which is why it can be an async function and return a whole display in the case of products.
|
|
650
|
-
*/
|
|
651
|
-
export type PageURLCreator<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = (options: PageURLCreatorOptions<InputDisplay>) => (typeof options)["type"] extends "categories" ? CanBePromiseWrapped<{
|
|
652
|
-
page_url: string;
|
|
653
|
-
}[]> : CanBePromiseWrapped<{
|
|
654
|
-
page_url: string;
|
|
655
|
-
}[]> | CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
|
|
656
622
|
export type ExclusiveId = {
|
|
657
623
|
categoryId: string;
|
|
658
624
|
productId?: undefined;
|
|
@@ -723,29 +689,29 @@ export type InstantCard<T extends Display> = (display: T, context: {
|
|
|
723
689
|
merchant: string;
|
|
724
690
|
market: string;
|
|
725
691
|
}) => JSX.Element;
|
|
726
|
-
type CategorySuggestionAfterURLCreator =
|
|
692
|
+
type CategorySuggestionAfterURLCreator = CategorySuggestion & {
|
|
727
693
|
page_url: string;
|
|
728
694
|
};
|
|
729
|
-
type ReplaceCategorySuggestion<T> = T extends
|
|
730
|
-
type SearchSuggestionsResponseAfterURLCreator = { [K in keyof
|
|
695
|
+
type ReplaceCategorySuggestion<T> = T extends CategorySuggestion ? CategorySuggestionAfterURLCreator : T extends CategorySuggestion[] ? CategorySuggestionAfterURLCreator[] : T;
|
|
696
|
+
type SearchSuggestionsResponseAfterURLCreator = { [K in keyof SearchSuggestionsResponseV3]: ReplaceCategorySuggestion<SearchSuggestionsResponseV3[K]> };
|
|
731
697
|
type AddPageUrlToDisplay<T extends any[]> = (T[number] & {
|
|
732
698
|
page_url: string;
|
|
733
699
|
})[];
|
|
734
|
-
type
|
|
700
|
+
type SearchResponseAfterDisplayTransformer = { [K in keyof SearchResponse]: K extends "displays" ? AddPageUrlToDisplay<SearchResponse[K]> : K extends "filters" ? AddActualFieldToFilters<SearchResponse[K]> : SearchResponse[K] };
|
|
735
701
|
type QuicklinksOrBreadCrumbsWithPageURL<T extends Breadcrumb | Quicklink> = T & {
|
|
736
702
|
page_url: string;
|
|
737
703
|
};
|
|
738
704
|
type _AddPageUrlToDisplay1<T extends any[]> = (T[number] & {
|
|
739
705
|
page_url: string;
|
|
740
706
|
})[];
|
|
741
|
-
type
|
|
742
|
-
type
|
|
707
|
+
type ProductListingResponseAfterDisplayTransformer = { [K in keyof ProductListingResponseV3]: K extends "displays" ? _AddPageUrlToDisplay1<ProductListingResponseV3[K]> : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV3[K]> : ProductListingResponseV3[K] };
|
|
708
|
+
type GetListingResponseAfterDisplayTransformer = { [K in keyof GetListingResponse]: K extends "breadcrumbs" ? QuicklinksOrBreadCrumbsWithPageURL<Breadcrumb>[] : K extends "quick_links" ? QuicklinksOrBreadCrumbsWithPageURL<Quicklink>[] : GetListingResponse[K] };
|
|
743
709
|
type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
|
|
744
710
|
get_metadata?: () => Promise<{
|
|
745
711
|
[k: string]: string;
|
|
746
712
|
} | undefined>;
|
|
747
713
|
get_session_id?: () => string | undefined;
|
|
748
|
-
} &
|
|
714
|
+
} & SomethingTakingADisplayTransformers<InputDisplay, OutputDisplay>;
|
|
749
715
|
interface GetListingOptions extends GetListingRequest {
|
|
750
716
|
listing_id: string;
|
|
751
717
|
session_id?: string;
|
|
@@ -757,21 +723,20 @@ interface GetListingOptions extends GetListingRequest {
|
|
|
757
723
|
*/
|
|
758
724
|
export class DepictAPI<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never = InputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<InputDisplay> : never> {
|
|
759
725
|
#private;
|
|
760
|
-
page_url_creator: PageURLCreator<ModernDisplay, OutputDisplay> | undefined;
|
|
761
726
|
display_transformers: DisplayTransformers<ModernDisplay, OutputDisplay> | undefined;
|
|
762
727
|
constructor(options: DepictAPIConstructorOptions<InputDisplay, OutputDisplay>);
|
|
763
728
|
suggest(input_req: SearchSuggestionsRequestV3): Promise<SearchSuggestionsResponseAfterURLCreator & {
|
|
764
729
|
failed?: true;
|
|
765
730
|
}>;
|
|
766
|
-
query(input_req: SearchRequestV3): Promise<
|
|
731
|
+
query(input_req: SearchRequestV3): Promise<SearchResponseAfterDisplayTransformer & {
|
|
767
732
|
failed?: true;
|
|
768
733
|
}>;
|
|
769
|
-
get_listing(input_req: GetListingOptions): Promise<
|
|
734
|
+
get_listing(input_req: GetListingOptions): Promise<GetListingResponseAfterDisplayTransformer & {
|
|
770
735
|
failed?: true;
|
|
771
736
|
}>;
|
|
772
737
|
get_listing_products(input_req: ProductListingRequestV3 & {
|
|
773
738
|
listing_id: string;
|
|
774
|
-
}): Promise<
|
|
739
|
+
}): Promise<ProductListingResponseAfterDisplayTransformer & {
|
|
775
740
|
failed?: true;
|
|
776
741
|
}>;
|
|
777
742
|
get_recommended<T extends Display>(input_req: BaseSearchRequestV3): Promise<{
|
|
@@ -823,7 +788,7 @@ type CategoryConstructorOptionsWithApi<InputDisplay extends Display, OutputDispl
|
|
|
823
788
|
};
|
|
824
789
|
type CategoryConstructorOptionsWithoutApi<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = GeneralCategoryListingOptions & {
|
|
825
790
|
api?: never;
|
|
826
|
-
} &
|
|
791
|
+
} & SomethingTakingADisplayTransformers<InputDisplay, OutputDisplay>;
|
|
827
792
|
type DepictCategoryConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay> = CategoryConstructorOptionsWithApi<InputDisplay, OutputDisplay> | CategoryConstructorOptionsWithoutApi<InputDisplay, OutputDisplay>;
|
|
828
793
|
export class DepictCategory<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never = InputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<InputDisplay> : never> {
|
|
829
794
|
#private;
|
|
@@ -844,7 +809,6 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
|
|
|
844
809
|
constructor({
|
|
845
810
|
api,
|
|
846
811
|
on_navigation,
|
|
847
|
-
page_url_creator,
|
|
848
812
|
display_transformers,
|
|
849
813
|
unique_instance_key_for_state,
|
|
850
814
|
listing_id_state_key,
|
|
@@ -871,12 +835,12 @@ export function BreadCrumbs<T extends Display>({
|
|
|
871
835
|
depict_category
|
|
872
836
|
}: {
|
|
873
837
|
depict_category: DepictCategory<T>;
|
|
874
|
-
}):
|
|
838
|
+
}): HTMLDivElement;
|
|
875
839
|
export function QuickLinks<T extends Display>({
|
|
876
840
|
depict_category
|
|
877
841
|
}: {
|
|
878
842
|
depict_category: DepictCategory<T>;
|
|
879
|
-
}):
|
|
843
|
+
}): HTMLDivElement;
|
|
880
844
|
/**
|
|
881
845
|
* Gets available listings for a given merchant, market and locale
|
|
882
846
|
*/
|
|
@@ -929,7 +893,7 @@ type ConstructorOptionsWithApi<InputDisplay extends Display, OutputDisplay exten
|
|
|
929
893
|
};
|
|
930
894
|
type ConstructorOptionsWithoutAPI<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = GeneralConstructorOptions<InputDisplay, OutputDisplay> & {
|
|
931
895
|
api?: never;
|
|
932
|
-
} &
|
|
896
|
+
} & SomethingTakingADisplayTransformers<InputDisplay, OutputDisplay>;
|
|
933
897
|
type ConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay> = ConstructorOptionsWithApi<InputDisplay, OutputDisplay> | ConstructorOptionsWithoutAPI<InputDisplay, OutputDisplay>;
|
|
934
898
|
export type OpenModalArguments = [options_for_modal?: {
|
|
935
899
|
style_props_?: Signal<JSX.CSSProperties>;
|
|
@@ -947,7 +911,6 @@ export class DepictSearch<InputDisplay extends Display, OutputDisplay extends Mo
|
|
|
947
911
|
url_transformer,
|
|
948
912
|
on_navigation,
|
|
949
913
|
enable_category_suggestions,
|
|
950
|
-
page_url_creator,
|
|
951
914
|
display_transformers,
|
|
952
915
|
api,
|
|
953
916
|
disable_scrolling_during_modal,
|
|
@@ -1024,46 +987,16 @@ export type BaseProviderConfig<InputDisplay extends Display, PossibleTransformed
|
|
|
1024
987
|
*/
|
|
1025
988
|
uniqueInstanceKeyForState?: string;
|
|
1026
989
|
} & (InputDisplay extends ModernDisplay ? "page_url" extends keyof InputDisplay["variant_displays"][number] ? {
|
|
1027
|
-
/**
|
|
1028
|
-
* @deprecated use displayTransformers instead
|
|
1029
|
-
*/
|
|
1030
|
-
pageURLCreator?: PageURLCreator<InputDisplay, PossibleTransformedDisplay>;
|
|
1031
|
-
/**
|
|
1032
|
-
* 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.
|
|
1033
|
-
*/
|
|
1034
|
-
displayTransformers?: never;
|
|
1035
|
-
} | {
|
|
1036
|
-
/**
|
|
1037
|
-
* @deprecated use displayTransformers instead
|
|
1038
|
-
*/
|
|
1039
|
-
pageURLCreator?: never;
|
|
1040
990
|
/**
|
|
1041
991
|
* 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.
|
|
1042
992
|
*/
|
|
1043
993
|
displayTransformers: DisplayTransformers<InputDisplay, PossibleTransformedDisplay>;
|
|
1044
994
|
} : {
|
|
1045
|
-
/**
|
|
1046
|
-
* @deprecated use displayTransformers instead
|
|
1047
|
-
*/
|
|
1048
|
-
pageURLCreator: PageURLCreator<InputDisplay, PossibleTransformedDisplay>;
|
|
1049
|
-
/**
|
|
1050
|
-
* 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.
|
|
1051
|
-
*/
|
|
1052
|
-
displayTransformers?: never;
|
|
1053
|
-
} | {
|
|
1054
995
|
/**
|
|
1055
996
|
* 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.
|
|
1056
997
|
*/
|
|
1057
998
|
displayTransformers: DisplayTransformers<InputDisplay, PossibleTransformedDisplay>;
|
|
1058
|
-
/**
|
|
1059
|
-
* @deprecated use displayTransformers instead
|
|
1060
|
-
*/
|
|
1061
|
-
pageURLCreator?: never;
|
|
1062
999
|
} : {
|
|
1063
|
-
/**
|
|
1064
|
-
* @deprecated use displayTransformers instead
|
|
1065
|
-
*/
|
|
1066
|
-
pageURLCreator?: never;
|
|
1067
1000
|
/**
|
|
1068
1001
|
* 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.
|
|
1069
1002
|
*/
|