@depict-ai/ui 1.3.5 → 1.3.7
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/dist/client/main.cjs +158 -99
- package/dist/client/module.js +158 -99
- package/dist/index.d.ts +12 -3
- package/dist/server/main.cjs +157 -98
- package/dist/server/module.js +157 -98
- package/package.json +1 -1
package/dist/client/main.cjs
CHANGED
|
@@ -44,7 +44,7 @@ $parcel$export(module.exports, "defaultGridSpacing", () => $a3280f0aad997933$exp
|
|
|
44
44
|
$parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$export$c3834fa86c616831);
|
|
45
45
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
46
46
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
47
|
-
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.3.
|
|
47
|
+
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.3.7";
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
@@ -385,18 +385,30 @@ function $6e22b5314fb52f4c$var$history_state_change(signals, entries, state) {
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
|
|
388
|
-
function $26a56f6b44703084$export$9862539c89138352(get_default_values_, router_) {
|
|
389
|
-
const
|
|
388
|
+
function $26a56f6b44703084$export$9862539c89138352({ get_default_values_: get_default_values_ , router_: router_ , prefix_: prefix_ }) {
|
|
389
|
+
const get_prefixed_default_values_ = ()=>{
|
|
390
|
+
const default_values = get_default_values_();
|
|
391
|
+
return Object.fromEntries(Object.entries(default_values).map(([key, value])=>[
|
|
392
|
+
prefix_ + key,
|
|
393
|
+
value
|
|
394
|
+
]));
|
|
395
|
+
};
|
|
396
|
+
const prefixed_state = (0, $6e22b5314fb52f4c$export$e183a13865960371)(get_prefixed_default_values_(), router_);
|
|
390
397
|
const reset_state = ()=>{
|
|
391
|
-
const new_defaults =
|
|
392
|
-
for(const key in
|
|
398
|
+
const new_defaults = get_prefixed_default_values_();
|
|
399
|
+
for(const key in prefixed_state){
|
|
393
400
|
const new_value = new_defaults[key];
|
|
394
|
-
|
|
401
|
+
prefixed_state[key][1](new_value);
|
|
395
402
|
}
|
|
396
403
|
};
|
|
404
|
+
let unprefixed_state;
|
|
405
|
+
unprefixed_state = Object.fromEntries(Object.entries(prefixed_state).map(([key, value])=>[
|
|
406
|
+
key.slice(prefix_.length),
|
|
407
|
+
value
|
|
408
|
+
]));
|
|
397
409
|
return [
|
|
398
410
|
reset_state,
|
|
399
|
-
|
|
411
|
+
unprefixed_state
|
|
400
412
|
];
|
|
401
413
|
}
|
|
402
414
|
|
|
@@ -453,7 +465,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
453
465
|
]
|
|
454
466
|
});
|
|
455
467
|
this.#guard_url_creator_length(category_suggestions, page_urls);
|
|
456
|
-
while(page_urls.length)
|
|
468
|
+
while(page_urls.length)// Copy over getters so we sneakily can make this reactive
|
|
469
|
+
Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
|
|
457
470
|
return response;
|
|
458
471
|
}
|
|
459
472
|
async #run_url_creator_for_rest(merchant1, market1, input_data) {
|
|
@@ -499,7 +512,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
499
512
|
]
|
|
500
513
|
});
|
|
501
514
|
this.#guard_url_creator_length(category_display_array, page_urls);
|
|
502
|
-
for(let i = 0; i < category_display_array.length; i++)
|
|
515
|
+
for(let i = 0; i < category_display_array.length; i++)// Copy over getters so we sneakily can make this reactive
|
|
516
|
+
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
503
517
|
}
|
|
504
518
|
return input_data;
|
|
505
519
|
}
|
|
@@ -4882,10 +4896,8 @@ const $1ab22f2cd39b3061$var$operator_map = {
|
|
|
4882
4896
|
"geq": "≥",
|
|
4883
4897
|
"inrange": "\uD83D\uDD22"
|
|
4884
4898
|
};
|
|
4885
|
-
const $1ab22f2cd39b3061$var$sorting_query_param = "sorting";
|
|
4886
4899
|
const $1ab22f2cd39b3061$var$ascending_token = "\uD83D\uDCC8";
|
|
4887
4900
|
const $1ab22f2cd39b3061$var$descending_token = "\uD83D\uDCC9";
|
|
4888
|
-
const $1ab22f2cd39b3061$var$filter_query_param_prefix = "filter_";
|
|
4889
4901
|
const $1ab22f2cd39b3061$var$range_delimiter = "-";
|
|
4890
4902
|
const $1ab22f2cd39b3061$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
|
|
4891
4903
|
const $1ab22f2cd39b3061$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
|
|
@@ -4951,17 +4963,17 @@ function $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data) {
|
|
|
4951
4963
|
}
|
|
4952
4964
|
return null;
|
|
4953
4965
|
}
|
|
4954
|
-
function $1ab22f2cd39b3061$export$58aa3f171519b6d7(filters, search_params) {
|
|
4966
|
+
function $1ab22f2cd39b3061$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
|
|
4955
4967
|
for (const filter of filters){
|
|
4956
4968
|
const { field: field , op: op , data: data } = filter;
|
|
4957
4969
|
const encoded_data = $1ab22f2cd39b3061$var$encode_filter_data(op, data);
|
|
4958
|
-
search_params.set(
|
|
4970
|
+
search_params.set(filter_query_param_prefix + field + $1ab22f2cd39b3061$var$operator_map[op], encoded_data);
|
|
4959
4971
|
}
|
|
4960
4972
|
}
|
|
4961
|
-
function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params) {
|
|
4973
|
+
function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
|
|
4962
4974
|
const found_filters = [];
|
|
4963
4975
|
for (const key of search_params.keys()){
|
|
4964
|
-
if (!key.startsWith(
|
|
4976
|
+
if (!key.startsWith(filter_query_param_prefix)) continue;
|
|
4965
4977
|
const encoded_data = search_params.get(key);
|
|
4966
4978
|
if (!encoded_data) continue;
|
|
4967
4979
|
for (const op of Object.keys($1ab22f2cd39b3061$var$operator_map)){
|
|
@@ -4969,7 +4981,7 @@ function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params) {
|
|
|
4969
4981
|
if (!key.endsWith(token)) continue;
|
|
4970
4982
|
const data = $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data);
|
|
4971
4983
|
if (!data) continue;
|
|
4972
|
-
const field = key.slice(
|
|
4984
|
+
const field = key.slice(filter_query_param_prefix.length, -token.length);
|
|
4973
4985
|
found_filters.push({
|
|
4974
4986
|
field: field,
|
|
4975
4987
|
op: op,
|
|
@@ -4979,14 +4991,14 @@ function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params) {
|
|
|
4979
4991
|
}
|
|
4980
4992
|
return found_filters;
|
|
4981
4993
|
}
|
|
4982
|
-
function $1ab22f2cd39b3061$export$62acb285a7579555(sorting, search_params) {
|
|
4994
|
+
function $1ab22f2cd39b3061$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
|
|
4983
4995
|
if (!sorting) return;
|
|
4984
4996
|
const { field: field , order: order } = sorting;
|
|
4985
4997
|
const ascending = order === "asc";
|
|
4986
|
-
search_params.set(
|
|
4998
|
+
search_params.set(sorting_query_param, field + (ascending ? $1ab22f2cd39b3061$var$ascending_token : $1ab22f2cd39b3061$var$descending_token));
|
|
4987
4999
|
}
|
|
4988
|
-
function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params) {
|
|
4989
|
-
const encoded_sorting = search_params.get(
|
|
5000
|
+
function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params, sorting_query_param_) {
|
|
5001
|
+
const encoded_sorting = search_params.get(sorting_query_param_);
|
|
4990
5002
|
if (!encoded_sorting) return;
|
|
4991
5003
|
if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$ascending_token)) return {
|
|
4992
5004
|
field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$ascending_token.length),
|
|
@@ -4999,22 +5011,22 @@ function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params) {
|
|
|
4999
5011
|
(0, $57o7A$depictaiutilishared.dlog)("Invalid sorting query param value", encoded_sorting);
|
|
5000
5012
|
return;
|
|
5001
5013
|
}
|
|
5002
|
-
function $1ab22f2cd39b3061$export$
|
|
5014
|
+
function $1ab22f2cd39b3061$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
|
|
5003
5015
|
// We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
|
|
5004
5016
|
const keys = [
|
|
5005
5017
|
...search_params.keys()
|
|
5006
5018
|
];
|
|
5007
|
-
for (const key of keys)if (key.startsWith(
|
|
5019
|
+
for (const key of keys)if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param) search_params.delete(key);
|
|
5008
5020
|
}
|
|
5009
5021
|
const $1ab22f2cd39b3061$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
|
|
5010
|
-
function $1ab22f2cd39b3061$export$43cd1e747fecd42e(
|
|
5011
|
-
if (!
|
|
5012
|
-
const was_url_object =
|
|
5013
|
-
const url_object = was_url_object ?
|
|
5022
|
+
function $1ab22f2cd39b3061$export$43cd1e747fecd42e({ to_url_: to_url_ , set_clearing_flag_: set_clearing_flag_ , from_search_params_: from_search_params_ = new URLSearchParams(location.search) , sorting_query_param_: sorting_query_param_ , filter_query_param_prefix_: filter_query_param_prefix_ }) {
|
|
5023
|
+
if (!to_url_) return to_url_;
|
|
5024
|
+
const was_url_object = to_url_ instanceof URL;
|
|
5025
|
+
const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
|
|
5014
5026
|
const { searchParams: searchParams } = url_object;
|
|
5015
|
-
if (
|
|
5016
|
-
if (
|
|
5017
|
-
for (const key of
|
|
5027
|
+
if (set_clearing_flag_) searchParams.set($1ab22f2cd39b3061$export$cf5feb2102aec7f2, "true");
|
|
5028
|
+
if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
|
|
5029
|
+
for (const key of from_search_params_.keys())if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
|
|
5018
5030
|
if (was_url_object) return url_object;
|
|
5019
5031
|
return url_object.href;
|
|
5020
5032
|
}
|
|
@@ -5022,7 +5034,7 @@ function $1ab22f2cd39b3061$export$43cd1e747fecd42e(to_url, set_clearing_flag, fr
|
|
|
5022
5034
|
|
|
5023
5035
|
|
|
5024
5036
|
const $e53b2e7e632ac4cb$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<nav class="crumbs"></nav>`, 2), $e53b2e7e632ac4cb$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<a class="crumb"></a>`, 2), $e53b2e7e632ac4cb$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<span class="separator"></span>`, 2);
|
|
5025
|
-
function $e53b2e7e632ac4cb$export$5646050d516e06bc({ crumb_data_: get_api_crumb_data , router_: router_ , i18n_: i18n_ }) {
|
|
5037
|
+
function $e53b2e7e632ac4cb$export$5646050d516e06bc({ crumb_data_: get_api_crumb_data , router_: router_ , i18n_: i18n_ , filter_query_param_prefix_: filter_query_param_prefix_ , sorting_query_param_: sorting_query_param_ }) {
|
|
5026
5038
|
const placeholder_crumb_data = [
|
|
5027
5039
|
,
|
|
5028
5040
|
,
|
|
@@ -5039,7 +5051,11 @@ function $e53b2e7e632ac4cb$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
5039
5051
|
return crumb_data();
|
|
5040
5052
|
},
|
|
5041
5053
|
children: (display_accessor, index)=>{
|
|
5042
|
-
const href = (0, $57o7A$solidjs.createMemo)(()=>(0, $1ab22f2cd39b3061$export$43cd1e747fecd42e)(
|
|
5054
|
+
const href = (0, $57o7A$solidjs.createMemo)(()=>(0, $1ab22f2cd39b3061$export$43cd1e747fecd42e)({
|
|
5055
|
+
to_url_: display_accessor()?.page_url,
|
|
5056
|
+
filter_query_param_prefix_: filter_query_param_prefix_,
|
|
5057
|
+
sorting_query_param_: sorting_query_param_
|
|
5058
|
+
}));
|
|
5043
5059
|
return [
|
|
5044
5060
|
(0, $57o7A$solidjsweb.createComponent)((0, $57o7A$solidjs.Show), {
|
|
5045
5061
|
get when () {
|
|
@@ -5104,7 +5120,7 @@ function $e53b2e7e632ac4cb$export$5646050d516e06bc({ crumb_data_: get_api_crumb_
|
|
|
5104
5120
|
|
|
5105
5121
|
|
|
5106
5122
|
const $8cceb1d3a967f369$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<nav class="quicklinks"></nav>`, 2), $8cceb1d3a967f369$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div>QuickLinks failed</div>`, 2), $8cceb1d3a967f369$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<a class="quicklink"></a>`, 2);
|
|
5107
|
-
function $8cceb1d3a967f369$export$466cdc317043f6cb({ quicklinks_data_: quicklinks_data_ , router_: router_ , current_query_id_: current_query_id_ , breadcrumb_data_: breadcrumb_data_ , i18n_: i18n_ }) {
|
|
5123
|
+
function $8cceb1d3a967f369$export$466cdc317043f6cb({ quicklinks_data_: quicklinks_data_ , router_: router_ , current_query_id_: current_query_id_ , breadcrumb_data_: breadcrumb_data_ , i18n_: i18n_ , sorting_query_param_: sorting_query_param_ , filter_query_param_prefix_: filter_query_param_prefix_ }) {
|
|
5108
5124
|
let scrolling_logic_ran_for_query_id = false;
|
|
5109
5125
|
let last_scroll_position;
|
|
5110
5126
|
let scroll_to_element_on_dom_insertion;
|
|
@@ -5239,7 +5255,12 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({ quicklinks_data_: quicklink
|
|
|
5239
5255
|
return quicklinks_data_()?.some(({ query_id: query_id })=>query_id === current_id);
|
|
5240
5256
|
});
|
|
5241
5257
|
const href = (0, $57o7A$solidjs.createMemo)(()=>// 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
|
|
5242
|
-
(0, $1ab22f2cd39b3061$export$43cd1e747fecd42e)(
|
|
5258
|
+
(0, $1ab22f2cd39b3061$export$43cd1e747fecd42e)({
|
|
5259
|
+
to_url_: display_accessor()?.page_url,
|
|
5260
|
+
set_clearing_flag_: is_sibling(),
|
|
5261
|
+
sorting_query_param_: sorting_query_param_,
|
|
5262
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
5263
|
+
}));
|
|
5243
5264
|
return (()=>{
|
|
5244
5265
|
const _el$3 = (0, $57o7A$solidjsweb.getNextElement)($8cceb1d3a967f369$var$_tmpl$3);
|
|
5245
5266
|
(0, $57o7A$solidjsweb.addEventListener)(_el$3, "click", (0, $57o7A$depictaiutilishared.catchify)((ev)=>{
|
|
@@ -5484,7 +5505,7 @@ function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
5484
5505
|
|
|
5485
5506
|
|
|
5486
5507
|
|
|
5487
|
-
const $839b3341523d31a2$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="statement">No category ID specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a category ID in your Depict Provider.</div>`, 2), $839b3341523d31a2$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="buttons"><button class="ok major"></button></div>`, 4);
|
|
5508
|
+
const $839b3341523d31a2$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="statement" style="white-space:pre-wrap">No category ID specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a category ID in your Depict Provider.</div>`, 2), $839b3341523d31a2$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="buttons"><button class="ok major"></button></div>`, 4);
|
|
5488
5509
|
function $839b3341523d31a2$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
5489
5510
|
if (!(0, $57o7A$depictaiutilishared.is_debug)) return; // Just to make sure we don't show this in production
|
|
5490
5511
|
const owner = (0, $57o7A$solidjs.getOwner)();
|
|
@@ -5525,7 +5546,7 @@ const $6b502b1b2155a0bc$export$5c28802497c8a83c = /*@__PURE__*/ Symbol("category
|
|
|
5525
5546
|
|
|
5526
5547
|
|
|
5527
5548
|
const $840d88a04b2d22a7$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="product-count"><!#><!/> <!#><!/></div>`, 6), $840d88a04b2d22a7$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div></div>`, 2), $840d88a04b2d22a7$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="filter-results-for-one-row"><!#><!/><!#><!/></div>`, 6), $840d88a04b2d22a7$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="depict plp category"><div class="listing-page"><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/></div><!#><!/><!#><!/></div>`, 20);
|
|
5528
|
-
function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , listing_type_: listing_type_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ }) {
|
|
5549
|
+
function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , listing_type_: listing_type_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ , sorting_query_param_: sorting_query_param_ , filter_query_param_prefix_: filter_query_param_prefix_ }) {
|
|
5529
5550
|
let results_for;
|
|
5530
5551
|
let only_show_filters_opener_;
|
|
5531
5552
|
let middle_elements_;
|
|
@@ -5721,7 +5742,9 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
5721
5742
|
return (0, $57o7A$solidjsweb.createComponent)((0, $e53b2e7e632ac4cb$export$5646050d516e06bc), {
|
|
5722
5743
|
crumb_data_: crumb_data_,
|
|
5723
5744
|
router_: router_,
|
|
5724
|
-
i18n_: i18n_
|
|
5745
|
+
i18n_: i18n_,
|
|
5746
|
+
sorting_query_param_: sorting_query_param_,
|
|
5747
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
5725
5748
|
});
|
|
5726
5749
|
}
|
|
5727
5750
|
}), _el$16, _co$5);
|
|
@@ -5735,7 +5758,9 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
5735
5758
|
current_query_id_: query_id_,
|
|
5736
5759
|
router_: router_,
|
|
5737
5760
|
breadcrumb_data_: crumb_data_,
|
|
5738
|
-
i18n_: i18n_
|
|
5761
|
+
i18n_: i18n_,
|
|
5762
|
+
sorting_query_param_: sorting_query_param_,
|
|
5763
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
5739
5764
|
});
|
|
5740
5765
|
}
|
|
5741
5766
|
}), _el$18, _co$6);
|
|
@@ -5978,19 +6003,20 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
|
5978
6003
|
const [get_current_href, set_current_href] = (0, $57o7A$solidjs.createSignal)(globalThis?.location?.href ?? "https://example.com");
|
|
5979
6004
|
const history_change_handler = (0, $57o7A$depictaiutilishared.catchify)(()=>set_current_href(location.href));
|
|
5980
6005
|
const owner = (0, $57o7A$solidjs.getOwner)() || (0, $57o7A$solidjs.createRoot)(()=>(0, $57o7A$solidjs.getOwner)());
|
|
6006
|
+
const { sorting_query_param_: sorting_query_param_ , filter_query_param_prefix_: filter_query_param_prefix_ } = options;
|
|
5981
6007
|
let writer_started = false;
|
|
5982
6008
|
(0, $57o7A$depictaiutilishared.instant_exec_on_suspect_history_change).add(history_change_handler);
|
|
5983
6009
|
(0, $57o7A$solidjs.onCleanup)(()=>(0, $57o7A$depictaiutilishared.instant_exec_on_suspect_history_change).delete(history_change_handler));
|
|
5984
6010
|
(0, $57o7A$solidjs.createComputed)(()=>{
|
|
5985
6011
|
const { searchParams: searchParams } = new URL(get_current_href());
|
|
5986
6012
|
(0, $57o7A$solidjs.batch)(()=>{
|
|
5987
|
-
const found_sorting = (0, $1ab22f2cd39b3061$export$766e9676e74997d3)(searchParams);
|
|
6013
|
+
const found_sorting = (0, $1ab22f2cd39b3061$export$766e9676e74997d3)(searchParams, sorting_query_param_);
|
|
5988
6014
|
if (found_sorting) {
|
|
5989
6015
|
const current_sorting = (0, $57o7A$solidjs.untrack)(get_sorting_);
|
|
5990
6016
|
// Do some diffing since we might assume in certain places of the code that if the signal changes it means the sorting has changed
|
|
5991
6017
|
if (current_sorting?.field !== found_sorting.field || current_sorting?.order !== found_sorting.order) set_sorting(found_sorting);
|
|
5992
6018
|
} else set_sorting();
|
|
5993
|
-
const found_filters = (0, $1ab22f2cd39b3061$export$f934fa24c3a86811)(searchParams);
|
|
6019
|
+
const found_filters = (0, $1ab22f2cd39b3061$export$f934fa24c3a86811)(searchParams, filter_query_param_prefix_);
|
|
5994
6020
|
const selected_filters = (0, $57o7A$solidjs.untrack)(get_selected_filters_);
|
|
5995
6021
|
const found_filters_map = new Map(found_filters.map(({ field: field , op: op , data: data })=>[
|
|
5996
6022
|
JSON.stringify([
|
|
@@ -6015,7 +6041,9 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
|
6015
6041
|
get_sorting_: get_sorting_,
|
|
6016
6042
|
get_selected_filters_: get_selected_filters_,
|
|
6017
6043
|
router_: router_,
|
|
6018
|
-
get_has_sideways_filter_clearing_flag_: get_has_sideways_filter_clearing_flag_
|
|
6044
|
+
get_has_sideways_filter_clearing_flag_: get_has_sideways_filter_clearing_flag_,
|
|
6045
|
+
sorting_query_param_: sorting_query_param_,
|
|
6046
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
6019
6047
|
}));
|
|
6020
6048
|
writer_started = true;
|
|
6021
6049
|
}
|
|
@@ -6034,7 +6062,7 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
|
6034
6062
|
}
|
|
6035
6063
|
/**
|
|
6036
6064
|
* Writes the sorting and filters to the URL query parameters when they change.
|
|
6037
|
-
*/ function $c79fd10a3ab7d6e0$var$start_href_writer({ get_sorting_: get_sorting_ , get_selected_filters_: get_selected_filters_ , router_: router_ , get_has_sideways_filter_clearing_flag_: get_has_sideways_filter_clearing_flag_ }) {
|
|
6065
|
+
*/ function $c79fd10a3ab7d6e0$var$start_href_writer({ get_sorting_: get_sorting_ , get_selected_filters_: get_selected_filters_ , router_: router_ , get_has_sideways_filter_clearing_flag_: get_has_sideways_filter_clearing_flag_ , sorting_query_param_: sorting_query_param_ , filter_query_param_prefix_: filter_query_param_prefix_ }) {
|
|
6038
6066
|
(0, $57o7A$solidjs.createEffect)((0, $57o7A$solidjs.on)([
|
|
6039
6067
|
get_sorting_,
|
|
6040
6068
|
get_selected_filters_,
|
|
@@ -6043,9 +6071,9 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
|
|
|
6043
6071
|
const current_href = location.href;
|
|
6044
6072
|
const url_object = new URL(current_href);
|
|
6045
6073
|
const { searchParams: searchParams } = url_object;
|
|
6046
|
-
(0, $1ab22f2cd39b3061$export$
|
|
6047
|
-
(0, $1ab22f2cd39b3061$export$62acb285a7579555)(sorting, searchParams);
|
|
6048
|
-
(0, $1ab22f2cd39b3061$export$58aa3f171519b6d7)(filters, searchParams);
|
|
6074
|
+
(0, $1ab22f2cd39b3061$export$916e6850778505f6)(searchParams, filter_query_param_prefix_, sorting_query_param_);
|
|
6075
|
+
(0, $1ab22f2cd39b3061$export$62acb285a7579555)(sorting, searchParams, sorting_query_param_);
|
|
6076
|
+
(0, $1ab22f2cd39b3061$export$58aa3f171519b6d7)(filters, searchParams, filter_query_param_prefix_);
|
|
6049
6077
|
if (!has_sideways_filter_clearing_flag) $c79fd10a3ab7d6e0$var$delete_sideways_param_flag(searchParams);
|
|
6050
6078
|
// We can't just check if the URL is equal since sometimes the order of the parameters in the URL changes (randomly?) so we need to compare them one by one
|
|
6051
6079
|
const unmodified_search_params = [
|
|
@@ -6076,6 +6104,8 @@ function $c79fd10a3ab7d6e0$var$delete_sideways_param_flag(searchParams) {
|
|
|
6076
6104
|
class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
6077
6105
|
/**
|
|
6078
6106
|
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
6107
|
+
*/ /**
|
|
6108
|
+
* We store query_id in history.state and do operate on this both here and in js-ui, this is the key to be used which js-ui provides
|
|
6079
6109
|
*/ #throwing_on_navigation(...args) {
|
|
6080
6110
|
const { on_navigation_: on_navigation_ } = this;
|
|
6081
6111
|
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
@@ -6138,8 +6168,11 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
6138
6168
|
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
6139
6169
|
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
6140
6170
|
const new_state = history.state;
|
|
6141
|
-
if (category_query_id_)
|
|
6142
|
-
|
|
6171
|
+
if (category_query_id_) {
|
|
6172
|
+
// In JS-UI we need to know the query_id of the current category, therefore push it into state
|
|
6173
|
+
if (!this.query_id_state_key) (0, $57o7A$depictaiutilishared.report)(new Error("query_id_state_key is not set"), "error");
|
|
6174
|
+
new_state[this.query_id_state_key] = category_query_id_;
|
|
6175
|
+
}
|
|
6143
6176
|
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
6144
6177
|
} else this.#throwing_on_navigation.call(this, {
|
|
6145
6178
|
is_replace: is_replace_,
|
|
@@ -6149,7 +6182,8 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
|
|
|
6149
6182
|
await promise;
|
|
6150
6183
|
})
|
|
6151
6184
|
};
|
|
6152
|
-
constructor(on_navigation){
|
|
6185
|
+
constructor(on_navigation, query_id_state_key){
|
|
6186
|
+
this.query_id_state_key = query_id_state_key;
|
|
6153
6187
|
this.on_navigation_ = on_navigation;
|
|
6154
6188
|
}
|
|
6155
6189
|
}
|
|
@@ -6166,13 +6200,13 @@ const $48567ac5b39bac56$var$InExternalAreaDiv = ({ children: children })=>(()=>
|
|
|
6166
6200
|
return _el$;
|
|
6167
6201
|
})();
|
|
6168
6202
|
class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
6169
|
-
#router
|
|
6203
|
+
#router;
|
|
6170
6204
|
#locale_signal = (0, $57o7A$solidjs.createSignal)();
|
|
6171
6205
|
#merchant_signal = (0, $57o7A$solidjs.createSignal)();
|
|
6172
6206
|
#market_signal = (0, $57o7A$solidjs.createSignal)();
|
|
6173
6207
|
#query_id_signal = (0, $57o7A$solidjs.createSignal)("");
|
|
6174
6208
|
#listing_type_signal = (0, $57o7A$solidjs.createSignal)();
|
|
6175
|
-
static #
|
|
6209
|
+
static #keys_constructed_with = [];
|
|
6176
6210
|
get localization() {
|
|
6177
6211
|
// allow reactive access
|
|
6178
6212
|
return this.#locale_signal[0]();
|
|
@@ -6211,27 +6245,35 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
6211
6245
|
set on_navigation(new_function) {
|
|
6212
6246
|
this.#router.on_navigation_ = new_function;
|
|
6213
6247
|
}
|
|
6214
|
-
constructor({ api: api , on_navigation: on_navigation , page_url_creator: page_url_creator , ...props_on_class }){
|
|
6248
|
+
constructor({ api: api , on_navigation: on_navigation , page_url_creator: page_url_creator , unique_instance_key_for_state: unique_instance_key_for_state = "" , query_id_state_key: query_id_state_key , ...props_on_class }){
|
|
6215
6249
|
const owner = (0, $57o7A$solidjs.getOwner)() || (0, $57o7A$solidjs.createRoot)(()=>(0, $57o7A$solidjs.getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
|
|
6216
6250
|
(0, $57o7A$solidjs.runWithOwner)(owner, ()=>{
|
|
6217
|
-
if ($48567ac5b39bac56$export$f34314aa9505732e.#
|
|
6251
|
+
if ($48567ac5b39bac56$export$f34314aa9505732e.#keys_constructed_with.includes(unique_instance_key_for_state) && !(0, $57o7A$solidjsweb.isServer)) // on the server we can't write stuff to history.state anyway so can have multiple
|
|
6218
6252
|
throw new Error("You can only have one instance of DepictCategory due to state limitations");
|
|
6219
|
-
$48567ac5b39bac56$export$f34314aa9505732e.#has_been_constructed = true;
|
|
6220
6253
|
Object.assign(this, props_on_class); // set initial signal values
|
|
6221
6254
|
(0, $d84fe647b84b5dc5$export$5162a71f252e6122)();
|
|
6255
|
+
this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", query_id_state_key);
|
|
6222
6256
|
if (on_navigation) this.#router.on_navigation_ = on_navigation;
|
|
6257
|
+
const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
|
|
6258
|
+
const filter_query_param_prefix_ = "filter" + unique_instance_key_for_state + "_";
|
|
6223
6259
|
const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ } = (0, $c79fd10a3ab7d6e0$export$477caf01aecaeb2a)({
|
|
6224
|
-
router_: this.#router
|
|
6260
|
+
router_: this.#router,
|
|
6261
|
+
sorting_query_param_: sorting_query_param_,
|
|
6262
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
6263
|
+
});
|
|
6264
|
+
const [reset_history_state_, state_] = (0, $26a56f6b44703084$export$9862539c89138352)({
|
|
6265
|
+
get_default_values_: ()=>({
|
|
6266
|
+
filters_open: false,
|
|
6267
|
+
sorting_open: false,
|
|
6268
|
+
expanded_filters: [],
|
|
6269
|
+
// Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
|
|
6270
|
+
local_filter_cache: [],
|
|
6271
|
+
expanded_hierarchical_filters: [],
|
|
6272
|
+
scroll_restoration_data: []
|
|
6273
|
+
}),
|
|
6274
|
+
router_: this.#router,
|
|
6275
|
+
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
6225
6276
|
});
|
|
6226
|
-
const [reset_history_state_, state_] = (0, $26a56f6b44703084$export$9862539c89138352)(()=>({
|
|
6227
|
-
category_filters_open: false,
|
|
6228
|
-
category_sorting_open: false,
|
|
6229
|
-
category_expanded_filters: [],
|
|
6230
|
-
// Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
|
|
6231
|
-
category_local_filter_cache: [],
|
|
6232
|
-
category_expanded_hierarchical_filters: [],
|
|
6233
|
-
category_scroll_restoration_data: []
|
|
6234
|
-
}), this.#router);
|
|
6235
6277
|
const i18n_ = (0, $0785f4c9947d9b5f$export$f091cbac892643a4)(this.#locale_signal[0]);
|
|
6236
6278
|
$48567ac5b39bac56$var$privately_shared_properties.set(this, {
|
|
6237
6279
|
state_: state_,
|
|
@@ -6245,8 +6287,11 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
6245
6287
|
router_: this.#router,
|
|
6246
6288
|
selected_filters_: selected_filters_,
|
|
6247
6289
|
current_sorting_: current_sorting_,
|
|
6248
|
-
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
|
|
6290
|
+
sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
|
|
6291
|
+
sorting_query_param_: sorting_query_param_,
|
|
6292
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
6249
6293
|
});
|
|
6294
|
+
$48567ac5b39bac56$export$f34314aa9505732e.#keys_constructed_with.push(unique_instance_key_for_state);
|
|
6250
6295
|
});
|
|
6251
6296
|
}
|
|
6252
6297
|
}
|
|
@@ -6263,7 +6308,7 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
|
|
|
6263
6308
|
grid_spacing: grid_spacing.horizontal
|
|
6264
6309
|
};
|
|
6265
6310
|
});
|
|
6266
|
-
const { state_: {
|
|
6311
|
+
const { state_: { local_filter_cache: local_filter_cache_ , filters_open: category_filters_open_ , sorting_open: category_sorting_open_ , expanded_filters: expanded_filters_ , expanded_hierarchical_filters: expanded_hierarchical_filters_ , scroll_restoration_data: scroll_restoration_data_ } , current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , reset_history_state_: reset_history_state_ , depict_api_: depict_api_ , i18n_: i18n_ , router_: router_ , breadcrumb_signal_: breadcrumb_signal_ , quicklinks_signal_: quicklinks_signal_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ , sorting_query_param_: sorting_query_param_ , filter_query_param_prefix_: filter_query_param_prefix_ } = shared_properties;
|
|
6267
6312
|
(0, $57o7A$solidjs.onCleanup)(reset_history_state_);
|
|
6268
6313
|
return (0, $840d88a04b2d22a7$export$f7d2f673fc2f091d)({
|
|
6269
6314
|
tenant_: ()=>depict_category.merchant,
|
|
@@ -6292,24 +6337,28 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
|
|
|
6292
6337
|
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(props.cols_at_size),
|
|
6293
6338
|
...grid_spacing_override()
|
|
6294
6339
|
})),
|
|
6295
|
-
product_card_template_: product_card_template
|
|
6340
|
+
product_card_template_: product_card_template,
|
|
6341
|
+
sorting_query_param_: sorting_query_param_,
|
|
6342
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
6296
6343
|
});
|
|
6297
6344
|
}, "Entire CategoryPage failed");
|
|
6298
6345
|
}
|
|
6299
6346
|
function $48567ac5b39bac56$export$5b7c3ce0ebe51f86({ depict_category: depict_category }) {
|
|
6300
|
-
const { i18n_: i18n_ , breadcrumb_signal_: [crumb_data_] , router_: router_ } = $48567ac5b39bac56$var$get_shared_properties(depict_category);
|
|
6347
|
+
const { i18n_: i18n_ , breadcrumb_signal_: [crumb_data_] , router_: router_ , sorting_query_param_: sorting_query_param_ , filter_query_param_prefix_: filter_query_param_prefix_ } = $48567ac5b39bac56$var$get_shared_properties(depict_category);
|
|
6301
6348
|
return (0, $57o7A$solidjsweb.createComponent)($48567ac5b39bac56$var$InExternalAreaDiv, {
|
|
6302
6349
|
get children () {
|
|
6303
6350
|
return (0, $e53b2e7e632ac4cb$export$5646050d516e06bc)({
|
|
6304
6351
|
i18n_: i18n_,
|
|
6305
6352
|
crumb_data_: crumb_data_,
|
|
6306
|
-
router_: router_
|
|
6353
|
+
router_: router_,
|
|
6354
|
+
sorting_query_param_: sorting_query_param_,
|
|
6355
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
6307
6356
|
});
|
|
6308
6357
|
}
|
|
6309
6358
|
});
|
|
6310
6359
|
}
|
|
6311
6360
|
function $48567ac5b39bac56$export$de035477d6fef996({ depict_category: depict_category }) {
|
|
6312
|
-
const { i18n_: i18n_ , quicklinks_signal_: [quicklinks_data_] , breadcrumb_signal_: [breadcrumb_data_] , router_: router_ } = $48567ac5b39bac56$var$get_shared_properties(depict_category);
|
|
6361
|
+
const { i18n_: i18n_ , quicklinks_signal_: [quicklinks_data_] , breadcrumb_signal_: [breadcrumb_data_] , router_: router_ , sorting_query_param_: sorting_query_param_ , filter_query_param_prefix_: filter_query_param_prefix_ } = $48567ac5b39bac56$var$get_shared_properties(depict_category);
|
|
6313
6362
|
return (0, $57o7A$solidjsweb.createComponent)($48567ac5b39bac56$var$InExternalAreaDiv, {
|
|
6314
6363
|
get children () {
|
|
6315
6364
|
return (0, $8cceb1d3a967f369$export$466cdc317043f6cb)({
|
|
@@ -6317,7 +6366,9 @@ function $48567ac5b39bac56$export$de035477d6fef996({ depict_category: depict_cat
|
|
|
6317
6366
|
quicklinks_data_: quicklinks_data_,
|
|
6318
6367
|
router_: router_,
|
|
6319
6368
|
current_query_id_: ()=>depict_category.category_id,
|
|
6320
|
-
breadcrumb_data_: breadcrumb_data_
|
|
6369
|
+
breadcrumb_data_: breadcrumb_data_,
|
|
6370
|
+
sorting_query_param_: sorting_query_param_,
|
|
6371
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
6321
6372
|
});
|
|
6322
6373
|
}
|
|
6323
6374
|
});
|
|
@@ -8643,31 +8694,39 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8643
8694
|
#merchant_signal = (0, $57o7A$solidjs.createSignal)();
|
|
8644
8695
|
#market_signal = (0, $57o7A$solidjs.createSignal)();
|
|
8645
8696
|
#modal_open_signal = (0, $57o7A$solidjs.createSignal)(false);
|
|
8646
|
-
static #
|
|
8697
|
+
static #keys_constructed_with = [];
|
|
8647
8698
|
#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
|
|
8648
|
-
constructor({ search_query_url_param_name: search_query_url_param_name_ = "query" , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true , page_url_creator: page_url_creator , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
8699
|
+
constructor({ unique_instance_key_for_state: unique_instance_key_for_state = "" , search_query_url_param_name: search_query_url_param_name_ = "query" + unique_instance_key_for_state , url_transformer: url_transformer , on_navigation: on_navigation , enable_category_suggestions: enable_category_suggestions = true , page_url_creator: page_url_creator , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
8649
8700
|
disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal: bottom_distance_under_modal , render_instant_card: render_instant_card , ...props_on_class }){
|
|
8650
8701
|
const owner = (0, $57o7A$solidjs.getOwner)() || (0, $57o7A$solidjs.createRoot)(()=>(0, $57o7A$solidjs.getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
|
|
8651
8702
|
(0, $57o7A$solidjs.runWithOwner)(owner, ()=>{
|
|
8652
|
-
if ($2c61e4cd8229c49a$export$ac6237957a15b3f0.#
|
|
8703
|
+
if ($2c61e4cd8229c49a$export$ac6237957a15b3f0.#keys_constructed_with.includes(unique_instance_key_for_state) && !(0, $57o7A$solidjsweb.isServer)) // on the server we can't write stuff to history.state anyway so can have multiple
|
|
8653
8704
|
throw new Error("You can only have one instance of DepictSearch");
|
|
8654
8705
|
Object.assign(this, props_on_class);
|
|
8655
8706
|
if (on_navigation) this.#router.on_navigation_ = on_navigation;
|
|
8707
|
+
const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
|
|
8708
|
+
const filter_query_param_prefix_ = "filter" + unique_instance_key_for_state + "_";
|
|
8656
8709
|
const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , search_query_accessor_: raw_search_query_accessor } = (0, $c79fd10a3ab7d6e0$export$477caf01aecaeb2a)({
|
|
8657
8710
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
8658
|
-
router_: this.#router
|
|
8711
|
+
router_: this.#router,
|
|
8712
|
+
sorting_query_param_: sorting_query_param_,
|
|
8713
|
+
filter_query_param_prefix_: filter_query_param_prefix_
|
|
8714
|
+
});
|
|
8715
|
+
const [reset_history_state_, state_] = (0, $26a56f6b44703084$export$9862539c89138352)({
|
|
8716
|
+
get_default_values_: ()=>({
|
|
8717
|
+
field_value: (globalThis?.location && new URLSearchParams(location.search).get(search_query_url_param_name_)) ?? "",
|
|
8718
|
+
filters_open: false,
|
|
8719
|
+
sorting_open: false,
|
|
8720
|
+
expanded_filters: [],
|
|
8721
|
+
// Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
|
|
8722
|
+
local_filter_cache: [],
|
|
8723
|
+
expanded_hierarchical_filters: [],
|
|
8724
|
+
showing_recommendation_rows: (0, $fb29c6201c369e39$export$1c8c715550dc689d),
|
|
8725
|
+
scroll_restoration_data: []
|
|
8726
|
+
}),
|
|
8727
|
+
router_: this.#router,
|
|
8728
|
+
prefix_: "search" + unique_instance_key_for_state + "_"
|
|
8659
8729
|
});
|
|
8660
|
-
const [reset_history_state_, state_] = (0, $26a56f6b44703084$export$9862539c89138352)(()=>({
|
|
8661
|
-
search_field_value: (globalThis?.location && new URLSearchParams(location.search).get(search_query_url_param_name_)) ?? "",
|
|
8662
|
-
search_filters_open: false,
|
|
8663
|
-
search_sorting_open: false,
|
|
8664
|
-
search_expanded_filters: [],
|
|
8665
|
-
// Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
|
|
8666
|
-
search_local_filter_cache: [],
|
|
8667
|
-
search_expanded_hierarchical_filters: [],
|
|
8668
|
-
search_showing_recommendation_rows: (0, $fb29c6201c369e39$export$1c8c715550dc689d),
|
|
8669
|
-
search_scroll_restoration_data: []
|
|
8670
|
-
}), this.#router);
|
|
8671
8730
|
const search_query_updating_blocked_ = (0, $57o7A$solidjs.createSignal)(false);
|
|
8672
8731
|
const [get_search_query_updating_blocked] = search_query_updating_blocked_;
|
|
8673
8732
|
const get_search_query_ = (0, $57o7A$solidjs.createMemo)((previous_value)=>{
|
|
@@ -8678,10 +8737,10 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8678
8737
|
page_url_creator: page_url_creator
|
|
8679
8738
|
});
|
|
8680
8739
|
const previous_searches = (0, $2b7a005a65221045$export$84bba84a7b837187)(get_search_query_);
|
|
8681
|
-
const [, set_search_showing_recommendation_rows] = state_.
|
|
8740
|
+
const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
|
|
8682
8741
|
const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $fb29c6201c369e39$export$1c8c715550dc689d)); // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
8683
8742
|
const on_submit_with_unchanged_value_ = ()=>this.modal_open = false;
|
|
8684
|
-
const [get_search_field_value_, set_search_field_value_] = state_.
|
|
8743
|
+
const [get_search_field_value_, set_search_field_value_] = state_.field_value;
|
|
8685
8744
|
const configured_submit_query_ = (new_query)=>(0, $f328bd45f8ede33c$export$e16630ecb9644a1c)({
|
|
8686
8745
|
on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
|
|
8687
8746
|
set_search_field_value_: set_search_field_value_,
|
|
@@ -8697,9 +8756,9 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8697
8756
|
selected_filters_: selected_filters_,
|
|
8698
8757
|
get_search_query_: get_search_query_,
|
|
8699
8758
|
current_sorting_: current_sorting_,
|
|
8700
|
-
expanded_hierarchical_filters_: state_.
|
|
8759
|
+
expanded_hierarchical_filters_: state_.expanded_hierarchical_filters,
|
|
8701
8760
|
i18n_: i18n_,
|
|
8702
|
-
local_filter_cache_: state_.
|
|
8761
|
+
local_filter_cache_: state_.local_filter_cache
|
|
8703
8762
|
});
|
|
8704
8763
|
$2c61e4cd8229c49a$var$privately_shared_properties.set(this, {
|
|
8705
8764
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
@@ -8723,7 +8782,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8723
8782
|
(0, $57o7A$solidjs.onCleanup)(()=>this.modal_open = false);
|
|
8724
8783
|
return (0, $f40a47a30a358305$export$1c593cbd6f1e10bc)(...args);
|
|
8725
8784
|
}, {
|
|
8726
|
-
search_field_value_: state_.
|
|
8785
|
+
search_field_value_: state_.field_value,
|
|
8727
8786
|
get_search_query_: get_search_query_,
|
|
8728
8787
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
8729
8788
|
previous_searches_: previous_searches,
|
|
@@ -8792,7 +8851,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
|
|
|
8792
8851
|
};
|
|
8793
8852
|
(0, $57o7A$solidjs.runWithOwner)(owner, ()=>(0, $57o7A$solidjs.createEffect)(modal_opening_effect));
|
|
8794
8853
|
})();
|
|
8795
|
-
$2c61e4cd8229c49a$export$ac6237957a15b3f0.#
|
|
8854
|
+
$2c61e4cd8229c49a$export$ac6237957a15b3f0.#keys_constructed_with.push(unique_instance_key_for_state);
|
|
8796
8855
|
});
|
|
8797
8856
|
}
|
|
8798
8857
|
get on_navigation() {
|
|
@@ -8866,8 +8925,8 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
8866
8925
|
market_: ()=>depict_search.market,
|
|
8867
8926
|
depict_api_: shared_properties.depict_api_,
|
|
8868
8927
|
min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
|
|
8869
|
-
local_filter_cache_: state_.
|
|
8870
|
-
search_field_value_: state_.
|
|
8928
|
+
local_filter_cache_: state_.local_filter_cache,
|
|
8929
|
+
search_field_value_: state_.field_value,
|
|
8871
8930
|
get_search_query_: shared_properties.get_search_query_,
|
|
8872
8931
|
clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
|
|
8873
8932
|
open_modal_: (...args)=>depict_search.modal_open = args,
|
|
@@ -8890,19 +8949,19 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
|
|
|
8890
8949
|
});
|
|
8891
8950
|
},
|
|
8892
8951
|
current_sorting_: shared_properties.current_sorting_,
|
|
8893
|
-
search_filters_open_: state_.
|
|
8894
|
-
search_sorting_open_: state_.
|
|
8895
|
-
expanded_filters_: state_.
|
|
8952
|
+
search_filters_open_: state_.filters_open,
|
|
8953
|
+
search_sorting_open_: state_.sorting_open,
|
|
8954
|
+
expanded_filters_: state_.expanded_filters,
|
|
8896
8955
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? (category_suggestion_)=>{
|
|
8897
8956
|
return (0, $dae23104ba8bb78c$export$d757d54550ebfb3d)({
|
|
8898
8957
|
category_suggestion_: category_suggestion_,
|
|
8899
8958
|
router_: shared_properties.router_
|
|
8900
8959
|
});
|
|
8901
8960
|
} : false,
|
|
8902
|
-
expanded_hierarchical_filters_: state_.
|
|
8961
|
+
expanded_hierarchical_filters_: state_.expanded_hierarchical_filters,
|
|
8903
8962
|
selected_filters_: shared_properties.selected_filters_,
|
|
8904
|
-
showing_recommendation_rows_: state_.
|
|
8905
|
-
scroll_restoration_data_: state_.
|
|
8963
|
+
showing_recommendation_rows_: state_.showing_recommendation_rows,
|
|
8964
|
+
scroll_restoration_data_: state_.scroll_restoration_data,
|
|
8906
8965
|
include_input_field_: ()=>props.include_input_field,
|
|
8907
8966
|
layout_options_: (0, $57o7A$solidjs.createMemo)(()=>({
|
|
8908
8967
|
cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(props.cols_at_size),
|
|
@@ -8926,7 +8985,7 @@ function $2c61e4cd8229c49a$export$316f6f283ae64765(props) {
|
|
|
8926
8985
|
let input_element;
|
|
8927
8986
|
const search_field = (0, $57o7A$solidjsweb.createComponent)((0, $66b8b9a9613c141d$export$b94867ecbd698f21), {
|
|
8928
8987
|
get search_field_value_ () {
|
|
8929
|
-
return shared_properties.state_.
|
|
8988
|
+
return shared_properties.state_.field_value;
|
|
8930
8989
|
},
|
|
8931
8990
|
get submit_query_ () {
|
|
8932
8991
|
return shared_properties.configured_submit_query_;
|