@umituz/react-native-subscription 2.14.98 → 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 -395
  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 +52 -0
  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 +37 -0
  14. package/src/domains/config/domain/entities/README.md +41 -0
  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 +96 -156
  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 +43 -0
  77. package/src/revenuecat/application/ports/README.md +41 -0
  78. package/src/revenuecat/domain/README.md +42 -141
  79. package/src/revenuecat/domain/constants/README.md +41 -0
  80. package/src/revenuecat/domain/entities/README.md +42 -0
  81. package/src/revenuecat/domain/errors/README.md +47 -191
  82. package/src/revenuecat/domain/types/README.md +41 -0
  83. package/src/revenuecat/domain/value-objects/README.md +41 -0
  84. package/src/revenuecat/infrastructure/README.md +41 -0
  85. package/src/revenuecat/infrastructure/config/README.md +32 -23
  86. package/src/revenuecat/infrastructure/handlers/README.md +41 -0
  87. package/src/revenuecat/infrastructure/managers/README.md +34 -42
  88. package/src/revenuecat/infrastructure/services/README.md +42 -0
  89. package/src/revenuecat/infrastructure/utils/README.md +41 -0
  90. package/src/revenuecat/presentation/README.md +42 -0
  91. package/src/revenuecat/presentation/hooks/README.md +29 -35
  92. package/src/utils/README.md +38 -525
@@ -2,146 +2,47 @@
2
2
 
3
3
  Domain entities and types for RevenueCat integration.
4
4
 
