@depict-ai/ui 2.1.23 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/latest/index.d.ts CHANGED
@@ -1,17 +1,159 @@
1
- import { JSX, Accessor, Signal, Setter } from "solid-js";
2
- import { report, Display, Amazing_Slider, ColsAtSize, Elem, ModernDisplay, Node_Array } from "@depict-ai/utilishared/latest";
3
- import { SearchFilter, SortModel, SearchRequestV2 } from "@depict-ai/types/api/SearchRequestV2";
1
+ import { JSX, Signal, Accessor, Setter } from "solid-js";
2
+ import { Amazing_Slider, Node_Array, Display, report, ColsAtSize, Elem, ModernDisplay } from "@depict-ai/utilishared/latest";
3
+ import { SearchFilter, SortModel, SearchRequestV3 } from "@depict-ai/types/api/SearchRequestV3";
4
4
  import { SearchFilter as _SearchFilter1, ContentLink, SearchResponse } from "@depict-ai/types/api/SearchResponse";
5
- import { BaseCategoryDisplay, ProductListingResponseV2 } from "@depict-ai/types/api/ProductListingResponseV2";
5
+ import { CategorySuggestion } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
6
+ import { Breadcrumb, Quicklink, GetListingResponse } from "@depict-ai/types/api/GetListingResponse";
6
7
  import { LegacyCategorySuggestion, SearchSuggestionsResponse } from "@depict-ai/types/api/SearchSuggestionsResponse";
