@depict-ai/ui 1.4.10 → 1.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ES10/index.cjs CHANGED
@@ -60,7 +60,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
60
60
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
61
61
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
62
62
  /*! Depict.ai search and product listing SDK */
63
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "1.4.10";
63
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "1.4.11";
64
64
  function $d6d51b09cb2116a6$export$5bad61ecde080b1f() {
65
65
  const {
66
66
  collapse: collapse,
@@ -6167,12 +6167,14 @@ function $ede6c70ecdca46fe$export$f7d2f673fc2f091d(_ref) {
6167
6167
  return (_plp_results_4 = plp_results_()) === null || _plp_results_4 === void 0 ? void 0 : _plp_results_4.quick_links;
6168
6168
  });
6169
6169
  const meta_tag_data_ = (0, $52FdA$solidjs.createMemo)(() => {
6170
- var _plp_results_5, _plp_results_5$metada, _plp_results_6, _plp_results_6$metada, _plp_results_7, _plp_results_7$metada;
6171
- meta_title_suffix_();
6172
- return (_plp_results_5 = plp_results_()) !== null && _plp_results_5 !== void 0 && (_plp_results_5$metada = _plp_results_5.metadata) !== null && _plp_results_5$metada !== void 0 && _plp_results_5$metada.replace_meta_tags ? {
6173
- title: ((_plp_results_6 = plp_results_()) === null || _plp_results_6 === void 0 ? void 0 : (_plp_results_6$metada = _plp_results_6.metadata) === null || _plp_results_6$metada === void 0 ? void 0 : _plp_results_6$metada.title) + (meta_title_suffix_() || ""),
6174
- description: (_plp_results_7 = plp_results_()) === null || _plp_results_7 === void 0 ? void 0 : (_plp_results_7$metada = _plp_results_7.metadata) === null || _plp_results_7$metada === void 0 ? void 0 : _plp_results_7$metada.description
6175
- } : null;
6170
+ var _plp_results_5, _plp_results_5$metada;
6171
+ if ((_plp_results_5 = plp_results_()) !== null && _plp_results_5 !== void 0 && (_plp_results_5$metada = _plp_results_5.metadata) !== null && _plp_results_5$metada !== void 0 && _plp_results_5$metada.replace_meta_tags) {
6172
+ var _plp_results_6, _plp_results_6$metada, _plp_results_7, _plp_results_7$metada;
6173
+ return {
6174
+ title: ((_plp_results_6 = plp_results_()) === null || _plp_results_6 === void 0 ? void 0 : (_plp_results_6$metada = _plp_results_6.metadata) === null || _plp_results_6$metada === void 0 ? void 0 : _plp_results_6$metada.title) + (meta_title_suffix_() || ""),
6175
+ description: (_plp_results_7 = plp_results_()) === null || _plp_results_7 === void 0 ? void 0 : (_plp_results_7$metada = _plp_results_7.metadata) === null || _plp_results_7$metada === void 0 ? void 0 : _plp_results_7$metada.description
6176
+ };
6177
+ }
6176
6178
  });
6177
6179
  (0, $52FdA$depictaiutilishared.edit_current_page_meta_tags)(meta_tag_data_);
6178
6180
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $52FdA$solidjs.createSignal)(false);
@@ -6528,8 +6530,12 @@ function $5dd9d0d3ea82e2dd$export$477caf01aecaeb2a(options) {
6528
6530
  const router_ = options.router_;
6529
6531
  const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
6530
6532
  const search_query_ = search_query_url_param_name_ ? (0, $52FdA$solidjs.createSignal)("") : undefined;
6533
+ const override_query_id_query_param_names_ = "override_query_id_query_param_names_" in options ? options.override_query_id_query_param_names_ : undefined;
6534
+ const override_query_id_ = override_query_id_query_param_names_ ? (0, $52FdA$solidjs.createSignal)(null) : undefined;
6531
6535
  const get_search_query_ = search_query_ === null || search_query_ === void 0 ? void 0 : search_query_[0];
6532
6536
  const set_search_query = search_query_ === null || search_query_ === void 0 ? void 0 : search_query_[1];
6537
+ const get_override_query_id_ = override_query_id_ === null || override_query_id_ === void 0 ? void 0 : override_query_id_[0];
6538
+ const set_override_query_id = override_query_id_ === null || override_query_id_ === void 0 ? void 0 : override_query_id_[1];
6533
6539
  const current_sorting_ = (0, $52FdA$solidjs.createSignal)();
6534
6540
  const selected_filters_ = (0, $52FdA$solidjs.createSignal)([]);
6535
6541
  const sideways_filter_clearing_flag_ = (0, $52FdA$solidjs.createSignal)(false);
@@ -6580,6 +6586,12 @@ function $5dd9d0d3ea82e2dd$export$477caf01aecaeb2a(options) {
6580
6586
  const found_query = searchParams.get(search_query_url_param_name_);
6581
6587
  set_search_query(found_query || "");
6582
6588
  }
6589
+ if (override_query_id_query_param_names_) {
6590
+ const found_override_query_id = override_query_id_query_param_names_.map(n => searchParams.get(n)).find(n => n);
6591
+ set_override_query_id(found_override_query_id || null);
6592
+ if (found_override_query_id) (0, $52FdA$depictaiutilishared.dlog)("Found override query id:", found_override_query_id); // This stuff might get confusing so better log it
6593
+ }
6594
+
6583
6595
  if (searchParams.get((0, $a68b73fd7ba0853f$export$cf5feb2102aec7f2)) === "true") set_has_sideways_filter_clearing_flag(true);
6584
6596
  if (!writer_started) {
6585
6597
  // 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
@@ -6603,7 +6615,10 @@ function $5dd9d0d3ea82e2dd$export$477caf01aecaeb2a(options) {
6603
6615
  search_query_accessor_: get_search_query_
6604
6616
  } : {
6605
6617
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6606
- })
6618
+ }),
6619
+ ...(typeof override_query_id_query_param_names_ === "object" ? {
6620
+ override_query_id_accessor_: get_override_query_id_
6621
+ } : {})
6607
6622
  };
