@depict-ai/ui 1.4.10 → 1.4.12

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.
@@ -54,7 +54,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
54
54
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
55
55
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
56
56
  /*! Depict.ai search and product listing SDK */
57
- const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.10";
57
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.12";
58
58
  function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
59
59
  const {
60
60
  collapse: collapse,
@@ -4562,11 +4562,10 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
4562
4562
  const crumb_data_ = (0, $5vyXB$solidjs.createMemo)(() => plp_results_()?.breadcrumb);
4563
4563
  const quicklinks_data_ = (0, $5vyXB$solidjs.createMemo)(() => plp_results_()?.quick_links);
4564
4564
  const meta_tag_data_ = (0, $5vyXB$solidjs.createMemo)(() => {
4565
- meta_title_suffix_();
4566
- return plp_results_()?.metadata?.replace_meta_tags ? {
4565
+ if (plp_results_()?.metadata?.replace_meta_tags) return {
4567
4566
  title: plp_results_()?.metadata?.title + (meta_title_suffix_() || ""),
4568
4567
  description: plp_results_()?.metadata?.description
4569
- } : null;
4568
+ };
4570
4569
  });
4571
4570
  (0, $5vyXB$depictaiutilishared.edit_current_page_meta_tags)(meta_tag_data_);
4572
4571
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $5vyXB$solidjs.createSignal)(false);
@@ -4856,8 +4855,12 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
4856
4855
  const router_ = options.router_;
4857
4856
  const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
4858
4857
  const search_query_ = search_query_url_param_name_ ? (0, $5vyXB$solidjs.createSignal)("") : undefined;
4858
+ const override_query_id_query_param_names_ = "override_query_id_query_param_names_" in options ? options.override_query_id_query_param_names_ : undefined;
4859
+ const override_query_id_ = override_query_id_query_param_names_ ? (0, $5vyXB$solidjs.createSignal)(null) : undefined;
4859
4860
  const get_search_query_ = search_query_?.[0];
4860
4861
  const set_search_query = search_query_?.[1];
4862
+ const get_override_query_id_ = override_query_id_?.[0];
4863
+ const set_override_query_id = override_query_id_?.[1];
4861
4864
  const current_sorting_ = (0, $5vyXB$solidjs.createSignal)();
4862
4865
  const selected_filters_ = (0, $5vyXB$solidjs.createSignal)([]);
4863
4866
  const sideways_filter_clearing_flag_ = (0, $5vyXB$solidjs.createSignal)(false);
@@ -4902,6 +4905,12 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
4902
4905
  const found_query = searchParams.get(search_query_url_param_name_);
4903
4906
  set_search_query(found_query || "");
4904
4907
  }
4908
+ if (override_query_id_query_param_names_) {
4909
+ const found_override_query_id = override_query_id_query_param_names_.map(n => searchParams.get(n)).find(n => n);
4910
+ set_override_query_id(found_override_query_id || null);
4911
+ if (found_override_query_id) (0, $5vyXB$depictaiutilishared.dlog)("Found override query id:", found_override_query_id); // This stuff might get confusing so better log it
4912
+ }
4913
+
4905
4914
  if (searchParams.get((0, $1ab22f2cd39b3061$export$cf5feb2102aec7f2)) === "true") set_has_sideways_filter_clearing_flag(true);
4906
4915
  if (!writer_started) {
4907
4916
  // The owner here is the createComputed which gets disposed the next time the computation runs - but we actually just want to delay the start of the href_writer until our signals contain the current value of the URL, therefore the runWithOwner
@@ -4925,7 +4934,10 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
4925
4934
  search_query_accessor_: get_search_query_
4926
4935
  } : {
4927
4936
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
4928
- })
4937
+ }),
4938
+ ...(typeof override_query_id_query_param_names_ === "object" ? {
4939
+ override_query_id_accessor_: get_override_query_id_
4940
+ } : {})
4929
4941
  };
4930
4942
  }
