@depict-ai/ui 3.0.27 → 4.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.
@@ -1,7 +1,7 @@
1
- import { ColsAtSize, Display, ModernDisplay, Amazing_Slider, Node_Array, report, Elem } from "@depict-ai/utilishared/ES10";
2
- import { JSX, Signal, Accessor, Setter } from "solid-js";
3
- import { SearchFilter, SortModel, SearchRequestV3 } from "@depict-ai/types/api/SearchRequestV3";
4
- import { ContentLink, SearchFilter as _SearchFilter1, SearchResponse } from "@depict-ai/types/api/SearchResponse";
1
+ import { Accessor, JSX, Signal, Setter } from "solid-js";
2
+ import { Display, ModernDisplay, Elem, ColsAtSize, report, Amazing_Slider, TwoLetterMarket, Node_Array } from "@depict-ai/utilishared/ES10";
3
+ import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
4
+ import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
5
5
  import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
6
6
  import { ProductListing, GetListingResponse } from "@depict-ai/types/api/GetListingResponse";
7
7
  import { ProductListingResponseV3 } from "@depict-ai/types/api/ProductListingResponseV3";
@@ -10,14 +10,58 @@ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequ
10
10
  import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
11
11
  import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
12
12
  import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
13
- export const version = "3.0.27";
14
- export type SDKColsAtSize = [number, number?][];
13
+ export const version = "4.0.0";
14
+ export type ModalAlignmentSignals = {
15
+ body_: Signal<JSX.CSSProperties>;
16
+ field_: Signal<JSX.CSSProperties>;
17
+ backdrop_?: Signal<JSX.CSSProperties>;
18
+ };
15
19
  /**
16
- * Transform SDK ColsAtSize into valid Layout ColsAtSize
17
- * @param cols_at_size [nbCol, maxWidth]
18
- * @returns
20
+ * Flag to align by top
19
21
  */
20
- export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
22
+ export const ALIGN_TOP = 1;
23
+ /**
24
+ * Flag to align by left
25
+ */
26
+ export const ALIGN_LEFT = 2;
27
+ /**
28
+ * Flag to also align the width of the modal to the element
29
+ */
30
+ export const ALIGN_WIDTH_ON_MODAL = 4;
31
+ /**
32
+ * Whether to align the center of the element to align to, to the center of the modal. If set, `transform: translateX(-50%)` will also be applied to the modal
33
+ */
34
+ export const SET_CENTERED_LEFT = 16;
35
+ /**
36
+ * Useful for aligning the search modal to an element, like an existing input field
37
+ * @param alignmentSignals a signal containing the style properties that will be applied to the modal body and serach field. You provide it to open_modal_ as `alignmentSignals_` when using SearchModal
38
+ * @param input_field the element to align to.
39
+ * @param alignment a bitmask of ALIGN_TOP, ALIGN_LEFT, ALIGN_WIDTH to determine how to align. Example: `ALIGN_TOP | ALIGN_LEFT` aligns both top and left
40
+ * @param includeScroll Should the aligner offset with scrolling? Useful to set to false when using position: fixed
41
+ * @param pollAlignment a reactive accessor, for the duration that it returns true the alignment will be re-ran every frame. Useful for when you're aligning to a moving element that doesn't change its width.
42
+ * @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
43
+ */
44
+ export function align_field({
45
+ body_: [, setModalBodyStyle],
46
+ field_: [, setModalFiedlStyle]
47
+ }: ModalAlignmentSignals, input_field: HTMLElement, alignment: number, includeScroll?: boolean, pollAlignment?: Accessor<boolean>): () => void;
48
+ /**
49
+ * A good way of "debouncing" if one wants to update a value as aggressively as possible without overloading the network or the server. It ensures that as many requests are made as possible without making two requests at once.
50
+ * This is for when you need a solid resource that has an accurate .loading value.
51
+ *
52
+ * Creates a sort of debounced/throttled resource - if the dependency changes while the fetcher is not running, the fetcher will instantly run. If the dependency changes while the fetcher is running, the fetcher will not run but a fetch with the dependency value will be queued. If the fetcher is already queued, the queued fetcher will be replaced with the new one. Once the running fetcher finishes, the queued fetcher will run.
53
+ *
54
+ * Caveats: the owner of the fetched might/will be incorrect, the resource will never have an error, instead the resource value will become undefined.
55
+ *
56
+ * @param dependency The value that the fetcher receives, when it updates the fetcher will run according to the rules described above
57
+ * @param fetcher The function that fetches the resource, it receives the dependency value as an argument
58
+ */
59
+ export function createDeparallelizedNoDropResource<T, X>(dependency: Accessor<T | undefined | null | false>, fetcher: (dependency: T) => Promise<X>): import("solid-js").Resource<X | undefined>;
60
+ /**
61
+ * Wraps a function in a try/catch block and throws the error globally. If undefined is provided as fn, a no-op is returned.
62
+ * @param fn the function to wrap
63
+ */
64
+ export function throw_globally<T extends (...args: any) => any>(fn?: T): (...args: Parameters<T>) => ReturnType<T> | undefined;
21
65
  declare const LISTING_ID = "listingId";
22
66
  declare const EXTERNAL_ID = "externalId";
