@depict-ai/ui 3.0.2 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/latest/index.cjs CHANGED
@@ -77,7 +77,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
77
77
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
78
78
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
79
79
  /*! Depict.ai search and product listing SDK */
80
- const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.2";
80
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.4";
81
81
  const $0f313083912e447a$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<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>`);
82
82
  function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
83
83
  return (() => {
@@ -488,7 +488,7 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
488
488
  event_: event_,
489
489
  force_spa_navigation_: force_spa_navigation_,
490
490
  is_replace_: is_replace_,
491
- listing_id_: listing_id_,
491
+ listing_query_: listing_query_,
492
492
  scroll = true
493
493
  }) => {
494
494
  const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
@@ -509,10 +509,10 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
509
509
  if (force_spa_navigation_ && wants_hard_navigation) {
510
510
  // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
511
511
  const new_state = history.state;
512
- if (listing_id_) {
512
+ if (listing_query_) {
513
513
  // In JS-UI we need to know the listing_id of the current category, therefore push it into state
514
- if (!this.listing_id_state_key) $gVhhF$depictaiutilishared.report(new Error("listing_id_state_key is not set"), "error");
515
- new_state[this.listing_id_state_key] = listing_id_;
514
+ if (!this.listing_query_state_key) $gVhhF$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
515
+ new_state[this.listing_query_state_key] = listing_query_;
516
516
  }
517
517
  history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
518
518
  } else this.#throwing_on_navigation.call(this, {
@@ -523,8 +523,8 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
523
523
  await promise;
524
524
  })
525
525
  };
526
- constructor(on_navigation, listing_id_state_key) {
527
- this.listing_id_state_key = listing_id_state_key;
526
+ constructor(on_navigation, listing_query_state_key) {
527
+ this.listing_query_state_key = listing_query_state_key;
528
528
  this.on_navigation_ = on_navigation;
529
529
  }
530
530
  }
@@ -5492,6 +5492,8 @@ function $67dc366d96177e70$export$967e966fca9515e(api_response) {
5492
5492
  }
5493
5493
  return api_response;
5494
5494
  }
5495
+ const $779741d0f266ea8c$export$74ee7529ce0f8a00 = "listingId";
5496
+ const $779741d0f266ea8c$export$5aae649db1b959fc = "externalId";
5495
5497
  const $e1d6c0f3d89d531c$var$v3_base_url = (0, $gVhhF$depictaiutilishared.base_url) + "/v3/";
5496
5498
  const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$v3_base_url + "search/";
5497
5499
  class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
@@ -5521,7 +5523,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
5521
5523
  const category_transformer = this.display_transformers?.categories;
5522
5524
  if (!category_transformer) return response;
5523
5525
  // find category suggestions, run thing with them, and then replace them
5524
- const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
5526
+ const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "listing");
5525
5527
  const transformed_category_suggestions = await category_transformer({
5526
5528
  market: market,
5527
5529
  merchant: merchant,
@@ -5571,8 +5573,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
5571
5573
  endpoint_: endpoint_,
5572
5574
  input_req_: input_req_,
5573
5575
  fallback_response_: fallback_response_,
5574
- method_ = "POST",
5575
- delete_key_before_sending_: delete_key_before_sending_ // only supported for GET requests
5576
+ method_ = "POST"
5576
5577
  }) {
5577
5578
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
5578
5579
  const with_ids = this.#add_ids_to_request(input_req_);
@@ -5590,7 +5591,6 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
5590
5591
  cache_obj.in_progress_[body] = new Promise(r => resolve_in_progress = r);
5591
5592
  try {
5592
5593
  const is_post = method_ === "POST";
5593
- if (!is_post && delete_key_before_sending_) delete sorted_request[delete_key_before_sending_];
5594
5594
  const url_to_request = is_post ? endpoint_ : $gVhhF$depictaiutilishared.make_url_with_query_params(endpoint_, sorted_request);
5595
5595
  const api_response = await $gVhhF$depictaiutilishared.fetch_retry($gVhhF$depictaiutilishared.add_version_query_params(url_to_request), {
5596
5596
  method: method_,
@@ -5678,9 +5678,13 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
5678
5678
  })
5679
5679
  });
5680
5680
  }
5681
- async get_listing(input_req) {
5681
+ async get_listing({
5682
+ id_type_: id_type_,
5683
+ id_to_query_for_: id_to_query_for_,
5684
+ ...input_req
5685
+ }) {
5682
5686
  return await this.#cached_request({
5683
- endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + encodeURIComponent(input_req.listing_id),
5687
+ endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_),
5684
5688
  input_req_: input_req,
5685
5689
  fallback_response_: () => ({
5686
5690
  listing_id: "",
@@ -5694,20 +5698,17 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
5694
5698
  "quick_links": [],
5695
5699
  failed: true
5696
5700
  }),
5697
- method_: "GET",
5698
- 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
5701
+ method_: "GET"
5699
5702
  });
5700
5703
  }
5701
-
5702
- async get_listing_products(input_req) {
5703
- const listing_id = input_req.listing_id; // listing_id goes into the path
5704
- const cloned_request = {
5705
- ...input_req
5706
- };
5707
- delete cloned_request["listing_id"];
5704
+ async get_listing_products({
5705
+ id_to_query_for_: id_to_query_for_,
5706
+ id_type_: id_type_,
5707
+ ...input_req_
5708
+ }) {
5708
5709
  return await this.#cached_request({
5709
- endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + encodeURIComponent(listing_id) + "/products",
5710
- input_req_: input_req,
5710
+ endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
5711
+ input_req_: input_req_,
5711
5712
  fallback_response_: () => ({
5712
5713
  "n_hits": 0,
5713
5714
  "displays": [],
@@ -6046,7 +6047,7 @@ function $3f08fe2992a2a8ca$export$5e4aed86c12acdd9({
6046
6047
  // After first load, always just load 20 since people might just be browsing the top ones still
6047
6048
  min_products_to_fetch_ : now - last_loaded < 10000 ? min_products_to_fetch_ * 5 : min_products_to_fetch_;
6048
6049
  // dlog("loading ", number_of_results_to_load, "products, because it was", now - last_loaded, "ms since last load");
6049
- const api_response = await depict_api_["listing_id" in base_part ? "get_listing_products" : "query"]({
6050
+ const api_response = await depict_api_["query" in base_part ? "query" : "get_listing_products"]({
6050
6051
  cursor: get_last_cursor(),
6051
6052
  limit: number_of_results_to_load,
6052
6053
  ...base_part
@@ -7688,7 +7689,10 @@ function $e53b2e7e632ac4cb$export$5646050d516e06bc({
7688
7689
  is_replace_: false,
7689
7690
  event_: ev,
7690
7691
  force_spa_navigation_: true,
7691
- listing_id_: display_accessor()?.listing_id
7692
+ listing_query_: {
7693
+ id: display_accessor().listing_id,
7694
+ type: $779741d0f266ea8c$export$74ee7529ce0f8a00
7695
+ }
7692
7696
  })), true);
7693
7697
  $gVhhF$solidjsweb.insert(_el$2, () => display_accessor().title);
7694
7698
  $gVhhF$solidjsweb.effect(() => $gVhhF$solidjsweb.setAttribute(_el$2, "href", href()));
@@ -7719,11 +7723,12 @@ const $8cceb1d3a967f369$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<n
7719
7723
  function $8cceb1d3a967f369$export$466cdc317043f6cb({
7720
7724
  quicklinks_data_: quicklinks_data_,
7721
7725
  router_: router_,
7722
- current_listing_id_: current_listing_id_,
7726
+ id_to_query_for_: id_to_query_for_,
7723
7727
  breadcrumb_data_: breadcrumb_data_,
7724
7728
  i18n_: i18n_,
7725
7729
  sorting_query_param_: sorting_query_param_,
7726
- filter_query_param_prefix_: filter_query_param_prefix_
7730
+ filter_query_param_prefix_: filter_query_param_prefix_,
7731
+ id_type_: id_type_
7727
7732
  }) {
7728
7733
  let scrolling_logic_ran_for_listing_id = false;
7729
7734
  let last_scroll_position;
@@ -7731,11 +7736,11 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
7731
7736
  let last_was_placeholder = false;
7732
7737
  let sliding_element;
7733
7738
  $gVhhF$solidjs.createComputed(() => {
7734
- current_listing_id_();
7739
+ id_to_query_for_();
7735
7740
  scrolling_logic_ran_for_listing_id = false;
7736
7741
  });
7737
7742
  const place_holdey_quicklinks_data = $gVhhF$solidjs.createMemo(() => quicklinks_data_() || [,,,]);
7738
- const selected_index = $gVhhF$solidjs.createMemo(() => quicklinks_data_()?.findIndex(item => item.listing_id === current_listing_id_())); // this will be -1 when viewing child categories
7743
+ const selected_index = $gVhhF$solidjs.createMemo(() => quicklinks_data_()?.findIndex(item => item[id_type_() === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id" : "listing_id"] === id_to_query_for_())); // this will be -1 when viewing child categories
7739
7744
  const scrollpos_per_listing_id = {};
7740
7745
  const mutation_plugins = [function () {
7741
7746
  if (!scrolling_logic_ran_for_listing_id) return;
@@ -7744,7 +7749,7 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
7744
7749
  } = this.insert_here;
7745
7750
  if (scrollLeft > 0) {
7746
7751
  last_scroll_position = scrollLeft;
7747
- const current_id = $gVhhF$solidjs.untrack(current_listing_id_);
7752
+ const current_id = $gVhhF$solidjs.untrack(id_to_query_for_);
7748
7753
  // make sure to not save position where selected item isn't in viewport
7749
7754
  const current_selected_index = $gVhhF$solidjs.untrack(selected_index);
7750
7755
  const intersecting_thing = this.intersecting_items_object[current_selected_index];
@@ -7807,7 +7812,7 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
7807
7812
  equals: false
7808
7813
  }), new_data => {
7809
7814
  const quicklinks_data = quicklinks_data_(); // this signal should have updated by now since this is a createEffect
7810
- const current_id = current_listing_id_();
7815
+ const current_id = id_to_query_for_();
7811
7816
  if (!new_data || !quicklinks_data || !current_id) return;
7812
7817
  const owner = $gVhhF$solidjs.getOwner();
7813
7818
  queueMicrotask(() => {
@@ -7855,10 +7860,9 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
7855
7860
  // Problem: When you don't open a link in a new tab, we don't display the filter cleared toast
7856
7861
  // 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
7857
7862
  const is_sibling = $gVhhF$solidjs.createMemo(() => {
7858
- const current_id = current_listing_id_();
7859
- return quicklinks_data_()?.some(({
7860
- listing_id: listing_id
7861
- }) => listing_id === current_id);
7863
+ const current_id = id_to_query_for_();
7864
+ const lookForId = id_type_() === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id" : "listing_id";
7865
+ return quicklinks_data_()?.some(quickLink => quickLink[lookForId] === current_id);
7862
7866
  });
7863
7867
  const href = $gVhhF$solidjs.createMemo(() =>
7864
7868
  // 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
@@ -7879,7 +7883,10 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
7879
7883
  is_replace_: false,
7880
7884
  event_: ev,
7881
7885
  force_spa_navigation_: true,
7882
- listing_id_: display_accessor()?.listing_id
7886
+ listing_query_: {
7887
+ id: display_accessor().listing_id,
7888
+ type: $779741d0f266ea8c$export$74ee7529ce0f8a00
7889
+ }
7883
7890
  });
7884
7891
  }), true);
7885
7892
  $gVhhF$solidjsweb.insert(_el$3, () => display_accessor()?.title || $gVhhF$solidjsweb.createComponent((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
@@ -8036,13 +8043,14 @@ let $0b6e2070a98de347$export$44dad306455dddf;
8036
8043
  })($0b6e2070a98de347$export$44dad306455dddf || ($0b6e2070a98de347$export$44dad306455dddf = {}));
8037
8044
  function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
8038
8045
  crumb_data_: crumb_data_,
8039
- listing_id_: listing_id_,
8046
+ id_to_query_for_: id_to_query_for_,
8040
8047
  i18n_: i18n_,
8041
8048
  selected_filters_: selected_filters_,
8042
8049
  local_filter_cache_: local_filter_cache_,
8043
8050
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
8044
8051
  plp_results_: plp_results_,
8045
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
8052
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
8053
+ id_type_: id_type_
8046
8054
  }) {
8047
8055
  // If we just got opened in a new tab, clear filters instantly and remove the flag
8048
8056
  $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
@@ -8053,17 +8061,21 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
8053
8061
  i18n_: i18n_,
8054
8062
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
8055
8063
  });
8056
- // Code below is for when we're already open and the user navigates to a new category
8064
+ // The code below is for when we're already open and the user navigates to a new category
8057
8065
  let previous_crumb_data = $gVhhF$solidjs.untrack(crumb_data_);
8058
- let listing_id_when_we_got_previous_data = $gVhhF$solidjs.untrack(listing_id_);
8066
+ let id_when_we_got_previous_data = {
8067
+ id_: $gVhhF$solidjs.untrack(id_to_query_for_),
8068
+ type_: $gVhhF$solidjs.untrack(id_type_)
8069
+ };
8059
8070
  let allow_filter_clearing = true; // set to false when going backwards/forwards
8060
8071
  // temporarily disable filter clearing when going backwards/forwards
8061
8072
  const handler = () => allow_filter_clearing = false;
8062
8073
  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
8063
8074
  $gVhhF$solidjs.onCleanup(() => window.removeEventListener("popstate", handler));
8064
8075
  $gVhhF$solidjs.createEffect($gVhhF$solidjs.on(crumb_data_, $gVhhF$depictaiutilishared.catchify(new_crumb_data => {
8065
- const listing_id_of_new_data = listing_id_();
8066
- if (allow_filter_clearing && previous_crumb_data && new_crumb_data && listing_id_of_new_data !== listing_id_when_we_got_previous_data) {
8076
+ const id_of_new_data = id_to_query_for_();
8077
+ const type_of_id_of_new_data = id_type_();
8078
+ 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_)) {
8067
8079
  const previous_length = previous_crumb_data.length;
8068
8080
  const new_length = new_crumb_data.length;
8069
8081
  const went_upwards = new_length < previous_length;
@@ -8086,7 +8098,10 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
8086
8098
  sideways_filter_clearing_flag_[1](false);
8087
8099
  }
8088
8100
  }
8089
- listing_id_when_we_got_previous_data = listing_id_of_new_data;
8101
+ id_when_we_got_previous_data = {
8102
+ id_: id_of_new_data,
8103
+ type_: type_of_id_of_new_data
8104
+ };
8090
8105
  previous_crumb_data = new_crumb_data;
8091
8106
  if (!allow_filter_clearing) allow_filter_clearing = true;
8092
8107
  })));
@@ -8118,7 +8133,7 @@ function $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_
8118
8133
  });
8119
8134
  tracking_function_for_plp_results(plp_results_);
8120
8135
  }
8121
- const $bb9760b7a8acdc18$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=statement style=white-space:pre-wrap>No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId.`),
8136
+ const $bb9760b7a8acdc18$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=statement style=white-space:pre-wrap>No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.`),
8122
8137
  $bb9760b7a8acdc18$var$_tmpl$2 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class=buttons><button class="ok major">`);
