@umituz/react-native-subscription 2.14.99 → 2.14.101

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.
Files changed (98) hide show
  1. package/README.md +211 -394
  2. package/package.json +3 -3
  3. package/src/application/README.md +46 -225
  4. package/src/application/ports/README.md +42 -97
  5. package/src/domain/README.md +36 -384
  6. package/src/domain/constants/README.md +0 -56
  7. package/src/domain/entities/README.md +43 -169
  8. package/src/domain/entities/SubscriptionStatus.ts +1 -1
  9. package/src/domain/errors/README.md +33 -287
  10. package/src/domain/value-objects/README.md +43 -179
  11. package/src/domains/README.md +50 -238
  12. package/src/domains/README.md.bak +274 -0
  13. package/src/domains/config/README.md +93 -383
  14. package/src/domains/config/domain/README.md +23 -376
  15. package/src/domains/config/domain/entities/README.md +34 -343
  16. package/src/domains/paywall/README.md +99 -369
  17. package/src/domains/paywall/components/README.md +34 -178
  18. package/src/domains/paywall/entities/README.md +34 -193
  19. package/src/domains/paywall/hooks/README.md +34 -122
  20. package/src/domains/wallet/README.md +34 -275
  21. package/src/domains/wallet/README.md.bak +209 -0
  22. package/src/domains/wallet/domain/README.md +34 -101
  23. package/src/domains/wallet/domain/entities/README.md +34 -115
  24. package/src/domains/wallet/domain/errors/README.md +34 -151
  25. package/src/domains/wallet/infrastructure/README.md +34 -89
  26. package/src/domains/wallet/presentation/components/README.md +34 -224
  27. package/src/domains/wallet/presentation/components/TransactionItem.tsx +1 -1
  28. package/src/domains/wallet/presentation/hooks/README.md +34 -248
  29. package/src/infrastructure/README.md +37 -496
  30. package/src/infrastructure/mappers/README.md +0 -13
  31. package/src/infrastructure/repositories/README.md +74 -360
  32. package/src/infrastructure/services/ActivationHandler.ts +1 -1
  33. package/src/infrastructure/services/README.md +95 -370
  34. package/src/infrastructure/services/SubscriptionService.ts +1 -1
  35. package/src/presentation/README.md +123 -408
  36. package/src/presentation/README.md.bak +172 -0
  37. package/src/presentation/components/README.md +151 -179
  38. package/src/presentation/components/README.md.bak +217 -0
  39. package/src/presentation/components/details/CreditRow.md +65 -310
  40. package/src/presentation/components/details/DetailRow.md +63 -255
  41. package/src/presentation/components/details/PremiumDetailsCard.md +65 -238
  42. package/src/presentation/components/details/PremiumStatusBadge.md +64 -239
  43. package/src/presentation/components/details/README.md +97 -447
  44. package/src/presentation/components/feedback/PaywallFeedbackModal.md +63 -287
  45. package/src/presentation/components/feedback/README.md +97 -445
  46. package/src/presentation/components/paywall/PaywallModal.md +66 -416
  47. package/src/presentation/components/paywall/README.md +50 -186
  48. package/src/presentation/components/sections/README.md +97 -466
  49. package/src/presentation/components/sections/SubscriptionSection.md +92 -244
  50. package/src/presentation/hooks/README.md +154 -741
  51. package/src/presentation/hooks/useAuthAwarePurchase.md +58 -325
  52. package/src/presentation/hooks/useAuthGate.md +61 -375
  53. package/src/presentation/hooks/useAuthSubscriptionSync.md +66 -370
  54. package/src/presentation/hooks/useCreditChecker.md +73 -378
  55. package/src/presentation/hooks/useCredits.md +74 -313
  56. package/src/presentation/hooks/useCredits.md.bak +231 -0
  57. package/src/presentation/hooks/useCreditsGate.md +66 -318
  58. package/src/presentation/hooks/useDeductCredit.md +0 -76
  59. package/src/presentation/hooks/useDeductCredit.ts +1 -1
  60. package/src/presentation/hooks/useDevTestCallbacks.md +63 -394
  61. package/src/presentation/hooks/useFeatureGate.md +105 -150
  62. package/src/presentation/hooks/useFeatureGate.md.bak +284 -0
  63. package/src/presentation/hooks/useInitializeCredits.md +64 -430
  64. package/src/presentation/hooks/usePaywall.md +61 -306
  65. package/src/presentation/hooks/usePaywallOperations.md +64 -458
  66. package/src/presentation/hooks/usePaywallVisibility.md +67 -316
  67. package/src/presentation/hooks/usePremium.md +84 -226
  68. package/src/presentation/hooks/usePremiumGate.md +60 -395
  69. package/src/presentation/hooks/usePremiumWithCredits.md +64 -401
  70. package/src/presentation/hooks/useSubscription.md +66 -422
  71. package/src/presentation/hooks/useSubscriptionDetails.md +65 -410
  72. package/src/presentation/hooks/useSubscriptionGate.md +80 -164
  73. package/src/presentation/hooks/useSubscriptionSettingsConfig.md +66 -346
  74. package/src/presentation/hooks/useSubscriptionStatus.md +66 -396
  75. package/src/presentation/hooks/useUserTier.md +63 -328
  76. package/src/presentation/hooks/useUserTierWithRepository.md +64 -424
  77. package/src/presentation/screens/README.md +48 -190
  78. package/src/presentation/types/README.md +0 -16
  79. package/src/presentation/utils/README.md +0 -21
  80. package/src/presentation/utils/subscriptionDateUtils.ts +1 -1
  81. package/src/revenuecat/README.md +99 -518
  82. package/src/revenuecat/application/README.md +35 -150
  83. package/src/revenuecat/application/ports/README.md +34 -162
  84. package/src/revenuecat/domain/README.md +42 -141
  85. package/src/revenuecat/domain/constants/README.md +34 -176
  86. package/src/revenuecat/domain/entities/README.md +34 -374
  87. package/src/revenuecat/domain/errors/README.md +47 -191
  88. package/src/revenuecat/domain/types/README.md +34 -366
  89. package/src/revenuecat/domain/value-objects/README.md +34 -434
  90. package/src/revenuecat/infrastructure/README.md +34 -43
  91. package/src/revenuecat/infrastructure/config/README.md +32 -23
  92. package/src/revenuecat/infrastructure/handlers/README.md +34 -211
  93. package/src/revenuecat/infrastructure/managers/README.md +34 -42
  94. package/src/revenuecat/infrastructure/services/README.md +35 -318
  95. package/src/revenuecat/infrastructure/utils/README.md +34 -375
  96. package/src/revenuecat/presentation/README.md +34 -176
  97. package/src/revenuecat/presentation/hooks/README.md +29 -35
  98. package/src/utils/README.md +38 -525
