react-native-purchases 7.4.0-beta.3 → 7.5.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.
@@ -24,6 +24,6 @@ Pod::Spec.new do |spec|
24
24
  ]
25
25
 
26
26
  spec.dependency "React-Core"
27
- spec.dependency "PurchasesHybridCommon", '7.4.0-beta.3'
28
- spec.swift_version = '5.7'
27
+ spec.dependency "PurchasesHybridCommon", '8.1.0'
28
+ spec.swift_version = '5.0'
29
29
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '7.4.0-beta.3'
32
+ versionName '7.5.0'
33
33
  }
34
34
 
35
35
  buildTypes {
@@ -121,8 +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:7.4.0-beta.3'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:8.1.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
- implementation 'androidx.compose.ui:ui-android:1.5.4'
127
- implementation "androidx.appcompat:appcompat:1.6.1"
128
126
  }
@@ -45,7 +45,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
45
45
  private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
46
46
  private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
47
47
  public static final String PLATFORM_NAME = "react-native";
48
- public static final String PLUGIN_VERSION = "7.4.0-beta.3";
48
+ public static final String PLUGIN_VERSION = "7.5.0";
49
49
 
50
50
  private final ReactApplicationContext reactContext;
51
51
 
@@ -83,7 +83,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
83
83
  public void setupPurchases(String apiKey, @Nullable String appUserID,
84
84
  boolean observerMode, @Nullable String userDefaultsSuiteName,
85
85
  @Nullable Boolean usesStoreKit2IfAvailable, boolean useAmazon,
86
- boolean shouldShowInAppMessagesAutomatically) {
86
+ boolean shouldShowInAppMessagesAutomatically,
87
+ @Nullable String entitlementVerificationMode) {
87
88
  PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
88
89
  Store store = Store.PLAY_STORE;
89
90
  if (useAmazon) {
@@ -97,7 +98,8 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
97
98
  platformInfo,
98
99
  store,
99
100
  new DangerousSettings(),
100
- shouldShowInAppMessagesAutomatically
101
+ shouldShowInAppMessagesAutomatically,
102
+ entitlementVerificationMode
101
103
  );
102
104
  Purchases.getSharedInstance().setUpdatedCustomerInfoListener(this);
103
105
  }
@@ -18,10 +18,7 @@ public class RNPurchasesPackage implements ReactPackage {
18
18
  @NonNull
19
19
  @Override
20
20
  public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
21
- return Arrays.<NativeModule>asList(
22
- new RNPurchasesModule(reactContext),
23
- new RNPaywallsModule(reactContext)
24
- );
21
+ return Arrays.<NativeModule>asList(new RNPurchasesModule(reactContext));
25
22
  }
26
23
 
27
24
  // Deprecated from RN 0.47
@@ -32,8 +29,6 @@ public class RNPurchasesPackage implements ReactPackage {
32
29
  @NonNull
33
30
  @Override
34
31
  public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
35
- return Arrays.asList(
36
- new RNPaywallManager()
37
- );
32
+ return Collections.emptyList();
38
33
  }
39
34
  }
package/dist/index.d.ts CHANGED
@@ -4,4 +4,3 @@ export * from './errors';
4
4
  export * from './customerInfo';
5
5
  export * from './purchases';
6
6
  export * from './offerings';
7
- export * from './paywalls';
package/dist/index.js CHANGED
@@ -23,4 +23,3 @@ __exportStar(require("./errors"), exports);
23
23
  __exportStar(require("./customerInfo"), exports);
24
24
  __exportStar(require("./purchases"), exports);
25
25
  __exportStar(require("./offerings"), exports);
26
- __exportStar(require("./paywalls"), exports);
@@ -1,4 +1,4 @@
1
- import { PURCHASES_ERROR_CODE, UninitializedPurchasesError, UnsupportedPlatformError, CustomerInfo, PurchasesEntitlementInfo, PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings, PurchasesStoreProduct, UpgradeInfo, PurchasesPromotionalOffer, PurchasesPackage, IntroEligibility, PurchasesStoreProductDiscount, SubscriptionOption, PRODUCT_CATEGORY, GoogleProductChangeInfo, PURCHASE_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, IN_APP_MESSAGE_TYPE } from '@revenuecat/purchases-typescript-internal';
1
+ import { PURCHASES_ERROR_CODE, UninitializedPurchasesError, UnsupportedPlatformError, CustomerInfo, PurchasesEntitlementInfo, PRORATION_MODE, PACKAGE_TYPE, INTRO_ELIGIBILITY_STATUS, PurchasesOfferings, PurchasesStoreProduct, UpgradeInfo, PurchasesPromotionalOffer, PurchasesPackage, IntroEligibility, PurchasesStoreProductDiscount, SubscriptionOption, PRODUCT_CATEGORY, GoogleProductChangeInfo, PURCHASE_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult, IN_APP_MESSAGE_TYPE, ENTITLEMENT_VERIFICATION_MODE, VERIFICATION_RESULT } from '@revenuecat/purchases-typescript-internal';
2
2
  export { PURCHASE_TYPE, BILLING_FEATURE, REFUND_REQUEST_STATUS, LOG_LEVEL, PurchasesConfiguration, CustomerInfoUpdateListener, ShouldPurchasePromoProductListener, MakePurchaseResult, LogHandler, LogInResult } from '@revenuecat/purchases-typescript-internal';
