@depict-ai/ui 4.10.4 → 4.10.6

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
@@ -115,7 +115,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $335c02c1241a9ca8$export$5b7
115
115
  $parcel$export(module.exports, "QuickLinks", () => $335c02c1241a9ca8$export$de035477d6fef996);
116
116
  $parcel$export(module.exports, "CategoryPage", () => $c10e33c4681f8c9b$export$e2bf8ce7779e827e);
117
117
  /*! Depict.ai search and product listing SDK */
118
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.4";
118
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "4.10.6";
119
119
  function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
120
120
  const signal = $52FdA$solidjs.createSignal(false);
121
121
  $52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
@@ -6292,7 +6292,8 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6292
6292
  get_extra_filters_button_: get_extra_filters_button_,
6293
6293
  get_extra_sorting_button_: get_extra_sorting_button_,
6294
6294
  filterModalParent_: filterModalParent_,
6295
- hideCount0FilterOptions_: hideCount0FilterOptions_
6295
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
6296
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
6296
6297
  } = _ref;
6297
6298
  const Self = () => {
6298
6299
  // This could technically be in SearchPage and CategoryPage and would be better suited there since it writes into local_filter_cache_ which i.e. SelectedFilters uses, but it's better suited here IMO due to DRY and being inside the correct error boundary here
@@ -6301,11 +6302,13 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6301
6302
  selected_filters_: selected_filters_,
6302
6303
  local_filter_cache_: local_filter_cache_
6303
6304
  });
6304
- const cleanup_promise = new Promise(r => $52FdA$solidjs.onCleanup(r));
6305
6305
  const [filters_open, set_filters_open] = search_filters_open_;
6306
6306
  const [sorting_open, set_sorting_open] = search_sorting_open_;
6307
6307
  const [get_current_sorting_] = current_sorting_;
6308
- const [is_small, set_is_small] = $52FdA$solidjs.createSignal(false);
6308
+ const isSmall = $52FdA$solidjs.createMemo(() => {
6309
+ var _switchToFiltersDrawe;
6310
+ return $3e17e871e9d0911d$export$d9f36cf74e24d595("(max-width:".concat((_switchToFiltersDrawe = switchToFiltersDrawerBreakpoint_()) !== null && _switchToFiltersDrawe !== void 0 ? _switchToFiltersDrawe : 651, "px)"));
6311
+ });
6309
6312
  const dismiss_modal_ = $52FdA$depictaiutilishared.catchify(() => {
6310
6313
  set_filters_open(false);
6311
6314
  set_sorting_open(false);
@@ -6369,7 +6372,7 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6369
6372
  $52FdA$solidjs.createComputed(() => {
6370
6373
  const fi_o = filters_open();
6371
6374
  const so_o = sorting_open();
6372
- const i_s = is_small();
6375
+ const i_s = isSmall()();
6373
6376
  // we need to always read all the signal if we have them in the if-statement the value of it changes when the computation runs
6374
6377
  if ((fi_o || so_o) && !i_s) {
6375
6378
  if (!grid_is_in_original_state) return;
@@ -6385,7 +6388,7 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6385
6388
  var _close_modal_;
6386
6389
  (_close_modal_ = close_modal_) === null || _close_modal_ === void 0 || _close_modal_();
6387
6390
  set_extra_els_in_results_container_("");
6388
- } else if (is_small()) {
6391
+ } else if (isSmall()()) {
6389
6392
  var _open_modal_;
6390
6393
  if ($52FdA$solidjs.untrack(() => input_modal_open_ === null || input_modal_open_ === void 0 ? void 0 : input_modal_open_())) {
6391
6394
  // we don't want to shove another modal into the users face, silently close the filters for them
@@ -6429,15 +6432,6 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6429
6432
  dismiss_modal_: dismiss_modal_,
6430
6433
  i18n_: i18n_
6431
6434
  }, filterModalParent_));
6432
- const {
6433
- remove: remove
6434
- } = $52FdA$depictaiutilishared.javascript_media_query("(max-width:651px)", _ref3 => {
6435
- let {
6436
- matches: matches
6437
- } = _ref3;
6438
- return set_is_small(matches);
6439
- });
6440
- cleanup_promise.then(remove);
6441
6435
  })();
6442
6436
  get_extra_filters_button_ === null || get_extra_filters_button_ === void 0 || get_extra_filters_button_(make_open_filters_button());
6443
6437
  get_extra_sorting_button_ === null || get_extra_sorting_button_ === void 0 || get_extra_sorting_button_(make_open_sorting_button());
@@ -6479,7 +6473,7 @@ function $f70cc6dfcadf0fd5$export$d7841e452f2e59a8(_ref) {
6479
6473
  }
6480
6474
  });
