react-native-purchases 9.1.0 → 9.2.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.
@@ -36,238 +36,244 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.previewNativeModuleRNPurchases = void 0;
39
+ exports.browserNativeModuleRNPurchases = void 0;
40
+ require("react-native-get-random-values"); // needed to generate random Ids in purchases-js in RN apps.
40
41
  var purchases_typescript_internal_1 = require("@revenuecat/purchases-typescript-internal");
41
- var previewCustomerInfo = {
42
- activeSubscriptions: [],
43
- allExpirationDates: {},
44
- allPurchaseDates: {},
45
- allPurchasedProductIdentifiers: [],
46
- entitlements: {
47
- active: {},
48
- all: {},
49
- verification: purchases_typescript_internal_1.VERIFICATION_RESULT.NOT_REQUESTED
50
- },
51
- firstSeen: new Date().toISOString(),
52
- latestExpirationDate: null,
53
- originalAppUserId: 'preview-user-id',
54
- originalApplicationVersion: null,
55
- requestDate: new Date().toISOString(),
56
- managementURL: null,
57
- originalPurchaseDate: new Date().toISOString(),
58
- nonSubscriptionTransactions: [],
59
- subscriptionsByProductIdentifier: {}
60
- };
61
- var previewPurchaseStoreTransaction = {
62
- transactionIdentifier: 'preview-transaction-id',
63
- productIdentifier: 'preview-product-id',
64
- purchaseDate: new Date().toISOString()
65
- };
66
- var previewMakePurchaseResult = {
67
- productIdentifier: 'preview-product-id',
68
- customerInfo: previewCustomerInfo,
69
- transaction: previewPurchaseStoreTransaction
70
- };
71
- var previewStoreProduct = {
72
- identifier: 'preview-product-id',
73
- description: 'Preview product description',
74
- title: 'Preview Product',
75
- price: 9.99,
76
- priceString: '$9.99',
77
- pricePerWeek: 2.50,
78
- pricePerMonth: 9.99,
79
- pricePerYear: 99.99,
80
- pricePerWeekString: '$2.50',
81
- pricePerMonthString: '$9.99',
82
- pricePerYearString: '$99.99',
83
- currencyCode: 'USD',
84
- introPrice: null,
85
- discounts: null,
86
- subscriptionPeriod: 'P1M',
87
- productCategory: purchases_typescript_internal_1.PRODUCT_CATEGORY.SUBSCRIPTION,
88
- productType: purchases_typescript_internal_1.PRODUCT_TYPE.AUTO_RENEWABLE_SUBSCRIPTION,
89
- defaultOption: null,
90
- subscriptionOptions: null,
91
- presentedOfferingIdentifier: 'preview-offering',
92
- presentedOfferingContext: {
93
- offeringIdentifier: 'preview-offering',
94
- placementIdentifier: 'preview-placement',
95
- targetingContext: null
96
- }
97
- };
98
- var previewPackage = {
99
- identifier: 'preview-package-id',
100
- packageType: purchases_typescript_internal_1.PACKAGE_TYPE.MONTHLY,
101
- product: previewStoreProduct,
102
- offeringIdentifier: 'preview-offering',
103
- presentedOfferingContext: {
104
- offeringIdentifier: 'preview-offering',
105
- placementIdentifier: 'preview-placement',
106
- targetingContext: null
107
- }
108
- };
109
- var previewOffering = {
110
- identifier: 'preview-offering',
111
- serverDescription: 'Preview offering for testing',
112
- metadata: {},
113
- availablePackages: [previewPackage],
114
- lifetime: null,
115
- annual: null,
116
- sixMonth: null,
117
- threeMonth: null,
118
- twoMonth: null,
119
- monthly: previewPackage,
120
- weekly: null
121
- };
122
- var previewOfferings = {
123
- all: {
124
- 'preview-offering': previewOffering
125
- },
126
- current: previewOffering
127
- };
128
- var previewVirtualCurrencies = {
129
- all: {}
130
- };
42
+ var purchases_js_hybrid_mappings_1 = require("@revenuecat/purchases-js-hybrid-mappings");
43
+ var utils_1 = require("./utils");
44
+ var typeGuards_1 = require("./typeGuards");
45
+ var environment_1 = require("../utils/environment");
46
+ var packageVersion = '9.1.0';
131
47
  /**
132
- * Preview implementation of the native module for Preview API mode, i.e. for environments where native modules are not available
133
- * (like Expo Go).
48
+ * Browser implementation of the native module. This will be used in the browser and Expo Go.
134
49
  */