23
67
  export type SDKGridSpacing = string | {
@@ -46,9 +90,20 @@ type CanBePromiseWrapped<T> = T | Promise<T>;
46
90
  export type ModernDisplayWithPageUrl<T extends ModernDisplay> = { [K in keyof T]: K extends "variant_displays" ? (T[K][number] & {
47
91
  page_url: string;
48
92
  })[] : T[K] };
93
+ /**
94
+ * A ProductListing with ancestors added in, this is what we pass to the display transformers as the ancestors might be required to construct the URL
95
+ */
49
96
  type ProductListingWithAncestors = ProductListing & {
50
97
  ancestors: Ancestors;
51
98
  };
99
+ /**
100
+ * The displayTransformer for categories does not only get a list of ListingSuggestions, when a search query has listing suggestions, but also their ancestors since we show breadcrumbs for the listing suggestions. To let the user differentiate (since the suggestion ones can be added/removed but not the ancestors) we add a boolean is_suggestion to the listing suggestions passed to the displayTransformer.
101
+ */
102
+ type ListingSuggestionForTransformer = (ListingSuggestion & {
103
+ is_suggestion: true;
104
+ }) | (Omit<ListingSuggestion, "suggestions_result_id"> & {
105
+ is_suggestion: false;
106
+ });
52
107
  /**
53
108
  * DisplayTransformers supersede pageURLCreator
54
109
  * DisplayTransformers are functions that take in a list of categories, content search results or products and then can transform or enrich the data for each category, content search result or product card in a batched way.
@@ -57,7 +112,7 @@ export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDispla
57
112
  products?: (options: DisplayTransformerAlwaysThereData & {
58
113
  displays: InputDisplay[];
59
114
  }) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
60
- categories?: <T extends ProductListingWithAncestors | ListingSuggestion>(options: DisplayTransformerAlwaysThereData & {
115
+ categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
61
116
  data: T[];
62
117
  }) => CanBePromiseWrapped<(T & {
63
118
  page_url: string;
@@ -74,6 +129,453 @@ export type SomethingTakingADisplayTransformers<InputDisplay extends Display, Ou
74
129
  page_url_creator?: never;
75
130
  display_transformers?: never;
76
131
  };
132
+ type ListingSuggestionAfterURLCreator = { [K in keyof ListingSuggestion]: K extends "ancestors" ? (ListingSuggestion & {
133
+ page_url: string;
134
+ })[] : ListingSuggestion[K] } & {
135
+ page_url: string;
136
+ };
137
+ type ReplaceCategorySuggestion<T> = T extends ListingSuggestion ? ListingSuggestionAfterURLCreator : T extends ListingSuggestion[] ? ListingSuggestionAfterURLCreator[] : T;
138
+ type SearchSuggestionsResponseAfterURLCreator = { [K in keyof SearchSuggestionsResponseV3]: ReplaceCategorySuggestion<SearchSuggestionsResponseV3[K]> };
139
+ type SearchResponseAfterDisplayTransformer = { [K in keyof SearchResponse]: K extends "displays" ? ModernDisplayWithPageUrl<any>[] : K extends "filters" ? AddActualFieldToFilters<SearchResponse[K]> : SearchResponse[K] };
140
+ type ProductListingWithPageURL = ProductListing & {
141
+ page_url: string;
142
+ };
143
+ type ProductListingResponseAfterDisplayTransformer = { [K in keyof ProductListingResponseV3]: K extends "displays" ? ModernDisplayWithPageUrl<any>[] : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV3[K]> : ProductListingResponseV3[K] };
144
+ type GetListingResponseAfterDisplayTransformer = { [K in keyof GetListingResponseWithQuicklinksAndBreadcrumbs]: K extends "breadcrumbs" ? ProductListingWithPageURL[] : K extends "quick_links" ? ProductListingWithPageURL[] : GetListingResponseWithQuicklinksAndBreadcrumbs[K] };
145
+ type GetListingResponseWithQuicklinksAndBreadcrumbs = Omit<GetListingResponse, "siblings" | "ancestors" | "children"> & {
146
+ quick_links: ProductListingWithAncestors[];
147
+ breadcrumbs: ProductListingWithAncestors[];
148
+ };
149
+ type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
150
+ get_metadata?: () => Promise<{
151
+ [k: string]: string;
152
+ } | undefined>;
153
+ get_session_id?: () => string | undefined;
154
+ } & SomethingTakingADisplayTransformers<InputDisplay, OutputDisplay>;
155
+ interface GetListingOptions extends Omit<GetListingRequest, "listing_id"> {
156
+ session_id?: string;
157
+ id_to_query_for_: string;
158
+ id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
159
+ }
160
+ /**
161
+ * Class that handles all communication done in PLP code with the Depict API. (Notably not for recommendations currently).
162
+ * It handles caching, retries and errors and is the only place that should be making requests to the Depict API.
163
+ */
164
+ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never = InputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<InputDisplay> : never> {
165
+ #private;
166
+ display_transformers: DisplayTransformers<ModernDisplay, OutputDisplay> | undefined;
167
+ constructor(options: DepictAPIConstructorOptions<InputDisplay, OutputDisplay>);
168
+ suggest(input_req: SearchSuggestionsRequestV3): Promise<SearchSuggestionsResponseAfterURLCreator & {
169
+ failed?: true;
170
+ }>;
171
+ query(input_req: SearchRequestV3): Promise<SearchResponseAfterDisplayTransformer & {
172
+ failed?: true;
173
+ }>;
174
+ get_listing({
175
+ id_type_,
176
+ id_to_query_for_,
177
+ ...input_req
178
+ }: GetListingOptions): Promise<GetListingResponseAfterDisplayTransformer & {
179
+ failed?: true;
180
+ }>;
181
+ get_listing_products({
182
+ id_to_query_for_,
183
+ id_type_,
184
+ ...input_req_
185
+ }: ProductListingRequestV3 & {
186
+ id_to_query_for_: string;
187
+ id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
188
+ }): Promise<ProductListingResponseAfterDisplayTransformer & {
189
+ failed?: true;
190
+ }>;
191
+ get_recommended<T extends Display>(input_req: BaseSearchRequestV3): Promise<{
192
+ displays: T[];
193
+ } & {
194
+ failed?: true | undefined;
195
+ }>;
196
+ }
197
+ /**
198
+ * PLP internationalisation shared between search and category listing
199
+ */
200
+ type plp_shared_i18n = {
201
+ backend_locale_: string;
202
+ scroll_to_top_: string;
203
+ back_: string;
204
+ open_sorting_: string;
205
+ close_sorting_: string;
206
+ open_filters_: string;
207
+ close_filters_: string;
208
+ close_: string;
209
+ ok_: string;
210
+ filters_cleared_: string;
211
+ we_cleared_your_filters_: string;
212
+ restore_: string;
213
+ sorting_text_: string;
214
+ filter_text_: string;
215
+ selected_filters_title_: string;
216
+ filters_: string;
217
+ view_less_: string;
218
+ view_more_: string;
219
+ /**
220
+ * Also used for "clear all" in previous searches (TextSuggestions)
221
+ */
222
+ clear_all_from_filter_crumbs_: string;
223
+ clear_individual_filter_: string;
224
+ of_: string;
225
+ clear_all_filters_from_big_button_: string;
226
+ try_without_filters_: string;
227
+ range_filter_low_point_aria_label_: string;
228
+ range_filter_high_point_aria_label_: string;
229
+ morphing_sign_expanded_aria_label_: string;
230
+ morphing_sign_collapsed_aria_label_: string;
231
+ search_a_filter_: (filter_section: string) => string;
232
+ breadcrumbs_aria_label_: string;
233
+ breadcrumbs_separator_: string;
234
+ price_formatting_: {
235
+ pre_: string;
236
+ post_: string;
237
+ decimal_places_delimiter_: string;
238
+ thousands_delimiter_: string;
239
+ places_after_comma_: number | "auto";
240
+ };
241
+ };
242
+ /**
243
+ * Search internationalisation
244
+ */
245
+ interface search_i18n extends plp_shared_i18n {
246
+ placeholder_text_: string;
247
+ show_n_results_: (number_of_results: HTMLElement) => Elem[];
248
+ no_results_text_: string;
249
+ no_products_: string;
250
+ search_recs_title_: string;
251
+ clear_filters_query_sorting_after_submit_: string;
252
+ modal_view_all_results_: (number_of_results: HTMLElement) => Elem[];
253
+ modal_discover_more_: string;
254
+ get_showing_results_for_: (query: HTMLElement, number_of_results_element: HTMLElement, has_query: boolean, number_of_results: number | undefined) => Elem[];
255
+ get_showing_pages_for_: (query: HTMLElement, number_of_results_element: HTMLElement, has_query: boolean, number_of_results: number | undefined) => Elem[];
256
+ previous_searches_text_: string;
257
+ category_: string;
258
+ brand_: string;
259
+ suggestions_: string;
260
+ search_submit_button_aria_label_: string;
261
+ search_field_field_aria_label_: string;
262
+ previous_searches_delete_entry_from_history_: string;
263
+ listing_suggestions_: string;
264
+ content_: string;
265
+ previous_: string;
266
+ popular_: string;
267
+ products_: string;
268
+ }
269
+ /**
270
+ * Category internationalisation
271
+ */
272
+ interface category_i18n extends plp_shared_i18n {
273
+ show_n_products_: (number_of_results: HTMLElement) => Elem[];
274
+ no_products_text_: string;
275
+ product_: string;
276
+ products_: string;
277
+ quicklinks_aria_label_: string;
278
+ }
279
+ /**
280
+ * For anything that is not exposed and only used internally we can use solid signals to get more performant rendering.
281
+ * For anything that can be used outside of solid, like Product Cards and InstantCards these types should not be used.
282
+ *
283
+ * Any solid_ type below should not be exposed outside of this library, as the accessors can be confusing and unnecessary.
284
+ */
285
+ /** For internal components using i18n that gets wrapped in solid's Accessors */
286
+ type solid_plp_shared_i18n = { [K in keyof plp_shared_i18n]: Accessor<plp_shared_i18n[K]> };
287
+ /** For internal components using i18n that gets wrapped in solid's Accessors */
288
+ type solid_search_i18n = { [K in keyof search_i18n]: Accessor<search_i18n[K]> };
289
+ /**
290
+ * Like standard_price_format except that the price and the formatting are reactive accessors
291
+ */
292
+ export function SolidFormatPrice(props: {
293
+ price_: number;
294
+ price_formatting_: {
295
+ pre_: string;
296
+ post_: string;
297
+ decimal_places_delimiter_: string;
298
+ thousands_delimiter_: string;
299
+ places_after_comma_: number | "auto";
300
+ };
301
+ }): JSX.Element;
302
+ export type SDKColsAtSize = [number, number?][];
303
+ /**
304
+ * Transform SDK ColsAtSize into valid Layout ColsAtSize
305
+ * @param cols_at_size [nbCol, maxWidth]
306
+ * @returns
307
+ */
308
+ export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
309
+ /**
310
+ * Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
311
+ * @returns A cleanup function to manually re-enable scrolling.
312
+ */
313
+ export function disable_scrolling(): () => void;
314
+ declare class SDKError extends Error {}
315
+ export class ProductCardError extends SDKError {
316
+ constructor(templateError: Error);
317
+ }
318
+ export function SentryErrorBoundary(props: {
319
+ children: JSX.Element;
320
+ message_: string;
321
+ severity_: Parameters<typeof report>[1];
322
+ on_error_?: (retry: VoidFunction) => JSX.Element | void;
323
+ class_list_?: string[];
324
+ }): JSX.Element;
325
+ /**
326
+ * Provider to wrap every listing (group of products) in
327
+ * Used for example for deduplicating ResizeObservers for responsive images
328
+ */
329
+ export function ListingProvider(props: {
330
+ children: JSX.Element;
331
+ }): JSX.Element;
332
+ /**
333
+ * Use this to get the context object if your component is within a ListingProvider
334
+ */
335
+ export function useListing(): Record<symbol, any> | undefined;
336
+ /**
337
+ * Function that encodes a filter object into query parameters and sets them on the given URLSearchParams object.
338
+ */
339
+ export function encode_filters(filters: FilterWithData[], search_params: URLSearchParams, filter_query_param_prefix: string): void;
340
+ /**
341
+ * Function that decodes the filters from the provided query parameters and returns them as an array of filter objects.
342
+ */
343
+ export function decode_filters(search_params: URLSearchParams, filter_query_param_prefix: string): FilterWithData[];
344
+ /**
345
+ * Function that encodes a sort model into a query paremeter and sets them on the given URLSearchParams object.
346
+ */
347
+ export function encode_sorting(sorting: SortModel | undefined, search_params: URLSearchParams, sorting_query_param: string): void;
348
+ /**
349
+ * Function that decodes the sort model from the provided query parameters and returns it as a sort model, if present.
350
+ */
351
+ export function decode_sorting(search_params: URLSearchParams, sorting_query_param_: string): SortModel | undefined;
352
+ /**
353
+ * Remove all Depict filter/sorting query parameters from the given URLSearchParams object.
354
+ * Used to reset the URLSearchParams object to a clean state, before adding new filters/sorting.
355
+ * @param search_params
356
+ * @param filter_query_param_prefix Prefix of the filter query parameters
357
+ * @param sorting_query_param
358
+ */
359
+ export function strip_encoded_filter_and_sort(search_params: URLSearchParams, filter_query_param_prefix: string, sorting_query_param: string): void;
360
+ /**
361
+ * Base placeholder component used by ImagePlaceholder and TextPlaceholder
362
+ */
363
+ export function BasePlaceholder(props: {
364
+ style: JSX.CSSProperties;
365
+ class?: string;
366
+ }): JSX.Element;
367
+ /**
368
+ * 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.
369
+ * If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
370
+ * @property height height of the placeholder. Set to `1em` by default.
371
+ * @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
372
+ * @property class extra classes to add to the placeholder
373
+ * @property style extra styles to add to the placeholder
374
+ */
375
+ export function TextPlaceholder(props: {
376
+ style?: JSX.CSSProperties;
377
+ height: string;
378
+ width: string;
379
+ class?: string;
380
+ }): JSX.Element;
381
+ /**
382
+ * ImageContainer for using the padding hack to set the aspect ratio of an image
383
+ * Put this around an <img> or <ResponsiveImg> to give it a container that always has the same size as the image. This prevents CLS and enables ResponsiveImg to work (the browser to load the correct image size)
384
+ * (Not using the CSS aspect-ratio property yet here due to browser support)
385
+ */
386
+ export function ImageContainer(props: {
387
+ aspectRatio: number | string;
388
+ class?: string;
389
+ children?: JSX.Element;
390
+ }): HTMLDivElement;
391
+ /**
392
+ * Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
393
+ */
394
+ export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
395
+ /**
396
+ * Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
397
+ * Will also delay loading and decoding of image until the browser is idle (with 5s timeout) to improve filtering/loading more performance.
398
+ * This is used for our responsive images:
399
+ * 1. The image must have a container with a fixed size (or aspect ratio) that is independent of the image. When aspectRatio is configured on the depict-cards element as data attribute, we will wrap the image in a ImageContainer for this. If it's false, the user has to provide this container themselves.
400
+ * 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
401
+ * 3. We set the size attribute of all the visible images to the size of the container we're observing. The point of this is that the sizes attribute is used to determine which image to load, and usually it's set by the user and depends on the relationship between image size and viewport size. By using a ResizeObserver, we can make sure the sizes attribute is always set to the correct value without it having to be configured. This will make so the browser always loads the correct image size for a crisp image but still fast load.
402
+ * You need to use insert(domNode, <ShopifyResponsiveImg size={sizeAccessor} src={src} />) if you want to insert the return value of this component into a DOM element manually, where you `import { insert } from "solid-js/web";` because we first want to insert the image once it has loaded.
403
+ */
404
+ export function ShopifyResponsiveImg(props: {
405
+ resolutions?: number[];
406
+ size: Accessor<number>;
407
+ } & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
408
+ src: string;
409
+ }): JSX.Element;
410
+ export const shopifyContainedImageContextSymbol: unique symbol;
411
+ /**
412
+ * Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.
413
+ * Will return a div of the provided aspect ratio that always has the same size, to avoid content layout shift. Will then put the image inside of the container once it loads.
414
+ * Also makes a responsive image without you having to do anything: uses shopify's CDN which picks the best image format to resize the image to the size of the first image container in a certain listing.
415
+ * This works because the listings (recs, search, plp) all are wrapped in `<ListingProvider>`'s. This means all components rendered within can use `useListing` to get an object to write data to that will be the same for all components rendered within that listing. The first instance of this component rendered within a listing puts a ResizeObserver on its div and the other components then just set the sizes attribute of their image to that.
416
+ * @property src image source
417
+ * @property aspectRatio aspect ratio of the image
418
+ * @property class extra class to add to the container
419
+ * @property alt alt text for the image
420
+ * @property imgProps props to pass to ShopifyResponsiveImg to add to the <img> element
421
+ */
422
+ export function ShopifyContainedImage(props: {
423
+ src: string;
424
+ aspectRatio: number | string;
425
+ class?: string;
426
+ imgProps?: Omit<Parameters<typeof ShopifyResponsiveImg>[0], "size" | "src">;
427
+ }): HTMLDivElement;
428
+ /**
429
+ * Hacks ShopifyContainedImage work even for non-shopify image urls by forcing the format to be WebP
430
+ */
431
+ export function ModernResponsiveContainedImage(props: {
432
+ merchant_: string;
433
+ } & Parameters<typeof ShopifyContainedImage>[0]): import("solid-js").JSX.Element;
434
+ /** @jsxImportSource solid-js */
435
+ export function GenericSliderArrowButton(props?: {
436
+ width_?: number;
437
+ height_?: number;
438
+ }): SVGElement;
439
+ export function SlidableItems({
440
+ children,
441
+ slider_ref_,
442
+ faded_opacity_,
443
+ mutation_plugins_,
444
+ disable_fading_,
445
+ arrow_width_,
446
+ arrow_height_,
447
+ snapAlign_,
448
+ fadingThreshold_
449
+ }: {
450
+ children?: JSX.Element;
451
+ slider_ref_?: (slider: Amazing_Slider) => any;
452
+ faded_opacity_?: number;
453
+ disable_fading_?: boolean;
454
+ snapAlign_?: "start" | "end" | "center";
455
+ fadingThreshold_?: number;
456
+ mutation_plugins_?: ((this: Amazing_Slider, mutations: IntersectionObserverEntry[], intersecting_items: Record<number, IntersectionObserverEntry>) => unknown)[];
457
+ arrow_width_?: number;
458
+ arrow_height_?: number;
459
+ }): JSX.Element;
460
+ export type SolidLayoutOptions = {
461
+ cols_at_size: ColsAtSize;
462
+ grid_spacing: string;
463
+ rows: {
464
+ start_rows?: number;
465
+ rows_per_click?: number;
466
+ currently_visible?: Signal<number>;
467
+ max_rows?: number;
468
+ button?: JSX.Element;
469
+ view_less_button?: JSX.Element;
470
+ } | "all";
471
+ layout: "slider" | "grid";
472
+ disable_partial_rows?: boolean;
473
+ override_vertical_spacing?: string;
474
+ children: JSX.Element;
475
+ element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
476
+ };
477
+ /**
478
+ * 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.
479
+ * @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
480
+ * @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`
481
+ * @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
482
+ * @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".
483
+ * @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
484
+ * @return An accessor containing a CSS string
485
+ */
486
+ export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
487
+ export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
488
+ interface Styles {
489
+ [selector: string]: JSX.CSSProperties;
490
+ }
491
+ export const styles_to_valid_css_string: (styles: Styles) => string;
492
+ type ImagePlaceholderBaseOptions = {
493
+ style?: JSX.CSSProperties;
494
+ class?: string;
495
+ };
496
+ type ImagePlaceholderBlockOptions = {
497
+ width: string;
498
+ height: string;
499
+ };
500
+ type ImagePlaceholderImageOptions = {
501
+ aspectRatio: number | string;
502
+ };
503
+ /**
504
+ * A placeholder that can be used instead of an image or other block of content while it's loading.
505
+ * 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.
506
+ * @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
507
+ * @property width If width and height is set, the defined width and height will be used.
508
+ * @property height If width and height is set, the defined width and height will be used.
509
+ * @property class extra classes to add to the placeholder
510
+ * @property style extra styles to add to the placeholder
511
+ */
512
+ export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
513
+ export function DefaultInstantCardPlaceholder(): HTMLDivElement;
514
+ /**
515
+ * Second generation search modal - the solid component that gets added to <body> when the search modal is opened
516
+ */
517
+ declare function RawSearchModalV2<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never>({
518
+ search_field_value_: props_search_field_value,
519
+ get_search_query_,
520
+ search_query_url_param_name_,
521
+ previous_searches_,
522
+ close_modal_,
523
+ alignmentSignals_,
524
+ depict_api_,
525
+ merchant_,
526
+ market_,
527
+ submit_query_: props_submit_query,
528
+ instant_results_options_,
529
+ register_closing_animation_,
530
+ url_transformer_,
531
+ closing_animation_,
532
+ clear_filters_,
533
+ i18n_,
534
+ disable_scrolling_,
535
+ enable_category_suggestions_,
536
+ class_list_,
537
+ bottom_distance_under_modal_,
538
+ selected_text_range_,
539
+ dont_sync_search_field_value_except_on_submit_,
540
+ router_,
541
+ content_search_enabled_,
542
+ sorting_query_param_,
543
+ filter_query_param_prefix_,
544
+ setSearchFieldOuterWidth_
545
+ }: {
546
+ search_field_value_: Signal<string>;
547
+ get_search_query_: Accessor<string>;
548
+ search_query_url_param_name_: string;
549
+ previous_searches_: Signal<string[]>;
550
+ close_modal_: VoidFunction;
551
+ alignmentSignals_?: ModalAlignmentSignals;
552
+ depict_api_: DepictAPI<InputDisplay, OutputDisplay>;
553
+ clear_filters_: (user_triggered: boolean) => void;
554
+ merchant_: Accessor<string>;
555
+ market_: Accessor<TwoLetterMarket>;
556
+ submit_query_: (new_query?: string) => void;
557
+ class_list_?: Accessor<Record<string, boolean>>;
558
+ url_transformer_?: (url_object: URL) => unknown;
559
+ disable_scrolling_?: boolean;
560
+ closing_animation_?: () => Promise<any>;
561
+ register_closing_animation_: (animation: () => Promise<any>) => void;
562
+ bottom_distance_under_modal_?: Accessor<number | undefined>;
563
+ selected_text_range_?: [number | null, number | null];
564
+ router_: PseudoRouter;
565
+ sorting_query_param_: string;
566
+ filter_query_param_prefix_: string;
567
+ setSearchFieldOuterWidth_?: Setter<number>;
568
+ instant_results_options_: {
569
+ min_products_to_fetch_: number;
570
+ has_sort_or_filters_: Accessor<boolean>;
571
+ };
572
+ i18n_: solid_search_i18n;
573
+ /** Should we include category suggestions. Defaults to true */
574
+ enable_category_suggestions_?: boolean;
575
+ dont_sync_search_field_value_except_on_submit_?: boolean;
576
+ content_search_enabled_: Accessor<boolean>;
577
+ }): HTMLDivElement[];
578
+ export const SearchModalV2: typeof RawSearchModalV2;
77
579
  type PossibleLayout = "grid" | "slider" | "slider-without-filters";
