@umituz/react-native-subscription 2.14.77 → 2.14.79

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.77",
3
+ "version": "2.14.79",
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",
@@ -82,6 +82,16 @@ export const PaywallContainer: React.FC<PaywallContainerProps> = ({
82
82
  const wasAnonymous = wasAnonymousRef.current;
83
83
  wasAnonymousRef.current = isAnonymous;
84
84
 
85
+ if (__DEV__) {
86
+ console.log("[PaywallContainer] Auth state check:", {
87
+ wasAnonymous,
88
+ isAnonymous,
89
+ hasPendingPackage: !!pendingPackage,
90
+ userId,
91
+ pendingPkgId: pendingPackage?.identifier,
92
+ });
93
+ }
94
+
85
95
  // If user was anonymous, now authenticated, and has pending package
86
96
  if (wasAnonymous && !isAnonymous && pendingPackage && userId) {
87
97
  if (__DEV__) {
@@ -83,6 +83,18 @@ export async function handlePurchase(
83
83
  return { success: true, isPremium: true, customerInfo };
84
84
  }
85
85
 
86
+ // In Preview API mode (Expo Go), purchases complete but entitlements aren't active
87
+ // Treat the purchase as successful for testing purposes
88
+ if (deps.isUsingTestStore()) {
89
+ await notifyPurchaseCompleted(
90
+ deps.config,
91
+ userId,
92
+ pkg.product.identifier,
93
+ customerInfo
94
+ );
95
+ return { success: true, isPremium: false, customerInfo };
96
+ }
97
+
86
98
  throw new RevenueCatPurchaseError(
87
99
  "Purchase completed but premium entitlement not active",
88
100
  pkg.product.identifier
@@ -104,6 +104,7 @@ export async function initializeSDK(
104
104
  await Purchases.configure({
105
105
  apiKey: key,
106
106
  appUserID: userId,
107
+ usesStoreKit2IfAvailable: true,
107
108
  });
108
109
  isPurchasesConfigured = true;
109
110
  deps.setInitialized(true);
@@ -11,6 +11,7 @@ export type SubscriptionPackageType = "weekly" | "monthly" | "yearly" | "unknown
11
11
  * - premium_weekly, weekly_premium, premium-weekly
12
12
  * - premium_monthly, monthly_premium, premium-monthly
13
13
  * - premium_yearly, yearly_premium, premium-yearly, premium_annual, annual_premium
14
+ * - preview-product-id (Preview API mode in Expo Go)
14
15
  */
15
16
  export function detectPackageType(productIdentifier: string): SubscriptionPackageType {
16
17
  if (!productIdentifier) {
@@ -26,6 +27,14 @@ export function detectPackageType(productIdentifier: string): SubscriptionPackag
26
27
  console.log("[PackageTypeDetector] Detecting package type for:", normalized);
27
28
  }
28
29
 
30
+ // Preview API mode (Expo Go testing)
31
+ if (normalized.includes("preview")) {
32
+ if (__DEV__) {
33
+ console.log("[PackageTypeDetector] Detected: PREVIEW (monthly)");
34
+ }
35
+ return "monthly";
36
+ }
37
+
29
38
  // Weekly detection
30
39
  if (normalized.includes("weekly") || normalized.includes("week")) {
31
40
  if (__DEV__) {