@depict-ai/ui 2.0.8 → 2.0.10

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.
@@ -61,7 +61,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
61
61
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
62
62
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
63
63
  /*! Depict.ai search and product listing SDK */
64
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.8";
64
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.10";
65
65
 
66
66
  /** @jsxImportSource solid-js */
67
67
 
@@ -238,6 +238,7 @@ function $a73063cc642f3e5f$export$7f8bd308237ab5a5(get_displays_) {
238
238
  });
239
239
  return displays_by_key_;
240
240
  }
241
+ const $a73063cc642f3e5f$var$result_ids = ["search_result_id", "product_listing_result_id", "recommendation_id"];
241
242
  function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
242
243
  displays_by_key_: displays_by_key_,
243
244
  merchant_: merchant_,
@@ -251,17 +252,24 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
251
252
  },
252
253
  children: (product_id, index) => {
253
254
  const owner = $5vyXB$solidjs.getOwner();
254
- const display_accessor = $5vyXB$solidjs.createMemo(() => displays_by_key_().get(product_id));
255
- const [product_card_resource] = $5vyXB$solidjs.createResource(display_accessor,
256
- // re-render when the reference to the display object changes
257
- // this should only be the case when the merchant or market changes and the new request has completed
258
- display => {
255
+ const display_accessor = $5vyXB$solidjs.createMemo(prev => {
256
+ const new_display = displays_by_key_().get(product_id);
257
+ if (prev && $a73063cc642f3e5f$var$deep_equal(prev, new_display))
258
+ // If displays are identical, they haven't changed due to merchant/market changing OR we made a new query and the displays are the same. Return the old display (same object reference) to avoid re-rendering.
259
+ // This doesn't work if people mutate the displays from within the template but we hope they don't
260
+ // (We can't know if the display changing is due to merchant/market changing or a new query otherwise and don't want to run into https://gitlab.com/depict-ai/depict.ai/-/merge_requests/6890/diffs)
261
+ return prev;
262
+ return new_display;
263
+ });
264
+ const [product_card_resource] = $5vyXB$solidjs.createResource(() => [merchant_(), market_(), display_accessor()],
265
+ // re-render when the reference to the display object changes or the merchant or market changes
266
+ // (We don't want to re-render if nothing has changed)
267
+ ([merchant, market, display]) => {
259
268
  // get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
260
269
  return product_card_template_(display, {
261
270
  set_on_index_change: fn => $5vyXB$solidjs.runWithOwner(owner, () => $5vyXB$solidjs.createEffect(() => fn(index()))),
262
- merchant: $5vyXB$solidjs.untrack(merchant_),
263
- // this means that the merchant and market provided to the template is wrong while we do another fetch, but I don't see how anyone would need to know the correct market there
264
- market: $5vyXB$solidjs.untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
271
+ merchant: merchant,
272
+ market: market // recommendation_grid can provide a sneaky undefined here just FYI
265
273
  });
266
274
  });
267
275
 
@@ -276,15 +284,13 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
276
284
  elements.push(element);
277
285
  // Add tracking ids
278
286
  if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
279
- const {
280
- dataset: dataset
281
- } = element;
282
- const {
283
- search_result_id: search_result_id,
284
- product_listing_result_id: product_listing_result_id,
285
- recommendation_id: recommendation_id
286
- } = display;
287
- if (search_result_id) dataset.searchResultId = search_result_id;else if (product_listing_result_id) dataset.productListingResultId = product_listing_result_id;else if (recommendation_id) dataset.recommendationId = recommendation_id;
287
+ for (let i = 0; i < $a73063cc642f3e5f$var$result_ids.length; i++) {
288
+ const id = $a73063cc642f3e5f$var$result_ids[i];
289
+ const value = display[id];
290
+ if (value) Object.assign(element.dataset, $5vyXB$depictaiutilishared.camelCasifyObject({
291
+ [id]: value
292
+ }));
293
+ }
288
294
  }
289
295
  do_per_elements_?.(elements, index);
290
296
  });
