@depict-ai/react-ui 1.0.14 → 1.0.16
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 -4
- package/dist/main.js +13 -10
- package/dist/module.js +13 -10
- 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
|
@@ -3,7 +3,7 @@ import { Display } 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
|
-
export const version = "1.0.
|
|
6
|
+
export const version = "1.0.16";
|
|
7
7
|
interface PLPConfig<T extends Display> extends BaseProductListingConfig {
|
|
8
8
|
/**
|
|
9
9
|
* The product card to use for rendering products.
|
|
@@ -53,6 +53,7 @@ export const usePerformanceClient: () => UsePerformanceClientReturn;
|
|
|
53
53
|
*/
|
|
54
54
|
type NavigateFunction = (relativeUrl: string, options: {
|
|
55
55
|
replace: boolean;
|
|
56
|
+
scroll: boolean;
|
|
56
57
|
}) => void;
|
|
57
58
|
/**
|
|
58
59
|
* The config for the DepictProvider.
|
|
@@ -92,8 +93,8 @@ type ProviderConfig = BaseProviderConfig & {
|
|
|
92
93
|
* @example
|
|
93
94
|
* If you're using another library, you can define your own navigate function, that's compatible with the `NavigateFunction` type.
|
|
94
95
|
* ```tsx
|
|
95
|
-
* const navigateFunction = (relativeUrl: string) => {
|
|
96
|
-
* router.push(relativeUrl);
|
|
96
|
+
* const navigateFunction = (relativeUrl: string, { replace }) => {
|
|
97
|
+
* router.push(relativeUrl, { replace });
|
|
97
98
|
* };
|
|
98
99
|
* ```
|
|
99
100
|
*/
|
|
@@ -483,7 +484,7 @@ export function useFetchRecommendations<T extends Display>(): UseFetchRecommenda
|
|
|
483
484
|
* Helper function to navigate to a new page depending on the navigation library used.
|
|
484
485
|
*/
|
|
485
486
|
export const Navigation: {
|
|
486
|
-
nextRouterNavigation: (router: import("next/router").NextRouter) => (
|
|
487
|
+
nextRouterNavigation: (router: import("next/router").NextRouter) => import("ui/components/DepictProvider").NavigateFunction;
|
|
487
488
|
};
|
|
488
489
|
export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
|
|
489
490
|
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.0.
|
|
34
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "1.0.16";
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
@@ -261,7 +261,7 @@ function $6319748b4f0426f0$var$make_next_router_event_target() {
|
|
|
261
261
|
|
|
262
262
|
|
|
263
263
|
|
|
264
|
-
const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
|
|
264
|
+
const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace, scroll)=>{
|
|
265
265
|
let Page;
|
|
266
266
|
(function(Page) {
|
|
267
267
|
Page[Page["OTHER"] = 0] = "OTHER";
|
|
@@ -273,7 +273,7 @@ const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
|
|
|
273
273
|
const target_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
274
274
|
window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
|
|
275
275
|
shallow: current_page === target_page,
|
|
276
|
-
scroll:
|
|
276
|
+
scroll: scroll
|
|
277
277
|
});
|
|
278
278
|
};
|
|
279
279
|
|
|
@@ -324,12 +324,13 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
|
|
|
324
324
|
try {
|
|
325
325
|
const { search: search , category: category , api: api , search_page_path_: [get_search_page_path, set_search_page_path] } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
|
|
326
326
|
if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
|
|
327
|
-
const on_navigation = ({ is_replace: is_replace , new_url: new_url })=>{
|
|
327
|
+
const on_navigation = ({ is_replace: is_replace , new_url: new_url , scroll: scroll })=>{
|
|
328
328
|
const new_relative_url = new_url.origin === location.origin ? new_url.pathname + new_url.search + new_url.hash : new_url.href; // bail out of making URL relative if it's not possible
|
|
329
329
|
if (navigateFunction) navigateFunction(new_relative_url, {
|
|
330
|
-
replace: is_replace
|
|
330
|
+
replace: is_replace,
|
|
331
|
+
scroll: scroll
|
|
331
332
|
});
|
|
332
|
-
else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_relative_url, is_replace);
|
|
333
|
+
else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_relative_url, is_replace, scroll);
|
|
333
334
|
};
|
|
334
335
|
if (!api) (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api = new (0, $4GYXz$depictaiui.DepictAPI)({
|
|
335
336
|
get_metadata: async ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData,
|
|
@@ -426,7 +427,9 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
|
|
|
426
427
|
const component_portals = new Set();
|
|
427
428
|
return (0, $4GYXz$depictaiui.SearchPage)({
|
|
428
429
|
// Default config goes here
|
|
429
|
-
include_input_field
|
|
430
|
+
get include_input_field () {
|
|
431
|
+
return props.includeInputField;
|
|
432
|
+
},
|
|
430
433
|
cols_at_size: (0, $4GYXz$solidjs.untrack)(()=>props.columnsAtSize) ?? (0, $4GYXz$depictaiui.defaultColsAtSize),
|
|
431
434
|
grid_spacing: (0, $4GYXz$solidjs.untrack)(()=>props.gridSpacing) ?? (0, $4GYXz$depictaiui.defaultGridSpacing),
|
|
432
435
|
depict_search: depict_search,
|
|
@@ -620,7 +623,7 @@ function $a134ea100690b628$var$fetchRecommendations(opts) {
|
|
|
620
623
|
|
|
621
624
|
|
|
622
625
|
|
|
623
|
-
const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
|
|
626
|
+
const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl, { scroll: scroll , replace: replace })=>{
|
|
624
627
|
let Page;
|
|
625
628
|
(function(Page) {
|
|
626
629
|
Page[Page["OTHER"] = 0] = "OTHER";
|
|
@@ -630,9 +633,9 @@ const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
|
|
|
630
633
|
const current_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
|
|
631
634
|
const target_u_o = new URL(relativeUrl, location.origin);
|
|
632
635
|
const target_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
633
|
-
router
|
|
636
|
+
router[replace ? "replace" : "push"](relativeUrl, undefined, {
|
|
634
637
|
shallow: current_page === target_page,
|
|
635
|
-
scroll:
|
|
638
|
+
scroll: scroll
|
|
636
639
|
});
|
|
637
640
|
};
|
|
638
641
|
|
package/dist/module.js
CHANGED
|
@@ -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.0.
|
|
14
|
+
const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.0.16";
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -241,7 +241,7 @@ function $8071251ee4e9ffa1$var$make_next_router_event_target() {
|
|
|
241
241
|
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
|
|
244
|
+
const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace, scroll)=>{
|
|
245
245
|
let Page;
|
|
246
246
|
(function(Page) {
|
|
247
247
|
Page[Page["OTHER"] = 0] = "OTHER";
|
|
@@ -253,7 +253,7 @@ const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
|
|
|
253
253
|
const target_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
254
254
|
window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
|
|
255
255
|
shallow: current_page === target_page,
|
|
256
|
-
scroll:
|
|
256
|
+
scroll: scroll
|
|
257
257
|
});
|
|
258
258
|
};
|
|
259
259
|
|
|
@@ -304,12 +304,13 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
|
|
|
304
304
|
try {
|
|
305
305
|
const { search: search , category: category , api: api , search_page_path_: [get_search_page_path, set_search_page_path] } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
|
|
306
306
|
if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
|
|
307
|
-
const on_navigation = ({ is_replace: is_replace , new_url: new_url })=>{
|
|
307
|
+
const on_navigation = ({ is_replace: is_replace , new_url: new_url , scroll: scroll })=>{
|
|
308
308
|
const new_relative_url = new_url.origin === location.origin ? new_url.pathname + new_url.search + new_url.hash : new_url.href; // bail out of making URL relative if it's not possible
|
|
309
309
|
if (navigateFunction) navigateFunction(new_relative_url, {
|
|
310
|
-
replace: is_replace
|
|
310
|
+
replace: is_replace,
|
|
311
|
+
scroll: scroll
|
|
311
312
|
});
|
|
312
|
-
else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_relative_url, is_replace);
|
|
313
|
+
else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_relative_url, is_replace, scroll);
|
|
313
314
|
};
|
|
314
315
|
if (!api) (0, $42858f023ef23dab$export$8e769ad4338a911e).api = new (0, $TZSbU$DepictAPI)({
|
|
315
316
|
get_metadata: async ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).metaData,
|
|
@@ -406,7 +407,9 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
|
|
|
406
407
|
const component_portals = new Set();
|
|
407
408
|
return (0, $TZSbU$SearchPage)({
|
|
408
409
|
// Default config goes here
|
|
409
|
-
include_input_field
|
|
410
|
+
get include_input_field () {
|
|
411
|
+
return props.includeInputField;
|
|
412
|
+
},
|
|
410
413
|
cols_at_size: (0, $TZSbU$untrack)(()=>props.columnsAtSize) ?? (0, $TZSbU$defaultColsAtSize),
|
|
411
414
|
grid_spacing: (0, $TZSbU$untrack)(()=>props.gridSpacing) ?? (0, $TZSbU$defaultGridSpacing),
|
|
412
415
|
depict_search: depict_search,
|
|
@@ -600,7 +603,7 @@ function $1bb4271dc44722e2$var$fetchRecommendations(opts) {
|
|
|
600
603
|
|
|
601
604
|
|
|
602
605
|
|
|
603
|
-
const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
|
|
606
|
+
const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(relativeUrl, { scroll: scroll , replace: replace })=>{
|
|
604
607
|
let Page;
|
|
605
608
|
(function(Page) {
|
|
606
609
|
Page[Page["OTHER"] = 0] = "OTHER";
|
|
@@ -610,9 +613,9 @@ const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
|
|
|
610
613
|
const current_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
|
|
611
614
|
const target_u_o = new URL(relativeUrl, location.origin);
|
|
612
615
|
const target_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
|
|
613
|
-
router
|
|
616
|
+
router[replace ? "replace" : "push"](relativeUrl, undefined, {
|
|
614
617
|
shallow: current_page === target_page,
|
|
615
|
-
scroll:
|
|
618
|
+
scroll: scroll
|
|
616
619
|
});
|
|
617
620
|
};
|
|
618
621
|
|
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.0.
|
|
36
|
+
export const version = "1.0.16";
|
|
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
|
@@ -21,7 +21,7 @@ $parcel$export(module.exports, "useFetchRecommendations", () => $41e7e5d85b5e0d4
|
|
|
21
21
|
$parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
const $db7b67857900028b$export$83d89fbfd8236492 = "1.0.
|
|
24
|
+
const $db7b67857900028b$export$83d89fbfd8236492 = "1.0.16";
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
|
package/dist-server/module.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depict-ai/react-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
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.0
|
|
103
|
-
"@depict-ai/utilishared": "^1.0.
|
|
100
|
+
"@depict-ai/dpc": "^1.0.16",
|
|
101
|
+
"@depict-ai/plp-styling": "^1.0.17",
|
|
102
|
+
"@depict-ai/ui": "^1.1.0",
|
|
103
|
+
"@depict-ai/utilishared": "^1.0.16",
|
|
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.17",
|
|
118
118
|
"@jest/globals": "^29.3.1",
|
|
119
119
|
"@parcel/babel-preset-env": "latest",
|
|
120
120
|
"@parcel/resolver-default": "^2.8.0",
|