@depict-ai/ui 0.0.78 → 0.0.80

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/main.js CHANGED
@@ -31,11 +31,11 @@ $parcel$export(module.exports, "DepictAPI", () => $9ce64f69303c371e$export$e015e
31
31
  $parcel$export(module.exports, "media_query_to_accessor", () => $beec9d22e42ed2cf$export$d9f36cf74e24d595);
32
32
  $parcel$export(module.exports, "setup_fast_leave", () => $d589470b68ce5b67$export$689e204eadb33baf);
33
33
  $parcel$export(module.exports, "show_toast", () => $b3e6a0e9382bf87e$export$5196e4c01fa56fcb);
34
- $parcel$export(module.exports, "solid_format_price", () => $5fc9fc23df1591db$export$469c7af753d08925);
34
+ $parcel$export(module.exports, "SolidFormatPrice", () => $5fc9fc23df1591db$export$a71e92cfbb498adc);
35
35
  $parcel$export(module.exports, "connect_search_field_height_to_aligner_height", () => $246e3e89a097f014$export$828dcdd425fd3231);
36
36
  $parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
37
37
  $parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
38
- /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.78";
38
+ /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.80";
39
39
 
40
40
 
41
41
 
@@ -57,25 +57,28 @@ async function $8c4e48a4bf96b284$export$58e808b1db15d3bc({ merchant: merchant ,
57
57
 
58
58
 
59
59
 
60
- function $1ee6da2465098194$export$e183a13865960371(params_to_default_value) {
60
+ function $1ee6da2465098194$export$e183a13865960371(params_to_default_value, router_) {
61
61
  const signals = {};
62
62
  const entries = Object.entries(params_to_default_value);
63
63
  const event_handler = (0, $46MJV$depictaiutilishared.catchify)(({ state: state })=>$1ee6da2465098194$var$history_state_change(signals, entries, state));
64
- for (const [param, default_value] of entries){
65
- const [read_signal] = signals[param] = (0, $46MJV$solidjs.createSignal)(history.state?.[param] ?? default_value);
66
- (0, $46MJV$solidjs.createComputed)((0, $46MJV$depictaiutilishared.catchify)(()=>{
64
+ // createRenderEffect because we need the instant execution so the signals always contain values, even before solid's render phase
65
+ (0, $46MJV$solidjs.createRenderEffect)(()=>{
66
+ let signal_changed = false;
67
+ let { state: state } = history; // cloning isn't necessary because we're calling replaceState on it anyway
68
+ if (state === null || typeof state != "object") state = {};
69
+ for (const [param, default_value] of entries){
70
+ const [read_signal] = signals[param] ||= (0, $46MJV$solidjs.createSignal)(state[param] ?? default_value);
67
71
  const new_value = read_signal();
68
- let { state: state } = history; // cloning isn't necessary because we're calling replaceState on it anyway
69
- if (new_value !== state?.[param]) {
70
- if (state === null || typeof state != "object") state = {};
72
+ if (new_value !== state[param]) {
73
+ signal_changed = true;
71
74
  state[param] = new_value;
72
- history.replaceState(state, "", location.href);
73
75
  }
74
- }));
75
- }
76
+ }
77
+ if (signal_changed) router_.navigate_.replace_state_(state);
78
+ });
76
79
  window.addEventListener("popstate", event_handler);
77
80
  (0, $46MJV$solidjs.onCleanup)((0, $46MJV$depictaiutilishared.catchify)(()=>window.removeEventListener("popstate", event_handler)));
78
- (0, $46MJV$solidjs.createEffect)((0, $46MJV$depictaiutilishared.catchify)(()=>(0, $46MJV$solidjs.untrack)((0, $46MJV$depictaiutilishared.catchify)(()=>$1ee6da2465098194$var$history_state_change(signals, entries, history.state))))); // we need this to run after the first writing
81
+ (0, $46MJV$solidjs.createEffect)((0, $46MJV$depictaiutilishared.catchify)(()=>(0, $46MJV$solidjs.untrack)((0, $46MJV$depictaiutilishared.catchify)(()=>$1ee6da2465098194$var$history_state_change(signals, entries, history.state))))); // we need this to run after reading the initial state from history.state to write the defaults to history.state
79
82
  return signals;
80
83
  }
81
84
  function $1ee6da2465098194$var$history_state_change(signals, entries, state) {
@@ -89,8 +92,8 @@ function $1ee6da2465098194$var$history_state_change(signals, entries, state) {
89
92
  }
90
93
 
91
94
 
92
- function $0de081f67b6d15b5$export$9862539c89138352(get_default_values_) {
93
- const state = (0, $1ee6da2465098194$export$e183a13865960371)(get_default_values_());
95
+ function $0de081f67b6d15b5$export$9862539c89138352(get_default_values_, router_) {
96
+ const state = (0, $1ee6da2465098194$export$e183a13865960371)(get_default_values_(), router_);
94
97
  const reset_state = ()=>{
95
98
  const new_defaults = get_default_values_();
96
99
  for(const key in state){
@@ -315,8 +318,12 @@ function $891da49c419865de$export$92f2da32c6e7e7ee({ search_results_: search_res
315
318
 
316
319
 
317
320
 
318
- function $5fc9fc23df1591db$export$469c7af753d08925({ price_: price_ , price_formatting_: price_formatting_ }) {
319
- return (0, $46MJV$solidjs.createMemo)(()=>(0, $46MJV$depictaiutilishared.standard_price_format)(price_(), price_formatting_().places_after_comma_, price_formatting_().decimal_places_delimiter_, price_formatting_().thousands_delimiter_));
321
+
322
+ function $5fc9fc23df1591db$export$a71e92cfbb498adc(props) {
323
+ return (0, $46MJV$solidjs.createMemo)(()=>{
324
+ const price_formatting = props.price_formatting_;
325
+ return (0, $46MJV$depictaiutilishared.standard_price_format)(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
326
+ });
320
327
  }
321
328
 
322
329
 
@@ -423,19 +430,27 @@ function $08fa9d20f7ec85af$export$83fd5de5504a7a67({ formatted_number_of_results
423
430
  }));
424
431
  });
425
432
  return (()=>{
426
- const _el$ = $08fa9d20f7ec85af$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$6 = _el$4.nextSibling, _el$7 = _el$6.nextSibling, _el$10 = _el$7.nextSibling, _el$8 = _el$10.nextSibling, _el$9 = _el$8.nextSibling;
433
+ const _el$ = $08fa9d20f7ec85af$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling, _el$7 = _el$4.nextSibling, _el$8 = _el$7.nextSibling, _el$11 = _el$8.nextSibling, _el$9 = _el$11.nextSibling, _el$10 = _el$9.nextSibling;
427
434
  const _ref$ = element;
428
435
  typeof _ref$ === "function" ? (0, $46MJV$solidjsweb.use)(_ref$, _el$) : element = _el$;
429
- (0, $46MJV$solidjsweb.insert)(_el$3, (0, $5fc9fc23df1591db$export$469c7af753d08925)({
430
- price_: first_to_show,
431
- price_formatting_: modified_price_formatting_
436
+ (0, $46MJV$solidjsweb.insert)(_el$3, (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
437
+ get price_ () {
438
+ return first_to_show();
439
+ },
440
+ get price_formatting_ () {
441
+ return modified_price_formatting_();
442
+ }
432
443
  }));
433
- (0, $46MJV$solidjsweb.insert)(_el$6, (0, $5fc9fc23df1591db$export$469c7af753d08925)({
434
- price_: last_to_show,
435
- price_formatting_: modified_price_formatting_
444
+ (0, $46MJV$solidjsweb.insert)(_el$7, (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
445
+ get price_ () {
446
+ return last_to_show();
447
+ },
448
+ get price_formatting_ () {
449
+ return modified_price_formatting_();
450
+ }
436
451
  }));
437
- (0, $46MJV$solidjsweb.insert)(_el$2, of_, _el$10);
438
- (0, $46MJV$solidjsweb.insert)(_el$9, count_to_show);
452
+ (0, $46MJV$solidjsweb.insert)(_el$2, of_, _el$11);
453
+ (0, $46MJV$solidjsweb.insert)(_el$10, count_to_show);
439
454
  return _el$;
440
455
  })();
441
456
  }
@@ -710,7 +725,8 @@ function $92e4e7906daa1ff8$export$8895d39404bd2bb1(props) {
710
725
  const { user_triggered_: user_triggered_ , i18n_: i18n_ , also_clear_sorting_: also_clear_sorting_ , local_filter_cache_: [get_local_filter_cache, set_local_filter_cache] , selected_filters_: [get_selected_filters, set_selected_filters] , expanded_hierarchical_filters_: [get_expanded_hierarchical_filters, set_expanded_hierarchical_filters] , delay_toast_: delay_toast_ } = props;
711
726
  const previous_selected_filters = (0, $46MJV$solidjs.untrack)(get_selected_filters);
712
727
  if (!previous_selected_filters.length) {
713
- // no filters selected, do nothing
728
+ // no filters selected, still clear sorting if applicable but don't display a toast for that since it's very minor
729
+ if (also_clear_sorting_) props.current_sorting_[1]();
714
730
  if (delay_toast_) return ()=>{};
715
731
  return;
716
732
  }
@@ -1381,16 +1397,24 @@ function $c130252ae1aed6e2$export$fecbb157621501bd({ number_of_rendered_selected
1381
1397
  };
1382
1398
  (0, $46MJV$solidjsweb.insert)(_el$5, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$depictaiutilishared.CrossIcon), {}), _el$6);
1383
1399
  (0, $46MJV$solidjsweb.insert)(_el$6, ()=>price_formatting_().pre_, _el$7);
1384
- (0, $46MJV$solidjsweb.insert)(_el$6, ()=>(0, $5fc9fc23df1591db$export$469c7af753d08925)({
1385
- price_: (0, $46MJV$solidjs.createMemo)(()=>filter().data[0]),
1386
- price_formatting_: price_formatting_
1387
- }), _el$7);
1400
+ (0, $46MJV$solidjsweb.insert)(_el$6, (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
1401
+ get price_ () {
1402
+ return filter().data[0];
1403
+ },
1404
+ get price_formatting_ () {
1405
+ return price_formatting_();
1406
+ }
1407
+ }), _el$7);
1388
1408
  (0, $46MJV$solidjsweb.insert)(_el$6, ()=>price_formatting_().post_, _el$7);
1389
1409
  (0, $46MJV$solidjsweb.insert)(_el$6, ()=>price_formatting_().pre_, null);
1390
- (0, $46MJV$solidjsweb.insert)(_el$6, ()=>(0, $5fc9fc23df1591db$export$469c7af753d08925)({
1391
- price_: (0, $46MJV$solidjs.createMemo)(()=>filter().data[1]),
1392
- price_formatting_: price_formatting_
1393
- }), null);
1410
+ (0, $46MJV$solidjsweb.insert)(_el$6, (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
1411
+ get price_ () {
1412
+ return filter().data[1];
1413
+ },
1414
+ get price_formatting_ () {
1415
+ return price_formatting_();
1416
+ }
1417
+ }), null);
1394
1418
  (0, $46MJV$solidjsweb.insert)(_el$6, ()=>price_formatting_().post_, null);
1395
1419
  return _el$5;
1396
1420
  })();
@@ -1961,16 +1985,24 @@ function $6833018d8bbbb2ad$var$RangeSelector({ max_: max_ , min_: min_ , current
1961
1985
  i18n_: i18n_
1962
1986
  }), _el$8);
1963
1987
  (0, $46MJV$solidjsweb.insert)(_el$9, pre_price, null);
1964
- (0, $46MJV$solidjsweb.insert)(_el$9, ()=>(0, $5fc9fc23df1591db$export$469c7af753d08925)({
1965
- price_: min_,
1966
- price_formatting_: price_formatting_
1967
- }), null);
1988
+ (0, $46MJV$solidjsweb.insert)(_el$9, (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
1989
+ get price_ () {
1990
+ return min_();
1991
+ },
1992
+ get price_formatting_ () {
1993
+ return price_formatting_();
1994
+ }
1995
+ }), null);
1968
1996
  (0, $46MJV$solidjsweb.insert)(_el$9, post_price, null);
1969
1997
  (0, $46MJV$solidjsweb.insert)(_el$10, pre_price, null);
1970
- (0, $46MJV$solidjsweb.insert)(_el$10, ()=>(0, $5fc9fc23df1591db$export$469c7af753d08925)({
1971
- price_: max_,
1972
- price_formatting_: price_formatting_
1973
- }), null);
1998
+ (0, $46MJV$solidjsweb.insert)(_el$10, (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
1999
+ get price_ () {
2000
+ return max_();
2001
+ },
2002
+ get price_formatting_ () {
2003
+ return price_formatting_();
2004
+ }
2005
+ }), null);
1974
2006
  (0, $46MJV$solidjsweb.insert)(_el$10, post_price, null);
1975
2007
  (0, $46MJV$solidjsweb.effect)((_p$)=>{
1976
2008
  const _v$ = i18n_.range_filter_low_point_aria_label_(), _v$2 = min_(), _v$3 = max_(), _v$4 = i18n_.range_filter_high_point_aria_label_(), _v$5 = min_(), _v$6 = max_();
@@ -2875,48 +2907,57 @@ var $6865c7388a79e957$export$2e2bcd8739ae039 = {
2875
2907
  const $8578879ddb04f368$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="show-selected" aria-hidden="true"><span></span></span>`, 4);
2876
2908
  function $8578879ddb04f368$export$53c59af873b303c9({ selected_filters_in_group_: selected_filters_in_group_ , i18n_: { price_formatting_: price_formatting_ } }) {
2877
2909
  const [show_tick_icon, set_show_tick_icon] = (0, $46MJV$solidjs.createSignal)(false);
2878
- return (()=>{
2879
- const _el$ = $8578879ddb04f368$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild;
2880
- (0, $46MJV$solidjsweb.insert)(_el$2, ()=>(0, $46MJV$solidjs.createMemo)(()=>(0, $46MJV$solidjs.batch)(()=>{
2881
- set_show_tick_icon(false);
2882
- let { size: size } = selected_filters_in_group_();
2883
- try_specific: {
2884
- if (size > 1) break try_specific;
2885
- for (const [selected_filter, filter_data] of selected_filters_in_group_()){
2886
- // we're intentionally not looping in this statement since we always just want to show the first thing in the filter group
2887
- const { meta: meta } = filter_data;
2888
- const { type: type } = meta;
2889
- if (type === "range") return [
2890
- (0, $46MJV$solidjsweb.memo)(()=>price_formatting_().pre_),
2891
- (0, $46MJV$solidjsweb.memo)(()=>(0, $5fc9fc23df1591db$export$469c7af753d08925)({
2892
- price_: (0, $46MJV$solidjs.createMemo)(()=>selected_filter.data[0]),
2893
- price_formatting_: price_formatting_
2894
- })),
2895
- (0, $46MJV$solidjsweb.memo)(()=>price_formatting_().post_),
2896
- " – ",
2897
- (0, $46MJV$solidjsweb.memo)(()=>price_formatting_().pre_),
2898
- (0, $46MJV$solidjsweb.memo)(()=>(0, $5fc9fc23df1591db$export$469c7af753d08925)({
2899
- price_: (0, $46MJV$solidjs.createMemo)(()=>selected_filter.data[1]),
2900
- price_formatting_: price_formatting_
2901
- })),
2902
- (0, $46MJV$solidjsweb.memo)(()=>price_formatting_().post_)
2903
- ];
2904
- else {
2905
- const { data: data } = selected_filter;
2906
- const data_is_array = Array.isArray(data);
2907
- if (data_is_array && data.length !== 1) {
2908
- size = data.length;
2909
- break try_specific;
2910
- }
2911
- const needle = data_is_array ? data[0] : data;
2912
- const index_in_meta = meta.values.findIndex((value)=>needle === value || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index)=>needle[index] === item));
2913
- return meta.names?.[index_in_meta] || meta.values?.[index_in_meta];
2910
+ const text = (0, $46MJV$solidjs.createMemo)(()=>(0, $46MJV$solidjs.batch)(()=>{
2911
+ set_show_tick_icon(false);
2912
+ let { size: size } = selected_filters_in_group_();
2913
+ try_specific: {
2914
+ if (size > 1) break try_specific;
2915
+ for (const [selected_filter, filter_data] of selected_filters_in_group_()){
2916
+ // we're intentionally not looping in this statement since we always just want to show the first thing in the filter group
2917
+ const { meta: meta } = filter_data;
2918
+ const { type: type } = meta;
2919
+ if (type === "range") return [
2920
+ (0, $46MJV$solidjsweb.memo)(()=>price_formatting_().pre_),
2921
+ (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
2922
+ get price_ () {
2923
+ return selected_filter.data[0];
2924
+ },
2925
+ get price_formatting_ () {
2926
+ return price_formatting_();
2927
+ }
2928
+ }),
2929
+ (0, $46MJV$solidjsweb.memo)(()=>price_formatting_().post_),
2930
+ " – ",
2931
+ (0, $46MJV$solidjsweb.memo)(()=>price_formatting_().pre_),
2932
+ (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
2933
+ get price_ () {
2934
+ return selected_filter.data[1];
2935
+ },
2936
+ get price_formatting_ () {
2937
+ return price_formatting_();
2914
2938
  }
2939
+ }),
2940
+ (0, $46MJV$solidjsweb.memo)(()=>price_formatting_().post_)
2941
+ ];
2942
+ else {
2943
+ const { data: data } = selected_filter;
2944
+ const data_is_array = Array.isArray(data);
2945
+ if (data_is_array && data.length !== 1) {
2946
+ size = data.length;
2947
+ break try_specific;
2915
2948
  }
2949
+ const needle = data_is_array ? data[0] : data;
2950
+ const index_in_meta = meta.values.findIndex((value)=>needle === value || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index)=>needle[index] === item));
2951
+ return meta.names?.[index_in_meta] || meta.values?.[index_in_meta];
2916
2952
  }
2917
- set_show_tick_icon(true);
2918
- return size + "";
2919
- })));
2953
+ }
2954
+ }
2955
+ set_show_tick_icon(true);
2956
+ return size + "";
2957
+ }));
2958
+ return (()=>{
2959
+ const _el$ = $8578879ddb04f368$var$_tmpl$.cloneNode(true), _el$2 = _el$.firstChild;
2960
+ (0, $46MJV$solidjsweb.insert)(_el$2, text);
2920
2961
  (0, $46MJV$solidjsweb.insert)(_el$, (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjs.Show), {
2921
2962
  get when () {
2922
2963
  return show_tick_icon();
@@ -2982,6 +3023,7 @@ function $5804fd6cbfb7160f$export$ab34afce88557c0e(props) {
2982
3023
 
2983
3024
 
2984
3025
 
3026
+
2985
3027
  const $1587765bd31f3722$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-collapsible"></div>`, 2), $1587765bd31f3722$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<button class="clear-group"><span></span></button>`, 4), $1587765bd31f3722$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="view-more-clear"></div>`, 2), $1587765bd31f3722$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-collapsible-body"><div class="filter-part"></div></div>`, 4), $1587765bd31f3722$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<details class="filter-collapsible"></details>`, 2), $1587765bd31f3722$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<summary class="filter-group-summary"><div class="summary"><span></span><div class="selected-w-sign"></div></div></summary>`, 8), $1587765bd31f3722$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="ungrouped"></div>`, 2), $1587765bd31f3722$var$_tmpl$8 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<button class="clear-all-filters major"></button>`, 2);
2986
3028
  function $1587765bd31f3722$export$3f1a388cc0d8fed7(props) {
2987
3029
  // Split like this to make placeholder wrapping more visible & this component is exported and used in MobileModal
@@ -3093,13 +3135,22 @@ function $1587765bd31f3722$var$ActualFilterBody(props) {
3093
3135
  return "Filter group " + JSON.stringify(section_) + " failed";
3094
3136
  },
3095
3137
  get children () {
3096
- return (0, $46MJV$solidjs.createMemo)(()=>(0, $46MJV$solidjs.createMemo)(()=>(0, $6865c7388a79e957$export$2e2bcd8739ae039)[filter()?.meta?.type])()?.({
3097
- filter_: filter,
3098
- expanded_hierarchical_filters_: props.expanded_hierarchical_filters_,
3099
- selected_filters_: props.selected_filters_,
3100
- i18n_: props.i18n_,
3101
- view_more_button_below_group_: view_more_button_below_group
3102
- }));
3138
+ return (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjsweb.Dynamic), {
3139
+ get component () {
3140
+ return (0, $6865c7388a79e957$export$2e2bcd8739ae039)[filter()?.meta?.type];
3141
+ },
3142
+ filter_: filter,
3143
+ get expanded_hierarchical_filters_ () {
3144
+ return props.expanded_hierarchical_filters_;
3145
+ },
3146
+ get selected_filters_ () {
3147
+ return props.selected_filters_;
3148
+ },
3149
+ get i18n_ () {
3150
+ return props.i18n_;
3151
+ },
3152
+ view_more_button_below_group_: view_more_button_below_group
3153
+ });
3103
3154
  }
3104
3155
  })
3105
3156
  }));
@@ -3155,19 +3206,27 @@ function $1587765bd31f3722$var$ActualFilterBody(props) {
3155
3206
  get each () {
3156
3207
  return untogglable_filters();
3157
3208
  },
3158
- children: (filter)=>// create memo to diff the function with next function
3159
- {
3209
+ children: (filter)=>{
3160
3210
  const view_more_button_below_group = (0, $46MJV$solidjs.createSignal)();
3161
- const filter_element_memo = (0, $46MJV$solidjs.createMemo)(()=>(0, $46MJV$solidjs.createMemo)(()=>(0, $6865c7388a79e957$export$2e2bcd8739ae039)[filter()?.meta?.type])()?.({
3211
+ const [get_view_more_button_below_group] = view_more_button_below_group;
3212
+ return [
3213
+ (0, $46MJV$solidjsweb.createComponent)((0, $46MJV$solidjsweb.Dynamic), {
3214
+ get component () {
3215
+ return (0, $6865c7388a79e957$export$2e2bcd8739ae039)[filter()?.meta?.type];
3216
+ },
3162
3217
  filter_: filter,
3163
- expanded_hierarchical_filters_: props.expanded_hierarchical_filters_,
3164
- selected_filters_: props.selected_filters_,
3165
- i18n_: props.i18n_,
3218
+ get expanded_hierarchical_filters_ () {
3219
+ return props.expanded_hierarchical_filters_;
3220
+ },
3221
+ get selected_filters_ () {
3222
+ return props.selected_filters_;
3223
+ },
3224
+ get i18n_ () {
3225
+ return props.i18n_;
3226
+ },
3166
3227
  view_more_button_below_group_: view_more_button_below_group
3167
- }));
3168
- return [
3169
- filter_element_memo,
3170
- view_more_button_below_group[0]
3228
+ }),
3229
+ (0, $46MJV$solidjsweb.memo)(get_view_more_button_below_group)
3171
3230
  ];
3172
3231
  }
3173
3232
  }));
@@ -3775,6 +3834,7 @@ function $0bc45cf6753f874a$export$b288c38ae3fddb56({ available_filters_: availab
3775
3834
 
3776
3835
  const $881cb1745bafff7a$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filters"><div class="body"></div></div>`, 4), $881cb1745bafff7a$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="sorting"><div class="body"></div></div>`, 4), $881cb1745bafff7a$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="sort-and-filter-buttons"><div class="outer"><div class="inner"></div></div></div>`, 6), $881cb1745bafff7a$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="num-filters"></span>`, 2), $881cb1745bafff7a$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="open-filters-button-container"><button class="filter toggle-button major-minor-transition" type="button"><span></span></button></div>`, 6), $881cb1745bafff7a$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<button class="toggle-button for-sorting major-minor-transition"><span></span></button>`, 4);
3777
3836
  function $881cb1745bafff7a$export$d7841e452f2e59a8({ current_sorting_: current_sorting_ , set_extra_els_in_results_container_: set_extra_els_in_results_container_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , set_sort_or_filter_open_: set_sort_or_filter_open_ , i18n_: i18n_ , available_sortings_: available_sortings_ , available_filters_: available_filters_ , expanded_filters_: expanded_filters_ , middle_elements_: middle_elements_ , input_modal_open_: input_modal_open_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_ , set_sort_and_filter_element_: set_sort_and_filter_element_ , formatted_number_of_results_: formatted_number_of_results_ , filter_button_width_: filter_button_width_ , sort_button_width_: sort_button_width_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , get_extra_filters_button_: get_extra_filters_button_ , get_extra_sorting_button_: get_extra_sorting_button_ }) {
3837
+ // @ts-ignore
3778
3838
  return (0, $0f2f58dd60b11888$export$b69d0d92862de18b)({
3779
3839
  severity_: "error",
3780
3840
  message_: "Sorting and filters failed",
@@ -4298,7 +4358,7 @@ const $c6a04c153e9853a7$export$e2cf3f19dd3f8aac = "went_sideways_clear_filters";
4298
4358
  function $c6a04c153e9853a7$export$43cd1e747fecd42e(to_url, set_clearing_flag, from_search_params = new URLSearchParams(location.search)) {
4299
4359
  if (!to_url) return to_url;
4300
4360
  const was_url_object = to_url instanceof URL;
4301
- const url_object = was_url_object ? to_url : new URL(to_url);
4361
+ const url_object = was_url_object ? to_url : new URL(to_url, location.origin);
4302
4362
  const { searchParams: searchParams } = url_object;
4303
4363
  if (set_clearing_flag) searchParams.set($c6a04c153e9853a7$export$e2cf3f19dd3f8aac, "true");
4304
4364
  if (from_search_params.has($c6a04c153e9853a7$var$sorting_query_param)) searchParams.set($c6a04c153e9853a7$var$sorting_query_param, from_search_params.get($c6a04c153e9853a7$var$sorting_query_param));
@@ -5172,6 +5232,7 @@ function $623202ae203e9e59$export$f091cbac892643a4(obj) {
5172
5232
 
5173
5233
  function $f27b0b326e0a87e2$export$23fca46f3143581f(component, error_message) {
5174
5234
  const component_in_error_boundary = (do_with_elements)=>{
5235
+ // @ts-ignore
5175
5236
  return (0, $0f2f58dd60b11888$export$b69d0d92862de18b)({
5176
5237
  severity_: "error",
5177
5238
  message_: error_message,
@@ -5198,13 +5259,16 @@ function $f27b0b326e0a87e2$export$23fca46f3143581f(component, error_message) {
5198
5259
 
5199
5260
 
5200
5261
 
5201
- function $004640621ca953d0$export$7bcff1eb3eca57d7(router) {
5262
+ function $cb699e435fadd254$export$477caf01aecaeb2a({ search_query_url_param_name_: search_query_url_param_name_ , router_: router_ }) {
5263
+ const search_query_ = search_query_url_param_name_ ? (0, $46MJV$solidjs.createSignal)("") : undefined;
5264
+ const get_search_query_ = search_query_?.[0];
5265
+ const set_search_query = search_query_?.[1];
5202
5266
  const current_sorting_ = (0, $46MJV$solidjs.createSignal)();
5203
5267
  const selected_filters_ = (0, $46MJV$solidjs.createSignal)([]);
5204
- const [get_sorting, set_sorting] = current_sorting_;
5205
- const [get_selected_filters, set_selected_filters] = selected_filters_;
5268
+ const [get_sorting_, set_sorting] = current_sorting_;
5269
+ const [get_selected_filters_, set_selected_filters] = selected_filters_;
5206
5270
  const [get_current_href, set_current_href] = (0, $46MJV$solidjs.createSignal)(location.href);
5207
- const history_change_handler = ()=>set_current_href(location.href);
5271
+ const history_change_handler = (0, $46MJV$depictaiutilishared.catchify)(()=>set_current_href(location.href));
5208
5272
  const owner = (0, $46MJV$solidjs.getOwner)() || (0, $46MJV$solidjs.createRoot)(()=>(0, $46MJV$solidjs.getOwner)());
5209
5273
  let writer_started = false;
5210
5274
  (0, $46MJV$depictaiutilishared.instant_exec_on_suspect_history_change).add(history_change_handler);
@@ -5214,12 +5278,12 @@ function $004640621ca953d0$export$7bcff1eb3eca57d7(router) {
5214
5278
  (0, $46MJV$solidjs.batch)(()=>{
5215
5279
  const found_sorting = (0, $c6a04c153e9853a7$export$766e9676e74997d3)(searchParams);
5216
5280
  if (found_sorting) {
5217
- const current_sorting = (0, $46MJV$solidjs.untrack)(get_sorting);
5281
+ const current_sorting = (0, $46MJV$solidjs.untrack)(get_sorting_);
5218
5282
  // Do some diffing since we might assume in certain places of the code that if the signal changes it means the sorting has changed
5219
5283
  if (current_sorting?.field !== found_sorting.field || current_sorting?.order !== found_sorting.order) set_sorting(found_sorting);
5220
5284
  } else set_sorting();
5221
5285
  const found_filters = (0, $c6a04c153e9853a7$export$f934fa24c3a86811)(searchParams);
5222
- const selected_filters = (0, $46MJV$solidjs.untrack)(get_selected_filters);
5286
+ const selected_filters = (0, $46MJV$solidjs.untrack)(get_selected_filters_);
5223
5287
  const found_filters_map = new Map(found_filters.map(({ field: field , op: op , data: data })=>[
5224
5288
  JSON.stringify([
5225
5289
  field,
@@ -5232,25 +5296,36 @@ function $004640621ca953d0$export$7bcff1eb3eca57d7(router) {
5232
5296
  field,
5233
5297
  op
5234
5298
  ]))) === JSON.stringify(data))) set_selected_filters(found_filters);
5299
+ if (search_query_url_param_name_) {
5300
+ const found_query = searchParams.get(search_query_url_param_name_);
5301
+ set_search_query(found_query || "");
5302
+ }
5235
5303
  if (!writer_started) {
5236
5304
  // The owner here is the createComputed which gets disposed the next time the computation runs - but we actually just want to delay the start of the href_writer until our signals contain the current value of the URL, therefore the runWithOwner
5237
- (0, $46MJV$solidjs.runWithOwner)(owner, ()=>$004640621ca953d0$var$start_href_writer(get_sorting, get_selected_filters, router));
5305
+ (0, $46MJV$solidjs.runWithOwner)(owner, ()=>$cb699e435fadd254$var$start_href_writer({
5306
+ get_sorting_: get_sorting_,
5307
+ get_selected_filters_: get_selected_filters_,
5308
+ router_: router_
5309
+ }));
5238
5310
  writer_started = true;
5239
5311
  }
5240
5312
  });
5241
5313
  });
5314
+ // @ts-ignore
5242
5315
  return {
5243
5316
  current_sorting_: current_sorting_,
5244
- selected_filters_: selected_filters_
5317
+ selected_filters_: selected_filters_,
5318
+ ...typeof search_query_url_param_name_ === "string" ? {
5319
+ search_query_accessor_: get_search_query_
5320
+ } : {}
5245
5321
  };
5246
5322
  }
5247
5323
  /**
5248
5324
  * Writes the sorting and filters to the URL query parameters when they change.
5249
- */ function $004640621ca953d0$var$start_href_writer(get_sorting, get_selected_filters, router) {
5250
- // This has to be a createComputed because there can be some kind of URL query bouncing back and forwards otherwise (observed when clearing filters by making a new search)
5251
- (0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)([
5252
- get_sorting,
5253
- get_selected_filters
5325
+ */ function $cb699e435fadd254$var$start_href_writer({ get_sorting_: get_sorting_ , get_selected_filters_: get_selected_filters_ , router_: router_ }) {
5326
+ (0, $46MJV$solidjs.createEffect)((0, $46MJV$solidjs.on)([
5327
+ get_sorting_,
5328
+ get_selected_filters_
5254
5329
  ], ([sorting, filters])=>{
5255
5330
  const current_href = location.href;
5256
5331
  const url_object = new URL(current_href);
@@ -5268,7 +5343,7 @@ function $004640621ca953d0$export$7bcff1eb3eca57d7(router) {
5268
5343
  // Having the array middle step because if we'd check the "size" property of the map the algorithm could be fooled if there were two query parameters with the same key
5269
5344
  const new_search_params_map = new Map(new_search_params);
5270
5345
  if (unmodified_search_params.length !== new_search_params.length || !unmodified_search_params.every(([key, value])=>new_search_params_map.get(key) === value)) // Only update URL if it actually changed
5271
- router.navigate_.go_to_({
5346
+ router_.navigate_.go_to_({
5272
5347
  is_replace_: true,
5273
5348
  new_url_: url_object.href,
5274
5349
  force_spa_navigation_: true
@@ -5327,10 +5402,15 @@ class $43940d5ca403c293$export$7e1297a3a19f10d8 {
5327
5402
  * @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
5328
5403
  * @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
5329
5404
  * @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
5330
- */ go_to_: async ({ new_url_: new_url_ , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ , category_query_id_: category_query_id_ })=>{
5405
+ * @param category_query_id_ If you are navigating to a category and know the query_id of, please provide it. This is for making a better devEx in js-ui
5406
+ */ go_to_: (0, $46MJV$depictaiutilishared.catchify)(async ({ new_url_: raw_new_url , event_: event_ , force_spa_navigation_: force_spa_navigation_ , is_replace_: is_replace_ , category_query_id_: category_query_id_ })=>{
5407
+ const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
5331
5408
  const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
5332
5409
  if (this.#dont_attempt_navigation(event_)) return;
5333
- if (wants_hard_navigation && !force_spa_navigation_) {
5410
+ const different_origin = new_url_.origin !== location.origin;
5411
+ if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
5412
+ if (force_spa_navigation_ && different_origin) // If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
5413
+ (0, $46MJV$depictaiutilishared.dwarn)("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
5334
5414
  if (!event_) // If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
5335
5415
  location.assign(new_url_);
5336
5416
  return;
@@ -5340,14 +5420,15 @@ class $43940d5ca403c293$export$7e1297a3a19f10d8 {
5340
5420
  if (force_spa_navigation_ && wants_hard_navigation) {
5341
5421
  // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
5342
5422
  const new_state = history.state;
5343
- if (category_query_id_) new_state.category_current_query_id = category_query_id_;
5423
+ if (category_query_id_) // In JS-UI we need to know the query_id of the current category, therefore push it into state
5424
+ new_state.category_current_query_id = category_query_id_;
5344
5425
  history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
5345
5426
  } else this.#throwing_on_navigation.call(this, {
5346
5427
  is_replace: is_replace_,
5347
- new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_)
5428
+ new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin)
5348
5429
  });
5349
5430
  await promise;
5350
- }
5431
+ })
5351
5432
  };
5352
5433
  constructor(on_navigation){
5353
5434
  this.on_navigation_ = on_navigation;
@@ -5409,7 +5490,9 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
5409
5490
  Object.assign(this, props_on_class); // set initial signal values
5410
5491
  (0, $33815c5a406b6cc0$export$5162a71f252e6122)();
5411
5492
  if (on_navigation) this.#router.on_navigation_ = on_navigation;
5412
- const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ } = (0, $004640621ca953d0$export$7bcff1eb3eca57d7)(this.#router);
5493
+ const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ } = (0, $cb699e435fadd254$export$477caf01aecaeb2a)({
5494
+ router_: this.#router
5495
+ });
5413
5496
  const [reset_history_state_, state_] = (0, $0de081f67b6d15b5$export$9862539c89138352)(()=>({
5414
5497
  category_filters_open: false,
5415
5498
  category_sorting_open: false,
@@ -5418,7 +5501,7 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
5418
5501
  category_local_filter_cache: [],
5419
5502
  category_expanded_hierarchical_filters: [],
5420
5503
  category_scroll_restoration_data: []
5421
- }));
5504
+ }), this.#router);
5422
5505
  const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
5423
5506
  $068a627cc18f7bb6$var$privately_shared_properties.set(this, {
5424
5507
  state_: state_,
@@ -6063,7 +6146,7 @@ function $67b60b572b7b7059$export$b3ad617e9036868(modal_body_style, input_field,
6063
6146
 
6064
6147
 
6065
6148
 
6066
- function $8b282f736ce4f3b8$export$e026af0c7b64ea5f({ selected_filters_: selected_filters_ , search_query_: [get_search_query] , current_sorting_: current_sorting_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , local_filter_cache_: local_filter_cache_ }) {
6149
+ function $8b282f736ce4f3b8$export$e026af0c7b64ea5f({ selected_filters_: selected_filters_ , get_search_query_: get_search_query_ , current_sorting_: current_sorting_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , local_filter_cache_: local_filter_cache_ }) {
6067
6150
  const [get_selected_filters] = selected_filters_;
6068
6151
  // Possible values:
6069
6152
  // 0 - we should not clear next submit
@@ -6078,7 +6161,7 @@ function $8b282f736ce4f3b8$export$e026af0c7b64ea5f({ selected_filters_: selected
6078
6161
  }, {
6079
6162
  defer: true
6080
6163
  }));
6081
- (0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)(get_search_query, (0, $46MJV$depictaiutilishared.catchify)(()=>{
6164
+ (0, $46MJV$solidjs.createComputed)((0, $46MJV$solidjs.on)(get_search_query_, (0, $46MJV$depictaiutilishared.catchify)(()=>{
6082
6165
  // when a query was submitted, clear filters if clear was pressed before
6083
6166
  const clear_value = (0, $46MJV$solidjs.untrack)(get_clear_filters_next_submit);
6084
6167
  if (clear_value) {
@@ -6103,12 +6186,11 @@ function $8b282f736ce4f3b8$export$e026af0c7b64ea5f({ selected_filters_: selected
6103
6186
 
6104
6187
 
6105
6188
 
6106
- function $ad118c2ba257d9b7$export$84bba84a7b837187(search_query) {
6189
+ function $ad118c2ba257d9b7$export$84bba84a7b837187(read_search_query) {
6107
6190
  const ls = localStorage;
6108
6191
  const key = "depict_searches";
6109
6192
  const previous_searches = (0, $46MJV$solidjs.createSignal)(JSON.parse(ls[key] || "[]"));
6110
6193
  const [read_previous_searches, write_previous_searches] = previous_searches;
6111
- const [read_search_query] = search_query;
6112
6194
  (0, $46MJV$solidjs.createEffect)((0, $46MJV$depictaiutilishared.catchify)(()=>{
6113
6195
  const json_encoded = JSON.stringify(read_previous_searches());
6114
6196
  if (ls[key] !== json_encoded) ls[key] = json_encoded;
@@ -6129,9 +6211,9 @@ function $ad118c2ba257d9b7$export$84bba84a7b837187(search_query) {
6129
6211
 
6130
6212
 
6131
6213
 
6132
- async function $1c323edfb89c9dca$export$e16630ecb9644a1c({ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ , search_param_name_: search_param_name_ , set_search_field_value_: set_search_field_value_ , search_query_: [read_search_query] , url_transformer_: url_transformer_ , router_: router_ , after_submit_: after_submit_ , get_new_query: get_new_query }) {
6214
+ async function $1c323edfb89c9dca$export$e16630ecb9644a1c({ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_ , search_param_name_: search_param_name_ , set_search_field_value_: set_search_field_value_ , get_search_query_: get_search_query_ , url_transformer_: url_transformer_ , router_: router_ , after_submit_: after_submit_ , get_new_query: get_new_query }) {
6133
6215
  const new_search_query = get_new_query();
6134
- const previous_query = (0, $46MJV$solidjs.untrack)(read_search_query);
6216
+ const previous_query = (0, $46MJV$solidjs.untrack)(get_search_query_);
6135
6217
  if (previous_query === new_search_query && new URLSearchParams(location.search).has(search_param_name_)) {
6136
6218
  // don't push a history entry / re-search if someone submits a search again
6137
6219
  // do close the modal though
@@ -6155,32 +6237,6 @@ async function $1c323edfb89c9dca$export$e16630ecb9644a1c({ on_submit_with_unchan
6155
6237
 
6156
6238
 
6157
6239
 
6158
- function $690220645373c65e$export$2542ffb77b620b02(params_to_default_value) {
6159
- // TODO: remove this abstraction, put it in same place as filters
6160
- // TODO: make it only return an accessor
6161
- const signals = {};
6162
- const entries = Object.entries(params_to_default_value);
6163
- for (const [param, default_value] of entries)signals[param] = (0, $46MJV$solidjs.createSignal)(default_value ?? "");
6164
- const [exit_iterable, exitable_iterable] = (0, $46MJV$depictaiutilishared.make_asyncIterable_exiter)((0, $46MJV$depictaiutilishared.href_change_ipns));
6165
- (0, $46MJV$solidjs.onCleanup)((0, $46MJV$depictaiutilishared.catchify)(exit_iterable));
6166
- (0, $46MJV$depictaiutilishared.catchify)(async ()=>{
6167
- for await (const href of exitable_iterable){
6168
- const { searchParams: searchParams } = new URL(href);
6169
- for (const [param, default_value] of entries){
6170
- const [_get, set] = signals[param];
6171
- if (searchParams.has(param)) {
6172
- const new_val = searchParams.get(param) ?? default_value ?? "";
6173
- set(new_val);
6174
- } else set(default_value ?? "");
6175
- }
6176
- }
6177
- })();
6178
- return signals;
6179
- }
6180
-
6181
-
6182
-
6183
-
6184
6240
 
6185
6241
 
6186
6242
 
@@ -6217,8 +6273,10 @@ function $690220645373c65e$export$2542ffb77b620b02(params_to_default_value) {
6217
6273
 
6218
6274
 
6219
6275
 
6276
+
6277
+
6220
6278
  const $1bf0125991f2d39b$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="orig price"></span>`, 2), $1bf0125991f2d39b$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title"></span></div><div class="price-container"><span class="price"></span></div></div></a>`, 16), $1bf0125991f2d39b$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="tagline"></div>`, 2);
6221
- const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market })=>{
6279
+ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container, { i18n: i18n , market: market }, router_)=>{
6222
6280
  const display = (0, $46MJV$solidjs.createMemo)(()=>{
6223
6281
  const display = display_or_variant_container();
6224
6282
  // Support for backend's new display format
@@ -6230,11 +6288,6 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6230
6288
  };
6231
6289
  }
6232
6290
  if (display.page_url) return display;
6233
- // Support for post-migration (but still old basic format) Stronger displays, with slug but without page_url
6234
- if (display.slug) {
6235
- display.page_url = `/${market}/` + display.slug;
6236
- return display;
6237
- }
6238
6291
  // Support for Spendrups displays, used by our frontend script and Spendrups coming react-ui integration.
6239
6292
  if (!display?.variants?.length) return;
6240
6293
  return display.variants.filter((v)=>v.product_id == display.product_id)[0];
@@ -6252,8 +6305,14 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6252
6305
  init_with_placeholder: true
6253
6306
  }));
6254
6307
  const is_sale = (0, $46MJV$solidjs.createMemo)(()=>display().sale_price !== display().original_price);
6308
+ const href = (0, $46MJV$solidjs.createMemo)(()=>display().page_url);
6255
6309
  const returnVal = (()=>{
6256
6310
  const _el$ = $1bf0125991f2d39b$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
6311
+ (0, $46MJV$solidjsweb.addEventListener)(_el$, "click", (0, $46MJV$depictaiutilishared.catchify)((event_)=>router_.navigate_.go_to_({
6312
+ new_url_: href(),
6313
+ is_replace_: false,
6314
+ event_: event_
6315
+ })), true);
6257
6316
  (0, $46MJV$solidjsweb.insert)(_el$2, contained_image);
6258
6317
  (0, $46MJV$solidjsweb.insert)(_el$5, ()=>display().brand);
6259
6318
  (0, $46MJV$solidjsweb.insert)(_el$6, ()=>display().title);
@@ -6275,22 +6334,30 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6275
6334
  get children () {
6276
6335
  const _el$8 = $1bf0125991f2d39b$var$_tmpl$.cloneNode(true);
6277
6336
  (0, $46MJV$solidjsweb.insert)(_el$8, ()=>i18n.price_formatting_().pre_, null);
6278
- (0, $46MJV$solidjsweb.insert)(_el$8, ()=>(0, $5fc9fc23df1591db$export$469c7af753d08925)({
6279
- price_: (0, $46MJV$solidjs.createMemo)(()=>display().original_price),
6280
- price_formatting_: i18n.price_formatting_
6281
- }), null);
6337
+ (0, $46MJV$solidjsweb.insert)(_el$8, (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
6338
+ get price_ () {
6339
+ return display().original_price;
6340
+ },
6341
+ get price_formatting_ () {
6342
+ return i18n.price_formatting_();
6343
+ }
6344
+ }), null);
6282
6345
  (0, $46MJV$solidjsweb.insert)(_el$8, ()=>i18n.price_formatting_().post_, null);
6283
6346
  return _el$8;
6284
6347
  }
6285
6348
  }), _el$9);
6286
6349
  (0, $46MJV$solidjsweb.insert)(_el$9, ()=>i18n.price_formatting_().pre_, null);
6287
- (0, $46MJV$solidjsweb.insert)(_el$9, ()=>(0, $5fc9fc23df1591db$export$469c7af753d08925)({
6288
- price_: (0, $46MJV$solidjs.createMemo)(()=>display().sale_price),
6289
- price_formatting_: i18n.price_formatting_
6290
- }), null);
6350
+ (0, $46MJV$solidjsweb.insert)(_el$9, (0, $46MJV$solidjsweb.createComponent)((0, $5fc9fc23df1591db$export$a71e92cfbb498adc), {
6351
+ get price_ () {
6352
+ return display().sale_price;
6353
+ },
6354
+ get price_formatting_ () {
6355
+ return i18n.price_formatting_();
6356
+ }
6357
+ }), null);
6291
6358
  (0, $46MJV$solidjsweb.insert)(_el$9, ()=>i18n.price_formatting_().post_, null);
6292
6359
  (0, $46MJV$solidjsweb.effect)((_p$)=>{
6293
- const _v$ = display().page_url, _v$2 = !!is_sale();
6360
+ const _v$ = href(), _v$2 = !!is_sale();
6294
6361
  _v$ !== _p$._v$ && (0, $46MJV$solidjsweb.setAttribute)(_el$, "href", _p$._v$ = _v$);
6295
6362
  _v$2 !== _p$._v$2 && _el$9.classList.toggle("sales-price", _p$._v$2 = _v$2);
6296
6363
  return _p$;
@@ -6303,10 +6370,13 @@ const $1bf0125991f2d39b$export$b05c0ae390cf3e06 = (display_or_variant_container,
6303
6370
  // This solves a JSX type issue where the return value does not match with the explicit JSX.Element type for some reason
6304
6371
  return returnVal;
6305
6372
  };
6373
+ (0, $46MJV$solidjsweb.delegateEvents)([
6374
+ "click"
6375
+ ]);
6306
6376
 
6307
6377
 
6308
6378
  const $4cadf33fd6aaf4b6$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="instant-results"></div>`, 2);
6309
- function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ }) {
6379
+ function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ , search_field_value_: [get_search_field_value] , tenant_: tenant_ , market_: market_ , render_instant_card_: render_instant_card_ , render_instant_card_placeholder_: render_instant_card_placeholder_ , min_products_to_fetch_: min_products_to_fetch_ , has_sort_or_filters_: has_sort_or_filters_ , set_num_results_accessor_: set_num_results_accessor_ , i18n_: i18n_ , router_: router_ }) {
6310
6380
  const max_cards = 4;
6311
6381
  const [read_current_instant_query, write_current_instant_query] = (0, $46MJV$solidjs.createSignal)("");
6312
6382
  let timeout;
@@ -6364,7 +6434,7 @@ function $4cadf33fd6aaf4b6$export$62f101a8aa597bf8({ depict_api_: depict_api_ ,
6364
6434
  i18n: i18n_,
6365
6435
  merchant: tenant_(),
6366
6436
  market: market_()
6367
- }), tenant_, market_)
6437
+ }, router_), tenant_, market_)
6368
6438
  });
6369
6439
  }
6370
6440
  }));
@@ -6670,14 +6740,14 @@ function $5a0afe153acd45d7$export$ba17c5b7e6dda39f({ whole_text_to_display_: who
6670
6740
 
6671
6741
 
6672
6742
  const $aabe56c678fa29ec$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<a class="suggestion"></a>`, 2), $aabe56c678fa29ec$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="search-icon"></div>`, 2), $aabe56c678fa29ec$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<span class="type"></span>`, 2), $aabe56c678fa29ec$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div><span class="value"></span></div>`, 4), $aabe56c678fa29ec$var$_tmpl$5 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<h2 class="text"></h2>`, 2), $aabe56c678fa29ec$var$_tmpl$6 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="suggestion-container query"></div>`, 2), $aabe56c678fa29ec$var$_tmpl$7 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="suggestion-container page"></div>`, 2), $aabe56c678fa29ec$var$_tmpl$8 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="suggestions"></div>`, 2);
6673
- function $aabe56c678fa29ec$export$e872e2339fb04a7f({ suggestion_memo_: suggestion_memo_ , search_page_url_param_name_: search_page_url_param_name_ , selected_index_: [read_selected_index_, write_selected_index_] , url_transformer_: url_transformer_ , filtered_previous_searches_: filtered_previous_searches_ , currently_showing_suggestions_: currently_showing_suggestions_ , on_previous_searches_page_: on_previous_searches_page_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , searching_for_value_: searching_for_value_ , router_: router_ , submit_query_: submit_query_ }) {
6743
+ function $aabe56c678fa29ec$export$e872e2339fb04a7f({ suggestion_memo_: suggestion_memo_ , search_query_url_param_name_: search_query_url_param_name_ , selected_index_: [read_selected_index_, write_selected_index_] , url_transformer_: url_transformer_ , filtered_previous_searches_: filtered_previous_searches_ , currently_showing_suggestions_: currently_showing_suggestions_ , on_previous_searches_page_: on_previous_searches_page_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , searching_for_value_: searching_for_value_ , router_: router_ , submit_query_: submit_query_ }) {
6674
6744
  const queries_memo = (0, $46MJV$solidjs.createMemo)(()=>suggestion_memo_().filter(({ type: type , title: title })=>type === (0, $81eea900c72d569b$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
6675
6745
  ));
6676
6746
  const not_queries_memo = (0, $46MJV$solidjs.createMemo)(()=>suggestion_memo_().filter(({ type: type })=>type !== (0, $81eea900c72d569b$export$3cf9497e790da491)));
6677
6747
  const render_entry = (input_obj, autocomplete_data_index, index, is_history = false)=>{
6678
6748
  const is_query = (0, $46MJV$solidjs.createMemo)(()=>input_obj().type === (0, $81eea900c72d569b$export$3cf9497e790da491));
6679
6749
  const href_with_changed_params_accessor = (0, $46MJV$solidjs.createMemo)(()=>is_query() ? (0, $41151dd3f5de2c98$export$91c3b6774e8be0f5)({
6680
- param_: search_page_url_param_name_,
6750
+ param_: search_query_url_param_name_,
6681
6751
  value_: (0, $46MJV$solidjs.createMemo)(()=>input_obj().title),
6682
6752
  url_transformer_: url_transformer_
6683
6753
  }) : undefined);
@@ -7013,7 +7083,7 @@ function $bc74fbd61efdd8a5$var$open_link_on_cmd_pressed(e, href) {
7013
7083
 
7014
7084
 
7015
7085
  const $81eea900c72d569b$export$3cf9497e790da491 = "query";
7016
- function $81eea900c72d569b$export$2f2b9559550c7bbc({ search_field_value_: search_field_value_ , search_query_: [get_search_query_] , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: unfiltered_previous_searches , previous_searches_text_: previous_searches_text_ , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , input_field_: input_field_ , url_transformer_: url_transformer_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_override_on_enter_fn_: set_override_on_enter_fn_ , selected_index_: selected_index_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , submit_query_: submit_query_ , router_: router_ }) {
7086
+ function $81eea900c72d569b$export$2f2b9559550c7bbc({ search_field_value_: search_field_value_ , get_search_query_: get_search_query_ , search_query_url_param_name_: search_query_url_param_name_ , previous_searches_: unfiltered_previous_searches , previous_searches_text_: previous_searches_text_ , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , input_field_: input_field_ , url_transformer_: url_transformer_ , currently_showing_suggestions_: currently_showing_suggestions_ , set_override_on_enter_fn_: set_override_on_enter_fn_ , selected_index_: selected_index_ , i18n_: i18n_ , include_category_suggestions_: include_category_suggestions_ , submit_query_: submit_query_ , router_: router_ }) {
7017
7087
  const [searching_for_value, set_searching_for_value] = (0, $46MJV$solidjs.createSignal)();
7018
7088
  const [read_search_field_value] = search_field_value_;
7019
7089
  const updating_blocked = (0, $46MJV$solidjs.createSignal)(false);
@@ -7054,7 +7124,7 @@ function $81eea900c72d569b$export$2f2b9559550c7bbc({ search_field_value_: search
7054
7124
  updating_blocked_: updating_blocked,
7055
7125
  currently_showing_suggestions_: currently_showing_suggestions_,
7056
7126
  set_override_on_enter_fn_: set_override_on_enter_fn_,
7057
- search_query_param_name_: search_page_url_param_name_,
7127
+ search_query_param_name_: search_query_url_param_name_,
7058
7128
  url_transformer_: url_transformer_,
7059
7129
  router_: router_
7060
7130
  });
@@ -7069,7 +7139,7 @@ function $81eea900c72d569b$export$2f2b9559550c7bbc({ search_field_value_: search
7069
7139
  get set_unfiltered_previous_searches_ () {
7070
7140
  return unfiltered_previous_searches[1];
7071
7141
  },
7072
- search_query_param_name_: search_page_url_param_name_,
7142
+ search_query_param_name_: search_query_url_param_name_,
7073
7143
  text_: previous_searches_text_,
7074
7144
  get previous_searches_ () {
7075
7145
  return (0, $46MJV$solidjs.createMemo)(()=>filtered_previous_searches().slice(0, 5));
@@ -7096,7 +7166,7 @@ function $81eea900c72d569b$export$2f2b9559550c7bbc({ search_field_value_: search
7096
7166
  i18n_: i18n_,
7097
7167
  url_transformer_: url_transformer_,
7098
7168
  searching_for_value_: searching_for_value,
7099
- search_page_url_param_name_: search_page_url_param_name_,
7169
+ search_query_url_param_name_: search_query_url_param_name_,
7100
7170
  selected_index_: selected_index_,
7101
7171
  suggestion_memo_: read_suggestion_signal,
7102
7172
  currently_showing_suggestions_: currently_showing_suggestions_,
@@ -7131,13 +7201,13 @@ function $fe1bd893954cc9ca$export$c7e181728ad525f(url) {
7131
7201
  }
7132
7202
 
7133
7203
 
7134
- function $4ee1f6be4255fde6$export$3340fdd8259bd4fd({ get_search_field_value_: get_search_field_value_ , search_page_url_param_name_: search_page_url_param_name_ , url_transformer_: url_transformer_ , get_search_query_: get_search_query_ }) {
7204
+ function $4ee1f6be4255fde6$export$3340fdd8259bd4fd({ get_search_field_value_: get_search_field_value_ , search_query_url_param_name_: search_query_url_param_name_ , url_transformer_: url_transformer_ , get_search_query_: get_search_query_ }) {
7135
7205
  let debounce_timeout;
7136
7206
  const stop_timeout = ()=>clearTimeout(debounce_timeout);
7137
7207
  const send_to_ga = (0, $46MJV$depictaiutilishared.catchify)(()=>{
7138
7208
  const fake_url = new URL(location.href);
7139
7209
  const { searchParams: searchParams } = fake_url;
7140
- searchParams.set(search_page_url_param_name_, (0, $46MJV$solidjs.untrack)(get_search_field_value_));
7210
+ searchParams.set(search_query_url_param_name_, (0, $46MJV$solidjs.untrack)(get_search_field_value_));
7141
7211
  searchParams.set("instant_result", "true");
7142
7212
  url_transformer_?.(fake_url);
7143
7213
  (0, $fe1bd893954cc9ca$export$c7e181728ad525f)(fake_url);
@@ -7188,7 +7258,7 @@ function $4a976b492943589f$export$f021bdedd3ec901a(props) {
7188
7258
 
7189
7259
 
7190
7260
  const $121d25ca6af2898f$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="discover-more"><button class="major" type="button"></button></div>`, 4), $121d25ca6af2898f$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<b></b>`, 2), $121d25ca6af2898f$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict-search-modal"><div class="body"><div class="padded"></div></div></div>`, 6), $121d25ca6af2898f$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp search"><div class="depict-search-modal-backdrop"></div></div>`, 4);
7191
- function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_search_field_value , search_query_: search_query_ , search_page_url_param_name_: search_page_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $46MJV$solidjs.createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: props_submit_query , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , bottom_distance_under_modal_: bottom_distance_under_modal_ , selected_text_range_: selected_text_range_ , dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_ = false , router_: router_ }) {
7261
+ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_search_field_value , get_search_query_: get_search_query_ , search_query_url_param_name_: search_query_url_param_name_ , previous_searches_: previous_searches_ , close_modal_: close_modal_ , style_props_: style_props_ = (0, $46MJV$solidjs.createSignal)({}) , depict_api_: depict_api_ , tenant_: tenant_ , market_: market_ , submit_query_: props_submit_query , instant_results_options_: instant_results_options_ , register_closing_animation_: register_closing_animation_ , url_transformer_: url_transformer_ , closing_animation_: closing_animation_ , clear_filters_: clear_filters_ , i18n_: i18n_ , disable_scrolling_: disable_scrolling_ = true , enable_category_suggestions_: enable_category_suggestions_ , class_list_: class_list_ , bottom_distance_under_modal_: bottom_distance_under_modal_ , selected_text_range_: selected_text_range_ , dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_ = false , router_: router_ }) {
7192
7262
  let on_enter_in_search_field_function;
7193
7263
  // As per feedback from stronger we sometimes want a modal with the search field value disconnected from the one in the rest of the UI, see https://depictaiworkspace.slack.com/archives/C02J16R9XEH/p1679065878487709.
7194
7264
  // This is desired for when the modal is opened from a UI element that visually does not look connected with the search page or current query
@@ -7215,7 +7285,7 @@ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_
7215
7285
  equals: false
7216
7286
  });
7217
7287
  if (disable_scrolling_) (0, $fa41c421eb980e23$export$fe334901e8bebd57)();
7218
- $121d25ca6af2898f$var$close_modal_when_navigating_away(close_modal_, search_page_url_param_name_);
7288
+ $121d25ca6af2898f$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
7219
7289
  window.addEventListener("keydown", close_on_escape_handler);
7220
7290
  (0, $46MJV$solidjs.onCleanup)((0, $46MJV$depictaiutilishared.catchify)(()=>window.removeEventListener("keydown", close_on_escape_handler)));
7221
7291
  const owner = (0, $46MJV$solidjs.getOwner)();
@@ -7240,8 +7310,8 @@ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_
7240
7310
  (0, $4ee1f6be4255fde6$export$3340fdd8259bd4fd)({
7241
7311
  get_search_field_value_: get_search_field_value_,
7242
7312
  url_transformer_: url_transformer_,
7243
- search_page_url_param_name_: search_page_url_param_name_,
7244
- get_search_query_: search_query_[0]
7313
+ search_query_url_param_name_: search_query_url_param_name_,
7314
+ get_search_query_: get_search_query_
7245
7315
  });
7246
7316
  const random_classname = (0, $46MJV$depictaiutilishared.make_random_classname)();
7247
7317
  const body_style = (0, $46MJV$solidjs.createMemo)(()=>{
@@ -7258,7 +7328,6 @@ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_
7258
7328
  input_field_ref_: (element)=>set_input_field(element),
7259
7329
  override_on_enter_: (e)=>on_enter_in_search_field_function?.(e),
7260
7330
  on_back_: close_modal_,
7261
- search_query_: search_query_,
7262
7331
  search_field_value_: search_field_value_,
7263
7332
  submit_query_: submit_query_,
7264
7333
  clear_filters_: clear_filters_,
@@ -7290,9 +7359,9 @@ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_
7290
7359
  get previous_searches_text_ () {
7291
7360
  return i18n_.previous_searches_text_;
7292
7361
  },
7293
- search_query_: search_query_,
7362
+ get_search_query_: get_search_query_,
7294
7363
  previous_searches_: previous_searches_,
7295
- search_page_url_param_name_: search_page_url_param_name_,
7364
+ search_query_url_param_name_: search_query_url_param_name_,
7296
7365
  market_: market_,
7297
7366
  tenant_: tenant_,
7298
7367
  selected_index_: selected_index,
@@ -7317,6 +7386,7 @@ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_
7317
7386
  i18n_: i18n_,
7318
7387
  market_: market_,
7319
7388
  set_num_results_accessor_: set_num_results_accessor_,
7389
+ router_: router_,
7320
7390
  ...instant_results_options_
7321
7391
  });
7322
7392
  }
@@ -7349,7 +7419,7 @@ function $121d25ca6af2898f$export$1c593cbd6f1e10bc({ search_field_value_: props_
7349
7419
  })()
7350
7420
  ];
7351
7421
  }
7352
- function $121d25ca6af2898f$var$close_modal_when_navigating_away(close_modal, search_page_url_param_name_) {
7422
+ function $121d25ca6af2898f$var$close_modal_when_navigating_away(close_modal, search_query_url_param_name_) {
7353
7423
  const [exit_iterable, exitable_iterable] = (0, $46MJV$depictaiutilishared.make_asyncIterable_exiter)((0, $46MJV$depictaiutilishared.href_change_ipns));
7354
7424
  let set_initial_values = false;
7355
7425
  let old_pathname;
@@ -7359,7 +7429,7 @@ function $121d25ca6af2898f$var$close_modal_when_navigating_away(close_modal, sea
7359
7429
  for await (const href of exitable_iterable){
7360
7430
  const u_o = new URL(href);
7361
7431
  const new_pathname = u_o.pathname;
7362
- const new_param_value = u_o.searchParams.get(search_page_url_param_name_);
7432
+ const new_param_value = u_o.searchParams.get(search_query_url_param_name_);
7363
7433
  if (set_initial_values) {
7364
7434
  if (new_param_value !== old_param_value || new_pathname !== old_pathname) {
7365
7435
  // close modal when pathname or query changes
@@ -7448,9 +7518,9 @@ function $ea038dec4ee16624$export$c05a196222ba1302({ suggestions_: suggestions_
7448
7518
 
7449
7519
 
7450
7520
  const $297ca03cb5dd5701$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<b></b>`, 2), $297ca03cb5dd5701$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="results-for"></div>`, 2);
7451
- function $297ca03cb5dd5701$export$9dd50d35b9d94fdf({ search_query_: search_query_ , i18n_: i18n_ , formatted_number_of_results_: formatted_number_of_results_ }) {
7521
+ function $297ca03cb5dd5701$export$9dd50d35b9d94fdf({ get_search_query_: get_search_query_ , i18n_: i18n_ , formatted_number_of_results_: formatted_number_of_results_ }) {
7452
7522
  const contents = (0, $46MJV$solidjs.createMemo)((0, $46MJV$depictaiutilishared.catchify)(()=>{
7453
- const q = search_query_[0]();
7523
+ const q = get_search_query_();
7454
7524
  return i18n_.get_showing_results_for_()((()=>{
7455
7525
  const _el$ = $297ca03cb5dd5701$var$_tmpl$.cloneNode(true);
7456
7526
  (0, $46MJV$solidjsweb.insert)(_el$, q);
@@ -7477,7 +7547,7 @@ function $297ca03cb5dd5701$export$9dd50d35b9d94fdf({ search_query_: search_query
7477
7547
 
7478
7548
  const $93779a41dce11249$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $93779a41dce11249$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp search"><div class="listing-page"></div></div>`, 4);
7479
7549
  function $93779a41dce11249$export$a54ec244c8863715(opts) {
7480
- const { depict_api_: depict_api_ , search_field_value_: search_field_value_ , search_query_: search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , rr_options_: rr_options_ , recommendations_rr_options_: recommendations_rr_options_ = rr_options_ , search_recs_view_more_: search_recs_view_more_ , get_product_id_: get_product_id_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ } = opts;
7550
+ const { depict_api_: depict_api_ , search_field_value_: search_field_value_ , get_search_query_: get_search_query_ , open_modal_: open_modal_ , submit_query_: submit_query_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , search_filters_open_: search_filters_open_ , search_sorting_open_: search_sorting_open_ , expanded_filters_: expanded_filters_ , input_modal_open_: input_modal_open_ , selected_filters_: selected_filters_ , i18n_: i18n_ , slider_arrow_button_: slider_arrow_button_ , make_category_suggestion_card_: make_category_suggestion_card_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , clear_filters_on_next_submit_: clear_filters_on_next_submit_ , local_filter_cache_: local_filter_cache_ , include_input_field_: include_input_field_ , tenant_: tenant_ , market_: market_ , showing_recommendation_rows_: showing_recommendation_rows_ , rr_options_: rr_options_ , recommendations_rr_options_: recommendations_rr_options_ = rr_options_ , search_recs_view_more_: search_recs_view_more_ , get_product_id_: get_product_id_ , disable_search_recommendations_: disable_search_recommendations_ , layout_options_: layout_options_ , recommendations_layout_options_: recommendations_layout_options_ = layout_options_ , scroll_restoration_data_: scroll_restoration_data_ } = opts;
7481
7551
  const tenant_object_ = new (0, $46MJV$depictaiutilishared.Tenant)({
7482
7552
  TENANT: (0, $46MJV$solidjs.untrack)(tenant_),
7483
7553
  MARKET: (0, $46MJV$solidjs.untrack)(market_),
@@ -7485,7 +7555,6 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7485
7555
  get_product_id: get_product_id_
7486
7556
  });
7487
7557
  const [get_sorting] = current_sorting_;
7488
- const [get_search_query] = search_query_;
7489
7558
  const all_products_loaded_ = (0, $46MJV$solidjs.createSignal)(false);
7490
7559
  const [get_all_products_loaded, set_all_products_loaded] = all_products_loaded_;
7491
7560
  const number_of_rendered_selected_filters_items_ = (0, $46MJV$solidjs.createSignal)(0);
@@ -7501,7 +7570,7 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7501
7570
  return {
7502
7571
  tenant: tenant_(),
7503
7572
  market: market_(),
7504
- query: get_search_query(),
7573
+ query: get_search_query_(),
7505
7574
  ...f.length ? {
7506
7575
  filters: f
7507
7576
  } : {},
@@ -7514,7 +7583,7 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7514
7583
  set_all_products_loaded(false);
7515
7584
  // only first page of results
7516
7585
  return await (0, $151280ad98f4438b$export$cc42dd29bf655ab6)({
7517
- id_: (0, $46MJV$solidjs.untrack)(get_search_query),
7586
+ id_: (0, $46MJV$solidjs.untrack)(get_search_query_),
7518
7587
  min_products_to_fetch_: min_products_to_fetch_,
7519
7588
  scroll_restoration_data_: scroll_restoration_data_,
7520
7589
  make_request_: (limit, cursor)=>depict_api_.query({
@@ -7527,7 +7596,7 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7527
7596
  });
7528
7597
  }));
7529
7598
  const [suggestions] = (0, $46MJV$solidjs.createResource)((0, $46MJV$solidjs.createMemo)(()=>({
7530
- query: search_query_[0](),
7599
+ query: get_search_query_(),
7531
7600
  tenant: tenant_(),
7532
7601
  market: market_()
7533
7602
  })), (opts)=>depict_api_.suggest(opts));
@@ -7544,7 +7613,6 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7544
7613
  let div_with_field_class;
7545
7614
  search_field = SafeSearchField({
7546
7615
  i18n_: i18n_,
7547
- search_query_: search_query_,
7548
7616
  search_field_value_: search_field_value_,
7549
7617
  submit_query_: submit_query_,
7550
7618
  clear_filters_: clear_filters_on_next_submit_,
@@ -7582,7 +7650,7 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7582
7650
  });
7583
7651
  const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $46MJV$solidjs.createSignal)();
7584
7652
  const results_for = (0, $46MJV$solidjsweb.createComponent)((0, $297ca03cb5dd5701$export$9dd50d35b9d94fdf), {
7585
- search_query_: search_query_,
7653
+ get_search_query_: get_search_query_,
7586
7654
  i18n_: i18n_,
7587
7655
  formatted_number_of_results_: formatted_number_of_results_
7588
7656
  });
@@ -7621,7 +7689,7 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7621
7689
  (0, $46MJV$depictaiutilishared.catchify)((0, $151280ad98f4438b$export$6e49da55e449af7c))({
7622
7690
  scroll_restoration_data_: scroll_restoration_data_,
7623
7691
  last_result_in_viewport_: last_result_in_viewport_,
7624
- id_: get_search_query,
7692
+ id_: get_search_query_,
7625
7693
  can_write_scroll_restoration_: can_write_scroll_restoration_
7626
7694
  });
7627
7695
  (0, $46MJV$solidjs.createComputed)(()=>{
@@ -7633,7 +7701,7 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7633
7701
  available_filters_: available_filters_
7634
7702
  });
7635
7703
  (0, $46MJV$solidjs.createEffect)(()=>{
7636
- get_search_query();
7704
+ get_search_query_();
7637
7705
  (0, $fe1bd893954cc9ca$export$c7e181728ad525f)(location);
7638
7706
  });
7639
7707
  (0, $46MJV$solidjs.createComputed)(()=>{
@@ -7700,7 +7768,7 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7700
7768
  sort_or_filter_open_: sort_or_filter_open_,
7701
7769
  tenant_object_: tenant_object_,
7702
7770
  type_for_tracking_: "search",
7703
- id_currently_querying_for_: get_search_query,
7771
+ id_currently_querying_for_: get_search_query_,
7704
7772
  no_results_options_: {
7705
7773
  selected_filters_: selected_filters_,
7706
7774
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -7813,13 +7881,17 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7813
7881
  #modal_open_signal = (0, $46MJV$solidjs.createSignal)(false);
7814
7882
  static #has_been_constructed = false;
7815
7883
  #router = new (0, $43940d5ca403c293$export$7e1297a3a19f10d8)("hard_navigation");
7816
- 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 , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
7817
- disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal_: bottom_distance_under_modal_ , render_instant_card: render_instant_card , ...props_on_class }){
7884
+ 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 , disable_scrolling_during_modal: // Stuff needed for non-standard customer deployments that we shouldn't actually expose
7885
+ disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal: bottom_distance_under_modal , render_instant_card: render_instant_card , ...props_on_class }){
7818
7886
  if ($79fbf145b15af988$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
7819
7887
  Object.assign(this, props_on_class);
7820
- const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ } = (0, $004640621ca953d0$export$7bcff1eb3eca57d7)(this.#router);
7888
+ if (on_navigation) this.#router.on_navigation_ = on_navigation;
7889
+ const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , search_query_accessor_: raw_search_query_accessor } = (0, $cb699e435fadd254$export$477caf01aecaeb2a)({
7890
+ search_query_url_param_name_: search_query_url_param_name_,
7891
+ router_: this.#router
7892
+ });
7821
7893
  const [reset_history_state_, state_] = (0, $0de081f67b6d15b5$export$9862539c89138352)(()=>({
7822
- search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name) ?? "",
7894
+ search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name_) ?? "",
7823
7895
  search_filters_open: false,
7824
7896
  search_sorting_open: false,
7825
7897
  search_expanded_filters: [],
@@ -7828,14 +7900,15 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7828
7900
  search_expanded_hierarchical_filters: [],
7829
7901
  search_showing_recommendation_rows: (0, $9f81b7ced87aabf2$export$1c8c715550dc689d),
7830
7902
  search_scroll_restoration_data: []
7831
- }));
7903
+ }), this.#router);
7832
7904
  const search_query_updating_blocked_ = (0, $46MJV$solidjs.createSignal)(false);
7833
- const { [search_query_url_param_name]: raw_search_query_signal } = (0, $690220645373c65e$export$2542ffb77b620b02)({
7834
- [search_query_url_param_name]: ""
7905
+ const [get_search_query_updating_blocked] = search_query_updating_blocked_;
7906
+ const get_search_query_ = (0, $46MJV$solidjs.createMemo)((previous_value)=>{
7907
+ if (get_search_query_updating_blocked()) return previous_value;
7908
+ else return raw_search_query_accessor();
7835
7909
  });
7836
- const search_query_signal_ = (0, $46MJV$solidjs.createSignal)((0, $46MJV$solidjs.untrack)(raw_search_query_signal[0]));
7837
7910
  const depict_api_ = api ?? new (0, $9ce64f69303c371e$export$e015ed2f2950f2e3)();
7838
- const previous_searches = (0, $ad118c2ba257d9b7$export$84bba84a7b837187)(search_query_signal_);
7911
+ const previous_searches = (0, $ad118c2ba257d9b7$export$84bba84a7b837187)(get_search_query_);
7839
7912
  const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
7840
7913
  const after_submit_ = ()=>set_search_showing_recommendation_rows((0, $9f81b7ced87aabf2$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
7841
7914
  const on_submit_with_unchanged_value_ = ()=>this.modal_open = false;
@@ -7843,31 +7916,24 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7843
7916
  const configured_submit_query_ = (new_query)=>(0, $1c323edfb89c9dca$export$e16630ecb9644a1c)({
7844
7917
  on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
7845
7918
  set_search_field_value_: set_search_field_value_,
7846
- search_query_: search_query_signal_,
7847
- search_param_name_: search_query_url_param_name,
7848
- url_transformer_: url_transformer,
7919
+ get_search_query_: get_search_query_,
7920
+ search_param_name_: search_query_url_param_name_,
7849
7921
  after_submit_: after_submit_,
7850
7922
  get_new_query: ()=>new_query || (0, $46MJV$solidjs.untrack)(get_search_field_value_),
7923
+ url_transformer_: url_transformer,
7851
7924
  router_: this.#router
7852
7925
  });
7853
7926
  const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
7854
7927
  const clear_filters_on_next_submit_ = (0, $8b282f736ce4f3b8$export$e026af0c7b64ea5f)({
7855
7928
  selected_filters_: selected_filters_,
7856
- search_query_: search_query_signal_,
7929
+ get_search_query_: get_search_query_,
7857
7930
  current_sorting_: current_sorting_,
7858
7931
  expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
7859
7932
  i18n_: i18n_,
7860
7933
  local_filter_cache_: state_.search_local_filter_cache
7861
7934
  });
7862
- if (on_navigation) this.#router.on_navigation_ = on_navigation;
7863
- (0, $46MJV$solidjs.createComputed)(()=>{
7864
- const [get_search_query_updating_blocked] = search_query_updating_blocked_;
7865
- const [get_raw_search_query_signal] = raw_search_query_signal;
7866
- const [, set_search_query_signal] = search_query_signal_; // this signal won't get written from anywhere, see url_params_to_signals JSDoc
7867
- if (!get_search_query_updating_blocked()) set_search_query_signal(get_raw_search_query_signal());
7868
- });
7869
7935
  $79fbf145b15af988$var$privately_shared_properties.set(this, {
7870
- search_query_url_param_name_: search_query_url_param_name,
7936
+ search_query_url_param_name_: search_query_url_param_name_,
7871
7937
  reset_history_state_: reset_history_state_,
7872
7938
  state_: state_,
7873
7939
  router_: this.#router,
@@ -7876,7 +7942,7 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7876
7942
  enable_category_suggestions_: enable_category_suggestions,
7877
7943
  clear_filters_on_next_submit_: clear_filters_on_next_submit_,
7878
7944
  configured_submit_query_: configured_submit_query_,
7879
- search_query_signal_: search_query_signal_,
7945
+ get_search_query_: get_search_query_,
7880
7946
  i18n_: i18n_,
7881
7947
  search_query_updating_blocked_: search_query_updating_blocked_,
7882
7948
  current_sorting_: current_sorting_,
@@ -7890,8 +7956,8 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7890
7956
  return (0, $121d25ca6af2898f$export$1c593cbd6f1e10bc)(...args);
7891
7957
  }, {
7892
7958
  search_field_value_: state_.search_field_value,
7893
- search_query_: search_query_signal_,
7894
- search_page_url_param_name_: search_query_url_param_name,
7959
+ get_search_query_: get_search_query_,
7960
+ search_query_url_param_name_: search_query_url_param_name_,
7895
7961
  previous_searches_: previous_searches,
7896
7962
  depict_api_: depict_api_,
7897
7963
  tenant_: this.#merchant_signal[0],
@@ -7909,7 +7975,7 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7909
7975
  i18n_: i18n_,
7910
7976
  enable_category_suggestions_: enable_category_suggestions,
7911
7977
  disable_scrolling_: disable_scrolling_during_modal,
7912
- bottom_distance_under_modal_: bottom_distance_under_modal_
7978
+ bottom_distance_under_modal_: bottom_distance_under_modal
7913
7979
  });
7914
7980
  // This will add some default behaviour to open_modal_ if no style_props_ are supplied
7915
7981
  // The default behaviour is to align the modal with the input field if possible
@@ -8039,7 +8105,7 @@ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
8039
8105
  min_products_to_fetch_: $79fbf145b15af988$var$min_products_to_fetch_,
8040
8106
  local_filter_cache_: state_.search_local_filter_cache,
8041
8107
  search_field_value_: state_.search_field_value,
8042
- search_query_: shared_properties.search_query_signal_,
8108
+ get_search_query_: shared_properties.get_search_query_,
8043
8109
  clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
8044
8110
  open_modal_: (...args)=>depict_search.modal_open = args,
8045
8111
  submit_query_: shared_properties.configured_submit_query_,
@@ -8104,9 +8170,6 @@ function $79fbf145b15af988$export$316f6f283ae64765({ depict_search: depict_searc
8104
8170
  return (0, $f27b0b326e0a87e2$export$23fca46f3143581f)(()=>{
8105
8171
  let input_element;
8106
8172
  const search_field = (0, $46MJV$solidjsweb.createComponent)((0, $2989e355f64e18e1$export$b94867ecbd698f21), {
8107
- get search_query_ () {
8108
- return shared_properties.search_query_signal_;
8109
- },
8110
8173
  get search_field_value_ () {
8111
8174
  return shared_properties.state_.search_field_value;
8112
8175
  },