@depict-ai/ui 0.0.83 → 1.0.2

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
@@ -1,7 +1,6 @@
1
1
  var $46MJV$depictaiutilishared = require("@depict-ai/utilishared");
2
2
  var $46MJV$solidjsweb = require("solid-js/web");
3
3
  var $46MJV$solidjs = require("solid-js");
4
- var $46MJV$lzstring = require("lz-string");
5
4
 
6
5
  function $parcel$export(e, n, v, s) {
7
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
@@ -35,7 +34,7 @@ $parcel$export(module.exports, "SolidFormatPrice", () => $5fc9fc23df1591db$expor
35
34
  $parcel$export(module.exports, "connect_search_field_height_to_aligner_height", () => $246e3e89a097f014$export$828dcdd425fd3231);
36
35
  $parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
37
36
  $parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
38
- /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.83";
37
+ /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "1.0.2";
39
38
 
40
39
 
41
40
 
@@ -114,15 +113,6 @@ function $0de081f67b6d15b5$export$9862539c89138352(get_default_values_, router_)
114
113
 
115
114
  const $9ce64f69303c371e$var$v2_base_url = (0, $46MJV$depictaiutilishared.base_url) + "/v2/";
116
115
  const $9ce64f69303c371e$var$search_base_url = $9ce64f69303c371e$var$v2_base_url + "search/";
117
- const $9ce64f69303c371e$var$add_ids_to_request = (input_req)=>{
118
- const request = {
119
- ...input_req
120
- };
121
- request.dsid ??= (0, $46MJV$depictaiutilishared.get_depict_id)();
122
- request.user_id ??= (0, $46MJV$depictaiutilishared.get_user_id)();
123
- request.session_id ??= (0, $46MJV$depictaiutilishared.get_session_id)();
124
- return request;
125
- };
126
116
  class $9ce64f69303c371e$export$e015ed2f2950f2e3 {
127
117
  #supports_finalization_registry = typeof FinalizationRegistry === "function";
128
118
  #cache_objs = {};
@@ -137,12 +127,26 @@ class $9ce64f69303c371e$export$e015ed2f2950f2e3 {
137
127
  })) : undefined
138
128
  };
139
129
  }
130
+ #add_ids_to_request = (input_req)=>{
131
+ const request = {
132
+ ...input_req
133
+ };
134
+ request.dsid ??= (0, $46MJV$depictaiutilishared.get_depict_id)();
135
+ // Todo: remove the default user and session IDs once we've confirmed backend can handle it and do whatever fallback is necessary.
136
+ request.user_id ??= this.#get_user_id?.() || (0, $46MJV$depictaiutilishared.get_user_id)();
137
+ request.session_id ??= this.#get_session_id?.() || (0, $46MJV$depictaiutilishared.get_session_id)();
138
+ return request;
139
+ };
140
140
  #get_metadata;