5
- ## Overview
6
-
7
- This directory contains domain-specific entities representing RevenueCat concepts like entitlements, offerings, and packages.
8
-
9
- ## Entities
10
-
11
- ### EntitlementInfo
12
- Represents a RevenueCat entitlement.
13
-
14
- ```typescript
15
- interface EntitlementInfo {
16
- identifier: string;
17
- isActive: boolean;
18
- willRenew: boolean;
19
- expirationDate?: Date;
20
- productIdentifier?: string;
21
- period?: PackagePeriod;
22
- }
23
- ```
24
-
25
- **Usage:**
26
- ```typescript
27
- const entitlement: EntitlementInfo = {
28
- identifier: 'premium',
29
- isActive: true,
30
- willRenew: true,
31
- expirationDate: new Date('2024-12-31'),
32
- productIdentifier: 'com.app.premium.annual',
33
- period: 'annual',
34
- };
35
- ```
36
-
37
- ### OfferingInfo
38
- Represents a RevenueCat offering containing packages.
39
-
40
- ```typescript
41
- interface OfferingInfo {
42
- identifier: string;
43
- packages: PackageInfo[];
44
- lifetime?: PackageInfo;
45
- monthly?: PackageInfo;
46
- annual?: PackageInfo;
47
- }
48
- ```
49
-
50
- ### PackageInfo
51
- Represents a purchasable package.
52
-
53
- ```typescript
54
- interface PackageInfo {
55
- identifier: string;
56
- packageType: PackageType;
57
- product: ProductInfo;
58
- offeringIdentifier: string;
59
- }
60
-
61
- interface ProductInfo {
62
- identifier: string;
63
- title: string;
64
- description: string;
65
- price: number;
66
- pricePerMonth?: number;
67
- currencyCode: string;
68
- }
69
-
70
- type PackageType = 'WEEKLY' | 'MONTHLY' | 'THREE_MONTHLY' | 'SIX_MONTHLY' | 'ANNUAL' | 'LIFETIME';
71
- ```
72
-
73
- ## Constants
74
-
75
- ### Entitlement Identifiers
76
-
77
- ```typescript
78
- export const ENTITLEMENT_IDS = {
79
- PREMIUM: 'premium',
80
- PRO: 'pro',
81
- BASIC: 'basic',
82
- } as const;
83
- ```
84
-
85
- ### Package Periods
86
-
87
- ```typescript
88
- export const PACKAGE_PERIODS = {
89
- WEEKLY: 'weekly',
90
- MONTHLY: 'monthly',
91
- ANNUAL: 'annual',
92
- LIFETIME: 'lifetime',
93
- } as const;
94
- ```
95
-
96
- ## Helper Functions
97
-
98
- ### Get Package Period
99
-
100
- ```typescript
101
- function getPackagePeriod(packageType: PackageType): PackagePeriod {
102
- const periodMap: Record<PackageType, PackagePeriod> = {
103
- WEEKLY: 'monthly',
104
- MONTHLY: 'monthly',
105
- THREE_MONTHLY: 'monthly',
106
- SIX_MONTHLY: 'monthly',
107
- ANNUAL: 'annual',
108
- LIFETIME: 'lifetime',
109
- };
110
- return periodMap[packageType];
111
- }
112
- ```
113
-
114
- ### Calculate Price Per Month
115
-
116
- ```typescript
117
- function calculatePricePerMonth(packageInfo: PackageInfo): number | null {
118
- if (!packageInfo.product.pricePerMonth) {
119
- return packageInfo.product.price;
120
- }
121
- return packageInfo.product.pricePerMonth;
122
- }
123
- ```
124
-
125
- ### Format Price
126
-
127
- ```typescript
128
- function formatPrice(price: number, currencyCode: string): string {
129
- return new Intl.NumberFormat('en-US', {
130
- style: 'currency',
131
- currency: currencyCode,
132
- }).format(price);
133
- }
134
- ```
135
-
136
- ## Best Practices
137
-
138
- 1. **Type Mapping**: Map RevenueCat types to domain types
139
- 2. **Null Safety**: Handle optional properties safely
140
- 3. **Validation**: Validate RevenueCat data
141
- 4. **Formatting**: Format prices and dates consistently
142
- 5. **Constants**: Use constants for identifiers
143
-
144
- ## Related
5
+ ## Location
6
+
7
+ `src/revenuecat/domain/`
8
+
9
+ ## Strategy
10
+
11
+ Domain-specific entities representing RevenueCat concepts like entitlements, offerings, and packages, with proper type mapping and validation.
12
+
13
+ ## Restrictions
14
+
15
+ ### REQUIRED
16
+
17
+ - MUST map RevenueCat types to domain types
18
+ - MUST handle optional properties safely (null safety)
19
+ - MUST validate RevenueCat data
20
+ - MUST format prices and dates consistently
21
+ - MUST use constants for identifiers
22
+
23
+ ### PROHIBITED
24
+
25
+ - MUST NOT expose RevenueCat implementation details to other layers
26
+ - MUST NOT leak RevenueCat SDK types outside this module
27
+ - MUST NOT assume all properties are present (null safety)
28
+
29
+ ### CRITICAL
30
+
31
+ - Always validate RevenueCat data before use
32
+ - Handle all optional properties safely
33
+ - Use constants for all identifiers
34
+ - Maintain consistent formatting for prices and dates
35
+
36
+ ## AI Agent Guidelines
37
+
38
+ When working with RevenueCat domain:
39
+ 1. Type Mapping - map RevenueCat types to domain types
40
+ 2. Null Safety - handle optional properties safely
41
+ 3. Validation - validate RevenueCat data
42
+ 4. Formatting - format prices and dates consistently
43
+ 5. Constants - use constants for identifiers
44
+
45
+ ## Related Documentation
145
46
 
146
47
  - [RevenueCat README](../README.md)
