@depict-ai/react-ui 1.0.12 → 1.0.15

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.
@@ -1,54 +1,58 @@
1
- import { ReactElement } from "react";
2
- import { DPC } from "@depict-ai/dpc";
3
- import { fetchDepictRecommendations, ExclusiveId } from "@depict-ai/ui";
4
- import { Display } from "@depict-ai/utilishared";
5
- type OpenModal = () => void;
6
- interface UseSearchModalReturn {
7
- open: OpenModal;
8
- }
9
- interface UseSearchFieldReturn {
10
- /**
11
- * A React component that renders the search field.
12
- */
13
- SearchField: () => ReactElement;
14
- }
15
- interface UsePerformanceClientReturn {
16
- dpc: DPC;
17
- }
18
- type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "userId" | "sessionId"> & ExclusiveId;
19
- interface UseFetchRecommendationsReturn<T extends Display> {
20
- /**
21
- * Fetch recommendations from the Depict API.
22
- * @example
23
- * General recommendations for a landing page:
24
- * ```tsx
25
- * fetchRecommendations({ type: "landing_page" });
26
- * ```
27
- * @example
28
- * Fetch targeted recommendations for a product details page (PDP):
29
- * ```tsx
30
- * fetchRecommendations({ type: "related", productId: "t-shirt-white" })
31
- * ```
32
- * @returns {Promise<T[]>}
33
- */
34
- fetchRecommendations: (opts: FetchRecsOptions) => Promise<T[]>;
35
- }
36
- export const version = "1.0.12";
37
- export function DepictProvider(props: any): any;
38
- export function SearchPage(): any;
39
- export function CategoryPage(): any;
40
- export function BreadCrumbs(): any;
41
- export function QuickLinks(): any;
42
- export function ComponentAligner(): import("react").DetailedReactHTMLElement<{
43
- className: string;
44
- style: {
45
- height: string;
46
- };
47
- }, HTMLElement>;
48
- export function ImagePlaceholder(): any;
49
- export function TextPlaceholder(): any;
50
- export function useSearchField(): UseSearchFieldReturn;
51
- export function openModal(): void;
52
- export function useSearchModal(): UseSearchModalReturn;
53
- export function usePerformanceClient(): UsePerformanceClientReturn;
54
- export function useFetchRecommendations<T extends Display>(): UseFetchRecommendationsReturn<T>;
1
+ import { ReactElement } from "react";
2
+ import { DPC } from "@depict-ai/dpc";
3
+ import { fetchDepictRecommendations, ExclusiveId, TextPlaceholder as _TextPlaceholder1, ImagePlaceholder as _ImagePlaceholder1 } from "@depict-ai/ui";
4
+ import { Display } from "@depict-ai/utilishared";
5
+ type OpenModal = () => void;
6
+ interface UseSearchModalReturn {
7
+ open: OpenModal;
8
+ }
9
+ interface UseSearchFieldReturn {
10
+ /**
11
+ * A React component that renders the search field.
12
+ */
13
+ SearchField: () => ReactElement;
14
+ }
15
+ interface UsePerformanceClientReturn {
16
+ dpc: DPC;
17
+ }
18
+ type FetchRecsOptions = Omit<Parameters<typeof fetchDepictRecommendations>[0], "merchant" | "market" | "userId" | "sessionId"> & ExclusiveId;
19
+ interface UseFetchRecommendationsReturn<T extends Display> {
20
+ /**
21
+ * Fetch recommendations from the Depict API.
22
+ * @example
23
+ * General recommendations for a landing page:
24
+ * ```tsx
25
+ * fetchRecommendations({ type: "landing_page" });
26
+ * ```
27
+ * @example
28
+ * Fetch targeted recommendations for a product details page (PDP):
29
+ * ```tsx
30
+ * fetchRecommendations({ type: "related", productId: "t-shirt-white" })
31
+ * ```
32
+ * @returns {Promise<T[]>}
33
+ */
34
+ fetchRecommendations: (opts: FetchRecsOptions) => Promise<T[]>;
35
+ }
36
+ export const version = "1.0.15";
37
+ export function DepictProvider(props: any): any;
38
+ export function SearchPage(): any;
39
+ export function CategoryPage(): any;
40
+ export function BreadCrumbs(): any;
41
+ export function QuickLinks(): any;
42
+ export function ComponentAligner(): import("react").DetailedReactHTMLElement<{
43
+ className: string;
44
+ style: {
45
+ height: string;
46
+ };
47
+ }, HTMLElement>;
48
+ export function ImagePlaceholder(raw_react_props: Parameters<typeof _ImagePlaceholder1>[0] & {
49
+ className: string;
50
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
51
+ export function TextPlaceholder(raw_react_props: Omit<Parameters<typeof _TextPlaceholder1>[0], "class"> & {
52
+ className: string;
53
+ }): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
54
+ export function useSearchField(): UseSearchFieldReturn;
55
+ export function openModal(): void;
56
+ export function useSearchModal(): UseSearchModalReturn;
57
+ export function usePerformanceClient(): UsePerformanceClientReturn;
58
+ export function useFetchRecommendations<T extends Display>(): UseFetchRecommendationsReturn<T>;
@@ -1,5 +1,7 @@
1
1
  var $5efvh$react = require("react");
2
2
  var $5efvh$reactjsxruntime = require("react/jsx-runtime");
3
+ var $5efvh$depictaiui = require("@depict-ai/ui");
4
+ var $5efvh$solidjsweb = require("solid-js/web");
3
5
 
4
6
  function $parcel$export(e, n, v, s) {
5
7
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
@@ -21,7 +23,25 @@ $parcel$export(module.exports, "useFetchRecommendations", () => $41e7e5d85b5e0d4
21
23
  $parcel$export(module.exports, "version", () => $db7b67857900028b$export$83d89fbfd8236492);
22
24
 
23
25
 
24
- const $db7b67857900028b$export$83d89fbfd8236492 = "1.0.12";
26
+
27
+
28
+
29
+ function $35dfe83eec81954c$export$4b564d7f5a1b1d43({ solid_component: solid_component , props: props , wrapper_type: wrapper_type = "div" , wrapper_style: wrapper_style = {} }) {
30
+ const wrapper_element_ref = (0, $5efvh$react.useRef)();
31
+ // The worst thing that can happen by multiple generateHydrationScript's is that events dispatched before the hydration are duplicated in solid's shared context which leads to them being deduplicated again here https://github.com/ryansolid/dom-expressions/blob/21fdba5bcab25986a2b93003aaace100b2231cdc/packages/dom-expressions/src/client.js#L280
32
+ const rendered_html = (0, $5efvh$solidjsweb.renderToString)(()=>solid_component(props, ()=>{})) + (0, $5efvh$solidjsweb.generateHydrationScript)();
33
+ return (0, $5efvh$react.createElement)((0, $5efvh$react.Fragment), null, (0, $5efvh$react.createElement)(wrapper_type, {
34
+ ref: wrapper_element_ref,
35
+ style: wrapper_style,
36
+ dangerouslySetInnerHTML: {
37
+ __html: rendered_html
38
+ }
39
+ }));
40
+ }
41
+
42
+
43
+
44
+ const $db7b67857900028b$export$83d89fbfd8236492 = "1.0.15";
25
45
 
26
46
 
27
47
  function $41e7e5d85b5e0d49$export$9fac37a9c21c2f3b(props) {
@@ -55,14 +75,29 @@ function $41e7e5d85b5e0d49$export$80e99ee6b29cadd2() {
55
75
  }
56
76
  });
57
77
  }
58
- function $41e7e5d85b5e0d49$export$3f37af283f8fb843() {
59
- return (0, $5efvh$reactjsxruntime.jsx)("div", {
60
- children: []
78
+ function $41e7e5d85b5e0d49$export$3f37af283f8fb843(raw_react_props) {
79
+ const react_props = {
80
+ class: raw_react_props.className,
81
+ ...raw_react_props
82
+ };
83
+ return (0, $35dfe83eec81954c$export$4b564d7f5a1b1d43)({
84
+ solid_component: (props_store)=>(0, $5efvh$depictaiui.ImagePlaceholder)(props_store),
85
+ props: react_props,
86
+ wrapper_type: "span"
61
87
  });
62
88
  }
63
- function $41e7e5d85b5e0d49$export$89c6019e4baa40b1() {
64
- return (0, $5efvh$reactjsxruntime.jsx)("div", {
65
- children: []
89
+ function $41e7e5d85b5e0d49$export$89c6019e4baa40b1(raw_react_props) {
90
+ const react_props = {
91
+ ...raw_react_props,
92
+ class: raw_react_props.className
93
+ };
94
+ return (0, $35dfe83eec81954c$export$4b564d7f5a1b1d43)({
95
+ solid_component: (props_store)=>(0, $5efvh$depictaiui.TextPlaceholder)(props_store),
96
+ props: react_props,
97
+ wrapper_type: "span",
98
+ wrapper_style: {
99
+ "height": "100%"
100
+ }
66
101
  });
67
102
  }
68
103
  function $41e7e5d85b5e0d49$export$9bb30bbe003b82e0() {
@@ -1,9 +1,29 @@
1
- import {createElement as $1RlIW$createElement} from "react";
1
+ import {createElement as $1RlIW$createElement, useRef as $1RlIW$useRef, Fragment as $1RlIW$Fragment} from "react";
2
2
  import {jsx as $1RlIW$jsx} from "react/jsx-runtime";
3
+ import {ImagePlaceholder as $1RlIW$ImagePlaceholder, TextPlaceholder as $1RlIW$TextPlaceholder} from "@depict-ai/ui";
4
+ import {renderToString as $1RlIW$renderToString, generateHydrationScript as $1RlIW$generateHydrationScript} from "solid-js/web";
3
5
 
4
6
 
5
7
 
6
- const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.0.12";
8
+
9
+
10
+
11
+ function $4568c09979447ab1$export$4b564d7f5a1b1d43({ solid_component: solid_component , props: props , wrapper_type: wrapper_type = "div" , wrapper_style: wrapper_style = {} }) {
12
+ const wrapper_element_ref = (0, $1RlIW$useRef)();
13
+ // The worst thing that can happen by multiple generateHydrationScript's is that events dispatched before the hydration are duplicated in solid's shared context which leads to them being deduplicated again here https://github.com/ryansolid/dom-expressions/blob/21fdba5bcab25986a2b93003aaace100b2231cdc/packages/dom-expressions/src/client.js#L280
14
+ const rendered_html = (0, $1RlIW$renderToString)(()=>solid_component(props, ()=>{})) + (0, $1RlIW$generateHydrationScript)();
15
+ return (0, $1RlIW$createElement)((0, $1RlIW$Fragment), null, (0, $1RlIW$createElement)(wrapper_type, {
16
+ ref: wrapper_element_ref,
17
+ style: wrapper_style,
18
+ dangerouslySetInnerHTML: {
19
+ __html: rendered_html
20
+ }
21
+ }));
22
+ }
23
+
24
+
25
+
26
+ const $c9c4d066f9a5b51b$export$83d89fbfd8236492 = "1.0.15";
7
27
 
8
28
 
9
29
  function $2b1fdeb83610500f$export$9fac37a9c21c2f3b(props) {
@@ -37,14 +57,29 @@ function $2b1fdeb83610500f$export$80e99ee6b29cadd2() {
37
57
  }
38
58
  });
39
59
  }
40
- function $2b1fdeb83610500f$export$3f37af283f8fb843() {
41
- return (0, $1RlIW$jsx)("div", {
42
- children: []
60
+ function $2b1fdeb83610500f$export$3f37af283f8fb843(raw_react_props) {
61
+ const react_props = {
62
+ class: raw_react_props.className,
63
+ ...raw_react_props
64
+ };
65
+ return (0, $4568c09979447ab1$export$4b564d7f5a1b1d43)({
66
+ solid_component: (props_store)=>(0, $1RlIW$ImagePlaceholder)(props_store),
67
+ props: react_props,
68
+ wrapper_type: "span"
43
69
  });
44
70
  }
45
- function $2b1fdeb83610500f$export$89c6019e4baa40b1() {
46
- return (0, $1RlIW$jsx)("div", {
47
- children: []
71
+ function $2b1fdeb83610500f$export$89c6019e4baa40b1(raw_react_props) {
72
+ const react_props = {
73
+ ...raw_react_props,
74
+ class: raw_react_props.className
75
+ };
76
+ return (0, $4568c09979447ab1$export$4b564d7f5a1b1d43)({
77
+ solid_component: (props_store)=>(0, $1RlIW$TextPlaceholder)(props_store),
78
+ props: react_props,
79
+ wrapper_type: "span",
80
+ wrapper_style: {
81
+ "height": "100%"
82
+ }
48
83
  });
49
84
  }
50
85
  function $2b1fdeb83610500f$export$9bb30bbe003b82e0() {
@@ -1,2 +1,2 @@
1
- export type { plp_shared_i18n, search_i18n, category_i18n, Locale } from "@depict-ai/ui/locales";
2
- export { cz, de, en, da, fi, pl, fr, sv, pt, no, nl, es, it } from "@depict-ai/ui/locales";
1
+ export type { plp_shared_i18n, search_i18n, category_i18n, Locale } from "@depict-ai/ui/locales";
2
+ export { cz, de, en, da, fi, pl, fr, sv, pt, no, nl, es, it } from "@depict-ai/ui/locales";
package/locales/index.js CHANGED
@@ -1 +1 @@
1
- export * from "@depict-ai/ui/locales";
1
+ export * from "@depict-ai/ui/locales";
@@ -1 +1 @@
1
- module.exports = require("@depict-ai/ui/locales");
1
+ module.exports = require("@depict-ai/ui/locales");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/react-ui",
3
- "version": "1.0.12",
3
+ "version": "1.0.15",
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.12",
101
- "@depict-ai/plp-styling": "^1.0.13",
102
- "@depict-ai/ui": "^1.0.15",
103
- "@depict-ai/utilishared": "^1.0.12",
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",
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.13",
117
+ "@depict-ai/plp-styling": "^1.0.16",
118
118
  "@jest/globals": "^29.3.1",
119
119
  "@parcel/babel-preset-env": "latest",
120
120
  "@parcel/resolver-default": "^2.8.0",