@umituz/react-native-subscription 2.28.0 → 2.28.2

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.0",
3
+ "version": "2.28.2",
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",
@@ -25,30 +25,15 @@ export const useSubscriptionStatus = (): SubscriptionStatusResult => {
25
25
  subscriptionStatusQueryKeys.user
26
26
  ),
27
27
  queryFn: async () => {
28
- const defaultStatus = {
29
- isPremium: false,
30
- expirationDate: null,
31
- willRenew: false,
32
- productIdentifier: null,
33
- originalPurchaseDate: null,
34
- latestPurchaseDate: null,
35
- billingIssuesDetected: false,
36
- isSandbox: false,
37
- periodType: null,
38
- store: null,
39
- gracePeriodExpiresDate: null,
40
- unsubscribeDetectedAt: null,
41
- };
42
-
43
28
  if (!isAuthenticated(userId)) {
44
- return defaultStatus;
29
+ return null;
45
30
  }
46
31
 
47
32
  try {
48
33
  const result = await SubscriptionManager.checkPremiumStatus();
49
- return result ?? defaultStatus;
34
+ return result;
50
35
  } catch {
51
- return defaultStatus;
36
+ return null;
52
37
  }
53
38
  },
54
39
  enabled: queryEnabled,
@@ -74,18 +59,18 @@ export const useSubscriptionStatus = (): SubscriptionStatusResult => {
74
59
  const isLoading = status === "pending";
75
60
 
76
61
  return {
77
- isPremium: data?.isPremium ?? false,
78
- expirationDate: data?.expirationDate ?? null,
79
- willRenew: data?.willRenew ?? false,
80
- productIdentifier: data?.productIdentifier ?? null,
81
- originalPurchaseDate: data?.originalPurchaseDate ?? null,
82
- latestPurchaseDate: data?.latestPurchaseDate ?? null,
83
- billingIssuesDetected: data?.billingIssuesDetected ?? false,
84
- isSandbox: data?.isSandbox ?? false,
85
- periodType: data?.periodType ?? null,
86
- store: data?.store ?? null,
87
- gracePeriodExpiresDate: data?.gracePeriodExpiresDate ?? null,
88
- unsubscribeDetectedAt: data?.unsubscribeDetectedAt ?? null,
62
+ isPremium: data?.isPremium || false,
63
+ expirationDate: data?.expirationDate || null,
64
+ willRenew: data?.willRenew || false,
65
+ productIdentifier: data?.productIdentifier || null,
66
+ originalPurchaseDate: data?.originalPurchaseDate || null,
67
+ latestPurchaseDate: data?.latestPurchaseDate || null,
68
+ billingIssuesDetected: data?.billingIssuesDetected || false,
69
+ isSandbox: data?.isSandbox || false,
70
+ periodType: data?.periodType || null,
71
+ store: data?.store || null,
72
+ gracePeriodExpiresDate: data?.gracePeriodExpiresDate || null,
73
+ unsubscribeDetectedAt: data?.unsubscribeDetectedAt || null,
89
74
  isLoading,
90
75
  error: error as Error | null,
91
76
  refetch,