6608
6623
  }
6609
6624
  /**
@@ -6838,6 +6853,7 @@ var $9cbefc32b9dab36d$var$_merchant_signal = /*#__PURE__*/new WeakMap();
6838
6853
  var $9cbefc32b9dab36d$var$_market_signal = /*#__PURE__*/new WeakMap();
6839
6854
  var $9cbefc32b9dab36d$var$_query_id_signal = /*#__PURE__*/new WeakMap();
6840
6855
  var $9cbefc32b9dab36d$var$_meta_title_suffix_ = /*#__PURE__*/new WeakMap();
6856
+ var $9cbefc32b9dab36d$var$_disable_override_query_id = /*#__PURE__*/new WeakMap();
6841
6857
  var $9cbefc32b9dab36d$var$_listing_type_signal = /*#__PURE__*/new WeakMap();
6842
6858
  class $9cbefc32b9dab36d$export$f34314aa9505732e {
6843
6859
  get localization() {
@@ -6877,6 +6893,12 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
6877
6893
  set meta_title_suffix(new_suffix) {
6878
6894
  (0, $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet))(this, $9cbefc32b9dab36d$var$_meta_title_suffix_)[1](new_suffix);
6879
6895
  }
6896
+ get disable_override_query_id() {
6897
+ return (0, $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet))(this, $9cbefc32b9dab36d$var$_disable_override_query_id)[0]();
6898
+ }
6899
+ set disable_override_query_id(new_value) {
6900
+ (0, $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet))(this, $9cbefc32b9dab36d$var$_disable_override_query_id)[1](new_value);
6901
+ }
6880
6902
  get on_navigation() {
6881
6903
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
6882
6904
  return (0, $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet))(this, $9cbefc32b9dab36d$var$_router).on_navigation_;
@@ -6918,6 +6940,10 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
6918
6940
  writable: true,
6919
6941
  value: (0, $52FdA$solidjs.createSignal)()
6920
6942
  });
