@ai-chans/sdk-react 0.2.0 → 0.2.1
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/README.md +7 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -2
- package/src/index.tsx +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# chans
|
|
1
|
+
# @ai-chans/sdk-react
|
|
2
2
|
|
|
3
3
|
React components and hooks for [chans.ai](https://chans.ai) voice AI.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install chans
|
|
8
|
+
npm install @ai-chans/sdk-react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Requires React 18 or 19.
|
|
@@ -17,7 +17,7 @@ Requires React 18 or 19.
|
|
|
17
17
|
Drop in a ready-to-use voice button:
|
|
18
18
|
|
|
19
19
|
```tsx
|
|
20
|
-
import { ChansVoice } from "chans
|
|
20
|
+
import { ChansVoice } from "@ai-chans/sdk-react"
|
|
21
21
|
|
|
22
22
|
function App() {
|
|
23
23
|
return (
|
|
@@ -35,7 +35,7 @@ function App() {
|
|
|
35
35
|
Build your own interface with render props:
|
|
36
36
|
|
|
37
37
|
```tsx
|
|
38
|
-
import { ChansVoice } from "chans
|
|
38
|
+
import { ChansVoice } from "@ai-chans/sdk-react"
|
|
39
39
|
|
|
40
40
|
function App() {
|
|
41
41
|
return (
|
|
@@ -64,7 +64,7 @@ function App() {
|
|
|
64
64
|
Access voice state from nested components:
|
|
65
65
|
|
|
66
66
|
```tsx
|
|
67
|
-
import { ChansVoice, useChans } from "chans
|
|
67
|
+
import { ChansVoice, useChans } from "@ai-chans/sdk-react"
|
|
68
68
|
|
|
69
69
|
function VoiceButton() {
|
|
70
70
|
const { state, connect, disconnect, isConnected } = useChans()
|
|
@@ -145,7 +145,7 @@ type ChansState =
|
|
|
145
145
|
|
|
146
146
|
```tsx
|
|
147
147
|
import { useState } from "react"
|
|
148
|
-
import { ChansVoice } from "chans
|
|
148
|
+
import { ChansVoice } from "@ai-chans/sdk-react"
|
|
149
149
|
|
|
150
150
|
function Chat() {
|
|
151
151
|
const [messages, setMessages] = useState<Array<{role: string, text: string}>>([])
|
|
@@ -175,7 +175,7 @@ function Chat() {
|
|
|
175
175
|
### Manual Connect/Disconnect
|
|
176
176
|
|
|
177
177
|
```tsx
|
|
178
|
-
import { ChansVoice } from "chans
|
|
178
|
+
import { ChansVoice } from "@ai-chans/sdk-react"
|
|
179
179
|
|
|
180
180
|
function App() {
|
|
181
181
|
return (
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChansState } from "@
|
|
2
|
-
export type { ChansState } from "@
|
|
1
|
+
import { ChansState } from "@ai-chans/sdk-js";
|
|
2
|
+
export type { ChansState } from "@ai-chans/sdk-js";
|
|
3
3
|
export interface ChansVoiceProps {
|
|
4
4
|
/**
|
|
5
5
|
* Agent token from chans.ai dashboard
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAe,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAe,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG1D,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;OAEG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
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect, useCallback, useRef, useMemo, createContext, useContext, } from "react";
|
|
4
|
-
import { ChansClient } from "@
|
|
4
|
+
import { ChansClient } from "@ai-chans/sdk-js";
|
|
5
5
|
const ChansContext = createContext(null);
|
|
6
6
|
/**
|
|
7
7
|
* Hook to access ChansVoice state from child components
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-chans/sdk-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"license": "Apache-2.0",
|
|
4
5
|
"repository": {
|
|
5
6
|
"type": "git",
|
|
6
7
|
"url": "https://github.com/ai-chans/sdk.git",
|
|
7
|
-
"directory": "react"
|
|
8
|
+
"directory": "sdk-react"
|
|
8
9
|
},
|
|
9
10
|
"description": "React component for chans.ai voice AI",
|
|
10
11
|
"type": "module",
|
package/src/index.tsx
CHANGED
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
createContext,
|
|
10
10
|
useContext,
|
|
11
11
|
} from "react"
|
|
12
|
-
import { ChansClient, ChansState } from "@
|
|
12
|
+
import { ChansClient, ChansState } from "@ai-chans/sdk-js"
|
|
13
13
|
|
|
14
14
|
// Re-export client types
|
|
15
|
-
export type { ChansState } from "@
|
|
15
|
+
export type { ChansState } from "@ai-chans/sdk-js"
|
|
16
16
|
|
|
17
17
|
export interface ChansVoiceProps {
|
|
18
18
|
/**
|