6481
6475
  }
6482
- function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref4) {
6476
+ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref3) {
6483
6477
  let {
6484
6478
  i18n_: i18n_,
6485
6479
  search_filters_open_: search_filters_open_,
@@ -6488,7 +6482,7 @@ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref4) {
6488
6482
  tabindex_: tabindex_,
6489
6483
  number_of_rendered_selected_filters_items_: [num_selected_filters],
6490
6484
  hide_button_: hide_button_
6491
- } = _ref4;
6485
+ } = _ref3;
6492
6486
  const filters_closed = $52FdA$solidjs.createMemo(() => !search_filters_open_[0]());
6493
6487
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
6494
6488
  return (() => {
@@ -6559,7 +6553,7 @@ function $f70cc6dfcadf0fd5$var$OpenFiltersButton(_ref4) {
6559
6553
  return _el$14;
6560
6554
  })();
6561
6555
  }
6562
- function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref5) {
6556
+ function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref4) {
6563
6557
  let {
6564
6558
  i18n_: i18n_,
6565
6559
  get_current_sorting_: get_current_sorting_,
@@ -6569,7 +6563,7 @@ function $f70cc6dfcadf0fd5$var$OpenSortingButton(_ref5) {
6569
6563
  sort_button_width_: sort_button_width_,
6570
6564
  tabindex_: tabindex_,
6571
6565
  meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6572
- } = _ref5;
6566
+ } = _ref4;
6573
6567
  const sorting_closed = $52FdA$solidjs.createMemo(() => !search_sorting_open_[0]());
6574
6568
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
6575
6569
  return (() => {
@@ -8167,13 +8161,18 @@ function $c19709057a32b2e7$export$780a853d15174484(_ref) {
8167
8161
  }
8168
8162
  }));
8169
8163
  }
8170
- function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
8164
+ function $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, products_request_loading_) {
8171
8165
  let hasSeenContentBlock = false;
8172
8166
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
8173
8167
  const contentComponents = new Map();
8174
- $52FdA$solidjs.createEffect(() => {
8168
+ const delayedServerBlocks = $52FdA$solidjs.createMemo(prev => {
8175
8169
  var _plp_meta;
8176
- const serverContentBlock = (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
8170
+ // Do not update the server blocks while the products request is loading, to avoid this: https://depictaiworkspace.slack.com/archives/C01JB6E7K7G/p1750861454651319
8171
+ if (products_request_loading_()) return prev;
8172
+ return (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
8173
+ });
8174
+ $52FdA$solidjs.createEffect(() => {
8175
+ const serverContentBlock = delayedServerBlocks();
8177
8176
  const currentHistory = $52FdA$solidjs.untrack(historyContentBlocks);
8178
8177
  // 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).
8179
8178
  if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
@@ -8282,7 +8281,8 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
8282
8281
  content_blocks_by_row_: content_blocks_by_row_,
8283
8282
  filterModalParent_: filterModalParent_,
8284
8283
  showSliderArrow_: showSliderArrow_,
8285
- hideCount0FilterOptions_: hideCount0FilterOptions_
8284
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
8285
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
8286
8286
  } = _ref;
8287
8287
  let results_for;
8288
8288
  let only_show_filters_opener_;
@@ -8378,7 +8378,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
8378
8378
  setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
8379
8379
  return result;
8380
8380
  }));
8381
- const contentBlocksByRow = $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
8381
+ const contentBlocksByRow = $0c035bbe7e30b438$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, () => plp_products_.loading);
8382
8382
  const countOfProductsForUI = $e335e2ff536c1a0b$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
8383
8383
  const available_sortings_ = $52FdA$solidjs.createMemo(() => {
8384
8384
  var _plp_products_, _plp_products_$sorts;
@@ -8515,6 +8515,7 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
8515
8515
  sort_and_filter_disabled_: sort_and_filter_disabled_,
8516
8516
  filterModalParent_: filterModalParent_,
8517
8517
  hideCount0FilterOptions_: hideCount0FilterOptions_,
8518
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_,
8518
8519
  ...extra_sort_and_filter_args_
8519
8520
  });
8520
8521
  $52FdA$depictaiutilisharedlatest.catchify((0, $fef4890f1f8e0544$export$6e49da55e449af7c))({
@@ -15438,7 +15439,8 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
15438
15439
  filterModalParent_: filterModalParent_,
15439
15440
  class_: class_,
15440
15441
  showSliderArrow_: showSliderArrow_,
15441
- hideCount0FilterOptions_: hideCount0FilterOptions_
15442
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
15443
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
15442
15444
  } = _ref;
15443
15445
  const [get_sorting] = current_sorting_;
15444
15446
  const all_products_loaded_ = $52FdA$solidjs.createSignal(false);
@@ -15559,7 +15561,8 @@ function $739c927cbecd26b0$export$a54ec244c8863715(_ref) {
15559
15561
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
15560
15562
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
15561
15563
  filterModalParent_: filterModalParent_,
15562
- hideCount0FilterOptions_: hideCount0FilterOptions_
15564
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
15565
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
15563
15566
  });
15564
15567
  const results_filters = $52FdA$solidjs.createSignal();
15565
15568
  const shouldActuallyShowInputField = $52FdA$solidjs.createMemo(() => {
@@ -16314,6 +16317,7 @@ function $ddd39c5f36f49703$export$f2dc7e4e4aa11abb(props) {
16314
16317
  search_sorting_open_: state_.sorting_open,
16315
16318
  expanded_filters_: state_.expanded_filters,
16316
16319
  content_results_rows_: state_.content_results_rows,
16320
+ switchToFiltersDrawerBreakpoint_: () => props.switchToFiltersDrawerBreakpoint_,
16317
16321
  content_blocks_by_row_: () => props.content_blocks_by_row,
16318
16322
  router_: shared_properties.router_,
16319
16323
  make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
@@ -17021,7 +17025,8 @@ function $c10e33c4681f8c9b$export$e2bf8ce7779e827e(props) {
17021
17025
  })),
17022
17026
  product_card_template_: product_card_template,
17023
17027
  sorting_query_param_: sorting_query_param_,
17024
- filter_query_param_prefix_: filter_query_param_prefix_
17028
+ filter_query_param_prefix_: filter_query_param_prefix_,
17029
+ switchToFiltersDrawerBreakpoint_: () => props.switchToFiltersDrawerBreakpoint_
17025
17030
  });
17026
17031
  }, "Entire CategoryPage failed");