135
- exports.previewNativeModuleRNPurchases = {
136
- setupPurchases: function (apiKey, _appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled) { return __awaiter(void 0, void 0, void 0, function () {
137
- return __generator(this, function (_a) {
138
- console.log('[RevenueCat] Preview mode: setupPurchases called with apiKey:', apiKey);
139
- return [2 /*return*/, null];
50
+ exports.browserNativeModuleRNPurchases = {
51
+ setupPurchases: function (apiKey, appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled) { return __awaiter(void 0, void 0, void 0, function () {
52
+ return __generator(this, function (_a) {
53
+ try {
54
+ purchases_js_hybrid_mappings_1.PurchasesCommon.configure({
55
+ apiKey: apiKey,
56
+ appUserId: appUserID || undefined,
57
+ flavor: 'react-native',
58
+ flavorVersion: packageVersion,
59
+ });
60
+ }
61
+ catch (error) {
62
+ console.error('Error configuring Purchases:', error);
63
+ throw error;
64
+ }
65
+ return [2 /*return*/];
140
66
  });
141
67
  }); },
142
68
  setAllowSharingStoreAccount: function (_allowSharing) { return __awaiter(void 0, void 0, void 0, function () {
143
69
  return __generator(this, function (_a) {
70
+ (0, utils_1.methodNotSupportedOnWeb)('setAllowSharingStoreAccount');
144
71
  return [2 /*return*/];
145
72
  });
146
73
  }); },
147
74
  setSimulatesAskToBuyInSandbox: function (_simulatesAskToBuyInSandbox) { return __awaiter(void 0, void 0, void 0, function () {
148
75
  return __generator(this, function (_a) {
76
+ (0, utils_1.methodNotSupportedOnWeb)('setSimulatesAskToBuyInSandbox');
149
77
  return [2 /*return*/];
150
78
  });
151
79
  }); },
152
80
  getOfferings: function () { return __awaiter(void 0, void 0, void 0, function () {
153
- return __generator(this, function (_a) {
154
- return [2 /*return*/, previewOfferings];
81
+ var offerings;
82
+ return __generator(this, function (_a) {
83
+ switch (_a.label) {
84
+ case 0:
85
+ (0, utils_1.ensurePurchasesConfigured)();
86
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getOfferings()];
87
+ case 1:
88
+ offerings = _a.sent();
89
+ return [2 /*return*/, (0, typeGuards_1.validateAndTransform)(offerings, typeGuards_1.isPurchasesOfferings, 'PurchasesOfferings')];
90
+ }
155
91
  });
156
92
  }); },
157
- getCurrentOfferingForPlacement: function (_placementIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
93
+ getCurrentOfferingForPlacement: function (placementIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
94
+ var offering;
158
95
  return __generator(this, function (_a) {
159
- return [2 /*return*/, previewOffering];
96
+ switch (_a.label) {
97
+ case 0:
98
+ (0, utils_1.ensurePurchasesConfigured)();
99
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getCurrentOfferingForPlacement(placementIdentifier)];
100
+ case 1:
101
+ offering = _a.sent();
102
+ return [2 /*return*/, offering ? (0, typeGuards_1.validateAndTransform)(offering, typeGuards_1.isPurchasesOffering, 'PurchasesOffering') : null];
103
+ }
160
104
  });
161
105
  }); },
162
106
  syncAttributesAndOfferingsIfNeeded: function () { return __awaiter(void 0, void 0, void 0, function () {
163
- return __generator(this, function (_a) {
164
- return [2 /*return*/, previewOfferings];
107
+ var offerings;
108
+ return __generator(this, function (_a) {
109
+ switch (_a.label) {
110
+ case 0:
111
+ (0, utils_1.ensurePurchasesConfigured)();
112
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getOfferings()];
113
+ case 1:
114
+ offerings = _a.sent();
115
+ return [2 /*return*/, (0, typeGuards_1.validateAndTransform)(offerings, typeGuards_1.isPurchasesOfferings, 'PurchasesOfferings')];
116
+ }
165
117
  });
166
118
  }); },
167
119
  getProductInfo: function (_productIdentifiers, _type) { return __awaiter(void 0, void 0, void 0, function () {
168
120
  return __generator(this, function (_a) {
169
- // In preview mode, return the preview product for any requested product identifiers
170
- return [2 /*return*/, [previewStoreProduct]];
121
+ (0, utils_1.methodNotSupportedOnWeb)('getProductInfo');
122
+ return [2 /*return*/];
171
123
  });
172
124
  }); },
173
125
  restorePurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
174
- return __generator(this, function (_a) {
175
- return [2 /*return*/, previewCustomerInfo];
126
+ var customerInfo;
127
+ return __generator(this, function (_a) {
128
+ switch (_a.label) {
129
+ case 0:
130
+ (0, utils_1.ensurePurchasesConfigured)();
131
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getCustomerInfo()];
132
+ case 1:
133
+ customerInfo = _a.sent();
134
+ return [2 /*return*/, (0, typeGuards_1.validateAndTransform)(customerInfo, typeGuards_1.isCustomerInfo, 'CustomerInfo')];
135
+ }
176
136
  });
177
137
  }); },
178
138
  getAppUserID: function () { return __awaiter(void 0, void 0, void 0, function () {
179
139
  return __generator(this, function (_a) {
180
- return [2 /*return*/, 'preview-user-id'];
140
+ (0, utils_1.ensurePurchasesConfigured)();
141
+ return [2 /*return*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getAppUserId()];
181
142
  });
182
143
  }); },
183
144
  getStorefront: function () { return __awaiter(void 0, void 0, void 0, function () {
184
145
  return __generator(this, function (_a) {
185
- return [2 /*return*/, 'preview-storefront'];
146
+ (0, utils_1.methodNotSupportedOnWeb)('getStorefront');
147
+ return [2 /*return*/];
186
148
  });
187
149
  }); },
188
150
  setDebugLogsEnabled: function (_enabled) { return __awaiter(void 0, void 0, void 0, function () {
189
151
  return __generator(this, function (_a) {
152
+ (0, utils_1.methodNotSupportedOnWeb)('setDebugLogsEnabled');
190
153
  return [2 /*return*/];
191
154
  });
192
155
  }); },
193
- setLogLevel: function (_level) { return __awaiter(void 0, void 0, void 0, function () {
156
+ setLogLevel: function (level) { return __awaiter(void 0, void 0, void 0, function () {
194
157
  return __generator(this, function (_a) {
158
+ purchases_js_hybrid_mappings_1.PurchasesCommon.setLogLevel(level);
195
159
  return [2 /*return*/];
196
160
  });
197
161
  }); },
198
- setLogHandler: function () { return __awaiter(void 0, void 0, void 0, function () {
162
+ setLogHandler: function (_handler) { return __awaiter(void 0, void 0, void 0, function () {
199
163
  return __generator(this, function (_a) {
200
- return [2 /*return*/, null];
164
+ (0, utils_1.methodNotSupportedOnWeb)('setLogHandler');
165
+ return [2 /*return*/];
201
166
  });
202
167
  }); },
203
168
  getCustomerInfo: function () { return __awaiter(void 0, void 0, void 0, function () {
204
- return __generator(this, function (_a) {
205
- return [2 /*return*/, previewCustomerInfo];
169
+ var customerInfo;
170
+ return __generator(this, function (_a) {
171
+ switch (_a.label) {
172
+ case 0:
173
+ (0, utils_1.ensurePurchasesConfigured)();
174
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getCustomerInfo()];
175
+ case 1:
176
+ customerInfo = _a.sent();
177
+ return [2 /*return*/, (0, typeGuards_1.validateAndTransform)(customerInfo, typeGuards_1.isCustomerInfo, 'CustomerInfo')];
178
+ }
206
179
  });
207
180
  }); },
208
- logIn: function (_appUserID) { return __awaiter(void 0, void 0, void 0, function () {
181
+ logIn: function (appUserID) { return __awaiter(void 0, void 0, void 0, function () {
182
+ var result;
209
183
  return __generator(this, function (_a) {
210
- return [2 /*return*/, {
211
- customerInfo: previewCustomerInfo,
212
- created: false
213
- }];
184
+ switch (_a.label) {
185
+ case 0:
186
+ (0, utils_1.ensurePurchasesConfigured)();
187
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().logIn(appUserID)];
188
+ case 1:
189
+ result = _a.sent();
190
+ return [2 /*return*/, (0, typeGuards_1.validateAndTransform)(result, typeGuards_1.isLogInResult, 'LogInResult')];
191
+ }
214
192
  });
215
193
  }); },
216
194
  logOut: function () { return __awaiter(void 0, void 0, void 0, function () {
217
- return __generator(this, function (_a) {
218
- return [2 /*return*/, previewCustomerInfo];
195
+ var customerInfo;
196
+ return __generator(this, function (_a) {
197
+ switch (_a.label) {
198
+ case 0:
199
+ (0, utils_1.ensurePurchasesConfigured)();
200
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().logOut()];
201
+ case 1:
202
+ customerInfo = _a.sent();
203
+ return [2 /*return*/, (0, typeGuards_1.validateAndTransform)(customerInfo, typeGuards_1.isCustomerInfo, 'CustomerInfo')];
204
+ }
219
205
  });
220
206
  }); },
221
207
  syncPurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
222
208
  return __generator(this, function (_a) {
209
+ (0, utils_1.methodNotSupportedOnWeb)('syncPurchases');
223
210
  return [2 /*return*/];
224
211
  });
225
212
  }); },
226
213
  syncAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
227
214
  return __generator(this, function (_a) {
215
+ (0, utils_1.methodNotSupportedOnWeb)('syncAmazonPurchase');
228
216
  return [2 /*return*/];
229
217
  });
230
218
  }); },
231
219
  syncObserverModeAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
232
220
  return __generator(this, function (_a) {
221
+ (0, utils_1.methodNotSupportedOnWeb)('syncObserverModeAmazonPurchase');
233
222
  return [2 /*return*/];
234
223
  });
235
224
  }); },
236
225
  recordPurchaseForProductID: function (_productID) { return __awaiter(void 0, void 0, void 0, function () {
237
226
  return __generator(this, function (_a) {
238
- return [2 /*return*/, previewPurchaseStoreTransaction];
227
+ (0, utils_1.methodNotSupportedOnWeb)('recordPurchaseForProductID');
228
+ return [2 /*return*/];
239
229
  });
240
230
  }); },
241
231
  enableAdServicesAttributionTokenCollection: function () { return __awaiter(void 0, void 0, void 0, function () {
242
232
  return __generator(this, function (_a) {
233
+ (0, utils_1.methodNotSupportedOnWeb)('enableAdServicesAttributionTokenCollection');
243
234
  return [2 /*return*/];
244
235
  });
245
236
  }); },
246
237
  purchaseProduct: function (_productIdentifier, _googleProductChangeInfo, _type, _discountTimestamp, _googleInfo, _presentedOfferingContext) { return __awaiter(void 0, void 0, void 0, function () {
247
238
  return __generator(this, function (_a) {
248
- // In preview mode, return a successful purchase result
249
- return [2 /*return*/, previewMakePurchaseResult];
239
+ (0, utils_1.methodNotSupportedOnWeb)('purchaseProduct');
240
+ return [2 /*return*/];
250
241
  });
251
242
  }); },
252
- purchasePackage: function (_packageIdentifier, _presentedOfferingContext, _googleProductChangeInfo, _discountTimestamp, _googleInfo) { return __awaiter(void 0, void 0, void 0, function () {
243
+ purchasePackage: function (packageIdentifier, presentedOfferingContext, _googleProductChangeInfo, _discountTimestamp, _googleInfo) { return __awaiter(void 0, void 0, void 0, function () {
244
+ var purchaseResult;
253
245
  return __generator(this, function (_a) {
254
- // In preview mode, return a successful purchase result
255
- return [2 /*return*/, previewMakePurchaseResult];
246
+ switch (_a.label) {
247
+ case 0:
248
+ (0, utils_1.ensurePurchasesConfigured)();
249
+ if ((0, environment_1.isExpoGo)()) {
250
+ throw new Error('Purchasing is not currently supported in Expo Go');
251
+ }
252
+ return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().purchasePackage({
253
+ packageIdentifier: packageIdentifier,
254
+ presentedOfferingContext: presentedOfferingContext,
255
+ })];
256
+ case 1:
257
+ purchaseResult = _a.sent();
258
+ return [2 /*return*/, (0, typeGuards_1.validateAndTransform)(purchaseResult, typeGuards_1.isMakePurchaseResult, 'MakePurchaseResult')];
259
+ }
256
260
  });
257
261
  }); },
258
262
  purchaseSubscriptionOption: function (_productIdentifier, _optionIdentifier, _upgradeInfo, _discountTimestamp, _googleInfo, _presentedOfferingContext) { return __awaiter(void 0, void 0, void 0, function () {
259
263
  return __generator(this, function (_a) {
260
- // In preview mode, return a successful purchase result
261
- return [2 /*return*/, previewMakePurchaseResult];
264
+ (0, utils_1.methodNotSupportedOnWeb)('purchaseSubscriptionOption');
265
+ return [2 /*return*/];
262
266
  });
263
267
  }); },
264
268
  isAnonymous: function () { return __awaiter(void 0, void 0, void 0, function () {
265
269
  return __generator(this, function (_a) {
266
- return [2 /*return*/, true];
270
+ (0, utils_1.ensurePurchasesConfigured)();
271
+ return [2 /*return*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().isAnonymous()];
267
272
  });
268
273
  }); },
269
274
  makeDeferredPurchase: function (_callbackID) { return __awaiter(void 0, void 0, void 0, function () {
270
275
  return __generator(this, function (_a) {
276
+ (0, utils_1.methodNotSupportedOnWeb)('makeDeferredPurchase');
271
277
  return [2 /*return*/];
272
278
  });
273
279
  }); },
@@ -276,229 +282,281 @@ exports.previewNativeModuleRNPurchases = {
276
282
  return __generator(this, function (_a) {
277
283
  result = {};
278
284
  productIDs.forEach(function (productId) {
279
- result[productId] = purchases_typescript_internal_1.INTRO_ELIGIBILITY_STATUS.INTRO_ELIGIBILITY_STATUS_ELIGIBLE;
285
+ result[productId] = purchases_typescript_internal_1.INTRO_ELIGIBILITY_STATUS.INTRO_ELIGIBILITY_STATUS_UNKNOWN;
280
286
  });
281
287
  return [2 /*return*/, result];
282
288
  });
283
289
  }); },
284
290
  getPromotionalOffer: function (_productIdentifier, _discount) { return __awaiter(void 0, void 0, void 0, function () {
285
291
  return __generator(this, function (_a) {
286
- return [2 /*return*/, undefined];
292
+ (0, utils_1.methodNotSupportedOnWeb)('getPromotionalOffer');
293
+ return [2 /*return*/];
287
294
  });
288
295
  }); },
289
296
  eligibleWinBackOffersForProductIdentifier: function (_productID) { return __awaiter(void 0, void 0, void 0, function () {
290
297
  return __generator(this, function (_a) {
291
- return [2 /*return*/, []];
298
+ (0, utils_1.methodNotSupportedOnWeb)('eligibleWinBackOffersForProductIdentifier');
299
+ return [2 /*return*/];
292
300
  });
293
301
  }); },
294
302
  purchaseProductWithWinBackOffer: function (_productID, _winBackOfferID) { return __awaiter(void 0, void 0, void 0, function () {
295
303
  return __generator(this, function (_a) {
296
- return [2 /*return*/, previewMakePurchaseResult];
304
+ (0, utils_1.methodNotSupportedOnWeb)('purchaseProductWithWinBackOffer');
305
+ return [2 /*return*/];
297
306
  });
298
307
  }); },
299
308
  purchasePackageWithWinBackOffer: function (_packageID, _winBackOfferID) { return __awaiter(void 0, void 0, void 0, function () {
300
309
  return __generator(this, function (_a) {
301
- return [2 /*return*/, previewMakePurchaseResult];
310
+ (0, utils_1.methodNotSupportedOnWeb)('purchasePackageWithWinBackOffer');
311
+ return [2 /*return*/];
302
312
  });
303
313
  }); },
304
314
  invalidateCustomerInfoCache: function () { return __awaiter(void 0, void 0, void 0, function () {
305
315
  return __generator(this, function (_a) {
316
+ (0, utils_1.methodNotSupportedOnWeb)('invalidateCustomerInfoCache');
306
317
  return [2 /*return*/];
307
318
  });
308
319
  }); },
309
320
  presentCodeRedemptionSheet: function () { return __awaiter(void 0, void 0, void 0, function () {
310
321
  return __generator(this, function (_a) {
322
+ (0, utils_1.methodNotSupportedOnWeb)('presentCodeRedemptionSheet');
311
323
  return [2 /*return*/];
312
324
  });
313
325
  }); },
314
- setAttributes: function (_attributes) { return __awaiter(void 0, void 0, void 0, function () {
326
+ setAttributes: function (attributes) { return __awaiter(void 0, void 0, void 0, function () {
315
327
  return __generator(this, function (_a) {
316
- return [2 /*return*/];
328
+ switch (_a.label) {
329
+ case 0: return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().setAttributes(attributes)];
330
+ case 1:
331
+ _a.sent();
332
+ return [2 /*return*/];
333
+ }
317
334
  });
318
335
  }); },
319
- setEmail: function (_email) { return __awaiter(void 0, void 0, void 0, function () {
336
+ setEmail: function (email) { return __awaiter(void 0, void 0, void 0, function () {
320
337
  return __generator(this, function (_a) {
321
- return [2 /*return*/];
338
+ switch (_a.label) {
339
+ case 0: return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().setEmail(email)];
340
+ case 1:
341
+ _a.sent();
342
+ return [2 /*return*/];
343
+ }
322
344
  });
323
345
  }); },
324
- setPhoneNumber: function (_phoneNumber) { return __awaiter(void 0, void 0, void 0, function () {
346
+ setPhoneNumber: function (phoneNumber) { return __awaiter(void 0, void 0, void 0, function () {
325
347
  return __generator(this, function (_a) {
326
- return [2 /*return*/];
348
+ switch (_a.label) {
349
+ case 0: return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().setPhoneNumber(phoneNumber)];
350
+ case 1:
351
+ _a.sent();
352
+ return [2 /*return*/];
353
+ }
327
354
  });
328
355
  }); },
329
- setDisplayName: function (_displayName) { return __awaiter(void 0, void 0, void 0, function () {
356
+ setDisplayName: function (displayName) { return __awaiter(void 0, void 0, void 0, function () {
330
357
  return __generator(this, function (_a) {
331
- return [2 /*return*/];
358
+ switch (_a.label) {
359
+ case 0: return [4 /*yield*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().setDisplayName(displayName)];
360
+ case 1:
361
+ _a.sent();
362
+ return [2 /*return*/];
363
+ }
332
364
  });
333
365
  }); },
334
366
  setPushToken: function (_pushToken) { return __awaiter(void 0, void 0, void 0, function () {
335
367
  return __generator(this, function (_a) {
368
+ (0, utils_1.methodNotSupportedOnWeb)('setPushToken');
336
369
  return [2 /*return*/];
337
370
  });
338
371
  }); },
339
- setProxyURLString: function (_proxyURLString) { return __awaiter(void 0, void 0, void 0, function () {
372
+ setProxyURLString: function (proxyURLString) { return __awaiter(void 0, void 0, void 0, function () {
340
373
  return __generator(this, function (_a) {
374
+ purchases_js_hybrid_mappings_1.PurchasesCommon.setProxyUrl(proxyURLString);
341
375
  return [2 /*return*/];
342
376
  });
343
377
  }); },
344
378
  collectDeviceIdentifiers: function () { return __awaiter(void 0, void 0, void 0, function () {
345
379
  return __generator(this, function (_a) {
380
+ (0, utils_1.methodNotSupportedOnWeb)('collectDeviceIdentifiers');
346
381
  return [2 /*return*/];
347
382
  });
348
383
  }); },
349
384
  setAdjustID: function (_adjustID) { return __awaiter(void 0, void 0, void 0, function () {
350
385
  return __generator(this, function (_a) {
386
+ (0, utils_1.methodNotSupportedOnWeb)('setAdjustID');
351
387
  return [2 /*return*/];
352
388
  });
353
389
  }); },
354
390
  setAppsflyerID: function (_appsflyerID) { return __awaiter(void 0, void 0, void 0, function () {
355
391
  return __generator(this, function (_a) {
392
+ (0, utils_1.methodNotSupportedOnWeb)('setAppsflyerID');
356
393
  return [2 /*return*/];
357
394
  });
358
395
  }); },
359
396
  setFBAnonymousID: function (_fbAnonymousID) { return __awaiter(void 0, void 0, void 0, function () {
360
397
  return __generator(this, function (_a) {
398
+ (0, utils_1.methodNotSupportedOnWeb)('setFBAnonymousID');
361
399
  return [2 /*return*/];
362
400
  });
363
401
  }); },
364
402
  setMparticleID: function (_mparticleID) { return __awaiter(void 0, void 0, void 0, function () {
365
403
  return __generator(this, function (_a) {
404
+ (0, utils_1.methodNotSupportedOnWeb)('setMparticleID');
366
405
  return [2 /*return*/];
367
406
  });
368
407
  }); },
369
408
  setCleverTapID: function (_cleverTapID) { return __awaiter(void 0, void 0, void 0, function () {
370
409
  return __generator(this, function (_a) {
410
+ (0, utils_1.methodNotSupportedOnWeb)('setCleverTapID');
371
411
  return [2 /*return*/];
372
412
  });
373
413
  }); },
374
414
  setMixpanelDistinctID: function (_mixpanelDistinctID) { return __awaiter(void 0, void 0, void 0, function () {
375
415
  return __generator(this, function (_a) {
416
+ (0, utils_1.methodNotSupportedOnWeb)('setMixpanelDistinctID');
376
417
  return [2 /*return*/];
377
418
  });
378
419
  }); },
379
420
  setFirebaseAppInstanceID: function (_firebaseAppInstanceID) { return __awaiter(void 0, void 0, void 0, function () {
380
421
  return __generator(this, function (_a) {
422
+ (0, utils_1.methodNotSupportedOnWeb)('setFirebaseAppInstanceID');
381
423
  return [2 /*return*/];
382
424
  });
383
425
  }); },
384
426
  setTenjinAnalyticsInstallationID: function (_tenjinAnalyticsInstallationID) { return __awaiter(void 0, void 0, void 0, function () {
385
427
  return __generator(this, function (_a) {
428
+ (0, utils_1.methodNotSupportedOnWeb)('setTenjinAnalyticsInstallationID');
386
429
  return [2 /*return*/];
387
430
  });
388
431
  }); },
389
432
  setKochavaDeviceID: function (_kochavaDeviceID) { return __awaiter(void 0, void 0, void 0, function () {
390
433
  return __generator(this, function (_a) {
434
+ (0, utils_1.methodNotSupportedOnWeb)('setKochavaDeviceID');
391
435
  return [2 /*return*/];
392
436
  });
393
437
  }); },
394
438
  setOnesignalID: function (_onesignalID) { return __awaiter(void 0, void 0, void 0, function () {
395
439
  return __generator(this, function (_a) {
440
+ (0, utils_1.methodNotSupportedOnWeb)('setOnesignalID');
396
441
  return [2 /*return*/];
397
442
  });
398
443
  }); },
399
444
  setAirshipChannelID: function (_airshipChannelID) { return __awaiter(void 0, void 0, void 0, function () {
400
445
  return __generator(this, function (_a) {
446
+ (0, utils_1.methodNotSupportedOnWeb)('setAirshipChannelID');
401
447
  return [2 /*return*/];
402
448
  });
403
449
  }); },
404
450
  setMediaSource: function (_mediaSource) { return __awaiter(void 0, void 0, void 0, function () {
405
451
  return __generator(this, function (_a) {
452
+ (0, utils_1.methodNotSupportedOnWeb)('setMediaSource');
406
453
  return [2 /*return*/];
407
454
  });
408
455
  }); },
409
456
  setMediaCampaign: function () { return __awaiter(void 0, void 0, void 0, function () {
410
457
  return __generator(this, function (_a) {
458
+ (0, utils_1.methodNotSupportedOnWeb)('setMediaCampaign');
411
459
  return [2 /*return*/];
412
460
  });
413
461
  }); },
414
462
  setCampaign: function (_campaign) { return __awaiter(void 0, void 0, void 0, function () {
415
463
  return __generator(this, function (_a) {
464
+ (0, utils_1.methodNotSupportedOnWeb)('setCampaign');
416
465
  return [2 /*return*/];
417
466
  });
418
467
  }); },
419
468
  setAdGroup: function (_adGroup) { return __awaiter(void 0, void 0, void 0, function () {
420
469
  return __generator(this, function (_a) {
470
+ (0, utils_1.methodNotSupportedOnWeb)('setAdGroup');
421
471
  return [2 /*return*/];
422
472
  });
423
473
  }); },
424
474
  setAd: function (_ad) { return __awaiter(void 0, void 0, void 0, function () {
425
475
  return __generator(this, function (_a) {
476
+ (0, utils_1.methodNotSupportedOnWeb)('setAd');
426
477
  return [2 /*return*/];
427
478
  });
428
479
  }); },
429
480
  setKeyword: function (_keyword) { return __awaiter(void 0, void 0, void 0, function () {
430
481
  return __generator(this, function (_a) {
482
+ (0, utils_1.methodNotSupportedOnWeb)('setKeyword');
431
483
  return [2 /*return*/];
432
484
  });
433
485
  }); },
434
486
  setCreative: function (_creative) { return __awaiter(void 0, void 0, void 0, function () {
435
487
  return __generator(this, function (_a) {
488
+ (0, utils_1.methodNotSupportedOnWeb)('setCreative');
436
489
  return [2 /*return*/];
437
490
  });
438
491
  }); },
439
492
  canMakePayments: function (_features) { return __awaiter(void 0, void 0, void 0, function () {
440
493
  return __generator(this, function (_a) {
441
- // In preview mode, return false (no payments can be made)
442
- return [2 /*return*/, false];
494
+ return [2 /*return*/, true];
443
495
  });
444
496
  }); },
445
497
  beginRefundRequestForActiveEntitlement: function () { return __awaiter(void 0, void 0, void 0, function () {
446
498
  return __generator(this, function (_a) {
447
- return [2 /*return*/, 0];
499
+ (0, utils_1.methodNotSupportedOnWeb)('beginRefundRequestForActiveEntitlement');
500
+ return [2 /*return*/];
448
501
  });
449
502
  }); },
450
503
  beginRefundRequestForEntitlementId: function (_entitlementIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
451
504
  return __generator(this, function (_a) {
452
- return [2 /*return*/, 0];
505
+ (0, utils_1.methodNotSupportedOnWeb)('beginRefundRequestForEntitlementId');
506
+ return [2 /*return*/];
453
507
  });
454
508
  }); },
455
509
  beginRefundRequestForProductId: function (_productIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
456
510
  return __generator(this, function (_a) {
457
- return [2 /*return*/, 0];
511
+ (0, utils_1.methodNotSupportedOnWeb)('beginRefundRequestForProductId');
512
+ return [2 /*return*/];
458
513
  });
459
514
  }); },
460
515
  showManageSubscriptions: function () { return __awaiter(void 0, void 0, void 0, function () {
461
516
  return __generator(this, function (_a) {
517
+ (0, utils_1.methodNotSupportedOnWeb)('showManageSubscriptions');
462
518
  return [2 /*return*/];
463
519
  });
464
520
  }); },
465
521
  showInAppMessages: function (_messageTypes) { return __awaiter(void 0, void 0, void 0, function () {
466
522
  return __generator(this, function (_a) {
523
+ (0, utils_1.methodNotSupportedOnWeb)('showInAppMessages');
467
524
  return [2 /*return*/];
468
525
  });
469
526
  }); },
470
527
  isWebPurchaseRedemptionURL: function (_urlString) { return __awaiter(void 0, void 0, void 0, function () {
471
528
  return __generator(this, function (_a) {
472
- // In preview mode, we'll return false for any URL
473
- return [2 /*return*/, false];
529
+ (0, utils_1.methodNotSupportedOnWeb)('isWebPurchaseRedemptionURL');
530
+ return [2 /*return*/];
474
531
  });
475
532
  }); },
476
533
  isConfigured: function () { return __awaiter(void 0, void 0, void 0, function () {
477
534
  return __generator(this, function (_a) {
478
- return [2 /*return*/, true];
535
+ return [2 /*return*/, purchases_js_hybrid_mappings_1.PurchasesCommon.isConfigured()];
479
536
  });
480
537
  }); },
481
538
  redeemWebPurchase: function (_urlString) { return __awaiter(void 0, void 0, void 0, function () {
482
539
  return __generator(this, function (_a) {
483
- return [2 /*return*/, {
484
- result: purchases_typescript_internal_1.WebPurchaseRedemptionResultType.SUCCESS,
485
- customerInfo: previewCustomerInfo
486
- }];
540
+ (0, utils_1.methodNotSupportedOnWeb)('redeemWebPurchase');
541
+ return [2 /*return*/];
487
542
  });
488
543
  }); },
489
544
  getVirtualCurrencies: function () { return __awaiter(void 0, void 0, void 0, function () {
490
545
  return __generator(this, function (_a) {
491
- return [2 /*return*/, previewVirtualCurrencies];
546
+ (0, utils_1.methodNotSupportedOnWeb)('getVirtualCurrencies');
547
+ return [2 /*return*/];
492
548
  });
493
549
  }); },
494
550
  invalidateVirtualCurrenciesCache: function () { return __awaiter(void 0, void 0, void 0, function () {
495
551
  return __generator(this, function (_a) {
552
+ (0, utils_1.methodNotSupportedOnWeb)('invalidateVirtualCurrenciesCache');
496
553
  return [2 /*return*/];
497
554
  });
498
555
  }); },
499
556
  getCachedVirtualCurrencies: function () { return __awaiter(void 0, void 0, void 0, function () {
500
557
  return __generator(this, function (_a) {
501
- return [2 /*return*/, previewVirtualCurrencies];
558
+ (0, utils_1.methodNotSupportedOnWeb)('getCachedVirtualCurrencies');
559
+ return [2 /*return*/];
502
560
  });
503
- }); }
561
+ }); },
504
562
  };