@umituz/react-native-subscription 2.28.4 → 2.29.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-subscription",
3
- "version": "2.28.4",
3
+ "version": "2.29.0",
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",
@@ -1,12 +1,18 @@
1
1
  import type { CreditsConfig } from "../core/Credits";
2
2
  import { detectPackageType } from "../../../utils/packageTypeDetector";
3
3
  import { getCreditAllocation } from "../../../utils/creditMapper";
4
+ import { NO_SUBSCRIPTION_PRODUCT_ID } from "../../subscription/application/syncConstants";
4
5
 
5
6
  export function calculateCreditLimit(productId: string | undefined, config: CreditsConfig): number {
6
7
  if (!productId) {
7
8
  throw new Error("[CreditLimitCalculator] Cannot calculate credit limit without productId");
8
9
  }
9
10
 
11
+ // Free tier users (no subscription) get 0 credits - strict paywall
12
+ if (productId === NO_SUBSCRIPTION_PRODUCT_ID) {
13
+ return 0;
14
+ }
15
+
10
16
  const explicitAmount = config.creditPackageAmounts?.[productId];
11
17
  if (explicitAmount) return explicitAmount;
12
18
 
@@ -51,6 +51,14 @@ export const SubscriptionDetailScreen: React.FC<SubscriptionDetailScreenProps> =
51
51
  daysRemaining={config.daysRemaining}
52
52
  hideTitle={!!config.onClose}
53
53
  translations={config.translations}
54
+ willRenew={config.willRenew}
55
+ productIdentifier={config.productIdentifier}
56
+ periodType={config.periodType}
57
+ store={config.store}
58
+ originalPurchaseDate={config.originalPurchaseDate}
59
+ latestPurchaseDate={config.latestPurchaseDate}
60
+ billingIssuesDetected={config.billingIssuesDetected}
61
+ isSandbox={config.isSandbox}
54
62
  />
55
63
  )}
