@umituz/react-native-subscription 2.27.114 → 2.27.115
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/subscription/application/SubscriptionSyncService.ts +3 -0
- package/src/domains/subscription/infrastructure/services/CustomerInfoListenerManager.ts +3 -0
- package/src/domains/subscription/infrastructure/services/RevenueCatInitializer.ts +1 -0
- package/src/domains/subscription/infrastructure/services/RevenueCatService.ts +1 -0
- package/src/domains/subscription/infrastructure/utils/PremiumStatusSyncer.ts +3 -0
- package/src/domains/subscription/presentation/useAuthAwarePurchase.ts +4 -8
- package/src/domains/wallet/infrastructure/repositories/TransactionRepository.ts +1 -1
- package/src/shared/infrastructure/SubscriptionEventBus.ts +1 -0
- package/src/shared/utils/Result.ts +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.115",
|
|
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",
|
|
@@ -31,6 +31,7 @@ export class SubscriptionSyncService {
|
|
|
31
31
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.CREDITS_UPDATED, userId);
|
|
32
32
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.PURCHASE_COMPLETED, { userId, productId });
|
|
33
33
|
} catch {
|
|
34
|
+
// Ignored to prevent background sync errors from disrupting user experience
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
@@ -54,6 +55,7 @@ export class SubscriptionSyncService {
|
|
|
54
55
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.CREDITS_UPDATED, userId);
|
|
55
56
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.RENEWAL_DETECTED, { userId, productId });
|
|
56
57
|
} catch {
|
|
58
|
+
// Ignored to prevent background sync errors from disrupting user experience
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
|
|
@@ -121,6 +123,7 @@ export class SubscriptionSyncService {
|
|
|
121
123
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.CREDITS_UPDATED, userId);
|
|
122
124
|
subscriptionEventBus.emit(SUBSCRIPTION_EVENTS.PREMIUM_STATUS_CHANGED, { userId, isPremium });
|
|
123
125
|
} catch {
|
|
126
|
+
// Ignored to prevent background sync errors from disrupting user experience
|
|
124
127
|
}
|
|
125
128
|
}
|
|
126
129
|
}
|
|
@@ -66,6 +66,7 @@ export class CustomerInfoListenerManager {
|
|
|
66
66
|
customerInfo
|
|
67
67
|
);
|
|
68
68
|
} catch {
|
|
69
|
+
// Silently fail listener callbacks to prevent crashing the main listener
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -80,6 +81,7 @@ export class CustomerInfoListenerManager {
|
|
|
80
81
|
customerInfo
|
|
81
82
|
);
|
|
82
83
|
} catch {
|
|
84
|
+
// Silently fail listener callbacks to prevent crashing the main listener
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -91,6 +93,7 @@ export class CustomerInfoListenerManager {
|
|
|
91
93
|
try {
|
|
92
94
|
await syncPremiumStatus(config, this.currentUserId, customerInfo);
|
|
93
95
|
} catch {
|
|
96
|
+
// Silently fail listener callbacks to prevent crashing the main listener
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
};
|
|
@@ -36,6 +36,7 @@ export async function syncPremiumStatus(
|
|
|
36
36
|
await config.onPremiumStatusChanged(userId, false, undefined, undefined, undefined, undefined);
|
|
37
37
|
}
|
|
38
38
|
} catch {
|
|
39
|
+
// Silently fail callback notifications to prevent crashing the main flow
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -53,6 +54,7 @@ export async function notifyPurchaseCompleted(
|
|
|
53
54
|
try {
|
|
54
55
|
await config.onPurchaseCompleted(userId, productId, customerInfo, source);
|
|
55
56
|
} catch {
|
|
57
|
+
// Silently fail callback notifications to prevent crashing the main flow
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -69,5 +71,6 @@ export async function notifyRestoreCompleted(
|
|
|
69
71
|
try {
|
|
70
72
|
await config.onRestoreCompleted(userId, isPremium, customerInfo);
|
|
71
73
|
} catch {
|
|
74
|
+
// Silently fail callback notifications to prevent crashing the main flow
|
|
72
75
|
}
|
|
73
76
|
}
|
|
@@ -84,15 +84,11 @@ export const useAuthAwarePurchase = (
|
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
authPurchaseStateManager.clearSavedPurchase();
|
|
91
|
-
}
|
|
92
|
-
return result;
|
|
93
|
-
} catch (error) {
|
|
94
|
-
throw error;
|
|
87
|
+
const result = await purchasePackage(saved.pkg);
|
|
88
|
+
if (result) {
|
|
89
|
+
authPurchaseStateManager.clearSavedPurchase();
|
|
95
90
|
}
|
|
91
|
+
return result;
|
|
96
92
|
}, [purchasePackage]);
|
|
97
93
|
|
|
98
94
|
return {
|
|
@@ -114,22 +114,6 @@ export function tryCatchSync<T>(
|
|
|
114
114
|
return failure(mappedError);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
export function tryCatchSync<T>(
|
|
118
|
-
fn: () => T,
|
|
119
|
-
errorMapper?: (error: unknown) => Error
|
|
120
|
-
): Result<T, Error> {
|
|
121
|
-
try {
|
|
122
|
-
const data = fn();
|
|
123
|
-
return success(data);
|
|
124
|
-
} catch {
|
|
125
|
-
const mappedError = errorMapper
|
|
126
|
-
? errorMapper(error)
|
|
127
|
-
: error instanceof Error
|
|
128
|
-
? error
|
|
129
|
-
: new Error(String(error));
|
|
130
|
-
return failure(mappedError);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
117
|
|
|
134
118
|
/** Combine multiple results into one */
|
|
135
119
|
export function combine<T, E>(results: Result<T, E>[]): Result<T[], E> {
|