Files
discord-decomp/sources/modules/premium/PremiumSubscriptionInvoice.tsx
2026-07-28 01:06:53 +03:00

1976 lines
93 KiB
TypeScript

/* Metro module 7545; source: modules/premium/PremiumSubscriptionInvoice.tsx; dependencies: [29, 57, 5, 31, 3811, 661, 3802, 507, 694, 4131, 44, 4141, 2] */
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
import ObjectWithoutProperties from '../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
import InvoiceRecord from '../../records/InvoiceRecord.tsx'; /* Metro dependency 3811 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
function _fun60640(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60640, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:6, offset: 0x01709111, size: 415 bytes, params: 8, frame: 24
let env0_0 = require;
const closure = function() {
return _createSubscriptionInvoicePreview.apply(this, arguments);
};
const closure2 = function() {
return _updateSubscriptionInvoicePreview.apply(this, arguments);
};
const closure3 = function() {
return _createOneTimePurchaseInvoicePreview.apply(this, arguments);
};
const closure4 = function() {
return _getSubscriptionInvoice.apply(this, arguments);
};
const useFetchGenericInvoicePreview2 = useFetchGenericInvoicePreview;
const getPaymentSourceIdFromInvoiceRecord = function({checkoutContext}) {
var r5;
var r2;
var r0;
var value3;
var value = null;
var value2 = undefined;
r5 = value == checkoutContext ? value2 : checkoutContext.payment_sources;
if (value == r5) {
r0 = value;
} else {
value3 = r5.find(_fun60667);
r2 = value == value3 ? value2 : value3.id;
r0 = value != r2 ? r2 : value;
}
return r0;
};
const env0_3 = ['subscriptionId'];
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
const env0_7 = value.useCallback;
const env0_8 = value.useEffect;
const env0_9 = value.useState;
const env0_10 = value.useRef;
(FileImportTrackerModule).fileFinishedImporting('modules/premium/PremiumSubscriptionInvoice.tsx');
exports.createSubscriptionInvoicePreview = closure;
exports.updateSubscriptionInvoicePreview = closure2;
exports.createOneTimePurchaseInvoicePreview = closure3;
exports.getSubscriptionInvoice = closure4;
exports.useFetchGenericInvoicePreview = useFetchGenericInvoicePreview2;
exports.useFetchSubscriptionGiftInvoicePreview = function(a0, a1) {
var env0_0 = a0;
var env0_1 = useRef(a0);
var env0_2 = useRef(false);
useEffect(_fun60669);
var JSON = global.JSON;
return useFetchGenericInvoicePreview(a0, useCallback(_fun60670, [JSON.stringify(a0)]), a1);
};
exports.useFetchSubscriptionInvoicePreview = useFetchSubscriptionInvoicePreview;
exports.useGetSubscriptionInvoice = function(a0, a1) {
var env0_0 = a0;
var env0_1 = useRef(a0);
useEffect(_fun60680);
var JSON = global.JSON;
return useFetchGenericInvoicePreview(a0, useCallback(_fun60681, [JSON.stringify(a0)]), a1);
};
exports.getItemUnitPriceWithDiscount = getItemUnitPriceWithDiscount;
function _createSubscriptionInvoicePreview() { // fn#60642, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:354, offset: 0x017092b0, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun60644).apply(this, arguments);
async function _fun60644({items, paymentSourceId, trialId, code, applyEntitlements, currency, renewal, metadata, loadId}) { // fn#60644, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:443, offset: 0x017092f2, size: 463 bytes, params: 2, frame: 28
var payment_sources;
var binding2;
var property;
var value9;
var HTTP;
var post;
var object;
var BILLING_SUBSCRIPTIONS_PREVIEW;
var value10;
var value11;
var value12;
var createInvoiceFromServer;
var body;
var invoiceFromServer;
var checkoutContext;
var value13;
var value14;
var binding3;
var value15;
var dispatch;
var error;
var BillingError;
var prototype;
var billingError;
if (false) {
return undefined;
}
value = undefined;
applyEntitlements = !(applyEntitlements === value) && applyEntitlements;
await value;
if (false) {
return undefined;
}
let object2 = {};
let binding = env2_0;
object2.items = binding(env2_2[6]).coerceExistingItemsToNewItemInterval(items).map(function(a0) {
var planId = a0.planId;
var value = Object.create(null);
value.planId = 0;
var value2 = copyDataProperties({}, a0, value, a0);
var object = {};
copyDataProperties(object, value2, value);
object['plan_id'] = planId;
return object;
});
object2.payment_source_id = paymentSourceId;
object2.trial_id = trialId;
object2.code = code;
object2.apply_entitlements = applyEntitlements;
object2.currency = currency;
object2.renewal = renewal;
object2.metadata = metadata;
object2.load_id = loadId;
try {
binding = env2_0;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding2 = env2_2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
property = binding2[7];
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value9 = binding(property);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
HTTP = value9.HTTP;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
post = HTTP.post;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding = env2_12;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
BILLING_SUBSCRIPTIONS_PREVIEW = binding.BILLING_SUBSCRIPTIONS_PREVIEW;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.url = BILLING_SUBSCRIPTIONS_PREVIEW;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.body = object2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.oldFormErrors = true;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.rejectWithError = false;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value10 = Reflect.apply(post, HTTP, [object]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
await value10;
try {
value11 = undefined;
value12 = false;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (value12) {
return value11;
}
try {
binding = env2_11;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
createInvoiceFromServer = binding.createInvoiceFromServer;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
body = value11.body;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
invoiceFromServer = Reflect.apply(createInvoiceFromServer, binding, [body]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
checkoutContext = invoiceFromServer.checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value13 = checkoutContext == null;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (value13) {
payment_sources = value;
} else {
try {
payment_sources = checkoutContext.payment_sources;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
}
try {
value14 = payment_sources == null;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (!value14) {
try {
binding = env2_1;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding3 = env2_2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
property = binding3[8];
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value15 = binding(property);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
dispatch = value15.dispatch;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2 = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.type = 'SUBSCRIPTION_PREVIEW_CHECKOUT_CONTEXT_UPDATE';
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
checkoutContext = invoiceFromServer.checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.checkoutContext = checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.paymentSourceId = paymentSourceId;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
Reflect.apply(dispatch, value15, [object2]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
}
return invoiceFromServer;
}
}
function _updateSubscriptionInvoicePreview() { // fn#60647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:1302, offset: 0x017094c1, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun60649).apply(this, arguments);
async function _fun60649({subscriptionId, items, paymentSourceId, renewal, currency, applyEntitlements, analyticsLocations, analyticsLocation, userDiscountOfferId}) { // fn#60649, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:1391, offset: 0x01709503, size: 508 bytes, params: 2, frame: 28
var environment;
var r19;
var payment_sources;
var r6;
var value6;
var binding;
var binding2;
var property;
var value11;
var HTTP;
var patch;
var object;
var BILLING_SUBSCRIPTION_PREVIEW;
var value12;
var object2;
var value13;
var value14;
var value15;
var createInvoiceFromServer;
var body;
var invoiceFromServer;
var value16;
var checkoutContext;
var value17;
var value18;
var binding3;
var value19;
var dispatch;
var error;
var BillingError;
var prototype;
var billingError;
if (false) {
return undefined;
}
value = undefined;
applyEntitlements = !(applyEntitlements === value) && applyEntitlements;
await value;
if (false) {
return undefined;
}
if (items == null) {
r19 = items;
} else {
value6 = environment.__proto__.__proto__;
binding = env2_0;
r19 = binding(env2_2[6]).coerceExistingItemsToNewItemInterval(items);
}
let object3 = {};
object3.items = r19 == null ? value : r19.map(function(a0) {
var planId = a0.planId;
var value = Object.create(null);
value.planId = 0;
var value2 = copyDataProperties({}, a0, value, a0);
var object = {};
copyDataProperties(object, value2, value);
object['plan_id'] = planId;
return object;
});
object3.payment_source_id = paymentSourceId;
object3.renewal = renewal;
object3.apply_entitlements = applyEntitlements;
object3.currency = currency;
object3.user_discount_offer_id = userDiscountOfferId;
try {
binding = env2_0;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding2 = env2_2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
property = binding2[7];
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value11 = binding(property);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
HTTP = value11.HTTP;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
patch = HTTP.patch;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding = env2_12;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
BILLING_SUBSCRIPTION_PREVIEW = binding.BILLING_SUBSCRIPTION_PREVIEW;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value12 = Reflect.apply(BILLING_SUBSCRIPTION_PREVIEW, binding, [subscriptionId]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.url = value12;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2 = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.location = analyticsLocation;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.location_stack = analyticsLocations;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.query = object2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.body = object3;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.oldFormErrors = true;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.rejectWithError = false;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value13 = Reflect.apply(patch, HTTP, [object]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
await value13;
try {
value14 = undefined;
value15 = false;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (value15) {
return value14;
}
try {
binding = env2_11;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
createInvoiceFromServer = binding.createInvoiceFromServer;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
body = value14.body;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
invoiceFromServer = Reflect.apply(createInvoiceFromServer, binding, [body]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value16 = paymentSourceId != null;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (value16) {
try {
checkoutContext = invoiceFromServer.checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value17 = checkoutContext == null;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (value17) {
try {
value18 = value != null;
r6 = value18;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (r6) {
try {
binding = env2_1;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding3 = env2_2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
property = binding3[8];
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value19 = binding(property);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
dispatch = value19.dispatch;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3 = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.type = 'SUBSCRIPTION_PREVIEW_CHECKOUT_CONTEXT_UPDATE';
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
checkoutContext = invoiceFromServer.checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.checkoutContext = checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.paymentSourceId = paymentSourceId;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
Reflect.apply(dispatch, value19, [object3]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
return invoiceFromServer;
}
return invoiceFromServer;
}
try {
payment_sources = checkoutContext.payment_sources;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value18 = payment_sources != null;
r6 = value18;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (r6) {
try {
binding = env2_1;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding3 = env2_2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
property = binding3[8];
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value19 = binding(property);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
dispatch = value19.dispatch;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3 = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.type = 'SUBSCRIPTION_PREVIEW_CHECKOUT_CONTEXT_UPDATE';
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
checkoutContext = invoiceFromServer.checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.checkoutContext = checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.paymentSourceId = paymentSourceId;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
Reflect.apply(dispatch, value19, [object3]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
return invoiceFromServer;
}
} else if (value16) {
try {
binding = env2_1;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding3 = env2_2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
property = binding3[8];
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value19 = binding(property);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
dispatch = value19.dispatch;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3 = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.type = 'SUBSCRIPTION_PREVIEW_CHECKOUT_CONTEXT_UPDATE';
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
checkoutContext = invoiceFromServer.checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.checkoutContext = checkoutContext;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object3.paymentSourceId = paymentSourceId;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
Reflect.apply(dispatch, value19, [object3]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
return invoiceFromServer;
}
return invoiceFromServer;
}
}
function _createOneTimePurchaseInvoicePreview() { // fn#60652, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:2369, offset: 0x017096ff, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun60654).apply(this, arguments);
async function _fun60654({paymentSourceId, skuId, subscriptionPlanId, currency, loadId}) { // fn#60654, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:2464, offset: 0x01709741, size: 287 bytes, params: 2, frame: 23
var binding2;
var property;
var value5;
var httpGetWithCountryCodeQuery;
var object;
var STORE_SKU_PURCHASE;
var value6;
var object2;
var value7;
var value8;
var value9;
var createInvoiceFromServer;
var body;
var invoiceFromServer;
var error;
var BillingError;
var prototype;
var billingError;
if (false) {
return undefined;
}
await undefined;
if (false) {
return undefined;
}
value = environment.__proto__.__proto__;
let binding = env2_1;
binding(env2_2[10])(skuId, 'SKU ID is missing for one time purchase gift invoice preview');
try {
binding = env2_0;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding2 = env2_2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
property = binding2[11];
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value5 = binding(property);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
httpGetWithCountryCodeQuery = value5.httpGetWithCountryCodeQuery;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
binding = env2_12;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
STORE_SKU_PURCHASE = binding.STORE_SKU_PURCHASE;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value6 = Reflect.apply(STORE_SKU_PURCHASE, binding, [skuId]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.url = value6;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2 = {};
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.gift = true;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.payment_source_id = paymentSourceId;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.sku_subscription_plan_id = subscriptionPlanId;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.currency = currency;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object2.load_id = loadId;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.query = object2;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.oldFormErrors = true;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
object.rejectWithError = false;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
value7 = Reflect.apply(httpGetWithCountryCodeQuery, value5, [object]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
await value7;
try {
value8 = undefined;
value9 = false;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
if (value9) {
return value8;
}
try {
binding = env2_11;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
createInvoiceFromServer = binding.createInvoiceFromServer;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
body = value8.body;
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
try {
invoiceFromServer = Reflect.apply(createInvoiceFromServer, binding, [body]);
} catch (error) {
binding = env2_0;
BillingError = binding(env2_2[9]).BillingError;
prototype = BillingError.prototype;
value = Object.create(prototype, {constructor: {value: BillingError}});
billingError = new BillingError();
value = billingError instanceof Object ? billingError : value;
throw value;
}
return invoiceFromServer;
}
}
function _getSubscriptionInvoice() { // fn#60656, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3022, offset: 0x01709860, size: 48 bytes, params: 1, frame: 14
return Module00005(_fun60658).apply(this, arguments);
async function _fun60658({subscriptionId, preventFetch}) { // fn#60658, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3091, offset: 0x017098a2, size: 156 bytes, params: 2, frame: 17
if (false) {
return undefined;
}
await undefined;
if (false) {
return undefined;
}
if (preventFetch) {
return null;
}
value = environment.__proto__.__proto__;
let binding = env2_0;
const HTTP = binding(env2_2[7]).HTTP;
const get = HTTP.get;
const object = {'url': null, 'oldFormErrors': true, 'rejectWithError': false};
object.url = env2_12.BILLING_SUBSCRIPTION_INVOICE(subscriptionId);
await Reflect.apply(get, HTTP, [object]);
if (false) {
return undefined;
}
binding = env2_11;
return binding.createInvoiceFromServer(undefined.body);
}
}
function useFetchGenericInvoicePreview({preventFetch}, a1, a2) { // fn#60659, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3326, offset: 0x0170993e, size: 161 bytes, params: 4, frame: 20
preventFetch = !(preventFetch === undefined) && preventFetch;
let env0_1 = a1;
const [property, env0_2] = Module00057(useState(null), 2);
const [property2, env0_3] = Module00057(useState(null), 2);
useEffect(function() {
var env0_1 = _fun60661;
var env0_0 = false;
if (!preventFetch) {
_fun60664();
}
return _fun60665;
}, [preventFetch, a1, a2]);
return [property, property2];
function _fun60660() { // fn#60660, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3470, offset: 0x017099df, size: 45 bytes, params: 1, frame: 10
if (!preventFetch) {
(function() {
return _loadPreview.apply(this, arguments);
})();
}
return function() {
env0_0 = true;
};
function _loadPreview() { // fn#60661, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3484, offset: 0x01709a0c, size: 51 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__.__proto__;
return env2_6(_fun60663).apply(this, arguments);
function* _fun60663() { // fn#60663, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3531, offset: 0x01709a48, size: 111 bytes, params: 1, frame: 15
var binding;
var defaultImport;
var value3;
var value4;
var preventFetchBinding;
var error;
var value6;
if (true) {
value = environment.__proto__.__proto__.__proto__;
try {
binding = env3_3;
} catch (error) {
value6 = environment.__proto__.__proto__;
if (!preventFetch) {
env3_3(error);
dependencyMap(null);
}
return undefined;
}
try {
binding(null);
} catch (error) {
value6 = environment.__proto__.__proto__;
if (!preventFetch) {
env3_3(error);
dependencyMap(null);
}
return undefined;
}
try {
} catch (error) {
value6 = environment.__proto__.__proto__;
if (!preventFetch) {
env3_3(error);
dependencyMap(null);
}
return undefined;
}
try {
defaultImport = importDefault();
} catch (error) {
value6 = environment.__proto__.__proto__;
if (!preventFetch) {
env3_3(error);
dependencyMap(null);
}
return undefined;
}
yield defaultImport;
try {
value3 = undefined;
value4 = false;
} catch (error) {
value6 = environment.__proto__.__proto__;
if (!preventFetch) {
env3_3(error);
dependencyMap(null);
}
return undefined;
}
if (value4) {
return value3;
}
try {
preventFetchBinding = preventFetch;
} catch (error) {
value6 = environment.__proto__.__proto__;
if (!preventFetch) {
env3_3(error);
dependencyMap(null);
}
return undefined;
}
if (!preventFetchBinding) {
try {
} catch (error) {
value6 = environment.__proto__.__proto__;
if (!preventFetch) {
env3_3(error);
dependencyMap(null);
}
return undefined;
}
try {
dependencyMap(value3);
} catch (error) {
value6 = environment.__proto__.__proto__;
if (!preventFetch) {
env3_3(error);
dependencyMap(null);
}
}
}
}
}
}
function loadPreview() { // fn#60664, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3643, offset: 0x00c3b2ba, size: 30 bytes, params: 1, frame: 13
return _loadPreview.apply(this, arguments);
}
function _fun60665() { // fn#60665, offset: 0x00e70226, size: 13 bytes, params: 1, frame: 2
}
}
}
function getPaymentSourceIdFromInvoiceRecord({checkoutContext}) { // fn#60666, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3739, offset: 0x01709ab7, size: 84 bytes, params: 2, frame: 14
const payment_sources = checkoutContext?.payment_sources;
return payment_sources == null ? null : payment_sources.find(function(a0) {
return a0.enabled;
})?.id ?? null;
}
function useFetchSubscriptionGiftInvoicePreview(a0, a1) { // fn#60668, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:4382, offset: 0x01709b0b, size: 110 bytes, params: 3, frame: 17
const env0_0 = a0;
const env0_1 = useRef(a0);
const env0_2 = useRef(false);
useEffect(_fun60669);
const JSON = global.JSON;
return useFetchGenericInvoicePreview(a0, useCallback(_fun60670, [JSON.stringify(a0)]), a1);
function _fun60669() { // fn#60669, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:4457, offset: 0x00e655cf, size: 21 bytes, params: 1, frame: 2
env0_1.current = env0_0;
}
function _fun60670() { // fn#60670, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:4506, offset: 0x01709b79, size: 81 bytes, params: 1, frame: 14
var r2;
var object;
const current = env0_1.current;
if (env0_2.current) {
r2 = current;
} else {
object = {};
copyDataProperties(object, current, undefined);
object['paymentSourceId'] = null;
r2 = object;
}
env0_2.current = true;
return createOneTimePurchaseInvoicePreview(r2);
}
}
function useFetchSubscriptionInvoicePreview(a0, a1) { // fn#60671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:4718, offset: 0x01709bca, size: 223 bytes, params: 3, frame: 21
var r3;
let value = a0;
if ('subscriptionId' in value) {
if (value.subscriptionId != null) {
r3 = value;
} else {
value.subscriptionId;
value = ObjectWithoutProperties(value, env0_3);
r3 = value;
}
} else {
r3 = value;
}
const env0_1 = useRef(r3);
const env0_2 = useRef(false);
const {serverPricedPreviewRef, shouldReturnInvoiceCache,
updateServerPricedPreviewRef} = useServerProvidedInvoiceCache(a1);
useEffect(_fun60676);
const JSON = global.JSON;
return useFetchGenericInvoicePreview(r3, useCallback(_fun60677, [JSON.stringify(r3), serverPricedPreviewRef,
shouldReturnInvoiceCache, updateServerPricedPreviewRef]), a1);
function useServerProvidedInvoiceCache(a0) { // fn#60672, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:4877, owner: useFetchSubscriptionInvoicePreview.useServerProvidedInvoiceCache, offset: 0x01709ca9, size: 101 bytes, params: 2, frame: 16
var environment;
const value = environment.__proto__;
const value2 = useRef(null);
useEffect(_fun60673, [a0]);
return {serverPricedPreviewRef: value2, shouldReturnInvoiceCache: useCallback(_fun60674, []),
updateServerPricedPreviewRef: useCallback(_fun60675, [])};
function _fun60673() { // fn#60673, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:4936, offset: 0x00c6baca, size: 19 bytes, params: 1, frame: 2
env0_0.current = null;
}
function _fun60674(a0, a1) { // fn#60674, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:4972, offset: 0x01709d0e, size: 71 bytes, params: 3, frame: 5
const current = env0_0.current;
return current != null && a0.paymentSourceId != null && a0.paymentSourceId === current.serverSelectedPaymentSourceId && a1 === current.dedupeKey;
}
function _fun60675(a0, a1, a2) { // fn#60675, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:5117, offset: 0x01709d55, size: 69 bytes, params: 4, frame: 14
var r0;
var object;
const binding = env0_0;
let value = null;
if (value == a2) {
object = {record: a0, dedupeKey: a1};
value = environment.__proto__.__proto__;
object.serverSelectedPaymentSourceId = getPaymentSourceIdFromInvoiceRecord(a0);
r0 = object;
} else {
r0 = value;
}
binding.current = r0;
}
}
function _fun60676() { // fn#60676, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:5435, offset: 0x00e655cf, size: 21 bytes, params: 1, frame: 2
env0_1.current = env0_0;
}
function _fun60677() { // fn#60677, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:5484, offset: 0x01709d9a, size: 263 bytes, params: 1, frame: 18
var environment;
var r2;
var r1;
var object;
var JSON;
var stringify;
var value2;
var Promise;
var value;
let current = env0_1.current;
if (env0_2.current) {
r2 = current;
} else {
object = {};
copyDataProperties(object, current, undefined);
object['paymentSourceId'] = null;
r2 = object;
}
if ('subscriptionId' in r2) {
env0_2.current = true;
value = environment.__proto__;
return updateSubscriptionInvoicePreview(r2);
}
if ('items' in r2) {
env0_2.current = true;
JSON = global.JSON;
stringify = JSON.stringify;
object = {};
copyDataProperties(object, r2, undefined);
object['paymentSourceId'] = 'exclude_from_dedupe';
value2 = Reflect.apply(stringify, JSON, [object]);
current = serverPricedPreviewRef.current;
if (current == null) {
value = environment.__proto__;
value = createSubscriptionInvoicePreview(r2);
value = value.then(_fun60678);
r1 = value;
} else if (shouldReturnInvoiceCache(r2, value2)) {
Promise = global.Promise;
r1 = Promise.resolve(current.record);
} else {
value = environment.__proto__;
value = createSubscriptionInvoicePreview(r2);
value = value.then(_fun60678);
r1 = value;
}
return r1;
}
return null;
function _fun60678(a0) { // fn#60678, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:5826, offset: 0x01709ea1, size: 38 bytes, params: 2, frame: 15
updateServerPricedPreviewRef(a0, env0_1, env0_0.paymentSourceId);
return a0;
}
}
}
function useGetSubscriptionInvoice(a0, a1) { // fn#60679, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:5959, offset: 0x01709ec7, size: 99 bytes, params: 3, frame: 17
const env0_0 = a0;
const env0_1 = useRef(a0);
useEffect(_fun60680);
const JSON = global.JSON;
return useFetchGenericInvoicePreview(a0, useCallback(_fun60681, [JSON.stringify(a0)]), a1);
function _fun60680() { // fn#60680, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:6013, offset: 0x00e655cf, size: 21 bytes, params: 1, frame: 2
env0_1.current = env0_0;
}
function _fun60681() { // fn#60681, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:6062, offset: 0x01709f2a, size: 28 bytes, params: 1, frame: 11
return getSubscriptionInvoice(env0_1.current);
}
}
function getItemUnitPriceWithDiscount(a0) { // fn#60682, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:6183, offset: 0x01709f46, size: 46 bytes, params: 2, frame: 12
const env0_0 = a0;
const subscriptionPlanPrice = a0.subscriptionPlanPrice;
a0.discounts.forEach(_fun60683);
return subscriptionPlanPrice;
function _fun60683({amount}) { // fn#60683, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:6282, offset: 0x01709f74, size: 42 bytes, params: 2, frame: 3
env0_1 = subscriptionPlanPrice - amount / env0_0.quantity;
}
}
}
function _fun60667(a0) { // fn#60667, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7723:3898, offset: 0x00df8de9, size: 10 bytes, params: 2, frame: 1
return a0.enabled;
}
global.__d(_fun60640, 7545, [29, 57, 5, 31, 3811, 661, 3802, 507, 694, 4131, 44, 4141,
2]) /* metro module 7545, dependencies: [29, 57, 5, 31, 3811, 661, 3802, 507, 694, 4131, 44, 4141, 2] */;