@depict-ai/ui 0.0.71 → 0.0.73

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
@@ -6,8 +6,8 @@ import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
6
6
  import { SearchSuggestionsResponse, CategorySuggestion } from "@depict-ai/types/api/SearchSuggestionsResponse";
7
7
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
8
8
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
9
- import { ProductListingResponse, BaseCategoryDisplay } from "@depict-ai/types/api/ProductListingResponse";
10
- export const version = "0.0.71";
9
+ import { ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
10
+ export const version = "0.0.73";
11
11
  type ExclusiveId = {
12
12
  categoryId: string;
13
13
  productId?: undefined;
@@ -176,13 +176,13 @@ export class DepictAPI {
176
176
  * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
177
177
  */
178
178
  export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
179
- export type WithRequired<T, K extends keyof T> = T & {
180
- [P in K]-?: T[P];
181
- };
182
179
  export type SDKGridSpacing = string | {
183
180
  horizontal: string;
184
181
  vertical: string;
185
182
  };
183
+ export type WithRequired<T, K extends keyof T> = T & {
184
+ [P in K]-?: T[P];
185
+ };
186
186
  export function show_toast({ children, on_close_, close_after_, ...more_attributes }: {
187
187
  children?: JSX.Element;
188
188
  close_after_: number;
@@ -200,6 +200,10 @@ export class ProductCardError extends SDKError {
200
200
  * @returns A cleanup function to manually re-enable scrolling.
201
201
  */
202
202
  export function disable_scrolling(): () => void;
203
+ type OnNavigation = ((options: {
204
+ is_replace: boolean;
205
+ new_url: URL;
206
+ }) => void) | "hard_navigation";
203
207
  export const CategoryTitle: ({ category_title_, product_count_, }: {
204
208
  category_title_: Accessor<string | undefined>;
205
209
  product_count_: JSX.Element;
@@ -236,7 +240,7 @@ type DepictCategoryConstructorOptions = {
236
240
  market: string;
237
241
  merchant: string;
238
242
  localization: category_i18n;
239
- on_navigation: (relative_url: string, ev: MouseEvent, display: BaseCategoryDisplay) => unknown;
243
+ on_navigation?: OnNavigation;
240
244
  api?: DepictAPI;
241
245
  };
242
246
  export class DepictCategory {
@@ -249,6 +253,8 @@ export class DepictCategory {
249
253
  set merchant(merchant: string);
250
254
  get market(): string;
251
255
  set market(market: string);
256
+ get on_navigation(): OnNavigation;
257
+ set on_navigation(new_function: OnNavigation);
252
258
  constructor({ api, on_navigation, ...props_on_class }: DepictCategoryConstructorOptions);
253
259
  }
254
260
  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, }: {
@@ -279,20 +285,12 @@ export function DefaultInstantCardPlaceholder(): HTMLDivElement;
279
285
  * @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
280
286
  */
281
287
  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;
282
- /**
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
284
- */
285
- export function push_state_with_query_param_value(url_param_name: string, value?: string, url_transformer?: (url_object: URL) => unknown): void;
286
288
  interface Styles {
287
289
  [selector: string]: JSX.CSSProperties;
288
290
  }
289
291
  export const styles_to_valid_css_string: (styles: Styles) => string;
290
292
  /** A function that renders category suggestion cards. Set to false to disable category suggestions. */
291
- export type RenderCategorySuggestion = (category_suggestion: Accessor<CategorySuggestion>, index: number, selected_filters_: Signal<{
292
- field: WithRequired<SearchFilter, "field">["field"];
293
- op: WithRequired<SearchFilter, "op">["op"];
294
- data: WithRequired<SearchFilter, "data">["data"];
295
- }[]>) => JSX.Element;
293
+ export type RenderCategorySuggestion = (category_suggestion: Accessor<CategorySuggestion>, index: number) => JSX.Element;
296
294
  /**
297
295
  * Connects the height of the search field to the height of the aligner.
298
296
  * @param aligner
@@ -306,7 +304,7 @@ type ConstructorOptions<T extends Display> = {
306
304
  market: string;
307
305
  merchant: string;
308
306
  localization: search_i18n;
309
- on_navigation?: (relative_url: string) => unknown;
307
+ on_navigation?: OnNavigation;
310
308
  url_transformer?: (url_object: URL) => unknown;
311
309
  enable_category_suggestions?: boolean;
312
310
  disable_scrolling_during_modal?: boolean;
@@ -327,7 +325,9 @@ type OpenModalArguments = [
327
325
  export const get_search_query_updating_blocked_signal: (depict_search: DepictSearch<any>) => Signal<boolean> | undefined;
328
326
  export class DepictSearch<T extends Display> {
329
327
  #private;
330
- 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>);
328
+ constructor({ search_query_url_param_name, url_transformer, on_navigation, enable_category_suggestions, disable_scrolling_during_modal, api, bottom_distance_under_modal_, render_instant_card, ...props_on_class }: ConstructorOptions<T>);
329
+ get on_navigation(): OnNavigation;
330
+ set on_navigation(new_function: OnNavigation);
331
331
  get localization(): search_i18n;
332
332
  set localization(locale_obj: search_i18n);
333
333
  get modal_open(): OpenModalArguments | boolean;
@@ -381,8 +381,8 @@ export type BaseSearchProviderConfig = {
381
381
  searchPagePath: string;
382
382
  /**
383
383
  * The name of the url parameter that will be used for the search query.
384
- * @example "q", "search_query"
385
- * @default "search_query"
384
+ * @example "q", "search_query", "query"
385
+ * @default "query"
386
386
  */
387
387
  urlParamName?: string;
388
388
  /**