react-native-purchases 9.0.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,235 +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
- };
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';
128
47
  /**
129
- * Preview implementation of the native module for Preview API mode, i.e. for environments where native modules are not available
130
- * (like Expo Go).
48
+ * Browser implementation of the native module. This will be used in the browser and Expo Go.
131
49
  */
132
- exports.previewNativeModuleRNPurchases = {
133
- setupPurchases: function (apiKey, _appUserID, _purchasesAreCompletedBy, _userDefaultsSuiteName, _storeKitVersion, _useAmazon, _shouldShowInAppMessagesAutomatically, _entitlementVerificationMode, _pendingTransactionsForPrepaidPlansEnabled, _diagnosticsEnabled) { return __awaiter(void 0, void 0, void 0, function () {
134
- return __generator(this, function (_a) {
135
- console.log('[RevenueCat] Preview mode: setupPurchases called with apiKey:', apiKey);
136
- 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*/];
137
66
  });
138
67
  }); },
139
68
  setAllowSharingStoreAccount: function (_allowSharing) { return __awaiter(void 0, void 0, void 0, function () {
140
69
  return __generator(this, function (_a) {
70
+ (0, utils_1.methodNotSupportedOnWeb)('setAllowSharingStoreAccount');
141
71
  return [2 /*return*/];
142
72
  });
143
73
  }); },
144
74
  setSimulatesAskToBuyInSandbox: function (_simulatesAskToBuyInSandbox) { return __awaiter(void 0, void 0, void 0, function () {
145
75
  return __generator(this, function (_a) {
76
+ (0, utils_1.methodNotSupportedOnWeb)('setSimulatesAskToBuyInSandbox');
146
77
  return [2 /*return*/];
147
78
  });
148
79
  }); },
149
80
  getOfferings: function () { return __awaiter(void 0, void 0, void 0, function () {
150
- return __generator(this, function (_a) {
151
- 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
+ }
152
91
  });
153
92
  }); },
154
- 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;
155
95
  return __generator(this, function (_a) {
156
- 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
+ }
157
104
  });
158
105
  }); },
159
106
  syncAttributesAndOfferingsIfNeeded: function () { return __awaiter(void 0, void 0, void 0, function () {
160
- return __generator(this, function (_a) {
161
- 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
+ }
162
117
  });
163
118
  }); },
164
119
  getProductInfo: function (_productIdentifiers, _type) { return __awaiter(void 0, void 0, void 0, function () {
165
120
  return __generator(this, function (_a) {
166
- // In preview mode, return the preview product for any requested product identifiers
167
- return [2 /*return*/, [previewStoreProduct]];
121
+ (0, utils_1.methodNotSupportedOnWeb)('getProductInfo');
122
+ return [2 /*return*/];
168
123
  });
169
124
  }); },
170
125
  restorePurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
171
- return __generator(this, function (_a) {
172
- 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
+ }
173
136
  });
174
137
  }); },
175
138
  getAppUserID: function () { return __awaiter(void 0, void 0, void 0, function () {
176
139
  return __generator(this, function (_a) {
177
- return [2 /*return*/, 'preview-user-id'];
140
+ (0, utils_1.ensurePurchasesConfigured)();
141
+ return [2 /*return*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().getAppUserId()];
178
142
  });
179
143
  }); },
180
144
  getStorefront: function () { return __awaiter(void 0, void 0, void 0, function () {
181
145
  return __generator(this, function (_a) {
182
- return [2 /*return*/, 'preview-storefront'];
146
+ (0, utils_1.methodNotSupportedOnWeb)('getStorefront');
147
+ return [2 /*return*/];
183
148
  });
184
149
  }); },
185
150
  setDebugLogsEnabled: function (_enabled) { return __awaiter(void 0, void 0, void 0, function () {
186
151
  return __generator(this, function (_a) {
152
+ (0, utils_1.methodNotSupportedOnWeb)('setDebugLogsEnabled');
187
153
  return [2 /*return*/];
188
154
  });
189
155
  }); },
