@umituz/react-native-subscription 2.14.99 → 2.14.100
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 +211 -394
- package/package.json +1 -1
- package/src/application/README.md +46 -225
- package/src/application/ports/README.md +42 -97
- package/src/domain/README.md +36 -384
- package/src/domain/constants/README.md +0 -56
- package/src/domain/entities/README.md +43 -169
- package/src/domain/errors/README.md +33 -287
- package/src/domain/value-objects/README.md +43 -179
- package/src/domains/README.md +50 -238
- package/src/domains/README.md.bak +274 -0
- package/src/domains/config/README.md +93 -383
- package/src/domains/config/domain/README.md +23 -376
- package/src/domains/config/domain/entities/README.md +34 -343
- package/src/domains/paywall/README.md +99 -369
- package/src/domains/paywall/components/README.md +34 -178
- package/src/domains/paywall/entities/README.md +34 -193
- package/src/domains/paywall/hooks/README.md +34 -122
- package/src/domains/wallet/README.md +34 -275
- package/src/domains/wallet/README.md.bak +209 -0
- package/src/domains/wallet/domain/README.md +34 -101
- package/src/domains/wallet/domain/entities/README.md +34 -115
- package/src/domains/wallet/domain/errors/README.md +34 -151
- package/src/domains/wallet/infrastructure/README.md +34 -89
- package/src/domains/wallet/presentation/components/README.md +34 -224
- package/src/domains/wallet/presentation/hooks/README.md +34 -248
- package/src/infrastructure/README.md +37 -496
- package/src/infrastructure/mappers/README.md +0 -13
- package/src/infrastructure/repositories/README.md +74 -360
- package/src/infrastructure/services/README.md +95 -370
- package/src/presentation/README.md +123 -408
- package/src/presentation/README.md.bak +172 -0
- package/src/presentation/components/README.md +151 -179
- package/src/presentation/components/README.md.bak +217 -0
- package/src/presentation/components/details/CreditRow.md +65 -310
- package/src/presentation/components/details/DetailRow.md +63 -255
- package/src/presentation/components/details/PremiumDetailsCard.md +65 -238
- package/src/presentation/components/details/PremiumStatusBadge.md +64 -239
- package/src/presentation/components/details/README.md +97 -447
- package/src/presentation/components/feedback/PaywallFeedbackModal.md +63 -287
- package/src/presentation/components/feedback/README.md +97 -445
- package/src/presentation/components/paywall/PaywallModal.md +66 -416
- package/src/presentation/components/paywall/README.md +50 -186
- package/src/presentation/components/sections/README.md +97 -466
- package/src/presentation/components/sections/SubscriptionSection.md +92 -244
- package/src/presentation/hooks/README.md +154 -741
- package/src/presentation/hooks/useAuthAwarePurchase.md +58 -325
- package/src/presentation/hooks/useAuthGate.md +61 -375
- package/src/presentation/hooks/useAuthSubscriptionSync.md +66 -370
- package/src/presentation/hooks/useCreditChecker.md +73 -378
- package/src/presentation/hooks/useCredits.md +74 -313
- package/src/presentation/hooks/useCredits.md.bak +231 -0
- package/src/presentation/hooks/useCreditsGate.md +66 -318
- package/src/presentation/hooks/useDeductCredit.md +0 -76
- package/src/presentation/hooks/useDevTestCallbacks.md +63 -394
- package/src/presentation/hooks/useFeatureGate.md +105 -150
- package/src/presentation/hooks/useFeatureGate.md.bak +284 -0
- package/src/presentation/hooks/useInitializeCredits.md +64 -430
- package/src/presentation/hooks/usePaywall.md +61 -306
- package/src/presentation/hooks/usePaywallOperations.md +64 -458
- package/src/presentation/hooks/usePaywallVisibility.md +67 -316
- package/src/presentation/hooks/usePremium.md +84 -226
- package/src/presentation/hooks/usePremiumGate.md +60 -395
- package/src/presentation/hooks/usePremiumWithCredits.md +64 -401
- package/src/presentation/hooks/useSubscription.md +66 -422
- package/src/presentation/hooks/useSubscriptionDetails.md +65 -410
- package/src/presentation/hooks/useSubscriptionGate.md +80 -164
- package/src/presentation/hooks/useSubscriptionSettingsConfig.md +66 -346
- package/src/presentation/hooks/useSubscriptionStatus.md +66 -396
- package/src/presentation/hooks/useUserTier.md +63 -328
- package/src/presentation/hooks/useUserTierWithRepository.md +64 -424
- package/src/presentation/screens/README.md +48 -190
- package/src/presentation/types/README.md +0 -16
- package/src/presentation/utils/README.md +0 -21
- package/src/revenuecat/README.md +99 -518
- package/src/revenuecat/application/README.md +35 -150
- package/src/revenuecat/application/ports/README.md +34 -162
- package/src/revenuecat/domain/README.md +42 -141
- package/src/revenuecat/domain/constants/README.md +34 -176
- package/src/revenuecat/domain/entities/README.md +34 -374
- package/src/revenuecat/domain/errors/README.md +47 -191
- package/src/revenuecat/domain/types/README.md +34 -366
- package/src/revenuecat/domain/value-objects/README.md +34 -434
- package/src/revenuecat/infrastructure/README.md +34 -43
- package/src/revenuecat/infrastructure/config/README.md +32 -23
- package/src/revenuecat/infrastructure/handlers/README.md +34 -211
- package/src/revenuecat/infrastructure/managers/README.md +34 -42
- package/src/revenuecat/infrastructure/services/README.md +35 -318
- package/src/revenuecat/infrastructure/utils/README.md +34 -375
- package/src/revenuecat/presentation/README.md +34 -176
- package/src/revenuecat/presentation/hooks/README.md +29 -35
- package/src/utils/README.md +38 -525
|
@@ -2,282 +2,90 @@
|
|
|
2
2
|
|
|
3
3
|
Simple row component displaying a label-value pair for subscription details.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Location
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { DetailRow } from '@umituz/react-native-subscription';
|
|
9
|
-
```
|
|
7
|
+
**Import Path**: `@umituz/react-native-subscription`
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
**File**: `src/presentation/components/details/DetailRow.tsx`
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
interface DetailRowProps {
|
|
15
|
-
label: string;
|
|
16
|
-
value: string;
|
|
17
|
-
highlight?: boolean;
|
|
18
|
-
style?: ViewStyle;
|
|
19
|
-
labelStyle?: TextStyle;
|
|
20
|
-
valueStyle?: TextStyle;
|
|
21
|
-
}
|
|
22
|
-
```
|
|
11
|
+
**Type**: Component
|
|
23
12
|
|
|
24
|
-
##
|
|
13
|
+
## Strategy
|
|
25
14
|
|
|
26
|
-
|
|
27
|
-
|------|------|---------|-------------|
|
|
28
|
-
| `label` | `string` | **Required** | Row label (left side) |
|
|
29
|
-
| `value` | `string` | **Required** | Row value (right side) |
|
|
30
|
-
| `highlight` | `boolean` | `false` | Highlight value in warning color |
|
|
31
|
-
| `style` | `ViewStyle` | `undefined` | Container style override |
|
|
32
|
-
| `labelStyle` | `TextStyle` | `undefined` | Label text style override |
|
|
33
|
-
| `valueStyle` | `TextStyle` | `undefined` | Value text style override |
|
|
15
|
+
### Label-Value Display
|
|
34
16
|
|
|
35
|
-
|
|
17
|
+
1. **Label Positioning**: Display label on left side
|
|
18
|
+
2. **Value Positioning**: Display value on right side
|
|
19
|
+
3. **Space Distribution**: Even spacing between label and value
|
|
20
|
+
4. **Highlight Option**: Support highlighting values (e.g., expiration warnings)
|
|
21
|
+
5. **Custom Styling**: Allow style overrides for flexibility
|
|
22
|
+
6. **Consistent Layout**: Maintain consistent vertical spacing
|
|
36
23
|
|
|
37
|
-
|
|
38
|
-
function SubscriptionDetails() {
|
|
39
|
-
return (
|
|
40
|
-
<View>
|
|
41
|
-
<DetailRow
|
|
42
|
-
label="Status"
|
|
43
|
-
value="Active"
|
|
44
|
-
/>
|
|
45
|
-
<DetailRow
|
|
46
|
-
label="Expires"
|
|
47
|
-
value="January 15, 2025"
|
|
48
|
-
/>
|
|
49
|
-
<DetailRow
|
|
50
|
-
label="Purchased"
|
|
51
|
-
value="January 15, 2024"
|
|
52
|
-
/>
|
|
53
|
-
</View>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
```
|
|
24
|
+
### Integration Points
|
|
57
25
|
|
|
58
|
-
|
|
26
|
+
- **PremiumDetailsCard**: Uses this component internally
|
|
27
|
+
- **SubscriptionSection**: For subscription detail display
|
|
28
|
+
- **Settings Screens**: For settings detail items
|
|
29
|
+
- **List Components**: For detail lists
|
|
59
30
|
|
|
60
|
-
|
|
31
|
+
## Restrictions
|
|
61
32
|
|
|
62
|
-
|
|
63
|
-
function ExpiringSoonRow() {
|
|
64
|
-
const daysRemaining = 3;
|
|
33
|
+
### REQUIRED
|
|
65
34
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
highlight={daysRemaining <= 7} // Highlight if expiring soon
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
```
|
|
35
|
+
- **Label Prop**: MUST provide valid label string
|
|
36
|
+
- **Value Prop**: MUST provide valid value string
|
|
37
|
+
- **Spacing**: MUST maintain consistent spacing
|
|
38
|
+
- **Null Handling**: MUST handle null or undefined values
|
|
75
39
|
|
|
76
|
-
###
|
|
40
|
+
### PROHIBITED
|
|
77
41
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
label="Subscription Type"
|
|
83
|
-
value="Premium Yearly"
|
|
84
|
-
style={{
|
|
85
|
-
paddingVertical: 12,
|
|
86
|
-
paddingHorizontal: 16,
|
|
87
|
-
backgroundColor: '#F5F5F5',
|
|
88
|
-
}}
|
|
89
|
-
labelStyle={{
|
|
90
|
-
fontWeight: '600',
|
|
91
|
-
color: '#333',
|
|
92
|
-
}}
|
|
93
|
-
valueStyle={{
|
|
94
|
-
fontWeight: '700',
|
|
95
|
-
color: '#4CAF50',
|
|
96
|
-
}}
|
|
97
|
-
/>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
```
|
|
42
|
+
- **NEVER** display without label and value
|
|
43
|
+
- **NEVER** use highlight for non-warning cases
|
|
44
|
+
- **DO NOT** use excessively long labels (affects layout)
|
|
45
|
+
- **DO NOT** mix different data types in same list
|
|
101
46
|
|
|
102
|
-
###
|
|
47
|
+
### CRITICAL SAFETY
|
|
103
48
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
49
|
+
- **ALWAYS** validate label and value props
|
|
50
|
+
- **MUST** handle empty strings
|
|
51
|
+
- **ALWAYS** use highlight sparingly (for warnings only)
|
|
52
|
+
- **NEVER** expose sensitive raw data
|
|
107
53
|
|
|
108
|
-
|
|
109
|
-
<Card>
|
|
110
|
-
<DetailRow
|
|
111
|
-
label="Status"
|
|
112
|
-
value={status.isActive ? 'Active' : 'Inactive'}
|
|
113
|
-
/>
|
|
54
|
+
## AI Agent Guidelines
|
|
114
55
|
|
|
115
|
-
|
|
116
|
-
<DetailRow
|
|
117
|
-
label="Expires"
|
|
118
|
-
value={expirationDate.toLocaleDateString()}
|
|
119
|
-
highlight={!willRenew}
|
|
120
|
-
/>
|
|
121
|
-
)}
|
|
56
|
+
### When Implementing Detail Rows
|
|
122
57
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
```
|
|
58
|
+
1. **Always** provide clear, concise labels
|
|
59
|
+
2. **Always** format values appropriately
|
|
60
|
+
3. **Always** use highlight only for warnings
|
|
61
|
+
4. **Always** keep labels short and consistent
|
|
62
|
+
5. **Never** display implementation details
|
|
131
63
|
|
|
132
|
-
|
|
64
|
+
### Integration Checklist
|
|
133
65
|
|
|
134
|
-
|
|
66
|
+
- [ ] Import from correct path: `@umituz/react-native-subscription`
|
|
67
|
+
- [ ] Provide valid label prop
|
|
68
|
+
- [ ] Provide valid value prop
|
|
69
|
+
- [ ] Format values appropriately
|
|
70
|
+
- [ ] Use highlight for warnings only
|
|
71
|
+
- [ ] Apply custom styling if needed
|
|
72
|
+
- [ ] Test with short values
|
|
73
|
+
- [ ] Test with long values
|
|
74
|
+
- [ ] Test with highlight enabled
|
|
75
|
+
- [ ] Test in list context
|
|
76
|
+
- [ ] Test standalone display
|
|
135
77
|
|
|
136
|
-
|
|
137
|
-
// Label color (left side)
|
|
138
|
-
labelStyle = {
|
|
139
|
-
color: tokens.colors.textSecondary, // Gray
|
|
140
|
-
}
|
|
78
|
+
### Common Patterns
|
|
141
79
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
```
|
|
80
|
+
1. **Subscription Details**: Show subscription info
|
|
81
|
+
2. **Settings Items**: Display settings values
|
|
82
|
+
3. **Status Information**: Show various status types
|
|
83
|
+
4. **Date Display**: Format and show dates
|
|
84
|
+
5. **Compact Lists**: Display multiple details
|
|
148
85
|
|
|
149
|
-
|
|
86
|
+
## Related Documentation
|
|
150
87
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
fontWeight: '500',
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
## Examples
|
|
160
|
-
|
|
161
|
-
### Subscription Info List
|
|
162
|
-
|
|
163
|
-
```typescript
|
|
164
|
-
function SubscriptionInfo() {
|
|
165
|
-
const { status, expirationDate, purchaseDate, isLifetime } = useSubscriptionDetails();
|
|
166
|
-
|
|
167
|
-
return (
|
|
168
|
-
<View style={styles.section}>
|
|
169
|
-
<Text style={styles.title}>Subscription Details</Text>
|
|
170
|
-
|
|
171
|
-
<DetailRow
|
|
172
|
-
label="Plan"
|
|
173
|
-
value={status.productId || 'Free'}
|
|
174
|
-
/>
|
|
175
|
-
|
|
176
|
-
{status.isActive && !isLifetime && (
|
|
177
|
-
<>
|
|
178
|
-
{expirationDate && (
|
|
179
|
-
<DetailRow
|
|
180
|
-
label="Expires"
|
|
181
|
-
value={expirationDate.toLocaleDateString()}
|
|
182
|
-
highlight={true}
|
|
183
|
-
/>
|
|
184
|
-
)}
|
|
185
|
-
|
|
186
|
-
{purchaseDate && (
|
|
187
|
-
<DetailRow
|
|
188
|
-
label="Purchased"
|
|
189
|
-
value={purchaseDate.toLocaleDateString()}
|
|
190
|
-
/>
|
|
191
|
-
)}
|
|
192
|
-
</>
|
|
193
|
-
)}
|
|
194
|
-
|
|
195
|
-
{isLifetime && (
|
|
196
|
-
<DetailRow
|
|
197
|
-
label="Type"
|
|
198
|
-
value="Lifetime Access"
|
|
199
|
-
/>
|
|
200
|
-
)}
|
|
201
|
-
</View>
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### With Icons
|
|
207
|
-
|
|
208
|
-
```typescript
|
|
209
|
-
function IconDetailRow() {
|
|
210
|
-
return (
|
|
211
|
-
<View style={styles.row}>
|
|
212
|
-
<Icon name="calendar" size={20} color="#666" />
|
|
213
|
-
|
|
214
|
-
<DetailRow
|
|
215
|
-
label="Expiration"
|
|
216
|
-
value="December 31, 2025"
|
|
217
|
-
style={{ flex: 1, marginLeft: 8 }}
|
|
218
|
-
/>
|
|
219
|
-
</View>
|
|
220
|
-
);
|
|
221
|
-
}
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### Compact Layout
|
|
225
|
-
|
|
226
|
-
```typescript
|
|
227
|
-
function CompactDetails() {
|
|
228
|
-
return (
|
|
229
|
-
<View>
|
|
230
|
-
<DetailRow
|
|
231
|
-
label="Price"
|
|
232
|
-
value="$9.99/month"
|
|
233
|
-
style={{ paddingVertical: 4 }}
|
|
234
|
-
/>
|
|
235
|
-
<DetailRow
|
|
236
|
-
label="Duration"
|
|
237
|
-
value="Monthly"
|
|
238
|
-
style={{ paddingVertical: 4 }}
|
|
239
|
-
/>
|
|
240
|
-
<DetailRow
|
|
241
|
-
label="Features"
|
|
242
|
-
value="Unlimited access"
|
|
243
|
-
style={{ paddingVertical: 4 }}
|
|
244
|
-
/>
|
|
245
|
-
</View>
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
## Best Practices
|
|
251
|
-
|
|
252
|
-
1. **Use consistent labels** - Keep labels similar across screens
|
|
253
|
-
2. **Format values** - Ensure proper date/currency formatting
|
|
254
|
-
3. **Highlight wisely** - Only highlight important warnings
|
|
255
|
-
4. **Keep concise** - Don't make values too long
|
|
256
|
-
5. **Test layouts** - Verify display with different content lengths
|
|
257
|
-
6. **Localize labels** - Translate labels for i18n
|
|
258
|
-
7. **Match design system** - Use consistent spacing and colors
|
|
259
|
-
|
|
260
|
-
## Styling
|
|
261
|
-
|
|
262
|
-
```typescript
|
|
263
|
-
const styles = StyleSheet.create({
|
|
264
|
-
container: {
|
|
265
|
-
flexDirection: 'row',
|
|
266
|
-
justifyContent: 'space-between',
|
|
267
|
-
alignItems: 'center',
|
|
268
|
-
// Add vertical padding for spacing between rows
|
|
269
|
-
paddingVertical: 8,
|
|
270
|
-
},
|
|
271
|
-
});
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
## Related Components
|
|
275
|
-
|
|
276
|
-
- **PremiumDetailsCard** - Uses this component internally
|
|
277
|
-
- **CreditRow** - Similar component for credit display
|
|
278
|
-
- **SubscriptionSection** - Section containing detail rows
|
|
279
|
-
|
|
280
|
-
## See Also
|
|
281
|
-
|
|
282
|
-
- [Subscription Details](../../hooks/useSubscriptionDetails.md)
|
|
283
|
-
- [Status Display](../../hooks/useSubscriptionStatus.md)
|
|
88
|
+
- **PremiumDetailsCard**: Uses this component
|
|
89
|
+
- **CreditRow**: Similar component for credits
|
|
90
|
+
- **SubscriptionSection**: Section containing detail rows
|
|
91
|
+
- **Details README**: `./README.md`
|
|
@@ -2,265 +2,92 @@
|
|
|
2
2
|
|
|
3
3
|
Premium subscription details card component.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Location
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
import { PremiumDetailsCard } from '@umituz/react-native-subscription';
|
|
9
|
-
```
|
|
7
|
+
**Import Path**: `@umituz/react-native-subscription`
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
**File**: `src/presentation/components/details/PremiumDetailsCard.tsx`
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
interface PremiumDetailsCardProps {
|
|
15
|
-
status: SubscriptionStatus;
|
|
16
|
-
onUpgradePress?: () => void;
|
|
17
|
-
onManagePress?: () => void;
|
|
18
|
-
style?: ViewStyle;
|
|
19
|
-
translations?: PremiumDetailsCardTranslations;
|
|
20
|
-
}
|
|
21
|
-
```
|
|
11
|
+
**Type**: Component
|
|
22
12
|
|
|
23
|
-
##
|
|
13
|
+
## Strategy
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
|----------|------|----------|-------------|
|
|
27
|
-
| `status` | `SubscriptionStatus` | Yes | Subscription status object |
|
|
28
|
-
| `onUpgradePress` | `() => void` | No | Callback when upgrade button pressed |
|
|
29
|
-
| `onManagePress` | `() => void` | No | Callback when manage button pressed |
|
|
30
|
-
| `style` | `ViewStyle` | No | Custom container style |
|
|
31
|
-
| `translations` | `PremiumDetailsCardTranslations` | No | Custom translations |
|
|
15
|
+
### Premium Status Card Display
|
|
32
16
|
|
|
33
|
-
|
|
17
|
+
1. **Status Display**: Show premium status with badge
|
|
18
|
+
2. **Detail Rendering**: Display subscription details (expiration, renewal, etc.)
|
|
19
|
+
3. **Action Buttons**: Show manage or upgrade button based on status
|
|
20
|
+
4. **Translation Support**: Support custom translations
|
|
21
|
+
5. **Visual Hierarchy**: Clear structure with header, details, and actions
|
|
22
|
+
6. **Responsive Design**: Adapt to different screen sizes
|
|
34
23
|
|
|
35
|
-
|
|
36
|
-
function MyScreen() {
|
|
37
|
-
const { subscription } = usePremium();
|
|
24
|
+
### Integration Points
|
|
38
25
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
```
|
|
26
|
+
- **useSubscriptionStatus**: For subscription status data
|
|
27
|
+
- **DetailRow**: For displaying individual details
|
|
28
|
+
- **PremiumStatusBadge**: For status badge
|
|
29
|
+
- **usePremium**: For premium status check
|
|
30
|
+
- **Navigation**: For button actions
|
|
48
31
|
|
|
49
|
-
##
|
|
32
|
+
## Restrictions
|
|
50
33
|
|
|
51
|
-
###
|
|
34
|
+
### REQUIRED
|
|
52
35
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
title: 'Premium',
|
|
58
|
-
active: 'Aktif',
|
|
59
|
-
inactive: 'Aktif Değil',
|
|
60
|
-
expires: 'Son Kullanma',
|
|
61
|
-
renews: 'Yenileniyor',
|
|
62
|
-
manage: 'Yönet',
|
|
63
|
-
upgrade: 'Yükselt',
|
|
64
|
-
lifetime: 'Ömür Boyu',
|
|
65
|
-
}}
|
|
66
|
-
/>
|
|
67
|
-
```
|
|
36
|
+
- **Status Prop**: MUST provide valid subscription status object
|
|
37
|
+
- **Callback Handling**: MUST implement button callbacks
|
|
38
|
+
- **Loading State**: MUST handle loading state
|
|
39
|
+
- **Null Handling**: MUST handle null status values
|
|
68
40
|
|
|
69
|
-
###
|
|
41
|
+
### PROHIBITED
|
|
70
42
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
borderRadius: 16,
|
|
76
|
-
padding: 20,
|
|
77
|
-
},
|
|
78
|
-
title: {
|
|
79
|
-
color: '#fff',
|
|
80
|
-
fontSize: 24,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
43
|
+
- **NEVER** display without status data
|
|
44
|
+
- **NEVER** hardcode status text (use translations)
|
|
45
|
+
- **DO NOT** show both manage and upgrade buttons
|
|
46
|
+
- **DO NOT** expose sensitive implementation details
|
|
83
47
|
|
|
84
|
-
|
|
85
|
-
status={subscription}
|
|
86
|
-
style={customStyles.card}
|
|
87
|
-
titleStyle={customStyles.title}
|
|
88
|
-
/>
|
|
89
|
-
```
|
|
48
|
+
### CRITICAL SAFETY
|
|
90
49
|
|
|
91
|
-
|
|
50
|
+
- **ALWAYS** validate status object
|
|
51
|
+
- **MUST** handle loading state
|
|
52
|
+
- **ALWAYS** provide clear button labels
|
|
53
|
+
- **NEVER** trust client-side status for security
|
|
92
54
|
|
|
93
|
-
|
|
94
|
-
<PremiumDetailsCard
|
|
95
|
-
status={subscription}
|
|
96
|
-
showManageButton={false}
|
|
97
|
-
showUpgradeButton={false}
|
|
98
|
-
/>
|
|
99
|
-
```
|
|
55
|
+
## AI Agent Guidelines
|
|
100
56
|
|
|
101
|
-
|
|
57
|
+
### When Implementing Premium Cards
|
|
102
58
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
renews?: string; // 'Renews on'
|
|
109
|
-
manage?: string; // 'Manage Subscription'
|
|
110
|
-
upgrade?: string; // 'Upgrade to Premium'
|
|
111
|
-
lifetime?: string; // 'Lifetime Access'
|
|
112
|
-
}
|
|
113
|
-
```
|
|
59
|
+
1. **Always** provide valid subscription status
|
|
60
|
+
2. **Always** handle loading state
|
|
61
|
+
3. **Always** implement button callbacks
|
|
62
|
+
4. **Always** use translations for localization
|
|
63
|
+
5. **Never** hardcode status strings
|
|
114
64
|
|
|
115
|
-
|
|
65
|
+
### Integration Checklist
|
|
116
66
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
│ ├── Manage Button (if premium)
|
|
129
|
-
│ └── Upgrade Button (if free)
|
|
130
|
-
```
|
|
67
|
+
- [ ] Import from correct path: `@umituz/react-native-subscription`
|
|
68
|
+
- [ ] Provide valid subscription status
|
|
69
|
+
- [ ] Implement onManagePress callback
|
|
70
|
+
- [ ] Implement onUpgradePress callback
|
|
71
|
+
- [ ] Handle loading state
|
|
72
|
+
- [ ] Handle null dates
|
|
73
|
+
- [ ] Provide translations
|
|
74
|
+
- [ ] Test with active premium
|
|
75
|
+
- [ ] Test with expired subscription
|
|
76
|
+
- [ ] Test with free user
|
|
77
|
+
- [ ] Test with lifetime subscription
|
|
131
78
|
|
|
132
|
-
|
|
79
|
+
### Common Patterns
|
|
133
80
|
|
|
134
|
-
|
|
81
|
+
1. **Profile Display**: Show in user profile
|
|
82
|
+
2. **Settings Card**: Display in settings screen
|
|
83
|
+
3. **Status Overview**: Show premium status overview
|
|
84
|
+
4. **With Navigation**: Navigate to management
|
|
85
|
+
5. **Localized Display**: Use with i18n
|
|
135
86
|
|
|
136
|
-
|
|
137
|
-
const defaultStyles = StyleSheet.create({
|
|
138
|
-
container: {
|
|
139
|
-
backgroundColor: '#fff',
|
|
140
|
-
borderRadius: 12,
|
|
141
|
-
padding: 16,
|
|
142
|
-
margin: 16,
|
|
143
|
-
shadowColor: '#000',
|
|
144
|
-
shadowOffset: { width: 0, height: 2 },
|
|
145
|
-
shadowOpacity: 0.1,
|
|
146
|
-
shadowRadius: 4,
|
|
147
|
-
elevation: 3,
|
|
148
|
-
},
|
|
149
|
-
header: {
|
|
150
|
-
flexDirection: 'row',
|
|
151
|
-
alignItems: 'center',
|
|
152
|
-
marginBottom: 12,
|
|
153
|
-
},
|
|
154
|
-
title: {
|
|
155
|
-
fontSize: 20,
|
|
156
|
-
fontWeight: 'bold',
|
|
157
|
-
color: '#000',
|
|
158
|
-
},
|
|
159
|
-
badge: {
|
|
160
|
-
backgroundColor: '#FFD700',
|
|
161
|
-
paddingHorizontal: 8,
|
|
162
|
-
paddingVertical: 4,
|
|
163
|
-
borderRadius: 12,
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
```
|
|
87
|
+
## Related Documentation
|
|
167
88
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
backgroundColor: '#1a1a1a',
|
|
174
|
-
},
|
|
175
|
-
title: {
|
|
176
|
-
color: '#fff',
|
|
177
|
-
},
|
|
178
|
-
text: {
|
|
179
|
-
color: '#ccc',
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
<PremiumDetailsCard
|
|
184
|
-
status={subscription}
|
|
185
|
-
theme={darkTheme}
|
|
186
|
-
/>
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Accessibility
|
|
190
|
-
|
|
191
|
-
The component includes:
|
|
192
|
-
|
|
193
|
-
- ✅ Accessibility label
|
|
194
|
-
- ✅ Accessibility hint
|
|
195
|
-
- ✅ Screen reader support
|
|
196
|
-
- ✅ Minimum touch target size (44x44)
|
|
197
|
-
|
|
198
|
-
```typescript
|
|
199
|
-
<PremiumDetailsCard
|
|
200
|
-
status={subscription}
|
|
201
|
-
accessibilityLabel="Premium subscription details"
|
|
202
|
-
accessibilityHint="Shows your premium subscription status and options"
|
|
203
|
-
/>
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
## Best Practices
|
|
207
|
-
|
|
208
|
-
1. **Provide callbacks** - Always handle upgrade/manage presses
|
|
209
|
-
2. **Show for premium users** - Display current subscription info
|
|
210
|
-
3. **Show for free users** - Encourage upgrade
|
|
211
|
-
4. **Update on purchase** - Refetch after subscription change
|
|
212
|
-
5. **Handle loading** - Show skeleton while loading
|
|
213
|
-
|
|
214
|
-
## Complete Example
|
|
215
|
-
|
|
216
|
-
```typescript
|
|
217
|
-
function SubscriptionScreen() {
|
|
218
|
-
const { subscription, isLoading, refetch } = usePremium();
|
|
219
|
-
|
|
220
|
-
useFocusEffect(
|
|
221
|
-
useCallback(() => {
|
|
222
|
-
refetch();
|
|
223
|
-
}, [refetch])
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
if (isLoading) {
|
|
227
|
-
return <PremiumDetailsCardSkeleton />;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (!subscription?.isPremium) {
|
|
231
|
-
return (
|
|
232
|
-
<PremiumDetailsCard
|
|
233
|
-
status={{
|
|
234
|
-
type: 'free',
|
|
235
|
-
isActive: false,
|
|
236
|
-
isPremium: false,
|
|
237
|
-
}}
|
|
238
|
-
onUpgradePress={() => navigation.navigate('Paywall')}
|
|
239
|
-
/>
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return (
|
|
244
|
-
<ScrollView>
|
|
245
|
-
<PremiumDetailsCard
|
|
246
|
-
status={subscription}
|
|
247
|
-
onManagePress={handleManageSubscription}
|
|
248
|
-
/>
|
|
249
|
-
|
|
250
|
-
{/* Additional premium features */}
|
|
251
|
-
<PremiumFeaturesList />
|
|
252
|
-
</ScrollView>
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
## Related Components
|
|
258
|
-
|
|
259
|
-
- **PremiumStatusBadge** - Compact premium badge
|
|
260
|
-
- **SubscriptionSection** - Full subscription section
|
|
261
|
-
- **PaywallModal** - Upgrade paywall
|
|
262
|
-
|
|
263
|
-
## See Also
|
|
264
|
-
|
|
265
|
-
- [Details Components README](../details/README.md)
|
|
266
|
-
- [PremiumStatusBadge](./PremiumStatusBadge.md)
|
|
89
|
+
- **PremiumStatusBadge**: Status badge component
|
|
90
|
+
- **DetailRow**: Detail item component
|
|
91
|
+
- **SubscriptionSection**: Subscription section
|
|
92
|
+
- **usePremium**: Premium status hook
|
|
93
|
+
- **Details README**: `./README.md`
|