3
3
  export default class Purchases {
4
4
  /**
@@ -64,6 +64,18 @@ export default class Purchases {
64
64
  * @enum {number}
65
65
  */
66
66
  static IN_APP_MESSAGE_TYPE: typeof IN_APP_MESSAGE_TYPE;
67
+ /**
68
+ * Enum of entitlement verification modes.
69
+ * @readonly
70
+ * @enum {string}
71
+ */
72
+ static ENTITLEMENT_VERIFICATION_MODE: typeof ENTITLEMENT_VERIFICATION_MODE;
73
+ /**
74
+ * The result of the verification process.
75
+ * @readonly
76
+ * @enum {string}
77
+ */
78
+ static VERIFICATION_RESULT: typeof VERIFICATION_RESULT;
67
79
  /**
68
80
  * @internal
69
81
  */
@@ -79,12 +91,13 @@ export default class Purchases {
79
91
  * @param {boolean} [observerMode=false] An optional boolean. Set this to TRUE if you have your own IAP implementation and want to use only RevenueCat's backend. Default is FALSE.
80
92
  * @param {boolean} [usesStoreKit2IfAvailable=false] DEPRECATED. An optional boolean. iOS-only. Defaults to FALSE. Setting this to TRUE will enable StoreKit2 on compatible devices.
81
93
  * We recommend not using this parameter, letting RevenueCat decide for you which StoreKit implementation to use.
94
+ * @param {ENTITLEMENT_VERIFICATION_MODE} [entitlementVerificationMode=ENTITLEMENT_VERIFICATION_MODE.DISABLED] Sets the entitlement verifciation mode to use. For more details, check https://rev.cat/trusted-entitlements
82
95
  * @param {boolean} [useAmazon=false] An optional boolean. Android-only. Set this to TRUE to enable Amazon on compatible devices.
83
96
  * @param {String?} userDefaultsSuiteName An optional string. iOS-only, will be ignored for Android.
84
97
  * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults suite, otherwise it will use standardUserDefaults.
85
98
  * Default is null, which will make the SDK use standardUserDefaults.
86
99
  */
87
- static configure({ apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable, useAmazon, shouldShowInAppMessagesAutomatically }: PurchasesConfiguration): void;
100
+ static configure({ apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode }: PurchasesConfiguration): void;
88
101
  /**
89
102
  * @deprecated, configure behavior through the RevenueCat dashboard instead.
90
103
  * If an user tries to purchase a product that is active on the current app store account,
package/dist/purchases.js CHANGED
@@ -75,20 +75,21 @@ var Purchases = /** @class */ (function () {
75
75
  * @param {boolean} [observerMode=false] An optional boolean. Set this to TRUE if you have your own IAP implementation and want to use only RevenueCat's backend. Default is FALSE.
76
76
  * @param {boolean} [usesStoreKit2IfAvailable=false] DEPRECATED. An optional boolean. iOS-only. Defaults to FALSE. Setting this to TRUE will enable StoreKit2 on compatible devices.
77
77
  * We recommend not using this parameter, letting RevenueCat decide for you which StoreKit implementation to use.
78
+ * @param {ENTITLEMENT_VERIFICATION_MODE} [entitlementVerificationMode=ENTITLEMENT_VERIFICATION_MODE.DISABLED] Sets the entitlement verifciation mode to use. For more details, check https://rev.cat/trusted-entitlements
78
79
  * @param {boolean} [useAmazon=false] An optional boolean. Android-only. Set this to TRUE to enable Amazon on compatible devices.
79
80
  * @param {String?} userDefaultsSuiteName An optional string. iOS-only, will be ignored for Android.
80
81
  * Set this if you would like the RevenueCat SDK to store its preferences in a different NSUserDefaults suite, otherwise it will use standardUserDefaults.
81
82
  * Default is null, which will make the SDK use standardUserDefaults.
82
83
  */
83
84
  Purchases.configure = function (_a) {
84
- var apiKey = _a.apiKey, _b = _a.appUserID, appUserID = _b === void 0 ? null : _b, _c = _a.observerMode, observerMode = _c === void 0 ? false : _c, userDefaultsSuiteName = _a.userDefaultsSuiteName, _d = _a.usesStoreKit2IfAvailable, usesStoreKit2IfAvailable = _d === void 0 ? false : _d, _e = _a.useAmazon, useAmazon = _e === void 0 ? false : _e, _f = _a.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _f === void 0 ? true : _f;
85
+ var apiKey = _a.apiKey, _b = _a.appUserID, appUserID = _b === void 0 ? null : _b, _c = _a.observerMode, observerMode = _c === void 0 ? false : _c, userDefaultsSuiteName = _a.userDefaultsSuiteName, _d = _a.usesStoreKit2IfAvailable, usesStoreKit2IfAvailable = _d === void 0 ? false : _d, _e = _a.useAmazon, useAmazon = _e === void 0 ? false : _e, _f = _a.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _f === void 0 ? true : _f, _g = _a.entitlementVerificationMode, entitlementVerificationMode = _g === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _g;
85
86
  if (apiKey === undefined || typeof apiKey !== "string") {
86
87
  throw new Error("Invalid API key. It must be called with an Object: configure({apiKey: \"key\"})");
87
88
  }
88
89
  if (appUserID !== null && typeof appUserID !== "undefined" && typeof appUserID !== "string") {
89
90
  throw new Error("appUserID needs to be a string");
90
91
  }
91
- RNPurchases.setupPurchases(apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable, useAmazon, shouldShowInAppMessagesAutomatically);
92
+ RNPurchases.setupPurchases(apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable, useAmazon, shouldShowInAppMessagesAutomatically, entitlementVerificationMode);
92
93
  };
93
94
  /**
94
95
  * @deprecated, configure behavior through the RevenueCat dashboard instead.
@@ -1453,6 +1454,18 @@ var Purchases = /** @class */ (function () {
1453
1454
  * @enum {number}
1454
1455
  */
1455
1456
  Purchases.IN_APP_MESSAGE_TYPE = purchases_typescript_internal_1.IN_APP_MESSAGE_TYPE;
1457
+ /**
1458
+ * Enum of entitlement verification modes.
1459
+ * @readonly
1460
+ * @enum {string}
1461
+ */
1462
+ Purchases.ENTITLEMENT_VERIFICATION_MODE = purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE;
1463
+ /**
1464
+ * The result of the verification process.
1465
+ * @readonly
1466
+ * @enum {string}
1467
+ */
1468
+ Purchases.VERIFICATION_RESULT = purchases_typescript_internal_1.VERIFICATION_RESULT;
1456
1469
  /**
1457
1470
  * @internal
1458
1471
  */
package/ios/RNPurchases.m CHANGED
@@ -43,7 +43,8 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
43
43
  userDefaultsSuiteName:(nullable NSString *)userDefaultsSuiteName
44
44
  usesStoreKit2IfAvailable:(BOOL)usesStoreKit2IfAvailable
45
45
  useAmazon:(BOOL)useAmazon
46
- shouldShowInAppMessagesAutomatically:(BOOL)shouldShowInAppMessagesAutomatically) {
46
+ shouldShowInAppMessagesAutomatically:(BOOL)shouldShowInAppMessagesAutomatically
47
+ entitlementVerificationMode:(nullable NSString *)entitlementVerificationMode) {
47
48
  RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey
48
49
  appUserID:appUserID
49
50
  observerMode:observerMode
@@ -52,7 +53,8 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
52
53
  platformFlavorVersion:self.platformFlavorVersion
53
54
  usesStoreKit2IfAvailable:usesStoreKit2IfAvailable
54
55
  dangerousSettings:nil
55
- shouldShowInAppMessagesAutomatically:shouldShowInAppMessagesAutomatically];
56
+ shouldShowInAppMessagesAutomatically:shouldShowInAppMessagesAutomatically
57
+ verificationMode:entitlementVerificationMode];
56
58
  purchases.delegate = self;
57
59
  }
58
60
 
@@ -470,7 +472,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
470
472
  }
471
473
 
472
474
  - (NSString *)platformFlavorVersion {
473
- return @"7.4.0-beta.3";
475
+ return @"7.5.0";
474
476
  }
475
477
 
476
478
  @end
@@ -10,8 +10,6 @@
10
10
  3552B97D252CF5900098008A /* PurchasesPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3552B97C252CF5900098008A /* PurchasesPlugin.swift */; };
11
11
  35BFF4DC247DDAD3008B64DA /* PurchasesHybridCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */; };