6943
+ $9cbefc32b9dab36d$var$_classPrivateFieldInitSpec(this, $9cbefc32b9dab36d$var$_disable_override_query_id, {
6944
+ writable: true,
6945
+ value: (0, $52FdA$solidjs.createSignal)()
6946
+ });
6921
6947
  $9cbefc32b9dab36d$var$_classPrivateFieldInitSpec(this, $9cbefc32b9dab36d$var$_listing_type_signal, {
6922
6948
  writable: true,
6923
6949
  value: (0, $52FdA$solidjs.createSignal)()
@@ -6931,16 +6957,19 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
6931
6957
  (0, $cfcd56242923775d$export$5162a71f252e6122)();
6932
6958
  (0, $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldSet))(this, $9cbefc32b9dab36d$var$_router, new (0, $73014ff36186a4dd$export$7e1297a3a19f10d8)("hard_navigation", query_id_state_key));
6933
6959
  if (on_navigation) (0, $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet))(this, $9cbefc32b9dab36d$var$_router).on_navigation_ = on_navigation;
6960
+ 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
6934
6961
  const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
6935
6962
  const filter_query_param_prefix_ = "f" + unique_instance_key_for_state + "_";
6936
6963
  const {
6937
6964
  selected_filters_: selected_filters_,
6938
6965
  current_sorting_: current_sorting_,
6939
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6966
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6967
+ override_query_id_accessor_: override_query_id_accessor_
6940
6968
  } = (0, $5dd9d0d3ea82e2dd$export$477caf01aecaeb2a)({
6941
6969
  router_: (0, $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet))(this, $9cbefc32b9dab36d$var$_router),
6942
6970
  sorting_query_param_: sorting_query_param_,
6943
- filter_query_param_prefix_: filter_query_param_prefix_
6971
+ filter_query_param_prefix_: filter_query_param_prefix_,
6972
+ override_query_id_query_param_names_: override_query_id_query_param_names_
6944
6973
  });
6945
6974
  const [reset_history_state_, state_] = (0, $2b15291bd38ac551$export$9862539c89138352)({
6946
6975
  get_default_values_: () => ({
@@ -6970,6 +6999,7 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
6970
6999
  router_: (0, $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet))(this, $9cbefc32b9dab36d$var$_router),
6971
7000
  selected_filters_: selected_filters_,
6972
7001
  current_sorting_: current_sorting_,
7002
+ override_query_id_accessor_: override_query_id_accessor_,
6973
7003
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6974
7004
  sorting_query_param_: sorting_query_param_,
6975
7005
  filter_query_param_prefix_: filter_query_param_prefix_
@@ -6979,6 +7009,11 @@ class $9cbefc32b9dab36d$export$f34314aa9505732e {
6979
7009
  });
6980
7010
  }
6981
7011
  }
7012
+ /**
7013
+ * This is the CategoryPage component visible outside - exported from @depict-ai/ui.
7014
+ * 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.
7015
+ * It is wrapped once again in the js-ui and react-ui packages which exports the final, most simplified interface.
7016
+ */
6982
7017
  var $9cbefc32b9dab36d$var$_keys_constructed_with = {
6983
7018
  writable: true,
6984
7019
  value: new Set()
@@ -7020,6 +7055,7 @@ function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
7020
7055
  },
7021
7056
  current_sorting_: current_sorting_,
7022
7057
  selected_filters_: selected_filters_,
7058
+ override_query_id_accessor_: override_query_id_accessor_,
7023
7059
  reset_history_state_: reset_history_state_,
7024
7060
  depict_api_: depict_api_,
7025
7061
  i18n_: i18n_,
