@depict-ai/ui 4.7.30 → 4.7.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ES10/index.cjs CHANGED
@@ -111,7 +111,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
111
111
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
112
112
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
113
113
  /*! Depict.ai search and product listing SDK */
114
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.7.30";
114
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.7.32";
115
115
  function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
116
116
  const signal = $52FdA$solidjs.createSignal(false);
117
117
  $52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
@@ -383,7 +383,7 @@ function $f8f375d6245ffff2$export$791ef57e62e21c3f(_ref) {
383
383
  return $52FdA$solidjs.createMemo(() => $f8f375d6245ffff2$export$92aa5d691d588f3f({
384
384
  wrapped_blocks_: get_wrapped_blocks_(),
385
385
  n_cols_currently_showing_: n_cols_currently_showing_()
386
- }));
386
+ }).content_blocks_by_index_);
387
387
  }
388
388
  function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
389
389
  let {
@@ -391,13 +391,15 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
391
391
  n_cols_currently_showing_: n_cols_currently_showing_
392
392
  } = _ref2;
393
393
  // This computation should be quite cheap since it just moves around things into an array
394
- const content_blocks_by_index = [];
394
+ const content_blocks_by_index_ = [];
395
395
  const constructed_block_arrays = new WeakSet();
396
396
  // Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
397
- const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
397
+ const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
398
398
  if (!n_cols_currently_showing_)
399
399
  // Nope out of here if we don't know how many columns are showing
400
- return content_blocks_by_index;
400
+ return {
401
+ content_blocks_by_index_: content_blocks_by_index_
402
+ };
401
403
  for (let i = 0; i < wrapped_blocks_.length; i++) {
402
404
  // i = row to show at
403
405
  const block = wrapped_blocks_[i];
@@ -414,25 +416,25 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
414
416
  // Calculate displacement of us by content blocks above us
415
417
  let displacement_by_added_blocks = 0;
416
418
  for (let j = 0; j < i; j++) {
417
- const row = displaced_products[j];
419
+ const row = displaced_products_[j];
418
420
  if (row === undefined) continue; // there were no blocks in this row
419
421
  let displaced_items_in_row;
420
422
  if (typeof row === "number") displaced_items_in_row = row;else {
421
423
  displaced_items_in_row = row.filter(item => item).length;
422
- displaced_products[j] = displaced_items_in_row;
424
+ displaced_products_[j] = displaced_items_in_row;
423
425
  }
424
426
  displacement_by_added_blocks += displaced_items_in_row;
425
427
  }
426
428
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
427
429
  for (let j = 0; j < index_of_us_in_row; j++) {
428
- var _displaced_products$i;
429
- if ((_displaced_products$i = displaced_products[i]) !== null && _displaced_products$i !== void 0 && _displaced_products$i[j])
430
+ var _displaced_products_$;
431
+ if ((_displaced_products_$ = displaced_products_[i]) !== null && _displaced_products_$ !== void 0 && _displaced_products_$[j])
430
432
  // Add blocks in our *current* row to the displacement, but only the ones to our left
431
433
  displacement_by_added_blocks++;
432
434
  }
433
435
  // Add block to output array at the correct index
434
436
  const final_target_index = target_index - displacement_by_added_blocks;
435
- const existing_block = content_blocks_by_index[final_target_index];
437
+ const existing_block = content_blocks_by_index_[final_target_index];
436
438
  const block_content = block.content;
437
439
  // If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
438
440
  if (existing_block) {
@@ -441,17 +443,20 @@ function $f8f375d6245ffff2$export$92aa5d691d588f3f(_ref2) {
441
443
  existing_block.push(block_content);else {
442
444
  const array = [existing_block, block_content];
443
445
  constructed_block_arrays.add(array);
444
- content_blocks_by_index[final_target_index] = array;
446
+ content_blocks_by_index_[final_target_index] = array;
445
447
  }
446
- } else content_blocks_by_index[final_target_index] = block_content;
448
+ } else content_blocks_by_index_[final_target_index] = block_content;
447
449
  // Update displacement
448
450
  for (let j = 0; j < span_rows; j++) {
449
451
  var _ref3;
450
- const row = displaced_products[_ref3 = i + j] || (displaced_products[_ref3] = []);
452
+ const row = displaced_products_[_ref3 = i + j] || (displaced_products_[_ref3] = []);
451
453
  for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
452
454
  }
453
455
  }
