@depict-ai/ui 1.4.2 → 1.4.3

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
@@ -7,7 +7,7 @@ import { CategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/
7
7
  import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
8
8
  import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
9
9
  import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
10
- export const version = "1.4.2";
10
+ export const version = "1.4.3";
11
11
  export function ExpandingDetails(props: {
12
12
  details_: HTMLDetailsElement;
13
13
  summary_: HTMLElement;
@@ -142,6 +142,10 @@ export type ProductCardTemplate<T extends Display> = (display: T | null, info?:
142
142
  * Backend defaults to category if not specified.
143
143
  */
144
144
  export type ListingType = "collection" | "category";
145
+ type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
146
+ actual_field?: string;
147
+ })[] : never;
148
+ type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
145
149
  export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
146
150
  export function SelectedFilters({ number_of_rendered_selected_filters_items_, i18n_, selected_filters_, local_filter_cache_: [read_local_filter_cache], get_search_filters_open_, get_search_sorting_open_, local_filter_cache_, expanded_hierarchical_filters_, }: {
147
151
  get_search_filters_open_: Accessor<boolean>;
@@ -258,7 +262,7 @@ export type ModernDisplayWithPageUrl<T extends ModernDisplay> = {
258
262
  page_url: string;
259
263
  })[] : T[K];
260
264
  };
261
- type PageURLCreatorOptions<InputDisplay extends ModernDisplay> = (PageURLCreatorAlwaysThereData & (PageURLCreatorCategoryData | PageURLCreatorProductData<InputDisplay>));
265
+ type PageURLCreatorOptions<InputDisplay extends ModernDisplay> = PageURLCreatorAlwaysThereData & (PageURLCreatorCategoryData | PageURLCreatorProductData<InputDisplay>);
262
266
  /**
263
267
  * PageUrlCreator is, in its most basic form, a function that takes in a list of categories or products and returns a list of page_urls for the provided categories or products.
264
268
  * It's main use case is to allow for the creation of links to the product or category pages on the merchant's site.
@@ -380,7 +384,7 @@ type AddPageUrlToDisplay<T extends any[]> = (T[number] & {
380
384
  page_url: string;
381
385
  })[];
382
386
  type SearchResponseAfterURLCreator = {
383
- [K in keyof SearchResponse]: K extends "displays" ? AddPageUrlToDisplay<SearchResponse[K]> : SearchResponse[K];
387
+ [K in keyof SearchResponse]: K extends "displays" ? AddPageUrlToDisplay<SearchResponse[K]> : K extends "filters" ? AddActualFieldToFilters<SearchResponse[K]> : SearchResponse[K];
384
388
  };
385
389
  type BaseCategoryDisplayAfterURLCreator = BaseCategoryDisplay & {
386
390
  page_url: string;
@@ -390,7 +394,7 @@ type _AddPageUrlToDisplay1<T extends any[]> = (T[number] & {
390
394
  page_url: string;
391
395
  })[];
392
396
  type ProductListingResponseAfterURLCreator = {
393
- [K in keyof ProductListingResponse]: K extends "displays" ? _AddPageUrlToDisplay1<ProductListingResponse[K]> : K extends "breadcrumb" | "quick_links" ? ReplaceBaseCategoryDisplay<ProductListingResponse[K]> : ProductListingResponse[K];
397
+ [K in keyof ProductListingResponse]: K extends "displays" ? _AddPageUrlToDisplay1<ProductListingResponse[K]> : K extends "breadcrumb" | "quick_links" ? ReplaceBaseCategoryDisplay<ProductListingResponse[K]> : K extends "filters" ? AddActualFieldToFilters<ProductListingResponse[K]> : ProductListingResponse[K];
394
398
  };
395
399
  type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
396
400
  get_metadata?: () => Promise<{