@depict-ai/ui 0.0.41 → 0.0.43

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/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestions
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
10
  import { ProductListingResponse, BaseCategoryDisplay } from "@depict-ai/types/api/ProductListingResponse";
11
11
  import { JSX as _JSX1 } from "solid-js/types/jsx";
12
- export const version = "0.0.41";
12
+ export const version = "0.0.43";
13
13
  type ExclusiveId = {
14
14
  categoryId: string;
15
15
  productId?: undefined;
@@ -67,7 +67,7 @@ type RecsAPIWrapperOptions = {
67
67
  * ```
68
68
  * @return This function is guaranteed to return an array of Displays. If anything fails, you will get an empty array.
69
69
  */
70
- export function fetchDepictRecommendations<T = Display>({ merchant, market, headers, ...fetch_recs_options }: RecsAPIWrapperOptions): Promise<T[]>;
70
+ export function fetchDepictRecommendations<T extends Display = Display>({ merchant, market, headers, ...fetch_recs_options }: RecsAPIWrapperOptions): Promise<T[]>;
71
71
  /**
72
72
  * Like standard_price_format except that the price and the formatting are reactive accessors
73
73
  */
@@ -155,7 +155,7 @@ interface category_i18n extends plp_shared_i18n {
155
155
  */
156
156
  export interface Locale extends category_i18n, search_i18n {
157
157
  }
158
- export type InstantCard = (display: unknown, context: {
158
+ export type InstantCard<T extends Display> = (display: T, context: {
159
159
  index: number;
160
160
  i18n: _search_i18n1;
161
161
  merchant: string;
@@ -250,11 +250,11 @@ export class DepictCategory {
250
250
  set market(market: string);
251
251
  constructor({ api, on_navigation, ...props_on_class }: DepictCategoryConstructorOptions);
252
252
  }
253
- export function CategoryPage({ depict_category, grid_spacing, cols_at_size, product_card_template, get_product_id, show_breadcrumbs, show_quicklinks, category_title, }: {
253
+ export function CategoryPage<T extends Display>({ depict_category, grid_spacing, cols_at_size, product_card_template, get_product_id, show_breadcrumbs, show_quicklinks, category_title, }: {
254
254
  depict_category: DepictCategory;
255
255
  grid_spacing: SDKGridSpacing;
256
256
  cols_at_size: SDKColsAtSize;
257
- product_card_template: (display: Display, info: InfoForProcessing) => Promise<Node_Array> | Node_Array;
257
+ product_card_template: (display: T | null, info: InfoForProcessing<T>) => Promise<Node_Array> | Node_Array;
258
258
  get_product_id: (url?: string) => string | Promise<string>;
259
259
  show_quicklinks?: boolean;
260
260
  show_breadcrumbs?: boolean;
@@ -292,7 +292,15 @@ export type RenderCategorySuggestion = (category_suggestion: Accessor<CategorySu
292
292
  op: WithRequired<SearchFilter, "op">["op"];
293
293
  data: WithRequired<SearchFilter, "data">["data"];
294
294
  }[]>) => JSX.Element;
295
- type ConstructorOptions = {
295
+ /**
296
+ * Connects the height of the query input to the height of the aligner.
297
+ * @param aligner
298
+ * @returns
299
+ */
300
+ export function connect_query_input_height_to_aligner_height(aligner: HTMLElement): {
301
+ cleanup: () => void;
302
+ };
303
+ type ConstructorOptions<T extends Display> = {
296
304
  search_query_url_param_name?: string;
297
305
  market: string;
298
306
  merchant: string;
@@ -303,7 +311,7 @@ type ConstructorOptions = {
303
311
  disable_scrolling_during_modal?: boolean;
304
312
  api?: DepictAPI;
305
313
  bottom_distance_under_modal_?: Accessor<number | undefined>;
306
- render_instant_card?: InstantCard;
314
+ render_instant_card?: InstantCard<T>;
307
315
  };
308
316
  type OpenModalArguments = [
309
317
  options_for_modal?: {
@@ -313,10 +321,10 @@ type OpenModalArguments = [
313
321
  },
314
322
  on_dispose?: VoidFunction
315
323
  ];
316
- export const get_search_query_updating_blocked_signal: (depict_search: DepictSearch) => Signal<boolean> | undefined;
317
- export class DepictSearch {
324
+ export const get_search_query_updating_blocked_signal: (depict_search: DepictSearch<any>) => Signal<boolean> | undefined;
325
+ export class DepictSearch<T extends Display> {
318
326
  #private;
319
- constructor({ search_query_url_param_name, url_transformer, on_navigation: raw_on_navigation, enable_category_suggestions, disable_scrolling_during_modal, api, bottom_distance_under_modal_, render_instant_card, ...props_on_class }: ConstructorOptions);
327
+ constructor({ search_query_url_param_name, url_transformer, on_navigation: raw_on_navigation, enable_category_suggestions, disable_scrolling_during_modal, api, bottom_distance_under_modal_, render_instant_card, ...props_on_class }: ConstructorOptions<T>);
320
328
  get localization(): search_i18n;
321
329
  set localization(locale_obj: search_i18n);
322
330
  get modal_open(): OpenModalArguments | boolean;
@@ -326,24 +334,24 @@ export class DepictSearch {
326
334
  get market(): string;
327
335
  set market(market: string);
328
336
  }
329
- export function SearchPage({ depict_search, include_input_field, grid_spacing, cols_at_size, product_card_template, get_product_id, extra_depict_options, }: {
330
- depict_search: DepictSearch;
337
+ export function SearchPage<T extends Display>({ depict_search, include_input_field, grid_spacing, cols_at_size, product_card_template, get_product_id, extra_depict_options, }: {
338
+ depict_search: DepictSearch<T>;
331
339
  include_input_field?: boolean | {
332
340
  on_open_?: VoidFunction;
333
341
  on_close_?: VoidFunction;
334
342
  };
335
343
  grid_spacing: SDKGridSpacing;
336
344
  cols_at_size: SDKColsAtSize;
337
- product_card_template: (display: Display, info: InfoForProcessing) => Promise<Node_Array> | Node_Array;
345
+ product_card_template: (display: T | null, info: InfoForProcessing<T>) => Promise<Node_Array> | Node_Array;
338
346
  get_product_id: (url?: string) => string | Promise<string>;
339
347
  extra_depict_options?: {
340
- pre_processors?: RR_PreProcessor[];
341
- post_processors?: RR_PostProcessor[];
348
+ pre_processors?: RR_PreProcessor<T>[];
349
+ post_processors?: RR_PostProcessor<T>[];
342
350
  recommendations_cols_at_size?: SDKColsAtSize;
343
351
  };
344
352
  }): Node_Array;
345
353
  interface SearchFieldParams {
346
- depict_search: DepictSearch;
354
+ depict_search: DepictSearch<any>;
347
355
  modal_dispose_handler?: VoidFunction;
348
356
  click_handler?: (this: HTMLDivElement, ev: MouseEvent) => any;
349
357
  aligner_ref?: HTMLElement | null;
package/dist/main.js CHANGED
@@ -1,3 +1,4 @@
1
+ const process = { env: {} }; // In case that the code using this wasn't built with "node emulation", just make process.env accesses become undefined.
1
2
  var $46MJV$depictaiutilishared = require("@depict-ai/utilishared");
2
3
  var $46MJV$solidjsweb = require("solid-js/web");
3
4
  var $46MJV$solidjs = require("solid-js");
@@ -30,10 +31,11 @@ $parcel$export(module.exports, "media_query_to_accessor", () => $beec9d22e42ed2c
30
31
  $parcel$export(module.exports, "setup_fast_leave", () => $d589470b68ce5b67$export$689e204eadb33baf);
31
32
  $parcel$export(module.exports, "show_toast", () => $b3e6a0e9382bf87e$export$5196e4c01fa56fcb);
32
33
  $parcel$export(module.exports, "solid_format_price", () => $5fc9fc23df1591db$export$469c7af753d08925);
34
+ $parcel$export(module.exports, "connect_query_input_height_to_aligner_height", () => $94360f5c066c55b9$export$bec48a3a3ca6bc09);
33
35
  $parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
34
36
  $parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
35
37
  /*! Depict.ai search and product listing SDK */
36
- const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.41";
38
+ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.43";
37
39
 
38
40
 
39
41
 
@@ -867,7 +869,10 @@ function $8d94abc871e13baf$export$3925f87b1545cfc6({ plp_results_: plp_results_
867
869
  query_base_: query_base_,
868
870
  observe_for_counting_: observe_for_counting_,
869
871
  start_cursor_: current_cursor
870
- }) : (items)=>(observe_for_counting_(items), items);
872
+ }) : function(items) {
873
+ observe_for_counting_(items);
874
+ return items;
875
+ };
871
876
  // create owner to run product cards with an Owner, so they know when they've gotten removed
872
877
  const [owner_for_cards, dispose_our_cards] = (0, $46MJV$solidjs.createRoot)((dispose)=>[
873
878
  (0, $46MJV$solidjs.getOwner)(),
@@ -1038,7 +1043,7 @@ async function $8d94abc871e13baf$var$insert_placeholders({ scroll_restoration_da
1038
1043
  {
1039
1044
  page_url: "javascript:void(0)"
1040
1045
  }
1041
- ]
1046
+ ] // This later gets ignored and turned into `null` by the SDK functions in the @depict-ai/ui package
1042
1047
  });
1043
1048
  const element = elements?.find((e)=>e instanceof HTMLElement || e instanceof SVGElement);
1044
1049
  if (!element) return [];
@@ -1130,7 +1135,7 @@ function $557269f7f9c4f20e$export$6c6d7a51fa9aa15d(props) {
1130
1135
  await expand(0, do_duration);
1131
1136
  } else {
1132
1137
  const animation = await collapse();
1133
- animation.addEventListener("finish", (0, $46MJV$depictaiutilishared.catchify)(()=>details_.open = false));
1138
+ animation?.addEventListener("finish", (0, $46MJV$depictaiutilishared.catchify)(()=>details_.open = false));
1134
1139
  }
1135
1140
  }));
1136
1141
  details_.addEventListener("toggle", (0, $46MJV$depictaiutilishared.catchify)(()=>{
@@ -5050,7 +5055,10 @@ function $068a627cc18f7bb6$export$e2bf8ce7779e827e({ depict_category: depict_cat
5050
5055
  ...grid_spacing_override
5051
5056
  },
5052
5057
  rr_options_: {
5053
- template: product_card_template
5058
+ template: (display, info)=>{
5059
+ const is_placeholder = info.rendering_options.type === "placeholder";
5060
+ return product_card_template(is_placeholder ? null : display, info);
5061
+ }
5054
5062
  }
5055
5063
  });
5056
5064
  }, "Entire CategoryPage failed");
@@ -5507,12 +5515,14 @@ function $9f81b7ced87aabf2$export$7de92c4c2205ebf3({ depict_api_: depict_api_ ,
5507
5515
  const rendering_result = await (await (0, $46MJV$depictaiutilishared.make_placeholder_rr)({
5508
5516
  // render the max amount of elements that there could be, to make sure scroll restoration works (placeholders can't be shorter than actual content)
5509
5517
  num_items: (0, $39d15a684cb3e309$export$6c9030e511152266) + (0, $46MJV$solidjs.untrack)(get_showing_recommendation_rows) * Math.max(...layout_options_.cols_at_size.map(([per_column])=>per_column))
5510
- }))(tenant_object_, {
5518
+ }))(tenant_object_, // @ts-ignore - make_placeholder_rr types is a touchy subject
5519
+ {
5511
5520
  type: "search_recs",
5512
5521
  recs: recs_promise,
5513
5522
  ...rr_options_,
5514
5523
  ...typeof rr_options_.template === "function" ? {
5515
5524
  template: (...args)=>(0, $46MJV$solidjs.runWithOwner)(owner_for_cards, ()=>// give template the possibility to know when it gets removed from the DOM by using solid-js onCleanup
5525
+ // @ts-ignore
5516
5526
  rr_options_.template(...args))
5517
5527
  } : {}
5518
5528
  });
@@ -5672,7 +5682,7 @@ function $ad118c2ba257d9b7$export$84bba84a7b837187(search_query) {
5672
5682
  if (ls[key] !== json_encoded) ls[key] = json_encoded;
5673
5683
  }));
5674
5684
  (0, $46MJV$solidjs.createComputed)((0, $46MJV$depictaiutilishared.catchify)(()=>{
5675
- const searches = (0, $46MJV$solidjs.untrack)((0, $46MJV$depictaiutilishared.catchify)(()=>read_previous_searches()));
5685
+ const searches = (0, $46MJV$solidjs.untrack)(read_previous_searches);
5676
5686
  const current_query = read_search_query();
5677
5687
  if (!current_query) // don't save no query in history
5678
5688
  return;
@@ -7343,6 +7353,29 @@ function $93779a41dce11249$export$a54ec244c8863715(opts) {
7343
7353
 
7344
7354
 
7345
7355
 
7356
+
7357
+ function $94360f5c066c55b9$export$bec48a3a3ca6bc09(aligner) {
7358
+ const style_element = document.createElement("style");
7359
+ document.head.append(style_element);
7360
+ const resize_observer = new ResizeObserver((0, $46MJV$depictaiutilishared.catchify)(()=>{
7361
+ const styles = (0, $d3c94b3b96557917$export$1233ca167bf71f9a)({
7362
+ ".depict.plp .depict-search-modal .query-input": {
7363
+ "height": `${aligner?.clientHeight}px`
7364
+ }
7365
+ });
7366
+ style_element.replaceChildren(styles);
7367
+ }));
7368
+ resize_observer.observe(aligner);
7369
+ const cleanup = ()=>{
7370
+ resize_observer.disconnect();
7371
+ style_element.remove();
7372
+ };
7373
+ return {
7374
+ cleanup: cleanup
7375
+ };
7376
+ }
7377
+
7378
+
7346
7379
  const $79fbf145b15af988$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$46MJV$solidjsweb.template)(`<div class="depict plp search"></div>`, 2);
7347
7380
  /**
7348
7381
  * Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
@@ -7629,7 +7662,10 @@ function $79fbf145b15af988$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
7629
7662
  width_: 6.46
7630
7663
  }),
7631
7664
  rr_options_: {
7632
- template: product_card_template,
7665
+ template: (display, info)=>{
7666
+ const is_placeholder = info.rendering_options.type === "placeholder";
7667
+ return product_card_template(is_placeholder ? null : display, info);
7668
+ },
7633
7669
  pre_processors: extra_depict_options?.pre_processors,
7634
7670
  post_processors: extra_depict_options?.post_processors
7635
7671
  },
@@ -7658,35 +7694,29 @@ function $79fbf145b15af988$export$b94867ecbd698f21({ depict_search: depict_searc
7658
7694
  },
7659
7695
  disabled_: true,
7660
7696
  field_element_ref_: (field)=>{
7661
- const handler = click_handler ?? (0, $46MJV$depictaiutilishared.catchify)(()=>{
7697
+ const style_props_ = (0, $46MJV$solidjs.createSignal)({
7698
+ position: "fixed"
7699
+ });
7700
+ const defaultHandler = (0, $46MJV$depictaiutilishared.catchify)(()=>{
7701
+ const { cleanup: cleanup } = $79fbf145b15af988$var$align_field_modal(style_props_, field, aligner_ref);
7702
+ const complete_modal_dispose_handler = ()=>{
7703
+ modal_dispose_handler?.();
7704
+ cleanup();
7705
+ };
7662
7706
  depict_search.modal_open = [
7663
7707
  {
7664
7708
  style_props_: style_props_
7665
7709
  },
7666
- modal_dispose_handler
7710
+ complete_modal_dispose_handler
7667
7711
  ];
7668
7712
  });
7713
+ const handler = click_handler ?? defaultHandler;
7669
7714
  field.addEventListener("click", handler);
7670
- (0, $46MJV$solidjs.onCleanup)(()=>field.removeEventListener("click", handler));
7715
+ (0, $46MJV$solidjs.onCleanup)(()=>{
7716
+ field.removeEventListener("click", handler);
7717
+ });
7671
7718
  }
7672
7719
  });
7673
- const style_props_ = (0, $46MJV$solidjs.createSignal)({
7674
- position: "fixed"
7675
- });
7676
- if (aligner_ref) {
7677
- const style_element = document.createElement("style");
7678
- document.head.append(style_element);
7679
- const resize_observer = new ResizeObserver((0, $46MJV$depictaiutilishared.catchify)(()=>{
7680
- const styles = (0, $d3c94b3b96557917$export$1233ca167bf71f9a)({
7681
- ".depict.plp .depict-search-modal .query-input": {
7682
- "height": `${aligner_ref?.clientHeight}px`
7683
- }
7684
- });
7685
- style_element.replaceChildren(styles);
7686
- }));
7687
- resize_observer.observe(aligner_ref);
7688
- (0, $67b60b572b7b7059$export$b3ad617e9036868)(style_props_, aligner_ref, undefined, false, "top");
7689
- } else (0, $67b60b572b7b7059$export$b3ad617e9036868)(style_props_, input);
7690
7720
  return [
7691
7721
  (()=>{
7692
7722
  const _el$ = $79fbf145b15af988$var$_tmpl$.cloneNode(true);
@@ -7697,6 +7727,25 @@ function $79fbf145b15af988$export$b94867ecbd698f21({ depict_search: depict_searc
7697
7727
  ];
7698
7728
  }, "SearchField failed");
7699
7729
  }
7730
+ function $79fbf145b15af988$var$align_field_modal(style_props_, input, aligner_ref) {
7731
+ return (0, $46MJV$solidjs.createRoot)((dispose)=>{
7732
+ if (aligner_ref) {
7733
+ const { cleanup: cleanup } = (0, $94360f5c066c55b9$export$bec48a3a3ca6bc09)(aligner_ref);
7734
+ (0, $67b60b572b7b7059$export$b3ad617e9036868)(style_props_, aligner_ref, undefined, false, "top");
7735
+ return {
7736
+ cleanup: ()=>{
7737
+ cleanup();
7738
+ dispose();
7739
+ }
7740
+ };
7741
+ } else {
7742
+ (0, $67b60b572b7b7059$export$b3ad617e9036868)(style_props_, input);
7743
+ return {
7744
+ cleanup: dispose
7745
+ };
7746
+ }
7747
+ });
7748
+ }
7700
7749
 
7701
7750
 
7702
7751
 
@@ -7757,6 +7806,7 @@ function $d589470b68ce5b67$export$689e204eadb33baf(pr) {
7757
7806
 
7758
7807
 
7759
7808
 
7809
+
7760
7810
  class $37e96a5ebc768cc7$export$3ccaa27d81dd8556 extends EventTarget {
7761
7811
  #stop_listening;
7762
7812
  #disconnect_observer;
package/dist/module.js CHANGED
@@ -1,9 +1,10 @@
1
+ const process = { env: {} }; // In case that the code using this wasn't built with "node emulation", just make process.env accesses become undefined.
1
2
  import {dlog as $g9l4l$dlog, fetch_recs as $g9l4l$fetch_recs, snakeCasifyObject as $g9l4l$snakeCasifyObject, GenericSliderArrowButton as $g9l4l$GenericSliderArrowButton, catchify as $g9l4l$catchify, base_url as $g9l4l$base_url, get_depict_id as $g9l4l$get_depict_id, get_user_id as $g9l4l$get_user_id, get_session_id as $g9l4l$get_session_id, make_url_with_query_params as $g9l4l$make_url_with_query_params, fetch_retry as $g9l4l$fetch_retry, sort_obj as $g9l4l$sort_obj, version as $g9l4l$version, Tenant as $g9l4l$Tenant, Placeholder as $g9l4l$Placeholder, report as $g9l4l$report, javascript_media_query as $g9l4l$javascript_media_query, standard_price_format as $g9l4l$standard_price_format, deparallelize_no_drop as $g9l4l$deparallelize_no_drop, default_rr as $g9l4l$default_rr, make_random_classname as $g9l4l$make_random_classname, n_col_styling_with_dist as $g9l4l$n_col_styling_with_dist, observer as $g9l4l$observer, Lazyfier as $g9l4l$Lazyfier, queueMacroTask as $g9l4l$queueMacroTask, deparallelize as $g9l4l$deparallelize, Rec_Renderer as $g9l4l$Rec_Renderer, CrossIcon as $g9l4l$CrossIcon, useExpandingContainer as $g9l4l$useExpandingContainer, Amazing_Slider as $g9l4l$Amazing_Slider, slider_snap_css as $g9l4l$slider_snap_css, slider_fading_factory as $g9l4l$slider_fading_factory, MinusIcon as $g9l4l$MinusIcon, FilterIcon as $g9l4l$FilterIcon, SortIconAsc as $g9l4l$SortIconAsc, SortIconDesc as $g9l4l$SortIconDesc, PlusIcon as $g9l4l$PlusIcon, TickIcon as $g9l4l$TickIcon, ArrowUp as $g9l4l$ArrowUp, normal_get_product_id as $g9l4l$normal_get_product_id, ContainedPlaceholderImage as $g9l4l$ContainedPlaceholderImage, BackIcon as $g9l4l$BackIcon, SearchIcon as $g9l4l$SearchIcon, Layout as $g9l4l$Layout, make_placeholder_rr as $g9l4l$make_placeholder_rr, async_iterable_ipns as $g9l4l$async_iterable_ipns, make_asyncIterable_exiter as $g9l4l$make_asyncIterable_exiter, href_change_ipns as $g9l4l$href_change_ipns, depict_click as $g9l4l$depict_click, impression_track_element as $g9l4l$impression_track_element, add_new_tab_listener as $g9l4l$add_new_tab_listener, ContainedImage as $g9l4l$ContainedImage, buildThresholdList as $g9l4l$buildThresholdList, PreviousSearchIcon as $g9l4l$PreviousSearchIcon, insert_surfaces as $g9l4l$insert_surfaces} from "@depict-ai/utilishared";
2
3
  import {template as $g9l4l$template, insert as $g9l4l$insert, effect as $g9l4l$effect, setAttribute as $g9l4l$setAttribute, createComponent as $g9l4l$createComponent, use as $g9l4l$use, addEventListener as $g9l4l$addEventListener, delegateEvents as $g9l4l$delegateEvents, spread as $g9l4l$spread, memo as $g9l4l$memo, style as $g9l4l$style, mergeProps as $g9l4l$mergeProps, classList as $g9l4l$classList, className as $g9l4l$className} from "solid-js/web";
3
4
  import {createSignal as $g9l4l$createSignal, onCleanup as $g9l4l$onCleanup, createComputed as $g9l4l$createComputed, createEffect as $g9l4l$createEffect, untrack as $g9l4l$untrack, batch as $g9l4l$batch, createResource as $g9l4l$createResource, createMemo as $g9l4l$createMemo, Show as $g9l4l$Show, createRenderEffect as $g9l4l$createRenderEffect, runWithOwner as $g9l4l$runWithOwner, createRoot as $g9l4l$createRoot, getOwner as $g9l4l$getOwner, on as $g9l4l$on, Index as $g9l4l$Index, For as $g9l4l$For, ErrorBoundary as $g9l4l$ErrorBoundary} from "solid-js";
4
5
 
5
6
  /*! Depict.ai search and product listing SDK */
6
- const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.41";
7
+ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.43";
7
8
 
8
9
 
9
10
 
@@ -837,7 +838,10 @@ function $57363319986950eb$export$3925f87b1545cfc6({ plp_results_: plp_results_
837
838
  query_base_: query_base_,
838
839
  observe_for_counting_: observe_for_counting_,
839
840
  start_cursor_: current_cursor
840
- }) : (items)=>(observe_for_counting_(items), items);
841
+ }) : function(items) {
842
+ observe_for_counting_(items);
843
+ return items;
844
+ };
841
845
  // create owner to run product cards with an Owner, so they know when they've gotten removed
842
846
  const [owner_for_cards, dispose_our_cards] = (0, $g9l4l$createRoot)((dispose)=>[
843
847
  (0, $g9l4l$getOwner)(),
@@ -1008,7 +1012,7 @@ async function $57363319986950eb$var$insert_placeholders({ scroll_restoration_da
1008
1012
  {
1009
1013
  page_url: "javascript:void(0)"
1010
1014
  }
1011
- ]
1015
+ ] // This later gets ignored and turned into `null` by the SDK functions in the @depict-ai/ui package
1012
1016
  });
1013
1017
  const element = elements?.find((e)=>e instanceof HTMLElement || e instanceof SVGElement);
1014
1018
  if (!element) return [];
@@ -1100,7 +1104,7 @@ function $7d4ae726763dc6bc$export$6c6d7a51fa9aa15d(props) {
1100
1104
  await expand(0, do_duration);
1101
1105
  } else {
1102
1106
  const animation = await collapse();
1103
- animation.addEventListener("finish", (0, $g9l4l$catchify)(()=>details_.open = false));
1107
+ animation?.addEventListener("finish", (0, $g9l4l$catchify)(()=>details_.open = false));
1104
1108
  }
1105
1109
  }));
1106
1110
  details_.addEventListener("toggle", (0, $g9l4l$catchify)(()=>{
@@ -5020,7 +5024,10 @@ function $ec52ef1e6c117813$export$e2bf8ce7779e827e({ depict_category: depict_cat
5020
5024
  ...grid_spacing_override
5021
5025
  },
5022
5026
  rr_options_: {
5023
- template: product_card_template
5027
+ template: (display, info)=>{
5028
+ const is_placeholder = info.rendering_options.type === "placeholder";
5029
+ return product_card_template(is_placeholder ? null : display, info);
5030
+ }
5024
5031
  }
5025
5032
  });
5026
5033
  }, "Entire CategoryPage failed");
@@ -5477,12 +5484,14 @@ function $aee0c68312d971f4$export$7de92c4c2205ebf3({ depict_api_: depict_api_ ,
5477
5484
  const rendering_result = await (await (0, $g9l4l$make_placeholder_rr)({
5478
5485
  // render the max amount of elements that there could be, to make sure scroll restoration works (placeholders can't be shorter than actual content)
5479
5486
  num_items: (0, $9679915780ee67c0$export$6c9030e511152266) + (0, $g9l4l$untrack)(get_showing_recommendation_rows) * Math.max(...layout_options_.cols_at_size.map(([per_column])=>per_column))
5480
- }))(tenant_object_, {
5487
+ }))(tenant_object_, // @ts-ignore - make_placeholder_rr types is a touchy subject
5488
+ {
5481
5489
  type: "search_recs",
5482
5490
  recs: recs_promise,
5483
5491
  ...rr_options_,
5484
5492
  ...typeof rr_options_.template === "function" ? {
5485
5493
  template: (...args)=>(0, $g9l4l$runWithOwner)(owner_for_cards, ()=>// give template the possibility to know when it gets removed from the DOM by using solid-js onCleanup
5494
+ // @ts-ignore
5486
5495
  rr_options_.template(...args))
5487
5496
  } : {}
5488
5497
  });
@@ -5642,7 +5651,7 @@ function $4d62f5daa51642fe$export$84bba84a7b837187(search_query) {
5642
5651
  if (ls[key] !== json_encoded) ls[key] = json_encoded;
5643
5652
  }));
5644
5653
  (0, $g9l4l$createComputed)((0, $g9l4l$catchify)(()=>{
5645
- const searches = (0, $g9l4l$untrack)((0, $g9l4l$catchify)(()=>read_previous_searches()));
5654
+ const searches = (0, $g9l4l$untrack)(read_previous_searches);
5646
5655
  const current_query = read_search_query();
5647
5656
  if (!current_query) // don't save no query in history
5648
5657
  return;
@@ -7313,6 +7322,29 @@ function $b76e8f62b1f313ef$export$a54ec244c8863715(opts) {
7313
7322
 
7314
7323
 
7315
7324
 
7325
+
7326
+ function $9783d52321be38fe$export$bec48a3a3ca6bc09(aligner) {
7327
+ const style_element = document.createElement("style");
7328
+ document.head.append(style_element);
7329
+ const resize_observer = new ResizeObserver((0, $g9l4l$catchify)(()=>{
7330
+ const styles = (0, $246aa49a8f85c7f3$export$1233ca167bf71f9a)({
7331
+ ".depict.plp .depict-search-modal .query-input": {
7332
+ "height": `${aligner?.clientHeight}px`
7333
+ }
7334
+ });
7335
+ style_element.replaceChildren(styles);
7336
+ }));
7337
+ resize_observer.observe(aligner);
7338
+ const cleanup = ()=>{
7339
+ resize_observer.disconnect();
7340
+ style_element.remove();
7341
+ };
7342
+ return {
7343
+ cleanup: cleanup
7344
+ };
7345
+ }
7346
+
7347
+
7316
7348
  const $540e930c58500cbe$var$_tmpl$ = /*@__PURE__*/ (0, /*@__PURE__*/$g9l4l$template)(`<div class="depict plp search"></div>`, 2);
7317
7349
  /**
7318
7350
  * Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
@@ -7599,7 +7631,10 @@ function $540e930c58500cbe$export$f2dc7e4e4aa11abb({ depict_search: depict_searc
7599
7631
  width_: 6.46
7600
7632
  }),
7601
7633
  rr_options_: {
7602
- template: product_card_template,
7634
+ template: (display, info)=>{
7635
+ const is_placeholder = info.rendering_options.type === "placeholder";
7636
+ return product_card_template(is_placeholder ? null : display, info);
7637
+ },
7603
7638
  pre_processors: extra_depict_options?.pre_processors,
7604
7639
  post_processors: extra_depict_options?.post_processors
7605
7640
  },
@@ -7628,35 +7663,29 @@ function $540e930c58500cbe$export$b94867ecbd698f21({ depict_search: depict_searc
7628
7663
  },
7629
7664
  disabled_: true,
7630
7665
  field_element_ref_: (field)=>{
7631
- const handler = click_handler ?? (0, $g9l4l$catchify)(()=>{
7666
+ const style_props_ = (0, $g9l4l$createSignal)({
7667
+ position: "fixed"
7668
+ });
7669
+ const defaultHandler = (0, $g9l4l$catchify)(()=>{
7670
+ const { cleanup: cleanup } = $540e930c58500cbe$var$align_field_modal(style_props_, field, aligner_ref);
7671
+ const complete_modal_dispose_handler = ()=>{
7672
+ modal_dispose_handler?.();
7673
+ cleanup();
7674
+ };
7632
7675
  depict_search.modal_open = [
7633
7676
  {
7634
7677
  style_props_: style_props_
7635
7678
  },
7636
- modal_dispose_handler
7679
+ complete_modal_dispose_handler
7637
7680
  ];
7638
7681
  });
7682
+ const handler = click_handler ?? defaultHandler;
7639
7683
  field.addEventListener("click", handler);
7640
- (0, $g9l4l$onCleanup)(()=>field.removeEventListener("click", handler));
7684
+ (0, $g9l4l$onCleanup)(()=>{
7685
+ field.removeEventListener("click", handler);
7686
+ });
7641
7687
  }
7642
7688
  });
7643
- const style_props_ = (0, $g9l4l$createSignal)({
7644
- position: "fixed"
7645
- });
7646
- if (aligner_ref) {
7647
- const style_element = document.createElement("style");
7648
- document.head.append(style_element);
7649
- const resize_observer = new ResizeObserver((0, $g9l4l$catchify)(()=>{
7650
- const styles = (0, $246aa49a8f85c7f3$export$1233ca167bf71f9a)({
7651
- ".depict.plp .depict-search-modal .query-input": {
7652
- "height": `${aligner_ref?.clientHeight}px`
7653
- }
7654
- });
7655
- style_element.replaceChildren(styles);
7656
- }));
7657
- resize_observer.observe(aligner_ref);
7658
- (0, $079defea521d5e2a$export$b3ad617e9036868)(style_props_, aligner_ref, undefined, false, "top");
7659
- } else (0, $079defea521d5e2a$export$b3ad617e9036868)(style_props_, input);
7660
7689
  return [
7661
7690
  (()=>{
7662
7691
  const _el$ = $540e930c58500cbe$var$_tmpl$.cloneNode(true);
@@ -7667,6 +7696,25 @@ function $540e930c58500cbe$export$b94867ecbd698f21({ depict_search: depict_searc
7667
7696
  ];
7668
7697
  }, "SearchField failed");
7669
7698
  }
7699
+ function $540e930c58500cbe$var$align_field_modal(style_props_, input, aligner_ref) {
7700
+ return (0, $g9l4l$createRoot)((dispose)=>{
7701
+ if (aligner_ref) {
7702
+ const { cleanup: cleanup } = (0, $9783d52321be38fe$export$bec48a3a3ca6bc09)(aligner_ref);
7703
+ (0, $079defea521d5e2a$export$b3ad617e9036868)(style_props_, aligner_ref, undefined, false, "top");
7704
+ return {
7705
+ cleanup: ()=>{
7706
+ cleanup();
7707
+ dispose();
7708
+ }
7709
+ };
7710
+ } else {
7711
+ (0, $079defea521d5e2a$export$b3ad617e9036868)(style_props_, input);
7712
+ return {
7713
+ cleanup: dispose
7714
+ };
7715
+ }
7716
+ });
7717
+ }
7670
7718
 
7671
7719
 
7672
7720
 
@@ -7727,6 +7775,7 @@ function $36316d7b4c897a03$export$689e204eadb33baf(pr) {
7727
7775
 
7728
7776
 
7729
7777
 
7778
+
7730
7779
  class $ba6c9609228edf6b$export$3ccaa27d81dd8556 extends EventTarget {
7731
7780
  #stop_listening;
7732
7781
  #disconnect_observer;
@@ -7827,4 +7876,4 @@ class $ba6c9609228edf6b$export$3ccaa27d81dd8556 extends EventTarget {
7827
7876
  (0, $g9l4l$dlog)("@depict-ai/ui version", (0, $18bf1d29fb889cca$export$83d89fbfd8236492));
7828
7877
 
7829
7878
 
7830
- export {$e95f1855a5e3864f$export$58e808b1db15d3bc as fetchDepictRecommendations, $ec52ef1e6c117813$export$de035477d6fef996 as QuickLinks, $ec52ef1e6c117813$export$5b7c3ce0ebe51f86 as BreadCrumbs, $6340962f8bafd049$export$b91cec6bdc6b32a1 as CategoryTitle, $9b693ea3ff420de6$export$824dde41348efed1 as embedded_num_products, $80a49d3809ecb080$export$643598a327b5833e as get_categories, $ec52ef1e6c117813$export$f34314aa9505732e as DepictCategory, $ec52ef1e6c117813$export$e2bf8ce7779e827e as CategoryPage, $540e930c58500cbe$export$ac6237957a15b3f0 as DepictSearch, $540e930c58500cbe$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $540e930c58500cbe$export$f2dc7e4e4aa11abb as SearchPage, $540e930c58500cbe$export$b94867ecbd698f21 as SearchField, $aaacfac0064e97d9$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $079defea521d5e2a$export$b3ad617e9036868 as align_field, $246aa49a8f85c7f3$export$1233ca167bf71f9a as styles_to_valid_css_string, $a1123c5ed9b0ee29$export$fe334901e8bebd57 as disable_scrolling, $a3e81b85527bc866$export$d0596b5cae35ad4 as open_search_with_shift_slash, $972ebf2641490830$export$26df08e242fe83a3 as push_state_with_query_param_value, $3846bb34098c738f$export$e015ed2f2950f2e3 as DepictAPI, $f22123a20b6b80b3$export$2cefb7e61fcbae00 as add_to_version_info, $fefe7683325039b3$export$d9f36cf74e24d595 as media_query_to_accessor, $36316d7b4c897a03$export$689e204eadb33baf as setup_fast_leave, $886fa987db4f3805$export$5196e4c01fa56fcb as show_toast, $5178263ed1e394ca$export$469c7af753d08925 as solid_format_price, $ba6c9609228edf6b$export$3ccaa27d81dd8556 as PageReplacer, $18bf1d29fb889cca$export$83d89fbfd8236492 as version};
7879
+ export {$e95f1855a5e3864f$export$58e808b1db15d3bc as fetchDepictRecommendations, $ec52ef1e6c117813$export$de035477d6fef996 as QuickLinks, $ec52ef1e6c117813$export$5b7c3ce0ebe51f86 as BreadCrumbs, $6340962f8bafd049$export$b91cec6bdc6b32a1 as CategoryTitle, $9b693ea3ff420de6$export$824dde41348efed1 as embedded_num_products, $80a49d3809ecb080$export$643598a327b5833e as get_categories, $ec52ef1e6c117813$export$f34314aa9505732e as DepictCategory, $ec52ef1e6c117813$export$e2bf8ce7779e827e as CategoryPage, $540e930c58500cbe$export$ac6237957a15b3f0 as DepictSearch, $540e930c58500cbe$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $540e930c58500cbe$export$f2dc7e4e4aa11abb as SearchPage, $540e930c58500cbe$export$b94867ecbd698f21 as SearchField, $aaacfac0064e97d9$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $079defea521d5e2a$export$b3ad617e9036868 as align_field, $246aa49a8f85c7f3$export$1233ca167bf71f9a as styles_to_valid_css_string, $a1123c5ed9b0ee29$export$fe334901e8bebd57 as disable_scrolling, $a3e81b85527bc866$export$d0596b5cae35ad4 as open_search_with_shift_slash, $972ebf2641490830$export$26df08e242fe83a3 as push_state_with_query_param_value, $3846bb34098c738f$export$e015ed2f2950f2e3 as DepictAPI, $f22123a20b6b80b3$export$2cefb7e61fcbae00 as add_to_version_info, $fefe7683325039b3$export$d9f36cf74e24d595 as media_query_to_accessor, $36316d7b4c897a03$export$689e204eadb33baf as setup_fast_leave, $886fa987db4f3805$export$5196e4c01fa56fcb as show_toast, $5178263ed1e394ca$export$469c7af753d08925 as solid_format_price, $9783d52321be38fe$export$bec48a3a3ca6bc09 as connect_query_input_height_to_aligner_height, $ba6c9609228edf6b$export$3ccaa27d81dd8556 as PageReplacer, $18bf1d29fb889cca$export$83d89fbfd8236492 as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": [
6
6
  "src/index.ts",
@@ -82,7 +82,7 @@
82
82
  "ts-jest": "^29.0.3"
83
83
  },
84
84
  "dependencies": {
85
- "@depict-ai/utilishared": "^0.0.39",
85
+ "@depict-ai/utilishared": "^0.0.41",
86
86
  "solid-js": "^1.6.2"
87
87
  },
88
88
  "types": "dist/index.d.ts"