@depict-ai/ui 1.4.7 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- import { add_to_version_info as $i7OB2$add_to_version_info, observer as $i7OB2$observer, catchify as $i7OB2$catchify, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, make_random_classname as $i7OB2$make_random_classname, dlog as $i7OB2$dlog, hex_to_rgb as $i7OB2$hex_to_rgb, report as $i7OB2$report, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, javascript_media_query as $i7OB2$javascript_media_query, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, dwarn as $i7OB2$dwarn, make_url_with_query_params as $i7OB2$make_url_with_query_params, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
1
+ import { add_to_version_info as $i7OB2$add_to_version_info, observer as $i7OB2$observer, catchify as $i7OB2$catchify, useExpandingContainer as $i7OB2$useExpandingContainer, standard_price_format as $i7OB2$standard_price_format, Amazing_Slider as $i7OB2$Amazing_Slider, slider_snap_css as $i7OB2$slider_snap_css, slider_fading_factory as $i7OB2$slider_fading_factory, make_random_classname as $i7OB2$make_random_classname, dlog as $i7OB2$dlog, hex_to_rgb as $i7OB2$hex_to_rgb, report as $i7OB2$report, relative_luminance_from_rgb as $i7OB2$relative_luminance_from_rgb, javascript_media_query as $i7OB2$javascript_media_query, n_col_styling_with_dist as $i7OB2$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $i7OB2$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $i7OB2$layout_get_total_rec_amount_for_row, layout_media_query_header as $i7OB2$layout_media_query_header, fetch_recs as $i7OB2$fetch_recs, snakeCasifyObject as $i7OB2$snakeCasifyObject, instant_exec_on_suspect_history_change as $i7OB2$instant_exec_on_suspect_history_change, base_url as $i7OB2$base_url, get_depict_id as $i7OB2$get_depict_id, get_user_id as $i7OB2$get_user_id, get_session_id as $i7OB2$get_session_id, sort_obj as $i7OB2$sort_obj, fetch_retry as $i7OB2$fetch_retry, add_version_query_params as $i7OB2$add_version_query_params, dwarn as $i7OB2$dwarn, make_url_with_query_params as $i7OB2$make_url_with_query_params, edit_current_page_meta_tags as $i7OB2$edit_current_page_meta_tags, base64_encode_unicode as $i7OB2$base64_encode_unicode, base64_decode_unicode as $i7OB2$base64_decode_unicode, queueMacroTask as $i7OB2$queueMacroTask, make_asyncIterable_exiter as $i7OB2$make_asyncIterable_exiter, href_change_ipns as $i7OB2$href_change_ipns, ContainedImage as $i7OB2$ContainedImage, deparallelize_no_drop as $i7OB2$deparallelize_no_drop, insert_surfaces as $i7OB2$insert_surfaces } from "@depict-ai/utilishared/latest";
2
2
  import { insert as $i7OB2$insert, createComponent as $i7OB2$createComponent, ssr as $i7OB2$ssr, ssrHydrationKey as $i7OB2$ssrHydrationKey, escape as $i7OB2$escape, ssrAttribute as $i7OB2$ssrAttribute, ssrElement as $i7OB2$ssrElement, Dynamic as $i7OB2$Dynamic, ssrStyle as $i7OB2$ssrStyle, ssrClassList as $i7OB2$ssrClassList, isServer as $i7OB2$isServer, mergeProps as $i7OB2$mergeProps } from "solid-js/web";
3
3
  import { createSignal as $i7OB2$createSignal, createMemo as $i7OB2$createMemo, untrack as $i7OB2$untrack, createEffect as $i7OB2$createEffect, getOwner as $i7OB2$getOwner, Show as $i7OB2$Show, Index as $i7OB2$Index, onCleanup as $i7OB2$onCleanup, For as $i7OB2$For, createRenderEffect as $i7OB2$createRenderEffect, createComputed as $i7OB2$createComputed, on as $i7OB2$on, batch as $i7OB2$batch, ErrorBoundary as $i7OB2$ErrorBoundary, createRoot as $i7OB2$createRoot, runWithOwner as $i7OB2$runWithOwner, createResource as $i7OB2$createResource, createReaction as $i7OB2$createReaction, Suspense as $i7OB2$Suspense } from "solid-js";
4
4
 
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.7";
8
+ const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.9";
9
9
  function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
10
10
  const {
11
11
  collapse: collapse,
@@ -4433,6 +4433,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
4433
4433
  depict_api_: depict_api_,
4434
4434
  query_id_: query_id_,
4435
4435
  listing_type_: listing_type_,
4436
+ meta_title_suffix_: meta_title_suffix_,
4436
4437
  current_sorting_: current_sorting_,
4437
4438
  min_products_to_fetch_: min_products_to_fetch_,
4438
4439
  category_filters_open_: category_filters_open_,
@@ -4511,6 +4512,14 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
4511
4512
  const available_filters_ = (0, $i7OB2$createMemo)(() => plp_results_()?.filters);
4512
4513
  const crumb_data_ = (0, $i7OB2$createMemo)(() => plp_results_()?.breadcrumb);
4513
4514
  const quicklinks_data_ = (0, $i7OB2$createMemo)(() => plp_results_()?.quick_links);
4515
+ const meta_tag_data_ = (0, $i7OB2$createMemo)(() => {
4516
+ meta_title_suffix_();
4517
+ return plp_results_()?.metadata?.replace_meta_tags ? {
4518
+ title: plp_results_()?.metadata?.title + (meta_title_suffix_() || ""),
4519
+ description: plp_results_()?.metadata?.description
4520
+ } : null;
4521
+ });
4522
+ (0, $i7OB2$edit_current_page_meta_tags)(meta_tag_data_);
4514
4523
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $i7OB2$createSignal)(false);
4515
4524
  const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $i7OB2$createSignal)();
