@depict-ai/react-ui 1.0.15 → 1.0.17

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 CHANGED
@@ -1,9 +1,9 @@
1
- import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, fetchDepictRecommendations, ExclusiveId } from "@depict-ai/ui";
1
+ import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui";
2
2
  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.15";
6
+ export const version = "1.0.17";
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
  */
@@ -498,7 +499,7 @@ export function useFetchRecommendations<T extends Display>(): UseFetchRecommenda
498
499
  * Helper function to navigate to a new page depending on the navigation library used.
499
500
  */
500
501
  export const Navigation: {
501
- nextRouterNavigation: (router: import("next/router").NextRouter) => (relativeUrl: string) => void;
502
+ nextRouterNavigation: (router: import("next/router").NextRouter) => import("ui/components/DepictProvider").NavigateFunction;
502
503
  };
503
504
  export { CategoryTitle, embedded_num_products as EmbeddedNumProducts } from "@depict-ai/ui";
504
505
  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.15";
34
+ const $db7b67857900028b$export$83d89fbfd8236492 = "1.0.17";
35
35
 
36
36
 
37
37
 
@@ -271,7 +271,7 @@ function $6319748b4f0426f0$var$make_next_router_event_target() {
271
271
 
272
272
 
273
273
 
274
- const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
274
+ const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace, scroll)=>{
275
275
  let Page;
276
276
  (function(Page) {
277
277
  Page[Page["OTHER"] = 0] = "OTHER";
@@ -283,7 +283,7 @@ const $bc389476eeb2b615$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
283
283
  const target_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
284
284
  window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
285
285
  shallow: current_page === target_page,
286
- scroll: true
286
+ scroll: scroll
287
287
  });
288
288
  };
289
289
 
@@ -334,12 +334,13 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
334
334
  try {
335
335
  const { search: search , category: category , api: api , search_page_path_: [get_search_page_path, set_search_page_path] } = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e);
336
336
  if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
337
- const on_navigation = ({ is_replace: is_replace , new_url: new_url })=>{
337
+ const on_navigation = ({ is_replace: is_replace , new_url: new_url , scroll: scroll })=>{
338
338
  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
339
339
  if (navigateFunction) navigateFunction(new_relative_url, {
340
- replace: is_replace
340
+ replace: is_replace,
341
+ scroll: scroll
341
342
  });
342
- else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_relative_url, is_replace);
343
+ else (0, $bc389476eeb2b615$export$599d4515591ef232)(new_relative_url, is_replace, scroll);
343
344
  };
