Files
discord-decomp/sources/modules/premium/native/gifting/PremiumGiftFeaturesCard.tsx
T
2026-07-28 01:06:53 +03:00

283 lines
17 KiB
TypeScript

/* Metro module 10389; source: modules/premium/native/gifting/PremiumGiftFeaturesCard.tsx; dependencies: [57, 31, 27, 7261, 1880, 482, 33, 697, 4501, 6597, 566, 7583, 10390, 7947, 10391, 7672, 10392, 5475, 7962, 10393, 7966, 7964, 4573, 1244, 7971, 4578, 2] */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
import TextStyles from '../../../rebrand/native/TextStyles.tsx'; /* Metro dependency 6597 */
import PromotionsStore from '../../promotions/PromotionsStore.tsx'; /* Metro dependency 7261 */
import NitroGiftPriceCopyExperiment from '../../gifting/experiments/NitroGiftPriceCopyExperiment.tsx'; /* Metro dependency 7672 */
import UsePremiumFeatures from '../../../user_settings/premium/native/utils/usePremiumFeatures.tsx'; /* Metro dependency 7947 */
import PremiumFeaturesBackground from '../../../user_settings/premium/native/PremiumFeaturesBackground.tsx'; /* Metro dependency 7962 */
import UsePremiumProductPricingString from '../hooks/usePremiumProductPricingString.tsx'; /* Metro dependency 10391 */
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 JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
import * as ConstantsModule from '../../../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
import * as FluxModule from '../../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as PremiumConstantsModule from '../../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 ButtonNativeModule from '../../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as MarketingComponentTypeModule from '../../../../external/discord_common/js/shared/shared-constants/MarketingComponentType.tsx'; /* Metro dependency 7583 */
function _fun80476(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#80476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10575:6, offset: 0x01e7c9a3, size: 684 bytes, params: 8, frame: 22
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactModule;
object = {};
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.default = {paddingVertical: PX_8};
const PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object.compact = {paddingVertical: PX_4};
object.smallCompact = {paddingVertical: 2};
object = {};
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.default = {marginTop: PX_24};
let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.compact = {marginTop: PX_12};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.smallCompact = {marginTop: PX_8};
object = {};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.default = {marginTop: PX_8};
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.compact = {marginTop: PX_12};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.smallCompact = {marginTop: PX_8};
object = {};
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.default = {marginTop: PX_24};
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.compact = {marginTop: PX_12};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object.smallCompact = {marginTop: PX_8};
const env0_17 = (CreateStylesModule).createStyles(_fun80477);
value = value.memo(PremiumGiftFeaturesCard);
(FileImportTrackerModule).fileFinishedImporting('modules/premium/native/gifting/PremiumGiftFeaturesCard.tsx');
exports.default = value;
function _fun80477() { // fn#80477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10575:788, offset: 0x01e7cc4f, size: 652 bytes, params: 1, frame: 18
const object = {};
const object2 = {overflow: 'hidden'};
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
object.promotional = object2;
const object3 = {justifyContent: 'flex-start'};
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
const BG_SURFACE_RAISED = (importDefault(697) /* metro dependency 697: native */).colors.BG_SURFACE_RAISED;
object3.backgroundColor = BG_SURFACE_RAISED;
const SHADOW_LOW = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_LOW;
copyDataProperties(object3, SHADOW_LOW, undefined);
object.card = object3;
const object4 = {};
const PX_40 = (importDefault(697) /* metro dependency 697: native */).space.PX_40;
object4.marginTop = PX_40;
let PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object4.marginStart = PX_24;
object.logo = object4;
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.promotionalLogo = {marginTop: PX_24};
const PX_32 = (importDefault(697) /* metro dependency 697: native */).space.PX_32;
object.promotionalLogoSingleLine = {marginTop: PX_32};
object.promotionalLogoSmallCompact = {marginTop: 18};
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.pricing = {maxWidth: 140, marginStart: PX_24};
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object.featureTitle = {marginStart: PX_24};
const object10 = {};
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object10.marginTop = PX_8;
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object10.marginHorizontal = PX_24;
object.features = object10;
const object11 = {};
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object11.marginHorizontal = PX_24;
PX_24 = (importDefault(697) /* metro dependency 697: native */).space.PX_24;
object11.marginBottom = PX_24;
object.button = object11;
const PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object.promotionalButton = {marginTop: PX_12};
object.featureIcon = {'width': 24, 'height': 24};
const object13 = {};
const defaultImport = TextStyles;
const PRIMARY_NORMAL = Fonts.PRIMARY_NORMAL;
const WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
copyDataProperties(object13, defaultImport(PRIMARY_NORMAL, WHITE, 16), undefined);
object13['marginStart'] = -8;
object.featureText = object13;
object.wumpusNoPrice = {'height': 75, 'right': 8};
object.promotionalCardImage = {'position': 'absolute', 'top': 0, 'left': 0, 'right': 0, 'bottom': 0};
object.promotionalBackground = {'position': 'absolute', 'height': 300, 'width': 150, 'right': 0};
return object;
}
function PremiumGiftFeaturesCard(a0) { // fn#80478, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10575:1839, offset: 0x01e7cedb, size: 1919 bytes, params: 2, frame: 46
var r11;
var text;
var r8;
var jsxRuntimeEnv0_11Binding;
var items5;
const Text = (TextModule).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
var items10;
const premiumType = a0.premiumType;
const onPress = a0.onPress;
const style = a0.style;
const claimableRewards = a0.claimableRewards;
let isSelected = a0.isSelected;
const value = undefined;
isSelected = isSelected === value || isSelected;
let variant = a0.variant;
variant = variant === value ? 'default' : variant;
let object = {'premiumType': 0, 'onPress': 0, 'style': 0, 'claimableRewards': 0, 'isSelected': 0, 'variant': 0};
silentSetPrototypeOf(object, null, undefined);
const value4 = copyDataProperties({}, a0, object, undefined);
const value6 = (FluxModule).useStateFromStores([PromotionsStore], _fun80479);
const value7 = (require(10390) /* metro dependency 10390: MarketingComponentHooks */).useThemeAndReducedMotionAwareAssetUrl(value6 == null ? value : value6.cardAsset);
const value8 = (require(10390) /* metro dependency 10390: MarketingComponentHooks */).useThemeAndReducedMotionAwareAssetUrl(value6 == null ? value : value6.backgroundAsset);
const styles = useStyles(claimableRewards != null && claimableRewards.length === 1);
const value11 = (UsePremiumFeatures)(premiumType);
const defaultImport = UsePremiumProductPricingString;
const MONTH = SubscriptionIntervalTypes.MONTH;
const value12 = defaultImport(premiumType, MONTH);
const defaultImport2 = defaultImport;
const YEAR = SubscriptionIntervalTypes.YEAR;
const value13 = defaultImport2(premiumType, YEAR);
const {showGiftPrice,
useNewCopy} = (NitroGiftPriceCopyExperiment).useConfig({location: 'PremiumGiftFeaturesCard'});
let r13 = (importDefault(10392) /* metro dependency 10392: useShouldShowGiftingPromotionDeco */)(premiumType) && claimableRewards != null && claimableRewards.length > 0;
const r21 = r13 && value7 != null;
const binding = env0_4;
const value20 = Module00057(binding.useState(0), 2);
const property = value20[0];
const value21 = 1;
const env0_0 = value20[value21];
const value22 = binding.useCallback(_fun80480, []);
const items2 = [styles.card, style];
items2[2] = r13 && styles.promotional;
const r5 = r21 && ((Component) => <Component style={styles.promotionalCardImage} resizeMode="cover" source={{uri: value7}} />)(importDefault(5475) /* metro dependency 5475: FastImage */);
const premiumFeaturesBackgroundProps = {premiumType: premiumType, opacity: r21 ? 0.82 : value21,
style: [styles.card, style, r13 && styles.promotional], ...value4};
if (r13) {
jsxRuntimeEnv0_11Binding = jsxRuntimeEnv0_11;
items5 = [
value6 != null && ((Component) => <Component giftPlanSelectionCardBannerComponent={value6} claimableRewards={claimableRewards} isSelected={isSelected} onLayout={value22} />)(importDefault(10393) /* metro dependency 10393: PremiumGiftPlanSelectPromotionalBanner */),
];
items5[1] = value8 != null && ((Component) => <Component style={[styles.promotionalBackground,
{top: property}]} resizeMode="cover" source={{uri: value8}} />)(importDefault(5475) /* metro dependency 5475: FastImage */);
r11 = (
<>
{items5}
</>
);
} else {
r11 = ((Component) => <Component premiumType={premiumType} style={!showGiftPrice && styles.wumpusNoPrice} />)(importDefault(7966) /* metro dependency 7966: PremiumFeaturesWumpus */);
}
object = [r11];
object[1] = ((Component) => <Component style={[styles.logo,
r13 && (value21 === claimableRewards.length ? styles.promotionalLogoSingleLine : styles.promotionalLogo),
r13 && variant === 'smallCompact' && styles.promotionalLogoSmallCompact]} premiumType={premiumType} />)(importDefault(7964) /* metro dependency 7964: PremiumFeaturesLogo */);
if (showGiftPrice) {
if (useNewCopy) {
var textProps = {'style': null, 'variant': 'text-sm/medium', 'color': 'always-white',
style: [styles.pricing,
env0_15[variant]]};
items10 = [value12, ' '];
items10[2] = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.lVQycU);
text = (
<Text {...textProps}>
{items10}
</Text>
);
} else {
text = (
<Text
style={[styles.pricing, env0_15[variant]]}
variant="text-sm/medium"
color="always-white"
>
{intl.format((require(1244) /* metro dependency 1244: indexNative */).t.Ob6fwp,
{monthlyPrice: value12,
yearlyPrice: value13})}
</Text>
);
}
r8 = text;
} else {
r8 = showGiftPrice;
}
object[2] = r8;
const items11 = [styles.featureTitle, env0_14[variant]];
const string = intl.string;
const JgsVht = (require(1244) /* metro dependency 1244: indexNative */).t.JgsVht;
object[3] = (
<Text
style={items11}
variant="heading-sm/bold"
color="always-white"
>
{Reflect.apply(string, intl, [JgsVht])}
</Text>
);
object[4] = ((Component) => <Component style={styles.features} features={value11} iconStyle={styles.featureIcon} labelStyle={styles.featureText} rowStyle={env0_13[variant]} />)(importDefault(7971) /* metro dependency 7971: PremiumFeatureList */);
object[5] = <View style={{flexGrow: value21}} />;
const items12 = [styles.button, env0_16[variant]];
r13 = r13 && styles.promotionalButton;
items12[2] = r13;
const Button = (ButtonNativeModule).Button;
const TIER_0 = PremiumTypes.TIER_0;
object[6] = (
<View style={items12}>
<Button
variant="experimental_premium-secondary"
text={premiumType === TIER_0 ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.rk4Uu8) : intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Ve9Ge6)}
onPress={onPress}
/>
</View>
);
return (
<View style={items2}>
{r5}
<PremiumFeaturesBackground {...premiumFeaturesBackgroundProps}>
{object}
</PremiumFeaturesBackground>
</View>
);
function _fun80479() { // fn#80479, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10575:2006, offset: 0x01e7d65a, size: 111 bytes, params: 1, frame: 13
var giftPlanSelectionCardBanner;
var properties;
let value = environment.__proto__;
const promotionsStoreBinding = PromotionsStore;
const getMarketingComponentByType = promotionsStoreBinding.getMarketingComponentByType;
const MarketingComponentType = (MarketingComponentTypeModule).MarketingComponentType;
const GIFT_PLAN_SELECTION_CARD_BANNER = MarketingComponentType.GIFT_PLAN_SELECTION_CARD_BANNER;
value = Reflect.apply(getMarketingComponentByType, promotionsStoreBinding, [GIFT_PLAN_SELECTION_CARD_BANNER]);
const value2 = null;
if (value2 == value) {
giftPlanSelectionCardBanner = value2;
} else {
properties = value.properties;
properties = properties.properties;
if (properties.oneofKind !== 'giftPlanSelectionCardBanner') {
giftPlanSelectionCardBanner = value2;
} else {
properties = value.properties;
properties = properties.properties;
giftPlanSelectionCardBanner = properties.giftPlanSelectionCardBanner;
}
}
return giftPlanSelectionCardBanner;
}
function _fun80480({nativeEvent}) { // fn#80480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10575:2698, offset: 0x01d08afa, size: 36 bytes, params: 2, frame: 11
env0_0(nativeEvent.layout.height);
}
}
}
global.__d(_fun80476, 10389, [57, 31, 27, 7261, 1880, 482, 33, 697, 4501, 6597, 566, 7583, 10390, 7947, 10391, 7672,
10392, 5475, 7962, 10393, 7966, 7964, 4573, 1244, 7971, 4578,
2]) /* metro module 10389, dependencies: [57, 31, 27, 7261, 1880, 482, 33, 697, 4501, 6597, 566, 7583, 10390, 7947, 10391, 7672, 10392, 5475, 7962, 10393, 7966, 7964, 4573, 1244, 7971, 4578, 2] */;