@depict-ai/ui 3.0.3 → 3.0.5

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,13 +1,13 @@
1
- import { add_to_version_info as $i7OB2$add_to_version_info, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, get_session_id as $i7OB2$get_session_id, add_version_query_params as $i7OB2$add_version_query_params, base_url as $i7OB2$base_url, dwarn as $i7OB2$dwarn, catchify as $i7OB2$catchify1, observer as $i7OB2$observer, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, report as $i7OB2$report, dlog as $i7OB2$dlog, ContainedImage as $i7OB2$ContainedImage, use_href_accessor as $i7OB2$use_href_accessor1, camelCasifyObject as $i7OB2$camelCasifyObject, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, is_safari as $i7OB2$is_safari, slider_fractional_factory as $i7OB2$slider_fractional_factory, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, snakeCasifyObject as $i7OB2$snakeCasifyObject, fetch_retry as $i7OB2$fetch_retry, sort_obj as $i7OB2$sort_obj, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, javascript_media_query as $i7OB2$javascript_media_query, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, ListenableSet as $i7OB2$ListenableSet1, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
1
+ import { add_to_version_info as $i7OB2$add_to_version_info, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, get_session_id as $i7OB2$get_session_id, add_version_query_params as $i7OB2$add_version_query_params, base_url as $i7OB2$base_url, dwarn as $i7OB2$dwarn, catchify as $i7OB2$catchify1, observer as $i7OB2$observer, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, report as $i7OB2$report, dlog as $i7OB2$dlog, ContainedImage as $i7OB2$ContainedImage, use_href_accessor as $i7OB2$use_href_accessor1, camelCasifyObject as $i7OB2$camelCasifyObject, make_random_classname as $i7OB2$make_random_classname, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, is_safari as $i7OB2$is_safari, slider_fractional_factory as $i7OB2$slider_fractional_factory, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, hex_to_rgb as $i7OB2$hex_to_rgb, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, snakeCasifyObject as $i7OB2$snakeCasifyObject, fetch_retry as $i7OB2$fetch_retry, sort_obj as $i7OB2$sort_obj, make_url_with_query_params as $i7OB2$make_url_with_query_params, javascript_media_query as $i7OB2$javascript_media_query, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, ListenableSet as $i7OB2$ListenableSet1, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
2
2
  import { createComponent as $i7OB2$createComponent, mergeProps as $i7OB2$mergeProps, Dynamic as $i7OB2$Dynamic, ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, escape as $i7OB2$escape, ssrAttribute as $i7OB2$ssrAttribute, insert as $i7OB2$insert, ssrElement as $i7OB2$ssrElement, ssrClassList as $i7OB2$ssrClassList, ssrStyle as $i7OB2$ssrStyle, isServer as $i7OB2$isServer, spread as $i7OB2$spread } from "solid-js/web";
3
3
  import { createContext as $i7OB2$createContext, useContext as $i7OB2$useContext, createSignal as $i7OB2$createSignal, createSelector as $i7OB2$createSelector, getOwner as $i7OB2$getOwner, runWithOwner as $i7OB2$runWithOwner, Index as $i7OB2$Index, createMemo as $i7OB2$createMemo, children as $i7OB2$children, onCleanup as $i7OB2$onCleanup, createEffect as $i7OB2$createEffect, untrack as $i7OB2$untrack, Show as $i7OB2$Show, createUniqueId as $i7OB2$createUniqueId, mergeProps as $i7OB2$mergeProps1, ErrorBoundary as $i7OB2$ErrorBoundary, createResource as $i7OB2$createResource, splitProps as $i7OB2$splitProps, createRoot as $i7OB2$createRoot, createRenderEffect as $i7OB2$createRenderEffect, batch as $i7OB2$batch, Suspense as $i7OB2$Suspense, on as $i7OB2$on, For as $i7OB2$For, createComputed as $i7OB2$createComputed, createReaction as $i7OB2$createReaction, mapArray as $i7OB2$mapArray } from "solid-js";
4
- import { ListenableSet as $i7OB2$ListenableSet, catchify as $i7OB2$catchify, use_href_accessor as $i7OB2$use_href_accessor } from "@depict-ai/utilishared/latest";
4
+ import { ListenableSet as $i7OB2$ListenableSet, catchify as $i7OB2$catchify, use_href_accessor as $i7OB2$use_href_accessor, report as $i7OB2$report1 } from "@depict-ai/utilishared/latest";
5
5
  import { createStore as $i7OB2$createStore, reconcile as $i7OB2$reconcile } from "solid-js/store";
6
6
 
7
7
  /*! Depict.ai search and product listing SDK */
8
8
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
9
9
  register_es_version("ui", "latest");
10
- const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.3";
10
+ const $ec291e0010116877$export$83d89fbfd8236492 = "3.0.5";
11
11
  const $fbbadcb080ad1d4a$var$_tmpl$ = ["<svg", ' xmlns="http://www.w3.org/2000/svg"', ' viewBox="0 0 14 26"><path d="M2 24.656c-.078 0-.156-.016-.234-.047s-.133-.066-.187-.129c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422l10.371-10.371L1.578 2.883c-.117-.117-.176-.258-.176-.422s.059-.305.176-.422.258-.176.422-.176.305.059.422.176l10.805 10.793a.59.59 0 0 1 .176.434c0 .172-.059.305-.176.422L2.422 24.48a.42.42 0 0 1-.199.129.54.54 0 0 1-.223.047zm0 0" fill="#0f0f0f"></path></svg>'];
12
12
  function $fbbadcb080ad1d4a$export$8be2714ec7f169ee(props = {}) {
13
13
  return $i7OB2$ssr($fbbadcb080ad1d4a$var$_tmpl$, $i7OB2$ssrHydrationKey(), $i7OB2$ssrAttribute("width", $i7OB2$escape(props.width_, true) ?? 14, false) + $i7OB2$ssrAttribute("height", $i7OB2$escape(props.height_, true) ?? 26, false));
@@ -369,7 +369,7 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
369
369
  event_: event_,
370
370
  force_spa_navigation_: force_spa_navigation_,
371
371
  is_replace_: is_replace_,
372
- listing_id_: listing_id_,
372
+ listing_query_: listing_query_,
373
373
  scroll = true
374
374
  }) => {
375
375
  const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
@@ -390,10 +390,10 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
390
390
  if (force_spa_navigation_ && wants_hard_navigation) {
391
391
  // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
392
392
  const new_state = history.state;
393
- if (listing_id_) {
393
+ if (listing_query_) {
394
394
  // In JS-UI we need to know the listing_id of the current category, therefore push it into state
395
- if (!this.listing_id_state_key) $i7OB2$report(new Error("listing_id_state_key is not set"), "error");
396
- new_state[this.listing_id_state_key] = listing_id_;
395
+ if (!this.listing_query_state_key) $i7OB2$report(new Error("listing_query_state_key is not set"), "error");
396
+ new_state[this.listing_query_state_key] = listing_query_;
397
397
  }
398
398
  history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
399
399
  } else this.#throwing_on_navigation.call(this, {
@@ -404,8 +404,8 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
404
404
  await promise;
405
405
  })
406
406
  };
