@depict-ai/ui 4.8.0 → 4.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { add_to_version_info as $b8hua$add_to_version_info, queueMacroTask as $b8hua$queueMacroTask, catchify as $b8hua$catchify, findMostFrequentItem as $b8hua$findMostFrequentItem, dwarn as $b8hua$dwarn, observer as $b8hua$observer, layout_media_query_header as $b8hua$layout_media_query_header, javascript_media_query as $b8hua$javascript_media_query, slider_fading_factory as $b8hua$slider_fading_factory, Amazing_Slider as $b8hua$Amazing_Slider, slider_snap_css as $b8hua$slider_snap_css, dlog as $b8hua$dlog1, camelCasifyObject as $b8hua$camelCasifyObject, useExpandingContainer as $b8hua$useExpandingContainer, fetch_retry as $b8hua$fetch_retry, base_url as $b8hua$base_url, slider_fractional_factory as $b8hua$slider_fractional_factory, make_random_classname as $b8hua$make_random_classname, n_col_styling_with_dist as $b8hua$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $b8hua$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $b8hua$layout_get_total_rec_amount_for_row, report as $b8hua$report, standard_price_format as $b8hua$standard_price_format, instant_exec_on_suspect_history_change as $b8hua$instant_exec_on_suspect_history_change, deparallelize_no_drop as $b8hua$deparallelize_no_drop, ContainedImage as $b8hua$ContainedImage, make_asyncIterable_exiter as $b8hua$make_asyncIterable_exiter, href_change_ipns as $b8hua$href_change_ipns, base64_encode_unicode as $b8hua$base64_encode_unicode, base64_decode_unicode as $b8hua$base64_decode_unicode, use_href_accessor as $b8hua$use_href_accessor, get_session_id as $b8hua$get_session_id, add_version_query_params as $b8hua$add_version_query_params, hex_to_rgb as $b8hua$hex_to_rgb, relative_luminance_from_rgb as $b8hua$relative_luminance_from_rgb, snakeCasifyObject as $b8hua$snakeCasifyObject, make_url_with_query_params as $b8hua$make_url_with_query_params, sort_obj as $b8hua$sort_obj, insert_surfaces as $b8hua$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
2
  import { createComponent as $b8hua$createComponent, mergeProps as $b8hua$mergeProps, insert as $b8hua$insert, ssr as $b8hua$ssr, ssrHydrationKey as $b8hua$ssrHydrationKey, ssrStyle as $b8hua$ssrStyle, ssrAttribute as $b8hua$ssrAttribute, escape as $b8hua$escape, spread as $b8hua$spread, isServer as $b8hua$isServer, ssrElement as $b8hua$ssrElement, ssrClassList as $b8hua$ssrClassList, Dynamic as $b8hua$Dynamic } from "solid-js/web";
3
- import { createSignal as $b8hua$createSignal, getOwner as $b8hua$getOwner, createEffect as $b8hua$createEffect, runWithOwner as $b8hua$runWithOwner, onCleanup as $b8hua$onCleanup, createContext as $b8hua$createContext, useContext as $b8hua$useContext, createMemo as $b8hua$createMemo, splitProps as $b8hua$splitProps, mergeProps as $b8hua$mergeProps1, untrack as $b8hua$untrack, createRenderEffect as $b8hua$createRenderEffect, Show as $b8hua$Show, batch as $b8hua$batch, createComputed as $b8hua$createComputed, mapArray as $b8hua$mapArray, createResource as $b8hua$createResource, Suspense as $b8hua$Suspense, createRoot as $b8hua$createRoot, For as $b8hua$For, Index as $b8hua$Index, createUniqueId as $b8hua$createUniqueId, ErrorBoundary as $b8hua$ErrorBoundary, on as $b8hua$on, createSelector as $b8hua$createSelector, children as $b8hua$children, createReaction as $b8hua$createReaction } from "solid-js";
3
+ import { createSignal as $b8hua$createSignal, getOwner as $b8hua$getOwner, createEffect as $b8hua$createEffect, runWithOwner as $b8hua$runWithOwner, onCleanup as $b8hua$onCleanup, createContext as $b8hua$createContext, useContext as $b8hua$useContext, createMemo as $b8hua$createMemo, splitProps as $b8hua$splitProps, mergeProps as $b8hua$mergeProps1, untrack as $b8hua$untrack, createRenderEffect as $b8hua$createRenderEffect, Show as $b8hua$Show, batch as $b8hua$batch, createComputed as $b8hua$createComputed, mapArray as $b8hua$mapArray, createResource as $b8hua$createResource, Suspense as $b8hua$Suspense, createRoot as $b8hua$createRoot, For as $b8hua$For, Index as $b8hua$Index, createUniqueId as $b8hua$createUniqueId, ErrorBoundary as $b8hua$ErrorBoundary, on as $b8hua$on, createSelector as $b8hua$createSelector, children as $b8hua$children, createReaction as $b8hua$createReaction, Switch as $b8hua$Switch, Match as $b8hua$Match } from "solid-js";
4
4
  import { createStore as $b8hua$createStore, reconcile as $b8hua$reconcile } from "solid-js/store";
5
5
  import { dlog as $b8hua$dlog, catchify as $b8hua$catchify1, ListenableSet as $b8hua$ListenableSet, use_href_accessor as $b8hua$use_href_accessor1, queueMacroTask as $b8hua$queueMacroTask1, report as $b8hua$report1 } from "@depict-ai/utilishared/ES10";
6
6
  import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/defineProperty";
@@ -10,7 +10,14 @@ import $b8hua$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpe
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.8.0";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.8.1";
14
+
15
+ // Value first so shopify merchants can set (extra) display transformers in the shopify app
16
+ // Calling these functions normally doesn't do anything, but our shopify app respects them
17
+ // Them being here is value first too because this can be easily imported in the product card editor
18
+ let $80c7883e020be192$var$extraDisplayTransformers;
19
+ const $80c7883e020be192$export$b2d94be4f02525b2 = () => $80c7883e020be192$var$extraDisplayTransformers;
20
+ const $80c7883e020be192$export$f98b8d5ea7207a1 = displayTransformers => $80c7883e020be192$var$extraDisplayTransformers = displayTransformers;
14
21
  const $5441862cd2f5e111$var$ListingContext = /*@__PURE__*/$b8hua$createContext();
15
22
  function $5441862cd2f5e111$export$e68cff63f76bd15b(props) {
16
23
  const our_object = {};
@@ -77,8 +84,12 @@ const $56047603f9d212b6$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingCo
77
84
  function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
78
85
  const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
79
86
  const [ourRatioKeyed, setOurRatioKeyed] = $b8hua$createSignal();
87
+ const [rAFSinceReturned, setRAFSinceReturned] = $b8hua$createSignal(false);
80
88
  const sizeToUse = $b8hua$createMemo(() => {
81
89
  var _props$sizeHeight;
90
+ // We first put the images into the DOM after they have been decoded. We can only get the correct object-fit value after the image is in the DOM.
91
+ // To avoid using an observer for knowing when the image is in the DOM (one of the most CPU intensive things when we did lighthouse optimisation) we just re-check an animationframe after we told <Show> to show the image, which seems to work reliably
92
+ rAFSinceReturned();
82
93
  // props.size could be a getter that expects a cleanup so get it in this memo instead of where we set img.sizes (also we need to multiply, and it's good with some diffing here so people calling the comp don't have to)
83
94
  const incomingSize = props.size();
84
95
  const ratio = ourRatioKeyed();
@@ -237,6 +248,7 @@ function $56047603f9d212b6$export$6e5611bc7e57e477(props) {
237
248
  hasDecodedFastPath = true;
238
249
  });
239
250
  });
251
+ $b8hua$createEffect(() => hasDecoded() && requestAnimationFrame($b8hua$catchify(() => setRAFSinceReturned(prev => !prev))));
240
252
  return $b8hua$createComponent((0, $b8hua$Show), {
241
253
  get when() {
242
254
  return hasDecoded();
@@ -438,13 +450,6 @@ function $98688279b9059f50$export$140423fa4bfb6d63(props) {
438
450
  customUrls: $98688279b9059f50$var$customUrls
439
451
  }));
440
452
  }
441
-
442
- // Value first so shopify merchants can set (extra) display transformers in the shopify app
443
- // Calling these functions normally doesn't do anything, but our shopify app respects them
444
- // Them being here is value first too because this can be easily imported in the product card editor
445
- let $80c7883e020be192$var$extraDisplayTransformers;
446
- const $80c7883e020be192$export$b2d94be4f02525b2 = () => $80c7883e020be192$var$extraDisplayTransformers;
447
- const $80c7883e020be192$export$f98b8d5ea7207a1 = displayTransformers => $80c7883e020be192$var$extraDisplayTransformers = displayTransformers;
448
453
  function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
449
454
  const signal = $b8hua$createSignal(false);
450
455
  $b8hua$onCleanup($b8hua$javascript_media_query(media_query, _ref => {
@@ -8158,7 +8163,8 @@ function $bc811d9630f9579b$export$9862539c89138352(_ref) {
8158
8163
  let {
8159
8164
  get_default_values_: get_default_values_,
8160
8165
  router_: router_,
8161
- prefix_: prefix_
8166
+ prefix_: prefix_,
8167
+ preserveKeys_: preserveKeys_
8162
8168
  } = _ref;
8163
8169
  const get_prefixed_default_values_ = () => {
8164
8170
  const default_values = get_default_values_();
@@ -8168,9 +8174,11 @@ function $bc811d9630f9579b$export$9862539c89138352(_ref) {
8168
8174
  }));
8169
8175
  };
8170
8176
  const prefixed_state = $972f6bce0f9d61be$export$e183a13865960371(get_prefixed_default_values_(), router_);
8177
+ const prefixedPreserveKeys = preserveKeys_ === null || preserveKeys_ === void 0 ? void 0 : preserveKeys_.map(key => prefix_ + key);
8171
8178
  const reset_state = () => {
8172
8179
  const new_defaults = get_prefixed_default_values_();
8173
8180
  for (const key in prefixed_state) {
8181
+ if (prefixedPreserveKeys !== null && prefixedPreserveKeys !== void 0 && prefixedPreserveKeys.includes(key)) continue;
8174
8182
  const new_value = new_defaults[key];
8175
8183
  prefixed_state[key][1](new_value);
8176
8184
  }
@@ -8905,8 +8913,13 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
8905
8913
  local_filter_cache: [],
8906
8914
  expanded_hierarchical_filters: [],
8907
8915
  scroll_restoration_data: [],
8908
- history_content_blocks: []
8916
+ history_content_blocks: {
8917
+ blocks: [],
8918
+ aspectRatios: {}
8919
+ }
8909
8920
  }),
8921
+ // Don't reset content block stuff when leaving category page as we need it for scroll restoration, same with scroll restoration data (actually a bit unsure if this is needed, I think it depends on if someone cleans up our elements before the location changes or after, and maybe some of the test flakyness we have seen is due to this not existing before?)
8922
+ preserveKeys_: ["history_content_blocks", "scroll_restoration_data"],
8910
8923
  router_: $b8hua$babelruntimehelpersclassPrivateFieldGet(this, $f5f54892fd0c7d9f$var$_router),
8911
8924
  prefix_: "category" + unique_instance_key_for_state + "_"
8912
8925
  });
