// Metro module 9787 (f9788). import { useCallback } from "react"; import { View } from "react-native"; import SKUStore from "../../../../stores/game_store/SKUStore"; import { SubscriptionIntervalTypes } from "../../PremiumConstants"; import { AnalyticsSections } from "../../../../Constants"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import Module712 from "../../../../_bundle/Module712"; import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext"; import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native"; import { GiftingBadgeExperiment } from "../../gifting/experiments/GiftingBadgeExperiment"; import { getGiftCodeURL, trackGiftCodeCopy } from "../../../../utils/GiftCodeUtils"; import { PremiumGiftScreens } from "./PremiumGiftModal"; import { showShareActionSheet } from "../../../action_sheet/native/showShareActionSheet"; import { Button } from "../../../../design/components/Button/native/Button.native"; import { intl, t } from "../../../../intl/index.native"; import PremiumUtils, { getPlanIdForPremiumType } from "../../../../utils/PremiumUtils"; import { copy } from "../../../../utils/ClipboardUtils.native"; import { presentCopiedToClipboard } from "../../../toast/native/ToastUtils"; import PremiumGiftBackgroundAnimation_android from "./PremiumGiftBackgroundAnimation.android"; import { Text } from "../../../../design/components/Text/native/Text"; import { InputButton } from "../../../../design/components/experimental/native"; import Module4138 from "../../../../_bundle/Module4138"; const useStyles = createStyles({ disclaimer: { marginTop: Module712.space.PX_4, marginBottom: Module712.space.PX_16 }, title: { marginTop: Module712.space.PX_24, textAlign: "center" }, description: { marginTop: Module712.space.PX_8, textAlign: "center" }, input: { marginTop: Module712.space.PX_24 }, inputLabel: { marginBottom: Module712.space.PX_4 } }); export default function PremiumGiftSuccessBody(props) { const giftCodeRecord = props.giftCodeRecord; const styles = useStyles(); const nativeGiftContext = useNativeGiftContext(); const { premiumType, planInterval } = nativeGiftContext; let giftStyle = nativeGiftContext.giftStyle; const giftCodeURL = getGiftCodeURL(giftCodeRecord.code); if (giftCodeRecord.giftStyle != null) { giftStyle = giftCodeRecord.giftStyle; } const r33 = giftCodeRecord.subscriptionPlanId != null ? giftCodeRecord.subscriptionPlanId : getPlanIdForPremiumType(premiumType, planInterval); const tierDisplayNameByPlanId = PremiumUtils.getTierDisplayNameByPlanId(r33); const intervalType = PremiumUtils.getInterval(r33).intervalType; const YEAR = SubscriptionIntervalTypes.YEAR; const callback = useCallback(() => { const r7 = SKUStore.get(giftCodeRecord.skuId); if (r7 != null) { trackGiftCodeCopy(giftCodeRecord, r7); } copy(giftCodeURL); presentCopiedToClipboard(); }, [giftCodeRecord, giftCodeURL]); return <> {[ , {intl.string(t["/s1xR7"])} , {intl.format(intervalType === YEAR ? t.rli5ey : t.bUdTqI, { intervalCount: 1, name: tierDisplayNameByPlanId })} , {intl.string(t["qS+yMo"])} , {intl.string(t.As9eLl)} ]} ; }; export function PremiumGiftSuccessActions(props) { const giftCodeRecord2 = props.giftCodeRecord; const nativeGiftContext = useNativeGiftContext(); const { onClose, prePurchaseGiftingBadgeProgress } = nativeGiftContext; const navigation = useNavigation(); const enabled = GiftingBadgeExperiment.useConfig({ location: "PremiumGiftSuccessActions" }).enabled; const giftCodeURL2 = getGiftCodeURL(giftCodeRecord2.code); const callback = useCallback(() => { if (enabled && prePurchaseGiftingBadgeProgress != null) { navigation.navigate(PremiumGiftScreens.GIFTING_BADGE, { currentProgress: prePurchaseGiftingBadgeProgress }); } else { onClose(); } }, [enabled, prePurchaseGiftingBadgeProgress, navigation, onClose]); const callback2 = useCallback(() => { showShareActionSheet({ url: giftCodeURL2 }, AnalyticsSections.PREMIUM_GIFT_SUCCESS_MODAL); let r14 = enabled; if (enabled) { r14 = prePurchaseGiftingBadgeProgress != null; } if (r14) { navigation.navigate(PremiumGiftScreens.GIFTING_BADGE, { currentProgress: prePurchaseGiftingBadgeProgress }); } }, [giftCodeURL2, enabled, prePurchaseGiftingBadgeProgress, navigation]); return <>