@depict-ai/ui 3.0.3 → 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.
@@ -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.3";
80
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "3.0.4";
81
81
  const $0f313083912e447a$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>'];
82
82
  function $0f313083912e447a$export$8be2714ec7f169ee(props = {}) {
83
83
  return $5vyXB$solidjsweb.ssr($0f313083912e447a$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.ssrAttribute("width", $5vyXB$solidjsweb.escape(props.width_, true) ?? 14, false) + $5vyXB$solidjsweb.ssrAttribute("height", $5vyXB$solidjsweb.escape(props.height_, true) ?? 26, false));
@@ -439,7 +439,7 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
439
439
  event_: event_,
440
440
  force_spa_navigation_: force_spa_navigation_,
441
441
  is_replace_: is_replace_,
442
- listing_id_: listing_id_,
442
+ listing_query_: listing_query_,
443
443
  scroll = true
444
444
  }) => {
445
445
  const new_url_ = raw_new_url instanceof URL ? raw_new_url : new URL(raw_new_url, location.origin);
@@ -460,10 +460,10 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
460
460
  if (force_spa_navigation_ && wants_hard_navigation) {
461
461
  // Don't allow hard navigation if we're forcing SPA navigation, which we do for things where PageReplacer can be used for performance
462
462
  const new_state = history.state;
463
- if (listing_id_) {
463
+ if (listing_query_) {
464
464
  // In JS-UI we need to know the listing_id of the current category, therefore push it into state
465
- if (!this.listing_id_state_key) $5vyXB$depictaiutilishared.report(new Error("listing_id_state_key is not set"), "error");
466
- new_state[this.listing_id_state_key] = listing_id_;
465
+ if (!this.listing_query_state_key) $5vyXB$depictaiutilishared.report(new Error("listing_query_state_key is not set"), "error");
466
+ new_state[this.listing_query_state_key] = listing_query_;
467
467
  }
468
468
  history[is_replace_ ? "replaceState" : "pushState"](new_state, "", new_url_);
469
469
  } else this.#throwing_on_navigation.call(this, {
@@ -474,8 +474,8 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
474
474
  await promise;
475
475
  })
476
476
  };
477
- constructor(on_navigation, listing_id_state_key) {
478
- this.listing_id_state_key = listing_id_state_key;
477
+ constructor(on_navigation, listing_query_state_key) {
478
+ this.listing_query_state_key = listing_query_state_key;
479
479
  this.on_navigation_ = on_navigation;
480
480
  }
481
481
  }
@@ -4450,6 +4450,8 @@ function $67dc366d96177e70$export$967e966fca9515e(api_response) {
4450
4450
  }
4451
4451
  return api_response;
4452
4452
  }
4453
+ const $779741d0f266ea8c$export$74ee7529ce0f8a00 = "listingId";
4454
+ const $779741d0f266ea8c$export$5aae649db1b959fc = "externalId";
4453
4455
  const $e1d6c0f3d89d531c$var$v3_base_url = (0, $5vyXB$depictaiutilishared.base_url) + "/v3/";
4454
4456
  const $e1d6c0f3d89d531c$var$search_base_url = $e1d6c0f3d89d531c$var$v3_base_url + "search/";
4455
4457
  class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
@@ -4479,7 +4481,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
4479
4481
  const category_transformer = this.display_transformers?.categories;
4480
4482
  if (!category_transformer) return response;
4481
4483
  // find category suggestions, run thing with them, and then replace them