@@ -7037,8 +7073,8 @@ function $9cbefc32b9dab36d$export$e2bf8ce7779e827e(props) {
7037
7073
  depict_api_: depict_api_,
7038
7074
  min_products_to_fetch_: $9cbefc32b9dab36d$var$min_products_to_fetch_,
7039
7075
  local_filter_cache_: local_filter_cache_,
7076
+ query_id_: (0, $52FdA$solidjs.createMemo)(() => !depict_category.disable_override_query_id && override_query_id_accessor_() || depict_category.category_id),
7040
7077
  meta_title_suffix_: () => depict_category.meta_title_suffix,
7041
- query_id_: () => depict_category.category_id,
7042
7078
  listing_type_: () => depict_category.listing_type,
7043
7079
  i18n_: i18n_,
7044
7080
  show_quicklinks_: (0, $52FdA$solidjs.createMemo)(() => {
package/ES10/index.d.ts CHANGED
@@ -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.11";
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
  /**
package/ES10/index.js CHANGED
@@ -8,7 +8,7 @@ import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
8
8
  /*! Depict.ai search and product listing SDK */
9
9
  import { register_es_version } from "../multi_import_deduplicator.mjs";
10
10
  register_es_version("ui", "ES10");
11
- const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.10";
11
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.11";
12
12
  function $8e8b179489080711$export$5bad61ecde080b1f() {
13
13
  const {
14
14
  collapse: collapse,
@@ -6115,12 +6115,14 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
6115
6115
  return (_plp_results_4 = plp_results_()) === null || _plp_results_4 === void 0 ? void 0 : _plp_results_4.quick_links;
6116
6116
  });
6117
6117
  const meta_tag_data_ = (0, $8tj43$createMemo)(() => {
6118
- var _plp_results_5, _plp_results_5$metada, _plp_results_6, _plp_results_6$metada, _plp_results_7, _plp_results_7$metada;
6119
- meta_title_suffix_();
6120
- return (_plp_results_5 = plp_results_()) !== null && _plp_results_5 !== void 0 && (_plp_results_5$metada = _plp_results_5.metadata) !== null && _plp_results_5$metada !== void 0 && _plp_results_5$metada.replace_meta_tags ? {
6121
- title: ((_plp_results_6 = plp_results_()) === null || _plp_results_6 === void 0 ? void 0 : (_plp_results_6$metada = _plp_results_6.metadata) === null || _plp_results_6$metada === void 0 ? void 0 : _plp_results_6$metada.title) + (meta_title_suffix_() || ""),
6122
- description: (_plp_results_7 = plp_results_()) === null || _plp_results_7 === void 0 ? void 0 : (_plp_results_7$metada = _plp_results_7.metadata) === null || _plp_results_7$metada === void 0 ? void 0 : _plp_results_7$metada.description
6123
- } : null;
6118
+ var _plp_results_5, _plp_results_5$metada;
6119
+ if ((_plp_results_5 = plp_results_()) !== null && _plp_results_5 !== void 0 && (_plp_results_5$metada = _plp_results_5.metadata) !== null && _plp_results_5$metada !== void 0 && _plp_results_5$metada.replace_meta_tags) {
6120
+ var _plp_results_6, _plp_results_6$metada, _plp_results_7, _plp_results_7$metada;
6121
+ return {
6122
+ title: ((_plp_results_6 = plp_results_()) === null || _plp_results_6 === void 0 ? void 0 : (_plp_results_6$metada = _plp_results_6.metadata) === null || _plp_results_6$metada === void 0 ? void 0 : _plp_results_6$metada.title) + (meta_title_suffix_() || ""),
6123
+ description: (_plp_results_7 = plp_results_()) === null || _plp_results_7 === void 0 ? void 0 : (_plp_results_7$metada = _plp_results_7.metadata) === null || _plp_results_7$metada === void 0 ? void 0 : _plp_results_7$metada.description
6124
+ };
6125
+ }
6124
6126
  });
6125
6127
  (0, $8tj43$edit_current_page_meta_tags)(meta_tag_data_);
6126
6128
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $8tj43$createSignal)(false);
@@ -6476,8 +6478,12 @@ function $9d3d794b62318ecc$export$477caf01aecaeb2a(options) {
6476
6478
  const router_ = options.router_;
6477
6479
  const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
6478
6480
  const search_query_ = search_query_url_param_name_ ? (0, $8tj43$createSignal)("") : undefined;
6481
+ const override_query_id_query_param_names_ = "override_query_id_query_param_names_" in options ? options.override_query_id_query_param_names_ : undefined;
6482
+ const override_query_id_ = override_query_id_query_param_names_ ? (0, $8tj43$createSignal)(null) : undefined;
6479
6483
  const get_search_query_ = search_query_ === null || search_query_ === void 0 ? void 0 : search_query_[0];
6480
6484
  const set_search_query = search_query_ === null || search_query_ === void 0 ? void 0 : search_query_[1];
6485
+ const get_override_query_id_ = override_query_id_ === null || override_query_id_ === void 0 ? void 0 : override_query_id_[0];
6486
+ const set_override_query_id = override_query_id_ === null || override_query_id_ === void 0 ? void 0 : override_query_id_[1];
6481
6487
  const current_sorting_ = (0, $8tj43$createSignal)();
6482
6488
  const selected_filters_ = (0, $8tj43$createSignal)([]);
6483
6489
  const sideways_filter_clearing_flag_ = (0, $8tj43$createSignal)(false);
@@ -6528,6 +6534,12 @@ function $9d3d794b62318ecc$export$477caf01aecaeb2a(options) {
6528
6534
  const found_query = searchParams.get(search_query_url_param_name_);
6529
6535
  set_search_query(found_query || "");
6530
6536
  }
6537
+ if (override_query_id_query_param_names_) {
6538
+ const found_override_query_id = override_query_id_query_param_names_.map(n => searchParams.get(n)).find(n => n);
6539
+ set_override_query_id(found_override_query_id || null);
6540
+ if (found_override_query_id) (0, $8tj43$dlog)("Found override query id:", found_override_query_id); // This stuff might get confusing so better log it
6541
+ }
6542
+
6531
6543
  if (searchParams.get((0, $2855bffe06ef7a03$export$cf5feb2102aec7f2)) === "true") set_has_sideways_filter_clearing_flag(true);
6532
6544
  if (!writer_started) {
6533
6545
  // 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
@@ -6551,7 +6563,10 @@ function $9d3d794b62318ecc$export$477caf01aecaeb2a(options) {
6551
6563
  search_query_accessor_: get_search_query_
6552
6564
  } : {
6553
6565
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6554
- })
6566
+ }),
6567
+ ...(typeof override_query_id_query_param_names_ === "object" ? {
6568
+ override_query_id_accessor_: get_override_query_id_
6569
+ } : {})
6555
6570
  };
