@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.
@@ -1,8 +1,8 @@
1
1
  var $3hooq$depictaiutilishared = require("@depict-ai/utilishared/ES10");
2
2
  var $3hooq$solidjsweb = require("solid-js/web");
3
3
  var $3hooq$solidjs = require("solid-js");
4
- var $3hooq$depictaiutilisharedlatest = require("@depict-ai/utilishared/ES10");
5
4
  var $3hooq$babelruntimehelpersdefineProperty = require("@babel/runtime/helpers/defineProperty");
5
+ var $3hooq$depictaiutilisharedlatest = require("@depict-ai/utilishared/ES10");
6
6
  var $3hooq$babelruntimehelpersclassPrivateFieldSet = require("@babel/runtime/helpers/classPrivateFieldSet");
7
7
  var $3hooq$babelruntimehelpersclassPrivateFieldGet = require("@babel/runtime/helpers/classPrivateFieldGet");
8
8
  var $3hooq$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.0";
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++) {
@@ -1009,7 +1009,7 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
1009
1009
  });
1010
1010
  // Work around https://github.com/solidjs/solid/issues/1828
1011
1011
  const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
1012
- const [, otherAttributes] = $3hooq$solidjs.splitProps(props, ["resolutions", "size", "src", "srcSet", "loading", "customUrls" // Can't have properties ending on underscore because the property name mangling will get confused by this <-
1012
+ const [, otherAttributes] = $3hooq$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 <-
1013
1013
  ]);
1014
1014
 
1015
1015
  const [hasSetSize, setHasSetSize] = $3hooq$solidjs.createSignal(false);
@@ -1065,13 +1065,18 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
1065
1065
  let hasDecodedFastPath = false;
1066
1066
  let timeoutSet = false;
1067
1067
  let gotCleanedUp = false;
1068
+ let srcJustChanged = true;
1068
1069
  img.classList.add("s-responsive-image");
1069
1070
  if (listingContext) {
1070
1071
  let prevValue;
1071
1072
  const aspectRatios = listingContext[$858fdcf73148519f$export$f8945274f08a3105] || (listingContext[$858fdcf73148519f$export$f8945274f08a3105] = new Set());
1072
1073
  const [, setMostPrevalentAspectRatio] = listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] || (listingContext[$858fdcf73148519f$export$6066eb417ed2e9f7] = $3hooq$solidjs.createSignal());
