@umituz/react-native-subscription 2.29.5 → 2.29.6
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/credits/application/CreditsInitializer.ts +3 -4
- package/src/domains/credits/application/DeductCreditsCommand.ts +3 -3
- package/src/domains/credits/application/PurchaseMetadataGenerator.ts +1 -1
- package/src/domains/credits/application/creditDocumentHelpers.ts +1 -1
- package/src/domains/credits/application/creditOperationUtils.ts +1 -1
- package/src/domains/credits/infrastructure/CreditsRepository.ts +2 -2
- package/src/domains/trial/application/TrialService.ts +2 -1
- package/src/domains/trial/infrastructure/DeviceTrialRepository.ts +2 -2
- package/src/shared/application/FeedbackService.ts +1 -1
- package/src/shared/infrastructure/firestore/collectionUtils.ts +3 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.6",
|
|
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",
|
|
@@ -2,25 +2,24 @@ import type { CreditsConfig } from "../core/Credits";
|
|
|
2
2
|
import { getAppVersion, validatePlatform } from "../../../utils/appUtils";
|
|
3
3
|
|
|
4
4
|
import type { InitializeCreditsMetadata, InitializationResult } from "../../subscription/application/SubscriptionInitializerTypes";
|
|
5
|
-
import { runTransaction, type Transaction, type DocumentReference, type Firestore } from "firebase
|
|
5
|
+
import { runTransaction, type Transaction, type DocumentReference, type Firestore } from "@umituz/react-native-firebase";
|
|
6
6
|
import { getCreditDocumentOrDefault } from "./creditDocumentHelpers";
|
|
7
7
|
import { calculateNewCredits, buildCreditsData, shouldSkipStatusSyncWrite } from "./creditOperationUtils";
|
|
8
8
|
import { calculateCreditLimit } from "./CreditLimitCalculator";
|
|
9
9
|
import { generatePurchaseMetadata } from "./PurchaseMetadataGenerator";
|
|
10
10
|
|
|
11
11
|
export async function initializeCreditsTransaction(
|
|
12
|
-
|
|
12
|
+
_db: Firestore,
|
|
13
13
|
creditsRef: DocumentReference,
|
|
14
14
|
config: CreditsConfig,
|
|
15
15
|
purchaseId: string,
|
|
16
16
|
metadata: InitializeCreditsMetadata
|
|
17
17
|
): Promise<InitializationResult> {
|
|
18
|
-
if (!db) throw new Error("Firestore instance is not available");
|
|
19
18
|
|
|
20
19
|
const platform = validatePlatform();
|
|
21
20
|
const appVersion = getAppVersion();
|
|
22
21
|
|
|
23
|
-
return runTransaction(
|
|
22
|
+
return runTransaction(async (transaction: Transaction) => {
|
|
24
23
|
const creditsDoc = await transaction.get(creditsRef);
|
|
25
24
|
const existingData = getCreditDocumentOrDefault(creditsDoc, platform);
|
|
26
25
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { runTransaction, serverTimestamp, type Transaction, type DocumentReference, type Firestore } from "firebase
|
|
1
|
+
import { runTransaction, serverTimestamp, type Transaction, type DocumentReference, type Firestore } from "@umituz/react-native-firebase";
|
|
2
2
|
import type { DeductCreditsResult } from "../core/Credits";
|
|
3
3
|
import { CREDIT_ERROR_CODES } from "../core/CreditsConstants";
|
|
4
4
|
import { subscriptionEventBus, SUBSCRIPTION_EVENTS } from "../../../shared/infrastructure/SubscriptionEventBus";
|
|
@@ -8,13 +8,13 @@ import { subscriptionEventBus, SUBSCRIPTION_EVENTS } from "../../../shared/infra
|
|
|
8
8
|
* Encapsulates the domain rules and transaction logic for credit usage.
|
|
9
9
|
*/
|
|
10
10
|
export async function deductCreditsOperation(
|
|
11
|
-
|
|
11
|
+
_db: Firestore,
|
|
12
12
|
creditsRef: DocumentReference,
|
|
13
13
|
cost: number,
|
|
14
14
|
userId: string
|
|
15
15
|
): Promise<DeductCreditsResult> {
|
|
16
16
|
try {
|
|
17
|
-
const remaining = await runTransaction(
|
|
17
|
+
const remaining = await runTransaction(async (tx: Transaction) => {
|
|
18
18
|
const docSnap = await tx.get(creditsRef);
|
|
19
19
|
|
|
20
20
|
if (!docSnap.exists()) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { UserCreditsDocumentRead } from "../core/UserCreditsDocument";
|
|
7
|
-
import { serverTimestamp, type DocumentSnapshot } from "firebase
|
|
7
|
+
import { serverTimestamp, type DocumentSnapshot } from "@umituz/react-native-firebase";
|
|
8
8
|
import { SUBSCRIPTION_STATUS, type Platform } from "../../subscription/core/SubscriptionConstants";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { serverTimestamp } from "firebase
|
|
1
|
+
import { serverTimestamp } from "@umituz/react-native-firebase";
|
|
2
2
|
import { resolveSubscriptionStatus } from "../../subscription/core/SubscriptionStatus";
|
|
3
3
|
import { creditAllocationOrchestrator } from "./credit-strategies/CreditAllocationOrchestrator";
|
|
4
4
|
import { isPast } from "../../../utils/dateUtils";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getDoc, setDoc
|
|
2
|
-
import { BaseRepository } from "@umituz/react-native-firebase";
|
|
1
|
+
import { getDoc, setDoc } from "firebase/firestore";
|
|
2
|
+
import { BaseRepository, type Firestore, type DocumentReference } from "@umituz/react-native-firebase";
|
|
3
3
|
import type { CreditsConfig, CreditsResult, DeductCreditsResult } from "../core/Credits";
|
|
4
4
|
import type { UserCreditsDocumentRead, PurchaseSource } from "../core/UserCreditsDocument";
|
|
5
5
|
import { initializeCreditsTransaction } from "../application/CreditsInitializer";
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Trial Service - Facade for device-based trial tracking
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { arrayUnion
|
|
5
|
+
import { arrayUnion } from "firebase/firestore";
|
|
6
|
+
import { serverTimestamp } from "@umituz/react-native-firebase";
|
|
6
7
|
import { PersistentDeviceIdService } from "@umituz/react-native-design-system";
|
|
7
8
|
import { DeviceTrialRepository } from "../infrastructure/DeviceTrialRepository";
|
|
8
9
|
import { TrialEligibilityService } from "./TrialEligibilityService";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { doc, getDoc, setDoc
|
|
2
|
-
import { getFirestore } from "@umituz/react-native-firebase";
|
|
1
|
+
import { doc, getDoc, setDoc } from "firebase/firestore";
|
|
2
|
+
import { getFirestore, serverTimestamp, type Firestore } from "@umituz/react-native-firebase";
|
|
3
3
|
import type { DeviceTrialRecord } from "../core/TrialTypes";
|
|
4
4
|
|
|
5
5
|
const DEVICE_TRIALS_COLLECTION = "device_trials";
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Feedback is stored under users/{userId}/feedback/{feedbackId}
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getFirestore } from "@umituz/react-native-firebase";
|
|
8
7
|
import { collection, addDoc, doc } from "firebase/firestore";
|
|
8
|
+
import { getFirestore } from "@umituz/react-native-firebase";
|
|
9
9
|
|
|
10
10
|
export interface FeedbackData {
|
|
11
11
|
userId: string | null;
|
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
* Shared utilities for building Firestore collection and document references
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { collection, doc } from "firebase/firestore";
|
|
6
7
|
import {
|
|
7
|
-
|
|
8
|
-
doc,
|
|
8
|
+
getFirestore,
|
|
9
9
|
type CollectionReference,
|
|
10
10
|
type DocumentReference,
|
|
11
11
|
type Firestore,
|
|
12
|
-
} from "firebase
|
|
13
|
-
import { getFirestore } from "@umituz/react-native-firebase";
|
|
12
|
+
} from "@umituz/react-native-firebase";
|
|
14
13
|
|
|
15
14
|
export interface CollectionConfig {
|
|
16
15
|
collectionName: string;
|