@depict-ai/react-ui 1.1.3 → 1.2.0

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,10 @@
1
- import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig, BaseSearchPageConfig, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui";
2
- import { Display } from "@depict-ai/utilishared";
1
+ import { BaseProductListingConfig, BaseProviderConfig, BaseSearchProviderConfig, BaseSearchPageConfig, ModernDisplayWithPageUrl as _ModernDisplayWithPageUrl1, BaseCategoryPageConfig, CategoryTitle, embedded_num_products, ImagePlaceholder as _ImagePlaceholder1, TextPlaceholder as _TextPlaceholder1, ExclusiveId, fetchDepictRecommendations } from "@depict-ai/ui";
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
- export const version = "1.1.3";
6
+ import { ModernDisplayWithPageUrl } from "@depict-ai/ui/src";
7
+ export const version = "1.2.0";
7
8
  interface PLPConfig<T extends Display> extends BaseProductListingConfig {
8
9
  /**
9
10
  * The product card to use for rendering products.
@@ -58,7 +59,7 @@ type NavigateFunction = (relativeUrl: string, options: {
58
59
  /**
59
60
  * The config for the DepictProvider.
60
61
  */
61
- type ProviderConfig = BaseProviderConfig & {
62
+ type ProviderConfig<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never> = BaseProviderConfig<OriginalDisplay, OutputDisplay> & {
62
63
  /**
63
64
  * The function to use for navigating to a new page.
64
65
  * This function will be used internally by our components to navigate.
@@ -138,7 +139,7 @@ type ProviderConfig = BaseProviderConfig & {
138
139
  * ```
139
140
  * @returns {JSX.Element} The DepictProvider.
140
141
  */
141
- export function DepictProvider(props: PropsWithChildren<ProviderConfig>): import("react").FunctionComponentElement<{
142
+ export function DepictProvider<InputDisplay extends Display, OutputDisplay extends ModernDisplay | never = InputDisplay extends ModernDisplay ? ModernDisplayWithPageUrl<InputDisplay> : never>(props: PropsWithChildren<ProviderConfig<InputDisplay, OutputDisplay>>): import("react").FunctionComponentElement<{
142
143
  children?: import("react").ReactNode;
143
144
  }>;
144
145
  /**
@@ -210,7 +211,9 @@ interface SearchPageConfig<T extends Display> extends BaseSearchPageConfig, PLPC
210
211
  *
211
212
  * ```
212
213
  */
213
- export function SearchPage<T extends Display>(props: SearchPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
214
+ export function SearchPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: SearchPageConfig<[
215
+ OutputDisplay
216
+ ] extends [never] ? OriginalDisplay : _ModernDisplayWithPageUrl1<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
214
217
  interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig, PLPConfig<T> {
215
218
  /**
216
219
  * The category id to show.
@@ -270,7 +273,9 @@ interface CategoryPageConfig<T extends Display> extends BaseCategoryPageConfig,
270
273
  * }
271
274
  * ```
272
275
  */
273
- export function CategoryPage<T extends Display>(props: CategoryPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
276
+ export function CategoryPage<OriginalDisplay extends Display, OutputDisplay extends ModernDisplay | never>(props: CategoryPageConfig<[
277
+ OutputDisplay
278
+ ] extends [never] ? OriginalDisplay : _ModernDisplayWithPageUrl1<OutputDisplay>>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
274
279
  /**
275
280
  * BreadCrumbs is the "trail" in the header of a category page.
276
281
  */
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.1.3";
34
+ const $db7b67857900028b$export$83d89fbfd8236492 = "1.2.0";
35
35
 
36
36
 
37
37
 
@@ -347,6 +347,7 @@ function $24b00503eef73528$export$9fac37a9c21c2f3b(props) {
347
347
  get_user_id: ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).userId,
348
348
  get_session_id: ()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).sessionId
349
349
  });
350
+ (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).api.page_url_creator = props.pageURLCreator;
350
351
  if (searchPagePath) {
351
352
  set_search_page_path($24b00503eef73528$var$ensure_correct_formatting(searchPagePath));
352
353
  if (!search) (0, $4GYXz$solidjs.createRoot)(()=>(0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).search = new (0, $4GYXz$depictaiui.DepictSearch)({
@@ -584,15 +585,16 @@ const $7c8b440edc188ad5$export$89c6019e4baa40b1 = (raw_react_props)=>{
584
585
  const $177ac8f5258066ba$export$d69d8daa20eae175 = (createOpenModalParams)=>{
585
586
  const { globalState: globalState , location: location = "centered" , alignerRef: alignerRef } = createOpenModalParams;
586
587
  const openModal = ()=>{
587
- if (globalState.search) {
588
+ const { search: search } = globalState;
589
+ if (search) {
588
590
  if (location === "aligned" && alignerRef?.current) (0, $4GYXz$depictaiui.open_modal_with_alignment)({
589
591
  "element": alignerRef.current,
590
592
  "location": location,
591
- "search": globalState.search
593
+ "search": search
592
594
  });
593
595
  else (0, $4GYXz$depictaiui.open_modal_with_alignment)({
594
596
  "location": "centered",
595
- "search": globalState.search
597
+ "search": search
596
598
  });
597
599
  } else throw new Error("Depict search is not configured. Add to your DepictProvider.");
598
600
  };
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.1.3";
14
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.2.0";
15
15
 
16
16
 
17
17
 
@@ -327,6 +327,7 @@ function $5376eb2a386cd90d$export$9fac37a9c21c2f3b(props) {
327
327
  get_user_id: ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).userId,
328
328
  get_session_id: ()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).sessionId
329
329
  });
330
+ (0, $42858f023ef23dab$export$8e769ad4338a911e).api.page_url_creator = props.pageURLCreator;
330
331
  if (searchPagePath) {
331
332
  set_search_page_path($5376eb2a386cd90d$var$ensure_correct_formatting(searchPagePath));
332
333
  if (!search) (0, $TZSbU$createRoot)(()=>(0, $42858f023ef23dab$export$8e769ad4338a911e).search = new (0, $TZSbU$DepictSearch)({
@@ -564,15 +565,16 @@ const $cbd250061abf11cb$export$89c6019e4baa40b1 = (raw_react_props)=>{
564
565
  const $41cab674edff4277$export$d69d8daa20eae175 = (createOpenModalParams)=>{
565
566
  const { globalState: globalState , location: location = "centered" , alignerRef: alignerRef } = createOpenModalParams;
566
567
  const openModal = ()=>{
567
- if (globalState.search) {
568
+ const { search: search } = globalState;
569
+ if (search) {
568
570
  if (location === "aligned" && alignerRef?.current) (0, $TZSbU$open_modal_with_alignment)({
569
571
  "element": alignerRef.current,
570
572
  "location": location,
571
- "search": globalState.search
573
+ "search": search
572
574
  });
573
575
  else (0, $TZSbU$open_modal_with_alignment)({
574
576
  "location": "centered",
575
- "search": globalState.search
577
+ "search": search
576
578
  });
577
579
  } else throw new Error("Depict search is not configured. Add to your DepictProvider.");
578
580
  };
@@ -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.1.3";
36
+ export const version = "1.2.0";
37
37
  export function DepictProvider(props: any): any;
38
38
  export function SearchPage(): any;
39
39
  export function CategoryPage(): any;
@@ -40,7 +40,7 @@ function $35dfe83eec81954c$export$4b564d7f5a1b1d43({ solid_component: solid_comp
40
40
  }
41
41
 
42
42
 
43
- const $db7b67857900028b$export$83d89fbfd8236492 = "1.1.3";
43
+ const $db7b67857900028b$export$83d89fbfd8236492 = "1.2.0";
44
44
 
45
45
 
46
46
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
@@ -22,7 +22,7 @@ function $4568c09979447ab1$export$4b564d7f5a1b1d43({ solid_component: solid_comp
22
22
  }
23
23
 
24
24
 
25
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.1.3";
25
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.2.0";
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.1.3",
3
+ "version": "1.2.0",
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.21",
101
- "@depict-ai/plp-styling": "^1.0.22",
102
- "@depict-ai/ui": "^1.1.5",
103
- "@depict-ai/utilishared": "^1.0.21",
100
+ "@depict-ai/dpc": "^1.0.22",
101
+ "@depict-ai/plp-styling": "^1.0.23",
102
+ "@depict-ai/ui": "^1.2.0",
103
+ "@depict-ai/utilishared": "^1.0.22",
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.22",
117
+ "@depict-ai/plp-styling": "^1.0.23",
118
118
  "@jest/globals": "^29.3.1",
119
119
  "@parcel/babel-preset-env": "latest",
120
120
  "@parcel/resolver-default": "^2.8.0",