@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.
package/latest/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { add_to_version_info as $9HbP8$add_to_version_info, observer as $9HbP8$observer, catchify as $9HbP8$catchify, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, make_random_classname as $9HbP8$make_random_classname, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, report as $9HbP8$report, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
1
+ import { add_to_version_info as $9HbP8$add_to_version_info, observer as $9HbP8$observer, catchify as $9HbP8$catchify, useExpandingContainer as $9HbP8$useExpandingContainer, standard_price_format as $9HbP8$standard_price_format, Amazing_Slider as $9HbP8$Amazing_Slider, slider_snap_css as $9HbP8$slider_snap_css, slider_fading_factory as $9HbP8$slider_fading_factory, make_random_classname as $9HbP8$make_random_classname, dlog as $9HbP8$dlog, hex_to_rgb as $9HbP8$hex_to_rgb, report as $9HbP8$report, relative_luminance_from_rgb as $9HbP8$relative_luminance_from_rgb, javascript_media_query as $9HbP8$javascript_media_query, n_col_styling_with_dist as $9HbP8$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $9HbP8$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $9HbP8$layout_get_total_rec_amount_for_row, layout_media_query_header as $9HbP8$layout_media_query_header, fetch_recs as $9HbP8$fetch_recs, snakeCasifyObject as $9HbP8$snakeCasifyObject, instant_exec_on_suspect_history_change as $9HbP8$instant_exec_on_suspect_history_change, base_url as $9HbP8$base_url, get_depict_id as $9HbP8$get_depict_id, get_user_id as $9HbP8$get_user_id, get_session_id as $9HbP8$get_session_id, sort_obj as $9HbP8$sort_obj, fetch_retry as $9HbP8$fetch_retry, add_version_query_params as $9HbP8$add_version_query_params, dwarn as $9HbP8$dwarn, make_url_with_query_params as $9HbP8$make_url_with_query_params, edit_current_page_meta_tags as $9HbP8$edit_current_page_meta_tags, base64_encode_unicode as $9HbP8$base64_encode_unicode, base64_decode_unicode as $9HbP8$base64_decode_unicode, queueMacroTask as $9HbP8$queueMacroTask, is_debug as $9HbP8$is_debug, make_asyncIterable_exiter as $9HbP8$make_asyncIterable_exiter, href_change_ipns as $9HbP8$href_change_ipns, ContainedImage as $9HbP8$ContainedImage, buildThresholdList as $9HbP8$buildThresholdList, deparallelize_no_drop as $9HbP8$deparallelize_no_drop, insert_surfaces as $9HbP8$insert_surfaces } from "@depict-ai/utilishared/latest";
2
2
  import { insert as $9HbP8$insert, createComponent as $9HbP8$createComponent, template as $9HbP8$template, getNextElement as $9HbP8$getNextElement, getNextMarker as $9HbP8$getNextMarker, addEventListener as $9HbP8$addEventListener, runHydrationEvents as $9HbP8$runHydrationEvents, memo as $9HbP8$memo, delegateEvents as $9HbP8$delegateEvents, effect as $9HbP8$effect, setAttribute as $9HbP8$setAttribute, spread as $9HbP8$spread, mergeProps as $9HbP8$mergeProps, Dynamic as $9HbP8$Dynamic, use as $9HbP8$use, style as $9HbP8$style, classList as $9HbP8$classList, className as $9HbP8$className, isServer as $9HbP8$isServer } from "solid-js/web";
3
3
  import { createSignal as $9HbP8$createSignal, createMemo as $9HbP8$createMemo, untrack as $9HbP8$untrack, createEffect as $9HbP8$createEffect, getOwner as $9HbP8$getOwner, Show as $9HbP8$Show, runWithOwner as $9HbP8$runWithOwner, Index as $9HbP8$Index, onCleanup as $9HbP8$onCleanup, createRoot as $9HbP8$createRoot, on as $9HbP8$on, For as $9HbP8$For, createRenderEffect as $9HbP8$createRenderEffect, createComputed as $9HbP8$createComputed, batch as $9HbP8$batch, ErrorBoundary as $9HbP8$ErrorBoundary, createResource as $9HbP8$createResource, createReaction as $9HbP8$createReaction, Suspense as $9HbP8$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,
@@ -5604,6 +5604,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
5604
5604
  depict_api_: depict_api_,
5605
5605
  query_id_: query_id_,
5606
5606
  listing_type_: listing_type_,
5607
+ meta_title_suffix_: meta_title_suffix_,
5607
5608
  current_sorting_: current_sorting_,
5608
5609
  min_products_to_fetch_: min_products_to_fetch_,
5609
5610
  category_filters_open_: category_filters_open_,
@@ -5682,6 +5683,14 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
5682
5683
  const available_filters_ = (0, $9HbP8$createMemo)(() => plp_results_()?.filters);
5683
5684
  const crumb_data_ = (0, $9HbP8$createMemo)(() => plp_results_()?.breadcrumb);
5684
5685
  const quicklinks_data_ = (0, $9HbP8$createMemo)(() => plp_results_()?.quick_links);
5686
+ const meta_tag_data_ = (0, $9HbP8$createMemo)(() => {
5687
+ meta_title_suffix_();
5688
+ return plp_results_()?.metadata?.replace_meta_tags ? {
5689
+ title: plp_results_()?.metadata?.title + (meta_title_suffix_() || ""),
5690
+ description: plp_results_()?.metadata?.description
5691
+ } : null;
5692
+ });
5693
+ (0, $9HbP8$edit_current_page_meta_tags)(meta_tag_data_);
5685
5694
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $9HbP8$createSignal)(false);
5686
5695
  const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $9HbP8$createSignal)();
