@centive/aria-sdk 0.3.0 → 0.4.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/README.md +61 -31
- package/dist/components/AriaAssistant.d.ts +10 -1
- package/dist/components/AriaAssistant.d.ts.map +1 -1
- package/dist/components/AriaTriggerButton.d.ts.map +1 -1
- package/dist/context/AriaProvider.d.ts +1 -1
- package/dist/context/AriaProvider.d.ts.map +1 -1
- package/dist/{index-SOt2llBN.js → index-BhEwL6TA.js} +3 -3
- package/dist/{index-SOt2llBN.js.map → index-BhEwL6TA.js.map} +1 -1
- package/dist/{index-BP2VXIUE.js → index-Bwp7d2Nw.js} +866 -838
- package/dist/index-Bwp7d2Nw.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -25
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-BP2VXIUE.js.map +0 -1
package/README.md
CHANGED
|
@@ -54,49 +54,71 @@ npm install react@^18.0.0 react-dom@^18.0.0
|
|
|
54
54
|
|
|
55
55
|
## 🚀 Quick Start
|
|
56
56
|
|
|
57
|
-
### 1.
|
|
57
|
+
### 1. Simple Integration (Recommended)
|
|
58
|
+
|
|
59
|
+
The SDK provides an all-in-one container that handles WebSocket connection, state management, and the UI. Just import and drop it in! By default, this includes both the floating trigger button and the assistant widget.
|
|
58
60
|
|
|
59
61
|
```tsx
|
|
60
|
-
import {
|
|
62
|
+
import { Aria } from '@centive/aria-sdk';
|
|
61
63
|
import '@centive/aria-sdk/styles.css';
|
|
62
64
|
|
|
63
65
|
function App() {
|
|
64
|
-
// Note: Persona configuration is now handled by the backend
|
|
65
|
-
// The backend determines which persona to display based on user context
|
|
66
66
|
const config = {
|
|
67
67
|
websocketUrl: 'ws://localhost:8000/ws',
|
|
68
|
-
userId: 'user_123',
|
|
68
|
+
userId: 'user_123',
|
|
69
69
|
theme: 'light', // or 'dark'
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
// This automatically renders the Trigger Button and Assistant Widget
|
|
74
|
+
<Aria config={config}>
|
|
75
|
+
<YourApp />
|
|
76
|
+
</Aria>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Advanced Integration (Manual Placement)
|
|
82
|
+
|
|
83
|
+
If you need full control over where components are rendered, you can disable the automatic rendering and place the component yourself:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { AriaProvider, AriaAssistant } from '@centive/aria-sdk';
|
|
87
|
+
|
|
88
|
+
function App() {
|
|
89
|
+
const config = {
|
|
90
|
+
websocketUrl: 'ws://localhost:8000/ws',
|
|
91
|
+
userId: 'user_123',
|
|
92
|
+
showAssistant: false, // Disable automatic rendering
|
|
89
93
|
};
|
|
90
94
|
|
|
91
95
|
return (
|
|
92
96
|
<AriaProvider config={config}>
|
|
93
97
|
<YourApp />
|
|
94
98
|
|
|
95
|
-
{/*
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
{/* AriaAssistant includes both the trigger button and the widget */}
|
|
100
|
+
<AriaAssistant
|
|
101
|
+
showTrigger={true} // Show floating trigger button
|
|
102
|
+
showAvatar={true} // Show avatar in trigger
|
|
103
|
+
triggerLabel="Chat" // Custom button label
|
|
104
|
+
/>
|
|
105
|
+
</AriaProvider>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. Trigger Button Only (No Auto-Popup)
|
|
111
|
+
|
|
112
|
+
If you only want the trigger button without the automatic assistant:
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { AriaProvider, AriaTriggerButton } from '@centive/aria-sdk';
|
|
116
|
+
|
|
117
|
+
function App() {
|
|
118
|
+
return (
|
|
119
|
+
<AriaProvider config={config}>
|
|
120
|
+
<YourApp />
|
|
121
|
+
<AriaTriggerButton showAvatar={true} label="Help" />
|
|
100
122
|
</AriaProvider>
|
|
101
123
|
);
|
|
102
124
|
}
|
|
@@ -177,10 +199,14 @@ Main provider component that wraps your application.
|
|
|
177
199
|
|
|
178
200
|
### AriaAssistant
|
|
179
201
|
|
|
180
|
-
|
|
202
|
+
Complete assistant component that includes both the floating trigger button and the assistant widget.
|
|
181
203
|
|
|
182
204
|
```tsx
|
|
183
|
-
<AriaAssistant
|
|
205
|
+
<AriaAssistant
|
|
206
|
+
showTrigger={true} // Show floating trigger button (default: true)
|
|
207
|
+
showAvatar={true} // Show avatar in trigger button (default: true)
|
|
208
|
+
triggerLabel="Chat" // Optional custom label for trigger button
|
|
209
|
+
/>
|
|
184
210
|
```
|
|
185
211
|
|
|
186
212
|
### AriaTriggerButton
|
|
@@ -248,6 +274,10 @@ interface AriaSDKConfig {
|
|
|
248
274
|
onMessageStreamAck?: () => void;
|
|
249
275
|
onSessionEndAck?: (savedCount: number) => void;
|
|
250
276
|
onSessionEndError?: (error: string, errorType: string) => void;
|
|
277
|
+
|
|
278
|
+
// Rendering options
|
|
279
|
+
showFloatingButton?: boolean; // Show the default floating button (default: true)
|
|
280
|
+
showAssistant?: boolean; // Show the assistant widget (default: true)
|
|
251
281
|
}
|
|
252
282
|
```
|
|
253
283
|
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
interface AriaAssistantProps {
|
|
3
|
+
/** Show the floating trigger button (default: true) */
|
|
4
|
+
showTrigger?: boolean;
|
|
5
|
+
/** Show avatar in trigger button (default: true) */
|
|
6
|
+
showAvatar?: boolean;
|
|
7
|
+
/** Custom label for trigger button */
|
|
8
|
+
triggerLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const AriaAssistant: React.FC<AriaAssistantProps>;
|
|
11
|
+
export {};
|
|
3
12
|
//# sourceMappingURL=AriaAssistant.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaAssistant.d.ts","sourceRoot":"","sources":["../../src/components/AriaAssistant.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AriaAssistant.d.ts","sourceRoot":"","sources":["../../src/components/AriaAssistant.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,UAAU,kBAAkB;IAC1B,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwDtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaTriggerButton.d.ts","sourceRoot":"","sources":["../../src/components/AriaTriggerButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1D,UAAU,sBAAuB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"AriaTriggerButton.d.ts","sourceRoot":"","sources":["../../src/components/AriaTriggerButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAK1D,UAAU,sBAAuB,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA2I9D,CAAC"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { AriaSDKConfig } from '@/types';
|
|
3
3
|
interface AriaProviderProps {
|
|
4
4
|
config: AriaSDKConfig;
|
|
5
|
-
children
|
|
5
|
+
children?: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare const AriaProvider: React.FC<AriaProviderProps>;
|
|
8
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaProvider.d.ts","sourceRoot":"","sources":["../../src/context/AriaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAmBxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"AriaProvider.d.ts","sourceRoot":"","sources":["../../src/context/AriaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAmBxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAM7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAgGD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAkhBpD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as n } from "./index-
|
|
2
|
-
import { d as i, b as C, a as d, C as l, c as m, D as A, E as c, I as g, M as u, S as E } from "./index-
|
|
1
|
+
import { A as n } from "./index-Bwp7d2Nw.js";
|
|
2
|
+
import { d as i, b as C, a as d, C as l, c as m, D as A, E as c, I as g, M as u, S as E } from "./index-Bwp7d2Nw.js";
|
|
3
3
|
const t = (e, a) => new n(e, void 0, a);
|
|
4
4
|
export {
|
|
5
5
|
i as AgentAudioInputStream,
|
|
@@ -14,4 +14,4 @@ export {
|
|
|
14
14
|
E as SignalMessageAction,
|
|
15
15
|
t as createClient
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=index-
|
|
17
|
+
//# sourceMappingURL=index-BhEwL6TA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-BhEwL6TA.js","sources":["../node_modules/@anam-ai/js-sdk/dist/module/index.js"],"sourcesContent":["import AnamClient from './AnamClient';\nimport { ClientError, ErrorCode } from './lib/ClientError';\n/**\n * Create a new Anam client.\n * @param sessionToken - A session token can be obtained from the Anam API.\n * @param personaConfig - The persona configuration to use.\n * @param options - Additional options.\n * @returns A new Anam client instance.\n */\nconst createClient = (sessionToken, options) => {\n return new AnamClient(sessionToken, undefined, options);\n};\n/**\n * Create a new Anam client with an API key instead of a session token.\n * This method is unsafe for production environments because it requires exposing your API key to the client side.\n * Only use this method for local testing.\n * @param apiKey - Your Anam API key.\n * @param personaConfig - The persona configuration to use.\n * @param options - Additional options.\n * @returns A new Anam client instance.\n */\nconst unsafe_createClientWithApiKey = (apiKey, personaConfig, options) => {\n return new AnamClient(undefined, personaConfig, Object.assign(Object.assign({}, options), { apiKey }));\n};\nexport { createClient, unsafe_createClientWithApiKey, ClientError, ErrorCode };\nexport * from './types';\n//# sourceMappingURL=index.js.map"],"names":["createClient","sessionToken","options","AnamClient"],"mappings":";;AASK,MAACA,IAAe,CAACC,GAAcC,MACzB,IAAIC,EAAWF,GAAc,QAAWC,CAAO;","x_google_ignoreList":[0]}
|