@centive/aria-sdk 0.3.1 → 0.4.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 +61 -31
- package/dist/components/AriaAssistant.d.ts +11 -2
- package/dist/components/AriaAssistant.d.ts.map +1 -1
- package/dist/components/AriaTriggerButton.d.ts +3 -2
- package/dist/components/AriaTriggerButton.d.ts.map +1 -1
- package/dist/components/AriaWidget.d.ts +2 -2
- package/dist/components/AriaWidget.d.ts.map +1 -1
- package/dist/components/ChatPanel.d.ts +2 -2
- package/dist/components/ChatPanel.d.ts.map +1 -1
- package/dist/components/SessionInfo.d.ts +2 -2
- package/dist/components/SessionInfo.d.ts.map +1 -1
- package/dist/components/ShadowContainer.d.ts +4 -4
- package/dist/components/ShadowContainer.d.ts.map +1 -1
- package/dist/context/AriaContext.d.ts +2 -2
- package/dist/context/AriaContext.d.ts.map +1 -1
- package/dist/context/AriaProvider.d.ts +3 -3
- package/dist/context/AriaProvider.d.ts.map +1 -1
- package/dist/{index-tD6uw6Jx.js → index-BqHnk4l5.js} +1297 -1261
- package/dist/index-BqHnk4l5.js.map +1 -0
- package/dist/{index-B_mgG08E.js → index-TbsycHlN.js} +3 -3
- package/dist/{index-B_mgG08E.js.map → index-TbsycHlN.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- 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 +7 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-tD6uw6Jx.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
|
-
import
|
|
2
|
-
|
|
1
|
+
import type { FC } from 'react';
|
|
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: 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,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,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,EAAE,CAAC,kBAAkB,CAwDhD,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FC } from 'react';
|
|
2
2
|
import type { ButtonProps } from '@/components/ui/button';
|
|
3
3
|
interface AriaTriggerButtonProps extends Omit<ButtonProps, 'onClick'> {
|
|
4
4
|
label?: string;
|
|
5
5
|
showIcon?: boolean;
|
|
6
6
|
showAvatar?: boolean;
|
|
7
|
+
onTrigger?: () => void;
|
|
7
8
|
}
|
|
8
|
-
export declare const AriaTriggerButton:
|
|
9
|
+
export declare const AriaTriggerButton: FC<AriaTriggerButtonProps>;
|
|
9
10
|
export {};
|
|
10
11
|
//# sourceMappingURL=AriaTriggerButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaTriggerButton.d.ts","sourceRoot":"","sources":["../../src/components/AriaTriggerButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AriaTriggerButton.d.ts","sourceRoot":"","sources":["../../src/components/AriaTriggerButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,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;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,EAAE,EAAE,CAAC,sBAAsB,CAkJxD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type FC } from 'react';
|
|
2
2
|
interface AriaWidgetProps {
|
|
3
3
|
onClose: () => void;
|
|
4
4
|
}
|
|
5
|
-
export declare const AriaWidget:
|
|
5
|
+
export declare const AriaWidget: FC<AriaWidgetProps>;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=AriaWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaWidget.d.ts","sourceRoot":"","sources":["../../src/components/AriaWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AriaWidget.d.ts","sourceRoot":"","sources":["../../src/components/AriaWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAOnD,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CA2T1C,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const ChatPanel:
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
export declare const ChatPanel: FC;
|
|
3
3
|
//# sourceMappingURL=ChatPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../../src/components/ChatPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ChatPanel.d.ts","sourceRoot":"","sources":["../../src/components/ChatPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAQ7D,eAAO,MAAM,SAAS,EAAE,EAmNvB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FC } from 'react';
|
|
2
2
|
interface SessionInfoProps {
|
|
3
3
|
compact?: boolean;
|
|
4
4
|
}
|
|
5
|
-
export declare const SessionInfo:
|
|
5
|
+
export declare const SessionInfo: FC<SessionInfoProps>;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=SessionInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionInfo.d.ts","sourceRoot":"","sources":["../../src/components/SessionInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionInfo.d.ts","sourceRoot":"","sources":["../../src/components/SessionInfo.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQhC,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAgM5C,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type FC, type ReactNode, type CSSProperties } from 'react';
|
|
2
2
|
interface ShadowContainerProps {
|
|
3
|
-
children:
|
|
3
|
+
children: ReactNode;
|
|
4
4
|
/** CSS string to inject into the shadow root */
|
|
5
5
|
styles?: string;
|
|
6
6
|
/** Optional class name for the shadow host element */
|
|
7
7
|
className?: string;
|
|
8
8
|
/** Optional inline styles for the shadow host element */
|
|
9
|
-
style?:
|
|
9
|
+
style?: CSSProperties;
|
|
10
10
|
/** Tag name for the shadow host element */
|
|
11
11
|
as?: 'div' | 'span' | 'section' | 'article' | 'aside' | 'main' | 'nav' | 'header' | 'footer';
|
|
12
12
|
}
|
|
@@ -20,6 +20,6 @@ interface ShadowContainerProps {
|
|
|
20
20
|
* - Prevents host app styles from affecting SDK components
|
|
21
21
|
* - Prevents SDK styles from leaking to host app
|
|
22
22
|
*/
|
|
23
|
-
export declare const ShadowContainer:
|
|
23
|
+
export declare const ShadowContainer: FC<ShadowContainerProps>;
|
|
24
24
|
export default ShadowContainer;
|
|
25
25
|
//# sourceMappingURL=ShadowContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShadowContainer.d.ts","sourceRoot":"","sources":["../../src/components/ShadowContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ShadowContainer.d.ts","sourceRoot":"","sources":["../../src/components/ShadowContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAGjG,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,2CAA2C;IAC3C,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;CAC9F;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAuEpD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatMessage, AriaSDKConfig, DisplayMode, TriggerMode, Theme, SessionState } from '@/types';
|
|
1
|
+
import type { ChatMessage, AriaSDKConfig, DisplayMode, TriggerMode, Theme, SessionState, TriggerSessionOptions } from '@/types';
|
|
2
2
|
export interface AriaContextType {
|
|
3
3
|
isOpen: boolean;
|
|
4
4
|
isConnected: boolean;
|
|
@@ -16,7 +16,7 @@ export interface AriaContextType {
|
|
|
16
16
|
toggleMute: () => void;
|
|
17
17
|
startSession: () => Promise<void>;
|
|
18
18
|
stopSession: () => Promise<void>;
|
|
19
|
-
triggerSession: () => void;
|
|
19
|
+
triggerSession: (options?: TriggerSessionOptions) => void;
|
|
20
20
|
displayMode: DisplayMode;
|
|
21
21
|
triggerMode: TriggerMode;
|
|
22
22
|
theme: Theme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaContext.d.ts","sourceRoot":"","sources":["../../src/context/AriaContext.tsx"],"names":[],"mappings":"AACA,OAAO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
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
2
|
import type { AriaSDKConfig } from '@/types';
|
|
3
3
|
interface AriaProviderProps {
|
|
4
4
|
config: AriaSDKConfig;
|
|
5
|
-
children
|
|
5
|
+
children?: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare const AriaProvider:
|
|
7
|
+
export declare const AriaProvider: FC<AriaProviderProps>;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=AriaProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaProvider.d.ts","sourceRoot":"","sources":["../../src/context/AriaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AriaProvider.d.ts","sourceRoot":"","sources":["../../src/context/AriaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAoB1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAM7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAgGD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAmiB9C,CAAC"}
|