407
- constructor(on_navigation, listing_id_state_key) {
408
- this.listing_id_state_key = listing_id_state_key;
407
+ constructor(on_navigation, listing_query_state_key) {
408
+ this.listing_query_state_key = listing_query_state_key;
409
409
  this.on_navigation_ = on_navigation;
410
410
  }
411
411
  }
@@ -824,27 +824,31 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({
824
824
  });
825
825
  }
826
826
  // source: https://medium.com/@pancemarko/deep-equality-in-javascript-determining-if-two-objects-are-equal-bf98cf47e934
827
+ // deeply diffs two objects
828
+ // Modified by chatGPT to not be recursive, since stiga was getting a stack overflow just due to the size of their data
829
+ // Modified futher to bias towards saying objects are equal non-primitive objects differ
827
830
  function $29ec7cddbe1d3484$var$deep_equal(obj1, obj2) {
828
- if (obj1 === obj2) return true;
829
- if (Array.isArray(obj1) && Array.isArray(obj2)) {
830
- if (obj1.length !== obj2.length) return false;
831
- return obj1.every((elem, index) => {
832
- return $29ec7cddbe1d3484$var$deep_equal(elem, obj2[index]);
833
- });
834
- }
835
- if (typeof obj1 === "object" && typeof obj2 === "object" && obj1 !== null && obj2 !== null) {
836
- if (Array.isArray(obj1) || Array.isArray(obj2)) return false;
837
- const keys1 = Object.keys(obj1);
838
- const keys2 = Object.keys(obj2);
839
- if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
840
- for (const key in obj1) {
841
- if ($29ec7cddbe1d3484$var$result_ids.includes(key)) continue; // ignore keys changing with every request
842
- const isEqual = $29ec7cddbe1d3484$var$deep_equal(obj1[key], obj2[key]);
843
- if (!isEqual) return false;
844
- }
845
- return true;
831
+ const stack = [[obj1, obj2]];
832
+ while (stack.length > 0) {
833
+ const [currentObj1, currentObj2] = stack.pop();
834
+ if (currentObj1 === currentObj2) continue;
835
+ if (Array.isArray(currentObj1) && Array.isArray(currentObj2)) {
836
+ if (currentObj1.length !== currentObj2.length) return false;
837
+ for (let i = 0; i < currentObj1.length; i++) stack.push([currentObj1[i], currentObj2[i]]);
838
+ } else if (typeof currentObj1 === "object" && typeof currentObj2 === "object" && currentObj1 !== null && currentObj2 !== null) {
839
+ if (Array.isArray(currentObj1) || Array.isArray(currentObj2)) return false;
840
+ const keys1 = Object.keys(currentObj1);
841
+ const keys2 = Object.keys(currentObj2);
842
+ if (keys1.length !== keys2.length || !keys1.every(key => keys2.includes(key))) return false;
843
+ for (let key in currentObj1) {
844
+ if ($29ec7cddbe1d3484$var$result_ids.includes(key)) continue; // ignore comparing values for keys we know are changing with every request
845
+ stack.push([currentObj1[key], currentObj2[key]]);
846
+ }
847
+ } else if (typeof currentObj1 !== "function" && typeof currentObj2 !== "function")
848
+ // Claim that all functions are equal, since the only way a function ends up here is because someone added it in the displayTransformer and that shouldn't force us to re-render, right?
849
+ return false;
846
850
  }
847
- return false;
851
+ return true;
848
852
  }
849
853
  const $c8d5ff4524619fcd$var$_tmpl$ = ["<div", ' class="', '">', "</div>"],
850
854
  $c8d5ff4524619fcd$var$_tmpl$2 = ["<style", ' type="text/css">', "</style>"];
@@ -4380,6 +4384,11 @@ function $e5014ccd0b76d9f4$export$967e966fca9515e(api_response) {
4380
4384
  }
4381
4385
  return api_response;
4382
4386
  }
