@depict-ai/ui 4.8.17 → 4.8.19
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 +15275 -15259
- package/ES10/index.d.ts +584 -580
- package/ES10/index.js +15203 -15188
- package/latest/index.cjs +14296 -14280
- package/latest/index.d.ts +584 -580
- package/latest/index.js +14274 -14259
- package/package.json +3 -3
- package/server/ES10/index.cjs +12903 -12885
- package/server/ES10/index.d.ts +584 -580
- package/server/ES10/index.js +12574 -12557
- package/server/latest/index.cjs +11701 -11683
- package/server/latest/index.d.ts +584 -580
- package/server/latest/index.js +11990 -11973
package/server/ES10/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Display, ModernDisplay, report, Amazing_Slider, useExpandingContainer,
|
|
1
|
+
import { JSX, Accessor, Setter, Signal } from "solid-js";
|
|
2
|
+
import { Display, Elem, ModernDisplay, report, ColsAtSize, Amazing_Slider, useExpandingContainer, Node_Array } from "@depict-ai/utilishared/ES10";
|
|
3
|
+
import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
|
|
3
4
|
import { ContentLink, SearchResponse, SearchFilter as _SearchFilter1 } from "@depict-ai/types/api/SearchResponse";
|
|
4
5
|
import { Ancestors, ListingSuggestion, SearchSuggestionsResponseV3, ProductListing as _ProductListing1 } from "@depict-ai/types/api/SearchSuggestionsResponseV3";
|
|
5
6
|
import { ProductListing, GetListingResponse, ContentBlock as _ContentBlock1 } from "@depict-ai/types/api/GetListingResponse";
|
|
6
|
-
import { SearchFilter, SearchRequestV3, SortModel } from "@depict-ai/types/api/SearchRequestV3";
|
|
7
7
|
import { ProductListingResponseV3, SearchFilter as _SearchFilter2 } from "@depict-ai/types/api/ProductListingResponseV3";
|
|
8
8
|
import { SearchSuggestionsRequestV3 } from "@depict-ai/types/api/SearchSuggestionsRequestV3";
|
|
9
9
|
import { ProductListingRequestV3 } from "@depict-ai/types/api/ProductListingRequestV3";
|
|
@@ -11,11 +11,126 @@ import { GetListingRequest } from "@depict-ai/types/api/GetListingRequest";
|
|
|
11
11
|
import { BaseSearchRequestV3 } from "@depict-ai/types/api/BaseSearchRequestV3";
|
|
12
12
|
import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
|
|
13
13
|
import { SearchFilter as _SearchFilter3 } from "@depict-ai/types/api/SearchRequestV2";
|
|
14
|
-
export const version = "4.8.
|
|
14
|
+
export const version = "4.8.19";
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
17
17
|
*/
|
|
18
|
-
export function
|
|
18
|
+
export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
|
|
19
|
+
declare const LISTING_ID = "listingId";
|
|
20
|
+
declare const EXTERNAL_ID = "externalId";
|
|
21
|
+
type ScrollRestorationData = {
|
|
22
|
+
min_results_loaded: number;
|
|
23
|
+
for_id: string;
|
|
24
|
+
}[];
|
|
25
|
+
export type SDKGridSpacing = string | {
|
|
26
|
+
horizontal: string;
|
|
27
|
+
vertical: string;
|
|
28
|
+
};
|
|
29
|
+
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|
|
30
|
+
export type FilterWithData = WithRequired<SearchFilter, "data">;
|
|
31
|
+
export interface SDKRenderingInfo {
|
|
32
|
+
/**
|
|
33
|
+
* If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
|
|
34
|
+
*/
|
|
35
|
+
set_on_index_change: (fn: (index: number) => void) => void;
|
|
36
|
+
}
|
|
37
|
+
export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
|
|
38
|
+
type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
|
|
39
|
+
actual_field?: string;
|
|
40
|
+
})[] : never;
|
|
41
|
+
type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
|
|
42
|
+
/**
|
|
43
|
+
* PLP internationalisation shared between search and category listing
|
|
44
|
+
*/
|
|
45
|
+
type plp_shared_i18n = {
|
|
46
|
+
backend_locale_: string;
|
|
47
|
+
scroll_to_top_: string;
|
|
48
|
+
back_: string;
|
|
49
|
+
open_sorting_: string;
|
|
50
|
+
close_sorting_: string;
|
|
51
|
+
open_filters_: string;
|
|
52
|
+
close_filters_: string;
|
|
53
|
+
close_: string;
|
|
54
|
+
ok_: string;
|
|
55
|
+
filters_cleared_: string;
|
|
56
|
+
we_cleared_your_filters_: string;
|
|
57
|
+
restore_: string;
|
|
58
|
+
sorting_text_: string;
|
|
59
|
+
filter_text_: string;
|
|
60
|
+
selected_filters_title_: string;
|
|
61
|
+
filters_: string;
|
|
62
|
+
view_less_: string;
|
|
63
|
+
view_more_: string;
|
|
64
|
+
/**
|
|
65
|
+
* Also used for "clear all" in previous searches (TextSuggestions)
|
|
66
|
+
*/
|
|
67
|
+
clear_all_from_filter_crumbs_: string;
|
|
68
|
+
clear_individual_filter_: string;
|
|
69
|
+
of_: string;
|
|
70
|
+
clear_all_filters_from_big_button_: string;
|
|
71
|
+
try_without_filters_: string;
|
|
72
|
+
range_filter_low_point_aria_label_: string;
|
|
73
|
+
range_filter_high_point_aria_label_: string;
|
|
74
|
+
morphing_sign_expanded_aria_label_: string;
|
|
75
|
+
morphing_sign_collapsed_aria_label_: string;
|
|
76
|
+
search_a_filter_: (filter_section: string) => string;
|
|
77
|
+
breadcrumbs_aria_label_: string;
|
|
78
|
+
breadcrumbs_separator_: string;
|
|
79
|
+
price_formatting_: {
|
|
80
|
+
pre_: string;
|
|
81
|
+
post_: string;
|
|
82
|
+
decimal_places_delimiter_: string;
|
|
83
|
+
thousands_delimiter_: string;
|
|
84
|
+
places_after_comma_: number | "auto";
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Search internationalisation
|
|
89
|
+
*/
|
|
90
|
+
interface search_i18n extends plp_shared_i18n {
|
|
91
|
+
placeholder_text_: string;
|
|
92
|
+
show_n_results_: (number_of_results: HTMLElement) => Elem[];
|
|
93
|
+
no_results_text_: string;
|
|
94
|
+
no_products_: string;
|
|
95
|
+
search_recs_title_: string;
|
|
96
|
+
clear_filters_query_sorting_after_submit_: string;
|
|
97
|
+
modal_view_all_results_: (number_of_results: HTMLElement) => Elem[];
|
|
98
|
+
modal_discover_more_: string;
|
|
99
|
+
get_showing_results_for_: (query: HTMLElement, number_of_results_element: HTMLElement, has_query: boolean, number_of_results: number | undefined) => Elem[];
|
|
100
|
+
get_showing_pages_for_: (query: HTMLElement, number_of_results_element: HTMLElement, has_query: boolean, number_of_results: number | undefined) => Elem[];
|
|
101
|
+
previous_searches_text_: string;
|
|
102
|
+
category_: string;
|
|
103
|
+
brand_: string;
|
|
104
|
+
suggestions_: string;
|
|
105
|
+
search_submit_button_aria_label_: string;
|
|
106
|
+
search_field_field_aria_label_: string;
|
|
107
|
+
previous_searches_delete_entry_from_history_: string;
|
|
108
|
+
listing_suggestions_: string;
|
|
109
|
+
content_: string;
|
|
110
|
+
previous_: string;
|
|
111
|
+
popular_: string;
|
|
112
|
+
products_: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Category internationalisation
|
|
116
|
+
*/
|
|
117
|
+
interface category_i18n extends plp_shared_i18n {
|
|
118
|
+
show_n_products_: (number_of_results: HTMLElement) => Elem[];
|
|
119
|
+
no_products_text_: string;
|
|
120
|
+
product_: string;
|
|
121
|
+
products_: string;
|
|
122
|
+
quicklinks_aria_label_: string;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* For anything that is not exposed and only used internally we can use solid signals to get more performant rendering.
|
|
126
|
+
* For anything that can be used outside of solid, like Product Cards and InstantCards these types should not be used.
|
|
127
|
+
*
|
|
128
|
+
* Any solid_ type below should not be exposed outside of this library, as the accessors can be confusing and unnecessary.
|
|
129
|
+
*/
|
|
130
|
+
/** For internal components using i18n that gets wrapped in solid's Accessors */
|
|
131
|
+
type solid_plp_shared_i18n = { [K in keyof plp_shared_i18n]: Accessor<plp_shared_i18n[K]> };
|
|
132
|
+
/** For internal components using i18n that gets wrapped in solid's Accessors */
|
|
133
|
+
type solid_search_i18n = { [K in keyof search_i18n]: Accessor<search_i18n[K]> };
|
|
19
134
|
type DisplayTransformerAlwaysThereData = {
|
|
20
135
|
merchant: string;
|
|
21
136
|
market: string;
|
|
@@ -68,48 +183,116 @@ export type SomethingTakingADisplayTransformers<InputDisplay extends Display, Ou
|
|
|
68
183
|
page_url_creator?: never;
|
|
69
184
|
display_transformers?: never;
|
|
70
185
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*/
|
|
76
|
-
export const setExtraDisplayTransformers: <InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay = InputDisplay>(displayTransformers: ExtraDisplayTransformers<InputDisplay, OutputDisplay>) => ExtraDisplayTransformers<InputDisplay, OutputDisplay>;
|
|
77
|
-
type ExtraDisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
|
|
78
|
-
products?: (options: DisplayTransformerAlwaysThereData & {
|
|
79
|
-
displays: InputDisplay[];
|
|
80
|
-
/**
|
|
81
|
-
* If the category display transformer was called due to navigating to a listing using a <CategoryPage> component, currentListing will be set and contain a promise that can be used to get information of said listing.
|
|
82
|
-
*/
|
|
83
|
-
currentListing?: Promise<ProductListing>;
|
|
84
|
-
}) => CanBePromiseWrapped<OutputDisplay>;
|
|
85
|
-
categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
|
|
86
|
-
data: T[];
|
|
87
|
-
}) => CanBePromiseWrapped<T[]>;
|
|
88
|
-
contentResults?: (options: DisplayTransformerAlwaysThereData & {
|
|
89
|
-
data: ContentLink[];
|
|
90
|
-
}) => CanBePromiseWrapped<ContentLink[]>;
|
|
186
|
+
type ListingSuggestionAfterURLCreator = { [K in keyof ListingSuggestion]: K extends "ancestors" ? (ListingSuggestion & {
|
|
187
|
+
page_url: string;
|
|
188
|
+
})[] : ListingSuggestion[K] } & {
|
|
189
|
+
page_url: string;
|
|
91
190
|
};
|
|
191
|
+
type ReplaceCategorySuggestion<T> = T extends ListingSuggestion ? ListingSuggestionAfterURLCreator : T extends ListingSuggestion[] ? ListingSuggestionAfterURLCreator[] : T;
|
|
192
|
+
type SearchSuggestionsResponseAfterURLCreator = { [K in keyof SearchSuggestionsResponseV3]: ReplaceCategorySuggestion<SearchSuggestionsResponseV3[K]> };
|
|
193
|
+
type SearchResponseAfterDisplayTransformer = { [K in keyof SearchResponse]: K extends "displays" ? ModernDisplayWithPageUrl<any>[] : K extends "filters" ? AddActualFieldToFilters<SearchResponse[K]> : SearchResponse[K] };
|
|
194
|
+
type ProductListingWithPageURL = ProductListing & {
|
|
195
|
+
page_url: string;
|
|
196
|
+
};
|
|
197
|
+
type ProductListingResponseAfterDisplayTransformer = { [K in keyof ProductListingResponseV3]: K extends "displays" ? ModernDisplayWithPageUrl<any>[] : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV3[K]> : ProductListingResponseV3[K] };
|
|
198
|
+
type GetListingResponseAfterDisplayTransformer = { [K in keyof GetListingResponseWithQuicklinksAndBreadcrumbs]: K extends "breadcrumbs" ? ProductListingWithPageURL[] : K extends "quick_links" ? ProductListingWithPageURL[] : GetListingResponseWithQuicklinksAndBreadcrumbs[K] };
|
|
199
|
+
type GetListingResponseWithQuicklinksAndBreadcrumbs = Omit<GetListingResponse, "siblings" | "ancestors" | "children"> & {
|
|
200
|
+
quick_links: ProductListingWithAncestors[];
|
|
201
|
+
breadcrumbs: ProductListingWithAncestors[];
|
|
202
|
+
};
|
|
203
|
+
type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
|
|
204
|
+
get_metadata?: () => Promise<{
|
|
205
|
+
[k: string]: string;
|
|
206
|
+
} | undefined>;
|
|
207
|
+
get_session_id?: () => string | undefined;
|
|
208
|
+
} & SomethingTakingADisplayTransformers<InputDisplay, OutputDisplay>;
|
|
209
|
+
interface GetListingOptions extends Omit<GetListingRequest, "listing_id"> {
|
|
210
|
+
session_id?: string;
|
|
211
|
+
id_to_query_for_: string;
|
|
212
|
+
id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
|
|
213
|
+
}
|
|
92
214
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
215
|
+
* Class that handles all communication done in PLP code with the Depict API. (Notably not for recommendations currently).
|
|
216
|
+
* It handles caching, retries and errors and is the only place that should be making requests to the Depict API.
|
|
95
217
|
*/
|
|
96
|
-
export
|
|
97
|
-
|
|
98
|
-
|
|
218
|
+
export class DepictAPI<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never = InputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<InputDisplay> : never> {
|
|
219
|
+
#private;
|
|
220
|
+
display_transformers: DisplayTransformers<ModernDisplay, OutputDisplay> | undefined;
|
|
221
|
+
constructor(options: DepictAPIConstructorOptions<InputDisplay, OutputDisplay>);
|
|
222
|
+
suggest(input_req: SearchSuggestionsRequestV3): Promise<SearchSuggestionsResponseAfterURLCreator & {
|
|
223
|
+
failed?: true;
|
|
224
|
+
}>;
|
|
225
|
+
query(input_req: SearchRequestV3): Promise<SearchResponseAfterDisplayTransformer & {
|
|
226
|
+
failed?: true;
|
|
227
|
+
}>;
|
|
228
|
+
get_listing({
|
|
229
|
+
id_type_,
|
|
230
|
+
id_to_query_for_,
|
|
231
|
+
...input_req
|
|
232
|
+
}: GetListingOptions): Promise<GetListingResponseAfterDisplayTransformer & {
|
|
233
|
+
failed?: true;
|
|
234
|
+
}>;
|
|
235
|
+
get_listing_products({
|
|
236
|
+
id_to_query_for_,
|
|
237
|
+
id_type_,
|
|
238
|
+
currentListingForTransformer_,
|
|
239
|
+
...input_req_
|
|
240
|
+
}: ProductListingRequestV3 & {
|
|
241
|
+
id_to_query_for_: string;
|
|
242
|
+
id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
|
|
243
|
+
currentListingForTransformer_: Promise<_ProductListing1>;
|
|
244
|
+
}): Promise<ProductListingResponseAfterDisplayTransformer & {
|
|
245
|
+
failed?: true;
|
|
246
|
+
}>;
|
|
247
|
+
get_recommended<T extends Display>(input_req: BaseSearchRequestV3): Promise<{
|
|
248
|
+
displays: T[];
|
|
249
|
+
} & {
|
|
250
|
+
failed?: true | undefined;
|
|
251
|
+
}>;
|
|
252
|
+
}
|
|
99
253
|
/**
|
|
100
|
-
*
|
|
254
|
+
* Like standard_price_format except that the price and the formatting are reactive accessors
|
|
101
255
|
*/
|
|
102
|
-
export function
|
|
256
|
+
export function SolidFormatPrice(props: {
|
|
257
|
+
price_: number;
|
|
258
|
+
price_formatting_: {
|
|
259
|
+
pre_: string;
|
|
260
|
+
post_: string;
|
|
261
|
+
decimal_places_delimiter_: string;
|
|
262
|
+
thousands_delimiter_: string;
|
|
263
|
+
places_after_comma_: number | "auto";
|
|
264
|
+
};
|
|
265
|
+
}): JSX.Element;
|
|
266
|
+
export function show_toast({
|
|
267
|
+
children,
|
|
268
|
+
on_close_,
|
|
269
|
+
close_after_,
|
|
270
|
+
...more_attributes
|
|
271
|
+
}: {
|
|
272
|
+
children?: JSX.Element;
|
|
273
|
+
close_after_: number;
|
|
274
|
+
on_close_?: VoidFunction;
|
|
275
|
+
} & JSX.HTMLAttributes<HTMLDivElement>): {
|
|
276
|
+
close_toast_: VoidFunction;
|
|
277
|
+
};
|
|
278
|
+
declare class SDKError extends Error {}
|
|
279
|
+
export class ProductCardError extends SDKError {
|
|
280
|
+
constructor(templateError: Error);
|
|
281
|
+
}
|
|
103
282
|
/**
|
|
104
|
-
*
|
|
105
|
-
* Put this around an <img> or <ResponsiveImg> to give it a container that always has the same size as the image. This prevents CLS and enables ResponsiveImg to work (the browser to load the correct image size)
|
|
106
|
-
* (Not using the CSS aspect-ratio property yet here due to browser support)
|
|
283
|
+
* SentryErrorBoundaries within this provider will call getContext_ when an error happens and add that context to sentry
|
|
107
284
|
*/
|
|
108
|
-
export function
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
285
|
+
export function ExtraSentryContextProvider(props: {
|
|
286
|
+
children: JSX.Element;
|
|
287
|
+
getContext_: () => Record<string, any>;
|
|
288
|
+
}): JSX.Element;
|
|
289
|
+
export function SentryErrorBoundary(props: {
|
|
290
|
+
children: JSX.Element;
|
|
291
|
+
message_: string;
|
|
292
|
+
severity_: Parameters<typeof report>[1];
|
|
293
|
+
on_error_?: (retry: VoidFunction) => JSX.Element | void;
|
|
294
|
+
class_list_?: string[];
|
|
295
|
+
}): JSX.Element;
|
|
113
296
|
/**
|
|
114
297
|
* Provider to wrap every product card that gets rendered in (in PLPResults rendering internals), enables using useProductCardIndex anywhere inside the product card to get the index of the product card.
|
|
115
298
|
*/
|
|
@@ -122,37 +305,51 @@ export function ProductCardIndexProvider(props: {
|
|
|
122
305
|
*/
|
|
123
306
|
export function useProductCardIndex(): Accessor<number> | undefined;
|
|
124
307
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* This is used for our responsive images:
|
|
129
|
-
* 1. The image must have a container with a fixed size (or aspect ratio) that is independent of the image. When aspectRatio is configured on the depict-cards element as data attribute, we will wrap the image in a ImageContainer for this. If it's false, the user has to provide this container themselves.
|
|
130
|
-
* 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
|
|
131
|
-
* 3. We set the size attribute of all the visible images to the size of the container we're observing. The point of this is that the sizes attribute is used to determine which image to load, and usually it's set by the user and depends on the relationship between image size and viewport size. By using a ResizeObserver, we can make sure the sizes attribute is always set to the correct value without it having to be configured. This will make so the browser always loads the correct image size for a crisp image but still fast load.
|
|
132
|
-
* You need to use insert(domNode, <ShopifyResponsiveImg size={sizeAccessor} src={src} />) if you want to insert the return value of this component into a DOM element manually, where you `import { insert } from "solid-js/web";` because we first want to insert the image once it has loaded.
|
|
308
|
+
* This is a function that will safely clone an object that may contain promises.
|
|
309
|
+
* It will use structuredClone to clone the object and then re-apply (copy) any promises that were in the original object to the cloned object.
|
|
310
|
+
* @param obj Anything to clone
|
|
133
311
|
*/
|
|
134
|
-
export function
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
312
|
+
export function promiseSafeStructuredClone<T>(obj: T): T;
|
|
313
|
+
export const CurrentlyIntersectingContext: import("solid-js").Context<{
|
|
314
|
+
currentlyIntersecting_: Accessor<Set<number>>;
|
|
315
|
+
setIsListening_: Setter<number>;
|
|
316
|
+
} | undefined>;
|
|
317
|
+
/**
|
|
318
|
+
* Returns an accessor that says if said product card is in the viewport or not, when ran within a product card. Throws if not ran within a product card.
|
|
319
|
+
*/
|
|
320
|
+
export function useProductCardIsVisible(): Accessor<boolean | undefined>;
|
|
321
|
+
export type SolidLayoutOptions = {
|
|
322
|
+
cols_at_size: ColsAtSize;
|
|
323
|
+
grid_spacing: string;
|
|
324
|
+
rows: {
|
|
325
|
+
start_rows?: number;
|
|
326
|
+
rows_per_click?: number;
|
|
327
|
+
currently_visible?: Signal<number>;
|
|
328
|
+
max_rows?: number;
|
|
329
|
+
button?: JSX.Element;
|
|
330
|
+
view_less_button?: JSX.Element;
|
|
331
|
+
} | "all";
|
|
332
|
+
layout: "slider" | "grid";
|
|
333
|
+
disable_partial_rows?: boolean;
|
|
334
|
+
override_vertical_spacing?: string;
|
|
335
|
+
children: JSX.Element;
|
|
336
|
+
element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
|
|
337
|
+
};
|
|
338
|
+
/**
|
|
339
|
+
* 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.
|
|
340
|
+
* @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
|
|
341
|
+
* @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`
|
|
342
|
+
* @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
|
|
343
|
+
* @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".
|
|
344
|
+
* @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
|
|
345
|
+
* @return An accessor containing a CSS string
|
|
346
|
+
*/
|
|
347
|
+
export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
|
|
348
|
+
/**
|
|
349
|
+
* See SolidLayout JSDoc except that here you can provide your own element
|
|
350
|
+
* When using insert_after_container, view more and view less buttons are not currently supported.
|
|
351
|
+
*/
|
|
352
|
+
export function SolidLayoutWithProvidedElement(props: Omit<SolidLayoutOptions, "children" | "element_attributes">, container_element: HTMLDivElement, insert_after_container?: boolean, container_class?: string): JSX.Element;
|
|
156
353
|
/**
|
|
157
354
|
* Base placeholder component used by ImagePlaceholder and TextPlaceholder
|
|
158
355
|
*/
|
|
@@ -180,72 +377,7 @@ type ImagePlaceholderImageOptions = {
|
|
|
180
377
|
* @property class extra classes to add to the placeholder
|
|
181
378
|
* @property style extra styles to add to the placeholder
|
|
182
379
|
*/
|
|
183
|
-
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
184
|
-
/**
|
|
185
|
-
* 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.
|
|
186
|
-
* If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
|
|
187
|
-
* @property height height of the placeholder. Set to `1em` by default.
|
|
188
|
-
* @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
|
|
189
|
-
* @property class extra classes to add to the placeholder
|
|
190
|
-
* @property style extra styles to add to the placeholder
|
|
191
|
-
*/
|
|
192
|
-
export function TextPlaceholder(props: {
|
|
193
|
-
style?: JSX.CSSProperties;
|
|
194
|
-
height: string;
|
|
195
|
-
width: string;
|
|
196
|
-
class?: string;
|
|
197
|
-
}): JSX.Element;
|
|
198
|
-
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
199
|
-
export const shopifyContainedImageContextSymbol: unique symbol;
|
|
200
|
-
/**
|
|
201
|
-
* Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.
|
|
202
|
-
* Will return a div of the provided aspect ratio that always has the same size, to avoid content layout shift. Will then put the image inside of the container once it loads.
|
|
203
|
-
* Also makes a responsive image without you having to do anything: uses shopify's CDN which picks the best image format to resize the image to the size of the first image container in a certain listing.
|
|
204
|
-
* This works because the listings (recs, search, plp) all are wrapped in `<ListingProvider>`'s. This means all components rendered within can use `useListing` to get an object to write data to that will be the same for all components rendered within that listing. The first instance of this component rendered within a listing puts a ResizeObserver on its div and the other components then just set the sizes attribute of their image to that.
|
|
205
|
-
* @property src image source
|
|
206
|
-
* @property aspectRatio aspect ratio of the image
|
|
207
|
-
* @property class extra class to add to the container
|
|
208
|
-
* @property alt alt text for the image
|
|
209
|
-
* @property autoAdjustAspectRatio whether to automatically adjust the aspect ratio of the image to the majority of the aspect ratios of loaded images in the current listing provider. Defaults to false. Can be overriden with css variable --image-aspect-ratio.
|
|
210
|
-
* @property imgProps props to pass to ShopifyResponsiveImg to add to the <img> element
|
|
211
|
-
*/
|
|
212
|
-
export function ShopifyContainedImage(props: {
|
|
213
|
-
src: string;
|
|
214
|
-
aspectRatio: number | string;
|
|
215
|
-
autoAdjustAspectRatio?: boolean;
|
|
216
|
-
class?: string;
|
|
217
|
-
imgProps?: Omit<Parameters<typeof ShopifyResponsiveImg>[0], "size" | "src">;
|
|
218
|
-
}): HTMLDivElement;
|
|
219
|
-
/**
|
|
220
|
-
* Hacks ShopifyContainedImage work even for non-shopify image urls by forcing the format to be WebP
|
|
221
|
-
*/
|
|
222
|
-
export function ModernResponsiveContainedImage(props: Parameters<typeof ShopifyContainedImage>[0]): import("solid-js").JSX.Element;
|
|
223
|
-
/**
|
|
224
|
-
* Wrapper around ShopifyResponsiveImg (component that just does an image, without wrapping in div). The wrapper allows ShopifyResponsiveImg to work both with shopify CDN URLs and arbitrary URLs, where the latter will be fed through Depict's cloudflare resizer.
|
|
225
|
-
*/
|
|
226
|
-
export function ModernResponsiveImage(props: Parameters<typeof ShopifyResponsiveImg>[0]): import("solid-js").JSX.Element;
|
|
227
|
-
/**
|
|
228
|
-
* Use `javascript_media_query` but return a reactive accessor instead of taking a callback function
|
|
229
|
-
*/
|
|
230
|
-
export function media_query_to_accessor(media_query: string): import("solid-js").Accessor<boolean>;
|
|
231
|
-
declare class SDKError extends Error {}
|
|
232
|
-
export class ProductCardError extends SDKError {
|
|
233
|
-
constructor(templateError: Error);
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* SentryErrorBoundaries within this provider will call getContext_ when an error happens and add that context to sentry
|
|
237
|
-
*/
|
|
238
|
-
export function ExtraSentryContextProvider(props: {
|
|
239
|
-
children: JSX.Element;
|
|
240
|
-
getContext_: () => Record<string, any>;
|
|
241
|
-
}): JSX.Element;
|
|
242
|
-
export function SentryErrorBoundary(props: {
|
|
243
|
-
children: JSX.Element;
|
|
244
|
-
message_: string;
|
|
245
|
-
severity_: Parameters<typeof report>[1];
|
|
246
|
-
on_error_?: (retry: VoidFunction) => JSX.Element | void;
|
|
247
|
-
class_list_?: string[];
|
|
248
|
-
}): JSX.Element;
|
|
380
|
+
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
249
381
|
/**
|
|
250
382
|
* The interface for a content block.
|
|
251
383
|
* Please make sure that you don't have content blocks overlap as that will cause undefined behavior.
|
|
@@ -298,14 +430,6 @@ export function remap_blocks_to_index<T = () => JSX.Element | Promise<JSX.Elemen
|
|
|
298
430
|
readonly content_blocks_by_index_: (Awaited<T> | T[])[];
|
|
299
431
|
readonly displaced_products_: (number | (true | undefined)[])[];
|
|
300
432
|
};
|
|
301
|
-
/**
|
|
302
|
-
* Returns a set containing the element where every element currently touching the screen started touching it.
|
|
303
|
-
*/
|
|
304
|
-
export function useMobileHover(): import("solid-js").Accessor<Set<Element>>;
|
|
305
|
-
/**
|
|
306
|
-
* Returns if the current tab is visible
|
|
307
|
-
*/
|
|
308
|
-
export function useVisibilityState(): import("solid-js").Accessor<boolean>;
|
|
309
433
|
/** @jsxImportSource solid-js */
|
|
310
434
|
export function GenericSliderArrowButton(props?: {
|
|
311
435
|
width_?: number;
|
|
@@ -330,55 +454,6 @@ export function useSlidableInformation(): {
|
|
|
330
454
|
slider_: Amazing_Slider;
|
|
331
455
|
intersectionEntries_: Accessor<IntersectionObserverEntry[]>;
|
|
332
456
|
} | undefined;
|
|
333
|
-
declare const LISTING_ID = "listingId";
|
|
334
|
-
declare const EXTERNAL_ID = "externalId";
|
|
335
|
-
type ScrollRestorationData = {
|
|
336
|
-
min_results_loaded: number;
|
|
337
|
-
for_id: string;
|
|
338
|
-
}[];
|
|
339
|
-
export type SDKGridSpacing = string | {
|
|
340
|
-
horizontal: string;
|
|
341
|
-
vertical: string;
|
|
342
|
-
};
|
|
343
|
-
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|
|
344
|
-
export type FilterWithData = WithRequired<SearchFilter, "data">;
|
|
345
|
-
export interface SDKRenderingInfo {
|
|
346
|
-
/**
|
|
347
|
-
* If you call this function with a provided function, the provided function will be called whenever the index of the currently displayed product changes.
|
|
348
|
-
*/
|
|
349
|
-
set_on_index_change: (fn: (index: number) => void) => void;
|
|
350
|
-
}
|
|
351
|
-
export type ProductCardTemplate<T extends Display> = (display: T | null, info?: SDKRenderingInfo) => JSX.Element | Promise<JSX.Element>;
|
|
352
|
-
type AddActualFieldToArray<T> = T extends Array<infer U> ? (U & {
|
|
353
|
-
actual_field?: string;
|
|
354
|
-
})[] : never;
|
|
355
|
-
type AddActualFieldToFilters<T extends SearchFilter[] | undefined> = T extends undefined ? undefined : AddActualFieldToArray<T>;
|
|
356
|
-
/**
|
|
357
|
-
* This is a function that will safely clone an object that may contain promises.
|
|
358
|
-
* It will use structuredClone to clone the object and then re-apply (copy) any promises that were in the original object to the cloned object.
|
|
359
|
-
* @param obj Anything to clone
|
|
360
|
-
*/
|
|
361
|
-
export function promiseSafeStructuredClone<T>(obj: T): T;
|
|
362
|
-
export const CurrentlyIntersectingContext: import("solid-js").Context<{
|
|
363
|
-
currentlyIntersecting_: Accessor<Set<number>>;
|
|
364
|
-
setIsListening_: Setter<number>;
|
|
365
|
-
} | undefined>;
|
|
366
|
-
/**
|
|
367
|
-
* Returns an accessor that says if said product card is in the viewport or not, when ran within a product card. Throws if not ran within a product card.
|
|
368
|
-
*/
|
|
369
|
-
export function useProductCardIsVisible(): Accessor<boolean | undefined>;
|
|
370
|
-
/**
|
|
371
|
-
* Just like `useExpandingContainer` except that the children can be reactive solid-js signals, basically solid's JSX.Element instead of our JSX.Element
|
|
372
|
-
*/
|
|
373
|
-
export function useExpandingContainerReactive(...params: Parameters<typeof useExpandingContainer>): {
|
|
374
|
-
collapse: (collapsing_delay?: any, time_to_collapse?: any) => Promise<Animation | undefined>;
|
|
375
|
-
expand: (expanding_delay?: any, time_to_expand?: any) => Promise<Animation | undefined>;
|
|
376
|
-
ExpandingContainer: ({
|
|
377
|
-
children
|
|
378
|
-
}: {
|
|
379
|
-
children: JSX.Element | (() => JSX.Element);
|
|
380
|
-
}) => JSX.Element;
|
|
381
|
-
};
|
|
382
457
|
export type SDKColsAtSize = [number, number?][];
|
|
383
458
|
/**
|
|
384
459
|
* Transform SDK ColsAtSize into valid Layout ColsAtSize
|
|
@@ -386,215 +461,86 @@ export type SDKColsAtSize = [number, number?][];
|
|
|
386
461
|
* @returns
|
|
387
462
|
*/
|
|
388
463
|
export const convert_sdk_cols_at_size_to_layout: (cols_at_size: SDKColsAtSize) => ColsAtSize;
|
|
389
|
-
export type SolidLayoutOptions = {
|
|
390
|
-
cols_at_size: ColsAtSize;
|
|
391
|
-
grid_spacing: string;
|
|
392
|
-
rows: {
|
|
393
|
-
start_rows?: number;
|
|
394
|
-
rows_per_click?: number;
|
|
395
|
-
currently_visible?: Signal<number>;
|
|
396
|
-
max_rows?: number;
|
|
397
|
-
button?: JSX.Element;
|
|
398
|
-
view_less_button?: JSX.Element;
|
|
399
|
-
} | "all";
|
|
400
|
-
layout: "slider" | "grid";
|
|
401
|
-
disable_partial_rows?: boolean;
|
|
402
|
-
override_vertical_spacing?: string;
|
|
403
|
-
children: JSX.Element;
|
|
404
|
-
element_attributes: Omit<JSX.HTMLAttributes<HTMLDivElement>, "classList">;
|
|
405
|
-
};
|
|
406
|
-
/**
|
|
407
|
-
* 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.
|
|
408
|
-
* @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
|
|
409
|
-
* @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`
|
|
410
|
-
* @property grid_spacing spacing to use if none is specified for the specific size in `cols_at_size`
|
|
411
|
-
* @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".
|
|
412
|
-
* @property override_vertical_spacing by default, the grid_spacing is used both horizontally and vertically, with this you can specify a separate spacing
|
|
413
|
-
* @return An accessor containing a CSS string
|
|
414
|
-
*/
|
|
415
|
-
export function SolidLayout(props: SolidLayoutOptions): JSX.Element;
|
|
416
464
|
/**
|
|
417
|
-
*
|
|
418
|
-
*
|
|
465
|
+
* This function is used to determine if the user is trying to open a link in a new tab or window, and we therefore should not single page navigate
|
|
466
|
+
* @param clickEvent The click event that triggered the navigation
|
|
419
467
|
*/
|
|
420
|
-
export function
|
|
468
|
+
export function allowNativeNavigation(clickEvent?: MouseEvent): number | boolean | undefined;
|
|
469
|
+
export type OnNavigation = ((options: {
|
|
470
|
+
is_replace: boolean;
|
|
471
|
+
new_url: URL;
|
|
472
|
+
scroll: boolean;
|
|
473
|
+
}) => void) | "hard_navigation";
|
|
421
474
|
/**
|
|
422
|
-
*
|
|
475
|
+
* Not a router that does our custom routing on non-spas and otherwise plugs into other routers and generalises their functionality
|
|
423
476
|
*/
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
scroll_to_top_: string;
|
|
427
|
-
back_: string;
|
|
428
|
-
open_sorting_: string;
|
|
429
|
-
close_sorting_: string;
|
|
430
|
-
open_filters_: string;
|
|
431
|
-
close_filters_: string;
|
|
432
|
-
close_: string;
|
|
433
|
-
ok_: string;
|
|
434
|
-
filters_cleared_: string;
|
|
435
|
-
we_cleared_your_filters_: string;
|
|
436
|
-
restore_: string;
|
|
437
|
-
sorting_text_: string;
|
|
438
|
-
filter_text_: string;
|
|
439
|
-
selected_filters_title_: string;
|
|
440
|
-
filters_: string;
|
|
441
|
-
view_less_: string;
|
|
442
|
-
view_more_: string;
|
|
477
|
+
export class PseudoRouter {
|
|
478
|
+
#private;
|
|
443
479
|
/**
|
|
444
|
-
*
|
|
480
|
+
* Function that will be called when we want to navigate, or a string saying it's not an SPA. You can change this OTG
|
|
445
481
|
*/
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
modal_view_all_results_: (number_of_results: HTMLElement) => Elem[];
|
|
477
|
-
modal_discover_more_: string;
|
|
478
|
-
get_showing_results_for_: (query: HTMLElement, number_of_results_element: HTMLElement, has_query: boolean, number_of_results: number | undefined) => Elem[];
|
|
479
|
-
get_showing_pages_for_: (query: HTMLElement, number_of_results_element: HTMLElement, has_query: boolean, number_of_results: number | undefined) => Elem[];
|
|
480
|
-
previous_searches_text_: string;
|
|
481
|
-
category_: string;
|
|
482
|
-
brand_: string;
|
|
483
|
-
suggestions_: string;
|
|
484
|
-
search_submit_button_aria_label_: string;
|
|
485
|
-
search_field_field_aria_label_: string;
|
|
486
|
-
previous_searches_delete_entry_from_history_: string;
|
|
487
|
-
listing_suggestions_: string;
|
|
488
|
-
content_: string;
|
|
489
|
-
previous_: string;
|
|
490
|
-
popular_: string;
|
|
491
|
-
products_: string;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Category internationalisation
|
|
495
|
-
*/
|
|
496
|
-
interface category_i18n extends plp_shared_i18n {
|
|
497
|
-
show_n_products_: (number_of_results: HTMLElement) => Elem[];
|
|
498
|
-
no_products_text_: string;
|
|
499
|
-
product_: string;
|
|
500
|
-
products_: string;
|
|
501
|
-
quicklinks_aria_label_: string;
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* For anything that is not exposed and only used internally we can use solid signals to get more performant rendering.
|
|
505
|
-
* For anything that can be used outside of solid, like Product Cards and InstantCards these types should not be used.
|
|
506
|
-
*
|
|
507
|
-
* Any solid_ type below should not be exposed outside of this library, as the accessors can be confusing and unnecessary.
|
|
508
|
-
*/
|
|
509
|
-
/** For internal components using i18n that gets wrapped in solid's Accessors */
|
|
510
|
-
type solid_plp_shared_i18n = { [K in keyof plp_shared_i18n]: Accessor<plp_shared_i18n[K]> };
|
|
511
|
-
/** For internal components using i18n that gets wrapped in solid's Accessors */
|
|
512
|
-
type solid_search_i18n = { [K in keyof search_i18n]: Accessor<search_i18n[K]> };
|
|
513
|
-
/**
|
|
514
|
-
* Like standard_price_format except that the price and the formatting are reactive accessors
|
|
515
|
-
*/
|
|
516
|
-
export function SolidFormatPrice(props: {
|
|
517
|
-
price_: number;
|
|
518
|
-
price_formatting_: {
|
|
519
|
-
pre_: string;
|
|
520
|
-
post_: string;
|
|
521
|
-
decimal_places_delimiter_: string;
|
|
522
|
-
thousands_delimiter_: string;
|
|
523
|
-
places_after_comma_: number | "auto";
|
|
524
|
-
};
|
|
525
|
-
}): JSX.Element;
|
|
526
|
-
type ListingSuggestionAfterURLCreator = { [K in keyof ListingSuggestion]: K extends "ancestors" ? (ListingSuggestion & {
|
|
527
|
-
page_url: string;
|
|
528
|
-
})[] : ListingSuggestion[K] } & {
|
|
529
|
-
page_url: string;
|
|
530
|
-
};
|
|
531
|
-
type ReplaceCategorySuggestion<T> = T extends ListingSuggestion ? ListingSuggestionAfterURLCreator : T extends ListingSuggestion[] ? ListingSuggestionAfterURLCreator[] : T;
|
|
532
|
-
type SearchSuggestionsResponseAfterURLCreator = { [K in keyof SearchSuggestionsResponseV3]: ReplaceCategorySuggestion<SearchSuggestionsResponseV3[K]> };
|
|
533
|
-
type SearchResponseAfterDisplayTransformer = { [K in keyof SearchResponse]: K extends "displays" ? ModernDisplayWithPageUrl<any>[] : K extends "filters" ? AddActualFieldToFilters<SearchResponse[K]> : SearchResponse[K] };
|
|
534
|
-
type ProductListingWithPageURL = ProductListing & {
|
|
535
|
-
page_url: string;
|
|
536
|
-
};
|
|
537
|
-
type ProductListingResponseAfterDisplayTransformer = { [K in keyof ProductListingResponseV3]: K extends "displays" ? ModernDisplayWithPageUrl<any>[] : K extends "filters" ? AddActualFieldToFilters<ProductListingResponseV3[K]> : ProductListingResponseV3[K] };
|
|
538
|
-
type GetListingResponseAfterDisplayTransformer = { [K in keyof GetListingResponseWithQuicklinksAndBreadcrumbs]: K extends "breadcrumbs" ? ProductListingWithPageURL[] : K extends "quick_links" ? ProductListingWithPageURL[] : GetListingResponseWithQuicklinksAndBreadcrumbs[K] };
|
|
539
|
-
type GetListingResponseWithQuicklinksAndBreadcrumbs = Omit<GetListingResponse, "siblings" | "ancestors" | "children"> & {
|
|
540
|
-
quick_links: ProductListingWithAncestors[];
|
|
541
|
-
breadcrumbs: ProductListingWithAncestors[];
|
|
542
|
-
};
|
|
543
|
-
type DepictAPIConstructorOptions<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never> = {
|
|
544
|
-
get_metadata?: () => Promise<{
|
|
545
|
-
[k: string]: string;
|
|
546
|
-
} | undefined>;
|
|
547
|
-
get_session_id?: () => string | undefined;
|
|
548
|
-
} & SomethingTakingADisplayTransformers<InputDisplay, OutputDisplay>;
|
|
549
|
-
interface GetListingOptions extends Omit<GetListingRequest, "listing_id"> {
|
|
550
|
-
session_id?: string;
|
|
551
|
-
id_to_query_for_: string;
|
|
552
|
-
id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
|
|
482
|
+
on_navigation_: OnNavigation;
|
|
483
|
+
/**
|
|
484
|
+
* 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
|
|
485
|
+
*/
|
|
486
|
+
listing_query_state_key: string | undefined;
|
|
487
|
+
navigate_: {
|
|
488
|
+
/**
|
|
489
|
+
* Call this if you *just* want to replace the state object in history.state
|
|
490
|
+
*/
|
|
491
|
+
replace_state_: (new_state: {
|
|
492
|
+
[key: string]: any;
|
|
493
|
+
}) => void;
|
|
494
|
+
/**
|
|
495
|
+
* Call this to change the URL
|
|
496
|
+
* @param new_url_ new URL to go to
|
|
497
|
+
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
498
|
+
* @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
|
|
499
|
+
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
500
|
+
* @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
|
|
501
|
+
*/
|
|
502
|
+
go_to_: (args_0: {
|
|
503
|
+
new_url_: string | URL;
|
|
504
|
+
event_?: MouseEvent | undefined;
|
|
505
|
+
force_spa_navigation_?: boolean | undefined;
|
|
506
|
+
is_replace_: boolean;
|
|
507
|
+
listing_query_?: ListingQuery | undefined;
|
|
508
|
+
scroll?: boolean | undefined;
|
|
509
|
+
}) => Promise<void | undefined>;
|
|
510
|
+
};
|
|
511
|
+
constructor(on_navigation: OnNavigation, listing_query_state_key?: string);
|
|
553
512
|
}
|
|
554
513
|
/**
|
|
555
|
-
*
|
|
556
|
-
*
|
|
514
|
+
* 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.
|
|
515
|
+
* If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
|
|
516
|
+
* @property height height of the placeholder. Set to `1em` by default.
|
|
517
|
+
* @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
|
|
518
|
+
* @property class extra classes to add to the placeholder
|
|
519
|
+
* @property style extra styles to add to the placeholder
|
|
557
520
|
*/
|
|
558
|
-
export
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
query(input_req: SearchRequestV3): Promise<SearchResponseAfterDisplayTransformer & {
|
|
566
|
-
failed?: true;
|
|
567
|
-
}>;
|
|
568
|
-
get_listing({
|
|
569
|
-
id_type_,
|
|
570
|
-
id_to_query_for_,
|
|
571
|
-
...input_req
|
|
572
|
-
}: GetListingOptions): Promise<GetListingResponseAfterDisplayTransformer & {
|
|
573
|
-
failed?: true;
|
|
574
|
-
}>;
|
|
575
|
-
get_listing_products({
|
|
576
|
-
id_to_query_for_,
|
|
577
|
-
id_type_,
|
|
578
|
-
currentListingForTransformer_,
|
|
579
|
-
...input_req_
|
|
580
|
-
}: ProductListingRequestV3 & {
|
|
581
|
-
id_to_query_for_: string;
|
|
582
|
-
id_type_: typeof LISTING_ID | typeof EXTERNAL_ID;
|
|
583
|
-
currentListingForTransformer_: Promise<_ProductListing1>;
|
|
584
|
-
}): Promise<ProductListingResponseAfterDisplayTransformer & {
|
|
585
|
-
failed?: true;
|
|
586
|
-
}>;
|
|
587
|
-
get_recommended<T extends Display>(input_req: BaseSearchRequestV3): Promise<{
|
|
588
|
-
displays: T[];
|
|
589
|
-
} & {
|
|
590
|
-
failed?: true | undefined;
|
|
591
|
-
}>;
|
|
592
|
-
}
|
|
521
|
+
export function TextPlaceholder(props: {
|
|
522
|
+
style?: JSX.CSSProperties;
|
|
523
|
+
height: string;
|
|
524
|
+
width: string;
|
|
525
|
+
class?: string;
|
|
526
|
+
}): JSX.Element;
|
|
527
|
+
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
593
528
|
/**
|
|
594
529
|
* Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
|
|
595
530
|
* @returns A cleanup function to manually re-enable scrolling.
|
|
596
531
|
*/
|
|
597
532
|
export function disable_scrolling(): () => void;
|
|
533
|
+
/**
|
|
534
|
+
* Provider to wrap every listing (group of products) in
|
|
535
|
+
* Used for example for deduplicating ResizeObservers for responsive images
|
|
536
|
+
*/
|
|
537
|
+
export function ListingProvider(props: {
|
|
538
|
+
children: JSX.Element;
|
|
539
|
+
}): JSX.Element;
|
|
540
|
+
/**
|
|
541
|
+
* Use this to get the context object if your component is within a ListingProvider
|
|
542
|
+
*/
|
|
543
|
+
export function useListing(): Record<symbol, any> | undefined;
|
|
598
544
|
/**
|
|
599
545
|
* Function that encodes a filter object into query parameters and sets them on the given URLSearchParams object.
|
|
600
546
|
*/
|
|
@@ -619,6 +565,80 @@ export function decode_sorting(search_params: URLSearchParams, sorting_query_par
|
|
|
619
565
|
* @param sorting_query_param
|
|
620
566
|
*/
|
|
621
567
|
export function strip_encoded_filter_and_sort(search_params: URLSearchParams, filter_query_param_prefix: string, sorting_query_param: string): void;
|
|
568
|
+
/**
|
|
569
|
+
* ImageContainer for using the padding hack to set the aspect ratio of an image
|
|
570
|
+
* Put this around an <img> or <ResponsiveImg> to give it a container that always has the same size as the image. This prevents CLS and enables ResponsiveImg to work (the browser to load the correct image size)
|
|
571
|
+
* (Not using the CSS aspect-ratio property yet here due to browser support)
|
|
572
|
+
*/
|
|
573
|
+
export function ImageContainer(props: {
|
|
574
|
+
aspectRatio: number | string;
|
|
575
|
+
class?: string;
|
|
576
|
+
children?: JSX.Element;
|
|
577
|
+
}): HTMLDivElement;
|
|
578
|
+
/**
|
|
579
|
+
* Automatically generate a srcset from the shopify CDN for an image and set the sizes attribute to the provided accessor.
|
|
580
|
+
* Will also delay loading and decoding of image until the browser is idle (with 5s timeout) to improve filtering/loading more performance.
|
|
581
|
+
* If ran within Depict product card rendering, within one of the first 8 product cards, those images will be loaded immediately and loading="lazy" will be ignored for them (unless you set it to "force-lazy").
|
|
582
|
+
* This is used for our responsive images:
|
|
583
|
+
* 1. The image must have a container with a fixed size (or aspect ratio) that is independent of the image. When aspectRatio is configured on the depict-cards element as data attribute, we will wrap the image in a ImageContainer for this. If it's false, the user has to provide this container themselves.
|
|
584
|
+
* 2. We set a ResizeObserver on one of the currently visible images (see makeSizeAccessor)
|
|
585
|
+
* 3. We set the size attribute of all the visible images to the size of the container we're observing. The point of this is that the sizes attribute is used to determine which image to load, and usually it's set by the user and depends on the relationship between image size and viewport size. By using a ResizeObserver, we can make sure the sizes attribute is always set to the correct value without it having to be configured. This will make so the browser always loads the correct image size for a crisp image but still fast load.
|
|
586
|
+
* You need to use insert(domNode, <ShopifyResponsiveImg size={sizeAccessor} src={src} />) if you want to insert the return value of this component into a DOM element manually, where you `import { insert } from "solid-js/web";` because we first want to insert the image once it has loaded.
|
|
587
|
+
*/
|
|
588
|
+
export function ShopifyResponsiveImg(props: {
|
|
589
|
+
resolutions?: number[];
|
|
590
|
+
/**
|
|
591
|
+
* Width of the container, we'll load an image with that width
|
|
592
|
+
*/
|
|
593
|
+
size: Accessor<number>;
|
|
594
|
+
/**
|
|
595
|
+
* Height of the container, if set we will use this to still load sharp images even when object-fit is set to "cover", and the image is "zoomed" in on the x-axis.
|
|
596
|
+
*/
|
|
597
|
+
sizeHeight?: Accessor<number>;
|
|
598
|
+
src: string;
|
|
599
|
+
/**
|
|
600
|
+
* When image is not lazy loaded this callback will be called every time the image has been decoded
|
|
601
|
+
*/
|
|
602
|
+
onDecoded?: VoidFunction;
|
|
603
|
+
loading?: "eager" | "lazy" | "force-lazy";
|
|
604
|
+
customUrls?: (url: string, width: number) => string;
|
|
605
|
+
/**
|
|
606
|
+
* When `true`, data written for ShopifyContainedImage's `autoAdjustAspectRatio` feature will only be allowed to be written the load after the image src has changed. This is to make css transitions on images whose size is animated smoother (since aspect ratio changing minimally as size changes will cause the transition to restart)
|
|
607
|
+
*/
|
|
608
|
+
keyRatioUpdating?: boolean;
|
|
609
|
+
} & Omit<JSX.ImgHTMLAttributes<HTMLImageElement>, "srcset" | "src" | "sizes" | "loading">): JSX.Element;
|
|
610
|
+
/**
|
|
611
|
+
* Returns two accessors (one width and one height) that will update when the size of the provided element changes, to be used with ResponsiveImg
|
|
612
|
+
*/
|
|
613
|
+
export function makeSizeAccessors(whatToWatch: HTMLElement): [Accessor<number>, Accessor<number>];
|
|
614
|
+
export const shopifyContainedImageContextSymbol: unique symbol;
|
|
615
|
+
/**
|
|
616
|
+
* Abstraction built on top of ShopifyResponsiveImg. This is your one-stop-shop If you just need a responsive image.
|
|
617
|
+
* Will return a div of the provided aspect ratio that always has the same size, to avoid content layout shift. Will then put the image inside of the container once it loads.
|
|
618
|
+
* Also makes a responsive image without you having to do anything: uses shopify's CDN which picks the best image format to resize the image to the size of the first image container in a certain listing.
|
|
619
|
+
* This works because the listings (recs, search, plp) all are wrapped in `<ListingProvider>`'s. This means all components rendered within can use `useListing` to get an object to write data to that will be the same for all components rendered within that listing. The first instance of this component rendered within a listing puts a ResizeObserver on its div and the other components then just set the sizes attribute of their image to that.
|
|
620
|
+
* @property src image source
|
|
621
|
+
* @property aspectRatio aspect ratio of the image
|
|
622
|
+
* @property class extra class to add to the container
|
|
623
|
+
* @property alt alt text for the image
|
|
624
|
+
* @property autoAdjustAspectRatio whether to automatically adjust the aspect ratio of the image to the majority of the aspect ratios of loaded images in the current listing provider. Defaults to false. Can be overriden with css variable --image-aspect-ratio.
|
|
625
|
+
* @property imgProps props to pass to ShopifyResponsiveImg to add to the <img> element
|
|
626
|
+
*/
|
|
627
|
+
export function ShopifyContainedImage(props: {
|
|
628
|
+
src: string;
|
|
629
|
+
aspectRatio: number | string;
|
|
630
|
+
autoAdjustAspectRatio?: boolean;
|
|
631
|
+
class?: string;
|
|
632
|
+
imgProps?: Omit<Parameters<typeof ShopifyResponsiveImg>[0], "size" | "src">;
|
|
633
|
+
}): HTMLDivElement;
|
|
634
|
+
/**
|
|
635
|
+
* Hacks ShopifyContainedImage work even for non-shopify image urls by forcing the format to be WebP
|
|
636
|
+
*/
|
|
637
|
+
export function ModernResponsiveContainedImage(props: Parameters<typeof ShopifyContainedImage>[0]): import("solid-js").JSX.Element;
|
|
638
|
+
/**
|
|
639
|
+
* Wrapper around ShopifyResponsiveImg (component that just does an image, without wrapping in div). The wrapper allows ShopifyResponsiveImg to work both with shopify CDN URLs and arbitrary URLs, where the latter will be fed through Depict's cloudflare resizer.
|
|
640
|
+
*/
|
|
641
|
+
export function ModernResponsiveImage(props: Parameters<typeof ShopifyResponsiveImg>[0]): import("solid-js").JSX.Element;
|
|
622
642
|
export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
|
|
623
643
|
/**
|
|
624
644
|
* Symbol used to identify the version of a SearchModal function. Values right now: 1 = 1st gen classic modal, 2 = second gen modal
|
|
@@ -628,11 +648,6 @@ export const modalVersionSymbol: unique symbol;
|
|
|
628
648
|
* Returns accessor with the size of the provided element, including padding and border (I think)
|
|
629
649
|
*/
|
|
630
650
|
export function make_accurate_width_accessor(what_to_watch: HTMLElement): import("solid-js").Accessor<number | undefined>;
|
|
631
|
-
/**
|
|
632
|
-
* This function is used to determine if the user is trying to open a link in a new tab or window, and we therefore should not single page navigate
|
|
633
|
-
* @param clickEvent The click event that triggered the navigation
|
|
634
|
-
*/
|
|
635
|
-
export function allowNativeNavigation(clickEvent?: MouseEvent): number | boolean | undefined;
|
|
636
651
|
interface Styles {
|
|
637
652
|
[selector: string]: JSX.CSSProperties;
|
|
638
653
|
}
|
|
@@ -942,58 +957,187 @@ export interface BaseCategoryPageConfig extends BaseProductListingConfig {
|
|
|
942
957
|
layout?: PossibleLayout;
|
|
943
958
|
}
|
|
944
959
|
/**
|
|
945
|
-
* The listing to query Depict for. `type` can be `"listingId"` or `"externalId"`..
|
|
946
|
-
* If `id` is `"listingId"`, it should be a uuid where Depict is the source of truth, you can get them here: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get.
|
|
947
|
-
* If `id` is `"externalId"`, it should be the id of the product listing in your system - whatever was passed to Depict during data ingestion.
|
|
960
|
+
* The listing to query Depict for. `type` can be `"listingId"` or `"externalId"`..
|
|
961
|
+
* If `id` is `"listingId"`, it should be a uuid where Depict is the source of truth, you can get them here: https://api.depict.ai/docs#tag/Listing/operation/Get_Listings_v3_listings_get.
|
|
962
|
+
* If `id` is `"externalId"`, it should be the id of the product listing in your system - whatever was passed to Depict during data ingestion.
|
|
963
|
+
*/
|
|
964
|
+
export type ListingQuery = {
|
|
965
|
+
type: typeof LISTING_ID | typeof EXTERNAL_ID;
|
|
966
|
+
id: string;
|
|
967
|
+
};
|
|
968
|
+
/**
|
|
969
|
+
* Just like `useExpandingContainer` except that the children can be reactive solid-js signals, basically solid's JSX.Element instead of our JSX.Element
|
|
970
|
+
*/
|
|
971
|
+
export function useExpandingContainerReactive(...params: Parameters<typeof useExpandingContainer>): {
|
|
972
|
+
collapse: (collapsing_delay?: any, time_to_collapse?: any) => Promise<Animation | undefined>;
|
|
973
|
+
expand: (expanding_delay?: any, time_to_expand?: any) => Promise<Animation | undefined>;
|
|
974
|
+
ExpandingContainer: ({
|
|
975
|
+
children
|
|
976
|
+
}: {
|
|
977
|
+
children: JSX.Element | (() => JSX.Element);
|
|
978
|
+
}) => JSX.Element;
|
|
979
|
+
};
|
|
980
|
+
export function ExpandingDetails(props: {
|
|
981
|
+
details_: HTMLDetailsElement;
|
|
982
|
+
summary_: HTMLElement;
|
|
983
|
+
children: JSX.Element | (() => JSX.Element);
|
|
984
|
+
is_open_: Signal<boolean>;
|
|
985
|
+
duration_?: number;
|
|
986
|
+
delay_?: number;
|
|
987
|
+
dont_animate_if_instant_open_?: boolean;
|
|
988
|
+
}): HTMLDetailsElement;
|
|
989
|
+
export function SelectedFilters({
|
|
990
|
+
number_of_rendered_selected_filters_items_,
|
|
991
|
+
i18n_,
|
|
992
|
+
selected_filters_,
|
|
993
|
+
local_filter_cache_: [read_local_filter_cache],
|
|
994
|
+
get_search_filters_open_,
|
|
995
|
+
get_search_sorting_open_,
|
|
996
|
+
local_filter_cache_,
|
|
997
|
+
expanded_hierarchical_filters_
|
|
998
|
+
}: {
|
|
999
|
+
get_search_filters_open_: Accessor<boolean>;
|
|
1000
|
+
get_search_sorting_open_: Accessor<boolean>;
|
|
1001
|
+
expanded_hierarchical_filters_: Signal<{
|
|
1002
|
+
value_: string[];
|
|
1003
|
+
expanded_: boolean;
|
|
1004
|
+
}[]>;
|
|
1005
|
+
number_of_rendered_selected_filters_items_: Signal<number>;
|
|
1006
|
+
i18n_: solid_plp_shared_i18n;
|
|
1007
|
+
selected_filters_: Signal<FilterWithData[]>;
|
|
1008
|
+
local_filter_cache_: Signal<SearchFilter[]>;
|
|
1009
|
+
}): HTMLDivElement;
|
|
1010
|
+
/**
|
|
1011
|
+
* Basically allows you to use SearchModal
|
|
1012
|
+
* 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.
|
|
1013
|
+
* @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
|
|
1014
|
+
* @param modal_fn_opts static options for the modal that won't change on a per-opening basis
|
|
1015
|
+
* @param parent override the parent element to append the modal to. Defaults to <body>
|
|
1016
|
+
@returns a function to open and close the modal. When calling the open_modal_ function additional parameters can be passed to the modal
|
|
1017
|
+
*/
|
|
1018
|
+
export function general_modal_abstraction<StaticOptions extends {
|
|
1019
|
+
[key: string]: any;
|
|
1020
|
+
}, ExtraOptionsProvidedOnOpen extends {
|
|
1021
|
+
[key: string]: any;
|
|
1022
|
+
}>(search_modal: (options: StaticOptions & ExtraOptionsProvidedOnOpen & {
|
|
1023
|
+
close_modal_: VoidFunction;
|
|
1024
|
+
open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
|
|
1025
|
+
register_closing_animation_: (animation: () => Promise<any>) => void;
|
|
1026
|
+
}) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
|
|
1027
|
+
open_modal_: (extra_options_for_modal?: any, on_dispose?: VoidFunction | undefined) => Promise<void | undefined>;
|
|
1028
|
+
close_modal_: () => void | undefined;
|
|
1029
|
+
}>;
|
|
1030
|
+
interface FilterBodyProps {
|
|
1031
|
+
available_filters_: Accessor<_SearchFilter1[] | undefined>;
|
|
1032
|
+
expanded_filters_: Signal<{
|
|
1033
|
+
section_: string;
|
|
1034
|
+
expanded_: boolean;
|
|
1035
|
+
}[]>;
|
|
1036
|
+
selected_filters_: Signal<{
|
|
1037
|
+
field: string;
|
|
1038
|
+
op: _SearchFilter1["op"];
|
|
1039
|
+
data: any;
|
|
1040
|
+
}[]>;
|
|
1041
|
+
local_filter_cache_: Signal<_SearchFilter1[]>;
|
|
1042
|
+
i18n_: solid_plp_shared_i18n;
|
|
1043
|
+
expanded_hierarchical_filters_: Signal<{
|
|
1044
|
+
value_: string[];
|
|
1045
|
+
expanded_: boolean;
|
|
1046
|
+
}[]>;
|
|
1047
|
+
are_in_modal_?: boolean;
|
|
1048
|
+
}
|
|
1049
|
+
export function FilterBody(props: FilterBodyProps): JSX.Element;
|
|
1050
|
+
/**
|
|
1051
|
+
* Makes signals out of values in history.state so that you can use history state as an intuitive storage of application state.
|
|
1052
|
+
* @param params_to_default_value an object of keys with a serialisable default value.
|
|
1053
|
+
* @param router_ router used to replace state
|
|
1054
|
+
* @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.
|
|
1055
|
+
*/
|
|
1056
|
+
export function history_dot_state_to_state<Param extends string, DefaultValue>(params_to_default_value: Record<Param, DefaultValue>, router_: PseudoRouter): Record<Param, Signal<any>>;
|
|
1057
|
+
export function create_modified_filters({
|
|
1058
|
+
available_filters_,
|
|
1059
|
+
local_filter_cache_: [read_local_cache, write_local_cache],
|
|
1060
|
+
selected_filters_: [read_selected_filters]
|
|
1061
|
+
}: {
|
|
1062
|
+
available_filters_: Accessor<_SearchFilter1[] | undefined>;
|
|
1063
|
+
selected_filters_: Signal<{
|
|
1064
|
+
field: string;
|
|
1065
|
+
op: _SearchFilter1["op"];
|
|
1066
|
+
data: any;
|
|
1067
|
+
}[]>;
|
|
1068
|
+
local_filter_cache_: Signal<_SearchFilter1[]>;
|
|
1069
|
+
}): void;
|
|
1070
|
+
export const CategoryTitle: ({
|
|
1071
|
+
category_title_,
|
|
1072
|
+
product_count_
|
|
1073
|
+
}: {
|
|
1074
|
+
category_title_: Accessor<string | undefined>;
|
|
1075
|
+
product_count_: JSX.Element;
|
|
1076
|
+
}) => JSX.Element;
|
|
1077
|
+
/**
|
|
1078
|
+
* 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.
|
|
1079
|
+
* 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
|
|
1080
|
+
* If you see “ResizeObserver loop limit exceeded”, this is probably doing it. More context here: https://depictaiworkspace.slack.com/archives/C02KVDZ8YHZ/p1667315647758829
|
|
948
1081
|
*/
|
|
949
|
-
export
|
|
950
|
-
|
|
951
|
-
|
|
1082
|
+
export const embedded_num_products: ({
|
|
1083
|
+
make_product_count_,
|
|
1084
|
+
set_observed_results_filters_elements_,
|
|
1085
|
+
is_slim_,
|
|
1086
|
+
sort_and_filter_element_,
|
|
1087
|
+
extra_sort_and_filter_args_
|
|
1088
|
+
}: {
|
|
1089
|
+
make_product_count_: () => JSX.Element;
|
|
1090
|
+
set_observed_results_filters_elements_: Setter<JSX.Element>;
|
|
1091
|
+
sort_and_filter_element_: Accessor<HTMLDivElement | undefined>;
|
|
1092
|
+
is_slim_: Accessor<boolean>;
|
|
1093
|
+
extra_sort_and_filter_args_: {
|
|
1094
|
+
get_extra_sorting_button_?: ((extra_button: JSX.Element) => unknown) | undefined;
|
|
1095
|
+
get_extra_filters_button_?: ((extra_button: JSX.Element) => unknown) | undefined;
|
|
1096
|
+
sort_button_width_?: Accessor<number | undefined> | undefined;
|
|
1097
|
+
filter_button_width_?: Accessor<number | undefined> | undefined;
|
|
1098
|
+
};
|
|
1099
|
+
}) => {
|
|
1100
|
+
only_show_filters_opener_: Accessor<boolean>;
|
|
1101
|
+
middle_elements_: Accessor<JSX.Element>;
|
|
1102
|
+
on_filters_constructed_: () => void;
|
|
952
1103
|
};
|
|
953
|
-
export type OnNavigation = ((options: {
|
|
954
|
-
is_replace: boolean;
|
|
955
|
-
new_url: URL;
|
|
956
|
-
scroll: boolean;
|
|
957
|
-
}) => void) | "hard_navigation";
|
|
958
1104
|
/**
|
|
959
|
-
*
|
|
1105
|
+
* Returns if the current tab is visible
|
|
960
1106
|
*/
|
|
961
|
-
export
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1107
|
+
export function useVisibilityState(): import("solid-js").Accessor<boolean>;
|
|
1108
|
+
type ContentBlockHistoryState = {
|
|
1109
|
+
blocks: _ContentBlock1[];
|
|
1110
|
+
aspectRatios: Record<string, number>;
|
|
1111
|
+
};
|
|
1112
|
+
/**
|
|
1113
|
+
* When called in something rendered as child of <CategoryPage>, this will return the current layout of the page (grid or slider).
|
|
1114
|
+
*/
|
|
1115
|
+
export function usePLPLayout(): Accessor<PossibleLayout | undefined> | undefined;
|
|
1116
|
+
export const getExtraDisplayTransformers: () => ExtraDisplayTransformers<any, any> | undefined;
|
|
1117
|
+
/**
|
|
1118
|
+
* When called from inside the shopify apps product card editor, this registers extra display transformers to be ran alongside Depict's default added ones. The ones for products and content will run after Depicts but the ones for categories will run before Depicts.
|
|
1119
|
+
* @param displayTransformers
|
|
1120
|
+
*/
|
|
1121
|
+
export const setExtraDisplayTransformers: <InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay = InputDisplay>(displayTransformers: ExtraDisplayTransformers<InputDisplay, OutputDisplay>) => ExtraDisplayTransformers<InputDisplay, OutputDisplay>;
|
|
1122
|
+
type ExtraDisplayTransformers<InputDisplay extends ModernDisplay, OutputDisplay extends ModernDisplay | never> = {
|
|
1123
|
+
products?: (options: DisplayTransformerAlwaysThereData & {
|
|
1124
|
+
displays: InputDisplay[];
|
|
978
1125
|
/**
|
|
979
|
-
*
|
|
980
|
-
* @param new_url_ new URL to go to
|
|
981
|
-
* @param event_ event if you have this in a click handler, will not do anything on cmd/ctrl or non-left click then
|
|
982
|
-
* @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
|
|
983
|
-
* @param is_replace_ if you want to replace the current URL in history instead of pushing a new one
|
|
984
|
-
* @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
|
|
1126
|
+
* If the category display transformer was called due to navigating to a listing using a <CategoryPage> component, currentListing will be set and contain a promise that can be used to get information of said listing.
|
|
985
1127
|
*/
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1128
|
+
currentListing?: Promise<ProductListing>;
|
|
1129
|
+
}) => CanBePromiseWrapped<OutputDisplay>;
|
|
1130
|
+
categories?: <T extends ProductListingWithAncestors | ListingSuggestionForTransformer>(options: DisplayTransformerAlwaysThereData & {
|
|
1131
|
+
data: T[];
|
|
1132
|
+
}) => CanBePromiseWrapped<T[]>;
|
|
1133
|
+
contentResults?: (options: DisplayTransformerAlwaysThereData & {
|
|
1134
|
+
data: ContentLink[];
|
|
1135
|
+
}) => CanBePromiseWrapped<ContentLink[]>;
|
|
1136
|
+
};
|
|
1137
|
+
/**
|
|
1138
|
+
* Returns a set containing the element where every element currently touching the screen started touching it.
|
|
1139
|
+
*/
|
|
1140
|
+
export function useMobileHover(): import("solid-js").Accessor<Set<Element>>;
|
|
997
1141
|
/**
|
|
998
1142
|
* The whole card representing a look
|
|
999
1143
|
*/
|
|
@@ -1085,40 +1229,6 @@ export function Tab(props: {
|
|
|
1085
1229
|
onSelected?: VoidFunction;
|
|
1086
1230
|
id?: string;
|
|
1087
1231
|
}): undefined;
|
|
1088
|
-
/**
|
|
1089
|
-
* Basically allows you to use SearchModal
|
|
1090
|
-
* 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.
|
|
1091
|
-
* @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
|
|
1092
|
-
* @param modal_fn_opts static options for the modal that won't change on a per-opening basis
|
|
1093
|
-
* @param parent override the parent element to append the modal to. Defaults to <body>
|
|
1094
|
-
@returns a function to open and close the modal. When calling the open_modal_ function additional parameters can be passed to the modal
|
|
1095
|
-
*/
|
|
1096
|
-
export function general_modal_abstraction<StaticOptions extends {
|
|
1097
|
-
[key: string]: any;
|
|
1098
|
-
}, ExtraOptionsProvidedOnOpen extends {
|
|
1099
|
-
[key: string]: any;
|
|
1100
|
-
}>(search_modal: (options: StaticOptions & ExtraOptionsProvidedOnOpen & {
|
|
1101
|
-
close_modal_: VoidFunction;
|
|
1102
|
-
open_modal_: (extra_options_for_modal?: ExtraOptionsProvidedOnOpen, on_dispose?: VoidFunction) => void;
|
|
1103
|
-
register_closing_animation_: (animation: () => Promise<any>) => void;
|
|
1104
|
-
}) => Node_Array, modal_fn_opts: StaticOptions, parent?: HTMLElement | ShadowRoot): Promise<{
|
|
1105
|
-
open_modal_: (extra_options_for_modal?: any, on_dispose?: VoidFunction | undefined) => Promise<void | undefined>;
|
|
1106
|
-
close_modal_: () => void | undefined;
|
|
1107
|
-
}>;
|
|
1108
|
-
/**
|
|
1109
|
-
* Makes signals out of values in history.state so that you can use history state as an intuitive storage of application state.
|
|
1110
|
-
* @param params_to_default_value an object of keys with a serialisable default value.
|
|
1111
|
-
* @param router_ router used to replace state
|
|
1112
|
-
* @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.
|
|
1113
|
-
*/
|
|
1114
|
-
export function history_dot_state_to_state<Param extends string, DefaultValue>(params_to_default_value: Record<Param, DefaultValue>, router_: PseudoRouter): Record<Param, Signal<any>>;
|
|
1115
|
-
export const CategoryTitle: ({
|
|
1116
|
-
category_title_,
|
|
1117
|
-
product_count_
|
|
1118
|
-
}: {
|
|
1119
|
-
category_title_: Accessor<string | undefined>;
|
|
1120
|
-
product_count_: JSX.Element;
|
|
1121
|
-
}) => JSX.Element;
|
|
1122
1232
|
export const defaultColsAtSize: SDKColsAtSize;
|
|
1123
1233
|
export const defaultGridSpacing = "2%";
|
|
1124
1234
|
export const defaultCategoryTitlePlugin: ({
|
|
@@ -1171,82 +1281,7 @@ export function RecommendationSlider<T extends Display>(props: {
|
|
|
1171
1281
|
showSliderArrow_?: boolean;
|
|
1172
1282
|
class?: string;
|
|
1173
1283
|
}): HTMLDivElement;
|
|
1174
|
-
export function ExpandingDetails(props: {
|
|
1175
|
-
details_: HTMLDetailsElement;
|
|
1176
|
-
summary_: HTMLElement;
|
|
1177
|
-
children: JSX.Element | (() => JSX.Element);
|
|
1178
|
-
is_open_: Signal<boolean>;
|
|
1179
|
-
duration_?: number;
|
|
1180
|
-
delay_?: number;
|
|
1181
|
-
dont_animate_if_instant_open_?: boolean;
|
|
1182
|
-
}): HTMLDetailsElement;
|
|
1183
1284
|
export function accessor_of_object_to_object_with_accessor_values<O extends Record<string | symbol, any>>(obj: Accessor<O>): { [K in keyof O]: Accessor<O[K]> };
|
|
1184
|
-
export function show_toast({
|
|
1185
|
-
children,
|
|
1186
|
-
on_close_,
|
|
1187
|
-
close_after_,
|
|
1188
|
-
...more_attributes
|
|
1189
|
-
}: {
|
|
1190
|
-
children?: JSX.Element;
|
|
1191
|
-
close_after_: number;
|
|
1192
|
-
on_close_?: VoidFunction;
|
|
1193
|
-
} & JSX.HTMLAttributes<HTMLDivElement>): {
|
|
1194
|
-
close_toast_: VoidFunction;
|
|
1195
|
-
};
|
|
1196
|
-
export function SelectedFilters({
|
|
1197
|
-
number_of_rendered_selected_filters_items_,
|
|
1198
|
-
i18n_,
|
|
1199
|
-
selected_filters_,
|
|
1200
|
-
local_filter_cache_: [read_local_filter_cache],
|
|
1201
|
-
get_search_filters_open_,
|
|
1202
|
-
get_search_sorting_open_,
|
|
1203
|
-
local_filter_cache_,
|
|
1204
|
-
expanded_hierarchical_filters_
|
|
1205
|
-
}: {
|
|
1206
|
-
get_search_filters_open_: Accessor<boolean>;
|
|
1207
|
-
get_search_sorting_open_: Accessor<boolean>;
|
|
1208
|
-
expanded_hierarchical_filters_: Signal<{
|
|
1209
|
-
value_: string[];
|
|
1210
|
-
expanded_: boolean;
|
|
1211
|
-
}[]>;
|
|
1212
|
-
number_of_rendered_selected_filters_items_: Signal<number>;
|
|
1213
|
-
i18n_: solid_plp_shared_i18n;
|
|
1214
|
-
selected_filters_: Signal<FilterWithData[]>;
|
|
1215
|
-
local_filter_cache_: Signal<SearchFilter[]>;
|
|
1216
|
-
}): HTMLDivElement;
|
|
1217
|
-
interface FilterBodyProps {
|
|
1218
|
-
available_filters_: Accessor<_SearchFilter1[] | undefined>;
|
|
1219
|
-
expanded_filters_: Signal<{
|
|
1220
|
-
section_: string;
|
|
1221
|
-
expanded_: boolean;
|
|
1222
|
-
}[]>;
|
|
1223
|
-
selected_filters_: Signal<{
|
|
1224
|
-
field: string;
|
|
1225
|
-
op: _SearchFilter1["op"];
|
|
1226
|
-
data: any;
|
|
1227
|
-
}[]>;
|
|
1228
|
-
local_filter_cache_: Signal<_SearchFilter1[]>;
|
|
1229
|
-
i18n_: solid_plp_shared_i18n;
|
|
1230
|
-
expanded_hierarchical_filters_: Signal<{
|
|
1231
|
-
value_: string[];
|
|
1232
|
-
expanded_: boolean;
|
|
1233
|
-
}[]>;
|
|
1234
|
-
are_in_modal_?: boolean;
|
|
1235
|
-
}
|
|
1236
|
-
export function FilterBody(props: FilterBodyProps): JSX.Element;
|
|
1237
|
-
export function create_modified_filters({
|
|
1238
|
-
available_filters_,
|
|
1239
|
-
local_filter_cache_: [read_local_cache, write_local_cache],
|
|
1240
|
-
selected_filters_: [read_selected_filters]
|
|
1241
|
-
}: {
|
|
1242
|
-
available_filters_: Accessor<_SearchFilter1[] | undefined>;
|
|
1243
|
-
selected_filters_: Signal<{
|
|
1244
|
-
field: string;
|
|
1245
|
-
op: _SearchFilter1["op"];
|
|
1246
|
-
data: any;
|
|
1247
|
-
}[]>;
|
|
1248
|
-
local_filter_cache_: Signal<_SearchFilter1[]>;
|
|
1249
|
-
}): void;
|
|
1250
1285
|
export type ExclusiveId = {
|
|
1251
1286
|
categoryId: string;
|
|
1252
1287
|
productId?: undefined;
|
|
@@ -1311,41 +1346,10 @@ type RecsAPIWrapperOptions = {
|
|
|
1311
1346
|
* @return This function is guaranteed to return an array of Displays. If anything fails, you will get an empty array.
|
|
1312
1347
|
*/
|
|
1313
1348
|
export function fetchDepictRecommendations<T extends ModernDisplay = ModernDisplay>(options: RecsAPIWrapperOptions): Promise<T[]>;
|
|
1314
|
-
/**
|
|
1315
|
-
* 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.
|
|
1316
|
-
* 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
|
|
1317
|
-
* If you see “ResizeObserver loop limit exceeded”, this is probably doing it. More context here: https://depictaiworkspace.slack.com/archives/C02KVDZ8YHZ/p1667315647758829
|
|
1318
|
-
*/
|
|
1319
|
-
export const embedded_num_products: ({
|
|
1320
|
-
make_product_count_,
|
|
1321
|
-
set_observed_results_filters_elements_,
|
|
1322
|
-
is_slim_,
|
|
1323
|
-
sort_and_filter_element_,
|
|
1324
|
-
extra_sort_and_filter_args_
|
|
1325
|
-
}: {
|
|
1326
|
-
make_product_count_: () => JSX.Element;
|
|
1327
|
-
set_observed_results_filters_elements_: Setter<JSX.Element>;
|
|
1328
|
-
sort_and_filter_element_: Accessor<HTMLDivElement | undefined>;
|
|
1329
|
-
is_slim_: Accessor<boolean>;
|
|
1330
|
-
extra_sort_and_filter_args_: {
|
|
1331
|
-
get_extra_sorting_button_?: ((extra_button: JSX.Element) => unknown) | undefined;
|
|
1332
|
-
get_extra_filters_button_?: ((extra_button: JSX.Element) => unknown) | undefined;
|
|
1333
|
-
sort_button_width_?: Accessor<number | undefined> | undefined;
|
|
1334
|
-
filter_button_width_?: Accessor<number | undefined> | undefined;
|
|
1335
|
-
};
|
|
1336
|
-
}) => {
|
|
1337
|
-
only_show_filters_opener_: Accessor<boolean>;
|
|
1338
|
-
middle_elements_: Accessor<JSX.Element>;
|
|
1339
|
-
on_filters_constructed_: () => void;
|
|
1340
|
-
};
|
|
1341
1349
|
/**
|
|
1342
1350
|
* Gets available listings for a given merchant, market and locale
|
|
1343
1351
|
*/
|
|
1344
1352
|
export function get_listings(merchant: string, market: string, locale: string): Promise<import("@depict-ai/types/api/ListListingsResponseItem").ListListingsResponseItem1[]>;
|
|
1345
|
-
type ContentBlockHistoryState = {
|
|
1346
|
-
blocks: _ContentBlock1[];
|
|
1347
|
-
aspectRatios: Record<string, number>;
|
|
1348
|
-
};
|
|
1349
1353
|
type GeneralCategoryListingOptions = {
|
|
1350
1354
|
market: string;
|
|
1351
1355
|
merchant: string;
|