@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/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__*/$gVhhF$solidjs.createContext();
|
|
113
119
|
function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
|
|
114
120
|
const our_object = {};
|
|
@@ -188,7 +194,11 @@ const $19950faaac026e09$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingCo
|
|
|
188
194
|
function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
189
195
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
190
196
|
const [ourRatioKeyed, setOurRatioKeyed] = $gVhhF$solidjs.createSignal();
|
|
197
|
+
const [rAFSinceReturned, setRAFSinceReturned] = $gVhhF$solidjs.createSignal(false);
|
|
191
198
|
const sizeToUse = $gVhhF$solidjs.createMemo(() => {
|
|
199
|
+
// 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.
|
|
200
|
+
// 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
|
|
201
|
+
rAFSinceReturned();
|
|
192
202
|
// 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)
|
|
193
203
|
const incomingSize = props.size();
|
|
194
204
|
const ratio = ourRatioKeyed();
|
|
@@ -344,6 +354,7 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
344
354
|
hasDecodedFastPath = true;
|
|
345
355
|
});
|
|
346
356
|
});
|
|
357
|
+
$gVhhF$solidjs.createEffect(() => hasDecoded() && requestAnimationFrame($gVhhF$depictaiutilishared.catchify(() => setRAFSinceReturned(prev => !prev))));
|
|
347
358
|
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
348
359
|
get when() {
|
|
349
360
|
return hasDecoded();
|
|
@@ -560,13 +571,6 @@ function $d212a67662c5cf38$export$140423fa4bfb6d63(props) {
|
|
|
560
571
|
customUrls: $d212a67662c5cf38$var$customUrls
|
|
561
572
|
}));
|
|
562
573
|
}
|
|
563
|
-
|
|
564
|
-
// Value first so shopify merchants can set (extra) display transformers in the shopify app
|
|
565
|
-
// Calling these functions normally doesn't do anything, but our shopify app respects them
|
|
566
|
-
// Them being here is value first too because this can be easily imported in the product card editor
|
|
567
|
-
let $606c221d98ba4d92$var$extraDisplayTransformers;
|
|
568
|
-
const $606c221d98ba4d92$export$b2d94be4f02525b2 = () => $606c221d98ba4d92$var$extraDisplayTransformers;
|
|
569
|
-
const $606c221d98ba4d92$export$f98b8d5ea7207a1 = displayTransformers => $606c221d98ba4d92$var$extraDisplayTransformers = displayTransformers;
|
|
570
574
|
function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
571
575
|
const signal = $gVhhF$solidjs.createSignal(false);
|
|
572
576
|
$gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
|
|
@@ -9907,16 +9911,19 @@ async function $6382a1b83da39674$var$download_categories(merchant, market, local
|
|
|
9907
9911
|
function $26a56f6b44703084$export$9862539c89138352({
|
|
9908
9912
|
get_default_values_: get_default_values_,
|
|
9909
9913
|
router_: router_,
|
|
9910
|
-
prefix_: prefix_
|
|
9914
|
+
prefix_: prefix_,
|
|
9915
|
+
preserveKeys_: preserveKeys_
|
|
9911
9916
|
}) {
|
|
9912
9917
|
const get_prefixed_default_values_ = () => {
|
|
9913
9918
|
const default_values = get_default_values_();
|
|
9914
9919
|
return Object.fromEntries(Object.entries(default_values).map(([key, value]) => [prefix_ + key, value]));
|
|
9915
9920
|
};
|
|
9916
9921
|
const prefixed_state = $6e22b5314fb52f4c$export$e183a13865960371(get_prefixed_default_values_(), router_);
|
|
9922
|
+
const prefixedPreserveKeys = preserveKeys_?.map(key => prefix_ + key);
|
|
9917
9923
|
const reset_state = () => {
|
|
9918
9924
|
const new_defaults = get_prefixed_default_values_();
|
|
9919
9925
|
for (const key in prefixed_state) {
|
|
9926
|
+
if (prefixedPreserveKeys?.includes(key)) continue;
|
|
9920
9927
|
const new_value = new_defaults[key];
|
|
9921
9928
|
prefixed_state[key][1](new_value);
|
|
9922
9929
|
}
|
|
@@ -10525,8 +10532,13 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
|
|
|
10525
10532
|
local_filter_cache: [],
|
|
10526
10533
|
expanded_hierarchical_filters: [],
|
|
10527
10534
|
scroll_restoration_data: [],
|
|
10528
|
-
history_content_blocks:
|
|
10535
|
+
history_content_blocks: {
|
|
10536
|
+
blocks: [],
|
|
10537
|
+
aspectRatios: {}
|
|
10538
|
+
}
|
|
10529
10539
|
}),
|
|
10540
|
+
// 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?)
|
|
10541
|
+
preserveKeys_: ["history_content_blocks", "scroll_restoration_data"],
|
|
10530
10542
|
router_: this.#router,
|
|
10531
10543
|
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
10532
10544
|
});
|
|
@@ -11444,8 +11456,15 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
11444
11456
|
for_id: for_id
|
|
11445
11457
|
}) => for_id === id_currently_querying_for_())?.min_results_loaded ?? min_products_to_fetch_);
|
|
11446
11458
|
});
|
|
11447
|
-
const
|
|
11448
|
-
|
|
11459
|
+
const layout = $gVhhF$solidjs.createMemo(() => {
|
|
11460
|
+
const incoming_layout = layout_options_().layout;
|
|
11461
|
+
if (incoming_layout === "slider-without-filters") return "slider";
|
|
11462
|
+
return incoming_layout || "grid";
|
|
11463
|
+
});
|
|
11464
|
+
const doesnt_have_content_blocks = $gVhhF$solidjs.createMemo(() => !content_blocks_by_row_() || layout() !== "grid");
|
|
11465
|
+
const content_blocks_ = $gVhhF$solidjs.createMemo(() => doesnt_have_content_blocks() ?
|
|
11466
|
+
// This bailing here is to not use proxy/stores and retain old browser compatibility when no content blocks are present
|
|
11467
|
+
() => [] : $d92f338ba8f9da9b$export$791ef57e62e21c3f({
|
|
11449
11468
|
content_blocks_: content_blocks_by_row_,
|
|
11450
11469
|
cols_at_size_: modified_cols_at_size,
|
|
11451
11470
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
@@ -11457,11 +11476,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
11457
11476
|
num_placeholders_: num_placeholders_
|
|
11458
11477
|
});
|
|
11459
11478
|
});
|
|
11460
|
-
const layout = $gVhhF$solidjs.createMemo(() => {
|
|
11461
|
-
const incoming_layout = layout_options_().layout;
|
|
11462
|
-
if (incoming_layout === "slider-without-filters") return "slider";
|
|
11463
|
-
return incoming_layout || "grid";
|
|
11464
|
-
});
|
|
11465
11479
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $gVhhF$solidjs.createSignal(false);
|
|
11466
11480
|
const block_suspense_if_needed = () => {
|
|
11467
11481
|
if (!is_just_after_plp_results_update) return;
|
|
@@ -11484,7 +11498,6 @@ function $fe76fb463cc60b89$export$3925f87b1545cfc6({
|
|
|
11484
11498
|
}, {
|
|
11485
11499
|
defer: true
|
|
11486
11500
|
}));
|
|
11487
|
-
$gVhhF$solidjs.createEffect(() => layout() !== "grid" && !doesnt_have_content_blocks() && $gVhhF$depictaiutilishared.dwarn("Slider layout doesn't support content blocks"));
|
|
11488
11501
|
/*
|
|
11489
11502
|
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)
|
|
11490
11503
|
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
@@ -14918,89 +14931,132 @@ function $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id, i18n_) {
|
|
|
14918
14931
|
$gVhhF$solidjs.onCleanup(disconnect);
|
|
14919
14932
|
}
|
|
14920
14933
|
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
14921
|
-
var $32c662f618f5d80d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<
|
|
14934
|
+
var $32c662f618f5d80d$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<video loop class=d-standard-content>`);
|
|
14922
14935
|
function $32c662f618f5d80d$export$780a853d15174484({
|
|
14923
|
-
|
|
14924
|
-
|
|
14925
|
-
|
|
14926
|
-
|
|
14927
|
-
|
|
14928
|
-
|
|
14929
|
-
},
|
|
14930
|
-
router_: router_
|
|
14936
|
+
link_: link_,
|
|
14937
|
+
type_: type_,
|
|
14938
|
+
router_: router_,
|
|
14939
|
+
setAspectRatioWas_: setAspectRatioWas_,
|
|
14940
|
+
mediaUrl_: mediaUrl_,
|
|
14941
|
+
aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
|
|
14931
14942
|
}) {
|
|
14932
|
-
|
|
14933
|
-
|
|
14934
|
-
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
}
|
|
14945
|
-
}, link && {
|
|
14946
|
-
href: link
|
|
14947
|
-
}, {
|
|
14948
|
-
get children() {
|
|
14949
|
-
return $gVhhF$solidjsweb.createComponent((0, $d212a67662c5cf38$export$140423fa4bfb6d63), {
|
|
14950
|
-
size: () => wrapperSize()?.[0]?.() || 0,
|
|
14951
|
-
sizeHeight: () => wrapperSize()?.[1]?.() || 0,
|
|
14952
|
-
src: mediaUrl,
|
|
14953
|
-
"class": "d-standard-content"
|
|
14954
|
-
});
|
|
14955
|
-
}
|
|
14956
|
-
}));
|
|
14957
|
-
}
|
|
14958
|
-
if (type === "video") {
|
|
14959
|
-
const pageVisible = $55cbacb79d3e0cea$export$54299a3c81f5425();
|
|
14960
|
-
return (() => {
|
|
14961
|
-
var _el$ = $gVhhF$solidjsweb.getNextElement($32c662f618f5d80d$var$_tmpl$),
|
|
14962
|
-
_el$2 = _el$.firstChild;
|
|
14963
|
-
$gVhhF$solidjsweb.addEventListener(_el$, "click", $gVhhF$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
|
|
14964
|
-
new_url_: link,
|
|
14943
|
+
const [wrapperSize, setWrapperSize] = $gVhhF$solidjs.createSignal();
|
|
14944
|
+
const isImage = type_ === "image";
|
|
14945
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjsweb.Dynamic), $gVhhF$solidjsweb.mergeProps({
|
|
14946
|
+
component: link_ ? "a" : "div",
|
|
14947
|
+
"class": "d-standard-content-wrapper",
|
|
14948
|
+
get style() {
|
|
14949
|
+
return $gVhhF$solidjsweb.memo(() => !!aspectRatioWhenAloneInRow_())() ? `--media-aspect-ratio: ${aspectRatioWhenAloneInRow_()}` : "";
|
|
14950
|
+
},
|
|
14951
|
+
ref: el => isImage && setWrapperSize(() => $128302ab61dab8f1$export$54c6d6ff54e72743(el)),
|
|
14952
|
+
get onClick() {
|
|
14953
|
+
return $gVhhF$depictaiutilisharedlatest.catchify(ev => link_ && router_.navigate_.go_to_({
|
|
14954
|
+
new_url_: link_,
|
|
14965
14955
|
is_replace_: false,
|
|
14966
14956
|
event_: ev
|
|
14967
|
-
}))
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
14973
|
-
$gVhhF$solidjsweb.
|
|
14974
|
-
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
14957
|
+
}));
|
|
14958
|
+
}
|
|
14959
|
+
}, link_ && {
|
|
14960
|
+
href: link_
|
|
14961
|
+
}, {
|
|
14962
|
+
get children() {
|
|
14963
|
+
return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Switch), {
|
|
14964
|
+
get children() {
|
|
14965
|
+
return [$gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Match), {
|
|
14966
|
+
when: isImage,
|
|
14967
|
+
get children() {
|
|
14968
|
+
return $gVhhF$solidjsweb.createComponent((0, $d212a67662c5cf38$export$140423fa4bfb6d63), {
|
|
14969
|
+
size: () => wrapperSize()?.[0]?.() || 0,
|
|
14970
|
+
sizeHeight: () => wrapperSize()?.[1]?.() || 0,
|
|
14971
|
+
src: mediaUrl_,
|
|
14972
|
+
"class": "d-standard-content",
|
|
14973
|
+
ref: el => el.addEventListener("load", $gVhhF$depictaiutilisharedlatest.catchify(() => setAspectRatioWas_(el.naturalWidth / el.naturalHeight)))
|
|
14974
|
+
});
|
|
14975
|
+
}
|
|
14976
|
+
}), $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Match), {
|
|
14977
|
+
when: type_ === "video",
|
|
14978
|
+
get children() {
|
|
14979
|
+
var _el$ = $gVhhF$solidjsweb.getNextElement($32c662f618f5d80d$var$_tmpl$);
|
|
14980
|
+
$gVhhF$solidjsweb.use(element => {
|
|
14981
|
+
const pageVisible = $55cbacb79d3e0cea$export$54299a3c81f5425();
|
|
14982
|
+
element.addEventListener("loadedmetadata", $gVhhF$depictaiutilisharedlatest.catchify(() => setAspectRatioWas_(element.videoWidth / element.videoHeight)));
|
|
14983
|
+
$gVhhF$solidjs.createEffect(() => {
|
|
14984
|
+
if (pageVisible()) element.play().catch(e => $gVhhF$depictaiutilishared.dlog("Failed to play", e));else element.pause();
|
|
14985
|
+
});
|
|
14986
|
+
}, _el$);
|
|
14987
|
+
$gVhhF$solidjsweb.setAttribute(_el$, "src", mediaUrl_);
|
|
14988
|
+
$gVhhF$solidjsweb.setProperty(_el$, "controls", false);
|
|
14989
|
+
$gVhhF$solidjsweb.setProperty(_el$, "muted", true);
|
|
14990
|
+
$gVhhF$solidjsweb.setProperty(_el$, "autoplay", true);
|
|
14991
|
+
$gVhhF$solidjsweb.setProperty(_el$, "playsinline", true);
|
|
14992
|
+
return _el$;
|
|
14993
|
+
}
|
|
14994
|
+
})];
|
|
14995
|
+
}
|
|
14996
|
+
});
|
|
14997
|
+
}
|
|
14998
|
+
}));
|
|
14981
14999
|
}
|
|
14982
|
-
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
14983
15000
|
function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
|
|
15001
|
+
let hasSeenContentBlock = false;
|
|
14984
15002
|
const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
|
|
15003
|
+
const contentComponents = new Map();
|
|
14985
15004
|
$gVhhF$solidjs.createEffect(() => {
|
|
14986
15005
|
const serverContentBlock = plp_meta()?.content_blocks;
|
|
14987
|
-
|
|
15006
|
+
const currentHistory = $gVhhF$solidjs.untrack(historyContentBlocks);
|
|
15007
|
+
// 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).
|
|
15008
|
+
if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
|
|
15009
|
+
...currentHistory,
|
|
15010
|
+
blocks: serverContentBlock
|
|
15011
|
+
});
|
|
14988
15012
|
});
|
|
14989
15013
|
const contentBlocksByRow = $gVhhF$solidjs.createMemo(() => {
|
|
14990
15014
|
const developerProvided = content_blocks_by_row_();
|
|
14991
|
-
const
|
|
14992
|
-
|
|
14993
|
-
|
|
15015
|
+
const {
|
|
15016
|
+
blocks: blocksFromHistory
|
|
15017
|
+
} = historyContentBlocks();
|
|
15018
|
+
if (developerProvided) return developerProvided;
|
|
15019
|
+
// If we didn't get any content blocks (backend always return empty array) and we haven't seen any content blocks yet, return undefined
|
|
15020
|
+
// This is so the result rendering (PLPResults) will still use flexbox provided rendering on existing customers, so adding this isn't a breaking change
|
|
15021
|
+
// 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
|
|
15022
|
+
if (!blocksFromHistory?.length && !hasSeenContentBlock) return;
|
|
14994
15023
|
const content = [];
|
|
14995
|
-
|
|
15024
|
+
hasSeenContentBlock = true;
|
|
15025
|
+
blocksFromHistory.forEach(row => {
|
|
15026
|
+
const {
|
|
15027
|
+
content: {
|
|
15028
|
+
link: link,
|
|
15029
|
+
type: type,
|
|
15030
|
+
url: url
|
|
15031
|
+
}
|
|
15032
|
+
} = row;
|
|
15033
|
+
// 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
|
|
15034
|
+
// This makes the block not flicker when going backwards/forwards if the content is the same on both pages
|
|
15035
|
+
// Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
|
|
15036
|
+
const componentCacheKey = JSON.stringify([link, type, url]);
|
|
15037
|
+
let component = contentComponents.get(componentCacheKey);
|
|
15038
|
+
if (!component) {
|
|
15039
|
+
component = () => $gVhhF$solidjsweb.createComponent((0, $32c662f618f5d80d$export$780a853d15174484), {
|
|
15040
|
+
link_: link,
|
|
15041
|
+
type_: type,
|
|
15042
|
+
mediaUrl_: url,
|
|
15043
|
+
router_: router_,
|
|
15044
|
+
aspectRatioWhenAloneInRow_: () => historyContentBlocks().aspectRatios[componentCacheKey],
|
|
15045
|
+
setAspectRatioWas_: aspectRatio => setHistoryContentBlocks(prev => ({
|
|
15046
|
+
...prev,
|
|
15047
|
+
aspectRatios: {
|
|
15048
|
+
...prev.aspectRatios,
|
|
15049
|
+
[componentCacheKey]: Math.round(aspectRatio * 100) / 100
|
|
15050
|
+
}
|
|
15051
|
+
}))
|
|
15052
|
+
});
|
|
15053
|
+
contentComponents.set(componentCacheKey, component);
|
|
15054
|
+
}
|
|
14996
15055
|
const contentBlock = {
|
|
14997
15056
|
span_columns: row.span_columns,
|
|
14998
15057
|
span_rows: row.span_rows,
|
|
14999
15058
|
position: row.position,
|
|
15000
|
-
content:
|
|
15001
|
-
contentBlock_: row,
|
|
15002
|
-
router_: router_
|
|
15003
|
-
})
|
|
15059
|
+
content: component
|
|
15004
15060
|
};
|
|
15005
15061
|
content[row.row] = contentBlock;
|
|
15006
15062
|
});
|
package/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.
|