1073
1074
  img.addEventListener("load", $3hooq$depictaiutilishared.catchify(() => {
1074
- // Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
1075
+ if (props.keyRatioUpdating) {
1076
+ if (!srcJustChanged) return;
1077
+ srcJustChanged = false;
1078
+ }
1079
+ // 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
1075
1080
  const aspectRatio_ = img.naturalWidth / img.naturalHeight;
1076
1081
  if (prevValue) aspectRatios.delete(prevValue);
1077
1082
  const newValue = !isNaN(aspectRatio_) ? {
@@ -1093,6 +1098,10 @@ function $858fdcf73148519f$export$6e5611bc7e57e477(props) {
1093
1098
  }
1094
1099
  $3hooq$solidjs.onCleanup(() => gotCleanedUp = true);
1095
1100
  $3hooq$solidjsweb.spread(img, $3hooq$solidjs.mergeProps(modifiedOtherAttributes), false, true);
1101
+ $3hooq$solidjs.createRenderEffect(() => {
1102
+ props.src;
1103
+ srcJustChanged = true;
1104
+ });
1096
1105
  $3hooq$solidjs.createEffect(() => {
1097
1106
  if (!props.size()) return; // wait until we have a size, run every time the size changes
1098
1107
  if (timeoutSet) return;
@@ -1160,48 +1169,22 @@ function $28535bb7671c63d1$export$e4b984597b71e989(props) {
1160
1169
  context[$28535bb7671c63d1$export$d7b7ab832c20e2f4] = $3hooq$solidjs.createSignal();
1161
1170
  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
1162
1171
  const [mostPrevalentAspectRatio] = context ? context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] || (context[(0, $858fdcf73148519f$export$6066eb417ed2e9f7)] = $3hooq$solidjs.createSignal()) : [];
1163
- const [aspectRatio, setAspectRatio] = $3hooq$solidjs.createSignal($3hooq$solidjs.untrack(() => props.aspectRatio));
1164
1172
  const container = $ce467edb5343cfcd$export$94026ee33dbabc26({
1165
1173
  // Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
1166
1174
  get class() {
1167
1175
  return props.class;
1168
1176
  },
1169
1177
  get aspectRatio() {
1170
- return aspectRatio();
1178
+ if (props.autoAdjustAspectRatio) {
1179
+ const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
1180
+ if (targetRatio != undefined) return "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
1181
+ }
1182
+ return props.aspectRatio;
1171
1183
  }
1172
1184
  });
1173
1185
  const owner = $3hooq$solidjs.getOwner();
1174
1186
  let createdSizeAccessor = false;
1175
1187
  let wasCleanedUp = false;
1176
- let timeout;
1177
- $3hooq$solidjs.createEffect(() => {
1178
- const {
1179
- autoAdjustAspectRatio: autoAdjustAspectRatio
1180
- } = props;
1181
- if (autoAdjustAspectRatio) {
1182
- const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
1183
- if (targetRatio != undefined) {
1184
- const targetValue = "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
1185
- const updateAspectRatio = $3hooq$depictaiutilishared.catchify(() => setAspectRatio(targetValue));
1186
- if (autoAdjustAspectRatio === "smoothed") {
1187
- if (!timeout)
1188
- // 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).
1189
- updateAspectRatio();
1190
- clearTimeout(timeout);
1191
- timeout = setTimeout(() => {
1192
- timeout = undefined;
1193
- updateAspectRatio();
1194
- }, 500);
1195
- return;
1196
- }
1197
- return updateAspectRatio();
1198
- }
1199
- } else {
1200
- clearTimeout(timeout);
1201
- timeout = undefined;
1202
- }
1203
- setAspectRatio(props.aspectRatio);
1204
- });
1205
1188
  $3hooq$solidjs.createEffect(() => {
1206
1189
  if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
1207
1190
  // ensure we always have a size accessor
@@ -1251,7 +1234,13 @@ function $f3db423dc84bc35d$export$9d4a4b669b1929ab(props) {
1251
1234
  }
1252
1235
  }));
1253
1236
  }
1254
- var $d66c35b5a6d6d926$var$_tmpl$ = ["<div", ' class="img-wrapper"><!--$-->', "<!--/--><!--$-->", "<!--/--></div>"],
1237
+ function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
1238
+ return $3hooq$solidjs.createMemo(() => {
1239
+ const price_formatting = props.price_formatting_;
1240
+ return $3hooq$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
1241
+ });
1242
+ }
1243
+ var $d66c35b5a6d6d926$var$_tmpl$ = ["<div", ' class="img-wrapper">', "</div>"],
1255
1244
  $d66c35b5a6d6d926$var$_tmpl$2 = ["<span", ' class="d-price original">', "</span>"],
1256
1245
  $d66c35b5a6d6d926$var$_tmpl$3 = ["<div", ' class="right-part"><div class="text-container"><span class="d-title line-clamp">', '</span><span class="', '">', "</span><!--$-->", "<!--/--></div><!--$-->", "<!--/--></div>"];
1257
1246
  function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
@@ -1261,23 +1250,17 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
1261
1250
  isExpanded_: isExpanded_,
1262
1251
  textFadeInAnimationRunning_: textFadeInAnimationRunning_,
1263
1252
  outerRef_: outerRef_,
1264
- animationDuration_: animationDuration_
1253
+ animationDuration_: animationDuration_,
1254
+ priceFormatting_: priceFormatting_,
1255
+ pseudoRouter_: pseudoRouter_
1265
1256
  } = _ref;
1266
1257
  const variantToUse = $3hooq$solidjs.createMemo(() => {
1267
1258
  const display = display_();
1268
1259
  return display === null || display === void 0 ? void 0 : display.variant_displays[display === null || display === void 0 ? void 0 : display.variant_index];
1269
1260
  });
1270
- const imageUrls = () => {
1271
- var _variantToUse;
1272
- return (_variantToUse = variantToUse()) === null || _variantToUse === void 0 ? void 0 : _variantToUse.image_urls;
1273
- };
1274
1261
  const imageUrl = $3hooq$solidjs.createMemo(() => {
1275
- var _imageUrls;
1276
- return (_imageUrls = imageUrls()) === null || _imageUrls === void 0 ? void 0 : _imageUrls[0];
1277
- });
1278
- const secondaryImageUrl = $3hooq$solidjs.createMemo(() => {
1279
- var _imageUrls2;
1280
- return (_imageUrls2 = imageUrls()) === null || _imageUrls2 === void 0 ? void 0 : _imageUrls2[1];
1262
+ var _variantToUse, _variantToUse$image_u;
1263
+ 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];
1281
1264
  });
1282
1265
  const [animationIsRunning, setAnimationIsRunning] = textFadeInAnimationRunning_;
1283
1266
  const [isExpandedThrottledByOurEffectRun, setIsExpandedThrottledByOurEffectRun] = $3hooq$solidjs.createSignal($3hooq$solidjs.untrack(isExpanded_));
@@ -1290,16 +1273,18 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
1290
1273
  var _variantToUse3;
1291
1274
  return (_variantToUse3 = variantToUse()) === null || _variantToUse3 === void 0 ? void 0 : _variantToUse3.original_price;
1292
1275
  });