190
- 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 () {
191
157
  return __generator(this, function (_a) {
158
+ purchases_js_hybrid_mappings_1.PurchasesCommon.setLogLevel(level);
192
159
  return [2 /*return*/];
193
160
  });
194
161
  }); },
195
- setLogHandler: function () { return __awaiter(void 0, void 0, void 0, function () {
162
+ setLogHandler: function (_handler) { return __awaiter(void 0, void 0, void 0, function () {
196
163
  return __generator(this, function (_a) {
197
- return [2 /*return*/, null];
164
+ (0, utils_1.methodNotSupportedOnWeb)('setLogHandler');
165
+ return [2 /*return*/];
198
166
  });
199
167
  }); },
200
168
  getCustomerInfo: function () { return __awaiter(void 0, void 0, void 0, function () {
201
- return __generator(this, function (_a) {
202
- 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
+ }
203
179
  });
204
180
  }); },
205
- 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;
206
183
  return __generator(this, function (_a) {
207
- return [2 /*return*/, {
208
- customerInfo: previewCustomerInfo,
209
- created: false
210
- }];
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
+ }
211
192
  });
212
193
  }); },
213
194
  logOut: function () { return __awaiter(void 0, void 0, void 0, function () {
214
- return __generator(this, function (_a) {
215
- 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
+ }
216
205
  });
217
206
  }); },
218
207
  syncPurchases: function () { return __awaiter(void 0, void 0, void 0, function () {
219
208
  return __generator(this, function (_a) {
209
+ (0, utils_1.methodNotSupportedOnWeb)('syncPurchases');
220
210
  return [2 /*return*/];
221
211
  });
222
212
  }); },
223
213
  syncAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
224
214
  return __generator(this, function (_a) {
215
+ (0, utils_1.methodNotSupportedOnWeb)('syncAmazonPurchase');
225
216
  return [2 /*return*/];
226
217
  });
227
218
  }); },
228
219
  syncObserverModeAmazonPurchase: function (_productID, _receiptID, _amazonUserID, _isoCurrencyCode, _price) { return __awaiter(void 0, void 0, void 0, function () {
229
220
  return __generator(this, function (_a) {
221
+ (0, utils_1.methodNotSupportedOnWeb)('syncObserverModeAmazonPurchase');
230
222
  return [2 /*return*/];
231
223
  });
232
224
  }); },
233
225
  recordPurchaseForProductID: function (_productID) { return __awaiter(void 0, void 0, void 0, function () {
234
226
  return __generator(this, function (_a) {
235
- return [2 /*return*/, previewPurchaseStoreTransaction];
227
+ (0, utils_1.methodNotSupportedOnWeb)('recordPurchaseForProductID');
228
+ return [2 /*return*/];
236
229
  });
237
230
  }); },
238
231
  enableAdServicesAttributionTokenCollection: function () { return __awaiter(void 0, void 0, void 0, function () {
239
232
  return __generator(this, function (_a) {
233
+ (0, utils_1.methodNotSupportedOnWeb)('enableAdServicesAttributionTokenCollection');
240
234
  return [2 /*return*/];
241
235
  });
242
236
  }); },
243
237
  purchaseProduct: function (_productIdentifier, _googleProductChangeInfo, _type, _discountTimestamp, _googleInfo, _presentedOfferingContext) { return __awaiter(void 0, void 0, void 0, function () {
244
238
  return __generator(this, function (_a) {
245
- // In preview mode, return a successful purchase result
246
- return [2 /*return*/, previewMakePurchaseResult];
239
+ (0, utils_1.methodNotSupportedOnWeb)('purchaseProduct');
240
+ return [2 /*return*/];
247
241
  });
248
242
  }); },
249
- 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;
250
245
  return __generator(this, function (_a) {
251
- // In preview mode, return a successful purchase result
252
- 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
+ }
253
260
  });
254
261
  }); },
