@umituz/react-native-subscription 2.35.0 → 2.35.2

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.0",
3
+ "version": "2.35.2",
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",
@@ -1,5 +1,5 @@
1
1
  import { useQuery, useQueryClient } from "@umituz/react-native-design-system";
2
- import { useCallback, useMemo, useEffect, useRef } from "react";
2
+ import { useCallback, useMemo, useEffect } from "react";
3
3
  import { useAuthStore, selectUserId } from "@umituz/react-native-auth";
4
4
  import { subscriptionEventBus, SUBSCRIPTION_EVENTS } from "../../../shared/infrastructure/SubscriptionEventBus";
5
5
  import {
@@ -3,7 +3,6 @@ import type { InitializeResult } from "../../../../shared/application/ports/IRev
3
3
  export class ConfigurationStateManager {
4
4
  private _isPurchasesConfigured = false;
5
5
  private _configurationPromise: Promise<InitializeResult> | null = null;
6
- private _resolveConfiguration: ((value: InitializeResult) => void) | null = null;
7
6
 
8
7
  get isPurchasesConfigured(): boolean {
9
8
  return this._isPurchasesConfigured;
@@ -26,7 +25,6 @@ export class ConfigurationStateManager {
26
25
 
27
26
  this._configurationPromise = new Promise((resolve) => {
28
27
  capturedResolve = resolve;
29
- this._resolveConfiguration = resolve;
30
28
  });
31
29
 
32
30
  return (value: InitializeResult) => {
@@ -42,11 +40,9 @@ export class ConfigurationStateManager {
42
40
 
43
41
  if (success) {
44
42
  this._configurationPromise = null;
45
- this._resolveConfiguration = null;
46
43
  } else {
47
44
  setTimeout(() => {
48
45
  this._configurationPromise = null;
49
- this._resolveConfiguration = null;
50
46
  }, 1000);
51
47
  }
52
48
  }
@@ -54,7 +50,6 @@ export class ConfigurationStateManager {
54
50
  reset(): void {
55
51
  this._isPurchasesConfigured = false;
56
52
  this._configurationPromise = null;
57
- this._resolveConfiguration = null;
58
53
  }
59
54
  }
60
55
 
@@ -2,6 +2,7 @@ import Purchases, { type CustomerInfo } from "react-native-purchases";
2
2
  import type { InitializeResult } from "../../../../shared/application/ports/IRevenueCatService";
3
3
  import type { InitializerDeps } from "./RevenueCatInitializer.types";
4
4
  import { FAILED_INITIALIZATION_RESULT } from "./initializerConstants";
5
+ import { syncPremiumStatus } from "../../../subscription/infrastructure/utils/PremiumStatusSyncer";
5
6
 
6
7
  declare const __DEV__: boolean;
7
8
 
@@ -118,8 +119,9 @@ export async function handleInitialConfiguration(
118
119
  Purchases.getOfferings(),
119
120
  ]);
120
121
 
122
+ const currentUserId = await Purchases.getAppUserID();
123
+
121
124
  if (typeof __DEV__ !== 'undefined' && __DEV__) {
122
- const currentUserId = await Purchases.getAppUserID();
123
125
  console.log('[UserSwitchHandler] ✅ Initial configuration completed:', {
124
126
  revenueCatUserId: currentUserId,
125
127
  activeEntitlements: Object.keys(customerInfo.entitlements.active),
@@ -127,6 +129,8 @@ export async function handleInitialConfiguration(
127
129
  });
128
130
  }
129
131
 
132
+ await syncPremiumStatus(deps.config, currentUserId, customerInfo);
133
+
130
134
  return buildSuccessResult(deps, customerInfo, offerings);
131
135
  } catch (error) {
132
136
  console.error('[UserSwitchHandler] SDK configuration failed', {
@@ -21,7 +21,7 @@ export function createSubscriptionInitModule(config: SubscriptionInitModuleConfi
21
21
  return true;
22
22
  }
23
23
 
24
- const cleanup = await initializeSubscription({ apiKey, ...subscriptionConfig });
24
+ await initializeSubscription({ apiKey, ...subscriptionConfig });
25
25
  return true;
26
26
  } catch {
27
27
  return false;