141
- constructor(get_metadata){
141
+ #get_user_id;
142
+ #get_session_id;
143
+ constructor({ get_metadata: get_metadata , get_user_id: get_user_id , get_session_id: get_session_id } = {}){
142
144
  this.#get_metadata = get_metadata;
145
+ this.#get_user_id = get_user_id;
146
+ this.#get_session_id = get_session_id;
143
147
  }
144
148
  async suggest(input_req) {
145
- const request = $9ce64f69303c371e$var$add_ids_to_request(input_req);
149
+ const request = this.#add_ids_to_request(input_req);
146
150
  const url = (0, $46MJV$depictaiutilishared.make_url_with_query_params)($9ce64f69303c371e$var$search_base_url + "suggestions", request);
147
151
  const results = await (0, $46MJV$depictaiutilishared.fetch_retry)((0, $46MJV$depictaiutilishared.add_version_query_params)(url));
148
152
  attempt_to_return_api_response: {
@@ -159,7 +163,7 @@ class $9ce64f69303c371e$export$e015ed2f2950f2e3 {
159
163
  }
160
164
  async #cached_post_request(endpoint1, input_req, fallback_response) {
161
165
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint1);
162
- const with_ids = $9ce64f69303c371e$var$add_ids_to_request(input_req);
166
+ const with_ids = this.#add_ids_to_request(input_req);
163
167
  const metaData = await this.#get_metadata?.();
164
168
  const request = metaData ? Object.assign(with_ids, {
165
169
  metadata: metaData
@@ -833,7 +837,8 @@ function $7b0b7e887b485a91$export$f33414a4df0afd3f({ product_card_template_: pro
833
837
  if (!unwrapped_array?.length || !unwrapped_array.every((item)=>item)) // Haven't finished rendering yet in case of "async" rendering, so don't freeze the elements yet
834
838
  return;
835
839
  // placeholders have finished rendering, freeze the elements
836
- $7b0b7e887b485a91$var$cached_placeholder_element = get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
840
+ // here we might receive the result of a promise that has already been received, tore down and put into cached_placeholder_element, so don't overwrite that more valid result if it's already set
841
+ $7b0b7e887b485a91$var$cached_placeholder_element ||= get_cloned_placeholders(unwrapped_array); // Clone initial return value so that who gave us the elements can't mutate them, which has caused issues before with react
837
842
  $7b0b7e887b485a91$var$rendering_cached_placeholder_element = undefined;
838
843
  dispose_original_copy(); // So that this memo will never re-run and the placeholder rendering function can clean up
839
844
  return get_cloned_placeholders(); // clone, just in case. If we wouldn't, someone could modify the copy in the DOM, and it would affect the cached version
@@ -4425,7 +4430,7 @@ function $c6a04c153e9853a7$var$encode_filter_data(op, data) {
4425
4430
  return encoded_data;
4426
4431
  }
4427
4432
  // Fallback encoding
4428
- return (0, $46MJV$lzstring.compressToBase64)(JSON.stringify(data));
4433
+ return (0, $46MJV$depictaiutilishared.base64_encode_unicode)(JSON.stringify(data));
4429
4434
  }
4430
4435
  function $c6a04c153e9853a7$var$decode_filter_data(op, encoded_data) {
4431
4436
  if (encoded_data === "1") return "true";
@@ -4433,7 +4438,7 @@ function $c6a04c153e9853a7$var$decode_filter_data(op, encoded_data) {
4433
4438
  if (op === "inrange" && encoded_data.includes($c6a04c153e9853a7$var$range_delimiter)) return encoded_data.split($c6a04c153e9853a7$var$range_delimiter).map((x)=>parseFloat(x));
4434
4439
  if (encoded_data.includes($c6a04c153e9853a7$var$string_item_delimiter) || encoded_data.includes($c6a04c153e9853a7$var$array_item_delimiter)) return $c6a04c153e9853a7$var$decode_array(encoded_data);
4435
4440
  try {
4436
- return JSON.parse((0, $46MJV$lzstring.decompressFromBase64)(encoded_data));
4441
+ return JSON.parse((0, $46MJV$depictaiutilishared.base64_decode_unicode)(encoded_data));
4437
4442
  } catch (e) {
4438
4443
  (0, $46MJV$depictaiutilishared.dlog)("Failed to fallback parse filter data", op, encoded_data, e);
4439
4444
  }
@@ -4494,13 +4499,13 @@ function $c6a04c153e9853a7$export$af4a870a0ee262c4(search_params) {
4494
4499
  ];
4495
4500
  for (const key of keys)if (key.startsWith($c6a04c153e9853a7$var$filter_query_param_prefix) || key === $c6a04c153e9853a7$var$sorting_query_param) search_params.delete(key);
4496
4501
  }
4497
- const $c6a04c153e9853a7$export$e2cf3f19dd3f8aac = "went_sideways_clear_filters";
4502
+ const $c6a04c153e9853a7$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
4498
4503
  function $c6a04c153e9853a7$export$43cd1e747fecd42e(to_url, set_clearing_flag, from_search_params = new URLSearchParams(location.search)) {
4499
4504
  if (!to_url) return to_url;
4500
4505
  const was_url_object = to_url instanceof URL;
4501
4506
  const url_object = was_url_object ? to_url : new URL(to_url, location.origin);
4502
4507
  const { searchParams: searchParams } = url_object;
4503
- if (set_clearing_flag) searchParams.set($c6a04c153e9853a7$export$e2cf3f19dd3f8aac, "true");
4508
+ if (set_clearing_flag) searchParams.set($c6a04c153e9853a7$export$cf5feb2102aec7f2, "true");
4504
4509
  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));
4505
4510
  for (const key of from_search_params.keys())if (key.startsWith($c6a04c153e9853a7$var$filter_query_param_prefix)) searchParams.set(key, from_search_params.get(key));
4506
4511
  if (was_url_object) return url_object;
@@ -4674,6 +4679,7 @@ function $cdc2c00c0a7da86e$export$466cdc317043f6cb({ quicklinks_data_: quicklink
4674
4679
  const quicklinks_data = quicklinks_data_(); // this signal should have updated by now since this is a createEffect
4675
4680
  const current_id = current_query_id_();
4676
4681
  if (!new_data || !quicklinks_data || !current_id) return;
4682
+ const owner = (0, $46MJV$solidjs.getOwner)();
4677
4683
  queueMicrotask(()=>{
4678
4684
  // has to be in microtask so that elements have rendered and are scroll-to-able
4679
4685
  scrolling_logic_ran_for_query_id = true;
@@ -4686,17 +4692,17 @@ function $cdc2c00c0a7da86e$export$466cdc317043f6cb({ quicklinks_data_: quicklink
4686
4692
  } else if (!(intersecting_items_object[selected_index()]?.intersectionRatio >= 0.95)) {
4687
4693
  // negated larger than to handle left side of comparison being undefined
4688
4694
  let done_work = false;
4689
- (0, $46MJV$solidjs.createComputed)((0, $46MJV$depictaiutilishared.catchify)(()=>{
4690
- if (done_work || !Array.isArray(quicklinks_data_())) return;
4691
- const sel_index = selected_index();
4692
- const target_element = sel_index >= 0 ? sel_index : 0;
4693
- if (document.documentElement.contains(insert_here)) {
4694
- slider.scroll_to_abs(target_element, true); // if nothing selected and no selected scroll position, go to left
4695
- last_scroll_position = insert_here.scrollLeft; // update this because it might get removed from the DOM before intersection observers triggered (actually happened for me)
4696
- } else // can't scroll if not in the DOM, scroll when we're back instead
4697
- scroll_to_element_on_dom_insertion = target_element;
4698
- done_work = true;
4699
- }));
4695
+ (0, $46MJV$solidjs.runWithOwner)(owner, ()=>(0, $46MJV$solidjs.createComputed)((0, $46MJV$depictaiutilishared.catchify)(()=>{
4696
+ if (done_work || !Array.isArray(quicklinks_data_())) return;
4697
+ const sel_index = selected_index();
4698
+ const target_element = sel_index >= 0 ? sel_index : 0;
4699
+ if (document.documentElement.contains(insert_here)) {
4700
+ slider.scroll_to_abs(target_element, true); // if nothing selected and no selected scroll position, go to left
4701
+ last_scroll_position = insert_here.scrollLeft; // update this because it might get removed from the DOM before intersection observers triggered (actually happened for me)
4702
+ } else // can't scroll if not in the DOM, scroll when we're back instead
4703
+ scroll_to_element_on_dom_insertion = target_element;
4704
+ done_work = true;
4705
+ })));
4700
4706
  }
4701
4707
  });
4702
4708
  }, {
@@ -4883,8 +4889,7 @@ let $29b757e2ae26852c$export$44dad306455dddf;
4883
4889
 
4884
4890
 
4885
4891
 
4886
-
4887
- function $207f7b30db90d048$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ , query_id_: query_id_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , plp_results_: plp_results_ , router_: router_ }) {
4892
+ function $207f7b30db90d048$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ , query_id_: query_id_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , plp_results_: plp_results_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ }) {
4888
4893
  // If we just got opened in a new tab, clear filters instantly and remove the flag
4889
4894
  $207f7b30db90d048$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
4890
4895
  plp_results_: plp_results_,
@@ -4892,7 +4897,7 @@ function $207f7b30db90d048$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ ,
4892
4897
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
4893
4898
  selected_filters_: selected_filters_,
4894
4899
  i18n_: i18n_,
4895
- router_: router_
4900
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
4896
4901
  });
4897
4902
  // Code below is for when we're already open and the user navigates to a new category
4898
4903
  let previous_crumb_data = (0, $46MJV$solidjs.untrack)(crumb_data_);
@@ -4922,7 +4927,7 @@ function $207f7b30db90d048$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ ,
4922
4927
  local_filter_cache_: local_filter_cache_
4923
4928
  });
4924
4929
  // Also ensure we don't have `sideways_url_params_flag` set anymore
4925
- $207f7b30db90d048$var$delete_sideways_param_flag(router_);
4930
+ sideways_filter_clearing_flag_[1](false);
4926
4931
  }
4927
4932
  }
