@umituz/react-native-subscription 2.14.70 → 2.14.72
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.
|
|
3
|
+
"version": "2.14.72",
|
|
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",
|
|
@@ -57,18 +57,31 @@ 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
|
|
|
67
|
-
//
|
|
68
|
-
//
|
|
69
|
-
const
|
|
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
|
+
|
|
68
|
+
// Get expiration date from RevenueCat entitlement (source of truth)
|
|
69
|
+
// premiumEntitlement.expirationDate is an ISO string from RevenueCat
|
|
70
|
+
const entitlementExpirationDate = premiumEntitlement?.expirationDate || null;
|
|
71
|
+
|
|
72
|
+
// Prefer CustomerInfo expiration (real-time) over cached status
|
|
73
|
+
const expiresAtIso = entitlementExpirationDate || (statusExpirationDate
|
|
70
74
|
? statusExpirationDate.toISOString()
|
|
71
|
-
:
|
|
75
|
+
: null);
|
|
76
|
+
|
|
77
|
+
if (__DEV__) {
|
|
78
|
+
console.log("[useSubscriptionSettingsConfig] Date sources:", {
|
|
79
|
+
entitlementExpirationDate,
|
|
80
|
+
statusExpirationDate: statusExpirationDate?.toISOString() || null,
|
|
81
|
+
finalExpiresAtIso: expiresAtIso,
|
|
82
|
+
premiumEntitlementKeys: premiumEntitlement ? Object.keys(premiumEntitlement) : null,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
72
85
|
|
|
73
86
|
const willRenew = premiumEntitlement?.willRenew || false;
|
|
74
87
|
const purchasedAtIso = convertPurchasedAt(credits?.purchasedAt);
|
|
@@ -47,8 +47,11 @@ export const useSubscriptionStatus = ({
|
|
|
47
47
|
return SubscriptionManager.checkPremiumStatus();
|
|
48
48
|
},
|
|
49
49
|
enabled: enabled && !!userId && SubscriptionManager.isInitializedForUser(userId),
|
|
50
|
-
staleTime:
|
|
51
|
-
gcTime:
|
|
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 {
|