Files
discord-decomp/sources/components_native/premium/PremiumSubscriptionPricingUpsell.tsx
T
2026-07-27 16:20:00 +03:00

337 lines
18 KiB
TypeScript

/* Metro module 12264; source: components_native/premium/PremiumSubscriptionPricingUpsell.tsx; dependencies: [57, 31, 27, 1949, 1878, 3807, 3808, 5140, 661, 1880, 33, 4501, 566, 3802, 7563, 694, 7037, 5143, 4573, 477, 5138, 5137, 1244, 1856, 2] */
function _fun93722(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#93722, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12450:6, offset: 0x020c0645, size: 476 bytes, params: 8, frame: 20
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 */;
const env0_5 = (require(27) /* metro dependency 27 */).View;
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const subscriptionPlanStore = importDefault(3807) /* metro dependency 3807: SubscriptionPlanStore */;
const subscriptionStore = importDefault(3808) /* metro dependency 3808: SubscriptionStore */;
const iapStoreAndroid = importDefault(5140) /* metro dependency 5140: IAPStoreAndroid */;
const env0_11 = (require(661) /* metro dependency 661: Constants */).CurrencyCodes;
let value = require(1880) /* metro dependency 1880: PremiumConstants */;
const env0_12 = value.SubscriptionPlans;
const env0_13 = value.SubscriptionPlanInfo;
const env0_14 = value.PremiumTypes;
const env0_15 = value.SubscriptionIntervalTypes;
const env0_16 = value.NUM_FREE_GUILD_BOOSTS_WITH_PREMIUM;
const env0_17 = value.GUILD_BOOST_COST_FOR_PREMIUM_USER_DISCOUNT_PERCENT;
value = require(33) /* metro dependency 33 */;
const env0_18 = value.jsx;
const env0_19 = value.Fragment;
const env0_20 = value.jsxs;
const env0_21 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({title: {marginTop: 16},
pricingSection: {alignItems: 'center'}, originalPrice: {textDecorationLine: 'line-through'},
cardText: {'lineHeight': 20, 'marginTop': 8, 'textAlign': 'center'}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('components_native/premium/PremiumSubscriptionPricingUpsell.tsx');
exports.default = PremiumSubscriptionPricingUpsell;
}
function PricingSubheadingCopy() { // fn#93723, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12450:635, offset: 0x020c0821, size: 1807 bytes, params: 1, frame: 33
var r19;
var price;
var price2;
var r10;
var price3;
var r1;
var r14;
var r16;
var r17;
var value10;
var moduleValue8;
var moduleValue10;
var value16;
var moduleValue11;
var formatRate;
var moduleValue12;
var moduleValue13;
var moduleValue14;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var format;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
var text;
var defaultImport2;
var defaultImport3;
var defaultImport4;
var jsxRuntimeEnv0_19Binding;
var XVMAKU;
var moduleValue15;
var object2;
var moduleValue16;
var value;
const value2 = undefined;
const styles = useStyles();
const fluxModule = require(566) /* metro dependency 566: flux */;
const useStateFromStores = fluxModule.useStateFromStores;
let object = [UserStore];
const currentUser = Reflect.apply(useStateFromStores, fluxModule, [object, function() {
return UserStore.getCurrentUser();
}]);
const hasBoostDiscount2 = (importDefault(3802) /* metro dependency 3802: PremiumUtils */).hasBoostDiscount(currentUser);
const locale = fluxModule.useStateFromStores([LocaleStore], function() {
return LocaleStore.locale;
});
const value3 = (require(7563) /* metro dependency 7563: useSubscriptionPlansLoaded */).useSubscriptionPlansLoaded();
const env0_1 = fluxModule.useStateFromStores([SubscriptionStore], function() {
return SubscriptionStore.getPremiumTypeSubscription();
});
const value4 = fluxModule.useStateFromStores([SubscriptionPlanStore], _fun93727);
env0_4.useEffect(_fun93728, []);
const moduleValue6 = fluxModule;
const useStateFromStoresArray = moduleValue6.useStateFromStoresArray;
const value6 = env0_3(Reflect.apply(useStateFromStoresArray, moduleValue6, [[IAPStoreAndroid], _fun93730]), 5);
const value7 = 0;
let property = value6[value7];
const property2 = value6[1];
const property3 = value6[2];
const property4 = value6[3];
const property5 = value6[4];
const value8 = null;
const {interval,
intervalCount} = value8 != value4 ? value4 : SubscriptionPlanInfo[SubscriptionPlans.PREMIUM_MONTH_GUILD];
if (value3) {
if (IAPStoreAndroid.isReady()) {
if (value8 == property) {
return (
<Text style={styles.cardText} variant="text-md/medium">
{'...'}
</Text>
);
}
r19 = value8 == property ? value2 : property.currencyCode.toLowerCase();
price = value8 == property ? value2 : property.price;
if (interval === SubscriptionIntervalTypes.YEAR) {
r1 = value8 != property5 && value8 != property4 ? property5.price - property4.price : value8;
r14 = r1;
r16 = r1;
} else if (hasBoostDiscount2) {
if (value8 == price) {
r14 = price;
r16 = price;
} else {
price2 = value8 == property3 ? value2 : property3.price;
r10 = value8 != price2 ? price2 : value7;
price3 = value8 == property2 ? value2 : property2.price;
value10 = r10 - (value8 != price3 ? price3 : value7);
r14 = price;
r16 = value10;
}
} else {
r14 = price;
r16 = price;
}
r1 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid() && value8 != r16;
if (r1) {
moduleValue8 = require(5138) /* metro dependency 5138: PriceUtils */;
r10 = moduleValue8.convertToMajorCurrencyUnits(r16, CurrencyCodes.USD);
} else {
r10 = r16;
}
if ((require(477) /* metro dependency 477: PlatformUtils */).isAndroid() && value8 != r14) {
moduleValue10 = require(5138) /* metro dependency 5138: PriceUtils */;
r1 = moduleValue10.convertToMajorCurrencyUnits(r14, CurrencyCodes.USD);
} else {
r1 = r14;
}
value16 = '...';
if (value8 != r10) {
moduleValue11 = require(5137) /* metro dependency 5137: PriceUtils */;
formatRate = moduleValue11.formatRate;
moduleValue12 = require(5137) /* metro dependency 5137: PriceUtils */;
r17 = Reflect.apply(formatRate, moduleValue11, [moduleValue12.formatPrice(r10, r19,
{convertToMajorUnits: false}),
interval, intervalCount]);
} else {
r17 = value16;
}
if (value8 != r1) {
moduleValue13 = require(5137) /* metro dependency 5137: PriceUtils */;
formatRate = moduleValue13.formatRate;
moduleValue14 = require(5137) /* metro dependency 5137: PriceUtils */;
r16 = Reflect.apply(formatRate, moduleValue13, [moduleValue14.formatPrice(r1, r19,
{convertToMajorUnits: false}),
interval, intervalCount]);
} else {
r16 = value16;
}
if (r10 !== r1) {
object = {};
object.style = styles.cardText;
object.accessibilityLabel = intl.formatToPlainString(t.lEIwDw, {price: r17, originalPrice: r16});
object.variant = 'text-md/medium';
object.children = intl.format(t.eRSsbf, {price: r17, originalPrice: r16,
originalPriceHook: originalPriceHook});
r1 = object;
} else {
object = {};
object.style = styles.cardText;
object.variant = 'text-md/medium';
object.children = intl.format((require(1244) /* metro dependency 1244: indexNative */).t.Mmf63F,
{price: r17});
r1 = object;
}
text = <Text {...r1} />;
defaultImport2 = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
if (defaultImport2.hasFreeBoosts(currentUser)) {
if (hasBoostDiscount2) {
defaultImport3 = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
if (defaultImport3.isPremium(currentUser, PremiumTypes.TIER_2)) {
jsxRuntimeEnv0_19Binding = jsxRuntimeEnv0_19;
var textProps = {style: styles.cardText, variant: 'text-md/medium'};
format = intl.format;
property = (require(1244) /* metro dependency 1244: indexNative */).t['ZikTt+'];
object2 = {};
object2.freeSubscriptionCount = NUM_FREE_GUILD_BOOSTS_WITH_PREMIUM;
moduleValue16 = require(1856) /* metro dependency 1856: NumberUtils */;
object2.discountPercent = moduleValue16.formatPercent(locale,
GUILD_BOOST_COST_FOR_PREMIUM_USER_DISCOUNT_PERCENT / 100);
value = <Text {...textProps}>{Reflect.apply(format, intl, [property, object2])}</Text>;
value = <>{value}{text}</>;
r1 = value;
} else if (hasBoostDiscount2) {
defaultImport4 = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
if (defaultImport4.isPremium(currentUser, PremiumTypes.TIER_1)) {
jsxRuntimeEnv0_19Binding = jsxRuntimeEnv0_19;
var textProps = {style: styles.cardText, variant: 'text-md/medium'};
format = intl.format;
XVMAKU = (require(1244) /* metro dependency 1244: indexNative */).t.XVMAKU;
moduleValue15 = require(1856) /* metro dependency 1856: NumberUtils */;
value = <Text {...textProps}>{Reflect.apply(format, intl, [XVMAKU,
{discountPercent: moduleValue15.formatPercent(locale,
GUILD_BOOST_COST_FOR_PREMIUM_USER_DISCOUNT_PERCENT / 100)}])}</Text>;
value = <>{value}{text}</>;
r1 = value;
} else {
r1 = text;
}
} else {
r1 = text;
}
} else if (hasBoostDiscount2) {
defaultImport4 = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
if (defaultImport4.isPremium(currentUser, PremiumTypes.TIER_1)) {
jsxRuntimeEnv0_19Binding = jsxRuntimeEnv0_19;
var textProps = {style: styles.cardText, variant: 'text-md/medium'};
format = intl.format;
XVMAKU = (require(1244) /* metro dependency 1244: indexNative */).t.XVMAKU;
moduleValue15 = require(1856) /* metro dependency 1856: NumberUtils */;
value = <Text {...textProps}>{Reflect.apply(format, intl, [XVMAKU,
{discountPercent: moduleValue15.formatPercent(locale,
GUILD_BOOST_COST_FOR_PREMIUM_USER_DISCOUNT_PERCENT / 100)}])}</Text>;
value = <>{value}{text}</>;
r1 = value;
} else {
r1 = text;
}
} else {
r1 = text;
}
} else if (hasBoostDiscount2) {
defaultImport4 = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
if (defaultImport4.isPremium(currentUser, PremiumTypes.TIER_1)) {
jsxRuntimeEnv0_19Binding = jsxRuntimeEnv0_19;
var textProps = {style: styles.cardText, variant: 'text-md/medium'};
format = intl.format;
XVMAKU = (require(1244) /* metro dependency 1244: indexNative */).t.XVMAKU;
moduleValue15 = require(1856) /* metro dependency 1856: NumberUtils */;
value = <Text {...textProps}>{Reflect.apply(format, intl, [XVMAKU,
{discountPercent: moduleValue15.formatPercent(locale,
GUILD_BOOST_COST_FOR_PREMIUM_USER_DISCOUNT_PERCENT / 100)}])}</Text>;
value = <>{value}{text}</>;
r1 = value;
} else {
r1 = text;
}
} else {
r1 = text;
}
return r1;
}
}
return (
<Text style={styles.cardText} variant="text-md/medium">
{'...'}
</Text>
);
}
function PremiumSubscriptionPricingUpsell() { // fn#93732, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12450:3246, offset: 0x020c1108, size: 213 bytes, params: 1, frame: 23
const styles = useStyles();
const value2 = (require(7563) /* metro dependency 7563: useSubscriptionPlansLoaded */).useSubscriptionPlansLoaded();
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
return (
<View style={styles.pricingSection}>
<Text
style={styles.title}
accessibilityRole="header"
variant="heading-lg/semibold"
color="mobile-text-heading-primary"
>
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t['3x1PFE'])}
</Text>
{value2 ? <PricingSubheadingCopy /> : null}
</View>
);
}
function _fun93727() { // fn#93727, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12450:966, offset: 0x020c0f30, size: 47 bytes, params: 1, frame: 12
return premiumTypeSubscription != null ? SubscriptionPlanStore.get(premiumTypeSubscription.planId) : undefined;
}
function _fun93728() { // fn#93728, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12450:1016, offset: 0x020c0f5f, size: 66 bytes, params: 1, frame: 11
var environment;
const value = environment.__proto__;
if (!IAPStoreAndroid.isReady()) {
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun93729);
}
}
function _fun93730() { // fn#93730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12450:1129, offset: 0x020c0fc6, size: 222 bytes, params: 1, frame: 17
let getProduct = IAPStoreAndroid.getProduct;
const ProductIds = (require(5143) /* metro dependency 5143: ProductIdsAndroid */).ProductIds;
const PREMIUM_GUILD_1_MONTHLY = ProductIds.PREMIUM_GUILD_1_MONTHLY;
const items2 = [Reflect.apply(getProduct, IAPStoreAndroid, [PREMIUM_GUILD_1_MONTHLY])];
getProduct = IAPStoreAndroid.getProduct;
const PREMIUM_TIER_2_MONTHLY = ProductIds.PREMIUM_TIER_2_MONTHLY;
items2[1] = Reflect.apply(getProduct, IAPStoreAndroid, [PREMIUM_TIER_2_MONTHLY]);
getProduct = IAPStoreAndroid.getProduct;
const PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY = ProductIds.PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY;
items2[2] = Reflect.apply(getProduct, IAPStoreAndroid, [PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY]);
getProduct = IAPStoreAndroid.getProduct;
const PREMIUM_TIER_2_YEARLY = ProductIds.PREMIUM_TIER_2_YEARLY;
items2[3] = Reflect.apply(getProduct, IAPStoreAndroid, [PREMIUM_TIER_2_YEARLY]);
getProduct = IAPStoreAndroid.getProduct;
const PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY = ProductIds.PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY;
items2[4] = Reflect.apply(getProduct, IAPStoreAndroid, [PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY]);
return items2;
}
function originalPriceHook(a0, a1) { // fn#93731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12450:2526, owner: PricingSubheadingCopy.originalPriceHook, offset: 0x020c10a4, size: 100 bytes, params: 3, frame: 16
if (env0_2 === env0_3) {
return null;
} else {
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
<Text
style={styles.originalPrice}
variant="text-sm/medium"
color="text-muted"
key={a1}
>
{a0}
</Text>
);
}
}
function _fun93729() { // fn#93729, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12450:1049, offset: 0x020c0fa1, size: 37 bytes, params: 1, frame: 11
const value = environment.__proto__.__proto__;
return (importDefault(7037) /* metro dependency 7037: BillingActionCreators */).loadProducts();
}