454
- return content_blocks_by_index;
456
+ return {
457
+ content_blocks_by_index_: content_blocks_by_index_,
458
+ displaced_products_: displaced_products_
459
+ };
455
460
  }
456
461
  /**
457
462
  * Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
@@ -480,19 +485,22 @@ function $f8f375d6245ffff2$var$wrap_blocks_in_div(rendered_content_blocks, max_s
480
485
  }
481
486
  }));
482
487
  $52FdA$solidjsweb.effect(_p$ => {
483
- var _v$ = {
488
+ var _v$ = !!(final_span_columns() === max_span_columns()),
489
+ _v$2 = {
484
490
  [(0, $830518481649feb1$export$c500183c31c2b22e)]: final_span_columns()
485
491
  },
486
- _v$2 = "span ".concat(final_span_columns()),
487
- _v$3 = "span ".concat(final_span_rows());
488
- _p$.e = $52FdA$solidjsweb.style(_el$, _v$, _p$.e);
489
- _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
490
- _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
492
+ _v$3 = "span ".concat(final_span_columns()),
493
+ _v$4 = "span ".concat(final_span_rows());
494
+ _v$ !== _p$.e && _el$.classList.toggle("spans-whole-row", _p$.e = _v$);
495
+ _p$.t = $52FdA$solidjsweb.style(_el$, _v$2, _p$.t);
496
+ _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-column", _v$3) : _el$.style.removeProperty("grid-column"));
497
+ _v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$.style.setProperty("grid-row", _v$4) : _el$.style.removeProperty("grid-row"));
491
498
  return _p$;
492
499
  }, {
493
500
  e: undefined,
494
501
  t: undefined,
495
- a: undefined
502
+ a: undefined,
503
+ o: undefined
496
504
  });
497
505
  return _el$;
498
506
  }
@@ -10645,7 +10653,8 @@ class $e270e9f953fcbc58$export$e015ed2f2950f2e3 {
10645
10653
  breadcrumbs: [],
10646
10654
  quick_links: [],
10647
10655
  image_urls: [],
10648
- failed: true
10656
+ failed: true,
10657
+ content_blocks: []
10649
10658
  }),
10650
10659
  method_: "GET"
10651
10660
  });
@@ -11131,7 +11140,8 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
11131
11140
  // Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
11132
11141
  local_filter_cache: [],
11133
11142
  expanded_hierarchical_filters: [],
11134
- scroll_restoration_data: []
11143
+ scroll_restoration_data: [],
11144
+ history_content_blocks: []
11135
11145
  }),
11136
11146
  router_: $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $9cbefc32b9dab36d$var$_router),
11137
11147
  prefix_: "category" + unique_instance_key_for_state + "_"
@@ -15919,6 +15929,99 @@ function $c3a7faae6f2b93c9$export$7af06a63c5a976c9(el, listing_id, i18n_) {
15919
15929
  $52FdA$solidjs.onCleanup(disconnect);
15920
15930
  }
15921
15931
  $52FdA$solidjsweb.delegateEvents(["click"]);
15932
+ var $c19709057a32b2e7$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<a class=d-standard-content-wrapper><video loop class=d-standard-content>`);
15933
+ function $c19709057a32b2e7$export$780a853d15174484(_ref) {
15934
+ let {
15935
+ contentBlock_: {
15936
+ content: {
15937
+ link: link,
15938
+ type: type,
15939
+ url: mediaUrl
15940
+ }
15941
+ },
15942
+ router_: router_
15943
+ } = _ref;
15944
+ if (type === "image") {
15945
+ const [wrapperSize, setWrapperSize] = $52FdA$solidjs.createSignal();
15946
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjsweb.Dynamic), $52FdA$solidjsweb.mergeProps({
15947
+ component: link ? "a" : "div",
15948
+ "class": "d-standard-content-wrapper",
15949
+ ref: el => setWrapperSize(() => $858fdcf73148519f$export$e6fffe67d4cdd848(el)),
15950
+ get onClick() {
15951
+ return $52FdA$depictaiutilisharedlatest.catchify(ev => link && router_.navigate_.go_to_({
15952
+ new_url_: link,
15953
+ is_replace_: false,
15954
+ event_: ev
15955
+ }));
15956
+ }
15957
+ }, link && {
15958
+ href: link
15959
+ }, {
15960
+ get children() {
15961
+ return $52FdA$solidjsweb.createComponent((0, $858fdcf73148519f$export$6e5611bc7e57e477), {
15962
+ get size() {
15963
+ return $52FdA$solidjs.createMemo(() => {
15964
+ var _wrapperSize;
15965
+ return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : _wrapperSize()) || 0;
15966
+ });
15967
+ },
15968
+ src: mediaUrl,
15969
+ "class": "d-standard-content"
15970
+ });
15971
+ }
15972
+ }));
15973
+ }
15974
+ if (type === "video") {
15975
+ const pageVisible = $e7a7d2fe8a8217d8$export$54299a3c81f5425();
15976
+ return (() => {
15977
+ var _el$ = $52FdA$solidjsweb.getNextElement($c19709057a32b2e7$var$_tmpl$),
15978
+ _el$2 = _el$.firstChild;
15979
+ $52FdA$solidjsweb.addEventListener(_el$, "click", $52FdA$depictaiutilisharedlatest.catchify(ev => router_.navigate_.go_to_({
15980
+ new_url_: link,
15981
+ is_replace_: false,
15982
+ event_: ev
15983
+ })), true);
15984
+ $52FdA$solidjsweb.setAttribute(_el$, "href", link);
15985
+ $52FdA$solidjsweb.use(element => $52FdA$solidjs.createEffect(() => {
15986
+ if (pageVisible()) element.play().catch(e => $52FdA$depictaiutilishared.dlog("Failed to play", e));else element.pause();
15987
+ }), _el$2);
15988
+ $52FdA$solidjsweb.setAttribute(_el$2, "src", mediaUrl);
15989
+ $52FdA$solidjsweb.setProperty(_el$2, "controls", false);
15990
+ $52FdA$solidjsweb.setProperty(_el$2, "muted", true);
15991
+ $52FdA$solidjsweb.setProperty(_el$2, "autoplay", true);
15992
+ $52FdA$solidjsweb.setProperty(_el$2, "playsinline", true);
15993
+ $52FdA$solidjsweb.runHydrationEvents();
15994
+ return _el$;
15995
+ })();
15996
+ }
15997
+ }
15998
+ $52FdA$solidjsweb.delegateEvents(["click"]);
15999
+ function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
16000
+ const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
16001
+ $52FdA$solidjs.createEffect(() => {
16002
+ var _plp_meta;
16003
+ const serverContentBlock = (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
16004
+ if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(historyContentBlocks())) setHistoryContentBlocks(serverContentBlock);
16005
+ });
16006
+ const contentBlocksByRow = $52FdA$solidjs.createMemo(() => {
16007
+ if (content_blocks_by_row_()) return content_blocks_by_row_();
16008
+ const content = [];
16009
+ historyContentBlocks().forEach(row => {
16010
+ const contentBlock = {
16011
+ span_columns: row.span_columns,
16012
+ span_rows: row.span_rows,
16013
+ position: row.position,
16014
+ content: () => $52FdA$solidjsweb.createComponent((0, $c19709057a32b2e7$export$780a853d15174484), {
16015
+ contentBlock_: row,
16016
+ router_: router_
16017
+ })
16018
+ };
16019
+ content[row.row] = contentBlock;
16020
+ });
16021
+ return content;
16022
+ });
16023
+ return contentBlocksByRow;
16024
+ }
15922
16025
  var $ede6c70ecdca46fe$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=product-count><!$><!/> <!$><!/>`),
15923
16026
  $ede6c70ecdca46fe$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
15924
16027
  $ede6c70ecdca46fe$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
@@ -15947,6 +16050,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
15947
16050
  show_breadcrumbs_: show_breadcrumbs_,
15948
16051
  layout_options_: layout_options_,
15949
16052
  scroll_restoration_data_: scroll_restoration_data_,
16053
+ history_content_blocks_: history_content_blocks_,
15950
16054
  product_card_template_: product_card_template_,
15951
16055
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
15952
16056
  sorting_query_param_: sorting_query_param_,
@@ -16015,6 +16119,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16015
16119
  }));
16016
16120
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
16017
16121
  const [plp_meta] = $52FdA$solidjs.createResource(meta_query_base, $52FdA$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
16122
+ const contentBlocksByRow = $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
16018
16123
  const available_sortings_ = $52FdA$solidjs.createMemo(() => {
16019
16124
  var _plp_products_, _plp_products_$sorts;
16020
16125
  return (_plp_products_ = plp_products_()) === null || _plp_products_ === void 0 ? void 0 : (_plp_products_$sorts = _plp_products_.sorts) === null || _plp_products_$sorts === void 0 ? void 0 : _plp_products_$sorts.map(sort => {
@@ -16303,7 +16408,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
16303
16408
  product_card_template_: product_card_template_,
16304
16409
  sort_or_filter_open_: sort_or_filter_open_,
16305
16410
  desktop_filter_elements_: desktop_filter_elements_,
16306
- content_blocks_by_row_: content_blocks_by_row_,
16411
+ content_blocks_by_row_: contentBlocksByRow,
16307
16412
  ConfiguredScrollStatus_: ConfiguredScrollStatus_,
16308
16413
  id_currently_querying_for_: id_to_query_for_,
16309
16414
  no_results_options_: {
@@ -16399,7 +16504,8 @@ function $c10e33c4681f8c9b$export$e2bf8ce7779e827e(props) {
16399
16504
  sorting_open: category_sorting_open_,
16400
16505
  expanded_filters: expanded_filters_,
16401
16506
  expanded_hierarchical_filters: expanded_hierarchical_filters_,
16402
- scroll_restoration_data: scroll_restoration_data_
16507
+ scroll_restoration_data: scroll_restoration_data_,
16508
+ history_content_blocks: history_content_blocks_
16403
16509
  } = depict_category.historyStateSignals_;
16404
16510
  const {
16405
16511
  current_sorting_: current_sorting_,
@@ -16451,6 +16557,7 @@ function $c10e33c4681f8c9b$export$e2bf8ce7779e827e(props) {
16451
16557
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
16452
16558
  content_blocks_by_row_: () => props.content_blocks_by_row,
16453
16559
  scroll_restoration_data_: scroll_restoration_data_,
16560
+ history_content_blocks_: history_content_blocks_,
16454
16561
  layout_options_: $52FdA$solidjs.createMemo(() => ({
16455
16562
  cols_at_size: $5401a6698b0c0658$export$6daf8749b65a1b77(props.cols_at_size),
16456
16563
  ...grid_spacing_override(),
package/ES10/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { report, Amazing_Slider, Display, useExpandingContainer, ColsAtSize, Ele
3
3
  import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
4
4
  import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
5
5
  import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
6
- import { ProductListing, GetListingResponse } from "@depict-ai/types/api/GetListingResponse";
6
+ import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
7
7
  import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
8
8
  import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
9
9
  import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequestV3";
@@ -11,7 +11,7 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
13
13
  import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
14
- export const version = "4.7.30";
14
+ export const version = "4.7.32";
15
15
  /**
16
16
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
17
  */
