@depict-ai/ui 1.1.4 → 1.1.5
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 +15 -7
- package/dist/client/main.js +9068 -0
- package/dist/client/module.js +15 -7
- package/dist/index.d.ts +1 -1
- package/dist/server/main.cjs +15 -7
- package/dist/server/main.js +8063 -0
- package/dist/server/module.js +15 -7
- package/locales/require.js +1154 -0
- package/package.json +4 -4
package/dist/client/module.js
CHANGED
|
@@ -2,7 +2,7 @@ import {add_to_version_info as $gco9i$add_to_version_info, observer as $gco9i$ob
|
|
|
2
2
|
import {createRoot as $gco9i$createRoot, createSignal as $gco9i$createSignal, getOwner as $gco9i$getOwner, runWithOwner as $gco9i$runWithOwner, onCleanup as $gco9i$onCleanup, createComputed as $gco9i$createComputed, createRenderEffect as $gco9i$createRenderEffect, createEffect as $gco9i$createEffect, untrack as $gco9i$untrack, batch as $gco9i$batch, createResource as $gco9i$createResource, createMemo as $gco9i$createMemo, Show as $gco9i$Show, createReaction as $gco9i$createReaction, Suspense as $gco9i$Suspense, on as $gco9i$on, ErrorBoundary as $gco9i$ErrorBoundary, For as $gco9i$For, Index as $gco9i$Index} from "solid-js";
|
|
3
3
|
import {template as $gco9i$template, getNextElement as $gco9i$getNextElement, spread as $gco9i$spread, mergeProps as $gco9i$mergeProps, runHydrationEvents as $gco9i$runHydrationEvents, effect as $gco9i$effect, setAttribute as $gco9i$setAttribute, insert as $gco9i$insert, isServer as $gco9i$isServer, createComponent as $gco9i$createComponent, getNextMarker as $gco9i$getNextMarker, use as $gco9i$use, memo as $gco9i$memo, addEventListener as $gco9i$addEventListener, delegateEvents as $gco9i$delegateEvents, classList as $gco9i$classList, style as $gco9i$style, className as $gco9i$className, Dynamic as $gco9i$Dynamic} from "solid-js/web";
|
|
4
4
|
|
|
5
|
-
/*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.1.
|
|
5
|
+
/*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.1.5";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -268,7 +268,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
268
268
|
if (this.#supports_finalization_registry) cache_obj.finalization_registry_.register(result, body); // delete key from cache when value (WeakRefs) are collected
|
|
269
269
|
else // delete things from cache after 5 minutes, so it doesn't get too heavy
|
|
270
270
|
setTimeout((0, $gco9i$catchify)(()=>delete cache_obj.cache_[body]), 300000);
|
|
271
|
-
}),
|
|
271
|
+
}), 60000 // cache values for at least 60 seconds
|
|
272
272
|
);
|
|
273
273
|
return result;
|
|
274
274
|
} finally{
|
|
@@ -1148,6 +1148,7 @@ function $0449e7d49398c077$export$a1fd619a4743ca08({ plp_results_: plp_results_
|
|
|
1148
1148
|
const record = records[i];
|
|
1149
1149
|
const { target: target , intersectionRatio: intersectionRatio } = record;
|
|
1150
1150
|
const index_of_target = target_to_index_map.get(target);
|
|
1151
|
+
if (index_of_target == undefined) return; // It seems like it can happen that we get IntersectionObserverEntries after the onCleanup function for a recommendation card has run, in Firefox. Probably a bug in Firefox? If I understood the bug correctly, this is a workaround.
|
|
1151
1152
|
const is_in_set = currently_intersecting.has(index_of_target);
|
|
1152
1153
|
if (intersectionRatio > 0) {
|
|
1153
1154
|
if (!is_in_set) currently_intersecting.add(index_of_target);
|
|
@@ -5067,23 +5068,30 @@ function $641bba2917fe862b$export$6e49da55e449af7c({ scroll_restoration_data_: [
|
|
|
5067
5068
|
]); // get rid of old data the browser saves the old state and will restore it later on
|
|
5068
5069
|
};
|
|
5069
5070
|
(0, $gco9i$createComputed)((0, $gco9i$catchify)(()=>{
|
|
5070
|
-
const
|
|
5071
|
-
if (
|
|
5071
|
+
const last_result = get_last_result_in_viewport_();
|
|
5072
|
+
if (last_result == undefined || last_result <= 0 || last_result == Infinity) return;
|
|
5073
|
+
if (isNaN(last_result)) {
|
|
5074
|
+
// if last_result is NaN there's an issue somewhere, but if we store something here that's not a number the for loop further down will break, and we won't be able to load results at all, so let's just continue
|
|
5075
|
+
(0, $gco9i$report)(new Error("last_result is NaN, this should not happen"), "error", {
|
|
5076
|
+
last_result: last_result
|
|
5077
|
+
});
|
|
5078
|
+
return;
|
|
5079
|
+
}
|
|
5072
5080
|
// We can push to history.state max 100 times per 30 seconds (Safari) so we have to debounce/cap this at 300ms for aggressive scrolling.
|
|
5073
5081
|
// Pushing to history.state right before we leave the page (onunload etc.) is unreliable, as it has to occur *before* the next page is pushed to history.
|
|
5074
|
-
// Instead we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
|
|
5082
|
+
// Instead, we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
|
|
5075
5083
|
const now = +new Date();
|
|
5076
5084
|
const time_since_last_ran = now - last_time_history_changed;
|
|
5077
5085
|
if (time_since_last_ran > $641bba2917fe862b$var$max_history_change_frequency) {
|
|
5078
5086
|
// If the interval to the previous push is already long enough, it's fine to push the next value directly.
|
|
5079
|
-
set_min_results_loaded(
|
|
5087
|
+
set_min_results_loaded(last_result);
|
|
5080
5088
|
last_time_history_changed = now;
|
|
5081
5089
|
// Even though the interval has passed, there could still be a delayed push timeout in flight (browser can delay timeouts at will).
|
|
5082
5090
|
// We've already written the guaranteed-to-be-freshest value so we can just cancel it.
|
|
5083
5091
|
clearTimeout(timeout);
|
|
5084
5092
|
return;
|
|
5085
5093
|
}
|
|
5086
|
-
set_to_later =
|
|
5094
|
+
set_to_later = last_result;
|
|
5087
5095
|
// If a delayed push timeout is already running, just changing the value that will be pushed is sufficient
|
|
5088
5096
|
if (timeout) return;
|
|
5089
5097
|
timeout = setTimeout((0, $gco9i$catchify)(()=>{
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { SearchSuggestionsResponse, CategorySuggestion } from "@depict-ai/types/
|
|
|
7
7
|
import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
|
|
8
8
|
import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
|
|
9
9
|
import { ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
|
|
10
|
-
export const version = "1.1.
|
|
10
|
+
export const version = "1.1.5";
|
|
11
11
|
/**
|
|
12
12
|
* Basically allows you to use SearchModal
|
|
13
13
|
* 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.
|
package/dist/server/main.cjs
CHANGED
|
@@ -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.1.
|
|
46
|
+
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.1.5";
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
@@ -293,7 +293,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
293
293
|
if (this.#supports_finalization_registry) cache_obj.finalization_registry_.register(result, body); // delete key from cache when value (WeakRefs) are collected
|
|
294
294
|
else // delete things from cache after 5 minutes, so it doesn't get too heavy
|
|
295
295
|
setTimeout((0, $diwD4$depictaiutilishared.catchify)(()=>delete cache_obj.cache_[body]), 300000);
|
|
296
|
-
}),
|
|
296
|
+
}), 60000 // cache values for at least 60 seconds
|
|
297
297
|
);
|
|
298
298
|
return result;
|
|
299
299
|
} finally{
|
|
@@ -947,6 +947,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({ plp_results_: plp_results_
|
|
|
947
947
|
const record = records[i];
|
|
948
948
|
const { target: target , intersectionRatio: intersectionRatio } = record;
|
|
949
949
|
const index_of_target = target_to_index_map.get(target);
|
|
950
|
+
if (index_of_target == undefined) return; // It seems like it can happen that we get IntersectionObserverEntries after the onCleanup function for a recommendation card has run, in Firefox. Probably a bug in Firefox? If I understood the bug correctly, this is a workaround.
|
|
950
951
|
const is_in_set = currently_intersecting.has(index_of_target);
|
|
951
952
|
if (intersectionRatio > 0) {
|
|
952
953
|
if (!is_in_set) currently_intersecting.add(index_of_target);
|
|
@@ -4346,23 +4347,30 @@ function $276380e4607fb9fb$export$6e49da55e449af7c({ scroll_restoration_data_: [
|
|
|
4346
4347
|
]); // get rid of old data the browser saves the old state and will restore it later on
|
|
4347
4348
|
};
|
|
4348
4349
|
(0, $diwD4$solidjs.createComputed)((0, $diwD4$depictaiutilishared.catchify)(()=>{
|
|
4349
|
-
const
|
|
4350
|
-
if (
|
|
4350
|
+
const last_result = get_last_result_in_viewport_();
|
|
4351
|
+
if (last_result == undefined || last_result <= 0 || last_result == Infinity) return;
|
|
4352
|
+
if (isNaN(last_result)) {
|
|
4353
|
+
// if last_result is NaN there's an issue somewhere, but if we store something here that's not a number the for loop further down will break, and we won't be able to load results at all, so let's just continue
|
|
4354
|
+
(0, $diwD4$depictaiutilishared.report)(new Error("last_result is NaN, this should not happen"), "error", {
|
|
4355
|
+
last_result: last_result
|
|
4356
|
+
});
|
|
4357
|
+
return;
|
|
4358
|
+
}
|
|
4351
4359
|
// We can push to history.state max 100 times per 30 seconds (Safari) so we have to debounce/cap this at 300ms for aggressive scrolling.
|
|
4352
4360
|
// Pushing to history.state right before we leave the page (onunload etc.) is unreliable, as it has to occur *before* the next page is pushed to history.
|
|
4353
|
-
// Instead we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
|
|
4361
|
+
// Instead, we delay our push with a timeout set to the next acceptable interval to the previous one, when necessary
|
|
4354
4362
|
const now = +new Date();
|
|
4355
4363
|
const time_since_last_ran = now - last_time_history_changed;
|
|
4356
4364
|
if (time_since_last_ran > $276380e4607fb9fb$var$max_history_change_frequency) {
|
|
4357
4365
|
// If the interval to the previous push is already long enough, it's fine to push the next value directly.
|
|
4358
|
-
set_min_results_loaded(
|
|
4366
|
+
set_min_results_loaded(last_result);
|
|
4359
4367
|
last_time_history_changed = now;
|
|
4360
4368
|
// Even though the interval has passed, there could still be a delayed push timeout in flight (browser can delay timeouts at will).
|
|
4361
4369
|
// We've already written the guaranteed-to-be-freshest value so we can just cancel it.
|
|
4362
4370
|
clearTimeout(timeout);
|
|
4363
4371
|
return;
|
|
4364
4372
|
}
|
|
4365
|
-
set_to_later =
|
|
4373
|
+
set_to_later = last_result;
|
|
4366
4374
|
// If a delayed push timeout is already running, just changing the value that will be pushed is sufficient
|
|
4367
4375
|
if (timeout) return;
|
|
4368
4376
|
timeout = setTimeout((0, $diwD4$depictaiutilishared.catchify)(()=>{
|