147
- - [Subscription Manager](../infrastructure/managers/README.md)
48
+ - [Subscription Manager](../../infrastructure/managers/README.md)
@@ -0,0 +1,41 @@
1
+ # RevenueCat Domain Constants
2
+
3
+ ## Location
4
+ Constants used throughout the RevenueCat integration.
5
+
6
+ ## Strategy
7
+ This directory contains constant definitions for RevenueCat-specific values including entitlement IDs, error codes, and configuration defaults for maintainability and consistency.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must use constants for all RevenueCat-specific values
13
+ - Must provide clear constant names
14
+ - Must maintain consistency across codebase
15
+ - Must document constant purposes
16
+
17
+ ### PROHIBITED
18
+ - DO NOT use magic strings or numbers
19
+ - DO NOT duplicate constant definitions
20
+ - DO NOT use hardcoded values
21
+ - DO NOT create ambiguous constants
22
+
23
+ ### CRITICAL SAFETY
24
+ - All RevenueCat-specific values MUST use constants
25
+ - Constants MUST be clearly named and documented
26
+ - Constant values MUST be consistent
27
+ - Entitlement IDs MUST match RevenueCat dashboard
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Use constants for all RevenueCat-specific values
31
+ 2. Provide clear, descriptive constant names
32
+ 3. Maintain consistency across the codebase
33
+ 4. Document the purpose of each constant
34
+ 5. Organize constants by category (entitlements, offerings, errors)
35
+ 6. Validate constants match RevenueCat dashboard configuration
36
+ 7. Avoid magic strings and numbers throughout code
37
+
38
+ ## Related Documentation
39
+ - [RevenueCat Domain](../README.md)
40
+ - [RevenueCat Errors](../errors/README.md)
41
+ - [RevenueCat Entities](../entities/README.md)
@@ -0,0 +1,42 @@
1
+ # RevenueCat Domain Entities
2
+
3
+ ## Location
4
+ Core domain entities for RevenueCat integration.
5
+
6
+ ## Strategy
7
+ This directory contains TypeScript type definitions and entities representing RevenueCat concepts like customer info, entitlements, offerings, and packages with proper type safety.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must use TypeScript types for all entities
13
+ - Must maintain type safety
14
+ - Must validate entity data
15
+ - Must provide clear type definitions
16
+
17
+ ### PROHIBITED
18
+ - DO NOT use `any` type for entities
19
+ - DO NOT bypass type checking
20
+ - DO NOT create invalid entity states
21
+ - DO NOT use loose type definitions
22
+
23
+ ### CRITICAL SAFETY
24
+ - All entities MUST be type-safe
25
+ - Entity data MUST be validated
26
+ - Type definitions MUST be clear and specific
27
+ - Entity states MUST be valid
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Define clear TypeScript types for all RevenueCat concepts
31
+ 2. Maintain strict type safety for all entities
32
+ 3. Validate entity data before use
33
+ 4. Provide comprehensive type definitions
34
+ 5. Document entity properties and relationships
35
+ 6. Use type guards for runtime validation
36
+ 7. Test entity creation and validation thoroughly
37
+
38
+ ## Related Documentation
39
+ - [RevenueCat Domain](../README.md)
40
+ - [RevenueCat Value Objects](../value-objects/README.md)
41
+ - [RevenueCat Errors](../errors/README.md)
42
+ - [RevenueCat Types](../types/README.md)
@@ -2,196 +2,52 @@
2
2
 
3
3
  Domain-specific errors for RevenueCat operations.
4
4
 
