@niledatabase/react 5.1.0 → 5.2.0-alpha.3

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
@@ -283,6 +283,71 @@ declare function SignedOut({ children, session: startSession, ...props }: Sessio
283
283
  className?: string;
284
284
  }): React__default.JSX.Element | null;
285
285
 
286
+ type MfaMethod = 'authenticator' | 'email';
287
+ type ChallengeScope = 'setup' | 'challenge';
288
+ type AuthenticatorSetup = {
289
+ method: 'authenticator';
290
+ token: string;
291
+ scope: ChallengeScope;
292
+ otpauthUrl?: string;
293
+ secret?: string;
294
+ recoveryKeys?: string[];
295
+ };
296
+ type EmailSetup = {
297
+ method: 'email';
298
+ token: string;
299
+ scope: ChallengeScope;
300
+ maskedEmail?: string;
301
+ };
302
+ type EnrollMfaProps = {
303
+ enrolled?: boolean;
304
+ enrolledMethod?: MfaMethod | null;
305
+ onRedirect?: (url: string) => void;
306
+ onChallengeRedirect?: (params: ChallengeRedirect) => void;
307
+ };
308
+ type ChallengeRedirect = {
309
+ token: string;
310
+ method: MfaMethod;
311
+ scope: ChallengeScope;
312
+ destination?: string;
313
+ };
314
+ type MfaSetup = AuthenticatorSetup | EmailSetup;
315
+ type AuthenticatorSetupProps = {
316
+ setup: AuthenticatorSetup;
317
+ onError: (message: string | null) => void;
318
+ onSuccess: (scope: 'setup' | 'challenge') => void;
319
+ };
320
+ type EnrollmentError = 'setup' | 'disable' | 'parseSetup' | 'parseDisable' | null;
321
+ type UseMfaEnrollmentOptions = {
322
+ method: MfaMethod;
323
+ currentMethod: MfaMethod | null;
324
+ onRedirect?: (url: string) => void;
325
+ onChallengeRedirect?: (params: ChallengeRedirect) => void;
326
+ };
327
+ type UseMfaEnrollmentResult<TSetup extends MfaSetup> = {
328
+ setup: TSetup | null;
329
+ loading: boolean;
330
+ errorType: EnrollmentError;
331
+ startSetup: () => Promise<void>;
332
+ startDisable: () => Promise<void>;
333
+ };
334
+
335
+ declare const useMultiFactor: ({ method, currentMethod, onRedirect, onChallengeRedirect, }: UseMfaEnrollmentOptions) => UseMfaEnrollmentResult<MfaSetup>;
336
+
337
+ declare function SetupAuthenticator({ setup, onError, onSuccess, }: AuthenticatorSetupProps): React__default.JSX.Element;
338
+
339
+ declare function SetupEmail({ setup, onSuccess, }: {
340
+ setup: EmailSetup;
341
+ onSuccess: (scope: 'setup' | 'challenge') => void;
342
+ }): React__default.JSX.Element;
343
+
344
+ declare function ChallengeContent({ payload, message, isEnrolled, onSuccess, }: {
345
+ payload: MfaSetup;
346
+ message?: string;
347
+ isEnrolled?: boolean;
348
+ onSuccess?: (scope: 'setup' | 'challenge') => void;
349
+ }): React__default.JSX.Element;
350
+
286
351
  type Tenant = {
287
352
  id: string;
288
353
  name: string;
@@ -322,6 +387,7 @@ interface User {
322
387
  created: string;
323
388
  updated?: string;
324
389
  emailVerified?: string | null;
390
+ multiFactor?: string | null;
325
391
  tenants: string[];
326
392
  }
327
393
 
@@ -370,4 +436,4 @@ declare const Email: ({ hide }: {
370
436
  }) => React$1.JSX.Element;
371
437
  declare const Password: () => React$1.JSX.Element;
372
438
 
373
- export { AzureSignInButton as Azure, DiscordSignInButton as Discord, Email, EmailSigningIn as EmailSignIn, EmailSignInButton, GitHubSignInButton as GitHub, GoogleSSOButton as Google, HubSpotSignInButton as HubSpot, LinkedInSignInButton as LinkedIn, OktaSignInButton as Okta, Password, ResetPasswordForm as PasswordResetForm, ResetPasswordForm$1 as PasswordResetRequestForm, SessionContext, SessionProvider, SigningIn as SignInForm, SignOutButton, SigningUp as SignUpForm, SignedIn, SignedOut, SlackSignInButton as Slack, TenantSelector, UserInfo, XSignInButton as X, useEmailSignIn, useMe, useResetPassword, useSession, useSignIn, useSignUp, useTenantId, useTenants };
439
+ export { type AuthenticatorSetup, AzureSignInButton as Azure, type ChallengeRedirect, DiscordSignInButton as Discord, Email, type EmailSetup, EmailSigningIn as EmailSignIn, EmailSignInButton, type EnrollMfaProps, type EnrollmentError, GitHubSignInButton as GitHub, GoogleSSOButton as Google, HubSpotSignInButton as HubSpot, LinkedInSignInButton as LinkedIn, type MfaMethod, type MfaSetup, SetupAuthenticator as MultiFactorAuthenticator, ChallengeContent as MultiFactorChallenge, SetupEmail as MultiFactorEmail, OktaSignInButton as Okta, Password, ResetPasswordForm as PasswordResetForm, ResetPasswordForm$1 as PasswordResetRequestForm, SessionContext, SessionProvider, SigningIn as SignInForm, SignOutButton, SigningUp as SignUpForm, SignedIn, SignedOut, SlackSignInButton as Slack, TenantSelector, UserInfo, XSignInButton as X, useEmailSignIn, useMe, useMultiFactor, useResetPassword, useSession, useSignIn, useSignUp, useTenantId, useTenants };
package/dist/index.d.ts CHANGED
@@ -283,6 +283,71 @@ declare function SignedOut({ children, session: startSession, ...props }: Sessio
283
283
  className?: string;
284
284
  }): React__default.JSX.Element | null;
