@umituz/react-native-subscription 2.14.99 → 2.14.101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +211 -394
  2. package/package.json +3 -3
  3. package/src/application/README.md +46 -225
  4. package/src/application/ports/README.md +42 -97
  5. package/src/domain/README.md +36 -384
  6. package/src/domain/constants/README.md +0 -56
  7. package/src/domain/entities/README.md +43 -169
  8. package/src/domain/entities/SubscriptionStatus.ts +1 -1
  9. package/src/domain/errors/README.md +33 -287
  10. package/src/domain/value-objects/README.md +43 -179
  11. package/src/domains/README.md +50 -238
  12. package/src/domains/README.md.bak +274 -0
  13. package/src/domains/config/README.md +93 -383
  14. package/src/domains/config/domain/README.md +23 -376
  15. package/src/domains/config/domain/entities/README.md +34 -343
  16. package/src/domains/paywall/README.md +99 -369
  17. package/src/domains/paywall/components/README.md +34 -178
  18. package/src/domains/paywall/entities/README.md +34 -193
  19. package/src/domains/paywall/hooks/README.md +34 -122
  20. package/src/domains/wallet/README.md +34 -275
  21. package/src/domains/wallet/README.md.bak +209 -0
  22. package/src/domains/wallet/domain/README.md +34 -101
  23. package/src/domains/wallet/domain/entities/README.md +34 -115
  24. package/src/domains/wallet/domain/errors/README.md +34 -151
  25. package/src/domains/wallet/infrastructure/README.md +34 -89
  26. package/src/domains/wallet/presentation/components/README.md +34 -224
  27. package/src/domains/wallet/presentation/components/TransactionItem.tsx +1 -1
  28. package/src/domains/wallet/presentation/hooks/README.md +34 -248
  29. package/src/infrastructure/README.md +37 -496
  30. package/src/infrastructure/mappers/README.md +0 -13
  31. package/src/infrastructure/repositories/README.md +74 -360
  32. package/src/infrastructure/services/ActivationHandler.ts +1 -1
  33. package/src/infrastructure/services/README.md +95 -370
  34. package/src/infrastructure/services/SubscriptionService.ts +1 -1
  35. package/src/presentation/README.md +123 -408
  36. package/src/presentation/README.md.bak +172 -0
  37. package/src/presentation/components/README.md +151 -179
  38. package/src/presentation/components/README.md.bak +217 -0
  39. package/src/presentation/components/details/CreditRow.md +65 -310
  40. package/src/presentation/components/details/DetailRow.md +63 -255
  41. package/src/presentation/components/details/PremiumDetailsCard.md +65 -238
  42. package/src/presentation/components/details/PremiumStatusBadge.md +64 -239
  43. package/src/presentation/components/details/README.md +97 -447
  44. package/src/presentation/components/feedback/PaywallFeedbackModal.md +63 -287
  45. package/src/presentation/components/feedback/README.md +97 -445
  46. package/src/presentation/components/paywall/PaywallModal.md +66 -416
  47. package/src/presentation/components/paywall/README.md +50 -186
  48. package/src/presentation/components/sections/README.md +97 -466
  49. package/src/presentation/components/sections/SubscriptionSection.md +92 -244
  50. package/src/presentation/hooks/README.md +154 -741
  51. package/src/presentation/hooks/useAuthAwarePurchase.md +58 -325
  52. package/src/presentation/hooks/useAuthGate.md +61 -375
  53. package/src/presentation/hooks/useAuthSubscriptionSync.md +66 -370
  54. package/src/presentation/hooks/useCreditChecker.md +73 -378
  55. package/src/presentation/hooks/useCredits.md +74 -313
  56. package/src/presentation/hooks/useCredits.md.bak +231 -0
  57. package/src/presentation/hooks/useCreditsGate.md +66 -318
  58. package/src/presentation/hooks/useDeductCredit.md +0 -76
  59. package/src/presentation/hooks/useDeductCredit.ts +1 -1
  60. package/src/presentation/hooks/useDevTestCallbacks.md +63 -394
  61. package/src/presentation/hooks/useFeatureGate.md +105 -150
  62. package/src/presentation/hooks/useFeatureGate.md.bak +284 -0
  63. package/src/presentation/hooks/useInitializeCredits.md +64 -430
  64. package/src/presentation/hooks/usePaywall.md +61 -306
  65. package/src/presentation/hooks/usePaywallOperations.md +64 -458
  66. package/src/presentation/hooks/usePaywallVisibility.md +67 -316
  67. package/src/presentation/hooks/usePremium.md +84 -226
  68. package/src/presentation/hooks/usePremiumGate.md +60 -395
  69. package/src/presentation/hooks/usePremiumWithCredits.md +64 -401
  70. package/src/presentation/hooks/useSubscription.md +66 -422
  71. package/src/presentation/hooks/useSubscriptionDetails.md +65 -410
  72. package/src/presentation/hooks/useSubscriptionGate.md +80 -164
  73. package/src/presentation/hooks/useSubscriptionSettingsConfig.md +66 -346
  74. package/src/presentation/hooks/useSubscriptionStatus.md +66 -396
  75. package/src/presentation/hooks/useUserTier.md +63 -328
  76. package/src/presentation/hooks/useUserTierWithRepository.md +64 -424
  77. package/src/presentation/screens/README.md +48 -190
  78. package/src/presentation/types/README.md +0 -16
  79. package/src/presentation/utils/README.md +0 -21
  80. package/src/presentation/utils/subscriptionDateUtils.ts +1 -1
  81. package/src/revenuecat/README.md +99 -518
  82. package/src/revenuecat/application/README.md +35 -150
  83. package/src/revenuecat/application/ports/README.md +34 -162
  84. package/src/revenuecat/domain/README.md +42 -141
  85. package/src/revenuecat/domain/constants/README.md +34 -176
  86. package/src/revenuecat/domain/entities/README.md +34 -374
  87. package/src/revenuecat/domain/errors/README.md +47 -191
  88. package/src/revenuecat/domain/types/README.md +34 -366
  89. package/src/revenuecat/domain/value-objects/README.md +34 -434
  90. package/src/revenuecat/infrastructure/README.md +34 -43
  91. package/src/revenuecat/infrastructure/config/README.md +32 -23
  92. package/src/revenuecat/infrastructure/handlers/README.md +34 -211
  93. package/src/revenuecat/infrastructure/managers/README.md +34 -42
  94. package/src/revenuecat/infrastructure/services/README.md +35 -318
  95. package/src/revenuecat/infrastructure/utils/README.md +34 -375
  96. package/src/revenuecat/presentation/README.md +34 -176
  97. package/src/revenuecat/presentation/hooks/README.md +29 -35
  98. package/src/utils/README.md +38 -525