4482
- const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
4484
+ const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "listing");
4483
4485
  const transformed_category_suggestions = await category_transformer({
4484
4486
  market: market,
4485
4487
  merchant: merchant,
@@ -4529,8 +4531,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
4529
4531
  endpoint_: endpoint_,
4530
4532
  input_req_: input_req_,
4531
4533
  fallback_response_: fallback_response_,
4532
- method_ = "POST",
4533
- delete_key_before_sending_: delete_key_before_sending_ // only supported for GET requests
4534
+ method_ = "POST"
4534
4535
  }) {
4535
4536
  const cache_obj = this.#get_cache_obj_for_endpoint(endpoint_);
4536
4537
  const with_ids = this.#add_ids_to_request(input_req_);
@@ -4548,7 +4549,6 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
4548
4549
  cache_obj.in_progress_[body] = new Promise(r => resolve_in_progress = r);
4549
4550
  try {
4550
4551
  const is_post = method_ === "POST";
4551
- if (!is_post && delete_key_before_sending_) delete sorted_request[delete_key_before_sending_];
4552
4552
  const url_to_request = is_post ? endpoint_ : $5vyXB$depictaiutilishared.make_url_with_query_params(endpoint_, sorted_request);
4553
4553
  const api_response = await $5vyXB$depictaiutilishared.fetch_retry($5vyXB$depictaiutilishared.add_version_query_params(url_to_request), {
4554
4554
  method: method_,
@@ -4636,9 +4636,13 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
4636
4636
  })
4637
4637
  });
4638
4638
  }
4639
- async get_listing(input_req) {
4639
+ async get_listing({
4640
+ id_type_: id_type_,
4641
+ id_to_query_for_: id_to_query_for_,
4642
+ ...input_req
4643
+ }) {
4640
4644
  return await this.#cached_request({
4641
- endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + encodeURIComponent(input_req.listing_id),
4645
+ endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_),
4642
4646
  input_req_: input_req,
4643
4647
  fallback_response_: () => ({
4644
4648
  listing_id: "",
@@ -4652,20 +4656,17 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
4652
4656
  "quick_links": [],
4653
4657
  failed: true
4654
4658
  }),
4655
- method_: "GET",
4656
- 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
4659
+ method_: "GET"
4657
4660
  });
4658
4661
  }
