react-native-purchases 8.11.10 → 9.0.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/README.md CHANGED
@@ -44,7 +44,8 @@ Or view our React Native sample app:
44
44
 
45
45
  ## Requirements
46
46
 
47
- The minimum React Native version this SDK requires is `0.64`.
47
+ The minimum React Native version this SDK requires is `0.73.0`.
48
+ In Android, minimum Kotlin version is `1.8.0`.
48
49
 
49
50
  ## SDK Reference
50
51
  Our full SDK reference [can be found here](https://revenuecat.github.io/react-native-purchases-docs/).
@@ -25,6 +25,6 @@ Pod::Spec.new do |spec|
25
25
  ]
26
26
 
27
27
  spec.dependency "React-Core"
28
- spec.dependency "PurchasesHybridCommon", '14.2.0'
28
+ spec.dependency "PurchasesHybridCommon", '15.0.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 '8.11.10'
32
+ versionName '9.0.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:14.2.0'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:15.0.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 = "8.11.10";
50
+ public static final String PLUGIN_VERSION = "9.0.0";
51
51
 
52
52
  private final ReactApplicationContext reactContext;
53
53
 
@@ -1,81 +1,81 @@
1
- import { CustomerInfo, INTRO_ELIGIBILITY_STATUS, MakePurchaseResult, PurchasesStoreTransaction, WebPurchaseRedemptionResultType, PurchasesStoreProduct, PurchasesOffering, PurchasesOfferings } from '@revenuecat/purchases-typescript-internal';
1
+ import { CustomerInfo, MakePurchaseResult, PurchasesStoreTransaction, WebPurchaseRedemptionResultType, PurchasesStoreProduct, PurchasesOffering, PurchasesOfferings } from '@revenuecat/purchases-typescript-internal';
2
2
  /**
3
3
  * Preview implementation of the native module for Preview API mode, i.e. for environments where native modules are not available
4
4
  * (like Expo Go).
5
5
  */
