react-native-purchases 10.5.0 → 10.7.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.
@@ -25,6 +25,6 @@ Pod::Spec.new do |spec|
25
25
  ]
26
26
 
27
27
  spec.dependency "React-Core"
28
- spec.dependency "PurchasesHybridCommon", '18.26.0'
28
+ spec.dependency "PurchasesHybridCommon", '18.29.0'
29
29
  spec.swift_version = '5.7'
30
30
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '10.5.0'
32
+ versionName '10.7.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:18.26.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:18.29.0'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -51,7 +51,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
51
51
  private static final String TRACKED_EVENT = "Purchases-TrackedEvent";
52
52
  private static final String DEBUG_EVENT = "Purchases-DebugEvent";
53
53
  public static final String PLATFORM_NAME = "react-native";
54
- public static final String PLUGIN_VERSION = "10.5.0";
54
+ public static final String PLUGIN_VERSION = "10.7.0";
55
55
 
56
56
  private final ReactApplicationContext reactContext;
57
57
 
@@ -96,8 +96,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
96
96
  boolean pendingTransactionsForPrepaidPlansEnabled,
97
97
  boolean diagnosticsEnabled,
98
98
  boolean automaticDeviceIdentifierCollectionEnabled,
99
- @Nullable String preferredUILocaleOverride,
100
- boolean useWorkflows) {
99
+ @Nullable String preferredUILocaleOverride) {
101
100
  PlatformInfo platformInfo = new PlatformInfo(PLATFORM_NAME, PLUGIN_VERSION);
102
101
  Store store = Store.PLAY_STORE;
103
102
  if ("GALAXY".equals(storeString)) {
@@ -105,9 +104,6 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
105
104
  } else if (useAmazon) {
106
105
  store = Store.AMAZON;
107
106
  }
108
- DangerousSettings dangerousSettings = useWorkflows
109
- ? DangerousSettings.forWorkflows(true)
110
- : new DangerousSettings();
111
107
  CommonKt.configure(
112
108
  reactContext,
113
109
  apiKey,
@@ -115,7 +111,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
115
111
  purchasesAreCompletedBy,
116
112
  platformInfo,
117
113
  store,
118
- dangerousSettings,
114
+ new DangerousSettings(),
119
115
  shouldShowInAppMessagesAutomatically,
120
116
  entitlementVerificationMode,
121
117
  pendingTransactionsForPrepaidPlansEnabled,
@@ -510,6 +506,11 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
510
506
  SubscriberAttributesKt.setOnesignalID(onesignalID);
511
507
  }
512
508
 
509
+ @ReactMethod
510
+ public void setOnesignalUserID(String onesignalUserID) {
511
+ SubscriberAttributesKt.setOnesignalUserID(onesignalUserID);
512
+ }
513
+
513
514
  @ReactMethod
514
515
  public void setAirshipChannelID(String airshipChannelID) {
515
516
  SubscriberAttributesKt.setAirshipChannelID(airshipChannelID);
@@ -3,7 +3,7 @@ import { MakePurchaseResult } from '@revenuecat/purchases-typescript-internal';
3
3
  * Browser implementation of the native module. This will be used in the browser and Expo Go.
4
4
  */
5
5
  export declare const browserNativeModuleRNPurchases: {
6
- setupPurchases: (apiKey: string, appUserID: string | null, _purchasesAreCompletedBy: string | null, _userDefaultsSuiteName: string | null, _storeKitVersion: string | null, _useAmazon: boolean, _store: string | null, _galaxyBillingMode: string | null, _shouldShowInAppMessagesAutomatically: boolean, _entitlementVerificationMode: string | null, _pendingTransactionsForPrepaidPlansEnabled: boolean, _diagnosticsEnabled: boolean, _automaticDeviceIdentifierCollectionEnabled: boolean, _preferredUILocaleOverride: string | null, _useWorkflows: boolean) => void;
6
+ setupPurchases: (apiKey: string, appUserID: string | null, _purchasesAreCompletedBy: string | null, _userDefaultsSuiteName: string | null, _storeKitVersion: string | null, _useAmazon: boolean, _store: string | null, _galaxyBillingMode: string | null, _shouldShowInAppMessagesAutomatically: boolean, _entitlementVerificationMode: string | null, _pendingTransactionsForPrepaidPlansEnabled: boolean, _diagnosticsEnabled: boolean, _automaticDeviceIdentifierCollectionEnabled: boolean, _preferredUILocaleOverride: string | null) => void;
7
7
  setAllowSharingStoreAccount: (_allowSharing: boolean) => Promise<void>;
8
8
  setSimulatesAskToBuyInSandbox: (_simulatesAskToBuyInSandbox: boolean) => Promise<void>;
9
9
  getOfferings: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesOfferings>;
@@ -63,6 +63,7 @@ export declare const browserNativeModuleRNPurchases: {
63
63
  setTenjinAnalyticsInstallationID: (_tenjinAnalyticsInstallationID: string) => Promise<void>;
64
64
  setKochavaDeviceID: (_kochavaDeviceID: string) => Promise<void>;
65
65
  setOnesignalID: (_onesignalID: string) => Promise<void>;
66
+ setOnesignalUserID: (_onesignalUserID: string) => Promise<void>;
66
67
  setAirshipChannelID: (_airshipChannelID: string) => Promise<void>;
67
68
  setMediaSource: (_mediaSource: string) => Promise<void>;
68
69
  setMediaCampaign: () => Promise<void>;
@@ -48,7 +48,7 @@ var packageVersion = '9.1.0';
48
48
  * Browser implementation of the native module. This will be used in the browser and Expo Go.
49
49
  */
50
50
  exports.browserNativeModuleRNPurchases = {
51
- setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _store, _galaxyBillingMode, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled, _automaticDeviceIdentifierCollectionEnabled, _preferredUILocaleOverride, _useWorkflows) {
51
+ setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _store, _galaxyBillingMode, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled, _automaticDeviceIdentifierCollectionEnabled, _preferredUILocaleOverride) {
52
52
  try {
53
53
  // Make sure that when running in Expo Go or Rork sandbox a web-compatible API key is used, because the underlying purchases-js error message isn't super clear when a non-compatible API key type is used in this case
54
54
  var webPlatformCompatibleApiKeyPrefixList = ['test_', 'rcb_'];
@@ -463,6 +463,12 @@ exports.browserNativeModuleRNPurchases = {
463
463
  return [2 /*return*/];
464
464
  });
465
465
  }); },
466
+ setOnesignalUserID: function (_onesignalUserID) { return __awaiter(void 0, void 0, void 0, function () {
467
+ return __generator(this, function (_a) {
468
+ (0, utils_1.methodNotSupportedOnWeb)('setOnesignalUserID');
469
+ return [2 /*return*/];
470
+ });
471
+ }); },
466
472
  setAirshipChannelID: function (_airshipChannelID) { return __awaiter(void 0, void 0, void 0, function () {
467
473
  return __generator(this, function (_a) {
468
474
  (0, utils_1.methodNotSupportedOnWeb)('setAirshipChannelID');
@@ -835,13 +835,24 @@ export default class Purchases {
835
835
  static setKochavaDeviceID(kochavaDeviceID: string | null): Promise<void>;
836
836
  /**
837
837
  * Subscriber attribute associated with the OneSignal Player Id for the user
838
- * Required for the RevenueCat OneSignal integration
838
+ * Required for the RevenueCat OneSignal integration with OneSignal SDK v4.0 and below
839
+ * (OneSignal API v9). For OneSignal SDK v5.0 and above, use {@link setOnesignalUserID} instead.
839
840
  *
840
841
  * @param onesignalID OneSignal Player ID to use in OneSignal integration. Empty String or null will delete the subscriber attribute.
841
842
  * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
842
843
  * setting the OneSignal ID.
843
844
  */
844
845
  static setOnesignalID(onesignalID: string | null): Promise<void>;
846
+ /**
847
+ * Subscriber attribute associated with the OneSignal User ID for the user
848
+ * Required for the RevenueCat OneSignal integration with OneSignal SDK v5.0
849
+ * and above (OneSignal API v11+).
850
+ *
851
+ * @param onesignalUserID OneSignal User ID to use in OneSignal integration. Empty String or null will delete the subscriber attribute.
852
+ * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
853
+ * setting the OneSignal user ID.
854
+ */
855
+ static setOnesignalUserID(onesignalUserID: string | null): Promise<void>;
845
856
  /**
846
857
  * Subscriber attribute associated with the Airship Channel Id for the user
847
858
  * Required for the RevenueCat Airship integration
package/dist/purchases.js CHANGED
@@ -172,9 +172,8 @@ var Purchases = /** @class */ (function () {
172
172
  * @warning If you use purchasesAreCompletedBy=PurchasesAreCompletedByMyApp, you must also provide a value for storeKitVersion.
173
173
  */
174
174
  Purchases.configure = function (configuration) {
175
- var _a;
176
- var apiKey = configuration.apiKey, _b = configuration.appUserID, appUserID = _b === void 0 ? null : _b, _c = configuration.purchasesAreCompletedBy, purchasesAreCompletedBy = _c === void 0 ? purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT : _c, userDefaultsSuiteName = configuration.userDefaultsSuiteName, _d = configuration.storeKitVersion, storeKitVersion = _d === void 0 ? purchases_typescript_internal_1.STOREKIT_VERSION.DEFAULT : _d, _e = configuration.useAmazon, useAmazon = _e === void 0 ? false : _e, _f = configuration.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _f === void 0 ? true : _f, _g = configuration.entitlementVerificationMode, entitlementVerificationMode = _g === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _g, _h = configuration.pendingTransactionsForPrepaidPlansEnabled, pendingTransactionsForPrepaidPlansEnabled = _h === void 0 ? false : _h, _j = configuration.diagnosticsEnabled, diagnosticsEnabled = _j === void 0 ? false : _j, _k = configuration.automaticDeviceIdentifierCollectionEnabled, automaticDeviceIdentifierCollectionEnabled = _k === void 0 ? true : _k, preferredUILocaleOverride = configuration.preferredUILocaleOverride, dangerousSettings = configuration.dangerousSettings;
177
- var _l = configuration, store = _l.store, galaxyBillingMode = _l.galaxyBillingMode;
175
+ var apiKey = configuration.apiKey, _a = configuration.appUserID, appUserID = _a === void 0 ? null : _a, _b = configuration.purchasesAreCompletedBy, purchasesAreCompletedBy = _b === void 0 ? purchases_typescript_internal_1.PURCHASES_ARE_COMPLETED_BY_TYPE.REVENUECAT : _b, userDefaultsSuiteName = configuration.userDefaultsSuiteName, _c = configuration.storeKitVersion, storeKitVersion = _c === void 0 ? purchases_typescript_internal_1.STOREKIT_VERSION.DEFAULT : _c, _d = configuration.useAmazon, useAmazon = _d === void 0 ? false : _d, _e = configuration.shouldShowInAppMessagesAutomatically, shouldShowInAppMessagesAutomatically = _e === void 0 ? true : _e, _f = configuration.entitlementVerificationMode, entitlementVerificationMode = _f === void 0 ? purchases_typescript_internal_1.ENTITLEMENT_VERIFICATION_MODE.DISABLED : _f, _g = configuration.pendingTransactionsForPrepaidPlansEnabled, pendingTransactionsForPrepaidPlansEnabled = _g === void 0 ? false : _g, _h = configuration.diagnosticsEnabled, diagnosticsEnabled = _h === void 0 ? false : _h, _j = configuration.automaticDeviceIdentifierCollectionEnabled, automaticDeviceIdentifierCollectionEnabled = _j === void 0 ? true : _j, preferredUILocaleOverride = configuration.preferredUILocaleOverride;
176
+ var _k = configuration, store = _k.store, galaxyBillingMode = _k.galaxyBillingMode;
178
177
  throwIfNativeModuleNotAvailable();
179
178
  if (!customLogHandler) {
180
179
  this.setLogHandler(function (logLevel, message) {
@@ -227,8 +226,7 @@ var Purchases = /** @class */ (function () {
227
226
  console.warn("Warning: You should provide the specific StoreKit version you're using in your implementation when configuring PURCHASES_ARE_COMPLETED_BY_TYPE.MY_APP, and not rely on the DEFAULT.");
228
227
  }
229
228
  }
230
- var useWorkflows = (_a = dangerousSettings === null || dangerousSettings === void 0 ? void 0 : dangerousSettings.useWorkflows) !== null && _a !== void 0 ? _a : false;
231
- RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, store, galaxyBillingMode, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, automaticDeviceIdentifierCollectionEnabled, preferredUILocaleOverride, useWorkflows);
229
+ RNPurchases.setupPurchases(apiKey, appUserID, purchasesCompletedByToUse, userDefaultsSuiteName, storeKitVersionToUse, useAmazon, store, galaxyBillingMode, shouldShowInAppMessagesAutomatically, entitlementVerificationMode, pendingTransactionsForPrepaidPlansEnabled, diagnosticsEnabled, automaticDeviceIdentifierCollectionEnabled, preferredUILocaleOverride);
232
230
  };
233
231
  /**
234
232
  * @deprecated, configure behavior through the RevenueCat dashboard (app.revenuecat.com) instead.
@@ -1553,7 +1551,8 @@ var Purchases = /** @class */ (function () {
1553
1551
  };
1554
1552
  /**
1555
1553
  * Subscriber attribute associated with the OneSignal Player Id for the user
1556
- * Required for the RevenueCat OneSignal integration
1554
+ * Required for the RevenueCat OneSignal integration with OneSignal SDK v4.0 and below
1555
+ * (OneSignal API v9). For OneSignal SDK v5.0 and above, use {@link setOnesignalUserID} instead.
1557
1556
  *
1558
1557
  * @param onesignalID OneSignal Player ID to use in OneSignal integration. Empty String or null will delete the subscriber attribute.
1559
1558
  * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
@@ -1572,6 +1571,28 @@ var Purchases = /** @class */ (function () {
1572
1571
  });
1573
1572
  });
1574
1573
  };
1574
+ /**
1575
+ * Subscriber attribute associated with the OneSignal User ID for the user
1576
+ * Required for the RevenueCat OneSignal integration with OneSignal SDK v5.0
1577
+ * and above (OneSignal API v11+).
1578
+ *
1579
+ * @param onesignalUserID OneSignal User ID to use in OneSignal integration. Empty String or null will delete the subscriber attribute.
1580
+ * @returns {Promise<void>} The promise will be rejected if configure has not been called yet or if there's an error
1581
+ * setting the OneSignal user ID.
1582
+ */
1583
+ Purchases.setOnesignalUserID = function (onesignalUserID) {
1584
+ return __awaiter(this, void 0, void 0, function () {
1585
+ return __generator(this, function (_a) {
1586
+ switch (_a.label) {
1587
+ case 0: return [4 /*yield*/, throwIfNotConfigured()];
1588
+ case 1:
1589
+ _a.sent();
1590
+ RNPurchases.setOnesignalUserID(onesignalUserID);
1591
+ return [2 /*return*/];
1592
+ }
1593
+ });
1594
+ });
1595
+ };
1575
1596
  /**
1576
1597
  * Subscriber attribute associated with the Airship Channel Id for the user
1577
1598
  * Required for the RevenueCat Airship integration
package/ios/RNPurchases.m CHANGED
@@ -6,12 +6,6 @@
6
6
 
7
7
  #import "RNPurchases.h"
8
8
 
9
- #if __has_include("RNPurchases-Swift.h")
10
- #import "RNPurchases-Swift.h"
11
- #else
12
- #import <RNPurchases/RNPurchases-Swift.h>
13
- #endif
14
-
15
9
  @import StoreKit;
16
10
 
17
11
  typedef void (^PurchaseCompletedBlock)(RCStoreTransaction *, RCCustomerInfo *, NSError *, BOOL);
@@ -95,9 +89,7 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
95
89
  pendingTransactionsForPrepaidPlansEnabled:(BOOL)pendingTransactionsForPrepaidPlansEnabled
96
90
  diagnosticsEnabled:(BOOL)diagnosticsEnabled
97
91
  automaticDeviceIdentifierCollectionEnabled:(BOOL)automaticDeviceIdentifierCollectionEnabled
98
- preferredUILocaleOverride:(nullable NSString *)preferredUILocaleOverride
99
- useWorkflows:(BOOL)useWorkflows) {
100
- RCDangerousSettings *dangerousSettings = [RNPurchasesDangerousSettingsFactory makeWithUseWorkflows:useWorkflows];
92
+ preferredUILocaleOverride:(nullable NSString *)preferredUILocaleOverride) {
101
93
  RCPurchases *purchases = [RCPurchases configureWithAPIKey:apiKey.mappingNSNullToNil
102
94
  appUserID:appUserID.mappingNSNullToNil
103
95
  purchasesAreCompletedBy:purchasesAreCompletedBy.mappingNSNullToNil
@@ -105,7 +97,7 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
105
97
  platformFlavor:self.platformFlavor
106
98
  platformFlavorVersion:self.platformFlavorVersion
107
99
  storeKitVersion:storeKitVersion.mappingNSNullToNil
108
- dangerousSettings:dangerousSettings
100
+ dangerousSettings:nil
109
101
  shouldShowInAppMessagesAutomatically:shouldShowInAppMessagesAutomatically
110
102
  verificationMode:entitlementVerificationMode.mappingNSNullToNil
111
103
  diagnosticsEnabled:diagnosticsEnabled
@@ -453,6 +445,10 @@ RCT_EXPORT_METHOD(setOnesignalID:(NSString *)onesignalID) {
453
445
  [RCCommonFunctionality setOnesignalID:onesignalID.mappingNSNullToNil];
454
446
  }
455
447
 
448
+ RCT_EXPORT_METHOD(setOnesignalUserID:(NSString *)onesignalUserID) {
449
+ [RCCommonFunctionality setOnesignalUserID:onesignalUserID.mappingNSNullToNil];
450
+ }
451
+
456
452
  RCT_EXPORT_METHOD(setAirshipChannelID:(NSString *)airshipChannelID) {
457
453
  [RCCommonFunctionality setAirshipChannelID:airshipChannelID.mappingNSNullToNil];
458
454
  }
@@ -787,7 +783,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
787
783
  }
788
784
 
789
785
  - (NSString *)platformFlavorVersion {
790
- return @"10.5.0";
786
+ return @"10.7.0";
791
787
  }
792
788
 
793
789
  @end
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-purchases",
3
3
  "title": "React Native Purchases",
4
- "version": "10.5.0",
4
+ "version": "10.7.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
  "module": "dist/index.js",
@@ -51,7 +51,7 @@
51
51
  "react-native-purchases-ui",
52
52
  "e2e-tests/MaestroTestApp"
53
53
  ],
54
- "packageManager": "yarn@3.6.1",
54
+ "packageManager": "yarn@3.6.1+sha512.de524adec81a6c3d7a26d936d439d2832e351cdfc5728f9d91f3fc85dd20b04391c038e9b4ecab11cae2b0dd9f0d55fd355af766bc5c1a7f8d25d96bb2a0b2ca",
55
55
  "repository": {
56
56
  "type": "git",
57
57
  "url": "git+https://github.com/revenuecat/react-native-purchases.git",
@@ -118,7 +118,7 @@
118
118
  ]
119
119
  },
120
120
  "dependencies": {
121
- "@revenuecat/purchases-js-hybrid-mappings": "18.26.0",
122
- "@revenuecat/purchases-typescript-internal": "18.26.0"
121
+ "@revenuecat/purchases-js-hybrid-mappings": "18.29.0",
122
+ "@revenuecat/purchases-typescript-internal": "18.29.0"
123
123
  }
124
124
  }
@@ -1,20 +0,0 @@
1
- //
2
- // PurchasesPlugin.swift
3
- // RNPurchases
4
- //
5
- // Created by César de la Vega on 10/6/20.
6
- // Copyright © 2020 Facebook. All rights reserved.
7
- //
8
-
9
- import Foundation
10
- @_spi(Internal) import RevenueCat
11
-
12
- /// Builds `DangerousSettings` for the React Native bridge. Lives in Swift because `useWorkflows`
13
- /// is an internal `@_spi(Internal)` flag that isn't reachable from the Objective-C bridge.
14
- @objc public class RNPurchasesDangerousSettingsFactory: NSObject {
15
-
16
- @objc public static func make(useWorkflows: Bool) -> DangerousSettings {
17
- return useWorkflows ? DangerousSettings(useWorkflows: true) : DangerousSettings()
18
- }
19
-
20
- }