@@ -13225,81 +13238,125 @@ function $a4777acaffa35a82$var$clear_if_opened_new_tab_with_sideways_url_params_
13225
13238
  });
13226
13239
  tracking_function_for_plp_results(plp_results_);
13227
13240
  }
13228
- var $3b772ef9a35560fe$var$_tmpl$ = ["<a", ' class="d-standard-content-wrapper"', "><video", ' muted="" autoplay="" playsinline="" loop class="d-standard-content"></video></a>'];
13241
+ var $3b772ef9a35560fe$var$_tmpl$ = ["<video", ' muted="" autoplay="" playsinline="" loop class="d-standard-content"></video>'];
13229
13242
  function $3b772ef9a35560fe$export$780a853d15174484(_ref) {
13230
13243
  let {
13231
- contentBlock_: {
13232
- content: {
13233
- link: link,
13234
- type: type,
13235
- url: mediaUrl
13236
- }
13237
- },
13238
- router_: router_
13244
+ link_: link_,
13245
+ type_: type_,
13246
+ router_: router_,
13247
+ setAspectRatioWas_: setAspectRatioWas_,
13248
+ mediaUrl_: mediaUrl_,
13249
+ aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
13239
13250
  } = _ref;
13240
- if (type === "image") {
13241
- const [wrapperSize, setWrapperSize] = $b8hua$createSignal();
13242
- return $b8hua$createComponent((0, $b8hua$Dynamic), $b8hua$mergeProps({
13243
- component: link ? "a" : "div",
13244
- "class": "d-standard-content-wrapper",
13245
- get onClick() {
13246
- return $b8hua$catchify1(ev => link && router_.navigate_.go_to_({
13247
- new_url_: link,
13248
- is_replace_: false,
13249
- event_: ev
13250
- }));
13251
- }
13252
- }, link && {
13253
- href: link
13254
- }, {
13255
- get children() {
13256
- return $b8hua$createComponent((0, $98688279b9059f50$export$140423fa4bfb6d63), {
13257
- size: () => {
13258
- var _wrapperSize, _wrapperSize$;
13259
- return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : (_wrapperSize$ = _wrapperSize[0]) === null || _wrapperSize$ === void 0 ? void 0 : _wrapperSize$.call(_wrapperSize)) || 0;
13260
- },
13261
- sizeHeight: () => {
13262
- var _wrapperSize2, _wrapperSize2$;
13263
- return ((_wrapperSize2 = wrapperSize()) === null || _wrapperSize2 === void 0 ? void 0 : (_wrapperSize2$ = _wrapperSize2[1]) === null || _wrapperSize2$ === void 0 ? void 0 : _wrapperSize2$.call(_wrapperSize2)) || 0;
13264
- },
13265
- src: mediaUrl,
13266
- "class": "d-standard-content"
13267
- });
13268
- }
13269
- }));
13270
- }
13271
- if (type === "video") {
13272
- const pageVisible = $a35e6f680c5bbc60$export$54299a3c81f5425();
13273
- return $b8hua$ssr($3b772ef9a35560fe$var$_tmpl$, $b8hua$ssrHydrationKey(), $b8hua$ssrAttribute("href", $b8hua$escape(link, true), false), $b8hua$ssrAttribute("src", $b8hua$escape(mediaUrl, true), false));
13274
- }
13251
+ const [wrapperSize, setWrapperSize] = $b8hua$createSignal();
13252
+ const isImage = type_ === "image";
13253
+ return $b8hua$createComponent((0, $b8hua$Dynamic), $b8hua$mergeProps({
13254
+ component: link_ ? "a" : "div",
13255
+ "class": "d-standard-content-wrapper",
13256
+ get style() {
13257
+ return aspectRatioWhenAloneInRow_() ? "--media-aspect-ratio: ".concat(aspectRatioWhenAloneInRow_()) : "";
13258
+ },
13259
+ get onClick() {
13260
+ return $b8hua$catchify1(ev => link_ && router_.navigate_.go_to_({
13261
+ new_url_: link_,
13262
+ is_replace_: false,
13263
+ event_: ev
13264
+ }));
13265
+ }
13266
+ }, link_ && {
13267
+ href: link_
13268
+ }, {
13269
+ get children() {
13270
+ return $b8hua$createComponent((0, $b8hua$Switch), {
13271
+ get children() {
13272
+ return [$b8hua$createComponent((0, $b8hua$Match), {
13273
+ when: isImage,
13274
+ get children() {
13275
+ return $b8hua$createComponent((0, $98688279b9059f50$export$140423fa4bfb6d63), {
13276
+ size: () => {
13277
+ var _wrapperSize, _wrapperSize$;
13278
+ return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : (_wrapperSize$ = _wrapperSize[0]) === null || _wrapperSize$ === void 0 ? void 0 : _wrapperSize$.call(_wrapperSize)) || 0;
13279
+ },
13280
+ sizeHeight: () => {
13281
+ var _wrapperSize2, _wrapperSize2$;
13282
+ return ((_wrapperSize2 = wrapperSize()) === null || _wrapperSize2 === void 0 ? void 0 : (_wrapperSize2$ = _wrapperSize2[1]) === null || _wrapperSize2$ === void 0 ? void 0 : _wrapperSize2$.call(_wrapperSize2)) || 0;
13283
+ },
13284
+ src: mediaUrl_,
13285
+ "class": "d-standard-content"
13286
+ });
13287
+ }
13288
+ }), $b8hua$createComponent((0, $b8hua$Match), {
13289
+ when: type_ === "video",
13290
+ get children() {
13291
+ return $b8hua$ssr($3b772ef9a35560fe$var$_tmpl$, $b8hua$ssrHydrationKey() + $b8hua$ssrAttribute("src", $b8hua$escape(mediaUrl_, true), false));
13292
+ }
13293
+ })];
13294
+ }
13295
+ });
13296
+ }
13297
+ }));
13275
13298
  }
