@umituz/react-native-subscription 2.14.61 → 2.14.62
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.14.
|
|
3
|
+
"version": "2.14.62",
|
|
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",
|
|
@@ -37,7 +37,8 @@ export class CreditsRepository extends BaseRepository {
|
|
|
37
37
|
|
|
38
38
|
private getCreditsDocRef(db: Firestore, userId: string) {
|
|
39
39
|
if (this.config.useUserSubcollection) {
|
|
40
|
-
|
|
40
|
+
// Path: users/{userId} - credits stored directly on user document
|
|
41
|
+
return doc(db, "users", userId);
|
|
41
42
|
}
|
|
42
43
|
return doc(db, this.config.collectionName, userId);
|
|
43
44
|
}
|
|
@@ -53,14 +53,17 @@ export async function initializeCreditsTransaction(
|
|
|
53
53
|
processedPurchases = [...processedPurchases, purchaseId].slice(-10);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
const creditsData = {
|
|
57
57
|
textCredits: newTextCredits,
|
|
58
58
|
imageCredits: newImageCredits,
|
|
59
59
|
purchasedAt,
|
|
60
60
|
lastUpdatedAt: now,
|
|
61
61
|
lastPurchaseAt: now,
|
|
62
62
|
processedPurchases,
|
|
63
|
-
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Use merge:true to avoid overwriting other user fields
|
|
66
|
+
transaction.set(creditsRef, creditsData, { merge: true });
|
|
64
67
|
|
|
65
68
|
return { textCredits: newTextCredits, imageCredits: newImageCredits };
|
|
66
69
|
});
|