12
12
  35D0736B20AD0F740012EB8C /* Purchases.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35D0736A20AD0F740012EB8C /* Purchases.framework */; };
13
- 4F72072A2AF30E7E0017395F /* RNPaywallManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7207292AF30E7E0017395F /* RNPaywallManager.m */; };
14
- 4F7D88D52AF9666800855875 /* RNPaywalls.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7D88D32AF9666800855875 /* RNPaywalls.m */; };
15
13
  B3E7B58A1CC2AC0600A0062D /* RNPurchases.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNPurchases.m */; };
16
14
  /* End PBXBuildFile section */
17
15
 
@@ -33,10 +31,6 @@
33
31
  3552B97C252CF5900098008A /* PurchasesPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchasesPlugin.swift; sourceTree = "<group>"; };
34
32
  35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PurchasesHybridCommon.framework; sourceTree = "<group>"; };
35
33
  35D0736A20AD0F740012EB8C /* Purchases.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Purchases.framework; sourceTree = SOURCE_ROOT; };
36
- 4F7207282AF30E7E0017395F /* RNPaywallManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNPaywallManager.h; sourceTree = "<group>"; };
37
- 4F7207292AF30E7E0017395F /* RNPaywallManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNPaywallManager.m; sourceTree = "<group>"; };
38
- 4F7D88D32AF9666800855875 /* RNPaywalls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPaywalls.m; sourceTree = "<group>"; };
39
- 4F7D88D42AF9666800855875 /* RNPaywalls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPaywalls.h; sourceTree = "<group>"; };
40
34
  B3E7B5881CC2AC0600A0062D /* RNPurchases.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPurchases.h; sourceTree = "<group>"; };
41
35
  B3E7B5891CC2AC0600A0062D /* RNPurchases.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPurchases.m; sourceTree = "<group>"; };
42
36
  /* End PBXFileReference section */
