@ringg/core 0.0.1-alpha.10
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 +93 -0
- package/dist/index.cjs +757 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +762 -0
- package/dist/index.d.ts +762 -0
- package/dist/index.js +718 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ringg AI
|
|
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,93 @@
|
|
|
1
|
+
# @ringg/core
|
|
2
|
+
|
|
3
|
+
Shared core for [Ringg AI](https://ringg.ai) SDKs. This package is installed automatically as a dependency of platform SDKs like `@ringg/react-native` — you don't need to install it directly.
|
|
4
|
+
|
|
5
|
+
## When would I use this?
|
|
6
|
+
|
|
7
|
+
If you're building a custom Ringg integration outside of our official SDKs, `@ringg/core` gives you:
|
|
8
|
+
|
|
9
|
+
- **TypeScript types** for config, themes, messages, events, and interactive components
|
|
10
|
+
- **API client** to start agent calls and submit feedback
|
|
11
|
+
- **Theme engine** with preset themes and gradient support
|
|
12
|
+
- **State management** for widget lifecycle
|
|
13
|
+
- **Utility functions** for formatting, identity checks, and more
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @ringg/core
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick example
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { type RinggWidgetConfig, type ChatMessage, ApiClient, mergeWidgetTheme, DEFAULT_WIDGET_THEME, WIDGET_PRESET_THEMES } from "@ringg/core";
|
|
25
|
+
|
|
26
|
+
// Create an API client
|
|
27
|
+
const api = new ApiClient({
|
|
28
|
+
baseUrl: "https://api.ringg.ai/ca/api/v0",
|
|
29
|
+
apiKey: "your-api-key",
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Start a voice call
|
|
33
|
+
const { call_id, user_token } = await api.startWebcall({
|
|
34
|
+
agentId: "your-agent-id",
|
|
35
|
+
variables: { callee_name: "Jane" },
|
|
36
|
+
mediaType: "audio",
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Submit post-call feedback
|
|
40
|
+
await api.submitFeedback(call_id, {
|
|
41
|
+
rating: 5,
|
|
42
|
+
comment: "Great experience!",
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Available exports
|
|
47
|
+
|
|
48
|
+
### Types
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import type {
|
|
52
|
+
RinggWidgetConfig, // Main config object
|
|
53
|
+
MediaType, // "audio" | "text"
|
|
54
|
+
ChatMessage, // { message, isSelf, name, timestamp }
|
|
55
|
+
WidgetTheme, // Theme customization
|
|
56
|
+
ResolvedWidgetTheme, // Theme with all defaults filled
|
|
57
|
+
ConnectionState, // "connected" | "disconnected" | "reconnecting"
|
|
58
|
+
WidgetEventName, // Event name union
|
|
59
|
+
WidgetEventMap, // Type-safe event → payload mapping
|
|
60
|
+
SlashCommand, // Agent slash command definition
|
|
61
|
+
ComponentPayload, // Interactive component data
|
|
62
|
+
} from "@ringg/core";
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Utilities
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import {
|
|
69
|
+
DEFAULT_CONFIG, // Default widget config values
|
|
70
|
+
DEFAULT_WIDGET_THEME, // Default theme
|
|
71
|
+
WIDGET_PRESET_THEMES, // Built-in theme presets
|
|
72
|
+
mergeWidgetTheme, // Merge partial theme with defaults
|
|
73
|
+
colorToSolid, // Extract solid color from gradient string
|
|
74
|
+
isGradient, // Check if a color string is a gradient
|
|
75
|
+
getButtonRadius, // Get button border radius from theme
|
|
76
|
+
formatTimestamp, // Format Unix timestamp to readable time
|
|
77
|
+
isAgentIdentity, // Check if a participant identity belongs to an agent
|
|
78
|
+
groupSlotsByDate, // Group calendar slots by date
|
|
79
|
+
formatSlotTime, // Format slot time for display
|
|
80
|
+
formatSlotDate, // Format slot date for display
|
|
81
|
+
filterSlashCommands, // Filter slash commands by text input
|
|
82
|
+
} from "@ringg/core";
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Platform SDKs
|
|
86
|
+
|
|
87
|
+
For building apps, use the platform-specific SDK instead:
|
|
88
|
+
|
|
89
|
+
- **React Native** — [`@ringg/react-native`](https://www.npmjs.com/package/@ringg/react-native)
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
[MIT](./LICENSE)
|