@umituz/react-native-subscription 2.27.106 → 2.27.108

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.27.106",
3
+ "version": "2.27.108",
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",
@@ -39,7 +39,7 @@
39
39
  "expo-image": ">=3.0.0",
40
40
  "firebase": ">=10.0.0",
41
41
  "react": ">=19.0.0",
42
- "react-native": "0.81.5",
42
+ "react-native": "0.81.4",
43
43
  "react-native-purchases": ">=7.0.0",
44
44
  "react-native-safe-area-context": ">=5.0.0",
45
45
  "zustand": ">=5.0.0"
@@ -89,7 +89,7 @@
89
89
  "expo-web-browser": "~15.0.10",
90
90
  "firebase": "^11.0.0",
91
91
  "react": "19.1.0",
92
- "react-native": "0.81.5",
92
+ "react-native": "0.81.4",
93
93
  "react-native-gesture-handler": "^2.30.0",
94
94
  "react-native-purchases": "^7.0.0",
95
95
  "react-native-safe-area-context": "^5.0.0",
@@ -33,11 +33,16 @@ export async function initializeCreditsTransaction(
33
33
  const now = serverTimestamp();
34
34
  const existingData = creditsDoc.exists()
35
35
  ? creditsDoc.data() as UserCreditsDocumentRead
36
- : null;
37
-
38
- if (!existingData) {
39
- throw new Error("Credits document does not exist");
40
- }
36
+ : {
37
+ credits: 0,
38
+ creditLimit: 0,
39
+ isPremium: false,
40
+ status: "none",
41
+ processedPurchases: [],
42
+ purchaseHistory: [],
43
+ platform: Platform.OS as any,
44
+ lastUpdatedAt: now,
45
+ } as any;
41
46
 
42
47
  if (existingData.processedPurchases.includes(purchaseId)) {
43
48
  return {
@@ -13,7 +13,7 @@ import type { RevenueCatData } from "../../subscription/core/RevenueCatData";
13
13
  import { DeductCreditsCommand } from "../application/DeductCreditsCommand";
14
14
  import { CreditLimitCalculator } from "../application/CreditLimitCalculator";
15
15
  import { PURCHASE_TYPE, type PurchaseType } from "../../subscription/core/SubscriptionConstants";
16
- import { updateDoc } from "firebase/firestore";
16
+ import { setDoc } from "firebase/firestore";
17
17
 
18
18
  export class CreditsRepository extends BaseRepository {
19
19
  private deductCommand: DeductCreditsCommand;
@@ -102,12 +102,12 @@ export class CreditsRepository extends BaseRepository {
102
102
  if (!db) throw new Error("Firestore instance is not available");
103
103
 
104
104
  const ref = this.getRef(db, userId);
105
- await updateDoc(ref, {
105
+ await setDoc(ref, {
106
106
  isPremium: false,
107
107
  status: "expired",
108
108
  willRenew: false,
109
109
  expirationDate: new Date().toISOString()
110
- });
110
+ }, { merge: true });
111
111
  }
112
112
  }
113
113