@umituz/react-native-subscription 2.27.36 → 2.27.38
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/revenuecat/infrastructure/services/CustomerInfoListenerManager.ts +3 -2
- package/src/revenuecat/infrastructure/services/OfferingsFetcher.ts +1 -1
- package/src/revenuecat/infrastructure/services/PurchaseHandler.ts +1 -1
- package/src/revenuecat/infrastructure/services/RestoreHandler.ts +1 -1
- package/src/revenuecat/infrastructure/services/RevenueCatInitializer.ts +1 -10
- package/src/revenuecat/infrastructure/services/RevenueCatService.ts +6 -6
- package/src/revenuecat/infrastructure/utils/PurchasesSDK.ts +40 -0
- package/src/revenuecat/presentation/hooks/useCustomerInfo.ts +1 -1
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.38",
|
|
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,10 +3,11 @@
|
|
|
3
3
|
* Handles RevenueCat customer info update listeners with renewal detection
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import {
|
|
7
|
+
Purchases,
|
|
7
8
|
type CustomerInfo,
|
|
8
9
|
type CustomerInfoUpdateListener,
|
|
9
|
-
} from "
|
|
10
|
+
} from "../utils/PurchasesSDK";
|
|
10
11
|
import type { RevenueCatConfig } from "../../domain/value-objects/RevenueCatConfig";
|
|
11
12
|
import { syncPremiumStatus } from "../utils/PremiumStatusSyncer";
|
|
12
13
|
import {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Purchases,
|
|
1
|
+
import { Purchases, type PurchasesPackage } from "../utils/PurchasesSDK";
|
|
2
2
|
import type { PurchaseResult } from "../../application/ports/IRevenueCatService";
|
|
3
3
|
import { RevenueCatPurchaseError, RevenueCatInitializationError } from "../../domain/errors/RevenueCatError";
|
|
4
4
|
import type { RevenueCatConfig } from "../../domain/value-objects/RevenueCatConfig";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Purchases from "
|
|
1
|
+
import { Purchases } from "../utils/PurchasesSDK";
|
|
2
2
|
import type { RestoreResult } from "../../application/ports/IRevenueCatService";
|
|
3
3
|
import { RevenueCatRestoreError, RevenueCatInitializationError } from "../../domain/errors/RevenueCatError";
|
|
4
4
|
import type { RevenueCatConfig } from "../../domain/value-objects/RevenueCatConfig";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Purchases,
|
|
1
|
+
import { Purchases, LOG_LEVEL } from "../utils/PurchasesSDK";
|
|
2
2
|
import type { InitializeResult } from "../../application/ports/IRevenueCatService";
|
|
3
3
|
import type { RevenueCatConfig } from "../../domain/value-objects/RevenueCatConfig";
|
|
4
4
|
import { resolveApiKey } from "../utils/ApiKeyResolver";
|
|
@@ -37,20 +37,11 @@ function buildSuccessResult(deps: InitializerDeps, customerInfo: any, offerings:
|
|
|
37
37
|
return { success: true, offering: offerings.current, hasPremium };
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function isNativeModuleAvailable(): boolean {
|
|
41
|
-
return typeof Purchases?.configure === 'function';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
40
|
export async function initializeSDK(
|
|
45
41
|
deps: InitializerDeps,
|
|
46
42
|
userId: string,
|
|
47
43
|
apiKey?: string
|
|
48
44
|
): Promise<InitializeResult> {
|
|
49
|
-
if (!isNativeModuleAvailable()) {
|
|
50
|
-
if (__DEV__) console.log('[RevenueCat] Native module not available (Expo Go)');
|
|
51
|
-
return { success: false, offering: null, hasPremium: false };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
45
|
if (deps.isInitialized() && deps.getCurrentUserId() === userId) {
|
|
55
46
|
try {
|
|
56
47
|
const [customerInfo, offerings] = await Promise.all([
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* Main service class for RevenueCat operations
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
PurchasesOffering,
|
|
9
|
-
PurchasesPackage,
|
|
10
|
-
CustomerInfo,
|
|
11
|
-
} from "
|
|
6
|
+
import {
|
|
7
|
+
Purchases,
|
|
8
|
+
type PurchasesOffering,
|
|
9
|
+
type PurchasesPackage,
|
|
10
|
+
type CustomerInfo,
|
|
11
|
+
} from "../utils/PurchasesSDK";
|
|
12
12
|
import type {
|
|
13
13
|
IRevenueCatService,
|
|
14
14
|
InitializeResult,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Purchases SDK Wrapper
|
|
3
|
+
* Handles ESM/CJS interop for react-native-purchases
|
|
4
|
+
* All files should import from this module instead of directly from react-native-purchases
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import PurchasesModule from "react-native-purchases";
|
|
8
|
+
import type {
|
|
9
|
+
CustomerInfo,
|
|
10
|
+
CustomerInfoUpdateListener,
|
|
11
|
+
PurchasesOffering,
|
|
12
|
+
PurchasesPackage,
|
|
13
|
+
LogHandler,
|
|
14
|
+
} from "react-native-purchases";
|
|
15
|
+
|
|
16
|
+
// Handle ESM/CJS interop - Metro bundler sometimes wraps default export
|
|
17
|
+
type PurchasesType = typeof PurchasesModule;
|
|
18
|
+
interface PurchasesModuleWithDefault {
|
|
19
|
+
default?: PurchasesType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const resolvedPurchases: PurchasesType =
|
|
23
|
+
(PurchasesModule as unknown as PurchasesModuleWithDefault).default ?? PurchasesModule;
|
|
24
|
+
|
|
25
|
+
// Re-export types
|
|
26
|
+
export type {
|
|
27
|
+
CustomerInfo,
|
|
28
|
+
CustomerInfoUpdateListener,
|
|
29
|
+
PurchasesOffering,
|
|
30
|
+
PurchasesPackage,
|
|
31
|
+
LogHandler,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Re-export LOG_LEVEL enum
|
|
35
|
+
export const LOG_LEVEL = resolvedPurchases.LOG_LEVEL;
|
|
36
|
+
|
|
37
|
+
// Export resolved Purchases instance
|
|
38
|
+
export const Purchases = resolvedPurchases;
|
|
39
|
+
|
|
40
|
+
export default Purchases;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { useEffect, useState, useCallback } from "react";
|
|
18
|
-
import Purchases,
|
|
18
|
+
import { Purchases, type CustomerInfo } from "../../infrastructure/utils/PurchasesSDK";
|
|
19
19
|
|
|
20
20
|
export interface UseCustomerInfoResult {
|
|
21
21
|
/** Current CustomerInfo from RevenueCat SDK */
|