@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/client/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
|
|
|
@@ -331,23 +331,10 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
331
331
|
let resolve_in_progress;
|
|
332
332
|
cache_obj.in_progress_[body] = new Promise((r)=>resolve_in_progress = r);
|
|
333
333
|
try {
|
|
334
|
-
|
|
334
|
+
const api_response = await (0, $57o7A$depictaiutilishared.fetch_retry)((0, $57o7A$depictaiutilishared.add_version_query_params)(endpoint1), {
|
|
335
335
|
method: "POST",
|
|
336
336
|
body: body
|
|
337
337
|
});
|
|
338
|
-
if ("query_id" in request && request.type === "collection") // FIXME: Remove. Backwards compatibility layer
|
|
339
|
-
// This will retry the request without the collection type if the first request fails
|
|
340
|
-
{
|
|
341
|
-
if (!api_response || api_response?.status === 404) {
|
|
342
|
-
(0, $57o7A$depictaiutilishared.dlog)("Fallback request for collections due to failure");
|
|
343
|
-
const fallback_body = JSON.parse(body);
|
|
344
|
-
delete fallback_body.type;
|
|
345
|
-
api_response = await (0, $57o7A$depictaiutilishared.fetch_retry)((0, $57o7A$depictaiutilishared.add_version_query_params)(endpoint1), {
|
|
346
|
-
method: "POST",
|
|
347
|
-
body: JSON.stringify(fallback_body)
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
338
|
return_successfully: {
|
|
352
339
|
if (!api_response || api_response.status !== 200) break return_successfully;
|
|
353
340
|
let result;
|
|
@@ -2266,10 +2253,10 @@ function $c1dc1554c1b94233$export$430444115f70a734({ selected_filters_: selected
|
|
|
2266
2253
|
}), _el$10, _co$2);
|
|
2267
2254
|
(0, $57o7A$solidjsweb.effect)(()=>_el$2.classList.toggle("count-0", !!(count() === 0)));
|
|
2268
2255
|
(0, $57o7A$solidjsweb.effect)(()=>_el$4.checked = (0, $57o7A$solidjs.createMemo)(()=>{
|
|
2256
|
+
const v = value();
|
|
2269
2257
|
const data = existing_filter()?.data;
|
|
2270
|
-
if (data ===
|
|
2271
|
-
|
|
2272
|
-
return false;
|
|
2258
|
+
if (data === v) return true;
|
|
2259
|
+
return Array.isArray(data) && data.every((item, index)=>item === v[index]);
|
|
2273
2260
|
})());
|
|
2274
2261
|
return _el$2;
|
|
2275
2262
|
})();
|
|
@@ -5300,9 +5287,9 @@ let $0b6e2070a98de347$export$44dad306455dddf;
|
|
|
5300
5287
|
|
|
5301
5288
|
|
|
5302
5289
|
|
|
5303
|
-
function $
|
|
5290
|
+
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_ }) {
|
|
5304
5291
|
// If we just got opened in a new tab, clear filters instantly and remove the flag
|
|
5305
|
-
$
|
|
5292
|
+
$ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
|
|
5306
5293
|
plp_results_: plp_results_,
|
|
5307
5294
|
local_filter_cache_: local_filter_cache_,
|
|
5308
5295
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
@@ -5346,7 +5333,7 @@ function $cc7c480116d2eba0$export$3945d6db2dfd3d12({ crumb_data_: crumb_data_ ,
|
|
|
5346
5333
|
if (!allow_filter_clearing) allow_filter_clearing = true;
|
|
5347
5334
|
})));
|
|
5348
5335
|
}
|
|
5349
|
-
function $
|
|
5336
|
+
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_] }) {
|
|
5350
5337
|
const tracking_function_for_plp_results = (0, $57o7A$solidjs.createReaction)(()=>{
|
|
5351
5338
|
// 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
|
|
5352
5339
|
if (!(0, $57o7A$solidjs.untrack)(get_sideways_filter_clearing_flag_)) return;
|
|
@@ -5376,8 +5363,8 @@ function $cc7c480116d2eba0$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
5376
5363
|
|
|
5377
5364
|
|
|
5378
5365
|
|
|
5379
|
-
const $
|
|
5380
|
-
function $
|
|
5366
|
+
const $839b3341523d31a2$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="statement">No category ID specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a category ID in your Depict Provider.</div>`, 2), $839b3341523d31a2$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="buttons"><button class="ok major"></button></div>`, 4);
|
|
5367
|
+
function $839b3341523d31a2$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
5381
5368
|
if (!(0, $57o7A$depictaiutilishared.is_debug)) return; // Just to make sure we don't show this in production
|
|
5382
5369
|
const owner = (0, $57o7A$solidjs.getOwner)();
|
|
5383
5370
|
const disconnect = (0, $57o7A$depictaiutilishared.observer).onexists(el, ({ element: element })=>(0, $57o7A$solidjs.runWithOwner)(owner, ()=>(0, $57o7A$solidjs.createEffect)(()=>{
|
|
@@ -5392,9 +5379,9 @@ function $cafad5eca9f09cb5$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
|
5392
5379
|
background: "#ffb830"
|
|
5393
5380
|
},
|
|
5394
5381
|
children: [
|
|
5395
|
-
(0, $57o7A$solidjsweb.getNextElement)($
|
|
5382
|
+
(0, $57o7A$solidjsweb.getNextElement)($839b3341523d31a2$var$_tmpl$),
|
|
5396
5383
|
(()=>{
|
|
5397
|
-
const _el$2 = (0, $57o7A$solidjsweb.getNextElement)($
|
|
5384
|
+
const _el$2 = (0, $57o7A$solidjsweb.getNextElement)($839b3341523d31a2$var$_tmpl$2), _el$3 = _el$2.firstChild;
|
|
5398
5385
|
_el$3.$$click = ()=>close_toast_() /* We have to wait for close_toast_ to get defined after the call to show_toast */ ;
|
|
5399
5386
|
(0, $57o7A$solidjsweb.insert)(_el$3, ()=>i18n_.ok_());
|
|
5400
5387
|
(0, $57o7A$solidjsweb.runHydrationEvents)();
|
|
@@ -5413,6 +5400,9 @@ function $cafad5eca9f09cb5$export$d4fc5c0e68a52116(el, query_id_, i18n_) {
|
|
|
5413
5400
|
|
|
5414
5401
|
|
|
5415
5402
|
|
|
5403
|
+
const $6b502b1b2155a0bc$export$5c28802497c8a83c = /*@__PURE__*/ Symbol("category_title_type");
|
|
5404
|
+
|
|
5405
|
+
|
|
5416
5406
|
const $840d88a04b2d22a7$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="product-count"><!#><!/> <!#><!/></div>`, 6), $840d88a04b2d22a7$var$_tmpl$2 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div></div>`, 2), $840d88a04b2d22a7$var$_tmpl$3 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="filter-results-for-one-row"><!#><!/><!#><!/></div>`, 6), $840d88a04b2d22a7$var$_tmpl$4 = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="depict plp category"><div class="listing-page"><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/></div><!#><!/><!#><!/></div>`, 20);
|
|
5417
5407
|
function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ , query_id_: query_id_ , listing_type_: listing_type_ , current_sorting_: current_sorting_ , min_products_to_fetch_: min_products_to_fetch_ , category_filters_open_: category_filters_open_ , category_sorting_open_: category_sorting_open_ , expanded_filters_: expanded_filters_ , selected_filters_: selected_filters_ , get_quicklinks_accessor_: get_quicklinks_accessor_ , i18n_: incoming_i18n , get_breadcrumb_accessor_: get_breadcrumb_accessor_ , expanded_hierarchical_filters_: expanded_hierarchical_filters_ , local_filter_cache_: local_filter_cache_ , tenant_: tenant_ , market_: market_ , router_: router_ , show_quicklinks_: show_quicklinks_ , category_title_: category_title_ , show_breadcrumbs_: show_breadcrumbs_ , layout_options_: layout_options_ , scroll_restoration_data_: scroll_restoration_data_ , product_card_template_: product_card_template_ , sideways_filter_clearing_flag_: sideways_filter_clearing_flag_ }) {
|
|
5418
5408
|
let results_for;
|
|
@@ -5478,7 +5468,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
5478
5468
|
const [results_filters, set_results_filters] = (0, $57o7A$solidjs.createSignal)();
|
|
5479
5469
|
const [observed_results_filters_elements, set_observed_results_filters_elements_] = (0, $57o7A$solidjs.createSignal)();
|
|
5480
5470
|
const is_slim_ = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-width:600px)");
|
|
5481
|
-
|
|
5471
|
+
// @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
|
|
5472
|
+
const category_title_type = category_title_[0, $6b502b1b2155a0bc$export$5c28802497c8a83c];
|
|
5482
5473
|
const extra_sort_and_filter_args_ = {};
|
|
5483
5474
|
const make_product_count_ = ()=>(()=>{
|
|
5484
5475
|
const _el$ = (0, $57o7A$solidjsweb.getNextElement)($840d88a04b2d22a7$var$_tmpl$), _el$3 = _el$.firstChild, [_el$4, _co$] = (0, $57o7A$solidjsweb.getNextMarker)(_el$3.nextSibling), _el$2 = _el$4.nextSibling, _el$5 = _el$2.nextSibling, [_el$6, _co$2] = (0, $57o7A$solidjsweb.getNextMarker)(_el$5.nextSibling);
|
|
@@ -5584,7 +5575,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
5584
5575
|
selected_filters_: selected_filters_,
|
|
5585
5576
|
available_filters_: available_filters_
|
|
5586
5577
|
});
|
|
5587
|
-
(0, $
|
|
5578
|
+
(0, $ef972f5c10b1c5b4$export$3945d6db2dfd3d12)({
|
|
5588
5579
|
query_id_: query_id_,
|
|
5589
5580
|
crumb_data_: crumb_data_,
|
|
5590
5581
|
i18n_: i18n_,
|
|
@@ -5600,7 +5591,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({ depict_api_: depict_api_ ,
|
|
|
5600
5591
|
(0, $57o7A$solidjsweb.isServer) ? "<!-- Category page based on Depict SDK -->" : document.createComment("Category page based on Depict SDK"),
|
|
5601
5592
|
(()=>{
|
|
5602
5593
|
const _el$13 = (0, $57o7A$solidjsweb.getNextElement)($840d88a04b2d22a7$var$_tmpl$4), _el$14 = _el$13.firstChild, _el$15 = _el$14.firstChild, [_el$16, _co$5] = (0, $57o7A$solidjsweb.getNextMarker)(_el$15.nextSibling), _el$17 = _el$16.nextSibling, [_el$18, _co$6] = (0, $57o7A$solidjsweb.getNextMarker)(_el$17.nextSibling), _el$19 = _el$18.nextSibling, [_el$20, _co$7] = (0, $57o7A$solidjsweb.getNextMarker)(_el$19.nextSibling), _el$21 = _el$20.nextSibling, [_el$22, _co$8] = (0, $57o7A$solidjsweb.getNextMarker)(_el$21.nextSibling), _el$23 = _el$22.nextSibling, [_el$24, _co$9] = (0, $57o7A$solidjsweb.getNextMarker)(_el$23.nextSibling), _el$25 = _el$24.nextSibling, [_el$26, _co$10] = (0, $57o7A$solidjsweb.getNextMarker)(_el$25.nextSibling), _el$27 = _el$14.nextSibling, [_el$28, _co$11] = (0, $57o7A$solidjsweb.getNextMarker)(_el$27.nextSibling), _el$29 = _el$28.nextSibling, [_el$30, _co$12] = (0, $57o7A$solidjsweb.getNextMarker)(_el$29.nextSibling);
|
|
5603
|
-
(0, $57o7A$solidjsweb.use)((el)=>process.env.NODE_ENV === "development" && (0, $
|
|
5594
|
+
(0, $57o7A$solidjsweb.use)((el)=>process.env.NODE_ENV === "development" && (0, $839b3341523d31a2$export$d4fc5c0e68a52116)(el, query_id_, i18n_), _el$13);
|
|
5604
5595
|
(0, $57o7A$solidjsweb.insert)(_el$14, (0, $57o7A$solidjsweb.createComponent)((0, $57o7A$solidjs.Show), {
|
|
5605
5596
|
when: show_breadcrumbs_,
|
|
5606
5597
|
get children () {
|
|
@@ -6216,6 +6207,7 @@ function $48567ac5b39bac56$var$get_shared_properties(depict_category) {
|
|
|
6216
6207
|
|
|
6217
6208
|
|
|
6218
6209
|
|
|
6210
|
+
|
|
6219
6211
|
const $0b23bfd073d9a4e8$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div class="category-title"><h1 class="title"></h1><span class="explanation"> — <!#><!/></span></div>`, 8);
|
|
6220
6212
|
const $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1 = /*@__PURE__*/ (()=>{
|
|
6221
6213
|
const actual_function = ({ category_title_: category_title_ , product_count_: product_count_ })=>{
|
|
@@ -6229,7 +6221,8 @@ const $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1 = /*@__PURE__*/ (()=>{
|
|
|
6229
6221
|
return _el$;
|
|
6230
6222
|
})();
|
|
6231
6223
|
};
|
|
6232
|
-
|
|
6224
|
+
// This is wrong but parcel can't build correctly, it says unexpected undefined
|
|
6225
|
+
actual_function[0, $6b502b1b2155a0bc$export$5c28802497c8a83c] = "simple";
|
|
6233
6226
|
return actual_function;
|
|
6234
6227
|
})();
|
|
6235
6228
|
|
|
@@ -6240,8 +6233,9 @@ const $0b23bfd073d9a4e8$export$b91cec6bdc6b32a1 = /*@__PURE__*/ (()=>{
|
|
|
6240
6233
|
|
|
6241
6234
|
|
|
6242
6235
|
|
|
6243
|
-
|
|
6244
|
-
const $
|
|
6236
|
+
|
|
6237
|
+
const $85b747260aa175c9$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$57o7A$solidjsweb.template)(`<div 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"><!#><!/><!#><!/><!#><!/></div></div></div>`, 12);
|
|
6238
|
+
const $85b747260aa175c9$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
|
|
6245
6239
|
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_ })=>{
|
|
6246
6240
|
// 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
|
|
6247
6241
|
let extra_sort_button_;
|
|
@@ -6263,7 +6257,7 @@ const $93e94e7b0aa8ca88$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
|
|
|
6263
6257
|
const on_filters_constructed_ = ()=>{
|
|
6264
6258
|
const active_sort_and_filter_element = (0, $57o7A$solidjs.untrack)(sort_and_filter_element_); // We assume that this doesn't change which it currently doesn't after the filters have been constructed
|
|
6265
6259
|
const extra_sort_and_filter_container_ = (()=>{
|
|
6266
|
-
const _el$ = (0, $57o7A$solidjsweb.getNextElement)($
|
|
6260
|
+
const _el$ = (0, $57o7A$solidjsweb.getNextElement)($85b747260aa175c9$var$_tmpl$), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, [_el$5, _co$] = (0, $57o7A$solidjsweb.getNextMarker)(_el$4.nextSibling), _el$6 = _el$5.nextSibling, [_el$7, _co$2] = (0, $57o7A$solidjsweb.getNextMarker)(_el$6.nextSibling), _el$8 = _el$7.nextSibling, [_el$9, _co$3] = (0, $57o7A$solidjsweb.getNextMarker)(_el$8.nextSibling);
|
|
6267
6261
|
(0, $57o7A$solidjsweb.insert)(_el$3, extra_filter_button_, _el$5, _co$);
|
|
6268
6262
|
(0, $57o7A$solidjsweb.insert)(_el$3, extra_count, _el$7, _co$2);
|
|
6269
6263
|
(0, $57o7A$solidjsweb.insert)(_el$3, extra_sort_button_, _el$9, _co$3);
|
|
@@ -6322,15 +6316,15 @@ const $93e94e7b0aa8ca88$export$824dde41348efed1 = /*@__PURE__*/ (()=>{
|
|
|
6322
6316
|
on_filters_constructed_: on_filters_constructed_
|
|
6323
6317
|
};
|
|
6324
6318
|
};
|
|
6325
|
-
actual_function[
|
|
6319
|
+
actual_function[0, $6b502b1b2155a0bc$export$5c28802497c8a83c] = "interactive";
|
|
6326
6320
|
return actual_function;
|
|
6327
6321
|
})();
|
|
6328
6322
|
|
|
6329
6323
|
|
|
6330
6324
|
|
|
6331
|
-
const $
|
|
6332
|
-
const $
|
|
6333
|
-
async function $
|
|
6325
|
+
const $63b10c9f461e0ef6$var$TEN_MINUTES = 600000;
|
|
6326
|
+
const $63b10c9f461e0ef6$var$TWENTY_FOUR_HOURS = 86400000;
|
|
6327
|
+
async function $63b10c9f461e0ef6$export$643598a327b5833e(tenant, market, type) {
|
|
6334
6328
|
let localstorage_value;
|
|
6335
6329
|
const localstorage_key = `depict_${tenant}_${type ?? "categories"}_` + market;
|
|
6336
6330
|
try {
|
|
@@ -6344,11 +6338,11 @@ async function $7b4bc889571cc67b$export$643598a327b5833e(tenant, market, type) {
|
|
|
6344
6338
|
const stored_queries = localstorage_value?.queries;
|
|
6345
6339
|
if (Array.isArray(stored_queries) && typeof updated === "number") {
|
|
6346
6340
|
const age = now - updated;
|
|
6347
|
-
if (stored_queries.length && age < $
|
|
6341
|
+
if (stored_queries.length && age < $63b10c9f461e0ef6$var$TEN_MINUTES) // if younger than 10 minutes and probably valid data, just return stored value
|
|
6348
6342
|
return stored_queries;
|
|
6349
|
-
else if (age < $
|
|
6343
|
+
else if (age < $63b10c9f461e0ef6$var$TWENTY_FOUR_HOURS) {
|
|
6350
6344
|
// 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)
|
|
6351
|
-
$
|
|
6345
|
+
$63b10c9f461e0ef6$var$fetch_and_store_categories(tenant, market, localstorage_key, type).catch((e)=>(0, $57o7A$depictaiutilishared.report)([
|
|
6352
6346
|
e,
|
|
6353
6347
|
"couldn't fetch categories"
|
|
6354
6348
|
], "warning"));
|
|
@@ -6356,10 +6350,10 @@ async function $7b4bc889571cc67b$export$643598a327b5833e(tenant, market, type) {
|
|
|
6356
6350
|
}
|
|
6357
6351
|
// else: we are older and just fetch, store and return new queries
|
|
6358
6352
|
}
|
|
6359
|
-
return await $
|
|
6353
|
+
return await $63b10c9f461e0ef6$var$fetch_and_store_categories(tenant, market, localstorage_key, type);
|
|
6360
6354
|
}
|
|
6361
|
-
async function $
|
|
6362
|
-
const new_categories = await $
|
|
6355
|
+
async function $63b10c9f461e0ef6$var$fetch_and_store_categories(tenant, market, localstorage_key, type) {
|
|
6356
|
+
const new_categories = await $63b10c9f461e0ef6$var$download_categories(tenant, market, type);
|
|
6363
6357
|
try {
|
|
6364
6358
|
localStorage[localstorage_key] = JSON.stringify({
|
|
6365
6359
|
updated: +new Date(),
|
|
@@ -6373,7 +6367,7 @@ async function $7b4bc889571cc67b$var$fetch_and_store_categories(tenant, market,
|
|
|
6373
6367
|
}
|
|
6374
6368
|
return new_categories;
|
|
6375
6369
|
}
|
|
6376
|
-
async function $
|
|
6370
|
+
async function $63b10c9f461e0ef6$var$download_categories(tenant, market, type) {
|
|
6377
6371
|
const fetched = await (0, $57o7A$depictaiutilishared.fetch_retry)((0, $57o7A$depictaiutilishared.base_url) + "/v2/product-listing/queries", {
|
|
6378
6372
|
method: "POST",
|
|
6379
6373
|
body: JSON.stringify({
|