Files
discord-decomp/sources/stores/billing/PaymentSourceStore.tsx
T
2026-07-27 16:20:00 +03:00

245 lines
9.4 KiB
TypeScript

/* Metro module 3805; source: stores/billing/PaymentSourceStore.tsx; dependencies: [6, 7, 15, 17, 18, 3806, 566, 694, 2] */
function _fun29260(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#29260, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:6, offset: 0x00fbdb6d, size: 353 bytes, params: 8, frame: 19
const _arrayLikeToArray_29266 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const closure = BILLING_PAYMENT_SOURCE_CREATE_SUCCESS;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_0 = importDefault(6) /* metro dependency 6 */;
const env0_1 = importDefault(7) /* metro dependency 7 */;
const env0_2 = importDefault(15) /* metro dependency 15 */;
const env0_3 = importDefault(17) /* metro dependency 17 */;
const env0_4 = importDefault(18) /* metro dependency 18 */;
const paymentSourceRecord = importDefault(3806) /* metro dependency 3806: PaymentSourceRecord */;
let env0_6 = {};
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
let value = _fun29268(Store);
value.displayName = 'PaymentSourceStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{BILLING_PAYMENT_SOURCE_CREATE_SUCCESS: closure, BILLING_PAYMENT_SOURCE_UPDATE_SUCCESS: closure,
BILLING_PAYMENT_SOURCE_FETCH_SUCCESS: closure,
BILLING_PAYMENT_SOURCES_FETCH_SUCCESS: BILLING_PAYMENT_SOURCES_FETCH_SUCCESS,
BILLING_PAYMENT_SOURCE_REMOVE_SUCCESS: BILLING_PAYMENT_SOURCE_REMOVE_SUCCESS_29278, LOGOUT: function() {
env0_6 = {};
env0_7 = null;
env0_8 = false;
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/billing/PaymentSourceStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_29261() { // fn#29261, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:160, offset: 0x00fbdcce, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_29261_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _createForOfIteratorHelperLoose_29264(a0, a1) { // fn#29264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:353, offset: 0x00fbdd2c, size: 370 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun29265;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_29266(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_29266(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_29266(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun29265;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
}
function BILLING_PAYMENT_SOURCE_CREATE_SUCCESS({paymentSource}) { // fn#29267, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:1284, offset: 0x00fbde9e, size: 98 bytes, params: 2, frame: 15
const object2 = {};
copyDataProperties(object2, env0_6, undefined);
let id = paymentSource.id;
object2[id] = paymentSource;
if (paymentSource.isDefault || global.Object.keys(object2).length === 1) {
id = paymentSource.id;
}
}
function _fun29268(a0) { // fn#29268, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:1413, offset: 0x00fbdf00, size: 214 bytes, params: 2, frame: 16
const closure = PaymentSourceStore;
env0_4(closure, a0);
return env0_1(closure, [{key: 'paymentSources', get: get_29270}, {key: 'paymentSourceIds', get: get_29271},
{key: 'defaultPaymentSourceId', get: get_29272}, {key: 'defaultPaymentSource', get: get_29273},
{key: 'hasFetchedPaymentSources', get: get_29274}, {key: 'getDefaultBillingCountryCode', value: function() {
var property = this.defaultPaymentSource;
var value = null;
return value == property ? value : property.paymentMethodCountry;
}}, {key: 'getPaymentSource', value: value_29276}]);
}
function BILLING_PAYMENT_SOURCES_FETCH_SUCCESS({paymentSources}) { // fn#29277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:2493, offset: 0x00fbe0ac, size: 160 bytes, params: 2, frame: 19
var r5;
var value4;
var binding;
var id;
var createFromServer;
var value5;
env0_6 = {};
env0_7 = null;
const value2 = _createForOfIteratorHelperLoose_29264(paymentSources);
const value3 = value2();
let done = value3.done;
if (!done) {
r5 = value3;
while (true) {
value4 = r5.value;
binding = env0_6;
id = value4.id;
createFromServer = PaymentSourceRecord.createFromServer;
binding[id] = Reflect.apply(createFromServer, PaymentSourceRecord, [value4]);
if (value4.default) {
id = value4.id;
env0_7 = id;
}
value5 = value2();
done = value5.done;
if (done) {
break;
}
r5 = value5;
continue;
}
}
if (env0_7 == null && paymentSources.length > 0) {
id = paymentSources[0].id;
}
}
function BILLING_PAYMENT_SOURCE_REMOVE_SUCCESS_29278({id}) { // fn#29278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:2763, offset: 0x00fbe14c, size: 87 bytes, params: 2, frame: 14
var r0;
var value2;
const object2 = {};
copyDataProperties(object2, env0_6, undefined);
env0_6 = object2;
delete object2[id];
if (env0_7 === id) {
value2 = global.Object.keys(env0_6);
r0 = value2.length === 0 ? null : value2[0];
}
}
function get_29271() { // fn#29271, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:1785, offset: 0x00fbe047, size: 27 bytes, params: 1, frame: 11
const Object = global.Object;
return Object.keys(env1_6);
}
function get_29273() { // fn#29273, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3932:1908, offset: 0x00fbe062, size: 30 bytes, params: 1, frame: 3
const value2 = null;
return value2 != env1_7 ? env1_6[env1_7] : value2;
}