Files
discord-decomp/sources/modules/guild_role_subscriptions/GuildRoleSubscriptionSystemMessageUtils.tsx
T
2026-07-27 16:20:00 +03:00

118 lines
8.6 KiB
TypeScript

/* Metro module 8235; source: modules/guild_role_subscriptions/GuildRoleSubscriptionSystemMessageUtils.tsx; dependencies: [1867, 1878, 8236, 661, 21, 1244, 6841, 4863, 2] */
function _fun65864(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#65864, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:6, offset: 0x01be339f, size: 336 bytes, params: 8, frame: 19
const env0_0 = require;
const identityHook = function(a0) {
return a0;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
let value = require(8236) /* metro dependency 8236: GuildRoleSubscriptionSystemMessageConstants */;
const env0_5 = value.getJoinButtonLabels;
const env0_6 = value.getRenewButtonLabels;
const env0_7 = value.STICKERS;
value = require(661) /* metro dependency 661: Constants */;
const env0_8 = value.AnalyticEvents;
const env0_9 = value.NOOP;
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guild_role_subscriptions/GuildRoleSubscriptionSystemMessageUtils.tsx');
exports.pickRoleSubscriptionPurchaseSticker = pickRoleSubscriptionPurchaseSticker;
exports.getRoleSubscriptionPurchaseStickerCTA = getRoleSubscriptionPurchaseStickerCTA;
exports.getRoleSubscriptionPurchaseSystemMessageFormattedContent = function({username, usernameOnClickHandler,
roleSubscriptionOnClickHandler, guildId, roleSubscriptionData}) {
var value2 = getRoleSubscriptionPurchaseSystemMessageContent({username: username,
usernameOnClickHandler: usernameOnClickHandler,
roleSubscriptionOnClickHandler: roleSubscriptionOnClickHandler,
guildId: guildId, roleSubscriptionData: roleSubscriptionData});
username = value2.content;
return require(dependencyMap[5]).intl.format(username, value2.formatParams);
};
exports.getRoleSubscriptionPurchaseSystemMessageAstFormattedContent = function({username, usernameOnClickHandler,
roleSubscriptionOnClickHandler, guildId, roleSubscriptionData}) {
var value2 = getRoleSubscriptionPurchaseSystemMessageContent({username: username,
usernameOnClickHandler: usernameOnClickHandler,
roleSubscriptionOnClickHandler: roleSubscriptionOnClickHandler,
guildId: guildId, roleSubscriptionData: roleSubscriptionData});
username = value2.content;
return require(dependencyMap[5]).intl.formatToParts(username, value2.formatParams);
};
exports.getRoleSubscriptionPurchaseSystemMessageContentMobile = getRoleSubscriptionPurchaseSystemMessageContentMobile;
exports.isEligibleForRoleSubscriptionPurchaseSystemMessageSettings = isEligibleForRoleSubscriptionPurchaseSystemMessageSettings;
exports.trackRoleSubscriptionPurchaseMessageTierClick = trackRoleSubscriptionPurchaseMessageTierClick;
exports.getRoleSubscriptionPurchaseSystemMessageEventProperties = getRoleSubscriptionPurchaseSystemMessageEventProperties;
}
function getRoleSubscriptionPurchaseContentCommonData(a0, a1) { // fn#65866, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:260, offset: 0x01be34ef, size: 109 bytes, params: 3, frame: 16
const guild = GuildStore.getGuild(a0);
const value2 = undefined;
const total_months_subscribed = a1 == null ? value2 : a1.total_months_subscribed;
const value3 = 0;
const r4 = total_months_subscribed ?? value3;
const is_renewal = a1 == null ? value2 : a1.is_renewal;
return {guild: guild, totalMonthsSubscribed: r4, showWithDuration: r4 > value3,
isRenewal: is_renewal != null && is_renewal};
}
function getRoleSubscriptionPurchaseSystemMessageContent({username, usernameOnClickHandler = identityHook, roleSubscriptionOnClickHandler = NOOP, guildId, roleSubscriptionData}) { // fn#65867, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:512, offset: 0x01be355c, size: 245 bytes, params: 2, frame: 22
const {guild, totalMonthsSubscribed, showWithDuration,
isRenewal} = getRoleSubscriptionPurchaseContentCommonData(guildId, roleSubscriptionData);
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
return {content: showWithDuration ? isRenewal ? t.Iy66M7 : t.eCgb2W : isRenewal ? t.mPTTdv : t.mYjFFx,
formatParams: {username: username, usernameHook: usernameOnClickHandler, guildName: guild?.name,
handleGuildNameClick: roleSubscriptionOnClickHandler, tierName: roleSubscriptionData?.tier_name,
months: totalMonthsSubscribed}};
}
function pickRoleSubscriptionPurchaseSticker(a0) { // fn#65868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:1195, offset: 0x01be3651, size: 131 bytes, params: 2, frame: 15
const id = UserStore.getCurrentUser()?.id;
const r2 = id != null ? (importDefault(21) /* metro dependency 21: SnowflakeUtils */).extractTimestamp(id) : 0;
const defaultImport2 = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
return STICKERS[(r2 + defaultImport2.extractTimestamp(a0)) % STICKERS.length];
}
function getRoleSubscriptionPurchaseStickerCTA(a0, a1) { // fn#65869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:1426, offset: 0x01be36d4, size: 82 bytes, params: 3, frame: 12
const r1 = a1 ? getRenewButtonLabels() : getJoinButtonLabels();
let value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
value = value.extractTimestamp(a0);
return r1[value % r1.length];
}
function getRoleSubscriptionPurchaseSystemMessageContentMobile({username, usernameOnClickHandler = identityHook, roleSubscriptionOnClickHandler = NOOP, guildId, roleSubscriptionData}) { // fn#65872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:2513, offset: 0x01be3819, size: 268 bytes, params: 2, frame: 23
const {guild, totalMonthsSubscribed, showWithDuration,
isRenewal} = getRoleSubscriptionPurchaseContentCommonData(guildId, roleSubscriptionData);
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
return (require(1244) /* metro dependency 1244: indexNative */).intl.formatToParts(showWithDuration ? isRenewal ? t.OQ0OUy : t['+N9bxq'] : isRenewal ? t.OxP1NC : t['6Z1E+7'],
{guildName: guild?.name, tierName: roleSubscriptionData?.tier_name, username: username,
usernameOnClick: usernameOnClickHandler, roleSubscriptionOnClick: roleSubscriptionOnClickHandler,
months: totalMonthsSubscribed});
}
function isEligibleForRoleSubscriptionPurchaseSystemMessageSettings(a0) { // fn#65873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:3140, offset: 0x01be3925, size: 41 bytes, params: 2, frame: 11
return (require(6841) /* metro dependency 6841: useIsCreatorMonetizationEnabledGuild */).isCreatorMonetizationEnabledGuild(a0);
}
function trackRoleSubscriptionPurchaseMessageTierClick(a0, a1, a2, a3) { // fn#65874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:3312, offset: 0x01be394e, size: 115 bytes, params: 5, frame: 17
const value2 = undefined;
const defaultImport = importDefault(4863) /* metro dependency 4863: AppAnalyticsUtils */;
const trackWithMetadata = defaultImport.trackWithMetadata;
const ROLE_SUBSCRIPTION_PURCHASE_SYSTEM_MESSAGE_CLICKED = AnalyticEvents.ROLE_SUBSCRIPTION_PURCHASE_SYSTEM_MESSAGE_CLICKED;
const currentUser = UserStore.getCurrentUser();
Reflect.apply(trackWithMetadata, defaultImport, [ROLE_SUBSCRIPTION_PURCHASE_SYSTEM_MESSAGE_CLICKED, {guild_id: a0,
user_id: currentUser == null ? value2 : currentUser.id, channel_id: a1, message_id: a2,
role_subscription_listing_id: a3}]);
return value2;
}
function getRoleSubscriptionPurchaseSystemMessageEventProperties({guild_id, id}, {author, id}) { // fn#65875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8420:3639, offset: 0x01be39c1, size: 91 bytes, params: 3, frame: 13
const object2 = {};
object2.guild_id = guild_id;
let id = UserStore.getCurrentUser()?.id;
object2.sender = id;
id = author.id;
object2.target_user = id;
object2.channel_id = id;
object2.message_id = id;
return object2;
}