@umituz/react-native-subscription 2.27.91 → 2.27.92

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 (46) hide show
  1. package/package.json +1 -1
  2. package/src/domains/subscription/core/RevenueCatTypes.ts +2 -1
  3. package/src/domains/subscription/core/SubscriptionConstants.ts +12 -0
  4. package/src/index.ts +5 -5
  5. package/src/utils/tierUtils.ts +3 -3
  6. package/src/utils/types.ts +4 -1
  7. package/src/utils/validation.ts +2 -2
  8. package/src/domains/config/README.md +0 -100
  9. package/src/utils/README.md +0 -42
  10. /package/src/{presentation → domains/subscription/presentation}/components/README.md +0 -0
  11. /package/src/{presentation → domains/subscription/presentation}/components/details/CreditRow.md +0 -0
  12. /package/src/{presentation → domains/subscription/presentation}/components/details/CreditRow.tsx +0 -0
  13. /package/src/{presentation → domains/subscription/presentation}/components/details/DetailRow.md +0 -0
  14. /package/src/{presentation → domains/subscription/presentation}/components/details/DetailRow.tsx +0 -0
  15. /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumDetailsCard.md +0 -0
  16. /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumDetailsCard.styles.ts +0 -0
  17. /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumDetailsCard.tsx +0 -0
  18. /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumDetailsCardTypes.ts +0 -0
  19. /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumStatusBadge.md +0 -0
  20. /package/src/{presentation → domains/subscription/presentation}/components/details/PremiumStatusBadge.tsx +0 -0
  21. /package/src/{presentation → domains/subscription/presentation}/components/details/README.md +0 -0
  22. /package/src/{presentation → domains/subscription/presentation}/components/feedback/PaywallFeedbackModal.md +0 -0
  23. /package/src/{presentation → domains/subscription/presentation}/components/feedback/PaywallFeedbackModal.tsx +0 -0
  24. /package/src/{presentation → domains/subscription/presentation}/components/feedback/README.md +0 -0
  25. /package/src/{presentation → domains/subscription/presentation}/components/feedback/paywallFeedbackStyles.ts +0 -0
  26. /package/src/{presentation → domains/subscription/presentation}/components/overlay/PurchaseLoadingOverlay.tsx +0 -0
  27. /package/src/{presentation → domains/subscription/presentation}/components/overlay/index.ts +0 -0
  28. /package/src/{presentation → domains/subscription/presentation}/components/paywall/PaywallModal.md +0 -0
  29. /package/src/{presentation → domains/subscription/presentation}/components/paywall/README.md +0 -0
  30. /package/src/{presentation → domains/subscription/presentation}/components/sections/README.md +0 -0
  31. /package/src/{presentation → domains/subscription/presentation}/components/sections/SubscriptionSection.md +0 -0
  32. /package/src/{presentation → domains/subscription/presentation}/components/sections/SubscriptionSection.tsx +0 -0
  33. /package/src/{presentation → domains/subscription/presentation}/screens/README.md +0 -0
  34. /package/src/{presentation → domains/subscription/presentation}/screens/SubscriptionDetailScreen.tsx +0 -0
  35. /package/src/{presentation → domains/subscription/presentation}/screens/components/CreditsList.tsx +0 -0
  36. /package/src/{presentation → domains/subscription/presentation}/screens/components/DevTestSection.tsx +0 -0
  37. /package/src/{presentation → domains/subscription/presentation}/screens/components/SubscriptionActions.tsx +0 -0
  38. /package/src/{presentation → domains/subscription/presentation}/screens/components/SubscriptionHeader.tsx +0 -0
  39. /package/src/{presentation → domains/subscription/presentation}/screens/components/UpgradePrompt.tsx +0 -0
  40. /package/src/{presentation → domains/subscription/presentation}/stores/index.ts +0 -0
  41. /package/src/{presentation → domains/subscription/presentation}/stores/purchaseLoadingStore.ts +0 -0
  42. /package/src/{presentation → domains/subscription/presentation}/types/README.md +0 -0
  43. /package/src/{presentation → domains/subscription/presentation}/types/SubscriptionDetailTypes.ts +0 -0
  44. /package/src/{presentation → domains/subscription/presentation}/types/SubscriptionSettingsTypes.ts +0 -0
  45. /package/src/{presentation → domains/subscription/presentation}/utils/README.md +0 -0
  46. /package/src/{presentation → domains/subscription/presentation}/utils/subscriptionDateUtils.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.27.91",
3
+ "version": "2.27.92",
4
4
  "description": "Complete subscription management with RevenueCat, paywall UI, and credits system for React Native apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -4,6 +4,7 @@
4
4
  */
5
5
 
6
6
  import type { CustomerInfo } from "react-native-purchases";
7
+ import { DEFAULT_ENTITLEMENT_ID } from "./SubscriptionConstants";
7
8
 
8
9
  /**
9
10
  * RevenueCat Entitlement Info
@@ -35,7 +36,7 @@ export interface RevenueCatPurchaseErrorInfo extends Error {
35
36
  */
