@depict-ai/ui 4.7.35 → 4.8.1
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 +148 -92
- package/ES10/index.d.ts +61 -61
- package/ES10/index.js +149 -92
- package/latest/index.cjs +142 -86
- package/latest/index.d.ts +61 -61
- package/latest/index.js +143 -86
- package/package.json +2 -2
- package/server/ES10/index.cjs +135 -73
- package/server/ES10/index.d.ts +61 -61
- package/server/ES10/index.js +136 -73
- package/server/latest/index.cjs +129 -67
- package/server/latest/index.d.ts +61 -61
- package/server/latest/index.js +130 -67
package/server/latest/index.cjs
CHANGED
|
@@ -12,9 +12,9 @@ function $parcel$export(e, n, v, s) {
|
|
|
12
12
|
configurable: true
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
$parcel$export(module.exports, "ModernResponsiveImage", () => $d212a67662c5cf38$export$140423fa4bfb6d63);
|
|
16
15
|
$parcel$export(module.exports, "setExtraDisplayTransformers", () => $606c221d98ba4d92$export$f98b8d5ea7207a1);
|
|
17
16
|
$parcel$export(module.exports, "getExtraDisplayTransformers", () => $606c221d98ba4d92$export$b2d94be4f02525b2);
|
|
17
|
+
$parcel$export(module.exports, "ModernResponsiveImage", () => $d212a67662c5cf38$export$140423fa4bfb6d63);
|
|
18
18
|
$parcel$export(module.exports, "remap_blocks_to_index", () => $d92f338ba8f9da9b$export$92aa5d691d588f3f);
|
|
19
19
|
$parcel$export(module.exports, "useMobileHover", () => $8bf678c45948a297$export$d4d96868197be50e);
|
|
20
20
|
$parcel$export(module.exports, "useVisibilityState", () => $55cbacb79d3e0cea$export$54299a3c81f5425);
|
|
@@ -106,9 +106,15 @@ $parcel$export(module.exports, "SearchField", () => $c0a0659cf97e8eb2$export$316
|
|
|
106
106
|
$parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7c3ce0ebe51f86);
|
|
107
107
|
$parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
|
|
108
108
|
$parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
|
|
109
|
-
$parcel$export(module.exports, "makeSizeAccessors", () => $128302ab61dab8f1$export$54c6d6ff54e72743);
|
|
110
109
|
/*! Depict.ai search and product listing SDK */
|
|
111
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.
|
|
110
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.1";
|
|
111
|
+
|
|
112
|
+
// Value first so shopify merchants can set (extra) display transformers in the shopify app
|
|
113
|
+
// Calling these functions normally doesn't do anything, but our shopify app respects them
|
|
114
|
+
// Them being here is value first too because this can be easily imported in the product card editor
|
|
115
|
+
let $606c221d98ba4d92$var$extraDisplayTransformers;
|
|
116
|
+
const $606c221d98ba4d92$export$b2d94be4f02525b2 = () => $606c221d98ba4d92$var$extraDisplayTransformers;
|
|
117
|
+
const $606c221d98ba4d92$export$f98b8d5ea7207a1 = displayTransformers => $606c221d98ba4d92$var$extraDisplayTransformers = displayTransformers;
|
|
112
118
|
const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$5vyXB$solidjs.createContext();
|
|
113
119
|
function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
|
|
114
120
|
const our_object = {};
|
|
@@ -174,7 +180,11 @@ const $19950faaac026e09$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingCo
|
|
|
174
180
|
function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
175
181
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
176
182
|
const [ourRatioKeyed, setOurRatioKeyed] = $5vyXB$solidjs.createSignal();
|
|
183
|
+
const [rAFSinceReturned, setRAFSinceReturned] = $5vyXB$solidjs.createSignal(false);
|
|
177
184
|
const sizeToUse = $5vyXB$solidjs.createMemo(() => {
|
|
185
|
+
// We first put the images into the DOM after they have been decoded. We can only get the correct object-fit value after the image is in the DOM.
|
|
186
|
+
// To avoid using an observer for knowing when the image is in the DOM (one of the most CPU intensive things when we did lighthouse optimisation) we just re-check an animationframe after we told <Show> to show the image, which seems to work reliably
|
|
187
|
+
rAFSinceReturned();
|
|
178
188
|
// props.size could be a getter that expects a cleanup so get it in this memo instead of where we set img.sizes (also we need to multiply, and it's good with some diffing here so people calling the comp don't have to)
|
|
179
189
|
const incomingSize = props.size();
|
|
180
190
|
const ratio = ourRatioKeyed();
|
|
@@ -330,6 +340,7 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
330
340
|
hasDecodedFastPath = true;
|
|
331
341
|
});
|
|
332
342
|
});
|
|
343
|
+
$5vyXB$solidjs.createEffect(() => hasDecoded() && requestAnimationFrame($5vyXB$depictaiutilishared.catchify(() => setRAFSinceReturned(prev => !prev))));
|
|
333
344
|
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
|
|
334
345
|
get when() {
|
|
335
346
|
return hasDecoded();
|
|
@@ -522,13 +533,6 @@ function $d212a67662c5cf38$export$140423fa4bfb6d63(props) {
|
|
|
522
533
|
customUrls: $d212a67662c5cf38$var$customUrls
|
|
523
534
|
}));
|
|
524
535
|
}
|
|
525
|
-
|
|
526
|
-
// Value first so shopify merchants can set (extra) display transformers in the shopify app
|
|
527
|
-
// Calling these functions normally doesn't do anything, but our shopify app respects them
|
|
528
|
-
// Them being here is value first too because this can be easily imported in the product card editor
|
|
529
|
-
let $606c221d98ba4d92$var$extraDisplayTransformers;
|
|
530
|
-
const $606c221d98ba4d92$export$b2d94be4f02525b2 = () => $606c221d98ba4d92$var$extraDisplayTransformers;
|
|
531
|
-
const $606c221d98ba4d92$export$f98b8d5ea7207a1 = displayTransformers => $606c221d98ba4d92$var$extraDisplayTransformers = displayTransformers;
|
|
532
536
|
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
533
537
|
const signal = $5vyXB$solidjs.createSignal(false);
|
|
534
538
|
$5vyXB$solidjs.onCleanup($5vyXB$depictaiutilishared.javascript_media_query(media_query, ({
|
|
@@ -7801,16 +7805,19 @@ async function $6382a1b83da39674$var$download_categories(merchant, market, local
|
|
|
7801
7805
|
function $26a56f6b44703084$export$9862539c89138352({
|
|
7802
7806
|
get_default_values_: get_default_values_,
|
|
7803
7807
|
router_: router_,
|
|
7804
|
-
prefix_: prefix_
|
|
7808
|
+
prefix_: prefix_,
|
|
7809
|
+
preserveKeys_: preserveKeys_
|
|
7805
7810
|
}) {
|
|
7806
7811
|
const get_prefixed_default_values_ = () => {
|
|
7807
7812
|
const default_values = get_default_values_();
|
|
7808
7813
|
return Object.fromEntries(Object.entries(default_values).map(([key, value]) => [prefix_ + key, value]));
|
|
7809
7814
|
};
|
|
7810
7815
|
const prefixed_state = $6e22b5314fb52f4c$export$e183a13865960371(get_prefixed_default_values_(), router_);
|
|
7816
|
+
const prefixedPreserveKeys = preserveKeys_?.map(key => prefix_ + key);
|
|
7811
7817
|
const reset_state = () => {
|
|
7812
7818
|
const new_defaults = get_prefixed_default_values_();
|
|
7813
7819
|
for (const key in prefixed_state) {
|
|
7820
|
+
if (prefixedPreserveKeys?.includes(key)) continue;
|
|
7814
7821
|
const new_value = new_defaults[key];
|
|
7815
7822
|
prefixed_state[key][1](new_value);
|
|
7816
7823
|
}
|
|
@@ -8424,8 +8431,13 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
8424
8431
|
local_filter_cache: [],
|
|
8425
8432
|
expanded_hierarchical_filters: [],
|
|
8426
8433
|
scroll_restoration_data: [],
|
|
8427
|
-
history_content_blocks:
|
|
8434
|
+
history_content_blocks: {
|
|
8435
|
+
blocks: [],
|
|
8436
|
+
aspectRatios: {}
|
|
8437
|
+
}
|
|
8428
8438
|
}),
|
|
8439
|
+
// Don't reset content block stuff when leaving category page as we need it for scroll restoration, same with scroll restoration data (actually a bit unsure if this is needed, I think it depends on if someone cleans up our elements before the location changes or after, and maybe some of the test flakyness we have seen is due to this not existing before?)
|
|
8440
|
+
preserveKeys_: ["history_content_blocks", "scroll_restoration_data"],
|
|
8429
8441
|
router_: this.#router,
|
|
8430
8442
|
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
8431
8443
|
});
|
|
@@ -9490,8 +9502,15 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
9490
9502
|
for_id: for_id
|
|
9491
9503
|
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
9492
9504
|
});
|
|
9493
|
-
const
|
|
9494
|
-
|
|
9505
|
+
const layout = $5vyXB$solidjs.createMemo(() => {
|
|
9506
|
+
const incoming_layout = layout_options_().layout;
|
|
9507
|
+
if (incoming_layout === "slider-without-filters") return "slider";
|
|
9508
|
+
return incoming_layout || "grid";
|
|
9509
|
+
});
|
|
9510
|
+
const doesnt_have_content_blocks = $5vyXB$solidjs.createMemo(() => !content_blocks_by_row_() || layout() !== "grid");
|
|
9511
|
+
const content_blocks_ = $5vyXB$solidjs.createMemo(() => doesnt_have_content_blocks() ?
|
|
9512
|
+
// This bailing here is to not use proxy/stores and retain old browser compatibility when no content blocks are present
|
|
9513
|
+
() => [] : $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
9495
9514
|
content_blocks_: content_blocks_by_row_,
|
|
9496
9515
|
cols_at_size_: modified_cols_at_size,
|
|
9497
9516
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
@@ -9503,11 +9522,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
9503
9522
|
num_placeholders_: num_placeholders_
|
|
9504
9523
|
});
|
|
9505
9524
|
});
|
|
9506
|
-
const layout = $5vyXB$solidjs.createMemo(() => {
|
|
9507
|
-
const incoming_layout = layout_options_().layout;
|
|
9508
|
-
if (incoming_layout === "slider-without-filters") return "slider";
|
|
9509
|
-
return incoming_layout || "grid";
|
|
9510
|
-
});
|
|
9511
9525
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $5vyXB$solidjs.createSignal(false);
|
|
9512
9526
|
const block_suspense_if_needed = () => {
|
|
9513
9527
|
if (!is_just_after_plp_results_update) return;
|
|
@@ -9530,7 +9544,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
9530
9544
|
}, {
|
|
9531
9545
|
defer: true
|
|
9532
9546
|
}));
|
|
9533
|
-
$5vyXB$solidjs.createEffect(() => layout() !== "grid" && !doesnt_have_content_blocks() && $5vyXB$depictaiutilishared.dwarn("Slider layout doesn't support content blocks"));
|
|
9534
9547
|
/*
|
|
9535
9548
|
This suspense ensures that if someone has async templates, we still show placeholders until the product cards actually have finished rendering (automagically since they're createResource's)
|
|
9536
9549
|
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
@@ -12362,68 +12375,117 @@ function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
12362
12375
|
});
|
|
12363
12376
|
tracking_function_for_plp_results(plp_results_);
|
|
12364
12377
|
}
|
|
12365
|
-
var $32c662f618f5d80d$var$_tmpl$ = ["<
|
|
12378
|
+
var $32c662f618f5d80d$var$_tmpl$ = ["<video", ' muted="" autoplay="" playsinline="" loop class="d-standard-content"></video>'];
|
|
12366
12379
|
function $32c662f618f5d80d$export$780a853d15174484({
|
|
12367
|
-
|
|
12368
|
-
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12372
|
-
|
|
12373
|
-
},
|
|
12374
|
-
router_: router_
|
|
12380
|
+
link_: link_,
|
|
12381
|
+
type_: type_,
|
|
12382
|
+
router_: router_,
|
|
12383
|
+
setAspectRatioWas_: setAspectRatioWas_,
|
|
12384
|
+
mediaUrl_: mediaUrl_,
|
|
12385
|
+
aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
|
|
12375
12386
|
}) {
|
|
12376
|
-
|
|
12377
|
-
|
|
12378
|
-
|
|
12379
|
-
|
|
12380
|
-
|
|
12381
|
-
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
}
|
|
12391
|
-
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
|
|
12395
|
-
|
|
12396
|
-
|
|
12397
|
-
|
|
12398
|
-
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12387
|
+
const [wrapperSize, setWrapperSize] = $5vyXB$solidjs.createSignal();
|
|
12388
|
+
const isImage = type_ === "image";
|
|
12389
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjsweb.Dynamic), $5vyXB$solidjsweb.mergeProps({
|
|
12390
|
+
component: link_ ? "a" : "div",
|
|
12391
|
+
"class": "d-standard-content-wrapper",
|
|
12392
|
+
get style() {
|
|
12393
|
+
return aspectRatioWhenAloneInRow_() ? `--media-aspect-ratio: ${aspectRatioWhenAloneInRow_()}` : "";
|
|
12394
|
+
},
|
|
12395
|
+
get onClick() {
|
|
12396
|
+
return $5vyXB$depictaiutilisharedlatest.catchify(ev => link_ && router_.navigate_.go_to_({
|
|
12397
|
+
new_url_: link_,
|
|
12398
|
+
is_replace_: false,
|
|
12399
|
+
event_: ev
|
|
12400
|
+
}));
|
|
12401
|
+
}
|
|
12402
|
+
}, link_ && {
|
|
12403
|
+
href: link_
|
|
12404
|
+
}, {
|
|
12405
|
+
get children() {
|
|
12406
|
+
return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Switch), {
|
|
12407
|
+
get children() {
|
|
12408
|
+
return [$5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Match), {
|
|
12409
|
+
when: isImage,
|
|
12410
|
+
get children() {
|
|
12411
|
+
return $5vyXB$solidjsweb.createComponent((0, $d212a67662c5cf38$export$140423fa4bfb6d63), {
|
|
12412
|
+
size: () => wrapperSize()?.[0]?.() || 0,
|
|
12413
|
+
sizeHeight: () => wrapperSize()?.[1]?.() || 0,
|
|
12414
|
+
src: mediaUrl_,
|
|
12415
|
+
"class": "d-standard-content"
|
|
12416
|
+
});
|
|
12417
|
+
}
|
|
12418
|
+
}), $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Match), {
|
|
12419
|
+
when: type_ === "video",
|
|
12420
|
+
get children() {
|
|
12421
|
+
return $5vyXB$solidjsweb.ssr($32c662f618f5d80d$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey() + $5vyXB$solidjsweb.ssrAttribute("src", $5vyXB$solidjsweb.escape(mediaUrl_, true), false));
|
|
12422
|
+
}
|
|
12423
|
+
})];
|
|
12424
|
+
}
|
|
12425
|
+
});
|
|
12426
|
+
}
|
|
12427
|
+
}));
|
|
12405
12428
|
}
|
|
12406
12429
|
function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
|
|
12430
|
+
let hasSeenContentBlock = false;
|
|
12407
12431
|
const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
|
|
12432
|
+
const contentComponents = new Map();
|
|
12408
12433
|
$5vyXB$solidjs.createEffect(() => {
|
|
12409
12434
|
const serverContentBlock = plp_meta()?.content_blocks;
|
|
12410
|
-
|
|
12435
|
+
const currentHistory = $5vyXB$solidjs.untrack(historyContentBlocks);
|
|
12436
|
+
// Only write to the history if the content blocks have changed when a new backend results arrives (we have them in history so scroll restoration works when going back, even when running shopify without single page navigations where our script dies inbetween pages).
|
|
12437
|
+
if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
|
|
12438
|
+
...currentHistory,
|
|
12439
|
+
blocks: serverContentBlock
|
|
12440
|
+
});
|
|
12411
12441
|
});
|
|
12412
12442
|
const contentBlocksByRow = $5vyXB$solidjs.createMemo(() => {
|
|
12413
12443
|
const developerProvided = content_blocks_by_row_();
|
|
12414
|
-
const
|
|
12415
|
-
|
|
12416
|
-
|
|
12444
|
+
const {
|
|
12445
|
+
blocks: blocksFromHistory
|
|
12446
|
+
} = historyContentBlocks();
|
|
12447
|
+
if (developerProvided) return developerProvided;
|
|
12448
|
+
// If we didn't get any content blocks (backend always return empty array) and we haven't seen any content blocks yet, return undefined
|
|
12449
|
+
// This is so the result rendering (PLPResults) will still use flexbox provided rendering on existing customers, so adding this isn't a breaking change
|
|
12450
|
+
// We don't want to switch rendering method every time one switches between a collection that hasn't vs has content blocks though, so once we've seen one content block we'll switch to css-grid-based rendering
|
|
12451
|
+
if (!blocksFromHistory?.length && !hasSeenContentBlock) return;
|
|
12417
12452
|
const content = [];
|
|
12418
|
-
|
|
12453
|
+
hasSeenContentBlock = true;
|
|
12454
|
+
blocksFromHistory.forEach(row => {
|
|
12455
|
+
const {
|
|
12456
|
+
content: {
|
|
12457
|
+
link: link,
|
|
12458
|
+
type: type,
|
|
12459
|
+
url: url
|
|
12460
|
+
}
|
|
12461
|
+
} = row;
|
|
12462
|
+
// Key the "content"-component by the link, type and url, so we can reuse the component (and later downstream the block elements) if it's the same
|
|
12463
|
+
// This makes the block not flicker when going backwards/forwards if the content is the same on both pages
|
|
12464
|
+
// Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
|
|
12465
|
+
const componentCacheKey = JSON.stringify([link, type, url]);
|
|
12466
|
+
let component = contentComponents.get(componentCacheKey);
|
|
12467
|
+
if (!component) {
|
|
12468
|
+
component = () => $5vyXB$solidjsweb.createComponent((0, $32c662f618f5d80d$export$780a853d15174484), {
|
|
12469
|
+
link_: link,
|
|
12470
|
+
type_: type,
|
|
12471
|
+
mediaUrl_: url,
|
|
12472
|
+
router_: router_,
|
|
12473
|
+
aspectRatioWhenAloneInRow_: () => historyContentBlocks().aspectRatios[componentCacheKey],
|
|
12474
|
+
setAspectRatioWas_: aspectRatio => setHistoryContentBlocks(prev => ({
|
|
12475
|
+
...prev,
|
|
12476
|
+
aspectRatios: {
|
|
12477
|
+
...prev.aspectRatios,
|
|
12478
|
+
[componentCacheKey]: Math.round(aspectRatio * 100) / 100
|
|
12479
|
+
}
|
|
12480
|
+
}))
|
|
12481
|
+
});
|
|
12482
|
+
contentComponents.set(componentCacheKey, component);
|
|
12483
|
+
}
|
|
12419
12484
|
const contentBlock = {
|
|
12420
12485
|
span_columns: row.span_columns,
|
|
12421
12486
|
span_rows: row.span_rows,
|
|
12422
12487
|
position: row.position,
|
|
12423
|
-
content:
|
|
12424
|
-
contentBlock_: row,
|
|
12425
|
-
router_: router_
|
|
12426
|
-
})
|
|
12488
|
+
content: component
|
|
12427
12489
|
};
|
|
12428
12490
|
content[row.row] = contentBlock;
|
|
12429
12491
|
});
|
package/server/latest/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { JSX, Accessor, Setter, Signal } from "solid-js";
|
|
2
1
|
import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer, ColsAtSize, Elem, Node_Array } from "@depict-ai/utilishared/latest";
|
|
3
2
|
import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
|
|
4
3
|
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
5
4
|
import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
|
|
5
|
+
import { JSX, Accessor, Setter, Signal } from "solid-js";
|
|
6
6
|
import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
|
|
7
7
|
import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
|
|
8
8
|
import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
|
|
@@ -11,7 +11,61 @@ 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.
|
|
14
|
+
export const version = "4.8.1";
|
|
15
|
+
type DisplayTransformerAlwaysThereData = {
|
|
16
|
+
merchant: string;
|
|
17
|
+
market: string;
|
|
18
|
+
locale: string;
|
|
19
|
+
};
|
|
20
|
+
type CanBePromiseWrapped<T> = T | Promise<T>;
|
|
21
|
+
export type ModernDisplayWithPageUrl<T extends ModernDisplay> = { [K in keyof T]: K extends "variant_displays" ? (T[K][number] & {
|
|
22
|
+
page_url: string;
|
|
23
|
+
})[] : T[K] };
|
|
24
|
+
/**
|
|
25
|
+
* A ProductListing with ancestors added in, this is what we pass to the display transformers as the ancestors might be required to construct the URL
|
|
26
|
+
*/
|
|
27
|
+
type ProductListingWithAncestors = ProductListing & {
|
|
28
|
+
ancestors: Ancestors;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The displayTransformer for categories does not only get a list of ListingSuggestions, when a search query has listing suggestions, but also their ancestors since we show breadcrumbs for the listing suggestions. To let the user differentiate (since the suggestion ones can be added/removed but not the ancestors) we add a boolean is_suggestion to the listing suggestions passed to the displayTransformer.
|
|
32
|
+
*/
|
|
33
|
+
type ListingSuggestionForTransformer = (ListingSuggestion & {
|
|
34
|
+
is_suggestion: true;
|
|
35
|
+
}) | (Omit<ListingSuggestion, "suggestions_result_id"> & {
|
|
36
|
+
is_suggestion: false;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* DisplayTransformers supersede pageURLCreator
|
|
40
|
+
* DisplayTransformers are functions that take in a list of categories, content search results or products and then can transform or enrich the data for each category, content search result or product card in a batched way.
|
|
41
|
+
*/
|
|
42
|
+
export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
|
|
43
|
+
products?: (options: DisplayTransformerAlwaysThereData & {
|
|
44
|
+
displays: InputDisplay[];
|
|
45
|
+
}) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
|
|
46
|
+
categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
|
|
47
|
+
data: T[];
|
|
48
|
+
}) => CanBePromiseWrapped<(T & {
|
|
49
|
+
page_url: string;
|
|
50
|
+
})[]>;
|
|
51
|
+
contentResults?: (options: DisplayTransformerAlwaysThereData & {
|
|
52
|
+
data: ContentLink[];
|
|
53
|
+
}) => CanBePromiseWrapped<ContentLink[]>;
|
|
54
|
+
};
|
|
55
|
+
export type SomethingTakingADisplayTransformers<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = InputDisplay extends ModernDisplay ? "page_url" extends keyof InputDisplay["variant_displays"][number] ? {
|
|
56
|
+
display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
|
|
57
|
+
} : {
|
|
58
|
+
display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
|
|
59
|
+
} : {
|
|
60
|
+
page_url_creator?: never;
|
|
61
|
+
display_transformers?: never;
|
|
62
|
+
};
|
|
63
|
+
export const getExtraDisplayTransformers: () => DisplayTransformers<any, any> | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* When called from inside the shopify apps product card editor, this registers extra display transformers to be ran alongside Depict's default added ones. The ones for products and content will run after Depicts but the ones for categories will run before Depicts.
|
|
66
|
+
* @param displayTransformers
|
|
67
|
+
*/
|
|
68
|
+
export const setExtraDisplayTransformers: <InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay = ModernDisplayWithPageUrl<InputDisplay>>(displayTransformers: DisplayTransformers<InputDisplay, OutputDisplay>) => DisplayTransformers<InputDisplay, OutputDisplay>;
|
|
15
69
|
/**
|
|
16
70
|
* Provider to wrap every listing (group of products) in
|
|
17
71
|
* Used for example for deduplicating ResizeObservers for responsive images
|
|
@@ -115,10 +169,6 @@ export function TextPlaceholder(props: {
|
|
|
115
169
|
class?: string;
|
|
116
170
|
}): JSX.Element;
|
|
117
171
|
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
118
|
-
/**
|
|
119
|
-
* Returns two accessors (one width and one height) that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
120
|
-
*/
|
|
121
|
-
export function makeSizeAccessors(whatToWatch: HTMLElement): [Accessor<number>, Accessor<number>];
|
|
122
172
|
export const shopifyContainedImageContextSymbol: unique symbol;
|
|
123
173
|
/**
|
|
124
174
|
* Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.
|
|
@@ -147,60 +197,6 @@ export function ModernResponsiveContainedImage(props: Parameters<typeof ShopifyC
|
|
|
147
197
|
* Wrapper around ShopifyResponsiveImg (component that just does an image, without wrapping in div). The wrapper allows ShopifyResponsiveImg to work both with shopify CDN URLs and arbitrary URLs, where the latter will be fed through Depict's cloudflare resizer.
|
|
148
198
|
*/
|
|
149
199
|
export function ModernResponsiveImage(props: Parameters<typeof ShopifyResponsiveImg>[0]): import("solid-js").JSX.Element;
|
|
150
|
-
type DisplayTransformerAlwaysThereData = {
|
|
151
|
-
merchant: string;
|
|
152
|
-
market: string;
|
|
153
|
-
locale: string;
|
|
154
|
-
};
|
|
155
|
-
type CanBePromiseWrapped<T> = T | Promise<T>;
|
|
156
|
-
export type ModernDisplayWithPageUrl<T extends ModernDisplay> = { [K in keyof T]: K extends "variant_displays" ? (T[K][number] & {
|
|
157
|
-
page_url: string;
|
|
158
|
-
})[] : T[K] };
|
|
159
|
-
/**
|
|
160
|
-
* A ProductListing with ancestors added in, this is what we pass to the display transformers as the ancestors might be required to construct the URL
|
|
161
|
-
*/
|
|
162
|
-
type ProductListingWithAncestors = ProductListing & {
|
|
163
|
-
ancestors: Ancestors;
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* The displayTransformer for categories does not only get a list of ListingSuggestions, when a search query has listing suggestions, but also their ancestors since we show breadcrumbs for the listing suggestions. To let the user differentiate (since the suggestion ones can be added/removed but not the ancestors) we add a boolean is_suggestion to the listing suggestions passed to the displayTransformer.
|
|
167
|
-
*/
|
|
168
|
-
type ListingSuggestionForTransformer = (ListingSuggestion & {
|
|
169
|
-
is_suggestion: true;
|
|
170
|
-
}) | (Omit<ListingSuggestion, "suggestions_result_id"> & {
|
|
171
|
-
is_suggestion: false;
|
|
172
|
-
});
|
|
173
|
-
/**
|
|
174
|
-
* DisplayTransformers supersede pageURLCreator
|
|
175
|
-
* DisplayTransformers are functions that take in a list of categories, content search results or products and then can transform or enrich the data for each category, content search result or product card in a batched way.
|
|
176
|
-
*/
|
|
177
|
-
export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
|
|
178
|
-
products?: (options: DisplayTransformerAlwaysThereData & {
|
|
179
|
-
displays: InputDisplay[];
|
|
180
|
-
}) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
|
|
181
|
-
categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
|
|
182
|
-
data: T[];
|
|
183
|
-
}) => CanBePromiseWrapped<(T & {
|
|
184
|
-
page_url: string;
|
|
185
|
-
})[]>;
|
|
186
|
-
contentResults?: (options: DisplayTransformerAlwaysThereData & {
|
|
187
|
-
data: ContentLink[];
|
|
188
|
-
}) => CanBePromiseWrapped<ContentLink[]>;
|
|
189
|
-
};
|
|
190
|
-
export type SomethingTakingADisplayTransformers<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = InputDisplay extends ModernDisplay ? "page_url" extends keyof InputDisplay["variant_displays"][number] ? {
|
|
191
|
-
display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
|
|
192
|
-
} : {
|
|
193
|
-
display_transformers: DisplayTransformers<InputDisplay, OutputDisplay>;
|
|
194
|
-
} : {
|
|
195
|
-
page_url_creator?: never;
|
|
196
|
-
display_transformers?: never;
|
|
197
|
-
};
|
|
198
|
-
export const getExtraDisplayTransformers: () => DisplayTransformers<any, any> | undefined;
|
|
199
|
-
/**
|
|
200
|
-
*
|
|
201
|
-
* @param displayTransformers
|
|
202
|
-
*/
|
|
203
|
-
export const setExtraDisplayTransformers: <InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay = ModernDisplayWithPageUrl<InputDisplay>>(displayTransformers: DisplayTransformers<InputDisplay, OutputDisplay>) => DisplayTransformers<InputDisplay, OutputDisplay>;
|
|
204
200
|
/**
|
|
205
201
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
206
202
|
*/
|
|
@@ -1315,6 +1311,10 @@ export const embedded_num_products: ({
|
|
|
1315
1311
|
* Gets available listings for a given merchant, market and locale
|
|
1316
1312
|
*/
|
|
1317
1313
|
export function get_listings(merchant: string, market: string, locale: string): Promise<import("@depict-ai/types/api/ListListingsResponseItem").ListListingsResponseItem1[]>;
|
|
1314
|
+
type ContentBlockHistoryState = {
|
|
1315
|
+
blocks: _ContentBlock1[];
|
|
1316
|
+
aspectRatios: Record<string, number>;
|
|
1317
|
+
};
|
|
1318
1318
|
type GeneralCategoryListingOptions = {
|
|
1319
1319
|
market: string;
|
|
1320
1320
|
merchant: string;
|
|
@@ -1351,7 +1351,7 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
|
|
|
1351
1351
|
expanded_: boolean;
|
|
1352
1352
|
}[]>;
|
|
1353
1353
|
scroll_restoration_data: Signal<ScrollRestorationData>;
|
|
1354
|
-
history_content_blocks: Signal<
|
|
1354
|
+
history_content_blocks: Signal<ContentBlockHistoryState>;
|
|
1355
1355
|
};
|
|
1356
1356
|
/**
|
|
1357
1357
|
* Signal representing the currently selected filters. Will update to always reflect the state of the current URL. Calling the setter triggers a navigation (replaceState) to an updated URL.
|