@depict-ai/ui 4.8.4 → 4.8.6
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 +85 -34
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +85 -34
- package/latest/index.cjs +78 -18
- package/latest/index.d.ts +1 -1
- package/latest/index.js +78 -18
- package/package.json +1 -1
- package/server/ES10/index.cjs +85 -34
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +85 -34
- package/server/latest/index.cjs +78 -18
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +78 -18
package/server/latest/index.cjs
CHANGED
|
@@ -108,7 +108,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
|
|
|
108
108
|
$parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
|
|
109
109
|
$parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
|
|
110
110
|
/*! Depict.ai search and product listing SDK */
|
|
111
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.
|
|
111
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.6";
|
|
112
112
|
function $128302ab61dab8f1$export$54c6d6ff54e72743(whatToWatch) {
|
|
113
113
|
const [width, setWidth] = $5vyXB$solidjs.createSignal(0);
|
|
114
114
|
const [height, setHeight] = $5vyXB$solidjs.createSignal(0);
|
|
@@ -2616,10 +2616,10 @@ function $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
|
|
|
2616
2616
|
i18n_: i18n_
|
|
2617
2617
|
}) {
|
|
2618
2618
|
return $5vyXB$solidjs.createMemo(() => {
|
|
2619
|
-
const
|
|
2620
|
-
if (isNaN(
|
|
2619
|
+
const numberToFormat = number_();
|
|
2620
|
+
if (isNaN(numberToFormat)) return "";
|
|
2621
2621
|
const price_formatting = i18n_.price_formatting_();
|
|
2622
|
-
return $5vyXB$depictaiutilishared.standard_price_format(
|
|
2622
|
+
return $5vyXB$depictaiutilishared.standard_price_format(numberToFormat, 0,
|
|
2623
2623
|
// we never want places after comma here it looks weird as hell
|
|
2624
2624
|
price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
2625
2625
|
});
|
|
@@ -3431,7 +3431,8 @@ function $66b8b9a9613c141d$export$b94867ecbd698f21({
|
|
|
3431
3431
|
return isNewModal || !searchFieldEmpty() ? "" : "display: none";
|
|
3432
3432
|
}
|
|
3433
3433
|
}, () => searchFieldEmpty() ? {
|
|
3434
|
-
"aria-hidden": "true"
|
|
3434
|
+
"aria-hidden": "true",
|
|
3435
|
+
tabIndex: -1
|
|
3435
3436
|
} : {
|
|
3436
3437
|
title: i18n_.clear_filters_query_sorting_after_submit_()
|
|
3437
3438
|
}), () => isNewModal ? $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
@@ -4480,7 +4481,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
|
|
|
4480
4481
|
// total number of results = content results + product results + category suggestions
|
|
4481
4482
|
const totalNumberResults = $5vyXB$solidjs.createMemo(() => {
|
|
4482
4483
|
const results = get_modal_search_results_()?.();
|
|
4483
|
-
|
|
4484
|
+
// Show actual number of result (more accurate) if there's no cursor (backend doesn't have more products)
|
|
4485
|
+
const hits = results?.cursor ? results?.n_hits : results?.displays?.length;
|
|
4484
4486
|
const content_results = content_search_enabled_() && results?.content_search_links?.length || 0;
|
|
4485
4487
|
const category_results = listing_suggestions_()?.length || 0;
|
|
4486
4488
|
return (hits ?? 0) + content_results + category_results;
|
|
@@ -4862,6 +4864,7 @@ async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_
|
|
|
4862
4864
|
close_modal_: close_modal_
|
|
4863
4865
|
};
|
|
4864
4866
|
}
|
|
4867
|
+
let $6e22b5314fb52f4c$export$68620bd6d5c6bb86;
|
|
4865
4868
|
function $6e22b5314fb52f4c$export$e183a13865960371(params_to_default_value, router_) {
|
|
4866
4869
|
const signals = {};
|
|
4867
4870
|
const entries = Object.entries(params_to_default_value);
|
|
@@ -4893,6 +4896,10 @@ function $6e22b5314fb52f4c$export$e183a13865960371(params_to_default_value, rout
|
|
|
4893
4896
|
}
|
|
4894
4897
|
}
|
|
4895
4898
|
if (signal_changed) router_.navigate_.replace_state_(state);
|
|
4899
|
+
$5vyXB$solidjs.onCleanup(() => $6e22b5314fb52f4c$export$68620bd6d5c6bb86 = {
|
|
4900
|
+
time: new Date().toISOString(),
|
|
4901
|
+
stack: new Error().stack
|
|
4902
|
+
});
|
|
4896
4903
|
});
|
|
4897
4904
|
// history_dot_state_to_state needs to update after its signals after url_state does BUT in the same task (might even have to be in the same tick in the microtask queue). If we'd use window.addEventListener("popstate") it would be guaranteed to be too late since each event listener has its own task
|
|
4898
4905
|
(0, $5vyXB$depictaiutilishared.instant_exec_on_suspect_history_change).add(event_handler);
|
|
@@ -7495,7 +7502,15 @@ function $70482f04605572e2$export$b288c38ae3fddb56({
|
|
|
7495
7502
|
selected_filters_: [read_selected_filters]
|
|
7496
7503
|
}) {
|
|
7497
7504
|
let last_remote_state;
|
|
7505
|
+
let executions = 0;
|
|
7506
|
+
let oneSecondInfiniteLoopPreventionTimeout;
|
|
7498
7507
|
$5vyXB$solidjs.createComputed(() => {
|
|
7508
|
+
// Sometimes (24 events in sentry, https://depictai-0o.sentry.io/issues/?project=5476183&query=is%3Aunresolved+filters+failed&referrer=issue-list&statsPeriod=14d), for some inexplicable reason, this computation infinite loops
|
|
7509
|
+
// I spent a 1h17min debug session with MadePeople in a tab where they could reproduce
|
|
7510
|
+
// Observations were that of the signal read_local_cache the observers at some point randomly started having this computation first instead of the effect that writes the value to the history
|
|
7511
|
+
// It's VERY HARD to get a tab in a state where it can be reproduced, like with the exact same circumstances it happens "once a day" for them and there's no noticable pattern. But when a tab is found, it can be reliably reproduced by going backwards/forwards.
|
|
7512
|
+
// Also we reliably clean up and dispose of the search page and the effect of history_dot_state_to_state stays in the signals' observers, but for some reason it disappears when the bug happens (onCleanup doesn't get called then either, if I debugged that correctly)
|
|
7513
|
+
// As a value first workaround, we just recognise when the computation has been executed "too often" and just start not doing anything after that
|
|
7499
7514
|
const remote_filters = Object.fromEntries(available_filters_()?.map(filter => [JSON.stringify([filter.field, filter.op, filter?.meta?.type]), filter]) || []);
|
|
7500
7515
|
const local_filters = Object.fromEntries(read_local_cache().map(filter => [JSON.stringify([filter.field, filter.op, filter?.meta?.type]), filter]));
|
|
7501
7516
|
const selected_filters = Object.fromEntries(read_selected_filters().map(filter_obj => [JSON.stringify([filter_obj.field, filter_obj.op]), filter_obj]));
|
|
@@ -7578,9 +7593,34 @@ function $70482f04605572e2$export$b288c38ae3fddb56({
|
|
|
7578
7593
|
}
|
|
7579
7594
|
if (last_remote_state !== available_filters_() ||
|
|
7580
7595
|
// we HAVE to update the local filter state (it can contain same info but needs to be different object reference) every time the API state changes, otherwise the CheckboxHierarchicalFilter component doesn't update
|
|
7581
|
-
|
|
7582
|
-
|
|
7596
|
+
// Sorry……… They're not that big
|
|
7597
|
+
JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) {
|
|
7598
|
+
const owner = $5vyXB$solidjs.getOwner();
|
|
7599
|
+
const signal = owner?.sources?.find?.(source => source.value === read_local_cache());
|
|
7600
|
+
if (executions > 30) {
|
|
7601
|
+
// We're probably in an infinite loop, let's just stop
|
|
7602
|
+
$5vyXB$depictaiutilishared.report(new Error("Infinite loop detected in create_modified_filters"), "error", {
|
|
7603
|
+
executions: executions,
|
|
7604
|
+
new_local_filter_state: new_local_filter_state,
|
|
7605
|
+
available_filters: available_filters_(),
|
|
7606
|
+
last_remote_state: last_remote_state,
|
|
7607
|
+
history_length: history.length,
|
|
7608
|
+
location: location.href,
|
|
7609
|
+
foundSignal: !!signal,
|
|
7610
|
+
observerSlots: signal?.observerSlots,
|
|
7611
|
+
observers: signal?.observers?.map?.(o => o?.fn + ""),
|
|
7612
|
+
lastHistoryDotStateToStateCleanupInfo: $6e22b5314fb52f4c$export$68620bd6d5c6bb86
|
|
7613
|
+
});
|
|
7614
|
+
return;
|
|
7615
|
+
}
|
|
7583
7616
|
write_local_cache(new_local_filter_state);
|
|
7617
|
+
// Keep track how many times we wrote this signal
|
|
7618
|
+
executions++;
|
|
7619
|
+
oneSecondInfiniteLoopPreventionTimeout ||= setTimeout($5vyXB$depictaiutilishared.catchify(() => {
|
|
7620
|
+
executions = 0;
|
|
7621
|
+
oneSecondInfiniteLoopPreventionTimeout = undefined;
|
|
7622
|
+
}), 1000);
|
|
7623
|
+
}
|
|
7584
7624
|
last_remote_state = available_filters_();
|
|
7585
7625
|
});
|
|
7586
7626
|
}
|
|
@@ -9291,7 +9331,8 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
|
9291
9331
|
query_base_: query_base_,
|
|
9292
9332
|
depict_api_: depict_api_,
|
|
9293
9333
|
is_loading_: is_loading_,
|
|
9294
|
-
content_blocks_: content_blocks_
|
|
9334
|
+
content_blocks_: content_blocks_,
|
|
9335
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
|
|
9295
9336
|
}) {
|
|
9296
9337
|
// Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
|
|
9297
9338
|
const [get_extra_displays, set_extra_displays_] = $5vyXB$solidjs.createSignal([], {
|
|
@@ -9315,6 +9356,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
|
9315
9356
|
is_loading_: is_loading_,
|
|
9316
9357
|
get_extra_displays: get_extra_displays
|
|
9317
9358
|
});
|
|
9359
|
+
$5vyXB$solidjs.createComputed(() => setCurrentlyLoadedDisplays_(displays_by_key_().size));
|
|
9318
9360
|
$3f08fe2992a2a8ca$export$5e4aed86c12acdd9({
|
|
9319
9361
|
percentage_in_view_: percentage_in_view_,
|
|
9320
9362
|
set_extra_displays_: set_extra_displays_,
|
|
@@ -9452,7 +9494,8 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
9452
9494
|
layout_options_: layout_options_,
|
|
9453
9495
|
id_currently_querying_for_: id_currently_querying_for_,
|
|
9454
9496
|
content_blocks_by_row_: content_blocks_by_row_,
|
|
9455
|
-
ConfiguredScrollStatus_: ConfiguredScrollStatus_
|
|
9497
|
+
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
9498
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
|
|
9456
9499
|
}) {
|
|
9457
9500
|
// The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
|
|
9458
9501
|
const is_loading_ = $5vyXB$solidjs.createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -9577,7 +9620,8 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
9577
9620
|
query_base_: query_base_,
|
|
9578
9621
|
depict_api_: depict_api_,
|
|
9579
9622
|
is_loading_: is_loading_,
|
|
9580
|
-
content_blocks_: content_blocks_
|
|
9623
|
+
content_blocks_: content_blocks_,
|
|
9624
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
|
|
9581
9625
|
});
|
|
9582
9626
|
$5vyXB$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
9583
9627
|
return suspense_contents;
|
|
@@ -10869,6 +10913,15 @@ function $5cbaffcb5602e671$export$44f738469d5570cf({
|
|
|
10869
10913
|
};
|
|
10870
10914
|
});
|
|
10871
10915
|
}
|
|
10916
|
+
function $13796d59ea8af231$export$a86bc18439445599(plp_products_, [allProductsLoaded], currentlyLoadedDisplays) {
|
|
10917
|
+
return $5vyXB$solidjs.createMemo(() => {
|
|
10918
|
+
const backendSays = plp_products_()?.n_hits;
|
|
10919
|
+
const loadedAll = allProductsLoaded();
|
|
10920
|
+
if (!backendSays || !loadedAll) return backendSays;
|
|
10921
|
+
// People can remove displays in the displayTransformers, for example houdini do it (https://depictaiworkspace.slack.com/archives/C061H2TF7K4/p1713261063439089). Correct the n_hits as well as possible in that case.
|
|
10922
|
+
return currentlyLoadedDisplays();
|
|
10923
|
+
});
|
|
10924
|
+
}
|
|
10872
10925
|
var $f1d7cb69f839a526$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
10873
10926
|
$f1d7cb69f839a526$var$_tmpl$2 = ["<div", ' class="', '"><div class="listing-page"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
|
|
10874
10927
|
function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
@@ -10909,6 +10962,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
10909
10962
|
}) {
|
|
10910
10963
|
const [get_sorting] = current_sorting_;
|
|
10911
10964
|
const all_products_loaded_ = $5vyXB$solidjs.createSignal(false);
|
|
10965
|
+
const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $5vyXB$solidjs.createSignal(0);
|
|
10912
10966
|
const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
|
|
10913
10967
|
const number_of_rendered_selected_filters_items_ = $5vyXB$solidjs.createSignal(0);
|
|
10914
10968
|
const first_result_in_viewport_ = $5vyXB$solidjs.createSignal();
|
|
@@ -10978,9 +11032,9 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
10978
11032
|
const SafeSearchField = $5vyXB$depictaiutilishared.catchify((0, $66b8b9a9613c141d$export$b94867ecbd698f21));
|
|
10979
11033
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $5vyXB$solidjs.createSignal(false);
|
|
10980
11034
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $5vyXB$solidjs.createSignal();
|
|
10981
|
-
const
|
|
11035
|
+
const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(search_results_, all_products_loaded_, currentlyLoadedDisplays);
|
|
10982
11036
|
const formatted_number_of_results_ = $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
|
|
10983
|
-
number_:
|
|
11037
|
+
number_: countOfProductsForUI,
|
|
10984
11038
|
i18n_: i18n_
|
|
10985
11039
|
});
|
|
10986
11040
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = $5vyXB$solidjs.createSignal();
|
|
@@ -10989,7 +11043,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
10989
11043
|
get type() {
|
|
10990
11044
|
return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).products;
|
|
10991
11045
|
},
|
|
10992
|
-
number_of_results_:
|
|
11046
|
+
number_of_results_: countOfProductsForUI
|
|
10993
11047
|
}, {
|
|
10994
11048
|
get_search_query_: get_search_query_,
|
|
10995
11049
|
i18n_: i18n_,
|
|
@@ -11208,6 +11262,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
11208
11262
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
11209
11263
|
id_currently_querying_for_: get_search_query_,
|
|
11210
11264
|
content_blocks_by_row_: content_blocks_by_row_,
|
|
11265
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
|
|
11211
11266
|
no_results_options_: {
|
|
11212
11267
|
selected_filters_: selected_filters_,
|
|
11213
11268
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -11248,7 +11303,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
11248
11303
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
11249
11304
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
11250
11305
|
i18n_: i18n_,
|
|
11251
|
-
number_of_results_:
|
|
11306
|
+
number_of_results_: countOfProductsForUI
|
|
11252
11307
|
});
|
|
11253
11308
|
}
|
|
11254
11309
|
})), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
@@ -12545,6 +12600,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12545
12600
|
const number_of_rendered_selected_filters_items_ = $5vyXB$solidjs.createSignal(0);
|
|
12546
12601
|
const first_result_in_viewport_ = $5vyXB$solidjs.createSignal();
|
|
12547
12602
|
const last_result_in_viewport_ = $5vyXB$solidjs.createSignal();
|
|
12603
|
+
const all_products_loaded_ = $5vyXB$solidjs.createSignal(false);
|
|
12604
|
+
const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $5vyXB$solidjs.createSignal(0);
|
|
12548
12605
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $5vyXB$solidjs.createSignal(false);
|
|
12549
12606
|
const products_query_base_ = $8cd545330f2674dc$export$210f130a61ac1e8d(() => {
|
|
12550
12607
|
const sort_obj = get_sorting() && {
|
|
@@ -12591,6 +12648,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12591
12648
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
12592
12649
|
const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
|
|
12593
12650
|
const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
|
|
12651
|
+
const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
|
|
12594
12652
|
const available_sortings_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
12595
12653
|
...sort,
|
|
12596
12654
|
order: sort.order ?? "desc"
|
|
@@ -12602,7 +12660,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12602
12660
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $5vyXB$solidjs.createSignal(false);
|
|
12603
12661
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $5vyXB$solidjs.createSignal();
|
|
12604
12662
|
const formatted_number_of_results_ = $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
|
|
12605
|
-
number_:
|
|
12663
|
+
number_: countOfProductsForUI,
|
|
12606
12664
|
i18n_: i18n_
|
|
12607
12665
|
});
|
|
12608
12666
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = $5vyXB$solidjs.createSignal();
|
|
@@ -12623,7 +12681,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12623
12681
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
12624
12682
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
12625
12683
|
i18n_: i18n_,
|
|
12626
|
-
number_of_results_:
|
|
12684
|
+
number_of_results_: countOfProductsForUI,
|
|
12627
12685
|
...extraProps
|
|
12628
12686
|
});
|
|
12629
12687
|
}
|
|
@@ -12641,7 +12699,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12641
12699
|
}
|
|
12642
12700
|
})), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
12643
12701
|
get when() {
|
|
12644
|
-
return
|
|
12702
|
+
return countOfProductsForUI() === 1;
|
|
12645
12703
|
},
|
|
12646
12704
|
get fallback() {
|
|
12647
12705
|
return i18n_.products_();
|
|
@@ -12812,6 +12870,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12812
12870
|
content_blocks_by_row_: contentBlocksByRow,
|
|
12813
12871
|
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
12814
12872
|
id_currently_querying_for_: id_to_query_for_,
|
|
12873
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
|
|
12874
|
+
all_products_loaded_: all_products_loaded_,
|
|
12815
12875
|
no_results_options_: {
|
|
12816
12876
|
selected_filters_: selected_filters_,
|
|
12817
12877
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
package/server/latest/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
|
|
13
13
|
import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
14
|
-
export const version = "4.8.
|
|
14
|
+
export const version = "4.8.6";
|
|
15
15
|
/**
|
|
16
16
|
* Returns two accessors (one width and one height) that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
17
17
|
*/
|
package/server/latest/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { dlog as $i7OB2$dlog, catchify as $i7OB2$catchify1, ListenableSet as $i7
|
|
|
7
7
|
/*! Depict.ai search and product listing SDK */
|
|
8
8
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
9
9
|
register_es_version("ui", "latest");
|
|
10
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "4.8.6";
|
|
11
11
|
function $a444a52bafa0dacc$export$54c6d6ff54e72743(whatToWatch) {
|
|
12
12
|
const [width, setWidth] = $i7OB2$createSignal(0);
|
|
13
13
|
const [height, setHeight] = $i7OB2$createSignal(0);
|
|
@@ -2515,10 +2515,10 @@ function $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
|
|
|
2515
2515
|
i18n_: i18n_
|
|
2516
2516
|
}) {
|
|
2517
2517
|
return $i7OB2$createMemo(() => {
|
|
2518
|
-
const
|
|
2519
|
-
if (isNaN(
|
|
2518
|
+
const numberToFormat = number_();
|
|
2519
|
+
if (isNaN(numberToFormat)) return "";
|
|
2520
2520
|
const price_formatting = i18n_.price_formatting_();
|
|
2521
|
-
return $i7OB2$standard_price_format(
|
|
2521
|
+
return $i7OB2$standard_price_format(numberToFormat, 0,
|
|
2522
2522
|
// we never want places after comma here it looks weird as hell
|
|
2523
2523
|
price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
2524
2524
|
});
|
|
@@ -3330,7 +3330,8 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
|
|
|
3330
3330
|
return isNewModal || !searchFieldEmpty() ? "" : "display: none";
|
|
3331
3331
|
}
|
|
3332
3332
|
}, () => searchFieldEmpty() ? {
|
|
3333
|
-
"aria-hidden": "true"
|
|
3333
|
+
"aria-hidden": "true",
|
|
3334
|
+
tabIndex: -1
|
|
3334
3335
|
} : {
|
|
3335
3336
|
title: i18n_.clear_filters_query_sorting_after_submit_()
|
|
3336
3337
|
}), () => isNewModal ? $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
@@ -4379,7 +4380,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
|
|
|
4379
4380
|
// total number of results = content results + product results + category suggestions
|
|
4380
4381
|
const totalNumberResults = $i7OB2$createMemo(() => {
|
|
4381
4382
|
const results = get_modal_search_results_()?.();
|
|
4382
|
-
|
|
4383
|
+
// Show actual number of result (more accurate) if there's no cursor (backend doesn't have more products)
|
|
4384
|
+
const hits = results?.cursor ? results?.n_hits : results?.displays?.length;
|
|
4383
4385
|
const content_results = content_search_enabled_() && results?.content_search_links?.length || 0;
|
|
4384
4386
|
const category_results = listing_suggestions_()?.length || 0;
|
|
4385
4387
|
return (hits ?? 0) + content_results + category_results;
|
|
@@ -4761,6 +4763,7 @@ async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_
|
|
|
4761
4763
|
close_modal_: close_modal_
|
|
4762
4764
|
};
|
|
4763
4765
|
}
|
|
4766
|
+
let $ca6f574bd8772184$export$68620bd6d5c6bb86;
|
|
4764
4767
|
function $ca6f574bd8772184$export$e183a13865960371(params_to_default_value, router_) {
|
|
4765
4768
|
const signals = {};
|
|
4766
4769
|
const entries = Object.entries(params_to_default_value);
|
|
@@ -4792,6 +4795,10 @@ function $ca6f574bd8772184$export$e183a13865960371(params_to_default_value, rout
|
|
|
4792
4795
|
}
|
|
4793
4796
|
}
|
|
4794
4797
|
if (signal_changed) router_.navigate_.replace_state_(state);
|
|
4798
|
+
$i7OB2$onCleanup(() => $ca6f574bd8772184$export$68620bd6d5c6bb86 = {
|
|
4799
|
+
time: new Date().toISOString(),
|
|
4800
|
+
stack: new Error().stack
|
|
4801
|
+
});
|
|
4795
4802
|
});
|
|
4796
4803
|
// history_dot_state_to_state needs to update after its signals after url_state does BUT in the same task (might even have to be in the same tick in the microtask queue). If we'd use window.addEventListener("popstate") it would be guaranteed to be too late since each event listener has its own task
|
|
4797
4804
|
(0, $i7OB2$instant_exec_on_suspect_history_change).add(event_handler);
|
|
@@ -7394,7 +7401,15 @@ function $5efb5894079b220e$export$b288c38ae3fddb56({
|
|
|
7394
7401
|
selected_filters_: [read_selected_filters]
|
|
7395
7402
|
}) {
|
|
7396
7403
|
let last_remote_state;
|
|
7404
|
+
let executions = 0;
|
|
7405
|
+
let oneSecondInfiniteLoopPreventionTimeout;
|
|
7397
7406
|
$i7OB2$createComputed(() => {
|
|
7407
|
+
// Sometimes (24 events in sentry, https://depictai-0o.sentry.io/issues/?project=5476183&query=is%3Aunresolved+filters+failed&referrer=issue-list&statsPeriod=14d), for some inexplicable reason, this computation infinite loops
|
|
7408
|
+
// I spent a 1h17min debug session with MadePeople in a tab where they could reproduce
|
|
7409
|
+
// Observations were that of the signal read_local_cache the observers at some point randomly started having this computation first instead of the effect that writes the value to the history
|
|
7410
|
+
// It's VERY HARD to get a tab in a state where it can be reproduced, like with the exact same circumstances it happens "once a day" for them and there's no noticable pattern. But when a tab is found, it can be reliably reproduced by going backwards/forwards.
|
|
7411
|
+
// Also we reliably clean up and dispose of the search page and the effect of history_dot_state_to_state stays in the signals' observers, but for some reason it disappears when the bug happens (onCleanup doesn't get called then either, if I debugged that correctly)
|
|
7412
|
+
// As a value first workaround, we just recognise when the computation has been executed "too often" and just start not doing anything after that
|
|
7398
7413
|
const remote_filters = Object.fromEntries(available_filters_()?.map(filter => [JSON.stringify([filter.field, filter.op, filter?.meta?.type]), filter]) || []);
|
|
7399
7414
|
const local_filters = Object.fromEntries(read_local_cache().map(filter => [JSON.stringify([filter.field, filter.op, filter?.meta?.type]), filter]));
|
|
7400
7415
|
const selected_filters = Object.fromEntries(read_selected_filters().map(filter_obj => [JSON.stringify([filter_obj.field, filter_obj.op]), filter_obj]));
|
|
@@ -7477,9 +7492,34 @@ function $5efb5894079b220e$export$b288c38ae3fddb56({
|
|
|
7477
7492
|
}
|
|
7478
7493
|
if (last_remote_state !== available_filters_() ||
|
|
7479
7494
|
// we HAVE to update the local filter state (it can contain same info but needs to be different object reference) every time the API state changes, otherwise the CheckboxHierarchicalFilter component doesn't update
|
|
7480
|
-
|
|
7481
|
-
|
|
7495
|
+
// Sorry……… They're not that big
|
|
7496
|
+
JSON.stringify(new_local_filter_state) !== JSON.stringify(read_local_cache())) {
|
|
7497
|
+
const owner = $i7OB2$getOwner();
|
|
7498
|
+
const signal = owner?.sources?.find?.(source => source.value === read_local_cache());
|
|
7499
|
+
if (executions > 30) {
|
|
7500
|
+
// We're probably in an infinite loop, let's just stop
|
|
7501
|
+
$i7OB2$report(new Error("Infinite loop detected in create_modified_filters"), "error", {
|
|
7502
|
+
executions: executions,
|
|
7503
|
+
new_local_filter_state: new_local_filter_state,
|
|
7504
|
+
available_filters: available_filters_(),
|
|
7505
|
+
last_remote_state: last_remote_state,
|
|
7506
|
+
history_length: history.length,
|
|
7507
|
+
location: location.href,
|
|
7508
|
+
foundSignal: !!signal,
|
|
7509
|
+
observerSlots: signal?.observerSlots,
|
|
7510
|
+
observers: signal?.observers?.map?.(o => o?.fn + ""),
|
|
7511
|
+
lastHistoryDotStateToStateCleanupInfo: $ca6f574bd8772184$export$68620bd6d5c6bb86
|
|
7512
|
+
});
|
|
7513
|
+
return;
|
|
7514
|
+
}
|
|
7482
7515
|
write_local_cache(new_local_filter_state);
|
|
7516
|
+
// Keep track how many times we wrote this signal
|
|
7517
|
+
executions++;
|
|
7518
|
+
oneSecondInfiniteLoopPreventionTimeout ||= setTimeout($i7OB2$catchify(() => {
|
|
7519
|
+
executions = 0;
|
|
7520
|
+
oneSecondInfiniteLoopPreventionTimeout = undefined;
|
|
7521
|
+
}), 1000);
|
|
7522
|
+
}
|
|
7483
7523
|
last_remote_state = available_filters_();
|
|
7484
7524
|
});
|
|
7485
7525
|
}
|
|
@@ -9190,7 +9230,8 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
9190
9230
|
query_base_: query_base_,
|
|
9191
9231
|
depict_api_: depict_api_,
|
|
9192
9232
|
is_loading_: is_loading_,
|
|
9193
|
-
content_blocks_: content_blocks_
|
|
9233
|
+
content_blocks_: content_blocks_,
|
|
9234
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
|
|
9194
9235
|
}) {
|
|
9195
9236
|
// Although typing doesn't reflect it, plp_results is guaranteed to contain an array of at least one display at this point
|
|
9196
9237
|
const [get_extra_displays, set_extra_displays_] = $i7OB2$createSignal([], {
|
|
@@ -9214,6 +9255,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({
|
|
|
9214
9255
|
is_loading_: is_loading_,
|
|
9215
9256
|
get_extra_displays: get_extra_displays
|
|
9216
9257
|
});
|
|
9258
|
+
$i7OB2$createComputed(() => setCurrentlyLoadedDisplays_(displays_by_key_().size));
|
|
9217
9259
|
$056f6ac0a6caa919$export$5e4aed86c12acdd9({
|
|
9218
9260
|
percentage_in_view_: percentage_in_view_,
|
|
9219
9261
|
set_extra_displays_: set_extra_displays_,
|
|
@@ -9351,7 +9393,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
9351
9393
|
layout_options_: layout_options_,
|
|
9352
9394
|
id_currently_querying_for_: id_currently_querying_for_,
|
|
9353
9395
|
content_blocks_by_row_: content_blocks_by_row_,
|
|
9354
|
-
ConfiguredScrollStatus_: ConfiguredScrollStatus_
|
|
9396
|
+
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
9397
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
|
|
9355
9398
|
}) {
|
|
9356
9399
|
// The plp_results_ resource will be delayed because we're using createBatchedMemo to not make triplicate API requests, but we need to show the placeholders before already to match Chrome and Firefox's "content has to be there, ready for scroll restoration, before all popstate tasks have been completed"-requirement
|
|
9357
9400
|
const is_loading_ = $i7OB2$createMemo(() => plp_results_.loading || query_base_.loading);
|
|
@@ -9476,7 +9519,8 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
|
|
|
9476
9519
|
query_base_: query_base_,
|
|
9477
9520
|
depict_api_: depict_api_,
|
|
9478
9521
|
is_loading_: is_loading_,
|
|
9479
|
-
content_blocks_: content_blocks_
|
|
9522
|
+
content_blocks_: content_blocks_,
|
|
9523
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_
|
|
9480
9524
|
});
|
|
9481
9525
|
$i7OB2$onCleanup(() => suspense_contents = undefined);
|
|
9482
9526
|
return suspense_contents;
|
|
@@ -10768,6 +10812,15 @@ function $0e562a5b247b1fc2$export$44f738469d5570cf({
|
|
|
10768
10812
|
};
|
|
10769
10813
|
});
|
|
10770
10814
|
}
|
|
10815
|
+
function $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, [allProductsLoaded], currentlyLoadedDisplays) {
|
|
10816
|
+
return $i7OB2$createMemo(() => {
|
|
10817
|
+
const backendSays = plp_products_()?.n_hits;
|
|
10818
|
+
const loadedAll = allProductsLoaded();
|
|
10819
|
+
if (!backendSays || !loadedAll) return backendSays;
|
|
10820
|
+
// People can remove displays in the displayTransformers, for example houdini do it (https://depictaiworkspace.slack.com/archives/C061H2TF7K4/p1713261063439089). Correct the n_hits as well as possible in that case.
|
|
10821
|
+
return currentlyLoadedDisplays();
|
|
10822
|
+
});
|
|
10823
|
+
}
|
|
10771
10824
|
var $7097477c78a89208$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
10772
10825
|
$7097477c78a89208$var$_tmpl$2 = ["<div", ' class="', '"><div class="listing-page"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
|
|
10773
10826
|
function $7097477c78a89208$export$a54ec244c8863715({
|
|
@@ -10808,6 +10861,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
10808
10861
|
}) {
|
|
10809
10862
|
const [get_sorting] = current_sorting_;
|
|
10810
10863
|
const all_products_loaded_ = $i7OB2$createSignal(false);
|
|
10864
|
+
const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $i7OB2$createSignal(0);
|
|
10811
10865
|
const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
|
|
10812
10866
|
const number_of_rendered_selected_filters_items_ = $i7OB2$createSignal(0);
|
|
10813
10867
|
const first_result_in_viewport_ = $i7OB2$createSignal();
|
|
@@ -10877,9 +10931,9 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
10877
10931
|
const SafeSearchField = $i7OB2$catchify((0, $5285d2814d0fac0c$export$b94867ecbd698f21));
|
|
10878
10932
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $i7OB2$createSignal(false);
|
|
10879
10933
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $i7OB2$createSignal();
|
|
10880
|
-
const
|
|
10934
|
+
const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(search_results_, all_products_loaded_, currentlyLoadedDisplays);
|
|
10881
10935
|
const formatted_number_of_results_ = $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
|
|
10882
|
-
number_:
|
|
10936
|
+
number_: countOfProductsForUI,
|
|
10883
10937
|
i18n_: i18n_
|
|
10884
10938
|
});
|
|
10885
10939
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = $i7OB2$createSignal();
|
|
@@ -10888,7 +10942,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
10888
10942
|
get type() {
|
|
10889
10943
|
return (0, $f8c929beb82c512b$export$2452208c79fe93ea).products;
|
|
10890
10944
|
},
|
|
10891
|
-
number_of_results_:
|
|
10945
|
+
number_of_results_: countOfProductsForUI
|
|
10892
10946
|
}, {
|
|
10893
10947
|
get_search_query_: get_search_query_,
|
|
10894
10948
|
i18n_: i18n_,
|
|
@@ -11107,6 +11161,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
11107
11161
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
11108
11162
|
id_currently_querying_for_: get_search_query_,
|
|
11109
11163
|
content_blocks_by_row_: content_blocks_by_row_,
|
|
11164
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
|
|
11110
11165
|
no_results_options_: {
|
|
11111
11166
|
selected_filters_: selected_filters_,
|
|
11112
11167
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -11147,7 +11202,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
11147
11202
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
11148
11203
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
11149
11204
|
i18n_: i18n_,
|
|
11150
|
-
number_of_results_:
|
|
11205
|
+
number_of_results_: countOfProductsForUI
|
|
11151
11206
|
});
|
|
11152
11207
|
}
|
|
11153
11208
|
})), $i7OB2$escape($i7OB2$createComponent((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
@@ -12444,6 +12499,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12444
12499
|
const number_of_rendered_selected_filters_items_ = $i7OB2$createSignal(0);
|
|
12445
12500
|
const first_result_in_viewport_ = $i7OB2$createSignal();
|
|
12446
12501
|
const last_result_in_viewport_ = $i7OB2$createSignal();
|
|
12502
|
+
const all_products_loaded_ = $i7OB2$createSignal(false);
|
|
12503
|
+
const [currentlyLoadedDisplays, setCurrentlyLoadedDisplays_] = $i7OB2$createSignal(0);
|
|
12447
12504
|
const [can_write_scroll_restoration_, set_can_write_scroll_restoration] = $i7OB2$createSignal(false);
|
|
12448
12505
|
const products_query_base_ = $587cd61972788655$export$210f130a61ac1e8d(() => {
|
|
12449
12506
|
const sort_obj = get_sorting() && {
|
|
@@ -12490,6 +12547,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12490
12547
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
12491
12548
|
const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify1(query => depict_api_.get_listing(query)));
|
|
12492
12549
|
const contentBlocksByRow = $486360b09f0d5729$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
|
|
12550
|
+
const countOfProductsForUI = $3ef0154d1cf118ed$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
|
|
12493
12551
|
const available_sortings_ = $i7OB2$createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
12494
12552
|
...sort,
|
|
12495
12553
|
order: sort.order ?? "desc"
|
|
@@ -12501,7 +12559,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12501
12559
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $i7OB2$createSignal(false);
|
|
12502
12560
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $i7OB2$createSignal();
|
|
12503
12561
|
const formatted_number_of_results_ = $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
|
|
12504
|
-
number_:
|
|
12562
|
+
number_: countOfProductsForUI,
|
|
12505
12563
|
i18n_: i18n_
|
|
12506
12564
|
});
|
|
12507
12565
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = $i7OB2$createSignal();
|
|
@@ -12522,7 +12580,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12522
12580
|
last_result_in_viewport_: last_result_in_viewport_,
|
|
12523
12581
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
12524
12582
|
i18n_: i18n_,
|
|
12525
|
-
number_of_results_:
|
|
12583
|
+
number_of_results_: countOfProductsForUI,
|
|
12526
12584
|
...extraProps
|
|
12527
12585
|
});
|
|
12528
12586
|
}
|
|
@@ -12540,7 +12598,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12540
12598
|
}
|
|
12541
12599
|
})), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
|
|
12542
12600
|
get when() {
|
|
12543
|
-
return
|
|
12601
|
+
return countOfProductsForUI() === 1;
|
|
12544
12602
|
},
|
|
12545
12603
|
get fallback() {
|
|
12546
12604
|
return i18n_.products_();
|
|
@@ -12711,6 +12769,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12711
12769
|
content_blocks_by_row_: contentBlocksByRow,
|
|
12712
12770
|
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
12713
12771
|
id_currently_querying_for_: id_to_query_for_,
|
|
12772
|
+
setCurrentlyLoadedDisplays_: setCurrentlyLoadedDisplays_,
|
|
12773
|
+
all_products_loaded_: all_products_loaded_,
|
|
12714
12774
|
no_results_options_: {
|
|
12715
12775
|
selected_filters_: selected_filters_,
|
|
12716
12776
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|