@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.
- package/README.md +211 -394
- package/package.json +3 -3
- 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/entities/SubscriptionStatus.ts +1 -1
- 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/components/TransactionItem.tsx +1 -1
- 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/ActivationHandler.ts +1 -1
- package/src/infrastructure/services/README.md +95 -370
- package/src/infrastructure/services/SubscriptionService.ts +1 -1
- 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/useDeductCredit.ts +1 -1
- 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/presentation/utils/subscriptionDateUtils.ts +1 -1
- 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,390 +1,100 @@
|
|
|
1
1
|
# Config Domain
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Central configuration system for subscription plans, product configurations, and package management.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Location
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
-
|
|
9
|
-
- **
|
|
10
|
-
- **Helper Fonksiyonlar**: Plan karşılaştırma ve filtreleme araçları
|
|
11
|
-
|
|
12
|
-
## Temel Kavramlar
|
|
13
|
-
|
|
14
|
-
### Plan (Plan Entity)
|
|
15
|
-
|
|
16
|
-
Abonelik planını temsil eden temel entity:
|
|
7
|
+
- **Base Path**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/config/`
|
|
8
|
+
- **Domain**: `src/domains/config/domain/`
|
|
9
|
+
- **Entities**: `src/domains/config/domain/entities/`
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
import { Plan } from '@umituz/react-native-subscription';
|
|
20
|
-
|
|
21
|
-
interface Plan {
|
|
22
|
-
id: string; // 'premium_monthly'
|
|
23
|
-
productId: string; // RevenueCat product ID
|
|
24
|
-
period: 'monthly' | 'annual' | 'lifetime';
|
|
25
|
-
price: number; // Fiyat (kusur Sayı)
|
|
26
|
-
currency: string; // 'USD', 'EUR', 'TRY'
|
|
27
|
-
credits?: number; // İlk kredi miktarı
|
|
28
|
-
features: string[]; // ['feature1', 'feature2']
|
|
29
|
-
metadata?: Record<string, any>;
|
|
30
|
-
}
|
|
31
|
-
```
|
|
11
|
+
## Strategy
|
|
32
12
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Plan Oluşturma
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
import { Plan } from '@umituz/react-native-subscription';
|
|
39
|
-
|
|
40
|
-
const monthlyPlan = Plan.create({
|
|
41
|
-
id: 'premium_monthly',
|
|
42
|
-
productId: 'com.app.premium.monthly',
|
|
43
|
-
period: 'monthly',
|
|
44
|
-
price: 9.99,
|
|
45
|
-
currency: 'USD',
|
|
46
|
-
credits: 100,
|
|
47
|
-
features: ['unlimited_access', 'ai_tools', 'no_ads'],
|
|
48
|
-
metadata: {
|
|
49
|
-
popular: false,
|
|
50
|
-
discount: 0,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
13
|
+
### Plan Management
|
|
53
14
|
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
###
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
// Paket tipi belirleme
|
|
142
|
-
const type = getPackageType(revenueCatPackage); // 'MONTHLY'
|
|
143
|
-
|
|
144
|
-
// Paket filtreleme
|
|
145
|
-
const subscriptions = filterPackagesByType(packages, 'subscription');
|
|
146
|
-
const inAppPurchases = filterPackagesByType(packages, 'inapp');
|
|
147
|
-
|
|
148
|
-
// Periyot çıkarma
|
|
149
|
-
const period = extractPackagePeriod('com.app.premium.monthly'); // 'monthly'
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Validasyon
|
|
153
|
-
|
|
154
|
-
### Plan Validasyonu
|
|
155
|
-
|
|
156
|
-
```typescript
|
|
157
|
-
import { Plan } from '@umituz/react-native-subscription';
|
|
158
|
-
|
|
159
|
-
try {
|
|
160
|
-
const plan = Plan.create({
|
|
161
|
-
id: 'premium_monthly',
|
|
162
|
-
productId: 'com.app.premium.monthly',
|
|
163
|
-
period: 'monthly',
|
|
164
|
-
price: -9.99, // Invalid: negatif fiyat
|
|
165
|
-
currency: 'USD',
|
|
166
|
-
});
|
|
167
|
-
} catch (error) {
|
|
168
|
-
console.error('Validation error:', error.message);
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### Config Validasyonu
|
|
173
|
-
|
|
174
|
-
```typescript
|
|
175
|
-
import {
|
|
176
|
-
validatePlanConfig,
|
|
177
|
-
validatePackageConfig,
|
|
178
|
-
type ValidationError,
|
|
179
|
-
} from '@umituz/react-native-subscription';
|
|
180
|
-
|
|
181
|
-
const validation = validatePlanConfig({
|
|
182
|
-
plans: [monthlyPlan, annualPlan],
|
|
183
|
-
defaultPlanId: 'premium_monthly',
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
if (!validation.isValid) {
|
|
187
|
-
validation.errors.forEach((error: ValidationError) => {
|
|
188
|
-
console.error(`Field: ${error.field}, Message: ${error.message}`);
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
## Konfigürasyon Nesneleri
|
|
194
|
-
|
|
195
|
-
### SubscriptionConfig
|
|
196
|
-
|
|
197
|
-
```typescript
|
|
198
|
-
import { SubscriptionConfig } from '@umituz/react-native-subscription';
|
|
199
|
-
|
|
200
|
-
const config: SubscriptionConfig = {
|
|
201
|
-
revenueCatApiKey: 'your_api_key',
|
|
202
|
-
revenueCatEntitlementId: 'premium',
|
|
203
|
-
|
|
204
|
-
plans: {
|
|
205
|
-
monthly: monthlyPlan,
|
|
206
|
-
annual: annualPlan,
|
|
207
|
-
lifetime: lifetimePlan,
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
defaultPlan: 'monthly',
|
|
211
|
-
|
|
212
|
-
features: {
|
|
213
|
-
requireAuth: true,
|
|
214
|
-
allowRestore: true,
|
|
215
|
-
syncWithFirebase: true,
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
ui: {
|
|
219
|
-
showAnnualDiscount: true,
|
|
220
|
-
highlightPopularPlan: true,
|
|
221
|
-
showPerks: true,
|
|
222
|
-
},
|
|
223
|
-
};
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### WalletConfig
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
import { WalletConfig } from '@umituz/react-native-subscription';
|
|
230
|
-
|
|
231
|
-
const walletConfig: WalletConfig = {
|
|
232
|
-
initialCredits: 100,
|
|
233
|
-
|
|
234
|
-
creditPackages: [
|
|
235
|
-
{
|
|
236
|
-
id: 'credits_small',
|
|
237
|
-
productId: 'com.app.credits.small',
|
|
238
|
-
amount: 100,
|
|
239
|
-
price: 0.99,
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
id: 'credits_medium',
|
|
243
|
-
productId: 'com.app.credits.medium',
|
|
244
|
-
amount: 500,
|
|
245
|
-
price: 3.99,
|
|
246
|
-
},
|
|
247
|
-
],
|
|
248
|
-
|
|
249
|
-
creditCosts: {
|
|
250
|
-
ai_generation: 1,
|
|
251
|
-
ai_analysis: 2,
|
|
252
|
-
premium_feature: 5,
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
expiration: {
|
|
256
|
-
enabled: true,
|
|
257
|
-
daysUntilExpiration: 365,
|
|
258
|
-
},
|
|
259
|
-
};
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
## Best Practices
|
|
263
|
-
|
|
264
|
-
1. **Tip Güvenliği**: Her zaman tip tanımlamalarını kullanın
|
|
265
|
-
2. **Validasyon**: Konfigürasyonları çalıştırmadan önce doğrulayın
|
|
266
|
-
3. **Default Değerler**: Anlamlı default değerler sağlayın
|
|
267
|
-
4. **Immutable**: Plan objelerini değiştirmek yerine yeni kopyalar oluşturun
|
|
268
|
-
5. **Environment**: Farklı ortamlar için farklı konfigürasyonlar kullanın
|
|
269
|
-
|
|
270
|
-
## Örnek Uygulama
|
|
271
|
-
|
|
272
|
-
```typescript
|
|
273
|
-
import {
|
|
274
|
-
Plan,
|
|
275
|
-
SubscriptionConfig,
|
|
276
|
-
validatePlanConfig,
|
|
277
|
-
formatPrice,
|
|
278
|
-
calculateDiscount,
|
|
279
|
-
} from '@umituz/react-native-subscription';
|
|
280
|
-
|
|
281
|
-
// 1. Planları tanımlayın
|
|
282
|
-
const plans = {
|
|
283
|
-
monthly: Plan.create({
|
|
284
|
-
id: 'premium_monthly',
|
|
285
|
-
productId: 'com.app.premium.monthly',
|
|
286
|
-
period: 'monthly',
|
|
287
|
-
price: 9.99,
|
|
288
|
-
currency: 'USD',
|
|
289
|
-
credits: 100,
|
|
290
|
-
features: ['unlimited_access', 'ai_tools'],
|
|
291
|
-
}),
|
|
292
|
-
|
|
293
|
-
annual: Plan.create({
|
|
294
|
-
id: 'premium_annual',
|
|
295
|
-
productId: 'com.app.premium.annual',
|
|
296
|
-
period: 'annual',
|
|
297
|
-
price: 79.99,
|
|
298
|
-
currency: 'USD',
|
|
299
|
-
credits: 1200,
|
|
300
|
-
features: ['unlimited_access', 'ai_tools', 'priority_support'],
|
|
301
|
-
metadata: { discount: 33, popular: true },
|
|
302
|
-
}),
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
// 2. Konfigürasyonu oluşturun
|
|
306
|
-
const config: SubscriptionConfig = {
|
|
307
|
-
revenueCatApiKey: process.env.REVENUECAT_API_KEY,
|
|
308
|
-
revenueCatEntitlementId: 'premium',
|
|
309
|
-
plans,
|
|
310
|
-
defaultPlan: 'monthly',
|
|
311
|
-
};
|
|
312
|
-
|
|
313
|
-
// 3. Doğrulayın
|
|
314
|
-
const validation = validatePlanConfig(config);
|
|
315
|
-
if (!validation.isValid) {
|
|
316
|
-
throw new Error('Invalid config');
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// 4. Kullanın
|
|
320
|
-
function PricingCard() {
|
|
321
|
-
const monthlyPrice = formatPrice(plans.monthly.price, 'USD');
|
|
322
|
-
const annualPrice = formatPrice(plans.annual.price, 'USD');
|
|
323
|
-
const discount = calculateDiscount(
|
|
324
|
-
plans.monthly.price * 12,
|
|
325
|
-
plans.annual.price
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
return (
|
|
329
|
-
<View>
|
|
330
|
-
<Text>Monthly: {monthlyPrice}</Text>
|
|
331
|
-
<Text>Annual: {annualPrice} (Save {discount}%)</Text>
|
|
332
|
-
</View>
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
## API Referansı
|
|
338
|
-
|
|
339
|
-
### Plan Entity
|
|
340
|
-
|
|
341
|
-
```typescript
|
|
342
|
-
class Plan {
|
|
343
|
-
readonly id: string;
|
|
344
|
-
readonly productId: string;
|
|
345
|
-
readonly period: PlanPeriod;
|
|
346
|
-
readonly price: number;
|
|
347
|
-
readonly currency: string;
|
|
348
|
-
readonly credits?: number;
|
|
349
|
-
readonly features: string[];
|
|
350
|
-
readonly metadata?: Record<string, any>;
|
|
351
|
-
|
|
352
|
-
// Metodlar
|
|
353
|
-
isBetterValueThan(other: Plan): boolean;
|
|
354
|
-
getMonthlyEquivalent(): number;
|
|
355
|
-
calculateSavings(other: Plan): number;
|
|
356
|
-
hasFeature(feature: string): boolean;
|
|
357
|
-
|
|
358
|
-
// Static metodlar
|
|
359
|
-
static create(config: PlanConfig): Plan;
|
|
360
|
-
static fromRevenueCat(package: Package): Plan;
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
### Tip Tanımlamaları
|
|
365
|
-
|
|
366
|
-
```typescript
|
|
367
|
-
type PlanPeriod = 'monthly' | 'annual' | 'lifetime';
|
|
368
|
-
|
|
369
|
-
interface PlanConfig {
|
|
370
|
-
id: string;
|
|
371
|
-
productId: string;
|
|
372
|
-
period: PlanPeriod;
|
|
373
|
-
price: number;
|
|
374
|
-
currency: string;
|
|
375
|
-
credits?: number;
|
|
376
|
-
features: string[];
|
|
377
|
-
metadata?: Record<string, any>;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
interface ValidationError {
|
|
381
|
-
field: string;
|
|
382
|
-
message: string;
|
|
383
|
-
value?: any;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
interface ValidationResult {
|
|
387
|
-
isValid: boolean;
|
|
388
|
-
errors: ValidationError[];
|
|
389
|
-
}
|
|
390
|
-
```
|
|
15
|
+
Comprehensive subscription plan configuration system.
|
|
16
|
+
|
|
17
|
+
- **Plan Types**: Monthly, annual, and lifetime plan configurations
|
|
18
|
+
- **Product Metadata**: RevenueCat product metadata management
|
|
19
|
+
- **Validation**: Configuration validation and type safety
|
|
20
|
+
- **Helper Functions**: Plan comparison and filtering utilities
|
|
21
|
+
|
|
22
|
+
### Configuration Objects
|
|
23
|
+
|
|
24
|
+
Structured configuration for different aspects of the system.
|
|
25
|
+
|
|
26
|
+
- **SubscriptionConfig**: Main subscription configuration
|
|
27
|
+
- **WalletConfig**: Credit system configuration
|
|
28
|
+
- **Plan Entities**: Individual plan definitions
|
|
29
|
+
- **Validation Rules**: Configuration validation schemas
|
|
30
|
+
|
|
31
|
+
### Helper Utilities
|
|
32
|
+
|
|
33
|
+
Plan comparison and manipulation functions.
|
|
34
|
+
|
|
35
|
+
- **Plan Comparison**: Value comparison between plans
|
|
36
|
+
- **Price Formatting**: Currency-aware price formatting
|
|
37
|
+
- **Discount Calculation**: Savings and discount calculations
|
|
38
|
+
- **Package Filtering**: Type-based package filtering
|
|
39
|
+
|
|
40
|
+
### Validation System
|
|
41
|
+
|
|
42
|
+
Comprehensive configuration validation.
|
|
43
|
+
|
|
44
|
+
- **Plan Validation**: Plan entity validation rules
|
|
45
|
+
- **Config Validation**: Complete configuration validation
|
|
46
|
+
- **Type Safety**: TypeScript type definitions
|
|
47
|
+
- **Error Messages**: Detailed validation error reporting
|
|
48
|
+
|
|
49
|
+
## Restrictions
|
|
50
|
+
|
|
51
|
+
### REQUIRED
|
|
52
|
+
|
|
53
|
+
- **Type Safety**: Always use TypeScript type definitions
|
|
54
|
+
- **Validation**: Validate configurations before runtime use
|
|
55
|
+
- **Default Values**: Provide meaningful default values
|
|
56
|
+
- **Immutable Updates**: Create new copies instead of modifying
|
|
57
|
+
|
|
58
|
+
### PROHIBITED
|
|
59
|
+
|
|
60
|
+
- **Invalid Prices**: Negative or zero prices not allowed
|
|
61
|
+
- **Missing IDs**: All plans must have valid IDs
|
|
62
|
+
- **Duplicate Plans**: No duplicate plan IDs allowed
|
|
63
|
+
- **Hardcoded Values**: Use configuration system
|
|
64
|
+
|
|
65
|
+
### CRITICAL
|
|
66
|
+
|
|
67
|
+
- **Configuration Integrity**: All configurations must be valid
|
|
68
|
+
- **Plan Consistency**: Related plans must be consistent
|
|
69
|
+
- **Currency Handling**: Proper currency code usage
|
|
70
|
+
- **Feature Lists**: Accurate feature mapping
|
|
71
|
+
|
|
72
|
+
## AI Agent Guidelines
|
|
73
|
+
|
|
74
|
+
### When Modifying Configuration System
|
|
75
|
+
|
|
76
|
+
1. **Type Definitions**: Update TypeScript types for new config
|
|
77
|
+
2. **Validation Rules**: Add validation for new fields
|
|
78
|
+
3. **Default Values**: Provide sensible defaults
|
|
79
|
+
4. **Documentation**: Document configuration options
|
|
80
|
+
|
|
81
|
+
### When Adding New Plan Types
|
|
82
|
+
|
|
83
|
+
1. **Entity Pattern**: Follow existing entity patterns
|
|
84
|
+
2. **Validation**: Add validation rules
|
|
85
|
+
3. **Helper Functions**: Create helper functions
|
|
86
|
+
4. **Testing**: Test with various configurations
|
|
87
|
+
|
|
88
|
+
### When Fixing Configuration Bugs
|
|
89
|
+
|
|
90
|
+
1. **Validation Logic**: Check validation rules
|
|
91
|
+
2. **Type Definitions**: Verify type correctness
|
|
92
|
+
3. **Default Values**: Ensure proper defaults
|
|
93
|
+
4. **Edge Cases**: Test boundary conditions
|
|
94
|
+
|
|
95
|
+
## Related Documentation
|
|
96
|
+
|
|
97
|
+
- [Paywall Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/paywall/README.md)
|
|
98
|
+
- [Wallet Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/wallet/README.md)
|
|
99
|
+
- [RevenueCat Integration](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/revenuecat/README.md)
|
|
100
|
+
- [Domain Layer](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domain/README.md)
|