151 lines
8.8 KiB
TypeScript
151 lines
8.8 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] */
|
|
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import LocaleStore from '../../user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
|
|
import Alert from '../../../components_native/common/Alert.tsx'; /* Metro dependency 4596 */
|
|
import IAPStoreAndroid from '../../../stores/native/IAPStore.android.tsx'; /* Metro dependency 5140 */
|
|
import TextStyles from '../../rebrand/native/TextStyles.tsx'; /* Metro dependency 6597 */
|
|
import Module12278 from '../../../by-id/module-12278.js'; /* Metro dependency 12278 */
|
|
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 '../../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
|
|
import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */
|
|
import * as NumberUtilsModule from '../../../utils/NumberUtils.tsx'; /* Metro dependency 1856 */
|
|
import * as PremiumConstantsModule from '../PremiumConstants.tsx'; /* Metro dependency 1880 */
|
|
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
|
|
import * as LegacyTokensModule from '../../../design/migrations/native/LegacyTokens.tsx'; /* Metro dependency 6235 */
|
|
import * as PremiumBundledPlansUtilsModule from './PremiumBundledPlansUtils.tsx'; /* Metro dependency 7027 */
|
|
import * as PremiumPlanSelectStoreModule from './PremiumPlanSelectStore.tsx'; /* Metro dependency 12270 */
|
|
|
|
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});
|
|
let value = ReactNativeModule;
|
|
const env0_5 = value.Image;
|
|
const env0_6 = value.View;
|
|
const Fonts = (ConstantsModule).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 object2 = {};
|
|
const DISPLAY_EXTRABOLD = Fonts.DISPLAY_EXTRABOLD;
|
|
copyDataProperties(object2, TextStyles(DISPLAY_EXTRABOLD, undefined, 24), undefined);
|
|
object2['alignSelf'] = 'center';
|
|
object2['textAlign'] = 'center';
|
|
object2['paddingBottom'] = 8;
|
|
const DARK_WHITE_500_LIGHT_BLACK_500 = (LegacyTokensModule).DARK_WHITE_500_LIGHT_BLACK_500;
|
|
object2['color'] = DARK_WHITE_500_LIGHT_BLACK_500;
|
|
const env0_13 = Reflect.apply(createStyles, value, [{container: {marginHorizontal: 26},
|
|
image: {'alignSelf': 'center', 'marginVertical': 32}, header: object2, 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}}]);
|
|
(FileImportTrackerModule).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 = (PremiumBundledPlansUtilsModule).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 = Module00057(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;
|
|
ReactModule.useEffect(_fun93814);
|
|
if (r1) {
|
|
return null;
|
|
}
|
|
const value9 = NumberUtilsModule.formatPercent(locale, PREMIUM_YEARLY_DISCOUNT_PERCENT / 100);
|
|
const items2 = [
|
|
<Image style={styles.image} source={Module12278} />,
|
|
];
|
|
const LegacyText = (NativeModule).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 object2 = {discountPercentage: value9};
|
|
object2.planName = (require(3802) /* metro dependency 3802: PremiumUtils */).getPremiumTypeDisplayName(premiumTier);
|
|
items2[1] = (
|
|
<LegacyText style={styles.header}>
|
|
{Reflect.apply(format, intl, [LQCVfK, object2])}
|
|
</LegacyText>
|
|
);
|
|
items2[2] = (
|
|
<LegacyText style={styles.description}>
|
|
{intl.format((require(1244) /* metro dependency 1244: indexNative */).t['7chOVL'],
|
|
{discountPercentage: value9})}
|
|
</LegacyText>
|
|
);
|
|
const Button = (ButtonNativeModule).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 iapStoreAndroidBinding = IAPStoreAndroid;
|
|
const getProduct = iapStoreAndroidBinding.getProduct;
|
|
return [Reflect.apply(getProduct, iapStoreAndroidBinding, [productId]), iapStoreAndroidBinding.isBusy()];
|
|
}
|
|
|
|
function _fun93814() { // fn#93814, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12463:1330, offset: 0x020c4cde, size: 24 bytes, params: 1, frame: 9
|
|
if (env0_2) {
|
|
continueWithDefault();
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun93809, 12277, [57, 31, 27, 1949, 5140, 12270, 1880, 482, 33, 4501, 6597, 6235, 7027, 566, 1856, 4596,
|
|
12278, 1305, 1244, 3802, 4578,
|
|
2]) /* metro module 12277, dependencies: [57, 31, 27, 1949, 5140, 12270, 1880, 482, 33, 4501, 6597, 6235, 7027, 566, 1856, 4596, 12278, 1305, 1244, 3802, 4578, 2] */;
|