@umituz/react-native-subscription 2.14.69 → 2.14.71

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.69",
3
+ "version": "2.14.71",
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",
@@ -77,6 +77,9 @@ export const useCredits = ({
77
77
  enabled: enabled && !!userId && isConfigured,
78
78
  staleTime,
79
79
  gcTime,
80
+ refetchOnMount: true, // Refetch when component mounts
81
+ refetchOnWindowFocus: true, // Refetch when app becomes active
82
+ refetchOnReconnect: true, // Refetch when network reconnects
80
83
  });
81
84
 
82
85
  const credits = data ?? null;
@@ -57,13 +57,14 @@ export const useSubscriptionSettingsConfig = (
57
57
  const { customerInfo } = useCustomerInfo();
58
58
  const { openPaywall } = usePaywallVisibility();
59
59
 
60
- // Premium status from actual RevenueCat subscription
61
- const isPremium = subscriptionActive;
62
-
63
60
  // RevenueCat entitlement info - dynamically using configured entitlementId
64
61
  const entitlementId = SubscriptionManager.getEntitlementId() || "premium";
65
62
  const premiumEntitlement = customerInfo?.entitlements.active[entitlementId];
66
63
 
64
+ // Premium status: use customerInfo directly as it updates in real-time via listener
65
+ // This is the source of truth, subscriptionActive is just a backup
66
+ const isPremium = !!premiumEntitlement || subscriptionActive;
67
+
67
68
  // Prefer expiration date from useSubscriptionStatus (checkPremiumStatus)
68
69
  // as it is already processed and typed. Fallback to CustomerInfo ISO string.
69
70
  const expiresAtIso = statusExpirationDate
@@ -47,8 +47,11 @@ export const useSubscriptionStatus = ({
47
47
  return SubscriptionManager.checkPremiumStatus();
48
48
  },
49
49
  enabled: enabled && !!userId && SubscriptionManager.isInitializedForUser(userId),
50
- staleTime: 30 * 1000,
51
- gcTime: 5 * 60 * 1000,
50
+ staleTime: 0, // No cache - always fetch fresh premium status
51
+ gcTime: 0, // Don't cache - garbage collect immediately
52
+ refetchOnMount: true,
53
+ refetchOnWindowFocus: true,
54
+ refetchOnReconnect: true,
52
55
  });
53
56
 
54
57
  return {
@@ -12,5 +12,7 @@ export const SUBSCRIPTION_QUERY_KEYS = {
12
12
  ["subscription", "initialized", userId] as const,
13
13
  } as const;
14
14
 
15
- export const STALE_TIME = 5 * 60 * 1000; // 5 minutes
16
- export const GC_TIME = 30 * 60 * 1000; // 30 minutes
15
+ // No cache - always fetch fresh data for subscription packages
16
+ // This ensures users always see real-time subscription status
17
+ export const STALE_TIME = 0; // Always stale - refetch immediately
18
+ export const GC_TIME = 0; // Don't cache - garbage collect immediately
@@ -38,5 +38,7 @@ export const useSubscriptionPackages = (userId: string | undefined) => {
38
38
  gcTime: GC_TIME,
39
39
  enabled: isConfigured,
40
40
  refetchOnMount: true,
41
+ refetchOnWindowFocus: true, // Refetch when app becomes active
42
+ refetchOnReconnect: true, // Refetch when network reconnects
41
43
  });
42
44
  };