@depict-ai/ui 4.10.18 → 4.10.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ES10/index.cjs CHANGED
@@ -115,7 +115,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
115
115
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
116
116
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
117
117
  /*! Depict.ai search and product listing SDK */
118
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.18";
118
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.20";
119
119
  function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
120
120
  const signal = $52FdA$solidjs.createSignal(false);
121
121
  $52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
@@ -2709,8 +2709,10 @@ async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_
2709
2709
  const modal_els = $52FdA$solidjs.createRoot(dispose => {
2710
2710
  let closing_animation;
2711
2711
  let animation_started;
2712
+ let focus_target_after_close;
2712
2713
  dispose_and_remove = () => {
2713
2714
  const actually_close = () => {
2715
+ var _focus_target_after_c;
2714
2716
  dispose();
2715
2717
  on_dispose === null || on_dispose === void 0 || on_dispose();
2716
2718
  const {
@@ -2729,11 +2731,19 @@ async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_
2729
2731
  }
2730
2732
  el.remove();
2731
2733
  });
2732
- if (should_restore_focus && element_focused_before_open !== null && element_focused_before_open !== void 0 && element_focused_before_open.isConnected) {
2734
+ const requested_focus_target = (_focus_target_after_c = focus_target_after_close) === null || _focus_target_after_c === void 0 ? void 0 : _focus_target_after_c();
2735
+ if (should_restore_focus && (requested_focus_target !== null && requested_focus_target !== void 0 && requested_focus_target.isConnected || element_focused_before_open !== null && element_focused_before_open !== void 0 && element_focused_before_open.isConnected)) {
2733
2736
  restoring_focus = true;
2734
2737
  try {
2735
2738
  // preventScroll so this can't re-introduce the safari page-jump the blur() above works around
2736
- element_focused_before_open.focus({
2739
+ let focused = false;
2740
+ if (requested_focus_target !== null && requested_focus_target !== void 0 && requested_focus_target.isConnected) {
2741
+ requested_focus_target.focus({
2742
+ preventScroll: true
2743
+ });
2744
+ focused = requested_focus_target.getRootNode().activeElement === requested_focus_target;
2745
+ }
2746
+ if (!focused && element_focused_before_open !== null && element_focused_before_open !== void 0 && element_focused_before_open.isConnected) element_focused_before_open.focus({
2737
2747
  preventScroll: true
2738
2748
  });
2739
2749
  } finally {
@@ -2755,7 +2765,8 @@ async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_
2755
2765
  ...extra_options_for_modal,
2756
2766
  close_modal_: close_modal_,
2757
2767
  open_modal_: open_modal_,
2758
- register_closing_animation_: animation => closing_animation = animation
2768
+ register_closing_animation_: animation => closing_animation = animation,
2769
+ set_focus_target_after_close_: get_target => focus_target_after_close = get_target
2759
2770
  });
2760
2771
  });
2761
2772
  body.append(...modal_els);
@@ -8253,7 +8264,8 @@ async function $8e8c89c02c16dc7b$export$5d2f6cd705125cd3() {
8253
8264
  return hlsModule;
8254
8265
  }
8255
8266
  var $c19709057a32b2e7$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<video class=d-standard-content>`),
8256
- $c19709057a32b2e7$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=d-standard-content-text>`);
8267
+ $c19709057a32b2e7$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=d-standard-content-text-group><span class=d-standard-content-text></span><span class=d-standard-content-cta>`),
8268
+ $c19709057a32b2e7$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=d-standard-content-text>`);
8257
8269
  function $c19709057a32b2e7$export$780a853d15174484(_ref) {
8258
8270
  let {
8259
8271
  link_: link_,
@@ -8264,7 +8276,8 @@ function $c19709057a32b2e7$export$780a853d15174484(_ref) {
8264
8276
  aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_,
8265
8277
  imageResizer_: imageResizer_,
8266
8278
  text_: text_,
8267
- textPosition_: textPosition_
8279
+ textPosition_: textPosition_,
8280
+ cta_: cta_
8268
8281
  } = _ref;
8269
8282
  let wroteAspectRatioToContainer = false; // Only write this once so we don't get into a aspect ratio changed -> size changed -> image source changed -> aspect ratio slightly changed infinite loop
8270
8283
  const [wrapperSize, setWrapperSize] = $52FdA$solidjs.createSignal();
@@ -8371,15 +8384,44 @@ function $c19709057a32b2e7$export$780a853d15174484(_ref) {
8371
8384
  }), $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
8372
8385
  when: text_,
8373
8386
  get children() {
8374
- var _el$2 = $52FdA$solidjsweb.getNextElement($c19709057a32b2e7$var$_tmpl$2);
8375
- $52FdA$solidjsweb.setAttribute(_el$2, "data-position", textPosition_ || "bottom-center");
8376
- $52FdA$solidjsweb.insert(_el$2, text_);
8377
- return _el$2;
8387
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
8388
+ when: cta_,
8389
+ get fallback() {
8390
+ return (() => {
8391
+ var _el$5 = $52FdA$solidjsweb.getNextElement($c19709057a32b2e7$var$_tmpl$3);
8392
+ $52FdA$solidjsweb.setAttribute(_el$5, "data-position", textPosition_ || "bottom-center");
8393
+ $52FdA$solidjsweb.insert(_el$5, text_);
8394
+ return _el$5;
8395
+ })();
8396
+ },
8397
+ get children() {
8398
+ var _el$2 = $52FdA$solidjsweb.getNextElement($c19709057a32b2e7$var$_tmpl$2),
8399
+ _el$3 = _el$2.firstChild,
8400
+ _el$4 = _el$3.nextSibling;
8401
+ $52FdA$solidjsweb.setAttribute(_el$2, "data-position", textPosition_ || "bottom-center");
8402
+ $52FdA$solidjsweb.setAttribute(_el$3, "data-position", textPosition_ || "bottom-center");
8403
+ $52FdA$solidjsweb.insert(_el$3, text_);
8404
+ $52FdA$solidjsweb.setAttribute(_el$4, "data-position", textPosition_ || "bottom-center");
8405
+ $52FdA$solidjsweb.insert(_el$4, cta_);
8406
+ return _el$2;
8407
+ }
8408
+ });
8378
8409
  }
