Files
discord-decomp/sources/modules/premium/native/PremiumPerkCard.tsx
T
2026-07-27 16:20:00 +03:00

267 lines
15 KiB
TypeScript

/* Metro module 7562; source: modules/premium/native/PremiumPerkCard.tsx; dependencies: [31, 27, 1880, 661, 33, 4584, 7563, 4136, 7007, 6789, 1244, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 4501, 697, 5475, 4573, 7580, 4578, 2] */
function _fun60795(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60795, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7740:6, offset: 0x0170f178, size: 590 bytes, params: 8, frame: 23
const env0_0 = require;
const closure = usePerkCardHeight;
let Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importAll(31) /* metro dependency 31 */;
let value = require(27) /* metro dependency 27 */;
const env0_4 = value.View;
const env0_5 = value.ScrollView;
const env0_6 = (require(1880) /* metro dependency 1880: PremiumConstants */).MAX_PREMIUM_TIER_2_ATTACHMENT_SIZE;
const env0_7 = (require(661) /* metro dependency 661: Constants */).UserSettingsSections;
value = require(33) /* metro dependency 33 */;
const env0_8 = value.jsx;
const env0_9 = value.jsxs;
const object = {NARROW: 0};
object[0] = 'NARROW';
object.WIDE = 1;
object[1] = 'WIDE';
Object = global.Object;
const freeze = Object.freeze;
const NARROW = object.NARROW;
const WIDE = object.WIDE;
value = Reflect.apply(freeze, Object, [{[NARROW]: {'width': 300, 'height': 364, 'scaledFontHeight': 440},
[WIDE]: {'width': 320, 'height': 364, 'scaledFontHeight': 440}}]);
const env0_12 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(_fun60797);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/native/PremiumPerkCard.tsx');
exports.default = PremiumPerkCard;
exports.PerkCardTypes = {CUSTOM_PROFILE: 'customProfile', CLIENT_THEMES: 'clientThemes',
SERVER_BOOSTS: 'serverBoosts', GREYED_SERVER_BOOSTS: 'greyServerBoosts', CUSTOM_APP_ICONS: 'customAppIcons',
EMOJI: 'emoji', CUSTOM_SOUNDS: 'customSounds', STICKER: 'sticker', EARLY_ACCESS: 'earlyAccess',
MEMBER_PRICING: 'memberPricing', LARGE_UPLOADS: 'largeUploads', HD_VIDEO: 'hdVideo',
SUPER_REACTIONS: 'superReactions', ENTRACE_SOUNDS: 'entranceSounds', BADGE: 'badge', GREYED_BADGE: 'greyBadge'};
exports.PerkCardVariant = object;
exports.PERK_CARD_SIZES = value;
exports.usePerkCardHeight = closure;
exports.usePremiumPerkCard = usePremiumPerkCard;
}
function usePerkCardHeight(a0) { // fn#60796, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7740:934, offset: 0x0170f3c6, size: 68 bytes, params: 2, frame: 12
const value2 = (require(4584) /* metro dependency 4584: useFontScale */).useFontScale();
const property = env0_11[a0];
return value2 > 1 ? property.scaledFontHeight : property.height;
}
function _fun60797(a0) { // fn#60797, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7740:1068, offset: 0x0170f40a, size: 529 bytes, params: 2, frame: 19
const object6 = {};
const object7 = {};
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object7.backgroundColor = BACKGROUND_SURFACE_HIGH;
let sm = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object7.borderRadius = sm;
object7.width = env0_11[a0].width;
const SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
copyDataProperties(object7, SHADOW_LOW, undefined);
object6.container = object7;
const object9 = {width: '100%'};
object9.borderTopLeftRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object9.borderTopRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object9.overflow = 'hidden';
object6.headerComponent = object9;
const object10 = {width: '100%'};
sm = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object10.borderTopLeftRadius = sm;
object10.borderTopRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object6.image = object10;
object6.title = {'marginTop': 16, 'marginHorizontal': 16};
const object11 = {'marginTop': 8, 'marginHorizontal': 16};
const value2 = 8;
const WIDE = env0_10.WIDE;
object11.marginBottom = a0 !== WIDE ? value2 : 24;
const NARROW = env0_10.NARROW;
copyDataProperties(object11, a0 === NARROW && ({height: '100%'}), sm);
object6.description = object11;
object6.button = {'marginTop': 'auto', 'marginHorizontal': 16, 'marginBottom': 16};
object6.imageContainer = {'position': 'relative', 'alignItems': 'center', 'justifyContent': 'center'};
const WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
object6.imageOverlayText = {color: WHITE, fontSize: 14};
const object12 = {'position': 'absolute', 'bottom': '10%', 'borderRadius': null, 'backgroundColor': null,
'paddingHorizontal': 12, 'paddingVertical': 4, 'justifyContent': 'center', 'alignItems': 'center'};
object12.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
const BACKGROUND_MOD_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_STRONG;
object12.backgroundColor = BACKGROUND_MOD_STRONG;
object6.imageOverlayTextContainer = object12;
object6.pillTextContainer = {'position': 'absolute', 'width': 'auto', 'top': -8, 'left': 10};
return object6;
}
function PremiumPerkCard({style, title, titleStyle, description, bodyComponent, headerComponent, imageSrc, buttonOnPress, cta, variant = env0_10.WIDE, imageOverlayText, pillText}) { // fn#60798, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7740:2186, offset: 0x0170f61b, size: 881 bytes, params: 2, frame: 35
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
var r12;
var intl;
if (cta !== undefined) {
r12 = cta;
} else {
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
r12 = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.jVcuVY);
}
const styles = useStyles(variant);
let NARROW = env0_10.NARROW;
const value2 = usePerkCardHeight(NARROW);
const r6 = imageSrc != null ? imageOverlayText != null ? <View style={styles.imageContainer}>{((Component) => <Component style={styles.image} source={imageSrc} />)(importDefault(5475) /* metro dependency 5475: FastImage */)}<View style={styles.imageOverlayTextContainer}><Text style={styles.imageOverlayText} variant="text-md/bold">{imageOverlayText.toUpperCase()}</Text></View></View> : ((Component) => <Component style={styles.image} source={imageSrc} />)(importDefault(5475) /* metro dependency 5475: FastImage */) : headerComponent != null ? <View style={styles.headerComponent}>{headerComponent}</View> : null;
const r13 = description != null ? <Text variant="text-sm/normal">{description}</Text> : bodyComponent ?? null;
const items2 = [styles.container];
NARROW = env0_10.NARROW;
items2[1] = variant === NARROW && ({height: value2});
items2[2] = style;
const items3 = [pillText != null && ((Component) => <Component pillText={pillText} style={styles.pillTextContainer} />)(importDefault(7580) /* metro dependency 7580: PillText */),
r6];
items3[2] = <Text style={[styles.title,
titleStyle]} variant="heading-lg/extrabold" accessibilityRole="header">{title}</Text>;
items3[3] = <ScrollView style={styles.description}>{r13}</ScrollView>;
items3[4] = buttonOnPress != null && <View style={styles.button}>{((Button) => <Button size="sm" variant="secondary" text={r12} onPress={buttonOnPress} />)((require(4578) /* metro dependency 4578: ButtonNative */).Button)}</View>;
return (
<View style={items2}>
{items3}
</View>
);
}
function usePremiumPerkCard() { // fn#60799, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7740:3384, offset: 0x0170f98c, size: 2312 bytes, params: 1, frame: 25
var object13;
const value2 = (require(7563) /* metro dependency 7563: useSubscriptionPlansLoaded */).useSubscriptionPlansLoaded();
const fileSizeUtilsModule = require(4136) /* metro dependency 4136: FileSizeUtils */;
const value4 = fileSizeUtilsModule.formatSize(MAX_PREMIUM_TIER_2_ATTACHMENT_SIZE / 1024, {useKibibytes: true});
const binding = env0_3;
const value5 = binding.useCallback(function() {
var moduleValue = require(dependencyMap[8]);
var object = {};
object.screen = UserSettingsSections.COLLECTIBLES_SHOP;
var object2 = {};
object2.analyticsSource = importDefault(dependencyMap[9]).PREMIUM_MARKETING_PERK_CARD;
object.params = object2;
moduleValue.openUserSettings(object);
}, []);
const value6 = binding.useCallback(function() {
require(dependencyMap[8]).openUserSettings({screen: UserSettingsSections.PROFILE_CUSTOMIZATION});
}, []);
const value7 = binding.useCallback(function() {
require(dependencyMap[8]).openUserSettings({screen: UserSettingsSections.APPEARANCE_THEME_PICKER});
}, []);
const value8 = binding.useCallback(_fun60803, [value2]);
const value9 = binding.useCallback(function() {
require(dependencyMap[8]).openUserSettings({screen: UserSettingsSections.APP_ICONS});
}, []);
object13 = {};
const object14 = {};
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const KcyDwF = t.KcyDwF;
object14.title = Reflect.apply(string, intl, [KcyDwF]);
string = intl.string;
const Mt3U1W = t.Mt3U1W;
object14.description = Reflect.apply(string, intl, [Mt3U1W]);
object14.imageSrc = importDefault(7564) /* metro dependency 7564 */;
object14.buttonOnPress = value6;
object13.customProfile = object14;
const object20 = {};
object20.title = intl.string(t.kWM48G);
string = intl.string;
const CjRASJ = t.CjRASJ;
object20.description = Reflect.apply(string, intl, [CjRASJ]);
object20.imageSrc = importDefault(7565) /* metro dependency 7565 */;
object20.buttonOnPress = value7;
object13.clientThemes = object20;
const object21 = {};
object21.title = intl.string(t['NyDu/6']);
object21.description = intl.string(t['4pEwXL']);
object21.imageSrc = importDefault(7566) /* metro dependency 7566 */;
object21.buttonOnPress = value8;
object13.serverBoosts = object21;
const object22 = {};
object22.title = intl.string(t['NyDu/6']);
object22.description = intl.string(t['4pEwXL']);
object22.imageSrc = importDefault(7567) /* metro dependency 7567 */;
object22.imageOverlayText = intl.string(t['/VzCKE']);
object13.greyServerBoosts = object22;
const object23 = {};
string = intl.string;
const OuItFi = t.OuItFi;
object23.title = Reflect.apply(string, intl, [OuItFi]);
object23.description = intl.string(t.mPyrE6);
object23.imageSrc = importDefault(7568) /* metro dependency 7568 */;
object23.buttonOnPress = value9;
object13.customAppIcons = object23;
const object24 = {};
object24.title = intl.string(t['R2IV/Q']);
string = intl.string;
const R5Xag2 = t.R5Xag2;
object24.description = Reflect.apply(string, intl, [R5Xag2]);
object24.imageSrc = importDefault(7569) /* metro dependency 7569 */;
object13.emoji = object24;
const object25 = {};
string = intl.string;
const LWsArT = t.LWsArT;
object25.title = Reflect.apply(string, intl, [LWsArT]);
object25.description = intl.string(t['4lSyCY']);
object25.imageSrc = importDefault(7570) /* metro dependency 7570 */;
object13.customSounds = object25;
const object26 = {};
object26.title = intl.string(t.tzdIwI);
object26.description = intl.string(t.hJG8ZN);
object26.imageSrc = importDefault(7571) /* metro dependency 7571 */;
object13.sticker = object26;
const object27 = {};
string = intl.string;
const EYxi0o = t.EYxi0o;
object27.title = Reflect.apply(string, intl, [EYxi0o]);
string = intl.string;
const M9AIt1 = t.M9AIt1;
object27.description = Reflect.apply(string, intl, [M9AIt1]);
object27.imageSrc = importDefault(7572) /* metro dependency 7572 */;
object13.earlyAccess = object27;
const object28 = {};
object28.title = intl.string(t['H4/NBN']);
object28.description = intl.string(t.wo3D3T);
object28.imageSrc = importDefault(7573) /* metro dependency 7573 */;
object28.buttonOnPress = value5;
object13.memberPricing = object28;
const object29 = {};
object29.title = intl.formatToPlainString(t.jqhAdL, {premiumMaxSize: value4});
object29.description = intl.formatToPlainString(t['HI+cfm'], {premiumMaxSize: value4});
object29.imageSrc = importDefault(7574) /* metro dependency 7574 */;
object13.largeUploads = object29;
const object30 = {};
string = intl.string;
const RSXQYO = t.RSXQYO;
object30.title = Reflect.apply(string, intl, [RSXQYO]);
object30.description = intl.string(t.ymCPxp);
object30.imageSrc = importDefault(7575) /* metro dependency 7575 */;
object13.hdVideo = object30;
const object31 = {};
object31.title = intl.string(t['6S7kO7']);
string = intl.string;
const A0U9fk = t.A0U9fk;
object31.description = Reflect.apply(string, intl, [A0U9fk]);
object31.imageSrc = importDefault(7576) /* metro dependency 7576 */;
object13.superReactions = object31;
const object32 = {};
object32.title = intl.string(t['f4M+H9']);
object32.description = intl.string(t['7ZCYvC']);
object32.imageSrc = importDefault(7577) /* metro dependency 7577 */;
object13.entranceSounds = object32;
const object33 = {};
object33.title = intl.string(t.dcFfSJ);
object33.description = intl.string(t['37MFFq']);
object33.imageSrc = importDefault(7578) /* metro dependency 7578 */;
object13.badge = object33;
const object34 = {};
object34.title = intl.string(t.dcFfSJ);
object34.description = intl.string(t['37MFFq']);
object34.imageSrc = importDefault(7579) /* metro dependency 7579 */;
object34.imageOverlayText = intl.string(t['/VzCKE']);
object13.greyBadge = object34;
return object13;
}
function _fun60803() { // fn#60803, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7740:3841, offset: 0x0171035b, size: 77 bytes, params: 1, frame: 14
const openUserSettingsModule = require(7007) /* metro dependency 7007: openUserSettings */;
const openUserSettings = openUserSettingsModule.openUserSettings;
const GUILD_BOOSTING = UserSettingsSections.GUILD_BOOSTING;
Reflect.apply(openUserSettings, openUserSettingsModule, [{screen: GUILD_BOOSTING,
params: {shouldFetchSubscriptionPlans: !env0_0}}]);
}