259 lines
14 KiB
TypeScript
259 lines
14 KiB
TypeScript
/* Metro module 15638; source: utils/native/CaptchaUtils.tsx; dependencies: [31, 27, 1949, 1310, 661, 33, 683, 4826, 4831, 566, 491, 562, 15639, 9486, 5080, 15640, 1962, 2] */
|
|
function _fun119750(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#119750, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:6, offset: 0x02517eb5, size: 358 bytes, params: 8, frame: 19
|
|
var object2;
|
|
let env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
let value = require(27) /* metro dependency 27 */;
|
|
const NativeModules = value.NativeModules;
|
|
const NativeEventEmitter = value.NativeEventEmitter;
|
|
const env0_4 = value.Keyboard;
|
|
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
|
|
const themeStore = importDefault(1310) /* metro dependency 1310: ThemeStore */;
|
|
value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_7 = value.CaptchaEvent;
|
|
const env0_8 = value.RECAPTCHA_SITE_KEY;
|
|
const env0_9 = value.AnalyticEvents;
|
|
const env0_10 = (require(33) /* metro dependency 33 */).jsx;
|
|
const CaptchaManager = NativeModules.CaptchaManager;
|
|
const nativeEventEmitter = new NativeEventEmitter(CaptchaManager);
|
|
object2 = {showCaptcha: showCaptcha_119752, closeCaptcha: function() {
|
|
CaptchaManager.closeCaptcha();
|
|
}, showHcaptcha: function(a0, a1) {
|
|
var env0_0 = a0;
|
|
var env0_1 = a1;
|
|
var Promise = global.Promise;
|
|
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
var value2 = new Promise(_fun119755);
|
|
return value2 instanceof Object ? value2 : value;
|
|
}, showRecaptcha: function() {
|
|
var env0_0 = this;
|
|
var Promise = global.Promise;
|
|
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
var value2 = new Promise(_fun119758);
|
|
return value2 instanceof Object ? value2 : value;
|
|
}};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/native/CaptchaUtils.tsx');
|
|
exports.default = object2;
|
|
exports.InlineHcaptcha = InlineHcaptcha;
|
|
}
|
|
|
|
function trackCaptchaEvent(a0, a1, a2, a3) { // fn#119751, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:305, offset: 0x0251801b, size: 206 bytes, params: 5, frame: 20
|
|
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
let CAPTCHA_EVENT = AnalyticEvents.CAPTCHA_EVENT;
|
|
Reflect.apply(track, defaultImport, [CAPTCHA_EVENT, {captcha_event_name: a0, captcha_service: a3, sitekey: a2,
|
|
captcha_flow_key: a1}]);
|
|
const defaultImport2 = importDefault(4826) /* metro dependency 4826: MonitoringAgent */;
|
|
const increment = defaultImport2.increment;
|
|
const MetricEvents = (require(4831) /* metro dependency 4831: MetricEvents */).MetricEvents;
|
|
CAPTCHA_EVENT = MetricEvents.CAPTCHA_EVENT;
|
|
Reflect.apply(increment, defaultImport2, [{name: CAPTCHA_EVENT, tags: ['event_name:' + a0,
|
|
'captcha_service:' + a3]}]);
|
|
}
|
|
|
|
function showCaptcha_119752() { // fn#119752, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:558, offset: 0x025180e9, size: 185 bytes, params: 1, frame: 20
|
|
const CaptchaTypes = (require(562) /* metro dependency 562: V8APIError */).CaptchaTypes;
|
|
const value = a0;
|
|
const r1 = value !== undefined ? value : CaptchaTypes.RECAPTCHA;
|
|
Keyboard.dismiss();
|
|
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
const OPEN_MODAL = AnalyticEvents.OPEN_MODAL;
|
|
Reflect.apply(track, defaultImport, [OPEN_MODAL, {type: 'CAPTCHA'}]);
|
|
const HCAPTCHA = CaptchaTypes.HCAPTCHA;
|
|
return r1 !== HCAPTCHA ? this.showRecaptcha() : a1 != null ? this.showHcaptcha(a1, a2) : this.showRecaptcha();
|
|
}
|
|
|
|
function showHcaptcha(a0, a1) { // fn#119754, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:808, offset: 0x025181b7, size: 53 bytes, params: 3, frame: 11
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const Promise = global.Promise;
|
|
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
const promise = new Promise(_fun119755);
|
|
return promise instanceof Object ? promise : value;
|
|
}
|
|
|
|
function showRecaptcha() { // fn#119757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:1389, offset: 0x0251842a, size: 46 bytes, params: 1, frame: 11
|
|
const Promise = global.Promise;
|
|
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
const promise = new Promise(_fun119758);
|
|
return promise instanceof Object ? promise : value;
|
|
}
|
|
|
|
function InlineHcaptcha(a0) { // fn#119761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:2037, offset: 0x02518633, size: 247 bytes, params: 2, frame: 21
|
|
const siteKey = a0.siteKey;
|
|
const env0_1 = a0.onVerify;
|
|
const env0_2 = a0.onError;
|
|
const object2 = {'siteKey': 0, 'onVerify': 0, 'onError': 0};
|
|
silentSetPrototypeOf(object2, null, undefined);
|
|
const value = copyDataProperties({}, a0, object2, undefined);
|
|
const locale = (require(566) /* metro dependency 566: flux */).useStateFromStores([LocaleStore], function() {
|
|
return LocaleStore.locale;
|
|
});
|
|
const value3 = (require(491) /* metro dependency 491 */).v4();
|
|
value3.useEffect(_fun119763, [value3, siteKey]);
|
|
return ((Component) => <Component siteKey={siteKey} onMessage={onMessage} languageCode={locale} {...value} />)(importDefault(15639) /* metro dependency 15639 */);
|
|
}
|
|
|
|
function _fun119755(a0, a1) { // fn#119755, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:828, offset: 0x025181ec, size: 203 bytes, params: 3, frame: 22
|
|
var environment;
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
let value = environment.__proto__;
|
|
const value2 = require(dependencyMap[10]).v4();
|
|
const trackCaptchaEventBinding = trackCaptchaEvent;
|
|
const binding = env0_0;
|
|
const CaptchaTypes = require(dependencyMap[11]).CaptchaTypes;
|
|
const HCAPTCHA = CaptchaTypes.HCAPTCHA;
|
|
trackCaptchaEventBinding('initial-load', value2, binding, HCAPTCHA);
|
|
value = importDefault(dependencyMap[14]);
|
|
value.pushLazy(require(dependencyMap[16])(dependencyMap[15], dependencyMap.paths), {siteKey: binding,
|
|
onMessage: onMessage_119756, rqdata: require}, 'hcaptcha');
|
|
}
|
|
|
|
function _fun119758(a0, a1) { // fn#119758, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:1425, offset: 0x02518458, size: 198 bytes, params: 3, frame: 20
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const value2 = (require(491) /* metro dependency 491 */).v4();
|
|
const trackCaptchaEventBinding = trackCaptchaEvent;
|
|
const CaptchaTypes = (require(562) /* metro dependency 562: V8APIError */).CaptchaTypes;
|
|
const HCAPTCHA = CaptchaTypes.HCAPTCHA;
|
|
trackCaptchaEventBinding('initial-load', value2, RECAPTCHA_SITE_KEY, HCAPTCHA);
|
|
CaptchaManager.showCaptcha(RECAPTCHA_SITE_KEY, ThemeStore.theme, 'https://cdn.discordapp.com/recaptcha/ios.html');
|
|
const binding = env1_12;
|
|
let addListener = binding.addListener;
|
|
const SOLVED = CaptchaEvent.SOLVED;
|
|
Reflect.apply(addListener, binding, [SOLVED, _fun119759]);
|
|
addListener = binding.addListener;
|
|
const EXPIRED = CaptchaEvent.EXPIRED;
|
|
Reflect.apply(addListener, binding, [EXPIRED, _fun119760]);
|
|
}
|
|
|
|
function _fun119763() { // fn#119763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:2189, offset: 0x0251872a, size: 66 bytes, params: 1, frame: 17
|
|
const trackCaptchaEventBinding = trackCaptchaEvent;
|
|
const binding = env0_3;
|
|
const siteKeyBinding = siteKey;
|
|
const CaptchaTypes = (require(562) /* metro dependency 562: V8APIError */).CaptchaTypes;
|
|
const HCAPTCHA = CaptchaTypes.HCAPTCHA;
|
|
trackCaptchaEventBinding('initial-load', binding, siteKeyBinding, HCAPTCHA);
|
|
}
|
|
|
|
function onMessage(a0) { // fn#119764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:2304, owner: InlineHcaptcha.onMessage, offset: 0x0251876c, size: 333 bytes, params: 2, frame: 22
|
|
var value;
|
|
const CaptchaError = (require(9486) /* metro dependency 9486: SharedCaptchaUtils */).CaptchaError;
|
|
const CaptchaTypes = (require(562) /* metro dependency 562: V8APIError */).CaptchaTypes;
|
|
var defaultImport;
|
|
let data = a0.nativeEvent.data;
|
|
if (data != null) {
|
|
data = a0.nativeEvent.data;
|
|
value = environment.__proto__;
|
|
if (data === CaptchaError.CANCEL) {
|
|
trackCaptchaEvent(data, env0_3, siteKey, CaptchaTypes.HCAPTCHA);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.CAPTCHA_FAILED, {reason: data});
|
|
if (onError != null) {
|
|
onError(data);
|
|
}
|
|
} else if (data === CaptchaError.ERROR) {
|
|
trackCaptchaEvent(data, env0_3, siteKey, CaptchaTypes.HCAPTCHA);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.CAPTCHA_FAILED, {reason: data});
|
|
if (onError != null) {
|
|
onError(data);
|
|
}
|
|
} else if (data === CaptchaError.EXPIRED) {
|
|
trackCaptchaEvent(data, env0_3, siteKey, CaptchaTypes.HCAPTCHA);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.CAPTCHA_FAILED, {reason: data});
|
|
if (onError != null) {
|
|
onError(data);
|
|
}
|
|
} else {
|
|
trackCaptchaEvent('verify', env0_3, siteKey, CaptchaTypes.HCAPTCHA);
|
|
onVerify(data);
|
|
}
|
|
}
|
|
}
|
|
|
|
function onMessage_119756(a0) { // fn#119756, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:988, offset: 0x025182b7, size: 371 bytes, params: 2, frame: 21
|
|
var value2;
|
|
const CaptchaError = (require(9486) /* metro dependency 9486: SharedCaptchaUtils */).CaptchaError;
|
|
var trackCaptchaEventBinding;
|
|
var binding;
|
|
var value4;
|
|
const CaptchaTypes = (require(562) /* metro dependency 562: V8APIError */).CaptchaTypes;
|
|
var value6;
|
|
var defaultImport;
|
|
const value = undefined;
|
|
let data = a0 == null ? value : a0.nativeEvent.data;
|
|
if (data != null) {
|
|
data = a0.nativeEvent.data;
|
|
value2 = environment.__proto__.__proto__;
|
|
if (data === CaptchaError.CANCEL) {
|
|
trackCaptchaEventBinding = trackCaptchaEvent;
|
|
binding = env0_2;
|
|
value6 = environment.__proto__;
|
|
trackCaptchaEventBinding(data, binding, env1_0, CaptchaTypes.HCAPTCHA);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.CAPTCHA_FAILED, {reason: data});
|
|
require(data);
|
|
} else if (data === CaptchaError.ERROR) {
|
|
trackCaptchaEventBinding = trackCaptchaEvent;
|
|
binding = env0_2;
|
|
value6 = environment.__proto__;
|
|
trackCaptchaEventBinding(data, binding, env1_0, CaptchaTypes.HCAPTCHA);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.CAPTCHA_FAILED, {reason: data});
|
|
require(data);
|
|
} else if (data === CaptchaError.EXPIRED) {
|
|
trackCaptchaEventBinding = trackCaptchaEvent;
|
|
binding = env0_2;
|
|
value6 = environment.__proto__;
|
|
trackCaptchaEventBinding(data, binding, env1_0, CaptchaTypes.HCAPTCHA);
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.CAPTCHA_FAILED, {reason: data});
|
|
require(data);
|
|
} else {
|
|
trackCaptchaEventBinding = trackCaptchaEvent;
|
|
binding = env0_2;
|
|
value4 = environment.__proto__;
|
|
trackCaptchaEventBinding('verify', binding, env1_0, CaptchaTypes.HCAPTCHA);
|
|
env0_0(data);
|
|
}
|
|
}
|
|
(importDefault(5080) /* metro dependency 5080: ModalActionCreators */).pop();
|
|
return value;
|
|
}
|
|
|
|
function _fun119759(a0) { // fn#119759, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:1619, offset: 0x0251851e, size: 93 bytes, params: 2, frame: 18
|
|
let binding = env1_0;
|
|
binding.closeCaptcha();
|
|
const trackCaptchaEventBinding = trackCaptchaEvent;
|
|
binding = env0_2;
|
|
const CaptchaTypes = (require(562) /* metro dependency 562: V8APIError */).CaptchaTypes;
|
|
const RECAPTCHA = CaptchaTypes.RECAPTCHA;
|
|
trackCaptchaEventBinding('verify', binding, RECAPTCHA_SITE_KEY, RECAPTCHA);
|
|
env0_0(a0);
|
|
}
|
|
|
|
function _fun119760() { // fn#119760, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15846:1740, offset: 0x0251857b, size: 184 bytes, params: 1, frame: 22
|
|
let binding = env1_0;
|
|
binding.closeCaptcha();
|
|
const trackCaptchaEventBinding = trackCaptchaEvent;
|
|
const CaptchaError = (require(9486) /* metro dependency 9486: SharedCaptchaUtils */).CaptchaError;
|
|
let EXPIRED = CaptchaError.EXPIRED;
|
|
binding = env0_2;
|
|
const CaptchaTypes = (require(562) /* metro dependency 562: V8APIError */).CaptchaTypes;
|
|
const RECAPTCHA = CaptchaTypes.RECAPTCHA;
|
|
trackCaptchaEventBinding(EXPIRED, binding, RECAPTCHA_SITE_KEY, RECAPTCHA);
|
|
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
const track = defaultImport.track;
|
|
const CAPTCHA_FAILED = AnalyticEvents.CAPTCHA_FAILED;
|
|
Reflect.apply(track, defaultImport, [CAPTCHA_FAILED, {reason: 'expired'}]);
|
|
EXPIRED = CaptchaError.EXPIRED;
|
|
require(EXPIRED);
|
|
}
|
|
|