8379
8410
  })];
8380
8411
  }
8381
8412
  }));
8382
8413
  }
8414
+ const $0c035bbe7e30b438$export$af2c67164f68e9e9 = content => {
8415
+ const {
8416
+ link: link,
8417
+ type: type,
8418
+ url: url,
8419
+ text: text,
8420
+ text_position: text_position,
8421
+ cta: cta
8422
+ } = content;
8423
+ return JSON.stringify([link, type, url, text !== null && text !== void 0 ? text : null, text_position !== null && text_position !== void 0 ? text_position : null, cta !== null && cta !== void 0 ? cta : null]);
8424
+ };
8383
8425
  function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, products_request_loading_, imageResizer_) {
8384
8426
  let hasSeenContentBlock = false;
8385
8427
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
@@ -8417,13 +8459,11 @@ function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_
8417
8459
  type: type,
8418
8460
  url: url,
8419
8461
  text: text,
8420
- text_position: text_position
8462
+ text_position: text_position,
8463
+ cta: cta
8421
8464
  }
8422
8465
  } = row;
8423
- // Key the "content"-component by its rendered inputs, so we can reuse the component (and later downstream the block elements) if it's the same
8424
- // This makes the block not flicker when going backwards/forwards if the content is the same on both pages
8425
- // Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
8426
- const componentCacheKey = JSON.stringify([link, type, url, text !== null && text !== void 0 ? text : null, text_position !== null && text_position !== void 0 ? text_position : null]);
8466
+ const componentCacheKey = $0c035bbe7e30b438$export$af2c67164f68e9e9(row.content);
8427
8467
  // The aspect ratio depends only on the media, so its history key must stay the pre-text 3-element shape — widening it would orphan every ratio already persisted in history.state
8428
8468
  const mediaCacheKey = JSON.stringify([link, type, url]);
8429
8469
  let component = contentComponents.get(componentCacheKey);
@@ -8443,7 +8483,8 @@ function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_
8443
8483
  })),
8444
8484
  imageResizer_: imageResizer_,
8445
8485
  text_: text,
8446
- textPosition_: text_position
8486
+ textPosition_: text_position,
8487
+ cta_: cta
8447
8488
  });
8448
8489
  contentComponents.set(componentCacheKey, component);
8449
8490
  }
@@ -11392,6 +11433,7 @@ var $29e5dbeb69da7a36$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<but
11392
11433
  $29e5dbeb69da7a36$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=spacer>`),
11393
11434
  $29e5dbeb69da7a36$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class="submit major"type=button>`),
