Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
711 lines
24 KiB
TypeScript
711 lines
24 KiB
TypeScript
// Module ID: 11185
|
|
// Function ID: 11186
|
|
// Name: IAPUtils
|
|
// Dependencies: [5, 17, 4635, 4852, 1371, 7340, 1074, 1373, 11186, 3, 38, 1363, 11205, 7343, 12, 1254, 4309, 504, 11206, 1362, 4615, 11207, 2]
|
|
// Exports: makeIAPRequest, manageSubscription, shouldMockIAPForceEnable, useCanPurchaseIAP
|
|
|
|
// Module 11185 (IAPUtils)
|
|
import LoggerDefault from "Logger" /* 3 */;
|
|
import _modDef12 from "module_12" /* 12 */;
|
|
import _modDef38 from "module_38" /* 38 */;
|
|
import v1 from "v1" /* 1254 */;
|
|
import ClientInfoUtilsAll from "ClientInfoUtils" /* 1362 */;
|
|
import PlatformUtils2 from "PlatformUtils" /* 1363 */;
|
|
import DeviceUtils from "DeviceUtils" /* 4615 */;
|
|
import StorekitIAPQueueDefault from "StorekitIAPQueue" /* 11205 */;
|
|
import GeneratedPaymentCurrencies from "GeneratedPaymentCurrencies" /* 11206 */;
|
|
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
|
|
import DevSettingsStore from "DevSettingsStore" /* 4635 */;
|
|
import UserStore from "UserStore" /* 1371 */;
|
|
import IAPStore from "IAPStore" /* 7340 */;
|
|
|
|
const require = globalThis.__r;
|
|
|
|
require = fn;
|
|
function serializePurchaseResponse(originalTransactionDate) {
|
|
_modDef38(null != originalTransactionDate.transactionId, "should have transactionId");
|
|
const obj = { originalTransactionDate: originalTransactionDate.originalTransactionDateIOS, originalTransactionIdentifier: null, transactionDate: null, transactionIdentifier: null, productIdentifier: null, transactionReceipt: null, jwsRepresentation: null };
|
|
let parsed;
|
|
if (null != originalTransactionDate.originalTransactionIdentifierIOS) {
|
|
const _parseInt = parseInt;
|
|
parsed = parseInt(originalTransactionDate.originalTransactionIdentifierIOS);
|
|
}
|
|
obj.originalTransactionIdentifier = parsed;
|
|
obj.transactionDate = originalTransactionDate.transactionDate;
|
|
obj.transactionIdentifier = parseInt(originalTransactionDate.transactionId);
|
|
({ productId: obj.productIdentifier, transactionReceipt: obj.transactionReceipt, verificationResultIOS: obj.jwsRepresentation } = originalTransactionDate);
|
|
return obj;
|
|
}
|
|
function convertToUUID(id) {
|
|
return v1.v5(id, NAMESPACE_SNOWFLAKE_UUID);
|
|
}
|
|
let closure_16 = async function _restorePurchases(arg0) {
|
|
let fullRestore = arg0;
|
|
c7 = 0;
|
|
c8 = 0;
|
|
let iter = (async (arg0, value) => {
|
|
if (c8 === 2) {
|
|
c8 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp4 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c8 = 2;
|
|
if (0 === c7) {
|
|
if (arg0 === 1) {
|
|
c8 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c8 = 3;
|
|
let obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
closure_3 = tmp2;
|
|
closure_4 = tmp5;
|
|
let fullRestore2;
|
|
fullRestore2 = fullRestore.fullRestore;
|
|
closure_132_1 = undefined;
|
|
closure_132_2 = undefined;
|
|
closure_132_3 = undefined;
|
|
c7 = 1;
|
|
c8 = 1;
|
|
return { value: "PX_16", done: true };
|
|
}
|
|
} else if (1 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c8 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c8 = 3;
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else if (closure_131_17()) {
|
|
if (fullRestore2) {
|
|
c7 = 2;
|
|
c8 = 1;
|
|
const obj6 = { value: obj9.sync(), done: false };
|
|
return obj6;
|
|
} else {
|
|
c7 = 3;
|
|
c8 = 1;
|
|
const obj7 = { value: obj9.getPendingTransactions(), done: false };
|
|
return obj7;
|
|
}
|
|
} else {
|
|
c8 = 3;
|
|
const obj8 = { value: [], done: true };
|
|
return obj8;
|
|
}
|
|
} else if (2 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c8 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c8 = 3;
|
|
const obj10 = { value, done: true };
|
|
return obj10;
|
|
} else {
|
|
arr2 = closure_131_1(closure_131_3[14]);
|
|
c7 = 4;
|
|
c8 = 1;
|
|
const obj11 = { value: closure_131_0(closure_131_3[8]).getAvailablePurchases({ onlyIncludeActiveItems: false }), done: false };
|
|
return obj11;
|
|
}
|
|
} else if (3 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c8 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c8 = 3;
|
|
const obj12 = { value, done: true };
|
|
return obj12;
|
|
} else {
|
|
closure_132_2 = value;
|
|
closure_132_3 = closure_131_1(closure_131_3[14]).map(closure_132_2, (id) => id.id);
|
|
arr4 = closure_131_1(closure_131_3[14]);
|
|
filter = arr4.filter;
|
|
const arr3 = closure_131_1(closure_131_3[14]);
|
|
c7 = 5;
|
|
c8 = 1;
|
|
const obj13 = { value: closure_131_0(closure_131_3[8]).getAvailablePurchases({ onlyIncludeActiveItems: false }), done: false };
|
|
return obj13;
|
|
}
|
|
} else {
|
|
if (4 === tmp5) {
|
|
if (arg0 === 1) {
|
|
c8 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c8 = 3;
|
|
const obj14 = { value, done: true };
|
|
return obj14;
|
|
} else {
|
|
closure_132_1 = map(value, (originalPurchase) => {
|
|
const obj = { originalPurchase, purchaseResponse: null };
|
|
filter(closure_1_3[10])(null != originalPurchase.transactionId, "should have transactionId");
|
|
const obj3 = { originalTransactionDate: originalPurchase.originalTransactionDateIOS, originalTransactionIdentifier: null, transactionDate: null, transactionIdentifier: null, productIdentifier: null, transactionReceipt: null, jwsRepresentation: null };
|
|
let parsed;
|
|
if (null != originalPurchase.originalTransactionIdentifierIOS) {
|
|
const _parseInt = parseInt;
|
|
parsed = parseInt(originalPurchase.originalTransactionIdentifierIOS);
|
|
}
|
|
obj3.originalTransactionIdentifier = parsed;
|
|
obj3.transactionDate = originalPurchase.transactionDate;
|
|
obj3.transactionIdentifier = parseInt(originalPurchase.transactionId);
|
|
({ productId: obj2.productIdentifier, transactionReceipt: obj2.transactionReceipt, verificationResultIOS: obj2.jwsRepresentation } = originalPurchase);
|
|
obj.purchaseResponse = obj3;
|
|
return obj;
|
|
});
|
|
c8 = 3;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c8 = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
closure_132_1 = filter(value, (transactionId) => {
|
|
let hasItem = null != transactionId.transactionId;
|
|
if (hasItem) {
|
|
const _parseInt = parseInt;
|
|
hasItem = closure_1_3.includes(parseInt(transactionId.transactionId));
|
|
}
|
|
return hasItem;
|
|
}).map((originalPurchase) => {
|
|
const obj = { originalPurchase, purchaseResponse: null };
|
|
filter(closure_1_3[10])(null != originalPurchase.transactionId, "should have transactionId");
|
|
const obj3 = { originalTransactionDate: originalPurchase.originalTransactionDateIOS, originalTransactionIdentifier: null, transactionDate: null, transactionIdentifier: null, productIdentifier: null, transactionReceipt: null, jwsRepresentation: null };
|
|
let parsed;
|
|
if (null != originalPurchase.originalTransactionIdentifierIOS) {
|
|
const _parseInt = parseInt;
|
|
parsed = parseInt(originalPurchase.originalTransactionIdentifierIOS);
|
|
}
|
|
obj3.originalTransactionIdentifier = parsed;
|
|
obj3.transactionDate = originalPurchase.transactionDate;
|
|
obj3.transactionIdentifier = parseInt(originalPurchase.transactionId);
|
|
({ productId: obj2.productIdentifier, transactionReceipt: obj2.transactionReceipt, verificationResultIOS: obj2.jwsRepresentation } = originalPurchase);
|
|
obj.purchaseResponse = obj3;
|
|
return obj;
|
|
});
|
|
const arr = filter(value, (transactionId) => {
|
|
let hasItem = null != transactionId.transactionId;
|
|
if (hasItem) {
|
|
const _parseInt = parseInt;
|
|
hasItem = closure_1_3.includes(parseInt(transactionId.transactionId));
|
|
}
|
|
return hasItem;
|
|
});
|
|
}
|
|
c8 = 3;
|
|
let obj = { value, done: true };
|
|
return obj;
|
|
}
|
|
} catch (tmp23) {
|
|
c8 = tmp;
|
|
throw tmp23;
|
|
}
|
|
}
|
|
})();
|
|
iter.next();
|
|
return iter;
|
|
};
|
|
function isStorekit2Available() {
|
|
let isIOSResult = PlatformUtils2.isIOS();
|
|
if (isIOSResult) {
|
|
let isAvailableResult;
|
|
if (closure_1_12 != null) {
|
|
isAvailableResult = obj2.isAvailable();
|
|
}
|
|
isIOSResult = 1 === isAvailableResult;
|
|
obj2 = closure_1_12;
|
|
}
|
|
return isIOSResult;
|
|
}
|
|
function remapStorefront(countryCode) {
|
|
const country = convertToAlpha2(countryCode.countryCode);
|
|
if (null == countryCode.currency) {
|
|
if (null == GeneratedPaymentCurrencies.GeneratedPaymentCurrenciesSets.APPLE_STORE_COUNTRY_CURRENCIES[country]) {
|
|
const _Error = Error;
|
|
const _HermesInternal = HermesInternal;
|
|
const error = new Error("Unable to get currency from countryCode " + countryCode.countryCode);
|
|
throw error;
|
|
}
|
|
} else {
|
|
const currency = React6[str.toUpperCase(str)];
|
|
}
|
|
return { currency, country };
|
|
}
|
|
let closure_19 = async function _fetchStoreFront(arg0, value) {
|
|
if (c5 === 2) {
|
|
c5 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp6 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c5 = 2;
|
|
if (0 === c4) {
|
|
if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 3;
|
|
const obj5 = { value, done: true };
|
|
return obj5;
|
|
} else {
|
|
closure_1 = tmp3;
|
|
closure_0 = tmp7;
|
|
closure_128_0 = undefined;
|
|
if (isStorekit2Available()) {
|
|
c3 = 1;
|
|
c4 = 2;
|
|
c5 = 1;
|
|
const obj6 = { value: require("module_11186").getStorefront(), done: false };
|
|
return obj6;
|
|
} else {
|
|
c5 = 3;
|
|
return { value: null, done: true };
|
|
}
|
|
}
|
|
} else if (1 === tmp7) {
|
|
c3 = 0;
|
|
closure_128_1 = closure_2;
|
|
const result = closure_129_0(closure_129_3[16]).captureBillingException(closure_128_1);
|
|
c5 = 3;
|
|
return { value: null, done: true };
|
|
} else if (arg0 === 1) {
|
|
c5 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c3 = 0;
|
|
c5 = 3;
|
|
const obj = { value, done: true };
|
|
return obj;
|
|
} else {
|
|
closure_128_0 = value;
|
|
if (null != closure_128_0) {
|
|
closure_129_18(closure_128_0);
|
|
}
|
|
c3 = 0;
|
|
c5 = 3;
|
|
}
|
|
} catch (tmp28) {
|
|
closure_2 = tmp28;
|
|
if (tmp4 === c3) {
|
|
c5 = tmp2;
|
|
throw tmp28;
|
|
} else {
|
|
c4 = tmp;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const convertToAlpha2 = fn(4852).convertToAlpha2;
|
|
const Constants = fn(1074);
|
|
({ CurrencyCodes: closure_8, IOS_BUNDLE_ID } = Constants);
|
|
const NAMESPACE_SNOWFLAKE_UUID = fn(1373).NAMESPACE_SNOWFLAKE_UUID;
|
|
({ InAppUtils: closure_11, RNIapIosSk2: closure_12 } = fn(17).NativeModules);
|
|
let items = [fn(11186).ErrorCode.E_USER_CANCELLED, Constants.StoreKitErrors.PAYMENT_CANCELED];
|
|
let set = new Set(items);
|
|
new LoggerDefault("IAPUtils.tsx");
|
|
let obj = {
|
|
loadProducts() {
|
|
if (obj.isIOS()) {
|
|
const _Object = Object;
|
|
let items = [StorekitIAPQueueDefault.fetchSubscriptions(Object.values(tmp(7343).ProductIds)), ];
|
|
const _Object2 = Object;
|
|
items[1] = StorekitIAPQueueDefault.fetchProducts(Object.values(tmp(7343).ProductIds));
|
|
let nextPromise = _Promise.all(items).then((result) => {
|
|
[r10007, tmp] = result;
|
|
set = new Set();
|
|
const items = [...tmp];
|
|
return _modDef12.filter(items, (identifier) => {
|
|
const hasItem = set.has(identifier.identifier);
|
|
let flag = !hasItem;
|
|
if (!hasItem) {
|
|
set.add(identifier.identifier);
|
|
flag = true;
|
|
}
|
|
return flag;
|
|
});
|
|
});
|
|
const allResult = _Promise.all(items);
|
|
} else {
|
|
nextPromise = _Promise.resolve([]);
|
|
}
|
|
return nextPromise;
|
|
},
|
|
purchaseProduct(arg0, arg1, arg2) {
|
|
closure_1 = arg1;
|
|
closure_2 = arg2;
|
|
closure_0 = asyncGeneratorStep(async (sku, withOffer) => {
|
|
c6 = 0;
|
|
c7 = 0;
|
|
c5 = 0;
|
|
return (async (arg0, value) => {
|
|
if (c7 === 2) {
|
|
c7 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp6 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj3 = { value, done: true };
|
|
return obj3;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c7 = 2;
|
|
if (0 === c6) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
const obj4 = { value, done: true };
|
|
return obj4;
|
|
} else {
|
|
closure_3 = tmp3;
|
|
appAccountToken = tmp7;
|
|
closure_130_0 = sku;
|
|
closure_130_1 = withOffer;
|
|
closure_130_2 = undefined;
|
|
if (null != currentUser.getCurrentUser()) {
|
|
c5 = 1;
|
|
c6 = 2;
|
|
c7 = 1;
|
|
const obj5 = { value: sku(11186).clearTransactionIOS(), done: false };
|
|
return obj5;
|
|
} else {
|
|
const _Error2 = Error;
|
|
const error = new Error("purchaseProduct: no valid user");
|
|
tmp48(error);
|
|
}
|
|
tmp48 = withOffer;
|
|
}
|
|
} else {
|
|
if (1 === tmp7) {
|
|
c5 = 0;
|
|
closure_130_1(closure_4);
|
|
} else if (2 === tmp7) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c5 = 0;
|
|
c7 = 3;
|
|
const obj7 = { value, done: true };
|
|
return obj7;
|
|
} else {
|
|
const obj8 = { sku, appAccountToken, withOffer };
|
|
c6 = 3;
|
|
c7 = 1;
|
|
const obj9 = { value: sku(11186).requestPurchase(obj8), done: false };
|
|
return obj9;
|
|
}
|
|
} else if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
closure_130_2 = value;
|
|
const _Object = Object;
|
|
if (closure_130_2 instanceof Object) {
|
|
closure_130_0(serializePurchaseResponse(closure_130_2));
|
|
c5 = 0;
|
|
} else {
|
|
const _Error = Error;
|
|
const error1 = new Error("Unable to select a platform, no request was made");
|
|
throw error1;
|
|
}
|
|
}
|
|
c5 = 0;
|
|
c7 = 3;
|
|
const obj = { value, done: true };
|
|
return obj;
|
|
}
|
|
c7 = 3;
|
|
} catch (tmp38) {
|
|
closure_4 = tmp38;
|
|
if (tmp4 === c5) {
|
|
c7 = tmp2;
|
|
throw tmp38;
|
|
} else {
|
|
c6 = tmp;
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
return new Promise(function() {
|
|
const self = this;
|
|
const apply = closure_0.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
});
|
|
},
|
|
canMakePayments() {
|
|
return new Promise((arg0, arg1) => {
|
|
closure_0 = arg0;
|
|
closure_1 = arg1;
|
|
closure_1_11.canMakePayments((arg0) => {
|
|
if (!arg0) {
|
|
const _Error = Error;
|
|
const error = new Error();
|
|
closure_1(error);
|
|
}
|
|
closure_0(arg0);
|
|
});
|
|
});
|
|
},
|
|
restorePurchases() {
|
|
const self = this;
|
|
const apply = closure_16.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
},
|
|
fetchStoreFront() {
|
|
const self = this;
|
|
const apply = closure_19.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
}
|
|
};
|
|
let PlatformUtils = fn(1363);
|
|
PlatformUtils = PlatformUtils.isIOS();
|
|
if (PlatformUtils) {
|
|
let isIOSResult1 = fn(1363).isIOS();
|
|
if (isIOSResult1) {
|
|
let Identifier = ClientInfoUtilsAll.getConstants().Identifier;
|
|
let _HermesInternal = HermesInternal;
|
|
let isRunningOnSimulator = Identifier.startsWith("" + IOS_BUNDLE_ID + ".local");
|
|
if (!isRunningOnSimulator) {
|
|
isRunningOnSimulator = fn(4615).getIsRunningOnSimulator();
|
|
let obj6 = fn(4615);
|
|
}
|
|
isIOSResult1 = isRunningOnSimulator;
|
|
const importAllResult = ClientInfoUtilsAll;
|
|
}
|
|
let value = isIOSResult1;
|
|
if (!value) {
|
|
value = DevSettingsStore.get("force_mock_iap");
|
|
}
|
|
PlatformUtils = value;
|
|
let obj4 = fn(1363);
|
|
}
|
|
if (PlatformUtils) {
|
|
obj = fn(11207).default;
|
|
}
|
|
function shouldMockIAPForceEnable() {
|
|
let isIOSResult = PlatformUtils2.isIOS();
|
|
if (isIOSResult) {
|
|
const Identifier = ClientInfoUtilsAll.getConstants().Identifier;
|
|
const _HermesInternal = HermesInternal;
|
|
let isRunningOnSimulator = Identifier.startsWith("" + IOS_BUNDLE_ID + ".local");
|
|
if (!isRunningOnSimulator) {
|
|
isRunningOnSimulator = DeviceUtils.getIsRunningOnSimulator();
|
|
const tmpResult = DeviceUtils;
|
|
}
|
|
isIOSResult = isRunningOnSimulator;
|
|
}
|
|
return isIOSResult;
|
|
}
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("utils/native/IAPUtils.tsx");
|
|
|
|
export default obj;
|
|
export { convertToUUID };
|
|
export const makeIAPRequest = function makeIAPRequest(arg0, arg1, arg2) {
|
|
closure_1 = arg1;
|
|
closure_2 = arg2;
|
|
closure_0 = asyncGeneratorStep(async (requestJSONString, sku) => {
|
|
c6 = 0;
|
|
c7 = 0;
|
|
c5 = 0;
|
|
return (async (arg0, value) => {
|
|
if (c7 === 2) {
|
|
c7 = 3;
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
} else if (tmp6 === 3) {
|
|
if (arg0 === 1) {
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
const obj2 = { value, done: true };
|
|
return obj2;
|
|
} else {
|
|
return { value: "HermesInternal", done: null };
|
|
}
|
|
} else {
|
|
try {
|
|
c7 = 2;
|
|
if (0 === c6) {
|
|
if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw value;
|
|
} else if (arg0 === 2) {
|
|
c7 = 3;
|
|
const obj5 = { value, done: true };
|
|
return obj5;
|
|
} else {
|
|
closure_3 = tmp3;
|
|
useACOM = tmp7;
|
|
closure_130_0 = requestJSONString;
|
|
closure_130_1 = sku;
|
|
closure_130_2 = undefined;
|
|
currentUser = currentUser.getCurrentUser();
|
|
if (null != currentUser) {
|
|
c5 = 1;
|
|
const obj6 = { requestJSONString, sku, appAccountToken: convertToUUID(currentUser.id), andDangerouslyFinishTransactionAutomaticallyIOS: false, useACOM };
|
|
c6 = 2;
|
|
c7 = 1;
|
|
const obj7 = { value: requestJSONString(11186).requestPurchase(obj6), done: false };
|
|
return obj7;
|
|
} else {
|
|
const _Error2 = Error;
|
|
const error = new Error("purchaseProduct: no valid user");
|
|
tmp61(error);
|
|
}
|
|
tmp61 = sku;
|
|
}
|
|
} else {
|
|
if (1 === tmp7) {
|
|
c5 = 0;
|
|
closure_130_3 = closure_4;
|
|
if (!set.has(closure_130_3.code)) {
|
|
const result = requestJSONString(4309).captureBillingException(closure_130_3);
|
|
const obj3 = requestJSONString(4309);
|
|
}
|
|
closure_130_1(closure_130_3);
|
|
} else if (arg0 === 1) {
|
|
c7 = 3;
|
|
throw value;
|
|
} else if (arg0 !== 2) {
|
|
closure_130_2 = value;
|
|
const _Object = Object;
|
|
if (closure_130_2 instanceof Object) {
|
|
const obj = { purchaseResponse: serializePurchaseResponse(closure_130_2), originalPurchase: null };
|
|
const _Array = Array;
|
|
if (Array.isArray(closure_130_2)) {
|
|
let first = tmp19[0];
|
|
} else {
|
|
first = tmp19;
|
|
}
|
|
obj.originalPurchase = first;
|
|
closure_130_0(obj);
|
|
c5 = 0;
|
|
} else {
|
|
const _Error = Error;
|
|
const error1 = new Error("Unable to select a platform, no request was made");
|
|
throw error1;
|
|
}
|
|
}
|
|
c5 = 0;
|
|
c7 = 3;
|
|
const obj8 = { value, done: true };
|
|
return obj8;
|
|
}
|
|
c7 = 3;
|
|
} catch (tmp49) {
|
|
closure_4 = tmp49;
|
|
if (tmp4 === c5) {
|
|
c7 = tmp2;
|
|
throw tmp49;
|
|
} else {
|
|
c6 = tmp;
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
});
|
|
return new Promise(function() {
|
|
const self = this;
|
|
const apply = closure_0.apply;
|
|
if (typeof apply === "unknown") {
|
|
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
|
|
} else {
|
|
applyArgumentsResult = apply(self, arguments);
|
|
}
|
|
return applyArgumentsResult;
|
|
});
|
|
};
|
|
export const useCanPurchaseIAP = function useCanPurchaseIAP(productId) {
|
|
_require = productId;
|
|
const items = [UserStore];
|
|
closure_1 = require("initialize").useStateFromStores(items, () => {
|
|
currentUser = currentUser.getCurrentUser();
|
|
let flag;
|
|
if (currentUser != null) {
|
|
flag = currentUser.verified;
|
|
}
|
|
if (flag == null) {
|
|
flag = false;
|
|
}
|
|
return flag;
|
|
}, []);
|
|
const obj = require("initialize");
|
|
const items1 = [IAPStore];
|
|
return !require("initialize").useStateFromStores(items1, () => {
|
|
const isReadyResult = IAPStore.isReady();
|
|
let tmp2 = !isReadyResult;
|
|
if (isReadyResult) {
|
|
let isBusyResult = obj.isBusy();
|
|
if (isBusyResult) {
|
|
isBusyResult = null == closure_0 || !obj.isPurchasingProduct(tmp4);
|
|
const tmp6 = null == closure_0 || !obj.isPurchasingProduct(tmp4);
|
|
}
|
|
tmp2 = isBusyResult;
|
|
}
|
|
if (!tmp2) {
|
|
tmp2 = !closure_1;
|
|
}
|
|
return tmp2;
|
|
});
|
|
};
|
|
export { isStorekit2Available };
|
|
export { remapStorefront };
|
|
export const manageSubscription = function manageSubscription() {
|
|
let isIOSResult = PlatformUtils2.isIOS();
|
|
if (isIOSResult) {
|
|
let isAvailableResult;
|
|
if (closure_1_12 != null) {
|
|
isAvailableResult = obj2.isAvailable();
|
|
}
|
|
isIOSResult = 1 === isAvailableResult;
|
|
obj2 = closure_1_12;
|
|
}
|
|
if (isIOSResult) {
|
|
let result = closure_1_12.showManageSubscriptions();
|
|
} else {
|
|
const _Error = Error;
|
|
const error = new Error("StoreKit 2 is not available");
|
|
result = Promise.reject(error);
|
|
}
|
|
return result;
|
|
};
|
|
export { shouldMockIAPForceEnable };
|