dauth-context-react 6.4.0 → 6.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dauth-context-react",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "description": "React provider and hook for passwordless authentication via the Dauth service (BFF pattern with httpOnly cookies)",
5
5
  "license": "MIT",
6
6
  "author": "David T. Pizarro Frick",
package/src/index.tsx CHANGED
@@ -21,6 +21,7 @@ import type {
21
21
  IModalTheme,
22
22
  IPasskeyCredential,
23
23
  DauthProfileModalProps,
24
+ ThemeMode,
24
25
  } from './interfaces';
25
26
 
26
27
  export { DauthProfileModal } from './DauthProfileModal';
@@ -32,6 +33,7 @@ export type {
32
33
  IModalTheme,
33
34
  IPasskeyCredential,
34
35
  DauthProfileModalProps,
36
+ ThemeMode,
35
37
  };
36
38
 
37
39
  const defaultOnError = (error: Error) => console.error(error);
@@ -92,10 +94,12 @@ export const DauthProvider: React.FC<IDauthProviderProps> = (
92
94
  telPrefix,
93
95
  telSuffix,
94
96
  language,
97
+ theme,
95
98
  avatar,
96
99
  birthDate,
97
100
  country,
98
101
  metadata,
102
+ customFields,
99
103
  } = fields;
100
104
  const user = {
101
105
  name,
@@ -104,10 +108,12 @@ export const DauthProvider: React.FC<IDauthProviderProps> = (
104
108
  telPrefix,
105
109
  telSuffix,
106
110
  language,
111
+ theme,
107
112
  avatar,
108
113
  birthDate,
109
114
  country,
110
115
  metadata,
116
+ customFields,
111
117
  } as Partial<IDauthUser>;
112
118
  return action.updateUserAction(ctx, user);
113
119
  },
@@ -6,6 +6,7 @@ const initialDauthState: IDauthState = {
6
6
  (typeof window !== 'undefined'
7
7
  ? window.document.documentElement.getAttribute('lang')
8
8
  : null) || 'es',
9
+ theme: 'system',
9
10
  } as IDauthUser,
10
11
  domain: {} as IDauthDomainState,
11
12
  isLoading: true,
package/src/interfaces.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export type ThemeMode = 'dark' | 'light' | 'system';
2
+
1
3
  export interface IDauthUser {
2
4
  _id: string;
3
5
  name: string;
@@ -6,6 +8,7 @@ export interface IDauthUser {
6
8
  email: string;
7
9
  isVerified: boolean;
8
10
  language: string;
11
+ theme: ThemeMode;
9
12
  avatar: {
10
13
  id: string;
11
14
  url: string;