This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+633
View File
@@ -0,0 +1,633 @@
// Metro module 4212 (f4213).
import Record from "../lib/Record";
import CompanyRecord from "./CompanyRecord";
import UserRecord from "./UserRecord";
import * as _Constants from "../modules/activities/Constants";
import { ApplicationTypes } from "../modules/applications/ApplicationConstants";
import { getIsRiotSocialSDKMigrationEnabled } from "../modules/application_account_linking/experiments/socialSDKMigration";
import { getIsValorantSocialSDKEnabled } from "../modules/application_account_linking/experiments/valorantSocialSDKExperiment";
import AvatarUtils from "../utils/AvatarUtils";
import { ApplicationOverlayMethodFlags } from "../_bundle/Module4218";
import { deserialize } from "../_bundle/HighLow";
import SnowflakeUtils from "../utils/SnowflakeUtils";
let c2432_7;
const createExecutable = function createExecutable(a0) {
const r1 = {
os: a0.os,
name: a0.name
};
if (a0.arguments != null) {
r1.arguments = a0.arguments;
}
if (a0.is_launcher != null) {
r1.isLauncher = a0.is_launcher;
}
return r1;
};
const { END_GAME_APPLICATION_ID, POKER_NIGHT_APPLICATION_ID } = _Constants;
const r28 = {};
r28[POKER_NIGHT_APPLICATION_ID] = 7;
r28[END_GAME_APPLICATION_ID] = 12;
c2432_7 = r28;
class BasicApplicationRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.name = a0.name;
this.icon = a0.icon;
this.splash = a0.splash;
this.primarySkuId = a0.primarySkuId;
let thirdPartySkus = a0.thirdPartySkus;
if (thirdPartySkus == null) {
thirdPartySkus = [];
}
this.thirdPartySkus = thirdPartySkus;
this.description = a0.description;
this.bot = a0.bot;
this.coverImage = a0.coverImage;
this.type = a0.type;
let is_monetized = a0.is_monetized;
if (is_monetized == null) {
is_monetized = a0.isMonetized;
}
this.isMonetized = is_monetized;
let is_verified = a0.is_verified;
if (is_verified == null) {
is_verified = a0.isVerified;
}
this.isVerified = is_verified;
let role_connections_verification_url = a0.role_connections_verification_url;
if (role_connections_verification_url == null) {
role_connections_verification_url = a0.roleConnectionsVerificationUrl;
}
this.roleConnectionsVerificationUrl = role_connections_verification_url;
let parent_id = a0.parent_id;
if (parent_id == null) {
parent_id = a0.parentId;
}
this.parentId = parent_id;
let connection_entrypoint_url = a0.connection_entrypoint_url;
if (connection_entrypoint_url == null) {
connection_entrypoint_url = a0._connectionEntrypointUrl;
}
this._connectionEntrypointUrl = connection_entrypoint_url;
let content_classification = a0.content_classification;
if (content_classification == null) {
content_classification = a0.contentClassification;
}
this.contentClassification = content_classification;
}
static createFromServer(a0) {
return new BasicApplicationRecord({
...a0,
coverImage: a0.cover_image,
primarySkuId: a0.primary_sku_id,
bot: a0.bot != null ? new UserRecord(a0.bot) : null,
thirdPartySkus: a0.third_party_skus,
roleConnectionsVerificationUrl: a0.role_connections_verification_url,
parentId: a0.parent_id,
_connectionEntrypointUrl: a0.connection_entrypoint_url,
contentClassification: a0.content_classification
});
}
get connectionEntrypointUrl() {
let r21;
L5: {
L4: {
if (["1443349464290168976", "1443350165678198935", "1443033465766281327"].includes(this.id)) {
if (this.id === "1443350165678198935" && !getIsValorantSocialSDKEnabled({
location: "ApplicationRecord"
})) {
break L4;
}
const isRiotSocialSDKMigrationEnabled = getIsRiotSocialSDKMigrationEnabled({
location: "ApplicationRecord"
});
r21 = "https://aes.sgp.pvp.net/providers/discord/link/v1?origin=Discord";
if (isRiotSocialSDKMigrationEnabled) {
break L5;
}
}
}
r21 = this._connectionEntrypointUrl;
}
return r21;
}
getIconURL(a0, a1) {
return this.icon != null ? AvatarUtils.getGameAssetURL({
id: this.id,
hash: this.icon,
size: a0,
format: a1
}) : null;
}
getIconSource(a0, a1) {
return this.icon != null ? AvatarUtils.getGameAssetSource({
id: this.id,
hash: this.icon,
size: a0,
format: a1
}) : null;
}
getSplashURL(a0, a1) {
return this.splash != null ? AvatarUtils.getGameAssetURL({
id: this.id,
hash: this.splash,
size: a0,
keepAspectRatio: true,
format: a1
}) : null;
}
getCoverImageURL(a0) {
return this.coverImage != null ? AvatarUtils.getApplicationIconURL({
id: this.id,
icon: this.coverImage,
size: a0,
keepAspectRatio: true
}) : null;
}
}
class ApplicationRecord extends BasicApplicationRecord {
constructor(a0) {
super(a0);
let overlay = a0.overlay;
if (overlay == null) {
overlay = false;
}
this.overlay = overlay;
let overlayWarn = a0.overlayWarn;
if (overlayWarn == null) {
overlayWarn = false;
}
this.overlayWarn = overlayWarn;
let overlayCompatibilityHook = a0.overlayCompatibilityHook;
if (overlayCompatibilityHook == null) {
overlayCompatibilityHook = false;
}
this.overlayCompatibilityHook = overlayCompatibilityHook;
let overlayMethods = a0.overlayMethods;
if (overlayMethods == null) {
overlayMethods = ApplicationOverlayMethodFlags.DEFAULT;
}
this.overlayMethods = overlayMethods;
let hook = a0.hook;
if (hook == null) {
hook = true;
}
this.hook = hook;
let aliases = a0.aliases;
if (aliases == null) {
aliases = [];
}
this.aliases = aliases;
let publishers = a0.publishers;
if (publishers == null) {
publishers = [];
}
this.publishers = publishers;
let developers = a0.developers;
if (developers == null) {
developers = [];
}
this.developers = developers;
this.storeListingSkuId = a0.storeListingSkuId;
this.guildId = a0.guildId;
this.guild = a0.guild;
let executables = a0.executables;
if (executables == null) {
executables = [];
}
this.executables = executables.map(createExecutable);
let hashes = a0.hashes;
if (hashes == null) {
hashes = [];
}
this.hashes = hashes;
this.eulaId = a0.eulaId;
this.slug = a0.slug;
let flags = a0.flags;
if (flags == null) {
flags = 0;
}
this.flags = deserialize(flags);
let tags = a0.tags;
if (tags == null) {
tags = [];
}
this.tags = tags;
this.maxParticipants = a0.maxParticipants;
let embedded_activity_config = a0.embedded_activity_config;
if (embedded_activity_config == null) {
embedded_activity_config = a0.embeddedActivityConfig;
}
this.embeddedActivityConfig = embedded_activity_config;
this.team = a0.team;
this.integrationTypesConfig = a0.integrationTypesConfig;
this.storefront_available = a0.storefront_available;
this.termsOfServiceUrl = a0.termsOfServiceUrl;
this.privacyPolicyUrl = a0.privacyPolicyUrl;
let is_discoverable = a0.is_discoverable;
if (is_discoverable == null) {
is_discoverable = a0.isDiscoverable;
}
this.isDiscoverable = is_discoverable;
let custom_install_url = a0.custom_install_url;
if (custom_install_url == null) {
custom_install_url = a0.customInstallUrl;
}
this.customInstallUrl = custom_install_url;
let install_params = a0.install_params;
if (install_params == null) {
install_params = a0.installParams;
}
this.installParams = install_params;
let directory_entry = a0.directory_entry;
if (directory_entry == null) {
directory_entry = a0.directoryEntry;
}
this.directoryEntry = directory_entry;
this.categories = a0.categories;
const linked_games = a0.linked_games;
let linkedGames2 = linked_games == null ? void 0 : linked_games.map((linked_game) => ({
...linked_game,
application: linked_game.application != null ? ApplicationRecord.createFromServer(linked_game.application) : void 0
}));
if (linkedGames2 == null) {
linkedGames2 = a0.linkedGames;
}
this.linkedGames = linkedGames2;
let deepLinkUri = a0.deepLinkUri;
if (deepLinkUri == null) {
deepLinkUri = a0.deeplink_uri;
}
this.deepLinkUri = deepLinkUri;
let applicationAccountLinkBenefitConfig = a0.applicationAccountLinkBenefitConfig;
if (applicationAccountLinkBenefitConfig == null) {
applicationAccountLinkBenefitConfig = a0.application_account_link_benefit_config;
}
this.applicationAccountLinkBenefitConfig = applicationAccountLinkBenefitConfig;
let parentId = a0.parentId;
if (parentId == null) {
parentId = a0.parent_id;
}
this.parentId = parentId;
}
static createFromServer(a0) {
const bot = a0.bot != null ? new UserRecord(a0.bot) : null;
let overlay_methods = a0.overlay_methods;
if (overlay_methods == null) {
overlay_methods = ApplicationOverlayMethodFlags.DEFAULT;
}
const publishers = a0.publishers != null ? a0.publishers.map(CompanyRecord.createFromServer) : [];
const developers = a0.developers != null ? a0.developers.map(CompanyRecord.createFromServer) : [];
let flags_new = a0.flags_new;
if (flags_new == null) {
flags_new = a0.flags;
}
if (flags_new == null) {
flags_new = 0;
}
const r4 = {
...a0,
coverImage: a0.cover_image,
primarySkuId: a0.primary_sku_id,
bot,
thirdPartySkus: a0.third_party_skus,
roleConnectionsVerificationUrl: a0.role_connections_verification_url,
overlayWarn: a0.overlay_warn,
overlayCompatibilityHook: a0.overlay_compatibility_hook,
overlayMethods: overlay_methods,
hook: a0.hook,
storeListingSkuId: a0.store_listing_sku_id,
guildId: a0.guild_id,
guild: a0.guild,
publishers,
developers,
eulaId: a0.eula_id,
slug: a0.slug,
flags: deserialize(flags_new),
maxParticipants: a0.max_participants,
tags: a0.tags,
embeddedActivityConfig: a0.embedded_activity_config,
integrationTypesConfig: a0.integration_types_config != null ? Object.fromEntries(Object.entries(a0.integration_types_config).map((item) => {
let [r13, r14] = item;
const r16 = [r13, ,];
if (r14 == null) {
r14 = {};
}
r16[1] = {
oauth2InstallParams: r14.oauth2_install_params
};
return r16;
})) : void 0,
termsOfServiceUrl: a0.terms_of_service_url,
privacyPolicyUrl: a0.privacy_policy_url,
isDiscoverable: a0.is_discoverable,
directoryEntry: a0.directory_entry,
categories: a0.categories
};
const linked_games = a0.linked_games;
r4.linkedGames = linked_games == null ? void 0 : linked_games.map((linked_game) => ({
...linked_game,
application: linked_game.application != null ? ApplicationRecord.createFromServer(linked_game.application) : void 0
}));
r4.deepLinkUri = a0.deeplink_uri;
r4.applicationAccountLinkBenefitConfig = a0.application_account_link_benefit_config;
r4.parentId = a0.parent_id;
return new ApplicationRecord(r4);
}
getCanonicalGameId() {
let r10;
if (this.type === ApplicationTypes.GAME) {
r10 = SnowflakeUtils.cast(this.id);
} else {
const linkedGames2 = this.linkedGames;
r10 = linkedGames2 == null ? void 0 : linkedGames2.find((item) => item.application?.type === ApplicationTypes.GAME)?.id;
if (r10 == null) {
r10 = null;
}
}
return r10;
}
mergeFromApplicationUpdate(a0) {
let id = a0.id;
if (id == null) {
id = this.id;
}
let name = a0.name;
if (name == null) {
name = this.name;
}
let icon = a0.icon;
if (icon == null) {
icon = this.icon;
}
let splash = a0.splash;
if (splash == null) {
splash = this.splash;
}
let overlay = a0.overlay;
if (overlay == null) {
overlay = this.overlay;
}
let overlayWarn = a0.overlayWarn;
if (overlayWarn == null) {
overlayWarn = this.overlayWarn;
}
let overlayCompatibilityHook = a0.overlayCompatibilityHook;
if (overlayCompatibilityHook == null) {
overlayCompatibilityHook = this.overlayCompatibilityHook;
}
let overlayMethods = a0.overlayMethods;
if (overlayMethods == null) {
overlayMethods = this.overlayMethods;
}
let hook = a0.hook;
if (hook == null) {
hook = this.hook;
}
let aliases = a0.aliases;
if (aliases == null) {
aliases = this.aliases;
}
let publishers = a0.publishers;
if (publishers == null) {
publishers = this.publishers;
}
let developers = a0.developers;
if (developers == null) {
developers = this.developers;
}
let primarySkuId = a0.primarySkuId;
if (primarySkuId == null) {
primarySkuId = this.primarySkuId;
}
let storeListingSkuId = a0.storeListingSkuId;
if (storeListingSkuId == null) {
storeListingSkuId = this.storeListingSkuId;
}
let thirdPartySkus = a0.thirdPartySkus;
if (thirdPartySkus == null) {
thirdPartySkus = this.thirdPartySkus;
}
let guildId = a0.guildId;
if (guildId == null) {
guildId = this.guildId;
}
let guild = a0.guild;
if (guild == null) {
guild = this.guild;
}
let executables = a0.executables;
if (executables == null) {
executables = this.executables;
}
let hashes = a0.hashes;
if (hashes == null) {
hashes = this.hashes;
}
let description = a0.description;
if (description == null) {
description = this.description;
}
let eulaId = a0.eulaId;
if (eulaId == null) {
eulaId = this.eulaId;
}
let slug = a0.slug;
if (slug == null) {
slug = this.slug;
}
let coverImage = a0.coverImage;
if (coverImage == null) {
coverImage = this.coverImage;
}
let bot = a0.bot;
if (bot == null) {
bot = this.bot;
}
let flags = a0.flags;
if (flags == null) {
flags = this.flags;
}
let maxParticipants = a0.maxParticipants;
if (maxParticipants == null) {
maxParticipants = this.maxParticipants;
}
let tags = a0.tags;
if (tags == null) {
tags = this.tags;
}
let embeddedActivityConfig = a0.embeddedActivityConfig;
if (embeddedActivityConfig == null) {
embeddedActivityConfig = this.embeddedActivityConfig != null ? {
...this.embeddedActivityConfig
} : void 0;
}
let type = a0.type;
if (type == null) {
type = this.type;
}
let team = a0.team;
if (team == null) {
team = this.team;
}
let roleConnectionsVerificationUrl = a0.roleConnectionsVerificationUrl;
if (roleConnectionsVerificationUrl == null) {
roleConnectionsVerificationUrl = this.roleConnectionsVerificationUrl;
}
let _connectionEntrypointUrl = a0._connectionEntrypointUrl;
if (_connectionEntrypointUrl == null) {
_connectionEntrypointUrl = this._connectionEntrypointUrl;
}
let integrationTypesConfig2 = a0.integrationTypesConfig;
if (integrationTypesConfig2 == null) {
integrationTypesConfig2 = this.integrationTypesConfig;
}
let isMonetized = a0.isMonetized;
if (isMonetized == null) {
isMonetized = this.isMonetized;
}
let storefront_available = a0.storefront_available;
if (storefront_available == null) {
storefront_available = this.storefront_available;
}
let termsOfServiceUrl = a0.termsOfServiceUrl;
if (termsOfServiceUrl == null) {
termsOfServiceUrl = this.termsOfServiceUrl;
}
let privacyPolicyUrl = a0.privacyPolicyUrl;
if (privacyPolicyUrl == null) {
privacyPolicyUrl = this.privacyPolicyUrl;
}
let isVerified = a0.isVerified;
if (isVerified == null) {
isVerified = this.isVerified;
}
let customInstallUrl = a0.customInstallUrl;
if (customInstallUrl == null) {
customInstallUrl = this.customInstallUrl;
}
let installParams = a0.installParams;
if (installParams == null) {
installParams = this.installParams;
}
let isDiscoverable = a0.isDiscoverable;
if (isDiscoverable == null) {
isDiscoverable = this.isDiscoverable;
}
let directoryEntry = a0.directoryEntry;
if (directoryEntry == null) {
directoryEntry = this.directoryEntry;
}
let categories = a0.categories;
if (categories == null) {
categories = this.categories;
}
const linkedGames2 = a0.linkedGames;
const linkedGames = this.linkedGames;
const linkedGames3 = linkedGames2 != null ? linkedGames != null ? linkedGames2.map((item) => {
if (item.application != null) {
return item;
}
const r12 = linkedGames.find((linkedGame) => linkedGame.id === item.id);
return r12?.application != null ? {
...item,
application: r12.application
} : item;
}) : linkedGames2 : linkedGames;
let deepLinkUri = a0.deepLinkUri;
if (deepLinkUri == null) {
deepLinkUri = this.deepLinkUri;
}
let applicationAccountLinkBenefitConfig = a0.applicationAccountLinkBenefitConfig;
if (applicationAccountLinkBenefitConfig == null) {
applicationAccountLinkBenefitConfig = this.applicationAccountLinkBenefitConfig;
}
let contentClassification = a0.contentClassification;
if (contentClassification == null) {
contentClassification = this.contentClassification;
}
let parentId = a0.parentId;
if (parentId == null) {
parentId = this.parentId;
}
return new ApplicationRecord({
id,
name,
icon,
splash,
overlay,
overlayWarn,
overlayCompatibilityHook,
overlayMethods,
hook,
aliases,
publishers,
developers,
primarySkuId,
storeListingSkuId,
thirdPartySkus,
guildId,
guild,
executables,
hashes,
description,
eulaId,
slug,
coverImage,
bot,
flags,
maxParticipants,
tags,
embeddedActivityConfig,
type,
team,
roleConnectionsVerificationUrl,
_connectionEntrypointUrl,
integrationTypesConfig: integrationTypesConfig2,
isMonetized,
storefront_available,
termsOfServiceUrl,
privacyPolicyUrl,
isVerified,
customInstallUrl,
installParams,
isDiscoverable,
directoryEntry,
categories,
linkedGames: linkedGames3,
deepLinkUri,
applicationAccountLinkBenefitConfig,
contentClassification,
parentId
});
}
getMaxParticipants() {
let maxParticipants = this.maxParticipants;
if (maxParticipants == null) {
maxParticipants = c2432_7[this.id];
}
if (maxParticipants == null) {
maxParticipants = 0;
}
return maxParticipants;
}
supportsIntegrationTypes(...args) {
const integrationTypesConfig = this.integrationTypesConfig;
return integrationTypesConfig != null && args.every((arg) => arg in integrationTypesConfig);
}
get destinationSkuId() {
return this.storeListingSkuId != null ? this.storeListingSkuId : this.primarySkuId;
}
get supportsOutOfProcessOverlay() {
return ApplicationRecord.supportsOutOfProcessOverlay(this.overlayMethods);
}
static supportsOutOfProcessOverlay(a0) {
const OUT_OF_PROCESS = ApplicationOverlayMethodFlags.OUT_OF_PROCESS;
return a0 != null && (a0 & OUT_OF_PROCESS) === OUT_OF_PROCESS;
}
}
export default ApplicationRecord;
export { createExecutable };
export { BasicApplicationRecord };
+32
View File
@@ -0,0 +1,32 @@
// Metro module 4086 (f4087).
import Record from "../lib/Record";
import { $callWithNewTarget } from "../_hermes/prelude";
class AppliedGuildBoostRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.guildId = a0.guildId;
this.userId = a0.userId;
this.user = a0.user;
this.ended = a0.ended;
this.endsAt = a0.endsAt != null ? a0.endsAt : null;
}
static createFromServer(a0) {
const { id, guild_id } = a0;
const userId = a0.user != null ? a0.user.id : a0.user_id;
const { user, ended } = a0;
const r17 = a0.ends_at != null ? a0.ends_at !== "" ? new Date(a0.ends_at) : null : null;
const prototypeOf = Object.getPrototypeOf(AppliedGuildBoostRecord);
const r27 = Object.create(AppliedGuildBoostRecord.prototype);
const r29 = $callWithNewTarget(prototypeOf, r27, AppliedGuildBoostRecord);
const r30 = r29 instanceof Object ? r29 : r27;
r30.id = id;
r30.guildId = guild_id;
r30.userId = userId;
r30.user = user;
r30.ended = ended;
r30.endsAt = r17 ?? null;
return r30;
}
}
export default AppliedGuildBoostRecord;
+192
View File
@@ -0,0 +1,192 @@
// Metro module 16371 (f16372).
import Record from "../lib/Record";
import { AuditLogActionTypes, AuditLogActions, AuditLogTargetTypes } from "../Constants";
import SentryUtils_native from "../utils/SentryUtils.native";
import Module3771 from "../_bundle/Module3771";
import SnowflakeUtils from "../utils/SnowflakeUtils";
let getActionType;
const getTargetType = function getTargetType(action) {
let ALL;
L94: {
if (action === AuditLogActions.ALL) {
ALL = AuditLogTargetTypes.ALL;
} else if (action <= AuditLogActions.GUILD_UPDATE) {
ALL = AuditLogTargetTypes.GUILD;
} else {
if (!(action <= AuditLogActions.CHANNEL_DELETE) && action !== AuditLogActions.MESSAGE_BULK_DELETE) {
if (action <= AuditLogActions.CHANNEL_OVERWRITE_DELETE) {
ALL = AuditLogTargetTypes.CHANNEL_OVERWRITE;
break L94;
}
if (!(action <= AuditLogActions.BOT_ADD) && action !== AuditLogActions.MESSAGE_DELETE && action !== AuditLogActions.MESSAGE_PIN && action !== AuditLogActions.MESSAGE_UNPIN) {
if (action <= AuditLogActions.ROLE_DELETE) {
ALL = AuditLogTargetTypes.ROLE;
break L94;
}
if (action <= AuditLogActions.INVITE_DELETE) {
ALL = AuditLogTargetTypes.INVITE;
break L94;
}
if (action <= AuditLogActions.WEBHOOK_DELETE) {
ALL = AuditLogTargetTypes.WEBHOOK;
break L94;
}
if (action <= AuditLogActions.EMOJI_DELETE) {
ALL = AuditLogTargetTypes.EMOJI;
break L94;
}
if (action <= AuditLogActions.INTEGRATION_DELETE) {
ALL = AuditLogTargetTypes.INTEGRATION;
break L94;
}
if (action <= AuditLogActions.STAGE_INSTANCE_DELETE) {
ALL = AuditLogTargetTypes.STAGE_INSTANCE;
break L94;
}
if (action <= AuditLogActions.STICKER_DELETE) {
ALL = AuditLogTargetTypes.STICKER;
break L94;
}
if (action <= AuditLogActions.GUILD_SCHEDULED_EVENT_DELETE) {
ALL = AuditLogTargetTypes.GUILD_SCHEDULED_EVENT;
break L94;
}
if (action <= AuditLogActions.THREAD_DELETE) {
ALL = AuditLogTargetTypes.THREAD;
break L94;
}
if (action === AuditLogActions.APPLICATION_COMMAND_PERMISSION_UPDATE) {
ALL = AuditLogTargetTypes.APPLICATION_COMMAND;
break L94;
}
if (action <= AuditLogActions.SOUNDBOARD_SOUND_DELETE) {
ALL = AuditLogTargetTypes.GUILD_SOUNDBOARD;
break L94;
}
if (action < AuditLogActions.AUTO_MODERATION_BLOCK_MESSAGE) {
ALL = AuditLogTargetTypes.AUTO_MODERATION_RULE;
break L94;
}
if (action !== AuditLogActions.AUTO_MODERATION_BLOCK_MESSAGE && action !== AuditLogActions.AUTO_MODERATION_FLAG_TO_CHANNEL && action !== AuditLogActions.AUTO_MODERATION_USER_COMMUNICATION_DISABLED && action !== AuditLogActions.AUTO_MODERATION_QUARANTINE_USER) {
if (action <= AuditLogActions.CREATOR_MONETIZATION_TERMS_ACCEPTED) {
ALL = AuditLogTargetTypes.GUILD;
break L94;
}
if (action <= AuditLogActions.ONBOARDING_PROMPT_DELETE) {
ALL = AuditLogTargetTypes.ONBOARDING_PROMPT;
break L94;
}
if (action <= AuditLogActions.ONBOARDING_UPDATE) {
ALL = AuditLogTargetTypes.GUILD_ONBOARDING;
break L94;
}
if (action <= AuditLogActions.GUILD_HOME_REMOVE_ITEM) {
ALL = AuditLogTargetTypes.GUILD_HOME;
break L94;
}
if (action <= AuditLogActions.HARMFUL_LINKS_BLOCKED_MESSAGE) {
ALL = AuditLogTargetTypes.GUILD;
break L94;
}
if (action <= AuditLogActions.HOME_SETTINGS_UPDATE) {
ALL = AuditLogTargetTypes.HOME_SETTINGS;
break L94;
}
if (action <= AuditLogActions.VOICE_CHANNEL_STATUS_DELETE) {
ALL = AuditLogTargetTypes.VOICE_CHANNEL_STATUS;
break L94;
}
if (action <= AuditLogActions.GUILD_SCHEDULED_EVENT_EXCEPTION_DELETE) {
ALL = AuditLogTargetTypes.GUILD_SCHEDULED_EVENT_EXCEPTION;
break L94;
}
if (action <= AuditLogActions.GUILD_MEMBER_VERIFICATION_UPDATE) {
ALL = AuditLogTargetTypes.GUILD_MEMBER_VERIFICATION;
break L94;
}
if (action <= AuditLogActions.GUILD_PROFILE_UPDATE) {
ALL = AuditLogTargetTypes.GUILD_PROFILE;
break L94;
}
if (action <= AuditLogActions.GUILD_MIGRATE_BYPASS_SLOWMODE_PERMISSION) {
ALL = AuditLogTargetTypes.GUILD;
break L94;
}
SentryUtils_native.captureMessage(`Unknown target type for: ${action}`);
ALL = AuditLogTargetTypes.UNKNOWN;
break L94;
}
ALL = AuditLogTargetTypes.USER;
break L94;
}
ALL = AuditLogTargetTypes.USER;
break L94;
}
ALL = AuditLogTargetTypes.CHANNEL;
}
}
return ALL;
};
getActionType = function getActionType(action) {
if (AuditLogActions.CHANNEL_CREATE !== action && AuditLogActions.CHANNEL_OVERWRITE_CREATE !== action && AuditLogActions.MEMBER_BAN_REMOVE !== action && AuditLogActions.ROLE_CREATE !== action && AuditLogActions.INVITE_CREATE !== action && AuditLogActions.WEBHOOK_CREATE !== action && AuditLogActions.EMOJI_CREATE !== action && AuditLogActions.STICKER_CREATE !== action && AuditLogActions.MESSAGE_PIN !== action && AuditLogActions.BOT_ADD !== action && AuditLogActions.INTEGRATION_CREATE !== action && AuditLogActions.STAGE_INSTANCE_CREATE !== action && AuditLogActions.GUILD_SCHEDULED_EVENT_CREATE !== action && AuditLogActions.THREAD_CREATE !== action && AuditLogActions.AUTO_MODERATION_RULE_CREATE !== action && AuditLogActions.CREATOR_MONETIZATION_REQUEST_CREATED !== action && AuditLogActions.ONBOARDING_PROMPT_CREATE !== action && AuditLogActions.ONBOARDING_CREATE !== action && AuditLogActions.GUILD_HOME_FEATURE_ITEM !== action && AuditLogActions.SOUNDBOARD_SOUND_CREATE !== action && AuditLogActions.HOME_SETTINGS_CREATE !== action && AuditLogActions.VOICE_CHANNEL_STATUS_CREATE !== action) {
if (AuditLogActions.CHANNEL_DELETE !== action && AuditLogActions.CHANNEL_OVERWRITE_DELETE !== action && AuditLogActions.MEMBER_KICK !== action && AuditLogActions.MEMBER_PRUNE !== action && AuditLogActions.MEMBER_BAN_ADD !== action && AuditLogActions.ROLE_DELETE !== action && AuditLogActions.INVITE_DELETE !== action && AuditLogActions.WEBHOOK_DELETE !== action && AuditLogActions.EMOJI_DELETE !== action && AuditLogActions.STICKER_DELETE !== action && AuditLogActions.MESSAGE_DELETE !== action && AuditLogActions.MESSAGE_BULK_DELETE !== action && AuditLogActions.MESSAGE_UNPIN !== action && AuditLogActions.INTEGRATION_DELETE !== action && AuditLogActions.MEMBER_DISCONNECT !== action && AuditLogActions.STAGE_INSTANCE_DELETE !== action && AuditLogActions.GUILD_SCHEDULED_EVENT_DELETE !== action && AuditLogActions.GUILD_SCHEDULED_EVENT_EXCEPTION_DELETE !== action && AuditLogActions.THREAD_DELETE !== action && AuditLogActions.AUTO_MODERATION_BLOCK_MESSAGE !== action && AuditLogActions.AUTO_MODERATION_RULE_DELETE !== action && AuditLogActions.ONBOARDING_PROMPT_DELETE !== action && AuditLogActions.GUILD_HOME_REMOVE_ITEM !== action && AuditLogActions.SOUNDBOARD_SOUND_DELETE !== action && AuditLogActions.VOICE_CHANNEL_STATUS_DELETE !== action) {
if (AuditLogActions.GUILD_UPDATE !== action && AuditLogActions.CHANNEL_UPDATE !== action && AuditLogActions.CHANNEL_OVERWRITE_UPDATE !== action && AuditLogActions.MEMBER_UPDATE !== action && AuditLogActions.MEMBER_ROLE_UPDATE !== action && AuditLogActions.ROLE_UPDATE !== action && AuditLogActions.INVITE_UPDATE !== action && AuditLogActions.WEBHOOK_UPDATE !== action && AuditLogActions.EMOJI_UPDATE !== action && AuditLogActions.STICKER_UPDATE !== action && AuditLogActions.INTEGRATION_UPDATE !== action && AuditLogActions.MEMBER_MOVE !== action && AuditLogActions.STAGE_INSTANCE_UPDATE !== action && AuditLogActions.GUILD_SCHEDULED_EVENT_UPDATE !== action && AuditLogActions.GUILD_SCHEDULED_EVENT_EXCEPTION_CREATE !== action && AuditLogActions.GUILD_SCHEDULED_EVENT_EXCEPTION_UPDATE !== action && AuditLogActions.THREAD_UPDATE !== action && AuditLogActions.APPLICATION_COMMAND_PERMISSION_UPDATE !== action && AuditLogActions.CREATOR_MONETIZATION_TERMS_ACCEPTED !== action && AuditLogActions.AUTO_MODERATION_RULE_UPDATE !== action && AuditLogActions.AUTO_MODERATION_FLAG_TO_CHANNEL !== action && AuditLogActions.AUTO_MODERATION_USER_COMMUNICATION_DISABLED !== action && AuditLogActions.AUTO_MODERATION_QUARANTINE_USER !== action && AuditLogActions.ONBOARDING_PROMPT_UPDATE !== action && AuditLogActions.ONBOARDING_UPDATE !== action && AuditLogActions.SOUNDBOARD_SOUND_UPDATE !== action && AuditLogActions.HOME_SETTINGS_UPDATE !== action && AuditLogActions.GUILD_MEMBER_VERIFICATION_UPDATE !== action && AuditLogActions.GUILD_PROFILE_UPDATE !== action && AuditLogActions.GUILD_MIGRATE_PIN_PERMISSION !== action && AuditLogActions.GUILD_MIGRATE_BYPASS_SLOWMODE_PERMISSION !== action) {
return AuditLogActionTypes.ALL;
}
return AuditLogActionTypes.UPDATE;
}
return AuditLogActionTypes.DELETE;
}
return AuditLogActionTypes.CREATE;
};
class AuditLogRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.action = a0.action;
this.actionType = getActionType(this.action);
this.targetId = a0.targetId;
let timestampStart = a0.timestampStart;
if (timestampStart == null) {
timestampStart = Module3771(SnowflakeUtils.extractTimestamp(this.id));
}
this.timestampStart = timestampStart;
let timestampEnd = a0.timestampEnd;
if (timestampEnd == null) {
timestampEnd = this.timestampStart;
}
this.timestampEnd = timestampEnd;
this.userId = a0.userId;
let changes = a0.changes;
if (changes == null) {
changes = [];
}
this.changes = changes;
this.targetType = getTargetType(this.action);
let options = a0.options;
if (options == null) {
options = {};
}
this.options = options;
let target = a0.target;
if (target == null) {
target = a0.id;
}
this.target = target;
let user = a0.user;
if (user == null) {
user = null;
}
this.user = user;
}
}
export default AuditLogRecord;
export { getTargetType };
export { getActionType };
export class AuditLogChange {
constructor(a0, a1, a2) {
this.key = a0;
this.oldValue = a1;
this.newValue = a2;
}
}
File diff suppressed because it is too large. Load diff
+20
View File
@@ -0,0 +1,20 @@
// Metro module 4213 (f4214).
import Record from "../lib/Record";
import { $callWithNewTarget } from "../_hermes/prelude";
class CompanyRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.name = a0.name;
}
static createFromServer(a0) {
const prototypeOf = Object.getPrototypeOf(CompanyRecord);
const r2 = Object.create(CompanyRecord.prototype);
const r10 = $callWithNewTarget(prototypeOf, r2, CompanyRecord);
const r11 = r10 instanceof Object ? r10 : r2;
r11.id = a0.id;
r11.name = a0.name;
return r11;
}
}
export default CompanyRecord;
+24
View File
@@ -0,0 +1,24 @@
// Metro module 4870 (f4871).
import Record from "../lib/Record";
class ConnectedAccountRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.type = a0.type;
this.name = a0.name;
this.revoked = a0.revoked || false;
this.integrations = a0.integrations || [];
this.visibility = a0.visibility || 0;
this.friendSync = a0.friend_sync || false;
this.showActivity = a0.show_activity || false;
this.verified = a0.verified || false;
this.accessToken = a0.access_token || null;
this.twoWayLink = a0.two_way_link || false;
this.metadata = a0.metadata || null;
this.metadataVisibility = a0.metadata_visibility || 0;
}
toString() {
return this.name;
}
}
export default ConnectedAccountRecord;
+17
View File
@@ -0,0 +1,17 @@
// Metro module 16397 (f16398).
import Record from "../lib/Record";
import UserRecord from "./UserRecord";
class EmojiRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.name = a0.name;
this.managed = a0.managed;
this.roles = a0.roles;
this.requiredColons = a0.requiredColons;
this.user = new UserRecord(a0.user);
this.animated = a0.animated;
this.available = a0.available;
}
}
export default EmojiRecord;
+127
View File
@@ -0,0 +1,127 @@
// Metro module 4227 (f4228).
import Record from "../lib/Record";
import SKURecord from "../modules/skus/SKURecord";
import UserRecord from "./UserRecord";
import { EntitlementTypes } from "../Constants";
import PremiumUtils from "../utils/PremiumUtils";
import { EntitlementTenantFulfillmentStatus } from "../_bundle/Module4232";
import { $callWithNewTarget } from "../_hermes/prelude";
class EntitlementRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.skuId = a0.skuId;
this.applicationId = a0.applicationId;
this.user = a0.user;
this.userId = a0.userId;
this.gifterId = a0.gifterId;
this.type = a0.type;
this.branches = a0.branches;
this.startsAt = a0.startsAt;
this.endsAt = a0.endsAt;
this.subscriptionId = a0.subscriptionId;
this.subscriptionPlanId = a0.subscriptionPlanId;
this.parentId = a0.parentId;
this.consumed = a0.consumed;
this.giftCodeBatchId = a0.giftCodeBatchId;
this.giftStyle = a0.giftStyle;
this.guildId = a0.guildId;
this.deleted = a0.deleted;
this.sourceType = a0.sourceType;
this.fulfillmentStatus = a0.fulfillmentStatus;
}
static createFromServer(a0) {
const { id, sku_id, application_id } = a0;
const user = a0.user != null ? new UserRecord(a0.user) : null;
const { user_id, gifter_user_id, type } = a0;
let branches = a0.branches;
if (branches == null) {
branches = [];
}
const startsAt = a0.starts_at != null ? new Date(a0.starts_at) : null;
const endsAt = a0.ends_at != null ? new Date(a0.ends_at) : null;
const subscription_id = a0.subscription_id;
const subscriptionPlanId = a0.subscription_plan != null ? a0.subscription_plan.id : null;
const parentId = a0.parent_id != null ? a0.parent_id : null;
const consumed = a0.consumed != null ? a0.consumed : null;
let gift_code_batch_id = a0.gift_code_batch_id;
if (gift_code_batch_id == null) {
gift_code_batch_id = null;
}
const { gift_style, guild_id, deleted } = a0;
if (a0.sku != null) {
SKURecord.createFromServer(a0.sku);
}
let source_type = a0.source_type;
if (source_type == null) {
source_type = null;
}
let fulfillment_status = a0.fulfillment_status;
if (fulfillment_status == null) {
fulfillment_status = null;
}
const prototypeOf = Object.getPrototypeOf(EntitlementRecord);
const r65 = Object.create(EntitlementRecord.prototype);
const r67 = $callWithNewTarget(prototypeOf, r65, EntitlementRecord);
const r68 = r67 instanceof Object ? r67 : r65;
r68.id = id;
r68.skuId = sku_id;
r68.applicationId = application_id;
r68.user = user;
r68.userId = user_id;
r68.gifterId = gifter_user_id;
r68.type = type;
r68.branches = branches;
r68.startsAt = startsAt;
r68.endsAt = endsAt;
r68.subscriptionId = subscription_id;
r68.subscriptionPlanId = subscriptionPlanId;
r68.parentId = parentId;
r68.consumed = consumed;
r68.giftCodeBatchId = gift_code_batch_id;
r68.giftStyle = gift_style;
r68.guildId = guild_id;
r68.deleted = deleted;
r68.sourceType = source_type;
r68.fulfillmentStatus = fulfillment_status;
return r68;
}
get isGiftable() {
return this.type === EntitlementTypes.USER_GIFT && this.gifterId == null;
}
isValid(a0, a1, r4 = null) {
if (!this.isGiftable && !this.deleted) {
if (this.type === EntitlementTypes.PREMIUM_SUBSCRIPTION) {
const r16 = a1.get(this.skuId);
if (r16 != null && !r16.premium) {
return false;
}
if (!PremiumUtils.canInstallPremiumApplications(a0)) {
return false;
}
}
const date = new Date();
if (this.startsAt != null && date < this.startsAt) {
return false;
}
if (this.endsAt != null && date >= this.endsAt) {
return false;
}
if (r4 != null) {
if (this.branches.length === 0) {
if (this.applicationId !== r4) {
return false;
}
} else if (!this.branches.includes(r4)) {
return false;
}
}
return true;
}
return false;
}
isFulfilled() {
return this.fulfillmentStatus === EntitlementTenantFulfillmentStatus.FULFILLED;
}
}
export default EntitlementRecord;
+121
View File
@@ -0,0 +1,121 @@
// Metro module 8033 (f8034).
import Record from "../lib/Record";
import PromotionRecord from "./PromotionRecord";
import SubscriptionPlanRecord from "./SubscriptionPlanRecord";
import { PremiumSubscriptionSKUToPremiumType } from "../modules/premium/PremiumConstants";
import Module3771 from "../_bundle/Module3771";
import { hasFlag } from "../_bundle/Module1384";
import { $callWithNewTarget } from "../_hermes/prelude";
let c5087_6 = Object.freeze({
PAYMENT_SOURCE_REQUIRED: 1,
EXISTING_PREMIUM_SUBSCRIPTION_DISALLOWED: 2,
NOT_SELF_REDEEMABLE: 4
});
class GiftCodeRecord extends Record {
constructor(a0) {
super();
this.userId = a0.userId;
this.code = a0.code;
this.skuId = a0.skuId;
this.applicationId = a0.applicationId;
this.uses = a0.uses;
this.maxUses = a0.maxUses;
this.expiresAt = a0.expiresAt;
this.redeemed = a0.redeemed;
this.storeListingId = a0.storeListingId;
this.subscriptionPlanId = a0.subscriptionPlanId;
this.subscriptionPlan = a0.subscriptionPlan;
this.revoked = a0.revoked;
this.entitlementBranches = a0.entitlementBranches;
this.flags = a0.flags;
this.subscriptionTrial = a0.subscriptionTrial;
this.promotion = a0.promotion;
this.giftStyle = a0.giftStyle;
}
static createFromServer(a0) {
const userId = a0.user != null ? a0.user.id : null;
const { code, sku_id, application_id, uses, max_uses } = a0;
const storeListingId = a0.store_listing != null ? a0.store_listing.id : null;
const expiresAt = a0.expires_at != null ? Module3771(a0.expires_at) : null;
const redeemed = a0.redeemed;
const subscriptionPlanId = a0.subscription_plan != null ? a0.subscription_plan.id : a0.subscription_plan_id;
const subscriptionPlan = a0.subscription_plan != null ? SubscriptionPlanRecord.createFromServer(a0.subscription_plan) : null;
const entitlementBranches = a0.entitlement_branches != null ? a0.entitlement_branches : null;
const flags = a0.flags != null ? a0.flags : 0;
const gift_style = a0.gift_style;
const subscriptionTrial = a0.subscription_trial != null ? {
id: a0.subscription_trial.id,
interval: a0.subscription_trial.interval,
intervalCount: a0.subscription_trial.interval_count,
skuId: a0.subscription_trial.sku_id
} : null;
const promotion = a0.promotion != null ? PromotionRecord.createFromServer(a0.promotion) : null;
const prototypeOf = Object.getPrototypeOf(GiftCodeRecord);
const r67 = Object.create(GiftCodeRecord.prototype);
const r68 = $callWithNewTarget(prototypeOf, r67, GiftCodeRecord);
const r69 = r68 instanceof Object ? r68 : r67;
r69.userId = userId;
r69.code = code;
r69.skuId = sku_id;
r69.applicationId = application_id;
r69.uses = uses;
r69.maxUses = max_uses;
r69.expiresAt = expiresAt;
r69.redeemed = redeemed;
r69.storeListingId = storeListingId;
r69.subscriptionPlanId = subscriptionPlanId;
r69.subscriptionPlan = subscriptionPlan;
r69.revoked = false;
r69.entitlementBranches = entitlementBranches;
r69.flags = flags;
r69.subscriptionTrial = subscriptionTrial;
r69.promotion = promotion;
r69.giftStyle = gift_style;
return r69;
}
isExpired() {
const expiresAt = this.expiresAt;
return expiresAt != null && Module3771().isAfter(expiresAt);
}
get hasMultipleCopies() {
return this.maxUses > 1;
}
get isClaimed() {
return this.uses >= this.maxUses;
}
get remainingUses() {
return this.maxUses - this.uses;
}
get isSubscription() {
return this.subscriptionPlanId != null;
}
get premiumSubscriptionType() {
const isSubscription2 = this.isSubscription;
let r1 = null;
if (isSubscription2) {
let r7 = PremiumSubscriptionSKUToPremiumType[this.skuId];
if (r7 == null) {
r7 = null;
}
r1 = r7;
}
return r1;
}
get isSelfRedeemable() {
return !hasFlag(this.flags, c5087_6.NOT_SELF_REDEEMABLE);
}
get isExistingPremiumSubscriptionDisallowed() {
return hasFlag(this.flags, c5087_6.EXISTING_PREMIUM_SUBSCRIPTION_DISALLOWED);
}
get analyticsData() {
return {
gift_code: this.code,
gift_code_max_uses: this.maxUses
};
}
toString() {
return this.code;
}
}
export default GiftCodeRecord;
export { c5087_6 as GiftCodeFlags };
+40
View File
@@ -0,0 +1,40 @@
// Metro module 4087 (f4088).
import Record from "../lib/Record";
import { $callWithNewTarget } from "../_hermes/prelude";
class GuildBoostSlotRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.subscriptionId = a0.subscriptionId;
this.premiumGuildSubscription = a0.premiumGuildSubscription;
this.canceled = a0.canceled;
this.cooldownEndsAt = a0.cooldownEndsAt;
this.subscription = a0.subscription;
}
static createFromServer(a0, a1) {
const { id, subscription_id } = a0;
const premiumGuildSubscription = a0.premium_guild_subscription != null ? {
id: a0.premium_guild_subscription.id,
guildId: a0.premium_guild_subscription.guild_id
} : null;
const { canceled, cooldown_ends_at } = a0;
const prototypeOf = Object.getPrototypeOf(GuildBoostSlotRecord);
const r8 = Object.create(GuildBoostSlotRecord.prototype);
const r23 = $callWithNewTarget(prototypeOf, r8, GuildBoostSlotRecord);
const r24 = r23 instanceof Object ? r23 : r8;
r24.id = id;
r24.subscriptionId = subscription_id;
r24.premiumGuildSubscription = premiumGuildSubscription;
r24.canceled = canceled;
r24.cooldownEndsAt = cooldown_ends_at;
r24.subscription = a1;
return r24;
}
isOnCooldown() {
return this.cooldownEndsAt != null && new Date(this.cooldownEndsAt).getTime() >= Date.now();
}
isAvailable() {
return this.premiumGuildSubscription == null && !this.isOnCooldown();
}
}
export default GuildBoostSlotRecord;
+114
View File
@@ -0,0 +1,114 @@
// Metro module 1415 (f1416).
import { set, TypeTag } from "../lib/PlainRecord";
import * as _Constants from "../Constants";
import { GuildNSFWContentLevel, MFALevels } from "../Constants";
import AvatarUtils from "../utils/AvatarUtils";
import { getAcronym } from "../utils/StringUtils";
import SnowflakeUtils from "../utils/SnowflakeUtils";
import { isServerNSFWLevelEnabled } from "../modules/age_gate/ServerNSFWLevelExperiment";
TypeTag;
const { BoostedGuildTiers, GuildExplicitContentFilterTypes, UserNotificationSettings, VerificationLevels } = _Constants;
let c1170_6 = new Set([GuildNSFWContentLevel.EXPLICIT, GuildNSFWContentLevel.AGE_RESTRICTED]);
const r49 = Object.freeze({
mfaLevel: MFALevels.NONE,
preferredLocale: "en-US",
afkTimeout: 0,
defaultMessageNotifications: UserNotificationSettings.ALL_MESSAGES,
verificationLevel: VerificationLevels.NONE,
explicitContentFilter: GuildExplicitContentFilterTypes.DISABLED,
premiumProgressBarEnabled: false,
premiumProgressBarEnabledUserUpdatedAt: null,
systemChannelFlags: 0,
maxStageVideoChannelUsers: -1,
maxVideoChannelUsers: -1,
maxMembers: -1,
premiumTier: BoostedGuildTiers.NONE,
nsfwLevel: GuildNSFWContentLevel.DEFAULT,
premiumSubscriberCount: 0,
features: new Set(),
description: null,
icon: null,
ownerId: null,
systemChannelId: null,
joinedAt: null,
discoverySplash: null,
splash: null,
banner: null,
homeHeader: null,
afkChannelId: null,
application_id: null,
vanityURLCode: null,
rulesChannelId: null,
safetyAlertsChannelId: null,
publicUpdatesChannelId: null,
ownerConfiguredContentLevel: null,
hubType: null,
latestOnboardingQuestionId: null,
profile: null,
guildTheme: null,
premiumFeatures: null,
moderatorReporting: null,
verificationRoleId: null,
gameApplicationIds: null,
officialMessageColor: null
});
export const GuildRecordTypeTag = "Guild";
export { c1170_6 as RESTRICTED_CONTENT_LEVELS };
export { r49 as GUILD_DEFAULT_PROPERTY_VALUES };
export function getGuildIconURL(a0, a1, canAnimate = false, lossless = false) {
return AvatarUtils.getGuildIconURL({
id: a0.id,
size: a1,
icon: a0.icon,
canAnimate,
lossless
});
}
export function getGuildIconSource(c13030_0, size, r5 = false) {
return AvatarUtils.getAnimatableSourceWithFallback(r5, (a0) => AvatarUtils.getGuildIconSource({
id: c13030_0.id,
size,
icon: c13030_0.icon,
canAnimate: a0
}));
}
export function getGuildAcronym(a0) {
return getAcronym(a0.name);
}
export function isGuildOwner(a0, a1) {
return a0.ownerId === (typeof a1 !== "string" ? a1 != null ? a1.id : null : a1);
}
export function isGuildOwnerWithRequiredMfaLevel(a0, a1) {
const mfaEnabled = a1.mfaEnabled;
const r0 = mfaEnabled ? !mfaEnabled : a0.mfaLevel === MFALevels.ELEVATED;
return r0 ? !r0 : a0.ownerId === (typeof a1 !== "string" ? a1 != null ? a1.id : null : a1);
}
export function isGuildLurker(a0) {
return a0.joinedAt == null;
}
export function getGuildEveryoneRoleId(a0) {
return SnowflakeUtils.castGuildIdAsEveryoneGuildRoleId(a0.id);
}
export function updateJoinedAt(a0, a1) {
return set(a0, "joinedAt", typeof a1 === "string" ? new Date(a1) : a1);
}
export function updateGameApplications(a0, a1) {
return set(a0, "gameApplicationIds", a1);
}
export function isGuildNSFW(a0) {
let r16;
let r2 = a0 != null;
if (r2) {
if (isServerNSFWLevelEnabled("guild_record")) {
r16 = c1170_6.has(a0.nsfwLevel);
} else {
let ownerConfiguredContentLevel = a0.ownerConfiguredContentLevel;
if (ownerConfiguredContentLevel == null) {
ownerConfiguredContentLevel = GuildNSFWContentLevel.DEFAULT;
}
r16 = c1170_6.has(ownerConfiguredContentLevel);
}
r2 = r16;
}
return r2;
}
+18
View File
@@ -0,0 +1,18 @@
// Metro module 1936 (f1937).
import { TypeTag } from "../lib/PlainRecord";
import { has, hasAny, equals } from "../_bundle/HighLow";
import Module12 from "../_bundle/Module12";
TypeTag;
export const GuildRoleRecordTypeTag = "GuildRole";
export function isEveryoneRole(a0) {
return a0.id === a0.guildId;
}
export function hasPermission(a0, a1) {
return has(a0.permissions, a1);
}
export function hasAnyPermission(a0, a1) {
return hasAny(a0.permissions, a1);
}
export function isRoleEqual(a0, a1) {
return Module12.isEqualWith(a0, a1, (a0, a1, a2) => a2 === "permissions" ? equals(a0, a1) : void 0);
}
+39
View File
@@ -0,0 +1,39 @@
// Metro module 4410 (f4411).
import Record from "../lib/Record";
import UserRecord from "./UserRecord";
import { $callWithNewTarget } from "../_hermes/prelude";
class InteractionRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.name = a0.name;
this.type = a0.type;
this.user = a0.user;
let name_localized = a0.name_localized;
if (name_localized == null) {
name_localized = a0.name;
}
this.displayName = name_localized;
}
static createFromServer(a0) {
const r3 = {
...a0,
user: new UserRecord(a0.user)
};
const prototypeOf = Object.getPrototypeOf(InteractionRecord);
const r19 = Object.create(InteractionRecord.prototype);
const r21 = $callWithNewTarget(prototypeOf, r19, InteractionRecord);
const r22 = r21 instanceof Object ? r21 : r19;
r22.id = r3.id;
r22.name = r3.name;
r22.type = r3.type;
r22.user = r3.user;
let name_localized = r3.name_localized;
if (name_localized == null) {
name_localized = r3.name;
}
r22.displayName = name_localized;
return r22;
}
}
export default InteractionRecord;
+54
View File
@@ -0,0 +1,54 @@
// Metro module 6697 (f6698).
import Record from "../lib/Record";
import Module3771 from "../_bundle/Module3771";
class InviteRecord extends Record {
constructor(a0) {
super();
const code = a0.code || "";
this.code = code;
this.temporary = a0.temporary || false;
this.revoked = a0.revoked || false;
this.uses = a0.uses || 0;
this.maxUses = a0.maxUses || 0;
this.maxAge = a0.maxAge || 0;
this.createdAt = a0.createdAt || new Date();
this.channel = a0.channel;
this.guild = a0.guild;
this.inviter = a0.inviter || null;
this.targetType = a0.targetType || null;
this.targetUser = a0.targetUser || null;
this.targetApplication = a0.targetApplication || null;
this.type = a0.type || null;
this.flags = a0.flags || 0;
this.roles = a0.roles || [];
}
static createFromServer(a0) {
let created_at = a0.created_at;
if (created_at == null) {
created_at = void 0;
}
return new InviteRecord({
...a0,
maxUses: a0.max_uses,
maxAge: a0.max_age,
createdAt: Module3771(created_at),
targetType: a0.target_type,
targetUser: a0.target_user,
targetApplication: a0.target_application
});
}
isExpired() {
const maxAge = this.maxAge;
if (maxAge > 0 && Module3771(this.createdAt).add(maxAge, "seconds").isBefore(Date.now())) {
return true;
}
return false;
}
getExpiresAt() {
return this.maxAge > 0 ? Module3771(this.createdAt).add(this.maxAge, "seconds").toDate() : Infinity;
}
toString() {
return this.code;
}
}
export default InviteRecord;
+184
View File
@@ -0,0 +1,184 @@
// Metro module 3844 (f3845).
import Record from "../lib/Record";
import { createInvoiceItemFromServer } from "../modules/premium/PremiumSubscriptionInvoiceItem";
import { $callWithNewTarget } from "../_hermes/prelude";
class BaseInvoiceRecord extends Record {
constructor(a0) {
super();
this.total = a0.total;
this.subtotal = a0.subtotal;
this.tax = a0.tax;
this.currency = a0.currency;
let invoiceItems = a0.invoiceItems;
if (invoiceItems == null) {
invoiceItems = [];
}
this.invoiceItems = invoiceItems;
}
static createFromServer(a0) {
const { total, subtotal, tax, currency } = a0;
let invoiceItems = a0.invoice_items.map((invoice_item) => ({
skuId: invoice_item.sku_id,
quantity: invoice_item.quantity,
description: invoice_item.description
}));
const prototypeOf = Object.getPrototypeOf(BaseInvoiceRecord);
const r18 = Object.create(BaseInvoiceRecord.prototype);
const r19 = $callWithNewTarget(prototypeOf, r18, BaseInvoiceRecord);
const r20 = r19 instanceof Object ? r19 : r18;
r20.total = total;
r20.subtotal = subtotal;
r20.tax = tax;
r20.currency = currency;
if (invoiceItems == null) {
invoiceItems = [];
}
r20.invoiceItems = invoiceItems;
return r20;
}
static createInvoiceFromOrder(a0) {
const billing_facet = a0.billing_facet;
const invoice_preview = billing_facet != null ? billing_facet.invoice_preview : null;
if (invoice_preview == null) {
return null;
}
let invoiceItems = invoice_preview.line_items.map((line_item) => {
const r9 = a0.order_line_items.find((order_line_item) => order_line_item.id === line_item.ref_order_line_item_id);
return r9 != null ? {
skuId: r9.sku_id,
unitPrice: {
amount: line_item.unit_price,
currency: invoice_preview.currency
},
quantity: line_item.quantity
} : null;
}).filter((item) => item != null);
const { total, subtotal, tax, currency } = invoice_preview;
const prototypeOf = Object.getPrototypeOf(BaseInvoiceRecord);
const r26 = Object.create(BaseInvoiceRecord.prototype);
const r27 = $callWithNewTarget(prototypeOf, r26, BaseInvoiceRecord);
const r28 = r27 instanceof Object ? r27 : r26;
r28.total = total;
r28.subtotal = subtotal;
r28.tax = tax;
r28.currency = currency;
if (invoiceItems == null) {
invoiceItems = [];
}
r28.invoiceItems = invoiceItems;
return r28;
}
getInvoicePreviewLineItemForSku(c13679_0) {
let r7 = this.invoiceItems.find((invoiceItem) => invoiceItem.skuId === c13679_0);
if (r7 == null) {
r7 = null;
}
return r7;
}
getInvoicePreviewLineItemUnitPriceForSku(a0) {
const invoicePreviewLineItemForSku = this.getInvoicePreviewLineItemForSku(a0);
return invoicePreviewLineItemForSku == null ? null : invoicePreviewLineItemForSku.unitPrice == null ? null : invoicePreviewLineItemForSku.unitPrice.amount;
}
}
class InvoiceRecord extends BaseInvoiceRecord {
constructor(a0) {
super(a0);
this.id = a0.id;
let invoiceItems = a0.invoiceItems;
if (invoiceItems == null) {
invoiceItems = [];
}
this.invoiceItems = invoiceItems;
this.taxInclusive = a0.taxInclusive;
this.subscriptionPeriodStart = a0.subscriptionPeriodStart;
this.subscriptionPeriodEnd = a0.subscriptionPeriodEnd;
this.status = a0.status;
this.orbsReward = a0.orbsReward;
this.checkoutContext = a0.checkoutContext;
}
static createInvoiceFromServer(a0) {
const invoice_items = a0.invoice_items;
const r4 = {
id: a0.id,
invoiceItems: invoice_items == null ? void 0 : invoice_items.map(createInvoiceItemFromServer),
total: a0.total,
subtotal: a0.subtotal,
currency: a0.currency,
tax: a0.tax,
taxInclusive: a0.tax_inclusive,
subscriptionPeriodStart: new Date(a0.subscription_period_start),
subscriptionPeriodEnd: new Date(a0.subscription_period_end),
status: a0.status,
orbsReward: a0.orbs_reward,
checkoutContext: a0.checkout_context
};
const prototypeOf = Object.getPrototypeOf(InvoiceRecord);
const r42 = Object.create(InvoiceRecord.prototype);
const r45 = $callWithNewTarget(prototypeOf, r42, InvoiceRecord, r4);
const r46 = r45 instanceof Object ? r45 : r42;
r46.id = r4.id;
let invoiceItems = r4.invoiceItems;
if (invoiceItems == null) {
invoiceItems = [];
}
r46.invoiceItems = invoiceItems;
r46.taxInclusive = r4.taxInclusive;
r46.subscriptionPeriodStart = r4.subscriptionPeriodStart;
r46.subscriptionPeriodEnd = r4.subscriptionPeriodEnd;
r46.status = r4.status;
r46.orbsReward = r4.orbsReward;
r46.checkoutContext = r4.checkoutContext;
return r46;
}
static createFromOTPPreview(a0) {
const invoice_items = a0.invoice_items;
const r17 = {
id: "",
invoiceItems: invoice_items == null ? void 0 : invoice_items.map(createInvoiceItemFromServer),
total: a0.amount,
subtotal: a0.subtotal,
currency: a0.currency,
tax: a0.tax,
taxInclusive: a0.tax_inclusive,
subscriptionPeriodStart: new Date(0),
subscriptionPeriodEnd: new Date(0),
orbsReward: a0.orbs_reward,
checkoutContext: a0.checkout_context
};
const prototypeOf = Object.getPrototypeOf(InvoiceRecord);
const r40 = Object.create(InvoiceRecord.prototype);
const r43 = $callWithNewTarget(prototypeOf, r40, InvoiceRecord, r17);
const r44 = r43 instanceof Object ? r43 : r40;
r44.id = r17.id;
let invoiceItems = r17.invoiceItems;
if (invoiceItems == null) {
invoiceItems = [];
}
r44.invoiceItems = invoiceItems;
r44.taxInclusive = r17.taxInclusive;
r44.subscriptionPeriodStart = r17.subscriptionPeriodStart;
r44.subscriptionPeriodEnd = r17.subscriptionPeriodEnd;
r44.status = r17.status;
r44.orbsReward = r17.orbsReward;
r44.checkoutContext = r17.checkoutContext;
return r44;
}
findInvoiceItemByPlanId(c13680_0) {
let r7 = this.invoiceItems.find((invoiceItem) => invoiceItem.subscriptionPlanId === c13680_0);
if (r7 == null) {
r7 = null;
}
return r7;
}
getDiscountIdIfExists() {
const r7 = this.invoiceItems.find((invoiceItem) => invoiceItem.discounts.length > 0);
if (r7 != null && r7.discounts.length !== 0) {
const r11 = r7.discounts[0];
if (r11 != null) {
return r11.discount_id;
}
}
}
}
export default InvoiceRecord;
export { BaseInvoiceRecord };
+129
View File
@@ -0,0 +1,129 @@
// Metro module 4225 (f4226).
import Record from "../lib/Record";
import ApplicationStore from "../modules/applications/ApplicationStore";
import EntitlementRecord from "./EntitlementRecord";
import { Distributors, LibraryApplicationFlags, SKUTypes } from "../Constants";
import Module3771 from "../_bundle/Module3771";
import * as _Module1384 from "../_bundle/Module1384";
import { $callWithNewTarget } from "../_hermes/prelude";
class LibraryApplicationRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.createdAt = a0.createdAt;
this.flags = a0.flags;
this.branchId = a0.branchId;
this.entitlements = a0.entitlements;
this.branch = a0.branch;
this.sku = a0.sku;
this.isTestMode = a0.isTestMode || false;
}
static createFromServer(a0) {
const r2 = {
id: a0.application.id,
branchId: a0.branch_id,
entitlements: a0.entitlements != null ? a0.entitlements.map((entitlement) => EntitlementRecord.createFromServer(entitlement)) : [],
branch: a0.branch,
flags: a0.flags,
createdAt: a0.created_at,
sku: {
id: a0.sku.id,
type: a0.sku.type,
premium: a0.sku.premium,
preorderReleaseAt: a0.sku.preorder_release_at != null ? Module3771(a0.sku.preorder_release_at) : null,
preorderApproximateReleaseDate: a0.sku.preorder_approximate_release_date != null ? a0.sku.preorder_approximate_release_date : null
}
};
const prototypeOf = Object.getPrototypeOf(LibraryApplicationRecord);
const r45 = Object.create(LibraryApplicationRecord.prototype);
const r46 = $callWithNewTarget(prototypeOf, r45, LibraryApplicationRecord);
const r47 = r46 instanceof Object ? r46 : r45;
r47.id = r2.id;
r47.createdAt = r2.createdAt;
r47.flags = r2.flags;
r47.branchId = r2.branchId;
r47.entitlements = r2.entitlements;
r47.branch = r2.branch;
r47.sku = r2.sku;
r47.isTestMode = r2.isTestMode || false;
return r47;
}
static createForTestMode(a0) {
const id2 = a0.id;
const id = a0.branch.id;
const branch = a0.branch;
const ENTITLED = LibraryApplicationFlags.ENTITLED;
const created_at = a0.branch.created_at;
const sku = {
id: a0.skuId,
type: SKUTypes.DURABLE_PRIMARY,
premium: false
};
const entitlements = [];
const prototypeOf = Object.getPrototypeOf(LibraryApplicationRecord);
const r9 = Object.create(LibraryApplicationRecord.prototype);
const r24 = $callWithNewTarget(prototypeOf, r9, LibraryApplicationRecord);
const r25 = r24 instanceof Object ? r24 : r9;
r25.id = id2;
r25.createdAt = created_at;
r25.flags = ENTITLED;
r25.branchId = id;
r25.entitlements = entitlements;
r25.branch = branch;
r25.sku = sku;
r25.isTestMode = true;
return r25;
}
getFlags() {
return this.flags;
}
hasFlag(a0) {
return _Module1384.hasFlag(this.flags, a0);
}
isHidden() {
return this.hasFlag(LibraryApplicationFlags.HIDDEN);
}
isLegacyOverlayEnabled() {
return !this.hasFlag(LibraryApplicationFlags.OVERLAY_DISABLED);
}
isOverlayV3Enabled() {
return !this.hasFlag(LibraryApplicationFlags.OVERLAY_V3_DISABLED);
}
isOverlayEnabled() {
return this.isLegacyOverlayEnabled() || this.isOverlayV3Enabled();
}
isMasterBranch() {
return this.branchId === this.id;
}
isDiscordApplication() {
return true;
}
isEntitled(c14000_1, c14000_0) {
return !!this.isTestMode || this.entitlements.some((entitlement) => entitlement.isValid(c14000_1, c14000_0, this.branchId));
}
isPreorder() {
return this.sku.preorderReleaseAt != null || this.sku.preorderApproximateReleaseDate != null;
}
getDistributor() {
return Distributors.DISCORD;
}
getBranchName() {
return this.branch != null ? this.branch.name : "master";
}
getBranchedName(a0) {
return !this.isMasterBranch() && this.branch != null ? `${a0.name} (${this.branch.name})` : a0.name;
}
getSkuIdForAnalytics() {
return this.sku.id;
}
getAnalyticsData() {
const application = ApplicationStore.getApplication(this.id);
return {
application_id: application != null ? application.id : null,
application_name: application != null ? application.name : null,
sku_id: this.getSkuIdForAnalytics(),
launcher_platform: this.getDistributor()
};
}
}
export default LibraryApplicationRecord;
+40
View File
@@ -0,0 +1,40 @@
// Metro module 6166 (f6167).
import Record from "../lib/Record";
import { Routes } from "../Constants";
import { $callWithNewTarget } from "../_hermes/prelude";
class LinkRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.path = a0.path;
this.inviteCode = a0.inviteCode;
}
static fromPath(a0) {
const r1 = {
id: a0,
path: a0
};
const prototypeOf = Object.getPrototypeOf(LinkRecord);
const r10 = Object.create(LinkRecord.prototype);
const r11 = $callWithNewTarget(prototypeOf, r10, LinkRecord);
const r12 = r11 instanceof Object ? r11 : r10;
r12.id = r1.id;
r12.path = r1.path;
r12.inviteCode = r1.inviteCode;
return r12;
}
static fromInviteCode(a0) {
const id = `invite:${a0}`;
const path = Routes.INVITE(a0);
const prototypeOf = Object.getPrototypeOf(LinkRecord);
const r17 = Object.create(LinkRecord.prototype);
const r18 = $callWithNewTarget(prototypeOf, r17, LinkRecord);
const r19 = r18 instanceof Object ? r18 : r17;
r19.id = id;
r19.path = path;
r19.inviteCode = a0;
return r19;
}
}
export default LinkRecord;
export { LinkRecord };
+454
View File
@@ -0,0 +1,454 @@
// Metro module 3827 (f3828).
import Record from "../lib/Record";
import { MessageFlags, MessageStates, MessageTypes } from "../Constants";
import * as _Module1384 from "../_bundle/Module1384";
import { emojiEquals } from "../modules/reactions/ReactionUtils";
import isForwardMessage from "../modules/forwarding/isForwardMessage";
import { ReactionTypes } from "../modules/messages/MessageReactionsTypes";
import { ApplicationIntegrationType } from "../_bundle/Module8028";
class MinimalMessageRecord extends Record {
constructor(a0) {
super();
let type = a0.type;
if (type == null) {
type = MessageTypes.DEFAULT;
}
this.type = type;
let content = a0.content;
if (content == null) {
content = "";
}
this.content = content;
let attachments = a0.attachments;
if (attachments == null) {
attachments = [];
}
this.attachments = attachments;
let embeds = a0.embeds;
if (embeds == null) {
embeds = [];
}
this.embeds = embeds;
let timestamp = a0.timestamp;
if (timestamp == null) {
timestamp = new Date();
}
this.timestamp = timestamp;
let editedTimestamp = a0.editedTimestamp;
if (editedTimestamp == null) {
editedTimestamp = null;
}
this.editedTimestamp = editedTimestamp;
let flags = a0.flags;
if (flags == null) {
flags = 0;
}
this.flags = flags;
let components = a0.components;
if (components == null) {
components = [];
}
this.components = components;
let codedLinks = a0.codedLinks;
if (codedLinks == null) {
codedLinks = [];
}
this.codedLinks = codedLinks;
let stickers = a0.stickers;
if (stickers == null) {
stickers = [];
}
this.stickers = stickers;
let sticker_items = a0.sticker_items;
if (sticker_items == null) {
sticker_items = a0.stickerItems;
}
if (sticker_items == null) {
sticker_items = [];
}
this.stickerItems = sticker_items;
let soundboard_sounds = a0.soundboard_sounds;
if (soundboard_sounds == null) {
soundboard_sounds = a0.soundboardSounds;
}
this.soundboardSounds = soundboard_sounds;
}
hasFlag(a0) {
return _Module1384.hasFlag(this.flags, a0);
}
}
class MessageRecord extends MinimalMessageRecord {
constructor(a0) {
let mentionGames2;
super(a0);
this.id = a0.id;
this.channel_id = a0.channel_id;
this.author = a0.author;
this.customRenderedContent = a0.customRenderedContent;
this.mentions = a0.mentions || [];
this.mentionRoles = a0.mentionRoles || [];
this.mentionChannels = a0.mentionChannels || [];
if (a0.mentionGames instanceof Map) {
mentionGames2 = a0.mentionGames;
} else {
const r24 = Map;
let mentionGames = a0.mentionGames;
if (mentionGames == null) {
mentionGames = [];
}
mentionGames2 = new r24(mentionGames.map((mentionGame) => [mentionGame.id, mentionGame]));
}
this.mentionGames = mentionGames2;
this.mentioned = a0.mentioned || false;
this.pinned = a0.pinned || false;
this.mentionEveryone = a0.mentionEveryone || false;
this.tts = a0.tts || false;
this.giftCodes = a0.giftCodes || [];
this.state = a0.state || MessageStates.SENT;
let nonce = a0.nonce;
if (nonce == null) {
nonce = void 0;
}
this.nonce = nonce;
this.blocked = a0.blocked || false;
this.ignored = a0.ignored || false;
this.call = a0.call || null;
this.bot = a0.bot || false;
this.webhookId = a0.webhookId || null;
this.reactions = a0.reactions || [];
this.applicationId = a0.application_id || a0.applicationId || null;
this.application = a0.application || null;
this.activity = a0.activity || null;
this.activityInstance = a0.activity_instance || a0.activityInstance || null;
this.messageReference = a0.messageReference || null;
this.isSearchHit = a0.hit || a0.isSearchHit || false;
this.loggingName = a0.loggingName || null;
this.colorString = a0.colorString;
this.nick = a0.nick;
this.interaction = a0.interaction || null;
this.interactionData = a0.interactionData || null;
this.interactionMetadata = a0.interactionMetadata || null;
this.interactionError = a0.interactionError || null;
this.roleSubscriptionData = a0.roleSubscriptionData;
this.purchaseNotification = a0.purchaseNotification;
this.poll = a0.poll;
this.sharedClientTheme = a0.shared_client_theme || a0.sharedClientTheme;
this.referralTrialOfferId = a0.referralTrialOfferId || null;
this.premiumGroupInviteId = a0.premiumGroupInviteId || null;
let gift_info = a0.gift_info;
if (gift_info == null) {
gift_info = a0.giftInfo;
}
this.giftInfo = gift_info;
this.giftingPrompt = a0.giftingPrompt || null;
this.boostingPrompt = a0.boostingPrompt || null;
this.messageSnapshots = a0.messageSnapshots || [];
this.isUnsupported = a0.isUnsupported || false;
let changelog_id = a0.changelog_id;
if (changelog_id == null) {
changelog_id = a0.changelogId || null;
}
this.changelogId = changelog_id;
let media_mention = a0.media_mention;
if (media_mention == null) {
media_mention = a0.mediaMention;
}
if (media_mention == null) {
media_mention = null;
}
this.mediaMention = media_mention;
let additionalName = a0.lobby_member?.additional_name;
if (additionalName == null) {
additionalName = a0.additionalName;
}
if (additionalName == null) {
additionalName = null;
}
this.additionalName = additionalName;
}
isEdited() {
return this.editedTimestamp != null;
}
getChannelId() {
return this.channel_id;
}
getReaction(c13641_0) {
return this.reactions.find((reaction) => emojiEquals(reaction.emoji, c13641_0));
}
getContentMessage() {
return isForwardMessage(this) ? this.messageSnapshots[0].message : this;
}
userHasReactedWithEmoji(c13642_0, c13642_1) {
return this.reactions.some((reaction) => {
if (emojiEquals(reaction.emoji, c13642_0)) {
return c13642_1 && reaction.me || (c13642_1 ? !c13642_1 : reaction.me_burst);
}
});
}
addReaction(a0) {
let me_burst = arguments[1];
if (me_burst === void 0) {
me_burst = false;
}
let c13643_1 = me_burst;
let burst_colors = arguments[2];
if (burst_colors === void 0) {
burst_colors = [];
}
let c13643_2 = burst_colors;
let r4 = arguments[3];
if (r4 === void 0) {
r4 = ReactionTypes.NORMAL;
}
const NORMAL = r4;
let c13643_4 = -1;
const r18 = this.reactions.map((reaction, index) => {
const r16 = emojiEquals(reaction.emoji, a0);
let r17 = reaction;
if (r16) {
c13643_4 = index;
if (NORMAL === ReactionTypes.BURST) {
if (c13643_1 && reaction.me_burst) {
return reaction;
}
const burst_count = reaction.burst_count + 1;
r17 = {
...reaction,
me_burst: !!c13643_1 || reaction.me_burst,
burst_count,
count_details: {
...reaction.count_details,
burst: burst_count
},
burst_colors: reaction.burst_colors != null && reaction.burst_colors.length > 0 ? reaction.burst_colors : c13643_2
};
} else if (NORMAL === ReactionTypes.VOTE) {
let r41 = reaction.count_details?.vote;
if (r41 == null) {
r41 = 0;
}
r17 = {
...reaction,
count_details: {
...reaction.count_details,
vote: c13643_1 ? reaction.me_vote ? r41 : r41 + 1 : r41 + 1
},
me_vote: !!c13643_1 || reaction.me_vote
};
} else {
if (c13643_1 && reaction.me) {
return reaction;
}
const count = reaction.count + 1;
r17 = {
...reaction,
count,
count_details: {
...reaction.count_details,
normal: count
},
me: !!c13643_1 || reaction.me
};
}
}
return r17;
});
if (c13643_4 === -1) {
if (NORMAL === ReactionTypes.BURST) {
r18.push({
emoji: a0,
me: false,
me_burst,
count: 0,
count_details: {
burst: 1,
normal: 0
},
burst_count: 1,
burst_colors
});
} else if (NORMAL === ReactionTypes.VOTE) {
r18.push({
emoji: a0,
me: false,
me_burst: false,
me_vote: me_burst,
count: 0,
count_details: {
burst: 0,
normal: 0,
vote: 1
},
burst_count: 0,
burst_colors: []
});
} else {
r18.push({
emoji: a0,
me: me_burst,
me_burst: false,
count: 1,
count_details: {
burst: 0,
normal: 1
},
burst_count: 0,
burst_colors: []
});
}
}
return this.set("reactions", r18);
}
addReactionBatch(a0, c13644_0) {
return a0.reduce((acc, { users, emoji, reactionType }) => users.reduce((acc, user) => acc.addReaction(emoji, user === c13644_0, [], reactionType), acc), this);
}
removeReaction(c13645_0, r12 = false) {
let c13645_1 = r12;
let r13 = arguments[2];
if (r13 === void 0) {
r13 = ReactionTypes.NORMAL;
}
const NORMAL2 = r13;
let c13645_3 = -1;
const r21 = this.reactions.map((reaction, index) => {
let r32;
const r17 = emojiEquals(reaction.emoji, c13645_0);
let r18 = reaction;
if (r17) {
if (NORMAL2 === ReactionTypes.BURST) {
const burst_count = c13645_1 && !reaction.me_burst ? reaction.burst_count : reaction.burst_count - 1;
r32 = {
...reaction,
burst_count,
me_burst: c13645_1 ? !c13645_1 : reaction.me_burst,
count_details: {
...reaction.count_details,
burst: burst_count
}
};
} else if (NORMAL2 === ReactionTypes.VOTE) {
let r40 = reaction.count_details?.vote;
if (r40 == null) {
r40 = 0;
}
r32 = {
...reaction,
count_details: {
...reaction.count_details,
vote: c13645_1 ? reaction.me_vote ? r40 - 1 : r40 : r40 - 1
},
me_vote: c13645_1 ? !c13645_1 : reaction.me_vote
};
} else {
const count = c13645_1 && !reaction.me ? reaction.count : reaction.count - 1;
r32 = {
...reaction,
count,
me: c13645_1 ? !c13645_1 : reaction.me,
count_details: {
...reaction.count_details,
normal: count
}
};
}
c13645_3 = index;
r18 = r32;
}
return r18;
});
let r23 = r21[c13645_3];
if (r23 == null) {
r23 = {};
}
const { count, burst_count, count_details } = r23;
let r1 = c13645_3 !== -1 && count <= 0 && burst_count <= 0;
if (r1) {
let r28 = count_details?.normal;
if (r28 == null) {
r28 = 0;
}
r1 = r28 <= 0;
}
if (r1) {
let r31 = count_details?.burst;
if (r31 == null) {
r31 = 0;
}
r1 = r31 <= 0;
}
if (r1) {
let r34 = count_details?.vote;
if (r34 == null) {
r34 = 0;
}
r1 = r34 <= 0;
}
if (r1) {
r21.splice(c13645_3, 1);
}
return this.set("reactions", r21);
}
removeReactionsForEmoji(c13646_0) {
return this.set("reactions", this.reactions.filter((reaction) => !emojiEquals(reaction.emoji, c13646_0)));
}
isSystemDM() {
return this.author.isSystemUser();
}
isCommandType() {
return this.type === MessageTypes.CHAT_INPUT_COMMAND || this.type === MessageTypes.CONTEXT_MENU_COMMAND;
}
isPoll() {
return this.poll != null;
}
isInteractionPlaceholder() {
return this.interaction != null && this.author.isNonUserBot();
}
canDeleteOwnMessage(a0) {
if (this.author.id === a0) {
return true;
}
let r9 = this.interactionMetadata?.authorizing_integration_owners;
if (r9 == null) {
r9 = {};
}
const interactionMetadata = this.interactionMetadata;
return (interactionMetadata == null ? void 0 : interactionMetadata.user.id) === a0 && Object.keys(r9).length === 1 && ApplicationIntegrationType.USER_INSTALL in r9;
}
toJS() {
return {
...this,
mentionGames: [...this.mentionGames.values()],
webkhook_id: this.webhookId,
edited_timestamp: this.editedTimestamp,
mention_everyone: this.mentionEveryone
};
}
isFirstMessageInForumPost(a0) {
return this.id === this.channel_id && a0.isForumPost();
}
}
export default MessageRecord;
export { MinimalMessageRecord };
export class ModeratorReport {
constructor(a0) {
this.reporting_user_id = a0.reporting_user_id;
this.reported_user_id = a0.reported_user_id;
this.reporting_member = a0.reporting_member;
this.reported_member = a0.reported_member;
}
}
class MessageSnapshotRecord extends Record {
constructor(a0) {
super();
this.message = new MinimalMessageRecord(a0.message);
let moderator_report = a0.moderator_report;
if (moderator_report == null) {
moderator_report = null;
}
this.moderatorReport = moderator_report;
}
}
export { MessageSnapshotRecord };
export function isMessageComponentsV2(a0) {
return _Module1384.hasFlag(a0.flags, MessageFlags.IS_COMPONENTS_V2);
}
+811
View File
@@ -0,0 +1,811 @@
// Metro module 3839 (f3840).
import Record from "../lib/Record";
import { IRREDEEMABLE_PAYMENT_SOURCES, PaymentGateways, PaymentSourceTypes } from "../Constants";
import { assertNever } from "../utils/GlobalUtils";
import * as _Module1384 from "../_bundle/Module1384";
import { $callWithNewTarget } from "../_hermes/prelude";
let PaypalSourceRecord, SofortSourceRecord, GiropaySourceRecord, Przelewy24SourceRecord, EPSSourceRecord, IdealSourceRecord, PaysafeSourceRecord, GcashSourceRecord, GrabPayMySourceRecord, MomoWalletSourceRecord, VenmoSourceRecord, KaKaoPaySourceRecord, GoPayWalletSourceRecord, BancontactSourceRecord, CashAppSourceRecord, TDSWalletSourceRecord;
class PaymentSourceRecord extends Record {
constructor(a0) {
super();
if (Object.values(PaymentSourceTypes).includes(a0.type)) {
this.id = a0.id;
this.type = a0.type;
this.paymentGateway = a0.paymentGateway;
let invalid = a0.invalid;
if (invalid == null) {
invalid = false;
}
this.invalid = invalid;
let billingAddress = a0.billingAddress;
if (billingAddress == null) {
billingAddress = {};
}
this.billingAddress = billingAddress;
this.isDefault = a0.isDefault;
let flags = a0.flags;
if (flags == null) {
flags = 0;
}
this.flags = flags;
let country = a0.country;
if (country == null) {
country = "";
}
this.country = country;
this.pixMetadata = a0.pixMetadata;
return this;
}
throw new Error(`Unrecognized payment source type ${a0.type}`);
}
static createFromServer(a0) {
let billing_address = a0.billing_address;
if (billing_address == null) {
billing_address = {};
}
const r9 = {
id: a0.id,
type: a0.type,
paymentGateway: a0.payment_gateway,
invalid: a0.invalid,
isDefault: a0.default,
billingAddress: {
name: billing_address.name,
line1: billing_address.line_1,
line2: billing_address.line_2,
city: billing_address.city,
postalCode: billing_address.postal_code,
state: billing_address.state,
country: billing_address.country
},
country: a0.country,
flags: a0.flags,
pixMetadata: a0.pix != null ? {
taxId: a0.pix.tax_id
} : void 0
};
const type = a0.type;
if (PaymentSourceTypes.CARD === type) {
const r607 = {
...r9,
brand: a0.brand,
last4: a0.last_4,
expiresMonth: a0.expires_month,
expiresYear: a0.expires_year
};
const prototypeOf18 = Object.getPrototypeOf(CreditCardSourceRecord);
const r620 = Object.create(CreditCardSourceRecord.prototype);
const r623 = $callWithNewTarget(prototypeOf18, r620, CreditCardSourceRecord, r607);
if (r607.type !== PaymentSourceTypes.CARD) {
throw new Error(`Cannot instantiate CreditCardSourceRecord with type: ${r607.type}, must be ${PaymentSourceTypes.CARD}`);
}
let brand = r607.brand;
if (brand == null) {
brand = "";
}
const r628 = r623 instanceof Object ? r623 : r620;
r628.brand = brand;
let last4 = r607.last4;
if (last4 == null) {
last4 = "";
}
r628.last4 = last4;
let expiresMonth = r607.expiresMonth;
if (expiresMonth == null) {
expiresMonth = 0;
}
r628.expiresMonth = expiresMonth;
let expiresYear = r607.expiresYear;
if (expiresYear == null) {
expiresYear = 0;
}
r628.expiresYear = expiresYear;
return r628;
}
if (PaymentSourceTypes.PAYPAL === type) {
const r574 = {
...r9,
email: a0.email
};
const prototypeOf17 = Object.getPrototypeOf(PaypalSourceRecord);
const r584 = Object.create(PaypalSourceRecord.prototype);
const r587 = $callWithNewTarget(prototypeOf17, r584, PaypalSourceRecord, r574);
if (r574.type !== PaymentSourceTypes.PAYPAL) {
throw new Error(`Cannot instantiate PaypalSourceRecord with type: ${r574.type}, must be ${PaymentSourceTypes.PAYPAL}`);
}
const email3 = r574.email || "";
const r592 = r587 instanceof Object ? r587 : r584;
r592.email = email3;
return r592;
}
if (PaymentSourceTypes.VENMO === type) {
const r541 = {
...r9,
username: a0.username
};
const prototypeOf16 = Object.getPrototypeOf(VenmoSourceRecord);
const r551 = Object.create(VenmoSourceRecord.prototype);
const r554 = $callWithNewTarget(prototypeOf16, r551, VenmoSourceRecord, r541);
if (r541.type !== PaymentSourceTypes.VENMO) {
throw new Error(`Cannot instantiate VenmoSourceRecord with type: ${r541.type}, must be ${PaymentSourceTypes.VENMO}`);
}
const username2 = r541.username || "";
const r559 = r554 instanceof Object ? r554 : r551;
r559.username = username2;
return r559;
}
if (PaymentSourceTypes.SEPA_DEBIT !== type && PaymentSourceTypes.SOFORT !== type) {
if (PaymentSourceTypes.GIROPAY === type) {
const r474 = {
...r9
};
const prototypeOf14 = Object.getPrototypeOf(GiropaySourceRecord);
const r483 = Object.create(GiropaySourceRecord.prototype);
const r486 = $callWithNewTarget(prototypeOf14, r483, GiropaySourceRecord, r474);
if (r474.type !== PaymentSourceTypes.GIROPAY) {
throw new Error(`Cannot instantiate GiropaySourceRecord with type: ${r474.type}, must be ${PaymentSourceTypes.GIROPAY}`);
}
return r486 instanceof Object ? r486 : r483;
}
if (PaymentSourceTypes.PRZELEWY24 === type) {
const r439 = {
...r9,
email: a0.email,
bank: a0.bank
};
const prototypeOf13 = Object.getPrototypeOf(Przelewy24SourceRecord);
const r450 = Object.create(Przelewy24SourceRecord.prototype);
const r453 = $callWithNewTarget(prototypeOf13, r450, Przelewy24SourceRecord, r439);
if (r439.type !== PaymentSourceTypes.PRZELEWY24) {
throw new Error(`Cannot instantiate Przelewy24SourceRecord with type: ${r439.type}, must be ${PaymentSourceTypes.PRZELEWY24}`);
}
const email = r439.email || "";
const r458 = r453 instanceof Object ? r453 : r450;
r458.email = email;
r458.bank = r439.bank;
return r458;
}
if (PaymentSourceTypes.EPS === type) {
const r406 = {
...r9,
bank: a0.bank
};
const prototypeOf12 = Object.getPrototypeOf(EPSSourceRecord);
const r416 = Object.create(EPSSourceRecord.prototype);
const r419 = $callWithNewTarget(prototypeOf12, r416, EPSSourceRecord, r406);
if (r406.type !== PaymentSourceTypes.EPS) {
throw new Error(`Cannot instantiate EPSSourceRecord with type: ${r406.type}, must be ${PaymentSourceTypes.EPS}`);
}
const r423 = r419 instanceof Object ? r419 : r416;
r423.bank = r406.bank;
return r423;
}
if (PaymentSourceTypes.PAYSAFE_CARD === type) {
const r375 = {
...r9
};
const prototypeOf11 = Object.getPrototypeOf(PaysafeSourceRecord);
const r384 = Object.create(PaysafeSourceRecord.prototype);
const r387 = $callWithNewTarget(prototypeOf11, r384, PaysafeSourceRecord, r375);
if (r375.type !== PaymentSourceTypes.PAYSAFE_CARD) {
throw new Error(`Cannot instantiate PaysafeSourceRecord with type: ${r375.type}, must be ${PaymentSourceTypes.PAYSAFE_CARD}`);
}
return r387 instanceof Object ? r387 : r384;
}
if (PaymentSourceTypes.GCASH === type) {
const r344 = {
...r9
};
const prototypeOf10 = Object.getPrototypeOf(GcashSourceRecord);
const r353 = Object.create(GcashSourceRecord.prototype);
const r356 = $callWithNewTarget(prototypeOf10, r353, GcashSourceRecord, r344);
if (r344.type !== PaymentSourceTypes.GCASH) {
throw new Error(`Cannot instantiate GcashSourceRecord with type: ${r344.type}, must be ${PaymentSourceTypes.GCASH}`);
}
return r356 instanceof Object ? r356 : r353;
}
if (PaymentSourceTypes.GRABPAY_MY === type) {
const r313 = {
...r9
};
const prototypeOf9 = Object.getPrototypeOf(GrabPayMySourceRecord);
const r322 = Object.create(GrabPayMySourceRecord.prototype);
const r325 = $callWithNewTarget(prototypeOf9, r322, GrabPayMySourceRecord, r313);
if (r313.type !== PaymentSourceTypes.GRABPAY_MY) {
throw new Error(`Cannot instantiate GrabPayMySourceRecord with type: ${r313.type}, must be ${PaymentSourceTypes.GRABPAY_MY}`);
}
return r325 instanceof Object ? r325 : r322;
}
if (PaymentSourceTypes.MOMO_WALLET === type) {
const r282 = {
...r9
};
const prototypeOf8 = Object.getPrototypeOf(MomoWalletSourceRecord);
const r291 = Object.create(MomoWalletSourceRecord.prototype);
const r294 = $callWithNewTarget(prototypeOf8, r291, MomoWalletSourceRecord, r282);
if (r282.type !== PaymentSourceTypes.MOMO_WALLET) {
throw new Error(`Cannot instantiate MomoWalletSourceRecord with type: ${r282.type}, must be ${PaymentSourceTypes.MOMO_WALLET}`);
}
return r294 instanceof Object ? r294 : r291;
}
if (PaymentSourceTypes.KAKAOPAY === type) {
const r251 = {
...r9
};
const prototypeOf7 = Object.getPrototypeOf(KaKaoPaySourceRecord);
const r260 = Object.create(KaKaoPaySourceRecord.prototype);
const r263 = $callWithNewTarget(prototypeOf7, r260, KaKaoPaySourceRecord, r251);
if (r251.type !== PaymentSourceTypes.KAKAOPAY) {
throw new Error(`Cannot instantiate KaKaoPaySourceRecord with type: ${r251.type}, must be ${PaymentSourceTypes.KAKAOPAY}`);
}
return r263 instanceof Object ? r263 : r260;
}
if (PaymentSourceTypes.GOPAY_WALLET === type) {
const r220 = {
...r9
};
const prototypeOf6 = Object.getPrototypeOf(GoPayWalletSourceRecord);
const r229 = Object.create(GoPayWalletSourceRecord.prototype);
const r232 = $callWithNewTarget(prototypeOf6, r229, GoPayWalletSourceRecord, r220);
if (r220.type !== PaymentSourceTypes.GOPAY_WALLET) {
throw new Error(`Cannot instantiate GoPayWalletSourceRecord with type: ${r220.type}, must be ${PaymentSourceTypes.GOPAY_WALLET}`);
}
return r232 instanceof Object ? r232 : r229;
}
if (PaymentSourceTypes.BANCONTACT === type) {
const r189 = {
...r9
};
const prototypeOf5 = Object.getPrototypeOf(BancontactSourceRecord);
const r198 = Object.create(BancontactSourceRecord.prototype);
const r201 = $callWithNewTarget(prototypeOf5, r198, BancontactSourceRecord, r189);
if (r189.type !== PaymentSourceTypes.BANCONTACT) {
throw new Error(`Cannot instantiate BancontactSourceRecord with type: ${r189.type}, must be ${PaymentSourceTypes.BANCONTACT}`);
}
return r201 instanceof Object ? r201 : r198;
}
if (PaymentSourceTypes.IDEAL === type) {
const r156 = {
...r9,
bank: a0.bank
};
const prototypeOf4 = Object.getPrototypeOf(IdealSourceRecord);
const r166 = Object.create(IdealSourceRecord.prototype);
const r169 = $callWithNewTarget(prototypeOf4, r166, IdealSourceRecord, r156);
if (r156.type !== PaymentSourceTypes.IDEAL) {
throw new Error(`Cannot instantiate IdealSourceRecord with type: ${r156.type}, must be ${PaymentSourceTypes.IDEAL}`);
}
const r173 = r169 instanceof Object ? r169 : r166;
r173.bank = r156.bank;
return r173;
}
if (PaymentSourceTypes.CASH_APP === type) {
const r123 = {
...r9,
username: a0.username
};
const prototypeOf3 = Object.getPrototypeOf(CashAppSourceRecord);
const r133 = Object.create(CashAppSourceRecord.prototype);
const r136 = $callWithNewTarget(prototypeOf3, r133, CashAppSourceRecord, r123);
if (r123.type !== PaymentSourceTypes.CASH_APP) {
throw new Error(`Cannot instantiate Cashapp with type: ${r123.type}, must be ${PaymentSourceTypes.CASH_APP}`);
}
const username = r123.username || "";
const r141 = r136 instanceof Object ? r136 : r133;
r141.username = username;
return r141;
}
if (PaymentSourceTypes.TDS_WALLET === type) {
const r92 = {
...r9
};
const prototypeOf2 = Object.getPrototypeOf(TDSWalletSourceRecord);
const r101 = Object.create(TDSWalletSourceRecord.prototype);
const r104 = $callWithNewTarget(prototypeOf2, r101, TDSWalletSourceRecord, r92);
if (r92.type !== PaymentSourceTypes.TDS_WALLET) {
throw new Error(`Cannot instantiate TDSWalletSourceRecord with type: ${r92.type}, must be ${PaymentSourceTypes.TDS_WALLET}`);
}
return r104 instanceof Object ? r104 : r101;
}
if (PaymentSourceTypes.PIX === type) {
const r65 = {
...r9,
email: a0.email
};
const prototypeOf = Object.getPrototypeOf(PixSourceRecord);
const r10 = Object.create(PixSourceRecord.prototype);
const r74 = $callWithNewTarget(prototypeOf, r10, PixSourceRecord, r65);
if (r65.type !== PaymentSourceTypes.PIX) {
throw new Error(`Cannot instantiate PixSourceRecord with type: ${r65.type}, must be ${PaymentSourceTypes.PIX}`);
}
const r77 = r74 instanceof Object ? r74 : r10;
r77.email = r65.email;
return r77;
}
assertNever(a0);
return void 0;
}
const r505 = {
...r9,
email: a0.email
};
const prototypeOf15 = Object.getPrototypeOf(SofortSourceRecord);
const r515 = Object.create(SofortSourceRecord.prototype);
const r518 = $callWithNewTarget(prototypeOf15, r515, SofortSourceRecord, r505);
if (r505.type !== PaymentSourceTypes.SOFORT && r505.type !== PaymentSourceTypes.SEPA_DEBIT) {
throw new Error(`Cannot instantiate SofortSourceRecord with type: ${r505.type}, must be ${PaymentSourceTypes.SOFORT} or ` + PaymentSourceTypes.SEPA_DEBIT);
}
const email2 = r505.email || "";
const r525 = r518 instanceof Object ? r518 : r515;
r525.email = email2;
return r525;
}
static createFromSerialized(a0) {
const type = a0.type;
if (PaymentSourceTypes.CARD === type) {
const prototypeOf18 = Object.getPrototypeOf(CreditCardSourceRecord);
const r511 = Object.create(CreditCardSourceRecord.prototype);
const r514 = $callWithNewTarget(prototypeOf18, r511, CreditCardSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.CARD) {
throw new Error(`Cannot instantiate CreditCardSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.CARD}`);
}
let brand = a0.brand;
if (brand == null) {
brand = "";
}
const r520 = r514 instanceof Object ? r514 : r511;
r520.brand = brand;
let last4 = a0.last4;
if (last4 == null) {
last4 = "";
}
r520.last4 = last4;
let expiresMonth = a0.expiresMonth;
if (expiresMonth == null) {
expiresMonth = 0;
}
r520.expiresMonth = expiresMonth;
let expiresYear = a0.expiresYear;
if (expiresYear == null) {
expiresYear = 0;
}
r520.expiresYear = expiresYear;
return r520;
}
if (PaymentSourceTypes.PAYPAL === type) {
const prototypeOf17 = Object.getPrototypeOf(PaypalSourceRecord);
const r483 = Object.create(PaypalSourceRecord.prototype);
const r486 = $callWithNewTarget(prototypeOf17, r483, PaypalSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.PAYPAL) {
throw new Error(`Cannot instantiate PaypalSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PAYPAL}`);
}
const email3 = a0.email || "";
const r491 = r486 instanceof Object ? r486 : r483;
r491.email = email3;
return r491;
}
if (PaymentSourceTypes.SOFORT !== type && PaymentSourceTypes.SEPA_DEBIT !== type) {
if (PaymentSourceTypes.GIROPAY === type) {
const prototypeOf15 = Object.getPrototypeOf(GiropaySourceRecord);
const r426 = Object.create(GiropaySourceRecord.prototype);
const r429 = $callWithNewTarget(prototypeOf15, r426, GiropaySourceRecord, a0);
if (a0.type !== PaymentSourceTypes.GIROPAY) {
throw new Error(`Cannot instantiate GiropaySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GIROPAY}`);
}
return r429 instanceof Object ? r429 : r426;
}
if (PaymentSourceTypes.PRZELEWY24 === type) {
const prototypeOf14 = Object.getPrototypeOf(Przelewy24SourceRecord);
const r397 = Object.create(Przelewy24SourceRecord.prototype);
const r400 = $callWithNewTarget(prototypeOf14, r397, Przelewy24SourceRecord, a0);
if (a0.type !== PaymentSourceTypes.PRZELEWY24) {
throw new Error(`Cannot instantiate Przelewy24SourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PRZELEWY24}`);
}
const email = a0.email || "";
const r405 = r400 instanceof Object ? r400 : r397;
r405.email = email;
r405.bank = a0.bank;
return r405;
}
if (PaymentSourceTypes.PAYSAFE_CARD === type) {
const prototypeOf13 = Object.getPrototypeOf(PaysafeSourceRecord);
const r370 = Object.create(PaysafeSourceRecord.prototype);
const r373 = $callWithNewTarget(prototypeOf13, r370, PaysafeSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.PAYSAFE_CARD) {
throw new Error(`Cannot instantiate PaysafeSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PAYSAFE_CARD}`);
}
return r373 instanceof Object ? r373 : r370;
}
if (PaymentSourceTypes.GCASH === type) {
const prototypeOf12 = Object.getPrototypeOf(GcashSourceRecord);
const r343 = Object.create(GcashSourceRecord.prototype);
const r346 = $callWithNewTarget(prototypeOf12, r343, GcashSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.GCASH) {
throw new Error(`Cannot instantiate GcashSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GCASH}`);
}
return r346 instanceof Object ? r346 : r343;
}
if (PaymentSourceTypes.GRABPAY_MY === type) {
const prototypeOf11 = Object.getPrototypeOf(GrabPayMySourceRecord);
const r316 = Object.create(GrabPayMySourceRecord.prototype);
const r319 = $callWithNewTarget(prototypeOf11, r316, GrabPayMySourceRecord, a0);
if (a0.type !== PaymentSourceTypes.GRABPAY_MY) {
throw new Error(`Cannot instantiate GrabPayMySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GRABPAY_MY}`);
}
return r319 instanceof Object ? r319 : r316;
}
if (PaymentSourceTypes.MOMO_WALLET === type) {
const prototypeOf10 = Object.getPrototypeOf(MomoWalletSourceRecord);
const r289 = Object.create(MomoWalletSourceRecord.prototype);
const r292 = $callWithNewTarget(prototypeOf10, r289, MomoWalletSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.MOMO_WALLET) {
throw new Error(`Cannot instantiate MomoWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.MOMO_WALLET}`);
}
return r292 instanceof Object ? r292 : r289;
}
if (PaymentSourceTypes.VENMO === type) {
const prototypeOf9 = Object.getPrototypeOf(VenmoSourceRecord);
const r261 = Object.create(VenmoSourceRecord.prototype);
const r264 = $callWithNewTarget(prototypeOf9, r261, VenmoSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.VENMO) {
throw new Error(`Cannot instantiate VenmoSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.VENMO}`);
}
const username2 = a0.username || "";
const r269 = r264 instanceof Object ? r264 : r261;
r269.username = username2;
return r269;
}
if (PaymentSourceTypes.KAKAOPAY === type) {
const prototypeOf8 = Object.getPrototypeOf(KaKaoPaySourceRecord);
const r234 = Object.create(KaKaoPaySourceRecord.prototype);
const r237 = $callWithNewTarget(prototypeOf8, r234, KaKaoPaySourceRecord, a0);
if (a0.type !== PaymentSourceTypes.KAKAOPAY) {
throw new Error(`Cannot instantiate KaKaoPaySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.KAKAOPAY}`);
}
return r237 instanceof Object ? r237 : r234;
}
if (PaymentSourceTypes.GOPAY_WALLET === type) {
const prototypeOf7 = Object.getPrototypeOf(GoPayWalletSourceRecord);
const r207 = Object.create(GoPayWalletSourceRecord.prototype);
const r210 = $callWithNewTarget(prototypeOf7, r207, GoPayWalletSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.GOPAY_WALLET) {
throw new Error(`Cannot instantiate GoPayWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GOPAY_WALLET}`);
}
return r210 instanceof Object ? r210 : r207;
}
if (PaymentSourceTypes.BANCONTACT === type) {
const prototypeOf6 = Object.getPrototypeOf(BancontactSourceRecord);
const r180 = Object.create(BancontactSourceRecord.prototype);
const r183 = $callWithNewTarget(prototypeOf6, r180, BancontactSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.BANCONTACT) {
throw new Error(`Cannot instantiate BancontactSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.BANCONTACT}`);
}
return r183 instanceof Object ? r183 : r180;
}
if (PaymentSourceTypes.EPS === type) {
const prototypeOf5 = Object.getPrototypeOf(EPSSourceRecord);
const r152 = Object.create(EPSSourceRecord.prototype);
const r155 = $callWithNewTarget(prototypeOf5, r152, EPSSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.EPS) {
throw new Error(`Cannot instantiate EPSSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.EPS}`);
}
const r159 = r155 instanceof Object ? r155 : r152;
r159.bank = a0.bank;
return r159;
}
if (PaymentSourceTypes.IDEAL === type) {
const prototypeOf4 = Object.getPrototypeOf(IdealSourceRecord);
const r124 = Object.create(IdealSourceRecord.prototype);
const r127 = $callWithNewTarget(prototypeOf4, r124, IdealSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.IDEAL) {
throw new Error(`Cannot instantiate IdealSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.IDEAL}`);
}
const r131 = r127 instanceof Object ? r127 : r124;
r131.bank = a0.bank;
return r131;
}
if (PaymentSourceTypes.CASH_APP === type) {
const prototypeOf3 = Object.getPrototypeOf(CashAppSourceRecord);
const r96 = Object.create(CashAppSourceRecord.prototype);
const r99 = $callWithNewTarget(prototypeOf3, r96, CashAppSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.CASH_APP) {
throw new Error(`Cannot instantiate Cashapp with type: ${a0.type}, must be ${PaymentSourceTypes.CASH_APP}`);
}
const username = a0.username || "";
const r104 = r99 instanceof Object ? r99 : r96;
r104.username = username;
return r104;
}
if (PaymentSourceTypes.TDS_WALLET === type) {
const prototypeOf2 = Object.getPrototypeOf(TDSWalletSourceRecord);
const r69 = Object.create(TDSWalletSourceRecord.prototype);
const r72 = $callWithNewTarget(prototypeOf2, r69, TDSWalletSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.TDS_WALLET) {
throw new Error(`Cannot instantiate TDSWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.TDS_WALLET}`);
}
return r72 instanceof Object ? r72 : r69;
}
if (PaymentSourceTypes.PIX === type) {
const prototypeOf = Object.getPrototypeOf(PixSourceRecord);
const r45 = Object.create(PixSourceRecord.prototype);
const r47 = $callWithNewTarget(prototypeOf, r45, PixSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.PIX) {
throw new Error(`Cannot instantiate PixSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PIX}`);
}
const r50 = r47 instanceof Object ? r47 : r45;
r50.email = a0.email;
return r50;
}
assertNever(type);
return void 0;
}
const prototypeOf16 = Object.getPrototypeOf(SofortSourceRecord);
const r453 = Object.create(SofortSourceRecord.prototype);
const r456 = $callWithNewTarget(prototypeOf16, r453, SofortSourceRecord, a0);
if (a0.type !== PaymentSourceTypes.SOFORT && a0.type !== PaymentSourceTypes.SEPA_DEBIT) {
throw new Error(`Cannot instantiate SofortSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.SOFORT} or ` + PaymentSourceTypes.SEPA_DEBIT);
}
const email2 = a0.email || "";
const r463 = r456 instanceof Object ? r456 : r453;
r463.email = email2;
return r463;
}
hasFlag(a0) {
return _Module1384.hasFlag(this.flags, a0);
}
get paymentMethodCountry() {
return this.country != null && this.country !== "" ? this.country : this.billingAddress.country;
}
canRedeemTrial() {
return !IRREDEEMABLE_PAYMENT_SOURCES.has(this.type);
}
}
class CreditCardSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.CARD) {
throw new Error(`Cannot instantiate CreditCardSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.CARD}`);
}
let brand = a0.brand;
if (brand == null) {
brand = "";
}
this.brand = brand;
let last4 = a0.last4;
if (last4 == null) {
last4 = "";
}
this.last4 = last4;
let expiresMonth = a0.expiresMonth;
if (expiresMonth == null) {
expiresMonth = 0;
}
this.expiresMonth = expiresMonth;
let expiresYear = a0.expiresYear;
if (expiresYear == null) {
expiresYear = 0;
}
this.expiresYear = expiresYear;
}
get isStripeLinkBankAccount() {
return this.brand === "link" && this.last4 === "0000";
}
}
const PaypalSourceRecord2 = class PaypalSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.PAYPAL) {
throw new Error(`Cannot instantiate PaypalSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PAYPAL}`);
}
const email = a0.email || "";
this.email = email;
}
};
PaypalSourceRecord2.prototype;
PaypalSourceRecord = PaypalSourceRecord2;
const SofortSourceRecord2 = class SofortSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.SOFORT && a0.type !== PaymentSourceTypes.SEPA_DEBIT) {
throw new Error(`Cannot instantiate SofortSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.SOFORT} or ` + PaymentSourceTypes.SEPA_DEBIT);
}
const email = a0.email || "";
this.email = email;
}
};
SofortSourceRecord2.prototype;
SofortSourceRecord = SofortSourceRecord2;
const GiropaySourceRecord2 = class GiropaySourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.GIROPAY) {
throw new Error(`Cannot instantiate GiropaySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GIROPAY}`);
}
}
};
GiropaySourceRecord2.prototype;
GiropaySourceRecord = GiropaySourceRecord2;
const Przelewy24SourceRecord2 = class Przelewy24SourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.PRZELEWY24) {
throw new Error(`Cannot instantiate Przelewy24SourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PRZELEWY24}`);
}
const email = a0.email || "";
this.email = email;
this.bank = a0.bank;
}
};
Przelewy24SourceRecord2.prototype;
Przelewy24SourceRecord = Przelewy24SourceRecord2;
const EPSSourceRecord2 = class EPSSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.EPS) {
throw new Error(`Cannot instantiate EPSSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.EPS}`);
}
this.bank = a0.bank;
}
};
EPSSourceRecord2.prototype;
EPSSourceRecord = EPSSourceRecord2;
const IdealSourceRecord2 = class IdealSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.IDEAL) {
throw new Error(`Cannot instantiate IdealSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.IDEAL}`);
}
this.bank = a0.bank;
}
};
IdealSourceRecord2.prototype;
IdealSourceRecord = IdealSourceRecord2;
const PaysafeSourceRecord2 = class PaysafeSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.PAYSAFE_CARD) {
throw new Error(`Cannot instantiate PaysafeSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PAYSAFE_CARD}`);
}
}
};
PaysafeSourceRecord2.prototype;
PaysafeSourceRecord = PaysafeSourceRecord2;
const GcashSourceRecord2 = class GcashSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.GCASH) {
throw new Error(`Cannot instantiate GcashSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GCASH}`);
}
}
};
GcashSourceRecord2.prototype;
GcashSourceRecord = GcashSourceRecord2;
const GrabPayMySourceRecord2 = class GrabPayMySourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.GRABPAY_MY) {
throw new Error(`Cannot instantiate GrabPayMySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GRABPAY_MY}`);
}
}
};
GrabPayMySourceRecord2.prototype;
GrabPayMySourceRecord = GrabPayMySourceRecord2;
const MomoWalletSourceRecord2 = class MomoWalletSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.MOMO_WALLET) {
throw new Error(`Cannot instantiate MomoWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.MOMO_WALLET}`);
}
}
};
MomoWalletSourceRecord2.prototype;
MomoWalletSourceRecord = MomoWalletSourceRecord2;
const VenmoSourceRecord2 = class VenmoSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.VENMO) {
throw new Error(`Cannot instantiate VenmoSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.VENMO}`);
}
const username = a0.username || "";
this.username = username;
}
};
VenmoSourceRecord2.prototype;
VenmoSourceRecord = VenmoSourceRecord2;
const KaKaoPaySourceRecord2 = class KaKaoPaySourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.KAKAOPAY) {
throw new Error(`Cannot instantiate KaKaoPaySourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.KAKAOPAY}`);
}
}
};
KaKaoPaySourceRecord2.prototype;
KaKaoPaySourceRecord = KaKaoPaySourceRecord2;
const GoPayWalletSourceRecord2 = class GoPayWalletSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.GOPAY_WALLET) {
throw new Error(`Cannot instantiate GoPayWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.GOPAY_WALLET}`);
}
}
};
GoPayWalletSourceRecord2.prototype;
GoPayWalletSourceRecord = GoPayWalletSourceRecord2;
const BancontactSourceRecord2 = class BancontactSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.BANCONTACT) {
throw new Error(`Cannot instantiate BancontactSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.BANCONTACT}`);
}
}
};
BancontactSourceRecord2.prototype;
BancontactSourceRecord = BancontactSourceRecord2;
const CashAppSourceRecord2 = class CashAppSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.CASH_APP) {
throw new Error(`Cannot instantiate Cashapp with type: ${a0.type}, must be ${PaymentSourceTypes.CASH_APP}`);
}
const username = a0.username || "";
this.username = username;
}
};
CashAppSourceRecord2.prototype;
CashAppSourceRecord = CashAppSourceRecord2;
const TDSWalletSourceRecord2 = class TDSWalletSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.TDS_WALLET) {
throw new Error(`Cannot instantiate TDSWalletSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.TDS_WALLET}`);
}
}
};
TDSWalletSourceRecord2.prototype;
TDSWalletSourceRecord = TDSWalletSourceRecord2;
class PixSourceRecord extends PaymentSourceRecord {
constructor(a0) {
super(a0);
if (a0.type !== PaymentSourceTypes.PIX) {
throw new Error(`Cannot instantiate PixSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.PIX}`);
}
this.email = a0.email;
}
}
export default PaymentSourceRecord;
export { CreditCardSourceRecord };
export { PaypalSourceRecord };
export { SofortSourceRecord };
export { GiropaySourceRecord };
export { Przelewy24SourceRecord };
export { EPSSourceRecord };
export { IdealSourceRecord };
export { PaysafeSourceRecord };
export { GcashSourceRecord };
export { GrabPayMySourceRecord };
export { MomoWalletSourceRecord };
export { VenmoSourceRecord };
export { KaKaoPaySourceRecord };
export { GoPayWalletSourceRecord };
export { BancontactSourceRecord };
export { CashAppSourceRecord };
class AppleSourceRecord extends PaymentSourceRecord {
constructor(a0) {
a0.id = "";
a0.paymentGateway = PaymentGateways.APPLE_PARTNER;
a0.type = PaymentSourceTypes.APPLE;
a0.billingAddress = {};
a0.country = "";
a0.invalid = false;
a0.isDefault = false;
a0.flags = 0;
super(a0);
if (a0.type !== PaymentSourceTypes.APPLE) {
throw new Error(`Cannot instantiate AppleSourceRecord with type: ${a0.type}, must be ${PaymentSourceTypes.APPLE}`);
}
}
}
export { AppleSourceRecord };
export { TDSWalletSourceRecord };
export { PixSourceRecord };
+204
View File
@@ -0,0 +1,204 @@
// Metro module 6263 (f6264).
import Record from "../lib/Record";
import { CountryListMode, PromotionTypes } from "../modules/premium/promotions/constants";
import * as _Module1384 from "../_bundle/Module1384";
class PromotionRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.trialId = a0.trialId;
this.startDate = a0.startDate;
this.endDate = a0.endDate;
this.outboundRedemptionEndDate = a0.outboundRedemptionEndDate;
this.inboundHeaderText = a0.inboundHeaderText;
this.inboundBodyText = a0.inboundBodyText;
this.inboundHelpCenterLink = a0.inboundHelpCenterLink;
this.outboundTitle = a0.outboundTitle;
this.outboundRedemptionModalBody = a0.outboundRedemptionModalBody;
this.outboundTermsAndConditions = a0.outboundTermsAndConditions;
this.outboundRedemptionPageLink = a0.outboundRedemptionPageLink;
this.outboundRedemptionUrlFormat = a0.outboundRedemptionUrlFormat;
let flags = a0.flags;
if (flags == null) {
flags = 0;
}
this.flags = flags;
let inboundRestrictedCountries = a0.inboundRestrictedCountries;
if (inboundRestrictedCountries == null) {
inboundRestrictedCountries = [];
}
this.inboundRestrictedCountries = inboundRestrictedCountries;
let outboundRestrictedCountries = a0.outboundRestrictedCountries;
if (outboundRestrictedCountries == null) {
outboundRestrictedCountries = [];
}
this.outboundRestrictedCountries = outboundRestrictedCountries;
let allowedCountries = a0.allowedCountries;
if (allowedCountries == null) {
allowedCountries = [];
}
this.allowedCountries = allowedCountries;
let countryListMode = a0.countryListMode;
if (countryListMode == null) {
countryListMode = CountryListMode.BLOCKLIST;
}
this.countryListMode = countryListMode;
this.promotionType = a0.promotionType;
this.partnerId = a0.partnerId;
this.marketingComponents = a0.marketingComponents;
this.rewardSkuIds = a0.rewardSkuIds;
let bogoRewardEnabled = a0.bogoRewardEnabled;
if (bogoRewardEnabled == null) {
bogoRewardEnabled = false;
}
this.bogoRewardEnabled = bogoRewardEnabled;
this.promotionKey = a0.promotionKey;
}
static createFromServer(a0) {
const r3 = {
id: a0.id,
trialId: a0.trial_id,
startDate: new Date(a0.start_date),
endDate: new Date(a0.end_date),
outboundRedemptionEndDate: a0.outbound_redemption_end_date != null ? new Date(a0.outbound_redemption_end_date) : null,
inboundHeaderText: null,
inboundBodyText: null,
inboundHelpCenterLink: null,
outboundTitle: null,
outboundRedemptionModalBody: null,
outboundTermsAndConditions: null,
outboundRedemptionPageLink: null,
outboundRedemptionUrlFormat: null,
flags: null,
inboundRestrictedCountries: null,
outboundRestrictedCountries: null,
allowedCountries: null,
countryListMode: null,
promotionType: null,
partnerId: null,
marketingComponents: null,
rewardSkuIds: null,
bogoRewardEnabled: null,
promotionKey: null
};
let inbound_header_text = a0.inbound_header_text;
if (inbound_header_text == null) {
inbound_header_text = "";
}
r3.inboundHeaderText = inbound_header_text;
let inbound_body_text = a0.inbound_body_text;
if (inbound_body_text == null) {
inbound_body_text = "";
}
r3.inboundBodyText = inbound_body_text;
let inbound_help_center_link = a0.inbound_help_center_link;
if (inbound_help_center_link == null) {
inbound_help_center_link = "";
}
r3.inboundHelpCenterLink = inbound_help_center_link;
let outbound_title = a0.outbound_title;
if (outbound_title == null) {
outbound_title = "";
}
r3.outboundTitle = outbound_title;
let outbound_redemption_modal_body = a0.outbound_redemption_modal_body;
if (outbound_redemption_modal_body == null) {
outbound_redemption_modal_body = "";
}
r3.outboundRedemptionModalBody = outbound_redemption_modal_body;
let outbound_terms_and_conditions = a0.outbound_terms_and_conditions;
if (outbound_terms_and_conditions == null) {
outbound_terms_and_conditions = "";
}
r3.outboundTermsAndConditions = outbound_terms_and_conditions;
let outbound_redemption_page_link = a0.outbound_redemption_page_link;
if (outbound_redemption_page_link == null) {
outbound_redemption_page_link = "";
}
r3.outboundRedemptionPageLink = outbound_redemption_page_link;
let outbound_redemption_url_format = a0.outbound_redemption_url_format;
if (outbound_redemption_url_format == null) {
outbound_redemption_url_format = "";
}
r3.outboundRedemptionUrlFormat = outbound_redemption_url_format;
r3.flags = a0.flags;
r3.inboundRestrictedCountries = a0.inbound_restricted_countries;
r3.outboundRestrictedCountries = a0.outbound_restricted_countries;
let allowed_countries = a0.allowed_countries;
if (allowed_countries == null) {
allowed_countries = [];
}
r3.allowedCountries = allowed_countries;
let country_list_mode = a0.country_list_mode;
if (country_list_mode == null) {
country_list_mode = CountryListMode.BLOCKLIST;
}
r3.countryListMode = country_list_mode;
r3.promotionType = a0.promotion_type;
let partner_id = a0.partner_id;
if (partner_id == null) {
partner_id = null;
}
r3.partnerId = partner_id;
let marketing_components = a0.marketing_components;
if (marketing_components == null) {
marketing_components = [];
}
r3.marketingComponents = marketing_components;
const metadata = a0.metadata;
let rewardSkuIds = metadata == null ? void 0 : metadata.premium_promotion?.reward_sku_ids;
if (rewardSkuIds == null) {
const metadata2 = a0.metadata;
rewardSkuIds = metadata2 == null ? void 0 : metadata2.gift_promotion?.reward_sku_ids;
}
if (rewardSkuIds == null) {
rewardSkuIds = [];
}
r3.rewardSkuIds = rewardSkuIds;
const metadata3 = a0.metadata;
const r61 = metadata3 == null;
let r62 = void 0;
if (!r61) {
const premium_promotion = metadata3.premium_promotion;
const r64 = premium_promotion == null;
r62 = void 0;
if (!r64) {
const reward_config = premium_promotion.reward_config;
r62 = reward_config == null ? void 0 : reward_config.bogo?.enabled;
}
}
r3.bogoRewardEnabled = r62 === true;
let promotion_key = a0.promotion_key;
if (promotion_key == null) {
promotion_key = "";
}
r3.promotionKey = promotion_key;
return new PromotionRecord(r3);
}
get isBogo() {
return this.promotionType === PromotionTypes.BOGO;
}
get isMarketingMoment() {
return this.promotionType === PromotionTypes.MARKETING_MOMENT;
}
get hasBogoReward() {
return this.bogoRewardEnabled;
}
hasFlag(a0) {
return _Module1384.hasFlag(this.flags, a0);
}
isCountryRestricted(a0) {
if (this.countryListMode === CountryListMode.ALLOWLIST) {
return !this.allowedCountries.includes(a0);
}
const promotionType = this.promotionType;
if (PromotionTypes.THIRD_PARTY_INBOUND !== promotionType && PromotionTypes.THIRD_PARTY_DIRECT_FULFILLMENT !== promotionType) {
if (PromotionTypes.THIRD_PARTY_OUTBOUND !== promotionType && PromotionTypes.THIRD_PARTY_OUTBOUND_RECURRING !== promotionType) {
return false;
}
return this.outboundRestrictedCountries.includes(a0);
}
return this.inboundRestrictedCountries.includes(a0);
}
}
export default PromotionRecord;
+28
View File
@@ -0,0 +1,28 @@
// Metro module 12372 (f12373).
import ApplicationRecord from "./ApplicationRecord";
import Platforms from "../lib/Platforms";
import { $callWithNewTarget } from "../_hermes/prelude";
const id = "spotify";
let c8543_1 = Platforms.get("spotify");
class SpotifyApplicationRecord extends ApplicationRecord {
id = id;
name = c8543_1.name;
constructor() {
super({});
}
getIconURL() {
return c8543_1.icon.lightPNG;
}
getWhiteIconURL() {
return c8543_1.icon.whitePNG;
}
}
const prototypeOf = Object.getPrototypeOf(SpotifyApplicationRecord);
const r30 = Object.create(SpotifyApplicationRecord.prototype);
const r31 = $callWithNewTarget(prototypeOf, r30, SpotifyApplicationRecord, {});
const r32 = r31 instanceof Object ? r31 : r30;
r32.id = "spotify";
r32.name = c8543_1.name;
export default SpotifyApplicationRecord;
export const SPOTIFY_APPLICATION_ID = "spotify";
export { r32 as SpotifyApplication };
+139
View File
@@ -0,0 +1,139 @@
// Metro module 13556 (f13557).
import Record from "../lib/Record";
import UserRecord from "./UserRecord";
import { transformStoreAssetFromServer } from "../modules/game_store/GameStoreAsset";
class StoreListingRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.applicationId = a0.applicationId;
this.skuId = a0.skuId;
this.skuFlags = a0.skuFlags;
this.summary = a0.summary;
this.tagline = a0.tagline;
this.flavorText = a0.flavorText;
this.description = a0.description;
let carouselItems = a0.carouselItems;
if (carouselItems == null) {
carouselItems = [];
}
this.carouselItems = carouselItems;
let childSkuIds = a0.childSkuIds;
if (childSkuIds == null) {
childSkuIds = [];
}
this.childSkuIds = childSkuIds;
let alternativeSkuIds = a0.alternativeSkuIds;
if (alternativeSkuIds == null) {
alternativeSkuIds = [];
}
this.alternativeSkuIds = alternativeSkuIds;
let assets = a0.assets;
if (assets == null) {
assets = [];
}
this.assets = assets;
this.staffNotes = a0.staffNotes;
this.guild = a0.guild;
let thumbnail = a0.thumbnail;
if (thumbnail == null) {
thumbnail = null;
}
this.thumbnail = thumbnail;
let boxArt = a0.boxArt;
if (boxArt == null) {
boxArt = null;
}
this.boxArt = boxArt;
let previewVideo = a0.previewVideo;
if (previewVideo == null) {
previewVideo = null;
}
this.previewVideo = previewVideo;
let headerBackground = a0.headerBackground;
if (headerBackground == null) {
headerBackground = null;
}
this.headerBackground = headerBackground;
let headerLogoDarkTheme = a0.headerLogoDarkTheme;
if (headerLogoDarkTheme == null) {
headerLogoDarkTheme = null;
}
this.headerLogoDarkTheme = headerLogoDarkTheme;
let headerLogoLightTheme = a0.headerLogoLightTheme;
if (headerLogoLightTheme == null) {
headerLogoLightTheme = null;
}
this.headerLogoLightTheme = headerLogoLightTheme;
let heroBackground = a0.heroBackground;
if (heroBackground == null) {
heroBackground = null;
}
this.heroBackground = heroBackground;
let heroVideo = a0.heroVideo;
if (heroVideo == null) {
heroVideo = null;
}
this.heroVideo = heroVideo;
let entitlementBranchId = a0.entitlementBranchId;
if (entitlementBranchId == null) {
entitlementBranchId = null;
}
this.entitlementBranchId = entitlementBranchId;
this.benefits = a0.benefits;
this.published = Boolean(a0.published);
}
static createFromServer(a0) {
const staff_notes = a0.staff_notes;
const childSkuIds = a0.child_skus != null ? a0.child_skus.map((child_sku) => child_sku.id) : null;
const alternativeSkuIds = a0.alternative_skus != null ? a0.alternative_skus.map((alternative_sku) => alternative_sku.id) : null;
const carouselItems = a0.carousel_items != null ? a0.carousel_items.map((carousel_item) => ({
assetId: carousel_item.asset_id,
youtubeVideoId: carousel_item.youtube_video_id
})) : null;
const assets = a0.assets != null ? a0.assets.map(transformStoreAssetFromServer) : null;
const staffNotes = staff_notes != null ? {
content: staff_notes.content,
user: staff_notes.user != null ? new UserRecord(staff_notes.user) : null
} : null;
const guild = a0.guild != null ? {
id: a0.guild.id,
name: a0.guild.name,
icon: a0.guild.icon,
approximateMemberCount: a0.guild.approximate_member_count,
approximatePresenceCount: a0.guild.approximate_presence_count
} : null;
const thumbnail = a0.thumbnail != null ? transformStoreAssetFromServer(a0.thumbnail) : null;
return new StoreListingRecord({
id: a0.id,
applicationId: a0.sku.application_id,
skuId: a0.sku.id,
skuFlags: a0.sku.flags,
summary: a0.summary,
tagline: a0.tagline,
flavorText: a0.flavor_text,
description: a0.description,
childSkuIds,
alternativeSkuIds,
carouselItems,
assets,
staffNotes,
guild,
thumbnail,
previewVideo: a0.preview_video != null ? transformStoreAssetFromServer(a0.preview_video) : null,
headerBackground: a0.header_background != null ? transformStoreAssetFromServer(a0.header_background) : null,
headerLogoDarkTheme: a0.header_logo_dark_theme != null ? transformStoreAssetFromServer(a0.header_logo_dark_theme) : null,
headerLogoLightTheme: a0.header_logo_light_theme != null ? transformStoreAssetFromServer(a0.header_logo_light_theme) : null,
boxArt: a0.box_art != null ? transformStoreAssetFromServer(a0.box_art) : null,
heroBackground: a0.hero_background != null ? transformStoreAssetFromServer(a0.hero_background) : null,
heroVideo: a0.hero_video != null ? transformStoreAssetFromServer(a0.hero_video) : null,
entitlementBranchId: a0.entitlement_branch_id,
benefits: a0.benefits,
published: a0.published
});
}
isSlimDirectoryVersion() {
return this.description == null;
}
}
export default StoreListingRecord;
+114
View File
@@ -0,0 +1,114 @@
// Metro module 3836 (f3837).
import Record from "../lib/Record";
import { PremiumSubscriptionSKUs, PremiumTypes, SubscriptionPlans } from "../modules/premium/PremiumConstants";
import { $callWithNewTarget } from "../_hermes/prelude";
class SubscriptionPlanRecord extends Record {
constructor(a0) {
super();
this.id = a0.id;
this.name = a0.name;
this.interval = a0.interval;
this.intervalCount = a0.intervalCount;
this.taxInclusive = a0.taxInclusive;
this.skuId = a0.skuId;
this.currency = a0.currency;
this.price = a0.price;
this.prices = a0.prices;
}
static createFromServer(a0) {
const prices = a0.prices != null ? Object.keys(a0.prices).reduce((acc, item) => {
if (a0.prices == null) {
return acc;
}
const r5 = a0.prices[item];
acc[item] = {
countryPrices: {
countryCode: r5.country_prices.country_code,
prices: r5.country_prices.prices.map((price) => ({
amount: price.amount,
currency: price.currency,
tax: 0,
taxInclusive: a0.tax_inclusive
}))
},
paymentSourcePrices: Object.entries(r5.payment_source_prices).reduce((acc, a1) => {
const [r22, r7] = a1;
acc[r22] = r7.map((item) => ({
amount: item.amount,
currency: item.currency,
tax: 0,
taxInclusive: a0.tax_inclusive
}));
return acc;
}, {})
};
return acc;
}, {}) : {};
const { id, name, interval, interval_count, tax_inclusive, sku_id, currency, price } = a0;
const prototypeOf = Object.getPrototypeOf(SubscriptionPlanRecord);
const r30 = Object.create(SubscriptionPlanRecord.prototype);
const r31 = $callWithNewTarget(prototypeOf, r30, SubscriptionPlanRecord);
const r32 = r31 instanceof Object ? r31 : r30;
r32.id = id;
r32.name = name;
r32.interval = interval;
r32.intervalCount = interval_count;
r32.taxInclusive = tax_inclusive;
r32.skuId = sku_id;
r32.currency = currency;
r32.price = price;
r32.prices = prices;
return r32;
}
get premiumSubscriptionType() {
const skuId = this.skuId;
if (PremiumSubscriptionSKUs.LEGACY !== skuId && PremiumSubscriptionSKUs.TIER_2 !== skuId) {
if (PremiumSubscriptionSKUs.TIER_1 === skuId) {
return PremiumTypes.TIER_1;
}
if (PremiumSubscriptionSKUs.TIER_0 === skuId) {
return PremiumTypes.TIER_0;
}
return null;
}
return PremiumTypes.TIER_2;
}
toServerData() {
const prices = {};
let c13663_0 = prices;
Object.keys(this.prices).forEach((item) => {
const r4 = this.prices[item];
c13663_0[item] = {
country_prices: {
country_code: r4.countryPrices.countryCode,
prices: r4.countryPrices.prices
},
payment_source_prices: r4.paymentSourcePrices
};
});
return {
id: this.id,
name: this.name,
sku_id: this.skuId,
interval: this.interval,
interval_count: this.intervalCount,
tax_inclusive: this.taxInclusive,
currency: this.currency,
price: this.price,
prices,
price_tier: this.price
};
}
}
export default SubscriptionPlanRecord;
export function getPriceFromServer(a0, a1) {
return {
amount: a0.amount,
currency: a0.currency,
tax: 0,
taxInclusive: a1
};
}
export function isNoneSubscription(a0) {
return [SubscriptionPlans.NONE_MONTH, SubscriptionPlans.NONE_3_MONTH, SubscriptionPlans.NONE_6_MONTH, SubscriptionPlans.NONE_YEAR].includes(a0);
}
+232
View File
@@ -0,0 +1,232 @@
// Metro module 3842 (f3843).
import Record from "../lib/Record";
import GooglePlayPriceChangeRecord from "../modules/premium/native/google_play_price_changes/GooglePlayPriceChangeRecord";
import InvoiceRecord from "./InvoiceRecord";
import { PaymentGateways, SubscriptionStatusTypes, SubscriptionStatusTypesSets, SubscriptionTypes } from "../Constants";
import { SubscriptionPauseReason, SubscriptionPauseReasonSets } from "../components/billing/BillingConstants";
import { PREMIUM_PLANS, SubscriptionPlanInfo, SubscriptionPlans } from "../modules/premium/PremiumConstants";
import { getBasePlanIdForSubscriptionItems } from "../modules/premium/PremiumSubscription";
import Module38 from "../_bundle/Module38";
import { isIOS } from "../utils/PlatformUtils";
import { isGooglePlayBillingSupported } from "../modules/device/BillingPlatformUtils";
import { isPremiumAtLeast } from "../utils/PremiumTypeUtils";
const createSubscriptionItemFromServer = function createSubscriptionItemFromServer(a0) {
return {
id: a0.id,
planId: a0.plan_id,
quantity: a0.quantity
};
};
class SubscriptionRecord extends Record {
constructor(a0) {
let planId5, planId6;
super();
this.id = a0.id;
this.type = a0.type;
this.items = a0.items;
this.createdAt = a0.createdAt;
this.canceledAt = a0.canceledAt;
this.currentPeriodStart = a0.currentPeriodStart;
this.currentPeriodEnd = a0.currentPeriodEnd;
this.status = a0.status;
this.paymentSourceId = a0.paymentSourceId;
this.paymentGateway = a0.paymentGateway;
this.paymentGatewayPlanId = a0.paymentGatewayPlanId;
this.paymentGatewaySubscriptionId = a0.paymentGatewaySubscriptionId;
this.trialId = a0.trialId;
this.trialEndsAt = a0.trialEndsAt;
this.renewalMutations = a0.renewalMutations;
this.currency = a0.currency;
this.pauseEndsAt = a0.pauseEndsAt;
this.pauseReason = a0.pauseReason;
this.metadata = a0.metadata;
this.latestInvoice = a0.latestInvoice;
this.useStorekitResubscribe = a0.useStorekitResubscribe;
this.price = a0.price;
this.userId = a0.userId;
this.streakStartedAt = a0.streakStartedAt;
this.eligiblePaymentGateways = a0.eligiblePaymentGateways;
this.priceChange = a0.priceChange;
const renewalMutations = this.renewalMutations;
let planId = a0.items[0].planId;
let planId2 = null;
if (a0.type === SubscriptionTypes.PREMIUM) {
const r66 = SubscriptionPlanInfo[a0.items[0].planId];
const { interval, intervalCount } = r66;
planId = getBasePlanIdForSubscriptionItems(a0.items, interval, intervalCount);
const r3 = renewalMutations != null;
planId5 = null;
planId6 = planId;
if (r3) {
const basePlanIdForSubscriptionItems2 = getBasePlanIdForSubscriptionItems(renewalMutations.items, interval, intervalCount);
planId2 = basePlanIdForSubscriptionItems2;
planId5 = basePlanIdForSubscriptionItems2;
planId6 = planId;
}
} else {
const r1 = renewalMutations != null && renewalMutations.items.length > 0;
planId5 = null;
planId6 = planId;
if (r1) {
const planId4 = renewalMutations.items[0].planId;
planId2 = planId4;
planId5 = planId4;
planId6 = planId;
}
}
this.planId = planId6;
this.additionalPlans = a0.items.filter((item) => item.planId !== planId);
if (renewalMutations != null && planId5 != null) {
renewalMutations.planId = planId5;
renewalMutations.additionalPlans = renewalMutations.items.filter((item) => item.planId !== planId2);
}
}
static createFromServer(a0) {
const r1 = {
id: a0.id,
type: a0.type,
createdAt: new Date(a0.created_at),
canceledAt: a0.canceled_at != null ? new Date(a0.canceled_at) : null,
currentPeriodStart: new Date(a0.current_period_start),
currentPeriodEnd: new Date(a0.current_period_end),
status: a0.status,
paymentSourceId: a0.payment_source_id,
paymentGateway: a0.payment_gateway,
paymentGatewayPlanId: a0.payment_gateway_plan_id,
paymentGatewaySubscriptionId: a0.payment_gateway_subscription_id,
trialId: a0.trial_id,
trialEndsAt: a0.trial_ends_at != null ? new Date(a0.trial_ends_at) : null,
items: a0.items.map(createSubscriptionItemFromServer),
renewalMutations: a0.renewal_mutations != null ? {
items: a0.renewal_mutations.items.map(createSubscriptionItemFromServer),
paymentGatewayPlanId: a0.renewal_mutations.payment_gateway_plan_id
} : null,
streakStartedAt: a0.streak_started_at != null ? new Date(a0.streak_started_at) : null,
currency: a0.currency,
pauseEndsAt: a0.pause_ends_at != null ? new Date(a0.pause_ends_at) : null,
pauseReason: a0.pause_reason,
metadata: a0.metadata,
useStorekitResubscribe: a0.use_storekit_resubscribe,
price: a0.price,
userId: a0.user_id,
...a0.latest_invoice != null ? {
latestInvoice: InvoiceRecord.createInvoiceFromServer(a0.latest_invoice)
} : {}
};
let eligible_payment_gateways = a0.eligible_payment_gateways;
if (eligible_payment_gateways == null) {
eligible_payment_gateways = null;
}
r1.eligiblePaymentGateways = eligible_payment_gateways;
r1.priceChange = a0.price_change != null ? GooglePlayPriceChangeRecord.createFromServer(a0.price_change) : null;
return new SubscriptionRecord(r1);
}
getCurrentSubscriptionPlanIdForGroup(c13676_0) {
return this.items.find((item) => c13676_0.includes(item.planId))?.planId;
}
get isPremium() {
return this.type === SubscriptionTypes.PREMIUM;
}
get isACOM() {
return this.paymentGateway === PaymentGateways.APPLE_ADVANCED_COMMERCE;
}
get planIdForCurrencies() {
let planIdFromItems2;
if (this.isPremium) {
Module38(this.planIdFromItems != null && this.planIdFromItems !== "", "Premium subscription has no planId for currencies");
planIdFromItems2 = this.planIdFromItems;
} else {
planIdFromItems2 = this.planId;
}
return planIdFromItems2;
}
get planIdFromItems() {
return this.getCurrentSubscriptionPlanIdForGroup(Object.values(SubscriptionPlans));
}
get premiumPlanIdFromItems() {
return this.getCurrentSubscriptionPlanIdForGroup([...PREMIUM_PLANS]);
}
get isPurchasedViaDesktop() {
return this.paymentGateway == null;
}
get isPurchasedViaAppleGeneric() {
return this.paymentGateway === PaymentGateways.APPLE_PARTNER || this.isACOM;
}
get isPurchasedViaApple() {
return this.paymentGateway === PaymentGateways.APPLE || this.isACOM;
}
get isPurchasedViaGoogle() {
return this.paymentGateway === PaymentGateways.GOOGLE;
}
get isPurchasedExternally() {
return this.isPurchasedViaApple || this.isPurchasedViaGoogle;
}
get isOnPlatformMatchingExternalPaymentGateway() {
return this.isPurchasedViaApple && isIOS() || this.isPurchasedViaGoogle && isGooglePlayBillingSupported();
}
get hasExternalPlanChange() {
return this.isPurchasedExternally && this.renewalMutations != null && this.paymentGatewayPlanId !== this.renewalMutations.paymentGatewayPlanId;
}
get hasPremiumNitroMonthly() {
return this.items.find((item) => item.planId === SubscriptionPlans.PREMIUM_MONTH_TIER_2) != null;
}
get isBoostOnly() {
return this.items.every((item) => [SubscriptionPlans.PREMIUM_MONTH_GUILD, SubscriptionPlans.PREMIUM_YEAR_GUILD].includes(item.planId));
}
get isPausedOrPausePending() {
return SubscriptionStatusTypesSets.ALL_PAUSE.has(this.status);
}
get isPaused() {
return this.status === SubscriptionStatusTypes.PAUSED;
}
get isPausedForFractionalPremium() {
return this.status === SubscriptionStatusTypes.PAUSED && this.pauseReason === SubscriptionPauseReason.FRACTIONAL_PREMIUM;
}
get isPausedAllowsUpdatesButNotResume() {
return this.status === SubscriptionStatusTypes.PAUSED && SubscriptionPauseReasonSets.CAN_MAKE_SUBSCRIPTION_UPDATES.has(this.pauseReason);
}
get isPausedAllowsResumeButNotUpdates() {
return this.status === SubscriptionStatusTypes.PAUSED && (this.pauseReason === null || !SubscriptionPauseReasonSets.CAN_MAKE_SUBSCRIPTION_UPDATES.has(this.pauseReason));
}
get isEnded() {
return this.status === SubscriptionStatusTypes.ENDED;
}
get endedAt() {
return this.status === SubscriptionStatusTypes.ENDED ? this.metadata?.ended_at != null ? new Date(this.metadata.ended_at) : this.currentPeriodEnd : null;
}
get isActive() {
return this.status === SubscriptionStatusTypes.ACTIVE;
}
get statusAllowsPerks() {
return SubscriptionStatusTypesSets.ALLOW_PERKS.has(this.status);
}
get hasActiveTrial() {
return this.trialId != null && this.trialEndsAt != null && new Date() < this.trialEndsAt;
}
get hasActiveDiscount() {
if (this.metadata == null) {
return false;
}
const active_discount_id = this.metadata.active_discount_id;
const active_discount_expires_at = this.metadata.active_discount_expires_at;
return active_discount_id != null && active_discount_expires_at != null && new Date() <= new Date(active_discount_expires_at);
}
get premiumSince() {
let streakStartedAt = this.streakStartedAt;
if (streakStartedAt == null) {
streakStartedAt = this.createdAt;
}
return streakStartedAt;
}
get hasAnyPremiumNitro() {
return this.items.some((item) => PREMIUM_PLANS.has(item.planId));
}
get hasAnyPremiumGroup() {
return this.items.some((item) => item.planId === SubscriptionPlans.PREMIUM_GROUP_MONTH);
}
hasPremiumAtLeast(c13677_0) {
return !!this.isPremium && this.items.some((item) => isPremiumAtLeast(SubscriptionPlanInfo[item.planId].premiumType, c13677_0));
}
}
export default SubscriptionRecord;
export { SubscriptionRecord };
+17
View File
@@ -0,0 +1,17 @@
// Metro module 12802 (f12803).
import ApplicationRecord from "./ApplicationRecord";
import { intl, t } from "../intl/index.native";
import Platforms from "../lib/Platforms";
let c8829_3 = "twitch:";
class TwitchApplicationRecord extends ApplicationRecord {
constructor(a0) {
super(a0);
this.id = `${c8829_3}${a0.url}`;
this.name = intl.string(t.JIPtgq);
}
getIconURL() {
return Platforms.get("twitch").icon.lightPNG;
}
}
export default TwitchApplicationRecord;
export const TWITCH_APPLICATION_ID_PREFIX = "twitch:";
+417
View File
@@ -0,0 +1,417 @@
// Metro module 1882 (f1883).
import Record from "../lib/Record";
import { LOCAL_BOT_ID, NON_USER_BOT_DISCRIMINATOR, PREMIUM_TYPE_NONE, UserFlags } from "../Constants";
import { PremiumTypes, PurchasedFlags, SKU_ID_PURCHASED_FLAGS } from "../modules/premium/PremiumConstants";
import { ensureUserPrimaryGuild } from "../modules/guild_tag/PrimaryGuildUtils";
import { parseServerDisplayNameStyles } from "../modules/display_name_styles/DisplayNameStylesUtils";
import { parseServerPremiumState } from "../modules/premium/premium_state/PremiumStateUtils";
import { parseServerPerks } from "../modules/premium/perks_state/PerksStateUtils";
import { ensureRestrictedScheduleRecord } from "../modules/parent_tools/FamilyCenterModels";
import { parseStoreCountry } from "../modules/billing/utils/StoreCountryUtils";
import { deserialize, has, combine } from "../_bundle/HighLow";
import SnowflakeUtils from "../utils/SnowflakeUtils";
import AvatarUtils, { SUPPORTS_WEBP } from "../utils/AvatarUtils";
import * as _Module1384 from "../_bundle/Module1384";
import * as _PremiumTypeUtils from "../utils/PremiumTypeUtils";
import { PremiumSource, PremiumSubscriptionType, PremiumSubscriptionGroupRole } from "../_bundle/Module1892";
import { parseAvatarDecorationData } from "../modules/collectibles/avatar_decorations/AvatarDecorationUtils";
import { getNameplateData } from "../modules/collectibles/nameplates/utils";
class UserRecord extends Record {
hasFlag = () => false;
isStaff = () => false;
isStaffPersonal = () => false;
hasAnyStaffLevel = () => false;
constructor(a0) {
super();
let premium_type = a0.premium_type;
if (premium_type == null) {
premium_type = a0.premiumType;
}
this.id = a0.id;
let username = a0.username;
if (username == null) {
username = "";
}
this.username = username;
let discriminator = a0.discriminator;
if (discriminator == null) {
discriminator = NON_USER_BOT_DISCRIMINATOR;
}
this.discriminator = discriminator;
let avatar2 = a0.avatar;
if (avatar2 == null) {
avatar2 = null;
}
this.avatar = avatar2;
let avatar_decoration_data = a0.avatar_decoration_data;
if (avatar_decoration_data == null) {
avatar_decoration_data = a0.avatarDecorationData;
}
this.avatarDecoration = avatar_decoration_data;
let email = a0.email;
if (email == null) {
email = null;
}
this.email = email;
let verified = a0.verified;
if (verified == null) {
verified = false;
}
this.verified = verified;
let bot = a0.bot;
if (bot == null) {
bot = false;
}
this.bot = bot;
let system = a0.system;
if (system == null) {
system = false;
}
this.system = system;
let mfa_enabled = a0.mfa_enabled;
if (mfa_enabled == null) {
mfa_enabled = a0.mfaEnabled;
}
if (mfa_enabled == null) {
mfa_enabled = false;
}
this.mfaEnabled = mfa_enabled;
let mobile = a0.mobile;
if (mobile == null) {
mobile = false;
}
this.mobile = mobile;
let desktop = a0.desktop;
if (desktop == null) {
desktop = false;
}
this.desktop = desktop;
this.premiumType = premium_type !== PREMIUM_TYPE_NONE ? premium_type : null;
let flags = a0.flags;
if (flags == null) {
flags = 0;
}
this.flags = flags;
let public_flags = a0.public_flags;
if (public_flags == null) {
public_flags = a0.publicFlags;
}
if (public_flags == null) {
public_flags = 0;
}
this.publicFlags = public_flags;
let purchased_flags = a0.purchased_flags;
if (purchased_flags == null) {
purchased_flags = a0.purchasedFlags;
}
if (purchased_flags == null) {
purchased_flags = 0;
}
this.purchasedFlags = purchased_flags;
let premium_usage_flags = a0.premium_usage_flags;
if (premium_usage_flags == null) {
premium_usage_flags = a0.premiumUsageFlags;
}
if (premium_usage_flags == null) {
premium_usage_flags = 0;
}
this.premiumUsageFlags = premium_usage_flags;
let phone = a0.phone;
if (phone == null) {
phone = null;
}
this.phone = phone;
let nsfw_allowed = a0.nsfw_allowed;
if (nsfw_allowed == null) {
nsfw_allowed = a0.nsfwAllowed;
}
this.nsfwAllowed = nsfw_allowed;
let age_verification_status = a0.age_verification_status;
if (age_verification_status == null) {
age_verification_status = a0.ageVerificationStatus;
}
this.ageVerificationStatus = age_verification_status;
let guildMemberAvatars = a0.guildMemberAvatars;
if (guildMemberAvatars == null) {
guildMemberAvatars = {};
}
this.guildMemberAvatars = guildMemberAvatars;
let has_bounced_email = a0.has_bounced_email;
if (has_bounced_email == null) {
has_bounced_email = a0.hasBouncedEmail;
}
if (has_bounced_email == null) {
has_bounced_email = false;
}
this.hasBouncedEmail = has_bounced_email;
let personal_connection_id = a0.personal_connection_id;
if (personal_connection_id == null) {
personal_connection_id = a0.personalConnectionId;
}
if (personal_connection_id == null) {
personal_connection_id = null;
}
this.personalConnectionId = personal_connection_id;
let global_name = a0.global_name;
if (global_name == null) {
global_name = a0.globalName;
}
this.globalName = global_name;
this.banner = a0.banner;
let primary_guild = a0.primary_guild;
if (primary_guild == null) {
primary_guild = a0.primaryGuild;
}
if (primary_guild == null) {
primary_guild = null;
}
this.primaryGuild = ensureUserPrimaryGuild(primary_guild);
this.collectibles = a0.collectibles;
let displayNameStyles = a0.displayNameStyles;
if (displayNameStyles == null) {
displayNameStyles = parseServerDisplayNameStyles(a0.display_name_styles);
}
this.displayNameStyles = displayNameStyles;
let premiumState = a0.premiumState;
if (premiumState == null) {
premiumState = parseServerPremiumState(a0.premium_state);
}
this.premiumState = premiumState;
this.perks = a0.perks?.activePerksBitmask != null ? a0.perks : parseServerPerks(a0.perks);
let restricted_schedule = a0.restricted_schedule;
if (restricted_schedule == null) {
restricted_schedule = a0.restrictedSchedule;
}
this.restrictedSchedule = ensureRestrictedScheduleRecord(restricted_schedule);
let appTransactionIds = a0.appTransactionIds;
if (appTransactionIds == null) {
appTransactionIds = a0.app_transaction_ids;
}
if (appTransactionIds == null) {
appTransactionIds = null;
}
this.appTransactionIds = appTransactionIds;
let store_country = a0.store_country;
if (store_country == null) {
store_country = a0.storeCountry;
}
this.storeCountry = parseStoreCountry(store_country);
Object.defineProperties(this, {
hasFlag: {
writable: false,
configurable: false,
enumerable: false,
value: (a0) => {
if (a0 <= 1073741824) {
return ((this.flags | this.publicFlags) & a0) === a0;
}
const r10 = deserialize(this.flags);
const r18 = deserialize(this.publicFlags);
const r22 = deserialize(a0);
return has(combine(r10, r18), r22);
}
},
isStaff: {
writable: false,
configurable: false,
enumerable: false,
value: () => this.hasFlag(UserFlags.STAFF)
},
isStaffPersonal: {
writable: false,
configurable: false,
enumerable: false,
value: () => {
const hasFlag2 = this.hasFlag(UserFlags.STAFF);
return hasFlag2 ? !hasFlag2 : this.personalConnectionId != null;
}
},
hasAnyStaffLevel: {
writable: false,
configurable: false,
enumerable: false,
value: () => this.hasFlag(UserFlags.STAFF) || this.hasFlag(UserFlags.COLLABORATOR) || this.hasFlag(UserFlags.RESTRICTED_COLLABORATOR)
}
});
if (this.globalName?.length === 0) {
this.globalName = null;
}
}
get createdAt() {
return new Date(SnowflakeUtils.extractTimestamp(this.id));
}
hasVerifiedEmailOrPhone() {
return this.verified === true || this.phone != null;
}
getAvatarURL(a0, a1, canAnimate = false, canWebP = SUPPORTS_WEBP) {
const avatar2 = a0 != null ? this.guildMemberAvatars[a0] : void 0;
return avatar2 != null && a0 != null ? AvatarUtils.getGuildMemberAvatarURLSimple({
guildId: a0,
avatar: avatar2,
userId: this.id,
canAnimate,
size: a1,
canWebP
}) : AvatarUtils.getUserAvatarURL(this, canAnimate, a1, null, canWebP);
}
addGuildAvatarHash(a0, a1) {
if (this.guildMemberAvatars[a0] === a1) {
return this;
}
const guildMemberAvatars = {
...this.guildMemberAvatars
};
guildMemberAvatars[a0] = a1;
return this.merge({
guildMemberAvatars
});
}
removeGuildAvatarHash(a0) {
if (this.guildMemberAvatars[a0] === void 0) {
return this;
}
const guildMemberAvatars = {
...this.guildMemberAvatars
};
guildMemberAvatars[a0] = void 0;
return this.merge({
guildMemberAvatars
});
}
getAvatarSource(a0) {
let avatar;
const guildId = a0;
let r5 = arguments[1];
if (r5 === void 0) {
r5 = false;
}
const size = arguments[2];
avatar = void 0;
if (a0 != null) {
avatar = this.guildMemberAvatars[a0];
if (avatar != null) {
return AvatarUtils.getAnimatableSourceWithFallback(r5, (a0) => AvatarUtils.makeSource(AvatarUtils.getGuildMemberAvatarURLSimple({
guildId,
avatar,
userId: this.id,
canAnimate: a0,
size
})));
}
}
return AvatarUtils.getAnimatableSourceWithFallback(r5, (a0) => AvatarUtils.getUserAvatarSource(this, a0, size));
}
isClaimed() {
return this.email != null || this.phone != null;
}
isPhoneVerified() {
return this.phone != null;
}
toString() {
return this.username !== "" ? this.username : "???";
}
get tag() {
return `${this.username}#${`${this.discriminator}`.padStart(4, "0")}`;
}
hasPurchasedFlag(a0) {
return _Module1384.hasFlag(this.purchasedFlags, a0);
}
hasPremiumUsageFlag(a0) {
return _Module1384.hasFlag(this.premiumUsageFlags, a0);
}
hasHadSKU(a0) {
const r4 = SKU_ID_PURCHASED_FLAGS[a0];
return r4 != null && this.hasPurchasedFlag(r4);
}
hasHadPremium(r5 = null) {
const hasPurchasedFlag2 = this.hasPurchasedFlag(PurchasedFlags.PREMIUM_TIER_0);
const hasPurchasedFlag3 = this.hasPurchasedFlag(PurchasedFlags.PREMIUM_TIER_1);
const hasPurchasedFlag4 = this.hasPurchasedFlag(PurchasedFlags.PREMIUM_TIER_2);
if (PremiumTypes.TIER_0 === r5) {
return hasPurchasedFlag2;
}
if (PremiumTypes.TIER_1 === r5) {
return hasPurchasedFlag3;
}
if (PremiumTypes.TIER_2 === r5) {
return hasPurchasedFlag4;
}
return hasPurchasedFlag2 || hasPurchasedFlag3 || hasPurchasedFlag4;
}
hadPremiumSubscription(r5 = null) {
const isPremium = _PremiumTypeUtils.isPremium(this);
return isPremium ? !isPremium : this.hasHadPremium(r5);
}
hasFreePremium() {
return this.isStaff() || this.hasFlag(UserFlags.PARTNER) || this.isStaffPersonal();
}
isOnReverseTrial() {
return _PremiumTypeUtils.isPremium(this) && this.premiumState?.premiumSource === PremiumSource.REVERSE_TRIAL;
}
isPremiumWithPremiumGroup() {
return _PremiumTypeUtils.isPremium(this, PremiumTypes.TIER_2) && this.premiumState?.premiumSource === PremiumSource.SUBSCRIPTION_GROUP;
}
hasPaidTier2Subscription() {
return _PremiumTypeUtils.isPremium(this, PremiumTypes.TIER_2) && this.premiumState?.premiumSubscriptionType === PremiumSubscriptionType.TIER_2;
}
isPremiumWithFractionalPremiumOnly() {
return _PremiumTypeUtils.isPremium(this, PremiumTypes.TIER_2) && (this.premiumState?.premiumSubscriptionType === PremiumSubscriptionType.NONE_UNSPECIFIED || this.premiumState?.premiumSubscriptionType === PremiumSubscriptionType.BOOST_ONLY) && this.premiumState?.premiumSource === PremiumSource.FRACTIONAL_NITRO;
}
isFractionalPremiumWithNoStandardSub() {
return _PremiumTypeUtils.isPremium(this, PremiumTypes.TIER_2) && this.premiumState?.premiumSource === PremiumSource.FRACTIONAL_NITRO && this.premiumState.premiumSubscriptionType !== PremiumSubscriptionType.TIER_2;
}
isFractionalPremium() {
return _PremiumTypeUtils.isPremium(this, PremiumTypes.TIER_2) && this.premiumState?.premiumSource === PremiumSource.FRACTIONAL_NITRO;
}
hasUrgentMessages() {
return this.hasFlag(UserFlags.HAS_UNREAD_URGENT_MESSAGES);
}
isNonUserBot() {
return this.isSystemUser() || this.bot && this.discriminator === NON_USER_BOT_DISCRIMINATOR;
}
isLocalBot() {
return this.bot && this.id === LOCAL_BOT_ID;
}
isVerifiedBot() {
return this.isSystemUser() || this.isLocalBot() || this.hasFlag(UserFlags.VERIFIED_BOT);
}
isSystemUser() {
return this.system === true;
}
hasAvatarForGuild(a0) {
return a0 != null && this.guildMemberAvatars[a0] != null;
}
hasUniqueUsername() {
return this.discriminator === "0";
}
isPremiumGroupMember() {
return this.isPremiumWithPremiumGroup() && this.premiumGroupRole === PremiumSubscriptionGroupRole.MEMBER;
}
isPremiumGroupPrimary() {
return this.isPremiumWithPremiumGroup() && this.premiumGroupRole === PremiumSubscriptionGroupRole.PRIMARY;
}
get isProvisional() {
return this.hasFlag(UserFlags.PROVISIONAL_ACCOUNT);
}
get avatarDecoration() {
return this.avatarDecorationData;
}
set avatarDecoration(a0) {
this.avatarDecorationData = parseAvatarDecorationData(a0);
}
get nameplate() {
return getNameplateData(this.collectibles?.nameplate);
}
get premiumGroupRole() {
let r6 = this.premiumState?.premiumSubscriptionGroupRole;
if (r6 == null) {
r6 = PremiumSubscriptionGroupRole.UNSPECIFIED;
}
return r6;
}
}
const userRecord = new UserRecord({
id: "0"
});
export default UserRecord;
export { userRecord as PLACEHOLDER_USER_RECORD };
+32
View File
@@ -0,0 +1,32 @@
// Metro module 4206 (f4207).
import Record from "../lib/Record";
class VoiceStateRecord extends Record {
constructor(a0) {
super();
const userId = a0.userId || "";
this.userId = userId;
this.channelId = a0.channelId || null;
this.sessionId = a0.sessionId || null;
this.mute = a0.mute || false;
this.deaf = a0.deaf || false;
this.selfMute = a0.selfMute || false;
this.selfDeaf = a0.selfDeaf || false;
this.selfVideo = a0.selfVideo || false;
this.selfStream = a0.selfStream || false;
this.suppress = a0.suppress || false;
this.requestToSpeakTimestamp = a0.requestToSpeakTimestamp;
let discoverable = a0.discoverable;
if (discoverable == null) {
discoverable = true;
}
this.discoverable = discoverable;
this.connectedAt = a0.connectedAt;
}
isVoiceMuted() {
return this.selfMute || this.mute || this.suppress || this.requestToSpeakTimestamp != null;
}
isVoiceDeafened() {
return this.selfDeaf || this.deaf;
}
}
export default VoiceStateRecord;
+16
View File
@@ -0,0 +1,16 @@
// Metro module 12803 (f12804).
import ApplicationRecord from "./ApplicationRecord";
import Platforms from "../lib/Platforms";
let c8830_2 = "xbox:";
class XboxApplicationRecord extends ApplicationRecord {
constructor(a0) {
super(a0);
this.id = `${c8830_2}${a0.name}`;
this.name = a0.name;
}
getIconURL() {
return Platforms.get("xbox").icon.lightPNG;
}
}
export default XboxApplicationRecord;
export const XBOX_APPLICATION_ID_PREFIX = "xbox:";