@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.
- package/ES10/index.cjs +190 -154
- package/ES10/index.d.ts +5 -2
- package/ES10/index.js +192 -156
- package/latest/index.cjs +186 -154
- package/latest/index.d.ts +5 -2
- package/latest/index.js +188 -156
- package/package.json +2 -2
- package/server/ES10/index.cjs +167 -135
- package/server/ES10/index.d.ts +5 -2
- package/server/ES10/index.js +169 -137
- package/server/latest/index.cjs +163 -135
- package/server/latest/index.d.ts +5 -2
- package/server/latest/index.js +165 -137
package/server/ES10/index.cjs
CHANGED
|
@@ -67,7 +67,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
67
67
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
68
68
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
69
69
|
/*! Depict.ai search and product listing SDK */
|
|
70
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.
|
|
70
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.10";
|
|
71
71
|
|
|
72
72
|
/** @jsxImportSource solid-js */
|
|
73
73
|
|
|
@@ -255,6 +255,7 @@ function $76012c4468a53d1f$export$7f8bd308237ab5a5(get_displays_) {
|
|
|
255
255
|
});
|
|
256
256
|
return displays_by_key_;
|
|
257
257
|
}
|
|
258
|
+
const $76012c4468a53d1f$var$result_ids = ["search_result_id", "product_listing_result_id", "recommendation_id"];
|
|
258
259
|
function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
259
260
|
let {
|
|
260
261
|
displays_by_key_: displays_by_key_,
|
|
@@ -269,17 +270,25 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
269
270
|
},
|
|
270
271
|
children: (product_id, index) => {
|
|
271
272
|
const owner = $3hooq$solidjs.getOwner();
|
|
272
|
-
const display_accessor = $3hooq$solidjs.createMemo(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
const display_accessor = $3hooq$solidjs.createMemo(prev => {
|
|
274
|
+
const new_display = displays_by_key_().get(product_id);
|
|
275
|
+
if (prev && $76012c4468a53d1f$var$deep_equal(prev, new_display))
|
|
276
|
+
// 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.
|
|
277
|
+
// This doesn't work if people mutate the displays from within the template but we hope they don't
|
|
278
|
+
// (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)
|
|
279
|
+
return prev;
|
|
280
|
+
return new_display;
|
|
281
|
+
});
|
|
282
|
+
const [product_card_resource] = $3hooq$solidjs.createResource(() => [merchant_(), market_(), display_accessor()],
|
|
283
|
+
// re-render when the reference to the display object changes or the merchant or market changes
|
|
284
|
+
// (We don't want to re-render if nothing has changed)
|
|
285
|
+
_ref2 => {
|
|
286
|
+
let [merchant, market, display] = _ref2;
|
|
277
287
|
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
278
288
|
return product_card_template_(display, {
|
|
279
289
|
set_on_index_change: fn => $3hooq$solidjs.runWithOwner(owner, () => $3hooq$solidjs.createEffect(() => fn(index()))),
|
|
280
|
-
merchant:
|
|
281
|
-
|
|
282
|
-
market: $3hooq$solidjs.untrack(market_) // recommendation_grid can provide a sneaky undefined here just FYI
|
|
290
|
+
merchant: merchant,
|
|
291
|
+
market: market // recommendation_grid can provide a sneaky undefined here just FYI
|
|
283
292
|
});
|
|
284
293
|
});
|
|
285
294
|
|
|
@@ -294,15 +303,13 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
294
303
|
elements.push(element);
|
|
295
304
|
// Add tracking ids
|
|
296
305
|
if (!(element instanceof HTMLElement)) continue; // Apparently only HTMLElements have dataset
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
} = display;
|
|
305
|
-
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;
|
|
306
|
+
for (let i = 0; i < $76012c4468a53d1f$var$result_ids.length; i++) {
|
|
307
|
+
const id = $76012c4468a53d1f$var$result_ids[i];
|
|
308
|
+
const value = display[id];
|
|
309
|
+
if (value) Object.assign(element.dataset, $3hooq$depictaiutilishared.camelCasifyObject({
|
|
310
|
+
[id]: value
|
|
311
|
+
}));
|
|
312
|
+
}
|
|
306
313
|
}
|
|
307
314
|
do_per_elements_ === null || do_per_elements_ === void 0 || do_per_elements_(elements, index);
|
|
308
315
|
});
|
|
@@ -310,6 +317,23 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
310
317
|
}
|
|
311
318
|
});
|
|
312
319
|
}
|
|
320
|
+
// Source: https://dmitripavlutin.com/how-to-compare-objects-in-javascript/
|
|
321
|
+
function $76012c4468a53d1f$var$deep_equal(object1, object2) {
|
|
322
|
+
const keys1 = Object.keys(object1);
|
|
323
|
+
const keys2 = Object.keys(object2);
|
|
324
|
+
if (keys1.length !== keys2.length) return false;
|
|
325
|
+
for (const key of keys1) {
|
|
326
|
+
if ($76012c4468a53d1f$var$result_ids.includes(key)) continue; // ignore result ids that change per response
|
|
327
|
+
const val1 = object1[key];
|
|
328
|
+
const val2 = object2[key];
|
|
329
|
+
const areObjects = $76012c4468a53d1f$var$is_object(val1) && $76012c4468a53d1f$var$is_object(val2);
|
|
330
|
+
if (areObjects && !$76012c4468a53d1f$var$deep_equal(val1, val2) || !areObjects && val1 !== val2) return false;
|
|
331
|
+
}
|
|
332
|
+
return true;
|
|
333
|
+
}
|
|
334
|
+
function $76012c4468a53d1f$var$is_object(object) {
|
|
335
|
+
return object != null && typeof object === "object";
|
|
336
|
+
}
|
|
313
337
|
|
|
314
338
|
// Errors caused by SDK consuming code interfacing with the SDK, not the SDK itself or other Depict packages
|
|
315
339
|
class $95e4006e1dcb5b72$export$e1d52e4f0c7557a1 extends Error {}
|
|
@@ -638,44 +662,43 @@ function $2c920813c92d6987$export$7da560f849543dff(_ref) {
|
|
|
638
662
|
return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
|
|
639
663
|
});
|
|
640
664
|
const num_placeholders_ = () => 20;
|
|
641
|
-
|
|
642
|
-
get
|
|
643
|
-
return
|
|
665
|
+
const elements = $3hooq$solidjsweb.ssr($2c920813c92d6987$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($8edd3cf30d1fd8b4$export$a2cc176055f8f08()), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), $3hooq$solidjsweb.mergeProps({
|
|
666
|
+
get rows() {
|
|
667
|
+
return rows_object_();
|
|
644
668
|
},
|
|
669
|
+
layout: "grid",
|
|
670
|
+
element_attributes: {
|
|
671
|
+
class: "cards"
|
|
672
|
+
}
|
|
673
|
+
}, layout_options_, {
|
|
645
674
|
get children() {
|
|
646
|
-
return $3hooq$solidjsweb.
|
|
647
|
-
get
|
|
648
|
-
return
|
|
675
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
|
|
676
|
+
get fallback() {
|
|
677
|
+
return $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
678
|
+
num_placeholders_: num_placeholders_,
|
|
679
|
+
product_card_template_: product_card_template_
|
|
680
|
+
});
|
|
649
681
|
},
|
|
650
|
-
layout: "grid",
|
|
651
|
-
element_attributes: {
|
|
652
|
-
class: "cards"
|
|
653
|
-
}
|
|
654
|
-
}, layout_options_, {
|
|
655
682
|
get children() {
|
|
656
|
-
return
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
667
|
-
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
668
|
-
displays_by_key_: displays_by_key_,
|
|
669
|
-
merchant_: merchant_,
|
|
670
|
-
market_: market_,
|
|
671
|
-
product_card_template_: product_card_template_
|
|
672
|
-
});
|
|
673
|
-
})();
|
|
674
|
-
}
|
|
675
|
-
});
|
|
683
|
+
return (() => {
|
|
684
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
685
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
686
|
+
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
687
|
+
displays_by_key_: displays_by_key_,
|
|
688
|
+
merchant_: merchant_,
|
|
689
|
+
market_: market_,
|
|
690
|
+
product_card_template_: product_card_template_
|
|
691
|
+
});
|
|
692
|
+
})();
|
|
676
693
|
}
|
|
677
|
-
})
|
|
694
|
+
});
|
|
678
695
|
}
|
|
696
|
+
}))));
|
|
697
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
698
|
+
get when() {
|
|
699
|
+
return is_showing_something();
|
|
700
|
+
},
|
|
701
|
+
children: elements
|
|
679
702
|
});
|
|
680
703
|
}
|
|
681
704
|
const $41227f10ad680afd$var$_tmpl$ = ["<button", ' class="show-more major" type="button">', "</button>"],
|
|
@@ -2835,8 +2858,8 @@ function $a162c9a08dc208c2$var$modify_only_local_filter(local_filter_object, sel
|
|
|
2835
2858
|
}
|
|
2836
2859
|
return modified_filter_object;
|
|
2837
2860
|
}
|
|
2838
|
-
async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
2839
|
-
const body = await (0, $3hooq$depictaiutilishared.observer).wait_for_element("body");
|
|
2861
|
+
async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_opts, parent) {
|
|
2862
|
+
const body = parent || (await (0, $3hooq$depictaiutilishared.observer).wait_for_element("body"));
|
|
2840
2863
|
let dispose_and_remove;
|
|
2841
2864
|
const open_modal_ = function () {
|
|
2842
2865
|
let extra_options_for_modal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -3719,7 +3742,10 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
3719
3742
|
const [get_extra_displays, set_extra_displays_] = $3hooq$solidjs.createSignal([], {
|
|
3720
3743
|
equals: false
|
|
3721
3744
|
});
|
|
3722
|
-
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() =>
|
|
3745
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => {
|
|
3746
|
+
var _plp_results_;
|
|
3747
|
+
return [...(((_plp_results_ = plp_results_()) === null || _plp_results_ === void 0 ? void 0 : _plp_results_.displays) || []), ...get_extra_displays()];
|
|
3748
|
+
}));
|
|
3723
3749
|
const percentage_in_view_ = $45c16e404a883f74$export$63dd0350f8559dda({
|
|
3724
3750
|
get_last_result_in_viewport_: get_last_result_in_viewport_,
|
|
3725
3751
|
displays_by_key_: displays_by_key_,
|
|
@@ -3839,18 +3865,18 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
3839
3865
|
layout_options_: layout_options_,
|
|
3840
3866
|
sort_or_filter_open_: sort_or_filter_open_
|
|
3841
3867
|
});
|
|
3842
|
-
$3hooq$solidjs.createComputed(() => {
|
|
3843
|
-
if (!is_loading_()) return;
|
|
3844
|
-
set_should_have_placeholders_rendered(true);
|
|
3845
|
-
set_suspense_is_blocked(false);
|
|
3846
|
-
is_just_after_plp_results_update = true;
|
|
3847
|
-
});
|
|
3848
3868
|
const block_suspense_if_needed = () => {
|
|
3849
3869
|
if (!is_just_after_plp_results_update) return;
|
|
3850
3870
|
is_just_after_plp_results_update = false;
|
|
3851
3871
|
fallback_is_alive = false;
|
|
3852
3872
|
set_suspense_is_blocked(true);
|
|
3853
3873
|
};
|
|
3874
|
+
$3hooq$solidjs.createComputed(() => {
|
|
3875
|
+
if (!is_loading_()) return;
|
|
3876
|
+
set_should_have_placeholders_rendered(true);
|
|
3877
|
+
set_suspense_is_blocked(false);
|
|
3878
|
+
is_just_after_plp_results_update = true;
|
|
3879
|
+
});
|
|
3854
3880
|
$3hooq$solidjs.createEffect($3hooq$solidjs.on(plp_results_, () => {
|
|
3855
3881
|
if (!fallback_is_alive) {
|
|
3856
3882
|
// 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
|
|
@@ -3860,6 +3886,48 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
3860
3886
|
}, {
|
|
3861
3887
|
defer: true
|
|
3862
3888
|
}));
|
|
3889
|
+
/*
|
|
3890
|
+
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)
|
|
3891
|
+
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
3892
|
+
(For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
|
|
3893
|
+
We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
|
|
3894
|
+
*/
|
|
3895
|
+
const product_cards_when_data = $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
|
|
3896
|
+
get fallback() {
|
|
3897
|
+
return (() => {
|
|
3898
|
+
fallback_is_alive = true;
|
|
3899
|
+
$3hooq$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
3900
|
+
return $3hooq$solidjs.createMemo(() => {
|
|
3901
|
+
// 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
|
|
3902
|
+
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
3903
|
+
if (get_suspense_is_blocked()) return suspense_contents;
|
|
3904
|
+
set_should_have_placeholders_rendered(true); // just in case
|
|
3905
|
+
$3hooq$solidjs.onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
3906
|
+
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>
|
|
3907
|
+
});
|
|
3908
|
+
})();
|
|
3909
|
+
},
|
|
3910
|
+
|
|
3911
|
+
get children() {
|
|
3912
|
+
return (() => {
|
|
3913
|
+
suspense_contents = $0d3ee7000f047e67$export$a1fd619a4743ca08({
|
|
3914
|
+
product_card_template_: product_card_template_,
|
|
3915
|
+
plp_results_: plp_results_,
|
|
3916
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
3917
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
3918
|
+
market_: market_,
|
|
3919
|
+
merchant_: merchant_,
|
|
3920
|
+
all_products_loaded_: all_products_loaded_,
|
|
3921
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
3922
|
+
query_base_: query_base_,
|
|
3923
|
+
depict_api_: depict_api_,
|
|
3924
|
+
is_loading_: is_loading_
|
|
3925
|
+
});
|
|
3926
|
+
$3hooq$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
3927
|
+
return suspense_contents;
|
|
3928
|
+
})();
|
|
3929
|
+
}
|
|
3930
|
+
});
|
|
3863
3931
|
return [$8edd3cf30d1fd8b4$export$a2cc176055f8f08(), $3hooq$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
|
|
3864
3932
|
get cols_at_size() {
|
|
3865
3933
|
return modified_cols_at_size();
|
|
@@ -3883,44 +3951,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
3883
3951
|
get fallback() {
|
|
3884
3952
|
return rendered_placeholders();
|
|
3885
3953
|
},
|
|
3886
|
-
|
|
3887
|
-
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
|
|
3888
|
-
get fallback() {
|
|
3889
|
-
return (() => {
|
|
3890
|
-
fallback_is_alive = true;
|
|
3891
|
-
$3hooq$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
3892
|
-
return $3hooq$solidjs.createMemo(() => {
|
|
3893
|
-
// 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
|
|
3894
|
-
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
3895
|
-
if (get_suspense_is_blocked()) return suspense_contents;
|
|
3896
|
-
set_should_have_placeholders_rendered(true); // just in case
|
|
3897
|
-
$3hooq$solidjs.onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
3898
|
-
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>
|
|
3899
|
-
});
|
|
3900
|
-
})();
|
|
3901
|
-
},
|
|
3902
|
-
|
|
3903
|
-
get children() {
|
|
3904
|
-
return (() => {
|
|
3905
|
-
suspense_contents = $0d3ee7000f047e67$export$a1fd619a4743ca08({
|
|
3906
|
-
product_card_template_: product_card_template_,
|
|
3907
|
-
plp_results_: plp_results_,
|
|
3908
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
3909
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
3910
|
-
market_: market_,
|
|
3911
|
-
merchant_: merchant_,
|
|
3912
|
-
all_products_loaded_: all_products_loaded_,
|
|
3913
|
-
min_products_to_fetch_: min_products_to_fetch_,
|
|
3914
|
-
query_base_: query_base_,
|
|
3915
|
-
depict_api_: depict_api_,
|
|
3916
|
-
is_loading_: is_loading_
|
|
3917
|
-
});
|
|
3918
|
-
$3hooq$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
3919
|
-
return suspense_contents;
|
|
3920
|
-
})();
|
|
3921
|
-
}
|
|
3922
|
-
});
|
|
3923
|
-
}
|
|
3954
|
+
children: product_cards_when_data
|
|
3924
3955
|
});
|
|
3925
3956
|
}
|
|
3926
3957
|
})];
|
|
@@ -6610,7 +6641,8 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
6610
6641
|
product_card_template_: product_card_template_,
|
|
6611
6642
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
6612
6643
|
view_more_button_ = true,
|
|
6613
|
-
layout_options_: layout_options_
|
|
6644
|
+
layout_options_: layout_options_,
|
|
6645
|
+
all_products_loaded_: all_products_loaded_
|
|
6614
6646
|
} = _ref;
|
|
6615
6647
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
6616
6648
|
const rows_object = view_more_button_ ? $c77adcdf5346b187$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
@@ -6623,42 +6655,42 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
6623
6655
|
let [per_column] = _ref2;
|
|
6624
6656
|
return per_column;
|
|
6625
6657
|
})));
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6658
|
+
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
6659
|
+
const elements = $3hooq$solidjsweb.ssr($c77adcdf5346b187$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(i18n_.search_recs_title_()), $3hooq$solidjsweb.escape($8edd3cf30d1fd8b4$export$a2cc176055f8f08()), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), $3hooq$solidjsweb.mergeProps({
|
|
6660
|
+
rows: rows_object,
|
|
6661
|
+
layout: "grid",
|
|
6662
|
+
element_attributes: {
|
|
6663
|
+
class: "cards"
|
|
6664
|
+
}
|
|
6665
|
+
}, layout_options_, {
|
|
6630
6666
|
get children() {
|
|
6631
|
-
return $3hooq$solidjsweb.
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
}
|
|
6637
|
-
}, layout_options_, {
|
|
6638
|
-
get children() {
|
|
6639
|
-
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
|
|
6640
|
-
get fallback() {
|
|
6641
|
-
return $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
6642
|
-
num_placeholders_: num_placeholders_,
|
|
6643
|
-
product_card_template_: product_card_template_
|
|
6644
|
-
});
|
|
6645
|
-
},
|
|
6646
|
-
get children() {
|
|
6647
|
-
return (() => {
|
|
6648
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
6649
|
-
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource() || []));
|
|
6650
|
-
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
6651
|
-
displays_by_key_: displays_by_key_,
|
|
6652
|
-
merchant_: $3hooq$solidjs.createMemo(() => search_query_base_().tenant),
|
|
6653
|
-
market_: $3hooq$solidjs.createMemo(() => search_query_base_().market),
|
|
6654
|
-
product_card_template_: product_card_template_
|
|
6655
|
-
});
|
|
6656
|
-
})();
|
|
6657
|
-
}
|
|
6667
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Suspense), {
|
|
6668
|
+
get fallback() {
|
|
6669
|
+
return $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
6670
|
+
num_placeholders_: num_placeholders_,
|
|
6671
|
+
product_card_template_: product_card_template_
|
|
6658
6672
|
});
|
|
6673
|
+
},
|
|
6674
|
+
get children() {
|
|
6675
|
+
return (() => {
|
|
6676
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
6677
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($3hooq$solidjs.createMemo(() => recommendations_resource() || []));
|
|
6678
|
+
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
6679
|
+
displays_by_key_: displays_by_key_,
|
|
6680
|
+
merchant_: $3hooq$solidjs.createMemo(() => search_query_base_().tenant),
|
|
6681
|
+
market_: $3hooq$solidjs.createMemo(() => search_query_base_().market),
|
|
6682
|
+
product_card_template_: product_card_template_
|
|
6683
|
+
});
|
|
6684
|
+
})();
|
|
6659
6685
|
}
|
|
6660
|
-
})
|
|
6686
|
+
});
|
|
6661
6687
|
}
|
|
6688
|
+
}))));
|
|
6689
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
6690
|
+
get when() {
|
|
6691
|
+
return is_showing_something() && all_products_loaded_();
|
|
6692
|
+
},
|
|
6693
|
+
children: elements
|
|
6662
6694
|
});
|
|
6663
6695
|
}
|
|
6664
6696
|
function $c77adcdf5346b187$var$make_state_saved_rows(_ref3, i18n_) {
|
|
@@ -8780,9 +8812,7 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
8780
8812
|
});
|
|
8781
8813
|
}
|
|
8782
8814
|
})), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
8783
|
-
|
|
8784
|
-
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
8785
|
-
},
|
|
8815
|
+
when: !disable_search_recommendations_,
|
|
8786
8816
|
keyed: false,
|
|
8787
8817
|
get children() {
|
|
8788
8818
|
return $3hooq$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
|
|
@@ -8801,7 +8831,8 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
8801
8831
|
},
|
|
8802
8832
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8803
8833
|
view_more_button_: search_recs_view_more_,
|
|
8804
|
-
product_card_template_: product_card_template_
|
|
8834
|
+
product_card_template_: product_card_template_,
|
|
8835
|
+
all_products_loaded_: get_all_products_loaded
|
|
8805
8836
|
});
|
|
8806
8837
|
}
|
|
8807
8838
|
});
|
|
@@ -8946,6 +8977,7 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
|
|
|
8946
8977
|
disable_scrolling_during_modal = true,
|
|
8947
8978
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
8948
8979
|
render_instant_card: render_instant_card,
|
|
8980
|
+
override_modal_element: override_modal_element,
|
|
8949
8981
|
...props_on_class
|
|
8950
8982
|
} = _ref;
|
|
8951
8983
|
$ddd39c5f36f49703$var$_classPrivateFieldInitSpec(this, $ddd39c5f36f49703$var$_locale_signal, {
|
|
@@ -9101,7 +9133,7 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
|
|
|
9101
9133
|
enable_category_suggestions_: enable_category_suggestions,
|
|
9102
9134
|
disable_scrolling_: disable_scrolling_during_modal,
|
|
9103
9135
|
bottom_distance_under_modal_: bottom_distance_under_modal
|
|
9104
|
-
});
|
|
9136
|
+
}, override_modal_element);
|
|
9105
9137
|
// This will add some default behaviour to open_modal_ if no style_props_ are supplied
|
|
9106
9138
|
// The default behaviour is to align the modal with the input field if possible
|
|
9107
9139
|
const modal_opening_effect = () => {
|
package/server/ES10/index.d.ts
CHANGED
|
@@ -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.
|
|
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;
|