@umituz/react-native-subscription 2.14.97 → 2.14.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/LICENSE +21 -0
- package/README.md +461 -0
- package/package.json +1 -3
- package/src/application/README.md +229 -0
- package/src/application/ports/README.md +103 -0
- package/src/domain/README.md +402 -0
- package/src/domain/constants/README.md +80 -0
- package/src/domain/entities/README.md +176 -0
- package/src/domain/errors/README.md +307 -0
- package/src/domain/value-objects/README.md +186 -0
- package/src/domains/README.md +240 -0
- package/src/domains/config/README.md +390 -0
- package/src/domains/config/domain/README.md +390 -0
- package/src/domains/config/domain/entities/README.md +350 -0
- package/src/domains/paywall/README.md +371 -0
- package/src/domains/paywall/components/PaywallHeader.tsx +8 -11
- package/src/domains/paywall/components/README.md +185 -0
- package/src/domains/paywall/entities/README.md +199 -0
- package/src/domains/paywall/hooks/README.md +129 -0
- package/src/domains/wallet/README.md +292 -0
- package/src/domains/wallet/domain/README.md +108 -0
- package/src/domains/wallet/domain/entities/README.md +122 -0
- package/src/domains/wallet/domain/errors/README.md +157 -0
- package/src/domains/wallet/infrastructure/README.md +96 -0
- package/src/domains/wallet/presentation/components/BalanceCard.tsx +6 -12
- package/src/domains/wallet/presentation/components/README.md +231 -0
- package/src/domains/wallet/presentation/hooks/README.md +255 -0
- package/src/infrastructure/README.md +514 -0
- package/src/infrastructure/mappers/README.md +34 -0
- package/src/infrastructure/models/README.md +26 -0
- package/src/infrastructure/repositories/README.md +385 -0
- package/src/infrastructure/services/README.md +374 -0
- package/src/presentation/README.md +410 -0
- package/src/presentation/components/README.md +183 -0
- package/src/presentation/components/details/CreditRow.md +337 -0
- package/src/presentation/components/details/DetailRow.md +283 -0
- package/src/presentation/components/details/PremiumDetailsCard.md +266 -0
- package/src/presentation/components/details/PremiumStatusBadge.md +266 -0
- package/src/presentation/components/details/README.md +449 -0
- package/src/presentation/components/feedback/PaywallFeedbackModal.md +314 -0
- package/src/presentation/components/feedback/README.md +447 -0
- package/src/presentation/components/paywall/PaywallModal.md +444 -0
- package/src/presentation/components/paywall/README.md +190 -0
- package/src/presentation/components/sections/README.md +468 -0
- package/src/presentation/components/sections/SubscriptionSection.md +246 -0
- package/src/presentation/hooks/README.md +743 -0
- package/src/presentation/hooks/useAuthAwarePurchase.md +359 -0
- package/src/presentation/hooks/useAuthGate.md +403 -0
- package/src/presentation/hooks/useAuthSubscriptionSync.md +398 -0
- package/src/presentation/hooks/useCreditChecker.md +407 -0
- package/src/presentation/hooks/useCredits.md +342 -0
- package/src/presentation/hooks/useCreditsGate.md +346 -0
- package/src/presentation/hooks/useDeductCredit.md +176 -0
- package/src/presentation/hooks/useDevTestCallbacks.md +422 -0
- package/src/presentation/hooks/useFeatureGate.md +157 -0
- package/src/presentation/hooks/useInitializeCredits.md +458 -0
- package/src/presentation/hooks/usePaywall.md +334 -0
- package/src/presentation/hooks/usePaywallOperations.md +486 -0
- package/src/presentation/hooks/usePaywallVisibility.md +344 -0
- package/src/presentation/hooks/usePremium.md +230 -0
- package/src/presentation/hooks/usePremiumGate.md +423 -0
- package/src/presentation/hooks/usePremiumWithCredits.md +429 -0
- package/src/presentation/hooks/useSubscription.md +450 -0
- package/src/presentation/hooks/useSubscriptionDetails.md +438 -0
- package/src/presentation/hooks/useSubscriptionGate.md +168 -0
- package/src/presentation/hooks/useSubscriptionSettingsConfig.md +374 -0
- package/src/presentation/hooks/useSubscriptionStatus.md +424 -0
- package/src/presentation/hooks/useUserTier.md +356 -0
- package/src/presentation/hooks/useUserTierWithRepository.md +452 -0
- package/src/presentation/screens/README.md +194 -0
- package/src/presentation/types/README.md +38 -0
- package/src/presentation/utils/README.md +52 -0
- package/src/revenuecat/README.md +523 -0
- package/src/revenuecat/application/README.md +158 -0
- package/src/revenuecat/application/ports/README.md +169 -0
- package/src/revenuecat/domain/README.md +147 -0
- package/src/revenuecat/domain/constants/README.md +183 -0
- package/src/revenuecat/domain/entities/README.md +382 -0
- package/src/revenuecat/domain/errors/README.md +197 -0
- package/src/revenuecat/domain/types/README.md +373 -0
- package/src/revenuecat/domain/value-objects/README.md +441 -0
- package/src/revenuecat/infrastructure/README.md +50 -0
- package/src/revenuecat/infrastructure/config/README.md +40 -0
- package/src/revenuecat/infrastructure/handlers/README.md +218 -0
- package/src/revenuecat/infrastructure/managers/README.md +49 -0
- package/src/revenuecat/infrastructure/services/README.md +325 -0
- package/src/revenuecat/infrastructure/utils/README.md +382 -0
- package/src/revenuecat/presentation/README.md +184 -0
- package/src/revenuecat/presentation/hooks/README.md +56 -0
- package/src/utils/README.md +529 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# CreditRow Component
|
|
2
|
+
|
|
3
|
+
Displays credit information with label, count badge, and progress bar.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { CreditRow } from '@umituz/react-native-subscription';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Signature
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
interface CreditRowProps {
|
|
15
|
+
label: string;
|
|
16
|
+
current: number;
|
|
17
|
+
total: number;
|
|
18
|
+
remainingLabel?: string;
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
|------|------|---------|-------------|
|
|
26
|
+
| `label` | `string` | **Required** | Credit type label |
|
|
27
|
+
| `current` | `number` | **Required** | Current credit amount |
|
|
28
|
+
| `total` | `number` | **Required** | Maximum credit amount |
|
|
29
|
+
| `remainingLabel` | `string` | `undefined` | Label for remaining text |
|
|
30
|
+
|
|
31
|
+
## Basic Usage
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
function CreditsDisplay() {
|
|
35
|
+
const { credits } = useCredits();
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<CreditRow
|
|
39
|
+
label="Monthly Credits"
|
|
40
|
+
current={credits}
|
|
41
|
+
total={100}
|
|
42
|
+
remainingLabel="credits remaining"
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Advanced Usage
|
|
49
|
+
|
|
50
|
+
### With Multiple Credit Types
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
function MultipleCredits() {
|
|
54
|
+
const { credits: monthlyCredits } = useCredits();
|
|
55
|
+
const bonusCredits = 50;
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<View>
|
|
59
|
+
<CreditRow
|
|
60
|
+
label="Monthly Credits"
|
|
61
|
+
current={monthlyCredits}
|
|
62
|
+
total={100}
|
|
63
|
+
remainingLabel="credits left"
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<CreditRow
|
|
67
|
+
label="Bonus Credits"
|
|
68
|
+
current={bonusCredits}
|
|
69
|
+
total={50}
|
|
70
|
+
remainingLabel="bonus credits"
|
|
71
|
+
/>
|
|
72
|
+
|
|
73
|
+
<CreditRow
|
|
74
|
+
label="Reward Credits"
|
|
75
|
+
current={25}
|
|
76
|
+
total={100}
|
|
77
|
+
remainingLabel="rewards"
|
|
78
|
+
/>
|
|
79
|
+
</View>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### With Dynamic Updates
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
function LiveCredits() {
|
|
88
|
+
const { credits, refetch } = useCredits();
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const interval = setInterval(() => {
|
|
92
|
+
refetch();
|
|
93
|
+
}, 30000); // Update every 30 seconds
|
|
94
|
+
|
|
95
|
+
return () => clearInterval(interval);
|
|
96
|
+
}, [refetch]);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<CreditRow
|
|
100
|
+
label="Credits"
|
|
101
|
+
current={credits}
|
|
102
|
+
total={100}
|
|
103
|
+
remainingLabel="remaining"
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### With Warning Thresholds
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
function CreditWarning() {
|
|
113
|
+
const { credits } = useCredits();
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<CreditRow
|
|
117
|
+
label="Monthly Credits"
|
|
118
|
+
current={credits}
|
|
119
|
+
total={100}
|
|
120
|
+
remainingLabel={credits < 20 ? '⚠️ Low balance!' : 'credits remaining'}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Complete Credit Dashboard
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
function CreditDashboard() {
|
|
130
|
+
const { credits: monthlyCredits, transactions } = useCredits();
|
|
131
|
+
const { purchasedAt } = useCredits();
|
|
132
|
+
|
|
133
|
+
// Calculate bonus credits from transactions
|
|
134
|
+
const bonusCredits = transactions
|
|
135
|
+
.filter(tx => tx.type === 'bonus')
|
|
136
|
+
.reduce((sum, tx) => sum + tx.amount, 0);
|
|
137
|
+
|
|
138
|
+
// Calculate total usage
|
|
139
|
+
const totalUsed = 100 - monthlyCredits + bonusCredits;
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Card>
|
|
143
|
+
<Text style={styles.title}>Your Credits</Text>
|
|
144
|
+
|
|
145
|
+
<CreditRow
|
|
146
|
+
label="Monthly Credits"
|
|
147
|
+
current={monthlyCredits}
|
|
148
|
+
total={100}
|
|
149
|
+
remainingLabel="credits this month"
|
|
150
|
+
/>
|
|
151
|
+
|
|
152
|
+
<CreditRow
|
|
153
|
+
label="Bonus Credits"
|
|
154
|
+
current={bonusCredits}
|
|
155
|
+
total={50}
|
|
156
|
+
remainingLabel="bonus credits"
|
|
157
|
+
/>
|
|
158
|
+
|
|
159
|
+
<View style={styles.footer}>
|
|
160
|
+
<Text style={styles.info}>
|
|
161
|
+
Resets on {getNextMonthDate(purchasedAt).toLocaleDateString()}
|
|
162
|
+
</Text>
|
|
163
|
+
</View>
|
|
164
|
+
</Card>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Progress Bar Colors
|
|
170
|
+
|
|
171
|
+
The progress bar color changes based on percentage:
|
|
172
|
+
|
|
173
|
+
| Percentage | Color | Visual |
|
|
174
|
+
|------------|-------|--------|
|
|
175
|
+
| 0-20% | Error (red) | ██████░░░░░░░░░░░░░ |
|
|
176
|
+
| 21-50% | Warning (orange) | ████████████░░░░░░ |
|
|
177
|
+
| 51-100% | Success (green) | ████████████████████ |
|
|
178
|
+
|
|
179
|
+
## Examples
|
|
180
|
+
|
|
181
|
+
### In Subscription Settings
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
function SubscriptionCredits() {
|
|
185
|
+
const { credits, isLoading } = useCredits();
|
|
186
|
+
|
|
187
|
+
if (isLoading) return <LoadingSkeleton />;
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<View style={styles.section}>
|
|
191
|
+
<Text style={styles.sectionTitle}>Credits</Text>
|
|
192
|
+
|
|
193
|
+
<CreditRow
|
|
194
|
+
label="Monthly Allowance"
|
|
195
|
+
current={credits}
|
|
196
|
+
total={100}
|
|
197
|
+
remainingLabel="credits"
|
|
198
|
+
/>
|
|
199
|
+
</View>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### With Purchase Link
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
function CreditWithPurchase() {
|
|
208
|
+
const { credits } = useCredits();
|
|
209
|
+
|
|
210
|
+
const isLow = credits < 20;
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<View>
|
|
214
|
+
<CreditRow
|
|
215
|
+
label="Credits"
|
|
216
|
+
current={credits}
|
|
217
|
+
total={100}
|
|
218
|
+
remainingLabel="remaining"
|
|
219
|
+
/>
|
|
220
|
+
|
|
221
|
+
{isLow && (
|
|
222
|
+
<Button
|
|
223
|
+
onPress={() => navigation.navigate('CreditPackages')}
|
|
224
|
+
title="Get More Credits"
|
|
225
|
+
style={styles.purchaseButton}
|
|
226
|
+
/>
|
|
227
|
+
)}
|
|
228
|
+
</View>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### With Feature Costs
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
function FeatureCostDisplay() {
|
|
237
|
+
const { credits } = useCredits();
|
|
238
|
+
|
|
239
|
+
const features = [
|
|
240
|
+
{ name: 'AI Generation', cost: 5 },
|
|
241
|
+
{ name: 'Advanced Export', cost: 3 },
|
|
242
|
+
{ name: 'Cloud Sync', cost: 1 },
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<View>
|
|
247
|
+
<CreditRow
|
|
248
|
+
label="Available Credits"
|
|
249
|
+
current={credits}
|
|
250
|
+
total={100}
|
|
251
|
+
remainingLabel="credits"
|
|
252
|
+
/>
|
|
253
|
+
|
|
254
|
+
<View style={styles.divider} />
|
|
255
|
+
|
|
256
|
+
{features.map((feature) => (
|
|
257
|
+
<DetailRow
|
|
258
|
+
key={feature.name}
|
|
259
|
+
label={feature.name}
|
|
260
|
+
value={`${feature.cost} credits`}
|
|
261
|
+
/>
|
|
262
|
+
))}
|
|
263
|
+
</View>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Component Layout
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
┌─────────────────────────────────────┐
|
|
272
|
+
│ Monthly Credits [50/100] │
|
|
273
|
+
│ ████████████░░░░░░░░░░░░░░░░ │
|
|
274
|
+
│ 50 credits remaining │
|
|
275
|
+
└─────────────────────────────────────┘
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Styling
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
const styles = StyleSheet.create({
|
|
282
|
+
container: {
|
|
283
|
+
gap: 8,
|
|
284
|
+
marginVertical: 4,
|
|
285
|
+
},
|
|
286
|
+
header: {
|
|
287
|
+
flexDirection: 'row',
|
|
288
|
+
justifyContent: 'space-between',
|
|
289
|
+
alignItems: 'center',
|
|
290
|
+
},
|
|
291
|
+
label: {
|
|
292
|
+
fontWeight: '500',
|
|
293
|
+
},
|
|
294
|
+
badge: {
|
|
295
|
+
paddingHorizontal: 8,
|
|
296
|
+
paddingVertical: 2,
|
|
297
|
+
borderRadius: 6,
|
|
298
|
+
backgroundColor: tokens.colors.surfaceSecondary,
|
|
299
|
+
},
|
|
300
|
+
count: {
|
|
301
|
+
fontWeight: '600',
|
|
302
|
+
},
|
|
303
|
+
progressBar: {
|
|
304
|
+
height: 8,
|
|
305
|
+
borderRadius: 4,
|
|
306
|
+
overflow: 'hidden',
|
|
307
|
+
backgroundColor: tokens.colors.surfaceSecondary,
|
|
308
|
+
},
|
|
309
|
+
progressFill: {
|
|
310
|
+
height: '100%',
|
|
311
|
+
borderRadius: 4,
|
|
312
|
+
backgroundColor: progressColor, // Dynamic based on percentage
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Best Practices
|
|
318
|
+
|
|
319
|
+
1. **Show total always** - Display max credits for context
|
|
320
|
+
2. **Update regularly** - Keep credits current
|
|
321
|
+
3. **Color code thresholds** - Use colors for low/high amounts
|
|
322
|
+
4. **Provide context** - Explain credit reset周期
|
|
323
|
+
5. **Link to purchase** - Add purchase option when low
|
|
324
|
+
6. **Test edge cases** - Zero credits, max credits, negative values
|
|
325
|
+
7. **Format numbers** - Use appropriate number formatting
|
|
326
|
+
|
|
327
|
+
## Related Components
|
|
328
|
+
|
|
329
|
+
- **PremiumDetailsCard** - Contains credit rows
|
|
330
|
+
- **DetailRow** - Simple label-value row
|
|
331
|
+
- **SubscriptionSection** - Section with credits
|
|
332
|
+
|
|
333
|
+
## See Also
|
|
334
|
+
|
|
335
|
+
- [useCredits](../../hooks/useCredits.md)
|
|
336
|
+
- [Credits Entity](../../../domains/wallet/domain/entities/Credits.md)
|
|
337
|
+
- [Credits README](../../../../domains/wallet/README.md)
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# DetailRow Component
|
|
2
|
+
|
|
3
|
+
Simple row component displaying a label-value pair for subscription details.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { DetailRow } from '@umituz/react-native-subscription';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Signature
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
interface DetailRowProps {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
highlight?: boolean;
|
|
18
|
+
style?: ViewStyle;
|
|
19
|
+
labelStyle?: TextStyle;
|
|
20
|
+
valueStyle?: TextStyle;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Props
|
|
25
|
+
|
|
26
|
+
| Prop | Type | Default | Description |
|
|
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 |
|
|
34
|
+
|
|
35
|
+
## Basic Usage
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
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
|
+
```
|
|
57
|
+
|
|
58
|
+
## Advanced Usage
|
|
59
|
+
|
|
60
|
+
### With Highlight
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
function ExpiringSoonRow() {
|
|
64
|
+
const daysRemaining = 3;
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<DetailRow
|
|
68
|
+
label="Expires"
|
|
69
|
+
value={expirationDate.toLocaleDateString()}
|
|
70
|
+
highlight={daysRemaining <= 7} // Highlight if expiring soon
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### With Custom Styling
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
function CustomDetailRow() {
|
|
80
|
+
return (
|
|
81
|
+
<DetailRow
|
|
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
|
+
```
|
|
101
|
+
|
|
102
|
+
### In Subscription Card
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
function SubscriptionCard() {
|
|
106
|
+
const { status, expirationDate, willRenew } = useSubscriptionStatus();
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Card>
|
|
110
|
+
<DetailRow
|
|
111
|
+
label="Status"
|
|
112
|
+
value={status.isActive ? 'Active' : 'Inactive'}
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
{expirationDate && (
|
|
116
|
+
<DetailRow
|
|
117
|
+
label="Expires"
|
|
118
|
+
value={expirationDate.toLocaleDateString()}
|
|
119
|
+
highlight={!willRenew}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
<DetailRow
|
|
124
|
+
label="Auto-renew"
|
|
125
|
+
value={willRenew ? 'Enabled' : 'Disabled'}
|
|
126
|
+
/>
|
|
127
|
+
</Card>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Color Options
|
|
133
|
+
|
|
134
|
+
### Default Colors
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
// Label color (left side)
|
|
138
|
+
labelStyle = {
|
|
139
|
+
color: tokens.colors.textSecondary, // Gray
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Value color (right side)
|
|
143
|
+
valueStyle = {
|
|
144
|
+
color: tokens.colors.textPrimary, // Black
|
|
145
|
+
fontWeight: '500',
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Highlight Colors
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
// When highlight={true}
|
|
153
|
+
valueStyle = {
|
|
154
|
+
color: tokens.colors.warning, // Orange/Yellow
|
|
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)
|