4387
+
4388
+ // Minifiable and tree-shakable enum
4389
+ // Why not use const enum? See https://gitlab.com/depict-ai/depict.ai/-/merge_requests/9223#note_1675965260
4390
+ const $c20599a0d81d953a$export$74ee7529ce0f8a00 = "listingId";
4391
+ const $c20599a0d81d953a$export$5aae649db1b959fc = "externalId";
4383
4392
  const $7fa23e2a0079eca4$var$v3_base_url = (0, $i7OB2$base_url) + "/v3/";
4384
4393
  const $7fa23e2a0079eca4$var$search_base_url = $7fa23e2a0079eca4$var$v3_base_url + "search/";
4385
4394
  class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
@@ -4409,7 +4418,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
4409
4418
  const category_transformer = this.display_transformers?.categories;
4410
4419
  if (!category_transformer) return response;
4411
4420
  // find category suggestions, run thing with them, and then replace them
4412
- const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
4421
+ const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "listing");
4413
4422
  const transformed_category_suggestions = await category_transformer({
4414
4423
  market: market,
4415
4424
  merchant: merchant,
@@ -4459,8 +4468,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
4459
4468
  endpoint_: endpoint_,
4460
4469
  input_req_: input_req_,
4461
4470
  fallback_response_: fallback_response_,
4462
- method_ = "POST",
4463
- delete_key_before_sending_: delete_key_before_sending_ // only supported for GET requests
4471
+ method_ = "POST"
4464
4472
  }) {
4465
4473
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
4466
4474
  const with_ids = this.#add_ids_to_request(input_req_);
@@ -4478,7 +4486,6 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
4478
4486
  cache_obj.in_progress_[body] = new Promise(r => resolve_in_progress = r);
4479
4487
  try {
4480
4488
  const is_post = method_ === "POST";
4481
- if (!is_post && delete_key_before_sending_) delete sorted_request[delete_key_before_sending_];
4482
4489
  const url_to_request = is_post ? endpoint_ : $i7OB2$make_url_with_query_params(endpoint_, sorted_request);
4483
4490
  const api_response = await $i7OB2$fetch_retry($i7OB2$add_version_query_params(url_to_request), {
4484
4491
  method: method_,
@@ -4566,9 +4573,13 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
4566
4573
  })
4567
4574
  });
4568
4575
  }
4569
- async get_listing(input_req) {
4576
+ async get_listing({
4577
+ id_type_: id_type_,
4578
+ id_to_query_for_: id_to_query_for_,
4579
+ ...input_req
4580
+ }) {
4570
4581
  return await this.#cached_request({
4571
- endpoint_: $7fa23e2a0079eca4$var$v3_base_url + "listings/" + encodeURIComponent(input_req.listing_id),
4582
+ endpoint_: $7fa23e2a0079eca4$var$v3_base_url + "listings/" + (id_type_ === $c20599a0d81d953a$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_),
4572
4583
  input_req_: input_req,
4573
4584
  fallback_response_: () => ({
4574
4585
  listing_id: "",
@@ -4582,20 +4593,17 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
4582
4593
  "quick_links": [],
4583
4594
  failed: true
4584
4595
  }),
4585
- method_: "GET",
4586
- delete_key_before_sending_: "listing_id" // this goes into the path, but we still need to have it in the request object until the last second as we want to include it as a key when caching requests
4596
+ method_: "GET"
4587
4597
  });
4588
4598
  }