1293
- const isOnSale = $3hooq$solidjs.createMemo(() => salePrice.latest !== originalPrice.latest); // .latest doesn't trigger suspense
1276
+ const isOnSale = $3hooq$solidjs.createMemo(() => !salePrice.loading && !originalPrice.loading && salePrice.latest !== originalPrice.latest); // .latest doesn't trigger suspense after the initial load
1277
+ const enableLink = $3hooq$solidjs.createMemo(() => isExpanded_() && !animationIsRunning());
1278
+ const href = $3hooq$solidjs.createMemo(() => {
1279
+ var _variantToUse4;
1280
+ return (_variantToUse4 = variantToUse()) === null || _variantToUse4 === void 0 ? void 0 : _variantToUse4.page_url;
1281
+ });
1294
1282
  const FavoriteButton = FavoriteButton_; // Just to get rid of the type error - TS doesn't understand <Show>
1295
1283
  return $3hooq$solidjsweb.ssrElement("a", $3hooq$solidjsweb.mergeProps({
1296
1284
  "class": "look-item"
1297
- }, () => {
1298
- var _variantToUse4;
1299
- return isExpanded_() && !animationIsRunning() ? {
1300
- href: (_variantToUse4 = variantToUse()) === null || _variantToUse4 === void 0 ? void 0 : _variantToUse4.page_url
1301
- } : {};
1302
- }), () => ["<!--$-->", $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1285
+ }, () => enableLink() ? {
1286
+ href: href()
1287
+ } : {}), () => ["<!--$-->", $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1303
1288
  when: imageUrl,
1304
1289
  get fallback() {
1305
1290
  return $3hooq$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
@@ -1325,25 +1310,10 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
1325
1310
  return isExpanded_() ? 0.75 : 1;
1326
1311
  },
1327
1312
  get autoAdjustAspectRatio() {
1328
- return isExpanded_() ? "smoothed" : false;
1329
- }
1330
- });
1331
- }
1332
- })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1333
- get when() {
1334
- return secondaryImageUrl();
1335
- },
1336
- get children() {
1337
- return $3hooq$solidjsweb.createComponent((0, $f3db423dc84bc35d$export$9d4a4b669b1929ab), {
1338
- get src() {
1339
- return secondaryImageUrl();
1313
+ return isExpanded_();
1340
1314
  },
1341
- get aspectRatio() {
1342
- return isExpanded_() ? 0.75 : 1;
1343
- },
1344
- "class": "secondary",
1345
- get autoAdjustAspectRatio() {
1346
- return isExpanded_() ? "smoothed" : false;
1315
+ imgProps: {
1316
+ keyRatioUpdating: true
1347
1317
  }
1348
1318
  });
1349
1319
  }
@@ -1358,18 +1328,66 @@ function $d66c35b5a6d6d926$export$b73ed90f0ee50dc3(_ref) {
1358
1328
  return $3hooq$solidjsweb.ssr($d66c35b5a6d6d926$var$_tmpl$3, $3hooq$solidjsweb.ssrHydrationKey(), (_$escape2 = $3hooq$solidjsweb.escape((_variantToUse5 = variantToUse()) === null || _variantToUse5 === void 0 ? void 0 : _variantToUse5.title)) !== null && _$escape2 !== void 0 ? _$escape2 : $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
1359
1329
  height: "1em",
1360
1330
  width: "20ch"
1361
- })), "d-price ".concat(isOnSale() ? "sale" : ""), !variantToUse() || salePrice.loading ? $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
1362
- height: "1em",
1363
- width: "20ch"
1364
- })) : $3hooq$solidjsweb.escape(salePrice()), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1331
+ })), "d-price ".concat(isOnSale() ? "sale" : ""), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1365
1332
  get when() {
1366
- return isOnSale();
1333
+ return variantToUse() && !salePrice.loading;
1367
1334
  },
