1 | import * as React from 'react';
|
2 | import { ReactFireOptions, ObservableStatus } from './';
|
3 | import type { Auth, User, IdTokenResult } from 'firebase/auth';
|
4 | declare type Claims = IdTokenResult['claims'];
|
5 | export declare function preloadUser(authResolver: () => Promise<Auth>): Promise<User | null | undefined>;
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | export declare function useUser<T = unknown>(options?: ReactFireOptions<T>): ObservableStatus<User | null>;
|
12 | export declare function useIdTokenResult(user: User, forceRefresh?: boolean, options?: ReactFireOptions<IdTokenResult>): ObservableStatus<IdTokenResult>;
|
13 | export interface AuthCheckProps {
|
14 | fallback: React.ReactNode;
|
15 | children: React.ReactNode;
|
16 | requiredClaims?: Object;
|
17 | }
|
18 | export interface ClaimsCheckProps {
|
19 | user: User;
|
20 | fallback: React.ReactNode;
|
21 | children: React.ReactNode;
|
22 | requiredClaims: {
|
23 | [key: string]: any;
|
24 | };
|
25 | }
|
26 | export interface ClaimCheckErrors {
|
27 | [key: string]: any[];
|
28 | }
|
29 | export declare type SigninCheckResult = {
|
30 | signedIn: false;
|
31 | hasRequiredClaims: false;
|
32 | errors: {};
|
33 | user: null;
|
34 | } | {
|
35 | signedIn: true;
|
36 | hasRequiredClaims: boolean;
|
37 | errors: ClaimCheckErrors;
|
38 | user: User;
|
39 | };
|
40 | export interface SignInCheckOptionsBasic extends ReactFireOptions<SigninCheckResult> {
|
41 | forceRefresh?: boolean;
|
42 | }
|
43 | export interface SignInCheckOptionsClaimsObject extends SignInCheckOptionsBasic {
|
44 | requiredClaims: Claims;
|
45 | }
|
46 | export interface ClaimsValidator {
|
47 | (claims: Claims): {
|
48 | hasRequiredClaims: boolean;
|
49 | errors: ClaimCheckErrors | {};
|
50 | };
|
51 | }
|
52 | export interface SignInCheckOptionsClaimsValidator extends SignInCheckOptionsBasic {
|
53 | validateCustomClaims: ClaimsValidator;
|
54 | }
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 | export declare function useSigninCheck(options?: SignInCheckOptionsBasic | SignInCheckOptionsClaimsObject | SignInCheckOptionsClaimsValidator): ObservableStatus<SigninCheckResult>;
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | export declare function ClaimsCheck({ user, fallback, children, requiredClaims }: ClaimsCheckProps): JSX.Element;
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 | export declare function AuthCheck({ fallback, children, requiredClaims }: AuthCheckProps): JSX.Element;
|
104 | export {};
|