@umituz/react-native-settings 2.0.0 → 2.4.0
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/README.md +129 -3
- package/lib/__tests__/setup.d.ts +5 -0
- package/lib/__tests__/setup.d.ts.map +1 -0
- package/lib/__tests__/setup.js +143 -0
- package/lib/__tests__/setup.js.map +1 -0
- package/lib/domain/repositories/ISettingsRepository.d.ts +51 -0
- package/lib/domain/repositories/ISettingsRepository.d.ts.map +1 -0
- package/lib/domain/repositories/ISettingsRepository.js +8 -0
- package/lib/domain/repositories/ISettingsRepository.js.map +1 -0
- package/lib/index.d.ts +35 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +32 -0
- package/lib/index.js.map +1 -0
- package/lib/infrastructure/storage/SettingsStore.d.ts +36 -0
- package/lib/infrastructure/storage/SettingsStore.d.ts.map +1 -0
- package/lib/infrastructure/storage/SettingsStore.js +144 -0
- package/lib/infrastructure/storage/SettingsStore.js.map +1 -0
- package/lib/presentation/components/CloudSyncSetting.d.ts +16 -0
- package/lib/presentation/components/CloudSyncSetting.d.ts.map +1 -0
- package/lib/presentation/components/CloudSyncSetting.js +30 -0
- package/lib/presentation/components/CloudSyncSetting.js.map +1 -0
- package/lib/presentation/components/DisclaimerCard.d.ts +15 -0
- package/lib/presentation/components/DisclaimerCard.d.ts.map +1 -0
- package/lib/presentation/components/DisclaimerCard.js +73 -0
- package/lib/presentation/components/DisclaimerCard.js.map +1 -0
- package/lib/presentation/components/DisclaimerModal.d.ts +13 -0
- package/lib/presentation/components/DisclaimerModal.d.ts.map +1 -0
- package/lib/presentation/components/DisclaimerModal.js +62 -0
- package/lib/presentation/components/DisclaimerModal.js.map +1 -0
- package/lib/presentation/components/DisclaimerSetting.d.ts +39 -0
- package/lib/presentation/components/DisclaimerSetting.d.ts.map +1 -0
- package/lib/presentation/components/DisclaimerSetting.js +59 -0
- package/lib/presentation/components/DisclaimerSetting.js.map +1 -0
- package/lib/presentation/components/SettingItem.d.ts +45 -0
- package/lib/presentation/components/SettingItem.d.ts.map +1 -0
- package/lib/presentation/components/SettingItem.js +113 -0
- package/lib/presentation/components/SettingItem.js.map +1 -0
- package/lib/presentation/components/SettingsErrorBoundary.d.ts +23 -0
- package/lib/presentation/components/SettingsErrorBoundary.d.ts.map +1 -0
- package/lib/presentation/components/SettingsErrorBoundary.js +73 -0
- package/lib/presentation/components/SettingsErrorBoundary.js.map +1 -0
- package/lib/presentation/components/SettingsFooter.d.ts +11 -0
- package/lib/presentation/components/SettingsFooter.d.ts.map +1 -0
- package/lib/presentation/components/SettingsFooter.js +31 -0
- package/lib/presentation/components/SettingsFooter.js.map +1 -0
- package/lib/presentation/components/SettingsSection.d.ts +13 -0
- package/lib/presentation/components/SettingsSection.d.ts.map +1 -0
- package/lib/presentation/components/SettingsSection.js +37 -0
- package/lib/presentation/components/SettingsSection.js.map +1 -0
- package/lib/presentation/components/StorageClearSetting.d.ts +16 -0
- package/lib/presentation/components/StorageClearSetting.d.ts.map +1 -0
- package/lib/presentation/components/StorageClearSetting.js +21 -0
- package/lib/presentation/components/StorageClearSetting.js.map +1 -0
- package/lib/presentation/components/UserProfileHeader.d.ts +30 -0
- package/lib/presentation/components/UserProfileHeader.d.ts.map +1 -0
- package/lib/presentation/components/UserProfileHeader.js +119 -0
- package/lib/presentation/components/UserProfileHeader.js.map +1 -0
- package/lib/presentation/screens/AppearanceScreen.d.ts +8 -0
- package/lib/presentation/screens/AppearanceScreen.d.ts.map +1 -0
- package/lib/presentation/screens/AppearanceScreen.js +8 -0
- package/lib/presentation/screens/AppearanceScreen.js.map +1 -0
- package/lib/presentation/screens/SettingsScreen.d.ts +38 -0
- package/lib/presentation/screens/SettingsScreen.d.ts.map +1 -0
- package/lib/presentation/screens/SettingsScreen.js +37 -0
- package/lib/presentation/screens/SettingsScreen.js.map +1 -0
- package/lib/presentation/screens/components/AboutLegalSection.d.ts +15 -0
- package/lib/presentation/screens/components/AboutLegalSection.d.ts.map +1 -0
- package/lib/presentation/screens/components/AboutLegalSection.js +28 -0
- package/lib/presentation/screens/components/AboutLegalSection.js.map +1 -0
- package/lib/presentation/screens/components/AppearanceSection.d.ts +12 -0
- package/lib/presentation/screens/components/AppearanceSection.d.ts.map +1 -0
- package/lib/presentation/screens/components/AppearanceSection.js +21 -0
- package/lib/presentation/screens/components/AppearanceSection.js.map +1 -0
- package/lib/presentation/screens/components/LanguageSection.d.ts +12 -0
- package/lib/presentation/screens/components/LanguageSection.d.ts.map +1 -0
- package/lib/presentation/screens/components/LanguageSection.js +26 -0
- package/lib/presentation/screens/components/LanguageSection.js.map +1 -0
- package/lib/presentation/screens/components/NotificationsSection.d.ts +12 -0
- package/lib/presentation/screens/components/NotificationsSection.d.ts.map +1 -0
- package/lib/presentation/screens/components/NotificationsSection.js +58 -0
- package/lib/presentation/screens/components/NotificationsSection.js.map +1 -0
- package/lib/presentation/screens/components/SettingsContent.d.ts +36 -0
- package/lib/presentation/screens/components/SettingsContent.d.ts.map +1 -0
- package/lib/presentation/screens/components/SettingsContent.js +81 -0
- package/lib/presentation/screens/components/SettingsContent.js.map +1 -0
- package/lib/presentation/screens/components/SettingsHeader.d.ts +12 -0
- package/lib/presentation/screens/components/SettingsHeader.d.ts.map +1 -0
- package/lib/presentation/screens/components/SettingsHeader.js +59 -0
- package/lib/presentation/screens/components/SettingsHeader.js.map +1 -0
- package/lib/presentation/screens/components/index.d.ts +9 -0
- package/lib/presentation/screens/components/index.d.ts.map +1 -0
- package/lib/presentation/screens/components/index.js +9 -0
- package/lib/presentation/screens/components/index.js.map +1 -0
- package/lib/presentation/screens/hooks/useFeatureDetection.d.ts +21 -0
- package/lib/presentation/screens/hooks/useFeatureDetection.d.ts.map +1 -0
- package/lib/presentation/screens/hooks/useFeatureDetection.js +82 -0
- package/lib/presentation/screens/hooks/useFeatureDetection.js.map +1 -0
- package/lib/presentation/screens/types/CustomSection.d.ts +19 -0
- package/lib/presentation/screens/types/CustomSection.d.ts.map +1 -0
- package/lib/presentation/screens/types/CustomSection.js +6 -0
- package/lib/presentation/screens/types/CustomSection.js.map +1 -0
- package/lib/presentation/screens/types/ExtendedConfig.d.ts +68 -0
- package/lib/presentation/screens/types/ExtendedConfig.d.ts.map +1 -0
- package/lib/presentation/screens/types/ExtendedConfig.js +6 -0
- package/lib/presentation/screens/types/ExtendedConfig.js.map +1 -0
- package/lib/presentation/screens/types/FeatureConfig.d.ts +95 -0
- package/lib/presentation/screens/types/FeatureConfig.d.ts.map +1 -0
- package/lib/presentation/screens/types/FeatureConfig.js +6 -0
- package/lib/presentation/screens/types/FeatureConfig.js.map +1 -0
- package/lib/presentation/screens/types/SettingsConfig.d.ts +97 -0
- package/lib/presentation/screens/types/SettingsConfig.d.ts.map +1 -0
- package/lib/presentation/screens/types/SettingsConfig.js +6 -0
- package/lib/presentation/screens/types/SettingsConfig.js.map +1 -0
- package/lib/presentation/screens/types/index.d.ts +10 -0
- package/lib/presentation/screens/types/index.d.ts.map +1 -0
- package/lib/presentation/screens/types/index.js +6 -0
- package/lib/presentation/screens/types/index.js.map +1 -0
- package/lib/presentation/screens/utils/normalizeConfig.d.ts +44 -0
- package/lib/presentation/screens/utils/normalizeConfig.d.ts.map +1 -0
- package/lib/presentation/screens/utils/normalizeConfig.js +38 -0
- package/lib/presentation/screens/utils/normalizeConfig.js.map +1 -0
- package/package.json +46 -11
- package/src/__tests__/integration.test.tsx +371 -0
- package/src/__tests__/performance.test.tsx +369 -0
- package/src/__tests__/setup.test.tsx +20 -0
- package/src/__tests__/setup.ts +157 -0
- package/src/index.ts +9 -0
- package/src/infrastructure/storage/SettingsStore.ts +90 -45
- package/src/infrastructure/storage/__tests__/SettingsStore.test.tsx +302 -0
- package/src/presentation/components/CloudSyncSetting.tsx +11 -17
- package/src/presentation/components/DisclaimerCard.tsx +115 -0
- package/src/presentation/components/DisclaimerModal.tsx +104 -0
- package/src/presentation/components/DisclaimerSetting.tsx +77 -159
- package/src/presentation/components/SettingItem.tsx +11 -2
- package/src/presentation/components/SettingsErrorBoundary.tsx +126 -0
- package/src/presentation/components/StorageClearSetting.tsx +13 -8
- package/src/presentation/components/UserProfileHeader.tsx +48 -11
- package/src/presentation/components/__tests__/CloudSyncSetting.test.tsx +78 -0
- package/src/presentation/components/__tests__/DisclaimerCard.test.tsx +208 -0
- package/src/presentation/components/__tests__/DisclaimerModal.test.tsx +236 -0
- package/src/presentation/components/__tests__/DisclaimerSetting.test.tsx +74 -0
- package/src/presentation/components/__tests__/SettingItem.test.tsx +189 -0
- package/src/presentation/components/__tests__/SettingsErrorBoundary.test.tsx +186 -0
- package/src/presentation/screens/SettingsScreen.tsx +29 -159
- package/src/presentation/screens/__tests__/SettingsScreen.test.tsx +322 -0
- package/src/presentation/screens/components/AboutLegalSection.tsx +14 -5
- package/src/presentation/screens/components/AppearanceSection.tsx +1 -1
- package/src/presentation/screens/components/LanguageSection.tsx +2 -1
- package/src/presentation/screens/components/NotificationsSection.tsx +19 -14
- package/src/presentation/screens/components/SettingsContent.tsx +167 -0
- package/src/presentation/screens/components/SettingsHeader.tsx +79 -0
- package/src/presentation/screens/hooks/__tests__/useFeatureDetection.test.tsx +261 -0
- package/src/presentation/screens/hooks/useFeatureDetection.ts +15 -5
- package/src/presentation/screens/types/CustomSection.ts +20 -0
- package/src/presentation/screens/types/ExtendedConfig.ts +68 -0
- package/src/presentation/screens/types/FeatureConfig.ts +102 -0
- package/src/presentation/screens/types/SettingsConfig.ts +116 -0
- package/src/presentation/screens/types/index.ts +20 -0
- package/src/presentation/screens/utils/normalizeConfig.ts +2 -1
- package/src/presentation/screens/types.ts +0 -263
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureConfig.d.ts","sourceRoot":"","sources":["../../../../src/presentation/screens/types/FeatureConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjD;;GAEG;AACH,MAAM,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CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,yBAAyB;IACzB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureConfig.js","sourceRoot":"","sources":["../../../../src/presentation/screens/types/FeatureConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Settings Configuration Type
|
|
3
|
+
* Combines all feature configurations
|
|
4
|
+
*/
|
|
5
|
+
import type { FeatureVisibility } from "./FeatureConfig";
|
|
6
|
+
import type { AppearanceConfig, LanguageConfig, NotificationsConfig, AboutConfig, LegalConfig } from "./FeatureConfig";
|
|
7
|
+
import type { AccountConfig, SupportConfig, DeveloperConfig } from "./ExtendedConfig";
|
|
8
|
+
/**
|
|
9
|
+
* Main Settings Configuration
|
|
10
|
+
*
|
|
11
|
+
* Controls which settings features are visible in the SettingsScreen.
|
|
12
|
+
* Each feature can be configured with:
|
|
13
|
+
* - Simple: boolean | 'auto' (quick setup)
|
|
14
|
+
* - Advanced: Detailed config object (full control)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Simple configuration
|
|
18
|
+
* const config: SettingsConfig = {
|
|
19
|
+
* appearance: true,
|
|
20
|
+
* notifications: 'auto',
|
|
21
|
+
* about: false,
|
|
22
|
+
* };
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Advanced configuration
|
|
26
|
+
* const config: SettingsConfig = {
|
|
27
|
+
* appearance: {
|
|
28
|
+
* enabled: true,
|
|
29
|
+
* route: 'CustomAppearance',
|
|
30
|
+
* showLanguage: true,
|
|
31
|
+
* showTheme: true,
|
|
32
|
+
* },
|
|
33
|
+
* notifications: {
|
|
34
|
+
* enabled: 'auto',
|
|
35
|
+
* showToggle: true,
|
|
36
|
+
* initialValue: false,
|
|
37
|
+
* onToggleChange: (value) => console.log(value),
|
|
38
|
+
* },
|
|
39
|
+
* support: {
|
|
40
|
+
* enabled: true,
|
|
41
|
+
* items: {
|
|
42
|
+
* liveSupport: {
|
|
43
|
+
* enabled: true,
|
|
44
|
+
* route: 'ChatSupport',
|
|
45
|
+
* title: 'Live Chat',
|
|
46
|
+
* },
|
|
47
|
+
* },
|
|
48
|
+
* },
|
|
49
|
+
* };
|
|
50
|
+
*/
|
|
51
|
+
export interface SettingsConfig {
|
|
52
|
+
/**
|
|
53
|
+
* Appearance settings (Theme customization)
|
|
54
|
+
* @default 'auto'
|
|
55
|
+
*/
|
|
56
|
+
appearance?: FeatureVisibility | AppearanceConfig;
|
|
57
|
+
/**
|
|
58
|
+
* Language settings
|
|
59
|
+
* @default 'auto'
|
|
60
|
+
*/
|
|
61
|
+
language?: FeatureVisibility | LanguageConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Notifications settings
|
|
64
|
+
* @default 'auto'
|
|
65
|
+
*/
|
|
66
|
+
notifications?: FeatureVisibility | NotificationsConfig;
|
|
67
|
+
/**
|
|
68
|
+
* About settings
|
|
69
|
+
* @default 'auto'
|
|
70
|
+
*/
|
|
71
|
+
about?: FeatureVisibility | AboutConfig;
|
|
72
|
+
/**
|
|
73
|
+
* Legal settings (Terms, Privacy Policy)
|
|
74
|
+
* @default 'auto'
|
|
75
|
+
*/
|
|
76
|
+
legal?: FeatureVisibility | LegalConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Account settings
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
account?: FeatureVisibility | AccountConfig;
|
|
82
|
+
/**
|
|
83
|
+
* Support settings
|
|
84
|
+
* @default false
|
|
85
|
+
*/
|
|
86
|
+
support?: FeatureVisibility | SupportConfig;
|
|
87
|
+
/**
|
|
88
|
+
* Developer settings (only shown in __DEV__ mode)
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
developer?: boolean | DeveloperConfig;
|
|
92
|
+
/**
|
|
93
|
+
* Custom empty state text when no settings are available
|
|
94
|
+
*/
|
|
95
|
+
emptyStateText?: string;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=SettingsConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsConfig.d.ts","sourceRoot":"","sources":["../../../../src/presentation/screens/types/SettingsConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAAC;IAElD;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,GAAG,cAAc,CAAC;IAE9C;;;OAGG;IACH,aAAa,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,CAAC;IAExD;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,GAAG,WAAW,CAAC;IAExC;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,GAAG,WAAW,CAAC;IAExC;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAAC;IAE5C;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAAC;IAE5C;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IAEtC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingsConfig.js","sourceRoot":"","sources":["../../../../src/presentation/screens/types/SettingsConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings Types - Public API
|
|
3
|
+
* Exports all settings-related types
|
|
4
|
+
*/
|
|
5
|
+
export type { FeatureVisibility } from "./FeatureConfig";
|
|
6
|
+
export type { AppearanceConfig, LanguageConfig, NotificationsConfig, AboutConfig, LegalConfig, } from "./FeatureConfig";
|
|
7
|
+
export type { AccountConfig, SupportConfig, DeveloperConfig, } from "./ExtendedConfig";
|
|
8
|
+
export type { SettingsConfig } from "./SettingsConfig";
|
|
9
|
+
export type { CustomSettingsSection } from "./CustomSection";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/presentation/screens/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,aAAa,EACb,aAAa,EACb,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/presentation/screens/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Normalization Utilities
|
|
3
|
+
* Single Responsibility: Normalize config values to consistent format
|
|
4
|
+
*/
|
|
5
|
+
import type { AppearanceConfig, LanguageConfig, NotificationsConfig, AboutConfig, LegalConfig, AccountConfig, SupportConfig, DeveloperConfig, SettingsConfig } from "../types";
|
|
6
|
+
export interface NormalizedConfig {
|
|
7
|
+
appearance: {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
config?: AppearanceConfig;
|
|
10
|
+
};
|
|
11
|
+
language: {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
config?: LanguageConfig;
|
|
14
|
+
};
|
|
15
|
+
notifications: {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
config?: NotificationsConfig;
|
|
18
|
+
};
|
|
19
|
+
about: {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
config?: AboutConfig;
|
|
22
|
+
};
|
|
23
|
+
legal: {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
config?: LegalConfig;
|
|
26
|
+
};
|
|
27
|
+
account: {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
config?: AccountConfig;
|
|
30
|
+
};
|
|
31
|
+
support: {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
config?: SupportConfig;
|
|
34
|
+
};
|
|
35
|
+
developer: {
|
|
36
|
+
enabled: boolean;
|
|
37
|
+
config?: DeveloperConfig;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Normalize entire SettingsConfig to consistent format
|
|
42
|
+
*/
|
|
43
|
+
export declare function normalizeSettingsConfig(config: SettingsConfig | undefined): NormalizedConfig;
|
|
44
|
+
//# sourceMappingURL=normalizeConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeConfig.d.ts","sourceRoot":"","sources":["../../../../src/presentation/screens/utils/normalizeConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAEV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,gBAAgB,CAAC;KAC3B,CAAC;IACF,QAAQ,EAAE;QACR,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,cAAc,CAAC;KACzB,CAAC;IACF,aAAa,EAAE;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,mBAAmB,CAAC;KAC9B,CAAC;IACF,KAAK,EAAE;QACL,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,CAAC;IACF,KAAK,EAAE;QACL,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,aAAa,CAAC;KACxB,CAAC;IACF,SAAS,EAAE;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,eAAe,CAAC;KAC1B,CAAC;CACH;AA2BD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,cAAc,GAAG,SAAS,GACjC,gBAAgB,CAWlB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Normalization Utilities
|
|
3
|
+
* Single Responsibility: Normalize config values to consistent format
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Normalize a config value to enabled boolean and optional config object
|
|
7
|
+
*/
|
|
8
|
+
function normalizeConfigValue(value, defaultValue) {
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
return { enabled: defaultValue === true };
|
|
11
|
+
}
|
|
12
|
+
if (typeof value === "boolean" || value === "auto") {
|
|
13
|
+
return { enabled: value === true };
|
|
14
|
+
}
|
|
15
|
+
// It's a config object
|
|
16
|
+
const config = value;
|
|
17
|
+
const enabled = config?.enabled ?? defaultValue;
|
|
18
|
+
return {
|
|
19
|
+
enabled: enabled === true,
|
|
20
|
+
config,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Normalize entire SettingsConfig to consistent format
|
|
25
|
+
*/
|
|
26
|
+
export function normalizeSettingsConfig(config) {
|
|
27
|
+
return {
|
|
28
|
+
appearance: normalizeConfigValue(config?.appearance, "auto"),
|
|
29
|
+
language: normalizeConfigValue(config?.language, "auto"),
|
|
30
|
+
notifications: normalizeConfigValue(config?.notifications, "auto"),
|
|
31
|
+
about: normalizeConfigValue(config?.about, "auto"),
|
|
32
|
+
legal: normalizeConfigValue(config?.legal, "auto"),
|
|
33
|
+
account: normalizeConfigValue(config?.account, false),
|
|
34
|
+
support: normalizeConfigValue(config?.support, false),
|
|
35
|
+
developer: normalizeConfigValue(config?.developer, false),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=normalizeConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeConfig.js","sourceRoot":"","sources":["../../../../src/presentation/screens/utils/normalizeConfig.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkDH;;GAEG;AACH,SAAS,oBAAoB,CAC3B,KAAwC,EACxC,YAA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
|
4
4
|
"description": "Settings management for React Native apps - user preferences, theme, language, notifications",
|
|
5
|
-
"main": "./
|
|
6
|
-
"types": "./
|
|
5
|
+
"main": "./lib/index.js",
|
|
6
|
+
"types": "./lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
+
"build": "tsc --skipLibCheck",
|
|
8
9
|
"typecheck": "tsc --noEmit",
|
|
9
10
|
"lint": "tsc --noEmit",
|
|
11
|
+
"test": "jest",
|
|
12
|
+
"test:watch": "jest --watch",
|
|
13
|
+
"test:coverage": "jest --coverage",
|
|
14
|
+
"prepublishOnly": "npm run build",
|
|
10
15
|
"version:minor": "npm version minor -m 'chore: release v%s'",
|
|
11
16
|
"version:major": "npm version major -m 'chore: release v%s'"
|
|
12
17
|
},
|
|
@@ -26,32 +31,62 @@
|
|
|
26
31
|
"url": "https://github.com/umituz/react-native-settings"
|
|
27
32
|
},
|
|
28
33
|
"peerDependencies": {
|
|
29
|
-
"react": ">=18.2.0",
|
|
30
|
-
"react-native": ">=0.74.0",
|
|
31
|
-
"zustand": "^5.0.2",
|
|
32
|
-
"lucide-react-native": "^0.468.0",
|
|
33
34
|
"@react-navigation/native": "^6.1.18",
|
|
34
|
-
"react-native-
|
|
35
|
-
"@umituz/react-native-storage": "latest",
|
|
35
|
+
"@umituz/react-native-appearance": "latest",
|
|
36
36
|
"@umituz/react-native-design-system": "latest",
|
|
37
37
|
"@umituz/react-native-design-system-atoms": "latest",
|
|
38
|
+
"@umituz/react-native-design-system-molecules": "latest",
|
|
38
39
|
"@umituz/react-native-design-system-organisms": "latest",
|
|
40
|
+
"@umituz/react-native-design-system-responsive": "latest",
|
|
39
41
|
"@umituz/react-native-design-system-theme": "latest",
|
|
42
|
+
"@umituz/react-native-design-system-typography": "latest",
|
|
40
43
|
"@umituz/react-native-localization": "latest",
|
|
41
|
-
"@umituz/react-native-
|
|
42
|
-
"expo-linear-gradient": "^15.0.7"
|
|
44
|
+
"@umituz/react-native-storage": "latest",
|
|
45
|
+
"expo-linear-gradient": "^15.0.7",
|
|
46
|
+
"lucide-react-native": "^0.468.0",
|
|
47
|
+
"react": ">=18.2.0",
|
|
48
|
+
"react-native": ">=0.74.0",
|
|
49
|
+
"react-native-safe-area-context": "~5.6.0",
|
|
50
|
+
"react-native-svg": "^15.0.0",
|
|
51
|
+
"zustand": "^5.0.2"
|
|
43
52
|
},
|
|
44
53
|
"devDependencies": {
|
|
54
|
+
"@babel/plugin-transform-runtime": "^7.28.5",
|
|
55
|
+
"@react-native/babel-preset": "^0.83.0",
|
|
56
|
+
"@testing-library/jest-native": "^5.4.3",
|
|
57
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
58
|
+
"@testing-library/react-native": "^12.9.0",
|
|
59
|
+
"@types/jest": "^29.5.14",
|
|
45
60
|
"@types/react": "^18.2.45",
|
|
46
61
|
"@types/react-native": "^0.73.0",
|
|
62
|
+
"@umituz/react-native-appearance": "latest",
|
|
63
|
+
"@umituz/react-native-design-system": "latest",
|
|
64
|
+
"@umituz/react-native-design-system-atoms": "latest",
|
|
65
|
+
"@umituz/react-native-design-system-molecules": "latest",
|
|
66
|
+
"@umituz/react-native-design-system-organisms": "latest",
|
|
67
|
+
"@umituz/react-native-design-system-responsive": "latest",
|
|
68
|
+
"@umituz/react-native-design-system-theme": "latest",
|
|
69
|
+
"@umituz/react-native-design-system-typography": "latest",
|
|
70
|
+
"@umituz/react-native-localization": "latest",
|
|
71
|
+
"@expo/vector-icons": "^14.0.0",
|
|
72
|
+
"@umituz/react-native-alert": "latest",
|
|
73
|
+
"@umituz/react-native-notifications": "latest",
|
|
74
|
+
"@umituz/react-native-storage": "latest",
|
|
75
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
76
|
+
"jest": "^29.7.0",
|
|
77
|
+
"lucide-react-native": "^0.468.0",
|
|
78
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
47
79
|
"react": "^18.2.0",
|
|
48
80
|
"react-native": "^0.74.0",
|
|
81
|
+
"react-native-svg": "^15.15.1",
|
|
82
|
+
"react-test-renderer": "^18.3.1",
|
|
49
83
|
"typescript": "^5.3.3"
|
|
50
84
|
},
|
|
51
85
|
"publishConfig": {
|
|
52
86
|
"access": "public"
|
|
53
87
|
},
|
|
54
88
|
"files": [
|
|
89
|
+
"lib",
|
|
55
90
|
"src",
|
|
56
91
|
"README.md",
|
|
57
92
|
"LICENSE"
|