@@ -93,7 +93,8 @@ export type ContentBlocksByRow = (undefined | ContentBlock)[];
93
93
  /**
94
94
  * Does pure calculations where to put each of the finished wrapped content blocks in the elements in the grid (input is by row). You need to cap span_columns of the blocks to the columns available before passing them to this function.
95
95
  * Also used in the portal in react.
96
- * @returns an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index
96
+ * @returns content_blocks_by_index_: an array where index is index of the blocks in the "displays array" and value is the content block (elements) to show at that index.
97
+ * displaced_products_: internal state that can be used to figure out if there's parts of a content block on a row, see the comment inside this function
97
98
  */
98
99
  export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Element>>({
99
100
  wrapped_blocks_,
@@ -106,7 +107,13 @@ export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Elemen
106
107
  content: T;
107
108
  })[];
108
109
  n_cols_currently_showing_: number | null;
109
- }): JSX.Element[];
110
+ }): {
111
+ content_blocks_by_index_: (Awaited<T> | T[])[];
112
+ readonly displaced_products_?: undefined;
113
+ } | {
114
+ readonly content_blocks_by_index_: (Awaited<T> | T[])[];
115
+ readonly displaced_products_: (number | (true | undefined)[])[];
116
+ };
110
117
  /**
111
118
  * Returns a set containing the element where every element currently touching the screen started touching it.
112
119
  */