@@ -292,6 +298,23 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
292
298
  }
293
299
  });
294
300
  }
301
+ // Source: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/
302
+ function $a73063cc642f3e5f$var$deep_equal(object1, object2) {
303
+ const keys1 = Object.keys(object1);
304
+ const keys2 = Object.keys(object2);
305
+ if (keys1.length !== keys2.length) return false;
306
+ for (const key of keys1) {
307
+ if ($a73063cc642f3e5f$var$result_ids.includes(key)) continue; // ignore result ids that change per response
308
+ const val1 = object1[key];
309
+ const val2 = object2[key];
310
+ const areObjects = $a73063cc642f3e5f$var$is_object(val1) && $a73063cc642f3e5f$var$is_object(val2);
311
+ if (areObjects && !$a73063cc642f3e5f$var$deep_equal(val1, val2) || !areObjects && val1 !== val2) return false;
312
+ }
313
+ return true;
314
+ }
315
+ function $a73063cc642f3e5f$var$is_object(object) {
316
+ return object != null && typeof object === "object";
317
+ }
295
318
 
296
319
  // Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
297
320
  class $7dd1edb2ee2b43ad$export$e1d52e4f0c7557a1 extends Error {}
@@ -600,44 +623,43 @@ function $b8e79813f4f7ebe4$export$7da560f849543dff({
600
623
  }) {
601
624
  const is_showing_something = $5vyXB$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
602
625
  const num_placeholders_ = () => 20;
603
- return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
604
- get when() {
605
- return is_showing_something();
626
+ const elements = $5vyXB$solidjsweb.ssr($b8e79813f4f7ebe4$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($fc23d7668ae0011d$export$a2cc176055f8f08()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $5vyXB$solidjsweb.mergeProps({
627
+ get rows() {
628
+ return rows_object_();
606
629
  },
630
+ layout: "grid",
631
+ element_attributes: {
632
+ class: "cards"
633
+ }
634
+ }, layout_options_, {
607
635
  get children() {
608
- return $5vyXB$solidjsweb.ssr($b8e79813f4f7ebe4$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($fc23d7668ae0011d$export$a2cc176055f8f08()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $5vyXB$solidjsweb.mergeProps({
609
- get rows() {
610
- return rows_object_();
636
+ return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
637
+ get fallback() {
638
+ return $0caf87eaa19079da$export$f33414a4df0afd3f({
639
+ num_placeholders_: num_placeholders_,
640
+ product_card_template_: product_card_template_
641
+ });
611
642
  },
612
- layout: "grid",
613
- element_attributes: {
614
- class: "cards"
615
- }
616
- }, layout_options_, {
617
643
  get children() {
618
- return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
619
- get fallback() {
620
- return $0caf87eaa19079da$export$f33414a4df0afd3f({
621
- num_placeholders_: num_placeholders_,
622
- product_card_template_: product_card_template_
623
- });
624
- },
625
- get children() {
626
- return (() => {
627
- // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
628
- const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => recommendations_resource_() || []));
629
- return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
630
- displays_by_key_: displays_by_key_,
631
- merchant_: merchant_,
632
- market_: market_,
633
- product_card_template_: product_card_template_
634
- });
635
- })();
636
- }
637
- });
644
+ return (() => {
645
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
646
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => recommendations_resource_() || []));
647
+ return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
648
+ displays_by_key_: displays_by_key_,
649
+ merchant_: merchant_,
650
+ market_: market_,
651
+ product_card_template_: product_card_template_
652
+ });
653
+ })();
638
654
  }
639
- }))));
655
+ });
640
656
  }
657
+ }))));
658
+ return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
659
+ get when() {
660
+ return is_showing_something();
661
+ },
662
+ children: elements
641
663
  });
642
664
  }
643
665
  const $1f8dbf7e28b3eff2$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
@@ -2636,8 +2658,8 @@ function $70482f04605572e2$var$modify_only_local_filter(local_filter_object, sel
2636
2658
  }