255
262
  purchaseSubscriptionOption: function (_productIdentifier, _optionIdentifier, _upgradeInfo, _discountTimestamp, _googleInfo, _presentedOfferingContext) { return __awaiter(void 0, void 0, void 0, function () {
256
263
  return __generator(this, function (_a) {
257
- // In preview mode, return a successful purchase result
258
- return [2 /*return*/, previewMakePurchaseResult];
264
+ (0, utils_1.methodNotSupportedOnWeb)('purchaseSubscriptionOption');
265
+ return [2 /*return*/];
259
266
  });
260
267
  }); },
261
268
  isAnonymous: function () { return __awaiter(void 0, void 0, void 0, function () {
262
269
  return __generator(this, function (_a) {
263
- return [2 /*return*/, true];
270
+ (0, utils_1.ensurePurchasesConfigured)();
271
+ return [2 /*return*/, purchases_js_hybrid_mappings_1.PurchasesCommon.getInstance().isAnonymous()];
264
272
  });
265
273
  }); },
266
274
  makeDeferredPurchase: function (_callbackID) { return __awaiter(void 0, void 0, void 0, function () {
267
275
  return __generator(this, function (_a) {
276
+ (0, utils_1.methodNotSupportedOnWeb)('makeDeferredPurchase');
268
277
  return [2 /*return*/];
269
278
  });
270
279
  }); },
@@ -273,214 +282,281 @@ exports.previewNativeModuleRNPurchases = {
273
282
  return __generator(this, function (_a) {
274
283
  result = {};
275
284
  productIDs.forEach(function (productId) {
276
- 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;
277
286
  });
278
287
  return [2 /*return*/, result];
279
288
  });
280
289
  }); },
281
290
  getPromotionalOffer: function (_productIdentifier, _discount) { return __awaiter(void 0, void 0, void 0, function () {
282
291
  return __generator(this, function (_a) {
283
- return [2 /*return*/, undefined];
292
+ (0, utils_1.methodNotSupportedOnWeb)('getPromotionalOffer');
293
+ return [2 /*return*/];
284
294
  });
285
295
  }); },
286
296
  eligibleWinBackOffersForProductIdentifier: function (_productID) { return __awaiter(void 0, void 0, void 0, function () {
287
297
  return __generator(this, function (_a) {
288
- return [2 /*return*/, []];
298
+ (0, utils_1.methodNotSupportedOnWeb)('eligibleWinBackOffersForProductIdentifier');
299
+ return [2 /*return*/];
289
300
  });
290
301
  }); },
291
302
  purchaseProductWithWinBackOffer: function (_productID, _winBackOfferID) { return __awaiter(void 0, void 0, void 0, function () {
292
303
  return __generator(this, function (_a) {
293
- return [2 /*return*/, previewMakePurchaseResult];
304
+ (0, utils_1.methodNotSupportedOnWeb)('purchaseProductWithWinBackOffer');
305
+ return [2 /*return*/];
294
306
  });
295
307
  }); },
296
308
  purchasePackageWithWinBackOffer: function (_packageID, _winBackOfferID) { return __awaiter(void 0, void 0, void 0, function () {
297
309
  return __generator(this, function (_a) {
298
- return [2 /*return*/, previewMakePurchaseResult];
310
+ (0, utils_1.methodNotSupportedOnWeb)('purchasePackageWithWinBackOffer');
311
+ return [2 /*return*/];
299
312
  });
300
313
  }); },
301
314
  invalidateCustomerInfoCache: function () { return __awaiter(void 0, void 0, void 0, function () {
302
315
  return __generator(this, function (_a) {
316
+ (0, utils_1.methodNotSupportedOnWeb)('invalidateCustomerInfoCache');
303
317
  return [2 /*return*/];
304
318
  });
305
319
  }); },
306
320
  presentCodeRedemptionSheet: function () { return __awaiter(void 0, void 0, void 0, function () {
307
321
  return __generator(this, function (_a) {
322
+ (0, utils_1.methodNotSupportedOnWeb)('presentCodeRedemptionSheet');
308
323
  return [2 /*return*/];
309
324
  });
310
325
  }); },
311
- 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 () {
312
327
  return __generator(this, function (_a) {
313
- 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
+ }
314
334
  });