17027
17032
  }
package/ES10/index.d.ts CHANGED
@@ -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.10.4";
14
+ export const version = "4.10.6";
15
15
  /**
16
16
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
17
  */
@@ -1318,7 +1318,6 @@ type RecsAPIWrapperOptions = {
1318
1318
  * @param market The market to fetch recs for. Depict will provide this to you. (Example: "sv" or "sv-se".)
1319
1319
  * @param locale The locale to fetch for.
1320
1320
  * @param type The type of the recommendations, e.g. `front_page`, `after_basket, `related`, etc. Ask Depict for this.
1321
- * @param categoryId When requesting recommendations for a category page, pass the id of the category page as `categoryId`.
1322
1321
  * @param productId When requesting recommendations for a single product, e.g. on a product detail page, pass the id of the product as `productId`.
1323
1322
  * @param productIds When requesting recommendations that should take multiple products into account, i.e. the contents of the basket/cart, pass an array of product ids as `productIds`
1324
1323
  * @param sessionId Optional unique identifier of the current session. Only necessary when performing server side requests to Depict.
@@ -1502,6 +1501,7 @@ export function SearchPage<OriginalDisplay extends Display, TransformedDisplay e
1502
1501
  class?: string;
1503
1502
  showSliderArrow_?: boolean;
1504
1503
  hideCount0FilterOptions_?: boolean;
1504
+ switchToFiltersDrawerBreakpoint_?: number | undefined;
1505
1505
  }): import("@depict-ai/utilishared").Node_Array;
1506
1506
  /**
1507
1507
  * Connects the height of the search field to the height of the aligner.
@@ -1541,7 +1541,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1541
1541
  * Open the modal with support for alignment.
1542
1542
  * @returns {void}
1543
1543
  */
1544
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1544
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1545
1545
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1546
1546
  export interface PageReplacer {
1547
1547
  readonly render_: () => Node_Array;
@@ -1613,6 +1613,7 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1613
1613
  grid_spacing: SDKGridSpacing;
1614
1614
  cols_at_size: SDKColsAtSize;
1615
1615
  product_card_template: ProductCardTemplate<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>;
1616
+ switchToFiltersDrawerBreakpoint_?: number | undefined;
1616
1617
  show_quicklinks?: boolean;
1617
1618
  show_breadcrumbs?: boolean;
1618
1619
  category_title: typeof CategoryTitle | typeof embedded_num_products;
@@ -1622,5 +1623,5 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1622
1623
  filterModalParent_?: HTMLElement | ShadowRoot;
1623
1624
  showSliderArrow_?: boolean;
1624
1625
  hideCount0FilterOptions_?: boolean;
1625
- }): import("@depict-ai/utilishared/latest").Node_Array;
1626
+ }): import("@depict-ai/utilishared").Node_Array;
1626
1627
  export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";
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.10.4";
13
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "4.10.6";
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 => {
@@ -6187,7 +6187,8 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
6187
6187
  get_extra_filters_button_: get_extra_filters_button_,
6188
6188
  get_extra_sorting_button_: get_extra_sorting_button_,
6189
6189
  filterModalParent_: filterModalParent_,
6190
- hideCount0FilterOptions_: hideCount0FilterOptions_
6190
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
6191
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
6191
6192
  } = _ref;
6192
6193
  const Self = () => {
6193
6194
  // This could technically be in SearchPage and CategoryPage and would be better suited there since it writes into local_filter_cache_ which i.e. SelectedFilters uses, but it's better suited here IMO due to DRY and being inside the correct error boundary here
@@ -6196,11 +6197,13 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
6196
6197
  selected_filters_: selected_filters_,
6197
6198
  local_filter_cache_: local_filter_cache_
6198
6199
  });
6199
- const cleanup_promise = new Promise(r => $8tj43$onCleanup(r));
6200
6200
  const [filters_open, set_filters_open] = search_filters_open_;
6201
6201
  const [sorting_open, set_sorting_open] = search_sorting_open_;
6202
6202
  const [get_current_sorting_] = current_sorting_;
6203
- const [is_small, set_is_small] = $8tj43$createSignal(false);
6203
+ const isSmall = $8tj43$createMemo(() => {
6204
+ var _switchToFiltersDrawe;
6205
+ return $00a5b94f0c11efbb$export$d9f36cf74e24d595("(max-width:".concat((_switchToFiltersDrawe = switchToFiltersDrawerBreakpoint_()) !== null && _switchToFiltersDrawe !== void 0 ? _switchToFiltersDrawe : 651, "px)"));
6206
+ });
6204
6207
  const dismiss_modal_ = $8tj43$catchify1(() => {
6205
6208
  set_filters_open(false);
6206
6209
  set_sorting_open(false);
@@ -6264,7 +6267,7 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
6264
6267
  $8tj43$createComputed(() => {
6265
6268
  const fi_o = filters_open();
6266
6269
  const so_o = sorting_open();
6267
- const i_s = is_small();
6270
+ const i_s = isSmall()();
6268
6271
  // we need to always read all the signal if we have them in the if-statement the value of it changes when the computation runs
6269
6272
  if ((fi_o || so_o) && !i_s) {
6270
6273
  if (!grid_is_in_original_state) return;
@@ -6280,7 +6283,7 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
6280
6283
  var _close_modal_;
6281
6284
  (_close_modal_ = close_modal_) === null || _close_modal_ === void 0 || _close_modal_();
6282
6285
  set_extra_els_in_results_container_("");
6283
- } else if (is_small()) {
6286
+ } else if (isSmall()()) {
6284
6287
  var _open_modal_;
6285
6288
  if ($8tj43$untrack(() => input_modal_open_ === null || input_modal_open_ === void 0 ? void 0 : input_modal_open_())) {
6286
6289
  // we don't want to shove another modal into the users face, silently close the filters for them
@@ -6324,15 +6327,6 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
6324
6327
  dismiss_modal_: dismiss_modal_,
6325
6328
  i18n_: i18n_
6326
6329
  }, filterModalParent_));
6327
- const {
6328
- remove: remove
6329
- } = $8tj43$javascript_media_query("(max-width:651px)", _ref3 => {
6330
- let {
6331
- matches: matches
6332
- } = _ref3;
6333
- return set_is_small(matches);
6334
- });
6335
- cleanup_promise.then(remove);
6336
6330
  })();
6337
6331
  get_extra_filters_button_ === null || get_extra_filters_button_ === void 0 || get_extra_filters_button_(make_open_filters_button());
6338
6332
  get_extra_sorting_button_ === null || get_extra_sorting_button_ === void 0 || get_extra_sorting_button_(make_open_sorting_button());
@@ -6374,7 +6368,7 @@ function $7396052a1484264f$export$d7841e452f2e59a8(_ref) {
6374
6368
  }
6375
6369
  });
6376
6370
  }
6377
- function $7396052a1484264f$var$OpenFiltersButton(_ref4) {
6371
+ function $7396052a1484264f$var$OpenFiltersButton(_ref3) {
6378
6372
  let {
6379
6373
  i18n_: i18n_,
6380
6374
  search_filters_open_: search_filters_open_,
@@ -6383,7 +6377,7 @@ function $7396052a1484264f$var$OpenFiltersButton(_ref4) {
6383
6377
  tabindex_: tabindex_,
6384
6378
  number_of_rendered_selected_filters_items_: [num_selected_filters],
6385
6379
  hide_button_: hide_button_
6386
- } = _ref4;
6380
+ } = _ref3;
6387
6381
  const filters_closed = $8tj43$createMemo(() => !search_filters_open_[0]());
6388
6382
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
6389
6383
  return (() => {
@@ -6454,7 +6448,7 @@ function $7396052a1484264f$var$OpenFiltersButton(_ref4) {
6454
6448
  return _el$14;
6455
6449
  })();
6456
6450
  }
6457
- function $7396052a1484264f$var$OpenSortingButton(_ref5) {
6451
+ function $7396052a1484264f$var$OpenSortingButton(_ref4) {
6458
6452
  let {
6459
6453
  i18n_: i18n_,
6460
6454
  get_current_sorting_: get_current_sorting_,
@@ -6464,7 +6458,7 @@ function $7396052a1484264f$var$OpenSortingButton(_ref5) {
6464
6458
  sort_button_width_: sort_button_width_,
6465
6459
  tabindex_: tabindex_,
6466
6460
  meta_of_currently_selected_sorting_: meta_of_currently_selected_sorting_
6467
- } = _ref5;
6461
+ } = _ref4;
6468
6462
  const sorting_closed = $8tj43$createMemo(() => !search_sorting_open_[0]());
6469
6463
  // We assume in embedded_num_products that this is a single HTMLElement so pls change there if you change it here
6470
6464
  return (() => {
@@ -8062,13 +8056,18 @@ function $3b772ef9a35560fe$export$780a853d15174484(_ref) {
8062
8056
  }
8063
8057
  }));
8064
8058
  }
8065
- function $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
8059
+ function $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, products_request_loading_) {
8066
8060
  let hasSeenContentBlock = false;
8067
8061
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
8068
8062
  const contentComponents = new Map();
8069
- $8tj43$createEffect(() => {
8063
+ const delayedServerBlocks = $8tj43$createMemo(prev => {
8070
8064
  var _plp_meta;
8071
- const serverContentBlock = (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
8065
+ // Do not update the server blocks while the products request is loading, to avoid this: https://depictaiworkspace.slack.com/archives/C01JB6E7K7G/p1750861454651319
8066
+ if (products_request_loading_()) return prev;
8067
+ return (_plp_meta = plp_meta()) === null || _plp_meta === void 0 ? void 0 : _plp_meta.content_blocks;
8068
+ });
8069
+ $8tj43$createEffect(() => {
8070
+ const serverContentBlock = delayedServerBlocks();
8072
8071
  const currentHistory = $8tj43$untrack(historyContentBlocks);
8073
8072
  // 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).
8074
8073
  if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
@@ -8177,7 +8176,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
8177
8176
  content_blocks_by_row_: content_blocks_by_row_,
8178
8177
  filterModalParent_: filterModalParent_,
8179
8178
  showSliderArrow_: showSliderArrow_,
8180
- hideCount0FilterOptions_: hideCount0FilterOptions_
8179
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
8180
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
8181
8181
  } = _ref;
8182
8182
  let results_for;
8183
8183
  let only_show_filters_opener_;
@@ -8273,7 +8273,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
8273
8273
  setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
8274
8274
  return result;
8275
8275
  }));
8276
- const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
8276
+ const contentBlocksByRow = $12ff24fdc4b26d88$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, () => plp_products_.loading);
8277
8277
  const countOfProductsForUI = $0728458b46ee9d32$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
8278
8278
  const available_sortings_ = $8tj43$createMemo(() => {
8279
8279
  var _plp_products_, _plp_products_$sorts;
@@ -8410,6 +8410,7 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
8410
8410
  sort_and_filter_disabled_: sort_and_filter_disabled_,
8411
8411
  filterModalParent_: filterModalParent_,
8412
8412
  hideCount0FilterOptions_: hideCount0FilterOptions_,
8413
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_,
8413
8414
  ...extra_sort_and_filter_args_
8414
8415
  });
8415
8416
  $8tj43$catchify((0, $5e6abec0dab4e610$export$6e49da55e449af7c))({
@@ -15333,7 +15334,8 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
15333
15334
  filterModalParent_: filterModalParent_,
15334
15335
  class_: class_,
15335
15336
  showSliderArrow_: showSliderArrow_,
15336
- hideCount0FilterOptions_: hideCount0FilterOptions_
15337
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
15338
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
15337
15339
  } = _ref;
15338
15340
  const [get_sorting] = current_sorting_;
15339
15341
  const all_products_loaded_ = $8tj43$createSignal(false);
@@ -15454,7 +15456,8 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
15454
15456
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
15455
15457
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
15456
15458
  filterModalParent_: filterModalParent_,
15457
- hideCount0FilterOptions_: hideCount0FilterOptions_
15459
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
15460
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
15458
15461
  });
15459
15462
  const results_filters = $8tj43$createSignal();
15460
15463
  const shouldActuallyShowInputField = $8tj43$createMemo(() => {
@@ -16209,6 +16212,7 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
16209
16212
  search_sorting_open_: state_.sorting_open,
16210
16213
  expanded_filters_: state_.expanded_filters,
16211
16214
  content_results_rows_: state_.content_results_rows,
16215
+ switchToFiltersDrawerBreakpoint_: () => props.switchToFiltersDrawerBreakpoint_,
16212
16216
  content_blocks_by_row_: () => props.content_blocks_by_row,
16213
16217
  router_: shared_properties.router_,
16214
16218
  make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
@@ -16916,7 +16920,8 @@ function $8821a19349c36651$export$e2bf8ce7779e827e(props) {
16916
16920
  })),
16917
16921
  product_card_template_: product_card_template,
16918
16922
  sorting_query_param_: sorting_query_param_,
16919
- filter_query_param_prefix_: filter_query_param_prefix_
16923
+ filter_query_param_prefix_: filter_query_param_prefix_,
16924
+ switchToFiltersDrawerBreakpoint_: () => props.switchToFiltersDrawerBreakpoint_
16920
16925
  });
16921
16926
  }, "Entire CategoryPage failed");
16922
16927
  }
package/latest/index.cjs CHANGED
@@ -109,7 +109,7 @@ $parcel$export(module.exports, "BreadCrumbs", () => $1f4925833f07df29$export$5b7
109
109
  $parcel$export(module.exports, "QuickLinks", () => $1f4925833f07df29$export$de035477d6fef996);
110
110
  $parcel$export(module.exports, "CategoryPage", () => $14f289047713d67a$export$e2bf8ce7779e827e);
111
111
  /*! Depict.ai search and product listing SDK */
112
- const $b757f75811f3261f$export$83d89fbfd8236492 = "4.10.4";
112
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "4.10.6";
113
113
  function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
114
114
  const signal = $gVhhF$solidjs.createSignal(false);
115
115
  $gVhhF$solidjs.onCleanup($gVhhF$depictaiutilishared.javascript_media_query(media_query, ({
@@ -5946,7 +5946,8 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
5946
5946
  get_extra_filters_button_: get_extra_filters_button_,
5947
5947
  get_extra_sorting_button_: get_extra_sorting_button_,
5948
5948
  filterModalParent_: filterModalParent_,
5949
- hideCount0FilterOptions_: hideCount0FilterOptions_
5949
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
5950
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
5950
5951
  }) {
5951
5952
  const Self = () => {
5952
5953
  // This could technically be in SearchPage and CategoryPage and would be better suited there since it writes into local_filter_cache_ which i.e. SelectedFilters uses, but it's better suited here IMO due to DRY and being inside the correct error boundary here
@@ -5955,11 +5956,10 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
5955
5956
  selected_filters_: selected_filters_,
5956
5957
  local_filter_cache_: local_filter_cache_
5957
5958
  });
5958
- const cleanup_promise = new Promise(r => $gVhhF$solidjs.onCleanup(r));
5959
5959
  const [filters_open, set_filters_open] = search_filters_open_;
5960
5960
  const [sorting_open, set_sorting_open] = search_sorting_open_;
5961
5961
  const [get_current_sorting_] = current_sorting_;
5962
- const [is_small, set_is_small] = $gVhhF$solidjs.createSignal(false);
5962
+ const isSmall = $gVhhF$solidjs.createMemo(() => $b54e6192d0caa293$export$d9f36cf74e24d595(`(max-width:${switchToFiltersDrawerBreakpoint_() ?? 651}px)`));
5963
5963
  const dismiss_modal_ = $gVhhF$depictaiutilishared.catchify(() => {
5964
5964
  set_filters_open(false);
5965
5965
  set_sorting_open(false);
@@ -6011,7 +6011,7 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
6011
6011
  $gVhhF$solidjs.createComputed(() => {
6012
6012
  const fi_o = filters_open();
6013
6013
  const so_o = sorting_open();
6014
- const i_s = is_small();
6014
+ const i_s = isSmall()();
6015
6015
  // we need to always read all the signal if we have them in the if-statement the value of it changes when the computation runs
6016
6016
  if ((fi_o || so_o) && !i_s) {
6017
6017
  if (!grid_is_in_original_state) return;
@@ -6026,7 +6026,7 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
6026
6026
  if (!filters_open() && !sorting_open()) {
6027
6027
  close_modal_?.();
6028
6028
  set_extra_els_in_results_container_("");
6029
- } else if (is_small()) {
6029
+ } else if (isSmall()()) {
6030
6030
  if ($gVhhF$solidjs.untrack(() => input_modal_open_?.())) {
6031
6031
  // we don't want to shove another modal into the users face, silently close the filters for them
6032
6032
  set_filters_open(false);
@@ -6068,12 +6068,6 @@ function $f8f64d05c525825b$export$d7841e452f2e59a8({
6068
6068
  dismiss_modal_: dismiss_modal_,
6069
6069
  i18n_: i18n_
6070
6070
  }, filterModalParent_));
6071
- const {
6072
- remove: remove
6073
- } = $gVhhF$depictaiutilishared.javascript_media_query("(max-width:651px)", ({
6074
- matches: matches
6075
- }) => set_is_small(matches));
6076
- cleanup_promise.then(remove);
6077
6071
  })();
6078
6072
  get_extra_filters_button_?.(make_open_filters_button());
6079
6073
  get_extra_sorting_button_?.(make_open_sorting_button());
@@ -7729,12 +7723,17 @@ function $32c662f618f5d80d$export$780a853d15174484({
7729
7723
  }
7730
7724
  }));
7731
7725
  }
7732
- function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_) {
7726
+ function $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, products_request_loading_) {
7733
7727
  let hasSeenContentBlock = false;
7734
7728
  const [historyContentBlocks, setHistoryContentBlocks] = history_content_blocks_;
7735
7729
  const contentComponents = new Map();
7730
+ const delayedServerBlocks = $gVhhF$solidjs.createMemo(prev => {
7731
+ // Do not update the server blocks while the products request is loading, to avoid this: https://depictaiworkspace.slack.com/archives/C01JB6E7K7G/p1750861454651319
7732
+ if (products_request_loading_()) return prev;
7733
+ return plp_meta()?.content_blocks;
7734
+ });
7736
7735
  $gVhhF$solidjs.createEffect(() => {
7737
- const serverContentBlock = plp_meta()?.content_blocks;
7736
+ const serverContentBlock = delayedServerBlocks();
7738
7737
  const currentHistory = $gVhhF$solidjs.untrack(historyContentBlocks);
7739
7738
  // 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).
7740
7739
  if (serverContentBlock && JSON.stringify(serverContentBlock) !== JSON.stringify(currentHistory.blocks)) setHistoryContentBlocks({
@@ -7840,7 +7839,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
7840
7839
  content_blocks_by_row_: content_blocks_by_row_,
7841
7840
  filterModalParent_: filterModalParent_,
7842
7841
  showSliderArrow_: showSliderArrow_,
7843
- hideCount0FilterOptions_: hideCount0FilterOptions_
7842
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
7843
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
7844
7844
  }) {
7845
7845
  let results_for;
7846
7846
  let only_show_filters_opener_;
@@ -7936,7 +7936,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
7936
7936
  setMetaRequestsForQuery(prev => prev.set(query.id_type_ + query.id_to_query_for_, listing));
7937
7937
  return result;
7938
7938
  }));
7939
- const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_);
7939
+ const contentBlocksByRow = $0a80939bf0a1e9cc$export$7a92d995f1bf3592(history_content_blocks_, plp_meta, content_blocks_by_row_, router_, () => plp_products_.loading);
7940
7940
  const countOfProductsForUI = $13796d59ea8af231$export$a86bc18439445599(plp_products_, all_products_loaded_, currentlyLoadedDisplays);
7941
7941
  const available_sortings_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
7942
7942
  ...sort,
@@ -8055,6 +8055,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8055
8055
  sort_and_filter_disabled_: sort_and_filter_disabled_,
8056
8056
  filterModalParent_: filterModalParent_,
8057
8057
  hideCount0FilterOptions_: hideCount0FilterOptions_,
8058
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_,
8058
8059
  ...extra_sort_and_filter_args_
8059
8060
  });
8060
8061
  $gVhhF$depictaiutilisharedlatest.catchify((0, $276380e4607fb9fb$export$6e49da55e449af7c))({
@@ -14562,7 +14563,8 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
14562
14563
  filterModalParent_: filterModalParent_,
14563
14564
  class_: class_,
14564
14565
  showSliderArrow_: showSliderArrow_,
14565
- hideCount0FilterOptions_: hideCount0FilterOptions_
14566
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
14567
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
14566
14568
  }) {
14567
14569
  const [get_sorting] = current_sorting_;
14568
14570
  const all_products_loaded_ = $gVhhF$solidjs.createSignal(false);
@@ -14671,7 +14673,8 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
14671
14673
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
14672
14674
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
14673
14675
  filterModalParent_: filterModalParent_,
14674
- hideCount0FilterOptions_: hideCount0FilterOptions_
14676
+ hideCount0FilterOptions_: hideCount0FilterOptions_,
14677
+ switchToFiltersDrawerBreakpoint_: switchToFiltersDrawerBreakpoint_
14675
14678
  });
14676
14679
  const results_filters = $gVhhF$solidjs.createSignal();
14677
14680
  const shouldActuallyShowInputField = $gVhhF$solidjs.createMemo(() => include_input_field_?.() ?? true); // default to showing input field
@@ -15332,6 +15335,7 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
15332
15335
  search_sorting_open_: state_.sorting_open,
15333
15336
  expanded_filters_: state_.expanded_filters,
15334
15337
  content_results_rows_: state_.content_results_rows,
15338
+ switchToFiltersDrawerBreakpoint_: () => props.switchToFiltersDrawerBreakpoint_,
15335
15339
  content_blocks_by_row_: () => props.content_blocks_by_row,
15336
15340
  router_: shared_properties.router_,
15337
15341
  make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
@@ -15929,7 +15933,8 @@ function $14f289047713d67a$export$e2bf8ce7779e827e(props) {
15929
15933
  })),
15930
15934
  product_card_template_: product_card_template,
15931
15935
  sorting_query_param_: sorting_query_param_,
15932
- filter_query_param_prefix_: filter_query_param_prefix_
15936
+ filter_query_param_prefix_: filter_query_param_prefix_,
15937
+ switchToFiltersDrawerBreakpoint_: () => props.switchToFiltersDrawerBreakpoint_
15933
15938
  });
15934
15939
  }, "Entire CategoryPage failed");
15935
15940
  }
package/latest/index.d.ts CHANGED
@@ -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.10.4";
14
+ export const version = "4.10.6";
15
15
  /**
16
16
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
17
17
  */
@@ -1318,7 +1318,6 @@ type RecsAPIWrapperOptions = {
1318
1318
  * @param market The market to fetch recs for. Depict will provide this to you. (Example: "sv" or "sv-se".)
1319
1319
  * @param locale The locale to fetch for.
1320
1320
  * @param type The type of the recommendations, e.g. `front_page`, `after_basket, `related`, etc. Ask Depict for this.
1321
- * @param categoryId When requesting recommendations for a category page, pass the id of the category page as `categoryId`.
1322
1321
  * @param productId When requesting recommendations for a single product, e.g. on a product detail page, pass the id of the product as `productId`.
1323
1322
  * @param productIds When requesting recommendations that should take multiple products into account, i.e. the contents of the basket/cart, pass an array of product ids as `productIds`
1324
1323
  * @param sessionId Optional unique identifier of the current session. Only necessary when performing server side requests to Depict.
@@ -1502,6 +1501,7 @@ export function SearchPage<OriginalDisplay extends Display, TransformedDisplay e
1502
1501
  class?: string;
1503
1502
  showSliderArrow_?: boolean;
1504
1503
  hideCount0FilterOptions_?: boolean;
1504
+ switchToFiltersDrawerBreakpoint_?: number | undefined;
1505
1505
  }): import("@depict-ai/utilishared").Node_Array;