2637
2659
  return modified_filter_object;
2638
2660
  }
2639
- async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2640
- const body = await (0, $5vyXB$depictaiutilishared.observer).wait_for_element("body");
2661
+ async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts, parent) {
2662
+ const body = parent || (await (0, $5vyXB$depictaiutilishared.observer).wait_for_element("body"));
2641
2663
  let dispose_and_remove;
2642
2664
  const open_modal_ = (extra_options_for_modal = {}, on_dispose) => {
2643
2665
  if (dispose_and_remove)
@@ -3436,7 +3458,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
3436
3458
  const [get_extra_displays, set_extra_displays_] = $5vyXB$solidjs.createSignal([], {
3437
3459
  equals: false
3438
3460
  });
3439
- const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => [...plp_results_().displays, ...get_extra_displays()]));
3461
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => [...(plp_results_()?.displays || []), ...get_extra_displays()]));
3440
3462
  const percentage_in_view_ = $4117463e2939f5f4$export$63dd0350f8559dda({
3441
3463
  get_last_result_in_viewport_: get_last_result_in_viewport_,
3442
3464
  displays_by_key_: displays_by_key_,
@@ -3549,18 +3571,18 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
3549
3571
  layout_options_: layout_options_,
3550
3572
  sort_or_filter_open_: sort_or_filter_open_
3551
3573
  });
3552
- $5vyXB$solidjs.createComputed(() => {
3553
- if (!is_loading_()) return;
3554
- set_should_have_placeholders_rendered(true);
3555
- set_suspense_is_blocked(false);
3556
- is_just_after_plp_results_update = true;
3557
- });
3558
3574
  const block_suspense_if_needed = () => {
3559
3575
  if (!is_just_after_plp_results_update) return;
3560
3576
  is_just_after_plp_results_update = false;
3561
3577
  fallback_is_alive = false;
3562
3578
  set_suspense_is_blocked(true);
3563
3579
  };