56
64
  {showCredits && config.credits && (
@@ -20,6 +20,16 @@ export interface SubscriptionDetailTranslations {
20
20
  creditsResetInfo?: string;
21
21
  remainingLabel?: string;
22
22
  upgradeButton: string;
23
+ // Additional subscription details
24
+ willRenewLabel?: string;
25
+ productLabel?: string;
26
+ planTypeLabel?: string;
27
+ periodTypeLabel?: string;
28
+ storeLabel?: string;
29
+ originalPurchaseDateLabel?: string;
30
+ latestPurchaseDateLabel?: string;
31
+ billingIssuesLabel?: string;
32
+ sandboxLabel?: string;
23
33
  }
24
34
 
25
35
  export interface UpgradePromptConfig {
@@ -47,6 +57,15 @@ export interface SubscriptionDetailConfig {
47
57
  translations: SubscriptionDetailTranslations;
48
58
  upgradePrompt?: UpgradePromptConfig;
49
59
  onClose?: () => void;
60
+ // Additional RevenueCat subscription details
61
+ willRenew?: boolean | null;
62
+ productIdentifier?: string | null;
63
+ periodType?: string | null;
64
+ store?: string | null;
65
+ originalPurchaseDate?: string | null;
66
+ latestPurchaseDate?: string | null;
67
+ billingIssuesDetected?: boolean;
68
+ isSandbox?: boolean;
50
69
  }
51
70
 
52
71
  export interface SubscriptionDetailScreenProps {
@@ -18,6 +18,14 @@ export const SubscriptionHeader: React.FC<SubscriptionHeaderProps> = ({
18
18
  daysRemaining,
19
19
  hideTitle,
20
20
  translations,
21
+ willRenew,
22
+ productIdentifier,
23
+ periodType,
24
+ store,
25
+ originalPurchaseDate,
26
+ latestPurchaseDate,
27
+ billingIssuesDetected,
28
+ isSandbox,
21
29
  }) => {
22
30
  const tokens = useAppDesignTokens();
23
31
  const showExpiring = daysRemaining !== null && daysRemaining !== undefined && daysRemaining <= EXPIRING_SOON_THRESHOLD_DAYS;
@@ -50,6 +58,14 @@ export const SubscriptionHeader: React.FC<SubscriptionHeaderProps> = ({
50
58
  showExpiring={showExpiring}
51
59
  translations={translations}
52
60
  styles={styles}
61
+ willRenew={willRenew}
62
+ productIdentifier={productIdentifier}
63
+ periodType={periodType}
64
+ store={store}
65
+ originalPurchaseDate={originalPurchaseDate}
66
+ latestPurchaseDate={latestPurchaseDate}
67
+ billingIssuesDetected={billingIssuesDetected}
68
+ isSandbox={isSandbox}
53
69
  />
54
70
  </View>
55
71
  );
@@ -16,5 +16,23 @@ export interface SubscriptionHeaderProps {
16
16
  lifetimeLabel: string;
17
17
  expiresLabel: string;
18
18
  purchasedLabel: string;
19
+ willRenewLabel?: string;
20
+ productLabel?: string;
21
+ planTypeLabel?: string;
22
+ periodTypeLabel?: string;
23
+ storeLabel?: string;
24
+ originalPurchaseDateLabel?: string;
25
+ latestPurchaseDateLabel?: string;
26
+ billingIssuesLabel?: string;
27
+ sandboxLabel?: string;
19
28
  };
29
+ // Additional RevenueCat subscription details
30
+ willRenew?: boolean | null;
31
+ productIdentifier?: string | null;
32
+ periodType?: string | null;
33
+ store?: string | null;
34
+ originalPurchaseDate?: string | null;
35
+ latestPurchaseDate?: string | null;
36
+ billingIssuesDetected?: boolean;
37
+ isSandbox?: boolean;
20
38
  }
@@ -11,6 +11,14 @@ interface SubscriptionHeaderContentProps {
11
11
  showExpiring: boolean;
12
12
  translations: SubscriptionHeaderProps["translations"];
13
13
  styles: any;
14
+ willRenew?: boolean | null;
15
+ productIdentifier?: string | null;
16
+ periodType?: string | null;
17
+ store?: string | null;
18
+ originalPurchaseDate?: string | null;
19
+ latestPurchaseDate?: string | null;
20
+ billingIssuesDetected?: boolean;
21
+ isSandbox?: boolean;
14
22
  }
15
23
 
16
24
  export const SubscriptionHeaderContent: React.FC<SubscriptionHeaderContentProps> = ({
@@ -21,6 +29,14 @@ export const SubscriptionHeaderContent: React.FC<SubscriptionHeaderContentProps>
21
29
  showExpiring,
22
30
  translations,
23
31
  styles,
32
+ willRenew,
33
+ productIdentifier,
34
+ periodType,
35
+ store,
36
+ originalPurchaseDate,
37
+ latestPurchaseDate,
38
+ billingIssuesDetected,
39
+ isSandbox,
24
40
  }) => (
25
41
  <View style={styles.details}>
26
42
  {isLifetime ? (
@@ -52,6 +68,80 @@ export const SubscriptionHeaderContent: React.FC<SubscriptionHeaderContentProps>
52
68
  valueStyle={styles.value}
53
69
  />
54
70
  )}
71
+ {willRenew !== null && willRenew !== undefined && translations.willRenewLabel && (
72
+ <DetailRow
73
+ label={translations.willRenewLabel}
74
+ value={willRenew ? "Yes" : "No"}
75
+ highlight={!willRenew}
76
+ style={styles.row}
77
+ labelStyle={styles.label}
78
+ valueStyle={styles.value}
79
+ />
80
+ )}
81
+ {productIdentifier && translations.productLabel && (
82
+ <DetailRow
83
+ label={translations.productLabel}
84
+ value={productIdentifier}
85
+ style={styles.row}
86
+ labelStyle={styles.label}
87
+ valueStyle={styles.value}
88
+ />
89
+ )}
90
+ {periodType && translations.periodTypeLabel && (
91
+ <DetailRow
92
+ label={translations.periodTypeLabel}
93
+ value={periodType}
94
+ style={styles.row}
95
+ labelStyle={styles.label}
96
+ valueStyle={styles.value}
97
+ />
98
+ )}
99
+ {store && translations.storeLabel && (
100
+ <DetailRow
101
+ label={translations.storeLabel}
102
+ value={store}
103
+ style={styles.row}
104
+ labelStyle={styles.label}
105
+ valueStyle={styles.value}
106
+ />
107
+ )}
108
+ {originalPurchaseDate && translations.originalPurchaseDateLabel && (
109
+ <DetailRow
110
+ label={translations.originalPurchaseDateLabel}
111
+ value={originalPurchaseDate}
112
+ style={styles.row}
113
+ labelStyle={styles.label}
114
+ valueStyle={styles.value}
115
+ />
116
+ )}
117
+ {latestPurchaseDate && translations.latestPurchaseDateLabel && (
118
+ <DetailRow
119
+ label={translations.latestPurchaseDateLabel}
120
+ value={latestPurchaseDate}
121
+ style={styles.row}
122
+ labelStyle={styles.label}
123
+ valueStyle={styles.value}
124
+ />
125
+ )}
126
+ {billingIssuesDetected && translations.billingIssuesLabel && (
127
+ <DetailRow
128
+ label={translations.billingIssuesLabel}
129
+ value="Detected"
130
+ highlight={true}
131
+ style={styles.row}
132
+ labelStyle={styles.label}
133
+ valueStyle={styles.value}
134
+ />
135
+ )}
136
+ {isSandbox && translations.sandboxLabel && (
137
+ <DetailRow
138
+ label={translations.sandboxLabel}
139
+ value="Test Mode"
140
+ style={styles.row}
141
+ labelStyle={styles.label}
142
+ valueStyle={styles.value}
143
+ />
144
+ )}
55
145
  </>
56
146
  )}
57
147
  </View>