4659
-
4660
- async get_listing_products(input_req) {
4661
- const listing_id = input_req.listing_id; // listing_id goes into the path
4662
- const cloned_request = {
4663
- ...input_req
4664
- };
4665
- delete cloned_request["listing_id"];
4662
+ async get_listing_products({
4663
+ id_to_query_for_: id_to_query_for_,
4664
+ id_type_: id_type_,
4665
+ ...input_req_
4666
+ }) {
4666
4667
  return await this.#cached_request({
4667
- endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + encodeURIComponent(listing_id) + "/products",
4668
- input_req_: input_req,
4668
+ endpoint_: $e1d6c0f3d89d531c$var$v3_base_url + "listings/" + (id_type_ === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id/" : "") + encodeURIComponent(id_to_query_for_) + "/products",
4669
+ input_req_: input_req_,
4669
4670
  fallback_response_: () => ({
4670
4671
  "n_hits": 0,
4671
4672
  "displays": [],
@@ -4966,7 +4967,7 @@ function $3f08fe2992a2a8ca$export$5e4aed86c12acdd9({
4966
4967
  // After first load, always just load 20 since people might just be browsing the top ones still
4967
4968
  min_products_to_fetch_ : now - last_loaded < 10000 ? min_products_to_fetch_ * 5 : min_products_to_fetch_;
4968
4969
  // dlog("loading ", number_of_results_to_load, "products, because it was", now - last_loaded, "ms since last load");
4969
- const api_response = await depict_api_["listing_id" in base_part ? "get_listing_products" : "query"]({
4970
+ const api_response = await depict_api_["query" in base_part ? "query" : "get_listing_products"]({
4970
4971
  cursor: get_last_cursor(),
4971
4972
  limit: number_of_results_to_load,
4972
4973
  ...base_part
@@ -6258,11 +6259,12 @@ const $8cceb1d3a967f369$var$_tmpl$ = ["<nav", ' class="quicklinks"', ">", "</nav
6258
6259
  function $8cceb1d3a967f369$export$466cdc317043f6cb({
6259
6260
  quicklinks_data_: quicklinks_data_,
6260
6261
  router_: router_,
6261
- current_listing_id_: current_listing_id_,
6262
+ id_to_query_for_: id_to_query_for_,
6262
6263
  breadcrumb_data_: breadcrumb_data_,
6263
6264
  i18n_: i18n_,
6264
6265
  sorting_query_param_: sorting_query_param_,
6265
- filter_query_param_prefix_: filter_query_param_prefix_
6266
+ filter_query_param_prefix_: filter_query_param_prefix_,
6267
+ id_type_: id_type_
6266
6268
  }) {
6267
6269
  let scrolling_logic_ran_for_listing_id = false;
6268
6270
  let last_scroll_position;
@@ -6270,11 +6272,11 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
6270
6272
  let last_was_placeholder = false;
6271
6273
  let sliding_element;
6272
6274
  $5vyXB$solidjs.createComputed(() => {
6273
- current_listing_id_();
6275
+ id_to_query_for_();
6274
6276
  scrolling_logic_ran_for_listing_id = false;
6275
6277
  });
6276
6278
  const place_holdey_quicklinks_data = $5vyXB$solidjs.createMemo(() => quicklinks_data_() || [,,,]);
6277
- const selected_index = $5vyXB$solidjs.createMemo(() => quicklinks_data_()?.findIndex(item => item.listing_id === current_listing_id_())); // this will be -1 when viewing child categories
6279
+ const selected_index = $5vyXB$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
6278
6280
  const scrollpos_per_listing_id = {};
6279
6281
  const mutation_plugins = [function () {
6280
6282
  if (!scrolling_logic_ran_for_listing_id) return;
@@ -6283,7 +6285,7 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
6283
6285
  } = this.insert_here;
6284
6286
  if (scrollLeft > 0) {
6285
6287
  last_scroll_position = scrollLeft;
6286
- const current_id = $5vyXB$solidjs.untrack(current_listing_id_);
6288
+ const current_id = $5vyXB$solidjs.untrack(id_to_query_for_);
6287
6289
  // make sure to not save position where selected item isn't in viewport
6288
6290
  const current_selected_index = $5vyXB$solidjs.untrack(selected_index);
6289
6291
  const intersecting_thing = this.intersecting_items_object[current_selected_index];
@@ -6345,7 +6347,7 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
6345
6347
  equals: false
6346
6348
  }), new_data => {
6347
6349
  const quicklinks_data = quicklinks_data_(); // this signal should have updated by now since this is a createEffect
6348
- const current_id = current_listing_id_();
6350
+ const current_id = id_to_query_for_();
6349
6351
  if (!new_data || !quicklinks_data || !current_id) return;
6350
6352
  const owner = $5vyXB$solidjs.getOwner();
6351
6353
  queueMicrotask(() => {
@@ -6393,10 +6395,9 @@ function $8cceb1d3a967f369$export$466cdc317043f6cb({
6393
6395
  // Problem: When you don't open a link in a new tab, we don't display the filter cleared toast
6394
6396
  // 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
6395
6397
  const is_sibling = $5vyXB$solidjs.createMemo(() => {
6396
- const current_id = current_listing_id_();
6397
- return quicklinks_data_()?.some(({
6398
- listing_id: listing_id
6399
- }) => listing_id === current_id);
6398
+ const current_id = id_to_query_for_();
6399
+ const lookForId = id_type_() === $779741d0f266ea8c$export$5aae649db1b959fc ? "external_id" : "listing_id";
6400
+ return quicklinks_data_()?.some(quickLink => quickLink[lookForId] === current_id);
6400
6401
  });
6401
6402
  const href = $5vyXB$solidjs.createMemo(() =>
6402
6403
  // 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
@@ -6604,13 +6605,14 @@ function $47e2cc552c02110c$export$8895d39404bd2bb1(props) {
6604
6605
  }
6605
6606
  function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
6606
6607
  crumb_data_: crumb_data_,
6607
- listing_id_: listing_id_,
6608
+ id_to_query_for_: id_to_query_for_,
6608
6609
  i18n_: i18n_,
6609
6610
  selected_filters_: selected_filters_,
6610
6611
  local_filter_cache_: local_filter_cache_,
6611
6612
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6612
6613
  plp_results_: plp_results_,
6613
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6614
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6615
+ id_type_: id_type_
6614
6616
  }) {
6615
6617
  // If we just got opened in a new tab, clear filters instantly and remove the flag
6616
6618
  $ef972f5c10b1c5b4$var$clear_if_opened_new_tab_with_sideways_url_params_flag({
@@ -6621,17 +6623,21 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
6621
6623
  i18n_: i18n_,
6622
6624
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6623
6625
  });
6624
- // Code below is for when we're already open and the user navigates to a new category
6626
+ // The code below is for when we're already open and the user navigates to a new category
6625
6627
  let previous_crumb_data = $5vyXB$solidjs.untrack(crumb_data_);
6626
- let listing_id_when_we_got_previous_data = $5vyXB$solidjs.untrack(listing_id_);
6628
+ let id_when_we_got_previous_data = {
6629
+ id_: $5vyXB$solidjs.untrack(id_to_query_for_),
6630
+ type_: $5vyXB$solidjs.untrack(id_type_)
6631
+ };
6627
6632
  let allow_filter_clearing = true; // set to false when going backwards/forwards
6628
6633
  // temporarily disable filter clearing when going backwards/forwards
6629
6634
  const handler = () => allow_filter_clearing = false;
6630
6635
  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
6631
6636
  $5vyXB$solidjs.onCleanup(() => window.removeEventListener("popstate", handler));
6632
6637
  $5vyXB$solidjs.createEffect($5vyXB$solidjs.on(crumb_data_, $5vyXB$depictaiutilishared.catchify(new_crumb_data => {
6633
- const listing_id_of_new_data = listing_id_();
6634
- if (allow_filter_clearing && previous_crumb_data && new_crumb_data && listing_id_of_new_data !== listing_id_when_we_got_previous_data) {
6638
+ const id_of_new_data = id_to_query_for_();
6639
+ const type_of_id_of_new_data = id_type_();
6640
+ 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_)) {
6635
6641
  const previous_length = previous_crumb_data.length;
6636
6642
  const new_length = new_crumb_data.length;
6637
6643
  const went_upwards = new_length < previous_length;
@@ -6654,7 +6660,10 @@ function $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
6654
6660
  sideways_filter_clearing_flag_[1](false);
6655
6661
  }
6656
6662
  }
6657
- listing_id_when_we_got_previous_data = listing_id_of_new_data;
6663
+ id_when_we_got_previous_data = {
6664
+ id_: id_of_new_data,
6665
+ type_: type_of_id_of_new_data
6666
+ };
6658
6667
  previous_crumb_data = new_crumb_data;
6659
6668
  if (!allow_filter_clearing) allow_filter_clearing = true;
6660
6669
  })));
@@ -6717,8 +6726,8 @@ const $840d88a04b2d22a7$var$_tmpl$ = ["<div", ' class="product-count"><!--$-->',
6717
6726
  $840d88a04b2d22a7$var$_tmpl$4 = ["<div", ' class="depict plp category"><div class="listing-page"><!--$-->', "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--><!--$-->", "<!--/--></div><!--$-->", "<!--/--><!--$-->", "<!--/--></div>"];
6718
6727
  function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6719
6728
  depict_api_: depict_api_,
6720
- listing_id_: listing_id_,
6721
- meta_title_suffix_: meta_title_suffix_,
6729
+ id_to_query_for_: id_to_query_for_,
6730
+ id_type_: id_type_,
6722
6731
  current_sorting_: current_sorting_,
6723
6732
  min_products_to_fetch_: min_products_to_fetch_,
6724
6733
  category_filters_open_: category_filters_open_,
@@ -6771,7 +6780,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6771
6780
  merchant: merchant_(),
6772
6781
  market: market_(),
6773
6782
  locale: backend_locale_(),
6774
- listing_id: listing_id_(),
6783
+ id_to_query_for_: id_to_query_for_(),
6784
+ id_type_: id_type_(),
6775
6785
  ...(f.length ? {
6776
6786
  filters: f
6777
6787
  } : {}),
@@ -6783,8 +6793,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6783
6793
  // Make "Get products in listing" request to get products in listing
6784
6794
  const [plp_products_] = $5vyXB$solidjs.createResource(products_query_base_,
6785
6795
  // 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)
6786
- $5vyXB$depictaiutilishared.catchify(base_query => $276380e4607fb9fb$export$cc42dd29bf655ab6({
6787
- id_: $5vyXB$solidjs.untrack(listing_id_),
6796
+ $5vyXB$depictaiutilisharedlatest.catchify(base_query => $276380e4607fb9fb$export$cc42dd29bf655ab6({
6797
+ id_: $5vyXB$solidjs.untrack(id_to_query_for_),
6788
6798
  scroll_restoration_data_: scroll_restoration_data_,
6789
6799
  min_products_to_fetch_: min_products_to_fetch_,
6790
6800
  make_request_: (limit, cursor) => depict_api_.get_listing_products({
@@ -6799,10 +6809,11 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6799
6809
  merchant: merchant_(),
6800
6810
  market: market_(),
6801
6811
  locale: backend_locale_(),
6802
- listing_id: listing_id_()
6812
+ id_to_query_for_: id_to_query_for_(),
6813
+ id_type_: id_type_()
6803
6814
  }));
6804
6815
  // Make "Get Listing" request to get quicklinks, breadcrumbs, title, etc
6805
- const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilishared.catchify(query => depict_api_.get_listing(query)));
6816
+ const [plp_meta] = $5vyXB$solidjs.createResource(meta_query_base, $5vyXB$depictaiutilisharedlatest.catchify(query => depict_api_.get_listing(query)));
6806
6817
  const available_sortings_ = $5vyXB$solidjs.createMemo(() => plp_products_()?.sorts?.map(sort => ({
6807
6818
  ...sort,
6808
6819
  order: sort.order ?? "desc"
@@ -6811,13 +6822,6 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6811
6822
  const title = $5vyXB$solidjs.createMemo(() => plp_meta()?.title);
6812
6823
  const crumb_data_ = $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title);
6813
6824
  const quicklinks_data_ = $5vyXB$solidjs.createMemo(() => plp_meta()?.quick_links);
6814
- const meta_tag_data_ = $5vyXB$solidjs.createMemo(() => {
6815
- if (plp_meta()?.replace_meta_tags) return {
6816
- title: plp_meta()?.title + (meta_title_suffix_() || ""),
6817
- description: plp_meta()?.description
6818
- };
6819
- });
6820
- $5vyXB$depictaiutilishared.edit_current_page_meta_tags(meta_tag_data_);
6821
6825
  const [sort_or_filter_open_, set_sort_or_filter_open_] = $5vyXB$solidjs.createSignal(false);
6822
6826
  const [desktop_filter_elements_, set_desktop_filter_elements] = $5vyXB$solidjs.createSignal();
6823
6827
  const formatted_number_of_results_ = $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
@@ -6877,7 +6881,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6877
6881
  }));
6878
6882
  results_for = make_product_count_();
6879
6883
  } else {
6880
- $5vyXB$depictaiutilishared.report(new Error("Unrecognised category_title_type, UI will look messed up"), "error");
6884
+ $5vyXB$depictaiutilisharedlatest.report(new Error("Unrecognised category_title_type, UI will look messed up"), "error");
6881
6885
  results_for = $5vyXB$solidjsweb.ssr($840d88a04b2d22a7$var$_tmpl$2, $5vyXB$solidjsweb.ssrHydrationKey());
6882
6886
  }
6883
6887
  const filters_opener = $f8f64d05c525825b$export$d7841e452f2e59a8({
@@ -6899,17 +6903,17 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6899
6903
  number_of_rendered_selected_filters_items_: number_of_rendered_selected_filters_items_,
6900
6904
  ...extra_sort_and_filter_args_
6901
6905
  });
6902
- $5vyXB$depictaiutilishared.catchify((0, $276380e4607fb9fb$export$6e49da55e449af7c))({
6906
+ $5vyXB$depictaiutilisharedlatest.catchify((0, $276380e4607fb9fb$export$6e49da55e449af7c))({
6903
6907
  scroll_restoration_data_: scroll_restoration_data_,
6904
6908
  last_result_in_viewport_: last_result_in_viewport_,
6905
- id_: listing_id_,
6909
+ id_: id_to_query_for_,
6906
6910
  can_write_scroll_restoration_: can_write_scroll_restoration_
6907
6911
  });
6908
6912
  on_filters_constructed_?.();
6909
6913
  $5vyXB$solidjs.createComputed(() => {
6910
6914
  if (plp_products_.loading) set_can_write_scroll_restoration(false);else if (plp_products_()) set_can_write_scroll_restoration(true);
6911
6915
  });
6912
- $5vyXB$solidjs.createRenderEffect($5vyXB$depictaiutilishared.catchify(async () => {
6916
+ $5vyXB$solidjs.createRenderEffect($5vyXB$depictaiutilisharedlatest.catchify(async () => {
6913
6917
  const slim = is_slim_();
6914
6918
  const only_show_filters_opener = only_show_filters_opener_?.();
6915
6919
  const owner = $5vyXB$solidjs.getOwner();
@@ -6922,14 +6926,15 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6922
6926
  available_filters_: available_filters_
6923
6927
  });
6924
6928
  $ef972f5c10b1c5b4$export$3945d6db2dfd3d12({
6925
- listing_id_: listing_id_,
6929
+ id_to_query_for_: id_to_query_for_,
6926
6930
  crumb_data_: crumb_data_,
6927
6931
  i18n_: i18n_,
6928
6932
  selected_filters_: selected_filters_,
6929
6933
  local_filter_cache_: local_filter_cache_,
6930
6934
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6931
6935
  plp_results_: plp_products_,
6932
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6936
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6937
+ id_type_: id_type_
6933
6938
  });
6934
6939
  get_breadcrumb_accessor_?.(crumb_data_);
6935
6940
  get_quicklinks_accessor_?.(quicklinks_data_);
@@ -6953,7 +6958,8 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
6953
6958
  get children() {
6954
6959
  return $5vyXB$solidjsweb.createComponent((0, $8cceb1d3a967f369$export$466cdc317043f6cb), {
6955
6960
  quicklinks_data_: quicklinks_data_,
6956
- current_listing_id_: listing_id_,
6961
+ id_to_query_for_: id_to_query_for_,
6962
+ id_type_: id_type_,
6957
6963
  router_: router_,
6958
6964
  breadcrumb_data_: crumb_data_,
6959
6965
  i18n_: i18n_,
@@ -7003,7 +7009,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
7003
7009
  sort_or_filter_open_: sort_or_filter_open_,
7004
7010
  desktop_filter_elements_: desktop_filter_elements_,
7005
7011
  content_blocks_by_row_: content_blocks_by_row_,
7006
- id_currently_querying_for_: listing_id_,
7012
+ id_currently_querying_for_: id_to_query_for_,
7007
7013
  no_results_options_: {
7008
7014
  selected_filters_: selected_filters_,
7009
7015
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
@@ -7044,7 +7050,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
7044
7050
  * Adds the current page as last breadcrumb to the breadcrumb trail
7045
7051
  */
7046
7052
  function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title) {
7047
- const href_accessor = $5vyXB$depictaiutilishared.use_href_accessor();
7053
+ const href_accessor = $5vyXB$depictaiutilisharedlatest.use_href_accessor();
7048
7054
  return $5vyXB$solidjs.createMemo(() => {
7049
7055
  const api_value = plp_meta()?.breadcrumbs;
7050
7056
  if (!api_value) return api_value;
@@ -7060,6 +7066,12 @@ function $840d88a04b2d22a7$var$add_us_to_crumbs(plp_meta, title) {
7060
7066
  },
7061
7067
  get slug() {
7062
7068
  return plp_meta().slug;
7069
+ },
7070
+ get listing_type() {
7071
+ return plp_meta().listing_type;
7072
+ },
7073
+ get external_id() {
7074
+ return plp_meta().external_id;
7063
7075
  }
7064
7076
  }];
7065
7077
  });
@@ -7227,8 +7239,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
7227
7239
  #localization_signal = $5vyXB$solidjs.createSignal();
7228
7240
  #merchant_signal = $5vyXB$solidjs.createSignal();
7229
7241
  #market_signal = $5vyXB$solidjs.createSignal();
7230
- #listing_id_signal = $5vyXB$solidjs.createSignal("");
7231
- #meta_title_suffix_ = $5vyXB$solidjs.createSignal();
7242
+ #listing_query_signal = $5vyXB$solidjs.createSignal({});
7232
7243
  #disable_override_listing_id = $5vyXB$solidjs.createSignal();
7233
7244
  static #keys_constructed_with = /*@__PURE__*/new Set();
7234
7245
  get localization() {
@@ -7238,11 +7249,11 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
7238
7249
  set localization(locale_obj) {
7239
7250
  this.#localization_signal[1](locale_obj);
7240
7251
  }
7241
- get listing_id() {
7242
- return this.#listing_id_signal[0]();
7252
+ get listing_query() {
7253
+ return this.#listing_query_signal[0]();
7243
7254
  }
7244
- set listing_id(id) {
7245
- this.#listing_id_signal[1](id);
7255
+ set listing_query(query) {
7256
+ this.#listing_query_signal[1](query);
7246
7257
  }
7247
7258
  get merchant() {
7248
7259
  return this.#merchant_signal[0]();
@@ -7256,12 +7267,6 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
7256
7267
  set market(market) {
7257
7268
  this.#market_signal[1](market);
7258
7269
  }
7259
- get meta_title_suffix() {
7260
- return this.#meta_title_suffix_[0]();
7261
- }
7262
- set meta_title_suffix(new_suffix) {
7263
- this.#meta_title_suffix_[1](new_suffix);
7264
- }
7265
7270
  get disable_override_listing_id() {
7266
7271
  return this.#disable_override_listing_id[0]();
7267
7272
  }
@@ -7280,7 +7285,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
7280
7285
  on_navigation: on_navigation,
7281
7286
  display_transformers: display_transformers,
7282
7287
  unique_instance_key_for_state = "",
7283
- listing_id_state_key: listing_id_state_key,
7288
+ listing_query_state_key: listing_query_state_key,
7284
7289
  ...props_on_class
7285
7290
  }) {
7286
7291
  const owner = $5vyXB$solidjs.getOwner() || $5vyXB$solidjs.createRoot(() => $5vyXB$solidjs.getOwner()); // we might have an owner, if so, pass it on. Otherwise, create one so solid doesn't print warnings to the console
@@ -7290,7 +7295,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
7290
7295
  throw new Error("You can only have one instance of DepictCategory with the same uniqueInstanceKeyForState");
7291
7296
  Object.assign(this, props_on_class); // set initial signal values
7292
7297
  $d84fe647b84b5dc5$export$5162a71f252e6122();
7293
- this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", listing_id_state_key);
7298
+ this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", listing_query_state_key);
7294
7299
  if (on_navigation) this.#router.on_navigation_ = on_navigation;
7295
7300
  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
7296
7301
  const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
@@ -7350,14 +7355,16 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
7350
7355
  category_title: category_title
7351
7356
  } = props;
7352
7357
  const shared_properties = $48567ac5b39bac56$var$get_shared_properties(depict_category);
7358
+ const diffableListingQuery = $5vyXB$solidjs.createMemo(() => Object.values(depict_category.listing_query).join(""));
7353
7359
  return $95837413165cc2df$export$23fca46f3143581f(() => {
7354
7360
  $5vyXB$solidjs.createEffect(prev => {
7355
7361
  // 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
7356
- const id = depict_category.listing_id; // <- this is a reactive getter
7357
- $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_id_change)(id, prev);
7358
- return id;
7362
+ diffableListingQuery(); // Only re-run this effect when the listing query *actually* changes (not just the object reference)
7363
+ const newId = $5vyXB$solidjs.untrack(() => depict_category.listing_query);
7364
+ $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_query_change)(newId, prev);
7365
+ return newId;
7359
7366
  });
7360
- $5vyXB$solidjs.onCleanup(() => $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_id_change)());
7367
+ $5vyXB$solidjs.onCleanup(() => $deaaf04362a1bc71$export$f50b88e2a00918b5(props.on_listing_query_change)());
7361
7368
  const grid_spacing_override = $5vyXB$solidjs.createMemo(() => {
7362
7369
  const {
7363
7370
  grid_spacing: grid_spacing
@@ -7398,8 +7405,8 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
7398
7405
  depict_api_: depict_api_,
7399
7406
  min_products_to_fetch_: $48567ac5b39bac56$var$min_products_to_fetch_,
7400
7407
  local_filter_cache_: local_filter_cache_,
7401
- listing_id_: $5vyXB$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_id),
7402
- meta_title_suffix_: () => depict_category.meta_title_suffix,
7408
+ id_to_query_for_: $5vyXB$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() || depict_category.listing_query.id),
7409
+ id_type_: $5vyXB$solidjs.createMemo(() => !depict_category.disable_override_listing_id && override_listing_id_accessor_() ? $779741d0f266ea8c$export$74ee7529ce0f8a00 : depict_category.listing_query.type),
7403
7410
  i18n_: i18n_,
7404
7411
  show_quicklinks_: $5vyXB$solidjs.createMemo(() => props.show_quicklinks ?? true),
7405
7412
  category_title_: category_title,
@@ -7459,13 +7466,16 @@ function $48567ac5b39bac56$export$de035477d6fef996({
7459
7466
  sorting_query_param_: sorting_query_param_,
7460
7467
  filter_query_param_prefix_: filter_query_param_prefix_
7461
7468
  } = $48567ac5b39bac56$var$get_shared_properties(depict_category);
7469
+ const id_to_query_for_ = $5vyXB$solidjs.createMemo(() => depict_category.listing_query.id);
7470
+ const id_type_ = $5vyXB$solidjs.createMemo(() => depict_category.listing_query.type);
7462
7471
  return $5vyXB$solidjsweb.createComponent($48567ac5b39bac56$var$InExternalAreaDiv, {
7463
7472
  get children() {
7464
7473
  return $8cceb1d3a967f369$export$466cdc317043f6cb({
7465
7474
  i18n_: i18n_,
7466
7475
  quicklinks_data_: quicklinks_data_,
7467
7476
  router_: router_,
7468
- current_listing_id_: () => depict_category.listing_id,
7477
+ id_type_: id_type_,
7478
+ id_to_query_for_: id_to_query_for_,
7469
7479
  breadcrumb_data_: breadcrumb_data_,
7470
7480
  sorting_query_param_: sorting_query_param_,
7471
7481
  filter_query_param_prefix_: filter_query_param_prefix_
@@ -8231,7 +8241,7 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
8231
8241
  searching_for_value_: searching_for_value_
8232
8242
  }), $5vyXB$solidjsweb.ssr($6b65ba8af12c5a26$var$_tmpl$3, $5vyXB$solidjsweb.ssrHydrationKey(), $5vyXB$solidjsweb.escape($5vyXB$solidjs.createMemo(() => {
8233
8243
  if (input_obj().type === "content") return i18n_.content_();
8234
- if (input_obj().category_type === "brand") return i18n_.brand_();
8244
+ if (input_obj().listing_type === "brand") return i18n_.brand_();
8235
8245
  return i18n_.category_();
8236
8246
  })()))]));
8237
8247
  };
@@ -8446,7 +8456,7 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
8446
8456
  url.searchParams.set(search_query_param_name_, title);
8447
8457
  return $b8700779b3e745de$export$1efe1013da60d0e4(e, url.href);
8448
8458
  }));
8449
- } else if (selected_entry?.type == "category" || selected_entry?.type === "content") $5vyXB$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
8459
+ } else if (selected_entry?.type == "listing" || selected_entry?.type === "content") $5vyXB$solidjs.runWithOwner(owner, () => override_on_enter_for_this_entry(e => {
8450
8460
  const {
8451
8461
  page_url: page_url
8452
8462
  } = selected_entry;
@@ -8900,7 +8910,7 @@ function $04048c1bef16c249$export$c05a196222ba1302({
8900
8910
  suggestions_: suggestions_,
8901
8911
  children: children
8902
8912
  }) {
8903
- const category_suggestions_ = $5vyXB$solidjs.createMemo(() => suggestions_()?.suggestions.filter(s => s.type === "category"));
8913
+ const category_suggestions_ = $5vyXB$solidjs.createMemo(() => suggestions_()?.suggestions.filter(s => s.type === "listing"));
8904
8914
  return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
8905
8915
  get when() {
8906
8916
  return category_suggestions_()?.length || suggestions_.loading;