@umituz/react-native-settings 4.20.57 → 4.20.59

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.
Files changed (65) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +51 -0
  2. package/.github/ISSUE_TEMPLATE/documentation.md +52 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +63 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +84 -0
  5. package/AI_AGENT_GUIDELINES.md +367 -0
  6. package/ARCHITECTURE.md +246 -0
  7. package/CHANGELOG.md +67 -0
  8. package/CODE_OF_CONDUCT.md +75 -0
  9. package/CONTRIBUTING.md +107 -0
  10. package/DOCUMENTATION_MIGRATION.md +319 -0
  11. package/DOCUMENTATION_TEMPLATE.md +155 -0
  12. package/LICENSE +21 -0
  13. package/README.md +321 -498
  14. package/SECURITY.md +98 -0
  15. package/SETTINGS_SCREEN_GUIDE.md +185 -0
  16. package/TESTING.md +358 -0
  17. package/package.json +13 -2
  18. package/src/__tests__/setup.ts +1 -4
  19. package/src/application/README.md +85 -271
  20. package/src/domains/about/README.md +85 -440
  21. package/src/domains/about/presentation/hooks/README.md +93 -348
  22. package/src/domains/appearance/README.md +95 -584
  23. package/src/domains/appearance/hooks/README.md +95 -303
  24. package/src/domains/appearance/infrastructure/services/README.md +83 -397
  25. package/src/domains/appearance/presentation/components/README.md +99 -0
  26. package/src/domains/cloud-sync/README.md +73 -439
  27. package/src/domains/cloud-sync/presentation/components/README.md +95 -493
  28. package/src/domains/dev/README.md +71 -457
  29. package/src/domains/disclaimer/README.md +77 -411
  30. package/src/domains/disclaimer/presentation/components/README.md +95 -392
  31. package/src/domains/faqs/README.md +86 -574
  32. package/src/domains/feedback/README.md +79 -553
  33. package/src/domains/feedback/presentation/hooks/README.md +93 -426
  34. package/src/domains/legal/README.md +88 -537
  35. package/src/domains/rating/README.md +73 -440
  36. package/src/domains/rating/presentation/components/README.md +95 -475
  37. package/src/domains/video-tutorials/README.md +77 -470
  38. package/src/domains/video-tutorials/presentation/components/README.md +95 -431
  39. package/src/infrastructure/README.md +78 -425
  40. package/src/infrastructure/repositories/README.md +88 -420
  41. package/src/infrastructure/services/README.md +74 -460
  42. package/src/presentation/components/README.md +97 -480
  43. package/src/presentation/components/SettingsErrorBoundary/README.md +48 -442
  44. package/src/presentation/components/SettingsFooter/README.md +48 -427
  45. package/src/presentation/components/SettingsItemCard/README.md +153 -392
  46. package/src/presentation/components/SettingsItemCard/STRATEGY.md +164 -0
  47. package/src/presentation/components/SettingsSection/README.md +47 -401
  48. package/src/presentation/hooks/README.md +95 -389
  49. package/src/presentation/hooks/mutations/README.md +99 -376
  50. package/src/presentation/hooks/queries/README.md +111 -353
  51. package/src/presentation/navigation/README.md +70 -502
  52. package/src/presentation/navigation/components/README.md +70 -295
  53. package/src/presentation/navigation/hooks/README.md +75 -367
  54. package/src/presentation/navigation/utils/README.md +100 -380
  55. package/src/presentation/screens/README.md +53 -504
  56. package/src/presentation/screens/components/SettingsContent/README.md +53 -382
  57. package/src/presentation/screens/components/SettingsHeader/README.md +48 -303
  58. package/src/presentation/screens/components/sections/CustomSettingsList/README.md +47 -359
  59. package/src/presentation/screens/components/sections/FeatureSettingsSection/README.md +81 -176
  60. package/src/presentation/screens/components/sections/IdentitySettingsSection/README.md +40 -297
  61. package/src/presentation/screens/components/sections/ProfileSectionLoader/README.md +47 -451
  62. package/src/presentation/screens/components/sections/SupportSettingsSection/README.md +45 -361
  63. package/src/presentation/screens/hooks/README.md +64 -354
  64. package/src/presentation/screens/types/README.md +79 -409
  65. package/src/presentation/screens/utils/README.md +65 -255
