@depict-ai/ui 1.4.22 → 1.4.23
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 +692 -495
- package/ES10/index.d.ts +131 -74
- package/ES10/index.js +694 -499
- package/latest/index.cjs +654 -470
- package/latest/index.d.ts +131 -74
- package/latest/index.js +656 -474
- package/package.json +4 -4
- package/server/ES10/index.cjs +614 -436
- package/server/ES10/index.d.ts +131 -74
- package/server/ES10/index.js +616 -440
- package/server/latest/index.cjs +587 -422
- package/server/latest/index.d.ts +131 -74
- package/server/latest/index.js +589 -426
package/server/latest/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { JSX, Signal, Accessor, Setter } from "solid-js";
|
|
2
|
+
import { Display, report, ColsAtSize, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/latest";
|
|
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,135 @@ 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.
|
|
10
|
+
export const version = "1.4.23";
|
|
11
|
+
export type SDKGridSpacing = string | {
|
|
12
|
+
horizontal: string;
|
|
13
|
+
vertical: string;
|
|
14
|
+
};
|
|
15
|
+
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|
|
16
|
+
type FilterWithData = WithRequired<SearchFilter, "data">;
|
|
17
|
+
export interface SDKRenderingInfo {
|
|
18
|
+
set_on_index_change: (fn: (index: number) => void) => void;
|
|
19
|
+
merchant: string;
|
|
20
|
+
market: string;
|
|
21
|
+
}
|
|
22
|
+
export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
|
|
23
|
+
/**
|
|
24
|
+
* Will be sent to backend to indicate whether the query_id_ is for a collection or category.
|
|
25
|
+
* Backend defaults to category if not specified.
|
|
26
|
+
*/
|
|
27
|
+
export type ListingType = "collection" | "category";
|
|
28
|
+
type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
|
|
29
|
+
actual_field?: string;
|
|
30
|
+
})[] : never;
|
|
31
|
+
type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
|
|
32
|
+
declare class SDKError extends Error {}
|
|
33
|
+
export class ProductCardError extends SDKError {
|
|
34
|
+
constructor(templateError: Error);
|
|
35
|
+
}
|
|
36
|
+
export function SentryErrorBoundary(props: {
|
|
37
|
+
children: JSX.Element;
|
|
38
|
+
message_: string;
|
|
39
|
+
severity_: Parameters<typeof report>[1];
|
|
40
|
+
on_error_?: (retry: VoidFunction) => void;
|
|
41
|
+
class_list_?: string[];
|
|
42
|
+
}): JSX.Element;
|
|
43
|
+
export type SolidLayoutOptions = {
|
|
44
|
+
cols_at_size: ColsAtSize;
|
|
45
|
+
grid_spacing: string;
|
|
46
|
+
rows: {
|
|
47
|
+
start_rows?: number;
|
|
48
|
+
rows_per_click?: number;
|
|
49
|
+
currently_visible?: Signal<number>;
|
|
50
|
+
max_rows?: number;
|
|
51
|
+
button?: JSX.Element;
|
|
52
|
+
view_less_button?: JSX.Element;
|
|
53
|
+
} | "all";
|
|
54
|
+
layout: "slider" | "grid";
|
|
55
|
+
disable_partial_rows?: boolean;
|
|
56
|
+
override_vertical_spacing?: string;
|
|
57
|
+
children: JSX.Element;
|
|
58
|
+
element_attributes: JSX.HTMLAttributes<HTMLDivElement>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* 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.
|
|
62
|
+
* @property rows if set to 'all': Just generate grid styling without any viewing/hiding functionality. If an object: start_rows is the number of rows at the beginning. rows_per_click is the amount of rows to view on each view more button click. button is the view more button to display. currently_visible is a signal that you can use to get and set the number of currently viewed rows
|
|
63
|
+
* @property cols_at_size An array with sub arrays looking like this: `[n_cols, min_width_media_query, max_width_media_query, grid_spacing_for_size]`, everything after `[n_cols, min_width]` is optional. falsey value for `min_width = no min_width`
|
|
64
|
+
* @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
|
|
65
|
+
* @property disable_partial_rows If set to `true`, will not let user press "show more" if next row is a partial row. Example of partial row: `cols_at_size` says we should have 4 recs in the next row, but we only have 2 left, so the row just gets 2 instead of 4, meaning it doesn't "fill out".
|
|
66
|
+
* @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
|
|
67
|
+
* @return An accessor containing a CSS string
|
|
68
|
+
*/
|
|
69
|
+
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
|
+
/** @jsxImportSource solid-js */
|
|
78
|
+
export function GenericSliderArrowButton(props?: {
|
|
79
|
+
width_?: number;
|
|
80
|
+
height_?: number;
|
|
81
|
+
}): 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
|
+
type RecommendationSliderBaseProps<T extends Display> = {
|
|
90
|
+
grid_spacing: SDKGridSpacing;
|
|
91
|
+
cols_at_size: SDKColsAtSize;
|
|
92
|
+
recommendations: Promise<T[]>;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
|
|
96
|
+
* If no merchant or market is specified, the product cards won't get any merchant and market in their second argument.
|
|
97
|
+
*/
|
|
98
|
+
export function RecommendationSlider<T extends Display>(props: {
|
|
99
|
+
product_card_template: ProductCardTemplate<T>;
|
|
100
|
+
merchant: string;
|
|
101
|
+
market: string;
|
|
102
|
+
} & RecommendationSliderBaseProps<T>): any;
|
|
103
|
+
export function RecommendationSlider<T extends Display>(props: {
|
|
104
|
+
product_card_template: ModifiedProductCardTemplate<T>;
|
|
105
|
+
merchant?: never;
|
|
106
|
+
market?: never;
|
|
107
|
+
} & RecommendationSliderBaseProps<T>): any;
|
|
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>>;
|
|
115
|
+
type RecommendationGridBaseProps<T extends Display> = {
|
|
116
|
+
grid_spacing: SDKGridSpacing;
|
|
117
|
+
cols_at_size: SDKColsAtSize;
|
|
118
|
+
recommendations: Promise<T[]>;
|
|
119
|
+
view_more_button?: {
|
|
120
|
+
text: string;
|
|
121
|
+
start_rows?: number;
|
|
122
|
+
rows_per_click?: number;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
|
|
127
|
+
* If no merchant or market is specified, the product cards won't get any merchant and market in their second argument.
|
|
128
|
+
*/
|
|
129
|
+
export function RecommendationGrid<T extends Display>(props: {
|
|
130
|
+
product_card_template: ProductCardTemplate<T>;
|
|
131
|
+
merchant: string;
|
|
132
|
+
market: string;
|
|
133
|
+
} & RecommendationGridBaseProps<T>): any;
|
|
134
|
+
export function RecommendationGrid<T extends Display>(props: {
|
|
135
|
+
product_card_template: _ModifiedProductCardTemplate1<T>;
|
|
136
|
+
merchant?: never;
|
|
137
|
+
market?: never;
|
|
138
|
+
} & RecommendationGridBaseProps<T>): any;
|
|
11
139
|
/**
|
|
12
140
|
* Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
13
141
|
*/
|
|
@@ -39,17 +167,6 @@ export function ShopifyResponsiveImg({
|
|
|
39
167
|
export function ImageContainer(props: {
|
|
40
168
|
aspectRatio: number;
|
|
41
169
|
}): HTMLDivElement;
|
|
42
|
-
declare class SDKError extends Error {}
|
|
43
|
-
export class ProductCardError extends SDKError {
|
|
44
|
-
constructor(templateError: Error);
|
|
45
|
-
}
|
|
46
|
-
export function SentryErrorBoundary(props: {
|
|
47
|
-
children: JSX.Element;
|
|
48
|
-
message_: string;
|
|
49
|
-
severity_: Parameters<typeof report>[1];
|
|
50
|
-
on_error_?: (retry: VoidFunction) => void;
|
|
51
|
-
class_list_?: string[];
|
|
52
|
-
}): JSX.Element;
|
|
53
170
|
export function ExpandingDetails(props: {
|
|
54
171
|
details_: HTMLDetailsElement;
|
|
55
172
|
summary_: HTMLElement;
|
|
@@ -154,11 +271,6 @@ interface category_i18n extends plp_shared_i18n {
|
|
|
154
271
|
*/
|
|
155
272
|
/** For internal components using i18n that gets wrapped in solid's Accessors */
|
|
156
273
|
type solid_plp_shared_i18n = { [K in keyof plp_shared_i18n]: Accessor<plp_shared_i18n[K]> };
|
|
157
|
-
/** @jsxImportSource solid-js */
|
|
158
|
-
export function GenericSliderArrowButton(props?: {
|
|
159
|
-
width_?: number;
|
|
160
|
-
height_?: number;
|
|
161
|
-
}): SVGElement;
|
|
162
274
|
export function show_toast({
|
|
163
275
|
children,
|
|
164
276
|
on_close_,
|
|
@@ -171,27 +283,6 @@ export function show_toast({
|
|
|
171
283
|
} & JSX.HTMLAttributes<HTMLDivElement>): {
|
|
172
284
|
close_toast_: VoidFunction;
|
|
173
285
|
};
|
|
174
|
-
export type SDKGridSpacing = string | {
|
|
175
|
-
horizontal: string;
|
|
176
|
-
vertical: string;
|
|
177
|
-
};
|
|
178
|
-
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|
|
179
|
-
type FilterWithData = WithRequired<SearchFilter, "data">;
|
|
180
|
-
export interface SDKRenderingInfo {
|
|
181
|
-
set_on_index_change: (fn: (index: number) => void) => void;
|
|
182
|
-
merchant: string;
|
|
183
|
-
market: string;
|
|
184
|
-
}
|
|
185
|
-
export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
|
|
186
|
-
/**
|
|
187
|
-
* Will be sent to backend to indicate whether the query_id_ is for a collection or category.
|
|
188
|
-
* Backend defaults to category if not specified.
|
|
189
|
-
*/
|
|
190
|
-
export type ListingType = "collection" | "category";
|
|
191
|
-
type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
|
|
192
|
-
actual_field?: string;
|
|
193
|
-
})[] : never;
|
|
194
|
-
type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
|
|
195
286
|
export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
|
|
196
287
|
export function SelectedFilters({
|
|
197
288
|
number_of_rendered_selected_filters_items_,
|
|
@@ -272,33 +363,6 @@ export function create_modified_filters({
|
|
|
272
363
|
}[]>;
|
|
273
364
|
local_filter_cache_: Signal<_SearchFilter1[]>;
|
|
274
365
|
}): void;
|
|
275
|
-
export type SolidLayoutOptions = {
|
|
276
|
-
cols_at_size: ColsAtSize;
|
|
277
|
-
grid_spacing: string;
|
|
278
|
-
rows: {
|
|
279
|
-
start_rows?: number;
|
|
280
|
-
rows_per_click?: number;
|
|
281
|
-
currently_visible?: Signal<number>;
|
|
282
|
-
max_rows?: number;
|
|
283
|
-
button?: JSX.Element;
|
|
284
|
-
view_less_button?: JSX.Element;
|
|
285
|
-
} | "all";
|
|
286
|
-
layout: "slider" | "grid";
|
|
287
|
-
disable_partial_rows?: boolean;
|
|
288
|
-
override_vertical_spacing?: string;
|
|
289
|
-
children: JSX.Element;
|
|
290
|
-
element_attributes: JSX.HTMLAttributes<HTMLDivElement>;
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* Grid: Calculates CSS for a grid with a certain spacing and certain number of columns at certain screen sizes, including a view more button. All properties are reactive.
|
|
294
|
-
* @property rows if set to 'all': Just generate grid styling without any viewing/hiding functionality. If an object: start_rows is the number of rows at the beginning. rows_per_click is the amount of rows to view on each view more button click. button is the view more button to display. currently_visible is a signal that you can use to get and set the number of currently viewed rows
|
|
295
|
-
* @property cols_at_size An array with sub arrays looking like this: `[n_cols, min_width_media_query, max_width_media_query, grid_spacing_for_size]`, everything after `[n_cols, min_width]` is optional. falsey value for `min_width = no min_width`
|
|
296
|
-
* @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
|
|
297
|
-
* @property disable_partial_rows If set to `true`, will not let user press "show more" if next row is a partial row. Example of partial row: `cols_at_size` says we should have 4 recs in the next row, but we only have 2 left, so the row just gets 2 instead of 4, meaning it doesn't "fill out".
|
|
298
|
-
* @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
|
|
299
|
-
* @return An accessor containing a CSS string
|
|
300
|
-
*/
|
|
301
|
-
export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
|
|
302
366
|
type DisplayTransformerAlwaysThereData = {
|
|
303
367
|
merchant: string;
|
|
304
368
|
market: string;
|
|
@@ -549,13 +613,6 @@ export const embedded_num_products: ({
|
|
|
549
613
|
middle_elements_: Accessor<JSX.Element>;
|
|
550
614
|
on_filters_constructed_: () => void;
|
|
551
615
|
};
|
|
552
|
-
export type SDKColsAtSize = [number, number?][];
|
|
553
|
-
/**
|
|
554
|
-
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
555
|
-
* @param cols_at_size [nbCol, maxWidth]
|
|
556
|
-
* @returns
|
|
557
|
-
*/
|
|
558
|
-
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
559
616
|
type GeneralCategoryListingOptions = {
|
|
560
617
|
market: string;
|
|
561
618
|
merchant: string;
|