@@ -77,10 +71,6 @@
77
71
  35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */,
78
72
  B3E7B5881CC2AC0600A0062D /* RNPurchases.h */,
79
73
  B3E7B5891CC2AC0600A0062D /* RNPurchases.m */,
80
- 4F7207282AF30E7E0017395F /* RNPaywallManager.h */,
81
- 4F7207292AF30E7E0017395F /* RNPaywallManager.m */,
82
- 4F7D88D42AF9666800855875 /* RNPaywalls.h */,
83
- 4F7D88D32AF9666800855875 /* RNPaywalls.m */,
84
74
  134814211AA4EA7D00B7C361 /* Products */,
85
75
  35493AC8202D4BCD004DFA39 /* Frameworks */,
86
76
  3552B97B252CF5900098008A /* RNPurchases-Bridging-Header.h */,
@@ -146,10 +136,8 @@
146
136
  isa = PBXSourcesBuildPhase;
147
137
  buildActionMask = 2147483647;
148
138
  files = (
149
- 4F7D88D52AF9666800855875 /* RNPaywalls.m in Sources */,
150
139
  B3E7B58A1CC2AC0600A0062D /* RNPurchases.m in Sources */,
151
140
  3552B97D252CF5900098008A /* PurchasesPlugin.swift in Sources */,
152
- 4F72072A2AF30E7E0017395F /* RNPaywallManager.m in Sources */,
153
141
  );
154
142
  runOnlyForDeploymentPostprocessing = 0;
155
143
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-purchases",
3
3
  "title": "React Native Purchases",
4
- "version": "7.4.0-beta.3",
4
+ "version": "7.5.0",
5
5
  "description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -95,6 +95,6 @@
95
95
  ]
96
96
  },
97
97
  "dependencies": {
98
- "@revenuecat/purchases-typescript-internal": "7.3.1"
98
+ "@revenuecat/purchases-typescript-internal": "8.1.0"
99
99
  }
100
100
  }
@@ -2,7 +2,7 @@
2
2
  <!DOCTYPE html>
3
3
  <html>
4
4
  <head>
5
- <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/7.4.0-beta.3/" />
5
+ <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/7.5.0/" />
6
6
  </head>
7
7
  <body>
8
8
  </body>