@@ -1,288 +1,98 @@
1
1
  # Settings Screen Utilities
2
2
 
3
- Utility functions for normalizing and managing settings screen configuration.
3
+ ## Purpose
4
4
 
5
- ## Functions
5
+ Utility functions for normalizing settings configuration, detecting features, and managing screen state.
6
6
 
7
- ### normalizeSettingsConfig
8
-
9
- Normalizes the settings configuration object to a consistent format.
10
-
11
- ```typescript
12
- import { normalizeSettingsConfig } from '@umituz/react-native-settings';
13
-
14
- const config = {
15
- appearance: true,
16
- notifications: 'auto',
17
- about: false,
18
- };
19
-
20
- const normalized = normalizeSettingsConfig(config);
21
- // Returns: NormalizedConfig with enabled flags and config objects
22
- ```
23
-
24
- #### Parameters
25
-
26
- | Parameter | Type | Description |
27
- |-----------|------|-------------|
28
- | `config` | `SettingsConfig \| undefined` | Raw configuration object |
29
-
30
- #### Returns
31
-
32
- `NormalizedConfig` - Normalized configuration with consistent structure
33
-
34
- #### Examples
35
-
36
- **Basic Config:**
37
-
38
- ```typescript
39
- const config = {
40
- appearance: true,
41
- language: true,
42
- };
43
-
44
- const normalized = normalizeSettingsConfig(config);
45
- // {
46
- // appearance: { enabled: true },
47
- // language: { enabled: true },
48
- // notifications: { enabled: false },
49
- // // ... others default to { enabled: false }
50
- // }
51
- ```
52
-
53
- **Auto Detection:**
7
+ ## File Paths
54
8
 
55
- ```typescript
56
- const config = {
57
- appearance: 'auto', // Enable if screen exists
58
- language: 'auto',
59
- };
60
-
61
- const normalized = normalizeSettingsConfig(config);
62
- // Will check navigation for screen availability
63
- ```
9
+ - **Config Normalization**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/utils/normalizeConfig.ts`
64
10
 
65
- **Advanced Config:**
11
+ ## Strategy
66
12
 
67
- ```typescript
68
- const config = {
69
- appearance: {
70
- enabled: true,
71
- route: 'CustomAppearance',
72
- showThemeSection: true,
73
- },
74
- };
13
+ 1. **Config Normalization**: Converts various config formats to consistent structure
14
+ 2. **Feature Visibility**: Handles boolean, 'auto', and object config types
15
+ 3. **Default Values**: Provides sensible defaults for all features
16
+ 4. **Type Safety**: Ensures type safety through TypeScript
17
+ 5. **Flexibility**: Supports simple and advanced configuration patterns
75
18
 
76
- const normalized = normalizeSettingsConfig(config);
77
- // {
78
- // appearance: { enabled: true, config: { route: '...', showThemeSection: true } }
79
- // }
80
- ```
19
+ ## Restrictions (Forbidden)
81
20
 
82
- ### normalizeConfigValue
21
+ ### DO NOT
22
+ - ❌ DO NOT use raw config values without normalizing
23
+ - ❌ DO NOT modify normalized config objects after creation
24
+ - ❌ DO NOT assume config structure (always normalize first)
83
25
 
84
- Normalizes a single config value to enabled/config format.
26
+ ### NEVER
27
+ - ❌ NEVER rely on implicit undefined behavior in config
28
+ - ❌ NEVER bypass normalization for "simple" configs
29
+ - ❌ NEVER use hardcoded default values in components
85
30
 
86
- ```typescript
87
- import { normalizeConfigValue } from '@umituz/react-native-settings';
31
+ ### AVOID
32
+ - AVOID creating multiple normalization functions for same purpose
33
+ - ❌ AVOID mixing normalized and non-normalized config
34
+ - ❌ AVOID changing normalization logic frequently
88
35
 
89
- // Boolean
90
- normalizeConfigValue(true, false)
91
- // { enabled: true }
36
+ ## Rules (Mandatory)
92
37
 