315
335
  }); },
316
- 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 () {
317
337
  return __generator(this, function (_a) {
318
- 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
+ }
319
344
  });
320
345
  }); },
321
- 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 () {
322
347
  return __generator(this, function (_a) {
323
- 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
+ }
324
354
  });
325
355
  }); },
326
- 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 () {
327
357
  return __generator(this, function (_a) {
328
- 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
+ }
329
364
  });
330
365
  }); },
331
366
  setPushToken: function (_pushToken) { return __awaiter(void 0, void 0, void 0, function () {
332
367
  return __generator(this, function (_a) {
368
+ (0, utils_1.methodNotSupportedOnWeb)('setPushToken');
333
369
  return [2 /*return*/];
334
370
  });
335
371
  }); },
336
- 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 () {
337
373
  return __generator(this, function (_a) {
374
+ purchases_js_hybrid_mappings_1.PurchasesCommon.setProxyUrl(proxyURLString);
338
375
  return [2 /*return*/];
339
376
  });
340
377
  }); },
341
378
  collectDeviceIdentifiers: function () { return __awaiter(void 0, void 0, void 0, function () {
342
379
  return __generator(this, function (_a) {
380
+ (0, utils_1.methodNotSupportedOnWeb)('collectDeviceIdentifiers');
343
381
  return [2 /*return*/];
344
382
  });
345
383
  }); },
346
384
  setAdjustID: function (_adjustID) { return __awaiter(void 0, void 0, void 0, function () {
347
385
  return __generator(this, function (_a) {
386
+ (0, utils_1.methodNotSupportedOnWeb)('setAdjustID');
348
387
  return [2 /*return*/];
349
388
  });
350
389
  }); },
351
390
  setAppsflyerID: function (_appsflyerID) { return __awaiter(void 0, void 0, void 0, function () {
352
391
  return __generator(this, function (_a) {
392
+ (0, utils_1.methodNotSupportedOnWeb)('setAppsflyerID');
353
393
  return [2 /*return*/];
354
394
  });
355
395
  }); },
356
396
  setFBAnonymousID: function (_fbAnonymousID) { return __awaiter(void 0, void 0, void 0, function () {
357
397
  return __generator(this, function (_a) {
398
+ (0, utils_1.methodNotSupportedOnWeb)('setFBAnonymousID');
358
399
  return [2 /*return*/];
359
400
  });
360
401
  }); },
361
402
  setMparticleID: function (_mparticleID) { return __awaiter(void 0, void 0, void 0, function () {
362
403
  return __generator(this, function (_a) {
404
+ (0, utils_1.methodNotSupportedOnWeb)('setMparticleID');
363
405
  return [2 /*return*/];
364
406
  });
365
407
  }); },
366
408
  setCleverTapID: function (_cleverTapID) { return __awaiter(void 0, void 0, void 0, function () {
367
409
  return __generator(this, function (_a) {
410
+ (0, utils_1.methodNotSupportedOnWeb)('setCleverTapID');
368
411
  return [2 /*return*/];
369
412
  });
370
413
  }); },
371
414
  setMixpanelDistinctID: function (_mixpanelDistinctID) { return __awaiter(void 0, void 0, void 0, function () {
372
415
  return __generator(this, function (_a) {
416
+ (0, utils_1.methodNotSupportedOnWeb)('setMixpanelDistinctID');
373
417
  return [2 /*return*/];
374
418
  });
375
419
  }); },
376
420
  setFirebaseAppInstanceID: function (_firebaseAppInstanceID) { return __awaiter(void 0, void 0, void 0, function () {
377
421
  return __generator(this, function (_a) {
422
+ (0, utils_1.methodNotSupportedOnWeb)('setFirebaseAppInstanceID');
378
423
  return [2 /*return*/];
379
424
  });
380
425
  }); },
