@umituz/react-native-settings 4.23.114 → 4.23.116
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": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.116",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -162,7 +162,8 @@ export const useSettingsScreenConfig = (
|
|
|
162
162
|
onSignIn: handleSignIn,
|
|
163
163
|
onLogout: handleSignOut,
|
|
164
164
|
onDeleteAccount: handleDeleteAccount,
|
|
165
|
-
|
|
165
|
+
translations: translations?.account,
|
|
166
|
+
}), [user, userProfileData, handleSignIn, handleSignOut, handleDeleteAccount, translations]);
|
|
166
167
|
|
|
167
168
|
// Use centralized FAQ translation
|
|
168
169
|
const translatedFaqData = useMemo(() =>
|
|
@@ -18,6 +18,18 @@ export interface SettingsTranslations {
|
|
|
18
18
|
items?: string[];
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
+
account?: {
|
|
22
|
+
editProfile?: string;
|
|
23
|
+
logout?: string;
|
|
24
|
+
deleteAccount?: string;
|
|
25
|
+
logoutConfirmTitle?: string;
|
|
26
|
+
logoutConfirmMessage?: string;
|
|
27
|
+
deleteConfirmTitle?: string;
|
|
28
|
+
deleteConfirmMessage?: string;
|
|
29
|
+
deleteErrorTitle?: string;
|
|
30
|
+
deleteErrorMessage?: string;
|
|
31
|
+
cancel?: string;
|
|
32
|
+
};
|
|
21
33
|
sections?: {
|
|
22
34
|
app?: string;
|
|
23
35
|
progress?: string;
|
|
@@ -6,6 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
import type { AccountScreenConfig } from "@umituz/react-native-auth";
|
|
8
8
|
|
|
9
|
+
export interface AccountTranslations {
|
|
10
|
+
editProfile?: string;
|
|
11
|
+
logout: string;
|
|
12
|
+
deleteAccount: string;
|
|
13
|
+
logoutConfirmTitle: string;
|
|
14
|
+
logoutConfirmMessage: string;
|
|
15
|
+
deleteConfirmTitle: string;
|
|
16
|
+
deleteConfirmMessage: string;
|
|
17
|
+
deleteErrorTitle?: string;
|
|
18
|
+
deleteErrorMessage?: string;
|
|
19
|
+
cancel: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
9
22
|
export interface CreateAccountConfigParams {
|
|
10
23
|
displayName?: string;
|
|
11
24
|
userId?: string;
|
|
@@ -15,6 +28,7 @@ export interface CreateAccountConfigParams {
|
|
|
15
28
|
onSignIn: () => void;
|
|
16
29
|
onLogout: () => Promise<void>;
|
|
17
30
|
onDeleteAccount: () => Promise<void>;
|
|
31
|
+
translations?: AccountTranslations;
|
|
18
32
|
}
|
|
19
33
|
|
|
20
34
|
/**
|
|
@@ -30,10 +44,26 @@ export function createAccountConfig(params: CreateAccountConfigParams): AccountS
|
|
|
30
44
|
onSignIn,
|
|
31
45
|
onLogout,
|
|
32
46
|
onDeleteAccount,
|
|
47
|
+
translations,
|
|
33
48
|
} = params;
|
|
34
49
|
|
|
35
50
|
const anonymous = isAnonymous ?? true;
|
|
36
51
|
|
|
52
|
+
// Helper to check if translation value is valid (not empty or undefined)
|
|
53
|
+
const hasValidTranslation = (value: string | undefined): boolean => {
|
|
54
|
+
return Boolean(value && value.trim().length > 0);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Only create accountActions if all required translations are present and non-empty
|
|
58
|
+
const hasValidAccountTranslations = translations &&
|
|
59
|
+
hasValidTranslation(translations.logout) &&
|
|
60
|
+
hasValidTranslation(translations.deleteAccount) &&
|
|
61
|
+
hasValidTranslation(translations.logoutConfirmTitle) &&
|
|
62
|
+
hasValidTranslation(translations.logoutConfirmMessage) &&
|
|
63
|
+
hasValidTranslation(translations.deleteConfirmTitle) &&
|
|
64
|
+
hasValidTranslation(translations.deleteConfirmMessage) &&
|
|
65
|
+
hasValidTranslation(translations.cancel);
|
|
66
|
+
|
|
37
67
|
return {
|
|
38
68
|
profile: {
|
|
39
69
|
displayName: displayName || "",
|
|
@@ -42,18 +72,20 @@ export function createAccountConfig(params: CreateAccountConfigParams): AccountS
|
|
|
42
72
|
avatarUrl: avatarUrl ?? photoURL ?? undefined,
|
|
43
73
|
},
|
|
44
74
|
isAnonymous: anonymous,
|
|
45
|
-
editProfileText: "",
|
|
75
|
+
editProfileText: translations?.editProfile || "",
|
|
46
76
|
onSignIn,
|
|
47
|
-
accountActions: {
|
|
77
|
+
accountActions: hasValidAccountTranslations ? {
|
|
48
78
|
onLogout,
|
|
49
79
|
onDeleteAccount,
|
|
50
|
-
logoutText:
|
|
51
|
-
logoutConfirmTitle:
|
|
52
|
-
logoutConfirmMessage:
|
|
53
|
-
cancelText:
|
|
54
|
-
deleteAccountText:
|
|
55
|
-
deleteConfirmTitle:
|
|
56
|
-
deleteConfirmMessage:
|
|
57
|
-
|
|
80
|
+
logoutText: translations.logout,
|
|
81
|
+
logoutConfirmTitle: translations.logoutConfirmTitle,
|
|
82
|
+
logoutConfirmMessage: translations.logoutConfirmMessage,
|
|
83
|
+
cancelText: translations.cancel,
|
|
84
|
+
deleteAccountText: translations.deleteAccount,
|
|
85
|
+
deleteConfirmTitle: translations.deleteConfirmTitle,
|
|
86
|
+
deleteConfirmMessage: translations.deleteConfirmMessage,
|
|
87
|
+
deleteErrorTitle: translations.deleteErrorTitle,
|
|
88
|
+
deleteErrorMessage: translations.deleteErrorMessage,
|
|
89
|
+
} : undefined,
|
|
58
90
|
};
|
|
59
91
|
}
|