1368
- get children() {
1369
- return $3hooq$solidjsweb.ssr($d66c35b5a6d6d926$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), !variantToUse() || originalPrice.loading ? $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
1335
+ get fallback() {
1336
+ return $3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
1370
1337
  height: "1em",
1371
1338
  width: "20ch"
1372
- })) : $3hooq$solidjsweb.escape(originalPrice()));
1339
+ });
1340
+ },
1341
+ get children() {
1342
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1343
+ get when() {
1344
+ return salePrice.latest;
1345
+ },
1346
+ get children() {
1347
+ return [priceFormatting_().pre_, $3hooq$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
1348
+ get price_() {
1349
+ return salePrice();
1350
+ },
1351
+ get price_formatting_() {
1352
+ return priceFormatting_();
1353
+ }
1354
+ }), priceFormatting_().post_];
1355
+ }
1356
+ });
1357
+ }
1358
+ })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1359
+ get when() {
1360
+ return isOnSale();
1361
+ },
1362
+ get children() {
1363
+ return $3hooq$solidjsweb.ssr($d66c35b5a6d6d926$var$_tmpl$2, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1364
+ get when() {
1365
+ return variantToUse() && !originalPrice.loading;
1366
+ },
1367
+ get fallback() {
1368
+ return $3hooq$solidjsweb.createComponent((0, $a7f7d416e6f61504$export$89c6019e4baa40b1), {
1369
+ height: "1em",
1370
+ width: "20ch"
1371
+ });
1372
+ },
1373
+ get children() {
1374
+ return $3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1375
+ get when() {
1376
+ return salePrice.latest;
1377
+ },
1378
+ get children() {
1379
+ return [priceFormatting_().pre_, $3hooq$solidjsweb.createComponent((0, $f38f2e64ebe2da86$export$a71e92cfbb498adc), {
1380
+ get price_() {
1381
+ return originalPrice();
1382
+ },
1383
+ get price_formatting_() {
1384
+ return priceFormatting_();
1385
+ }
1386
+ }), priceFormatting_().post_];
1387
+ }
1388
+ });
1389
+ }
1390
+ })));
1373
1391
  }
1374
1392
  })), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $3hooq$solidjs.Show), {
1375
1393
  when: FavoriteButton_,
@@ -1440,7 +1458,9 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
1440
1458
  userWantsExpandedSignal_: [userWantsExpanded, setUserWantsExpanded],
1441
1459
  containerWidth_: containerWidth_,
1442
1460
  animationDuration_: animationDuration_,
1443
- supportsHover_: supportsHover_
1461
+ supportsHover_: supportsHover_,
1462
+ priceFormatting_: priceFormatting_,
1463
+ pseudoRouter_: pseudoRouter_
1444
1464
  } = _ref;
1445
1465
  let isAffectedByChromeBug = false;
1446
1466
  // If the user requests the drawer to be expanded or not
@@ -1471,11 +1491,13 @@ function $e0b3f1f332b6863b$export$ebf0b1d4f90c09ae(_ref) {
1471
1491
  },
