@depict-ai/ui 4.3.1 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/latest/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import { add_to_version_info as $9HbP8$add_to_version_info, fetch_retry as $9HbP8$fetch_retry, base_url as $9HbP8$base_url, slider_fractional_factory as $9HbP8$slider_fractional_factory, dlog as $9HbP8$dlog, camelCasifyObject as $9HbP8$camelCasifyObject, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, catchify as $9HbP8$catchify, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, slider_fading_factory as $9HbP8$slider_fading_factory, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, observer as $9HbP8$observer, javascript_media_query as $9HbP8$javascript_media_query, queueMacroTask as $9HbP8$queueMacroTask, findMostFrequentItem as $9HbP8$findMostFrequentItem, dwarn as $9HbP8$dwarn, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ContainedImage as $9HbP8$ContainedImage, standard_price_format as $9HbP8$standard_price_format, buildThresholdList as $9HbP8$buildThresholdList, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, use_href_accessor as $9HbP8$use_href_accessor, get_session_id as $9HbP8$get_session_id, add_version_query_params as $9HbP8$add_version_query_params, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, useExpandingContainer as $9HbP8$useExpandingContainer, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, snakeCasifyObject as $9HbP8$snakeCasifyObject, sort_obj as $9HbP8$sort_obj, make_url_with_query_params as $9HbP8$make_url_with_query_params, ListenableSet as $9HbP8$ListenableSet1, insert_surfaces as $9HbP8$insert_surfaces, is_debug as $9HbP8$is_debug } from "@depict-ai/utilishared/latest";
2
- import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, insert as $9HbP8$insert, createComponent as $9HbP8$createComponent, mergeProps as $9HbP8$mergeProps, isServer as $9HbP8$isServer, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, addEventListener as $9HbP8$addEventListener, className as $9HbP8$className, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, getNextMarker as $9HbP8$getNextMarker, effect as $9HbP8$effect, classList as $9HbP8$classList, setAttribute as $9HbP8$setAttribute, style as $9HbP8$style, use as $9HbP8$use, setProperty as $9HbP8$setProperty, Dynamic as $9HbP8$Dynamic } from "solid-js/web";
3
- import { createSignal as $9HbP8$createSignal, createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, Show as $9HbP8$Show, Suspense as $9HbP8$Suspense, untrack as $9HbP8$untrack, createRenderEffect as $9HbP8$createRenderEffect, Index as $9HbP8$Index, createRoot as $9HbP8$createRoot, onCleanup as $9HbP8$onCleanup, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createEffect as $9HbP8$createEffect, createContext as $9HbP8$createContext, useContext as $9HbP8$useContext, createUniqueId as $9HbP8$createUniqueId, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, splitProps as $9HbP8$splitProps, mergeProps as $9HbP8$mergeProps1, on as $9HbP8$on, batch as $9HbP8$batch, createSelector as $9HbP8$createSelector, children as $9HbP8$children, createReaction as $9HbP8$createReaction, mapArray as $9HbP8$mapArray } from "solid-js";
1
+ import { add_to_version_info as $9HbP8$add_to_version_info, fetch_retry as $9HbP8$fetch_retry, base_url as $9HbP8$base_url, dwarn as $9HbP8$dwarn, slider_fractional_factory as $9HbP8$slider_fractional_factory, dlog as $9HbP8$dlog, camelCasifyObject as $9HbP8$camelCasifyObject, make_random_classname as $9HbP8$make_random_classname, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, catchify as $9HbP8$catchify, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, report as $9HbP8$report, slider_fading_factory as $9HbP8$slider_fading_factory, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, observer as $9HbP8$observer, javascript_media_query as $9HbP8$javascript_media_query, queueMacroTask as $9HbP8$queueMacroTask, findMostFrequentItem as $9HbP8$findMostFrequentItem, standard_price_format as $9HbP8$standard_price_format, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, use_href_accessor as $9HbP8$use_href_accessor, get_session_id as $9HbP8$get_session_id, add_version_query_params as $9HbP8$add_version_query_params, useExpandingContainer as $9HbP8$useExpandingContainer, hex_to_rgb as $9HbP8$hex_to_rgb, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, snakeCasifyObject as $9HbP8$snakeCasifyObject, sort_obj as $9HbP8$sort_obj, make_url_with_query_params as $9HbP8$make_url_with_query_params, ListenableSet as $9HbP8$ListenableSet1, insert_surfaces as $9HbP8$insert_surfaces, is_debug as $9HbP8$is_debug } from "@depict-ai/utilishared/latest";
2
+ import { template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, insert as $9HbP8$insert, createComponent as $9HbP8$createComponent, mergeProps as $9HbP8$mergeProps1, isServer as $9HbP8$isServer, spread as $9HbP8$spread, runHydrationEvents as $9HbP8$runHydrationEvents, addEventListener as $9HbP8$addEventListener, className as $9HbP8$className, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, getNextMarker as $9HbP8$getNextMarker, effect as $9HbP8$effect, classList as $9HbP8$classList, setAttribute as $9HbP8$setAttribute, style as $9HbP8$style, use as $9HbP8$use, setProperty as $9HbP8$setProperty, Dynamic as $9HbP8$Dynamic } from "solid-js/web";
3
+ import { createSignal as $9HbP8$createSignal, createMemo as $9HbP8$createMemo, createResource as $9HbP8$createResource, createEffect as $9HbP8$createEffect, mergeProps as $9HbP8$mergeProps, Show as $9HbP8$Show, Suspense as $9HbP8$Suspense, untrack as $9HbP8$untrack, createRenderEffect as $9HbP8$createRenderEffect, Index as $9HbP8$Index, createRoot as $9HbP8$createRoot, onCleanup as $9HbP8$onCleanup, For as $9HbP8$For, getOwner as $9HbP8$getOwner, runWithOwner as $9HbP8$runWithOwner, createContext as $9HbP8$createContext, useContext as $9HbP8$useContext, createUniqueId as $9HbP8$createUniqueId, createComputed as $9HbP8$createComputed, ErrorBoundary as $9HbP8$ErrorBoundary, splitProps as $9HbP8$splitProps, on as $9HbP8$on, batch as $9HbP8$batch, createSelector as $9HbP8$createSelector, children as $9HbP8$children, createReaction as $9HbP8$createReaction, mapArray as $9HbP8$mapArray } from "solid-js";
4
4
  import { ListenableSet as $9HbP8$ListenableSet, catchify as $9HbP8$catchify1, use_href_accessor as $9HbP8$use_href_accessor1, report as $9HbP8$report1 } from "@depict-ai/utilishared/latest";
5
5
  import { createStore as $9HbP8$createStore, reconcile as $9HbP8$reconcile } from "solid-js/store";
6
6
 
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "4.3.1";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "4.3.3";
11
11
  const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
12
12
  const cols_at_size = [];
