@githat/nextjs 0.2.5 → 0.2.6

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/index.d.mts CHANGED
@@ -7,6 +7,11 @@ interface GitHatUser {
7
7
  name: string;
8
8
  avatarUrl: string | null;
9
9
  emailVerified: boolean;
10
+ githubUsername?: string;
11
+ cognitoUsername?: string;
12
+ cognitoSub?: string;
13
+ googleId?: string;
14
+ authProvider?: 'email' | 'github' | 'cognito' | 'google';
10
15
  }
11
16
  interface GitHatOrg {
12
17
  id: string;
@@ -105,6 +110,33 @@ declare function useGitHat(): {
105
110
  resendVerificationEmail: (email: string) => Promise<{
106
111
  success: boolean;
107
112
  }>;
113
+ getGitHubOAuthUrl: (options?: {
114
+ redirectUri?: string;
115
+ state?: string;
116
+ }) => Promise<{
117
+ url: string;
118
+ }>;
119
+ signInWithGitHub: (code: string, options?: {
120
+ redirectUri?: string;
121
+ }) => Promise<{
122
+ user: GitHatUser;
123
+ org: GitHatOrg | null;
124
+ isNewUser: boolean;
125
+ }>;
126
+ getCognitoOAuthUrl: (options?: {
127
+ redirectUri?: string;
128
+ state?: string;
129
+ identityProvider?: string;
130
+ }) => Promise<{
131
+ url: string;
132
+ }>;
133
+ signInWithCognito: (code: string, options?: {
134
+ redirectUri?: string;
135
+ }) => Promise<{
136
+ user: GitHatUser;
137
+ org: GitHatOrg | null;
138
+ isNewUser: boolean;
139
+ }>;
108
140
  };
109
141
 
110
142
  interface DataItem {
@@ -279,6 +311,86 @@ interface ChangePasswordFormProps {
279
311
  }
280
312
  declare function ChangePasswordForm({ onSuccess, onError, minPasswordLength, }: ChangePasswordFormProps): react_jsx_runtime.JSX.Element;
281
313
 
314
+ interface GitHubButtonProps {
315
+ /** Text to display on the button */
316
+ children?: React.ReactNode;
317
+ /** Custom redirect URI after GitHub auth */
318
+ redirectUri?: string;
319
+ /** Callback on successful auth */
320
+ onSuccess?: (result: {
321
+ user: any;
322
+ org: any;
323
+ isNewUser: boolean;
324
+ }) => void;
325
+ /** Callback on error */
326
+ onError?: (error: Error) => void;
327
+ /** Additional class names */
328
+ className?: string;
329
+ /** Button variant */
330
+ variant?: 'default' | 'outline';
331
+ /** Disable the button */
332
+ disabled?: boolean;
333
+ }
334
+ declare function GitHubButton({ children, redirectUri, onSuccess, onError, className, variant, disabled, }: GitHubButtonProps): react_jsx_runtime.JSX.Element;
335
+
336
+ interface GitHubCallbackProps {
337
+ /** URL to redirect to after successful auth */
338
+ redirectUrl?: string;
339
+ /** URL for new users (onboarding) */
340
+ newUserRedirectUrl?: string;
341
+ /** Callback on successful auth */
342
+ onSuccess?: (result: {
343
+ user: any;
344
+ org: any;
345
+ isNewUser: boolean;
346
+ }) => void;
347
+ /** Callback on error */
348
+ onError?: (error: Error) => void;
349
+ /** Custom loading component */
350
+ loadingComponent?: React.ReactNode;
351
+ /** Custom error component */
352
+ errorComponent?: (error: string) => React.ReactNode;
353
+ }
354
+ declare function GitHubCallback({ redirectUrl, newUserRedirectUrl, onSuccess, onError, loadingComponent, errorComponent, }: GitHubCallbackProps): react_jsx_runtime.JSX.Element;
355
+
356
+ interface CognitoButtonProps {
357
+ /** Text to display on the button */
358
+ children?: React.ReactNode;
359
+ /** Custom redirect URI after Cognito auth */
360
+ redirectUri?: string;
361
+ /** Specific identity provider (e.g., 'Google', 'Facebook') */
362
+ identityProvider?: string;
363
+ /** Callback on error */
364
+ onError?: (error: Error) => void;
365
+ /** Additional class names */
366
+ className?: string;
367
+ /** Button variant */
368
+ variant?: 'default' | 'outline';
369
+ /** Disable the button */
370
+ disabled?: boolean;
371
+ }
372
+ declare function CognitoButton({ children, redirectUri, identityProvider, onError, className, variant, disabled, }: CognitoButtonProps): react_jsx_runtime.JSX.Element;
373
+
374
+ interface CognitoCallbackProps {
375
+ /** URL to redirect to after successful auth */
376
+ redirectUrl?: string;
377
+ /** URL for new users (onboarding) */
378
+ newUserRedirectUrl?: string;
379
+ /** Callback on successful auth */
380
+ onSuccess?: (result: {
381
+ user: any;
382
+ org: any;
383
+ isNewUser: boolean;
384
+ }) => void;
385
+ /** Callback on error */
386
+ onError?: (error: Error) => void;
387
+ /** Custom loading component */
388
+ loadingComponent?: React.ReactNode;
389
+ /** Custom error component */
390
+ errorComponent?: (error: string) => React.ReactNode;
391
+ }
392
+ declare function CognitoCallback({ redirectUrl, newUserRedirectUrl, onSuccess, onError, loadingComponent, errorComponent, }: CognitoCallbackProps): react_jsx_runtime.JSX.Element;
393
+
282
394
  /**
283
395
  * @githat/nextjs/server
284
396
  *
@@ -328,4 +440,4 @@ interface WithAuthOptions {
328
440
  onUnauthorized?: () => Response;
329
441
  }
330
442
 
331
- export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useGitHat };
443
+ export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, CognitoButton, CognitoCallback, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, GitHubButton, GitHubCallback, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useGitHat };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,11 @@ interface GitHatUser {
7
7
  name: string;
8
8
  avatarUrl: string | null;
9
9
  emailVerified: boolean;
10
+ githubUsername?: string;
11
+ cognitoUsername?: string;
12
+ cognitoSub?: string;
13
+ googleId?: string;
14
+ authProvider?: 'email' | 'github' | 'cognito' | 'google';
10
15
  }
11
16
  interface GitHatOrg {
12
17
  id: string;
@@ -105,6 +110,33 @@ declare function useGitHat(): {
105
110
  resendVerificationEmail: (email: string) => Promise<{
106
111
  success: boolean;
107
112
  }>;
113
+ getGitHubOAuthUrl: (options?: {
114
+ redirectUri?: string;
115
+ state?: string;
116
+ }) => Promise<{
117
+ url: string;
118
+ }>;
119
+ signInWithGitHub: (code: string, options?: {
120
+ redirectUri?: string;
121
+ }) => Promise<{
122
+ user: GitHatUser;
123
+ org: GitHatOrg | null;
124
+ isNewUser: boolean;
125
+ }>;
126
+ getCognitoOAuthUrl: (options?: {
127
+ redirectUri?: string;
128
+ state?: string;
129
+ identityProvider?: string;
130
+ }) => Promise<{
131
+ url: string;
132
+ }>;
133
+ signInWithCognito: (code: string, options?: {
134
+ redirectUri?: string;
135
+ }) => Promise<{
136
+ user: GitHatUser;
137
+ org: GitHatOrg | null;
138
+ isNewUser: boolean;
139
+ }>;
108
140
  };
109
141
 
110
142
  interface DataItem {
@@ -279,6 +311,86 @@ interface ChangePasswordFormProps {
279
311
  }
280
312
  declare function ChangePasswordForm({ onSuccess, onError, minPasswordLength, }: ChangePasswordFormProps): react_jsx_runtime.JSX.Element;
281
313
 
314
+ interface GitHubButtonProps {
315
+ /** Text to display on the button */
316
+ children?: React.ReactNode;
317
+ /** Custom redirect URI after GitHub auth */
318
+ redirectUri?: string;
319
+ /** Callback on successful auth */
320
+ onSuccess?: (result: {
321
+ user: any;
322
+ org: any;
323
+ isNewUser: boolean;
324
+ }) => void;
325
+ /** Callback on error */
326
+ onError?: (error: Error) => void;
327
+ /** Additional class names */
328
+ className?: string;
329
+ /** Button variant */
330
+ variant?: 'default' | 'outline';
331
+ /** Disable the button */
332
+ disabled?: boolean;
333
+ }
334
+ declare function GitHubButton({ children, redirectUri, onSuccess, onError, className, variant, disabled, }: GitHubButtonProps): react_jsx_runtime.JSX.Element;
335
+
336
+ interface GitHubCallbackProps {
337
+ /** URL to redirect to after successful auth */
338
+ redirectUrl?: string;
339
+ /** URL for new users (onboarding) */
340
+ newUserRedirectUrl?: string;
341
+ /** Callback on successful auth */
342
+ onSuccess?: (result: {
343
+ user: any;
344
+ org: any;
345
+ isNewUser: boolean;
346
+ }) => void;
347
+ /** Callback on error */
348
+ onError?: (error: Error) => void;
349
+ /** Custom loading component */
350
+ loadingComponent?: React.ReactNode;
351
+ /** Custom error component */
352
+ errorComponent?: (error: string) => React.ReactNode;
353
+ }
354
+ declare function GitHubCallback({ redirectUrl, newUserRedirectUrl, onSuccess, onError, loadingComponent, errorComponent, }: GitHubCallbackProps): react_jsx_runtime.JSX.Element;
355
+
356
+ interface CognitoButtonProps {
357
+ /** Text to display on the button */
358
+ children?: React.ReactNode;
359
+ /** Custom redirect URI after Cognito auth */
360
+ redirectUri?: string;
361
+ /** Specific identity provider (e.g., 'Google', 'Facebook') */
362
+ identityProvider?: string;
363
+ /** Callback on error */
364
+ onError?: (error: Error) => void;
365
+ /** Additional class names */
366
+ className?: string;
367
+ /** Button variant */
368
+ variant?: 'default' | 'outline';
369
+ /** Disable the button */
370
+ disabled?: boolean;
371
+ }
372
+ declare function CognitoButton({ children, redirectUri, identityProvider, onError, className, variant, disabled, }: CognitoButtonProps): react_jsx_runtime.JSX.Element;
373
+
374
+ interface CognitoCallbackProps {
375
+ /** URL to redirect to after successful auth */
376
+ redirectUrl?: string;
377
+ /** URL for new users (onboarding) */
378
+ newUserRedirectUrl?: string;
379
+ /** Callback on successful auth */
380
+ onSuccess?: (result: {
381
+ user: any;
382
+ org: any;
383
+ isNewUser: boolean;
384
+ }) => void;
385
+ /** Callback on error */
386
+ onError?: (error: Error) => void;
387
+ /** Custom loading component */
388
+ loadingComponent?: React.ReactNode;
389
+ /** Custom error component */
390
+ errorComponent?: (error: string) => React.ReactNode;
391
+ }
392
+ declare function CognitoCallback({ redirectUrl, newUserRedirectUrl, onSuccess, onError, loadingComponent, errorComponent, }: CognitoCallbackProps): react_jsx_runtime.JSX.Element;
393
+
282
394
  /**
283
395
  * @githat/nextjs/server
284
396
  *
@@ -328,4 +440,4 @@ interface WithAuthOptions {
328
440
  onUnauthorized?: () => Response;
329
441
  }
330
442
 
331
- export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useGitHat };
443
+ export { type AuthActions, type AuthPayload, type AuthState, type AuthenticatedHandler, type BatchOperation, type BatchResult, ChangePasswordForm, CognitoButton, CognitoCallback, type DataItem, type DeleteResult, type EmailVerificationResult, ForgotPasswordForm, type GitHatConfig, type GitHatContextValue, type GitHatOrg, GitHatProvider, type GitHatUser, GitHubButton, GitHubCallback, type OrgMetadata, OrgSwitcher, type PasswordResetResult, ProtectedRoute, type PutResult, type QueryOptions, type QueryResult, ResetPasswordForm, SignInButton, SignInForm, SignUpButton, type SignUpData, SignUpForm, type SignUpResult, UserButton, VerifiedBadge, VerifyEmailStatus, type VerifyOptions, type WithAuthOptions, useAuth, useData, useGitHat };