@depict-ai/ui 2.0.7 → 2.0.9
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 +195 -153
- package/ES10/index.d.ts +1 -1
- package/ES10/index.js +197 -155
- package/latest/index.cjs +190 -153
- package/latest/index.d.ts +1 -1
- package/latest/index.js +192 -155
- package/package.json +1 -1
- package/server/ES10/index.cjs +172 -134
- package/server/ES10/index.d.ts +1 -1
- package/server/ES10/index.js +174 -136
- package/server/latest/index.cjs +167 -134
- package/server/latest/index.d.ts +1 -1
- package/server/latest/index.js +169 -136
package/latest/index.cjs
CHANGED
|
@@ -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.
|
|
64
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.9";
|
|
65
65
|
|
|
66
66
|
/** @jsxImportSource solid-js */
|
|
67
67
|
|
|
@@ -113,7 +113,7 @@ const $4e04be41243c3d80$export$6daf8749b65a1b77 = cols_at_size => {
|
|
|
113
113
|
return $4e04be41243c3d80$var$transform_elements(sorted_cols_at_size);
|
|
114
114
|
};
|
|
115
115
|
function $fc23d7668ae0011d$export$a2cc176055f8f08() {
|
|
116
|
-
const text = "Please try setting `
|
|
116
|
+
const text = "Please try setting `columnsAtSize` on the `SearchPage`/`CategoryPage` components to change the grid before setting it with CSS. If you do with CSS, set `ColsAtSize` to an empty array to ensure no declarations created by the SDK leak through.";
|
|
117
117
|
return (0, $gVhhF$solidjsweb.isServer) ? {
|
|
118
118
|
t: `<!-- ${text} -->`
|
|
119
119
|
} : document.createComment(text);
|
|
@@ -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 = $gVhhF$solidjs.getOwner();
|
|
254
|
-
const display_accessor = $gVhhF$solidjs.createMemo(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
const display_accessor = $gVhhF$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] = $gVhhF$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 => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => fn(index()))),
|
|
262
|
-
merchant:
|
|
263
|
-
|
|
264
|
-
market: $gVhhF$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
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
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, $gVhhF$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,7 +623,13 @@ function $95837413165cc2df$export$23fca46f3143581f(component, error_message) {
|
|
|
600
623
|
return component_in_error_boundary(elements => {
|
|
601
624
|
const have_multiple = Array.isArray(elements);
|
|
602
625
|
if (have_multiple ? !elements?.length : !elements) return;
|
|
603
|
-
(0, $gVhhF$depictaiutilishared.observer).onremoved(have_multiple ? elements[0] : elements,
|
|
626
|
+
(0, $gVhhF$depictaiutilishared.observer).onremoved(have_multiple ? elements[0] : elements, ({
|
|
627
|
+
element: element
|
|
628
|
+
}) => {
|
|
629
|
+
if (document.documentElement.contains(element)) return; // If element has instantly been re-inserted, don't dispose
|
|
630
|
+
// See https://depictaiworkspace.slack.com/archives/C050GHEPBTR/p1695809102791259?thread_ts=1695106805.459729&cid=C050GHEPBTR
|
|
631
|
+
dispose();
|
|
632
|
+
});
|
|
604
633
|
});
|
|
605
634
|
});else
|
|
606
635
|
// we're already in a root so cleanups are handled
|
|
@@ -648,51 +677,52 @@ function $b8e79813f4f7ebe4$export$7da560f849543dff({
|
|
|
648
677
|
}) {
|
|
649
678
|
const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource_.loading || recommendations_resource_()?.length);
|
|
650
679
|
const num_placeholders_ = () => 20;
|
|
680
|
+
const elements = (() => {
|
|
681
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($b8e79813f4f7ebe4$var$_tmpl$),
|
|
682
|
+
_el$2 = _el$.firstChild,
|
|
683
|
+
[_el$3, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$2.nextSibling),
|
|
684
|
+
_el$4 = _el$3.nextSibling,
|
|
685
|
+
[_el$5, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$4.nextSibling);
|
|
686
|
+
$gVhhF$solidjsweb.insert(_el$, (0, $fc23d7668ae0011d$export$a2cc176055f8f08), _el$3, _co$);
|
|
687
|
+
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $gVhhF$solidjsweb.mergeProps({
|
|
688
|
+
get rows() {
|
|
689
|
+
return rows_object_();
|
|
690
|
+
},
|
|
691
|
+
layout: "grid",
|
|
692
|
+
element_attributes: {
|
|
693
|
+
class: "cards"
|
|
694
|
+
}
|
|
695
|
+
}, layout_options_, {
|
|
696
|
+
get children() {
|
|
697
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
698
|
+
get fallback() {
|
|
699
|
+
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
700
|
+
num_placeholders_: num_placeholders_,
|
|
701
|
+
product_card_template_: product_card_template_
|
|
702
|
+
});
|
|
703
|
+
},
|
|
704
|
+
get children() {
|
|
705
|
+
return (() => {
|
|
706
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
707
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
708
|
+
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
709
|
+
displays_by_key_: displays_by_key_,
|
|
710
|
+
merchant_: merchant_,
|
|
711
|
+
market_: market_,
|
|
712
|
+
product_card_template_: product_card_template_
|
|
713
|
+
});
|
|
714
|
+
})();
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
})), _el$5, _co$2);
|
|
719
|
+
return _el$;
|
|
720
|
+
})();
|
|
651
721
|
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
652
722
|
get when() {
|
|
653
723
|
return is_showing_something();
|
|
654
724
|
},
|
|
655
|
-
|
|
656
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($b8e79813f4f7ebe4$var$_tmpl$),
|
|
657
|
-
_el$2 = _el$.firstChild,
|
|
658
|
-
[_el$3, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$2.nextSibling),
|
|
659
|
-
_el$4 = _el$3.nextSibling,
|
|
660
|
-
[_el$5, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$4.nextSibling);
|
|
661
|
-
$gVhhF$solidjsweb.insert(_el$, (0, $fc23d7668ae0011d$export$a2cc176055f8f08), _el$3, _co$);
|
|
662
|
-
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $gVhhF$solidjsweb.mergeProps({
|
|
663
|
-
get rows() {
|
|
664
|
-
return rows_object_();
|
|
665
|
-
},
|
|
666
|
-
layout: "grid",
|
|
667
|
-
element_attributes: {
|
|
668
|
-
class: "cards"
|
|
669
|
-
}
|
|
670
|
-
}, layout_options_, {
|
|
671
|
-
get children() {
|
|
672
|
-
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
673
|
-
get fallback() {
|
|
674
|
-
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
675
|
-
num_placeholders_: num_placeholders_,
|
|
676
|
-
product_card_template_: product_card_template_
|
|
677
|
-
});
|
|
678
|
-
},
|
|
679
|
-
get children() {
|
|
680
|
-
return (() => {
|
|
681
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
682
|
-
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource_() || []));
|
|
683
|
-
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
684
|
-
displays_by_key_: displays_by_key_,
|
|
685
|
-
merchant_: merchant_,
|
|
686
|
-
market_: market_,
|
|
687
|
-
product_card_template_: product_card_template_
|
|
688
|
-
});
|
|
689
|
-
})();
|
|
690
|
-
}
|
|
691
|
-
});
|
|
692
|
-
}
|
|
693
|
-
})), _el$5, _co$2);
|
|
694
|
-
return _el$;
|
|
695
|
-
}
|
|
725
|
+
children: elements
|
|
696
726
|
});
|
|
697
727
|
}
|
|
698
728
|
const $1f8dbf7e28b3eff2$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<button class="show-more major" type="button"></button>`, 2),
|
|
@@ -4298,7 +4328,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
|
4298
4328
|
const [get_extra_displays, set_extra_displays_] = $gVhhF$solidjs.createSignal([], {
|
|
4299
4329
|
equals: false
|
|
4300
4330
|
});
|
|
4301
|
-
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => [...plp_results_()
|
|
4331
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => [...(plp_results_()?.displays || []), ...get_extra_displays()]));
|
|
4302
4332
|
const percentage_in_view_ = $4117463e2939f5f4$export$63dd0350f8559dda({
|
|
4303
4333
|
get_last_result_in_viewport_: get_last_result_in_viewport_,
|
|
4304
4334
|
displays_by_key_: displays_by_key_,
|
|
@@ -4417,18 +4447,18 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
4417
4447
|
layout_options_: layout_options_,
|
|
4418
4448
|
sort_or_filter_open_: sort_or_filter_open_
|
|
4419
4449
|
});
|
|
4420
|
-
$gVhhF$solidjs.createComputed(() => {
|
|
4421
|
-
if (!is_loading_()) return;
|
|
4422
|
-
set_should_have_placeholders_rendered(true);
|
|
4423
|
-
set_suspense_is_blocked(false);
|
|
4424
|
-
is_just_after_plp_results_update = true;
|
|
4425
|
-
});
|
|
4426
4450
|
const block_suspense_if_needed = () => {
|
|
4427
4451
|
if (!is_just_after_plp_results_update) return;
|
|
4428
4452
|
is_just_after_plp_results_update = false;
|
|
4429
4453
|
fallback_is_alive = false;
|
|
4430
4454
|
set_suspense_is_blocked(true);
|
|
4431
4455
|
};
|
|
4456
|
+
$gVhhF$solidjs.createComputed(() => {
|
|
4457
|
+
if (!is_loading_()) return;
|
|
4458
|
+
set_should_have_placeholders_rendered(true);
|
|
4459
|
+
set_suspense_is_blocked(false);
|
|
4460
|
+
is_just_after_plp_results_update = true;
|
|
4461
|
+
});
|
|
4432
4462
|
$gVhhF$solidjs.createEffect($gVhhF$solidjs.on(plp_results_, () => {
|
|
4433
4463
|
if (!fallback_is_alive) {
|
|
4434
4464
|
// 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
|
|
@@ -4438,6 +4468,48 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
4438
4468
|
}, {
|
|
4439
4469
|
defer: true
|
|
4440
4470
|
}));
|
|
4471
|
+
/*
|
|
4472
|
+
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)
|
|
4473
|
+
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
4474
|
+
(For the whole idea of the displays being cached to work we can't tear down and re-run ProductCards for every new result.
|
|
4475
|
+
We have to keep ProductCards alive, but hidden, and feed them new data as soon as we had it)
|
|
4476
|
+
*/
|
|
4477
|
+
const product_cards_when_data = $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
4478
|
+
get fallback() {
|
|
4479
|
+
return (() => {
|
|
4480
|
+
fallback_is_alive = true;
|
|
4481
|
+
$gVhhF$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4482
|
+
return $gVhhF$solidjs.createMemo(() => {
|
|
4483
|
+
// 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
|
|
4484
|
+
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
4485
|
+
if (get_suspense_is_blocked()) return suspense_contents;
|
|
4486
|
+
set_should_have_placeholders_rendered(true); // just in case
|
|
4487
|
+
$gVhhF$solidjs.onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
4488
|
+
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>
|
|
4489
|
+
});
|
|
4490
|
+
})();
|
|
4491
|
+
},
|
|
4492
|
+
|
|
4493
|
+
get children() {
|
|
4494
|
+
return (() => {
|
|
4495
|
+
suspense_contents = $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
4496
|
+
product_card_template_: product_card_template_,
|
|
4497
|
+
plp_results_: plp_results_,
|
|
4498
|
+
last_result_in_viewport_: last_result_in_viewport_,
|
|
4499
|
+
first_result_in_viewport_: first_result_in_viewport_,
|
|
4500
|
+
market_: market_,
|
|
4501
|
+
merchant_: merchant_,
|
|
4502
|
+
all_products_loaded_: all_products_loaded_,
|
|
4503
|
+
min_products_to_fetch_: min_products_to_fetch_,
|
|
4504
|
+
query_base_: query_base_,
|
|
4505
|
+
depict_api_: depict_api_,
|
|
4506
|
+
is_loading_: is_loading_
|
|
4507
|
+
});
|
|
4508
|
+
$gVhhF$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
4509
|
+
return suspense_contents;
|
|
4510
|
+
})();
|
|
4511
|
+
}
|
|
4512
|
+
});
|
|
4441
4513
|
return [$gVhhF$solidjsweb.memo((0, $fc23d7668ae0011d$export$a2cc176055f8f08)), $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), {
|
|
4442
4514
|
get cols_at_size() {
|
|
4443
4515
|
return modified_cols_at_size();
|
|
@@ -4461,44 +4533,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
4461
4533
|
get fallback() {
|
|
4462
4534
|
return rendered_placeholders();
|
|
4463
4535
|
},
|
|
4464
|
-
|
|
4465
|
-
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
4466
|
-
get fallback() {
|
|
4467
|
-
return (() => {
|
|
4468
|
-
fallback_is_alive = true;
|
|
4469
|
-
$gVhhF$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
4470
|
-
return $gVhhF$solidjs.createMemo(() => {
|
|
4471
|
-
// 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
|
|
4472
|
-
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
4473
|
-
if (get_suspense_is_blocked()) return suspense_contents;
|
|
4474
|
-
set_should_have_placeholders_rendered(true); // just in case
|
|
4475
|
-
$gVhhF$solidjs.onCleanup(() => set_should_have_placeholders_rendered(false));
|
|
4476
|
-
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>
|
|
4477
|
-
});
|
|
4478
|
-
})();
|
|
4479
|
-
},
|
|
4480
|
-
|
|
4481
|
-
get children() {
|
|
4482
|
-
return (() => {
|
|
4483
|
-
suspense_contents = $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
4484
|
-
product_card_template_: product_card_template_,
|
|
4485
|
-
plp_results_: plp_results_,
|
|
4486
|
-
last_result_in_viewport_: last_result_in_viewport_,
|
|
4487
|
-
first_result_in_viewport_: first_result_in_viewport_,
|
|
4488
|
-
market_: market_,
|
|
4489
|
-
merchant_: merchant_,
|
|
4490
|
-
all_products_loaded_: all_products_loaded_,
|
|
4491
|
-
min_products_to_fetch_: min_products_to_fetch_,
|
|
4492
|
-
query_base_: query_base_,
|
|
4493
|
-
depict_api_: depict_api_,
|
|
4494
|
-
is_loading_: is_loading_
|
|
4495
|
-
});
|
|
4496
|
-
$gVhhF$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
4497
|
-
return suspense_contents;
|
|
4498
|
-
})();
|
|
4499
|
-
}
|
|
4500
|
-
});
|
|
4501
|
-
}
|
|
4536
|
+
children: product_cards_when_data
|
|
4502
4537
|
});
|
|
4503
4538
|
}
|
|
4504
4539
|
})];
|
|
@@ -7507,58 +7542,61 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
|
|
|
7507
7542
|
product_card_template_: product_card_template_,
|
|
7508
7543
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
7509
7544
|
view_more_button_ = true,
|
|
7510
|
-
layout_options_: layout_options_
|
|
7545
|
+
layout_options_: layout_options_,
|
|
7546
|
+
all_products_loaded_: all_products_loaded_
|
|
7511
7547
|
}) {
|
|
7512
7548
|
const [get_showing_recommendation_rows] = showing_recommendation_rows_; // We reset this in after_submit in search.tsx FYI
|
|
7513
7549
|
const rows_object = view_more_button_ ? $fb29c6201c369e39$var$make_state_saved_rows(showing_recommendation_rows_, i18n_) : "all";
|
|
7514
7550
|
const [recommendations_resource] = $gVhhF$solidjs.createResource(search_query_base_, query => depict_api_.get_recommended(query).then(r => r.displays));
|
|
7515
7551
|
const is_showing_something = $gVhhF$solidjs.createMemo(() => recommendations_resource.loading || recommendations_resource()?.length);
|
|
7516
7552
|
const num_placeholders_ = $gVhhF$solidjs.createMemo(() => (0, $aec24316ed262dc0$export$6c9030e511152266) + get_showing_recommendation_rows() * Math.max(...layout_options_().cols_at_size.map(([per_column]) => per_column)));
|
|
7553
|
+
// Don't tear down elements every time one updates the page - don't put them within <Show>
|
|
7554
|
+
const elements = (() => {
|
|
7555
|
+
const _el$ = $gVhhF$solidjsweb.getNextElement($fb29c6201c369e39$var$_tmpl$),
|
|
7556
|
+
_el$2 = _el$.firstChild,
|
|
7557
|
+
_el$3 = _el$2.nextSibling,
|
|
7558
|
+
[_el$4, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$3.nextSibling),
|
|
7559
|
+
_el$5 = _el$4.nextSibling,
|
|
7560
|
+
[_el$6, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
7561
|
+
$gVhhF$solidjsweb.insert(_el$2, () => i18n_.search_recs_title_());
|
|
7562
|
+
$gVhhF$solidjsweb.insert(_el$, (0, $fc23d7668ae0011d$export$a2cc176055f8f08), _el$4, _co$);
|
|
7563
|
+
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $gVhhF$solidjsweb.mergeProps({
|
|
7564
|
+
rows: rows_object,
|
|
7565
|
+
layout: "grid",
|
|
7566
|
+
element_attributes: {
|
|
7567
|
+
class: "cards"
|
|
7568
|
+
}
|
|
7569
|
+
}, layout_options_, {
|
|
7570
|
+
get children() {
|
|
7571
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
7572
|
+
get fallback() {
|
|
7573
|
+
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
7574
|
+
num_placeholders_: num_placeholders_,
|
|
7575
|
+
product_card_template_: product_card_template_
|
|
7576
|
+
});
|
|
7577
|
+
},
|
|
7578
|
+
get children() {
|
|
7579
|
+
return (() => {
|
|
7580
|
+
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
7581
|
+
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource() || []));
|
|
7582
|
+
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
7583
|
+
displays_by_key_: displays_by_key_,
|
|
7584
|
+
merchant_: $gVhhF$solidjs.createMemo(() => search_query_base_().tenant),
|
|
7585
|
+
market_: $gVhhF$solidjs.createMemo(() => search_query_base_().market),
|
|
7586
|
+
product_card_template_: product_card_template_
|
|
7587
|
+
});
|
|
7588
|
+
})();
|
|
7589
|
+
}
|
|
7590
|
+
});
|
|
7591
|
+
}
|
|
7592
|
+
})), _el$6, _co$2);
|
|
7593
|
+
return _el$;
|
|
7594
|
+
})();
|
|
7517
7595
|
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
7518
7596
|
get when() {
|
|
7519
|
-
return is_showing_something();
|
|
7597
|
+
return $gVhhF$solidjsweb.memo(() => !!is_showing_something())() && all_products_loaded_();
|
|
7520
7598
|
},
|
|
7521
|
-
|
|
7522
|
-
const _el$ = $gVhhF$solidjsweb.getNextElement($fb29c6201c369e39$var$_tmpl$),
|
|
7523
|
-
_el$2 = _el$.firstChild,
|
|
7524
|
-
_el$3 = _el$2.nextSibling,
|
|
7525
|
-
[_el$4, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$3.nextSibling),
|
|
7526
|
-
_el$5 = _el$4.nextSibling,
|
|
7527
|
-
[_el$6, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
7528
|
-
$gVhhF$solidjsweb.insert(_el$2, () => i18n_.search_recs_title_());
|
|
7529
|
-
$gVhhF$solidjsweb.insert(_el$, (0, $fc23d7668ae0011d$export$a2cc176055f8f08), _el$4, _co$);
|
|
7530
|
-
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), $gVhhF$solidjsweb.mergeProps({
|
|
7531
|
-
rows: rows_object,
|
|
7532
|
-
layout: "grid",
|
|
7533
|
-
element_attributes: {
|
|
7534
|
-
class: "cards"
|
|
7535
|
-
}
|
|
7536
|
-
}, layout_options_, {
|
|
7537
|
-
get children() {
|
|
7538
|
-
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Suspense), {
|
|
7539
|
-
get fallback() {
|
|
7540
|
-
return $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
7541
|
-
num_placeholders_: num_placeholders_,
|
|
7542
|
-
product_card_template_: product_card_template_
|
|
7543
|
-
});
|
|
7544
|
-
},
|
|
7545
|
-
get children() {
|
|
7546
|
-
return (() => {
|
|
7547
|
-
// IIFE to make sure we access both the recommendations_resource and the resources containing the product card rendering results themselves within the Suspense boundary
|
|
7548
|
-
const displays_by_key_ = $a73063cc642f3e5f$export$7f8bd308237ab5a5($gVhhF$solidjs.createMemo(() => recommendations_resource() || []));
|
|
7549
|
-
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
7550
|
-
displays_by_key_: displays_by_key_,
|
|
7551
|
-
merchant_: $gVhhF$solidjs.createMemo(() => search_query_base_().tenant),
|
|
7552
|
-
market_: $gVhhF$solidjs.createMemo(() => search_query_base_().market),
|
|
7553
|
-
product_card_template_: product_card_template_
|
|
7554
|
-
});
|
|
7555
|
-
})();
|
|
7556
|
-
}
|
|
7557
|
-
});
|
|
7558
|
-
}
|
|
7559
|
-
})), _el$6, _co$2);
|
|
7560
|
-
return _el$;
|
|
7561
|
-
}
|
|
7599
|
+
children: elements
|
|
7562
7600
|
});
|
|
7563
7601
|
}
|
|
7564
7602
|
function $fb29c6201c369e39$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
|
|
@@ -9993,9 +10031,7 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
9993
10031
|
}
|
|
9994
10032
|
}), _el$19, _co$8);
|
|
9995
10033
|
$gVhhF$solidjsweb.insert(_el$7, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
9996
|
-
|
|
9997
|
-
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
9998
|
-
},
|
|
10034
|
+
when: !disable_search_recommendations_,
|
|
9999
10035
|
keyed: false,
|
|
10000
10036
|
get children() {
|
|
10001
10037
|
return $gVhhF$solidjsweb.createComponent((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
|
|
@@ -10011,7 +10047,8 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
|
|
|
10011
10047
|
},
|
|
10012
10048
|
showing_recommendation_rows_: showing_recommendation_rows_,
|
|
10013
10049
|
view_more_button_: search_recs_view_more_,
|
|
10014
|
-
product_card_template_: product_card_template_
|
|
10050
|
+
product_card_template_: product_card_template_,
|
|
10051
|
+
all_products_loaded_: get_all_products_loaded
|
|
10015
10052
|
});
|
|
10016
10053
|
}
|
|
10017
10054
|
});
|
package/latest/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.9";
|
|
11
11
|
/**
|
|
12
12
|
* Returns accessor with the size of the provided element, including padding and border (I think)
|
|
13
13
|
*/
|