@umituz/react-native-settings 4.23.97 → 4.23.99
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/about/domain/entities/AppInfo.ts +1 -0
- package/src/domains/about/presentation/components/AboutContent.tsx +6 -6
- package/src/domains/about/presentation/screens/AboutScreen.tsx +2 -4
- package/src/domains/appearance/presentation/screens/AppearanceScreen.tsx +9 -12
- package/src/domains/disclaimer/presentation/components/DisclaimerSetting.tsx +9 -20
- package/src/domains/disclaimer/presentation/screens/DisclaimerScreen.tsx +2 -6
- package/src/domains/gamification/types/index.ts +12 -12
- package/src/domains/localization/presentation/components/LanguageSection.tsx +3 -3
- package/src/domains/localization/presentation/screens/LanguageSelectionScreen.tsx +1 -1
- package/src/domains/notifications/presentation/components/NotificationsSection.tsx +2 -4
- package/src/domains/notifications/presentation/screens/NotificationSettingsScreen.tsx +1 -3
- package/src/infrastructure/utils/configFactory.ts +3 -14
- package/src/presentation/hooks/useSettingsScreenConfig.ts +27 -12
- package/src/presentation/navigation/SettingsStackNavigator.tsx +9 -8
- package/src/presentation/navigation/hooks/useNavigationHandlers.ts +4 -2
- package/src/presentation/navigation/hooks/useSettingsScreens.ts +10 -10
- package/src/presentation/navigation/utils/navigationTranslations.ts +29 -32
- package/src/presentation/screens/SettingsScreen.tsx +5 -1
- package/src/presentation/screens/components/GamificationSettingsItem.tsx +3 -6
- package/src/presentation/screens/components/SettingsContent.tsx +9 -5
- package/src/presentation/screens/components/SettingsHeader.tsx +4 -3
- package/src/presentation/screens/components/SubscriptionSettingsItem.tsx +3 -4
- package/src/presentation/screens/components/VideoTutorialSettingsItem.tsx +2 -4
- package/src/presentation/screens/components/WalletSettingsItem.tsx +3 -4
- package/src/presentation/screens/components/sections/FeatureSettingsSection.tsx +11 -13
- package/src/presentation/screens/components/sections/IdentitySettingsSection.tsx +5 -6
- package/src/presentation/screens/components/sections/ProfileSectionLoader.tsx +11 -9
- package/src/presentation/screens/components/sections/SupportSettingsSection.tsx +22 -23
- package/src/presentation/screens/types/SettingsConfig.ts +97 -6
- package/src/presentation/utils/accountConfigUtils.ts +9 -17
- package/src/presentation/utils/config-creators/base-configs.ts +0 -22
- package/src/presentation/utils/config-creators/feature-configs.ts +0 -20
- package/src/presentation/utils/config-creators/support-configs.ts +2 -12
- package/src/presentation/utils/faqTranslator.ts +5 -18
- package/src/presentation/utils/settingsConfigFactory.ts +10 -13
- package/src/presentation/utils/useAuthHandlers.ts +13 -20
- package/src/presentation/utils/userProfileUtils.ts +2 -16
- package/src/domains/disclaimer/README.md +0 -87
- package/src/domains/disclaimer/presentation/components/DisclaimerCard.test.tsx +0 -208
- package/src/domains/disclaimer/presentation/components/DisclaimerModal.test.tsx +0 -236
- package/src/domains/disclaimer/presentation/components/DisclaimerSetting.test.tsx +0 -74
- package/src/domains/disclaimer/presentation/components/README.md +0 -97
- package/src/domains/localization/presentation/components/__tests__/LanguageItem.test.tsx +0 -106
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for DisclaimerCard Component
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { render, fireEvent } from '@testing-library/react-native';
|
|
7
|
-
import { DisclaimerCard } from '../DisclaimerCard';
|
|
8
|
-
|
|
9
|
-
// Mock dependencies
|
|
10
|
-
jest.mock('@umituz/react-native-design-system', () => ({
|
|
11
|
-
useAppDesignTokens: () => ({
|
|
12
|
-
colors: {
|
|
13
|
-
backgroundPrimary: '#ffffff',
|
|
14
|
-
},
|
|
15
|
-
spacing: {
|
|
16
|
-
md: 16,
|
|
17
|
-
},
|
|
18
|
-
typography: {
|
|
19
|
-
labelLarge: {
|
|
20
|
-
fontWeight: '500',
|
|
21
|
-
fontSize: 14,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
25
|
-
withAlpha: jest.fn((color: string, alpha: number) => `${color}${alpha}`),
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
jest.mock('@umituz/react-native-design-system', () => ({
|
|
29
|
-
AtomicText: ({ children, type, color, style }: any) => (
|
|
30
|
-
<Text style={style} testID={`atomic-text-${type}-${color}`}>
|
|
31
|
-
{children}
|
|
32
|
-
</Text>
|
|
33
|
-
),
|
|
34
|
-
AtomicIcon: ({ name, color, size, style }: any) => (
|
|
35
|
-
<Text style={style} testID={`atomic-icon-${name}-${color}-${size}`}>
|
|
36
|
-
Icon: {name}
|
|
37
|
-
</Text>
|
|
38
|
-
),
|
|
39
|
-
}));
|
|
40
|
-
|
|
41
|
-
import { Text } from 'react-native';
|
|
42
|
-
|
|
43
|
-
describe('DisclaimerCard', () => {
|
|
44
|
-
it('renders correctly with basic props', () => {
|
|
45
|
-
const { getByTestId, getByText } = render(
|
|
46
|
-
<DisclaimerCard
|
|
47
|
-
title="Test Title"
|
|
48
|
-
shortMessage="Test Message"
|
|
49
|
-
iconName="AlertTriangle"
|
|
50
|
-
iconColor="#FF9800"
|
|
51
|
-
backgroundColor="#FFF3E0"
|
|
52
|
-
onPress={jest.fn()}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
expect(getByText('Test Title')).toBeTruthy();
|
|
57
|
-
expect(getByText('Test Message')).toBeTruthy();
|
|
58
|
-
expect(getByTestId('disclaimer-setting')).toBeTruthy();
|
|
59
|
-
expect(getByTestId('atomic-icon-AlertTriangle-warning')).toBeTruthy();
|
|
60
|
-
expect(getByTestId('atomic-icon-ArrowRight-secondary-sm')).toBeTruthy();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('calls onPress when pressed', () => {
|
|
64
|
-
const mockOnPress = jest.fn();
|
|
65
|
-
const { getByTestId } = render(
|
|
66
|
-
<DisclaimerCard
|
|
67
|
-
title="Test Title"
|
|
68
|
-
shortMessage="Test Message"
|
|
69
|
-
iconName="AlertTriangle"
|
|
70
|
-
iconColor="#FF9800"
|
|
71
|
-
backgroundColor="#FFF3E0"
|
|
72
|
-
onPress={mockOnPress}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
fireEvent.press(getByTestId('disclaimer-setting'));
|
|
77
|
-
expect(mockOnPress).toHaveBeenCalledTimes(1);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('applies correct styling with theme tokens', () => {
|
|
81
|
-
const { getByTestId } = render(
|
|
82
|
-
<DisclaimerCard
|
|
83
|
-
title="Test Title"
|
|
84
|
-
shortMessage="Test Message"
|
|
85
|
-
iconName="AlertTriangle"
|
|
86
|
-
iconColor="#FF9800"
|
|
87
|
-
backgroundColor="#FFF3E0"
|
|
88
|
-
onPress={jest.fn()}
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
const card = getByTestId('disclaimer-setting');
|
|
93
|
-
expect(card.props.style).toContainEqual({
|
|
94
|
-
backgroundColor: '#FFF3E0',
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('renders with different icon names', () => {
|
|
99
|
-
const { getByTestId } = render(
|
|
100
|
-
<DisclaimerCard
|
|
101
|
-
title="Test Title"
|
|
102
|
-
shortMessage="Test Message"
|
|
103
|
-
iconName="info"
|
|
104
|
-
iconColor="#2196F3"
|
|
105
|
-
backgroundColor="#E3F2FD"
|
|
106
|
-
onPress={jest.fn()}
|
|
107
|
-
/>
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
expect(getByTestId('atomic-icon-info-warning')).toBeTruthy();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('handles long text content', () => {
|
|
114
|
-
const longTitle = 'This is a very long disclaimer title that should be handled properly';
|
|
115
|
-
const longMessage = 'This is a very long disclaimer message that should wrap properly and not break the layout';
|
|
116
|
-
|
|
117
|
-
const { getByText } = render(
|
|
118
|
-
<DisclaimerCard
|
|
119
|
-
title={longTitle}
|
|
120
|
-
shortMessage={longMessage}
|
|
121
|
-
iconName="AlertTriangle"
|
|
122
|
-
iconColor="#FF9800"
|
|
123
|
-
backgroundColor="#FFF3E0"
|
|
124
|
-
onPress={jest.fn()}
|
|
125
|
-
/>
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
expect(getByText(longTitle)).toBeTruthy();
|
|
129
|
-
expect(getByText(longMessage)).toBeTruthy();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('has correct accessibility properties', () => {
|
|
133
|
-
const mockOnPress = jest.fn();
|
|
134
|
-
const { getByTestId } = render(
|
|
135
|
-
<DisclaimerCard
|
|
136
|
-
title="Test Title"
|
|
137
|
-
shortMessage="Test Message"
|
|
138
|
-
iconName="AlertTriangle"
|
|
139
|
-
iconColor="#FF9800"
|
|
140
|
-
backgroundColor="#FFF3E0"
|
|
141
|
-
onPress={mockOnPress}
|
|
142
|
-
/>
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
const touchable = getByTestId('disclaimer-setting');
|
|
146
|
-
expect(touchable.props.activeOpacity).toBe(0.7);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('uses withAlpha utility correctly', () => {
|
|
150
|
-
const { withAlpha } = require('@umituz/react-native-design-system');
|
|
151
|
-
|
|
152
|
-
render(
|
|
153
|
-
<DisclaimerCard
|
|
154
|
-
title="Test Title"
|
|
155
|
-
shortMessage="Test Message"
|
|
156
|
-
iconName="AlertTriangle"
|
|
157
|
-
iconColor="#FF9800"
|
|
158
|
-
backgroundColor="#FFF3E0"
|
|
159
|
-
onPress={jest.fn()}
|
|
160
|
-
/>
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
expect(withAlpha).toHaveBeenCalledWith('#FF9800', 0.2);
|
|
164
|
-
expect(withAlpha).toHaveBeenCalledWith('#FF9800', 0.4);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('maintains correct layout structure', () => {
|
|
168
|
-
const { getByTestId } = render(
|
|
169
|
-
<DisclaimerCard
|
|
170
|
-
title="Test Title"
|
|
171
|
-
shortMessage="Test Message"
|
|
172
|
-
iconName="AlertTriangle"
|
|
173
|
-
iconColor="#FF9800"
|
|
174
|
-
backgroundColor="#FFF3E0"
|
|
175
|
-
onPress={jest.fn()}
|
|
176
|
-
/>
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
// Check that icon container has correct styles
|
|
180
|
-
expect(getByTestId('atomic-icon-AlertTriangle-warning')).toBeTruthy();
|
|
181
|
-
|
|
182
|
-
// Check that title and arrow are present
|
|
183
|
-
expect(getByTestId('atomic-icon-ArrowRight-secondary-sm')).toBeTruthy();
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
it('handles press events correctly', () => {
|
|
187
|
-
const mockOnPress = jest.fn();
|
|
188
|
-
const { getByTestId } = render(
|
|
189
|
-
<DisclaimerCard
|
|
190
|
-
title="Test Title"
|
|
191
|
-
shortMessage="Test Message"
|
|
192
|
-
iconName="AlertTriangle"
|
|
193
|
-
iconColor="#FF9800"
|
|
194
|
-
backgroundColor="#FFF3E0"
|
|
195
|
-
onPress={mockOnPress}
|
|
196
|
-
/>
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
// Test single press
|
|
200
|
-
fireEvent.press(getByTestId('disclaimer-setting'));
|
|
201
|
-
expect(mockOnPress).toHaveBeenCalledTimes(1);
|
|
202
|
-
|
|
203
|
-
// Test multiple presses
|
|
204
|
-
fireEvent.press(getByTestId('disclaimer-setting'));
|
|
205
|
-
fireEvent.press(getByTestId('disclaimer-setting'));
|
|
206
|
-
expect(mockOnPress).toHaveBeenCalledTimes(3);
|
|
207
|
-
});
|
|
208
|
-
});
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for DisclaimerModal Component
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { render, fireEvent } from '@testing-library/react-native';
|
|
7
|
-
import { DisclaimerModal } from '../DisclaimerModal';
|
|
8
|
-
|
|
9
|
-
// Mock dependencies
|
|
10
|
-
jest.mock('@umituz/react-native-design-system', () => ({
|
|
11
|
-
useAppDesignTokens: () => ({
|
|
12
|
-
colors: {
|
|
13
|
-
backgroundPrimary: '#ffffff',
|
|
14
|
-
borderLight: '#e0e0e0',
|
|
15
|
-
},
|
|
16
|
-
}),
|
|
17
|
-
}));
|
|
18
|
-
|
|
19
|
-
jest.mock('@umituz/react-native-design-system', () => ({
|
|
20
|
-
AtomicText: ({ children, type, color, style }: any) => (
|
|
21
|
-
<Text style={style} testID={`atomic-text-${type}-${color}`}>
|
|
22
|
-
{children}
|
|
23
|
-
</Text>
|
|
24
|
-
),
|
|
25
|
-
AtomicIcon: ({ name, color, size, style }: any) => (
|
|
26
|
-
<Text style={style} testID={`atomic-icon-${name}-${color}-${size}`}>
|
|
27
|
-
Icon: {name}
|
|
28
|
-
</Text>
|
|
29
|
-
),
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
import { Text, Modal, ScrollView } from 'react-native';
|
|
33
|
-
|
|
34
|
-
describe('DisclaimerModal', () => {
|
|
35
|
-
it('renders null when visible is false', () => {
|
|
36
|
-
const { queryByTestId } = render(
|
|
37
|
-
<DisclaimerModal
|
|
38
|
-
visible={false}
|
|
39
|
-
title="Test Title"
|
|
40
|
-
content="Test Content"
|
|
41
|
-
onClose={jest.fn()}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
expect(queryByTestId('disclaimer-modal')).toBeNull();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('renders correctly when visible is true', () => {
|
|
49
|
-
const { getByTestId, getByText } = render(
|
|
50
|
-
<DisclaimerModal
|
|
51
|
-
visible={true}
|
|
52
|
-
title="Test Title"
|
|
53
|
-
content="Test Content"
|
|
54
|
-
onClose={jest.fn()}
|
|
55
|
-
/>
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
expect(getByTestId('disclaimer-modal')).toBeTruthy();
|
|
59
|
-
expect(getByText('Test Title')).toBeTruthy();
|
|
60
|
-
expect(getByText('Test Content')).toBeTruthy();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('calls onClose when close button is pressed', () => {
|
|
64
|
-
const mockOnClose = jest.fn();
|
|
65
|
-
const { getByTestId } = render(
|
|
66
|
-
<DisclaimerModal
|
|
67
|
-
visible={true}
|
|
68
|
-
title="Test Title"
|
|
69
|
-
content="Test Content"
|
|
70
|
-
onClose={mockOnClose}
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
fireEvent.press(getByTestId('close-disclaimer-modal'));
|
|
75
|
-
expect(mockOnClose).toHaveBeenCalledTimes(1);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('applies correct theme colors', () => {
|
|
79
|
-
const { getByTestId } = render(
|
|
80
|
-
<DisclaimerModal
|
|
81
|
-
visible={true}
|
|
82
|
-
title="Test Title"
|
|
83
|
-
content="Test Content"
|
|
84
|
-
onClose={jest.fn()}
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const modalContainer = getByTestId('disclaimer-modal');
|
|
89
|
-
expect(modalContainer.props.style).toContainEqual({
|
|
90
|
-
backgroundColor: '#ffffff',
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('renders header with correct structure', () => {
|
|
95
|
-
const { getByTestId, getByText } = render(
|
|
96
|
-
<DisclaimerModal
|
|
97
|
-
visible={true}
|
|
98
|
-
title="Test Title"
|
|
99
|
-
content="Test Content"
|
|
100
|
-
onClose={jest.fn()}
|
|
101
|
-
/>
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
expect(getByTestId('atomic-text-headlineMedium-primary')).toBeTruthy();
|
|
105
|
-
expect(getByTestId('atomic-icon-X-primary-md')).toBeTruthy();
|
|
106
|
-
expect(getByText('Test Title')).toBeTruthy();
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('renders content in ScrollView', () => {
|
|
110
|
-
const { getByTestId } = render(
|
|
111
|
-
<DisclaimerModal
|
|
112
|
-
visible={true}
|
|
113
|
-
title="Test Title"
|
|
114
|
-
content="Test Content"
|
|
115
|
-
onClose={jest.fn()}
|
|
116
|
-
/>
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
expect(getByTestId('disclaimer-modal-content')).toBeTruthy();
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('handles long content correctly', () => {
|
|
123
|
-
const longContent = 'This is a very long disclaimer content that should scroll properly. '.repeat(20);
|
|
124
|
-
|
|
125
|
-
const { getByText } = render(
|
|
126
|
-
<DisclaimerModal
|
|
127
|
-
visible={true}
|
|
128
|
-
title="Test Title"
|
|
129
|
-
content={longContent}
|
|
130
|
-
onClose={jest.fn()}
|
|
131
|
-
/>
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
expect(getByText(longContent)).toBeTruthy();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('applies correct text styling', () => {
|
|
138
|
-
const { getByTestId } = render(
|
|
139
|
-
<DisclaimerModal
|
|
140
|
-
visible={true}
|
|
141
|
-
title="Test Title"
|
|
142
|
-
content="Test Content"
|
|
143
|
-
onClose={jest.fn()}
|
|
144
|
-
/>
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
expect(getByTestId('atomic-text-bodyMedium-primary')).toBeTruthy();
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it('has correct accessibility properties', () => {
|
|
151
|
-
const mockOnClose = jest.fn();
|
|
152
|
-
const { getByTestId } = render(
|
|
153
|
-
<DisclaimerModal
|
|
154
|
-
visible={true}
|
|
155
|
-
title="Test Title"
|
|
156
|
-
content="Test Content"
|
|
157
|
-
onClose={mockOnClose}
|
|
158
|
-
/>
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const closeButton = getByTestId('close-disclaimer-modal');
|
|
162
|
-
expect(closeButton).toBeTruthy();
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('handles multiple close calls', () => {
|
|
166
|
-
const mockOnClose = jest.fn();
|
|
167
|
-
const { getByTestId } = render(
|
|
168
|
-
<DisclaimerModal
|
|
169
|
-
visible={true}
|
|
170
|
-
title="Test Title"
|
|
171
|
-
content="Test Content"
|
|
172
|
-
onClose={mockOnClose}
|
|
173
|
-
/>
|
|
174
|
-
);
|
|
175
|
-
|
|
176
|
-
const closeButton = getByTestId('close-disclaimer-modal');
|
|
177
|
-
|
|
178
|
-
fireEvent.press(closeButton);
|
|
179
|
-
fireEvent.press(closeButton);
|
|
180
|
-
fireEvent.press(closeButton);
|
|
181
|
-
|
|
182
|
-
expect(mockOnClose).toHaveBeenCalledTimes(3);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it('maintains correct layout structure', () => {
|
|
186
|
-
const { getByTestId } = render(
|
|
187
|
-
<DisclaimerModal
|
|
188
|
-
visible={true}
|
|
189
|
-
title="Test Title"
|
|
190
|
-
content="Test Content"
|
|
191
|
-
onClose={jest.fn()}
|
|
192
|
-
/>
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
// Check modal container exists
|
|
196
|
-
expect(getByTestId('disclaimer-modal')).toBeTruthy();
|
|
197
|
-
|
|
198
|
-
// Check header elements exist
|
|
199
|
-
expect(getByTestId('atomic-text-headlineMedium-primary')).toBeTruthy();
|
|
200
|
-
expect(getByTestId('atomic-icon-X-primary-md')).toBeTruthy();
|
|
201
|
-
|
|
202
|
-
// Check content exists
|
|
203
|
-
expect(getByTestId('disclaimer-modal-content')).toBeTruthy();
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
it('handles empty content gracefully', () => {
|
|
207
|
-
const { getByTestId, queryByText } = render(
|
|
208
|
-
<DisclaimerModal
|
|
209
|
-
visible={true}
|
|
210
|
-
title="Test Title"
|
|
211
|
-
content=""
|
|
212
|
-
onClose={jest.fn()}
|
|
213
|
-
/>
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
expect(getByTestId('disclaimer-modal')).toBeTruthy();
|
|
217
|
-
expect(getByTestId('atomic-text-headlineMedium-primary')).toBeTruthy();
|
|
218
|
-
// Empty content should still render the text component
|
|
219
|
-
expect(getByTestId('atomic-text-bodyMedium-primary')).toBeTruthy();
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
it('handles special characters in content', () => {
|
|
223
|
-
const specialContent = 'Content with special chars: © ® ™ "quotes" \'apostrophes\'';
|
|
224
|
-
|
|
225
|
-
const { getByText } = render(
|
|
226
|
-
<DisclaimerModal
|
|
227
|
-
visible={true}
|
|
228
|
-
title="Test Title"
|
|
229
|
-
content={specialContent}
|
|
230
|
-
onClose={jest.fn()}
|
|
231
|
-
/>
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
expect(getByText(specialContent)).toBeTruthy();
|
|
235
|
-
});
|
|
236
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for DisclaimerSetting Component
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { render, fireEvent } from '@testing-library/react-native';
|
|
7
|
-
import { DisclaimerSetting } from '../DisclaimerSetting';
|
|
8
|
-
|
|
9
|
-
// Mock dependencies
|
|
10
|
-
jest.mock('../../../localization', () => ({
|
|
11
|
-
useLocalization: () => ({
|
|
12
|
-
t: (key: string) => key,
|
|
13
|
-
}),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
jest.mock('@umituz/react-native-design-system', () => ({
|
|
17
|
-
useAppDesignTokens: () => ({
|
|
18
|
-
colors: {
|
|
19
|
-
backgroundPrimary: '#ffffff',
|
|
20
|
-
warning: '#ff9800',
|
|
21
|
-
},
|
|
22
|
-
spacing: {
|
|
23
|
-
md: 16,
|
|
24
|
-
},
|
|
25
|
-
}),
|
|
26
|
-
withAlpha: (color: string, alpha: number) => `${color}${alpha}`,
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
describe('DisclaimerSetting', () => {
|
|
30
|
-
it('renders disclaimer card correctly', () => {
|
|
31
|
-
const { getByTestId } = render(<DisclaimerSetting />);
|
|
32
|
-
|
|
33
|
-
expect(getByTestId('disclaimer-setting')).toBeTruthy();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('opens modal when card is pressed', () => {
|
|
37
|
-
const { getByTestId } = render(<DisclaimerSetting />);
|
|
38
|
-
|
|
39
|
-
const card = getByTestId('disclaimer-setting');
|
|
40
|
-
fireEvent.press(card);
|
|
41
|
-
|
|
42
|
-
// Modal should be visible now
|
|
43
|
-
expect(getByTestId('close-disclaimer-modal')).toBeTruthy();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('closes modal when close button is pressed', () => {
|
|
47
|
-
const { getByTestId } = render(<DisclaimerSetting />);
|
|
48
|
-
|
|
49
|
-
// Open modal first
|
|
50
|
-
const card = getByTestId('disclaimer-setting');
|
|
51
|
-
fireEvent.press(card);
|
|
52
|
-
|
|
53
|
-
// Close modal
|
|
54
|
-
const closeButton = getByTestId('close-disclaimer-modal');
|
|
55
|
-
fireEvent.press(closeButton);
|
|
56
|
-
|
|
57
|
-
// Modal should be closed
|
|
58
|
-
expect(() => getByTestId('close-disclaimer-modal')).toThrow();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('uses custom props when provided', () => {
|
|
62
|
-
const customProps = {
|
|
63
|
-
titleKey: 'custom.title',
|
|
64
|
-
messageKey: 'custom.message',
|
|
65
|
-
shortMessageKey: 'custom.shortMessage',
|
|
66
|
-
iconName: 'info',
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const { getByText } = render(<DisclaimerSetting {...customProps} />);
|
|
70
|
-
|
|
71
|
-
expect(getByText('custom.title')).toBeTruthy();
|
|
72
|
-
expect(getByText('custom.shortMessage')).toBeTruthy();
|
|
73
|
-
});
|
|
74
|
-
});
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# Disclaimer Components
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
Components for displaying legal disclaimers, warnings, and important information to users. Provides flexible options for showing disclaimers as cards, modals, or integrated settings with acceptance tracking.
|
|
6
|
-
|
|
7
|
-
## File Paths
|
|
8
|
-
|
|
9
|
-
- **DisclaimerCard**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/components/DisclaimerCard.tsx`
|
|
10
|
-
- **DisclaimerModal**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/components/DisclaimerModal.tsx`
|
|
11
|
-
- **DisclaimerSetting**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/components/DisclaimerSetting.tsx`
|
|
12
|
-
- **DisclaimerScreen**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/screens/DisclaimerScreen.tsx`
|
|
13
|
-
|
|
14
|
-
## Strategy
|
|
15
|
-
|
|
16
|
-
1. **Progressive Disclosure**: Uses compact cards for summary information with expand/collapse functionality, showing full details only when users explicitly request them via modals or dedicated screens.
|
|
17
|
-
|
|
18
|
-
2. **Acceptance Tracking**: Implements storage-based tracking of user acceptance, allowing one-time or versioned disclaimers that don't repeatedly show to users who have already accepted.
|
|
19
|
-
|
|
20
|
-
3. **Flexible Display Options**: Provides multiple component variants (card, modal, setting, screen) to accommodate different UX requirements and legal compliance needs.
|
|
21
|
-
|
|
22
|
-
4. **Legal Compliance**: Designed to support various legal scenarios including terms of service, privacy policies, beta warnings, and regional restrictions with proper acceptance handling.
|
|
23
|
-
|
|
24
|
-
5. **Internationalization Ready**: Supports translation keys and localized content to display disclaimers in user's preferred language, essential for global apps.
|
|
25
|
-
|
|
26
|
-
## Restrictions
|
|
27
|
-
|
|
28
|
-
### ❌ DO NOT
|
|
29
|
-
|
|
30
|
-
- Hide critical legal information behind multiple taps
|
|
31
|
-
- Use confusing or ambiguous language
|
|
32
|
-
- Bypass acceptance tracking for required disclaimers
|
|
33
|
-
- Display disclaimers that are hard to read or dismiss
|
|
34
|
-
- Mix different disclaimer types inappropriately
|
|
35
|
-
|
|
36
|
-
### ❌ NEVER
|
|
37
|
-
|
|
38
|
-
- Allow users to proceed without accepting required disclaimers
|
|
39
|
-
- Store acceptance without reliable persistence mechanism
|
|
40
|
-
- Show outdated or superseded disclaimer versions
|
|
41
|
-
- Use dark patterns to trick users into acceptance
|
|
42
|
-
- Display illegal or unenforceable disclaimer content
|
|
43
|
-
|
|
44
|
-
### ❌ AVOID
|
|
45
|
-
|
|
46
|
-
- Overly long disclaimer text (break into sections)
|
|
47
|
-
- Technical jargon that average users don't understand
|
|
48
|
-
- Aggressive or alarming icon choices
|
|
49
|
-
- Blocking app usage for non-critical disclaimers
|
|
50
|
-
- Showing disclaimers too frequently
|
|
51
|
-
|
|
52
|
-
## Rules
|
|
53
|
-
|
|
54
|
-
### ✅ ALWAYS
|
|
55
|
-
|
|
56
|
-
- Use clear, concise language in disclaimers
|
|
57
|
-
- Require explicit acceptance for legal disclaimers
|
|
58
|
-
- Store acceptance reliably using AsyncStorage
|
|
59
|
-
- Provide easy access to full disclaimer text
|
|
60
|
-
- Allow users to review disclaimers anytime
|
|
61
|
-
|
|
62
|
-
### ✅ MUST
|
|
63
|
-
|
|
64
|
-
- Show disclaimers before relevant features are used
|
|
65
|
-
- Include accept/decline options for modal disclaimers
|
|
66
|
-
- Version disclaimers to track updates
|
|
67
|
-
- Provide legal contact information
|
|
68
|
-
- Comply with regional legal requirements
|
|
69
|
-
|
|
70
|
-
### ✅ SHOULD
|
|
71
|
-
|
|
72
|
-
- Use showOnce for one-time acknowledgments
|
|
73
|
-
- Implement version checking for updated disclaimers
|
|
74
|
-
- Group related disclaimers together
|
|
75
|
-
- Use appropriate warning levels (info, warning, error)
|
|
76
|
-
- Provide translations for all user-facing text
|
|
77
|
-
- Test disclaimer flows thoroughly
|
|
78
|
-
|
|
79
|
-
## AI Agent Guidelines
|
|
80
|
-
|
|
81
|
-
1. **Component Selection**: Use DisclaimerCard for non-critical notices and summaries. Use DisclaimerModal for required legal acceptance (terms, privacy). Use DisclaimerSetting for optional features or beta warnings. Use DisclaimerScreen for comprehensive legal documents.
|
|
82
|
-
|
|
83
|
-
2. **Acceptance Strategy**: For required legal disclaimers (terms, privacy), block app or feature usage until accepted. Use version checking to show updated disclaimers only when content changes. For non-critical notices, use showOnce to avoid annoying users.
|
|
84
|
-
|
|
85
|
-
3. **Storage Best Practices**: Use AsyncStorage with unique keys for each disclaimer. Include version numbers in storage keys (e.g., "privacy-2024-01"). Store acceptance timestamp to track when users agreed. Clear storage when app is uninstalled.
|
|
86
|
-
|
|
87
|
-
4. **Content Organization**: Break long legal documents into sections with clear headings. Use formatting (bold, lists) to improve readability. Consider providing a summary with link to full text. Ensure font sizes are readable (minimum 14px).
|
|
88
|
-
|
|
89
|
-
5. **User Experience**: Make acceptance actions clear (use "I Agree" / "I Accept" rather than "OK"). Provide a way to decline with clear consequences. Don't block the entire app for minor disclaimers - allow access to other features. Consider showing disclaimers at appropriate times (onboarding, before specific features).
|
|
90
|
-
|
|
91
|
-
## Reference
|
|
92
|
-
|
|
93
|
-
- **Card Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/components/DisclaimerCard.tsx`
|
|
94
|
-
- **Modal Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/components/DisclaimerModal.tsx`
|
|
95
|
-
- **Setting Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/components/DisclaimerSetting.tsx`
|
|
96
|
-
- **Screen Component**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/screens/DisclaimerScreen.tsx`
|
|
97
|
-
- **Disclaimer Components**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-settings/src/domains/disclaimer/presentation/components/`
|