@ttoss/react-auth-core 0.2.0 → 0.2.2
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 +4 -10
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +4 -10
- package/package.json +7 -7
package/dist/esm/index.js
CHANGED
|
@@ -241,7 +241,7 @@ var AuthForgotPassword = props => {
|
|
|
241
241
|
}).required();
|
|
242
242
|
const formMethods = useForm2({
|
|
243
243
|
resolver: yupResolver2(schema),
|
|
244
|
-
mode: "
|
|
244
|
+
mode: "onChange"
|
|
245
245
|
});
|
|
246
246
|
return /* @__PURE__ */jsx4(Form2, {
|
|
247
247
|
...formMethods,
|
|
@@ -370,7 +370,7 @@ var AuthForgotPasswordResetPassword = props => {
|
|
|
370
370
|
});
|
|
371
371
|
const formMethods = useForm3({
|
|
372
372
|
resolver: yupResolver3(schema),
|
|
373
|
-
mode: "
|
|
373
|
+
mode: "onChange"
|
|
374
374
|
});
|
|
375
375
|
return /* @__PURE__ */jsx5(Form3, {
|
|
376
376
|
...formMethods,
|
|
@@ -517,7 +517,7 @@ var AuthSignIn = ({
|
|
|
517
517
|
});
|
|
518
518
|
const formMethods = useForm4({
|
|
519
519
|
defaultValues,
|
|
520
|
-
mode: "
|
|
520
|
+
mode: "onChange",
|
|
521
521
|
resolver: yupResolver4(schema)
|
|
522
522
|
});
|
|
523
523
|
const onSubmitForm = data => {
|
|
@@ -726,7 +726,7 @@ var AuthSignUp = props => {
|
|
|
726
726
|
}
|
|
727
727
|
}, [props.signUpTerms, signUpTermsLabel]);
|
|
728
728
|
const formMethods = useForm5({
|
|
729
|
-
mode: "
|
|
729
|
+
mode: "onChange",
|
|
730
730
|
resolver: yupResolver5(schema)
|
|
731
731
|
});
|
|
732
732
|
const onSubmitForm = data => {
|
|
@@ -1031,25 +1031,19 @@ var AuthProvider = props => {
|
|
|
1031
1031
|
setLoading(authData.isAuthenticated === void 0);
|
|
1032
1032
|
}, [authData.isAuthenticated, setLoading]);
|
|
1033
1033
|
React4.useEffect(() => {
|
|
1034
|
-
let isMounted = true;
|
|
1035
1034
|
const fetchAuthData = async () => {
|
|
1036
1035
|
try {
|
|
1037
1036
|
const data = await getAuthData?.();
|
|
1038
|
-
if (!isMounted) return;
|
|
1039
1037
|
if (data) {
|
|
1040
1038
|
setAuthData(data);
|
|
1041
1039
|
} else {
|
|
1042
1040
|
setAuthData(UNAUTHENTICATED_USER);
|
|
1043
1041
|
}
|
|
1044
1042
|
} catch {
|
|
1045
|
-
if (!isMounted) return;
|
|
1046
1043
|
setAuthData(UNAUTHENTICATED_USER);
|
|
1047
1044
|
}
|
|
1048
1045
|
};
|
|
1049
1046
|
fetchAuthData();
|
|
1050
|
-
return () => {
|
|
1051
|
-
isMounted = false;
|
|
1052
|
-
};
|
|
1053
1047
|
}, [getAuthData]);
|
|
1054
1048
|
const signOut = React4.useCallback(async () => {
|
|
1055
1049
|
await signOutProp?.();
|
package/dist/index.d.cts
CHANGED
|
@@ -24,7 +24,7 @@ type AuthData = {
|
|
|
24
24
|
isAuthenticated: boolean | undefined;
|
|
25
25
|
};
|
|
26
26
|
type AuthContextValue = {
|
|
27
|
-
signOut
|
|
27
|
+
signOut: () => Promise<void>;
|
|
28
28
|
isAuthenticated: boolean;
|
|
29
29
|
user: AuthUser | null;
|
|
30
30
|
tokens: AuthTokens | null;
|
|
@@ -141,9 +141,8 @@ declare const AuthFullScreen: ({ children }: AuthFullScreenProps) => react_jsx_r
|
|
|
141
141
|
|
|
142
142
|
type AuthProviderProps = {
|
|
143
143
|
children: React$1.ReactNode;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
signOut?: () => Promise<void>;
|
|
144
|
+
getAuthData: () => Promise<AuthData | null>;
|
|
145
|
+
signOut: () => Promise<void>;
|
|
147
146
|
};
|
|
148
147
|
declare const AuthProvider: (props: AuthProviderProps) => react_jsx_runtime.JSX.Element | null;
|
|
149
148
|
declare const useAuth: () => AuthContextValue;
|
package/dist/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ type AuthData = {
|
|
|
24
24
|
isAuthenticated: boolean | undefined;
|
|
25
25
|
};
|
|
26
26
|
type AuthContextValue = {
|
|
27
|
-
signOut
|
|
27
|
+
signOut: () => Promise<void>;
|
|
28
28
|
isAuthenticated: boolean;
|
|
29
29
|
user: AuthUser | null;
|
|
30
30
|
tokens: AuthTokens | null;
|
|
@@ -141,9 +141,8 @@ declare const AuthFullScreen: ({ children }: AuthFullScreenProps) => react_jsx_r
|
|
|
141
141
|
|
|
142
142
|
type AuthProviderProps = {
|
|
143
143
|
children: React$1.ReactNode;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
signOut?: () => Promise<void>;
|
|
144
|
+
getAuthData: () => Promise<AuthData | null>;
|
|
145
|
+
signOut: () => Promise<void>;
|
|
147
146
|
};
|
|
148
147
|
declare const AuthProvider: (props: AuthProviderProps) => react_jsx_runtime.JSX.Element | null;
|
|
149
148
|
declare const useAuth: () => AuthContextValue;
|
package/dist/index.js
CHANGED
|
@@ -294,7 +294,7 @@ var AuthForgotPassword = props => {
|
|
|
294
294
|
}).required();
|
|
295
295
|
const formMethods = (0, import_forms2.useForm)({
|
|
296
296
|
resolver: (0, import_forms2.yupResolver)(schema),
|
|
297
|
-
mode: "
|
|
297
|
+
mode: "onChange"
|
|
298
298
|
});
|
|
299
299
|
return /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_forms2.Form, {
|
|
300
300
|
...formMethods,
|
|
@@ -423,7 +423,7 @@ var AuthForgotPasswordResetPassword = props => {
|
|
|
423
423
|
});
|
|
424
424
|
const formMethods = (0, import_forms3.useForm)({
|
|
425
425
|
resolver: (0, import_forms3.yupResolver)(schema),
|
|
426
|
-
mode: "
|
|
426
|
+
mode: "onChange"
|
|
427
427
|
});
|
|
428
428
|
return /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_forms3.Form, {
|
|
429
429
|
...formMethods,
|
|
@@ -570,7 +570,7 @@ var AuthSignIn = ({
|
|
|
570
570
|
});
|
|
571
571
|
const formMethods = (0, import_forms4.useForm)({
|
|
572
572
|
defaultValues,
|
|
573
|
-
mode: "
|
|
573
|
+
mode: "onChange",
|
|
574
574
|
resolver: (0, import_forms4.yupResolver)(schema)
|
|
575
575
|
});
|
|
576
576
|
const onSubmitForm = data => {
|
|
@@ -779,7 +779,7 @@ var AuthSignUp = props => {
|
|
|
779
779
|
}
|
|
780
780
|
}, [props.signUpTerms, signUpTermsLabel]);
|
|
781
781
|
const formMethods = (0, import_forms5.useForm)({
|
|
782
|
-
mode: "
|
|
782
|
+
mode: "onChange",
|
|
783
783
|
resolver: (0, import_forms5.yupResolver)(schema)
|
|
784
784
|
});
|
|
785
785
|
const onSubmitForm = data => {
|
|
@@ -1084,25 +1084,19 @@ var AuthProvider = props => {
|
|
|
1084
1084
|
setLoading(authData.isAuthenticated === void 0);
|
|
1085
1085
|
}, [authData.isAuthenticated, setLoading]);
|
|
1086
1086
|
React4.useEffect(() => {
|
|
1087
|
-
let isMounted = true;
|
|
1088
1087
|
const fetchAuthData = async () => {
|
|
1089
1088
|
try {
|
|
1090
1089
|
const data = await getAuthData?.();
|
|
1091
|
-
if (!isMounted) return;
|
|
1092
1090
|
if (data) {
|
|
1093
1091
|
setAuthData(data);
|
|
1094
1092
|
} else {
|
|
1095
1093
|
setAuthData(UNAUTHENTICATED_USER);
|
|
1096
1094
|
}
|
|
1097
1095
|
} catch {
|
|
1098
|
-
if (!isMounted) return;
|
|
1099
1096
|
setAuthData(UNAUTHENTICATED_USER);
|
|
1100
1097
|
}
|
|
1101
1098
|
};
|
|
1102
1099
|
fetchAuthData();
|
|
1103
|
-
return () => {
|
|
1104
|
-
isMounted = false;
|
|
1105
|
-
};
|
|
1106
1100
|
}, [getAuthData]);
|
|
1107
1101
|
const signOut = React4.useCallback(async () => {
|
|
1108
1102
|
await signOutProp?.();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/react-auth-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Core authentication components and abstractions for React apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": ">=16.8.0",
|
|
32
|
-
"@ttoss/components": "^2.2.26",
|
|
33
32
|
"@ttoss/forms": "^0.31.3",
|
|
34
33
|
"@ttoss/logger": "^0.6.4",
|
|
35
34
|
"@ttoss/react-notifications": "^2.4.3",
|
|
36
|
-
"@ttoss/
|
|
37
|
-
"@ttoss/react-i18n": "^2.0.14"
|
|
35
|
+
"@ttoss/components": "^2.2.26",
|
|
36
|
+
"@ttoss/react-i18n": "^2.0.14",
|
|
37
|
+
"@ttoss/ui": "^5.9.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@jest/globals": "^29.7.0",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"react": "^19.1.0",
|
|
44
44
|
"tsup": "^8.5.0",
|
|
45
45
|
"@ttoss/components": "^2.2.26",
|
|
46
|
-
"@ttoss/
|
|
46
|
+
"@ttoss/config": "^1.35.6",
|
|
47
47
|
"@ttoss/forms": "^0.31.3",
|
|
48
|
+
"@ttoss/logger": "^0.6.4",
|
|
49
|
+
"@ttoss/i18n-cli": "^0.7.31",
|
|
48
50
|
"@ttoss/react-i18n": "^2.0.14",
|
|
49
51
|
"@ttoss/react-notifications": "^2.4.3",
|
|
50
|
-
"@ttoss/logger": "^0.6.4",
|
|
51
|
-
"@ttoss/config": "^1.35.6",
|
|
52
52
|
"@ttoss/test-utils": "^2.1.26",
|
|
53
53
|
"@ttoss/ui": "^5.9.2"
|
|
54
54
|
},
|