decord/alpha/source/modules/age_assurance/AgeVerificationSystemNotificationUtils.tsx
2026-10-13 12:43:34 +00:00

99 lines
4.3 KiB
TypeScript

// Module ID: 12278
// Function ID: 12279
// Name: AgeVerificationSystemNotificationUtils
// Dependencies: [10488, 5432, 1085, 7543, 2]
// Exports: isAgeVerificationMessageWithConnectToTeenCta, isAgeVerificationMessageWithManualReviewCta, isAgeVerificationMessageWithRetryCta
// Module 12278 (AgeVerificationSystemNotificationUtils)
import Constants from "Constants" /* 1085 */;
import ManualAgeAssuranceFallbackExperiment from "ManualAgeAssuranceFallbackExperiment" /* 7543 */;
import FamilyCenterPendingConnectionStore from "FamilyCenterPendingConnectionStore" /* 10488 */;
import MessageStore from "MessageStore" /* 5432 */;
import size from "module_2" /* 2 */;
const MessageEmbedTypes = Constants.MessageEmbedTypes;
let obj2 = { RETRY: "retry", CONNECT_TO_TEEN: "connect_to_teen", REQUEST_MANUAL_REVIEW: "request_manual_review" };
const obj = { CTAS: "ctas", CONTENT_TYPE: "content_type" };
let result = size.fileFinishedImporting("modules/age_assurance/AgeVerificationSystemNotificationUtils.tsx");
export const AgeVerificationSystemNotificationEmbedKeys = obj;
export const AgeVerificationSystemNotificationCtaTypes = obj2;
export const AgeVerificationSystemNotificationContentType = { VERIFIED_ADULT: "verified_adult", VERIFIED_TEEN: "verified_teen", ERROR: "error", FAE_FAILED: "fae_failed", ID_FAILED: "id_failed", UNDERAGE: "underage", MANUAL_REVIEW_SUBMITTED: "manual_review_submitted" };
export const isAgeVerificationMessageWithRetryCta = function isAgeVerificationMessageWithRetryCta(channel_id, id) {
const message = MessageStore.getMessage(channel_id, id);
if (null != message) {
if (null != message.embeds) {
if (0 !== message.embeds.length) {
if (null != message.embeds[0].fields) {
if (message.embeds[0].type === MessageEmbedTypes.AGE_VERIFICATION_SYSTEM_NOTIFICATION) {
const fields = message.embeds[0].fields;
const found = fields.find((rawName) => rawName.rawName === constants.CTAS);
let hasItem;
if (found != null) {
const str = found.rawValue;
const parts = str.split(",");
hasItem = parts.includes(obj2.RETRY);
}
return hasItem;
}
}
}
}
}
return false;
};
export const isAgeVerificationMessageWithManualReviewCta = function isAgeVerificationMessageWithManualReviewCta(channel_id, id) {
const message = MessageStore.getMessage(channel_id, id);
if (null != message) {
if (null != message.embeds) {
if (0 !== message.embeds.length) {
if (null != message.embeds[0].fields) {
if (message.embeds[0].type === MessageEmbedTypes.AGE_VERIFICATION_SYSTEM_NOTIFICATION) {
const fields = message.embeds[0].fields;
const found = fields.find((rawName) => rawName.rawName === constants.CTAS);
let hasItem;
if (found != null) {
const str = found.rawValue;
const parts = str.split(",");
hasItem = parts.includes(obj2.REQUEST_MANUAL_REVIEW);
}
let result = true === hasItem;
if (result) {
obj2 = ManualAgeAssuranceFallbackExperiment;
result = obj2.isManualAgeAssuranceFallbackEnabled("isAgeVerificationMessageWithManualReviewCta");
}
return result;
}
}
}
}
}
return false;
};
export const isAgeVerificationMessageWithConnectToTeenCta = function isAgeVerificationMessageWithConnectToTeenCta(channel_id, id) {
if (null == FamilyCenterPendingConnectionStore.getPendingConnection()) {
return false;
} else {
const message = MessageStore.getMessage(channel_id, id);
if (null != message) {
if (null != message.embeds) {
if (0 !== message.embeds.length) {
if (null != message.embeds[0].fields) {
if (message.embeds[0].type === MessageEmbedTypes.AGE_VERIFICATION_SYSTEM_NOTIFICATION) {
const fields = message.embeds[0].fields;
const found = fields.find((rawName) => rawName.rawName === constants.CTAS);
let hasItem;
if (found != null) {
const str = found.rawValue;
const parts = str.split(",");
hasItem = parts.includes(obj2.CONNECT_TO_TEEN);
}
return true === hasItem;
}
}
}
}
}
return false;
}
};