129 lines
7.1 KiB
TypeScript
129 lines
7.1 KiB
TypeScript
/* Metro module 10657; source: modules/application_commands/getPrimaryAppCommand.tsx; dependencies: [5, 31, 1379, 7861, 1909, 7869, 7865, 8042, 2] */
|
|
function _fun81967(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#81967, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:6, offset: 0x01ee5bfa, size: 342 bytes, params: 8, frame: 23
|
|
const env0_0 = require;
|
|
const closure = queryForPrimaryAppCommand;
|
|
const closure2 = useGetPrimaryAppCommand;
|
|
const closure3 = useQueryForPrimaryAppCommand;
|
|
const closure4 = isPrimaryAppCommandUsableInAppDM;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(5) /* metro dependency 5 */;
|
|
const env0_3 = importAll(31) /* metro dependency 31 */;
|
|
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
|
|
const applicationCommandIndexStoreModule = require(7861) /* metro dependency 7861: ApplicationCommandIndexStore */;
|
|
const env0_5 = applicationCommandIndexStoreModule.getOrFetchApplicationCommandIndexForTarget;
|
|
const env0_6 = applicationCommandIndexStoreModule.useQueryState;
|
|
const applicationCommandIndexStore = importDefault(7861) /* metro dependency 7861: ApplicationCommandIndexStore */;
|
|
const ApplicationCommandType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandType;
|
|
const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT;
|
|
object = [PRIMARY_ENTRY_POINT];
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/application_commands/getPrimaryAppCommand.tsx');
|
|
exports.default = function() {
|
|
return _getPrimaryAppCommand.apply(this, arguments);
|
|
};
|
|
exports.NO_PRIMARY_APP_COMMAND_ERROR = 'no primary app command for application';
|
|
exports.queryForPrimaryAppCommand = closure;
|
|
exports.useGetPrimaryAppCommand = closure2;
|
|
exports.useQueryForPrimaryAppCommand = closure3;
|
|
exports.useIsPrimaryAppCommandUsableInAppDM = useIsPrimaryAppCommandUsableInAppDM;
|
|
exports.isPrimaryAppCommandUsableInAppDM = closure4;
|
|
}
|
|
|
|
function _getPrimaryAppCommand() { // fn#81968, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:309, offset: 0x01ee5d50, size: 50 bytes, params: 1, frame: 14
|
|
return env0_2(_fun81970).apply(this, arguments);
|
|
}
|
|
|
|
function queryForPrimaryAppCommand(a0, a1) { // fn#81971, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:667, offset: 0x01ee5e45, size: 139 bytes, params: 3, frame: 18
|
|
const query = ApplicationCommandIndexStore.query;
|
|
const object2 = {};
|
|
const ApplicationCommandType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandType;
|
|
const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT;
|
|
object2.commandTypes = [PRIMARY_ENTRY_POINT];
|
|
const ScoreMethod = (require(7869) /* metro dependency 7869: ApplicationCommandQueryTypes */).ScoreMethod;
|
|
const COMMAND_ONLY = ScoreMethod.COMMAND_ONLY;
|
|
return Reflect.apply(query, ApplicationCommandIndexStore, [a0, object2, {'placeholderCount': 1, 'scoreMethod': null,
|
|
'applicationId': null, 'allowFetch': false, 'allowApplicationState': true, scoreMethod: COMMAND_ONLY,
|
|
applicationId: a1}]).commands[0];
|
|
}
|
|
|
|
function useGetPrimaryAppCommand(a0, a1) { // fn#81972, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:926, offset: 0x01ee5ed0, size: 99 bytes, params: 3, frame: 17
|
|
const env0_0 = a1;
|
|
const {commands, loading} = useQueryForPrimaryAppCommand(a0, a1);
|
|
const property = commands[0];
|
|
env0_3.useEffect(_fun81973, [a1, property != null, loading]);
|
|
return property;
|
|
}
|
|
|
|
function useQueryForPrimaryAppCommand(a0, a1) { // fn#81974, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:1167, offset: 0x01ee5f7e, size: 93 bytes, params: 3, frame: 16
|
|
const object2 = {commandTypes: env0_9};
|
|
const ScoreMethod = (require(7869) /* metro dependency 7869: ApplicationCommandQueryTypes */).ScoreMethod;
|
|
const COMMAND_ONLY = ScoreMethod.COMMAND_ONLY;
|
|
return useQueryState(a0, object2, {'placeholderCount': 1, 'scoreMethod': null, 'applicationId': null,
|
|
'allowFetch': false, 'allowApplicationState': true, scoreMethod: COMMAND_ONLY, applicationId: a1});
|
|
}
|
|
|
|
function isPrimaryAppCommandUsableInAppDM(a0) { // fn#81975, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:1360, offset: 0x01ee5fdb, size: 156 bytes, params: 2, frame: 16
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
return a0.integration_types != null && a0.integration_types.includes((require(8042) /* metro dependency 8042: ApplicationIntegrationType */).ApplicationIntegrationType.USER_INSTALL) && (a0.contexts != null && a0.contexts.includes((require(1909) /* metro dependency 1909: Server */).InteractionContextType.BOT_DM));
|
|
}
|
|
|
|
function useIsPrimaryAppCommandUsableInAppDM({context, applicationId, botUserId}) { // fn#81977, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:2043, offset: 0x01ee6077, size: 64 bytes, params: 2, frame: 16
|
|
const value2 = useGetPrimaryAppCommand(context, applicationId);
|
|
return value2 != null && (botUserId != null && isPrimaryAppCommandUsableInAppDM(value2));
|
|
}
|
|
|
|
function* _fun81970(a0, a1) { // fn#81970, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:374, offset: 0x01ee5d8d, size: 184 bytes, params: 3, frame: 20
|
|
var r1;
|
|
var r2;
|
|
var value6;
|
|
var Error;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
let binding = env2_4;
|
|
const channel = binding.getChannel(a0);
|
|
const value4 = channel != null;
|
|
if (value4) {
|
|
value6 = env2_11({channel: channel, type: 'channel'}, a1);
|
|
r1 = value6 == null;
|
|
r2 = value6;
|
|
} else {
|
|
r1 = value4;
|
|
r2 = undefined;
|
|
}
|
|
if (r1) {
|
|
binding = env2_5;
|
|
yield binding({type: 'application', applicationId: a1});
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
binding = env2_11;
|
|
r2 = binding({channel: channel, type: 'channel'}, a1);
|
|
if (r2 != null) {
|
|
return r2;
|
|
}
|
|
Error = global.Error;
|
|
binding = env2_8;
|
|
throw new Error(binding);
|
|
}
|
|
if (r2 != null) {
|
|
return r2;
|
|
}
|
|
Error = global.Error;
|
|
throw new Error(env2_8);
|
|
}
|
|
|
|
function _fun81973() { // fn#81973, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10843:1066, offset: 0x01ee5f33, size: 75 bytes, params: 1, frame: 13
|
|
var value2;
|
|
if (!(result || loading)) {
|
|
value2 = environment.__proto__;
|
|
(require(7865) /* metro dependency 7865: ApplicationCommandIndexActionCreators */).requestApplicationCommandIndex({type: 'application',
|
|
|
|
applicationId: require});
|
|
}
|
|
}
|
|
|