@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.
Files changed (92) hide show
  1. package/README.md +211 -394
  2. package/package.json +1 -1
  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/errors/README.md +33 -287
  9. package/src/domain/value-objects/README.md +43 -179
  10. package/src/domains/README.md +50 -238
  11. package/src/domains/README.md.bak +274 -0
  12. package/src/domains/config/README.md +93 -383
  13. package/src/domains/config/domain/README.md +23 -376
  14. package/src/domains/config/domain/entities/README.md +34 -343
  15. package/src/domains/paywall/README.md +99 -369
  16. package/src/domains/paywall/components/README.md +34 -178
  17. package/src/domains/paywall/entities/README.md +34 -193
  18. package/src/domains/paywall/hooks/README.md +34 -122
  19. package/src/domains/wallet/README.md +34 -275
  20. package/src/domains/wallet/README.md.bak +209 -0
  21. package/src/domains/wallet/domain/README.md +34 -101
  22. package/src/domains/wallet/domain/entities/README.md +34 -115
  23. package/src/domains/wallet/domain/errors/README.md +34 -151
  24. package/src/domains/wallet/infrastructure/README.md +34 -89
  25. package/src/domains/wallet/presentation/components/README.md +34 -224
  26. package/src/domains/wallet/presentation/hooks/README.md +34 -248
  27. package/src/infrastructure/README.md +37 -496
  28. package/src/infrastructure/mappers/README.md +0 -13
  29. package/src/infrastructure/repositories/README.md +74 -360
  30. package/src/infrastructure/services/README.md +95 -370
  31. package/src/presentation/README.md +123 -408
  32. package/src/presentation/README.md.bak +172 -0
  33. package/src/presentation/components/README.md +151 -179
  34. package/src/presentation/components/README.md.bak +217 -0
  35. package/src/presentation/components/details/CreditRow.md +65 -310
  36. package/src/presentation/components/details/DetailRow.md +63 -255
  37. package/src/presentation/components/details/PremiumDetailsCard.md +65 -238
  38. package/src/presentation/components/details/PremiumStatusBadge.md +64 -239
  39. package/src/presentation/components/details/README.md +97 -447
  40. package/src/presentation/components/feedback/PaywallFeedbackModal.md +63 -287
  41. package/src/presentation/components/feedback/README.md +97 -445
  42. package/src/presentation/components/paywall/PaywallModal.md +66 -416
  43. package/src/presentation/components/paywall/README.md +50 -186
  44. package/src/presentation/components/sections/README.md +97 -466
  45. package/src/presentation/components/sections/SubscriptionSection.md +92 -244
  46. package/src/presentation/hooks/README.md +154 -741
  47. package/src/presentation/hooks/useAuthAwarePurchase.md +58 -325
  48. package/src/presentation/hooks/useAuthGate.md +61 -375
  49. package/src/presentation/hooks/useAuthSubscriptionSync.md +66 -370
  50. package/src/presentation/hooks/useCreditChecker.md +73 -378
  51. package/src/presentation/hooks/useCredits.md +74 -313
  52. package/src/presentation/hooks/useCredits.md.bak +231 -0
  53. package/src/presentation/hooks/useCreditsGate.md +66 -318
  54. package/src/presentation/hooks/useDeductCredit.md +0 -76
  55. package/src/presentation/hooks/useDevTestCallbacks.md +63 -394
  56. package/src/presentation/hooks/useFeatureGate.md +105 -150
  57. package/src/presentation/hooks/useFeatureGate.md.bak +284 -0
  58. package/src/presentation/hooks/useInitializeCredits.md +64 -430
  59. package/src/presentation/hooks/usePaywall.md +61 -306
  60. package/src/presentation/hooks/usePaywallOperations.md +64 -458
  61. package/src/presentation/hooks/usePaywallVisibility.md +67 -316
  62. package/src/presentation/hooks/usePremium.md +84 -226
  63. package/src/presentation/hooks/usePremiumGate.md +60 -395
  64. package/src/presentation/hooks/usePremiumWithCredits.md +64 -401
  65. package/src/presentation/hooks/useSubscription.md +66 -422
  66. package/src/presentation/hooks/useSubscriptionDetails.md +65 -410
  67. package/src/presentation/hooks/useSubscriptionGate.md +80 -164
  68. package/src/presentation/hooks/useSubscriptionSettingsConfig.md +66 -346
  69. package/src/presentation/hooks/useSubscriptionStatus.md +66 -396
  70. package/src/presentation/hooks/useUserTier.md +63 -328
  71. package/src/presentation/hooks/useUserTierWithRepository.md +64 -424
  72. package/src/presentation/screens/README.md +48 -190
  73. package/src/presentation/types/README.md +0 -16
  74. package/src/presentation/utils/README.md +0 -21
  75. package/src/revenuecat/README.md +99 -518
  76. package/src/revenuecat/application/README.md +35 -150
  77. package/src/revenuecat/application/ports/README.md +34 -162
  78. package/src/revenuecat/domain/README.md +42 -141
  79. package/src/revenuecat/domain/constants/README.md +34 -176
  80. package/src/revenuecat/domain/entities/README.md +34 -374
  81. package/src/revenuecat/domain/errors/README.md +47 -191
  82. package/src/revenuecat/domain/types/README.md +34 -366
  83. package/src/revenuecat/domain/value-objects/README.md +34 -434
  84. package/src/revenuecat/infrastructure/README.md +34 -43
  85. package/src/revenuecat/infrastructure/config/README.md +32 -23
  86. package/src/revenuecat/infrastructure/handlers/README.md +34 -211
  87. package/src/revenuecat/infrastructure/managers/README.md +34 -42
  88. package/src/revenuecat/infrastructure/services/README.md +35 -318
  89. package/src/revenuecat/infrastructure/utils/README.md +34 -375
  90. package/src/revenuecat/presentation/README.md +34 -176
  91. package/src/revenuecat/presentation/hooks/README.md +29 -35
  92. package/src/utils/README.md +38 -525