5
- ## Overview
6
-
7
- This directory contains custom error classes for RevenueCat-specific error conditions.
8
-
9
- ## Error Types
10
-
11
- ### PurchaseError
12
- Base error for purchase failures.
13
-
14
- ```typescript
15
- class PurchaseError extends Error {
16
- constructor(
17
- message: string,
18
- public code: string,
19
- public underlyingError?: Error
20
- ) {
21
- super(message);
22
- this.name = 'PurchaseError';
23
- }
24
- }
25
- ```
26
-
27
- **Common Codes:**
28
- - `PURCHASE_CANCELLED`: User cancelled purchase
29
- - `PURCHASE_INVALID`: Invalid purchase data
30
- - `NETWORK_ERROR`: Network connectivity issue
31
- - `STORE_PROBLEM`: App store issue
32
-
33
- ### EntitlementNotFoundError
34
- Thrown when expected entitlement is not found.
35
-
36
- ```typescript
37
- class EntitlementNotFoundError extends Error {
38
- constructor(public entitlementId: string) {
39
- super(
40
- `Entitlement not found: ${entitlementId}`,
41
- 'ENTITLEMENT_NOT_FOUND'
42
- );
43
- this.name = 'EntitlementNotFoundError';
44
- }
45
- }
46
- ```
47
-
48
- **Usage:**
49
- ```typescript
50
- import { EntitlementNotFoundError } from './errors/EntitlementNotFoundError';
51
-
52
- function getEntitlement(customerInfo: CustomerInfo, id: string): Entitlement {
53
- const entitlement = customerInfo.entitlements.active[id];
54
- if (!entitlement) {
55
- throw new EntitlementNotFoundError(id);
56
- }
57
- return entitlement;
58
- }
59
- ```
60
-
61
- ### ConfigurationError
62
- Thrown when RevenueCat configuration is invalid.
63
-
64
- ```typescript
65
- class ConfigurationError extends Error {
66
- constructor(missingConfig: string[]) {
67
- super(
68
- `RevenueCat not configured: ${missingConfig.join(', ')}`,
69
- 'CONFIGURATION_ERROR'
70
- );
71
- this.name = 'ConfigurationError';
72
- }
73
- }
74
- ```
75
-
76
- **Usage:**
77
- ```typescript
78
- function validateRevenueCatConfig(config: any) {
79
- const required = ['apiKey'];
80
- const missing = required.filter(key => !config[key]);
81
-
82
- if (missing.length > 0) {
83
- throw new ConfigurationError(missing);
84
- }
85
- }
86
- ```
87
-
88
- ### OfferingNotFoundError
89
- Thrown when requested offering is not available.
90
-
91
- ```typescript
92
- class OfferingNotFoundError extends Error {
93
- constructor(public offeringId: string) {
94
- super(
95
- `Offering not found: ${offeringId}`,
96
- 'OFFERING_NOT_FOUND'
97
- );
98
- this.name = 'OfferingNotFoundError';
99
- }
100
- }
101
- ```
102
-
103
- ## Error Handling Pattern
104
-
105
- ```typescript
106
- import {
107
- PurchaseError,
108
- EntitlementNotFoundError,
109
- ConfigurationError
110
- } from './errors';
111
-
112
- async function handlePurchase(package: Package) {
113
- try {
114
- const result = await Purchases.purchasePackage(package);
115
- return { success: true, result };
116
- } catch (error) {
117
- if (error instanceof UserCancelledError) {
118
- // User cancelled - not really an error
119
- return { success: false, cancelled: true };
120
- }
121
-
122
- if (error instanceof PurchaseError) {
123
- switch (error.code) {
124
- case 'PURCHASE_CANCELLED':
125
- analytics.track('purchase_cancelled');
126
- break;
127
- case 'NETWORK_ERROR':
128
- showRetryDialog();
129
- break;
130
- case 'STORE_PROBLEM':
131
- showStoreProblemDialog();
132
- break;
133
- default:
134
- showErrorDialog(error.message);
135
- }
136
- return { success: false, error };
137
- }
138
-
139
- // Unexpected error
140
- console.error('Unexpected purchase error:', error);
141
- return { success: false, error };
142
- }
143
- }
144
- ```
145
-
146
- ## Error Recovery
147
-
148
- ### Retry Logic
149
- ```typescript
150
- async function purchaseWithRetry(pkg: Package, maxRetries = 3) {
151
- for (let i = 0; i < maxRetries; i++) {
152
- try {
153
- const result = await Purchases.purchasePackage(pkg);
154
- return result;
155
- } catch (error) {
156
- if (error instanceof PurchaseError) {
157
- if (error.code === 'NETWORK_ERROR' && i < maxRetries - 1) {
158
- await delay(1000 * (i + 1)); // Exponential backoff
159
- continue;
160
- }
161
- }
162
- throw error;
163
- }
164
- }
165
- }
166
- ```
167
-
168
- ### User-Friendly Messages
169
- ```typescript
170
- function getUserFriendlyMessage(error: Error): string {
171
- if (error instanceof PurchaseError) {
172
- const messages: Record<string, string> = {
173
- PURCHASE_CANCELLED: 'Purchase was cancelled',
174
- NETWORK_ERROR: 'Network error. Please check your connection.',
175
- STORE_PROBLEM: 'There was an issue with the app store.',
176
- PURCHASE_INVALID: 'Purchase data is invalid.',
177
- };
178
- return messages[error.code] || 'An error occurred';
179
- }
180
- return error.message;
181
- }
182
- ```
183
-
184
- ## Best Practices
185
-
186
- 1. **Specific Errors**: Use specific error types
187
- 2. **Error Codes**: Include machine-readable codes
188
- 3. **Context**: Include relevant data in error
189
- 4. **Recovery**: Implement recovery strategies
190
- 5. **User Feedback**: Convert errors to user-friendly messages
191
- 6. **Logging**: Log errors for debugging
192
- 7. **Analytics**: Track errors for monitoring
193
-
194
- ## Related
5
+ ## Location
6
+
7
+ `src/revenuecat/domain/errors/`
8
+
9
+ ## Strategy
10
+
11
+ Custom error classes for RevenueCat-specific error conditions, providing typed error handling for purchase, entitlement, configuration, and offering failures.
12
+
13
+ ## Restrictions
14
+
15
+ ### REQUIRED
16
+
17
+ - MUST use specific error types (not generic errors)
18
+ - MUST include machine-readable error codes
19
+ - MUST include relevant contextual data
20
+ - MUST implement recovery strategies
21
+ - MUST convert errors to user-friendly messages
22
+ - MUST log errors for debugging
23
+ - MUST track errors for analytics
24
+
25
+ ### PROHIBITED
26
+
27
+ - MUST NOT expose sensitive RevenueCat API keys or tokens
28
+ - MUST NOT leak raw RevenueCat errors to users
29
+ - MUST NOT ignore error conditions
30
+
31
+ ### CRITICAL
32
+
33
+ - Always implement specific error types
34
+ - Include machine-readable codes for programmatic handling
35
+ - Provide recovery strategies where applicable
36
+ - Convert technical errors to user-friendly messages
37
+ - Log all errors for debugging and monitoring
38
+
39
+ ## AI Agent Guidelines
40
+
41
+ When working with RevenueCat errors:
42
+ 1. Specific Errors - use specific error types
43
+ 2. Error Codes - include machine-readable codes
44
+ 3. Context - include relevant data in error
45
+ 4. Recovery - implement recovery strategies
46
+ 5. User Feedback - convert errors to user-friendly messages
47
+ 6. Logging - log errors for debugging
48
+ 7. Analytics - track errors for monitoring
49
+
50
+ ## Related Documentation
195
51
 
