@umituz/react-native-subscription 2.27.66 → 2.27.68

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 (125) hide show
  1. package/package.json +1 -1
  2. package/src/domains/credits/application/CreditLimitCalculator.ts +17 -0
  3. package/src/domains/credits/application/CreditsInitializer.ts +85 -0
  4. package/src/domains/credits/application/DeductCreditsCommand.ts +52 -0
  5. package/src/domains/credits/application/PurchaseMetadataGenerator.ts +59 -0
  6. package/src/domains/credits/application/credit-strategies/CreditAllocationContext.ts +35 -0
  7. package/src/domains/credits/application/credit-strategies/ICreditStrategy.ts +18 -0
  8. package/src/domains/credits/application/credit-strategies/StandardPurchaseCreditStrategy.ts +16 -0
  9. package/src/domains/credits/application/credit-strategies/SyncCreditStrategy.ts +15 -0
  10. package/src/domains/credits/application/credit-strategies/TrialCreditStrategy.ts +18 -0
  11. package/src/{infrastructure/mappers → domains/credits/core}/CreditsMapper.ts +4 -4
  12. package/src/domains/credits/infrastructure/CreditsRepository.ts +102 -0
  13. package/src/{presentation/hooks → domains/credits/presentation}/useCredits.ts +21 -4
  14. package/src/domains/subscription/application/SubscriptionAuthListener.ts +26 -0
  15. package/src/domains/subscription/application/SubscriptionInitializer.ts +77 -0
  16. package/src/{infrastructure/services → domains/subscription/application}/SubscriptionInitializerTypes.ts +21 -1
  17. package/src/domains/subscription/application/SubscriptionSyncService.ts +71 -0
  18. package/src/domains/subscription/application/SubscriptionSyncUtils.ts +16 -0
  19. package/src/{revenuecat/domain/value-objects → domains/subscription/core}/RevenueCatConfig.ts +1 -1
  20. package/src/{domain/types → domains/subscription/core}/RevenueCatData.ts +1 -1
  21. package/src/{domain/entities → domains/subscription/core}/SubscriptionStatus.ts +13 -21
  22. package/src/domains/subscription/core/SubscriptionStatusHandlers.ts +51 -0
  23. package/src/domains/subscription/infrastructure/handlers/PackageHandler.ts +67 -0
  24. package/src/domains/subscription/infrastructure/handlers/PurchaseStatusResolver.ts +27 -0
  25. package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/useRevenueCat.ts +1 -1
  26. package/src/domains/subscription/infrastructure/managers/SubscriptionInternalState.ts +12 -0
  27. package/src/domains/subscription/infrastructure/managers/SubscriptionManager.ts +110 -0
  28. package/src/{revenuecat → domains/subscription}/infrastructure/services/PurchaseHandler.ts +1 -1
  29. package/src/{revenuecat → domains/subscription}/infrastructure/services/RestoreHandler.ts +1 -1
  30. package/src/{revenuecat → domains/subscription}/infrastructure/services/RevenueCatInitializer.ts +1 -1
  31. package/src/{revenuecat → domains/subscription}/infrastructure/services/RevenueCatService.ts +2 -2
  32. package/src/{presentation/hooks → domains/subscription/presentation}/usePremium.ts +7 -4
  33. package/src/domains/trial/application/TrialEligibilityService.ts +25 -0
  34. package/src/domains/trial/application/TrialService.ts +69 -0
  35. package/src/{infrastructure/services → domains/trial/core}/TrialTypes.ts +1 -1
  36. package/src/domains/trial/infrastructure/DeviceTrialRepository.ts +30 -0
  37. package/src/index.ts +28 -59
  38. package/src/init/createSubscriptionInitModule.ts +1 -1
  39. package/src/presentation/components/details/PremiumStatusBadge.tsx +1 -3
  40. package/src/presentation/hooks/feedback/useFeedbackSubmit.ts +1 -1
  41. package/src/presentation/hooks/index.ts +11 -11
  42. package/src/shared/application/ports/IRevenueCatService.ts +32 -0
  43. package/src/shared/infrastructure/SubscriptionEventBus.ts +51 -0
  44. package/src/application/README.md +0 -50
  45. package/src/domain/README.md +0 -54
  46. package/src/domain/entities/README.md +0 -50
  47. package/src/domain/entities/SubscriptionStatus.test.ts +0 -149
  48. package/src/domain/errors/README.md +0 -53
  49. package/src/domain/value-objects/README.md +0 -50
  50. package/src/infrastructure/README.md +0 -55
  51. package/src/infrastructure/mappers/README.md +0 -21
  52. package/src/infrastructure/models/README.md +0 -26
  53. package/src/infrastructure/repositories/CreditsRepository.ts +0 -132
  54. package/src/infrastructure/repositories/README.md +0 -99
  55. package/src/infrastructure/services/CreditsInitializer.ts +0 -170
  56. package/src/infrastructure/services/README.md +0 -99
  57. package/src/infrastructure/services/SubscriptionInitializer.ts +0 -176
  58. package/src/infrastructure/services/SubscriptionService.ts +0 -133
  59. package/src/infrastructure/services/TrialService.ts +0 -197
  60. package/src/infrastructure/services/app-service-helpers.ts +0 -111
  61. package/src/revenuecat/README.md +0 -104
  62. package/src/revenuecat/application/README.md +0 -43
  63. package/src/revenuecat/application/ports/IRevenueCatService.ts +0 -76
  64. package/src/revenuecat/application/ports/README.md +0 -41
  65. package/src/revenuecat/domain/README.md +0 -48
  66. package/src/revenuecat/domain/constants/README.md +0 -41
  67. package/src/revenuecat/domain/entities/README.md +0 -42
  68. package/src/revenuecat/domain/errors/README.md +0 -53
  69. package/src/revenuecat/domain/types/README.md +0 -41
  70. package/src/revenuecat/domain/value-objects/README.md +0 -41
  71. package/src/revenuecat/index.ts +0 -13
  72. package/src/revenuecat/infrastructure/handlers/PackageHandler.ts +0 -161
  73. package/src/revenuecat/infrastructure/managers/SubscriptionManager.ts +0 -165
  74. package/src/revenuecat/presentation/README.md +0 -42
  75. /package/src/{domain/entities → domains/credits/core}/Credits.ts +0 -0
  76. /package/src/{infrastructure/models → domains/credits/core}/UserCreditsDocument.ts +0 -0
  77. /package/src/{infrastructure/repositories → domains/credits/infrastructure}/CreditsRepositoryProvider.ts +0 -0
  78. /package/src/{presentation/hooks → domains/credits/presentation}/useDeductCredit.ts +0 -0
  79. /package/src/{revenuecat/domain/constants → domains/subscription/core}/RevenueCatConstants.ts +0 -0
  80. /package/src/{revenuecat/domain/errors → domains/subscription/core}/RevenueCatError.ts +0 -0
  81. /package/src/{revenuecat/domain/types → domains/subscription/core}/RevenueCatTypes.ts +0 -0
  82. /package/src/{domain/entities → domains/subscription/core}/SubscriptionConstants.ts +0 -0
  83. /package/src/{revenuecat → domains/subscription}/infrastructure/README.md +0 -0
  84. /package/src/{revenuecat → domains/subscription}/infrastructure/config/README.md +0 -0
  85. /package/src/{revenuecat → domains/subscription}/infrastructure/handlers/README.md +0 -0
  86. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/README.md +0 -0
  87. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/subscriptionQueryKeys.ts +0 -0
  88. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/useCustomerInfo.ts +0 -0
  89. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/useInitializeSubscription.ts +0 -0
  90. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/usePaywallFlow.ts +0 -0
  91. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/usePurchasePackage.ts +0 -0
  92. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/useRestorePurchase.ts +0 -0
  93. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/useRevenueCatTrialEligibility.ts +0 -0
  94. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/useSubscriptionPackages.ts +0 -0
  95. /package/src/{revenuecat/presentation → domains/subscription/infrastructure}/hooks/useSubscriptionQueries.ts +0 -0
  96. /package/src/{revenuecat → domains/subscription}/infrastructure/managers/README.md +0 -0
  97. /package/src/{revenuecat → domains/subscription}/infrastructure/services/CustomerInfoListenerManager.ts +0 -0
  98. /package/src/{revenuecat → domains/subscription}/infrastructure/services/OfferingsFetcher.ts +0 -0
  99. /package/src/{revenuecat → domains/subscription}/infrastructure/services/README.md +0 -0
  100. /package/src/{revenuecat → domains/subscription}/infrastructure/services/ServiceStateManager.ts +0 -0
  101. /package/src/{revenuecat → domains/subscription}/infrastructure/utils/ApiKeyResolver.ts +0 -0
  102. /package/src/{revenuecat → domains/subscription}/infrastructure/utils/InitializationCache.ts +0 -0
  103. /package/src/{revenuecat → domains/subscription}/infrastructure/utils/PremiumStatusSyncer.ts +0 -0
  104. /package/src/{revenuecat → domains/subscription}/infrastructure/utils/README.md +0 -0
  105. /package/src/{revenuecat → domains/subscription}/infrastructure/utils/RenewalDetector.ts +0 -0
  106. /package/src/{revenuecat → domains/subscription}/infrastructure/utils/UserIdProvider.ts +0 -0
  107. /package/src/{presentation/hooks → domains/subscription/presentation}/useAuthAwarePurchase.ts +0 -0
  108. /package/src/{presentation/hooks → domains/subscription/presentation}/useAuthSubscriptionSync.ts +0 -0
  109. /package/src/{presentation/hooks → domains/subscription/presentation}/useFeatureGate.ts +0 -0
  110. /package/src/{presentation/hooks → domains/subscription/presentation}/usePaywallVisibility.ts +0 -0
  111. /package/src/{presentation/hooks → domains/subscription/presentation}/usePremiumGate.ts +0 -0
  112. /package/src/{presentation/hooks → domains/subscription/presentation}/useSavedPurchaseAutoExecution.ts +0 -0
  113. /package/src/{presentation/hooks → domains/subscription/presentation}/useSubscriptionSettingsConfig.ts +0 -0
  114. /package/src/{presentation/hooks → domains/subscription/presentation}/useSubscriptionSettingsConfig.utils.ts +0 -0
  115. /package/src/{presentation/hooks → domains/subscription/presentation}/useSubscriptionStatus.ts +0 -0
  116. /package/src/{infrastructure/services → shared/application}/ActivationHandler.ts +0 -0
  117. /package/src/{infrastructure/services → shared/application}/FeedbackService.ts +0 -0
  118. /package/src/{application → shared/application}/ports/ISubscriptionRepository.ts +0 -0
  119. /package/src/{application → shared/application}/ports/ISubscriptionService.ts +0 -0
  120. /package/src/{application → shared/application}/ports/README.md +0 -0
  121. /package/src/{domain/errors → shared/utils}/InsufficientCreditsError.ts +0 -0
  122. /package/src/{infrastructure → shared}/utils/Logger.ts +0 -0
  123. /package/src/{domain/value-objects → shared/utils}/Result.ts +0 -0
  124. /package/src/{domain/value-objects → shared/utils}/SubscriptionConfig.ts +0 -0
  125. /package/src/{domain/errors → shared/utils}/SubscriptionError.ts +0 -0
