@umituz/react-native-subscription 2.31.21 → 2.31.22
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.31.
|
|
3
|
+
"version": "2.31.22",
|
|
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",
|
|
@@ -34,7 +34,7 @@ class SubscriptionManagerImpl {
|
|
|
34
34
|
async initialize(userId?: string): Promise<boolean> {
|
|
35
35
|
this.ensureConfigured();
|
|
36
36
|
|
|
37
|
-
const actualUserId = userId ?? (await this.managerConfig.getAnonymousUserId());
|
|
37
|
+
const actualUserId = userId ?? (await this.managerConfig.getAnonymousUserId()) ?? '';
|
|
38
38
|
const { shouldInit, existingPromise } = this.state.initCache.tryAcquireInitialization(actualUserId);
|
|
39
39
|
|
|
40
40
|
if (!shouldInit && existingPromise) {
|
|
@@ -49,7 +49,7 @@ class SubscriptionManagerImpl {
|
|
|
49
49
|
private async performInitialization(userId: string): Promise<boolean> {
|
|
50
50
|
this.ensureConfigured();
|
|
51
51
|
const { service, success } = await performServiceInitialization(this.managerConfig.config, userId);
|
|
52
|
-
this.serviceInstance = service;
|
|
52
|
+
this.serviceInstance = service ?? null;
|
|
53
53
|
this.ensurePackageHandlerInitialized();
|
|
54
54
|
return success;
|
|
55
55
|
}
|
|
@@ -95,7 +95,7 @@ class SubscriptionManagerImpl {
|
|
|
95
95
|
|
|
96
96
|
getEntitlementId(): string {
|
|
97
97
|
this.ensureConfigured();
|
|
98
|
-
return this.managerConfig.config.entitlementIdentifier;
|
|
98
|
+
return this.managerConfig.config.entitlementIdentifier ?? '';
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -76,7 +76,9 @@ export async function handlePurchase(
|
|
|
76
76
|
const restoreResult = await handleRestore(deps, userId);
|
|
77
77
|
if (restoreResult.success && restoreResult.isPremium) {
|
|
78
78
|
// Restore succeeded, notify and return success
|
|
79
|
-
|
|
79
|
+
if (restoreResult.customerInfo) {
|
|
80
|
+
await notifyPurchaseCompleted(deps.config, userId, pkg.product.identifier, restoreResult.customerInfo, getSavedPurchase()?.source);
|
|
81
|
+
}
|
|
80
82
|
clearSavedPurchase();
|
|
81
83
|
return {
|
|
82
84
|
success: true,
|
|
@@ -13,16 +13,6 @@ export class TrialEligibilityService {
|
|
|
13
13
|
const { hasUsedTrial, trialInProgress, userIds = [] } = record;
|
|
14
14
|
|
|
15
15
|
if (userId && userIds.includes(userId)) {
|
|
16
|
-
// Detect corrupted state: user in list but flags say trial not used
|
|
17
|
-
if (!hasUsedTrial && !trialInProgress) {
|
|
18
|
-
console.warn('[TrialEligibilityService] Corrupted trial state detected', {
|
|
19
|
-
userId,
|
|
20
|
-
deviceId,
|
|
21
|
-
hasUsedTrial,
|
|
22
|
-
trialInProgress,
|
|
23
|
-
userIdsCount: userIds.length
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
16
|
return { eligible: false, reason: "user_already_used", deviceId };
|
|
27
17
|
}
|
|
28
18
|
|