@umituz/react-native-subscription 2.14.75 → 2.14.77

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.14.75",
3
+ "version": "2.14.77",
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
  * Apps just call initializeSubscription with config
5
5
  */
6
6
 
7
+ import { Platform } from "react-native";
7
8
  import type { CustomerInfo } from "react-native-purchases";
8
9
  import type { CreditsConfig } from "../../domain/entities/Credits";
9
10
  import { configureCreditsRepository, getCreditsRepository } from "../repositories/CreditsRepositoryProvider";
@@ -23,7 +24,12 @@ export interface CreditPackageConfig {
23
24
  }
24
25
 
25
26
  export interface SubscriptionInitConfig {
26
- apiKey: string;
27
+ /** API key for RevenueCat (can provide single key or platform-specific keys) */
28
+ apiKey?: string;
29
+ /** iOS-specific API key (overrides apiKey if provided on iOS) */
30
+ apiKeyIos?: string;
31
+ /** Android-specific API key (overrides apiKey if provided on Android) */
32
+ apiKeyAndroid?: string;
27
33
  testStoreKey?: string;
28
34
  entitlementId: string;
29
35
  credits: CreditsConfig;
@@ -83,6 +89,8 @@ export const initializeSubscription = async (
83
89
  ): Promise<void> => {
84
90
  const {
85
91
  apiKey,
92
+ apiKeyIos,
93
+ apiKeyAndroid,
86
94
  testStoreKey,
87
95
  entitlementId,
88
96
  credits,
@@ -95,7 +103,12 @@ export const initializeSubscription = async (
95
103
  authStateTimeoutMs = 2000,
96
104
  } = config;
97
105
 
98
- if (!apiKey) {
106
+ // Resolve API key based on platform
107
+ const resolvedApiKey = Platform.OS === "ios"
108
+ ? (apiKeyIos || apiKey || "")
109
+ : (apiKeyAndroid || apiKey || "");
110
+
111
+ if (!resolvedApiKey) {
99
112
  throw new Error("RevenueCat API key is required");
100
113
  }
101
114
 
@@ -180,7 +193,7 @@ export const initializeSubscription = async (
180
193
 
181
194
  SubscriptionManager.configure({
182
195
  config: {
183
- apiKey,
196
+ apiKey: resolvedApiKey,
184
197
  testStoreKey,
185
198
  entitlementIdentifier: entitlementId,
186
199
  consumableProductIdentifiers: consumableIdentifiers,
@@ -188,7 +201,7 @@ export const initializeSubscription = async (
188
201
  onCreditsUpdated,
189
202
  onPurchaseCompleted: handlePurchaseCompleted,
190
203
  },
191
- apiKey,
204
+ apiKey: resolvedApiKey,
192
205
  getAnonymousUserId,
193
206
  });
194
207
 
@@ -50,7 +50,7 @@ export const PremiumStatusBadge: React.FC<PremiumStatusBadgeProps> = ({
50
50
  badge: {
51
51
  paddingHorizontal: tokens.spacing.sm,
52
52
  paddingVertical: tokens.spacing.xs,
53
- borderRadius: tokens.borderRadius.xs,
53
+ borderRadius: tokens.radius.xs,
54
54
  backgroundColor,
55
55
  },
56
56
  badgeText: {
@@ -42,7 +42,7 @@ export const CreditItem: React.FC<CreditItemProps> = ({
42
42
  badge: {
43
43
  paddingHorizontal: tokens.spacing.md,
44
44
  paddingVertical: tokens.spacing.xs,
45
- borderRadius: tokens.borderRadius.md,
45
+ borderRadius: tokens.radius.md,
46
46
  backgroundColor: tokens.colors.surfaceSecondary,
47
47
  },
48
48
  count: {
@@ -50,13 +50,13 @@ export const CreditItem: React.FC<CreditItemProps> = ({
50
50
  },
51
51
  progressBar: {
52
52
  height: 8,
53
- borderRadius: tokens.borderRadius.xs,
53
+ borderRadius: tokens.radius.xs,
54
54
  overflow: "hidden",
55
55
  backgroundColor: tokens.colors.surfaceSecondary,
56
56
  },
57
57
  progressFill: {
58
58
  height: "100%",
59
- borderRadius: tokens.borderRadius.xs,
59
+ borderRadius: tokens.radius.xs,
60
60
  width: `${percentage}%`,
61
61
  backgroundColor: progressColor,
62
62
  },
@@ -21,7 +21,7 @@ export const CreditsList: React.FC<CreditsListProps> = ({
21
21
  () =>
22
22
  StyleSheet.create({
23
23
  container: {
24
- borderRadius: tokens.borderRadius.lg,
24
+ borderRadius: tokens.radius.lg,
25
25
  padding: tokens.spacing.lg,
26
26
  gap: tokens.spacing.lg,
27
27
  backgroundColor: tokens.colors.surface,
@@ -47,7 +47,7 @@ export const DevTestSection: React.FC<DevTestSectionWithTranslationsProps> = ({
47
47
  button: {
48
48
  paddingVertical: tokens.spacing.md,
49
49
  paddingHorizontal: tokens.spacing.lg,
50
- borderRadius: tokens.borderRadius.md,
50
+ borderRadius: tokens.radius.md,
51
51
  alignItems: "center",
52
52
  },
53
53
  primaryButton: {
@@ -23,7 +23,7 @@ export const SubscriptionActions: React.FC<SubscriptionActionsProps> = ({
23
23
  },
24
24
  primaryButton: {
25
25
  paddingVertical: tokens.spacing.md,
26
- borderRadius: tokens.borderRadius.lg,
26
+ borderRadius: tokens.radius.lg,
27
27
  alignItems: "center",
28
28
  backgroundColor: tokens.colors.primary,
29
29
  },
@@ -26,7 +26,7 @@ export const SubscriptionHeader: React.FC<SubscriptionHeaderProps> = ({
26
26
  () =>
27
27
  StyleSheet.create({
28
28
  container: {
29
- borderRadius: tokens.borderRadius.lg,
29
+ borderRadius: tokens.radius.lg,
30
30
  padding: tokens.spacing.lg,
31
31
  gap: tokens.spacing.lg,
32
32
  backgroundColor: tokens.colors.surface,
@@ -49,7 +49,7 @@ export const UpgradePrompt: React.FC<UpgradePromptProps> = ({
49
49
  lineHeight: 22,
50
50
  },
51
51
  benefitsCard: {
52
- borderRadius: tokens.borderRadius.lg,
52
+ borderRadius: tokens.radius.lg,
53
53
  padding: tokens.spacing.lg,
54
54
  gap: tokens.spacing.md,
55
55
  backgroundColor: tokens.colors.surface,
@@ -72,7 +72,7 @@ export const UpgradePrompt: React.FC<UpgradePromptProps> = ({
72
72
  },
73
73
  upgradeButton: {
74
74
  paddingVertical: tokens.spacing.lg,
75
- borderRadius: tokens.borderRadius.lg,
75
+ borderRadius: tokens.radius.lg,
76
76
  alignItems: "center",
77
77
  backgroundColor: tokens.colors.primary,
78
78
  },