@ram_28/kf-ai-sdk 1.0.3 → 1.0.4
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 +3 -28
- package/dist/auth/authConfig.d.ts +1 -1
- package/dist/auth/index.d.ts +2 -3
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +317 -331
- package/package.json +1 -1
- package/sdk/auth/authConfig.ts +4 -4
- package/sdk/auth/index.ts +2 -21
package/README.md
CHANGED
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
// Authentication
|
|
32
32
|
AuthProvider,
|
|
33
33
|
useAuth,
|
|
34
|
-
configureAuth,
|
|
35
34
|
|
|
36
35
|
// Hooks
|
|
37
36
|
useForm,
|
|
@@ -41,15 +40,11 @@ import {
|
|
|
41
40
|
|
|
42
41
|
// API
|
|
43
42
|
api,
|
|
44
|
-
setApiBaseUrl,
|
|
45
43
|
|
|
46
44
|
// Utilities
|
|
47
45
|
formatCurrency,
|
|
48
46
|
formatDate
|
|
49
47
|
} from '@ram_28/kf-ai-sdk';
|
|
50
|
-
|
|
51
|
-
// Configure API base URL
|
|
52
|
-
setApiBaseUrl('https://api.example.com');
|
|
53
48
|
```
|
|
54
49
|
|
|
55
50
|
## Authentication
|
|
@@ -58,38 +53,18 @@ The SDK provides a complete authentication solution with cookie-based session ma
|
|
|
58
53
|
|
|
59
54
|
### Setup
|
|
60
55
|
|
|
61
|
-
Wrap your app with `AuthProvider` inside a `QueryClientProvider
|
|
56
|
+
Wrap your app with `AuthProvider` inside a `QueryClientProvider`. No configuration required - it works out of the box:
|
|
62
57
|
|
|
63
58
|
```tsx
|
|
64
59
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
65
|
-
import { AuthProvider
|
|
66
|
-
|
|
67
|
-
// Configure API
|
|
68
|
-
setApiBaseUrl('https://api.example.com');
|
|
69
|
-
|
|
70
|
-
// Optional: customize auth settings
|
|
71
|
-
configureAuth({
|
|
72
|
-
defaultProvider: 'google',
|
|
73
|
-
autoRedirect: true,
|
|
74
|
-
refetchOnWindowFocus: false, // Disable session check on tab switch
|
|
75
|
-
refetchOnReconnect: true, // Re-check session on network reconnect
|
|
76
|
-
providers: {
|
|
77
|
-
google: {
|
|
78
|
-
loginPath: '/api/auth/google/login',
|
|
79
|
-
logoutPath: '/api/auth/logout',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
});
|
|
60
|
+
import { AuthProvider } from '@ram_28/kf-ai-sdk';
|
|
83
61
|
|
|
84
62
|
const queryClient = new QueryClient();
|
|
85
63
|
|
|
86
64
|
function App() {
|
|
87
65
|
return (
|
|
88
66
|
<QueryClientProvider client={queryClient}>
|
|
89
|
-
<AuthProvider
|
|
90
|
-
loadingComponent={<div>Loading...</div>}
|
|
91
|
-
onAuthChange={(status, user) => console.log('Auth:', status, user)}
|
|
92
|
-
>
|
|
67
|
+
<AuthProvider>
|
|
93
68
|
<MyApp />
|
|
94
69
|
</AuthProvider>
|
|
95
70
|
</QueryClientProvider>
|
|
@@ -24,7 +24,7 @@ export declare function setAuthProvider(provider: AuthProviderName, config: Auth
|
|
|
24
24
|
export declare function getAuthConfig(): Readonly<AuthConfig>;
|
|
25
25
|
/**
|
|
26
26
|
* Get the base URL for auth endpoints
|
|
27
|
-
* Falls back to API base URL
|
|
27
|
+
* Falls back to API base URL, then window.location.origin
|
|
28
28
|
*/
|
|
29
29
|
export declare function getAuthBaseUrl(): string;
|
|
30
30
|
/**
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { AuthProvider } from "./AuthProvider";
|
|
2
2
|
export { useAuth } from "./useAuth";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export type { UserDetails, SessionResponse, AuthStatus, AuthConfig, AuthProviderName, AuthEndpointConfig, AuthProviderProps, UseAuthReturn, LoginOptions, LogoutOptions, } from "./types";
|
|
3
|
+
export { AuthenticationError } from "./authClient";
|
|
4
|
+
export type { UserDetails, SessionResponse, AuthStatus, AuthProviderProps, UseAuthReturn, } from "./types";
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sdk/auth/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sdk/auth/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,YAAY,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,aAAa,GACd,MAAM,SAAS,CAAC"}
|