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

81 lines
5.2 KiB
TypeScript

/* Metro module 12295; source: modules/premium/native/renderPremiumButtonText.tsx; dependencies: [31, 27, 1880, 33, 4501, 4000, 697, 3802, 1244, 1305, 2] */
import Native from '../../../external/discord_common/js/packages/tokens/native.tsx'; /* Metro dependency 697 */
import PremiumUtils from '../../../utils/PremiumUtils.tsx'; /* Metro dependency 3802 */
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 NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
import * as PremiumConstantsModule from '../PremiumConstants.tsx'; /* Metro dependency 1880 */
import * as ColorUtilsModule from '../../../utils/ColorUtils.tsx'; /* Metro dependency 4000 */
function _fun93906(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#93906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12481:6, offset: 0x020c9d33, size: 336 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
ReactModule;
let value = PremiumConstantsModule;
const env0_4 = value.PREMIUM_YEARLY_DISCOUNT_PERCENT;
const env0_5 = value.SubscriptionIntervalTypes;
value = require(33) /* metro dependency 33 */;
const env0_6 = value.jsx;
const env0_7 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
const hexWithOpacity = ColorUtilsModule.hexWithOpacity;
const WHITE = (Native).unsafe_rawColors.WHITE;
const env0_8 = Reflect.apply(createStyles, value, [{discount: {'borderWidth': 1, 'borderColor': null,
'borderRadius': 2, 'marginLeft': 4, 'paddingHorizontal': 2, borderColor: Reflect.apply(hexWithOpacity,
ColorUtilsModule, [WHITE, 0.3])}, premiumText: {flexDirection: 'row'}}]);
(FileImportTrackerModule).fileFinishedImporting('modules/premium/native/renderPremiumButtonText.tsx');
exports.default = renderPremiumText;
function PremiumText({style, isCurrentPlan, isGift, basePlanId, product, text}) { // fn#93907, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12481:425, offset: 0x020c9e83, size: 719 bytes, params: 2, frame: 31
const LegacyText = (NativeModule).LegacyText;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
const styles = useStyles();
const defaultImport = PremiumUtils;
const getInterval = defaultImport.getInterval;
const intervalType = Reflect.apply(getInterval, defaultImport, [basePlanId]).intervalType;
const YEAR = SubscriptionIntervalTypes.YEAR;
const r12 = intervalType !== YEAR || isCurrentPlan ? null : '-' + PREMIUM_YEARLY_DISCOUNT_PERCENT + '%';
const r8 = text ?? (intervalType === SubscriptionIntervalTypes.MONTH ? isGift ? intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.FIjgMp,
{price: product?.priceString ?? '$...'}) : intl.formatToPlainString(isCurrentPlan ? t.V6iX43 : t.AbOLNu,
{price: product?.priceString ?? '$...'}) : isGift ? intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.rm53bV,
{price: product?.priceString ?? '$...'}) : intl.formatToPlainString(isCurrentPlan ? t.dFbQCa : t['rS8FA+'],
{price: product?.priceString ?? '$...'}));
const formatToPlainString = intl.formatToPlainString;
const E0lS2r = (require(1244) /* metro dependency 1244: indexNative */).t.E0lS2r;
return (
<View style={styles.premiumText}>
<LegacyText
style={style}
numberOfLines={1}
accessibilityLabel={Reflect.apply(formatToPlainString, intl, [E0lS2r, {product: product?.title,
description: r8}])}
>
{r8}
</LegacyText>
{
r12 != null
? (
<View style={styles.discount}>
<LegacyText style={style} numberOfLines={1}>
{r12}
</LegacyText>
</View>
)
: null
}
</View>
);
}
function renderPremiumText(a0) { // fn#93908, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12481:1380, offset: 0x01da845c, size: 33 bytes, params: 2, frame: 13
return <PremiumText {...a0} />;
}
}
global.__d(_fun93906, 12295, [31, 27, 1880, 33, 4501, 4000, 697, 3802, 1244, 1305,
2]) /* metro module 12295, dependencies: [31, 27, 1880, 33, 4501, 4000, 697, 3802, 1244, 1305, 2] */;