13
13
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -426,7 +426,7 @@ function $c8d5ff4524619fcd$export$d21e32dfedac04be(props) {
426
426
  const container_class = "x" + $9HbP8$createUniqueId();
427
427
  const container_element_ = (() => {
428
428
  var _el$ = $9HbP8$getNextElement($c8d5ff4524619fcd$var$_tmpl$);
429
- $9HbP8$spread(_el$, $9HbP8$mergeProps(() => props.element_attributes, {
429
+ $9HbP8$spread(_el$, $9HbP8$mergeProps1(() => props.element_attributes, {
430
430
  "classList": {
431
431
  [container_class]: true
432
432
  }
@@ -669,7 +669,7 @@ function $c4492d24952ed731$export$d41d19e89346fa2({
669
669
  } = slider;
670
670
  const Layout = props => $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, insert_here, true);
671
671
  // Do like this, so we don't have to call mergeProps ourselves
672
- $9HbP8$createComponent(Layout, $9HbP8$mergeProps({
672
+ $9HbP8$createComponent(Layout, $9HbP8$mergeProps1({
673
673
  rows: "all",
674
674
  layout: "slider"
675
675
  }, layout_options_));
@@ -974,7 +974,7 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
974
974
  });
975
975
  // Work around https://github.com/solidjs/solid/issues/1828
976
976
  const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
977
- const [, otherAttributes] = $9HbP8$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 <-
977
+ const [, otherAttributes] = $9HbP8$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 <-
978
978
  ]);
979
979
 
980
980
  const [hasSetSize, setHasSetSize] = $9HbP8$createSignal(false);
@@ -990,7 +990,7 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
990
990
  if (loading === "force-lazy") return true;
991
991
  return loading === "lazy" && !isPrioritisedImage();
992
992
  });
993
- const modifiedOtherAttributes = $9HbP8$mergeProps1(otherAttributes, {
993
+ const modifiedOtherAttributes = $9HbP8$mergeProps(otherAttributes, {
994
994
  get loading() {
995
995
  return shouldActuallyEnableLazyLoading() ? "lazy" : undefined;
996
996
  }
@@ -1030,13 +1030,18 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1030
1030
  let hasDecodedFastPath = false;
1031
1031
  let timeoutSet = false;
1032
1032
  let gotCleanedUp = false;
1033
+ let srcJustChanged = true;
1033
1034
  img.classList.add("s-responsive-image");
1034
1035
  if (listingContext) {
1035
1036
  let prevValue;
1036
1037
  const aspectRatios = listingContext[$e8ffe11ed01df0fe$export$f8945274f08a3105] ||= new Set();
1037
1038
  const [, setMostPrevalentAspectRatio] = listingContext[$e8ffe11ed01df0fe$export$6066eb417ed2e9f7] ||= $9HbP8$createSignal();
1038
1039
  img.addEventListener("load", $9HbP8$catchify(() => {
1039
- // Save our aspect ratio whenever it changes, so that we can base the containers on the most dominant aspect ratio, used in SearchModalV2
1040
+ if (props.keyRatioUpdating) {
1041
+ if (!srcJustChanged) return;
1042
+ srcJustChanged = false;
1043
+ }
1044
+ // 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
1040
1045
  const aspectRatio_ = img.naturalWidth / img.naturalHeight;
1041
1046
  if (prevValue) aspectRatios.delete(prevValue);
1042
1047
  const newValue = !isNaN(aspectRatio_) ? {
@@ -1054,7 +1059,11 @@ function $e8ffe11ed01df0fe$export$6e5611bc7e57e477(props) {
1054
1059
  $9HbP8$onCleanup(() => prevValue && aspectRatios.delete(prevValue));
1055
1060
  }
1056
1061
  $9HbP8$onCleanup(() => gotCleanedUp = true);
1057
- $9HbP8$spread(img, $9HbP8$mergeProps1(modifiedOtherAttributes), false, true);
1062
+ $9HbP8$spread(img, $9HbP8$mergeProps(modifiedOtherAttributes), false, true);
1063
+ $9HbP8$createRenderEffect(() => {
1064
+ props.src;
1065
+ srcJustChanged = true;
1066
+ });
1058
1067
  $9HbP8$createEffect(() => {
1059
1068
  if (!props.size()) return; // wait until we have a size, run every time the size changes
1060
1069
  if (timeoutSet) return;
@@ -1124,48 +1133,22 @@ function $660070e2a394b3c3$export$e4b984597b71e989(props) {
1124
1133
  const [mostPrevalentAspectRatio] = context ?
1125
1134
  // If the context exists we have to create the signal here as getting it here would be too late when it's created by ShopifyResponsiveImg below
1126
1135
  context[(0, $e8ffe11ed01df0fe$export$6066eb417ed2e9f7)] ||= $9HbP8$createSignal() : [];
1127
- const [aspectRatio, setAspectRatio] = $9HbP8$createSignal($9HbP8$untrack(() => props.aspectRatio));
1128
1136
  const container = $f18d425032111270$export$94026ee33dbabc26({
1129
1137
  // Write getters manually instead of using JSX, so we can do more complex logic in the aspectRatio getter without increasing bundle size
1130
1138
  get class() {
1131
1139
  return props.class;
1132
1140
  },
1133
1141
  get aspectRatio() {
1134
- return aspectRatio();
1142
+ if (props.autoAdjustAspectRatio) {
1143
+ const targetRatio = mostPrevalentAspectRatio?.();
1144
+ if (targetRatio != undefined) return `var(${(0, $bb15dfb548a7666e$export$8a2234b5b1a5ebd4)}, ${targetRatio})`;
1145
+ }
1146
+ return props.aspectRatio;
1135
1147
  }
1136
1148
  });
1137
1149
  const owner = $9HbP8$getOwner();
1138
1150
  let createdSizeAccessor = false;
1139
1151
  let wasCleanedUp = false;
1140
- let timeout;
1141
- $9HbP8$createEffect(() => {
1142
- const {
1143
- autoAdjustAspectRatio: autoAdjustAspectRatio
1144
- } = props;
1145
- if (autoAdjustAspectRatio) {
1146
- const targetRatio = mostPrevalentAspectRatio?.();
1147
- if (targetRatio != undefined) {
1148
- const targetValue = `var(${(0, $bb15dfb548a7666e$export$8a2234b5b1a5ebd4)}, ${targetRatio})`;
1149
- const updateAspectRatio = $9HbP8$catchify(() => setAspectRatio(targetValue));
1150
- if (autoAdjustAspectRatio === "smoothed") {
1151
- if (!timeout)
1152
- // 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).
1153
- updateAspectRatio();
1154
- clearTimeout(timeout);
1155
- timeout = setTimeout(() => {
1156
- timeout = undefined;
1157
- updateAspectRatio();
1158
- }, 500);
1159
- return;
1160
- }
1161
- return updateAspectRatio();
1162
- }
1163
- } else {
1164
- clearTimeout(timeout);
1165
- timeout = undefined;
1166
- }
1167
- setAspectRatio(props.aspectRatio);
1168
- });
1169
1152
  $9HbP8$createEffect(() => {
1170
1153
  if (currentImageSize() || wasCleanedUp) return; // We get into the effect when onCleanup is called if we don't have wasCleanedUp
1171
1154
  // ensure we always have a size accessor
@@ -1179,7 +1162,7 @@ function $660070e2a394b3c3$export$e4b984597b71e989(props) {
1179
1162
  $9HbP8$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
1180
1163
  });
1181
1164
 
1182
- $9HbP8$insert(container, $9HbP8$createComponent((0, $e8ffe11ed01df0fe$export$6e5611bc7e57e477), $9HbP8$mergeProps({
1165
+ $9HbP8$insert(container, $9HbP8$createComponent((0, $e8ffe11ed01df0fe$export$6e5611bc7e57e477), $9HbP8$mergeProps1({
1183
1166
  get size() {
1184
1167
  return $9HbP8$createMemo(() => currentImageSize()?.() || 0);
1185
1168
  },
@@ -1194,7 +1177,7 @@ function $660070e2a394b3c3$export$e4b984597b71e989(props) {
1194
1177
  return container;
1195
1178
  }
1196
1179
  function $70bb27cc6be01fc7$export$9d4a4b669b1929ab(props) {
1197
- return $9HbP8$createComponent((0, $660070e2a394b3c3$export$e4b984597b71e989), $9HbP8$mergeProps(props, {
1180
+ return $9HbP8$createComponent((0, $660070e2a394b3c3$export$e4b984597b71e989), $9HbP8$mergeProps1(props, {
1198
1181
  get imgProps() {
1199
1182
  return {
1200
1183
  ...props.imgProps,
@@ -1211,6 +1194,12 @@ function $70bb27cc6be01fc7$export$9d4a4b669b1929ab(props) {
1211
1194
  }
1212
1195
  }));
1213
1196
  }
1197
+ function $8c0f86cb3e266eeb$export$a71e92cfbb498adc(props) {
1198
+ return $9HbP8$createMemo(() => {
1199
+ const price_formatting = props.price_formatting_;
1200
+ return $9HbP8$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
1201
+ });
1202
+ }
1214
1203
  var $5a6c386e1bde5665$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=img-wrapper>`),
1215
1204
  $5a6c386e1bde5665$var$_tmpl$2 = /*#__PURE__*/$9HbP8$template(`<span class="d-price original">`),
1216
1205
  $5a6c386e1bde5665$var$_tmpl$3 = /*#__PURE__*/$9HbP8$template(`<div class=right-part><div class=text-container><span class="d-title line-clamp"></span><span class=d-price></span><!$><!/></div><!$><!/>`),
@@ -1218,10 +1207,12 @@ var $5a6c386e1bde5665$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=img-
1218
1207
  function $5a6c386e1bde5665$export$b73ed90f0ee50dc3({
1219
1208
  display_: display_,
1220
1209
  FavoriteButton_: FavoriteButton_,
1221
- isExpanded_: isExpanded_,
1210
+ userWantsExpandedSignal_: [userWantsExpanded, setUserWantsExpanded],
1222
1211
  textFadeInAnimationRunning_: textFadeInAnimationRunning_,
1223
1212
  outerRef_: outerRef_,
1224
- animationDuration_: animationDuration_
1213
+ animationDuration_: animationDuration_,
1214
+ priceFormatting_: priceFormatting_,
1215
+ pseudoRouter_: pseudoRouter_
1225
1216
  }) {
1226
1217
  const variantToUse = $9HbP8$createMemo(() => {
1227
1218
  const display = display_();
@@ -1229,11 +1220,13 @@ function $5a6c386e1bde5665$export$b73ed90f0ee50dc3({
1229
1220
  });
1230
1221
  const imageUrl = $9HbP8$createMemo(() => variantToUse()?.image_urls?.[0]);
1231
1222
  const [animationIsRunning, setAnimationIsRunning] = textFadeInAnimationRunning_;
1232
- const [isExpandedThrottledByOurEffectRun, setIsExpandedThrottledByOurEffectRun] = $9HbP8$createSignal($9HbP8$untrack(isExpanded_));
1223
+ const [isExpandedThrottledByOurEffectRun, setIsExpandedThrottledByOurEffectRun] = $9HbP8$createSignal($9HbP8$untrack(userWantsExpanded));
1233
1224
  const [animationEffectExists, setAnimationEffectExists] = $9HbP8$createSignal(false);
1234
1225
  const [salePrice] = $9HbP8$createResource(() => variantToUse()?.sale_price);
1235
1226
  const [originalPrice] = $9HbP8$createResource(() => variantToUse()?.original_price);
1236
- const isOnSale = $9HbP8$createMemo(() => salePrice.latest !== originalPrice.latest); // .latest doesn't trigger suspense
1227
+ const isOnSale = $9HbP8$createMemo(() => !salePrice.loading && !originalPrice.loading && salePrice.latest !== originalPrice.latest); // .latest doesn't trigger suspense after the initial load
1228
+ const enableLink = $9HbP8$createMemo(() => userWantsExpanded() && !animationIsRunning());
1229
+ const href = $9HbP8$createMemo(() => variantToUse()?.page_url);
1237
1230
  const FavoriteButton = FavoriteButton_; // Just to get rid of the type error - TS doesn't understand <Show>
1238
1231
  return (() => {
1239
1232
  var _el$ = $9HbP8$getNextElement($5a6c386e1bde5665$var$_tmpl$4),
@@ -1243,9 +1236,24 @@ function $5a6c386e1bde5665$export$b73ed90f0ee50dc3({
1243
1236
  [_el$15, _co$4] = $9HbP8$getNextMarker(_el$14.nextSibling);
1244
1237
  var _ref$ = outerRef_;
1245
1238
  typeof _ref$ === "function" ? $9HbP8$use(_ref$, _el$) : outerRef_ = _el$;
1246
- $9HbP8$spread(_el$, $9HbP8$mergeProps(() => isExpanded_() && !animationIsRunning() ? {
1247
- href: variantToUse()?.page_url
1248
- } : {}), false, true);
1239
+ $9HbP8$spread(_el$, $9HbP8$mergeProps1(() => enableLink() ? {
1240
+ href: href()
1241
+ } : {}, {
1242
+ get onClick() {
1243
+ return $9HbP8$catchify(event_ => {
1244
+ if (enableLink()) {
1245
+ pseudoRouter_.navigate_.go_to_({
1246
+ new_url_: href(),
1247
+ is_replace_: false,
1248
+ event_: event_
1249
+ });
1250
+ if (event_.defaultPrevented)
1251
+ // We single-page-navigated in this tab, close the look
1252
+ setUserWantsExpanded(false);
1253
+ }
1254
+ });
1255
+ }
1256
+ }), false, true);
1249
1257
  $9HbP8$insert(_el$, $9HbP8$createComponent((0, $9HbP8$Show), {
1250
1258
  when: imageUrl,
1251
1259
  get fallback() {
@@ -1270,10 +1278,13 @@ function $5a6c386e1bde5665$export$b73ed90f0ee50dc3({
1270
1278
  return imageUrl();
1271
1279
  },
1272
1280
  get aspectRatio() {
1273
- return isExpanded_() ? 0.75 : 1;
1281
+ return userWantsExpanded() ? 0.75 : 1;
1274
1282
  },
1275
1283
  get autoAdjustAspectRatio() {
1276
- return isExpanded_() ? "smoothed" : false;
1284
+ return userWantsExpanded();
1285
+ },
1286
+ imgProps: {
1287
+ keyRatioUpdating: true
1277
1288
  }
1278
1289
  });
1279
1290
  }
@@ -1283,7 +1294,7 @@ function $5a6c386e1bde5665$export$b73ed90f0ee50dc3({
1283
1294
  }), _el$13, _co$3);
1284
1295
  $9HbP8$insert(_el$, $9HbP8$createComponent((0, $9HbP8$Show), {
1285
1296
  get when() {
1286
- return (animationEffectExists() ? isExpandedThrottledByOurEffectRun() : isExpanded_()) || animationIsRunning();
1297
+ return (animationEffectExists() ? isExpandedThrottledByOurEffectRun() : userWantsExpanded()) || animationIsRunning();
1287
1298
  },
1288
1299
  get children() {
1289
1300
  var _el$3 = $9HbP8$getNextElement($5a6c386e1bde5665$var$_tmpl$3),
@@ -1310,7 +1321,7 @@ function $5a6c386e1bde5665$export$b73ed90f0ee50dc3({
1310
1321
  setAnimationIsRunning(true);
1311
1322
  $9HbP8$runWithOwner(owner, () => {
1312
1323
  $9HbP8$createRenderEffect(() => {
1313
- const expanded = isExpanded_();
1324
+ const expanded = userWantsExpanded();
1314
1325
  // Still glitches in chrome (probably not fixable) and sometimes the timing is off in Safari but fuck it, I couldn't massage the WAAPI to improve it in any way (without reading computed style) to make the reversing of animations glitch less
1315
1326
  textContainerAnimation.pause();
1316
1327
  textContainerAnimation.updatePlaybackRate(expanded ? 1 : -1);
@@ -1330,26 +1341,68 @@ function $5a6c386e1bde5665$export$b73ed90f0ee50dc3({
1330
1341
  height: "1em",
1331
1342
  width: "20ch"
1332
1343
  }));
1333
- $9HbP8$insert(_el$6, (() => {
1334
- var _c$ = $9HbP8$memo(() => !!(!variantToUse() || salePrice.loading));
1335
- return () => _c$() ? $9HbP8$createComponent((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
1336
- height: "1em",
1337
- width: "20ch"
1338
- }) : salePrice();
1339
- })());
1344
+ $9HbP8$insert(_el$6, $9HbP8$createComponent((0, $9HbP8$Show), {
1345
+ get when() {
1346
+ return variantToUse() && !salePrice.loading;
1347
+ },
1348
+ get fallback() {
1349
+ return $9HbP8$createComponent((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
1350
+ height: "1em",
1351
+ width: "20ch"
1352
+ });
1353
+ },
1354
+ get children() {
1355
+ return $9HbP8$createComponent((0, $9HbP8$Show), {
1356
+ get when() {
1357
+ return salePrice.latest;
1358
+ },
1359
+ get children() {
1360
+ return [$9HbP8$memo(() => priceFormatting_().pre_), $9HbP8$createComponent((0, $8c0f86cb3e266eeb$export$a71e92cfbb498adc), {
1361
+ get price_() {
1362
+ return salePrice();
1363
+ },
1364
+ get price_formatting_() {
1365
+ return priceFormatting_();
1366
+ }
1367
+ }), $9HbP8$memo(() => priceFormatting_().post_)];
1368
+ }
1369
+ });
1370
+ }
1371
+ }));
1340
1372
  $9HbP8$insert(_el$4, $9HbP8$createComponent((0, $9HbP8$Show), {
1341
1373
  get when() {
1342
1374
  return isOnSale();
1343
1375
  },
1344
1376
  get children() {
1345
1377
  var _el$7 = $9HbP8$getNextElement($5a6c386e1bde5665$var$_tmpl$2);
1346
- $9HbP8$insert(_el$7, (() => {
1347
- var _c$2 = $9HbP8$memo(() => !!(!variantToUse() || originalPrice.loading));
1348
- return () => _c$2() ? $9HbP8$createComponent((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
1349
- height: "1em",
1350
- width: "20ch"
1351
- }) : originalPrice();
1352
- })());
1378
+ $9HbP8$insert(_el$7, $9HbP8$createComponent((0, $9HbP8$Show), {
1379
+ get when() {
1380
+ return variantToUse() && !originalPrice.loading;
1381
+ },
1382
+ get fallback() {
1383
+ return $9HbP8$createComponent((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
1384
+ height: "1em",
1385
+ width: "20ch"
1386
+ });
1387
+ },
1388
+ get children() {
1389
+ return $9HbP8$createComponent((0, $9HbP8$Show), {
1390
+ get when() {
1391
+ return salePrice.latest;
1392
+ },
1393
+ get children() {
1394
+ return [$9HbP8$memo(() => priceFormatting_().pre_), $9HbP8$createComponent((0, $8c0f86cb3e266eeb$export$a71e92cfbb498adc), {
1395
+ get price_() {
1396
+ return originalPrice();
1397
+ },
1398
+ get price_formatting_() {
1399
+ return priceFormatting_();
1400
+ }
1401
+ }), $9HbP8$memo(() => priceFormatting_().post_)];
1402
+ }
1403
+ });
1404
+ }
1405
+ }));
1353
1406
  return _el$7;
1354
1407
  }
1355
1408
  }), _el$9, _co$);
@@ -1423,10 +1476,12 @@ var $7555dcad3b8a4632$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=scro
1423
1476
  function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
1424
1477
  displays_: displays_,
1425
1478
  FavoriteButton_: FavoriteButton_,
1426
- userWantsExpandedSignal_: [userWantsExpanded, setUserWantsExpanded],
1479
+ userWantsExpandedSignal_: userWantsExpandedSignal_,
1427
1480
  containerWidth_: containerWidth_,
1428
1481
  animationDuration_: animationDuration_,
1429
- supportsHover_: supportsHover_
1482
+ supportsHover_: supportsHover_,
1483
+ priceFormatting_: priceFormatting_,
1484
+ pseudoRouter_: pseudoRouter_
1430
1485
  }) {
1431
1486
  let isAffectedByChromeBug = false;
1432
1487
  // If the user requests the drawer to be expanded or not
@@ -1435,6 +1490,7 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
1435
1490
  // The following three signals just contain the state if the animations are actually running and should only be set by the respective animation code
1436
1491
  const textFadeInAnimationRunning = $9HbP8$createSignal(false);
1437
1492
  const [getSecondPartAnimationRunning] = textFadeInAnimationRunning;
1493
+ const [userWantsExpanded, setUserWantsExpanded] = userWantsExpandedSignal_;
1438
1494
  $62a8f670f8464532$export$7b9a0e99f0aeb2f3().then(is => isAffectedByChromeBug = is);
1439
1495
  return $9HbP8$createComponent((0, $011607bdf658f807$export$e68cff63f76bd15b), {
1440
1496
  get children() {
@@ -1456,7 +1512,7 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
1456
1512
  behavior: "smooth"
1457
1513
  });
1458
1514
  }), _el$2);
1459
- $9HbP8$spread(_el$2, $9HbP8$mergeProps({
1515
+ $9HbP8$spread(_el$2, $9HbP8$mergeProps1({
1460
1516
  get classList() {
1461
1517
  return {
1462
1518
  expanded: userWantsExpanded(),
@@ -1480,11 +1536,13 @@ function $7555dcad3b8a4632$export$ebf0b1d4f90c09ae({
1480
1536
  },
1481
1537
  children: (display, index) => {
1482
1538
  return $9HbP8$createComponent((0, $5a6c386e1bde5665$export$b73ed90f0ee50dc3), {
1539
+ pseudoRouter_: pseudoRouter_,
1483
1540
  animationDuration_: animationDuration_,
1484
1541
  display_: display,
1485
1542
  FavoriteButton_: FavoriteButton_,
1486
- isExpanded_: userWantsExpanded,
1543
+ userWantsExpandedSignal_: userWantsExpandedSignal_,
1487
1544
  textFadeInAnimationRunning_: textFadeInAnimationRunning,
1545
+ priceFormatting_: priceFormatting_,
1488
1546
  outerRef_: el => $9HbP8$createEffect(() => {
1489
1547
  if (index !== 0) return;
1490
1548
  const resizeObserver = new ResizeObserver($9HbP8$catchify(records => setLookItemHeight(records.at(-1).contentRect.height)));
@@ -1527,10 +1585,10 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1527
1585
  expandedLooksSignal_: [expandedLooks_, setExpandedLooks],
1528
1586
  FavoriteButton_: FavoriteButton_,
1529
1587
  placeholderImageAspectRatio_: placeholderImageAspectRatio_,
1530
- animationDuration_: animationDuration_
1588
+ animationDuration_: animationDuration_,
1589
+ priceFormatting_: priceFormatting_,
1590
+ pseudoRouter_: pseudoRouter_
1531
1591
  }) {
1532
- // TODO: shopify, run displayTransformers to get dynamic prices
1533
- // TODO: format prices
1534
1592
  const [coverImage] = display_?.image_urls || [];
1535
1593
  const useWantsExpandedSignal_ = $9HbP8$createSignal(false);
1536
1594
  const [userWantsExpanded, setUserWantsExpanded] = useWantsExpandedSignal_;
@@ -1574,7 +1632,7 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1574
1632
  when: display_,
1575
1633
  get fallback() {
1576
1634
  return $9HbP8$createComponent((0, $7f60f09116a3fe61$export$3f37af283f8fb843), {
1577
- aspectRatio: placeholderImageAspectRatio_
1635
+ aspectRatio: `var(${(0, $bb15dfb548a7666e$export$8a2234b5b1a5ebd4)}, ${placeholderImageAspectRatio_})`
1578
1636
  });
1579
1637
  },
1580
1638
  get children() {
@@ -1592,11 +1650,125 @@ function $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1592
1650
  containerWidth_: containerWidth_,
1593
1651
  animationDuration_: animationDuration_,
1594
1652
  supportsHover_: supportsHover_,
1595
- FavoriteButton_: FavoriteButton_
1653
+ FavoriteButton_: FavoriteButton_,
1654
+ priceFormatting_: priceFormatting_,
1655
+ pseudoRouter_: pseudoRouter_
1596
1656
  })]);
1597
1657
  return container;
1598
1658
  }
1599
1659
  $9HbP8$delegateEvents(["click"]);
1660
+
1661
+ /**
1662
+ * 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
1663
+ * @param clickEvent The click event that triggered the navigation
1664
+ */
1665
+ function $a281666e5c15c2ec$export$29d28dadc2d6b631(clickEvent) {
1666
+ return clickEvent?.button ||
1667
+ // if not zero it's a wheel click which opens in new tab
1668
+ clickEvent?.metaKey ||
1669
+ // if true, cmd button on macOS which opens in new tab
1670
+ clickEvent?.ctrlKey ||
1671
+ // if true, ctrl button on windows or linux which opens in new tab
1672
+ clickEvent?.shiftKey // if true, shift button on windows, linux or macOS which opens in a new window
1673
+ ;
1674
+ }
1675
+
1676
+ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
1677
+ /**
1678
+ * Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
1679
+ */ /**
1680
+ * 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
1681
+ */
1682
+ #throwing_on_navigation(...args) {
1683
+ const {
1684
+ on_navigation_: on_navigation_
1685
+ } = this;
1686
+ if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
1687
+ // make sure that we don't accidentally catchify if the SDK consumer has fucked up
1688
+ try {
1689
+ return on_navigation_(...args);
1690
+ } catch (e) {
1691
+ queueMicrotask(() => {
1692
+ throw e;
1693
+ });
1694
+ }
1695
+ }
1696
+ /**
1697
+ * Vue has async router that needs to be awaited (it navigates after a microtask)
1698
+ * This standardises waiting for all kinds of routers
1699
+ */
1700
+ #get_navigation_happened_promise(is_replace) {
1701
+ return new Promise(resolve => {
1702
+ const handler = what_happened => {
1703
+ if (what_happened === (is_replace ? "replaceState" : "pushState")) {
1704
+ resolve();
1705
+ (0, $9HbP8$instant_exec_on_suspect_history_change).delete(handler);
1706
+ }
1707
+ };
1708
+ (0, $9HbP8$instant_exec_on_suspect_history_change).add(handler);
1709
+ });
1710
+ }
1711
+ navigate_ = {
1712
+ /**
1713
+ * Call this if you *just* want to replace the state object in history.state
1714
+ */
1715
+ replace_state_: new_state => {
1716
+ // 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
1717
+ globalThis?.history?.replaceState(new_state, "");
1718
+ },
1719
+ /**
1720
+ * Call this to change the URL
1721
+ * @param new_url_ new URL to go to
1722
+ * @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
1723
+ * @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
1724
+ * @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
1725
+ * @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
1726
+ */
1727
+ go_to_: $9HbP8$catchify(async ({
1728
+ new_url_: raw_new_url,
1729
+ event_: event_,
1730
+ force_spa_navigation_: force_spa_navigation_,
1731
+ is_replace_: is_replace_,
1732
+ listing_query_: listing_query_,
1733
+ scroll = true
1734
+ }) => {
1735
+ const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
1736
+ const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
1737
+ if ($a281666e5c15c2ec$export$29d28dadc2d6b631(event_)) return;
1738
+ const different_origin = new_url_.origin !== location.origin;
1739
+ if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
1740
+ if (force_spa_navigation_ && different_origin)
1741
+ // If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
1742
+ $9HbP8$dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
1743
+ if (!event_)
1744
+ // If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
1745
+ location.assign(new_url_);
1746
+ return;
1747
+ }
1748
+ event_?.preventDefault();
1749
+ const promise = this.#get_navigation_happened_promise(true);
1750
+ if (force_spa_navigation_ && wants_hard_navigation) {
1751
+ // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
1752
+ const new_state = history.state;
1753
+ if (listing_query_) {
1754
+ // In JS-UI we need to know the listing_id of the current category, therefore push it into state
1755
+ if (!this.listing_query_state_key) $9HbP8$report(new Error("listing_query_state_key is not set"), "error");
1756
+ new_state[this.listing_query_state_key] = listing_query_;
1757
+ }
1758
+ history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
1759
+ } else this.#throwing_on_navigation.call(this, {
1760
+ is_replace: is_replace_,
1761
+ new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
1762
+ scroll: scroll
1763
+ });
1764
+ await promise;
1765
+ })
1766
+ };
1767
+ constructor(on_navigation, listing_query_state_key) {
1768
+ this.listing_query_state_key = listing_query_state_key;
1769
+ this.on_navigation_ = on_navigation;
1770
+ }
1771
+ }
1600
1772
  var $f577edfe2240eec1$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class="depict recommendations looks"style=--animation-duration:240ms>`);
1601
1773
  let $f577edfe2240eec1$var$expandedLooksSignal_;
1602
1774
  function $f577edfe2240eec1$export$1935e6bdfc5ed8ce(props) {
@@ -1605,6 +1777,7 @@ function $f577edfe2240eec1$export$1935e6bdfc5ed8ce(props) {
1605
1777
  equals: false
1606
1778
  });
1607
1779
  const expandingAnimationDuration = 240;
1780
+ const pseudoRouter = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation");
1608
1781
  const grid_spacing_override = $9HbP8$createMemo(() => {
1609
1782
  const {
1610
1783
  gridSpacing_: gridSpacing_
@@ -1630,21 +1803,37 @@ function $f577edfe2240eec1$export$1935e6bdfc5ed8ce(props) {
1630
1803
  });
1631
1804
  const decoded = await response?.json?.().catch(() => false);
1632
1805
  if (!decoded)
1633
- // If network fails, make sure to return empty array adn SolidRecommendationSlider will remove its elements
1806
+ // If network fails, make sure to return empty array and SolidRecommendationSlider will remove its elements
1634
1807
  return [];
1635
- return decoded.listings;
1808
+ const {
1809
+ listings: listings
1810
+ } = decoded;
1811
+ const baseData = {
1812
+ merchant: merchant,
1813
+ market: market,
1814
+ locale: locale
1815
+ };
1816
+ return $f577edfe2240eec1$var$runDisplayTransformersForLooks(baseData, listings, props.displayTransformers_);
1817
+ });
1818
+ $9HbP8$createEffect(() => {
1819
+ const {
1820
+ onNavigation_: onNavigation_
1821
+ } = props;
1822
+ if (onNavigation_) pseudoRouter.on_navigation_ = onNavigation_;
1636
1823
  });
1637
1824
  return (() => {
1638
1825
  var _el$ = $9HbP8$getNextElement($f577edfe2240eec1$var$_tmpl$);
1639
1826
  $9HbP8$insert(_el$, $9HbP8$createComponent((0, $011607bdf658f807$export$e68cff63f76bd15b), {
1640
1827
  get children() {
1641
1828
  return $c4492d24952ed731$export$d41d19e89346fa2({
1642
- product_card_template_: (display, info) => $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1829
+ product_card_template_: display => $28ee4f7db3cc44b8$export$44809a8a3e867e30({
1643
1830
  display_: display,
1644
1831
  FavoriteButton_: props.FavoriteButton_,
1645
1832
  placeholderImageAspectRatio_: props.imagePlaceholderAspectRatio_,
1646
1833
  animationDuration_: expandingAnimationDuration,
1647
- expandedLooksSignal_: $f577edfe2240eec1$var$expandedLooksSignal_
1834
+ expandedLooksSignal_: $f577edfe2240eec1$var$expandedLooksSignal_,
1835
+ priceFormatting_: () => props.priceFormatting_,
1836
+ pseudoRouter_: pseudoRouter
1648
1837
  }),
1649
1838
  recommendations_resource_: looksResource,
1650
1839
  title_: () => props.title_,
@@ -1659,6 +1848,53 @@ function $f577edfe2240eec1$export$1935e6bdfc5ed8ce(props) {
1659
1848
  })();
1660
1849
  }, "LookSlider failed");
1661
1850
  }
1851
+ async function $f577edfe2240eec1$var$runDisplayTransformersForLooks(baseData, listings, displayTransformers) {
1852
+ try {
1853
+ const {
1854
+ products: productTransformer,
1855
+ categories: providedListingTransformer
1856
+ } = displayTransformers || {};
1857
+ if (!productTransformer && !providedListingTransformer) return listings;
1858
+ const listingTransformer = providedListingTransformer || (({
1859
+ data: data
1860
+ }) => data);
1861
+ const displaysToTransform = [];
1862
+ const displayIdsPerListingId = {};
1863
+ const transformedListingsPromise = listingTransformer({
1864
+ ...baseData,
1865
+ data: listings.map(({
1866
+ displays: displays,
1867
+ ...listing
1868
+ }) => {
1869
+ // Populate our displays by id and displayIdToListings object in the .map where we add ancestors to the listings, for peak efficiency
1870
+ for (let i = 0; i < displays.length; i++) {
1871
+ const display = displays[i];
1872
+ const uniqueIdOfDisplay = $16351e4c87b90b3d$export$548d053aba053d79(display);
1873
+ displaysToTransform.push(display);
1874
+ (displayIdsPerListingId[listing.listing_id] ||= []).push(uniqueIdOfDisplay);
1875
+ }
1876
+ return {
1877
+ ...listing,
1878
+ ancestors: []
1879
+ };
1880
+ })
1881
+ });
1882
+ // This allows the person providing the displayTransformer to re-order and remove displays
1883
+ const transformedProducts = productTransformer ? await productTransformer({
1884
+ ...baseData,
1885
+ displays: displaysToTransform
1886
+ }) : displaysToTransform;
1887
+ const transformedListings = await transformedListingsPromise;
1888
+ const transformedDisplayById = Object.fromEntries(transformedProducts.map(display => [$16351e4c87b90b3d$export$548d053aba053d79(display), display]));
1889
+ return transformedListings.map(listing => $9HbP8$mergeProps(listing, {
1890
+ // use mergeProps because in preview browser we add getters in this object, that would be called too early otherwise
1891
+ displays: (displayIdsPerListingId[listing.listing_id] || []).map(displayId => transformedDisplayById[displayId]).filter(v => v)
1892
+ }));
1893
+ } catch (e) {
1894
+ $9HbP8$dwarn("Displaytransformers threw", e);
1895
+ return [];
1896
+ }
1897
+ }
1662
1898
  const $90980bd87c9960f9$export$3064e1e8c6513da3 = new Set();
1663
1899
  let $90980bd87c9960f9$var$has_ran = false;
1664
1900
  function $90980bd87c9960f9$export$5162a71f252e6122() {
@@ -1699,21 +1935,6 @@ function $90980bd87c9960f9$var$starts_with_any_prefix(key) {
1699
1935
  }
1700
1936
  }
1701
1937
 
1702
- /**
1703
- * 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
1704
- * @param clickEvent The click event that triggered the navigation
1705
- */
1706
- function $a281666e5c15c2ec$export$29d28dadc2d6b631(clickEvent) {
1707
- return clickEvent?.button ||
1708
- // if not zero it's a wheel click which opens in new tab
1709
- clickEvent?.metaKey ||
1710
- // if true, cmd button on macOS which opens in new tab
1711
- clickEvent?.ctrlKey ||
1712
- // if true, ctrl button on windows or linux which opens in new tab
1713
- clickEvent?.shiftKey // if true, shift button on windows, linux or macOS which opens in a new window
1714
- ;
1715
- }
1716
-
1717
1938
  /**
1718
1939
  * Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
1719
1940
  */
@@ -1753,12 +1974,6 @@ function $d8dbf52fea1773e2$export$f50b88e2a00918b5(fn) {
1753
1974
  }
1754
1975
  };
1755
1976
  }
1756
- function $8c0f86cb3e266eeb$export$a71e92cfbb498adc(props) {
1757
- return $9HbP8$createMemo(() => {
1758
- const price_formatting = props.price_formatting_;
1759
- return $9HbP8$standard_price_format(props.price_, price_formatting.places_after_comma_, price_formatting.decimal_places_delimiter_, price_formatting.thousands_delimiter_);
1760
- });
1761
- }
1762
1977
  function $f4125ce4984deee6$export$fb40a80c530e5f2b(selectedIndex, groupIndex, indexInGroup) {
1763
1978
  const isSelected = $9HbP8$createMemo(() => {
1764
1979
  const selectedValue = selectedIndex();
@@ -3125,7 +3340,7 @@ function $5285d2814d0fac0c$export$b94867ecbd698f21({
3125
3340
  $9HbP8$insert(_el$5, $9HbP8$createComponent((0, $19976a74d273070d$export$3b621d86b1566b2), {}));
3126
3341
  var _ref$2 = submit_button_ref_;
3127
3342
  typeof _ref$2 === "function" ? $9HbP8$use(_ref$2, _el$6) : submit_button_ref_ = _el$6;
3128
- $9HbP8$spread(_el$6, $9HbP8$mergeProps({
3343
+ $9HbP8$spread(_el$6, $9HbP8$mergeProps1({
3129
3344
  get onClick() {
3130
3345
  return $9HbP8$catchify(() => submit_query_());
3131
3346
  }
@@ -3762,7 +3977,7 @@ function $4ce5b8892775b62d$export$67152d26d4f56ee8({
3762
3977
  const href = $9HbP8$createMemo(() => listing_()?.page_url); // <- 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
3763
3978
  const LinkToListing = props => (() => {
3764
3979
  var _el$ = $9HbP8$getNextElement($4ce5b8892775b62d$var$_tmpl$);
3765
- $9HbP8$spread(_el$, $9HbP8$mergeProps(props, {
3980
+ $9HbP8$spread(_el$, $9HbP8$mergeProps1(props, {
3766
3981
  get href() {
3767
3982
  return href();
3768
3983
  },
@@ -4156,7 +4371,7 @@ function $2f3171b02c8f4a5d$export$af1fb307bbba2417({
4156
4371
  $9HbP8$createComputed($9HbP8$on(search_field_value_[0], () => !suggestions_updating_blocked() && set_selected_index(undefined), {
4157
4372
  defer: true
4158
4373
  })); // reset autocomplete position if query changes
4159
- return [$9HbP8$createComponent((0, $903297121898e5ff$export$d4994a86c6235f72), $9HbP8$mergeProps(sharedSuggestionProps, {
4374
+ return [$9HbP8$createComponent((0, $903297121898e5ff$export$d4994a86c6235f72), $9HbP8$mergeProps1(sharedSuggestionProps, {
4160
4375
  get title_() {
4161
4376
  return i18n_.popular_;
4162
4377
  },
@@ -4166,7 +4381,7 @@ function $2f3171b02c8f4a5d$export$af1fb307bbba2417({
4166
4381
  return itemIndexes_.suggestionsIndex_;
4167
4382
  },
4168
4383
  showPlaceholders_: () => showPlaceholders() || noResults_() && !noResultsPopularSuggestions.latest
4169
- })), $9HbP8$createComponent((0, $903297121898e5ff$export$d4994a86c6235f72), $9HbP8$mergeProps(sharedSuggestionProps, {
4384
+ })), $9HbP8$createComponent((0, $903297121898e5ff$export$d4994a86c6235f72), $9HbP8$mergeProps1(sharedSuggestionProps, {
4170
4385
  get title_() {
4171
4386
  return i18n_.previous_;
4172
4387
  },
@@ -4183,7 +4398,7 @@ function $2f3171b02c8f4a5d$export$af1fb307bbba2417({
4183
4398
  return _el$;
4184
4399
  })(),
4185
4400
  showPlaceholders_: () => false
4186
- })), $9HbP8$createComponent((0, $903297121898e5ff$export$d4994a86c6235f72), $9HbP8$mergeProps(sharedSuggestionProps, {
4401
+ })), $9HbP8$createComponent((0, $903297121898e5ff$export$d4994a86c6235f72), $9HbP8$mergeProps1(sharedSuggestionProps, {
4187
4402
  get title_() {
4188
4403
  return i18n_.content_;
4189
4404
  },
@@ -4705,7 +4920,7 @@ function $024fbc0a2d796fad$export$b2539bed5023c21c(props) {
4705
4920
  return $9HbP8$createComponent($024fbc0a2d796fad$var$TabsContext.Provider, {
4706
4921
  value: new (0, $9HbP8$ListenableSet)(),
4707
4922
  get children() {
4708
- return $9HbP8$createComponent($024fbc0a2d796fad$var$ActualTabs, $9HbP8$mergeProps(props, {
4923
+ return $9HbP8$createComponent($024fbc0a2d796fad$var$ActualTabs, $9HbP8$mergeProps1(props, {
4709
4924
  get children() {
4710
4925
  return props.children;
4711
4926
  }
@@ -4735,7 +4950,7 @@ function $024fbc0a2d796fad$var$ActualTabs(props) {
4735
4950
  },
4736
4951
  children: item => {
4737
4952
  const weSelected = $9HbP8$createMemo(() => isSelected(item().id));
4738
- return $9HbP8$createComponent((0, $9HbP8$Dynamic), $9HbP8$mergeProps({
4953
+ return $9HbP8$createComponent((0, $9HbP8$Dynamic), $9HbP8$mergeProps1({
4739
4954
  get component() {
4740
4955
  return props.AnchorComponent;
4741
4956
  },
@@ -4842,7 +5057,7 @@ function $024fbc0a2d796fad$export$3e41faf802a29e71(props) {
4842
5057
  if (!currentTabs) throw new Error("Tab must be a child of Tabs");
4843
5058
  const id = $9HbP8$createUniqueId();
4844
5059
  const ourSet = currentTabs;
4845
- const extendedProps = $9HbP8$mergeProps1({
5060
+ const extendedProps = $9HbP8$mergeProps({
4846
5061
  id: id
4847
5062
  }, props);
4848
5063
  ourSet.add(extendedProps);
@@ -4956,102 +5171,6 @@ function $ca6f574bd8772184$var$history_state_change(signals, entries, state) {
4956
5171
  }
4957
5172
  });
4958
5173
  }
4959
- class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
4960
- /**
4961
- * Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
4962
- */ /**
4963
- * 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
4964
- */
4965
- #throwing_on_navigation(...args) {
4966
- const {
4967
- on_navigation_: on_navigation_
4968
- } = this;
4969
- if (typeof on_navigation_ !== "function") throw new Error("on_navigation_ is not a function");
4970
- // make sure that we don't accidentally catchify if the SDK consumer has fucked up
4971
- try {
4972
- return on_navigation_(...args);
4973
- } catch (e) {
4974
- queueMicrotask(() => {
4975
- throw e;
4976
- });
4977
- }
4978
- }
4979
- /**
4980
- * Vue has async router that needs to be awaited (it navigates after a microtask)
4981
- * This standardises waiting for all kinds of routers
4982
- */
4983
- #get_navigation_happened_promise(is_replace) {
4984
- return new Promise(resolve => {
4985
- const handler = what_happened => {
4986
- if (what_happened === (is_replace ? "replaceState" : "pushState")) {
4987
- resolve();
4988
- (0, $9HbP8$instant_exec_on_suspect_history_change).delete(handler);
4989
- }
4990
- };
4991
- (0, $9HbP8$instant_exec_on_suspect_history_change).add(handler);
4992
- });
4993
- }
4994
- navigate_ = {
4995
- /**
4996
- * Call this if you *just* want to replace the state object in history.state
4997
- */
4998
- replace_state_: new_state => {
4999
- // 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
5000
- globalThis?.history?.replaceState(new_state, "");
5001
- },
5002
- /**
5003
- * Call this to change the URL
5004
- * @param new_url_ new URL to go to
5005
- * @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
5006
- * @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
5007
- * @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
5008
- * @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
5009
- */
5010
- go_to_: $9HbP8$catchify(async ({
5011
- new_url_: raw_new_url,
5012
- event_: event_,
5013
- force_spa_navigation_: force_spa_navigation_,
5014
- is_replace_: is_replace_,
5015
- listing_query_: listing_query_,
5016
- scroll = true
5017
- }) => {
5018
- const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
5019
- const wants_hard_navigation = this.on_navigation_ === "hard_navigation";
5020
- if ($a281666e5c15c2ec$export$29d28dadc2d6b631(event_)) return;
5021
- const different_origin = new_url_.origin !== location.origin;
5022
- if (wants_hard_navigation && (!force_spa_navigation_ || different_origin)) {
5023
- if (force_spa_navigation_ && different_origin)
5024
- // If we call history.pushState on a different origin, it will throw an error, so fallback to hard navigations
5025
- $9HbP8$dwarn("Can't single page navigate to", new_url_.href, "due to different origin, this MIGHT mean you should fix the URLs");
5026
- if (!event_)
5027
- // If we haven't gotten an event, nothing will happen by not calling prevent default, so we need to change the URL
5028
- location.assign(new_url_);
5029
- return;
5030
- }
5031
- event_?.preventDefault();
5032
- const promise = this.#get_navigation_happened_promise(true);
5033
- if (force_spa_navigation_ && wants_hard_navigation) {
5034
- // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
5035
- const new_state = history.state;
5036
- if (listing_query_) {
5037
- // In JS-UI we need to know the listing_id of the current category, therefore push it into state
5038
- if (!this.listing_query_state_key) $9HbP8$report(new Error("listing_query_state_key is not set"), "error");
5039
- new_state[this.listing_query_state_key] = listing_query_;
5040
- }
5041
- history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
5042
- } else this.#throwing_on_navigation.call(this, {
5043
- is_replace: is_replace_,
5044
- new_url: new_url_ instanceof URL ? new_url_ : new URL(new_url_, location.origin),
5045
- scroll: scroll
5046
- });
5047
- await promise;
5048
- })
5049
- };
5050
- constructor(on_navigation, listing_query_state_key) {
5051
- this.listing_query_state_key = listing_query_state_key;
5052
- this.on_navigation_ = on_navigation;
5053
- }
5054
- }
5055
5174
  var $2a26c8ff1ef1fe75$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<div class=image-container>`);
5056
5175
  function $2a26c8ff1ef1fe75$export$41e1a079d40a0d58(props) {
5057
5176
  const [display] = $9HbP8$createResource(() => ({
@@ -5168,7 +5287,7 @@ function $3da8afe3ed57cf34$export$7da560f849543dff({
5168
5287
  _el$5 = _el$4.nextSibling,
5169
5288
  [_el$6, _co$2] = $9HbP8$getNextMarker(_el$5.nextSibling);
5170
5289
  $9HbP8$insert(_el$2, (0, $a458486f22b22f63$export$a2cc176055f8f08), _el$4, _co$);
5171
- $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
5290
+ $9HbP8$insert(_el$2, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps1({
5172
5291
  get rows() {
5173
5292
  return rows_object_();
5174
5293
  },
@@ -5544,14 +5663,14 @@ function $8560c919ff763930$var$ActualShopTheLookButton(props) {
5544
5663
  const displayStyleValue = $9HbP8$createMemo(() => hasAnythingToShow() ? "" : "none");
5545
5664
  const button = (() => {
5546
5665
  var _el$2 = $9HbP8$getNextElement($8560c919ff763930$var$_tmpl$2);
5547
- $9HbP8$spread(_el$2, $9HbP8$mergeProps(() => localProps.buttonAttributes), false, true);
5666
+ $9HbP8$spread(_el$2, $9HbP8$mergeProps1(() => localProps.buttonAttributes), false, true);
5548
5667
  $9HbP8$insert(_el$2, () => localProps?.buttonAttributes?.children || "Shop the look");
5549
5668
  $9HbP8$runHydrationEvents();
5550
5669
  return _el$2;
5551
5670
  })();
5552
5671
  $9HbP8$createEffect(() => button.style.display = displayStyleValue()); // Set our attributes like this, so we allow total control over the button from the outside via buttonAttributes
5553
5672
  $9HbP8$createEffect(() => !hasAnythingToShow() && closeModal()); // close modal if we ever get into the state of having it open and not having anything to show
5554
- $8560c919ff763930$var$modalProps = $9HbP8$mergeProps1(partForModal, {
5673
+ $8560c919ff763930$var$modalProps = $9HbP8$mergeProps(partForModal, {
5555
5674
  products_to_shop_: products_to_shop_
5556
5675
  });
5557
5676
  button.addEventListener("click", openModal);
@@ -6287,7 +6406,7 @@ var $f8a56ba74eedd0c6$var$_tmpl$ = /*#__PURE__*/$9HbP8$template(`<svg><path d="M
6287
6406
  function $f8a56ba74eedd0c6$export$f21ab0717a89c77f(props) {
6288
6407
  return (() => {
6289
6408
  var _el$ = $9HbP8$getNextElement($f8a56ba74eedd0c6$var$_tmpl$);
6290
- $9HbP8$spread(_el$, $9HbP8$mergeProps(props, {
6409
+ $9HbP8$spread(_el$, $9HbP8$mergeProps1(props, {
6291
6410
  "xmlns": "http://www.w3.org/2000/svg",
6292
6411
  "width": "11",
6293
6412
  "height": "12"
@@ -7762,7 +7881,7 @@ const $93716a9ad0dea854$export$414f6a19d38e655c = ({
7762
7881
  [_el$6, _co$] = $9HbP8$getNextMarker(_el$5.nextSibling),
7763
7882
  _el$7 = _el$6.nextSibling,
7764
7883
  [_el$8, _co$2] = $9HbP8$getNextMarker(_el$7.nextSibling);
7765
- $9HbP8$spread(_el$2, $9HbP8$mergeProps(attributes, {
7884
+ $9HbP8$spread(_el$2, $9HbP8$mergeProps1(attributes, {
7766
7885
  get disabled() {
7767
7886
  return $9HbP8$memo(() => !!count_zero())() && !is_selected();
7768
7887
  },
@@ -9160,7 +9279,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
9160
9279
  // Filter out our transformed ancestors
9161
9280
  const transformedAncestors = Object.fromEntries(transformerResult.filter(item => item.is_suggestion === false).map(item => [item.listing_id, item]));
9162
9281
  // Add the now transformed ancestors into the ancestors of the listing suggestions
9163
- const transformedSuggestions = transformerResult.filter(item => item.is_suggestion !== false).map(item => $9HbP8$mergeProps1(item, {
9282
+ const transformedSuggestions = transformerResult.filter(item => item.is_suggestion !== false).map(item => $9HbP8$mergeProps(item, {
9164
9283
  // Use mergeProps instead of spread since page_url and other properties could be a getter that solid components should call
9165
9284
  ancestors: item.ancestors.map(ancestor => {
9166
9285
  const newAncestor = transformedAncestors[ancestor.listing_id];
@@ -9720,7 +9839,7 @@ function $172e1b898d457050$export$7de92c4c2205ebf3({
9720
9839
  [_el$6, _co$2] = $9HbP8$getNextMarker(_el$5.nextSibling);
9721
9840
  $9HbP8$insert(_el$2, () => i18n_.search_recs_title_());
9722
9841
  $9HbP8$insert(_el$, (0, $a458486f22b22f63$export$a2cc176055f8f08), _el$4, _co$);
9723
- $9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
9842
+ $9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps1({
9724
9843
  rows: rows_object,
9725
9844
  layout: "grid",
9726
9845
  element_attributes: {
@@ -10449,7 +10568,7 @@ function $6dee9211e57ac31a$export$ab6b147eec64fea5(props) {
10449
10568
  const container_class = "x" + $9HbP8$createUniqueId();
10450
10569
  const container_element_ = (() => {
10451
10570
  var _el$ = $9HbP8$getNextElement($6dee9211e57ac31a$var$_tmpl$);
10452
- $9HbP8$spread(_el$, $9HbP8$mergeProps(() => props.element_attributes, {
10571
+ $9HbP8$spread(_el$, $9HbP8$mergeProps1(() => props.element_attributes, {
10453
10572
  "classList": {
10454
10573
  [container_class]: true
10455
10574
  }
@@ -10724,7 +10843,7 @@ function $e7a7eb102ddc0c79$var$wrap_blocks_in_div(rendered_content_blocks, max_s
10724
10843
  return _el$;
10725
10844
  }
10726
10845
  });
10727
- return $9HbP8$mergeProps1(block, {
10846
+ return $9HbP8$mergeProps(block, {
10728
10847
  // Create content divs for the blocks with as much fine-grained diffing as possible?
10729
10848
  content: () => {
10730
10849
  // 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
@@ -10965,7 +11084,7 @@ function $2d25e42846eac370$export$3925f87b1545cfc6({
10965
11084
  } = slider;
10966
11085
  const Layout = props => $c8d5ff4524619fcd$export$445d8d3f5f706a40(props, insert_here, true);
10967
11086
  // Do like this, so we don't have to call mergeProps ourselves
10968
- $9HbP8$createComponent(Layout, $9HbP8$mergeProps(layout_options_, {
11087
+ $9HbP8$createComponent(Layout, $9HbP8$mergeProps1(layout_options_, {
10969
11088
  rows: "all",
10970
11089
  get cols_at_size() {
10971
11090
  return modified_cols_at_size();
@@ -11470,7 +11589,7 @@ function $757dac7f7c6c5241$export$9bf11afa910f536e({
11470
11589
  get children() {
11471
11590
  return (() => {
11472
11591
  var _el$34 = $9HbP8$getNextElement($757dac7f7c6c5241$var$_tmpl$5);
11473
- $9HbP8$insert(_el$34, $9HbP8$createComponent((0, $fab07f52c9861732$export$3f1a388cc0d8fed7), $9HbP8$mergeProps(args_for_filtering_, {
11592
+ $9HbP8$insert(_el$34, $9HbP8$createComponent((0, $fab07f52c9861732$export$3f1a388cc0d8fed7), $9HbP8$mergeProps1(args_for_filtering_, {
11474
11593
  are_in_modal_: true
11475
11594
  })));
11476
11595
  return _el$34;
@@ -12236,7 +12355,7 @@ function $b2bf2cdcff8142d8$export$f631859cab12b342({
12236
12355
  [_el$8, _co$] = $9HbP8$getNextMarker(_el$7.nextSibling),
12237
12356
  _el$9 = _el$8.nextSibling,
12238
12357
  [_el$10, _co$2] = $9HbP8$getNextMarker(_el$9.nextSibling);
12239
- $9HbP8$insert(_el$4, $9HbP8$createComponent(LinkIfPossible, $9HbP8$mergeProps(make_link_attributes, {
12358
+ $9HbP8$insert(_el$4, $9HbP8$createComponent(LinkIfPossible, $9HbP8$mergeProps1(make_link_attributes, {
12240
12359
  tabIndex: "-1",
12241
12360
  get children() {
12242
12361
  return $9HbP8$createComponent((0, $190927650b4840eb$export$605674723bcc715c), {
@@ -12245,7 +12364,7 @@ function $b2bf2cdcff8142d8$export$f631859cab12b342({
12245
12364
  });
12246
12365
  }
12247
12366
  })));
12248
- $9HbP8$insert(_el$5, $9HbP8$createComponent(LinkIfPossible, $9HbP8$mergeProps({
12367
+ $9HbP8$insert(_el$5, $9HbP8$createComponent(LinkIfPossible, $9HbP8$mergeProps1({
12249
12368
  "class": "content-title line-clamp"
12250
12369
  }, make_link_attributes, {
12251
12370
  get title() {
@@ -12392,7 +12511,7 @@ function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
12392
12511
  },
12393
12512
  number_of_results_: num_results
12394
12513
  }), _el$3, _co$);
12395
- $9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps({
12514
+ $9HbP8$insert(_el$, $9HbP8$createComponent((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), $9HbP8$mergeProps1({
12396
12515
  layout: "grid",
12397
12516
  element_attributes: {
12398
12517
  class: "cards"
@@ -12779,7 +12898,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
12779
12898
  });
12780
12899
  const [sort_and_filter_element_, set_sort_and_filter_element_] = $9HbP8$createSignal();
12781
12900
  const no_results_text_ = $9HbP8$createMemo(() => (search_results_()?.content_search_links?.length ? i18n_.no_products_ : i18n_.no_results_text_)());
12782
- const results_for = $9HbP8$createComponent((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), $9HbP8$mergeProps({
12901
+ const results_for = $9HbP8$createComponent((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), $9HbP8$mergeProps1({
12783
12902
  get type() {
12784
12903
  return (0, $f8c929beb82c512b$export$2452208c79fe93ea).products;
12785
12904
  },
@@ -14672,7 +14791,7 @@ function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta) {
14672
14791
  return $9HbP8$createMemo(() => {
14673
14792
  const api_value = plp_meta()?.breadcrumbs;
14674
14793
  if (!api_value) return api_value;
14675
- return [...api_value, $9HbP8$mergeProps1(plp_meta(), {
14794
+ return [...api_value, $9HbP8$mergeProps(plp_meta(), {
14676
14795
  get page_url() {
14677
14796
  return href_accessor();
14678
14797
  }