@meridial/react 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 +21 -0
- package/README.md +134 -0
- package/dist/chunk-QCWLFL7O.js +4294 -0
- package/dist/chunk-QCWLFL7O.js.map +1 -0
- package/dist/chunk-VDQAVB4N.js +1754 -0
- package/dist/chunk-VDQAVB4N.js.map +1 -0
- package/dist/chunk-WCRZUGN4.js +1933 -0
- package/dist/chunk-WCRZUGN4.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/recorder.d.ts +11 -0
- package/dist/recorder.js +9 -0
- package/dist/recorder.js.map +1 -0
- package/dist/styles.css +6012 -0
- package/dist/voicebox-DCgECemo.d.ts +27 -0
- package/dist/voicebox.d.ts +3 -0
- package/dist/voicebox.js +9 -0
- package/dist/voicebox.js.map +1 -0
- package/package.json +68 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Meridial
|
|
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
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# `@meridial/react`
|
|
2
|
+
|
|
3
|
+
React components for embedding the Meridial in-app assistant UI (`Voicebox`) and workflow recorder UI (`Recorder`).
|
|
4
|
+
|
|
5
|
+
## Exports
|
|
6
|
+
|
|
7
|
+
- **`Voicebox`**: embedded assistant widget (badge + draggable conversation bar).
|
|
8
|
+
- **`Recorder`**: draggable recorder UI that captures click-steps + microphone narration and stores workflows locally (and can read server workflows when authenticated).
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
npm i @meridial/react
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## `Voicebox`
|
|
17
|
+
|
|
18
|
+
### Props
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
interface VoiceboxProps {
|
|
22
|
+
firstMessage?: string
|
|
23
|
+
instructions?: string
|
|
24
|
+
baseUrl?: string
|
|
25
|
+
publishableKey?: string
|
|
26
|
+
identifier?: string | null
|
|
27
|
+
tools?: VoiceboxTool[]
|
|
28
|
+
triggerIcon?: React.ReactNode
|
|
29
|
+
cursor?: React.ReactNode
|
|
30
|
+
metadata?: Record<string, string>
|
|
31
|
+
onError?: (error: string) => void
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Minimal example (Next.js / React)
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
"use client"
|
|
39
|
+
|
|
40
|
+
import { z } from "zod"
|
|
41
|
+
import { Voicebox, defineTool, type VoiceboxTool } from "@meridial/react"
|
|
42
|
+
|
|
43
|
+
const tools: VoiceboxTool[] = [
|
|
44
|
+
defineTool({
|
|
45
|
+
name: "current_weather",
|
|
46
|
+
description: "Get the current weather for a given location.",
|
|
47
|
+
parameters: z.object({
|
|
48
|
+
location: z.string(),
|
|
49
|
+
}),
|
|
50
|
+
execute: async ({ location }) => {
|
|
51
|
+
// Runs in the browser/client.
|
|
52
|
+
return { location, weather: "sunny", temperature: "24°C" }
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
export function VoiceboxWidget({
|
|
58
|
+
publishableKey,
|
|
59
|
+
identifier,
|
|
60
|
+
}: {
|
|
61
|
+
publishableKey: string
|
|
62
|
+
identifier: string | null
|
|
63
|
+
}) {
|
|
64
|
+
return (
|
|
65
|
+
<Voicebox
|
|
66
|
+
baseUrl="https://app.meridial.dev"
|
|
67
|
+
publishableKey={publishableKey}
|
|
68
|
+
identifier={identifier}
|
|
69
|
+
firstMessage="Hi, I am a meridial agent. How can I help you today ?"
|
|
70
|
+
instructions="You are a helpful assistant that can answer questions and help with tasks."
|
|
71
|
+
tools={tools}
|
|
72
|
+
metadata={{ orgId: "org_123..." }}
|
|
73
|
+
onError={(err) => console.error("[Voicebox]", err)}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## `Recorder`
|
|
80
|
+
|
|
81
|
+
### Props
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
interface RecorderProps {
|
|
85
|
+
baseUrl?: string
|
|
86
|
+
publishableKey?: string
|
|
87
|
+
cursor?: React.ReactNode
|
|
88
|
+
onError?: (error: string) => void
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Minimal example
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
"use client"
|
|
96
|
+
|
|
97
|
+
import { Recorder } from "@meridial/react"
|
|
98
|
+
|
|
99
|
+
export function RecorderWidget({ publishableKey }: { publishableKey?: string }) {
|
|
100
|
+
return (
|
|
101
|
+
<Recorder
|
|
102
|
+
baseUrl=""
|
|
103
|
+
publishableKey={publishableKey}
|
|
104
|
+
onError={(err) => console.error("[Recorder]", err)}
|
|
105
|
+
/>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Styling / UI
|
|
111
|
+
|
|
112
|
+
These components use Tailwind CSS classes and are designed to work with your existing Tailwind / shadcn setup.
|
|
113
|
+
|
|
114
|
+
You can integrate styles in either of these ways:
|
|
115
|
+
|
|
116
|
+
### Option 1: include `@meridial/react` in your Tailwind sources
|
|
117
|
+
|
|
118
|
+
If your app compiles Tailwind itself, make sure your global stylesheet scans the React package too.
|
|
119
|
+
|
|
120
|
+
```css
|
|
121
|
+
@source "../node_modules/@meridial/react/dist/**/*.{js,mjs}";
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Adjust the relative path so it is correct from your own global stylesheet location.
|
|
125
|
+
|
|
126
|
+
### Option 2: import the built CSS directly
|
|
127
|
+
|
|
128
|
+
If you do not want Tailwind to scan the package, import the package CSS in your global stylesheet instead:
|
|
129
|
+
|
|
130
|
+
```css
|
|
131
|
+
@import "@meridial/react/dist/styles.css";
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Use this approach when you want the package to provide its own prebuilt styles instead of relying on your app's Tailwind build to generate them.
|