36
37
  export function getPremiumEntitlement(
37
38
  customerInfo: CustomerInfo,
38
- entitlementIdentifier: string = 'premium'
39
+ entitlementIdentifier: string = DEFAULT_ENTITLEMENT_ID
39
40
  ): RevenueCatEntitlement | null {
40
41
  const entitlement = customerInfo.entitlements.active[entitlementIdentifier];
41
42
  if (!entitlement) {
@@ -3,6 +3,18 @@
3
3
  * Centralized source of truth for subscription-related enums and types.
4
4
  */
5
5
 
6
+ /** User tier constants */
7
+ export const USER_TIER = {
8
+ ANONYMOUS: 'anonymous',
9
+ FREEMIUM: 'freemium',
10
+ PREMIUM: 'premium',
11
+ } as const;
12
+
13
+ export type UserTierType = (typeof USER_TIER)[keyof typeof USER_TIER];
14
+
15
+ /** Default entitlement identifier */
16
+ export const DEFAULT_ENTITLEMENT_ID = 'premium';
17
+
6
18
  /** Subscription status constants */
7
19
  export const SUBSCRIPTION_STATUS = {
8
20
  ACTIVE: 'active',
package/src/index.ts CHANGED
@@ -54,11 +54,11 @@ export {
54
54
  export * from "./presentation/hooks";
55
55
 
56
56
  // Presentation Layer - Components
57
- export * from "./presentation/components/details/PremiumDetailsCard";
58
- export * from "./presentation/components/details/PremiumStatusBadge";
59
- export * from "./presentation/components/sections/SubscriptionSection";
60
- export * from "./presentation/components/feedback/PaywallFeedbackModal";
61
- export * from "./presentation/screens/SubscriptionDetailScreen";
57
+ export * from "./domains/subscription/presentation/components/details/PremiumDetailsCard";
58
+ export * from "./domains/subscription/presentation/components/details/PremiumStatusBadge";
59
+ export * from "./domains/subscription/presentation/components/sections/SubscriptionSection";
60
+ export * from "./domains/subscription/presentation/components/feedback/PaywallFeedbackModal";
61
+ export * from "./domains/subscription/presentation/screens/SubscriptionDetailScreen";
62
62
  export * from "./domains/paywall/components/PaywallContainer";
63
63
 
64
64
  export type {
@@ -4,7 +4,7 @@
4
4
  * Core logic for determining user tier and premium status
5
5
  */
6
6
 
7
- import type { UserTierInfo } from './types';
7
+ import { USER_TIER, type UserTierInfo } from './types';
8
8
 
9
9
 
10
10
  export function getUserTierInfo(
@@ -14,7 +14,7 @@ export function getUserTierInfo(
14
14
  ): UserTierInfo {
15
15
  if (isAnonymous || userId === null) {
16
16
  return {
17
- tier: 'anonymous',
17
+ tier: USER_TIER.ANONYMOUS,
18
18
  isPremium: false,
19
19
  isAnonymous: true,
20
20
  isAuthenticated: false,
@@ -23,7 +23,7 @@ export function getUserTierInfo(
23
23
  }
24
24
 
25
25
  return {
26
- tier: isPremium ? 'premium' : 'freemium',
26
+ tier: isPremium ? USER_TIER.PREMIUM : USER_TIER.FREEMIUM,
27
27
  isPremium,
28
28
  isAnonymous: false,
29
29
  isAuthenticated: true,
@@ -4,7 +4,10 @@
4
4
  * Type definitions for user tier system
5
5
  */
6
6
 
7
- export type UserTier = 'anonymous' | 'freemium' | 'premium';
7
+ import { USER_TIER, type UserTierType } from '../domains/subscription/core/SubscriptionConstants';
8
+
9
+ export type UserTier = UserTierType;
10
+ export { USER_TIER };
8
11
 
9
12
  export interface UserTierInfo {
10
13
  /** User tier classification */
@@ -4,10 +4,10 @@
4
4
  * Type guards and validation functions for user tier system
5
5
  */
6
6
 
7
- import type { UserTier, UserTierInfo } from './types';
7
+ import { USER_TIER, type UserTier, type UserTierInfo } from './types';
8
8
 
9
9
  export function isValidUserTier(value: unknown): value is UserTier {
10
- return value === 'anonymous' || value === 'freemium' || value === 'premium';
10
+ return value === USER_TIER.ANONYMOUS || value === USER_TIER.FREEMIUM || value === USER_TIER.PREMIUM;
11
11
  }
12
12
 
13
13
  export function isUserTierInfo(value: unknown): value is UserTierInfo {
@@ -1,100 +0,0 @@
1
- # Config Domain
2
-
3
- Central configuration system for subscription plans, product configurations, and package management.
4
-
5
- ## Location
6
-
7
- - **Base Path**: `/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/config/`
8
- - **Domain**: `src/domains/config/domain/`
9
- - **Entities**: `src/domains/config/domain/entities/`
10
-
11
- ## Strategy
12
-
13
- ### Plan Management
14
-
15
- Comprehensive subscription plan configuration system.
16
-
17
- - **Plan Types**: Monthly, annual, and lifetime plan configurations
18
- - **Product Metadata**: RevenueCat product metadata management
19
- - **Validation**: Configuration validation and type safety
20
- - **Helper Functions**: Plan comparison and filtering utilities
21
-
22
- ### Configuration Objects
23
-
24
- Structured configuration for different aspects of the system.
25
-
26
- - **SubscriptionConfig**: Main subscription configuration
27
- - **WalletConfig**: Credit system configuration
28
- - **Plan Entities**: Individual plan definitions
29
- - **Validation Rules**: Configuration validation schemas
30
-
31
- ### Helper Utilities
32
-
33
- Plan comparison and manipulation functions.
34
-
35
- - **Plan Comparison**: Value comparison between plans
36
- - **Price Formatting**: Currency-aware price formatting
37
- - **Discount Calculation**: Savings and discount calculations
38
- - **Package Filtering**: Type-based package filtering
39
-
40
- ### Validation System
41
-
42
- Comprehensive configuration validation.
43
-
44
- - **Plan Validation**: Plan entity validation rules
45
- - **Config Validation**: Complete configuration validation
46
- - **Type Safety**: TypeScript type definitions
47
- - **Error Messages**: Detailed validation error reporting
48
-
49
- ## Restrictions
50
-
51
- ### REQUIRED
52
-
53
- - **Type Safety**: Always use TypeScript type definitions
54
- - **Validation**: Validate configurations before runtime use
55
- - **Default Values**: Provide meaningful default values
56
- - **Immutable Updates**: Create new copies instead of modifying
57
-
58
- ### PROHIBITED
59
-
60
- - **Invalid Prices**: Negative or zero prices not allowed
61
- - **Missing IDs**: All plans must have valid IDs
62
- - **Duplicate Plans**: No duplicate plan IDs allowed
63
- - **Hardcoded Values**: Use configuration system
64
-
65
- ### CRITICAL
66
-
67
- - **Configuration Integrity**: All configurations must be valid
68
- - **Plan Consistency**: Related plans must be consistent
69
- - **Currency Handling**: Proper currency code usage
70
- - **Feature Lists**: Accurate feature mapping
71
-
72
- ## AI Agent Guidelines
73
-
74
- ### When Modifying Configuration System
75
-
76
- 1. **Type Definitions**: Update TypeScript types for new config
77
- 2. **Validation Rules**: Add validation for new fields
78
- 3. **Default Values**: Provide sensible defaults
79
- 4. **Documentation**: Document configuration options
80
-
81
- ### When Adding New Plan Types
82
-
83
- 1. **Entity Pattern**: Follow existing entity patterns
84
- 2. **Validation**: Add validation rules
85
- 3. **Helper Functions**: Create helper functions
86
- 4. **Testing**: Test with various configurations
87
-
88
- ### When Fixing Configuration Bugs
89
-
90
- 1. **Validation Logic**: Check validation rules
91
- 2. **Type Definitions**: Verify type correctness
92
- 3. **Default Values**: Ensure proper defaults
93
- 4. **Edge Cases**: Test boundary conditions
94
-
95
- ## Related Documentation
96
-
97
- - [Paywall Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/paywall/README.md)
98
- - [Wallet Domain](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domains/wallet/README.md)
99
- - [RevenueCat Integration](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/revenuecat/README.md)
100
- - [Domain Layer](/Users/umituz/Desktop/github/umituz/apps/artificial_intelligence/npm-packages/react-native-subscription/src/domain/README.md)
@@ -1,42 +0,0 @@
1
- # Utils
2
-
3
- ## Location
4
- Abonelik sistemi için yardımcı fonksiyonlar ve utility araçları.
5
-
6
- ## Strategy
7
- Bu dizin, premium durum kontrolü, kullanıcı tier yönetimi, paket işlemleri, fiyat hesaplama, periyot formatlama, asenkron işlemler, validasyon ve veri dönüşümü için yardımcı fonksiyonlar içerir.
8
-
9
- ## Restrictions
10
-
11
- ### REQUIRED
12
- - Must maintain type safety for all functions
13
- - Must handle null checks safely
14
- - Must support localization
15
- - Must validate all inputs
16
-
17
- ### PROHIBITED
18
- - DO NOT bypass null safety checks
19
- - DO NOT ignore error handling
20
- - DO NOT hardcode locale values
21
- - DO NOT skip validation
22
-
23
- ### CRITICAL SAFETY
24
- - All functions MUST be type-safe
25
- - Null checks MUST be performed safely
26
- - Errors MUST be caught and handled
27
- - Validation MUST return clear results
28
-
29
- ## AI Agent Guidelines
30
- 1. Maintain type safety for all utility functions
31
- 2. Perform null checks safely with proper guards
32
- 3. Catch and handle errors appropriately
33
- 4. Support localization for different locales
34
- 5. Write JSDoc comments for all functions
35
- 6. Test utility functions thoroughly with edge cases
36
- 7. Provide clear validation error messages
37
-
38
- ## Related Documentation
39
- - Premium utilities for status checks
40
- - User tier utilities for tier management
41
- - Package utilities for RevenueCat integration
42
- - Price utilities for formatting and calculation