4589
-
4590
- async get_listing_products(input_req) {
4591
- const listing_id = input_req.listing_id; // listing_id goes into the path
4592
- const cloned_request = {
4593
- ...input_req
4594
- };
4595
- delete cloned_request["listing_id"];
4599
+ async get_listing_products({
4600
+ id_to_query_for_: id_to_query_for_,
4601
+ id_type_: id_type_,
4602
+ ...input_req_
4603
+ }) {
4596
4604
  return await this.#cached_request({
4597
- endpoint_: $7fa23e2a0079eca4$var$v3_base_url + "listings/" + encodeURIComponent(listing_id) + "/products",
4598
- input_req_: input_req,
4605
+ endpoint_: $7fa23e2a0079eca4$var$v3_base_url + "listings/" + (id_type_ === $c20599a0d81d953a$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
4606
+ input_req_: input_req_,
4599
4607
  fallback_response_: () => ({
4600
4608
  "n_hits": 0,
4601
4609
  "displays": [],
@@ -4896,7 +4904,7 @@ function $056f6ac0a6caa919$export$5e4aed86c12acdd9({
4896
4904
  // After first load, always just load 20 since people might just be browsing the top ones still
4897
4905
  min_products_to_fetch_ : now - last_loaded < 10000 ? min_products_to_fetch_ * 5 : min_products_to_fetch_;
4898
4906
  // dlog("loading ", number_of_results_to_load, "products, because it was", now - last_loaded, "ms since last load");
4899
- const api_response = await depict_api_["listing_id" in base_part ? "get_listing_products" : "query"]({
4907
+ const api_response = await depict_api_["query" in base_part ? "query" : "get_listing_products"]({
4900
4908
  cursor: get_last_cursor(),
4901
4909
  limit: number_of_results_to_load,
4902
4910
  ...base_part
@@ -6188,11 +6196,12 @@ const $06edf3aec9073663$var$_tmpl$ = ["<nav", ' class="quicklinks"', ">", "</nav
6188
6196
  function $06edf3aec9073663$export$466cdc317043f6cb({
6189
6197
  quicklinks_data_: quicklinks_data_,
6190
6198
  router_: router_,
6191
- current_listing_id_: current_listing_id_,
6199
+ id_to_query_for_: id_to_query_for_,
6192
6200
  breadcrumb_data_: breadcrumb_data_,
6193
6201
  i18n_: i18n_,
6194
6202
  sorting_query_param_: sorting_query_param_,
6195
- filter_query_param_prefix_: filter_query_param_prefix_
6203
+ filter_query_param_prefix_: filter_query_param_prefix_,
6204
+ id_type_: id_type_
6196
6205
  }) {
6197
6206
  let scrolling_logic_ran_for_listing_id = false;
6198
6207
  let last_scroll_position;
@@ -6200,11 +6209,11 @@ function $06edf3aec9073663$export$466cdc317043f6cb({
6200
6209
  let last_was_placeholder = false;
6201
6210
  let sliding_element;
6202
6211
  $i7OB2$createComputed(() => {
6203
- current_listing_id_();
6212
+ id_to_query_for_();
6204
6213
  scrolling_logic_ran_for_listing_id = false;
6205
6214
  });
6206
6215
  const place_holdey_quicklinks_data = $i7OB2$createMemo(() => quicklinks_data_() || [,,,]);
6207
- const selected_index = $i7OB2$createMemo(() => quicklinks_data_()?.findIndex(item => item.listing_id === current_listing_id_())); // this will be -1 when viewing child categories
6216
+ const selected_index = $i7OB2$createMemo(() => quicklinks_data_()?.findIndex(item => item[id_type_() === $c20599a0d81d953a$export$5aae649db1b959fc ? "external_id" : "listing_id"] === id_to_query_for_())); // this will be -1 when viewing child categories
6208
6217
  const scrollpos_per_listing_id = {};
6209
6218
  const mutation_plugins = [function () {
6210
6219
  if (!scrolling_logic_ran_for_listing_id) return;
@@ -6213,7 +6222,7 @@ function $06edf3aec9073663$export$466cdc317043f6cb({
6213
6222
  } = this.insert_here;
6214
6223
  if (scrollLeft > 0) {
6215
6224
  last_scroll_position = scrollLeft;
6216
- const current_id = $i7OB2$untrack(current_listing_id_);
6225
+ const current_id = $i7OB2$untrack(id_to_query_for_);
6217
6226
  // make sure to not save position where selected item isn't in viewport
6218
6227
  const current_selected_index = $i7OB2$untrack(selected_index);
6219
6228
  const intersecting_thing = this.intersecting_items_object[current_selected_index];
@@ -6275,7 +6284,7 @@ function $06edf3aec9073663$export$466cdc317043f6cb({
6275
6284
  equals: false
6276
6285
  }), new_data => {
6277
6286
  const quicklinks_data = quicklinks_data_(); // this signal should have updated by now since this is a createEffect
6278
- const current_id = current_listing_id_();
6287
+ const current_id = id_to_query_for_();
6279
6288
  if (!new_data || !quicklinks_data || !current_id) return;
6280
6289
  const owner = $i7OB2$getOwner();
6281
6290
  queueMicrotask(() => {
@@ -6323,10 +6332,9 @@ function $06edf3aec9073663$export$466cdc317043f6cb({
6323
6332
  // Problem: When you don't open a link in a new tab, we don't display the filter cleared toast
6324
6333
  // Solution: instead of not adding the state to the url, add a flag to the link if it's a sibling and then display the toast on load if the flag is set
6325
6334
  const is_sibling = $i7OB2$createMemo(() => {
6326
- const current_id = current_listing_id_();
6327
- return quicklinks_data_()?.some(({
6328
- listing_id: listing_id
6329
- }) => listing_id === current_id);
6335
+ const current_id = id_to_query_for_();
6336
+ const lookForId = id_type_() === $c20599a0d81d953a$export$5aae649db1b959fc ? "external_id" : "listing_id";
6337
+ return quicklinks_data_()?.some(quickLink => quickLink[lookForId] === current_id);
6330
6338
  });
6331
6339
  const href = $i7OB2$createMemo(() =>
6332
6340
  // We don't want these links to delete the sort and filter state by default, only if `clear_filters_when_going_sideways` explicitly clears them
@@ -6534,13 +6542,14 @@ function $e9342fb3ac73a54a$export$8895d39404bd2bb1(props) {
6534
6542
  }
6535
6543
  function $e7fce80abe608e01$export$3945d6db2dfd3d12({
6536
6544
  crumb_data_: crumb_data_,
6537
- listing_id_: listing_id_,
6545
+ id_to_query_for_: id_to_query_for_,
6538
6546
  i18n_: i18n_,
6539
6547
  selected_filters_: selected_filters_,
6540
6548
  local_filter_cache_: local_filter_cache_,
6541
6549
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6542
6550
  plp_results_: plp_results_,
6543
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6551
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6552
+ id_type_: id_type_
6544
6553
  }) {
6545
6554
  // If we just got opened in a new tab, clear filters instantly and remove the flag
6546
6555
  $e7fce80abe608e01$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
@@ -6551,17 +6560,21 @@ function $e7fce80abe608e01$export$3945d6db2dfd3d12({
6551
6560
  i18n_: i18n_,
6552
6561
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6553
6562
  });
6554
- // Code below is for when we're already open and the user navigates to a new category
6563
+ // The code below is for when we're already open and the user navigates to a new category
6555
6564
  let previous_crumb_data = $i7OB2$untrack(crumb_data_);
6556
- let listing_id_when_we_got_previous_data = $i7OB2$untrack(listing_id_);
6565
+ let id_when_we_got_previous_data = {
6566
+ id_: $i7OB2$untrack(id_to_query_for_),
6567
+ type_: $i7OB2$untrack(id_type_)
6568
+ };
6557
6569
  let allow_filter_clearing = true; // set to false when going backwards/forwards
6558
6570
  // temporarily disable filter clearing when going backwards/forwards
6559
6571
  const handler = () => allow_filter_clearing = false;
6560
6572
  window.addEventListener("popstate", handler); // popstate only gets called when using back/forwards button of browser or the history navigate to achieve the same, but not on pushState or replaceState
6561
6573
  $i7OB2$onCleanup(() => window.removeEventListener("popstate", handler));
6562
6574
  $i7OB2$createEffect($i7OB2$on(crumb_data_, $i7OB2$catchify1(new_crumb_data => {
6563
- const listing_id_of_new_data = listing_id_();
6564
- if (allow_filter_clearing && previous_crumb_data && new_crumb_data && listing_id_of_new_data !== listing_id_when_we_got_previous_data) {
6575
+ const id_of_new_data = id_to_query_for_();
6576
+ const type_of_id_of_new_data = id_type_();
6577
+ if (allow_filter_clearing && previous_crumb_data && new_crumb_data && (id_of_new_data !== id_when_we_got_previous_data.id_ || type_of_id_of_new_data !== id_when_we_got_previous_data.type_)) {
6565
6578
  const previous_length = previous_crumb_data.length;
6566
6579
  const new_length = new_crumb_data.length;
6567
6580
  const went_upwards = new_length < previous_length;
@@ -6584,7 +6597,10 @@ function $e7fce80abe608e01$export$3945d6db2dfd3d12({
6584
6597
  sideways_filter_clearing_flag_[1](false);
6585
6598
  }
6586
6599
  }
6587
- listing_id_when_we_got_previous_data = listing_id_of_new_data;
6600
+ id_when_we_got_previous_data = {
6601
+ id_: id_of_new_data,
6602
+ type_: type_of_id_of_new_data
6603
+ };
6588
6604
  previous_crumb_data = new_crumb_data;
6589
6605
  if (!allow_filter_clearing) allow_filter_clearing = true;
6590
6606
  })));
@@ -6647,8 +6663,8 @@ const $df5d81d0fe61ff21$var$_tmpl$ = ["<div", ' class="product-count"><!--$-->',
6647
6663
  $df5d81d0fe61ff21$var$_tmpl$4 = ["<div", ' class="depict plp category"><div class="listing-page"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
6648
6664
  function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6649
6665
  depict_api_: depict_api_,
6650
- listing_id_: listing_id_,
6651
- meta_title_suffix_: meta_title_suffix_,
6666
+ id_to_query_for_: id_to_query_for_,
6667
+ id_type_: id_type_,
6652
6668
  current_sorting_: current_sorting_,
6653
6669
  min_products_to_fetch_: min_products_to_fetch_,
6654
6670
  category_filters_open_: category_filters_open_,
@@ -6701,7 +6717,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6701
6717
  merchant: merchant_(),
6702
6718
  market: market_(),
6703
6719
  locale: backend_locale_(),
6704
- listing_id: listing_id_(),
6720
+ id_to_query_for_: id_to_query_for_(),
6721
+ id_type_: id_type_(),
6705
6722
  ...(f.length ? {
6706
6723
  filters: f
6707
6724
  } : {}),
@@ -6713,8 +6730,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6713
6730
  // Make "Get products in listing" request to get products in listing
6714
6731
  const [plp_products_] = $i7OB2$createResource(products_query_base_,
6715
6732
  // only first page of results, unless the history state says we should load more (can't do that in load more thing, I tested, they need to be added at once for the browser to not give up scroll restoration)
6716
- $i7OB2$catchify1(base_query => $641bba2917fe862b$export$cc42dd29bf655ab6({
6717
- id_: $i7OB2$untrack(listing_id_),
6733
+ $i7OB2$catchify(base_query => $641bba2917fe862b$export$cc42dd29bf655ab6({
6734
+ id_: $i7OB2$untrack(id_to_query_for_),
6718
6735
  scroll_restoration_data_: scroll_restoration_data_,
6719
6736
  min_products_to_fetch_: min_products_to_fetch_,
6720
6737
  make_request_: (limit, cursor) => depict_api_.get_listing_products({
@@ -6729,10 +6746,11 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6729
6746
  merchant: merchant_(),
6730
6747
  market: market_(),
6731
6748
  locale: backend_locale_(),
6732
- listing_id: listing_id_()
6749
+ id_to_query_for_: id_to_query_for_(),
6750
+ id_type_: id_type_()
6733
6751
  }));
6734
6752
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
6735
- const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify1(query => depict_api_.get_listing(query)));
6753
+ const [plp_meta] = $i7OB2$createResource(meta_query_base, $i7OB2$catchify(query => depict_api_.get_listing(query)));
6736
6754
  const available_sortings_ = $i7OB2$createMemo(() => plp_products_()?.sorts?.map(sort => ({
6737
6755
  ...sort,
6738
6756
  order: sort.order ?? "desc"
@@ -6741,13 +6759,6 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6741
6759
  const title = $i7OB2$createMemo(() => plp_meta()?.title);
6742
6760
  const crumb_data_ = $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta, title);
6743
6761
  const quicklinks_data_ = $i7OB2$createMemo(() => plp_meta()?.quick_links);
6744
- const meta_tag_data_ = $i7OB2$createMemo(() => {
6745
- if (plp_meta()?.replace_meta_tags) return {
6746
- title: plp_meta()?.title + (meta_title_suffix_() || ""),
6747
- description: plp_meta()?.description
6748
- };
6749
- });
6750
- $i7OB2$edit_current_page_meta_tags(meta_tag_data_);
6751
6762
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $i7OB2$createSignal(false);
6752
6763
  const [desktop_filter_elements_, set_desktop_filter_elements] = $i7OB2$createSignal();
6753
6764
  const formatted_number_of_results_ = $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
@@ -6807,7 +6818,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6807
6818
  }));
6808
6819
  results_for = make_product_count_();
6809
6820
  } else {
6810
- $i7OB2$report(new Error("Unrecognised category_title_type, UI will look messed up"), "error");
6821
+ $i7OB2$report1(new Error("Unrecognised category_title_type, UI will look messed up"), "error");
6811
6822
  results_for = $i7OB2$ssr($df5d81d0fe61ff21$var$_tmpl$2, $i7OB2$ssrHydrationKey());
6812
6823
  }
6813
6824
  const filters_opener = $cdea4cf8c5c071ef$export$d7841e452f2e59a8({
@@ -6829,17 +6840,17 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6829
6840
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
6830
6841
  ...extra_sort_and_filter_args_
6831
6842
  });
6832
- $i7OB2$catchify1((0, $641bba2917fe862b$export$6e49da55e449af7c))({
6843
+ $i7OB2$catchify((0, $641bba2917fe862b$export$6e49da55e449af7c))({
6833
6844
  scroll_restoration_data_: scroll_restoration_data_,
6834
6845
  last_result_in_viewport_: last_result_in_viewport_,
6835
- id_: listing_id_,
6846
+ id_: id_to_query_for_,
6836
6847
  can_write_scroll_restoration_: can_write_scroll_restoration_
6837
6848
  });
6838
6849
  on_filters_constructed_?.();
6839
6850
  $i7OB2$createComputed(() => {
6840
6851
  if (plp_products_.loading) set_can_write_scroll_restoration(false);else if (plp_products_()) set_can_write_scroll_restoration(true);
6841
6852
  });
6842
- $i7OB2$createRenderEffect($i7OB2$catchify1(async () => {
6853
+ $i7OB2$createRenderEffect($i7OB2$catchify(async () => {
6843
6854
  const slim = is_slim_();
6844
6855
  const only_show_filters_opener = only_show_filters_opener_?.();
6845
6856
  const owner = $i7OB2$getOwner();
@@ -6852,14 +6863,15 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6852
6863
  available_filters_: available_filters_
6853
6864
  });
6854
6865
  $e7fce80abe608e01$export$3945d6db2dfd3d12({
6855
- listing_id_: listing_id_,
6866
+ id_to_query_for_: id_to_query_for_,
6856
6867
  crumb_data_: crumb_data_,
6857
6868
  i18n_: i18n_,
6858
6869
  selected_filters_: selected_filters_,
6859
6870
  local_filter_cache_: local_filter_cache_,
6860
6871
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6861
6872
  plp_results_: plp_products_,
6862
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6873
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6874
+ id_type_: id_type_
6863
6875
  });
6864
6876
  get_breadcrumb_accessor_?.(crumb_data_);
6865
6877
  get_quicklinks_accessor_?.(quicklinks_data_);
@@ -6883,7 +6895,8 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6883
6895
  get children() {
6884
6896
  return $i7OB2$createComponent((0, $06edf3aec9073663$export$466cdc317043f6cb), {
6885
6897
  quicklinks_data_: quicklinks_data_,
6886
- current_listing_id_: listing_id_,
6898
+ id_to_query_for_: id_to_query_for_,
6899
+ id_type_: id_type_,
6887
6900
  router_: router_,
6888
6901
  breadcrumb_data_: crumb_data_,
6889
6902
  i18n_: i18n_,
@@ -6933,7 +6946,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6933
6946
  sort_or_filter_open_: sort_or_filter_open_,
6934
6947
  desktop_filter_elements_: desktop_filter_elements_,
6935
6948
  content_blocks_by_row_: content_blocks_by_row_,
6936
- id_currently_querying_for_: listing_id_,
6949
+ id_currently_querying_for_: id_to_query_for_,
6937
6950
  no_results_options_: {
6938
6951
  selected_filters_: selected_filters_,
6939
6952
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -6974,7 +6987,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
6974
6987
  * Adds the current page as last breadcrumb to the breadcrumb trail
6975
6988
  */
6976
6989
  function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta, title) {
6977
- const href_accessor = $i7OB2$use_href_accessor1();
6990
+ const href_accessor = $i7OB2$use_href_accessor();
6978
6991
  return $i7OB2$createMemo(() => {
6979
6992
  const api_value = plp_meta()?.breadcrumbs;
6980
6993
  if (!api_value) return api_value;
@@ -6990,6 +7003,12 @@ function $df5d81d0fe61ff21$var$add_us_to_crumbs(plp_meta, title) {
6990
7003
  },
6991
7004
  get slug() {
6992
7005
  return plp_meta().slug;
7006
+ },
7007
+ get listing_type() {
7008
+ return plp_meta().listing_type;
7009
+ },
7010
+ get external_id() {
7011
+ return plp_meta().external_id;
6993
7012
  }
6994
7013
  }];
6995
7014
  });
@@ -7157,8 +7176,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
7157
7176
  #localization_signal = $i7OB2$createSignal();
7158
7177
  #merchant_signal = $i7OB2$createSignal();
7159
7178
  #market_signal = $i7OB2$createSignal();
7160
- #listing_id_signal = $i7OB2$createSignal("");
7161
- #meta_title_suffix_ = $i7OB2$createSignal();
7179
+ #listing_query_signal = $i7OB2$createSignal({});
7162
7180
  #disable_override_listing_id = $i7OB2$createSignal();
7163
7181
  static #keys_constructed_with = /*@__PURE__*/new Set();
7164
7182
  get localization() {
@@ -7168,11 +7186,11 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
7168
7186
  set localization(locale_obj) {
7169
7187
  this.#localization_signal[1](locale_obj);
7170
7188
  }
7171
- get listing_id() {
7172
- return this.#listing_id_signal[0]();
7189
+ get listing_query() {
7190
+ return this.#listing_query_signal[0]();
7173
7191
  }
7174
- set listing_id(id) {
7175
- this.#listing_id_signal[1](id);
7192
+ set listing_query(query) {
7193
+ this.#listing_query_signal[1](query);
7176
7194
  }
7177
7195
  get merchant() {
7178
7196
  return this.#merchant_signal[0]();
@@ -7186,12 +7204,6 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
7186
7204
  set market(market) {
7187
7205
  this.#market_signal[1](market);
7188
7206
  }
7189
- get meta_title_suffix() {
7190
- return this.#meta_title_suffix_[0]();
7191
- }
7192
- set meta_title_suffix(new_suffix) {
7193
- this.#meta_title_suffix_[1](new_suffix);
7194
- }
7195
7207
  get disable_override_listing_id() {
7196
7208
  return this.#disable_override_listing_id[0]();
7197
7209
  }
@@ -7210,7 +7222,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
7210
7222
  on_navigation: on_navigation,
7211
7223
  display_transformers: display_transformers,
7212
7224
  unique_instance_key_for_state = "",
7213
- listing_id_state_key: listing_id_state_key,
7225
+ listing_query_state_key: listing_query_state_key,
7214
7226
  ...props_on_class
7215
7227
  }) {
7216
7228
  const owner = $i7OB2$getOwner() || $i7OB2$createRoot(() => $i7OB2$getOwner()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
@@ -7220,7 +7232,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
7220
7232
  throw new Error("You can only have one instance of DepictCategory with the same uniqueInstanceKeyForState");
7221
7233
  Object.assign(this, props_on_class); // set initial signal values
7222
7234
  $90980bd87c9960f9$export$5162a71f252e6122();
7223
- this.#router = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation", listing_id_state_key);
7235
+ this.#router = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation", listing_query_state_key);
7224
7236
  if (on_navigation) this.#router.on_navigation_ = on_navigation;
7225
7237
  const override_listing_id_query_param_names_ = ["listing_id_" + unique_instance_key_for_state, "listing_id"]; // If you're wondering why this is an array https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7958#note_1511700842
7226
7238
  const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
@@ -7280,14 +7292,16 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
7280
7292
  category_title: category_title
7281
7293
  } = props;
7282
7294
  const shared_properties = $961b5c64bef4662f$var$get_shared_properties(depict_category);
7295
+ const diffableListingQuery = $i7OB2$createMemo(() => Object.values(depict_category.listing_query || {}).join(""));
7283
7296
  return $16b52438165aafe2$export$23fca46f3143581f(() => {
7284
7297
  $i7OB2$createEffect(prev => {
7285
7298
  // this is here (and not on DepictCategory) so that people also know when PageReplacer removes the page, it's intended to help people replace their own content when a depict page is navigated, see https://depictaiworkspace.slack.com/archives/C04M8MGCF3K/p1691670636155369
7286
- const id = depict_category.listing_id; // <- this is a reactive getter
7287
- $d8dbf52fea1773e2$export$f50b88e2a00918b5(props.on_listing_id_change)(id, prev);
7288
- return id;
7299
+ diffableListingQuery(); // Only re-run this effect when the listing query *actually* changes (not just the object reference)
7300
+ const newId = $i7OB2$untrack(() => depict_category.listing_query);
7301
+ $d8dbf52fea1773e2$export$f50b88e2a00918b5(props.on_listing_query_change)(newId, prev);
7302
+ return newId;
7289
7303
  });
7290
- $i7OB2$onCleanup(() => $d8dbf52fea1773e2$export$f50b88e2a00918b5(props.on_listing_id_change)());
7304
+ $i7OB2$onCleanup(() => $d8dbf52fea1773e2$export$f50b88e2a00918b5(props.on_listing_query_change)());
7291
7305
  const grid_spacing_override = $i7OB2$createMemo(() => {
7292
7306
  const {
7293
7307
  grid_spacing: grid_spacing
@@ -7328,8 +7342,11 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
7328
7342
  depict_api_: depict_api_,
7329
7343
  min_products_to_fetch_: $961b5c64bef4662f$var$min_products_to_fetch_,
7330
7344
  local_filter_cache_: local_filter_cache_,
7331
- listing_id_: $i7OB2$createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_id),
7332
- meta_title_suffix_: () => depict_category.meta_title_suffix,
7345
+ id_to_query_for_: $i7OB2$createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_query.id),
7346
+ id_type_: $i7OB2$createMemo(() => {
7347
+ if (!depict_category.disable_override_listing_id && override_listing_id_accessor_()) return $c20599a0d81d953a$export$74ee7529ce0f8a00;
7348
+ return depict_category.listing_query.type;
7349
+ }),
7333
7350
  i18n_: i18n_,
7334
7351
  show_quicklinks_: $i7OB2$createMemo(() => props.show_quicklinks ?? true),
7335
7352
  category_title_: category_title,
@@ -7389,13 +7406,16 @@ function $961b5c64bef4662f$export$de035477d6fef996({
7389
7406
  sorting_query_param_: sorting_query_param_,
7390
7407
  filter_query_param_prefix_: filter_query_param_prefix_
7391
7408
  } = $961b5c64bef4662f$var$get_shared_properties(depict_category);
7409
+ const id_to_query_for_ = $i7OB2$createMemo(() => depict_category.listing_query.id);
7410
+ const id_type_ = $i7OB2$createMemo(() => depict_category.listing_query.type);
7392
7411
  return $i7OB2$createComponent($961b5c64bef4662f$var$InExternalAreaDiv, {
7393
7412
  get children() {
7394
7413
  return $06edf3aec9073663$export$466cdc317043f6cb({
7395
7414
  i18n_: i18n_,
7396
7415
  quicklinks_data_: quicklinks_data_,
7397
7416
  router_: router_,
7398
- current_listing_id_: () => depict_category.listing_id,
7417
+ id_type_: id_type_,
7418
+ id_to_query_for_: id_to_query_for_,
7399
7419
  breadcrumb_data_: breadcrumb_data_,
7400
7420
  sorting_query_param_: sorting_query_param_,
7401
7421
  filter_query_param_prefix_: filter_query_param_prefix_
@@ -8161,7 +8181,7 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
8161
8181
  searching_for_value_: searching_for_value_
8162
8182
  }), $i7OB2$ssr($cea52f6b24092f05$var$_tmpl$3, $i7OB2$ssrHydrationKey(), $i7OB2$escape($i7OB2$createMemo(() => {
8163
8183
  if (input_obj().type === "content") return i18n_.content_();
8164
- if (input_obj().category_type === "brand") return i18n_.brand_();
8184
+ if (input_obj().listing_type === "brand") return i18n_.brand_();
8165
8185
  return i18n_.category_();
8166
8186
  })()))]));
8167
8187
  };
@@ -8376,7 +8396,7 @@ function $15f380f0ce2812cc$var$actual_navigation_working_on_fake_data({
8376
8396
  url.searchParams.set(search_query_param_name_, title);
8377
8397
  return $92a48aea6a9364d8$export$1efe1013da60d0e4(e, url.href);
8378
8398
  }));
8379
- } else if (selected_entry?.type == "category" || selected_entry?.type === "content") $i7OB2$runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
8399
+ } else if (selected_entry?.type == "listing" || selected_entry?.type === "content") $i7OB2$runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
8380
8400
  const {
8381
8401
  page_url: page_url
8382
8402
  } = selected_entry;
@@ -8830,7 +8850,7 @@ function $793905995512612d$export$c05a196222ba1302({
8830
8850
  suggestions_: suggestions_,
8831
8851
  children: children
8832
8852
  }) {
8833
- const category_suggestions_ = $i7OB2$createMemo(() => suggestions_()?.suggestions.filter(s => s.type === "category"));
8853
+ const category_suggestions_ = $i7OB2$createMemo(() => suggestions_()?.suggestions.filter(s => s.type === "listing"));
8834
8854
  return $i7OB2$createComponent((0, $i7OB2$Show), {
8835
8855
  get when() {
8836
8856
  return category_suggestions_()?.length || suggestions_.loading;