@umituz/react-native-firebase 2.1.1 → 2.2.1
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 +1 -1
- package/src/domains/account-deletion/index.ts +2 -2
- package/src/domains/account-deletion/presentation/components/PasswordPromptScreen.tsx +145 -0
- package/src/domains/account-deletion/presentation/hooks/usePasswordPrompt.tsx +2 -2
- package/src/domains/account-deletion/presentation/components/PasswordPromptModal.tsx +0 -106
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-firebase",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Unified Firebase package for React Native apps - Auth and Firestore services using Firebase JS SDK (no native modules).",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -27,8 +27,8 @@ export {
|
|
|
27
27
|
getAppleReauthCredential,
|
|
28
28
|
} from './infrastructure/services/reauthentication.service';
|
|
29
29
|
|
|
30
|
-
export {
|
|
31
|
-
export type {
|
|
30
|
+
export { PasswordPromptScreen } from './presentation/components/PasswordPromptScreen';
|
|
31
|
+
export type { PasswordPromptScreenProps } from './presentation/components/PasswordPromptScreen';
|
|
32
32
|
|
|
33
33
|
export { usePasswordPrompt } from './presentation/hooks/usePasswordPrompt';
|
|
34
34
|
export type { UsePasswordPromptOptions, UsePasswordPromptReturn } from './presentation/hooks/usePasswordPrompt';
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Password Prompt Screen
|
|
3
|
+
* Full-screen modal for password input during account deletion reauthentication
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { View, StyleSheet, SafeAreaView, KeyboardAvoidingView, Platform } from 'react-native';
|
|
8
|
+
import {
|
|
9
|
+
BaseModal,
|
|
10
|
+
AtomicInput,
|
|
11
|
+
AtomicButton,
|
|
12
|
+
AtomicText,
|
|
13
|
+
useAppDesignTokens
|
|
14
|
+
} from '@umituz/react-native-design-system';
|
|
15
|
+
|
|
16
|
+
export interface PasswordPromptScreenProps {
|
|
17
|
+
visible: boolean;
|
|
18
|
+
onConfirm: (password: string) => void;
|
|
19
|
+
onCancel: () => void;
|
|
20
|
+
title?: string;
|
|
21
|
+
message?: string;
|
|
22
|
+
confirmText?: string;
|
|
23
|
+
cancelText?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const PasswordPromptScreen: React.FC<PasswordPromptScreenProps> = ({
|
|
27
|
+
visible,
|
|
28
|
+
onConfirm,
|
|
29
|
+
onCancel,
|
|
30
|
+
title = 'Password Required',
|
|
31
|
+
message = 'Enter your password to continue',
|
|
32
|
+
confirmText = 'Confirm',
|
|
33
|
+
cancelText = 'Cancel',
|
|
34
|
+
}) => {
|
|
35
|
+
const tokens = useAppDesignTokens();
|
|
36
|
+
const [password, setPassword] = useState('');
|
|
37
|
+
const [error, setError] = useState('');
|
|
38
|
+
|
|
39
|
+
const handleConfirm = () => {
|
|
40
|
+
if (!password.trim()) {
|
|
41
|
+
setError('Password is required');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
onConfirm(password);
|
|
45
|
+
setPassword('');
|
|
46
|
+
setError('');
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const handleCancel = () => {
|
|
50
|
+
setPassword('');
|
|
51
|
+
setError('');
|
|
52
|
+
onCancel();
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<BaseModal
|
|
57
|
+
visible={visible}
|
|
58
|
+
onClose={handleCancel}
|
|
59
|
+
dismissOnBackdrop={false}
|
|
60
|
+
presentationStyle="fullScreen"
|
|
61
|
+
>
|
|
62
|
+
<SafeAreaView style={[styles.safeArea, { backgroundColor: tokens.colors.background }]}>
|
|
63
|
+
<KeyboardAvoidingView
|
|
64
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
65
|
+
style={styles.keyboardView}
|
|
66
|
+
>
|
|
67
|
+
<View style={[styles.container, { padding: tokens.spacing.xl }]}>
|
|
68
|
+
<View style={styles.header}>
|
|
69
|
+
<AtomicText variant="h2" weight="bold" color="textPrimary" style={styles.title}>
|
|
70
|
+
{title}
|
|
71
|
+
</AtomicText>
|
|
72
|
+
<AtomicText variant="body" color="textSecondary" style={styles.message}>
|
|
73
|
+
{message}
|
|
74
|
+
</AtomicText>
|
|
75
|
+
</View>
|
|
76
|
+
|
|
77
|
+
<View style={styles.content}>
|
|
78
|
+
<AtomicInput
|
|
79
|
+
value={password}
|
|
80
|
+
onChangeText={(text: string) => {
|
|
81
|
+
setPassword(text);
|
|
82
|
+
setError('');
|
|
83
|
+
}}
|
|
84
|
+
placeholder="Password"
|
|
85
|
+
secureTextEntry
|
|
86
|
+
autoFocus
|
|
87
|
+
state={error ? 'error' : 'default'}
|
|
88
|
+
helperText={error}
|
|
89
|
+
style={{ marginBottom: tokens.spacing.md }}
|
|
90
|
+
/>
|
|
91
|
+
</View>
|
|
92
|
+
|
|
93
|
+
<View style={[styles.buttons, { gap: tokens.spacing.sm }]}>
|
|
94
|
+
<AtomicButton
|
|
95
|
+
title={cancelText}
|
|
96
|
+
onPress={handleCancel}
|
|
97
|
+
variant="secondary"
|
|
98
|
+
style={styles.button}
|
|
99
|
+
/>
|
|
100
|
+
<AtomicButton
|
|
101
|
+
title={confirmText}
|
|
102
|
+
onPress={handleConfirm}
|
|
103
|
+
variant="primary"
|
|
104
|
+
style={styles.button}
|
|
105
|
+
/>
|
|
106
|
+
</View>
|
|
107
|
+
</View>
|
|
108
|
+
</KeyboardAvoidingView>
|
|
109
|
+
</SafeAreaView>
|
|
110
|
+
</BaseModal>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const styles = StyleSheet.create({
|
|
115
|
+
safeArea: {
|
|
116
|
+
flex: 1,
|
|
117
|
+
},
|
|
118
|
+
keyboardView: {
|
|
119
|
+
flex: 1,
|
|
120
|
+
},
|
|
121
|
+
container: {
|
|
122
|
+
flex: 1,
|
|
123
|
+
justifyContent: 'center',
|
|
124
|
+
},
|
|
125
|
+
header: {
|
|
126
|
+
marginBottom: 32,
|
|
127
|
+
},
|
|
128
|
+
title: {
|
|
129
|
+
marginBottom: 8,
|
|
130
|
+
textAlign: 'center',
|
|
131
|
+
},
|
|
132
|
+
message: {
|
|
133
|
+
textAlign: 'center',
|
|
134
|
+
},
|
|
135
|
+
content: {
|
|
136
|
+
flex: 1,
|
|
137
|
+
justifyContent: 'center',
|
|
138
|
+
},
|
|
139
|
+
buttons: {
|
|
140
|
+
flexDirection: 'row',
|
|
141
|
+
},
|
|
142
|
+
button: {
|
|
143
|
+
flex: 1,
|
|
144
|
+
},
|
|
145
|
+
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { useState, useCallback, useMemo } from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { PasswordPromptScreen } from '../components/PasswordPromptScreen';
|
|
8
8
|
|
|
9
9
|
export interface UsePasswordPromptOptions {
|
|
10
10
|
title?: string;
|
|
@@ -46,7 +46,7 @@ export const usePasswordPrompt = (options: UsePasswordPromptOptions = {}): UsePa
|
|
|
46
46
|
}, [resolvePromise]);
|
|
47
47
|
|
|
48
48
|
const PasswordPromptComponent = useMemo(() => (
|
|
49
|
-
<
|
|
49
|
+
<PasswordPromptScreen
|
|
50
50
|
visible={isVisible}
|
|
51
51
|
onConfirm={handleConfirm}
|
|
52
52
|
onCancel={handleCancel}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Password Prompt Modal
|
|
3
|
-
* Modal for password input during account deletion reauthentication
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import { View, StyleSheet } from 'react-native';
|
|
8
|
-
import {
|
|
9
|
-
BaseModal,
|
|
10
|
-
AtomicInput,
|
|
11
|
-
AtomicButton,
|
|
12
|
-
useAppDesignTokens
|
|
13
|
-
} from '@umituz/react-native-design-system';
|
|
14
|
-
|
|
15
|
-
export interface PasswordPromptModalProps {
|
|
16
|
-
visible: boolean;
|
|
17
|
-
onConfirm: (password: string) => void;
|
|
18
|
-
onCancel: () => void;
|
|
19
|
-
title?: string;
|
|
20
|
-
message?: string;
|
|
21
|
-
confirmText?: string;
|
|
22
|
-
cancelText?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const PasswordPromptModal: React.FC<PasswordPromptModalProps> = ({
|
|
26
|
-
visible,
|
|
27
|
-
onConfirm,
|
|
28
|
-
onCancel,
|
|
29
|
-
title = 'Password Required',
|
|
30
|
-
message = 'Enter your password to continue',
|
|
31
|
-
confirmText = 'Confirm',
|
|
32
|
-
cancelText = 'Cancel',
|
|
33
|
-
}) => {
|
|
34
|
-
const tokens = useAppDesignTokens();
|
|
35
|
-
const [password, setPassword] = useState('');
|
|
36
|
-
const [error, setError] = useState('');
|
|
37
|
-
|
|
38
|
-
const handleConfirm = () => {
|
|
39
|
-
if (!password.trim()) {
|
|
40
|
-
setError('Password is required');
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
onConfirm(password);
|
|
44
|
-
setPassword('');
|
|
45
|
-
setError('');
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const handleCancel = () => {
|
|
49
|
-
setPassword('');
|
|
50
|
-
setError('');
|
|
51
|
-
onCancel();
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<BaseModal
|
|
56
|
-
visible={visible}
|
|
57
|
-
onClose={handleCancel}
|
|
58
|
-
title={title}
|
|
59
|
-
subtitle={message}
|
|
60
|
-
dismissOnBackdrop={false}
|
|
61
|
-
>
|
|
62
|
-
<View style={[styles.container, { padding: tokens.spacing.md }]}>
|
|
63
|
-
<AtomicInput
|
|
64
|
-
value={password}
|
|
65
|
-
onChangeText={(text: string) => {
|
|
66
|
-
setPassword(text);
|
|
67
|
-
setError('');
|
|
68
|
-
}}
|
|
69
|
-
placeholder="Password"
|
|
70
|
-
secureTextEntry
|
|
71
|
-
autoFocus
|
|
72
|
-
state={error ? 'error' : 'default'}
|
|
73
|
-
helperText={error}
|
|
74
|
-
style={{ marginBottom: tokens.spacing.md }}
|
|
75
|
-
/>
|
|
76
|
-
|
|
77
|
-
<View style={[styles.buttons, { gap: tokens.spacing.sm }]}>
|
|
78
|
-
<AtomicButton
|
|
79
|
-
title={cancelText}
|
|
80
|
-
onPress={handleCancel}
|
|
81
|
-
variant="secondary"
|
|
82
|
-
style={styles.button}
|
|
83
|
-
/>
|
|
84
|
-
<AtomicButton
|
|
85
|
-
title={confirmText}
|
|
86
|
-
onPress={handleConfirm}
|
|
87
|
-
variant="primary"
|
|
88
|
-
style={styles.button}
|
|
89
|
-
/>
|
|
90
|
-
</View>
|
|
91
|
-
</View>
|
|
92
|
-
</BaseModal>
|
|
93
|
-
);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
const styles = StyleSheet.create({
|
|
97
|
-
container: {
|
|
98
|
-
width: '100%',
|
|
99
|
-
},
|
|
100
|
-
buttons: {
|
|
101
|
-
flexDirection: 'row',
|
|
102
|
-
},
|
|
103
|
-
button: {
|
|
104
|
-
flex: 1,
|
|
105
|
-
},
|
|
106
|
-
});
|