@@ -0,0 +1,274 @@
1
+ # Domains
2
+
3
+ Specialized domain modules implementing specific business logic and features.
4
+
5
+ ## Location
6
+
7
+ **Directory**: `src/domains/`
8
+
9
+ **Type**: Domain Collection
10
+
11
+ ## Strategy
12
+
13
+ ### Domain-Driven Design
14
+
15
+ This directory implements Domain-Driven Design (DDD) principles:
16
+
17
+ 1. **Wallet Domain**: Credit balance, transactions, and purchase flow
18
+ 2. **Paywall Domain**: Upgrade prompts, subscription management
19
+ 3. **Config Domain**: Feature flags, subscription configuration
20
+
21
+ Each domain is self-contained with:
22
+ - **Domain Layer**: Business logic, entities, value objects
23
+ - **Infrastructure Layer**: External integrations, repositories
24
+ - **Presentation Layer**: Domain-specific hooks and components
25
+
26
+ ### Architecture Pattern
27
+
28
+ ```
29
+ ┌─────────────────────────────────────┐
30
+ │ Application Layer │
31
+ │ (Use Cases, Orchestration) │
32
+ └──────────────┬──────────────────────┘
33
+
34
+ ┌───────┴────────┐
35
+ │ │
36
+ ┌──────▼──────┐ ┌─────▼──────┐
37
+ │ Wallet │ │ Paywall │
38
+ │ Domain │ │ Domain │
39
+ ├─────────────┤ ├────────────┤
40
+ │ Domain │ │ Domain │
41
+ │ Infra │ │ Infra │
42
+ │ Presentation│ │ Presentation│
43
+ └──────┬──────┘ └─────┬──────┘
44
+ │ │
45
+ └────────┬───────┘
46
+
47
+ ┌────────▼──────────┐
48
+ │ Shared Infra │
49
+ │ (Firebase, etc) │
50
+ └───────────────────┘
51
+ ```
52
+
53
+ ## Domain Modules
54
+
55
+ ### Wallet Domain (`wallet/`)
56
+
57
+ **Responsibility**: Credit balance and transaction management
58
+
59
+ **Key Features**:
60
+ - Credit balance tracking
61
+ - Transaction history
62
+ - Purchase initialization
63
+ - Real-time updates
64
+
65
+ **Documentation**: `wallet/README.md`
66
+
67
+ ### Paywall Domain (`paywall/`)
68
+
69
+ **Responsibility**: Subscription upgrade flows and paywall UI
70
+
71
+ **Key Features**:
72
+ - Paywall display logic
73
+ - Subscription management
74
+ - Feature gating
75
+ - Upgrade prompts
76
+
77
+ **Documentation**: `paywall/README.md`
78
+
79
+ ### Config Domain (`config/`)
80
+
81
+ **Responsibility**: Subscription configuration and feature flags
82
+
83
+ **Key Features**:
84
+ - Subscription tiers
85
+ - Feature configuration
86
+ - Pricing rules
87
+ - Feature flags
88
+
89
+ **Documentation**: `config/README.md`
90
+
91
+ ## Restrictions
92
+
93
+ ### REQUIRED
94
+
95
+ - **Domain Isolation**: Domains MUST NOT directly depend on each other
96
+ - **Interface Segregation**: Use well-defined interfaces between layers
97
+ - **Dependency Inversion**: Depend on abstractions, not concretions
98
+ - **Testability**: All domains MUST be testable in isolation
99
+
100
+ ### PROHIBITED
101
+
102
+ - **NEVER** share domain logic between domains (use shared kernel if needed)
103
+ - **NEVER** create circular dependencies between domains
104
+ - **DO NOT** bypass domain layer from presentation
105
+ - **NEVER** expose infrastructure details to other domains
106
+
107
+ ### CRITICAL SAFETY
108
+
109
+ - **ALWAYS** validate invariants at domain boundaries
110
+ - **ALWAYS** implement domain errors for business rule violations
111
+ - **NEVER** allow inconsistent domain state
112
+ - **MUST** implement proper transaction boundaries
113
+ - **ALWAYS** sanitize inputs from external sources
114
+
115
+ ## Rules
116
+
117
+ ### Domain Boundaries
118
+
119
+ ```typescript
120
+ // CORRECT - Respecting domain boundaries
121
+ // Wallet domain handles credits
122
+ const { credits } = useCredits(); // From wallet domain
123
+
124
+ // Paywall domain handles upgrades
125
+ const { showPaywall } = usePaywallOperations(); // From paywall domain
126
+
127
+ // INCORRECT - Crossing domain boundaries
128
+ const walletRepository = new WalletRepository();
129
+ // Directly using wallet repo in paywall component
130
+ ```
131
+
132
+ ### Domain Errors
133
+
134
+ ```typescript
135
+ // CORRECT - Domain-specific errors
136
+ class InsufficientCreditsError extends DomainError {
137
+ constructor(required: number, available: number) {
138
+ super(`Insufficient credits: need ${required}, have ${available}`);
139
+ }
140
+ }
141
+
142
+ // INCORRECT - Generic errors
143
+ throw new Error('Not enough credits'); // Loses domain context
144
+ ```
145
+
146
+ ### Dependency Direction
147
+
148
+ ```typescript
149
+ // CORRECT - Dependency inversion
150
+ interface ICreditsRepository {
151
+ getBalance(userId: string): Promise<number>;
152
+ deductCredits(userId: string, amount: number): Promise<void>;
153
+ }
154
+
155
+ // Domain depends on interface, not implementation
156
+ class CreditService {
157
+ constructor(private repo: ICreditsRepository) {}
158
+ }
159
+
160
+ // INCORRECT - Concrete dependency
161
+ class CreditService {
162
+ constructor(private repo: FirebaseCreditsRepository) {}
163
+ // Tightly coupled to Firebase
164
+ }
165
+ ```
166
+
167
+ ## AI Agent Guidelines
168
+
169
+ ### When Working with Domains
170
+
171
+ 1. **Always** respect domain boundaries
172
+ 2. **Always** use dependency inversion
173
+ 3. **Always** implement domain-specific errors
174
+ 4. **Always** validate invariants at boundaries
175
+ 5. **Never** create circular dependencies
176
+
177
+ ### Integration Checklist
178
+
179
+ - [ ] Identify correct domain for feature
180
+ - [ ] Respect domain boundaries
181
+ - [ ] Use appropriate interfaces
182
+ - [ ] Handle domain errors
183
+ - [ ] Test domain in isolation
184
+ - [ ] Document domain interactions
185
+ - [ ] Validate invariants
186
+ - [ ] Implement transaction boundaries
187
+ - [ ] Test cross-domain scenarios
188
+ - [ ] Verify no circular dependencies
189
+
190
+ ### Common Patterns
191
+
192
+ 1. **Aggregate Root**: Single entry point for aggregate
193
+ 2. **Value Objects**: Immutable values with no identity
194
+ 3. **Domain Events**: Publish domain events for side effects
195
+ 4. **Repositories**: Abstract data access
196
+ 5. **Factories**: Complex object creation
197
+ 6. **Domain Services**: Business logic that doesn't fit entities
198
+ 7. **Specification**: Business rule encapsulation
199
+ 8. **Anti-Corruption Layer**: Isolate from external systems
200
+
201
+ ## Related Documentation
202
+
203
+ - **Wallet Domain**: `wallet/README.md`
204
+ - **Paywall Domain**: `paywall/README.md`
205
+ - **Config Domain**: `config/README.md`
206
+ - **Domain Layer**: `../domain/README.md`
207
+ - **Infrastructure**: `../infrastructure/README.md`
208
+
209
+ ## Domain Structure
210
+
211
+ ```
212
+ src/domains/
213
+ ├── wallet/ # Wallet and credits domain
214
+ │ ├── domain/ # Business logic
215
+ │ ├── infrastructure/ # External integrations
216
+ │ └── presentation/ # UI hooks and components
217
+ ├── paywall/ # Paywall and upgrades domain
218
+ │ ├── domain/
219
+ │ ├── infrastructure/
220
+ │ └── presentation/
221
+ └── config/ # Configuration domain
222
+ ├── domain/
223
+ ├── infrastructure/
224
+ └── presentation/
225
+ ```
226
+
227
+ ## Creating a New Domain
228
+
229
+ When creating a new domain:
230
+
231
+ 1. **Define Boundaries**: What is the domain's responsibility?
232
+ 2. **Identify Entities**: What are the core business objects?
233
+ 3. **Define Invariants**: What rules must always be true?
234
+ 4. **Design Interfaces**: How will other layers interact?
235
+ 5. **Implement Repository**: Abstract data access
236
+ 6. **Create Presentation Layer**: Hooks and components
237
+ 7. **Write Tests**: Test domain logic in isolation
238
+ 8. **Document**: Provide comprehensive README
239
+
240
+ Example:
241
+
242
+ ```typescript
243
+ // Domain entity
244
+ export class FeatureFlag {
245
+ constructor(
246
+ public readonly id: string,
247
+ public readonly name: string,
248
+ private _isEnabled: boolean
249
+ ) {}
250
+
251
+ get isEnabled(): boolean {
252
+ return this._isEnabled;
253
+ }
254
+
255
+ enable(): void {
256
+ this._isEnabled = true;
257
+ }
258
+
259
+ disable(): void {
260
+ this._isEnabled = false;
261
+ }
262
+ }
263
+
264
+ // Repository interface
265
+ export interface IFeatureFlagRepository {
266
+ findById(id: string): Promise<FeatureFlag | null>;
267
+ save(flag: FeatureFlag): Promise<void>;
268
+ }
269
+
270
+ // Presentation hook
271
+ export function useFeatureFlag(featureId: string) {
272
+ // Hook implementation
273
+ }
274
+ ```