dauth-context-react 6.1.0 → 6.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.
package/dist/index.d.mts CHANGED
@@ -18,6 +18,7 @@ interface IDauthUser {
18
18
  birthDate?: Date;
19
19
  country?: string;
20
20
  metadata?: Record<string, unknown>;
21
+ customFields?: Record<string, string>;
21
22
  createdAt: Date;
22
23
  updatedAt: Date;
23
24
  lastLogin: Date;
@@ -34,6 +35,11 @@ interface IFormField {
34
35
  field: string;
35
36
  required: boolean;
36
37
  }
38
+ interface ICustomField {
39
+ key: string;
40
+ label: string;
41
+ required: boolean;
42
+ }
37
43
  interface IModalTheme {
38
44
  accent?: string;
39
45
  accentHover?: string;
@@ -50,8 +56,17 @@ interface IDauthDomainState {
50
56
  allowedOrigins: string[];
51
57
  authMethods?: IDauthAuthMethods;
52
58
  formFields?: IFormField[];
59
+ customFields?: ICustomField[];
53
60
  modalTheme?: IModalTheme;
54
61
  }
62
+ interface IPasskeyCredential {
63
+ _id: string;
64
+ name?: string;
65
+ deviceType: 'singleDevice' | 'multiDevice';
66
+ backedUp: boolean;
67
+ createdAt: string;
68
+ lastUsedAt?: string;
69
+ }
55
70
  interface IDauthState {
56
71
  user: IDauthUser;
57
72
  domain: IDauthDomainState;
@@ -61,10 +76,17 @@ interface IDauthState {
61
76
  logout: () => void;
62
77
  updateUser: (fields: Partial<IDauthUser>) => Promise<boolean>;
63
78
  deleteAccount: () => Promise<boolean>;
79
+ getPasskeyCredentials: () => Promise<IPasskeyCredential[]>;
80
+ registerPasskey: (name?: string) => Promise<IPasskeyCredential | null>;
81
+ deletePasskeyCredential: (credentialId: string) => Promise<boolean>;
64
82
  }
65
83
  interface DauthProfileModalProps {
66
84
  open: boolean;
67
85
  onClose: () => void;
86
+ /** Optional: provide a function to handle avatar upload.
87
+ * Receives a File, should return the URL string.
88
+ * If not provided, the avatar edit button is hidden. */
89
+ onAvatarUpload?: (file: File) => Promise<string>;
68
90
  }
69
91
  interface IDauthProviderProps {
70
92
  domainName: string;
@@ -77,9 +99,9 @@ interface IDauthProviderProps {
77
99
  dauthUrl?: string;
78
100
  }
79
101
 
80
- declare function DauthProfileModal({ open, onClose }: DauthProfileModalProps): React$1.ReactPortal | null;
102
+ declare function DauthProfileModal({ open, onClose, onAvatarUpload, }: DauthProfileModalProps): React$1.ReactPortal | null;
81
103
 
82
104
  declare const DauthProvider: React$1.FC<IDauthProviderProps>;
83
105
  declare const useDauth: () => IDauthState;
84
106
 
85
- export { DauthProfileModal, type DauthProfileModalProps, DauthProvider, type IDauthAuthMethods, type IDauthProviderProps, type IFormField, type IModalTheme, useDauth };
107
+ export { DauthProfileModal, type DauthProfileModalProps, DauthProvider, type ICustomField, type IDauthAuthMethods, type IDauthProviderProps, type IFormField, type IModalTheme, type IPasskeyCredential, useDauth };
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ interface IDauthUser {
18
18
  birthDate?: Date;
19
19
  country?: string;
20
20
  metadata?: Record<string, unknown>;
21
+ customFields?: Record<string, string>;
21
22
  createdAt: Date;
22
23
  updatedAt: Date;
23
24
  lastLogin: Date;
@@ -34,6 +35,11 @@ interface IFormField {
34
35
  field: string;
35
36
  required: boolean;
36
37
  }
38
+ interface ICustomField {
39
+ key: string;
40
+ label: string;
41
+ required: boolean;
42
+ }
37
43
  interface IModalTheme {
38
44
  accent?: string;
39
45
  accentHover?: string;
@@ -50,8 +56,17 @@ interface IDauthDomainState {
50
56
  allowedOrigins: string[];
51
57
  authMethods?: IDauthAuthMethods;
52
58
  formFields?: IFormField[];
59
+ customFields?: ICustomField[];
53
60
  modalTheme?: IModalTheme;
54
61
  }
62
+ interface IPasskeyCredential {
63
+ _id: string;
64
+ name?: string;
65
+ deviceType: 'singleDevice' | 'multiDevice';
66
+ backedUp: boolean;
67
+ createdAt: string;
68
+ lastUsedAt?: string;
69
+ }
55
70
  interface IDauthState {
56
71
  user: IDauthUser;
57
72
  domain: IDauthDomainState;
@@ -61,10 +76,17 @@ interface IDauthState {
61
76
  logout: () => void;
62
77
  updateUser: (fields: Partial<IDauthUser>) => Promise<boolean>;
63
78
  deleteAccount: () => Promise<boolean>;
79
+ getPasskeyCredentials: () => Promise<IPasskeyCredential[]>;
80
+ registerPasskey: (name?: string) => Promise<IPasskeyCredential | null>;
81
+ deletePasskeyCredential: (credentialId: string) => Promise<boolean>;
64
82
  }
65
83
  interface DauthProfileModalProps {
66
84
  open: boolean;
67
85
  onClose: () => void;
86
+ /** Optional: provide a function to handle avatar upload.
87
+ * Receives a File, should return the URL string.
88
+ * If not provided, the avatar edit button is hidden. */
89
+ onAvatarUpload?: (file: File) => Promise<string>;
68
90
  }
69
91
  interface IDauthProviderProps {
70
92
  domainName: string;
@@ -77,9 +99,9 @@ interface IDauthProviderProps {
77
99
  dauthUrl?: string;
78
100
  }
79
101
 
80
- declare function DauthProfileModal({ open, onClose }: DauthProfileModalProps): React$1.ReactPortal | null;
102
+ declare function DauthProfileModal({ open, onClose, onAvatarUpload, }: DauthProfileModalProps): React$1.ReactPortal | null;
81
103
 
82
104
  declare const DauthProvider: React$1.FC<IDauthProviderProps>;
83
105
  declare const useDauth: () => IDauthState;
84
106
 
85
- export { DauthProfileModal, type DauthProfileModalProps, DauthProvider, type IDauthAuthMethods, type IDauthProviderProps, type IFormField, type IModalTheme, useDauth };
107
+ export { DauthProfileModal, type DauthProfileModalProps, DauthProvider, type ICustomField, type IDauthAuthMethods, type IDauthProviderProps, type IFormField, type IModalTheme, type IPasskeyCredential, useDauth };