/* Metro module 10461; source: modules/premium/native/gifting/PremiumGiftPurchaseButton.tsx; dependencies: [31, 27, 7670, 5126, 1902, 1878, 7261, 661, 33, 4501, 697, 5463, 8483, 1901, 1305, 4573, 1244, 4589, 10462, 1484, 7669, 566, 7355, 7583, 7278, 10392, 7633, 7635, 7294, 10382, 8461, 10390, 5475, 8341, 9646, 10396, 6789, 6766, 1948, 4578, 4015, 2] */ import UserStore from '../../../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import UseSafeAreaInsetsKeyboardAwareNative from '../../../safe_area/useSafeAreaInsetsKeyboardAware.native.tsx'; /* Metro dependency 5463 */ import PromotionsStore from '../../promotions/PromotionsStore.tsx'; /* Metro dependency 7261 */ import BadgeDirectoryStore from '../../../badges/BadgeDirectoryStore.tsx'; /* Metro dependency 7670 */ import UseShouldShowGiftingPromotionDeco from '../../gifting/native/hooks/useShouldShowGiftingPromotionDeco.tsx'; /* Metro dependency 10392 */ 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 UseNavigationNativeModule from '../../../../design/components/Navigator/native/useNavigation.native.tsx'; /* Metro dependency 1484 */ import * as NameplateRecordModule from '../../../collectibles/records/NameplateRecord.tsx'; /* Metro dependency 1902 */ import * as ChatInputUtilsModule from '../../../../utils/native/ChatInputUtils.tsx'; /* Metro dependency 4015 */ 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 AvatarDecorationRecordModule from '../../../collectibles/records/AvatarDecorationRecord.tsx'; /* Metro dependency 5126 */ import * as Gift_customization_bannerModule from '../../../../external/discord_common/js/packages/protos/discord_protos/premium_marketing/v1/gift_customization_banner.tsx'; /* Metro dependency 7278 */ import * as IAPUtilsModule from '../../../../utils/native/IAPUtils.tsx'; /* Metro dependency 7355 */ import * as MarketingComponentTypeModule from '../../../../external/discord_common/js/shared/shared-constants/MarketingComponentType.tsx'; /* Metro dependency 7583 */ import * as GiftingBadgeExperimentModule from '../../gifting/experiments/GiftingBadgeExperiment.tsx'; /* Metro dependency 7633 */ import * as NativeGiftContextModule from '../../../payments/native/NativeGiftContext.tsx'; /* Metro dependency 7669 */ import * as IconButtonNativeModule from '../../../../design/components/Button/native/IconButton.native.tsx'; /* Metro dependency 8341 */ import * as UseFetchCollectiblesProductModule from '../../../collectibles/hooks/useFetchCollectiblesProduct.tsx'; /* Metro dependency 8461 */ import * as PremiumGiftModalModule from './PremiumGiftModal.tsx'; /* Metro dependency 10382 */ function _fun80964(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#80964, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10647:6, offset: 0x01e91df0, size: 350 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ReactNativeModule; const env0_4 = value.StyleSheet; const env0_5 = value.View; value = require(33) /* metro dependency 33 */; const env0_12 = value.jsx; const env0_13 = value.Fragment; const env0_14 = value.jsxs; const env0_15 = (CreateStylesModule).createStyles(_fun80966); (FileImportTrackerModule).fileFinishedImporting('modules/premium/native/gifting/PremiumGiftPurchaseButton.tsx'); exports.default = PremiumGiftPurchaseButton; function RewardPreview({collectiblesItem, currentUser, gradientColors, gradientAngle}) { // fn#80965, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10647:1685, offset: 0x01e91f4e, size: 791 bytes, params: 2, frame: 28 var r0; var isAvatarDecorationRecord2; var value2; var jsxRuntimeEnv0_13Binding; var items3; const Text = (TextModule).Text; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; var items2; var Avatar; const styles = useStyles((UseSafeAreaInsetsKeyboardAwareNative)().insets.bottom); if (isNameplateRecord(collectiblesItem)) { jsxRuntimeEnv0_13Binding = jsxRuntimeEnv0_13; items2 = [ {((Component) => )(importDefault(8483) /* metro dependency 8483: Nameplate */)} , ]; var viewBindingProps2 = {style: styles.singleAvatarContainer}; Avatar = (require(1305) /* metro dependency 1305: native */).Avatar; var avatarProps = {user: currentUser, guildId: undefined, size: (require(1305) /* metro dependency 1305: native */).AvatarSizes.SMALL}; avatarProps['aria-hidden'] = true; items2[1] = ( ); items2[2] = ( {intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Rh4oem)} ); r0 = ( <> {items2} ); } else { isAvatarDecorationRecord2 = isAvatarDecorationRecord(collectiblesItem); value2 = null; if (isAvatarDecorationRecord2) { jsxRuntimeEnv0_13Binding = jsxRuntimeEnv0_13; items3 = [ ((Component) => )(importDefault(4589) /* metro dependency 4589 */), ]; items3[1] = ( {((Component) => )(importDefault(10462) /* metro dependency 10462: GiftingRewardPreviewAvatar */)} ); items3[2] = ( {intl.string((require(1244) /* metro dependency 1244: indexNative */).t.Rh4oem)} ); r0 = ( <> {items3} ); } else { r0 = value2; } } return r0; } function _fun80966(a0) { // fn#80966, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10647:324, offset: 0x01e92265, size: 753 bytes, params: 2, frame: 21 const object = {}; const object2 = {}; const BACKGROUND_BASE_LOW = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOW; object2.backgroundColor = BACKGROUND_BASE_LOW; let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12; object2.paddingTop = PX_12; PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12; object2.paddingBottom = PX_12 + a0; let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16; object2.paddingHorizontal = PX_16; let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8; object2.gap = PX_8; const SHADOW_TOP_HIGH = (importDefault(697) /* metro dependency 697: native */).shadows.SHADOW_TOP_HIGH; copyDataProperties(object2, SHADOW_TOP_HIGH, undefined); object.container = object2; object.chooseRewardContainer = {'flexDirection': 'row', 'alignItems': 'center', 'height': 52}; const object3 = {}; copyDataProperties(object3, StyleSheet.absoluteFillObject, undefined); object3['borderRadius'] = (importDefault(697) /* metro dependency 697: native */).radii.sm; object3['overflow'] = 'hidden'; object.gradientBackdrop = object3; PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8; object.chooseRewardText = {flex: 1, marginStart: PX_8}; object.backgroundImage = {'position': 'absolute', 'top': 0, 'left': 0, 'right': 0, 'bottom': 0, 'opacity': 1}; PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8; object.inAppFlowImage = {'width': 58, 'height': 58, marginStart: PX_8}; object.inAppFlowImageLargeTilted = {'width': 86, 'height': 86, transform: [{rotate: '-4deg'}, {translateY: -11}]}; object.singleAvatarContainer = {'flexDirection': 'row', 'paddingRight': 15, 'justifyContent': 'center', 'alignItems': 'center', 'marginLeft': 5}; PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16; object.selectedRewardRow = {'flexDirection': 'row', 'alignItems': 'center', gap: PX_16}; object.selectedRewardBannerContainer = {'flex': 1, 'flexDirection': 'row', 'alignItems': 'center', 'height': 52}; const object9 = {}; copyDataProperties(object9, StyleSheet.absoluteFillObject, -11); object9['borderRadius'] = (importDefault(697) /* metro dependency 697: native */).radii.sm; let PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4; object9['top'] = PX_4; PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4; object9['bottom'] = PX_4; PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4; object9['start'] = PX_4; PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4; object9['end'] = PX_4; PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12; object9['marginStart'] = PX_12; object.selectedRewardBannerGradient = object9; object.selectedRewardText = {flex: 1}; const object10 = {'position': 'absolute', 'left': 0, 'right': 0, 'top': 0, 'bottom': 0, 'borderRadius': null, 'overflow': 'hidden'}; object10.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm; object.nameplateWrapper = object10; return object; } function PremiumGiftPurchaseButton({defaultSelection}) { // fn#80967, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:10647:2712, offset: 0x01e92556, size: 2182 bytes, params: 2, frame: 43 var r30; var r18; var r7; var String; var BACKGROUND_BRAND; var items2; const IconButton = (IconButtonNativeModule).IconButton; var items3; var items4; var TextWithIOSLinkWorkaround; var format; var hYoGUM; var defaultImport5; const styles = useStyles((UseSafeAreaInsetsKeyboardAwareNative)().insets.bottom); const env0_1 = (UseNavigationNativeModule).useNavigation(); const value3 = (NativeGiftContextModule).useNativeGiftContext(); const env0_2 = value3.onPurchase; const isPurchasing = value3.isPurchasing; const productId = value3.productId; const allRewards = value3.allRewards; const claimableRewards = value3.claimableRewards; const selectedGiftingPromotionReward = value3.selectedGiftingPromotionReward; const setSelectedGiftingPromotionReward = value3.setSelectedGiftingPromotionReward; const env0_7 = value3.setCurrentAnalyticsStep; const useStateFromStores = FluxModule.useStateFromStores; let items5 = [UserStore]; const currentUser = Reflect.apply(useStateFromStores, FluxModule, [items5, function() { return UserStore.getCurrentUser(); }]); const value4 = (IAPUtilsModule).useCanPurchaseIAP(productId); const value5 = FluxModule.useStateFromStores([PromotionsStore], _fun80969); const assetVariant = value5?.assetVariant; const GiftCustomizationBanner_AssetVariant = (Gift_customization_bannerModule).GiftCustomizationBanner_AssetVariant; const LARGE_TILTED = GiftCustomizationBanner_AssetVariant.LARGE_TILTED; const value7 = assetVariant === LARGE_TILTED; const r14 = claimableRewards != null && claimableRewards.length > 0; const r19 = claimableRewards != null && claimableRewards.length === 1; const value12 = (UseShouldShowGiftingPromotionDeco)(); let r6 = value12 && selectedGiftingPromotionReward == null; const GiftingBadgeExperiment = (GiftingBadgeExperimentModule).GiftingBadgeExperiment; const useConfig = GiftingBadgeExperiment.useConfig; const enabled = Reflect.apply(useConfig, GiftingBadgeExperiment, [{location: 'PremiumGiftPurchaseButton'}]).enabled; const {nextTier, giftsToNextTier} = FluxModule.useStateFromStoresObject([BadgeDirectoryStore], function() { var object = {}; var badgeDirectoryStoreBinding = BadgeDirectoryStore; object.nextTier = badgeDirectoryStoreBinding.getNextTier(require(dependencyMap[27]).BadgeId.GIFTING); object.giftsToNextTier = badgeDirectoryStoreBinding.getRemainingToNextTier(require(dependencyMap[27]).BadgeId.GIFTING); return object; }); allRewards.useEffect(_fun80973, [r19, claimableRewards, setSelectedGiftingPromotionReward]); let colors = value5 == null || value5.gradient == null ? undefined : value5.gradient.colors; const r26 = colors ?? []; if (r26.length > 0) { r30 = r26; } else { String = global.String; colors = (importDefault(697) /* metro dependency 697: native */).colors; BACKGROUND_BRAND = colors.BACKGROUND_BRAND; items5 = [String(BACKGROUND_BRAND)]; String = global.String; colors = (importDefault(697) /* metro dependency 697: native */).colors; BACKGROUND_BRAND = colors.BACKGROUND_BRAND; items5[1] = String(BACKGROUND_BRAND); r30 = items5; } const useFetchCollectiblesProduct = UseFetchCollectiblesProductModule.useFetchCollectiblesProduct; const product = Reflect.apply(useFetchCollectiblesProduct, UseFetchCollectiblesProductModule, [selectedGiftingPromotionReward]).product; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; const string = intl.string; const t = (require(1244) /* metro dependency 1244: indexNative */).t; const r11 = r6 ? Reflect.apply(string, intl, [t['gNZY/B']]) : Reflect.apply(string, intl, [t.ouo4FK]); const r12 = r6 ? 'primary' : 'active'; const value20 = (require(10390) /* metro dependency 10390: MarketingComponentHooks */).useThemeAndReducedMotionAwareAssetUrl(value5?.mobileBackgroundAsset); const value21 = (require(10390) /* metro dependency 10390: MarketingComponentHooks */).useThemeAndReducedMotionAwareAssetUrl(value5?.asset); const r32 = product == null ? undefined : product.items[0]; if (r6) { if (r14) { var viewBinding4Props = {style: styles.chooseRewardContainer}; var viewBinding5Props = {style: styles.gradientBackdrop, pointerEvents: 'none'}; items3 = [ ((Component) => )(importDefault(4589) /* metro dependency 4589 */), ]; items3[1] = value20 != null && ((Component) => )(importDefault(5475) /* metro dependency 5475: FastImage */); items4 = [ {items3} , ]; items4[1] = value21 != null && ((Component) => )(importDefault(5475) /* metro dependency 5475: FastImage */); items4[2] = ((Text) => {intl.string((require(1244) /* metro dependency 1244: indexNative */).t.cMiNit)})((require(4573) /* metro dependency 4573: Text */).Text); r7 = ( {items4} ); } else if (r32 == null) { r7 = ( enabled && nextTier != null ? ((Component) => )(importDefault(10396) /* metro dependency 10396: GiftingBadgeProgressBanner */) : null ); } else if (value12) { if (selectedGiftingPromotionReward != null) { var viewBinding2Props = {style: styles.selectedRewardRow}; items2 = [ , ]; if (r19) { r18 = !r19; } else { r18 = ( )((require(9646) /* metro dependency 9646: PencilIcon */).PencilIcon)} accessibilityLabel={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.bt75uw)} onPress={function() { navigateToRewardSelection(selectedGiftingPromotionReward); }} /> ); } items2[1] = r18; r7 = ( {items2} ); } else { r7 = ( enabled && nextTier != null ? ((Component) => )(importDefault(10396) /* metro dependency 10396: GiftingBadgeProgressBanner */) : null ); } } else { r7 = ( enabled && nextTier != null ? ((Component) => )(importDefault(10396) /* metro dependency 10396: GiftingBadgeProgressBanner */) : null ); } } else if (r32 == null) { r7 = ( enabled && nextTier != null ? ((Component) => )(importDefault(10396) /* metro dependency 10396: GiftingBadgeProgressBanner */) : null ); } else if (value12) { if (selectedGiftingPromotionReward != null) { var viewBinding2Props = {style: styles.selectedRewardRow}; items2 = [ , ]; if (r19) { r18 = !r19; } else { r18 = ( )((require(9646) /* metro dependency 9646: PencilIcon */).PencilIcon)} accessibilityLabel={intl.string((require(1244) /* metro dependency 1244: indexNative */).t.bt75uw)} onPress={onPress_80974} /> ); } items2[1] = r18; r7 = ( {items2} ); } else { r7 = ( enabled && nextTier != null ? ((Component) => )(importDefault(10396) /* metro dependency 10396: GiftingBadgeProgressBanner */) : null ); } } else { r7 = ( enabled && nextTier != null ? ((Component) => )(importDefault(10396) /* metro dependency 10396: GiftingBadgeProgressBanner */) : null ); } if (r6) { r6 = !r6; } else { TextWithIOSLinkWorkaround = (require(6766) /* metro dependency 6766: TextWithIOSLinkWorkaround */).TextWithIOSLinkWorkaround; format = intl.format; hYoGUM = (require(1244) /* metro dependency 1244: indexNative */).t.hYoGUM; defaultImport5 = importDefault(1948) /* metro dependency 1948: HelpdeskUtils */; r6 = ( {Reflect.apply(format, intl, [hYoGUM, {paidURL: defaultImport5.getArticleURL(HelpdeskArticles.PAID_TERMS)}])} ); } const Button = (ButtonNativeModule).Button; return ( {r7} {r6}