@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/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 = $52FdA$solidjs.getOwner();
|
|
272
|
-
const display_accessor = $52FdA$solidjs.createMemo(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
273
|
+
const display_accessor = $52FdA$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] = $52FdA$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 => $52FdA$solidjs.runWithOwner(owner, () => $52FdA$solidjs.createEffect(() => fn(index()))),
|
|
280
|
-
merchant:
|
|
281
|
-
|
|
282
|
-
market: $52FdA$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, $52FdA$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 {}
|
|
@@ -701,51 +725,52 @@ function $2c920813c92d6987$export$7da560f849543dff(_ref) {
|
|
|
701
725
|
return recommendations_resource_.loading || ((_recommendations_reso = recommendations_resource_()) === null || _recommendations_reso === void 0 ? void 0 : _recommendations_reso.length);
|
|
702
726
|
});
|
|
703
727
|
const num_placeholders_ = () => 20;
|
|
728
|
+
const elements = (() => {
|
|
729
|
+
const _el$ = $52FdA$solidjsweb.getNextElement($2c920813c92d6987$var$_tmpl$),
|
|
730
|
+
_el$2 = _el$.firstChild,
|
|
731
|
+
[_el$3, _co$] = $52FdA$solidjsweb.getNextMarker(_el$2.nextSibling),
|
|
732
|
+
_el$4 = _el$3.nextSibling,
|
|
733
|
+
[_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
|
|
734
|
+
$52FdA$solidjsweb.insert(_el$, (0, $8edd3cf30d1fd8b4$export$a2cc176055f8f08), _el$3, _co$);
|
|
735
|
+
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), $52FdA$solidjsweb.mergeProps({
|
|
736
|
+
get rows() {
|
|
737
|
+
return rows_object_();
|
|
738
|
+
},
|
|
739
|
+
layout: "grid",
|
|
740
|
+
element_attributes: {
|
|
741
|
+
class: "cards"
|
|
742
|
+
}
|
|
743
|
+
}, layout_options_, {
|
|
744
|
+
get children() {
|
|
745
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
|
|
746
|
+
get fallback() {
|
|
747
|
+
return $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
748
|
+
num_placeholders_: num_placeholders_,
|
|
749
|
+
product_card_template_: product_card_template_
|
|
750
|
+
});
|
|
751
|
+
},
|
|
752
|
+
get children() {
|
|
753
|
+
return (() => {
|
|
754
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
755
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
756
|
+
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
757
|
+
displays_by_key_: displays_by_key_,
|
|
758
|
+
merchant_: merchant_,
|
|
759
|
+
market_: market_,
|
|
760
|
+
product_card_template_: product_card_template_
|
|
761
|
+
});
|
|
762
|
+
})();
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
})), _el$5, _co$2);
|
|
767
|
+
return _el$;
|
|
768
|
+
})();
|
|
704
769
|
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
705
770
|
get when() {
|
|
706
771
|
return is_showing_something();
|
|
707
772
|
},
|
|
708
|
-
|
|
709
|
-
const _el$ = $52FdA$solidjsweb.getNextElement($2c920813c92d6987$var$_tmpl$),
|
|
710
|
-
_el$2 = _el$.firstChild,
|
|
711
|
-
[_el$3, _co$] = $52FdA$solidjsweb.getNextMarker(_el$2.nextSibling),
|
|
712
|
-
_el$4 = _el$3.nextSibling,
|
|
713
|
-
[_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
|
|
714
|
-
$52FdA$solidjsweb.insert(_el$, (0, $8edd3cf30d1fd8b4$export$a2cc176055f8f08), _el$3, _co$);
|
|
715
|
-
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), $52FdA$solidjsweb.mergeProps({
|
|
716
|
-
get rows() {
|
|
717
|
-
return rows_object_();
|
|
718
|
-
},
|
|
719
|
-
layout: "grid",
|
|
720
|
-
element_attributes: {
|
|
721
|
-
class: "cards"
|
|
722
|
-
}
|
|
723
|
-
}, layout_options_, {
|
|
724
|
-
get children() {
|
|
725
|
-
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
|
|
726
|
-
get fallback() {
|
|
727
|
-
return $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
728
|
-
num_placeholders_: num_placeholders_,
|
|
729
|
-
product_card_template_: product_card_template_
|
|
730
|
-
});
|
|
731
|
-
},
|
|
732
|
-
get children() {
|
|
733
|
-
return (() => {
|
|
734
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
735
|
-
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
736
|
-
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
737
|
-
displays_by_key_: displays_by_key_,
|
|
738
|
-
merchant_: merchant_,
|
|
739
|
-
market_: market_,
|
|
740
|
-
product_card_template_: product_card_template_
|
|
741
|
-
});
|
|
742
|
-
})();
|
|
743
|
-
}
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
})), _el$5, _co$2);
|
|
747
|
-
return _el$;
|
|
748
|
-
}
|
|
773
|
+
children: elements
|
|
749
774
|
});
|
|
750
775
|
}
|
|
751
776
|
const $41227f10ad680afd$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class="show-more major" type="button"></button>`, 2),
|
|
@@ -3702,8 +3727,8 @@ function $a162c9a08dc208c2$var$modify_only_local_filter(local_filter_object, sel
|
|
|
3702
3727
|
}
|
|
3703
3728
|
return modified_filter_object;
|
|
3704
3729
|
}
|
|
3705
|
-
async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_opts) {
|
|
3706
|
-
const body = await (0, $52FdA$depictaiutilishared.observer).wait_for_element("body");
|
|
3730
|
+
async function $4cf7d9829d60d844$export$79b1565500412d9b(search_modal, modal_fn_opts, parent) {
|
|
3731
|
+
const body = parent || (await (0, $52FdA$depictaiutilishared.observer).wait_for_element("body"));
|
|
3707
3732
|
let dispose_and_remove;
|
|
3708
3733
|
const open_modal_ = function () {
|
|
3709
3734
|
let extra_options_for_modal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -4624,7 +4649,10 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4624
4649
|
const [get_extra_displays, set_extra_displays_] = $52FdA$solidjs.createSignal([], {
|
|
4625
4650
|
equals: false
|
|
4626
4651
|
});
|
|
4627
|
-
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() =>
|
|
4652
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => {
|
|
4653
|
+
var _plp_results_;
|
|
4654
|
+
return [...(((_plp_results_ = plp_results_()) === null || _plp_results_ === void 0 ? void 0 : _plp_results_.displays) || []), ...get_extra_displays()];
|
|
4655
|
+
}));
|
|
4628
4656
|
const percentage_in_view_ = $45c16e404a883f74$export$63dd0350f8559dda({
|
|
4629
4657
|
get_last_result_in_viewport_: get_last_result_in_viewport_,
|
|
4630
4658
|
displays_by_key_: displays_by_key_,
|
|
@@ -4750,18 +4778,18 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4750
4778
|
layout_options_: layout_options_,
|
|
4751
4779
|
sort_or_filter_open_: sort_or_filter_open_
|
|
4752
4780
|
});
|
|
4753
|
-
$52FdA$solidjs.createComputed(() => {
|
|
4754
|
-
if (!is_loading_()) return;
|
|
4755
|
-
set_should_have_placeholders_rendered(true);
|
|
4756
|
-
set_suspense_is_blocked(false);
|
|
4757
|
-
is_just_after_plp_results_update = true;
|
|
4758
|
-
});
|
|
4759
4781
|
const block_suspense_if_needed = () => {
|
|
4760
4782
|
if (!is_just_after_plp_results_update) return;
|
|
4761
4783
|
is_just_after_plp_results_update = false;
|
|
4762
4784
|
fallback_is_alive = false;
|
|
4763
4785
|
set_suspense_is_blocked(true);
|
|
4764
4786
|
};
|
|
4787
|
+
$52FdA$solidjs.createComputed(() => {
|
|
4788
|
+
if (!is_loading_()) return;
|
|
4789
|
+
set_should_have_placeholders_rendered(true);
|
|
4790
|
+
set_suspense_is_blocked(false);
|
|
4791
|
+
is_just_after_plp_results_update = true;
|
|
4792
|
+
});
|
|
4765
4793
|
$52FdA$solidjs.createEffect($52FdA$solidjs.on(plp_results_, () => {
|
|
4766
4794
|
if (!fallback_is_alive) {
|
|
4767
4795
|
// 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
|
|
@@ -4771,6 +4799,48 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4771
4799
|
}, {
|
|
4772
4800
|
defer: true
|
|
4773
4801
|
}));
|
|
4802
|
+
/*
|
|
4803
|
+
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)
|
|
4804
|
+
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
4805
|
+
(For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
|
|
4806
|
+
We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
|
|
4807
|
+
*/
|
|
4808
|
+
const product_cards_when_data = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
|
|
4809
|
+
get fallback() {
|
|
4810
|
+
return (() => {
|
|
4811
|
+
fallback_is_alive = true;
|
|
4812
|
+
$52FdA$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4813
|
+
return $52FdA$solidjs.createMemo(() => {
|
|
4814
|
+
// 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
|
|
4815
|
+
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
4816
|
+
if (get_suspense_is_blocked()) return suspense_contents;
|
|
4817
|
+
set_should_have_placeholders_rendered(true); // just in case
|
|
4818
|
+
$52FdA$solidjs.onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
4819
|
+
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>
|
|
4820
|
+
});
|
|
4821
|
+
})();
|
|
4822
|
+
},
|
|
4823
|
+
|
|
4824
|
+
get children() {
|
|
4825
|
+
return (() => {
|
|
4826
|
+
suspense_contents = $0d3ee7000f047e67$export$a1fd619a4743ca08({
|
|
4827
|
+
product_card_template_: product_card_template_,
|
|
4828
|
+
plp_results_: plp_results_,
|
|
4829
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
4830
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
4831
|
+
market_: market_,
|
|
4832
|
+
merchant_: merchant_,
|
|
4833
|
+
all_products_loaded_: all_products_loaded_,
|
|
4834
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
4835
|
+
query_base_: query_base_,
|
|
4836
|
+
depict_api_: depict_api_,
|
|
4837
|
+
is_loading_: is_loading_
|
|
4838
|
+
});
|
|
4839
|
+
$52FdA$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
4840
|
+
return suspense_contents;
|
|
4841
|
+
})();
|
|
4842
|
+
}
|
|
4843
|
+
});
|
|
4774
4844
|
return [$52FdA$solidjsweb.memo((0, $8edd3cf30d1fd8b4$export$a2cc176055f8f08)), $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
|
|
4775
4845
|
get cols_at_size() {
|
|
4776
4846
|
return modified_cols_at_size();
|
|
@@ -4794,44 +4864,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
4794
4864
|
get fallback() {
|
|
4795
4865
|
return rendered_placeholders();
|
|
4796
4866
|
},
|
|
4797
|
-
|
|
4798
|
-
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
|
|
4799
|
-
get fallback() {
|
|
4800
|
-
return (() => {
|
|
4801
|
-
fallback_is_alive = true;
|
|
4802
|
-
$52FdA$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4803
|
-
return $52FdA$solidjs.createMemo(() => {
|
|
4804
|
-
// 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
|
|
4805
|
-
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
4806
|
-
if (get_suspense_is_blocked()) return suspense_contents;
|
|
4807
|
-
set_should_have_placeholders_rendered(true); // just in case
|
|
4808
|
-
$52FdA$solidjs.onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
4809
|
-
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>
|
|
4810
|
-
});
|
|
4811
|
-
})();
|
|
4812
|
-
},
|
|
4813
|
-
|
|
4814
|
-
get children() {
|
|
4815
|
-
return (() => {
|
|
4816
|
-
suspense_contents = $0d3ee7000f047e67$export$a1fd619a4743ca08({
|
|
4817
|
-
product_card_template_: product_card_template_,
|
|
4818
|
-
plp_results_: plp_results_,
|
|
4819
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
4820
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
4821
|
-
market_: market_,
|
|
4822
|
-
merchant_: merchant_,
|
|
4823
|
-
all_products_loaded_: all_products_loaded_,
|
|
4824
|
-
min_products_to_fetch_: min_products_to_fetch_,
|
|
4825
|
-
query_base_: query_base_,
|
|
4826
|
-
depict_api_: depict_api_,
|
|
4827
|
-
is_loading_: is_loading_
|
|
4828
|
-
});
|
|
4829
|
-
$52FdA$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
4830
|
-
return suspense_contents;
|
|
4831
|
-
})();
|
|
4832
|
-
}
|
|
4833
|
-
});
|
|
4834
|
-
}
|
|
4867
|
+
children: product_cards_when_data
|
|
4835
4868
|
});
|
|
4836
4869
|
}
|
|
4837
4870
|
})];
|
|
@@ -8106,7 +8139,8 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8106
8139
|
product_card_template_: product_card_template_,
|
|
8107
8140
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
8108
8141
|
view_more_button_ = true,
|
|
8109
|
-
layout_options_: layout_options_
|
|
8142
|
+
layout_options_: layout_options_,
|
|
8143
|
+
all_products_loaded_: all_products_loaded_
|
|
8110
8144
|
} = _ref;
|
|
8111
8145
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
8112
8146
|
const rows_object = view_more_button_ ? $c77adcdf5346b187$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
@@ -8119,51 +8153,53 @@ function $c77adcdf5346b187$export$7de92c4c2205ebf3(_ref) {
|
|
|
8119
8153
|
let [per_column] = _ref2;
|
|
8120
8154
|
return per_column;
|
|
8121
8155
|
})));
|
|
8156
|
+
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
8157
|
+
const elements = (() => {
|
|
8158
|
+
const _el$ = $52FdA$solidjsweb.getNextElement($c77adcdf5346b187$var$_tmpl$),
|
|
8159
|
+
_el$2 = _el$.firstChild,
|
|
8160
|
+
_el$3 = _el$2.nextSibling,
|
|
8161
|
+
[_el$4, _co$] = $52FdA$solidjsweb.getNextMarker(_el$3.nextSibling),
|
|
8162
|
+
_el$5 = _el$4.nextSibling,
|
|
8163
|
+
[_el$6, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
8164
|
+
$52FdA$solidjsweb.insert(_el$2, () => i18n_.search_recs_title_());
|
|
8165
|
+
$52FdA$solidjsweb.insert(_el$, (0, $8edd3cf30d1fd8b4$export$a2cc176055f8f08), _el$4, _co$);
|
|
8166
|
+
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), $52FdA$solidjsweb.mergeProps({
|
|
8167
|
+
rows: rows_object,
|
|
8168
|
+
layout: "grid",
|
|
8169
|
+
element_attributes: {
|
|
8170
|
+
class: "cards"
|
|
8171
|
+
}
|
|
8172
|
+
}, layout_options_, {
|
|
8173
|
+
get children() {
|
|
8174
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
|
|
8175
|
+
get fallback() {
|
|
8176
|
+
return $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
8177
|
+
num_placeholders_: num_placeholders_,
|
|
8178
|
+
product_card_template_: product_card_template_
|
|
8179
|
+
});
|
|
8180
|
+
},
|
|
8181
|
+
get children() {
|
|
8182
|
+
return (() => {
|
|
8183
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
8184
|
+
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => recommendations_resource() || []));
|
|
8185
|
+
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
8186
|
+
displays_by_key_: displays_by_key_,
|
|
8187
|
+
merchant_: $52FdA$solidjs.createMemo(() => search_query_base_().tenant),
|
|
8188
|
+
market_: $52FdA$solidjs.createMemo(() => search_query_base_().market),
|
|
8189
|
+
product_card_template_: product_card_template_
|
|
8190
|
+
});
|
|
8191
|
+
})();
|
|
8192
|
+
}
|
|
8193
|
+
});
|
|
8194
|
+
}
|
|
8195
|
+
})), _el$6, _co$2);
|
|
8196
|
+
return _el$;
|
|
8197
|
+
})();
|
|
8122
8198
|
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
8123
8199
|
get when() {
|
|
8124
|
-
return is_showing_something();
|
|
8200
|
+
return $52FdA$solidjsweb.memo(() => !!is_showing_something())() && all_products_loaded_();
|
|
8125
8201
|
},
|
|
8126
|
-
|
|
8127
|
-
const _el$ = $52FdA$solidjsweb.getNextElement($c77adcdf5346b187$var$_tmpl$),
|
|
8128
|
-
_el$2 = _el$.firstChild,
|
|
8129
|
-
_el$3 = _el$2.nextSibling,
|
|
8130
|
-
[_el$4, _co$] = $52FdA$solidjsweb.getNextMarker(_el$3.nextSibling),
|
|
8131
|
-
_el$5 = _el$4.nextSibling,
|
|
8132
|
-
[_el$6, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
8133
|
-
$52FdA$solidjsweb.insert(_el$2, () => i18n_.search_recs_title_());
|
|
8134
|
-
$52FdA$solidjsweb.insert(_el$, (0, $8edd3cf30d1fd8b4$export$a2cc176055f8f08), _el$4, _co$);
|
|
8135
|
-
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), $52FdA$solidjsweb.mergeProps({
|
|
8136
|
-
rows: rows_object,
|
|
8137
|
-
layout: "grid",
|
|
8138
|
-
element_attributes: {
|
|
8139
|
-
class: "cards"
|
|
8140
|
-
}
|
|
8141
|
-
}, layout_options_, {
|
|
8142
|
-
get children() {
|
|
8143
|
-
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Suspense), {
|
|
8144
|
-
get fallback() {
|
|
8145
|
-
return $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
8146
|
-
num_placeholders_: num_placeholders_,
|
|
8147
|
-
product_card_template_: product_card_template_
|
|
8148
|
-
});
|
|
8149
|
-
},
|
|
8150
|
-
get children() {
|
|
8151
|
-
return (() => {
|
|
8152
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
8153
|
-
const displays_by_key_ = $76012c4468a53d1f$export$7f8bd308237ab5a5($52FdA$solidjs.createMemo(() => recommendations_resource() || []));
|
|
8154
|
-
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
8155
|
-
displays_by_key_: displays_by_key_,
|
|
8156
|
-
merchant_: $52FdA$solidjs.createMemo(() => search_query_base_().tenant),
|
|
8157
|
-
market_: $52FdA$solidjs.createMemo(() => search_query_base_().market),
|
|
8158
|
-
product_card_template_: product_card_template_
|
|
8159
|
-
});
|
|
8160
|
-
})();
|
|
8161
|
-
}
|
|
8162
|
-
});
|
|
8163
|
-
}
|
|
8164
|
-
})), _el$6, _co$2);
|
|
8165
|
-
return _el$;
|
|
8166
|
-
}
|
|
8202
|
+
children: elements
|
|
8167
8203
|
});
|
|
8168
8204
|
}
|
|
8169
8205
|
function $c77adcdf5346b187$var$make_state_saved_rows(_ref3, i18n_) {
|
|
@@ -10736,9 +10772,7 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10736
10772
|
}
|
|
10737
10773
|
}), _el$19, _co$8);
|
|
10738
10774
|
$52FdA$solidjsweb.insert(_el$7, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
10739
|
-
|
|
10740
|
-
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
10741
|
-
},
|
|
10775
|
+
when: !disable_search_recommendations_,
|
|
10742
10776
|
keyed: false,
|
|
10743
10777
|
get children() {
|
|
10744
10778
|
return $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
|
|
@@ -10757,7 +10791,8 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
|
|
|
10757
10791
|
},
|
|
10758
10792
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
10759
10793
|
view_more_button_: search_recs_view_more_,
|
|
10760
|
-
product_card_template_: product_card_template_
|
|
10794
|
+
product_card_template_: product_card_template_,
|
|
10795
|
+
all_products_loaded_: get_all_products_loaded
|
|
10761
10796
|
});
|
|
10762
10797
|
}
|
|
10763
10798
|
});
|
|
@@ -10907,6 +10942,7 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
|
|
|
10907
10942
|
disable_scrolling_during_modal = true,
|
|
10908
10943
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
10909
10944
|
render_instant_card: render_instant_card,
|
|
10945
|
+
override_modal_element: override_modal_element,
|
|
10910
10946
|
...props_on_class
|
|
10911
10947
|
} = _ref;
|
|
10912
10948
|
$ddd39c5f36f49703$var$_classPrivateFieldInitSpec(this, $ddd39c5f36f49703$var$_locale_signal, {
|
|
@@ -11062,7 +11098,7 @@ class $ddd39c5f36f49703$export$ac6237957a15b3f0 {
|
|
|
11062
11098
|
enable_category_suggestions_: enable_category_suggestions,
|
|
11063
11099
|
disable_scrolling_: disable_scrolling_during_modal,
|
|
11064
11100
|
bottom_distance_under_modal_: bottom_distance_under_modal
|
|
11065
|
-
});
|
|
11101
|
+
}, override_modal_element);
|
|
11066
11102
|
// This will add some default behaviour to open_modal_ if no style_props_ are supplied
|
|
11067
11103
|
// The default behaviour is to align the modal with the input field if possible
|
|
11068
11104
|
const modal_opening_effect = () => {
|
package/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;
|