4516
4525
  const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
@@ -5013,6 +5022,23 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
5013
5022
  this.on_navigation_ = on_navigation;
5014
5023
  }
5015
5024
  }
5025
+
5026
+ /**
5027
+ * Wraps a function in a try/catch block and throws the error globally. If undefined is provided as fn, a no-op is returned.
5028
+ * @param fn the function to wrap
5029
+ */
5030
+ function $d8dbf52fea1773e2$export$f50b88e2a00918b5(fn) {
5031
+ return function (...args) {
5032
+ if (!fn) return;
5033
+ try {
5034
+ return Reflect.apply(fn, this, args);
5035
+ } catch (e) {
5036
+ queueMicrotask(() => {
5037
+ throw e;
5038
+ });
5039
+ }
5040
+ };
5041
+ }
5016
5042
  const $961b5c64bef4662f$var$_tmpl$ = ["<div", ' class="depict plp category">', "</div>"];
5017
5043
  // We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
5018
5044
  /**
@@ -5030,6 +5056,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5030
5056
  #merchant_signal = (0, $i7OB2$createSignal)();
5031
5057
  #market_signal = (0, $i7OB2$createSignal)();
5032
5058
  #query_id_signal = (0, $i7OB2$createSignal)("");
5059
+ #meta_title_suffix_ = (0, $i7OB2$createSignal)();
5033
5060
  #listing_type_signal = (0, $i7OB2$createSignal)();
5034
5061
  static #keys_constructed_with = new Set();
5035
5062
  get localization() {
@@ -5063,6 +5090,12 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5063
5090
  set listing_type(listing_type) {
5064
5091
  this.#listing_type_signal[1](listing_type);
5065
5092
  }
5093
+ get meta_title_suffix() {
5094
+ return this.#meta_title_suffix_[0]();
5095
+ }
5096
+ set meta_title_suffix(new_suffix) {
5097
+ this.#meta_title_suffix_[1](new_suffix);
5098
+ }
5066
5099
  get on_navigation() {
5067
5100
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
5068
5101
  return this.#router.on_navigation_;
@@ -5144,10 +5177,17 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
5144
5177
  } = props;
5145
5178
  const shared_properties = $961b5c64bef4662f$var$get_shared_properties(depict_category);
5146
5179
  return (0, $16b52438165aafe2$export$23fca46f3143581f)(() => {
5180
+ (0, $i7OB2$createEffect)(prev => {
5181
+ // 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
5182
+ const id = depict_category.category_id; // <- this is a reactive getter
5183
+ (0, $d8dbf52fea1773e2$export$f50b88e2a00918b5)(props.on_query_id_change)(id, prev);
5184
+ return id;
5185
+ });
5186
+ (0, $i7OB2$onCleanup)(() => (0, $d8dbf52fea1773e2$export$f50b88e2a00918b5)(props.on_query_id_change)());
5147
5187
  const grid_spacing_override = (0, $i7OB2$createMemo)(() => {
5148
5188
  const {
5149
5189
  grid_spacing: grid_spacing
5150
- } = props; // can be reactive
5190
+ } = props; // can be reactive, therefore read in the memo
5151
5191
  return typeof grid_spacing === "string" ? {
5152
5192
  grid_spacing: grid_spacing
5153
5193
  } : {
@@ -5183,6 +5223,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
5183
5223
  depict_api_: depict_api_,
5184
5224
  min_products_to_fetch_: $961b5c64bef4662f$var$min_products_to_fetch_,
5185
5225
  local_filter_cache_: local_filter_cache_,
5226
+ meta_title_suffix_: () => depict_category.meta_title_suffix,
5186
5227
  query_id_: () => depict_category.category_id,
5187
5228
  listing_type_: () => depict_category.listing_type,
5188
5229
  i18n_: i18n_,
@@ -7933,6 +7974,13 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
7933
7974
  grid_spacing: grid_spacing.horizontal
7934
7975
  };
7935
7976
  });
7977
+ (0, $i7OB2$createEffect)(prev => {
7978
+ // this is here (and not on DepictSearch) 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
7979
+ const search_query = shared_properties.get_search_query_();
7980
+ (0, $d8dbf52fea1773e2$export$f50b88e2a00918b5)(props.on_query_change)(search_query, prev);
7981
+ return search_query;
7982
+ });
7983
+ (0, $i7OB2$onCleanup)(() => (0, $d8dbf52fea1773e2$export$f50b88e2a00918b5)(props.on_query_change)());
7936
7984
  (0, $i7OB2$onCleanup)(shared_properties.reset_history_state_);
7937
7985
  return (0, $7097477c78a89208$export$a54ec244c8863715)({
7938
7986
  input_modal_open_: () => !!depict_search.modal_open,