13276
13299
  function $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
13277
13300
  let hasSeenContentBlock = false;
13278
13301
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
13302
+ const contentComponents = new Map();
13279
13303
  $b8hua$createEffect(() => {
13280
13304
  var _plp_meta;
13281
13305
  const serverContentBlock = (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
13282
- if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(historyContentBlocks())) setHistoryContentBlocks(serverContentBlock);
13306
+ const currentHistory = $b8hua$untrack(historyContentBlocks);
13307
+ // Only write to the history if the content blocks have changed when a new backend results arrives (we have them in history so scroll restoration works when going back, even when running shopify without single page navigations where our script dies inbetween pages).
13308
+ if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
13309
+ ...currentHistory,
13310
+ blocks: serverContentBlock
13311
+ });
13283
13312
  });
13284
13313
  const contentBlocksByRow = $b8hua$createMemo(() => {
13285
13314
  const developerProvided = content_blocks_by_row_();
13286
- const fromHistory = historyContentBlocks();
13315
+ const {
13316
+ blocks: blocksFromHistory
13317
+ } = historyContentBlocks();
13287
13318
  if (developerProvided) return developerProvided;
13288
13319
  // If we didn't get any content blocks (backend always return empty array) and we haven't seen any content blocks yet, return undefined
13289
13320
  // This is so the result rendering (PLPResults) will still use flexbox provided rendering on existing customers, so adding this isn't a breaking change
13290
13321
  // We don't want to switch rendering method every time one switches between a collection that hasn't vs has content blocks though, so once we've seen one content block we'll switch to css-grid-based rendering
13291
- if (!(fromHistory !== null && fromHistory !== void 0 && fromHistory.length) && !hasSeenContentBlock) return undefined;
13322
+ if (!(blocksFromHistory !== null && blocksFromHistory !== void 0 && blocksFromHistory.length) && !hasSeenContentBlock) return;
13292
13323
  const content = [];
13293
13324
  hasSeenContentBlock = true;
13294
- fromHistory.forEach(row => {
13325
+ blocksFromHistory.forEach(row => {
13326
+ const {
13327
+ content: {
13328
+ link: link,
13329
+ type: type,
13330
+ url: url
13331
+ }
13332
+ } = row;
13333
+ // Key the "content"-component by the link, type and url, so we can reuse the component (and later downstream the block elements) if it's the same
13334
+ // This makes the block not flicker when going backwards/forwards if the content is the same on both pages
13335
+ // Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
13336
+ const componentCacheKey = JSON.stringify([link, type, url]);
13337
+ let component = contentComponents.get(componentCacheKey);
13338
+ if (!component) {
13339
+ component = () => $b8hua$createComponent((0, $3b772ef9a35560fe$export$780a853d15174484), {
13340
+ link_: link,
13341
+ type_: type,
13342
+ mediaUrl_: url,
13343
+ router_: router_,
13344
+ aspectRatioWhenAloneInRow_: () => historyContentBlocks().aspectRatios[componentCacheKey],
13345
+ setAspectRatioWas_: aspectRatio => setHistoryContentBlocks(prev => ({
13346
+ ...prev,
13347
+ aspectRatios: {
13348
+ ...prev.aspectRatios,
13349
+ [componentCacheKey]: Math.round(aspectRatio * 100) / 100
13350
+ }
13351
+ }))
13352
+ });
13353
+ contentComponents.set(componentCacheKey, component);
13354
+ }
13295
13355
  const contentBlock = {
13296
13356
  span_columns: row.span_columns,
13297
13357
  span_rows: row.span_rows,
13298
13358
  position: row.position,
13299
- content: () => $b8hua$createComponent((0, $3b772ef9a35560fe$export$780a853d15174484), {
13300
- contentBlock_: row,
13301
- router_: router_
13302
- })
13359
+ content: component
13303
13360
  };
13304
13361
  content[row.row] = contentBlock;
13305
13362
  });
@@ -13809,4 +13866,4 @@ function $8821a19349c36651$export$e2bf8ce7779e827e(props) {
13809
13866
  }, "Entire CategoryPage failed");
13810
13867
  }
13811
13868
  $b8hua$add_to_version_info("ui", (0, $8db9a15135765c11$export$83d89fbfd8236492));
13812
- export { $98688279b9059f50$export$140423fa4bfb6d63 as ModernResponsiveImage, $80c7883e020be192$export$f98b8d5ea7207a1 as setExtraDisplayTransformers, $80c7883e020be192$export$b2d94be4f02525b2 as getExtraDisplayTransformers, $ff7feae4dddd6073$export$92aa5d691d588f3f as remap_blocks_to_index, $715f7f2e53146662$export$d4d96868197be50e as useMobileHover, $a35e6f680c5bbc60$export$54299a3c81f5425 as useVisibilityState, $002f09d00aac50b2$export$eaa625fb39439e37 as useSlidableInformation, $618bd53ea0a41cd4$export$80bb7300ce6a8be3 as useProductCardIsVisible, $618bd53ea0a41cd4$export$f223d69ed12f5fb7 as CurrentlyIntersectingContext, $8e8b179489080711$export$5bad61ecde080b1f as useExpandingContainerReactive, $bb34cd283e904784$export$2c9f9bf2092486aa as LooksSliderOrGrid, $22dd375b476673e2$export$44809a8a3e867e30 as LookCard, $ac571292d606f30b$export$7e1297a3a19f10d8 as PseudoRouter, $6d75ec14f537c37f$export$83bb9af5671e1dbe as promiseSafeStructuredClone, $68e6625c8d51f847$export$5162a71f252e6122 as preserve_items_in_history_dot_state, $68e6625c8d51f847$export$3064e1e8c6513da3 as prefixes_to_preserve_in_history_dot_state, $9b35d1384e31813a$export$29d28dadc2d6b631 as allowNativeNavigation, $b026fa9c9c904a98$export$1ea76ea778b880dd as modalVersionSymbol, $a604a8ffa4e4c03f$export$e417c49320921907 as createDeparallelizedNoDropResource, $01c33966d9ddb108$export$f50b88e2a00918b5 as throw_globally, $40411f2ec772c376$export$9265e66f26f8e383 as ClassicSearchModal, $06fcd2a345efd24d$export$b0c55aa2e87c4be7 as SearchModalV2, $98688279b9059f50$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $6a439680ae7e9ba3$export$3e41faf802a29e71 as Tab, $6a439680ae7e9ba3$export$b2539bed5023c21c as Tabs, $6b0fd8fd20df8ccf$export$d4973c31938cbfd1 as ShopTheLookButton, $972f6bce0f9d61be$export$e183a13865960371 as history_dot_state_to_state, $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $2855bffe06ef7a03$export$62acb285a7579555 as encode_sorting, $2855bffe06ef7a03$export$766e9676e74997d3 as decode_sorting, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $1e69163caedaab4e$export$11354f017ddc9790 as ProductCardIndexProvider, $1e69163caedaab4e$export$e3faf4d95300054f as useProductCardIndex, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $fc830a7ee59416ef$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $74777e8fe65b3dcb$export$240ecf5363d76c0f as ExtraSentryContextProvider, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $63f1f8dbcd07d3b0$export$445d8d3f5f706a40 as SolidLayoutWithProvidedElement, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $50aebf5b445518eb$export$58e808b1db15d3bc as fetchDepictRecommendations, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $160ea2b55d8772d2$export$c1a6b039e689a58e as get_listings, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $1308a7816c3d4f2d$export$3f238c96c45e6cc6 as ALIGN_TOP, $1308a7816c3d4f2d$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $1308a7816c3d4f2d$export$7895aadd1956b1c7 as ALIGN_LEFT, $1308a7816c3d4f2d$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version, $a3026fb727bc7550$export$316f6f283ae64765 as SearchField, $62a8813a51fbd22f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $62a8813a51fbd22f$export$de035477d6fef996 as QuickLinks, $8821a19349c36651$export$e2bf8ce7779e827e as CategoryPage, $4be619ec2cd7bba3$export$54c6d6ff54e72743 as makeSizeAccessors };
13869
+ export { $80c7883e020be192$export$f98b8d5ea7207a1 as setExtraDisplayTransformers, $80c7883e020be192$export$b2d94be4f02525b2 as getExtraDisplayTransformers, $98688279b9059f50$export$140423fa4bfb6d63 as ModernResponsiveImage, $ff7feae4dddd6073$export$92aa5d691d588f3f as remap_blocks_to_index, $715f7f2e53146662$export$d4d96868197be50e as useMobileHover, $a35e6f680c5bbc60$export$54299a3c81f5425 as useVisibilityState, $002f09d00aac50b2$export$eaa625fb39439e37 as useSlidableInformation, $618bd53ea0a41cd4$export$80bb7300ce6a8be3 as useProductCardIsVisible, $618bd53ea0a41cd4$export$f223d69ed12f5fb7 as CurrentlyIntersectingContext, $8e8b179489080711$export$5bad61ecde080b1f as useExpandingContainerReactive, $bb34cd283e904784$export$2c9f9bf2092486aa as LooksSliderOrGrid, $22dd375b476673e2$export$44809a8a3e867e30 as LookCard, $ac571292d606f30b$export$7e1297a3a19f10d8 as PseudoRouter, $6d75ec14f537c37f$export$83bb9af5671e1dbe as promiseSafeStructuredClone, $68e6625c8d51f847$export$5162a71f252e6122 as preserve_items_in_history_dot_state, $68e6625c8d51f847$export$3064e1e8c6513da3 as prefixes_to_preserve_in_history_dot_state, $9b35d1384e31813a$export$29d28dadc2d6b631 as allowNativeNavigation, $b026fa9c9c904a98$export$1ea76ea778b880dd as modalVersionSymbol, $a604a8ffa4e4c03f$export$e417c49320921907 as createDeparallelizedNoDropResource, $01c33966d9ddb108$export$f50b88e2a00918b5 as throw_globally, $40411f2ec772c376$export$9265e66f26f8e383 as ClassicSearchModal, $06fcd2a345efd24d$export$b0c55aa2e87c4be7 as SearchModalV2, $98688279b9059f50$export$9d4a4b669b1929ab as ModernResponsiveContainedImage, $6a439680ae7e9ba3$export$3e41faf802a29e71 as Tab, $6a439680ae7e9ba3$export$b2539bed5023c21c as Tabs, $6b0fd8fd20df8ccf$export$d4973c31938cbfd1 as ShopTheLookButton, $972f6bce0f9d61be$export$e183a13865960371 as history_dot_state_to_state, $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $2855bffe06ef7a03$export$62acb285a7579555 as encode_sorting, $2855bffe06ef7a03$export$766e9676e74997d3 as decode_sorting, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $1e69163caedaab4e$export$11354f017ddc9790 as ProductCardIndexProvider, $1e69163caedaab4e$export$e3faf4d95300054f as useProductCardIndex, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $fc830a7ee59416ef$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $74777e8fe65b3dcb$export$240ecf5363d76c0f as ExtraSentryContextProvider, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $63f1f8dbcd07d3b0$export$445d8d3f5f706a40 as SolidLayoutWithProvidedElement, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $50aebf5b445518eb$export$58e808b1db15d3bc as fetchDepictRecommendations, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $160ea2b55d8772d2$export$c1a6b039e689a58e as get_listings, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $1308a7816c3d4f2d$export$3f238c96c45e6cc6 as ALIGN_TOP, $1308a7816c3d4f2d$export$902f8b4a7dae5d78 as ALIGN_WIDTH_ON_MODAL, $1308a7816c3d4f2d$export$7895aadd1956b1c7 as ALIGN_LEFT, $1308a7816c3d4f2d$export$6060bc6bee850eb6 as SET_CENTERED_LEFT, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version, $a3026fb727bc7550$export$316f6f283ae64765 as SearchField, $62a8813a51fbd22f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $62a8813a51fbd22f$export$de035477d6fef996 as QuickLinks, $8821a19349c36651$export$e2bf8ce7779e827e as CategoryPage };
@@ -12,9 +12,9 @@ function $parcel$export(e, n, v, s) {
12
12
  configurable: true
13
13
  });
14
14
  }