11394
11435
  $29e5dbeb69da7a36$var$_tmpl$5 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div><!$><!/><!$><!/><div class=field><!$><!/><input class=query tabindex=0 enterkeyhint=search><!$><!/></div><!$><!/><!$><!/>`);
11436
+ const $29e5dbeb69da7a36$var$keys_not_opening_modal = new Set(["Tab", "Shift", "Control", "Alt", "AltGraph", "Meta", "CapsLock", "Escape", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "PageUp", "PageDown", "Home", "End", "Insert", "ContextMenu", "NumLock", "ScrollLock", "Pause", "PrintScreen"]);
11395
11437
  function $29e5dbeb69da7a36$export$b94867ecbd698f21(_ref) {
11396
11438
  let {
11397
11439
  search_field_value_: [searchFieldValue, setSearchFieldValue],
@@ -11574,7 +11616,7 @@ function $29e5dbeb69da7a36$export$b94867ecbd698f21(_ref) {
11574
11616
  get onKeyDown() {
11575
11617
  return $52FdA$depictaiutilishared.catchify(e => {
11576
11618
  if (disabled_) {
11577
- if (e.key !== "Tab" && e.key !== "Shift")
11619
+ if (!$29e5dbeb69da7a36$var$keys_not_opening_modal.has(e.key) && !/^F\d{1,2}$/.test(e.key))
11578
11620
  // alow tab-selecting the input field and then open the modal when the user start writing but also to move past the field with tab
11579
11621
  input_element.click();
11580
11622
  } else if (e.key === "Enter") {
@@ -11679,6 +11721,33 @@ function $4b71b4fabdee5753$export$93d9bfd0c9c1a5b8(close_modal, search_query_url
11679
11721
  }
11680
11722
  })();
11681
11723
  }
11724
+ function $9ccac7b807fe6451$export$9e9e2ae069cf2fe1(_ref) {
11725
+ let {
11726
+ props_search_field_value_: props_search_field_value_,
11727
+ props_submit_query_: props_submit_query_,
11728
+ dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_,
11729
+ set_focus_target_after_close_: set_focus_target_after_close_,
11730
+ get_search_page_input_element_: get_search_page_input_element_
11731
+ } = _ref;
11732
+ const search_field_value_ = dont_sync_search_field_value_except_on_submit_ ? $52FdA$solidjs.createSignal("") : props_search_field_value_;
11733
+ let submits_in_flight = 0;
11734
+ const submit_query_ = async function () {
11735
+ let new_query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $52FdA$solidjs.untrack(search_field_value_[0]);
11736
+ submits_in_flight++;
11737
+ try {
11738
+ return await props_submit_query_(new_query, () => set_focus_target_after_close_(get_search_page_input_element_));
11739
+ } finally {
11740
+ submits_in_flight--;
11741
+ }
11742
+ };
11743
+ if (dont_sync_search_field_value_except_on_submit_) $52FdA$solidjs.createEffect($52FdA$solidjs.on(search_field_value_[0], value => submits_in_flight > 0 && props_search_field_value_[1](value), {
11744
+ defer: true
11745
+ }));
11746
+ return {
11747
+ search_field_value_: search_field_value_,
11748
+ submit_query_: submit_query_
11749
+ };
11750
+ }
11682
11751
  var $9035b24c2dbd3f36$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=discover-more><button class=major type=button>`),
11683
11752
  $9035b24c2dbd3f36$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<b>`),
11684
11753
  $9035b24c2dbd3f36$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=depict-search-modal><div class=body role=search aria-label="Search modal with search field, query suggestions and result preview"><!$><!/><div id=depict-suggestions-and-result-preview class=padded><!$><!/><!$><!/><!$><!/></div><!$><!/></div><!$><!/>`),