4931
4943
  /**
@@ -5106,6 +5118,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
5106
5118
  #market_signal = (0, $5vyXB$solidjs.createSignal)();
5107
5119
  #query_id_signal = (0, $5vyXB$solidjs.createSignal)("");
5108
5120
  #meta_title_suffix_ = (0, $5vyXB$solidjs.createSignal)();
5121
+ #disable_override_query_id = (0, $5vyXB$solidjs.createSignal)();
5109
5122
  #listing_type_signal = (0, $5vyXB$solidjs.createSignal)();
5110
5123
  static #keys_constructed_with = new Set();
5111
5124
  get localization() {
@@ -5145,6 +5158,12 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
5145
5158
  set meta_title_suffix(new_suffix) {
5146
5159
  this.#meta_title_suffix_[1](new_suffix);
5147
5160
  }
5161
+ get disable_override_query_id() {
5162
+ return this.#disable_override_query_id[0]();
5163
+ }
5164
+ set disable_override_query_id(new_value) {
5165
+ this.#disable_override_query_id[1](new_value);
5166
+ }
5148
5167
  get on_navigation() {
5149
5168
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
5150
5169
  return this.#router.on_navigation_;
@@ -5170,16 +5189,19 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
5170
5189
  (0, $d84fe647b84b5dc5$export$5162a71f252e6122)();
5171
5190
  this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", query_id_state_key);
5172
5191
  if (on_navigation) this.#router.on_navigation_ = on_navigation;
5192
+ const override_query_id_query_param_names_ = ["query_id_" + unique_instance_key_for_state, "query_id"]; // If you're wondering why this is an array https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7958#note_1511700842
5173
5193
  const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
5174
5194
  const filter_query_param_prefix_ = "f" + unique_instance_key_for_state + "_";
5175
5195
  const {
5176
5196
  selected_filters_: selected_filters_,
5177
5197
  current_sorting_: current_sorting_,
5178
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
5198
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
5199
+ override_query_id_accessor_: override_query_id_accessor_
5179
5200
  } = (0, $c79fd10a3ab7d6e0$export$477caf01aecaeb2a)({
5180
5201
  router_: this.#router,
5181
5202
  sorting_query_param_: sorting_query_param_,
5182
- filter_query_param_prefix_: filter_query_param_prefix_
5203
+ filter_query_param_prefix_: filter_query_param_prefix_,
5204
+ override_query_id_query_param_names_: override_query_id_query_param_names_
5183
5205
  });
5184
5206
  const [reset_history_state_, state_] = (0, $26a56f6b44703084$export$9862539c89138352)({
5185
5207
  get_default_values_: () => ({
@@ -5209,6 +5231,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
5209
5231
  router_: this.#router,
5210
5232
  selected_filters_: selected_filters_,
5211
5233
  current_sorting_: current_sorting_,
5234
+ override_query_id_accessor_: override_query_id_accessor_,
5212
5235
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
5213
5236
  sorting_query_param_: sorting_query_param_,
5214
5237
  filter_query_param_prefix_: filter_query_param_prefix_
@@ -5255,6 +5278,7 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
5255
5278
  },
5256
5279
  current_sorting_: current_sorting_,
5257
5280
  selected_filters_: selected_filters_,
5281
+ override_query_id_accessor_: override_query_id_accessor_,
5258
5282
  reset_history_state_: reset_history_state_,
5259
5283
  depict_api_: depict_api_,
5260
5284
  i18n_: i18n_,
@@ -5272,8 +5296,8 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
5272
5296
  depict_api_: depict_api_,
5273
5297
  min_products_to_fetch_: $48567ac5b39bac56$var$min_products_to_fetch_,
5274
5298
  local_filter_cache_: local_filter_cache_,
5299
+ query_id_: (0, $5vyXB$solidjs.createMemo)(() => !depict_category.disable_override_query_id && override_query_id_accessor_() || depict_category.category_id),
5275
5300
  meta_title_suffix_: () => depict_category.meta_title_suffix,
5276
- query_id_: () => depict_category.category_id,
5277
5301
  listing_type_: () => depict_category.listing_type,
5278
5302
  i18n_: i18n_,
5279
5303
  show_quicklinks_: (0, $5vyXB$solidjs.createMemo)(() => props.show_quicklinks ?? true),
@@ -7,7 +7,7 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "1.4.10";
10
+ export const version = "1.4.12";
11
11
  export function ExpandingDetails(props: {
12
12
  details_: HTMLDetailsElement;
13
13
  summary_: HTMLElement;
@@ -550,6 +550,8 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
550
550
  set listing_type(listing_type: ListingType | undefined);
551
551
  get meta_title_suffix(): string | undefined;
552
552
  set meta_title_suffix(new_suffix: string | undefined);
553
+ get disable_override_query_id(): boolean | undefined;
554
+ set disable_override_query_id(new_value: boolean | undefined);
553
555
  get on_navigation(): OnNavigation;
554
556
  set on_navigation(new_function: OnNavigation);
555
557
  constructor({
@@ -562,6 +564,11 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
562
564
  ...props_on_class
563
565
  }: DepictCategoryConstructorOptions<InputDisplay, OutputDisplay>);
564
566
  }
567
+ /**
568
+ * This is the CategoryPage component visible outside - exported from @depict-ai/ui.
569
+ * It wraps the internal, pure CategoryPage component and connects it to the DepictCategory instance and other global state such as the history or page URL.
570
+ * It is wrapped once again in the js-ui and react-ui packages which exports the final, most simplified interface.
571
+ */
565
572
  export function CategoryPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: {
566
573
  depict_category: DepictCategory<OriginalDisplay, OutputDisplay>;
567
574
  grid_spacing: SDKGridSpacing;
@@ -697,6 +704,11 @@ export class DepictSearch<InputDisplay extends Display, OutputDisplay extends Mo
697
704
  set market(market: string);
698
705
  fetchSearchResults(query: string, filters?: SearchFilter[], maxResults?: number): Promise<([OutputDisplay] extends [never] ? InputDisplay : ModernDisplayWithPageUrl<OutputDisplay>)[]>;
699
706
  }
