@truworth/twc-auth 1.2.9 → 1.2.10
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/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +2 -2
- package/build/src/screens/CreatePassword/index.js +2 -2
- package/build/src/screens/CreatePassword/index.native.js +2 -2
- package/build/src/screens/ResetPassword/hooks/internal/useResetPassword.js +2 -0
- package/build/src/screens/ResetPassword/index.js +2 -2
- package/build/src/screens/ResetPassword/index.native.js +2 -2
- package/build/src/screens/SignUp/components/SignUpForm/index.js +2 -2
- package/build/types/screens/CreatePassword/hooks/internal/useCreatePassword.d.ts +1 -1
- package/build/types/screens/ResetPassword/hooks/internal/useResetPassword.d.ts +1 -0
- package/package.json +2 -3
|
@@ -23,7 +23,7 @@ const useCreatePassword = () => {
|
|
|
23
23
|
setConfirmPassword('');
|
|
24
24
|
onResult();
|
|
25
25
|
};
|
|
26
|
-
const
|
|
26
|
+
const isContinueDisabled = !Object.keys(criteria).every(c => criteria[c]) || (password !== confirmPassword);
|
|
27
27
|
return {
|
|
28
28
|
password, setPassword,
|
|
29
29
|
confirmPassword, setConfirmPassword,
|
|
@@ -33,7 +33,7 @@ const useCreatePassword = () => {
|
|
|
33
33
|
criteria, setCriteria,
|
|
34
34
|
handlePassword, handleConfirmPassword,
|
|
35
35
|
handleSkip,
|
|
36
|
-
|
|
36
|
+
isContinueDisabled
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
export { useCreatePassword };
|
|
@@ -12,12 +12,12 @@ const CreatePassword = ({ userDetails, handleBack, onContinue }) => {
|
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
const { password, confirmPassword } = form.watch();
|
|
15
|
-
const { criteria, setCriteria, maxLength, setMaxLength, handleSkip, } = useCreatePassword();
|
|
15
|
+
const { criteria, setCriteria, maxLength, setMaxLength, handleSkip, isContinueDisabled } = useCreatePassword();
|
|
16
16
|
return (_jsx(ScreenLayout, { title: _jsxs(Flex, { justify: "between", align: "center", children: [_jsx(Typography, { type: "heading", size: "h5", children: "Create your Password" }), countryCode == '91' &&
|
|
17
17
|
_jsx(Button, { label: "Skip Now", variant: "link", onClick: () => handleSkip({ onResult: onContinue }) })] }), subTitle: "Use a password that's easy to remember and fulfills all the requirements listed below.", buttonProps: {
|
|
18
18
|
label: 'Continue',
|
|
19
19
|
onClick: () => onContinue(password, confirmPassword),
|
|
20
|
-
disabled:
|
|
20
|
+
disabled: isContinueDisabled
|
|
21
21
|
}, onPressBack: handleBack, children: _jsxs(Form, { form: form, className: 'w-full', children: [_jsx(Form.Item, { name: "password", label: "Enter Password", normalize: (value) => value.replace(/\s/g, ''), rules: [
|
|
22
22
|
{
|
|
23
23
|
required: true,
|
|
@@ -8,14 +8,14 @@ import { PasswordCriteria } from '../../components/PasswordCriteria/index.native
|
|
|
8
8
|
const { primary } = Colors;
|
|
9
9
|
const CreatePassword = ({ navigation, route }) => {
|
|
10
10
|
const { countryCode, email } = route.params;
|
|
11
|
-
const { password, confirmPassword, passwordVisible, setPasswordVisible, confirmPasswordVisible, setConfirmPasswordVisible, maxLength, setMaxLength, criteria, setCriteria, handlePassword, handleConfirmPassword, handleSkip,
|
|
11
|
+
const { password, confirmPassword, passwordVisible, setPasswordVisible, confirmPasswordVisible, setConfirmPasswordVisible, maxLength, setMaxLength, criteria, setCriteria, handlePassword, handleConfirmPassword, handleSkip, isContinueDisabled } = useCreatePassword();
|
|
12
12
|
const onContinue = () => {
|
|
13
13
|
navigation.navigate('UserConsent', { ...route.params, password });
|
|
14
14
|
};
|
|
15
15
|
return (_jsx(Layout, { style: { flex: 1, backgroundColor: primary.white }, children: _jsxs(ScreenLayout, { title: "Create your Password", subTitle: "Use a password that\u2019s easy to remember and fulfills all the requirement listed below.", buttonProps: {
|
|
16
16
|
label: 'Continue',
|
|
17
17
|
onPress: onContinue,
|
|
18
|
-
disabled:
|
|
18
|
+
disabled: isContinueDisabled,
|
|
19
19
|
}, accessoryRight: countryCode == '91'
|
|
20
20
|
? _jsx(TouchableOpacity, { activeOpacity: 0.8, onPress: () => {
|
|
21
21
|
Keyboard.dismiss();
|
|
@@ -39,6 +39,7 @@ const useResetPassword = ({ sessionToken }) => {
|
|
|
39
39
|
showMessage({ message: err?.response?.data?.errors?.[0]?.message || 'An unexpected error occurred' });
|
|
40
40
|
}).finally(() => setLoading(false));
|
|
41
41
|
};
|
|
42
|
+
const isContinueDisabled = !Object.keys(criteria).every(c => criteria[c]) || (password !== confirmPassword);
|
|
42
43
|
return {
|
|
43
44
|
loading,
|
|
44
45
|
password, setPassword,
|
|
@@ -50,6 +51,7 @@ const useResetPassword = ({ sessionToken }) => {
|
|
|
50
51
|
handlePassword,
|
|
51
52
|
handleContinue,
|
|
52
53
|
handleConfirmPassword,
|
|
54
|
+
isContinueDisabled
|
|
53
55
|
};
|
|
54
56
|
};
|
|
55
57
|
export { useResetPassword };
|
|
@@ -11,12 +11,12 @@ const ResetPassword = ({ email, sessionToken, onPressBack, onContinue }) => {
|
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
const { password, confirmPassword } = form.watch();
|
|
14
|
-
const { loading, criteria, setCriteria, maxLength, setMaxLength, handlePassword, handleConfirmPassword, handleContinue, } = useResetPassword({ sessionToken });
|
|
14
|
+
const { loading, criteria, setCriteria, maxLength, setMaxLength, handlePassword, handleConfirmPassword, handleContinue, isContinueDisabled } = useResetPassword({ sessionToken });
|
|
15
15
|
return (_jsx(ScreenLayout, { title: "Reset your Password", subTitle: "Use a password that\u2019s easy to remember and fulfills all the requirements listed below.", buttonProps: {
|
|
16
16
|
loading,
|
|
17
17
|
label: 'Continue',
|
|
18
18
|
onClick: () => handleContinue({ onResult: onContinue }),
|
|
19
|
-
disabled:
|
|
19
|
+
disabled: isContinueDisabled
|
|
20
20
|
}, onPressBack: onPressBack, children: _jsx(Flex, { direction: "column", children: _jsxs(Form, { form: form, className: "w-full", children: [_jsx(Form.Item, { label: "Enter Password", normalize: (value) => value.replace(/\s/g, ''), rules: [
|
|
21
21
|
{
|
|
22
22
|
required: true,
|
|
@@ -7,7 +7,7 @@ import { PasswordCriteria } from '../../components/PasswordCriteria/index.native
|
|
|
7
7
|
const { primary } = Colors;
|
|
8
8
|
const ResetPassword = ({ navigation, route }) => {
|
|
9
9
|
const { sessionToken, email } = route.params || {};
|
|
10
|
-
const { loading, password, confirmPassword, passwordVisible, setPasswordVisible, confirmPasswordVisible, setConfirmPasswordVisible, maxLength, setMaxLength, criteria, setCriteria, handlePassword, handleContinue, handleConfirmPassword, } = useResetPassword({ sessionToken });
|
|
10
|
+
const { loading, password, confirmPassword, passwordVisible, setPasswordVisible, confirmPasswordVisible, setConfirmPasswordVisible, maxLength, setMaxLength, criteria, setCriteria, handlePassword, handleContinue, handleConfirmPassword, isContinueDisabled } = useResetPassword({ sessionToken });
|
|
11
11
|
return (_jsx(Layout, { style: { flex: 1, backgroundColor: primary.white }, children: _jsxs(ScreenLayout, { title: "Reset your Password", subTitle: "Use a password that\u2019s easy to remember and fulfills all the requirements listed below.", buttonProps: {
|
|
12
12
|
loading,
|
|
13
13
|
label: 'Continue',
|
|
@@ -16,7 +16,7 @@ const ResetPassword = ({ navigation, route }) => {
|
|
|
16
16
|
onResult: () => navigation.navigate('EnterEmail')
|
|
17
17
|
});
|
|
18
18
|
},
|
|
19
|
-
disabled:
|
|
19
|
+
disabled: isContinueDisabled
|
|
20
20
|
}, children: [_jsx(TextInputField, { placeholder: "Enter password...", onChangeValue: handlePassword, secureTextEntry: !passwordVisible, value: password, rightIcon2: passwordVisible
|
|
21
21
|
? 'eye-outline'
|
|
22
22
|
: 'eye-off-outline', onPressRightIcon2: () => setPasswordVisible(!passwordVisible), autoFocus: true, maxLength: maxLength }), _jsx(PasswordCriteria, { email: email, criteria: criteria, onCriteriaChange: setCriteria, onMaxLengthChange: setMaxLength, password: password }), _jsx(TextInputField, { placeholder: "Confirm password...", onChangeValue: handleConfirmPassword, secureTextEntry: !confirmPasswordVisible, value: confirmPassword, rightIcon2: confirmPasswordVisible
|
|
@@ -27,8 +27,8 @@ const SignUpFormComponent = ({ userDetails, onContinue }) => {
|
|
|
27
27
|
const form = useForm({
|
|
28
28
|
liveValidation: true,
|
|
29
29
|
defaultValues: {
|
|
30
|
-
firstName: userDetails.firstName ??
|
|
31
|
-
lastName: userDetails.lastName ??
|
|
30
|
+
firstName: userDetails.firstName ?? getQueryParam(router.query.firstName),
|
|
31
|
+
lastName: userDetails.lastName ?? getQueryParam(router.query.lastName),
|
|
32
32
|
dateOfBirth: userDetails.selectedDOB,
|
|
33
33
|
email: userDetails.email ?? "",
|
|
34
34
|
phone: userDetails.phone ?? "",
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"description": "Truworth Auth Package for React Native and Web",
|
|
7
|
-
"version": "1.2.
|
|
7
|
+
"version": "1.2.10",
|
|
8
8
|
"main": "build/src/index.js",
|
|
9
9
|
"types": "build/types/index.d.ts",
|
|
10
10
|
"files": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"lottie-react": "^2.4.1",
|
|
47
47
|
"lottie-react-native": "6.7.2",
|
|
48
48
|
"moment": "^2.30.1",
|
|
49
|
-
"next": "
|
|
49
|
+
"next": "15.5.9",
|
|
50
50
|
"react": "18.3.1",
|
|
51
51
|
"react-dom": "^18.2.0",
|
|
52
52
|
"react-google-login": "^5.2.2",
|
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
"react-native-rsa-native": "2.0.5",
|
|
64
64
|
"react-native-safe-area-context": "4.14.0",
|
|
65
65
|
"react-native-svg": "15.8.0",
|
|
66
|
-
"react-native-svg-uri": "^1.2.3",
|
|
67
66
|
"react-native-vector-icons": "9.2.0",
|
|
68
67
|
"react-redux": "^9.2.0",
|
|
69
68
|
"sweetalert2": "^11.23.0",
|