@depict-ai/ui 4.3.1 → 4.3.3
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 +327 -203
- package/ES10/index.d.ts +242 -235
- package/ES10/index.js +361 -237
- package/latest/index.cjs +307 -188
- package/latest/index.d.ts +242 -235
- package/latest/index.js +341 -222
- package/package.json +2 -2
- package/server/ES10/index.cjs +312 -197
- package/server/ES10/index.d.ts +242 -235
- package/server/ES10/index.js +352 -237
- package/server/latest/index.cjs +290 -180
- package/server/latest/index.d.ts +242 -235
- package/server/latest/index.js +330 -220
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.3";
|
|
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,6 +1346,12 @@ function $f3db423dc84bc35d$export$9d4a4b669b1929ab(props) {
|
|
|
1363
1346
|
}
|
|
1364
1347
|
}));
|
|
1365
1348
|
}
|
|
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
|
+
}
|
|
1366
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><!$><!/>`),
|
|
@@ -1371,10 +1360,12 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1371
1360
|
let {
|
|
1372
1361
|
display_: display_,
|
|
1373
1362
|
FavoriteButton_: FavoriteButton_,
|
|
1374
|
-
|
|
1363
|
+
userWantsExpandedSignal_: [userWantsExpanded, setUserWantsExpanded],
|
|
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_();
|
|
@@ -1385,7 +1376,7 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1385
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];
|
|
1386
1377
|
});
|
|
1387
1378
|
const [animationIsRunning, setAnimationIsRunning] = textFadeInAnimationRunning_;
|
|
1388
|
-
const [isExpandedThrottledByOurEffectRun, setIsExpandedThrottledByOurEffectRun] = $52FdA$solidjs.createSignal($52FdA$solidjs.untrack(
|
|
1379
|
+
const [isExpandedThrottledByOurEffectRun, setIsExpandedThrottledByOurEffectRun] = $52FdA$solidjs.createSignal($52FdA$solidjs.untrack(userWantsExpanded));
|
|
1389
1380
|
const [animationEffectExists, setAnimationEffectExists] = $52FdA$solidjs.createSignal(false);
|
|
1390
1381
|
const [salePrice] = $52FdA$solidjs.createResource(() => {
|
|
1391
1382
|
var _variantToUse2;
|
|
@@ -1395,7 +1386,12 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1395
1386
|
var _variantToUse3;
|
|
1396
1387
|
return (_variantToUse3 = variantToUse()) === null || _variantToUse3 === void 0 ? void 0 : _variantToUse3.original_price;
|
|
1397
1388
|
});
|
|
1398
|
-
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(() => userWantsExpanded() && !animationIsRunning());
|
|
1391
|
+
const href = $52FdA$solidjs.createMemo(() => {
|
|
1392
|
+
var _variantToUse4;
|
|
1393
|
+
return (_variantToUse4 = variantToUse()) === null || _variantToUse4 === void 0 ? void 0 : _variantToUse4.page_url;
|
|
1394
|
+
});
|
|
1399
1395
|
const FavoriteButton = FavoriteButton_; // Just to get rid of the type error - TS doesn't understand <Show>
|
|
1400
1396
|
return (() => {
|
|
1401
1397
|
var _el$ = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$4),
|
|
@@ -1405,11 +1401,23 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1405
1401
|
[_el$15, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$14.nextSibling);
|
|
1406
1402
|
var _ref$ = outerRef_;
|
|
1407
1403
|
typeof _ref$ === "function" ? $52FdA$solidjsweb.use(_ref$, _el$) : outerRef_ = _el$;
|
|
1408
|
-
$52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => {
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1404
|
+
$52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(() => enableLink() ? {
|
|
1405
|
+
href: href()
|
|
1406
|
+
} : {}, {
|
|
1407
|
+
get onClick() {
|
|
1408
|
+
return $52FdA$depictaiutilishared.catchify(event_ => {
|
|
1409
|
+
if (enableLink()) {
|
|
1410
|
+
pseudoRouter_.navigate_.go_to_({
|
|
1411
|
+
new_url_: href(),
|
|
1412
|
+
is_replace_: false,
|
|
1413
|
+
event_: event_
|
|
1414
|
+
});
|
|
1415
|
+
if (event_.defaultPrevented)
|
|
1416
|
+
// We single-page-navigated in this tab, close the look
|
|
1417
|
+
setUserWantsExpanded(false);
|
|
1418
|
+
}
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1413
1421
|
}), false, true);
|
|
1414
1422
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1415
1423
|
when: imageUrl,
|
|
@@ -1435,10 +1443,13 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1435
1443
|
return imageUrl();
|
|
1436
1444
|
},
|
|
1437
1445
|
get aspectRatio() {
|
|
1438
|
-
return
|
|
1446
|
+
return userWantsExpanded() ? 0.75 : 1;
|
|
1439
1447
|
},
|
|
1440
1448
|
get autoAdjustAspectRatio() {
|
|
1441
|
-
return
|
|
1449
|
+
return userWantsExpanded();
|
|
1450
|
+
},
|
|
1451
|
+
imgProps: {
|
|
1452
|
+
keyRatioUpdating: true
|
|
1442
1453
|
}
|
|
1443
1454
|
});
|
|
1444
1455
|
}
|
|
@@ -1448,7 +1459,7 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1448
1459
|
}), _el$13, _co$3);
|
|
1449
1460
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1450
1461
|
get when() {
|
|
1451
|
-
return (animationEffectExists() ? isExpandedThrottledByOurEffectRun() :
|
|
1462
|
+
return (animationEffectExists() ? isExpandedThrottledByOurEffectRun() : userWantsExpanded()) || animationIsRunning();
|
|
1452
1463
|
},
|
|
1453
1464
|
get children() {
|
|
1454
1465
|
var _el$3 = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$3),
|
|
@@ -1476,7 +1487,7 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1476
1487
|
setAnimationIsRunning(true);
|
|
1477
1488
|
$52FdA$solidjs.runWithOwner(owner, () => {
|
|
1478
1489
|
$52FdA$solidjs.createRenderEffect(() => {
|
|
1479
|
-
const expanded =
|
|
1490
|
+
const expanded = userWantsExpanded();
|
|
1480
1491
|
// Still glitches in chrome (probably not fixable) and sometimes the timing is off in Safari but fuck it, I couldn't massage the WAAPI to improve it in any way (without reading computed style) to make the reversing of animations glitch less
|
|
1481
1492
|
textContainerAnimation.pause();
|
|
1482
1493
|
textContainerAnimation.updatePlaybackRate(expanded ? 1 : -1);
|
|
@@ -1499,26 +1510,68 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1499
1510
|
width: "20ch"
|
|
1500
1511
|
});
|
|
1501
1512
|
});
|
|
1502
|
-
$52FdA$solidjsweb.insert(_el$6, (()
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1513
|
+
$52FdA$solidjsweb.insert(_el$6, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1514
|
+
get when() {
|
|
1515
|
+
return variantToUse() && !salePrice.loading;
|
|
1516
|
+
},
|
|
1517
|
+
get fallback() {
|
|
1518
|
+
return $52FdA$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
|
|
1519
|
+
height: "1em",
|
|
1520
|
+
width: "20ch"
|
|
1521
|
+
});
|
|
1522
|
+
},
|
|
1523
|
+
get children() {
|
|
1524
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1525
|
+
get when() {
|
|
1526
|
+
return salePrice.latest;
|
|
1527
|
+
},
|
|
1528
|
+
get children() {
|
|
1529
|
+
return [$52FdA$solidjsweb.memo(() => priceFormatting_().pre_), $52FdA$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
|
|
1530
|
+
get price_() {
|
|
1531
|
+
return salePrice();
|
|
1532
|
+
},
|
|
1533
|
+
get price_formatting_() {
|
|
1534
|
+
return priceFormatting_();
|
|
1535
|
+
}
|
|
1536
|
+
}), $52FdA$solidjsweb.memo(() => priceFormatting_().post_)];
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
}
|
|
1540
|
+
}));
|
|
1509
1541
|
$52FdA$solidjsweb.insert(_el$4, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1510
1542
|
get when() {
|
|
1511
1543
|
return isOnSale();
|
|
1512
1544
|
},
|
|
1513
1545
|
get children() {
|
|
1514
1546
|
var _el$7 = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$2);
|
|
1515
|
-
$52FdA$solidjsweb.insert(_el$7, (()
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1547
|
+
$52FdA$solidjsweb.insert(_el$7, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1548
|
+
get when() {
|
|
1549
|
+
return variantToUse() && !originalPrice.loading;
|
|
1550
|
+
},
|
|
1551
|
+
get fallback() {
|
|
1552
|
+
return $52FdA$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
|
|
1553
|
+
height: "1em",
|
|
1554
|
+
width: "20ch"
|
|
1555
|
+
});
|
|
1556
|
+
},
|
|
1557
|
+
get children() {
|
|
1558
|
+
return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1559
|
+
get when() {
|
|
1560
|
+
return salePrice.latest;
|
|
1561
|
+
},
|
|
1562
|
+
get children() {
|
|
1563
|
+
return [$52FdA$solidjsweb.memo(() => priceFormatting_().pre_), $52FdA$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
|
|
1564
|
+
get price_() {
|
|
1565
|
+
return originalPrice();
|
|
1566
|
+
},
|
|
1567
|
+
get price_formatting_() {
|
|
1568
|
+
return priceFormatting_();
|
|
1569
|
+
}
|
|
1570
|
+
}), $52FdA$solidjsweb.memo(() => priceFormatting_().post_)];
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
}));
|
|
1522
1575
|
return _el$7;
|
|
1523
1576
|
}
|
|
1524
1577
|
}), _el$9, _co$);
|
|
@@ -1593,10 +1646,12 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1593
1646
|
let {
|
|
1594
1647
|
displays_: displays_,
|
|
1595
1648
|
FavoriteButton_: FavoriteButton_,
|
|
1596
|
-
userWantsExpandedSignal_:
|
|
1649
|
+
userWantsExpandedSignal_: userWantsExpandedSignal_,
|
|
1597
1650
|
containerWidth_: containerWidth_,
|
|
1598
1651
|
animationDuration_: animationDuration_,
|
|
1599
|
-
supportsHover_: supportsHover_
|
|
1652
|
+
supportsHover_: supportsHover_,
|
|
1653
|
+
priceFormatting_: priceFormatting_,
|
|
1654
|
+
pseudoRouter_: pseudoRouter_
|
|
1600
1655
|
} = _ref;
|
|
1601
1656
|
let isAffectedByChromeBug = false;
|
|
1602
1657
|
// If the user requests the drawer to be expanded or not
|
|
@@ -1605,6 +1660,7 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1605
1660
|
// The following three signals just contain the state if the animations are actually running and should only be set by the respective animation code
|
|
1606
1661
|
const textFadeInAnimationRunning = $52FdA$solidjs.createSignal(false);
|
|
1607
1662
|
const [getSecondPartAnimationRunning] = textFadeInAnimationRunning;
|
|
1663
|
+
const [userWantsExpanded, setUserWantsExpanded] = userWantsExpandedSignal_;
|
|
1608
1664
|
$dfa95866b27a2a53$export$7b9a0e99f0aeb2f3().then(is => isAffectedByChromeBug = is);
|
|
1609
1665
|
return $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
1610
1666
|
get children() {
|
|
@@ -1650,11 +1706,13 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1650
1706
|
},
|
|
1651
1707
|
children: (display, index) => {
|
|
1652
1708
|
return $52FdA$solidjsweb.createComponent((0, $d66c35b5a6d6d926$export$b73ed90f0ee50dc3), {
|
|
1709
|
+
pseudoRouter_: pseudoRouter_,
|
|
1653
1710
|
animationDuration_: animationDuration_,
|
|
1654
1711
|
display_: display,
|
|
1655
1712
|
FavoriteButton_: FavoriteButton_,
|
|
1656
|
-
|
|
1713
|
+
userWantsExpandedSignal_: userWantsExpandedSignal_,
|
|
1657
1714
|
textFadeInAnimationRunning_: textFadeInAnimationRunning,
|
|
1715
|
+
priceFormatting_: priceFormatting_,
|
|
1658
1716
|
outerRef_: el => $52FdA$solidjs.createEffect(() => {
|
|
1659
1717
|
if (index !== 0) return;
|
|
1660
1718
|
const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => setLookItemHeight(records.at(-1).contentRect.height)));
|
|
@@ -1698,10 +1756,10 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1698
1756
|
expandedLooksSignal_: [expandedLooks_, setExpandedLooks],
|
|
1699
1757
|
FavoriteButton_: FavoriteButton_,
|
|
1700
1758
|
placeholderImageAspectRatio_: placeholderImageAspectRatio_,
|
|
1701
|
-
animationDuration_: animationDuration_
|
|
1759
|
+
animationDuration_: animationDuration_,
|
|
1760
|
+
priceFormatting_: priceFormatting_,
|
|
1761
|
+
pseudoRouter_: pseudoRouter_
|
|
1702
1762
|
} = _ref;
|
|
1703
|
-
// TODO: shopify, run displayTransformers to get dynamic prices
|
|
1704
|
-
// TODO: format prices
|
|
1705
1763
|
const [coverImage] = (display_ === null || display_ === void 0 ? void 0 : display_.image_urls) || [];
|
|
1706
1764
|
const useWantsExpandedSignal_ = $52FdA$solidjs.createSignal(false);
|
|
1707
1765
|
const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
|
|
@@ -1747,7 +1805,7 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1747
1805
|
when: display_,
|
|
1748
1806
|
get fallback() {
|
|
1749
1807
|
return $52FdA$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
|
|
1750
|
-
aspectRatio: placeholderImageAspectRatio_
|
|
1808
|
+
aspectRatio: "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(placeholderImageAspectRatio_, ")")
|
|
1751
1809
|
});
|
|
1752
1810
|
},
|
|
1753
1811
|
get children() {
|
|
@@ -1765,11 +1823,137 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1765
1823
|
containerWidth_: containerWidth_,
|
|
1766
1824
|
animationDuration_: animationDuration_,
|
|
1767
1825
|
supportsHover_: supportsHover_,
|
|
1768
|
-
FavoriteButton_: FavoriteButton_
|
|
1826
|
+
FavoriteButton_: FavoriteButton_,
|
|
1827
|
+
priceFormatting_: priceFormatting_,
|
|
1828
|
+
pseudoRouter_: pseudoRouter_
|
|
1769
1829
|
})]);
|
|
1770
1830
|
return container;
|
|
1771
1831
|
}
|
|
1772
1832
|
$52FdA$solidjsweb.delegateEvents(["click"]);
|
|
1833
|
+
|
|
1834
|
+
/**
|
|
1835
|
+
* 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
|
|
1836
|
+
* @param clickEvent The click event that triggered the navigation
|
|
1837
|
+
*/
|
|
1838
|
+
function $9ca08bcacbc598ce$export$29d28dadc2d6b631(clickEvent) {
|
|
1839
|
+
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
|
|
1840
|
+
);
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
function $73014ff36186a4dd$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
1844
|
+
$73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
1845
|
+
privateSet.add(obj);
|
|
1846
|
+
}
|
|
1847
|
+
function $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
1848
|
+
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
1849
|
+
}
|
|
1850
|
+
function $73014ff36186a4dd$var$_classPrivateMethodGet(receiver, privateSet, fn) {
|
|
1851
|
+
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
1852
|
+
return fn;
|
|
1853
|
+
}
|
|
1854
|
+
var $73014ff36186a4dd$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
|
|
1855
|
+
var $73014ff36186a4dd$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
|
|
1856
|
+
class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
|
|
1857
|
+
/**
|
|
1858
|
+
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
1859
|
+
*/ /**
|
|
1860
|
+
* 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
|
|
1861
|
+
*/ /**
|
|
1862
|
+
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
1863
|
+
* This standardises waiting for all kinds of routers
|
|
1864
|
+
*/
|
|
1865
|
+
constructor(on_navigation, listing_query_state_key) {
|
|
1866
|
+
$73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_get_navigation_happened_promise);
|
|
1867
|
+
$73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_throwing_on_navigation);
|
|
1868
|
+
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "on_navigation_", void 0);
|
|
1869
|
+
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "listing_query_state_key", void 0);
|
|
1870
|
+
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "navigate_", {
|
|
1871
|
+
/**
|
|
1872
|
+
* Call this if you *just* want to replace the state object in history.state
|
|
1873
|
+
*/
|
|
1874
|
+
replace_state_: new_state => {
|
|
1875
|
+
var _globalThis$history;
|
|
1876
|
+
// 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
|
|
1877
|
+
globalThis === null || globalThis === void 0 || (_globalThis$history = globalThis.history) === null || _globalThis$history === void 0 || _globalThis$history.replaceState(new_state, "");
|
|
1878
|
+
},
|
|
1879
|
+
/**
|
|
1880
|
+
* Call this to change the URL
|
|
1881
|
+
* @param new_url_ new URL to go to
|
|
1882
|
+
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
1883
|
+
* @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
|
|
1884
|
+
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
1885
|
+
* @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
|
|
1886
|
+
*/
|
|
1887
|
+
go_to_: $52FdA$depictaiutilishared.catchify(async _ref => {
|
|
1888
|
+
let {
|
|
1889
|
+
new_url_: raw_new_url,
|
|
1890
|
+
event_: event_,
|
|
1891
|
+
force_spa_navigation_: force_spa_navigation_,
|
|
1892
|
+
is_replace_: is_replace_,
|
|
1893
|
+
listing_query_: listing_query_,
|
|
1894
|
+
scroll = true
|
|
1895
|
+
} = _ref;
|
|
1896
|
+
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
1897
|
+
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
1898
|
+
if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(event_)) return;
|
|
1899
|
+
const different_origin = new_url_.origin !== location.origin;
|
|
1900
|
+
if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
|
|
1901
|
+
if (force_spa_navigation_ && different_origin)
|
|
1902
|
+
// If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
|
|
1903
|
+
$52FdA$depictaiutilishared.dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
|
|
1904
|
+
if (!event_)
|
|
1905
|
+
// If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
1906
|
+
location.assign(new_url_);
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
event_ === null || event_ === void 0 || event_.preventDefault();
|
|
1910
|
+
const promise = $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_get_navigation_happened_promise, $73014ff36186a4dd$var$_get_navigation_happened_promise2).call(this, true);
|
|
1911
|
+
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
1912
|
+
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
1913
|
+
const new_state = history.state;
|
|
1914
|
+
if (listing_query_) {
|
|
1915
|
+
// In JS-UI we need to know the listing_id of the current category, therefore push it into state
|
|
1916
|
+
if (!this.listing_query_state_key) $52FdA$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
|
|
1917
|
+
new_state[this.listing_query_state_key] = listing_query_;
|
|
1918
|
+
}
|
|
1919
|
+
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
1920
|
+
} else $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_throwing_on_navigation, $73014ff36186a4dd$var$_throwing_on_navigation2).call(this, {
|
|
1921
|
+
is_replace: is_replace_,
|
|
1922
|
+
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
1923
|
+
scroll: scroll
|
|
1924
|
+
});
|
|
1925
|
+
await promise;
|
|
1926
|
+
})
|
|
1927
|
+
});
|
|
1928
|
+
this.listing_query_state_key = listing_query_state_key;
|
|
1929
|
+
this.on_navigation_ = on_navigation;
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
function $73014ff36186a4dd$var$_throwing_on_navigation2() {
|
|
1933
|
+
const {
|
|
1934
|
+
on_navigation_: on_navigation_
|
|
1935
|
+
} = this;
|
|
1936
|
+
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
1937
|
+
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
1938
|
+
try {
|
|
1939
|
+
return on_navigation_(...arguments);
|
|
1940
|
+
} catch (e) {
|
|
1941
|
+
queueMicrotask(() => {
|
|
1942
|
+
throw e;
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
function $73014ff36186a4dd$var$_get_navigation_happened_promise2(is_replace) {
|
|
1947
|
+
return new Promise(resolve => {
|
|
1948
|
+
const handler = what_happened => {
|
|
1949
|
+
if (what_happened === (is_replace ? "replaceState" : "pushState")) {
|
|
1950
|
+
resolve();
|
|
1951
|
+
(0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
|
|
1952
|
+
}
|
|
1953
|
+
};
|
|
1954
|
+
(0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).add(handler);
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1773
1957
|
var $8446f782881fa12e$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="depict recommendations looks"style=--animation-duration:240ms>`);
|
|
1774
1958
|
let $8446f782881fa12e$var$expandedLooksSignal_;
|
|
1775
1959
|
function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
@@ -1778,6 +1962,7 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1778
1962
|
equals: false
|
|
1779
1963
|
}));
|
|
1780
1964
|
const expandingAnimationDuration = 240;
|
|
1965
|
+
const pseudoRouter = new (0, $73014ff36186a4dd$export$7e1297a3a19f10d8)("hard_navigation");
|
|
1781
1966
|
const grid_spacing_override = $52FdA$solidjs.createMemo(() => {
|
|
1782
1967
|
const {
|
|
1783
1968
|
gridSpacing_: gridSpacing_
|
|
@@ -1805,21 +1990,37 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1805
1990
|
});
|
|
1806
1991
|
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));
|
|
1807
1992
|
if (!decoded)
|
|
1808
|
-
// If network fails, make sure to return empty array
|
|
1993
|
+
// If network fails, make sure to return empty array and SolidRecommendationSlider will remove its elements
|
|
1809
1994
|
return [];
|
|
1810
|
-
|
|
1995
|
+
const {
|
|
1996
|
+
listings: listings
|
|
1997
|
+
} = decoded;
|
|
1998
|
+
const baseData = {
|
|
1999
|
+
merchant: merchant,
|
|
2000
|
+
market: market,
|
|
2001
|
+
locale: locale
|
|
2002
|
+
};
|
|
2003
|
+
return $8446f782881fa12e$var$runDisplayTransformersForLooks(baseData, listings, props.displayTransformers_);
|
|
2004
|
+
});
|
|
2005
|
+
$52FdA$solidjs.createEffect(() => {
|
|
2006
|
+
const {
|
|
2007
|
+
onNavigation_: onNavigation_
|
|
2008
|
+
} = props;
|
|
2009
|
+
if (onNavigation_) pseudoRouter.on_navigation_ = onNavigation_;
|
|
1811
2010
|
});
|
|
1812
2011
|
return (() => {
|
|
1813
2012
|
var _el$ = $52FdA$solidjsweb.getNextElement($8446f782881fa12e$var$_tmpl$);
|
|
1814
2013
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
1815
2014
|
get children() {
|
|
1816
2015
|
return $236a257ee52e5414$export$d41d19e89346fa2({
|
|
1817
|
-
product_card_template_:
|
|
2016
|
+
product_card_template_: display => $47e3c3102c78121b$export$44809a8a3e867e30({
|
|
1818
2017
|
display_: display,
|
|
1819
2018
|
FavoriteButton_: props.FavoriteButton_,
|
|
1820
2019
|
placeholderImageAspectRatio_: props.imagePlaceholderAspectRatio_,
|
|
1821
2020
|
animationDuration_: expandingAnimationDuration,
|
|
1822
|
-
expandedLooksSignal_: $8446f782881fa12e$var$expandedLooksSignal_
|
|
2021
|
+
expandedLooksSignal_: $8446f782881fa12e$var$expandedLooksSignal_,
|
|
2022
|
+
priceFormatting_: () => props.priceFormatting_,
|
|
2023
|
+
pseudoRouter_: pseudoRouter
|
|
1823
2024
|
}),
|
|
1824
2025
|
recommendations_resource_: looksResource,
|
|
1825
2026
|
title_: () => props.title_,
|
|
@@ -1834,6 +2035,58 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1834
2035
|
})();
|
|
1835
2036
|
}, "LookSlider failed");
|
|
1836
2037
|
}
|
|
2038
|
+
async function $8446f782881fa12e$var$runDisplayTransformersForLooks(baseData, listings, displayTransformers) {
|
|
2039
|
+
try {
|
|
2040
|
+
const {
|
|
2041
|
+
products: productTransformer,
|
|
2042
|
+
categories: providedListingTransformer
|
|
2043
|
+
} = displayTransformers || {};
|
|
2044
|
+
if (!productTransformer && !providedListingTransformer) return listings;
|
|
2045
|
+
const listingTransformer = providedListingTransformer || (_ref3 => {
|
|
2046
|
+
let {
|
|
2047
|
+
data: data
|
|
2048
|
+
} = _ref3;
|
|
2049
|
+
return data;
|
|
2050
|
+
});
|
|
2051
|
+
const displaysToTransform = [];
|
|
2052
|
+
const displayIdsPerListingId = {};
|
|
2053
|
+
const transformedListingsPromise = listingTransformer({
|
|
2054
|
+
...baseData,
|
|
2055
|
+
data: listings.map(_ref4 => {
|
|
2056
|
+
let {
|
|
2057
|
+
displays: displays,
|
|
2058
|
+
...listing
|
|
2059
|
+
} = _ref4;
|
|
2060
|
+
// Populate our displays by id and displayIdToListings object in the .map where we add ancestors to the listings, for peak efficiency
|
|
2061
|
+
for (let i = 0; i < displays.length; i++) {
|
|
2062
|
+
var _listing$listing_id;
|
|
2063
|
+
const display = displays[i];
|
|
2064
|
+
const uniqueIdOfDisplay = $b85edfec41cd3989$export$548d053aba053d79(display);
|
|
2065
|
+
displaysToTransform.push(display);
|
|
2066
|
+
(displayIdsPerListingId[_listing$listing_id = listing.listing_id] || (displayIdsPerListingId[_listing$listing_id] = [])).push(uniqueIdOfDisplay);
|
|
2067
|
+
}
|
|
2068
|
+
return {
|
|
2069
|
+
...listing,
|
|
2070
|
+
ancestors: []
|
|
2071
|
+
};
|
|
2072
|
+
})
|
|
2073
|
+
});
|
|
2074
|
+
// This allows the person providing the displayTransformer to re-order and remove displays
|
|
2075
|
+
const transformedProducts = productTransformer ? await productTransformer({
|
|
2076
|
+
...baseData,
|
|
2077
|
+
displays: displaysToTransform
|
|
2078
|
+
}) : displaysToTransform;
|
|
2079
|
+
const transformedListings = await transformedListingsPromise;
|
|
2080
|
+
const transformedDisplayById = Object.fromEntries(transformedProducts.map(display => [$b85edfec41cd3989$export$548d053aba053d79(display), display]));
|
|
2081
|
+
return transformedListings.map(listing => $52FdA$solidjs.mergeProps(listing, {
|
|
2082
|
+
// use mergeProps because in preview browser we add getters in this object, that would be called too early otherwise
|
|
2083
|
+
displays: (displayIdsPerListingId[listing.listing_id] || []).map(displayId => transformedDisplayById[displayId]).filter(v => v)
|
|
2084
|
+
}));
|
|
2085
|
+
} catch (e) {
|
|
2086
|
+
$52FdA$depictaiutilishared.dwarn("Displaytransformers threw", e);
|
|
2087
|
+
return [];
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
1837
2090
|
const $cfcd56242923775d$export$3064e1e8c6513da3 = new Set();
|
|
1838
2091
|
let $cfcd56242923775d$var$has_ran = false;
|
|
1839
2092
|
function $cfcd56242923775d$export$5162a71f252e6122() {
|
|
@@ -1875,15 +2128,6 @@ function $cfcd56242923775d$var$starts_with_any_prefix(key) {
|
|
|
1875
2128
|
}
|
|
1876
2129
|
}
|
|
1877
2130
|
|
|
1878
|
-
/**
|
|
1879
|
-
* 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
|
|
1880
|
-
* @param clickEvent The click event that triggered the navigation
|
|
1881
|
-
*/
|
|
1882
|
-
function $9ca08bcacbc598ce$export$29d28dadc2d6b631(clickEvent) {
|
|
1883
|
-
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
|
|
1884
|
-
);
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
2131
|
/**
|
|
1888
2132
|
* Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
|
|
1889
2133
|
*/
|
|
@@ -1924,12 +2168,6 @@ function $bdea39a75c454f4f$export$f50b88e2a00918b5(fn) {
|
|
|
1924
2168
|
}
|
|
1925
2169
|
};
|
|
1926
2170
|
}
|
|
1927
|
-
function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
|
|
1928
|
-
return $52FdA$solidjs.createMemo(() => {
|
|
1929
|
-
const price_formatting = props.price_formatting_;
|
|
1930
|
-
return $52FdA$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
1931
|
-
});
|
|
1932
|
-
}
|
|
1933
2171
|
function $b0f8d9f49e018db9$export$fb40a80c530e5f2b(selectedIndex, groupIndex, indexInGroup) {
|
|
1934
2172
|
const isSelected = $52FdA$solidjs.createMemo(() => {
|
|
1935
2173
|
const selectedValue = selectedIndex();
|
|
@@ -5264,120 +5502,6 @@ function $367b536a2a94d24e$var$history_state_change(signals, entries, state) {
|
|
|
5264
5502
|
}
|
|
5265
5503
|
});
|
|
5266
5504
|
}
|
|
5267
|
-
function $73014ff36186a4dd$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
5268
|
-
$73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
5269
|
-
privateSet.add(obj);
|
|
5270
|
-
}
|
|
5271
|
-
function $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
5272
|
-
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
5273
|
-
}
|
|
5274
|
-
function $73014ff36186a4dd$var$_classPrivateMethodGet(receiver, privateSet, fn) {
|
|
5275
|
-
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
5276
|
-
return fn;
|
|
5277
|
-
}
|
|
5278
|
-
var $73014ff36186a4dd$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
|
|
5279
|
-
var $73014ff36186a4dd$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
|
|
5280
|
-
class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
|
|
5281
|
-
/**
|
|
5282
|
-
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
5283
|
-
*/ /**
|
|
5284
|
-
* 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
|
|
5285
|
-
*/ /**
|
|
5286
|
-
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
5287
|
-
* This standardises waiting for all kinds of routers
|
|
5288
|
-
*/
|
|
5289
|
-
constructor(on_navigation, listing_query_state_key) {
|
|
5290
|
-
$73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_get_navigation_happened_promise);
|
|
5291
|
-
$73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_throwing_on_navigation);
|
|
5292
|
-
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "on_navigation_", void 0);
|
|
5293
|
-
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "listing_query_state_key", void 0);
|
|
5294
|
-
$parcel$interopDefault($52FdA$babelruntimehelpersdefineProperty)(this, "navigate_", {
|
|
5295
|
-
/**
|
|
5296
|
-
* Call this if you *just* want to replace the state object in history.state
|
|
5297
|
-
*/
|
|
5298
|
-
replace_state_: new_state => {
|
|
5299
|
-
var _globalThis$history;
|
|
5300
|
-
// 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
|
|
5301
|
-
globalThis === null || globalThis === void 0 || (_globalThis$history = globalThis.history) === null || _globalThis$history === void 0 || _globalThis$history.replaceState(new_state, "");
|
|
5302
|
-
},
|
|
5303
|
-
/**
|
|
5304
|
-
* Call this to change the URL
|
|
5305
|
-
* @param new_url_ new URL to go to
|
|
5306
|
-
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
5307
|
-
* @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
|
|
5308
|
-
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
5309
|
-
* @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
|
|
5310
|
-
*/
|
|
5311
|
-
go_to_: $52FdA$depictaiutilishared.catchify(async _ref => {
|
|
5312
|
-
let {
|
|
5313
|
-
new_url_: raw_new_url,
|
|
5314
|
-
event_: event_,
|
|
5315
|
-
force_spa_navigation_: force_spa_navigation_,
|
|
5316
|
-
is_replace_: is_replace_,
|
|
5317
|
-
listing_query_: listing_query_,
|
|
5318
|
-
scroll = true
|
|
5319
|
-
} = _ref;
|
|
5320
|
-
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
5321
|
-
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
5322
|
-
if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(event_)) return;
|
|
5323
|
-
const different_origin = new_url_.origin !== location.origin;
|
|
5324
|
-
if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
|
|
5325
|
-
if (force_spa_navigation_ && different_origin)
|
|
5326
|
-
// If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
|
|
5327
|
-
$52FdA$depictaiutilishared.dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
|
|
5328
|
-
if (!event_)
|
|
5329
|
-
// If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
5330
|
-
location.assign(new_url_);
|
|
5331
|
-
return;
|
|
5332
|
-
}
|
|
5333
|
-
event_ === null || event_ === void 0 || event_.preventDefault();
|
|
5334
|
-
const promise = $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_get_navigation_happened_promise, $73014ff36186a4dd$var$_get_navigation_happened_promise2).call(this, true);
|
|
5335
|
-
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
5336
|
-
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
5337
|
-
const new_state = history.state;
|
|
5338
|
-
if (listing_query_) {
|
|
5339
|
-
// In JS-UI we need to know the listing_id of the current category, therefore push it into state
|
|
5340
|
-
if (!this.listing_query_state_key) $52FdA$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
|
|
5341
|
-
new_state[this.listing_query_state_key] = listing_query_;
|
|
5342
|
-
}
|
|
5343
|
-
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
5344
|
-
} else $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_throwing_on_navigation, $73014ff36186a4dd$var$_throwing_on_navigation2).call(this, {
|
|
5345
|
-
is_replace: is_replace_,
|
|
5346
|
-
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
5347
|
-
scroll: scroll
|
|
5348
|
-
});
|
|
5349
|
-
await promise;
|
|
5350
|
-
})
|
|
5351
|
-
});
|
|
5352
|
-
this.listing_query_state_key = listing_query_state_key;
|
|
5353
|
-
this.on_navigation_ = on_navigation;
|
|
5354
|
-
}
|
|
5355
|
-
}
|
|
5356
|
-
function $73014ff36186a4dd$var$_throwing_on_navigation2() {
|
|
5357
|
-
const {
|
|
5358
|
-
on_navigation_: on_navigation_
|
|
5359
|
-
} = this;
|
|
5360
|
-
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
5361
|
-
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
5362
|
-
try {
|
|
5363
|
-
return on_navigation_(...arguments);
|
|
5364
|
-
} catch (e) {
|
|
5365
|
-
queueMicrotask(() => {
|
|
5366
|
-
throw e;
|
|
5367
|
-
});
|
|
5368
|
-
}
|
|
5369
|
-
}
|
|
5370
|
-
function $73014ff36186a4dd$var$_get_navigation_happened_promise2(is_replace) {
|
|
5371
|
-
return new Promise(resolve => {
|
|
5372
|
-
const handler = what_happened => {
|
|
5373
|
-
if (what_happened === (is_replace ? "replaceState" : "pushState")) {
|
|
5374
|
-
resolve();
|
|
5375
|
-
(0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
|
|
5376
|
-
}
|
|
5377
|
-
};
|
|
5378
|
-
(0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).add(handler);
|
|
5379
|
-
});
|
|
5380
|
-
}
|
|
5381
5505
|
var $c8e3c11062d8380b$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=image-container>`);
|
|
5382
5506
|
function $c8e3c11062d8380b$export$41e1a079d40a0d58(props) {
|
|
5383
5507
|
const [display] = $52FdA$solidjs.createResource(() => ({
|