Files
discord-decomp/sources/stores/InstantInviteStore.tsx
T
2026-07-28 01:06:53 +03:00

262 lines
15 KiB
TypeScript

/* Metro module 8880; source: stores/InstantInviteStore.tsx; dependencies: [6, 7, 15, 17, 18, 8150, 4118, 8881, 8883, 8884, 566, 694, 2] */
import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import InviteRecord from '../records/InviteRecord.tsx'; /* Metro dependency 8150 */
import Module08881 from '../by-id/module-08881.js'; /* Metro dependency 8881 */
import defaultImport2 from '../by-id/module-08883.js'; /* Metro dependency 8883 */
import defaultImport3 from '../by-id/module-08884.js'; /* Metro dependency 8884 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../modules/instant_invite/Constants.tsx'; /* Metro dependency 4118 */
function _fun69296(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69296, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:6, offset: 0x01c707c0, size: 606 bytes, params: 8, frame: 21
const normalizeInviteCodeForInstallationId = function(a0) {
return a0.toLowerCase();
};
const INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR2 = INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let env0_10 = {};
let env0_11 = {};
let env0_12 = {};
let env0_13 = {};
const Map = global.Map;
let map = new Map();
const Store = (Flux).Store;
_fun69302(Store).displayName = 'InstantInviteStore';
map = new map(importDefault(694) /* metro dependency 694: Dispatcher */, {CONNECTION_OPEN: function() {
env0_10 = {};
env0_11 = {};
env0_12 = {};
env0_13 = {};
env0_9 = null;
env0_15 = false;
env0_16 = false;
env0_14 = false;
}, CHANNEL_DELETE: CHANNEL_DELETE_69310, FRIEND_INVITE_CREATE_SUCCESS: FRIEND_INVITE_CREATE_SUCCESS_69311,
FRIEND_INVITE_CREATE_FAILURE: function() {
env0_16 = false;
}, FRIEND_INVITE_REVOKE_SUCCESS: FRIEND_INVITE_REVOKE_SUCCESS_69313,
INSTANT_INVITE_CREATE_SUCCESS: INSTANT_INVITE_CREATE_SUCCESS_69315,
INSTANT_INVITE_CREATE_FAILURE: INSTANT_INVITE_CREATE_FAILURE,
INSTANT_INVITE_REVOKE_SUCCESS: INSTANT_INVITE_REVOKE_SUCCESS_69317, FRIEND_INVITE_REVOKE_REQUEST: function() {
env0_15 = true;
}, FRIEND_INVITE_CREATE_REQUEST: function() {
env0_16 = true;
}, FRIEND_INVITES_FETCH_REQUEST: function() {
env0_14 = true;
}, FRIEND_INVITES_FETCH_RESPONSE: FRIEND_INVITES_FETCH_RESPONSE, INSTANT_INVITE_CLEAR: INSTANT_INVITE_CLEAR,
INSTANT_INVITE_RECEIVED_INSTALLATION_ID_SET: INSTANT_INVITE_RECEIVED_INSTALLATION_ID_SET,
INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR: INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR2,
INVITE_MODAL_CLOSE: INVITE_MODAL_CLOSE, LOGOUT: LOGOUT_69326});
(FileImportTrackerModule).fileFinishedImporting('stores/InstantInviteStore.tsx');
exports.default = map;
function _isNativeReflectConstruct_69297() { // fn#69297, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:186, offset: 0x01c70a1e, size: 98 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_69297_isNativeReflectConstruct = function() {
return !!result;
})();
}
function INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR({inviteCode}) { // fn#69301, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:502, offset: 0x01c70a80, size: 92 bytes, params: 2, frame: 14
var Map;
var value3;
var map;
const value2 = normalizeInviteCodeForInstallationId(inviteCode);
let binding = env0_17;
if (binding.has(value2)) {
Map = global.Map;
binding = env0_17;
value3 = Object.create(Map.prototype, {constructor: {value: Map}});
map = new Map(binding);
(map instanceof Object ? map : value3).delete(value2);
return undefined;
}
return false;
}
function _fun69302(a0) { // fn#69302, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:660, offset: 0x01c70adc, size: 180 bytes, params: 2, frame: 16
const InstantInviteStore2 = InstantInviteStore;
Inherits(InstantInviteStore2, a0);
return CreateClass(InstantInviteStore2, [{key: 'getInvite', value: value_69304}, {key: 'getFriendInvite',
value: value_69305}, {key: 'getFriendInvitesFetching', value: value_69306}, {key: 'canRevokeFriendInvite',
value: value_69307}, {key: 'getReceivedInstallationIdForInviteCode', value: value_69308}]);
function InstantInviteStore() { // fn#69303, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:672, offset: 0x01176269, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_2(this, InstantInviteStore);
const value3 = env1_5(InstantInviteStore);
return env1_4(this, _isNativeReflectConstruct_69297() ? global.Reflect.construct(value3, arguments,
env1_5(this).constructor) : value3.apply(this, arguments));
}
function value_69304(a0) { // fn#69304, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:979, offset: 0x01c70b90, size: 137 bytes, params: 2, frame: 10
let value = a1;
const value2 = undefined;
const {targetType, targetUserId, targetApplicationId} = value !== value2 ? value : {};
value = environment.__proto__;
const STREAM = InviteTargetTypes.STREAM;
return targetType !== STREAM ? targetType !== InviteTargetTypes.EMBEDDED_APPLICATION ? env1_10[a0] : targetApplicationId != null ? env1_12[a0] == null ? value2 : env1_12[a0][targetApplicationId] : env1_10[a0] : targetUserId != null ? env1_11[a0] == null ? value2 : env1_11[a0][targetUserId] : targetType !== InviteTargetTypes.EMBEDDED_APPLICATION ? env1_10[a0] : targetApplicationId != null ? env1_12[a0] == null ? value2 : env1_12[a0][targetApplicationId] : env1_10[a0];
}
function value_69305() { // fn#69305, offset: 0x00e07a77, size: 9 bytes, params: 1, frame: 1
return env1_9;
}
function value_69306() { // fn#69306, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
return env1_14;
}
function value_69307() { // fn#69307, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:1326, offset: 0x01c70c19, size: 35 bytes, params: 1, frame: 3
const value = environment.__proto__;
return env1_9 != null && !env1_15 && !env1_16;
}
function value_69308(a0) { // fn#69308, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:1414, offset: 0x01c70c3c, size: 33 bytes, params: 2, frame: 13
return env1_17.get(normalizeInviteCodeForInstallationId(a0));
}
}
function CHANNEL_DELETE_69310({channel}) { // fn#69310, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:1664, offset: 0x01c70c90, size: 54 bytes, params: 2, frame: 4
delete env0_10[channel.id];
delete env0_11[channel.id];
delete env0_12[channel.id];
}
function FRIEND_INVITE_CREATE_SUCCESS_69311(a0) { // fn#69311, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:1781, offset: 0x01c70cc6, size: 158 bytes, params: 2, frame: 17
const binding = env0_13;
const code = a0.invite.code;
const inviteRecordBinding = InviteRecord;
binding[code] = inviteRecordBinding.createFromServer(a0.invite);
const defaultImport = Module08881;
const Object = global.Object;
const value3 = defaultImport(defaultImport2(defaultImport3(Object.values(env0_13), 'createdAt')));
const value4 = null;
env0_9 = value4 != value3 ? value3 : value4;
}
function FRIEND_INVITE_REVOKE_SUCCESS_69313(a0) { // fn#69313, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2065, offset: 0x01c70d64, size: 155 bytes, params: 2, frame: 18
const invites = a0.invites;
const value = null;
if (value != invites) {
a0.invites.forEach(_fun69314);
}
const defaultImport = Module08881;
const Object = global.Object;
const value4 = defaultImport(defaultImport2(defaultImport3(Object.values(env0_13), 'createdAt')));
env0_9 = value != value4 ? value4 : value;
function _fun69314(a0) { // fn#69314, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2151, offset: 0x01c70dff, size: 42 bytes, params: 2, frame: 4
if (env1_13[a0.code] != null) {
delete env1_13[a0.code];
}
}
}
function INSTANT_INVITE_CREATE_SUCCESS_69315({channelId, invite}) { // fn#69315, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2303, offset: 0x01c70e29, size: 217 bytes, params: 2, frame: 14
const fromServer = InviteRecord.createFromServer(invite);
const targetType = fromServer.targetType;
const STREAM = InviteTargetTypes.STREAM;
if (targetType !== STREAM) {
if (fromServer.targetType !== InviteTargetTypes.EMBEDDED_APPLICATION) {
env0_10[channelId] = fromServer;
} else if (fromServer.targetApplication != null) {
if (env0_12[channelId] == null) {
env0_12[channelId] = {};
}
env0_12[channelId][fromServer.targetApplication.id] = fromServer;
} else {
env0_10[channelId] = fromServer;
}
} else if (fromServer.targetUser != null) {
if (env0_11[channelId] == null) {
env0_11[channelId] = {};
}
env0_11[channelId][global.String(fromServer.targetUser.id)] = fromServer;
} else if (fromServer.targetType !== InviteTargetTypes.EMBEDDED_APPLICATION) {
env0_10[channelId] = fromServer;
} else if (fromServer.targetApplication != null) {
if (env0_12[channelId] == null) {
env0_12[channelId] = {};
}
env0_12[channelId][fromServer.targetApplication.id] = fromServer;
} else {
env0_10[channelId] = fromServer;
}
}
function INSTANT_INVITE_CREATE_FAILURE({channelId}) { // fn#69316, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2655, offset: 0x01c70f02, size: 25 bytes, params: 2, frame: 3
env0_10[channelId] = null;
}
function INSTANT_INVITE_REVOKE_SUCCESS_69317({channelId}) { // fn#69317, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:2753, offset: 0x01c70f02, size: 25 bytes, params: 2, frame: 3
env0_10[channelId] = null;
}
function FRIEND_INVITES_FETCH_RESPONSE({invites}) { // fn#69321, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3084, offset: 0x01c70f1b, size: 149 bytes, params: 2, frame: 17
invites.forEach(_fun69322);
const defaultImport = Module08881;
const Object = global.Object;
env0_9 = defaultImport(defaultImport2(defaultImport3(Object.values({}), 'createdAt'))) ?? null;
function _fun69322(a0) { // fn#69322, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3158, offset: 0x01c70fb0, size: 38 bytes, params: 2, frame: 13
const binding = env1_13;
const code = a0.code;
const inviteRecordBinding = InviteRecord;
binding[code] = inviteRecordBinding.createFromServer(a0);
}
}
function INSTANT_INVITE_CLEAR({channelId}) { // fn#69323, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3299, offset: 0x01c70fd6, size: 23 bytes, params: 2, frame: 2
delete env0_10[channelId];
}
function INSTANT_INVITE_RECEIVED_INSTALLATION_ID_SET({inviteCode, receivedInstallationId}) { // fn#69324, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3403, offset: 0x01c70fed, size: 78 bytes, params: 2, frame: 15
const Map = global.Map;
const map = new Map(env0_17);
map.set(normalizeInviteCodeForInstallationId(inviteCode), receivedInstallationId);
}
function INVITE_MODAL_CLOSE({inviteCode}) { // fn#69325, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3643, offset: 0x01c7103b, size: 41 bytes, params: 2, frame: 12
return inviteCode != null && INSTANT_INVITE_RECEIVED_INSTALLATION_ID_CLEAR({inviteCode: inviteCode});
}
function LOGOUT_69326() { // fn#69326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9065:3765, offset: 0x01c71064, size: 58 bytes, params: 1, frame: 10
if (env0_17.size === 0) {
return false;
}
const Map = global.Map;
const map = new Map();
}
}
global.__d(_fun69296, 8880, [6, 7, 15, 17, 18, 8150, 4118, 8881, 8883, 8884, 566, 694,
2]) /* metro module 8880, dependencies: [6, 7, 15, 17, 18, 8150, 4118, 8881, 8883, 8884, 566, 694, 2] */;