4928
4933
  query_id_when_we_got_previous_data = query_id_of_new_data;
@@ -4930,11 +4935,11 @@ function $207f7b30db90d048$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ ,
4930
4935
  if (!allow_filter_clearing) allow_filter_clearing = true;
4931
4936
  })));
4932
4937
  }
4933
- function $207f7b30db90d048$var$clear_if_opened_new_tab_with_sideways_url_params_flag({ plp_results_: plp_results_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , router_: router_ }) {
4938
+ function $207f7b30db90d048$var$clear_if_opened_new_tab_with_sideways_url_params_flag({ plp_results_: plp_results_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , sideways_filter_clearing_flag_: [get_sideways_filter_clearing_flag_, set_sideways_filter_clearing_flag_] }) {
4934
4939
  const tracking_function_for_plp_results = (0, $46MJV$solidjs.createReaction)(()=>{
4935
4940
  // On first rendering of the CategoryPage (after we have results), check if we got to this URL by going sideways in QuickLinks and clear filters with toast if so
4936
- const had_flag = $207f7b30db90d048$var$delete_sideways_param_flag(router_);
4937
- if (!had_flag) return;
4941
+ if (!(0, $46MJV$solidjs.untrack)(get_sideways_filter_clearing_flag_)) return;
4942
+ set_sideways_filter_clearing_flag_(false);
4938
4943
  (0, $46MJV$depictaiutilishared.dlog)("Flag to clear filters was set, clearing filters");
4939
4944
  (0, $46MJV$depictaiutilishared.queueMacroTask)(()=>{
4940
4945
  // Do it next task so that all the filters have time to populate
@@ -4950,22 +4955,10 @@ function $207f7b30db90d048$var$clear_if_opened_new_tab_with_sideways_url_params_
4950
4955
  });
4951
4956
  tracking_function_for_plp_results(plp_results_);
4952
4957
  }
4953
- function $207f7b30db90d048$var$delete_sideways_param_flag(router) {
4954
- const url_object = new URL(location.href);
4955
- const { searchParams: searchParams } = url_object;
4956
- if (searchParams.get((0, $c6a04c153e9853a7$export$e2cf3f19dd3f8aac)) !== "true") return false;
4957
- searchParams.delete((0, $c6a04c153e9853a7$export$e2cf3f19dd3f8aac));
4958
- router.navigate_.go_to_({
4959
- new_url_: url_object,
4960
- is_replace_: true,
4961
- force_spa_navigation_: true
4962
- });
4963
- return true;
4964
- }
4965
4958
 
4966
4959
 
4967
4960
  const $671632478f2a7ce7$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="product-count"> </div>`, 2), $671632478f2a7ce7$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div></div>`, 2), $671632478f2a7ce7$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="filter-results-for-one-row"></div>`, 2), $671632478f2a7ce7$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp category"><div class="listing-page"></div></div>`, 4);
4968
- function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , 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_ , slider_arrow_button_: slider_arrow_button_ , 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_ }) {
4961
+ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , 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_ , slider_arrow_button_: slider_arrow_button_ , 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_ }) {
4969
4962
  let results_for;
4970
4963
  let only_show_filters_opener_;
4971
4964
  let middle_elements_;
@@ -5141,7 +5134,7 @@ function $671632478f2a7ce7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
5141
5134
  local_filter_cache_: local_filter_cache_,
5142
5135
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
5143
5136
  plp_results_: plp_results_,
5144
- router_: router_
5137
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
5145
5138
  });
5146
5139
  get_breadcrumb_accessor_?.(crumb_data_);
5147
5140
  get_quicklinks_accessor_?.(quicklinks_data_);
@@ -5333,7 +5326,9 @@ const $7958d3dbd96a4f87$export$6daf8749b65a1b77 = (cols_at_size)=>{
5333
5326
  ];
5334
5327
  }
5335
5328
  // Sort widths in ascending order
