@tern-secure/types 1.1.0-canary.v20251008131428 → 1.1.0-canary.v20251008165428
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/esm/index.js +0 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +204 -274
- package/dist/index.d.ts +204 -274
- package/dist/index.js +0 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -259,259 +259,6 @@ interface TernSecureHandlerOptions {
|
|
|
259
259
|
basePath?: string;
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
/**
|
|
263
|
-
* Defines the basic structure for color theming.
|
|
264
|
-
*/
|
|
265
|
-
interface ThemeColors {
|
|
266
|
-
primary?: string;
|
|
267
|
-
secondary?: string;
|
|
268
|
-
accent?: string;
|
|
269
|
-
background?: string;
|
|
270
|
-
text?: string;
|
|
271
|
-
error?: string;
|
|
272
|
-
success?: string;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Defines the basic structure for font theming.
|
|
276
|
-
*/
|
|
277
|
-
interface ThemeFonts {
|
|
278
|
-
primary?: string;
|
|
279
|
-
secondary?: string;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Defines the basic structure for spacing and layout theming.
|
|
283
|
-
*/
|
|
284
|
-
interface ThemeSpacing {
|
|
285
|
-
small?: string | number;
|
|
286
|
-
medium?: string | number;
|
|
287
|
-
large?: string | number;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Defines the basic structure for border radius theming.
|
|
291
|
-
*/
|
|
292
|
-
interface ThemeBorderRadius {
|
|
293
|
-
small?: string | number;
|
|
294
|
-
medium?: string | number;
|
|
295
|
-
large?: string | number;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Allows for overriding styles of specific UI components.
|
|
299
|
-
* Properties can be CSS-in-JS objects or class names, depending on implementation.
|
|
300
|
-
*/
|
|
301
|
-
interface ThemeComponentStyles {
|
|
302
|
-
button?: Record<string, any> | string;
|
|
303
|
-
input?: Record<string, any> | string;
|
|
304
|
-
card?: Record<string, any> | string;
|
|
305
|
-
label?: Record<string, any> | string;
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Defines the overall appearance/theme configuration.
|
|
309
|
-
* This allows for broad customization of the UI components.
|
|
310
|
-
*/
|
|
311
|
-
interface Appearance {
|
|
312
|
-
colors?: ThemeColors;
|
|
313
|
-
fonts?: ThemeFonts;
|
|
314
|
-
spacing?: ThemeSpacing;
|
|
315
|
-
borderRadius?: ThemeBorderRadius;
|
|
316
|
-
componentStyles?: ThemeComponentStyles;
|
|
317
|
-
variables?: Record<string, string | number>;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Base UI configuration shared between SignIn and SignUp
|
|
321
|
-
*/
|
|
322
|
-
interface BaseAuthUIConfig {
|
|
323
|
-
/** Visual appearance configuration */
|
|
324
|
-
appearance?: Appearance;
|
|
325
|
-
/** Application logo URL or SVG string */
|
|
326
|
-
logo?: string;
|
|
327
|
-
/** Application name for display */
|
|
328
|
-
appName?: string;
|
|
329
|
-
/** Render mode for cross-platform support */
|
|
330
|
-
renderMode?: 'modal' | 'page' | 'embedded';
|
|
331
|
-
/** Layout direction */
|
|
332
|
-
layout?: 'vertical' | 'horizontal';
|
|
333
|
-
/** Custom loading message */
|
|
334
|
-
loadingMessage?: string;
|
|
335
|
-
/** Loading spinner variant */
|
|
336
|
-
loadingSpinnerVariant?: 'circular' | 'linear' | 'dots';
|
|
337
|
-
/** Accessibility configuration */
|
|
338
|
-
a11y?: {
|
|
339
|
-
/** ARIA labels and descriptions */
|
|
340
|
-
labels?: Record<string, string>;
|
|
341
|
-
/** Element to receive initial focus */
|
|
342
|
-
initialFocus?: string;
|
|
343
|
-
/** Whether to trap focus within the auth UI */
|
|
344
|
-
trapFocus?: boolean;
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Sign-in specific UI configuration
|
|
349
|
-
*/
|
|
350
|
-
interface SignInUIConfig extends BaseAuthUIConfig {
|
|
351
|
-
/** Social sign-in buttons configuration */
|
|
352
|
-
socialButtons?: {
|
|
353
|
-
google?: boolean;
|
|
354
|
-
microsoft?: boolean;
|
|
355
|
-
github?: boolean;
|
|
356
|
-
facebook?: boolean;
|
|
357
|
-
twitter?: boolean;
|
|
358
|
-
apple?: boolean;
|
|
359
|
-
linkedin?: boolean;
|
|
360
|
-
layout?: 'vertical' | 'horizontal';
|
|
361
|
-
size?: 'small' | 'medium' | 'large';
|
|
362
|
-
};
|
|
363
|
-
/** "Remember me" checkbox configuration */
|
|
364
|
-
rememberMe?: {
|
|
365
|
-
enabled?: boolean;
|
|
366
|
-
defaultChecked?: boolean;
|
|
367
|
-
};
|
|
368
|
-
/** Sign-up link configuration */
|
|
369
|
-
signUpLink?: {
|
|
370
|
-
enabled?: boolean;
|
|
371
|
-
text?: string;
|
|
372
|
-
href?: string;
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
/**
|
|
376
|
-
* Sign-up specific UI configuration
|
|
377
|
-
*/
|
|
378
|
-
interface SignUpUIConfig extends BaseAuthUIConfig {
|
|
379
|
-
/** Password requirements display configuration */
|
|
380
|
-
passwordRequirements?: {
|
|
381
|
-
show?: boolean;
|
|
382
|
-
rules?: Array<{
|
|
383
|
-
rule: string;
|
|
384
|
-
description: string;
|
|
385
|
-
}>;
|
|
386
|
-
};
|
|
387
|
-
/** Terms and conditions configuration */
|
|
388
|
-
terms?: {
|
|
389
|
-
enabled?: boolean;
|
|
390
|
-
text?: string;
|
|
391
|
-
link?: string;
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
interface TernSecureSession {
|
|
396
|
-
token: string | null;
|
|
397
|
-
expiresAt?: number;
|
|
398
|
-
}
|
|
399
|
-
type SignInFormValues = {
|
|
400
|
-
email: string;
|
|
401
|
-
password: string;
|
|
402
|
-
phoneNumber?: string;
|
|
403
|
-
};
|
|
404
|
-
type SignInInitialValue = Partial<SignInFormValues>;
|
|
405
|
-
type SignUpFormValues = {
|
|
406
|
-
email: string;
|
|
407
|
-
password: string;
|
|
408
|
-
confirmPassword?: string;
|
|
409
|
-
displayName?: string;
|
|
410
|
-
};
|
|
411
|
-
type SignUpInitialValue = Partial<SignUpFormValues>;
|
|
412
|
-
interface SignInResponse {
|
|
413
|
-
success: boolean;
|
|
414
|
-
message?: string;
|
|
415
|
-
error?: any | undefined;
|
|
416
|
-
user?: any;
|
|
417
|
-
}
|
|
418
|
-
interface AuthError extends Error {
|
|
419
|
-
code?: any | string;
|
|
420
|
-
message: string;
|
|
421
|
-
response?: SignInResponse;
|
|
422
|
-
}
|
|
423
|
-
declare function isSignInResponse(value: any): value is SignInResponse;
|
|
424
|
-
interface AuthActions {
|
|
425
|
-
signInWithEmail: (email: string, password: string) => Promise<SignInResponse>;
|
|
426
|
-
signInWithGoogle: () => Promise<void>;
|
|
427
|
-
signInWithMicrosoft: () => Promise<void>;
|
|
428
|
-
signOut: () => Promise<void>;
|
|
429
|
-
getRedirectResult: () => Promise<any>;
|
|
430
|
-
getIdToken: () => Promise<string | null>;
|
|
431
|
-
createUserWithEmailAndPassword?: (email: string, password: string) => Promise<SignInResponse>;
|
|
432
|
-
sendEmailVerification?: (user: TernSecureUser) => Promise<void>;
|
|
433
|
-
}
|
|
434
|
-
interface RedirectConfig {
|
|
435
|
-
redirectUrl?: string;
|
|
436
|
-
isReturn?: boolean;
|
|
437
|
-
priority?: number;
|
|
438
|
-
}
|
|
439
|
-
interface SignInProps extends RedirectConfig {
|
|
440
|
-
initialValue?: SignInInitialValue;
|
|
441
|
-
logo?: string;
|
|
442
|
-
appName?: string;
|
|
443
|
-
appearance?: Appearance;
|
|
444
|
-
onError?: (error: AuthError) => void;
|
|
445
|
-
onSuccess?: (user: TernSecureUser | null) => void;
|
|
446
|
-
}
|
|
447
|
-
/**
|
|
448
|
-
* SignUpProps interface defines the properties for the sign-up component.
|
|
449
|
-
* It extends RedirectConfig to include redirect-related properties.
|
|
450
|
-
*/
|
|
451
|
-
interface SignUpProps extends RedirectConfig {
|
|
452
|
-
initialValue?: SignUpInitialValue;
|
|
453
|
-
logo?: string;
|
|
454
|
-
appName?: string;
|
|
455
|
-
appearance?: Appearance;
|
|
456
|
-
onError?: (error: AuthError) => void;
|
|
457
|
-
onSuccess?: (user: TernSecureUser | null) => void;
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Defines the contract for a TernSecure instance.
|
|
461
|
-
* This instance provides authentication state, user information, and methods
|
|
462
|
-
* for managing the authentication lifecycle. It is designed to be used by
|
|
463
|
-
* UI packages like tern-ui, which act as "dumb" renderers.
|
|
464
|
-
*/
|
|
465
|
-
interface TernSecureInstanceOld {
|
|
466
|
-
/** Indicates if the user is currently signed in. */
|
|
467
|
-
isSignedIn: () => boolean;
|
|
468
|
-
/** The current authenticated user object, or null if not signed in. */
|
|
469
|
-
user: TernSecureUser | null;
|
|
470
|
-
/** The current user session information, or null if not signed in. */
|
|
471
|
-
session: TernSecureSession | null;
|
|
472
|
-
/** Initiates the sign-out process for the current user. */
|
|
473
|
-
signOut: () => Promise<void>;
|
|
474
|
-
/**
|
|
475
|
-
* Prepares or signals to mount the sign-in interface.
|
|
476
|
-
* @param options Optional configuration or initial state for the sign-in UI, conforming to SignInProps.
|
|
477
|
-
*/
|
|
478
|
-
mountSignIn: (options?: SignInProps) => void;
|
|
479
|
-
/** Cleans up or signals to unmount the sign-in interface. */
|
|
480
|
-
unmountSignIn: () => void;
|
|
481
|
-
/**
|
|
482
|
-
* Prepares or signals to mount the sign-up interface.
|
|
483
|
-
* @param options Optional configuration or initial state for the sign-up UI, conforming to SignUpProps.
|
|
484
|
-
*/
|
|
485
|
-
mountSignUp: (options?: SignUpProps) => void;
|
|
486
|
-
/** Cleans up or signals to unmount the sign-up interface. */
|
|
487
|
-
unmountSignUp: () => void;
|
|
488
|
-
/**
|
|
489
|
-
* Determines if a redirect is necessary based on the current authentication
|
|
490
|
-
* state and the given path.
|
|
491
|
-
* @param currentPath The current URL path.
|
|
492
|
-
* @returns True if a redirect is needed, false otherwise, or a string path to redirect to.
|
|
493
|
-
*/
|
|
494
|
-
shouldRedirect: (currentPath: string) => boolean | string;
|
|
495
|
-
/**
|
|
496
|
-
* Constructs a URL, appending necessary redirect parameters.
|
|
497
|
-
* Useful for redirecting back to the original page after authentication.
|
|
498
|
-
* @param baseUrl The base URL to which redirect parameters should be added.
|
|
499
|
-
* @returns The new URL string with redirect parameters.
|
|
500
|
-
*/
|
|
501
|
-
constructUrlWithRedirect: (baseUrl: string) => string;
|
|
502
|
-
/**
|
|
503
|
-
* Redirects the user to the configured login page.
|
|
504
|
-
* @param redirectUrl Optional URL to redirect to after successful login.
|
|
505
|
-
*/
|
|
506
|
-
redirectToLogin: (redirectUrl?: string) => void;
|
|
507
|
-
/** Indicates if an authentication operation is currently in progress. */
|
|
508
|
-
isLoading: boolean;
|
|
509
|
-
/** Holds any error that occurred during an authentication operation, or null otherwise. */
|
|
510
|
-
error: Error | null;
|
|
511
|
-
/** Indicates if the user has verified their email address. */
|
|
512
|
-
sendVerificationEmail: () => Promise<void>;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
262
|
type SessionStatus = 'active' | 'expired' | 'revoked' | 'pending';
|
|
516
263
|
/**
|
|
517
264
|
* parsed can be replaced with
|
|
@@ -602,7 +349,7 @@ interface SessionResult {
|
|
|
602
349
|
}
|
|
603
350
|
|
|
604
351
|
type SignInStatus = 'idle' | 'pending_email_password' | 'pending_social' | 'pending_mfa' | 'redirecting' | 'success' | 'error';
|
|
605
|
-
type
|
|
352
|
+
type SignInFormValues = {
|
|
606
353
|
email: string;
|
|
607
354
|
password: string;
|
|
608
355
|
phoneNumber?: string;
|
|
@@ -617,17 +364,17 @@ interface AuthErrorTree extends Error {
|
|
|
617
364
|
message: string;
|
|
618
365
|
response?: any | string;
|
|
619
366
|
}
|
|
620
|
-
interface
|
|
367
|
+
interface SignInResponse {
|
|
621
368
|
success: boolean;
|
|
622
369
|
message?: string;
|
|
623
370
|
error?: any | undefined;
|
|
624
371
|
user?: any;
|
|
625
372
|
}
|
|
626
|
-
type
|
|
627
|
-
interface ResendEmailVerification extends
|
|
373
|
+
type SignInInitialValue = Partial<SignInFormValues>;
|
|
374
|
+
interface ResendEmailVerification extends SignInResponse {
|
|
628
375
|
isVerified?: boolean;
|
|
629
376
|
}
|
|
630
|
-
declare function isSignInResponseTree(value: any): value is
|
|
377
|
+
declare function isSignInResponseTree(value: any): value is SignInResponse;
|
|
631
378
|
interface SignInResource {
|
|
632
379
|
/**
|
|
633
380
|
* The current status of the sign-in process.
|
|
@@ -638,7 +385,7 @@ interface SignInResource {
|
|
|
638
385
|
* @param params - The sign-in form values.
|
|
639
386
|
* @returns A promise that resolves with the sign-in response.
|
|
640
387
|
*/
|
|
641
|
-
withEmailAndPassword: (params:
|
|
388
|
+
withEmailAndPassword: (params: SignInFormValues) => Promise<SignInResponse>;
|
|
642
389
|
/**
|
|
643
390
|
* @param provider - The identifier of the social provider (e.g., 'google', 'microsoft', 'github').
|
|
644
391
|
* @param options - Optional configuration for the social sign-in flow.
|
|
@@ -646,14 +393,14 @@ interface SignInResource {
|
|
|
646
393
|
*/
|
|
647
394
|
withSocialProvider: (provider: string, options?: {
|
|
648
395
|
mode?: 'popup' | 'redirect';
|
|
649
|
-
}) => Promise<
|
|
396
|
+
}) => Promise<SignInResponse | void>;
|
|
650
397
|
/**
|
|
651
398
|
* Completes an MFA (Multi-Factor Authentication) step after a primary authentication attempt.
|
|
652
399
|
* @param mfaToken - The MFA token or code submitted by the user.
|
|
653
400
|
* @param mfaContext - Optional context or session data from the MFA initiation step.
|
|
654
401
|
* @returns A promise that resolves with the sign-in response upon successful MFA verification.
|
|
655
402
|
*/
|
|
656
|
-
completeMfaSignIn: (mfaToken: string, mfaContext?: any) => Promise<
|
|
403
|
+
completeMfaSignIn: (mfaToken: string, mfaContext?: any) => Promise<SignInResponse>;
|
|
657
404
|
/**
|
|
658
405
|
* Sends a password reset email to the given email address.
|
|
659
406
|
* @param email - The user's email address.
|
|
@@ -669,7 +416,7 @@ interface SignInResource {
|
|
|
669
416
|
* Checks the result of a redirect-based sign-in flow, typically used in OAuth or SSO scenarios.
|
|
670
417
|
* @returns A promise that resolves with the sign-in response or null if no result is available.
|
|
671
418
|
*/
|
|
672
|
-
checkRedirectResult: () => Promise<
|
|
419
|
+
checkRedirectResult: () => Promise<SignInResponse | null>;
|
|
673
420
|
}
|
|
674
421
|
|
|
675
422
|
interface SignUpResource {
|
|
@@ -687,7 +434,7 @@ interface SignUpResource {
|
|
|
687
434
|
*/
|
|
688
435
|
withSocialProvider: (provider: string, options?: {
|
|
689
436
|
mode?: 'popup' | 'redirect';
|
|
690
|
-
}) => Promise<
|
|
437
|
+
}) => Promise<SignInResponse | void>;
|
|
691
438
|
}
|
|
692
439
|
type SignUpStatus = 'missing_requirements' | 'complete' | 'abandoned';
|
|
693
440
|
|
|
@@ -782,10 +529,10 @@ interface TernSecureState {
|
|
|
782
529
|
isAuthenticated: boolean;
|
|
783
530
|
token: any | null;
|
|
784
531
|
email: string | null;
|
|
785
|
-
status:
|
|
532
|
+
status: 'loading' | 'authenticated' | 'unauthenticated' | 'unverified';
|
|
786
533
|
user?: TernSecureUser | null;
|
|
787
534
|
}
|
|
788
|
-
type AuthProviderStatus =
|
|
535
|
+
type AuthProviderStatus = 'idle' | 'pending' | 'error' | 'success';
|
|
789
536
|
declare const DEFAULT_TERN_SECURE_STATE: TernSecureState;
|
|
790
537
|
interface TernSecureAuthProvider {
|
|
791
538
|
/** Current auth state */
|
|
@@ -805,8 +552,8 @@ interface TernSecureAuthProvider {
|
|
|
805
552
|
/** Sign out the current user */
|
|
806
553
|
signOut(): Promise<void>;
|
|
807
554
|
}
|
|
808
|
-
type Persistence =
|
|
809
|
-
type Mode$1 =
|
|
555
|
+
type Persistence = 'local' | 'session' | 'browserCookie' | 'none';
|
|
556
|
+
type Mode$1 = 'browser' | 'server';
|
|
810
557
|
type TernAuthSDK = {
|
|
811
558
|
/** SDK package name (e.g., @tern-secure/auth) */
|
|
812
559
|
name: string;
|
|
@@ -858,7 +605,7 @@ type EventHandler<Events extends TernSecureEvent> = (payload: TernAuthEventPaylo
|
|
|
858
605
|
type TernAuthEventPayload = {
|
|
859
606
|
status: TernSecureAuthStatus;
|
|
860
607
|
};
|
|
861
|
-
type TernSecureAuthStatus =
|
|
608
|
+
type TernSecureAuthStatus = 'error' | 'loading' | 'ready';
|
|
862
609
|
type onEventListener = <E extends TernSecureEvent>(event: E, handler: EventHandler<E>, opt?: {
|
|
863
610
|
notify?: boolean;
|
|
864
611
|
}) => void;
|
|
@@ -897,6 +644,14 @@ interface TernSecureAuth {
|
|
|
897
644
|
requiresVerification: boolean;
|
|
898
645
|
/** Initialize TernSecureAuth */
|
|
899
646
|
initialize(options?: TernSecureAuthOptions): Promise<void>;
|
|
647
|
+
/**
|
|
648
|
+
* @internal
|
|
649
|
+
*/
|
|
650
|
+
_internal_getOption<K extends keyof TernSecureAuthOptions>(key: K): TernSecureAuthOptions[K];
|
|
651
|
+
/**
|
|
652
|
+
* @internal
|
|
653
|
+
*/
|
|
654
|
+
_internal_getAllOptions(): Readonly<TernSecureAuthOptions>;
|
|
900
655
|
/** Current user*/
|
|
901
656
|
user: TernSecureUser | null | undefined;
|
|
902
657
|
/** Current session */
|
|
@@ -916,7 +671,22 @@ interface TernSecureAuth {
|
|
|
916
671
|
/** Remove event listener */
|
|
917
672
|
off: OffEventListener;
|
|
918
673
|
addListener: (callback: ListenerCallback) => UnsubscribeCallback;
|
|
674
|
+
/** Get redirect result from OAuth flows */
|
|
675
|
+
getRedirectResult: () => Promise<any>;
|
|
676
|
+
/** Navigate to SignIn page */
|
|
677
|
+
redirectToSignIn(options?: SignInRedirectOptions): Promise<unknown>;
|
|
678
|
+
/** Navigate to SignUp page */
|
|
679
|
+
redirectToSignUp(options?: SignUpRedirectOptions): Promise<unknown>;
|
|
680
|
+
redirectAfterSignIn: () => void;
|
|
681
|
+
redirectAfterSignUp: () => void;
|
|
919
682
|
}
|
|
683
|
+
type SignUpFormValues = {
|
|
684
|
+
email: string;
|
|
685
|
+
password: string;
|
|
686
|
+
confirmPassword?: string;
|
|
687
|
+
displayName?: string;
|
|
688
|
+
};
|
|
689
|
+
type SignUpInitialValue = Partial<SignUpFormValues>;
|
|
920
690
|
interface TernSecureAuthFactory {
|
|
921
691
|
create(options?: TernSecureAuthOptions): TernSecureAuth;
|
|
922
692
|
}
|
|
@@ -938,6 +708,166 @@ type TernVerificationResult = (DecodedIdToken & {
|
|
|
938
708
|
valid: false;
|
|
939
709
|
error: AuthErrorResponse;
|
|
940
710
|
};
|
|
711
|
+
/**
|
|
712
|
+
* Props for SignIn component focusing on UI concerns
|
|
713
|
+
*/
|
|
714
|
+
type SignInProps = {
|
|
715
|
+
/** Routing Path */
|
|
716
|
+
path?: string;
|
|
717
|
+
/** URL to navigate to after successfully sign-in */
|
|
718
|
+
forceRedirectUrl?: string | null;
|
|
719
|
+
/** Initial form values */
|
|
720
|
+
initialValue?: SignInInitialValue;
|
|
721
|
+
/** Callbacks */
|
|
722
|
+
onSuccess?: (user: TernSecureUser | null) => void;
|
|
723
|
+
} & SignUpRedirectUrl;
|
|
724
|
+
/**
|
|
725
|
+
* Props for SignUp component focusing on UI concerns
|
|
726
|
+
*/
|
|
727
|
+
type SignUpProps = {
|
|
728
|
+
/** URL to navigate to after successfully sign-up */
|
|
729
|
+
forceRedirectUrl?: string | null;
|
|
730
|
+
/** Initial form values */
|
|
731
|
+
initialValue?: SignUpInitialValue;
|
|
732
|
+
/** Callbacks */
|
|
733
|
+
onSubmit?: (values: SignUpFormValues) => Promise<void>;
|
|
734
|
+
onSuccess?: (user: TernSecureUser | null) => void;
|
|
735
|
+
} & SignInRedirectUrl;
|
|
736
|
+
type SignInRedirectOptions = RedirectOptions;
|
|
737
|
+
type SignUpRedirectOptions = RedirectOptions;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Defines the basic structure for color theming.
|
|
741
|
+
*/
|
|
742
|
+
interface ThemeColors {
|
|
743
|
+
primary?: string;
|
|
744
|
+
secondary?: string;
|
|
745
|
+
accent?: string;
|
|
746
|
+
background?: string;
|
|
747
|
+
text?: string;
|
|
748
|
+
error?: string;
|
|
749
|
+
success?: string;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Defines the basic structure for font theming.
|
|
753
|
+
*/
|
|
754
|
+
interface ThemeFonts {
|
|
755
|
+
primary?: string;
|
|
756
|
+
secondary?: string;
|
|
757
|
+
}
|
|
758
|
+
/**
|
|
759
|
+
* Defines the basic structure for spacing and layout theming.
|
|
760
|
+
*/
|
|
761
|
+
interface ThemeSpacing {
|
|
762
|
+
small?: string | number;
|
|
763
|
+
medium?: string | number;
|
|
764
|
+
large?: string | number;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* Defines the basic structure for border radius theming.
|
|
768
|
+
*/
|
|
769
|
+
interface ThemeBorderRadius {
|
|
770
|
+
small?: string | number;
|
|
771
|
+
medium?: string | number;
|
|
772
|
+
large?: string | number;
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Allows for overriding styles of specific UI components.
|
|
776
|
+
* Properties can be CSS-in-JS objects or class names, depending on implementation.
|
|
777
|
+
*/
|
|
778
|
+
interface ThemeComponentStyles {
|
|
779
|
+
button?: Record<string, any> | string;
|
|
780
|
+
input?: Record<string, any> | string;
|
|
781
|
+
card?: Record<string, any> | string;
|
|
782
|
+
label?: Record<string, any> | string;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Defines the overall appearance/theme configuration.
|
|
786
|
+
* This allows for broad customization of the UI components.
|
|
787
|
+
*/
|
|
788
|
+
interface Appearance {
|
|
789
|
+
colors?: ThemeColors;
|
|
790
|
+
fonts?: ThemeFonts;
|
|
791
|
+
spacing?: ThemeSpacing;
|
|
792
|
+
borderRadius?: ThemeBorderRadius;
|
|
793
|
+
componentStyles?: ThemeComponentStyles;
|
|
794
|
+
variables?: Record<string, string | number>;
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Base UI configuration shared between SignIn and SignUp
|
|
798
|
+
*/
|
|
799
|
+
interface BaseAuthUIConfig {
|
|
800
|
+
/** Visual appearance configuration */
|
|
801
|
+
appearance?: Appearance;
|
|
802
|
+
/** Application logo URL or SVG string */
|
|
803
|
+
logo?: string;
|
|
804
|
+
/** Application name for display */
|
|
805
|
+
appName?: string;
|
|
806
|
+
/** Render mode for cross-platform support */
|
|
807
|
+
renderMode?: 'modal' | 'page' | 'embedded';
|
|
808
|
+
/** Layout direction */
|
|
809
|
+
layout?: 'vertical' | 'horizontal';
|
|
810
|
+
/** Custom loading message */
|
|
811
|
+
loadingMessage?: string;
|
|
812
|
+
/** Loading spinner variant */
|
|
813
|
+
loadingSpinnerVariant?: 'circular' | 'linear' | 'dots';
|
|
814
|
+
/** Accessibility configuration */
|
|
815
|
+
a11y?: {
|
|
816
|
+
/** ARIA labels and descriptions */
|
|
817
|
+
labels?: Record<string, string>;
|
|
818
|
+
/** Element to receive initial focus */
|
|
819
|
+
initialFocus?: string;
|
|
820
|
+
/** Whether to trap focus within the auth UI */
|
|
821
|
+
trapFocus?: boolean;
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Sign-in specific UI configuration
|
|
826
|
+
*/
|
|
827
|
+
interface SignInUIConfig extends BaseAuthUIConfig {
|
|
828
|
+
/** Social sign-in buttons configuration */
|
|
829
|
+
socialButtons?: {
|
|
830
|
+
google?: boolean;
|
|
831
|
+
microsoft?: boolean;
|
|
832
|
+
github?: boolean;
|
|
833
|
+
facebook?: boolean;
|
|
834
|
+
twitter?: boolean;
|
|
835
|
+
apple?: boolean;
|
|
836
|
+
linkedin?: boolean;
|
|
837
|
+
layout?: 'vertical' | 'horizontal';
|
|
838
|
+
size?: 'small' | 'medium' | 'large';
|
|
839
|
+
};
|
|
840
|
+
/** "Remember me" checkbox configuration */
|
|
841
|
+
rememberMe?: {
|
|
842
|
+
enabled?: boolean;
|
|
843
|
+
defaultChecked?: boolean;
|
|
844
|
+
};
|
|
845
|
+
/** Sign-up link configuration */
|
|
846
|
+
signUpLink?: {
|
|
847
|
+
enabled?: boolean;
|
|
848
|
+
text?: string;
|
|
849
|
+
href?: string;
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Sign-up specific UI configuration
|
|
854
|
+
*/
|
|
855
|
+
interface SignUpUIConfig extends BaseAuthUIConfig {
|
|
856
|
+
/** Password requirements display configuration */
|
|
857
|
+
passwordRequirements?: {
|
|
858
|
+
show?: boolean;
|
|
859
|
+
rules?: Array<{
|
|
860
|
+
rule: string;
|
|
861
|
+
description: string;
|
|
862
|
+
}>;
|
|
863
|
+
};
|
|
864
|
+
/** Terms and conditions configuration */
|
|
865
|
+
terms?: {
|
|
866
|
+
enabled?: boolean;
|
|
867
|
+
text?: string;
|
|
868
|
+
link?: string;
|
|
869
|
+
};
|
|
870
|
+
}
|
|
941
871
|
|
|
942
872
|
type Mode = 'browser' | 'server';
|
|
943
873
|
type TernSecureSDK = {
|
|
@@ -1025,9 +955,9 @@ interface TernSecureInstanceTree {
|
|
|
1025
955
|
/** Construct URL with redirect parameters */
|
|
1026
956
|
constructUrlWithAuthRedirect: (to: string) => string;
|
|
1027
957
|
/** Navigate to SignIn page */
|
|
1028
|
-
redirectToSignIn(options?:
|
|
958
|
+
redirectToSignIn(options?: SignInRedirectOptionss): Promise<unknown>;
|
|
1029
959
|
/** Navigate to SignUp page */
|
|
1030
|
-
redirectToSignUp(options?:
|
|
960
|
+
redirectToSignUp(options?: SignUpRedirectOptionss): Promise<unknown>;
|
|
1031
961
|
redirectAfterSignIn: () => void;
|
|
1032
962
|
redirectAfterSignUp: () => void;
|
|
1033
963
|
/** Error and Event Handling */
|
|
@@ -1073,7 +1003,7 @@ type SignInPropsTree = {
|
|
|
1073
1003
|
/** URL to navigate to after successfully sign-in */
|
|
1074
1004
|
forceRedirectUrl?: string | null;
|
|
1075
1005
|
/** Initial form values */
|
|
1076
|
-
initialValue?:
|
|
1006
|
+
initialValue?: SignInInitialValue;
|
|
1077
1007
|
/** UI configuration */
|
|
1078
1008
|
ui?: SignInUIConfig;
|
|
1079
1009
|
/** Callbacks */
|
|
@@ -1095,8 +1025,8 @@ type SignUpPropsTree = {
|
|
|
1095
1025
|
onError?: (error: AuthErrorTree) => void;
|
|
1096
1026
|
onSuccess?: (user: TernSecureUser | null) => void;
|
|
1097
1027
|
} & SignInRedirectUrl;
|
|
1098
|
-
type
|
|
1099
|
-
type
|
|
1028
|
+
type SignInRedirectOptionss = RedirectOptions;
|
|
1029
|
+
type SignUpRedirectOptionss = RedirectOptions;
|
|
1100
1030
|
|
|
1101
1031
|
interface TernSecureApiErrorJSON {
|
|
1102
1032
|
code: string;
|
|
@@ -1142,4 +1072,4 @@ type DomainOrProxyUrl = {
|
|
|
1142
1072
|
*/
|
|
1143
1073
|
type Autocomplete<U extends T, T = string> = U | (T & Record<never, never>);
|
|
1144
1074
|
|
|
1145
|
-
export { type ActiveSession, type AdminConfigValidationResult, type AfterSignOutUrl, type Appearance, type
|
|
1075
|
+
export { type ActiveSession, type AdminConfigValidationResult, type AfterSignOutUrl, type Appearance, type AuthEndpoint, type AuthErrorCode, type AuthErrorResponse, type AuthErrorTree, type AuthProviderStatus, type Autocomplete, type BaseAuthUIConfig, type CheckAuthorizationFromSessionClaims, type CheckCustomClaims, type ConfigValidationResult, type CookieOptions, type CookieOpts, type CookieStore, type CorsOptions, DEFAULT_TERN_SECURE_STATE, type DecodedIdToken, type DomainOrProxyUrl, ERRORS, type EndpointConfig, type ErrorCode, type ExpiredSession, type FirebaseClaims, type FirebaseState, type IdTokenResult, type InitialState, type InstanceType, type JWTPayload, type JWTProtectedHeader, type Jwt, type ListenerCallback, type ParsedToken, type PendingSession, type Persistence, type RateLimitOptions, type RedirectOptions, type ResendEmailVerification, type SecurityOptions, type ServerConfigValidationResult, type SessionCookieConfig, type SessionEndpointConfig, type SessionParams, type SessionResult, type SessionStatus, type SessionSubEndpoint, type SharedSignInAuthObjectProperties, type SignInFormValues, type SignInInitialValue, type SignInProps, type SignInPropsTree, type SignInRedirectOptions, type SignInRedirectOptionss, type SignInRedirectUrl, type SignInResource, type SignInResponse, type SignInStatus, type SignInUIConfig, type SignOut, type SignOutOptions, type SignOutOptionsTree, type SignUpFormValues, type SignUpFormValuesTree, type SignUpInitialValue, type SignUpInitialValueTree, type SignUpProps, type SignUpPropsTree, type SignUpRedirectOptions, type SignUpRedirectOptionss, type SignUpRedirectUrl, type SignUpResource, type SignUpStatus, type SignUpUIConfig, type SignedInSession, type TernAuthEventPayload, type TernAuthListenerEvent, type TernAuthListenerEventPayload, type TernAuthSDK, type TernSecureAPIError, type TernSecureAdminConfig, type TernSecureApiErrorJSON, type TernSecureAuth, type TernSecureAuthFactory, type TernSecureAuthOptions, type TernSecureAuthProvider, type TernSecureAuthStatus, type TernSecureConfig, type TernSecureFireRestError, type TernSecureFireRestErrorJSON, type TernSecureHandlerOptions, type TernSecureInstance, type TernSecureInstanceTree, type TernSecureInstanceTreeOptions, type TernSecureInstanceTreeStatus, type TernSecureOptions, type TernSecureResources, type TernSecureSDK, type TernSecureServerConfig, type TernSecureSessionTree, type TernSecureState, type TernSecureUser, type TernSecureUserData, type TernVerificationResult, type ThemeBorderRadius, type ThemeColors, type ThemeComponentStyles, type ThemeFonts, type ThemeSpacing, type TokenCookieConfig, type UnsubscribeCallback, type UseAuthReturn, type UseSignInReturn, type UserInfo, type VerifiedTokens, isSignInResponseTree };
|