6
6
  export declare const previewNativeModuleRNPurchases: {
7
- setupPurchases: () => Promise<null>;
8
- setAllowSharingStoreAccount: () => Promise<null>;
9
- setSimulatesAskToBuyInSandbox: () => Promise<null>;
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<null>;
8
+ setAllowSharingStoreAccount: (_allowSharing: boolean) => Promise<void>;
9
+ setSimulatesAskToBuyInSandbox: (_simulatesAskToBuyInSandbox: boolean) => Promise<void>;
10
10
  getOfferings: () => Promise<PurchasesOfferings>;
11
- getCurrentOfferingForPlacement: () => Promise<PurchasesOffering>;
11
+ getCurrentOfferingForPlacement: (_placementIdentifier: string) => Promise<PurchasesOffering>;
12
12
  syncAttributesAndOfferingsIfNeeded: () => Promise<PurchasesOfferings>;
13
- getProductInfo: () => Promise<PurchasesStoreProduct[]>;
13
+ getProductInfo: (_productIdentifiers: string[], _type: string) => Promise<PurchasesStoreProduct[]>;
14
14
  restorePurchases: () => Promise<CustomerInfo>;
15
15
  getAppUserID: () => Promise<string>;
16
16
  getStorefront: () => Promise<string>;
17
- setDebugLogsEnabled: () => Promise<null>;
18
- setLogLevel: () => Promise<null>;
17
+ setDebugLogsEnabled: (_enabled: boolean) => Promise<void>;
18
+ setLogLevel: (_level: string) => Promise<void>;
19
19
  setLogHandler: () => Promise<null>;
20
20
  getCustomerInfo: () => Promise<CustomerInfo>;
21
- logIn: () => Promise<{
21
+ logIn: (_appUserID: string) => Promise<{
22
22
  customerInfo: CustomerInfo;
23
23
  created: boolean;
24
24
  }>;
25
25
  logOut: () => Promise<CustomerInfo>;
26
26
  syncPurchases: () => Promise<void>;
27
- syncAmazonPurchase: () => Promise<void>;
28
- syncObserverModeAmazonPurchase: () => Promise<void>;
29
- recordPurchaseForProductID: () => Promise<PurchasesStoreTransaction>;
27
+ syncAmazonPurchase: (_productID: string, _receiptID: string, _amazonUserID: string, _isoCurrencyCode: string | null, _price: number | null) => Promise<void>;
28
+ syncObserverModeAmazonPurchase: (_productID: string, _receiptID: string, _amazonUserID: string, _isoCurrencyCode: string | null, _price: number | null) => Promise<void>;
29
+ recordPurchaseForProductID: (_productID: string) => Promise<PurchasesStoreTransaction>;
30
30
  enableAdServicesAttributionTokenCollection: () => Promise<void>;
31
- purchaseProduct: () => Promise<MakePurchaseResult>;
32
- purchasePackage: () => Promise<MakePurchaseResult>;
33
- purchaseSubscriptionOption: () => Promise<void>;
31
+ purchaseProduct: (_productIdentifier: string, _googleProductChangeInfo: any, _type: string, _discountTimestamp: string | null, _googleInfo: any, _presentedOfferingContext: any) => Promise<MakePurchaseResult>;
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<MakePurchaseResult>;
34
34
  isAnonymous: () => Promise<boolean>;
35
- makeDeferredPurchase: () => Promise<null>;
36
- checkTrialOrIntroductoryPriceEligibility: () => Promise<{
37
- 'preview-product-id': INTRO_ELIGIBILITY_STATUS;
35
+ makeDeferredPurchase: (_callbackID: number) => Promise<void>;
36
+ checkTrialOrIntroductoryPriceEligibility: (productIDs: string[]) => Promise<{
37
+ [productId: string]: any;
38
38
  }>;
39
- getPromotionalOffer: () => Promise<undefined>;
40
- eligibleWinBackOffersForProductIdentifier: () => Promise<never[]>;
41
- purchaseProductWithWinBackOffer: () => Promise<MakePurchaseResult>;
42
- purchasePackageWithWinBackOffer: () => Promise<MakePurchaseResult>;
39
+ getPromotionalOffer: (_productIdentifier: string, _discount: any) => Promise<undefined>;
40
+ eligibleWinBackOffersForProductIdentifier: (_productID: string) => Promise<never[]>;
41
+ purchaseProductWithWinBackOffer: (_productID: string, _winBackOfferID: string) => Promise<MakePurchaseResult>;
42
+ purchasePackageWithWinBackOffer: (_packageID: string, _winBackOfferID: string) => Promise<MakePurchaseResult>;
43
43
  invalidateCustomerInfoCache: () => Promise<void>;
44
44
  presentCodeRedemptionSheet: () => Promise<void>;
45
- setAttributes: () => Promise<void>;
46
- setEmail: () => Promise<void>;
47
- setPhoneNumber: () => Promise<void>;
48
- setDisplayName: () => Promise<void>;
49
- setPushToken: () => Promise<void>;
50
- setProxyURLString: () => Promise<void>;
45
+ setAttributes: (_attributes: any) => Promise<void>;
46
+ setEmail: (_email: string) => Promise<void>;
47
+ setPhoneNumber: (_phoneNumber: string) => Promise<void>;
48
+ setDisplayName: (_displayName: string) => Promise<void>;
49
+ setPushToken: (_pushToken: string) => Promise<void>;
50
+ setProxyURLString: (_proxyURLString: string) => Promise<void>;
51
51
  collectDeviceIdentifiers: () => Promise<void>;
52
- setAdjustID: () => Promise<void>;
53
- setAppsflyerID: () => Promise<void>;
54
- setFBAnonymousID: () => Promise<void>;
55
- setMparticleID: () => Promise<void>;
56
- setCleverTapID: () => Promise<void>;
57
- setMixpanelDistinctID: () => Promise<void>;
58
- setFirebaseAppInstanceID: () => Promise<void>;
59
- setTenjinAnalyticsInstallationID: () => Promise<void>;
60
- setKochavaDeviceID: () => Promise<void>;
61
- setOnesignalID: () => Promise<void>;
62
- setAirshipChannelID: () => Promise<void>;
63
- setMediaSource: () => Promise<void>;
52
+ setAdjustID: (_adjustID: string) => Promise<void>;
53
+ setAppsflyerID: (_appsflyerID: string) => Promise<void>;
54
+ setFBAnonymousID: (_fbAnonymousID: string) => Promise<void>;
55
+ setMparticleID: (_mparticleID: string) => Promise<void>;
56
+ setCleverTapID: (_cleverTapID: string) => Promise<void>;
57
+ setMixpanelDistinctID: (_mixpanelDistinctID: string) => Promise<void>;
58
+ setFirebaseAppInstanceID: (_firebaseAppInstanceID: string) => Promise<void>;
59
+ setTenjinAnalyticsInstallationID: (_tenjinAnalyticsInstallationID: string) => Promise<void>;
60
+ setKochavaDeviceID: (_kochavaDeviceID: string) => Promise<void>;
61
+ setOnesignalID: (_onesignalID: string) => Promise<void>;
62
+ setAirshipChannelID: (_airshipChannelID: string) => Promise<void>;
63
+ setMediaSource: (_mediaSource: string) => Promise<void>;
64
64
  setMediaCampaign: () => Promise<void>;
65
- setCampaign: () => Promise<void>;
66
- setAdGroup: () => Promise<void>;
67
- setAd: () => Promise<void>;
68
- setKeyword: () => Promise<void>;
69
- setCreative: () => Promise<void>;
70
- canMakePayments: () => Promise<boolean>;
65
+ setCampaign: (_campaign: string) => Promise<void>;
66
+ setAdGroup: (_adGroup: string) => Promise<void>;
67
+ setAd: (_ad: string) => Promise<void>;
68
+ setKeyword: (_keyword: string) => Promise<void>;
69
+ setCreative: (_creative: string) => Promise<void>;
70
+ canMakePayments: (_features: any[]) => Promise<boolean>;
71
71
  beginRefundRequestForActiveEntitlement: () => Promise<number>;
72
- beginRefundRequestForEntitlementId: () => Promise<number>;
73
- beginRefundRequestForProductId: () => Promise<number>;
72
+ beginRefundRequestForEntitlementId: (_entitlementIdentifier: string) => Promise<number>;
73
+ beginRefundRequestForProductId: (_productIdentifier: string) => Promise<number>;
74
74
  showManageSubscriptions: () => Promise<void>;
75
- showInAppMessages: () => Promise<void>;
76
- isWebPurchaseRedemptionURL: () => Promise<null>;
75
+ showInAppMessages: (_messageTypes: any[]) => Promise<void>;
76
+ isWebPurchaseRedemptionURL: (_urlString: string) => Promise<boolean>;
77
77
  isConfigured: () => Promise<boolean>;
78
- redeemWebPurchase: () => Promise<{
78
+ redeemWebPurchase: (_urlString: string) => Promise<{
79
79
  result: WebPurchaseRedemptionResultType;
80
80
  customerInfo: CustomerInfo;
81
81
  }>;
@@ -130,19 +130,20 @@ var previewOfferings = {
130
130
  * (like Expo Go).
131
131
  */
132
132
  exports.previewNativeModuleRNPurchases = {
133
- setupPurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
133
+ setupPurchases: function (apiKey, _appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled) { return __awaiter(void 0, void 0, void 0, function () {
134
134
  return __generator(this, function (_a) {
135
+ console.log('[RevenueCat] Preview mode: setupPurchases called with apiKey:', apiKey);
135
136
  return [2 /*return*/, null];
136
137
  });
137
138
  }); },
138
- setAllowSharingStoreAccount: function () { return __awaiter(void 0, void 0, void 0, function () {
139
+ setAllowSharingStoreAccount: function (_allowSharing) { return __awaiter(void 0, void 0, void 0, function () {
139
140
  return __generator(this, function (_a) {
140
- return [2 /*return*/, null];
141
+ return [2 /*return*/];
141
142
  });
142
143
  }); },
143
- setSimulatesAskToBuyInSandbox: function () { return __awaiter(void 0, void 0, void 0, function () {
144
+ setSimulatesAskToBuyInSandbox: function (_simulatesAskToBuyInSandbox) { return __awaiter(void 0, void 0, void 0, function () {
144
145
  return __generator(this, function (_a) {
145
- return [2 /*return*/, null];
146
+ return [2 /*return*/];
146
147
  });
147
148
  }); },
148
149
  getOfferings: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -150,7 +151,7 @@ exports.previewNativeModuleRNPurchases = {
150
151
  return [2 /*return*/, previewOfferings];
151
152
  });
152
153
  }); },
153
- getCurrentOfferingForPlacement: function () { return __awaiter(void 0, void 0, void 0, function () {
154
+ getCurrentOfferingForPlacement: function (_placementIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
154
155
  return __generator(this, function (_a) {
155
156
  return [2 /*return*/, previewOffering];
156
157
  });
@@ -160,8 +161,9 @@ exports.previewNativeModuleRNPurchases = {
160
161
  return [2 /*return*/, previewOfferings];
161
162
  });
162
163
  }); },
163
- getProductInfo: function () { return __awaiter(void 0, void 0, void 0, function () {
164
+ getProductInfo: function (_productIdentifiers, _type) { return __awaiter(void 0, void 0, void 0, function () {
164
165
  return __generator(this, function (_a) {
166
+ // In preview mode, return the preview product for any requested product identifiers
165
167
  return [2 /*return*/, [previewStoreProduct]];
166
168
  });
167
169
  }); },
@@ -180,14 +182,14 @@ exports.previewNativeModuleRNPurchases = {
180
182
  return [2 /*return*/, 'preview-storefront'];
181
183
  });
182
184
  }); },
183
- setDebugLogsEnabled: function () { return __awaiter(void 0, void 0, void 0, function () {
185
+ setDebugLogsEnabled: function (_enabled) { return __awaiter(void 0, void 0, void 0, function () {
184
186
  return __generator(this, function (_a) {
185
- return [2 /*return*/, null];
187
+ return [2 /*return*/];
186
188
  });
187
189
  }); },
188
- setLogLevel: function () { return __awaiter(void 0, void 0, void 0, function () {
190
+ setLogLevel: function (_level) { return __awaiter(void 0, void 0, void 0, function () {
189
191
  return __generator(this, function (_a) {
190
- return [2 /*return*/, null];
192
+ return [2 /*return*/];
191
193
  });
192
194
  }); },
193
195
  setLogHandler: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -200,7 +202,7 @@ exports.previewNativeModuleRNPurchases = {
200
202
  return [2 /*return*/, previewCustomerInfo];
201
203
  });
202
204
  }); },
203
- logIn: function () { return __awaiter(void 0, void 0, void 0, function () {
205
+ logIn: function (_appUserID) { return __awaiter(void 0, void 0, void 0, function () {
204
206
  return __generator(this, function (_a) {
205
207
  return [2 /*return*/, {
206
208
  customerInfo: previewCustomerInfo,
@@ -218,17 +220,17 @@ exports.previewNativeModuleRNPurchases = {
218
220
  return [2 /*return*/];
219
221
  });
220
222
  }); },
221
- syncAmazonPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
223
+ syncAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
222
224
  return __generator(this, function (_a) {
223
225
  return [2 /*return*/];
224
226
  });
225
227
  }); },
226
- syncObserverModeAmazonPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
228
+ syncObserverModeAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
227
229
  return __generator(this, function (_a) {
228
230
  return [2 /*return*/];
229
231
  });
230
232
  }); },
231
- recordPurchaseForProductID: function () { return __awaiter(void 0, void 0, void 0, function () {
233
+ recordPurchaseForProductID: function (_productID) { return __awaiter(void 0, void 0, void 0, function () {
232
234
  return __generator(this, function (_a) {
233
235
  return [2 /*return*/, previewPurchaseStoreTransaction];
234
236
  });
@@ -238,19 +240,22 @@ exports.previewNativeModuleRNPurchases = {
238
240
  return [2 /*return*/];
239
241
  });
240
242
  }); },
241
- purchaseProduct: function () { return __awaiter(void 0, void 0, void 0, function () {
243
+ purchaseProduct: function (_productIdentifier, _googleProductChangeInfo, _type, _discountTimestamp, _googleInfo, _presentedOfferingContext) { return __awaiter(void 0, void 0, void 0, function () {
242
244
  return __generator(this, function (_a) {
245
+ // In preview mode, return a successful purchase result
243
246
  return [2 /*return*/, previewMakePurchaseResult];
244
247
  });
245
248
  }); },
246
- purchasePackage: function () { return __awaiter(void 0, void 0, void 0, function () {
249
+ purchasePackage: function (_packageIdentifier, _presentedOfferingContext, _googleProductChangeInfo, _discountTimestamp, _googleInfo) { return __awaiter(void 0, void 0, void 0, function () {
247
250
  return __generator(this, function (_a) {
251
+ // In preview mode, return a successful purchase result
248
252
  return [2 /*return*/, previewMakePurchaseResult];
249
253
  });
250
254
  }); },
251
- purchaseSubscriptionOption: function () { return __awaiter(void 0, void 0, void 0, function () {
255
+ purchaseSubscriptionOption: function (_productIdentifier, _optionIdentifier, _upgradeInfo, _discountTimestamp, _googleInfo, _presentedOfferingContext) { return __awaiter(void 0, void 0, void 0, function () {
252
256
  return __generator(this, function (_a) {
253
- return [2 /*return*/];
257
+ // In preview mode, return a successful purchase result
258
+ return [2 /*return*/, previewMakePurchaseResult];
254
259
  });
255
260
  }); },
256
261
  isAnonymous: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -258,34 +263,37 @@ exports.previewNativeModuleRNPurchases = {
258
263
  return [2 /*return*/, true];
259
264
  });
260
265
  }); },
261
- makeDeferredPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
266
+ makeDeferredPurchase: function (_callbackID) { return __awaiter(void 0, void 0, void 0, function () {
262
267
  return __generator(this, function (_a) {
263
- return [2 /*return*/, null];
268
+ return [2 /*return*/];
264
269
  });
265
270
  }); },
266
- checkTrialOrIntroductoryPriceEligibility: function () { return __awaiter(void 0, void 0, void 0, function () {
271
+ checkTrialOrIntroductoryPriceEligibility: function (productIDs) { return __awaiter(void 0, void 0, void 0, function () {
272
+ var result;
267
273
  return __generator(this, function (_a) {
268
- return [2 /*return*/, ({
269
- 'preview-product-id': purchases_typescript_internal_1.INTRO_ELIGIBILITY_STATUS.INTRO_ELIGIBILITY_STATUS_ELIGIBLE
270
- })];
274
+ result = {};
275
+ productIDs.forEach(function (productId) {
276
+ result[productId] = purchases_typescript_internal_1.INTRO_ELIGIBILITY_STATUS.INTRO_ELIGIBILITY_STATUS_ELIGIBLE;
277
+ });
278
+ return [2 /*return*/, result];
271
279
  });
272
280
  }); },
273
- getPromotionalOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
281
+ getPromotionalOffer: function (_productIdentifier, _discount) { return __awaiter(void 0, void 0, void 0, function () {
274
282
  return __generator(this, function (_a) {
275
283
  return [2 /*return*/, undefined];
276
284
  });
277
285
  }); },
278
- eligibleWinBackOffersForProductIdentifier: function () { return __awaiter(void 0, void 0, void 0, function () {
286
+ eligibleWinBackOffersForProductIdentifier: function (_productID) { return __awaiter(void 0, void 0, void 0, function () {
279
287
  return __generator(this, function (_a) {
280
288
  return [2 /*return*/, []];
281
289
  });
282
290
  }); },
283
- purchaseProductWithWinBackOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
291
+ purchaseProductWithWinBackOffer: function (_productID, _winBackOfferID) { return __awaiter(void 0, void 0, void 0, function () {
284
292
  return __generator(this, function (_a) {
285
293
  return [2 /*return*/, previewMakePurchaseResult];
286
294
  });
287
295
  }); },
288
- purchasePackageWithWinBackOffer: function () { return __awaiter(void 0, void 0, void 0, function () {
296
+ purchasePackageWithWinBackOffer: function (_packageID, _winBackOfferID) { return __awaiter(void 0, void 0, void 0, function () {
289
297
  return __generator(this, function (_a) {
290
298
  return [2 /*return*/, previewMakePurchaseResult];
291
299
  });
@@ -300,32 +308,32 @@ exports.previewNativeModuleRNPurchases = {
300
308
  return [2 /*return*/];
301
309
  });
302
310
  }); },
303
- setAttributes: function () { return __awaiter(void 0, void 0, void 0, function () {
311
+ setAttributes: function (_attributes) { return __awaiter(void 0, void 0, void 0, function () {
304
312
  return __generator(this, function (_a) {
305
313
  return [2 /*return*/];
306
314
  });
307
315
  }); },
308
- setEmail: function () { return __awaiter(void 0, void 0, void 0, function () {
316
+ setEmail: function (_email) { return __awaiter(void 0, void 0, void 0, function () {
309
317
  return __generator(this, function (_a) {
310
318
  return [2 /*return*/];
311
319
  });
312
320
  }); },
313
- setPhoneNumber: function () { return __awaiter(void 0, void 0, void 0, function () {
321
+ setPhoneNumber: function (_phoneNumber) { return __awaiter(void 0, void 0, void 0, function () {
314
322
  return __generator(this, function (_a) {
315
323
  return [2 /*return*/];
316
324
  });
317
325
  }); },
318
- setDisplayName: function () { return __awaiter(void 0, void 0, void 0, function () {
326
+ setDisplayName: function (_displayName) { return __awaiter(void 0, void 0, void 0, function () {
319
327
  return __generator(this, function (_a) {
320
328
  return [2 /*return*/];
321
329
  });
322
330
  }); },
323
- setPushToken: function () { return __awaiter(void 0, void 0, void 0, function () {
331
+ setPushToken: function (_pushToken) { return __awaiter(void 0, void 0, void 0, function () {
324
332
  return __generator(this, function (_a) {
325
333
  return [2 /*return*/];
326
334
  });
327
335
  }); },
328
- setProxyURLString: function () { return __awaiter(void 0, void 0, void 0, function () {
336
+ setProxyURLString: function (_proxyURLString) { return __awaiter(void 0, void 0, void 0, function () {
329
337
  return __generator(this, function (_a) {
330
338
  return [2 /*return*/];
331
339
  });
@@ -335,62 +343,62 @@ exports.previewNativeModuleRNPurchases = {
335
343
  return [2 /*return*/];
336
344
  });
337
345
  }); },
338
- setAdjustID: function () { return __awaiter(void 0, void 0, void 0, function () {
346
+ setAdjustID: function (_adjustID) { return __awaiter(void 0, void 0, void 0, function () {
339
347
  return __generator(this, function (_a) {
340
348
  return [2 /*return*/];
341
349
  });
342
350
  }); },
343
- setAppsflyerID: function () { return __awaiter(void 0, void 0, void 0, function () {
351
+ setAppsflyerID: function (_appsflyerID) { return __awaiter(void 0, void 0, void 0, function () {
344
352
  return __generator(this, function (_a) {
345
353
  return [2 /*return*/];
346
354
  });
347
355
  }); },
348
- setFBAnonymousID: function () { return __awaiter(void 0, void 0, void 0, function () {
356
+ setFBAnonymousID: function (_fbAnonymousID) { return __awaiter(void 0, void 0, void 0, function () {
349
357
  return __generator(this, function (_a) {
350
358
  return [2 /*return*/];
351
359
  });
352
360
  }); },
353
- setMparticleID: function () { return __awaiter(void 0, void 0, void 0, function () {
361
+ setMparticleID: function (_mparticleID) { return __awaiter(void 0, void 0, void 0, function () {
354
362
  return __generator(this, function (_a) {
355
363
  return [2 /*return*/];
356
364
  });
357
365
  }); },
358
- setCleverTapID: function () { return __awaiter(void 0, void 0, void 0, function () {
366
+ setCleverTapID: function (_cleverTapID) { return __awaiter(void 0, void 0, void 0, function () {
359
367
  return __generator(this, function (_a) {
360
368
  return [2 /*return*/];
361
369
  });
362
370
  }); },
363
- setMixpanelDistinctID: function () { return __awaiter(void 0, void 0, void 0, function () {
371
+ setMixpanelDistinctID: function (_mixpanelDistinctID) { return __awaiter(void 0, void 0, void 0, function () {
364
372
  return __generator(this, function (_a) {
365
373
  return [2 /*return*/];
366
374
  });
367
375
  }); },
368
- setFirebaseAppInstanceID: function () { return __awaiter(void 0, void 0, void 0, function () {
376
+ setFirebaseAppInstanceID: function (_firebaseAppInstanceID) { return __awaiter(void 0, void 0, void 0, function () {
369
377
  return __generator(this, function (_a) {
370
378
  return [2 /*return*/];
371
379
  });
372
380
  }); },
373
- setTenjinAnalyticsInstallationID: function () { return __awaiter(void 0, void 0, void 0, function () {
381
+ setTenjinAnalyticsInstallationID: function (_tenjinAnalyticsInstallationID) { return __awaiter(void 0, void 0, void 0, function () {
374
382
  return __generator(this, function (_a) {
375
383
  return [2 /*return*/];
376
384
  });
377
385
  }); },
378
- setKochavaDeviceID: function () { return __awaiter(void 0, void 0, void 0, function () {
386
+ setKochavaDeviceID: function (_kochavaDeviceID) { return __awaiter(void 0, void 0, void 0, function () {
379
387
  return __generator(this, function (_a) {
380
388
  return [2 /*return*/];
381
389
  });
382
390
  }); },
383
- setOnesignalID: function () { return __awaiter(void 0, void 0, void 0, function () {
391
+ setOnesignalID: function (_onesignalID) { return __awaiter(void 0, void 0, void 0, function () {
384
392
  return __generator(this, function (_a) {
385
393
  return [2 /*return*/];
386
394
  });
387
395
  }); },
388
- setAirshipChannelID: function () { return __awaiter(void 0, void 0, void 0, function () {
396
+ setAirshipChannelID: function (_airshipChannelID) { return __awaiter(void 0, void 0, void 0, function () {
389
397
  return __generator(this, function (_a) {
390
398
  return [2 /*return*/];
391
399
  });
392
400
  }); },
393
- setMediaSource: function () { return __awaiter(void 0, void 0, void 0, function () {
401
+ setMediaSource: function (_mediaSource) { return __awaiter(void 0, void 0, void 0, function () {
394
402
  return __generator(this, function (_a) {
395
403
  return [2 /*return*/];
396
404
  });
@@ -400,33 +408,34 @@ exports.previewNativeModuleRNPurchases = {
400
408
  return [2 /*return*/];
401
409
  });
402
410
  }); },
403
- setCampaign: function () { return __awaiter(void 0, void 0, void 0, function () {
411
+ setCampaign: function (_campaign) { return __awaiter(void 0, void 0, void 0, function () {
404
412
  return __generator(this, function (_a) {
405
413
  return [2 /*return*/];
406
414
  });
407
415
  }); },
408
- setAdGroup: function () { return __awaiter(void 0, void 0, void 0, function () {
416
+ setAdGroup: function (_adGroup) { return __awaiter(void 0, void 0, void 0, function () {
409
417
  return __generator(this, function (_a) {
410
418
  return [2 /*return*/];
411
419
  });
412
420
  }); },
413
- setAd: function () { return __awaiter(void 0, void 0, void 0, function () {
421
+ setAd: function (_ad) { return __awaiter(void 0, void 0, void 0, function () {
414
422
  return __generator(this, function (_a) {
415
423
  return [2 /*return*/];
416
424
  });
417
425
  }); },
418
- setKeyword: function () { return __awaiter(void 0, void 0, void 0, function () {
426
+ setKeyword: function (_keyword) { return __awaiter(void 0, void 0, void 0, function () {
419
427
  return __generator(this, function (_a) {
420
428
  return [2 /*return*/];
421
429
  });
422
430
  }); },
423
- setCreative: function () { return __awaiter(void 0, void 0, void 0, function () {
431
+ setCreative: function (_creative) { return __awaiter(void 0, void 0, void 0, function () {
424
432
  return __generator(this, function (_a) {
425
433
  return [2 /*return*/];
426
434
  });
427
435
  }); },
428
- canMakePayments: function () { return __awaiter(void 0, void 0, void 0, function () {
436
+ canMakePayments: function (_features) { return __awaiter(void 0, void 0, void 0, function () {
429
437
  return __generator(this, function (_a) {
438
+ // In preview mode, return false (no payments can be made)
430
439
  return [2 /*return*/, false];
431
440
  });
432
441
  }); },
@@ -435,12 +444,12 @@ exports.previewNativeModuleRNPurchases = {
435
444
  return [2 /*return*/, 0];
436
445
  });
437
446
  }); },
438
- beginRefundRequestForEntitlementId: function () { return __awaiter(void 0, void 0, void 0, function () {
447
+ beginRefundRequestForEntitlementId: function (_entitlementIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
439
448
  return __generator(this, function (_a) {
440
449
  return [2 /*return*/, 0];
441
450
  });
442
451
  }); },
443
- beginRefundRequestForProductId: function () { return __awaiter(void 0, void 0, void 0, function () {
452
+ beginRefundRequestForProductId: function (_productIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
444
453
  return __generator(this, function (_a) {
445
454
  return [2 /*return*/, 0];
446
455
  });
@@ -450,14 +459,15 @@ exports.previewNativeModuleRNPurchases = {
450
459
  return [2 /*return*/];
451
460
  });
452
461
  }); },
453
- showInAppMessages: function () { return __awaiter(void 0, void 0, void 0, function () {
462
+ showInAppMessages: function (_messageTypes) { return __awaiter(void 0, void 0, void 0, function () {
454
463
  return __generator(this, function (_a) {
455
464
  return [2 /*return*/];
456
465
  });
457
466
  }); },
458
- isWebPurchaseRedemptionURL: function () { return __awaiter(void 0, void 0, void 0, function () {
467
+ isWebPurchaseRedemptionURL: function (_urlString) { return __awaiter(void 0, void 0, void 0, function () {
459
468
  return __generator(this, function (_a) {
460
- return [2 /*return*/, null];
469
+ // In preview mode, we'll return false for any URL
470
+ return [2 /*return*/, false];
461
471
  });
462
472
  }); },
463
473
  isConfigured: function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -465,7 +475,7 @@ exports.previewNativeModuleRNPurchases = {
465
475
  return [2 /*return*/, true];
466
476
  });
467
477
  }); },
468
- redeemWebPurchase: function () { return __awaiter(void 0, void 0, void 0, function () {
478
+ redeemWebPurchase: function (_urlString) { return __awaiter(void 0, void 0, void 0, function () {
469
479
  return __generator(this, function (_a) {
470
480
  return [2 /*return*/, {
471
481
  result: purchases_typescript_internal_1.WebPurchaseRedemptionResultType.SUCCESS,
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Detects if the app is running in an environment where native modules are not available
3
- * (like Expo Go) or if the required native modules are missing.
3
+ * (like Expo Go or Web) or if the required native modules are missing.
4
4
  *
5
5
  * @returns {boolean} True if the app is running in an environment where native modules are not available
6
- * (like Expo Go) or if the required native modules are missing.
6
+ * (like Expo Go or Web) or if the required native modules are missing.
7
7
  */
8
8
  export declare function shouldUsePreviewAPIMode(): boolean;
9
9
  declare global {
@@ -4,17 +4,23 @@ exports.shouldUsePreviewAPIMode = void 0;
4
4
  var react_native_1 = require("react-native");
5
5
  /**
6
6
  * Detects if the app is running in an environment where native modules are not available
7
- * (like Expo Go) or if the required native modules are missing.
7
+ * (like Expo Go or Web) or if the required native modules are missing.
8
8
  *
9
9
  * @returns {boolean} True if the app is running in an environment where native modules are not available
10
- * (like Expo Go) or if the required native modules are missing.
10
+ * (like Expo Go or Web) or if the required native modules are missing.
11
11
  */
12
12
  function shouldUsePreviewAPIMode() {
13
- var usePreviewAPIMode = isExpoGo();
14
- if (usePreviewAPIMode) {
13
+ if (isExpoGo()) {
15
14
  console.log('Expo Go app detected. Using RevenueCat in Preview API Mode.');
15
+ return true;
16
+ }
17
+ else if (isWebPlatform()) {
18
+ console.log('Web platform detected. Using RevenueCat in Preview API Mode.');
19
+ return true;
20
+ }
21
+ else {
22
+ return false;
16
23
  }
17
- return usePreviewAPIMode;
18
24
  }
19
25
  exports.shouldUsePreviewAPIMode = shouldUsePreviewAPIMode;
20
26
  /**
@@ -27,3 +33,9 @@ function isExpoGo() {
27
33
  }
28
34
  return !!((_b = (_a = globalThis.expo) === null || _a === void 0 ? void 0 : _a.modules) === null || _b === void 0 ? void 0 : _b.ExpoGo);
29
35
  }
36
+ /**
37
+ * Detects if the app is running on web platform
38
+ */
39
+ function isWebPlatform() {
40
+ return react_native_1.Platform.OS === 'web';
41
+ }
package/ios/RNPurchases.m CHANGED
@@ -639,7 +639,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
639
639
  }
640
640
 
641
641
  - (NSString *)platformFlavorVersion {
642
- return @"8.11.10";
642
+ return @"9.0.0";
643
643
  }
644
644
 
645
645
  @end
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "react-native-purchases",
3
3
  "title": "React Native Purchases",
4
- "version": "8.11.10",
4
+ "version": "9.0.0",
5
5
  "description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
6
6
  "main": "dist/index.js",
7
+ "module": "dist/index.js",
7
8
  "types": "dist/index.d.ts",
8
9
  "source": "src/index",
10
+ "browser": "dist/index.js",
11
+ "react-native": "dist/index.js",
9
12
  "files": [
10
13
  "dist",
11
14
  "android",
@@ -38,7 +41,8 @@
38
41
  "prepare": "tsc",
39
42
  "example": "yarn workspace purchasetester",
40
43
  "ui": "yarn workspace react-native-purchases-ui",
41
- "bootstrap": "yarn && yarn example pods"
44
+ "bootstrap": "yarn && yarn prepare-expo && yarn example pods",
45
+ "prepare-expo": "yarn build && yarn ui prepare && yarn pack && yarn ui pack && touch examples/purchaseTesterExpo/yarn.lock"
42
46
  },
43
47
  "workspaces": [
44
48
  "examples/purchaseTesterTypescript",
@@ -64,12 +68,19 @@
64
68
  "readmeFilename": "README.md",
65
69
  "peerDependencies": {
66
70
  "react": ">= 16.6.3",
67
- "react-native": "*"
71
+ "react-native": ">= 0.73.0",
72
+ "react-native-web": "*"
73
+ },
74
+ "peerDependenciesMeta": {
75
+ "react-native-web": {
76
+ "optional": true
77
+ }
68
78
  },
69
79
  "devDependencies": {
70
80
  "@types/jest": "^29.5.12",
71
81
  "@types/react": "^18.2.44",
72
82
  "@types/react-dom": "~18.2.0",
83
+ "babel-plugin-react-native-web": "^0.20.0",
73
84
  "jest": "^29.7.0",
74
85
  "jest-react-native": "^18.0.0",
75
86
  "pod-install": "^0.1.0",
@@ -83,7 +94,7 @@
83
94
  "typescript": "^5.2.2"
84
95
  },
85
96
  "resolutions": {
86
- "@types/react": "^18.2.44",
97
+ "@types/react": "18.2.44",
87
98
  "@types/react-native": "0.73.5",
88
99
  "@types/react-dom": "18.2.0"
89
100
  },
@@ -100,6 +111,6 @@
100
111
  ]
101
112
  },
102
113
  "dependencies": {
103
- "@revenuecat/purchases-typescript-internal": "14.2.0"
114
+ "@revenuecat/purchases-typescript-internal": "15.0.0"
104
115
  }
105
116
  }