@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/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.
|
|
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__*/$3hooq$solidjs.createContext();
|
|
119
125
|
function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
|
|
120
126
|
const our_object = {};
|
|
@@ -181,8 +187,12 @@ const $858fdcf73148519f$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingCo
|
|
|
181
187
|
function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
182
188
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
183
189
|
const [ourRatioKeyed, setOurRatioKeyed] = $3hooq$solidjs.createSignal();
|
|
190
|
+
const [rAFSinceReturned, setRAFSinceReturned] = $3hooq$solidjs.createSignal(false);
|
|
184
191
|
const sizeToUse = $3hooq$solidjs.createMemo(() => {
|
|
185
192
|
var _props$sizeHeight;
|
|
193
|
+
// 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.
|
|
194
|
+
// 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
|
|
195
|
+
rAFSinceReturned();
|
|
186
196
|
// 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)
|
|
187
197
|
const incomingSize = props.size();
|
|
188
198
|
const ratio = ourRatioKeyed();
|
|
@@ -341,6 +351,7 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
341
351
|
hasDecodedFastPath = true;
|
|
342
352
|
});
|
|
343
353
|
});
|
|
354
|
+
$3hooq$solidjs.createEffect(() => hasDecoded() && requestAnimationFrame($3hooq$depictaiutilishared.catchify(() => setRAFSinceReturned(prev => !prev))));
|
|
344
355
|
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
345
356
|
get when() {
|
|
346
357
|
return hasDecoded();
|
|
@@ -542,13 +553,6 @@ function $f3db423dc84bc35d$export$140423fa4bfb6d63(props) {
|
|
|
542
553
|
customUrls: $f3db423dc84bc35d$var$customUrls
|
|
543
554
|
}));
|
|
544
555
|
}
|
|
545
|
-
|
|
546
|
-
// Value first so shopify merchants can set (extra) display transformers in the shopify app
|
|
547
|
-
// Calling these functions normally doesn't do anything, but our shopify app respects them
|
|
548
|
-
// Them being here is value first too because this can be easily imported in the product card editor
|
|
549
|
-
let $cc9aacef898ccc9a$var$extraDisplayTransformers;
|
|
550
|
-
const $cc9aacef898ccc9a$export$b2d94be4f02525b2 = () => $cc9aacef898ccc9a$var$extraDisplayTransformers;
|
|
551
|
-
const $cc9aacef898ccc9a$export$f98b8d5ea7207a1 = displayTransformers => $cc9aacef898ccc9a$var$extraDisplayTransformers = displayTransformers;
|
|
552
556
|
function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
|
|
553
557
|
const signal = $3hooq$solidjs.createSignal(false);
|
|
554
558
|
$3hooq$solidjs.onCleanup($3hooq$depictaiutilishared.javascript_media_query(media_query, _ref => {
|
|
@@ -8262,7 +8266,8 @@ function $2b15291bd38ac551$export$9862539c89138352(_ref) {
|
|
|
8262
8266
|
let {
|
|
8263
8267
|
get_default_values_: get_default_values_,
|
|
8264
8268
|
router_: router_,
|
|
8265
|
-
prefix_: prefix_
|
|
8269
|
+
prefix_: prefix_,
|
|
8270
|
+
preserveKeys_: preserveKeys_
|
|
8266
8271
|
} = _ref;
|
|
8267
8272
|
const get_prefixed_default_values_ = () => {
|
|
8268
8273
|
const default_values = get_default_values_();
|
|
@@ -8272,9 +8277,11 @@ function $2b15291bd38ac551$export$9862539c89138352(_ref) {
|
|
|
8272
8277
|
}));
|
|
8273
8278
|
};
|
|
8274
8279
|
const prefixed_state = $367b536a2a94d24e$export$e183a13865960371(get_prefixed_default_values_(), router_);
|
|
8280
|
+
const prefixedPreserveKeys = preserveKeys_ === null || preserveKeys_ === void 0 ? void 0 : preserveKeys_.map(key => prefix_ + key);
|
|
8275
8281
|
const reset_state = () => {
|
|
8276
8282
|
const new_defaults = get_prefixed_default_values_();
|
|
8277
8283
|
for (const key in prefixed_state) {
|
|
8284
|
+
if (prefixedPreserveKeys !== null && prefixedPreserveKeys !== void 0 && prefixedPreserveKeys.includes(key)) continue;
|
|
8278
8285
|
const new_value = new_defaults[key];
|
|
8279
8286
|
prefixed_state[key][1](new_value);
|
|
8280
8287
|
}
|
|
@@ -9009,8 +9016,13 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
|
|
|
9009
9016
|
local_filter_cache: [],
|
|
9010
9017
|
expanded_hierarchical_filters: [],
|
|
9011
9018
|
scroll_restoration_data: [],
|
|
9012
|
-
history_content_blocks:
|
|
9019
|
+
history_content_blocks: {
|
|
9020
|
+
blocks: [],
|
|
9021
|
+
aspectRatios: {}
|
|
9022
|
+
}
|
|
9013
9023
|
}),
|
|
9024
|
+
// 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?)
|
|
9025
|
+
preserveKeys_: ["history_content_blocks", "scroll_restoration_data"],
|
|
9014
9026
|
router_: $parcel$interopDefault($3hooq$babelruntimehelpersclassPrivateFieldGet)(this, $9cbefc32b9dab36d$var$_router),
|
|
9015
9027
|
prefix_: "category" + unique_instance_key_for_state + "_"
|
|
9016
9028
|
});
|
|
@@ -10145,8 +10157,15 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
10145
10157
|
return for_id === id_currently_querying_for_();
|
|
10146
10158
|
})) === null || _get_scroll_restorati2 === void 0 ? void 0 : _get_scroll_restorati2.min_results_loaded) !== null && _get_scroll_restorati !== void 0 ? _get_scroll_restorati : min_products_to_fetch_);
|
|
10147
10159
|
});
|
|
10148
|
-
const
|
|
10149
|
-
|
|
10160
|
+
const layout = $3hooq$solidjs.createMemo(() => {
|
|
10161
|
+
const incoming_layout = layout_options_().layout;
|
|
10162
|
+
if (incoming_layout === "slider-without-filters") return "slider";
|
|
10163
|
+
return incoming_layout || "grid";
|
|
10164
|
+
});
|
|
10165
|
+
const doesnt_have_content_blocks = $3hooq$solidjs.createMemo(() => !content_blocks_by_row_() || layout() !== "grid");
|
|
10166
|
+
const content_blocks_ = $3hooq$solidjs.createMemo(() => doesnt_have_content_blocks() ?
|
|
10167
|
+
// This bailing here is to not use proxy/stores and retain old browser compatibility when no content blocks are present
|
|
10168
|
+
() => [] : $f8f375d6245ffff2$export$791ef57e62e21c3f({
|
|
10150
10169
|
content_blocks_: content_blocks_by_row_,
|
|
10151
10170
|
cols_at_size_: modified_cols_at_size,
|
|
10152
10171
|
set_top_row_shortened_by_: set_top_row_shortened_by_
|
|
@@ -10158,11 +10177,6 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
10158
10177
|
num_placeholders_: num_placeholders_
|
|
10159
10178
|
});
|
|
10160
10179
|
});
|
|
10161
|
-
const layout = $3hooq$solidjs.createMemo(() => {
|
|
10162
|
-
const incoming_layout = layout_options_().layout;
|
|
10163
|
-
if (incoming_layout === "slider-without-filters") return "slider";
|
|
10164
|
-
return incoming_layout || "grid";
|
|
10165
|
-
});
|
|
10166
10180
|
const [get_suspense_is_blocked, set_suspense_is_blocked] = $3hooq$solidjs.createSignal(false);
|
|
10167
10181
|
const block_suspense_if_needed = () => {
|
|
10168
10182
|
if (!is_just_after_plp_results_update) return;
|
|
@@ -10185,7 +10199,6 @@ function $484eec37514a982e$export$3925f87b1545cfc6(_ref) {
|
|
|
10185
10199
|
}, {
|
|
10186
10200
|
defer: true
|
|
10187
10201
|
}));
|
|
10188
|
-
$3hooq$solidjs.createEffect(() => layout() !== "grid" && !doesnt_have_content_blocks() && $3hooq$depictaiutilishared.dwarn("Slider layout doesn't support content blocks"));
|
|
10189
10202
|
/*
|
|
10190
10203
|
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)
|
|
10191
10204
|
We're creating it outside the <Show> so that we can benefit from <For>'s optimisation between changing results
|
|
@@ -13328,76 +13341,125 @@ function $8b366fdb0c76194d$var$clear_if_opened_new_tab_with_sideways_url_params_
|
|
|
13328
13341
|
});
|
|
13329
13342
|
tracking_function_for_plp_results(plp_results_);
|
|
13330
13343
|
}
|
|
13331
|
-
var $c19709057a32b2e7$var$_tmpl$ = ["<
|
|
13344
|
+
var $c19709057a32b2e7$var$_tmpl$ = ["<video", ' muted="" autoplay="" playsinline="" loop class="d-standard-content"></video>'];
|
|
13332
13345
|
function $c19709057a32b2e7$export$780a853d15174484(_ref) {
|
|
13333
13346
|
let {
|
|
13334
|
-
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13338
|
-
|
|
13339
|
-
|
|
13340
|
-
},
|
|
13341
|
-
router_: router_
|
|
13347
|
+
link_: link_,
|
|
13348
|
+
type_: type_,
|
|
13349
|
+
router_: router_,
|
|
13350
|
+
setAspectRatioWas_: setAspectRatioWas_,
|
|
13351
|
+
mediaUrl_: mediaUrl_,
|
|
13352
|
+
aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
|
|
13342
13353
|
} = _ref;
|
|
13343
|
-
|
|
13344
|
-
|
|
13345
|
-
|
|
13346
|
-
|
|
13347
|
-
|
|
13348
|
-
|
|
13349
|
-
|
|
13350
|
-
|
|
13351
|
-
|
|
13352
|
-
|
|
13353
|
-
|
|
13354
|
-
|
|
13355
|
-
|
|
13356
|
-
|
|
13357
|
-
}
|
|
13358
|
-
|
|
13359
|
-
|
|
13360
|
-
|
|
13361
|
-
|
|
13362
|
-
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13354
|
+
const [wrapperSize, setWrapperSize] = $3hooq$solidjs.createSignal();
|
|
13355
|
+
const isImage = type_ === "image";
|
|
13356
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjsweb.Dynamic), $3hooq$solidjsweb.mergeProps({
|
|
13357
|
+
component: link_ ? "a" : "div",
|
|
13358
|
+
"class": "d-standard-content-wrapper",
|
|
13359
|
+
get style() {
|
|
13360
|
+
return aspectRatioWhenAloneInRow_() ? "--media-aspect-ratio: ".concat(aspectRatioWhenAloneInRow_()) : "";
|
|
13361
|
+
},
|
|
13362
|
+
get onClick() {
|
|
13363
|
+
return $3hooq$depictaiutilisharedlatest.catchify(ev => link_ && router_.navigate_.go_to_({
|
|
13364
|
+
new_url_: link_,
|
|
13365
|
+
is_replace_: false,
|
|
13366
|
+
event_: ev
|
|
13367
|
+
}));
|
|
13368
|
+
}
|
|
13369
|
+
}, link_ && {
|
|
13370
|
+
href: link_
|
|
13371
|
+
}, {
|
|
13372
|
+
get children() {
|
|
13373
|
+
return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Switch), {
|
|
13374
|
+
get children() {
|
|
13375
|
+
return [$3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Match), {
|
|
13376
|
+
when: isImage,
|
|
13377
|
+
get children() {
|
|
13378
|
+
return $3hooq$solidjsweb.createComponent((0, $f3db423dc84bc35d$export$140423fa4bfb6d63), {
|
|
13379
|
+
size: () => {
|
|
13380
|
+
var _wrapperSize, _wrapperSize$;
|
|
13381
|
+
return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : (_wrapperSize$ = _wrapperSize[0]) === null || _wrapperSize$ === void 0 ? void 0 : _wrapperSize$.call(_wrapperSize)) || 0;
|
|
13382
|
+
},
|
|
13383
|
+
sizeHeight: () => {
|
|
13384
|
+
var _wrapperSize2, _wrapperSize2$;
|
|
13385
|
+
return ((_wrapperSize2 = wrapperSize()) === null || _wrapperSize2 === void 0 ? void 0 : (_wrapperSize2$ = _wrapperSize2[1]) === null || _wrapperSize2$ === void 0 ? void 0 : _wrapperSize2$.call(_wrapperSize2)) || 0;
|
|
13386
|
+
},
|
|
13387
|
+
src: mediaUrl_,
|
|
13388
|
+
"class": "d-standard-content"
|
|
13389
|
+
});
|
|
13390
|
+
}
|
|
13391
|
+
}), $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Match), {
|
|
13392
|
+
when: type_ === "video",
|
|
13393
|
+
get children() {
|
|
13394
|
+
return $3hooq$solidjsweb.ssr($c19709057a32b2e7$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey() + $3hooq$solidjsweb.ssrAttribute("src", $3hooq$solidjsweb.escape(mediaUrl_, true), false));
|
|
13395
|
+
}
|
|
13396
|
+
})];
|
|
13397
|
+
}
|
|
13398
|
+
});
|
|
13399
|
+
}
|
|
13400
|
+
}));
|
|
13378
13401
|
}
|
|
13379
13402
|
function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
|
|
13403
|
+
let hasSeenContentBlock = false;
|
|
13380
13404
|
const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
|
|
13405
|
+
const contentComponents = new Map();
|
|
13381
13406
|
$3hooq$solidjs.createEffect(() => {
|
|
13382
13407
|
var _plp_meta;
|
|
13383
13408
|
const serverContentBlock = (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
|
|
13384
|
-
|
|
13409
|
+
const currentHistory = $3hooq$solidjs.untrack(historyContentBlocks);
|
|
13410
|
+
// 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).
|
|
13411
|
+
if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
|
|
13412
|
+
...currentHistory,
|
|
13413
|
+
blocks: serverContentBlock
|
|
13414
|
+
});
|
|
13385
13415
|
});
|
|
13386
13416
|
const contentBlocksByRow = $3hooq$solidjs.createMemo(() => {
|
|
13387
13417
|
const developerProvided = content_blocks_by_row_();
|
|
13388
|
-
const
|
|
13389
|
-
|
|
13390
|
-
|
|
13418
|
+
const {
|
|
13419
|
+
blocks: blocksFromHistory
|
|
13420
|
+
} = historyContentBlocks();
|
|
13421
|
+
if (developerProvided) return developerProvided;
|
|
13422
|
+
// If we didn't get any content blocks (backend always return empty array) and we haven't seen any content blocks yet, return undefined
|
|
13423
|
+
// This is so the result rendering (PLPResults) will still use flexbox provided rendering on existing customers, so adding this isn't a breaking change
|
|
13424
|
+
// 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
|
|
13425
|
+
if (!(blocksFromHistory !== null && blocksFromHistory !== void 0 && blocksFromHistory.length) && !hasSeenContentBlock) return;
|
|
13391
13426
|
const content = [];
|
|
13392
|
-
|
|
13427
|
+
hasSeenContentBlock = true;
|
|
13428
|
+
blocksFromHistory.forEach(row => {
|
|
13429
|
+
const {
|
|
13430
|
+
content: {
|
|
13431
|
+
link: link,
|
|
13432
|
+
type: type,
|
|
13433
|
+
url: url
|
|
13434
|
+
}
|
|
13435
|
+
} = row;
|
|
13436
|
+
// 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
|
|
13437
|
+
// This makes the block not flicker when going backwards/forwards if the content is the same on both pages
|
|
13438
|
+
// Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
|
|
13439
|
+
const componentCacheKey = JSON.stringify([link, type, url]);
|
|
13440
|
+
let component = contentComponents.get(componentCacheKey);
|
|
13441
|
+
if (!component) {
|
|
13442
|
+
component = () => $3hooq$solidjsweb.createComponent((0, $c19709057a32b2e7$export$780a853d15174484), {
|
|
13443
|
+
link_: link,
|
|
13444
|
+
type_: type,
|
|
13445
|
+
mediaUrl_: url,
|
|
13446
|
+
router_: router_,
|
|
13447
|
+
aspectRatioWhenAloneInRow_: () => historyContentBlocks().aspectRatios[componentCacheKey],
|
|
13448
|
+
setAspectRatioWas_: aspectRatio => setHistoryContentBlocks(prev => ({
|
|
13449
|
+
...prev,
|
|
13450
|
+
aspectRatios: {
|
|
13451
|
+
...prev.aspectRatios,
|
|
13452
|
+
[componentCacheKey]: Math.round(aspectRatio * 100) / 100
|
|
13453
|
+
}
|
|
13454
|
+
}))
|
|
13455
|
+
});
|
|
13456
|
+
contentComponents.set(componentCacheKey, component);
|
|
13457
|
+
}
|
|
13393
13458
|
const contentBlock = {
|
|
13394
13459
|
span_columns: row.span_columns,
|
|
13395
13460
|
span_rows: row.span_rows,
|
|
13396
13461
|
position: row.position,
|
|
13397
|
-
content:
|
|
13398
|
-
contentBlock_: row,
|
|
13399
|
-
router_: router_
|
|
13400
|
-
})
|
|
13462
|
+
content: component
|
|
13401
13463
|
};
|
|
13402
13464
|
content[row.row] = contentBlock;
|
|
13403
13465
|
});
|
package/server/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.
|
|
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.
|