98 lines
6.6 KiB
TypeScript
98 lines
6.6 KiB
TypeScript
/* Metro module 12277; source: modules/premium/native/PremiumPlanSelectYearlyUpsellModal.tsx; dependencies: [57, 31, 27, 1949, 5140, 12270, 1880, 482, 33, 4501, 6597, 6235, 7027, 566, 1856, 4596, 12278, 1305, 1244, 3802, 4578, 2] */
|
|
function _fun93809(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#93809, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12463:6, offset: 0x020c468e, size: 533 bytes, params: 8, frame: 25
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_4 = importAll(31) /* metro dependency 31 */;
|
|
let value = require(27) /* metro dependency 27 */;
|
|
const env0_5 = value.Image;
|
|
const env0_6 = value.View;
|
|
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
|
|
const iapStoreAndroid = importDefault(5140) /* metro dependency 5140: IAPStoreAndroid */;
|
|
const env0_9 = (require(12270) /* metro dependency 12270: PremiumPlanSelectStore */).usePremiumPlanSelectStore;
|
|
const env0_10 = (require(1880) /* metro dependency 1880: PremiumConstants */).PREMIUM_YEARLY_DISCOUNT_PERCENT;
|
|
const Fonts = (require(482) /* metro dependency 482: Constants */).Fonts;
|
|
value = require(33) /* metro dependency 33 */;
|
|
const env0_11 = value.jsx;
|
|
const env0_12 = value.jsxs;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
const object = {};
|
|
const textStyles = importDefault(6597) /* metro dependency 6597: TextStyles */;
|
|
const DISPLAY_EXTRABOLD = Fonts.DISPLAY_EXTRABOLD;
|
|
copyDataProperties(object, textStyles(DISPLAY_EXTRABOLD, undefined, 24), undefined);
|
|
object['alignSelf'] = 'center';
|
|
object['textAlign'] = 'center';
|
|
object['paddingBottom'] = 8;
|
|
const DARK_WHITE_500_LIGHT_BLACK_500 = (require(6235) /* metro dependency 6235: LegacyTokens */).DARK_WHITE_500_LIGHT_BLACK_500;
|
|
object['color'] = DARK_WHITE_500_LIGHT_BLACK_500;
|
|
const env0_13 = Reflect.apply(createStyles, value, [{container: {marginHorizontal: 26},
|
|
image: {'alignSelf': 'center', 'marginVertical': 32}, header: object, description: {'alignSelf': 'center',
|
|
'textAlign': 'center', 'paddingBottom': 32, color: DARK_WHITE_500_LIGHT_BLACK_500},
|
|
upsellButton: {marginBottom: 16}, continueButton: {marginBottom: 4}, cancelButton: {'marginTop': 8,
|
|
'marginBottom': 4}}]);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/native/PremiumPlanSelectYearlyUpsellModal.tsx');
|
|
exports.default = PremiumPlanSelectYearlyUpsellModal;
|
|
}
|
|
|
|
function PremiumPlanSelectYearlyUpsellModal({onClose, productId, orderPriceString, continueWithUpsell, continueWithDefault}) { // fn#93810, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12463:867, offset: 0x020c48a3, size: 1034 bytes, params: 2, frame: 38
|
|
const styles = useStyles();
|
|
const value3 = usePremiumPlanSelectStore(function(a0) {
|
|
return a0.isPurchasing;
|
|
});
|
|
const premiumBundledItemsFromProductId = (require(7027) /* metro dependency 7027: PremiumBundledPlansUtils */).getPremiumBundledItemsFromProductId(productId);
|
|
const locale = (require(566) /* metro dependency 566: flux */).useStateFromStores([LocaleStore], function() {
|
|
return LocaleStore.locale;
|
|
});
|
|
const fluxModule = require(566) /* metro dependency 566: flux */;
|
|
const useStateFromStoresArray = fluxModule.useStateFromStoresArray;
|
|
const value6 = env0_3(Reflect.apply(useStateFromStoresArray, fluxModule, [[IAPStoreAndroid], _fun93813]), 2);
|
|
const property = value6[0];
|
|
const r18 = value3 || value6[1];
|
|
const premiumTier = premiumBundledItemsFromProductId.premiumTier;
|
|
const r25 = orderPriceString ?? property?.priceString;
|
|
const r1 = premiumTier == null || r25 == null;
|
|
env0_4.useEffect(_fun93814);
|
|
if (r1) {
|
|
return null;
|
|
}
|
|
const numberUtilsModule = require(1856) /* metro dependency 1856: NumberUtils */;
|
|
const value9 = numberUtilsModule.formatPercent(locale, PREMIUM_YEARLY_DISCOUNT_PERCENT / 100);
|
|
const Alert = importDefault(4596) /* metro dependency 4596: Alert */;
|
|
const items2 = [<Image style={styles.image} source={importDefault(12278) /* metro dependency 12278 */} />];
|
|
const LegacyText = (require(1305) /* metro dependency 1305: native */).LegacyText;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const format = intl.format;
|
|
const LQCVfK = (require(1244) /* metro dependency 1244: indexNative */).t.LQCVfK;
|
|
const object = {discountPercentage: value9};
|
|
object.planName = (require(3802) /* metro dependency 3802: PremiumUtils */).getPremiumTypeDisplayName(premiumTier);
|
|
items2[1] = <LegacyText style={styles.header}>{Reflect.apply(format, intl, [LQCVfK, object])}</LegacyText>;
|
|
items2[2] = <LegacyText style={styles.description}>{intl.format((require(1244) /* metro dependency 1244: indexNative */).t['7chOVL'],
|
|
{discountPercentage: value9})}</LegacyText>;
|
|
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
|
|
const formatToPlainString = intl.formatToPlainString;
|
|
const Qvq6GE = (require(1244) /* metro dependency 1244: indexNative */).t.Qvq6GE;
|
|
items2[3] = <View style={styles.upsellButton}><Button variant="active" text={Reflect.apply(formatToPlainString,
|
|
intl, [Qvq6GE, {price: r25}])} onPress={continueWithUpsell} disabled={r18} /></View>;
|
|
const string = intl.string;
|
|
const YwEyQM = (require(1244) /* metro dependency 1244: indexNative */).t.YwEyQM;
|
|
items2[4] = <View style={styles.continueButton}><Button variant="secondary" text={Reflect.apply(string, intl,
|
|
[YwEyQM])} onPress={continueWithDefault} disabled={r18} /></View>;
|
|
items2[5] = <View style={styles.cancelButton}><Button variant="tertiary" text={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.cpT0Cq)} onPress={onClose} /></View>;
|
|
return (
|
|
<Alert onClose={onClose} noDefaultButtons>
|
|
<View style={styles.container}>
|
|
{items2}
|
|
</View>
|
|
</Alert>
|
|
);
|
|
}
|
|
|
|
function _fun93813() { // fn#93813, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12463:1173, offset: 0x020c4cad, size: 49 bytes, params: 1, frame: 11
|
|
const value = environment.__proto__;
|
|
const getProduct = IAPStoreAndroid.getProduct;
|
|
return [Reflect.apply(getProduct, IAPStoreAndroid, [productId]), IAPStoreAndroid.isBusy()];
|
|
}
|
|
|