381
426
  setTenjinAnalyticsInstallationID: function (_tenjinAnalyticsInstallationID) { return __awaiter(void 0, void 0, void 0, function () {
382
427
  return __generator(this, function (_a) {
428
+ (0, utils_1.methodNotSupportedOnWeb)('setTenjinAnalyticsInstallationID');
383
429
  return [2 /*return*/];
384
430
  });
385
431
  }); },
386
432
  setKochavaDeviceID: function (_kochavaDeviceID) { return __awaiter(void 0, void 0, void 0, function () {
387
433
  return __generator(this, function (_a) {
434
+ (0, utils_1.methodNotSupportedOnWeb)('setKochavaDeviceID');
388
435
  return [2 /*return*/];
389
436
  });
390
437
  }); },
391
438
  setOnesignalID: function (_onesignalID) { return __awaiter(void 0, void 0, void 0, function () {
392
439
  return __generator(this, function (_a) {
440
+ (0, utils_1.methodNotSupportedOnWeb)('setOnesignalID');
393
441
  return [2 /*return*/];
394
442
  });
395
443
  }); },
396
444
  setAirshipChannelID: function (_airshipChannelID) { return __awaiter(void 0, void 0, void 0, function () {
397
445
  return __generator(this, function (_a) {
446
+ (0, utils_1.methodNotSupportedOnWeb)('setAirshipChannelID');
398
447
  return [2 /*return*/];
399
448
  });
400
449
  }); },
401
450
  setMediaSource: function (_mediaSource) { return __awaiter(void 0, void 0, void 0, function () {
402
451
  return __generator(this, function (_a) {
452
+ (0, utils_1.methodNotSupportedOnWeb)('setMediaSource');
403
453
  return [2 /*return*/];
404
454
  });
405
455
  }); },
406
456
  setMediaCampaign: function () { return __awaiter(void 0, void 0, void 0, function () {
407
457
  return __generator(this, function (_a) {
458
+ (0, utils_1.methodNotSupportedOnWeb)('setMediaCampaign');
408
459
  return [2 /*return*/];
409
460
  });
410
461
  }); },
411
462
  setCampaign: function (_campaign) { return __awaiter(void 0, void 0, void 0, function () {
412
463
  return __generator(this, function (_a) {
464
+ (0, utils_1.methodNotSupportedOnWeb)('setCampaign');
413
465
  return [2 /*return*/];
414
466
  });
415
467
  }); },
416
468
  setAdGroup: function (_adGroup) { return __awaiter(void 0, void 0, void 0, function () {
417
469
  return __generator(this, function (_a) {
470
+ (0, utils_1.methodNotSupportedOnWeb)('setAdGroup');
418
471
  return [2 /*return*/];
419
472
  });
420
473
  }); },
421
474
  setAd: function (_ad) { return __awaiter(void 0, void 0, void 0, function () {
422
475
  return __generator(this, function (_a) {
476
+ (0, utils_1.methodNotSupportedOnWeb)('setAd');
423
477
  return [2 /*return*/];
424
478
  });
425
479
  }); },
426
480
  setKeyword: function (_keyword) { return __awaiter(void 0, void 0, void 0, function () {
427
481
  return __generator(this, function (_a) {
482
+ (0, utils_1.methodNotSupportedOnWeb)('setKeyword');
428
483
  return [2 /*return*/];
429
484
  });
430
485
  }); },
431
486
  setCreative: function (_creative) { return __awaiter(void 0, void 0, void 0, function () {
432
487
  return __generator(this, function (_a) {
488
+ (0, utils_1.methodNotSupportedOnWeb)('setCreative');
433
489
  return [2 /*return*/];
434
490
  });
435
491
  }); },
436
492
  canMakePayments: function (_features) { return __awaiter(void 0, void 0, void 0, function () {
437
493
  return __generator(this, function (_a) {
438
- // In preview mode, return false (no payments can be made)
439
- return [2 /*return*/, false];
494
+ return [2 /*return*/, true];
440
495
  });
441
496
  }); },
