@umituz/react-native-subscription 2.14.18 → 2.14.20

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.18",
3
+ "version": "2.14.20",
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",
@@ -37,15 +37,19 @@ export const useAuthAwarePurchase = (): UseAuthAwarePurchaseResult => {
37
37
 
38
38
  const handlePurchase = useCallback(
39
39
  async (pkg: PurchasesPackage): Promise<boolean> => {
40
+ // SECURITY: Block purchase if auth provider not configured
40
41
  if (!globalAuthProvider) {
41
42
  if (__DEV__) {
42
- console.warn(
43
- "[useAuthAwarePurchase] Auth provider not configured. Call configureAuthProvider() at app start.",
43
+ console.error(
44
+ "[useAuthAwarePurchase] CRITICAL: Auth provider not configured. " +
45
+ "Call configureAuthProvider() at app start. Purchase blocked for security.",
44
46
  );
45
47
  }
46
- return purchasePackage(pkg);
48
+ // Block purchase - never allow without auth provider
49
+ return false;
47
50
  }
48
51
 
52
+ // Block purchase if user not authenticated (anonymous users cannot purchase)
49
53
  if (!globalAuthProvider.isAuthenticated()) {
50
54
  if (__DEV__) {
51
55
  console.log(
@@ -63,15 +67,19 @@ export const useAuthAwarePurchase = (): UseAuthAwarePurchaseResult => {
63
67
  );
64
68
 
65
69
  const handleRestore = useCallback(async (): Promise<boolean> => {
70
+ // SECURITY: Block restore if auth provider not configured
66
71
  if (!globalAuthProvider) {
67
72
  if (__DEV__) {
68
- console.warn(
69
- "[useAuthAwarePurchase] Auth provider not configured. Call configureAuthProvider() at app start.",
73
+ console.error(
74
+ "[useAuthAwarePurchase] CRITICAL: Auth provider not configured. " +
75
+ "Call configureAuthProvider() at app start. Restore blocked for security.",
70
76
  );
71
77
  }
72
- return restorePurchase();
78
+ // Block restore - never allow without auth provider
79
+ return false;
73
80
  }
74
81
 
82
+ // Block restore if user not authenticated
75
83
  if (!globalAuthProvider.isAuthenticated()) {
76
84
  if (__DEV__) {
77
85
  console.log(
@@ -78,9 +78,6 @@ export const useSubscriptionSettingsConfig = (
78
78
  [expiresAtIso]
79
79
  );
80
80
 
81
- // Subscription press handler - always opens paywall for upgrade
82
- const handleSubscriptionPress = openPaywall;
83
-
84
81
  // Status type
85
82
  const statusType: SubscriptionStatusType = isPremium ? "active" : "none";
86
83
 
@@ -112,7 +109,7 @@ export const useSubscriptionSettingsConfig = (
112
109
  ? translations.statusActive
113
110
  : translations.statusFree,
114
111
  icon: "diamond",
115
- onPress: handleSubscriptionPress,
112
+ onPress: openPaywall,
116
113
  },
117
114
  sectionConfig: {
118
115
  statusType,
@@ -58,7 +58,7 @@ export const useSubscriptionStatus = ({
58
58
 
59
59
  return status;
60
60
  },
61
- enabled: enabled && !!userId && SubscriptionManager.isInitialized(),
61
+ enabled: enabled && !!userId && SubscriptionManager.isInitializedForUser(userId),
62
62
  staleTime: 30 * 1000,
63
63
  gcTime: 5 * 60 * 1000,
64
64
  });