@depict-ai/ui 4.7.30 → 4.7.31
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 +111 -22
- package/ES10/index.d.ts +12 -5
- package/ES10/index.js +111 -22
- package/latest/index.cjs +102 -15
- package/latest/index.d.ts +12 -5
- package/latest/index.js +102 -15
- package/package.json +1 -1
- package/server/ES10/index.cjs +56 -22
- package/server/ES10/index.d.ts +12 -5
- package/server/ES10/index.js +56 -22
- package/server/latest/index.cjs +47 -15
- package/server/latest/index.d.ts +12 -5
- package/server/latest/index.js +47 -15
package/server/ES10/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
|
|
13
13
|
import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
14
|
-
export const version = "4.7.
|
|
14
|
+
export const version = "4.7.31";
|
|
15
15
|
/**
|
|
16
16
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
17
17
|
*/
|
|
@@ -93,7 +93,8 @@ export type ContentBlocksByRow = (undefined | ContentBlock)[];
|
|
|
93
93
|
/**
|
|
94
94
|
* Does pure calculations where to put each of the finished wrapped content blocks in the elements in the grid (input is by row). You need to cap span_columns of the blocks to the columns available before passing them to this function.
|
|
95
95
|
* Also used in the portal in react.
|
|
96
|
-
* @returns an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index
|
|
96
|
+
* @returns content_blocks_by_index_: an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index.
|
|
97
|
+
* displaced_products_: internal state that can be used to figure out if there's parts of a content block on a row, see the comment inside this function
|
|
97
98
|
*/
|
|
98
99
|
export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Element>>({
|
|
99
100
|
wrapped_blocks_,
|
|
@@ -106,7 +107,13 @@ export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Elemen
|
|
|
106
107
|
content: T;
|
|
107
108
|
})[];
|
|
108
109
|
n_cols_currently_showing_: number | null;
|
|
109
|
-
}):
|
|
110
|
+
}): {
|
|
111
|
+
content_blocks_by_index_: JSX.Element[];
|
|
112
|
+
readonly displaced_products_?: undefined;
|
|
113
|
+
} | {
|
|
114
|
+
readonly content_blocks_by_index_: JSX.Element[];
|
|
115
|
+
readonly displaced_products_: (number | (true | undefined)[])[];
|
|
116
|
+
};
|
|
110
117
|
/**
|
|
111
118
|
* Returns a set containing the element where every element currently touching the screen started touching it.
|
|
112
119
|
*/
|
|
@@ -1477,7 +1484,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
|
|
|
1477
1484
|
* Open the modal with support for alignment.
|
|
1478
1485
|
* @returns {void}
|
|
1479
1486
|
*/
|
|
1480
|
-
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends
|
|
1487
|
+
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
|
|
1481
1488
|
export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
|
|
1482
1489
|
export interface PageReplacer {
|
|
1483
1490
|
readonly render_: () => Node_Array;
|
|
@@ -1556,5 +1563,5 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
|
|
|
1556
1563
|
content_blocks_by_row?: ContentBlocksByRow;
|
|
1557
1564
|
layout?: PossibleLayout;
|
|
1558
1565
|
filterModalParent_?: HTMLElement | ShadowRoot;
|
|
1559
|
-
}): import("@depict-ai/utilishared
|
|
1566
|
+
}): import("@depict-ai/utilishared").Node_Array;
|
|
1560
1567
|
export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";
|
package/server/ES10/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
|
|
|
10
10
|
/*! Depict.ai search and product listing SDK */
|
|
11
11
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
12
12
|
register_es_version("ui", "ES10");
|
|
13
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.7.
|
|
13
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.7.31";
|
|
14
14
|
function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
|
|
15
15
|
const signal = $b8hua$createSignal(false);
|
|
16
16
|
$b8hua$onCleanup($b8hua$javascript_media_query(media_query, _ref => {
|
|
@@ -115,7 +115,7 @@ function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
|
|
|
115
115
|
return $b8hua$createMemo(() => $ff7feae4dddd6073$export$92aa5d691d588f3f({
|
|
116
116
|
wrapped_blocks_: get_wrapped_blocks_(),
|
|
117
117
|
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
118
|
-
}));
|
|
118
|
+
}).content_blocks_by_index_);
|
|
119
119
|
}
|
|
120
120
|
function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
|
|
121
121
|
let {
|
|
@@ -123,13 +123,15 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
|
|
|
123
123
|
n_cols_currently_showing_: n_cols_currently_showing_
|
|
124
124
|
} = _ref2;
|
|
125
125
|
// This computation should be quite cheap since it just moves around things into an array
|
|
126
|
-
const
|
|
126
|
+
const content_blocks_by_index_ = [];
|
|
127
127
|
const constructed_block_arrays = new WeakSet();
|
|
128
128
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
129
|
-
const
|
|
129
|
+
const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
130
130
|
if (!n_cols_currently_showing_)
|
|
131
131
|
// Nope out of here if we don't know how many columns are showing
|
|
132
|
-
return
|
|
132
|
+
return {
|
|
133
|
+
content_blocks_by_index_: content_blocks_by_index_
|
|
134
|
+
};
|
|
133
135
|
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
134
136
|
// i = row to show at
|
|
135
137
|
const block = wrapped_blocks_[i];
|
|
@@ -146,25 +148,25 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
|
|
|
146
148
|
// Calculate displacement of us by content blocks above us
|
|
147
149
|
let displacement_by_added_blocks = 0;
|
|
148
150
|
for (let j = 0; j < i; j++) {
|
|
149
|
-
const row =
|
|
151
|
+
const row = displaced_products_[j];
|
|
150
152
|
if (row === undefined) continue; // there were no blocks in this row
|
|
151
153
|
let displaced_items_in_row;
|
|
152
154
|
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
153
155
|
displaced_items_in_row = row.filter(item => item).length;
|
|
154
|
-
|
|
156
|
+
displaced_products_[j] = displaced_items_in_row;
|
|
155
157
|
}
|
|
156
158
|
displacement_by_added_blocks += displaced_items_in_row;
|
|
157
159
|
}
|
|
158
160
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
159
161
|
for (let j = 0; j < index_of_us_in_row; j++) {
|
|
160
|
-
var
|
|
161
|
-
if ((
|
|
162
|
+
var _displaced_products_$;
|
|
163
|
+
if ((_displaced_products_$ = displaced_products_[i]) !== null && _displaced_products_$ !== void 0 && _displaced_products_$[j])
|
|
162
164
|
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
163
165
|
displacement_by_added_blocks++;
|
|
164
166
|
}
|
|
165
167
|
// Add block to output array at the correct index
|
|
166
168
|
const final_target_index = target_index - displacement_by_added_blocks;
|
|
167
|
-
const existing_block =
|
|
169
|
+
const existing_block = content_blocks_by_index_[final_target_index];
|
|
168
170
|
const block_content = block.content;
|
|
169
171
|
// If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
|
|
170
172
|
if (existing_block) {
|
|
@@ -173,17 +175,20 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
|
|
|
173
175
|
existing_block.push(block_content);else {
|
|
174
176
|
const array = [existing_block, block_content];
|
|
175
177
|
constructed_block_arrays.add(array);
|
|
176
|
-
|
|
178
|
+
content_blocks_by_index_[final_target_index] = array;
|
|
177
179
|
}
|
|
178
|
-
} else
|
|
180
|
+
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
179
181
|
// Update displacement
|
|
180
182
|
for (let j = 0; j < span_rows; j++) {
|
|
181
183
|
var _ref3;
|
|
182
|
-
const row =
|
|
184
|
+
const row = displaced_products_[_ref3 = i + j] || (displaced_products_[_ref3] = []);
|
|
183
185
|
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
|
-
return
|
|
188
|
+
return {
|
|
189
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
190
|
+
displaced_products_: displaced_products_
|
|
191
|
+
};
|
|
187
192
|
}
|
|
188
193
|
/**
|
|
189
194
|
* Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
|
|
@@ -8384,7 +8389,8 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
|
|
|
8384
8389
|
breadcrumbs: [],
|
|
8385
8390
|
quick_links: [],
|
|
8386
8391
|
image_urls: [],
|
|
8387
|
-
failed: true
|
|
8392
|
+
failed: true,
|
|
8393
|
+
content_blocks: []
|
|
8388
8394
|
}),
|
|
8389
8395
|
method_: "GET"
|
|
8390
8396
|
});
|
|
@@ -13189,6 +13195,16 @@ function $a4777acaffa35a82$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
13189
13195
|
});
|
|
13190
13196
|
tracking_function_for_plp_results(plp_results_);
|
|
13191
13197
|
}
|
|
13198
|
+
var $3b772ef9a35560fe$var$_tmpl$ = ["<a", "><img", ' style="', '"></a>'],
|
|
13199
|
+
$3b772ef9a35560fe$var$_tmpl$2 = ["<a", "><video", ' muted="" autoplay="" playsinline="" loop style="', '"></video></a>'];
|
|
13200
|
+
function $3b772ef9a35560fe$export$780a853d15174484(_ref) {
|
|
13201
|
+
let {
|
|
13202
|
+
contentBlock: contentBlock,
|
|
13203
|
+
router_: router_
|
|
13204
|
+
} = _ref;
|
|
13205
|
+
if (contentBlock.content.type === "image") return () => $b8hua$ssr($3b772ef9a35560fe$var$_tmpl$, $b8hua$ssrHydrationKey() + $b8hua$ssrAttribute("href", $b8hua$escape(contentBlock.content.link, true), false), $b8hua$ssrAttribute("src", $b8hua$escape(contentBlock.content.url, true), false), "width:100%;height:100%;object-fit:cover;position:absolute;inset:0");
|
|
13206
|
+
if (contentBlock.content.type === "video") return () => $b8hua$ssr($3b772ef9a35560fe$var$_tmpl$2, $b8hua$ssrHydrationKey() + $b8hua$ssrAttribute("href", $b8hua$escape(contentBlock.content.link, true), false), $b8hua$ssrAttribute("src", $b8hua$escape(contentBlock.content.url, true), false), "width:100%;height:100%;object-fit:cover;position:absolute;inset:0");
|
|
13207
|
+
}
|
|
13192
13208
|
var $4b4b262708b516ee$var$_tmpl$ = ["<div", ' class="product-count"><!--$-->', "<!--/--> <!--$-->", "<!--/--></div>"],
|
|
13193
13209
|
$4b4b262708b516ee$var$_tmpl$2 = ["<div", "></div>"],
|
|
13194
13210
|
$4b4b262708b516ee$var$_tmpl$3 = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
@@ -13285,6 +13301,24 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
13285
13301
|
}));
|
|
13286
13302
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
13287
13303
|
const [plp_meta] = $b8hua$createResource(meta_query_base, $b8hua$catchify(query => depict_api_.get_listing(query)));
|
|
13304
|
+
const contentBlocksByRow = $b8hua$createMemo(() => {
|
|
13305
|
+
var _plp_meta, _plp_meta$content_blo;
|
|
13306
|
+
if (content_blocks_by_row_()) return content_blocks_by_row_();
|
|
13307
|
+
const content = [];
|
|
13308
|
+
(_plp_meta = plp_meta()) === null || _plp_meta === void 0 || (_plp_meta$content_blo = _plp_meta.content_blocks) === null || _plp_meta$content_blo === void 0 || _plp_meta$content_blo.forEach(row => {
|
|
13309
|
+
const contentBlock = {
|
|
13310
|
+
span_columns: row.span_columns,
|
|
13311
|
+
span_rows: row.span_rows,
|
|
13312
|
+
position: row.position,
|
|
13313
|
+
content: $3b772ef9a35560fe$export$780a853d15174484({
|
|
13314
|
+
contentBlock: row,
|
|
13315
|
+
router_: router_
|
|
13316
|
+
})
|
|
13317
|
+
};
|
|
13318
|
+
content[row.row] = contentBlock;
|
|
13319
|
+
});
|
|
13320
|
+
return content;
|
|
13321
|
+
});
|
|
13288
13322
|
const available_sortings_ = $b8hua$createMemo(() => {
|
|
13289
13323
|
var _plp_products_, _plp_products_$sorts;
|
|
13290
13324
|
return (_plp_products_ = plp_products_()) === null || _plp_products_ === void 0 ? void 0 : (_plp_products_$sorts = _plp_products_.sorts) === null || _plp_products_$sorts === void 0 ? void 0 : _plp_products_$sorts.map(sort => {
|
|
@@ -13300,13 +13334,13 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
13300
13334
|
return (_plp_products_2 = plp_products_()) === null || _plp_products_2 === void 0 ? void 0 : _plp_products_2.filters;
|
|
13301
13335
|
});
|
|
13302
13336
|
const title = $b8hua$createMemo(() => {
|
|
13303
|
-
var
|
|
13304
|
-
return (
|
|
13337
|
+
var _plp_meta2;
|
|
13338
|
+
return (_plp_meta2 = plp_meta()) === null || _plp_meta2 === void 0 ? void 0 : _plp_meta2.title;
|
|
13305
13339
|
});
|
|
13306
13340
|
const crumb_data_ = $4b4b262708b516ee$var$add_us_to_crumbs(plp_meta);
|
|
13307
13341
|
const quicklinks_data_ = $b8hua$createMemo(() => {
|
|
13308
|
-
var
|
|
13309
|
-
return (
|
|
13342
|
+
var _plp_meta3;
|
|
13343
|
+
return (_plp_meta3 = plp_meta()) === null || _plp_meta3 === void 0 ? void 0 : _plp_meta3.quick_links;
|
|
13310
13344
|
});
|
|
13311
13345
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = $b8hua$createSignal(false);
|
|
13312
13346
|
const [desktop_filter_elements_, set_desktop_filter_elements] = $b8hua$createSignal();
|
|
@@ -13531,7 +13565,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
13531
13565
|
product_card_template_: product_card_template_,
|
|
13532
13566
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
13533
13567
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
13534
|
-
content_blocks_by_row_:
|
|
13568
|
+
content_blocks_by_row_: contentBlocksByRow,
|
|
13535
13569
|
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
13536
13570
|
id_currently_querying_for_: id_to_query_for_,
|
|
13537
13571
|
no_results_options_: {
|
|
@@ -13572,8 +13606,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
13572
13606
|
function $4b4b262708b516ee$var$add_us_to_crumbs(plp_meta) {
|
|
13573
13607
|
const href_accessor = $b8hua$use_href_accessor1();
|
|
13574
13608
|
return $b8hua$createMemo(() => {
|
|
13575
|
-
var
|
|
13576
|
-
const api_value = (
|
|
13609
|
+
var _plp_meta4;
|
|
13610
|
+
const api_value = (_plp_meta4 = plp_meta()) === null || _plp_meta4 === void 0 ? void 0 : _plp_meta4.breadcrumbs;
|
|
13577
13611
|
if (!api_value) return api_value;
|
|
13578
13612
|
return [...api_value, $b8hua$mergeProps(plp_meta(), {
|
|
13579
13613
|
get page_url() {
|
package/server/latest/index.cjs
CHANGED
|
@@ -105,7 +105,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
|
|
|
105
105
|
$parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
|
|
106
106
|
$parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
|
|
107
107
|
/*! Depict.ai search and product listing SDK */
|
|
108
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.7.
|
|
108
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.7.31";
|
|
109
109
|
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
110
110
|
const signal = $5vyXB$solidjs.createSignal(false);
|
|
111
111
|
$5vyXB$solidjs.onCleanup($5vyXB$depictaiutilishared.javascript_media_query(media_query, ({
|
|
@@ -202,20 +202,22 @@ function $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
|
202
202
|
return $5vyXB$solidjs.createMemo(() => $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
203
203
|
wrapped_blocks_: get_wrapped_blocks_(),
|
|
204
204
|
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
205
|
-
}));
|
|
205
|
+
}).content_blocks_by_index_);
|
|
206
206
|
}
|
|
207
207
|
function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
208
208
|
wrapped_blocks_: wrapped_blocks_,
|
|
209
209
|
n_cols_currently_showing_: n_cols_currently_showing_
|
|
210
210
|
}) {
|
|
211
211
|
// This computation should be quite cheap since it just moves around things into an array
|
|
212
|
-
const
|
|
212
|
+
const content_blocks_by_index_ = [];
|
|
213
213
|
const constructed_block_arrays = new WeakSet();
|
|
214
214
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
215
|
-
const
|
|
215
|
+
const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
216
216
|
if (!n_cols_currently_showing_)
|
|
217
217
|
// Nope out of here if we don't know how many columns are showing
|
|
218
|
-
return
|
|
218
|
+
return {
|
|
219
|
+
content_blocks_by_index_: content_blocks_by_index_
|
|
220
|
+
};
|
|
219
221
|
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
220
222
|
// i = row to show at
|
|
221
223
|
const block = wrapped_blocks_[i];
|
|
@@ -232,22 +234,22 @@ function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
|
232
234
|
// Calculate displacement of us by content blocks above us
|
|
233
235
|
let displacement_by_added_blocks = 0;
|
|
234
236
|
for (let j = 0; j < i; j++) {
|
|
235
|
-
const row =
|
|
237
|
+
const row = displaced_products_[j];
|
|
236
238
|
if (row === undefined) continue; // there were no blocks in this row
|
|
237
239
|
let displaced_items_in_row;
|
|
238
240
|
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
239
241
|
displaced_items_in_row = row.filter(item => item).length;
|
|
240
|
-
|
|
242
|
+
displaced_products_[j] = displaced_items_in_row;
|
|
241
243
|
}
|
|
242
244
|
displacement_by_added_blocks += displaced_items_in_row;
|
|
243
245
|
}
|
|
244
246
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
245
|
-
for (let j = 0; j < index_of_us_in_row; j++) if (
|
|
247
|
+
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products_[i]?.[j])
|
|
246
248
|
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
247
249
|
displacement_by_added_blocks++;
|
|
248
250
|
// Add block to output array at the correct index
|
|
249
251
|
const final_target_index = target_index - displacement_by_added_blocks;
|
|
250
|
-
const existing_block =
|
|
252
|
+
const existing_block = content_blocks_by_index_[final_target_index];
|
|
251
253
|
const block_content = block.content;
|
|
252
254
|
// If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
|
|
253
255
|
if (existing_block) {
|
|
@@ -256,16 +258,19 @@ function $d92f338ba8f9da9b$export$92aa5d691d588f3f({
|
|
|
256
258
|
existing_block.push(block_content);else {
|
|
257
259
|
const array = [existing_block, block_content];
|
|
258
260
|
constructed_block_arrays.add(array);
|
|
259
|
-
|
|
261
|
+
content_blocks_by_index_[final_target_index] = array;
|
|
260
262
|
}
|
|
261
|
-
} else
|
|
263
|
+
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
262
264
|
// Update displacement
|
|
263
265
|
for (let j = 0; j < span_rows; j++) {
|
|
264
|
-
const row =
|
|
266
|
+
const row = displaced_products_[i + j] ||= [];
|
|
265
267
|
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
266
268
|
}
|
|
267
269
|
}
|
|
268
|
-
return
|
|
270
|
+
return {
|
|
271
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
272
|
+
displaced_products_: displaced_products_
|
|
273
|
+
};
|
|
269
274
|
}
|
|
270
275
|
/**
|
|
271
276
|
* Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
|
|
@@ -8126,7 +8131,8 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
|
|
|
8126
8131
|
breadcrumbs: [],
|
|
8127
8132
|
quick_links: [],
|
|
8128
8133
|
image_urls: [],
|
|
8129
|
-
failed: true
|
|
8134
|
+
failed: true,
|
|
8135
|
+
content_blocks: []
|
|
8130
8136
|
}),
|
|
8131
8137
|
method_: "GET"
|
|
8132
8138
|
});
|
|
@@ -12328,6 +12334,15 @@ function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
12328
12334
|
});
|
|
12329
12335
|
tracking_function_for_plp_results(plp_results_);
|
|
12330
12336
|
}
|
|
12337
|
+
var $32c662f618f5d80d$var$_tmpl$ = ["<a", "><img", ' style="', '"></a>'],
|
|
12338
|
+
$32c662f618f5d80d$var$_tmpl$2 = ["<a", "><video", ' muted="" autoplay="" playsinline="" loop style="', '"></video></a>'];
|
|
12339
|
+
function $32c662f618f5d80d$export$780a853d15174484({
|
|
12340
|
+
contentBlock: contentBlock,
|
|
12341
|
+
router_: router_
|
|
12342
|
+
}) {
|
|
12343
|
+
if (contentBlock.content.type === "image") return () => $5vyXB$solidjsweb.ssr($32c662f618f5d80d$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey() + $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(contentBlock.content.link, true), false), $5vyXB$solidjsweb.ssrAttribute("src", $5vyXB$solidjsweb.escape(contentBlock.content.url, true), false), "width:100%;height:100%;object-fit:cover;position:absolute;inset:0");
|
|
12344
|
+
if (contentBlock.content.type === "video") return () => $5vyXB$solidjsweb.ssr($32c662f618f5d80d$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey() + $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(contentBlock.content.link, true), false), $5vyXB$solidjsweb.ssrAttribute("src", $5vyXB$solidjsweb.escape(contentBlock.content.url, true), false), "width:100%;height:100%;object-fit:cover;position:absolute;inset:0");
|
|
12345
|
+
}
|
|
12331
12346
|
var $840d88a04b2d22a7$var$_tmpl$ = ["<div", ' class="product-count"><!--$-->', "<!--/--> <!--$-->", "<!--/--></div>"],
|
|
12332
12347
|
$840d88a04b2d22a7$var$_tmpl$2 = ["<div", "></div>"],
|
|
12333
12348
|
$840d88a04b2d22a7$var$_tmpl$3 = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
@@ -12423,6 +12438,23 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12423
12438
|
}));
|
|
12424
12439
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
12425
12440
|
const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
|
|
12441
|
+
const contentBlocksByRow = $5vyXB$solidjs.createMemo(() => {
|
|
12442
|
+
if (content_blocks_by_row_()) return content_blocks_by_row_();
|
|
12443
|
+
const content = [];
|
|
12444
|
+
plp_meta()?.content_blocks?.forEach(row => {
|
|
12445
|
+
const contentBlock = {
|
|
12446
|
+
span_columns: row.span_columns,
|
|
12447
|
+
span_rows: row.span_rows,
|
|
12448
|
+
position: row.position,
|
|
12449
|
+
content: $32c662f618f5d80d$export$780a853d15174484({
|
|
12450
|
+
contentBlock: row,
|
|
12451
|
+
router_: router_
|
|
12452
|
+
})
|
|
12453
|
+
};
|
|
12454
|
+
content[row.row] = contentBlock;
|
|
12455
|
+
});
|
|
12456
|
+
return content;
|
|
12457
|
+
});
|
|
12426
12458
|
const available_sortings_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
12427
12459
|
...sort,
|
|
12428
12460
|
order: sort.order ?? "desc"
|
|
@@ -12641,7 +12673,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
|
|
|
12641
12673
|
product_card_template_: product_card_template_,
|
|
12642
12674
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
12643
12675
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
12644
|
-
content_blocks_by_row_:
|
|
12676
|
+
content_blocks_by_row_: contentBlocksByRow,
|
|
12645
12677
|
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
12646
12678
|
id_currently_querying_for_: id_to_query_for_,
|
|
12647
12679
|
no_results_options_: {
|
package/server/latest/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
|
|
13
13
|
import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
14
|
-
export const version = "4.7.
|
|
14
|
+
export const version = "4.7.31";
|
|
15
15
|
/**
|
|
16
16
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
17
17
|
*/
|
|
@@ -93,7 +93,8 @@ export type ContentBlocksByRow = (undefined | ContentBlock)[];
|
|
|
93
93
|
/**
|
|
94
94
|
* Does pure calculations where to put each of the finished wrapped content blocks in the elements in the grid (input is by row). You need to cap span_columns of the blocks to the columns available before passing them to this function.
|
|
95
95
|
* Also used in the portal in react.
|
|
96
|
-
* @returns an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index
|
|
96
|
+
* @returns content_blocks_by_index_: an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index.
|
|
97
|
+
* displaced_products_: internal state that can be used to figure out if there's parts of a content block on a row, see the comment inside this function
|
|
97
98
|
*/
|
|
98
99
|
export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Element>>({
|
|
99
100
|
wrapped_blocks_,
|
|
@@ -106,7 +107,13 @@ export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Elemen
|
|
|
106
107
|
content: T;
|
|
107
108
|
})[];
|
|
108
109
|
n_cols_currently_showing_: number | null;
|
|
109
|
-
}):
|
|
110
|
+
}): {
|
|
111
|
+
content_blocks_by_index_: JSX.Element[];
|
|
112
|
+
readonly displaced_products_?: undefined;
|
|
113
|
+
} | {
|
|
114
|
+
readonly content_blocks_by_index_: JSX.Element[];
|
|
115
|
+
readonly displaced_products_: (number | (true | undefined)[])[];
|
|
116
|
+
};
|
|
110
117
|
/**
|
|
111
118
|
* Returns a set containing the element where every element currently touching the screen started touching it.
|
|
112
119
|
*/
|
|
@@ -1477,7 +1484,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
|
|
|
1477
1484
|
* Open the modal with support for alignment.
|
|
1478
1485
|
* @returns {void}
|
|
1479
1486
|
*/
|
|
1480
|
-
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends
|
|
1487
|
+
export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
|
|
1481
1488
|
export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
|
|
1482
1489
|
export interface PageReplacer {
|
|
1483
1490
|
readonly render_: () => Node_Array;
|
|
@@ -1556,5 +1563,5 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
|
|
|
1556
1563
|
content_blocks_by_row?: ContentBlocksByRow;
|
|
1557
1564
|
layout?: PossibleLayout;
|
|
1558
1565
|
filterModalParent_?: HTMLElement | ShadowRoot;
|
|
1559
|
-
}): import("@depict-ai/utilishared
|
|
1566
|
+
}): import("@depict-ai/utilishared").Node_Array;
|
|
1560
1567
|
export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";
|
package/server/latest/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { dlog as $i7OB2$dlog, catchify as $i7OB2$catchify, ListenableSet as $i7O
|
|
|
7
7
|
/*! Depict.ai search and product listing SDK */
|
|
8
8
|
import { register_es_version } from "../../multi_import_deduplicator.mjs";
|
|
9
9
|
register_es_version("ui", "latest");
|
|
10
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "4.7.
|
|
10
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "4.7.31";
|
|
11
11
|
function $dc9262ef6f786812$export$d9f36cf74e24d595(media_query) {
|
|
12
12
|
const signal = $i7OB2$createSignal(false);
|
|
13
13
|
$i7OB2$onCleanup($i7OB2$javascript_media_query(media_query, ({
|
|
@@ -104,20 +104,22 @@ function $e7a7eb102ddc0c79$export$791ef57e62e21c3f({
|
|
|
104
104
|
return $i7OB2$createMemo(() => $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
|
|
105
105
|
wrapped_blocks_: get_wrapped_blocks_(),
|
|
106
106
|
n_cols_currently_showing_: n_cols_currently_showing_()
|
|
107
|
-
}));
|
|
107
|
+
}).content_blocks_by_index_);
|
|
108
108
|
}
|
|
109
109
|
function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
|
|
110
110
|
wrapped_blocks_: wrapped_blocks_,
|
|
111
111
|
n_cols_currently_showing_: n_cols_currently_showing_
|
|
112
112
|
}) {
|
|
113
113
|
// This computation should be quite cheap since it just moves around things into an array
|
|
114
|
-
const
|
|
114
|
+
const content_blocks_by_index_ = [];
|
|
115
115
|
const constructed_block_arrays = new WeakSet();
|
|
116
116
|
// Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
|
|
117
|
-
const
|
|
117
|
+
const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
|
|
118
118
|
if (!n_cols_currently_showing_)
|
|
119
119
|
// Nope out of here if we don't know how many columns are showing
|
|
120
|
-
return
|
|
120
|
+
return {
|
|
121
|
+
content_blocks_by_index_: content_blocks_by_index_
|
|
122
|
+
};
|
|
121
123
|
for (let i = 0; i < wrapped_blocks_.length; i++) {
|
|
122
124
|
// i = row to show at
|
|
123
125
|
const block = wrapped_blocks_[i];
|
|
@@ -134,22 +136,22 @@ function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
|
|
|
134
136
|
// Calculate displacement of us by content blocks above us
|
|
135
137
|
let displacement_by_added_blocks = 0;
|
|
136
138
|
for (let j = 0; j < i; j++) {
|
|
137
|
-
const row =
|
|
139
|
+
const row = displaced_products_[j];
|
|
138
140
|
if (row === undefined) continue; // there were no blocks in this row
|
|
139
141
|
let displaced_items_in_row;
|
|
140
142
|
if (typeof row === "number") displaced_items_in_row = row;else {
|
|
141
143
|
displaced_items_in_row = row.filter(item => item).length;
|
|
142
|
-
|
|
144
|
+
displaced_products_[j] = displaced_items_in_row;
|
|
143
145
|
}
|
|
144
146
|
displacement_by_added_blocks += displaced_items_in_row;
|
|
145
147
|
}
|
|
146
148
|
const index_of_us_in_row = target_index - index_of_first_item_in_row;
|
|
147
|
-
for (let j = 0; j < index_of_us_in_row; j++) if (
|
|
149
|
+
for (let j = 0; j < index_of_us_in_row; j++) if (displaced_products_[i]?.[j])
|
|
148
150
|
// Add blocks in our *current* row to the displacement, but only the ones to our left
|
|
149
151
|
displacement_by_added_blocks++;
|
|
150
152
|
// Add block to output array at the correct index
|
|
151
153
|
const final_target_index = target_index - displacement_by_added_blocks;
|
|
152
|
-
const existing_block =
|
|
154
|
+
const existing_block = content_blocks_by_index_[final_target_index];
|
|
153
155
|
const block_content = block.content;
|
|
154
156
|
// If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
|
|
155
157
|
if (existing_block) {
|
|
@@ -158,16 +160,19 @@ function $e7a7eb102ddc0c79$export$92aa5d691d588f3f({
|
|
|
158
160
|
existing_block.push(block_content);else {
|
|
159
161
|
const array = [existing_block, block_content];
|
|
160
162
|
constructed_block_arrays.add(array);
|
|
161
|
-
|
|
163
|
+
content_blocks_by_index_[final_target_index] = array;
|
|
162
164
|
}
|
|
163
|
-
} else
|
|
165
|
+
} else content_blocks_by_index_[final_target_index] = block_content;
|
|
164
166
|
// Update displacement
|
|
165
167
|
for (let j = 0; j < span_rows; j++) {
|
|
166
|
-
const row =
|
|
168
|
+
const row = displaced_products_[i + j] ||= [];
|
|
167
169
|
for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
|
-
return
|
|
172
|
+
return {
|
|
173
|
+
content_blocks_by_index_: content_blocks_by_index_,
|
|
174
|
+
displaced_products_: displaced_products_
|
|
175
|
+
};
|
|
171
176
|
}
|
|
172
177
|
/**
|
|
173
178
|
* Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
|
|
@@ -8028,7 +8033,8 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
8028
8033
|
breadcrumbs: [],
|
|
8029
8034
|
quick_links: [],
|
|
8030
8035
|
image_urls: [],
|
|
8031
|
-
failed: true
|
|
8036
|
+
failed: true,
|
|
8037
|
+
content_blocks: []
|
|
8032
8038
|
}),
|
|
8033
8039
|
method_: "GET"
|
|
8034
8040
|
});
|
|
@@ -12230,6 +12236,15 @@ function $e7fce80abe608e01$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
12230
12236
|
});
|
|
12231
12237
|
tracking_function_for_plp_results(plp_results_);
|
|
12232
12238
|
}
|
|
12239
|
+
var $f916989c4b1be9f7$var$_tmpl$ = ["<a", "><img", ' style="', '"></a>'],
|
|
12240
|
+
$f916989c4b1be9f7$var$_tmpl$2 = ["<a", "><video", ' muted="" autoplay="" playsinline="" loop style="', '"></video></a>'];
|
|
12241
|
+
function $f916989c4b1be9f7$export$780a853d15174484({
|
|
12242
|
+
contentBlock: contentBlock,
|
|
12243
|
+
router_: router_
|
|
12244
|
+
}) {
|
|
12245
|
+
if (contentBlock.content.type === "image") return () => $i7OB2$ssr($f916989c4b1be9f7$var$_tmpl$, $i7OB2$ssrHydrationKey() + $i7OB2$ssrAttribute("href", $i7OB2$escape(contentBlock.content.link, true), false), $i7OB2$ssrAttribute("src", $i7OB2$escape(contentBlock.content.url, true), false), "width:100%;height:100%;object-fit:cover;position:absolute;inset:0");
|
|
12246
|
+
if (contentBlock.content.type === "video") return () => $i7OB2$ssr($f916989c4b1be9f7$var$_tmpl$2, $i7OB2$ssrHydrationKey() + $i7OB2$ssrAttribute("href", $i7OB2$escape(contentBlock.content.link, true), false), $i7OB2$ssrAttribute("src", $i7OB2$escape(contentBlock.content.url, true), false), "width:100%;height:100%;object-fit:cover;position:absolute;inset:0");
|
|
12247
|
+
}
|
|
12233
12248
|
var $df5d81d0fe61ff21$var$_tmpl$ = ["<div", ' class="product-count"><!--$-->', "<!--/--> <!--$-->", "<!--/--></div>"],
|
|
12234
12249
|
$df5d81d0fe61ff21$var$_tmpl$2 = ["<div", "></div>"],
|
|
12235
12250
|
$df5d81d0fe61ff21$var$_tmpl$3 = ["<div", ' class="filter-results-for-one-row"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
|
|
@@ -12325,6 +12340,23 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12325
12340
|
}));
|
|
12326
12341
|
// Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
|
|
12327
12342
|
const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify(query => depict_api_.get_listing(query)));
|
|
12343
|
+
const contentBlocksByRow = $i7OB2$createMemo(() => {
|
|
12344
|
+
if (content_blocks_by_row_()) return content_blocks_by_row_();
|
|
12345
|
+
const content = [];
|
|
12346
|
+
plp_meta()?.content_blocks?.forEach(row => {
|
|
12347
|
+
const contentBlock = {
|
|
12348
|
+
span_columns: row.span_columns,
|
|
12349
|
+
span_rows: row.span_rows,
|
|
12350
|
+
position: row.position,
|
|
12351
|
+
content: $f916989c4b1be9f7$export$780a853d15174484({
|
|
12352
|
+
contentBlock: row,
|
|
12353
|
+
router_: router_
|
|
12354
|
+
})
|
|
12355
|
+
};
|
|
12356
|
+
content[row.row] = contentBlock;
|
|
12357
|
+
});
|
|
12358
|
+
return content;
|
|
12359
|
+
});
|
|
12328
12360
|
const available_sortings_ = $i7OB2$createMemo(() => plp_products_()?.sorts?.map(sort => ({
|
|
12329
12361
|
...sort,
|
|
12330
12362
|
order: sort.order ?? "desc"
|
|
@@ -12543,7 +12575,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
12543
12575
|
product_card_template_: product_card_template_,
|
|
12544
12576
|
sort_or_filter_open_: sort_or_filter_open_,
|
|
12545
12577
|
desktop_filter_elements_: desktop_filter_elements_,
|
|
12546
|
-
content_blocks_by_row_:
|
|
12578
|
+
content_blocks_by_row_: contentBlocksByRow,
|
|
12547
12579
|
ConfiguredScrollStatus_: ConfiguredScrollStatus_,
|
|
12548
12580
|
id_currently_querying_for_: id_to_query_for_,
|
|
12549
12581
|
no_results_options_: {
|