15
- $parcel$export(module.exports, "ModernResponsiveImage", () => $d212a67662c5cf38$export$140423fa4bfb6d63);
16
15
  $parcel$export(module.exports, "setExtraDisplayTransformers", () => $606c221d98ba4d92$export$f98b8d5ea7207a1);
17
16
  $parcel$export(module.exports, "getExtraDisplayTransformers", () => $606c221d98ba4d92$export$b2d94be4f02525b2);
17
+ $parcel$export(module.exports, "ModernResponsiveImage", () => $d212a67662c5cf38$export$140423fa4bfb6d63);
18
18
  $parcel$export(module.exports, "remap_blocks_to_index", () => $d92f338ba8f9da9b$export$92aa5d691d588f3f);
19
19
  $parcel$export(module.exports, "useMobileHover", () => $8bf678c45948a297$export$d4d96868197be50e);
20
20
  $parcel$export(module.exports, "useVisibilityState", () => $55cbacb79d3e0cea$export$54299a3c81f5425);
@@ -106,9 +106,15 @@ $parcel$export(module.exports, "SearchField", () => $c0a0659cf97e8eb2$export$316
106
106
  $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7c3ce0ebe51f86);
107
107
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
108
108
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
109
- $parcel$export(module.exports, "makeSizeAccessors", () => $128302ab61dab8f1$export$54c6d6ff54e72743);
110
109
  /*! Depict.ai search and product listing SDK */
