57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
// Metro module 12601 (f12602).
|
|
import { View } from "react-native";
|
|
import { PREMIUM_YEARLY_DISCOUNT_PERCENT, PRICE_PLACEHOLDER, SubscriptionIntervalTypes } from "../PremiumConstants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { hexWithOpacity } from "../../../utils/ColorUtils";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import PremiumUtils from "../../../utils/PremiumUtils";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { LegacyText } from "../../../design/void/native";
|
|
let useStyles;
|
|
const PremiumText = function PremiumText(props) {
|
|
const { style, isCurrentPlan, isGift, basePlanId, product } = props;
|
|
let text = props.text;
|
|
const styles = useStyles();
|
|
const intervalType = PremiumUtils.getInterval(basePlanId).intervalType;
|
|
const r11 = intervalType === SubscriptionIntervalTypes.YEAR ? isCurrentPlan ? null : `-${PREMIUM_YEARLY_DISCOUNT_PERCENT}%` : null;
|
|
if (text == null) {
|
|
let price = product?.priceString;
|
|
if (price == null) {
|
|
price = PRICE_PLACEHOLDER;
|
|
}
|
|
text = intervalType === SubscriptionIntervalTypes.MONTH ? isGift ? intl.formatToPlainString(t.FIjgMp, {
|
|
price
|
|
}) : intl.formatToPlainString(isCurrentPlan ? t.V6iX43 : t.AbOLNu, {
|
|
price
|
|
}) : isGift ? intl.formatToPlainString(t.rm53bV, {
|
|
price
|
|
}) : intl.formatToPlainString(isCurrentPlan ? t.dFbQCa : t["rS8FA+"], {
|
|
price
|
|
});
|
|
}
|
|
return <View style={styles.premiumText}>
|
|
<LegacyText style={style} numberOfLines={1} accessibilityLabel={intl.formatToPlainString(t.E0lS2r, {
|
|
product: product?.title,
|
|
description: text
|
|
})}>{text}</LegacyText>
|
|
{r11 != null ? <View style={styles.discount}>
|
|
<LegacyText style={style} numberOfLines={1}>{r11}</LegacyText>
|
|
</View> : null}
|
|
</View>;
|
|
};
|
|
useStyles = createStyles({
|
|
discount: {
|
|
borderWidth: 1,
|
|
borderColor: hexWithOpacity(Module712.unsafe_rawColors.WHITE, 0.3),
|
|
borderRadius: 2,
|
|
marginLeft: 4,
|
|
paddingHorizontal: 2
|
|
},
|
|
premiumText: {
|
|
flexDirection: "row"
|
|
}
|
|
});
|
|
export default function renderPremiumText(a0) {
|
|
return <PremiumText {...a0} />;
|
|
};
|