@depict-ai/ui 2.1.1 → 2.1.2
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 +26 -30
- package/ES10/index.d.ts +4 -4
- package/ES10/index.js +26 -30
- package/latest/index.cjs +26 -30
- package/latest/index.d.ts +4 -4
- package/latest/index.js +26 -30
- package/package.json +1 -1
- package/server/ES10/index.cjs +29 -31
- package/server/ES10/index.d.ts +4 -4
- package/server/ES10/index.js +29 -31
- package/server/latest/index.cjs +29 -31
- package/server/latest/index.d.ts +4 -4
- package/server/latest/index.js +29 -31
package/ES10/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
|
|
|
76
76
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
|
|
77
77
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
78
78
|
/*! Depict.ai search and product listing SDK */
|
|
79
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.
|
|
79
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.2";
|
|
80
80
|
const $a68b73fd7ba0853f$var$fallback_operator = "in";
|
|
81
81
|
const $a68b73fd7ba0853f$var$fallback_token = "";
|
|
82
82
|
const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
|
|
@@ -4970,8 +4970,7 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
4970
4970
|
query_base_: query_base_,
|
|
4971
4971
|
depict_api_: depict_api_,
|
|
4972
4972
|
is_loading_: is_loading_,
|
|
4973
|
-
content_blocks_: content_blocks_
|
|
4974
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4973
|
+
content_blocks_: content_blocks_
|
|
4975
4974
|
} = _ref;
|
|
4976
4975
|
// The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
|
|
4977
4976
|
const target_to_index_map = new Map();
|
|
@@ -5018,7 +5017,6 @@ function $0d3ee7000f047e67$export$a1fd619a4743ca08(_ref) {
|
|
|
5018
5017
|
query_base_: query_base_,
|
|
5019
5018
|
depict_api_: depict_api_
|
|
5020
5019
|
});
|
|
5021
|
-
$52FdA$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
5022
5020
|
return $76012c4468a53d1f$export$43f0fb951fcb0c54({
|
|
5023
5021
|
displays_by_key_: displays_by_key_,
|
|
5024
5022
|
merchant_: merchant_,
|
|
@@ -5224,26 +5222,18 @@ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
|
|
|
5224
5222
|
let {
|
|
5225
5223
|
content_blocks_: incoming_content_blocks,
|
|
5226
5224
|
cols_at_size_: cols_at_size_,
|
|
5227
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
5228
5225
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5229
5226
|
} = _ref;
|
|
5230
5227
|
// these are by row
|
|
5231
5228
|
const [content_blocks, set_content_blocks] = $52FdA$solidjsstore.createStore([]);
|
|
5232
5229
|
const n_cols_currently_showing_ = $85fcdab554c24789$export$a79e666719b3647c(cols_at_size_);
|
|
5233
|
-
const products_to_rows = products => {
|
|
5234
|
-
const cols_currently_showing = n_cols_currently_showing_();
|
|
5235
|
-
if (cols_currently_showing === null) return 0;
|
|
5236
|
-
return Math.ceil(products / cols_currently_showing);
|
|
5237
|
-
};
|
|
5238
|
-
const showing_rows = $52FdA$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
5239
5230
|
$52FdA$solidjs.createEffect(() => {
|
|
5240
5231
|
const incoming_value = incoming_content_blocks();
|
|
5241
5232
|
if (!incoming_value) {
|
|
5242
5233
|
set_content_blocks([]);
|
|
5243
5234
|
return;
|
|
5244
5235
|
}
|
|
5245
|
-
|
|
5246
|
-
set_content_blocks($52FdA$solidjsstore.reconcile(capped_value, {
|
|
5236
|
+
set_content_blocks($52FdA$solidjsstore.reconcile(incoming_value, {
|
|
5247
5237
|
key: "content"
|
|
5248
5238
|
})); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
|
|
5249
5239
|
});
|
|
@@ -5301,12 +5291,12 @@ function $f8f375d6245ffff2$var$remap_blocks_to_index(_ref2) {
|
|
|
5301
5291
|
for (let j = 0; j < i; j++) {
|
|
5302
5292
|
const row = displaced_products[j];
|
|
5303
5293
|
if (row === undefined) continue; // there were no blocks in this row
|
|
5304
|
-
let
|
|
5305
|
-
if (typeof row === "number")
|
|
5306
|
-
|
|
5307
|
-
displaced_products[j] =
|
|
5294
|
+
let displaced_items_in_row;
|
|
5295
|
+
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
5296
|
+
displaced_items_in_row = row.filter(item => item).length;
|
|
5297
|
+
displaced_products[j] = displaced_items_in_row;
|
|
5308
5298
|
}
|
|
5309
|
-
displacement_by_added_blocks +=
|
|
5299
|
+
displacement_by_added_blocks += displaced_items_in_row;
|
|
5310
5300
|
}
|
|
5311
5301
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
5312
5302
|
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
@@ -5351,9 +5341,12 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5351
5341
|
var _max_span_columns;
|
|
5352
5342
|
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
5353
5343
|
};
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5344
|
+
const [rendering_delayed, set_rendering_delayed_] = $52FdA$solidjs.createSignal(true);
|
|
5345
|
+
const content = $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
5346
|
+
get when() {
|
|
5347
|
+
return !rendering_delayed();
|
|
5348
|
+
},
|
|
5349
|
+
get children() {
|
|
5357
5350
|
const _el$ = $52FdA$solidjsweb.getNextElement($f8f375d6245ffff2$var$_tmpl$);
|
|
5358
5351
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent($f8f375d6245ffff2$var$RenderContent, {
|
|
5359
5352
|
get content() {
|
|
@@ -5376,7 +5369,16 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5376
5369
|
_v$3: undefined
|
|
5377
5370
|
});
|
|
5378
5371
|
return _el$;
|
|
5379
|
-
}
|
|
5372
|
+
}
|
|
5373
|
+
});
|
|
5374
|
+
return $52FdA$solidjs.mergeProps(block, {
|
|
5375
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
5376
|
+
content: () => {
|
|
5377
|
+
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
5378
|
+
// However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
|
|
5379
|
+
set_rendering_delayed_(false);
|
|
5380
|
+
return content;
|
|
5381
|
+
},
|
|
5380
5382
|
get span_columns() {
|
|
5381
5383
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
5382
5384
|
return get_span_columns();
|
|
@@ -5473,8 +5475,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5473
5475
|
let fallback_is_alive = false;
|
|
5474
5476
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $52FdA$solidjs.createSignal(true);
|
|
5475
5477
|
const [top_row_shortened_by_, set_top_row_shortened_by_] = $52FdA$solidjs.createSignal(0);
|
|
5476
|
-
|
|
5477
|
-
const [number_loaded_displays, set_number_loaded_displays_] = $52FdA$solidjs.createSignal(0);
|
|
5478
|
+
$52FdA$solidjs.createSignal(false);
|
|
5478
5479
|
const modified_cols_at_size = $c749e60bca5000cb$export$cb5808ba002cdeed({
|
|
5479
5480
|
layout_options_: layout_options_,
|
|
5480
5481
|
sort_or_filter_open_: sort_or_filter_open_
|
|
@@ -5489,12 +5490,10 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5489
5490
|
return for_id === id_currently_querying_for_();
|
|
5490
5491
|
})) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
|
|
5491
5492
|
});
|
|
5492
|
-
const number_of_items_shown_ = $52FdA$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
5493
5493
|
const doesnt_have_content_blocks = $52FdA$solidjs.createMemo(() => !content_blocks_by_row_());
|
|
5494
5494
|
const content_blocks_ = $52FdA$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $f8f375d6245ffff2$export$791ef57e62e21c3f({
|
|
5495
5495
|
content_blocks_: content_blocks_by_row_,
|
|
5496
5496
|
cols_at_size_: modified_cols_at_size,
|
|
5497
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
5498
5497
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5499
5498
|
}));
|
|
5500
5499
|
const rendered_placeholders = $52FdA$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $e3915574cfd3466c$export$f33414a4df0afd3f({
|
|
@@ -5534,8 +5533,6 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5534
5533
|
get fallback() {
|
|
5535
5534
|
fallback_is_alive = true;
|
|
5536
5535
|
$52FdA$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
5537
|
-
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
5538
|
-
$52FdA$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
5539
5536
|
return $52FdA$solidjs.createMemo(() => {
|
|
5540
5537
|
// 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
|
|
5541
5538
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -5560,8 +5557,7 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
5560
5557
|
query_base_: query_base_,
|
|
5561
5558
|
depict_api_: depict_api_,
|
|
5562
5559
|
is_loading_: is_loading_,
|
|
5563
|
-
content_blocks_: content_blocks_
|
|
5564
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
5560
|
+
content_blocks_: content_blocks_
|
|
5565
5561
|
});
|
|
5566
5562
|
$52FdA$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
5567
5563
|
return suspense_contents;
|
package/ES10/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { BaseCategoryDisplay, ProductListingResponse } from "@depict-ai/types/ap
|
|
|
6
6
|
import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/api/SearchSuggestionsResponse";
|
|
7
7
|
import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
|
|
8
8
|
import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
|
|
9
|
-
import {
|
|
10
|
-
export const version = "2.1.
|
|
9
|
+
import { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
|
|
10
|
+
export const version = "2.1.2";
|
|
11
11
|
/**
|
|
12
12
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
13
13
|
*/
|
|
@@ -55,7 +55,7 @@ export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlac
|
|
|
55
55
|
* The interface for a content block.
|
|
56
56
|
* Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
|
|
57
57
|
* The height of the content block will be the height of the tallest item in a row, so if there are no products in a row the content block needs to "bring its own height".
|
|
58
|
-
* If you need to load any data in the content block, please make sure to return a placeholder while you're doing so, to avoid layout shifts and ensure scroll restoration works correctly.
|
|
58
|
+
* If you need to load any data in the content block, please make sure to return a placeholder while you're doing so (see `ImagePlaceholder`), to avoid layout shifts and ensure scroll restoration works correctly.
|
|
59
59
|
*
|
|
60
60
|
* - `span_columns`: How many columns the block should span. This will be capped to the number of columns available.
|
|
61
61
|
* - `span_rows`: How many rows the block should span.
|
|
@@ -670,7 +670,7 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
|
|
|
670
670
|
query(input_req: SearchRequest): Promise<SearchResponseAfterURLCreator & {
|
|
671
671
|
failed?: true;
|
|
672
672
|
}>;
|
|
673
|
-
list(input_req:
|
|
673
|
+
list(input_req: ProductListingRequestV2): Promise<ProductListingResponseAfterURLCreator & {
|
|
674
674
|
failed?: true;
|
|
675
675
|
}>;
|
|
676
676
|
get_recommended<T extends Display>(input_req: BaseSearchRequest): Promise<{
|
package/ES10/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
|
|
|
9
9
|
/*! Depict.ai search and product listing SDK */
|
|
10
10
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
11
11
|
register_es_version("ui", "ES10");
|
|
12
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.
|
|
12
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.2";
|
|
13
13
|
const $2855bffe06ef7a03$var$fallback_operator = "in";
|
|
14
14
|
const $2855bffe06ef7a03$var$fallback_token = "";
|
|
15
15
|
const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
|
|
@@ -4903,8 +4903,7 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4903
4903
|
query_base_: query_base_,
|
|
4904
4904
|
depict_api_: depict_api_,
|
|
4905
4905
|
is_loading_: is_loading_,
|
|
4906
|
-
content_blocks_: content_blocks_
|
|
4907
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4906
|
+
content_blocks_: content_blocks_
|
|
4908
4907
|
} = _ref;
|
|
4909
4908
|
// The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
|
|
4910
4909
|
const target_to_index_map = new Map();
|
|
@@ -4951,7 +4950,6 @@ function $45a8953d760b5e58$export$a1fd619a4743ca08(_ref) {
|
|
|
4951
4950
|
query_base_: query_base_,
|
|
4952
4951
|
depict_api_: depict_api_
|
|
4953
4952
|
});
|
|
4954
|
-
$8tj43$createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4955
4953
|
return $2d7bad8684bc7f44$export$43f0fb951fcb0c54({
|
|
4956
4954
|
displays_by_key_: displays_by_key_,
|
|
4957
4955
|
merchant_: merchant_,
|
|
@@ -5157,26 +5155,18 @@ function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
|
|
|
5157
5155
|
let {
|
|
5158
5156
|
content_blocks_: incoming_content_blocks,
|
|
5159
5157
|
cols_at_size_: cols_at_size_,
|
|
5160
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
5161
5158
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5162
5159
|
} = _ref;
|
|
5163
5160
|
// these are by row
|
|
5164
5161
|
const [content_blocks, set_content_blocks] = $8tj43$createStore([]);
|
|
5165
5162
|
const n_cols_currently_showing_ = $8244fdad249f8d5f$export$a79e666719b3647c(cols_at_size_);
|
|
5166
|
-
const products_to_rows = products => {
|
|
5167
|
-
const cols_currently_showing = n_cols_currently_showing_();
|
|
5168
|
-
if (cols_currently_showing === null) return 0;
|
|
5169
|
-
return Math.ceil(products / cols_currently_showing);
|
|
5170
|
-
};
|
|
5171
|
-
const showing_rows = $8tj43$createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
5172
5163
|
$8tj43$createEffect(() => {
|
|
5173
5164
|
const incoming_value = incoming_content_blocks();
|
|
5174
5165
|
if (!incoming_value) {
|
|
5175
5166
|
set_content_blocks([]);
|
|
5176
5167
|
return;
|
|
5177
5168
|
}
|
|
5178
|
-
|
|
5179
|
-
set_content_blocks($8tj43$reconcile(capped_value, {
|
|
5169
|
+
set_content_blocks($8tj43$reconcile(incoming_value, {
|
|
5180
5170
|
key: "content"
|
|
5181
5171
|
})); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
|
|
5182
5172
|
});
|
|
@@ -5234,12 +5224,12 @@ function $ff7feae4dddd6073$var$remap_blocks_to_index(_ref2) {
|
|
|
5234
5224
|
for (let j = 0; j < i; j++) {
|
|
5235
5225
|
const row = displaced_products[j];
|
|
5236
5226
|
if (row === undefined) continue; // there were no blocks in this row
|
|
5237
|
-
let
|
|
5238
|
-
if (typeof row === "number")
|
|
5239
|
-
|
|
5240
|
-
displaced_products[j] =
|
|
5227
|
+
let displaced_items_in_row;
|
|
5228
|
+
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
5229
|
+
displaced_items_in_row = row.filter(item => item).length;
|
|
5230
|
+
displaced_products[j] = displaced_items_in_row;
|
|
5241
5231
|
}
|
|
5242
|
-
displacement_by_added_blocks +=
|
|
5232
|
+
displacement_by_added_blocks += displaced_items_in_row;
|
|
5243
5233
|
}
|
|
5244
5234
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
5245
5235
|
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
@@ -5284,9 +5274,12 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5284
5274
|
var _max_span_columns;
|
|
5285
5275
|
return Math.min(block.span_columns, (_max_span_columns = max_span_columns()) !== null && _max_span_columns !== void 0 ? _max_span_columns : Infinity);
|
|
5286
5276
|
};
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5277
|
+
const [rendering_delayed, set_rendering_delayed_] = $8tj43$createSignal(true);
|
|
5278
|
+
const content = $8tj43$createComponent((0, $8tj43$Show), {
|
|
5279
|
+
get when() {
|
|
5280
|
+
return !rendering_delayed();
|
|
5281
|
+
},
|
|
5282
|
+
get children() {
|
|
5290
5283
|
const _el$ = $8tj43$getNextElement($ff7feae4dddd6073$var$_tmpl$);
|
|
5291
5284
|
$8tj43$insert(_el$, $8tj43$createComponent($ff7feae4dddd6073$var$RenderContent, {
|
|
5292
5285
|
get content() {
|
|
@@ -5309,7 +5302,16 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5309
5302
|
_v$3: undefined
|
|
5310
5303
|
});
|
|
5311
5304
|
return _el$;
|
|
5312
|
-
}
|
|
5305
|
+
}
|
|
5306
|
+
});
|
|
5307
|
+
return $8tj43$mergeProps1(block, {
|
|
5308
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
5309
|
+
content: () => {
|
|
5310
|
+
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
5311
|
+
// However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
|
|
5312
|
+
set_rendering_delayed_(false);
|
|
5313
|
+
return content;
|
|
5314
|
+
},
|
|
5313
5315
|
get span_columns() {
|
|
5314
5316
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
5315
5317
|
return get_span_columns();
|
|
@@ -5406,8 +5408,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
5406
5408
|
let fallback_is_alive = false;
|
|
5407
5409
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $8tj43$createSignal(true);
|
|
5408
5410
|
const [top_row_shortened_by_, set_top_row_shortened_by_] = $8tj43$createSignal(0);
|
|
5409
|
-
|
|
5410
|
-
const [number_loaded_displays, set_number_loaded_displays_] = $8tj43$createSignal(0);
|
|
5411
|
+
$8tj43$createSignal(false);
|
|
5411
5412
|
const modified_cols_at_size = $b2dbaafb23d00c7f$export$cb5808ba002cdeed({
|
|
5412
5413
|
layout_options_: layout_options_,
|
|
5413
5414
|
sort_or_filter_open_: sort_or_filter_open_
|
|
@@ -5422,12 +5423,10 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
5422
5423
|
return for_id === id_currently_querying_for_();
|
|
5423
5424
|
})) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
|
|
5424
5425
|
});
|
|
5425
|
-
const number_of_items_shown_ = $8tj43$createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
5426
5426
|
const doesnt_have_content_blocks = $8tj43$createMemo(() => !content_blocks_by_row_());
|
|
5427
5427
|
const content_blocks_ = $8tj43$createMemo(() => doesnt_have_content_blocks() ? () => [] : $ff7feae4dddd6073$export$791ef57e62e21c3f({
|
|
5428
5428
|
content_blocks_: content_blocks_by_row_,
|
|
5429
5429
|
cols_at_size_: modified_cols_at_size,
|
|
5430
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
5431
5430
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5432
5431
|
}));
|
|
5433
5432
|
const rendered_placeholders = $8tj43$createMemo(() => get_should_have_placeholders_rendered() ? $bdd80c7862246dc2$export$f33414a4df0afd3f({
|
|
@@ -5467,8 +5466,6 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
5467
5466
|
get fallback() {
|
|
5468
5467
|
fallback_is_alive = true;
|
|
5469
5468
|
$8tj43$onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
5470
|
-
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
5471
|
-
$8tj43$onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
5472
5469
|
return $8tj43$createMemo(() => {
|
|
5473
5470
|
// 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
|
|
5474
5471
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -5493,8 +5490,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
5493
5490
|
query_base_: query_base_,
|
|
5494
5491
|
depict_api_: depict_api_,
|
|
5495
5492
|
is_loading_: is_loading_,
|
|
5496
|
-
content_blocks_: content_blocks_
|
|
5497
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
5493
|
+
content_blocks_: content_blocks_
|
|
5498
5494
|
});
|
|
5499
5495
|
$8tj43$onCleanup(() => suspense_contents = undefined);
|
|
5500
5496
|
return suspense_contents;
|
package/latest/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
|
|
|
70
70
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
71
71
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
72
72
|
/*! Depict.ai search and product listing SDK */
|
|
73
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.
|
|
73
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "2.1.2";
|
|
74
74
|
const $1ab22f2cd39b3061$var$fallback_operator = "in";
|
|
75
75
|
const $1ab22f2cd39b3061$var$fallback_token = "";
|
|
76
76
|
const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
|
|
@@ -4632,8 +4632,7 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
|
4632
4632
|
query_base_: query_base_,
|
|
4633
4633
|
depict_api_: depict_api_,
|
|
4634
4634
|
is_loading_: is_loading_,
|
|
4635
|
-
content_blocks_: content_blocks_
|
|
4636
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
4635
|
+
content_blocks_: content_blocks_
|
|
4637
4636
|
}) {
|
|
4638
4637
|
// The following sets up an intersection observer to determine which results are in the viewport, used for the ScrollStatus indicator and knowing when to load more
|
|
4639
4638
|
const target_to_index_map = new Map();
|
|
@@ -4677,7 +4676,6 @@ function $ac167f6af6a48fc3$export$a1fd619a4743ca08({
|
|
|
4677
4676
|
query_base_: query_base_,
|
|
4678
4677
|
depict_api_: depict_api_
|
|
4679
4678
|
});
|
|
4680
|
-
$gVhhF$solidjs.createComputed(() => set_number_loaded_displays_(displays_by_key_().size));
|
|
4681
4679
|
return $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
4682
4680
|
displays_by_key_: displays_by_key_,
|
|
4683
4681
|
merchant_: merchant_,
|
|
@@ -4871,26 +4869,18 @@ const $d92f338ba8f9da9b$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<d
|
|
|
4871
4869
|
function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
4872
4870
|
content_blocks_: incoming_content_blocks,
|
|
4873
4871
|
cols_at_size_: cols_at_size_,
|
|
4874
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
4875
4872
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
4876
4873
|
}) {
|
|
4877
4874
|
// these are by row
|
|
4878
4875
|
const [content_blocks, set_content_blocks] = $gVhhF$solidjsstore.createStore([]);
|
|
4879
4876
|
const n_cols_currently_showing_ = $055384b985678603$export$a79e666719b3647c(cols_at_size_);
|
|
4880
|
-
const products_to_rows = products => {
|
|
4881
|
-
const cols_currently_showing = n_cols_currently_showing_();
|
|
4882
|
-
if (cols_currently_showing === null) return 0;
|
|
4883
|
-
return Math.ceil(products / cols_currently_showing);
|
|
4884
|
-
};
|
|
4885
|
-
const showing_rows = $gVhhF$solidjs.createMemo(() => products_to_rows(number_of_items_shown_()));
|
|
4886
4877
|
$gVhhF$solidjs.createEffect(() => {
|
|
4887
4878
|
const incoming_value = incoming_content_blocks();
|
|
4888
4879
|
if (!incoming_value) {
|
|
4889
4880
|
set_content_blocks([]);
|
|
4890
4881
|
return;
|
|
4891
4882
|
}
|
|
4892
|
-
|
|
4893
|
-
set_content_blocks($gVhhF$solidjsstore.reconcile(capped_value, {
|
|
4883
|
+
set_content_blocks($gVhhF$solidjsstore.reconcile(incoming_value, {
|
|
4894
4884
|
key: "content"
|
|
4895
4885
|
})); // key: Make moving blocks faster, see https://github.com/solidjs/solid/issues/1925#issuecomment-1769671596
|
|
4896
4886
|
});
|
|
@@ -4947,12 +4937,12 @@ function $d92f338ba8f9da9b$var$remap_blocks_to_index({
|
|
|
4947
4937
|
for (let j = 0; j < i; j++) {
|
|
4948
4938
|
const row = displaced_products[j];
|
|
4949
4939
|
if (row === undefined) continue; // there were no blocks in this row
|
|
4950
|
-
let
|
|
4951
|
-
if (typeof row === "number")
|
|
4952
|
-
|
|
4953
|
-
displaced_products[j] =
|
|
4940
|
+
let displaced_items_in_row;
|
|
4941
|
+
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
4942
|
+
displaced_items_in_row = row.filter(item => item).length;
|
|
4943
|
+
displaced_products[j] = displaced_items_in_row;
|
|
4954
4944
|
}
|
|
4955
|
-
displacement_by_added_blocks +=
|
|
4945
|
+
displacement_by_added_blocks += displaced_items_in_row;
|
|
4956
4946
|
}
|
|
4957
4947
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
4958
4948
|
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products[i]?.[j])
|
|
@@ -4990,9 +4980,12 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
4990
4980
|
const get_wrapped_blocks = $gVhhF$solidjs.mapArray(() => rendered_content_blocks, block => {
|
|
4991
4981
|
if (!block) return;
|
|
4992
4982
|
const get_span_columns = () => Math.min(block.span_columns, max_span_columns() ?? Infinity);
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4983
|
+
const [rendering_delayed, set_rendering_delayed_] = $gVhhF$solidjs.createSignal(true);
|
|
4984
|
+
const content = $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
4985
|
+
get when() {
|
|
4986
|
+
return !rendering_delayed();
|
|
4987
|
+
},
|
|
4988
|
+
get children() {
|
|
4996
4989
|
const _el$ = $gVhhF$solidjsweb.getNextElement($d92f338ba8f9da9b$var$_tmpl$);
|
|
4997
4990
|
$gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent($d92f338ba8f9da9b$var$RenderContent, {
|
|
4998
4991
|
get content() {
|
|
@@ -5015,7 +5008,16 @@ function $d92f338ba8f9da9b$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
5015
5008
|
_v$3: undefined
|
|
5016
5009
|
});
|
|
5017
5010
|
return _el$;
|
|
5018
|
-
}
|
|
5011
|
+
}
|
|
5012
|
+
});
|
|
5013
|
+
return $gVhhF$solidjs.mergeProps(block, {
|
|
5014
|
+
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
5015
|
+
content: () => {
|
|
5016
|
+
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
5017
|
+
// However, no need to count products to know if we should render: the <For> loops in Placeholders and render_displays will only call this function if there's actually a product here that wants to display this block
|
|
5018
|
+
set_rendering_delayed_(false);
|
|
5019
|
+
return content;
|
|
5020
|
+
},
|
|
5019
5021
|
get span_columns() {
|
|
5020
5022
|
// Cap max width of block to the number of columns available, for everyone downstream
|
|
5021
5023
|
return get_span_columns();
|
|
@@ -5109,8 +5111,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
5109
5111
|
let fallback_is_alive = false;
|
|
5110
5112
|
const [get_should_have_placeholders_rendered, set_should_have_placeholders_rendered] = $gVhhF$solidjs.createSignal(true);
|
|
5111
5113
|
const [top_row_shortened_by_, set_top_row_shortened_by_] = $gVhhF$solidjs.createSignal(0);
|
|
5112
|
-
|
|
5113
|
-
const [number_loaded_displays, set_number_loaded_displays_] = $gVhhF$solidjs.createSignal(0);
|
|
5114
|
+
$gVhhF$solidjs.createSignal(false);
|
|
5114
5115
|
const modified_cols_at_size = $738c3a81fc46a340$export$cb5808ba002cdeed({
|
|
5115
5116
|
layout_options_: layout_options_,
|
|
5116
5117
|
sort_or_filter_open_: sort_or_filter_open_
|
|
@@ -5121,12 +5122,10 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
5121
5122
|
for_id: for_id
|
|
5122
5123
|
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
5123
5124
|
});
|
|
5124
|
-
const number_of_items_shown_ = $gVhhF$solidjs.createMemo(() => is_loading_() || product_card_suspense_is_in_fallback() ? num_placeholders_() : number_loaded_displays());
|
|
5125
5125
|
const doesnt_have_content_blocks = $gVhhF$solidjs.createMemo(() => !content_blocks_by_row_());
|
|
5126
5126
|
const content_blocks_ = $gVhhF$solidjs.createMemo(() => doesnt_have_content_blocks() ? () => [] : $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
5127
5127
|
content_blocks_: content_blocks_by_row_,
|
|
5128
5128
|
cols_at_size_: modified_cols_at_size,
|
|
5129
|
-
number_of_items_shown_: number_of_items_shown_,
|
|
5130
5129
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
5131
5130
|
}));
|
|
5132
5131
|
const rendered_placeholders = $gVhhF$solidjs.createMemo(() => get_should_have_placeholders_rendered() ? $0caf87eaa19079da$export$f33414a4df0afd3f({
|
|
@@ -5166,8 +5165,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
5166
5165
|
get fallback() {
|
|
5167
5166
|
fallback_is_alive = true;
|
|
5168
5167
|
$gVhhF$solidjs.onCleanup(block_suspense_if_needed); // Block suspense after initial run every time after we fetch
|
|
5169
|
-
set_product_card_suspense_is_in_fallback(true); // Here for the content block code that needs to know how many items we're displaying
|
|
5170
|
-
$gVhhF$solidjs.onCleanup(() => set_product_card_suspense_is_in_fallback(false));
|
|
5171
5168
|
return $gVhhF$solidjs.createMemo(() => {
|
|
5172
5169
|
// 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
|
|
5173
5170
|
// In future we could have individual suspense's for each product card, but that's too much for now
|
|
@@ -5192,8 +5189,7 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
5192
5189
|
query_base_: query_base_,
|
|
5193
5190
|
depict_api_: depict_api_,
|
|
5194
5191
|
is_loading_: is_loading_,
|
|
5195
|
-
content_blocks_: content_blocks_
|
|
5196
|
-
set_number_loaded_displays_: set_number_loaded_displays_
|
|
5192
|
+
content_blocks_: content_blocks_
|
|
5197
5193
|
});
|
|
5198
5194
|
$gVhhF$solidjs.onCleanup(() => suspense_contents = undefined);
|
|
5199
5195
|
return suspense_contents;
|
package/latest/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ import { BaseCategoryDisplay, ProductListingResponse } from "@depict-ai/types/ap
|
|
|
6
6
|
import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/api/SearchSuggestionsResponse";
|
|
7
7
|
import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
|
|
8
8
|
import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
|
|
9
|
-
import {
|
|
10
|
-
export const version = "2.1.
|
|
9
|
+
import { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
|
|
10
|
+
export const version = "2.1.2";
|
|
11
11
|
/**
|
|
12
12
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
13
13
|
*/
|
|
@@ -55,7 +55,7 @@ export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlac
|
|
|
55
55
|
* The interface for a content block.
|
|
56
56
|
* Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
|
|
57
57
|
* The height of the content block will be the height of the tallest item in a row, so if there are no products in a row the content block needs to "bring its own height".
|
|
58
|
-
* If you need to load any data in the content block, please make sure to return a placeholder while you're doing so, to avoid layout shifts and ensure scroll restoration works correctly.
|
|
58
|
+
* If you need to load any data in the content block, please make sure to return a placeholder while you're doing so (see `ImagePlaceholder`), to avoid layout shifts and ensure scroll restoration works correctly.
|
|
59
59
|
*
|
|
60
60
|
* - `span_columns`: How many columns the block should span. This will be capped to the number of columns available.
|
|
61
61
|
* - `span_rows`: How many rows the block should span.
|
|
@@ -670,7 +670,7 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
|
|
|
670
670
|
query(input_req: SearchRequest): Promise<SearchResponseAfterURLCreator & {
|
|
671
671
|
failed?: true;
|
|
672
672
|
}>;
|
|
673
|
-
list(input_req:
|
|
673
|
+
list(input_req: ProductListingRequestV2): Promise<ProductListingResponseAfterURLCreator & {
|
|
674
674
|
failed?: true;
|
|
675
675
|
}>;
|
|
676
676
|
get_recommended<T extends Display>(input_req: BaseSearchRequest): Promise<{
|