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

108 lines
5.2 KiB
TypeScript

/* Metro module 3819; source: stores/billing/BraintreeStore.tsx; dependencies: [6, 7, 15, 17, 18, 661, 477, 507, 566, 694, 2] */
function _fun29541(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#29541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3946:6, offset: 0x00fc4873, size: 458 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
let value = require(661) /* metro dependency 661: Constants */;
const env0_7 = value.Endpoints;
const env0_8 = value.PaymentGateways;
const env0_9 = value.PaymentSourceTypes;
value = require(477) /* metro dependency 477: PlatformUtils */;
if (value.isDesktop()) {
global.window.popupBridge = {getReturnUrlPrefix: getReturnUrlPrefix, open: open};
}
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun29547(Store).displayName = 'BraintreeStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
{BRAINTREE_CREATE_CLIENT_SUCCESS: function(a0) {
env0_12 = a0.client;
}, BRAINTREE_CREATE_PAYPAL_CLIENT_SUCCESS: function(a0) {
env0_13 = a0.paypalClient;
}, BILLING_POPUP_BRIDGE_CALLBACK: BILLING_POPUP_BRIDGE_CALLBACK_29555,
BILLING_POPUP_BRIDGE_STATE_UPDATE: function({paymentSourceType, state}) {
if (paymentSourceType === PaymentSourceTypes.PAYPAL) {
env0_10 = state;
}
}, BRAINTREE_TEARDOWN_PAYPAL_CLIENT: function() {
env0_13 = null;
}, BRAINTREE_CREATE_VENMO_CLIENT_SUCCESS: function(a0) {
env0_14 = a0.venmoClient;
}, BRAINTREE_TEARDOWN_VENMO_CLIENT: function() {
env0_14 = null;
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/billing/BraintreeStore.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_29542() { // fn#29542, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3946:215, offset: 0x00fc4a3d, 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_29542_isNativeReflectConstruct = function() {
return !!result;
})();
}
function getReturnUrlPrefix() { // fn#29545, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3946:498, offset: 0x00fc4a9b, size: 117 bytes, params: 1, frame: 14
if (env0_10 == null) {
throw new global.Error('popupBridgeState is unset');
}
const aPIBaseURL = (require(507) /* metro dependency 507: HTTPUtils */).getAPIBaseURL();
const BILLING_POPUP_BRIDGE_CALLBACK_REDIRECT_PREFIX = Endpoints.BILLING_POPUP_BRIDGE_CALLBACK_REDIRECT_PREFIX;
const BRAINTREE = PaymentGateways.BRAINTREE;
return aPIBaseURL + Reflect.apply(BILLING_POPUP_BRIDGE_CALLBACK_REDIRECT_PREFIX, Endpoints, [BRAINTREE, env0_10]);
}
function open(a0) { // fn#29546, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3946:659, offset: 0x00fc4b10, size: 47 bytes, params: 2, frame: 12
env0_11 = a0;
global.window.open(a0);
env0_15.emitChange();
}
function _fun29547(a0) { // fn#29547, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3946:706, offset: 0x00fc4b3f, size: 143 bytes, params: 2, frame: 16
const closure = BraintreeStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'getClient', value: value_29549}, {key: 'getPayPalClient', value: value_29550},
{key: 'getVenmoClient', value: value_29551}, {key: 'getLastURL', value: value_29552}]);
}
function BILLING_POPUP_BRIDGE_CALLBACK_29555({paymentSourceType, state, path, query}) { // fn#29555, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3946:1479, offset: 0x00fc4c69, size: 108 bytes, params: 2, frame: 15
var onComplete;
const PAYPAL = PaymentSourceTypes.PAYPAL;
if (paymentSourceType === PAYPAL) {
if (state === env0_10) {
onComplete = global.window.popupBridge.onComplete;
if (typeof onComplete === 'function') {
onComplete(null, {path: path, queryItems: query});
}
}
}
}