This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,28 @@
// Metro module 12326 (f12327).
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { PremiumGiftStyles } from "../../PremiumConstants";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { match } from "../../../../_bundle/Module4389";
import * as _Module12327 from "../../../../_bundle/Module12327";
import * as _Module12328 from "../../../../_bundle/Module12328";
import * as _Module12329 from "../../../../_bundle/Module12329";
import * as _Module8782 from "../../../../_bundle/Module8782";
import * as _Module8791 from "../../../../_bundle/Module8791";
import * as _Module8788 from "../../../../_bundle/Module8788";
import * as _Module8785 from "../../../../_bundle/Module8785";
import * as _Module8794 from "../../../../_bundle/Module8794";
import * as _Module8797 from "../../../../_bundle/Module8797";
import * as _Module8800 from "../../../../_bundle/Module8800";
import * as _Module8803 from "../../../../_bundle/Module8803";
import LottieAnimationView from "../../../../components_native/common/LottieAnimationView";
export default function GiftBoxAnimation(props) {
const giftStyle = props.giftStyle;
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
if (giftStyle == null) {
return null;
}
return <LottieAnimationView source={match(giftStyle).with(PremiumGiftStyles.SNOWGLOBE, () => _Module12327).with(PremiumGiftStyles.BOX, () => _Module12328).with(PremiumGiftStyles.CUP, () => _Module12329).with(PremiumGiftStyles.STANDARD_BOX, () => _Module8782).with(PremiumGiftStyles.COFFEE, () => _Module8791).with(PremiumGiftStyles.CHEST, () => _Module8788).with(PremiumGiftStyles.CAKE, () => _Module8785).with(PremiumGiftStyles.SEASONAL_STANDARD_BOX, () => _Module8794).with(PremiumGiftStyles.SEASONAL_CAKE, () => _Module8797).with(PremiumGiftStyles.SEASONAL_CHEST, () => _Module8800).with(PremiumGiftStyles.SEASONAL_COFFEE, () => _Module8803).otherwise(() => _Module8782)} autoPlay={!stateFromStores} style={{
width: 320,
height: 212
}} />;
};
@@ -0,0 +1,54 @@
// Metro module 12331 (f12332).
import { Image as Image2, ScrollView, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useTheme } from "../../../../_bundle/Module1481";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import Module12332 from "../../../../_bundle/Module12332";
import Module12333 from "../../../../_bundle/Module12333";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
const useStyles = createStyles({
container: {
flex: 1,
justifyContent: "space-between",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
body: {
flex: 1,
alignItems: "center",
justifyContent: "center",
paddingTop: 28,
paddingBottom: 12,
paddingHorizontal: 32
},
header: {
marginTop: 32,
textAlign: "center"
},
message: {
marginTop: 8,
textAlign: "center"
},
footer: {
paddingHorizontal: 24
}
});
export default function GiftCodeRedeemError(props) {
const message = props.message;
const styles = useStyles();
return <SafeAreaPaddingView bottom style={styles.container}>
<ScrollView contentContainerStyle={styles.body} alwaysBounceVertical={false}>
<Image2 source={useTheme().dark ? Module12332 : Module12333} />
<Text variant="heading-xl/bold" style={styles.header}>
{intl.formatToMarkdownString(t.JUvC0s, {})}
</Text>
<Text variant="text-lg/medium" style={styles.message}>{message}</Text>
</ScrollView>
<View style={styles.footer}>
<Button text={intl.string(t.cpT0Cq)} size="md" onPress={() => ModalActionCreators.pop()} />
</View>
</SafeAreaPaddingView>;
};
@@ -0,0 +1,57 @@
// Metro module 8037 (f8038).
import GiftCodeStore from "../../../../stores/GiftCodeStore";
import UserStore from "../../../../stores/UserStore";
import { getHeaderNoTitle, getHeaderCloseButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import GiftCodeRedeemStart from "./GiftCodeRedeemStart";
import GiftCodeRedeemSuccess from "./GiftCodeRedeemSuccess";
import GiftCodeRedeemError from "./GiftCodeRedeemError";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useGiftCodeErrorMessage from "./useGiftCodeErrorMessage";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
let c5091_6 = {
START: "giftcode-start",
SUCCESS: "giftcode-success",
ERROR: "giftcode-error"
};
const headerNoTitle = getHeaderNoTitle();
export default function GiftCodeRedeemModal(props) {
const { code, ...rest } = props;
const stateFromStores2 = useStateFromStores([GiftCodeStore], () => GiftCodeStore.get(code));
const stateFromStores3 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const giftCodeErrorMessage = useGiftCodeErrorMessage(code, stateFromStores3);
if (stateFromStores3 == null) {
return null;
}
const stateFromStores = stateFromStores3;
const screens = {};
screens[c5091_6.START] = {
headerTitle: headerNoTitle,
headerLeft: getHeaderCloseButton(() => ModalActionCreators.pop()),
render: (a0) => <GiftCodeRedeemStart {...a0} user={stateFromStores} />
};
screens[c5091_6.SUCCESS] = {
headerTitle: headerNoTitle,
headerLeft: getHeaderCloseButton(() => ModalActionCreators.pop()),
render: (a0) => <GiftCodeRedeemSuccess {...a0} user={stateFromStores} />
};
screens[c5091_6.ERROR] = {
headerTitle: headerNoTitle,
headerLeft: getHeaderCloseButton(() => ModalActionCreators.pop()),
render: (a0) => <GiftCodeRedeemError {...a0} />
};
return stateFromStores2 == null ? null : <Navigator screens={screens} initialRouteStack={giftCodeErrorMessage != null ? [{
name: c5091_6.ERROR,
params: {
message: giftCodeErrorMessage,
...rest
}
}] : [{
name: c5091_6.START,
params: {
giftCode: stateFromStores2,
...rest
}
}]} />;
};
export { c5091_6 as GiftCodeModalScreens };
@@ -0,0 +1,386 @@
// Metro module 8038 (f8039).
import { useRef, useEffect } from "react";
import { ImageBackground, ScrollView, View } from "react-native";
import GiftCodeStore from "../../../../stores/GiftCodeStore";
import UserStore from "../../../../stores/UserStore";
import SKUStore from "../../../../stores/game_store/SKUStore";
import { AnalyticEvents, GiftCodeModalStates } from "../../../../Constants";
import { BUNDLE_PREVIEW_CONFIG } from "../../../collectibles/native/CollectiblesPreviewConstants";
import { trackStep, getSubscriptionGiftStartHeaderText, getGiftCodeRedeemError } from "../../../../utils/GiftCodeUtils";
import { isGameItemSKU } from "../../../slayer_storefront/SlayerStorefrontUtils";
import { intl, t } from "../../../../intl/index.native";
import { match, P } from "../../../../_bundle/Module4389";
import { CollectiblesItemType } from "../../../../_bundle/Module1901";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import UserUtils from "../../../../utils/UserUtils";
import useGiftCodeErrorMessage from "./useGiftCodeErrorMessage";
import { useGetOrFetchSubscriptionPlan } from "../../../../utils/SubscriptionUtils";
import { useGetOrFetchApplication } from "../../../applications/useGetOrFetchApplications";
import { useFetchCollectiblesProduct } from "../../../collectibles/hooks/useFetchCollectiblesProduct";
import { isCollectiblesGiftCode } from "../../../collectibles/CollectiblesUtils";
import { useShopProductItems } from "../../../collectibles/hooks/useShopProductItems";
import useStartAuthorize from "../../../application_account_linking/native/useStartAuthorize";
import { useSocialLayerStorefrontMobileAccountLinkingDisabled } from "../../../slayer_storefront/native/hooks/useSocialLayerStorefrontMobileAccountLinkingDisabled";
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { fetchSocialLayerStorefrontConfig } from "../../../slayer_storefront/SocialLayerStorefrontActionCreators";
import { playSoundLocally } from "../../../soundboard/SoundboardActionCreators";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { Text } from "../../../../design/components/Text/native/Text";
import * as _Module8050 from "../../../../_bundle/Module8050";
import GiftModalEmojis from "../GiftModalEmojis";
import SlayerStorefrontGiftPreview from "../../../slayer_storefront/native/SlayerStorefrontGiftPreview";
import GameIcon, { GameIconSizes } from "../../../game_detection/native/GameIcon";
import BundleSampleV2 from "../../../collectibles/native/BundleSampleV2";
import { Avatar, AVATAR_SIZE_MAP, AvatarSizes } from "../../../../design/void/native";
import ProfileEffectUserPreview from "../../../collectibles/profile_effects/native/previews/ProfileEffectUserPreview";
import ProfileFrameUserPreview from "../../../collectibles/profile_frames/native/previews/ProfileFrameUserPreview";
import { NameplatePreview } from "../../../collectibles/nameplates/native/NameplatePreview";
import GiftBoxAnimation from "./GiftBoxAnimation";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { GiftCodeModalScreens } from "./GiftCodeRedeemModal";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import { ExperimentalGameControllerLinkIcon } from "../../../../design/components/Icon/native/redesign/generated/ExperimentalGameControllerLinkIcon";
import GiftCodeActionCreators from "../../../../actions/native/GiftCodeActionCreators";
const targetSize = {
width: BUNDLE_PREVIEW_CONFIG.large.bundleWidth,
height: BUNDLE_PREVIEW_CONFIG.large.bundleHeight
};
const useStyles = createStyles({
container: {
flex: 1,
justifyContent: "space-between",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
body: {
flex: 1,
alignItems: "center",
justifyContent: "center",
paddingTop: 28
},
bodyWithMessage: {
flex: 0
},
nameplateContainer: {
width: "100%"
},
nameplateContainerOffCenter: {
paddingBottom: 56
},
message: {
gap: 8
},
text: {
textAlign: "center",
paddingHorizontal: 32
},
footer: {
paddingHorizontal: 24,
paddingBottom: 12
},
confettiBackground: {
justifyContent: "center",
width: "100%",
position: "absolute",
top: 0,
left: 0,
opacity: 0.4,
height: 275
},
emojiContainer: {
justifyContent: "center",
alignItems: "center"
},
imageWrapper: {
position: "relative",
width: "100%",
alignItems: "center",
justifyContent: "center"
},
collectiblesAsset: {
margin: 40
},
collectiblesAssetBundle: {
margin: 20
},
giftCardAsset: {
marginTop: 20,
marginBottom: 40
},
linkAccountIcon: {
marginRight: 4
}
});
export default function GiftCodeRedeemStart(props) {
let children2, children3, props4;
let message, c16207_8, stateFromStores, fetched, hasAlreadyLinked, canStartAuthorization, startAuthorization, analyticsLocations, ref;
const { giftCode, customMessage, soundId, emojiName, user } = props;
message = void 0;
c16207_8 = void 0;
stateFromStores = void 0;
fetched = void 0;
hasAlreadyLinked = void 0;
canStartAuthorization = void 0;
startAuthorization = void 0;
analyticsLocations = void 0;
ref = void 0;
const styles = useStyles();
const navigation = useNavigation();
const stateFromStores2 = useStateFromStores([GiftCodeStore], () => GiftCodeStore.getIsAccepting(giftCode.code));
let r35 = useStateFromStores([UserStore], () => UserUtils.getName(UserStore.getUser(giftCode.userId)));
if (r35 == null) {
r35 = "";
}
message = useGiftCodeErrorMessage(giftCode.code, user);
const getOrFetchSubscriptionPlan = useGetOrFetchSubscriptionPlan(giftCode.subscriptionPlanId);
const getOrFetchApplication = useGetOrFetchApplication(giftCode.applicationId);
const product = useFetchCollectiblesProduct(isCollectiblesGiftCode(giftCode) ? giftCode.skuId : null, true).product;
const r32 = product == null ? void 0 : product.items[0];
const type = product?.type;
const BUNDLE = CollectiblesItemType.BUNDLE;
let r87 = product;
if (r87 == null) {
r87 = {
items: []
};
}
const shopProductItems = useShopProductItems(r87);
const { firstAvatarDecoration, firstProfileEffect, firstNameplate } = shopProductItems;
let r26 = customMessage != null && customMessage.length > 0;
c16207_8 = r26;
stateFromStores = useStateFromStores([SKUStore], () => SKUStore.get(giftCode.skuId));
const startAuthorize = useStartAuthorize(getOrFetchApplication);
fetched = startAuthorize.fetched;
hasAlreadyLinked = startAuthorize.hasAlreadyLinked;
canStartAuthorization = startAuthorize.canStartAuthorization;
startAuthorization = startAuthorize.startAuthorization;
const socialLayerStorefrontMobileAccountLinkingDisabled = useSocialLayerStorefrontMobileAccountLinkingDisabled(giftCode.applicationId);
analyticsLocations = useAnalyticsLocations(AnalyticsLocation.GIFT_CODE_MODAL).analyticsLocations;
ref = useRef({
analyticsLocations,
skuId: giftCode.skuId,
applicationId: giftCode.applicationId,
canStartAuthorization
});
useEffect(() => {
ref.current.canStartAuthorization = canStartAuthorization;
}, [canStartAuthorization]);
useEffect(() => {
if (fetched && isGameItemSKU(stateFromStores)) {
const current = ref.current;
AnalyticsUtils.track(AnalyticEvents.SLAYER_STOREFRONT_LINK_ACCOUNT_STEP_VIEWED, {
location_stack: current.analyticsLocations,
sku_id: current.skuId,
application_id: current.applicationId,
is_gift: true,
is_account_linked: hasAlreadyLinked,
can_start_authorization: current.canStartAuthorization
});
}
}, [fetched, hasAlreadyLinked, stateFromStores]);
useEffect(() => {
if (isGameItemSKU(stateFromStores)) {
fetchSocialLayerStorefrontConfig();
}
}, [stateFromStores]);
useEffect(() => {
trackStep({
step: GiftCodeModalStates.CONFIRM,
giftCode,
customMessage,
emojiName,
soundId
});
}, [giftCode, customMessage, emojiName, soundId]);
useEffect(() => {
if (giftCode.giftStyle != null && soundId != null) {
playSoundLocally(null, {
soundId,
volume: 1
});
}
}, [soundId, giftCode.giftStyle]);
const props2 = {
bottom: true,
style: styles.container,
children: null
};
const props3 = {
contentContainerStyle: [styles.body, r26 ? styles.bodyWithMessage : void 0],
alwaysBounceVertical: false,
children: null
};
const isSubscription = giftCode.isSubscription;
const type2 = r32?.type;
const isBundle = type === BUNDLE;
const sender = r35;
const children = [<Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles.text} accessibilityRole="header">
{isSubscription && getOrFetchSubscriptionPlan != null ? getSubscriptionGiftStartHeaderText(getOrFetchSubscriptionPlan, sender, stateFromStores?.name) : isGameItemSKU(stateFromStores) ? intl.string(t["Bn1J+a"]) : match({
type: type2,
isBundle,
sender
}).with({
isBundle: true,
sender: P.not(P.nullish)
}, () => intl.formatToPlainString(t.JUV1tL, {
sender
})).with({
isBundle: true,
sender: P.nullish
}, () => intl.string(t.iJ8823)).with({
type: CollectiblesItemType.AVATAR_DECORATION,
sender: P.not(P.nullish)
}, () => intl.formatToPlainString(t.SKduyh, {
sender
})).with({
type: CollectiblesItemType.PROFILE_EFFECT,
sender: P.not(P.nullish)
}, () => intl.formatToPlainString(t["1w42T2"], {
sender
})).with({
type: CollectiblesItemType.NAMEPLATE,
sender: P.not(P.nullish)
}, () => intl.formatToPlainString(t.vFiQlU, {
sender
})).with({
type: CollectiblesItemType.PROFILE_FRAME,
sender: P.not(P.nullish)
}, () => intl.formatToPlainString(t["UH/EQL"], {
sender
})).with({
type: CollectiblesItemType.AVATAR_DECORATION,
sender: P.nullish
}, () => intl.string(t["2ZO6CC"])).with({
type: CollectiblesItemType.PROFILE_EFFECT,
sender: P.nullish
}, () => intl.string(t["2NxdjX"])).with({
type: CollectiblesItemType.NAMEPLATE,
sender: P.nullish
}, () => intl.string(t.v7F232)).with({
type: CollectiblesItemType.PROFILE_FRAME,
sender: P.nullish
}, () => intl.string(t["1+tgC0"])).otherwise(() => intl.string(t["2BWscv"]))}
</Text>, <View style={styles.imageWrapper}>
{emojiName != null && <ImageBackground source={_Module8050} style={styles.confettiBackground}>
<View style={styles.emojiContainer}>
<GiftModalEmojis emojiName={emojiName} randomizeSizing />
</View>
</ImageBackground>}
</View>, r32 == null && (getOrFetchApplication != null && isGameItemSKU(stateFromStores)) ? <SlayerStorefrontGiftPreview sku={stateFromStores} application={getOrFetchApplication} sender={sender} hasAccountLinked={hasAlreadyLinked} canStartAuthorization={canStartAuthorization} mobileAccountLinkingDisabled={socialLayerStorefrontMobileAccountLinkingDisabled} /> : r32 == null && (getOrFetchApplication != null && giftCode.giftStyle == null) ? <GameIcon game={getOrFetchApplication} size={GameIconSizes.LARGE} skuId={giftCode.skuId} /> : <View {...isBundle && (product != null && (firstAvatarDecoration != null && firstProfileEffect != null)) ? {
style: styles.collectiblesAssetBundle,
children: <BundleSampleV2 deco={firstAvatarDecoration} pfx={firstProfileEffect} nameplate={firstNameplate} size="large" targetSize={targetSize} />
} : {
style: giftCode.isSubscription ? styles.giftCardAsset : styles.collectiblesAsset,
children: match(r32).with({
type: CollectiblesItemType.AVATAR_DECORATION
}, (a0) => <Avatar source={user.getAvatarSource(null, true, AVATAR_SIZE_MAP[AvatarSizes.GIFT_START])} avatarDecoration={a0} size={AvatarSizes.GIFT_START} animate />).with({
type: CollectiblesItemType.PROFILE_EFFECT
}, (a0) => <ProfileEffectUserPreview user={user} profileEffect={a0} />).with({
type: CollectiblesItemType.PROFILE_FRAME
}, (a0) => <ProfileFrameUserPreview user={user} profileFrame={a0} />).with({
type: CollectiblesItemType.NAMEPLATE
}, (a0) => <View style={[styles.nameplateContainer, c16207_8 ? void 0 : styles.nameplateContainerOffCenter]}>
<NameplatePreview user={user} nameplate={a0} />
</View>).otherwise(() => <GiftBoxAnimation giftStyle={giftCode.giftStyle} />)
}} />, ,];
if (r26) {
r26 = <View style={styles.message}>
<Text variant="eyebrow" color="text-default" style={styles.text}>
{intl.format(t["6yrIzU"], {
sender
})}
</Text>
<Text variant={customMessage.length > 110 ? "heading-xl/semibold" : "heading-xxl/semibold"} style={styles.text}>{customMessage}</Text>
</View>;
}
L67: {
children[3] = r26;
props3.children = children;
children2 = [<ScrollView {...props3} />, ,];
props4 = {
style: styles.footer,
children: null
};
if (giftCode.isClaimed) {
children3 = <Button text={intl.string(t.XiOHRX)} size="md" onPress={() => navigation.push(GiftCodeModalScreens.SUCCESS, {
giftCode
})} />;
} else if (message != null) {
children3 = <Button text={intl.string(t["3nWhcJ"])} size="md" onPress={() => {
trackStep({
step: GiftCodeModalStates.ERROR,
giftCode,
customMessage,
emojiName,
soundId
});
navigation.push(GiftCodeModalScreens.ERROR, {
message
});
}} />;
} else {
if (isGameItemSKU(stateFromStores) && !hasAlreadyLinked) {
children3 = <Button {...canStartAuthorization && !socialLayerStorefrontMobileAccountLinkingDisabled ? {
text: intl.string(t["VDAhr+"]),
size: "md",
icon: <ExperimentalGameControllerLinkIcon size="xs" color={Module712.colors.WHITE} style={styles.linkAccountIcon} />,
onPress: () => {
AnalyticsUtils.track(AnalyticEvents.SLAYER_STOREFRONT_ACCOUNT_LINK_CLICKED, {
location_stack: analyticsLocations,
sku_id: giftCode.skuId,
application_id: giftCode.applicationId,
is_gift: true
});
startAuthorization({
analyticsLocations
});
}
} : {
text: intl.string(t.cpT0Cq),
size: "md",
onPress: () => {
ModalActionCreators.pop();
}
}} />;
break L67;
}
children3 = <Button disabled={stateFromStores2} text={stateFromStores2 ? intl.string(t.rTeOBK) : intl.string(t["3nWhcJ"])} size="md" onPress={() => {
GiftCodeActionCreators.redeemGiftCode({
code: giftCode.code,
onRedeemed: () => {
trackStep({
step: GiftCodeModalStates.SUCCESS,
giftCode,
customMessage,
emojiName,
soundId
});
navigation.push(GiftCodeModalScreens.SUCCESS, {
giftCode
});
},
onError: (a0) => {
trackStep({
step: GiftCodeModalStates.ERROR,
giftCode,
customMessage,
emojiName,
soundId
});
navigation.push(GiftCodeModalScreens.ERROR, {
message: getGiftCodeRedeemError(a0, user)
});
}
});
}} />;
}
}
props4.children = children3;
children2[1] = <View {...props4} />;
props2.children = children2;
return <SafeAreaPaddingView {...props2} />;
};
@@ -0,0 +1,214 @@
// Metro module 12330 (f12331).
import { ScrollView, View } from "react-native";
import SKUStore from "../../../../stores/game_store/SKUStore";
import { BUNDLE_PREVIEW_CONFIG } from "../../../collectibles/native/CollectiblesPreviewConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useGetOrFetchSubscriptionPlan } from "../../../../utils/SubscriptionUtils";
import { useGetOrFetchApplication } from "../../../applications/useGetOrFetchApplications";
import { useFetchCollectiblesProduct } from "../../../collectibles/hooks/useFetchCollectiblesProduct";
import { isCollectiblesGiftCode } from "../../../collectibles/CollectiblesUtils";
import { CollectiblesItemType } from "../../../../_bundle/Module1901";
import { useShopProductItems } from "../../../collectibles/hooks/useShopProductItems";
import { useHandleUseNow } from "../../../collectibles/native/useHandleUseNow";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { isGameItemSKU } from "../../../slayer_storefront/SlayerStorefrontUtils";
import SlayerStorefrontItemCard from "../../../slayer_storefront/native/SlayerStorefrontItemCard";
import GameIcon, { GameIconSizes } from "../../../game_detection/native/GameIcon";
import BundleSampleV2 from "../../../collectibles/native/BundleSampleV2";
import { match } from "../../../../_bundle/Module4389";
import { Avatar, AVATAR_SIZE_MAP, AvatarSizes } from "../../../../design/void/native";
import ProfileEffectUserPreview from "../../../collectibles/profile_effects/native/previews/ProfileEffectUserPreview";
import ProfileFrameUserPreview from "../../../collectibles/profile_frames/native/previews/ProfileFrameUserPreview";
import { NameplatePreview } from "../../../collectibles/nameplates/native/NameplatePreview";
import GiftBoxAnimation from "./GiftBoxAnimation";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { getSubscriptionGiftSuccessText } from "../../../../utils/GiftCodeUtils";
import { Button } from "../../../../design/components/Button/native/Button.native";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
const targetSize = {
width: BUNDLE_PREVIEW_CONFIG.large.bundleWidth,
height: BUNDLE_PREVIEW_CONFIG.large.bundleHeight
};
const useStyles = createStyles({
container: {
flex: 1,
justifyContent: "space-between",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
body: {
flex: 1,
alignItems: "center",
justifyContent: "center",
paddingTop: 28,
paddingBottom: 12,
paddingHorizontal: 32
},
nameplateContainer: {
width: "100%",
paddingTop: Module712.space.PX_24
},
bundleContainer: {
width: "100%",
alignItems: "center",
paddingTop: Module712.space.PX_24
},
header: {
marginTop: 32,
textAlign: "center"
},
message: {
marginTop: 8,
textAlign: "center"
},
footer: {
paddingHorizontal: 24
},
gameItemCard: {
marginTop: 20
}
});
export default function GiftCodeRedeemSuccess(props) {
let r166, r258, children, props4;
const { giftCode, user } = props;
const styles = useStyles();
const stateFromStores = useStateFromStores([SKUStore], () => SKUStore.get(giftCode.skuId));
const getOrFetchSubscriptionPlan = useGetOrFetchSubscriptionPlan(giftCode.subscriptionPlanId);
const getOrFetchApplication = useGetOrFetchApplication(giftCode.applicationId);
const product = useFetchCollectiblesProduct(isCollectiblesGiftCode(giftCode) ? giftCode.skuId : null, true).product;
const r22 = product == null ? void 0 : product.items[0];
const type = product?.type;
const BUNDLE = CollectiblesItemType.BUNDLE;
const shopProductItems = useShopProductItems(product == null ? {
items: []
} : product);
const { firstAvatarDecoration, firstProfileEffect, firstNameplate } = shopProductItems;
let product2 = product;
if (product2 == null) {
product2 = {
skuId: "",
type: CollectiblesItemType.BUNDLE,
items: []
};
}
let r1 = type === BUNDLE;
const handleUseNow = useHandleUseNow({
product: product2
});
const { handleUseNow: handleUseNow2, isApplying } = handleUseNow;
const props2 = {
bottom: true,
style: styles.container,
children: null
};
const props3 = {
contentContainerStyle: styles.body,
alwaysBounceVertical: false,
children: null
};
const r126 = r22 == null && getOrFetchApplication != null ? isGameItemSKU(stateFromStores) ? <View style={styles.gameItemCard}>
<SlayerStorefrontItemCard sku={stateFromStores} />
</View> : <GameIcon game={getOrFetchApplication} size={GameIconSizes.LARGE} skuId={giftCode.skuId} /> : r1 && (product != null && (firstAvatarDecoration != null && firstProfileEffect != null)) ? <View style={styles.bundleContainer}>
<BundleSampleV2 deco={firstAvatarDecoration} pfx={firstProfileEffect} nameplate={firstNameplate} size="large" targetSize={targetSize} />
</View> : match(r22).with({
type: CollectiblesItemType.AVATAR_DECORATION
}, (a0) => <Avatar source={user == null ? void 0 : user.getAvatarSource(null, true, AVATAR_SIZE_MAP[AvatarSizes.GIFT_SUCCESS])} avatarDecoration={a0} size={AvatarSizes.GIFT_SUCCESS} animate />).with({
type: CollectiblesItemType.PROFILE_EFFECT
}, (a0) => <ProfileEffectUserPreview user={user} profileEffect={a0} />).with({
type: CollectiblesItemType.PROFILE_FRAME
}, (a0) => <ProfileFrameUserPreview user={user} profileFrame={a0} />).with({
type: CollectiblesItemType.NAMEPLATE
}, (a0) => <View style={styles.nameplateContainer}>
<NameplatePreview user={user} nameplate={a0} />
</View>).otherwise(() => <GiftBoxAnimation giftStyle={giftCode.giftStyle} />);
L35: {
children = [r126, , ,];
if (stateFromStores == null) {
r166 = <Text variant="heading-xl/bold" style={styles.header} accessibilityRole="header">
{intl.string(t["+BNMcF"])}
</Text>;
} else if (isGameItemSKU(stateFromStores)) {
r166 = <Text variant="heading-xl/bold" style={styles.header} accessibilityRole="header">
{intl.string(t["5glWta"])}
</Text>;
} else {
if (giftCode.isSubscription && getOrFetchSubscriptionPlan != null) {
r166 = <Text variant="heading-xl/bold" style={styles.header} accessibilityRole="header">
{intl.format(t["1C2BG/"], {
skuName: stateFromStores.name
})}
</Text>;
break L35;
}
r166 = r22 != null ? <Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles.header} accessibilityRole="header">
{intl.string(t.IMffmm)}
</Text> : void 0;
}
}
children[1] = r166;
if (isGameItemSKU(stateFromStores) && getOrFetchApplication != null) {
const W2znvX = t.W2znvX;
let skuName = stateFromStores?.name;
if (skuName == null) {
skuName = "";
}
r258 = <Text variant="text-md/medium" style={styles.message}>
{intl.formatToPlainString(W2znvX, {
skuName,
applicationName: getOrFetchApplication.name
})}
</Text>;
} else {
r258 = giftCode.isSubscription && getOrFetchSubscriptionPlan != null ? <Text variant="text-md/medium" style={styles.message}>
{getSubscriptionGiftSuccessText(getOrFetchSubscriptionPlan)}
</Text> : <Text variant="text-md/medium" style={styles.message}>
{r22 != null ? stateFromStores?.name != null ? intl.formatToPlainString(t["4kp0AB"], {
itemName: stateFromStores.name
}) : intl.string(t["5ayf7w"]) : intl.string(t["5ayf7w"])}
</Text>;
}
children[2] = r258;
props3.children = children;
const children2 = [<ScrollView {...props3} />, ,];
if (r22 == null) {
props4 = {
text: intl.string(t["NX+WJN"]),
size: "md",
onPress: ModalActionCreators.pop
};
} else {
props4 = {
text: intl.string(t.MAS7uK),
size: "md",
loading: isApplying,
disabled: null,
onPress: null
};
let r308 = r22 != null;
if (r308) {
let r4 = !r1;
if (r1) {
if (r1) {
r1 = product != null;
}
if (r1) {
r1 = firstAvatarDecoration != null;
}
if (r1) {
r1 = firstProfileEffect != null;
}
r4 = r1;
}
r308 = r4;
}
props4.disabled = !r308;
props4.onPress = handleUseNow2;
}
children2[1] = <View style={styles.footer}>
<Button {...props4} />
</View>;
props2.children = children2;
return <SafeAreaPaddingView {...props2} />;
};
@@ -0,0 +1,13 @@
// Metro module 8040 (f8041).
import CollectiblesPurchaseStore from "../../../collectibles/CollectiblesPurchaseStore";
import GiftCodeStore from "../../../../stores/GiftCodeStore";
import { useStateFromStoresArray, useStateFromStores } from "../../../../_bundle/Module589";
import { intl, t } from "../../../../intl/index.native";
import { getGiftCodeRedeemError } from "../../../../utils/GiftCodeUtils";
export default function useGiftCodeErrorMessage(c16209_0, a1) {
let c16209_1;
const [r18, r19] = useStateFromStoresArray([GiftCodeStore], () => [GiftCodeStore.get(c16209_0), GiftCodeStore.getError(c16209_0)]);
c16209_1 = r18;
const stateFromStores = useStateFromStores([CollectiblesPurchaseStore], () => CollectiblesPurchaseStore.getPurchase(c16209_1?.skuId));
return r18?.userId === a1?.id ? intl.string(t.JZxgJX) : r18?.isClaimed ? intl.string(t.ilcBeX) : stateFromStores != null ? intl.string(t.mdLtb5) : r19 == null ? null : getGiftCodeRedeemError(r19);
};