@depict-ai/ui 4.3.1 → 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 +312 -196
- package/ES10/index.d.ts +242 -235
- package/ES10/index.js +346 -230
- package/latest/index.cjs +292 -181
- package/latest/index.d.ts +242 -235
- package/latest/index.js +326 -215
- package/package.json +2 -2
- package/server/ES10/index.cjs +305 -191
- package/server/ES10/index.d.ts +242 -235
- package/server/ES10/index.js +345 -231
- package/server/latest/index.cjs +283 -174
- package/server/latest/index.d.ts +242 -235
- package/server/latest/index.js +323 -214
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,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><!$><!/>`),
|
|
@@ -1374,7 +1363,9 @@ 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_();
|
|
@@ -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(() => 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
|
+
});
|
|
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,16 @@ 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_ => enableLink() && pseudoRouter_.navigate_.go_to_({
|
|
1409
|
+
new_url_: href(),
|
|
1410
|
+
is_replace_: false,
|
|
1411
|
+
event_: event_
|
|
1412
|
+
}));
|
|
1413
|
+
}
|
|
1413
1414
|
}), false, true);
|
|
1414
1415
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1415
1416
|
when: imageUrl,
|
|
@@ -1438,7 +1439,10 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1438
1439
|
return isExpanded_() ? 0.75 : 1;
|
|
1439
1440
|
},
|
|
1440
1441
|
get autoAdjustAspectRatio() {
|
|
1441
|
-
return isExpanded_()
|
|
1442
|
+
return isExpanded_();
|
|
1443
|
+
},
|
|
1444
|
+
imgProps: {
|
|
1445
|
+
keyRatioUpdating: true
|
|
1442
1446
|
}
|
|
1443
1447
|
});
|
|
1444
1448
|
}
|
|
@@ -1499,26 +1503,68 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1499
1503
|
width: "20ch"
|
|
1500
1504
|
});
|
|
1501
1505
|
});
|
|
1502
|
-
$52FdA$solidjsweb.insert(_el$6, (()
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
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
|
+
}));
|
|
1509
1534
|
$52FdA$solidjsweb.insert(_el$4, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
|
|
1510
1535
|
get when() {
|
|
1511
1536
|
return isOnSale();
|
|
1512
1537
|
},
|
|
1513
1538
|
get children() {
|
|
1514
1539
|
var _el$7 = $52FdA$solidjsweb.getNextElement($d66c35b5a6d6d926$var$_tmpl$2);
|
|
1515
|
-
$52FdA$solidjsweb.insert(_el$7, (()
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
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
|
+
}));
|
|
1522
1568
|
return _el$7;
|
|
1523
1569
|
}
|
|
1524
1570
|
}), _el$9, _co$);
|
|
@@ -1596,7 +1642,9 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1596
1642
|
userWantsExpandedSignal_: [userWantsExpanded, setUserWantsExpanded],
|
|
1597
1643
|
containerWidth_: containerWidth_,
|
|
1598
1644
|
animationDuration_: animationDuration_,
|
|
1599
|
-
supportsHover_: supportsHover_
|
|
1645
|
+
supportsHover_: supportsHover_,
|
|
1646
|
+
priceFormatting_: priceFormatting_,
|
|
1647
|
+
pseudoRouter_: pseudoRouter_
|
|
1600
1648
|
} = _ref;
|
|
1601
1649
|
let isAffectedByChromeBug = false;
|
|
1602
1650
|
// If the user requests the drawer to be expanded or not
|
|
@@ -1650,11 +1698,13 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1650
1698
|
},
|
|
1651
1699
|
children: (display, index) => {
|
|
1652
1700
|
return $52FdA$solidjsweb.createComponent((0, $d66c35b5a6d6d926$export$b73ed90f0ee50dc3), {
|
|
1701
|
+
pseudoRouter_: pseudoRouter_,
|
|
1653
1702
|
animationDuration_: animationDuration_,
|
|
1654
1703
|
display_: display,
|
|
1655
1704
|
FavoriteButton_: FavoriteButton_,
|
|
1656
1705
|
isExpanded_: userWantsExpanded,
|
|
1657
1706
|
textFadeInAnimationRunning_: textFadeInAnimationRunning,
|
|
1707
|
+
priceFormatting_: priceFormatting_,
|
|
1658
1708
|
outerRef_: el => $52FdA$solidjs.createEffect(() => {
|
|
1659
1709
|
if (index !== 0) return;
|
|
1660
1710
|
const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => setLookItemHeight(records.at(-1).contentRect.height)));
|
|
@@ -1698,10 +1748,10 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1698
1748
|
expandedLooksSignal_: [expandedLooks_, setExpandedLooks],
|
|
1699
1749
|
FavoriteButton_: FavoriteButton_,
|
|
1700
1750
|
placeholderImageAspectRatio_: placeholderImageAspectRatio_,
|
|
1701
|
-
animationDuration_: animationDuration_
|
|
1751
|
+
animationDuration_: animationDuration_,
|
|
1752
|
+
priceFormatting_: priceFormatting_,
|
|
1753
|
+
pseudoRouter_: pseudoRouter_
|
|
1702
1754
|
} = _ref;
|
|
1703
|
-
// TODO: shopify, run displayTransformers to get dynamic prices
|
|
1704
|
-
// TODO: format prices
|
|
1705
1755
|
const [coverImage] = (display_ === null || display_ === void 0 ? void 0 : display_.image_urls) || [];
|
|
1706
1756
|
const useWantsExpandedSignal_ = $52FdA$solidjs.createSignal(false);
|
|
1707
1757
|
const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
|
|
@@ -1747,7 +1797,7 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1747
1797
|
when: display_,
|
|
1748
1798
|
get fallback() {
|
|
1749
1799
|
return $52FdA$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
|
|
1750
|
-
aspectRatio: placeholderImageAspectRatio_
|
|
1800
|
+
aspectRatio: "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(placeholderImageAspectRatio_, ")")
|
|
1751
1801
|
});
|
|
1752
1802
|
},
|
|
1753
1803
|
get children() {
|
|
@@ -1765,11 +1815,137 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
|
|
|
1765
1815
|
containerWidth_: containerWidth_,
|
|
1766
1816
|
animationDuration_: animationDuration_,
|
|
1767
1817
|
supportsHover_: supportsHover_,
|
|
1768
|
-
FavoriteButton_: FavoriteButton_
|
|
1818
|
+
FavoriteButton_: FavoriteButton_,
|
|
1819
|
+
priceFormatting_: priceFormatting_,
|
|
1820
|
+
pseudoRouter_: pseudoRouter_
|
|
1769
1821
|
})]);
|
|
1770
1822
|
return container;
|
|
1771
1823
|
}
|
|
1772
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
|
+
}
|
|
1773
1949
|
var $8446f782881fa12e$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="depict recommendations looks"style=--animation-duration:240ms>`);
|
|
1774
1950
|
let $8446f782881fa12e$var$expandedLooksSignal_;
|
|
1775
1951
|
function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
@@ -1778,6 +1954,7 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1778
1954
|
equals: false
|
|
1779
1955
|
}));
|
|
1780
1956
|
const expandingAnimationDuration = 240;
|
|
1957
|
+
const pseudoRouter = new (0, $73014ff36186a4dd$export$7e1297a3a19f10d8)("hard_navigation");
|
|
1781
1958
|
const grid_spacing_override = $52FdA$solidjs.createMemo(() => {
|
|
1782
1959
|
const {
|
|
1783
1960
|
gridSpacing_: gridSpacing_
|
|
@@ -1805,21 +1982,37 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1805
1982
|
});
|
|
1806
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));
|
|
1807
1984
|
if (!decoded)
|
|
1808
|
-
// 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
|
|
1809
1986
|
return [];
|
|
1810
|
-
|
|
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_;
|
|
1811
2002
|
});
|
|
1812
2003
|
return (() => {
|
|
1813
2004
|
var _el$ = $52FdA$solidjsweb.getNextElement($8446f782881fa12e$var$_tmpl$);
|
|
1814
2005
|
$52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
|
|
1815
2006
|
get children() {
|
|
1816
2007
|
return $236a257ee52e5414$export$d41d19e89346fa2({
|
|
1817
|
-
product_card_template_:
|
|
2008
|
+
product_card_template_: display => $47e3c3102c78121b$export$44809a8a3e867e30({
|
|
1818
2009
|
display_: display,
|
|
1819
2010
|
FavoriteButton_: props.FavoriteButton_,
|
|
1820
2011
|
placeholderImageAspectRatio_: props.imagePlaceholderAspectRatio_,
|
|
1821
2012
|
animationDuration_: expandingAnimationDuration,
|
|
1822
|
-
expandedLooksSignal_: $8446f782881fa12e$var$expandedLooksSignal_
|
|
2013
|
+
expandedLooksSignal_: $8446f782881fa12e$var$expandedLooksSignal_,
|
|
2014
|
+
priceFormatting_: () => props.priceFormatting_,
|
|
2015
|
+
pseudoRouter_: pseudoRouter
|
|
1823
2016
|
}),
|
|
1824
2017
|
recommendations_resource_: looksResource,
|
|
1825
2018
|
title_: () => props.title_,
|
|
@@ -1834,6 +2027,58 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
|
|
|
1834
2027
|
})();
|
|
1835
2028
|
}, "LookSlider failed");
|
|
1836
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
|
+
}
|
|
1837
2082
|
const $cfcd56242923775d$export$3064e1e8c6513da3 = new Set();
|
|
1838
2083
|
let $cfcd56242923775d$var$has_ran = false;
|
|
1839
2084
|
function $cfcd56242923775d$export$5162a71f252e6122() {
|
|
@@ -1875,15 +2120,6 @@ function $cfcd56242923775d$var$starts_with_any_prefix(key) {
|
|
|
1875
2120
|
}
|
|
1876
2121
|
}
|
|
1877
2122
|
|
|
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
2123
|
/**
|
|
1888
2124
|
* Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
|
|
1889
2125
|
*/
|
|
@@ -1924,12 +2160,6 @@ function $bdea39a75c454f4f$export$f50b88e2a00918b5(fn) {
|
|
|
1924
2160
|
}
|
|
1925
2161
|
};
|
|
1926
2162
|
}
|
|
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
2163
|
function $b0f8d9f49e018db9$export$fb40a80c530e5f2b(selectedIndex, groupIndex, indexInGroup) {
|
|
1934
2164
|
const isSelected = $52FdA$solidjs.createMemo(() => {
|
|
1935
2165
|
const selectedValue = selectedIndex();
|
|
@@ -5264,120 +5494,6 @@ function $367b536a2a94d24e$var$history_state_change(signals, entries, state) {
|
|
|
5264
5494
|
}
|
|
5265
5495
|
});
|
|
5266
5496
|
}
|
|
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
5497
|
var $c8e3c11062d8380b$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=image-container>`);
|
|
5382
5498
|
function $c8e3c11062d8380b$export$41e1a079d40a0d58(props) {
|
|
5383
5499
|
const [display] = $52FdA$solidjs.createResource(() => ({
|