@depict-ai/ui 4.1.4 → 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 +179 -79
- package/ES10/index.d.ts +8 -2
- package/ES10/index.js +179 -80
- package/latest/index.cjs +179 -79
- package/latest/index.d.ts +8 -2
- package/latest/index.js +179 -80
- package/package.json +1 -1
- package/server/ES10/index.cjs +147 -50
- package/server/ES10/index.d.ts +8 -2
- package/server/ES10/index.js +147 -51
- package/server/latest/index.cjs +147 -50
- package/server/latest/index.d.ts +8 -2
- package/server/latest/index.js +147 -51
package/latest/index.cjs
CHANGED
|
@@ -12,6 +12,7 @@ function $parcel$export(e, n, v, s) {
|
|
|
12
12
|
configurable: true
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
$parcel$export(module.exports, "promiseSafeStructuredClone", () => $ac946c6b782bb900$export$83bb9af5671e1dbe);
|
|
15
16
|
$parcel$export(module.exports, "preserve_items_in_history_dot_state", () => $d84fe647b84b5dc5$export$5162a71f252e6122);
|
|
16
17
|
$parcel$export(module.exports, "prefixes_to_preserve_in_history_dot_state", () => $d84fe647b84b5dc5$export$3064e1e8c6513da3);
|
|
17
18
|
$parcel$export(module.exports, "allowNativeNavigation", () => $747421cd28dec5b5$export$29d28dadc2d6b631);
|
|
@@ -92,7 +93,76 @@ $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad99
|
|
|
92
93
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
93
94
|
$parcel$export(module.exports, "SearchField", () => $c0a0659cf97e8eb2$export$316f6f283ae64765);
|
|
94
95
|
/*! Depict.ai search and product listing SDK */
|
|
95
|
-
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.1.
|
|
96
|
+
const $b757f75811f3261f$export$83d89fbfd8236492 = "4.1.5";
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* This is a function that will safely clone an object that may contain promises.
|
|
100
|
+
* 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.
|
|
101
|
+
* @param obj Anything to clone
|
|
102
|
+
*/
|
|
103
|
+
function $ac946c6b782bb900$export$83bb9af5671e1dbe(obj) {
|
|
104
|
+
if (obj instanceof Promise) return obj;
|
|
105
|
+
// Extract all promises, keep a map of them, and then re-apply them to both the original object and the target object after cloning
|
|
106
|
+
const seen = new Set();
|
|
107
|
+
const keyStack = [[]];
|
|
108
|
+
const valueStack = [obj];
|
|
109
|
+
const promiseLocationStack = [];
|
|
110
|
+
while (valueStack.length) {
|
|
111
|
+
const value = valueStack.pop();
|
|
112
|
+
const keyPath = keyStack.pop();
|
|
113
|
+
// Promises can only be in objects and we don't need to check for objects we've already seen (like in circular references)
|
|
114
|
+
if (typeof value !== "object" || value === null || seen.has(value)) continue;
|
|
115
|
+
seen.add(value);
|
|
116
|
+
if (Array.isArray(value)) {
|
|
117
|
+
for (let i = 0; i < value.length; i++) {
|
|
118
|
+
const ourValue = value[i];
|
|
119
|
+
const valuesKeyPath = [...keyPath, i];
|
|
120
|
+
if (ourValue instanceof Promise) {
|
|
121
|
+
promiseLocationStack.push([valuesKeyPath, ourValue]);
|
|
122
|
+
delete value[i]; // This will leave a hole in the array, but it's fine since we'll put it back soon
|
|
123
|
+
// This way both the indexes will be correct when putting the value back and our for loop doesn't get messed up
|
|
124
|
+
} else {
|
|
125
|
+
keyStack.push(valuesKeyPath);
|
|
126
|
+
valueStack.push(ourValue);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
for (const innerKey in value) {
|
|
132
|
+
const ourValue = value[innerKey];
|
|
133
|
+
const valuesKeyPath = [...keyPath, innerKey];
|
|
134
|
+
if (ourValue instanceof Promise) {
|
|
135
|
+
promiseLocationStack.push([valuesKeyPath, ourValue]);
|
|
136
|
+
delete value[innerKey];
|
|
137
|
+
} else {
|
|
138
|
+
keyStack.push(valuesKeyPath);
|
|
139
|
+
valueStack.push(ourValue);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
let structuredClonedObject;
|
|
144
|
+
let error;
|
|
145
|
+
try {
|
|
146
|
+
structuredClonedObject = structuredClone(obj);
|
|
147
|
+
} catch (e) {
|
|
148
|
+
// We still need to put back the promises in the original object, even if we threw an error
|
|
149
|
+
error = e;
|
|
150
|
+
}
|
|
151
|
+
// Put back the promises in both the original object and the cloned object
|
|
152
|
+
while (promiseLocationStack.length) {
|
|
153
|
+
const [keyPath, promise] = promiseLocationStack.pop();
|
|
154
|
+
let targetInClone = structuredClonedObject;
|
|
155
|
+
let targetInOriginal = obj;
|
|
156
|
+
for (let i = 0; i < keyPath.length - 1; i++) {
|
|
157
|
+
if (!error) targetInClone = targetInClone[keyPath[i]];
|
|
158
|
+
targetInOriginal = targetInOriginal[keyPath[i]];
|
|
159
|
+
}
|
|
160
|
+
if (!error) targetInClone[keyPath[keyPath.length - 1]] = promise;
|
|
161
|
+
targetInOriginal[keyPath[keyPath.length - 1]] = promise;
|
|
162
|
+
}
|
|
163
|
+
if (error) throw error;
|
|
164
|
+
return structuredClonedObject;
|
|
165
|
+
}
|
|
96
166
|
const $d84fe647b84b5dc5$export$3064e1e8c6513da3 = new Set();
|
|
97
167
|
let $d84fe647b84b5dc5$var$has_ran = false;
|
|
98
168
|
function $d84fe647b84b5dc5$export$5162a71f252e6122() {
|
|
@@ -234,12 +304,55 @@ function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
|
|
|
234
304
|
}) => signal[1](matches)).remove);
|
|
235
305
|
return signal[0];
|
|
236
306
|
}
|
|
307
|
+
var $9fe9883b1d8ecccc$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span>`);
|
|
308
|
+
function $9fe9883b1d8ecccc$export$acb3eaade4b23afd(props) {
|
|
309
|
+
// Work around https://github.com/solidjs/solid/issues/1980
|
|
310
|
+
return (() => {
|
|
311
|
+
var _el$ = $gVhhF$solidjsweb.getNextElement($9fe9883b1d8ecccc$var$_tmpl$);
|
|
312
|
+
$gVhhF$solidjsweb.effect(_p$ => {
|
|
313
|
+
var _v$ = `${props.class || ""} depict-placeholder`,
|
|
314
|
+
_v$2 = props.style;
|
|
315
|
+
_v$ !== _p$.e && $gVhhF$solidjsweb.className(_el$, _p$.e = _v$);
|
|
316
|
+
_p$.t = $gVhhF$solidjsweb.style(_el$, _v$2, _p$.t);
|
|
317
|
+
return _p$;
|
|
318
|
+
}, {
|
|
319
|
+
e: undefined,
|
|
320
|
+
t: undefined
|
|
321
|
+
});
|
|
322
|
+
return _el$;
|
|
323
|
+
})();
|
|
324
|
+
}
|
|
325
|
+
function $061ff5b4c3d36171$export$89c6019e4baa40b1(props) {
|
|
326
|
+
const style = $gVhhF$solidjs.createMemo(() => {
|
|
327
|
+
const {
|
|
328
|
+
style: style,
|
|
329
|
+
height: height,
|
|
330
|
+
width: width
|
|
331
|
+
} = props;
|
|
332
|
+
return {
|
|
333
|
+
...(style || {}),
|
|
334
|
+
height: height ?? "1em",
|
|
335
|
+
...(width && {
|
|
336
|
+
width: width
|
|
337
|
+
})
|
|
338
|
+
};
|
|
339
|
+
});
|
|
340
|
+
return $gVhhF$solidjsweb.createComponent((0, $9fe9883b1d8ecccc$export$acb3eaade4b23afd), {
|
|
341
|
+
get style() {
|
|
342
|
+
return style();
|
|
343
|
+
},
|
|
344
|
+
get ["class"]() {
|
|
345
|
+
return props.class;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
237
349
|
var $6ae613870d3380fc$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span class="title line-clamp">`),
|
|
238
350
|
$6ae613870d3380fc$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span class=brand>`),
|
|
239
351
|
$6ae613870d3380fc$var$_tmpl$3 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="tagline line-clamp">`),
|
|
240
352
|
$6ae613870d3380fc$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span class="orig price"><!$><!/><!$><!/><!$><!/>`),
|
|
241
|
-
$6ae613870d3380fc$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<
|
|
242
|
-
$6ae613870d3380fc$var$_tmpl$6 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=
|
|
353
|
+
$6ae613870d3380fc$var$_tmpl$5 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span class=price><!$><!/><!$><!/><!$><!/>`),
|
|
354
|
+
$6ae613870d3380fc$var$_tmpl$6 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<a class=instant-card><div class=img-part><!$><!/><!$><!/></div><div class=right-part><!$><!/><div class=price-container><!$><!/><!$><!/>`),
|
|
355
|
+
$6ae613870d3380fc$var$_tmpl$7 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=title-brand-tagline>`);
|
|
243
356
|
const $6ae613870d3380fc$export$b05c0ae390cf3e06 = ({
|
|
244
357
|
display_: display_,
|
|
245
358
|
router_: router_,
|
|
@@ -253,7 +366,10 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = ({
|
|
|
253
366
|
const [get_selected_index_, set_selected_index_] = selected_index_ || [];
|
|
254
367
|
const variant = display_.variant_displays[display_.variant_index];
|
|
255
368
|
const href = $gVhhF$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
|
|
256
|
-
|
|
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] = $gVhhF$solidjs.createResource(() => variant.sale_price);
|
|
371
|
+
const [originalPrice] = $gVhhF$solidjs.createResource(() => variant.original_price);
|
|
372
|
+
const isOnSale = $gVhhF$solidjs.createMemo(() => salePrice() !== originalPrice());
|
|
257
373
|
const supports_hover = $b54e6192d0caa293$export$d9f36cf74e24d595("(hover: hover) and (pointer: fine)");
|
|
258
374
|
const [isSelected, selectedDueToKeyboardNavigation] = selected_index_ ? $f144ea315d9e4caa$export$fb40a80c530e5f2b(get_selected_index_, keyboardNavigationGroupIndex_, index_) : [];
|
|
259
375
|
const secondary_image_url = variant.image_urls?.[1] || variant.secondary_image_url || variant.alternative_display_image_url;
|
|
@@ -275,25 +391,20 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = ({
|
|
|
275
391
|
})();
|
|
276
392
|
})())];
|
|
277
393
|
return (() => {
|
|
278
|
-
var _el$4 = $gVhhF$solidjsweb.getNextElement($6ae613870d3380fc$var$_tmpl$
|
|
394
|
+
var _el$4 = $gVhhF$solidjsweb.getNextElement($6ae613870d3380fc$var$_tmpl$6),
|
|
279
395
|
_el$5 = _el$4.firstChild,
|
|
280
396
|
_el$6 = _el$5.firstChild,
|
|
281
397
|
[_el$7, _co$] = $gVhhF$solidjsweb.getNextMarker(_el$6.nextSibling),
|
|
282
398
|
_el$8 = _el$7.nextSibling,
|
|
283
399
|
[_el$9, _co$2] = $gVhhF$solidjsweb.getNextMarker(_el$8.nextSibling),
|
|
284
400
|
_el$10 = _el$5.nextSibling,
|
|
285
|
-
_el$
|
|
286
|
-
[_el$
|
|
287
|
-
_el$11 = _el$
|
|
401
|
+
_el$30 = _el$10.firstChild,
|
|
402
|
+
[_el$31, _co$11] = $gVhhF$solidjsweb.getNextMarker(_el$30.nextSibling),
|
|
403
|
+
_el$11 = _el$31.nextSibling,
|
|
288
404
|
_el$26 = _el$11.firstChild,
|
|
289
405
|
[_el$27, _co$9] = $gVhhF$solidjsweb.getNextMarker(_el$26.nextSibling),
|
|
290
|
-
_el$
|
|
291
|
-
_el$
|
|
292
|
-
[_el$21, _co$6] = $gVhhF$solidjsweb.getNextMarker(_el$20.nextSibling),
|
|
293
|
-
_el$22 = _el$21.nextSibling,
|
|
294
|
-
[_el$23, _co$7] = $gVhhF$solidjsweb.getNextMarker(_el$22.nextSibling),
|
|
295
|
-
_el$24 = _el$23.nextSibling,
|
|
296
|
-
[_el$25, _co$8] = $gVhhF$solidjsweb.getNextMarker(_el$24.nextSibling);
|
|
406
|
+
_el$28 = _el$27.nextSibling,
|
|
407
|
+
[_el$29, _co$10] = $gVhhF$solidjsweb.getNextMarker(_el$28.nextSibling);
|
|
297
408
|
$gVhhF$solidjsweb.use(element => $f144ea315d9e4caa$export$12761f53d7ab7f27(element, () => selectedDueToKeyboardNavigation?.() ?? false), _el$4);
|
|
298
409
|
$gVhhF$solidjsweb.addEventListener(_el$4, "mouseleave", $gVhhF$depictaiutilishared.catchify(() => set_selected_index_?.()));
|
|
299
410
|
$gVhhF$solidjsweb.addEventListener(_el$4, "mouseenter", $gVhhF$depictaiutilishared.catchify(() => set_selected_index_?.([keyboardNavigationGroupIndex_(), index_()])));
|
|
@@ -318,12 +429,14 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = ({
|
|
|
318
429
|
}
|
|
319
430
|
}), _el$9, _co$2);
|
|
320
431
|
$gVhhF$solidjsweb.insert(_el$10, selected_index_ ? $gVhhF$solidjsweb.createComponent(TitleBrandTagline, {}) : (() => {
|
|
321
|
-
var _el$
|
|
322
|
-
$gVhhF$solidjsweb.insert(_el$
|
|
323
|
-
return _el$
|
|
324
|
-
})(), _el$
|
|
432
|
+
var _el$32 = $gVhhF$solidjsweb.getNextElement($6ae613870d3380fc$var$_tmpl$7);
|
|
433
|
+
$gVhhF$solidjsweb.insert(_el$32, $gVhhF$solidjsweb.createComponent(TitleBrandTagline, {}));
|
|
434
|
+
return _el$32;
|
|
435
|
+
})(), _el$31, _co$11);
|
|
325
436
|
$gVhhF$solidjsweb.insert(_el$11, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
326
|
-
when
|
|
437
|
+
get when() {
|
|
438
|
+
return isOnSale();
|
|
439
|
+
},
|
|
327
440
|
get children() {
|
|
328
441
|
var _el$12 = $gVhhF$solidjsweb.getNextElement($6ae613870d3380fc$var$_tmpl$4),
|
|
329
442
|
_el$13 = _el$12.firstChild,
|
|
@@ -335,7 +448,7 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = ({
|
|
|
335
448
|
$gVhhF$solidjsweb.insert(_el$12, () => i18n_.price_formatting_().pre_, _el$14, _co$3);
|
|
336
449
|
$gVhhF$solidjsweb.insert(_el$12, $gVhhF$solidjsweb.createComponent((0, $d659702496cb72ea$export$a71e92cfbb498adc), {
|
|
337
450
|
get price_() {
|
|
338
|
-
return
|
|
451
|
+
return originalPrice();
|
|
339
452
|
},
|
|
340
453
|
get price_formatting_() {
|
|
341
454
|
return i18n_.price_formatting_();
|
|
@@ -345,17 +458,39 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = ({
|
|
|
345
458
|
return _el$12;
|
|
346
459
|
}
|
|
347
460
|
}), _el$27, _co$9);
|
|
348
|
-
_el$
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
get price_() {
|
|
352
|
-
return variant.sale_price;
|
|
461
|
+
$gVhhF$solidjsweb.insert(_el$11, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
|
|
462
|
+
get when() {
|
|
463
|
+
return !salePrice.loading && salePrice.latest;
|
|
353
464
|
},
|
|
354
|
-
get
|
|
355
|
-
return
|
|
465
|
+
get fallback() {
|
|
466
|
+
return $gVhhF$solidjsweb.createComponent((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
|
|
467
|
+
width: "5ch",
|
|
468
|
+
height: "1em",
|
|
469
|
+
"class": "price"
|
|
470
|
+
});
|
|
471
|
+
},
|
|
472
|
+
get children() {
|
|
473
|
+
var _el$19 = $gVhhF$solidjsweb.getNextElement($6ae613870d3380fc$var$_tmpl$5),
|
|
474
|
+
_el$20 = _el$19.firstChild,
|
|
475
|
+
[_el$21, _co$6] = $gVhhF$solidjsweb.getNextMarker(_el$20.nextSibling),
|
|
476
|
+
_el$22 = _el$21.nextSibling,
|
|
477
|
+
[_el$23, _co$7] = $gVhhF$solidjsweb.getNextMarker(_el$22.nextSibling),
|
|
478
|
+
_el$24 = _el$23.nextSibling,
|
|
479
|
+
[_el$25, _co$8] = $gVhhF$solidjsweb.getNextMarker(_el$24.nextSibling);
|
|
480
|
+
$gVhhF$solidjsweb.insert(_el$19, () => i18n_.price_formatting_().pre_, _el$21, _co$6);
|
|
481
|
+
$gVhhF$solidjsweb.insert(_el$19, $gVhhF$solidjsweb.createComponent((0, $d659702496cb72ea$export$a71e92cfbb498adc), {
|
|
482
|
+
get price_() {
|
|
483
|
+
return salePrice();
|
|
484
|
+
},
|
|
485
|
+
get price_formatting_() {
|
|
486
|
+
return i18n_.price_formatting_();
|
|
487
|
+
}
|
|
488
|
+
}), _el$23, _co$7);
|
|
489
|
+
$gVhhF$solidjsweb.insert(_el$19, () => i18n_.price_formatting_().post_, _el$25, _co$8);
|
|
490
|
+
$gVhhF$solidjsweb.effect(() => _el$19.classList.toggle("sales-price", !!isOnSale()));
|
|
491
|
+
return _el$19;
|
|
356
492
|
}
|
|
357
|
-
}), _el$
|
|
358
|
-
$gVhhF$solidjsweb.insert(_el$19, () => i18n_.price_formatting_().post_, _el$25, _co$8);
|
|
493
|
+
}), _el$29, _co$10);
|
|
359
494
|
$gVhhF$solidjsweb.effect(_p$ => {
|
|
360
495
|
var _v$ = href(),
|
|
361
496
|
_v$2 = display_.search_result_id,
|
|
@@ -374,24 +509,6 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = ({
|
|
|
374
509
|
})();
|
|
375
510
|
};
|
|
376
511
|
$gVhhF$solidjsweb.delegateEvents(["click"]);
|
|
377
|
-
var $9fe9883b1d8ecccc$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<span>`);
|
|
378
|
-
function $9fe9883b1d8ecccc$export$acb3eaade4b23afd(props) {
|
|
379
|
-
// Work around https://github.com/solidjs/solid/issues/1980
|
|
380
|
-
return (() => {
|
|
381
|
-
var _el$ = $gVhhF$solidjsweb.getNextElement($9fe9883b1d8ecccc$var$_tmpl$);
|
|
382
|
-
$gVhhF$solidjsweb.effect(_p$ => {
|
|
383
|
-
var _v$ = `${props.class || ""} depict-placeholder`,
|
|
384
|
-
_v$2 = props.style;
|
|
385
|
-
_v$ !== _p$.e && $gVhhF$solidjsweb.className(_el$, _p$.e = _v$);
|
|
386
|
-
_p$.t = $gVhhF$solidjsweb.style(_el$, _v$2, _p$.t);
|
|
387
|
-
return _p$;
|
|
388
|
-
}, {
|
|
389
|
-
e: undefined,
|
|
390
|
-
t: undefined
|
|
391
|
-
});
|
|
392
|
-
return _el$;
|
|
393
|
-
})();
|
|
394
|
-
}
|
|
395
512
|
function $3bc4a89b971a3af5$export$3f37af283f8fb843(props) {
|
|
396
513
|
const style = $gVhhF$solidjs.createMemo(() => {
|
|
397
514
|
const {
|
|
@@ -423,30 +540,6 @@ function $3bc4a89b971a3af5$export$3f37af283f8fb843(props) {
|
|
|
423
540
|
}
|
|
424
541
|
});
|
|
425
542
|
}
|
|
426
|
-
function $061ff5b4c3d36171$export$89c6019e4baa40b1(props) {
|
|
427
|
-
const style = $gVhhF$solidjs.createMemo(() => {
|
|
428
|
-
const {
|
|
429
|
-
style: style,
|
|
430
|
-
height: height,
|
|
431
|
-
width: width
|
|
432
|
-
} = props;
|
|
433
|
-
return {
|
|
434
|
-
...(style || {}),
|
|
435
|
-
height: height ?? "1em",
|
|
436
|
-
...(width && {
|
|
437
|
-
width: width
|
|
438
|
-
})
|
|
439
|
-
};
|
|
440
|
-
});
|
|
441
|
-
return $gVhhF$solidjsweb.createComponent((0, $9fe9883b1d8ecccc$export$acb3eaade4b23afd), {
|
|
442
|
-
get style() {
|
|
443
|
-
return style();
|
|
444
|
-
},
|
|
445
|
-
get ["class"]() {
|
|
446
|
-
return props.class;
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
543
|
var $6f604560873e4f69$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<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>`);
|
|
451
544
|
const $6f604560873e4f69$export$8a2234b5b1a5ebd4 = "--image-aspect-ratio";
|
|
452
545
|
function $6f604560873e4f69$export$ee1733d9a8495996() {
|
|
@@ -555,7 +648,12 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
|
555
648
|
// We had a case on singular where they popped an image url and due to use caching after some time there was no image
|
|
556
649
|
// Attempt cloning the displays if possible (99.9% of the cases probably) and if not, just use the original display
|
|
557
650
|
try {
|
|
558
|
-
|
|
651
|
+
// Use promiseSafeStructuredClone so that:
|
|
652
|
+
// 1. When fetching for example prices from an API, one can start that API request
|
|
653
|
+
// 2. Add the promise to the display
|
|
654
|
+
// 3. Already render the product card with placeholders for prices while the price loads
|
|
655
|
+
// 4. When the price loads, re-render the display with the new price
|
|
656
|
+
display = $ac946c6b782bb900$export$83bb9af5671e1dbe(display);
|
|
559
657
|
} catch (e) {
|
|
560
658
|
if (!$a73063cc642f3e5f$var$printedCloneError) {
|
|
561
659
|
$a73063cc642f3e5f$var$printedCloneError = true;
|
|
@@ -613,7 +711,7 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({
|
|
|
613
711
|
// Modified futher to bias towards saying objects are equal non-primitive objects differ
|
|
614
712
|
function $a73063cc642f3e5f$var$deep_equal(obj1, obj2) {
|
|
615
713
|
const stack = [[obj1, obj2]];
|
|
616
|
-
while (stack.length
|
|
714
|
+
while (stack.length) {
|
|
617
715
|
const [currentObj1, currentObj2] = stack.pop();
|
|
618
716
|
if (currentObj1 === currentObj2) continue;
|
|
619
717
|
if (Array.isArray(currentObj1) && Array.isArray(currentObj2)) {
|
|
@@ -2541,10 +2639,10 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
2541
2639
|
const src_options = $gVhhF$solidjs.createMemo(() => {
|
|
2542
2640
|
const {
|
|
2543
2641
|
src: src,
|
|
2544
|
-
|
|
2642
|
+
customUrls: customUrls
|
|
2545
2643
|
} = props;
|
|
2546
|
-
const fallback_src = (
|
|
2547
|
-
const srcset = $19950faaac026e09$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096],
|
|
2644
|
+
const fallback_src = (customUrls || $19950faaac026e09$export$1d6267828870adda)(src, 400);
|
|
2645
|
+
const srcset = $19950faaac026e09$var$make_srcset(props.src, props.resolutions || [64, 128, 256, 300, 400, 512, 640, 768, 1024, 1280, 1536, 2048, 2560, 3072, 3584, 4096], customUrls);
|
|
2548
2646
|
// The order here *might* matter - I've seen mobile safari always start with loading the 400px version when it was reversed
|
|
2549
2647
|
return {
|
|
2550
2648
|
srcset: srcset,
|
|
@@ -2553,7 +2651,9 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
|
|
|
2553
2651
|
});
|
|
2554
2652
|
// Work around https://github.com/solidjs/solid/issues/1828
|
|
2555
2653
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
2556
|
-
const [, otherAttributes] = $gVhhF$solidjs.splitProps(props, ["resolutions", "size", "src", "srcSet", "loading"
|
|
2654
|
+
const [, otherAttributes] = $gVhhF$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 <-
|
|
2655
|
+
]);
|
|
2656
|
+
|
|
2557
2657
|
const [hasSetSize, setHasSetSize] = $gVhhF$solidjs.createSignal(false);
|
|
2558
2658
|
const [hasDecoded, setHasDecoded] = $gVhhF$solidjs.createSignal(false);
|
|
2559
2659
|
const productCardIndexAccessor = $129b9b9c010039d0$export$e3faf4d95300054f();
|
|
@@ -2749,7 +2849,7 @@ function $e8327f98c8ee28d7$export$9d4a4b669b1929ab(props) {
|
|
|
2749
2849
|
get imgProps() {
|
|
2750
2850
|
return {
|
|
2751
2851
|
...props.imgProps,
|
|
2752
|
-
|
|
2852
|
+
customUrls: (url, width // Apparently don't have to encode url for CF's service
|
|
2753
2853
|
) => {
|
|
2754
2854
|
if (url.startsWith("https://cdn.shopify.com"))
|
|
2755
2855
|
// 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,
|
package/latest/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;
|