@depict-ai/ui 3.0.3 → 3.0.5
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 +162 -151
- package/ES10/index.d.ts +211 -201
- package/ES10/index.js +164 -153
- package/latest/index.cjs +139 -113
- package/latest/index.d.ts +211 -201
- package/latest/index.js +141 -115
- package/package.json +4 -4
- package/server/ES10/index.cjs +137 -126
- package/server/ES10/index.d.ts +211 -201
- package/server/ES10/index.js +139 -128
- package/server/latest/index.cjs +128 -108
- package/server/latest/index.d.ts +211 -201
- package/server/latest/index.js +130 -110
package/server/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.5";
|
|
81
81
|
const $0f313083912e447a$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>'];
|
|
82
82
|
function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
|
|
83
83
|
return $5vyXB$solidjsweb.ssr($0f313083912e447a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("width", $5vyXB$solidjsweb.escape(props.width_, true) ?? 14, false) + $5vyXB$solidjsweb.ssrAttribute("height", $5vyXB$solidjsweb.escape(props.height_, true) ?? 26, false));
|
|
@@ -439,7 +439,7 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
439
439
|
event_: event_,
|
|
440
440
|
force_spa_navigation_: force_spa_navigation_,
|
|
441
441
|
is_replace_: is_replace_,
|
|
442
|
-
|
|
442
|
+
listing_query_: listing_query_,
|
|
443
443
|
scroll = true
|
|
444
444
|
}) => {
|
|
445
445
|
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
@@ -460,10 +460,10 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
460
460
|
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
461
461
|
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
462
462
|
const new_state = history.state;
|
|
463
|
-
if (
|
|
463
|
+
if (listing_query_) {
|
|
464
464
|
// In JS-UI we need to know the listing_id of the current category, therefore push it into state
|
|
465
|
-
if (!this.
|
|
466
|
-
new_state[this.
|
|
465
|
+
if (!this.listing_query_state_key) $5vyXB$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
|
|
466
|
+
new_state[this.listing_query_state_key] = listing_query_;
|
|
467
467
|
}
|
|
468
468
|
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
469
469
|
} else this.#throwing_on_navigation.call(this, {
|
|
@@ -474,8 +474,8 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
474
474
|
await promise;
|
|
475
475
|
})
|
|
476
476
|
};
|
|
477
|
-
constructor(on_navigation,
|
|
478
|
-
this.
|
|
477
|
+
constructor(on_navigation, listing_query_state_key) {
|
|
478
|
+
this.listing_query_state_key = listing_query_state_key;
|
|
479
479
|
this.on_navigation_ = on_navigation;
|
|
480
480
|
}
|
|
481
481
|
}
|
|
@@ -894,27 +894,31 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
|
894
894
|
});
|
|
895
895
|
}
|
|
896
896
|
// source: https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934
|
|
897
|
+
// deeply diffs two objects
|
|
898
|
+
// Modified by chatGPT to not be recursive, since stiga was getting a stack overflow just due to the size of their data
|
|
899
|
+
// Modified futher to bias towards saying objects are equal non-primitive objects differ
|
|
897
900
|
function $a73063cc642f3e5f$var$deep_equal(obj1, obj2) {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
}
|
|
915
|
-
|
|
901
|
+
const stack = [[obj1, obj2]];
|
|
902
|
+
while (stack.length > 0) {
|
|
903
|
+
const [currentObj1, currentObj2] = stack.pop();
|
|
904
|
+
if (currentObj1 === currentObj2) continue;
|
|
905
|
+
if (Array.isArray(currentObj1) && Array.isArray(currentObj2)) {
|
|
906
|
+
if (currentObj1.length !== currentObj2.length) return false;
|
|
907
|
+
for (let i = 0; i < currentObj1.length; i++) stack.push([currentObj1[i], currentObj2[i]]);
|
|
908
|
+
} else if (typeof currentObj1 === "object" && typeof currentObj2 === "object" && currentObj1 !== null && currentObj2 !== null) {
|
|
909
|
+
if (Array.isArray(currentObj1) || Array.isArray(currentObj2)) return false;
|
|
910
|
+
const keys1 = Object.keys(currentObj1);
|
|
911
|
+
const keys2 = Object.keys(currentObj2);
|
|
912
|
+
if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
|
|
913
|
+
for (let key in currentObj1) {
|
|
914
|
+
if ($a73063cc642f3e5f$var$result_ids.includes(key)) continue; // ignore comparing values for keys we know are changing with every request
|
|
915
|
+
stack.push([currentObj1[key], currentObj2[key]]);
|
|
916
|
+
}
|
|
917
|
+
} else if (typeof currentObj1 !== "function" && typeof currentObj2 !== "function")
|
|
918
|
+
// Claim that all functions are equal, since the only way a function ends up here is because someone added it in the displayTransformer and that shouldn't force us to re-render, right?
|
|
919
|
+
return false;
|
|
916
920
|
}
|
|
917
|
-
return
|
|
921
|
+
return true;
|
|
918
922
|
}
|
|
919
923
|
const $f48d0fbb00835aaa$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
|
|
920
924
|
$f48d0fbb00835aaa$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
|
|
@@ -4450,6 +4454,11 @@ function $67dc366d96177e70$export$967e966fca9515e(api_response) {
|
|
|
4450
4454
|
}
|
|
4451
4455
|
return api_response;
|
|
4452
4456
|
}
|
|
4457
|
+
|
|
4458
|
+
// Minifiable and tree-shakable enum
|
|
4459
|
+
// Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
|
|
4460
|
+
const $779741d0f266ea8c$export$74ee7529ce0f8a00 = "listingId";
|
|
4461
|
+
const $779741d0f266ea8c$export$5aae649db1b959fc = "externalId";
|
|
4453
4462
|
const $e1d6c0f3d89d531c$var$v3_base_url = (0, $5vyXB$depictaiutilishared.base_url) + "/v3/";
|
|
4454
4463
|
const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$v3_base_url + "search/";
|
|
4455
4464
|
class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
@@ -4479,7 +4488,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4479
4488
|
const category_transformer = this.display_transformers?.categories;
|
|
4480
4489
|
if (!category_transformer) return response;
|
|
4481
4490
|
// find category suggestions, run thing with them, and then replace them
|
|
4482
|
-
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "
|
|
4491
|
+
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "listing");
|
|
4483
4492
|
const transformed_category_suggestions = await category_transformer({
|
|
4484
4493
|
market: market,
|
|
4485
4494
|
merchant: merchant,
|
|
@@ -4529,8 +4538,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4529
4538
|
endpoint_: endpoint_,
|
|
4530
4539
|
input_req_: input_req_,
|
|
4531
4540
|
fallback_response_: fallback_response_,
|
|
4532
|
-
method_ = "POST"
|
|
4533
|
-
delete_key_before_sending_: delete_key_before_sending_ // only supported for GET requests
|
|
4541
|
+
method_ = "POST"
|
|
4534
4542
|
}) {
|
|
4535
4543
|
const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
|
|
4536
4544
|
const with_ids = this.#add_ids_to_request(input_req_);
|
|
@@ -4548,7 +4556,6 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4548
4556
|
cache_obj.in_progress_[body] = new Promise(r => resolve_in_progress = r);
|
|
4549
4557
|
try {
|
|
4550
4558
|
const is_post = method_ === "POST";
|
|
4551
|
-
if (!is_post && delete_key_before_sending_) delete sorted_request[delete_key_before_sending_];
|
|
4552
4559
|
const url_to_request = is_post ? endpoint_ : $5vyXB$depictaiutilishared.make_url_with_query_params(endpoint_, sorted_request);
|
|
4553
4560
|
const api_response = await $5vyXB$depictaiutilishared.fetch_retry($5vyXB$depictaiutilishared.add_version_query_params(url_to_request), {
|
|
4554
4561
|
method: method_,
|
|
@@ -4636,9 +4643,13 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4636
4643
|
})
|
|
4637
4644
|
});
|
|
4638
4645
|
}
|
|
4639
|
-
async get_listing(
|
|
4646
|
+
async get_listing({
|
|
4647
|
+
id_type_: id_type_,
|
|
4648
|
+
id_to_query_for_: id_to_query_for_,
|
|
4649
|
+
...input_req
|
|
4650
|
+
}) {
|
|
4640
4651
|
return await this.#cached_request({
|
|
4641
|
-
endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + encodeURIComponent(
|
|
4652
|
+
endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_),
|
|
4642
4653
|
input_req_: input_req,
|
|
4643
4654
|
fallback_response_: () => ({
|
|
4644
4655
|
listing_id: "",
|
|
@@ -4652,20 +4663,17 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
4652
4663
|
"quick_links": [],
|
|
4653
4664
|
failed: true
|
|
4654
4665
|
}),
|
|
4655
|
-
method_: "GET"
|
|
4656
|
-
delete_key_before_sending_: "listing_id" // this goes into the path, but we still need to have it in the request object until the last second as we want to include it as a key when caching requests
|
|
4666
|
+
method_: "GET"
|
|
4657
4667
|
});
|
|
4658
4668
|
}
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
};
|
|
4665
|
-
delete cloned_request["listing_id"];
|
|
4669
|
+
async get_listing_products({
|
|
4670
|
+
id_to_query_for_: id_to_query_for_,
|
|
4671
|
+
id_type_: id_type_,
|
|
4672
|
+
...input_req_
|
|
4673
|
+
}) {
|
|
4666
4674
|
return await this.#cached_request({
|
|
4667
|
-
endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + encodeURIComponent(
|
|
4668
|
-
input_req_:
|
|
4675
|
+
endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
|
|
4676
|
+
input_req_: input_req_,
|
|
4669
4677
|
fallback_response_: () => ({
|
|
4670
4678
|
"n_hits": 0,
|
|
4671
4679
|
"displays": [],
|
|
@@ -4966,7 +4974,7 @@ function $3f08fe2992a2a8ca$export$5e4aed86c12acdd9({
|
|
|
4966
4974
|
// After first load, always just load 20 since people might just be browsing the top ones still
|
|
4967
4975
|
min_products_to_fetch_ : now - last_loaded < 10000 ? min_products_to_fetch_ * 5 : min_products_to_fetch_;
|
|
4968
4976
|
// dlog("loading ", number_of_results_to_load, "products, because it was", now - last_loaded, "ms since last load");
|
|
4969
|
-
const api_response = await depict_api_["
|
|
4977
|
+
const api_response = await depict_api_["query" in base_part ? "query" : "get_listing_products"]({
|
|
4970
4978
|
cursor: get_last_cursor(),
|
|
4971
4979
|
limit: number_of_results_to_load,
|
|
4972
4980
|
...base_part
|
|
@@ -6258,11 +6266,12 @@ const $8cceb1d3a967f369$var$_tmpl$ = ["<nav", ' class="quicklinks"', ">", "</nav
|
|
|
6258
6266
|
function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
6259
6267
|
quicklinks_data_: quicklinks_data_,
|
|
6260
6268
|
router_: router_,
|
|
6261
|
-
|
|
6269
|
+
id_to_query_for_: id_to_query_for_,
|
|
6262
6270
|
breadcrumb_data_: breadcrumb_data_,
|
|
6263
6271
|
i18n_: i18n_,
|
|
6264
6272
|
sorting_query_param_: sorting_query_param_,
|
|
6265
|
-
filter_query_param_prefix_: filter_query_param_prefix_
|
|
6273
|
+
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
6274
|
+
id_type_: id_type_
|
|
6266
6275
|
}) {
|
|
6267
6276
|
let scrolling_logic_ran_for_listing_id = false;
|
|
6268
6277
|
let last_scroll_position;
|
|
@@ -6270,11 +6279,11 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
|
6270
6279
|
let last_was_placeholder = false;
|
|
6271
6280
|
let sliding_element;
|
|
6272
6281
|
$5vyXB$solidjs.createComputed(() => {
|
|
6273
|
-
|
|
6282
|
+
id_to_query_for_();
|
|
6274
6283
|
scrolling_logic_ran_for_listing_id = false;
|
|
6275
6284
|
});
|
|
6276
6285
|
const place_holdey_quicklinks_data = $5vyXB$solidjs.createMemo(() => quicklinks_data_() || [,,,]);
|
|
6277
|
-
const selected_index = $5vyXB$solidjs.createMemo(() => quicklinks_data_()?.findIndex(item => item
|
|
6286
|
+
const selected_index = $5vyXB$solidjs.createMemo(() => quicklinks_data_()?.findIndex(item => item[id_type_() === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id" : "listing_id"] === id_to_query_for_())); // this will be -1 when viewing child categories
|
|
6278
6287
|
const scrollpos_per_listing_id = {};
|
|
6279
6288
|
const mutation_plugins = [function () {
|
|
6280
6289
|
if (!scrolling_logic_ran_for_listing_id) return;
|
|
@@ -6283,7 +6292,7 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
|
6283
6292
|
} = this.insert_here;
|
|
6284
6293
|
if (scrollLeft > 0) {
|
|
6285
6294
|
last_scroll_position = scrollLeft;
|
|
6286
|
-
const current_id = $5vyXB$solidjs.untrack(
|
|
6295
|
+
const current_id = $5vyXB$solidjs.untrack(id_to_query_for_);
|
|
6287
6296
|
// make sure to not save position where selected item isn't in viewport
|
|
6288
6297
|
const current_selected_index = $5vyXB$solidjs.untrack(selected_index);
|
|
6289
6298
|
const intersecting_thing = this.intersecting_items_object[current_selected_index];
|
|
@@ -6345,7 +6354,7 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
|
6345
6354
|
equals: false
|
|
6346
6355
|
}), new_data => {
|
|
6347
6356
|
const quicklinks_data = quicklinks_data_(); // this signal should have updated by now since this is a createEffect
|
|
6348
|
-
const current_id =
|
|
6357
|
+
const current_id = id_to_query_for_();
|
|
6349
6358
|
if (!new_data || !quicklinks_data || !current_id) return;
|
|
6350
6359
|
const owner = $5vyXB$solidjs.getOwner();
|
|
6351
6360
|
queueMicrotask(() => {
|
|
@@ -6393,10 +6402,9 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
|
6393
6402
|
// Problem: When you don't open a link in a new tab, we don't display the filter cleared toast
|
|
6394
6403
|
// Solution: instead of not adding the state to the url, add a flag to the link if it's a sibling and then display the toast on load if the flag is set
|
|
6395
6404
|
const is_sibling = $5vyXB$solidjs.createMemo(() => {
|
|
6396
|
-
const current_id =
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
}) => listing_id === current_id);
|
|
6405
|
+
const current_id = id_to_query_for_();
|
|
6406
|
+
const lookForId = id_type_() === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id" : "listing_id";
|
|
6407
|
+
return quicklinks_data_()?.some(quickLink => quickLink[lookForId] === current_id);
|
|
6400
6408
|
});
|
|
6401
6409
|
const href = $5vyXB$solidjs.createMemo(() =>
|
|
6402
6410
|
// We don't want these links to delete the sort and filter state by default, only if `clear_filters_when_going_sideways` explicitly clears them
|
|
@@ -6604,13 +6612,14 @@ function $47e2cc552c02110c$export$8895d39404bd2bb1(props) {
|
|
|
6604
6612
|
}
|
|
6605
6613
|
function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
6606
6614
|
crumb_data_: crumb_data_,
|
|
6607
|
-
|
|
6615
|
+
id_to_query_for_: id_to_query_for_,
|
|
6608
6616
|
i18n_: i18n_,
|
|
6609
6617
|
selected_filters_: selected_filters_,
|
|
6610
6618
|
local_filter_cache_: local_filter_cache_,
|
|
6611
6619
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
6612
6620
|
plp_results_: plp_results_,
|
|
6613
|
-
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
|
|
6621
|
+
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6622
|
+
id_type_: id_type_
|
|
6614
6623
|
}) {
|
|
6615
6624
|
// If we just got opened in a new tab, clear filters instantly and remove the flag
|
|
6616
6625
|
$ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
|
|
@@ -6621,17 +6630,21 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
|
6621
6630
|
i18n_: i18n_,
|
|
6622
6631
|
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
|
|
6623
6632
|
});
|
|
6624
|
-
//
|
|
6633
|
+
// The code below is for when we're already open and the user navigates to a new category
|
|
6625
6634
|
let previous_crumb_data = $5vyXB$solidjs.untrack(crumb_data_);
|
|
6626
|
-
let
|
|
6635
|
+
let id_when_we_got_previous_data = {
|
|
6636
|
+
id_: $5vyXB$solidjs.untrack(id_to_query_for_),
|
|
6637
|
+
type_: $5vyXB$solidjs.untrack(id_type_)
|
|
6638
|
+
};
|
|
6627
6639
|
let allow_filter_clearing = true; // set to false when going backwards/forwards
|
|
6628
6640
|
// temporarily disable filter clearing when going backwards/forwards
|
|
6629
6641
|
const handler = () => allow_filter_clearing = false;
|
|
6630
6642
|
window.addEventListener("popstate", handler); // popstate only gets called when using back/forwards button of browser or the history navigate to achieve the same, but not on pushState or replaceState
|
|
6631
6643
|
$5vyXB$solidjs.onCleanup(() => window.removeEventListener("popstate", handler));
|
|
6632
6644
|
$5vyXB$solidjs.createEffect($5vyXB$solidjs.on(crumb_data_, $5vyXB$depictaiutilishared.catchify(new_crumb_data => {
|
|
6633
|
-
const
|
|
6634
|
-
|
|
6645
|
+
const id_of_new_data = id_to_query_for_();
|
|
6646
|
+
const type_of_id_of_new_data = id_type_();
|
|
6647
|
+
if (allow_filter_clearing && previous_crumb_data && new_crumb_data && (id_of_new_data !== id_when_we_got_previous_data.id_ || type_of_id_of_new_data !== id_when_we_got_previous_data.type_)) {
|
|
6635
6648
|
const previous_length = previous_crumb_data.length;
|
|
6636
6649
|
const new_length = new_crumb_data.length;
|
|
6637
6650
|
const went_upwards = new_length < previous_length;
|
|
@@ -6654,7 +6667,10 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
|
6654
6667
|
sideways_filter_clearing_flag_[1](false);
|
|
6655
6668
|
}
|
|
6656
6669
|
}
|
|
6657
|
-
|
|
6670
|
+
id_when_we_got_previous_data = {
|
|
6671
|
+
id_: id_of_new_data,
|
|
6672
|
+
type_: type_of_id_of_new_data
|
|
6673
|
+
};
|
|
6658
6674
|
previous_crumb_data = new_crumb_data;
|
|
6659
6675
|
if (!allow_filter_clearing) allow_filter_clearing = true;
|
|
6660
6676
|
})));
|
|
@@ -6717,8 +6733,8 @@ const $840d88a04b2d22a7$var$_tmpl$ = ["<div", ' class="product-count"><!--$-->',
|
|
|
6717
6733
|
$840d88a04b2d22a7$var$_tmpl$4 = ["<div", ' class="depict plp category"><div class="listing-page"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
|
|
6718
6734
|
function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
6719
6735
|
depict_api_: depict_api_,
|
|
6720
|
-
|
|
6721
|
-
|
|
6736
|
+
id_to_query_for_: id_to_query_for_,
|
|
6737
|
+
id_type_: id_type_,
|
|
6722
6738
|
current_sorting_: current_sorting_,
|
|
6723
6739
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
6724
6740
|
category_filters_open_: category_filters_open_,
|
|
@@ -6771,7 +6787,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6771
6787
|
merchant: merchant_(),
|
|
6772
6788
|
market: market_(),
|
|
6773
6789
|
locale: backend_locale_(),
|
|
6774
|
-
|
|
6790
|
+
id_to_query_for_: id_to_query_for_(),
|
|
6791
|
+
id_type_: id_type_(),
|
|
6775
6792
|
...(f.length ? {
|
|
6776
6793
|
filters: f
|
|
6777
6794
|
} : {}),
|
|
@@ -6783,8 +6800,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6783
6800
|
// Make "Get products in listing" request to get products in listing
|
|
6784
6801
|
const [plp_products_] = $5vyXB$solidjs.createResource(products_query_base_,
|
|
6785
6802
|
// only first page of results, unless the history state says we should load more (can't do that in load more thing, I tested, they need to be added at once for the browser to not give up scroll restoration)
|
|
6786
|
-
$5vyXB$
|
|
6787
|
-
id_: $5vyXB$solidjs.untrack(
|
|
6803
|
+
$5vyXB$depictaiutilisharedlatest.catchify(base_query => $276380e4607fb9fb$export$cc42dd29bf655ab6({
|
|
6804
|
+
id_: $5vyXB$solidjs.untrack(id_to_query_for_),
|
|
6788
6805
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
6789
6806
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
6790
6807
|
make_request_: (limit, cursor) => depict_api_.get_listing_products({
|
|
@@ -6799,10 +6816,11 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6799
6816
|
merchant: merchant_(),
|
|
6800
6817
|
market: market_(),
|
|
6801
6818
|
locale: backend_locale_(),
|
|
6802
|
-
|
|
6819
|
+
id_to_query_for_: id_to_query_for_(),
|
|
6820
|
+
id_type_: id_type_()
|
|
6803
6821
|
}));
|
|
6804
6822
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
6805
|
-
const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$
|
|
6823
|
+
const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
|
|
6806
6824
|
const available_sortings_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
6807
6825
|
...sort,
|
|
6808
6826
|
order: sort.order ?? "desc"
|
|
@@ -6811,13 +6829,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6811
6829
|
const title = $5vyXB$solidjs.createMemo(() => plp_meta()?.title);
|
|
6812
6830
|
const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title);
|
|
6813
6831
|
const quicklinks_data_ = $5vyXB$solidjs.createMemo(() => plp_meta()?.quick_links);
|
|
6814
|
-
const meta_tag_data_ = $5vyXB$solidjs.createMemo(() => {
|
|
6815
|
-
if (plp_meta()?.replace_meta_tags) return {
|
|
6816
|
-
title: plp_meta()?.title + (meta_title_suffix_() || ""),
|
|
6817
|
-
description: plp_meta()?.description
|
|
6818
|
-
};
|
|
6819
|
-
});
|
|
6820
|
-
$5vyXB$depictaiutilishared.edit_current_page_meta_tags(meta_tag_data_);
|
|
6821
6832
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $5vyXB$solidjs.createSignal(false);
|
|
6822
6833
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $5vyXB$solidjs.createSignal();
|
|
6823
6834
|
const formatted_number_of_results_ = $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
|
|
@@ -6877,7 +6888,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6877
6888
|
}));
|
|
6878
6889
|
results_for = make_product_count_();
|
|
6879
6890
|
} else {
|
|
6880
|
-
$5vyXB$
|
|
6891
|
+
$5vyXB$depictaiutilisharedlatest.report(new Error("Unrecognised category_title_type, UI will look messed up"), "error");
|
|
6881
6892
|
results_for = $5vyXB$solidjsweb.ssr($840d88a04b2d22a7$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey());
|
|
6882
6893
|
}
|
|
6883
6894
|
const filters_opener = $f8f64d05c525825b$export$d7841e452f2e59a8({
|
|
@@ -6899,17 +6910,17 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6899
6910
|
number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
|
|
6900
6911
|
...extra_sort_and_filter_args_
|
|
6901
6912
|
});
|
|
6902
|
-
$5vyXB$
|
|
6913
|
+
$5vyXB$depictaiutilisharedlatest.catchify((0, $276380e4607fb9fb$export$6e49da55e449af7c))({
|
|
6903
6914
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
6904
6915
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
6905
|
-
id_:
|
|
6916
|
+
id_: id_to_query_for_,
|
|
6906
6917
|
can_write_scroll_restoration_: can_write_scroll_restoration_
|
|
6907
6918
|
});
|
|
6908
6919
|
on_filters_constructed_?.();
|
|
6909
6920
|
$5vyXB$solidjs.createComputed(() => {
|
|
6910
6921
|
if (plp_products_.loading) set_can_write_scroll_restoration(false);else if (plp_products_()) set_can_write_scroll_restoration(true);
|
|
6911
6922
|
});
|
|
6912
|
-
$5vyXB$solidjs.createRenderEffect($5vyXB$
|
|
6923
|
+
$5vyXB$solidjs.createRenderEffect($5vyXB$depictaiutilisharedlatest.catchify(async () => {
|
|
6913
6924
|
const slim = is_slim_();
|
|
6914
6925
|
const only_show_filters_opener = only_show_filters_opener_?.();
|
|
6915
6926
|
const owner = $5vyXB$solidjs.getOwner();
|
|
@@ -6922,14 +6933,15 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6922
6933
|
available_filters_: available_filters_
|
|
6923
6934
|
});
|
|
6924
6935
|
$ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
|
|
6925
|
-
|
|
6936
|
+
id_to_query_for_: id_to_query_for_,
|
|
6926
6937
|
crumb_data_: crumb_data_,
|
|
6927
6938
|
i18n_: i18n_,
|
|
6928
6939
|
selected_filters_: selected_filters_,
|
|
6929
6940
|
local_filter_cache_: local_filter_cache_,
|
|
6930
6941
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
6931
6942
|
plp_results_: plp_products_,
|
|
6932
|
-
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
|
|
6943
|
+
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6944
|
+
id_type_: id_type_
|
|
6933
6945
|
});
|
|
6934
6946
|
get_breadcrumb_accessor_?.(crumb_data_);
|
|
6935
6947
|
get_quicklinks_accessor_?.(quicklinks_data_);
|
|
@@ -6953,7 +6965,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
6953
6965
|
get children() {
|
|
6954
6966
|
return $5vyXB$solidjsweb.createComponent((0, $8cceb1d3a967f369$export$466cdc317043f6cb), {
|
|
6955
6967
|
quicklinks_data_: quicklinks_data_,
|
|
6956
|
-
|
|
6968
|
+
id_to_query_for_: id_to_query_for_,
|
|
6969
|
+
id_type_: id_type_,
|
|
6957
6970
|
router_: router_,
|
|
6958
6971
|
breadcrumb_data_: crumb_data_,
|
|
6959
6972
|
i18n_: i18n_,
|
|
@@ -7003,7 +7016,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7003
7016
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
7004
7017
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
7005
7018
|
content_blocks_by_row_: content_blocks_by_row_,
|
|
7006
|
-
id_currently_querying_for_:
|
|
7019
|
+
id_currently_querying_for_: id_to_query_for_,
|
|
7007
7020
|
no_results_options_: {
|
|
7008
7021
|
selected_filters_: selected_filters_,
|
|
7009
7022
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -7044,7 +7057,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
7044
7057
|
* Adds the current page as last breadcrumb to the breadcrumb trail
|
|
7045
7058
|
*/
|
|
7046
7059
|
function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title) {
|
|
7047
|
-
const href_accessor = $5vyXB$
|
|
7060
|
+
const href_accessor = $5vyXB$depictaiutilisharedlatest.use_href_accessor();
|
|
7048
7061
|
return $5vyXB$solidjs.createMemo(() => {
|
|
7049
7062
|
const api_value = plp_meta()?.breadcrumbs;
|
|
7050
7063
|
if (!api_value) return api_value;
|
|
@@ -7060,6 +7073,12 @@ function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title) {
|
|
|
7060
7073
|
},
|
|
7061
7074
|
get slug() {
|
|
7062
7075
|
return plp_meta().slug;
|
|
7076
|
+
},
|
|
7077
|
+
get listing_type() {
|
|
7078
|
+
return plp_meta().listing_type;
|
|
7079
|
+
},
|
|
7080
|
+
get external_id() {
|
|
7081
|
+
return plp_meta().external_id;
|
|
7063
7082
|
}
|
|
7064
7083
|
}];
|
|
7065
7084
|
});
|
|
@@ -7227,8 +7246,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
7227
7246
|
#localization_signal = $5vyXB$solidjs.createSignal();
|
|
7228
7247
|
#merchant_signal = $5vyXB$solidjs.createSignal();
|
|
7229
7248
|
#market_signal = $5vyXB$solidjs.createSignal();
|
|
7230
|
-
#
|
|
7231
|
-
#meta_title_suffix_ = $5vyXB$solidjs.createSignal();
|
|
7249
|
+
#listing_query_signal = $5vyXB$solidjs.createSignal({});
|
|
7232
7250
|
#disable_override_listing_id = $5vyXB$solidjs.createSignal();
|
|
7233
7251
|
static #keys_constructed_with = /*@__PURE__*/new Set();
|
|
7234
7252
|
get localization() {
|
|
@@ -7238,11 +7256,11 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
7238
7256
|
set localization(locale_obj) {
|
|
7239
7257
|
this.#localization_signal[1](locale_obj);
|
|
7240
7258
|
}
|
|
7241
|
-
get
|
|
7242
|
-
return this.#
|
|
7259
|
+
get listing_query() {
|
|
7260
|
+
return this.#listing_query_signal[0]();
|
|
7243
7261
|
}
|
|
7244
|
-
set
|
|
7245
|
-
this.#
|
|
7262
|
+
set listing_query(query) {
|
|
7263
|
+
this.#listing_query_signal[1](query);
|
|
7246
7264
|
}
|
|
7247
7265
|
get merchant() {
|
|
7248
7266
|
return this.#merchant_signal[0]();
|
|
@@ -7256,12 +7274,6 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
7256
7274
|
set market(market) {
|
|
7257
7275
|
this.#market_signal[1](market);
|
|
7258
7276
|
}
|
|
7259
|
-
get meta_title_suffix() {
|
|
7260
|
-
return this.#meta_title_suffix_[0]();
|
|
7261
|
-
}
|
|
7262
|
-
set meta_title_suffix(new_suffix) {
|
|
7263
|
-
this.#meta_title_suffix_[1](new_suffix);
|
|
7264
|
-
}
|
|
7265
7277
|
get disable_override_listing_id() {
|
|
7266
7278
|
return this.#disable_override_listing_id[0]();
|
|
7267
7279
|
}
|
|
@@ -7280,7 +7292,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
7280
7292
|
on_navigation: on_navigation,
|
|
7281
7293
|
display_transformers: display_transformers,
|
|
7282
7294
|
unique_instance_key_for_state = "",
|
|
7283
|
-
|
|
7295
|
+
listing_query_state_key: listing_query_state_key,
|
|
7284
7296
|
...props_on_class
|
|
7285
7297
|
}) {
|
|
7286
7298
|
const owner = $5vyXB$solidjs.getOwner() || $5vyXB$solidjs.createRoot(() => $5vyXB$solidjs.getOwner()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
|
|
@@ -7290,7 +7302,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
7290
7302
|
throw new Error("You can only have one instance of DepictCategory with the same uniqueInstanceKeyForState");
|
|
7291
7303
|
Object.assign(this, props_on_class); // set initial signal values
|
|
7292
7304
|
$d84fe647b84b5dc5$export$5162a71f252e6122();
|
|
7293
|
-
this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation",
|
|
7305
|
+
this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", listing_query_state_key);
|
|
7294
7306
|
if (on_navigation) this.#router.on_navigation_ = on_navigation;
|
|
7295
7307
|
const override_listing_id_query_param_names_ = ["listing_id_" + unique_instance_key_for_state, "listing_id"]; // If you're wondering why this is an array https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7958#note_1511700842
|
|
7296
7308
|
const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
|
|
@@ -7350,14 +7362,16 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
|
|
|
7350
7362
|
category_title: category_title
|
|
7351
7363
|
} = props;
|
|
7352
7364
|
const shared_properties = $48567ac5b39bac56$var$get_shared_properties(depict_category);
|
|
7365
|
+
const diffableListingQuery = $5vyXB$solidjs.createMemo(() => Object.values(depict_category.listing_query || {}).join(""));
|
|
7353
7366
|
return $95837413165cc2df$export$23fca46f3143581f(() => {
|
|
7354
7367
|
$5vyXB$solidjs.createEffect(prev => {
|
|
7355
7368
|
// this is here (and not on DepictCategory) so that people also know when PageReplacer removes the page, it's intended to help people replace their own content when a depict page is navigated, see https://depictaiworkspace.slack.com/archives/C04M8MGCF3K/p1691670636155369
|
|
7356
|
-
|
|
7357
|
-
$
|
|
7358
|
-
|
|
7369
|
+
diffableListingQuery(); // Only re-run this effect when the listing query *actually* changes (not just the object reference)
|
|
7370
|
+
const newId = $5vyXB$solidjs.untrack(() => depict_category.listing_query);
|
|
7371
|
+
$deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_query_change)(newId, prev);
|
|
7372
|
+
return newId;
|
|
7359
7373
|
});
|
|
7360
|
-
$5vyXB$solidjs.onCleanup(() => $deaaf04362a1bc71$export$f50b88e2a00918b5(props.
|
|
7374
|
+
$5vyXB$solidjs.onCleanup(() => $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_query_change)());
|
|
7361
7375
|
const grid_spacing_override = $5vyXB$solidjs.createMemo(() => {
|
|
7362
7376
|
const {
|
|
7363
7377
|
grid_spacing: grid_spacing
|
|
@@ -7398,8 +7412,11 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
|
|
|
7398
7412
|
depict_api_: depict_api_,
|
|
7399
7413
|
min_products_to_fetch_: $48567ac5b39bac56$var$min_products_to_fetch_,
|
|
7400
7414
|
local_filter_cache_: local_filter_cache_,
|
|
7401
|
-
|
|
7402
|
-
|
|
7415
|
+
id_to_query_for_: $5vyXB$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_query.id),
|
|
7416
|
+
id_type_: $5vyXB$solidjs.createMemo(() => {
|
|
7417
|
+
if (!depict_category.disable_override_listing_id && override_listing_id_accessor_()) return $779741d0f266ea8c$export$74ee7529ce0f8a00;
|
|
7418
|
+
return depict_category.listing_query.type;
|
|
7419
|
+
}),
|
|
7403
7420
|
i18n_: i18n_,
|
|
7404
7421
|
show_quicklinks_: $5vyXB$solidjs.createMemo(() => props.show_quicklinks ?? true),
|
|
7405
7422
|
category_title_: category_title,
|
|
@@ -7459,13 +7476,16 @@ function $48567ac5b39bac56$export$de035477d6fef996({
|
|
|
7459
7476
|
sorting_query_param_: sorting_query_param_,
|
|
7460
7477
|
filter_query_param_prefix_: filter_query_param_prefix_
|
|
7461
7478
|
} = $48567ac5b39bac56$var$get_shared_properties(depict_category);
|
|
7479
|
+
const id_to_query_for_ = $5vyXB$solidjs.createMemo(() => depict_category.listing_query.id);
|
|
7480
|
+
const id_type_ = $5vyXB$solidjs.createMemo(() => depict_category.listing_query.type);
|
|
7462
7481
|
return $5vyXB$solidjsweb.createComponent($48567ac5b39bac56$var$InExternalAreaDiv, {
|
|
7463
7482
|
get children() {
|
|
7464
7483
|
return $8cceb1d3a967f369$export$466cdc317043f6cb({
|
|
7465
7484
|
i18n_: i18n_,
|
|
7466
7485
|
quicklinks_data_: quicklinks_data_,
|
|
7467
7486
|
router_: router_,
|
|
7468
|
-
|
|
7487
|
+
id_type_: id_type_,
|
|
7488
|
+
id_to_query_for_: id_to_query_for_,
|
|
7469
7489
|
breadcrumb_data_: breadcrumb_data_,
|
|
7470
7490
|
sorting_query_param_: sorting_query_param_,
|
|
7471
7491
|
filter_query_param_prefix_: filter_query_param_prefix_
|
|
@@ -8231,7 +8251,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
|
|
|
8231
8251
|
searching_for_value_: searching_for_value_
|
|
8232
8252
|
}), $5vyXB$solidjsweb.ssr($6b65ba8af12c5a26$var$_tmpl$3, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjs.createMemo(() => {
|
|
8233
8253
|
if (input_obj().type === "content") return i18n_.content_();
|
|
8234
|
-
if (input_obj().
|
|
8254
|
+
if (input_obj().listing_type === "brand") return i18n_.brand_();
|
|
8235
8255
|
return i18n_.category_();
|
|
8236
8256
|
})()))]));
|
|
8237
8257
|
};
|
|
@@ -8446,7 +8466,7 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
|
|
|
8446
8466
|
url.searchParams.set(search_query_param_name_, title);
|
|
8447
8467
|
return $b8700779b3e745de$export$1efe1013da60d0e4(e, url.href);
|
|
8448
8468
|
}));
|
|
8449
|
-
} else if (selected_entry?.type == "
|
|
8469
|
+
} else if (selected_entry?.type == "listing" || selected_entry?.type === "content") $5vyXB$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
|
|
8450
8470
|
const {
|
|
8451
8471
|
page_url: page_url
|
|
8452
8472
|
} = selected_entry;
|
|
@@ -8900,7 +8920,7 @@ function $04048c1bef16c249$export$c05a196222ba1302({
|
|
|
8900
8920
|
suggestions_: suggestions_,
|
|
8901
8921
|
children: children
|
|
8902
8922
|
}) {
|
|
8903
|
-
const category_suggestions_ = $5vyXB$solidjs.createMemo(() => suggestions_()?.suggestions.filter(s => s.type === "
|
|
8923
|
+
const category_suggestions_ = $5vyXB$solidjs.createMemo(() => suggestions_()?.suggestions.filter(s => s.type === "listing"));
|
|
8904
8924
|
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
8905
8925
|
get when() {
|
|
8906
8926
|
return category_suggestions_()?.length || suggestions_.loading;
|