@ronza.ai/react 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ronza
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,76 @@
1
- # Temporary Holding Version
1
+ # @ronza.ai/react
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Your Ronza agent in a React app (React 18 or 19): `<RonzaWidget />` and
4
+ `useRonza()`. Built on [`@ronza.ai/web`](https://www.npmjs.com/package/@ronza.ai/web),
5
+ which loads the chat from cdn.ronza.ai, so every fix to the chat reaches your
6
+ app without a new release of yours.
7
+
8
+ Guides for each framework: https://ronza.ai/docs/install
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ npm install @ronza.ai/react
14
+ ```
15
+
16
+ ## Use
17
+
18
+ ```tsx
19
+ import { RonzaWidget, useRonza } from '@ronza.ai/react';
20
+
21
+ export function App() {
22
+ return (
23
+ <>
24
+ <RonzaWidget
25
+ agentKey="pk_YOUR_PUBLIC_KEY"
26
+ getToken={async () => fetchTokenFromYourServer()}
27
+ context={{ plan: 'Pro' }}
28
+ />
29
+ <HelpButton />
30
+ </>
31
+ );
32
+ }
33
+
34
+ function HelpButton() {
35
+ const ronza = useRonza(); // null until the chat is ready
36
+ return <button disabled={!ronza} onClick={() => ronza?.open()}>Ask us</button>;
37
+ }
38
+ ```
39
+
40
+ ### `<RonzaWidget />`
41
+
42
+ Renders nothing itself. Put it once in your app, for example in the layout.
43
+
44
+ | Prop | |
45
+ |---|---|
46
+ | `agentKey` | Required. The public key, `pk_...`, from the agent's install page in Ronza Chat. |
47
+ | `getToken` | Returns an identity token from your server for the signed-in user, or `null` when nobody is signed in (an empty or blank string counts as `null`). Called once at start, and again when the chat reports the error `identity_refused` (the signed-in session can no longer be renewed); the fresh token is handed over with `identify`. A `boot_failed` error is not retried with a new token: a token refused at start is a setup error to fix on your server. When it returns no token after a token (your user signed out), the chat is reset to an anonymous visitor. |
48
+ | `context` | What the page tells the agent, for example `{ plan: 'Pro' }`. Sent when the widget starts and again whenever it changes by value; removing it clears it, and a widget with no `context` (another route's, say) clears what an earlier one set. |
49
+ | `channel` | `'center'` for Center stage. |
50
+ | `hideLauncher` | Keep the launcher hidden and open the chat from your own button. |
51
+ | `theme`, `display`, `scriptOrigin` | As in `@ronza.ai/web`. |
52
+
53
+ `agentKey`, `channel`, `theme` and `display` are read when the widget first
54
+ mounts. Change the theme later with `useRonza()?.update({ theme })`.
55
+
56
+ Unmounting the widget hides the launcher and keeps the conversation, so a
57
+ route change does not end the chat. It is safe under Strict Mode: the double
58
+ mount loads the script once, starts the chat once and calls `getToken` once.
59
+
60
+ ### `useRonza()`
61
+
62
+ The typed client from `@ronza.ai/web` (`open`, `close`, `on`, `context`,
63
+ `identify`, `reset` and the rest) once the chat is ready, and `null` before
64
+ that and on the server. It works in any component, inside or outside the
65
+ widget's part of the tree.
66
+
67
+ ### Server rendering
68
+
69
+ Safe in server-rendered apps (Next.js and others): nothing runs on the server
70
+ and `useRonza()` is `null` there. The package is marked `'use client'`, so in
71
+ the Next.js App Router a server layout can render `<RonzaWidget />` directly;
72
+ `useRonza()` belongs in client components, like any hook.
73
+
74
+ ## License
75
+
76
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,175 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const react = require("react");
5
+ const web = require("@ronza.ai/web");
6
+ const FRESH_TOKEN_ERROR_CODE = "identity_refused";
7
+ const MIN_MILLISECONDS_BETWEEN_TOKEN_REFRESHES = 1e4;
8
+ let readyClient = null;
9
+ const readyClientSubscribers = /* @__PURE__ */ new Set();
10
+ function setReadyClient(client) {
11
+ if (readyClient === client) return;
12
+ readyClient = client;
13
+ for (const notify of readyClientSubscribers) notify();
14
+ }
15
+ function subscribeToReadyClient(notify) {
16
+ readyClientSubscribers.add(notify);
17
+ return () => {
18
+ readyClientSubscribers.delete(notify);
19
+ };
20
+ }
21
+ function readReadyClient() {
22
+ return readyClient;
23
+ }
24
+ function readServerClient() {
25
+ return null;
26
+ }
27
+ function useRonza() {
28
+ return react.useSyncExternalStore(subscribeToReadyClient, readReadyClient, readServerClient);
29
+ }
30
+ function isPlainObject(value) {
31
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
32
+ const prototype = Object.getPrototypeOf(value);
33
+ return prototype === Object.prototype || prototype === null;
34
+ }
35
+ function isSameValue(left, right) {
36
+ if (Object.is(left, right)) return true;
37
+ if (Array.isArray(left) && Array.isArray(right)) {
38
+ return left.length === right.length && left.every((item, index) => isSameValue(item, right[index]));
39
+ }
40
+ if (isPlainObject(left) && isPlainObject(right)) {
41
+ const leftNames = Object.keys(left);
42
+ if (leftNames.length !== Object.keys(right).length) return false;
43
+ return leftNames.every((name) => Object.prototype.hasOwnProperty.call(right, name) && isSameValue(left[name], right[name]));
44
+ }
45
+ return false;
46
+ }
47
+ function copyPlain(value) {
48
+ if (Array.isArray(value)) return value.map(copyPlain);
49
+ if (isPlainObject(value)) {
50
+ const copy = {};
51
+ for (const name of Object.keys(value)) copy[name] = copyPlain(value[name]);
52
+ return copy;
53
+ }
54
+ return value;
55
+ }
56
+ function normaliseToken(answer) {
57
+ if (typeof answer !== "string") return null;
58
+ const token = answer.trim();
59
+ return token === "" ? null : token;
60
+ }
61
+ function reportError(message, error) {
62
+ console.error(`[ronza] ${message}`, error);
63
+ }
64
+ function RonzaWidget(props) {
65
+ const latestProps = react.useRef(props);
66
+ const [startedClient, setStartedClient] = react.useState(null);
67
+ const startedClientRef = react.useRef(null);
68
+ const startRequestedRef = react.useRef(false);
69
+ const mountedRef = react.useRef(false);
70
+ const lastTokenRef = react.useRef(null);
71
+ const refreshInFlightRef = react.useRef(false);
72
+ const lastRefreshAtRef = react.useRef(Number.NEGATIVE_INFINITY);
73
+ const lastSentContextRef = react.useRef(void 0);
74
+ react.useEffect(() => {
75
+ latestProps.current = props;
76
+ });
77
+ react.useEffect(() => {
78
+ mountedRef.current = true;
79
+ function adoptClient(client, chatWasAlreadyLoaded) {
80
+ startedClientRef.current = client;
81
+ setStartedClient(client);
82
+ if (chatWasAlreadyLoaded && !latestProps.current.hideLauncher) client.show();
83
+ }
84
+ async function start() {
85
+ const chatWasAlreadyLoaded = web.getRonza() !== null;
86
+ let token = null;
87
+ const getToken = latestProps.current.getToken;
88
+ if (getToken) {
89
+ try {
90
+ token = normaliseToken(await getToken());
91
+ } catch (error) {
92
+ reportError("getToken failed, so the chat starts without a signed-in visitor:", error);
93
+ }
94
+ if (!mountedRef.current) {
95
+ startRequestedRef.current = false;
96
+ return;
97
+ }
98
+ }
99
+ lastTokenRef.current = token;
100
+ const options = latestProps.current;
101
+ const loading = web.loadRonza({
102
+ agentKey: options.agentKey,
103
+ channel: options.channel,
104
+ identityToken: token ?? void 0,
105
+ hideLauncher: options.hideLauncher,
106
+ theme: options.theme,
107
+ display: options.display,
108
+ scriptOrigin: options.scriptOrigin
109
+ });
110
+ loading.then(setReadyClient, (error) => {
111
+ if (error instanceof Error && error.message.startsWith("[ronza] ")) console.error(error.message);
112
+ else reportError("the chat could not be loaded:", error);
113
+ });
114
+ const client = web.getRonza();
115
+ if (client && client.agentKey === options.agentKey) adoptClient(client, chatWasAlreadyLoaded);
116
+ }
117
+ if (!startRequestedRef.current) {
118
+ startRequestedRef.current = true;
119
+ void start();
120
+ } else if (startedClientRef.current && !latestProps.current.hideLauncher) {
121
+ startedClientRef.current.show();
122
+ }
123
+ return () => {
124
+ mountedRef.current = false;
125
+ startedClientRef.current?.hide();
126
+ };
127
+ }, []);
128
+ react.useEffect(() => {
129
+ if (!startedClient) return void 0;
130
+ const client = startedClient;
131
+ async function refreshToken() {
132
+ const getToken = latestProps.current.getToken;
133
+ if (!getToken || refreshInFlightRef.current) return;
134
+ const now = Date.now();
135
+ if (now - lastRefreshAtRef.current < MIN_MILLISECONDS_BETWEEN_TOKEN_REFRESHES) return;
136
+ lastRefreshAtRef.current = now;
137
+ refreshInFlightRef.current = true;
138
+ let token;
139
+ try {
140
+ token = normaliseToken(await getToken());
141
+ } catch (error) {
142
+ reportError("getToken failed, so the refused sign-in was not renewed:", error);
143
+ return;
144
+ } finally {
145
+ refreshInFlightRef.current = false;
146
+ }
147
+ if (token === null) {
148
+ if (lastTokenRef.current !== null) {
149
+ lastTokenRef.current = null;
150
+ client.reset();
151
+ }
152
+ return;
153
+ }
154
+ if (token === lastTokenRef.current) return;
155
+ lastTokenRef.current = token;
156
+ client.identify({ token });
157
+ }
158
+ function onError(detail) {
159
+ if (detail?.code === FRESH_TOKEN_ERROR_CODE) void refreshToken();
160
+ }
161
+ return client.on("error", onError);
162
+ }, [startedClient]);
163
+ react.useEffect(() => {
164
+ if (!startedClient) return;
165
+ const next = props.context ?? null;
166
+ const previous = lastSentContextRef.current;
167
+ if (previous !== void 0 && isSameValue(previous, next)) return;
168
+ const sent = copyPlain(next);
169
+ lastSentContextRef.current = sent;
170
+ startedClient.context(sent);
171
+ });
172
+ return null;
173
+ }
174
+ exports.RonzaWidget = RonzaWidget;
175
+ exports.useRonza = useRonza;
@@ -0,0 +1,36 @@
1
+ import type { LoadRonzaOptions, PageContextFields, RonzaClient } from '@ronza.ai/web';
2
+ export type { LoadRonzaOptions, PageContextFields, PageContextValue, RonzaChannel, RonzaClient, RonzaDisplay, RonzaEventDetails, RonzaEventListener, RonzaEventName, RonzaSettingsUpdate, RonzaTheme, } from '@ronza.ai/web';
3
+ export interface RonzaWidgetProps {
4
+ /** The agent's public key, `pk_...`. Read when the widget first mounts. */
5
+ agentKey: string;
6
+ /**
7
+ * Returns an identity token from your server for the signed-in user, or `null` (or an empty string) when nobody
8
+ * is signed in. Called once at start, and again when the chat reports `identity_refused` (the signed-in session
9
+ * can no longer be renewed). Resolving to no token after a token signs the visitor out (`reset`).
10
+ */
11
+ getToken?: () => Promise<string | null> | string | null;
12
+ /**
13
+ * What the page tells the agent (`{ plan: 'Pro' }`). Sent when the widget starts (left out, it clears what an
14
+ * earlier widget on the page set), then again whenever it changes by value.
15
+ */
16
+ context?: PageContextFields | null;
17
+ /** `'center'` for Center stage. Read when the widget first mounts. */
18
+ channel?: LoadRonzaOptions['channel'];
19
+ /** Keep the launcher hidden; open the chat from your own button with `useRonza()?.open()`. */
20
+ hideLauncher?: boolean;
21
+ /** Read when the widget first mounts; change it later with `useRonza()?.update({ theme })`. */
22
+ theme?: LoadRonzaOptions['theme'];
23
+ /** Read when the widget first mounts. */
24
+ display?: LoadRonzaOptions['display'];
25
+ /** Where the script comes from. Default `https://cdn.ronza.ai`. */
26
+ scriptOrigin?: string;
27
+ }
28
+ /** The typed client once the chat is ready; `null` before, and on a server. */
29
+ export declare function useRonza(): RonzaClient | null;
30
+ /**
31
+ * Loads the agent and keeps it in step with the app: the signed-in user (`getToken`), the page context
32
+ * (`context`), and the launcher, hidden while the component is unmounted. Renders nothing.
33
+ *
34
+ * Strict Mode safe: its double mount loads the script once, boots once and calls `getToken` once.
35
+ */
36
+ export declare function RonzaWidget(props: RonzaWidgetProps): null;
@@ -0,0 +1,36 @@
1
+ import type { LoadRonzaOptions, PageContextFields, RonzaClient } from '@ronza.ai/web';
2
+ export type { LoadRonzaOptions, PageContextFields, PageContextValue, RonzaChannel, RonzaClient, RonzaDisplay, RonzaEventDetails, RonzaEventListener, RonzaEventName, RonzaSettingsUpdate, RonzaTheme, } from '@ronza.ai/web';
3
+ export interface RonzaWidgetProps {
4
+ /** The agent's public key, `pk_...`. Read when the widget first mounts. */
5
+ agentKey: string;
6
+ /**
7
+ * Returns an identity token from your server for the signed-in user, or `null` (or an empty string) when nobody
8
+ * is signed in. Called once at start, and again when the chat reports `identity_refused` (the signed-in session
9
+ * can no longer be renewed). Resolving to no token after a token signs the visitor out (`reset`).
10
+ */
11
+ getToken?: () => Promise<string | null> | string | null;
12
+ /**
13
+ * What the page tells the agent (`{ plan: 'Pro' }`). Sent when the widget starts (left out, it clears what an
14
+ * earlier widget on the page set), then again whenever it changes by value.
15
+ */
16
+ context?: PageContextFields | null;
17
+ /** `'center'` for Center stage. Read when the widget first mounts. */
18
+ channel?: LoadRonzaOptions['channel'];
19
+ /** Keep the launcher hidden; open the chat from your own button with `useRonza()?.open()`. */
20
+ hideLauncher?: boolean;
21
+ /** Read when the widget first mounts; change it later with `useRonza()?.update({ theme })`. */
22
+ theme?: LoadRonzaOptions['theme'];
23
+ /** Read when the widget first mounts. */
24
+ display?: LoadRonzaOptions['display'];
25
+ /** Where the script comes from. Default `https://cdn.ronza.ai`. */
26
+ scriptOrigin?: string;
27
+ }
28
+ /** The typed client once the chat is ready; `null` before, and on a server. */
29
+ export declare function useRonza(): RonzaClient | null;
30
+ /**
31
+ * Loads the agent and keeps it in step with the app: the signed-in user (`getToken`), the page context
32
+ * (`context`), and the launcher, hidden while the component is unmounted. Renders nothing.
33
+ *
34
+ * Strict Mode safe: its double mount loads the script once, boots once and calls `getToken` once.
35
+ */
36
+ export declare function RonzaWidget(props: RonzaWidgetProps): null;
package/dist/index.js ADDED
@@ -0,0 +1,175 @@
1
+ "use client";
2
+ import { useSyncExternalStore, useRef, useState, useEffect } from "react";
3
+ import { getRonza, loadRonza } from "@ronza.ai/web";
4
+ const FRESH_TOKEN_ERROR_CODE = "identity_refused";
5
+ const MIN_MILLISECONDS_BETWEEN_TOKEN_REFRESHES = 1e4;
6
+ let readyClient = null;
7
+ const readyClientSubscribers = /* @__PURE__ */ new Set();
8
+ function setReadyClient(client) {
9
+ if (readyClient === client) return;
10
+ readyClient = client;
11
+ for (const notify of readyClientSubscribers) notify();
12
+ }
13
+ function subscribeToReadyClient(notify) {
14
+ readyClientSubscribers.add(notify);
15
+ return () => {
16
+ readyClientSubscribers.delete(notify);
17
+ };
18
+ }
19
+ function readReadyClient() {
20
+ return readyClient;
21
+ }
22
+ function readServerClient() {
23
+ return null;
24
+ }
25
+ function useRonza() {
26
+ return useSyncExternalStore(subscribeToReadyClient, readReadyClient, readServerClient);
27
+ }
28
+ function isPlainObject(value) {
29
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
30
+ const prototype = Object.getPrototypeOf(value);
31
+ return prototype === Object.prototype || prototype === null;
32
+ }
33
+ function isSameValue(left, right) {
34
+ if (Object.is(left, right)) return true;
35
+ if (Array.isArray(left) && Array.isArray(right)) {
36
+ return left.length === right.length && left.every((item, index) => isSameValue(item, right[index]));
37
+ }
38
+ if (isPlainObject(left) && isPlainObject(right)) {
39
+ const leftNames = Object.keys(left);
40
+ if (leftNames.length !== Object.keys(right).length) return false;
41
+ return leftNames.every((name) => Object.prototype.hasOwnProperty.call(right, name) && isSameValue(left[name], right[name]));
42
+ }
43
+ return false;
44
+ }
45
+ function copyPlain(value) {
46
+ if (Array.isArray(value)) return value.map(copyPlain);
47
+ if (isPlainObject(value)) {
48
+ const copy = {};
49
+ for (const name of Object.keys(value)) copy[name] = copyPlain(value[name]);
50
+ return copy;
51
+ }
52
+ return value;
53
+ }
54
+ function normaliseToken(answer) {
55
+ if (typeof answer !== "string") return null;
56
+ const token = answer.trim();
57
+ return token === "" ? null : token;
58
+ }
59
+ function reportError(message, error) {
60
+ console.error(`[ronza] ${message}`, error);
61
+ }
62
+ function RonzaWidget(props) {
63
+ const latestProps = useRef(props);
64
+ const [startedClient, setStartedClient] = useState(null);
65
+ const startedClientRef = useRef(null);
66
+ const startRequestedRef = useRef(false);
67
+ const mountedRef = useRef(false);
68
+ const lastTokenRef = useRef(null);
69
+ const refreshInFlightRef = useRef(false);
70
+ const lastRefreshAtRef = useRef(Number.NEGATIVE_INFINITY);
71
+ const lastSentContextRef = useRef(void 0);
72
+ useEffect(() => {
73
+ latestProps.current = props;
74
+ });
75
+ useEffect(() => {
76
+ mountedRef.current = true;
77
+ function adoptClient(client, chatWasAlreadyLoaded) {
78
+ startedClientRef.current = client;
79
+ setStartedClient(client);
80
+ if (chatWasAlreadyLoaded && !latestProps.current.hideLauncher) client.show();
81
+ }
82
+ async function start() {
83
+ const chatWasAlreadyLoaded = getRonza() !== null;
84
+ let token = null;
85
+ const getToken = latestProps.current.getToken;
86
+ if (getToken) {
87
+ try {
88
+ token = normaliseToken(await getToken());
89
+ } catch (error) {
90
+ reportError("getToken failed, so the chat starts without a signed-in visitor:", error);
91
+ }
92
+ if (!mountedRef.current) {
93
+ startRequestedRef.current = false;
94
+ return;
95
+ }
96
+ }
97
+ lastTokenRef.current = token;
98
+ const options = latestProps.current;
99
+ const loading = loadRonza({
100
+ agentKey: options.agentKey,
101
+ channel: options.channel,
102
+ identityToken: token ?? void 0,
103
+ hideLauncher: options.hideLauncher,
104
+ theme: options.theme,
105
+ display: options.display,
106
+ scriptOrigin: options.scriptOrigin
107
+ });
108
+ loading.then(setReadyClient, (error) => {
109
+ if (error instanceof Error && error.message.startsWith("[ronza] ")) console.error(error.message);
110
+ else reportError("the chat could not be loaded:", error);
111
+ });
112
+ const client = getRonza();
113
+ if (client && client.agentKey === options.agentKey) adoptClient(client, chatWasAlreadyLoaded);
114
+ }
115
+ if (!startRequestedRef.current) {
116
+ startRequestedRef.current = true;
117
+ void start();
118
+ } else if (startedClientRef.current && !latestProps.current.hideLauncher) {
119
+ startedClientRef.current.show();
120
+ }
121
+ return () => {
122
+ mountedRef.current = false;
123
+ startedClientRef.current?.hide();
124
+ };
125
+ }, []);
126
+ useEffect(() => {
127
+ if (!startedClient) return void 0;
128
+ const client = startedClient;
129
+ async function refreshToken() {
130
+ const getToken = latestProps.current.getToken;
131
+ if (!getToken || refreshInFlightRef.current) return;
132
+ const now = Date.now();
133
+ if (now - lastRefreshAtRef.current < MIN_MILLISECONDS_BETWEEN_TOKEN_REFRESHES) return;
134
+ lastRefreshAtRef.current = now;
135
+ refreshInFlightRef.current = true;
136
+ let token;
137
+ try {
138
+ token = normaliseToken(await getToken());
139
+ } catch (error) {
140
+ reportError("getToken failed, so the refused sign-in was not renewed:", error);
141
+ return;
142
+ } finally {
143
+ refreshInFlightRef.current = false;
144
+ }
145
+ if (token === null) {
146
+ if (lastTokenRef.current !== null) {
147
+ lastTokenRef.current = null;
148
+ client.reset();
149
+ }
150
+ return;
151
+ }
152
+ if (token === lastTokenRef.current) return;
153
+ lastTokenRef.current = token;
154
+ client.identify({ token });
155
+ }
156
+ function onError(detail) {
157
+ if (detail?.code === FRESH_TOKEN_ERROR_CODE) void refreshToken();
158
+ }
159
+ return client.on("error", onError);
160
+ }, [startedClient]);
161
+ useEffect(() => {
162
+ if (!startedClient) return;
163
+ const next = props.context ?? null;
164
+ const previous = lastSentContextRef.current;
165
+ if (previous !== void 0 && isSameValue(previous, next)) return;
166
+ const sent = copyPlain(next);
167
+ lastSentContextRef.current = sent;
168
+ startedClient.context(sent);
169
+ });
170
+ return null;
171
+ }
172
+ export {
173
+ RonzaWidget,
174
+ useRonza
175
+ };
package/package.json CHANGED
@@ -1,6 +1,72 @@
1
1
  {
2
2
  "name": "@ronza.ai/react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "The Ronza chat agent in a React app: <RonzaWidget /> and useRonza(). Built on @ronza.ai/web.",
5
+ "keywords": [
6
+ "ronza",
7
+ "chat",
8
+ "widget",
9
+ "agent",
10
+ "react"
11
+ ],
12
+ "license": "MIT",
13
+ "//": "Publish with pnpm (pnpm pack, then npm publish of that tarball, or pnpm publish): only pnpm turns workspace:^ into ^0.1.0; prepublishOnly (scripts/refuse-npm-publish.cjs) refuses a plain npm publish of this folder.",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/ronzahq/ronza-js.git",
17
+ "directory": "react"
18
+ },
19
+ "homepage": "https://ronza.ai/docs/install",
20
+ "type": "module",
21
+ "main": "./dist/index.cjs",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "import": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "require": {
31
+ "types": "./dist/index.d.cts",
32
+ "default": "./dist/index.cjs"
33
+ }
34
+ },
35
+ "./package.json": "./package.json"
36
+ },
37
+ "files": [
38
+ "dist",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "sideEffects": false,
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "engines": {
47
+ "node": ">=18"
48
+ },
49
+ "dependencies": {
50
+ "@ronza.ai/web": "^0.1.0"
51
+ },
52
+ "peerDependencies": {
53
+ "react": "^18.0.0 || ^19.0.0"
54
+ },
55
+ "devDependencies": {
56
+ "@testing-library/react": "^16.1.0",
57
+ "@types/node": "^22.0.0",
58
+ "@types/react": "^18.3.18",
59
+ "@types/react-dom": "^18.3.5",
60
+ "jsdom": "^25.0.1",
61
+ "react": "^18.3.1",
62
+ "react-dom": "^18.3.1",
63
+ "typescript": "^5.7.3",
64
+ "vite": "^6.0.11",
65
+ "vitest": "^2.0.0"
66
+ },
67
+ "scripts": {
68
+ "build": "pnpm --dir ../web run build && vite build && tsc -p tsconfig.build.json && node -e \"require('fs').copyFileSync('dist/index.d.ts','dist/index.d.cts')\"",
69
+ "test": "vitest run",
70
+ "typecheck": "tsc --noEmit -p tsconfig.json"
71
+ }
6
72
  }