707
+ /**
708
+ * This is the SearchPage component visible outside - exported from @depict-ai/ui.
709
+ * It wraps the internal, pure SearchPage component and connects it to the DepictSearch instance and other global state such as the history or page URL.
710
+ * It is wrapped once again in the js-ui and react-ui packages which exports the final, most simplified interface.
711
+ */
700
712
  export function SearchPage<OriginalDisplay extends Display, TransformedDisplay extends never | ModernDisplay>(props: {
701
713
  depict_search: DepictSearch<OriginalDisplay, TransformedDisplay>;
702
714
  include_input_field?: boolean | {
@@ -819,9 +831,18 @@ export type BaseSearchProviderConfig = {
819
831
  };
820
832
  export type BaseCategoryProviderConfig = {
821
833
  /**
822
- * Currently used for SEO long tail only. Example: {generatedTitle} + {metaTitleSuffix}
834
+ * Currently used for SEO long tail only.
835
+ * Read more about SEO collections here https://docs.depict.ai/other-guides/seo-collections-guide/introduction
836
+ * @default ""
837
+ * @example
838
+ * If the generated SEO title is "Blue Jeans", and you specify metaTitleSuffix to " | My Store", the final SEO title will be "Blue Jeans | My Store".
823
839
  */
824
840
  metaTitleSuffix?: string;
841
+ /**
842
+ * The parameter `query_id=` will override the regular category id that you have configured your SDK to use. You can consider the `query_id` as an escape-hatch if you want to easily set a category id.
843
+ * However, if your page already sets a query_id, you can disable this behaviour by setting this property to `true` (to avoid a conflict).
844
+ */
845
+ disableOverrideQueryId?: boolean;
825
846
  };
826
847
  export interface BaseProductListingConfig {
827
848
  /**
@@ -5,7 +5,7 @@ import { createSignal as $i7OB2$createSignal, createMemo as $i7OB2$createMemo, u
5
5
  /*! Depict.ai search and product listing SDK */
6
6
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
7
7
  register_es_version("ui", "latest");
8
- const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.10";
8
+ const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.12";
9
9
  function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
10
10
  const {
11
11
  collapse: collapse,
@@ -4513,11 +4513,10 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
4513
4513
  const crumb_data_ = (0, $i7OB2$createMemo)(() => plp_results_()?.breadcrumb);
4514
4514
  const quicklinks_data_ = (0, $i7OB2$createMemo)(() => plp_results_()?.quick_links);
4515
4515
  const meta_tag_data_ = (0, $i7OB2$createMemo)(() => {
4516
- meta_title_suffix_();
4517
- return plp_results_()?.metadata?.replace_meta_tags ? {
4516
+ if (plp_results_()?.metadata?.replace_meta_tags) return {
4518
4517
  title: plp_results_()?.metadata?.title + (meta_title_suffix_() || ""),
4519
4518
  description: plp_results_()?.metadata?.description
4520
- } : null;
4519
+ };
4521
4520
  });
4522
4521
  (0, $i7OB2$edit_current_page_meta_tags)(meta_tag_data_);
4523
4522
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $i7OB2$createSignal)(false);
@@ -4807,8 +4806,12 @@ function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
4807
4806
  const router_ = options.router_;
4808
4807
  const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
4809
4808
  const search_query_ = search_query_url_param_name_ ? (0, $i7OB2$createSignal)("") : undefined;
4809
+ const override_query_id_query_param_names_ = "override_query_id_query_param_names_" in options ? options.override_query_id_query_param_names_ : undefined;
4810
+ const override_query_id_ = override_query_id_query_param_names_ ? (0, $i7OB2$createSignal)(null) : undefined;
4810
4811
  const get_search_query_ = search_query_?.[0];
4811
4812
  const set_search_query = search_query_?.[1];
4813
+ const get_override_query_id_ = override_query_id_?.[0];
4814
+ const set_override_query_id = override_query_id_?.[1];
4812
4815
  const current_sorting_ = (0, $i7OB2$createSignal)();
4813
4816
  const selected_filters_ = (0, $i7OB2$createSignal)([]);
4814
4817
  const sideways_filter_clearing_flag_ = (0, $i7OB2$createSignal)(false);
@@ -4853,6 +4856,12 @@ function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
4853
4856
  const found_query = searchParams.get(search_query_url_param_name_);
4854
4857
  set_search_query(found_query || "");
4855
4858
  }
4859
+ if (override_query_id_query_param_names_) {
4860
+ const found_override_query_id = override_query_id_query_param_names_.map(n => searchParams.get(n)).find(n => n);
4861
+ set_override_query_id(found_override_query_id || null);
4862
+ if (found_override_query_id) (0, $i7OB2$dlog)("Found override query id:", found_override_query_id); // This stuff might get confusing so better log it
4863
+ }
4864
+
4856
4865
  if (searchParams.get((0, $4147651646da990a$export$cf5feb2102aec7f2)) === "true") set_has_sideways_filter_clearing_flag(true);
4857
4866
  if (!writer_started) {
4858
4867
  // The owner here is the createComputed which gets disposed the next time the computation runs - but we actually just want to delay the start of the href_writer until our signals contain the current value of the URL, therefore the runWithOwner
@@ -4876,7 +4885,10 @@ function $ccd5db07a3a069c5$export$477caf01aecaeb2a(options) {
4876
4885
  search_query_accessor_: get_search_query_
4877
4886
  } : {
4878
4887
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
4879
- })
4888
+ }),
4889
+ ...(typeof override_query_id_query_param_names_ === "object" ? {
4890
+ override_query_id_accessor_: get_override_query_id_
4891
+ } : {})
4880
4892
  };
