react-native-purchases 9.2.3 → 9.3.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", '17.0.0'
28
+ spec.dependency "PurchasesHybridCommon", '17.3.0'
29
29
  spec.swift_version = '5.7'
30
30
  end
@@ -6,7 +6,7 @@ buildscript {
6
6
  }
7
7
 
8
8
  dependencies {
9
- classpath 'com.android.tools.build:gradle:8.12.1'
9
+ classpath 'com.android.tools.build:gradle:8.12.2'
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.2.3'
32
+ versionName '9.3.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:17.0.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:17.3.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.2.3";
50
+ public static final String PLUGIN_VERSION = "9.3.0";
51
51
 
52
52
  private final ReactApplicationContext reactContext;
53
53
 
@@ -77,7 +77,7 @@ export declare const browserNativeModuleRNPurchases: {
77
77
  isWebPurchaseRedemptionURL: (_urlString: string) => Promise<void>;
78
78
  isConfigured: () => Promise<boolean>;
79
79
  redeemWebPurchase: (_urlString: string) => Promise<void>;
80
- getVirtualCurrencies: () => Promise<void>;
80
+ getVirtualCurrencies: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesVirtualCurrencies>;
81
81
  invalidateVirtualCurrenciesCache: () => Promise<void>;
82
- getCachedVirtualCurrencies: () => Promise<void>;
82
+ getCachedVirtualCurrencies: () => Promise<import("@revenuecat/purchases-typescript-internal").PurchasesVirtualCurrencies | null>;
83
83
  };
@@ -541,21 +541,31 @@ exports.browserNativeModuleRNPurchases = {
541
541
  });
542
542
  }); },
543
543
  getVirtualCurrencies: function () { return __awaiter(void 0, void 0, void 0, function () {
544
+ var virtualCurrencies;
544
545
  return __generator(this, function (_a) {
545
- (0, utils_1.methodNotSupportedOnWeb)('getVirtualCurrencies');
546
- return [2 /*return*/];
546
+ switch (_a.label) {
547
+ case 0:
548
+ (0, utils_1.ensurePurchasesConfigured)();
549
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getVirtualCurrencies()];
550
+ case 1:
551
+ virtualCurrencies = _a.sent();
552
+ return [2 /*return*/, (0, typeGuards_1.validateAndTransform)(virtualCurrencies, typeGuards_1.isPurchasesVirtualCurrencies, 'PurchasesVirtualCurrencies')];
553
+ }
547
554
  });
548
555
  }); },
549
556
  invalidateVirtualCurrenciesCache: function () { return __awaiter(void 0, void 0, void 0, function () {
550
557
  return __generator(this, function (_a) {
551
- (0, utils_1.methodNotSupportedOnWeb)('invalidateVirtualCurrenciesCache');
558
+ (0, utils_1.ensurePurchasesConfigured)();
559
+ purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().invalidateVirtualCurrenciesCache();
552
560
  return [2 /*return*/];
553
561
  });
554
562
  }); },
555
563
  getCachedVirtualCurrencies: function () { return __awaiter(void 0, void 0, void 0, function () {
564
+ var cachedVirtualCurrencies;
556
565
  return __generator(this, function (_a) {
557
- (0, utils_1.methodNotSupportedOnWeb)('getCachedVirtualCurrencies');
558
- return [2 /*return*/];
566
+ (0, utils_1.ensurePurchasesConfigured)();
567
+ cachedVirtualCurrencies = purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getCachedVirtualCurrencies();
568
+ return [2 /*return*/, cachedVirtualCurrencies ? (0, typeGuards_1.validateAndTransform)(cachedVirtualCurrencies, typeGuards_1.isPurchasesVirtualCurrencies, 'PurchasesVirtualCurrencies') : null];
559
569
  });
560
570
  }); },
561
571
  };
@@ -1,4 +1,4 @@
1
- import { CustomerInfo, MakePurchaseResult, PurchasesOffering, PurchasesOfferings } from '@revenuecat/purchases-typescript-internal';
1
+ import { CustomerInfo, MakePurchaseResult, PurchasesOffering, PurchasesOfferings, PurchasesVirtualCurrencies } from '@revenuecat/purchases-typescript-internal';
2
2
  /**
3
3
  * Type guard function type - returns true if value matches type T
4
4
  */
@@ -20,4 +20,5 @@ export declare function isLogInResult(value: any): value is {
20
20
  created: boolean;
21
21
  };
22
22
  export declare function isMakePurchaseResult(value: any): value is MakePurchaseResult;
23
+ export declare function isPurchasesVirtualCurrencies(value: any): value is PurchasesVirtualCurrencies;
23
24
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isMakePurchaseResult = exports.isLogInResult = exports.isPurchasesOffering = exports.isPurchasesOfferings = exports.isCustomerInfo = exports.validateAndTransform = void 0;
3
+ exports.isPurchasesVirtualCurrencies = exports.isMakePurchaseResult = exports.isLogInResult = exports.isPurchasesOffering = exports.isPurchasesOfferings = exports.isCustomerInfo = exports.validateAndTransform = void 0;
4
4
  /**
5
5
  * Type-safe transformation function that validates purchases-js output matches expected type
6
6
  * @param value - The value from purchases-js
@@ -59,3 +59,8 @@ function isMakePurchaseResult(value) {
59
59
  typeof value.transaction === 'object';
60
60
  }
61
61
  exports.isMakePurchaseResult = isMakePurchaseResult;
62
+ function isPurchasesVirtualCurrencies(value) {
63
+ return value && typeof value === 'object' &&
64
+ typeof value.all === 'object';
65
+ }
66
+ exports.isPurchasesVirtualCurrencies = isPurchasesVirtualCurrencies;
package/ios/RNPurchases.m CHANGED
@@ -657,7 +657,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
657
657
  }
658
658
 
659
659
  - (NSString *)platformFlavorVersion {
660
- return @"9.2.3";
660
+ return @"9.3.0";
661
661
  }
662
662
 
663
663
  @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": "9.2.3",
4
+ "version": "9.3.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",
@@ -114,7 +114,7 @@
114
114
  ]
115
115
  },
116
116
  "dependencies": {
117
- "@revenuecat/purchases-js-hybrid-mappings": "16.2.1",
118
- "@revenuecat/purchases-typescript-internal": "16.2.1"
117
+ "@revenuecat/purchases-js-hybrid-mappings": "17.3.0",
118
+ "@revenuecat/purchases-typescript-internal": "17.3.0"
119
119
  }
120
120
  }