5336
- const sorted_cols_at_size = cols_at_size.sort((a, b)=>{
5329
+ const sorted_cols_at_size = [
5330
+ ...cols_at_size
5331
+ ].sort((a, b)=>{
5337
5332
  const [_b, width_A] = a;
5338
5333
  const [_a, width_b] = b;
5339
5334
  if (width_A === undefined) return -1;
@@ -5391,14 +5386,18 @@ function $f27b0b326e0a87e2$export$23fca46f3143581f(component, error_message) {
5391
5386
 
5392
5387
 
5393
5388
 
5394
- function $cb699e435fadd254$export$477caf01aecaeb2a({ search_query_url_param_name_: search_query_url_param_name_ , router_: router_ }) {
5389
+ function $cb699e435fadd254$export$477caf01aecaeb2a(options) {
5390
+ const router_ = options.router_;
5391
+ const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
5395
5392
  const search_query_ = search_query_url_param_name_ ? (0, $46MJV$solidjs.createSignal)("") : undefined;
5396
5393
  const get_search_query_ = search_query_?.[0];
5397
5394
  const set_search_query = search_query_?.[1];
5398
5395
  const current_sorting_ = (0, $46MJV$solidjs.createSignal)();
5399
5396
  const selected_filters_ = (0, $46MJV$solidjs.createSignal)([]);
5397
+ const sideways_filter_clearing_flag_ = (0, $46MJV$solidjs.createSignal)(false);
5400
5398
  const [get_sorting_, set_sorting] = current_sorting_;
5401
5399
  const [get_selected_filters_, set_selected_filters] = selected_filters_;
5400
+ const [get_has_sideways_filter_clearing_flag_, set_has_sideways_filter_clearing_flag] = sideways_filter_clearing_flag_;
5402
5401
  const [get_current_href, set_current_href] = (0, $46MJV$solidjs.createSignal)(location.href);
5403
5402
  const history_change_handler = (0, $46MJV$depictaiutilishared.catchify)(()=>set_current_href(location.href));
5404
5403
  const owner = (0, $46MJV$solidjs.getOwner)() || (0, $46MJV$solidjs.createRoot)(()=>(0, $46MJV$solidjs.getOwner)());
@@ -5432,12 +5431,14 @@ function $cb699e435fadd254$export$477caf01aecaeb2a({ search_query_url_param_name
5432
5431
  const found_query = searchParams.get(search_query_url_param_name_);
5433
5432
  set_search_query(found_query || "");
5434
5433
  }
5434
+ if (searchParams.get((0, $c6a04c153e9853a7$export$cf5feb2102aec7f2)) === "true") set_has_sideways_filter_clearing_flag(true);
5435
5435
  if (!writer_started) {
5436
5436
  // 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
5437
5437
  (0, $46MJV$solidjs.runWithOwner)(owner, ()=>$cb699e435fadd254$var$start_href_writer({
5438
5438
  get_sorting_: get_sorting_,
5439
5439
  get_selected_filters_: get_selected_filters_,
5440
- router_: router_
5440
+ router_: router_,
5441
+ get_has_sideways_filter_clearing_flag_: get_has_sideways_filter_clearing_flag_
5441
5442
  }));
5442
5443
  writer_started = true;
5443
5444
  }
@@ -5449,22 +5450,26 @@ function $cb699e435fadd254$export$477caf01aecaeb2a({ search_query_url_param_name
5449
5450
  selected_filters_: selected_filters_,
5450
5451
  ...typeof search_query_url_param_name_ === "string" ? {
5451
5452
  search_query_accessor_: get_search_query_
5452
- } : {}
5453
+ } : {
5454
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
5455
+ }
5453
5456
  };
5454
5457
  }
5455
5458
  /**
5456
5459
  * Writes the sorting and filters to the URL query parameters when they change.
5457
- */ function $cb699e435fadd254$var$start_href_writer({ get_sorting_: get_sorting_ , get_selected_filters_: get_selected_filters_ , router_: router_ }) {
5460
+ */ function $cb699e435fadd254$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_ }) {
5458
5461
  (0, $46MJV$solidjs.createEffect)((0, $46MJV$solidjs.on)([
5459
5462
  get_sorting_,
5460
- get_selected_filters_
5461
- ], ([sorting, filters])=>{
5463
+ get_selected_filters_,
5464
+ get_has_sideways_filter_clearing_flag_
5465
+ ], ([sorting, filters, has_sideways_filter_clearing_flag])=>{
5462
5466
  const current_href = location.href;
5463
5467
  const url_object = new URL(current_href);
5464
5468
  const { searchParams: searchParams } = url_object;
5465
5469
  (0, $c6a04c153e9853a7$export$af4a870a0ee262c4)(searchParams);
5466
5470
  (0, $c6a04c153e9853a7$export$62acb285a7579555)(sorting, searchParams);
5467
5471
  (0, $c6a04c153e9853a7$export$58aa3f171519b6d7)(filters, searchParams);
5472
+ if (!has_sideways_filter_clearing_flag) $cb699e435fadd254$var$delete_sideways_param_flag(searchParams);
5468
5473
  // 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
5469
5474
  const unmodified_search_params = [
5470
5475
  ...new URL(current_href).searchParams
@@ -5484,6 +5489,9 @@ function $cb699e435fadd254$export$477caf01aecaeb2a({ search_query_url_param_name
5484
5489
  defer: true
5485
5490
  }));
5486
5491
  }
5492
+ function $cb699e435fadd254$var$delete_sideways_param_flag(searchParams) {
5493
+ if (searchParams.get((0, $c6a04c153e9853a7$export$cf5feb2102aec7f2)) === "true") searchParams.delete((0, $c6a04c153e9853a7$export$cf5feb2102aec7f2));
5494
+ }
5487
5495
 
5488
5496
 
5489
5497
 
@@ -5617,38 +5625,42 @@ class $068a627cc18f7bb6$export$f34314aa9505732e {
5617
5625
  this.#router.on_navigation_ = new_function;
5618
5626
  }
5619
5627
  constructor({ api: api , on_navigation: on_navigation , ...props_on_class }){
5620
- if ($068a627cc18f7bb6$export$f34314aa9505732e.#has_been_constructed) throw new Error("You can only have one instance of DepictCategory due to state limitations");
5621
- $068a627cc18f7bb6$export$f34314aa9505732e.#has_been_constructed = true;
5622
- Object.assign(this, props_on_class); // set initial signal values
5623
- (0, $33815c5a406b6cc0$export$5162a71f252e6122)();
5624
- if (on_navigation) this.#router.on_navigation_ = on_navigation;
5625
- const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ } = (0, $cb699e435fadd254$export$477caf01aecaeb2a)({
5626
- router_: this.#router
5627
- });
5628
- const [reset_history_state_, state_] = (0, $0de081f67b6d15b5$export$9862539c89138352)(()=>({
5629
- category_filters_open: false,
5630
- category_sorting_open: false,
5631
- category_expanded_filters: [],
5632
- // 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
5633
- category_local_filter_cache: [],
5634
- category_expanded_hierarchical_filters: [],
5635
- category_scroll_restoration_data: []
5636
- }), this.#router);
5637
- const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
5638
- $068a627cc18f7bb6$var$privately_shared_properties.set(this, {
5639
- state_: state_,
5640
- breadcrumb_signal_: (0, $46MJV$solidjs.createSignal)(),
5641
- quicklinks_signal_: (0, $46MJV$solidjs.createSignal)(),
5642
- i18n_: i18n_,
5643
- reset_history_state_: reset_history_state_,
5644
- depict_api_: api ?? new (0, $9ce64f69303c371e$export$e015ed2f2950f2e3)(),
5645
- router_: this.#router,
5646
- selected_filters_: selected_filters_,
5647
- current_sorting_: current_sorting_,
5648
- slider_arrow_button_: (0, $46MJV$depictaiutilishared.GenericSliderArrowButton)({
5649
- height_: 12,
5650
- width_: 6.46
5651
- })
5628
+ const owner = (0, $46MJV$solidjs.getOwner)() || (0, $46MJV$solidjs.createRoot)(()=>(0, $46MJV$solidjs.getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
5629
+ (0, $46MJV$solidjs.runWithOwner)(owner, ()=>{
5630
+ if ($068a627cc18f7bb6$export$f34314aa9505732e.#has_been_constructed) throw new Error("You can only have one instance of DepictCategory due to state limitations");
5631
+ $068a627cc18f7bb6$export$f34314aa9505732e.#has_been_constructed = true;
5632
+ Object.assign(this, props_on_class); // set initial signal values
5633
+ (0, $33815c5a406b6cc0$export$5162a71f252e6122)();
5634
+ if (on_navigation) this.#router.on_navigation_ = on_navigation;
5635
+ const { selected_filters_: selected_filters_ , current_sorting_: current_sorting_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ } = (0, $cb699e435fadd254$export$477caf01aecaeb2a)({
5636
+ router_: this.#router
5637
+ });
5638
+ const [reset_history_state_, state_] = (0, $0de081f67b6d15b5$export$9862539c89138352)(()=>({
5639
+ category_filters_open: false,
5640
+ category_sorting_open: false,
5641
+ category_expanded_filters: [],
5642
+ // 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
5643
+ category_local_filter_cache: [],
5644
+ category_expanded_hierarchical_filters: [],
5645
+ category_scroll_restoration_data: []
5646
+ }), this.#router);
5647
+ const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
5648
+ $068a627cc18f7bb6$var$privately_shared_properties.set(this, {
5649
+ state_: state_,
5650
+ breadcrumb_signal_: (0, $46MJV$solidjs.createSignal)(),
5651
+ quicklinks_signal_: (0, $46MJV$solidjs.createSignal)(),
5652
+ i18n_: i18n_,
5653
+ reset_history_state_: reset_history_state_,
5654
+ depict_api_: api ?? new (0, $9ce64f69303c371e$export$e015ed2f2950f2e3)(),
5655
+ router_: this.#router,
5656
+ selected_filters_: selected_filters_,
5657
+ current_sorting_: current_sorting_,
5658
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
5659
+ slider_arrow_button_: (0, $46MJV$depictaiutilishared.GenericSliderArrowButton)({
5660
+ height_: 12,
5661
+ width_: 6.46
5662
+ })
5663
+ });
5652
5664
  });
5653
5665
  }
5654
5666
  }
@@ -5661,7 +5673,7 @@ function $068a627cc18f7bb6$export$e2bf8ce7779e827e({ depict_category: depict_cat
5661
5673
  grid_spacing: grid_spacing.horizontal
5662
5674
  };
5663
5675
  return (0, $f27b0b326e0a87e2$export$23fca46f3143581f)(()=>{
5664
- const { state_: { category_local_filter_cache: local_filter_cache_ , category_filters_open: category_filters_open_ , category_sorting_open: category_sorting_open_ , category_expanded_filters: expanded_filters_ , category_expanded_hierarchical_filters: expanded_hierarchical_filters_ , category_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_ , slider_arrow_button_: slider_arrow_button_ } = shared_properties;
5676
+ const { state_: { category_local_filter_cache: local_filter_cache_ , category_filters_open: category_filters_open_ , category_sorting_open: category_sorting_open_ , category_expanded_filters: expanded_filters_ , category_expanded_hierarchical_filters: expanded_hierarchical_filters_ , category_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_ , slider_arrow_button_: slider_arrow_button_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ } = shared_properties;
5665
5677
  (0, $46MJV$solidjs.onCleanup)(reset_history_state_);
5666
5678
  return (0, $671632478f2a7ce7$export$f7d2f673fc2f091d)({
5667
5679
  tenant_: ()=>depict_category.merchant,
@@ -5684,6 +5696,7 @@ function $068a627cc18f7bb6$export$e2bf8ce7779e827e({ depict_category: depict_cat
5684
5696
  expanded_filters_: expanded_filters_,
5685
5697
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
5686
5698
  selected_filters_: selected_filters_,
5699
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
5687
5700
  scroll_restoration_data_: scroll_restoration_data_,
5688
5701
  layout_options_: {
5689
5702
  cols_at_size: (0, $7958d3dbd96a4f87$export$6daf8749b65a1b77)(cols_at_size),
@@ -7892,159 +7905,161 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7892
7905
  #router = new (0, $43940d5ca403c293$export$7e1297a3a19f10d8)("hard_navigation");
7893
7906
  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
7894
7907
  disable_scrolling_during_modal = true , api: api , bottom_distance_under_modal: bottom_distance_under_modal , render_instant_card: render_instant_card , ...props_on_class }){
7895
- if ($79fbf145b15af988$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
7896
- Object.assign(this, props_on_class);
7897
- if (on_navigation) this.#router.on_navigation_ = on_navigation;
7898
- const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , search_query_accessor_: raw_search_query_accessor } = (0, $cb699e435fadd254$export$477caf01aecaeb2a)({
7899
- search_query_url_param_name_: search_query_url_param_name_,
7900
- router_: this.#router
7901
- });
7902
- const [reset_history_state_, state_] = (0, $0de081f67b6d15b5$export$9862539c89138352)(()=>({
7903
- search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name_) ?? "",
7904
- search_filters_open: false,
7905
- search_sorting_open: false,
7906
- search_expanded_filters: [],
7907
- // 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
7908
- search_local_filter_cache: [],
7909
- search_expanded_hierarchical_filters: [],
7910
- search_showing_recommendation_rows: (0, $9f81b7ced87aabf2$export$1c8c715550dc689d),
7911
- search_scroll_restoration_data: []
7912
- }), this.#router);
7913
- const search_query_updating_blocked_ = (0, $46MJV$solidjs.createSignal)(false);
7914
- const [get_search_query_updating_blocked] = search_query_updating_blocked_;
7915
- const get_search_query_ = (0, $46MJV$solidjs.createMemo)((previous_value)=>{
7916
- if (get_search_query_updating_blocked()) return previous_value;
7917
- else return raw_search_query_accessor();
7918
- });
7919
- const depict_api_ = api ?? new (0, $9ce64f69303c371e$export$e015ed2f2950f2e3)();
7920
- const previous_searches = (0, $ad118c2ba257d9b7$export$84bba84a7b837187)(get_search_query_);
7921
- const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
7922
- 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
7923
- const on_submit_with_unchanged_value_ = ()=>this.modal_open = false;
7924
- const [get_search_field_value_, set_search_field_value_] = state_.search_field_value;
7925
- const configured_submit_query_ = (new_query)=>(0, $1c323edfb89c9dca$export$e16630ecb9644a1c)({
7926
- on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
7927
- set_search_field_value_: set_search_field_value_,
7928
- get_search_query_: get_search_query_,
7929
- search_param_name_: search_query_url_param_name_,
7930
- after_submit_: after_submit_,
7931
- get_new_query: ()=>new_query || (0, $46MJV$solidjs.untrack)(get_search_field_value_),
7932
- url_transformer_: url_transformer,
7908
+ const owner = (0, $46MJV$solidjs.getOwner)() || (0, $46MJV$solidjs.createRoot)(()=>(0, $46MJV$solidjs.getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
7909
+ (0, $46MJV$solidjs.runWithOwner)(owner, ()=>{
7910
+ if ($79fbf145b15af988$export$ac6237957a15b3f0.#has_been_constructed) throw new Error("You can only have one instance of DepictSearch");
7911
+ Object.assign(this, props_on_class);
7912
+ if (on_navigation) this.#router.on_navigation_ = on_navigation;
7913
+ const { current_sorting_: current_sorting_ , selected_filters_: selected_filters_ , search_query_accessor_: raw_search_query_accessor } = (0, $cb699e435fadd254$export$477caf01aecaeb2a)({
7914
+ search_query_url_param_name_: search_query_url_param_name_,
7933
7915
  router_: this.#router
7934
7916
  });
7935
- const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
7936
- const clear_filters_on_next_submit_ = (0, $8b282f736ce4f3b8$export$e026af0c7b64ea5f)({
7937
- selected_filters_: selected_filters_,
7938
- get_search_query_: get_search_query_,
7939
- current_sorting_: current_sorting_,
7940
- expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
7941
- i18n_: i18n_,
7942
- local_filter_cache_: state_.search_local_filter_cache
7943
- });
7944
- $79fbf145b15af988$var$privately_shared_properties.set(this, {
7945
- search_query_url_param_name_: search_query_url_param_name_,
7946
- reset_history_state_: reset_history_state_,
7947
- state_: state_,
7948
- router_: this.#router,
7949
- url_transformer_: url_transformer,
7950
- depict_api_: depict_api_,
7951
- enable_category_suggestions_: enable_category_suggestions,
7952
- clear_filters_on_next_submit_: clear_filters_on_next_submit_,
7953
- configured_submit_query_: configured_submit_query_,
7954
- get_search_query_: get_search_query_,
7955
- i18n_: i18n_,
7956
- search_query_updating_blocked_: search_query_updating_blocked_,
7957
- current_sorting_: current_sorting_,
7958
- selected_filters_: selected_filters_
7959
- });
7960
- (0, $33815c5a406b6cc0$export$5162a71f252e6122)();
7961
- (0, $46MJV$depictaiutilishared.catchify)(async ()=>{
7962
- const owner = (0, $46MJV$solidjs.getOwner)() || (0, $46MJV$solidjs.createRoot)(()=>(0, $46MJV$solidjs.getOwner)()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
7963
- const { open_modal_: open_modal_ , close_modal_: close_modal_ } = await (0, $089c01924e13fae5$export$79b1565500412d9b)((...args)=>{
7964
- (0, $46MJV$solidjs.onCleanup)(()=>this.modal_open = false);
7965
- return (0, $121d25ca6af2898f$export$1c593cbd6f1e10bc)(...args);
7966
- }, {
7967
- search_field_value_: state_.search_field_value,
7917
+ const [reset_history_state_, state_] = (0, $0de081f67b6d15b5$export$9862539c89138352)(()=>({
7918
+ search_field_value: new URLSearchParams(location.search).get(search_query_url_param_name_) ?? "",
7919
+ search_filters_open: false,
7920
+ search_sorting_open: false,
7921
+ search_expanded_filters: [],
7922
+ // 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
7923
+ search_local_filter_cache: [],
7924
+ search_expanded_hierarchical_filters: [],
7925
+ search_showing_recommendation_rows: (0, $9f81b7ced87aabf2$export$1c8c715550dc689d),
7926
+ search_scroll_restoration_data: []
7927
+ }), this.#router);
7928
+ const search_query_updating_blocked_ = (0, $46MJV$solidjs.createSignal)(false);
7929
+ const [get_search_query_updating_blocked] = search_query_updating_blocked_;
7930
+ const get_search_query_ = (0, $46MJV$solidjs.createMemo)((previous_value)=>{
7931
+ if (get_search_query_updating_blocked()) return previous_value;
7932
+ else return raw_search_query_accessor();
7933
+ });
7934
+ const depict_api_ = api ?? new (0, $9ce64f69303c371e$export$e015ed2f2950f2e3)();
7935
+ const previous_searches = (0, $ad118c2ba257d9b7$export$84bba84a7b837187)(get_search_query_);
7936
+ const [, set_search_showing_recommendation_rows] = state_.search_showing_recommendation_rows;
7937
+ 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
7938
+ const on_submit_with_unchanged_value_ = ()=>this.modal_open = false;
7939
+ const [get_search_field_value_, set_search_field_value_] = state_.search_field_value;
7940
+ const configured_submit_query_ = (new_query)=>(0, $1c323edfb89c9dca$export$e16630ecb9644a1c)({
7941
+ on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
7942
+ set_search_field_value_: set_search_field_value_,
7943
+ get_search_query_: get_search_query_,
7944
+ search_param_name_: search_query_url_param_name_,
7945
+ after_submit_: after_submit_,
7946
+ get_new_query: ()=>new_query || (0, $46MJV$solidjs.untrack)(get_search_field_value_),
7947
+ url_transformer_: url_transformer,
7948
+ router_: this.#router
7949
+ });
7950
+ const i18n_ = (0, $623202ae203e9e59$export$f091cbac892643a4)(this.#locale_signal[0]);
7951
+ const clear_filters_on_next_submit_ = (0, $8b282f736ce4f3b8$export$e026af0c7b64ea5f)({
7952
+ selected_filters_: selected_filters_,
7968
7953
  get_search_query_: get_search_query_,
7954
+ current_sorting_: current_sorting_,
7955
+ expanded_hierarchical_filters_: state_.search_expanded_hierarchical_filters,
7956
+ i18n_: i18n_,
7957
+ local_filter_cache_: state_.search_local_filter_cache
7958
+ });
7959
+ $79fbf145b15af988$var$privately_shared_properties.set(this, {
7969
7960
  search_query_url_param_name_: search_query_url_param_name_,
7970
- previous_searches_: previous_searches,
7971
- depict_api_: depict_api_,
7972
- tenant_: this.#merchant_signal[0],
7973
- clear_filters_: clear_filters_on_next_submit_,
7974
- market_: this.#market_signal[0],
7975
- submit_query_: configured_submit_query_,
7976
- url_transformer_: url_transformer,
7961
+ reset_history_state_: reset_history_state_,
7962
+ state_: state_,
7977
7963
  router_: this.#router,
7978
- instant_results_options_: {
7979
- min_products_to_fetch_: $79fbf145b15af988$var$min_products_to_fetch_,
7980
- render_instant_card_: render_instant_card,
7981
- render_instant_card_placeholder_: (0, $17c49340edfdbb31$export$ee1733d9a8495996),
7982
- has_sort_or_filters_: (0, $46MJV$solidjs.createMemo)(()=>!!(Object.keys(selected_filters_[0]())?.length || current_sorting_[0]()))
7983
- },
7984
- i18n_: i18n_,
7964
+ url_transformer_: url_transformer,
7965
+ depict_api_: depict_api_,
7985
7966
  enable_category_suggestions_: enable_category_suggestions,
7986
- disable_scrolling_: disable_scrolling_during_modal,
7987
- bottom_distance_under_modal_: bottom_distance_under_modal
7967
+ clear_filters_on_next_submit_: clear_filters_on_next_submit_,
7968
+ configured_submit_query_: configured_submit_query_,
7969
+ get_search_query_: get_search_query_,
7970
+ i18n_: i18n_,
7971
+ search_query_updating_blocked_: search_query_updating_blocked_,
7972
+ current_sorting_: current_sorting_,
7973
+ selected_filters_: selected_filters_
7988
7974
  });
7989
- // This will add some default behaviour to open_modal_ if no style_props_ are supplied
7990
- // The default behaviour is to align the modal with the input field if possible
7991
- const modal_opening_effect = ()=>{
7992
- const open_signal_value = this.modal_open;
7993
- const signal_value_is_options = Array.isArray(open_signal_value);
7994
- // Close modal if signal is false
7995
- if (!open_signal_value) {
7996
- close_modal_();
7997
- return;
7998
- }
7999
- const { search_page_aligned_modal_body_style_signal_: search_page_aligned_modal_body_style_signal_ } = $79fbf145b15af988$var$privately_shared_properties.get(this);
8000
- if (signal_value_is_options && open_signal_value[0]?.style_props_) {
8001
- // They know what they're doing, just call the modal with the provided options
8002
- open_modal_(...open_signal_value);
8003
- return;
8004
- }
8005
- if (!open_signal_value[0]?.style_props_ && search_page_aligned_modal_body_style_signal_) {
8006
- // Open modal aligned with search page if no alignment specified and possible to align with search page
8007
- if (!signal_value_is_options) {
7975
+ (0, $33815c5a406b6cc0$export$5162a71f252e6122)();
7976
+ (0, $46MJV$depictaiutilishared.catchify)(async ()=>{
7977
+ const { open_modal_: open_modal_ , close_modal_: close_modal_ } = await (0, $089c01924e13fae5$export$79b1565500412d9b)((...args)=>{
7978
+ (0, $46MJV$solidjs.onCleanup)(()=>this.modal_open = false);
7979
+ return (0, $121d25ca6af2898f$export$1c593cbd6f1e10bc)(...args);
7980
+ }, {
7981
+ search_field_value_: state_.search_field_value,
7982
+ get_search_query_: get_search_query_,
7983
+ search_query_url_param_name_: search_query_url_param_name_,
7984
+ previous_searches_: previous_searches,
7985
+ depict_api_: depict_api_,
7986
+ tenant_: this.#merchant_signal[0],
7987
+ clear_filters_: clear_filters_on_next_submit_,
7988
+ market_: this.#market_signal[0],
7989
+ submit_query_: configured_submit_query_,
7990
+ url_transformer_: url_transformer,
7991
+ router_: this.#router,
7992
+ instant_results_options_: {
7993
+ min_products_to_fetch_: $79fbf145b15af988$var$min_products_to_fetch_,
7994
+ render_instant_card_: render_instant_card,
7995
+ render_instant_card_placeholder_: (0, $17c49340edfdbb31$export$ee1733d9a8495996),
7996
+ has_sort_or_filters_: (0, $46MJV$solidjs.createMemo)(()=>!!(Object.keys(selected_filters_[0]())?.length || current_sorting_[0]()))
7997
+ },
7998
+ i18n_: i18n_,
7999
+ enable_category_suggestions_: enable_category_suggestions,
8000
+ disable_scrolling_: disable_scrolling_during_modal,
8001
+ bottom_distance_under_modal_: bottom_distance_under_modal
8002
+ });
8003
+ // This will add some default behaviour to open_modal_ if no style_props_ are supplied
8004
+ // The default behaviour is to align the modal with the input field if possible
8005
+ const modal_opening_effect = ()=>{
8006
+ const open_signal_value = this.modal_open;
8007
+ const signal_value_is_options = Array.isArray(open_signal_value);
8008
+ // Close modal if signal is false
8009
+ if (!open_signal_value) {
8010
+ close_modal_();
8011
+ return;
8012
+ }
8013
+ const { search_page_aligned_modal_body_style_signal_: search_page_aligned_modal_body_style_signal_ } = $79fbf145b15af988$var$privately_shared_properties.get(this);
8014
+ if (signal_value_is_options && open_signal_value[0]?.style_props_) {
8015
+ // They know what they're doing, just call the modal with the provided options
8016
+ open_modal_(...open_signal_value);
8017
+ return;
8018
+ }
8019
+ if (!open_signal_value[0]?.style_props_ && search_page_aligned_modal_body_style_signal_) {
8020
+ // Open modal aligned with search page if no alignment specified and possible to align with search page
8021
+ if (!signal_value_is_options) {
8022
+ open_modal_({
8023
+ style_props_: search_page_aligned_modal_body_style_signal_
8024
+ });
8025
+ return;
8026
+ }
8027
+ const [options_arg, ...rest] = open_signal_value;
8008
8028
  open_modal_({
8029
+ ...options_arg,
8009
8030
  style_props_: search_page_aligned_modal_body_style_signal_
8010
- });
8031
+ }, ...rest);
8032
+ return;
8033
+ }
8034
+ // Open centered modal
8035
+ const supports_hover = (0, $beec9d22e42ed2cf$export$d9f36cf74e24d595)("(hover: hover) and (pointer: fine)");
8036
+ const desktop_short = (0, $beec9d22e42ed2cf$export$d9f36cf74e24d595)("(max-height: 790px)");
8037
+ const mobile_short = (0, $beec9d22e42ed2cf$export$d9f36cf74e24d595)("(max-height: 1000px)");
8038
+ const transform_y = (0, $46MJV$solidjs.createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
8039
+ const style_props_ = (0, $46MJV$solidjs.createSignal)({
8040
+ position: "fixed",
8041
+ top: "50%"
8042
+ });
8043
+ (0, $46MJV$solidjs.createComputed)(()=>style_props_[1]((old_value)=>({
8044
+ ...old_value,
8045
+ transform: transform_y() ? "translateY(-50%)" : "unset"
8046
+ })));
8047
+ if (signal_value_is_options) {
8048
+ const [options_arg, ...rest] = open_signal_value;
8049
+ open_modal_({
8050
+ ...options_arg,
8051
+ style_props_: search_page_aligned_modal_body_style_signal_ || style_props_
8052
+ }, ...rest);
8011
8053
  return;
8012
8054
  }
8013
- const [options_arg, ...rest] = open_signal_value;
8014
- open_modal_({
8015
- ...options_arg,
8016
- style_props_: search_page_aligned_modal_body_style_signal_
8017
- }, ...rest);
8018
- return;
8019
- }
8020
- // Open centered modal
8021
- const supports_hover = (0, $beec9d22e42ed2cf$export$d9f36cf74e24d595)("(hover: hover) and (pointer: fine)");
8022
- const desktop_short = (0, $beec9d22e42ed2cf$export$d9f36cf74e24d595)("(max-height: 790px)");
8023
- const mobile_short = (0, $beec9d22e42ed2cf$export$d9f36cf74e24d595)("(max-height: 1000px)");
8024
- const transform_y = (0, $46MJV$solidjs.createMemo)(()=>supports_hover() ? !desktop_short() : !mobile_short());
8025
- const style_props_ = (0, $46MJV$solidjs.createSignal)({
8026
- position: "fixed",
8027
- top: "50%"
8028
- });
8029
- (0, $46MJV$solidjs.createComputed)(()=>style_props_[1]((old_value)=>({
8030
- ...old_value,
8031
- transform: transform_y() ? "translateY(-50%)" : "unset"
8032
- })));
8033
- if (signal_value_is_options) {
8034
- const [options_arg, ...rest] = open_signal_value;
8035
8055
  open_modal_({
8036
- ...options_arg,
8037
- style_props_: search_page_aligned_modal_body_style_signal_ || style_props_
8038
- }, ...rest);
8039
- return;
8040
- }
8041
- open_modal_({
8042
- style_props_: style_props_
8043
- });
8044
- };
8045
- (0, $46MJV$solidjs.runWithOwner)(owner, ()=>(0, $46MJV$solidjs.createEffect)(modal_opening_effect));
8046
- })();
8047
- $79fbf145b15af988$export$ac6237957a15b3f0.#has_been_constructed = true;
8056
+ style_props_: style_props_
8057
+ });
8058
+ };
8059
+ (0, $46MJV$solidjs.runWithOwner)(owner, ()=>(0, $46MJV$solidjs.createEffect)(modal_opening_effect));
8060
+ })();
8061
+ $79fbf145b15af988$export$ac6237957a15b3f0.#has_been_constructed = true;
8062
+ });
8048
8063
  }
8049
8064
  get on_navigation() {
8050
8065
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)