@depict-ai/ui 1.2.1 → 1.2.3
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/dist/client/main.cjs +39 -45
- package/dist/client/main.js +9063 -0
- package/dist/client/module.js +38 -44
- package/dist/index.d.ts +2 -2
- package/dist/main.js +8692 -0
- package/dist/module.js +8743 -0
- package/dist/server/main.cjs +34 -40
- package/dist/server/main.js +8058 -0
- package/dist/server/module.js +33 -39
- package/locales/require.js +1154 -0
- package/package.json +4 -4
- package/dist/tsconfig2.tsbuildinfo +0 -1
package/dist/server/main.cjs
CHANGED
|
@@ -13,8 +13,8 @@ $parcel$export(module.exports, "fetchDepictRecommendations", () => $bc91d938b8c6
|
|
|
13
13
|
$parcel$export(module.exports, "QuickLinks", () => $48567ac5b39bac56$export$de035477d6fef996);
|
|
14
14
|
$parcel$export(module.exports, "BreadCrumbs", () => $48567ac5b39bac56$export$5b7c3ce0ebe51f86);
|
|
15
15
|
$parcel$export(module.exports, "CategoryTitle", () => $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1);
|
|
16
|
-
$parcel$export(module.exports, "embedded_num_products", () => $
|
|
17
|
-
$parcel$export(module.exports, "get_categories", () => $
|
|
16
|
+
$parcel$export(module.exports, "embedded_num_products", () => $85b747260aa175c9$export$824dde41348efed1);
|
|
17
|
+
$parcel$export(module.exports, "get_categories", () => $63b10c9f461e0ef6$export$643598a327b5833e);
|
|
18
18
|
$parcel$export(module.exports, "DepictCategory", () => $48567ac5b39bac56$export$f34314aa9505732e);
|
|
19
19
|
$parcel$export(module.exports, "CategoryPage", () => $48567ac5b39bac56$export$e2bf8ce7779e827e);
|
|
20
20
|
$parcel$export(module.exports, "DepictSearch", () => $2c61e4cd8229c49a$export$ac6237957a15b3f0);
|
|
@@ -43,7 +43,7 @@ $parcel$export(module.exports, "defaultGridSpacing", () => $a3280f0aad997933$exp
|
|
|
43
43
|
$parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$export$c3834fa86c616831);
|
|
44
44
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
45
45
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
46
|
-
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.2.
|
|
46
|
+
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.2.3";
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
@@ -315,23 +315,10 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
315
315
|
let resolve_in_progress;
|
|
316
316
|
cache_obj.in_progress_[body] = new Promise((r)=>resolve_in_progress = r);
|
|
317
317
|
try {
|
|
318
|
-
|
|
318
|
+
const api_response = await (0, $diwD4$depictaiutilishared.fetch_retry)((0, $diwD4$depictaiutilishared.add_version_query_params)(endpoint1), {
|
|
319
319
|
method: "POST",
|
|
320
320
|
body: body
|
|
321
321
|
});
|
|
322
|
-
if ("query_id" in request && request.type === "collection") // FIXME: Remove. Backwards compatibility layer
|
|
323
|
-
// This will retry the request without the collection type if the first request fails
|
|
324
|
-
{
|
|
325
|
-
if (!api_response || api_response?.status === 404) {
|
|
326
|
-
(0, $diwD4$depictaiutilishared.dlog)("Fallback request for collections due to failure");
|
|
327
|
-
const fallback_body = JSON.parse(body);
|
|
328
|
-
delete fallback_body.type;
|
|
329
|
-
api_response = await (0, $diwD4$depictaiutilishared.fetch_retry)((0, $diwD4$depictaiutilishared.add_version_query_params)(endpoint1), {
|
|
330
|
-
method: "POST",
|
|
331
|
-
body: JSON.stringify(fallback_body)
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
322
|
return_successfully: {
|
|
336
323
|
if (!api_response || api_response.status !== 200) break return_successfully;
|
|
337
324
|
let result;
|
|
@@ -1852,10 +1839,10 @@ function $c1dc1554c1b94233$export$430444115f70a734({ selected_filters_: selected
|
|
|
1852
1839
|
const random_selector = (0, $diwD4$depictaiutilishared.make_random_classname)();
|
|
1853
1840
|
const count = (0, $diwD4$solidjs.createMemo)(()=>filter_().meta.counts?.[index]);
|
|
1854
1841
|
return (0, $diwD4$solidjsweb.ssr)($c1dc1554c1b94233$var$_tmpl$3, (0, $diwD4$solidjsweb.ssrHydrationKey)(), `input-row ${count() === 0 ? "count-0" : ""}`, (0, $diwD4$solidjsweb.ssrAttribute)("for", (0, $diwD4$solidjsweb.escape)(random_selector, true), false), (0, $diwD4$solidjsweb.ssrAttribute)("id", (0, $diwD4$solidjsweb.escape)(random_selector, true), false) + (0, $diwD4$solidjsweb.ssrAttribute)("name", (0, $diwD4$solidjsweb.escape)(radio_name, true), false), (0, $diwD4$solidjsweb.ssrAttribute)("checked", (0, $diwD4$solidjs.createMemo)(()=>{
|
|
1842
|
+
const v = value();
|
|
1855
1843
|
const data = existing_filter()?.data;
|
|
1856
|
-
if (data ===
|
|
1857
|
-
|
|
1858
|
-
return false;
|
|
1844
|
+
if (data === v) return true;
|
|
1845
|
+
return Array.isArray(data) && data.every((item, index)=>item === v[index]);
|
|
1859
1846
|
})(), true), (0, $diwD4$solidjsweb.escape)((0, $diwD4$solidjs.createMemo)(()=>{
|
|
1860
1847
|
const name = filter_().meta?.names?.[index];
|
|
1861
1848
|
if (name) return name;
|
|
@@ -4606,9 +4593,9 @@ function $47e2cc552c02110c$export$8895d39404bd2bb1(props) {
|
|
|
4606
4593
|
}
|
|
4607
4594
|
|
|
4608
4595
|
|
|
4609
|
-
function $
|
|
4596
|
+
function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ , query_id_: query_id_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , plp_results_: plp_results_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ }) {
|
|
4610
4597
|
// If we just got opened in a new tab, clear filters instantly and remove the flag
|
|
4611
|
-
$
|
|
4598
|
+
$ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
|
|
4612
4599
|
plp_results_: plp_results_,
|
|
4613
4600
|
local_filter_cache_: local_filter_cache_,
|
|
4614
4601
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -4652,7 +4639,7 @@ function $cc7c480116d2eba0$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ ,
|
|
|
4652
4639
|
if (!allow_filter_clearing) allow_filter_clearing = true;
|
|
4653
4640
|
})));
|
|
4654
4641
|
}
|
|
4655
|
-
function $
|
|
4642
|
+
function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_flag({ plp_results_: plp_results_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , i18n_: i18n_ , selected_filters_: selected_filters_ , local_filter_cache_: local_filter_cache_ , sideways_filter_clearing_flag_: [get_sideways_filter_clearing_flag_, set_sideways_filter_clearing_flag_] }) {
|
|
4656
4643
|
const tracking_function_for_plp_results = (0, $diwD4$solidjs.createReaction)(()=>{
|
|
4657
4644
|
// On first rendering of the CategoryPage (after we have results), check if we got to this URL by going sideways in QuickLinks and clear filters with toast if so
|
|
4658
4645
|
if (!(0, $diwD4$solidjs.untrack)(get_sideways_filter_clearing_flag_)) return;
|
|
@@ -4676,6 +4663,9 @@ function $cc7c480116d2eba0$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
4676
4663
|
|
|
4677
4664
|
|
|
4678
4665
|
|
|
4666
|
+
const $6b502b1b2155a0bc$export$5c28802497c8a83c = /*@__PURE__*/ Symbol("category_title_type");
|
|
4667
|
+
|
|
4668
|
+
|
|
4679
4669
|
const $840d88a04b2d22a7$var$_tmpl$ = [
|
|
4680
4670
|
"<div",
|
|
4681
4671
|
' class="product-count"><!--#-->',
|
|
@@ -4765,7 +4755,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4765
4755
|
const [results_filters, set_results_filters] = (0, $diwD4$solidjs.createSignal)();
|
|
4766
4756
|
const [observed_results_filters_elements, set_observed_results_filters_elements_] = (0, $diwD4$solidjs.createSignal)();
|
|
4767
4757
|
const is_slim_ = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-width:600px)");
|
|
4768
|
-
|
|
4758
|
+
// @ts-ignore - there's no type error here when writing the code, but parcel can't generate types that include the symbol, so we need to suppress the error that creates in our pipelines
|
|
4759
|
+
const category_title_type = category_title_[0, $6b502b1b2155a0bc$export$5c28802497c8a83c];
|
|
4769
4760
|
const extra_sort_and_filter_args_ = {};
|
|
4770
4761
|
const make_product_count_ = ()=>(0, $diwD4$solidjsweb.ssr)($840d88a04b2d22a7$var$_tmpl$, (0, $diwD4$solidjsweb.ssrHydrationKey)(), (0, $diwD4$solidjsweb.escape)((0, $diwD4$solidjsweb.createComponent)((0, $diwD4$solidjs.Show), {
|
|
4771
4762
|
get when () {
|
|
@@ -4861,7 +4852,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
4861
4852
|
selected_filters_: selected_filters_,
|
|
4862
4853
|
available_filters_: available_filters_
|
|
4863
4854
|
});
|
|
4864
|
-
(0, $
|
|
4855
|
+
(0, $ef972f5c10b1c5b4$export$3945d6db2dfd3d12)({
|
|
4865
4856
|
query_id_: query_id_,
|
|
4866
4857
|
crumb_data_: crumb_data_,
|
|
4867
4858
|
i18n_: i18n_,
|
|
@@ -5478,6 +5469,7 @@ function $48567ac5b39bac56$var$get_shared_properties(depict_category) {
|
|
|
5478
5469
|
|
|
5479
5470
|
|
|
5480
5471
|
|
|
5472
|
+
|
|
5481
5473
|
const $0b23bfd073d9a4e8$var$_tmpl$ = [
|
|
5482
5474
|
"<div",
|
|
5483
5475
|
' class="category-title"><h1 class="title">',
|
|
@@ -5491,7 +5483,8 @@ const $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1 = /*@__PURE__*/ (()=>{
|
|
|
5491
5483
|
width: "10ch"
|
|
5492
5484
|
})), (0, $diwD4$solidjsweb.escape)(product_count_));
|
|
5493
5485
|
};
|
|
5494
|
-
|
|
5486
|
+
// This is wrong but parcel can't build correctly, it says unexpected undefined
|
|
5487
|
+
actual_function[0, $6b502b1b2155a0bc$export$5c28802497c8a83c] = "simple";
|
|
5495
5488
|
return actual_function;
|
|
5496
5489
|
})();
|
|
5497
5490
|
|
|
@@ -5501,14 +5494,15 @@ const $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1 = /*@__PURE__*/ (()=>{
|
|
|
5501
5494
|
|
|
5502
5495
|
|
|
5503
5496
|
|
|
5504
|
-
|
|
5497
|
+
|
|
5498
|
+
const $85b747260aa175c9$var$_tmpl$ = [
|
|
5505
5499
|
"<div",
|
|
5506
5500
|
' class="sort-and-filter-buttons fake" aria-hidden="true" style="position:absolute;z-index:-1;pointer-events:none;opacity:0"><div class="outer"><div class="inner"><!--#-->',
|
|
5507
5501
|
"<!--/--><!--#-->",
|
|
5508
5502
|
"<!--/--><!--#-->",
|
|
5509
5503
|
"<!--/--></div></div></div>"
|
|
5510
5504
|
];
|
|
5511
|
-
const $
|
|
5505
|
+
const $85b747260aa175c9$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
|
|
5512
5506
|
const actual_function = ({ make_product_count_: make_product_count_ , set_observed_results_filters_elements_: set_observed_results_filters_elements_ , is_slim_: is_slim_ , sort_and_filter_element_: sort_and_filter_element_ , extra_sort_and_filter_args_: extra_sort_and_filter_args_ })=>{
|
|
5513
5507
|
// this does two things: make the sorting and filters button the same width and move the number of products out of the SortAndFilter middle_elements_ if it doesn't fit
|
|
5514
5508
|
let extra_sort_button_;
|
|
@@ -5529,7 +5523,7 @@ const $93e94e7b0aa8ca88$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
|
|
|
5529
5523
|
extra_sort_and_filter_args_.sort_button_width_ = sort_button_width_;
|
|
5530
5524
|
const on_filters_constructed_ = ()=>{
|
|
5531
5525
|
const active_sort_and_filter_element = (0, $diwD4$solidjs.untrack)(sort_and_filter_element_); // We assume that this doesn't change which it currently doesn't after the filters have been constructed
|
|
5532
|
-
const extra_sort_and_filter_container_ = (0, $diwD4$solidjsweb.ssr)($
|
|
5526
|
+
const extra_sort_and_filter_container_ = (0, $diwD4$solidjsweb.ssr)($85b747260aa175c9$var$_tmpl$, (0, $diwD4$solidjsweb.ssrHydrationKey)(), (0, $diwD4$solidjsweb.escape)(extra_filter_button_), (0, $diwD4$solidjsweb.escape)(extra_count), (0, $diwD4$solidjsweb.escape)(extra_sort_button_));
|
|
5533
5527
|
set_observed_results_filters_elements_(extra_sort_and_filter_container_);
|
|
5534
5528
|
const [total_available_width, set_total_available_width] = (0, $diwD4$solidjs.createSignal)();
|
|
5535
5529
|
const [filter_button_required_width, set_filter_button_required_width] = (0, $diwD4$solidjs.createSignal)();
|
|
@@ -5583,15 +5577,15 @@ const $93e94e7b0aa8ca88$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
|
|
|
5583
5577
|
on_filters_constructed_: on_filters_constructed_
|
|
5584
5578
|
};
|
|
5585
5579
|
};
|
|
5586
|
-
actual_function[
|
|
5580
|
+
actual_function[0, $6b502b1b2155a0bc$export$5c28802497c8a83c] = "interactive";
|
|
5587
5581
|
return actual_function;
|
|
5588
5582
|
})();
|
|
5589
5583
|
|
|
5590
5584
|
|
|
5591
5585
|
|
|
5592
|
-
const $
|
|
5593
|
-
const $
|
|
5594
|
-
async function $
|
|
5586
|
+
const $63b10c9f461e0ef6$var$TEN_MINUTES = 600000;
|
|
5587
|
+
const $63b10c9f461e0ef6$var$TWENTY_FOUR_HOURS = 86400000;
|
|
5588
|
+
async function $63b10c9f461e0ef6$export$643598a327b5833e(tenant, market, type) {
|
|
5595
5589
|
let localstorage_value;
|
|
5596
5590
|
const localstorage_key = `depict_${tenant}_${type ?? "categories"}_` + market;
|
|
5597
5591
|
try {
|
|
@@ -5605,11 +5599,11 @@ async function $7b4bc889571cc67b$export$643598a327b5833e(tenant, market, type) {
|
|
|
5605
5599
|
const stored_queries = localstorage_value?.queries;
|
|
5606
5600
|
if (Array.isArray(stored_queries) && typeof updated === "number") {
|
|
5607
5601
|
const age = now - updated;
|
|
5608
|
-
if (stored_queries.length && age < $
|
|
5602
|
+
if (stored_queries.length && age < $63b10c9f461e0ef6$var$TEN_MINUTES) // if younger than 10 minutes and probably valid data, just return stored value
|
|
5609
5603
|
return stored_queries;
|
|
5610
|
-
else if (age < $
|
|
5604
|
+
else if (age < $63b10c9f461e0ef6$var$TWENTY_FOUR_HOURS) {
|
|
5611
5605
|
// if younger than a day, return stored value but still trigger re-fetch, so we have fresh data next page load (stale data this one but never a delay)
|
|
5612
|
-
$
|
|
5606
|
+
$63b10c9f461e0ef6$var$fetch_and_store_categories(tenant, market, localstorage_key, type).catch((e)=>(0, $diwD4$depictaiutilishared.report)([
|
|
5613
5607
|
e,
|
|
5614
5608
|
"couldn't fetch categories"
|
|
5615
5609
|
], "warning"));
|
|
@@ -5617,10 +5611,10 @@ async function $7b4bc889571cc67b$export$643598a327b5833e(tenant, market, type) {
|
|
|
5617
5611
|
}
|
|
5618
5612
|
// else: we are older and just fetch, store and return new queries
|
|
5619
5613
|
}
|
|
5620
|
-
return await $
|
|
5614
|
+
return await $63b10c9f461e0ef6$var$fetch_and_store_categories(tenant, market, localstorage_key, type);
|
|
5621
5615
|
}
|
|
5622
|
-
async function $
|
|
5623
|
-
const new_categories = await $
|
|
5616
|
+
async function $63b10c9f461e0ef6$var$fetch_and_store_categories(tenant, market, localstorage_key, type) {
|
|
5617
|
+
const new_categories = await $63b10c9f461e0ef6$var$download_categories(tenant, market, type);
|
|
5624
5618
|
try {
|
|
5625
5619
|
localStorage[localstorage_key] = JSON.stringify({
|
|
5626
5620
|
updated: +new Date(),
|
|
@@ -5634,7 +5628,7 @@ async function $7b4bc889571cc67b$var$fetch_and_store_categories(tenant, market,
|
|
|
5634
5628
|
}
|
|
5635
5629
|
return new_categories;
|
|
5636
5630
|
}
|
|
5637
|
-
async function $
|
|
5631
|
+
async function $63b10c9f461e0ef6$var$download_categories(tenant, market, type) {
|
|
5638
5632
|
const fetched = await (0, $diwD4$depictaiutilishared.fetch_retry)((0, $diwD4$depictaiutilishared.base_url) + "/v2/product-listing/queries", {
|
|
5639
5633
|
method: "POST",
|
|
5640
5634
|
body: JSON.stringify({
|