7
- import { BaseSearchRequestV2 } from "@depict-ai/types/api/BaseSearchRequestV2";
8
- import { SearchSuggestionsRequestV2 } from "@depict-ai/types/api/SearchSuggestionsRequestV2";
9
- import { ProductListingRequestV2 } from "@depict-ai/types/api/ProductListingRequestV2";
10
- export const version = "2.1.23";
8
+ import { ProductListingResponseV3 } from "@depict-ai/types/api/ProductListingResponseV3";
9
+ import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
10
+ import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequestV3";
11
+ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
12
+ import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
13
+ import { SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/SearchRequestV2";
14
+ export const version = "3.0.0";
15
+ /** @jsxImportSource solid-js */
16
+ export function GenericSliderArrowButton(props?: {
17
+ width_?: number;
18
+ height_?: number;
19
+ }): SVGElement;
20
+ export function SlidableItems({
21
+ children,
22
+ slider_ref_,
23
+ faded_opacity_,
24
+ mutation_plugins_,
25
+ disable_fading_,
26
+ arrow_width_,
27
+ arrow_height_
28
+ }: {
29
+ children?: JSX.Element;
30
+ slider_ref_?: (slider: Amazing_Slider) => any;
31
+ faded_opacity_?: number;
32
+ disable_fading_?: boolean;
33
+ mutation_plugins_?: ((this: Amazing_Slider, mutations: IntersectionObserverEntry[], intersecting_items: Record<number, IntersectionObserverEntry>) => unknown)[];
34
+ arrow_width_?: number;
35
+ arrow_height_?: number;
36
+ }): HTMLDivElement;
11
37
  /**
12
- * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
38
+ * Renders a set of tabs
39
+ * Will ignore any children that's not a <Tab />
40
+ * Will cache children after the first visit, so they don't get re-created when closing and re-opening a tab
13
41
  */
14
- export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
42
+ export function Tabs(props: Parameters<typeof ActualTabs>[0]): JSX.Element;
43
+ declare function ActualTabs(props: {
44
+ children: JSX.Element;
45
+ wrapTabBar?: (navElement: JSX.Element) => JSX.Element;
46
+ slidable?: boolean;
47
+ /**
48
+ * Component to use for creating an anchor (<a> tag) for the tab bar
49
+ */
50
+ AnchorComponent: (props: JSX.AnchorHTMLAttributes<HTMLAnchorElement> & {
51
+ children: JSX.Element;
52
+ }) => JSX.Element;
53
+ }): JSX.Element;
54
+ /**
55
+ * Renders a tab
56
+ * 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.
57
+ */
58
+ export function Tab(props: {
59
+ label: JSX.Element;
60
+ children: JSX.Element;
61
+ onSelected?: VoidFunction;
62
+ id?: string;
63
+ }): undefined;
64
+ /**
65
+ * Basically allows you to use SearchModal
66
+ * 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.
67
+ * @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
68
+ * @param modal_fn_opts static options for the modal that won't change on a per-opening basis
69
+ * @param parent override the parent element to append the modal to. Defaults to <body>
70
+ @returns a function to open and close the modal. When calling the open_modal_ function additional parameters can be passed to the modal
71
+ */
72
+ export function general_modal_abstraction<StaticOptions extends {
73
+ [key: string]: any;
74
+ }, ExtraOptionsProvidedOnOpen extends {
75
+ [key: string]: any;
76
+ }>(search_modal: (options: StaticOptions & ExtraOptionsProvidedOnOpen & {
77
+ close_modal_: VoidFunction;
78
+ open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
79
+ register_closing_animation_: (animation: () => Promise<any>) => void;
80
+ }) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
81
+ open_modal_: (extra_options_for_modal?: any, on_dispose?: VoidFunction | undefined) => Promise<void | undefined>;
82
+ close_modal_: () => void | undefined;
83
+ }>;
84
+ export type OnNavigation = ((options: {
85
+ is_replace: boolean;
86
+ new_url: URL;
87
+ scroll: boolean;
88
+ }) => void) | "hard_navigation";
89
+ /**
90
+ * Not a router that does our custom routing on non-spas and otherwise plugs into other routers and generalises their functionality
91
+ */
92
+ declare class PseudoRouter {
93
+ #private;
94
+ /**
95
+ * Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
96
+ */
97
+ on_navigation_: OnNavigation;
98
+ /**
99
+ * We store listing_id in history.state and do operate on this both here and in js-ui, this is the key to be used which js-ui provides
100
+ */
101
+ listing_id_state_key: string | undefined;
102
+ navigate_: {
103
+ /**
104
+ * Call this if you *just* want to replace the state object in history.state
105
+ */
106
+ replace_state_: (new_state: {
107
+ [key: string]: any;
108
+ }) => void;
109
+ /**
110
+ * Call this to change the URL
111
+ * @param new_url_ new URL to go to
112
+ * @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
113
+ * @param force_spa_navigation_ if you want to force SPA navigation even if on_navigation_ is set to "hard_navigation". You should only set this to true for inter-SDK-page navigations
114
+ * @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
115
+ * @param listing_id_ If you are navigating to a category and know the listing_id of, please provide it. This is for making a better devEx in js-ui
116
+ */
117
+ go_to_: (args_0: {
118
+ new_url_: string | URL;
119
+ event_?: MouseEvent | undefined;
120
+ force_spa_navigation_?: boolean | undefined;
121
+ is_replace_: boolean;
122
+ listing_id_?: string | undefined;
123
+ scroll?: boolean | undefined;
124
+ }) => Promise<void | undefined>;
125
+ };
126
+ constructor(on_navigation: OnNavigation, listing_id_state_key?: string);
127
+ }
128
+ /**
129
+ * Makes signals out of values in history.state so that you can use history state as an intuitive storage of application state.
130
+ * @param params_to_default_value an object of keys with a serialisable default value.
131
+ * @param router_ router used to replace state
132
+ * @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.
133
+ */
134
+ export function history_dot_state_to_state<Param extends string, DefaultValue>(params_to_default_value: Record<Param, DefaultValue>, router_: PseudoRouter): Record<Param, Signal<any>>;
135
+ export type SDKGridSpacing = string | {
136
+ horizontal: string;
137
+ vertical: string;
138
+ };
139
+ export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
140
+ type FilterWithData = WithRequired<SearchFilter, "data">;
141
+ export interface SDKRenderingInfo {
142
+ /**
143
+ * If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
144
+ */
145
+ set_on_index_change: (fn: (index: number) => void) => void;
146
+ }
147
+ export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
148
+ type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
149
+ actual_field?: string;
150
+ })[] : never;
151
+ type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
152
+ /**
153
+ * Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
154
+ * @returns A cleanup function to manually re-enable scrolling.
155
+ */
156
+ export function disable_scrolling(): () => void;
15
157
  declare class SDKError extends Error {}
