@merit-systems/echo-react-sdk 1.0.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 +70 -0
- package/dist/echo-react-sdk.umd.js +4 -0
- package/dist/echo-react-sdk.umd.js.map +1 -0
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +94 -0
- package/dist/index.js +8337 -0
- package/dist/index.js.map +1 -0
- package/package.json +92 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Balance } from '@merit-systems/echo-typescript-sdk';
|
|
2
|
+
import { default as default_2 } from 'react';
|
|
3
|
+
import { EchoContextValue as EchoContextValue_2 } from '..';
|
|
4
|
+
import { FreeBalance } from '@merit-systems/echo-typescript-sdk';
|
|
5
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
6
|
+
import { OpenAI as OpenAI_2 } from 'openai';
|
|
7
|
+
import { ReactNode } from 'react';
|
|
8
|
+
|
|
9
|
+
export declare type EchoBalance = Balance;
|
|
10
|
+
|
|
11
|
+
export declare interface EchoConfig {
|
|
12
|
+
appId: string;
|
|
13
|
+
apiUrl?: string;
|
|
14
|
+
redirectUri?: string;
|
|
15
|
+
scope?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export declare interface EchoContextValue {
|
|
19
|
+
user: EchoUser | null;
|
|
20
|
+
balance: EchoBalance | null;
|
|
21
|
+
freeTierBalance: FreeBalance | null;
|
|
22
|
+
isAuthenticated: boolean;
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
error: string | null;
|
|
25
|
+
token: string | null;
|
|
26
|
+
signIn: () => Promise<void>;
|
|
27
|
+
signOut: () => Promise<void>;
|
|
28
|
+
refreshBalance: () => Promise<void>;
|
|
29
|
+
createPaymentLink: (amount: number, description?: string, successUrl?: string) => Promise<string>;
|
|
30
|
+
getToken: () => Promise<string | null>;
|
|
31
|
+
clearAuth: () => Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare function EchoProvider({ config, children }: EchoProviderProps): JSX_2.Element;
|
|
35
|
+
|
|
36
|
+
declare interface EchoProviderProps {
|
|
37
|
+
config: EchoConfig;
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export declare function EchoSignIn({ onSuccess, onError, className, children, }: EchoSignInProps): JSX_2.Element;
|
|
42
|
+
|
|
43
|
+
export declare interface EchoSignInProps {
|
|
44
|
+
onSuccess?: (user: EchoUser) => void;
|
|
45
|
+
onError?: (error: Error) => void;
|
|
46
|
+
className?: string;
|
|
47
|
+
children?: React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare function EchoTokenPurchase({ amount, onPurchaseComplete, onError, className, children, }: EchoTokenPurchaseProps): JSX_2.Element;
|
|
51
|
+
|
|
52
|
+
export declare interface EchoTokenPurchaseProps {
|
|
53
|
+
amount?: number;
|
|
54
|
+
onPurchaseComplete?: (balance: EchoBalance) => void;
|
|
55
|
+
onError?: (error: Error) => void;
|
|
56
|
+
className?: string;
|
|
57
|
+
children?: React.ReactNode;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare interface EchoUser {
|
|
61
|
+
id: string;
|
|
62
|
+
email: string;
|
|
63
|
+
name?: string;
|
|
64
|
+
picture?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export declare const Logo: default_2.FC<LogoProps>;
|
|
68
|
+
|
|
69
|
+
declare interface LogoProps {
|
|
70
|
+
className?: string;
|
|
71
|
+
width?: number;
|
|
72
|
+
height?: number;
|
|
73
|
+
variant?: 'light' | 'dark';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare type OpenAI = OpenAI_2;
|
|
77
|
+
|
|
78
|
+
export declare function useEcho(): EchoContextValue_2;
|
|
79
|
+
|
|
80
|
+
export declare function useEchoOpenAI(options?: UseEchoOpenAIOptions): UseEchoOpenAIResult;
|
|
81
|
+
|
|
82
|
+
declare interface UseEchoOpenAIOptions {
|
|
83
|
+
baseURL?: string;
|
|
84
|
+
enabled?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
declare interface UseEchoOpenAIResult {
|
|
88
|
+
openai: OpenAI;
|
|
89
|
+
isReady: boolean;
|
|
90
|
+
error: string | null;
|
|
91
|
+
isLoading: boolean;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export { }
|