@depict-ai/ui 4.0.10 → 4.0.12

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
@@ -94,7 +94,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447a
94
94
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
95
95
  $parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316f6f283ae64765);
96
96
  /*! Depict.ai search and product listing SDK */
97
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.10";
97
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.12";
98
98
  function $a28000bc10de28ad$export$e417c49320921907(dependency, fetcher) {
99
99
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $52FdA$solidjs.createSignal();
100
100
  const deparallelizedFetcher = $52FdA$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
@@ -3235,15 +3235,16 @@ function $f765bad01136eee1$export$c8d7e00464029b45(_ref) {
3235
3235
  itemIndex_: itemIndex_,
3236
3236
  selected_index_: selected_index_,
3237
3237
  modalLayoutStacked_: modalLayoutStacked_,
3238
+ showPlaceholders_: showPlaceholders_,
3238
3239
  currently_showing_suggestions_: [, set_currently_showing_suggestions]
3239
3240
  } = _ref;
3240
3241
  const listings_by_id = $52FdA$solidjs.createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
3241
3242
  const productCards = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.For), {
3242
3243
  get each() {
3243
- return Object.keys(listings_by_id());
3244
+ return $52FdA$solidjsweb.memo(() => !!showPlaceholders_())() ? [,,,] : Object.keys(listings_by_id());
3244
3245
  },
3245
3246
  children: (listingId, index) => {
3246
- const listing = $52FdA$solidjs.createMemo(() => listings_by_id()[listingId]);
3247
+ const listing = $52FdA$solidjs.createMemo(() => listingId == undefined ? undefined : listings_by_id()[listingId]);
3247
3248
  return $52FdA$solidjsweb.createComponent((0, $d1e7b96fb13cd1d3$export$67152d26d4f56ee8), {
3248
3249
  listing_: listing,
3249
3250
  i18n_: i18n_,
@@ -3267,7 +3268,7 @@ function $f765bad01136eee1$export$c8d7e00464029b45(_ref) {
3267
3268
  return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3268
3269
  get when() {
3269
3270
  var _listing_suggestions_2;
3270
- return (_listing_suggestions_2 = listing_suggestions_()) === null || _listing_suggestions_2 === void 0 ? void 0 : _listing_suggestions_2.length;
3271
+ return ((_listing_suggestions_2 = listing_suggestions_()) === null || _listing_suggestions_2 === void 0 ? void 0 : _listing_suggestions_2.length) || showPlaceholders_();
3271
3272
  },
3272
3273
  get children() {
3273
3274
  var _el$ = $52FdA$solidjsweb.getNextElement($f765bad01136eee1$var$_tmpl$),
@@ -3643,6 +3644,7 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
3643
3644
  forceUseDiv_: forceUseDiv_
3644
3645
  } = _ref;
3645
3646
  let on_enter_in_search_field_function;
3647
+ let listingSuggestionsDebounceTimeout;
3646
3648
  // 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.
3647
3649
  // 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
3648
3650
  // Basically the UI signals that the button that opens the modal starts a new search.
@@ -3658,6 +3660,8 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
3658
3660
  const [input_field, set_input_field] = $52FdA$solidjs.createSignal();
3659
3661
  const [searching_for_value_, set_searching_for_value_] = $52FdA$solidjs.createSignal();
3660
3662
  const [show_stale_content_results_, set_show_stale_content_results_] = $52FdA$solidjs.createSignal(false);
3663
+ // For fake debounce
3664
+ const [showStaleListingSuggestions, setShowStaleListingSuggestions] = $52FdA$solidjs.createSignal(false);
3661
3665
  const suggestions_updating_blocked_ = $52FdA$solidjs.createSignal(false);
3662
3666
  const [modalBodyWidth, setModalBodyWidth] = $52FdA$solidjs.createSignal(0);
3663
3667
  const modalLayoutStacked_ = $52FdA$solidjs.createMemo(() => modalBodyWidth() < 650);
@@ -3689,9 +3693,11 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
3689
3693
  set_searching_for_value_: set_searching_for_value_,
3690
3694
  set_show_stale_content_results_: set_show_stale_content_results_
3691
3695
  });
3692
- const listing_suggestions_ = $52FdA$solidjs.createMemo(() => {
3696
+ const listing_suggestions_ = $52FdA$solidjs.createMemo(prev => {
3693
3697
  var _suggestions_response;
3694
3698
  const all = enable_category_suggestions_ ? (_suggestions_response = suggestions_response_()) === null || _suggestions_response === void 0 ? void 0 : _suggestions_response.filter(item => item.type === "listing") : [];
3699
+ // To prevent jumping of the modal when the visual listing suggestions exist/don't exist we debounce it the same way as the product results
3700
+ if (showStaleListingSuggestions() && !(all !== null && all !== void 0 && all.length)) return prev;
3695
3701
  if (modalLayoutStacked_()) return all;
3696
3702
  return all === null || all === void 0 ? void 0 : all.slice(0, 3);
3697
3703
  });
@@ -3766,6 +3772,13 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
3766
3772
  $4b71b4fabdee5753$export$93d9bfd0c9c1a5b8(close_modal_, search_query_url_param_name_);
3767
3773
  addEventListener("keydown", close_on_escape_handler);
3768
3774
  $52FdA$solidjs.onCleanup(() => removeEventListener("keydown", close_on_escape_handler));
3775
+ $52FdA$solidjs.createEffect($52FdA$solidjs.on(get_search_field_value_, () => {
3776
+ setShowStaleListingSuggestions(true);
3777
+ clearTimeout(listingSuggestionsDebounceTimeout);
3778
+ listingSuggestionsDebounceTimeout = setTimeout($52FdA$depictaiutilishared.catchify(() => setShowStaleListingSuggestions(false)), 350);
3779
+ }, {
3780
+ defer: true
3781
+ }));
3769
3782
  if (closing_animation_) register_closing_animation_(closing_animation_);
3770
3783
  $4e44eb7e21ff022a$export$3340fdd8259bd4fd({
3771
3784
  get_search_field_value_: get_search_field_value_,
@@ -3872,7 +3885,8 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
3872
3885
  },
3873
3886
  selected_index_: selected_index_,
3874
3887
  currently_showing_suggestions_: currently_showing_suggestions_,
3875
- modalLayoutStacked_: modalLayoutStacked_
3888
+ modalLayoutStacked_: modalLayoutStacked_,
3889
+ showPlaceholders_: () => !suggestions_response_.latest
3876
3890
  });
3877
3891
  }
3878
3892
  });
package/ES10/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.10";
13
+ export const version = "4.0.12";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
package/ES10/index.js CHANGED
@@ -10,7 +10,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.10";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.12";
14
14
  function $a604a8ffa4e4c03f$export$e417c49320921907(dependency, fetcher) {
15
15
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $8tj43$createSignal();
16
16
  const deparallelizedFetcher = $8tj43$deparallelize_no_drop(async dependencyValue => {
@@ -3151,15 +3151,16 @@ function $ab401afaded322ab$export$c8d7e00464029b45(_ref) {
3151
3151
  itemIndex_: itemIndex_,
3152
3152
  selected_index_: selected_index_,
3153
3153
  modalLayoutStacked_: modalLayoutStacked_,
3154
+ showPlaceholders_: showPlaceholders_,
3154
3155
  currently_showing_suggestions_: [, set_currently_showing_suggestions]
3155
3156
  } = _ref;
3156
3157
  const listings_by_id = $8tj43$createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
3157
3158
  const productCards = $8tj43$createComponent((0, $8tj43$For), {
3158
3159
  get each() {
3159
- return Object.keys(listings_by_id());
3160
+ return $8tj43$memo(() => !!showPlaceholders_())() ? [,,,] : Object.keys(listings_by_id());
3160
3161
  },
3161
3162
  children: (listingId, index) => {
3162
- const listing = $8tj43$createMemo(() => listings_by_id()[listingId]);
3163
+ const listing = $8tj43$createMemo(() => listingId == undefined ? undefined : listings_by_id()[listingId]);
3163
3164
  return $8tj43$createComponent((0, $26db6925469636a4$export$67152d26d4f56ee8), {
3164
3165
  listing_: listing,
3165
3166
  i18n_: i18n_,
@@ -3183,7 +3184,7 @@ function $ab401afaded322ab$export$c8d7e00464029b45(_ref) {
3183
3184
  return $8tj43$createComponent((0, $8tj43$Show), {
3184
3185
  get when() {
3185
3186
  var _listing_suggestions_2;
3186
- return (_listing_suggestions_2 = listing_suggestions_()) === null || _listing_suggestions_2 === void 0 ? void 0 : _listing_suggestions_2.length;
3187
+ return ((_listing_suggestions_2 = listing_suggestions_()) === null || _listing_suggestions_2 === void 0 ? void 0 : _listing_suggestions_2.length) || showPlaceholders_();
3187
3188
  },
3188
3189
  get children() {
3189
3190
  var _el$ = $8tj43$getNextElement($ab401afaded322ab$var$_tmpl$),
@@ -3559,6 +3560,7 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
3559
3560
  forceUseDiv_: forceUseDiv_
3560
3561
  } = _ref;
3561
3562
  let on_enter_in_search_field_function;
3563
+ let listingSuggestionsDebounceTimeout;
3562
3564
  // 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.
3563
3565
  // 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
3564
3566
  // Basically the UI signals that the button that opens the modal starts a new search.
@@ -3574,6 +3576,8 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
3574
3576
  const [input_field, set_input_field] = $8tj43$createSignal();
3575
3577
  const [searching_for_value_, set_searching_for_value_] = $8tj43$createSignal();
3576
3578
  const [show_stale_content_results_, set_show_stale_content_results_] = $8tj43$createSignal(false);
3579
+ // For fake debounce
3580
+ const [showStaleListingSuggestions, setShowStaleListingSuggestions] = $8tj43$createSignal(false);
3577
3581
  const suggestions_updating_blocked_ = $8tj43$createSignal(false);
3578
3582
  const [modalBodyWidth, setModalBodyWidth] = $8tj43$createSignal(0);
3579
3583
  const modalLayoutStacked_ = $8tj43$createMemo(() => modalBodyWidth() < 650);
@@ -3605,9 +3609,11 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
3605
3609
  set_searching_for_value_: set_searching_for_value_,
3606
3610
  set_show_stale_content_results_: set_show_stale_content_results_
3607
3611
  });
3608
- const listing_suggestions_ = $8tj43$createMemo(() => {
3612
+ const listing_suggestions_ = $8tj43$createMemo(prev => {
3609
3613
  var _suggestions_response;
3610
3614
  const all = enable_category_suggestions_ ? (_suggestions_response = suggestions_response_()) === null || _suggestions_response === void 0 ? void 0 : _suggestions_response.filter(item => item.type === "listing") : [];
3615
+ // To prevent jumping of the modal when the visual listing suggestions exist/don't exist we debounce it the same way as the product results
3616
+ if (showStaleListingSuggestions() && !(all !== null && all !== void 0 && all.length)) return prev;
3611
3617
  if (modalLayoutStacked_()) return all;
3612
3618
  return all === null || all === void 0 ? void 0 : all.slice(0, 3);
3613
3619
  });
@@ -3682,6 +3688,13 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
3682
3688
  $a82a41ab7188eda2$export$93d9bfd0c9c1a5b8(close_modal_, search_query_url_param_name_);
3683
3689
  addEventListener("keydown", close_on_escape_handler);
3684
3690
  $8tj43$onCleanup(() => removeEventListener("keydown", close_on_escape_handler));
3691
+ $8tj43$createEffect($8tj43$on(get_search_field_value_, () => {
3692
+ setShowStaleListingSuggestions(true);
3693
+ clearTimeout(listingSuggestionsDebounceTimeout);
3694
+ listingSuggestionsDebounceTimeout = setTimeout($8tj43$catchify(() => setShowStaleListingSuggestions(false)), 350);
3695
+ }, {
3696
+ defer: true
3697
+ }));
3685
3698
  if (closing_animation_) register_closing_animation_(closing_animation_);
3686
3699
  $a09bb7c652acf957$export$3340fdd8259bd4fd({
3687
3700
  get_search_field_value_: get_search_field_value_,
@@ -3788,7 +3801,8 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
3788
3801
  },
3789
3802
  selected_index_: selected_index_,
3790
3803
  currently_showing_suggestions_: currently_showing_suggestions_,
3791
- modalLayoutStacked_: modalLayoutStacked_
3804
+ modalLayoutStacked_: modalLayoutStacked_,
3805
+ showPlaceholders_: () => !suggestions_response_.latest
3792
3806
  });
3793
3807
  }
3794
3808
  });
package/latest/index.cjs CHANGED
@@ -88,7 +88,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad99
88
88
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
89
89
  $parcel$export(module.exports, "SearchField", () => $c0a0659cf97e8eb2$export$316f6f283ae64765);
90
90
  /*! Depict.ai search and product listing SDK */
91
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.10";
91
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.12";
92
92
  function $53df95e470b2f8d2$export$e417c49320921907(dependency, fetcher) {
93
93
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $gVhhF$solidjs.createSignal();
94
94
  const deparallelizedFetcher = $gVhhF$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
@@ -3088,15 +3088,16 @@ function $83e616b38be339e4$export$c8d7e00464029b45({
3088
3088
  itemIndex_: itemIndex_,
3089
3089
  selected_index_: selected_index_,
3090
3090
  modalLayoutStacked_: modalLayoutStacked_,
3091
+ showPlaceholders_: showPlaceholders_,
3091
3092
  currently_showing_suggestions_: [, set_currently_showing_suggestions]
3092
3093
  }) {
3093
3094
  const listings_by_id = $gVhhF$solidjs.createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
3094
3095
  const productCards = $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.For), {
3095
3096
  get each() {
3096
- return Object.keys(listings_by_id());
3097
+ return $gVhhF$solidjsweb.memo(() => !!showPlaceholders_())() ? [,,,] : Object.keys(listings_by_id());
3097
3098
  },
3098
3099
  children: (listingId, index) => {
3099
- const listing = $gVhhF$solidjs.createMemo(() => listings_by_id()[listingId]);
3100
+ const listing = $gVhhF$solidjs.createMemo(() => listingId == undefined ? undefined : listings_by_id()[listingId]);
3100
3101
  return $gVhhF$solidjsweb.createComponent((0, $1f3b5fa875714dea$export$67152d26d4f56ee8), {
3101
3102
  listing_: listing,
3102
3103
  i18n_: i18n_,
@@ -3116,7 +3117,7 @@ function $83e616b38be339e4$export$c8d7e00464029b45({
3116
3117
  })) || []));
3117
3118
  return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
3118
3119
  get when() {
3119
- return listing_suggestions_()?.length;
3120
+ return listing_suggestions_()?.length || showPlaceholders_();
3120
3121
  },
3121
3122
  get children() {
3122
3123
  var _el$ = $gVhhF$solidjsweb.getNextElement($83e616b38be339e4$var$_tmpl$),
@@ -3485,6 +3486,7 @@ function $11597ae03e703a47$var$RawSearchModalV2({
3485
3486
  forceUseDiv_: forceUseDiv_
3486
3487
  }) {
3487
3488
  let on_enter_in_search_field_function;
3489
+ let listingSuggestionsDebounceTimeout;
3488
3490
  // 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.
3489
3491
  // 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
3490
3492
  // Basically the UI signals that the button that opens the modal starts a new search.
@@ -3500,6 +3502,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
3500
3502
  const [input_field, set_input_field] = $gVhhF$solidjs.createSignal();
3501
3503
  const [searching_for_value_, set_searching_for_value_] = $gVhhF$solidjs.createSignal();
3502
3504
  const [show_stale_content_results_, set_show_stale_content_results_] = $gVhhF$solidjs.createSignal(false);
3505
+ // For fake debounce
3506
+ const [showStaleListingSuggestions, setShowStaleListingSuggestions] = $gVhhF$solidjs.createSignal(false);
3503
3507
  const suggestions_updating_blocked_ = $gVhhF$solidjs.createSignal(false);
3504
3508
  const [modalBodyWidth, setModalBodyWidth] = $gVhhF$solidjs.createSignal(0);
3505
3509
  const modalLayoutStacked_ = $gVhhF$solidjs.createMemo(() => modalBodyWidth() < 650);
@@ -3531,8 +3535,10 @@ function $11597ae03e703a47$var$RawSearchModalV2({
3531
3535
  set_searching_for_value_: set_searching_for_value_,
3532
3536
  set_show_stale_content_results_: set_show_stale_content_results_
3533
3537
  });
3534
- const listing_suggestions_ = $gVhhF$solidjs.createMemo(() => {
3538
+ const listing_suggestions_ = $gVhhF$solidjs.createMemo(prev => {
3535
3539
  const all = enable_category_suggestions_ ? suggestions_response_()?.filter(item => item.type === "listing") : [];
3540
+ // To prevent jumping of the modal when the visual listing suggestions exist/don't exist we debounce it the same way as the product results
3541
+ if (showStaleListingSuggestions() && !all?.length) return prev;
3536
3542
  if (modalLayoutStacked_()) return all;
3537
3543
  return all?.slice(0, 3);
3538
3544
  });
@@ -3601,6 +3607,13 @@ function $11597ae03e703a47$var$RawSearchModalV2({
3601
3607
  $eb3039a27db40508$export$93d9bfd0c9c1a5b8(close_modal_, search_query_url_param_name_);
3602
3608
  addEventListener("keydown", close_on_escape_handler);
3603
3609
  $gVhhF$solidjs.onCleanup(() => removeEventListener("keydown", close_on_escape_handler));
3610
+ $gVhhF$solidjs.createEffect($gVhhF$solidjs.on(get_search_field_value_, () => {
3611
+ setShowStaleListingSuggestions(true);
3612
+ clearTimeout(listingSuggestionsDebounceTimeout);
3613
+ listingSuggestionsDebounceTimeout = setTimeout($gVhhF$depictaiutilishared.catchify(() => setShowStaleListingSuggestions(false)), 350);
3614
+ }, {
3615
+ defer: true
3616
+ }));
3604
3617
  if (closing_animation_) register_closing_animation_(closing_animation_);
3605
3618
  $036d367ce3058351$export$3340fdd8259bd4fd({
3606
3619
  get_search_field_value_: get_search_field_value_,
@@ -3707,7 +3720,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
3707
3720
  },
3708
3721
  selected_index_: selected_index_,
3709
3722
  currently_showing_suggestions_: currently_showing_suggestions_,
3710
- modalLayoutStacked_: modalLayoutStacked_
3723
+ modalLayoutStacked_: modalLayoutStacked_,
3724
+ showPlaceholders_: () => !suggestions_response_.latest
3711
3725
  });
3712
3726
  }
3713
3727
  });
package/latest/index.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.10";
13
+ export const version = "4.0.12";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
package/latest/index.js CHANGED
@@ -7,7 +7,7 @@ import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.10";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.12";
11
11
  function $136f1d4d6c7ba6ac$export$e417c49320921907(dependency, fetcher) {
12
12
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $9HbP8$createSignal();
13
13
  const deparallelizedFetcher = $9HbP8$deparallelize_no_drop(async dependencyValue => {
@@ -3007,15 +3007,16 @@ function $44f30a4222ce604b$export$c8d7e00464029b45({
3007
3007
  itemIndex_: itemIndex_,
3008
3008
  selected_index_: selected_index_,
3009
3009
  modalLayoutStacked_: modalLayoutStacked_,
3010
+ showPlaceholders_: showPlaceholders_,
3010
3011
  currently_showing_suggestions_: [, set_currently_showing_suggestions]
3011
3012
  }) {
3012
3013
  const listings_by_id = $9HbP8$createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
3013
3014
  const productCards = $9HbP8$createComponent((0, $9HbP8$For), {
3014
3015
  get each() {
3015
- return Object.keys(listings_by_id());
3016
+ return $9HbP8$memo(() => !!showPlaceholders_())() ? [,,,] : Object.keys(listings_by_id());
3016
3017
  },
3017
3018
  children: (listingId, index) => {
3018
- const listing = $9HbP8$createMemo(() => listings_by_id()[listingId]);
3019
+ const listing = $9HbP8$createMemo(() => listingId == undefined ? undefined : listings_by_id()[listingId]);
3019
3020
  return $9HbP8$createComponent((0, $4ce5b8892775b62d$export$67152d26d4f56ee8), {
3020
3021
  listing_: listing,
3021
3022
  i18n_: i18n_,
@@ -3035,7 +3036,7 @@ function $44f30a4222ce604b$export$c8d7e00464029b45({
3035
3036
  })) || []));
3036
3037
  return $9HbP8$createComponent((0, $9HbP8$Show), {
3037
3038
  get when() {
3038
- return listing_suggestions_()?.length;
3039
+ return listing_suggestions_()?.length || showPlaceholders_();
3039
3040
  },
3040
3041
  get children() {
3041
3042
  var _el$ = $9HbP8$getNextElement($44f30a4222ce604b$var$_tmpl$),
@@ -3404,6 +3405,7 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
3404
3405
  forceUseDiv_: forceUseDiv_
3405
3406
  }) {
3406
3407
  let on_enter_in_search_field_function;
3408
+ let listingSuggestionsDebounceTimeout;
3407
3409
  // 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.
3408
3410
  // 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
3409
3411
  // Basically the UI signals that the button that opens the modal starts a new search.
@@ -3419,6 +3421,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
3419
3421
  const [input_field, set_input_field] = $9HbP8$createSignal();
3420
3422
  const [searching_for_value_, set_searching_for_value_] = $9HbP8$createSignal();
3421
3423
  const [show_stale_content_results_, set_show_stale_content_results_] = $9HbP8$createSignal(false);
3424
+ // For fake debounce
3425
+ const [showStaleListingSuggestions, setShowStaleListingSuggestions] = $9HbP8$createSignal(false);
3422
3426
  const suggestions_updating_blocked_ = $9HbP8$createSignal(false);
3423
3427
  const [modalBodyWidth, setModalBodyWidth] = $9HbP8$createSignal(0);
3424
3428
  const modalLayoutStacked_ = $9HbP8$createMemo(() => modalBodyWidth() < 650);
@@ -3450,8 +3454,10 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
3450
3454
  set_searching_for_value_: set_searching_for_value_,
3451
3455
  set_show_stale_content_results_: set_show_stale_content_results_
3452
3456
  });
3453
- const listing_suggestions_ = $9HbP8$createMemo(() => {
3457
+ const listing_suggestions_ = $9HbP8$createMemo(prev => {
3454
3458
  const all = enable_category_suggestions_ ? suggestions_response_()?.filter(item => item.type === "listing") : [];
3459
+ // To prevent jumping of the modal when the visual listing suggestions exist/don't exist we debounce it the same way as the product results
3460
+ if (showStaleListingSuggestions() && !all?.length) return prev;
3455
3461
  if (modalLayoutStacked_()) return all;
3456
3462
  return all?.slice(0, 3);
3457
3463
  });
@@ -3520,6 +3526,13 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
3520
3526
  $512b994d501f412b$export$93d9bfd0c9c1a5b8(close_modal_, search_query_url_param_name_);
3521
3527
  addEventListener("keydown", close_on_escape_handler);
3522
3528
  $9HbP8$onCleanup(() => removeEventListener("keydown", close_on_escape_handler));
3529
+ $9HbP8$createEffect($9HbP8$on(get_search_field_value_, () => {
3530
+ setShowStaleListingSuggestions(true);
3531
+ clearTimeout(listingSuggestionsDebounceTimeout);
3532
+ listingSuggestionsDebounceTimeout = setTimeout($9HbP8$catchify(() => setShowStaleListingSuggestions(false)), 350);
3533
+ }, {
3534
+ defer: true
3535
+ }));
3523
3536
  if (closing_animation_) register_closing_animation_(closing_animation_);
3524
3537
  $c64d28ca12452b21$export$3340fdd8259bd4fd({
3525
3538
  get_search_field_value_: get_search_field_value_,
@@ -3626,7 +3639,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
3626
3639
  },
3627
3640
  selected_index_: selected_index_,
3628
3641
  currently_showing_suggestions_: currently_showing_suggestions_,
3629
- modalLayoutStacked_: modalLayoutStacked_
3642
+ modalLayoutStacked_: modalLayoutStacked_,
3643
+ showPlaceholders_: () => !suggestions_response_.latest
3630
3644
  });
3631
3645
  }
3632
3646
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "sass": "styles.scss",
@@ -94,7 +94,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447a
94
94
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
95
95
  $parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316f6f283ae64765);
96
96
  /*! Depict.ai search and product listing SDK */
97
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.10";
97
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.0.12";
98
98
  function $a28000bc10de28ad$export$e417c49320921907(dependency, fetcher) {
99
99
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $3hooq$solidjs.createSignal();
100
100
  const deparallelizedFetcher = $3hooq$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
@@ -2540,15 +2540,16 @@ function $f765bad01136eee1$export$c8d7e00464029b45(_ref) {
2540
2540
  itemIndex_: itemIndex_,
2541
2541
  selected_index_: selected_index_,
2542
2542
  modalLayoutStacked_: modalLayoutStacked_,
2543
+ showPlaceholders_: showPlaceholders_,
2543
2544
  currently_showing_suggestions_: [, set_currently_showing_suggestions]
2544
2545
  } = _ref;
2545
2546
  const listings_by_id = $3hooq$solidjs.createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
2546
2547
  const productCards = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.For), {
2547
2548
  get each() {
2548
- return Object.keys(listings_by_id());
2549
+ return showPlaceholders_() ? [,,,] : Object.keys(listings_by_id());
2549
2550
  },
2550
2551
  children: (listingId, index) => {
2551
- const listing = $3hooq$solidjs.createMemo(() => listings_by_id()[listingId]);
2552
+ const listing = $3hooq$solidjs.createMemo(() => listingId == undefined ? undefined : listings_by_id()[listingId]);
2552
2553
  return $3hooq$solidjsweb.createComponent((0, $d1e7b96fb13cd1d3$export$67152d26d4f56ee8), {
2553
2554
  listing_: listing,
2554
2555
  i18n_: i18n_,
@@ -2572,7 +2573,7 @@ function $f765bad01136eee1$export$c8d7e00464029b45(_ref) {
2572
2573
  return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
2573
2574
  get when() {
2574
2575
  var _listing_suggestions_2;
2575
- return (_listing_suggestions_2 = listing_suggestions_()) === null || _listing_suggestions_2 === void 0 ? void 0 : _listing_suggestions_2.length;
2576
+ return ((_listing_suggestions_2 = listing_suggestions_()) === null || _listing_suggestions_2 === void 0 ? void 0 : _listing_suggestions_2.length) || showPlaceholders_();
2576
2577
  },
2577
2578
  get children() {
2578
2579
  return $3hooq$solidjsweb.ssr($f765bad01136eee1$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "order:" + $3hooq$solidjsweb.escape(itemIndex_(), true), $3hooq$solidjsweb.escape(i18n_.listing_suggestions_()), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
@@ -2881,6 +2882,7 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
2881
2882
  forceUseDiv_: forceUseDiv_
2882
2883
  } = _ref;
2883
2884
  let on_enter_in_search_field_function;
2885
+ let listingSuggestionsDebounceTimeout;
2884
2886
  // 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.
2885
2887
  // 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
2886
2888
  // Basically the UI signals that the button that opens the modal starts a new search.
@@ -2896,6 +2898,8 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
2896
2898
  const [input_field, set_input_field] = $3hooq$solidjs.createSignal();
2897
2899
  const [searching_for_value_, set_searching_for_value_] = $3hooq$solidjs.createSignal();
2898
2900
  const [show_stale_content_results_, set_show_stale_content_results_] = $3hooq$solidjs.createSignal(false);
2901
+ // For fake debounce
2902
+ const [showStaleListingSuggestions, setShowStaleListingSuggestions] = $3hooq$solidjs.createSignal(false);
2899
2903
  const suggestions_updating_blocked_ = $3hooq$solidjs.createSignal(false);
2900
2904
  const [modalBodyWidth, setModalBodyWidth] = $3hooq$solidjs.createSignal(0);
2901
2905
  const modalLayoutStacked_ = $3hooq$solidjs.createMemo(() => modalBodyWidth() < 650);
@@ -2927,9 +2931,11 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
2927
2931
  set_searching_for_value_: set_searching_for_value_,
2928
2932
  set_show_stale_content_results_: set_show_stale_content_results_
2929
2933
  });
2930
- const listing_suggestions_ = $3hooq$solidjs.createMemo(() => {
2934
+ const listing_suggestions_ = $3hooq$solidjs.createMemo(prev => {
2931
2935
  var _suggestions_response;
2932
2936
  const all = enable_category_suggestions_ ? (_suggestions_response = suggestions_response_()) === null || _suggestions_response === void 0 ? void 0 : _suggestions_response.filter(item => item.type === "listing") : [];
2937
+ // To prevent jumping of the modal when the visual listing suggestions exist/don't exist we debounce it the same way as the product results
2938
+ if (showStaleListingSuggestions() && !(all !== null && all !== void 0 && all.length)) return prev;
2933
2939
  if (modalLayoutStacked_()) return all;
2934
2940
  return all === null || all === void 0 ? void 0 : all.slice(0, 3);
2935
2941
  });
@@ -3004,6 +3010,13 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
3004
3010
  $4b71b4fabdee5753$export$93d9bfd0c9c1a5b8(close_modal_, search_query_url_param_name_);
3005
3011
  addEventListener("keydown", close_on_escape_handler);
3006
3012
  $3hooq$solidjs.onCleanup(() => removeEventListener("keydown", close_on_escape_handler));
3013
+ $3hooq$solidjs.createEffect($3hooq$solidjs.on(get_search_field_value_, () => {
3014
+ setShowStaleListingSuggestions(true);
3015
+ clearTimeout(listingSuggestionsDebounceTimeout);
3016
+ listingSuggestionsDebounceTimeout = setTimeout($3hooq$depictaiutilishared.catchify(() => setShowStaleListingSuggestions(false)), 350);
3017
+ }, {
3018
+ defer: true
3019
+ }));
3007
3020
  if (closing_animation_) register_closing_animation_(closing_animation_);
3008
3021
  $4e44eb7e21ff022a$export$3340fdd8259bd4fd({
3009
3022
  get_search_field_value_: get_search_field_value_,
@@ -3103,7 +3116,8 @@ function $43600b30502feeda$var$RawSearchModalV2(_ref) {
3103
3116
  },
3104
3117
  selected_index_: selected_index_,
3105
3118
  currently_showing_suggestions_: currently_showing_suggestions_,
3106
- modalLayoutStacked_: modalLayoutStacked_
3119
+ modalLayoutStacked_: modalLayoutStacked_,
3120
+ showPlaceholders_: () => !suggestions_response_.latest
3107
3121
  });
3108
3122
  }
3109
3123
  });
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.10";
13
+ export const version = "4.0.12";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
@@ -10,7 +10,7 @@ import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from
10
10
  /*! Depict.ai search and product listing SDK */
11
11
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
12
12
  register_es_version("ui", "ES10");
13
- const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.10";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.0.12";
14
14
  function $a604a8ffa4e4c03f$export$e417c49320921907(dependency, fetcher) {
15
15
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $b8hua$createSignal();
16
16
  const deparallelizedFetcher = $b8hua$deparallelize_no_drop(async dependencyValue => {
@@ -2456,15 +2456,16 @@ function $ab401afaded322ab$export$c8d7e00464029b45(_ref) {
2456
2456
  itemIndex_: itemIndex_,
2457
2457
  selected_index_: selected_index_,
2458
2458
  modalLayoutStacked_: modalLayoutStacked_,
2459
+ showPlaceholders_: showPlaceholders_,
2459
2460
  currently_showing_suggestions_: [, set_currently_showing_suggestions]
2460
2461
  } = _ref;
2461
2462
  const listings_by_id = $b8hua$createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
2462
2463
  const productCards = $b8hua$createComponent((0, $b8hua$For), {
2463
2464
  get each() {
2464
- return Object.keys(listings_by_id());
2465
+ return showPlaceholders_() ? [,,,] : Object.keys(listings_by_id());
2465
2466
  },
2466
2467
  children: (listingId, index) => {
2467
- const listing = $b8hua$createMemo(() => listings_by_id()[listingId]);
2468
+ const listing = $b8hua$createMemo(() => listingId == undefined ? undefined : listings_by_id()[listingId]);
2468
2469
  return $b8hua$createComponent((0, $26db6925469636a4$export$67152d26d4f56ee8), {
2469
2470
  listing_: listing,
2470
2471
  i18n_: i18n_,
@@ -2488,7 +2489,7 @@ function $ab401afaded322ab$export$c8d7e00464029b45(_ref) {
2488
2489
  return $b8hua$createComponent((0, $b8hua$Show), {
2489
2490
  get when() {
2490
2491
  var _listing_suggestions_2;
2491
- return (_listing_suggestions_2 = listing_suggestions_()) === null || _listing_suggestions_2 === void 0 ? void 0 : _listing_suggestions_2.length;
2492
+ return ((_listing_suggestions_2 = listing_suggestions_()) === null || _listing_suggestions_2 === void 0 ? void 0 : _listing_suggestions_2.length) || showPlaceholders_();
2492
2493
  },
2493
2494
  get children() {
2494
2495
  return $b8hua$ssr($ab401afaded322ab$var$_tmpl$, $b8hua$ssrHydrationKey(), "order:" + $b8hua$escape(itemIndex_(), true), $b8hua$escape(i18n_.listing_suggestions_()), $b8hua$escape($b8hua$createComponent((0, $b8hua$Show), {
@@ -2797,6 +2798,7 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
2797
2798
  forceUseDiv_: forceUseDiv_
2798
2799
  } = _ref;
2799
2800
  let on_enter_in_search_field_function;
2801
+ let listingSuggestionsDebounceTimeout;
2800
2802
  // 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.
2801
2803
  // 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
2802
2804
  // Basically the UI signals that the button that opens the modal starts a new search.
@@ -2812,6 +2814,8 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
2812
2814
  const [input_field, set_input_field] = $b8hua$createSignal();
2813
2815
  const [searching_for_value_, set_searching_for_value_] = $b8hua$createSignal();
2814
2816
  const [show_stale_content_results_, set_show_stale_content_results_] = $b8hua$createSignal(false);
2817
+ // For fake debounce
2818
+ const [showStaleListingSuggestions, setShowStaleListingSuggestions] = $b8hua$createSignal(false);
2815
2819
  const suggestions_updating_blocked_ = $b8hua$createSignal(false);
2816
2820
  const [modalBodyWidth, setModalBodyWidth] = $b8hua$createSignal(0);
2817
2821
  const modalLayoutStacked_ = $b8hua$createMemo(() => modalBodyWidth() < 650);
@@ -2843,9 +2847,11 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
2843
2847
  set_searching_for_value_: set_searching_for_value_,
2844
2848
  set_show_stale_content_results_: set_show_stale_content_results_
2845
2849
  });
2846
- const listing_suggestions_ = $b8hua$createMemo(() => {
2850
+ const listing_suggestions_ = $b8hua$createMemo(prev => {
2847
2851
  var _suggestions_response;
2848
2852
  const all = enable_category_suggestions_ ? (_suggestions_response = suggestions_response_()) === null || _suggestions_response === void 0 ? void 0 : _suggestions_response.filter(item => item.type === "listing") : [];
2853
+ // To prevent jumping of the modal when the visual listing suggestions exist/don't exist we debounce it the same way as the product results
2854
+ if (showStaleListingSuggestions() && !(all !== null && all !== void 0 && all.length)) return prev;
2849
2855
  if (modalLayoutStacked_()) return all;
2850
2856
  return all === null || all === void 0 ? void 0 : all.slice(0, 3);
2851
2857
  });
@@ -2920,6 +2926,13 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
2920
2926
  $a82a41ab7188eda2$export$93d9bfd0c9c1a5b8(close_modal_, search_query_url_param_name_);
2921
2927
  addEventListener("keydown", close_on_escape_handler);
2922
2928
  $b8hua$onCleanup(() => removeEventListener("keydown", close_on_escape_handler));
2929
+ $b8hua$createEffect($b8hua$on(get_search_field_value_, () => {
2930
+ setShowStaleListingSuggestions(true);
2931
+ clearTimeout(listingSuggestionsDebounceTimeout);
2932
+ listingSuggestionsDebounceTimeout = setTimeout($b8hua$catchify(() => setShowStaleListingSuggestions(false)), 350);
2933
+ }, {
2934
+ defer: true
2935
+ }));
2923
2936
  if (closing_animation_) register_closing_animation_(closing_animation_);
2924
2937
  $a09bb7c652acf957$export$3340fdd8259bd4fd({
2925
2938
  get_search_field_value_: get_search_field_value_,
@@ -3019,7 +3032,8 @@ function $06fcd2a345efd24d$var$RawSearchModalV2(_ref) {
3019
3032
  },
3020
3033
  selected_index_: selected_index_,
3021
3034
  currently_showing_suggestions_: currently_showing_suggestions_,
3022
- modalLayoutStacked_: modalLayoutStacked_
3035
+ modalLayoutStacked_: modalLayoutStacked_,
3036
+ showPlaceholders_: () => !suggestions_response_.latest
3023
3037
  });
3024
3038
  }
3025
3039
  });
@@ -88,7 +88,7 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad99
88
88
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
89
89
  $parcel$export(module.exports, "SearchField", () => $c0a0659cf97e8eb2$export$316f6f283ae64765);
90
90
  /*! Depict.ai search and product listing SDK */
91
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.10";
91
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.0.12";
92
92
  function $53df95e470b2f8d2$export$e417c49320921907(dependency, fetcher) {
93
93
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $5vyXB$solidjs.createSignal();
94
94
  const deparallelizedFetcher = $5vyXB$depictaiutilishared.deparallelize_no_drop(async dependencyValue => {
@@ -2414,15 +2414,16 @@ function $83e616b38be339e4$export$c8d7e00464029b45({
2414
2414
  itemIndex_: itemIndex_,
2415
2415
  selected_index_: selected_index_,
2416
2416
  modalLayoutStacked_: modalLayoutStacked_,
2417
+ showPlaceholders_: showPlaceholders_,
2417
2418
  currently_showing_suggestions_: [, set_currently_showing_suggestions]
2418
2419
  }) {
2419
2420
  const listings_by_id = $5vyXB$solidjs.createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
2420
2421
  const productCards = $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.For), {
2421
2422
  get each() {
2422
- return Object.keys(listings_by_id());
2423
+ return showPlaceholders_() ? [,,,] : Object.keys(listings_by_id());
2423
2424
  },
2424
2425
  children: (listingId, index) => {
2425
- const listing = $5vyXB$solidjs.createMemo(() => listings_by_id()[listingId]);
2426
+ const listing = $5vyXB$solidjs.createMemo(() => listingId == undefined ? undefined : listings_by_id()[listingId]);
2426
2427
  return $5vyXB$solidjsweb.createComponent((0, $1f3b5fa875714dea$export$67152d26d4f56ee8), {
2427
2428
  listing_: listing,
2428
2429
  i18n_: i18n_,
@@ -2442,7 +2443,7 @@ function $83e616b38be339e4$export$c8d7e00464029b45({
2442
2443
  })) || []));
2443
2444
  return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
2444
2445
  get when() {
2445
- return listing_suggestions_()?.length;
2446
+ return listing_suggestions_()?.length || showPlaceholders_();
2446
2447
  },
2447
2448
  get children() {
2448
2449
  return $5vyXB$solidjsweb.ssr($83e616b38be339e4$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), "order:" + $5vyXB$solidjsweb.escape(itemIndex_(), true), $5vyXB$solidjsweb.escape(i18n_.listing_suggestions_()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
@@ -2744,6 +2745,7 @@ function $11597ae03e703a47$var$RawSearchModalV2({
2744
2745
  forceUseDiv_: forceUseDiv_
2745
2746
  }) {
2746
2747
  let on_enter_in_search_field_function;
2748
+ let listingSuggestionsDebounceTimeout;
2747
2749
  // 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.
2748
2750
  // 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
2749
2751
  // Basically the UI signals that the button that opens the modal starts a new search.
@@ -2759,6 +2761,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
2759
2761
  const [input_field, set_input_field] = $5vyXB$solidjs.createSignal();
2760
2762
  const [searching_for_value_, set_searching_for_value_] = $5vyXB$solidjs.createSignal();
2761
2763
  const [show_stale_content_results_, set_show_stale_content_results_] = $5vyXB$solidjs.createSignal(false);
2764
+ // For fake debounce
2765
+ const [showStaleListingSuggestions, setShowStaleListingSuggestions] = $5vyXB$solidjs.createSignal(false);
2762
2766
  const suggestions_updating_blocked_ = $5vyXB$solidjs.createSignal(false);
2763
2767
  const [modalBodyWidth, setModalBodyWidth] = $5vyXB$solidjs.createSignal(0);
2764
2768
  const modalLayoutStacked_ = $5vyXB$solidjs.createMemo(() => modalBodyWidth() < 650);
@@ -2790,8 +2794,10 @@ function $11597ae03e703a47$var$RawSearchModalV2({
2790
2794
  set_searching_for_value_: set_searching_for_value_,
2791
2795
  set_show_stale_content_results_: set_show_stale_content_results_
2792
2796
  });
2793
- const listing_suggestions_ = $5vyXB$solidjs.createMemo(() => {
2797
+ const listing_suggestions_ = $5vyXB$solidjs.createMemo(prev => {
2794
2798
  const all = enable_category_suggestions_ ? suggestions_response_()?.filter(item => item.type === "listing") : [];
2799
+ // To prevent jumping of the modal when the visual listing suggestions exist/don't exist we debounce it the same way as the product results
2800
+ if (showStaleListingSuggestions() && !all?.length) return prev;
2795
2801
  if (modalLayoutStacked_()) return all;
2796
2802
  return all?.slice(0, 3);
2797
2803
  });
@@ -2860,6 +2866,13 @@ function $11597ae03e703a47$var$RawSearchModalV2({
2860
2866
  $eb3039a27db40508$export$93d9bfd0c9c1a5b8(close_modal_, search_query_url_param_name_);
2861
2867
  addEventListener("keydown", close_on_escape_handler);
2862
2868
  $5vyXB$solidjs.onCleanup(() => removeEventListener("keydown", close_on_escape_handler));
2869
+ $5vyXB$solidjs.createEffect($5vyXB$solidjs.on(get_search_field_value_, () => {
2870
+ setShowStaleListingSuggestions(true);
2871
+ clearTimeout(listingSuggestionsDebounceTimeout);
2872
+ listingSuggestionsDebounceTimeout = setTimeout($5vyXB$depictaiutilishared.catchify(() => setShowStaleListingSuggestions(false)), 350);
2873
+ }, {
2874
+ defer: true
2875
+ }));
2863
2876
  if (closing_animation_) register_closing_animation_(closing_animation_);
2864
2877
  $036d367ce3058351$export$3340fdd8259bd4fd({
2865
2878
  get_search_field_value_: get_search_field_value_,
@@ -2959,7 +2972,8 @@ function $11597ae03e703a47$var$RawSearchModalV2({
2959
2972
  },
2960
2973
  selected_index_: selected_index_,
2961
2974
  currently_showing_suggestions_: currently_showing_suggestions_,
2962
- modalLayoutStacked_: modalLayoutStacked_
2975
+ modalLayoutStacked_: modalLayoutStacked_,
2976
+ showPlaceholders_: () => !suggestions_response_.latest
2963
2977
  });
2964
2978
  }
2965
2979
  });
@@ -10,7 +10,7 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "4.0.10";
13
+ export const version = "4.0.12";
14
14
  export type ModalAlignmentSignals = {
15
15
  body_: Signal<JSX.CSSProperties>;
16
16
  field_: Signal<JSX.CSSProperties>;
@@ -7,7 +7,7 @@ import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.10";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.0.12";
11
11
  function $136f1d4d6c7ba6ac$export$e417c49320921907(dependency, fetcher) {
12
12
  const [promiseOfCurrentFetcherRun, setPromiseOfCurrentFetcherRun] = $i7OB2$createSignal();
13
13
  const deparallelizedFetcher = $i7OB2$deparallelize_no_drop(async dependencyValue => {
@@ -2333,15 +2333,16 @@ function $44f30a4222ce604b$export$c8d7e00464029b45({
2333
2333
  itemIndex_: itemIndex_,
2334
2334
  selected_index_: selected_index_,
2335
2335
  modalLayoutStacked_: modalLayoutStacked_,
2336
+ showPlaceholders_: showPlaceholders_,
2336
2337
  currently_showing_suggestions_: [, set_currently_showing_suggestions]
2337
2338
  }) {
2338
2339
  const listings_by_id = $i7OB2$createMemo(() => Object.fromEntries((listing_suggestions_() || []).map(listing => [listing.listing_id, listing])));
2339
2340
  const productCards = $i7OB2$createComponent((0, $i7OB2$For), {
2340
2341
  get each() {
2341
- return Object.keys(listings_by_id());
2342
+ return showPlaceholders_() ? [,,,] : Object.keys(listings_by_id());
2342
2343
  },
2343
2344
  children: (listingId, index) => {
2344
- const listing = $i7OB2$createMemo(() => listings_by_id()[listingId]);
2345
+ const listing = $i7OB2$createMemo(() => listingId == undefined ? undefined : listings_by_id()[listingId]);
2345
2346
  return $i7OB2$createComponent((0, $4ce5b8892775b62d$export$67152d26d4f56ee8), {
2346
2347
  listing_: listing,
2347
2348
  i18n_: i18n_,
@@ -2361,7 +2362,7 @@ function $44f30a4222ce604b$export$c8d7e00464029b45({
2361
2362
  })) || []));
2362
2363
  return $i7OB2$createComponent((0, $i7OB2$Show), {
2363
2364
  get when() {
2364
- return listing_suggestions_()?.length;
2365
+ return listing_suggestions_()?.length || showPlaceholders_();
2365
2366
  },
2366
2367
  get children() {
2367
2368
  return $i7OB2$ssr($44f30a4222ce604b$var$_tmpl$, $i7OB2$ssrHydrationKey(), "order:" + $i7OB2$escape(itemIndex_(), true), $i7OB2$escape(i18n_.listing_suggestions_()), $i7OB2$escape($i7OB2$createComponent((0, $i7OB2$Show), {
@@ -2663,6 +2664,7 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
2663
2664
  forceUseDiv_: forceUseDiv_
2664
2665
  }) {
2665
2666
  let on_enter_in_search_field_function;
2667
+ let listingSuggestionsDebounceTimeout;
2666
2668
  // 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.
2667
2669
  // 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
2668
2670
  // Basically the UI signals that the button that opens the modal starts a new search.
@@ -2678,6 +2680,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
2678
2680
  const [input_field, set_input_field] = $i7OB2$createSignal();
2679
2681
  const [searching_for_value_, set_searching_for_value_] = $i7OB2$createSignal();
2680
2682
  const [show_stale_content_results_, set_show_stale_content_results_] = $i7OB2$createSignal(false);
2683
+ // For fake debounce
2684
+ const [showStaleListingSuggestions, setShowStaleListingSuggestions] = $i7OB2$createSignal(false);
2681
2685
  const suggestions_updating_blocked_ = $i7OB2$createSignal(false);
2682
2686
  const [modalBodyWidth, setModalBodyWidth] = $i7OB2$createSignal(0);
2683
2687
  const modalLayoutStacked_ = $i7OB2$createMemo(() => modalBodyWidth() < 650);
@@ -2709,8 +2713,10 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
2709
2713
  set_searching_for_value_: set_searching_for_value_,
2710
2714
  set_show_stale_content_results_: set_show_stale_content_results_
2711
2715
  });
2712
- const listing_suggestions_ = $i7OB2$createMemo(() => {
2716
+ const listing_suggestions_ = $i7OB2$createMemo(prev => {
2713
2717
  const all = enable_category_suggestions_ ? suggestions_response_()?.filter(item => item.type === "listing") : [];
2718
+ // To prevent jumping of the modal when the visual listing suggestions exist/don't exist we debounce it the same way as the product results
2719
+ if (showStaleListingSuggestions() && !all?.length) return prev;
2714
2720
  if (modalLayoutStacked_()) return all;
2715
2721
  return all?.slice(0, 3);
2716
2722
  });
@@ -2779,6 +2785,13 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
2779
2785
  $512b994d501f412b$export$93d9bfd0c9c1a5b8(close_modal_, search_query_url_param_name_);
2780
2786
  addEventListener("keydown", close_on_escape_handler);
2781
2787
  $i7OB2$onCleanup(() => removeEventListener("keydown", close_on_escape_handler));
2788
+ $i7OB2$createEffect($i7OB2$on(get_search_field_value_, () => {
2789
+ setShowStaleListingSuggestions(true);
2790
+ clearTimeout(listingSuggestionsDebounceTimeout);
2791
+ listingSuggestionsDebounceTimeout = setTimeout($i7OB2$catchify(() => setShowStaleListingSuggestions(false)), 350);
2792
+ }, {
2793
+ defer: true
2794
+ }));
2782
2795
  if (closing_animation_) register_closing_animation_(closing_animation_);
2783
2796
  $c64d28ca12452b21$export$3340fdd8259bd4fd({
2784
2797
  get_search_field_value_: get_search_field_value_,
@@ -2878,7 +2891,8 @@ function $500a16dd18ee5a71$var$RawSearchModalV2({
2878
2891
  },
2879
2892
  selected_index_: selected_index_,
2880
2893
  currently_showing_suggestions_: currently_showing_suggestions_,
2881
- modalLayoutStacked_: modalLayoutStacked_
2894
+ modalLayoutStacked_: modalLayoutStacked_,
2895
+ showPlaceholders_: () => !suggestions_response_.latest
2882
2896
  });
2883
2897
  }
2884
2898
  });