@umituz/react-native-subscription 2.19.2 → 2.19.3
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.19.
|
|
3
|
+
"version": "2.19.3",
|
|
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",
|
|
@@ -40,15 +40,25 @@ export const initializeSubscription = async (config: SubscriptionInitConfig): Pr
|
|
|
40
40
|
configureCreditsRepository({ ...credits, creditPackageAmounts: creditPackages?.amounts });
|
|
41
41
|
|
|
42
42
|
const onPurchase = async (userId: string, productId: string, _customerInfo: unknown, source?: string) => {
|
|
43
|
+
if (__DEV__) {
|
|
44
|
+
console.log('[SubscriptionInitializer] onPurchase called:', { userId, productId, source });
|
|
45
|
+
}
|
|
43
46
|
try {
|
|
44
|
-
await getCreditsRepository().initializeCredits(
|
|
47
|
+
const result = await getCreditsRepository().initializeCredits(
|
|
45
48
|
userId,
|
|
46
49
|
`purchase_${productId}_${Date.now()}`,
|
|
47
50
|
productId,
|
|
48
51
|
source as any
|
|
49
52
|
);
|
|
53
|
+
if (__DEV__) {
|
|
54
|
+
console.log('[SubscriptionInitializer] Credits initialized:', result);
|
|
55
|
+
}
|
|
50
56
|
onCreditsUpdated?.(userId);
|
|
51
|
-
} catch {
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (__DEV__) {
|
|
59
|
+
console.error('[SubscriptionInitializer] Credits init failed:', error);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
52
62
|
};
|
|
53
63
|
|
|
54
64
|
const onRenewal = async (userId: string, productId: string, renewalId: string) => {
|
|
@@ -37,6 +37,8 @@ export async function syncPremiumStatus(
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
declare const __DEV__: boolean;
|
|
41
|
+
|
|
40
42
|
export async function notifyPurchaseCompleted(
|
|
41
43
|
config: RevenueCatConfig,
|
|
42
44
|
userId: string,
|
|
@@ -44,14 +46,31 @@ export async function notifyPurchaseCompleted(
|
|
|
44
46
|
customerInfo: CustomerInfo,
|
|
45
47
|
source?: string
|
|
46
48
|
): Promise<void> {
|
|
49
|
+
if (__DEV__) {
|
|
50
|
+
console.log('[PremiumStatusSyncer] notifyPurchaseCompleted called:', {
|
|
51
|
+
userId,
|
|
52
|
+
productId,
|
|
53
|
+
source,
|
|
54
|
+
hasCallback: !!config.onPurchaseCompleted,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
47
58
|
if (!config.onPurchaseCompleted) {
|
|
59
|
+
if (__DEV__) {
|
|
60
|
+
console.warn('[PremiumStatusSyncer] No onPurchaseCompleted callback configured!');
|
|
61
|
+
}
|
|
48
62
|
return;
|
|
49
63
|
}
|
|
50
64
|
|
|
51
65
|
try {
|
|
52
66
|
await config.onPurchaseCompleted(userId, productId, customerInfo, source);
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
if (__DEV__) {
|
|
68
|
+
console.log('[PremiumStatusSyncer] onPurchaseCompleted callback executed successfully');
|
|
69
|
+
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (__DEV__) {
|
|
72
|
+
console.error('[PremiumStatusSyncer] onPurchaseCompleted callback failed:', error);
|
|
73
|
+
}
|
|
55
74
|
}
|
|
56
75
|
}
|
|
57
76
|
|