1472
1492
  children: (display, index) => {
1473
1493
  return $3hooq$solidjsweb.createComponent((0, $d66c35b5a6d6d926$export$b73ed90f0ee50dc3), {
1494
+ pseudoRouter_: pseudoRouter_,
1474
1495
  animationDuration_: animationDuration_,
1475
1496
  display_: display,
1476
1497
  FavoriteButton_: FavoriteButton_,
1477
1498
  isExpanded_: userWantsExpanded,
1478
1499
  textFadeInAnimationRunning_: textFadeInAnimationRunning,
1500
+ priceFormatting_: priceFormatting_,
1479
1501
  outerRef_: el => $3hooq$solidjs.createEffect(() => {
1480
1502
  if (index !== 0) return;
1481
1503
  const resizeObserver = new ResizeObserver($3hooq$depictaiutilishared.catchify(records => setLookItemHeight(records.at(-1).contentRect.height)));
@@ -1517,10 +1539,10 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
1517
1539
  expandedLooksSignal_: [expandedLooks_, setExpandedLooks],
1518
1540
  FavoriteButton_: FavoriteButton_,
1519
1541
  placeholderImageAspectRatio_: placeholderImageAspectRatio_,
1520
- animationDuration_: animationDuration_
1542
+ animationDuration_: animationDuration_,
1543
+ priceFormatting_: priceFormatting_,
1544
+ pseudoRouter_: pseudoRouter_
1521
1545
  } = _ref;
1522
- // TODO: shopify, run displayTransformers to get dynamic prices
1523
- // TODO: format prices
1524
1546
  const [coverImage] = (display_ === null || display_ === void 0 ? void 0 : display_.image_urls) || [];
1525
1547
  const useWantsExpandedSignal_ = $3hooq$solidjs.createSignal(false);
1526
1548
  const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
@@ -1553,7 +1575,7 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
1553
1575
  when: display_,
1554
1576
  get fallback() {
1555
1577
  return $3hooq$solidjsweb.createComponent((0, $b8a8d61b3ec5f5ac$export$3f37af283f8fb843), {
1556
- aspectRatio: placeholderImageAspectRatio_
1578
+ aspectRatio: "var(".concat((0, $c0cf6af094336798$export$8a2234b5b1a5ebd4), ", ").concat(placeholderImageAspectRatio_, ")")
1557
1579
  });
1558
1580
  },
1559
1581
  get children() {
@@ -1571,10 +1593,136 @@ function $47e3c3102c78121b$export$44809a8a3e867e30(_ref) {
1571
1593
  containerWidth_: containerWidth_,
1572
1594
  animationDuration_: animationDuration_,
1573
1595
  supportsHover_: supportsHover_,
1574
- FavoriteButton_: FavoriteButton_
1596
+ FavoriteButton_: FavoriteButton_,
1597
+ priceFormatting_: priceFormatting_,
1598
+ pseudoRouter_: pseudoRouter_
1575
1599
  })]);
1576
1600
  return container;
1577
1601
  }
1602
+
1603
+ /**
1604
+ * 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
1605
+ * @param clickEvent The click event that triggered the navigation
1606
+ */
1607
+ function $9ca08bcacbc598ce$export$29d28dadc2d6b631(clickEvent) {
1608
+ 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
1609
+ );
1610
+ }
1611
+
1612
+ function $73014ff36186a4dd$var$_classPrivateMethodInitSpec(obj, privateSet) {
1613
+ $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateSet);
1614
+ privateSet.add(obj);
1615
+ }
1616
+ function $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateCollection) {
1617
+ if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
1618
+ }
1619
+ function $73014ff36186a4dd$var$_classPrivateMethodGet(receiver, privateSet, fn) {
1620
+ if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
1621
+ return fn;
1622
+ }
1623
+ var $73014ff36186a4dd$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
1624
+ var $73014ff36186a4dd$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
1625
+ class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
1626
+ /**
1627
+ * Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
1628
+ */ /**
1629
+ * 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
1630
+ */ /**
1631
+ * Vue has async router that needs to be awaited (it navigates after a microtask)
1632
+ * This standardises waiting for all kinds of routers
1633
+ */
1634
+ constructor(on_navigation, listing_query_state_key) {
1635
+ $73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_get_navigation_happened_promise);
1636
+ $73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_throwing_on_navigation);
1637
+ $parcel$interopDefault($3hooq$babelruntimehelpersdefineProperty)(this, "on_navigation_", void 0);
1638
+ $parcel$interopDefault($3hooq$babelruntimehelpersdefineProperty)(this, "listing_query_state_key", void 0);
1639
+ $parcel$interopDefault($3hooq$babelruntimehelpersdefineProperty)(this, "navigate_", {
1640
+ /**
1641
+ * Call this if you *just* want to replace the state object in history.state
1642
+ */
1643
+ replace_state_: new_state => {
1644
+ var _globalThis$history;
1645
+ // 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
1646
+ globalThis === null || globalThis === void 0 || (_globalThis$history = globalThis.history) === null || _globalThis$history === void 0 || _globalThis$history.replaceState(new_state, "");
1647
+ },
1648
+ /**
1649
+ * Call this to change the URL
1650
+ * @param new_url_ new URL to go to
1651
+ * @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
1652
+ * @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
1653
+ * @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
1654
+ * @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
1655
+ */
1656
+ go_to_: $3hooq$depictaiutilishared.catchify(async _ref => {
1657
+ let {
1658
+ new_url_: raw_new_url,
1659
+ event_: event_,
1660
+ force_spa_navigation_: force_spa_navigation_,
1661
+ is_replace_: is_replace_,
1662
+ listing_query_: listing_query_,
1663
+ scroll = true
1664
+ } = _ref;
1665
+ const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
1666
+ const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
1667
+ if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(event_)) return;
1668
+ const different_origin = new_url_.origin !== location.origin;
1669
+ if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
1670
+ if (force_spa_navigation_ && different_origin)
1671
+ // If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
1672
+ $3hooq$depictaiutilishared.dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
1673
+ if (!event_)
1674
+ // If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
1675
+ location.assign(new_url_);
1676
+ return;
1677
+ }
1678
+ event_ === null || event_ === void 0 || event_.preventDefault();
1679
+ const promise = $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_get_navigation_happened_promise, $73014ff36186a4dd$var$_get_navigation_happened_promise2).call(this, true);
1680
+ if (force_spa_navigation_ && wants_hard_navigation) {
1681
+ // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
1682
+ const new_state = history.state;
1683
+ if (listing_query_) {
1684
+ // In JS-UI we need to know the listing_id of the current category, therefore push it into state
1685
+ if (!this.listing_query_state_key) $3hooq$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
1686
+ new_state[this.listing_query_state_key] = listing_query_;
1687
+ }
1688
+ history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
1689
+ } else $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_throwing_on_navigation, $73014ff36186a4dd$var$_throwing_on_navigation2).call(this, {
1690
+ is_replace: is_replace_,
1691
+ new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
1692
+ scroll: scroll
1693
+ });
1694
+ await promise;
1695
+ })
1696
+ });
1697
+ this.listing_query_state_key = listing_query_state_key;
1698
+ this.on_navigation_ = on_navigation;
1699
+ }
1700
+ }
1701
+ function $73014ff36186a4dd$var$_throwing_on_navigation2() {
1702
+ const {
1703
+ on_navigation_: on_navigation_
1704
+ } = this;
1705
+ if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
1706
+ // make sure that we don't accidentally catchify if the SDK consumer has fucked up
1707
+ try {
1708
+ return on_navigation_(...arguments);
1709
+ } catch (e) {
1710
+ queueMicrotask(() => {
1711
+ throw e;
1712
+ });
1713
+ }
1714
+ }
1715
+ function $73014ff36186a4dd$var$_get_navigation_happened_promise2(is_replace) {
1716
+ return new Promise(resolve => {
1717
+ const handler = what_happened => {
1718
+ if (what_happened === (is_replace ? "replaceState" : "pushState")) {
1719
+ resolve();
1720
+ (0, $3hooq$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
1721
+ }
1722
+ };
1723
+ (0, $3hooq$depictaiutilishared.instant_exec_on_suspect_history_change).add(handler);
1724
+ });
1725
+ }
1578
1726
  var $8446f782881fa12e$var$_tmpl$ = ["<div", ' class="depict recommendations looks" style="', '">', "</div>"];
1579
1727
  let $8446f782881fa12e$var$expandedLooksSignal_;
1580
1728
  function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
@@ -1583,6 +1731,7 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
1583
1731
  equals: false
1584
1732
  }));