285
285
 
286
+ type MfaMethod = 'authenticator' | 'email';
287
+ type ChallengeScope = 'setup' | 'challenge';
288
+ type AuthenticatorSetup = {
289
+ method: 'authenticator';
290
+ token: string;
291
+ scope: ChallengeScope;
292
+ otpauthUrl?: string;
293
+ secret?: string;
294
+ recoveryKeys?: string[];
295
+ };
296
+ type EmailSetup = {
297
+ method: 'email';
298
+ token: string;
299
+ scope: ChallengeScope;
300
+ maskedEmail?: string;
301
+ };
302
+ type EnrollMfaProps = {
303
+ enrolled?: boolean;
304
+ enrolledMethod?: MfaMethod | null;
305
+ onRedirect?: (url: string) => void;
306
+ onChallengeRedirect?: (params: ChallengeRedirect) => void;
307
+ };
308
+ type ChallengeRedirect = {
309
+ token: string;
310
+ method: MfaMethod;
311
+ scope: ChallengeScope;
312
+ destination?: string;
313
+ };
314
+ type MfaSetup = AuthenticatorSetup | EmailSetup;
315
+ type AuthenticatorSetupProps = {
316
+ setup: AuthenticatorSetup;
317
+ onError: (message: string | null) => void;
318
+ onSuccess: (scope: 'setup' | 'challenge') => void;
319
+ };
320
+ type EnrollmentError = 'setup' | 'disable' | 'parseSetup' | 'parseDisable' | null;
321
+ type UseMfaEnrollmentOptions = {
322
+ method: MfaMethod;
323
+ currentMethod: MfaMethod | null;
324
+ onRedirect?: (url: string) => void;
325
+ onChallengeRedirect?: (params: ChallengeRedirect) => void;
326
+ };
327
+ type UseMfaEnrollmentResult<TSetup extends MfaSetup> = {
328
+ setup: TSetup | null;
329
+ loading: boolean;
330
+ errorType: EnrollmentError;
331
+ startSetup: () => Promise<void>;
332
+ startDisable: () => Promise<void>;
333
+ };
334
+
335
+ declare const useMultiFactor: ({ method, currentMethod, onRedirect, onChallengeRedirect, }: UseMfaEnrollmentOptions) => UseMfaEnrollmentResult<MfaSetup>;
336
+
337
+ declare function SetupAuthenticator({ setup, onError, onSuccess, }: AuthenticatorSetupProps): React__default.JSX.Element;
338
+
339
+ declare function SetupEmail({ setup, onSuccess, }: {
340
+ setup: EmailSetup;
341
+ onSuccess: (scope: 'setup' | 'challenge') => void;
342
+ }): React__default.JSX.Element;
343
+
344
+ declare function ChallengeContent({ payload, message, isEnrolled, onSuccess, }: {
345
+ payload: MfaSetup;
346
+ message?: string;
347
+ isEnrolled?: boolean;
348
+ onSuccess?: (scope: 'setup' | 'challenge') => void;
349
+ }): React__default.JSX.Element;
350
+
286
351
  type Tenant = {
287
352
  id: string;
288
353
  name: string;
@@ -322,6 +387,7 @@ interface User {
322
387
  created: string;
323
388
  updated?: string;
324
389
  emailVerified?: string | null;
390
+ multiFactor?: string | null;
325
391
  tenants: string[];
326
392
  }
327
393
 
@@ -370,4 +436,4 @@ declare const Email: ({ hide }: {
370
436
  }) => React$1.JSX.Element;
371
437
  declare const Password: () => React$1.JSX.Element;
372
438
 
373
- export { AzureSignInButton as Azure, DiscordSignInButton as Discord, Email, EmailSigningIn as EmailSignIn, EmailSignInButton, GitHubSignInButton as GitHub, GoogleSSOButton as Google, HubSpotSignInButton as HubSpot, LinkedInSignInButton as LinkedIn, OktaSignInButton as Okta, Password, ResetPasswordForm as PasswordResetForm, ResetPasswordForm$1 as PasswordResetRequestForm, SessionContext, SessionProvider, SigningIn as SignInForm, SignOutButton, SigningUp as SignUpForm, SignedIn, SignedOut, SlackSignInButton as Slack, TenantSelector, UserInfo, XSignInButton as X, useEmailSignIn, useMe, useResetPassword, useSession, useSignIn, useSignUp, useTenantId, useTenants };
439
+ export { type AuthenticatorSetup, AzureSignInButton as Azure, type ChallengeRedirect, DiscordSignInButton as Discord, Email, type EmailSetup, EmailSigningIn as EmailSignIn, EmailSignInButton, type EnrollMfaProps, type EnrollmentError, GitHubSignInButton as GitHub, GoogleSSOButton as Google, HubSpotSignInButton as HubSpot, LinkedInSignInButton as LinkedIn, type MfaMethod, type MfaSetup, SetupAuthenticator as MultiFactorAuthenticator, ChallengeContent as MultiFactorChallenge, SetupEmail as MultiFactorEmail, OktaSignInButton as Okta, Password, ResetPasswordForm as PasswordResetForm, ResetPasswordForm$1 as PasswordResetRequestForm, SessionContext, SessionProvider, SigningIn as SignInForm, SignOutButton, SigningUp as SignUpForm, SignedIn, SignedOut, SlackSignInButton as Slack, TenantSelector, UserInfo, XSignInButton as X, useEmailSignIn, useMe, useMultiFactor, useResetPassword, useSession, useSignIn, useSignUp, useTenantId, useTenants };