@umituz/react-native-subscription 2.31.11 → 2.31.12
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 +1 -1
- package/src/domains/credits/presentation/useCredits.ts +1 -1
- package/src/domains/subscription/infrastructure/handlers/PurchaseStatusResolver.ts +9 -9
- package/src/domains/subscription/infrastructure/hooks/useCustomerInfo.ts +2 -0
- package/src/domains/subscription/presentation/useSubscriptionStatus.ts +12 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.31.
|
|
3
|
+
"version": "2.31.12",
|
|
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,16 +25,16 @@ export class PurchaseStatusResolver {
|
|
|
25
25
|
return {
|
|
26
26
|
isPremium: true,
|
|
27
27
|
expirationDate: toDate(entitlement.expirationDate),
|
|
28
|
-
willRenew: entitlement.willRenew
|
|
29
|
-
productIdentifier: entitlement.productIdentifier
|
|
30
|
-
originalPurchaseDate: toDate(entitlement.originalPurchaseDate)
|
|
31
|
-
latestPurchaseDate: toDate(entitlement.latestPurchaseDate)
|
|
28
|
+
willRenew: entitlement.willRenew ?? false,
|
|
29
|
+
productIdentifier: entitlement.productIdentifier ?? null,
|
|
30
|
+
originalPurchaseDate: toDate(entitlement.originalPurchaseDate) ?? null,
|
|
31
|
+
latestPurchaseDate: toDate(entitlement.latestPurchaseDate) ?? null,
|
|
32
32
|
billingIssuesDetected: entitlement.billingIssueDetectedAt !== null && entitlement.billingIssueDetectedAt !== undefined,
|
|
33
|
-
isSandbox: entitlement.isSandbox
|
|
34
|
-
periodType: entitlement.periodType
|
|
35
|
-
store: null,
|
|
36
|
-
gracePeriodExpiresDate: null,
|
|
37
|
-
unsubscribeDetectedAt: toDate(entitlement.unsubscribeDetectedAt)
|
|
33
|
+
isSandbox: entitlement.isSandbox ?? false,
|
|
34
|
+
periodType: entitlement.periodType ?? null,
|
|
35
|
+
store: null,
|
|
36
|
+
gracePeriodExpiresDate: null,
|
|
37
|
+
unsubscribeDetectedAt: toDate(entitlement.unsubscribeDetectedAt) ?? null,
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -91,12 +91,14 @@ export function useCustomerInfo(): UseCustomerInfoResult {
|
|
|
91
91
|
setError(null);
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
+
// Set ref BEFORE adding listener to ensure cleanup can always find it
|
|
94
95
|
listenerRef.current = listener;
|
|
95
96
|
Purchases.addCustomerInfoUpdateListener(listener);
|
|
96
97
|
|
|
97
98
|
return () => {
|
|
98
99
|
if (listenerRef.current) {
|
|
99
100
|
Purchases.removeCustomerInfoUpdateListener(listenerRef.current);
|
|
101
|
+
listenerRef.current = null;
|
|
100
102
|
}
|
|
101
103
|
};
|
|
102
104
|
}, [fetchCustomerInfo]);
|
|
@@ -75,18 +75,18 @@ export const useSubscriptionStatus = (): SubscriptionStatusResult => {
|
|
|
75
75
|
const isLoading = status === "pending";
|
|
76
76
|
|
|
77
77
|
return {
|
|
78
|
-
isPremium: data?.isPremium
|
|
79
|
-
expirationDate: data?.expirationDate
|
|
80
|
-
willRenew: data?.willRenew
|
|
81
|
-
productIdentifier: data?.productIdentifier
|
|
82
|
-
originalPurchaseDate: data?.originalPurchaseDate
|
|
83
|
-
latestPurchaseDate: data?.latestPurchaseDate
|
|
84
|
-
billingIssuesDetected: data?.billingIssuesDetected
|
|
85
|
-
isSandbox: data?.isSandbox
|
|
86
|
-
periodType: data?.periodType
|
|
87
|
-
store: data?.store
|
|
88
|
-
gracePeriodExpiresDate: data?.gracePeriodExpiresDate
|
|
89
|
-
unsubscribeDetectedAt: data?.unsubscribeDetectedAt
|
|
78
|
+
isPremium: data?.isPremium ?? false,
|
|
79
|
+
expirationDate: data?.expirationDate ?? null,
|
|
80
|
+
willRenew: data?.willRenew ?? false,
|
|
81
|
+
productIdentifier: data?.productIdentifier ?? null,
|
|
82
|
+
originalPurchaseDate: data?.originalPurchaseDate ?? null,
|
|
83
|
+
latestPurchaseDate: data?.latestPurchaseDate ?? null,
|
|
84
|
+
billingIssuesDetected: data?.billingIssuesDetected ?? false,
|
|
85
|
+
isSandbox: data?.isSandbox ?? false,
|
|
86
|
+
periodType: data?.periodType ?? null,
|
|
87
|
+
store: data?.store ?? null,
|
|
88
|
+
gracePeriodExpiresDate: data?.gracePeriodExpiresDate ?? null,
|
|
89
|
+
unsubscribeDetectedAt: data?.unsubscribeDetectedAt ?? null,
|
|
90
90
|
isLoading,
|
|
91
91
|
error: error as Error | null,
|
|
92
92
|
refetch,
|