31 lines
1.7 KiB
TypeScript
31 lines
1.7 KiB
TypeScript
// Metro module 8030 (f8031).
|
|
import ApplicationCommandIndexStore from "../../application_commands/ApplicationCommandIndexStore";
|
|
import { BuiltInSectionId } from "../../application_commands/ApplicationCommandConstants";
|
|
import { ApplicationIntegrationType } from "../../../_bundle/Module8028";
|
|
function $mk79688() {
|
|
return (a0) => a0?.oauth2_install_params != null || a0?.oauth2InstallParams != null;
|
|
}
|
|
export function canInstallApplication({ customInstallUrl, installParams, integrationTypesConfig }) {
|
|
return customInstallUrl != null || installParams != null || integrationTypesConfig != null && Object.values(integrationTypesConfig).some($mk79688());
|
|
}
|
|
export function isAppUserInstallable({ customInstallUrl, installParams, integrationTypesConfig }) {
|
|
return (customInstallUrl != null || installParams != null || integrationTypesConfig != null && Object.values(integrationTypesConfig).some($mk79688())) && integrationTypesConfig != null && ApplicationIntegrationType.USER_INSTALL in integrationTypesConfig;
|
|
}
|
|
export function shouldInstallApplicationOnDemand({ applicationId, channel, commandIntegrationTypes }) {
|
|
const r0 = commandIntegrationTypes != null && !commandIntegrationTypes.includes(ApplicationIntegrationType.USER_INSTALL);
|
|
let r18 = !r0;
|
|
if (!r0) {
|
|
let r22 = !(applicationId === BuiltInSectionId.BUILT_IN);
|
|
if (r22) {
|
|
const hasUserStateApplication = ApplicationCommandIndexStore.hasUserStateApplication(applicationId);
|
|
r22 = hasUserStateApplication ? !hasUserStateApplication : channel == null || !ApplicationCommandIndexStore.hasContextStateApplication({
|
|
applicationId,
|
|
channelId: channel.id,
|
|
guildId: channel.guild_id
|
|
});
|
|
}
|
|
r18 = r22;
|
|
}
|
|
return r18;
|
|
}
|