6556
6571
  }
6557
6572
  /**
@@ -6786,6 +6801,7 @@ var $f5f54892fd0c7d9f$var$_merchant_signal = /*#__PURE__*/new WeakMap();
6786
6801
  var $f5f54892fd0c7d9f$var$_market_signal = /*#__PURE__*/new WeakMap();
6787
6802
  var $f5f54892fd0c7d9f$var$_query_id_signal = /*#__PURE__*/new WeakMap();
6788
6803
  var $f5f54892fd0c7d9f$var$_meta_title_suffix_ = /*#__PURE__*/new WeakMap();
6804
+ var $f5f54892fd0c7d9f$var$_disable_override_query_id = /*#__PURE__*/new WeakMap();
6789
6805
  var $f5f54892fd0c7d9f$var$_listing_type_signal = /*#__PURE__*/new WeakMap();
6790
6806
  class $f5f54892fd0c7d9f$export$f34314aa9505732e {
6791
6807
  get localization() {
@@ -6825,6 +6841,12 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
6825
6841
  set meta_title_suffix(new_suffix) {
6826
6842
  (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_meta_title_suffix_)[1](new_suffix);
6827
6843
  }
6844
+ get disable_override_query_id() {
6845
+ return (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_disable_override_query_id)[0]();
6846
+ }
6847
+ set disable_override_query_id(new_value) {
6848
+ (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_disable_override_query_id)[1](new_value);
6849
+ }
6828
6850
  get on_navigation() {
6829
6851
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
6830
6852
  return (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_router).on_navigation_;
@@ -6866,6 +6888,10 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
6866
6888
  writable: true,
6867
6889
  value: (0, $8tj43$createSignal)()
6868
6890
  });
6891
+ $f5f54892fd0c7d9f$var$_classPrivateFieldInitSpec(this, $f5f54892fd0c7d9f$var$_disable_override_query_id, {
6892
+ writable: true,
6893
+ value: (0, $8tj43$createSignal)()
6894
+ });
6869
6895
  $f5f54892fd0c7d9f$var$_classPrivateFieldInitSpec(this, $f5f54892fd0c7d9f$var$_listing_type_signal, {
6870
6896
  writable: true,
6871
6897
  value: (0, $8tj43$createSignal)()
@@ -6879,16 +6905,19 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
6879
6905
  (0, $68e6625c8d51f847$export$5162a71f252e6122)();
6880
6906
  (0, $8tj43$babelruntimehelpersclassPrivateFieldSet)(this, $f5f54892fd0c7d9f$var$_router, new (0, $ac571292d606f30b$export$7e1297a3a19f10d8)("hard_navigation", query_id_state_key));
6881
6907
  if (on_navigation) (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_router).on_navigation_ = on_navigation;
6908
+ 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
6882
6909
  const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
6883
6910
  const filter_query_param_prefix_ = "f" + unique_instance_key_for_state + "_";
6884
6911
  const {
6885
6912
  selected_filters_: selected_filters_,
6886
6913
  current_sorting_: current_sorting_,
6887
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6914
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6915
+ override_query_id_accessor_: override_query_id_accessor_
6888
6916
  } = (0, $9d3d794b62318ecc$export$477caf01aecaeb2a)({
6889
6917
  router_: (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_router),
6890
6918
  sorting_query_param_: sorting_query_param_,
6891
- filter_query_param_prefix_: filter_query_param_prefix_
6919
+ filter_query_param_prefix_: filter_query_param_prefix_,
6920
+ override_query_id_query_param_names_: override_query_id_query_param_names_
6892
6921
  });
6893
6922
  const [reset_history_state_, state_] = (0, $bc811d9630f9579b$export$9862539c89138352)({
6894
6923
  get_default_values_: () => ({
@@ -6918,6 +6947,7 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
6918
6947
  router_: (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_router),
6919
6948
  selected_filters_: selected_filters_,
6920
6949
  current_sorting_: current_sorting_,
6950
+ override_query_id_accessor_: override_query_id_accessor_,
6921
6951
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6922
6952
  sorting_query_param_: sorting_query_param_,
6923
6953
  filter_query_param_prefix_: filter_query_param_prefix_
@@ -6927,6 +6957,11 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
6927
6957
  });
6928
6958
  }
6929
6959
  }
6960
+ /**
6961
+ * This is the CategoryPage component visible outside - exported from @depict-ai/ui.
6962
+ * 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.
6963
+ * It is wrapped once again in the js-ui and react-ui packages which exports the final, most simplified interface.
6964
+ */
6930
6965
  var $f5f54892fd0c7d9f$var$_keys_constructed_with = {
6931
6966
  writable: true,
6932
6967
  value: new Set()
@@ -6968,6 +7003,7 @@ function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
6968
7003
  },
6969
7004
  current_sorting_: current_sorting_,
6970
7005
  selected_filters_: selected_filters_,
7006
+ override_query_id_accessor_: override_query_id_accessor_,
6971
7007
  reset_history_state_: reset_history_state_,
6972
7008
  depict_api_: depict_api_,
6973
7009
  i18n_: i18n_,
@@ -6985,8 +7021,8 @@ function $f5f54892fd0c7d9f$export$e2bf8ce7779e827e(props) {
6985
7021
  depict_api_: depict_api_,
6986
7022
  min_products_to_fetch_: $f5f54892fd0c7d9f$var$min_products_to_fetch_,
6987
7023
  local_filter_cache_: local_filter_cache_,
7024
+ query_id_: (0, $8tj43$createMemo)(() => !depict_category.disable_override_query_id && override_query_id_accessor_() || depict_category.category_id),
6988
7025
  meta_title_suffix_: () => depict_category.meta_title_suffix,
6989
- query_id_: () => depict_category.category_id,
6990
7026
  listing_type_: () => depict_category.listing_type,
6991
7027
  i18n_: i18n_,
6992
7028
  show_quicklinks_: (0, $8tj43$createMemo)(() => {
package/latest/index.cjs CHANGED
@@ -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.11";
58
58
  function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
59
59
  const {
60
60
  collapse: collapse,
@@ -5733,11 +5733,10 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
5733
5733
  const crumb_data_ = (0, $gVhhF$solidjs.createMemo)(() => plp_results_()?.breadcrumb);
5734
5734
  const quicklinks_data_ = (0, $gVhhF$solidjs.createMemo)(() => plp_results_()?.quick_links);
5735
5735
  const meta_tag_data_ = (0, $gVhhF$solidjs.createMemo)(() => {
5736
- meta_title_suffix_();
5737
- return plp_results_()?.metadata?.replace_meta_tags ? {
5736
+ if (plp_results_()?.metadata?.replace_meta_tags) return {
5738
5737
  title: plp_results_()?.metadata?.title + (meta_title_suffix_() || ""),
5739
5738
  description: plp_results_()?.metadata?.description
5740
- } : null;
5739
+ };
5741
5740
  });
5742
5741
  (0, $gVhhF$depictaiutilishared.edit_current_page_meta_tags)(meta_tag_data_);
5743
5742
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $gVhhF$solidjs.createSignal)(false);
@@ -6076,8 +6075,12 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
6076
6075
  const router_ = options.router_;
6077
6076
  const search_query_url_param_name_ = "search_query_url_param_name_" in options ? options.search_query_url_param_name_ : undefined;
6078
6077
  const search_query_ = search_query_url_param_name_ ? (0, $gVhhF$solidjs.createSignal)("") : undefined;
6078
+ const override_query_id_query_param_names_ = "override_query_id_query_param_names_" in options ? options.override_query_id_query_param_names_ : undefined;
6079
+ const override_query_id_ = override_query_id_query_param_names_ ? (0, $gVhhF$solidjs.createSignal)(null) : undefined;
6079
6080
  const get_search_query_ = search_query_?.[0];
6080
6081
  const set_search_query = search_query_?.[1];
6082
+ const get_override_query_id_ = override_query_id_?.[0];
6083
+ const set_override_query_id = override_query_id_?.[1];
6081
6084
  const current_sorting_ = (0, $gVhhF$solidjs.createSignal)();
6082
6085
  const selected_filters_ = (0, $gVhhF$solidjs.createSignal)([]);
6083
6086
  const sideways_filter_clearing_flag_ = (0, $gVhhF$solidjs.createSignal)(false);
@@ -6122,6 +6125,12 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
6122
6125
  const found_query = searchParams.get(search_query_url_param_name_);
6123
6126
  set_search_query(found_query || "");
6124
6127
  }
6128
+ if (override_query_id_query_param_names_) {
6129
+ const found_override_query_id = override_query_id_query_param_names_.map(n => searchParams.get(n)).find(n => n);
6130
+ set_override_query_id(found_override_query_id || null);
6131
+ if (found_override_query_id) (0, $gVhhF$depictaiutilishared.dlog)("Found override query id:", found_override_query_id); // This stuff might get confusing so better log it
6132
+ }
6133
+
6125
6134
  if (searchParams.get((0, $1ab22f2cd39b3061$export$cf5feb2102aec7f2)) === "true") set_has_sideways_filter_clearing_flag(true);
6126
6135
  if (!writer_started) {
6127
6136
  // 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
@@ -6145,7 +6154,10 @@ function $c79fd10a3ab7d6e0$export$477caf01aecaeb2a(options) {
6145
6154
  search_query_accessor_: get_search_query_
6146
6155
  } : {
6147
6156
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6148
- })
6157
+ }),
6158
+ ...(typeof override_query_id_query_param_names_ === "object" ? {
6159
+ override_query_id_accessor_: get_override_query_id_
6160
+ } : {})
6149
6161
  };
6150
6162
  }
6151
6163
  /**
@@ -6331,6 +6343,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
6331
6343
  #market_signal = (0, $gVhhF$solidjs.createSignal)();
6332
6344
  #query_id_signal = (0, $gVhhF$solidjs.createSignal)("");
6333
6345
  #meta_title_suffix_ = (0, $gVhhF$solidjs.createSignal)();
6346
+ #disable_override_query_id = (0, $gVhhF$solidjs.createSignal)();
6334
6347
  #listing_type_signal = (0, $gVhhF$solidjs.createSignal)();
6335
6348
  static #keys_constructed_with = new Set();
6336
6349
  get localization() {
@@ -6370,6 +6383,12 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
6370
6383
  set meta_title_suffix(new_suffix) {
6371
6384
  this.#meta_title_suffix_[1](new_suffix);
6372
6385
  }
6386
+ get disable_override_query_id() {
6387
+ return this.#disable_override_query_id[0]();
6388
+ }
6389
+ set disable_override_query_id(new_value) {
6390
+ this.#disable_override_query_id[1](new_value);
6391
+ }
6373
6392
  get on_navigation() {
6374
6393
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
6375
6394
  return this.#router.on_navigation_;
@@ -6395,16 +6414,19 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
6395
6414
  (0, $d84fe647b84b5dc5$export$5162a71f252e6122)();
6396
6415
  this.#router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation", query_id_state_key);
6397
6416
  if (on_navigation) this.#router.on_navigation_ = on_navigation;
6417
+ 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
6398
6418
  const sorting_query_param_ = "sorting" + unique_instance_key_for_state;
6399
6419
  const filter_query_param_prefix_ = "f" + unique_instance_key_for_state + "_";
6400
6420
  const {
6401
6421
  selected_filters_: selected_filters_,
6402
6422
  current_sorting_: current_sorting_,
6403
- sideways_filter_clearing_flag_: sideways_filter_clearing_flag_
6423
+ sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6424
+ override_query_id_accessor_: override_query_id_accessor_
6404
6425
  } = (0, $c79fd10a3ab7d6e0$export$477caf01aecaeb2a)({
6405
6426
  router_: this.#router,
6406
6427
  sorting_query_param_: sorting_query_param_,
6407
- filter_query_param_prefix_: filter_query_param_prefix_
6428
+ filter_query_param_prefix_: filter_query_param_prefix_,
6429
+ override_query_id_query_param_names_: override_query_id_query_param_names_
6408
6430
  });
6409
6431
  const [reset_history_state_, state_] = (0, $26a56f6b44703084$export$9862539c89138352)({
6410
6432
  get_default_values_: () => ({
@@ -6434,6 +6456,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
6434
6456
  router_: this.#router,
6435
6457
  selected_filters_: selected_filters_,
6436
6458
  current_sorting_: current_sorting_,
6459
+ override_query_id_accessor_: override_query_id_accessor_,
6437
6460
  sideways_filter_clearing_flag_: sideways_filter_clearing_flag_,
6438
6461
  sorting_query_param_: sorting_query_param_,
6439
6462
  filter_query_param_prefix_: filter_query_param_prefix_
@@ -6480,6 +6503,7 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
6480
6503
  },
6481
6504
  current_sorting_: current_sorting_,
6482
6505
  selected_filters_: selected_filters_,
6506
+ override_query_id_accessor_: override_query_id_accessor_,
6483
6507
  reset_history_state_: reset_history_state_,
6484
6508
  depict_api_: depict_api_,
6485
6509
  i18n_: i18n_,
@@ -6497,8 +6521,8 @@ function $48567ac5b39bac56$export$e2bf8ce7779e827e(props) {
6497
6521
  depict_api_: depict_api_,
6498
6522
  min_products_to_fetch_: $48567ac5b39bac56$var$min_products_to_fetch_,
6499
6523
  local_filter_cache_: local_filter_cache_,
6524
+ query_id_: (0, $gVhhF$solidjs.createMemo)(() => !depict_category.disable_override_query_id && override_query_id_accessor_() || depict_category.category_id),
6500
6525
  meta_title_suffix_: () => depict_category.meta_title_suffix,
6501
- query_id_: () => depict_category.category_id,
6502
6526
  listing_type_: () => depict_category.listing_type,
6503
6527
  i18n_: i18n_,
6504
6528
  show_quicklinks_: (0, $gVhhF$solidjs.createMemo)(() => props.show_quicklinks ?? true),
package/latest/index.d.ts CHANGED
@@ -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.11";
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
  /**