Files
discord-decomp/modules/premium/native/gifting/PremiumGiftSuccess.tsx
T
2026-11-01 12:12:55 +02:00

65 lines
3.6 KiB
TypeScript

// Metro module 9785 (f9786).
import { useEffect } from "react";
import { View } from "react-native";
import PromotionsStore from "../../promotions/PromotionsStore";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
import Module38 from "../../../../_bundle/Module38";
import useGiftingPromotionConfig from "../../gifting/hooks/useGiftingPromotionConfig";
import useShouldShowGiftingPromotionDeco from "../../gifting/native/hooks/useShouldShowGiftingPromotionDeco";
import { useGetOrFetchPurchase } from "../../../collectibles/hooks/useFetchCollectiblesCategoriesAndPurchases";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { markSnowflakeBoundDismissibleContentAsDismissed } from "../../../dismissible_content/DismissibleContentUtils";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import PremiumGiftPurchaseSuccess, { PremiumGiftSuccessActions } from "./PremiumGiftPurchaseSuccess";
import PremiumGiftDMPurchaseSuccess, { PremiumGiftDMSuccessActions } from "./PremiumGiftDMPurchaseSuccess";
import PremiumGiftingPromotionSuccessActions from "./PremiumGiftingPromotionSuccessActions";
const useStyles = createStyles((a0) => ({
bodyContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
paddingHorizontal: Module712.space.PX_16,
flex: 1,
alignContent: "center",
justifyContent: "center",
flexGrow: 1
},
actionContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
paddingTop: Module712.space.PX_16,
paddingBottom: a0 + Module712.space.PX_16,
paddingHorizontal: Module712.space.PX_16,
gap: Module712.space.PX_8,
...Module712.shadows.SHADOW_TOP_LOW
}
}));
export default function PremiumGiftSuccess() {
const styles = useStyles(useSafeAreaInsets_native().bottom);
const nativeGiftContext = useNativeGiftContext();
const { recipientUser, giftCodeRecord, selectedGiftingPromotionReward } = nativeGiftContext;
Module38(giftCodeRecord != null, "Gift code record cannot be null on success screen");
const giftingPromotionConfig = useGiftingPromotionConfig();
let c17488_0 = giftingPromotionConfig;
const shouldShowGiftingPromotionDeco = useShouldShowGiftingPromotionDeco();
let c17488_1 = shouldShowGiftingPromotionDeco;
const getOrFetchPurchase = useGetOrFetchPurchase(selectedGiftingPromotionReward, false);
const stateFromStores = useStateFromStores([PromotionsStore], () => PromotionsStore.getGiftPromotion()?.id);
useEffect(() => {
if (c17488_0 != null && c17488_0.reminderNotice != null && c17488_1 && stateFromStores != null) {
markSnowflakeBoundDismissibleContentAsDismissed(DismissibleContent.GIFTING_PROMOTION_REMINDER, stateFromStores, {
dismissAction: ContentDismissActionType.INDIRECT_ACTION
});
}
}, [shouldShowGiftingPromotionDeco, giftingPromotionConfig, stateFromStores]);
return <>
<View style={styles.bodyContainer}>
{recipientUser == null ? <PremiumGiftPurchaseSuccess giftCodeRecord={giftCodeRecord} /> : <PremiumGiftDMPurchaseSuccess />}
</View>
<View style={styles.actionContainer}>
{getOrFetchPurchase != null ? <PremiumGiftingPromotionSuccessActions purchase={getOrFetchPurchase} /> : recipientUser == null ? <PremiumGiftSuccessActions giftCodeRecord={giftCodeRecord} /> : <PremiumGiftDMSuccessActions />}
</View>
</>;
};