344
345
  if (!api) (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api = new (0, $4GYXz$depictaiui.DepictAPI)({
345
346
  get_metadata: async ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).metaData,
@@ -410,7 +411,6 @@ const $883a881f7926405d$export$80e99ee6b29cadd2 = /*#__PURE__*/ (0, $4GYXz$react
410
411
 
411
412
 
412
413
 
413
-
414
414
  function $7ad7a3d0011b7b1b$export$a54ec244c8863715(props) {
415
415
  return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)({
416
416
  solid_component: (0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($7ad7a3d0011b7b1b$var$SolidSearchPage),
@@ -439,7 +439,9 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
439
439
  const component_portals = new Set();
440
440
  return (0, $4GYXz$depictaiui.SearchPage)({
441
441
  // Default config goes here
442
- include_input_field: (0, $4GYXz$solidjs.untrack)(()=>props.includeInputField) ?? true,
442
+ get include_input_field () {
443
+ return props.includeInputField;
444
+ },
443
445
  cols_at_size: (0, $4GYXz$solidjs.untrack)(()=>props.columnsAtSize) ?? (0, $4GYXz$depictaiui.defaultColsAtSize),
444
446
  grid_spacing: (0, $4GYXz$solidjs.untrack)(()=>props.gridSpacing) ?? (0, $4GYXz$depictaiui.defaultGridSpacing),
445
447
  depict_search: depict_search,
@@ -660,7 +662,7 @@ function $a134ea100690b628$var$fetchRecommendations(opts) {
660
662
 
661
663
 
662
664
 
663
- const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
665
+ const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl, { scroll: scroll , replace: replace })=>{
664
666
  let Page;
665
667
  (function(Page) {
666
668
  Page[Page["OTHER"] = 0] = "OTHER";
@@ -670,9 +672,9 @@ const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
670
672
  const current_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
671
673
  const target_u_o = new URL(relativeUrl, location.origin);
672
674
  const target_page = (0, $b4d0d98857ed9934$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $b4d0d98857ed9934$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
673
- router.push(relativeUrl, undefined, {
675
+ router[replace ? "replace" : "push"](relativeUrl, undefined, {
674
676
  shallow: current_page === target_page,
675
- scroll: true
677
+ scroll: scroll
676
678
  });
677
679
  };
678
680
 
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.15";
14
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.0.17";
15
15
 
16
16
 
17
17
 
@@ -251,7 +251,7 @@ function $8071251ee4e9ffa1$var$make_next_router_event_target() {
251
251
 
252
252
 
253
253
 
254
- const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
254
+ const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace, scroll)=>{
255
255
  let Page;
256
256
  (function(Page) {
257
257
  Page[Page["OTHER"] = 0] = "OTHER";
@@ -263,7 +263,7 @@ const $7216ca4c8308a0f9$export$599d4515591ef232 = (relativeUrl, isReplace)=>{
263
263
  const target_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
264
264
  window.next.router[isReplace ? "replace" : "push"](relativeUrl, undefined, {
265
265
  shallow: current_page === target_page,
266
- scroll: true
266
+ scroll: scroll
267
267
  });
268
268
  };
269
269
 
@@ -314,12 +314,13 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
314
314
  try {
315
315
  const { search: search , category: category , api: api , search_page_path_: [get_search_page_path, set_search_page_path] } = (0, $42858f023ef23dab$export$8e769ad4338a911e);
316
316
  if (typeof window?.next?.router === "undefined" && !navigateFunction) throw new Error("You must provide a navigateFunction when not using Next.js.");
317
- const on_navigation = ({ is_replace: is_replace , new_url: new_url })=>{
317
+ const on_navigation = ({ is_replace: is_replace , new_url: new_url , scroll: scroll })=>{
318
318
  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
319
319
  if (navigateFunction) navigateFunction(new_relative_url, {
320
- replace: is_replace
320
+ replace: is_replace,
321
+ scroll: scroll
321
322
  });
322
- else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_relative_url, is_replace);
323
+ else (0, $7216ca4c8308a0f9$export$599d4515591ef232)(new_relative_url, is_replace, scroll);
323
324
  };
324
325
  if (!api) (0, $42858f023ef23dab$export$8e769ad4338a911e).api = new (0, $TZSbU$DepictAPI)({
325
326
  get_metadata: async ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).metaData,
@@ -390,7 +391,6 @@ const $421f32789b6f111f$export$80e99ee6b29cadd2 = /*#__PURE__*/ (0, $TZSbU$forwa
390
391
 
391
392
 
392
393
 
393
-
394
394
  function $4a678f0c87b12e78$export$a54ec244c8863715(props) {
395
395
  return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)({
396
396
  solid_component: (0, $c83ba9ab79386687$export$e5139bbbb9a05035)($4a678f0c87b12e78$var$SolidSearchPage),
@@ -419,7 +419,9 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
419
419
  const component_portals = new Set();
420
420
  return (0, $TZSbU$SearchPage)({
421
421
  // Default config goes here
422
- include_input_field: (0, $TZSbU$untrack)(()=>props.includeInputField) ?? true,
422
+ get include_input_field () {
423
+ return props.includeInputField;
424
+ },
423
425
  cols_at_size: (0, $TZSbU$untrack)(()=>props.columnsAtSize) ?? (0, $TZSbU$defaultColsAtSize),
424
426
  grid_spacing: (0, $TZSbU$untrack)(()=>props.gridSpacing) ?? (0, $TZSbU$defaultGridSpacing),
425
427
  depict_search: depict_search,
@@ -640,7 +642,7 @@ function $1bb4271dc44722e2$var$fetchRecommendations(opts) {
640
642
 
641
643
 
642
644
 
643
- const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
645
+ const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(relativeUrl, { scroll: scroll , replace: replace })=>{
644
646
  let Page;
645
647
  (function(Page) {
646
648
  Page[Page["OTHER"] = 0] = "OTHER";
@@ -650,9 +652,9 @@ const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(relativeUrl)=>{
650
652
  const current_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)() ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)() ? Page.CATEGORY : Page.OTHER;
651
653
  const target_u_o = new URL(relativeUrl, location.origin);
652
654
  const target_page = (0, $c83ba9ab79386687$export$775e6b3892b5ad52)(target_u_o) ? Page.SEARCH : (0, $c83ba9ab79386687$export$30c8a12df09be0e4)(target_u_o) ? Page.CATEGORY : Page.OTHER;
653
- router.push(relativeUrl, undefined, {
655
+ router[replace ? "replace" : "push"](relativeUrl, undefined, {
654
656
  shallow: current_page === target_page,
655
- scroll: true
657
+ scroll: scroll
656
658
  });
657
659
  };
658
660
 
@@ -1,6 +1,6 @@
1
1
  import { ReactElement } from "react";
2
2
  import { DPC } from "@depict-ai/dpc";
3
- import { fetchDepictRecommendations, ExclusiveId, TextPlaceholder as _TextPlaceholder1, ImagePlaceholder as _ImagePlaceholder1 } from "@depict-ai/ui";
3
+ import { ExclusiveId, fetchDepictRecommendations, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1 } from "@depict-ai/ui";
4
4
  import { Display } from "@depict-ai/utilishared";
5
5
  type OpenModal = () => void;
6
6
  interface UseSearchModalReturn {
@@ -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.15";
36
+ export const version = "1.0.17";
37
37
  export function DepictProvider(props: any): any;
38
38
  export function SearchPage(): any;
39
39
  export function CategoryPage(): any;
@@ -40,8 +40,7 @@ function $35dfe83eec81954c$export$4b564d7f5a1b1d43({ solid_component: solid_comp
40
40
  }
41
41
 
42
42
 
43
-
44
- const $db7b67857900028b$export$83d89fbfd8236492 = "1.0.15";
43
+ const $db7b67857900028b$export$83d89fbfd8236492 = "1.0.17";
45
44
 
46
45
 
47
46
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
@@ -22,8 +22,7 @@ function $4568c09979447ab1$export$4b564d7f5a1b1d43({ solid_component: solid_comp
22
22
  }
23
23
 
24
24
 
25
-
26
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.0.15";
25
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.0.17";
27
26
 
28
27
 
29
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.0.15",
3
+ "version": "1.0.17",
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.15",
101
- "@depict-ai/plp-styling": "^1.0.16",
102
- "@depict-ai/ui": "^1.0.18",
103
- "@depict-ai/utilishared": "^1.0.15",
100
+ "@depict-ai/dpc": "^1.0.17",
101
+ "@depict-ai/plp-styling": "^1.0.18",
102
+ "@depict-ai/ui": "^1.1.1",
103
+ "@depict-ai/utilishared": "^1.0.17",
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.16",
117
+ "@depict-ai/plp-styling": "^1.0.18",
118
118
  "@jest/globals": "^29.3.1",
119
119
  "@parcel/babel-preset-env": "latest",
120
120
  "@parcel/resolver-default": "^2.8.0",