@umituz/react-native-subscription 2.35.11 → 2.35.12

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.35.11",
3
+ "version": "2.35.12",
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",
@@ -52,37 +52,21 @@ export function usePaywallActions({
52
52
  });
53
53
 
54
54
  const handlePurchase = useCallback(async () => {
55
- console.log('🔵 [usePaywallActions] handlePurchase called', {
56
- selectedPlanId,
57
- packagesCount: packages.length,
58
- isProcessing,
59
- hasOnPurchase: !!onPurchaseRef.current
60
- });
61
-
62
- const planId = selectedPlanId || (packages.length > 0 ? packages[0]?.product.identifier : null);
63
-
64
- if (!planId || !onPurchaseRef.current || isProcessing) {
65
- console.log('⚠️ [usePaywallActions] Purchase blocked', {
66
- noPlanId: !planId,
67
- noCallback: !onPurchaseRef.current,
68
- isProcessing
69
- });
70
- if (!planId && onAuthRequiredRef.current) onAuthRequiredRef.current();
71
- return;
55
+ if (!selectedPlanId || !onPurchaseRef.current || isProcessing) {
56
+ if (!selectedPlanId && onAuthRequiredRef.current) {
57
+ onAuthRequiredRef.current();
58
+ }
59
+ return;
72
60
  }
73
61
 
74
- console.log('🟢 [usePaywallActions] Starting purchase', { planId });
75
62
  setIsLocalProcessing(true);
76
- startPurchase(planId, "manual");
63
+ startPurchase(selectedPlanId, "manual");
77
64
 
78
65
  try {
79
- const pkg = packages.find((p) => p.product.identifier === planId);
80
- console.log('📦 [usePaywallActions] Package found:', !!pkg);
66
+ const pkg = packages.find((p) => p.product.identifier === selectedPlanId);
81
67
 
82
68
  if (pkg) {
83
- console.log('🚀 [usePaywallActions] Calling onPurchase callback');
84
69
  const success = await onPurchaseRef.current(pkg);
85
- console.log('✅ [usePaywallActions] onPurchase completed', { success });
86
70
 
87
71
  if (success !== false) {
88
72
  onPurchaseSuccessRef.current?.();
@@ -90,13 +74,11 @@ export function usePaywallActions({
90
74
  }
91
75
  }
92
76
  } catch (error) {
93
- console.error('❌ [usePaywallActions] Purchase error:', error);
94
77
  const err = error instanceof Error ? error : new Error(String(error));
95
78
  onPurchaseErrorRef.current?.(err);
96
79
  } finally {
97
- console.log('🏁 [usePaywallActions] Purchase flow finished');
98
80
  setIsLocalProcessing(false);
99
- endPurchase(planId);
81
+ endPurchase(selectedPlanId);
100
82
  }
101
83
  }, [selectedPlanId, packages, isProcessing, startPurchase, endPurchase]);
102
84
 
@@ -3,8 +3,6 @@ import { getPremiumEntitlement } from "../../../revenuecat/core/types";
3
3
  import { toDate } from "../../../../shared/utils/dateConverter";
4
4
  import { detectPackageType } from "../../../../utils/packageTypeDetector";
5
5
 
6
- declare const __DEV__: boolean;
7
-
8
6
  export interface PremiumStatus {
9
7
  isPremium: boolean;
10
8
  expirationDate: Date | null;
@@ -29,11 +27,6 @@ export class PurchaseStatusResolver {
29
27
  const productIdentifier = entitlement.productIdentifier ?? null;
30
28
  const detectedPackageType = productIdentifier ? detectPackageType(productIdentifier) : null;
31
29
 
32
- if (typeof __DEV__ !== "undefined" && __DEV__) {
33
- console.log("[PurchaseStatusResolver] productIdentifier:", productIdentifier);
34
- console.log("[PurchaseStatusResolver] detectedPackageType:", detectedPackageType);
35
- }
36
-
37
30
  return {
38
31
  isPremium: true,
39
32
  expirationDate: toDate(entitlement.expirationDate),
@@ -4,8 +4,6 @@ import { DetailRow } from "../../components/details/DetailRow";
4
4
  import type { SubscriptionHeaderProps } from "./SubscriptionHeader.types";
5
5
  import { formatPackageTypeForDisplay } from "../../../../subscription/utils/packageTypeFormatter";
6
6
 
7
- declare const __DEV__: boolean;
8
-
9
7
  interface SubscriptionHeaderContentProps {
10
8
  isLifetime: boolean;
11
9
  showExpirationDate: boolean;
@@ -40,14 +38,8 @@ export const SubscriptionHeaderContent: React.FC<SubscriptionHeaderContentProps>
40
38
  latestPurchaseDate,
41
39
  billingIssuesDetected,
42
40
  isSandbox,
43
- }) => {
44
- if (typeof __DEV__ !== 'undefined' && __DEV__) {
45
- console.log('[SubscriptionHeaderContent] packageType:', packageType);
46
- console.log('[SubscriptionHeaderContent] periodType:', periodType);
47
- }
48
-
49
- return (
50
- <View style={styles.details}>
41
+ }) => (
42
+ <View style={styles.details}>
51
43
  {isLifetime ? (
52
44
  <DetailRow
53
45
  label={translations.statusLabel}
@@ -145,5 +137,4 @@ export const SubscriptionHeaderContent: React.FC<SubscriptionHeaderContentProps>
145
137
  </>
146
138
  )}
147
139
  </View>
148
- );
149
- };
140
+ );
@@ -1,70 +0,0 @@
1
- /**
2
- * Package Type Detector Tests
3
- * Test various product ID patterns
4
- */
5
-
6
- import { detectPackageType } from "./packageTypeDetector";
7
- import { PACKAGE_TYPE } from "../domains/subscription/core/SubscriptionConstants";
8
-
9
- // Test common product ID patterns
10
- const testCases = [
11
- // Standard patterns
12
- { id: "com.umituz.aibabyfacepredictor.weekly", expected: PACKAGE_TYPE.WEEKLY },
13
- { id: "com.umituz.aibabyfacepredictor.monthly", expected: PACKAGE_TYPE.MONTHLY },
14
- { id: "com.umituz.aibabyfacepredictor.yearly", expected: PACKAGE_TYPE.YEARLY },
15
-
16
- // Test store patterns
17
- { id: "com.umituz.aibabyfacepredictor.test.weekly", expected: PACKAGE_TYPE.WEEKLY },
18
- { id: "com.umituz.aibabyfacepredictor.test.monthly", expected: PACKAGE_TYPE.MONTHLY },
19
- { id: "com.umituz.aibabyfacepredictor.test.yearly", expected: PACKAGE_TYPE.YEARLY },
20
-
21
- // Alternative naming
22
- { id: "weekly_subscription", expected: PACKAGE_TYPE.WEEKLY },
23
- { id: "monthly_subscription", expected: PACKAGE_TYPE.MONTHLY },
24
- { id: "annual_subscription", expected: PACKAGE_TYPE.YEARLY },
25
-
26
- // Edge cases
27
- { id: "week_pass", expected: PACKAGE_TYPE.WEEKLY },
28
- { id: "month_pass", expected: PACKAGE_TYPE.MONTHLY },
29
- { id: "year_pass", expected: PACKAGE_TYPE.YEARLY },
30
-
31
- // Should NOT match
32
- { id: "credit_package", expected: PACKAGE_TYPE.UNKNOWN },
33
- { id: "random_product", expected: PACKAGE_TYPE.UNKNOWN },
34
- ];
35
-
36
- console.log("=== Package Type Detector Tests ===\n");
37
-
38
- let passed = 0;
39
- let failed = 0;
40
-
41
- testCases.forEach(({ id, expected }) => {
42
- const result = detectPackageType(id);
43
- const isPass = result === expected;
44
-
45
- if (isPass) {
46
- passed++;
47
- console.log(`✅ PASS: "${id}" → ${result}`);
48
- } else {
49
- failed++;
50
- console.log(`❌ FAIL: "${id}" → ${result} (expected: ${expected})`);
51
- }
52
- });
53
-
54
- console.log(`\n=== Results: ${passed} passed, ${failed} failed ===`);
55
-
56
- // Test actual RevenueCat product IDs (if available)
57
- console.log("\n=== Test Your Actual Product IDs ===");
58
- console.log("Add your actual product IDs below to test:\n");
59
-
60
- const yourProductIds = [
61
- // Add your actual product IDs here
62
- // "com.yourapp.yourproduct.weekly",
63
- ];
64
-
65
- if (yourProductIds.length > 0) {
66
- yourProductIds.forEach(id => {
67
- const result = detectPackageType(id);
68
- console.log(`Product: "${id}" → Detected as: ${result}`);
69
- });
70
- }