395 lines
22 KiB
TypeScript
395 lines
22 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] */
|
|
import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import LocaleStore from '../../modules/user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
|
|
import SubscriptionPlanStore from '../../stores/billing/SubscriptionPlanStore.tsx'; /* Metro dependency 3807 */
|
|
import SubscriptionStore from '../../stores/billing/SubscriptionStore.tsx'; /* Metro dependency 3808 */
|
|
import IAPStoreAndroid from '../../stores/native/IAPStore.android.tsx'; /* Metro dependency 5140 */
|
|
import BillingActionCreators from '../../actions/native/BillingActionCreators.tsx'; /* Metro dependency 7037 */
|
|
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 FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as PremiumConstantsModule from '../../modules/premium/PremiumConstants.tsx'; /* Metro dependency 1880 */
|
|
import * as CreateStylesModule from '../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as TextModule from '../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as ProductIdsAndroidModule from '../../modules/premium/native/ProductIds.android.tsx'; /* Metro dependency 5143 */
|
|
import * as UseSubscriptionPlansLoadedModule from '../../modules/billing/hooks/useSubscriptionPlansLoaded.tsx'; /* Metro dependency 7563 */
|
|
|
|
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});
|
|
let value = PremiumConstantsModule;
|
|
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 = (CreateStylesModule).createStyles({title: {marginTop: 16},
|
|
pricingSection: {alignItems: 'center'}, originalPrice: {textDecorationLine: 'line-through'},
|
|
cardText: {'lineHeight': 20, 'marginTop': 8, 'textAlign': 'center'}});
|
|
(FileImportTrackerModule).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 = (TextModule).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 object3;
|
|
var moduleValue16;
|
|
var value;
|
|
const value2 = undefined;
|
|
const styles = useStyles();
|
|
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 = (UseSubscriptionPlansLoadedModule).useSubscriptionPlansLoaded();
|
|
const env0_1 = FluxModule.useStateFromStores([SubscriptionStore], function() {
|
|
return SubscriptionStore.getPremiumTypeSubscription();
|
|
});
|
|
const value4 = FluxModule.useStateFromStores([SubscriptionPlanStore], _fun93727);
|
|
ReactModule.useEffect(_fun93728, []);
|
|
const useStateFromStoresArray = FluxModule.useStateFromStoresArray;
|
|
const value6 = Module00057(Reflect.apply(useStateFromStoresArray, FluxModule, [[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) {
|
|
iapStoreAndroidBinding = IAPStoreAndroid;
|
|
if (iapStoreAndroidBinding.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+'];
|
|
object3 = {};
|
|
object3.freeSubscriptionCount = NUM_FREE_GUILD_BOOSTS_WITH_PREMIUM;
|
|
moduleValue16 = require(1856) /* metro dependency 1856: NumberUtils */;
|
|
object3.discountPercent = moduleValue16.formatPercent(locale,
|
|
GUILD_BOOST_COST_FOR_PREMIUM_USER_DISCOUNT_PERCENT / 100);
|
|
value = (
|
|
<Text {...textProps}>
|
|
{Reflect.apply(format, intl, [property, object3])}
|
|
</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 _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__;
|
|
const iapStoreAndroidBinding = IAPStoreAndroid;
|
|
if (!iapStoreAndroidBinding.isReady()) {
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).wait(_fun93729);
|
|
}
|
|
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 (BillingActionCreators).loadProducts();
|
|
}
|
|
|
|
}
|
|
|
|
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 iapStoreAndroidBinding = IAPStoreAndroid;
|
|
let getProduct = iapStoreAndroidBinding.getProduct;
|
|
const ProductIds = (ProductIdsAndroidModule).ProductIds;
|
|
const PREMIUM_GUILD_1_MONTHLY = ProductIds.PREMIUM_GUILD_1_MONTHLY;
|
|
const items2 = [Reflect.apply(getProduct, iapStoreAndroidBinding, [PREMIUM_GUILD_1_MONTHLY])];
|
|
iapStoreAndroidBinding = IAPStoreAndroid;
|
|
getProduct = iapStoreAndroidBinding.getProduct;
|
|
const PREMIUM_TIER_2_MONTHLY = ProductIds.PREMIUM_TIER_2_MONTHLY;
|
|
items2[1] = Reflect.apply(getProduct, iapStoreAndroidBinding, [PREMIUM_TIER_2_MONTHLY]);
|
|
iapStoreAndroidBinding = IAPStoreAndroid;
|
|
getProduct = iapStoreAndroidBinding.getProduct;
|
|
const PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY = ProductIds.PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY;
|
|
items2[2] = Reflect.apply(getProduct, iapStoreAndroidBinding, [PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY]);
|
|
iapStoreAndroidBinding = IAPStoreAndroid;
|
|
getProduct = iapStoreAndroidBinding.getProduct;
|
|
const PREMIUM_TIER_2_YEARLY = ProductIds.PREMIUM_TIER_2_YEARLY;
|
|
items2[3] = Reflect.apply(getProduct, iapStoreAndroidBinding, [PREMIUM_TIER_2_YEARLY]);
|
|
iapStoreAndroidBinding = IAPStoreAndroid;
|
|
getProduct = iapStoreAndroidBinding.getProduct;
|
|
const PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY = ProductIds.PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY;
|
|
items2[4] = Reflect.apply(getProduct, iapStoreAndroidBinding, [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 === Module00057) {
|
|
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 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 = (UseSubscriptionPlansLoadedModule).useSubscriptionPlansLoaded();
|
|
const Text = (TextModule).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>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun93722, 12264, [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]) /* metro module 12264, 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] */;
|