196
52
  - [RevenueCat Domain](../README.md)
197
- - [RevenueCat Services](../infrastructure/services/README.md)
53
+ - [RevenueCat Services](../../infrastructure/services/README.md)
@@ -0,0 +1,41 @@
1
+ # RevenueCat Domain Types
2
+
3
+ ## Location
4
+ Type definitions and type utilities for RevenueCat integration.
5
+
6
+ ## Strategy
7
+ This directory contains TypeScript type definitions, type guards, and utility types used throughout the RevenueCat integration for type safety and compile-time checks.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must use type guards for runtime checks
13
+ - Must provide utility types for common operations
14
+ - Must maintain type safety throughout
15
+ - Must use strict TypeScript types
16
+
17
+ ### PROHIBITED
18
+ - DO NOT use `any` type
19
+ - DO NOT bypass type guards
20
+ - DO NOT ignore type safety
21
+ - DO NOT use loose type definitions
22
+
23
+ ### CRITICAL SAFETY
24
+ - All type checks MUST use type guards
25
+ - All types MUST be strictly defined
26
+ - Type assertions MUST be safe
27
+ - Utility types MUST be used appropriately
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Use type guards for runtime type checking
31
+ 2. Define utility types for common operations
32
+ 3. Maintain strict type safety throughout codebase
33
+ 4. Provide clear type definitions for all RevenueCat concepts
34
+ 5. Use type assertions only when safe
35
+ 6. Test type guards thoroughly
36
+ 7. Document complex types with comments
37
+
38
+ ## Related Documentation
39
+ - [RevenueCat Domain](../README.md)
40
+ - [RevenueCat Entities](../entities/README.md)
41
+ - [RevenueCat Value Objects](../value-objects/README.md)
@@ -0,0 +1,41 @@
1
+ # RevenueCat Domain Value Objects
2
+
3
+ ## Location
4
+ Value objects for RevenueCat integration.
5
+
6
+ ## Strategy
7
+ This directory contains value objects - immutable types that represent concepts in the RevenueCat domain with no identity, defined by their attributes rather than identity.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must validate in constructor
13
+ - Must keep value objects immutable
14
+ - Must implement proper equality based on values
15
+ - Must provide locale-aware formatting
16
+
17
+ ### PROHIBITED
18
+ - DO NOT modify value objects after creation
19
+ - DO NOT bypass validation in constructor
20
+ - DO NOT use identity-based equality
21
+ - DO NOT ignore locale in formatting
22
+
23
+ ### CRITICAL SAFETY
24
+ - All value objects MUST be immutable
25
+ - Validation MUST happen in constructor
26
+ - Equality MUST be based on values, not identity
27
+ - Formatting MUST be locale-aware
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Never modify value objects after creation
31
+ 2. Validate all inputs in constructor with fail-fast
32
+ 3. Implement proper equality based on values
33
+ 4. Provide locale-aware formatting methods
34
+ 5. Return new instances for all operations
35
+ 6. Use TypeScript for compile-time type safety
36
+ 7. Provide toString/JSON methods if needed for serialization
37
+
38
+ ## Related Documentation
39
+ - [RevenueCat Domain](../README.md)
40
+ - [RevenueCat Entities](../entities/README.md)
41
+ - [RevenueCat Types](../types/README.md)
@@ -0,0 +1,41 @@
1
+ # RevenueCat Infrastructure
2
+
3
+ ## Location
4
+ Infrastructure layer for RevenueCat integration.
5
+
6
+ ## Strategy
7
+ This directory contains concrete implementations of RevenueCat interfaces, handling communication with the RevenueCat SDK and external services with proper error handling and data transformation.
8
+
9
+ ## Restrictions
10
+
11
+ ### REQUIRED
12
+ - Must integrate directly with RevenueCat SDK
13
+ - Must convert SDK errors to domain errors
14
+ - Must map SDK types to domain types
15
+ - Must manage purchase and customer info events
16
+
17
+ ### PROHIBITED
18
+ - DO NOT expose SDK errors directly to application
19
+ - DO NOT use SDK types in domain layer
20
+ - DO NOT skip error mapping
21
+ - DO NOT ignore lifecycle events
22
+
23
+ ### CRITICAL SAFETY
24
+ - All SDK errors MUST be converted to domain errors
25
+ - All SDK types MUST be mapped to domain types
26
+ - All events MUST be handled appropriately
27
+ - Configuration MUST be set up correctly
28
+
29
+ ## AI Agent Guidelines
30
+ 1. Integrate directly with RevenueCat SDK
31
+ 2. Convert all SDK errors to domain errors
32
+ 3. Map all SDK types to domain types
33
+ 4. Manage purchase and customer info events properly
34
+ 5. Set up and configure RevenueCat correctly
35
+ 6. Test SDK integration thoroughly
36
+ 7. Handle all edge cases in SDK communication
37
+
38
+ ## Related Documentation
39
+ - [RevenueCat Integration](../README.md)
40
+ - [RevenueCat Application](../application/README.md)
41
+ - [RevenueCat Domain](../domain/README.md)