16
158
  export class ProductCardError extends SDKError {
17
159
  constructor(templateError: Error);
@@ -23,6 +165,7 @@ export function SentryErrorBoundary(props: {
23
165
  on_error_?: (retry: VoidFunction) => JSX.Element | void;
24
166
  class_list_?: string[];
25
167
  }): JSX.Element;
168
+ export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
26
169
  /**
27
170
  * Base placeholder component used by ImagePlaceholder and TextPlaceholder
28
171
  */
@@ -51,6 +194,115 @@ type ImagePlaceholderImageOptions = {
51
194
  * @property style extra styles to add to the placeholder
52
195
  */
53
196
  export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
197
+ export type SDKColsAtSize = [number, number?][];
198
+ /**
199
+ * Transform SDK ColsAtSize into valid Layout ColsAtSize
200
+ * @param cols_at_size [nbCol, maxWidth]
201
+ * @returns
202
+ */
203
+ export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
204
+ /**
205
+ * 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.
206
+ * If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
207
+ * @property height height of the placeholder. Set to `1em` by default.
208
+ * @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
209
+ * @property class extra classes to add to the placeholder
210
+ * @property style extra styles to add to the placeholder
211
+ */
212
+ export function TextPlaceholder(props: {
213
+ style?: JSX.CSSProperties;
214
+ height: string;
215
+ width: string;
216
+ class?: string;
217
+ }): JSX.Element;
218
+ export const CategoryTitle: ({
219
+ category_title_,
220
+ product_count_
221
+ }: {
222
+ category_title_: Accessor<string | undefined>;
223
+ product_count_: JSX.Element;
224
+ }) => JSX.Element;
225
+ export const defaultColsAtSize: SDKColsAtSize;
226
+ export const defaultGridSpacing = "2%";
227
+ export const defaultCategoryTitlePlugin: ({
228
+ category_title_,
229
+ product_count_
230
+ }: {
231
+ category_title_: import("solid-js").Accessor<string | undefined>;
232
+ product_count_: import("solid-js").JSX.Element;
233
+ }) => import("solid-js").JSX.Element;
234
+ export type SolidLayoutOptions = {
235
+ cols_at_size: ColsAtSize;
236
+ grid_spacing: string;
237
+ rows: {
238
+ start_rows?: number;
239
+ rows_per_click?: number;
240
+ currently_visible?: Signal<number>;
241
+ max_rows?: number;
242
+ button?: JSX.Element;
243
+ view_less_button?: JSX.Element;
244
+ } | "all";
245
+ layout: "slider" | "grid";
246
+ disable_partial_rows?: boolean;
247
+ override_vertical_spacing?: string;
248
+ children: JSX.Element;
249
+ element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
250
+ };
251
+ /**
252
+ * 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.
253
+ * @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
254
+ * @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`
255
+ * @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
256
+ * @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".
257
+ * @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
258
+ * @return An accessor containing a CSS string
259
+ */
260
+ export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
261
+ /**
262
+ * Provider to wrap every listing (group of products) in
263
+ * Used for example for deduplicating ResizeObservers for responsive images
264
+ */
265
+ export function ListingProvider(props: {
266
+ children: JSX.Element;
267
+ }): JSX.Element;
268
+ /**
269
+ * Use this to get the context object if your component is within a ListingProvider
270
+ */
271
+ export function useListing(): Record<symbol, any> | undefined;
272
+ /**
273
+ * Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
274
+ * If no merchant or market is specified, the product cards won't get any merchant and market in their second argument.
275
+ */
276
+ export function RecommendationGrid<T extends Display>(props: {
277
+ grid_spacing: SDKGridSpacing;
278
+ cols_at_size: SDKColsAtSize;
279
+ title?: JSX.Element;
280
+ recommendations: Promise<T[]>;
281
+ view_more_button?: {
282
+ text: string;
283
+ start_rows?: number;
284
+ rows_per_click?: number;
285
+ };
286
+ max_rows?: number;
287
+ product_card_template: ProductCardTemplate<T>;
288
+ }): HTMLDivElement;
289
+ type ShopTheLookOpenModalOptions<T extends Display> = {
290
+ onNavigation: OnNavigation;
291
+ productId: string;
292
+ merchant: string;
293
+ market: string;
294
+ locale: string;
295
+ imageAspectRatio: number;
296
+ productCardTemplate: ProductCardTemplate<T>;
297
+ };
298
+ type ShopTheLookButtonProps<T extends Display> = ShopTheLookOpenModalOptions<T> & {
299
+ buttonAttributes?: JSX.ButtonHTMLAttributes<HTMLButtonElement>;
300
+ };
301
+ export function ShopTheLookButton<T extends Display>(props: ShopTheLookButtonProps<T>): import("solid-js").JSX.Element;
302
+ /**
303
+ * Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
304
+ */
305
+ export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
54
306
  /**
55
307
  * The interface for a content block.
56
308
  * Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
@@ -79,37 +331,6 @@ export type ContentBlock = {
79
331
  * ```
80
332
  */
81
333
  export type ContentBlocksByRow = (undefined | ContentBlock)[];
82
- export type SDKGridSpacing = string | {
83
- horizontal: string;
84
- vertical: string;
85
- };
86
- export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
87
- type FilterWithData = WithRequired<SearchFilter, "data">;
88
- export interface SDKRenderingInfo {
89
- /**
90
- * If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
91
- */
92
- set_on_index_change: (fn: (index: number) => void) => void;
93
- merchant: string;
94
- market: string;
95
- }
96
- export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
97
- type WithoutMerchant<T> = T extends {
98
- merchant: string;
99
- } ? Omit<T, "merchant"> : T;
100
- type WithoutMarket<T> = T extends {
101
- market: string;
102
- } ? Omit<T, "market"> : T;
103
- export type ProductCardTemplateWithoutMerchantAndMarket<T extends Display> = (display: Parameters<ProductCardTemplate<T>>[0], info?: WithoutMerchant<WithoutMarket<SDKRenderingInfo>>) => ReturnType<ProductCardTemplate<T>>;
104
- /**
105
- * Will be sent to backend to indicate whether the query_id_ is for a collection or category.
106
- * Backend defaults to category if not specified.
107
- */
108
- export type ListingType = "collection" | "category";
109
- type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
110
- actual_field?: string;
111
- })[] : never;
112
- type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
113
334
  /**
114
335
  * Function that encodes a filter object into query parameters and sets them on the given URLSearchParams object.
115
336
  */