78
580
  export type BaseProviderConfig<InputDisplay extends Display, PossibleTransformedDisplay extends ModernDisplay | never> = {
79
581
  /**
@@ -117,7 +619,7 @@ export type BaseProviderConfig<InputDisplay extends Display, PossibleTransformed
117
619
  */
118
620
  displayTransformers?: never;
119
621
  });
120
- export type BaseSearchProviderConfig = {
622
+ export type BaseSearchProviderConfig<InputDisplay extends Display, PossibleTransformedDisplay extends ModernDisplay | never> = {
121
623
  /**
122
624
  * The path to the search page.
123
625
  * @example "/search", "/sok"
@@ -139,6 +641,17 @@ export type BaseSearchProviderConfig = {
139
641
  * @default false
140
642
  */
141
643
  enableContentSearch?: boolean;
644
+ /**
645
+ * The search modal component to use. You can switch between the classic and the new search modal. Provide one of the components here that you can import from the same package as the one you're using to see this message.
646
+ * You also need to reflect the choice in SCSS, example:
647
+ * ```scss
648
+ * @use "@depict-ai/js-ui" as plp-styling with (
649
+ * $search-modal-layout: "v2" // or "classic"
650
+ * );
651
+ * ```
652
+ * The default is SearchModalV2. That means that ClassicSearchModal can get tree-shaken if you use v2 but not vice-versa. To force SearchModalV2 from being tree-shaken, set process.env.NO_SEARCH_MODAL_DEFAULT to "true".
653
+ */
654
+ searchModalComponent?: typeof SearchModalV2<InputDisplay, PossibleTransformedDisplay> | typeof ClassicSearchModal;
142
655
  };
143
656
  export type BaseCategoryProviderConfig = {
144
657
  /**
@@ -177,99 +690,30 @@ export interface BaseCategoryPageConfig extends BaseProductListingConfig {
177
690
  * Whether to show the breadcrumbs in the category page.
178
691
  * @default true
179
692
  */
180
- showBreadcrumbs?: boolean;
181
- /**
182
- * Whether to show the quicklinks in the category page.
183
- * @default true
184
- */
185
- showQuicklinks?: boolean;
186
- /**
187
- * The layout used for listing the products.
188
- * 1. `"grid"` is the default and shows the products in a grid
189
- * 2. `"slider"` shows the products in a slider and has default `false` for showBreadcrumbs and showQuicklinks
190
- * 3. `"slider-without-filters"` is the same as `"slider"` but does also not render any sorting or filter buttons
191
- * @default "grid"
192
- */
193
- layout?: PossibleLayout;
194
- }
195
- /**
196
- * The listing to query Depict for. `type` can be `"listingId"` or `"externalId"` and `id` is the actual id.
197
- * If `id` is `"listingId"`, it should be a uuid where Depict is the source of truth, you can get them here: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get.
198
- * If `id` is `"externalId"`, it should be the id of the product listing in your system - whatever was passed to Depict during data ingestion.
199
- */
200
- export type ListingQuery = {
201
- type: typeof LISTING_ID | typeof EXTERNAL_ID;
202
- id: string;
203
- };
204
- /** @jsxImportSource solid-js */
205
- export function GenericSliderArrowButton(props?: {
206
- width_?: number;
207
- height_?: number;
208
- }): SVGElement;
209
- export function SlidableItems({
210
- children,
211
- slider_ref_,
212
- faded_opacity_,
213
- mutation_plugins_,
214
- disable_fading_,
215
- arrow_width_,
216
- arrow_height_
217
- }: {
218
- children?: JSX.Element;
219
- slider_ref_?: (slider: Amazing_Slider) => any;
220
- faded_opacity_?: number;
221
- disable_fading_?: boolean;
222
- mutation_plugins_?: ((this: Amazing_Slider, mutations: IntersectionObserverEntry[], intersecting_items: Record<number, IntersectionObserverEntry>) => unknown)[];
223
- arrow_width_?: number;
224
- arrow_height_?: number;
225
- }): JSX.Element;
226
- /**
227
- * Renders a set of tabs
228
- * Will ignore any children that's not a <Tab />
229
- * Will cache children after the first visit, so they don't get re-created when closing and re-opening a tab
230
- */
231
- export function Tabs(props: Parameters<typeof ActualTabs>[0]): JSX.Element;
232
- declare function ActualTabs(props: {
233
- children: JSX.Element;
234
- wrapTabBar?: (navElement: JSX.Element) => JSX.Element;
235
- slidable?: boolean;
236
- /**
237
- * Component to use for creating an anchor (<a> tag) for the tab bar
238
- */
239
- AnchorComponent: (props: JSX.AnchorHTMLAttributes<HTMLAnchorElement> & {
240
- children: JSX.Element;
241
- }) => JSX.Element;
242
- }): JSX.Element;
243
- /**
244
- * Renders a tab
245
- * Provide a custom id if you want to link to it from outside the tabs (i.e. provide "hello" and then linking to "#hello" focuses the tab). The id has to be unique.
246
- */
247
- export function Tab(props: {
248
- label: JSX.Element;
249
- children: JSX.Element;
250
- onSelected?: VoidFunction;
251
- id?: string;
252
- }): undefined;
693
+ showBreadcrumbs?: boolean;
694
+ /**
695
+ * Whether to show the quicklinks in the category page.
696
+ * @default true
697
+ */
698
+ showQuicklinks?: boolean;
699
+ /**
700
+ * The layout used for listing the products.
701
+ * 1. `"grid"` is the default and shows the products in a grid
702
+ * 2. `"slider"` shows the products in a slider and has default `false` for showBreadcrumbs and showQuicklinks
703
+ * 3. `"slider-without-filters"` is the same as `"slider"` but does also not render any sorting or filter buttons
704
+ * @default "grid"
705
+ */
706
+ layout?: PossibleLayout;
707
+ }
253
708
  /**
254
- * Basically allows you to use SearchModal
255
- * So the idea is to have a modal. It should either be rendered and exist, in which case it is in the foreground and open, or it's completely gone. This makes things easier.
256
- * @param search_modal a function which returns an array of nodes that get appended into <body>. This function will run in its own solid-js root which will call onCleanup and cleanup all reactive things inside it when the modal is closed. This function will get the arguments passed to open_modal_ and the modal_fn_opts merged together, along with register_closing_animation_ where an async function that resolves once the animation is finished can be provided to animate the closing of the modal
257
- * @param modal_fn_opts static options for the modal that won't change on a per-opening basis
258
- * @param parent override the parent element to append the modal to. Defaults to <body>
259
- @returns a function to open and close the modal. When calling the open_modal_ function additional parameters can be passed to the modal
709
+ * The listing to query Depict for. `type` can be `"listingId"` or `"externalId"`..
710
+ * If `id` is `"listingId"`, it should be a uuid where Depict is the source of truth, you can get them here: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get.
711
+ * If `id` is `"externalId"`, it should be the id of the product listing in your system - whatever was passed to Depict during data ingestion.
260
712
  */
