@umituz/react-native-subscription 2.27.13 → 2.27.15
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.
|
|
3
|
+
"version": "2.27.15",
|
|
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",
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
* Creates ready-to-use service implementations for configureAppServices
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
getPremiumEntitlement,
|
|
10
|
-
} from "./SubscriptionInitializer";
|
|
6
|
+
import { getCreditsRepository } from "../repositories/CreditsRepositoryProvider";
|
|
7
|
+
import { getRevenueCatService } from "../../revenuecat/infrastructure/services/RevenueCatService";
|
|
8
|
+
import { getPremiumEntitlement } from "../../revenuecat/domain/types/RevenueCatTypes";
|
|
11
9
|
import { creditsQueryKeys } from "../../presentation/hooks/useCredits";
|
|
12
|
-
import { paywallControl } from "../../
|
|
10
|
+
import { paywallControl } from "../../presentation/hooks/usePaywallVisibility";
|
|
13
11
|
import {
|
|
14
12
|
getGlobalQueryClient,
|
|
15
13
|
hasGlobalQueryClient,
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import type { PurchasesPackage } from "react-native-purchases";
|
|
7
7
|
|
|
8
|
-
declare const __DEV__: boolean;
|
|
9
|
-
|
|
10
8
|
export type PackageCategory = "credits" | "subscription";
|
|
11
9
|
|
|
12
10
|
export interface PackageFilterConfig {
|
|
@@ -30,17 +28,7 @@ export function getPackageCategory(
|
|
|
30
28
|
config.creditIdentifierPattern?.test(identifier) ||
|
|
31
29
|
config.creditIdentifierPattern?.test(productIdentifier);
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
if (__DEV__) {
|
|
35
|
-
console.log("[PackageFilter] Credit package:", identifier);
|
|
36
|
-
}
|
|
37
|
-
return "credits";
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (__DEV__) {
|
|
41
|
-
console.log("[PackageFilter] Subscription package:", identifier);
|
|
42
|
-
}
|
|
43
|
-
return "subscription";
|
|
31
|
+
return isCreditPackage ? "credits" : "subscription";
|
|
44
32
|
}
|
|
45
33
|
|
|
46
34
|
export function filterPackagesByMode(
|
|
@@ -49,22 +37,10 @@ export function filterPackagesByMode(
|
|
|
49
37
|
config: PackageFilterConfig = DEFAULT_CONFIG
|
|
50
38
|
): PurchasesPackage[] {
|
|
51
39
|
if (mode === "hybrid") {
|
|
52
|
-
if (__DEV__) {
|
|
53
|
-
console.log("[PackageFilter] Hybrid mode - returning all packages:", packages.length);
|
|
54
|
-
}
|
|
55
40
|
return packages;
|
|
56
41
|
}
|
|
57
42
|
|
|
58
|
-
|
|
59
|
-
const category = getPackageCategory(pkg, config);
|
|
60
|
-
return category === mode;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
if (__DEV__) {
|
|
64
|
-
console.log(`[PackageFilter] Mode: ${mode}, Filtered: ${filtered.length}/${packages.length}`);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return filtered;
|
|
43
|
+
return packages.filter((pkg) => getPackageCategory(pkg, config) === mode);
|
|
68
44
|
}
|
|
69
45
|
|
|
70
46
|
export function separatePackages(
|
|
@@ -75,20 +51,12 @@ export function separatePackages(
|
|
|
75
51
|
const subscriptionPackages: PurchasesPackage[] = [];
|
|
76
52
|
|
|
77
53
|
for (const pkg of packages) {
|
|
78
|
-
|
|
79
|
-
if (category === "credits") {
|
|
54
|
+
if (getPackageCategory(pkg, config) === "credits") {
|
|
80
55
|
creditPackages.push(pkg);
|
|
81
56
|
} else {
|
|
82
57
|
subscriptionPackages.push(pkg);
|
|
83
58
|
}
|
|
84
59
|
}
|
|
85
60
|
|
|
86
|
-
if (__DEV__) {
|
|
87
|
-
console.log("[PackageFilter] Separated:", {
|
|
88
|
-
credits: creditPackages.length,
|
|
89
|
-
subscriptions: subscriptionPackages.length,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
61
|
return { creditPackages, subscriptionPackages };
|
|
94
62
|
}
|
|
@@ -5,6 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
export type SubscriptionPackageType = "weekly" | "monthly" | "yearly" | "unknown";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Check if identifier is a credit package (consumable purchase)
|
|
10
|
+
* Credit packages use a different system and don't need type detection
|
|
11
|
+
*/
|
|
12
|
+
function isCreditPackage(identifier: string): boolean {
|
|
13
|
+
return identifier.includes("credit");
|
|
14
|
+
}
|
|
15
|
+
|
|
8
16
|
/**
|
|
9
17
|
* Detect package type from product identifier
|
|
10
18
|
* Supports common RevenueCat naming patterns:
|
|
@@ -12,19 +20,19 @@ export type SubscriptionPackageType = "weekly" | "monthly" | "yearly" | "unknown
|
|
|
12
20
|
* - premium_monthly, monthly_premium, premium-monthly
|
|
13
21
|
* - premium_yearly, yearly_premium, premium-yearly, premium_annual, annual_premium
|
|
14
22
|
* - preview-product-id (Preview API mode in Expo Go)
|
|
23
|
+
*
|
|
24
|
+
* Note: Credit packages (consumable purchases) are skipped silently
|
|
15
25
|
*/
|
|
16
26
|
export function detectPackageType(productIdentifier: string): SubscriptionPackageType {
|
|
17
27
|
if (!productIdentifier) {
|
|
18
|
-
if (__DEV__) {
|
|
19
|
-
console.log("[PackageTypeDetector] No product identifier provided");
|
|
20
|
-
}
|
|
21
28
|
return "unknown";
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
const normalized = productIdentifier.toLowerCase();
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
// Skip credit packages silently - they use creditPackageConfig instead
|
|
34
|
+
if (isCreditPackage(normalized)) {
|
|
35
|
+
return "unknown";
|
|
28
36
|
}
|
|
29
37
|
|
|
30
38
|
// Preview API mode (Expo Go testing)
|