decord/source/modules/applications/utils/ApplicationInstallUtils.tsx

106 lines
3.6 KiB
TypeScript
Raw Normal View History

2026-09-03 10:05:34 +00:00
// Module ID: 8458
// Function ID: 8459
2026-07-20 16:05:17 +00:00
// Name: canInstallApplication
2026-09-03 10:05:34 +00:00
// Dependencies: [8158, 4953, 8446, 2]
2026-07-29 08:29:29 +00:00
// Exports: canInstallApplication, isAppUserInstallable, shouldInstallApplicationOnDemand
2026-07-20 16:05:17 +00:00
2026-09-03 10:05:34 +00:00
// Module 8458 (canInstallApplication)
import ApplicationIntegrationType from "ApplicationIntegrationType" /* 8446 */;
import closure_2 from "getIndexKey" /* 8158 */;
import { BuiltInSectionId } from "TRUE_OPTION_NAME" /* 4953 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
let result = require("set").fileFinishedImporting("modules/applications/utils/ApplicationInstallUtils.tsx");
2026-07-29 08:29:29 +00:00
export const canInstallApplication = function canInstallApplication(application) {
2026-07-20 16:05:17 +00:00
const integrationTypesConfig = application.integrationTypesConfig;
let tmp = null != application.customInstallUrl || null != application.installParams;
if (!tmp) {
let someResult = null != integrationTypesConfig;
if (someResult) {
const _Object = Object;
const values = Object.values(integrationTypesConfig);
someResult = values.some((oauth2_install_params) => {
let prop;
2026-07-29 08:29:29 +00:00
if (oauth2_install_params != null) {
2026-07-20 16:05:17 +00:00
prop = oauth2_install_params.oauth2_install_params;
}
let tmp2 = null != prop;
if (!tmp2) {
let oauth2InstallParams;
2026-07-29 08:29:29 +00:00
if (oauth2_install_params != null) {
2026-07-20 16:05:17 +00:00
oauth2InstallParams = oauth2_install_params.oauth2InstallParams;
}
tmp2 = null != oauth2InstallParams;
}
return tmp2;
});
}
tmp = someResult;
}
return tmp;
2026-07-29 08:29:29 +00:00
};
export const isAppUserInstallable = function isAppUserInstallable(integrationTypesConfig) {
integrationTypesConfig = integrationTypesConfig.integrationTypesConfig;
let tmp = null != integrationTypesConfig.customInstallUrl || null != integrationTypesConfig.installParams;
if (!tmp) {
let someResult = null != integrationTypesConfig;
if (someResult) {
const _Object = Object;
const values = Object.values(integrationTypesConfig);
someResult = values.some((oauth2_install_params) => {
let prop;
if (oauth2_install_params != null) {
prop = oauth2_install_params.oauth2_install_params;
}
let tmp2 = null != prop;
if (!tmp2) {
let oauth2InstallParams;
if (oauth2_install_params != null) {
oauth2InstallParams = oauth2_install_params.oauth2InstallParams;
}
tmp2 = null != oauth2InstallParams;
}
return tmp2;
});
}
tmp = someResult;
}
2026-07-20 16:05:17 +00:00
if (tmp) {
tmp = null != integrationTypesConfig;
}
if (tmp) {
2026-08-24 06:08:38 +00:00
tmp = ApplicationIntegrationType.ApplicationIntegrationType.USER_INSTALL in integrationTypesConfig;
2026-07-20 16:05:17 +00:00
}
return tmp;
};
export const shouldInstallApplicationOnDemand = function shouldInstallApplicationOnDemand(arg0) {
({ applicationId, channel, commandIntegrationTypes } = arg0);
let tmp = null != commandIntegrationTypes;
if (tmp) {
2026-08-24 06:08:38 +00:00
tmp = !commandIntegrationTypes.includes(ApplicationIntegrationType.ApplicationIntegrationType.USER_INSTALL);
2026-07-20 16:05:17 +00:00
}
let tmp4 = !tmp;
if (!tmp) {
2026-07-29 08:29:29 +00:00
let tmp6 = applicationId !== BuiltInSectionId.BUILT_IN;
if (tmp6) {
2026-08-24 06:08:38 +00:00
let obj = closure_2;
const result = closure_2.hasUserStateApplication(applicationId);
2026-07-29 08:29:29 +00:00
let tmp8 = !result;
if (!result) {
let tmp9 = null == channel;
if (!tmp9) {
obj = { applicationId: null, channelId: null, guildId: null };
obj[0] = applicationId;
({ id: obj2[1], guild_id: obj2[2] } = channel);
tmp9 = !obj.hasContextStateApplication(obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp8 = tmp9;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp6 = tmp8;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp4 = tmp6;
2026-07-20 16:05:17 +00:00
}
return tmp4;
};