@@ -1,468 +1,99 @@
1
1
  # Sections Components
2
2
 
3
- Abonelik ile ilgili section ve kart bileşenleri.
4
-
5
- ## Bileşenler
6
-
7
- - [SubscriptionSection](#subscriptionsection) - Abonelik bölümü
8
-
9
- ## SubscriptionSection
10
-
11
- Abonelik durumunu gösteren ve yönetim işlemlerini sağlayan section bileşeni.
12
-
13
- ### Kullanım
14
-
15
- ```typescript
16
- import { SubscriptionSection } from '@umituz/react-native-subscription';
17
-
18
- <SubscriptionSection
19
- title="Subscription"
20
- subscription={{
21
- type: 'premium',
22
- isActive: true,
23
- expirationDate: '2025-12-31T23:59:59Z',
24
- productId: 'com.app.premium.annual',
25
- }}
26
- onPress={() => navigation.navigate('SubscriptionDetail')}
27
- translations={{
28
- title: 'Subscription',
29
- status: 'Active',
30
- manage: 'Manage Subscription',
31
- upgrade: 'Upgrade to Premium',
32
- expires: 'Expires on',
33
- }}
34
- />
35
- ```
36
-
37
- ### Props
38
-
39
- ```typescript
40
- interface SubscriptionSectionProps {
41
- title?: string;
42
- subscription: SubscriptionStatus | null;
43
- onPress?: () => void;
44
- onUpgradePress?: () => void;
45
- onManagePress?: () => void;
46
- style?: ViewStyle;
47
- translations?: SubscriptionSectionTranslations;
48
- showStatus?: boolean;
49
- showExpiration?: boolean;
50
- showManageButton?: boolean;
51
- }
52
- ```
53
-
54
- ### Özellikler
55
-
56
- - Abonelik durumunu gösterir
57
- - Son kullanma tarihini görüntüler
58
- - Yönetim butonu sağlar
59
- - Upgrade butonu (free kullanıcılar için)
60
- - Özelleştirilebilir çeviri desteği
61
- - Press action ile detay sayfasına navigasyon
62
-
63
- ### Detaylı Kullanım
64
-
65
- ```typescript
66
- import React from 'react';
67
- import { View, ScrollView } from 'react-native';
68
- import { SubscriptionSection } from '@umituz/react-native-subscription';
69
-
70
- function SettingsScreen() {
71
- const { subscription, isPremium } = useSubscription();
72
-
73
- return (
74
- <ScrollView>
75
- {/* Abonelik Section */}
76
- <SubscriptionSection
77
- title="My Subscription"
78
- subscription={subscription}
79
- showStatus={true}
80
- showExpiration={true}
81
- showManageButton={isPremium}
82
- onPress={() => {
83
- navigation.navigate('SubscriptionDetail');
84
- }}
85
- onUpgradePress={() => {
86
- // Paywall göster
87
- showPaywall();
88
- }}
89
- onManagePress={() => {
90
- // Subscription yönetimi (Apple/Google subscription management)
91
- if (Platform.OS === 'ios') {
92
- Linking.openURL('https://apps.apple.com/account/subscriptions');
93
- } else {
94
- Linking.openURL('https://play.google.com/store/account/subscriptions');
95
- }
96
- }}
97
- translations={{
98
- title: 'Subscription',
99
- active: 'Active',
100
- inactive: 'Inactive',
101
- expires: 'Expires on',
102
- renews: 'Renews on',
103
- manage: 'Manage Subscription',
104
- upgrade: 'Upgrade to Premium',
105
- lifetime: 'Lifetime Access',
106
- }}
107
- />
108
-
109
- {/* Diğer settingler */}
110
- {/* ... */}
111
- </ScrollView>
112
- );
113
- }
114
- ```
115
-
116
- ## Özelleştirme
117
-
118
- ### Custom Styling
119
-
120
- ```typescript
121
- import { StyleSheet } from 'react-native';
122
- import { SubscriptionSection } from '@umituz/react-native-subscription';
123
-
124
- const customStyles = StyleSheet.create({
125
- container: {
126
- backgroundColor: '#FF6B6B',
127
- borderRadius: 12,
128
- padding: 16,
129
- margin: 16,
130
- shadowColor: '#000',
131
- shadowOffset: { width: 0, height: 2 },
132
- shadowOpacity: 0.1,
133
- shadowRadius: 4,
134
- elevation: 3,
135
- },
136
- title: {
137
- fontSize: 20,
138
- fontWeight: 'bold',
139
- color: '#FFFFFF',
140
- },
141
- status: {
142
- fontSize: 14,
143
- color: '#FFFFFF',
144
- opacity: 0.9,
145
- },
146
- });
147
-
148
- <SubscriptionSection
149
- subscription={subscription}
150
- onPress={handlePress}
151
- style={customStyles.container}
152
- titleStyle={customStyles.title}
153
- statusStyle={customStyles.status}
154
- />
155
- ```
156
-
157
- ### Custom Actions
158
-
159
- ```typescript
160
- import { SubscriptionSection } from '@umituz/react-native-subscription';
161
-
162
- function CustomSubscriptionSection() {
163
- const { subscription } = useSubscription();
164
-
165
- const handlePress = () => {
166
- if (subscription?.isPremium) {
167
- // Premium kullanıcı: Detayları göster
168
- navigation.navigate('SubscriptionDetail');
169
- } else {
170
- // Free kullanıcı: Paywall göster
171
- navigation.navigate('Paywall');
172
- }
173
- };
174
-
175
- const handleLongPress = () => {
176
- // Long press ile hızlı yönetim
177
- if (subscription?.isPremium) {
178
- showManageOptions();
179
- }
180
- };
181
-
182
- return (
183
- <SubscriptionSection
184
- subscription={subscription}
185
- onPress={handlePress}
186
- onLongPress={handleLongPress}
187
- translations={{
188
- title: 'My Plan',
189
- status: subscription?.isActive ? 'Active' : 'Inactive',
190
- manage: 'Manage',
191
- upgrade: 'Upgrade',
192
- }}
193
- />
194
- );
195
- }
196
- ```
197
-
198
- ## Durum Bazlı Gösterim
199
-
200
- Farklı durumlar için farklı görünümler:
201
-
202
- ```typescript
203
- import { SubscriptionSection } from '@umituz/react-native-subscription';
204
-
205
- function StatusBasedSections() {
206
- const { subscription } = useSubscription();
207
-
208
- if (!subscription) {
209
- // Loading state
210
- return <SubscriptionSection.Loading />;
211
- }
212
-
213
- if (subscription.isPremium) {
214
- // Premium kullanıcı
215
- return (
216
- <SubscriptionSection
217
- subscription={subscription}
218
- showStatus={true}
219
- showExpiration={true}
220
- showManageButton={true}
221
- onPress={() => navigation.navigate('PremiumDetail')}
222
- translations={{
223
- title: 'Premium Plan',
224
- active: 'Active',
225
- manage: 'Manage Subscription',
226
- }}
227
- />
228
- );
229
- }
230
-
231
- // Free kullanıcı
232
- return (
233
- <SubscriptionSection
234
- subscription={subscription}
235
- showStatus={false}
236
- onUpgradePress={() => navigation.navigate('Paywall')}
237
- translations={{
238
- title: 'Free Plan',
239
- upgrade: 'Upgrade to Premium',
240
- }}
241
- />
242
- );
243
- }
244
- ```
245
-
246
- ## Birden Fazla Section
247
-
248
- Farklı abonelik türleri için:
249
-
250
- ```typescript
251
- import { SubscriptionSection } from '@umituz/react-native-subscription';
252
-
253
- function MultipleSections() {
254
- const { subscription } = useSubscription();
255
-
256
- return (
257
- <ScrollView>
258
- {/* Ana Abonelik */}
259
- <SubscriptionSection
260
- title="Main Subscription"
261
- subscription={subscription}
262
- onPress={() => navigation.navigate('MainSubscription')}
263
- />
264
-
265
- {/* Kredi Paketi */}
266
- <SubscriptionSection
267
- title="Credits Balance"
268
- subscription={{
269
- type: 'credits',
270
- isActive: true,
271
- credits: 150,
272
- }}
273
- onPress={() => navigation.navigate('Credits')}
274
- translations={{
275
- title: 'Credits',
276
- status: '150 credits available',
277
- }}
278
- />
279
-
280
- {/* Lifetime Plan */}
281
- {subscription?.type === 'lifetime' && (
282
- <SubscriptionSection
283
- title="Lifetime Access"
284
- subscription={subscription}
285
- showExpiration={false}
286
- translations={{
287
- title: 'Lifetime',
288
- status: 'Owned forever',
289
- }}
290
- />
291
- )}
292
- </ScrollView>
293
- );
294
- }
295
- ```
296
-
297
- ## Refresh Support
298
-
299
- Pull-to-refresh desteği:
300
-
301
- ```typescript
302
- import React, { useState } from 'react';
303
- import { ScrollView, RefreshControl } from 'react-native';
304
- import { SubscriptionSection } from '@umituz/react-native-subscription';
305
-
306
- function RefreshableSection() {
307
- const { subscription, refetch, isLoading } = useSubscription();
308
- const [refreshing, setRefreshing] = useState(false);
309
-
310
- const handleRefresh = async () => {
311
- setRefreshing(true);
312
- await refetch();
313
- setRefreshing(false);
314
- };
315
-
316
- return (
317
- <ScrollView
318
- refreshControl={
319
- <RefreshControl
320
- refreshing={refreshing || isLoading}
321
- onRefresh={handleRefresh}
322
- />
323
- }
324
- >
325
- <SubscriptionSection
326
- subscription={subscription}
327
- onPress={() => navigation.navigate('SubscriptionDetail')}
328
- />
329
- </ScrollView>
330
- );
331
- }
332
- ```
333
-
334
- ## Best Practices
335
-
336
- 1. **Clear Status**: Durumun açık ve net olduğundan emin olun
337
- 2. **Action Buttons**: Uygun aksiyon butonları sağlayın
338
- 3. **Loading States**: Yüklenme durumlarını gösterin
339
- 4. **Error Handling**: Hata durumlarını graceful şekilde handle edin
340
- 5. **Accessibility**: Accessibility özelliklerini ekleyin
341
- 6. **Consistent Design**: Tüm section'larda tutarlı tasarım kullanın
342
- 7. **Deep Links**: Yönetim sayfalarına deep link ekleyin
343
-
344
- ## Örnek: Complete Implementation
345
-
346
- ```typescript
347
- import React from 'react';
348
- import {
349
- View,
350
- StyleSheet,
351
- ScrollView,
352
- RefreshControl,
353
- Linking,
354
- Platform,
355
- } from 'react-native';
356
- import {
357
- SubscriptionSection,
358
- useSubscription,
359
- } from '@umituz/react-native-subscription';
360
-
361
- export default function SettingsScreen() {
362
- const { subscription, isLoading, refetch } = useSubscription();
363
- const [refreshing, setRefreshing] = React.useState(false);
364
-
365
- const handleRefresh = async () => {
366
- setRefreshing(true);
367
- await refetch();
368
- setRefreshing(false);
369
- };
370
-
371
- const handleManageSubscription = () => {
372
- const url =
373
- Platform.OS === 'ios'
374
- ? 'https://apps.apple.com/account/subscriptions'
375
- : 'https://play.google.com/store/account/subscriptions';
376
-
377
- Linking.openURL(url).catch((err) =>
378
- console.error('Cannot open URL:', err)
379
- );
380
- };
381
-
382
- return (
383
- <ScrollView
384
- style={styles.container}
385
- refreshControl={
386
- <RefreshControl refreshing={refreshing} onRefresh={handleRefresh} />
387
- }
388
- >
389
- {/* Header */}
390
- <View style={styles.header}>
391
- <Text style={styles.headerTitle}>Settings</Text>
392
- </View>
393
-
394
- {/* Subscription Section */}
395
- <SubscriptionSection
396
- title="Subscription"
397
- subscription={subscription}
398
- showStatus={true}
399
- showExpiration={true}
400
- showManageButton={subscription?.isPremium}
401
- onPress={() => navigation.navigate('SubscriptionDetail')}
402
- onManagePress={handleManageSubscription}
403
- onUpgradePress={() => navigation.navigate('Paywall')}
404
- translations={{
405
- title: 'Subscription',
406
- active: 'Active',
407
- inactive: 'Inactive',
408
- expires: 'Expires on',
409
- renews: 'Renews on',
410
- manage: 'Manage Subscription',
411
- upgrade: 'Upgrade to Premium',
412
- lifetime: 'Lifetime Access',
413
- }}
414
- />
415
-
416
- {/* Diğer ayarlar */}
417
- {/* ... */}
418
- </ScrollView>
419
- );
420
- }
421
-
422
- const styles = StyleSheet.create({
423
- container: {
424
- flex: 1,
425
- backgroundColor: '#F5F5F5',
426
- },
427
- header: {
428
- padding: 20,
429
- backgroundColor: '#fff',
430
- borderBottomWidth: 1,
431
- borderBottomColor: '#E0E0E0',
432
- },
433
- headerTitle: {
434
- fontSize: 28,
435
- fontWeight: 'bold',
436
- },
437
- });
438
- ```
439
-
440
- ## Translations
441
-
442
- Çoklu dil desteği:
443
-
444
- ```typescript
445
- const translations = {
446
- 'en': {
447
- title: 'Subscription',
448
- active: 'Active',
449
- inactive: 'Inactive',
450
- expires: 'Expires on',
451
- manage: 'Manage',
452
- upgrade: 'Upgrade',
453
- },
454
- 'tr': {
455
- title: 'Abonelik',
456
- active: 'Aktif',
457
- inactive: 'Aktif değil',
458
- expires: 'Son kullanma',
459
- manage: 'Yönet',
460
- upgrade: 'Yükselt',
461
- },
462
- };
463
-
464
- <SubscriptionSection
465
- subscription={subscription}
466
- translations={translations[userLanguage]}
467
- />
468
- ```
3
+ Subscription-related section and card components.
4
+
5
+ ## Location
6
+
7
+ - **Base Path**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/presentation/components/sections/`
8
+ - **Components**: `src/presentation/components/sections/`
9
+
10
+ ## Strategy
11
+
12
+ ### Section Components
13
+
14
+ Organized sections for subscription information display.
15
+
16
+ - **SubscriptionSection**: Subscription status and management section
17
+ - **Status Display**: Clear status indicators
18
+ - **Action Buttons**: Management and upgrade actions
19
+ - **Navigation Support**: Deep linking to detail screens
20
+
21
+ ### Display Features
22
+
23
+ Comprehensive subscription information display.
24
+
25
+ - **Status Indicators**: Active/inactive status display
26
+ - **Expiration Dates**: Date formatting and display
27
+ - **Management Actions**: Subscription management buttons
28
+ - **Upgrade Options**: Premium upgrade prompts
29
+
30
+ ### Interaction Design
31
+
32
+ User-friendly interaction patterns.
33
+
34
+ - **Press Actions**: Navigation to detail screens
35
+ - **Long Press**: Quick management options
36
+ - **Status-Based UI**: Different UI for different subscription states
37
+ - **Refresh Support**: Pull-to-refresh capabilities
38
+
39
+ ### Customization
40
+
41
+ Flexible styling and behavior.
42
+
43
+ - **Custom Actions**: Custom action handlers
44
+ - **Style Props**: Custom styling support
45
+ - **Translation Support**: Multi-language support
46
+ - **Conditional Display**: Show/hide elements based on state
47
+
48
+ ## Restrictions
49
+
50
+ ### REQUIRED
51
+
52
+ - **Status Clarity**: Status must be clearly visible
53
+ - **Action Buttons**: Provide appropriate action buttons
54
+ - **Loading States**: Show loading indicators
55
+ - **Error Handling**: Handle errors gracefully
56
+
57
+ ### PROHIBITED
58
+
59
+ - **Hardcoded Text**: All text must support translations
60
+ - **Missing Actions**: Never omit necessary actions
61
+ - **Ambiguous Status**: Status must be unambiguous
62
+ - **Blocking UI**: Never block app navigation
63
+
64
+ ### CRITICAL
65
+
66
+ - **Deep Links**: Include management deep links
67
+ - **State Accuracy**: Display accurate subscription state
68
+ - **User Actions**: Provide clear action options
69
+ - **Platform Links**: Correct platform-specific management links
70
+
71
+ ## AI Agent Guidelines
72
+
73
+ ### When Modifying Section Components
74
+
75
+ 1. **Component Interface**: Maintain consistent prop interfaces
76
+ 2. **State Handling**: Proper state management
77
+ 3. **Translations**: Ensure translation support
78
+ 4. **Accessibility**: Include accessibility features
79
+
80
+ ### When Adding Section Features
81
+
82
+ 1. **Pattern Consistency**: Follow existing patterns
83
+ 2. **Type Safety**: Define TypeScript types
84
+ 3. **Documentation**: Document props and usage
85
+ 4. **Testing**: Test with different subscription states
86
+
87
+ ### When Fixing Section Component Bugs
88
+
89
+ 1. **State Display**: Check state display logic
90
+ 2. **Actions**: Verify action handlers
91
+ 3. **Navigation**: Test navigation flows
92
+ 4. **Edge Cases**: Test with null/undefined states
93
+
94
+ ## Related Documentation
95
+
96
+ - [Details Components](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/presentation/components/details/README.md)
97
+ - [Feedback Components](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/presentation/components/feedback/README.md)
98
+ - [Presentation Components](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/presentation/components/README.md)
99
+ - [Paywall Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/paywall/README.md)