@depict-ai/ui 2.1.22 → 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/ES10/index.cjs +2429 -1801
- package/ES10/index.d.ts +307 -252
- package/ES10/index.js +2566 -1942
- package/latest/index.cjs +1998 -1378
- package/latest/index.d.ts +307 -252
- package/latest/index.js +2417 -1801
- package/locales/ES10/index.cjs +198 -62
- package/locales/ES10/index.d.ts +25 -4
- package/locales/ES10/index.js +179 -63
- package/locales/latest/index.cjs +214 -78
- package/locales/latest/index.d.ts +25 -4
- package/locales/latest/index.js +195 -79
- package/package.json +7 -7
- package/server/ES10/index.cjs +2177 -1674
- package/server/ES10/index.d.ts +307 -252
- package/server/ES10/index.js +1908 -1409
- package/server/latest/index.cjs +2008 -1509
- package/server/latest/index.d.ts +307 -252
- package/server/latest/index.js +2099 -1604
package/server/ES10/index.d.ts
CHANGED
|
@@ -1,17 +1,159 @@
|
|
|
1
|
-
import { JSX,
|
|
2
|
-
import {
|
|
3
|
-
import { SearchFilter, SortModel,
|
|
1
|
+
import { JSX, Signal, Accessor, Setter } from "solid-js";
|
|
2
|
+
import { Amazing_Slider, Node_Array, Display, report, ColsAtSize, Elem, ModernDisplay } from "@depict-ai/utilishared/ES10";
|
|
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 {
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
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
|
-
*
|
|
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
|
|
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
|
|
@@ -183,118 +393,28 @@ export const shopifyContainedImageContextSymbol: unique symbol;
|
|
|
183
393
|
* @property src image source
|
|
184
394
|
* @property aspectRatio aspect ratio of the image
|
|
185
395
|
* @property class extra class to add to the container
|
|
396
|
+
* @property alt alt text for the image
|
|
186
397
|
*/
|
|
187
398
|
export function ShopifyContainedImage(props: {
|
|
188
399
|
src: string;
|
|
189
400
|
aspectRatio: number;
|
|
190
401
|
class?: string;
|
|
191
|
-
|
|
192
|
-
/** @jsxImportSource solid-js */
|
|
193
|
-
export function GenericSliderArrowButton(props?: {
|
|
194
|
-
width_?: number;
|
|
195
|
-
height_?: number;
|
|
196
|
-
}): SVGElement;
|
|
197
|
-
export function SlidableItems({
|
|
198
|
-
children,
|
|
199
|
-
slider_ref_,
|
|
200
|
-
faded_opacity_,
|
|
201
|
-
mutation_plugins_,
|
|
202
|
-
disable_fading_,
|
|
203
|
-
arrow_width_,
|
|
204
|
-
arrow_height_
|
|
205
|
-
}: {
|
|
206
|
-
children?: JSX.Element;
|
|
207
|
-
slider_ref_?: (slider: Amazing_Slider) => any;
|
|
208
|
-
faded_opacity_?: number;
|
|
209
|
-
disable_fading_?: boolean;
|
|
210
|
-
mutation_plugins_?: ((this: Amazing_Slider, mutations: IntersectionObserverEntry[], intersecting_items: Record<number, IntersectionObserverEntry>) => unknown)[];
|
|
211
|
-
arrow_width_?: number;
|
|
212
|
-
arrow_height_?: number;
|
|
402
|
+
alt?: string;
|
|
213
403
|
}): HTMLDivElement;
|
|
214
404
|
/**
|
|
215
405
|
* Returns accessor with the size of the provided element, including padding and border (I think)
|
|
216
406
|
*/
|
|
217
407
|
export function make_accurate_width_accessor(what_to_watch: HTMLElement): import("solid-js").Accessor<number | undefined>;
|
|
218
|
-
export type SDKColsAtSize = [number, number?][];
|
|
219
|
-
/**
|
|
220
|
-
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
221
|
-
* @param cols_at_size [nbCol, maxWidth]
|
|
222
|
-
* @returns
|
|
223
|
-
*/
|
|
224
|
-
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
225
|
-
export type SolidLayoutOptions = {
|
|
226
|
-
cols_at_size: ColsAtSize;
|
|
227
|
-
grid_spacing: string;
|
|
228
|
-
rows: {
|
|
229
|
-
start_rows?: number;
|
|
230
|
-
rows_per_click?: number;
|
|
231
|
-
currently_visible?: Signal<number>;
|
|
232
|
-
max_rows?: number;
|
|
233
|
-
button?: JSX.Element;
|
|
234
|
-
view_less_button?: JSX.Element;
|
|
235
|
-
} | "all";
|
|
236
|
-
layout: "slider" | "grid";
|
|
237
|
-
disable_partial_rows?: boolean;
|
|
238
|
-
override_vertical_spacing?: string;
|
|
239
|
-
children: JSX.Element;
|
|
240
|
-
element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
|
|
241
|
-
};
|
|
242
|
-
/**
|
|
243
|
-
* 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.
|
|
244
|
-
* @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
|
|
245
|
-
* @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`
|
|
246
|
-
* @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
|
|
247
|
-
* @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".
|
|
248
|
-
* @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
|
|
249
|
-
* @return An accessor containing a CSS string
|
|
250
|
-
*/
|
|
251
|
-
export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
|
|
252
|
-
type RecommendationSliderBaseProps<T extends Display> = {
|
|
253
|
-
grid_spacing: SDKGridSpacing;
|
|
254
|
-
cols_at_size: SDKColsAtSize;
|
|
255
|
-
recommendations: Promise<T[]>;
|
|
256
|
-
title?: JSX.Element;
|
|
257
|
-
};
|
|
258
408
|
/**
|
|
259
409
|
* Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
|
|
260
|
-
* If no merchant or market is specified, the product cards won't get any merchant and market in their second argument.
|
|
261
410
|
*/
|
|
262
411
|
export function RecommendationSlider<T extends Display>(props: {
|
|
263
|
-
product_card_template: ProductCardTemplate<T>;
|
|
264
|
-
merchant: string;
|
|
265
|
-
market: string;
|
|
266
|
-
} & RecommendationSliderBaseProps<T>): HTMLDivElement;
|
|
267
|
-
export function RecommendationSlider<T extends Display>(props: {
|
|
268
|
-
product_card_template: ProductCardTemplateWithoutMerchantAndMarket<T>;
|
|
269
|
-
merchant?: never;
|
|
270
|
-
market?: never;
|
|
271
|
-
} & RecommendationSliderBaseProps<T>): HTMLDivElement;
|
|
272
|
-
type RecommendationGridBaseProps<T extends Display> = {
|
|
273
412
|
grid_spacing: SDKGridSpacing;
|
|
274
413
|
cols_at_size: SDKColsAtSize;
|
|
275
|
-
title?: JSX.Element;
|
|
276
414
|
recommendations: Promise<T[]>;
|
|
277
|
-
|
|
278
|
-
text: string;
|
|
279
|
-
start_rows?: number;
|
|
280
|
-
rows_per_click?: number;
|
|
281
|
-
};
|
|
282
|
-
max_rows?: number;
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
* Render a grid with provided recommendations. displayTransformers will not be applied for this since you yourself provide the displays. Options are reactive.
|
|
286
|
-
* If no merchant or market is specified, the product cards won't get any merchant and market in their second argument.
|
|
287
|
-
*/
|
|
288
|
-
export function RecommendationGrid<T extends Display>(props: {
|
|
415
|
+
title?: JSX.Element;
|
|
289
416
|
product_card_template: ProductCardTemplate<T>;
|
|
290
|
-
|
|
291
|
-
market: string;
|
|
292
|
-
} & RecommendationGridBaseProps<T>): HTMLDivElement;
|
|
293
|
-
export function RecommendationGrid<T extends Display>(props: {
|
|
294
|
-
product_card_template: ProductCardTemplateWithoutMerchantAndMarket<T>;
|
|
295
|
-
merchant?: never;
|
|
296
|
-
market?: never;
|
|
297
|
-
} & RecommendationGridBaseProps<T>): HTMLDivElement;
|
|
417
|
+
}): HTMLDivElement;
|
|
298
418
|
export function ExpandingDetails(props: {
|
|
299
419
|
details_: HTMLDetailsElement;
|
|
300
420
|
summary_: HTMLElement;
|
|
@@ -322,6 +442,7 @@ export function SolidFormatPrice(props: {
|
|
|
322
442
|
* PLP internationalisation shared between search and category listing
|
|
323
443
|
*/
|
|
324
444
|
type plp_shared_i18n = {
|
|
445
|
+
backend_locale_: string;
|
|
325
446
|
scroll_to_top_: string;
|
|
326
447
|
back_: string;
|
|
327
448
|
open_sorting_: string;
|
|
@@ -412,7 +533,6 @@ export function show_toast({
|
|
|
412
533
|
} & JSX.HTMLAttributes<HTMLDivElement>): {
|
|
413
534
|
close_toast_: VoidFunction;
|
|
414
535
|
};
|
|
415
|
-
export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
|
|
416
536
|
export function SelectedFilters({
|
|
417
537
|
number_of_rendered_selected_filters_items_,
|
|
418
538
|
i18n_,
|
|
@@ -434,20 +554,6 @@ export function SelectedFilters({
|
|
|
434
554
|
selected_filters_: Signal<FilterWithData[]>;
|
|
435
555
|
local_filter_cache_: Signal<SearchFilter[]>;
|
|
436
556
|
}): HTMLDivElement;
|
|
437
|
-
/**
|
|
438
|
-
* 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.
|
|
439
|
-
* If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
|
|
440
|
-
* @property height height of the placeholder. Set to `1em` by default.
|
|
441
|
-
* @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
|
|
442
|
-
* @property class extra classes to add to the placeholder
|
|
443
|
-
* @property style extra styles to add to the placeholder
|
|
444
|
-
*/
|
|
445
|
-
export function TextPlaceholder(props: {
|
|
446
|
-
style?: JSX.CSSProperties;
|
|
447
|
-
height: string;
|
|
448
|
-
width: string;
|
|
449
|
-
class?: string;
|
|
450
|
-
}): JSX.Element;
|
|
451
557
|
interface FilterBodyProps {
|
|
452
558
|
available_filters_: Accessor<_SearchFilter1[] | undefined>;
|
|
453
559
|
expanded_filters_: Signal<{
|
|
@@ -498,7 +604,7 @@ export type DisplayTransformers<InputDisplay extends ModernDisplay, OutputDispla
|
|
|
498
604
|
displays: InputDisplay[];
|
|
499
605
|
}) => CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
|
|
500
606
|
categories?: (options: DisplayTransformerAlwaysThereData & {
|
|
501
|
-
data: (
|
|
607
|
+
data: (Breadcrumb | Quicklink | CategorySuggestion)[];
|
|
502
608
|
}) => CanBePromiseWrapped<{
|
|
503
609
|
page_url: string;
|
|
504
610
|
}[]>;
|
|
@@ -528,7 +634,7 @@ type PageURLCreatorAlwaysThereData = {
|
|
|
528
634
|
};
|
|
529
635
|
type PageURLCreatorCategoryData = {
|
|
530
636
|
type: "categories";
|
|
531
|
-
data: (
|
|
637
|
+
data: (Breadcrumb | Quicklink | CategorySuggestion)[];
|
|
532
638
|
};
|
|
533
639
|
type PageURLCreatorProductData<T extends ModernDisplay> = {
|
|
534
640
|
displays: T[];
|
|
@@ -547,31 +653,6 @@ export type PageURLCreator<InputDisplay extends ModernDisplay, OutputDisplay ext
|
|
|
547
653
|
}[]> : CanBePromiseWrapped<{
|
|
548
654
|
page_url: string;
|
|
549
655
|
}[]> | CanBePromiseWrapped<OutputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<OutputDisplay>[] : never>;
|
|
550
|
-
/**
|
|
551
|
-
* Basically allows you to use SearchModal
|
|
552
|
-
* 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.
|
|
553
|
-
* @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
|
|
554
|
-
* @param modal_fn_opts static options for the modal that won't change on a per-opening basis
|
|
555
|
-
* @param parent override the parent element to append the modal to. Defaults to <body>
|
|
556
|
-
@returns a function to open and close the modal. When calling the open_modal_ function additional parameters can be passed to the modal
|
|
557
|
-
*/
|
|
558
|
-
export function general_modal_abstraction<StaticOptions extends {
|
|
559
|
-
[key: string]: any;
|
|
560
|
-
}, ExtraOptionsProvidedOnOpen extends {
|
|
561
|
-
[key: string]: any;
|
|
562
|
-
}>(search_modal: (options: StaticOptions & ExtraOptionsProvidedOnOpen & {
|
|
563
|
-
close_modal_: VoidFunction;
|
|
564
|
-
open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
|
|
565
|
-
register_closing_animation_: (animation: () => Promise<any>) => void;
|
|
566
|
-
}) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
|
|
567
|
-
open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
|
|
568
|
-
close_modal_: () => void;
|
|
569
|
-
}>;
|
|
570
|
-
export type OnNavigation = ((options: {
|
|
571
|
-
is_replace: boolean;
|
|
572
|
-
new_url: URL;
|
|
573
|
-
scroll: boolean;
|
|
574
|
-
}) => void) | "hard_navigation";
|
|
575
656
|
export type ExclusiveId = {
|
|
576
657
|
categoryId: string;
|
|
577
658
|
productId?: undefined;
|
|
@@ -593,7 +674,7 @@ type RecsAPIWrapperOptions = {
|
|
|
593
674
|
type: string;
|
|
594
675
|
merchant: string;
|
|
595
676
|
market: string;
|
|
596
|
-
|
|
677
|
+
locale: string;
|
|
597
678
|
sessionId?: string;
|
|
598
679
|
headers?: HeadersInit;
|
|
599
680
|
metadata?: Record<string, any>;
|
|
@@ -604,12 +685,12 @@ type RecsAPIWrapperOptions = {
|
|
|
604
685
|
*
|
|
605
686
|
* @param merchant The name of the merchant (e.g. "acme")
|
|
606
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.
|
|
607
689
|
* @param type The type of the recommendations, e.g. `front_page`, `after_basket, `related`, etc. Ask Depict for this.
|
|
608
690
|
* @param categoryId When requesting recommendations for a category page, pass the id of the category page as `categoryId`.
|
|
609
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`.
|
|
610
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`
|
|
611
|
-
* @param
|
|
612
|
-
* @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.
|
|
613
694
|
* @param metadata Custom metadata to be sent with each request to the Depict API. Only necessary if specifically instructed by Depict.
|
|
614
695
|
* @param headers Optional headers to send to the Depict API. This could be authentication for example. 99% of integrations can leave this unset.
|
|
615
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.
|
|
@@ -635,12 +716,7 @@ type RecsAPIWrapperOptions = {
|
|
|
635
716
|
* ```
|
|
636
717
|
* @return This function is guaranteed to return an array of Displays. If anything fails, you will get an empty array.
|
|
637
718
|
*/
|
|
638
|
-
export function fetchDepictRecommendations<T extends
|
|
639
|
-
merchant,
|
|
640
|
-
market,
|
|
641
|
-
headers,
|
|
642
|
-
...fetch_recs_options
|
|
643
|
-
}: RecsAPIWrapperOptions): Promise<T[]>;
|
|
719
|
+
export function fetchDepictRecommendations<T extends ModernDisplay = ModernDisplay>(options: RecsAPIWrapperOptions): Promise<T[]>;
|
|
644
720
|
export type InstantCard<T extends Display> = (display: T, context: {
|
|
645
721
|
index: number;
|
|
646
722
|
i18n: search_i18n;
|
|
@@ -656,21 +732,25 @@ type AddPageUrlToDisplay<T extends any[]> = (T[number] & {
|
|
|
656
732
|
page_url: string;
|
|
657
733
|
})[];
|
|
658
734
|
type SearchResponseAfterURLCreator = { [K in keyof SearchResponse]: K extends "displays" ? AddPageUrlToDisplay<SearchResponse[K]> : K extends "filters" ? AddActualFieldToFilters<SearchResponse[K]> : SearchResponse[K] };
|
|
659
|
-
type
|
|
735
|
+
type QuicklinksOrBreadCrumbsWithPageURL<T extends Breadcrumb | Quicklink> = T & {
|
|
660
736
|
page_url: string;
|
|
661
737
|
};
|
|
662
|
-
type ReplaceBaseCategoryDisplay<T> = T extends BaseCategoryDisplay ? BaseCategoryDisplayAfterURLCreator : T extends BaseCategoryDisplay[] ? BaseCategoryDisplayAfterURLCreator[] : T;
|
|
663
738
|
type _AddPageUrlToDisplay1<T extends any[]> = (T[number] & {
|
|
664
739
|
page_url: string;
|
|
665
740
|
})[];
|
|
666
|
-
type ProductListingResponseAfterURLCreator = { [K in keyof
|
|
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] };
|
|
667
743
|
type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
|
|
668
744
|
get_metadata?: () => Promise<{
|
|
669
745
|
[k: string]: string;
|
|
670
746
|
} | undefined>;
|
|
671
|
-
get_user_id?: () => string | undefined;
|
|
672
747
|
get_session_id?: () => string | undefined;
|
|
673
748
|
} & SomethingTakingAPageURLCreatorOrDisplayTransformers<InputDisplay, OutputDisplay>;
|
|
749
|
+
interface GetListingOptions extends GetListingRequest {
|
|
750
|
+
listing_id: string;
|
|
751
|
+
session_id?: string;
|
|
752
|
+
market: string;
|
|
753
|
+
}
|
|
674
754
|
/**
|
|
675
755
|
* Class that handles all communication done in PLP code with the Depict API. (Notably not for recommendations currently).
|
|
676
756
|
* It handles caching, retries and errors and is the only place that should be making requests to the Depict API.
|
|
@@ -680,33 +760,26 @@ export class DepictAPI<InputDisplay extends Display, OutputDisplay extends Moder
|
|
|
680
760
|
page_url_creator: PageURLCreator<ModernDisplay, OutputDisplay> | undefined;
|
|
681
761
|
display_transformers: DisplayTransformers<ModernDisplay, OutputDisplay> | undefined;
|
|
682
762
|
constructor(options: DepictAPIConstructorOptions<InputDisplay, OutputDisplay>);
|
|
683
|
-
suggest(input_req:
|
|
763
|
+
suggest(input_req: SearchSuggestionsRequestV3): Promise<SearchSuggestionsResponseAfterURLCreator & {
|
|
764
|
+
failed?: true;
|
|
765
|
+
}>;
|
|
766
|
+
query(input_req: SearchRequestV3): Promise<SearchResponseAfterURLCreator & {
|
|
684
767
|
failed?: true;
|
|
685
768
|
}>;
|
|
686
|
-
|
|
769
|
+
get_listing(input_req: GetListingOptions): Promise<GetListingResponseAfterURLCreator & {
|
|
687
770
|
failed?: true;
|
|
688
771
|
}>;
|
|
689
|
-
|
|
772
|
+
get_listing_products(input_req: ProductListingRequestV3 & {
|
|
773
|
+
listing_id: string;
|
|
774
|
+
}): Promise<ProductListingResponseAfterURLCreator & {
|
|
690
775
|
failed?: true;
|
|
691
776
|
}>;
|
|
692
|
-
get_recommended<T extends Display>(input_req:
|
|
777
|
+
get_recommended<T extends Display>(input_req: BaseSearchRequestV3): Promise<{
|
|
693
778
|
displays: T[];
|
|
694
779
|
} & {
|
|
695
780
|
failed?: true | undefined;
|
|
696
781
|
}>;
|
|
697
782
|
}
|
|
698
|
-
/**
|
|
699
|
-
* Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
|
|
700
|
-
* @returns A cleanup function to manually re-enable scrolling.
|
|
701
|
-
*/
|
|
702
|
-
export function disable_scrolling(): () => void;
|
|
703
|
-
export const CategoryTitle: ({
|
|
704
|
-
category_title_,
|
|
705
|
-
product_count_
|
|
706
|
-
}: {
|
|
707
|
-
category_title_: Accessor<string | undefined>;
|
|
708
|
-
product_count_: JSX.Element;
|
|
709
|
-
}) => JSX.Element;
|
|
710
783
|
/**
|
|
711
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.
|
|
712
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
|
|
@@ -740,7 +813,7 @@ type GeneralCategoryListingOptions = {
|
|
|
740
813
|
localization: category_i18n;
|
|
741
814
|
unique_instance_key_for_state?: string;
|
|
742
815
|
on_navigation?: OnNavigation;
|
|
743
|
-
|
|
816
|
+
listing_id_state_key?: string;
|
|
744
817
|
};
|
|
745
818
|
type CategoryConstructorOptionsWithApi<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = GeneralCategoryListingOptions & {
|
|
746
819
|
api: DepictAPI<InputDisplay, OutputDisplay>;
|
|
@@ -756,18 +829,16 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
|
|
|
756
829
|
#private;
|
|
757
830
|
get localization(): category_i18n;
|
|
758
831
|
set localization(locale_obj: category_i18n);
|
|
759
|
-
get
|
|
760
|
-
set
|
|
832
|
+
get listing_id(): string;
|
|
833
|
+
set listing_id(id: string);
|
|
761
834
|
get merchant(): string;
|
|
762
835
|
set merchant(merchant: string);
|
|
763
836
|
get market(): string;
|
|
764
837
|
set market(market: string);
|
|
765
|
-
get listing_type(): ListingType | undefined;
|
|
766
|
-
set listing_type(listing_type: ListingType | undefined);
|
|
767
838
|
get meta_title_suffix(): string | undefined;
|
|
768
839
|
set meta_title_suffix(new_suffix: string | undefined);
|
|
769
|
-
get
|
|
770
|
-
set
|
|
840
|
+
get disable_override_listing_id(): boolean | undefined;
|
|
841
|
+
set disable_override_listing_id(new_value: boolean | undefined);
|
|
771
842
|
get on_navigation(): OnNavigation;
|
|
772
843
|
set on_navigation(new_function: OnNavigation);
|
|
773
844
|
constructor({
|
|
@@ -776,7 +847,7 @@ export class DepictCategory<InputDisplay extends Display, OutputDisplay extends
|
|
|
776
847
|
page_url_creator,
|
|
777
848
|
display_transformers,
|
|
778
849
|
unique_instance_key_for_state,
|
|
779
|
-
|
|
850
|
+
listing_id_state_key,
|
|
780
851
|
...props_on_class
|
|
781
852
|
}: DepictCategoryConstructorOptions<InputDisplay, OutputDisplay>);
|
|
782
853
|
}
|
|
@@ -793,26 +864,23 @@ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay exte
|
|
|
793
864
|
show_quicklinks?: boolean;
|
|
794
865
|
show_breadcrumbs?: boolean;
|
|
795
866
|
category_title: typeof CategoryTitle | typeof embedded_num_products;
|
|
796
|
-
|
|
867
|
+
on_listing_id_change?: (new_listing_id?: string | undefined, old_listing_id?: string | undefined) => void;
|
|
797
868
|
content_blocks_by_row?: ContentBlocksByRow;
|
|
798
869
|
}): import("@depict-ai/utilishared").Node_Array;
|
|
799
870
|
export function BreadCrumbs<T extends Display>({
|
|
800
871
|
depict_category
|
|
801
872
|
}: {
|
|
802
873
|
depict_category: DepictCategory<T>;
|
|
803
|
-
}):
|
|
874
|
+
}): JSX.Element;
|
|
804
875
|
export function QuickLinks<T extends Display>({
|
|
805
876
|
depict_category
|
|
806
877
|
}: {
|
|
807
878
|
depict_category: DepictCategory<T>;
|
|
808
|
-
}):
|
|
879
|
+
}): JSX.Element;
|
|
809
880
|
/**
|
|
810
|
-
* Gets available
|
|
811
|
-
* @param tenant
|
|
812
|
-
* @param market
|
|
813
|
-
* @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
|
|
814
882
|
*/
|
|
815
|
-
export function
|
|
883
|
+
export function get_listings(merchant: string, market: string, locale: string): Promise<import("@depict-ai/types/api/ListingResponseItem").ListingResponseItem1[]>;
|
|
816
884
|
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
817
885
|
/**
|
|
818
886
|
* Useful for aligning the search modal to an element, like an existing input field
|
|
@@ -900,7 +968,7 @@ export class DepictSearch<InputDisplay extends Display, OutputDisplay extends Mo
|
|
|
900
968
|
set merchant(tenant: string);
|
|
901
969
|
get market(): string;
|
|
902
970
|
set market(market: string);
|
|
903
|
-
fetchSearchResults(query: string, filters?:
|
|
971
|
+
fetchSearchResults(query: string, filters?: _SearchFilter2[], maxResults?: number): Promise<([OutputDisplay] extends [never] ? InputDisplay : ModernDisplayWithPageUrl<OutputDisplay>)[]>;
|
|
904
972
|
}
|
|
905
973
|
/**
|
|
906
974
|
* This is the SearchPage component visible outside - exported from @depict-ai/ui.
|
|
@@ -941,11 +1009,7 @@ export type BaseProviderConfig<InputDisplay extends Display, PossibleTransformed
|
|
|
941
1009
|
*/
|
|
942
1010
|
market: string;
|
|
943
1011
|
/**
|
|
944
|
-
* Optional unique
|
|
945
|
-
*/
|
|
946
|
-
userId?: string;
|
|
947
|
-
/**
|
|
948
|
-
* 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.
|
|
949
1013
|
*/
|
|
950
1014
|
sessionId?: string;
|
|
951
1015
|
/**
|
|
@@ -1038,10 +1102,10 @@ export type BaseCategoryProviderConfig = {
|
|
|
1038
1102
|
*/
|
|
1039
1103
|
metaTitleSuffix?: string;
|
|
1040
1104
|
/**
|
|
1041
|
-
* The parameter `
|
|
1042
|
-
* However, if your page already sets a
|
|
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).
|
|
1043
1107
|
*/
|
|
1044
|
-
|
|
1108
|
+
disableOverrideListingId?: boolean;
|
|
1045
1109
|
};
|
|
1046
1110
|
export interface BaseProductListingConfig {
|
|
1047
1111
|
/**
|
|
@@ -1143,13 +1207,4 @@ export class PageReplacer extends EventTarget {
|
|
|
1143
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)
|
|
1144
1208
|
*/
|
|
1145
1209
|
export function setup_fast_leave(pr: PageReplacer): void;
|
|
1146
|
-
export
|
|
1147
|
-
export const defaultGridSpacing = "2%";
|
|
1148
|
-
export const defaultCategoryTitlePlugin: ({
|
|
1149
|
-
category_title_,
|
|
1150
|
-
product_count_
|
|
1151
|
-
}: {
|
|
1152
|
-
category_title_: import("solid-js").Accessor<string | undefined>;
|
|
1153
|
-
product_count_: import("solid-js").JSX.Element;
|
|
1154
|
-
}) => import("solid-js").JSX.Element;
|
|
1155
|
-
export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV2";
|
|
1210
|
+
export type { SearchFilter } from "@depict-ai/types/api/SearchRequestV3";
|