@umituz/react-native-subscription 2.37.39 → 2.37.40
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/package.json +1 -1
- package/src/domains/credits/application/CreditLimitCalculator.ts +1 -9
- package/src/domains/credits/application/DeductCreditsCommand.ts +13 -6
- package/src/domains/credits/application/RefundCreditsCommand.ts +1 -5
- package/src/domains/credits/application/credit-strategies/TrialCreditStrategy.ts +1 -5
- package/src/domains/credits/application/creditDocumentHelpers.ts +2 -9
- package/src/domains/credits/core/Credits.ts +0 -23
- package/src/domains/credits/core/CreditsMapper.ts +0 -6
- package/src/domains/credits/core/UserCreditsDocument.ts +0 -12
- package/src/domains/credits/infrastructure/CreditsRepositoryManager.ts +0 -21
- package/src/domains/credits/infrastructure/operations/CreditsWriter.ts +2 -1
- package/src/domains/credits/presentation/deduct-credit/useDeductCredit.ts +2 -2
- package/src/domains/credits/presentation/useCredits.ts +10 -9
- package/src/domains/paywall/components/PaywallContainer.types.ts +0 -28
- package/src/domains/paywall/components/PaywallModal.styles.ts +0 -4
- package/src/domains/paywall/entities/types.ts +0 -5
- package/src/domains/paywall/hooks/usePaywallActions.ts +1 -15
- package/src/domains/revenuecat/core/errors/RevenueCatError.ts +0 -6
- package/src/domains/revenuecat/core/errors/RevenueCatErrorHandler.ts +0 -24
- package/src/domains/revenuecat/core/errors/RevenueCatErrorMessages.ts +0 -18
- package/src/domains/revenuecat/core/errors/index.ts +0 -4
- package/src/domains/revenuecat/core/types/RevenueCatConfig.ts +3 -7
- package/src/domains/revenuecat/core/types/RevenueCatData.ts +4 -9
- package/src/domains/revenuecat/core/types/RevenueCatTypes.ts +5 -65
- package/src/domains/revenuecat/core/types/index.ts +0 -4
- package/src/domains/revenuecat/infrastructure/services/UserSwitchMutex.ts +1 -24
- package/src/domains/subscription/application/SubscriptionAuthListener.ts +5 -21
- package/src/domains/subscription/application/SubscriptionInitializerTypes.ts +1 -5
- package/src/domains/subscription/application/SubscriptionSyncService.ts +11 -2
- package/src/domains/subscription/application/SubscriptionSyncUtils.ts +1 -1
- package/src/domains/subscription/application/initializer/BackgroundInitializer.ts +15 -2
- package/src/domains/subscription/application/initializer/ServiceConfigurator.ts +9 -2
- package/src/domains/subscription/constants/thresholds.ts +0 -9
- package/src/domains/subscription/core/SubscriptionConstants.ts +0 -4
- package/src/domains/subscription/core/SubscriptionStatus.ts +11 -21
- package/src/domains/subscription/core/SubscriptionStatusHandlers.ts +4 -7
- package/src/domains/subscription/infrastructure/handlers/PurchaseStatusResolver.ts +1 -1
- package/src/domains/subscription/infrastructure/hooks/subscriptionQueryKeys.ts +0 -13
- package/src/domains/subscription/infrastructure/hooks/usePurchasePackage.ts +0 -18
- package/src/domains/subscription/infrastructure/hooks/useRestorePurchase.ts +3 -17
- package/src/domains/subscription/infrastructure/hooks/useRevenueCatTrialEligibility.ts +0 -17
- package/src/domains/subscription/infrastructure/hooks/useSubscriptionPackages.ts +0 -19
- package/src/domains/subscription/infrastructure/hooks/useSubscriptionQueries.ts +0 -6
- package/src/domains/subscription/infrastructure/managers/subscriptionManagerUtils.ts +0 -17
- package/src/domains/subscription/infrastructure/state/initializationState.ts +0 -25
- package/src/domains/subscription/infrastructure/utils/InitializationCache.ts +0 -21
- package/src/domains/subscription/infrastructure/utils/PremiumStatusSyncer.ts +2 -7
- package/src/domains/subscription/infrastructure/utils/authPurchaseState.ts +0 -5
- package/src/domains/subscription/infrastructure/utils/renewal/PackageTierComparator.ts +1 -0
- package/src/domains/subscription/infrastructure/utils/trialEligibilityUtils.ts +0 -18
- package/src/domains/subscription/presentation/components/details/PremiumDetailsCard.styles.ts +0 -5
- package/src/domains/subscription/presentation/components/details/PremiumDetailsCardTypes.ts +0 -5
- package/src/domains/subscription/presentation/components/feedback/paywallFeedbackStyles.ts +0 -5
- package/src/domains/subscription/presentation/stores/index.ts +0 -4
- package/src/domains/subscription/presentation/stores/purchaseLoadingStore.ts +0 -13
- package/src/domains/subscription/presentation/useAuthAwarePurchase.ts +30 -21
- package/src/domains/subscription/presentation/usePaywallVisibility.ts +0 -9
- package/src/domains/subscription/presentation/useSubscriptionStatus.ts +8 -11
- package/src/domains/subscription/utils/authGuards.ts +3 -0
- package/src/domains/trial/application/TrialService.ts +0 -9
- package/src/domains/trial/core/TrialTypes.ts +0 -8
- package/src/domains/wallet/domain/mappers/TransactionMapper.ts +0 -5
- package/src/domains/wallet/domain/types/transaction.types.ts +0 -7
- package/src/domains/wallet/index.ts +0 -7
- package/src/domains/wallet/infrastructure/config/walletConfig.ts +0 -11
- package/src/domains/wallet/presentation/hooks/useTransactionHistory.ts +6 -3
- package/src/domains/wallet/presentation/hooks/useWallet.ts +0 -7
- package/src/domains/wallet/utils/transactionIconMap.ts +0 -10
- package/src/global.d.ts +0 -6
- package/src/index.ts +1 -4
- package/src/init/createSubscriptionInitModule.ts +12 -2
- package/src/init/index.ts +1 -5
- package/src/presentation/hooks/feedback/useFeedbackSubmit.ts +0 -11
- package/src/shared/application/FeedbackService.ts +3 -21
- package/src/shared/application/ports/ISubscriptionRepository.ts +0 -4
- package/src/shared/infrastructure/SubscriptionEventBus.ts +0 -13
- package/src/shared/infrastructure/firestore/collectionUtils.ts +1 -17
- package/src/shared/infrastructure/firestore/index.ts +0 -4
- package/src/shared/infrastructure/firestore/resultUtils.ts +0 -12
- package/src/shared/infrastructure/react-query/hooks/usePreviousUserCleanup.ts +0 -17
- package/src/shared/infrastructure/react-query/queryConfig.ts +0 -15
- package/src/shared/utils/BaseError.ts +0 -5
- package/src/shared/utils/Result.ts +0 -20
- package/src/shared/utils/dateConverter.ts +6 -46
- package/src/utils/appUtils.ts +0 -16
- package/src/utils/creditMapper.ts +0 -7
- package/src/utils/dateUtils.compare.ts +0 -24
- package/src/utils/dateUtils.core.ts +0 -39
- package/src/utils/dateUtils.format.ts +0 -41
- package/src/utils/dateUtils.math.ts +0 -41
- package/src/utils/dateUtils.ts +0 -5
- package/src/utils/packagePeriodUtils.ts +0 -20
- package/src/utils/packageTypeDetector.ts +1 -21
- package/src/utils/premiumStatusUtils.ts +1 -14
- package/src/utils/priceUtils.ts +0 -35
- package/src/utils/tierUtils.ts +1 -8
- package/src/utils/types.ts +1 -25
- package/src/utils/validation.ts +1 -7
- package/src/domains/README.md +0 -52
- package/src/domains/config/domain/README.md +0 -37
- package/src/domains/config/domain/entities/README.md +0 -41
- package/src/domains/paywall/README.md +0 -101
- package/src/domains/paywall/entities/README.md +0 -40
- package/src/domains/paywall/hooks/README.md +0 -41
- package/src/domains/subscription/application/syncConstants.ts +0 -1
- package/src/domains/subscription/infrastructure/README.md +0 -41
- package/src/domains/subscription/infrastructure/config/README.md +0 -49
- package/src/domains/subscription/infrastructure/handlers/README.md +0 -41
- package/src/domains/subscription/infrastructure/hooks/README.md +0 -50
- package/src/domains/subscription/infrastructure/managers/README.md +0 -41
- package/src/domains/subscription/infrastructure/services/README.md +0 -42
- package/src/domains/subscription/infrastructure/utils/README.md +0 -41
- package/src/domains/subscription/presentation/components/README.md +0 -155
- package/src/domains/subscription/presentation/components/details/CreditRow.md +0 -92
- package/src/domains/subscription/presentation/components/details/DetailRow.md +0 -91
- package/src/domains/subscription/presentation/components/details/PremiumDetailsCard.md +0 -93
- package/src/domains/subscription/presentation/components/details/PremiumStatusBadge.md +0 -91
- package/src/domains/subscription/presentation/components/details/README.md +0 -99
- package/src/domains/subscription/presentation/components/feedback/PaywallFeedbackModal.md +0 -90
- package/src/domains/subscription/presentation/components/feedback/README.md +0 -99
- package/src/domains/subscription/presentation/components/paywall/PaywallModal.md +0 -94
- package/src/domains/subscription/presentation/components/paywall/README.md +0 -54
- package/src/domains/subscription/presentation/components/sections/README.md +0 -99
- package/src/domains/subscription/presentation/components/sections/SubscriptionSection.md +0 -94
- package/src/domains/subscription/presentation/utils/README.md +0 -31
- package/src/domains/wallet/README.md +0 -51
- package/src/domains/wallet/domain/README.md +0 -41
- package/src/domains/wallet/infrastructure/README.md +0 -41
- package/src/domains/wallet/presentation/components/README.md +0 -41
- package/src/domains/wallet/presentation/hooks/README.md +0 -41
- package/src/shared/application/ports/README.md +0 -48
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# Wallet Domain
|
|
2
|
-
|
|
3
|
-
Credit balance management, transaction history tracking, and product metadata management.
|
|
4
|
-
|
|
5
|
-
## Location
|
|
6
|
-
|
|
7
|
-
`src/domains/wallet/`
|
|
8
|
-
|
|
9
|
-
## Strategy
|
|
10
|
-
|
|
11
|
-
Implements layered architecture for credit management with domain layer (entities, value objects, errors), infrastructure layer (repositories, Firebase services, mappers), and presentation layer (hooks, components). Handles initialization, operations, and transaction history with real-time updates.
|
|
12
|
-
|
|
13
|
-
## Restrictions
|
|
14
|
-
|
|
15
|
-
### REQUIRED
|
|
16
|
-
|
|
17
|
-
- All operations require authenticated user
|
|
18
|
-
- Credit operations MUST be validated server-side
|
|
19
|
-
- All credit changes MUST be recorded in transaction history
|
|
20
|
-
- MUST handle insufficient credits gracefully
|
|
21
|
-
|
|
22
|
-
### PROHIBITED
|
|
23
|
-
|
|
24
|
-
- MUST NOT allow client-side credit modifications without server validation
|
|
25
|
-
- MUST NOT deduct credits without sufficient balance
|
|
26
|
-
- MUST NOT expose internal repository logic to UI
|
|
27
|
-
- MUST NOT store credit balance in AsyncStorage (use secure backend)
|
|
28
|
-
|
|
29
|
-
### CRITICAL
|
|
30
|
-
|
|
31
|
-
- Always validate credit amounts (must be positive)
|
|
32
|
-
- Always implement optimistic updates with rollback
|
|
33
|
-
- Never trust client-side credit balance for security decisions
|
|
34
|
-
- Must implement retry logic for failed operations
|
|
35
|
-
- Always sanitize transaction reasons to prevent injection attacks
|
|
36
|
-
|
|
37
|
-
## AI Agent Guidelines
|
|
38
|
-
|
|
39
|
-
When implementing credit operations:
|
|
40
|
-
1. Always check balance before deducting
|
|
41
|
-
2. Always provide transaction reason and metadata
|
|
42
|
-
3. Always handle insufficient credits gracefully
|
|
43
|
-
4. Always implement optimistic updates with rollback
|
|
44
|
-
5. Never trust client-side balance for security
|
|
45
|
-
|
|
46
|
-
## Related Documentation
|
|
47
|
-
|
|
48
|
-
- [Credits Repository](infrastructure/README.md)
|
|
49
|
-
- [useCredits Hook](../../presentation/hooks/README.md)
|
|
50
|
-
- [UserCredits Entity](domain/entities/README.md)
|
|
51
|
-
- [Transaction Errors](domain/errors/README.md)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Wallet Domain
|
|
2
|
-
|
|
3
|
-
## Location
|
|
4
|
-
Wallet domain containing credits and transaction management logic.
|
|
5
|
-
|
|
6
|
-
## Strategy
|
|
7
|
-
The wallet domain manages user credits, transactions, and credit allocation strategies with duplicate protection, transactional operations, and complete audit trail.
|
|
8
|
-
|
|
9
|
-
## Restrictions
|
|
10
|
-
|
|
11
|
-
### REQUIRED
|
|
12
|
-
- Must check credit balance before operations
|
|
13
|
-
- Must handle credit exhaustion gracefully
|
|
14
|
-
- Must track all credit transactions
|
|
15
|
-
- Must reset credits on subscription renewal
|
|
16
|
-
|
|
17
|
-
### PROHIBITED
|
|
18
|
-
- DO NOT perform operations without balance check
|
|
19
|
-
- DO NOT allow duplicate credit allocations
|
|
20
|
-
- DO NOT skip transaction logging
|
|
21
|
-
- DO NOT bypass credit exhaustion handling
|
|
22
|
-
|
|
23
|
-
### CRITICAL SAFETY
|
|
24
|
-
- Credit allocations MUST be protected against duplicates
|
|
25
|
-
- All credit operations MUST be transactional
|
|
26
|
-
- Transaction history MUST be complete and accurate
|
|
27
|
-
- Credit exhaustion MUST trigger upgrade flow
|
|
28
|
-
|
|
29
|
-
## AI Agent Guidelines
|
|
30
|
-
1. Always verify credit balance before performing operations
|
|
31
|
-
2. Handle credit exhaustion with clear upgrade path
|
|
32
|
-
3. Log all credit transactions for audit trail
|
|
33
|
-
4. Implement monthly credit reset on subscription renewal
|
|
34
|
-
5. Test edge cases: zero credits, max credits, duplicates
|
|
35
|
-
6. Use ACCUMULATE mode for renewals, REPLACE for new purchases
|
|
36
|
-
7. Provide optimistic updates with rollback capability
|
|
37
|
-
|
|
38
|
-
## Related Documentation
|
|
39
|
-
- [Credits README](./README.md)
|
|
40
|
-
- [Credits Entity](./domain/entities/Credits.md)
|
|
41
|
-
- [useCredits Hook](../../presentation/hooks/useCredits.md)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Wallet Infrastructure
|
|
2
|
-
|
|
3
|
-
## Location
|
|
4
|
-
Infrastructure layer for wallet and credits functionality.
|
|
5
|
-
|
|
6
|
-
## Strategy
|
|
7
|
-
This directory contains implementations for credit persistence, transactions, and credit operations with duplicate protection and optimistic updates.
|
|
8
|
-
|
|
9
|
-
## Restrictions
|
|
10
|
-
|
|
11
|
-
### REQUIRED
|
|
12
|
-
- Must check credit balance before deducting
|
|
13
|
-
- Must handle errors appropriately
|
|
14
|
-
- Must use transactions for data consistency
|
|
15
|
-
- Must log all credit operations
|
|
16
|
-
|
|
17
|
-
### PROHIBITED
|
|
18
|
-
- DO NOT deduct credits without balance check
|
|
19
|
-
- DO NOT allow duplicate credit allocations
|
|
20
|
-
- DO NOT skip transaction boundaries
|
|
21
|
-
- DO NOT ignore credit operation errors
|
|
22
|
-
|
|
23
|
-
### CRITICAL SAFETY
|
|
24
|
-
- Duplicate allocations MUST be prevented based on purchaseId
|
|
25
|
-
- Credit operations MUST be atomic
|
|
26
|
-
- All operations MUST be logged for debugging
|
|
27
|
-
- Input validation MUST be performed
|
|
28
|
-
|
|
29
|
-
## AI Agent Guidelines
|
|
30
|
-
1. Always verify credit balance before deduction operations
|
|
31
|
-
2. Implement comprehensive error handling for credit operations
|
|
32
|
-
3. Use transactions to ensure data consistency
|
|
33
|
-
4. Track all credit operations with detailed logging
|
|
34
|
-
5. Test edge cases: zero credits, max credits, duplicates
|
|
35
|
-
6. Validate all input parameters before processing
|
|
36
|
-
7. Implement duplicate protection based on purchaseId
|
|
37
|
-
|
|
38
|
-
## Related Documentation
|
|
39
|
-
- [Wallet Domain](../domain/README.md)
|
|
40
|
-
- [Credits Entity](../domain/entities/README.md)
|
|
41
|
-
- [useCredits Hook](../../presentation/hooks/useCredits.md)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Wallet Presentation Components
|
|
2
|
-
|
|
3
|
-
## Location
|
|
4
|
-
UI components for wallet and credit display.
|
|
5
|
-
|
|
6
|
-
## Strategy
|
|
7
|
-
This directory contains React Native components for displaying credits, transactions, and wallet information with clear visual hierarchy and status indicators.
|
|
8
|
-
|
|
9
|
-
## Restrictions
|
|
10
|
-
|
|
11
|
-
### REQUIRED
|
|
12
|
-
- Must show loading states appropriately
|
|
13
|
-
- Must provide empty state messages
|
|
14
|
-
- Must allow manual refresh capability
|
|
15
|
-
- Must display transaction history clearly
|
|
16
|
-
|
|
17
|
-
### PROHIBITED
|
|
18
|
-
- DO NOT hide credit balance from users
|
|
19
|
-
- DO NOT show technical errors directly
|
|
20
|
-
- DO NOT skip loading indicators
|
|
21
|
-
- DO NOT obscure transaction details
|
|
22
|
-
|
|
23
|
-
### CRITICAL SAFETY
|
|
24
|
-
- Credit balance MUST always be visible
|
|
25
|
-
- Status indicators MUST be color-coded appropriately
|
|
26
|
-
- Transaction history MUST be complete and accurate
|
|
27
|
-
- Purchase links MUST be easily accessible
|
|
28
|
-
|
|
29
|
-
## AI Agent Guidelines
|
|
30
|
-
1. Emphasize important information with visual hierarchy
|
|
31
|
-
2. Use color coding to indicate status (low/warning/good)
|
|
32
|
-
3. Show skeleton screens while loading data
|
|
33
|
-
4. Provide helpful empty state messages
|
|
34
|
-
5. Allow users to manually refresh credit data
|
|
35
|
-
6. Display complete transaction history
|
|
36
|
-
7. Make credit purchases easily accessible
|
|
37
|
-
|
|
38
|
-
## Related Documentation
|
|
39
|
-
- [Credit Row](../../../presentation/components/details/CreditRow.md)
|
|
40
|
-
- [Credits Hook](../hooks/README.md)
|
|
41
|
-
- [Wallet Domain](../../domain/README.md)
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Wallet Presentation Hooks
|
|
2
|
-
|
|
3
|
-
## Location
|
|
4
|
-
React hooks for wallet and credit functionality.
|
|
5
|
-
|
|
6
|
-
## Strategy
|
|
7
|
-
This directory contains React hooks specifically for credit management and wallet operations with optimistic updates and proper error handling.
|
|
8
|
-
|
|
9
|
-
## Restrictions
|
|
10
|
-
|
|
11
|
-
### REQUIRED
|
|
12
|
-
- Must check balance before deducting
|
|
13
|
-
- Must handle loading states appropriately
|
|
14
|
-
- Must handle deduction failures gracefully
|
|
15
|
-
- Must log all credit operations
|
|
16
|
-
|
|
17
|
-
### PROHIBITED
|
|
18
|
-
- DO NOT deduct credits without balance check
|
|
19
|
-
- DO NOT skip error handling
|
|
20
|
-
- DO NOT ignore loading states
|
|
21
|
-
- DO NOT perform operations without tracking
|
|
22
|
-
|
|
23
|
-
### CRITICAL SAFETY
|
|
24
|
-
- Balance checks MUST precede all deductions
|
|
25
|
-
- Deduction failures MUST be handled gracefully
|
|
26
|
-
- Optimistic updates MUST support rollback
|
|
27
|
-
- All operations MUST be logged
|
|
28
|
-
|
|
29
|
-
## AI Agent Guidelines
|
|
30
|
-
1. Always check credit balance before deducting
|
|
31
|
-
2. Show appropriate loading states during operations
|
|
32
|
-
3. Handle deduction failures with graceful recovery
|
|
33
|
-
4. Use optimistic updates for better user experience
|
|
34
|
-
5. Log all credit operations for debugging
|
|
35
|
-
6. Initialize credits automatically after premium purchase
|
|
36
|
-
7. Test edge cases: zero credits, max credits, failures
|
|
37
|
-
|
|
38
|
-
## Related Documentation
|
|
39
|
-
- [useCredits Hook Documentation](../../../presentation/hooks/useCredits.md)
|
|
40
|
-
- [useDeductCredit Hook Documentation](../../../presentation/hooks/useDeductCredit.md)
|
|
41
|
-
- [Credits Entity](../../domain/entities/README.md)
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
# Application Ports
|
|
2
|
-
|
|
3
|
-
Interfaces defining contracts between application layer and external dependencies.
|
|
4
|
-
|
|
5
|
-
## Location
|
|
6
|
-
|
|
7
|
-
`src/application/ports/`
|
|
8
|
-
|
|
9
|
-
## Strategy
|
|
10
|
-
|
|
11
|
-
Port interfaces define how the application layer interacts with external services and repositories, enabling dependency inversion and testability through clear contracts.
|
|
12
|
-
|
|
13
|
-
## Restrictions
|
|
14
|
-
|
|
15
|
-
### REQUIRED
|
|
16
|
-
|
|
17
|
-
- MUST use interface segregation (keep interfaces focused)
|
|
18
|
-
- MUST document behavior thoroughly
|
|
19
|
-
- MUST use domain entities in return types
|
|
20
|
-
- MUST make all I/O operations async
|
|
21
|
-
- MUST define clear contracts between layers
|
|
22
|
-
|
|
23
|
-
### PROHIBITED
|
|
24
|
-
|
|
25
|
-
- MUST NOT couple interfaces to specific implementations
|
|
26
|
-
- MUST NOT include infrastructure concerns in port definitions
|
|
27
|
-
- MUST NOT leak implementation details through interfaces
|
|
28
|
-
|
|
29
|
-
### CRITICAL
|
|
30
|
-
|
|
31
|
-
- Keep interfaces focused and segregated
|
|
32
|
-
- Document all behavior thoroughly
|
|
33
|
-
- Use domain entities in return types
|
|
34
|
-
- Ensure all I/O operations are async
|
|
35
|
-
|
|
36
|
-
## AI Agent Guidelines
|
|
37
|
-
|
|
38
|
-
When working with application ports:
|
|
39
|
-
1. Interface Segregation - keep interfaces focused
|
|
40
|
-
2. Clear Contracts - document behavior thoroughly
|
|
41
|
-
3. Return Types - use domain entities in return types
|
|
42
|
-
4. Async Operations - all I/O operations should be async
|
|
43
|
-
|
|
44
|
-
## Related Documentation
|
|
45
|
-
|
|
46
|
-
- [Application Layer](../README.md)
|
|
47
|
-
- [Infrastructure Services](../../infrastructure/services/README.md)
|
|
48
|
-
- [Infrastructure Repositories](../../infrastructure/repositories/README.md)
|