@depict-ai/ui 4.3.0 → 4.3.2
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 +350 -258
- package/ES10/index.d.ts +244 -237
- package/ES10/index.js +384 -292
- package/latest/index.cjs +326 -234
- package/latest/index.d.ts +244 -237
- package/latest/index.js +360 -268
- package/package.json +2 -2
- package/server/ES10/index.cjs +307 -219
- package/server/ES10/index.d.ts +244 -237
- package/server/ES10/index.js +347 -259
- package/server/latest/index.cjs +284 -195
- package/server/latest/index.d.ts +244 -237
- package/server/latest/index.js +324 -235
package/ES10/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var $52FdA$depictaiutilishared = require("@depict-ai/utilishared/ES10");
|
|
2
2
|
var $52FdA$solidjsweb = require("solid-js/web");
|
|
3
3
|
var $52FdA$solidjs = require("solid-js");
|
|
4
|
-
var $52FdA$depictaiutilisharedlatest = require("@depict-ai/utilishared/ES10");
|
|
5
4
|
var $52FdA$babelruntimehelpersdefineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
5
|
+
var $52FdA$depictaiutilisharedlatest = require("@depict-ai/utilishared/ES10");
|
|
6
6
|
var $52FdA$babelruntimehelpersclassPrivateFieldSet = require("@babel/runtime/helpers/classPrivateFieldSet");
|
|
7
7
|
var $52FdA$babelruntimehelpersclassPrivateFieldGet = require("@babel/runtime/helpers/classPrivateFieldGet");
|
|
8
8
|
var $52FdA$solidjsstore = require("solid-js/store");
|
|
@@ -100,7 +100,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
|
|
|
100
100
|
$parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
|
|
101
101
|
$parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
|
|
102
102
|
/*! Depict.ai search and product listing SDK */
|
|
103
|
-
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.3.
|
|
103
|
+
const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.3.2";
|
|
104
104
|
const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
|
|
105
105
|
const cols_at_size = [];
|
|
106
106
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -1121,7 +1121,7 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
1121
1121
|
});
|
|
1122
1122
|
// Work around https://github.com/solidjs/solid/issues/1828
|
|
1123
1123
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
1124
|
-
const [, otherAttributes] = $52FdA$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 <-
|
|
1124
|
+
const [, otherAttributes] = $52FdA$solidjs.splitProps(props, ["resolutions", "size", "src", "srcSet", "loading", "keyRatioUpdating", "customUrls" // Can't have properties ending on underscore because the property name mangling will get confused by this <-
|
|
1125
1125
|
]);
|
|
1126
1126
|
|
|
1127
1127
|
const [hasSetSize, setHasSetSize] = $52FdA$solidjs.createSignal(false);
|
|
@@ -1177,13 +1177,18 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
1177
1177
|
let hasDecodedFastPath = false;
|
|
1178
1178
|
let timeoutSet = false;
|
|
1179
1179
|
let gotCleanedUp = false;
|
|
1180
|
+
let srcJustChanged = true;
|
|
1180
1181
|
img.classList.add("s-responsive-image");
|
|
1181
1182
|
if (listingContext) {
|
|
1182
1183
|
let prevValue;
|
|
1183
1184
|
const aspectRatios = listingContext[$858fdcf73148519f$export$f8945274f08a3105] || (listingContext[$858fdcf73148519f$export$f8945274f08a3105] = new Set());
|
|
1184
1185
|
const [, setMostPrevalentAspectRatio] = listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] || (listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] = $52FdA$solidjs.createSignal());
|
|
1185
1186
|
img.addEventListener("load", $52FdA$depictaiutilishared.catchify(() => {
|
|
1186
|
-
|
|
1187
|
+
if (props.keyRatioUpdating) {
|
|
1188
|
+
if (!srcJustChanged) return;
|
|
1189
|
+
srcJustChanged = false;
|
|
1190
|
+
}
|
|
1191
|
+
// Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2 and LookItem
|
|
1187
1192
|
const aspectRatio_ = img.naturalWidth / img.naturalHeight;
|
|
1188
1193
|
if (prevValue) aspectRatios.delete(prevValue);
|
|
1189
1194
|
const newValue = !isNaN(aspectRatio_) ? {
|
|
@@ -1205,6 +1210,10 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
|
|
|
1205
1210
|
}
|
|
1206
1211
|
$52FdA$solidjs.onCleanup(() => gotCleanedUp = true);
|
|
1207
1212
|
$52FdA$solidjsweb.spread(img, $52FdA$solidjs.mergeProps(modifiedOtherAttributes), false, true);
|
|
1213
|
+
$52FdA$solidjs.createRenderEffect(() => {
|
|
1214
|
+
props.src;
|
|
1215
|
+
srcJustChanged = true;
|
|
1216
|
+
});
|
|
1208
1217
|
$52FdA$solidjs.createEffect(() => {
|
|
1209
1218
|
if (!props.size()) return; // wait until we have a size, run every time the size changes
|
|
1210
1219
|
if (timeoutSet) return;
|
|
@@ -1272,48 +1281,22 @@ function $28535bb7671c63d1$export$e4b984597b71e989(props) {
|
|
|
1272
1281
|
context[$28535bb7671c63d1$export$d7b7ab832c20e2f4] = $52FdA$solidjs.createSignal();
|
|
1273
1282
|
const [currentImageSize, setCurrentImageSize] = (context === null || context === void 0 ? void 0 : context[$28535bb7671c63d1$export$d7b7ab832c20e2f4]) || $28535bb7671c63d1$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
1274
1283
|
const [mostPrevalentAspectRatio] = context ? context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] || (context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] = $52FdA$solidjs.createSignal()) : [];
|
|
1275
|
-
const [aspectRatio, setAspectRatio] = $52FdA$solidjs.createSignal($52FdA$solidjs.untrack(() => props.aspectRatio));
|
|
1276
1284
|
const container = $ce467edb5343cfcd$export$94026ee33dbabc26({
|
|
1277
1285
|
// Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
|
|
1278
1286
|
get class() {
|
|
1279
1287
|
return props.class;
|
|
1280
1288
|
},
|
|
1281
1289
|
get aspectRatio() {
|
|
1282
|
-
|
|
1290
|
+
if (props.autoAdjustAspectRatio) {
|
|
1291
|
+
const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
|
|
1292
|
+
if (targetRatio != undefined) return "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
|
|
1293
|
+
}
|
|
1294
|
+
return props.aspectRatio;
|
|
1283
1295
|
}
|
|
1284
1296
|
});
|
|
1285
1297
|
const owner = $52FdA$solidjs.getOwner();
|
|
1286
1298
|
let createdSizeAccessor = false;
|
|
1287
1299
|
let wasCleanedUp = false;
|
|
1288
|
-
let timeout;
|
|
1289
|
-
$52FdA$solidjs.createEffect(() => {
|
|
1290
|
-
const {
|
|
1291
|
-
autoAdjustAspectRatio: autoAdjustAspectRatio
|
|
1292
|
-
} = props;
|
|
1293
|
-
if (autoAdjustAspectRatio) {
|
|
1294
|
-
const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
|
|
1295
|
-
if (targetRatio != undefined) {
|
|
1296
|
-
const targetValue = "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
|
|
1297
|
-
const updateAspectRatio = $52FdA$depictaiutilishared.catchify(() => setAspectRatio(targetValue));
|
|
1298
|
-
if (autoAdjustAspectRatio === "smoothed") {
|
|
1299
|
-
if (!timeout)
|
|
1300
|
-
// If we don't have a timeout yet, also update instantly. This is so that the aspect ratio does get set at the start of a transition, if it changes (when using smoothing).
|
|
1301
|
-
updateAspectRatio();
|
|
1302
|
-
clearTimeout(timeout);
|
|
1303
|
-
timeout = setTimeout(() => {
|
|
1304
|
-
timeout = undefined;
|
|
1305
|
-
updateAspectRatio();
|
|
1306
|
-
}, 500);
|
|
1307
|
-
return;
|
|
1308
|
-
}
|
|
1309
|
-
return updateAspectRatio();
|
|
1310
|
-
}
|
|
1311
|
-
} else {
|
|
1312
|
-
clearTimeout(timeout);
|
|
1313
|
-
timeout = undefined;
|
|
1314
|
-
}
|
|
1315
|
-
setAspectRatio(props.aspectRatio);
|
|
1316
|
-
});
|
|
1317
1300
|
$52FdA$solidjs.createEffect(() => {
|
|
1318
1301
|
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
1319
1302
|
// ensure we always have a size accessor
|
|
@@ -1363,7 +1346,13 @@ function $f3db423dc84bc35d$export$9d4a4b669b1929ab(props) {
|
|
|
1363
1346
|
}
|
|
1364
1347
|
}));
|
|
1365
1348
|
}
|
|
1366
|
-
|
|
1349
|
+
function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
|
|
1350
|
+
return $52FdA$solidjs.createMemo(() => {
|
|
1351
|
+
const price_formatting = props.price_formatting_;
|
|
1352
|
+
return $52FdA$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
var $d66c35b5a6d6d926$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=img-wrapper>`),
|
|
1367
1356
|
$d66c35b5a6d6d926$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class="d-price original">`),
|
|
1368
1357
|
$d66c35b5a6d6d926$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=right-part><div class=text-container><span class="d-title line-clamp"></span><span class=d-price></span><!$><!/></div><!$><!/>`),
|
|
1369
1358
|
$d66c35b5a6d6d926$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<a class=look-item><!$><!/><!$><!/>`);
|
|
@@ -1374,23 +1363,17 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1374
1363
|
isExpanded_: isExpanded_,
|
|
1375
1364
|
textFadeInAnimationRunning_: textFadeInAnimationRunning_,
|
|
1376
1365
|
outerRef_: outerRef_,
|
|
1377
|
-
animationDuration_: animationDuration_
|
|
1366
|
+
animationDuration_: animationDuration_,
|
|
1367
|
+
priceFormatting_: priceFormatting_,
|
|
1368
|
+
pseudoRouter_: pseudoRouter_
|
|
1378
1369
|
} = _ref;
|
|
1379
1370
|
const variantToUse = $52FdA$solidjs.createMemo(() => {
|
|
1380
1371
|
const display = display_();
|
|
1381
1372
|
return display === null || display === void 0 ? void 0 : display.variant_displays[display === null || display === void 0 ? void 0 : display.variant_index];
|
|
1382
1373
|
});
|
|
1383
|
-
const imageUrls = () => {
|
|
1384
|
-
var _variantToUse;
|
|
1385
|
-
return (_variantToUse = variantToUse()) === null || _variantToUse === void 0 ? void 0 : _variantToUse.image_urls;
|
|
1386
|
-
};
|
|
1387
1374
|
const imageUrl = $52FdA$solidjs.createMemo(() => {
|
|
1388
|
-
var
|
|
1389
|
-
return (
|
|
1390
|
-
});
|
|
1391
|
-
const secondaryImageUrl = $52FdA$solidjs.createMemo(() => {
|
|
1392
|
-
var _imageUrls2;
|
|
1393
|
-
return (_imageUrls2 = imageUrls()) === null || _imageUrls2 === void 0 ? void 0 : _imageUrls2[1];
|
|
1375
|
+
var _variantToUse, _variantToUse$image_u;
|
|
1376
|
+
return (_variantToUse = variantToUse()) === null || _variantToUse === void 0 ? void 0 : (_variantToUse$image_u = _variantToUse.image_urls) === null || _variantToUse$image_u === void 0 ? void 0 : _variantToUse$image_u[0];
|
|
1394
1377
|
});
|
|
1395
1378
|
const [animationIsRunning, setAnimationIsRunning] = textFadeInAnimationRunning_;
|
|
1396
1379
|
const [isExpandedThrottledByOurEffectRun, setIsExpandedThrottledByOurEffectRun] = $52FdA$solidjs.createSignal($52FdA$solidjs.untrack(isExpanded_));
|
|
@@ -1403,21 +1386,31 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1403
1386
|
var _variantToUse3;
|
|
1404
1387
|
return (_variantToUse3 = variantToUse()) === null || _variantToUse3 === void 0 ? void 0 : _variantToUse3.original_price;
|
|
1405
1388
|
});
|
|
1406
|
-
const isOnSale = $52FdA$solidjs.createMemo(() => salePrice.latest !== originalPrice.latest); // .latest doesn't trigger suspense
|
|
1389
|
+
const isOnSale = $52FdA$solidjs.createMemo(() => !salePrice.loading && !originalPrice.loading && salePrice.latest !== originalPrice.latest); // .latest doesn't trigger suspense after the initial load
|
|
1390
|
+
const enableLink = $52FdA$solidjs.createMemo(() => isExpanded_() && !animationIsRunning());
|
|
1391
|
+
const href = $52FdA$solidjs.createMemo(() => {
|
|
1392
|
+
var _variantToUse4;
|
|
1393
|
+
return (_variantToUse4 = variantToUse()) === null || _variantToUse4 === void 0 ? void 0 : _variantToUse4.page_url;
|
|
1394
|
+
});
|
|
1407
1395
|
const FavoriteButton = FavoriteButton_; // Just to get rid of the type error - TS doesn't understand <Show>
|
|
1408
1396
|
return (() => {
|
|
1409
1397
|
var _el$ = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$4),
|
|
1410
|
-
_el$
|
|
1411
|
-
[_el$
|
|
1412
|
-
_el$
|
|
1413
|
-
[_el$
|
|
1398
|
+
_el$12 = _el$.firstChild,
|
|
1399
|
+
[_el$13, _co$3] = $52FdA$solidjsweb.getNextMarker(_el$12.nextSibling),
|
|
1400
|
+
_el$14 = _el$13.nextSibling,
|
|
1401
|
+
[_el$15, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$14.nextSibling);
|
|
1414
1402
|
var _ref$ = outerRef_;
|
|
1415
1403
|
typeof _ref$ === "function" ? $52FdA$solidjsweb.use(_ref$, _el$) : outerRef_ = _el$;
|
|
1416
|
-
$52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1404
|
+
$52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => enableLink() ? {
|
|
1405
|
+
href: href()
|
|
1406
|
+
} : {}, {
|
|
1407
|
+
get onClick() {
|
|
1408
|
+
return $52FdA$depictaiutilishared.catchify(event_ => enableLink() && pseudoRouter_.navigate_.go_to_({
|
|
1409
|
+
new_url_: href(),
|
|
1410
|
+
is_replace_: false,
|
|
1411
|
+
event_: event_
|
|
1412
|
+
}));
|
|
1413
|
+
}
|
|
1421
1414
|
}), false, true);
|
|
1422
1415
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1423
1416
|
when: imageUrl,
|
|
@@ -1427,11 +1420,7 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1427
1420
|
});
|
|
1428
1421
|
},
|
|
1429
1422
|
get children() {
|
|
1430
|
-
var _el$2 = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$)
|
|
1431
|
-
_el$3 = _el$2.firstChild,
|
|
1432
|
-
[_el$4, _co$] = $52FdA$solidjsweb.getNextMarker(_el$3.nextSibling),
|
|
1433
|
-
_el$5 = _el$4.nextSibling,
|
|
1434
|
-
[_el$6, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$5.nextSibling);
|
|
1423
|
+
var _el$2 = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$);
|
|
1435
1424
|
$52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1436
1425
|
get when() {
|
|
1437
1426
|
return imageUrl();
|
|
@@ -1450,46 +1439,30 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1450
1439
|
return isExpanded_() ? 0.75 : 1;
|
|
1451
1440
|
},
|
|
1452
1441
|
get autoAdjustAspectRatio() {
|
|
1453
|
-
return isExpanded_()
|
|
1454
|
-
}
|
|
1455
|
-
});
|
|
1456
|
-
}
|
|
1457
|
-
}), _el$4, _co$);
|
|
1458
|
-
$52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1459
|
-
get when() {
|
|
1460
|
-
return secondaryImageUrl();
|
|
1461
|
-
},
|
|
1462
|
-
get children() {
|
|
1463
|
-
return $52FdA$solidjsweb.createComponent((0, $f3db423dc84bc35d$export$9d4a4b669b1929ab), {
|
|
1464
|
-
get src() {
|
|
1465
|
-
return secondaryImageUrl();
|
|
1466
|
-
},
|
|
1467
|
-
get aspectRatio() {
|
|
1468
|
-
return isExpanded_() ? 0.75 : 1;
|
|
1442
|
+
return isExpanded_();
|
|
1469
1443
|
},
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
return isExpanded_() ? "smoothed" : false;
|
|
1444
|
+
imgProps: {
|
|
1445
|
+
keyRatioUpdating: true
|
|
1473
1446
|
}
|
|
1474
1447
|
});
|
|
1475
1448
|
}
|
|
1476
|
-
})
|
|
1449
|
+
}));
|
|
1477
1450
|
return _el$2;
|
|
1478
1451
|
}
|
|
1479
|
-
}), _el$
|
|
1452
|
+
}), _el$13, _co$3);
|
|
1480
1453
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1481
1454
|
get when() {
|
|
1482
1455
|
return (animationEffectExists() ? isExpandedThrottledByOurEffectRun() : isExpanded_()) || animationIsRunning();
|
|
1483
1456
|
},
|
|
1484
1457
|
get children() {
|
|
1485
|
-
var _el$
|
|
1486
|
-
_el$
|
|
1487
|
-
_el$
|
|
1488
|
-
_el$
|
|
1489
|
-
_el$
|
|
1490
|
-
[_el$
|
|
1491
|
-
_el$
|
|
1492
|
-
[_el$
|
|
1458
|
+
var _el$3 = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$3),
|
|
1459
|
+
_el$4 = _el$3.firstChild,
|
|
1460
|
+
_el$5 = _el$4.firstChild,
|
|
1461
|
+
_el$6 = _el$5.nextSibling,
|
|
1462
|
+
_el$8 = _el$6.nextSibling,
|
|
1463
|
+
[_el$9, _co$] = $52FdA$solidjsweb.getNextMarker(_el$8.nextSibling),
|
|
1464
|
+
_el$10 = _el$4.nextSibling,
|
|
1465
|
+
[_el$11, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$10.nextSibling);
|
|
1493
1466
|
$52FdA$solidjsweb.use(element => {
|
|
1494
1467
|
const owner = $52FdA$solidjs.getOwner();
|
|
1495
1468
|
$52FdA$solidjs.onCleanup((0, $52FdA$depictaiutilishared.observer).onexists(element, _ref2 => {
|
|
@@ -1522,49 +1495,91 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1522
1495
|
for (const ev of ["cancel", "finish"]) textContainerAnimation.addEventListener(ev, $52FdA$depictaiutilishared.catchify(() => setAnimationIsRunning(false)));
|
|
1523
1496
|
disconnector();
|
|
1524
1497
|
}));
|
|
1525
|
-
}, _el$
|
|
1526
|
-
$52FdA$solidjsweb.insert(_el$
|
|
1498
|
+
}, _el$3);
|
|
1499
|
+
$52FdA$solidjsweb.insert(_el$5, () => {
|
|
1527
1500
|
var _variantToUse$title, _variantToUse5;
|
|
1528
1501
|
return (_variantToUse$title = (_variantToUse5 = variantToUse()) === null || _variantToUse5 === void 0 ? void 0 : _variantToUse5.title) !== null && _variantToUse$title !== void 0 ? _variantToUse$title : $52FdA$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
|
|
1529
1502
|
height: "1em",
|
|
1530
1503
|
width: "20ch"
|
|
1531
1504
|
});
|
|
1532
1505
|
});
|
|
1533
|
-
$52FdA$solidjsweb.insert(_el$
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1506
|
+
$52FdA$solidjsweb.insert(_el$6, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1507
|
+
get when() {
|
|
1508
|
+
return variantToUse() && !salePrice.loading;
|
|
1509
|
+
},
|
|
1510
|
+
get fallback() {
|
|
1511
|
+
return $52FdA$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
|
|
1512
|
+
height: "1em",
|
|
1513
|
+
width: "20ch"
|
|
1514
|
+
});
|
|
1515
|
+
},
|
|
1516
|
+
get children() {
|
|
1517
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1518
|
+
get when() {
|
|
1519
|
+
return salePrice.latest;
|
|
1520
|
+
},
|
|
1521
|
+
get children() {
|
|
1522
|
+
return [$52FdA$solidjsweb.memo(() => priceFormatting_().pre_), $52FdA$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
|
|
1523
|
+
get price_() {
|
|
1524
|
+
return salePrice();
|
|
1525
|
+
},
|
|
1526
|
+
get price_formatting_() {
|
|
1527
|
+
return priceFormatting_();
|
|
1528
|
+
}
|
|
1529
|
+
}), $52FdA$solidjsweb.memo(() => priceFormatting_().post_)];
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
}));
|
|
1534
|
+
$52FdA$solidjsweb.insert(_el$4, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1541
1535
|
get when() {
|
|
1542
1536
|
return isOnSale();
|
|
1543
1537
|
},
|
|
1544
1538
|
get children() {
|
|
1545
|
-
var _el$
|
|
1546
|
-
$52FdA$solidjsweb.insert(_el$
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1539
|
+
var _el$7 = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$2);
|
|
1540
|
+
$52FdA$solidjsweb.insert(_el$7, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1541
|
+
get when() {
|
|
1542
|
+
return variantToUse() && !originalPrice.loading;
|
|
1543
|
+
},
|
|
1544
|
+
get fallback() {
|
|
1545
|
+
return $52FdA$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
|
|
1546
|
+
height: "1em",
|
|
1547
|
+
width: "20ch"
|
|
1548
|
+
});
|
|
1549
|
+
},
|
|
1550
|
+
get children() {
|
|
1551
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1552
|
+
get when() {
|
|
1553
|
+
return salePrice.latest;
|
|
1554
|
+
},
|
|
1555
|
+
get children() {
|
|
1556
|
+
return [$52FdA$solidjsweb.memo(() => priceFormatting_().pre_), $52FdA$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
|
|
1557
|
+
get price_() {
|
|
1558
|
+
return originalPrice();
|
|
1559
|
+
},
|
|
1560
|
+
get price_formatting_() {
|
|
1561
|
+
return priceFormatting_();
|
|
1562
|
+
}
|
|
1563
|
+
}), $52FdA$solidjsweb.memo(() => priceFormatting_().post_)];
|
|
1564
|
+
}
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
}));
|
|
1568
|
+
return _el$7;
|
|
1554
1569
|
}
|
|
1555
|
-
}), _el$
|
|
1556
|
-
$52FdA$solidjsweb.insert(_el$
|
|
1570
|
+
}), _el$9, _co$);
|
|
1571
|
+
$52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1557
1572
|
when: FavoriteButton_,
|
|
1558
1573
|
get children() {
|
|
1559
1574
|
return $52FdA$solidjsweb.createComponent(FavoriteButton, {
|
|
1560
1575
|
display_: display_
|
|
1561
1576
|
});
|
|
1562
1577
|
}
|
|
1563
|
-
}), _el$
|
|
1564
|
-
$52FdA$solidjsweb.effect(() => _el$
|
|
1565
|
-
return _el$
|
|
1578
|
+
}), _el$11, _co$2);
|
|
1579
|
+
$52FdA$solidjsweb.effect(() => _el$6.classList.toggle("sale", !!isOnSale()));
|
|
1580
|
+
return _el$3;
|
|
1566
1581
|
}
|
|
1567
|
-
}), _el$
|
|
1582
|
+
}), _el$15, _co$4);
|
|
1568
1583
|
$52FdA$solidjsweb.runHydrationEvents();
|
|
1569
1584
|
return _el$;
|
|
1570
1585
|
})();
|
|
@@ -1627,7 +1642,9 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1627
1642
|
userWantsExpandedSignal_: [userWantsExpanded, setUserWantsExpanded],
|
|
1628
1643
|
containerWidth_: containerWidth_,
|
|
1629
1644
|
animationDuration_: animationDuration_,
|
|
1630
|
-
supportsHover_: supportsHover_
|
|
1645
|
+
supportsHover_: supportsHover_,
|
|
1646
|
+
priceFormatting_: priceFormatting_,
|
|
1647
|
+
pseudoRouter_: pseudoRouter_
|
|
1631
1648
|
} = _ref;
|
|
1632
1649
|
let isAffectedByChromeBug = false;
|
|
1633
1650
|
// If the user requests the drawer to be expanded or not
|
|
@@ -1681,11 +1698,13 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1681
1698
|
},
|
|
1682
1699
|
children: (display, index) => {
|
|
1683
1700
|
return $52FdA$solidjsweb.createComponent((0, $d66c35b5a6d6d926$export$b73ed90f0ee50dc3), {
|
|
1701
|
+
pseudoRouter_: pseudoRouter_,
|
|
1684
1702
|
animationDuration_: animationDuration_,
|
|
1685
1703
|
display_: display,
|
|
1686
1704
|
FavoriteButton_: FavoriteButton_,
|
|
1687
1705
|
isExpanded_: userWantsExpanded,
|
|
1688
1706
|
textFadeInAnimationRunning_: textFadeInAnimationRunning,
|
|
1707
|
+
priceFormatting_: priceFormatting_,
|
|
1689
1708
|
outerRef_: el => $52FdA$solidjs.createEffect(() => {
|
|
1690
1709
|
if (index !== 0) return;
|
|
1691
1710
|
const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => setLookItemHeight(records.at(-1).contentRect.height)));
|
|
@@ -1729,10 +1748,10 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1729
1748
|
expandedLooksSignal_: [expandedLooks_, setExpandedLooks],
|
|
1730
1749
|
FavoriteButton_: FavoriteButton_,
|
|
1731
1750
|
placeholderImageAspectRatio_: placeholderImageAspectRatio_,
|
|
1732
|
-
animationDuration_: animationDuration_
|
|
1751
|
+
animationDuration_: animationDuration_,
|
|
1752
|
+
priceFormatting_: priceFormatting_,
|
|
1753
|
+
pseudoRouter_: pseudoRouter_
|
|
1733
1754
|
} = _ref;
|
|
1734
|
-
// TODO: shopify, run displayTransformers to get dynamic prices
|
|
1735
|
-
// TODO: format prices
|
|
1736
1755
|
const [coverImage] = (display_ === null || display_ === void 0 ? void 0 : display_.image_urls) || [];
|
|
1737
1756
|
const useWantsExpandedSignal_ = $52FdA$solidjs.createSignal(false);
|
|
1738
1757
|
const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
|
|
@@ -1740,16 +1759,23 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1740
1759
|
const us = Symbol("look");
|
|
1741
1760
|
const container = (() => {
|
|
1742
1761
|
var _el$ = $52FdA$solidjsweb.getNextElement($47e3c3102c78121b$var$_tmpl$);
|
|
1743
|
-
$52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilishared.catchify(
|
|
1762
|
+
$52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilishared.catchify(_ref2 => {
|
|
1763
|
+
let {
|
|
1764
|
+
target: target
|
|
1765
|
+
} = _ref2;
|
|
1766
|
+
// Don't toggle when clicking on the links
|
|
1767
|
+
if (target.matches("a") || target.closest("a")) return;
|
|
1768
|
+
setUserWantsExpanded(prev => !prev);
|
|
1769
|
+
}), true);
|
|
1744
1770
|
_el$.classList.toggle("placeholder", !!!display_);
|
|
1745
1771
|
$52FdA$solidjsweb.runHydrationEvents();
|
|
1746
1772
|
return _el$;
|
|
1747
1773
|
})();
|
|
1748
1774
|
const containerWidth_ = $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(container);
|
|
1749
|
-
const clickHandler = $52FdA$depictaiutilishared.catchify(
|
|
1775
|
+
const clickHandler = $52FdA$depictaiutilishared.catchify(_ref3 => {
|
|
1750
1776
|
let {
|
|
1751
1777
|
target: target
|
|
1752
|
-
} =
|
|
1778
|
+
} = _ref3;
|
|
1753
1779
|
if (target !== container && !container.contains(target))
|
|
1754
1780
|
// When clicking outside the look, close it
|
|
1755
1781
|
setUserWantsExpanded(false);
|
|
@@ -1771,7 +1797,7 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1771
1797
|
when: display_,
|
|
1772
1798
|
get fallback() {
|
|
1773
1799
|
return $52FdA$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
|
|
1774
|
-
aspectRatio: placeholderImageAspectRatio_
|
|
1800
|
+
aspectRatio: "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(placeholderImageAspectRatio_, ")")
|
|
1775
1801
|
});
|
|
1776
1802
|
},
|
|
1777
1803
|
get children() {
|
|
@@ -1789,11 +1815,137 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1789
1815
|
containerWidth_: containerWidth_,
|
|
1790
1816
|
animationDuration_: animationDuration_,
|
|
1791
1817
|
supportsHover_: supportsHover_,
|
|
1792
|
-
FavoriteButton_: FavoriteButton_
|
|
1818
|
+
FavoriteButton_: FavoriteButton_,
|
|
1819
|
+
priceFormatting_: priceFormatting_,
|
|
1820
|
+
pseudoRouter_: pseudoRouter_
|
|
1793
1821
|
})]);
|
|
1794
1822
|
return container;
|
|
1795
1823
|
}
|
|
1796
1824
|
$52FdA$solidjsweb.delegateEvents(["click"]);
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* This function is used to determine if the user is trying to open a link in a new tab or window, and we therefore should not single page navigate
|
|
1828
|
+
* @param clickEvent The click event that triggered the navigation
|
|
1829
|
+
*/
|
|
1830
|
+
function $9ca08bcacbc598ce$export$29d28dadc2d6b631(clickEvent) {
|
|
1831
|
+
return (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.button) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.metaKey) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.ctrlKey) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.shiftKey // if true, shift button on windows, linux or macOS which opens in a new window
|
|
1832
|
+
);
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
function $73014ff36186a4dd$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
1836
|
+
$73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
1837
|
+
privateSet.add(obj);
|
|
1838
|
+
}
|
|
1839
|
+
function $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
1840
|
+
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
1841
|
+
}
|
|
1842
|
+
function $73014ff36186a4dd$var$_classPrivateMethodGet(receiver, privateSet, fn) {
|
|
1843
|
+
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
1844
|
+
return fn;
|
|
1845
|
+
}
|
|
1846
|
+
var $73014ff36186a4dd$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
|
|
1847
|
+
var $73014ff36186a4dd$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
|
|
1848
|
+
class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
|
|
1849
|
+
/**
|
|
1850
|
+
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
1851
|
+
*/ /**
|
|
1852
|
+
* We store listing_id in history.state and do operate on this both here and in js-ui, this is the key to be used which js-ui provides
|
|
1853
|
+
*/ /**
|
|
1854
|
+
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
1855
|
+
* This standardises waiting for all kinds of routers
|
|
1856
|
+
*/
|
|
1857
|
+
constructor(on_navigation, listing_query_state_key) {
|
|
1858
|
+
$73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_get_navigation_happened_promise);
|
|
1859
|
+
$73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_throwing_on_navigation);
|
|
1860
|
+
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "on_navigation_", void 0);
|
|
1861
|
+
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "listing_query_state_key", void 0);
|
|
1862
|
+
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "navigate_", {
|
|
1863
|
+
/**
|
|
1864
|
+
* Call this if you *just* want to replace the state object in history.state
|
|
1865
|
+
*/
|
|
1866
|
+
replace_state_: new_state => {
|
|
1867
|
+
var _globalThis$history;
|
|
1868
|
+
// This doesn't break any router, so we just do this directly for now, since many don't expose an interface for changing the state
|
|
1869
|
+
globalThis === null || globalThis === void 0 || (_globalThis$history = globalThis.history) === null || _globalThis$history === void 0 || _globalThis$history.replaceState(new_state, "");
|
|
1870
|
+
},
|
|
1871
|
+
/**
|
|
1872
|
+
* Call this to change the URL
|
|
1873
|
+
* @param new_url_ new URL to go to
|
|
1874
|
+
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
1875
|
+
* @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
|
|
1876
|
+
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
1877
|
+
* @param listing_id_ If you are navigating to a category and know the listing_id of, please provide it. This is for making a better devEx in js-ui
|
|
1878
|
+
*/
|
|
1879
|
+
go_to_: $52FdA$depictaiutilishared.catchify(async _ref => {
|
|
1880
|
+
let {
|
|
1881
|
+
new_url_: raw_new_url,
|
|
1882
|
+
event_: event_,
|
|
1883
|
+
force_spa_navigation_: force_spa_navigation_,
|
|
1884
|
+
is_replace_: is_replace_,
|
|
1885
|
+
listing_query_: listing_query_,
|
|
1886
|
+
scroll = true
|
|
1887
|
+
} = _ref;
|
|
1888
|
+
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
1889
|
+
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
1890
|
+
if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(event_)) return;
|
|
1891
|
+
const different_origin = new_url_.origin !== location.origin;
|
|
1892
|
+
if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
|
|
1893
|
+
if (force_spa_navigation_ && different_origin)
|
|
1894
|
+
// If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
|
|
1895
|
+
$52FdA$depictaiutilishared.dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
|
|
1896
|
+
if (!event_)
|
|
1897
|
+
// If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
1898
|
+
location.assign(new_url_);
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
event_ === null || event_ === void 0 || event_.preventDefault();
|
|
1902
|
+
const promise = $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_get_navigation_happened_promise, $73014ff36186a4dd$var$_get_navigation_happened_promise2).call(this, true);
|
|
1903
|
+
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
1904
|
+
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
1905
|
+
const new_state = history.state;
|
|
1906
|
+
if (listing_query_) {
|
|
1907
|
+
// In JS-UI we need to know the listing_id of the current category, therefore push it into state
|
|
1908
|
+
if (!this.listing_query_state_key) $52FdA$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
|
|
1909
|
+
new_state[this.listing_query_state_key] = listing_query_;
|
|
1910
|
+
}
|
|
1911
|
+
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
1912
|
+
} else $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_throwing_on_navigation, $73014ff36186a4dd$var$_throwing_on_navigation2).call(this, {
|
|
1913
|
+
is_replace: is_replace_,
|
|
1914
|
+
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
1915
|
+
scroll: scroll
|
|
1916
|
+
});
|
|
1917
|
+
await promise;
|
|
1918
|
+
})
|
|
1919
|
+
});
|
|
1920
|
+
this.listing_query_state_key = listing_query_state_key;
|
|
1921
|
+
this.on_navigation_ = on_navigation;
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
function $73014ff36186a4dd$var$_throwing_on_navigation2() {
|
|
1925
|
+
const {
|
|
1926
|
+
on_navigation_: on_navigation_
|
|
1927
|
+
} = this;
|
|
1928
|
+
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
1929
|
+
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
1930
|
+
try {
|
|
1931
|
+
return on_navigation_(...arguments);
|
|
1932
|
+
} catch (e) {
|
|
1933
|
+
queueMicrotask(() => {
|
|
1934
|
+
throw e;
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
function $73014ff36186a4dd$var$_get_navigation_happened_promise2(is_replace) {
|
|
1939
|
+
return new Promise(resolve => {
|
|
1940
|
+
const handler = what_happened => {
|
|
1941
|
+
if (what_happened === (is_replace ? "replaceState" : "pushState")) {
|
|
1942
|
+
resolve();
|
|
1943
|
+
(0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
(0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).add(handler);
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1797
1949
|
var $8446f782881fa12e$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="depict recommendations looks"style=--animation-duration:240ms>`);
|
|
1798
1950
|
let $8446f782881fa12e$var$expandedLooksSignal_;
|
|
1799
1951
|
function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
@@ -1802,6 +1954,7 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1802
1954
|
equals: false
|
|
1803
1955
|
}));
|
|
1804
1956
|
const expandingAnimationDuration = 240;
|
|
1957
|
+
const pseudoRouter = new (0, $73014ff36186a4dd$export$7e1297a3a19f10d8)("hard_navigation");
|
|
1805
1958
|
const grid_spacing_override = $52FdA$solidjs.createMemo(() => {
|
|
1806
1959
|
const {
|
|
1807
1960
|
gridSpacing_: gridSpacing_
|
|
@@ -1829,21 +1982,37 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1829
1982
|
});
|
|
1830
1983
|
const decoded = await (response === null || response === void 0 ? void 0 : (_json = (_ref2 = response).json) === null || _json === void 0 ? void 0 : _json.call(_ref2).catch(() => false));
|
|
1831
1984
|
if (!decoded)
|
|
1832
|
-
// If network fails, make sure to return empty array
|
|
1985
|
+
// If network fails, make sure to return empty array and SolidRecommendationSlider will remove its elements
|
|
1833
1986
|
return [];
|
|
1834
|
-
|
|
1987
|
+
const {
|
|
1988
|
+
listings: listings
|
|
1989
|
+
} = decoded;
|
|
1990
|
+
const baseData = {
|
|
1991
|
+
merchant: merchant,
|
|
1992
|
+
market: market,
|
|
1993
|
+
locale: locale
|
|
1994
|
+
};
|
|
1995
|
+
return $8446f782881fa12e$var$runDisplayTransformersForLooks(baseData, listings, props.displayTransformers_);
|
|
1996
|
+
});
|
|
1997
|
+
$52FdA$solidjs.createEffect(() => {
|
|
1998
|
+
const {
|
|
1999
|
+
onNavigation_: onNavigation_
|
|
2000
|
+
} = props;
|
|
2001
|
+
if (onNavigation_) pseudoRouter.on_navigation_ = onNavigation_;
|
|
1835
2002
|
});
|
|
1836
2003
|
return (() => {
|
|
1837
2004
|
var _el$ = $52FdA$solidjsweb.getNextElement($8446f782881fa12e$var$_tmpl$);
|
|
1838
2005
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
1839
2006
|
get children() {
|
|
1840
2007
|
return $236a257ee52e5414$export$d41d19e89346fa2({
|
|
1841
|
-
product_card_template_:
|
|
2008
|
+
product_card_template_: display => $47e3c3102c78121b$export$44809a8a3e867e30({
|
|
1842
2009
|
display_: display,
|
|
1843
2010
|
FavoriteButton_: props.FavoriteButton_,
|
|
1844
2011
|
placeholderImageAspectRatio_: props.imagePlaceholderAspectRatio_,
|
|
1845
2012
|
animationDuration_: expandingAnimationDuration,
|
|
1846
|
-
expandedLooksSignal_: $8446f782881fa12e$var$expandedLooksSignal_
|
|
2013
|
+
expandedLooksSignal_: $8446f782881fa12e$var$expandedLooksSignal_,
|
|
2014
|
+
priceFormatting_: () => props.priceFormatting_,
|
|
2015
|
+
pseudoRouter_: pseudoRouter
|
|
1847
2016
|
}),
|
|
1848
2017
|
recommendations_resource_: looksResource,
|
|
1849
2018
|
title_: () => props.title_,
|
|
@@ -1858,6 +2027,58 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1858
2027
|
})();
|
|
1859
2028
|
}, "LookSlider failed");
|
|
1860
2029
|
}
|
|
2030
|
+
async function $8446f782881fa12e$var$runDisplayTransformersForLooks(baseData, listings, displayTransformers) {
|
|
2031
|
+
try {
|
|
2032
|
+
const {
|
|
2033
|
+
products: productTransformer,
|
|
2034
|
+
categories: providedListingTransformer
|
|
2035
|
+
} = displayTransformers || {};
|
|
2036
|
+
if (!productTransformer && !providedListingTransformer) return listings;
|
|
2037
|
+
const listingTransformer = providedListingTransformer || (_ref3 => {
|
|
2038
|
+
let {
|
|
2039
|
+
data: data
|
|
2040
|
+
} = _ref3;
|
|
2041
|
+
return data;
|
|
2042
|
+
});
|
|
2043
|
+
const displaysToTransform = [];
|
|
2044
|
+
const displayIdsPerListingId = {};
|
|
2045
|
+
const transformedListingsPromise = listingTransformer({
|
|
2046
|
+
...baseData,
|
|
2047
|
+
data: listings.map(_ref4 => {
|
|
2048
|
+
let {
|
|
2049
|
+
displays: displays,
|
|
2050
|
+
...listing
|
|
2051
|
+
} = _ref4;
|
|
2052
|
+
// Populate our displays by id and displayIdToListings object in the .map where we add ancestors to the listings, for peak efficiency
|
|
2053
|
+
for (let i = 0; i < displays.length; i++) {
|
|
2054
|
+
var _listing$listing_id;
|
|
2055
|
+
const display = displays[i];
|
|
2056
|
+
const uniqueIdOfDisplay = $b85edfec41cd3989$export$548d053aba053d79(display);
|
|
2057
|
+
displaysToTransform.push(display);
|
|
2058
|
+
(displayIdsPerListingId[_listing$listing_id = listing.listing_id] || (displayIdsPerListingId[_listing$listing_id] = [])).push(uniqueIdOfDisplay);
|
|
2059
|
+
}
|
|
2060
|
+
return {
|
|
2061
|
+
...listing,
|
|
2062
|
+
ancestors: []
|
|
2063
|
+
};
|
|
2064
|
+
})
|
|
2065
|
+
});
|
|
2066
|
+
// This allows the person providing the displayTransformer to re-order and remove displays
|
|
2067
|
+
const transformedProducts = productTransformer ? await productTransformer({
|
|
2068
|
+
...baseData,
|
|
2069
|
+
displays: displaysToTransform
|
|
2070
|
+
}) : displaysToTransform;
|
|
2071
|
+
const transformedListings = await transformedListingsPromise;
|
|
2072
|
+
const transformedDisplayById = Object.fromEntries(transformedProducts.map(display => [$b85edfec41cd3989$export$548d053aba053d79(display), display]));
|
|
2073
|
+
return transformedListings.map(listing => $52FdA$solidjs.mergeProps(listing, {
|
|
2074
|
+
// use mergeProps because in preview browser we add getters in this object, that would be called too early otherwise
|
|
2075
|
+
displays: (displayIdsPerListingId[listing.listing_id] || []).map(displayId => transformedDisplayById[displayId]).filter(v => v)
|
|
2076
|
+
}));
|
|
2077
|
+
} catch (e) {
|
|
2078
|
+
$52FdA$depictaiutilishared.dwarn("Displaytransformers threw", e);
|
|
2079
|
+
return [];
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
1861
2082
|
const $cfcd56242923775d$export$3064e1e8c6513da3 = new Set();
|
|
1862
2083
|
let $cfcd56242923775d$var$has_ran = false;
|
|
1863
2084
|
function $cfcd56242923775d$export$5162a71f252e6122() {
|
|
@@ -1899,15 +2120,6 @@ function $cfcd56242923775d$var$starts_with_any_prefix(key) {
|
|
|
1899
2120
|
}
|
|
1900
2121
|
}
|
|
1901
2122
|
|
|
1902
|
-
/**
|
|
1903
|
-
* This function is used to determine if the user is trying to open a link in a new tab or window, and we therefore should not single page navigate
|
|
1904
|
-
* @param clickEvent The click event that triggered the navigation
|
|
1905
|
-
*/
|
|
1906
|
-
function $9ca08bcacbc598ce$export$29d28dadc2d6b631(clickEvent) {
|
|
1907
|
-
return (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.button) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.metaKey) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.ctrlKey) || (clickEvent === null || clickEvent === void 0 ? void 0 : clickEvent.shiftKey // if true, shift button on windows, linux or macOS which opens in a new window
|
|
1908
|
-
);
|
|
1909
|
-
}
|
|
1910
|
-
|
|
1911
2123
|
/**
|
|
1912
2124
|
* Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
|
|
1913
2125
|
*/
|
|
@@ -1948,12 +2160,6 @@ function $bdea39a75c454f4f$export$f50b88e2a00918b5(fn) {
|
|
|
1948
2160
|
}
|
|
1949
2161
|
};
|
|
1950
2162
|
}
|
|
1951
|
-
function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
|
|
1952
|
-
return $52FdA$solidjs.createMemo(() => {
|
|
1953
|
-
const price_formatting = props.price_formatting_;
|
|
1954
|
-
return $52FdA$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
1955
|
-
});
|
|
1956
|
-
}
|
|
1957
2163
|
function $b0f8d9f49e018db9$export$fb40a80c530e5f2b(selectedIndex, groupIndex, indexInGroup) {
|
|
1958
2164
|
const isSelected = $52FdA$solidjs.createMemo(() => {
|
|
1959
2165
|
const selectedValue = selectedIndex();
|
|
@@ -5288,120 +5494,6 @@ function $367b536a2a94d24e$var$history_state_change(signals, entries, state) {
|
|
|
5288
5494
|
}
|
|
5289
5495
|
});
|
|
5290
5496
|
}
|
|
5291
|
-
function $73014ff36186a4dd$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
5292
|
-
$73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
5293
|
-
privateSet.add(obj);
|
|
5294
|
-
}
|
|
5295
|
-
function $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
5296
|
-
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
5297
|
-
}
|
|
5298
|
-
function $73014ff36186a4dd$var$_classPrivateMethodGet(receiver, privateSet, fn) {
|
|
5299
|
-
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
5300
|
-
return fn;
|
|
5301
|
-
}
|
|
5302
|
-
var $73014ff36186a4dd$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
|
|
5303
|
-
var $73014ff36186a4dd$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
|
|
5304
|
-
class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
|
|
5305
|
-
/**
|
|
5306
|
-
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
5307
|
-
*/ /**
|
|
5308
|
-
* We store listing_id in history.state and do operate on this both here and in js-ui, this is the key to be used which js-ui provides
|
|
5309
|
-
*/ /**
|
|
5310
|
-
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
5311
|
-
* This standardises waiting for all kinds of routers
|
|
5312
|
-
*/
|
|
5313
|
-
constructor(on_navigation, listing_query_state_key) {
|
|
5314
|
-
$73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_get_navigation_happened_promise);
|
|
5315
|
-
$73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_throwing_on_navigation);
|
|
5316
|
-
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "on_navigation_", void 0);
|
|
5317
|
-
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "listing_query_state_key", void 0);
|
|
5318
|
-
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "navigate_", {
|
|
5319
|
-
/**
|
|
5320
|
-
* Call this if you *just* want to replace the state object in history.state
|
|
5321
|
-
*/
|
|
5322
|
-
replace_state_: new_state => {
|
|
5323
|
-
var _globalThis$history;
|
|
5324
|
-
// This doesn't break any router, so we just do this directly for now, since many don't expose an interface for changing the state
|
|
5325
|
-
globalThis === null || globalThis === void 0 || (_globalThis$history = globalThis.history) === null || _globalThis$history === void 0 || _globalThis$history.replaceState(new_state, "");
|
|
5326
|
-
},
|
|
5327
|
-
/**
|
|
5328
|
-
* Call this to change the URL
|
|
5329
|
-
* @param new_url_ new URL to go to
|
|
5330
|
-
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
5331
|
-
* @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
|
|
5332
|
-
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
5333
|
-
* @param listing_id_ If you are navigating to a category and know the listing_id of, please provide it. This is for making a better devEx in js-ui
|
|
5334
|
-
*/
|
|
5335
|
-
go_to_: $52FdA$depictaiutilishared.catchify(async _ref => {
|
|
5336
|
-
let {
|
|
5337
|
-
new_url_: raw_new_url,
|
|
5338
|
-
event_: event_,
|
|
5339
|
-
force_spa_navigation_: force_spa_navigation_,
|
|
5340
|
-
is_replace_: is_replace_,
|
|
5341
|
-
listing_query_: listing_query_,
|
|
5342
|
-
scroll = true
|
|
5343
|
-
} = _ref;
|
|
5344
|
-
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
5345
|
-
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
5346
|
-
if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(event_)) return;
|
|
5347
|
-
const different_origin = new_url_.origin !== location.origin;
|
|
5348
|
-
if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
|
|
5349
|
-
if (force_spa_navigation_ && different_origin)
|
|
5350
|
-
// If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
|
|
5351
|
-
$52FdA$depictaiutilishared.dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
|
|
5352
|
-
if (!event_)
|
|
5353
|
-
// If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
5354
|
-
location.assign(new_url_);
|
|
5355
|
-
return;
|
|
5356
|
-
}
|
|
5357
|
-
event_ === null || event_ === void 0 || event_.preventDefault();
|
|
5358
|
-
const promise = $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_get_navigation_happened_promise, $73014ff36186a4dd$var$_get_navigation_happened_promise2).call(this, true);
|
|
5359
|
-
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
5360
|
-
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
5361
|
-
const new_state = history.state;
|
|
5362
|
-
if (listing_query_) {
|
|
5363
|
-
// In JS-UI we need to know the listing_id of the current category, therefore push it into state
|
|
5364
|
-
if (!this.listing_query_state_key) $52FdA$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
|
|
5365
|
-
new_state[this.listing_query_state_key] = listing_query_;
|
|
5366
|
-
}
|
|
5367
|
-
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
5368
|
-
} else $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_throwing_on_navigation, $73014ff36186a4dd$var$_throwing_on_navigation2).call(this, {
|
|
5369
|
-
is_replace: is_replace_,
|
|
5370
|
-
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
5371
|
-
scroll: scroll
|
|
5372
|
-
});
|
|
5373
|
-
await promise;
|
|
5374
|
-
})
|
|
5375
|
-
});
|
|
5376
|
-
this.listing_query_state_key = listing_query_state_key;
|
|
5377
|
-
this.on_navigation_ = on_navigation;
|
|
5378
|
-
}
|
|
5379
|
-
}
|
|
5380
|
-
function $73014ff36186a4dd$var$_throwing_on_navigation2() {
|
|
5381
|
-
const {
|
|
5382
|
-
on_navigation_: on_navigation_
|
|
5383
|
-
} = this;
|
|
5384
|
-
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
5385
|
-
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
5386
|
-
try {
|
|
5387
|
-
return on_navigation_(...arguments);
|
|
5388
|
-
} catch (e) {
|
|
5389
|
-
queueMicrotask(() => {
|
|
5390
|
-
throw e;
|
|
5391
|
-
});
|
|
5392
|
-
}
|
|
5393
|
-
}
|
|
5394
|
-
function $73014ff36186a4dd$var$_get_navigation_happened_promise2(is_replace) {
|
|
5395
|
-
return new Promise(resolve => {
|
|
5396
|
-
const handler = what_happened => {
|
|
5397
|
-
if (what_happened === (is_replace ? "replaceState" : "pushState")) {
|
|
5398
|
-
resolve();
|
|
5399
|
-
(0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
|
|
5400
|
-
}
|
|
5401
|
-
};
|
|
5402
|
-
(0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).add(handler);
|
|
5403
|
-
});
|
|
5404
|
-
}
|
|
5405
5497
|
var $c8e3c11062d8380b$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=image-container>`);
|
|
5406
5498
|
function $c8e3c11062d8380b$export$41e1a079d40a0d58(props) {
|
|
5407
5499
|
const [display] = $52FdA$solidjs.createResource(() => ({
|