@depict-ai/ui 1.4.25 → 2.0.0
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/ES10/index.cjs +231 -170
- package/ES10/index.d.ts +27 -31
- package/ES10/index.js +233 -172
- package/README.md +2 -1
- package/latest/index.cjs +220 -166
- package/latest/index.d.ts +27 -31
- package/latest/index.js +222 -168
- package/locales/require.js +1152 -0
- package/package.json +7 -7
- package/server/ES10/index.cjs +190 -139
- package/server/ES10/index.d.ts +27 -31
- package/server/ES10/index.js +192 -141
- package/server/latest/index.cjs +180 -131
- package/server/latest/index.d.ts +27 -31
- package/server/latest/index.js +182 -133
package/ES10/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX, Signal, Accessor, Setter } from "solid-js";
|
|
2
|
-
import { Display,
|
|
2
|
+
import { Display, ColsAtSize, report, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/ES10";
|
|
3
3
|
import { SearchFilter, SearchRequest } from "@depict-ai/types/api/SearchRequest";
|
|
4
4
|
import { SearchFilter as _SearchFilter1, ContentLink, SearchResponse } from "@depict-ai/types/api/SearchResponse";
|
|
5
5
|
import { BaseCategoryDisplay, ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
|
|
@@ -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 = "
|
|
10
|
+
export const version = "2.0.0";
|
|
11
11
|
export type SDKGridSpacing = string | {
|
|
12
12
|
horizontal: string;
|
|
13
13
|
vertical: string;
|
|
@@ -15,11 +15,21 @@ export type SDKGridSpacing = string | {
|
|
|
15
15
|
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|
|
16
16
|
type FilterWithData = WithRequired<SearchFilter, "data">;
|
|
17
17
|
export interface SDKRenderingInfo {
|
|
18
|
+
/**
|
|
19
|
+
* If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
|
|
20
|
+
*/
|
|
18
21
|
set_on_index_change: (fn: (index: number) => void) => void;
|
|
19
22
|
merchant: string;
|
|
20
23
|
market: string;
|
|
21
24
|
}
|
|
22
25
|
export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
|
|
26
|
+
type WithoutMerchant<T> = T extends {
|
|
27
|
+
merchant: string;
|
|
28
|
+
} ? Omit<T, "merchant"> : T;
|
|
29
|
+
type WithoutMarket<T> = T extends {
|
|
30
|
+
market: string;
|
|
31
|
+
} ? Omit<T, "market"> : T;
|
|
32
|
+
export type ProductCardTemplateWithoutMerchantAndMarket<T extends Display> = (display: Parameters<ProductCardTemplate<T>>[0], info?: WithoutMerchant<WithoutMarket<SDKRenderingInfo>>) => ReturnType<ProductCardTemplate<T>>;
|
|
23
33
|
/**
|
|
24
34
|
* Will be sent to backend to indicate whether the query_id_ is for a collection or category.
|
|
25
35
|
* Backend defaults to category if not specified.
|
|
@@ -29,6 +39,13 @@ type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
|
|
|
29
39
|
actual_field?: string;
|
|
30
40
|
})[] : never;
|
|
31
41
|
type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
|
|
42
|
+
export type SDKColsAtSize = [number, number?][];
|
|
43
|
+
/**
|
|
44
|
+
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
45
|
+
* @param cols_at_size [nbCol, maxWidth]
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
32
49
|
declare class SDKError extends Error {}
|
|
33
50
|
export class ProductCardError extends SDKError {
|
|
34
51
|
constructor(templateError: Error);
|
|
@@ -55,7 +72,7 @@ export type SolidLayoutOptions = {
|
|
|
55
72
|
disable_partial_rows?: boolean;
|
|
56
73
|
override_vertical_spacing?: string;
|
|
57
74
|
children: JSX.Element;
|
|
58
|
-
element_attributes: JSX.HTMLAttributes<HTMLDivElement>;
|
|
75
|
+
element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
|
|
59
76
|
};
|
|
60
77
|
/**
|
|
61
78
|
* SolidLayout: SolidJS adaption of Layout. Calculates CSS for a grid or slider with a certain spacing and certain number of columns at certain screen sizes, including a view more button. All properties are reactive.
|
|
@@ -67,25 +84,11 @@ export type SolidLayoutOptions = {
|
|
|
67
84
|
* @return An accessor containing a CSS string
|
|
68
85
|
*/
|
|
69
86
|
export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
|
|
70
|
-
export type SDKColsAtSize = [number, number?][];
|
|
71
|
-
/**
|
|
72
|
-
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
73
|
-
* @param cols_at_size [nbCol, maxWidth]
|
|
74
|
-
* @returns
|
|
75
|
-
*/
|
|
76
|
-
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
77
87
|
/** @jsxImportSource solid-js */
|
|
78
88
|
export function GenericSliderArrowButton(props?: {
|
|
79
89
|
width_?: number;
|
|
80
90
|
height_?: number;
|
|
81
91
|
}): SVGElement;
|
|
82
|
-
type WithoutMerchant<T> = T extends {
|
|
83
|
-
merchant: string;
|
|
84
|
-
} ? Omit<T, "merchant"> : T;
|
|
85
|
-
type WithoutMarket<T> = T extends {
|
|
86
|
-
market: string;
|
|
87
|
-
} ? Omit<T, "market"> : T;
|
|
88
|
-
type ModifiedProductCardTemplate<T extends Display> = (display: Parameters<ProductCardTemplate<T>>[0], info?: WithoutMerchant<WithoutMarket<SDKRenderingInfo>>) => ReturnType<ProductCardTemplate<T>>;
|
|
89
92
|
type RecommendationSliderBaseProps<T extends Display> = {
|
|
90
93
|
grid_spacing: SDKGridSpacing;
|
|
91
94
|
cols_at_size: SDKColsAtSize;
|
|
@@ -99,19 +102,12 @@ export function RecommendationSlider<T extends Display>(props: {
|
|
|
99
102
|
product_card_template: ProductCardTemplate<T>;
|
|
100
103
|
merchant: string;
|
|
101
104
|
market: string;
|
|
102
|
-
} & RecommendationSliderBaseProps<T>):
|
|
105
|
+
} & RecommendationSliderBaseProps<T>): HTMLDivElement;
|
|
103
106
|
export function RecommendationSlider<T extends Display>(props: {
|
|
104
|
-
product_card_template:
|
|
107
|
+
product_card_template: ProductCardTemplateWithoutMerchantAndMarket<T>;
|
|
105
108
|
merchant?: never;
|
|
106
109
|
market?: never;
|
|
107
|
-
} & RecommendationSliderBaseProps<T>):
|
|
108
|
-
type _WithoutMerchant1<T> = T extends {
|
|
109
|
-
merchant: string;
|
|
110
|
-
} ? Omit<T, "merchant"> : T;
|
|
111
|
-
type _WithoutMarket1<T> = T extends {
|
|
112
|
-
market: string;
|
|
113
|
-
} ? Omit<T, "market"> : T;
|
|
114
|
-
type _ModifiedProductCardTemplate1<T extends Display> = (display: Parameters<ProductCardTemplate<T>>[0], info?: _WithoutMerchant1<_WithoutMarket1<SDKRenderingInfo>>) => ReturnType<ProductCardTemplate<T>>;
|
|
110
|
+
} & RecommendationSliderBaseProps<T>): HTMLDivElement;
|
|
115
111
|
type RecommendationGridBaseProps<T extends Display> = {
|
|
116
112
|
grid_spacing: SDKGridSpacing;
|
|
117
113
|
cols_at_size: SDKColsAtSize;
|
|
@@ -130,12 +126,12 @@ export function RecommendationGrid<T extends Display>(props: {
|
|
|
130
126
|
product_card_template: ProductCardTemplate<T>;
|
|
131
127
|
merchant: string;
|
|
132
128
|
market: string;
|
|
133
|
-
} & RecommendationGridBaseProps<T>):
|
|
129
|
+
} & RecommendationGridBaseProps<T>): HTMLDivElement;
|
|
134
130
|
export function RecommendationGrid<T extends Display>(props: {
|
|
135
|
-
product_card_template:
|
|
131
|
+
product_card_template: ProductCardTemplateWithoutMerchantAndMarket<T>;
|
|
136
132
|
merchant?: never;
|
|
137
133
|
market?: never;
|
|
138
|
-
} & RecommendationGridBaseProps<T>):
|
|
134
|
+
} & RecommendationGridBaseProps<T>): HTMLDivElement;
|
|
139
135
|
/**
|
|
140
136
|
* Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
141
137
|
*/
|
|
@@ -824,7 +820,7 @@ interface SearchFieldParams {
|
|
|
824
820
|
click_handler?: (this: HTMLDivElement, ev: MouseEvent) => any;
|
|
825
821
|
aligner_ref?: HTMLElement | null;
|
|
826
822
|
}
|
|
827
|
-
export function SearchField(props: SearchFieldParams):
|
|
823
|
+
export function SearchField(props: SearchFieldParams): HTMLDivElement[];
|
|
828
824
|
export type BaseProviderConfig<InputDisplay extends Display, PossibleTransformedDisplay extends ModernDisplay | never> = {
|
|
829
825
|
/**
|
|
830
826
|
* The merchant to use for the search.
|