5687
5696
  const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
@@ -6233,6 +6242,23 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
6233
6242
  this.on_navigation_ = on_navigation;
6234
6243
  }
6235
6244
  }
6245
+
6246
+ /**
6247
+ * Wraps a function in a try/catch block and throws the error globally. If undefined is provided as fn, a no-op is returned.
6248
+ * @param fn the function to wrap
6249
+ */
6250
+ function $d8dbf52fea1773e2$export$f50b88e2a00918b5(fn) {
6251
+ return function (...args) {
6252
+ if (!fn) return;
6253
+ try {
6254
+ return Reflect.apply(fn, this, args);
6255
+ } catch (e) {
6256
+ queueMicrotask(() => {
6257
+ throw e;
6258
+ });
6259
+ }
6260
+ };
6261
+ }
6236
6262
  const $961b5c64bef4662f$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<div class="depict plp category"></div>`, 2);
6237
6263
  // 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
6238
6264
  /**
@@ -6255,6 +6281,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
6255
6281
  #merchant_signal = (0, $9HbP8$createSignal)();
6256
6282
  #market_signal = (0, $9HbP8$createSignal)();
6257
6283
  #query_id_signal = (0, $9HbP8$createSignal)("");
6284
+ #meta_title_suffix_ = (0, $9HbP8$createSignal)();
6258
6285
  #listing_type_signal = (0, $9HbP8$createSignal)();
6259
6286
  static #keys_constructed_with = new Set();
6260
6287
  get localization() {
@@ -6288,6 +6315,12 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
6288
6315
  set listing_type(listing_type) {
6289
6316
  this.#listing_type_signal[1](listing_type);
6290
6317
  }
6318
+ get meta_title_suffix() {
6319
+ return this.#meta_title_suffix_[0]();
6320
+ }
6321
+ set meta_title_suffix(new_suffix) {
6322
+ this.#meta_title_suffix_[1](new_suffix);
6323
+ }
6291
6324
  get on_navigation() {
6292
6325
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
6293
6326
  return this.#router.on_navigation_;
@@ -6369,10 +6402,17 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
6369
6402
  } = props;
6370
6403
  const shared_properties = $961b5c64bef4662f$var$get_shared_properties(depict_category);
6371
6404
  return (0, $16b52438165aafe2$export$23fca46f3143581f)(() => {
6405
+ (0, $9HbP8$createEffect)(prev => {
6406
+ // 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
6407
+ const id = depict_category.category_id; // <- this is a reactive getter
6408
+ (0, $d8dbf52fea1773e2$export$f50b88e2a00918b5)(props.on_query_id_change)(id, prev);
6409
+ return id;
6410
+ });
6411
+ (0, $9HbP8$onCleanup)(() => (0, $d8dbf52fea1773e2$export$f50b88e2a00918b5)(props.on_query_id_change)());
6372
6412
  const grid_spacing_override = (0, $9HbP8$createMemo)(() => {
6373
6413
  const {
6374
6414
  grid_spacing: grid_spacing
6375
- } = props; // can be reactive
6415
+ } = props; // can be reactive, therefore read in the memo
6376
6416
  return typeof grid_spacing === "string" ? {
6377
6417
  grid_spacing: grid_spacing
6378
6418
  } : {
@@ -6408,6 +6448,7 @@ function $961b5c64bef4662f$export$e2bf8ce7779e827e(props) {
6408
6448
  depict_api_: depict_api_,
6409
6449
  min_products_to_fetch_: $961b5c64bef4662f$var$min_products_to_fetch_,
6410
6450
  local_filter_cache_: local_filter_cache_,
6451
+ meta_title_suffix_: () => depict_category.meta_title_suffix,
6411
6452
  query_id_: () => depict_category.category_id,
6412
6453
  listing_type_: () => depict_category.listing_type,
6413
6454
  i18n_: i18n_,
@@ -9786,6 +9827,13 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
9786
9827
  grid_spacing: grid_spacing.horizontal
9787
9828
  };
9788
9829
  });
9830
+ (0, $9HbP8$createEffect)(prev => {
9831
+ // 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
9832
+ const search_query = shared_properties.get_search_query_();
9833
+ (0, $d8dbf52fea1773e2$export$f50b88e2a00918b5)(props.on_query_change)(search_query, prev);
9834
+ return search_query;
9835
+ });
9836
+ (0, $9HbP8$onCleanup)(() => (0, $d8dbf52fea1773e2$export$f50b88e2a00918b5)(props.on_query_change)());
9789
9837
  (0, $9HbP8$onCleanup)(shared_properties.reset_history_state_);
9790
9838
  return (0, $7097477c78a89208$export$a54ec244c8863715)({
9791
9839
  input_modal_open_: () => !!depict_search.modal_open,