react-native-purchases-ui 7.15.0-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +20 -0
- package/README.md +20 -0
- package/RNPaywalls.podspec +22 -0
- package/android/build.gradle +98 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/com/revenuecat/purchases/react/ui/Paywall.kt +33 -0
- package/android/src/main/java/com/revenuecat/purchases/react/ui/RNPaywallManager.kt +18 -0
- package/android/src/main/java/com/revenuecat/purchases/react/ui/RNPaywallsModule.kt +44 -0
- package/android/src/main/java/com/revenuecat/purchases/react/ui/RNPaywallsPackage.kt +17 -0
- package/ios/PurchasesPlugin.swift +9 -0
- package/ios/RNPaywallManager.h +17 -0
- package/ios/RNPaywallManager.m +27 -0
- package/ios/RNPaywalls-Bridging-Header.h +4 -0
- package/ios/RNPaywalls.h +13 -0
- package/ios/RNPaywalls.m +81 -0
- package/lib/commonjs/index.js +18 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +114 -0
- package/src/index.tsx +13 -0
package/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 RevenueCat
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
12
|
+
copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
<h3 align="center">😻 In-App Subscriptions Made Easy 😻</h3>
|
2
|
+
|
3
|
+
[![License](https://img.shields.io/cocoapods/l/RevenueCat.svg?style=flat)](http://cocoapods.org/pods/RevenueCat)
|
4
|
+
|
5
|
+
RevenueCat is a powerful, reliable, and free to use in-app purchase server with cross-platform support. Our open-source framework provides a backend and a wrapper around StoreKit and Google Play Billing to make implementing in-app purchases and subscriptions easy.
|
6
|
+
|
7
|
+
Whether you are building a new app or already have millions of customers, you can use RevenueCat to:
|
8
|
+
|
9
|
+
* Fetch products, make purchases, and check subscription status with our [native SDKs](https://docs.revenuecat.com/docs/installation).
|
10
|
+
* Host and [configure products](https://docs.revenuecat.com/docs/entitlements) remotely from our dashboard.
|
11
|
+
* Analyze the most important metrics for your app business [in one place](https://docs.revenuecat.com/docs/charts).
|
12
|
+
* See customer transaction histories, chart lifetime value, and [grant promotional subscriptions](https://docs.revenuecat.com/docs/customers).
|
13
|
+
* Get notified of real-time events through [webhooks](https://docs.revenuecat.com/docs/webhooks).
|
14
|
+
* Send enriched purchase events to analytics and attribution tools with our easy integrations.
|
15
|
+
|
16
|
+
Sign up to [get started for free](https://app.revenuecat.com/signup).
|
17
|
+
|
18
|
+
## React Native Purchases UI
|
19
|
+
|
20
|
+
React Native Purchases UI is the client for the [RevenueCat](https://www.revenuecat.com/) subscription and purchase tracking system. It is an open source framework that provides a wrapper around `StoreKit`, `Google Play Billing` and the RevenueCat backend to make implementing in-app purchases in `React Native` easy.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
4
|
+
|
5
|
+
Pod::Spec.new do |spec|
|
6
|
+
spec.name = "RNPaywalls"
|
7
|
+
spec.summary = "Cross-platform subscriptions framework for ReactNative"
|
8
|
+
spec.version = package['version']
|
9
|
+
|
10
|
+
spec.authors = package['author']
|
11
|
+
spec.homepage = "https://github.com/RevenueCat/react-native-purchases"
|
12
|
+
spec.license = package['license']
|
13
|
+
spec.platform = :ios, "11.0"
|
14
|
+
|
15
|
+
spec.source = { :git => "https://github.com/RevenueCat/react-native-purchases.git" }
|
16
|
+
spec.source_files = "ios/**/*.{h,m,swift}"
|
17
|
+
spec.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
18
|
+
|
19
|
+
spec.dependency "React-Core"
|
20
|
+
spec.dependency "PurchasesHybridCommon", '8.10.0-beta.8'
|
21
|
+
spec.swift_version = '5.7'
|
22
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
buildscript {
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["PurchasesUi_kotlinVersion"]
|
4
|
+
|
5
|
+
repositories {
|
6
|
+
google()
|
7
|
+
mavenCentral()
|
8
|
+
}
|
9
|
+
|
10
|
+
dependencies {
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
def isNewArchitectureEnabled() {
|
18
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
19
|
+
}
|
20
|
+
|
21
|
+
apply plugin: "com.android.library"
|
22
|
+
apply plugin: "kotlin-android"
|
23
|
+
|
24
|
+
if (isNewArchitectureEnabled()) {
|
25
|
+
apply plugin: "com.facebook.react"
|
26
|
+
}
|
27
|
+
|
28
|
+
def getExtOrDefault(name) {
|
29
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["PurchasesUi_" + name]
|
30
|
+
}
|
31
|
+
|
32
|
+
def getExtOrIntegerDefault(name) {
|
33
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["PurchasesUi_" + name]).toInteger()
|
34
|
+
}
|
35
|
+
|
36
|
+
def supportsNamespace() {
|
37
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
38
|
+
def major = parsed[0].toInteger()
|
39
|
+
def minor = parsed[1].toInteger()
|
40
|
+
|
41
|
+
// Namespace support was added in 7.3.0
|
42
|
+
return (major == 7 && minor >= 3) || major >= 8
|
43
|
+
}
|
44
|
+
|
45
|
+
android {
|
46
|
+
if (supportsNamespace()) {
|
47
|
+
namespace "com.revenuecat.purchases.react.ui"
|
48
|
+
|
49
|
+
sourceSets {
|
50
|
+
main {
|
51
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
57
|
+
|
58
|
+
defaultConfig {
|
59
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
60
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
61
|
+
versionCode 1
|
62
|
+
versionName '7.15.0-rc.1'
|
63
|
+
}
|
64
|
+
|
65
|
+
buildTypes {
|
66
|
+
release {
|
67
|
+
minifyEnabled false
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
lintOptions {
|
72
|
+
disable "GradleCompatible"
|
73
|
+
}
|
74
|
+
|
75
|
+
compileOptions {
|
76
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
77
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
repositories {
|
82
|
+
mavenCentral()
|
83
|
+
google()
|
84
|
+
}
|
85
|
+
|
86
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
87
|
+
|
88
|
+
dependencies {
|
89
|
+
// For < 0.71, this will be from the local maven repo
|
90
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
91
|
+
//noinspection GradleDynamicVersion
|
92
|
+
implementation "com.facebook.react:react-native:+"
|
93
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
94
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:8.10.0-beta.8'
|
95
|
+
implementation 'androidx.compose.ui:ui-android:1.5.4'
|
96
|
+
implementation "androidx.appcompat:appcompat:1.6.1"
|
97
|
+
}
|
98
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
package com.revenuecat.purchases.react.ui
|
2
|
+
|
3
|
+
import android.app.PendingIntent.getActivity
|
4
|
+
import android.content.Context
|
5
|
+
import android.util.AttributeSet
|
6
|
+
import android.widget.ImageView
|
7
|
+
import androidx.compose.runtime.Composable
|
8
|
+
import androidx.compose.runtime.getValue
|
9
|
+
import androidx.compose.runtime.mutableStateOf
|
10
|
+
import androidx.compose.runtime.setValue
|
11
|
+
import androidx.compose.ui.platform.AbstractComposeView
|
12
|
+
import com.facebook.react.ReactActivity
|
13
|
+
import com.facebook.react.ReactActivityDelegate
|
14
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
15
|
+
import com.revenuecat.purchases.ui.revenuecatui.ExperimentalPreviewRevenueCatUIPurchasesAPI
|
16
|
+
import com.revenuecat.purchases.ui.revenuecatui.Paywall
|
17
|
+
import com.revenuecat.purchases.ui.revenuecatui.PaywallOptions
|
18
|
+
|
19
|
+
internal class Paywall @JvmOverloads constructor(
|
20
|
+
context: Context,
|
21
|
+
attrs: AttributeSet? = null,
|
22
|
+
) : AbstractComposeView(context, attrs) {
|
23
|
+
@OptIn(ExperimentalPreviewRevenueCatUIPurchasesAPI::class)
|
24
|
+
@Composable
|
25
|
+
override fun Content() {
|
26
|
+
Paywall(
|
27
|
+
PaywallOptions.Builder(
|
28
|
+
dismissRequest = {}
|
29
|
+
)
|
30
|
+
.build()
|
31
|
+
)
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
package com.revenuecat.purchases.react.ui
|
2
|
+
|
3
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
4
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
5
|
+
|
6
|
+
internal class RNPaywallManager : SimpleViewManager<Paywall>() {
|
7
|
+
companion object {
|
8
|
+
const val REACT_CLASS = "RNPaywall"
|
9
|
+
}
|
10
|
+
|
11
|
+
override fun getName(): String {
|
12
|
+
return REACT_CLASS
|
13
|
+
}
|
14
|
+
|
15
|
+
override fun createViewInstance(themedReactContext: ThemedReactContext): Paywall {
|
16
|
+
return Paywall(themedReactContext)
|
17
|
+
}
|
18
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
package com.revenuecat.purchases.react.ui
|
2
|
+
|
3
|
+
import androidx.fragment.app.FragmentActivity
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
7
|
+
import com.revenuecat.purchases.hybridcommon.ui.presentPaywallFromFragment
|
8
|
+
|
9
|
+
internal class RNPaywallsModule(reactContext: ReactApplicationContext) :
|
10
|
+
ReactContextBaseJavaModule(reactContext) {
|
11
|
+
companion object {
|
12
|
+
const val NAME = "RNPaywalls"
|
13
|
+
}
|
14
|
+
|
15
|
+
private val currentActivityFragment: FragmentActivity?
|
16
|
+
get() {
|
17
|
+
return when (val currentActivity = currentActivity) {
|
18
|
+
is FragmentActivity -> currentActivity
|
19
|
+
else -> null
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
override fun getName(): String {
|
24
|
+
return NAME
|
25
|
+
}
|
26
|
+
|
27
|
+
@ReactMethod
|
28
|
+
fun presentPaywall() {
|
29
|
+
presentPaywall(null)
|
30
|
+
}
|
31
|
+
|
32
|
+
@ReactMethod
|
33
|
+
fun presentPaywallIfNeeded(requiredEntitlementIdentifier: String?) {
|
34
|
+
presentPaywall(requiredEntitlementIdentifier)
|
35
|
+
}
|
36
|
+
|
37
|
+
private fun presentPaywall(requiredEntitlementIdentifier: String?) {
|
38
|
+
val fragment = currentActivityFragment
|
39
|
+
?: // TODO: log
|
40
|
+
return
|
41
|
+
|
42
|
+
presentPaywallFromFragment(fragment, requiredEntitlementIdentifier)
|
43
|
+
}
|
44
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
package com.revenuecat.purchases.react.ui
|
2
|
+
|
3
|
+
import com.facebook.react.ReactPackage
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
7
|
+
|
8
|
+
|
9
|
+
class RNPaywallsPackage : ReactPackage {
|
10
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
11
|
+
return listOf(RNPaywallsModule(reactContext))
|
12
|
+
}
|
13
|
+
|
14
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
15
|
+
return listOf(RNPaywallManager())
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
//
|
2
|
+
// RNPaywallManager.h
|
3
|
+
// RNPurchases
|
4
|
+
//
|
5
|
+
// Created by Nacho Soto on 11/1/23.
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import <React/RCTViewManager.h>
|
10
|
+
|
11
|
+
NS_ASSUME_NONNULL_BEGIN
|
12
|
+
|
13
|
+
@interface RNPaywallManager : RCTViewManager
|
14
|
+
|
15
|
+
@end
|
16
|
+
|
17
|
+
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//
|
2
|
+
// RNPaywallManager.m
|
3
|
+
// RNPurchases
|
4
|
+
//
|
5
|
+
// Created by Nacho Soto on 11/1/23.
|
6
|
+
// Copyright © 2023 Facebook. All rights reserved.
|
7
|
+
//
|
8
|
+
|
9
|
+
#import "RNPaywallManager.h"
|
10
|
+
@import PurchasesHybridCommon;
|
11
|
+
|
12
|
+
@implementation RNPaywallManager
|
13
|
+
|
14
|
+
RCT_EXPORT_MODULE(RNPaywall)
|
15
|
+
|
16
|
+
- (UIView *)view
|
17
|
+
{
|
18
|
+
if (@available(iOS 15.0, *)) {
|
19
|
+
PaywallProxy *proxy = [[PaywallProxy alloc] init];
|
20
|
+
return [proxy createPaywallView].view;
|
21
|
+
} else {
|
22
|
+
NSLog(@"Error: attempted to present paywalls on unsupported iOS version.");
|
23
|
+
return nil;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
@end
|
package/ios/RNPaywalls.h
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
//
|
2
|
+
// Created by RNPaywalls.
|
3
|
+
// Copyright © 2023 RevenueCat. All rights reserved.
|
4
|
+
//
|
5
|
+
|
6
|
+
#import <React/RCTEventEmitter.h>
|
7
|
+
|
8
|
+
@import PurchasesHybridCommon;
|
9
|
+
@import RevenueCat;
|
10
|
+
|
11
|
+
@interface RNPaywalls : RCTEventEmitter <RCTBridgeModule>
|
12
|
+
|
13
|
+
@end
|
package/ios/RNPaywalls.m
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
|
2
|
+
//
|
3
|
+
// Created by RevenueCat.
|
4
|
+
// Copyright © 2023 RevenueCat. All rights reserved.
|
5
|
+
//
|
6
|
+
|
7
|
+
#import "RNPaywalls.h"
|
8
|
+
|
9
|
+
@interface RNPaywalls ()
|
10
|
+
|
11
|
+
@property (nonatomic, strong) id paywallProxy;
|
12
|
+
|
13
|
+
@end
|
14
|
+
|
15
|
+
@implementation RNPaywalls
|
16
|
+
|
17
|
+
RCT_EXPORT_MODULE();
|
18
|
+
|
19
|
+
- (instancetype)initWithDisabledObservation
|
20
|
+
{
|
21
|
+
if ((self = [super initWithDisabledObservation])) {
|
22
|
+
[self initializePaywalls];
|
23
|
+
}
|
24
|
+
|
25
|
+
return self;
|
26
|
+
}
|
27
|
+
|
28
|
+
- (instancetype)init
|
29
|
+
{
|
30
|
+
if (([super init])) {
|
31
|
+
[self initializePaywalls];
|
32
|
+
}
|
33
|
+
return self;
|
34
|
+
}
|
35
|
+
|
36
|
+
// `RCTEventEmitter` does not implement designated iniitializers correctly so we have to duplicate the call in both constructors.
|
37
|
+
- (void)initializePaywalls {
|
38
|
+
if (@available(iOS 15.0, *)) {
|
39
|
+
self.paywallProxy = [PaywallProxy new];
|
40
|
+
} else {
|
41
|
+
self.paywallProxy = nil;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
// MARK: -
|
46
|
+
|
47
|
+
- (NSArray<NSString *> *)supportedEvents {
|
48
|
+
return @[];
|
49
|
+
}
|
50
|
+
|
51
|
+
- (dispatch_queue_t)methodQueue {
|
52
|
+
return dispatch_get_main_queue();
|
53
|
+
}
|
54
|
+
|
55
|
+
- (PaywallProxy *)paywalls API_AVAILABLE(ios(15.0)){
|
56
|
+
return self.paywallProxy;
|
57
|
+
}
|
58
|
+
|
59
|
+
// MARK: -
|
60
|
+
|
61
|
+
RCT_EXPORT_METHOD(presentPaywall) {
|
62
|
+
if (@available(iOS 15.0, *)) {
|
63
|
+
[self.paywalls presentPaywall];
|
64
|
+
} else {
|
65
|
+
[self logPaywallsUnsupportedError];
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
RCT_EXPORT_METHOD(presentPaywallIfNeeded:(NSString *)requiredEntitlementIdentifier) {
|
70
|
+
if (@available(iOS 15.0, *)) {
|
71
|
+
[self.paywalls presentPaywallIfNeededWithRequiredEntitlementIdentifier:requiredEntitlementIdentifier];
|
72
|
+
} else {
|
73
|
+
[self logPaywallsUnsupportedError];
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
- (void)logPaywallsUnsupportedError {
|
78
|
+
NSLog(@"Error: attempted to present paywalls on unsupported iOS version.");
|
79
|
+
}
|
80
|
+
|
81
|
+
@end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.presentPaywall = presentPaywall;
|
7
|
+
exports.presentPaywallIfNeeded = presentPaywallIfNeeded;
|
8
|
+
var _reactNative = require("react-native");
|
9
|
+
const RNPaywalls = _reactNative.NativeModules.RNPaywalls;
|
10
|
+
function presentPaywall() {
|
11
|
+
// TODO: check iOS/Android version
|
12
|
+
RNPaywalls.presentPaywall();
|
13
|
+
}
|
14
|
+
function presentPaywallIfNeeded(requiredEntitlementIdentifier) {
|
15
|
+
// TODO: check iOS/Android version
|
16
|
+
RNPaywalls.presentPaywallIfNeeded(requiredEntitlementIdentifier);
|
17
|
+
}
|
18
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNative","require","RNPaywalls","NativeModules","presentPaywall","presentPaywallIfNeeded","requiredEntitlementIdentifier"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,UAAU,GAAGC,0BAAa,CAACD,UAAU;AAEpC,SAASE,cAAcA,CAAA,EAAG;EAC/B;EACAF,UAAU,CAACE,cAAc,CAAC,CAAC;AAC7B;AAEO,SAASC,sBAAsBA,CAACC,6BAAqC,EAAE;EAC5E;EACAJ,UAAU,CAACG,sBAAsB,CAACC,6BAA6B,CAAC;AAClE"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { NativeModules } from "react-native";
|
2
|
+
const RNPaywalls = NativeModules.RNPaywalls;
|
3
|
+
export function presentPaywall() {
|
4
|
+
// TODO: check iOS/Android version
|
5
|
+
RNPaywalls.presentPaywall();
|
6
|
+
}
|
7
|
+
export function presentPaywallIfNeeded(requiredEntitlementIdentifier) {
|
8
|
+
// TODO: check iOS/Android version
|
9
|
+
RNPaywalls.presentPaywallIfNeeded(requiredEntitlementIdentifier);
|
10
|
+
}
|
11
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["NativeModules","RNPaywalls","presentPaywall","presentPaywallIfNeeded","requiredEntitlementIdentifier"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAE5C,MAAMC,UAAU,GAAGD,aAAa,CAACC,UAAU;AAE3C,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B;EACAD,UAAU,CAACC,cAAc,CAAC,CAAC;AAC7B;AAEA,OAAO,SAASC,sBAAsBA,CAACC,6BAAqC,EAAE;EAC5E;EACAH,UAAU,CAACE,sBAAsB,CAACC,6BAA6B,CAAC;AAClE"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,SAG7B;AAED,wBAAgB,sBAAsB,CAAC,6BAA6B,EAAE,MAAM,QAG3E"}
|
package/package.json
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
{
|
2
|
+
"name": "react-native-purchases-ui",
|
3
|
+
"title": "React Native Purchases UI",
|
4
|
+
"version": "7.15.0-rc.1",
|
5
|
+
"description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android.",
|
6
|
+
"main": "lib/commonjs/index",
|
7
|
+
"module": "lib/module/index",
|
8
|
+
"types": "lib/typescript/src/index.d.ts",
|
9
|
+
"react-native": "src/index",
|
10
|
+
"source": "src/index",
|
11
|
+
"files": [
|
12
|
+
"src",
|
13
|
+
"lib",
|
14
|
+
"android",
|
15
|
+
"!android/build",
|
16
|
+
"!android/gradle",
|
17
|
+
"!android/gradlew",
|
18
|
+
"!android/gradlew.bat",
|
19
|
+
"!android/local.properties",
|
20
|
+
"ios",
|
21
|
+
"cpp",
|
22
|
+
"*.podspec",
|
23
|
+
"!ios/build",
|
24
|
+
"!**/__tests__",
|
25
|
+
"!**/__fixtures__",
|
26
|
+
"!**/__mocks__",
|
27
|
+
"!**/.*"
|
28
|
+
],
|
29
|
+
"scripts": {
|
30
|
+
"test": "jest",
|
31
|
+
"typecheck": "tsc --noEmit",
|
32
|
+
"tslint": "tslint -c tslint.json 'src/*.ts'",
|
33
|
+
"prepare": "bob build"
|
34
|
+
},
|
35
|
+
"repository": {
|
36
|
+
"type": "git",
|
37
|
+
"url": "git+https://github.com/revenuecat/react-native-purchases.git",
|
38
|
+
"baseUrl": "https://github.com/revenuecat/react-native-purchases"
|
39
|
+
},
|
40
|
+
"keywords": [
|
41
|
+
"react-native",
|
42
|
+
"in-app purchase",
|
43
|
+
"subscriptions",
|
44
|
+
"iap",
|
45
|
+
"iOS",
|
46
|
+
"Apple",
|
47
|
+
"Android"
|
48
|
+
],
|
49
|
+
"author": "RevenueCat, Inc.",
|
50
|
+
"license": "MIT",
|
51
|
+
"readmeFilename": "README.md",
|
52
|
+
"devDependencies": {
|
53
|
+
"@types/jest": "^28.1.2",
|
54
|
+
"@types/react": "~17.0.21",
|
55
|
+
"@types/react-native": "0.70.0",
|
56
|
+
"jest": "^28.1.1",
|
57
|
+
"jest-react-native": "^18.0.0",
|
58
|
+
"pod-install": "^0.1.0",
|
59
|
+
"prettier": "^2.0.5",
|
60
|
+
"react": "18.2.0",
|
61
|
+
"react-native": "0.73.1",
|
62
|
+
"react-native-builder-bob": "^0.20.0",
|
63
|
+
"ts-jest": "^24.1.0",
|
64
|
+
"tslint": "^5.20.0",
|
65
|
+
"tslint-config-prettier": "^1.18.0",
|
66
|
+
"typedoc": "^0.23.21",
|
67
|
+
"typescript": "^5.0.2"
|
68
|
+
},
|
69
|
+
"resolutions": {
|
70
|
+
"@types/react": "17.0.21"
|
71
|
+
},
|
72
|
+
"peerDependencies": {
|
73
|
+
"react": "*",
|
74
|
+
"react-native": "*"
|
75
|
+
},
|
76
|
+
"jest": {
|
77
|
+
"preset": "react-native",
|
78
|
+
"modulePathIgnorePatterns": [
|
79
|
+
"<rootDir>/lib/"
|
80
|
+
],
|
81
|
+
"moduleFileExtensions": [
|
82
|
+
"js"
|
83
|
+
],
|
84
|
+
"transform": {
|
85
|
+
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
|
86
|
+
},
|
87
|
+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.js$",
|
88
|
+
"testPathIgnorePatterns": [
|
89
|
+
"\\.snap$",
|
90
|
+
"<rootDir>/node_modules/"
|
91
|
+
],
|
92
|
+
"cacheDirectory": ".jest/cache",
|
93
|
+
"setupFiles": [
|
94
|
+
"./scripts/setupJest.js"
|
95
|
+
]
|
96
|
+
},
|
97
|
+
"react-native-builder-bob": {
|
98
|
+
"source": "src",
|
99
|
+
"output": "lib",
|
100
|
+
"targets": [
|
101
|
+
"commonjs",
|
102
|
+
"module",
|
103
|
+
[
|
104
|
+
"typescript",
|
105
|
+
{
|
106
|
+
"project": "tsconfig.build.json"
|
107
|
+
}
|
108
|
+
]
|
109
|
+
]
|
110
|
+
},
|
111
|
+
"dependencies": {
|
112
|
+
"react-native-purchases": "7.15.0-rc.1"
|
113
|
+
}
|
114
|
+
}
|
package/src/index.tsx
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import { NativeModules } from "react-native";
|
2
|
+
|
3
|
+
const RNPaywalls = NativeModules.RNPaywalls;
|
4
|
+
|
5
|
+
export function presentPaywall() {
|
6
|
+
// TODO: check iOS/Android version
|
7
|
+
RNPaywalls.presentPaywall();
|
8
|
+
}
|
9
|
+
|
10
|
+
export function presentPaywallIfNeeded(requiredEntitlementIdentifier: String) {
|
11
|
+
// TODO: check iOS/Android version
|
12
|
+
RNPaywalls.presentPaywallIfNeeded(requiredEntitlementIdentifier);
|
13
|
+
}
|