@depict-ai/react-ui 0.0.65 → 0.0.67

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
1
  import { SDKColsAtSize, SDKGridSpacing } from "@depict-ai/ui/dist";
2
- import { Display } from "../../../lib/displays/Display";
2
+ import { Display } from "@depict-ai/utilishared";
3
3
  import React, { ReactNode, PropsWithChildren, ReactElement } from "react";
4
4
  import { Locale } from "@depict-ai/ui/locales";
5
- import { Display as _Display1 } from "@depict-ai/utilishared";
6
- import { CategoryPage } from "@depict-ai/ui";
5
+ import { CategoryTitle, embedded_num_products } from "@depict-ai/ui";
6
+ export const version = "0.0.67";
7
7
  interface PLPConfig<T extends Display> {
8
8
  /**
9
9
  * The product card to use for rendering products.
@@ -170,7 +170,7 @@ export function DepictProvider(props: PropsWithChildren<DepictConfig>): import("
170
170
  * @returns {JSX.Element}
171
171
  */
172
172
  export const DepictAligner: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
173
- interface SearchPageConfig<T extends _Display1> extends PLPConfig<T> {
173
+ interface SearchPageConfig<T extends Display> extends PLPConfig<T> {
174
174
  /**
175
175
  * Whether to show the search input field in the search page.
176
176
  * @default true
@@ -217,8 +217,8 @@ interface SearchPageConfig<T extends _Display1> extends PLPConfig<T> {
217
217
  *
218
218
  * ```
219
219
  */
220
- export function DepictSearchPage<T extends _Display1>(props: SearchPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
221
- interface CategoryPageConfig<T extends _Display1> extends PLPConfig<T> {
220
+ export function DepictSearchPage<T extends Display>(props: SearchPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
221
+ interface CategoryPageConfig<T extends Display> extends PLPConfig<T> {
222
222
  /**
223
223
  * The category id to show.
224
224
  */
@@ -242,7 +242,7 @@ interface CategoryPageConfig<T extends _Display1> extends PLPConfig<T> {
242
242
  * <DepictCategoryPage categoryId="jeans" productCard={MyCustomCategoryProductCard} categoryTitlePlugin={CategoryTitle} />
243
243
  * ```
244
244
  */
245
- categoryTitlePlugin?: Parameters<typeof CategoryPage>[0]["category_title"];
245
+ categoryTitlePlugin?: typeof CategoryTitle | typeof embedded_num_products;
246
246
  }
247
247
  /**
248
248
  * DepictCategoryPage is a component that renders a category page.
@@ -283,7 +283,7 @@ interface CategoryPageConfig<T extends _Display1> extends PLPConfig<T> {
283
283
  * }
284
284
  * ```
285
285
  */
286
- export function DepictCategoryPage<T extends _Display1>(props: CategoryPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
286
+ export function DepictCategoryPage<T extends Display>(props: CategoryPageConfig<T>): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
287
287
  /**
288
288
  * BreadCrumbs is the "trail" in the header of a category page.
289
289
  */
@@ -346,7 +346,7 @@ interface UseSearchModalParams {
346
346
 
347
347
  const { open } = useDepictSearchModal({
348
348
  location: "aligned",
349
- headerAlignerRef: ref,
349
+ alignerRef: ref,
350
350
  });
351
351
 
352
352
  return (
@@ -417,7 +417,7 @@ interface UseDepictSearchFieldReturn {
417
417
  * import { useDepictSearchField } from "@depict-ai/react-ui";
418
418
  *
419
419
  * const App = () => {
420
- * const { DepictSearchField } = useDepictSearchModal();
420
+ * const { DepictSearchField } = useDepictSearchField();
421
421
  *
422
422
  * return (
423
423
  * <div>
@@ -430,17 +430,17 @@ interface UseDepictSearchFieldReturn {
430
430
  * Render a search field that opens a modal aligned another DOM element:
431
431
  * ```tsx
432
432
  * import React from "react";
433
- * import { useDepictSearchField } from "@depict-ai/react-ui";
433
+ * import { DepictAligner, useDepictSearchField } from "@depict-ai/react-ui";
434
434
  *
435
435
  * const App = () => {
436
- * const alignerRef = useRef(null);
437
- * const { DepictSearchField } = useDepictSearchModal({
436
+ * const ref = useRef(null);
437
+ * const { DepictSearchField } = useDepictSearchField({
438
438
  * alignerRef: ref
439
439
  * });
440
440
  *
441
441
  * return (
442
442
  * <div>
443
- * <div ref={alignerRef} style={{ height: "100px", width: "100px" }} />
443
+ * <DepictAligner ref={ref} />
444
444
  * <DepictSearchField />
445
445
  * </div>
446
446
  * );
@@ -449,7 +449,6 @@ interface UseDepictSearchFieldReturn {
449
449
  * @returns {JSX.Element}
450
450
  */
451
451
  export const useDepictSearchField: (props: SearchFieldProps) => UseDepictSearchFieldReturn;
452
- export const version = "0.0.65";
453
452
  /**
454
453
  * Helper function to navigate to a new page depending on the navigation library used.
455
454
  */
package/dist/main.js CHANGED
@@ -28,6 +28,10 @@ $parcel$export(module.exports, "Navigation", () => $b742053c966024b4$export$b8a6
28
28
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
29
29
  // Note, if you add an export here, also add one in src-server/main.ts
30
30
 
31
+ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.67";
32
+
33
+
34
+
31
35
 
32
36
 
33
37
 
@@ -137,7 +141,7 @@ function $b4d0d98857ed9934$export$e5139bbbb9a05035(component, is_set = (0, $0b7c
137
141
  });
138
142
  };
139
143
  }
140
- async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display , info: info , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
144
+ async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
141
145
  const solid_container = document.createElement("div");
142
146
  const react_has_rendered = new Promise((r)=>{
143
147
  const m_o = new MutationObserver(()=>{
@@ -148,9 +152,8 @@ async function $b4d0d98857ed9934$export$79c79419c1ef0081({ display: display , in
148
152
  childList: true
149
153
  });
150
154
  });
151
- const is_placeholder = info.rendering_options.type === "placeholder";
152
155
  const reactProductCard = (0, $4GYXz$reactjsxruntime.jsx)(react_template, {
153
- display: is_placeholder ? null : display
156
+ display: display
154
157
  });
155
158
  const portal = $4GYXz$reactdom.createPortal(reactProductCard, solid_container);
156
159
  component_portals.add(portal);
@@ -290,9 +293,8 @@ function $7ad7a3d0011b7b1b$var$SolidSearchPage(props, set_portals) {
290
293
  // Todo: Do we need this?
291
294
  get_product_id: ()=>"",
292
295
  depict_search: depict_search,
293
- product_card_template: (display, info)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
296
+ product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
294
297
  display: display,
295
- info: info,
296
298
  react_template: props.productCard,
297
299
  component_portals: component_portals,
298
300
  set_portals: set_portals
@@ -340,9 +342,8 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
340
342
  category_title: props.categoryTitlePlugin || (0, $4GYXz$depictaiui.CategoryTitle),
341
343
  show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
342
344
  show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
343
- product_card_template: (display, info)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
345
+ product_card_template: (display)=>(0, $b4d0d98857ed9934$export$79c79419c1ef0081)({
344
346
  display: display,
345
- info: info,
346
347
  react_template: props.productCard,
347
348
  component_portals: component_portals,
348
349
  set_portals: set_portals
@@ -356,7 +357,7 @@ function $5aa5fcb9f8a2bebc$var$SolidCategoryPage(props, set_portals) {
356
357
 
357
358
 
358
359
  function $d88e98b11c182b8e$export$5646050d516e06bc() {
359
- return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($d88e98b11c182b8e$var$vanilla_breadcrumbs), {});
360
+ return (0, $b4d0d98857ed9934$export$f6e64e17bd69eeef)((0, $b4d0d98857ed9934$export$e5139bbbb9a05035)($d88e98b11c182b8e$var$vanilla_breadcrumbs), undefined);
360
361
  }
361
362
  function $d88e98b11c182b8e$var$vanilla_breadcrumbs() {
362
363
  const depict_category = (0, $0b7cd4fb39fc3502$export$8e769ad4338a911e).category;
@@ -422,10 +423,7 @@ const $ef7db890e488d4f4$export$d69d8daa20eae175 = (createOpenModalParams)=>{
422
423
  globalState.search.modal_open = true;
423
424
  return;
424
425
  }
425
- if (!headerAligner) // Very important not to throw here, as it just means the ref hasn't been set by react yet.
426
- // This is a race condition that will be resolved in the next render.
427
- // If we throw here, the app will crash.
428
- return;
426
+ if (!headerAligner) return;
429
427
  const { cleanup: cleanup } = (0, $4GYXz$depictaiui.connect_query_input_height_to_aligner_height)(headerAligner);
430
428
  let dispose_aligner;
431
429
  /**
@@ -489,10 +487,6 @@ const $ca5840628781f899$export$45080d603eda647c = (props)=>{
489
487
 
490
488
 
491
489
 
492
- const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.65";
493
-
494
-
495
-
496
490
 
497
491
  const $e387bd534de10acd$export$804fac5697cfbe35 = (router)=>(href)=>{
498
492
  const shallow = (0, $b4d0d98857ed9934$export$92a8f8b3c630fa0d)(location);
package/dist/module.js CHANGED
@@ -10,6 +10,10 @@ import {createPortal as $TZSbU$createPortal} from "react-dom";
10
10
  /*! Depict.ai search and product listing react SDK wrapper */ // This is where the actual source of your React stuff should live
11
11
  // Note, if you add an export here, also add one in src-server/main.ts
12
12
 
13
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.67";
14
+
15
+
16
+
13
17
 
14
18
 
15
19
 
@@ -119,7 +123,7 @@ function $c83ba9ab79386687$export$e5139bbbb9a05035(component, is_set = (0, $4285
119
123
  });
120
124
  };
121
125
  }
122
- async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , info: info , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
126
+ async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , component_portals: component_portals , set_portals: set_portals , react_template: react_template }) {
123
127
  const solid_container = document.createElement("div");
124
128
  const react_has_rendered = new Promise((r)=>{
125
129
  const m_o = new MutationObserver(()=>{
@@ -130,9 +134,8 @@ async function $c83ba9ab79386687$export$79c79419c1ef0081({ display: display , in
130
134
  childList: true
131
135
  });
132
136
  });
133
- const is_placeholder = info.rendering_options.type === "placeholder";
134
137
  const reactProductCard = (0, $TZSbU$jsx)(react_template, {
135
- display: is_placeholder ? null : display
138
+ display: display
136
139
  });
137
140
  const portal = $TZSbU$createPortal(reactProductCard, solid_container);
138
141
  component_portals.add(portal);
@@ -272,9 +275,8 @@ function $4a678f0c87b12e78$var$SolidSearchPage(props, set_portals) {
272
275
  // Todo: Do we need this?
273
276
  get_product_id: ()=>"",
274
277
  depict_search: depict_search,
275
- product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
278
+ product_card_template: (display)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
276
279
  display: display,
277
- info: info,
278
280
  react_template: props.productCard,
279
281
  component_portals: component_portals,
280
282
  set_portals: set_portals
@@ -322,9 +324,8 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
322
324
  category_title: props.categoryTitlePlugin || (0, $43099132aad1ceb6$re_export$CategoryTitle),
323
325
  show_breadcrumbs: props.showBreadcrumbs === undefined ? true : props.showBreadcrumbs,
324
326
  show_quicklinks: props.showQuicklinks === undefined ? true : props.showQuicklinks,
325
- product_card_template: (display, info)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
327
+ product_card_template: (display)=>(0, $c83ba9ab79386687$export$79c79419c1ef0081)({
326
328
  display: display,
327
- info: info,
328
329
  react_template: props.productCard,
329
330
  component_portals: component_portals,
330
331
  set_portals: set_portals
@@ -338,7 +339,7 @@ function $48d7f568740a317d$var$SolidCategoryPage(props, set_portals) {
338
339
 
339
340
 
340
341
  function $f866f7ed9f751af4$export$5646050d516e06bc() {
341
- return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($f866f7ed9f751af4$var$vanilla_breadcrumbs), {});
342
+ return (0, $c83ba9ab79386687$export$f6e64e17bd69eeef)((0, $c83ba9ab79386687$export$e5139bbbb9a05035)($f866f7ed9f751af4$var$vanilla_breadcrumbs), undefined);
342
343
  }
343
344
  function $f866f7ed9f751af4$var$vanilla_breadcrumbs() {
344
345
  const depict_category = (0, $42858f023ef23dab$export$8e769ad4338a911e).category;
@@ -404,10 +405,7 @@ const $5e26376d86621891$export$d69d8daa20eae175 = (createOpenModalParams)=>{
404
405
  globalState.search.modal_open = true;
405
406
  return;
406
407
  }
407
- if (!headerAligner) // Very important not to throw here, as it just means the ref hasn't been set by react yet.
408
- // This is a race condition that will be resolved in the next render.
409
- // If we throw here, the app will crash.
410
- return;
408
+ if (!headerAligner) return;
411
409
  const { cleanup: cleanup } = (0, $TZSbU$connect_query_input_height_to_aligner_height)(headerAligner);
412
410
  let dispose_aligner;
413
411
  /**
@@ -471,10 +469,6 @@ const $e3ccaca62718bae4$export$45080d603eda647c = (props)=>{
471
469
 
472
470
 
473
471
 
474
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.65";
475
-
476
-
477
-
478
472
 
479
473
  const $a92aa2beb560b8af$export$804fac5697cfbe35 = (router)=>(href)=>{
480
474
  const shallow = (0, $c83ba9ab79386687$export$92a8f8b3c630fa0d)(location);
@@ -9,7 +9,7 @@ interface UseDepictSearchFieldReturn {
9
9
  */
10
10
  DepictSearchField: () => ReactElement;
11
11
  }
12
- export const version = "0.0.65";
12
+ export const version = "0.0.67";
13
13
  export function DepictProvider(props: any): any;
14
14
  export function DepictSearchPage(): any;
15
15
  export function DepictCategoryPage(): any;
@@ -19,7 +19,7 @@ $parcel$export(module.exports, "useDepictSearchModal", () => $41e7e5d85b5e0d49$e
19
19
  $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
20
20
 
21
21
 
22
- const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.65";
22
+ const $db7b67857900028b$export$83d89fbfd8236492 = "0.0.67";
23
23
 
24
24
 
25
25
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
@@ -3,7 +3,7 @@ import {jsx as $1RlIW$jsx} from "react/jsx-runtime";
3
3
 
4
4
 
5
5
 
6
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.65";
6
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "0.0.67";
7
7
 
8
8
 
9
9
  function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",
@@ -90,8 +90,8 @@
90
90
  "/locales"
91
91
  ],
92
92
  "dependencies": {
93
- "@depict-ai/ui": "^0.0.42",
94
- "@depict-ai/utilishared": "^0.0.40",
93
+ "@depict-ai/ui": "^0.0.44",
94
+ "@depict-ai/utilishared": "^0.0.42",
95
95
  "solid-js": "^1.6.2"
96
96
  },
97
97
  "peerDependencies": {
@@ -104,7 +104,7 @@
104
104
  "@babel/preset-typescript": "latest",
105
105
  "@babel/runtime": "latest",
106
106
  "@babel/runtime-corejs3": "latest",
107
- "@depict-ai/plp-styling": "^0.0.5",
107
+ "@depict-ai/plp-styling": "^0.0.7",
108
108
  "@jest/globals": "^29.3.1",
109
109
  "@parcel/babel-preset-env": "latest",
110
110
  "@parcel/resolver-default": "^2.8.0",