@umituz/react-native-subscription 2.40.0 → 2.40.1

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.40.0",
3
+ "version": "2.40.1",
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",
@@ -74,14 +74,33 @@ export function usePaywallActions({
74
74
  return;
75
75
  }
76
76
 
77
+ if (__DEV__) {
78
+ console.log('[usePaywallActions] Starting purchase', {
79
+ productId: pkg.product.identifier,
80
+ hasOnClose: !!onCloseRef.current,
81
+ hasOnSuccess: !!onPurchaseSuccessRef.current,
82
+ });
83
+ }
84
+
77
85
  setIsLocalProcessing(true);
78
86
  startPurchase(currentSelectedId, "manual");
79
87
 
80
88
  try {
81
89
  const success = await onPurchaseRef.current(pkg);
90
+ if (__DEV__) {
91
+ console.log('[usePaywallActions] Purchase completed', { success });
92
+ }
82
93
  if (success === true) {
94
+ if (__DEV__) {
95
+ console.log('[usePaywallActions] Purchase successful, calling onPurchaseSuccess and onClose');
96
+ }
83
97
  onPurchaseSuccessRef.current?.();
98
+ // Always close paywall on successful purchase
84
99
  onCloseRef.current?.();
100
+ } else {
101
+ if (__DEV__) {
102
+ console.warn('[usePaywallActions] Purchase returned false, not closing');
103
+ }
85
104
  }
86
105
  } catch (error) {
87
106
  onPurchaseErrorRef.current?.(error instanceof Error ? error : new Error(String(error)));
@@ -99,12 +118,29 @@ export function usePaywallActions({
99
118
 
100
119
  if (isProcessingRef.current) return;
101
120
 
121
+ if (__DEV__) {
122
+ console.log('[usePaywallActions] Starting restore', {
123
+ hasOnClose: !!onCloseRef.current,
124
+ hasOnSuccess: !!onPurchaseSuccessRef.current,
125
+ });
126
+ }
127
+
102
128
  setIsLocalProcessing(true);
103
129
  try {
104
130
  const success = await onRestoreRef.current();
131
+ if (__DEV__) {
132
+ console.log('[usePaywallActions] Restore completed', { success });
133
+ }
105
134
  if (success === true) {
135
+ if (__DEV__) {
136
+ console.log('[usePaywallActions] Restore successful, calling onPurchaseSuccess and onClose');
137
+ }
106
138
  onPurchaseSuccessRef.current?.();
107
139
  onCloseRef.current?.();
140
+ } else {
141
+ if (__DEV__) {
142
+ console.warn('[usePaywallActions] Restore returned false, not closing');
143
+ }
108
144
  }
109
145
  } catch (error) {
110
146
  onPurchaseErrorRef.current?.(error instanceof Error ? error : new Error(String(error)));