111
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.0";
110
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.8.1";
111
+
112
+ // Value first so shopify merchants can set (extra) display transformers in the shopify app
113
+ // Calling these functions normally doesn't do anything, but our shopify app respects them
114
+ // Them being here is value first too because this can be easily imported in the product card editor
115
+ let $606c221d98ba4d92$var$extraDisplayTransformers;
116
+ const $606c221d98ba4d92$export$b2d94be4f02525b2 = () => $606c221d98ba4d92$var$extraDisplayTransformers;
117
+ const $606c221d98ba4d92$export$f98b8d5ea7207a1 = displayTransformers => $606c221d98ba4d92$var$extraDisplayTransformers = displayTransformers;
112
118
  const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$5vyXB$solidjs.createContext();
113
119
  function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
114
120
  const our_object = {};
@@ -174,7 +180,11 @@ const $19950faaac026e09$export$6066eb417ed2e9f7 = /*@__PURE__*/Symbol("listingCo
174
180
  function $19950faaac026e09$export$6e5611bc7e57e477(props) {
175
181
  const img = new Image(); // Need to use new Image or browser might not start loading image before it's in the DOM
176
182
  const [ourRatioKeyed, setOurRatioKeyed] = $5vyXB$solidjs.createSignal();
183
+ const [rAFSinceReturned, setRAFSinceReturned] = $5vyXB$solidjs.createSignal(false);
177
184
  const sizeToUse = $5vyXB$solidjs.createMemo(() => {
185
+ // We first put the images into the DOM after they have been decoded. We can only get the correct object-fit value after the image is in the DOM.
186
+ // To avoid using an observer for knowing when the image is in the DOM (one of the most CPU intensive things when we did lighthouse optimisation) we just re-check an animationframe after we told <Show> to show the image, which seems to work reliably
187
+ rAFSinceReturned();
178
188
  // props.size could be a getter that expects a cleanup so get it in this memo instead of where we set img.sizes (also we need to multiply, and it's good with some diffing here so people calling the comp don't have to)
179
189
  const incomingSize = props.size();
180
190
  const ratio = ourRatioKeyed();
@@ -330,6 +340,7 @@ function $19950faaac026e09$export$6e5611bc7e57e477(props) {
330
340
  hasDecodedFastPath = true;
331
341
  });
332
342
  });
343
+ $5vyXB$solidjs.createEffect(() => hasDecoded() && requestAnimationFrame($5vyXB$depictaiutilishared.catchify(() => setRAFSinceReturned(prev => !prev))));
333
344
  return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
334
345
  get when() {
335
346
  return hasDecoded();
@@ -522,13 +533,6 @@ function $d212a67662c5cf38$export$140423fa4bfb6d63(props) {
522
533
  customUrls: $d212a67662c5cf38$var$customUrls
523
534
  }));