@@ -1,33 +0,0 @@
1
- package com.revenuecat.purchases.react
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
- }
@@ -1,22 +0,0 @@
1
- package com.revenuecat.purchases.react;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.uimanager.SimpleViewManager;
6
- import com.facebook.react.uimanager.ThemedReactContext;
7
-
8
- public class RNPaywallManager extends SimpleViewManager<Paywall> {
9
- public static final String REACT_CLASS = "RNPaywall";
10
-
11
- @NonNull
12
- @Override
13
- public String getName() {
14
- return REACT_CLASS;
15
- }
16
-
17
- @NonNull
18
- @Override
19
- protected Paywall createViewInstance(@NonNull ThemedReactContext themedReactContext) {
20
- return new Paywall(themedReactContext);
21
- }
22
- }
@@ -1,58 +0,0 @@
1
- package com.revenuecat.purchases.react;
2
-
3
- import static com.revenuecat.purchases.hybridcommon.PaywallHelpersKt.presentPaywallFromFragment;
4
-
5
- import android.app.Activity;
6
-
7
- import androidx.annotation.NonNull;
8
- import androidx.annotation.Nullable;
9
- import androidx.annotation.OptIn;
10
- import androidx.fragment.app.FragmentActivity;
11
-
12
- import com.facebook.react.bridge.ReactApplicationContext;
13
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
14
- import com.facebook.react.bridge.ReactMethod;
15
- import com.revenuecat.purchases.ui.revenuecatui.ExperimentalPreviewRevenueCatUIPurchasesAPI;
16
-
17
- @OptIn(markerClass = ExperimentalPreviewRevenueCatUIPurchasesAPI.class)
18
- public class RNPaywallsModule extends ReactContextBaseJavaModule {
19
- public RNPaywallsModule(ReactApplicationContext reactContext) {
20
- super(reactContext);
21
- }
22
-
23
- @NonNull
24
- @Override
25
- public String getName() {
26
- return "RNPaywalls";
27
- }
28
-
29
- @ReactMethod
30
- public void presentPaywall() {
31
- presentPaywall(null);
32
- }
33
-
34
- @ReactMethod
35
- public void presentPaywallIfNeeded(final String requiredEntitlementIdentifier) {
36
- presentPaywall(requiredEntitlementIdentifier);
37
- }
38
-
39
- private void presentPaywall(final @Nullable String requiredEntitlementIdentifier) {
40
- final FragmentActivity fragment = getCurrentActivityFragment();
41
- if (fragment == null) {
42
- // TODO: log
43
- return;
44
- }
45
-
46
- presentPaywallFromFragment(fragment, requiredEntitlementIdentifier);
47
- }
48
-
49
- private @Nullable FragmentActivity getCurrentActivityFragment() {
50
- final Activity activity = getCurrentActivity();
51
-
52
- if (activity instanceof FragmentActivity) {
53
- return (FragmentActivity) activity;
54
- } else {
55
- return null;
56
- }
57
- }
58
- }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export default class PaywallView extends React.Component {
3
- render(): React.JSX.Element;
4
- }
5
- export declare function presentPaywall(): void;
6
- export declare function presentPaywallIfNeeded(requiredEntitlementIdentifier: String): void;
package/dist/paywalls.js DELETED
@@ -1,60 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.presentPaywallIfNeeded = exports.presentPaywall = void 0;
33
- var react_native_1 = require("react-native");
34
- var react_native_2 = require("react-native");
35
- var react_1 = __importDefault(require("react"));
36
- var RNPaywall = (0, react_native_1.requireNativeComponent)('RNPaywall');
37
- var RNPaywalls = react_native_2.NativeModules.RNPaywalls;
38
- var PaywallView = /** @class */ (function (_super) {
39
- __extends(PaywallView, _super);
40
- function PaywallView() {
41
- return _super !== null && _super.apply(this, arguments) || this;
42
- }
43
- PaywallView.prototype.render = function () {
44
- return (
45
- // TODO: check iOS version to fail if < 15
46
- react_1.default.createElement(RNPaywall, __assign({}, this.props)));
47
- };
48
- return PaywallView;
49
- }(react_1.default.Component));
50
- exports.default = PaywallView;
51
- function presentPaywall() {
52
- // TODO: check iOS/Android version
53
- RNPaywalls.presentPaywall();
54
- }
55
- exports.presentPaywall = presentPaywall;
56
- function presentPaywallIfNeeded(requiredEntitlementIdentifier) {
57
- // TODO: check iOS/Android version
58
- RNPaywalls.presentPaywallIfNeeded(requiredEntitlementIdentifier);
59
- }
60
- exports.presentPaywallIfNeeded = presentPaywallIfNeeded;
@@ -1,17 +0,0 @@
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
@@ -1,27 +0,0 @@
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 DELETED
@@ -1,13 +0,0 @@
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 DELETED
@@ -1,81 +0,0 @@
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