@depict-ai/ui 1.0.5 → 1.0.6
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 +8 -2
- package/dist/main.js +1837 -1770
- package/dist/module.js +1803 -1739
- package/dist/typescript_schema/BaseSearchRequest.d.ts +197 -0
- package/dist/typescript_schema/ProductListingQueriesRequest.d.ts +14 -0
- package/dist/typescript_schema/ProductListingQueriesResponse.d.ts +10 -0
- package/dist/typescript_schema/ProductListingRequest.d.ts +221 -0
- package/dist/typescript_schema/ProductListingResponse.d.ts +232 -0
- package/dist/typescript_schema/RecommendResponse.d.ts +15 -0
- package/dist/typescript_schema/SearchRequest.d.ts +213 -0
- package/dist/typescript_schema/SearchResponse.d.ts +192 -0
- package/dist/typescript_schema/SearchSuggestionsRequest.d.ts +18 -0
- package/dist/typescript_schema/SearchSuggestionsResponse.d.ts +182 -0
- package/dist/typescript_schema/TrackV2Request.d.ts +115 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +130 -129
- package/locales/require.js +143 -141
- package/package.json +12 -8
- package/ssr/client/main.js +8363 -10769
- package/ssr/client/module.js +8396 -10710
- package/ssr/index.d.ts +345 -444
- package/ssr/server/main.js +7001 -8750
- package/ssr/server/module.js +6990 -8614
- package/tsconfig.json +1 -1
- package/.idea/GitLink.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/ui.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -53
package/ssr/index.d.ts
CHANGED
|
@@ -7,36 +7,35 @@ import { SearchSuggestionsResponse, CategorySuggestion } from "@depict-ai/types/
|
|
|
7
7
|
import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
|
|
8
8
|
import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
|
|
9
9
|
import { ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
|
|
10
|
-
export const version = "1.0.
|
|
11
|
-
export type OnNavigation = ((options: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
10
|
+
export const version = "1.0.5";
|
|
11
|
+
export type OnNavigation = ((options: {
|
|
12
|
+
is_replace: boolean;
|
|
13
|
+
new_url: URL;
|
|
14
|
+
}) => void) | "hard_navigation";
|
|
15
|
+
export type ExclusiveId = {
|
|
16
|
+
categoryId: string;
|
|
17
|
+
productId?: undefined;
|
|
18
|
+
productIds?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
categoryId?: undefined;
|
|
21
|
+
productId: string;
|
|
22
|
+
productIds?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
categoryId?: undefined;
|
|
25
|
+
productId?: undefined;
|
|
26
|
+
productIds: string[];
|
|
27
|
+
} | {
|
|
28
|
+
categoryId?: undefined;
|
|
29
|
+
productId?: undefined;
|
|
30
|
+
productIds?: undefined;
|
|
31
|
+
};
|
|
33
32
|
type RecsAPIWrapperOptions = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
type: string;
|
|
34
|
+
merchant: string;
|
|
35
|
+
market: string;
|
|
36
|
+
userId?: string;
|
|
37
|
+
sessionId?: string;
|
|
38
|
+
headers?: HeadersInit;
|
|
40
39
|
} & ExclusiveId;
|
|
41
40
|
/**
|
|
42
41
|
* Fetches recommendations from Depict's API.
|
|
@@ -74,231 +73,176 @@ type RecsAPIWrapperOptions = {
|
|
|
74
73
|
* ```
|
|
75
74
|
* @return This function is guaranteed to return an array of Displays. If anything fails, you will get an empty array.
|
|
76
75
|
*/
|
|
77
|
-
export function fetchDepictRecommendations<T extends Display = Display>({
|
|
78
|
-
merchant,
|
|
79
|
-
market,
|
|
80
|
-
headers,
|
|
81
|
-
...fetch_recs_options
|
|
82
|
-
}: RecsAPIWrapperOptions): Promise<T[]>;
|
|
76
|
+
export function fetchDepictRecommendations<T extends Display = Display>({ merchant, market, headers, ...fetch_recs_options }: RecsAPIWrapperOptions): Promise<T[]>;
|
|
83
77
|
/**
|
|
84
78
|
* Like standard_price_format except that the price and the formatting are reactive accessors
|
|
85
79
|
*/
|
|
86
80
|
export function SolidFormatPrice(props: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
price_: number;
|
|
82
|
+
price_formatting_: {
|
|
83
|
+
pre_: string;
|
|
84
|
+
post_: string;
|
|
85
|
+
decimal_places_delimiter_: string;
|
|
86
|
+
thousands_delimiter_: string;
|
|
87
|
+
places_after_comma_: number | "auto";
|
|
88
|
+
};
|
|
95
89
|
}): JSX.Element;
|
|
96
90
|
/**
|
|
97
91
|
* PLP internationalisation shared between search and category listing
|
|
98
92
|
*/
|
|
99
93
|
type plp_shared_i18n = {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
94
|
+
scroll_to_top_: string;
|
|
95
|
+
back_: string;
|
|
96
|
+
open_sorting_: string;
|
|
97
|
+
close_sorting_: string;
|
|
98
|
+
open_filters_: string;
|
|
99
|
+
close_filters_: string;
|
|
100
|
+
close_: string;
|
|
101
|
+
ok_: string;
|
|
102
|
+
filters_cleared_: string;
|
|
103
|
+
we_cleared_your_filters_: string;
|
|
104
|
+
restore_: string;
|
|
105
|
+
sorting_text_: string;
|
|
106
|
+
filter_text_: string;
|
|
107
|
+
selected_filters_title_: string;
|
|
108
|
+
filters_: string;
|
|
109
|
+
view_less_: string;
|
|
110
|
+
view_more_: string;
|
|
111
|
+
clear_all_from_filter_crumbs_: string;
|
|
112
|
+
clear_individual_filter_: string;
|
|
113
|
+
of_: string;
|
|
114
|
+
clear_all_filters_from_big_button_: string;
|
|
115
|
+
try_without_filters_: string;
|
|
116
|
+
range_filter_low_point_aria_label_: string;
|
|
117
|
+
range_filter_high_point_aria_label_: string;
|
|
118
|
+
morphing_sign_expanded_aria_label_: string;
|
|
119
|
+
morphing_sign_collapsed_aria_label_: string;
|
|
120
|
+
price_formatting_: {
|
|
121
|
+
pre_: string;
|
|
122
|
+
post_: string;
|
|
123
|
+
decimal_places_delimiter_: string;
|
|
124
|
+
thousands_delimiter_: string;
|
|
125
|
+
places_after_comma_: number | "auto";
|
|
126
|
+
};
|
|
133
127
|
};
|
|
134
128
|
/**
|
|
135
129
|
* Search internationalisation
|
|
136
130
|
*/
|
|
137
131
|
interface search_i18n extends plp_shared_i18n {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
132
|
+
placeholder_text_: string;
|
|
133
|
+
show_n_results_: (number_of_results: HTMLElement) => Elem[];
|
|
134
|
+
no_results_text_: string;
|
|
135
|
+
search_recs_title_: string;
|
|
136
|
+
clear_filters_query_sorting_after_submit_: string;
|
|
137
|
+
modal_view_all_results_: (number_of_results: HTMLElement) => Elem[];
|
|
138
|
+
modal_discover_more_: string;
|
|
139
|
+
get_showing_results_for_: (query: HTMLElement, number_of_results: HTMLElement) => Elem[];
|
|
140
|
+
previous_searches_text_: string;
|
|
141
|
+
category_: string;
|
|
142
|
+
suggestions_: string;
|
|
143
|
+
search_submit_button_aria_label_: string;
|
|
144
|
+
search_field_field_aria_label_: string;
|
|
145
|
+
previous_searches_delete_entry_from_history_: string;
|
|
152
146
|
}
|
|
153
147
|
/**
|
|
154
148
|
* Category internationalisation
|
|
155
149
|
*/
|
|
156
150
|
interface category_i18n extends plp_shared_i18n {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
show_n_products_: (number_of_results: HTMLElement) => Elem[];
|
|
152
|
+
no_products_text_: string;
|
|
153
|
+
product_: string;
|
|
154
|
+
products_: string;
|
|
155
|
+
breadcrumbs_aria_label_: string;
|
|
156
|
+
quicklinks_aria_label_: string;
|
|
157
|
+
breadcrumbs_separator_: string;
|
|
164
158
|
}
|
|
165
|
-
export type InstantCard<T extends Display> = (
|
|
166
|
-
display: T,
|
|
167
|
-
context: {
|
|
159
|
+
export type InstantCard<T extends Display> = (display: T, context: {
|
|
168
160
|
index: number;
|
|
169
161
|
i18n: search_i18n;
|
|
170
162
|
merchant: string;
|
|
171
163
|
market: string;
|
|
172
|
-
|
|
173
|
-
) => JSX.Element;
|
|
164
|
+
}) => JSX.Element;
|
|
174
165
|
interface DepictAPIConstructorOptions {
|
|
175
|
-
|
|
176
|
-
| {
|
|
166
|
+
get_metadata?: () => Promise<{
|
|
177
167
|
[k: string]: string;
|
|
178
|
-
|
|
179
|
-
| undefined
|
|
180
|
-
|
|
181
|
-
get_user_id?: () => string | undefined;
|
|
182
|
-
get_session_id?: () => string | undefined;
|
|
168
|
+
} | undefined>;
|
|
169
|
+
get_user_id?: () => string | undefined;
|
|
170
|
+
get_session_id?: () => string | undefined;
|
|
183
171
|
}
|
|
184
172
|
export class DepictAPI {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
failed?: true;
|
|
200
|
-
}
|
|
201
|
-
>;
|
|
202
|
-
get_recommended<D extends Display>(
|
|
203
|
-
input_req: BaseSearchRequest
|
|
204
|
-
): Promise<{
|
|
205
|
-
displays: D[];
|
|
206
|
-
}>;
|
|
173
|
+
#private;
|
|
174
|
+
constructor({ get_metadata, get_user_id, get_session_id }?: DepictAPIConstructorOptions);
|
|
175
|
+
suggest(input_req: SearchSuggestionsRequest): Promise<SearchSuggestionsResponse & {
|
|
176
|
+
failed?: true;
|
|
177
|
+
}>;
|
|
178
|
+
query(input_req: SearchRequest): Promise<SearchResponse & {
|
|
179
|
+
failed?: true;
|
|
180
|
+
}>;
|
|
181
|
+
list(input_req: ProductListingRequest): Promise<ProductListingResponse & {
|
|
182
|
+
failed?: true;
|
|
183
|
+
}>;
|
|
184
|
+
get_recommended<D extends Display>(input_req: BaseSearchRequest): Promise<{
|
|
185
|
+
displays: D[];
|
|
186
|
+
}>;
|
|
207
187
|
}
|
|
208
188
|
/**
|
|
209
189
|
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
210
190
|
*/
|
|
211
191
|
export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
|
|
212
|
-
export type SDKGridSpacing =
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
vertical: string;
|
|
217
|
-
};
|
|
192
|
+
export type SDKGridSpacing = string | {
|
|
193
|
+
horizontal: string;
|
|
194
|
+
vertical: string;
|
|
195
|
+
};
|
|
218
196
|
export type WithRequired<T, K extends keyof T> = T & {
|
|
219
|
-
|
|
197
|
+
[P in K]-?: T[P];
|
|
220
198
|
};
|
|
221
199
|
export interface SDKRenderingInfo {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
200
|
+
set_on_index_change: (fn: (index: number) => void) => void;
|
|
201
|
+
merchant: string;
|
|
202
|
+
market: string;
|
|
225
203
|
}
|
|
226
|
-
export type ProductCardTemplate<T extends Display> = (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
children,
|
|
232
|
-
on_close_,
|
|
233
|
-
close_after_,
|
|
234
|
-
...more_attributes
|
|
235
|
-
}: {
|
|
236
|
-
children?: JSX.Element;
|
|
237
|
-
close_after_: number;
|
|
238
|
-
on_close_?: VoidFunction;
|
|
204
|
+
export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
|
|
205
|
+
export function show_toast({ children, on_close_, close_after_, ...more_attributes }: {
|
|
206
|
+
children?: JSX.Element;
|
|
207
|
+
close_after_: number;
|
|
208
|
+
on_close_?: VoidFunction;
|
|
239
209
|
} & JSX.HTMLAttributes<HTMLDivElement>): {
|
|
240
|
-
|
|
210
|
+
close_toast_: VoidFunction;
|
|
241
211
|
};
|
|
242
|
-
declare class SDKError extends Error {
|
|
212
|
+
declare class SDKError extends Error {
|
|
213
|
+
}
|
|
243
214
|
export class ProductCardError extends SDKError {
|
|
244
|
-
|
|
215
|
+
constructor(templateError: Error);
|
|
245
216
|
}
|
|
246
|
-
/**
|
|
247
|
-
* Base placeholder component used by ImagePlaceholder and TextPlaceholder
|
|
248
|
-
*/
|
|
249
|
-
export function BasePlaceholder(props: { style: JSX.CSSProperties; class?: string }): JSX.Element;
|
|
250
|
-
/**
|
|
251
|
-
* A Placeholder to use instead of some text, while it's loading. This is the inline version, meant to be embedded into sentences (or exist instead of them), etc.
|
|
252
|
-
* If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
|
|
253
|
-
* @property height height of the placeholder. Set to `1em` by default.
|
|
254
|
-
* @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
|
|
255
|
-
* @property class extra classes to add to the placeholder
|
|
256
|
-
* @property style extra styles to add to the placeholder
|
|
257
|
-
*/
|
|
258
|
-
export function TextPlaceholder(props: {
|
|
259
|
-
style?: JSX.CSSProperties;
|
|
260
|
-
height: string;
|
|
261
|
-
width: string;
|
|
262
|
-
class?: string;
|
|
263
|
-
}): JSX.Element;
|
|
264
217
|
/**
|
|
265
218
|
* Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
|
|
266
219
|
* @returns A cleanup function to manually re-enable scrolling.
|
|
267
220
|
*/
|
|
268
221
|
export function disable_scrolling(): () => void;
|
|
269
|
-
export const CategoryTitle: ({
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
category_title_: Accessor<string | undefined>;
|
|
274
|
-
product_count_: JSX.Element;
|
|
275
|
-
}) => JSX.Element;
|
|
222
|
+
export const CategoryTitle: ({ category_title_, product_count_, }: {
|
|
223
|
+
category_title_: Accessor<string | undefined>;
|
|
224
|
+
product_count_: JSX.Element;
|
|
225
|
+
}) => HTMLElement;
|
|
276
226
|
/**
|
|
277
227
|
* Embeds number of products between sort and filter buttons on mobile if possible, only supported for category pages right now. Pass it as category_title_ to Category.
|
|
278
228
|
* Note: this will add an invisible element as first element in depict-search-page which will confuse the flex-gap SCSS mixin a bit so you'll get some extra spacing at the beginning of the search page
|
|
279
229
|
* If you see “ResizeObserver loop limit exceeded”, this is probably doing it. More context here: https://depictaiworkspace.slack.com/archives/C02KVDZ8YHZ/p1667315647758829
|
|
280
230
|
*/
|
|
281
|
-
export const embedded_num_products: ({
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
extra_sort_and_filter_args_: {
|
|
293
|
-
get_extra_sorting_button_?: ((extra_button: JSX.Element) => unknown) | undefined;
|
|
294
|
-
get_extra_filters_button_?: ((extra_button: JSX.Element) => unknown) | undefined;
|
|
295
|
-
sort_button_width_?: Accessor<number | undefined> | undefined;
|
|
296
|
-
filter_button_width_?: Accessor<number | undefined> | undefined;
|
|
297
|
-
};
|
|
231
|
+
export const embedded_num_products: ({ make_product_count_, set_observed_results_filters_elements_, is_slim_, sort_and_filter_element_, extra_sort_and_filter_args_, }: {
|
|
232
|
+
make_product_count_: () => JSX.Element;
|
|
233
|
+
set_observed_results_filters_elements_: Setter<JSX.Element>;
|
|
234
|
+
sort_and_filter_element_: Accessor<HTMLDivElement | undefined>;
|
|
235
|
+
is_slim_: Accessor<boolean>;
|
|
236
|
+
extra_sort_and_filter_args_: {
|
|
237
|
+
get_extra_sorting_button_?: ((extra_button: JSX.Element) => unknown) | undefined;
|
|
238
|
+
get_extra_filters_button_?: ((extra_button: JSX.Element) => unknown) | undefined;
|
|
239
|
+
sort_button_width_?: Accessor<number | undefined> | undefined;
|
|
240
|
+
filter_button_width_?: Accessor<number | undefined> | undefined;
|
|
241
|
+
};
|
|
298
242
|
}) => {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
243
|
+
only_show_filters_opener_: Accessor<boolean>;
|
|
244
|
+
middle_elements_: Accessor<JSX.Element>;
|
|
245
|
+
on_filters_constructed_: () => void;
|
|
302
246
|
};
|
|
303
247
|
export type SDKColsAtSize = [number, number?][];
|
|
304
248
|
/**
|
|
@@ -308,69 +252,42 @@ export type SDKColsAtSize = [number, number?][];
|
|
|
308
252
|
*/
|
|
309
253
|
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
310
254
|
type DepictCategoryConstructorOptions = {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
255
|
+
market: string;
|
|
256
|
+
merchant: string;
|
|
257
|
+
localization: category_i18n;
|
|
258
|
+
on_navigation?: OnNavigation;
|
|
259
|
+
api?: DepictAPI;
|
|
316
260
|
};
|
|
317
261
|
export class DepictCategory {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
262
|
+
#private;
|
|
263
|
+
get localization(): category_i18n;
|
|
264
|
+
set localization(locale_obj: category_i18n);
|
|
265
|
+
get category_id(): string;
|
|
266
|
+
set category_id(id: string);
|
|
267
|
+
get merchant(): string;
|
|
268
|
+
set merchant(merchant: string);
|
|
269
|
+
get market(): string;
|
|
270
|
+
set market(market: string);
|
|
271
|
+
get on_navigation(): OnNavigation;
|
|
272
|
+
set on_navigation(new_function: OnNavigation);
|
|
273
|
+
constructor({ api, on_navigation, ...props_on_class }: DepictCategoryConstructorOptions);
|
|
330
274
|
}
|
|
331
|
-
export function CategoryPage<T extends Display>({
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}: {
|
|
340
|
-
depict_category: DepictCategory;
|
|
341
|
-
grid_spacing: SDKGridSpacing;
|
|
342
|
-
cols_at_size: SDKColsAtSize;
|
|
343
|
-
product_card_template: ProductCardTemplate<T>;
|
|
344
|
-
show_quicklinks?: boolean;
|
|
345
|
-
show_breadcrumbs?: boolean;
|
|
346
|
-
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
275
|
+
export function CategoryPage<T extends Display>({ depict_category, grid_spacing, cols_at_size, product_card_template, show_breadcrumbs, show_quicklinks, category_title, }: {
|
|
276
|
+
depict_category: DepictCategory;
|
|
277
|
+
grid_spacing: SDKGridSpacing;
|
|
278
|
+
cols_at_size: SDKColsAtSize;
|
|
279
|
+
product_card_template: ProductCardTemplate<T>;
|
|
280
|
+
show_quicklinks?: boolean;
|
|
281
|
+
show_breadcrumbs?: boolean;
|
|
282
|
+
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
347
283
|
}): import("@depict-ai/utilishared").Node_Array;
|
|
348
|
-
export function BreadCrumbs({ depict_category }: {
|
|
349
|
-
|
|
284
|
+
export function BreadCrumbs({ depict_category }: {
|
|
285
|
+
depict_category: DepictCategory;
|
|
286
|
+
}): HTMLElement;
|
|
287
|
+
export function QuickLinks({ depict_category }: {
|
|
288
|
+
depict_category: DepictCategory;
|
|
289
|
+
}): HTMLElement;
|
|
350
290
|
export function get_categories(tenant: string, market: string): Promise<string[]>;
|
|
351
|
-
type ImagePlaceholderBaseOptions = {
|
|
352
|
-
style?: JSX.CSSProperties;
|
|
353
|
-
class?: string;
|
|
354
|
-
};
|
|
355
|
-
type ImagePlaceholderBlockOptions = {
|
|
356
|
-
width: string;
|
|
357
|
-
height: string;
|
|
358
|
-
};
|
|
359
|
-
type ImagePlaceholderImageOptions = {
|
|
360
|
-
aspectRatio: number;
|
|
361
|
-
};
|
|
362
|
-
/**
|
|
363
|
-
* A placeholder that can be used instead of an image or other block of content while it's loading.
|
|
364
|
-
* The placeholder has `display:block`, meaning it will create a new "row" in the layout for itself. Can be used either for images with a defined aspect ratio (ContainedImage) or blocks.
|
|
365
|
-
* @property aspectRatio if aspectRatio is defined the placeholder will be in "image mode" and fill out the available width and then adjust the height according to the aspectRatio
|
|
366
|
-
* @property width If width and height is set, the defined width and height will be used.
|
|
367
|
-
* @property height If width and height is set, the defined width and height will be used.
|
|
368
|
-
* @property class extra classes to add to the placeholder
|
|
369
|
-
* @property style extra styles to add to the placeholder
|
|
370
|
-
*/
|
|
371
|
-
export function ImagePlaceholder(
|
|
372
|
-
props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)
|
|
373
|
-
): JSX.Element;
|
|
374
291
|
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
375
292
|
/**
|
|
376
293
|
* Useful for aligning the search modal to an element, like an existing input field
|
|
@@ -381,211 +298,198 @@ export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
|
381
298
|
* @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
|
|
382
299
|
* @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
|
|
383
300
|
*/
|
|
384
|
-
export function align_field(
|
|
385
|
-
modal_body_style: Signal<JSX.CSSProperties>,
|
|
386
|
-
input_field: HTMLElement,
|
|
387
|
-
width_transformer?: (arg0: number) => number,
|
|
388
|
-
includeScroll?: boolean,
|
|
389
|
-
one_axies_only?: "top" | "left"
|
|
390
|
-
): () => void;
|
|
301
|
+
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;
|
|
391
302
|
interface Styles {
|
|
392
|
-
|
|
303
|
+
[selector: string]: JSX.CSSProperties;
|
|
393
304
|
}
|
|
394
305
|
export const styles_to_valid_css_string: (styles: Styles) => string;
|
|
395
306
|
/** A function that renders category suggestion cards. Set to false to disable category suggestions. */
|
|
396
|
-
export type RenderCategorySuggestion = (
|
|
397
|
-
category_suggestion: Accessor<CategorySuggestion>,
|
|
398
|
-
index: number
|
|
399
|
-
) => JSX.Element;
|
|
307
|
+
export type RenderCategorySuggestion = (category_suggestion: Accessor<CategorySuggestion>, index: number) => JSX.Element;
|
|
400
308
|
/**
|
|
401
309
|
* Connects the height of the search field to the height of the aligner.
|
|
402
310
|
* @param aligner
|
|
403
311
|
* @returns
|
|
404
312
|
*/
|
|
405
313
|
export function connect_search_field_height_to_aligner_height(aligner: HTMLElement): {
|
|
406
|
-
|
|
314
|
+
cleanup: () => void;
|
|
407
315
|
};
|
|
408
316
|
type ConstructorOptions<T extends Display> = {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
317
|
+
search_query_url_param_name?: string;
|
|
318
|
+
market: string;
|
|
319
|
+
merchant: string;
|
|
320
|
+
localization: search_i18n;
|
|
321
|
+
on_navigation?: OnNavigation;
|
|
322
|
+
url_transformer?: (url_object: URL) => unknown;
|
|
323
|
+
enable_category_suggestions?: boolean;
|
|
324
|
+
disable_scrolling_during_modal?: boolean;
|
|
325
|
+
api?: DepictAPI;
|
|
326
|
+
bottom_distance_under_modal?: Accessor<number | undefined>;
|
|
327
|
+
render_instant_card?: InstantCard<T>;
|
|
420
328
|
};
|
|
421
329
|
export type OpenModalArguments = [
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
330
|
+
options_for_modal?: {
|
|
331
|
+
style_props_?: Signal<JSX.CSSProperties>;
|
|
332
|
+
closing_animation_?: () => Promise<any>;
|
|
333
|
+
class_list_?: Accessor<Record<string, boolean>>;
|
|
334
|
+
selected_text_range_?: readonly [number | null, number | null] | [number | null, number | null];
|
|
335
|
+
dont_sync_search_field_value_except_on_submit_?: boolean;
|
|
336
|
+
},
|
|
337
|
+
on_dispose?: VoidFunction
|
|
430
338
|
];
|
|
431
|
-
export const get_search_query_updating_blocked_signal: (
|
|
432
|
-
depict_search: DepictSearch<any>
|
|
433
|
-
) => Signal<boolean> | undefined;
|
|
339
|
+
export const get_search_query_updating_blocked_signal: (depict_search: DepictSearch<any>) => Signal<boolean> | undefined;
|
|
434
340
|
export class DepictSearch<T extends Display> {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
set on_navigation(new_function: OnNavigation);
|
|
449
|
-
get localization(): search_i18n;
|
|
450
|
-
set localization(locale_obj: search_i18n);
|
|
451
|
-
get modal_open(): OpenModalArguments | boolean;
|
|
452
|
-
set modal_open(new_state: OpenModalArguments | boolean);
|
|
453
|
-
get merchant(): string;
|
|
454
|
-
set merchant(tenant: string);
|
|
455
|
-
get market(): string;
|
|
456
|
-
set market(market: string);
|
|
457
|
-
fetchSearchResults(query: string, filters?: SearchFilter[]): Promise<T[]>;
|
|
341
|
+
#private;
|
|
342
|
+
constructor({ search_query_url_param_name: 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>);
|
|
343
|
+
get on_navigation(): OnNavigation;
|
|
344
|
+
set on_navigation(new_function: OnNavigation);
|
|
345
|
+
get localization(): search_i18n;
|
|
346
|
+
set localization(locale_obj: search_i18n);
|
|
347
|
+
get modal_open(): OpenModalArguments | boolean;
|
|
348
|
+
set modal_open(new_state: OpenModalArguments | boolean);
|
|
349
|
+
get merchant(): string;
|
|
350
|
+
set merchant(tenant: string);
|
|
351
|
+
get market(): string;
|
|
352
|
+
set market(market: string);
|
|
353
|
+
fetchSearchResults(query: string, filters?: SearchFilter[]): Promise<T[]>;
|
|
458
354
|
}
|
|
459
|
-
export function SearchPage<T extends Display>({
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
grid_spacing,
|
|
463
|
-
cols_at_size,
|
|
464
|
-
product_card_template,
|
|
465
|
-
extra_depict_options,
|
|
466
|
-
}: {
|
|
467
|
-
depict_search: DepictSearch<T>;
|
|
468
|
-
include_input_field?:
|
|
469
|
-
| boolean
|
|
470
|
-
| {
|
|
355
|
+
export function SearchPage<T extends Display>({ depict_search, include_input_field, grid_spacing, cols_at_size, product_card_template, extra_depict_options, }: {
|
|
356
|
+
depict_search: DepictSearch<T>;
|
|
357
|
+
include_input_field?: boolean | {
|
|
471
358
|
on_open_?: VoidFunction;
|
|
472
359
|
on_close_?: VoidFunction;
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
360
|
+
};
|
|
361
|
+
grid_spacing: SDKGridSpacing;
|
|
362
|
+
cols_at_size: SDKColsAtSize;
|
|
363
|
+
product_card_template: ProductCardTemplate<T>;
|
|
364
|
+
extra_depict_options?: {
|
|
365
|
+
recommendations_cols_at_size?: SDKColsAtSize;
|
|
366
|
+
};
|
|
480
367
|
}): import("@depict-ai/utilishared").Node_Array;
|
|
481
368
|
interface SearchFieldParams {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
369
|
+
depict_search: DepictSearch<any>;
|
|
370
|
+
modal_dispose_handler?: VoidFunction;
|
|
371
|
+
click_handler?: (this: HTMLDivElement, ev: MouseEvent) => any;
|
|
372
|
+
aligner_ref?: HTMLElement | null;
|
|
486
373
|
}
|
|
487
|
-
export function SearchField({
|
|
488
|
-
depict_search,
|
|
489
|
-
modal_dispose_handler,
|
|
490
|
-
click_handler,
|
|
491
|
-
aligner_ref,
|
|
492
|
-
}: SearchFieldParams): import("@depict-ai/utilishared").Node_Array;
|
|
374
|
+
export function SearchField({ depict_search, modal_dispose_handler, click_handler, aligner_ref, }: SearchFieldParams): import("@depict-ai/utilishared").Node_Array;
|
|
493
375
|
export type BaseProviderConfig = {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
376
|
+
/**
|
|
377
|
+
* The merchant to use for the search.
|
|
378
|
+
* @example "YOUR_MERCHANT", "stronger"
|
|
379
|
+
*/
|
|
380
|
+
merchant: string;
|
|
381
|
+
/**
|
|
382
|
+
* The market to use for the search.
|
|
383
|
+
* @example "YOUR_MARKET", "no", "en-de"
|
|
384
|
+
*/
|
|
385
|
+
market: string;
|
|
386
|
+
/**
|
|
387
|
+
* Optional unique identifier of a logged in user. Should be persistent across devices and sessions.
|
|
388
|
+
*/
|
|
389
|
+
userId?: string;
|
|
390
|
+
/**
|
|
391
|
+
* Optional unique identifer of the current session. Only necessary when performing server side requests to Depict.
|
|
392
|
+
*/
|
|
393
|
+
sessionId?: string;
|
|
394
|
+
/**
|
|
395
|
+
* Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
|
|
396
|
+
*/
|
|
397
|
+
metaData?: Record<string, string>;
|
|
516
398
|
};
|
|
517
399
|
export type BaseSearchProviderConfig = {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
400
|
+
/**
|
|
401
|
+
* The path to the search page.
|
|
402
|
+
* @example "/search", "/sok"
|
|
403
|
+
*/
|
|
404
|
+
searchPagePath: string;
|
|
405
|
+
/**
|
|
406
|
+
* The name of the url parameter that will be used for the search query.
|
|
407
|
+
* @example "q", "search_query", "query"
|
|
408
|
+
* @default "query"
|
|
409
|
+
*/
|
|
410
|
+
urlParamName?: string;
|
|
411
|
+
/**
|
|
412
|
+
* Whether to enable category suggestions in the search modal and search page.
|
|
413
|
+
* @default false
|
|
414
|
+
*/
|
|
415
|
+
enableCategorySuggestions?: boolean;
|
|
534
416
|
};
|
|
535
417
|
export interface BaseProductListingConfig {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
418
|
+
/**
|
|
419
|
+
* How many columns to show at each media size.
|
|
420
|
+
* @default
|
|
421
|
+
* [[2, 901], [3, 1024], [4]]
|
|
422
|
+
* @example
|
|
423
|
+
* [[2, 901], [3, 1024], [4]]
|
|
424
|
+
* means 2 columns at sizes up to 901px, 3 columns at sizes up to 1024px and after that 4 columns at any viewport size.
|
|
425
|
+
*/
|
|
426
|
+
columnsAtSize?: SDKColsAtSize;
|
|
427
|
+
/**
|
|
428
|
+
* The spacing between products.
|
|
429
|
+
* @default "2%"
|
|
430
|
+
* @example
|
|
431
|
+
* "2%", "10px", "1rem", {horizontal: "1%", vertical: "5px"}
|
|
432
|
+
*/
|
|
433
|
+
gridSpacing?: SDKGridSpacing;
|
|
552
434
|
}
|
|
553
435
|
export interface BaseSearchPageConfig extends BaseProductListingConfig {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
436
|
+
/**
|
|
437
|
+
* Whether to show the search input field in the search page.
|
|
438
|
+
* @default true
|
|
439
|
+
*/
|
|
440
|
+
includeInputField?: boolean;
|
|
559
441
|
}
|
|
560
442
|
export interface BaseCategoryPageConfig extends BaseProductListingConfig {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Whether to show the breadcrumbs in the category page.
|
|
445
|
+
* @default true
|
|
446
|
+
*/
|
|
447
|
+
showBreadcrumbs?: boolean;
|
|
448
|
+
/**
|
|
449
|
+
* Whether to show the quicklinks in the category page.
|
|
450
|
+
* @default true
|
|
451
|
+
*/
|
|
452
|
+
showQuicklinks?: boolean;
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Props for the TextPlaceholder component.
|
|
456
|
+
*/
|
|
457
|
+
export interface TextPlaceholderProps {
|
|
458
|
+
/**
|
|
459
|
+
* The height of the text, including a unit.
|
|
460
|
+
* @example "1em"
|
|
461
|
+
*/
|
|
462
|
+
height: string;
|
|
463
|
+
/**
|
|
464
|
+
* The width of the text.
|
|
465
|
+
* @example "60px", "10em"
|
|
466
|
+
*/
|
|
467
|
+
width: string;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Props for the ImagePlaceholder component.
|
|
471
|
+
*/
|
|
472
|
+
export interface ImagePlaceholderProps {
|
|
473
|
+
/** The aspect ratio of the image that will be displayed. */
|
|
474
|
+
aspectRatio: number;
|
|
571
475
|
}
|
|
572
476
|
type CenteredLocation = {
|
|
573
|
-
|
|
477
|
+
location?: "centered";
|
|
574
478
|
};
|
|
575
479
|
type AlignedLocation = {
|
|
576
|
-
|
|
577
|
-
|
|
480
|
+
location: "aligned";
|
|
481
|
+
element: HTMLElement;
|
|
578
482
|
};
|
|
579
483
|
/**
|
|
580
484
|
* How the modal should be opened.
|
|
581
485
|
*/
|
|
582
486
|
type ModalLocation = AlignedLocation | CenteredLocation;
|
|
583
487
|
type OpenModalParams<T extends Display> = ModalLocation & {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
488
|
+
search: DepictSearch<T>;
|
|
489
|
+
/**
|
|
490
|
+
* If true, the search field in the modal opened will be empty and de-coupled from the other SearchFields.
|
|
491
|
+
*/
|
|
492
|
+
makesNewSearch?: boolean;
|
|
589
493
|
};
|
|
590
494
|
/**
|
|
591
495
|
* Open the modal with support for alignment.
|
|
@@ -594,11 +498,11 @@ type OpenModalParams<T extends Display> = ModalLocation & {
|
|
|
594
498
|
export const open_modal_with_alignment: <T extends Display>(openModalParams: OpenModalParams<T>) => void;
|
|
595
499
|
export function open_search_with_shift_slash(open_search: VoidFunction): () => void;
|
|
596
500
|
export interface PageReplacer {
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
501
|
+
readonly render_: () => Node_Array;
|
|
502
|
+
readonly is_page_: (url: URL) => boolean;
|
|
503
|
+
readonly title_?: string;
|
|
504
|
+
readonly selector_: string;
|
|
505
|
+
readonly append_instead_of_replace_?: boolean;
|
|
602
506
|
}
|
|
603
507
|
/**
|
|
604
508
|
* PageReplacer is a class that can be used to layer an SPA (single page application) on top of a non-SPA, for certain pages.
|
|
@@ -612,21 +516,18 @@ export interface PageReplacer {
|
|
|
612
516
|
* @param append_instead_of_replace_ If true, the replacement element will be appended to the element that is found by selector_ instead of replacing it. This is useful if one doesn't actually want it to replace the element because one has other logic.
|
|
613
517
|
*/
|
|
614
518
|
export class PageReplacer extends EventTarget {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
}: Omit<PageReplacer, "destroy_" | "addEventListener" | "removeEventListener" | "dispatchEvent" | "open_"> & {
|
|
628
|
-
is_spa_?: boolean;
|
|
629
|
-
});
|
|
519
|
+
#private;
|
|
520
|
+
/**
|
|
521
|
+
* Returns if the "replacement page" is currently open
|
|
522
|
+
*/
|
|
523
|
+
get open_(): boolean;
|
|
524
|
+
/**
|
|
525
|
+
* Stops listening to URL changes and closes the page (if it is currently open)
|
|
526
|
+
*/
|
|
527
|
+
destroy_(): void;
|
|
528
|
+
constructor({ is_spa_, ...options }: Omit<PageReplacer, "destroy_" | "addEventListener" | "removeEventListener" | "dispatchEvent" | "open_"> & {
|
|
529
|
+
is_spa_?: boolean;
|
|
530
|
+
});
|
|
630
531
|
}
|
|
631
532
|
/**
|
|
632
533
|
* 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)
|