524
535
  }
525
-
526
- // Value first so shopify merchants can set (extra) display transformers in the shopify app
527
- // Calling these functions normally doesn't do anything, but our shopify app respects them
528
- // Them being here is value first too because this can be easily imported in the product card editor
529
- let $606c221d98ba4d92$var$extraDisplayTransformers;
530
- const $606c221d98ba4d92$export$b2d94be4f02525b2 = () => $606c221d98ba4d92$var$extraDisplayTransformers;
531
- const $606c221d98ba4d92$export$f98b8d5ea7207a1 = displayTransformers => $606c221d98ba4d92$var$extraDisplayTransformers = displayTransformers;
532
536
  function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
533
537
  const signal = $5vyXB$solidjs.createSignal(false);
534
538
  $5vyXB$solidjs.onCleanup($5vyXB$depictaiutilishared.javascript_media_query(media_query, ({
@@ -7801,16 +7805,19 @@ async function $6382a1b83da39674$var$download_categories(merchant, market, local
7801
7805
  function $26a56f6b44703084$export$9862539c89138352({
7802
7806
  get_default_values_: get_default_values_,
7803
7807
  router_: router_,
7804
- prefix_: prefix_
7808
+ prefix_: prefix_,
7809
+ preserveKeys_: preserveKeys_
7805
7810
  }) {
7806
7811
  const get_prefixed_default_values_ = () => {
7807
7812
  const default_values = get_default_values_();
7808
7813
  return Object.fromEntries(Object.entries(default_values).map(([key, value]) => [prefix_ + key, value]));
7809
7814
  };
7810
7815
  const prefixed_state = $6e22b5314fb52f4c$export$e183a13865960371(get_prefixed_default_values_(), router_);
7816
+ const prefixedPreserveKeys = preserveKeys_?.map(key => prefix_ + key);
7811
7817
  const reset_state = () => {
7812
7818
  const new_defaults = get_prefixed_default_values_();
7813
7819
  for (const key in prefixed_state) {
7820
+ if (prefixedPreserveKeys?.includes(key)) continue;
7814
7821
  const new_value = new_defaults[key];
7815
7822
  prefixed_state[key][1](new_value);
7816
7823
  }
@@ -8424,8 +8431,13 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
8424
8431
  local_filter_cache: [],
8425
8432
  expanded_hierarchical_filters: [],
8426
8433
  scroll_restoration_data: [],
8427
- history_content_blocks: []
8434
+ history_content_blocks: {
8435
+ blocks: [],
8436
+ aspectRatios: {}
8437
+ }
8428
8438
  }),
8439
+ // Don't reset content block stuff when leaving category page as we need it for scroll restoration, same with scroll restoration data (actually a bit unsure if this is needed, I think it depends on if someone cleans up our elements before the location changes or after, and maybe some of the test flakyness we have seen is due to this not existing before?)
8440
+ preserveKeys_: ["history_content_blocks", "scroll_restoration_data"],
8429
8441
  router_: this.#router,
8430
8442
  prefix_: "category" + unique_instance_key_for_state + "_"
8431
8443
  });
@@ -12363,73 +12375,117 @@ function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_
12363
12375
  });
12364
12376
  tracking_function_for_plp_results(plp_results_);
12365
12377
  }
