Files
discord-decomp/sources/modules/instant_invite/resolveInvite.tsx
T
2026-07-27 16:20:00 +03:00

211 lines
10 KiB
TypeScript

/* Metro module 9439; source: modules/instant_invite/resolveInvite.tsx; dependencies: [1226, 1867, 4118, 661, 4116, 683, 4098, 5046, 480, 1392, 2] */
function _fun73444(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#73444, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9625:6, offset: 0x01d6cd65, size: 259 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
let value = require(4118) /* metro dependency 4118: Constants */;
const env0_5 = value.InviteTargetTypes;
const env0_6 = value.InviteTypes;
value = require(661) /* metro dependency 661: Constants */;
const env0_7 = value.Endpoints;
const env0_8 = value.AnalyticEvents;
const env0_9 = value.LoggingInviteTypes;
const env0_10 = value.AbortCodes;
const Map = global.Map;
const map = new Map();
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/instant_invite/resolveInvite.tsx');
exports.default = resolveInvite_73446;
}
function getExtendedInviteType(a0) { // fn#73445, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9625:245, offset: 0x01d6ce68, size: 213 bytes, params: 2, frame: 14
if (a0 == null) {
return null;
}
let target_type = a0.target_type;
const STREAM = InviteTargetTypes.STREAM;
if (target_type === STREAM) {
return LoggingInviteTypes.STREAM;
}
target_type = a0.target_type;
const EMBEDDED_APPLICATION = InviteTargetTypes.EMBEDDED_APPLICATION;
if (target_type === EMBEDDED_APPLICATION) {
return LoggingInviteTypes.APPLICATION;
}
const inviteType = (require(4116) /* metro dependency 4116: InviteTypeUtils */).getInviteType(a0);
const FRIEND = InviteTypes.FRIEND;
if (FRIEND === inviteType) {
return LoggingInviteTypes.FRIEND_INVITE;
}
const GROUP_DM = InviteTypes.GROUP_DM;
if (GROUP_DM === inviteType) {
return LoggingInviteTypes.GDM_INVITE;
}
const GUILD = InviteTypes.GUILD;
if (GUILD === inviteType) {
return LoggingInviteTypes.SERVER_INVITE;
}
const String = global.String;
return String(inviteType);
}
function resolveInvite_73446(a0, a1, a2) { // fn#73446, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9625:684, offset: 0x01d6cf3d, size: 448 bytes, params: 4, frame: 22
var object3;
const env0_0 = a0;
const env0_1 = a1;
const env0_2 = a2;
const value2 = undefined;
const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
const track = defaultImport.track;
const INVITE_OPENED = AnalyticEvents.INVITE_OPENED;
const value3 = null;
const inviteInstanceId = value3 == a2 ? value2 : a2.inviteInstanceId;
Reflect.apply(track, defaultImport, [INVITE_OPENED, {invite_code: a0,
invite_instance_id: value3 != inviteInstanceId ? inviteInstanceId : value3}]);
const binding = env0_11;
if (binding.has(a0)) {
return env0_11.get(a0);
}
const extraDataFromInviteKey = (require(4098) /* metro dependency 4098: InviteCodeUtils */).parseExtraDataFromInviteKey(a0);
object3 = {'inputValue': null, 'with_counts': true, 'with_expiration': true, 'guild_scheduled_event_id': null,
'with_permissions': true};
object3.inputValue = value3 == a2 ? value2 : a2.inputValue;
object3.guild_scheduled_event_id = extraDataFromInviteKey.guildScheduledEventId;
const r4 = value3 == a2 || !a2.withGames;
object3.with_games = r4 ? value2 : !r4;
const defaultImport2 = importDefault(5046) /* metro dependency 5046: TrackedHTTPUtils */;
const get = defaultImport2.get;
const object4 = {};
object4.url = Endpoints.INVITE(extraDataFromInviteKey.baseCode);
object4.query = object3;
object4.oldFormErrors = true;
const NetworkActionNames = (require(480) /* metro dependency 480: AnalyticsUtils */).NetworkActionNames;
const INVITE_RESOLVE = NetworkActionNames.INVITE_RESOLVE;
object4.trackedActionData = {event: INVITE_RESOLVE, properties: properties};
object4.rejectWithError = false;
const value9 = Reflect.apply(get, defaultImport2, [object4]).then(_fun73448, _fun73449).finally(_fun73450);
env0_11.set(a0, value9);
return value9;
}
function resolveInvite_73446Properties(a0) { // fn#73447, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9625:1243, owner: resolveInvite_73446.properties, offset: 0x01d6d0fd, size: 453 bytes, params: 2, frame: 20
const ok = a0.ok;
const value = null;
const body = ok ? a0.body : value;
const body2 = a0.body;
const value2 = undefined;
const code = value == body2 ? value2 : body2.code;
const USER_BANNED = AbortCodes.USER_BANNED;
const typeUtilsModule = require(1392) /* metro dependency 1392: TypeUtils */;
const exact = typeUtilsModule.exact;
const object2 = {};
object2.resolved = a0.ok;
object2.guild_id = value == body || value == body.guild ? value2 : body.guild.id;
object2.channel_id = value == body || value == body.channel ? value2 : body.channel.id;
object2.channel_type = value == body || value == body.channel ? value2 : body.channel.type;
object2.inviter_id = value == body || value == body.inviter ? value2 : body.inviter.id;
object2.code = env0_3.baseCode;
object2.input_value = value == importDefault ? value2 : importDefault.inputValue;
object2.location = require;
object2.authenticated = AuthenticationStore.isAuthenticated();
object2.size_total = value == body ? value2 : body.approximate_member_count;
object2.size_online = value == body ? value2 : body.approximate_presence_count;
object2.destination_user_id = value == body || value == body.target_user ? value2 : body.target_user.id;
object2.invite_type = getExtendedInviteType(body);
object2.user_banned = code === USER_BANNED;
const getGuild = GuildStore.getGuild;
object2.user_is_member = value != Reflect.apply(getGuild, GuildStore,
[value == body || value == body.guild ? value2 : body.guild.id]);
return Reflect.apply(exact, typeUtilsModule, [object2]);
}
function _fun73448({body}) { // fn#73448, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9625:2008, offset: 0x01d6d2c2, size: 444 bytes, params: 2, frame: 24
var id;
var value3;
var value4;
var defaultImport;
var track;
var INVITE_RESOLVED;
var object2;
var channel;
var getGuild;
if (require != null) {
value3 = environment.__proto__;
value4 = undefined;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
INVITE_RESOLVED = AnalyticEvents.INVITE_RESOLVED;
object2 = {resolved: true};
id = body.guild != null ? body.guild.id : null;
object2.guild_id = id;
channel = body.channel;
id = channel != null ? body.channel.id : null;
object2.channel_id = id;
channel = body.channel;
object2.channel_type = channel != null ? body.channel.type : null;
id = body.inviter ? body.inviter.id : null;
object2.inviter_id = id;
object2.code = env0_3.baseCode;
object2.input_value = importDefault == null ? value4 : importDefault.inputValue;
object2.location = require;
object2.authenticated = AuthenticationStore.isAuthenticated();
object2.size_total = body.approximate_member_count;
object2.size_online = body.approximate_presence_count;
id = body.target_user != null ? body.target_user.id : null;
object2.destination_user_id = id;
object2.invite_type = getExtendedInviteType(body);
getGuild = GuildStore.getGuild;
id = body == null || body.guild == null ? value4 : body.guild.id;
object2.user_is_member = Reflect.apply(getGuild, GuildStore, [id]) != null;
object2.invite_instance_id = (importDefault == null ? value4 : importDefault.inviteInstanceId) ?? null;
Reflect.apply(track, defaultImport, [INVITE_RESOLVED, object2, {flush: true}]);
}
return {invite: body, code: env0_0};
}
function _fun73449(a0) { // fn#73449, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9625:2716, offset: 0x01d6d47e, size: 267 bytes, params: 2, frame: 22
var r1;
var code;
var value2;
var value3;
var defaultImport;
var track;
var INVITE_RESOLVED;
var object2;
let body = a0.body;
let value = body != null;
if (value) {
code = a0.body.code;
value = environment.__proto__;
value = code === AbortCodes.USER_BANNED;
r1 = value;
} else {
r1 = value;
}
if (require != null) {
value2 = environment.__proto__;
value3 = undefined;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
track = defaultImport.track;
INVITE_RESOLVED = AnalyticEvents.INVITE_RESOLVED;
object2 = {resolved: false};
object2.code = env0_3.baseCode;
object2.input_value = importDefault == null ? value3 : importDefault.inputValue;
object2.location = require;
object2.authenticated = AuthenticationStore.isAuthenticated();
object2.user_banned = r1;
body = a0.body;
object2.error_code = body == null ? value3 : body.code;
body = a0.body;
object2.error_message = body == null ? value3 : body.message;
Reflect.apply(track, defaultImport, [INVITE_RESOLVED, object2, {flush: true}]);
}
return {invite: null, code: env0_0, banned: r1};
}
function _fun73450() { // fn#73450, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9625:3092, offset: 0x01d6d589, size: 28 bytes, params: 1, frame: 11
env1_11.delete(env0_0);
}