134 lines
8.1 KiB
TypeScript
134 lines
8.1 KiB
TypeScript
/* Metro module 10657; source: modules/application_commands/getPrimaryAppCommand.tsx; dependencies: [5, 31, 1379, 7861, 1909, 7869, 7865, 8042, 2] */
|
|
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import ApplicationCommandIndexStore from './ApplicationCommandIndexStore.tsx'; /* Metro dependency 7861 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as ServerModule from '../../flow/Server.tsx'; /* Metro dependency 1909 */
|
|
import * as ApplicationCommandIndexStoreModule from './ApplicationCommandIndexStore.tsx'; /* Metro dependency 7861 */
|
|
import * as ApplicationCommandQueryTypesModule from './ApplicationCommandQueryTypes.tsx'; /* Metro dependency 7869 */
|
|
|
|
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 queryForPrimaryAppCommand2 = queryForPrimaryAppCommand;
|
|
const useGetPrimaryAppCommand2 = useGetPrimaryAppCommand;
|
|
const useQueryForPrimaryAppCommand2 = useQueryForPrimaryAppCommand;
|
|
const isPrimaryAppCommandUsableInAppDM2 = isPrimaryAppCommandUsableInAppDM;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const ApplicationCommandType = (ServerModule).ApplicationCommandType;
|
|
const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT;
|
|
object = [PRIMARY_ENTRY_POINT];
|
|
(FileImportTrackerModule).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 = queryForPrimaryAppCommand2;
|
|
exports.useGetPrimaryAppCommand = useGetPrimaryAppCommand2;
|
|
exports.useQueryForPrimaryAppCommand = useQueryForPrimaryAppCommand2;
|
|
exports.useIsPrimaryAppCommandUsableInAppDM = useIsPrimaryAppCommandUsableInAppDM;
|
|
exports.isPrimaryAppCommandUsableInAppDM = isPrimaryAppCommandUsableInAppDM2;
|
|
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 Module00005(_fun81970).apply(this, arguments);
|
|
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 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 applicationCommandIndexStoreBinding = ApplicationCommandIndexStore;
|
|
const query = applicationCommandIndexStoreBinding.query;
|
|
const object = {};
|
|
const ApplicationCommandType = (ServerModule).ApplicationCommandType;
|
|
const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT;
|
|
object.commandTypes = [PRIMARY_ENTRY_POINT];
|
|
const ScoreMethod = (ApplicationCommandQueryTypesModule).ScoreMethod;
|
|
const COMMAND_ONLY = ScoreMethod.COMMAND_ONLY;
|
|
return Reflect.apply(query, applicationCommandIndexStoreBinding, [a0, object, {'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];
|
|
ReactModule.useEffect(_fun81973, [a1, property != null, loading]);
|
|
return property;
|
|
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});
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
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 object = {commandTypes: env0_9};
|
|
const ScoreMethod = (ApplicationCommandQueryTypesModule).ScoreMethod;
|
|
const COMMAND_ONLY = ScoreMethod.COMMAND_ONLY;
|
|
return useQueryState(a0, object, {'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));
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun81967, 10657, [5, 31, 1379, 7861, 1909, 7869, 7865, 8042,
|
|
2]) /* metro module 10657, dependencies: [5, 31, 1379, 7861, 1909, 7869, 7865, 8042, 2] */;
|