@depict-ai/ui 1.0.17 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/main.js +430 -230
- package/dist/client/module.js +431 -233
- package/dist/index.d.ts +59 -27
- package/dist/main.js +13 -9
- package/dist/module.js +13 -9
- package/dist/server/main.js +374 -195
- package/dist/server/module.js +375 -198
- package/package.json +50 -27
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Display, Elem, ColsAtSize, Node_Array } from "@depict-ai/utilishared";
|
|
2
1
|
import { JSX, Accessor, Setter, Signal } from "solid-js";
|
|
2
|
+
import { Display, Elem, ColsAtSize, Node_Array } from "@depict-ai/utilishared";
|
|
3
3
|
import { SearchResponse } from "@depict-ai/types/api/SearchResponse";
|
|
4
4
|
import { SearchRequest, SearchFilter } from "@depict-ai/types/api/SearchRequest";
|
|
5
5
|
import { BaseSearchRequest } from "@depict-ai/types/api/BaseSearchRequest";
|
|
@@ -7,7 +7,13 @@ import { SearchSuggestionsResponse, CategorySuggestion } from "@depict-ai/types/
|
|
|
7
7
|
import { SearchSuggestionsRequest } from "@depict-ai/types/api/SearchSuggestionsRequest";
|
|
8
8
|
import { ProductListingRequest } from "@depict-ai/types/api/ProductListingRequest";
|
|
9
9
|
import { ProductListingResponse } from "@depict-ai/types/api/ProductListingResponse";
|
|
10
|
-
export const version = "1.0.
|
|
10
|
+
export const version = "1.0.18";
|
|
11
|
+
export function CrossIcon(props?: JSX.SvgSVGAttributes<SVGSVGElement>): SVGElement;
|
|
12
|
+
/** @jsxImportSource solid-js */
|
|
13
|
+
export function GenericSliderArrowButton(props?: {
|
|
14
|
+
width_?: number;
|
|
15
|
+
height_?: number;
|
|
16
|
+
}): SVGElement;
|
|
11
17
|
export type OnNavigation = ((options: {
|
|
12
18
|
is_replace: boolean;
|
|
13
19
|
new_url: URL;
|
|
@@ -214,6 +220,27 @@ declare class SDKError extends Error {
|
|
|
214
220
|
export class ProductCardError extends SDKError {
|
|
215
221
|
constructor(templateError: Error);
|
|
216
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Base placeholder component used by ImagePlaceholder and TextPlaceholder
|
|
225
|
+
*/
|
|
226
|
+
export function BasePlaceholder(props: {
|
|
227
|
+
style: JSX.CSSProperties;
|
|
228
|
+
class?: string;
|
|
229
|
+
}): JSX.Element;
|
|
230
|
+
/**
|
|
231
|
+
* 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.
|
|
232
|
+
* If you want a block version, use `ImagePlaceholder` with `width`and `height` set instead.
|
|
233
|
+
* @property height height of the placeholder. Set to `1em` by default.
|
|
234
|
+
* @property width width of the placeholder. For specific number of characters use `ch`, ex: `width="7ch"`
|
|
235
|
+
* @property class extra classes to add to the placeholder
|
|
236
|
+
* @property style extra styles to add to the placeholder
|
|
237
|
+
*/
|
|
238
|
+
export function TextPlaceholder(props: {
|
|
239
|
+
style?: JSX.CSSProperties;
|
|
240
|
+
height: string;
|
|
241
|
+
width: string;
|
|
242
|
+
class?: string;
|
|
243
|
+
}): JSX.Element;
|
|
217
244
|
/**
|
|
218
245
|
* Disables scrolling until the solidjs reactive scoped is disposed (onCleanup)
|
|
219
246
|
* @returns A cleanup function to manually re-enable scrolling.
|
|
@@ -222,7 +249,7 @@ export function disable_scrolling(): () => void;
|
|
|
222
249
|
export const CategoryTitle: ({ category_title_, product_count_, }: {
|
|
223
250
|
category_title_: Accessor<string | undefined>;
|
|
224
251
|
product_count_: JSX.Element;
|
|
225
|
-
}) =>
|
|
252
|
+
}) => JSX.Element;
|
|
226
253
|
/**
|
|
227
254
|
* 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.
|
|
228
255
|
* 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
|
|
@@ -287,7 +314,34 @@ export function BreadCrumbs({ depict_category }: {
|
|
|
287
314
|
export function QuickLinks({ depict_category }: {
|
|
288
315
|
depict_category: DepictCategory;
|
|
289
316
|
}): HTMLElement;
|
|
290
|
-
|
|
317
|
+
/**
|
|
318
|
+
* Gets available categories/collections (query_ids for the product-listing endpoint) for a merchant
|
|
319
|
+
* @param tenant
|
|
320
|
+
* @param market
|
|
321
|
+
* @param type - optional, currently only setting this to "collection" will return collections instead of categories
|
|
322
|
+
*/
|
|
323
|
+
export function get_categories(tenant: string, market: string, type?: string): Promise<string[]>;
|
|
324
|
+
type ImagePlaceholderBaseOptions = {
|
|
325
|
+
style?: JSX.CSSProperties;
|
|
326
|
+
class?: string;
|
|
327
|
+
};
|
|
328
|
+
type ImagePlaceholderBlockOptions = {
|
|
329
|
+
width: string;
|
|
330
|
+
height: string;
|
|
331
|
+
};
|
|
332
|
+
type ImagePlaceholderImageOptions = {
|
|
333
|
+
aspectRatio: number;
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* A placeholder that can be used instead of an image or other block of content while it's loading.
|
|
337
|
+
* The placeholder has `display:block`, meaning it will create a new "row" in the layout for itself. Can be used either for images with a defined aspect ratio (ContainedImage) or blocks.
|
|
338
|
+
* @property aspectRatio if aspectRatio is defined the placeholder will be in "image mode" and fill out the available width and then adjust the height according to the aspectRatio
|
|
339
|
+
* @property width If width and height is set, the defined width and height will be used.
|
|
340
|
+
* @property height If width and height is set, the defined width and height will be used.
|
|
341
|
+
* @property class extra classes to add to the placeholder
|
|
342
|
+
* @property style extra styles to add to the placeholder
|
|
343
|
+
*/
|
|
344
|
+
export function ImagePlaceholder(props: ImagePlaceholderBaseOptions & (ImagePlaceholderBlockOptions | ImagePlaceholderImageOptions)): JSX.Element;
|
|
291
345
|
export function DefaultInstantCardPlaceholder(): HTMLDivElement;
|
|
292
346
|
/**
|
|
293
347
|
* Useful for aligning the search modal to an element, like an existing input field
|
|
@@ -451,28 +505,6 @@ export interface BaseCategoryPageConfig extends BaseProductListingConfig {
|
|
|
451
505
|
*/
|
|
452
506
|
showQuicklinks?: boolean;
|
|
453
507
|
}
|
|
454
|
-
/**
|
|
455
|
-
* Props for the TextPlaceholder component.
|
|
456
|
-
*/
|
|
457
|
-
export interface TextPlaceholderProps {
|
|
458
|
-
/**
|
|
459
|
-
* The height of the text, including a unit.
|
|
460
|
-
* @example "1em"
|
|
461
|
-
*/
|
|
462
|
-
height: string;
|
|
463
|
-
/**
|
|
464
|
-
* The width of the text.
|
|
465
|
-
* @example "60px", "10em"
|
|
466
|
-
*/
|
|
467
|
-
width: string;
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Props for the ImagePlaceholder component.
|
|
471
|
-
*/
|
|
472
|
-
export interface ImagePlaceholderProps {
|
|
473
|
-
/** The aspect ratio of the image that will be displayed. */
|
|
474
|
-
aspectRatio: number;
|
|
475
|
-
}
|
|
476
508
|
type CenteredLocation = {
|
|
477
509
|
location?: "centered";
|
|
478
510
|
};
|
|
@@ -538,5 +570,5 @@ export const defaultGridSpacing = "2%";
|
|
|
538
570
|
export const defaultCategoryTitlePlugin: ({ category_title_, product_count_, }: {
|
|
539
571
|
category_title_: import("solid-js").Accessor<string | undefined>;
|
|
540
572
|
product_count_: import("solid-js").JSX.Element;
|
|
541
|
-
}) =>
|
|
573
|
+
}) => import("solid-js").JSX.Element;
|
|
542
574
|
export type { SearchFilter } from "@depict-ai/types/api/SearchRequest";
|
package/dist/main.js
CHANGED
|
@@ -37,7 +37,7 @@ $parcel$export(module.exports, "defaultGridSpacing", () => $a3280f0aad997933$exp
|
|
|
37
37
|
$parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$export$c3834fa86c616831);
|
|
38
38
|
$parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
|
|
39
39
|
$parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
|
|
40
|
-
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.0.
|
|
40
|
+
/*! Depict.ai search and product listing SDK */ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.0.9";
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -995,17 +995,22 @@ function $a73063cc642f3e5f$export$43f0fb951fcb0c54({ displays_by_key_: displays_
|
|
|
995
995
|
];
|
|
996
996
|
},
|
|
997
997
|
children: (product_id, index)=>{
|
|
998
|
+
// We're using `untrack` here since we don't want to react in here to displays_by_key changing
|
|
999
|
+
// As long as our key stays the same we assume that the display hasn't changed, so we don't want to rerender
|
|
1000
|
+
// If the key gets removed, <For> will remove us
|
|
998
1001
|
const owner = (0, $iBTHO$solidjs.getOwner)();
|
|
999
1002
|
const display_accessor = (0, $iBTHO$solidjs.createMemo)(()=>displays_by_key_().get(product_id));
|
|
1000
|
-
const [product_card_resource] = (0, $iBTHO$solidjs.createResource)(
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
+
const [product_card_resource] = (0, $iBTHO$solidjs.createResource)((0, $iBTHO$solidjs.createMemo)(()=>[
|
|
1004
|
+
merchant_(),
|
|
1005
|
+
market_()
|
|
1006
|
+
]), // re-render when merchant or market changes
|
|
1007
|
+
([merchant, market])=>{
|
|
1003
1008
|
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
1009
|
+
const display = (0, $iBTHO$solidjs.untrack)(display_accessor);
|
|
1004
1010
|
return product_card_template_(display, {
|
|
1005
1011
|
set_on_index_change: (fn)=>(0, $iBTHO$solidjs.runWithOwner)(owner, ()=>(0, $iBTHO$solidjs.createEffect)(()=>fn(index()))),
|
|
1006
|
-
merchant:
|
|
1007
|
-
|
|
1008
|
-
market: (0, $iBTHO$solidjs.untrack)(market_)
|
|
1012
|
+
merchant: merchant,
|
|
1013
|
+
market: market
|
|
1009
1014
|
});
|
|
1010
1015
|
});
|
|
1011
1016
|
const node_accessor = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)(product_card_resource);
|
|
@@ -6452,8 +6457,7 @@ const $6ae613870d3380fc$export$b05c0ae390cf3e06 = (display_or_variant_container,
|
|
|
6452
6457
|
sizes: "0px"
|
|
6453
6458
|
}));
|
|
6454
6459
|
const is_sale = (0, $iBTHO$solidjs.createMemo)(()=>display().sale_price !== display().original_price);
|
|
6455
|
-
|
|
6456
|
-
const href = (0, $iBTHO$solidjs.createMemo)(()=>display().localized_page_url || display().page_url);
|
|
6460
|
+
const href = (0, $iBTHO$solidjs.createMemo)(()=>display().page_url);
|
|
6457
6461
|
return (()=>{
|
|
6458
6462
|
const _el$ = $6ae613870d3380fc$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
|
|
6459
6463
|
(0, $iBTHO$solidjsweb.addEventListener)(_el$, "click", (0, $iBTHO$depictaiutilishared.catchify)((event_)=>router_.navigate_.go_to_({
|
package/dist/module.js
CHANGED
|
@@ -2,7 +2,7 @@ import {add_to_version_info as $kyEB6$add_to_version_info, fetch_recs as $kyEB6$
|
|
|
2
2
|
import {template as $kyEB6$template, insert as $kyEB6$insert, effect as $kyEB6$effect, setAttribute as $kyEB6$setAttribute, createComponent as $kyEB6$createComponent, use as $kyEB6$use, memo as $kyEB6$memo, addEventListener as $kyEB6$addEventListener, delegateEvents as $kyEB6$delegateEvents, spread as $kyEB6$spread, classList as $kyEB6$classList, style as $kyEB6$style, Dynamic as $kyEB6$Dynamic, mergeProps as $kyEB6$mergeProps, className as $kyEB6$className} from "solid-js/web";
|
|
3
3
|
import {createSignal as $kyEB6$createSignal, getOwner as $kyEB6$getOwner, createRoot as $kyEB6$createRoot, runWithOwner as $kyEB6$runWithOwner, onCleanup as $kyEB6$onCleanup, createComputed as $kyEB6$createComputed, createRenderEffect as $kyEB6$createRenderEffect, createEffect as $kyEB6$createEffect, untrack as $kyEB6$untrack, batch as $kyEB6$batch, createResource as $kyEB6$createResource, createMemo as $kyEB6$createMemo, Show as $kyEB6$Show, createReaction as $kyEB6$createReaction, Suspense as $kyEB6$Suspense, on as $kyEB6$on, ErrorBoundary as $kyEB6$ErrorBoundary, For as $kyEB6$For, Index as $kyEB6$Index} from "solid-js";
|
|
4
4
|
|
|
5
|
-
/*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.0.
|
|
5
|
+
/*! Depict.ai search and product listing SDK */ const $ec291e0010116877$export$83d89fbfd8236492 = "1.0.9";
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -960,17 +960,22 @@ function $29ec7cddbe1d3484$export$43f0fb951fcb0c54({ displays_by_key_: displays_
|
|
|
960
960
|
];
|
|
961
961
|
},
|
|
962
962
|
children: (product_id, index)=>{
|
|
963
|
+
// We're using `untrack` here since we don't want to react in here to displays_by_key changing
|
|
964
|
+
// As long as our key stays the same we assume that the display hasn't changed, so we don't want to rerender
|
|
965
|
+
// If the key gets removed, <For> will remove us
|
|
963
966
|
const owner = (0, $kyEB6$getOwner)();
|
|
964
967
|
const display_accessor = (0, $kyEB6$createMemo)(()=>displays_by_key_().get(product_id));
|
|
965
|
-
const [product_card_resource] = (0, $kyEB6$createResource)(
|
|
966
|
-
|
|
967
|
-
|
|
968
|
+
const [product_card_resource] = (0, $kyEB6$createResource)((0, $kyEB6$createMemo)(()=>[
|
|
969
|
+
merchant_(),
|
|
970
|
+
market_()
|
|
971
|
+
]), // re-render when merchant or market changes
|
|
972
|
+
([merchant, market])=>{
|
|
968
973
|
// get display in the function that re-runs when merchant or market have changed, since the display may have changed but product_id not
|
|
974
|
+
const display = (0, $kyEB6$untrack)(display_accessor);
|
|
969
975
|
return product_card_template_(display, {
|
|
970
976
|
set_on_index_change: (fn)=>(0, $kyEB6$runWithOwner)(owner, ()=>(0, $kyEB6$createEffect)(()=>fn(index()))),
|
|
971
|
-
merchant:
|
|
972
|
-
|
|
973
|
-
market: (0, $kyEB6$untrack)(market_)
|
|
977
|
+
merchant: merchant,
|
|
978
|
+
market: market
|
|
974
979
|
});
|
|
975
980
|
});
|
|
976
981
|
const node_accessor = (0, $a52235d12ccf9c88$export$2f0cbfbb4354bb52)(product_card_resource);
|
|
@@ -6417,8 +6422,7 @@ const $e003be2a50d9e5bc$export$b05c0ae390cf3e06 = (display_or_variant_container,
|
|
|
6417
6422
|
sizes: "0px"
|
|
6418
6423
|
}));
|
|
6419
6424
|
const is_sale = (0, $kyEB6$createMemo)(()=>display().sale_price !== display().original_price);
|
|
6420
|
-
|
|
6421
|
-
const href = (0, $kyEB6$createMemo)(()=>display().localized_page_url || display().page_url);
|
|
6425
|
+
const href = (0, $kyEB6$createMemo)(()=>display().page_url);
|
|
6422
6426
|
return (()=>{
|
|
6423
6427
|
const _el$ = $e003be2a50d9e5bc$var$_tmpl$2.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.firstChild, _el$5 = _el$4.firstChild, _el$6 = _el$5.nextSibling, _el$7 = _el$4.nextSibling, _el$9 = _el$7.firstChild;
|
|
6424
6428
|
(0, $kyEB6$addEventListener)(_el$, "click", (0, $kyEB6$catchify)((event_)=>router_.navigate_.go_to_({
|