decord/source/modules/guild_member_verification/MemberVerificationUtils.tsx

73 lines
2.8 KiB
TypeScript
Raw Normal View History

// Module ID: 5072
// Function ID: 5073
// Name: MemberVerificationUtils
// Dependencies: [5073, 1074, 4398, 1369, 2]
2026-07-20 16:05:17 +00:00
// Exports: guildHasVerificationGate, isAutomaticApprovalFormField, isManualApprovalFormField, isValidFormResponse, removeInternalFields
// Module 5072 (MemberVerificationUtils)
import Constants from "Constants" /* 1074 */;
import MemberVerificationTypes from "MemberVerificationTypes" /* 4398 */;
import MemberVerificationConstants from "MemberVerificationConstants" /* 5073 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
({ AUTOMATIC_APPROVAL_FORM_FIELDS: c2, MANUAL_APPROVAL_FORM_FIELDS: c3 } = MemberVerificationConstants);
const GuildFeatures = Constants.GuildFeatures;
const result = size.fileFinishedImporting("modules/guild_member_verification/MemberVerificationUtils.tsx");
2026-07-20 16:05:17 +00:00
export const isValidFormResponse = function isValidFormResponse(required) {
({ response, field_type } = required);
if (required.required) {
if (null == response) {
return false;
} else {
if (MemberVerificationTypes.VerificationFormFieldTypes.TERMS !== field_type) {
if (tmp4(4398).VerificationFormFieldTypes.VERIFICATION !== field_type) {
if (tmp4(4398).VerificationFormFieldTypes.TEXT_INPUT !== field_type) {
if (tmp4(4398).VerificationFormFieldTypes.PARAGRAPH !== field_type) {
if (tmp4(4398).VerificationFormFieldTypes.MULTIPLE_CHOICE === field_type) {
2026-08-04 21:03:28 +00:00
return typeof response === "number";
2026-07-20 16:05:17 +00:00
} else {
return tmp4(1369).assertNever(field_type);
2026-07-20 16:05:17 +00:00
}
}
}
2026-08-04 21:03:28 +00:00
let tmp2 = typeof response === "string";
if (typeof response === "string") {
2026-07-29 08:29:29 +00:00
tmp2 = "" !== response.trim();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp2;
2026-07-20 16:05:17 +00:00
}
}
const _Boolean = Boolean;
return Boolean(response);
}
} else {
return true;
}
};
export const removeInternalFields = function removeInternalFields(arr) {
return arr.filter((field_type) => field_type.field_type !== MemberVerificationTypes.VerificationFormFieldTypes.VERIFICATION);
2026-07-20 16:05:17 +00:00
};
export const isAutomaticApprovalFormField = function isAutomaticApprovalFormField(field_type) {
field_type = undefined;
2026-07-29 08:29:29 +00:00
if (field_type != null) {
2026-07-20 16:05:17 +00:00
field_type = field_type.field_type;
}
return set.has(field_type);
};
export const isManualApprovalFormField = function isManualApprovalFormField(field_type) {
field_type = undefined;
2026-07-29 08:29:29 +00:00
if (field_type != null) {
2026-07-20 16:05:17 +00:00
field_type = field_type.field_type;
}
return set2.has(field_type);
};
export const guildHasVerificationGate = function guildHasVerificationGate(guild) {
let hasItem = null != guild;
if (hasItem) {
const features = guild.features;
hasItem = features.has(GuildFeatures.MEMBER_VERIFICATION_GATE_ENABLED);
}
return hasItem;
};