@@ -134,17 +355,6 @@ export function decode_sorting(search_params: URLSearchParams, sorting_query_par
134
355
  * @param sorting_query_param
135
356
  */
136
357
  export function strip_encoded_filter_and_sort(search_params: URLSearchParams, filter_query_param_prefix: string, sorting_query_param: string): void;
137
- /**
138
- * Provider to wrap every listing (group of products) in
139
- * Used for example for deduplicating ResizeObservers for responsive images
140
- */
141
- export function ListingProvider(props: {
142
- children: JSX.Element;
143
- }): JSX.Element;
144
- /**
145
- * Use this to get the context object if your component is within a ListingProvider
146
- */
147
- export function useListing(): Record<symbol, any> | undefined;
148
358
  /** @jsxImportSource solid-js */
149
359
  /**
150
360
  * ImageContainer for using the padding hack to set the aspect ratio of an image
@@ -191,112 +401,20 @@ export function ShopifyContainedImage(props: {
191
401
  class?: string;
192
402
  alt?: string;
193
403
  }): HTMLDivElement;
194
- /** @jsxImportSource solid-js */
195
- export function GenericSliderArrowButton(props?: {
196
- width_?: number;
197
- height_?: number;
198
- }): SVGElement;
199
- export function SlidableItems({
200
- children,
201
- slider_ref_,
202
- faded_opacity_,
203
- mutation_plugins_,
204
- disable_fading_,
205
- arrow_width_,
206
- arrow_height_
207
- }: {
208
- children?: JSX.Element;
209
- slider_ref_?: (slider: Amazing_Slider) => any;
210
- faded_opacity_?: number;
211
- disable_fading_?: boolean;
212
- mutation_plugins_?: ((this: Amazing_Slider, mutations: IntersectionObserverEntry[], intersecting_items: Record<number, IntersectionObserverEntry>) => unknown)[];
213
- arrow_width_?: number;
214
- arrow_height_?: number;
215
- }): HTMLDivElement;
216
404
  /**
217
405
  * Returns accessor with the size of the provided element, including padding and border (I think)
218
406
  */
219
407
  export function make_accurate_width_accessor(what_to_watch: HTMLElement): import("solid-js").Accessor<number | undefined>;
220
- export type SDKColsAtSize = [number, number?][];
221
- /**
222
- * Transform SDK ColsAtSize into valid Layout ColsAtSize
223
- * @param cols_at_size [nbCol, maxWidth]
224
- * @returns
225
- */
226
- export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
227
- export type SolidLayoutOptions = {
228
- cols_at_size: ColsAtSize;
229
- grid_spacing: string;
230
- rows: {
231
- start_rows?: number;
232
- rows_per_click?: number;
233
- currently_visible?: Signal<number>;
234
- max_rows?: number;
235
- button?: JSX.Element;
236
- view_less_button?: JSX.Element;
237
- } | "all";
238
- layout: "slider" | "grid";
239
- disable_partial_rows?: boolean;
240
- override_vertical_spacing?: string;
241
- children: JSX.Element;
242
- element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
243
- };
244
- /**
245
- * 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.
246
- * @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
247
- * @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`
248
- * @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
249
- * @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".
250
- * @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
251
- * @return An accessor containing a CSS string
252
- */
253
- export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
254
- type RecommendationSliderBaseProps<T extends Display> = {
255
- grid_spacing: SDKGridSpacing;
256
- cols_at_size: SDKColsAtSize;
257
- recommendations: Promise<T[]>;
258
- title?: JSX.Element;
259
- };
260
408
  /**
261
409
  * Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
262
- * If no merchant or market is specified, the product cards won't get any merchant and market in their second argument.
263
410
  */
264
411
  export function RecommendationSlider<T extends Display>(props: {
265
- product_card_template: ProductCardTemplate<T>;
266
- merchant: string;
267
- market: string;
268
- } & RecommendationSliderBaseProps<T>): HTMLDivElement;
269
- export function RecommendationSlider<T extends Display>(props: {
270
- product_card_template: ProductCardTemplateWithoutMerchantAndMarket<T>;
271
- merchant?: never;
272
- market?: never;
273
- } & RecommendationSliderBaseProps<T>): HTMLDivElement;
274
- type RecommendationGridBaseProps<T extends Display> = {
275
412
  grid_spacing: SDKGridSpacing;
276
413
  cols_at_size: SDKColsAtSize;
277
- title?: JSX.Element;
278
414
  recommendations: Promise<T[]>;
279
- view_more_button?: {
280
- text: string;
281
- start_rows?: number;
282
- rows_per_click?: number;
283
- };
284
- max_rows?: number;
285
- };
286
- /**
287
- * Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
288
- * If no merchant or market is specified, the product cards won't get any merchant and market in their second argument.
289
- */
290
- export function RecommendationGrid<T extends Display>(props: {
415
+ title?: JSX.Element;
291
416
  product_card_template: ProductCardTemplate<T>;
292
- merchant: string;
293
- market: string;
294
- } & RecommendationGridBaseProps<T>): HTMLDivElement;
295
- export function RecommendationGrid<T extends Display>(props: {
296
- product_card_template: ProductCardTemplateWithoutMerchantAndMarket<T>;
297
- merchant?: never;
298
- market?: never;
299
- } & RecommendationGridBaseProps<T>): HTMLDivElement;
417
+ }): HTMLDivElement;
300
418
  export function ExpandingDetails(props: {
301
419
  details_: HTMLDetailsElement;
302
420
  summary_: HTMLElement;
@@ -324,6 +442,7 @@ export function SolidFormatPrice(props: {
324
442
  * PLP internationalisation shared between search and category listing
325
443
  */
326
444
  type plp_shared_i18n = {
445
+ backend_locale_: string;
327
446
  scroll_to_top_: string;
328
447
  back_: string;
329
448
  open_sorting_: string;
@@ -414,7 +533,6 @@ export function show_toast({
414
533
  } & JSX.HTMLAttributes<HTMLDivElement>): {
415
534
  close_toast_: VoidFunction;
416
535
  };
417
- export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
418
536
  export function SelectedFilters({
419
537
  number_of_rendered_selected_filters_items_,
420
538
  i18n_,
@@ -436,20 +554,6 @@ export function SelectedFilters({
436
554
  selected_filters_: Signal<FilterWithData[]>;
437
555
  local_filter_cache_: Signal<SearchFilter[]>;
438
556
  }): HTMLDivElement;
439
- /**
440
- * 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.
441
- * If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
442
- * @property height height of the placeholder. Set to `1em` by default.
443
- * @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
444
- * @property class extra classes to add to the placeholder
445
- * @property style extra styles to add to the placeholder
446
- */
447
- export function TextPlaceholder(props: {
448
- style?: JSX.CSSProperties;
449
- height: string;
450
- width: string;
451
- class?: string;
452
- }): JSX.Element;
453
557
  interface FilterBodyProps {
454
558
  available_filters_: Accessor<_SearchFilter1[] | undefined>;
455
559
  expanded_filters_: Signal<{
@@ -500,7 +604,7 @@ export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDispla
500
604
  displays: InputDisplay[];
501
605
  }) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
502
606
  categories?: (options: DisplayTransformerAlwaysThereData & {
503
- data: (BaseCategoryDisplay | LegacyCategorySuggestion)[];
607
+ data: (Breadcrumb | Quicklink | CategorySuggestion)[];
504
608
  }) => CanBePromiseWrapped<{
505
609
  page_url: string;
506
610
  }[]>;
@@ -530,7 +634,7 @@ type PageURLCreatorAlwaysThereData = {
530
634
  };
531
635
  type PageURLCreatorCategoryData = {
532
636
  type: "categories";
533
- data: (BaseCategoryDisplay | LegacyCategorySuggestion)[];
637
+ data: (Breadcrumb | Quicklink | CategorySuggestion)[];
534
638
  };
535
639
  type PageURLCreatorProductData<T extends ModernDisplay> = {
536
640
  displays: T[];
@@ -549,31 +653,6 @@ export type PageURLCreator<InputDisplay extends ModernDisplay, OutputDisplay ext
549
653
  }[]> : CanBePromiseWrapped<{
550
654
  page_url: string;
551
655
  }[]> | CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
552
- /**
553
- * Basically allows you to use SearchModal
554
- * 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.
555
- * @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
556
- * @param modal_fn_opts static options for the modal that won't change on a per-opening basis
557
- * @param parent override the parent element to append the modal to. Defaults to <body>
558
- @returns a function to open and close the modal. When calling the open_modal_ function additional parameters can be passed to the modal
559
- */
560
- export function general_modal_abstraction<StaticOptions extends {
561
- [key: string]: any;
562
- }, ExtraOptionsProvidedOnOpen extends {
563
- [key: string]: any;
564
- }>(search_modal: (options: StaticOptions & ExtraOptionsProvidedOnOpen & {
565
- close_modal_: VoidFunction;
566
- open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
567
- register_closing_animation_: (animation: () => Promise<any>) => void;
568
- }) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
569
- open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
570
- close_modal_: () => void;
571
- }>;
572
- export type OnNavigation = ((options: {
573
- is_replace: boolean;
574
- new_url: URL;
575
- scroll: boolean;
576
- }) => void) | "hard_navigation";
577
656
  export type ExclusiveId = {
578
657
  categoryId: string;
579
658
  productId?: undefined;
@@ -595,7 +674,7 @@ type RecsAPIWrapperOptions = {
595
674
  type: string;
596
675
  merchant: string;
597
676
  market: string;
598
- userId?: string;
677
+ locale: string;
599
678
  sessionId?: string;
600
679
  headers?: HeadersInit;
601
680
  metadata?: Record<string, any>;
@@ -606,12 +685,12 @@ type RecsAPIWrapperOptions = {
606
685
  *
607
686
  * @param merchant The name of the merchant (e.g. "acme")
608
687
  * @param market The market to fetch recs for. Depict will provide this to you. (Example: "sv" or "sv-se".)
688
+ * @param locale The locale to fetch for.
609
689
  * @param type The type of the recommendations, e.g. `front_page`, `after_basket, `related`, etc. Ask Depict for this.
610
690
  * @param categoryId When requesting recommendations for a category page, pass the id of the category page as `categoryId`.
611
691
  * @param productId When requesting recommendations for a single product, e.g. on a product detail page, pass the id of the product as `productId`.
612
692
  * @param productIds When requesting recommendations that should take multiple products into account, i.e. the contents of the basket/cart, pass an array of product ids as `productIds`
613
- * @param userId Optional unique identifier of a logged-in user. Should be persistent across devices and sessions.
614
- * @param sessionId Optional unique identifer of the current session. Only necessary when performing server side requests to Depict.
693
+ * @param sessionId Optional unique identifier of the current session. Only necessary when performing server side requests to Depict.
615
694
  * @param metadata Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
616
695
  * @param headers Optional headers to send to the Depict API. This could be authentication for example. 99% of integrations can leave this unset.
617
696
  * When no id is provided (none out of `categoryId`, `productId` and `productIds`) general recommendations will be fetched. This is for, for example, the frontpage where generally popular products get returned.
@@ -637,12 +716,7 @@ type RecsAPIWrapperOptions = {
637
716
  * ```
638
717
  * @return This function is guaranteed to return an array of Displays. If anything fails, you will get an empty array.
639
718
  */
640
- export function fetchDepictRecommendations<T extends Display = Display>({
641
- merchant,
642
- market,
643
- headers,
644
- ...fetch_recs_options
645
- }: RecsAPIWrapperOptions): Promise<T[]>;
719
+ export function fetchDepictRecommendations<T extends ModernDisplay = ModernDisplay>(options: RecsAPIWrapperOptions): Promise<T[]>;
646
720
  export type InstantCard<T extends Display> = (display: T, context: {
647
721
  index: number;
648
722
  i18n: search_i18n;
@@ -658,21 +732,25 @@ type AddPageUrlToDisplay<T extends any[]> = (T[number] & {
658
732
  page_url: string;
659
733
  })[];
660
734
  type SearchResponseAfterURLCreator = { [K in keyof SearchResponse]: K extends "displays" ? AddPageUrlToDisplay<SearchResponse[K]> : K extends "filters" ? AddActualFieldToFilters<SearchResponse[K]> : SearchResponse[K] };
661
- type BaseCategoryDisplayAfterURLCreator = BaseCategoryDisplay & {
735
+ type QuicklinksOrBreadCrumbsWithPageURL<T extends Breadcrumb | Quicklink> = T & {
662
736
  page_url: string;
663
737
  };
664
- type ReplaceBaseCategoryDisplay<T> = T extends BaseCategoryDisplay ? BaseCategoryDisplayAfterURLCreator : T extends BaseCategoryDisplay[] ? BaseCategoryDisplayAfterURLCreator[] : T;
665
738
  type _AddPageUrlToDisplay1<T extends any[]> = (T[number] & {
666
739
  page_url: string;
667
740
  })[];
668
- type ProductListingResponseAfterURLCreator = { [K in keyof ProductListingResponseV2]: K extends "displays" ? _AddPageUrlToDisplay1<ProductListingResponseV2[K]> : K extends "breadcrumb" | "quick_links" ? ReplaceBaseCategoryDisplay<ProductListingResponseV2[K]> : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV2[K]> : ProductListingResponseV2[K] };
741
+ type ProductListingResponseAfterURLCreator = { [K in keyof ProductListingResponseV3]: K extends "displays" ? _AddPageUrlToDisplay1<ProductListingResponseV3[K]> : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV3[K]> : ProductListingResponseV3[K] };
742
+ type GetListingResponseAfterURLCreator = { [K in keyof GetListingResponse]: K extends "breadcrumbs" ? QuicklinksOrBreadCrumbsWithPageURL<Breadcrumb>[] : K extends "quick_links" ? QuicklinksOrBreadCrumbsWithPageURL<Quicklink>[] : GetListingResponse[K] };
669
743
  type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
670
744
  get_metadata?: () => Promise<{
671
745
  [k: string]: string;
672
746
  } | undefined>;
673
- get_user_id?: () => string | undefined;
674
747
  get_session_id?: () => string | undefined;
675
748
  } & SomethingTakingAPageURLCreatorOrDisplayTransformers<InputDisplay, OutputDisplay>;
749
+ interface GetListingOptions extends GetListingRequest {
750
+ listing_id: string;
751
+ session_id?: string;
752
+ market: string;
753
+ }
676
754
  /**
677
755
  * Class that handles all communication done in PLP code with the Depict API. (Notably not for recommendations currently).
678
756
  * It handles caching, retries and errors and is the only place that should be making requests to the Depict API.
@@ -682,33 +760,26 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
682
760
  page_url_creator: PageURLCreator<ModernDisplay, OutputDisplay> | undefined;
683
761
  display_transformers: DisplayTransformers<ModernDisplay, OutputDisplay> | undefined;
684
762
  constructor(options: DepictAPIConstructorOptions<InputDisplay, OutputDisplay>);
685
- suggest(input_req: SearchSuggestionsRequestV2): Promise<SearchSuggestionsResponseAfterURLCreator & {
763
+ suggest(input_req: SearchSuggestionsRequestV3): Promise<SearchSuggestionsResponseAfterURLCreator & {
764
+ failed?: true;
765
+ }>;
766
+ query(input_req: SearchRequestV3): Promise<SearchResponseAfterURLCreator & {
686
767
  failed?: true;
687
768
  }>;
688
- query(input_req: SearchRequestV2): Promise<SearchResponseAfterURLCreator & {
769
+ get_listing(input_req: GetListingOptions): Promise<GetListingResponseAfterURLCreator & {
689
770
  failed?: true;
690
771
  }>;
691
- list(input_req: ProductListingRequestV2): Promise<ProductListingResponseAfterURLCreator & {
772
+ get_listing_products(input_req: ProductListingRequestV3 & {
773
+ listing_id: string;
774
+ }): Promise<ProductListingResponseAfterURLCreator & {
692
775
  failed?: true;
693
776
  }>;
694
- get_recommended<T extends Display>(input_req: BaseSearchRequestV2): Promise<{
777
+ get_recommended<T extends Display>(input_req: BaseSearchRequestV3): Promise<{
695
778
  displays: T[];
696
779
  } & {
697
780
  failed?: true | undefined;
698
781
  }>;
699
782
  }
700
- /**
701
- * Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
702
- * @returns A cleanup function to manually re-enable scrolling.
703
- */
704
- export function disable_scrolling(): () => void;
705
- export const CategoryTitle: ({
706
- category_title_,
707
- product_count_
708
- }: {
709
- category_title_: Accessor<string | undefined>;
710
- product_count_: JSX.Element;
711
- }) => JSX.Element;
712
783
  /**
713
784
  * 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.
714
785
  * 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
@@ -742,7 +813,7 @@ type GeneralCategoryListingOptions = {
742
813
  localization: category_i18n;
743
814
  unique_instance_key_for_state?: string;
744
815
  on_navigation?: OnNavigation;
745
- query_id_state_key?: string;
816
+ listing_id_state_key?: string;
746
817
  };
747
818
  type CategoryConstructorOptionsWithApi<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = GeneralCategoryListingOptions & {
748
819
  api: DepictAPI<InputDisplay, OutputDisplay>;
@@ -758,18 +829,16 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
758
829
  #private;
759
830
  get localization(): category_i18n;
760
831
  set localization(locale_obj: category_i18n);
761
- get category_id(): string;
762
- set category_id(id: string);
832
+ get listing_id(): string;
833
+ set listing_id(id: string);
763
834
  get merchant(): string;
764
835
  set merchant(merchant: string);
765
836
  get market(): string;
766
837
  set market(market: string);
767
- get listing_type(): ListingType | undefined;
768
- set listing_type(listing_type: ListingType | undefined);
769
838
  get meta_title_suffix(): string | undefined;
770
839
  set meta_title_suffix(new_suffix: string | undefined);
771
- get disable_override_query_id(): boolean | undefined;
772
- set disable_override_query_id(new_value: boolean | undefined);
840
+ get disable_override_listing_id(): boolean | undefined;
841
+ set disable_override_listing_id(new_value: boolean | undefined);
773
842
  get on_navigation(): OnNavigation;
774
843
  set on_navigation(new_function: OnNavigation);
775
844
  constructor({
@@ -778,7 +847,7 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
778
847
  page_url_creator,
779
848
  display_transformers,
780
849
  unique_instance_key_for_state,
781
- query_id_state_key,
850
+ listing_id_state_key,
782
851
  ...props_on_class
783
852
  }: DepictCategoryConstructorOptions<InputDisplay, OutputDisplay>);
784
853
  }
@@ -795,26 +864,23 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
795
864
  show_quicklinks?: boolean;
796
865
  show_breadcrumbs?: boolean;
797
866
  category_title: typeof CategoryTitle | typeof embedded_num_products;
798
- on_query_id_change?: (new_query_id?: string | undefined, old_query_id?: string | undefined) => void;
867
+ on_listing_id_change?: (new_listing_id?: string | undefined, old_listing_id?: string | undefined) => void;
799
868
  content_blocks_by_row?: ContentBlocksByRow;
800
869
  }): import("@depict-ai/utilishared").Node_Array;
801
870
  export function BreadCrumbs<T extends Display>({
802
871
  depict_category
803
872
  }: {
804
873
  depict_category: DepictCategory<T>;
805
- }): HTMLElement;
874
+ }): JSX.Element;
806
875
  export function QuickLinks<T extends Display>({
807
876
  depict_category
808
877
  }: {
809
878
  depict_category: DepictCategory<T>;
810
- }): HTMLElement;
879
+ }): JSX.Element;
811
880
  /**
812
- * Gets available categories/collections (query_ids for the product-listing endpoint) for a merchant
813
- * @param tenant
814
- * @param market
815
- * @param type - optional, currently only setting this to "collection" will return collections instead of categories
881
+ * Gets available listings for a given merchant, market and locale
816
882
  */
817
- export function get_categories(tenant: string, market: string, type?: string): Promise<string[]>;
883
+ export function get_listings(merchant: string, market: string, locale: string): Promise<import("@depict-ai/types/api/ListingResponseItem").ListingResponseItem1[]>;
818
884
  export function DefaultInstantCardPlaceholder(): HTMLDivElement;
819
885
  /**
820
886
  * Useful for aligning the search modal to an element, like an existing input field
@@ -902,7 +968,7 @@ export class DepictSearch<InputDisplay extends Display, OutputDisplay extends Mo
902
968
  set merchant(tenant: string);
903
969
  get market(): string;
904
970
  set market(market: string);
905
- fetchSearchResults(query: string, filters?: SearchFilter[], maxResults?: number): Promise<([OutputDisplay] extends [never] ? InputDisplay : ModernDisplayWithPageUrl<OutputDisplay>)[]>;
971
+ fetchSearchResults(query: string, filters?: _SearchFilter2[], maxResults?: number): Promise<([OutputDisplay] extends [never] ? InputDisplay : ModernDisplayWithPageUrl<OutputDisplay>)[]>;
906
972
  }
907
973
  /**
908
974
  * This is the SearchPage component visible outside - exported from @depict-ai/ui.
@@ -943,11 +1009,7 @@ export type BaseProviderConfig<InputDisplay extends Display, PossibleTransformed
943
1009
  */
944
1010
  market: string;
945
1011
  /**
946
- * Optional unique identifier of a logged in user. Should be persistent across devices and sessions.
947
- */
948
- userId?: string;
949
- /**
950
- * Optional unique identifer of the current session. Only necessary when performing server side requests to Depict.
1012
+ * Optional unique identifer of the user. Only necessary when performing server side requests to Depict. All Depict tooling has a fallback ID that will be used when this isn't specified, but if you make requests to Depict directly, you need to specify this everywhere.
951
1013
  */
952
1014
  sessionId?: string;
953
1015
  /**
@@ -1040,10 +1102,10 @@ export type BaseCategoryProviderConfig = {
1040
1102
  */
1041
1103
  metaTitleSuffix?: string;
1042
1104
  /**
1043
- * The parameter `query_id=` will override the regular category id that you have configured your SDK to use. You can consider the `query_id` as an escape-hatch if you want to easily set a category id.
1044
- * However, if your page already sets a query_id, you can disable this behaviour by setting this property to `true` (to avoid a conflict).
1105
+ * The parameter `listing_id=` will override the regular category id that you have configured your SDK to use. You can consider the `listing_id` as an escape-hatch if you want to easily set a listing id.
1106
+ * However, if your page already sets a listing_id, you can disable this behaviour by setting this property to `true` (to avoid a conflict).
1045
1107
  */
1046
- disableOverrideQueryId?: boolean;
1108
+ disableOverrideListingId?: boolean;
1047
1109
  };
1048
1110
  export interface BaseProductListingConfig {
1049
1111
  /**
@@ -1145,13 +1207,4 @@ export class PageReplacer extends EventTarget {
1145
1207
  * 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)
1146
1208
  */
1147
1209
  export function setup_fast_leave(pr: PageReplacer): void;
1148
- export const defaultColsAtSize: SDKColsAtSize;
1149
- export const defaultGridSpacing = "2%";
1150
- export const defaultCategoryTitlePlugin: ({
1151
- category_title_,
1152
- product_count_
1153
- }: {
1154
- category_title_: import("solid-js").Accessor<string | undefined>;
1155
- product_count_: import("solid-js").JSX.Element;
1156
- }) => import("solid-js").JSX.Element;
1157
- export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV2";
1210
+ export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";