3580
+ $5vyXB$solidjs.createComputed(() => {
3581
+ if (!is_loading_()) return;
3582
+ set_should_have_placeholders_rendered(true);
3583
+ set_suspense_is_blocked(false);
3584
+ is_just_after_plp_results_update = true;
3585
+ });
3564
3586
  $5vyXB$solidjs.createEffect($5vyXB$solidjs.on(plp_results_, () => {
3565
3587
  if (!fallback_is_alive) {
3566
3588
  // if all product card rendering functions after the initial rendering are synchronous the suspense boundary will never go into the fallback, so we don't know when they have finished rendering, and we can't block the suspense. Therefore, we're just doing it with this effect
@@ -3570,6 +3592,48 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
3570
3592
  }, {
3571
3593
  defer: true
3572
3594
  }));
3595
+ /*
3596
+ This suspense ensures that if someone has async templates, we still show placeholders until the product cards actually have finished rendering (automagically since they're createResource's)
3597
+ We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
3598
+ (For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
3599
+ We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
3600
+ */
3601
+ const product_cards_when_data = $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
3602
+ get fallback() {
3603
+ return (() => {
3604
+ fallback_is_alive = true;
3605
+ $5vyXB$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
3606
+ return $5vyXB$solidjs.createMemo(() => {
3607
+ // We need to be able to block the suspense since when async product cards are *rendering* we want to show the placeholders on initial load but not when loading more
3608
+ // In future we could have individual suspense's for each product card, but that's too much for now
3609
+ if (get_suspense_is_blocked()) return suspense_contents;
3610
+ set_should_have_placeholders_rendered(true); // just in case
3611
+ $5vyXB$solidjs.onCleanup(() => set_should_have_placeholders_rendered(false));
3612
+ return rendered_placeholders; // I lifted the placeholders into the memo since we don't want to re-render them when switching from <Show> to <Suspense>
3613
+ });
3614
+ })();
3615
+ },
3616
+
3617
+ get children() {
3618
+ return (() => {
3619
+ suspense_contents = $ac167f6af6a48fc3$export$a1fd619a4743ca08({
3620
+ product_card_template_: product_card_template_,
3621
+ plp_results_: plp_results_,
3622
+ last_result_in_viewport_: last_result_in_viewport_,
3623
+ first_result_in_viewport_: first_result_in_viewport_,
3624
+ market_: market_,
3625
+ merchant_: merchant_,
3626
+ all_products_loaded_: all_products_loaded_,
3627
+ min_products_to_fetch_: min_products_to_fetch_,
3628
+ query_base_: query_base_,
3629
+ depict_api_: depict_api_,
3630
+ is_loading_: is_loading_
3631
+ });
3632
+ $5vyXB$solidjs.onCleanup(() => suspense_contents = undefined);
3633
+ return suspense_contents;
3634
+ })();
3635
+ }
3636
+ });
3573
3637
  return [$fc23d7668ae0011d$export$a2cc176055f8f08(), $5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), {
3574
3638
  get cols_at_size() {
3575
3639
  return modified_cols_at_size();
@@ -3593,44 +3657,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
3593
3657
  get fallback() {
3594
3658
  return rendered_placeholders();
3595
3659
  },
3596
- get children() {
3597
- return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
3598
- get fallback() {
3599
- return (() => {
3600
- fallback_is_alive = true;
3601
- $5vyXB$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
3602
- return $5vyXB$solidjs.createMemo(() => {
3603
- // We need to be able to block the suspense since when async product cards are *rendering* we want to show the placeholders on initial load but not when loading more
3604
- // In future we could have individual suspense's for each product card, but that's too much for now
3605
- if (get_suspense_is_blocked()) return suspense_contents;
3606
- set_should_have_placeholders_rendered(true); // just in case
3607
- $5vyXB$solidjs.onCleanup(() => set_should_have_placeholders_rendered(false));
3608
- return rendered_placeholders; // I lifted the placeholders into the memo since we don't want to re-render them when switching from <Show> to <Suspense>
3609
- });
3610
- })();
3611
- },
3612
-
3613
- get children() {
3614
- return (() => {
3615
- suspense_contents = $ac167f6af6a48fc3$export$a1fd619a4743ca08({
3616
- product_card_template_: product_card_template_,
3617
- plp_results_: plp_results_,
3618
- last_result_in_viewport_: last_result_in_viewport_,
3619
- first_result_in_viewport_: first_result_in_viewport_,
3620
- market_: market_,
3621
- merchant_: merchant_,
3622
- all_products_loaded_: all_products_loaded_,
3623
- min_products_to_fetch_: min_products_to_fetch_,
3624
- query_base_: query_base_,
3625
- depict_api_: depict_api_,
3626
- is_loading_: is_loading_
3627
- });
3628
- $5vyXB$solidjs.onCleanup(() => suspense_contents = undefined);
3629
- return suspense_contents;
3630
- })();
3631
- }
3632
- });
3633
- }
3660
+ children: product_cards_when_data
3634
3661
  });
3635
3662
  }
3636
3663
  })];
@@ -6077,49 +6104,50 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
6077
6104
  product_card_template_: product_card_template_,
6078
6105
  showing_recommendation_rows_: showing_recommendation_rows_,
6079
6106
  view_more_button_ = true,
