react-native-purchases 9.0.0 → 9.2.0
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/RNPurchases.podspec +1 -1
- package/android/build.gradle +3 -3
- package/android/src/main/java/com/revenuecat/purchases/react/RNPurchasesModule.java +24 -1
- package/dist/{preview → browser}/nativeModule.d.ts +40 -38
- package/dist/{preview → browser}/nativeModule.js +230 -154
- package/dist/browser/typeGuards.d.ts +23 -0
- package/dist/browser/typeGuards.js +61 -0
- package/dist/browser/utils.d.ts +6 -0
- package/dist/browser/utils.js +18 -0
- package/dist/purchases.d.ts +28 -2
- package/dist/purchases.js +70 -75
- package/dist/utils/environment.d.ts +5 -1
- package/dist/utils/environment.js +6 -5
- package/ios/RNPurchases.m +19 -1
- package/package.json +7 -2
package/RNPurchases.podspec
CHANGED
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ buildscript {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
dependencies {
|
|
9
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
9
|
+
classpath 'com.android.tools.build:gradle:8.12.0'
|
|
10
10
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -29,7 +29,7 @@ android {
|
|
|
29
29
|
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
|
|
30
30
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
31
31
|
versionCode 1
|
|
32
|
-
versionName '9.
|
|
32
|
+
versionName '9.2.0'
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
buildTypes {
|
|
@@ -121,6 +121,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
|
121
121
|
dependencies {
|
|
122
122
|
//noinspection GradleDynamicVersion
|
|
123
123
|
api 'com.facebook.react:react-native:+'
|
|
124
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common:
|
|
124
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common:16.2.0'
|
|
125
125
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
126
126
|
}
|
|
@@ -47,7 +47,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
47
47
|
private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
|
|
48
48
|
private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
|
|
49
49
|
public static final String PLATFORM_NAME = "react-native";
|
|
50
|
-
public static final String PLUGIN_VERSION = "9.
|
|
50
|
+
public static final String PLUGIN_VERSION = "9.2.0";
|
|
51
51
|
|
|
52
52
|
private final ReactApplicationContext reactContext;
|
|
53
53
|
|
|
@@ -338,6 +338,29 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
|
|
|
338
338
|
promise.resolve(Purchases.isConfigured());
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
//================================================================================
|
|
342
|
+
// Virtual Currencies
|
|
343
|
+
//================================================================================
|
|
344
|
+
@ReactMethod
|
|
345
|
+
public void getVirtualCurrencies(final Promise promise) {
|
|
346
|
+
CommonKt.getVirtualCurrencies(getOnResult(promise));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
@ReactMethod
|
|
350
|
+
public void invalidateVirtualCurrenciesCache() {
|
|
351
|
+
CommonKt.invalidateVirtualCurrenciesCache();
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
@ReactMethod
|
|
355
|
+
public void getCachedVirtualCurrencies(final Promise promise) {
|
|
356
|
+
Map<String, ?> cachedVirtualCurrencies = CommonKt.getCachedVirtualCurrencies();
|
|
357
|
+
if (cachedVirtualCurrencies == null) {
|
|
358
|
+
promise.resolve(null);
|
|
359
|
+
} else {
|
|
360
|
+
promise.resolve(convertMapToWriteableMap(cachedVirtualCurrencies));
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
341
364
|
//================================================================================
|
|
342
365
|
// Subscriber Attributes
|
|
343
366
|
//================================================================================
|
|
@@ -1,53 +1,55 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'react-native-get-random-values';
|
|
2
|
+
import { MakePurchaseResult } from '@revenuecat/purchases-typescript-internal';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
* (like Expo Go).
|
|
4
|
+
* Browser implementation of the native module. This will be used in the browser and Expo Go.
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
7
|
-
setupPurchases: (apiKey: string,
|
|
6
|
+
export declare const browserNativeModuleRNPurchases: {
|
|
7
|
+
setupPurchases: (apiKey: string, appUserID: string | null, _purchasesAreCompletedBy: string | null, _userDefaultsSuiteName: string | null, _storeKitVersion: string | null, _useAmazon: boolean, _shouldShowInAppMessagesAutomatically: boolean, _entitlementVerificationMode: string | null, _pendingTransactionsForPrepaidPlansEnabled: boolean, _diagnosticsEnabled: boolean) => Promise<void>;
|
|
8
8
|
setAllowSharingStoreAccount: (_allowSharing: boolean) => Promise<void>;
|
|
9
9
|
setSimulatesAskToBuyInSandbox: (_simulatesAskToBuyInSandbox: boolean) => Promise<void>;
|
|
10
|
-
getOfferings: () => Promise<PurchasesOfferings>;
|
|
11
|
-
getCurrentOfferingForPlacement: (
|
|
12
|
-
syncAttributesAndOfferingsIfNeeded: () => Promise<PurchasesOfferings>;
|
|
13
|
-
getProductInfo: (_productIdentifiers: string[], _type: string) => Promise<
|
|
14
|
-
restorePurchases: () => Promise<CustomerInfo>;
|
|
10
|
+
getOfferings: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOfferings>;
|
|
11
|
+
getCurrentOfferingForPlacement: (placementIdentifier: string) => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOffering | null>;
|
|
12
|
+
syncAttributesAndOfferingsIfNeeded: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOfferings>;
|
|
13
|
+
getProductInfo: (_productIdentifiers: string[], _type: string) => Promise<void>;
|
|
14
|
+
restorePurchases: () => Promise<import("@revenuecat/purchases-typescript-internal").CustomerInfo>;
|
|
15
15
|
getAppUserID: () => Promise<string>;
|
|
16
|
-
getStorefront: () => Promise<
|
|
16
|
+
getStorefront: () => Promise<void>;
|
|
17
17
|
setDebugLogsEnabled: (_enabled: boolean) => Promise<void>;
|
|
18
|
-
setLogLevel: (
|
|
19
|
-
setLogHandler: () => Promise<
|
|
20
|
-
getCustomerInfo: () => Promise<CustomerInfo>;
|
|
21
|
-
logIn: (
|
|
22
|
-
customerInfo: CustomerInfo;
|
|
18
|
+
setLogLevel: (level: string) => Promise<void>;
|
|
19
|
+
setLogHandler: (_handler: (message: string) => void) => Promise<void>;
|
|
20
|
+
getCustomerInfo: () => Promise<import("@revenuecat/purchases-typescript-internal").CustomerInfo>;
|
|
21
|
+
logIn: (appUserID: string) => Promise<{
|
|
22
|
+
customerInfo: import("@revenuecat/purchases-typescript-internal").CustomerInfo;
|
|
23
23
|
created: boolean;
|
|
24
24
|
}>;
|
|
25
|
-
logOut: () => Promise<CustomerInfo>;
|
|
25
|
+
logOut: () => Promise<import("@revenuecat/purchases-typescript-internal").CustomerInfo>;
|
|
26
26
|
syncPurchases: () => Promise<void>;
|
|
27
27
|
syncAmazonPurchase: (_productID: string, _receiptID: string, _amazonUserID: string, _isoCurrencyCode: string | null, _price: number | null) => Promise<void>;
|
|
28
28
|
syncObserverModeAmazonPurchase: (_productID: string, _receiptID: string, _amazonUserID: string, _isoCurrencyCode: string | null, _price: number | null) => Promise<void>;
|
|
29
|
-
recordPurchaseForProductID: (_productID: string) => Promise<
|
|
29
|
+
recordPurchaseForProductID: (_productID: string) => Promise<void>;
|
|
30
30
|
enableAdServicesAttributionTokenCollection: () => Promise<void>;
|
|
31
|
-
purchaseProduct: (_productIdentifier: string, _googleProductChangeInfo: any, _type: string, _discountTimestamp: string | null, _googleInfo: any, _presentedOfferingContext: any) => Promise<
|
|
32
|
-
purchasePackage: (
|
|
33
|
-
purchaseSubscriptionOption: (_productIdentifier: string, _optionIdentifier: string, _upgradeInfo: any, _discountTimestamp: string | null, _googleInfo: any, _presentedOfferingContext: any) => Promise<
|
|
31
|
+
purchaseProduct: (_productIdentifier: string, _googleProductChangeInfo: any, _type: string, _discountTimestamp: string | null, _googleInfo: any, _presentedOfferingContext: any) => Promise<void>;
|
|
32
|
+
purchasePackage: (packageIdentifier: string, presentedOfferingContext: any, _googleProductChangeInfo: any, _discountTimestamp: string | null, _googleInfo: any) => Promise<MakePurchaseResult>;
|
|
33
|
+
purchaseSubscriptionOption: (_productIdentifier: string, _optionIdentifier: string, _upgradeInfo: any, _discountTimestamp: string | null, _googleInfo: any, _presentedOfferingContext: any) => Promise<void>;
|
|
34
34
|
isAnonymous: () => Promise<boolean>;
|
|
35
35
|
makeDeferredPurchase: (_callbackID: number) => Promise<void>;
|
|
36
36
|
checkTrialOrIntroductoryPriceEligibility: (productIDs: string[]) => Promise<{
|
|
37
37
|
[productId: string]: any;
|
|
38
38
|
}>;
|
|
39
|
-
getPromotionalOffer: (_productIdentifier: string, _discount: any) => Promise<
|
|
40
|
-
eligibleWinBackOffersForProductIdentifier: (_productID: string) => Promise<
|
|
41
|
-
purchaseProductWithWinBackOffer: (_productID: string, _winBackOfferID: string) => Promise<
|
|
42
|
-
purchasePackageWithWinBackOffer: (_packageID: string, _winBackOfferID: string) => Promise<
|
|
39
|
+
getPromotionalOffer: (_productIdentifier: string, _discount: any) => Promise<void>;
|
|
40
|
+
eligibleWinBackOffersForProductIdentifier: (_productID: string) => Promise<void>;
|
|
41
|
+
purchaseProductWithWinBackOffer: (_productID: string, _winBackOfferID: string) => Promise<void>;
|
|
42
|
+
purchasePackageWithWinBackOffer: (_packageID: string, _winBackOfferID: string) => Promise<void>;
|
|
43
43
|
invalidateCustomerInfoCache: () => Promise<void>;
|
|
44
44
|
presentCodeRedemptionSheet: () => Promise<void>;
|
|
45
|
-
setAttributes: (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
setAttributes: (attributes: {
|
|
46
|
+
[key: string]: string | null;
|
|
47
|
+
}) => Promise<void>;
|
|
48
|
+
setEmail: (email: string) => Promise<void>;
|
|
49
|
+
setPhoneNumber: (phoneNumber: string) => Promise<void>;
|
|
50
|
+
setDisplayName: (displayName: string) => Promise<void>;
|
|
49
51
|
setPushToken: (_pushToken: string) => Promise<void>;
|
|
50
|
-
setProxyURLString: (
|
|
52
|
+
setProxyURLString: (proxyURLString: string) => Promise<void>;
|
|
51
53
|
collectDeviceIdentifiers: () => Promise<void>;
|
|
52
54
|
setAdjustID: (_adjustID: string) => Promise<void>;
|
|
53
55
|
setAppsflyerID: (_appsflyerID: string) => Promise<void>;
|
|
@@ -68,15 +70,15 @@ export declare const previewNativeModuleRNPurchases: {
|
|
|
68
70
|
setKeyword: (_keyword: string) => Promise<void>;
|
|
69
71
|
setCreative: (_creative: string) => Promise<void>;
|
|
70
72
|
canMakePayments: (_features: any[]) => Promise<boolean>;
|
|
71
|
-
beginRefundRequestForActiveEntitlement: () => Promise<
|
|
72
|
-
beginRefundRequestForEntitlementId: (_entitlementIdentifier: string) => Promise<
|
|
73
|
-
beginRefundRequestForProductId: (_productIdentifier: string) => Promise<
|
|
73
|
+
beginRefundRequestForActiveEntitlement: () => Promise<void>;
|
|
74
|
+
beginRefundRequestForEntitlementId: (_entitlementIdentifier: string) => Promise<void>;
|
|
75
|
+
beginRefundRequestForProductId: (_productIdentifier: string) => Promise<void>;
|
|
74
76
|
showManageSubscriptions: () => Promise<void>;
|
|
75
77
|
showInAppMessages: (_messageTypes: any[]) => Promise<void>;
|
|
76
|
-
isWebPurchaseRedemptionURL: (_urlString: string) => Promise<
|
|
78
|
+
isWebPurchaseRedemptionURL: (_urlString: string) => Promise<void>;
|
|
77
79
|
isConfigured: () => Promise<boolean>;
|
|
78
|
-
redeemWebPurchase: (_urlString: string) => Promise<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
redeemWebPurchase: (_urlString: string) => Promise<void>;
|
|
81
|
+
getVirtualCurrencies: () => Promise<void>;
|
|
82
|
+
invalidateVirtualCurrenciesCache: () => Promise<void>;
|
|
83
|
+
getCachedVirtualCurrencies: () => Promise<void>;
|
|
82
84
|
};
|