@umituz/react-native-settings 5.3.9 → 5.3.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/package.json +1 -1
- package/src/index.ts +0 -8
- package/src/presentation/navigation/hooks/useSettingsScreens.ts +6 -3
- package/src/presentation/navigation/types.ts +29 -4
- package/src/presentation/screens/components/sections/ProfileSectionLoader.tsx +6 -2
- package/src/presentation/utils/accountConfigUtils.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.10",
|
|
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",
|
package/src/index.ts
CHANGED
|
@@ -37,14 +37,6 @@ export {
|
|
|
37
37
|
useResetSettingsMutation
|
|
38
38
|
} from './presentation/hooks/mutations/useSettingsMutations';
|
|
39
39
|
|
|
40
|
-
export { useSettingsScreenConfig } from './presentation/hooks/useSettingsScreenConfig';
|
|
41
|
-
export type {
|
|
42
|
-
UseSettingsScreenConfigParams,
|
|
43
|
-
SettingsScreenConfigResult,
|
|
44
|
-
SettingsFeatures,
|
|
45
|
-
} from './presentation/hooks/useSettingsScreenConfig';
|
|
46
|
-
|
|
47
|
-
|
|
48
40
|
// =============================================================================
|
|
49
41
|
// PRESENTATION LAYER - Screens
|
|
50
42
|
// =============================================================================
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import type { StackScreen } from "@umituz/react-native-design-system/molecules";
|
|
3
3
|
import { LanguageSelectionScreen } from "../../../domains/localization";
|
|
4
4
|
import { NotificationSettingsScreen } from "../../../domains/notifications";
|
|
5
|
-
|
|
5
|
+
// AccountScreen is an optional peer — lazy require so the package works without @umituz/react-native-auth
|
|
6
|
+
const AccountScreen: React.ComponentType<any> | null = (() => {
|
|
7
|
+
try { return require("@umituz/react-native-auth").AccountScreen ?? null; } catch { return null; }
|
|
8
|
+
})();
|
|
6
9
|
import { SettingsScreen } from "../../screens/SettingsScreen";
|
|
7
10
|
import { AppearanceScreen } from "../../screens/AppearanceScreen";
|
|
8
11
|
import { FAQScreen } from "../../../domains/faqs";
|
|
@@ -119,7 +122,7 @@ export const useSettingsScreens = (props: UseSettingsScreensProps): StackScreen[
|
|
|
119
122
|
});
|
|
120
123
|
|
|
121
124
|
const accountScreen = createConditionalScreen(
|
|
122
|
-
!!accountConfig,
|
|
125
|
+
!!accountConfig && !!AccountScreen,
|
|
123
126
|
() => createScreenWithProps("Account", AccountScreen as any, { config: accountConfig })
|
|
124
127
|
);
|
|
125
128
|
|
|
@@ -88,11 +88,36 @@ export interface FAQData {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* Account configuration — auth is an optional peer dependency.
|
|
92
|
+
* Defined locally so the main package does not require @umituz/react-native-auth.
|
|
92
93
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
export interface AccountConfig {
|
|
95
|
+
profile?: {
|
|
96
|
+
displayName?: string;
|
|
97
|
+
userId?: string;
|
|
98
|
+
isAnonymous?: boolean;
|
|
99
|
+
avatarUrl?: string;
|
|
100
|
+
accountSettingsRoute?: string;
|
|
101
|
+
benefits?: string[];
|
|
102
|
+
};
|
|
103
|
+
isAnonymous?: boolean;
|
|
104
|
+
editProfileText?: string;
|
|
105
|
+
onSignIn?: () => void;
|
|
106
|
+
PasswordPromptComponent?: React.ReactNode;
|
|
107
|
+
accountActions?: {
|
|
108
|
+
onLogout?: () => Promise<void>;
|
|
109
|
+
onDeleteAccount?: () => Promise<void>;
|
|
110
|
+
logoutText?: string;
|
|
111
|
+
logoutConfirmTitle?: string;
|
|
112
|
+
logoutConfirmMessage?: string;
|
|
113
|
+
cancelText?: string;
|
|
114
|
+
deleteAccountText?: string;
|
|
115
|
+
deleteConfirmTitle?: string;
|
|
116
|
+
deleteConfirmMessage?: string;
|
|
117
|
+
deleteErrorTitle?: string;
|
|
118
|
+
deleteErrorMessage?: string;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
96
121
|
|
|
97
122
|
/**
|
|
98
123
|
* Settings Stack Navigator Props
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { View, StyleSheet } from "react-native";
|
|
3
|
-
import { ProfileSection } from "@umituz/react-native-auth";
|
|
4
3
|
import { useAppNavigation } from "@umituz/react-native-design-system/molecules";
|
|
5
4
|
|
|
5
|
+
// ProfileSection is an optional peer — lazy require so the package works without @umituz/react-native-auth
|
|
6
|
+
const ProfileSection: React.ComponentType<any> | null = (() => {
|
|
7
|
+
try { return require("@umituz/react-native-auth").ProfileSection ?? null; } catch { return null; }
|
|
8
|
+
})();
|
|
9
|
+
|
|
6
10
|
export interface ProfileSectionLoaderProps {
|
|
7
11
|
userProfile?: {
|
|
8
12
|
displayName?: string;
|
|
@@ -36,7 +40,7 @@ export const ProfileSectionLoader: React.FC<ProfileSectionLoaderProps> = React.m
|
|
|
36
40
|
return translations?.anonymousName || "";
|
|
37
41
|
}, [translations]);
|
|
38
42
|
|
|
39
|
-
if (!userProfile) return null;
|
|
43
|
+
if (!userProfile || !ProfileSection) return null;
|
|
40
44
|
|
|
41
45
|
return (
|
|
42
46
|
<View style={styles.profileContainer}>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Helper functions for creating account screen configurations.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type {
|
|
7
|
+
import type { AccountConfig } from "../navigation/types";
|
|
8
8
|
|
|
9
9
|
export interface AccountTranslations {
|
|
10
10
|
editProfile?: string;
|
|
@@ -35,7 +35,7 @@ export interface CreateAccountConfigParams {
|
|
|
35
35
|
/**
|
|
36
36
|
* Create account screen configuration
|
|
37
37
|
*/
|
|
38
|
-
export function createAccountConfig(params: CreateAccountConfigParams):
|
|
38
|
+
export function createAccountConfig(params: CreateAccountConfigParams): AccountConfig {
|
|
39
39
|
const {
|
|
40
40
|
displayName,
|
|
41
41
|
userId,
|