@@ -1327,6 +1334,7 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
1327
1334
  expanded_: boolean;
1328
1335
  }[]>;
1329
1336
  scroll_restoration_data: Signal<ScrollRestorationData>;
1337
+ history_content_blocks: Signal<_ContentBlock1[]>;
1330
1338
  };
1331
1339
  /**
1332
1340
  * Signal representing the currently selected filters. Will update to always reflect the state of the current URL. Calling the setter triggers a navigation (replaceState) to an updated URL.
package/ES10/index.js CHANGED
@@ -10,7 +10,7 @@ import $8tj43$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.7.30";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.7.32";
14
14
  function $00a5b94f0c11efbb$export$d9f36cf74e24d595(media_query) {
15
15
  const signal = $8tj43$createSignal(false);
16
16
  $8tj43$onCleanup($8tj43$javascript_media_query(media_query, _ref => {
@@ -282,7 +282,7 @@ function $ff7feae4dddd6073$export$791ef57e62e21c3f(_ref) {
282
282
  return $8tj43$createMemo(() => $ff7feae4dddd6073$export$92aa5d691d588f3f({
283
283
  wrapped_blocks_: get_wrapped_blocks_(),
284
284
  n_cols_currently_showing_: n_cols_currently_showing_()
285
- }));
285
+ }).content_blocks_by_index_);
286
286
  }
287
287
  function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
288
288
  let {
@@ -290,13 +290,15 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
290
290
  n_cols_currently_showing_: n_cols_currently_showing_
291
291
  } = _ref2;
292
292
  // This computation should be quite cheap since it just moves around things into an array
293
- const content_blocks_by_index = [];
293
+ const content_blocks_by_index_ = [];
294
294
  const constructed_block_arrays = new WeakSet();
295
295
  // Need to keep track of products displaced by blocks above when mapping rows to indexes in the actual grid
296
- const displaced_products = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
296
+ const displaced_products_ = []; // undefined = is product, true = is content block if number instead of tuple number indicates content blocks in that row. Index in first array is row, index in second array is column
297
297
  if (!n_cols_currently_showing_)
298
298
  // Nope out of here if we don't know how many columns are showing
299
- return content_blocks_by_index;
299
+ return {
300
+ content_blocks_by_index_: content_blocks_by_index_
301
+ };
300
302
  for (let i = 0; i < wrapped_blocks_.length; i++) {
301
303
  // i = row to show at
302
304
  const block = wrapped_blocks_[i];
@@ -313,25 +315,25 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
313
315
  // Calculate displacement of us by content blocks above us
314
316
  let displacement_by_added_blocks = 0;
315
317
  for (let j = 0; j < i; j++) {
316
- const row = displaced_products[j];
318
+ const row = displaced_products_[j];
317
319
  if (row === undefined) continue; // there were no blocks in this row
318
320
  let displaced_items_in_row;
319
321
  if (typeof row === "number") displaced_items_in_row = row;else {
320
322
  displaced_items_in_row = row.filter(item => item).length;
321
- displaced_products[j] = displaced_items_in_row;
323
+ displaced_products_[j] = displaced_items_in_row;
322
324
  }
323
325
  displacement_by_added_blocks += displaced_items_in_row;
324
326
  }
325
327
  const index_of_us_in_row = target_index - index_of_first_item_in_row;
326
328
  for (let j = 0; j < index_of_us_in_row; j++) {
327
- var _displaced_products$i;
328
- if ((_displaced_products$i = displaced_products[i]) !== null && _displaced_products$i !== void 0 && _displaced_products$i[j])
329
+ var _displaced_products_$;
330
+ if ((_displaced_products_$ = displaced_products_[i]) !== null && _displaced_products_$ !== void 0 && _displaced_products_$[j])
329
331
  // Add blocks in our *current* row to the displacement, but only the ones to our left
330
332
  displacement_by_added_blocks++;
331
333
  }
332
334
  // Add block to output array at the correct index
333
335
  const final_target_index = target_index - displacement_by_added_blocks;
334
- const existing_block = content_blocks_by_index[final_target_index];
336
+ const existing_block = content_blocks_by_index_[final_target_index];
335
337
  const block_content = block.content;
336
338
  // If two blocks want to exist at the same location (can happen, for example if one block wants to be at the end of a row and the other one at the start of the next row) add an array with both
337
339
  if (existing_block) {
@@ -340,17 +342,20 @@ function $ff7feae4dddd6073$export$92aa5d691d588f3f(_ref2) {
340
342
  existing_block.push(block_content);else {
341
343
  const array = [existing_block, block_content];
342
344
  constructed_block_arrays.add(array);
343
- content_blocks_by_index[final_target_index] = array;
345
+ content_blocks_by_index_[final_target_index] = array;
344
346
  }
345
- } else content_blocks_by_index[final_target_index] = block_content;
347
+ } else content_blocks_by_index_[final_target_index] = block_content;
346
348
  // Update displacement
347
349
  for (let j = 0; j < span_rows; j++) {
348
350
  var _ref3;
349
- const row = displaced_products[_ref3 = i + j] || (displaced_products[_ref3] = []);
351
+ const row = displaced_products_[_ref3 = i + j] || (displaced_products_[_ref3] = []);
350
352
  for (let k = index_of_us_in_row; k < index_of_us_in_row + span_columns; k++) row[k] = true;
351
353
  }
352
354
  }
353
- return content_blocks_by_index;
355
+ return {
356
+ content_blocks_by_index_: content_blocks_by_index_,
357
+ displaced_products_: displaced_products_
358
+ };
354
359
  }
355
360
  /**
356
361
  * Takes a store that contains an array from where index is number of row and value is the result of executing the content block rendering function.
@@ -379,19 +384,22 @@ function $ff7feae4dddd6073$var$wrap_blocks_in_div(rendered_content_blocks, max_s
379
384
  }
380
385
  }));
381
386
  $8tj43$effect(_p$ => {
382
- var _v$ = {
387
+ var _v$ = !!(final_span_columns() === max_span_columns()),
388
+ _v$2 = {
383
389
  [(0, $64d94dcaa058dc7b$export$c500183c31c2b22e)]: final_span_columns()
384
390
  },
385
- _v$2 = "span ".concat(final_span_columns()),
386
- _v$3 = "span ".concat(final_span_rows());
387
- _p$.e = $8tj43$style(_el$, _v$, _p$.e);
388
- _v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$.style.setProperty("grid-column", _v$2) : _el$.style.removeProperty("grid-column"));
389
- _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-row", _v$3) : _el$.style.removeProperty("grid-row"));
391
+ _v$3 = "span ".concat(final_span_columns()),
392
+ _v$4 = "span ".concat(final_span_rows());
393
+ _v$ !== _p$.e && _el$.classList.toggle("spans-whole-row", _p$.e = _v$);
394
+ _p$.t = $8tj43$style(_el$, _v$2, _p$.t);
395
+ _v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$.style.setProperty("grid-column", _v$3) : _el$.style.removeProperty("grid-column"));
396
+ _v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$.style.setProperty("grid-row", _v$4) : _el$.style.removeProperty("grid-row"));
390
397
  return _p$;
391
398
  }, {
392
399
  e: undefined,
393
400
  t: undefined,
394
- a: undefined
401
+ a: undefined,
402
+ o: undefined
395
403
  });
396
404
  return _el$;
397
405
  }
@@ -10544,7 +10552,8 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
10544
10552
  breadcrumbs: [],
10545
10553
  quick_links: [],
10546
10554
  image_urls: [],
10547
- failed: true
10555
+ failed: true,
10556
+ content_blocks: []
10548
10557
  }),
10549
10558
  method_: "GET"
10550
10559
  });
@@ -11030,7 +11039,8 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
11030
11039
  // Please make sure that the signal created by below line always updates AFTER selected_filters_ updates on a "popstate" event. If the filter cache is popped before the selected filters are the code in create_modified_filters() is going to re-calculate search_local_filter_cache without knowing the real value of search_selected_filters, and we'll end up with too few filters in search_local_filter_cache in some cases
11031
11040
  local_filter_cache: [],
11032
11041
  expanded_hierarchical_filters: [],
11033
- scroll_restoration_data: []
11042
+ scroll_restoration_data: [],
11043
+ history_content_blocks: []
11034
11044
  }),
11035
11045
  router_: $8tj43$babelruntimehelpersclassPrivateFieldGet(this, $f5f54892fd0c7d9f$var$_router),
11036
11046
  prefix_: "category" + unique_instance_key_for_state + "_"
@@ -15818,6 +15828,99 @@ function $1145661fd3ca5519$export$7af06a63c5a976c9(el, listing_id, i18n_) {
15818
15828
  $8tj43$onCleanup(disconnect);
15819
15829
  }
15820
15830
  $8tj43$delegateEvents(["click"]);
15831
+ var $3b772ef9a35560fe$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<a class=d-standard-content-wrapper><video loop class=d-standard-content>`);
15832
+ function $3b772ef9a35560fe$export$780a853d15174484(_ref) {
15833
+ let {
15834
+ contentBlock_: {
15835
+ content: {
15836
+ link: link,
15837
+ type: type,
15838
+ url: mediaUrl
15839
+ }
15840
+ },
15841
+ router_: router_
15842
+ } = _ref;
15843
+ if (type === "image") {
15844
+ const [wrapperSize, setWrapperSize] = $8tj43$createSignal();
15845
+ return $8tj43$createComponent((0, $8tj43$Dynamic), $8tj43$mergeProps1({
15846
+ component: link ? "a" : "div",
15847
+ "class": "d-standard-content-wrapper",
15848
+ ref: el => setWrapperSize(() => $56047603f9d212b6$export$e6fffe67d4cdd848(el)),
15849
+ get onClick() {
15850
+ return $8tj43$catchify(ev => link && router_.navigate_.go_to_({
15851
+ new_url_: link,
15852
+ is_replace_: false,
15853
+ event_: ev
15854
+ }));
15855
+ }
15856
+ }, link && {
15857
+ href: link
15858
+ }, {
15859
+ get children() {
15860
+ return $8tj43$createComponent((0, $56047603f9d212b6$export$6e5611bc7e57e477), {
15861
+ get size() {
15862
+ return $8tj43$createMemo(() => {
15863
+ var _wrapperSize;
15864
+ return ((_wrapperSize = wrapperSize()) === null || _wrapperSize === void 0 ? void 0 : _wrapperSize()) || 0;
15865
+ });
15866
+ },
15867
+ src: mediaUrl,
15868
+ "class": "d-standard-content"
15869
+ });
15870
+ }
15871
+ }));
15872
+ }
15873
+ if (type === "video") {
15874
+ const pageVisible = $a35e6f680c5bbc60$export$54299a3c81f5425();
15875
+ return (() => {
15876
+ var _el$ = $8tj43$getNextElement($3b772ef9a35560fe$var$_tmpl$),
15877
+ _el$2 = _el$.firstChild;
15878
+ $8tj43$addEventListener(_el$, "click", $8tj43$catchify(ev => router_.navigate_.go_to_({
15879
+ new_url_: link,
15880
+ is_replace_: false,
15881
+ event_: ev
15882
+ })), true);
15883
+ $8tj43$setAttribute(_el$, "href", link);
15884
+ $8tj43$use(element => $8tj43$createEffect(() => {
15885
+ if (pageVisible()) element.play().catch(e => $8tj43$dlog1("Failed to play", e));else element.pause();
15886
+ }), _el$2);
15887
+ $8tj43$setAttribute(_el$2, "src", mediaUrl);
15888
+ $8tj43$setProperty(_el$2, "controls", false);
15889
+ $8tj43$setProperty(_el$2, "muted", true);
15890
+ $8tj43$setProperty(_el$2, "autoplay", true);
15891
+ $8tj43$setProperty(_el$2, "playsinline", true);
15892
+ $8tj43$runHydrationEvents();
15893
+ return _el$;
15894
+ })();
15895
+ }
15896
+ }
15897
+ $8tj43$delegateEvents(["click"]);
15898
+ function $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
15899
+ const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
15900
+ $8tj43$createEffect(() => {
15901
+ var _plp_meta;
15902
+ const serverContentBlock = (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
15903
+ if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(historyContentBlocks())) setHistoryContentBlocks(serverContentBlock);
15904
+ });
15905
+ const contentBlocksByRow = $8tj43$createMemo(() => {
15906
+ if (content_blocks_by_row_()) return content_blocks_by_row_();
15907
+ const content = [];
15908
+ historyContentBlocks().forEach(row => {
15909
+ const contentBlock = {
15910
+ span_columns: row.span_columns,
15911
+ span_rows: row.span_rows,
15912
+ position: row.position,
15913
+ content: () => $8tj43$createComponent((0, $3b772ef9a35560fe$export$780a853d15174484), {
15914
+ contentBlock_: row,
15915
+ router_: router_
15916
+ })
15917
+ };
15918
+ content[row.row] = contentBlock;
15919
+ });
15920
+ return content;
15921
+ });
15922
+ return contentBlocksByRow;
15923
+ }
15821
15924
  var $4b4b262708b516ee$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=product-count><!$><!/> <!$><!/>`),
15822
15925
  $4b4b262708b516ee$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div>`),
15823
15926
  $4b4b262708b516ee$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=filter-results-for-one-row><!$><!/><!$><!/>`),
@@ -15846,6 +15949,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
15846
15949
  show_breadcrumbs_: show_breadcrumbs_,
15847
15950
  layout_options_: layout_options_,
15848
15951
  scroll_restoration_data_: scroll_restoration_data_,
15952
+ history_content_blocks_: history_content_blocks_,
15849
15953
  product_card_template_: product_card_template_,
15850
15954
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
15851
15955
  sorting_query_param_: sorting_query_param_,
@@ -15914,6 +16018,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
15914
16018
  }));
15915
16019
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
15916
16020
  const [plp_meta] = $8tj43$createResource(meta_query_base, $8tj43$catchify(query => depict_api_.get_listing(query)));
16021
+ const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
15917
16022
  const available_sortings_ = $8tj43$createMemo(() => {
15918
16023
  var _plp_products_, _plp_products_$sorts;
15919
16024
  return (_plp_products_ = plp_products_()) === null || _plp_products_ === void 0 ? void 0 : (_plp_products_$sorts = _plp_products_.sorts) === null || _plp_products_$sorts === void 0 ? void 0 : _plp_products_$sorts.map(sort => {
@@ -16202,7 +16307,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
16202
16307
  product_card_template_: product_card_template_,
16203
16308
  sort_or_filter_open_: sort_or_filter_open_,
16204
16309
  desktop_filter_elements_: desktop_filter_elements_,
16205
- content_blocks_by_row_: content_blocks_by_row_,
16310
+ content_blocks_by_row_: contentBlocksByRow,
16206
16311
  ConfiguredScrollStatus_: ConfiguredScrollStatus_,
16207
16312
  id_currently_querying_for_: id_to_query_for_,
16208
16313
  no_results_options_: {
@@ -16298,7 +16403,8 @@ function $8821a19349c36651$export$e2bf8ce7779e827e(props) {
16298
16403
  sorting_open: category_sorting_open_,
16299
16404
  expanded_filters: expanded_filters_,
16300
16405
  expanded_hierarchical_filters: expanded_hierarchical_filters_,
16301
- scroll_restoration_data: scroll_restoration_data_
16406
+ scroll_restoration_data: scroll_restoration_data_,
16407
+ history_content_blocks: history_content_blocks_
16302
16408
  } = depict_category.historyStateSignals_;
16303
16409
  const {
16304
16410
  current_sorting_: current_sorting_,
@@ -16350,6 +16456,7 @@ function $8821a19349c36651$export$e2bf8ce7779e827e(props) {
16350
16456
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
16351
16457
  content_blocks_by_row_: () => props.content_blocks_by_row,
16352
16458
  scroll_restoration_data_: scroll_restoration_data_,
16459
+ history_content_blocks_: history_content_blocks_,
16353
16460
  layout_options_: $8tj43$createMemo(() => ({
16354
16461
  cols_at_size: $a9c7ba6087881ac2$export$6daf8749b65a1b77(props.cols_at_size),
16355
16462
  ...grid_spacing_override(),