6080
- layout_options_: layout_options_
6107
+ layout_options_: layout_options_,
6108
+ all_products_loaded_: all_products_loaded_
6081
6109
  }) {
6082
6110
  const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
6083
6111
  const rows_object = view_more_button_ ? $fb29c6201c369e39$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
6084
6112
  const [recommendations_resource] = $5vyXB$solidjs.createResource(search_query_base_, query => depict_api_.get_recommended(query).then(r => r.displays));
6085
6113
  const is_showing_something = $5vyXB$solidjs.createMemo(() => recommendations_resource.loading || recommendations_resource()?.length);
6086
6114
  const num_placeholders_ = $5vyXB$solidjs.createMemo(() => (0, $aec24316ed262dc0$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(([per_column]) => per_column)));
6087
- return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
6088
- get when() {
6089
- return is_showing_something();
6090
- },
6115
+ // Don't tear down elements every time one updates the page - don't put them within <Show>
6116
+ const elements = $5vyXB$solidjsweb.ssr($fb29c6201c369e39$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(i18n_.search_recs_title_()), $5vyXB$solidjsweb.escape($fc23d7668ae0011d$export$a2cc176055f8f08()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $5vyXB$solidjsweb.mergeProps({
6117
+ rows: rows_object,
6118
+ layout: "grid",
6119
+ element_attributes: {
6120
+ class: "cards"
6121
+ }
6122
+ }, layout_options_, {
6091
6123
  get children() {
6092
- return $5vyXB$solidjsweb.ssr($fb29c6201c369e39$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape(i18n_.search_recs_title_()), $5vyXB$solidjsweb.escape($fc23d7668ae0011d$export$a2cc176055f8f08()), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $5vyXB$solidjsweb.mergeProps({
6093
- rows: rows_object,
6094
- layout: "grid",
6095
- element_attributes: {
6096
- class: "cards"
6097
- }
6098
- }, layout_options_, {
6099
- get children() {
6100
- return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
6101
- get fallback() {
6102
- return $0caf87eaa19079da$export$f33414a4df0afd3f({
6103
- num_placeholders_: num_placeholders_,
6104
- product_card_template_: product_card_template_
6105
- });
6106
- },
6107
- get children() {
6108
- return (() => {
6109
- // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
6110
- const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => recommendations_resource() || []));
6111
- return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
6112
- displays_by_key_: displays_by_key_,
6113
- merchant_: $5vyXB$solidjs.createMemo(() => search_query_base_().tenant),
6114
- market_: $5vyXB$solidjs.createMemo(() => search_query_base_().market),
6115
- product_card_template_: product_card_template_
6116
- });
6117
- })();
6118
- }
6124
+ return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Suspense), {
6125
+ get fallback() {
6126
+ return $0caf87eaa19079da$export$f33414a4df0afd3f({
6127
+ num_placeholders_: num_placeholders_,
6128
+ product_card_template_: product_card_template_
6119
6129
  });
6130
+ },
6131
+ get children() {
6132
+ return (() => {
6133
+ // IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
6134
+ const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($5vyXB$solidjs.createMemo(() => recommendations_resource() || []));
6135
+ return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
6136
+ displays_by_key_: displays_by_key_,
6137
+ merchant_: $5vyXB$solidjs.createMemo(() => search_query_base_().tenant),
6138
+ market_: $5vyXB$solidjs.createMemo(() => search_query_base_().market),
6139
+ product_card_template_: product_card_template_
6140
+ });
6141
+ })();
6120
6142
  }
6121
- }))));
6143
+ });
6122
6144
  }
6145
+ }))));
6146
+ return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
6147
+ get when() {
6148
+ return is_showing_something() && all_products_loaded_();
6149
+ },
6150
+ children: elements
6123
6151
  });
6124
6152
  }
6125
6153
  function $fb29c6201c369e39$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
@@ -8108,9 +8136,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
8108
8136
  });
8109
8137
  }
8110
8138
  })), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
8111
- get when() {
8112
- return get_all_products_loaded() && !disable_search_recommendations_;
8113
- },
8139
+ when: !disable_search_recommendations_,
8114
8140
  keyed: false,
8115
8141
  get children() {
8116
8142
  return $5vyXB$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
@@ -8126,7 +8152,8 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
8126
8152
  },
8127
8153
  showing_recommendation_rows_: showing_recommendation_rows_,
8128
8154
  view_more_button_: search_recs_view_more_,
8129
- product_card_template_: product_card_template_
8155
+ product_card_template_: product_card_template_,
8156
+ all_products_loaded_: get_all_products_loaded
8130
8157
  });
