@centive/aria-sdk 0.5.5 → 0.5.7
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/dist/context/AriaProvider.d.ts.map +1 -1
- package/dist/hooks/useAriaSession.d.ts +75 -0
- package/dist/hooks/useAriaSession.d.ts.map +1 -0
- package/dist/{index-B5eKfkTN.js → index-Bs6J26t3.js} +3 -3
- package/dist/{index-B5eKfkTN.js.map → index-Bs6J26t3.js.map} +1 -1
- package/dist/{index-B3GM9bzB.js → index-CvEEkyjV.js} +1187 -1114
- package/dist/index-CvEEkyjV.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -13
- package/dist/lib/AriaSessionManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-B3GM9bzB.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
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;AAU1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,
|
|
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;AAU1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAmb9C,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { SessionState, SessionManagerStatus } from '@/types';
|
|
2
|
+
/**
|
|
3
|
+
* Session information returned by useAriaSession hook
|
|
4
|
+
*/
|
|
5
|
+
export interface AriaSessionInfo {
|
|
6
|
+
/** Current session state including token, expiry, and readiness */
|
|
7
|
+
sessionState: SessionState;
|
|
8
|
+
/** Current status of the session manager */
|
|
9
|
+
status: SessionManagerStatus;
|
|
10
|
+
/** Whether the session is preloaded and ready for instant use */
|
|
11
|
+
isPreloaded: boolean;
|
|
12
|
+
/** Whether the session is currently paused (widget closed with persistSession: true) */
|
|
13
|
+
isPaused: boolean;
|
|
14
|
+
/** Whether the session is connected */
|
|
15
|
+
isConnected: boolean;
|
|
16
|
+
/** Whether the session is currently loading */
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
/** Current session ID if available */
|
|
19
|
+
sessionId: string | null;
|
|
20
|
+
/** Whether the session token is expired */
|
|
21
|
+
isExpired: boolean;
|
|
22
|
+
/** Whether the session is expiring soon (within refresh buffer) */
|
|
23
|
+
isExpiringSoon: boolean;
|
|
24
|
+
/** Time until session expires in milliseconds (null if no expiry) */
|
|
25
|
+
timeUntilExpiry: number | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Session control actions returned by useAriaSession hook
|
|
29
|
+
*/
|
|
30
|
+
export interface AriaSessionActions {
|
|
31
|
+
/** End the current session explicitly (for logout scenarios) */
|
|
32
|
+
endSession: () => Promise<void>;
|
|
33
|
+
/** Refresh the session token proactively */
|
|
34
|
+
refreshSession: () => Promise<void>;
|
|
35
|
+
/** Start a new session (if not already active) */
|
|
36
|
+
startSession: () => Promise<void>;
|
|
37
|
+
/** Trigger a session with optional user trigger flag */
|
|
38
|
+
triggerSession: (userTrigger?: boolean) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Return type for useAriaSession hook
|
|
42
|
+
*/
|
|
43
|
+
export interface UseAriaSessionReturn {
|
|
44
|
+
/** Session information and state */
|
|
45
|
+
session: AriaSessionInfo;
|
|
46
|
+
/** Session control actions */
|
|
47
|
+
actions: AriaSessionActions;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Hook to access and control Aria session state.
|
|
51
|
+
*
|
|
52
|
+
* This hook provides:
|
|
53
|
+
* - Session state information (token, expiry, status)
|
|
54
|
+
* - Session control actions (end, refresh, start)
|
|
55
|
+
* - Expiry tracking utilities
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const { session, actions } = useAriaSession();
|
|
60
|
+
*
|
|
61
|
+
* // Check session state
|
|
62
|
+
* if (session.isExpiringSoon) {
|
|
63
|
+
* console.log('Session expiring soon, will auto-refresh');
|
|
64
|
+
* }
|
|
65
|
+
*
|
|
66
|
+
* // End session on logout
|
|
67
|
+
* const handleLogout = async () => {
|
|
68
|
+
* await actions.endSession();
|
|
69
|
+
* // ... rest of logout logic
|
|
70
|
+
* };
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare const useAriaSession: () => UseAriaSessionReturn;
|
|
74
|
+
export default useAriaSession;
|
|
75
|
+
//# sourceMappingURL=useAriaSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAriaSession.d.ts","sourceRoot":"","sources":["../../src/hooks/useAriaSession.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,YAAY,EAAE,YAAY,CAAC;IAC3B,4CAA4C;IAC5C,MAAM,EAAE,oBAAoB,CAAC;IAC7B,iEAAiE;IACjE,WAAW,EAAE,OAAO,CAAC;IACrB,wFAAwF;IACxF,QAAQ,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,WAAW,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,SAAS,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,cAAc,EAAE,OAAO,CAAC;IACxB,qEAAqE;IACrE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,4CAA4C;IAC5C,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,kDAAkD;IAClD,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,wDAAwD;IACxD,cAAc,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oCAAoC;IACpC,OAAO,EAAE,eAAe,CAAC;IACzB,8BAA8B;IAC9B,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,cAAc,QAAO,oBAyFjC,CAAC;AAEF,eAAe,cAAc,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-CvEEkyjV.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-CvEEkyjV.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-Bs6J26t3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-Bs6J26t3.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]}
|