1506
1506
  /**
1507
1507
  * Connects the height of the search field to the height of the aligner.
@@ -1541,7 +1541,7 @@ type OpenModalParams<OriginalDisplay extends Display, OutputDisplay extends Mode
1541
1541
  * Open the modal with support for alignment.
1542
1542
  * @returns {void}
1543
1543
  */
1544
- export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends ModernDisplay>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1544
+ export const open_modal_with_alignment: <OriginalDisplay extends Display, OutputDisplay extends unknown>(openModalParams: OpenModalParams<OriginalDisplay, OutputDisplay>) => void;
1545
1545
  export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
1546
1546
  export interface PageReplacer {
1547
1547
  readonly render_: () => Node_Array;
@@ -1613,6 +1613,7 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1613
1613
  grid_spacing: SDKGridSpacing;
1614
1614
  cols_at_size: SDKColsAtSize;
1615
1615
  product_card_template: ProductCardTemplate<[OutputDisplay] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>;
1616
+ switchToFiltersDrawerBreakpoint_?: number | undefined;
1616
1617
  show_quicklinks?: boolean;
1617
1618
  show_breadcrumbs?: boolean;
1618
1619
  category_title: typeof CategoryTitle | typeof embedded_num_products;
@@ -1622,5 +1623,5 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
1622
1623
  filterModalParent_?: HTMLElement | ShadowRoot;
1623
1624
  showSliderArrow_?: boolean;
1624
1625
  hideCount0FilterOptions_?: boolean;
1625
- }): import("@depict-ai/utilishared/latest").Node_Array;
1626
+ }): import("@depict-ai/utilishared").Node_Array;
1626
1627
  export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";