8123
8138
  function $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8124
8139
  if (!(0, $gVhhF$depictaiutilishared.is_debug)) return; // Just to make sure we don't show this in production
@@ -8128,7 +8143,7 @@ function $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id, i18n_) {
8128
8143
  }) => $gVhhF$solidjs.runWithOwner(owner, () => $gVhhF$solidjs.createEffect(() => {
8129
8144
  if (!document.documentElement.contains(element)) return;
8130
8145
  if (!listing_id()) {
8131
- const warning = "No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId.";
8146
+ const warning = "No listingId specified, this is probably unintentional. Make sure to create (and insert) the CategoryPage *after* you have specified a listingId/externalId.";
8132
8147
  $gVhhF$depictaiutilishared.dwarn(warning);
8133
8148
  const {
8134
8149
  close_toast_: close_toast_
@@ -8183,8 +8198,8 @@ const $840d88a04b2d22a7$var$_tmpl$ = /*#__PURE__*/$gVhhF$solidjsweb.template(`<d
8183
8198
  $840d88a04b2d22a7$var$_tmpl$4 = /*#__PURE__*/$gVhhF$solidjsweb.template(`<div class="depict plp category"><div class=listing-page><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/>`);
8184
8199
  function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8185
8200
  depict_api_: depict_api_,
8186
- listing_id_: listing_id_,
8187
- meta_title_suffix_: meta_title_suffix_,
8201
+ id_to_query_for_: id_to_query_for_,
8202
+ id_type_: id_type_,
8188
8203
  current_sorting_: current_sorting_,
8189
8204
  min_products_to_fetch_: min_products_to_fetch_,
8190
8205
  category_filters_open_: category_filters_open_,
@@ -8237,7 +8252,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8237
8252
  merchant: merchant_(),
8238
8253
  market: market_(),
8239
8254
  locale: backend_locale_(),
8240
- listing_id: listing_id_(),
8255
+ id_to_query_for_: id_to_query_for_(),
8256
+ id_type_: id_type_(),
8241
8257
  ...(f.length ? {
8242
8258
  filters: f
8243
8259
  } : {}),
@@ -8249,8 +8265,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8249
8265
  // Make "Get products in listing" request to get products in listing
8250
8266
  const [plp_products_] = $gVhhF$solidjs.createResource(products_query_base_,
8251
8267
  // 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)
8252
- $gVhhF$depictaiutilishared.catchify(base_query => $276380e4607fb9fb$export$cc42dd29bf655ab6({
8253
- id_: $gVhhF$solidjs.untrack(listing_id_),
8268
+ $gVhhF$depictaiutilisharedlatest.catchify(base_query => $276380e4607fb9fb$export$cc42dd29bf655ab6({
8269
+ id_: $gVhhF$solidjs.untrack(id_to_query_for_),
8254
8270
  scroll_restoration_data_: scroll_restoration_data_,
8255
8271
  min_products_to_fetch_: min_products_to_fetch_,
8256
8272
  make_request_: (limit, cursor) => depict_api_.get_listing_products({
@@ -8265,10 +8281,11 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8265
8281
  merchant: merchant_(),
8266
8282
  market: market_(),
8267
8283
  locale: backend_locale_(),
8268
- listing_id: listing_id_()
8284
+ id_to_query_for_: id_to_query_for_(),
8285
+ id_type_: id_type_()
8269
8286
  }));
8270
8287
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
8271
- const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilishared.catchify(query => depict_api_.get_listing(query)));
8288
+ const [plp_meta] = $gVhhF$solidjs.createResource(meta_query_base, $gVhhF$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
8272
8289
  const available_sortings_ = $gVhhF$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
8273
8290
  ...sort,
8274
8291
  order: sort.order ?? "desc"
@@ -8277,13 +8294,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8277
8294
  const title = $gVhhF$solidjs.createMemo(() => plp_meta()?.title);
8278
8295
  const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title);
8279
8296
  const quicklinks_data_ = $gVhhF$solidjs.createMemo(() => plp_meta()?.quick_links);
8280
- const meta_tag_data_ = $gVhhF$solidjs.createMemo(() => {
8281
- if (plp_meta()?.replace_meta_tags) return {
8282
- title: plp_meta()?.title + (meta_title_suffix_() || ""),
8283
- description: plp_meta()?.description
8284
- };
8285
- });
8286
- $gVhhF$depictaiutilishared.edit_current_page_meta_tags(meta_tag_data_);
8287
8297
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $gVhhF$solidjs.createSignal(false);
8288
8298
  const [desktop_filter_elements_, set_desktop_filter_elements] = $gVhhF$solidjs.createSignal();
8289
8299
  const formatted_number_of_results_ = $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
@@ -8353,7 +8363,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8353
8363
  }));
8354
8364
  results_for = make_product_count_();
8355
8365
  } else {
8356
- $gVhhF$depictaiutilishared.report(new Error("Unrecognised category_title_type, UI will look messed up"), "error");
8366
+ $gVhhF$depictaiutilisharedlatest.report(new Error("Unrecognised category_title_type, UI will look messed up"), "error");
8357
8367
  results_for = $gVhhF$solidjsweb.getNextElement($840d88a04b2d22a7$var$_tmpl$2);
8358
8368
  }
8359
8369
  const filters_opener = $f8f64d05c525825b$export$d7841e452f2e59a8({
@@ -8375,17 +8385,17 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8375
8385
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
8376
8386
  ...extra_sort_and_filter_args_
8377
8387
  });
8378
- $gVhhF$depictaiutilishared.catchify((0, $276380e4607fb9fb$export$6e49da55e449af7c))({
8388
+ $gVhhF$depictaiutilisharedlatest.catchify((0, $276380e4607fb9fb$export$6e49da55e449af7c))({
8379
8389
  scroll_restoration_data_: scroll_restoration_data_,
8380
8390
  last_result_in_viewport_: last_result_in_viewport_,
8381
- id_: listing_id_,
8391
+ id_: id_to_query_for_,
8382
8392
  can_write_scroll_restoration_: can_write_scroll_restoration_
8383
8393
  });
8384
8394
  on_filters_constructed_?.();
8385
8395
  $gVhhF$solidjs.createComputed(() => {
8386
8396
  if (plp_products_.loading) set_can_write_scroll_restoration(false);else if (plp_products_()) set_can_write_scroll_restoration(true);
8387
8397
  });
8388
- $gVhhF$solidjs.createRenderEffect($gVhhF$depictaiutilishared.catchify(async () => {
8398
+ $gVhhF$solidjs.createRenderEffect($gVhhF$depictaiutilisharedlatest.catchify(async () => {
8389
8399
  const slim = is_slim_();
8390
8400
  const only_show_filters_opener = only_show_filters_opener_?.();
8391
8401
  const owner = $gVhhF$solidjs.getOwner();
@@ -8407,14 +8417,15 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8407
8417
  available_filters_: available_filters_
8408
8418
  });
8409
8419
  $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
8410
- listing_id_: listing_id_,
8420
+ id_to_query_for_: id_to_query_for_,
8411
8421
  crumb_data_: crumb_data_,
8412
8422
  i18n_: i18n_,
8413
8423
  selected_filters_: selected_filters_,
8414
8424
  local_filter_cache_: local_filter_cache_,
8415
8425
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
8416
8426
  plp_results_: plp_products_,
8417
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
8427
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
8428
+ id_type_: id_type_
8418
8429
  });
8419
8430
  get_breadcrumb_accessor_?.(crumb_data_);
8420
8431
  get_quicklinks_accessor_?.(quicklinks_data_);
@@ -8437,7 +8448,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8437
8448
  [_el$28, _co$11] = $gVhhF$solidjsweb.getNextMarker(_el$27.nextSibling),
8438
8449
  _el$29 = _el$28.nextSibling,
8439
8450
  [_el$30, _co$12] = $gVhhF$solidjsweb.getNextMarker(_el$29.nextSibling);
8440
- $gVhhF$solidjsweb.use(el => process.env.NODE_ENV === "development" && $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, listing_id_, i18n_), _el$13);
8451
+ $gVhhF$solidjsweb.use(el => process.env.NODE_ENV === "development" && $bb9760b7a8acdc18$export$7af06a63c5a976c9(el, id_to_query_for_, i18n_), _el$13);
8441
8452
  $gVhhF$solidjsweb.insert(_el$14, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
8442
8453
  get when() {
8443
8454
  return show_breadcrumbs_();
@@ -8459,7 +8470,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8459
8470
  get children() {
8460
8471
  return $gVhhF$solidjsweb.createComponent((0, $8cceb1d3a967f369$export$466cdc317043f6cb), {
8461
8472
  quicklinks_data_: quicklinks_data_,
8462
- current_listing_id_: listing_id_,
8473
+ id_to_query_for_: id_to_query_for_,
8474
+ id_type_: id_type_,
8463
8475
  router_: router_,
8464
8476
  breadcrumb_data_: crumb_data_,
8465
8477
  i18n_: i18n_,
@@ -8513,7 +8525,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8513
8525
  sort_or_filter_open_: sort_or_filter_open_,
8514
8526
  desktop_filter_elements_: desktop_filter_elements_,
8515
8527
  content_blocks_by_row_: content_blocks_by_row_,
8516
- id_currently_querying_for_: listing_id_,
8528
+ id_currently_querying_for_: id_to_query_for_,
8517
8529
  no_results_options_: {
8518
8530
  selected_filters_: selected_filters_,
8519
8531
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -8559,7 +8571,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
8559
8571
  * Adds the current page as last breadcrumb to the breadcrumb trail
8560
8572
  */
8561
8573
  function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title) {
8562
- const href_accessor = $gVhhF$depictaiutilishared.use_href_accessor();
8574
+ const href_accessor = $gVhhF$depictaiutilisharedlatest.use_href_accessor();
8563
8575
  return $gVhhF$solidjs.createMemo(() => {
8564
8576
  const api_value = plp_meta()?.breadcrumbs;
8565
8577
  if (!api_value) return api_value;
@@ -8575,6 +8587,12 @@ function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title) {
8575
8587
  },
8576
8588
  get slug() {
8577
8589
  return plp_meta().slug;
8590
+ },
8591
+ get listing_type() {
8592
+ return plp_meta().listing_type;
8593
+ },
8594
+ get external_id() {
8595
+ return plp_meta().external_id;
8578
8596
  }
8579
8597
  }];
8580
8598
  });
@@ -8747,8 +8765,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
8747
8765
  #localization_signal = $gVhhF$solidjs.createSignal();
8748
8766
  #merchant_signal = $gVhhF$solidjs.createSignal();
8749
8767
  #market_signal = $gVhhF$solidjs.createSignal();
8750
- #listing_id_signal = $gVhhF$solidjs.createSignal("");
8751
- #meta_title_suffix_ = $gVhhF$solidjs.createSignal();
8768
+ #listing_query_signal = $gVhhF$solidjs.createSignal({});
8752
8769
  #disable_override_listing_id = $gVhhF$solidjs.createSignal();
8753
8770
  static #keys_constructed_with = /*@__PURE__*/new Set();
8754
8771
  get localization() {
@@ -8758,11 +8775,11 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
8758
8775
  set localization(locale_obj) {
8759
8776
  this.#localization_signal[1](locale_obj);
8760
8777
  }
8761
- get listing_id() {
8762
- return this.#listing_id_signal[0]();
8778
+ get listing_query() {
8779
+ return this.#listing_query_signal[0]();
8763
8780
  }
8764
- set listing_id(id) {
8765
- this.#listing_id_signal[1](id);
8781
+ set listing_query(query) {
8782
+ this.#listing_query_signal[1](query);
8766
8783
  }
8767
8784
  get merchant() {
8768
8785
  return this.#merchant_signal[0]();
@@ -8776,12 +8793,6 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
8776
8793
  set market(market) {
8777
8794
  this.#market_signal[1](market);
8778
8795
  }
8779
- get meta_title_suffix() {
8780
- return this.#meta_title_suffix_[0]();
8781
- }
8782
- set meta_title_suffix(new_suffix) {
8783
- this.#meta_title_suffix_[1](new_suffix);
8784
- }
8785
8796
  get disable_override_listing_id() {
8786
8797
  return this.#disable_override_listing_id[0]();
8787
8798
  }
@@ -8800,7 +8811,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
8800
8811
  on_navigation: on_navigation,
8801
8812
  display_transformers: display_transformers,
8802
8813
  unique_instance_key_for_state = "",
8803
- listing_id_state_key: listing_id_state_key,
8814
+ listing_query_state_key: listing_query_state_key,
8804
8815
  ...props_on_class
8805
8816
  }) {
8806
8817
  const owner = $gVhhF$solidjs.getOwner() || $gVhhF$solidjs.createRoot(() => $gVhhF$solidjs.getOwner()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
@@ -8810,7 +8821,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
8810
8821
  throw new Error("You can only have one instance of DepictCategory with the same uniqueInstanceKeyForState");
8811
8822
  Object.assign(this, props_on_class); // set initial signal values
8812
8823
  $d84fe647b84b5dc5$export$5162a71f252e6122();
8813
- this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", listing_id_state_key);
8824
+ this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", listing_query_state_key);
8814
8825
  if (on_navigation) this.#router.on_navigation_ = on_navigation;
8815
8826
  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
8816
8827
  const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
@@ -8870,14 +8881,16 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
8870
8881
  category_title: category_title
8871
8882
  } = props;
8872
8883
  const shared_properties = $48567ac5b39bac56$var$get_shared_properties(depict_category);
8884
+ const diffableListingQuery = $gVhhF$solidjs.createMemo(() => Object.values(depict_category.listing_query).join(""));
8873
8885
  return $95837413165cc2df$export$23fca46f3143581f(() => {
8874
8886
  $gVhhF$solidjs.createEffect(prev => {
8875
8887
  // 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
8876
- const id = depict_category.listing_id; // <- this is a reactive getter
8877
- $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_id_change)(id, prev);
8878
- return id;
8888
+ diffableListingQuery(); // Only re-run this effect when the listing query *actually* changes (not just the object reference)
8889
+ const newId = $gVhhF$solidjs.untrack(() => depict_category.listing_query);
8890
+ $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_query_change)(newId, prev);
8891
+ return newId;
8879
8892
  });
8880
- $gVhhF$solidjs.onCleanup(() => $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_id_change)());
8893
+ $gVhhF$solidjs.onCleanup(() => $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_query_change)());
8881
8894
  const grid_spacing_override = $gVhhF$solidjs.createMemo(() => {
8882
8895
  const {
8883
8896
  grid_spacing: grid_spacing
@@ -8918,8 +8931,8 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
8918
8931
  depict_api_: depict_api_,
8919
8932
  min_products_to_fetch_: $48567ac5b39bac56$var$min_products_to_fetch_,
8920
8933
  local_filter_cache_: local_filter_cache_,
8921
- listing_id_: $gVhhF$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_id),
8922
- meta_title_suffix_: () => depict_category.meta_title_suffix,
8934
+ id_to_query_for_: $gVhhF$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_query.id),
8935
+ id_type_: $gVhhF$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() ? $779741d0f266ea8c$export$74ee7529ce0f8a00 : depict_category.listing_query.type),
8923
8936
  i18n_: i18n_,
8924
8937
  show_quicklinks_: $gVhhF$solidjs.createMemo(() => props.show_quicklinks ?? true),
8925
8938
  category_title_: category_title,
@@ -8979,13 +8992,16 @@ function $48567ac5b39bac56$export$de035477d6fef996({
8979
8992
  sorting_query_param_: sorting_query_param_,
8980
8993
  filter_query_param_prefix_: filter_query_param_prefix_
8981
8994
  } = $48567ac5b39bac56$var$get_shared_properties(depict_category);
8995
+ const id_to_query_for_ = $gVhhF$solidjs.createMemo(() => depict_category.listing_query.id);
8996
+ const id_type_ = $gVhhF$solidjs.createMemo(() => depict_category.listing_query.type);
8982
8997
  return $gVhhF$solidjsweb.createComponent($48567ac5b39bac56$var$InExternalAreaDiv, {
8983
8998
  get children() {
8984
8999
  return $8cceb1d3a967f369$export$466cdc317043f6cb({
8985
9000
  i18n_: i18n_,
8986
9001
  quicklinks_data_: quicklinks_data_,
8987
9002
  router_: router_,
8988
- current_listing_id_: () => depict_category.listing_id,
9003
+ id_type_: id_type_,
9004
+ id_to_query_for_: id_to_query_for_,
8989
9005
  breadcrumb_data_: breadcrumb_data_,
8990
9006
  sorting_query_param_: sorting_query_param_,
8991
9007
  filter_query_param_prefix_: filter_query_param_prefix_
@@ -9182,6 +9198,7 @@ function $dae23104ba8bb78c$export$d757d54550ebfb3d({
9182
9198
  category_suggestion_: category_suggestion_,
9183
9199
  router_: router_
9184
9200
  }) {
9201
+ const parentTitle = $gVhhF$solidjs.createMemo(() => category_suggestion_().breadcrumbs.at(-1)?.title);
9185
9202
  return (() => {
9186
9203
  const _el$ = $gVhhF$solidjsweb.getNextElement($dae23104ba8bb78c$var$_tmpl$2),
9187
9204
  _el$2 = _el$.firstChild,
@@ -9197,11 +9214,11 @@ function $dae23104ba8bb78c$export$d757d54550ebfb3d({
9197
9214
  $gVhhF$solidjsweb.insert(_el$2, () => category_suggestion_().title);
9198
9215
  $gVhhF$solidjsweb.insert(_el$, $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
9199
9216
  get when() {
9200
- return typeof category_suggestion_().parent_title === "string";
9217
+ return parentTitle();
9201
9218
  },
9202
9219
  get children() {
9203
9220
  const _el$3 = $gVhhF$solidjsweb.getNextElement($dae23104ba8bb78c$var$_tmpl$);
9204
- $gVhhF$solidjsweb.insert(_el$3, () => category_suggestion_().parent_title);
9221
+ $gVhhF$solidjsweb.insert(_el$3, parentTitle);
9205
9222
  return _el$3;
9206
9223
  }
9207
9224
  }), _el$5, _co$);
@@ -10023,6 +10040,11 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
10023
10040
  }) : undefined);
10024
10041
  const href = $gVhhF$solidjs.createMemo(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
10025
10042
  const is_selected = $gVhhF$solidjs.createMemo(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
10043
+ const parent_title_if_exists = $gVhhF$solidjs.createMemo(() => {
10044
+ const item = input_obj();
10045
+ if (!("breadcrumbs" in item)) return;
10046
+ return item.breadcrumbs.at(-1)?.title;
10047
+ });
10026
10048
  return (() => {
10027
10049
  const _el$ = $gVhhF$solidjsweb.getNextElement($6b65ba8af12c5a26$var$_tmpl$);
10028
10050
  $gVhhF$solidjsweb.use(element => element.addEventListener("click", $gVhhF$depictaiutilishared.catchify(ev => {
@@ -10064,7 +10086,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
10064
10086
  },
10065
10087
  searching_for_value_: searching_for_value_
10066
10088
  })] : [$gVhhF$solidjsweb.memo((() => {
10067
- const _c$2 = $gVhhF$solidjsweb.memo(() => typeof input_obj() /* this is a harmless lie */.parent_title === "string");
10089
+ const _c$2 = $gVhhF$solidjsweb.memo(() => !!parent_title_if_exists());
10068
10090
  return () => _c$2() ? (() => {
10069
10091
  const _el$4 = $gVhhF$solidjsweb.getNextElement($6b65ba8af12c5a26$var$_tmpl$4),
10070
10092
  _el$6 = _el$4.firstChild,
@@ -10077,7 +10099,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
10077
10099
  },
10078
10100
  searching_for_value_: searching_for_value_
10079
10101
  }), _el$7, _co$);
10080
- $gVhhF$solidjsweb.insert(_el$5, () => input_obj().parent_title);
10102
+ $gVhhF$solidjsweb.insert(_el$5, parent_title_if_exists);
10081
10103
  return _el$4;
10082
10104
  })() : (() => {
10083
10105
  const _c$3 = $gVhhF$solidjsweb.memo(() => input_obj().type === "content");
@@ -10111,7 +10133,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
10111
10133
  const _el$3 = $gVhhF$solidjsweb.getNextElement($6b65ba8af12c5a26$var$_tmpl$3);
10112
10134
  $gVhhF$solidjsweb.insert(_el$3, $gVhhF$solidjs.createMemo(() => {
10113
10135
  if (input_obj().type === "content") return i18n_.content_();
10114
- if (input_obj().category_type === "BRAND") return i18n_.brand_();
10136
+ if (input_obj().listing_type === "brand") return i18n_.brand_();
10115
10137
  return i18n_.category_();
10116
10138
  }));
10117
10139
  return _el$3;
@@ -10371,7 +10393,7 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
10371
10393
  url.searchParams.set(search_query_param_name_, title);
10372
10394
  return $b8700779b3e745de$export$1efe1013da60d0e4(e, url.href);
10373
10395
  }));
10374
- } else if (selected_entry?.type == "category" || selected_entry?.type === "content") $gVhhF$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
10396
+ } else if (selected_entry?.type == "listing" || selected_entry?.type === "content") $gVhhF$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
10375
10397
  const {
10376
10398
  page_url: page_url
10377
10399
  } = selected_entry;
@@ -10896,7 +10918,7 @@ function $04048c1bef16c249$export$c05a196222ba1302({
10896
10918
  suggestions_: suggestions_,
10897
10919
  children: children
10898
10920
  }) {
10899
- const category_suggestions_ = $gVhhF$solidjs.createMemo(() => suggestions_()?.suggestions.filter(s => s.type === "category"));
10921
+ const category_suggestions_ = $gVhhF$solidjs.createMemo(() => suggestions_()?.suggestions.filter(s => s.type === "listing"));
10900
10922
  return $gVhhF$solidjsweb.createComponent((0, $gVhhF$solidjs.Show), {
10901
10923
  get when() {
10902
10924
  return category_suggestions_()?.length || suggestions_.loading;