442
497
  beginRefundRequestForActiveEntitlement: function () { return __awaiter(void 0, void 0, void 0, function () {
443
498
  return __generator(this, function (_a) {
444
- return [2 /*return*/, 0];
499
+ (0, utils_1.methodNotSupportedOnWeb)('beginRefundRequestForActiveEntitlement');
500
+ return [2 /*return*/];
445
501
  });
446
502
  }); },
447
503
  beginRefundRequestForEntitlementId: function (_entitlementIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
448
504
  return __generator(this, function (_a) {
449
- return [2 /*return*/, 0];
505
+ (0, utils_1.methodNotSupportedOnWeb)('beginRefundRequestForEntitlementId');
506
+ return [2 /*return*/];
450
507
  });
451
508
  }); },
452
509
  beginRefundRequestForProductId: function (_productIdentifier) { return __awaiter(void 0, void 0, void 0, function () {
453
510
  return __generator(this, function (_a) {
454
- return [2 /*return*/, 0];
511
+ (0, utils_1.methodNotSupportedOnWeb)('beginRefundRequestForProductId');
512
+ return [2 /*return*/];
455
513
  });
456
514
  }); },
457
515
  showManageSubscriptions: function () { return __awaiter(void 0, void 0, void 0, function () {
458
516
  return __generator(this, function (_a) {
517
+ (0, utils_1.methodNotSupportedOnWeb)('showManageSubscriptions');
459
518
  return [2 /*return*/];
460
519
  });
461
520
  }); },
462
521
  showInAppMessages: function (_messageTypes) { return __awaiter(void 0, void 0, void 0, function () {
463
522
  return __generator(this, function (_a) {
523
+ (0, utils_1.methodNotSupportedOnWeb)('showInAppMessages');
464
524
  return [2 /*return*/];
465
525
  });
466
526
  }); },
467
527
  isWebPurchaseRedemptionURL: function (_urlString) { return __awaiter(void 0, void 0, void 0, function () {
468
528
  return __generator(this, function (_a) {
469
- // In preview mode, we'll return false for any URL
470
- return [2 /*return*/, false];
529
+ (0, utils_1.methodNotSupportedOnWeb)('isWebPurchaseRedemptionURL');
530
+ return [2 /*return*/];
471
531
  });
472
532
  }); },
473
533
  isConfigured: function () { return __awaiter(void 0, void 0, void 0, function () {
474
534
  return __generator(this, function (_a) {
475
- return [2 /*return*/, true];
535
+ return [2 /*return*/, purchases_js_hybrid_mappings_1.PurchasesCommon.isConfigured()];
476
536
  });
477
537
  }); },
478
538
  redeemWebPurchase: function (_urlString) { return __awaiter(void 0, void 0, void 0, function () {
479
539
  return __generator(this, function (_a) {
480
- return [2 /*return*/, {
481
- result: purchases_typescript_internal_1.WebPurchaseRedemptionResultType.SUCCESS,
482
- customerInfo: previewCustomerInfo
483
- }];
540
+ (0, utils_1.methodNotSupportedOnWeb)('redeemWebPurchase');
541
+ return [2 /*return*/];
542
+ });
543
+ }); },
544
+ getVirtualCurrencies: function () { return __awaiter(void 0, void 0, void 0, function () {
545
+ return __generator(this, function (_a) {
546
+ (0, utils_1.methodNotSupportedOnWeb)('getVirtualCurrencies');
547
+ return [2 /*return*/];
548
+ });
549
+ }); },
550
+ invalidateVirtualCurrenciesCache: function () { return __awaiter(void 0, void 0, void 0, function () {
551
+ return __generator(this, function (_a) {
552
+ (0, utils_1.methodNotSupportedOnWeb)('invalidateVirtualCurrenciesCache');
553
+ return [2 /*return*/];
554
+ });
555
+ }); },
556
+ getCachedVirtualCurrencies: function () { return __awaiter(void 0, void 0, void 0, function () {
557
+ return __generator(this, function (_a) {
558
+ (0, utils_1.methodNotSupportedOnWeb)('getCachedVirtualCurrencies');
559
+ return [2 /*return*/];
484
560
  });
485
561
  }); },
486
562
  };