@@ -1,371 +1,101 @@
1
1
  # Paywall Domain
2
2
 
3
- Abonelik ve kredi satın alımı için kullanıcı dostu ödeme duvarı (paywall) bileşenleri ve hooks.
4
-
5
- ## Özellikler
6
-
7
- - **Hazır Paywall Bileşenleri**: Önceden tasarlanmış, özelleştirilebilir paywall UI'ları
8
- - **Modal ve Full-Screen Desteği**: Modal veya tam ekran paywall seçenekleri
9
- - **Çoklu Dil Desteği**: Built-in i18n desteği
10
- - **A/B Test Hazır**: Farklı paywall varyantları kolayca oluşturulabilir
11
- - **Analytics Entegrasyonu**: Kullanıcı davranışlarını takip edin
12
-
13
- ## Kurulum
14
-
15
- ### Temel Konfigürasyon
16
-
17
- ```typescript
18
- import { SubscriptionProvider } from '@umituz/react-native-subscription';
19
-
20
- function App() {
21
- return (
22
- <SubscriptionProvider
23
- config={{
24
- revenueCatApiKey: 'your_api_key',
25
- entitlementId: 'premium',
26
- }}
27
- >
28
- {/* Your app */}
29
- </SubscriptionProvider>
30
- );
31
- }
32
- ```
33
-
34
- ## Kullanım
35
-
36
- ### PaywallModal
37
-
38
- Modal paywall gösterimi için:
39
-
40
- ```typescript
41
- import { PaywallModal } from '@umituz/react-native-subscription';
42
-
43
- function MyComponent() {
44
- const [isVisible, setIsVisible] = useState(false);
45
-
46
- return (
47
- <>
48
- <Button onPress={() => setIsVisible(true)} title="Upgrade to Premium" />
49
-
50
- <PaywallModal
51
- isVisible={isVisible}
52
- onClose={() => setIsVisible(false)}
53
- config={{
54
- title: 'Unlock Premium Features',
55
- description: 'Get unlimited access to all features',
56
- features: [
57
- { icon: 'star', text: 'Unlimited credits' },
58
- { icon: 'zap', text: 'AI-powered tools' },
59
- { icon: 'shield', text: 'Ad-free experience' },
60
- ],
61
- }}
62
- />
63
- </>
64
- );
65
- }
66
- ```
67
-
68
- ### usePaywall Hook
69
-
70
- Paywall görünürlüğünü ve davranışlarını kontrol etmek için:
71
-
72
- ```typescript
73
- import { usePaywall } from '@umituz/react-native-subscription';
74
-
75
- function PremiumFeature() {
76
- const { showPaywall, hidePaywall, isPaywallVisible } = usePaywall();
77
-
78
- const handleUpgradeClick = () => {
79
- showPaywall({
80
- trigger: 'premium_button',
81
- featureId: 'ai_tools',
82
- });
83
- };
84
-
85
- return (
86
- <View>
87
- <Text>Premium Feature</Text>
88
- <Button onPress={handleUpgradeClick} title="Unlock" />
89
- </View>
90
- );
91
- }
92
- ```
93
-
94
- ### usePaywallActions Hook
95
-
96
- Paywall aksiyonları için:
97
-
98
- ```typescript
99
- import { usePaywallActions } from '@umituz/react-native-subscription';
100
-
101
- function PaywallHandler() {
102
- const { handlePurchase, handleRestore, isLoading } = usePaywallActions();
103
-
104
- return (
105
- <View>
106
- <Button
107
- onPress={handlePurchase}
108
- disabled={isLoading}
109
- title="Subscribe Now"
110
- />
111
- <Button onPress={handleRestore} title="Restore Purchase" />
112
- </View>
113
- );
114
- }
115
- ```
116
-
117
- ### useSubscriptionModal Hook
118
-
119
- Subscription modal yönetimi için:
120
-
121
- ```typescript
122
- import { useSubscriptionModal } from '@umituz/react-native-subscription';
123
-
124
- function SubscriptionButton() {
125
- const { openModal, closeModal, isModalOpen } = useSubscriptionModal();
126
-
127
- return (
128
- <>
129
- <Button onPress={openModal} title="View Plans" />
130
- <SubscriptionModal
131
- isOpen={isModalOpen}
132
- onClose={closeModal}
133
- />
134
- </>
135
- );
136
- }
137
- ```
138
-
139
- ## Bileşenler
140
-
141
- ### PaywallContainer
142
-
143
- Paywall içerik wrapper'ı:
144
-
145
- ```typescript
146
- import { PaywallContainer } from '@umituz/react-native-subscription';
147
-
148
- <PaywallContainer
149
- config={{
150
- theme: 'dark',
151
- showCloseButton: true,
152
- closeOnBackdropPress: false,
153
- }}
154
- >
155
- {/* Paywall content */}
156
- </PaywallContainer>
157
- ```
158
-
159
- ### PaywallScreen
160
-
161
- Tam ekran paywall:
162
-
163
- ```typescript
164
- import { PaywallScreen } from '@umituz/react-native-subscription';
165
-
166
- <PaywallScreen
167
- packages={subscriptionPackages}
168
- onPackageSelect={handlePackageSelect}
169
- config={{
170
- highlightPackage: 'annual',
171
- showPerks: true,
172
- showTerms: true,
173
- }}
174
- translations={{
175
- title: 'Choose Your Plan',
176
- subtitle: 'Cancel anytime',
177
- terms: 'Terms & Privacy Policy',
178
- }}
179
- />
180
- ```
181
-
182
- ## Hooks Referansı
183
-
184
- ### usePaywall
185
-
186
- ```typescript
187
- const {
188
- showPaywall, // Paywall göster
189
- hidePaywall, // Paywall gizle
190
- isPaywallVisible, // Paywall görünürlük durumu
191
- paywallConfig, // Mevcut konfigürasyon
192
- } = usePaywall();
193
- ```
194
-
195
- ### usePaywallActions
196
-
197
- ```typescript
198
- const {
199
- handlePurchase, // Satın alma işlemi
200
- handleRestore, // Satın alma geri yükleme
201
- isLoading, // Yüklenme durumu
202
- error, // Hata mesajı
203
- selectedPackage, // Seçili paket
204
- } = usePaywallActions();
205
- ```
206
-
207
- ### usePaywallTranslations
208
-
209
- ```typescript
210
- const {
211
- translations, // Çeviri objeleri
212
- t, // Çeviri fonksiyonu
213
- isLoading, // Yüklenme durumu
214
- } = usePaywallTranslations({
215
- language: 'tr',
216
- fallbackLanguage: 'en',
217
- });
218
- ```
219
-
220
- ## Özelleştirme
221
-
222
- ### Tema Konfigürasyonu
223
-
224
- ```typescript
225
- const customTheme = {
226
- colors: {
227
- primary: '#FF6B6B',
228
- background: '#1A1A1A',
229
- text: '#FFFFFF',
230
- textSecondary: '#A0A0A0',
231
- },
232
- fonts: {
233
- title: { fontSize: 28, fontWeight: 'bold' },
234
- body: { fontSize: 16, fontWeight: 'normal' },
235
- },
236
- };
237
-
238
- <PaywallModal theme={customTheme} />
239
- ```
240
-
241
- ### Özel Feature Listesi
242
-
243
- ```typescript
244
- const customFeatures = [
245
- {
246
- id: 'feature1',
247
- icon: 'rocket',
248
- title: 'AI-Powered Tools',
249
- description: 'Advanced AI features',
250
- highlight: true,
251
- },
252
- {
253
- id: 'feature2',
254
- icon: 'infinity',
255
- title: 'Unlimited Credits',
256
- description: 'Never run out of credits',
257
- },
258
- ];
259
-
260
- <PaywallScreen features={customFeatures} />
261
- ```
262
-
263
- ## Event Tracking
264
-
265
- Analytics entegrasyonu için:
266
-
267
- ```typescript
268
- import { usePaywallFeedback } from '@umituz/react-native-subscription';
269
-
270
- function PaywallWithTracking() {
271
- const { trackEvent, trackPurchase, trackDismiss } = usePaywallFeedback();
272
-
273
- useEffect(() => {
274
- trackEvent('paywall_impression', {
275
- source: 'home_screen',
276
- });
277
- }, []);
278
-
279
- const handlePurchase = async () => {
280
- await purchasePackage();
281
- trackPurchase('premium_monthly', {
282
- revenue: 9.99,
283
- currency: 'USD',
284
- });
285
- };
286
-
287
- const handleClose = () => {
288
- trackDismiss('paywall_closed', {
289
- duration: 30, // seconds
290
- });
291
- closeModal();
292
- };
293
- }
294
- ```
295
-
296
- ## Best Practices
297
-
298
- 1. **Trigger Bazlı Gösterim**: Farklı trigger'lar için farklı paywall'lar kullanın
299
- 2. **A/B Test**: Farklı varyasyonları test edin
300
- 3. **Analytics**: Kullanıcı davranışlarını takip edin
301
- 4. **Copywriting**: Farklı dillerde optimize edilmiş copy kullanın
302
- 5. **Loading States**: Satın alma sırasında loading gösterin
303
- 6. **Error Handling**: Hataları kullanıcı dostu mesajlarla gösterin
304
-
305
- ## Örnek Uygulama
306
-
307
- ```typescript
308
- import React, { useState } from 'react';
309
- import { View, Button } from 'react-native';
310
- import {
311
- PaywallModal,
312
- usePaywall,
313
- usePaywallActions,
314
- } from '@umituz/react-native-subscription';
315
-
316
- export default function PaywallExample() {
317
- const { isPaywallVisible, showPaywall, hidePaywall } = usePaywall();
318
- const { handlePurchase, isLoading } = usePaywallActions();
319
-
320
- return (
321
- <View>
322
- <Button
323
- onPress={() => showPaywall({ trigger: 'upgrade_button' })}
324
- title="Upgrade to Premium"
325
- />
326
-
327
- <PaywallModal
328
- isVisible={isPaywallVisible}
329
- onClose={hidePaywall}
330
- config={{
331
- title: 'Go Premium',
332
- description: 'Unlock all features',
333
- features: [
334
- { icon: 'star', text: 'Unlimited access' },
335
- { icon: 'zap', text: 'AI features' },
336
- { icon: 'shield', text: 'No ads' },
337
- ],
338
- }}
339
- onPurchase={handlePurchase}
340
- isLoading={isLoading}
341
- />
342
- </View>
343
- );
344
- }
345
- ```
346
-
347
- ## Tip Tanımlamaları
348
-
349
- ```typescript
350
- interface PaywallConfig {
351
- title?: string;
352
- description?: string;
353
- features?: PaywallFeature[];
354
- theme?: 'light' | 'dark';
355
- showCloseButton?: boolean;
356
- closeOnBackdropPress?: boolean;
357
- }
358
-
359
- interface PaywallFeature {
360
- icon: string;
361
- text: string;
362
- description?: string;
363
- highlight?: boolean;
364
- }
365
-
366
- interface PaywallTrigger {
367
- trigger: string;
368
- featureId?: string;
369
- source?: string;
370
- }
371
- ```
3
+ Subscription and credit purchase flow with user-friendly payment wall components and hooks.
4
+
5
+ ## Location
6
+
7
+ - **Base Path**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/paywall/`
8
+ - **Entities**: `src/domains/paywall/entities/`
9
+ - **Components**: `src/domains/paywall/components/`
10
+ - **Hooks**: `src/domains/paywall/hooks/`
11
+
12
+ ## Strategy
13
+
14
+ ### Paywall Management
15
+
16
+ Centralized paywall system for subscription and credit purchase flows.
17
+
18
+ - **Modal and Full-Screen Support**: Flexible paywall display options
19
+ - **Multi-language Support**: Built-in i18n capabilities
20
+ - **A/B Test Ready**: Easy creation of different paywall variants
21
+ - **Analytics Integration**: User behavior tracking capabilities
22
+
23
+ ### Component Architecture
24
+
25
+ Ready-to-use paywall components with customization support.
26
+
27
+ - **PaywallModal**: Modal-based paywall display
28
+ - **PaywallContainer**: Paywall content wrapper
29
+ - **PaywallScreen**: Full-screen paywall implementation
30
+ - **Feature Lists**: Customizable feature display components
31
+
32
+ ### Hook Integration
33
+
34
+ Hooks for paywall state and behavior management.
35
+
36
+ - **usePaywall**: Paywall visibility and state control
37
+ - **usePaywallActions**: Purchase and restore action handling
38
+ - **usePaywallTranslations**: Translation management
39
+ - **useSubscriptionModal**: Subscription modal management
40
+
41
+ ### Configuration Strategy
42
+
43
+ Theme and content customization system.
44
+
45
+ - **Theme Configuration**: Custom color schemes and styling
46
+ - **Feature Lists**: Customizable feature display
47
+ - **Translation Support**: Multi-language copy management
48
+ - **Event Tracking**: Analytics integration points
49
+
50
+ ## Restrictions
51
+
52
+ ### REQUIRED
53
+
54
+ - **Paywall Context**: All paywall components must be used within SubscriptionProvider
55
+ - **Config Validation**: Paywall configuration must be validated before use
56
+ - **Error Handling**: All paywall actions must have error handling
57
+ - **Loading States**: Purchase operations must show loading indicators
58
+
59
+ ### PROHIBITED
60
+
61
+ - **Hardcoded Strings**: All text must support translations
62
+ - **Direct RevenueCat Calls**: Use paywall hooks instead of direct SDK calls
63
+ - **Missing Analytics**: All paywall interactions must be tracked
64
+ - **Blocking UI**: Never block app flow without escape options
65
+
66
+ ### CRITICAL
67
+
68
+ - **User Experience**: Paywalls must be dismissible
69
+ - **Purchase Flow**: Complete purchase flow must be handled
70
+ - **Error Recovery**: Graceful error handling required
71
+ - **State Management**: Paywall state must be properly managed
72
+
73
+ ## AI Agent Guidelines
74
+
75
+ ### When Modifying Paywall Components
76
+
77
+ 1. **Maintain UX Standards**: Keep user experience consistent
78
+ 2. **Test All States**: Test loading, success, and error states
79
+ 3. **Analytics Integration**: Add tracking for new interactions
80
+ 4. **Translation Support**: All new text must be translatable
81
+
82
+ ### When Adding New Paywall Features
83
+
84
+ 1. **Hook Pattern**: Create corresponding hook for new features
85
+ 2. **Type Safety**: Define proper TypeScript types
86
+ 3. **Documentation**: Document all props and usage
87
+ 4. **Testing**: Test with different subscription states
88
+
89
+ ### When Fixing Paywall Bugs
90
+
91
+ 1. **RevenueCat Integration**: Check RevenueCat SDK integration
92
+ 2. **State Management**: Verify state transitions
93
+ 3. **Edge Cases**: Test with null/undefined states
94
+ 4. **User Flows**: Test complete purchase flows
95
+
96
+ ## Related Documentation
97
+
98
+ - [RevenueCat Integration](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/revenuecat/README.md)
99
+ - [Config Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/config/README.md)
100
+ - [Wallet Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/wallet/README.md)
101
+ - [Presentation Components](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/presentation/components/README.md)
@@ -1,185 +1,41 @@
1
1
  # Paywall Components
2
2
 
3
+ ## Location
3
4
  UI components for displaying paywalls and upgrade prompts.
4
5
 
5
- ## Overview
6
-
7
- This directory contains React Native components for rendering paywall screens and upgrade prompts.
8
-
9
- ## Components
10
-
11
- ### PaywallScreen
12
- Main paywall screen with package selection.
13
-
14
- ```typescript
15
- function PaywallScreen() {
16
- const { packages, isLoading } = useSubscriptionPackages();
17
- const { handlePurchase, handleRestore } = usePaywallOperations({
18
- userId: user?.uid,
19
- isAnonymous: !user,
20
- });
21
-
22
- if (isLoading) return <LoadingScreen />;
23
-
24
- return (
25
- <ScrollView>
26
- <PaywallHeader />
27
-
28
- {packages.map((pkg) => (
29
- <PackageCard
30
- key={pkg.identifier}
31
- package={pkg}
32
- onPress={() => handlePurchase(pkg)}
33
- />
34
- ))}
35
-
36
- <RestoreButton onPress={handleRestore} />
37
- </ScrollView>
38
- );
39
- }
40
- ```
41
-
42
- ### PackageCard
43
- Individual subscription package display card.
44
-
45
- ```typescript
46
- interface PackageCardProps {
47
- package: PaywallPackage;
48
- selected?: boolean;
49
- onPress: () => void;
50
- popular?: boolean;
51
- }
52
- ```
53
-
54
- **Features:**
55
- - Highlight popular packages
56
- - Show price and period
57
- - Display features list
58
- - Show savings (for annual)
59
- - Visual selection indicator
60
-
61
- ### PaywallModal
62
- Modal-style paywall overlay.
63
-
64
- ```typescript
65
- interface PaywallModalProps {
66
- visible: boolean;
67
- onClose: () => void;
68
- onPurchase: (pkg: Package) => void;
69
- configuration: PaywallConfig;
70
- }
71
- ```
72
-
73
- **Usage:**
74
- ```typescript
75
- <PaywallModal
76
- visible={showPaywall}
77
- onClose={() => setShowPaywall(false)}
78
- onPurchase={handlePurchase}
79
- configuration={{
80
- title: 'Upgrade to Premium',
81
- features: ['Unlimited access', 'Ad-free'],
82
- packages: packages,
83
- }}
84
- />
85
- ```
86
-
87
- ### PremiumFeatureLock
88
- Locked feature indicator that prompts upgrade.
89
-
90
- ```typescript
91
- interface PremiumFeatureLockProps {
92
- feature: string;
93
- onPress: () => void;
94
- icon?: string;
95
- message?: string;
96
- }
97
- ```
98
-
99
- **Usage:**
100
- ```typescript
101
- <PremiumFeatureLock
102
- feature="AI Generation"
103
- onPress={() => showPaywall({ type: 'premium_feature', feature: 'ai_generation' })}
104
- message="Upgrade to generate unlimited content"
105
- icon="lock"
106
- />
107
- ```
108
-
109
- ## Usage Patterns
110
-
111
- ### With Navigation
112
- ```typescript
113
- function navigateToPaywall(trigger: PaywallTrigger) {
114
- navigation.navigate('Paywall', { trigger });
115
- }
116
-
117
- // In paywall screen
118
- const { trigger } = route.params;
119
- const config = getPaywallConfig(trigger.type);
120
- ```
121
-
122
- ### With Inline Paywall
123
- ```typescript
124
- function InlinePaywall({ onUpgrade, onDismiss }) {
125
- return (
126
- <Card>
127
- <Image source={premiumIllustration} />
128
- <Title>Unlock Premium Features</Title>
129
- <FeaturesList features={premiumFeatures} />
130
- <Button onPress={onUpgrade}>Upgrade Now</Button>
131
- <Link onPress={onDismiss}>Maybe Later</Link>
132
- </Card>
133
- );
134
- }
135
- ```
136
-
137
- ### With Context
138
- ```typescript
139
- function ContextualPaywall({ feature, context }) {
140
- const { packages } = useSubscriptionPackages();
141
-
142
- return (
143
- <PaywallScreen
144
- title={`Unlock ${feature}`}
145
- subtitle={`You need Premium to use ${feature}`}
146
- highlightPackage={context.recommendedPackage}
147
- packages={packages}
148
- />
149
- );
150
- }
151
- ```
152
-
153
- ## Styling
154
-
155
- Components use design tokens for consistent styling:
156
-
157
- ```typescript
158
- import { useAppDesignTokens } from '@umituz/react-native-design-system';
159
-
160
- const tokens = useAppDesignTokens();
161
-
162
- const styles = StyleSheet.create({
163
- card: {
164
- backgroundColor: tokens.colors.surface,
165
- borderRadius: tokens.radius.lg,
166
- padding: tokens.spacing.lg,
167
- },
168
- });
169
- ```
170
-
171
- ## Best Practices
172
-
173
- 1. **Clear Value**: Communicate premium benefits clearly
174
- 2. **Visual Hierarchy**: Highlight recommended package
175
- 3. **Social Proof**: Show user counts or testimonials
176
- 4. **Easy Dismissal**: Allow users to close when appropriate
177
- 5. **Smooth Purchase**: Make purchase flow simple
178
- 6. **Loading States**: Show appropriate loading indicators
179
- 7. **Error Handling**: Handle purchase failures gracefully
180
-
181
- ## Related
182
-
6
+ ## Strategy
7
+ This directory contains React Native components for rendering paywall screens and upgrade prompts with clear value communication and smooth purchase flow.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must communicate premium benefits clearly
13
+ - Must highlight recommended package
14
+ - Must allow dismissal when appropriate
15
+ - Must show appropriate loading indicators
16
+
17
+ ### PROHIBITED
18
+ - DO NOT obscure purchase flow
19
+ - DO NOT hide pricing information
20
+ - DO NOT prevent appropriate dismissal
21
+ - DO NOT show technical errors to users
22
+
23
+ ### CRITICAL SAFETY
24
+ - Pricing information MUST be clear and accurate
25
+ - Purchase flow MUST be simple and straightforward
26
+ - Loading states MUST be visible during operations
27
+ - Purchase failures MUST be handled gracefully
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Communicate premium benefits clearly to users
31
+ 2. Highlight recommended package with visual hierarchy
32
+ 3. Show social proof (user counts, testimonials) when available
33
+ 4. Allow users to dismiss paywall when appropriate
34
+ 5. Make purchase flow simple and straightforward
35
+ 6. Show loading indicators during async operations
36
+ 7. Handle purchase failures with user-friendly messages
37
+
38
+ ## Related Documentation
183
39
  - [Paywall README](../README.md)
184
40
  - [PaywallVisibility Hook](../../hooks/usePaywallVisibility.md)
185
41
  - [Premium Components](../../components/details/README.md)