@depict-ai/react-ui 1.3.2 → 1.3.4
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/index.d.ts +5 -5
- package/dist/main.js +31 -21
- package/dist/module.js +32 -22
- package/dist-server/index.d.ts +1 -1
- package/dist-server/main.js +1 -1
- package/dist-server/module.js +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig,
|
|
1
|
+
import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig, ModernDisplayWithPageUrl, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui";
|
|
2
2
|
import { Display, ModernDisplay } from "@depict-ai/utilishared";
|
|
3
3
|
import React, { ReactNode, PropsWithChildren, ReactElement } from "react";
|
|
4
4
|
import { DPC } from "@depict-ai/dpc";
|
|
5
5
|
import { Locale } from "@depict-ai/ui/locales";
|
|
6
|
-
|
|
7
|
-
export const version = "1.3.2";
|
|
6
|
+
export const version = "1.3.4";
|
|
8
7
|
interface PLPConfig<T extends Display> extends BaseProductListingConfig {
|
|
9
8
|
/**
|
|
10
9
|
* The product card to use for rendering products.
|
|
@@ -213,7 +212,7 @@ interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPC
|
|
|
213
212
|
*/
|
|
214
213
|
export function SearchPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: SearchPageConfig<[
|
|
215
214
|
OutputDisplay
|
|
216
|
-
] extends [never] ? OriginalDisplay :
|
|
215
|
+
] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
217
216
|
interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
|
|
218
217
|
/**
|
|
219
218
|
* The category id to show.
|
|
@@ -275,7 +274,7 @@ interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig,
|
|
|
275
274
|
*/
|
|
276
275
|
export function CategoryPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: CategoryPageConfig<[
|
|
277
276
|
OutputDisplay
|
|
278
|
-
] extends [never] ? OriginalDisplay :
|
|
277
|
+
] extends [never] ? OriginalDisplay : ModernDisplayWithPageUrl<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
279
278
|
/**
|
|
280
279
|
* BreadCrumbs is the "trail" in the header of a category page.
|
|
281
280
|
*/
|
|
@@ -511,4 +510,5 @@ export const Navigation: {
|
|
|
511
510
|
nextRouterNavigation: (router: import("next/router").NextRouter) => import("ui/components/DepictProvider").NavigateFunction;
|
|
512
511
|
};
|
|
513
512
|
export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
|
|
513
|
+
export type { PageURLCreator } from "@depict-ai/ui";
|
|
514
514
|
export type { Locale } from "@depict-ai/ui/locales";
|
package/dist/main.js
CHANGED
|
@@ -31,7 +31,7 @@ $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fb
|
|
|
31
31
|
$parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a61e5c71402559);
|
|
32
32
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
33
33
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
34
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "1.3.
|
|
34
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "1.3.4";
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -199,7 +199,8 @@ function $6319748b4f0426f0$export$6453cbc34515a94d() {
|
|
|
199
199
|
const old_scrollTo = window.scrollTo;
|
|
200
200
|
const next_router_event_target = $6319748b4f0426f0$var$make_next_router_event_target(); // So we can use once: true
|
|
201
201
|
window.scrollTo = (...args)=>{
|
|
202
|
-
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !are_on_search_or_category_page()
|
|
202
|
+
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !are_on_search_or_category_page() || history.scrollRestoration === "manual" // I.e. Chimi has manual scroll restoration that we don't want to block https://depictaiworkspace.slack.com/archives/C058KQ3MU8Z/p1686658007164019?thread_ts=1686134246.109689&cid=C058KQ3MU8Z
|
|
203
|
+
) return Reflect.apply(old_scrollTo, window, args);
|
|
203
204
|
else should_use_old_scroll = true;
|
|
204
205
|
};
|
|
205
206
|
// When popping state, add padding in the same event as the "popstate" event (required) and then remove it once our stuff is in the DOM
|
|
@@ -447,8 +448,12 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
447
448
|
get include_input_field () {
|
|
448
449
|
return props.includeInputField;
|
|
449
450
|
},
|
|
450
|
-
cols_at_size
|
|
451
|
-
|
|
451
|
+
get cols_at_size () {
|
|
452
|
+
return props.columnsAtSize ?? (0, $4GYXz$depictaiui.defaultColsAtSize);
|
|
453
|
+
},
|
|
454
|
+
get grid_spacing () {
|
|
455
|
+
return props.gridSpacing ?? (0, $4GYXz$depictaiui.defaultGridSpacing);
|
|
456
|
+
},
|
|
452
457
|
depict_search: depict_search,
|
|
453
458
|
product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
|
|
454
459
|
display: display,
|
|
@@ -508,8 +513,12 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
|
|
|
508
513
|
(0, $4GYXz$solidjs.createComputed)(()=>depict_category.listing_type = props.listingType);
|
|
509
514
|
const category = ()=>(0, $4GYXz$depictaiui.CategoryPage)({
|
|
510
515
|
depict_category: depict_category,
|
|
511
|
-
cols_at_size
|
|
512
|
-
|
|
516
|
+
get cols_at_size () {
|
|
517
|
+
return props.columnsAtSize ?? (0, $4GYXz$depictaiui.defaultColsAtSize);
|
|
518
|
+
},
|
|
519
|
+
get grid_spacing () {
|
|
520
|
+
return props.gridSpacing ?? (0, $4GYXz$depictaiui.defaultGridSpacing);
|
|
521
|
+
},
|
|
513
522
|
category_title: (0, $4GYXz$solidjs.untrack)(()=>props.categoryTitlePlugin) || (0, $4GYXz$depictaiui.defaultCategoryTitlePlugin),
|
|
514
523
|
show_breadcrumbs: (0, $4GYXz$solidjs.untrack)(()=>props.showBreadcrumbs),
|
|
515
524
|
show_quicklinks: (0, $4GYXz$solidjs.untrack)(()=>props.showQuicklinks),
|
|
@@ -635,26 +644,27 @@ function $ae73b15c325f1b21$export$912994940e660d32(params = {}) {
|
|
|
635
644
|
|
|
636
645
|
|
|
637
646
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
const $913da7f4d0bc77f2$export$9bb30bbe003b82e0 = (props = {})=>{
|
|
650
|
+
// We should just export a plain SearchField component here, not a weird hook thing, but I don't want to make a breaking change. Just fixing the re-rendering issue for now.
|
|
651
|
+
// Create signal that persists across renders
|
|
652
|
+
const [[get_aligner_signal_value, set_aligner_signal_value]] = (0, $4GYXz$react.useState)((0, $4GYXz$solidjs.createSignal)());
|
|
653
|
+
// Update signal value when alignerRef changes
|
|
654
|
+
set_aligner_signal_value(props?.alignerRef);
|
|
655
|
+
// Make sure react never re-renders the actual SearchField component
|
|
656
|
+
const componentFunction = (0, $4GYXz$react.useCallback)(()=>(0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
|
|
641
657
|
solid_component: (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)(()=>(0, $4GYXz$depictaiui.SearchField)({
|
|
642
658
|
depict_search: (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search,
|
|
643
|
-
aligner_ref
|
|
659
|
+
get aligner_ref () {
|
|
660
|
+
// React mutates the object at some random time so only get the current value once it actually is requested
|
|
661
|
+
return get_aligner_signal_value()?.current;
|
|
662
|
+
}
|
|
644
663
|
})),
|
|
645
664
|
props: {}
|
|
646
|
-
});
|
|
647
|
-
};
|
|
648
|
-
return ReactSearchField;
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
const $913da7f4d0bc77f2$export$9bb30bbe003b82e0 = (props)=>{
|
|
653
|
-
const SearchField = (0, $cd591d0e4ce29df7$export$bde46b5bb6287cea)({
|
|
654
|
-
alignerRef: props?.alignerRef
|
|
655
|
-
});
|
|
665
|
+
}), []);
|
|
656
666
|
return {
|
|
657
|
-
SearchField:
|
|
667
|
+
SearchField: componentFunction
|
|
658
668
|
};
|
|
659
669
|
};
|
|
660
670
|
|
package/dist/module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {add_to_version_info as $TZSbU$add_to_version_info, catchify as $TZSbU$catchify, queueMacroTask as $TZSbU$queueMacroTask, instant_exec_on_suspect_history_change as $TZSbU$instant_exec_on_suspect_history_change, derror as $TZSbU$derror} from "@depict-ai/utilishared";
|
|
2
2
|
import {CategoryTitle as $43099132aad1ceb6$re_export$CategoryTitle, embedded_num_products as $43099132aad1ceb6$re_export$EmbeddedNumProducts, DepictAPI as $TZSbU$DepictAPI, DepictSearch as $TZSbU$DepictSearch, DepictCategory as $TZSbU$DepictCategory, ProductCardError as $TZSbU$ProductCardError, get_search_query_updating_blocked_signal as $TZSbU$get_search_query_updating_blocked_signal, SearchPage as $TZSbU$SearchPage, defaultColsAtSize as $TZSbU$defaultColsAtSize, defaultGridSpacing as $TZSbU$defaultGridSpacing, CategoryPage as $TZSbU$CategoryPage, defaultCategoryTitlePlugin as $TZSbU$defaultCategoryTitlePlugin, BreadCrumbs as $TZSbU$BreadCrumbs, QuickLinks as $TZSbU$QuickLinks, ImagePlaceholder as $TZSbU$ImagePlaceholder, TextPlaceholder as $TZSbU$TextPlaceholder, open_modal_with_alignment as $TZSbU$open_modal_with_alignment, SearchField as $TZSbU$SearchField, fetchDepictRecommendations as $TZSbU$fetchDepictRecommendations} from "@depict-ai/ui";
|
|
3
3
|
import {createRoot as $TZSbU$createRoot, untrack as $TZSbU$untrack, createEffect as $TZSbU$createEffect, createComponent as $TZSbU$createComponent, Show as $TZSbU$Show, getOwner as $TZSbU$getOwner, runWithOwner as $TZSbU$runWithOwner, onCleanup as $TZSbU$onCleanup, createSignal as $TZSbU$createSignal, createComputed as $TZSbU$createComputed} from "solid-js";
|
|
4
|
-
import {createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, useState as $TZSbU$useState, useRef as $TZSbU$useRef, useEffect as $TZSbU$useEffect, Component as $TZSbU$Component, forwardRef as $TZSbU$forwardRef} from "react";
|
|
4
|
+
import {createElement as $TZSbU$createElement, Fragment as $TZSbU$Fragment, useState as $TZSbU$useState, useRef as $TZSbU$useRef, useEffect as $TZSbU$useEffect, Component as $TZSbU$Component, forwardRef as $TZSbU$forwardRef, useCallback as $TZSbU$useCallback} from "react";
|
|
5
5
|
import {defaultLocale as $TZSbU$defaultLocale} from "@depict-ai/ui/locales";
|
|
6
6
|
import {render as $TZSbU$render, hydrate as $TZSbU$hydrate} from "solid-js/web";
|
|
7
7
|
import {jsx as $TZSbU$jsx} from "react/jsx-runtime";
|
|
@@ -11,7 +11,7 @@ import {DPC as $TZSbU$DPC} from "@depict-ai/dpc";
|
|
|
11
11
|
|
|
12
12
|
/*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
|
|
13
13
|
// Note, if you add an export here, also add one in src-server/main.ts
|
|
14
|
-
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.3.
|
|
14
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.3.4";
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -179,7 +179,8 @@ function $8071251ee4e9ffa1$export$6453cbc34515a94d() {
|
|
|
179
179
|
const old_scrollTo = window.scrollTo;
|
|
180
180
|
const next_router_event_target = $8071251ee4e9ffa1$var$make_next_router_event_target(); // So we can use once: true
|
|
181
181
|
window.scrollTo = (...args)=>{
|
|
182
|
-
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !are_on_search_or_category_page()
|
|
182
|
+
if (should_use_old_scroll || process.env.__NEXT_SCROLL_RESTORATION || !are_on_search_or_category_page() || history.scrollRestoration === "manual" // I.e. Chimi has manual scroll restoration that we don't want to block https://depictaiworkspace.slack.com/archives/C058KQ3MU8Z/p1686658007164019?thread_ts=1686134246.109689&cid=C058KQ3MU8Z
|
|
183
|
+
) return Reflect.apply(old_scrollTo, window, args);
|
|
183
184
|
else should_use_old_scroll = true;
|
|
184
185
|
};
|
|
185
186
|
// When popping state, add padding in the same event as the "popstate" event (required) and then remove it once our stuff is in the DOM
|
|
@@ -427,8 +428,12 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
|
|
|
427
428
|
get include_input_field () {
|
|
428
429
|
return props.includeInputField;
|
|
429
430
|
},
|
|
430
|
-
cols_at_size
|
|
431
|
-
|
|
431
|
+
get cols_at_size () {
|
|
432
|
+
return props.columnsAtSize ?? (0, $TZSbU$defaultColsAtSize);
|
|
433
|
+
},
|
|
434
|
+
get grid_spacing () {
|
|
435
|
+
return props.gridSpacing ?? (0, $TZSbU$defaultGridSpacing);
|
|
436
|
+
},
|
|
432
437
|
depict_search: depict_search,
|
|
433
438
|
product_card_template: (display)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
|
|
434
439
|
display: display,
|
|
@@ -488,8 +493,12 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
|
|
|
488
493
|
(0, $TZSbU$createComputed)(()=>depict_category.listing_type = props.listingType);
|
|
489
494
|
const category = ()=>(0, $TZSbU$CategoryPage)({
|
|
490
495
|
depict_category: depict_category,
|
|
491
|
-
cols_at_size
|
|
492
|
-
|
|
496
|
+
get cols_at_size () {
|
|
497
|
+
return props.columnsAtSize ?? (0, $TZSbU$defaultColsAtSize);
|
|
498
|
+
},
|
|
499
|
+
get grid_spacing () {
|
|
500
|
+
return props.gridSpacing ?? (0, $TZSbU$defaultGridSpacing);
|
|
501
|
+
},
|
|
493
502
|
category_title: (0, $TZSbU$untrack)(()=>props.categoryTitlePlugin) || (0, $TZSbU$defaultCategoryTitlePlugin),
|
|
494
503
|
show_breadcrumbs: (0, $TZSbU$untrack)(()=>props.showBreadcrumbs),
|
|
495
504
|
show_quicklinks: (0, $TZSbU$untrack)(()=>props.showQuicklinks),
|
|
@@ -615,26 +624,27 @@ function $70344e5e0d0fea06$export$912994940e660d32(params = {}) {
|
|
|
615
624
|
|
|
616
625
|
|
|
617
626
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
const $2b886cf548a4775c$export$9bb30bbe003b82e0 = (props = {})=>{
|
|
630
|
+
// We should just export a plain SearchField component here, not a weird hook thing, but I don't want to make a breaking change. Just fixing the re-rendering issue for now.
|
|
631
|
+
// Create signal that persists across renders
|
|
632
|
+
const [[get_aligner_signal_value, set_aligner_signal_value]] = (0, $TZSbU$useState)((0, $TZSbU$createSignal)());
|
|
633
|
+
// Update signal value when alignerRef changes
|
|
634
|
+
set_aligner_signal_value(props?.alignerRef);
|
|
635
|
+
// Make sure react never re-renders the actual SearchField component
|
|
636
|
+
const componentFunction = (0, $TZSbU$useCallback)(()=>(0, $c83ba9ab79386687$export$f6e64e17bd69eeef)({
|
|
621
637
|
solid_component: (0, $c83ba9ab79386687$export$e5139bbbb9a05035)(()=>(0, $TZSbU$SearchField)({
|
|
622
638
|
depict_search: (0, $42858f023ef23dab$export$8e769ad4338a911e).search,
|
|
623
|
-
aligner_ref
|
|
639
|
+
get aligner_ref () {
|
|
640
|
+
// React mutates the object at some random time so only get the current value once it actually is requested
|
|
641
|
+
return get_aligner_signal_value()?.current;
|
|
642
|
+
}
|
|
624
643
|
})),
|
|
625
644
|
props: {}
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
return ReactSearchField;
|
|
629
|
-
};
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
const $2b886cf548a4775c$export$9bb30bbe003b82e0 = (props)=>{
|
|
633
|
-
const SearchField = (0, $cdd7408b22d1586a$export$bde46b5bb6287cea)({
|
|
634
|
-
alignerRef: props?.alignerRef
|
|
635
|
-
});
|
|
645
|
+
}), []);
|
|
636
646
|
return {
|
|
637
|
-
SearchField:
|
|
647
|
+
SearchField: componentFunction
|
|
638
648
|
};
|
|
639
649
|
};
|
|
640
650
|
|
package/dist-server/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ interface UseFetchRecommendationsReturn<T extends Display> {
|
|
|
33
33
|
*/
|
|
34
34
|
fetchRecommendations: (opts: FetchRecsOptions) => Promise<T[]>;
|
|
35
35
|
}
|
|
36
|
-
export const version = "1.3.
|
|
36
|
+
export const version = "1.3.4";
|
|
37
37
|
export function DepictProvider(props: any): any;
|
|
38
38
|
export function SearchPage(): any;
|
|
39
39
|
export function CategoryPage(): any;
|
package/dist-server/main.js
CHANGED
|
@@ -40,7 +40,7 @@ function $35dfe83eec81954c$export$4b564d7f5a1b1d43({ solid_component: solid_comp
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "1.3.
|
|
43
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "1.3.4";
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
|
package/dist-server/module.js
CHANGED
|
@@ -22,7 +22,7 @@ function $4568c09979447ab1$export$4b564d7f5a1b1d43({ solid_component: solid_comp
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.3.
|
|
25
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.3.4";
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/react-ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"packageManager": "yarn@3.2.2",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -97,10 +97,10 @@
|
|
|
97
97
|
"README.md"
|
|
98
98
|
],
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@depict-ai/dpc": "^1.0.
|
|
101
|
-
"@depict-ai/plp-styling": "^1.0.
|
|
102
|
-
"@depict-ai/ui": "^1.3.
|
|
103
|
-
"@depict-ai/utilishared": "^1.0.
|
|
100
|
+
"@depict-ai/dpc": "^1.0.28",
|
|
101
|
+
"@depict-ai/plp-styling": "^1.0.27",
|
|
102
|
+
"@depict-ai/ui": "^1.3.3",
|
|
103
|
+
"@depict-ai/utilishared": "^1.0.26",
|
|
104
104
|
"solid-js": "^1.7.3"
|
|
105
105
|
},
|
|
106
106
|
"peerDependencies": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@babel/preset-typescript": "latest",
|
|
115
115
|
"@babel/runtime": "latest",
|
|
116
116
|
"@babel/runtime-corejs3": "latest",
|
|
117
|
-
"@depict-ai/plp-styling": "^1.0.
|
|
117
|
+
"@depict-ai/plp-styling": "^1.0.27",
|
|
118
118
|
"@jest/globals": "^29.3.1",
|
|
119
119
|
"@parcel/babel-preset-env": "latest",
|
|
120
120
|
"@parcel/resolver-default": "^2.8.0",
|