Files
discord-decomp/sources/modules/premium/native/PremiumPerkCard.tsx
T
2026-07-28 01:06:53 +03:00

323 lines
18 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] */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as PremiumConstantsModule from '../PremiumConstants.tsx'; /* Metro dependency 1880 */
import * as FileSizeUtilsModule from '../../../utils/FileSizeUtils.tsx'; /* Metro dependency 4136 */
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as UseFontScaleModule from '../../screen/native/useFontScale.tsx'; /* Metro dependency 4584 */
import * as OpenUserSettingsModule from '../../user_settings/core/native/openUserSettings.tsx'; /* Metro dependency 7007 */
import * as UseSubscriptionPlansLoadedModule from '../../billing/hooks/useSubscriptionPlansLoaded.tsx'; /* Metro dependency 7563 */
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 usePerkCardHeight2 = usePerkCardHeight;
let Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_4 = value.View;
const env0_5 = value.ScrollView;
value = require(33) /* metro dependency 33 */;
const env0_8 = value.jsx;
const env0_9 = value.jsxs;
const object2 = {NARROW: 0};
object2[0] = 'NARROW';
object2.WIDE = 1;
object2[1] = 'WIDE';
Object = global.Object;
const freeze = Object.freeze;
const NARROW = object2.NARROW;
const WIDE = object2.WIDE;
value = Reflect.apply(freeze, Object, [{[NARROW]: {'width': 300, 'height': 364, 'scaledFontHeight': 440},
[WIDE]: {'width': 320, 'height': 364, 'scaledFontHeight': 440}}]);
const env0_12 = (CreateStylesModule).createStyles(_fun60797);
(FileImportTrackerModule).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 = object2;
exports.PERK_CARD_SIZES = value;
exports.usePerkCardHeight = usePerkCardHeight2;
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 = (UseFontScaleModule).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 object = {};
const object2 = {};
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object2.backgroundColor = BACKGROUND_SURFACE_HIGH;
let sm = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object2.borderRadius = sm;
object2.width = env0_11[a0].width;
const SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
copyDataProperties(object2, SHADOW_LOW, undefined);
object.container = object2;
const object3 = {width: '100%'};
object3.borderTopLeftRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object3.borderTopRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object3.overflow = 'hidden';
object.headerComponent = object3;
const object4 = {width: '100%'};
sm = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object4.borderTopLeftRadius = sm;
object4.borderTopRightRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.image = object4;
object.title = {'marginTop': 16, 'marginHorizontal': 16};
const object5 = {'marginTop': 8, 'marginHorizontal': 16};
const value2 = 8;
const WIDE = env0_10.WIDE;
object5.marginBottom = a0 !== WIDE ? value2 : 24;
const NARROW = env0_10.NARROW;
copyDataProperties(object5, a0 === NARROW && ({height: '100%'}), sm);
object.description = object5;
object.button = {'marginTop': 'auto', 'marginHorizontal': 16, 'marginBottom': 16};
object.imageContainer = {'position': 'relative', 'alignItems': 'center', 'justifyContent': 'center'};
const WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
object.imageOverlayText = {color: WHITE, fontSize: 14};
const object8 = {'position': 'absolute', 'bottom': '10%', 'borderRadius': null, 'backgroundColor': null,
'paddingHorizontal': 12, 'paddingVertical': 4, 'justifyContent': 'center', 'alignItems': 'center'};
object8.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
const BACKGROUND_MOD_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_STRONG;
object8.backgroundColor = BACKGROUND_MOD_STRONG;
object.imageOverlayTextContainer = object8;
object.pillTextContainer = {'position': 'absolute', 'width': 'auto', 'top': -8, 'left': 10};
return object;
}
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 = (TextModule).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
const value2 = (UseSubscriptionPlansLoadedModule).useSubscriptionPlansLoaded();
const value4 = FileSizeUtilsModule.formatSize(MAX_PREMIUM_TIER_2_ATTACHMENT_SIZE / 1024, {useKibibytes: true});
const value5 = ReactModule.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 = ReactModule.useCallback(function() {
require(dependencyMap[8]).openUserSettings({screen: UserSettingsSections.PROFILE_CUSTOMIZATION});
}, []);
const value7 = ReactModule.useCallback(function() {
require(dependencyMap[8]).openUserSettings({screen: UserSettingsSections.APPEARANCE_THEME_PICKER});
}, []);
const value8 = ReactModule.useCallback(_fun60803, [value2]);
const value9 = ReactModule.useCallback(function() {
require(dependencyMap[8]).openUserSettings({screen: UserSettingsSections.APP_ICONS});
}, []);
object = {};
let object2 = {};
const intl = (IndexNativeModule).intl;
let string = intl.string;
const t = (IndexNativeModule).t;
const KcyDwF = t.KcyDwF;
object2.title = Reflect.apply(string, intl, [KcyDwF]);
string = intl.string;
const Mt3U1W = t.Mt3U1W;
object2.description = Reflect.apply(string, intl, [Mt3U1W]);
object2.imageSrc = importDefault(7564) /* metro dependency 7564 */;
object2.buttonOnPress = value6;
object.customProfile = object2;
const object3 = {};
object3.title = intl.string(t.kWM48G);
string = intl.string;
const CjRASJ = t.CjRASJ;
object3.description = Reflect.apply(string, intl, [CjRASJ]);
object3.imageSrc = importDefault(7565) /* metro dependency 7565 */;
object3.buttonOnPress = value7;
object.clientThemes = object3;
const object4 = {};
object4.title = intl.string(t['NyDu/6']);
object4.description = intl.string(t['4pEwXL']);
object4.imageSrc = importDefault(7566) /* metro dependency 7566 */;
object4.buttonOnPress = value8;
object.serverBoosts = object4;
const object5 = {};
object5.title = intl.string(t['NyDu/6']);
object5.description = intl.string(t['4pEwXL']);
object5.imageSrc = importDefault(7567) /* metro dependency 7567 */;
object5.imageOverlayText = intl.string(t['/VzCKE']);
object.greyServerBoosts = object5;
const object6 = {};
string = intl.string;
const OuItFi = t.OuItFi;
object6.title = Reflect.apply(string, intl, [OuItFi]);
object6.description = intl.string(t.mPyrE6);
object6.imageSrc = importDefault(7568) /* metro dependency 7568 */;
object6.buttonOnPress = value9;
object.customAppIcons = object6;
const object7 = {};
object7.title = intl.string(t['R2IV/Q']);
string = intl.string;
const R5Xag2 = t.R5Xag2;
object7.description = Reflect.apply(string, intl, [R5Xag2]);
object7.imageSrc = importDefault(7569) /* metro dependency 7569 */;
object.emoji = object7;
const object8 = {};
string = intl.string;
const LWsArT = t.LWsArT;
object8.title = Reflect.apply(string, intl, [LWsArT]);
object8.description = intl.string(t['4lSyCY']);
object8.imageSrc = importDefault(7570) /* metro dependency 7570 */;
object.customSounds = object8;
const object9 = {};
object9.title = intl.string(t.tzdIwI);
object9.description = intl.string(t.hJG8ZN);
object9.imageSrc = importDefault(7571) /* metro dependency 7571 */;
object.sticker = object9;
const object10 = {};
string = intl.string;
const EYxi0o = t.EYxi0o;
object10.title = Reflect.apply(string, intl, [EYxi0o]);
string = intl.string;
const M9AIt1 = t.M9AIt1;
object10.description = Reflect.apply(string, intl, [M9AIt1]);
object10.imageSrc = importDefault(7572) /* metro dependency 7572 */;
object.earlyAccess = object10;
const object11 = {};
object11.title = intl.string(t['H4/NBN']);
object11.description = intl.string(t.wo3D3T);
object11.imageSrc = importDefault(7573) /* metro dependency 7573 */;
object11.buttonOnPress = value5;
object.memberPricing = object11;
const object12 = {};
object12.title = intl.formatToPlainString(t.jqhAdL, {premiumMaxSize: value4});
object12.description = intl.formatToPlainString(t['HI+cfm'], {premiumMaxSize: value4});
object12.imageSrc = importDefault(7574) /* metro dependency 7574 */;
object.largeUploads = object12;
const object15 = {};
string = intl.string;
const RSXQYO = t.RSXQYO;
object15.title = Reflect.apply(string, intl, [RSXQYO]);
object15.description = intl.string(t.ymCPxp);
object15.imageSrc = importDefault(7575) /* metro dependency 7575 */;
object.hdVideo = object15;
const object16 = {};
object16.title = intl.string(t['6S7kO7']);
string = intl.string;
const A0U9fk = t.A0U9fk;
object16.description = Reflect.apply(string, intl, [A0U9fk]);
object16.imageSrc = importDefault(7576) /* metro dependency 7576 */;
object.superReactions = object16;
const object17 = {};
object17.title = intl.string(t['f4M+H9']);
object17.description = intl.string(t['7ZCYvC']);
object17.imageSrc = importDefault(7577) /* metro dependency 7577 */;
object.entranceSounds = object17;
const object18 = {};
object18.title = intl.string(t.dcFfSJ);
object18.description = intl.string(t['37MFFq']);
object18.imageSrc = importDefault(7578) /* metro dependency 7578 */;
object.badge = object18;
const object19 = {};
object19.title = intl.string(t.dcFfSJ);
object19.description = intl.string(t['37MFFq']);
object19.imageSrc = importDefault(7579) /* metro dependency 7579 */;
object19.imageOverlayText = intl.string(t['/VzCKE']);
object.greyBadge = object19;
return object;
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 openUserSettings = OpenUserSettingsModule.openUserSettings;
const GUILD_BOOSTING = UserSettingsSections.GUILD_BOOSTING;
Reflect.apply(openUserSettings, OpenUserSettingsModule, [{screen: GUILD_BOOSTING,
params: {shouldFetchSubscriptionPlans: !env0_0}}]);
}
}
}
global.__d(_fun60795, 7562, [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]) /* metro module 7562, 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] */;