@@ -1,104 +0,0 @@
1
- # RevenueCat Integration
2
-
3
- Comprehensive integration and API wrapper for subscription management with RevenueCat.
4
-
5
- ## Location
6
-
7
- - **Base Path**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/revenuecat/`
8
- - **Domain**: `src/revenuecat/domain/`
9
- - **Infrastructure**: `src/revenuecat/infrastructure/`
10
- - **Presentation**: `src/revenuecat/presentation/`
11
-
12
- ## Strategy
13
-
14
- ### RevenueCat SDK Integration
15
-
16
- Seamless RevenueCat SDK initialization and configuration.
17
-
18
- - **Automatic Initialization**: SDK startup and configuration
19
- - **User ID Management**: Auth system integration
20
- - **Purchase Flow**: Managed purchase operations
21
- - **Restore Operations**: Purchase restoration support
22
- - **Error Handling**: RevenueCat error management
23
-
24
- ### Hook Architecture
25
-
26
- React hooks for RevenueCat functionality.
27
-
28
- - **useRevenueCat**: Core RevenueCat access
29
- - **useCustomerInfo**: Subscription information tracking
30
- - **useInitializeSubscription**: Initialization status monitoring
31
- - **useSubscriptionPackages**: Package listing and selection
32
- - **usePaywallFlow**: Complete paywall flow management
33
- - **useRestorePurchase**: Purchase restoration
34
-
35
- ### State Management
36
-
37
- Customer info and subscription state tracking.
38
-
39
- - **Customer Info Tracking**: Real-time subscription updates
40
- - **Offerings Management**: Package offering configuration
41
- - **Purchase State**: Purchase operation states
42
- - **Error States**: Comprehensive error handling
43
-
44
- ### User ID Synchronization
45
-
46
- Auth system integration for user management.
47
-
48
- - **Auth Sync**: Automatic user ID synchronization
49
- - **Login/Logout**: User ID management on auth changes
50
- - **Anonymous Users**: Anonymous user support
51
- - **Migration**: User migration support
52
-
53
- ## Restrictions
54
-
55
- ### REQUIRED
56
-
57
- - **Initialization**: Must initialize before any operations
58
- - **User ID Sync**: Sync user IDs with auth system
59
- - **Error Handling**: All operations must handle errors
60
- - **Loading States**: Show appropriate loading indicators
61
-
62
- ### PROHIBITED
63
-
64
- - **Direct SDK Calls**: Use hooks instead of direct RevenueCat calls
65
- - **Missing User IDs**: Operations require valid user IDs
66
- - **Uninitialized Access**: Don't call methods before initialization
67
- - **Ignoring Errors**: All errors must be handled
68
-
69
- ### CRITICAL
70
-
71
- - **API Key Security**: Never expose API keys in client code
72
- - **User ID Consistency**: Maintain consistent user IDs
73
- - **Purchase Validation**: Validate all purchase results
74
- - **Entitlement Check**: Always verify entitlements
75
-
76
- ## AI Agent Guidelines
77
-
78
- ### When Modifying RevenueCat Integration
79
-
80
- 1. **SDK Version**: Check RevenueCat SDK version compatibility
81
- 2. **Type Definitions**: Update TypeScript types
82
- 3. **Error Handling**: Maintain comprehensive error handling
83
- 4. **Testing**: Test with different subscription states
84
-
85
- ### When Adding New Hooks
86
-
87
- 1. **Hook Pattern**: Follow existing hook patterns
88
- 2. **State Management**: Proper state management
89
- 3. **Error Handling**: Comprehensive error handling
90
- 4. **Documentation**: Document hook usage and return values
91
-
92
- ### When Fixing RevenueCat Bugs
93
-
94
- 1. **SDK Integration**: Check RevenueCat SDK integration
95
- 2. **State Updates**: Verify state update mechanisms
96
- 3. **User ID**: Verify user ID consistency
97
- 4. **Purchase Flow**: Test complete purchase flows
98
-
99
- ## Related Documentation
100
-
101
- - [Paywall Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/paywall/README.md)
102
- - [Config Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/config/README.md)
103
- - [Infrastructure Layer](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/infrastructure/README.md)
104
- - [Application Layer](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/application/README.md)
@@ -1,43 +0,0 @@
1
- # RevenueCat Application Layer
2
-
3
- ## Location
4
- Application layer for RevenueCat integration, containing use cases and orchestration logic.
5
-
6
- ## Strategy
7
- This directory contains use cases and application-level operations for managing RevenueCat subscriptions and purchases with proper error handling and state synchronization.
8
-
9
- ## Restrictions
10
-
11
- ### REQUIRED
12
- - Must handle RevenueCat errors gracefully
13
- - Must provide user ID when available
14
- - Must use entitlements instead of product IDs
15
- - Must keep local state synchronized
16
-
17
- ### PROHIBITED
18
- - DO NOT ignore RevenueCat errors
19
- - DO NOT skip user ID provision
20
- - DO NOT use product IDs directly
21
- - DO NOT allow state desynchronization
22
-
23
- ### CRITICAL SAFETY
24
- - All errors MUST be handled gracefully
25
- - User IDs MUST be provided when available
26
- - Entitlements MUST be used for flexibility
27
- - Local state MUST stay synchronized
28
-
29
- ## AI Agent Guidelines
30
- 1. Always handle RevenueCat errors with proper recovery
31
- 2. Provide user ID when available for better tracking
32
- 3. Use entitlements instead of product IDs for flexibility
33
- 4. Check if offerings are available before purchasing
34
- 5. Validate customer info after purchases
35
- 6. Keep local state synchronized with RevenueCat
36
- 7. Handle network timeouts appropriately
37
- 8. Log all RevenueCat operations for debugging
38
-
39
- ## Related Documentation
40
- - [RevenueCat Integration](../README.md)
41
- - [RevenueCat Domain](../domain/README.md)
42
- - [RevenueCat Infrastructure](../infrastructure/README.md)
43
- - [Application Ports](./ports/README.md)
@@ -1,76 +0,0 @@
1
- /**
2
- * RevenueCat Service Interface
3
- * Port for subscription operations
4
- */
5
-
6
- import type { PurchasesPackage, PurchasesOffering, CustomerInfo } from "react-native-purchases";
7
-
8
- export interface InitializeResult {
9
- success: boolean;
10
- offering: PurchasesOffering | null;
11
- isPremium: boolean;
12
- }
13
-
14
- export interface PurchaseResult {
15
- success: boolean;
16
- isPremium: boolean;
17
- customerInfo?: CustomerInfo;
18
- isConsumable?: boolean;
19
- productId?: string;
20
- }
21
-
22
- export interface RestoreResult {
23
- success: boolean;
24
- isPremium: boolean;
25
- customerInfo?: CustomerInfo;
26
- }
27
-
28
- export interface IRevenueCatService {
29
- /**
30
- * Initialize RevenueCat SDK
31
- * @param userId User identifier
32
- * @param apiKey Optional API key (auto-resolved if not provided)
33
- */
34
- initialize(userId: string, apiKey?: string): Promise<InitializeResult>;
35
-
36
- /**
37
- * Fetch offerings from RevenueCat
38
- */
39
- fetchOfferings(): Promise<PurchasesOffering | null>;
40
-
41
- /**
42
- * Purchase a package
43
- */
44
- purchasePackage(pkg: PurchasesPackage, userId: string): Promise<PurchaseResult>;
45
-
46
- /**
47
- * Restore purchases
48
- */
49
- restorePurchases(userId: string): Promise<RestoreResult>;
50
-
51
- /**
52
- * Reset RevenueCat SDK (for logout)
53
- */
54
- reset(): Promise<void>;
55
-
56
- /**
57
- * Get current customer info
58
- */
59
- getCustomerInfo(): Promise<CustomerInfo | null>;
60
-
61
- /**
62
- * Get RevenueCat API key for current platform
63
- */
64
- getRevenueCatKey(): string | null;
65
-
66
- /**
67
- * Check if RevenueCat is initialized
68
- */
69
- isInitialized(): boolean;
70
-
71
- /**
72
- * Get current user ID
73
- */
74
- getCurrentUserId(): string | null;
75
- }
76
-
@@ -1,41 +0,0 @@
1
- # RevenueCat Application Ports
2
-
3
- ## Location
4
- Interface definitions for RevenueCat service layer.
5
-
6
- ## Strategy
7
- This directory defines the ports (interfaces) that the RevenueCat infrastructure must implement, following the Dependency Inversion Principle for testability and flexibility.
8
-
9
- ## Restrictions
10
-
11
- ### REQUIRED
12
- - Must define clear interfaces for all operations
13
- - Must support mocking for testing
14
- - Must enable implementation swapping
15
- - Must maintain contracts between layers
16
-
17
- ### PROHIBITED
18
- - DO NOT depend on concrete implementations
19
- - DO NOT create interfaces without clear purpose
20
- - DO NOT break interface contracts
21
- - DO NOT couple application to infrastructure
22
-
23
- ### CRITICAL SAFETY
24
- - All dependencies MUST be inverted
25
- - Interfaces MUST be clearly defined
26
- - Implementations MUST be swappable
27
- - Contracts MUST be maintained
28
-
29
- ## AI Agent Guidelines
30
- 1. Define clear interfaces for all RevenueCat operations
31
- 2. Design interfaces for easy mocking in tests
32
- 3. Enable implementation swapping when needed
33
- 4. Keep application layer decoupled from infrastructure
34
- 5. Maintain clear contracts between layers
35
- 6. Document interface behavior thoroughly
36
- 7. Test with mock implementations
37
-
38
- ## Related Documentation
39
- - [RevenueCat Application Layer](../README.md)
40
- - [RevenueCat Infrastructure](../infrastructure/README.md)
41
- - [RevenueCat Domain](../domain/README.md)
@@ -1,48 +0,0 @@
1
- # RevenueCat Domain
2
-
3
- Domain entities and types for RevenueCat integration.
4
-
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
46
-
47
- - [RevenueCat README](../README.md)
48
- - [Subscription Manager](../../infrastructure/managers/README.md)
@@ -1,41 +0,0 @@
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)
@@ -1,42 +0,0 @@
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)
@@ -1,53 +0,0 @@
1
- # RevenueCat Domain Errors
2
-
3
- Domain-specific errors for RevenueCat operations.
4
-
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
51
-
52
- - [RevenueCat Domain](../README.md)
53
- - [RevenueCat Services](../../infrastructure/services/README.md)
@@ -1,41 +0,0 @@
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)
@@ -1,41 +0,0 @@
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)
@@ -1,13 +0,0 @@
1
- export * from "./domain/errors/RevenueCatError";
2
- export * from "./domain/value-objects/RevenueCatConfig";
3
- export * from "./domain/types/RevenueCatTypes";
4
- export * from "./domain/constants/RevenueCatConstants";
5
- export * from "./application/ports/IRevenueCatService";
6
- export * from "./infrastructure/services/RevenueCatService";
7
- export * from "./infrastructure/managers/SubscriptionManager";
8
- export * from "./infrastructure/handlers/PackageHandler";
9
- export * from "./presentation/hooks/useRevenueCat";
10
- export * from "./presentation/hooks/useCustomerInfo";
11
- export * from "./presentation/hooks/usePaywallFlow";
12
- export * from "./presentation/hooks/useSubscriptionQueries";
13
- export * from "./presentation/hooks/useRevenueCatTrialEligibility";