@umituz/react-native-subscription 2.14.96 → 2.14.98
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 +462 -0
- package/package.json +3 -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/config/README.md +390 -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 +160 -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/domain/README.md +147 -0
- package/src/revenuecat/domain/errors/README.md +197 -0
- package/src/revenuecat/infrastructure/config/README.md +40 -0
- package/src/revenuecat/infrastructure/managers/README.md +49 -0
- package/src/revenuecat/presentation/hooks/README.md +56 -0
- package/src/revenuecat/presentation/hooks/usePurchasePackage.ts +1 -1
- package/src/utils/README.md +529 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
# Details Components
|
|
2
|
+
|
|
3
|
+
Abonelik ve premium detaylarını göstermek için UI bileşenleri.
|
|
4
|
+
|
|
5
|
+
## Bileşenler
|
|
6
|
+
|
|
7
|
+
- [PremiumDetailsCard](#premiumdetailscard) - Premium detay kartı
|
|
8
|
+
- [PremiumStatusBadge](#premiumstatusbadge) - Durum badge'i
|
|
9
|
+
- [DetailRow](#detailrow) - Detay satırı
|
|
10
|
+
- [CreditRow](#creditrow) - Kredi satırı
|
|
11
|
+
|
|
12
|
+
## PremiumDetailsCard
|
|
13
|
+
|
|
14
|
+
Premium abonelik detaylarını gösteren kart bileşeni.
|
|
15
|
+
|
|
16
|
+
### Kullanım
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { PremiumDetailsCard } from '@umituz/react-native-subscription';
|
|
20
|
+
|
|
21
|
+
<PremiumDetailsCard
|
|
22
|
+
status={{
|
|
23
|
+
type: 'premium',
|
|
24
|
+
isActive: true,
|
|
25
|
+
isPremium: true,
|
|
26
|
+
expirationDate: '2025-12-31T23:59:59Z',
|
|
27
|
+
willRenew: true,
|
|
28
|
+
productId: 'com.app.premium.annual',
|
|
29
|
+
}}
|
|
30
|
+
onUpgradePress={() => console.log('Upgrade pressed')}
|
|
31
|
+
onManagePress={() => console.log('Manage pressed')}
|
|
32
|
+
translations={{
|
|
33
|
+
title: 'Premium',
|
|
34
|
+
status: 'Active',
|
|
35
|
+
expires: 'Expires on',
|
|
36
|
+
renews: 'Renews on',
|
|
37
|
+
manage: 'Manage Subscription',
|
|
38
|
+
upgrade: 'Upgrade to Premium',
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Props
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
interface PremiumDetailsCardProps {
|
|
47
|
+
status: SubscriptionStatus;
|
|
48
|
+
onUpgradePress?: () => void;
|
|
49
|
+
onManagePress?: () => void;
|
|
50
|
+
style?: ViewStyle;
|
|
51
|
+
translations?: PremiumDetailsCardTranslations;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Özellikler
|
|
56
|
+
|
|
57
|
+
- Abonelik durumunu gösterir (Active, Expired, vb.)
|
|
58
|
+
- Son kullanma tarihini görüntüler
|
|
59
|
+
- Yenileme durumunu gösterir
|
|
60
|
+
- Upgrade ve Manage butonları
|
|
61
|
+
- Özelleştirilebilir çeviri desteği
|
|
62
|
+
|
|
63
|
+
## PremiumStatusBadge
|
|
64
|
+
|
|
65
|
+
Kullanıcının premium durumunu gösteren badge bileşeni.
|
|
66
|
+
|
|
67
|
+
### Kullanım
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { PremiumStatusBadge } from '@umituz/react-native-subscription';
|
|
71
|
+
|
|
72
|
+
<PremiumStatusBadge
|
|
73
|
+
status="premium"
|
|
74
|
+
size="medium"
|
|
75
|
+
showIcon={true}
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<PremiumStatusBadge
|
|
79
|
+
status="free"
|
|
80
|
+
size="small"
|
|
81
|
+
showIcon={false}
|
|
82
|
+
/>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Props
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
interface PremiumStatusBadgeProps {
|
|
89
|
+
status: SubscriptionStatusType;
|
|
90
|
+
size?: 'small' | 'medium' | 'large';
|
|
91
|
+
showIcon?: boolean;
|
|
92
|
+
style?: ViewStyle;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Özellikler
|
|
97
|
+
|
|
98
|
+
- Farklı boyut seçenekleri
|
|
99
|
+
- İkon gösterimi/hiding
|
|
100
|
+
- Durum bazlı renkler
|
|
101
|
+
- Responsive tasarım
|
|
102
|
+
|
|
103
|
+
## DetailRow
|
|
104
|
+
|
|
105
|
+
Detay gösterimi için satır bileşeni.
|
|
106
|
+
|
|
107
|
+
### Kullanım
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { DetailRow } from '@umituz/react-native-subscription';
|
|
111
|
+
|
|
112
|
+
<DetailRow
|
|
113
|
+
label="Subscription Type"
|
|
114
|
+
value="Annual Premium"
|
|
115
|
+
/>
|
|
116
|
+
|
|
117
|
+
<DetailRow
|
|
118
|
+
label="Price"
|
|
119
|
+
value="$79.99/year"
|
|
120
|
+
/>
|
|
121
|
+
|
|
122
|
+
<DetailRow
|
|
123
|
+
label="Status"
|
|
124
|
+
value="Active"
|
|
125
|
+
valueColor="green"
|
|
126
|
+
/>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Props
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
interface DetailRowProps {
|
|
133
|
+
label: string;
|
|
134
|
+
value: string;
|
|
135
|
+
valueColor?: string;
|
|
136
|
+
style?: ViewStyle;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## CreditRow
|
|
141
|
+
|
|
142
|
+
Kredi bakiyesi gösterimi için satır bileşeni.
|
|
143
|
+
|
|
144
|
+
### Kullanım
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
import { CreditRow } from '@umituz/react-native-subscription';
|
|
148
|
+
|
|
149
|
+
<CreditRow
|
|
150
|
+
credits={150}
|
|
151
|
+
currency="USD"
|
|
152
|
+
showBalance={true}
|
|
153
|
+
/>
|
|
154
|
+
|
|
155
|
+
<CreditRow
|
|
156
|
+
credits={50}
|
|
157
|
+
currency="USD"
|
|
158
|
+
showBalance={false}
|
|
159
|
+
translations={{
|
|
160
|
+
credits: 'Credits',
|
|
161
|
+
balance: 'Balance',
|
|
162
|
+
}}
|
|
163
|
+
/>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Props
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
interface CreditRowProps {
|
|
170
|
+
credits: number;
|
|
171
|
+
currency?: string;
|
|
172
|
+
showBalance?: boolean;
|
|
173
|
+
translations?: {
|
|
174
|
+
credits?: string;
|
|
175
|
+
balance?: string;
|
|
176
|
+
};
|
|
177
|
+
style?: ViewStyle;
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Birlikte Kullanım
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
import React from 'react';
|
|
185
|
+
import { View, ScrollView } from 'react-native';
|
|
186
|
+
import {
|
|
187
|
+
PremiumDetailsCard,
|
|
188
|
+
PremiumStatusBadge,
|
|
189
|
+
DetailRow,
|
|
190
|
+
CreditRow,
|
|
191
|
+
} from '@umituz/react-native-subscription';
|
|
192
|
+
|
|
193
|
+
function SubscriptionDetailsScreen() {
|
|
194
|
+
const { subscription, credits } = useSubscription();
|
|
195
|
+
|
|
196
|
+
return (
|
|
197
|
+
<ScrollView>
|
|
198
|
+
{/* Durum Badge */}
|
|
199
|
+
<View style={styles.header}>
|
|
200
|
+
<PremiumStatusBadge
|
|
201
|
+
status={subscription?.type}
|
|
202
|
+
size="large"
|
|
203
|
+
showIcon={true}
|
|
204
|
+
/>
|
|
205
|
+
</View>
|
|
206
|
+
|
|
207
|
+
{/* Detay Kartı */}
|
|
208
|
+
<PremiumDetailsCard
|
|
209
|
+
status={subscription}
|
|
210
|
+
onManagePress={handleManage}
|
|
211
|
+
/>
|
|
212
|
+
|
|
213
|
+
{/* Ek Detaylar */}
|
|
214
|
+
<View style={styles.section}>
|
|
215
|
+
<DetailRow label="Plan" value="Annual Premium" />
|
|
216
|
+
<DetailRow label="Price" value="$79.99/year" />
|
|
217
|
+
<DetailRow
|
|
218
|
+
label="Status"
|
|
219
|
+
value={subscription?.isActive ? 'Active' : 'Inactive'}
|
|
220
|
+
valueColor={subscription?.isActive ? 'green' : 'red'}
|
|
221
|
+
/>
|
|
222
|
+
</View>
|
|
223
|
+
|
|
224
|
+
{/* Kredi Bakiyesi */}
|
|
225
|
+
<View style={styles.section}>
|
|
226
|
+
<CreditRow
|
|
227
|
+
credits={credits}
|
|
228
|
+
currency="USD"
|
|
229
|
+
showBalance={true}
|
|
230
|
+
/>
|
|
231
|
+
</View>
|
|
232
|
+
</ScrollView>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const styles = StyleSheet.create({
|
|
237
|
+
header: {
|
|
238
|
+
padding: 16,
|
|
239
|
+
alignItems: 'center',
|
|
240
|
+
},
|
|
241
|
+
section: {
|
|
242
|
+
padding: 16,
|
|
243
|
+
backgroundColor: '#fff',
|
|
244
|
+
marginVertical: 8,
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Styling
|
|
250
|
+
|
|
251
|
+
Bileşen stilleri özelleştirilebilir:
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { premiumDetailsCardStyles } from '@umituz/react-native-subscription';
|
|
255
|
+
|
|
256
|
+
// Kendi stilınızı kullanın
|
|
257
|
+
const customStyles = StyleSheet.create({
|
|
258
|
+
container: {
|
|
259
|
+
backgroundColor: 'custom-background',
|
|
260
|
+
borderRadius: 16,
|
|
261
|
+
padding: 20,
|
|
262
|
+
shadowColor: '#000',
|
|
263
|
+
shadowOffset: { width: 0, height: 2 },
|
|
264
|
+
shadowOpacity: 0.25,
|
|
265
|
+
shadowRadius: 3.84,
|
|
266
|
+
elevation: 5,
|
|
267
|
+
},
|
|
268
|
+
title: {
|
|
269
|
+
fontSize: 24,
|
|
270
|
+
fontWeight: 'bold',
|
|
271
|
+
color: '#FF6B6B',
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
<PremiumDetailsCard
|
|
276
|
+
style={customStyles.container}
|
|
277
|
+
status={status}
|
|
278
|
+
/>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Translations
|
|
282
|
+
|
|
283
|
+
Tüm bileşenler çeviri desteği sunar:
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
const translations = {
|
|
287
|
+
// PremiumDetailsCard
|
|
288
|
+
title: 'Premium',
|
|
289
|
+
active: 'Active',
|
|
290
|
+
inactive: 'Inactive',
|
|
291
|
+
expires: 'Expires on',
|
|
292
|
+
renews: 'Renews on',
|
|
293
|
+
manage: 'Manage Subscription',
|
|
294
|
+
upgrade: 'Upgrade to Premium',
|
|
295
|
+
lifetime: 'Lifetime Access',
|
|
296
|
+
|
|
297
|
+
// PremiumStatusBadge
|
|
298
|
+
guest: 'Guest',
|
|
299
|
+
free: 'Free',
|
|
300
|
+
premium: 'Premium',
|
|
301
|
+
|
|
302
|
+
// DetailRow & CreditRow
|
|
303
|
+
credits: 'Credits',
|
|
304
|
+
balance: 'Balance',
|
|
305
|
+
plan: 'Plan',
|
|
306
|
+
status: 'Status',
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
<PremiumDetailsCard
|
|
310
|
+
translations={translations}
|
|
311
|
+
status={status}
|
|
312
|
+
/>
|
|
313
|
+
|
|
314
|
+
<PremiumStatusBadge
|
|
315
|
+
status="premium"
|
|
316
|
+
translations={translations}
|
|
317
|
+
/>
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## Best Practices
|
|
321
|
+
|
|
322
|
+
1. **Consistent Styling**: Tüm detay bileşenlerinde tutarlı stil kullanın
|
|
323
|
+
2. **Loading States**: Veri yüklenirken loading gösterin
|
|
324
|
+
3. **Error States**: Hata durumlarını kullanıcı dostu gösterin
|
|
325
|
+
4. **Accessibility**: Accessibility özelliklerini ekleyin
|
|
326
|
+
5. **Responsive**: Farklı ekran boyutlarında test edin
|
|
327
|
+
6. **Performance**: Gereksiz re-render'lardan kaçının
|
|
328
|
+
7. **Translations**: Her zaman çeviri desteği sağlayın
|
|
329
|
+
|
|
330
|
+
## Örnek Implementasyon
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
import React, { useState } from 'react';
|
|
334
|
+
import {
|
|
335
|
+
View,
|
|
336
|
+
StyleSheet,
|
|
337
|
+
ActivityIndicator,
|
|
338
|
+
RefreshControl,
|
|
339
|
+
} from 'react-native';
|
|
340
|
+
import {
|
|
341
|
+
PremiumDetailsCard,
|
|
342
|
+
PremiumStatusBadge,
|
|
343
|
+
DetailRow,
|
|
344
|
+
CreditRow,
|
|
345
|
+
useSubscription,
|
|
346
|
+
useCredits,
|
|
347
|
+
} from '@umituz/react-native-subscription';
|
|
348
|
+
|
|
349
|
+
export default function MySubscriptionScreen() {
|
|
350
|
+
const { subscription, isLoading, refetch } = useSubscription();
|
|
351
|
+
const { credits } = useCredits();
|
|
352
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
353
|
+
|
|
354
|
+
const handleRefresh = async () => {
|
|
355
|
+
setRefreshing(true);
|
|
356
|
+
await refetch();
|
|
357
|
+
setRefreshing(false);
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
if (isLoading) {
|
|
361
|
+
return (
|
|
362
|
+
<View style={styles.centered}>
|
|
363
|
+
<ActivityIndicator size="large" />
|
|
364
|
+
</View>
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
return (
|
|
369
|
+
<ScrollView
|
|
370
|
+
style={styles.container}
|
|
371
|
+
refreshControl={
|
|
372
|
+
<RefreshControl refreshing={refreshing} onRefresh={handleRefresh} />
|
|
373
|
+
}
|
|
374
|
+
>
|
|
375
|
+
{/* Header */}
|
|
376
|
+
<View style={styles.header}>
|
|
377
|
+
<PremiumStatusBadge
|
|
378
|
+
status={subscription?.type || 'guest'}
|
|
379
|
+
size="large"
|
|
380
|
+
showIcon={true}
|
|
381
|
+
/>
|
|
382
|
+
</View>
|
|
383
|
+
|
|
384
|
+
{/* Premium Details */}
|
|
385
|
+
<PremiumDetailsCard
|
|
386
|
+
status={subscription}
|
|
387
|
+
onManagePress={() => console.log('Manage')}
|
|
388
|
+
onUpgradePress={() => console.log('Upgrade')}
|
|
389
|
+
style={styles.card}
|
|
390
|
+
/>
|
|
391
|
+
|
|
392
|
+
{/* Additional Details */}
|
|
393
|
+
<View style={styles.section}>
|
|
394
|
+
<DetailRow
|
|
395
|
+
label="Plan"
|
|
396
|
+
value={subscription?.productId || 'Free Plan'}
|
|
397
|
+
/>
|
|
398
|
+
<DetailRow
|
|
399
|
+
label="Status"
|
|
400
|
+
value={subscription?.isActive ? 'Active' : 'Inactive'}
|
|
401
|
+
valueColor={subscription?.isActive ? '#4CAF50' : '#F44336'}
|
|
402
|
+
/>
|
|
403
|
+
{subscription?.expirationDate && (
|
|
404
|
+
<DetailRow
|
|
405
|
+
label="Expires"
|
|
406
|
+
value={new Date(subscription.expirationDate).toLocaleDateString()}
|
|
407
|
+
/>
|
|
408
|
+
)}
|
|
409
|
+
</View>
|
|
410
|
+
|
|
411
|
+
{/* Credits */}
|
|
412
|
+
<View style={styles.section}>
|
|
413
|
+
<CreditRow
|
|
414
|
+
credits={credits}
|
|
415
|
+
currency="USD"
|
|
416
|
+
showBalance={true}
|
|
417
|
+
/>
|
|
418
|
+
</View>
|
|
419
|
+
</ScrollView>
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const styles = StyleSheet.create({
|
|
424
|
+
container: {
|
|
425
|
+
flex: 1,
|
|
426
|
+
backgroundColor: '#F5F5F5',
|
|
427
|
+
},
|
|
428
|
+
centered: {
|
|
429
|
+
flex: 1,
|
|
430
|
+
justifyContent: 'center',
|
|
431
|
+
alignItems: 'center',
|
|
432
|
+
},
|
|
433
|
+
header: {
|
|
434
|
+
padding: 20,
|
|
435
|
+
alignItems: 'center',
|
|
436
|
+
backgroundColor: '#fff',
|
|
437
|
+
},
|
|
438
|
+
card: {
|
|
439
|
+
margin: 16,
|
|
440
|
+
},
|
|
441
|
+
section: {
|
|
442
|
+
backgroundColor: '#fff',
|
|
443
|
+
padding: 16,
|
|
444
|
+
marginHorizontal: 16,
|
|
445
|
+
marginBottom: 16,
|
|
446
|
+
borderRadius: 12,
|
|
447
|
+
},
|
|
448
|
+
});
|
|
449
|
+
```
|