@depict-ai/ui 4.1.3 → 4.1.5
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 +189 -82
- package/ES10/index.d.ts +8 -2
- package/ES10/index.js +189 -83
- package/latest/index.cjs +189 -82
- package/latest/index.d.ts +8 -2
- package/latest/index.js +189 -83
- package/package.json +1 -1
- package/server/ES10/index.cjs +157 -53
- package/server/ES10/index.d.ts +8 -2
- package/server/ES10/index.js +157 -54
- package/server/latest/index.cjs +157 -53
- package/server/latest/index.d.ts +8 -2
- package/server/latest/index.js +157 -54
package/server/ES10/index.cjs
CHANGED
|
@@ -18,6 +18,7 @@ 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, "promiseSafeStructuredClone", () => $400d96565bbbfe07$export$83bb9af5671e1dbe);
|
|
21
22
|
$parcel$export(module.exports, "preserve_items_in_history_dot_state", () => $cfcd56242923775d$export$5162a71f252e6122);
|
|
22
23
|
$parcel$export(module.exports, "prefixes_to_preserve_in_history_dot_state", () => $cfcd56242923775d$export$3064e1e8c6513da3);
|
|
23
24
|
$parcel$export(module.exports, "allowNativeNavigation", () => $9ca08bcacbc598ce$export$29d28dadc2d6b631);
|
|
@@ -98,7 +99,76 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447a
|
|
|
98
99
|
$parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
|
|
99
100
|
$parcel$export(module.exports, "SearchField", () => $98aef9965764903d$export$316f6f283ae64765);
|
|
100
101
|
/*! Depict.ai search and product listing SDK */
|
|
101
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.1.
|
|
102
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.1.5";
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* This is a function that will safely clone an object that may contain promises.
|
|
106
|
+
* It will use structuredClone to clone the object and then re-apply (copy) any promises that were in the original object to the cloned object.
|
|
107
|
+
* @param obj Anything to clone
|
|
108
|
+
*/
|
|
109
|
+
function $400d96565bbbfe07$export$83bb9af5671e1dbe(obj) {
|
|
110
|
+
if (obj instanceof Promise) return obj;
|
|
111
|
+
// Extract all promises, keep a map of them, and then re-apply them to both the original object and the target object after cloning
|
|
112
|
+
const seen = new Set();
|
|
113
|
+
const keyStack = [[]];
|
|
114
|
+
const valueStack = [obj];
|
|
115
|
+
const promiseLocationStack = [];
|
|
116
|
+
while (valueStack.length) {
|
|
117
|
+
const value = valueStack.pop();
|
|
118
|
+
const keyPath = keyStack.pop();
|
|
119
|
+
// Promises can only be in objects and we don't need to check for objects we've already seen (like in circular references)
|
|
120
|
+
if (typeof value !== "object" || value === null || seen.has(value)) continue;
|
|
121
|
+
seen.add(value);
|
|
122
|
+
if (Array.isArray(value)) {
|
|
123
|
+
for (let i = 0; i < value.length; i++) {
|
|
124
|
+
const ourValue = value[i];
|
|
125
|
+
const valuesKeyPath = [...keyPath, i];
|
|
126
|
+
if (ourValue instanceof Promise) {
|
|
127
|
+
promiseLocationStack.push([valuesKeyPath, ourValue]);
|
|
128
|
+
delete value[i]; // This will leave a hole in the array, but it's fine since we'll put it back soon
|
|
129
|
+
// This way both the indexes will be correct when putting the value back and our for loop doesn't get messed up
|
|
130
|
+
} else {
|
|
131
|
+
keyStack.push(valuesKeyPath);
|
|
132
|
+
valueStack.push(ourValue);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
for (const innerKey in value) {
|
|
138
|
+
const ourValue = value[innerKey];
|
|
139
|
+
const valuesKeyPath = [...keyPath, innerKey];
|
|
140
|
+
if (ourValue instanceof Promise) {
|
|
141
|
+
promiseLocationStack.push([valuesKeyPath, ourValue]);
|
|
142
|
+
delete value[innerKey];
|
|
143
|
+
} else {
|
|
144
|
+
keyStack.push(valuesKeyPath);
|
|
145
|
+
valueStack.push(ourValue);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
let structuredClonedObject;
|
|
150
|
+
let error;
|
|
151
|
+
try {
|
|
152
|
+
structuredClonedObject = structuredClone(obj);
|
|
153
|
+
} catch (e) {
|
|
154
|
+
// We still need to put back the promises in the original object, even if we threw an error
|
|
155
|
+
error = e;
|
|
156
|
+
}
|
|
157
|
+
// Put back the promises in both the original object and the cloned object
|
|
158
|
+
while (promiseLocationStack.length) {
|
|
159
|
+
const [keyPath, promise] = promiseLocationStack.pop();
|
|
160
|
+
let targetInClone = structuredClonedObject;
|
|
161
|
+
let targetInOriginal = obj;
|
|
162
|
+
for (let i = 0; i < keyPath.length - 1; i++) {
|
|
163
|
+
if (!error) targetInClone = targetInClone[keyPath[i]];
|
|
164
|
+
targetInOriginal = targetInOriginal[keyPath[i]];
|
|
165
|
+
}
|
|
166
|
+
if (!error) targetInClone[keyPath[keyPath.length - 1]] = promise;
|
|
167
|
+
targetInOriginal[keyPath[keyPath.length - 1]] = promise;
|
|
168
|
+
}
|
|
169
|
+
if (error) throw error;
|
|
170
|
+
return structuredClonedObject;
|
|
171
|
+
}
|
|
102
172
|
const $cfcd56242923775d$export$3064e1e8c6513da3 = new Set();
|
|
103
173
|
let $cfcd56242923775d$var$has_ran = false;
|
|
104
174
|
function $cfcd56242923775d$export$5162a71f252e6122() {
|
|
@@ -245,12 +315,42 @@ function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
|
|
|
245
315
|
}).remove);
|
|
246
316
|
return signal[0];
|
|
247
317
|
}
|
|
318
|
+
var $e3d733f899558f40$var$_tmpl$ = ["<span", ' class="', '" style="', '"></span>'];
|
|
319
|
+
function $e3d733f899558f40$export$acb3eaade4b23afd(props) {
|
|
320
|
+
// Work around https://github.com/solidjs/solid/issues/1980
|
|
321
|
+
return $3hooq$solidjsweb.ssr($e3d733f899558f40$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "".concat($3hooq$solidjsweb.escape(props.class, true) || "", " depict-placeholder"), $3hooq$solidjsweb.ssrStyle(props.style));
|
|
322
|
+
}
|
|
323
|
+
function $a7f7d416e6f61504$export$89c6019e4baa40b1(props) {
|
|
324
|
+
const style = $3hooq$solidjs.createMemo(() => {
|
|
325
|
+
const {
|
|
326
|
+
style: style,
|
|
327
|
+
height: height,
|
|
328
|
+
width: width
|
|
329
|
+
} = props;
|
|
330
|
+
return {
|
|
331
|
+
...(style || {}),
|
|
332
|
+
height: height !== null && height !== void 0 ? height : "1em",
|
|
333
|
+
...(width && {
|
|
334
|
+
width: width
|
|
335
|
+
})
|
|
336
|
+
};
|
|
337
|
+
});
|
|
338
|
+
return $3hooq$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
|
|
339
|
+
get style() {
|
|
340
|
+
return style();
|
|
341
|
+
},
|
|
342
|
+
get ["class"]() {
|
|
343
|
+
return props.class;
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
}
|
|
248
347
|
var $82d079b68975fbf7$var$_tmpl$ = ["<span", ' class="title line-clamp">', "</span>"],
|
|
249
348
|
$82d079b68975fbf7$var$_tmpl$2 = ["<span", ' class="brand">', "</span>"],
|
|
250
349
|
$82d079b68975fbf7$var$_tmpl$3 = ["<div", ' class="tagline line-clamp">', "</div>"],
|
|
251
350
|
$82d079b68975fbf7$var$_tmpl$4 = ["<span", ' class="orig price"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></span>"],
|
|
252
|
-
$82d079b68975fbf7$var$_tmpl$5 = ["<
|
|
253
|
-
$82d079b68975fbf7$var$_tmpl$6 = ["<div", ' class="
|
|
351
|
+
$82d079b68975fbf7$var$_tmpl$5 = ["<span", ' class="', '"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></span>"],
|
|
352
|
+
$82d079b68975fbf7$var$_tmpl$6 = ["<a", ' class="', '"', '><div class="img-part"><!--$-->', "<!--/--><!--$-->", '<!--/--></div><div class="right-part"><!--$-->', '<!--/--><div class="price-container"><!--$-->', "<!--/--><!--$-->", "<!--/--></div></div></a>"],
|
|
353
|
+
$82d079b68975fbf7$var$_tmpl$7 = ["<div", ' class="title-brand-tagline">', "</div>"];
|
|
254
354
|
const $82d079b68975fbf7$export$b05c0ae390cf3e06 = _ref => {
|
|
255
355
|
var _variant$image_urls;
|
|
256
356
|
let {
|
|
@@ -266,13 +366,16 @@ const $82d079b68975fbf7$export$b05c0ae390cf3e06 = _ref => {
|
|
|
266
366
|
const [get_selected_index_, set_selected_index_] = selected_index_ || [];
|
|
267
367
|
const variant = display_.variant_displays[display_.variant_index];
|
|
268
368
|
const href = $3hooq$solidjs.createMemo(() => variant.page_url); // <- could be made reactive getter in displayTransformers, read it in memo here since it might create computations (for example in the preview-brower), and there's no owner in the onClick handler
|
|
269
|
-
|
|
369
|
+
// Prices can be promises, for example in our shopify app. Always assume they are (will work the same when they aren't)
|
|
370
|
+
const [salePrice] = $3hooq$solidjs.createResource(() => variant.sale_price);
|
|
371
|
+
const [originalPrice] = $3hooq$solidjs.createResource(() => variant.original_price);
|
|
372
|
+
const isOnSale = $3hooq$solidjs.createMemo(() => salePrice() !== originalPrice());
|
|
270
373
|
const supports_hover = $3e17e871e9d0911d$export$d9f36cf74e24d595("(hover: hover) and (pointer: fine)");
|
|
271
374
|
const [isSelected, selectedDueToKeyboardNavigation] = selected_index_ ? $b0f8d9f49e018db9$export$fb40a80c530e5f2b(get_selected_index_, keyboardNavigationGroupIndex_, index_) : [];
|
|
272
375
|
const secondary_image_url = ((_variant$image_urls = variant.image_urls) === null || _variant$image_urls === void 0 ? void 0 : _variant$image_urls[1]) || variant.secondary_image_url || variant.alternative_display_image_url;
|
|
273
376
|
const brandInTagline = selected_index_ && variant.brand;
|
|
274
377
|
const TitleBrandTagline = () => [!selected_index_ && $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(variant.brand)), $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(variant.title)), (variant.sub_heading_1 || variant.sub_heading_2 || brandInTagline) && $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$3, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape([brandInTagline, variant.sub_heading_1, variant.sub_heading_2].filter(v => v).join(" | ")))];
|
|
275
|
-
return $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$
|
|
378
|
+
return $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$6, $3hooq$solidjsweb.ssrHydrationKey(), "instant-card ".concat(isSelected !== null && isSelected !== void 0 && isSelected() ? "selected" : ""), $3hooq$solidjsweb.ssrAttribute("href", $3hooq$solidjsweb.escape(href(), true), false) + $3hooq$solidjsweb.ssrAttribute("data-search-result-id", $3hooq$solidjsweb.escape(display_.search_result_id, true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent(InstantCardImageComponent_, {
|
|
276
379
|
get src_() {
|
|
277
380
|
var _variant$image_urls2;
|
|
278
381
|
return ((_variant$image_urls2 = variant.image_urls) === null || _variant$image_urls2 === void 0 ? void 0 : _variant$image_urls2[0]) || variant.image_url || variant.display_image_url;
|
|
@@ -286,32 +389,43 @@ const $82d079b68975fbf7$export$b05c0ae390cf3e06 = _ref => {
|
|
|
286
389
|
src_: secondary_image_url
|
|
287
390
|
});
|
|
288
391
|
}
|
|
289
|
-
})), selected_index_ ? $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent(TitleBrandTagline, {})) : $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$
|
|
290
|
-
when
|
|
392
|
+
})), selected_index_ ? $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent(TitleBrandTagline, {})) : $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$7, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent(TitleBrandTagline, {}))), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
393
|
+
get when() {
|
|
394
|
+
return isOnSale();
|
|
395
|
+
},
|
|
291
396
|
get children() {
|
|
292
397
|
return $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$4, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape(i18n_.price_formatting_().pre_), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
|
|
293
398
|
get price_() {
|
|
294
|
-
return
|
|
399
|
+
return originalPrice();
|
|
295
400
|
},
|
|
296
401
|
get price_formatting_() {
|
|
297
402
|
return i18n_.price_formatting_();
|
|
298
403
|
}
|
|
299
404
|
})), $3hooq$solidjsweb.escape(i18n_.price_formatting_().post_));
|
|
300
405
|
}
|
|
301
|
-
})),
|
|
302
|
-
get
|
|
303
|
-
return
|
|
406
|
+
})), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
|
|
407
|
+
get when() {
|
|
408
|
+
return !salePrice.loading && salePrice.latest;
|
|
304
409
|
},
|
|
305
|
-
get
|
|
306
|
-
return
|
|
410
|
+
get fallback() {
|
|
411
|
+
return $3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
|
|
412
|
+
width: "5ch",
|
|
413
|
+
height: "1em",
|
|
414
|
+
"class": "price"
|
|
415
|
+
});
|
|
416
|
+
},
|
|
417
|
+
get children() {
|
|
418
|
+
return $3hooq$solidjsweb.ssr($82d079b68975fbf7$var$_tmpl$5, $3hooq$solidjsweb.ssrHydrationKey(), "".concat("price", " ").concat(isOnSale() ? "sales-price" : ""), $3hooq$solidjsweb.escape(i18n_.price_formatting_().pre_), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
|
|
419
|
+
get price_() {
|
|
420
|
+
return salePrice();
|
|
421
|
+
},
|
|
422
|
+
get price_formatting_() {
|
|
423
|
+
return i18n_.price_formatting_();
|
|
424
|
+
}
|
|
425
|
+
})), $3hooq$solidjsweb.escape(i18n_.price_formatting_().post_));
|
|
307
426
|
}
|
|
308
|
-
}))
|
|
427
|
+
})));
|
|
309
428
|
};
|
|
310
|
-
var $e3d733f899558f40$var$_tmpl$ = ["<span", ' class="', '" style="', '"></span>'];
|
|
311
|
-
function $e3d733f899558f40$export$acb3eaade4b23afd(props) {
|
|
312
|
-
// Work around https://github.com/solidjs/solid/issues/1980
|
|
313
|
-
return $3hooq$solidjsweb.ssr($e3d733f899558f40$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "".concat($3hooq$solidjsweb.escape(props.class, true) || "", " depict-placeholder"), $3hooq$solidjsweb.ssrStyle(props.style));
|
|
314
|
-
}
|
|
315
429
|
function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
|
|
316
430
|
const style = $3hooq$solidjs.createMemo(() => {
|
|
317
431
|
const {
|
|
@@ -343,30 +457,6 @@ function $b8a8d61b3ec5f5ac$export$3f37af283f8fb843(props) {
|
|
|
343
457
|
}
|
|
344
458
|
});
|
|
345
459
|
}
|
|
346
|
-
function $a7f7d416e6f61504$export$89c6019e4baa40b1(props) {
|
|
347
|
-
const style = $3hooq$solidjs.createMemo(() => {
|
|
348
|
-
const {
|
|
349
|
-
style: style,
|
|
350
|
-
height: height,
|
|
351
|
-
width: width
|
|
352
|
-
} = props;
|
|
353
|
-
return {
|
|
354
|
-
...(style || {}),
|
|
355
|
-
height: height !== null && height !== void 0 ? height : "1em",
|
|
356
|
-
...(width && {
|
|
357
|
-
width: width
|
|
358
|
-
})
|
|
359
|
-
};
|
|
360
|
-
});
|
|
361
|
-
return $3hooq$solidjsweb.createComponent((0, $e3d733f899558f40$export$acb3eaade4b23afd), {
|
|
362
|
-
get style() {
|
|
363
|
-
return style();
|
|
364
|
-
},
|
|
365
|
-
get ["class"]() {
|
|
366
|
-
return props.class;
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
460
|
var $c0cf6af094336798$var$_tmpl$ = ["<div", ' class="instant-card"><div class="img-part">', '</div><div class="right-part"><div class="title-brand-tagline"><span class="title">', '</span></div><div class="price-container">', "</div></div></div>"];
|
|
371
461
|
const $c0cf6af094336798$export$8a2234b5b1a5ebd4 = "--image-aspect-ratio";
|
|
372
462
|
function $c0cf6af094336798$export$ee1733d9a8495996() {
|
|
@@ -468,7 +558,12 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
468
558
|
// We had a case on singular where they popped an image url and due to use caching after some time there was no image
|
|
469
559
|
// Attempt cloning the displays if possible (99.9% of the cases probably) and if not, just use the original display
|
|
470
560
|
try {
|
|
471
|
-
|
|
561
|
+
// Use promiseSafeStructuredClone so that:
|
|
562
|
+
// 1. When fetching for example prices from an API, one can start that API request
|
|
563
|
+
// 2. Add the promise to the display
|
|
564
|
+
// 3. Already render the product card with placeholders for prices while the price loads
|
|
565
|
+
// 4. When the price loads, re-render the display with the new price
|
|
566
|
+
display = $400d96565bbbfe07$export$83bb9af5671e1dbe(display);
|
|
472
567
|
} catch (e) {
|
|
473
568
|
if (!$76012c4468a53d1f$var$printedCloneError) {
|
|
474
569
|
$76012c4468a53d1f$var$printedCloneError = true;
|
|
@@ -526,7 +621,7 @@ function $76012c4468a53d1f$export$43f0fb951fcb0c54(_ref) {
|
|
|
526
621
|
// Modified futher to bias towards saying objects are equal non-primitive objects differ
|
|
527
622
|
function $76012c4468a53d1f$var$deep_equal(obj1, obj2) {
|
|
528
623
|
const stack = [[obj1, obj2]];
|
|
529
|
-
while (stack.length
|
|
624
|
+
while (stack.length) {
|
|
530
625
|
const [currentObj1, currentObj2] = stack.pop();
|
|
531
626
|
if (currentObj1 === currentObj2) continue;
|
|
532
627
|
if (Array.isArray(currentObj1) && Array.isArray(currentObj2)) {
|
|
@@ -2077,10 +2172,10 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2077
2172
|
const src_options = $3hooq$solidjs.createMemo(() => {
|
|
2078
2173
|
const {
|
|
2079
2174
|
src: src,
|
|
2080
|
-
|
|
2175
|
+
customUrls: customUrls
|
|
2081
2176
|
} = props;
|
|
2082
|
-
const fallback_src = (
|
|
2083
|
-
const srcset = $858fdcf73148519f$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096],
|
|
2177
|
+
const fallback_src = (customUrls || $858fdcf73148519f$export$1d6267828870adda)(src, 400);
|
|
2178
|
+
const srcset = $858fdcf73148519f$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096], customUrls);
|
|
2084
2179
|
// The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
|
|
2085
2180
|
return {
|
|
2086
2181
|
srcset: srcset,
|
|
@@ -2089,7 +2184,9 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2089
2184
|
});
|
|
2090
2185
|
// Work around https://github.com/solidjs/solid/issues/1828
|
|
2091
2186
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
2092
|
-
const [, otherAttributes] = $3hooq$solidjs.splitProps(props, ["resolutions", "size", "src", "srcSet", "loading"
|
|
2187
|
+
const [, otherAttributes] = $3hooq$solidjs.splitProps(props, ["resolutions", "size", "src", "srcSet", "loading", "customUrls" // Can't have properties ending on underscore because the property name mangling will get confused by this <-
|
|
2188
|
+
]);
|
|
2189
|
+
|
|
2093
2190
|
const [hasSetSize, setHasSetSize] = $3hooq$solidjs.createSignal(false);
|
|
2094
2191
|
const [hasDecoded, setHasDecoded] = $3hooq$solidjs.createSignal(false);
|
|
2095
2192
|
const productCardIndexAccessor = $b54645378dfc7280$export$e3faf4d95300054f();
|
|
@@ -2221,9 +2318,9 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
2221
2318
|
});
|
|
2222
2319
|
}
|
|
2223
2320
|
function $858fdcf73148519f$var$make_srcset(url, resolutions, customGenerateImageUrl_) {
|
|
2224
|
-
return resolutions.map(width => "".concat((customGenerateImageUrl_ || $858fdcf73148519f$
|
|
2321
|
+
return resolutions.map(width => "".concat((customGenerateImageUrl_ || $858fdcf73148519f$export$1d6267828870adda)(url, width), " ").concat(width, "w")).join(", ");
|
|
2225
2322
|
}
|
|
2226
|
-
function $858fdcf73148519f$
|
|
2323
|
+
function $858fdcf73148519f$export$1d6267828870adda(url, width) {
|
|
2227
2324
|
// Even just creating one `URL` object per image src and then setting the search parameter is quite slow (0.25ms to set the width param)
|
|
2228
2325
|
// We're making the assumptions that the url has already at least one query parameter and that the image resizing service will choose the last one out of a duplicate width parameter (shopify's does)
|
|
2229
2326
|
// That way we can just to string concatenation which is insanely fast
|
|
@@ -2290,8 +2387,15 @@ function $9e470232a6b789a3$export$9d4a4b669b1929ab(props) {
|
|
|
2290
2387
|
get imgProps() {
|
|
2291
2388
|
return {
|
|
2292
2389
|
...props.imgProps,
|
|
2293
|
-
|
|
2294
|
-
) =>
|
|
2390
|
+
customUrls: (url, width // Apparently don't have to encode url for CF's service
|
|
2391
|
+
) => {
|
|
2392
|
+
if (url.startsWith("https://cdn.shopify.com"))
|
|
2393
|
+
// The shopify image resizing CDN blocks Cloudflare's image resizer. It's possible that we can't detect shopify image URLs sometimes because they go to the merchant's domain,
|
|
2394
|
+
// but it seems like the URLs returned by the Depict API always goes to the cdn.shopify.com version of an image, so this simple workaround works.
|
|
2395
|
+
return $858fdcf73148519f$export$1d6267828870adda(url, width);
|
|
2396
|
+
// Use cloudflare image resizer instead of img.depict.ai because it's a lot faster (and also auto-chooses other formats if webp is not supported)
|
|
2397
|
+
return "https://app.depict.ai/cdn-cgi/image/width=".concat(width, ",format=auto/").concat(url);
|
|
2398
|
+
}
|
|
2295
2399
|
};
|
|
2296
2400
|
}
|
|
2297
2401
|
}));
|
package/server/ES10/index.d.ts
CHANGED
|
@@ -10,7 +10,13 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
|
|
|
10
10
|
import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
13
|
-
export const version = "4.1.
|
|
13
|
+
export const version = "4.1.5";
|
|
14
|
+
/**
|
|
15
|
+
* This is a function that will safely clone an object that may contain promises.
|
|
16
|
+
* It will use structuredClone to clone the object and then re-apply (copy) any promises that were in the original object to the cloned object.
|
|
17
|
+
* @param obj Anything to clone
|
|
18
|
+
*/
|
|
19
|
+
export function promiseSafeStructuredClone<T>(obj: T): T;
|
|
14
20
|
export const prefixes_to_preserve_in_history_dot_state: Set<string>;
|
|
15
21
|
/**
|
|
16
22
|
* Prevent, usually SPAs, from deleting our stuff from history.state when they call history.pushState with a new object they have constructed. This will only run once no matter how often it's called.
|
|
@@ -436,7 +442,7 @@ export function ShopifyResponsiveImg(props: {
|
|
|
436
442
|
size: Accessor<number>;
|
|
437
443
|
src: string;
|
|
438
444
|
loading?: "eager" | "lazy" | "force-lazy";
|
|
439
|
-
|
|
445
|
+
customUrls?: (url: string, width: number) => string;
|
|
440
446
|
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes" | "loading">): JSX.Element;
|
|
441
447
|
type ImagePlaceholderBaseOptions = {
|
|
442
448
|
style?: JSX.CSSProperties;
|