@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
|
@@ -1,371 +1,101 @@
|
|
|
1
1
|
# Paywall Domain
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
-
|
|
10
|
-
- **
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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)
|