8131
8158
  }
8132
8159
  });
@@ -8231,6 +8258,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
8231
8258
  disable_scrolling_during_modal = true,
8232
8259
  bottom_distance_under_modal: bottom_distance_under_modal,
8233
8260
  render_instant_card: render_instant_card,
8261
+ override_modal_element: override_modal_element,
8234
8262
  ...props_on_class
8235
8263
  }) {
8236
8264
  const owner = $5vyXB$solidjs.getOwner() || $5vyXB$solidjs.createRoot(() => $5vyXB$solidjs.getOwner()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
@@ -8353,7 +8381,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
8353
8381
  enable_category_suggestions_: enable_category_suggestions,
8354
8382
  disable_scrolling_: disable_scrolling_during_modal,
8355
8383
  bottom_distance_under_modal_: bottom_distance_under_modal
8356
- });
8384
+ }, override_modal_element);
8357
8385
  // This will add some default behaviour to open_modal_ if no style_props_ are supplied
8358
8386
  // The default behaviour is to align the modal with the input field if possible
8359
8387
  const modal_opening_effect = () => {
@@ -7,7 +7,7 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "2.0.8";
10
+ export const version = "2.0.10";
11
11
  /**
12
12
  * Returns accessor with the size of the provided element, including padding and border (I think)
13
13
  */
@@ -435,6 +435,7 @@ export type PageURLCreator<InputDisplay extends ModernDisplay, OutputDisplay ext
435
435
  * So the idea is to have a modal. It should either be rendered and exist, in which case it is in the foreground and open, or it's completely gone. This makes things easier.
436
436
  * @param search_modal a function which returns an array of nodes that get appended into <body>. This function will run in its own solid-js root which will call onCleanup and cleanup all reactive things inside it when the modal is closed. This function will get the arguments passed to open_modal_ and the modal_fn_opts merged together, along with register_closing_animation_ where an async function that resolves once the animation is finished can be provided to animate the closing of the modal
437
437
  * @param modal_fn_opts static options for the modal that won't change on a per-opening basis
438
+ * @param parent override the parent element to append the modal to. Defaults to <body>
438
439
  @returns a function to open and close the modal. When calling the open_modal_ function additional parameters can be passed to the modal
439
440
  */
440
441
  export function general_modal_abstraction<StaticOptions extends {
@@ -445,7 +446,7 @@ export function general_modal_abstraction<StaticOptions extends {
445
446
  close_modal_: VoidFunction;
446
447
  open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
447
448
  register_closing_animation_: (animation: () => Promise<any>) => void;
448
- }) => Node_Array, modal_fn_opts: StaticOptions): Promise<{
449
+ }) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
449
450
  open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
450
451
  close_modal_: () => void;
451
452
  }>;
@@ -753,6 +754,7 @@ type GeneralConstructorOptions<InputDisplay extends Display, OutputDisplay exten
753
754
  disable_scrolling_during_modal?: boolean;
754
755
  bottom_distance_under_modal?: Accessor<number | undefined>;
755
756
  render_instant_card?: InstantCard<OutputDisplay extends ModernDisplay ? OutputDisplay : InputDisplay>;
757
+ override_modal_element?: HTMLElement | ShadowRoot;
756
758
  };
757
759
  type ConstructorOptionsWithApi<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = GeneralConstructorOptions<InputDisplay, OutputDisplay> & {
758
760
  api: DepictAPI<InputDisplay, OutputDisplay>;
@@ -786,6 +788,7 @@ export class DepictSearch<InputDisplay extends Display, OutputDisplay extends Mo
786
788
  disable_scrolling_during_modal,
787
789
  bottom_distance_under_modal,
788
790
  render_instant_card,
791
+ override_modal_element,
789
792
  ...props_on_class
790
793
  }: ConstructorOptions<InputDisplay, OutputDisplay>);
791
794
  get enable_content_search(): boolean | undefined;