@@ -11693,6 +11762,8 @@ function $9035b24c2dbd3f36$var$RawClassicSearchModal(_ref) {
11693
11762
  search_query_url_param_name_: search_query_url_param_name_,
11694
11763
  previous_searches_: previous_searches_,
11695
11764
  close_modal_: close_modal_,
11765
+ set_focus_target_after_close_: set_focus_target_after_close_,
11766
+ get_search_page_input_element_: get_search_page_input_element_,
11696
11767
  depict_api_: depict_api_,
11697
11768
  merchant_: merchant_,
11698
11769
  market_: market_,
@@ -11717,15 +11788,16 @@ function $9035b24c2dbd3f36$var$RawClassicSearchModal(_ref) {
11717
11788
  // 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.
11718
11789
  // 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
11719
11790
  // Basically the UI signals that the button that opens the modal starts a new search.
11720
- const search_field_value_ = dont_sync_search_field_value_except_on_submit_ ? $52FdA$solidjs.createSignal("") : props_search_field_value;
11721
- const propagate_search_field_value_back = dont_sync_search_field_value_except_on_submit_ ? () => props_search_field_value[1]($52FdA$solidjs.untrack(search_field_value_[0])) // Set actual search field value to the throwaway internal one before submitting
11722
- : undefined;
11723
- const submit_query_ = function () {
11724
- // submit_query expects to read the current search field value which is why we have to write the current one to the signal before calling it
11725
- // It will write the old one back and then write the new one after submit
11726
- propagate_search_field_value_back === null || propagate_search_field_value_back === void 0 || propagate_search_field_value_back();
11727
- return props_submit_query(...arguments);
11728
- };
11791
+ const {
11792
+ search_field_value_: search_field_value_,
11793
+ submit_query_: submit_query_
11794
+ } = $9ccac7b807fe6451$export$9e9e2ae069cf2fe1({
11795
+ props_search_field_value_: props_search_field_value,
11796
+ props_submit_query_: props_submit_query,
11797
+ dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_,
11798
+ set_focus_target_after_close_: set_focus_target_after_close_,
11799
+ get_search_page_input_element_: get_search_page_input_element_
11800
+ });
11729
11801
  const [input_field, set_input_field] = $52FdA$solidjs.createSignal();
11730
11802
  const [get_search_field_value_] = search_field_value_;
11731
11803
  // Search field alignment unused in ClassicSearchModal since the search field spans the whole modal
@@ -12557,6 +12629,8 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
12557
12629
  search_query_url_param_name_: search_query_url_param_name_,
12558
12630
  previous_searches_: previous_searches_,
12559
12631
  close_modal_: close_modal_,
12632
+ set_focus_target_after_close_: set_focus_target_after_close_,
12633
+ get_search_page_input_element_: get_search_page_input_element_,
12560
12634
  alignmentSignals_: alignmentSignals_,
12561
12635
  depict_api_: depict_api_,
12562
12636
  merchant_: merchant_,
@@ -12587,15 +12661,16 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
12587
12661
  // 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.
12588
12662
  // 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
12589
12663
  // Basically the UI signals that the button that opens the modal starts a new search.
12590
- const search_field_value_ = dont_sync_search_field_value_except_on_submit_ ? $52FdA$solidjs.createSignal("") : props_search_field_value;
12591
- const propagate_search_field_value_back = dont_sync_search_field_value_except_on_submit_ ? () => props_search_field_value[1]($52FdA$solidjs.untrack(search_field_value_[0])) // Set actual search field value to the throwaway internal one before submitting
12592
- : undefined;
12593
- const submit_query_ = function () {
12594
- // submit_query expects to read the current search field value which is why we have to write the current one to the signal before calling it
12595
- // It will write the old one back and then write the new one after submit
12596
- propagate_search_field_value_back === null || propagate_search_field_value_back === void 0 || propagate_search_field_value_back();
12597
- return props_submit_query(...arguments);
12598
- };
12664
+ const {
12665
+ search_field_value_: search_field_value_,
12666
+ submit_query_: submit_query_
12667
+ } = $9ccac7b807fe6451$export$9e9e2ae069cf2fe1({
12668
+ props_search_field_value_: props_search_field_value,
12669
+ props_submit_query_: props_submit_query,
12670
+ dont_sync_search_field_value_except_on_submit_: dont_sync_search_field_value_except_on_submit_,
12671
+ set_focus_target_after_close_: set_focus_target_after_close_,
12672
+ get_search_page_input_element_: get_search_page_input_element_
12673
+ });
12599
12674
  const [input_field, set_input_field] = $52FdA$solidjs.createSignal();
12600
12675
  const [searching_for_value_, set_searching_for_value_] = $52FdA$solidjs.createSignal();
12601
12676
  const [show_stale_content_results_, set_show_stale_content_results_] = $52FdA$solidjs.createSignal(false);
@@ -14913,11 +14988,12 @@ async function $7f680455a2aa1079$export$e16630ecb9644a1c(_ref) {
14913
14988
  let {
14914
14989
  on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
14915
14990
  search_param_name_: search_param_name_,
14916
- set_search_field_value_: set_search_field_value_,
14991
+ search_field_value_: search_field_value_,
14917
14992
  get_search_query_: get_search_query_,
14918
14993
  url_transformer_: url_transformer_,
14919
14994
  router_: router_,
14920
14995
  after_submit_: after_submit_,
14996
+ before_navigate_: before_navigate_,
14921
14997
  get_new_query: get_new_query
14922
14998
  } = _ref;
14923
14999
  const new_search_query = get_new_query();
@@ -14925,21 +15001,92 @@ async function $7f680455a2aa1079$export$e16630ecb9644a1c(_ref) {
14925
15001
  if (previous_query === new_search_query && new URLSearchParams(location.search).has(search_param_name_)) {
14926
15002
  // don't push a history entry / re-search if someone submits a search again
14927
15003
  // do close the modal though
15004
+ search_field_value_.settle_(new_search_query);
14928
15005
  on_submit_with_unchanged_value_ === null || on_submit_with_unchanged_value_ === void 0 || on_submit_with_unchanged_value_();
14929
- return;
15006
+ return false;
14930
15007
  }
14931
- set_search_field_value_(previous_query); // restore the value to the previous query since this one goes to the new history entry
14932
15008
  const target_url = new URL(location.href);
14933
15009
  url_transformer_ === null || url_transformer_ === void 0 || url_transformer_(target_url);
14934
15010
  target_url.searchParams.set(search_param_name_, new_search_query);
14935
- await router_.navigate_.go_to_({
14936
- new_url_: target_url,
14937
- is_replace_: false,
14938
- force_spa_navigation_: true
14939
- });
14940
- set_search_field_value_(new_search_query);
15011
+ const end_submit = search_field_value_.begin_submit_(new_search_query, previous_query);
15012
+ before_navigate_ === null || before_navigate_ === void 0 || before_navigate_();
15013
+ let landed;
15014
+ try {
15015
+ await router_.navigate_.go_to_({
15016
+ new_url_: target_url,
15017
+ is_replace_: false,
15018
+ force_spa_navigation_: true
15019
+ });
15020
+ } finally {
15021
+ landed = end_submit();
15022
+ }
15023
+ if (!landed) return false;
14941
15024
  scrollTo(0, 0);
14942
15025
  after_submit_ === null || after_submit_ === void 0 || after_submit_();
15026
+ return true;
15027
+ }
15028
+ function $24f1a81b790e371c$export$d13a185c53aa5edf(persisted_, get_search_query_) {
15029
+ const [get_persisted, set_persisted] = persisted_;
15030
+ const [get_submitting, set_submitting] = $52FdA$solidjs.createSignal();
15031
+ const get_value = $52FdA$solidjs.createMemo(() => {
15032
+ var _get_submitting;
15033
+ return (_get_submitting = get_submitting()) !== null && _get_submitting !== void 0 ? _get_submitting : get_persisted();
15034
+ });
15035
+ const set_value = value => {
15036
+ const new_value = typeof value === "function" ? value($52FdA$solidjs.untrack(get_value)) : value;
15037
+ if ($52FdA$solidjs.untrack(get_submitting) === undefined) set_persisted(new_value);else set_submitting(new_value);
15038
+ return new_value;
15039
+ };
15040
+ let current_submit;
15041
+ const end_submit = landed => {
15042
+ current_submit.landed_ = landed;
15043
+ current_submit = undefined;
15044
+ $52FdA$solidjs.batch(() => {
15045
+ const submitting = $52FdA$solidjs.untrack(get_submitting);
15046
+ set_submitting(undefined);
15047
+ if (landed && submitting !== undefined) set_persisted(submitting);
15048
+ });
15049
+ };
15050
+ const abort_on_popstate = what_happened => {
15051
+ if (what_happened === "popstate" && current_submit) end_submit(false);
15052
+ };
15053
+ (0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).add(abort_on_popstate);
15054
+ $52FdA$solidjs.onCleanup(() => (0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).delete(abort_on_popstate));
15055
+ $52FdA$solidjs.createEffect($52FdA$solidjs.on(get_search_query_, query => {
15056
+ const token = current_submit;
15057
+ if (!token || query !== token.query_) return;
15058
+ queueMicrotask(() => {
15059
+ if (current_submit === token) end_submit(true);
15060
+ });
15061
+ }, {
15062
+ defer: true
15063
+ }));
15064
+ const begin_submit_ = (submitted_query, query_of_current_history_entry) => {
15065
+ const token = current_submit = {
15066
+ query_: submitted_query,
15067
+ landed_: false
15068
+ };
15069
+ $52FdA$solidjs.batch(() => {
15070
+ set_submitting(submitted_query);
15071
+ set_persisted(query_of_current_history_entry);
15072
+ });
15073
+ return () => {
15074
+ if (current_submit === token) end_submit(true);
15075
+ return token.landed_;
15076
+ };
15077
+ };
15078
+ const settle_ = query => {
15079
+ if (current_submit) return;
15080
+ $52FdA$solidjs.batch(() => {
15081
+ set_submitting(undefined);
15082
+ set_persisted(query);
15083
+ });
15084
+ };
15085
+ return {
15086
+ value_: [get_value, set_value],
15087
+ begin_submit_: begin_submit_,
15088
+ settle_: settle_
15089
+ };
14943
15090
  }
14944
15091
  function $7a8e55af4ef13fae$export$181cceed5c91919e(callback, alsoRaF, passiveListener) {
14945
15092
  let aligned_this_microtask = false;
@@ -15683,6 +15830,7 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
15683
15830
  scroll_restoration_data_: scroll_restoration_data_,
15684
15831
  product_card_template_: product_card_template_,
15685
15832
  modalAlignmentSignalsRef_: modalAlignmentSignalsRef_,
15833
+ inputFieldRef_: inputFieldRef_,
15686
15834
  router_: router_,
15687
15835
  content_results_rows_: content_results_rows_,
15688
15836
  content_layout_options_: content_layout_options_,
@@ -15887,6 +16035,8 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
15887
16035
  if (!search_field) break add_input_field;
15888
16036
  setModalBodyStyle({});
15889
16037
  modalAlignmentSignalsRef_ === null || modalAlignmentSignalsRef_ === void 0 || modalAlignmentSignalsRef_(alignmentSignals_);
16038
+ inputFieldRef_ === null || inputFieldRef_ === void 0 || inputFieldRef_(input_element);
16039
+ $52FdA$solidjs.onCleanup(() => inputFieldRef_ === null || inputFieldRef_ === void 0 ? void 0 : inputFieldRef_(undefined));
15890
16040
  const [pollAlignment, setPollAlignment_] = $52FdA$solidjs.createSignal(false);
15891
16041
  const align_position = $52FdA$depictaiutilishared.catchify((0, $d6ed4dbb6507996d$export$b3ad617e9036868))(alignmentSignals_, search_field, (0, $d6ed4dbb6507996d$export$3f238c96c45e6cc6) | (0, $d6ed4dbb6507996d$export$7895aadd1956b1c7) | (modalVersionUsed_ === 1 ? (0, $d6ed4dbb6507996d$export$902f8b4a7dae5d78) : (0, $d6ed4dbb6507996d$export$6060bc6bee850eb6) | (0, $d6ed4dbb6507996d$export$5097308c5200105a)), true, pollAlignment);
15892
16042
  div_with_field_class.addEventListener("click", $52FdA$depictaiutilishared.catchify(e => {
@@ -16296,14 +16446,16 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
16296
16446
  set_search_content_results_rows((0, $eab939d0b95b75ee$export$70ceae36059a1036));
16297
16447
  }; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
16298
16448
  const on_submit_with_unchanged_value_ = () => this.modal_open = false;
16299
- const [get_search_field_value_, set_search_field_value_] = state_.field_value;
16300
- const configured_submit_query_ = new_query => $7f680455a2aa1079$export$e16630ecb9644a1c({
16449
+ const search_field_value_ = $24f1a81b790e371c$export$d13a185c53aa5edf(state_.field_value, get_search_query_);
16450
+ const [get_search_field_value_] = search_field_value_.value_;
16451
+ const configured_submit_query_ = (new_query, before_navigate_) => $7f680455a2aa1079$export$e16630ecb9644a1c({
16301
16452
  on_submit_with_unchanged_value_: on_submit_with_unchanged_value_,
16302
- set_search_field_value_: set_search_field_value_,
16453
+ search_field_value_: search_field_value_,
16303
16454
  get_search_query_: get_search_query_,
16304
16455
  search_param_name_: search_query_url_param_name_,
16305
16456
  after_submit_: after_submit_,
16306
- get_new_query: () => new_query || $52FdA$solidjs.untrack(get_search_field_value_),
16457
+ before_navigate_: before_navigate_,
16458
+ get_new_query: () => new_query !== null && new_query !== void 0 ? new_query : $52FdA$solidjs.untrack(get_search_field_value_),
16307
16459
  url_transformer_: url_transformer,
16308
16460
  router_: $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $ddd39c5f36f49703$var$_router)
16309
16461
  });
@@ -16322,6 +16474,7 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
16322
16474
  search_query_url_param_name_: search_query_url_param_name_,
16323
16475
  reset_history_state_: reset_history_state_,
16324
16476
  state_: state_,
16477
+ search_field_value_: search_field_value_.value_,
16325
16478
  router_: $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $ddd39c5f36f49703$var$_router),
16326
16479
  url_transformer_: url_transformer,
16327
16480
  depict_api_: depict_api_,
@@ -16345,7 +16498,11 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
16345
16498
  $52FdA$solidjs.onCleanup(() => _this.modal_open = false);
16346
16499
  return searchModalComponent(...arguments);
16347
16500
  }, {
16348
- search_field_value_: state_.field_value,
16501
+ search_field_value_: search_field_value_.value_,
16502
+ get_search_page_input_element_: () => {
16503
+ var _privately_shared_pro2;
16504
+ return (_privately_shared_pro2 = $ddd39c5f36f49703$export$dde08b2dca8cc1ce.get(this)) === null || _privately_shared_pro2 === void 0 ? void 0 : _privately_shared_pro2.search_page_input_element_;
16505
+ },
16349
16506
  get_search_query_: get_search_query_,
16350
16507
  search_query_url_param_name_: search_query_url_param_name_,
16351
16508
  previous_searches_: previous_searches,
@@ -16510,6 +16667,7 @@ function $ddd39c5f36f49703$export$f2dc7e4e4aa11abb(props) {
16510
16667
  const {
16511
16668
  state_: state_
16512
16669
  } = shared_properties;
16670
+ let registered_input_element;
16513
16671
  const grid_spacing_override = $52FdA$solidjs.createMemo(() => {
16514
16672
  const {
16515
16673
  grid_spacing: grid_spacing
@@ -16541,7 +16699,7 @@ function $ddd39c5f36f49703$export$f2dc7e4e4aa11abb(props) {
16541
16699
  var _depict_search$enable;
16542
16700
  return (_depict_search$enable = depict_search.enable_content_search) !== null && _depict_search$enable !== void 0 ? _depict_search$enable : $ddd39c5f36f49703$var$content_search_default;
16543
16701
  },
16544
- search_field_value_: state_.field_value,
16702
+ search_field_value_: shared_properties.search_field_value_,
16545
16703
  get_search_query_: shared_properties.get_search_query_,
16546
16704
  clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
16547
16705
  open_modal_: function () {
@@ -16552,6 +16710,16 @@ function $ddd39c5f36f49703$export$f2dc7e4e4aa11abb(props) {
16552
16710
  modalVersionUsed_: shared_properties.modalVersionUsed_,
16553
16711
  showSliderArrow_: () => props.showSliderArrow_,
16554
16712
  i18n_: shared_properties.i18n_,
16713
+ inputFieldRef_: input_element => {
16714
+ const shared_info_right_now = $ddd39c5f36f49703$export$dde08b2dca8cc1ce.get(depict_search);
16715
+ if (!shared_info_right_now) return;
16716
+ if (input_element === undefined && shared_info_right_now.search_page_input_element_ !== registered_input_element) return;
16717
+ registered_input_element = input_element;
16718
+ $ddd39c5f36f49703$export$dde08b2dca8cc1ce.set(depict_search, {
16719
+ ...shared_info_right_now,
16720
+ search_page_input_element_: input_element
16721
+ });
16722
+ },
16555
16723
  modalAlignmentSignalsRef_: style => {
16556
16724
  const shared_info_right_now = $ddd39c5f36f49703$export$dde08b2dca8cc1ce.get(depict_search);
16557
16725
  if (!shared_info_right_now) return;
@@ -16998,7 +17166,7 @@ function $98aef9965764903d$export$316f6f283ae64765(props) {
16998
17166
  return shared_properties.BackIcon_;
16999
17167
  },
17000
17168
  get search_field_value_() {
17001
- return shared_properties.state_.field_value;
17169
+ return shared_properties.search_field_value_;
17002
17170
  },
17003
17171
  get submit_query_() {
17004
17172
  return shared_properties.configured_submit_query_;
@@ -17041,7 +17209,7 @@ function $98aef9965764903d$export$316f6f283ae64765(props) {
17041
17209
  return shared_properties.BackIcon_;
17042
17210
  },
17043
17211
  get search_field_value_() {
17044
- return shared_properties.state_.field_value;
17212
+ return shared_properties.search_field_value_;
17045
17213
  },
17046
17214
  get submit_query_() {
17047
17215
  return shared_properties.configured_submit_query_;
package/ES10/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.10.18";
14
+ export const version = "4.10.20";
15
15
  /**
16
16
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
17
  */
@@ -713,6 +713,8 @@ declare function RawSearchModalV2<InputDisplay extends Display, OutputDisplay ex
713
713
  search_query_url_param_name_,
714
714
  previous_searches_,
715
715
  close_modal_,
716
+ set_focus_target_after_close_,
717
+ get_search_page_input_element_,
716
718
  alignmentSignals_,
717
719
  depict_api_,
718
720
  merchant_,
@@ -743,12 +745,14 @@ declare function RawSearchModalV2<InputDisplay extends Display, OutputDisplay ex
743
745
  search_query_url_param_name_: string;
744
746
  previous_searches_: Signal<string[]>;
745
747
  close_modal_: VoidFunction;
748
+ set_focus_target_after_close_: (get_target: (() => HTMLElement | undefined) | undefined) => void;
749
+ get_search_page_input_element_: () => HTMLInputElement | undefined;
746
750
  alignmentSignals_?: ModalAlignmentSignals;
747
751
  depict_api_: DepictAPI<InputDisplay, OutputDisplay>;
748
752
  clear_filters_: (user_triggered: boolean) => void;
749
753
  merchant_: Accessor<string>;
750
754
  market_: Accessor<string>;
751
- submit_query_: (new_query?: string) => void;
755
+ submit_query_: (new_query?: string, before_navigate_?: VoidFunction) => Promise<boolean>;
752
756
  class_list_?: Accessor<Record<string, boolean>>;
753
757
  url_transformer_?: (url_object: URL) => unknown;
754
758
  disable_scrolling_?: boolean;
@@ -785,6 +789,8 @@ declare function RawClassicSearchModal({
785
789
  search_query_url_param_name_,
786
790
  previous_searches_,
787
791
  close_modal_,
792
+ set_focus_target_after_close_,
793
+ get_search_page_input_element_,
788
794
  depict_api_,
789
795
  merchant_,
790
796
  market_,
@@ -810,11 +816,13 @@ declare function RawClassicSearchModal({
810
816
  search_query_url_param_name_: string;
811
817
  previous_searches_: Signal<string[]>;
812
818
  close_modal_: VoidFunction;
819
+ set_focus_target_after_close_: (get_target: (() => HTMLElement | undefined) | undefined) => void;
820
+ get_search_page_input_element_: () => HTMLInputElement | undefined;
813
821
  depict_api_: DepictAPI<any>;
814
822
  clear_filters_: (user_triggered: boolean) => void;
815
823
  merchant_: Accessor<string>;
816
824
  market_: Accessor<string>;
817
- submit_query_: (new_query?: string) => void;
825
+ submit_query_: (new_query?: string, before_navigate_?: VoidFunction) => Promise<boolean>;
818
826
  class_list_?: Accessor<Record<string, boolean>>;
819
827
  url_transformer_?: (url_object: URL) => unknown;
820
828
  disable_scrolling_?: boolean;
@@ -1038,6 +1046,7 @@ export function general_modal_abstraction<StaticOptions extends {
1038
1046
  close_modal_: VoidFunction;
1039
1047
  open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
1040
1048
  register_closing_animation_: (animation: () => Promise<any>) => void;
1049
+ set_focus_target_after_close_: (get_target: (() => HTMLElement | undefined) | undefined) => void;
1041
1050
  }) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
1042
1051
  open_modal_: (extra_options_for_modal?: any, on_dispose?: VoidFunction | undefined) => Promise<void | undefined>;
1043
1052
  close_modal_: () => void | undefined;