@depict-ai/ui 4.3.0 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ES10/index.cjs +350 -258
- package/ES10/index.d.ts +244 -237
- package/ES10/index.js +384 -292
- package/latest/index.cjs +326 -234
- package/latest/index.d.ts +244 -237
- package/latest/index.js +360 -268
- package/package.json +2 -2
- package/server/ES10/index.cjs +307 -219
- package/server/ES10/index.d.ts +244 -237
- package/server/ES10/index.js +347 -259
- package/server/latest/index.cjs +284 -195
- package/server/latest/index.d.ts +244 -237
- package/server/latest/index.js +324 -235
package/ES10/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { add_to_version_info as $8tj43$add_to_version_info, fetch_retry as $8tj43$fetch_retry, base_url as $8tj43$base_url, slider_fractional_factory as $8tj43$slider_fractional_factory, dlog as $8tj43$dlog, camelCasifyObject as $8tj43$camelCasifyObject, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, catchify as $8tj43$catchify, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, slider_fading_factory as $8tj43$slider_fading_factory, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, observer as $8tj43$observer, javascript_media_query as $8tj43$javascript_media_query, queueMacroTask as $8tj43$queueMacroTask, findMostFrequentItem as $8tj43$findMostFrequentItem,
|
|
2
|
-
import { template as $8tj43$template, getNextElement as $8tj43$getNextElement, insert as $8tj43$insert, createComponent as $8tj43$createComponent, mergeProps as $8tj43$
|
|
3
|
-
import { createSignal as $8tj43$createSignal, createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, Show as $8tj43$Show, Suspense as $8tj43$Suspense, untrack as $8tj43$untrack, createRenderEffect as $8tj43$createRenderEffect, Index as $8tj43$Index, createRoot as $8tj43$createRoot, onCleanup as $8tj43$onCleanup, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner,
|
|
4
|
-
import { ListenableSet as $8tj43$ListenableSet, catchify as $8tj43$catchify1, use_href_accessor as $8tj43$use_href_accessor1, report as $8tj43$report1 } from "@depict-ai/utilishared/ES10";
|
|
1
|
+
import { add_to_version_info as $8tj43$add_to_version_info, fetch_retry as $8tj43$fetch_retry, base_url as $8tj43$base_url, dwarn as $8tj43$dwarn, slider_fractional_factory as $8tj43$slider_fractional_factory, dlog as $8tj43$dlog, camelCasifyObject as $8tj43$camelCasifyObject, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, catchify as $8tj43$catchify, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, slider_fading_factory as $8tj43$slider_fading_factory, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, observer as $8tj43$observer, javascript_media_query as $8tj43$javascript_media_query, queueMacroTask as $8tj43$queueMacroTask, findMostFrequentItem as $8tj43$findMostFrequentItem, standard_price_format as $8tj43$standard_price_format, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, use_href_accessor as $8tj43$use_href_accessor, get_session_id as $8tj43$get_session_id, add_version_query_params as $8tj43$add_version_query_params, useExpandingContainer as $8tj43$useExpandingContainer, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, snakeCasifyObject as $8tj43$snakeCasifyObject, make_url_with_query_params as $8tj43$make_url_with_query_params, sort_obj as $8tj43$sort_obj, ListenableSet as $8tj43$ListenableSet1, insert_surfaces as $8tj43$insert_surfaces, is_debug as $8tj43$is_debug } from "@depict-ai/utilishared/ES10";
|
|
2
|
+
import { template as $8tj43$template, getNextElement as $8tj43$getNextElement, insert as $8tj43$insert, createComponent as $8tj43$createComponent, mergeProps as $8tj43$mergeProps1, isServer as $8tj43$isServer, spread as $8tj43$spread, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, getNextMarker as $8tj43$getNextMarker, effect as $8tj43$effect, classList as $8tj43$classList, setAttribute as $8tj43$setAttribute, style as $8tj43$style, use as $8tj43$use, setProperty as $8tj43$setProperty, Dynamic as $8tj43$Dynamic } from "solid-js/web";
|
|
3
|
+
import { createSignal as $8tj43$createSignal, createMemo as $8tj43$createMemo, createResource as $8tj43$createResource, createEffect as $8tj43$createEffect, mergeProps as $8tj43$mergeProps, Show as $8tj43$Show, Suspense as $8tj43$Suspense, untrack as $8tj43$untrack, createRenderEffect as $8tj43$createRenderEffect, Index as $8tj43$Index, createRoot as $8tj43$createRoot, onCleanup as $8tj43$onCleanup, For as $8tj43$For, getOwner as $8tj43$getOwner, runWithOwner as $8tj43$runWithOwner, createContext as $8tj43$createContext, useContext as $8tj43$useContext, createUniqueId as $8tj43$createUniqueId, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, splitProps as $8tj43$splitProps, on as $8tj43$on, batch as $8tj43$batch, createSelector as $8tj43$createSelector, children as $8tj43$children, createReaction as $8tj43$createReaction, mapArray as $8tj43$mapArray } from "solid-js";
|
|
5
4
|
import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
import { ListenableSet as $8tj43$ListenableSet, catchify as $8tj43$catchify1, use_href_accessor as $8tj43$use_href_accessor1, report as $8tj43$report1 } from "@depict-ai/utilishared/ES10";
|
|
6
6
|
import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
|
|
7
7
|
import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
|
|
8
8
|
import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from "solid-js/store";
|
|
@@ -10,7 +10,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
|
|
|
10
10
|
/*! Depict.ai search and product listing SDK */
|
|
11
11
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
12
12
|
register_es_version("ui", "ES10");
|
|
13
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.3.
|
|
13
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "4.3.2";
|
|
14
14
|
const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
|
|
15
15
|
const cols_at_size = [];
|
|
16
16
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -453,7 +453,7 @@ function $63f1f8dbcd07d3b0$export$d21e32dfedac04be(props) {
|
|
|
453
453
|
const container_class = "x" + $8tj43$createUniqueId();
|
|
454
454
|
const container_element_ = (() => {
|
|
455
455
|
var _el$ = $8tj43$getNextElement($63f1f8dbcd07d3b0$var$_tmpl$);
|
|
456
|
-
$8tj43$spread(_el$, $8tj43$
|
|
456
|
+
$8tj43$spread(_el$, $8tj43$mergeProps1(() => props.element_attributes, {
|
|
457
457
|
"classList": {
|
|
458
458
|
[container_class]: true
|
|
459
459
|
}
|
|
@@ -714,7 +714,7 @@ function $39ddb986053fb759$export$d41d19e89346fa2(_ref) {
|
|
|
714
714
|
} = slider;
|
|
715
715
|
const Layout = props => $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, insert_here, true);
|
|
716
716
|
// Do like this, so we don't have to call mergeProps ourselves
|
|
717
|
-
$8tj43$createComponent(Layout, $8tj43$
|
|
717
|
+
$8tj43$createComponent(Layout, $8tj43$mergeProps1({
|
|
718
718
|
rows: "all",
|
|
719
719
|
layout: "slider"
|
|
720
720
|
}, layout_options_));
|
|
@@ -1031,7 +1031,7 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1031
1031
|
});
|
|
1032
1032
|
// Work around https://github.com/solidjs/solid/issues/1828
|
|
1033
1033
|
const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
|
|
1034
|
-
const [, otherAttributes] = $8tj43$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 <-
|
|
1034
|
+
const [, otherAttributes] = $8tj43$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 <-
|
|
1035
1035
|
]);
|
|
1036
1036
|
|
|
1037
1037
|
const [hasSetSize, setHasSetSize] = $8tj43$createSignal(false);
|
|
@@ -1047,7 +1047,7 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1047
1047
|
if (loading === "force-lazy") return true;
|
|
1048
1048
|
return loading === "lazy" && !isPrioritisedImage();
|
|
1049
1049
|
});
|
|
1050
|
-
const modifiedOtherAttributes = $8tj43$
|
|
1050
|
+
const modifiedOtherAttributes = $8tj43$mergeProps(otherAttributes, {
|
|
1051
1051
|
get loading() {
|
|
1052
1052
|
return shouldActuallyEnableLazyLoading() ? "lazy" : undefined;
|
|
1053
1053
|
}
|
|
@@ -1087,13 +1087,18 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1087
1087
|
let hasDecodedFastPath = false;
|
|
1088
1088
|
let timeoutSet = false;
|
|
1089
1089
|
let gotCleanedUp = false;
|
|
1090
|
+
let srcJustChanged = true;
|
|
1090
1091
|
img.classList.add("s-responsive-image");
|
|
1091
1092
|
if (listingContext) {
|
|
1092
1093
|
let prevValue;
|
|
1093
1094
|
const aspectRatios = listingContext[$56047603f9d212b6$export$f8945274f08a3105] || (listingContext[$56047603f9d212b6$export$f8945274f08a3105] = new Set());
|
|
1094
1095
|
const [, setMostPrevalentAspectRatio] = listingContext[$56047603f9d212b6$export$6066eb417ed2e9f7] || (listingContext[$56047603f9d212b6$export$6066eb417ed2e9f7] = $8tj43$createSignal());
|
|
1095
1096
|
img.addEventListener("load", $8tj43$catchify(() => {
|
|
1096
|
-
|
|
1097
|
+
if (props.keyRatioUpdating) {
|
|
1098
|
+
if (!srcJustChanged) return;
|
|
1099
|
+
srcJustChanged = false;
|
|
1100
|
+
}
|
|
1101
|
+
// 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
|
|
1097
1102
|
const aspectRatio_ = img.naturalWidth / img.naturalHeight;
|
|
1098
1103
|
if (prevValue) aspectRatios.delete(prevValue);
|
|
1099
1104
|
const newValue = !isNaN(aspectRatio_) ? {
|
|
@@ -1114,7 +1119,11 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
|
|
|
1114
1119
|
$8tj43$onCleanup(() => prevValue && aspectRatios.delete(prevValue));
|
|
1115
1120
|
}
|
|
1116
1121
|
$8tj43$onCleanup(() => gotCleanedUp = true);
|
|
1117
|
-
$8tj43$spread(img, $8tj43$
|
|
1122
|
+
$8tj43$spread(img, $8tj43$mergeProps(modifiedOtherAttributes), false, true);
|
|
1123
|
+
$8tj43$createRenderEffect(() => {
|
|
1124
|
+
props.src;
|
|
1125
|
+
srcJustChanged = true;
|
|
1126
|
+
});
|
|
1118
1127
|
$8tj43$createEffect(() => {
|
|
1119
1128
|
if (!props.size()) return; // wait until we have a size, run every time the size changes
|
|
1120
1129
|
if (timeoutSet) return;
|
|
@@ -1182,48 +1191,22 @@ function $4df489344a0f97c7$export$e4b984597b71e989(props) {
|
|
|
1182
1191
|
context[$4df489344a0f97c7$export$d7b7ab832c20e2f4] = $8tj43$createSignal();
|
|
1183
1192
|
const [currentImageSize, setCurrentImageSize] = (context === null || context === void 0 ? void 0 : context[$4df489344a0f97c7$export$d7b7ab832c20e2f4]) || $4df489344a0f97c7$var$backupSizeSignal; // use global fallback signal (might lead to blurry images) if no context is available
|
|
1184
1193
|
const [mostPrevalentAspectRatio] = context ? context[(0, $56047603f9d212b6$export$6066eb417ed2e9f7)] || (context[(0, $56047603f9d212b6$export$6066eb417ed2e9f7)] = $8tj43$createSignal()) : [];
|
|
1185
|
-
const [aspectRatio, setAspectRatio] = $8tj43$createSignal($8tj43$untrack(() => props.aspectRatio));
|
|
1186
1194
|
const container = $801e8845d3fa3653$export$94026ee33dbabc26({
|
|
1187
1195
|
// Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
|
|
1188
1196
|
get class() {
|
|
1189
1197
|
return props.class;
|
|
1190
1198
|
},
|
|
1191
1199
|
get aspectRatio() {
|
|
1192
|
-
|
|
1200
|
+
if (props.autoAdjustAspectRatio) {
|
|
1201
|
+
const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
|
|
1202
|
+
if (targetRatio != undefined) return "var(".concat((0, $5eaa00b951637e96$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
|
|
1203
|
+
}
|
|
1204
|
+
return props.aspectRatio;
|
|
1193
1205
|
}
|
|
1194
1206
|
});
|
|
1195
1207
|
const owner = $8tj43$getOwner();
|
|
1196
1208
|
let createdSizeAccessor = false;
|
|
1197
1209
|
let wasCleanedUp = false;
|
|
1198
|
-
let timeout;
|
|
1199
|
-
$8tj43$createEffect(() => {
|
|
1200
|
-
const {
|
|
1201
|
-
autoAdjustAspectRatio: autoAdjustAspectRatio
|
|
1202
|
-
} = props;
|
|
1203
|
-
if (autoAdjustAspectRatio) {
|
|
1204
|
-
const targetRatio = mostPrevalentAspectRatio === null || mostPrevalentAspectRatio === void 0 ? void 0 : mostPrevalentAspectRatio();
|
|
1205
|
-
if (targetRatio != undefined) {
|
|
1206
|
-
const targetValue = "var(".concat((0, $5eaa00b951637e96$export$8a2234b5b1a5ebd4), ", ").concat(targetRatio, ")");
|
|
1207
|
-
const updateAspectRatio = $8tj43$catchify(() => setAspectRatio(targetValue));
|
|
1208
|
-
if (autoAdjustAspectRatio === "smoothed") {
|
|
1209
|
-
if (!timeout)
|
|
1210
|
-
// 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).
|
|
1211
|
-
updateAspectRatio();
|
|
1212
|
-
clearTimeout(timeout);
|
|
1213
|
-
timeout = setTimeout(() => {
|
|
1214
|
-
timeout = undefined;
|
|
1215
|
-
updateAspectRatio();
|
|
1216
|
-
}, 500);
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
return updateAspectRatio();
|
|
1220
|
-
}
|
|
1221
|
-
} else {
|
|
1222
|
-
clearTimeout(timeout);
|
|
1223
|
-
timeout = undefined;
|
|
1224
|
-
}
|
|
1225
|
-
setAspectRatio(props.aspectRatio);
|
|
1226
|
-
});
|
|
1227
1210
|
$8tj43$createEffect(() => {
|
|
1228
1211
|
if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
|
|
1229
1212
|
// ensure we always have a size accessor
|
|
@@ -1237,7 +1220,7 @@ function $4df489344a0f97c7$export$e4b984597b71e989(props) {
|
|
|
1237
1220
|
$8tj43$queueMacroTask(() => setCurrentImageSize()); // unset the size accessor next event loop iteration, so that all onCleanup's have time to run, since the effects run more aggressively and can create a size accessor with a cleaned up owner otherwise
|
|
1238
1221
|
});
|
|
1239
1222
|
|
|
1240
|
-
$8tj43$insert(container, $8tj43$createComponent((0, $56047603f9d212b6$export$6e5611bc7e57e477), $8tj43$
|
|
1223
|
+
$8tj43$insert(container, $8tj43$createComponent((0, $56047603f9d212b6$export$6e5611bc7e57e477), $8tj43$mergeProps1({
|
|
1241
1224
|
get size() {
|
|
1242
1225
|
return $8tj43$createMemo(() => {
|
|
1243
1226
|
var _currentImageSize;
|
|
@@ -1256,7 +1239,7 @@ function $4df489344a0f97c7$export$e4b984597b71e989(props) {
|
|
|
1256
1239
|
return container;
|
|
1257
1240
|
}
|
|
1258
1241
|
function $98688279b9059f50$export$9d4a4b669b1929ab(props) {
|
|
1259
|
-
return $8tj43$createComponent((0, $4df489344a0f97c7$export$e4b984597b71e989), $8tj43$
|
|
1242
|
+
return $8tj43$createComponent((0, $4df489344a0f97c7$export$e4b984597b71e989), $8tj43$mergeProps1(props, {
|
|
1260
1243
|
get imgProps() {
|
|
1261
1244
|
return {
|
|
1262
1245
|
...props.imgProps,
|
|
@@ -1273,7 +1256,13 @@ function $98688279b9059f50$export$9d4a4b669b1929ab(props) {
|
|
|
1273
1256
|
}
|
|
1274
1257
|
}));
|
|
1275
1258
|
}
|
|
1276
|
-
|
|
1259
|
+
function $60ec7a29849d81db$export$a71e92cfbb498adc(props) {
|
|
1260
|
+
return $8tj43$createMemo(() => {
|
|
1261
|
+
const price_formatting = props.price_formatting_;
|
|
1262
|
+
return $8tj43$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
var $0c5b1686f971e5e7$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=img-wrapper>`),
|
|
1277
1266
|
$0c5b1686f971e5e7$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span class="d-price original">`),
|
|
1278
1267
|
$0c5b1686f971e5e7$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=right-part><div class=text-container><span class="d-title line-clamp"></span><span class=d-price></span><!$><!/></div><!$><!/>`),
|
|
1279
1268
|
$0c5b1686f971e5e7$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<a class=look-item><!$><!/><!$><!/>`);
|
|
@@ -1284,23 +1273,17 @@ function $0c5b1686f971e5e7$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1284
1273
|
isExpanded_: isExpanded_,
|
|
1285
1274
|
textFadeInAnimationRunning_: textFadeInAnimationRunning_,
|
|
1286
1275
|
outerRef_: outerRef_,
|
|
1287
|
-
animationDuration_: animationDuration_
|
|
1276
|
+
animationDuration_: animationDuration_,
|
|
1277
|
+
priceFormatting_: priceFormatting_,
|
|
1278
|
+
pseudoRouter_: pseudoRouter_
|
|
1288
1279
|
} = _ref;
|
|
1289
1280
|
const variantToUse = $8tj43$createMemo(() => {
|
|
1290
1281
|
const display = display_();
|
|
1291
1282
|
return display === null || display === void 0 ? void 0 : display.variant_displays[display === null || display === void 0 ? void 0 : display.variant_index];
|
|
1292
1283
|
});
|
|
1293
|
-
const imageUrls = () => {
|
|
1294
|
-
var _variantToUse;
|
|
1295
|
-
return (_variantToUse = variantToUse()) === null || _variantToUse === void 0 ? void 0 : _variantToUse.image_urls;
|
|
1296
|
-
};
|
|
1297
1284
|
const imageUrl = $8tj43$createMemo(() => {
|
|
1298
|
-
var
|
|
1299
|
-
return (
|
|
1300
|
-
});
|
|
1301
|
-
const secondaryImageUrl = $8tj43$createMemo(() => {
|
|
1302
|
-
var _imageUrls2;
|
|
1303
|
-
return (_imageUrls2 = imageUrls()) === null || _imageUrls2 === void 0 ? void 0 : _imageUrls2[1];
|
|
1285
|
+
var _variantToUse, _variantToUse$image_u;
|
|
1286
|
+
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];
|
|
1304
1287
|
});
|
|
1305
1288
|
const [animationIsRunning, setAnimationIsRunning] = textFadeInAnimationRunning_;
|
|
1306
1289
|
const [isExpandedThrottledByOurEffectRun, setIsExpandedThrottledByOurEffectRun] = $8tj43$createSignal($8tj43$untrack(isExpanded_));
|
|
@@ -1313,21 +1296,31 @@ function $0c5b1686f971e5e7$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1313
1296
|
var _variantToUse3;
|
|
1314
1297
|
return (_variantToUse3 = variantToUse()) === null || _variantToUse3 === void 0 ? void 0 : _variantToUse3.original_price;
|
|
1315
1298
|
});
|
|
1316
|
-
const isOnSale = $8tj43$createMemo(() => salePrice.latest !== originalPrice.latest); // .latest doesn't trigger suspense
|
|
1299
|
+
const isOnSale = $8tj43$createMemo(() => !salePrice.loading && !originalPrice.loading && salePrice.latest !== originalPrice.latest); // .latest doesn't trigger suspense after the initial load
|
|
1300
|
+
const enableLink = $8tj43$createMemo(() => isExpanded_() && !animationIsRunning());
|
|
1301
|
+
const href = $8tj43$createMemo(() => {
|
|
1302
|
+
var _variantToUse4;
|
|
1303
|
+
return (_variantToUse4 = variantToUse()) === null || _variantToUse4 === void 0 ? void 0 : _variantToUse4.page_url;
|
|
1304
|
+
});
|
|
1317
1305
|
const FavoriteButton = FavoriteButton_; // Just to get rid of the type error - TS doesn't understand <Show>
|
|
1318
1306
|
return (() => {
|
|
1319
1307
|
var _el$ = $8tj43$getNextElement($0c5b1686f971e5e7$var$_tmpl$4),
|
|
1320
|
-
_el$
|
|
1321
|
-
[_el$
|
|
1322
|
-
_el$
|
|
1323
|
-
[_el$
|
|
1308
|
+
_el$12 = _el$.firstChild,
|
|
1309
|
+
[_el$13, _co$3] = $8tj43$getNextMarker(_el$12.nextSibling),
|
|
1310
|
+
_el$14 = _el$13.nextSibling,
|
|
1311
|
+
[_el$15, _co$4] = $8tj43$getNextMarker(_el$14.nextSibling);
|
|
1324
1312
|
var _ref$ = outerRef_;
|
|
1325
1313
|
typeof _ref$ === "function" ? $8tj43$use(_ref$, _el$) : outerRef_ = _el$;
|
|
1326
|
-
$8tj43$spread(_el$, $8tj43$
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1314
|
+
$8tj43$spread(_el$, $8tj43$mergeProps1(() => enableLink() ? {
|
|
1315
|
+
href: href()
|
|
1316
|
+
} : {}, {
|
|
1317
|
+
get onClick() {
|
|
1318
|
+
return $8tj43$catchify(event_ => enableLink() && pseudoRouter_.navigate_.go_to_({
|
|
1319
|
+
new_url_: href(),
|
|
1320
|
+
is_replace_: false,
|
|
1321
|
+
event_: event_
|
|
1322
|
+
}));
|
|
1323
|
+
}
|
|
1331
1324
|
}), false, true);
|
|
1332
1325
|
$8tj43$insert(_el$, $8tj43$createComponent((0, $8tj43$Show), {
|
|
1333
1326
|
when: imageUrl,
|
|
@@ -1337,11 +1330,7 @@ function $0c5b1686f971e5e7$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1337
1330
|
});
|
|
1338
1331
|
},
|
|
1339
1332
|
get children() {
|
|
1340
|
-
var _el$2 = $8tj43$getNextElement($0c5b1686f971e5e7$var$_tmpl$)
|
|
1341
|
-
_el$3 = _el$2.firstChild,
|
|
1342
|
-
[_el$4, _co$] = $8tj43$getNextMarker(_el$3.nextSibling),
|
|
1343
|
-
_el$5 = _el$4.nextSibling,
|
|
1344
|
-
[_el$6, _co$2] = $8tj43$getNextMarker(_el$5.nextSibling);
|
|
1333
|
+
var _el$2 = $8tj43$getNextElement($0c5b1686f971e5e7$var$_tmpl$);
|
|
1345
1334
|
$8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
|
|
1346
1335
|
get when() {
|
|
1347
1336
|
return imageUrl();
|
|
@@ -1360,46 +1349,30 @@ function $0c5b1686f971e5e7$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1360
1349
|
return isExpanded_() ? 0.75 : 1;
|
|
1361
1350
|
},
|
|
1362
1351
|
get autoAdjustAspectRatio() {
|
|
1363
|
-
return isExpanded_()
|
|
1364
|
-
}
|
|
1365
|
-
});
|
|
1366
|
-
}
|
|
1367
|
-
}), _el$4, _co$);
|
|
1368
|
-
$8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
|
|
1369
|
-
get when() {
|
|
1370
|
-
return secondaryImageUrl();
|
|
1371
|
-
},
|
|
1372
|
-
get children() {
|
|
1373
|
-
return $8tj43$createComponent((0, $98688279b9059f50$export$9d4a4b669b1929ab), {
|
|
1374
|
-
get src() {
|
|
1375
|
-
return secondaryImageUrl();
|
|
1376
|
-
},
|
|
1377
|
-
get aspectRatio() {
|
|
1378
|
-
return isExpanded_() ? 0.75 : 1;
|
|
1352
|
+
return isExpanded_();
|
|
1379
1353
|
},
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
return isExpanded_() ? "smoothed" : false;
|
|
1354
|
+
imgProps: {
|
|
1355
|
+
keyRatioUpdating: true
|
|
1383
1356
|
}
|
|
1384
1357
|
});
|
|
1385
1358
|
}
|
|
1386
|
-
})
|
|
1359
|
+
}));
|
|
1387
1360
|
return _el$2;
|
|
1388
1361
|
}
|
|
1389
|
-
}), _el$
|
|
1362
|
+
}), _el$13, _co$3);
|
|
1390
1363
|
$8tj43$insert(_el$, $8tj43$createComponent((0, $8tj43$Show), {
|
|
1391
1364
|
get when() {
|
|
1392
1365
|
return (animationEffectExists() ? isExpandedThrottledByOurEffectRun() : isExpanded_()) || animationIsRunning();
|
|
1393
1366
|
},
|
|
1394
1367
|
get children() {
|
|
1395
|
-
var _el$
|
|
1396
|
-
_el$
|
|
1397
|
-
_el$
|
|
1398
|
-
_el$
|
|
1399
|
-
_el$
|
|
1400
|
-
[_el$
|
|
1401
|
-
_el$
|
|
1402
|
-
[_el$
|
|
1368
|
+
var _el$3 = $8tj43$getNextElement($0c5b1686f971e5e7$var$_tmpl$3),
|
|
1369
|
+
_el$4 = _el$3.firstChild,
|
|
1370
|
+
_el$5 = _el$4.firstChild,
|
|
1371
|
+
_el$6 = _el$5.nextSibling,
|
|
1372
|
+
_el$8 = _el$6.nextSibling,
|
|
1373
|
+
[_el$9, _co$] = $8tj43$getNextMarker(_el$8.nextSibling),
|
|
1374
|
+
_el$10 = _el$4.nextSibling,
|
|
1375
|
+
[_el$11, _co$2] = $8tj43$getNextMarker(_el$10.nextSibling);
|
|
1403
1376
|
$8tj43$use(element => {
|
|
1404
1377
|
const owner = $8tj43$getOwner();
|
|
1405
1378
|
$8tj43$onCleanup((0, $8tj43$observer).onexists(element, _ref2 => {
|
|
@@ -1432,49 +1405,91 @@ function $0c5b1686f971e5e7$export$b73ed90f0ee50dc3(_ref) {
|
|
|
1432
1405
|
for (const ev of ["cancel", "finish"]) textContainerAnimation.addEventListener(ev, $8tj43$catchify(() => setAnimationIsRunning(false)));
|
|
1433
1406
|
disconnector();
|
|
1434
1407
|
}));
|
|
1435
|
-
}, _el$
|
|
1436
|
-
$8tj43$insert(_el$
|
|
1408
|
+
}, _el$3);
|
|
1409
|
+
$8tj43$insert(_el$5, () => {
|
|
1437
1410
|
var _variantToUse$title, _variantToUse5;
|
|
1438
1411
|
return (_variantToUse$title = (_variantToUse5 = variantToUse()) === null || _variantToUse5 === void 0 ? void 0 : _variantToUse5.title) !== null && _variantToUse$title !== void 0 ? _variantToUse$title : $8tj43$createComponent((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
|
|
1439
1412
|
height: "1em",
|
|
1440
1413
|
width: "20ch"
|
|
1441
1414
|
});
|
|
1442
1415
|
});
|
|
1443
|
-
$8tj43$insert(_el$
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1416
|
+
$8tj43$insert(_el$6, $8tj43$createComponent((0, $8tj43$Show), {
|
|
1417
|
+
get when() {
|
|
1418
|
+
return variantToUse() && !salePrice.loading;
|
|
1419
|
+
},
|
|
1420
|
+
get fallback() {
|
|
1421
|
+
return $8tj43$createComponent((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
|
|
1422
|
+
height: "1em",
|
|
1423
|
+
width: "20ch"
|
|
1424
|
+
});
|
|
1425
|
+
},
|
|
1426
|
+
get children() {
|
|
1427
|
+
return $8tj43$createComponent((0, $8tj43$Show), {
|
|
1428
|
+
get when() {
|
|
1429
|
+
return salePrice.latest;
|
|
1430
|
+
},
|
|
1431
|
+
get children() {
|
|
1432
|
+
return [$8tj43$memo(() => priceFormatting_().pre_), $8tj43$createComponent((0, $60ec7a29849d81db$export$a71e92cfbb498adc), {
|
|
1433
|
+
get price_() {
|
|
1434
|
+
return salePrice();
|
|
1435
|
+
},
|
|
1436
|
+
get price_formatting_() {
|
|
1437
|
+
return priceFormatting_();
|
|
1438
|
+
}
|
|
1439
|
+
}), $8tj43$memo(() => priceFormatting_().post_)];
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
}
|
|
1443
|
+
}));
|
|
1444
|
+
$8tj43$insert(_el$4, $8tj43$createComponent((0, $8tj43$Show), {
|
|
1451
1445
|
get when() {
|
|
1452
1446
|
return isOnSale();
|
|
1453
1447
|
},
|
|
1454
1448
|
get children() {
|
|
1455
|
-
var _el$
|
|
1456
|
-
$8tj43$insert(_el$
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1449
|
+
var _el$7 = $8tj43$getNextElement($0c5b1686f971e5e7$var$_tmpl$2);
|
|
1450
|
+
$8tj43$insert(_el$7, $8tj43$createComponent((0, $8tj43$Show), {
|
|
1451
|
+
get when() {
|
|
1452
|
+
return variantToUse() && !originalPrice.loading;
|
|
1453
|
+
},
|
|
1454
|
+
get fallback() {
|
|
1455
|
+
return $8tj43$createComponent((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
|
|
1456
|
+
height: "1em",
|
|
1457
|
+
width: "20ch"
|
|
1458
|
+
});
|
|
1459
|
+
},
|
|
1460
|
+
get children() {
|
|
1461
|
+
return $8tj43$createComponent((0, $8tj43$Show), {
|
|
1462
|
+
get when() {
|
|
1463
|
+
return salePrice.latest;
|
|
1464
|
+
},
|
|
1465
|
+
get children() {
|
|
1466
|
+
return [$8tj43$memo(() => priceFormatting_().pre_), $8tj43$createComponent((0, $60ec7a29849d81db$export$a71e92cfbb498adc), {
|
|
1467
|
+
get price_() {
|
|
1468
|
+
return originalPrice();
|
|
1469
|
+
},
|
|
1470
|
+
get price_formatting_() {
|
|
1471
|
+
return priceFormatting_();
|
|
1472
|
+
}
|
|
1473
|
+
}), $8tj43$memo(() => priceFormatting_().post_)];
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
}));
|
|
1478
|
+
return _el$7;
|
|
1464
1479
|
}
|
|
1465
|
-
}), _el$
|
|
1466
|
-
$8tj43$insert(_el$
|
|
1480
|
+
}), _el$9, _co$);
|
|
1481
|
+
$8tj43$insert(_el$3, $8tj43$createComponent((0, $8tj43$Show), {
|
|
1467
1482
|
when: FavoriteButton_,
|
|
1468
1483
|
get children() {
|
|
1469
1484
|
return $8tj43$createComponent(FavoriteButton, {
|
|
1470
1485
|
display_: display_
|
|
1471
1486
|
});
|
|
1472
1487
|
}
|
|
1473
|
-
}), _el$
|
|
1474
|
-
$8tj43$effect(() => _el$
|
|
1475
|
-
return _el$
|
|
1488
|
+
}), _el$11, _co$2);
|
|
1489
|
+
$8tj43$effect(() => _el$6.classList.toggle("sale", !!isOnSale()));
|
|
1490
|
+
return _el$3;
|
|
1476
1491
|
}
|
|
1477
|
-
}), _el$
|
|
1492
|
+
}), _el$15, _co$4);
|
|
1478
1493
|
$8tj43$runHydrationEvents();
|
|
1479
1494
|
return _el$;
|
|
1480
1495
|
})();
|
|
@@ -1537,7 +1552,9 @@ function $4089a7972a508539$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1537
1552
|
userWantsExpandedSignal_: [userWantsExpanded, setUserWantsExpanded],
|
|
1538
1553
|
containerWidth_: containerWidth_,
|
|
1539
1554
|
animationDuration_: animationDuration_,
|
|
1540
|
-
supportsHover_: supportsHover_
|
|
1555
|
+
supportsHover_: supportsHover_,
|
|
1556
|
+
priceFormatting_: priceFormatting_,
|
|
1557
|
+
pseudoRouter_: pseudoRouter_
|
|
1541
1558
|
} = _ref;
|
|
1542
1559
|
let isAffectedByChromeBug = false;
|
|
1543
1560
|
// If the user requests the drawer to be expanded or not
|
|
@@ -1567,7 +1584,7 @@ function $4089a7972a508539$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1567
1584
|
behavior: "smooth"
|
|
1568
1585
|
});
|
|
1569
1586
|
}), _el$2);
|
|
1570
|
-
$8tj43$spread(_el$2, $8tj43$
|
|
1587
|
+
$8tj43$spread(_el$2, $8tj43$mergeProps1({
|
|
1571
1588
|
get classList() {
|
|
1572
1589
|
return {
|
|
1573
1590
|
expanded: userWantsExpanded(),
|
|
@@ -1591,11 +1608,13 @@ function $4089a7972a508539$export$ebf0b1d4f90c09ae(_ref) {
|
|
|
1591
1608
|
},
|
|
1592
1609
|
children: (display, index) => {
|
|
1593
1610
|
return $8tj43$createComponent((0, $0c5b1686f971e5e7$export$b73ed90f0ee50dc3), {
|
|
1611
|
+
pseudoRouter_: pseudoRouter_,
|
|
1594
1612
|
animationDuration_: animationDuration_,
|
|
1595
1613
|
display_: display,
|
|
1596
1614
|
FavoriteButton_: FavoriteButton_,
|
|
1597
1615
|
isExpanded_: userWantsExpanded,
|
|
1598
1616
|
textFadeInAnimationRunning_: textFadeInAnimationRunning,
|
|
1617
|
+
priceFormatting_: priceFormatting_,
|
|
1599
1618
|
outerRef_: el => $8tj43$createEffect(() => {
|
|
1600
1619
|
if (index !== 0) return;
|
|
1601
1620
|
const resizeObserver = new ResizeObserver($8tj43$catchify(records => setLookItemHeight(records.at(-1).contentRect.height)));
|
|
@@ -1639,10 +1658,10 @@ function $697d8713dc82b9ab$export$44809a8a3e867e30(_ref) {
|
|
|
1639
1658
|
expandedLooksSignal_: [expandedLooks_, setExpandedLooks],
|
|
1640
1659
|
FavoriteButton_: FavoriteButton_,
|
|
1641
1660
|
placeholderImageAspectRatio_: placeholderImageAspectRatio_,
|
|
1642
|
-
animationDuration_: animationDuration_
|
|
1661
|
+
animationDuration_: animationDuration_,
|
|
1662
|
+
priceFormatting_: priceFormatting_,
|
|
1663
|
+
pseudoRouter_: pseudoRouter_
|
|
1643
1664
|
} = _ref;
|
|
1644
|
-
// TODO: shopify, run displayTransformers to get dynamic prices
|
|
1645
|
-
// TODO: format prices
|
|
1646
1665
|
const [coverImage] = (display_ === null || display_ === void 0 ? void 0 : display_.image_urls) || [];
|
|
1647
1666
|
const useWantsExpandedSignal_ = $8tj43$createSignal(false);
|
|
1648
1667
|
const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
|
|
@@ -1650,16 +1669,23 @@ function $697d8713dc82b9ab$export$44809a8a3e867e30(_ref) {
|
|
|
1650
1669
|
const us = Symbol("look");
|
|
1651
1670
|
const container = (() => {
|
|
1652
1671
|
var _el$ = $8tj43$getNextElement($697d8713dc82b9ab$var$_tmpl$);
|
|
1653
|
-
$8tj43$addEventListener(_el$, "click", $8tj43$catchify(
|
|
1672
|
+
$8tj43$addEventListener(_el$, "click", $8tj43$catchify(_ref2 => {
|
|
1673
|
+
let {
|
|
1674
|
+
target: target
|
|
1675
|
+
} = _ref2;
|
|
1676
|
+
// Don't toggle when clicking on the links
|
|
1677
|
+
if (target.matches("a") || target.closest("a")) return;
|
|
1678
|
+
setUserWantsExpanded(prev => !prev);
|
|
1679
|
+
}), true);
|
|
1654
1680
|
_el$.classList.toggle("placeholder", !!!display_);
|
|
1655
1681
|
$8tj43$runHydrationEvents();
|
|
1656
1682
|
return _el$;
|
|
1657
1683
|
})();
|
|
1658
1684
|
const containerWidth_ = $fc830a7ee59416ef$export$ebdc3711f7e02ccd(container);
|
|
1659
|
-
const clickHandler = $8tj43$catchify(
|
|
1685
|
+
const clickHandler = $8tj43$catchify(_ref3 => {
|
|
1660
1686
|
let {
|
|
1661
1687
|
target: target
|
|
1662
|
-
} =
|
|
1688
|
+
} = _ref3;
|
|
1663
1689
|
if (target !== container && !container.contains(target))
|
|
1664
1690
|
// When clicking outside the look, close it
|
|
1665
1691
|
setUserWantsExpanded(false);
|
|
@@ -1681,7 +1707,7 @@ function $697d8713dc82b9ab$export$44809a8a3e867e30(_ref) {
|
|
|
1681
1707
|
when: display_,
|
|
1682
1708
|
get fallback() {
|
|
1683
1709
|
return $8tj43$createComponent((0, $3ab4aa97880fb88d$export$3f37af283f8fb843), {
|
|
1684
|
-
aspectRatio: placeholderImageAspectRatio_
|
|
1710
|
+
aspectRatio: "var(".concat((0, $5eaa00b951637e96$export$8a2234b5b1a5ebd4), ", ").concat(placeholderImageAspectRatio_, ")")
|
|
1685
1711
|
});
|
|
1686
1712
|
},
|
|
1687
1713
|
get children() {
|
|
@@ -1699,11 +1725,137 @@ function $697d8713dc82b9ab$export$44809a8a3e867e30(_ref) {
|
|
|
1699
1725
|
containerWidth_: containerWidth_,
|
|
1700
1726
|
animationDuration_: animationDuration_,
|
|
1701
1727
|
supportsHover_: supportsHover_,
|
|
1702
|
-
FavoriteButton_: FavoriteButton_
|
|
1728
|
+
FavoriteButton_: FavoriteButton_,
|
|
1729
|
+
priceFormatting_: priceFormatting_,
|
|
1730
|
+
pseudoRouter_: pseudoRouter_
|
|
1703
1731
|
})]);
|
|
1704
1732
|
return container;
|
|
1705
1733
|
}
|
|
1706
1734
|
$8tj43$delegateEvents(["click"]);
|
|
1735
|
+
|
|
1736
|
+
/**
|
|
1737
|
+
* 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
|
|
1738
|
+
* @param clickEvent The click event that triggered the navigation
|
|
1739
|
+
*/
|
|
1740
|
+
function $9b35d1384e31813a$export$29d28dadc2d6b631(clickEvent) {
|
|
1741
|
+
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
|
|
1742
|
+
);
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
function $ac571292d606f30b$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
1746
|
+
$ac571292d606f30b$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
1747
|
+
privateSet.add(obj);
|
|
1748
|
+
}
|
|
1749
|
+
function $ac571292d606f30b$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
1750
|
+
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
1751
|
+
}
|
|
1752
|
+
function $ac571292d606f30b$var$_classPrivateMethodGet(receiver, privateSet, fn) {
|
|
1753
|
+
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
1754
|
+
return fn;
|
|
1755
|
+
}
|
|
1756
|
+
var $ac571292d606f30b$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
|
|
1757
|
+
var $ac571292d606f30b$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
|
|
1758
|
+
class $ac571292d606f30b$export$7e1297a3a19f10d8 {
|
|
1759
|
+
/**
|
|
1760
|
+
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
1761
|
+
*/ /**
|
|
1762
|
+
* 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
|
|
1763
|
+
*/ /**
|
|
1764
|
+
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
1765
|
+
* This standardises waiting for all kinds of routers
|
|
1766
|
+
*/
|
|
1767
|
+
constructor(on_navigation, listing_query_state_key) {
|
|
1768
|
+
$ac571292d606f30b$var$_classPrivateMethodInitSpec(this, $ac571292d606f30b$var$_get_navigation_happened_promise);
|
|
1769
|
+
$ac571292d606f30b$var$_classPrivateMethodInitSpec(this, $ac571292d606f30b$var$_throwing_on_navigation);
|
|
1770
|
+
$8tj43$babelruntimehelpersdefineProperty(this, "on_navigation_", void 0);
|
|
1771
|
+
$8tj43$babelruntimehelpersdefineProperty(this, "listing_query_state_key", void 0);
|
|
1772
|
+
$8tj43$babelruntimehelpersdefineProperty(this, "navigate_", {
|
|
1773
|
+
/**
|
|
1774
|
+
* Call this if you *just* want to replace the state object in history.state
|
|
1775
|
+
*/
|
|
1776
|
+
replace_state_: new_state => {
|
|
1777
|
+
var _globalThis$history;
|
|
1778
|
+
// 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
|
|
1779
|
+
globalThis === null || globalThis === void 0 || (_globalThis$history = globalThis.history) === null || _globalThis$history === void 0 || _globalThis$history.replaceState(new_state, "");
|
|
1780
|
+
},
|
|
1781
|
+
/**
|
|
1782
|
+
* Call this to change the URL
|
|
1783
|
+
* @param new_url_ new URL to go to
|
|
1784
|
+
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
1785
|
+
* @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
|
|
1786
|
+
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
1787
|
+
* @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
|
|
1788
|
+
*/
|
|
1789
|
+
go_to_: $8tj43$catchify(async _ref => {
|
|
1790
|
+
let {
|
|
1791
|
+
new_url_: raw_new_url,
|
|
1792
|
+
event_: event_,
|
|
1793
|
+
force_spa_navigation_: force_spa_navigation_,
|
|
1794
|
+
is_replace_: is_replace_,
|
|
1795
|
+
listing_query_: listing_query_,
|
|
1796
|
+
scroll = true
|
|
1797
|
+
} = _ref;
|
|
1798
|
+
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
1799
|
+
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
1800
|
+
if ($9b35d1384e31813a$export$29d28dadc2d6b631(event_)) return;
|
|
1801
|
+
const different_origin = new_url_.origin !== location.origin;
|
|
1802
|
+
if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
|
|
1803
|
+
if (force_spa_navigation_ && different_origin)
|
|
1804
|
+
// If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
|
|
1805
|
+
$8tj43$dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
|
|
1806
|
+
if (!event_)
|
|
1807
|
+
// If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
1808
|
+
location.assign(new_url_);
|
|
1809
|
+
return;
|
|
1810
|
+
}
|
|
1811
|
+
event_ === null || event_ === void 0 || event_.preventDefault();
|
|
1812
|
+
const promise = $ac571292d606f30b$var$_classPrivateMethodGet(this, $ac571292d606f30b$var$_get_navigation_happened_promise, $ac571292d606f30b$var$_get_navigation_happened_promise2).call(this, true);
|
|
1813
|
+
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
1814
|
+
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
1815
|
+
const new_state = history.state;
|
|
1816
|
+
if (listing_query_) {
|
|
1817
|
+
// In JS-UI we need to know the listing_id of the current category, therefore push it into state
|
|
1818
|
+
if (!this.listing_query_state_key) $8tj43$report(new Error("listing_query_state_key is not set"), "error");
|
|
1819
|
+
new_state[this.listing_query_state_key] = listing_query_;
|
|
1820
|
+
}
|
|
1821
|
+
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
1822
|
+
} else $ac571292d606f30b$var$_classPrivateMethodGet(this, $ac571292d606f30b$var$_throwing_on_navigation, $ac571292d606f30b$var$_throwing_on_navigation2).call(this, {
|
|
1823
|
+
is_replace: is_replace_,
|
|
1824
|
+
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
1825
|
+
scroll: scroll
|
|
1826
|
+
});
|
|
1827
|
+
await promise;
|
|
1828
|
+
})
|
|
1829
|
+
});
|
|
1830
|
+
this.listing_query_state_key = listing_query_state_key;
|
|
1831
|
+
this.on_navigation_ = on_navigation;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
function $ac571292d606f30b$var$_throwing_on_navigation2() {
|
|
1835
|
+
const {
|
|
1836
|
+
on_navigation_: on_navigation_
|
|
1837
|
+
} = this;
|
|
1838
|
+
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
1839
|
+
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
1840
|
+
try {
|
|
1841
|
+
return on_navigation_(...arguments);
|
|
1842
|
+
} catch (e) {
|
|
1843
|
+
queueMicrotask(() => {
|
|
1844
|
+
throw e;
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
function $ac571292d606f30b$var$_get_navigation_happened_promise2(is_replace) {
|
|
1849
|
+
return new Promise(resolve => {
|
|
1850
|
+
const handler = what_happened => {
|
|
1851
|
+
if (what_happened === (is_replace ? "replaceState" : "pushState")) {
|
|
1852
|
+
resolve();
|
|
1853
|
+
(0, $8tj43$instant_exec_on_suspect_history_change).delete(handler);
|
|
1854
|
+
}
|
|
1855
|
+
};
|
|
1856
|
+
(0, $8tj43$instant_exec_on_suspect_history_change).add(handler);
|
|
1857
|
+
});
|
|
1858
|
+
}
|
|
1707
1859
|
var $cee56a95f722f55f$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class="depict recommendations looks"style=--animation-duration:240ms>`);
|
|
1708
1860
|
let $cee56a95f722f55f$var$expandedLooksSignal_;
|
|
1709
1861
|
function $cee56a95f722f55f$export$1935e6bdfc5ed8ce(props) {
|
|
@@ -1712,6 +1864,7 @@ function $cee56a95f722f55f$export$1935e6bdfc5ed8ce(props) {
|
|
|
1712
1864
|
equals: false
|
|
1713
1865
|
}));
|
|
1714
1866
|
const expandingAnimationDuration = 240;
|
|
1867
|
+
const pseudoRouter = new (0, $ac571292d606f30b$export$7e1297a3a19f10d8)("hard_navigation");
|
|
1715
1868
|
const grid_spacing_override = $8tj43$createMemo(() => {
|
|
1716
1869
|
const {
|
|
1717
1870
|
gridSpacing_: gridSpacing_
|
|
@@ -1739,21 +1892,37 @@ function $cee56a95f722f55f$export$1935e6bdfc5ed8ce(props) {
|
|
|
1739
1892
|
});
|
|
1740
1893
|
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));
|
|
1741
1894
|
if (!decoded)
|
|
1742
|
-
// If network fails, make sure to return empty array
|
|
1895
|
+
// If network fails, make sure to return empty array and SolidRecommendationSlider will remove its elements
|
|
1743
1896
|
return [];
|
|
1744
|
-
|
|
1897
|
+
const {
|
|
1898
|
+
listings: listings
|
|
1899
|
+
} = decoded;
|
|
1900
|
+
const baseData = {
|
|
1901
|
+
merchant: merchant,
|
|
1902
|
+
market: market,
|
|
1903
|
+
locale: locale
|
|
1904
|
+
};
|
|
1905
|
+
return $cee56a95f722f55f$var$runDisplayTransformersForLooks(baseData, listings, props.displayTransformers_);
|
|
1906
|
+
});
|
|
1907
|
+
$8tj43$createEffect(() => {
|
|
1908
|
+
const {
|
|
1909
|
+
onNavigation_: onNavigation_
|
|
1910
|
+
} = props;
|
|
1911
|
+
if (onNavigation_) pseudoRouter.on_navigation_ = onNavigation_;
|
|
1745
1912
|
});
|
|
1746
1913
|
return (() => {
|
|
1747
1914
|
var _el$ = $8tj43$getNextElement($cee56a95f722f55f$var$_tmpl$);
|
|
1748
1915
|
$8tj43$insert(_el$, $8tj43$createComponent((0, $5441862cd2f5e111$export$e68cff63f76bd15b), {
|
|
1749
1916
|
get children() {
|
|
1750
1917
|
return $39ddb986053fb759$export$d41d19e89346fa2({
|
|
1751
|
-
product_card_template_:
|
|
1918
|
+
product_card_template_: display => $697d8713dc82b9ab$export$44809a8a3e867e30({
|
|
1752
1919
|
display_: display,
|
|
1753
1920
|
FavoriteButton_: props.FavoriteButton_,
|
|
1754
1921
|
placeholderImageAspectRatio_: props.imagePlaceholderAspectRatio_,
|
|
1755
1922
|
animationDuration_: expandingAnimationDuration,
|
|
1756
|
-
expandedLooksSignal_: $cee56a95f722f55f$var$expandedLooksSignal_
|
|
1923
|
+
expandedLooksSignal_: $cee56a95f722f55f$var$expandedLooksSignal_,
|
|
1924
|
+
priceFormatting_: () => props.priceFormatting_,
|
|
1925
|
+
pseudoRouter_: pseudoRouter
|
|
1757
1926
|
}),
|
|
1758
1927
|
recommendations_resource_: looksResource,
|
|
1759
1928
|
title_: () => props.title_,
|
|
@@ -1768,6 +1937,58 @@ function $cee56a95f722f55f$export$1935e6bdfc5ed8ce(props) {
|
|
|
1768
1937
|
})();
|
|
1769
1938
|
}, "LookSlider failed");
|
|
1770
1939
|
}
|
|
1940
|
+
async function $cee56a95f722f55f$var$runDisplayTransformersForLooks(baseData, listings, displayTransformers) {
|
|
1941
|
+
try {
|
|
1942
|
+
const {
|
|
1943
|
+
products: productTransformer,
|
|
1944
|
+
categories: providedListingTransformer
|
|
1945
|
+
} = displayTransformers || {};
|
|
1946
|
+
if (!productTransformer && !providedListingTransformer) return listings;
|
|
1947
|
+
const listingTransformer = providedListingTransformer || (_ref3 => {
|
|
1948
|
+
let {
|
|
1949
|
+
data: data
|
|
1950
|
+
} = _ref3;
|
|
1951
|
+
return data;
|
|
1952
|
+
});
|
|
1953
|
+
const displaysToTransform = [];
|
|
1954
|
+
const displayIdsPerListingId = {};
|
|
1955
|
+
const transformedListingsPromise = listingTransformer({
|
|
1956
|
+
...baseData,
|
|
1957
|
+
data: listings.map(_ref4 => {
|
|
1958
|
+
let {
|
|
1959
|
+
displays: displays,
|
|
1960
|
+
...listing
|
|
1961
|
+
} = _ref4;
|
|
1962
|
+
// Populate our displays by id and displayIdToListings object in the .map where we add ancestors to the listings, for peak efficiency
|
|
1963
|
+
for (let i = 0; i < displays.length; i++) {
|
|
1964
|
+
var _listing$listing_id;
|
|
1965
|
+
const display = displays[i];
|
|
1966
|
+
const uniqueIdOfDisplay = $6a4c7ed6d005505c$export$548d053aba053d79(display);
|
|
1967
|
+
displaysToTransform.push(display);
|
|
1968
|
+
(displayIdsPerListingId[_listing$listing_id = listing.listing_id] || (displayIdsPerListingId[_listing$listing_id] = [])).push(uniqueIdOfDisplay);
|
|
1969
|
+
}
|
|
1970
|
+
return {
|
|
1971
|
+
...listing,
|
|
1972
|
+
ancestors: []
|
|
1973
|
+
};
|
|
1974
|
+
})
|
|
1975
|
+
});
|
|
1976
|
+
// This allows the person providing the displayTransformer to re-order and remove displays
|
|
1977
|
+
const transformedProducts = productTransformer ? await productTransformer({
|
|
1978
|
+
...baseData,
|
|
1979
|
+
displays: displaysToTransform
|
|
1980
|
+
}) : displaysToTransform;
|
|
1981
|
+
const transformedListings = await transformedListingsPromise;
|
|
1982
|
+
const transformedDisplayById = Object.fromEntries(transformedProducts.map(display => [$6a4c7ed6d005505c$export$548d053aba053d79(display), display]));
|
|
1983
|
+
return transformedListings.map(listing => $8tj43$mergeProps(listing, {
|
|
1984
|
+
// use mergeProps because in preview browser we add getters in this object, that would be called too early otherwise
|
|
1985
|
+
displays: (displayIdsPerListingId[listing.listing_id] || []).map(displayId => transformedDisplayById[displayId]).filter(v => v)
|
|
1986
|
+
}));
|
|
1987
|
+
} catch (e) {
|
|
1988
|
+
$8tj43$dwarn("Displaytransformers threw", e);
|
|
1989
|
+
return [];
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1771
1992
|
const $68e6625c8d51f847$export$3064e1e8c6513da3 = new Set();
|
|
1772
1993
|
let $68e6625c8d51f847$var$has_ran = false;
|
|
1773
1994
|
function $68e6625c8d51f847$export$5162a71f252e6122() {
|
|
@@ -1809,15 +2030,6 @@ function $68e6625c8d51f847$var$starts_with_any_prefix(key) {
|
|
|
1809
2030
|
}
|
|
1810
2031
|
}
|
|
1811
2032
|
|
|
1812
|
-
/**
|
|
1813
|
-
* 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
|
|
1814
|
-
* @param clickEvent The click event that triggered the navigation
|
|
1815
|
-
*/
|
|
1816
|
-
function $9b35d1384e31813a$export$29d28dadc2d6b631(clickEvent) {
|
|
1817
|
-
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
|
|
1818
|
-
);
|
|
1819
|
-
}
|
|
1820
|
-
|
|
1821
2033
|
/**
|
|
1822
2034
|
* Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
|
|
1823
2035
|
*/
|
|
@@ -1858,12 +2070,6 @@ function $01c33966d9ddb108$export$f50b88e2a00918b5(fn) {
|
|
|
1858
2070
|
}
|
|
1859
2071
|
};
|
|
1860
2072
|
}
|
|
1861
|
-
function $60ec7a29849d81db$export$a71e92cfbb498adc(props) {
|
|
1862
|
-
return $8tj43$createMemo(() => {
|
|
1863
|
-
const price_formatting = props.price_formatting_;
|
|
1864
|
-
return $8tj43$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
|
|
1865
|
-
});
|
|
1866
|
-
}
|
|
1867
2073
|
function $d0883254246d3eb6$export$fb40a80c530e5f2b(selectedIndex, groupIndex, indexInGroup) {
|
|
1868
2074
|
const isSelected = $8tj43$createMemo(() => {
|
|
1869
2075
|
const selectedValue = selectedIndex();
|
|
@@ -3301,7 +3507,7 @@ function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
|
|
|
3301
3507
|
$8tj43$insert(_el$5, $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {}));
|
|
3302
3508
|
var _ref$2 = submit_button_ref_;
|
|
3303
3509
|
typeof _ref$2 === "function" ? $8tj43$use(_ref$2, _el$6) : submit_button_ref_ = _el$6;
|
|
3304
|
-
$8tj43$spread(_el$6, $8tj43$
|
|
3510
|
+
$8tj43$spread(_el$6, $8tj43$mergeProps1({
|
|
3305
3511
|
get onClick() {
|
|
3306
3512
|
return $8tj43$catchify(() => submit_query_());
|
|
3307
3513
|
}
|
|
@@ -3958,7 +4164,7 @@ function $26db6925469636a4$export$67152d26d4f56ee8(_ref) {
|
|
|
3958
4164
|
}); // <- could be made reactive getter created in displayTransformers, read it in memo here since it might create computations (for example in the preview-brower), and there's no owner in the onClick handler
|
|
3959
4165
|
const LinkToListing = props => (() => {
|
|
3960
4166
|
var _el$ = $8tj43$getNextElement($26db6925469636a4$var$_tmpl$);
|
|
3961
|
-
$8tj43$spread(_el$, $8tj43$
|
|
4167
|
+
$8tj43$spread(_el$, $8tj43$mergeProps1(props, {
|
|
3962
4168
|
get href() {
|
|
3963
4169
|
return href();
|
|
3964
4170
|
},
|
|
@@ -4374,7 +4580,7 @@ function $4acc866f8fdfc002$export$af1fb307bbba2417(_ref) {
|
|
|
4374
4580
|
$8tj43$createComputed($8tj43$on(search_field_value_[0], () => !suggestions_updating_blocked() && set_selected_index(undefined), {
|
|
4375
4581
|
defer: true
|
|
4376
4582
|
})); // reset autocomplete position if query changes
|
|
4377
|
-
return [$8tj43$createComponent((0, $5175a47d13b7c228$export$d4994a86c6235f72), $8tj43$
|
|
4583
|
+
return [$8tj43$createComponent((0, $5175a47d13b7c228$export$d4994a86c6235f72), $8tj43$mergeProps1(sharedSuggestionProps, {
|
|
4378
4584
|
get title_() {
|
|
4379
4585
|
return i18n_.popular_;
|
|
4380
4586
|
},
|
|
@@ -4384,7 +4590,7 @@ function $4acc866f8fdfc002$export$af1fb307bbba2417(_ref) {
|
|
|
4384
4590
|
return itemIndexes_.suggestionsIndex_;
|
|
4385
4591
|
},
|
|
4386
4592
|
showPlaceholders_: () => showPlaceholders() || noResults_() && !noResultsPopularSuggestions.latest
|
|
4387
|
-
})), $8tj43$createComponent((0, $5175a47d13b7c228$export$d4994a86c6235f72), $8tj43$
|
|
4593
|
+
})), $8tj43$createComponent((0, $5175a47d13b7c228$export$d4994a86c6235f72), $8tj43$mergeProps1(sharedSuggestionProps, {
|
|
4388
4594
|
get title_() {
|
|
4389
4595
|
return i18n_.previous_;
|
|
4390
4596
|
},
|
|
@@ -4401,7 +4607,7 @@ function $4acc866f8fdfc002$export$af1fb307bbba2417(_ref) {
|
|
|
4401
4607
|
return _el$;
|
|
4402
4608
|
})(),
|
|
4403
4609
|
showPlaceholders_: () => false
|
|
4404
|
-
})), $8tj43$createComponent((0, $5175a47d13b7c228$export$d4994a86c6235f72), $8tj43$
|
|
4610
|
+
})), $8tj43$createComponent((0, $5175a47d13b7c228$export$d4994a86c6235f72), $8tj43$mergeProps1(sharedSuggestionProps, {
|
|
4405
4611
|
get title_() {
|
|
4406
4612
|
return i18n_.content_;
|
|
4407
4613
|
},
|
|
@@ -4937,7 +5143,7 @@ function $6a439680ae7e9ba3$export$b2539bed5023c21c(props) {
|
|
|
4937
5143
|
return $8tj43$createComponent($6a439680ae7e9ba3$var$TabsContext.Provider, {
|
|
4938
5144
|
value: new (0, $8tj43$ListenableSet)(),
|
|
4939
5145
|
get children() {
|
|
4940
|
-
return $8tj43$createComponent($6a439680ae7e9ba3$var$ActualTabs, $8tj43$
|
|
5146
|
+
return $8tj43$createComponent($6a439680ae7e9ba3$var$ActualTabs, $8tj43$mergeProps1(props, {
|
|
4941
5147
|
get children() {
|
|
4942
5148
|
return props.children;
|
|
4943
5149
|
}
|
|
@@ -4967,7 +5173,7 @@ function $6a439680ae7e9ba3$var$ActualTabs(props) {
|
|
|
4967
5173
|
},
|
|
4968
5174
|
children: item => {
|
|
4969
5175
|
const weSelected = $8tj43$createMemo(() => isSelected(item().id));
|
|
4970
|
-
return $8tj43$createComponent((0, $8tj43$Dynamic), $8tj43$
|
|
5176
|
+
return $8tj43$createComponent((0, $8tj43$Dynamic), $8tj43$mergeProps1({
|
|
4971
5177
|
get component() {
|
|
4972
5178
|
return props.AnchorComponent;
|
|
4973
5179
|
},
|
|
@@ -5078,7 +5284,7 @@ function $6a439680ae7e9ba3$export$3e41faf802a29e71(props) {
|
|
|
5078
5284
|
if (!currentTabs) throw new Error("Tab must be a child of Tabs");
|
|
5079
5285
|
const id = $8tj43$createUniqueId();
|
|
5080
5286
|
const ourSet = currentTabs;
|
|
5081
|
-
const extendedProps = $8tj43$
|
|
5287
|
+
const extendedProps = $8tj43$mergeProps({
|
|
5082
5288
|
id: id
|
|
5083
5289
|
}, props);
|
|
5084
5290
|
ourSet.add(extendedProps);
|
|
@@ -5198,120 +5404,6 @@ function $972f6bce0f9d61be$var$history_state_change(signals, entries, state) {
|
|
|
5198
5404
|
}
|
|
5199
5405
|
});
|
|
5200
5406
|
}
|
|
5201
|
-
function $ac571292d606f30b$var$_classPrivateMethodInitSpec(obj, privateSet) {
|
|
5202
|
-
$ac571292d606f30b$var$_checkPrivateRedeclaration(obj, privateSet);
|
|
5203
|
-
privateSet.add(obj);
|
|
5204
|
-
}
|
|
5205
|
-
function $ac571292d606f30b$var$_checkPrivateRedeclaration(obj, privateCollection) {
|
|
5206
|
-
if (privateCollection.has(obj)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
5207
|
-
}
|
|
5208
|
-
function $ac571292d606f30b$var$_classPrivateMethodGet(receiver, privateSet, fn) {
|
|
5209
|
-
if (!privateSet.has(receiver)) throw new TypeError("attempted to get private field on non-instance");
|
|
5210
|
-
return fn;
|
|
5211
|
-
}
|
|
5212
|
-
var $ac571292d606f30b$var$_throwing_on_navigation = /*#__PURE__*/new WeakSet();
|
|
5213
|
-
var $ac571292d606f30b$var$_get_navigation_happened_promise = /*#__PURE__*/new WeakSet();
|
|
5214
|
-
class $ac571292d606f30b$export$7e1297a3a19f10d8 {
|
|
5215
|
-
/**
|
|
5216
|
-
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
5217
|
-
*/ /**
|
|
5218
|
-
* 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
|
|
5219
|
-
*/ /**
|
|
5220
|
-
* Vue has async router that needs to be awaited (it navigates after a microtask)
|
|
5221
|
-
* This standardises waiting for all kinds of routers
|
|
5222
|
-
*/
|
|
5223
|
-
constructor(on_navigation, listing_query_state_key) {
|
|
5224
|
-
$ac571292d606f30b$var$_classPrivateMethodInitSpec(this, $ac571292d606f30b$var$_get_navigation_happened_promise);
|
|
5225
|
-
$ac571292d606f30b$var$_classPrivateMethodInitSpec(this, $ac571292d606f30b$var$_throwing_on_navigation);
|
|
5226
|
-
$8tj43$babelruntimehelpersdefineProperty(this, "on_navigation_", void 0);
|
|
5227
|
-
$8tj43$babelruntimehelpersdefineProperty(this, "listing_query_state_key", void 0);
|
|
5228
|
-
$8tj43$babelruntimehelpersdefineProperty(this, "navigate_", {
|
|
5229
|
-
/**
|
|
5230
|
-
* Call this if you *just* want to replace the state object in history.state
|
|
5231
|
-
*/
|
|
5232
|
-
replace_state_: new_state => {
|
|
5233
|
-
var _globalThis$history;
|
|
5234
|
-
// 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
|
|
5235
|
-
globalThis === null || globalThis === void 0 || (_globalThis$history = globalThis.history) === null || _globalThis$history === void 0 || _globalThis$history.replaceState(new_state, "");
|
|
5236
|
-
},
|
|
5237
|
-
/**
|
|
5238
|
-
* Call this to change the URL
|
|
5239
|
-
* @param new_url_ new URL to go to
|
|
5240
|
-
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
5241
|
-
* @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
|
|
5242
|
-
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
5243
|
-
* @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
|
|
5244
|
-
*/
|
|
5245
|
-
go_to_: $8tj43$catchify(async _ref => {
|
|
5246
|
-
let {
|
|
5247
|
-
new_url_: raw_new_url,
|
|
5248
|
-
event_: event_,
|
|
5249
|
-
force_spa_navigation_: force_spa_navigation_,
|
|
5250
|
-
is_replace_: is_replace_,
|
|
5251
|
-
listing_query_: listing_query_,
|
|
5252
|
-
scroll = true
|
|
5253
|
-
} = _ref;
|
|
5254
|
-
const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
|
|
5255
|
-
const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
|
|
5256
|
-
if ($9b35d1384e31813a$export$29d28dadc2d6b631(event_)) return;
|
|
5257
|
-
const different_origin = new_url_.origin !== location.origin;
|
|
5258
|
-
if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
|
|
5259
|
-
if (force_spa_navigation_ && different_origin)
|
|
5260
|
-
// If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
|
|
5261
|
-
$8tj43$dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
|
|
5262
|
-
if (!event_)
|
|
5263
|
-
// If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
|
|
5264
|
-
location.assign(new_url_);
|
|
5265
|
-
return;
|
|
5266
|
-
}
|
|
5267
|
-
event_ === null || event_ === void 0 || event_.preventDefault();
|
|
5268
|
-
const promise = $ac571292d606f30b$var$_classPrivateMethodGet(this, $ac571292d606f30b$var$_get_navigation_happened_promise, $ac571292d606f30b$var$_get_navigation_happened_promise2).call(this, true);
|
|
5269
|
-
if (force_spa_navigation_ && wants_hard_navigation) {
|
|
5270
|
-
// Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
|
|
5271
|
-
const new_state = history.state;
|
|
5272
|
-
if (listing_query_) {
|
|
5273
|
-
// In JS-UI we need to know the listing_id of the current category, therefore push it into state
|
|
5274
|
-
if (!this.listing_query_state_key) $8tj43$report(new Error("listing_query_state_key is not set"), "error");
|
|
5275
|
-
new_state[this.listing_query_state_key] = listing_query_;
|
|
5276
|
-
}
|
|
5277
|
-
history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
|
|
5278
|
-
} else $ac571292d606f30b$var$_classPrivateMethodGet(this, $ac571292d606f30b$var$_throwing_on_navigation, $ac571292d606f30b$var$_throwing_on_navigation2).call(this, {
|
|
5279
|
-
is_replace: is_replace_,
|
|
5280
|
-
new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
|
|
5281
|
-
scroll: scroll
|
|
5282
|
-
});
|
|
5283
|
-
await promise;
|
|
5284
|
-
})
|
|
5285
|
-
});
|
|
5286
|
-
this.listing_query_state_key = listing_query_state_key;
|
|
5287
|
-
this.on_navigation_ = on_navigation;
|
|
5288
|
-
}
|
|
5289
|
-
}
|
|
5290
|
-
function $ac571292d606f30b$var$_throwing_on_navigation2() {
|
|
5291
|
-
const {
|
|
5292
|
-
on_navigation_: on_navigation_
|
|
5293
|
-
} = this;
|
|
5294
|
-
if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
|
|
5295
|
-
// make sure that we don't accidentally catchify if the SDK consumer has fucked up
|
|
5296
|
-
try {
|
|
5297
|
-
return on_navigation_(...arguments);
|
|
5298
|
-
} catch (e) {
|
|
5299
|
-
queueMicrotask(() => {
|
|
5300
|
-
throw e;
|
|
5301
|
-
});
|
|
5302
|
-
}
|
|
5303
|
-
}
|
|
5304
|
-
function $ac571292d606f30b$var$_get_navigation_happened_promise2(is_replace) {
|
|
5305
|
-
return new Promise(resolve => {
|
|
5306
|
-
const handler = what_happened => {
|
|
5307
|
-
if (what_happened === (is_replace ? "replaceState" : "pushState")) {
|
|
5308
|
-
resolve();
|
|
5309
|
-
(0, $8tj43$instant_exec_on_suspect_history_change).delete(handler);
|
|
5310
|
-
}
|
|
5311
|
-
};
|
|
5312
|
-
(0, $8tj43$instant_exec_on_suspect_history_change).add(handler);
|
|
5313
|
-
});
|
|
5314
|
-
}
|
|
5315
5407
|
var $b652875d5a5139ec$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=image-container>`);
|
|
5316
5408
|
function $b652875d5a5139ec$export$41e1a079d40a0d58(props) {
|
|
5317
5409
|
const [display] = $8tj43$createResource(() => ({
|
|
@@ -5434,7 +5526,7 @@ function $e3efeb558d952696$export$7da560f849543dff(_ref) {
|
|
|
5434
5526
|
_el$5 = _el$4.nextSibling,
|
|
5435
5527
|
[_el$6, _co$2] = $8tj43$getNextMarker(_el$5.nextSibling);
|
|
5436
5528
|
$8tj43$insert(_el$2, (0, $ca55612a53dbbdd2$export$a2cc176055f8f08), _el$4, _co$);
|
|
5437
|
-
$8tj43$insert(_el$2, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$
|
|
5529
|
+
$8tj43$insert(_el$2, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps1({
|
|
5438
5530
|
get rows() {
|
|
5439
5531
|
return rows_object_();
|
|
5440
5532
|
},
|
|
@@ -5823,7 +5915,7 @@ function $6b0fd8fd20df8ccf$var$ActualShopTheLookButton(props) {
|
|
|
5823
5915
|
const displayStyleValue = $8tj43$createMemo(() => hasAnythingToShow() ? "" : "none");
|
|
5824
5916
|
const button = (() => {
|
|
5825
5917
|
var _el$2 = $8tj43$getNextElement($6b0fd8fd20df8ccf$var$_tmpl$2);
|
|
5826
|
-
$8tj43$spread(_el$2, $8tj43$
|
|
5918
|
+
$8tj43$spread(_el$2, $8tj43$mergeProps1(() => localProps.buttonAttributes), false, true);
|
|
5827
5919
|
$8tj43$insert(_el$2, () => {
|
|
5828
5920
|
var _localProps$buttonAtt;
|
|
5829
5921
|
return (localProps === null || localProps === void 0 ? void 0 : (_localProps$buttonAtt = localProps.buttonAttributes) === null || _localProps$buttonAtt === void 0 ? void 0 : _localProps$buttonAtt.children) || "Shop the look";
|
|
@@ -5833,7 +5925,7 @@ function $6b0fd8fd20df8ccf$var$ActualShopTheLookButton(props) {
|
|
|
5833
5925
|
})();
|
|
5834
5926
|
$8tj43$createEffect(() => button.style.display = displayStyleValue()); // Set our attributes like this, so we allow total control over the button from the outside via buttonAttributes
|
|
5835
5927
|
$8tj43$createEffect(() => !hasAnythingToShow() && closeModal()); // close modal if we ever get into the state of having it open and not having anything to show
|
|
5836
|
-
$6b0fd8fd20df8ccf$var$modalProps = $8tj43$
|
|
5928
|
+
$6b0fd8fd20df8ccf$var$modalProps = $8tj43$mergeProps(partForModal, {
|
|
5837
5929
|
products_to_shop_: products_to_shop_
|
|
5838
5930
|
});
|
|
5839
5931
|
button.addEventListener("click", openModal);
|
|
@@ -6595,7 +6687,7 @@ var $ff3225aef892a467$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg><path d="M
|
|
|
6595
6687
|
function $ff3225aef892a467$export$f21ab0717a89c77f(props) {
|
|
6596
6688
|
return (() => {
|
|
6597
6689
|
var _el$ = $8tj43$getNextElement($ff3225aef892a467$var$_tmpl$);
|
|
6598
|
-
$8tj43$spread(_el$, $8tj43$
|
|
6690
|
+
$8tj43$spread(_el$, $8tj43$mergeProps1(props, {
|
|
6599
6691
|
"xmlns": "http://www.w3.org/2000/svg",
|
|
6600
6692
|
"width": "11",
|
|
6601
6693
|
"height": "12"
|
|
@@ -8180,7 +8272,7 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
|
|
|
8180
8272
|
[_el$6, _co$] = $8tj43$getNextMarker(_el$5.nextSibling),
|
|
8181
8273
|
_el$7 = _el$6.nextSibling,
|
|
8182
8274
|
[_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
|
|
8183
|
-
$8tj43$spread(_el$2, $8tj43$
|
|
8275
|
+
$8tj43$spread(_el$2, $8tj43$mergeProps1(attributes, {
|
|
8184
8276
|
get disabled() {
|
|
8185
8277
|
return $8tj43$memo(() => !!count_zero())() && !is_selected();
|
|
8186
8278
|
},
|
|
@@ -9817,7 +9909,7 @@ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, mar
|
|
|
9817
9909
|
// Filter out our transformed ancestors
|
|
9818
9910
|
const transformedAncestors = Object.fromEntries(transformerResult.filter(item => item.is_suggestion === false).map(item => [item.listing_id, item]));
|
|
9819
9911
|
// Add the now transformed ancestors into the ancestors of the listing suggestions
|
|
9820
|
-
const transformedSuggestions = transformerResult.filter(item => item.is_suggestion !== false).map(item => $8tj43$
|
|
9912
|
+
const transformedSuggestions = transformerResult.filter(item => item.is_suggestion !== false).map(item => $8tj43$mergeProps(item, {
|
|
9821
9913
|
// Use mergeProps instead of spread since page_url and other properties could be a getter that solid components should call
|
|
9822
9914
|
ancestors: item.ancestors.map(ancestor => {
|
|
9823
9915
|
const newAncestor = transformedAncestors[ancestor.listing_id];
|
|
@@ -10353,7 +10445,7 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
|
|
|
10353
10445
|
[_el$6, _co$2] = $8tj43$getNextMarker(_el$5.nextSibling);
|
|
10354
10446
|
$8tj43$insert(_el$2, () => i18n_.search_recs_title_());
|
|
10355
10447
|
$8tj43$insert(_el$, (0, $ca55612a53dbbdd2$export$a2cc176055f8f08), _el$4, _co$);
|
|
10356
|
-
$8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$
|
|
10448
|
+
$8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps1({
|
|
10357
10449
|
rows: rows_object,
|
|
10358
10450
|
layout: "grid",
|
|
10359
10451
|
element_attributes: {
|
|
@@ -11117,7 +11209,7 @@ function $64d94dcaa058dc7b$export$ab6b147eec64fea5(props) {
|
|
|
11117
11209
|
const container_class = "x" + $8tj43$createUniqueId();
|
|
11118
11210
|
const container_element_ = (() => {
|
|
11119
11211
|
var _el$ = $8tj43$getNextElement($64d94dcaa058dc7b$var$_tmpl$);
|
|
11120
|
-
$8tj43$spread(_el$, $8tj43$
|
|
11212
|
+
$8tj43$spread(_el$, $8tj43$mergeProps1(() => props.element_attributes, {
|
|
11121
11213
|
"classList": {
|
|
11122
11214
|
[container_class]: true
|
|
11123
11215
|
}
|
|
@@ -11412,7 +11504,7 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
|
|
|
11412
11504
|
return _el$;
|
|
11413
11505
|
}
|
|
11414
11506
|
});
|
|
11415
|
-
return $8tj43$
|
|
11507
|
+
return $8tj43$mergeProps(block, {
|
|
11416
11508
|
// Create content divs for the blocks with as much fine-grained diffing as possible?
|
|
11417
11509
|
content: () => {
|
|
11418
11510
|
// Sneaky on-demand rendering, so we don't render more blocks than we can show: we have the rendered value here and don't return a function that renders because if our block would be moved around we'd be guaranteed to re-render
|
|
@@ -11660,7 +11752,7 @@ function $7faea0096f14b59b$export$3925f87b1545cfc6(_ref) {
|
|
|
11660
11752
|
} = slider;
|
|
11661
11753
|
const Layout = props => $63f1f8dbcd07d3b0$export$445d8d3f5f706a40(props, insert_here, true);
|
|
11662
11754
|
// Do like this, so we don't have to call mergeProps ourselves
|
|
11663
|
-
$8tj43$createComponent(Layout, $8tj43$
|
|
11755
|
+
$8tj43$createComponent(Layout, $8tj43$mergeProps1(layout_options_, {
|
|
11664
11756
|
rows: "all",
|
|
11665
11757
|
get cols_at_size() {
|
|
11666
11758
|
return modified_cols_at_size();
|
|
@@ -12189,7 +12281,7 @@ function $082c4ed3e22f8d71$export$9bf11afa910f536e(_ref) {
|
|
|
12189
12281
|
get children() {
|
|
12190
12282
|
return (() => {
|
|
12191
12283
|
var _el$34 = $8tj43$getNextElement($082c4ed3e22f8d71$var$_tmpl$5);
|
|
12192
|
-
$8tj43$insert(_el$34, $8tj43$createComponent((0, $f6b0500577e1b210$export$3f1a388cc0d8fed7), $8tj43$
|
|
12284
|
+
$8tj43$insert(_el$34, $8tj43$createComponent((0, $f6b0500577e1b210$export$3f1a388cc0d8fed7), $8tj43$mergeProps1(args_for_filtering_, {
|
|
12193
12285
|
are_in_modal_: true
|
|
12194
12286
|
})));
|
|
12195
12287
|
return _el$34;
|
|
@@ -13002,7 +13094,7 @@ function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
|
|
|
13002
13094
|
[_el$8, _co$] = $8tj43$getNextMarker(_el$7.nextSibling),
|
|
13003
13095
|
_el$9 = _el$8.nextSibling,
|
|
13004
13096
|
[_el$10, _co$2] = $8tj43$getNextMarker(_el$9.nextSibling);
|
|
13005
|
-
$8tj43$insert(_el$4, $8tj43$createComponent(LinkIfPossible, $8tj43$
|
|
13097
|
+
$8tj43$insert(_el$4, $8tj43$createComponent(LinkIfPossible, $8tj43$mergeProps1(make_link_attributes, {
|
|
13006
13098
|
tabIndex: "-1",
|
|
13007
13099
|
get children() {
|
|
13008
13100
|
return $8tj43$createComponent((0, $3c5e15c6ee4227a9$export$605674723bcc715c), {
|
|
@@ -13011,7 +13103,7 @@ function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
|
|
|
13011
13103
|
});
|
|
13012
13104
|
}
|
|
13013
13105
|
})));
|
|
13014
|
-
$8tj43$insert(_el$5, $8tj43$createComponent(LinkIfPossible, $8tj43$
|
|
13106
|
+
$8tj43$insert(_el$5, $8tj43$createComponent(LinkIfPossible, $8tj43$mergeProps1({
|
|
13015
13107
|
"class": "content-title line-clamp"
|
|
13016
13108
|
}, make_link_attributes, {
|
|
13017
13109
|
get title() {
|
|
@@ -13177,7 +13269,7 @@ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
|
|
|
13177
13269
|
},
|
|
13178
13270
|
number_of_results_: num_results
|
|
13179
13271
|
}), _el$3, _co$);
|
|
13180
|
-
$8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$
|
|
13272
|
+
$8tj43$insert(_el$, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), $8tj43$mergeProps1({
|
|
13181
13273
|
layout: "grid",
|
|
13182
13274
|
element_attributes: {
|
|
13183
13275
|
class: "cards"
|
|
@@ -13588,7 +13680,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
13588
13680
|
var _search_results_4, _search_results_4$con;
|
|
13589
13681
|
return ((_search_results_4 = search_results_()) !== null && _search_results_4 !== void 0 && (_search_results_4$con = _search_results_4.content_search_links) !== null && _search_results_4$con !== void 0 && _search_results_4$con.length ? i18n_.no_products_ : i18n_.no_results_text_)();
|
|
13590
13682
|
});
|
|
13591
|
-
const results_for = $8tj43$createComponent((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), $8tj43$
|
|
13683
|
+
const results_for = $8tj43$createComponent((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), $8tj43$mergeProps1({
|
|
13592
13684
|
get type() {
|
|
13593
13685
|
return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).products;
|
|
13594
13686
|
},
|
|
@@ -15729,7 +15821,7 @@ function $4b4b262708b516ee$var$add_us_to_crumbs(plp_meta) {
|
|
|
15729
15821
|
var _plp_meta3;
|
|
15730
15822
|
const api_value = (_plp_meta3 = plp_meta()) === null || _plp_meta3 === void 0 ? void 0 : _plp_meta3.breadcrumbs;
|
|
15731
15823
|
if (!api_value) return api_value;
|
|
15732
|
-
return [...api_value, $8tj43$
|
|
15824
|
+
return [...api_value, $8tj43$mergeProps(plp_meta(), {
|
|
15733
15825
|
get page_url() {
|
|
15734
15826
|
return href_accessor();
|
|
15735
15827
|
}
|