4881
4893
  }
4882
4894
  /**
@@ -5057,6 +5069,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5057
5069
  #market_signal = (0, $i7OB2$createSignal)();
5058
5070
  #query_id_signal = (0, $i7OB2$createSignal)("");
5059
5071
  #meta_title_suffix_ = (0, $i7OB2$createSignal)();
5072
+ #disable_override_query_id = (0, $i7OB2$createSignal)();
5060
5073
  #listing_type_signal = (0, $i7OB2$createSignal)();
5061
5074
  static #keys_constructed_with = new Set();
5062
5075
  get localization() {
@@ -5096,6 +5109,12 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5096
5109
  set meta_title_suffix(new_suffix) {
5097
5110
  this.#meta_title_suffix_[1](new_suffix);
5098
5111
  }
5112
+ get disable_override_query_id() {
5113
+ return this.#disable_override_query_id[0]();
5114
+ }
5115
+ set disable_override_query_id(new_value) {
5116
+ this.#disable_override_query_id[1](new_value);
5117
+ }
5099
5118
  get on_navigation() {
5100
5119
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
5101
5120
  return this.#router.on_navigation_;
@@ -5121,16 +5140,19 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5121
5140
  (0, $90980bd87c9960f9$export$5162a71f252e6122)();
5122
5141
  this.#router = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation", query_id_state_key);
5123
5142
  if (on_navigation) this.#router.on_navigation_ = on_navigation;
5143
+ const override_query_id_query_param_names_ = ["query_id_" + unique_instance_key_for_state, "query_id"]; // If you're wondering why this is an array https://gitlab.com/depict-ai/depict.ai/-/merge_requests/7958#note_1511700842
5124
5144
  const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
5125
5145
  const filter_query_param_prefix_ = "f" + unique_instance_key_for_state + "_";
5126
5146
  const {
5127
5147
  selected_filters_: selected_filters_,
5128
5148
  current_sorting_: current_sorting_,
5129
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
5149
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
5150
+ override_query_id_accessor_: override_query_id_accessor_
5130
5151
  } = (0, $ccd5db07a3a069c5$export$477caf01aecaeb2a)({
5131
5152
  router_: this.#router,
5132
5153
  sorting_query_param_: sorting_query_param_,
5133
- filter_query_param_prefix_: filter_query_param_prefix_
5154
+ filter_query_param_prefix_: filter_query_param_prefix_,
5155
+ override_query_id_query_param_names_: override_query_id_query_param_names_
5134
5156
  });
5135
5157
  const [reset_history_state_, state_] = (0, $a8fa7302d6f93c0b$export$9862539c89138352)({
5136
5158
  get_default_values_: () => ({
@@ -5160,6 +5182,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5160
5182
  router_: this.#router,
5161
5183
  selected_filters_: selected_filters_,
5162
5184
  current_sorting_: current_sorting_,
5185
+ override_query_id_accessor_: override_query_id_accessor_,
5163
5186
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
5164
5187
  sorting_query_param_: sorting_query_param_,
5165
5188
  filter_query_param_prefix_: filter_query_param_prefix_
@@ -5206,6 +5229,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
5206
5229
  },
5207
5230
  current_sorting_: current_sorting_,
5208
5231
  selected_filters_: selected_filters_,
5232
+ override_query_id_accessor_: override_query_id_accessor_,
5209
5233
  reset_history_state_: reset_history_state_,
5210
5234
  depict_api_: depict_api_,
5211
5235
  i18n_: i18n_,
@@ -5223,8 +5247,8 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
5223
5247
  depict_api_: depict_api_,
5224
5248
  min_products_to_fetch_: $961b5c64bef4662f$var$min_products_to_fetch_,
5225
5249
  local_filter_cache_: local_filter_cache_,
5250
+ query_id_: (0, $i7OB2$createMemo)(() => !depict_category.disable_override_query_id && override_query_id_accessor_() || depict_category.category_id),
5226
5251
  meta_title_suffix_: () => depict_category.meta_title_suffix,
5227
- query_id_: () => depict_category.category_id,
5228
5252
  listing_type_: () => depict_category.listing_type,
5229
5253
  i18n_: i18n_,
5230
5254
  show_quicklinks_: (0, $i7OB2$createMemo)(() => props.show_quicklinks ?? true),