@umituz/react-native-subscription 2.11.25 â 2.11.26
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.11.
|
|
3
|
+
"version": "2.11.26",
|
|
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,16 +31,44 @@ export class CustomerInfoListenerManager {
|
|
|
31
31
|
setupListener(config: RevenueCatConfig): void {
|
|
32
32
|
this.removeListener();
|
|
33
33
|
|
|
34
|
+
if (__DEV__) {
|
|
35
|
+
console.log("[CustomerInfoListener] Setting up listener", {
|
|
36
|
+
userId: this.currentUserId,
|
|
37
|
+
entitlementId: this.entitlementIdentifier,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
34
41
|
addPackageBreadcrumb("subscription", "Setting up customer info listener", {
|
|
35
42
|
userId: this.currentUserId,
|
|
36
43
|
});
|
|
37
44
|
|
|
38
45
|
this.listener = async (customerInfo: CustomerInfo) => {
|
|
39
|
-
if (
|
|
46
|
+
if (__DEV__) {
|
|
47
|
+
console.log("[CustomerInfoListener] đ Listener fired!", {
|
|
48
|
+
userId: this.currentUserId,
|
|
49
|
+
hasActiveEntitlements: Object.keys(customerInfo.entitlements.active).length > 0,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!this.currentUserId) {
|
|
54
|
+
if (__DEV__) {
|
|
55
|
+
console.warn("[CustomerInfoListener] â No userId, skipping");
|
|
56
|
+
}
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
40
59
|
|
|
41
60
|
const hasPremium =
|
|
42
61
|
!!customerInfo.entitlements.active[this.entitlementIdentifier];
|
|
43
62
|
|
|
63
|
+
if (__DEV__) {
|
|
64
|
+
console.log("[CustomerInfoListener] Customer info updated", {
|
|
65
|
+
userId: this.currentUserId,
|
|
66
|
+
hasPremium,
|
|
67
|
+
entitlementIdentifier: this.entitlementIdentifier,
|
|
68
|
+
activeEntitlements: Object.keys(customerInfo.entitlements.active),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
44
72
|
addPackageBreadcrumb("subscription", "Customer info updated", {
|
|
45
73
|
userId: this.currentUserId,
|
|
46
74
|
hasPremium,
|
|
@@ -56,6 +84,15 @@ export class CustomerInfoListenerManager {
|
|
|
56
84
|
const productId = premiumEntitlement.productIdentifier;
|
|
57
85
|
const renewalId = `renewal_${productId}_${premiumEntitlement.expirationDate}`;
|
|
58
86
|
|
|
87
|
+
if (__DEV__) {
|
|
88
|
+
console.log("[CustomerInfoListener] đ° Processing credit renewal", {
|
|
89
|
+
userId: this.currentUserId,
|
|
90
|
+
productId,
|
|
91
|
+
renewalId,
|
|
92
|
+
expirationDate: premiumEntitlement.expirationDate,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
59
96
|
addPackageBreadcrumb(
|
|
60
97
|
"subscription",
|
|
61
98
|
"Processing credit renewal",
|
|
@@ -73,6 +110,13 @@ export class CustomerInfoListenerManager {
|
|
|
73
110
|
renewalId
|
|
74
111
|
);
|
|
75
112
|
|
|
113
|
+
if (__DEV__) {
|
|
114
|
+
console.log("[CustomerInfoListener] â
Credit renewal completed", {
|
|
115
|
+
userId: this.currentUserId,
|
|
116
|
+
productId,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
76
120
|
addPackageBreadcrumb(
|
|
77
121
|
"subscription",
|
|
78
122
|
"Credit renewal completed",
|
|
@@ -82,6 +126,14 @@ export class CustomerInfoListenerManager {
|
|
|
82
126
|
}
|
|
83
127
|
);
|
|
84
128
|
} catch (error) {
|
|
129
|
+
if (__DEV__) {
|
|
130
|
+
console.error("[CustomerInfoListener] â Credit renewal failed", {
|
|
131
|
+
userId: this.currentUserId,
|
|
132
|
+
productId,
|
|
133
|
+
error: error instanceof Error ? error.message : String(error),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
85
137
|
addPackageBreadcrumb(
|
|
86
138
|
"subscription",
|
|
87
139
|
"Credit renewal failed",
|
|
@@ -92,6 +144,20 @@ export class CustomerInfoListenerManager {
|
|
|
92
144
|
}
|
|
93
145
|
);
|
|
94
146
|
}
|
|
147
|
+
} else {
|
|
148
|
+
if (__DEV__) {
|
|
149
|
+
console.warn("[CustomerInfoListener] â ī¸ Premium but no entitlement/expiration", {
|
|
150
|
+
hasPremiumEntitlement: !!premiumEntitlement,
|
|
151
|
+
hasExpirationDate: !!(premiumEntitlement?.expirationDate),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
if (__DEV__) {
|
|
157
|
+
console.log("[CustomerInfoListener] âšī¸ Skipping credit renewal", {
|
|
158
|
+
hasPremium,
|
|
159
|
+
hasCallback: !!config.onCreditRenewal,
|
|
160
|
+
});
|
|
95
161
|
}
|
|
96
162
|
}
|
|
97
163
|
|