93
- // Auto
94
- normalizeConfigValue('auto', false)
95
- // { enabled: false } (will be determined dynamically)
38
+ ### ALWAYS
39
+ - ✅ ALWAYS normalize config before passing to components
40
+ - ALWAYS use normalized config for feature detection
41
+ - ✅ MUST treat normalized config as immutable
42
+ - ✅ MUST provide defaults for all features
96
43
 
97
- // Object
98
- normalizeConfigValue({ enabled: true, route: 'Custom' }, false)
99
- // { enabled: true, config: { enabled: true, route: 'Custom' } }
44
+ ### MUST
45
+ - MUST handle boolean, 'auto', and object config types
46
+ - MUST preserve advanced config options in normalization
47
+ - ✅ MUST use TypeScript types for type safety
100
48
 
101
- // Undefined
102
- normalizeConfigValue(undefined, true)
103
- // { enabled: true }
104
- ```
49
+ ### SHOULD
50
+ - ✅ SHOULD normalize once and pass to multiple consumers
51
+ - SHOULD use 'auto' for conditionally shown features
52
+ - ✅ SHOULD keep normalization logic centralized
105
53
 
106
- #### Type Parameters
54
+ ## AI Agent Guidelines
107
55
 
108
- | Parameter | Type | Description |
109
- |-----------|------|-------------|
110
- | `T` | Config object type | Type of config object |
111
- | `value` | `FeatureVisibility \| T \| undefined` | Config value to normalize |
112
- | `defaultValue` | `FeatureVisibility` | Default enabled state |
56
+ 1. **File Reference**: When modifying normalization logic, refer to `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/presentation/screens/utils/normalizeConfig.ts`
57
+ 2. **Config Types**: Understand three input types: boolean (true/false), 'auto' (detect), or object (advanced config)
58
+ 3. **Default Strategy**: Most features default to 'auto', some to false (userProfile, subscription, etc.)
59
+ 4. **Immutable Pattern**: Never mutate normalized config, create new objects if needed
60
+ 5. **Type Safety**: Leverage TypeScript for compile-time checking
113
61
 
114
- ## NormalizedConfig Structure
62
+ ## Utility Reference
115
63
 
116
- ```typescript
117
- interface NormalizedConfig {
118
- appearance: {
119
- enabled: boolean;
120
- config?: AppearanceConfig;
121
- };
122
- language: {
123
- enabled: boolean;
124
- config?: LanguageConfig;
125
- };
126
- notifications: {
127
- enabled: boolean;
128
- config?: NotificationsConfig;
129
- };
130
- about: {
131
- enabled: boolean;
132
- config?: AboutConfig;
133
- };
134
- legal: {
135
- enabled: boolean;
136
- config?: LegalConfig;
137
- };
138
- disclaimer: {
139
- enabled: boolean;
140
- config?: DisclaimerConfig;
141
- };
142
- userProfile: {
143
- enabled: boolean;
144
- config?: UserProfileConfig;
145
- };
146
- feedback: {
147
- enabled: boolean;
148
- config?: FeedbackConfig;
149
- };
150
- rating: {
151
- enabled: boolean;
152
- config?: RatingConfig;
153
- };
154
- faqs: {
155
- enabled: boolean;
156
- config?: FAQConfig;
157
- };
158
- subscription: {
159
- enabled: boolean;
160
- config?: SubscriptionConfig;
161
- };
162
- wallet: {
163
- enabled: boolean;
164
- config?: WalletConfig;
165
- };
166
- }
167
- ```
168
-
169
- ## FeatureVisibility
170
-
171
- Type alias for feature enablement:
172
-
173
- ```typescript
174
- type FeatureVisibility = boolean | 'auto';
175
- ```
176
-
177
- - `true`: Feature is enabled
178
- - `false`: Feature is disabled
179
- - `'auto'`: Feature is automatically detected (checks navigation)
180
-
181
- ## Default Values
182
-
183
- Default values for each feature:
184
-
185
- | Feature | Default | Description |
186
- |---------|---------|-------------|
187
- | `appearance` | `'auto'` | Auto-detect |
188
- | `language` | `'auto'` | Auto-detect |
189
- | `notifications` | `'auto'` | Auto-detect |
190
- | `about` | `'auto'` | Auto-detect |
191
- | `legal` | `'auto'` | Auto-detect |
192
- | `disclaimer` | `false` | Disabled |
193
- | `userProfile` | `false` | Disabled |
194
- | `feedback` | `false` | Disabled |
195
- | `rating` | `false` | Disabled |
196
- | `faqs` | `false` | Disabled |
197
- | `subscription` | `false` | Disabled |
198
- | `wallet` | `false` | Disabled |
199
-
200
- ## Usage Examples
201
-
202
- ### Complete Normalization
203
-
204
- ```typescript
205
- import { normalizeSettingsConfig } from '@umituz/react-native-settings';
206
-
207
- function SettingsScreenWrapper() {
208
- const rawConfig = {
209
- appearance: true,
210
- language: {
211
- enabled: true,
212
- route: 'LanguageSelection',
213
- showFlags: true,
214
- },
215
- notifications: 'auto',
216
- };
64
+ ### normalizeSettingsConfig
217
65
 
218
- const normalized = normalizeSettingsConfig(rawConfig);
66
+ **Purpose**: Converts raw config to normalized format
219
67
 
220
- return (
221
- <SettingsContent
222
- normalizedConfig={normalized}
223
- features={normalized}
224
- />
225
- );
226
- }
227
- ```
68
+ **Parameters**:
69
+ - `config`: Raw SettingsConfig (boolean | 'auto' | object values)
228
70
 
229
- ### Feature Detection Integration
71
+ **Returns**: NormalizedConfig with enabled flags and config objects
230
72
 
73
+ **Output Structure**:
231
74
  ```typescript