261
- export function general_modal_abstraction<StaticOptions extends {
262
- [key: string]: any;
263
- }, ExtraOptionsProvidedOnOpen extends {
264
- [key: string]: any;
265
- }>(search_modal: (options: StaticOptions & ExtraOptionsProvidedOnOpen & {
266
- close_modal_: VoidFunction;
267
- open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
268
- register_closing_animation_: (animation: () => Promise<any>) => void;
269
- }) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
270
- open_modal_: (extra_options_for_modal?: any, on_dispose?: VoidFunction | undefined) => Promise<void | undefined>;
271
- close_modal_: () => void | undefined;
272
- }>;
713
+ export type ListingQuery = {
714
+ type: typeof LISTING_ID | typeof EXTERNAL_ID;
715
+ id: string;
716
+ };
273
717
  export type OnNavigation = ((options: {
274
718
  is_replace: boolean;
275
719
  new_url: URL;
@@ -315,71 +759,122 @@ declare class PseudoRouter {
315
759
  constructor(on_navigation: OnNavigation, listing_query_state_key?: string);
316
760
  }
317
761
  /**
318
- * Makes signals out of values in history.state so that you can use history state as an intuitive storage of application state.
319
- * @param params_to_default_value an object of keys with a serialisable default value.
320
- * @param router_ router used to replace state
321
- * @returns An object with the same keys as provided with the value being a Signal containing the default value. When the signal is set, history.replaceState is called and the key/value is put into history.state. If something else pushes a new state or the state is poped the signal value will update to always be in-line with the value of history.state.
762
+ * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
322
763
  */
323
- export function history_dot_state_to_state<Param extends string, DefaultValue>(params_to_default_value: Record<Param, DefaultValue>, router_: PseudoRouter): Record<Param, Signal<any>>;
764
+ export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
324
765
  /**
325
- * Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
326
- * @returns A cleanup function to manually re-enable scrolling.
766
+ * First generation (classic) search modal - the solid component that gets added to <body> when the search modal is opened
327
767
  */
328
- export function disable_scrolling(): () => void;
329
- declare class SDKError extends Error {}
330
- export class ProductCardError extends SDKError {
331
- constructor(templateError: Error);
332
- }
333
- export function SentryErrorBoundary(props: {
768
+ declare function RawClassicSearchModal({
769
+ search_field_value_: props_search_field_value,
770
+ get_search_query_,
771
+ search_query_url_param_name_,
772
+ previous_searches_,
773
+ close_modal_,
774
+ depict_api_,
775
+ merchant_,
776
+ market_,
777
+ submit_query_: props_submit_query,
778
+ instant_results_options_,
779
+ register_closing_animation_,
780
+ url_transformer_,
781
+ closing_animation_,
782
+ clear_filters_,
783
+ i18n_,
784
+ disable_scrolling_,
785
+ enable_category_suggestions_,
786
+ class_list_,
787
+ bottom_distance_under_modal_,
788
+ selected_text_range_,
789
+ dont_sync_search_field_value_except_on_submit_,
790
+ router_,
791
+ content_search_enabled_,
792
+ alignmentSignals_
793
+ }: {
794
+ search_field_value_: Signal<string>;
795
+ get_search_query_: Accessor<string>;
796
+ search_query_url_param_name_: string;
797
+ previous_searches_: Signal<string[]>;
798
+ close_modal_: VoidFunction;
799
+ depict_api_: DepictAPI<any>;
800
+ clear_filters_: (user_triggered: boolean) => void;
801
+ merchant_: Accessor<string>;
802
+ market_: Accessor<TwoLetterMarket>;
803
+ submit_query_: (new_query?: string) => void;
804
+ class_list_?: Accessor<Record<string, boolean>>;
805
+ url_transformer_?: (url_object: URL) => unknown;
806
+ disable_scrolling_?: boolean;
807
+ closing_animation_?: () => Promise<any>;
808
+ register_closing_animation_: (animation: () => Promise<any>) => void;
809
+ bottom_distance_under_modal_?: Accessor<number | undefined>;
810
+ alignmentSignals_?: ModalAlignmentSignals;
811
+ selected_text_range_?: [number | null, number | null];
812
+ router_: PseudoRouter;
813
+ instant_results_options_: {
814
+ min_products_to_fetch_: number;
815
+ has_sort_or_filters_: Accessor<boolean>;
816
+ };
817
+ i18n_: solid_search_i18n;
818
+ /** Should we include category suggestions. Defaults to true */
819
+ enable_category_suggestions_?: boolean;
820
+ dont_sync_search_field_value_except_on_submit_?: boolean;
821
+ content_search_enabled_: Accessor<boolean>;
822
+ }): HTMLDivElement[];
823
+ export const ClassicSearchModal: typeof RawClassicSearchModal;
824
+ /**
825
+ * Renders a set of tabs
826
+ * Will ignore any children that's not a <Tab />
827
+ * Will cache children after the first visit, so they don't get re-created when closing and re-opening a tab
828
+ */
829
+ export function Tabs(props: Parameters<typeof ActualTabs>[0]): JSX.Element;
830
+ declare function ActualTabs(props: {
334
831
  children: JSX.Element;
335
- message_: string;
336
- severity_: Parameters<typeof report>[1];
337
- on_error_?: (retry: VoidFunction) => JSX.Element | void;
338
- class_list_?: string[];
832
+ wrapTabBar?: (navElement: JSX.Element) => JSX.Element;
833
+ slidable?: boolean;
834
+ /**
835
+ * Component to use for creating an anchor (<a> tag) for the tab bar
836
+ */
837
+ AnchorComponent: (props: JSX.AnchorHTMLAttributes<HTMLAnchorElement> & {
838
+ children: JSX.Element;
839
+ }) => JSX.Element;
339
840
  }): JSX.Element;
340
- export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
341
841
  /**
342
- * Base placeholder component used by ImagePlaceholder and TextPlaceholder
842
+ * Renders a tab
843
+ * Provide a custom id if you want to link to it from outside the tabs (i.e. provide "hello" and then linking to "#hello" focuses the tab). The id has to be unique.
343
844
  */
344
- export function BasePlaceholder(props: {
345
- style: JSX.CSSProperties;
346
- class?: string;
347
- }): JSX.Element;
348
- type ImagePlaceholderBaseOptions = {
349
- style?: JSX.CSSProperties;
350
- class?: string;
351
- };
352
- type ImagePlaceholderBlockOptions = {
353
- width: string;
354
- height: string;
355
- };
356
- type ImagePlaceholderImageOptions = {
357
- aspectRatio: number;
358
- };
845
+ export function Tab(props: {
846
+ label: JSX.Element;
847
+ children: JSX.Element;
848
+ onSelected?: VoidFunction;
849
+ id?: string;
850
+ }): undefined;
359
851
  /**
360
- * A placeholder that can be used instead of an image or other block of content while it's loading.
361
- * 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.
362
- * @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
363
- * @property width If width and height is set, the defined width and height will be used.
364
- * @property height If width and height is set, the defined width and height will be used.
365
- * @property class extra classes to add to the placeholder
366
- * @property style extra styles to add to the placeholder
852
+ * Basically allows you to use SearchModal
853
+ * So the idea is to have a modal. It should either be rendered and exist, in which case it is in the foreground and open, or it's completely gone. This makes things easier.
854
+ * @param search_modal a function which returns an array of nodes that get appended into <body>. This function will run in its own solid-js root which will call onCleanup and cleanup all reactive things inside it when the modal is closed. This function will get the arguments passed to open_modal_ and the modal_fn_opts merged together, along with register_closing_animation_ where an async function that resolves once the animation is finished can be provided to animate the closing of the modal
855
+ * @param modal_fn_opts static options for the modal that won't change on a per-opening basis
856
+ * @param parent override the parent element to append the modal to. Defaults to <body>
857
+ @returns a function to open and close the modal. When calling the open_modal_ function additional parameters can be passed to the modal
367
858
  */
368
- export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
859
+ export function general_modal_abstraction<StaticOptions extends {
860
+ [key: string]: any;
861
+ }, ExtraOptionsProvidedOnOpen extends {
862
+ [key: string]: any;
863
+ }>(search_modal: (options: StaticOptions & ExtraOptionsProvidedOnOpen & {
864
+ close_modal_: VoidFunction;
865
+ open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
866
+ register_closing_animation_: (animation: () => Promise<any>) => void;
867
+ }) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
868
+ open_modal_: (extra_options_for_modal?: any, on_dispose?: VoidFunction | undefined) => Promise<void | undefined>;
869
+ close_modal_: () => void | undefined;
870
+ }>;
369
871
  /**
370
- * 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.
371
- * If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
372
- * @property height height of the placeholder. Set to `1em` by default.
373
- * @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
374
- * @property class extra classes to add to the placeholder
375
- * @property style extra styles to add to the placeholder
872
+ * Makes signals out of values in history.state so that you can use history state as an intuitive storage of application state.
873
+ * @param params_to_default_value an object of keys with a serialisable default value.
874
+ * @param router_ router used to replace state
875
+ * @returns An object with the same keys as provided with the value being a Signal containing the default value. When the signal is set, history.replaceState is called and the key/value is put into history.state. If something else pushes a new state or the state is poped the signal value will update to always be in-line with the value of history.state.
376
876
  */
377
- export function TextPlaceholder(props: {
378
- style?: JSX.CSSProperties;
379
- height: string;
380
- width: string;
381
- class?: string;
382
- }): JSX.Element;
877
+ export function history_dot_state_to_state<Param extends string, DefaultValue>(params_to_default_value: Record<Param, DefaultValue>, router_: PseudoRouter): Record<Param, Signal<any>>;
383
878
  export const CategoryTitle: ({
384
879
  category_title_,
385
880
  product_count_
@@ -396,44 +891,6 @@ export const defaultCategoryTitlePlugin: ({
396
891
  category_title_: import("solid-js").Accessor<string | undefined>;
397
892
  product_count_: import("solid-js").JSX.Element;
398
893
  }) => import("solid-js").JSX.Element;
399
- export type SolidLayoutOptions = {
400
- cols_at_size: ColsAtSize;
401
- grid_spacing: string;
402
- rows: {
403
- start_rows?: number;
404
- rows_per_click?: number;
405
- currently_visible?: Signal<number>;
406
- max_rows?: number;
407
- button?: JSX.Element;
408
- view_less_button?: JSX.Element;
409
- } | "all";
410
- layout: "slider" | "grid";
411
- disable_partial_rows?: boolean;
412
- override_vertical_spacing?: string;
413
- children: JSX.Element;
414
- element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
415
- };
416
- /**
417
- * 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.
418
- * @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
419
- * @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`
420
- * @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
421
- * @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".
422
- * @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
423
- * @return An accessor containing a CSS string
424
- */
425
- export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
426
- /**
427
- * Provider to wrap every listing (group of products) in
428
- * Used for example for deduplicating ResizeObservers for responsive images
429
- */
430
- export function ListingProvider(props: {
431
- children: JSX.Element;
432
- }): JSX.Element;
433
- /**
434
- * Use this to get the context object if your component is within a ListingProvider
435
- */
436
- export function useListing(): Record<symbol, any> | undefined;
437
894
  /**
438
895
  * Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
439
896
  * If no merchant or market is specified, the product cards won't get any merchant and market in their second argument.
@@ -463,110 +920,35 @@ type ShopTheLookOpenModalOptions<T extends Display> = {
463
920
  type ShopTheLookButtonProps<T extends Display> = ShopTheLookOpenModalOptions<T> & {
464
921
  buttonAttributes?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
465
922
  };
466
- export function ShopTheLookButton<T extends Display>(props: ShopTheLookButtonProps<T>): JSX.Element;
467
- /**
468
- * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
469
- */
470
- export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
471
- /**
472
- * The interface for a content block.
473
- * Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
474
- * The height of the content block will be the height of the tallest item in a row, so if there are no products in a row the content block needs to "bring its own height".
475
- * If you need to load any data in the content block, please make sure to return a placeholder while you're doing so (see `ImagePlaceholder`), to avoid layout shifts and ensure scroll restoration works correctly.
476
- *
477
- * - `span_columns`: How many columns the block should span. This will be capped to the number of columns available.
478
- * - `span_rows`: How many rows the block should span.
479
- * - `position`: Where the block should be positioned. Can be `left`, `center` or `right`.
480
- * - `content`: The content to render in the block - please provide a function returning one or multiple HTML elements.
481
- */
482
- export type ContentBlock = {
483
- span_columns: number;
484
- span_rows: number;
485
- position: "left" | "center" | "right";
486
- content: () => JSX.Element | Promise<JSX.Element>;
487
- };
488
- /**
489
- * A sparse array containing content blocks to show (or an empty slot or undefined if there's no block at that index). See ContentBlock for how a content block looks like. The index is the row where the content block should be shown.
490
- * For example, to create a block on row 1 and 3 you'd do `[, block1, , block2]`.
491
- * Alternatively:
492
- * ```
493
- * const blocks = [];
494
- * blocks[1] = block1;
495
- * blocks[3] = block2;
496
- * ```
497
- */
498
- export type ContentBlocksByRow = (undefined | ContentBlock)[];
499
- /**
500
- * Function that encodes a filter object into query parameters and sets them on the given URLSearchParams object.
501
- */
502
- export function encode_filters(filters: FilterWithData[], search_params: URLSearchParams, filter_query_param_prefix: string): void;
503
- /**
504
- * Function that decodes the filters from the provided query parameters and returns them as an array of filter objects.
505
- */
506
- export function decode_filters(search_params: URLSearchParams, filter_query_param_prefix: string): FilterWithData[];
507
- /**
508
- * Function that encodes a sort model into a query paremeter and sets them on the given URLSearchParams object.
509
- */
510
- export function encode_sorting(sorting: SortModel | undefined, search_params: URLSearchParams, sorting_query_param: string): void;
511
- /**
512
- * Function that decodes the sort model from the provided query parameters and returns it as a sort model, if present.
513
- */
514
- export function decode_sorting(search_params: URLSearchParams, sorting_query_param_: string): SortModel | undefined;
515
- /**
516
- * Remove all Depict filter/sorting query parameters from the given URLSearchParams object.
517
- * Used to reset the URLSearchParams object to a clean state, before adding new filters/sorting.
518
- * @param search_params
519
- * @param filter_query_param_prefix Prefix of the filter query parameters
520
- * @param sorting_query_param
521
- */
522
- export function strip_encoded_filter_and_sort(search_params: URLSearchParams, filter_query_param_prefix: string, sorting_query_param: string): void;
523
- /**
524
- * ImageContainer for using the padding hack to set the aspect ratio of an image
525
- * Put this around an <img> or <ResponsiveImg> to give it a container that always has the same size as the image. This prevents CLS and enables ResponsiveImg to work (the browser to load the correct image size)
526
- * (Not using the CSS aspect-ratio property yet here due to browser support)
527
- */
528
- export function ImageContainer(props: {
529
- aspectRatio: number;
530
- class?: string;
531
- children?: JSX.Element;
532
- }): HTMLDivElement;
533
- /**
534
- * Returns an accessor that will update when the size of the provided element changes, to be used with ResponsiveImg
535
- */
536
- export function makeSizeAccessor(whatToWatch: HTMLElement): Accessor<number>;
923
+ export function ShopTheLookButton<T extends Display>(props: ShopTheLookButtonProps<T>): JSX.Element;
537
924
  /**
538
- * Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
539
- * Will also delay loading and decoding of image until the browser is idle (with 5s timeout) to improve filtering/loading more performance.
540
- * This is used for our responsive images:
541
- * 1. The image must have a container with a fixed size (or aspect ratio) that is independent of the image. When aspectRatio is configured on the depict-cards element as data attribute, we will wrap the image in a ImageContainer for this. If it's false, the user has to provide this container themselves.
542
- * 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
543
- * 3. We set the size attribute of all the visible images to the size of the container we're observing. The point of this is that the sizes attribute is used to determine which image to load, and usually it's set by the user and depends on the relationship between image size and viewport size. By using a ResizeObserver, we can make sure the sizes attribute is always set to the correct value without it having to be configured. This will make so the browser always loads the correct image size for a crisp image but still fast load.
544
- * You need to use insert(domNode, <ShopifyResponsiveImg size={sizeAccessor} src={src} />) if you want to insert the return value of this component into a DOM element manually, where you `import { insert } from "solid-js/web";` because we first want to insert the image once it has loaded.
925
+ * The interface for a content block.
926
+ * Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
927
+ * The height of the content block will be the height of the tallest item in a row, so if there are no products in a row the content block needs to "bring its own height".
928
+ * If you need to load any data in the content block, please make sure to return a placeholder while you're doing so (see `ImagePlaceholder`), to avoid layout shifts and ensure scroll restoration works correctly.
929
+ *
930
+ * - `span_columns`: How many columns the block should span. This will be capped to the number of columns available.
931
+ * - `span_rows`: How many rows the block should span.
932
+ * - `position`: Where the block should be positioned. Can be `left`, `center` or `right`.
933
+ * - `content`: The content to render in the block - please provide a function returning one or multiple HTML elements.
545
934
  */
546
- export function ShopifyResponsiveImg(props: {
547
- resolutions?: number[];
548
- size: Accessor<number>;
549
- } & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes"> & {
550
- src: string;
551
- }): JSX.Element;
552
- export const shopifyContainedImageContextSymbol: unique symbol;
935
+ export type ContentBlock = {
936
+ span_columns: number;
937
+ span_rows: number;
938
+ position: "left" | "center" | "right";
939
+ content: () => JSX.Element | Promise<JSX.Element>;
940
+ };
553
941
  /**
554
- * Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.
555
- * Will return a div of the provided aspect ratio that always has the same size, to avoid content layout shift. Will then put the image inside of the container once it loads.
556
- * Also makes a responsive image without you having to do anything: uses shopify's CDN which picks the best image format to resize the image to the size of the first image container in a certain listing.
557
- * This works because the listings (recs, search, plp) all are wrapped in `<ListingProvider>`'s. This means all components rendered within can use `useListing` to get an object to write data to that will be the same for all components rendered within that listing. The first instance of this component rendered within a listing puts a ResizeObserver on its div and the other components then just set the sizes attribute of their image to that.
558
- * @property src image source
559
- * @property aspectRatio aspect ratio of the image
560
- * @property class extra class to add to the container
561
- * @property alt alt text for the image
562
- * @property imgProps props to pass to ShopifyResponsiveImg to add to the <img> element
942
+ * A sparse array containing content blocks to show (or an empty slot or undefined if there's no block at that index). See ContentBlock for how a content block looks like. The index is the row where the content block should be shown.
943
+ * For example, to create a block on row 1 and 3 you'd do `[, block1, , block2]`.
944
+ * Alternatively:
945
+ * ```
946
+ * const blocks = [];
947
+ * blocks[1] = block1;
948
+ * blocks[3] = block2;
949
+ * ```
563
950
  */
564
- export function ShopifyContainedImage(props: {
565
- src: string;
566
- aspectRatio: number;
567
- class?: string;
568
- imgProps?: Omit<Parameters<typeof ShopifyResponsiveImg>[0], "size" | "src">;
569
- }): HTMLDivElement;
951
+ export type ContentBlocksByRow = (undefined | ContentBlock)[];
570
952
  /**
571
953
  * Returns accessor with the size of the provided element, including padding and border (I think)
572
954
  */
@@ -591,102 +973,6 @@ export function ExpandingDetails(props: {
591
973
  dont_animate_if_instant_open_?: boolean;
592
974
  }): HTMLDetailsElement;
593
975
  export function accessor_of_object_to_object_with_accessor_values<O extends Record<string | symbol, any>>(obj: Accessor<O>): { [K in keyof O]: Accessor<O[K]> };
594
- /**
595
- * Like standard_price_format except that the price and the formatting are reactive accessors
596
- */
597
- export function SolidFormatPrice(props: {
598
- price_: number;
599
- price_formatting_: {
600
- pre_: string;
601
- post_: string;
602
- decimal_places_delimiter_: string;
603
- thousands_delimiter_: string;
604
- places_after_comma_: number | "auto";
605
- };
606
- }): JSX.Element;
607
- /**
608
- * PLP internationalisation shared between search and category listing
609
- */
610
- type plp_shared_i18n = {
611
- backend_locale_: string;
612
- scroll_to_top_: string;
613
- back_: string;
614
- open_sorting_: string;
615
- close_sorting_: string;
616
- open_filters_: string;
617
- close_filters_: string;
618
- close_: string;
619
- ok_: string;
620
- filters_cleared_: string;
621
- we_cleared_your_filters_: string;
622
- restore_: string;
623
- sorting_text_: string;
624
- filter_text_: string;
625
- selected_filters_title_: string;
626
- filters_: string;
627
- view_less_: string;
628
- view_more_: string;
629
- clear_all_from_filter_crumbs_: string;
630
- clear_individual_filter_: string;
631
- of_: string;
632
- clear_all_filters_from_big_button_: string;
633
- try_without_filters_: string;
634
- range_filter_low_point_aria_label_: string;
635
- range_filter_high_point_aria_label_: string;
636
- morphing_sign_expanded_aria_label_: string;
637
- morphing_sign_collapsed_aria_label_: string;
638
- search_a_filter_: (filter_section: string) => string;
639
- price_formatting_: {
640
- pre_: string;
641
- post_: string;
642
- decimal_places_delimiter_: string;
643
- thousands_delimiter_: string;
644
- places_after_comma_: number | "auto";
645
- };
646
- };
647
- /**
648
- * Search internationalisation
649
- */
650
- interface search_i18n extends plp_shared_i18n {
651
- placeholder_text_: string;
652
- show_n_results_: (number_of_results: HTMLElement) => Elem[];
653
- no_results_text_: string;
654
- no_products_: string;
655
- search_recs_title_: string;
656
- clear_filters_query_sorting_after_submit_: string;
657
- modal_view_all_results_: (number_of_results: HTMLElement) => Elem[];
658
- modal_discover_more_: string;
659
- get_showing_results_for_: (query: HTMLElement, number_of_results_element: HTMLElement, has_query: boolean, number_of_results: number | undefined) => Elem[];
660
- get_showing_pages_for_: (query: HTMLElement, number_of_results_element: HTMLElement, has_query: boolean, number_of_results: number | undefined) => Elem[];
661
- previous_searches_text_: string;
662
- category_: string;
663
- brand_: string;
664
- suggestions_: string;
665
- search_submit_button_aria_label_: string;
666
- search_field_field_aria_label_: string;
667
- previous_searches_delete_entry_from_history_: string;
668
- content_: string;
669
- }
670
- /**
671
- * Category internationalisation
672
- */
673
- interface category_i18n extends plp_shared_i18n {
674
- show_n_products_: (number_of_results: HTMLElement) => Elem[];
675
- no_products_text_: string;
676
- product_: string;
677
- products_: string;
678
- breadcrumbs_aria_label_: string;
679
- quicklinks_aria_label_: string;
680
- breadcrumbs_separator_: string;
681
- }
682
- /**
683
- * For anything that is not exposed and only used internally we can use solid signals to get more performant rendering.
684
- * For anything that can be used outside of solid, like Product Cards and InstantCards these types should not be used.
685
- *
686
- * Any solid_ type below should not be exposed outside of this library, as the accessors can be confusing and unnecessary.
687
- */
688
- /** For internal components using i18n that gets wrapped in solid's Accessors */
689
- type solid_plp_shared_i18n = { [K in keyof plp_shared_i18n]: Accessor<plp_shared_i18n[K]> };
690
976
  export function show_toast({
691
977
  children,
692
978
  on_close_,
@@ -817,81 +1103,6 @@ type RecsAPIWrapperOptions = {
817
1103
  * @return This function is guaranteed to return an array of Displays. If anything fails, you will get an empty array.
818
1104
  */
819
1105
  export function fetchDepictRecommendations<T extends ModernDisplay = ModernDisplay>(options: RecsAPIWrapperOptions): Promise<T[]>;
820
- export type InstantCard<T extends Display> = (display: T, context: {
821
- index: number;
822
- i18n: search_i18n;
823
- merchant: string;
824
- market: string;
825
- }) => JSX.Element;
826
- type CategorySuggestionAfterURLCreator = ListingSuggestion & {
827
- page_url: string;
828
- };
829
- type ReplaceCategorySuggestion<T> = T extends ListingSuggestion ? CategorySuggestionAfterURLCreator : T extends ListingSuggestion[] ? CategorySuggestionAfterURLCreator[] : T;
830
- type SearchSuggestionsResponseAfterURLCreator = { [K in keyof SearchSuggestionsResponseV3]: ReplaceCategorySuggestion<SearchSuggestionsResponseV3[K]> };
831
- type AddPageUrlToDisplay<T extends any[]> = (T[number] & {
832
- page_url: string;
833
- })[];
834
- type SearchResponseAfterDisplayTransformer = { [K in keyof SearchResponse]: K extends "displays" ? AddPageUrlToDisplay<SearchResponse[K]> : K extends "filters" ? AddActualFieldToFilters<SearchResponse[K]> : SearchResponse[K] };
835
- type ProductListingWithPageURL = ProductListing & {
836
- page_url: string;
837
- };
838
- type _AddPageUrlToDisplay1<T extends any[]> = (T[number] & {
839
- page_url: string;
840
- })[];
841
- type ProductListingResponseAfterDisplayTransformer = { [K in keyof ProductListingResponseV3]: K extends "displays" ? _AddPageUrlToDisplay1<ProductListingResponseV3[K]> : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV3[K]> : ProductListingResponseV3[K] };
842
- type GetListingResponseAfterDisplayTransformer = { [K in keyof GetListingResponseWithQuicklinksAndBreadcrumbs]: K extends "breadcrumbs" ? ProductListingWithPageURL[] : K extends "quick_links" ? ProductListingWithPageURL[] : GetListingResponseWithQuicklinksAndBreadcrumbs[K] };
843
- type GetListingResponseWithQuicklinksAndBreadcrumbs = Omit<GetListingResponse, "siblings" | "ancestors" | "children"> & {
844
- quick_links: ProductListingWithAncestors[];
845
- breadcrumbs: ProductListingWithAncestors[];
846
- };
847
- type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
848
- get_metadata?: () => Promise<{
849
- [k: string]: string;
850
- } | undefined>;
851
- get_session_id?: () => string | undefined;
852
- } & SomethingTakingADisplayTransformers<InputDisplay, OutputDisplay>;
853
- interface GetListingOptions extends Omit<GetListingRequest, "listing_id"> {
854
- session_id?: string;
855
- id_to_query_for_: string;
856
- id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
857
- }
858
- /**
859
- * Class that handles all communication done in PLP code with the Depict API. (Notably not for recommendations currently).
860
- * It handles caching, retries and errors and is the only place that should be making requests to the Depict API.
861
- */
862
- export class DepictAPI<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never = InputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<InputDisplay> : never> {
863
- #private;
864
- display_transformers: DisplayTransformers<ModernDisplay, OutputDisplay> | undefined;
865
- constructor(options: DepictAPIConstructorOptions<InputDisplay, OutputDisplay>);
866
- suggest(input_req: SearchSuggestionsRequestV3): Promise<SearchSuggestionsResponseAfterURLCreator & {
867
- failed?: true;
868
- }>;
869
- query(input_req: SearchRequestV3): Promise<SearchResponseAfterDisplayTransformer & {
870
- failed?: true;
871
- }>;
872
- get_listing({
873
- id_type_,
874
- id_to_query_for_,
875
- ...input_req
876
- }: GetListingOptions): Promise<GetListingResponseAfterDisplayTransformer & {
877
- failed?: true;
878
- }>;
879
- get_listing_products({
880
- id_to_query_for_,
881
- id_type_,
882
- ...input_req_
883
- }: ProductListingRequestV3 & {
884
- id_to_query_for_: string;
885
- id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
886
- }): Promise<ProductListingResponseAfterDisplayTransformer & {
887
- failed?: true;
888
- }>;
889
- get_recommended<T extends Display>(input_req: BaseSearchRequestV3): Promise<{
890
- displays: T[];
891
- } & {
892
- failed?: true | undefined;
893
- }>;
894
- }
895
1106
  /**
896
1107
  * 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.
897
1108
  * 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
@@ -991,31 +1202,8 @@ export function QuickLinks<T extends Display>({
991
1202
  * Gets available listings for a given merchant, market and locale
992
1203
  */
993
1204
  export function get_listings(merchant: string, market: string, locale: string): Promise<import("@depict-ai/types/api/ListListingsResponseItem").ListListingsResponseItem1[]>;
994
- export function DefaultInstantCardPlaceholder(): HTMLDivElement;
995
- /**
996
- * Useful for aligning the search modal to an element, like an existing input field
997
- * @param modal_body_style a signal containing the style properties that will be applied to the modal body. You provide it to open_modal_ as `style_props_` when using SearchModal
998
- * @param input_field the element to align to.
999
- * @param width_transformer A function that gets to change the width value before it is being applied
1000
- * @param includeScroll Should the aligner offset with scrolling? Useful to set to false when using position: fixed
1001
- * @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
1002
- * @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
1003
- */
1004
- 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;
1005
- interface Styles {
1006
- [selector: string]: JSX.CSSProperties;
1007
- }
1008
- export const styles_to_valid_css_string: (styles: Styles) => string;
1009
1205
  /** A function that renders category suggestion cards. Set to false to disable category suggestions. */
1010
- export type RenderCategorySuggestion = (category_suggestion: Accessor<CategorySuggestionAfterURLCreator>, index: number) => JSX.Element;
1011
- /**
1012
- * Connects the height of the search field to the height of the aligner.
1013
- * @param aligner
1014
- * @returns
1015
- */
1016
- export function connect_search_field_height_to_aligner_height(aligner: HTMLElement): {
1017
- cleanup: () => void;
1018
- };
1206
+ export type RenderCategorySuggestion = (category_suggestion: Accessor<ListingSuggestionAfterURLCreator>, index: number) => JSX.Element;
1019
1207
  type GeneralConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
1020
1208
  search_query_url_param_name?: string;
1021
1209
  market: string;
@@ -1026,9 +1214,9 @@ type GeneralConstructorOptions<InputDisplay extends Display, OutputDisplay exten
1026
1214
  enable_category_suggestions?: boolean;
1027
1215
  enable_content_search?: boolean;
1028
1216
  unique_instance_key_for_state?: string;
1217
+ searchModalComponent: typeof SearchModalV2<InputDisplay, OutputDisplay> | typeof ClassicSearchModal;
1029
1218
  disable_scrolling_during_modal?: boolean;
1030
1219
  bottom_distance_under_modal?: Accessor<number | undefined>;
1031
- render_instant_card?: InstantCard<OutputDisplay extends ModernDisplay ? OutputDisplay : InputDisplay>;
1032
1220
  override_modal_element?: HTMLElement | ShadowRoot;
1033
1221
  };
1034
1222
  type ConstructorOptionsWithApi<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = GeneralConstructorOptions<InputDisplay, OutputDisplay> & {
@@ -1042,8 +1230,9 @@ type ConstructorOptionsWithoutAPI<InputDisplay extends Display, OutputDisplay ex
1042
1230
  } & SomethingTakingADisplayTransformers<InputDisplay, OutputDisplay>;
1043
1231
  type ConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay> = ConstructorOptionsWithApi<InputDisplay, OutputDisplay> | ConstructorOptionsWithoutAPI<InputDisplay, OutputDisplay>;
1044
1232
  export type OpenModalArguments = [options_for_modal?: {
1045
- style_props_?: Signal<JSX.CSSProperties>;
1233
+ alignmentSignals_?: ModalAlignmentSignals;
1046
1234
  closing_animation_?: () => Promise<any>;
1235
+ setSearchFieldOuterWidth_?: Setter<number>;
1047
1236
  class_list_?: Accessor<Record<string, boolean>>;
1048
1237
  selected_text_range_?: readonly [number | null, number | null] | [number | null, number | null];
1049
1238
  dont_sync_search_field_value_except_on_submit_?: boolean;
@@ -1059,9 +1248,9 @@ export class DepictSearch<InputDisplay extends Display, OutputDisplay extends Mo
1059
1248
  enable_category_suggestions,
1060
1249
  display_transformers,
1061
1250
  api,
1251
+ searchModalComponent,
1062
1252
  disable_scrolling_during_modal,
1063
1253
  bottom_distance_under_modal,
1064
- render_instant_card,
1065
1254
  override_modal_element,
1066
1255
  ...props_on_class
1067
1256
  }: ConstructorOptions<InputDisplay, OutputDisplay>);
@@ -1099,13 +1288,14 @@ export function SearchPage<OriginalDisplay extends Display, TransformedDisplay e
1099
1288
  recommendations_cols_at_size?: SDKColsAtSize;
1100
1289
  };
1101
1290
  }): import("@depict-ai/utilishared").Node_Array;
1102
- interface SearchFieldParams {
1103
- depict_search: DepictSearch<any>;
1104
- modal_dispose_handler?: VoidFunction;
1105
- click_handler?: (this: HTMLDivElement, ev: MouseEvent) => any;
1106
- aligner_ref?: HTMLElement | null;
1107
- }
1108
- export function SearchField(props: SearchFieldParams): HTMLDivElement[];
1291
+ /**
1292
+ * Connects the height of the search field to the height of the aligner.
1293
+ * @param aligner
1294
+ * @returns
1295
+ */
1296
+ export function connect_search_field_height_to_aligner_height(aligner: HTMLElement): {
1297
+ cleanup: () => void;
1298
+ };
1109
1299
  type CenteredLocation = {
1110
1300
  location?: "centered";
1111
1301
  };
@@ -1169,4 +1359,14 @@ export class PageReplacer extends EventTarget {
1169
1359
  * 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)
1170
1360
  */
1171
1361
  export function setup_fast_leave(pr: PageReplacer): void;
1362
+ interface SearchFieldParams {
1363
+ depict_search: DepictSearch<any>;
1364
+ modal_dispose_handler?: VoidFunction;
1365
+ click_handler?: (this: HTMLDivElement, ev: MouseEvent) => any;
1366
+ aligner_ref?: HTMLElement | null;
1367
+ }
1368
+ /**
1369
+ * Returns a SearchField that will open a modal aligned to it when clicked.
1370
+ */
1371
+ export function SearchField(props: SearchFieldParams): HTMLDivElement[];
1172
1372
  export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";