dauth-context-react 2.2.0 → 2.3.0

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.
@@ -1,49 +1,65 @@
1
- export interface IDauthUser {
2
- _id: string;
3
- name: string;
4
- lastname: string;
5
- nickname: string;
6
- email: string;
7
- isVerified: boolean;
8
- language: string;
9
- avatar: {
10
- id: string;
11
- url: string;
12
- };
13
- role: string;
14
- telPrefix: string;
15
- telSuffix: string;
16
- birthDate?: Date;
17
- country?: string;
18
- metadata?: Record<string, unknown>;
19
- createdAt: Date;
20
- updatedAt: Date;
21
- lastLogin: Date;
22
- }
23
- export interface IDauthDomainState {
24
- name: string;
25
- loginRedirect: string;
26
- allowedOrigins: string[];
27
- }
28
- export interface IDauthState {
29
- user: IDauthUser;
30
- domain: IDauthDomainState;
31
- isLoading: boolean;
32
- isAuthenticated: boolean;
33
- loginWithRedirect: () => void;
34
- logout: () => void;
35
- getAccessToken: () => Promise<string>;
36
- updateUser: (fields: Partial<IDauthUser>) => Promise<boolean>;
37
- updateUserWithRedirect: () => void;
38
- sendEmailVerificationStatus: {
39
- status: IActionStatus;
40
- isLoading: boolean;
41
- };
42
- sendEmailVerification: () => Promise<boolean>;
43
- deleteAccount: () => Promise<boolean>;
44
- }
45
- export interface IActionStatus {
46
- type: TStatusTypes;
47
- message: string;
48
- }
49
- export declare type TStatusTypes = 'success' | 'error' | 'info' | 'warning';
1
+ import React$1 from 'react';
2
+
3
+ interface IDauthUser {
4
+ _id: string;
5
+ name: string;
6
+ lastname: string;
7
+ nickname: string;
8
+ email: string;
9
+ isVerified: boolean;
10
+ language: string;
11
+ avatar: {
12
+ id: string;
13
+ url: string;
14
+ };
15
+ role: string;
16
+ telPrefix: string;
17
+ telSuffix: string;
18
+ birthDate?: Date;
19
+ country?: string;
20
+ metadata?: Record<string, unknown>;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ lastLogin: Date;
24
+ }
25
+ interface IDauthDomainState {
26
+ name: string;
27
+ loginRedirect: string;
28
+ allowedOrigins: string[];
29
+ }
30
+ interface IDauthState {
31
+ user: IDauthUser;
32
+ domain: IDauthDomainState;
33
+ isLoading: boolean;
34
+ isAuthenticated: boolean;
35
+ loginWithRedirect: () => void;
36
+ logout: () => void;
37
+ getAccessToken: () => Promise<string>;
38
+ updateUser: (fields: Partial<IDauthUser>) => Promise<boolean>;
39
+ updateUserWithRedirect: () => void;
40
+ sendEmailVerificationStatus: {
41
+ status: IActionStatus;
42
+ isLoading: boolean;
43
+ };
44
+ sendEmailVerification: () => Promise<boolean>;
45
+ deleteAccount: () => Promise<boolean>;
46
+ }
47
+ interface IActionStatus {
48
+ type: TStatusTypes;
49
+ message: string;
50
+ }
51
+ type TStatusTypes = 'success' | 'error' | 'info' | 'warning';
52
+ interface IDauthProviderProps {
53
+ domainName: string;
54
+ children: React.ReactNode;
55
+ storageKey?: {
56
+ accessToken?: string;
57
+ refreshToken?: string;
58
+ };
59
+ onError?: (error: Error) => void;
60
+ }
61
+
62
+ declare const DauthProvider: React$1.FC<IDauthProviderProps>;
63
+ declare const useDauth: () => IDauthState;
64
+
65
+ export { DauthProvider, type IDauthProviderProps, useDauth };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,65 @@
1
- import React from 'react';
2
- interface DauthProviderProps {
3
- domainName: string;
4
- children: React.ReactNode;
5
- }
6
- export declare const DauthProvider: React.FC<DauthProviderProps>;
7
- export declare const useDauth: () => import("./interfaces").IDauthState;
8
- export {};
1
+ import React$1 from 'react';
2
+
3
+ interface IDauthUser {
4
+ _id: string;
5
+ name: string;
6
+ lastname: string;
7
+ nickname: string;
8
+ email: string;
9
+ isVerified: boolean;
10
+ language: string;
11
+ avatar: {
12
+ id: string;
13
+ url: string;
14
+ };
15
+ role: string;
16
+ telPrefix: string;
17
+ telSuffix: string;
18
+ birthDate?: Date;
19
+ country?: string;
20
+ metadata?: Record<string, unknown>;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ lastLogin: Date;
24
+ }
25
+ interface IDauthDomainState {
26
+ name: string;
27
+ loginRedirect: string;
28
+ allowedOrigins: string[];
29
+ }
30
+ interface IDauthState {
31
+ user: IDauthUser;
32
+ domain: IDauthDomainState;
33
+ isLoading: boolean;
34
+ isAuthenticated: boolean;
35
+ loginWithRedirect: () => void;
36
+ logout: () => void;
37
+ getAccessToken: () => Promise<string>;
38
+ updateUser: (fields: Partial<IDauthUser>) => Promise<boolean>;
39
+ updateUserWithRedirect: () => void;
40
+ sendEmailVerificationStatus: {
41
+ status: IActionStatus;
42
+ isLoading: boolean;
43
+ };
44
+ sendEmailVerification: () => Promise<boolean>;
45
+ deleteAccount: () => Promise<boolean>;
46
+ }
47
+ interface IActionStatus {
48
+ type: TStatusTypes;
49
+ message: string;
50
+ }
51
+ type TStatusTypes = 'success' | 'error' | 'info' | 'warning';
52
+ interface IDauthProviderProps {
53
+ domainName: string;
54
+ children: React.ReactNode;
55
+ storageKey?: {
56
+ accessToken?: string;
57
+ refreshToken?: string;
58
+ };
59
+ onError?: (error: Error) => void;
60
+ }
61
+
62
+ declare const DauthProvider: React$1.FC<IDauthProviderProps>;
63
+ declare const useDauth: () => IDauthState;
64
+
65
+ export { DauthProvider, type IDauthProviderProps, useDauth };