@umituz/react-native-subscription 2.37.120 → 2.37.123
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.37.
|
|
3
|
+
"version": "2.37.123",
|
|
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",
|
|
@@ -78,7 +78,14 @@ export async function deductCreditsOperation(
|
|
|
78
78
|
? message
|
|
79
79
|
: CREDIT_ERROR_CODES.DEDUCT_ERR;
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
// Use console.warn instead of console.error for "no credits" - this is expected behavior, not a system error
|
|
82
|
+
if (__DEV__) {
|
|
83
|
+
if (code === CREDIT_ERROR_CODES.NO_CREDITS || code === CREDIT_ERROR_CODES.CREDITS_EXHAUSTED) {
|
|
84
|
+
console.warn('[DeductCreditsCommand] ⚠️ User has no credits - paywall should open', { code, message });
|
|
85
|
+
} else {
|
|
86
|
+
console.error('[DeductCreditsCommand] ❌ Unexpected transaction error:', { code, message });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
82
89
|
|
|
83
90
|
return {
|
|
84
91
|
success: false,
|
|
@@ -28,7 +28,9 @@ export const useDeductCredit = ({
|
|
|
28
28
|
if (__DEV__) console.log('[useDeductCredit] mutation result:', JSON.stringify(res));
|
|
29
29
|
if (!res.success) {
|
|
30
30
|
if (__DEV__) console.log('[useDeductCredit] deduction FAILED:', res.error?.code, res.error?.message);
|
|
31
|
-
|
|
31
|
+
// Call onCreditsExhausted for any credit-related error codes
|
|
32
|
+
if (res.error?.code === "CREDITS_EXHAUSTED" || res.error?.code === "DEDUCT_ERR" || res.error?.code === "NO_CREDITS") {
|
|
33
|
+
if (__DEV__) console.log('[useDeductCredit] Credits exhausted, calling onCreditsExhausted callback');
|
|
32
34
|
onCreditsExhausted?.();
|
|
33
35
|
}
|
|
34
36
|
return false;
|