1585
1733
  const expandingAnimationDuration = 240;
1734
+ const pseudoRouter = new (0, $73014ff36186a4dd$export$7e1297a3a19f10d8)("hard_navigation");
1586
1735
  const grid_spacing_override = $3hooq$solidjs.createMemo(() => {
1587
1736
  const {
1588
1737
  gridSpacing_: gridSpacing_
@@ -1610,19 +1759,35 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
1610
1759
  });
1611
1760
  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));
1612
1761
  if (!decoded)
1613
- // If network fails, make sure to return empty array adn SolidRecommendationSlider will remove its elements
1762
+ // If network fails, make sure to return empty array and SolidRecommendationSlider will remove its elements
1614
1763
  return [];
1615
- return decoded.listings;
1764
+ const {
1765
+ listings: listings
1766
+ } = decoded;
1767
+ const baseData = {
1768
+ merchant: merchant,
1769
+ market: market,
1770
+ locale: locale
1771
+ };
1772
+ return $8446f782881fa12e$var$runDisplayTransformersForLooks(baseData, listings, props.displayTransformers_);
1773
+ });
1774
+ $3hooq$solidjs.createEffect(() => {
1775
+ const {
1776
+ onNavigation_: onNavigation_
1777
+ } = props;
1778
+ if (onNavigation_) pseudoRouter.on_navigation_ = onNavigation_;
1616
1779
  });
1617
1780
  return $3hooq$solidjsweb.ssr($8446f782881fa12e$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), $3hooq$solidjsweb.ssrStyle("--animation-duration: ".concat(expandingAnimationDuration, "ms")), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $d067f3a30f047b41$export$e68cff63f76bd15b), {
1618
1781
  get children() {
1619
1782
  return $236a257ee52e5414$export$d41d19e89346fa2({
1620
- product_card_template_: (display, info) => $47e3c3102c78121b$export$44809a8a3e867e30({
1783
+ product_card_template_: display => $47e3c3102c78121b$export$44809a8a3e867e30({
1621
1784
  display_: display,
1622
1785
  FavoriteButton_: props.FavoriteButton_,
1623
1786
  placeholderImageAspectRatio_: props.imagePlaceholderAspectRatio_,
1624
1787
  animationDuration_: expandingAnimationDuration,
1625
- expandedLooksSignal_: $8446f782881fa12e$var$expandedLooksSignal_
1788
+ expandedLooksSignal_: $8446f782881fa12e$var$expandedLooksSignal_,
1789
+ priceFormatting_: () => props.priceFormatting_,
1790
+ pseudoRouter_: pseudoRouter
1626
1791
  }),
1627
1792
  recommendations_resource_: looksResource,
1628
1793
  title_: () => props.title_,
@@ -1635,6 +1800,58 @@ function $8446f782881fa12e$export$1935e6bdfc5ed8ce(props) {
1635
1800
  })));
1636
1801
  }, "LookSlider failed");
1637
1802
  }
