@depict-ai/ui 0.0.70 → 0.0.71

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
@@ -1,6 +1,5 @@
1
1
  import { Display, Elem, ColsAtSize, InfoForProcessing, Node_Array, RR_PostProcessor, RR_PreProcessor } from "@depict-ai/utilishared";
2
2
  import { Accessor, JSX, Setter, Signal } from "solid-js";
3
- import { search_i18n as _search_i18n1 } from "../../../locales";
4
3
  import { SearchResponse } from "@depict-ai/types/api/SearchResponse";
5
4
  import { SearchRequest, SearchFilter } from "@depict-ai/types/api/SearchRequest";
6
5
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
@@ -8,8 +7,7 @@ import { SearchSuggestionsResponse, CategorySuggestion } from "@depict-ai/types/
8
7
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
8
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
9
  import { ProductListingResponse, BaseCategoryDisplay } from "@depict-ai/types/api/ProductListingResponse";
11
- import { JSX as _JSX1 } from "solid-js/types/jsx";
12
- export const version = "0.0.70";
10
+ export const version = "0.0.71";
13
11
  type ExclusiveId = {
14
12
  categoryId: string;
15
13
  productId?: undefined;
@@ -152,7 +150,7 @@ interface category_i18n extends plp_shared_i18n {
152
150
  }
153
151
  export type InstantCard<T extends Display> = (display: T, context: {
154
152
  index: number;
155
- i18n: _search_i18n1;
153
+ i18n: search_i18n;
156
154
  merchant: string;
157
155
  market: string;
158
156
  }) => JSX.Element;
@@ -181,7 +179,7 @@ export function media_query_to_accessor(media_query: string): import("solid-js")
181
179
  export type WithRequired<T, K extends keyof T> = T & {
182
180
  [P in K]-?: T[P];
183
181
  };
184
- type SDKGridSpacing = string | {
182
+ export type SDKGridSpacing = string | {
185
183
  horizontal: string;
186
184
  vertical: string;
187
185
  };
@@ -227,7 +225,7 @@ export const embedded_num_products: ({ make_product_count_, set_observed_results
227
225
  middle_elements_: Accessor<JSX.Element>;
228
226
  on_filters_constructed_: () => void;
229
227
  };
230
- type SDKColsAtSize = [number, number?][];
228
+ export type SDKColsAtSize = [number, number?][];
231
229
  /**
232
230
  * Transform SDK ColsAtSize into valid Layout ColsAtSize
233
231
  * @param cols_at_size [nbCol, maxWidth]
@@ -280,13 +278,13 @@ export function DefaultInstantCardPlaceholder(): HTMLDivElement;
280
278
  * @param one_axies_only Usually align_field will align on top and left positioning and set the width. With one_axies_only it can be chosen to apart from setting width only align on top/left axis
281
279
  * @returns a function that can be called any time to re-run the alignment routine in case that the elements have gone out of alignment
282
280
  */
283
- export function align_field(modal_body_style: Signal<_JSX1.CSSProperties>, input_field: HTMLElement, width_transformer?: (arg0: number) => number, includeScroll?: boolean, one_axies_only?: "top" | "left"): () => void;
281
+ export function align_field(modal_body_style: Signal<JSX.CSSProperties>, input_field: HTMLElement, width_transformer?: (arg0: number) => number, includeScroll?: boolean, one_axies_only?: "top" | "left"): () => void;
284
282
  /**
285
283
  * Calls history.pushState wiht the current url BUT the query parameter with name url_param_name has been set to value (or deleted if no value is provided) and url_transformer has been executed on the URL object that we're pushing
286
284
  */
287
285
  export function push_state_with_query_param_value(url_param_name: string, value?: string, url_transformer?: (url_object: URL) => unknown): void;
288
286
  interface Styles {
289
- [selector: string]: _JSX1.CSSProperties;
287
+ [selector: string]: JSX.CSSProperties;
290
288
  }
291
289
  export const styles_to_valid_css_string: (styles: Styles) => string;
292
290
  /** A function that renders category suggestion cards. Set to false to disable category suggestions. */
@@ -318,7 +316,7 @@ type ConstructorOptions<T extends Display> = {
318
316
  };
319
317
  type OpenModalArguments = [
320
318
  options_for_modal?: {
321
- style_props_?: Signal<_JSX1.CSSProperties>;
319
+ style_props_?: Signal<JSX.CSSProperties>;
322
320
  closing_animation_?: () => Promise<any>;
323
321
  class_list_?: Accessor<Record<string, boolean>>;
324
322
  selected_text_range_?: readonly [number | null, number | null] | [number | null, number | null];
@@ -338,6 +336,7 @@ export class DepictSearch<T extends Display> {
338
336
  set merchant(tenant: string);
339
337
  get market(): string;
340
338
  set market(market: string);
339
+ fetchSearchResults(query: string, filters?: SearchFilter[]): Promise<T[]>;
341
340
  }
342
341
  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, }: {
343
342
  depict_search: DepictSearch<T>;
@@ -511,3 +510,4 @@ export class PageReplacer extends EventTarget {
511
510
  * makes so that links to the previous page close the search instead of closing the search and reloading the page (to be used with non-spas)
512
511
  */
513
512
  export function setup_fast_leave(pr: PageReplacer): void;
513
+ export type { SearchFilter } from "@depict-ai/types/api/SearchRequest";
package/dist/main.js CHANGED
@@ -35,7 +35,7 @@ $parcel$export(module.exports, "solid_format_price", () => $5fc9fc23df1591db$exp
35
35
  $parcel$export(module.exports, "connect_search_field_height_to_aligner_height", () => $246e3e89a097f014$export$828dcdd425fd3231);
36
36
  $parcel$export(module.exports, "PageReplacer", () => $37e96a5ebc768cc7$export$3ccaa27d81dd8556);
37
37
  $parcel$export(module.exports, "version", () => $ae93561d5649a847$export$83d89fbfd8236492);
38
- /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.70";
38
+ /*! Depict.ai search and product listing SDK */ const $ae93561d5649a847$export$83d89fbfd8236492 = "0.0.71";
39
39
 
40
40
 
41
41
 
@@ -7678,6 +7678,17 @@ class $79fbf145b15af988$export$ac6237957a15b3f0 {
7678
7678
  set market(market) {
7679
7679
  this.#market_signal[1](market);
7680
7680
  }
7681
+ async fetchSearchResults(query, filters) {
7682
+ const { depict_api_: depict_api_ } = $79fbf145b15af988$var$privately_shared_properties.get(this);
7683
+ const result = await depict_api_.query({
7684
+ tenant: this.merchant,
7685
+ market: this.market,
7686
+ query: query,
7687
+ filters: filters
7688
+ });
7689
+ if (result.failed) throw new Error("Failed to fetch search results");
7690
+ return result.displays;
7691
+ }
7681
7692
  }
7682
7693
  function $79fbf145b15af988$var$get_shared_properties(depict_search) {
7683
7694
  const shared_properties = $79fbf145b15af988$var$privately_shared_properties.get(depict_search);
package/dist/module.js CHANGED
@@ -2,7 +2,7 @@ import {add_to_version_info as $g9l4l$add_to_version_info, fetch_recs as $g9l4l$
2
2
  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, classList as $g9l4l$classList, memo as $g9l4l$memo, style as $g9l4l$style, mergeProps as $g9l4l$mergeProps, className as $g9l4l$className} from "solid-js/web";
3
3
  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, createReaction as $g9l4l$createReaction, on as $g9l4l$on, ErrorBoundary as $g9l4l$ErrorBoundary, Index as $g9l4l$Index, For as $g9l4l$For} from "solid-js";
4
4
 
5
- /*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.70";
5
+ /*! Depict.ai search and product listing SDK */ const $18bf1d29fb889cca$export$83d89fbfd8236492 = "0.0.71";
6
6
 
7
7
 
8
8
 
@@ -7645,6 +7645,17 @@ class $540e930c58500cbe$export$ac6237957a15b3f0 {
7645
7645
  set market(market) {
7646
7646
  this.#market_signal[1](market);
7647
7647
  }
7648
+ async fetchSearchResults(query, filters) {
7649
+ const { depict_api_: depict_api_ } = $540e930c58500cbe$var$privately_shared_properties.get(this);
7650
+ const result = await depict_api_.query({
7651
+ tenant: this.merchant,
7652
+ market: this.market,
7653
+ query: query,
7654
+ filters: filters
7655
+ });
7656
+ if (result.failed) throw new Error("Failed to fetch search results");
7657
+ return result.displays;
7658
+ }
7648
7659
  }
7649
7660
  function $540e930c58500cbe$var$get_shared_properties(depict_search) {
7650
7661
  const shared_properties = $540e930c58500cbe$var$privately_shared_properties.get(depict_search);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/ui",
3
- "version": "0.0.70",
3
+ "version": "0.0.71",
4
4
  "description": "Base package containing the actual UI of Depict UI along with translations, with a not-simplified API. We recommend using @depict-ai/js-ui or @depict-ai/react-ui instead.",
5
5
  "packageManager": "yarn@3.2.2",
6
6
  "source": [
@@ -84,9 +84,9 @@
84
84
  "ts-jest": "^29.0.3"
85
85
  },
86
86
  "dependencies": {
87
- "@depict-ai/plp-styling": "^0.0.31",
88
- "@depict-ai/types": "^0.0.22",
89
- "@depict-ai/utilishared": "^0.0.74",
87
+ "@depict-ai/plp-styling": "^0.0.32",
88
+ "@depict-ai/types": "^0.0.23",
89
+ "@depict-ai/utilishared": "^0.0.75",
90
90
  "solid-js": "^1.6.2"
91
91
  },
92
92
  "types": "dist/index.d.ts"