12366
- var $32c662f618f5d80d$var$_tmpl$ = ["<a", ' class="d-standard-content-wrapper"', "><video", ' muted="" autoplay="" playsinline="" loop class="d-standard-content"></video></a>'];
12378
+ var $32c662f618f5d80d$var$_tmpl$ = ["<video", ' muted="" autoplay="" playsinline="" loop class="d-standard-content"></video>'];
12367
12379
  function $32c662f618f5d80d$export$780a853d15174484({
12368
- contentBlock_: {
12369
- content: {
12370
- link: link,
12371
- type: type,
12372
- url: mediaUrl
12373
- }
12374
- },
12375
- router_: router_
12380
+ link_: link_,
12381
+ type_: type_,
12382
+ router_: router_,
12383
+ setAspectRatioWas_: setAspectRatioWas_,
12384
+ mediaUrl_: mediaUrl_,
12385
+ aspectRatioWhenAloneInRow_: aspectRatioWhenAloneInRow_
12376
12386
  }) {
12377
- if (type === "image") {
12378
- const [wrapperSize, setWrapperSize] = $5vyXB$solidjs.createSignal();
12379
- return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjsweb.Dynamic), $5vyXB$solidjsweb.mergeProps({
12380
- component: link ? "a" : "div",
12381
- "class": "d-standard-content-wrapper",
12382
- get onClick() {
12383
- return $5vyXB$depictaiutilisharedlatest.catchify(ev => link && router_.navigate_.go_to_({
12384
- new_url_: link,
12385
- is_replace_: false,
12386
- event_: ev
12387
- }));
12388
- }
12389
- }, link && {
12390
- href: link
12391
- }, {
12392
- get children() {
12393
- return $5vyXB$solidjsweb.createComponent((0, $d212a67662c5cf38$export$140423fa4bfb6d63), {
12394
- size: () => wrapperSize()?.[0]?.() || 0,
12395
- sizeHeight: () => wrapperSize()?.[1]?.() || 0,
12396
- src: mediaUrl,
12397
- "class": "d-standard-content"
12398
- });
12399
- }
12400
- }));
12401
- }
12402
- if (type === "video") {
12403
- const pageVisible = $55cbacb79d3e0cea$export$54299a3c81f5425();
12404
- return $5vyXB$solidjsweb.ssr($32c662f618f5d80d$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("href", $5vyXB$solidjsweb.escape(link, true), false), $5vyXB$solidjsweb.ssrAttribute("src", $5vyXB$solidjsweb.escape(mediaUrl, true), false));
12405
- }
12387
+ const [wrapperSize, setWrapperSize] = $5vyXB$solidjs.createSignal();
12388
+ const isImage = type_ === "image";
12389
+ return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjsweb.Dynamic), $5vyXB$solidjsweb.mergeProps({
12390
+ component: link_ ? "a" : "div",
12391
+ "class": "d-standard-content-wrapper",
12392
+ get style() {
12393
+ return aspectRatioWhenAloneInRow_() ? `--media-aspect-ratio: ${aspectRatioWhenAloneInRow_()}` : "";
12394
+ },
12395
+ get onClick() {
12396
+ return $5vyXB$depictaiutilisharedlatest.catchify(ev => link_ && router_.navigate_.go_to_({
12397
+ new_url_: link_,
12398
+ is_replace_: false,
12399
+ event_: ev
12400
+ }));
12401
+ }
12402
+ }, link_ && {
12403
+ href: link_
12404
+ }, {
12405
+ get children() {
12406
+ return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Switch), {
12407
+ get children() {
12408
+ return [$5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Match), {
12409
+ when: isImage,
12410
+ get children() {
12411
+ return $5vyXB$solidjsweb.createComponent((0, $d212a67662c5cf38$export$140423fa4bfb6d63), {
12412
+ size: () => wrapperSize()?.[0]?.() || 0,
12413
+ sizeHeight: () => wrapperSize()?.[1]?.() || 0,
12414
+ src: mediaUrl_,
12415
+ "class": "d-standard-content"
12416
+ });
12417
+ }
12418
+ }), $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Match), {
12419
+ when: type_ === "video",
12420
+ get children() {
12421
+ return $5vyXB$solidjsweb.ssr($32c662f618f5d80d$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey() + $5vyXB$solidjsweb.ssrAttribute("src", $5vyXB$solidjsweb.escape(mediaUrl_, true), false));
12422
+ }
12423
+ })];
12424
+ }
12425
+ });
12426
+ }
12427
+ }));
12406
12428
  }