232
- import { normalizeSettingsConfig, useFeatureDetection } from '@umituz/react-native-settings';
233
-
234
- function SettingsScreenWithDetection() {
235
- const navigation = useNavigation();
236
- const config = {
237
- appearance: 'auto',
238
- language: 'auto',
239
- notifications: 'auto',
240
- };
241
-
242
- const normalized = normalizeSettingsConfig(config);
243
- const features = useFeatureDetection(normalized, navigation, {
244
- notificationServiceAvailable: true,
245
- });
246
-
247
- return (
248
- <SettingsContent
249
- normalizedConfig={normalized}
250
- features={features}
251
- />
252
- );
75
+ {
76
+ appearance: { enabled: boolean, config?: AppearanceConfig },
77
+ language: { enabled: boolean, config?: LanguageConfig },
78
+ // ... other features
253
79
  }
254
80
  ```
255
81
 
256
- ## Auto Detection
257
-
258
- When using `'auto'`, features are detected based on:
259
-
260
- 1. **Navigation State**: Checks if screen exists in navigation stack
261
- 2. **Config Override**: Respects `enabled: true/false` in config object
262
- 3. **Service Availability**: Checks if required services are available
263
-
264
- ```typescript
265
- // Auto detection flow
266
- appearance.config?.enabled === true // Explicitly enabled
267
- || (appearance.config?.enabled !== false // Not explicitly disabled
268
- && hasNavigationScreen(navigation, 'Appearance')) // Screen exists
269
- ```
82
+ ### normalizeConfigValue
270
83
 
271
- ## Best Practices
84
+ **Purpose**: Normalizes a single config value
272
85
 
273
- 1. **Always Normalize**: Normalize config before passing to components
274
- 2. **Use Auto**: Use `'auto'` for features that should be conditionally shown
275
- 3. **Explicit Control**: Use boolean for features that must be shown/hidden
276
- 4. **Advanced Config**: Use config objects for detailed customization
277
- 5. **Feature Detection**: Always use with `useFeatureDetection` hook
278
- 6. **Type Safety**: Leverage TypeScript for config type checking
86
+ **Parameters**:
87
+ - `value`: FeatureVisibility | ConfigObject | undefined
88
+ - `defaultValue`: Default enabled state
279
89
 
280
- ## Related
90
+ **Returns**: { enabled: boolean, config?: ConfigObject }
281
91
 
282
- - **useFeatureDetection**: Hook for detecting features
283
- - **SettingsConfig**: Configuration types
284
- - **SettingsContent**: Content component
92
+ **Usage**: Use for normalizing individual feature configs
285
93
 
286
- ## License
94
+ ## Related Components
287
95
 
288
- MIT
96
+ - **useFeatureDetection**: Hook that uses normalized config
97
+ - **SettingsScreen**: Screen that uses normalized config
98
+ - **SettingsContent**: Content component that requires normalized config