1803
+ async function $8446f782881fa12e$var$runDisplayTransformersForLooks(baseData, listings, displayTransformers) {
1804
+ try {
1805
+ const {
1806
+ products: productTransformer,
1807
+ categories: providedListingTransformer
1808
+ } = displayTransformers || {};
1809
+ if (!productTransformer && !providedListingTransformer) return listings;
1810
+ const listingTransformer = providedListingTransformer || (_ref3 => {
1811
+ let {
1812
+ data: data
1813
+ } = _ref3;
1814
+ return data;
1815
+ });
1816
+ const displaysToTransform = [];
1817
+ const displayIdsPerListingId = {};
1818
+ const transformedListingsPromise = listingTransformer({
1819
+ ...baseData,
1820
+ data: listings.map(_ref4 => {
1821
+ let {
1822
+ displays: displays,
1823
+ ...listing
1824
+ } = _ref4;
1825
+ // Populate our displays by id and displayIdToListings object in the .map where we add ancestors to the listings, for peak efficiency
1826
+ for (let i = 0; i < displays.length; i++) {
1827
+ var _listing$listing_id;
1828
+ const display = displays[i];
1829
+ const uniqueIdOfDisplay = $b85edfec41cd3989$export$548d053aba053d79(display);
1830
+ displaysToTransform.push(display);
1831
+ (displayIdsPerListingId[_listing$listing_id = listing.listing_id] || (displayIdsPerListingId[_listing$listing_id] = [])).push(uniqueIdOfDisplay);
1832
+ }
1833
+ return {
1834
+ ...listing,
1835
+ ancestors: []
1836
+ };
1837
+ })
1838
+ });
1839
+ // This allows the person providing the displayTransformer to re-order and remove displays
1840
+ const transformedProducts = productTransformer ? await productTransformer({
1841
+ ...baseData,
1842
+ displays: displaysToTransform
1843
+ }) : displaysToTransform;
1844
+ const transformedListings = await transformedListingsPromise;
1845
+ const transformedDisplayById = Object.fromEntries(transformedProducts.map(display => [$b85edfec41cd3989$export$548d053aba053d79(display), display]));
1846
+ return transformedListings.map(listing => $3hooq$solidjs.mergeProps(listing, {
1847
+ // use mergeProps because in preview browser we add getters in this object, that would be called too early otherwise
1848
+ displays: (displayIdsPerListingId[listing.listing_id] || []).map(displayId => transformedDisplayById[displayId]).filter(v => v)
1849
+ }));
1850
+ } catch (e) {
1851
+ $3hooq$depictaiutilishared.dwarn("Displaytransformers threw", e);
1852
+ return [];
1853
+ }
1854
+ }
1638
1855
  const $cfcd56242923775d$export$3064e1e8c6513da3 = new Set();
1639
1856
  let $cfcd56242923775d$var$has_ran = false;
1640
1857
  function $cfcd56242923775d$export$5162a71f252e6122() {
@@ -1676,15 +1893,6 @@ function $cfcd56242923775d$var$starts_with_any_prefix(key) {
1676
1893
  }
1677
1894
  }
1678
1895
 
1679
- /**
1680
- * 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
1681
- * @param clickEvent The click event that triggered the navigation
1682
- */
1683
- function $9ca08bcacbc598ce$export$29d28dadc2d6b631(clickEvent) {
1684
- 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
1685
- );
1686
- }
1687
-
1688
1896
  /**
1689
1897
  * Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
1690
1898
  */
@@ -1725,12 +1933,6 @@ function $bdea39a75c454f4f$export$f50b88e2a00918b5(fn) {
1725
1933
  }
1726
1934
  };
1727
1935
  }
1728
- function $f38f2e64ebe2da86$export$a71e92cfbb498adc(props) {
1729
- return $3hooq$solidjs.createMemo(() => {
1730
- const price_formatting = props.price_formatting_;
1731
- return $3hooq$depictaiutilishared.standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
1732
- });
1733
- }
1734
1936
  function $b0f8d9f49e018db9$export$fb40a80c530e5f2b(selectedIndex, groupIndex, indexInGroup) {
1735
1937
  const isSelected = $3hooq$solidjs.createMemo(() => {
1736
1938
  const selectedValue = selectedIndex();
@@ -4280,120 +4482,6 @@ function $367b536a2a94d24e$var$history_state_change(signals, entries, state) {
4280
4482
  }
4281
4483
  });
4282
4484
  }