12407
12429
  function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
12408
12430
  let hasSeenContentBlock = false;
12409
12431
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
12432
+ const contentComponents = new Map();
12410
12433
  $5vyXB$solidjs.createEffect(() => {
12411
12434
  const serverContentBlock = plp_meta()?.content_blocks;
12412
- if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(historyContentBlocks())) setHistoryContentBlocks(serverContentBlock);
12435
+ const currentHistory = $5vyXB$solidjs.untrack(historyContentBlocks);
12436
+ // Only write to the history if the content blocks have changed when a new backend results arrives (we have them in history so scroll restoration works when going back, even when running shopify without single page navigations where our script dies inbetween pages).
12437
+ if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
12438
+ ...currentHistory,
12439
+ blocks: serverContentBlock
12440
+ });
12413
12441
  });
12414
12442
  const contentBlocksByRow = $5vyXB$solidjs.createMemo(() => {
12415
12443
  const developerProvided = content_blocks_by_row_();
12416
- const fromHistory = historyContentBlocks();
12444
+ const {
12445
+ blocks: blocksFromHistory
12446
+ } = historyContentBlocks();
12417
12447
  if (developerProvided) return developerProvided;
12418
12448
  // If we didn't get any content blocks (backend always return empty array) and we haven't seen any content blocks yet, return undefined
12419
12449
  // This is so the result rendering (PLPResults) will still use flexbox provided rendering on existing customers, so adding this isn't a breaking change
12420
12450
  // We don't want to switch rendering method every time one switches between a collection that hasn't vs has content blocks though, so once we've seen one content block we'll switch to css-grid-based rendering
12421
- if (!fromHistory?.length && !hasSeenContentBlock) return undefined;
12451
+ if (!blocksFromHistory?.length && !hasSeenContentBlock) return;
12422
12452
  const content = [];
12423
12453
  hasSeenContentBlock = true;
12424
- fromHistory.forEach(row => {
12454
+ blocksFromHistory.forEach(row => {
12455
+ const {
12456
+ content: {
12457
+ link: link,
12458
+ type: type,
12459
+ url: url
12460
+ }
12461
+ } = row;
12462
+ // Key the "content"-component by the link, type and url, so we can reuse the component (and later downstream the block elements) if it's the same
12463
+ // This makes the block not flicker when going backwards/forwards if the content is the same on both pages
12464
+ // Also it lets us rewrite the blocks state in the history based on the block aspect ratio without infinite looping
12465
+ const componentCacheKey = JSON.stringify([link, type, url]);
12466
+ let component = contentComponents.get(componentCacheKey);
12467
+ if (!component) {
12468
+ component = () => $5vyXB$solidjsweb.createComponent((0, $32c662f618f5d80d$export$780a853d15174484), {
12469
+ link_: link,
12470
+ type_: type,
12471
+ mediaUrl_: url,
12472
+ router_: router_,
12473
+ aspectRatioWhenAloneInRow_: () => historyContentBlocks().aspectRatios[componentCacheKey],
12474
+ setAspectRatioWas_: aspectRatio => setHistoryContentBlocks(prev => ({
12475
+ ...prev,
12476
+ aspectRatios: {
12477
+ ...prev.aspectRatios,
12478
+ [componentCacheKey]: Math.round(aspectRatio * 100) / 100
12479
+ }
12480
+ }))
12481
+ });
12482
+ contentComponents.set(componentCacheKey, component);
12483
+ }
12425
12484
  const contentBlock = {
12426
12485
  span_columns: row.span_columns,
12427
12486
  span_rows: row.span_rows,
12428
12487
  position: row.position,
12429
- content: () => $5vyXB$solidjsweb.createComponent((0, $32c662f618f5d80d$export$780a853d15174484), {
12430
- contentBlock_: row,
12431
- router_: router_
12432
- })
12488
+ content: component
12433
12489
  };
12434
12490
  content[row.row] = contentBlock;
12435
12491
  });