@depict-ai/ui 4.8.0 → 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 +133 -83
- package/ES10/index.d.ts +61 -61
- package/ES10/index.js +134 -83
- package/latest/index.cjs +127 -77
- package/latest/index.d.ts +61 -61
- package/latest/index.js +128 -77
- package/package.json +2 -2
- package/server/ES10/index.cjs +120 -64
- package/server/ES10/index.d.ts +61 -61
- package/server/ES10/index.js +121 -64
- package/server/latest/index.cjs +114 -58
- package/server/latest/index.d.ts +61 -61
- package/server/latest/index.js +115 -58
package/ES10/index.cjs
CHANGED
|
@@ -18,9 +18,9 @@ function $parcel$export(e, n, v, s) {
|
|
|
18
18
|
function $parcel$interopDefault(a) {
|
|
19
19
|
return a && a.__esModule ? a.default : a;
|
|
20
20
|
}
|
|
21
|
-
$parcel$export(module.exports, "ModernResponsiveImage", () => $f3db423dc84bc35d$export$140423fa4bfb6d63);
|
|
22
21
|
$parcel$export(module.exports, "setExtraDisplayTransformers", () => $cc9aacef898ccc9a$export$f98b8d5ea7207a1);
|
|
23
22
|
$parcel$export(module.exports, "getExtraDisplayTransformers", () => $cc9aacef898ccc9a$export$b2d94be4f02525b2);
|
|
23
|
+
$parcel$export(module.exports, "ModernResponsiveImage", () => $f3db423dc84bc35d$export$140423fa4bfb6d63);
|
|
24
24
|
$parcel$export(module.exports, "remap_blocks_to_index", () => $f8f375d6245ffff2$export$92aa5d691d588f3f);
|
|
25
25
|
$parcel$export(module.exports, "useMobileHover", () => $0deb6ff75e3d67c6$export$d4d96868197be50e);
|
|
26
26
|
$parcel$export(module.exports, "useVisibilityState", () => $e7a7d2fe8a8217d8$export$54299a3c81f5425);
|
|
@@ -112,9 +112,15 @@ $parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316
|
|
|
112
112
|
$parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7c3ce0ebe51f86);
|
|
113
113
|
$parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
|
|
114
114
|
$parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
|
|
115
|
-
$parcel$export(module.exports, "makeSizeAccessors", () => $054b1113e4897051$export$54c6d6ff54e72743);
|
|
116
115
|
/*! Depict.ai search and product listing SDK */
|
|
117
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.8.
|
|
116
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.8.1";
|
|
117
|
+
|
|
118
|
+
// Value first so shopify merchants can set (extra) display transformers in the shopify app
|
|
119
|
+
// Calling these functions normally doesn't do anything, but our shopify app respects them
|
|
120
|
+
// Them being here is value first too because this can be easily imported in the product card editor
|
|
121
|
+
let $cc9aacef898ccc9a$var$extraDisplayTransformers;
|
|
122
|
+
const $cc9aacef898ccc9a$export$b2d94be4f02525b2 = () => $cc9aacef898ccc9a$var$extraDisplayTransformers;
|
|
123
|
+
const $cc9aacef898ccc9a$export$f98b8d5ea7207a1 = displayTransformers => $cc9aacef898ccc9a$var$extraDisplayTransformers = displayTransformers;
|
|
118
124
|
const $d067f3a30f047b41$var$ListingContext = /*@__PURE__*/$52FdA$solidjs.createContext();
|
|
119
125
|
function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
|
|
120
126
|
const our_object = {};
|
|
@@ -195,8 +201,12 @@ const $858fdcf73148519f$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingCo
|
|
|
195
201
|
function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
196
202
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
197
203
|
const [ourRatioKeyed, setOurRatioKeyed] = $52FdA$solidjs.createSignal();
|
|
204
|
+
const [rAFSinceReturned, setRAFSinceReturned] = $52FdA$solidjs.createSignal(false);
|
|
198
205
|
const sizeToUse = $52FdA$solidjs.createMemo(() => {
|
|
199
206
|
var _props$sizeHeight;
|
|
207
|
+
// 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.
|
|
208
|
+
// 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
|
|
209
|
+
rAFSinceReturned();
|
|
200
210
|
// 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)
|
|
201
211
|
const incomingSize = props.size();
|
|
202
212
|
const ratio = ourRatioKeyed();
|
|
@@ -355,6 +365,7 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
355
365
|
hasDecodedFastPath = true;
|
|
356
366
|
});
|
|
357
367
|
});
|
|
368
|
+
$52FdA$solidjs.createEffect(() => hasDecoded() && requestAnimationFrame($52FdA$depictaiutilishared.catchify(() => setRAFSinceReturned(prev => !prev))));
|
|
358
369
|
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
359
370
|
get when() {
|
|
360
371
|
return hasDecoded();
|
|
@@ -580,13 +591,6 @@ function $f3db423dc84bc35d$export$140423fa4bfb6d63(props) {
|
|
|
580
591
|
customUrls: $f3db423dc84bc35d$var$customUrls
|
|
581
592
|
}));
|
|
582
593
|
}
|
|
583
|
-
|
|
584
|
-
// Value first so shopify merchants can set (extra) display transformers in the shopify app
|
|
585
|
-
// Calling these functions normally doesn't do anything, but our shopify app respects them
|
|
586
|
-
// Them being here is value first too because this can be easily imported in the product card editor
|
|
587
|
-
let $cc9aacef898ccc9a$var$extraDisplayTransformers;
|
|
588
|
-
const $cc9aacef898ccc9a$export$b2d94be4f02525b2 = () => $cc9aacef898ccc9a$var$extraDisplayTransformers;
|
|
589
|
-
const $cc9aacef898ccc9a$export$f98b8d5ea7207a1 = displayTransformers => $cc9aacef898ccc9a$var$extraDisplayTransformers = displayTransformers;
|
|
590
594
|
function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
|
|
591
595
|
const signal = $52FdA$solidjs.createSignal(false);
|
|
592
596
|
$52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
|
|
@@ -10430,7 +10434,8 @@ function $2b15291bd38ac551$export$9862539c89138352(_ref) {
|
|
|
10430
10434
|
let {
|
|
10431
10435
|
get_default_values_: get_default_values_,
|
|
10432
10436
|
router_: router_,
|
|
10433
|
-
prefix_: prefix_
|
|
10437
|
+
prefix_: prefix_,
|
|
10438
|
+
preserveKeys_: preserveKeys_
|
|
10434
10439
|
} = _ref;
|
|
10435
10440
|
const get_prefixed_default_values_ = () => {
|
|
10436
10441
|
const default_values = get_default_values_();
|
|
@@ -10440,9 +10445,11 @@ function $2b15291bd38ac551$export$9862539c89138352(_ref) {
|
|
|
10440
10445
|
}));
|
|
10441
10446
|
};
|
|
10442
10447
|
const prefixed_state = $367b536a2a94d24e$export$e183a13865960371(get_prefixed_default_values_(), router_);
|
|
10448
|
+
const prefixedPreserveKeys = preserveKeys_ === null || preserveKeys_ === void 0 ? void 0 : preserveKeys_.map(key => prefix_ + key);
|
|
10443
10449
|
const reset_state = () => {
|
|
10444
10450
|
const new_defaults = get_prefixed_default_values_();
|
|
10445
10451
|
for (const key in prefixed_state) {
|
|
10452
|
+
if (prefixedPreserveKeys !== null && prefixedPreserveKeys !== void 0 && prefixedPreserveKeys.includes(key)) continue;
|
|
10446
10453
|
const new_value = new_defaults[key];
|
|
10447
10454
|
prefixed_state[key][1](new_value);
|
|
10448
10455
|
}
|
|
@@ -11172,8 +11179,13 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
|
|
|
11172
11179
|
local_filter_cache: [],
|
|
11173
11180
|
expanded_hierarchical_filters: [],
|
|
11174
11181
|
scroll_restoration_data: [],
|
|
11175
|
-
history_content_blocks:
|
|
11182
|
+
history_content_blocks: {
|
|
11183
|
+
blocks: [],
|
|
11184
|
+
aspectRatios: {}
|
|
11185
|
+
}
|
|
11176
11186
|
}),
|
|
11187
|
+
// 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?)
|
|
11188
|
+
preserveKeys_: ["history_content_blocks", "scroll_restoration_data"],
|
|
11177
11189
|
router_: $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $9cbefc32b9dab36d$var$_router),
|
|
11178
11190
|
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
11179
11191
|
});
|
|
@@ -15961,102 +15973,140 @@ function $c3a7faae6f2b93c9$export$7af06a63c5a976c9(el, listing_id, i18n_) {
|
|
|
15961
15973
|
$52FdA$solidjs.onCleanup(disconnect);
|
|
15962
15974
|
}
|
|
15963
15975
|
$52FdA$solidjsweb.delegateEvents(["click"]);
|
|
15964
|
-
var $c19709057a32b2e7$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<
|
|
15976
|
+
var $c19709057a32b2e7$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<video loop class=d-standard-content>`);
|
|
15965
15977
|
function $c19709057a32b2e7$export$780a853d15174484(_ref) {
|
|
15966
15978
|
let {
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
},
|
|
15974
|
-
router_: router_
|
|
15979
|
+
link_: link_,
|
|
15980
|
+
type_: type_,
|
|
15981
|
+
router_: router_,
|
|
15982
|
+
setAspectRatioWas_: setAspectRatioWas_,
|
|
15983
|
+
mediaUrl_: mediaUrl_,
|
|
15984
|
+
aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
|
|
15975
15985
|
} = _ref;
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15979
|
-
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
}
|
|
15989
|
-
}, link && {
|
|
15990
|
-
href: link
|
|
15991
|
-
}, {
|
|
15992
|
-
get children() {
|
|
15993
|
-
return $52FdA$solidjsweb.createComponent((0, $f3db423dc84bc35d$export$140423fa4bfb6d63), {
|
|
15994
|
-
size: () => {
|
|
15995
|
-
var _wrapperSize, _wrapperSize$;
|
|
15996
|
-
return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : (_wrapperSize$ = _wrapperSize[0]) === null || _wrapperSize$ === void 0 ? void 0 : _wrapperSize$.call(_wrapperSize)) || 0;
|
|
15997
|
-
},
|
|
15998
|
-
sizeHeight: () => {
|
|
15999
|
-
var _wrapperSize2, _wrapperSize2$;
|
|
16000
|
-
return ((_wrapperSize2 = wrapperSize()) === null || _wrapperSize2 === void 0 ? void 0 : (_wrapperSize2$ = _wrapperSize2[1]) === null || _wrapperSize2$ === void 0 ? void 0 : _wrapperSize2$.call(_wrapperSize2)) || 0;
|
|
16001
|
-
},
|
|
16002
|
-
src: mediaUrl,
|
|
16003
|
-
"class": "d-standard-content"
|
|
16004
|
-
});
|
|
16005
|
-
}
|
|
16006
|
-
}));
|
|
16007
|
-
}
|
|
16008
|
-
if (type === "video") {
|
|
16009
|
-
const pageVisible = $e7a7d2fe8a8217d8$export$54299a3c81f5425();
|
|
16010
|
-
return (() => {
|
|
16011
|
-
var _el$ = $52FdA$solidjsweb.getNextElement($c19709057a32b2e7$var$_tmpl$),
|
|
16012
|
-
_el$2 = _el$.firstChild;
|
|
16013
|
-
$52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
|
|
16014
|
-
new_url_: link,
|
|
15986
|
+
const [wrapperSize, setWrapperSize] = $52FdA$solidjs.createSignal();
|
|
15987
|
+
const isImage = type_ === "image";
|
|
15988
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjsweb.Dynamic), $52FdA$solidjsweb.mergeProps({
|
|
15989
|
+
component: link_ ? "a" : "div",
|
|
15990
|
+
"class": "d-standard-content-wrapper",
|
|
15991
|
+
get style() {
|
|
15992
|
+
return $52FdA$solidjsweb.memo(() => !!aspectRatioWhenAloneInRow_())() ? "--media-aspect-ratio: ".concat(aspectRatioWhenAloneInRow_()) : "";
|
|
15993
|
+
},
|
|
15994
|
+
ref: el => isImage && setWrapperSize(() => $054b1113e4897051$export$54c6d6ff54e72743(el)),
|
|
15995
|
+
get onClick() {
|
|
15996
|
+
return $52FdA$depictaiutilisharedlatest.catchify(ev => link_ && router_.navigate_.go_to_({
|
|
15997
|
+
new_url_: link_,
|
|
16015
15998
|
is_replace_: false,
|
|
16016
15999
|
event_: ev
|
|
16017
|
-
}))
|
|
16018
|
-
|
|
16019
|
-
|
|
16020
|
-
|
|
16021
|
-
|
|
16022
|
-
|
|
16023
|
-
$52FdA$solidjsweb.
|
|
16024
|
-
|
|
16025
|
-
|
|
16026
|
-
|
|
16027
|
-
|
|
16028
|
-
|
|
16029
|
-
|
|
16030
|
-
|
|
16000
|
+
}));
|
|
16001
|
+
}
|
|
16002
|
+
}, link_ && {
|
|
16003
|
+
href: link_
|
|
16004
|
+
}, {
|
|
16005
|
+
get children() {
|
|
16006
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Switch), {
|
|
16007
|
+
get children() {
|
|
16008
|
+
return [$52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Match), {
|
|
16009
|
+
when: isImage,
|
|
16010
|
+
get children() {
|
|
16011
|
+
return $52FdA$solidjsweb.createComponent((0, $f3db423dc84bc35d$export$140423fa4bfb6d63), {
|
|
16012
|
+
size: () => {
|
|
16013
|
+
var _wrapperSize, _wrapperSize$;
|
|
16014
|
+
return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : (_wrapperSize$ = _wrapperSize[0]) === null || _wrapperSize$ === void 0 ? void 0 : _wrapperSize$.call(_wrapperSize)) || 0;
|
|
16015
|
+
},
|
|
16016
|
+
sizeHeight: () => {
|
|
16017
|
+
var _wrapperSize2, _wrapperSize2$;
|
|
16018
|
+
return ((_wrapperSize2 = wrapperSize()) === null || _wrapperSize2 === void 0 ? void 0 : (_wrapperSize2$ = _wrapperSize2[1]) === null || _wrapperSize2$ === void 0 ? void 0 : _wrapperSize2$.call(_wrapperSize2)) || 0;
|
|
16019
|
+
},
|
|
16020
|
+
src: mediaUrl_,
|
|
16021
|
+
"class": "d-standard-content",
|
|
16022
|
+
ref: el => el.addEventListener("load", $52FdA$depictaiutilisharedlatest.catchify(() => setAspectRatioWas_(el.naturalWidth / el.naturalHeight)))
|
|
16023
|
+
});
|
|
16024
|
+
}
|
|
16025
|
+
}), $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Match), {
|
|
16026
|
+
when: type_ === "video",
|
|
16027
|
+
get children() {
|
|
16028
|
+
var _el$ = $52FdA$solidjsweb.getNextElement($c19709057a32b2e7$var$_tmpl$);
|
|
16029
|
+
$52FdA$solidjsweb.use(element => {
|
|
16030
|
+
const pageVisible = $e7a7d2fe8a8217d8$export$54299a3c81f5425();
|
|
16031
|
+
element.addEventListener("loadedmetadata", $52FdA$depictaiutilisharedlatest.catchify(() => setAspectRatioWas_(element.videoWidth / element.videoHeight)));
|
|
16032
|
+
$52FdA$solidjs.createEffect(() => {
|
|
16033
|
+
if (pageVisible()) element.play().catch(e => $52FdA$depictaiutilishared.dlog("Failed to play", e));else element.pause();
|
|
16034
|
+
});
|
|
16035
|
+
}, _el$);
|
|
16036
|
+
$52FdA$solidjsweb.setAttribute(_el$, "src", mediaUrl_);
|
|
16037
|
+
$52FdA$solidjsweb.setProperty(_el$, "controls", false);
|
|
16038
|
+
$52FdA$solidjsweb.setProperty(_el$, "muted", true);
|
|
16039
|
+
$52FdA$solidjsweb.setProperty(_el$, "autoplay", true);
|
|
16040
|
+
$52FdA$solidjsweb.setProperty(_el$, "playsinline", true);
|
|
16041
|
+
return _el$;
|
|
16042
|
+
}
|
|
16043
|
+
})];
|
|
16044
|
+
}
|
|
16045
|
+
});
|
|
16046
|
+
}
|
|
16047
|
+
}));
|
|
16031
16048
|
}
|
|
16032
|
-
$52FdA$solidjsweb.delegateEvents(["click"]);
|
|
16033
16049
|
function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
|
|
16034
16050
|
let hasSeenContentBlock = false;
|
|
16035
16051
|
const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
|
|
16052
|
+
const contentComponents = new Map();
|
|
16036
16053
|
$52FdA$solidjs.createEffect(() => {
|
|
16037
16054
|
var _plp_meta;
|
|
16038
16055
|
const serverContentBlock = (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
|
|
16039
|
-
|
|
16056
|
+
const currentHistory = $52FdA$solidjs.untrack(historyContentBlocks);
|
|
16057
|
+
// 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).
|
|
16058
|
+
if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
|
|
16059
|
+
...currentHistory,
|
|
16060
|
+
blocks: serverContentBlock
|
|
16061
|
+
});
|
|
16040
16062
|
});
|
|
16041
16063
|
const contentBlocksByRow = $52FdA$solidjs.createMemo(() => {
|
|
16042
16064
|
const developerProvided = content_blocks_by_row_();
|
|
16043
|
-
const
|
|
16065
|
+
const {
|
|
16066
|
+
blocks: blocksFromHistory
|
|
16067
|
+
} = historyContentBlocks();
|
|
16044
16068
|
if (developerProvided) return developerProvided;
|
|
16045
16069
|
// If we didn't get any content blocks (backend always return empty array) and we haven't seen any content blocks yet, return undefined
|
|
16046
16070
|
// This is so the result rendering (PLPResults) will still use flexbox provided rendering on existing customers, so adding this isn't a breaking change
|
|
16047
16071
|
// 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
|
|
16048
|
-
if (!(
|
|
16072
|
+
if (!(blocksFromHistory !== null && blocksFromHistory !== void 0 && blocksFromHistory.length) && !hasSeenContentBlock) return;
|
|
16049
16073
|
const content = [];
|
|
16050
16074
|
hasSeenContentBlock = true;
|
|
16051
|
-
|
|
16075
|
+
blocksFromHistory.forEach(row => {
|
|
16076
|
+
const {
|
|
16077
|
+
content: {
|
|
16078
|
+
link: link,
|
|
16079
|
+
type: type,
|
|
16080
|
+
url: url
|
|
16081
|
+
}
|
|
16082
|
+
} = row;
|
|
16083
|
+
// 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
|
|
16084
|
+
// This makes the block not flicker when going backwards/forwards if the content is the same on both pages
|
|
16085
|
+
// Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
|
|
16086
|
+
const componentCacheKey = JSON.stringify([link, type, url]);
|
|
16087
|
+
let component = contentComponents.get(componentCacheKey);
|
|
16088
|
+
if (!component) {
|
|
16089
|
+
component = () => $52FdA$solidjsweb.createComponent((0, $c19709057a32b2e7$export$780a853d15174484), {
|
|
16090
|
+
link_: link,
|
|
16091
|
+
type_: type,
|
|
16092
|
+
mediaUrl_: url,
|
|
16093
|
+
router_: router_,
|
|
16094
|
+
aspectRatioWhenAloneInRow_: () => historyContentBlocks().aspectRatios[componentCacheKey],
|
|
16095
|
+
setAspectRatioWas_: aspectRatio => setHistoryContentBlocks(prev => ({
|
|
16096
|
+
...prev,
|
|
16097
|
+
aspectRatios: {
|
|
16098
|
+
...prev.aspectRatios,
|
|
16099
|
+
[componentCacheKey]: Math.round(aspectRatio * 100) / 100
|
|
16100
|
+
}
|
|
16101
|
+
}))
|
|
16102
|
+
});
|
|
16103
|
+
contentComponents.set(componentCacheKey, component);
|
|
16104
|
+
}
|
|
16052
16105
|
const contentBlock = {
|
|
16053
16106
|
span_columns: row.span_columns,
|
|
16054
16107
|
span_rows: row.span_rows,
|
|
16055
16108
|
position: row.position,
|
|
16056
|
-
content:
|
|
16057
|
-
contentBlock_: row,
|
|
16058
|
-
router_: router_
|
|
16059
|
-
})
|
|
16109
|
+
content: component
|
|
16060
16110
|
};
|
|
16061
16111
|
content[row.row] = contentBlock;
|
|
16062
16112
|
});
|
package/ES10/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/ES10";
|
|
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.8.
|
|
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.
|