4283
- function $73014ff36186a4dd$var$_classPrivateMethodInitSpec(obj, privateSet) {
4284
- $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateSet);
4285
- privateSet.add(obj);
4286
- }
4287
- function $73014ff36186a4dd$var$_checkPrivateRedeclaration(obj, privateCollection) {
4288
- if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
4289
- }
4290
- function $73014ff36186a4dd$var$_classPrivateMethodGet(receiver, privateSet, fn) {
4291
- if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
4292
- return fn;
4293
- }
4294
- var $73014ff36186a4dd$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
4295
- var $73014ff36186a4dd$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
4296
- class $73014ff36186a4dd$export$7e1297a3a19f10d8 {
4297
- /**
4298
- * Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
4299
- */ /**
4300
- * 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
4301
- */ /**
4302
- * Vue has async router that needs to be awaited (it navigates after a microtask)
4303
- * This standardises waiting for all kinds of routers
4304
- */
4305
- constructor(on_navigation, listing_query_state_key) {
4306
- $73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_get_navigation_happened_promise);
4307
- $73014ff36186a4dd$var$_classPrivateMethodInitSpec(this, $73014ff36186a4dd$var$_throwing_on_navigation);
4308
- $parcel$interopDefault($3hooq$babelruntimehelpersdefineProperty)(this, "on_navigation_", void 0);
4309
- $parcel$interopDefault($3hooq$babelruntimehelpersdefineProperty)(this, "listing_query_state_key", void 0);
4310
- $parcel$interopDefault($3hooq$babelruntimehelpersdefineProperty)(this, "navigate_", {
4311
- /**
4312
- * Call this if you *just* want to replace the state object in history.state
4313
- */
4314
- replace_state_: new_state => {
4315
- var _globalThis$history;
4316
- // 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
4317
- globalThis === null || globalThis === void 0 || (_globalThis$history = globalThis.history) === null || _globalThis$history === void 0 || _globalThis$history.replaceState(new_state, "");
4318
- },
4319
- /**
4320
- * Call this to change the URL
4321
- * @param new_url_ new URL to go to
4322
- * @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
4323
- * @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
4324
- * @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
4325
- * @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
4326
- */
4327
- go_to_: $3hooq$depictaiutilishared.catchify(async _ref => {
4328
- let {
4329
- new_url_: raw_new_url,
4330
- event_: event_,
4331
- force_spa_navigation_: force_spa_navigation_,
4332
- is_replace_: is_replace_,
4333
- listing_query_: listing_query_,
4334
- scroll = true
4335
- } = _ref;
4336
- const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
4337
- const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
4338
- if ($9ca08bcacbc598ce$export$29d28dadc2d6b631(event_)) return;
4339
- const different_origin = new_url_.origin !== location.origin;
4340
- if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
4341
- if (force_spa_navigation_ && different_origin)
4342
- // If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
4343
- $3hooq$depictaiutilishared.dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
4344
- if (!event_)
4345
- // If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
4346
- location.assign(new_url_);
4347
- return;
4348
- }
4349
- event_ === null || event_ === void 0 || event_.preventDefault();
4350
- const promise = $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_get_navigation_happened_promise, $73014ff36186a4dd$var$_get_navigation_happened_promise2).call(this, true);
4351
- if (force_spa_navigation_ && wants_hard_navigation) {
4352
- // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
4353
- const new_state = history.state;
4354
- if (listing_query_) {
4355
- // In JS-UI we need to know the listing_id of the current category, therefore push it into state
4356
- if (!this.listing_query_state_key) $3hooq$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
4357
- new_state[this.listing_query_state_key] = listing_query_;
4358
- }
4359
- history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
4360
- } else $73014ff36186a4dd$var$_classPrivateMethodGet(this, $73014ff36186a4dd$var$_throwing_on_navigation, $73014ff36186a4dd$var$_throwing_on_navigation2).call(this, {
4361
- is_replace: is_replace_,
4362
- new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
4363
- scroll: scroll
4364
- });
4365
- await promise;
4366
- })
4367
- });
4368
- this.listing_query_state_key = listing_query_state_key;
4369
- this.on_navigation_ = on_navigation;
4370
- }
4371
- }
4372
- function $73014ff36186a4dd$var$_throwing_on_navigation2() {
4373
- const {
4374
- on_navigation_: on_navigation_
4375
- } = this;
4376
- if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
4377
- // make sure that we don't accidentally catchify if the SDK consumer has fucked up
4378
- try {
4379
- return on_navigation_(...arguments);
4380
- } catch (e) {
4381
- queueMicrotask(() => {
4382
- throw e;
4383
- });
4384
- }
4385
- }
4386
- function $73014ff36186a4dd$var$_get_navigation_happened_promise2(is_replace) {
4387
- return new Promise(resolve => {
4388
- const handler = what_happened => {
4389
- if (what_happened === (is_replace ? "replaceState" : "pushState")) {
4390
- resolve();
4391
- (0, $3hooq$depictaiutilishared.instant_exec_on_suspect_history_change).delete(handler);
4392
- }
4393
- };
4394
- (0, $3hooq$depictaiutilishared.instant_exec_on_suspect_history_change).add(handler);
4395
- });
4396
- }
4397
4485
  var $c8e3c11062d8380b$var$_tmpl$ = ["<div", ' class="image-container">', "</div>"];
4398
4486
  function $c8e3c11062d8380b$export$41e1a079d40a0d58(props) {
4399
4487
  const [display] = $3hooq$solidjs.createResource(() => ({