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,89 @@
// Metro module 12537 (f12538).
import { Image as Image2, View } from "react-native";
import { AppliedGuildBoostsRequiredForBoostedGuildTier, BoostedGuildTiers } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { getTier048PxSource } from "../../../design/components/Illustration/native/redesign/generated/Tier048Px";
import Module12542 from "../../../_bundle/Module12542";
import Module12543 from "../../../_bundle/Module12543";
import Module12544 from "../../../_bundle/Module12544";
import useGuildPowerupsBoostCount from "../powerups/hooks/useGuildPowerupsBoostCount";
import { getNextGuildTierFromGuild, getTierName } from "../../../utils/GuildBoostingUtils";
import ProgressCircle from "./components/ProgressCircle";
import { Text } from "../../../design/components/Text/native/Text";
const useStyles = createStyles({
guildTierProgressCircle: {
position: "relative",
width: 70,
height: 70
},
guildTierBackground: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
width: 64,
height: 64,
alignItems: "center",
justifyContent: "center",
borderRadius: Module712.radii.xxl
},
guildTierNoneIcon: {
width: 18,
height: 30
},
guildTierIcon: {
width: 24,
height: 24
},
guildTierName: {
lineHeight: 16,
marginTop: 2
}
});
export default function BoostedGuildTierProgressCircle(props) {
let props2, props3, source;
const { guild, theme } = props;
const styles = useStyles();
const available = useGuildPowerupsBoostCount(guild?.id).available;
if (guild == null) {
return <View style={styles.guildTierBackground}>
<Image2 source={getTier048PxSource(theme)} style={styles.guildTierNoneIcon} accessibilityElementsHidden importantForAccessibility="no" />
</View>;
}
const nextGuildTierFromGuild = getNextGuildTierFromGuild(guild.id);
const r32 = nextGuildTierFromGuild != null ? AppliedGuildBoostsRequiredForBoostedGuildTier[nextGuildTierFromGuild] : null;
const percent = r32 != null ? r32 > 0 ? available / r32 * 100 : 100 : 100;
L17: {
props2 = {
style: styles.guildTierProgressCircle,
percent,
children: null
};
props3 = {
style: styles.guildTierBackground,
children: null
};
if (guild != null && guild.premiumTier !== BoostedGuildTiers.NONE) {
const premiumTier = guild.premiumTier;
if (BoostedGuildTiers.TIER_1 === premiumTier) {
source = Module12542;
break L17;
}
if (BoostedGuildTiers.TIER_2 === premiumTier) {
source = Module12543;
break L17;
}
const TIER_3 = BoostedGuildTiers.TIER_3;
source = void 0;
if (TIER_3 !== premiumTier) {
break L17;
}
source = Module12544;
} else {
source = getTier048PxSource(theme);
}
}
props3.children = [<Image2 source={source} style={styles.guildTierIcon} accessibilityElementsHidden importantForAccessibility="no" />, <Text style={styles.guildTierName} variant="text-xs/semibold" color="interactive-text-active">
{getTierName(guild.premiumTier)}
</Text>];
props2.children = <View {...props3} />;
return <ProgressCircle {...props2} />;
};
@@ -0,0 +1,38 @@
// Metro module 8051 (f8052).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import EmojiUtils from "../../../utils/EmojiUtils";
import Emoji from "../../emojis/native/Emoji";
let c5102_5 = [[100, 0, -40], [120, 40, -10], [100, 80, 10], [180, 20, 20], [140, 95, 15], [250, 0, 0], [250, 80, -20], [400, 90, 10], [400, 20, -20], [410, 0, 40]];
const useStyles = createStyles({
emojisContainer: {
alignItems: "center",
justifyContent: "center",
height: 250,
width: "100%",
position: "absolute",
zIndex: 1,
paddingBottom: 210
}
});
export default ({ emojiName, randomizeSizing = false }) => {
let c16220_1 = randomizeSizing;
const styles = useStyles();
const uRL = EmojiUtils.getURL(emojiName);
return <View style={styles.emojisContainer}>
{c5102_5.map((item, index) => {
const r17 = _slicedToArray(item, 3);
return <Emoji key={`${index}-${emojiName}`} src={uRL} name={emojiName} style={{
position: "absolute",
top: `${r17[0]}%`,
left: `${r17[1]}%`,
transform: [{
rotate: `${r17[2]}deg`
}, {
scale: c16220_1 ? 1.5 * Math.random() + 0.5 : 1
}]
}} forceTextEmoji />;
})}
</View>;
};
@@ -0,0 +1,259 @@
// Metro module 12531 (f12532).
import { useMemo, useEffect } from "react";
import { Image as Image2, View } from "react-native";
import ThemeStore from "../../user_settings/ThemeStore";
import GuildStore from "../../../stores/GuildStore";
import GuildBoostSlotStore from "../../../stores/billing/GuildBoostSlotStore";
import SubscriptionStore from "../../../stores/billing/SubscriptionStore";
import { Fonts } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import TextStyles from "../../rebrand/native/TextStyles";
import useCountdown from "../../../hooks/useCountdown";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import SnowflakeUtils from "../../../utils/SnowflakeUtils";
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
import { openTransferModal, openApplyBoostModal } from "../../../actions/native/BoostingActionCreators";
import GuildIcon, { GuildIconSizes } from "../../guild/native/GuildIcon";
import Module12532 from "../../../_bundle/Module12532";
import { useStateFromStores } from "../../../_bundle/Module589";
import AvatarUtils from "../../../utils/AvatarUtils";
import { useSubscriptionPlaceholderPatternSource } from "../../../design/components/Illustration/native/redesign/generated/SubscriptionPlaceholderPattern";
import BoostedGuildTierProgressCircle from "./BoostedGuildTierProgressCircle";
import { fetchSubscriptions } from "../../billing/actions/BillingActionCreators";
import { fetchGuildBoostSlots } from "../../../actions/BoostingActionCreators";
import Module12 from "../../../_bundle/Module12";
let useStyles, GuildBoostSlotsInventoryRow, GuildBoostSlot, UnusedGuildBoostSlots, BoostedGuildInfo, BoostedGuild;
const GuildBoostSlotCooldown = function GuildBoostSlotCooldown(props) {
const cooldownEndsAt = props.cooldownEndsAt;
const styles = useStyles();
const memo = useMemo(() => new Date(cooldownEndsAt), [cooldownEndsAt]);
const countdown = useCountdown(memo, 15000);
const { days, hours, minutes } = countdown;
return memo.valueOf() <= Date.now() ? null : <Text style={styles.subscriptionSlotInfoCooldown} variant="text-xs/medium" color="text-muted">
{intl.format(t.NffSH8, {
days,
hours,
minutes
})}
</Text>;
};
GuildBoostSlotsInventoryRow = function GuildBoostSlotsInventoryRow(props) {
const { title, subtitle, action, isLast } = props;
const styles = useStyles();
return <View style={styles.subscriptionSlot}>
<View style={styles.subscriptionSlotInner}>
<View style={styles.subscriptionSlotInfo}>
<Text style={styles.subscriptionSlotInfoTitle} lineClamp={1} variant="text-md/semibold" color="interactive-text-active">{title}</Text>
{subtitle}
</View>
{action}
</View>
{isLast ? null : <View style={styles.subscriptionSlotBorder} />}
</View>;
};
GuildBoostSlot = function GuildBoostSlot(props) {
const { guild, guildBoostSlot, isLast } = props;
if (guild == null) {
return null;
}
const r4 = guildBoostSlot.premiumGuildSubscription != null ? guildBoostSlot.premiumGuildSubscription.id : null;
const r15 = r4 != null ? SnowflakeUtils.extractTimestamp(r4) : null;
return <GuildBoostSlotsInventoryRow title={r15 != null ? intl.formatToPlainString(t["ePe+Xh"], {
date: new Date(r15)
}) : null} subtitle={guildBoostSlot.cooldownEndsAt != null ? <GuildBoostSlotCooldown cooldownEndsAt={guildBoostSlot.cooldownEndsAt} /> : null} action={guildBoostSlot.isOnCooldown() ? null : <PressableOpacity accessibilityRole="button" onPress={() => openTransferModal({
guildBoostSlots: [guildBoostSlot]
})}>
<Text variant="text-md/medium" color="control-brand-foreground">
{intl.string(t.jqqLb6)}
</Text>
</PressableOpacity>} isLast={isLast} />;
};
UnusedGuildBoostSlots = function UnusedGuildBoostSlots(props) {
let c19894_0;
const unusedSlots = props.unusedSlots;
c19894_0 = void 0;
const styles = useStyles();
const r9 = unusedSlots.filter(({ cooldownEndsAt: cooldownEndsAt2 }) => cooldownEndsAt2 != null && new Date(cooldownEndsAt2).valueOf() > Date.now());
c19894_0 = r9;
const r18 = unusedSlots.filter(({ cooldownEndsAt: cooldownEndsAt2 }) => cooldownEndsAt2 == null || new Date(cooldownEndsAt2).valueOf() <= Date.now());
return <View style={styles.unusedSlots}>
{r18.length > 0 ? <GuildBoostSlotsInventoryRow title={intl.formatToPlainString(t.ewI23O, {
numSubscriptions: r18.length
})} action={<PressableOpacity accessibilityRole="button" onPress={() => openApplyBoostModal()}>
<Text variant="text-md/medium" color="text-link">
{intl.string(t["7KyPor"])}
</Text>
</PressableOpacity>} isLast={r9.length === 0} /> : null}
{r9.map((item, index) => <GuildBoostSlotsInventoryRow key={item.id} title={intl.formatToPlainString(t.gDsyB9, {
numSubscriptions: 1
})} subtitle={item.cooldownEndsAt != null ? <GuildBoostSlotCooldown cooldownEndsAt={item.cooldownEndsAt} /> : null} isLast={index === c19894_0.length - 1} />)}
</View>;
};
BoostedGuildInfo = function BoostedGuildInfo(props) {
const { guild, numGuildBoostSlots } = props;
const styles = useStyles();
return guild != null ? <View style={styles.guildInfo}>
<View style={styles.guildInfoIcon}>
<GuildIcon guild={guild} size={GuildIconSizes.NORMAL} selected={false} />
</View>
<View>
<Text style={styles.guildInfoName} variant="heading-lg/extrabold" color="interactive-text-active">{guild.name}</Text>
<View style={styles.guildInfoRowBottom}>
<Image2 source={Module12532} style={styles.guildInfoRowIcon} />
<Text style={styles.guildInfoSubscriptionCount} variant="text-xs/semibold" color="interactive-text-active">
{intl.format(t.bexfNy, {
numSubscriptions: numGuildBoostSlots
})}
</Text>
</View>
</View>
</View> : null;
};
BoostedGuild = function BoostedGuild(props) {
const { guildId, guildBoostSlots } = props;
const styles = useStyles();
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
const stateFromStores2 = useStateFromStores([ThemeStore], () => ThemeStore.theme);
const r16 = stateFromStores != null ? stateFromStores.banner != null ? AvatarUtils.getGuildBannerSource(stateFromStores) : null : null;
let source = useSubscriptionPlaceholderPatternSource();
if (r16 != null) {
source = r16;
}
return <View style={styles.boostedGuild}>
<View style={styles.subscriptionBody}>
<View style={styles.subscriptionImageView}>
<Image2 source={source} style={[styles.subscriptionImage, r16 == null ? styles.subscriptionImageFallback : null]} />
{r16 != null ? <View style={styles.subscriptionImageOverlay} /> : null}
<BoostedGuildTierProgressCircle guild={stateFromStores} theme={stateFromStores2} />
</View>
<BoostedGuildInfo guild={stateFromStores} numGuildBoostSlots={guildBoostSlots.length} />
</View>
<View>
{guildBoostSlots.map((a0, index) => <GuildBoostSlot key={a0.id} guild={stateFromStores} guildBoostSlot={a0} isLast={index === guildBoostSlots.length - 1} />)}
</View>
</View>;
};
useStyles = createStyles({
inventory: {
marginBottom: 32
},
header: {
marginHorizontal: 16,
marginBottom: 16
},
boostedGuild: {
borderRadius: Module712.radii.xs,
marginBottom: 16
},
subscriptionBody: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
subscriptionImageView: {
backgroundColor: Module712.colors.BACKGROUND_MOD_NORMAL,
width: "100%",
height: 112,
overflow: "hidden",
alignItems: "center",
justifyContent: "center"
},
subscriptionImage: {
position: "absolute",
width: "100%",
height: "100%"
},
subscriptionImageFallback: {
opacity: 0.4
},
subscriptionImageOverlay: {
position: "absolute",
width: "100%",
height: "100%",
backgroundColor: Module712.colors.BLACK,
opacity: 0.4
},
guildInfo: {
flexDirection: "row",
padding: 16
},
guildInfoIcon: {
marginRight: 8
},
guildInfoName: {
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.INTERACTIVE_TEXT_ACTIVE, 20),
marginBottom: 4
},
guildInfoRowBottom: {
flexDirection: "row",
alignItems: "center"
},
guildInfoRowIcon: {
height: 12,
width: 8,
marginLeft: 2,
marginRight: 8
},
guildInfoSubscriptionCount: {
lineHeight: 16
},
subscriptionSlot: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
paddingLeft: 16
},
subscriptionSlotInner: {
alignItems: "center",
flexDirection: "row",
paddingRight: 16,
paddingVertical: 12
},
subscriptionSlotBorder: {
backgroundColor: Module712.colors.BORDER_SUBTLE,
height: 1
},
subscriptionSlotInfo: {
flexShrink: 1,
flexGrow: 1
},
subscriptionSlotInfoTitle: {
lineHeight: 24
},
subscriptionSlotInfoCooldown: {
lineHeight: 16
},
unusedSlots: {
marginBottom: 32
}
});
export default function GuildBoostSlotsInventory() {
let r51;
let c19896_0;
L9: {
const styles = useStyles();
useEffect(() => {
fetchSubscriptions();
fetchGuildBoostSlots();
}, []);
const stateFromStores2 = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumTypeSubscription());
const r43 = Module12(useStateFromStores([GuildBoostSlotStore], () => GuildBoostSlotStore.boostSlots)).groupBy(({ premiumGuildSubscription }) => premiumGuildSubscription != null ? premiumGuildSubscription.guildId : "0").value();
c19896_0 = r43;
const unusedSlots = r43[0];
const r14 = Object.keys(r43).filter((item) => item !== "0");
if (r14.length === 0) {
r51 = null;
if (unusedSlots == null) {
break L9;
}
}
r51 = stateFromStores2 == null ? null : <View style={styles.inventory}>
{unusedSlots != null ? unusedSlots.length > 0 ? <UnusedGuildBoostSlots unusedSlots={unusedSlots} /> : null : null}
{r14.length > 0 ? <>
<Text style={styles.header} variant="eyebrow" color="text-default">
{intl.string(t.gB9oQ7)}
</Text>
{r14.map((item) => <BoostedGuild key={item} guildId={item} guildBoostSlots={c19896_0[item]} />)}
</> : null}
</View>;
}
return r51;
};
@@ -0,0 +1,10 @@
// Metro module 16214 (f16215).
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
class IAPManager extends AutomaticLifecycleManager {
actions = {
POST_CONNECTION_OPEN: () => {},
APP_STATE_UPDATE: () => {}
};
}
const iAPManager = new IAPManager();
export default iAPManager;
@@ -0,0 +1,34 @@
// Metro module 6241 (f6242).
import { PremiumSubscriptionSKUToPremiumType } from "../PremiumConstants";
import { usePremiumTrialOffer } from "../hooks/usePremiumTrialOffer.android";
import { useIsDismissibleContentDismissed_UNSAFE } from "../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../_bundle/Module1358";
import { isAndroidTwoWeekTrialsTrialCTAEnabled } from "../experiments/AndroidTwoWeekTrialsExperiment";
import { formatIntervalDuration } from "../../../utils/PremiumUtils";
import { intl, t } from "../../../intl/index.native";
export function useShouldShowPremiumTrialUserSettingsAvatarBadge() {
const premiumTrialOffer = usePremiumTrialOffer();
const isDismissibleContentDismissed_UNSAFE = useIsDismissibleContentDismissed_UNSAFE(DismissibleContent.PREMIUM_MOBILE_TRIAL_USER_SETTINGS_AVATAR_BADGE);
return premiumTrialOffer != null && !(premiumTrialOffer?.expires_at != null) && !isDismissibleContentDismissed_UNSAFE;
}
export function usePremiumTrialOfferPremiumType() {
const premiumTrialOffer = usePremiumTrialOffer();
return PremiumSubscriptionSKUToPremiumType[premiumTrialOffer == null ? void 0 : premiumTrialOffer.subscription_trial?.sku_id];
}
export function useNitroTrialCtaOverride(a0) {
const subscription_trial = usePremiumTrialOffer()?.subscription_trial;
if (subscription_trial == null) {
return null;
}
if (isAndroidTwoWeekTrialsTrialCTAEnabled({
location: a0
})) {
return intl.formatToPlainString(t["6xpY54"], {
duration: formatIntervalDuration({
intervalType: subscription_trial.interval,
intervalCount: subscription_trial.interval_count
})
});
}
return null;
}
+116
View File
@@ -0,0 +1,116 @@
// Metro module 12774 (f12775).
import UserOfferStore from "../../../stores/billing/UserOfferStore";
import { PremiumSubscriptionSKUs } from "../PremiumConstants";
import { NoticeTypes } from "../../../Constants";
import { Storage } from "../../../_bundle/Module595";
import Module3771 from "../../../_bundle/Module3771";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c8805_6, c8805_7, c8805_8, isNoticeDismissed, updateNotice;
const clearDismissUntil = function clearDismissUntil(item) {
Storage.remove(c8805_8[item] + "-untilAtLeast");
};
isNoticeDismissed = function isNoticeDismissed(a0) {
if (a0 == null) {
return false;
}
const r9 = c8805_8[a0];
if (r9 != null) {
const r16 = Storage.get(c8805_8[a0] + "-untilAtLeast");
const r17 = r16 != null ? Module3771(r16) : null;
if (r17 != null) {
return r17.isAfter(Module3771());
}
}
let r21 = r9 != null && r9 !== "";
if (r21) {
let r30 = Storage.get(r9);
if (r30 == null) {
r30 = false;
}
r21 = r30;
}
return r21;
};
updateNotice = function updateNotice() {
c8805_6 = null;
for (const item of c8805_7) {
if (item !== NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING) {
if (item !== NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING) {
continue;
}
if (!(UserOfferStore.getAlmostExpiringTrialOffersForReminder([PremiumSubscriptionSKUs.TIER_0]).length > 0)) {
continue;
}
if (isNoticeDismissed(NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING)) {
continue;
}
c8805_6 = item;
break;
}
if (!(UserOfferStore.getAlmostExpiringTrialOffersForReminder([PremiumSubscriptionSKUs.TIER_2]).length > 0)) {
continue;
}
if (isNoticeDismissed(NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING)) {
continue;
}
c8805_6 = item;
break;
}
};
c8805_6 = null;
c8805_7 = [NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING, NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING];
const r31 = {};
r31[NoticeTypes.PREMIUM_TIER_0_TRIAL_ENDING] = "hidePremiumTier0TrialEndingReminder";
r31[NoticeTypes.PREMIUM_TIER_2_TRIAL_ENDING] = "hidePremiumTier2TrialEndingReminder";
c8805_8 = r31;
class NoticeStore extends Module589.Store {
static displayName = "NoticeStore";
initialize() {
this.syncWith([UserOfferStore], updateNotice);
this.waitFor(UserOfferStore);
}
getNoticeType() {
return c8805_6;
}
}
const noticeStore = new NoticeStore(Dispatcher, {
CONNECTION_OPEN: updateNotice,
CURRENT_USER_UPDATE: updateNotice,
PREMIUM_PAYMENT_SUBSCRIBE_SUCCESS: updateNotice,
BILLING_SUBSCRIPTION_UPDATE_SUCCESS: updateNotice,
BILLING_MOST_RECENT_SUBSCRIPTION_FETCH_SUCCESS: updateNotice,
BILLING_SUBSCRIPTION_FETCH_SUCCESS: updateNotice,
LOGOUT: function handleLogout() {
(function clearStorage() {
for (const item of c8805_7) {
const r27 = c8805_8[item];
if (r27 != null) {
Storage.remove(r27);
}
clearDismissUntil(item);
}
})();
c8805_6 = null;
},
NOTICE_DISMISS: function handleNoticeDismiss(a0) {
if (c8805_6 != null) {
L8: {
const untilAtLeast = a0.untilAtLeast;
if (c8805_6 != null) {
const r5 = c8805_8[c8805_6];
if (r5 != null) {
Storage.set(r5, true);
}
if (untilAtLeast != null && r5 != null) {
Storage.set(c8805_8[c8805_6] + "-untilAtLeast", untilAtLeast.format("YYYY-MM-DDTHH:mm:ss.SSSZ"));
break L8;
}
Storage.remove(c8805_8[c8805_6] + "-untilAtLeast");
}
}
updateNotice();
}
}
});
export default noticeStore;
@@ -0,0 +1,128 @@
// Metro module 6558 (f6559).
import { View } from "react-native";
import EntitlementStore from "../../../stores/game_store/EntitlementStore";
import { SubscriptionStatusTypes } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import PremiumUtils, { castPremiumSubscriptionAsSkuId, extendDateWithUnconsumedFractionalPremium } from "../../../utils/PremiumUtils";
import { intl, t } from "../../../intl/index.native";
import PremiumGroup_messages from "../premium_group/PremiumGroup.messages";
import GameIcon, { GameIconSizes } from "../../game_detection/native/GameIcon";
import { Text } from "../../../design/components/Text/native/Text";
import { useStateFromStoresArray } from "../../../_bundle/Module589";
import Module12 from "../../../_bundle/Module12";
let useStyles;
const AccountCreditTier = function AccountCreditTier(props) {
let r44, currentSubscription2, months, shouldAddDivider, skuId, styles, tierDisplayNameByPlanId;
L12: {
const planId = props.planId;
months = props.months;
currentSubscription2 = props.currentSubscription;
shouldAddDivider = props.shouldAddDivider;
const { unconsumedFractionalPremiumUnits, hasPremiumGroup: hasPremiumGroup2 } = props;
styles = useStyles();
skuId = castPremiumSubscriptionAsSkuId(PremiumUtils.getSkuIdForPlan(planId));
tierDisplayNameByPlanId = PremiumUtils.getTierDisplayNameByPlanId(planId);
if (hasPremiumGroup2) {
r44 = intl.string(PremiumGroup_messages["5asczk"]);
} else {
if (currentSubscription2 != null && currentSubscription2.planId === planId) {
let date = extendDateWithUnconsumedFractionalPremium(currentSubscription2.status === SubscriptionStatusTypes.PAUSED && currentSubscription2.pauseEndsAt != null ? new Date(currentSubscription2.pauseEndsAt) : new Date(currentSubscription2.currentPeriodEnd), unconsumedFractionalPremiumUnits);
const r71 = t["5CNRRA"];
if (date == null) {
date = 0;
}
r44 = intl.formatToPlainString(r71, {
date
});
break L12;
}
r44 = intl.formatToPlainString(t.eNXZ5O, {
planName: tierDisplayNameByPlanId
});
}
}
const r81 = currentSubscription2 != null && currentSubscription2.isPurchasedExternally;
return <View style={[styles.creditItem, shouldAddDivider ? styles.divider : null]}>
<GameIcon size={GameIconSizes.SMALL} skuId={skuId} />
<View style={styles.textContainer}>
<Text style={styles.headerText} variant="text-md/semibold" color="mobile-text-heading-primary">
{intl.format(t.LzobT9, {
planName: tierDisplayNameByPlanId
})}
</Text>
{r81 ? !r81 : <Text style={styles.subText} variant="text-xs/medium" color="text-default">{r44}</Text>}
</View>
<Text style={styles.timeText} variant="text-md/medium" color="text-default">
{intl.format(t["ess/xl"], {
count: months
})}
</Text>
</View>;
};
useStyles = createStyles({
title: {
marginBottom: 12
},
creditList: {
borderRadius: Module712.radii.xs,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
creditItem: {
flexDirection: "row",
alignItems: "center",
padding: 16
},
textContainer: {
marginLeft: 16,
marginRight: 16,
flexDirection: "column",
flex: 1
},
headerText: {
lineHeight: 20
},
subText: {
lineHeight: 16
},
timeText: {
lineHeight: 20,
alignSelf: "flex-start"
},
divider: {
borderBottomWidth: 1,
borderBottomColor: Module712.colors.BORDER_SUBTLE
},
creditDescription: {
marginTop: 8
}
});
export default function PremiumAccountCredit(props) {
let c15795_3;
const { currentSubscription, entitlements, style, creditListContainerStyle, hasPremiumGroup } = props;
c15795_3 = void 0;
const styles = useStyles();
const stateFromStoresArray = useStateFromStoresArray([EntitlementStore], () => EntitlementStore.getUnactivatedFractionalPremiumUnits());
if (entitlements != null && PremiumUtils.hasAccountCredit(entitlements)) {
const r16 = Module12(Array.from(entitlements)).filter(({ subscriptionPlanId, parentId, consumed }) => subscriptionPlanId != null && parentId != null && !consumed).groupBy((item) => item.subscriptionPlanId).value();
c15795_3 = r16;
return <View style={style}>
<Text style={styles.title} accessibilityRole="header" variant="eyebrow" color="text-default">
{intl.string(t.YugZY0)}
</Text>
<View style={[styles.creditList, creditListContainerStyle]}>
{Object.keys(r16).map((item) => {
const r4 = Object;
return <AccountCreditTier key={item} planId={item} months={c15795_3[item].length} currentSubscription={currentSubscription} shouldAddDivider={!(item === r4.keys(c15795_3)[Object.keys(c15795_3).length - 1])} unconsumedFractionalPremiumUnits={stateFromStoresArray} hasPremiumGroup={hasPremiumGroup} />;
})}
</View>
<Text style={styles.creditDescription} variant="text-sm/medium">
{intl.string(t.kNEjGm)}
</Text>
{currentSubscription != null ? currentSubscription.isPurchasedExternally ? <Text style={styles.creditDescription} variant="text-sm/medium">
{intl.string(t.azRP0E)}
</Text> : null : null}
</View>;
}
return null;
};
@@ -0,0 +1,95 @@
// Metro module 6295 (f6296).
import { AnalyticEvents, PurchaseTypeToAnalyticsPaymentType, PurchaseTypes, SubscriptionTypes } from "../../../Constants";
import { v4 } from "../../../_bundle/Module514";
import { getPremiumPlanItem } from "../../../utils/PremiumUtils";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { HermesBuiltin } from "../../../_hermes/prelude";
const r20 = {
SKU_SELECT: "sku_select",
PLAN_SELECT: "plan_select",
REVIEW: "review",
CONFIRM: "confirm",
MOBILE_WEB_REDIRECT_CHECKOUT: "mobile_web_redirect_checkout",
YEARLY_UPSELL: "yearly_upsell",
PREMIUM_UPSELL: "premium_upsell",
EXTERNAL_PAYMENT: "external_payment",
REWARD_SKU_SELECT: "reward_sku_select"
};
const r30 = {
WHAT_YOU_LOSE: 1,
1: "WHAT_YOU_LOSE",
CONFIRM: 2,
2: "CONFIRM",
PREVIEW: 3,
3: "PREVIEW",
DOWNGRADE_TO_TIER_0: 4,
4: "DOWNGRADE_TO_TIER_0",
MOBILE_SUBSCRIPTION_MANAGE: 5,
5: "MOBILE_SUBSCRIPTION_MANAGE"
};
const r40 = {};
r40[r30.WHAT_YOU_LOSE] = "What You're Losing";
r40[r30.DOWNGRADE_TO_TIER_0] = "Downgrade To Tier 0";
r40[r30.CONFIRM] = "Confirm Cancellation";
r40[r30.PREVIEW] = "Preview Updated Subscription";
r40[r30.MOBILE_SUBSCRIPTION_MANAGE] = "Mobile Subscription Manage";
export { r20 as PaymentFlowStep };
export function getBasePurchaseFlowAnalyticsFields(a0) {
const { analyticsLoadId, isGift = false, analyticsLocation } = a0;
return {
load_id: analyticsLoadId,
payment_type: PurchaseTypeToAnalyticsPaymentType[PurchaseTypes.SUBSCRIPTION],
subscription_type: SubscriptionTypes.PREMIUM,
is_gift: isGift,
location: analyticsLocation,
location_stack: a0.analyticsLocations,
location_section: analyticsLocation?.section
};
}
export function getPaymentFlowCompletedAnalyticsFields(a0, a1) {
return {
...a0,
...a1
};
}
export function getPaymentFlowStepAnalyticsFields(a0, a1) {
return {
...a0,
...a1
};
}
export function getNewAnalyticsLoadId() {
return v4();
}
export { r30 as CancellationFlowSteps };
export { r40 as STEP_ANALYTICS_NAMES };
export function trackPremiumSubscriptionCancellationStarted(a0, a1) {
const CANCELLATION_FLOW_STARTED = AnalyticEvents.CANCELLATION_FLOW_STARTED;
const r17 = {
location_stack: a1
};
HermesBuiltin.copyDataProperties(r17, {
subscription_id: a0?.id,
subscription_type: a0?.type,
subscription_plan_id: a0 != null ? getPremiumPlanItem(a0)?.id : void 0,
subscription_plan_gateway_plan_id: a0?.paymentGatewayPlanId,
subscription_status: a0?.status
});
AnalyticsUtils.track(CANCELLATION_FLOW_STARTED, r17);
}
export function trackPremiumSubscriptionCancellationFlowStep({ fromStep, toStep, subscription, analyticsLocations }) {
const CANCELLATION_FLOW_STEP = AnalyticEvents.CANCELLATION_FLOW_STEP;
const r18 = {
from_step: fromStep,
to_step: toStep,
location_stack: analyticsLocations
};
HermesBuiltin.copyDataProperties(r18, {
subscription_id: subscription?.id,
subscription_type: subscription?.type,
subscription_plan_id: subscription != null ? getPremiumPlanItem(subscription)?.id : void 0,
subscription_plan_gateway_plan_id: subscription?.paymentGatewayPlanId,
subscription_status: subscription?.status
});
AnalyticsUtils.track(CANCELLATION_FLOW_STEP, r18);
}
@@ -0,0 +1,218 @@
// Metro module 6250 (f6251).
import { PREMIUM_GUILD_SUBSCRIPTION_PLANS, PremiumTypes, SubscriptionIntervalTypes, SubscriptionPlans } from "../PremiumConstants";
import { AppStorePremiumProductIdsToPremiumBundledItems } from "./ProductIds.android";
import { isBoostOnlySubscription, getItemsWithUpsertedPremiumPlanId } from "../../../utils/PremiumUtils";
function $mk78085($env) {
return (a0) => {
const numPremiumGuild = a0.numPremiumGuild;
const r6 = $env[0];
return numPremiumGuild === r6.numPremiumGuild && a0.premiumTier === r6.premiumTier && a0.interval !== r6.interval && !a0.isDeprecated;
};
}
let isValidBundleProductId, getSubscriptionItemsForProduct, aggregateQuantitiesByPlanId, planQuantityMapsEqual, getProductIdFromSubscriptionItems;
const getPremiumBundledItemsFromProductId = function getPremiumBundledItemsFromProductId(a0) {
if (a0 in AppStorePremiumProductIdsToPremiumBundledItems) {
return AppStorePremiumProductIdsToPremiumBundledItems[a0];
}
throw new Error(`Invalid bundled product ID ${a0}`);
};
isValidBundleProductId = function isValidBundleProductId(a0) {
return a0 != null && a0 in AppStorePremiumProductIdsToPremiumBundledItems;
};
getSubscriptionItemsForProduct = function getSubscriptionItemsForProduct(a0) {
if (!isValidBundleProductId(a0)) {
throw new Error(`Invalid product ${a0}`);
}
const premiumBundledItemsFromProductId = getPremiumBundledItemsFromProductId(a0);
const r28 = [];
if (premiumBundledItemsFromProductId.basePlanId !== SubscriptionPlans.NONE_MONTH) {
r28.push({
planId: premiumBundledItemsFromProductId.basePlanId,
quantity: 1
});
}
for (const additionalPlan of premiumBundledItemsFromProductId.additionalPlans) {
r28.push({
planId: additionalPlan.planId,
quantity: additionalPlan.quantity
});
}
return r28;
};
aggregateQuantitiesByPlanId = function aggregateQuantitiesByPlanId(a0) {
const map = new Map();
for (const item of a0) {
const { planId, quantity } = item;
let r10 = map.get(planId);
if (r10 == null) {
r10 = 0;
}
map.set(planId, r10 + quantity);
}
return map;
};
planQuantityMapsEqual = function planQuantityMapsEqual(a0, a1) {
if (a0.size !== a1.size) {
return false;
}
for (const item of a0) {
const [r8, r28] = item;
if (a1.get(r8) === r28) {
continue;
}
return false;
}
return true;
};
getProductIdFromSubscriptionItems = function getProductIdFromSubscriptionItems(a0) {
const r4 = aggregateQuantitiesByPlanId(a0);
for (const item of Object.keys(AppStorePremiumProductIdsToPremiumBundledItems)) {
if (!planQuantityMapsEqual(r4, aggregateQuantitiesByPlanId(getSubscriptionItemsForProduct(item)))) {
continue;
}
return item;
}
throw new Error("No App Store bundled product matches the subscription items");
};
export function getPremiumBundlesWithPredicate(a0) {
return Object.values(AppStorePremiumProductIdsToPremiumBundledItems).filter(a0);
}
export function getPremiumBundleWithPredicate(a0) {
return Object.values(AppStorePremiumProductIdsToPremiumBundledItems).find(a0);
}
export { getPremiumBundledItemsFromProductId };
export function getToggledIntervalProduct(a0) {
if (a0 in AppStorePremiumProductIdsToPremiumBundledItems) {
let env15613;
const r19 = env15613 = {};
const r23 = AppStorePremiumProductIdsToPremiumBundledItems[a0];
env15613[0] = r23;
return r23.premiumTier !== PremiumTypes.TIER_1 ? Object.values(AppStorePremiumProductIdsToPremiumBundledItems).find($mk78085(r19))?.productId : null;
}
throw new Error(`Invalid bundled product ID ${a0}`);
}
export function getProductIdsForBothIntervals(a0) {
let r63;
if (a0 in AppStorePremiumProductIdsToPremiumBundledItems) {
let env15614;
const r25 = AppStorePremiumProductIdsToPremiumBundledItems[a0];
const r26 = env15614 = {};
env15614[0] = void 0;
if (a0 in AppStorePremiumProductIdsToPremiumBundledItems) {
const r42 = AppStorePremiumProductIdsToPremiumBundledItems[a0];
env15614[0] = r42;
let yearly = r42.premiumTier !== PremiumTypes.TIER_1 ? Object.values(AppStorePremiumProductIdsToPremiumBundledItems).find($mk78085(r26))?.productId : null;
if (yearly == null) {
r63 = {
monthly: a0,
yearly: null
};
} else {
const monthly = r25.interval === SubscriptionIntervalTypes.MONTH ? a0 : yearly;
if (r25.interval === SubscriptionIntervalTypes.YEAR) {
yearly = a0;
}
r63 = {
monthly,
yearly
};
}
return r63;
}
throw new Error(`Invalid bundled product ID ${a0}`);
}
throw new Error(`Invalid bundled product ID ${a0}`);
}
export function productsHaveSamePerks(a0, a1) {
if (a0 != null && a0 in AppStorePremiumProductIdsToPremiumBundledItems && a1 != null && a1 in AppStorePremiumProductIdsToPremiumBundledItems) {
if (a0 != null && a1 != null) {
if (a0 === a1) {
return true;
}
if (a0 in AppStorePremiumProductIdsToPremiumBundledItems) {
const r40 = AppStorePremiumProductIdsToPremiumBundledItems[a0];
if (a1 in AppStorePremiumProductIdsToPremiumBundledItems) {
const r57 = AppStorePremiumProductIdsToPremiumBundledItems[a1];
return r40.numPremiumGuild === r57.numPremiumGuild && r40.premiumTier === r57.premiumTier;
}
throw new Error(`Invalid bundled product ID ${a1}`);
}
throw new Error(`Invalid bundled product ID ${a0}`);
}
return a0 === a1;
}
return a0 === a1;
}
export { isValidBundleProductId };
export function shouldAlwaysExcludeFromPlanSelect(a0) {
return a0.isDeprecated || a0.interval === SubscriptionIntervalTypes.YEAR;
}
export { getSubscriptionItemsForProduct };
export function getModifySubscriptionItemsForProduct(a0, a1) {
if (a0 in AppStorePremiumProductIdsToPremiumBundledItems) {
const r24 = AppStorePremiumProductIdsToPremiumBundledItems[a0];
if (r24.premiumTier != null && isBoostOnlySubscription(a1)) {
let c15615_0;
const r40 = getItemsWithUpsertedPremiumPlanId(a1, r24.basePlanId).reverse();
const r44 = r24.additionalPlans.find((additionalPlan) => PREMIUM_GUILD_SUBSCRIPTION_PLANS.has(additionalPlan.planId));
c15615_0 = r44;
return r44 != null ? r40.map((item) => {
const r7 = PREMIUM_GUILD_SUBSCRIPTION_PLANS.has(item.planId);
let r8 = item;
if (r7) {
r8 = {
...item,
planId: c15615_0.planId,
quantity: c15615_0.quantity
};
}
return r8;
}) : r40;
}
return getSubscriptionItemsForProduct(a0);
}
throw new Error(`Invalid bundled product ID ${a0}`);
}
export function makeExternalPaymentGatewayPlanIdOrThrow(a0) {
if (a0 == null) {
throw new Error("Invalid null plan ID");
}
if (a0 != null && a0 in AppStorePremiumProductIdsToPremiumBundledItems) {
return a0;
}
const r14 = a0 + ".1";
if (r14 in AppStorePremiumProductIdsToPremiumBundledItems) {
return r14;
}
throw new Error(`Invalid plan ID ${a0}`);
}
export { getProductIdFromSubscriptionItems };
export function getProductIdFromSubscription(a0, a1) {
let r20;
if (a0.isACOM) {
let r44 = a1 ? a0.renewalMutations?.items : null;
if (r44 == null) {
r44 = a0.items;
}
r20 = getProductIdFromSubscriptionItems(r44);
} else {
let r10 = a1 ? a0.renewalMutations?.paymentGatewayPlanId : null;
if (r10 == null) {
r10 = a0.paymentGatewayPlanId;
}
if (r10 == null) {
throw new Error("Invalid null plan ID");
}
const r14 = r10 != null && r10 in AppStorePremiumProductIdsToPremiumBundledItems;
r20 = r10;
if (!r14) {
const r22 = r10 + ".1";
const r27 = r22 in AppStorePremiumProductIdsToPremiumBundledItems;
r20 = r22;
if (!r27) {
throw new Error(`Invalid plan ID ${r10}`);
}
}
}
return r20;
}
+314
View File
@@ -0,0 +1,314 @@
// Metro module 12446 (f12447).
import { useCallback } from "react";
import { ScrollView, View } from "react-native";
import { MAX_PREMIUM_TIER_2_ATTACHMENT_SIZE } from "../PremiumConstants";
import { HelpdeskArticles, UserSettingsSections } from "../../../Constants";
import { useFontScale } from "../../screen/native/useFontScale";
import { useSubscriptionPlansLoaded } from "../../billing/hooks/useSubscriptionPlansLoaded";
import { formatSize } from "../../../utils/FileSizeUtils";
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { intl, t } from "../../../intl/index.native";
import Module12448 from "../../../_bundle/Module12448";
import Module12449 from "../../../_bundle/Module12449";
import Module12450 from "../../../_bundle/Module12450";
import Module12451 from "../../../_bundle/Module12451";
import Module12452 from "../../../_bundle/Module12452";
import Module12453 from "../../../_bundle/Module12453";
import Module12454 from "../../../_bundle/Module12454";
import Module12455 from "../../../_bundle/Module12455";
import Module12456 from "../../../_bundle/Module12456";
import Module12457 from "../../../_bundle/Module12457";
import Module12458 from "../../../_bundle/Module12458";
import Module12459 from "../../../_bundle/Module12459";
import Module12460 from "../../../_bundle/Module12460";
import Module12461 from "../../../_bundle/Module12461";
import Module12462 from "../../../_bundle/Module12462";
import Module12463 from "../../../_bundle/Module12463";
import Module12464 from "../../../_bundle/Module12464";
import { Text } from "../../../design/components/Text/native/Text";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import FastImage from "../../../components_native/common/FastImage";
import PillText from "./components/PillText";
import { Button } from "../../../design/components/Button/native/Button.native";
const r33 = {
CUSTOM_PROFILE: "customProfile",
CLIENT_THEMES: "clientThemes",
SERVER_BOOSTS: "serverBoosts",
GREYED_SERVER_BOOSTS: "greyServerBoosts",
CUSTOM_APP_ICONS: "customAppIcons",
EMOJI: "emoji",
CUSTOM_SOUNDS: "customSounds",
STICKER: "sticker",
EARLY_ACCESS: "earlyAccess",
MEMBER_PRICING: "memberPricing",
LARGE_UPLOADS: "largeUploads",
HD_VIDEO: "hdVideo",
SUPER_REACTIONS: "superReactions",
ENTRACE_SOUNDS: "entranceSounds",
BADGE: "badge",
GREYED_BADGE: "greyBadge",
XBOX_GAME_PASS: "xboxGamePass"
};
let c8610_11 = {
NARROW: 0,
0: "NARROW",
WIDE: 1,
1: "WIDE"
};
const r55 = Object;
const r57 = {};
r57[c8610_11.NARROW] = {
width: 300,
height: 364,
scaledFontHeight: 440
};
r57[c8610_11.WIDE] = {
width: 320,
height: 364,
scaledFontHeight: 440
};
let c8610_12 = r55.freeze(r57);
const useStyles = createStyles((a0) => ({
container: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.sm,
width: c8610_12[a0].width,
...Module712.shadows.SHADOW_LOW
},
headerComponent: {
width: "100%",
borderTopLeftRadius: Module712.radii.sm,
borderTopRightRadius: Module712.radii.sm,
overflow: "hidden"
},
image: {
width: "100%",
borderTopLeftRadius: Module712.radii.sm,
borderTopRightRadius: Module712.radii.sm
},
title: {
marginTop: 16,
marginHorizontal: 16
},
description: {
marginTop: 8,
marginHorizontal: 16,
marginBottom: a0 === c8610_11.WIDE ? 24 : 8,
...a0 === c8610_11.NARROW && {
height: "100%"
}
},
button: {
marginTop: "auto",
marginHorizontal: 16,
marginBottom: 16
},
imageContainer: {
position: "relative",
alignItems: "center",
justifyContent: "center"
},
imageOverlayText: {
color: Module712.colors.WHITE,
fontSize: 14
},
imageOverlayTextContainer: {
position: "absolute",
bottom: "10%",
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.BACKGROUND_MOD_STRONG,
paddingHorizontal: 12,
paddingVertical: 4,
justifyContent: "center",
alignItems: "center"
},
pillTextContainer: {
position: "absolute",
width: "auto",
top: -8,
left: 10
}
}));
export default function PremiumPerkCard(props) {
const { style, title, titleStyle, description, bodyComponent, headerComponent, imageSrc, imageStyle, buttonOnPress, cta = intl.string(t.jVcuVY), variant = c8610_11.WIDE, imageOverlayText, pillText } = props;
const styles = useStyles(variant);
const NARROW = c8610_11.NARROW;
const fontScale = useFontScale();
const r48 = c8610_12[NARROW];
const height = fontScale > 1 ? r48.scaledFontHeight : r48.height;
return <View style={[styles.container, variant === c8610_11.NARROW && {
height
}, style]}>
{pillText != null && <PillText pillText={pillText} style={styles.pillTextContainer} />}
{imageSrc != null ? imageOverlayText != null ? <View style={styles.imageContainer}>
<FastImage style={[styles.image, imageStyle]} source={imageSrc} />
<View style={styles.imageOverlayTextContainer}>
<Text style={styles.imageOverlayText} variant="text-md/bold">
{imageOverlayText.toUpperCase()}
</Text>
</View>
</View> : <FastImage style={[styles.image, imageStyle]} source={imageSrc} /> : headerComponent != null ? <View style={styles.headerComponent}>{headerComponent}</View> : null}
<Text style={[styles.title, titleStyle]} variant="heading-lg/extrabold" accessibilityRole="header">{title}</Text>
<ScrollView style={styles.description}>
{description != null ? <Text variant="text-sm/normal">{description}</Text> : bodyComponent ?? null}
</ScrollView>
{buttonOnPress != null && <View style={styles.button}>
<Button size="sm" variant="secondary" text={cta} onPress={buttonOnPress} />
</View>}
</View>;
};
export { r33 as PerkCardTypes };
export { c8610_11 as PerkCardVariant };
export { c8610_12 as PERK_CARD_SIZES };
export function usePerkCardHeight(a0) {
const fontScale = useFontScale();
const r11 = c8610_12[a0];
return fontScale > 1 ? r11.scaledFontHeight : r11.height;
}
export function usePremiumPerkCard() {
const subscriptionPlansLoaded = useSubscriptionPlansLoaded();
const premiumMaxSize = formatSize(MAX_PREMIUM_TIER_2_ATTACHMENT_SIZE / 1024, {
useKibibytes: true
});
const callback2 = useCallback(() => {
openUserSettings({
screen: UserSettingsSections.COLLECTIBLES_SHOP,
params: {
analyticsSource: AnalyticsLocation.PREMIUM_MARKETING_PERK_CARD
}
});
}, []);
const callback = useCallback(() => {
openUserSettings({
screen: UserSettingsSections.PROFILE_CUSTOMIZATION
});
}, []);
const callback3 = useCallback(() => {
openUserSettings({
screen: UserSettingsSections.APPEARANCE_THEME_PICKER
});
}, []);
const callback4 = useCallback(() => {
openUserSettings({
screen: UserSettingsSections.GUILD_BOOSTING,
params: {
shouldFetchSubscriptionPlans: !subscriptionPlansLoaded
}
});
}, [subscriptionPlansLoaded]);
const callback5 = useCallback(() => {
openUserSettings({
screen: UserSettingsSections.APP_ICONS
});
}, []);
return {
customProfile: {
title: intl.string(t.KcyDwF),
description: intl.string(t.Mt3U1W),
imageSrc: Module12448,
buttonOnPress: callback
},
clientThemes: {
title: intl.string(t.kWM48G),
description: intl.string(t.CjRASJ),
imageSrc: Module12449,
buttonOnPress: callback3
},
serverBoosts: {
title: intl.string(t["NyDu/6"]),
description: intl.string(t["4pEwXL"]),
imageSrc: Module12450,
buttonOnPress: callback4
},
greyServerBoosts: {
title: intl.string(t["NyDu/6"]),
description: intl.string(t["4pEwXL"]),
imageSrc: Module12451,
imageOverlayText: intl.string(t["/VzCKE"])
},
customAppIcons: {
title: intl.string(t.OuItFi),
description: intl.string(t.mPyrE6),
imageSrc: Module12452,
buttonOnPress: callback5
},
emoji: {
title: intl.string(t["R2IV/Q"]),
description: intl.string(t.R5Xag2),
imageSrc: Module12453
},
customSounds: {
title: intl.string(t.LWsArT),
description: intl.string(t["4lSyCY"]),
imageSrc: Module12454
},
sticker: {
title: intl.string(t.tzdIwI),
description: intl.string(t.hJG8ZN),
imageSrc: Module12455
},
earlyAccess: {
title: intl.string(t.EYxi0o),
description: intl.string(t.M9AIt1),
imageSrc: Module12456
},
memberPricing: {
title: intl.string(t["H4/NBN"]),
description: intl.string(t.wo3D3T),
imageSrc: Module12457,
buttonOnPress: callback2
},
largeUploads: {
title: intl.formatToPlainString(t.jqhAdL, {
premiumMaxSize
}),
description: intl.formatToPlainString(t["HI+cfm"], {
premiumMaxSize
}),
imageSrc: Module12458
},
hdVideo: {
title: intl.string(t.RSXQYO),
description: intl.string(t.ymCPxp),
imageSrc: Module12459
},
superReactions: {
title: intl.string(t["6S7kO7"]),
description: intl.string(t.A0U9fk),
imageSrc: Module12460
},
entranceSounds: {
title: intl.string(t["f4M+H9"]),
description: intl.string(t["7ZCYvC"]),
imageSrc: Module12461
},
badge: {
title: intl.string(t.dcFfSJ),
description: intl.string(t["37MFFq"]),
imageSrc: Module12462
},
greyBadge: {
title: intl.string(t.dcFfSJ),
description: intl.string(t["37MFFq"]),
imageSrc: Module12463,
imageOverlayText: intl.string(t["/VzCKE"])
},
xboxGamePass: {
title: intl.string(t.aJE9i1),
imageSrc: {
uri: Module12464
},
imageStyle: {
aspectRatio: 1.9789473684210526
},
bodyComponent: <Text variant="text-sm/normal">
{intl.format(t["9Wv+8h"], {
termsLink: HelpdeskUtils.getArticleURL(HelpdeskArticles.NITRO_2_POINT_0)
})}
</Text>
}
};
}
@@ -0,0 +1,58 @@
// Metro module 12485 (f12486).
import { useState, useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import PremiumPerkCard, { usePerkCardHeight, PerkCardVariant, PERK_CARD_SIZES } from "./PremiumPerkCard";
import { Text } from "../../../design/components/Text/native/Text";
import Carousel from "../../../components_native/common/Carousel";
import { CarouselPagination } from "../../../design/void/native";
const useStyles = createStyles({
title: {
marginLeft: 24
},
indicators: {
marginBottom: -36
},
carousel: {
marginTop: 16
},
carouselCard: {
marginLeft: 8
},
lastCarouselCard: {
marginRight: 8
}
});
export default function PremiumPerkCarousel(props) {
let length;
const { title, perks, style, onItemChange } = props;
length = void 0;
const styles = useStyles();
const perkCardHeight = usePerkCardHeight(PerkCardVariant.NARROW);
const [state, setState] = useState(0);
const callback = useCallback((a0) => {
if (a0 !== state) {
setState(a0);
if (onItemChange != null) {
onItemChange(a0);
}
}
}, [state, onItemChange]);
const width = PERK_CARD_SIZES[PerkCardVariant.NARROW].width;
length = perks.length;
return <View style={style}>
<Text style={styles.title} variant="heading-xl/extrabold" color="mobile-text-heading-primary">{title}</Text>
<Carousel style={[styles.carousel, {
height: perkCardHeight + 8
}]} width={width} onPageChange={callback} pageIndictor={false} scrollViewProps={{
overScrollMode: "always",
snapToInterval: width + 8 + 0.2,
snapToStart: true,
snapToAlignment: "start",
decelerationRate: "normal"
}}>
{perks.map((perk, index) => <PremiumPerkCard key={index} {...perk} variant={PerkCardVariant.NARROW} style={[styles.carouselCard, length - 1 === index ? styles.lastCarouselCard : null]} />)}
</Carousel>
<CarouselPagination containerStyle={styles.indicators} numberOfItems={perks.length} currentIndex={state} />
</View>;
};
@@ -0,0 +1,96 @@
// Metro module 6226 (f6227).
import { View } from "react-native";
import { PremiumTypes, SubscriptionIntervalTypes } from "../PremiumConstants";
import { getPremiumGradientColor } from "../../colors/native/ColorConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module6228 from "../../../_bundle/Module6228";
import Module6229 from "../../../_bundle/Module6229";
import PremiumUtils, { getPlanIdForPremiumType, getPremiumTypeDisplayName } from "../../../utils/PremiumUtils";
import Module4611 from "../../../_bundle/Module4611";
import { HorizontalGradient } from "../../../ConstantsIOS";
import FastImage from "../../../components_native/common/FastImage";
import Module6230 from "../../../_bundle/Module6230";
import Module6231 from "../../../_bundle/Module6231";
import Module6232 from "../../../_bundle/Module6232";
import { PremiumPill } from "../../user_settings/premium/native/PremiumPill";
import Module6246 from "../../../_bundle/Module6246";
import Module6247 from "../../../_bundle/Module6247";
import Module6248 from "../../../_bundle/Module6248";
const useStyles = createStyles({
header: {
height: 112,
justifyContent: "center",
alignItems: "center"
},
logoContainer: {
position: "absolute",
top: 16,
left: 16
},
imgWumpus: {
position: "absolute",
height: 90
},
imgWumpusRight: {
transform: [{
scaleX: -1
}]
},
imgWumpusBottom: {
bottom: 0
},
discountPill: {
marginTop: 10
}
});
export default function PremiumPlanActionSheetHeader(props) {
let r115, props3, style;
const { premiumType, trialOffer, discountOffer } = props;
const styles = useStyles();
const r1 = trialOffer != null && trialOffer.subscription_trial?.sku_id === PremiumUtils.getSkuIdForPremiumType(premiumType);
const planIdForPremiumType = getPlanIdForPremiumType(premiumType, SubscriptionIntervalTypes.MONTH);
let r17 = discountOffer != null;
if (r17) {
const discount = discountOffer.discount;
r17 = discount == null ? void 0 : discount.planIds.includes(planIdForPremiumType);
}
const props2 = {
style: styles.header,
colors: getPremiumGradientColor(premiumType),
start: HorizontalGradient.START,
end: HorizontalGradient.END,
accessible: true,
accessibilityRole: "header",
accessibilityLabel: getPremiumTypeDisplayName(premiumType),
children: null
};
const children = [(PremiumTypes.TIER_0 === premiumType ? Module6228 : PremiumTypes.TIER_1 !== premiumType ? PremiumTypes.TIER_2 === premiumType ? Module6229 : void 0 : null) && <FastImage source={PremiumTypes.TIER_0 === premiumType ? Module6228 : PremiumTypes.TIER_1 !== premiumType ? PremiumTypes.TIER_2 === premiumType ? Module6229 : void 0 : null} />, <View style={styles.logoContainer}>
<FastImage source={PremiumTypes.TIER_0 === premiumType ? Module6230 : PremiumTypes.TIER_1 === premiumType ? Module6231 : PremiumTypes.TIER_2 === premiumType ? Module6232 : void 0} resizeMode="contain" />
{r1 ? <PremiumPill style={styles.discountPill} trialOffer={trialOffer} premiumType={premiumType} useWhiteBackground hideTrialCountdown /> : null}
{r17 ? <PremiumPill style={styles.discountPill} discountOffer={discountOffer} premiumType={premiumType} shouldShowDiscountUpsell useWhiteBackground /> : null}
</View>, ,];
const source = PremiumTypes.TIER_0 === premiumType ? Module6246 : PremiumTypes.TIER_1 === premiumType ? Module6247 : PremiumTypes.TIER_2 === premiumType ? Module6248 : void 0;
L41: {
props3 = {
source,
style: null,
resizeMode: "contain"
};
style = [styles.imgWumpus, ,];
if (PremiumTypes.TIER_0 !== premiumType && PremiumTypes.TIER_1 !== premiumType) {
const TIER_2 = PremiumTypes.TIER_2;
r115 = void 0;
if (TIER_2 !== premiumType) {
break L41;
}
r115 = styles.imgWumpusRight;
} else {
r115 = styles.imgWumpusBottom;
}
}
style[1] = r115;
props3.style = style;
children[2] = <FastImage {...props3} />;
props2.children = children;
return <Module4611 {...props2} />;
};
@@ -0,0 +1,94 @@
// Metro module 6225 (f6226).
import ActionSheetStore from "../../action_sheet/native/ActionSheetStore";
import { PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY, PremiumTypes } from "../PremiumConstants";
import { create } from "../../../_bundle/Module644";
import { batchUpdates } from "../../../_bundle/Module705";
import openPremiumPlanSelectionActionSheet from "./openPremiumPlanSelectionActionSheet";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
let c3953_6 = create(() => ({
productId: "",
initiatedPurchaseFromNewFlow: false,
isPaymentSuccess: false,
mobileWebRedirectCheckoutStatus: null
}));
export { c3953_6 as usePremiumPlanPurchasedStore };
export function setInitiatedPurchaseFromNewFlow({ productId, onPaymentSuccess, onPaymentDismiss }) {
batchUpdates(() => {
c3953_6.setState({
productId,
initiatedPurchaseFromNewFlow: true,
onPaymentSuccess,
onPaymentDismiss
});
});
}
export function setPaymentSuccess() {
if (c3953_6.getState().initiatedPurchaseFromNewFlow) {
const state = c3953_6.getState();
const { productId: productId2, onPaymentSuccess: onPaymentSuccess2 } = state;
batchUpdates(() => c3953_6.setState({
isPaymentSuccess: true
}));
if (onPaymentSuccess2 != null) {
onPaymentSuccess2(productId2);
}
}
}
export function setMobileWebRedirectCheckoutStatus(mobileWebRedirectCheckoutStatus) {
batchUpdates(() => c3953_6.setState({
mobileWebRedirectCheckoutStatus
}));
}
export function handleMobileWebCheckoutStatus(a0) {
const mobileWebRedirectCheckoutStatus2 = a0;
if (a0 === "succeeded") {
const state = c3953_6.getState();
const { productId: productId2, onPaymentSuccess: onPaymentSuccess2 } = state;
if (state.mobileWebRedirectCheckoutStatus === "dismissed") {
return void 0;
}
if (ActionSheetStore.getKey() !== PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY) {
openPremiumPlanSelectionActionSheet({
premiumType: PremiumTypes.TIER_2,
analyticsLocations: [AnalyticsLocation.DEEPLINK],
analyticsLocation: {}
});
}
batchUpdates(() => c3953_6.setState({
isPaymentSuccess: true,
mobileWebRedirectCheckoutStatus: mobileWebRedirectCheckoutStatus2
}));
if (onPaymentSuccess2 != null) {
onPaymentSuccess2(productId2);
}
}
}
export function showOldPaymentFlowSuccess(a0) {
if (c3953_6.getState().initiatedPurchaseFromNewFlow) {
batchUpdates(() => c3953_6.setState({
isPaymentSuccess: true
}));
} else {
a0();
}
}
export function reset() {
const state = c3953_6.getState();
const { productId: productId2, isPaymentSuccess, onPaymentDismiss: onPaymentDismiss2, mobileWebRedirectCheckoutStatus: mobileWebRedirectCheckoutStatus3 } = state;
if (onPaymentDismiss2 != null) {
onPaymentDismiss2({
productId: productId2,
isSuccess: isPaymentSuccess
});
}
batchUpdates(() => {
c3953_6.setState({
productId: "",
initiatedPurchaseFromNewFlow: false,
isPaymentSuccess: false,
mobileWebRedirectCheckoutStatus: mobileWebRedirectCheckoutStatus3 != null ? mobileWebRedirectCheckoutStatus3 !== "in_mobile_web" ? "dismissed" : null : null,
onPaymentSuccess: void 0,
onPaymentDismiss: void 0
});
});
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,15 @@
// Metro module 12573 (f12574).
import { create } from "../../../_bundle/Module644";
import { batchUpdates } from "../../../_bundle/Module705";
let c8677_2 = create(() => ({
isPurchasing: false,
purchasingProductId: null
}));
export { c8677_2 as usePremiumPlanSelectStore };
export function setIsPurchasing(isPurchasing, r4 = null) {
const purchasingProductId = r4;
batchUpdates(() => c8677_2.setState({
isPurchasing,
purchasingProductId
}));
}
@@ -0,0 +1,116 @@
// Metro module 12582 (f12583).
import { useState, useEffect } from "react";
import { Image as Image2, View } from "react-native";
import LocaleStore from "../../user_settings/LocaleStore";
import IAPStore_android from "../../../stores/native/IAPStore.android";
import { usePremiumPlanSelectStore } from "./PremiumPlanSelectStore";
import { PREMIUM_YEARLY_DISCOUNT_PERCENT } from "../PremiumConstants";
import { Fonts } from "../../../_bundle/Module505";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import TextStyles from "../../rebrand/native/TextStyles";
import { DARK_WHITE_500_LIGHT_BLACK_500 } from "../../../design/migrations/native/LegacyTokens";
import { getPremiumBundledItemsFromProductId } from "./PremiumBundledPlansUtils";
import { useStateFromStores, useStateFromStoresArray } from "../../../_bundle/Module589";
import { formatPercent } from "../../../utils/NumberUtils";
import Alert from "../../../components_native/common/Alert";
import Module12583 from "../../../_bundle/Module12583";
import { LegacyText } from "../../../design/void/native";
import { intl, t } from "../../../intl/index.native";
import { getPremiumTypeDisplayName } from "../../../utils/PremiumUtils";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
marginHorizontal: 26
},
image: {
alignSelf: "center",
marginVertical: 32
},
header: {
...TextStyles(Fonts.DISPLAY_EXTRABOLD, void 0, 24),
alignSelf: "center",
textAlign: "center",
paddingBottom: 8,
color: DARK_WHITE_500_LIGHT_BLACK_500
},
description: {
alignSelf: "center",
textAlign: "center",
paddingBottom: 32,
color: DARK_WHITE_500_LIGHT_BLACK_500
},
upsellButton: {
marginBottom: 16
},
continueButton: {
marginBottom: 4
},
cancelButton: {
marginTop: 8,
marginBottom: 4
}
});
export default function PremiumPlanSelectYearlyUpsellModal(props) {
let setState, c19909_4;
const { onClose, productId } = props;
let orderPriceString = props.orderPriceString;
const { continueWithUpsell, continueWithDefault } = props;
setState = void 0;
c19909_4 = void 0;
const styles = useStyles();
const premiumPlanSelectStore = usePremiumPlanSelectStore((a0) => a0.isPurchasing);
let state;
[state, setState] = useState(null);
const premiumBundledItemsFromProductId = getPremiumBundledItemsFromProductId(productId);
const stateFromStores = useStateFromStores([LocaleStore], () => LocaleStore.locale);
const [r55, r56] = useStateFromStoresArray([IAPStore_android], () => [IAPStore_android.getProduct(productId), IAPStore_android.isBusy()]);
const disabled = premiumPlanSelectStore ? premiumPlanSelectStore : r56;
const premiumTier = premiumBundledItemsFromProductId.premiumTier;
if (orderPriceString == null) {
orderPriceString = r55?.priceString;
}
const r58 = premiumTier == null || orderPriceString == null;
c19909_4 = r58;
useEffect(() => {
if (c19909_4) {
continueWithDefault();
}
});
if (r58) {
return null;
}
const discountPercentage = formatPercent(stateFromStores, PREMIUM_YEARLY_DISCOUNT_PERCENT / 100);
return <Alert onClose={onClose} noDefaultButtons>
<View style={styles.container}>
<Image2 style={styles.image} source={Module12583} />
<LegacyText style={styles.header} accessibilityRole="header">
{intl.format(t.LQCVfK, {
discountPercentage,
planName: getPremiumTypeDisplayName(premiumTier)
})}
</LegacyText>
<LegacyText style={styles.description}>
{intl.format(t["7chOVL"], {
discountPercentage
})}
</LegacyText>
<View style={styles.upsellButton}>
<Button variant="active" text={intl.formatToPlainString(t.Qvq6GE, {
price: orderPriceString
})} onPress={() => {
setState("upsell");
continueWithUpsell();
}} disabled={disabled} loading={state === "upsell" && premiumPlanSelectStore} />
</View>
<View style={styles.continueButton}>
<Button variant="secondary" text={intl.string(t.YwEyQM)} onPress={() => {
setState("default");
continueWithDefault();
}} disabled={disabled} loading={state === "default" && premiumPlanSelectStore} />
</View>
<View style={styles.cancelButton}>
<Button variant="tertiary" text={intl.string(t.cpT0Cq)} onPress={onClose} />
</View>
</View>
</Alert>;
};
@@ -0,0 +1,877 @@
// Metro module 6217 (f6218).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import { useState, useMemo, useCallback } from "react";
import { View, ActivityIndicator } from "react-native";
import { useNativeCheckoutStore } from "../../checkout/native/NativeCheckoutStore";
import LocaleStore from "../../user_settings/LocaleStore";
import IAPStore_android from "../../../stores/native/IAPStore.android";
import { reset, setMobileWebRedirectCheckoutStatus, usePremiumPlanPurchasedStore, setInitiatedPurchaseFromNewFlow } from "./PremiumPlanPurchasedStore";
import { SubscriptionPlans, DISCOUNTS, SubscriptionPlanInfo, PRICE_PLACEHOLDER, SubscriptionIntervalTypes, PremiumTypes, PremiumSubscriptionSKUs, PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY } from "../PremiumConstants";
import { AnalyticEvents, AnalyticsObjects, AnalyticsObjectTypes, MarketingURLs, HelpdeskArticles } from "../../../Constants";
import { TitleStyleType } from "../../../design/void/Form/native/FormConstants";
import { ItemPurchaseType, EUR_TO_HRK_CONVERSION_RATE } from "../../payments/PaymentConstants";
import { CurrencyCodes, PaymentGateways } from "../../../_bundle/Module505";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import PremiumUtils, { getTierDisplayNameByPlanId, castPremiumSubscriptionAsSkuId } from "../../../utils/PremiumUtils";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import Module38 from "../../../_bundle/Module38";
import PremiumPlanActionSheetHeader from "./PremiumPlanActionSheetHeader";
import { formatPercent } from "../../../utils/NumberUtils";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useCheckoutPlanPriceString } from "./hooks/useCheckoutPlanPriceString";
import { formatRate, formatPrice } from "../../../utils/PriceUtils";
import { Button } from "../../../design/components/Button/native/Button.native";
import { useHandlePremiumPurchase } from "./handlePremiumPurchase.android";
import { useIsPaymentsBlocked } from "../../billing/experiments/BlockedPaymentsCountryExperiment";
import useTheme from "../../../hooks/useTheme";
import { usePremiumTrialOffer } from "../hooks/usePremiumTrialOffer.android";
import { usePremiumDiscountOffer } from "../hooks/usePremiumDiscountOffer.android";
import { useDiscountedPremiumProductInfo } from "./hooks/useDiscountedPremiumProductInfo";
import { useBottomSheetRef } from "../../../design/components/Sheet/native/useBottomSheetRef";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import useInitialValue from "../../../hooks/useInitialValue";
import { getNewAnalyticsLoadId, getBasePurchaseFlowAnalyticsFields, PaymentFlowStep, getPaymentFlowStepAnalyticsFields } from "./PremiumAnalyticsUtils";
import * as _MobileWebRedirectCheckoutUtils from "../../payments/utils/MobileWebRedirectCheckoutUtils";
import { getCustomCheckoutFlowForAnalytics } from "../../payments/utils/MobileWebRedirectCheckoutUtils";
import useMountEffect from "../../../hooks/useMountEffect";
import { trackPaymentFlowStartedAnalyticsAndCTP } from "../../experiments/trigger_points/PaymentFlowStartedTriggerPoint";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { goToStandalonePremiumCheckoutFromMobileApp } from "../../payments/native/utils/BillingStandaloneNativeUtils";
import { isMetaQuest } from "../../device/MetaQuestUtils.android";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
import InvalidGooglePlayPurchase from "../../billing/errors/InvalidGooglePlayPurchase";
import { fetchSubscriptions } from "../../billing/actions/BillingActionCreators";
import { getSubscriptionItemsForProduct, getPremiumBundlesWithPredicate } from "./PremiumBundledPlansUtils";
import { isThemeDark } from "../../../design/shared";
import Module6315 from "../../../_bundle/Module6315";
import Module6316 from "../../../_bundle/Module6316";
import Module6317 from "../../../_bundle/Module6317";
import Module6318 from "../../../_bundle/Module6318";
import Module6319 from "../../../_bundle/Module6319";
import Module6320 from "../../../_bundle/Module6320";
import { isAndroid, isIOS } from "../../../utils/PlatformUtils";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import BlockedPaymentsCountryDisplay from "../../billing/native/BlockedPaymentsCountryDisplay";
import { ActionSheetHeaderBar } from "../../../design/components/Sheet/native/ActionSheetHeaderBar.native";
import FastImage from "../../../components_native/common/FastImage";
import FormSection from "../../../design/void/Form/native/FormSection";
import PaymentFlowWarningMessage from "../../billing/native/PaymentFlowWarningMessage";
import { RadioGroup } from "../../../design/void/native";
import { NitroACOMSubscriptionExperiment } from "../../billing/native/ACOMExperiments";
import { useIsEligibleForBogoOffer } from "./hooks/useIsEligibleForBogoOffer.android";
import NativeCheckoutStoreProvider from "../../checkout/native/stores/NativeCheckoutStoreProvider";
function $mk78038($env) {
return ({ additionalPlans, isDeprecated, numPremiumGuild, premiumTier }) => additionalPlans.length === 0 && !isDeprecated && numPremiumGuild === 0 && premiumTier === $env[0];
}
function $mk114907($env) {
return () => {
if (isMetaQuest()) {
(0, reset)();
ActionSheetActionCreators.hideActionSheet();
} else {
const r9 = $env;
(0, setMobileWebRedirectCheckoutStatus)("in_mobile_web");
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_STEP, r9[4]);
}
};
}
function $mk114908($env) {
return () => {
AlertActionCreators.show({
title: intl.string(t.NrBVjw),
body: intl.string(t["gD+grx"]),
hideActionSheet: true
});
};
}
let PlanOptionBadgeComponent, PlanOption, PremiumPlanSelectionActionSheetCTA, PremiumPlanSelectionActionSheet, _excluded, useStyles;
let env3945 = {};
const Header = function Header(props) {
let premiumType2 = props.premiumType;
const { isPaymentSuccess, selectedPremiumType, trialOffer, discountOffer } = props;
const styles = useStyles();
const r23 = (0, useNativeCheckoutStore)((a0) => ({
orderRequired: a0.orderRequired,
orderRecord: a0.orderRecord
}));
const { orderRequired, orderRecord } = r23;
if (premiumType2 == null && !isPaymentSuccess) {
return <Text style={styles.headerText} variant="text-md/semibold" color="text-default" accessibilityRole="header">
{intl.string(t.vLz3Zs)}
</Text>;
}
if (isPaymentSuccess) {
premiumType2 = selectedPremiumType;
}
Module38(premiumType2 != null, "If isPaymentSuccess is true, a value must be given for selectedPremiumType. Or premiumType must be given.");
let r44 = trialOffer != null && premiumType2 != null;
if (r44) {
let r51 = trialOffer.subscription_trial?.sku_id === PremiumUtils.getSkuIdForPremiumType(premiumType2);
if (r51) {
let r3 = !orderRequired;
if (orderRequired) {
const trial_id = trialOffer.trial_id;
const r4 = orderRecord == null;
let r53 = void 0;
if (!r4) {
const subscriptionFacet = orderRecord.subscriptionFacet;
r53 = subscriptionFacet == null ? void 0 : subscriptionFacet.subscriptionPreview?.subscriptionTrialId;
}
r3 = trial_id === r53;
}
r51 = r3;
}
r44 = r51;
}
return (0, jsx)(PremiumPlanActionSheetHeader, {
premiumType: premiumType2,
trialOffer: r44 ? trialOffer : null,
discountOffer
});
};
PlanOptionBadgeComponent = function PlanOptionBadgeComponent(props) {
const { text, backgroundColorType = "green" } = props;
const styles = useStyles();
const style = [styles.planOptionDiscount, ,];
const r1 = backgroundColorType === "white";
style[1] = r1 ? styles.planOptionDiscountWhite : null;
return <View style={style}>
<Text style={styles.planOptionDiscountText} variant="text-xs/bold" color={r1 ? "text-overlay-dark" : "text-overlay-light"}>{text}</Text>
</View>;
};
PlanOption = function PlanOption(props) {
let r30, r222;
const { premiumItem, selectedProductId, optionNeedsProductNameLabel: optionNeedsProductNameLabel2 } = props;
let customBadgeComponent = props.customBadgeComponent;
const { trialOffer, discountOffer, discountedPriceString: discountedPriceString2 } = props;
let userIsEligibleForBogoPromotion2 = props.userIsEligibleForBogoPromotion;
if (userIsEligibleForBogoPromotion2 === void 0) {
userIsEligibleForBogoPromotion2 = false;
}
const selectedPremiumType = props.selectedPremiumType;
const styles = useStyles();
const [state, setState] = useState(0);
const stateFromStores = useStateFromStores([IAPStore_android], () => IAPStore_android.getProduct(premiumItem.productId));
let price = useCheckoutPlanPriceString(premiumItem.productId, stateFromStores);
const r60 = (0, useNativeCheckoutStore)((a0) => ({
orderRequired: a0.orderRequired,
orderRecord: a0.orderRecord
}));
const { orderRequired, orderRecord } = r60;
const premiumTier = premiumItem.premiumTier;
let r4 = trialOffer != null && premiumTier != null;
if (r4) {
let r68 = trialOffer.subscription_trial?.sku_id === PremiumUtils.getSkuIdForPremiumType(premiumTier);
if (r68) {
let r6 = !orderRequired;
if (orderRequired) {
const trial_id = trialOffer.trial_id;
const r7 = orderRecord == null;
let r70 = void 0;
if (!r7) {
const subscriptionFacet = orderRecord.subscriptionFacet;
r70 = subscriptionFacet == null ? void 0 : subscriptionFacet.subscriptionPreview?.subscriptionTrialId;
}
r6 = trial_id === r70;
}
r68 = r6;
}
r4 = r68;
}
const tierDisplayNameByPlanId = getTierDisplayNameByPlanId(premiumItem.basePlanId);
const intervalString = PremiumUtils.getIntervalString(premiumItem.interval, false);
const basePlanId = premiumItem.basePlanId;
const PREMIUM_YEAR_TIER_2 = SubscriptionPlans.PREMIUM_YEAR_TIER_2;
const r31 = r4 || discountOffer != null || (userIsEligibleForBogoPromotion2 ? basePlanId === PREMIUM_YEAR_TIER_2 : userIsEligibleForBogoPromotion2);
const r41 = r31 ? null : DISCOUNTS[premiumItem.basePlanId];
if (userIsEligibleForBogoPromotion2) {
userIsEligibleForBogoPromotion2 = premiumItem.basePlanId === SubscriptionPlans.PREMIUM_MONTH_TIER_2;
}
const productId2 = premiumItem.productId;
const r35 = stateFromStores == null ? CurrencyCodes.USD : stateFromStores.currencyCode.toLowerCase() in CurrencyCodes ? stateFromStores.currencyCode.toLowerCase() : CurrencyCodes.USD;
const r104 = SubscriptionPlanInfo[premiumItem.basePlanId];
const discountedPrice = discountedPriceString2 != null ? formatRate(discountedPriceString2, r104.interval, r104.intervalCount) : null;
if (r4) {
r30 = intl.formatToPlainString(t.hXcaLT, {
price: formatPrice(0, r35, {
minimumFractionDigits: 0,
maximumFractionDigits: 0
})
});
} else {
r30 = discountedPriceString2;
if (r30 == null) {
r30 = price == null ? PRICE_PLACEHOLDER : price;
}
}
const regularPrice = formatRate(price == null ? PRICE_PLACEHOLDER : price, r104.interval, r104.intervalCount);
const style = state > 0 ? [styles.planOptionPriceContainer, {
transform: [{
translateY: state / 2
}]
}] : styles.planOptionPriceContainer;
const variant = discountOffer == null ? r4 ? "text-lg/medium" : "text-md/medium" : "text-lg/medium";
const r148 = productId2 === selectedProductId;
let color = "interactive-text-default";
const r159 = [<Text variant={variant} color={r148 ? "interactive-text-active" : "interactive-text-default"}>
{optionNeedsProductNameLabel2 ? `${tierDisplayNameByPlanId} ${intervalString}` : intervalString}
</Text>, ,];
if (customBadgeComponent == null) {
customBadgeComponent = r31 ? null : userIsEligibleForBogoPromotion2 ? <PlanOptionBadgeComponent text={intl.string(t.iQTfWx)} /> : r41 != null ? <PlanOptionBadgeComponent text={intl.format(t.IAybsG, {
discount: formatPercent(LocaleStore.locale, r41 / 100)
})} /> : null;
}
const r202 = [<View style={styles.planOptionDiscountContainer}>
{customBadgeComponent}
<Text style={styles.priceText} variant="text-lg/medium" color={r148 ? "interactive-text-active" : "interactive-text-default"}>{r30}</Text>
</View>, , ,];
let r203 = null;
if (r4) {
const color2 = r148 ? "text-default" : "interactive-text-default";
if (premiumItem.interval === SubscriptionIntervalTypes.YEAR) {
const ECT4A5 = t.ECT4A5;
if (price == null) {
price = PRICE_PLACEHOLDER;
}
r222 = intl.formatToPlainString(ECT4A5, {
price
});
} else {
r222 = intl.formatToPlainString(t.v9QeON, {
price: price == null ? PRICE_PLACEHOLDER : price
});
}
r203 = <Text variant="text-xs/medium" color={color2}>{r222}</Text>;
}
r202[1] = r203;
const props2 = {
style: styles.discountSubTextContainer,
onLayout: (a0) => {
const height = a0.nativeEvent.layout.height;
if (height !== state) {
setState(height);
}
},
children: null
};
const r235 = discountedPrice != null;
let r236 = null;
if (r235) {
const r237 = discountOffer != null;
r236 = null;
if (r237) {
const r238 = selectedPremiumType == null;
r236 = null;
if (r238) {
const color3 = r148 ? "text-default" : "interactive-text-default";
const r251 = t["02Gmgm"];
let numMonths = discountOffer.discount?.userUsageLimit;
if (numMonths == null) {
numMonths = 1;
}
r236 = <Text variant="text-sm/medium" color={color3}>
{intl.formatToPlainString(r251, {
discountedPrice,
numMonths
})}
</Text>;
}
}
}
const children = [r236, ,];
let r258 = discountedPriceString2 != null && discountOffer != null;
if (r258) {
if (r148) {
color = "text-default";
}
const r270 = t["vZk+c/"];
let numMonths2 = discountOffer.discount?.userUsageLimit;
if (numMonths2 == null) {
numMonths2 = 1;
}
r258 = <Text variant="text-sm/medium" color={color}>
{intl.formatToPlainString(r270, {
regularPrice,
numMonths: numMonths2
})}
</Text>;
}
children[1] = r258;
props2.children = children;
r202[2] = <View {...props2} />;
r159[1] = <View style={style}>{r202}</View>;
return <View style={styles.planOptionContainer}>{r159}</View>;
};
PremiumPlanSelectionActionSheetCTA = function PremiumPlanSelectionActionSheetCTA(props) {
const { isPaymentSuccess, onClose: onClose2, ctaText, onStartPayment, shouldUseMobileWebRedirectCheckout, disabled, loading } = props;
if (isPaymentSuccess) {
return <Button text={intl.string(t.WAI6xu)} size="md" grow onPress={onClose2} />;
}
return <Button text={ctaText} {...shouldUseMobileWebRedirectCheckout ? {
size: "lg",
variant: "primary"
} : {
size: "md",
variant: "active"
}} grow onPress={() => onStartPayment({
shouldRedirectToMobileWeb: shouldUseMobileWebRedirectCheckout
})} loading={loading} disabled={disabled} />;
};
PremiumPlanSelectionActionSheet = function PremiumPlanSelectionActionSheet(props) {
let r309, r387, r400;
let env15588 = {
$parent: env3945
};
env15588[0] = props.applicationId;
const { analyticsLocation, analyticsLocations, premiumType: premiumType2 } = props;
env15588[1] = premiumType2;
const premiumItems = props.premiumItems;
env15588[2] = premiumItems;
const { userIsEligibleForBogoPromotion: userIsEligibleForBogoPromotion2, initialSelectedItem, onPaymentSuccess } = props;
env15588[3] = onPaymentSuccess;
const onPaymentDismiss = props.onPaymentDismiss;
env15588[4] = onPaymentDismiss;
let showFormTitle = props.showFormTitle;
if (showFormTitle === void 0) {
showFormTitle = true;
}
env15588[5] = void 0;
env15588[6] = void 0;
env15588[7] = void 0;
env15588[8] = void 0;
env15588[9] = void 0;
env15588[10] = void 0;
env15588[11] = void 0;
env15588[12] = void 0;
env15588[13] = void 0;
env15588[14] = void 0;
env15588[15] = void 0;
env15588[16] = void 0;
env15588[17] = void 0;
env15588[18] = void 0;
env15588[19] = void 0;
env15588[20] = void 0;
env15588[22] = void 0;
env15588[21] = function _onPlanSelectionChange() {
const r9 = async (c29691_0) => {
let c29691_1, c29691_2;
L19: {
L18: {
L16: {
let env31403;
c29691_2 = env15588;
const r11 = env31403 = {
$parent: env3945
};
c29691_1 = r11;
env31403[0] = c29691_0;
env31403[1] = void 0;
const r26 = env15588[2].find((item) => item.productId === env31403[0]);
env31403[1] = r26;
if (r26 == null) {
break L19;
}
if (r26 === env15588[13]) {
break L19;
}
const subscriptionItemsForProduct = getSubscriptionItemsForProduct(c29691_0);
if (env15588[10]) {
if (await (0, env15588[9])(subscriptionItemsForProduct.map((item) => ({
sku_id: castPremiumSubscriptionAsSkuId(PremiumUtils.getSkuIdForPlan(item.planId)),
subscription_plan_id: item.planId,
quantity: item.quantity,
purchase_type: ItemPurchaseType.SUBSCRIPTION
}))) != null) {
(0, env15588[14])(env31403[1]);
break L18;
}
break L16;
}
(0, env15588[14])(env31403[1]);
break L19;
}
return void 0;
}
return void 0;
}
};
env15588[21] = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
env15588[5] = styles;
const premiumPlanPurchasedStore2 = usePremiumPlanPurchasedStore((a0) => a0.isPaymentSuccess);
env15588[6] = premiumPlanPurchasedStore2;
const premiumPlanPurchasedStore = usePremiumPlanPurchasedStore((a0) => a0.mobileWebRedirectCheckoutStatus);
let loading = useStateFromStores([IAPStore_android], () => IAPStore_android.isBusy());
const handlePremiumPurchase = useHandlePremiumPurchase();
env15588[7] = handlePremiumPurchase;
const isPaymentsBlocked = useIsPaymentsBlocked();
const theme = useTheme();
const nativeCheckoutStore = useNativeCheckoutStore((a0) => a0.orderRecord);
env15588[8] = nativeCheckoutStore;
const nativeCheckoutStore2 = useNativeCheckoutStore((a0) => ({
patchOrderLineItems: a0.patchOrderLineItems,
isPatchOrderLoading: a0.isPatchOrderLoading,
orderRequired: a0.orderRequired
}));
env15588[9] = nativeCheckoutStore2.patchOrderLineItems;
let isPatchOrderLoading = nativeCheckoutStore2.isPatchOrderLoading;
const orderRequired = nativeCheckoutStore2.orderRequired;
env15588[10] = orderRequired;
const nativeCheckoutStore3 = useNativeCheckoutStore((a0) => a0.isCreateOrderLoading);
if (!isPatchOrderLoading) {
isPatchOrderLoading = nativeCheckoutStore3;
}
const premiumTrialOffer2 = usePremiumTrialOffer();
const premiumDiscountOffer2 = usePremiumDiscountOffer();
let r2 = premiumTrialOffer2 != null && premiumType2 != null;
if (r2) {
let r94 = premiumTrialOffer2.subscription_trial?.sku_id === PremiumUtils.getSkuIdForPremiumType(premiumType2);
if (r94) {
let r5 = !orderRequired;
if (orderRequired) {
const trial_id = premiumTrialOffer2.trial_id;
const r6 = nativeCheckoutStore == null;
let r96 = void 0;
if (!r6) {
const subscriptionFacet = nativeCheckoutStore.subscriptionFacet;
r96 = subscriptionFacet == null ? void 0 : subscriptionFacet.subscriptionPreview?.subscriptionTrialId;
}
r5 = trial_id === r96;
}
r94 = r5;
}
r2 = r94;
}
env15588[11] = r2;
const discountedPremiumProductInfo = useDiscountedPremiumProductInfo(premiumDiscountOffer2, premiumItems);
const { discountedProduct, discountedPriceString: discountedPriceString2 } = discountedPremiumProductInfo;
env15588[12] = discountedPriceString2;
const r109 = _slicedToArray(useState(initialSelectedItem), 2);
const r34 = r109[0];
env15588[13] = r34;
env15588[14] = r109[1];
const stateFromStores = useStateFromStores([IAPStore_android], () => {
const r2 = env15588[13];
return r2 != null ? IAPStore_android.getProduct(r2.productId) : null;
});
const bottomSheetRef = useBottomSheetRef().bottomSheetRef;
const analyticsLocations2 = useAnalyticsLocations(analyticsLocations, AnalyticsLocation.PREMIUM_PAYMENT_ACTION_SHEET).analyticsLocations;
env15588[15] = analyticsLocations2;
const initialValue = useInitialValue(() => getNewAnalyticsLoadId());
env15588[16] = initialValue;
const memo = useMemo(() => castPremiumSubscriptionAsSkuId(PremiumUtils.getSkuIdForPremiumType(env15588[1])), [premiumType2]);
env15588[17] = memo;
const basePurchaseFlowAnalyticsFields = getBasePurchaseFlowAnalyticsFields({
analyticsLoadId: initialValue,
analyticsLocation: {
object: AnalyticsObjects.BUTTON_CTA,
object_type: AnalyticsObjectTypes.BUY,
...analyticsLocation
},
analyticsLocations: analyticsLocations2
});
env15588[18] = basePurchaseFlowAnalyticsFields;
const r145 = r34 != null ? r34.basePlanId : null;
const onClose = function onClose() {
(0, reset)();
ActionSheetActionCreators.hideActionSheet();
};
env15588[19] = r145;
const isMobileWebRedirectCheckoutEnabled = _MobileWebRedirectCheckoutUtils.isMobileWebRedirectCheckoutEnabled();
env15588[20] = isMobileWebRedirectCheckoutEnabled;
useMountEffect(() => {
trackPaymentFlowStartedAnalyticsAndCTP({
...env15588[18],
application_id: env15588[0],
subscription_plan_id: env15588[19],
sku_id: env15588[17],
custom_checkout_flow: env15588[20] ? getCustomCheckoutFlowForAnalytics() : void 0
});
});
const callback = useCallback(async function(c25749_0) {
let c25749_1, c25749_2, c25749_3;
let c25749_4 = 0;
const r12 = env15588;
L25: {
try {
let env29692;
c25749_2 = r12;
const r37 = env29692 = {
$parent: r12
};
c25749_1 = r37;
env29692[0] = void 0;
let r16 = c25749_0;
if (r16 === void 0) {
r16 = {
shouldRedirectToMobileWeb: false
};
}
env29692[0] = r16.shouldRedirectToMobileWeb;
env29692[1] = void 0;
env29692[2] = void 0;
env29692[3] = void 0;
env29692[4] = void 0;
await void 0;
Module38(env15588[13] != null, "cannot start payment without a selectedItem");
env29692[1] = env15588[13].basePlanId;
env29692[2] = env15588[20] && env29692[0];
env29692[3] = env29692[2] ? PaymentFlowStep.MOBILE_WEB_REDIRECT_CHECKOUT : PaymentFlowStep.EXTERNAL_PAYMENT;
env29692[4] = getPaymentFlowStepAnalyticsFields(env15588[18], {
from_step: PaymentFlowStep.PLAN_SELECT,
to_step: env29692[3],
subscription_plan_gateway_plan_id: env15588[13].productId,
sku_id: env15588[17]
});
if (!env29692[2]) {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_STEP, env29692[4]);
}
(0, setInitiatedPurchaseFromNewFlow)({
productId: env15588[13].productId,
onPaymentSuccess: env15588[3],
onPaymentDismiss: env15588[4]
});
if (env29692[2]) {
const r120 = c25749_1;
const r130 = {
planId: env29692[1],
isGift: false,
loadId: env15588[16]
};
const r23 = $mk114908(env15588.$parent);
goToStandalonePremiumCheckoutFromMobileApp("premium_plan_selection_action_sheet", r130, $mk114907(r120), r23);
} else {
c25749_4 = 1;
await env15588[7]({
productId: env15588[13].productId,
analyticsLocation: env15588[18].location,
analyticsLoadId: env15588[16],
analyticsLocations: env15588[15],
orderId: env15588[8]?.id
});
c25749_4 = 0;
}
} catch ($e) {
const r35 = $e;
let r7 = r35;
c25749_3 = r35;
if (c25749_4 !== 0) {
while (true) {
try {
const r172 = c25749_3;
c25749_4 = 0;
env29692[5] = r172;
if (env29692[5] instanceof InvalidGooglePlayPurchase) {
fetchSubscriptions();
AlertActionCreators.show({
title: intl.string(t["U+H+kd"]),
body: intl.string(t.F9ktNa),
hideActionSheet: true
});
break L25;
}
throw env29692[5];
} catch (r168) {
r7 = r168;
c25749_3 = r168;
if (c25749_4 === 0) {
break;
}
}
}
}
throw r7;
}
}
}, [memo, basePurchaseFlowAnalyticsFields, initialValue, analyticsLocations2, handlePremiumPurchase, isMobileWebRedirectCheckoutEnabled, onPaymentDismiss, onPaymentSuccess, nativeCheckoutStore, r34]);
const memo2 = useMemo(() => env15588[20] ? intl.string(t.rylrdY) : env15588[11] ? isAndroid() ? intl.string(t.rKD72m) : intl.string(t.bboTul) : intl.string(t.nIlrxd), [r2, isMobileWebRedirectCheckoutEnabled]);
env15588[22] = memo2;
const memo3 = useMemo(() => {
if (env15588[6]) {
return null;
}
const interval = env15588[13]?.interval;
if (interval == null) {
return null;
}
if (env15588[11]) {
return <Text style={env15588[5].legalDisclaimerText} variant="text-xxs/medium">
{intl.format(isAndroid() ? t.tINI9V : t.ZWXtAj, {
paidURL: MarketingURLs.PAID_TERMS,
interval: PremiumUtils.getIntervalStringAsNoun(interval),
cancelURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.PREMIUM_DETAILS_CANCEL_SUB)
})}
</Text>;
}
if (env15588[12] != null) {
return (0, jsx)(Text, {
style: env15588[5].legalDisclaimerText,
variant: "text-xxs/medium",
children: intl.format(t["3uC7vj"], {
buttonText: env15588[22],
interval: PremiumUtils.formatInterval(interval),
cancelSubscriptionArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.PREMIUM_DETAILS_CANCEL_SUB),
paidServiceTermsArticle: HelpdeskUtils.getArticleURL(HelpdeskArticles.PAID_TERMS)
})
});
}
return (0, jsx)(Text, {
style: env15588[5].legalDisclaimerText,
variant: "text-xxs/medium",
children: intl.format(isAndroid() ? t.COObWR : t["7wpqfj"], {
paidURL: MarketingURLs.PAID_TERMS,
interval: PremiumUtils.getIntervalStringAsNoun(interval),
ctaText: env15588[22]
})
});
}, [premiumPlanPurchasedStore2, r34, r2, discountedPriceString2, memo2, styles.legalDisclaimerText]);
if (isPaymentsBlocked) {
r400 = <View style={styles.blockedPaymentContainer}>
<BlockedPaymentsCountryDisplay />
<ActionSheetHeaderBar variant="floating" onPress={onClose} />
</View>;
} else {
const r185 = [<Header premiumType={premiumType2} isPaymentSuccess={premiumPlanPurchasedStore2} selectedPremiumType={r34?.premiumTier} trialOffer={premiumTrialOffer2} discountOffer={discountedPriceString2 != null ? premiumDiscountOffer2 : null} />, , ,];
if (premiumPlanPurchasedStore === "in_mobile_web") {
r387 = <ActivityIndicator size="large" style={styles.loadingIndicator} />;
} else {
if (premiumPlanPurchasedStore2) {
const premiumTier = r34?.premiumTier;
const r344 = [<FastImage source={PremiumTypes.TIER_0 === premiumTier ? isThemeDark(theme) ? Module6315 : Module6316 : PremiumTypes.TIER_1 === premiumTier ? isThemeDark(theme) ? Module6317 : Module6318 : PremiumTypes.TIER_2 === premiumTier ? isThemeDark(theme) ? Module6319 : Module6320 : void 0} />, ,];
const premiumTier2 = r34?.premiumTier;
r344[1] = <Text style={styles.contentActivatedText} variant="text-md/semibold">
{PremiumTypes.TIER_0 === premiumTier2 ? intl.string(t["6WWrVM"]) : PremiumTypes.TIER_1 === premiumTier2 ? intl.string(t.LAAgsy) : PremiumTypes.TIER_2 === premiumTier2 ? intl.string(t.I7xNzI) : void 0}
</Text>;
r309 = <View style={styles.contentActivated}>{r344}</View>;
} else {
const r53 = {
convertToMajorUnits: isAndroid()
};
if (showFormTitle) {
showFormTitle = !r2;
}
const r232 = [r2 ? <Text variant="text-md/normal" color="text-strong" style={styles.trialDisclaimer}>
{intl.string(t.u95Dt4)}
</Text> : discountedPriceString2 != null ? discountedProduct != null ? premiumType2 != null ? <View>
<Text variant="text-md/normal" color="text-strong" style={styles.discountDisclaimer}>
{intl.format(t.yBn7uz, {
regularPrice: discountedProduct.priceString,
discountedPrice: discountedPriceString2
})}
</Text>
<View style={[styles.divider, styles.offerDividerMargin]} />
</View> : null : null : null, ,];
const title = showFormTitle ? intl.string(t.u95Dt4) : void 0;
const sectionBodyStyle = [styles.formSectionBody, showFormTitle ? !showFormTitle : styles.formSectionBodyWithNoTitle];
const r278 = [stateFromStores != null && stateFromStores.countryCode === "HR" && stateFromStores.currencyCode.toLowerCase() === CurrencyCodes.EUR && <PaymentFlowWarningMessage message={intl.formatToPlainString(t["9hnZoK"], {
kunaPriceWithCurrency: formatPrice(stateFromStores.price * EUR_TO_HRK_CONVERSION_RATE, CurrencyCodes.HRK, r53)
})} />, ,];
const productId2 = r34?.productId;
const productId3 = r34?.productId;
const identifier2 = discountedProduct?.identifier;
const productId = productId3;
const premiumTrialOffer = premiumTrialOffer2;
const premiumDiscountOffer = premiumDiscountOffer2;
const identifier = identifier2;
const discountedPriceString = discountedPriceString2;
const userIsEligibleForBogoPromotion = userIsEligibleForBogoPromotion2;
const premiumType = premiumType2;
const optionNeedsProductNameLabel = new Set(premiumItems.map((premiumItem) => premiumItem.premiumTier)).size > 1;
r278[1] = <RadioGroup value={productId2} options={premiumItems.map((a0) => ({
name: <PlanOption premiumItem={a0} selectedProductId={productId} optionNeedsProductNameLabel={optionNeedsProductNameLabel} trialOffer={premiumTrialOffer} discountOffer={premiumDiscountOffer} discountedPriceString={a0.productId === identifier ? discountedPriceString : null} userIsEligibleForBogoPromotion={userIsEligibleForBogoPromotion} selectedPremiumType={premiumType} />,
value: a0.productId
}))} onChange={(event) => (function onPlanSelectionChange(a0) {
return env15588[21].apply(this, arguments);
})(event.value)} withDividers={false} style={styles.planOptionRowContainer} disabled={loading ? loading : isPatchOrderLoading} indicatorLeft />;
r232[1] = <FormSection title={title} titleStyleType={TitleStyleType.NO_BORDER_OR_MARGIN} titleViewStyle={styles.formTitle} sectionBodyStyle={sectionBodyStyle} inset>{r278}</FormSection>;
r309 = <View style={styles.contentSelectPlan}>{r232}</View>;
}
const r381 = [r309, ,];
const disabled = loading ? loading : isPatchOrderLoading;
if (!loading) {
loading = isPatchOrderLoading;
}
r381[1] = <PremiumPlanSelectionActionSheetCTA isPaymentSuccess={premiumPlanPurchasedStore2} onClose={onClose} ctaText={memo2} onStartPayment={callback} shouldUseMobileWebRedirectCheckout={isMobileWebRedirectCheckoutEnabled} disabled={disabled} loading={loading} />;
r387 = <>{r381}</>;
}
r185[1] = <View style={styles.body}>
{r387}
{isMobileWebRedirectCheckoutEnabled ? !isMobileWebRedirectCheckoutEnabled : memo3}
</View>;
r185[2] = <ActionSheetHeaderBar variant="floating" onPress={onClose} />;
r400 = <>{r185}</>;
}
return <BottomSheet ref={bottomSheetRef} handleDisabled onDismiss={reset} startExpanded>{r400}</BottomSheet>;
};
_excluded = ["predicate", "initialSelectedCriteria", "sortFn"];
useStyles = createStyles({
body: {
padding: 16
},
headerText: {
paddingTop: 30,
paddingHorizontal: 20
},
contentSelectPlan: {
marginBottom: 16
},
contentActivated: {
alignItems: "center",
paddingTop: 40,
paddingBottom: 56
},
contentActivatedText: {
width: 328,
marginTop: 16,
textAlign: "center"
},
formTitle: {
paddingTop: 0,
paddingLeft: 0
},
formSectionBody: {
backgroundColor: "none"
},
formSectionBodyWithNoTitle: {
marginTop: -24
},
planOptionRowContainer: {
paddingHorizontal: 10
},
planOptionContainer: {
display: "flex",
flexDirection: "row",
alignItems: "center"
},
planOptionPriceContainer: {
flexGrow: 1,
flexShrink: 1,
display: "flex",
flexDirection: "column",
alignItems: "flex-end"
},
planOptionDiscountContainer: {
display: "flex",
flexDirection: "row",
flexShrink: 1
},
planOptionDiscount: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
borderRadius: Module712.radii.lg,
backgroundColor: Module712.unsafe_rawColors.GREEN_360,
paddingVertical: 2,
paddingHorizontal: 8,
marginRight: 8
},
planOptionDiscountWhite: {
backgroundColor: Module712.colors.WHITE
},
planOptionDiscountText: {
textTransform: "uppercase"
},
blockedPaymentContainer: {
marginVertical: 40
},
legalDisclaimerText: {
marginTop: 16
},
divider: {
height: 1,
width: "100%",
backgroundColor: Module712.colors.BORDER_SUBTLE
},
offerDividerMargin: {
marginBottom: 8
},
trialDisclaimer: {
marginBottom: 8
},
discountDisclaimer: {
marginBottom: 20
},
loadingIndicator: {
marginVertical: 30
},
discountSubTextContainer: {
alignItems: "flex-end"
},
priceText: {
flexShrink: 1
}
});
export default function PremiumPlanSelectionActionSheetWithOrderCTX(props) {
let r13, APPLE_ADVANCED_COMMERCE, PaymentGateways2, paymentGateway;
const enabled = NitroACOMSubscriptionExperiment.useConfig({
location: "PremiumPlanSelectionActionSheetWithOrderCTX"
}).enabled;
if (isIOS()) {
if (enabled) {
APPLE_ADVANCED_COMMERCE = PaymentGateways.APPLE_ADVANCED_COMMERCE;
PaymentGateways2 = PaymentGateways;
} else {
APPLE_ADVANCED_COMMERCE = PaymentGateways.APPLE;
PaymentGateways2 = PaymentGateways;
}
r13 = PaymentGateways2;
paymentGateway = APPLE_ADVANCED_COMMERCE;
} else {
paymentGateway = PaymentGateways.GOOGLE;
r13 = PaymentGateways;
}
let predicate = props.predicate;
if (predicate === void 0) {
let premiumType2 = props.premiumType;
if (premiumType2 == null) {
premiumType2 = PremiumTypes.TIER_2;
}
let env15591;
const r32 = env15591 = {};
env15591[0] = premiumType2;
predicate = $mk78038(r32);
}
let initialSelectedCriteria = props.initialSelectedCriteria;
if (initialSelectedCriteria === void 0) {
initialSelectedCriteria = (a0) => a0.interval === SubscriptionIntervalTypes.YEAR;
}
const { sortFn = (a0, a1) => a1.interval - a0.interval, ...rest } = props;
const trial_id = usePremiumTrialOffer()?.trial_id;
const initialSubscriptionFacet = trial_id != null ? {
subscription_preview: {
subscription_trial_id: trial_id
}
} : void 0;
const isEligibleForBogoOffer = useIsEligibleForBogoOffer();
const premiumItems = sortFn == null ? getPremiumBundlesWithPredicate(predicate) : getPremiumBundlesWithPredicate(predicate).sort(sortFn);
if (isEligibleForBogoOffer) {
initialSelectedCriteria = (a0) => a0.interval === SubscriptionIntervalTypes.MONTH;
}
const initialSelectedItem = premiumItems.find(initialSelectedCriteria);
return <NativeCheckoutStoreProvider paymentGateway={paymentGateway} orderRequired={paymentGateway === r13.APPLE_ADVANCED_COMMERCE} skuIds={[]} defaultPlans={initialSelectedItem != null ? getSubscriptionItemsForProduct(initialSelectedItem.productId).map((item) => ({
subscriptionPlanId: item.planId,
skuId: castPremiumSubscriptionAsSkuId(PremiumUtils.getSkuIdForPlan(item.planId)),
quantity: item.quantity
})) : [{
subscriptionPlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
skuId: castPremiumSubscriptionAsSkuId(PremiumSubscriptionSKUs.TIER_2),
quantity: 1
}]} isGift={false} activeSubscription={null} initialSubscriptionFacet={initialSubscriptionFacet} onOrderRetryCancellation={() => ActionSheetActionCreators.hideActionSheet(PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY)}>
<PremiumPlanSelectionActionSheet {...rest} premiumItems={premiumItems} userIsEligibleForBogoPromotion={isEligibleForBogoOffer} initialSelectedItem={initialSelectedItem} />
</NativeCheckoutStoreProvider>;
};
export function getItemsByPremiumTypePredicate(a0) {
let env15590;
const r0 = env15590 = {};
env15590[0] = a0;
return $mk78038(r0);
}
@@ -0,0 +1,156 @@
// Metro module 6536 (f6537).
import { useMemo } from "react";
import { View } from "react-native";
import { PremiumTypes } from "../PremiumConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import FastImage from "../../../components_native/common/FastImage";
import { Text } from "../../../design/components/Text/native/Text";
import { getPremiumTypeFromSubscription, getPremiumTypeDisplayName } from "../../../utils/PremiumUtils";
import useAnalyticsLocations from "../../app_analytics/useAnalyticsLocations";
import { useWhatYouLoseProfileTier1Source } from "../../../design/components/Illustration/native/redesign/generated/WhatYouLoseProfileTier1";
import Module38 from "../../../_bundle/Module38";
import Module6542 from "../../../_bundle/Module6542";
import { intl, t } from "../../../intl/index.native";
import Module6543 from "../../../_bundle/Module6543";
import Module6205 from "../../../_bundle/Module6205";
import Module6544 from "../../../_bundle/Module6544";
import Module6545 from "../../../_bundle/Module6545";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import PremiumPlanActionSheetHeader from "./PremiumPlanActionSheetHeader";
import { Button } from "../../../design/components/Button/native/Button.native";
import { STEP_ANALYTICS_NAMES, CancellationFlowSteps, trackPremiumSubscriptionCancellationFlowStep } from "./PremiumAnalyticsUtils";
let useStyles, c4205_10;
const WhatYouLoseItem = function WhatYouLoseItem(props) {
const { imageSource, text } = props;
const styles = useStyles();
return <View style={styles.item}>
<FastImage source={imageSource} />
<Text variant="text-md/medium" style={styles.itemLabel}>{text}</Text>
</View>;
};
useStyles = createStyles({
body: {
paddingTop: 24,
paddingHorizontal: 24
},
title: {
marginBottom: 8,
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY
},
subtitle: {
marginBottom: 16,
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY
},
item: {
marginBottom: 16,
borderRadius: Module712.radii.sm,
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
padding: 16
},
itemLabel: {
marginTop: 8
},
footer: {
paddingHorizontal: 16
},
button: {
marginBottom: 8
},
keepText: {
textAlign: "center",
paddingVertical: 8,
color: Module712.colors.TEXT_SUBTLE
}
});
c4205_10 = {
DOWNGRADE: 0,
0: "DOWNGRADE",
CANCEL: 1,
1: "CANCEL"
};
export default function PremiumPlanWhatYouLoseActionSheet(props) {
const { mode, onContinue, subscription } = props;
const styles = useStyles();
const premiumTypeFromSubscription = getPremiumTypeFromSubscription(subscription);
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
const whatYouLoseProfileTier1Source = useWhatYouLoseProfileTier1Source();
Module38(premiumTypeFromSubscription != null, "Expected premium type");
const memo = useMemo(() => {
if (PremiumTypes.TIER_0 === premiumTypeFromSubscription) {
return [{
imageSource: Module6542,
text: intl.format(t["0hUHi6"], {})
}, {
imageSource: Module6543,
text: intl.format(t.wFWO6D, {})
}];
}
if (PremiumTypes.TIER_1 === premiumTypeFromSubscription) {
return [{
imageSource: whatYouLoseProfileTier1Source,
text: intl.format(t.xCaYwE, {})
}, {
imageSource: Module6205,
text: intl.format(t.wK04T1, {})
}, {
imageSource: Module6544,
text: intl.format(t.K4Hv69, {})
}];
}
if (PremiumTypes.TIER_2 === premiumTypeFromSubscription) {
return [{
imageSource: Module6545,
text: intl.format(t["gpqr+n"], {})
}, {
imageSource: Module6544,
text: intl.format(t.wRxEDW, {})
}, {
imageSource: Module6205,
text: intl.format(t["4WZ7T2"], {})
}];
}
return [];
}, [premiumTypeFromSubscription, whatYouLoseProfileTier1Source]);
return <BottomSheet>
<PremiumPlanActionSheetHeader premiumType={premiumTypeFromSubscription} />
<View style={styles.body}>
<Text variant="heading-xl/extrabold" style={styles.title}>
{mode === c4205_10.CANCEL ? intl.string(t.PWq8TL) : intl.string(t["7VcWW0"])}
</Text>
<Text variant="text-md/medium" style={styles.subtitle}>
{mode === c4205_10.CANCEL ? intl.format(t.jh5mUz, {
subscriptionName: getPremiumTypeDisplayName(premiumTypeFromSubscription, true)
}) : intl.format(t.Qk34Ik, {
subscriptionName: getPremiumTypeDisplayName(premiumTypeFromSubscription, true)
})}
</Text>
{memo.map((item, index) => <WhatYouLoseItem key={index} {...item} />)}
</View>
<View style={styles.footer}>
<View style={styles.button}>
<Button text={intl.string(t["3PatSz"])} grow onPress={() => {
onContinue(STEP_ANALYTICS_NAMES[CancellationFlowSteps.WHAT_YOU_LOSE]);
ActionSheetActionCreators.hideActionSheet();
}} />
</View>
<Text variant="text-sm/medium" style={styles.keepText} onPress={function onPress() {
trackPremiumSubscriptionCancellationFlowStep({
subscription,
analyticsLocations,
fromStep: STEP_ANALYTICS_NAMES[CancellationFlowSteps.WHAT_YOU_LOSE],
toStep: null
});
ActionSheetActionCreators.hideActionSheet();
}}>
{intl.string(t.rzVN6j)}
</Text>
</View>
</BottomSheet>;
};
export { c4205_10 as WhatYouLoseMode };
+147
View File
@@ -0,0 +1,147 @@
// Metro module 14012 (f14013).
import { View } from "react-native";
import SubscriptionStore from "../../../stores/billing/SubscriptionStore";
import { PREMIUM_TIER_2_REFERRAL_TRIAL_ID } from "../PremiumConstants";
import { Gradients } from "../../colors/native/ColorConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import * as _shared from "../../../design/shared";
import useTheme from "../../../hooks/useTheme";
import { Text } from "../../../design/components/Text/native/Text";
import useTrackImpression from "../../app_analytics/useTrackImpression";
import { ImpressionTypes, ImpressionNames } from "../../../_bundle/Module503";
import { MarketingComponentType } from "../../../_bundle/Module6567";
import { Icon } from "../../../design/void/native";
import Module14013 from "../../../_bundle/Module14013";
import { usePremiumTrialOffer } from "../hooks/usePremiumTrialOffer.android";
import { usePremiumDiscountOffer } from "../hooks/usePremiumDiscountOffer.android";
import { useHasTier2Premium } from "../../../utils/PremiumUtils";
import { useIsDismissibleContentDismissed_UNSAFE } from "../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../_bundle/Module1358";
import { useStateFromStores } from "../../../_bundle/Module589";
import { useSelectedDismissibleContent, useSelectedSnowflakeBoundDismissibleContent } from "../../dismissible_content/hooks/useSelectedDismissibleContent";
import { useIsEligibleSenderForReferralProgram } from "../referral_program/hooks/useIsEligibleSenderForReferralProgram";
import { useIsReferralProgramEntrypointBadgeAcknowledged } from "../referral_program/ReferralProgramUtils";
import { usePromotionMarketingComponent } from "../hooks/usePromotionMarketingComponent";
import { intl, t } from "../../../intl/index.native";
import Module4611 from "../../../_bundle/Module4611";
import { HorizontalGradient } from "../../../ConstantsIOS";
import { isAndroid } from "../../../utils/PlatformUtils";
let useStyles, OfferBadge;
const ThemedTabBadge = function ThemedTabBadge(props) {
const label = props.label;
const styles = useStyles();
const isThemeDark = _shared.isThemeDark(useTheme());
return <View style={[styles.badge, isThemeDark ? styles.badgeBackgroundDarkTheme : styles.badgeBackgroundLightTheme]}>
<Text variant="eyebrow" color={isThemeDark ? "text-overlay-dark" : "text-overlay-light"} style={styles.text}>{label}</Text>
</View>;
};
OfferBadge = function OfferBadge(props) {
const { acked, badgeCopy, ackedBadgeCopy, componentId } = props;
const styles = useStyles();
useTrackImpression({
type: ImpressionTypes.VIEW,
name: ImpressionNames.PREMIUM_MARKETING_COMPONENT,
properties: {
component_type: MarketingComponentType.PREMIUM_TAB,
component_id: componentId
}
}, {
disableTrack: componentId == null
});
return acked ? <View style={styles.acked}>
<Icon source={Module14013} size={Icon.Sizes.EXTRA_SMALL} color={styles.icon.color} style={styles.icon} />
<Text variant="eyebrow" color="interactive-text-default" style={styles.text}>{ackedBadgeCopy}</Text>
</View> : <ThemedTabBadge label={badgeCopy} />;
};
useStyles = createStyles({
tag: {
paddingVertical: 4,
paddingHorizontal: 8,
borderRadius: Module712.radii.round
},
badge: {
display: "flex",
minWidth: 16,
minHeight: 16,
paddingHorizontal: 8,
justifyContent: "center",
alignItems: "center",
gap: 4,
borderRadius: Module712.radii.round
},
badgeBackgroundLightTheme: {
backgroundColor: Module712.colors.BACKGROUND_BRAND
},
badgeBackgroundDarkTheme: {
backgroundColor: Module712.colors.WHITE
},
acked: {
paddingVertical: 2,
paddingHorizontal: 12,
borderRadius: Module712.radii.round,
backgroundColor: Module712.colors.BORDER_SUBTLE,
display: "flex",
flexDirection: "row",
alignItems: "center",
textAlignVertical: "center"
},
ackedBadge: {
backgroundColor: Module712.colors.BORDER_SUBTLE
},
icon: {
color: Module712.colors.INTERACTIVE_TEXT_DEFAULT,
marginRight: 2
},
text: {
paddingBottom: 2
},
premiumDiscountBadge: {
paddingVertical: 2,
paddingHorizontal: 12,
borderRadius: Module712.radii.round,
display: "flex",
flexDirection: "row",
alignItems: "center",
textAlignVertical: "center"
}
});
export default function PremiumTabBadge() {
const styles = useStyles();
const premiumTrialOffer = usePremiumTrialOffer();
const premiumDiscountOffer = usePremiumDiscountOffer();
const hasTier2Premium = useHasTier2Premium();
const isDismissibleContentDismissed_UNSAFE = useIsDismissibleContentDismissed_UNSAFE(DismissibleContent.MOBILE_NITRO_HOME_SETTINGS_BADGE);
const r45 = isDismissibleContentDismissed_UNSAFE ? !isDismissibleContentDismissed_UNSAFE : hasTier2Premium;
const [r18, ] = useSelectedDismissibleContent(useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumTypeSubscription())?.trialId === PREMIUM_TIER_2_REFERRAL_TRIAL_ID && !r45 ? [DismissibleContent.REFERRAL_TRIAL_MOBILE_NITRO_HOME_BADGE] : [], void 0, true);
const [r17, ] = useSelectedDismissibleContent(!r45 && hasTier2Premium ? [DismissibleContent.WHATS_NEW_TENURE_BADGE_REWARD] : [], void 0, true);
const isEligibleSenderForReferralProgram = useIsEligibleSenderForReferralProgram();
const isReferralProgramEntrypointBadgeAcknowledged = useIsReferralProgramEntrypointBadgeAcknowledged();
const promotionMarketingComponent = usePromotionMarketingComponent(MarketingComponentType.PREMIUM_TAB);
const r93 = promotionMarketingComponent != null ? promotionMarketingComponent.properties.properties.oneofKind === "premiumTab" ? DismissibleContent.PREMIUM_TAB_MARKETING_MOMENT_OFFER_BADGE : null : null;
let r101 = promotionMarketingComponent?.promotionId;
if (r101 == null) {
r101 = "";
}
const [r104, ] = useSelectedSnowflakeBoundDismissibleContent(r93, r101, void 0, true);
if (promotionMarketingComponent != null && promotionMarketingComponent.properties.properties.oneofKind === "premiumTab") {
return <OfferBadge acked={r104 !== DismissibleContent.PREMIUM_TAB_MARKETING_MOMENT_OFFER_BADGE} badgeCopy={promotionMarketingComponent.properties.properties.premiumTab.badgeLabel} ackedBadgeCopy={promotionMarketingComponent.properties.properties.premiumTab.acknowledgedBadgeLabel} componentId={promotionMarketingComponent.id} />;
}
const r118 = r18 === DismissibleContent.REFERRAL_TRIAL_MOBILE_NITRO_HOME_BADGE ? intl.string(t.uO4bXn) : r17 === DismissibleContent.WHATS_NEW_TENURE_BADGE_REWARD ? intl.string(t["jyYgZ+"]) : null;
return isEligibleSenderForReferralProgram && !isReferralProgramEntrypointBadgeAcknowledged ? <ThemedTabBadge label={intl.string(t.RDE0Sc)} /> : r45 ? <Module4611 style={styles.tag} colors={Gradients.PREMIUM_TIER_2} start={HorizontalGradient.START} end={HorizontalGradient.END}>
<Text variant="eyebrow" color="text-overlay-light" style={isAndroid() ? styles.text : void 0}>
{intl.string(t.y2b7CA)}
</Text>
</Module4611> : premiumTrialOffer != null ? <OfferBadge acked={premiumTrialOffer?.expires_at != null} badgeCopy={intl.string(t.OS9KPu)} ackedBadgeCopy={intl.string(t.OS9KPu)} /> : premiumDiscountOffer != null ? premiumDiscountOffer.hasAcknowledged() ? <View style={[styles.premiumDiscountBadge, styles.ackedBadge]}>
<Icon source={Module14013} size={Icon.Sizes.EXTRA_SMALL} color={styles.icon.color} style={styles.icon} />
<Text variant="eyebrow" color="interactive-text-default" style={styles.text}>
{intl.string(t["/DTtr6"])}
</Text>
</View> : <Module4611 style={styles.premiumDiscountBadge} colors={["#db00a4", "#5968f0"]} start={HorizontalGradient.START} end={HorizontalGradient.END}>
<Text variant="eyebrow" color="text-overlay-light" style={styles.text}>
{intl.string(t["/DTtr6"])}
</Text>
</Module4611> : r118 != null ? <Module4611 style={styles.tag} colors={Gradients.PREMIUM_TIER_2} start={HorizontalGradient.START} end={HorizontalGradient.END}>
<Text variant="eyebrow" color="text-overlay-light" style={isAndroid() ? styles.text : void 0}>{r118}</Text>
</Module4611> : null;
};
@@ -0,0 +1,345 @@
// Metro module 5675 (f5676).
import * as _PremiumConstants from "../PremiumConstants";
import { SubscriptionPlans } from "../PremiumConstants";
import * as _MetaQuestUtils_android from "../../device/MetaQuestUtils.android";
const { PremiumTypes, SubscriptionIntervalTypes, PREMIUM_TIER_2_LIKELIHOOD_TRIAL_ID, PREMIUM_TIER_2_REACTIVATION_TRIAL_ID, PREMIUM_TIER_0_LIKELIHOOD_TRIAL_ID, PREMIUM_TIER_2_TRIAL_FOR_EVERYONE_TRIAL_ID, PREMIUM_TIER_2_REFERRAL_TRIAL_ID, PREMIUM_TIER_2_HFU_TWO_WEEK_TRIAL_ID, PREMIUM_TIER_2_LIKELIHOOD_1_MONTH_40_PERCENT_DISCOUNT_ID, PREMIUM_TIER_2_REENGAGEMENT_1_MONTH_40_PERCENT_DISCOUNT_ID } = _PremiumConstants;
let c3512_1 = Object.freeze({
PREMIUM_GIFT_MONTH_TIER_0: "premium_month_tier_0.2",
PREMIUM_GIFT_YEAR_TIER_0: "premium_year_tier_0",
PREMIUM_GIFT_MONTH_TIER_1: "premium_month_tier_1",
PREMIUM_GIFT_YEAR_TIER_1: "premium_year_tier_1",
PREMIUM_GIFT_MONTH_TIER_2: "premium_month_tier_2",
PREMIUM_GIFT_YEAR_TIER_2: "premium_year_tier_2",
PREMIUM_TIER_2_MONTHLY: "premium_tier_2_monthly",
PREMIUM_TIER_2_YEARLY: "premium_tier_2_yearly",
PREMIUM_TIER_1_MONTHLY: "premium_tier_1_monthly",
PREMIUM_TIER_1_YEARLY: "premium_tier_1_yearly",
PREMIUM_TIER_0_MONTHLY: "premium_tier_0_month",
PREMIUM_TIER_0_YEARLY: "premium_tier_0_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY: "premium_tier_2_premium_guild_1_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY: "premium_tier_2_premium_guild_1_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_2_MONTHLY: "premium_tier_2_premium_guild_2_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_2_YEARLY: "premium_tier_2_premium_guild_2_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_3_MONTHLY: "premium_tier_2_premium_guild_3_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_3_YEARLY: "premium_tier_2_premium_guild_3_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_5_MONTHLY: "premium_tier_2_premium_guild_5_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_5_YEARLY: "premium_tier_2_premium_guild_5_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_10_MONTHLY: "premium_tier_2_premium_guild_10_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_13_MONTHLY: "premium_tier_2_premium_guild_13_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_28_MONTHLY: "premium_tier_2_premium_guild_28_monthly",
PREMIUM_TIER_1_PREMIUM_GUILD_1_MONTHLY: "premium_tier_1_premium_guild_1_monthly",
PREMIUM_TIER_1_PREMIUM_GUILD_1_YEARLY: "premium_tier_1_premium_guild_1_yearly",
PREMIUM_GUILD_1_MONTHLY: "premium_guild_1_monthly",
PREMIUM_GUILD_2_MONTHLY: "premium_guild_2_monthly"
});
const r8 = [c3512_1.PREMIUM_GIFT_MONTH_TIER_0, c3512_1.PREMIUM_GIFT_YEAR_TIER_0, c3512_1.PREMIUM_GIFT_MONTH_TIER_1, c3512_1.PREMIUM_GIFT_YEAR_TIER_1, c3512_1.PREMIUM_GIFT_MONTH_TIER_2, c3512_1.PREMIUM_GIFT_YEAR_TIER_2];
const isMetaQuest = _MetaQuestUtils_android.isMetaQuest();
const PREMIUM_TIER_2_MONTHLY = c3512_1.PREMIUM_TIER_2_MONTHLY;
const r43 = isMetaQuest ? [PREMIUM_TIER_2_MONTHLY, c3512_1.PREMIUM_TIER_2_YEARLY, c3512_1.PREMIUM_TIER_0_MONTHLY, c3512_1.PREMIUM_TIER_0_YEARLY] : [PREMIUM_TIER_2_MONTHLY, c3512_1.PREMIUM_TIER_2_YEARLY, c3512_1.PREMIUM_TIER_1_MONTHLY, c3512_1.PREMIUM_TIER_1_YEARLY, c3512_1.PREMIUM_TIER_0_MONTHLY, c3512_1.PREMIUM_TIER_0_YEARLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_MONTHLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_YEARLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_MONTHLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_YEARLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_MONTHLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_YEARLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_10_MONTHLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_13_MONTHLY, c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_28_MONTHLY, c3512_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_MONTHLY, c3512_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_YEARLY, c3512_1.PREMIUM_GUILD_1_MONTHLY, c3512_1.PREMIUM_GUILD_2_MONTHLY];
const r67 = Object;
const r69 = {};
r69[SubscriptionPlans.PREMIUM_MONTH_TIER_0] = c3512_1.PREMIUM_TIER_0_MONTHLY;
r69[SubscriptionPlans.PREMIUM_MONTH_TIER_1] = c3512_1.PREMIUM_TIER_1_MONTHLY;
r69[SubscriptionPlans.PREMIUM_MONTH_TIER_2] = c3512_1.PREMIUM_TIER_2_MONTHLY;
r69[SubscriptionPlans.PREMIUM_MONTH_GUILD] = c3512_1.PREMIUM_GUILD_1_MONTHLY;
r69[SubscriptionPlans.PREMIUM_YEAR_TIER_0] = c3512_1.PREMIUM_TIER_0_YEARLY;
r69[SubscriptionPlans.PREMIUM_YEAR_TIER_1] = c3512_1.PREMIUM_TIER_1_YEARLY;
r69[SubscriptionPlans.PREMIUM_YEAR_TIER_2] = c3512_1.PREMIUM_TIER_2_YEARLY;
const r83 = r67.freeze(r69);
const r84 = {};
r84[c3512_1.PREMIUM_TIER_2_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_2_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: []
};
r84[c3512_1.PREMIUM_TIER_2_YEARLY] = {
productId: c3512_1.PREMIUM_TIER_2_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: []
};
r84[c3512_1.PREMIUM_TIER_1_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_1_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_1,
additionalPlans: []
};
r84[c3512_1.PREMIUM_TIER_1_YEARLY] = {
productId: c3512_1.PREMIUM_TIER_1_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_1,
additionalPlans: []
};
r84[c3512_1.PREMIUM_TIER_0_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_0_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_0,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_0,
additionalPlans: []
};
r84[c3512_1.PREMIUM_TIER_0_YEARLY] = {
productId: c3512_1.PREMIUM_TIER_0_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_0,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_0,
additionalPlans: []
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 1,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 1,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 2,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 2,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_YEARLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 2,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 2,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 3,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 3,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_YEARLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 3,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 3,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 5,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 5,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_YEARLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 5,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 5,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_10_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_10_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 10,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 10,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_13_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_13_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 13,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 13,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_28_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_2_PREMIUM_GUILD_28_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 28,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 28,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_MONTHLY] = {
productId: c3512_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 1,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_1,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_YEARLY] = {
productId: c3512_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 1,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_1,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r84[c3512_1.PREMIUM_GUILD_1_MONTHLY] = {
productId: c3512_1.PREMIUM_GUILD_1_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 1,
premiumTier: null,
basePlanId: SubscriptionPlans.NONE_MONTH,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r84[c3512_1.PREMIUM_GUILD_2_MONTHLY] = {
productId: c3512_1.PREMIUM_GUILD_2_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 2,
premiumTier: null,
basePlanId: SubscriptionPlans.NONE_MONTH,
additionalPlans: [{
quantity: 2,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
const r259 = {};
const r260 = {};
r260[c3512_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-likelihood";
r260[c3512_1.PREMIUM_TIER_2_YEARLY] = "premium-tier-2-yearly-likelihood";
r259[PREMIUM_TIER_2_LIKELIHOOD_TRIAL_ID] = r260;
const r265 = {};
r265[c3512_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-reactivation";
r265[c3512_1.PREMIUM_TIER_2_YEARLY] = "premium-tier-2-yearly-reactivation";
r259[PREMIUM_TIER_2_REACTIVATION_TRIAL_ID] = r265;
const r270 = {};
r270[c3512_1.PREMIUM_TIER_0_MONTHLY] = "premium-tier-0-monthly-likelihood";
r270[c3512_1.PREMIUM_TIER_0_YEARLY] = "premium-tier-0-yearly-likelihood";
r259[PREMIUM_TIER_0_LIKELIHOOD_TRIAL_ID] = r270;
const r275 = {};
r275[c3512_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-q4-drop";
r275[c3512_1.PREMIUM_TIER_2_YEARLY] = "premium-tier-2-yearly-q4-drop";
r259[PREMIUM_TIER_2_TRIAL_FOR_EVERYONE_TRIAL_ID] = r275;
const r280 = {};
r280[c3512_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-referral-trial";
r280[c3512_1.PREMIUM_TIER_2_YEARLY] = "premium-tier-2-yearly-referral-trial";
r259[PREMIUM_TIER_2_REFERRAL_TRIAL_ID] = r280;
const r285 = {};
r285[c3512_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-hfu-two-week-trial";
r285[c3512_1.PREMIUM_TIER_2_YEARLY] = "premium-tier-2-yearly-hfu-two-week-trial";
r259[PREMIUM_TIER_2_HFU_TWO_WEEK_TRIAL_ID] = r285;
const r290 = {};
const r291 = {};
r291[c3512_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-likelihood-discount";
r290[PREMIUM_TIER_2_LIKELIHOOD_1_MONTH_40_PERCENT_DISCOUNT_ID] = r291;
const r294 = {};
r294[c3512_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-reengagement-discount";
r290[PREMIUM_TIER_2_REENGAGEMENT_1_MONTH_40_PERCENT_DISCOUNT_ID] = r294;
export { c3512_1 as ProductIds };
export const GenericProductIds = [];
export { r8 as IAPProductIds };
export { r43 as SubscriptionProductIds };
export { r83 as BasePlanIdToProductId };
export { r84 as AppStorePremiumProductIdsToPremiumBundledItems };
export { r259 as TrialIdToProductOfferId };
export { r290 as DiscountIdToProductOfferId };
export const BOGO_OFFER_ID = "premium-tier-2-monthly-bogo";
export function getProductIdForGift(a0) {
if (SubscriptionPlans.PREMIUM_MONTH_TIER_0 === a0) {
return c3512_1.PREMIUM_GIFT_MONTH_TIER_0;
}
if (SubscriptionPlans.PREMIUM_YEAR_TIER_0 === a0) {
return c3512_1.PREMIUM_GIFT_YEAR_TIER_0;
}
if (SubscriptionPlans.PREMIUM_MONTH_TIER_1 === a0) {
return c3512_1.PREMIUM_GIFT_MONTH_TIER_1;
}
if (SubscriptionPlans.PREMIUM_YEAR_TIER_1 === a0) {
return c3512_1.PREMIUM_GIFT_YEAR_TIER_1;
}
if (SubscriptionPlans.PREMIUM_MONTH_TIER_2 === a0) {
return c3512_1.PREMIUM_GIFT_MONTH_TIER_2;
}
if (SubscriptionPlans.PREMIUM_YEAR_TIER_2 === a0) {
return c3512_1.PREMIUM_GIFT_YEAR_TIER_2;
}
throw new Error("Tried to get Product for Plan not configured for IAP!");
}
export function getPlanIdForGift(a0) {
if (c3512_1.PREMIUM_GIFT_MONTH_TIER_0 === a0) {
return SubscriptionPlans.PREMIUM_MONTH_TIER_0;
}
if (c3512_1.PREMIUM_GIFT_YEAR_TIER_0 === a0) {
return SubscriptionPlans.PREMIUM_YEAR_TIER_0;
}
if (c3512_1.PREMIUM_GIFT_MONTH_TIER_1 === a0) {
return SubscriptionPlans.PREMIUM_MONTH_TIER_1;
}
if (c3512_1.PREMIUM_GIFT_YEAR_TIER_1 === a0) {
return SubscriptionPlans.PREMIUM_YEAR_TIER_1;
}
if (c3512_1.PREMIUM_GIFT_MONTH_TIER_2 === a0) {
return SubscriptionPlans.PREMIUM_MONTH_TIER_2;
}
if (c3512_1.PREMIUM_GIFT_YEAR_TIER_2 === a0) {
return SubscriptionPlans.PREMIUM_YEAR_TIER_2;
}
throw new Error("Tried to get Plan for Product not configured for IAP!");
}
+422
View File
@@ -0,0 +1,422 @@
// Metro module 6293 (f6294).
import * as _PremiumConstants from "../PremiumConstants";
import { SubscriptionPlans } from "../PremiumConstants";
import { AppleProductIds } from "../../../_bundle/Module6294";
const { PremiumTypes, SubscriptionIntervalTypes, PREMIUM_TIER_2_LIKELIHOOD_TRIAL_ID, PREMIUM_TIER_2_REACTIVATION_TRIAL_ID, PREMIUM_TIER_0_LIKELIHOOD_TRIAL_ID, PREMIUM_TIER_2_TRIAL_FOR_EVERYONE_TRIAL_ID, PREMIUM_TIER_2_REFERRAL_TRIAL_ID, PREMIUM_TIER_2_LIKELIHOOD_1_MONTH_40_PERCENT_DISCOUNT_ID, PREMIUM_TIER_2_REENGAGEMENT_1_MONTH_40_PERCENT_DISCOUNT_ID, PREMIUM_TIER_2_HFU_TWO_WEEK_TRIAL_ID } = _PremiumConstants;
let c4009_1 = Object.freeze({
PREMIUM_MONTH_TIER_1: "premium_month_tier_1.1",
PREMIUM_YEAR_TIER_1: "premium_year_tier_1.1",
PREMIUM_MONTH_TIER_2: "premium_month_tier_2.1",
PREMIUM_YEAR_TIER_2: "premium_year_tier_2.1",
PREMIUM_GIFT_MONTH_TIER_0: "premium_month_tier_0",
PREMIUM_GIFT_YEAR_TIER_0: "premium_year_tier_0",
PREMIUM_GIFT_MONTH_TIER_1: "premium_month_tier_1.2",
PREMIUM_GIFT_YEAR_TIER_1: "premium_year_tier_1.2",
PREMIUM_GIFT_MONTH_TIER_2: "premium_month_tier_2.2",
PREMIUM_GIFT_YEAR_TIER_2: "premium_year_tier_2.2",
PREMIUM_TIER_2_MONTHLY: "premium_tier_2_monthly",
PREMIUM_TIER_2_YEARLY: "premium_tier_2_yearly",
PREMIUM_TIER_1_MONTHLY: "premium_tier_1_monthly",
PREMIUM_TIER_1_YEARLY: "premium_tier_1_yearly",
PREMIUM_TIER_0_MONTHLY: "premium_tier_0_monthly",
PREMIUM_TIER_0_YEARLY: "premium_tier_0_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY: "premium_tier_2_premium_guild_1_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY: "premium_tier_2_premium_guild_1_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_2_MONTHLY: "premium_tier_2_premium_guild_2_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_2_YEARLY: "premium_tier_2_premium_guild_2_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_3_MONTHLY: "premium_tier_2_premium_guild_3_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_3_YEARLY: "premium_tier_2_premium_guild_3_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_5_MONTHLY: "premium_tier_2_premium_guild_5_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_5_YEARLY: "premium_tier_2_premium_guild_5_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_10_MONTHLY: "premium_tier_2_premium_guild_10_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_10_YEARLY: "premium_tier_2_premium_guild_10_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_13_MONTHLY: "premium_tier_2_premium_guild_13_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_13_YEARLY: "premium_tier_2_premium_guild_13_yearly",
PREMIUM_TIER_2_PREMIUM_GUILD_28_MONTHLY: "premium_tier_2_premium_guild_28_monthly",
PREMIUM_TIER_2_PREMIUM_GUILD_28_YEARLY: "premium_tier_2_premium_guild_28_yearly",
PREMIUM_TIER_1_PREMIUM_GUILD_1_MONTHLY: "premium_tier_1_premium_guild_1_monthly",
PREMIUM_TIER_1_PREMIUM_GUILD_1_YEARLY: "premium_tier_1_premium_guild_1_yearly",
PREMIUM_GUILD_1_MONTHLY: "premium_guild_1_monthly",
PREMIUM_GUILD_2_MONTHLY: "premium_guild_2_monthly",
STICKER_PACK_199: "sticker_pack_199",
STICKER_PACK_299: "sticker_pack_299",
GENERIC_SUBSCRIPTION: AppleProductIds.GENERIC_SUBSCRIPTION,
GENERIC_CONSUMABLE: AppleProductIds.GENERIC_CONSUMABLE
});
const r42 = [AppleProductIds.GENERIC_SUBSCRIPTION, AppleProductIds.GENERIC_CONSUMABLE];
const r47 = Object;
const r49 = {};
r49[SubscriptionPlans.PREMIUM_MONTH_TIER_0] = c4009_1.PREMIUM_TIER_0_MONTHLY;
r49[SubscriptionPlans.PREMIUM_MONTH_TIER_1] = c4009_1.PREMIUM_TIER_1_MONTHLY;
r49[SubscriptionPlans.PREMIUM_MONTH_TIER_2] = c4009_1.PREMIUM_TIER_2_MONTHLY;
r49[SubscriptionPlans.PREMIUM_MONTH_GUILD] = c4009_1.PREMIUM_GUILD_1_MONTHLY;
r49[SubscriptionPlans.PREMIUM_YEAR_TIER_0] = c4009_1.PREMIUM_TIER_0_YEARLY;
r49[SubscriptionPlans.PREMIUM_YEAR_TIER_1] = c4009_1.PREMIUM_TIER_1_YEARLY;
r49[SubscriptionPlans.PREMIUM_YEAR_TIER_2] = c4009_1.PREMIUM_TIER_2_YEARLY;
const r63 = r47.freeze(r49);
const r64 = {};
r64[c4009_1.PREMIUM_MONTH_TIER_1] = {
productId: c4009_1.PREMIUM_MONTH_TIER_1,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_1,
additionalPlans: [],
isDeprecated: true
};
r64[c4009_1.PREMIUM_YEAR_TIER_1] = {
productId: c4009_1.PREMIUM_YEAR_TIER_1,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_1,
additionalPlans: [],
isDeprecated: true
};
r64[c4009_1.PREMIUM_MONTH_TIER_2] = {
productId: c4009_1.PREMIUM_MONTH_TIER_2,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [],
isDeprecated: true
};
r64[c4009_1.PREMIUM_YEAR_TIER_2] = {
productId: c4009_1.PREMIUM_YEAR_TIER_2,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [],
isDeprecated: true
};
r64[c4009_1.PREMIUM_TIER_2_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_2_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: []
};
r64[c4009_1.PREMIUM_TIER_2_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_2_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: []
};
r64[c4009_1.PREMIUM_TIER_1_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_1_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_1,
additionalPlans: []
};
r64[c4009_1.PREMIUM_TIER_1_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_1_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_1,
additionalPlans: []
};
r64[c4009_1.PREMIUM_TIER_0_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_0_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_0,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_0,
additionalPlans: []
};
r64[c4009_1.PREMIUM_TIER_0_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_0_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 0,
premiumTier: PremiumTypes.TIER_0,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_0,
additionalPlans: []
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 1,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_1_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 1,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 2,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 2,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_2_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 2,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 2,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 3,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 3,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_3_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 3,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 3,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 5,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 5,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_5_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 5,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 5,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_10_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_10_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 10,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 10,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_10_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_10_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 10,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 10,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_13_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_13_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 13,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 13,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_13_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_13_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 13,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 13,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_28_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_28_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 28,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_2,
additionalPlans: [{
quantity: 28,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_28_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_2_PREMIUM_GUILD_28_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 28,
premiumTier: PremiumTypes.TIER_2,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_2,
additionalPlans: [{
quantity: 28,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_MONTHLY] = {
productId: c4009_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 1,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_MONTH_TIER_1,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_YEARLY] = {
productId: c4009_1.PREMIUM_TIER_1_PREMIUM_GUILD_1_YEARLY,
interval: SubscriptionIntervalTypes.YEAR,
numPremiumGuild: 1,
premiumTier: PremiumTypes.TIER_1,
basePlanId: SubscriptionPlans.PREMIUM_YEAR_TIER_1,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_YEAR_GUILD
}]
};
r64[c4009_1.PREMIUM_GUILD_1_MONTHLY] = {
productId: c4009_1.PREMIUM_GUILD_1_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 1,
premiumTier: null,
basePlanId: SubscriptionPlans.NONE_MONTH,
additionalPlans: [{
quantity: 1,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
r64[c4009_1.PREMIUM_GUILD_2_MONTHLY] = {
productId: c4009_1.PREMIUM_GUILD_2_MONTHLY,
interval: SubscriptionIntervalTypes.MONTH,
numPremiumGuild: 2,
premiumTier: null,
basePlanId: SubscriptionPlans.NONE_MONTH,
additionalPlans: [{
quantity: 2,
planId: SubscriptionPlans.PREMIUM_MONTH_GUILD
}]
};
const r294 = {};
const r295 = {};
r295[c4009_1.PREMIUM_TIER_2_MONTHLY] = "premium_tier_2_monthly_likelihood";
r295[c4009_1.PREMIUM_TIER_2_YEARLY] = "premium_tier_2_yearly_likelihood";
r294[PREMIUM_TIER_2_LIKELIHOOD_TRIAL_ID] = r295;
const r300 = {};
r300[c4009_1.PREMIUM_TIER_2_MONTHLY] = "premium_tier_2_monthly_reactivation";
r300[c4009_1.PREMIUM_TIER_2_YEARLY] = "premium_tier_2_yearly_reactivation";
r294[PREMIUM_TIER_2_REACTIVATION_TRIAL_ID] = r300;
const r305 = {};
r305[c4009_1.PREMIUM_TIER_0_MONTHLY] = "premium_tier_0_monthly_likelihood";
r305[c4009_1.PREMIUM_TIER_0_YEARLY] = "premium_tier_0_yearly_likelihood";
r294[PREMIUM_TIER_0_LIKELIHOOD_TRIAL_ID] = r305;
const r310 = {};
r310[c4009_1.PREMIUM_TIER_2_MONTHLY] = "premium_tier_2_monthly_q4_drop";
r310[c4009_1.PREMIUM_TIER_2_YEARLY] = "premium_tier_2_yearly_q4_drop";
r294[PREMIUM_TIER_2_TRIAL_FOR_EVERYONE_TRIAL_ID] = r310;
const r315 = {};
r315[c4009_1.PREMIUM_TIER_2_MONTHLY] = "premium_tier_2_monthly_referral_trial";
r315[c4009_1.PREMIUM_TIER_2_YEARLY] = "premium_tier_2_yearly_referral_trial";
r294[PREMIUM_TIER_2_REFERRAL_TRIAL_ID] = r315;
const r320 = {};
r320[c4009_1.PREMIUM_TIER_2_MONTHLY] = "premium_tier_2_monthly_hfu_two_week_trial";
r320[c4009_1.PREMIUM_TIER_2_YEARLY] = "premium_tier_2_yearly_hfu_two_week_trial";
r294[PREMIUM_TIER_2_HFU_TWO_WEEK_TRIAL_ID] = r320;
const r325 = {};
const r326 = {};
r326[c4009_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-likelihood-discount";
r325[PREMIUM_TIER_2_LIKELIHOOD_1_MONTH_40_PERCENT_DISCOUNT_ID] = r326;
const r329 = {};
r329[c4009_1.PREMIUM_TIER_2_MONTHLY] = "premium-tier-2-monthly-reengagement-discount";
r325[PREMIUM_TIER_2_REENGAGEMENT_1_MONTH_40_PERCENT_DISCOUNT_ID] = r329;
export { c4009_1 as ProductIds };
export { r42 as GenericProductIds };
export { r63 as BasePlanIdToProductId };
export const IAPProductIds = [];
export const SubscriptionProductIds = [];
export { r64 as AppStorePremiumProductIdsToPremiumBundledItems };
export { r294 as TrialIdToProductOfferId };
export { r325 as DiscountIdToProductOfferId };
export const BOGO_OFFER_ID = "premium-tier-2-monthly-bogo";
export function getProductIdForGift(a0) {
if (SubscriptionPlans.PREMIUM_MONTH_TIER_0 === a0) {
return c4009_1.PREMIUM_GIFT_MONTH_TIER_0;
}
if (SubscriptionPlans.PREMIUM_YEAR_TIER_0 === a0) {
return c4009_1.PREMIUM_GIFT_YEAR_TIER_0;
}
if (SubscriptionPlans.PREMIUM_MONTH_TIER_1 === a0) {
return c4009_1.PREMIUM_GIFT_MONTH_TIER_1;
}
if (SubscriptionPlans.PREMIUM_YEAR_TIER_1 === a0) {
return c4009_1.PREMIUM_GIFT_YEAR_TIER_1;
}
if (SubscriptionPlans.PREMIUM_MONTH_TIER_2 === a0) {
return c4009_1.PREMIUM_GIFT_MONTH_TIER_2;
}
if (SubscriptionPlans.PREMIUM_YEAR_TIER_2 === a0) {
return c4009_1.PREMIUM_GIFT_YEAR_TIER_2;
}
throw new Error("Tried to get Product for Plan not configured for IAP!");
}
export function getPlanIdForGift(a0) {
if (c4009_1.PREMIUM_GIFT_MONTH_TIER_0 === a0) {
return SubscriptionPlans.PREMIUM_MONTH_TIER_0;
}
if (c4009_1.PREMIUM_GIFT_YEAR_TIER_0 === a0) {
return SubscriptionPlans.PREMIUM_YEAR_TIER_0;
}
if (c4009_1.PREMIUM_GIFT_MONTH_TIER_1 === a0) {
return SubscriptionPlans.PREMIUM_MONTH_TIER_1;
}
if (c4009_1.PREMIUM_GIFT_YEAR_TIER_1 === a0) {
return SubscriptionPlans.PREMIUM_YEAR_TIER_1;
}
if (c4009_1.PREMIUM_GIFT_MONTH_TIER_2 === a0) {
return SubscriptionPlans.PREMIUM_MONTH_TIER_2;
}
if (c4009_1.PREMIUM_GIFT_YEAR_TIER_2 === a0) {
return SubscriptionPlans.PREMIUM_YEAR_TIER_2;
}
throw new Error("Tried to get Plan for Product not configured for IAP!");
}
@@ -0,0 +1,44 @@
// Metro module 6549 (f6550).
import { Linking, View } from "react-native";
import { SubscriptionStatusTypes } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { Icon, IconSizes } from "../../../design/void/native";
import Module6550 from "../../../_bundle/Module6550";
import { Text } from "../../../design/components/Text/native/Text";
import { intl, t } from "../../../intl/index.native";
import { getDisplayName, getExternalSubscriptionMethodUrl } from "../../../utils/PremiumUtils";
import { Button } from "../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
padding: 8,
margin: 8,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
textContainer: {
flexDirection: "row"
},
icon: {
marginRight: 4
},
text: {
marginBottom: 8,
flex: 1
}
});
export default function SubscriptionAccountHoldNotice(props) {
const subscription = props.subscription;
const styles = useStyles();
return subscription.status === SubscriptionStatusTypes.ACCOUNT_HOLD ? <View style={styles.container}>
<View style={styles.textContainer}>
<Icon size={IconSizes.MEDIUM} style={styles.icon} source={Module6550} />
<Text style={styles.text} variant="text-sm/medium">
{intl.format(t["7I21Iz"], {
endDate: subscription.currentPeriodEnd,
planDescription: getDisplayName(subscription.planId)
})}
</Text>
</View>
<Button size="sm" text={intl.string(t.VJmUNy)} onPress={() => Linking.openURL(getExternalSubscriptionMethodUrl(subscription.paymentGateway, "PAYMENT_SOURCE_MANAGEMENT"))} />
</View> : null;
};
@@ -0,0 +1,44 @@
// Metro module 6548 (f6549).
import { View } from "react-native";
import { isNoneSubscription } from "../../../records/SubscriptionPlanRecord";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { DARK_PRIMARY_630_LIGHT_PRIMARY_230, DARK_PRIMARY_300_LIGHT_PRIMARY_500 } from "../../../design/migrations/native/LegacyTokens";
import { WarningCircle, LegacyText } from "../../../design/void/native";
import { intl, t } from "../../../intl/index.native";
import PremiumUtils, { getExternalPlanDisplayName } from "../../../utils/PremiumUtils";
const useStyles = createStyles({
container: {
padding: 10,
marginVertical: 5,
marginHorizontal: 15,
borderRadius: Module712.radii.xs,
display: "flex",
flexDirection: "row",
justifyContent: "center",
backgroundColor: DARK_PRIMARY_630_LIGHT_PRIMARY_230
},
icon: {
alignSelf: "center",
marginLeft: 15,
color: DARK_PRIMARY_300_LIGHT_PRIMARY_500
},
text: {
paddingLeft: 10,
marginRight: 15,
color: DARK_PRIMARY_300_LIGHT_PRIMARY_500
}
});
export default function SubscriptionRenewalMutationsNotice(props) {
const { subscription, renewalMutations } = props;
const styles = useStyles();
return <View style={styles.container}>
<WarningCircle style={styles.icon} />
<LegacyText style={styles.text}>
{intl.format(t.ar1cPl, {
planName: !subscription.hasExternalPlanChange && !isNoneSubscription(renewalMutations.planId) ? PremiumUtils.getDisplayName(renewalMutations.planId) : getExternalPlanDisplayName(renewalMutations),
date: subscription.currentPeriodEnd
})}
</LegacyText>
</View>;
};
@@ -0,0 +1,27 @@
// Metro module 16333 (f16334).
import UserStore from "../../../stores/UserStore";
import UserOfferStore from "../../../stores/billing/UserOfferStore";
import { PaymentGateways } from "../../../_bundle/Module505";
import AutomaticLifecycleManager from "../../../lib/AutomaticLifecycleManager";
import { NitroACOMSubscriptionExperiment } from "../../billing/native/ACOMExperiments";
import { isPremium } from "../../../utils/PremiumTypeUtils";
import { fetchUserOffer } from "../UserOfferActionCreators";
class UserOfferManager extends AutomaticLifecycleManager {
actions = {
POST_CONNECTION_OPEN: () => this.handlePostConnectionOpen()
};
handlePostConnectionOpen = () => {
const currentUser = UserStore.getCurrentUser();
const r16 = NitroACOMSubscriptionExperiment.getConfig({
location: "UserOfferManager.handlePostConnectionOpen"
}).enabled ? {
offerId: void 0,
paymentGatewayOverride: PaymentGateways.APPLE_ADVANCED_COMMERCE
} : void 0;
if (!(currentUser == null || !currentUser.verified || isPremium(currentUser) || UserOfferStore.isFetchingOffer())) {
fetchUserOffer("MobilePremiumOfferManager", true, r16);
}
};
}
const userOfferManager = new UserOfferManager();
export default userOfferManager;
@@ -0,0 +1,27 @@
// Metro module 6556 (f6557).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
defaultContainerStyle: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "center"
},
disabledContainerStyle: {
opacity: 0.5
}
});
export function LinkButton(props) {
const { onPress, text, containerStyle, disabled, textStyle, variant = "text-xs/medium", textColor = "text-link", iconRight } = props;
const styles = useStyles();
return <PressableOpacity style={[styles.defaultContainerStyle, disabled && styles.disabledContainerStyle, containerStyle]} hitSlop={{
top: 8,
right: 8,
bottom: 8
}} accessibilityRole="button" activeOpacity={0.2} disabled={disabled} onPress={onPress}>
<Text style={textStyle} variant={variant} color={textColor}>{text}</Text>
{iconRight}
</PressableOpacity>;
}
@@ -0,0 +1,24 @@
// Metro module 12465 (f12466).
import { HorizontalGradient } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import usePremiumPrimaryGradientColors from "../usePremiumPrimaryGradientColors";
import Module4611 from "../../../../_bundle/Module4611";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
pillTextContainer: {
paddingHorizontal: 8,
borderRadius: Module712.radii.lg,
justifyContent: "center"
},
pillText: {
textTransform: "uppercase"
}
});
export default function PillText(props) {
const { pillText, style } = props;
const styles = useStyles();
return <Module4611 style={[styles.pillTextContainer, style]} start={HorizontalGradient.START} end={HorizontalGradient.END} colors={usePremiumPrimaryGradientColors()}>
<Text variant="text-xs/semibold" color="text-overlay-light" style={styles.pillText}>{pillText}</Text>
</Module4611>;
};
@@ -0,0 +1,56 @@
// Metro module 11685 (f11686).
import { Component } from "react";
import { View } from "react-native";
import { createLegacyClassComponentStyles } from "../../../../design/components/Styles/native/createStyles";
import { ThemeContext } from "../../../../_bundle/Module3901";
import Module712 from "../../../../_bundle/Module712";
import Module8531, { Circle } from "../../../../_bundle/Module8531";
const styles = createLegacyClassComponentStyles({
progressCircle: {
alignItems: "center",
justifyContent: "center"
},
circle: {
position: "absolute",
width: "100%",
height: "100%"
},
circleOverlay: {
position: "relative",
display: "flex",
justifyContent: "center",
alignItems: "center"
}
});
class ProgressCircle extends Component {
static contextType = ThemeContext;
static defaultProps = {
size: 20,
strokeWidth: 0.9,
color: Module712.unsafe_rawColors.GUILD_BOOSTING_PINK
};
renderCircle() {
const r17 = styles(this.context);
const props = this.props;
const { percent, color, size, strokeWidth } = props;
const r31 = Math.min(Math.max(percent, 0), 100);
const r2 = (size - strokeWidth) / 2;
const strokeDasharray = r2 * Math.PI * 2;
return <Module8531 viewBox={`0 0 ${size} ${size}`} style={r17.circle}>
<Circle fill="none" cx={size / 2} cy={size / 2} r={r2} strokeWidth={strokeWidth} strokeLinecap="round" transform={`rotate(-90 ${size / 2} ${size / 2})`} stroke={color} style={{
strokeDasharray,
strokeDashoffset: (1 - r31 / 100) * strokeDasharray
}} />
</Module8531>;
}
render() {
const r10 = styles(this.context);
const props = this.props;
const { style, children } = props;
return <View style={[r10.progressCircle, style]}>
{this.renderCircle()}
{children != null ? <View style={r10.circleOverlay}>{children}</View> : null}
</View>;
}
}
export default ProgressCircle;
@@ -0,0 +1,80 @@
// Metro module 15762 (f15763).
import { useMemo, useEffect, useCallback } from "react";
import { PremiumTypes, SubscriptionPlanInfo } from "../../PremiumConstants";
import * as _Constants from "../../../../Constants";
import { AnalyticEvents } from "../../../../Constants";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { acknowledgeUserOffer } from "../../UserOfferActionCreators";
import openPremiumModal from "../../../../components_native/premium/openPremiumModal";
import openPremiumPlanSelectionActionSheet from "../openPremiumPlanSelectionActionSheet";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import PremiumDiscountOfferActionSheetContent from "./PremiumDiscountOfferActionSheetContent";
const { AnalyticsObjectTypes, AnalyticsPages, AnalyticsSections } = _Constants;
const analyticsLocation = {
page: AnalyticsPages.USER_SETTINGS,
section: AnalyticsSections.SETTINGS_PREMIUM,
objectType: AnalyticsObjectTypes.BUY
};
export default ({ markAsDismissed, userDiscountOffer }) => {
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.PREMIUM_DISCOUNT_OFFER_ACTION_SHEET).analyticsLocations;
const memo = useMemo(() => {
const r1 = userDiscountOffer == null;
let r5 = void 0;
if (!r1) {
const discount = userDiscountOffer.discount;
const r7 = discount == null;
r5 = void 0;
if (!r7) {
const planIds = discount.planIds;
r5 = planIds == null ? void 0 : planIds[0];
}
}
let r14 = (r5 != null ? SubscriptionPlanInfo[r5] : null)?.premiumType;
if (r14 == null) {
r14 = PremiumTypes.TIER_2;
}
return r14;
}, [userDiscountOffer]);
useEffect(() => {
if (userDiscountOffer != null) {
AnalyticsUtils.track(AnalyticEvents.PREMIUM_DISCOUNT_OFFER_ACTION_SHEET_VIEWED, {
location: analyticsLocations,
discount_offer_id: userDiscountOffer.id
});
acknowledgeUserOffer(void 0, userDiscountOffer);
}
}, []);
useEffect(() => {
if (userDiscountOffer == null) {
markAsDismissed(ContentDismissActionType.AUTO_DISMISS);
}
}, [userDiscountOffer, markAsDismissed]);
const callback = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.PREMIUM_DISCOUNT_OFFER_ACTION_SHEET_DISMISSED, {
location: analyticsLocations,
discount_offer_id: userDiscountOffer?.id
});
markAsDismissed(ContentDismissActionType.USER_DISMISS);
}, [analyticsLocations, markAsDismissed, userDiscountOffer]);
const callback2 = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.PREMIUM_DISCOUNT_OFFER_ACTION_SHEET_CTA_CLICKED, {
location: analyticsLocations,
discount_offer_id: userDiscountOffer?.id
});
markAsDismissed(ContentDismissActionType.TAKE_ACTION);
openPremiumModal({
analyticsLocations
});
openPremiumPlanSelectionActionSheet({
analyticsLocation,
analyticsLocations,
premiumType: memo
});
}, [analyticsLocations, markAsDismissed, userDiscountOffer, memo]);
return userDiscountOffer == null ? null : <BottomSheet key={userDiscountOffer?.id} startExpanded onDismiss={callback}>
<PremiumDiscountOfferActionSheetContent discountOffer={userDiscountOffer} onConfirm={callback2} />
</BottomSheet>;
};
@@ -0,0 +1,77 @@
// Metro module 15763 (f15764).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { UserIcon } from "../../../../design/components/Icon/native/redesign/generated/UserIcon";
import { intl, t } from "../../../../intl/index.native";
import { ChatSmileIcon } from "../../../../design/components/Icon/native/redesign/generated/ChatSmileIcon";
import { FolderIcon } from "../../../../design/components/Icon/native/redesign/generated/FolderIcon";
import { NitroWumpusFlightRight3dIllustration } from "../../../../design/assets/native";
import { Text } from "../../../../design/components/Text/native/Text";
import PremiumPerksList from "../../../../components_native/premium/PremiumPerksList";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { NitroWheelIcon } from "../../../../design/components/Icon/native/redesign/generated/NitroWheelIcon";
const useStyles = createStyles({
contentContainer: {
paddingHorizontal: 36,
paddingTop: 18,
paddingBottom: 36,
width: "100%",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
alignItems: "flex-start",
display: "flex",
flexDirection: "column",
gap: 0
},
buttonContainer: {
marginVertical: 6,
width: "100%",
height: 48
},
title: {
width: "100%",
textAlign: "center"
},
heroIllustrationContainer: {
alignItems: "center",
justifyContent: "center",
height: 188,
width: "100%"
}
});
const r37 = memo(function PremiumDiscountOfferActionSheetContent(props) {
const { discountOffer, onConfirm } = props;
const styles = useStyles();
const perks = [{
IconComponent: UserIcon,
label: intl.string(t.kpMomJ),
description: intl.string(t.uVUtPw)
}, {
IconComponent: ChatSmileIcon,
label: intl.string(t["R2IV/Q"]),
description: intl.string(t["3SUJLd"])
}, {
IconComponent: FolderIcon,
label: intl.string(t["u/NJKc"]),
description: intl.string(t.i1UuMk)
}];
const amount = discountOffer.discount.amount;
return <View style={styles.contentContainer}>
<View style={styles.heroIllustrationContainer}>
<NitroWumpusFlightRight3dIllustration width={180} height={180} />
</View>
<Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles.title}>
{intl.formatToPlainString(t.qowbUk, {
percent: amount
})}
</Text>
<PremiumPerksList perks={perks} />
<View style={styles.buttonContainer}>
<Button size="lg" text={intl.formatToPlainString(t.bkQ4bH, {
percent: amount
})} onPress={onConfirm} grow icon={<NitroWheelIcon size="md" color={Module712.unsafe_rawColors.WHITE} />} />
</View>
</View>;
});
export default r37;
@@ -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);
};
@@ -0,0 +1,213 @@
// Metro module 9824 (f9825).
import { useCallback, useEffect } from "react";
import { View } from "react-native";
import BadgeDirectoryStore from "../../../badges/BadgeDirectoryStore";
import { getNextTierForProgress, getRemainingGiftsToNextTier, getTierForProgress } from "../../gifting/GiftingBadgeConstants";
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 ModalActionCreators from "../../../../actions/ModalActionCreators";
import { getRootNavigationRef } from "../../../main_tabs_v2/RootNavigationRef.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { GiftIcon } from "../../../../design/components/Icon/native/redesign/generated/GiftIcon";
import { intl } from "../../../../intl/index.native";
import GiftingBadge_messages from "../../gifting/GiftingBadge.messages";
import GiftingBadgeProgress from "../../gifting/native/views/GiftingBadgeProgress";
import { Text } from "../../../../design/components/Text/native/Text";
import { triggerHapticFeedback } from "../../../haptics/HapticUtils.native";
import HapticFeedbackTypes from "../../../haptics/HapticFeedbackTypes";
import GiftingBadgeIcon from "../../gifting/native/views/GiftingBadgeIcon";
import GiftingBadgeLevelUpProgress from "../../gifting/native/views/GiftingBadgeLevelUpProgress";
import { UNSAFE_markDismissibleContentAsDismissed } from "../../../dismissible_content/DismissibleContentUnsafeUtils";
import { DismissibleContent } from "../../../../_bundle/Module1358";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { BadgeId } from "../../../../_bundle/Module8106";
let useStyles, InProgressScreen, LevelUpScreen;
const PostPurchaseFooter = function PostPurchaseFooter(props) {
const onSendGift = props.onSendGift;
const styles = useStyles(useSafeAreaInsets_native().bottom);
const callback2 = useCallback(() => {
ModalActionCreators.pop();
onSendGift();
}, [onSendGift]);
const callback = useCallback(() => {
ModalActionCreators.pop();
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
rootNavigationRef.navigate("you");
}
}, []);
return <View style={styles.footer}>
<Button grow variant="primary" icon={<GiftIcon size="sm" color={Module712.colors.CONTROL_PRIMARY_TEXT_DEFAULT} />} text={intl.string(GiftingBadge_messages.g86YiI)} onPress={callback2} />
<Button grow variant="secondary" text={intl.string(GiftingBadge_messages["sa/cfM"])} onPress={callback} />
</View>;
};
InProgressScreen = function InProgressScreen(props) {
const { progress, title, progressBarTitle, description, currentTier, nextTier, onSendGift: onSendGift2 } = props;
const styles = useStyles(useSafeAreaInsets_native().bottom);
return <View style={styles.screenContainer}>
<View style={styles.content}>
<View style={styles.progressWrapper}>
<GiftingBadgeProgress progress={progress} currentTier={currentTier} nextTier={nextTier} iconSize={48} title={progressBarTitle} />
</View>
<View style={styles.messageSection}>
<Text variant="heading-xxl/bold" style={styles.centerText}>{title}</Text>
<Text variant="text-md/medium" color="text-subtle" style={styles.centerText}>{description}</Text>
</View>
</View>
<PostPurchaseFooter onSendGift={onSendGift2} />
</View>;
};
LevelUpScreen = function LevelUpScreen(props) {
const { simulatedProgress, currentTier, newTier, nextTier, giftsToNextTier, onSendGift: onSendGift2 } = props;
const styles = useStyles(useSafeAreaInsets_native().bottom);
useEffect(() => {
triggerHapticFeedback(HapticFeedbackTypes.IMPACT_HEAVY);
}, []);
const r45 = [<View style={styles.levelUpIconWrapper}>
{newTier.simple_icon_url != null && <GiftingBadgeIcon icon={newTier.simple_icon_url} size={140} />}
</View>, ,];
const r53 = [<GiftingBadgeLevelUpProgress progress={simulatedProgress} currentTier={currentTier} newTier={newTier} style={styles.levelUpProgress} />, ,];
let name = newTier.name;
if (name == null) {
name = "";
}
const r69 = [<Text variant="heading-xxl/bold" style={styles.centerText}>
{intl.format(GiftingBadge_messages.k8MmO8, {
tierName: name
})}
</Text>, ,];
let r70 = nextTier != null && giftsToNextTier != null && giftsToNextTier > 0;
if (r70) {
const r82 = GiftingBadge_messages["6QVlxw"];
let name2 = nextTier.name;
if (name2 == null) {
name2 = "";
}
r70 = <Text variant="text-md/normal" color="text-subtle" style={styles.centerText}>
{intl.format(r82, {
count: giftsToNextTier,
nextTierName: name2
})}
</Text>;
}
r69[1] = r70;
r53[1] = <View style={styles.messageSection}>{r69}</View>;
r45[1] = <View style={styles.levelUpBody}>{r53}</View>;
return <View style={styles.screenContainer}>
<View style={styles.content}>{r45}</View>
<PostPurchaseFooter onSendGift={onSendGift2} />
</View>;
};
useStyles = createStyles((a0) => ({
screenContainer: {
flex: 1
},
content: {
flex: 1,
alignItems: "center",
justifyContent: "center",
padding: Module712.space.PX_16
},
progressWrapper: {
padding: Module712.space.PX_16,
width: "100%",
marginBottom: Module712.space.PX_24
},
messageSection: {
gap: Module712.space.PX_12,
alignItems: "center",
width: "100%",
paddingHorizontal: Module712.space.PX_16
},
centerText: {
textAlign: "center"
},
levelUpIconWrapper: {
paddingVertical: 26,
paddingHorizontal: 74,
marginBottom: Module712.space.PX_48
},
levelUpBody: {
gap: Module712.space.PX_12,
alignItems: "center",
width: "100%"
},
levelUpProgress: {
maxWidth: 260
},
footer: {
width: "100%",
gap: Module712.space.PX_12,
paddingHorizontal: Module712.space.PX_16,
paddingBottom: Module712.space.PX_16 + a0
}
}));
export default function GiftBadgePostPurchase(props) {
let r100, props2;
const { currentProgress, onSendGift: onSendGift2 } = props;
useEffect(() => {
UNSAFE_markDismissibleContentAsDismissed(DismissibleContent.NEW_GIFTING_BADGES_COACHMARK, {
dismissAction: ContentDismissActionType.INDIRECT_ACTION
});
}, []);
const stateFromStores = useStateFromStores([BadgeDirectoryStore], () => BadgeDirectoryStore.getBadgeById(BadgeId.GIFTING)?.tiers);
if (stateFromStores == null) {
return null;
}
const tierForProgress2 = getTierForProgress(stateFromStores, currentProgress);
const simulatedProgress = currentProgress + 1;
const tierForProgress = getTierForProgress(stateFromStores, simulatedProgress);
const key = tierForProgress?.key;
const key2 = tierForProgress2?.key;
const nextTierForProgress = getNextTierForProgress(stateFromStores, simulatedProgress);
const remainingGiftsToNextTier = getRemainingGiftsToNextTier(stateFromStores, simulatedProgress);
if (key !== key2 && tierForProgress != null) {
r100 = <LevelUpScreen simulatedProgress={simulatedProgress} currentTier={tierForProgress2} newTier={tierForProgress} nextTier={nextTierForProgress} giftsToNextTier={remainingGiftsToNextTier} onSendGift={onSendGift2} />;
} else {
if (remainingGiftsToNextTier === 1) {
let nextTier = nextTierForProgress?.name;
if (nextTier == null) {
nextTier = "";
}
const r81 = {
title: intl.formatToPlainString(GiftingBadge_messages.KjdBPz, {
nextTier
}),
description: intl.string(GiftingBadge_messages.oqDrEM),
progressBarTitle: intl.string(GiftingBadge_messages["Ka5s+Q"]),
progress: simulatedProgress,
currentTier: null,
nextTier: null,
onSendGift: null
};
let currentTier = tierForProgress;
if (currentTier == null) {
currentTier = void 0;
}
r81.currentTier = currentTier;
let nextTier2 = nextTierForProgress;
if (nextTier2 == null) {
nextTier2 = void 0;
}
r81.nextTier = nextTier2;
r81.onSendGift = onSendGift2;
props2 = r81;
} else {
props2 = {
title: intl.string(GiftingBadge_messages["/rBQud"]),
description: intl.string(GiftingBadge_messages.DDQMlx),
progressBarTitle: tierForProgress2?.name != null ? intl.formatToPlainString(GiftingBadge_messages.bwyQt8, {
tierName: tierForProgress2?.name
}) : "",
progress: simulatedProgress,
currentTier: tierForProgress == null ? void 0 : tierForProgress,
nextTier: nextTierForProgress == null ? void 0 : nextTierForProgress,
onSendGift: onSendGift2
};
}
r100 = <InProgressScreen {...props2} />;
}
return r100;
};
@@ -0,0 +1,90 @@
// Metro module 11409 (f11410).
import { useRef, useEffect } from "react";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import { useToken } from "../../../../design/tokens/native/useToken";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { isIOS } from "../../../../utils/PlatformUtils";
import ReanimatedRexport, { FadeOut } from "../../../reanimated/ReanimatedRexport";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import LottieAnimationView from "../../../../components_native/common/LottieAnimationView";
const useStyles = createStyles((a0, a1) => ({
container: {
backgroundColor: Module712.colors.REDESIGN_BUTTON_TERTIARY_BACKGROUND,
width: a0,
height: a0,
borderRadius: Module712.radii.round,
marginHorizontal: a1,
display: "flex",
alignItems: "center",
justifyContent: "center"
},
containerRefresh: {
width: a0,
height: a0,
borderRadius: Module712.radii.sm,
marginHorizontal: a1,
display: "flex",
alignItems: "center",
justifyContent: "center"
},
animation: {
width: 30,
height: 30
},
animationRefresh: {
width: 24,
height: 24
}
}));
export function PremiumAnimatedGiftButton(props) {
let active = props.active;
const { style, activeStyle, disabled, accessibilityState, channelId, animationDataUrl, onAnimationFinished, loop } = props;
const enabled = useMobileVisualRefreshConfig({
location: "PremiumAnimatedGiftButton"
}).enabled;
const token = useToken(Module712.modules.mobile.CHAT_INPUT_ACTION_BUTTON_SIZE);
const token2 = useToken(Module712.modules.mobile.CHAT_INPUT_ACTION_BUTTON_MARGIN);
const token3 = useToken(Module712.modules.mobile.CHAT_INPUT_BUTTON_MIN_TOUCH_TARGET_SIZE);
const styles = useStyles(token, token2);
const r63 = Math.max(0, (token3 - token) / 2);
const ref = useRef(null);
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
useEffect(() => {
if (!stateFromStores) {
if (isIOS() && ref != null) {
const current = ref.current;
if (current != null) {
current.reset();
}
}
if (ref != null) {
const current2 = ref.current;
if (current2 != null) {
current2.play();
}
}
}
}, [channelId, stateFromStores]);
const exiting = stateFromStores ? void 0 : FadeOut;
const style2 = [enabled ? styles.containerRefresh : styles.container, style, ,];
if (active) {
active = !disabled;
}
if (active) {
active = activeStyle;
}
style2[2] = active;
return <ReanimatedRexport.View exiting={exiting}>
<PressableOpacity style={style2} hitSlop={r63 > 0 ? r63 : void 0} accessibilityRole="button" accessibilityState={{
disabled,
...accessibilityState
}} {...props}>
<LottieAnimationView ref={ref} style={enabled ? styles.animationRefresh : styles.animation} source={{
uri: animationDataUrl
}} loop={loop} autoPlay={false} onAnimationFinish={onAnimationFinished} />
</PressableOpacity>
</ReanimatedRexport.View>;
}
@@ -0,0 +1,43 @@
// Metro module 9712 (f9713).
import { useRef, useState, useEffect } from "react";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useAPNGPlayerControls, APNGPlayer } from "../../../image/native/APNGPlayer.android";
import { isAndroid } from "../../../../utils/PlatformUtils";
import useTimeout from "../../../../hooks/useTimeout";
import FastImage from "../../../../components_native/common/FastImage";
export default function PremiumFeaturesPromotionalLogo(props) {
const { rotatingAvatarImageUrl, promoRotatingStyle, shouldAnimate = true } = props;
let aPNGPlayerControls, state, setState;
let c17423_0 = shouldAnimate;
aPNGPlayerControls = void 0;
state = void 0;
setState = void 0;
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
let r2 = null;
const ref = useRef(null);
aPNGPlayerControls = useAPNGPlayerControls(ref);
[state, setState] = useState(false);
useEffect(() => {
if (isAndroid() && !stateFromStores) {
if (c17423_0) {
aPNGPlayerControls.seek(0);
setState(true);
} else {
setState(false);
aPNGPlayerControls.stop();
}
}
}, [shouldAnimate, aPNGPlayerControls, stateFromStores]);
if (state) {
r2 = 100;
}
useTimeout(() => {
if (state) {
aPNGPlayerControls.play();
}
}, r2);
return isAndroid() && !stateFromStores ? <APNGPlayer ref={ref} url={rotatingAvatarImageUrl} autoplay={false} style={promoRotatingStyle} /> : <FastImage style={promoRotatingStyle} resizeMode="contain" source={{
uri: rotatingAvatarImageUrl
}} />;
};
@@ -0,0 +1,57 @@
// Metro module 9828 (f9829).
import { useRef, useEffect } from "react";
import { AnalyticEvents } from "../../../../Constants";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
import { PaymentFlowStep, getPaymentFlowStepAnalyticsFields } from "../PremiumAnalyticsUtils";
import { isIOS } from "../../../../utils/PlatformUtils";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { intl, t } from "../../../../intl/index.native";
import { trackPaymentFlowStartedAnalyticsAndCTP } from "../../../experiments/trigger_points/PaymentFlowStartedTriggerPoint";
export default function PremiumGiftAnalytics({ currentStep, children }) {
const nativeGiftContext = useNativeGiftContext();
const { customGiftMessage, productId, basePurchaseAnalytics } = nativeGiftContext;
const ref = useRef(null);
const r22 = Date.now();
const ref2 = useRef(r22);
const ref3 = useRef(r22);
useEffect(() => {
if (currentStep !== ref.current) {
const current = Date.now();
if (ref.current != null) {
if (currentStep === PaymentFlowStep.CONFIRM && isIOS()) {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_SUCCEEDED, {
...getPaymentFlowStepAnalyticsFields(basePurchaseAnalytics, {
subscription_plan_gateway_plan_id: productId
}),
is_custom_message_edited: customGiftMessage !== intl.string(t.ZkOo1U),
is_custom_emoji_sound_available: false
});
}
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_STEP, {
...getPaymentFlowStepAnalyticsFields(basePurchaseAnalytics, {
from_step: ref.current,
to_step: currentStep,
step_duration_ms: current - ref3.current,
flow_duration_ms: current - ref2.current,
subscription_plan_gateway_plan_id: productId
})
});
} else {
trackPaymentFlowStartedAnalyticsAndCTP(basePurchaseAnalytics);
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_LOADED, {
...getPaymentFlowStepAnalyticsFields(basePurchaseAnalytics, {
initial_step: currentStep
})
});
}
ref.current = currentStep;
ref3.current = current;
}
}, [basePurchaseAnalytics, currentStep, ref, customGiftMessage, productId]);
useEffect(() => () => {
if (ref.current !== PaymentFlowStep.CONFIRM) {
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_CANCELED, basePurchaseAnalytics);
}
}, [basePurchaseAnalytics, ref]);
return children;
};
@@ -0,0 +1,110 @@
// Metro module 8778 (f8779).
import { useRef, useState, useMemo, useCallback, useEffect } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../../a11y/AccessibilityStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { AnimationState } from "../../PremiumGiftingUtils";
import { getGiftAnimationData, getLottieType, LottieType } from "../utils/GiftAnimationData";
import LottieAnimationView from "../../../../components_native/common/LottieAnimationView";
const useStyles = createStyles({
container: {
display: "flex",
alignItems: "flex-end",
justifyContent: "center",
flexDirection: "row"
},
consistentHeight: {
height: 300
},
animation: {
maxWidth: 375,
width: "100%",
height: "auto"
},
baseAnimation: {
position: "absolute",
bottom: 0
},
lottie: {
height: 275
}
});
export default function PremiumGiftBackgroundAnimation(props) {
let ref, ref2, state, setState, state2, setState2, state3, setState3, state4, setState4;
const giftStyle = props.giftStyle;
let withConsistentHeight = props.withConsistentHeight;
ref = void 0;
ref2 = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
state3 = void 0;
setState3 = void 0;
state4 = void 0;
setState4 = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
ref = useRef(null);
ref2 = useRef(null);
[state, setState] = useState(AnimationState.ACTION);
[state2, setState2] = useState(void 0);
[state3, setState3] = useState(void 0);
[state4, setState4] = useState(false);
const memo = useMemo(() => getGiftAnimationData(giftStyle, AnimationState.ACTION), [giftStyle]);
const memo2 = useMemo(() => getGiftAnimationData(giftStyle, AnimationState.LOOP), [giftStyle]);
const lottieType = getLottieType(giftStyle);
useMemo(() => {
if (state2 !== giftStyle) {
setState2(giftStyle);
setState4(state !== AnimationState.LOOP && state3 != null);
setState(AnimationState.ACTION);
}
}, [state3, state2, giftStyle, state]);
const callback = useCallback((a0) => {
if (state4) {
setState4(false);
} else if (!(state === AnimationState.LOOP || a0)) {
setState3(AnimationState.ACTION);
setState(AnimationState.LOOP);
}
}, [state, state4]);
useEffect(() => {
if (state === AnimationState.LOOP) {
const current2 = ref.current;
if (current2 != null) {
current2.reset();
}
} else {
const current = ref2.current;
if (current != null) {
current.reset();
}
}
}, [state]);
useEffect(() => {
if (stateFromStores) {
const current = ref.current;
if (current != null) {
current.reset();
}
}
}, [stateFromStores]);
const style = [styles.container, ,];
if (withConsistentHeight) {
withConsistentHeight = styles.consistentHeight;
}
style[1] = withConsistentHeight;
const style2 = [styles.baseAnimation, styles.animation, lottieType === LottieType.LOTTIE && styles.lottie, ,];
const r98 = state2 === giftStyle;
style2[3] = {
opacity: r98 ? state !== AnimationState.LOOP ? 1 : 0 : 0
};
return <View style={style}>
<LottieAnimationView style={style2} hardwareAccelerationAndroid={lottieType === LottieType.LOTTIE} ref={ref} source={memo} autoPlay={!stateFromStores} onAnimationFinish={callback} loop={false} />
<LottieAnimationView style={[styles.animation, lottieType === LottieType.LOTTIE && styles.lottie, {
opacity: r98 ? state === AnimationState.LOOP ? 1 : 0 : 0
}]} hardwareAccelerationAndroid={lottieType === LottieType.LOTTIE} ref={ref2} source={memo2} autoPlay={stateFromStores ? !stateFromStores : state === AnimationState.LOOP} loop />
</View>;
};
@@ -0,0 +1,64 @@
// Metro module 8777 (f8778).
import { useState, useEffect } from "react";
import { ScrollView } from "react-native";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _native from "../../../../design/void/native";
import PremiumGiftBackgroundAnimation_android from "./PremiumGiftBackgroundAnimation.android";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
let AnimatedComponent, useStyles, __initData;
const GiftBackgroundSelect = function GiftBackgroundSelect(props) {
const { giftStyle, withConsistentHeight = true } = props;
const styles = useStyles();
const width = useWindowDimensions_native().width;
const [state, setState] = useState();
const sharedValue = useSharedValue(false);
useEffect(() => {
sharedValue.set(state != null);
}, [state, sharedValue]);
const N = function N() {
return {
opacity: _timing.withTiming(sharedValue.get() ? 1 : 0, {
easing: _native.STANDARD_EASING,
duration: 100
})
};
};
N.__closure = {
STANDARD_EASING: _native.STANDARD_EASING,
withTiming: _timing.withTiming,
visibility: sharedValue
};
N.__workletHash = 5743780040676;
N.__initData = __initData;
return <>
{[<PremiumGiftBackgroundAnimation_android giftStyle={giftStyle} withConsistentHeight={withConsistentHeight} />, <AnimatedComponent onContentSizeChange={(event) => {
if (state == null) {
setState(event);
}
}} contentContainerStyle={[styles.contentContainer, state != null && state < width && {
flex: 1
}]} style={[styles.scrollView, useAnimatedStyle(N)]} horizontal showsHorizontalScrollIndicator={false} />]}
</>;
};
AnimatedComponent = ReanimatedRexport.createAnimatedComponent(ScrollView);
useStyles = createStyles({
scrollView: {
flex: 1,
marginTop: Module712.space.PX_24
},
contentContainer: {
justifyContent: "center"
}
});
__initData = {
code: "function PremiumGiftBackgroundSelectTsx1(){const{STANDARD_EASING,withTiming,visibility}=this.__closure;const animationSettings={easing:STANDARD_EASING,duration:100};return{opacity:withTiming(visibility.get()?1:0,animationSettings)};}"
};
export default function PremiumGiftBackgroundSelect() {
const nativeGiftContext = useNativeGiftContext();
return <GiftBackgroundSelect giftStyle={nativeGiftContext.giftStyle} setGiftStyle={nativeGiftContext.setGiftStyle} />;
};
export { GiftBackgroundSelect };
@@ -0,0 +1,91 @@
// Metro module 11890 (f11891).
import { Pressable, View } from "react-native";
import { PremiumGiftStyles } from "../../PremiumConstants";
import { GIFT_STYLE_DESCRIPTIONS } from "../../gifting/PremiumGiftingConstants";
import Module11892 from "../../../../_bundle/Module11892";
import Module11893 from "../../../../_bundle/Module11893";
import Module11894 from "../../../../_bundle/Module11894";
import Module11895 from "../../../../_bundle/Module11895";
import Module11896 from "../../../../_bundle/Module11896";
import Module11897 from "../../../../_bundle/Module11897";
import Module11898 from "../../../../_bundle/Module11898";
import Module11899 from "../../../../_bundle/Module11899";
import Module11900 from "../../../../_bundle/Module11900";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl } from "../../../../intl/index.native";
import PremiumGifting_messages from "../../gifting/PremiumGifting.messages";
import FastImage from "../../../../components_native/common/FastImage";
const r31 = {};
r31[PremiumGiftStyles.STANDARD_BOX] = Module11892;
r31[PremiumGiftStyles.CAKE] = Module11893;
r31[PremiumGiftStyles.CHEST] = Module11894;
r31[PremiumGiftStyles.COFFEE] = Module11895;
r31[PremiumGiftStyles.NITROWEEN_STANDARD] = {
uri: Module11896
};
r31[PremiumGiftStyles.SNOWGLOBE] = null;
r31[PremiumGiftStyles.BOX] = null;
r31[PremiumGiftStyles.CUP] = null;
r31[PremiumGiftStyles.SEASONAL_CAKE] = {
uri: Module11897
};
r31[PremiumGiftStyles.SEASONAL_CHEST] = {
uri: Module11898
};
r31[PremiumGiftStyles.SEASONAL_COFFEE] = {
uri: Module11899
};
r31[PremiumGiftStyles.SEASONAL_STANDARD_BOX] = {
uri: Module11900
};
let c8155_8 = r31;
const useStyles = createStyles((a0) => ({
container: {
width: 78,
height: 44,
justifyContent: "center",
marginEnd: Module712.space.PX_8,
marginStart: a0 === 0 ? 20 : 0
},
selected: {
position: "absolute",
borderColor: Module712.colors.TEXT_BRAND,
borderRadius: Module712.radii.sm,
borderWidth: 2,
flex: 1,
width: 78,
height: 44
},
image: {
width: 72,
height: 38,
alignSelf: "center"
}
}));
export default function GiftBackgroundSelectTile(props) {
const index = props.index;
let selected = props.selected;
const { giftStyle, onPress } = props;
const styles = useStyles(index);
const source = c8155_8[giftStyle];
let r23 = null;
if (source != null) {
const props2 = {
"aria-label": intl.formatToPlainString(PremiumGifting_messages["+utqaz"], {
giftStyle: intl.string(GIFT_STYLE_DESCRIPTIONS[giftStyle])
}),
"aria-selected": selected,
style: styles.container,
onPress,
children: null
};
if (selected) {
selected = <View style={styles.selected} />;
}
props2.children = [selected, <FastImage resizeMode="contain" style={styles.image} source={source} />];
r23 = <Pressable {...props2} />;
}
return r23;
};
export { c8155_8 as GIFT_STYLE_IMG };
@@ -0,0 +1,33 @@
// Metro module 8811 (f8812).
import { useCallback, memo } from "react";
import { View } from "react-native";
import { CUSTOM_GIFT_MESSAGE_MAX_LENGTH } from "../../PremiumConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import { TextArea } from "../../../../design/components/TextInput/native/TextArea.native";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
let useStyles;
const GiftCustomMessage = function GiftCustomMessage(props) {
const { onFocusMessage, setMessagePosition, customGiftMessage, setCustomGiftMessage } = props;
const styles = useStyles();
const placeholder = intl.string(t.ZkOo1U);
const callback = useCallback((a0) => {
setCustomGiftMessage(a0);
}, [setCustomGiftMessage]);
return <View style={styles.container} onLayout={(event) => setMessagePosition(event.nativeEvent.layout.y)}>
<TextArea label={intl.string(t.B3miE8)} placeholder={placeholder} value={customGiftMessage} onChange={callback} maxLength={CUSTOM_GIFT_MESSAGE_MAX_LENGTH} onFocus={onFocusMessage} />
</View>;
};
useStyles = createStyles({
container: {
marginTop: Module712.space.PX_24,
marginHorizontal: Module712.space.PX_16
}
});
const r41 = memo(function({ onFocusMessage, setMessagePosition: setMessagePosition2 }) {
const nativeGiftContext = useNativeGiftContext();
return <GiftCustomMessage onFocusMessage={onFocusMessage} setMessagePosition={setMessagePosition2} customGiftMessage={nativeGiftContext.customGiftMessage} setCustomGiftMessage={nativeGiftContext.setCustomGiftMessage} />;
});
export default r41;
export { GiftCustomMessage };
@@ -0,0 +1,74 @@
// Metro module 9780 (f9781).
import { useState, useRef, useCallback, useEffect } from "react";
import { ScrollView, View } from "react-native";
import { PremiumTypes } from "../../PremiumConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
import { useGiftingPromotionDefaultSelectionV2 } from "../../gifting/hooks/useGiftingPromotionDefaultSelection";
import { intl, t } from "../../../../intl/index.native";
import PremiumGiftBackgroundSelect from "./PremiumGiftBackgroundSelect";
import PremiumGiftDuration from "./PremiumGiftDuration";
import { Text } from "../../../../design/components/Text/native/Text";
import LockedRecipientField from "../../../checkout/native/gifting/LockedRecipientField";
import PremiumGiftCustomMessage from "./PremiumGiftCustomMessage";
import PremiumGiftPurchaseButton from "./PremiumGiftPurchaseButton";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
scrollViewContainer: {
paddingBottom: Module712.space.PX_24
},
senderHeaderTitle: {
marginTop: Module712.space.PX_24,
marginLeft: Module712.space.PX_16,
marginBottom: Module712.space.PX_8,
fontSize: 14
}
});
export default function PremiumGiftCustomization() {
let nitroTierName;
const navigation = useNavigation();
const styles = useStyles();
const nativeGiftContext = useNativeGiftContext();
const { recipientUser, premiumType } = nativeGiftContext;
const giftingPromotionDefaultSelectionV2 = useGiftingPromotionDefaultSelectionV2(nativeGiftContext.claimableRewards, nativeGiftContext.selectedGiftingPromotionReward);
const [state, setMessagePosition] = useState(0);
const ref = useRef(null);
const callback = useCallback(() => {
setTimeout(() => {
const current = ref.current;
return current == null ? void 0 : current.scrollTo({
y: state,
animated: true
});
}, 100);
}, [state]);
nitroTierName = premiumType === PremiumTypes.TIER_2 ? intl.string(t.lG6a5x) : intl.string(t["t9uG/o"]);
useEffect(() => {
navigation.setOptions({
title: intl.formatToPlainString(t["RMu0/q"], {
nitroTierName
})
});
}, [navigation, nitroTierName]);
return <View style={styles.container}>
<ScrollView ref={ref} contentContainerStyle={styles.scrollViewContainer} showsVerticalScrollIndicator={false}>
<View>
<PremiumGiftBackgroundSelect />
<PremiumGiftDuration />
{recipientUser != null && <>
<Text style={styles.senderHeaderTitle} variant="text-md/semibold">
{intl.string(t.NlkxGS)}
</Text>
<LockedRecipientField user={recipientUser} />
<PremiumGiftCustomMessage onFocusMessage={callback} setMessagePosition={setMessagePosition} />
</>}
</View>
</ScrollView>
<PremiumGiftPurchaseButton defaultSelection={giftingPromotionDefaultSelectionV2} />
</View>;
};
@@ -0,0 +1,56 @@
// Metro module 9788 (f9789).
import { useCallback } from "react";
import { View } from "react-native";
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 { PremiumGiftScreens } from "./PremiumGiftModal";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../intl/index.native";
import PremiumGifting_messages from "../../gifting/PremiumGifting.messages";
import PremiumGiftBackgroundAnimation_android from "./PremiumGiftBackgroundAnimation.android";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
title: {
marginTop: Module712.space.PX_24,
textAlign: "center"
},
description: {
marginTop: Module712.space.PX_8,
textAlign: "center"
}
});
export default function PremiumGiftDMSuccessBody() {
const styles = useStyles();
return <>
<View>
<PremiumGiftBackgroundAnimation_android giftStyle={useNativeGiftContext().giftStyle} />
</View>
<Text style={styles.title} variant="heading-lg/bold">
{intl.string(t.MqZXbv)}
</Text>
<Text style={styles.description} variant="text-md/medium">
{intl.string(t.Y1keV0)}
</Text>
</>;
};
export function PremiumGiftDMSuccessActions() {
const nativeGiftContext = useNativeGiftContext();
const { onClose, prePurchaseGiftingBadgeProgress } = nativeGiftContext;
const navigation = useNavigation();
const enabled = GiftingBadgeExperiment.useConfig({
location: "PremiumGiftDMSuccessActions"
}).enabled;
const callback = useCallback(() => {
if (enabled && prePurchaseGiftingBadgeProgress != null) {
navigation.navigate(PremiumGiftScreens.GIFTING_BADGE, {
currentProgress: prePurchaseGiftingBadgeProgress
});
} else {
onClose();
}
}, [enabled, prePurchaseGiftingBadgeProgress, navigation, onClose]);
return <Button text={intl.string(PremiumGifting_messages.bGKjmg)} variant="primary" onPress={callback} />;
}
@@ -0,0 +1,94 @@
// Metro module 9782 (f9783).
import { useMemo } from "react";
import { View } from "react-native";
import { PREMIUM_YEARLY_DISCOUNT_PERCENT, SubscriptionIntervalTypes } from "../../PremiumConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import { RowButton } from "../../../../design/components/TableRow/native/RowButton.native";
import usePremiumProductPricingString from "../hooks/usePremiumProductPricingString";
import { useRadioA11yNative } from "../../../../_bundle/Module3907";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import NitroGiftPriceCopyExperiment from "../../gifting/experiments/NitroGiftPriceCopyExperiment";
import useInitialValue from "../../../../hooks/useInitialValue";
let c6487_9, useStyles, useStyles2;
const PremiumGiftDurationButton = function PremiumGiftDurationButton(props) {
let selected = props.selected;
const planInterval = props.planInterval;
const nativeGiftContext = useNativeGiftContext();
const { premiumType, setPlanInterval } = nativeGiftContext;
const styles = useStyles();
const Component = selected ? TableRow : RowButton;
const discount = planInterval === SubscriptionIntervalTypes.YEAR ? `${PREMIUM_YEARLY_DISCOUNT_PERCENT}%` : null;
const premiumProductPricingString = usePremiumProductPricingString(premiumType, planInterval);
const radioA11yNative = useRadioA11yNative({
selected
});
const { accessibilityRole, accessibilityState } = radioA11yNative;
const style = [styles.container, ,];
if (selected) {
selected = styles.containerSelected;
}
style[1] = selected;
return <View style={style}>
<Component label={<View style={styles.labelContainer}>
<Text variant="text-md/semibold">
{planInterval === SubscriptionIntervalTypes.MONTH ? intl.string(t.Mh9bTt) : intl.string(t.DRgqMo)}
</Text>
{discount != null && <View style={styles.labelPromo}>
<Text variant="text-md/bold" color="text-overlay-light">
{intl.formatToPlainString(t.IAybsG, {
discount
}).toUpperCase()}
</Text>
</View>}
</View>} trailing={<Text variant="text-md/semibold">{premiumProductPricingString}</Text>} onPress={() => {
setPlanInterval(planInterval);
}} arrow={false} accessibilityRole={accessibilityRole} accessibilityState={accessibilityState} start end />
</View>;
};
c6487_9 = [SubscriptionIntervalTypes.YEAR, SubscriptionIntervalTypes.MONTH];
useStyles = createStyles({
container: {
marginTop: Module712.space.PX_8
},
containerSelected: {
borderColor: Module712.colors.BACKGROUND_BRAND,
borderRadius: Module712.radii.lg,
borderWidth: 2
},
labelContainer: {
flexDirection: "row"
},
labelPromo: {
marginStart: Module712.space.PX_8,
backgroundColor: Module712.colors.STATUS_POSITIVE_BACKGROUND,
paddingHorizontal: Module712.space.PX_8,
borderRadius: Module712.radii.round
}
});
useStyles2 = createStyles({
durationContainer: {
marginHorizontal: Module712.space.PX_16
},
durationTitle: {
marginTop: Module712.space.PX_24
}
});
export default function PremiumGiftDuration() {
const styles2 = useStyles2();
const planInterval2 = useNativeGiftContext().planInterval;
const initialValue = useInitialValue(NitroGiftPriceCopyExperiment.useConfig({
location: "PremiumGiftDuration"
}).monthlyDefaultSelected);
let c17486_1 = initialValue;
const memo = useMemo(() => c17486_1 ? [...c6487_9].reverse() : c6487_9, [initialValue]);
return <View style={styles2.durationContainer}>
<Text style={styles2.durationTitle} variant="text-sm/semibold">
{intl.string(t["8XT6Nf"])}
</Text>
{memo.map((item, index) => <PremiumGiftDurationButton key={index} selected={planInterval2 === item} planInterval={item} />)}
</View>;
};
@@ -0,0 +1,217 @@
// Metro module 9707 (f9708).
import { memo, useState, useCallback } from "react";
import { View } from "react-native";
import PromotionsStore from "../../promotions/PromotionsStore";
import { PremiumTypes, SubscriptionIntervalTypes } from "../../PremiumConstants";
import { Fonts } from "../../../../_bundle/Module505";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import TextStyles from "../../../rebrand/native/TextStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { MarketingComponentType } from "../../../../_bundle/Module6567";
import { useThemeAndReducedMotionAwareAssetUrl } from "../../promotions/MarketingComponentHooks";
import usePremiumFeatures from "../../../user_settings/premium/native/utils/usePremiumFeatures";
import usePremiumProductPricingString from "../hooks/usePremiumProductPricingString";
import NitroGiftPriceCopyExperiment from "../../gifting/experiments/NitroGiftPriceCopyExperiment";
import useShouldShowGiftingPromotionDeco from "../../gifting/native/hooks/useShouldShowGiftingPromotionDeco";
import FastImage from "../../../../components_native/common/FastImage";
import PremiumFeaturesBackground from "../../../user_settings/premium/native/PremiumFeaturesBackground";
import PremiumGiftPlanSelectPromotionalBanner from "./PremiumGiftPlanSelectPromotionalBanner";
import PremiumFeaturesWumpus from "../../../user_settings/premium/native/PremiumFeaturesWumpus";
import PremiumFeaturesLogo from "../../../user_settings/premium/native/PremiumFeaturesLogo";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import PremiumFeatureList from "../../../../components_native/premium/PremiumFeatureList";
import { Button } from "../../../../design/components/Button/native/Button.native";
let c6424_13 = {
default: {
paddingVertical: Module712.space.PX_8
},
compact: {
paddingVertical: Module712.space.PX_4
},
smallCompact: {
paddingVertical: 2
}
};
let c6424_14 = {
default: {
marginTop: Module712.space.PX_24
},
compact: {
marginTop: Module712.space.PX_12
},
smallCompact: {
marginTop: Module712.space.PX_8
}
};
let c6424_15 = {
default: {
marginTop: Module712.space.PX_8
},
compact: {
marginTop: Module712.space.PX_12
},
smallCompact: {
marginTop: Module712.space.PX_8
}
};
let c6424_16 = {
default: {
marginTop: Module712.space.PX_24
},
compact: {
marginTop: Module712.space.PX_12
},
smallCompact: {
marginTop: Module712.space.PX_8
}
};
const useStyles = createStyles(() => ({
promotional: {
overflow: "hidden",
borderRadius: Module712.radii.sm
},
card: {
justifyContent: "flex-start",
borderRadius: Module712.radii.sm,
backgroundColor: Module712.colors.BG_SURFACE_RAISED,
...Module712.shadows.SHADOW_LOW
},
logo: {
marginTop: Module712.space.PX_40,
marginStart: Module712.space.PX_24
},
promotionalLogo: {
marginTop: Module712.space.PX_24
},
promotionalLogoSingleLine: {
marginTop: Module712.space.PX_32
},
promotionalLogoSmallCompact: {
marginTop: 18
},
pricing: {
maxWidth: 140,
marginStart: Module712.space.PX_24
},
featureTitle: {
marginStart: Module712.space.PX_24
},
features: {
marginTop: Module712.space.PX_8,
marginHorizontal: Module712.space.PX_24
},
button: {
marginHorizontal: Module712.space.PX_24,
marginBottom: Module712.space.PX_24
},
promotionalButton: {
marginTop: Module712.space.PX_12
},
featureIcon: {
width: 24,
height: 24
},
featureText: {
...TextStyles(Fonts.PRIMARY_NORMAL, Module712.colors.WHITE, 16),
marginStart: -8
},
wumpusNoPrice: {
height: 75,
right: 8
},
promotionalCardImage: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0
},
promotionalBackground: {
position: "absolute",
height: 300,
width: 150,
right: 0
}
}));
const r101 = memo(function PremiumGiftFeaturesCard(props) {
let r161;
const { premiumType, onPress, style, claimableRewards, isSelected = true, variant = "default", ...props2 } = props;
let setState;
setState = void 0;
const stateFromStores = useStateFromStores([PromotionsStore], () => {
const marketingComponentByType = PromotionsStore.getMarketingComponentByType(MarketingComponentType.GIFT_PLAN_SELECTION_CARD_BANNER);
return marketingComponentByType == null ? null : marketingComponentByType.properties.properties.oneofKind === "giftPlanSelectionCardBanner" ? marketingComponentByType.properties.properties.giftPlanSelectionCardBanner : null;
});
const themeAndReducedMotionAwareAssetUrl = useThemeAndReducedMotionAwareAssetUrl(stateFromStores?.cardAsset);
const themeAndReducedMotionAwareAssetUrl2 = useThemeAndReducedMotionAwareAssetUrl(stateFromStores?.backgroundAsset);
const styles = useStyles(claimableRewards != null && claimableRewards.length === 1);
const premiumFeatures = usePremiumFeatures(premiumType);
const premiumProductPricingString = usePremiumProductPricingString(premiumType, SubscriptionIntervalTypes.MONTH);
const premiumProductPricingString2 = usePremiumProductPricingString(premiumType, SubscriptionIntervalTypes.YEAR);
const config = NitroGiftPriceCopyExperiment.useConfig({
location: "PremiumGiftFeaturesCard"
});
let showGiftPrice = config.showGiftPrice;
const useNewCopy = config.useNewCopy;
let r21 = useShouldShowGiftingPromotionDeco(premiumType) && claimableRewards != null && claimableRewards.length > 0;
const r15 = r21 ? themeAndReducedMotionAwareAssetUrl != null : r21;
let top;
[top, setState] = useState(0);
const callback = useCallback((a0) => {
setState(a0.nativeEvent.layout.height);
}, []);
const style2 = [styles.card, style, r21 ? styles.promotional : r21];
const r96 = [r15 && <FastImage style={styles.promotionalCardImage} resizeMode="cover" source={{
uri: themeAndReducedMotionAwareAssetUrl
}} />, ,];
const opacity = r15 ? 0.82 : 1;
const style3 = [styles.card, style, r21 ? styles.promotional : r21];
const r130 = [r21 ? <>
{stateFromStores != null && <PremiumGiftPlanSelectPromotionalBanner giftPlanSelectionCardBannerComponent={stateFromStores} claimableRewards={claimableRewards} isSelected={isSelected} onLayout={callback} />}
{themeAndReducedMotionAwareAssetUrl2 != null && <FastImage style={[styles.promotionalBackground, {
top
}]} resizeMode="cover" source={{
uri: themeAndReducedMotionAwareAssetUrl2
}} />}
</> : <PremiumFeaturesWumpus premiumType={premiumType} style={showGiftPrice ? !showGiftPrice : styles.wumpusNoPrice} />, <PremiumFeaturesLogo style={[styles.logo, r21 ? claimableRewards.length === 1 ? styles.promotionalLogoSingleLine : styles.promotionalLogo : r21, (r21 ? variant === "smallCompact" : r21) && styles.promotionalLogoSmallCompact]} premiumType={premiumType} />, , , , , ,];
if (showGiftPrice) {
const props3 = {
style: [styles.pricing, c6424_15[variant]],
variant: "text-sm/medium",
color: "text-overlay-light",
children: null
};
if (useNewCopy) {
props3.children = [premiumProductPricingString, " ", intl.string(t.lVQycU)];
r161 = <Text {...props3} />;
} else {
props3.children = intl.format(t.Ob6fwp, {
monthlyPrice: premiumProductPricingString,
yearlyPrice: premiumProductPricingString2
});
r161 = <Text {...props3} />;
}
showGiftPrice = r161;
}
r130[2] = showGiftPrice;
r130[3] = <Text style={[styles.featureTitle, c6424_14[variant]]} variant="heading-sm/bold" color="text-overlay-light">
{intl.string(t.JgsVht)}
</Text>;
r130[4] = <PremiumFeatureList style={styles.features} features={premiumFeatures} iconStyle={styles.featureIcon} labelStyle={styles.featureText} rowStyle={c6424_13[variant]} />;
r130[5] = <View style={{
flexGrow: 1
}} />;
const style4 = [styles.button, c6424_16[variant], ,];
if (r21) {
r21 = styles.promotionalButton;
}
style4[2] = r21;
r130[6] = <View style={style4}>
<Button variant="primary-overlay" text={premiumType === PremiumTypes.TIER_0 ? intl.string(t.rk4Uu8) : intl.string(t.Ve9Ge6)} onPress={onPress} />
</View>;
r96[1] = <PremiumFeaturesBackground premiumType={premiumType} opacity={opacity} style={style3} {...props2}>{r130}</PremiumFeaturesBackground>;
return <View style={style2}>{r96}</View>;
});
export default r101;
@@ -0,0 +1,149 @@
// Metro module 9700 (f9701).
import { useMemo, useCallback, useState } from "react";
import UserStore from "../../../../stores/UserStore";
import { PaymentFlowStep, getBasePurchaseFlowAnalyticsFields } from "../PremiumAnalyticsUtils";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useFetchWishlistAndProfileInfoForUser, useShouldShowWishlistInDMGifting } from "../../../wishlists/hooks/useWishlistHooks";
import { intl, t } from "../../../../intl/index.native";
import { getHeaderCloseButton, getHeaderBackButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import PremiumGiftPlanSelect from "./PremiumGiftPlanSelect";
import GiftingSKUSelectScreen from "../../gifting/native/views/promotions/GiftingSKUSelectScreen";
import PremiumGiftCustomization from "./PremiumGiftCustomization";
import PremiumGiftSuccess from "./PremiumGiftSuccess";
import GiftingBadge_messages from "../../gifting/GiftingBadge.messages";
import GiftBadgePostPurchase from "./GiftBadgePostPurchase";
import { openGiftModal } from "../utils/openGiftModal";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations";
import useInitialValue from "../../../../hooks/useInitialValue";
import { v4 } from "../../../../_bundle/Module514";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import { isPremiumGiftingSupported } from "../../../device/BillingPlatformUtils";
import UnsupportedFeatureModal from "../../../billing/native/UnsupportedFeatureModal";
import { NativeGiftContextProvider } from "../../../payments/native/NativeGiftContext";
import PremiumGiftAnalytics from "./PremiumGiftAnalytics";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
let c6417_7 = {
PLAN_SELECT: "PremiumGiftPlanSelect",
REWARD_SELECT: "GiftingSKUSelect",
CUSTOMIZATION: "PremiumGiftCustomization",
SUCCESS: "PremiumGiftSuccess",
GIFTING_BADGE: "GiftingBadgePostPurchase"
};
const r30 = {};
r30[c6417_7.PLAN_SELECT] = PaymentFlowStep.SKU_SELECT;
r30[c6417_7.REWARD_SELECT] = PaymentFlowStep.REWARD_SKU_SELECT;
r30[c6417_7.CUSTOMIZATION] = PaymentFlowStep.PLAN_SELECT;
r30[c6417_7.SUCCESS] = PaymentFlowStep.CONFIRM;
r30[c6417_7.GIFTING_BADGE] = PaymentFlowStep.CONFIRM;
let c6417_8 = r30;
const useStyles = createStyles({
header: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
shadowColor: "transparent"
}
});
export default function PremiumGiftModal(props) {
let setState;
const { recipientUserId: recipientUserId2, premiumType, planInterval, analyticsLocation, analyticsLocations } = props;
let initialRoute = props.initialRoute;
const { order, onDismiss } = props;
setState = void 0;
const analyticsLocations2 = useAnalyticsLocations(analyticsLocations).analyticsLocations;
const analyticsLoadId = useInitialValue(() => v4());
const memo = useMemo(() => getBasePurchaseFlowAnalyticsFields({
isGift: true,
analyticsLoadId,
analyticsLocation,
analyticsLocations
}), [analyticsLoadId, analyticsLocation, analyticsLocations]);
if (initialRoute == null) {
initialRoute = premiumType != null ? c6417_7.CUSTOMIZATION : c6417_7.PLAN_SELECT;
}
let recipientUserId, wishlist, userProfile, wishlistId, error, shouldShowWishlistInDMGifting;
const callback = useCallback(() => {
ModalActionCreators.pop();
if (onDismiss != null) {
onDismiss();
}
}, [onDismiss]);
recipientUserId = recipientUserId2;
wishlist = void 0;
userProfile = void 0;
wishlistId = void 0;
error = void 0;
shouldShowWishlistInDMGifting = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([UserStore], () => recipientUserId != null ? UserStore.getUser(recipientUserId) : null);
const fetchWishlistAndProfileInfoForUser = useFetchWishlistAndProfileInfoForUser(recipientUserId);
wishlist = fetchWishlistAndProfileInfoForUser.wishlist;
userProfile = fetchWishlistAndProfileInfoForUser.userProfile;
wishlistId = fetchWishlistAndProfileInfoForUser.wishlistId;
error = fetchWishlistAndProfileInfoForUser.error;
shouldShowWishlistInDMGifting = useShouldShowWishlistInDMGifting({
isGift: true,
giftRecipient: stateFromStores,
isSocialLayerStorefrontEnabled: false
});
const PLAN_SELECT = c6417_7.PLAN_SELECT;
const r65 = shouldShowWishlistInDMGifting ? {
title: intl.string(t["JCFN/y"]),
headerLeft: getHeaderCloseButton(callback),
headerStyle: styles.header,
render: () => <PremiumGiftPlanSelect shouldUseDMWishlistGiftingDesign isLoadingWishlist={false} />
} : {
title: "",
headerShown: false,
render: () => <PremiumGiftPlanSelect shouldUseDMWishlistGiftingDesign={false} isLoadingWishlist={recipientUserId != null && !shouldShowWishlistInDMGifting && error == null && (userProfile == null || wishlistId != null && wishlist == null)} />
};
const screens = {};
screens[PLAN_SELECT] = r65;
screens[c6417_7.REWARD_SELECT] = {
title: "",
headerLeft: initialRoute === c6417_7.REWARD_SELECT ? getHeaderCloseButton(callback) : getHeaderBackButton(),
headerStyle: styles.header,
render: (a0) => <GiftingSKUSelectScreen defaultHighlightedReward={a0.defaultHighlightedReward} allRewards={a0.allRewards} claimableRewards={a0.claimableRewards} onSelect={a0.onSelect} />
};
screens[c6417_7.CUSTOMIZATION] = {
title: "",
headerLeft: initialRoute === c6417_7.CUSTOMIZATION ? getHeaderCloseButton(callback) : getHeaderBackButton(),
headerStyle: styles.header,
render: () => <PremiumGiftCustomization />
};
screens[c6417_7.SUCCESS] = {
title: "",
headerLeft: getHeaderCloseButton(callback),
headerStyle: styles.header,
render: () => <PremiumGiftSuccess />
};
screens[c6417_7.GIFTING_BADGE] = {
title: intl.string(GiftingBadge_messages.roVAey),
headerLeft: getHeaderCloseButton(callback),
headerTransparent: true,
headerStyle: {
backgroundColor: "transparent",
shadowColor: "transparent"
},
render: (a0) => <GiftBadgePostPurchase currentProgress={a0.currentProgress} onSendGift={() => {
openGiftModal({
analyticsLocations: [AnalyticsLocation.GIFTING_BADGE_POST_PURCHASE]
});
}} />
};
let currentStep;
[currentStep, setState] = useState(c6417_8[initialRoute]);
return isPremiumGiftingSupported() ? <AnalyticsLocationProvider value={analyticsLocations2}>
<NativeGiftContextProvider basePurchaseAnalytics={memo} recipientUserId={recipientUserId} onClose={callback} setCurrentAnalyticsStep={setState} premiumType={premiumType} planInterval={planInterval} initialOrder={order}>
<PremiumGiftAnalytics currentStep={currentStep}>
<Navigator initialRouteName={initialRoute} screens={screens} onStateChange={(event) => {
if (event != null) {
setState(c6417_8[event.routes[event.index].name]);
}
}} />
</PremiumGiftAnalytics>
</NativeGiftContextProvider>
</AnalyticsLocationProvider> : <UnsupportedFeatureModal title={intl.string(t["JCFN/y"])} />;
};
export { c6417_7 as PremiumGiftScreens };
@@ -0,0 +1,465 @@
// Metro module 9701 (f9702).
import { useState, useEffect, useRef, useCallback, useMemo } from "react";
import { ActivityIndicator, Pressable, ScrollView, View } from "react-native";
import BadgeDirectoryStore from "../../../badges/BadgeDirectoryStore";
import PromotionsStore from "../../promotions/PromotionsStore";
import { PremiumTypes } from "../../PremiumConstants";
import { VerticalGradient } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import Module689 from "../../../../_bundle/Module689";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
import { useIsScreenReaderEnabled } from "../../../a11y/native/useIsScreenReaderEnabled.native";
import { useNavigatorBackPressHandler } from "../../../../design/components/Navigator/native/useNavigatorBackPressHandler.native";
import { useStateFromStoresArray, useStateFromStoresObject } from "../../../../_bundle/Module589";
import { useSelectPremiumGift } from "../hooks/useSelectPremiumGift";
import GiftingBadgeExperiment from "../../gifting/experiments/GiftingBadgeExperiment";
import { BadgeId } from "../../../../_bundle/Module8106";
import { PremiumGiftScreens } from "./PremiumGiftModal";
import openGiftingBadgeInfoActionSheet from "../../gifting/native/openGiftingBadgeInfoActionSheet";
import PremiumGiftFeaturesCard from "./PremiumGiftFeaturesCard";
import { useIsWindowSmall } from "../../../screen/native/useIsWindowSmall";
import { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import * as _native from "../../../../design/void/native";
import { Avatar, AvatarSizes, CarouselPagination } from "../../../../design/void/native";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import GiftingBadgeProgressBanner from "../../gifting/native/views/GiftingBadgeProgressBanner";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import Module9714 from "../../../../_bundle/Module9714";
import { PremiumGiftWishlistBanner } from "./PremiumGiftWishlistBanner";
import StatusBar_android from "../../../status_bar/native/components/StatusBar.android";
import { intl, t } from "../../../../intl/index.native";
import { XSmallIcon } from "../../../../design/components/Icon/native/redesign/generated/XSmallIcon";
import FastImage from "../../../../components_native/common/FastImage";
import Module9777 from "../../../../_bundle/Module9777";
import Module4611 from "../../../../_bundle/Module4611";
import { NAV_BAR_HEIGHT } from "../../../../design/components/Navigator/native/NavigatorConstants.native";
import { Text } from "../../../../design/components/Text/native/Text";
let __initData, __initData2;
const data = [PremiumTypes.TIER_2, PremiumTypes.TIER_0];
const gap = 16;
const useStyles = createStyles((a0, a1, a2) => ({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
headerBackground: {
position: "absolute",
width: a0,
height: 0.1 * a1,
top: a1 / 1.75 - 0.1 * a1
},
headerBackgroundColor: {
color: Module712.colors.BACKGROUND_BASE_LOW
},
headerImageContainer: {
position: "absolute",
width: a0,
height: a1 / 1.75
},
headerImage: {
width: a0
},
headerOverlay: {
width: a0,
backgroundColor: Module689("#000000").alpha(0.8).hex()
},
avatar: {
alignSelf: "center"
},
title: {
textAlign: "center",
marginTop: a2 ? Module712.space.PX_16 : Module712.space.PX_12,
marginHorizontal: Module712.space.PX_24
},
description: {
textAlign: "center",
marginTop: a2 ? Module712.space.PX_16 : Module712.space.PX_12,
marginHorizontal: Module712.space.PX_24
},
carousel: {
marginTop: a2 ? Module712.space.PX_16 : Module712.space.PX_32
},
dmGiftingContent: {
paddingTop: Module712.space.PX_16,
paddingBottom: Module712.space.PX_48
},
loadingContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center"
},
closeButtonContainer: {
position: "absolute",
top: 0,
left: 0,
zIndex: 1
},
closeButton: {
padding: Module712.space.PX_16
},
closeButtonIcon: {
width: 24,
height: 24,
tintColor: "white"
},
badgeBanner: {
marginTop: Module712.space.PX_16,
marginHorizontal: Module712.space.PX_16
}
}));
__initData = {
code: "function PremiumGiftPlanSelectTsx1(){const{STANDARD_EASING,withTiming,carouselVisibility}=this.__closure;const animationSettings={easing:STANDARD_EASING,duration:500};return{opacity:withTiming(carouselVisibility.get()?1:0,animationSettings),transform:[{translateY:withTiming(carouselVisibility.get()?0:100,animationSettings)}]};}"
};
__initData2 = {
code: "function PremiumGiftPlanSelectTsx2(value,index){const{lastItemIndex,leftOffset,centerOffset,rightOffset,carouselStep}=this.__closure;const activeIndex=index-value;const leftT=Math.max(0,Math.min(1,activeIndex));const rightT=Math.max(0,Math.min(1,activeIndex-(lastItemIndex-1)));const offset=leftOffset+leftT*(centerOffset-leftOffset)+rightT*(rightOffset-centerOffset);return{transform:[{translateX:value*carouselStep+offset}]};}"
};
export default function PremiumGiftPlanSelect(props) {
let r270, r307, r332, r342, r381, children2, children3, props6;
let selectPremiumGift, c17415_4, styles, state, setState, state2, setState2, ref, callback, width, callback2, c17415_14, sharedValue, c17415_16, c17415_17, c17415_18, c17415_19;
const { shouldUseDMWishlistGiftingDesign, isLoadingWishlist } = props;
selectPremiumGift = void 0;
c17415_4 = void 0;
styles = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
ref = void 0;
callback = void 0;
width = void 0;
callback2 = void 0;
c17415_14 = void 0;
sharedValue = void 0;
c17415_16 = void 0;
c17415_17 = void 0;
c17415_18 = void 0;
c17415_19 = void 0;
const navigation = useNavigation();
const safeAreaInsets_native = useSafeAreaInsets_native();
const { top, bottom } = safeAreaInsets_native;
const windowDimensions_native = useWindowDimensions_native();
const { width: width2, height } = windowDimensions_native;
const nativeGiftContext = useNativeGiftContext();
const { recipientUser, claimableRewards, onClose } = nativeGiftContext;
const isScreenReaderEnabled = useIsScreenReaderEnabled();
useNavigatorBackPressHandler(() => {
onClose();
return true;
});
const stateFromStoresArray = useStateFromStoresArray([PromotionsStore], () => PromotionsStore.getGiftPromotionRewardSkuIds());
selectPremiumGift = useSelectPremiumGift("PremiumGiftPlanSelect");
let enabled = GiftingBadgeExperiment.useConfig({
location: "PremiumGiftPlanSelect"
}).enabled;
const stateFromStoresObject = useStateFromStoresObject([BadgeDirectoryStore], () => ({
nextTier: BadgeDirectoryStore.getNextTier(BadgeId.GIFTING),
giftsToNextTier: BadgeDirectoryStore.getRemainingToNextTier(BadgeId.GIFTING)
}));
const { nextTier, giftsToNextTier } = stateFromStoresObject;
if (enabled) {
enabled = nextTier != null;
}
c17415_4 = enabled;
styles = useStyles(width2, height, enabled);
let onSnapToItem;
[state, onSnapToItem] = useState(0);
let state3;
[state3, setState] = useState(false);
useEffect(() => {
let c26519_0 = navigation.addListener("state", () => {
const state3 = navigation.getState();
setState(state3.routes[state3.index].name === PremiumGiftScreens.PLAN_SELECT);
});
return () => {
navigation.removeListener("state", c26519_0);
};
}, [navigation]);
let state4;
[state4, setState2] = useState(null);
state2 = state4;
ref = useRef([]);
useEffect(() => {
ref.current = [];
setState2(null);
}, [shouldUseDMWishlistGiftingDesign]);
callback = useCallback(() => {
if (ref.current.length >= data.length) {
const r6 = Math;
const r20 = r6.max.apply(r6, [...ref.current]);
if (!Number.isNaN(r20)) {
setState2(r20);
}
}
}, [setState2]);
const callback3 = useCallback(() => {
openGiftingBadgeInfoActionSheet();
}, []);
width = 0.86 * width2;
callback2 = useCallback(function(variant, r3 = {
forScreenReader: false
}) {
const forScreenReader = r3.forScreenReader;
return function({ item, index }) {
const Component = forScreenReader ? Pressable : View;
const r14 = {
accessible: forScreenReader ? forScreenReader : void 0,
accessibilityRole: forScreenReader ? "button" : void 0,
onPress: forScreenReader ? () => selectPremiumGift(item) : void 0,
style: {
paddingVertical: Module712.space.PX_8
},
children: null
};
let height = state2;
if (state2 == null) {
height = void 0;
}
r14.children = <PremiumGiftFeaturesCard key={index} premiumType={item} variant={variant} onPress={() => selectPremiumGift(item)} style={{
height,
width,
alignSelf: variant === "default" ? "center" : void 0
}} onLayout={(event) => {
const height = event.nativeEvent.layout.height;
if (height > 0) {
const current = ref.current;
const r7 = Math;
let r15 = ref.current[index];
if (r15 == null) {
r15 = 0;
}
current[index] = r7.max(height, r15);
callback();
}
}} claimableRewards={claimableRewards} isSelected={state === index} />;
return <Component {...r14} />;
};
}, [selectPremiumGift, width, ref, callback, state2, state, claimableRewards]);
const isWindowSmall = useIsWindowSmall();
let r9 = claimableRewards != null;
let r136 = enabled;
if (r9) {
r9 = claimableRewards.length > 0;
}
const r138 = isWindowSmall ? "smallCompact" : r9 ? "smallCompact" : "compact";
c17415_14 = r138;
const memo = useMemo(() => callback2(c17415_14), [callback2, r138]);
let renderItem = useMemo(() => callback2("default"), [callback2]);
sharedValue = useSharedValue(false);
useEffect(() => {
sharedValue.set(state2 != null);
}, [sharedValue, state2]);
const he = function he() {
const r8 = {
easing: _native.STANDARD_EASING,
duration: 500
};
return {
opacity: _timing.withTiming(sharedValue.get() ? 1 : 0, r8),
transform: [{
translateY: _timing.withTiming(sharedValue.get() ? 0 : 100, r8)
}]
};
};
he.__closure = {
STANDARD_EASING: _native.STANDARD_EASING,
withTiming: _timing.withTiming,
carouselVisibility: sharedValue
};
he.__workletHash = 2946262965957;
he.__initData = __initData;
const animatedStyle = useAnimatedStyle(he);
const memo2 = useMemo(() => [Module689(styles.headerBackgroundColor.color).alpha(0).hex(), Module689(styles.headerBackgroundColor.color).alpha(1).hex()], [styles]);
const carouselStep = width + gap;
c17415_16 = carouselStep;
const lastItemIndex = data.length - 1;
c17415_17 = lastItemIndex;
const centerOffset = (width2 - width) / 2;
c17415_18 = centerOffset;
const rightOffset = width2 - width - gap;
c17415_19 = rightOffset;
const fe = function fe(a0, a1) {
const r13 = a1 - a0;
const r16 = Math.max(0, Math.min(1, r13));
const r23 = Math.max(0, Math.min(1, r13 - (c17415_17 - 1)));
const r25 = a0 * c17415_16;
return {
transform: [{
translateX: r25 + (16 + r16 * (c17415_18 - 16) + r23 * (c17415_19 - c17415_18))
}]
};
};
fe.__closure = {
lastItemIndex,
leftOffset: 16,
centerOffset,
rightOffset,
carouselStep
};
fe.__workletHash = 8954351954675;
fe.__initData = __initData2;
const callback4 = useCallback(fe, [carouselStep, lastItemIndex, 16, centerOffset, rightOffset]);
if (isLoadingWishlist) {
r342 = <View style={[styles.container, styles.loadingContainer]}>
<ActivityIndicator size="large" />
</View>;
} else if (shouldUseDMWishlistGiftingDesign) {
const props4 = {
style: styles.container,
children: null
};
const props5 = {
contentContainerStyle: {
paddingBottom: bottom
},
children: null
};
if (r136) {
let name2 = nextTier.name;
if (name2 == null) {
name2 = "";
}
r136 = <View style={styles.badgeBanner}>
<Pressable onPress={callback3} accessibilityRole="button">
<GiftingBadgeProgressBanner giftsToNextTier={giftsToNextTier} nextTierName={name2} nextTierIcon={nextTier.simple_icon_url} analyticsLocation={AnalyticsLocation.PREMIUM_GIFT_PLAN_SELECTION} />
</Pressable>
</View>;
}
L52: {
children2 = [r136, , ,];
props6 = {
style: styles.dmGiftingContent,
children: null
};
if (stateFromStoresArray.length !== 0) {
children3 = null;
if (claimableRewards === void 0) {
break L52;
}
}
if (isScreenReaderEnabled) {
r381 = <ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={{
gap,
paddingHorizontal: gap
}}>
{data.map((a0, a1) => callback2(c17415_14, {
forScreenReader: true
})({
item: a0,
index: a1
}))}
</ScrollView>;
} else {
if (state2 == null) {
state4 = 1;
}
r381 = <Module9714 style={animatedStyle} data={data} renderItem={memo} width={width2} windowSize={data.length} height={state4 + 2 * Module712.space.PX_8} onConfigurePanGesture={(event) => {
event.activeOffsetX([-10, 10]);
}} loop={false} scrollAnimationDuration={200} customAnimation={callback4} onSnapToItem={onSnapToItem} />;
}
children3 = r381;
}
props6.children = children3;
children2[1] = <View {...props6} />;
children2[2] = recipientUser != null && <PremiumGiftWishlistBanner giftRecipient={recipientUser} />;
props5.children = children2;
props4.children = <ScrollView {...props5} />;
r342 = <View {...props4} />;
} else {
if (state3) {
state3 = <StatusBar_android animated barStyle="light-content" />;
}
const r191 = [state3, <Pressable style={[styles.closeButtonContainer, {
paddingTop: top
}]} onPress={onClose} accessibilityRole="button" accessibilityLabel={intl.string(t.cpT0Cq)}>
<View style={styles.closeButton}>
<XSmallIcon size="md" style={styles.closeButtonIcon} />
</View>
</Pressable>, <FastImage resizeMode="cover" style={[styles.headerImageContainer, styles.headerImage]} source={Module9777} />, <View style={[styles.headerImageContainer, styles.headerOverlay]} />, <Module4611 style={styles.headerBackground} start={VerticalGradient.START} end={VerticalGradient.END} colors={memo2} />, ,];
const props2 = {
contentContainerStyle: {
paddingBottom: bottom
},
children: null
};
const props3 = {
style: [{
paddingTop: top + NAV_BAR_HEIGHT
}],
children: null
};
const children = [recipientUser != null && <Avatar style={styles.avatar} guildId={void 0} size={r136 ? AvatarSizes.LARGE_48 : AvatarSizes.XLARGE} user={recipientUser} />, , , , ,];
const variant2 = recipientUser != null ? "heading-xl/extrabold" : "heading-xxl/extrabold";
if (recipientUser != null) {
const m5ggvH = t.m5ggvH;
let globalName = recipientUser.globalName;
if (globalName == null) {
globalName = recipientUser.username;
}
r270 = intl.formatToPlainString(m5ggvH, {
username: globalName
});
} else {
r270 = intl.string(t.dqQgZv);
}
children[1] = <Text style={styles.title} variant={variant2} color="text-overlay-light">{r270}</Text>;
children[2] = <Text style={styles.description} variant="heading-sm/medium" color="text-overlay-light">
{intl.string(t["30qzrd"])}
</Text>;
let r294 = r136;
if (r136) {
let name = nextTier.name;
if (name == null) {
name = "";
}
r294 = <Pressable style={styles.badgeBanner} onPress={callback3} accessibilityRole="button">
<GiftingBadgeProgressBanner giftsToNextTier={giftsToNextTier} nextTierName={name} nextTierIcon={nextTier.simple_icon_url} analyticsLocation={AnalyticsLocation.PREMIUM_GIFT_PLAN_SELECTION} />
</Pressable>;
}
L39: {
children[3] = r294;
if (stateFromStoresArray.length !== 0) {
r307 = null;
if (claimableRewards === void 0) {
break L39;
}
}
if (isScreenReaderEnabled) {
r332 = <ScrollView horizontal showsHorizontalScrollIndicator={false} style={styles.carousel} contentContainerStyle={{
gap,
paddingHorizontal: gap
}}>
{data.map((a0, a1) => callback2(c17415_4 ? c17415_14 : "default", {
forScreenReader: true
})({
item: a0,
index: a1
}))}
</ScrollView>;
} else {
if (r136) {
renderItem = memo;
}
r332 = <>
<Module9714 style={[styles.carousel, animatedStyle]} data={data} renderItem={renderItem} width={width2} height={state2 != null ? state2 + 2 * Module712.space.PX_8 : void 0} onConfigurePanGesture={(event) => {
event.activeOffsetX([-10, 10]);
}} loop={false} scrollAnimationDuration={200} customAnimation={r136 ? callback4 : void 0} mode="parallax" modeConfig={{
parallaxScrollingScale: 1,
parallaxScrollingOffset: 40
}} onSnapToItem={onSnapToItem} />
<CarouselPagination numberOfItems={data.length} currentIndex={state} />
</>;
}
r307 = r332;
}
children[4] = r307;
props3.children = children;
props2.children = <View {...props3} />;
r191[5] = <ScrollView {...props2} />;
r342 = <>{r191}</>;
}
return r342;
};
@@ -0,0 +1,106 @@
// Metro module 9711 (f9712).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { GiftPlanSelectionCardBanner_AssetVariant } from "../../../../_bundle/Module6279";
import { useThemeAndReducedMotionAwareAssetUrl } from "../../promotions/MarketingComponentHooks";
import Module4611 from "../../../../_bundle/Module4611";
import FastImage from "../../../../components_native/common/FastImage";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import PremiumFeaturesPromotionalLogo from "./PremiumFeaturesPromotionalLogo";
const useStyles = createStyles(() => ({
gradient: {
minHeight: 60
},
bannerImage: {
position: "absolute",
top: 0,
left: 0,
right: 0,
width: "100%",
aspectRatio: 5
},
content: {
minHeight: 60,
justifyContent: "center",
gap: 2,
paddingTop: Module712.space.PX_12,
paddingBottom: Module712.space.PX_12,
paddingStart: Module712.space.PX_24,
paddingEnd: 120
},
heading: {},
subheading: {},
logoContainer: {
position: "absolute",
top: 0,
bottom: 0,
right: 10,
justifyContent: "center",
alignItems: "center"
},
logoContainerLargeTilted: {
transform: [{
rotate: "-7deg"
}, {
translateY: 8
}]
},
logo: {
width: 95,
height: 95
},
logoLargeTilted: {
width: 120,
height: 120
}
}));
const r29 = memo(function PremiumGiftPlanSelectPromotionalBanner(props) {
const { giftPlanSelectionCardBannerComponent, claimableRewards, isSelected, onLayout } = props;
const styles = useStyles();
const { gradient, assetVariant } = giftPlanSelectionCardBannerComponent;
const LARGE_TILTED = GiftPlanSelectionCardBanner_AssetVariant.LARGE_TILTED;
const themeAndReducedMotionAwareAssetUrl2 = useThemeAndReducedMotionAwareAssetUrl(giftPlanSelectionCardBannerComponent.mobileBannerAsset);
const themeAndReducedMotionAwareAssetUrl = useThemeAndReducedMotionAwareAssetUrl(giftPlanSelectionCardBannerComponent.avatarAsset, true);
let angle = gradient?.angle;
if (angle == null) {
angle = 90;
}
let colors = gradient?.colors;
if (colors == null) {
colors = [];
}
const r51 = [themeAndReducedMotionAwareAssetUrl2 != null && <FastImage style={styles.bannerImage} resizeMode="cover" source={{
uri: themeAndReducedMotionAwareAssetUrl2
}} />, <View style={styles.content}>
<Text style={styles.heading} variant="text-md/bold" color="text-overlay-light">
{intl.string(t.OEtqpm)}
</Text>
<Text style={styles.subheading} variant="text-md/medium" color="text-overlay-light">
{intl.formatToPlainString(t["2h5M+X"], {
availableCount: claimableRewards.length
})}
</Text>
</View>, ,];
let r87 = themeAndReducedMotionAwareAssetUrl != null;
if (r87) {
let r88 = assetVariant === LARGE_TILTED;
const style = [styles.logoContainer, r88 ? styles.logoContainerLargeTilted : r88];
const promoRotatingStyle = [styles.logo, ,];
if (r88) {
r88 = styles.logoLargeTilted;
}
promoRotatingStyle[1] = r88;
r87 = <View style={style}>
<PremiumFeaturesPromotionalLogo shouldAnimate={isSelected} promoRotatingStyle={promoRotatingStyle} rotatingAvatarImageUrl={themeAndReducedMotionAwareAssetUrl} />
</View>;
}
r51[2] = r87;
return <Module4611 style={styles.gradient} useAngle angle={angle} angleCenter={{
x: 0.5,
y: 0.5
}} colors={colors} onLayout={onLayout}>{r51}</Module4611>;
});
export default r29;
@@ -0,0 +1,337 @@
// Metro module 9783 (f9784).
import { useEffect } from "react";
import { StyleSheet, View } from "react-native";
import BadgeDirectoryStore from "../../../badges/BadgeDirectoryStore";
import { isAvatarDecorationRecord } from "../../../collectibles/records/AvatarDecorationRecord";
import { isNameplateRecord } from "../../../collectibles/records/NameplateRecord";
import UserStore from "../../../../stores/UserStore";
import PromotionsStore from "../../promotions/PromotionsStore";
import { HelpdeskArticles } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import Nameplate from "../../../collectibles/nameplates/native/Nameplate";
import { getNameplateData } from "../../../collectibles/nameplates/utils";
import { Avatar, AvatarSizes } from "../../../../design/void/native";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import Module4611 from "../../../../_bundle/Module4611";
import GiftingRewardPreviewAvatar from "../../gifting/native/views/GiftingRewardPreviewAvatar";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import { useCanPurchaseIAP } from "../../../../utils/native/IAPUtils";
import { MarketingComponentType } from "../../../../_bundle/Module6567";
import { GiftCustomizationBanner_AssetVariant } from "../../../../_bundle/Module6280";
import useShouldShowGiftingPromotionDeco from "../../gifting/native/hooks/useShouldShowGiftingPromotionDeco";
import { GiftingBadgeExperiment } from "../../gifting/experiments/GiftingBadgeExperiment";
import { BadgeId } from "../../../../_bundle/Module8106";
import { PaymentFlowStep } from "../PremiumAnalyticsUtils";
import { PremiumGiftScreens } from "./PremiumGiftModal";
import { useFetchCollectiblesProduct } from "../../../collectibles/hooks/useFetchCollectiblesProduct";
import { useThemeAndReducedMotionAwareAssetUrl } from "../../promotions/MarketingComponentHooks";
import FastImage from "../../../../components_native/common/FastImage";
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
import { PencilIcon } from "../../../../design/components/Icon/native/redesign/generated/PencilIcon";
import GiftingBadgeProgressBanner from "../../gifting/native/views/GiftingBadgeProgressBanner";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { dismissKeyboard } from "../../../../utils/native/ChatInputUtils";
let useStyles;
const RewardPreview = function RewardPreview(props) {
let r30;
const { collectiblesItem, currentUser, gradientColors } = props;
let gradientAngle = props.gradientAngle;
const styles = useStyles(useSafeAreaInsetsKeyboardAware_native().insets.bottom);
if (isNameplateRecord(collectiblesItem)) {
r30 = <>
<View style={styles.nameplateWrapper}>
<Nameplate nameplate={getNameplateData(collectiblesItem)} fullOpacity animate />
</View>
<View style={styles.singleAvatarContainer}>
<Avatar user={currentUser} guildId={void 0} size={AvatarSizes.SMALL} aria-hidden />
</View>
<Text style={styles.selectedRewardText} variant="text-xs/medium">
{intl.string(t.Rh4oem)}
</Text>
</>;
} else {
const isAvatarDecorationRecord2 = isAvatarDecorationRecord(collectiblesItem);
r30 = null;
if (isAvatarDecorationRecord2) {
if (gradientAngle == null) {
gradientAngle = 90;
}
r30 = <>
<Module4611 style={styles.selectedRewardBannerGradient} useAngle angle={gradientAngle} angleCenter={{
x: 0.5,
y: 0.5
}} colors={gradientColors} />
<View style={styles.singleAvatarContainer}>
<GiftingRewardPreviewAvatar size={AvatarSizes.NORMAL} asset={collectiblesItem.asset} />
</View>
<Text style={styles.selectedRewardText} variant="text-xs/medium" color="text-overlay-light">
{intl.string(t.Rh4oem)}
</Text>
</>;
}
}
return r30;
};
useStyles = createStyles((a0) => ({
container: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
paddingTop: Module712.space.PX_12,
paddingBottom: Module712.space.PX_12 + a0,
paddingHorizontal: Module712.space.PX_16,
gap: Module712.space.PX_8,
...Module712.shadows.SHADOW_TOP_HIGH
},
chooseRewardContainer: {
flexDirection: "row",
alignItems: "center",
height: 52
},
gradientBackdrop: {
...StyleSheet.absoluteFillObject,
borderRadius: Module712.radii.sm,
overflow: "hidden"
},
chooseRewardText: {
flex: 1,
marginStart: Module712.space.PX_8
},
backgroundImage: {
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
opacity: 1
},
inAppFlowImage: {
width: 58,
height: 58,
marginStart: Module712.space.PX_8
},
inAppFlowImageLargeTilted: {
width: 86,
height: 86,
transform: [{
rotate: "-4deg"
}, {
translateY: -11
}]
},
singleAvatarContainer: {
flexDirection: "row",
paddingRight: 15,
justifyContent: "center",
alignItems: "center",
marginLeft: 5
},
selectedRewardRow: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_16
},
selectedRewardBannerContainer: {
flex: 1,
flexDirection: "row",
alignItems: "center",
height: 52
},
selectedRewardBannerGradient: {
...StyleSheet.absoluteFillObject,
borderRadius: Module712.radii.sm,
top: Module712.space.PX_4,
bottom: Module712.space.PX_4,
start: Module712.space.PX_4,
end: Module712.space.PX_4,
marginStart: Module712.space.PX_12
},
selectedRewardText: {
flex: 1
},
nameplateWrapper: {
position: "absolute",
left: 0,
right: 0,
top: 0,
bottom: 0,
borderRadius: Module712.radii.sm,
overflow: "hidden"
}
}));
export default function PremiumGiftPurchaseButton(props) {
let r144;
let c17487_8, c17487_9, c17487_10, $mk106748 = function() {
return (a0) => {
setSelectedGiftingPromotionReward(a0);
navigation.navigate(PremiumGiftScreens.CUSTOMIZATION);
};
};
const defaultSelection = props.defaultSelection;
c17487_8 = void 0;
c17487_9 = void 0;
c17487_10 = void 0;
const styles = useStyles(useSafeAreaInsetsKeyboardAware_native().insets.bottom);
const navigation = useNavigation();
const nativeGiftContext = useNativeGiftContext();
const { onPurchase, isPurchasing, productId, allRewards, claimableRewards, selectedGiftingPromotionReward, setSelectedGiftingPromotionReward, setCurrentAnalyticsStep } = nativeGiftContext;
const stateFromStores2 = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const canPurchaseIAP = useCanPurchaseIAP(productId);
const stateFromStores = useStateFromStores([PromotionsStore], () => {
const marketingComponentByType = PromotionsStore.getMarketingComponentByType(MarketingComponentType.GIFT_CUSTOMIZATION_BANNER);
return marketingComponentByType == null ? null : marketingComponentByType.properties.properties.oneofKind === "giftCustomizationBanner" ? marketingComponentByType.properties.properties.giftCustomizationBanner : null;
});
const assetVariant = stateFromStores?.assetVariant;
const LARGE_TILTED = GiftCustomizationBanner_AssetVariant.LARGE_TILTED;
const r4 = claimableRewards != null && claimableRewards.length > 0;
c17487_8 = r4;
const r71 = claimableRewards != null && claimableRewards.length === 1;
c17487_9 = r71;
const shouldShowGiftingPromotionDeco = useShouldShowGiftingPromotionDeco();
const r19 = shouldShowGiftingPromotionDeco && selectedGiftingPromotionReward == null;
c17487_10 = r19;
const enabled = GiftingBadgeExperiment.useConfig({
location: "PremiumGiftPurchaseButton"
}).enabled;
const stateFromStoresObject = useStateFromStoresObject([BadgeDirectoryStore], () => ({
nextTier: BadgeDirectoryStore.getNextTier(BadgeId.GIFTING),
giftsToNextTier: BadgeDirectoryStore.getRemainingToNextTier(BadgeId.GIFTING)
}));
const { nextTier, giftsToNextTier } = stateFromStoresObject;
useEffect(() => {
if (c17487_9) {
setSelectedGiftingPromotionReward(claimableRewards[0]);
}
}, [r71, claimableRewards, setSelectedGiftingPromotionReward]);
let colors = stateFromStores == null ? void 0 : stateFromStores.gradient?.colors;
if (colors == null) {
colors = [];
}
const gradientColors = colors.length > 0 ? colors : [String(Module712.colors.BACKGROUND_BRAND), String(Module712.colors.BACKGROUND_BRAND)];
const product = useFetchCollectiblesProduct(selectedGiftingPromotionReward).product;
const text = r19 ? intl.string(t["gNZY/B"]) : intl.string(t.ouo4FK);
const variant = r19 ? "primary" : "active";
const themeAndReducedMotionAwareAssetUrl2 = useThemeAndReducedMotionAwareAssetUrl(stateFromStores?.mobileBackgroundAsset);
const themeAndReducedMotionAwareAssetUrl = useThemeAndReducedMotionAwareAssetUrl(stateFromStores?.asset);
const collectiblesItem = product == null ? void 0 : product.items[0];
if (r19 && r4) {
let angle = stateFromStores == null ? void 0 : stateFromStores.gradient?.angle;
if (angle == null) {
angle = 90;
}
const r212 = [<View style={styles.gradientBackdrop} pointerEvents="none">
<Module4611 style={StyleSheet.absoluteFillObject} useAngle angle={angle} angleCenter={{
x: 0.5,
y: 0.5
}} colors={colors} />
{themeAndReducedMotionAwareAssetUrl2 != null && <FastImage style={styles.backgroundImage} resizeMode="cover" source={{
uri: themeAndReducedMotionAwareAssetUrl2
}} />}
</View>, , ,];
let r213 = themeAndReducedMotionAwareAssetUrl != null;
if (r213) {
let r214 = assetVariant === LARGE_TILTED;
const style = [styles.inAppFlowImage, ,];
if (r214) {
r214 = styles.inAppFlowImageLargeTilted;
}
style[1] = r214;
r213 = <FastImage style={style} resizeMode="contain" source={{
uri: themeAndReducedMotionAwareAssetUrl
}} />;
}
r212[1] = r213;
r212[2] = <Text style={styles.chooseRewardText} variant="text-xs/semibold" color="text-overlay-light">
{intl.string(t.cMiNit)}
</Text>;
r144 = <View style={styles.chooseRewardContainer}>{r212}</View>;
} else if (collectiblesItem != null && (shouldShowGiftingPromotionDeco && selectedGiftingPromotionReward != null)) {
r144 = <View style={styles.selectedRewardRow}>
<View style={styles.selectedRewardBannerContainer}>
<RewardPreview collectiblesItem={collectiblesItem} currentUser={stateFromStores2} gradientColors={gradientColors} gradientAngle={stateFromStores == null ? void 0 : stateFromStores.gradient?.angle} />
</View>
{r71 ? !r71 : <IconButton variant="tertiary" size="sm" icon={<PencilIcon size="sm" />} accessibilityLabel={intl.string(t.bt75uw)} onPress={function onPress() {
let defaultHighlightedReward = selectedGiftingPromotionReward;
if (c17487_8) {
setCurrentAnalyticsStep(PaymentFlowStep.REWARD_SKU_SELECT);
if (selectedGiftingPromotionReward == null) {
defaultHighlightedReward = defaultSelection;
}
const REWARD_SELECT = PremiumGiftScreens.REWARD_SELECT;
let allRewards2 = allRewards;
if (allRewards == null) {
allRewards2 = [];
}
let claimableRewards2 = claimableRewards;
if (claimableRewards == null) {
claimableRewards2 = [];
}
navigation.navigate(REWARD_SELECT, {
defaultHighlightedReward,
allRewards: allRewards2,
claimableRewards: claimableRewards2,
onSelect: $mk106748()
});
}
}} />}
</View>;
} else {
r144 = null;
if (enabled) {
const r145 = nextTier != null;
r144 = null;
if (r145) {
let name = nextTier.name;
if (name == null) {
name = "";
}
r144 = <GiftingBadgeProgressBanner giftsToNextTier={giftsToNextTier} nextTierName={name} nextTierIcon={nextTier.simple_icon_url} analyticsLocation={AnalyticsLocation.PREMIUM_GIFT_CUSTOMIZATION} />;
}
}
}
return <View style={styles.container}>
{r144}
{r19 ? !r19 : <Text variant="text-sm/normal">
{intl.format(t.hYoGUM, {
paidURL: HelpdeskUtils.getArticleURL(HelpdeskArticles.PAID_TERMS)
})}
</Text>}
<Button loading={isPurchasing} variant={variant} text={text} disabled={canPurchaseIAP ? isPurchasing : !canPurchaseIAP} onPress={isPurchasing ? void 0 : function() {
L9: {
dismissKeyboard();
if (c17487_10) {
if (c17487_8) {
if (!c17487_8) {
break L9;
}
setCurrentAnalyticsStep(PaymentFlowStep.REWARD_SKU_SELECT);
const REWARD_SELECT = PremiumGiftScreens.REWARD_SELECT;
let allRewards2 = allRewards;
if (allRewards == null) {
allRewards2 = [];
}
let claimableRewards2 = claimableRewards;
if (claimableRewards == null) {
claimableRewards2 = [];
}
navigation.navigate(REWARD_SELECT, {
defaultHighlightedReward: defaultSelection,
allRewards: allRewards2,
claimableRewards: claimableRewards2,
onSelect: $mk106748()
});
break L9;
}
}
onPurchase(() => {
navigation.navigate(PremiumGiftScreens.SUCCESS);
});
}
}} />
</View>;
};
@@ -0,0 +1,122 @@
// 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 <>
{[<View>
<PremiumGiftBackgroundAnimation_android giftStyle={giftStyle} />
</View>, <Text style={styles.title} variant="heading-lg/bold">
{intl.string(t["/s1xR7"])}
</Text>, <Text style={styles.description} variant="text-md/medium">
{intl.format(intervalType === YEAR ? t.rli5ey : t.bUdTqI, {
intervalCount: 1,
name: tierDisplayNameByPlanId
})}
</Text>, <View style={styles.input}>
<Text style={styles.inputLabel} variant="heading-md/bold">
{intl.string(t["qS+yMo"])}
</Text>
<InputButton text={giftCodeURL} icon={Module4138} iconPosition="end" onPress={callback} />
</View>, <Text style={styles.disclaimer} variant="text-xs/normal">
{intl.string(t.As9eLl)}
</Text>]}
</>;
};
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 <>
<Button variant="primary" text={intl.string(t.RDE0Sc)} onPress={callback2} />
<Button variant="secondary" text={intl.string(t.cpT0Cq)} onPress={callback} />
</>;
}
@@ -0,0 +1,64 @@
// 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>
</>;
};
@@ -0,0 +1,249 @@
// Metro module 9748 (f9749).
import { useMemo, useRef, useEffect, useCallback } from "react";
import { View, ScrollView } from "react-native";
import { WishlistRecommendationReason } from "../../../wishlists/records/WishlistRecommendationRecord";
import { GiftingOrigin, PremiumSubscriptionSKUToPremiumType } from "../../PremiumConstants";
import { SKUProductLines, AnalyticEvents } from "../../../../Constants";
import { CollectiblesMobileShopScreen } from "../../../collectibles/CollectiblesShopConstants";
import { UserProfileSections } from "../../../user_profile/Constants";
import { jsx } from "react/jsx-runtime";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { COLLECTIBLES_SHOP_CARD_WIDTH } from "../../../collectibles/native/CollectiblesShopCardV2";
import { WISHLIST_IN_DM_LENGTH_MOBILE, WishlistItemSource } from "../../../wishlists/hooks/useWishlistHooks";
import { useWishlistRecommendationsForSingleUser } from "../../../wishlists/hooks/useWishlistRecommendations";
import { getBannerMode, BANNER_CONFIG_MOBILE } from "../../gifting/utils/WishlistBannerUtils";
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import showUserProfileActionSheet from "../../../user_profile/native/showUserProfileActionSheet";
import { useSelectPremiumGift } from "../hooks/useSelectPremiumGift";
import { openSocialLayerStorefrontGiftModal } from "../../../slayer_storefront/native/SocialLayerStorefrontNativeActionCreators";
import { getRootNavigationRef } from "../../../main_tabs_v2/RootNavigationRef.native";
import ToastActionCreators from "../../../toast/native/ToastActionCreators";
import { intl, t } from "../../../../intl/index.native";
import { openCollectiblesShopMobile } from "../../../collectibles/CollectiblesActionCreators";
import { openShopGiftModal } from "../../../collectibles/native/openGiftModal";
import UserUtils from "../../../../utils/UserUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import WishlistItemCard from "../../../wishlists/native/WishlistItemCard";
import WishlistViewMoreCard from "../../../wishlists/native/WishlistViewMoreCard";
let env6458 = {};
const PX_16 = Module712.space.PX_16;
const PX_162 = Module712.space.PX_16;
const useStyles = createStyles((a0, a1) => ({
title: {
marginBottom: Module712.space.PX_4,
paddingHorizontal: PX_162
},
subtitle: {
marginBottom: Module712.space.PX_12,
paddingHorizontal: PX_162
},
placeholderRow: {
flexDirection: "row",
gap: PX_16,
paddingHorizontal: PX_162
},
placeholder: {
width: a0,
height: a1,
borderRadius: Module712.radii.lg,
backgroundColor: Module712.colors.BACKGROUND_SECONDARY_ALT
},
wishlistItemShadow: {
width: a0,
height: a1,
borderRadius: Module712.radii.lg,
backgroundColor: Module712.colors.BG_SURFACE_RAISED,
...Module712.shadows.SHADOW_LOW
}
}));
export function PremiumGiftWishlistBanner(props) {
let r154, props2;
let c17451_0;
let env17450 = {
$parent: env6458
};
const giftRecipient = props.giftRecipient;
env17450[0] = giftRecipient;
env17450[1] = void 0;
env17450[2] = void 0;
env17450[3] = void 0;
env17450[4] = void 0;
env17450[5] = void 0;
env17450[6] = void 0;
env17450[7] = void 0;
env17450[8] = void 0;
env17450[9] = void 0;
env17450[10] = void 0;
env17450[11] = void 0;
env17450[12] = void 0;
env17450[13] = void 0;
env17450[14] = void 0;
env17450[15] = void 0;
const size = {
width: COLLECTIBLES_SHOP_CARD_WIDTH,
height: COLLECTIBLES_SHOP_CARD_WIDTH
};
env17450[1] = size;
env17450[2] = WISHLIST_IN_DM_LENGTH_MOBILE;
const wishlistRecommendationsForSingleUser = useWishlistRecommendationsForSingleUser({
userId: giftRecipient.id,
numItems: WISHLIST_IN_DM_LENGTH_MOBILE
});
const wishlistAndRecommendations = wishlistRecommendationsForSingleUser.wishlistAndRecommendations;
env17450[3] = wishlistAndRecommendations;
const skusToUserAndReason = wishlistRecommendationsForSingleUser.skusToUserAndReason;
env17450[4] = skusToUserAndReason;
const status = wishlistRecommendationsForSingleUser.status;
env17450[5] = status;
const totalUnownedWishlistItemCount = wishlistRecommendationsForSingleUser.totalUnownedWishlistItemCount;
env17450[6] = totalUnownedWishlistItemCount;
const defaultWishlistId = wishlistRecommendationsForSingleUser.defaultWishlistId;
env17450[7] = defaultWishlistId;
const memo = useMemo(() => env17450[3].filter((item) => item.productLine === SKUProductLines.PREMIUM || item.productLine === SKUProductLines.COLLECTIBLES || item.productLine === SKUProductLines.SOCIAL_LAYER_GAME_ITEM).map((item) => {
const r4 = env17450[4];
return {
sku: item,
source: r4[item.id] != null && r4[item.id][env17450[0].id] === WishlistRecommendationReason.WISHLIST ? WishlistItemSource.WISHLIST : WishlistItemSource.POPULAR
};
}), [wishlistAndRecommendations, giftRecipient.id, skusToUserAndReason]);
env17450[8] = memo;
const memo2 = useMemo(() => getBannerMode({
totalUnownedWishlistItemCount: env17450[6],
wishlistInDmLength: env17450[2],
displayItems: env17450[8]
}), [totalUnownedWishlistItemCount, WISHLIST_IN_DM_LENGTH_MOBILE, memo]);
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.WISHLIST_BANNER).analyticsLocations;
env17450[9] = analyticsLocations;
env17450[10] = useRef(false);
useEffect(() => {
const r3 = env17450[10];
const current = r3.current;
if ((current ? !current : env17450[5] === "success") && env17450[8].length > 0) {
const IMPRESSION_GIFT_OPTION_WISHLIST_BANNER_VIEWED = AnalyticEvents.IMPRESSION_GIFT_OPTION_WISHLIST_BANNER_VIEWED;
const r13 = env17450[8];
AnalyticsUtils.track(IMPRESSION_GIFT_OPTION_WISHLIST_BANNER_VIEWED, {
gift_recipient_id: env17450[0].id,
sku_ids: r13.map((item) => item.sku.id),
location_stack: env17450[9],
product_lines: Array.from(new Set(r13.map((item) => item.sku.productLine)))
});
r3.current = true;
}
}, [status, memo, giftRecipient.id, analyticsLocations]);
const callback = useCallback(() => {
showUserProfileActionSheet({
userId: env17450[0].id,
initialSection: UserProfileSections.WISHLIST,
sourceAnalyticsLocations: env17450[9]
});
}, [giftRecipient.id, analyticsLocations]);
const selectPremiumGift = useSelectPremiumGift("PremiumGiftWishlistBanner");
env17450[11] = selectPremiumGift;
c17451_0 = void 0;
c17451_0 = async (c30140_0, c30140_1) => {
L18: {
AnalyticsUtils.track(AnalyticEvents.GIFTING_ITEM_CLICKED, {
sku_id: c30140_0.id,
item_source: c30140_1 === WishlistItemSource.WISHLIST ? "wishlist" : "shop",
wishlist_id: c30140_1 === WishlistItemSource.WISHLIST ? env17450[7] : null,
product_line: c30140_0.productLine
});
if (c30140_0.productLine !== SKUProductLines.PREMIUM) {
if (c30140_0.productLine !== SKUProductLines.SOCIAL_LAYER_GAME_ITEM) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
openCollectiblesShopMobile({
analyticsLocations: [AnalyticsLocation.GIFT_SELECTION_MODAL_WISHLIST],
analyticsSource: AnalyticsLocation.GIFT_SELECTION_MODAL_WISHLIST,
screen: CollectiblesMobileShopScreen.FEATURED_PAGE
});
openShopGiftModal({
skuId: c30140_0.id,
analyticsLocations: [AnalyticsLocation.GIFT_SELECTION_MODAL_WISHLIST],
lockedRecipientUser: env17450[0],
giftingOrigin: GiftingOrigin.DM_CHANNEL_WISHLIST
});
break L18;
}
ToastActionCreators.open({
key: "WISHLIST_ITEM_PRESS_ERROR",
content: intl.string(t["rTU7/z"])
});
break L18;
}
openSocialLayerStorefrontGiftModal({
skuId: c30140_0.id,
analyticsLocations: [AnalyticsLocation.GIFT_SELECTION_MODAL_WISHLIST],
lockedRecipientUser: env17450[0],
giftingOrigin: GiftingOrigin.DM_CHANNEL_WISHLIST
});
break L18;
}
await (0, env17450[11])(PremiumSubscriptionSKUToPremiumType[c30140_0.id]);
return void 0;
}
};
env17450[12] = useCallback(function() {
return c17451_0.apply(this, arguments);
}, [giftRecipient, defaultWishlistId, selectPremiumGift]);
const name = UserUtils.getName(giftRecipient);
env17450[13] = name;
const r85 = BANNER_CONFIG_MOBILE[memo2];
const title = r85.title;
const subtitle = r85.getSubtitle(name);
const styles = useStyles(size.width, size.height);
env17450[14] = styles;
if (status === "error") {
return null;
}
const r3 = status === "loading" || memo.length === 0;
const r96 = totalUnownedWishlistItemCount > WISHLIST_IN_DM_LENGTH_MOBILE;
const r97 = r96 ? memo.slice(0, WISHLIST_IN_DM_LENGTH_MOBILE - 1) : memo;
const r101 = r96 ? memo[WISHLIST_IN_DM_LENGTH_MOBILE - 1] : null;
env17450[15] = r101;
const r112 = [<Text style={styles.title} variant="text-lg/semibold">{title}</Text>, <Text style={styles.subtitle} variant="text-sm/medium" color="text-muted">{subtitle}</Text>, ,];
if (r3) {
r154 = <View style={styles.placeholderRow}>
{Array.from({
length: WISHLIST_IN_DM_LENGTH_MOBILE
}, (a0, a1) => (0, jsx)(View, {
style: env17450[14].placeholder
}, a1))}
</View>;
} else {
const gap = PX_16;
const r135 = [r97.map(({ sku, source }) => <View key={sku.id} style={env17450[14].wishlistItemShadow}>
<WishlistItemCard sku={sku} size={env17450[1]} source={source} recipientName={env17450[13]} onPress={() => (0, env17450[12])(sku, source)} />
</View>), ,];
let r136 = r101 != null;
if (r136) {
const r138 = {
style: styles.wishlistItemShadow,
children: null
};
if (r96) {
r138.children = <WishlistViewMoreCard sku={r101.sku} size={size} recipientName={name} overflowCount={totalUnownedWishlistItemCount - WISHLIST_IN_DM_LENGTH_MOBILE + 1} onPress={callback} />;
props2 = r138;
} else {
r138.children = <WishlistItemCard sku={r101.sku} size={size} source={r101.source} recipientName={name} onPress={() => {
const r3 = env17450[12];
const r4 = env17450[15];
return r3(r4.sku, r4.source);
}} />;
props2 = r138;
}
r136 = <View {...props2} />;
}
r135[1] = r136;
r154 = <ScrollView horizontal showsHorizontalScrollIndicator={false} snapToInterval={COLLECTIBLES_SHOP_CARD_WIDTH + gap} snapToAlignment="start" decelerationRate="fast" nestedScrollEnabled contentContainerStyle={{
gap,
paddingHorizontal: PX_162,
paddingVertical: Module712.space.PX_8
}}>{r135}</ScrollView>;
}
r112[2] = r154;
return <View>{r112}</View>;
}
@@ -0,0 +1,116 @@
// Metro module 9789 (f9790).
import { useCallback } from "react";
import { View } from "react-native";
import { isAvatarDecorationRecord } from "../../../collectibles/records/AvatarDecorationRecord";
import { isNameplateRecord } from "../../../collectibles/records/NameplateRecord";
import UserStore from "../../../../stores/UserStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { GiftingBadgeExperiment } from "../../gifting/experiments/GiftingBadgeExperiment";
import { useFetchCollectiblesProduct } from "../../../collectibles/hooks/useFetchCollectiblesProduct";
import { PremiumGiftScreens } from "./PremiumGiftModal";
import ProductPurchaseSuccessActionCreators from "../../../collectibles/native/ProductPurchaseSuccessActionCreators";
import Nameplate from "../../../collectibles/nameplates/native/Nameplate";
import { getNameplateData } from "../../../collectibles/nameplates/utils";
import { Avatar, AvatarSizes } from "../../../../design/void/native";
import GiftingRewardPreviewAvatar from "../../gifting/native/views/GiftingRewardPreviewAvatar";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
container: {
flexDirection: "column",
alignItems: "center",
gap: Module712.space.PX_16
},
nameplateContainer: {
width: 234,
height: 40,
flexDirection: "row",
alignItems: "center",
position: "relative",
borderRadius: Module712.radii.sm,
overflow: "hidden"
},
nameplateWrapper: {
position: "absolute",
left: 0,
right: 0,
top: 0,
bottom: 0,
borderRadius: Module712.radii.sm,
overflow: "hidden"
},
singleAvatarContainer: {
flexDirection: "row",
paddingRight: 15,
justifyContent: "center",
alignItems: "center",
marginLeft: 5
}
});
export default function PremiumGiftingPromotionSuccessActions(props) {
let onClose, prePurchaseGiftingBadgeProgress, navigation, enabled, product, callback;
const purchase = props.purchase;
onClose = void 0;
prePurchaseGiftingBadgeProgress = void 0;
navigation = void 0;
enabled = void 0;
product = void 0;
callback = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getCurrentUser());
const nativeGiftContext = useNativeGiftContext();
onClose = nativeGiftContext.onClose;
prePurchaseGiftingBadgeProgress = nativeGiftContext.prePurchaseGiftingBadgeProgress;
navigation = useNavigation();
enabled = GiftingBadgeExperiment.useConfig({
location: "PremiumGiftingPromotionSuccessActions"
}).enabled;
const fetchCollectiblesProduct = useFetchCollectiblesProduct(purchase.skuId);
product = fetchCollectiblesProduct.product;
const isFetching = fetchCollectiblesProduct.isFetching;
callback = useCallback(() => {
let r1 = enabled;
if (enabled) {
r1 = prePurchaseGiftingBadgeProgress != null;
}
if (r1) {
navigation.navigate(PremiumGiftScreens.GIFTING_BADGE, {
currentProgress: prePurchaseGiftingBadgeProgress
});
}
}, [enabled, prePurchaseGiftingBadgeProgress, navigation]);
const callback2 = useCallback(() => {
L6: {
if (product != null) {
ProductPurchaseSuccessActionCreators.open({
product,
onCancel: callback
});
} else {
if (enabled && prePurchaseGiftingBadgeProgress != null) {
navigation.navigate(PremiumGiftScreens.GIFTING_BADGE, {
currentProgress: prePurchaseGiftingBadgeProgress
});
break L6;
}
onClose();
}
}
}, [product, onClose, callback, enabled, prePurchaseGiftingBadgeProgress, navigation]);
const r19 = purchase.items[0];
return <View style={styles.container}>
{isNameplateRecord(r19) ? <View style={styles.nameplateContainer}>
<View style={styles.nameplateWrapper}>
<Nameplate nameplate={getNameplateData(r19)} fullOpacity animate />
</View>
<View style={styles.singleAvatarContainer}>
<Avatar user={stateFromStores} guildId={void 0} size={AvatarSizes.SMALL} aria-hidden />
</View>
</View> : isAvatarDecorationRecord(r19) ? <GiftingRewardPreviewAvatar size={AvatarSizes.LARGE} asset={r19.asset} /> : void 0}
<Button grow text={intl.string(t.kMYVwv)} loading={isFetching} onPress={callback2} />
</View>;
};
@@ -0,0 +1,70 @@
// Metro module 15759 (f15760).
import { View } from "react-native";
import SubscriptionStore from "../../../../stores/billing/SubscriptionStore";
import GooglePlayPriceChangeStore from "./GooglePlayPriceChangeStore";
import { HelpdeskArticles } from "../../../../Constants";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { getTierDisplayNameByPlanId, getIntervalStringAsNoun, getInterval } from "../../../../utils/PremiumUtils";
import { formatPrice } from "../../../../utils/PriceUtils";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import HelpdeskUtils from "../../../../utils/HelpdeskUtils";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
padding: Module712.space.PX_32,
paddingTop: Module712.space.PX_24
},
textContainer: {
marginBottom: Module712.space.PX_24
},
header: {
marginBottom: Module712.space.PX_16,
alignItems: "center",
textAlign: "center"
},
body: {
textAlign: "center"
}
});
export default function GooglePlayPriceChangeActionSheet(props) {
const markAsDismissed = props.markAsDismissed;
const styles = useStyles();
const stateFromStores = useStateFromStores([GooglePlayPriceChangeStore], () => GooglePlayPriceChangeStore.priceChangeRecord);
let r42 = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumSubscription(true))?.premiumPlanIdFromItems;
if (r42 == null) {
r42 = "";
}
const tierDisplayNameByPlanId = getTierDisplayNameByPlanId(r42);
const intervalStringAsNoun = getIntervalStringAsNoun(getInterval(r42).intervalType);
const oldPrice = formatPrice(stateFromStores.oldPrice, stateFromStores.oldCurrency);
const newPrice = formatPrice(stateFromStores.newPrice, stateFromStores.newCurrency);
return <BottomSheet>
<View style={styles.container}>
<View style={styles.textContainer}>
<Text variant="heading-xl/bold" style={styles.header}>
{intl.format(t.x0bFvn, {
subscriptionName: tierDisplayNameByPlanId
})}
</Text>
<Text variant="text-md/medium" style={styles.body}>
{intl.format(t["n+Hrjb"], {
subscriptionName: tierDisplayNameByPlanId,
changeDate: new Date(stateFromStores.expectedChargeTime),
interval: intervalStringAsNoun,
newPrice,
oldPrice,
hc_article_url: HelpdeskUtils.getArticleURL(HelpdeskArticles.SUBSCRIPTION_CANCEL)
})}
</Text>
</View>
<Button variant="primary" text={intl.string(t.BddRzS)} onPress={() => {
markAsDismissed(ContentDismissActionType.USER_DISMISS);
}} />
</View>
</BottomSheet>;
};
@@ -0,0 +1,54 @@
// Metro module 3843 (f3844).
import Record from "../../../../lib/Record";
import { $callWithNewTarget } from "../../../../_hermes/prelude";
let c2177_0 = {
PRICE_CHANGE_MODE_UNSPECIFIED: "PRICE_CHANGE_MODE_UNSPECIFIED",
PRICE_DECREASE: "PRICE_DECREASE",
PRICE_INCREASE: "PRICE_INCREASE",
OPT_OUT_PRICE_INCREASE: "OPT_OUT_PRICE_INCREASE"
};
class GooglePlayPriceChangeRecord extends Record {
constructor(a0) {
super();
this.userId = a0.userId;
this.subscriptionId = a0.subscriptionId;
this.oldCurrency = a0.oldCurrency;
this.oldPrice = a0.oldPrice;
this.newCurrency = a0.newCurrency;
this.newPrice = a0.newPrice;
this.priceChangeMode = a0.priceChangeMode;
this.expectedChargeTime = a0.expectedChargeTime;
this.priceChangeId = a0.priceChangeId;
}
static createFromServer({ user_id, subscription_id, old_currency, old_price, new_currency, new_price, price_change_mode, expected_charge_time, price_change_id }) {
const prototypeOf = Object.getPrototypeOf(GooglePlayPriceChangeRecord);
const r18 = Object.create(GooglePlayPriceChangeRecord.prototype);
const r19 = $callWithNewTarget(prototypeOf, r18, GooglePlayPriceChangeRecord);
const r20 = r19 instanceof Object ? r19 : r18;
r20.userId = user_id;
r20.subscriptionId = subscription_id;
r20.oldCurrency = old_currency;
r20.oldPrice = old_price;
r20.newCurrency = new_currency;
r20.newPrice = new_price;
r20.priceChangeMode = price_change_mode;
r20.expectedChargeTime = expected_charge_time;
r20.priceChangeId = price_change_id;
return r20;
}
get isPriceIncrease() {
return this.priceChangeMode === c2177_0.PRICE_INCREASE || this.priceChangeMode === c2177_0.OPT_OUT_PRICE_INCREASE;
}
get isOptOutPriceIncrease() {
return this.priceChangeMode === c2177_0.OPT_OUT_PRICE_INCREASE;
}
get isPriceDecrease() {
return this.priceChangeMode === c2177_0.PRICE_DECREASE;
}
get isInFuture() {
return this.expectedChargeTime > new Date().toISOString();
}
}
export default GooglePlayPriceChangeRecord;
export { c2177_0 as GooglePlayPriceChangeMode };
export { GooglePlayPriceChangeRecord };
@@ -0,0 +1,37 @@
// Metro module 15760 (f15761).
import SubscriptionStore from "../../../../stores/billing/SubscriptionStore";
import { SubscriptionStatusTypes } from "../../../../Constants";
import { isAndroid } from "../../../../utils/PlatformUtils";
import Module589 from "../../../../_bundle/Module589";
import Dispatcher from "../../../../Dispatcher";
let c11262_3, c11262_4, priceChange;
const onInitializeSync = function onInitializeSync() {
priceChange = null;
c11262_4 = false;
if (isAndroid()) {
const premiumSubscription = SubscriptionStore.getPremiumSubscription();
const priceChange2 = premiumSubscription?.priceChange;
if (premiumSubscription != null && c11262_3.has(premiumSubscription.status) && priceChange2 != null && priceChange2.isInFuture && priceChange2.isPriceIncrease) {
priceChange = priceChange2;
c11262_4 = true;
}
}
};
c11262_3 = new Set([SubscriptionStatusTypes.ACTIVE, SubscriptionStatusTypes.PAST_DUE, SubscriptionStatusTypes.UNPAID]);
c11262_4 = false;
priceChange = null;
class GooglePlayPriceChangeStore extends Module589.Store {
static displayName = "GooglePlayPriceChangeStore";
initialize() {
this.syncWith([SubscriptionStore], onInitializeSync);
this.waitFor(SubscriptionStore);
}
get shouldShowGooglePlayPriceChange() {
return c11262_4;
}
get priceChangeRecord() {
return priceChange;
}
}
const googlePlayPriceChangeStore = new GooglePlayPriceChangeStore(Dispatcher, {});
export default googlePlayPriceChangeStore;
@@ -0,0 +1,430 @@
// Metro module 6251 (f6252).
import _objectWithoutProperties from "../../../_bundle/_objectWithoutProperties";
import { useCallback } from "react";
import { setGPlayAnalytics } from "../../gplay/native/GPlayAnalyticsStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import SubscriptionStore from "../../../stores/billing/SubscriptionStore";
import IAPStore_android from "../../../stores/native/IAPStore.android";
import { Endpoints, AnalyticEvents } from "../../../Constants";
import { PaymentGateways } from "../../../_bundle/Module505";
import { HTTP } from "../../../_bundle/sendRequest";
import InvalidGooglePlayPurchase from "../../billing/errors/InvalidGooglePlayPurchase";
import { BillingError } from "../../../errors/index";
import { isSpendingLimitError, showSpendingLimitReachedAlert } from "../../parent_tools/native/showSpendingLimitReachedAlert";
import { intl, t } from "../../../intl/index.native";
import { ErrorCodes } from "../../../errors/BillingError";
import AlertActionCreators from "../../../actions/AlertActionCreators";
import { TrialIdToProductOfferId, DiscountIdToProductOfferId, ProductIds, BOGO_OFFER_ID } from "./ProductIds.android";
import { useStateFromStores } from "../../../_bundle/Module589";
import { usePremiumTrialOffer } from "../hooks/usePremiumTrialOffer.android";
import { usePremiumDiscountOffer } from "../hooks/usePremiumDiscountOffer.native";
import { useIsEligibleForBogoOffer } from "./hooks/useIsEligibleForBogoOffer.android";
import { getBasePurchaseFlowAnalyticsFields } from "./PremiumAnalyticsUtils";
import { trackPaymentFlowStartedAnalyticsAndCTP } from "../../experiments/trigger_points/PaymentFlowStartedTriggerPoint";
import GPlayManager_android from "../../gplay/native/GPlayManager.android";
import { convertToMinorCurrencyUnits } from "../../../_bundle/convertToMajorCurrencyUnits";
import { captureBillingException } from "../../../utils/BillingUtils";
import { updatePendingDowngrade, subscribe, purchase } from "../../../actions/native/GPlayActionCreators";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { HermesBuiltin } from "../../../_hermes/prelude";
function $mk117979($env) {
return function getOfferId(a0, a1, a2, a3, a4) {
const offerIds = a4?.offerIds;
if (offerIds != null) {
if (a2 != null) {
const r34 = TrialIdToProductOfferId[a2.trial_id];
return r34 == null ? void 0 : r34[a0];
}
if (a3 != null) {
const r25 = DiscountIdToProductOfferId[a3.discountId];
return r25 == null ? void 0 : r25[a0];
}
}
return a1 ? a0 === ProductIds.PREMIUM_TIER_2_MONTHLY ? BOGO_OFFER_ID : null : null;
};
}
function $mk117980($env) {
return function showPurchaseErrorModal(a0) {
const r17 = a0 instanceof BillingError ? a0 : new BillingError(a0);
if (isSpendingLimitError(r17)) {
showSpendingLimitReachedAlert();
} else {
const r33 = intl.string(t.LFFx5G);
const body = r17.code !== ErrorCodes.UNKNOWN && r17.code !== -1 && r17.message != null ? r17.message : r33;
AlertActionCreators.show({
title: intl.string(t["U+H+kd"]),
body,
isDismissable: true
});
}
};
}
let _excluded;
let env3969 = {};
const validatePurchase = async function validatePurchase(c25765_0) {
let c25765_3;
let c25765_4 = 0;
let c29706_0, c29706_1, c29706_2, c29706_3, c29706_4, c29706_5, c29706_6;
try {
c29706_0 = void 0;
c29706_1 = void 0;
c29706_2 = void 0;
c29706_3 = void 0;
c29706_4 = void 0;
c29706_5 = void 0;
c29706_0 = c25765_0.productId;
c29706_1 = c25765_0.premiumSubscription;
c29706_2 = c25765_0.offerId;
c29706_3 = c25765_0.currency;
c29706_4 = c25765_0.price;
c29706_5 = c25765_0.isGift;
await void 0;
c25765_4 = 1;
await HTTP.post({
url: Endpoints.GOOGLE_PLAY_VALIDATE_PURCHASE,
body: {
product_id: c29706_0,
offer_id: c29706_2,
subscription_id: c29706_1?.id,
currency: c29706_3,
price: c29706_4,
is_gift: c29706_5
},
rejectWithError: false
});
c25765_4 = 0;
} catch ($e) {
const r30 = $e;
let r8 = r30;
c25765_3 = r30;
if (c25765_4 !== 0) {
while (true) {
try {
const r96 = c25765_3;
c25765_4 = 0;
c29706_6 = r96;
throw new InvalidGooglePlayPurchase(c29706_6);
} catch (r92) {
r8 = r92;
c25765_3 = r92;
if (c25765_4 === 0) {
break;
}
}
}
}
throw r8;
}
};
_excluded = ["succeededOnlyFields"];
export function useHandlePremiumPurchase() {
let env15616 = {
$parent: env3969
};
const stateFromStores = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumTypeSubscription());
env15616[0] = stateFromStores;
const premiumTrialOffer = usePremiumTrialOffer();
env15616[1] = premiumTrialOffer;
const premiumDiscountOffer = usePremiumDiscountOffer();
env15616[2] = premiumDiscountOffer;
const isEligibleForBogoOffer = useIsEligibleForBogoOffer();
env15616[3] = isEligibleForBogoOffer;
const r3 = stateFromStores != null;
env15616[4] = r3;
const id = stateFromStores?.id;
env15616[5] = id;
const paymentGatewayPlanId = stateFromStores?.paymentGatewayPlanId;
env15616[6] = paymentGatewayPlanId;
const paymentGatewaySubscriptionId = stateFromStores?.paymentGatewaySubscriptionId;
env15616[7] = paymentGatewaySubscriptionId;
let c15617_0 = async (c29707_0) => {
let r22, allowPlanChange, isOneTimePurchase;
let c29707_1, c29707_2, c29707_3, c29707_4;
let c29707_5 = 0;
const r16 = void 0;
const r15 = env3969;
L45: {
try {
let env31411;
L16: {
L13: {
L14: {
L10: {
c29707_3 = r16;
const r54 = env31411 = {
$parent: r15
};
c29707_2 = r54;
env31411[0] = void 0;
env31411[1] = void 0;
env31411[2] = void 0;
env31411[3] = void 0;
env31411[4] = void 0;
env31411[5] = void 0;
env31411[6] = void 0;
env31411[7] = void 0;
env31411[8] = void 0;
env31411[9] = void 0;
env31411[10] = void 0;
env31411[11] = void 0;
env31411[12] = void 0;
r22 = c29707_0;
env31411[0] = r22.productId;
env31411[1] = r22.skuId;
env31411[2] = r22.analyticsLoadId;
env31411[3] = r22.analyticsLocation;
env31411[4] = r22.analyticsLocations;
env31411[5] = r22.analyticsData;
const isGift = r22.isGift;
if (isGift !== void 0) {
env31411[6] = isGift;
isOneTimePurchase = r22.isOneTimePurchase;
if (isOneTimePurchase !== void 0) {
break L10;
}
} else {
env31411[6] = false;
isOneTimePurchase = r22.isOneTimePurchase;
if (isOneTimePurchase !== void 0) {
break L10;
}
}
env31411[7] = false;
allowPlanChange = r22.allowPlanChange;
if (allowPlanChange !== void 0) {
break L13;
}
break L14;
}
env31411[7] = isOneTimePurchase;
allowPlanChange = r22.allowPlanChange;
if (allowPlanChange !== void 0) {
break L13;
}
}
env31411[8] = true;
env31411[9] = r22.applicationId;
env31411[10] = r22.giftInfoOptions;
env31411[11] = r22.onPurchaseComplete;
env31411[12] = r22.onPurchaseError;
env31411[13] = void 0;
env31411[14] = void 0;
env31411[15] = void 0;
env31411[16] = void 0;
env31411[17] = void 0;
env31411[18] = void 0;
env31411[19] = void 0;
env31411[20] = void 0;
env31411[21] = void 0;
break L16;
}
env31411[8] = allowPlanChange;
env31411[9] = r22.applicationId;
env31411[10] = r22.giftInfoOptions;
env31411[11] = r22.onPurchaseComplete;
env31411[12] = r22.onPurchaseError;
env31411[13] = void 0;
env31411[14] = void 0;
env31411[15] = void 0;
env31411[16] = void 0;
env31411[17] = void 0;
env31411[18] = void 0;
env31411[19] = void 0;
env31411[20] = void 0;
env31411[21] = void 0;
}
await void 0;
env31411[13] = AuthenticationStore.getId();
env31411[14] = IAPStore_android.getProduct(env31411[0]);
env31411[15] = getBasePurchaseFlowAnalyticsFields({
isGift: env31411[6],
analyticsLoadId: env31411[2],
analyticsLocation: env31411[3],
analyticsLocations: env31411[4]
});
const r116 = env31411[5];
c29707_1 = r116;
if (r116 == null) {
c29707_1 = {};
}
env31411[16] = c29707_1;
env31411[17] = env31411[16].succeededOnlyFields;
env31411[18] = (0, _objectWithoutProperties)(env31411[16], _excluded);
const r127 = {
...env31411[15],
subscription_plan_gateway_plan_id: env31411[0],
sku_id: env31411[1],
price: env31411[14]?.price,
regular_price: env31411[14]?.price
};
const r140 = env31411[14];
const currency = r140 == null ? void 0 : r140.currencyCode.toLowerCase();
L31: {
const r144 = c29707_3;
r127.currency = currency;
r127.application_id = env31411[9];
HermesBuiltin.copyDataProperties(r127, env31411[18]);
env31411[19] = r127;
setGPlayAnalytics(env31411[0], {
...env31411[19],
succeededOnlyFields: env31411[17]
});
const r156 = env31411[0];
const r157 = r144.$parent;
const r158 = r157[3];
const r31 = r157[1];
const r30 = r157[2];
const r29 = env31411[14];
env31411[20] = $mk117979(env3969)(r156, r158, r31, r30, r29);
trackPaymentFlowStartedAnalyticsAndCTP({
...env31411[19],
payment_gateway: PaymentGateways.GOOGLE
});
c29707_5 = 1;
if (!env31411[6] && !env31411[7]) {
if (c29707_3.$parent[4] && !env31411[8]) {
break L31;
}
if (c29707_3.$parent[6] != null && c29707_3.$parent[7] != null && c29707_3.$parent[5] != null) {
const r208 = c29707_3;
const r215 = env31411[0];
const r216 = r208.$parent;
updatePendingDowngrade(r215, r216[6], r216[7], r216[5]);
}
await (0, validatePurchase)({
productId: env31411[0],
premiumSubscription: c29707_3.$parent[0],
offerId: env31411[20]
});
const r244 = c29707_3;
const r251 = env31411[0];
const r252 = env31411[13];
const r253 = r244.$parent;
await subscribe(r251, r252, r253[6], r253[7], env31411[20]);
} else {
if (env31411[6] && env31411[10] != null) {
if (GPlayManager_android.giftInfoOptionsCache != null && GPlayManager_android.giftInfoOptionsCache[env31411[0]] != null) {
delete GPlayManager_android.giftInfoOptionsCache[env31411[0]];
}
GPlayManager_android.giftInfoOptionsCache[env31411[0]] = {
...env31411[10]
};
}
env31411[21] = null;
if (env31411[14] != null) {
c29707_5 = 2;
env31411[21] = convertToMinorCurrencyUnits(env31411[14].price / 100, env31411[14].currencyCode);
c29707_5 = 1;
}
const r333 = c29707_3;
const r340 = env31411[14];
const r341 = r340 == null;
let currency2 = void 0;
if (!r341) {
const currencyCode = r340.currencyCode;
currency2 = currencyCode == null ? void 0 : currencyCode.toLowerCase();
}
await validatePurchase({
productId: env31411[0],
premiumSubscription: r333.$parent[0],
offerId: null,
currency: currency2,
price: env31411[21],
isGift: env31411[6]
});
await purchase(env31411[0], env31411[13]);
}
}
const r185 = env31411[11];
if (r185 != null) {
r185({
paymentGateway: PaymentGateways.GOOGLE
});
}
c29707_5 = 0;
} catch ($e) {
const r52 = $e;
let r7 = r52;
c29707_4 = r52;
let r53 = c29707_5;
if (r53 !== 0) {
while (true) {
if (r53 === 1) {
try {
const r522 = c29707_4;
c29707_5 = 0;
env31411[23] = r522;
AnalyticsUtils.track(AnalyticEvents.PAYMENT_FLOW_FAILED, {
...env31411[19],
payment_gateway: PaymentGateways.GOOGLE,
error_message: env31411[23].message
});
const r541 = env31411[12];
if (r541 != null) {
r541();
}
captureBillingException(env31411[23]);
const r552 = env31411[23];
$mk117980(env3969)(r552);
if (!(env31411[23] instanceof InvalidGooglePlayPurchase)) {
break L45;
}
throw env31411[23];
} catch (r519) {
r7 = r519;
c29707_4 = r519;
r53 = c29707_5;
if (r53 === 0) {
break;
}
}
} else {
try {
const r425 = c29707_4;
c29707_5 = 1;
env31411[22] = r425;
captureBillingException(env31411[22]);
const r436 = c29707_3;
const r443 = env31411[14];
const r444 = r443 == null;
let currency3 = void 0;
if (!r444) {
const currencyCode2 = r443.currencyCode;
currency3 = currencyCode2 == null ? void 0 : currencyCode2.toLowerCase();
}
await validatePurchase({
productId: env31411[0],
premiumSubscription: r436.$parent[0],
offerId: null,
currency: currency3,
price: env31411[21],
isGift: env31411[6]
});
await purchase(env31411[0], env31411[13]);
const r509 = env31411[11];
if (r509 != null) {
r509({
paymentGateway: PaymentGateways.GOOGLE
});
}
c29707_5 = 0;
break L45;
} catch (r422) {
r7 = r422;
c29707_4 = r422;
r53 = c29707_5;
if (r53 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
return useCallback(function() {
return c15617_0.apply(this, arguments);
}, [r3, paymentGatewayPlanId, paymentGatewaySubscriptionId, id, premiumTrialOffer, premiumDiscountOffer, stateFromStores, isEligibleForBogoOffer]);
}
@@ -0,0 +1,23 @@
// Metro module 6249 (f6250).
import { useMemo } from "react";
import { useNativeCheckoutStore } from "../../../checkout/native/NativeCheckoutStore";
import { getSubscriptionItemsForProduct } from "../PremiumBundledPlansUtils";
import { isIOS } from "../../../../utils/PlatformUtils";
export function useCheckoutPlanPriceString(a0, a1) {
let nativeCheckoutStore;
let c15612_0 = a0;
let r6 = a1?.priceString;
if (r6 == null) {
r6 = null;
}
const nativeCheckoutStore2 = useNativeCheckoutStore((a0) => a0.orderRequired);
nativeCheckoutStore = useNativeCheckoutStore((a0) => a0.getCheckoutContextRecord());
const memo = useMemo(() => {
if (nativeCheckoutStore == null) {
return null;
}
const availablePlanForItems = nativeCheckoutStore.getAvailablePlanForItems(getSubscriptionItemsForProduct(c15612_0));
return availablePlanForItems != null ? availablePlanForItems.getPriceString() : null;
}, [nativeCheckoutStore, a0]);
return isIOS() ? nativeCheckoutStore2 !== false ? memo : r6 : r6;
}
@@ -0,0 +1,46 @@
// Metro module 6570 (f6571).
import { useMemo } from "react";
import IAPStore_android from "../../../../stores/native/IAPStore.android";
import { CurrencyCodes } from "../../../../_bundle/Module505";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { DiscountIdToProductOfferId } from "../ProductIds.android";
import { formatPrice } from "../../../../utils/PriceUtils";
export function useDiscountedPremiumProductInfo(a0, a1) {
let stateFromStores;
const memo = useMemo(() => {
if (a0 == null) {
return null;
}
let r4 = a0.discount?.planIds;
if (r4 == null) {
r4 = [];
}
let c25927_0 = r4;
return a1.find((item) => c25927_0.includes(item.basePlanId));
}, [a0, a1]);
stateFromStores = useStateFromStores([IAPStore_android], () => memo != null ? IAPStore_android.getProduct(memo.productId) : null, [memo]);
return {
discountedProduct: stateFromStores,
discountedPriceString: useMemo(() => {
if (a0 != null && stateFromStores != null) {
const r10 = DiscountIdToProductOfferId[a0.discountId];
const r15 = r10 == null ? void 0 : r10[stateFromStores.identifier];
let c25928_0 = r15;
if (r15 == null) {
return null;
}
const r23 = stateFromStores.currencyCode.toUpperCase() in CurrencyCodes ? stateFromStores.currencyCode.toLowerCase() : CurrencyCodes.USD;
if (stateFromStores.subscriptionOffers != null) {
const r30 = stateFromStores.subscriptionOffers.find((subscriptionOffer) => subscriptionOffer.offerId === c25928_0);
if (r30 != null && r30.pricingPhases != null && r30.pricingPhases.length > 0) {
return formatPrice(r30.pricingPhases[0].price / 100, r23, {
convertToMajorUnits: false
});
}
}
return null;
}
return null;
}, [a0, stateFromStores])
};
}
@@ -0,0 +1,31 @@
// Metro module 6261 (f6262).
import { useEffect } from "react";
import SubscriptionStore from "../../../../stores/billing/SubscriptionStore";
import PromotionsStore from "../../promotions/PromotionsStore";
import { PremiumTypes } from "../../PremiumConstants";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { usePremiumTrialOffer } from "../../hooks/usePremiumTrialOffer.android";
import { usePremiumDiscountOffer } from "../../hooks/usePremiumDiscountOffer.native";
import { useIsPaymentsBlocked } from "../../../billing/experiments/BlockedPaymentsCountryExperiment";
import { useForceUpdate } from "../../../../_bundle/Module6235";
export function useIsEligibleForBogoOffer() {
let forceUpdate, c15638_1;
const stateFromStores = useStateFromStores([PromotionsStore], () => PromotionsStore.getActiveBogoRewardPromotion());
const stateFromStores2 = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumTypeSubscription());
const premiumTrialOffer = usePremiumTrialOffer();
const premiumDiscountOffer = usePremiumDiscountOffer();
const isPaymentsBlocked = useIsPaymentsBlocked();
forceUpdate = useForceUpdate();
const r16 = stateFromStores != null ? stateFromStores.endDate.valueOf() : null;
c15638_1 = r16;
useEffect(() => {
if (c15638_1 != null) {
const r8 = c15638_1 - Date.now();
if (!(r8 <= 0)) {
let c25767_0 = setTimeout(forceUpdate, r8);
return () => clearTimeout(c25767_0);
}
}
}, [r16, forceUpdate]);
return stateFromStores != null && !isPaymentsBlocked && (premiumTrialOffer == null && premiumDiscountOffer == null && (stateFromStores2 == null ? void 0 : stateFromStores2.hasPremiumAtLeast(PremiumTypes.TIER_2)) !== true);
}
@@ -0,0 +1,98 @@
// Metro module 6571 (f6572).
import { useEffect } from "react";
import SubscriptionPlanStore from "../../../../stores/billing/SubscriptionPlanStore";
import SubscriptionStore from "../../../../stores/billing/SubscriptionStore";
import IAPStore_android from "../../../../stores/native/IAPStore.android";
import { PaymentGateways } from "../../../../_bundle/Module505";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { NitroACOMSubscriptionExperiment } from "../../../billing/native/ACOMExperiments";
import NativePaymentHooks_android from "../../../payments/native/hooks/NativePaymentHooks.android";
import useStoreFrontPrice, { PriceStates } from "../../../billing/native/subscription/useStoreFrontPrice";
import { BasePlanIdToProductId } from "../ProductIds.android";
import { isIOS } from "../../../../utils/PlatformUtils";
import useInitialValue from "../../../../hooks/useInitialValue";
import Backoff from "../../../../_bundle/Backoff";
import { fetchPremiumSubscriptionPlans } from "../../../../actions/SubscriptionPlanActionCreators";
import { formatPrice } from "../../../../utils/PriceUtils";
export default function usePremiumPlanPrice(a0) {
let r72;
let storeFront, priceState, c15807_3, c15807_4, c15807_5;
const stateFromStores = useStateFromStores([SubscriptionStore], () => SubscriptionStore.getPremiumTypeSubscription());
let enabled = NitroACOMSubscriptionExperiment.useConfig({
location: "usePremiumPlanPrice"
}).enabled;
storeFront = NativePaymentHooks_android.useNativeIAPPayments().storeFront;
const storeFrontPrice = useStoreFrontPrice(useStateFromStores([SubscriptionPlanStore], () => a0 != null ? SubscriptionPlanStore.get(a0) : null, [a0]), storeFront);
const price = storeFrontPrice.price;
priceState = storeFrontPrice.priceState;
const r43 = a0 != null ? BasePlanIdToProductId[a0] : null;
c15807_3 = r43;
const stateFromStores2 = useStateFromStores([IAPStore_android], () => c15807_3 != null ? IAPStore_android.getProduct(c15807_3) : null, [r43]);
let r56 = isIOS();
if (r56) {
if (!enabled) {
enabled = stateFromStores?.isACOM === true;
}
r56 = enabled;
}
c15807_4 = r56;
const initialValue = useInitialValue(() => new Backoff(500, 10000));
c15807_5 = initialValue;
useEffect(() => {
L12: {
if (c15807_4) {
if (priceState !== PriceStates.PRICE_AVAILABLE) {
if (priceState !== PriceStates.MISMATCHING_COUNTRIES && priceState !== PriceStates.COUNTRY_PRICE_UNAVAILABLE) {
break L12;
}
if (storeFront?.country != null) {
if (!c15807_5.pending && !SubscriptionPlanStore.isFetchingForPremiumSKUs() && !(c15807_5.fails >= 3)) {
const country = storeFront.country;
c15807_5.fail(() => {
if (!SubscriptionPlanStore.isFetchingForPremiumSKUs()) {
fetchPremiumSubscriptionPlans(country, void 0, void 0, PaymentGateways.APPLE_ADVANCED_COMMERCE).catch(() => {});
}
});
return () => {
c15807_5.cancel();
};
}
}
} else {
c15807_5.succeed();
}
}
}
}, [r56, priceState, storeFront, initialValue]);
const r69 = a0 == null;
let r70 = null;
if (!r69) {
if (r56) {
r72 = priceState === PriceStates.PRICE_AVAILABLE ? price != null ? {
price: price.amount,
currency: price.currency,
countryCode: storeFront?.country,
priceString: formatPrice(price.amount, price.currency),
source: "API"
} : null : null;
} else {
const r71 = stateFromStores2 != null;
r72 = null;
if (r71) {
let countryCode = storeFront?.country;
if (countryCode == null) {
countryCode = stateFromStores2.countryCode;
}
r72 = {
price: stateFromStores2.price,
currency: stateFromStores2.currencyCode,
countryCode,
priceString: stateFromStores2.priceString,
source: "IAP"
};
}
}
r70 = r72;
}
return r70;
};
@@ -0,0 +1,14 @@
// Metro module 9709 (f9710).
import IAPStore_android from "../../../../stores/native/IAPStore.android";
import { PRICE_PLACEHOLDER } from "../../PremiumConstants";
import { getPlanIdForPremiumType } from "../../../../utils/PremiumUtils";
import { getProductIdForGift } from "../ProductIds.android";
import { useStateFromStores } from "../../../../_bundle/Module589";
export default function usePremiumProductPricingString(a0, a1) {
const productIdForGift = getProductIdForGift(getPlanIdForPremiumType(a0, a1));
let r24 = useStateFromStores([IAPStore_android], () => IAPStore_android.getProduct(productIdForGift))?.priceString;
if (r24 == null) {
r24 = PRICE_PLACEHOLDER;
}
return r24;
};
@@ -0,0 +1,177 @@
// Metro module 12580 (f12581).
import { useEffect } from "react";
import { useNativeCheckoutStore } from "../../../checkout/native/NativeCheckoutStore";
import IAPStore_android from "../../../../stores/native/IAPStore.android";
import { PremiumTypes, SubscriptionIntervalTypes } from "../../PremiumConstants";
import { getProductIdFromSubscription, getSubscriptionItemsForProduct } from "../PremiumBundledPlansUtils";
import { AppStorePremiumProductIdsToPremiumBundledItems } from "../ProductIds.android";
import { isIOS, getPlatformName, isAndroid } from "../../../../utils/PlatformUtils";
import { formatPrice } from "../../../../utils/PriceUtils";
import { captureBillingException } from "../../../../utils/BillingUtils";
import { useStateFromStores } from "../../../../_bundle/Module589";
let c8678_7;
const getViewerProductId = function getViewerProductId(a0) {
let productIdFromSubscription;
if (a0 == null) {
return null;
}
try {
productIdFromSubscription = getProductIdFromSubscription(a0, false);
} catch ($e) {
return null;
}
return productIdFromSubscription;
};
c8678_7 = {
priceString: null,
failure: null
};
export function usePremiumTier2DeltaPriceString(a0, a1, a2, a3) {
let r51, r67, r92;
let viewerProductId;
const nativeCheckoutStore = useNativeCheckoutStore((a0) => ({
orderRequired: a0.orderRequired,
checkoutContext: a0.getCheckoutContextRecord()
}));
const { orderRequired, checkoutContext } = nativeCheckoutStore;
viewerProductId = getViewerProductId(a1);
const stateFromStores = useStateFromStores([IAPStore_android], () => viewerProductId != null ? IAPStore_android.getProduct(viewerProductId) : null);
const r31 = isIOS() && orderRequired;
let r3 = false;
if (a3) {
const premiumTier = a0.premiumTier;
const TIER_2 = PremiumTypes.TIER_2;
r3 = false;
if (premiumTier === TIER_2) {
const interval = a0.interval;
const MONTH = SubscriptionIntervalTypes.MONTH;
r3 = false;
if (interval === MONTH) {
const r2 = a0.numPremiumGuild < 1;
r3 = false;
if (!r2) {
const viewerProductId2 = getViewerProductId(a1);
const r43 = viewerProductId2 != null ? AppStorePremiumProductIdsToPremiumBundledItems[viewerProductId2] : null;
r3 = r43 != null && r43.basePlanId === a0.basePlanId && r43.numPremiumGuild === 0;
}
}
}
}
if (r3) {
L39: {
if (r31) {
L38: {
if (checkoutContext == null) {
r92 = c8678_7;
} else {
const availablePlanForItems = checkoutContext.getAvailablePlanForItems(getSubscriptionItemsForProduct(a0.productId));
if (availablePlanForItems == null) {
r92 = c8678_7;
} else {
const addOnPrice = availablePlanForItems.getAddOnPrice();
if (addOnPrice != null && addOnPrice.majorUnits > 0) {
r92 = {
priceString: formatPrice(addOnPrice.majorUnits, addOnPrice.currency, {
convertToMajorUnits: false
}),
failure: null
};
break L38;
}
r92 = c8678_7;
}
}
}
r67 = r92;
} else {
if (a2 != null && stateFromStores != null) {
const platformName = getPlatformName();
if (a2.currencyCode !== stateFromStores.currencyCode) {
r67 = {
priceString: null,
failure: {
kind: "currency_mismatch",
platform: platformName,
productId: a0.productId,
currencyCode: a2.currencyCode
}
};
break L39;
}
const r62 = a2.price - stateFromStores.price;
if (r62 > 0 && r62 < a2.price) {
r67 = {
priceString: formatPrice(isAndroid() ? r62 / 100 : r62, a2.currencyCode, {
convertToMajorUnits: false
}),
failure: null
};
break L39;
}
r67 = {
priceString: null,
failure: {
kind: "delta_out_of_range",
platform: platformName,
productId: a0.productId,
currencyCode: a2.currencyCode
}
};
break L39;
}
r67 = c8678_7;
}
}
r51 = r67;
} else {
r51 = c8678_7;
}
const { priceString, failure } = r51;
let r106 = failure?.kind;
if (r106 == null) {
r106 = null;
}
const delta_failure_kind = r106;
let r108 = failure?.platform;
if (r108 == null) {
r108 = null;
}
let c19908_1 = r108;
let r110 = failure?.currencyCode;
if (r110 == null) {
r110 = null;
}
let c19908_2 = r110;
let r112 = failure?.productId;
if (r112 == null) {
r112 = null;
}
let c19908_3 = r112;
useEffect(() => {
if (delta_failure_kind != null) {
const error = new Error(`delta_price_integrity_${delta_failure_kind}`);
let delta_platform = c19908_1;
if (delta_platform == null) {
delta_platform = "unknown";
}
let delta_currency_code = c19908_2;
if (delta_currency_code == null) {
delta_currency_code = "unknown";
}
let delta_product_id = c19908_3;
if (delta_product_id == null) {
delta_product_id = "unknown";
}
captureBillingException(error, {
tags: {
source: "usePremiumTier2DeltaPriceString",
delta_failure_kind,
delta_platform,
delta_currency_code,
delta_product_id
}
});
}
}, [delta_failure_kind, r108, r110, r112]);
return priceString;
}
@@ -0,0 +1,73 @@
// Metro module 9702 (f9703).
import { useCallback } from "react";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
import { useCreateOrReuseGiftOrder } from "../../../payments/native/utils/createOrReuseGiftOrder";
import { getPlanIdForPremiumType } from "../../../../utils/PremiumUtils";
import { getProductIdForGift } from "../ProductIds.android";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../../intl/index.native";
import { PremiumGiftScreens } from "../gifting/PremiumGiftModal";
let env6419 = {};
export function useSelectPremiumGift(a0) {
let env17416 = {
$parent: env6419
};
const navigation = useNavigation();
env17416[0] = navigation;
const nativeGiftContext = useNativeGiftContext();
const setPremiumType = nativeGiftContext.setPremiumType;
env17416[1] = setPremiumType;
const recipientUserId = nativeGiftContext.recipientUserId;
env17416[2] = recipientUserId;
const planInterval = nativeGiftContext.planInterval;
env17416[3] = planInterval;
const setOrder = nativeGiftContext.setOrder;
env17416[4] = setOrder;
const createOrReuseGiftOrder2 = useCreateOrReuseGiftOrder(a0);
env17416[5] = createOrReuseGiftOrder2;
let c17417_0 = async (c30136_0) => {
let c30136_3 = 0;
let c31511_0;
try {
c31511_0 = void 0;
(0, env17416[4])(void 0);
(0, env17416[1])(c30136_0);
const planIdForPremiumType = getPlanIdForPremiumType(c30136_0, env17416[3]);
const productIdForGift = getProductIdForGift(planIdForPremiumType);
c30136_3 = 1;
c31511_0 = await (0, env17416[5])({
planId: planIdForPremiumType,
recipientUserId: env17416[2],
productId: productIdForGift
});
c30136_3 = 0;
(0, env17416[4])(c31511_0);
env17416[0].navigate(PremiumGiftScreens.CUSTOMIZATION);
} catch ($e) {
let r28 = $e;
if (c30136_3 !== 0) {
while (true) {
try {
c30136_3 = 0;
AlertActionCreators.show({
title: intl.string(t.R0RpRX),
body: intl.string(t.CKsXk3)
});
} catch ($e) {
r28 = $e;
if (c30136_3 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r28;
}
};
return useCallback(function() {
return c17417_0.apply(this, arguments);
}, [setPremiumType, planInterval, createOrReuseGiftOrder2, recipientUserId, setOrder, navigation]);
}
@@ -0,0 +1,53 @@
// Metro module 6546 (f6547).
import { UserSettingsSections } from "../../../Constants";
import * as _PremiumBundledPlansUtils from "./PremiumBundledPlansUtils";
import ModalActionCreators from "../../../actions/ModalActionCreators";
import { PREMIUM_KEY } from "../../../components_native/premium/PremiumModal";
import { trackUserSettingsPaneViewed } from "../../../utils/UserSettingsUtils";
export function launchPremiumPlanSelect({ predicate, navigation, showCurrentPlan = true, isBoostPurchaseFlow = false, analyticsLocation, analyticsLocations, planId, applicationId, guildId, onBack, onPaymentSuccess, onPaymentDismiss }) {
const wrappedPredicate = function wrappedPredicate(a0) {
const shouldAlwaysExcludeFromPlanSelect = _PremiumBundledPlansUtils.shouldAlwaysExcludeFromPlanSelect(a0);
let r12 = !shouldAlwaysExcludeFromPlanSelect;
if (!shouldAlwaysExcludeFromPlanSelect) {
let r14 = predicate == null ? void 0 : predicate(a0);
if (r14 == null) {
r14 = true;
}
r12 = r14;
}
return r12;
};
const PREMIUM_PLAN_SELECT = UserSettingsSections.PREMIUM_PLAN_SELECT;
if (navigation != null) {
navigation.push(PREMIUM_PLAN_SELECT, {
predicate: wrappedPredicate,
analyticsLocation,
analyticsLocations,
showCurrentPlan,
isBoostPurchaseFlow,
planId,
applicationId,
guildId,
onPaymentSuccess,
onPaymentDismiss
});
} else {
ModalActionCreators.pushLazy(import("../../../components_native/premium/PremiumModal"), {
initialRoute: PREMIUM_PLAN_SELECT,
analyticsLocation,
analyticsLocations,
predicate: wrappedPredicate,
showCurrentPlan,
isBoostPurchaseFlow,
planId,
applicationId,
guildId,
onBack,
onPaymentSuccess,
onPaymentDismiss
}, PREMIUM_KEY);
}
trackUserSettingsPaneViewed({
destinationPane: PREMIUM_PLAN_SELECT
});
}
@@ -0,0 +1,9 @@
// Metro module 6216 (f6217).
import { PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY } from "../PremiumConstants";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
export default function openPremiumPlanSelectionActionSheet(a0, a1) {
if (a1 == null) {
ActionSheetActionCreators.hideActionSheet();
}
ActionSheetActionCreators.openLazy(import("./PremiumPlanSelectionActionSheet"), PREMIUM_PLAN_SELECTION_ACTION_SHEET_KEY, a0, a1);
};
@@ -0,0 +1,6 @@
// Metro module 6535 (f6536).
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
export default function openPremiumPlanWhatYouLoseActionSheet(a0) {
ActionSheetActionCreators.hideActionSheet();
ActionSheetActionCreators.openLazy(import("./PremiumPlanWhatYouLoseActionSheet"), "PremiumPlanWhatYouLoseActionSheet", a0);
};
@@ -0,0 +1,33 @@
// Metro module 16670 (f16671).
import SubscriptionStore from "../../../../stores/billing/SubscriptionStore";
import UserOfferStore from "../../../../stores/billing/UserOfferStore";
import { MessageTypes } from "../../../../_bundle/Module686";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
import { fetchUserOffer } from "../../UserOfferActionCreators";
import AutomaticLifecycleManager from "../../../../lib/AutomaticLifecycleManager";
import setupLoadFromMessageManagerHandlers from "../../../messages/setupLoadFromMessageManagerHandlers";
import { $callWithNewTarget } from "../../../../_hermes/prelude";
let ReferralMessageManager;
const handleReferralMessages = function handleReferralMessages(a0) {
if (a0.type === MessageTypes.PREMIUM_REFERRAL && a0.content != null && SnowflakeUtils.isProbablyAValidSnowflake(a0.content)) {
const premiumTypeSubscription = SubscriptionStore.getPremiumTypeSubscription();
const shouldFetchReferralOffer = UserOfferStore.shouldFetchReferralOffer(SnowflakeUtils.extractTimestamp(a0.content));
if (premiumTypeSubscription == null && shouldFetchReferralOffer) {
fetchUserOffer("ReferralMessageManager");
}
}
};
const ReferralMessageManager2 = class ReferralMessageManager extends AutomaticLifecycleManager {
constructor() {
super();
setupLoadFromMessageManagerHandlers(this, handleReferralMessages);
}
};
ReferralMessageManager2.prototype;
ReferralMessageManager = ReferralMessageManager2;
const prototypeOf = Object.getPrototypeOf(ReferralMessageManager);
const r26 = Object.create(ReferralMessageManager.prototype);
const r27 = $callWithNewTarget(prototypeOf, r26, ReferralMessageManager);
const r28 = r27 instanceof Object ? r27 : r26;
setupLoadFromMessageManagerHandlers(r28, handleReferralMessages);
export default r28;
@@ -0,0 +1,15 @@
// Metro module 11004 (f11005).
import SubscriptionStore from "../../../../stores/billing/SubscriptionStore";
import UserOfferStore from "../../../../stores/billing/UserOfferStore";
export function canOpenPremiumPlanDirectlyForReferralTrial() {
const premiumTypeSubscription = SubscriptionStore.getPremiumTypeSubscription(false);
let r6 = SubscriptionStore.hasFetchedSubscriptions();
const isFetchingOffer = UserOfferStore.isFetchingOffer();
if (r6) {
r6 = premiumTypeSubscription == null;
}
if (r6) {
r6 = !isFetchingOffer;
}
return r6;
}
@@ -0,0 +1,56 @@
// Metro module 12601 (f12602).
import { View } from "react-native";
import { PREMIUM_YEARLY_DISCOUNT_PERCENT, PRICE_PLACEHOLDER, SubscriptionIntervalTypes } from "../PremiumConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { hexWithOpacity } from "../../../utils/ColorUtils";
import Module712 from "../../../_bundle/Module712";
import PremiumUtils from "../../../utils/PremiumUtils";
import { intl, t } from "../../../intl/index.native";
import { LegacyText } from "../../../design/void/native";
let useStyles;
const PremiumText = function PremiumText(props) {
const { style, isCurrentPlan, isGift, basePlanId, product } = props;
let text = props.text;
const styles = useStyles();
const intervalType = PremiumUtils.getInterval(basePlanId).intervalType;
const r11 = intervalType === SubscriptionIntervalTypes.YEAR ? isCurrentPlan ? null : `-${PREMIUM_YEARLY_DISCOUNT_PERCENT}%` : null;
if (text == null) {
let price = product?.priceString;
if (price == null) {
price = PRICE_PLACEHOLDER;
}
text = intervalType === SubscriptionIntervalTypes.MONTH ? isGift ? intl.formatToPlainString(t.FIjgMp, {
price
}) : intl.formatToPlainString(isCurrentPlan ? t.V6iX43 : t.AbOLNu, {
price
}) : isGift ? intl.formatToPlainString(t.rm53bV, {
price
}) : intl.formatToPlainString(isCurrentPlan ? t.dFbQCa : t["rS8FA+"], {
price
});
}
return <View style={styles.premiumText}>
<LegacyText style={style} numberOfLines={1} accessibilityLabel={intl.formatToPlainString(t.E0lS2r, {
product: product?.title,
description: text
})}>{text}</LegacyText>
{r11 != null ? <View style={styles.discount}>
<LegacyText style={style} numberOfLines={1}>{r11}</LegacyText>
</View> : null}
</View>;
};
useStyles = createStyles({
discount: {
borderWidth: 1,
borderColor: hexWithOpacity(Module712.unsafe_rawColors.WHITE, 0.3),
borderRadius: 2,
marginLeft: 4,
paddingHorizontal: 2
},
premiumText: {
flexDirection: "row"
}
});
export default function renderPremiumText(a0) {
return <PremiumText {...a0} />;
};
@@ -0,0 +1,54 @@
// Metro module 14788 (f14789).
import { useEffect, useCallback } from "react";
import { PremiumTypes } from "../../PremiumConstants";
import { AnalyticEvents } from "../../../../Constants";
import { ContentDismissActionType } from "../../../dismissible_content/DismissibleContentConstants";
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import UserTrialActionCreators_android from "../../UserTrialActionCreators.android";
import openPremiumModal from "../../../../components_native/premium/openPremiumModal";
import { formatIntervalDuration } from "../../../../utils/PremiumUtils";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import PremiumTrialOfferActionSheetContent from "./PremiumTrialOfferActionSheetContent";
export default ({ markAsDismissed, userTrialOffer, fallbackPremiumType = PremiumTypes.TIER_2 }) => {
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.PREMIUM_TRIAL_OFFER_ACTION_SHEET).analyticsLocations;
useEffect(() => {
if (userTrialOffer != null) {
AnalyticsUtils.track(AnalyticEvents.PREMIUM_TRIAL_OFFER_ACTION_SHEET_VIEWED, {
location: analyticsLocations,
trial_id: userTrialOffer.trial_id
});
UserTrialActionCreators_android.acknowledgeUserTrialOffer(userTrialOffer);
}
}, []);
useEffect(() => {
if (userTrialOffer == null) {
markAsDismissed(ContentDismissActionType.AUTO_DISMISS);
}
}, [userTrialOffer, markAsDismissed]);
const callback = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.PREMIUM_TRIAL_OFFER_ACTION_SHEET_DISMISSED, {
location: analyticsLocations,
trial_id: userTrialOffer?.trial_id
});
markAsDismissed(ContentDismissActionType.USER_DISMISS);
}, [analyticsLocations, markAsDismissed, userTrialOffer]);
const callback2 = useCallback(() => {
AnalyticsUtils.track(AnalyticEvents.PREMIUM_TRIAL_OFFER_ACTION_SHEET_CTA_CLICKED, {
location: analyticsLocations,
trial_id: userTrialOffer?.trial_id
});
markAsDismissed(ContentDismissActionType.TAKE_ACTION);
openPremiumModal({
analyticsLocations
});
}, [analyticsLocations, markAsDismissed, userTrialOffer]);
const intervalDuration = formatIntervalDuration({
intervalType: userTrialOffer == null ? void 0 : userTrialOffer.subscription_trial?.interval,
intervalCount: userTrialOffer == null ? void 0 : userTrialOffer.subscription_trial?.interval_count
});
return userTrialOffer == null ? null : <BottomSheet key={userTrialOffer.id} startExpanded onDismiss={callback}>
<PremiumTrialOfferActionSheetContent intervalDuration={intervalDuration} trialOffer={userTrialOffer} onConfirm={callback2} fallbackPremiumType={fallbackPremiumType} />
</BottomSheet>;
};
@@ -0,0 +1,79 @@
// Metro module 14789 (f14790).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { UserIcon } from "../../../../design/components/Icon/native/redesign/generated/UserIcon";
import { intl, t } from "../../../../intl/index.native";
import { ChatSmileIcon } from "../../../../design/components/Icon/native/redesign/generated/ChatSmileIcon";
import { FolderIcon } from "../../../../design/components/Icon/native/redesign/generated/FolderIcon";
import { NitroWumpusFlightRight3dIllustration } from "../../../../design/assets/native";
import { Text } from "../../../../design/components/Text/native/Text";
import { getDisplayNameFromSku } from "../../../../utils/PremiumUtils";
import PremiumPerksList from "../../../../components_native/premium/PremiumPerksList";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { NitroWheelIcon } from "../../../../design/components/Icon/native/redesign/generated/NitroWheelIcon";
const useStyles = createStyles({
contentContainer: {
paddingHorizontal: 36,
paddingTop: 18,
paddingBottom: 36,
width: "100%",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
alignItems: "flex-start",
display: "flex",
flexDirection: "column",
gap: 0
},
buttonContainer: {
marginVertical: 6,
width: "100%",
height: 48
},
title: {
width: "100%",
textAlign: "center"
},
heroIllustrationContainer: {
alignItems: "center",
justifyContent: "center",
height: 188,
width: "100%"
}
});
const r37 = memo(function PremiumTrialOfferActionSheetContent(props) {
const { trialOffer, intervalDuration, onConfirm } = props;
const styles = useStyles();
const subscription_trial = trialOffer?.subscription_trial;
const perks = [{
IconComponent: UserIcon,
label: intl.string(t.kpMomJ),
description: intl.string(t.uVUtPw)
}, {
IconComponent: ChatSmileIcon,
label: intl.string(t["R2IV/Q"]),
description: intl.string(t["3SUJLd"])
}, {
IconComponent: FolderIcon,
label: intl.string(t["u/NJKc"]),
description: intl.string(t.i1UuMk)
}];
return <View style={styles.contentContainer}>
<View style={styles.heroIllustrationContainer}>
<NitroWumpusFlightRight3dIllustration width={180} height={180} />
</View>
<Text variant="heading-xl/bold" color="mobile-text-heading-primary" style={styles.title}>
{intl.formatToPlainString(t.q8eMc0, {
displayName: subscription_trial?.sku_id != null ? getDisplayNameFromSku(subscription_trial?.sku_id) : null,
duration: intervalDuration
})}
</Text>
<PremiumPerksList perks={perks} />
<View style={styles.buttonContainer}>
<Button size="lg" text={intl.formatToPlainString(t.xASjq5, {
duration: intervalDuration
})} onPress={onConfirm} grow icon={<NitroWheelIcon size="md" color={Module712.unsafe_rawColors.WHITE} />} />
</View>
</View>;
});
export default r37;
@@ -0,0 +1,6 @@
// Metro module 12466 (f12467).
import { useToken } from "../../../design/tokens/native/useToken";
import Module712 from "../../../_bundle/Module712";
export default function usePremiumPrimaryGradientColors() {
return [useToken(Module712.colors.REDESIGN_BUTTON_PREMIUM_PRIMARY_PURPLE_FOR_GRADIENT), useToken(Module712.colors.REDESIGN_BUTTON_PREMIUM_PRIMARY_PURPLE_FOR_GRADIENT_2), useToken(Module712.colors.REDESIGN_BUTTON_PREMIUM_PRIMARY_PINK_FOR_GRADIENT)];
};
@@ -0,0 +1,17 @@
// Metro module 6329 (f6330).
import { useEffect } from "react";
import IAPStore_android from "../../../stores/native/IAPStore.android";
import { useStateFromStores } from "../../../_bundle/Module589";
import AlertActionCreators from "../../../actions/AlertActionCreators";
import { intl, t } from "../../../intl/index.native";
export default function useStoreConnectionErrorAlert() {
const stateFromStores = useStateFromStores([IAPStore_android], () => IAPStore_android.hasConnectionError());
useEffect(() => {
if (stateFromStores) {
AlertActionCreators.show({
title: intl.string(t["U+H+kd"]),
body: intl.string(t.Q9OYlM)
});
}
}, [stateFromStores]);
};
@@ -0,0 +1,115 @@
// Metro module 8779 (f8780).
import { PremiumGiftStyles } from "../../PremiumConstants";
import { AnimationState } from "../../PremiumGiftingUtils";
import * as _Module8780 from "../../../../_bundle/Module8780";
import * as _Module8781 from "../../../../_bundle/Module8781";
import * as _Module8782 from "../../../../_bundle/Module8782";
import * as _Module8783 from "../../../../_bundle/Module8783";
import * as _Module8784 from "../../../../_bundle/Module8784";
import * as _Module8785 from "../../../../_bundle/Module8785";
import * as _Module8786 from "../../../../_bundle/Module8786";
import * as _Module8787 from "../../../../_bundle/Module8787";
import * as _Module8788 from "../../../../_bundle/Module8788";
import * as _Module8789 from "../../../../_bundle/Module8789";
import * as _Module8790 from "../../../../_bundle/Module8790";
import * as _Module8791 from "../../../../_bundle/Module8791";
import * as _Module8792 from "../../../../_bundle/Module8792";
import * as _Module8793 from "../../../../_bundle/Module8793";
import * as _Module8794 from "../../../../_bundle/Module8794";
import * as _Module8795 from "../../../../_bundle/Module8795";
import * as _Module8796 from "../../../../_bundle/Module8796";
import * as _Module8797 from "../../../../_bundle/Module8797";
import * as _Module8798 from "../../../../_bundle/Module8798";
import * as _Module8799 from "../../../../_bundle/Module8799";
import * as _Module8800 from "../../../../_bundle/Module8800";
import * as _Module8801 from "../../../../_bundle/Module8801";
import * as _Module8802 from "../../../../_bundle/Module8802";
import * as _Module8803 from "../../../../_bundle/Module8803";
let c5735_3 = {
JSON: 0,
0: "JSON",
LOTTIE: 1,
1: "LOTTIE"
};
export { c5735_3 as LottieType };
export function getLottieType(a0) {
return a0 === PremiumGiftStyles.NITROWEEN_STANDARD ? c5735_3.LOTTIE : c5735_3.JSON;
}
export function getGiftAnimationData(a0, a1) {
if (PremiumGiftStyles.STANDARD_BOX === a0) {
if (AnimationState.IDLE === a1) {
return _Module8780;
}
if (AnimationState.LOOP === a1) {
return _Module8781;
}
return _Module8782;
}
if (PremiumGiftStyles.CAKE === a0) {
if (AnimationState.IDLE === a1) {
return _Module8783;
}
if (AnimationState.LOOP === a1) {
return _Module8784;
}
return _Module8785;
}
if (PremiumGiftStyles.CHEST === a0) {
if (AnimationState.IDLE === a1) {
return _Module8786;
}
if (AnimationState.LOOP === a1) {
return _Module8787;
}
return _Module8788;
}
if (PremiumGiftStyles.COFFEE === a0) {
if (AnimationState.IDLE === a1) {
return _Module8789;
}
if (AnimationState.LOOP === a1) {
return _Module8790;
}
return _Module8791;
}
if (PremiumGiftStyles.SEASONAL_STANDARD_BOX === a0) {
if (AnimationState.IDLE === a1) {
return _Module8792;
}
if (AnimationState.LOOP === a1) {
return _Module8793;
}
return _Module8794;
}
if (PremiumGiftStyles.SEASONAL_CAKE === a0) {
if (AnimationState.IDLE === a1) {
return _Module8795;
}
if (AnimationState.LOOP === a1) {
return _Module8796;
}
return _Module8797;
}
if (PremiumGiftStyles.SEASONAL_CHEST === a0) {
if (AnimationState.IDLE === a1) {
return _Module8798;
}
if (AnimationState.LOOP === a1) {
return _Module8799;
}
return _Module8800;
}
if (PremiumGiftStyles.SEASONAL_COFFEE === a0) {
if (AnimationState.IDLE === a1) {
return _Module8801;
}
if (AnimationState.LOOP === a1) {
return _Module8802;
}
return _Module8803;
}
if (PremiumGiftStyles.SNOWGLOBE !== a0 && PremiumGiftStyles.BOX !== a0) {
PremiumGiftStyles.CUP;
}
throw Error();
}
@@ -0,0 +1,111 @@
// Metro module 6552 (f6553).
import { SubscriptionStatusTypes } from "../../../../Constants";
import { PaymentGatewayToFriendlyName } from "../../../../_bundle/Module505";
import Logger from "../../../debug/Logger";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../../intl/index.native";
import { isIOS } from "../../../../utils/PlatformUtils";
import { isMetaQuest } from "../../../device/MetaQuestUtils.android";
import { goToStandaloneNitroManagementFromMobileApp } from "../../../payments/native/utils/BillingStandaloneNativeUtils";
import { LinkButton } from "../components/LinkButton";
let c4213_6, c4213_7, defaultMobileWebNitroManagementFailureCallback;
const defaultMobileWebNitroManagementSuccessCallback = function defaultMobileWebNitroManagementSuccessCallback() {
return c4213_6.log("Successfully opened mobile web Nitro Management page");
};
defaultMobileWebNitroManagementFailureCallback = function defaultMobileWebNitroManagementFailureCallback(a0) {
c4213_6.error("Failed to open mobile web Nitro Management page, error response: ", a0);
AlertActionCreators.show({
title: intl.string(t.NrBVjw),
body: intl.string(t["gD+grx"]),
hideActionSheet: true
});
};
c4213_6 = new Logger("PremiumManagementUtils");
const r32 = {
PREMIUM_MANAGEMENT: "premium_management"
};
c4213_7 = {
IN_APP: "manage_in_app",
IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY: "manage_in_external_mobile_payment_gateway",
IN_WEB: "manage_in_web"
};
export { r32 as MobileWebDestinationTypes };
export { c4213_7 as PremiumManagementMethod };
export function getPremiumManagementMethod(a0) {
let IN_APP;
const r1 = a0 == null;
let r2 = null;
if (!r1) {
L8: {
if (a0.isOnPlatformMatchingExternalPaymentGateway) {
IN_APP = c4213_7.IN_APP;
} else {
if (a0.isPurchasedExternally && a0.paymentGateway != null) {
IN_APP = c4213_7.IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY;
break L8;
}
IN_APP = c4213_7.IN_WEB;
}
}
r2 = IN_APP;
}
return r2;
}
export function getExternalManagementMessage(a0, r6 = null) {
let IN_APP;
let c15788_0 = r6;
const r0 = a0 == null;
let r12 = null;
if (!r0) {
L10: {
if (a0.isOnPlatformMatchingExternalPaymentGateway) {
IN_APP = c4213_7.IN_APP;
} else {
if (a0.isPurchasedExternally && a0.paymentGateway != null) {
IN_APP = c4213_7.IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY;
break L10;
}
IN_APP = c4213_7.IN_WEB;
}
}
r12 = IN_APP;
}
if (r12 != null && r12 !== c4213_7.IN_APP) {
const mobilePlatform = isIOS() ? "iOS" : isMetaQuest() ? "Meta Quest" : "Android";
if (r12 === c4213_7.IN_EXTERNAL_MOBILE_PAYMENT_GATEWAY && a0 != null && a0.paymentGateway != null) {
return intl.formatToPlainString(t.cFZnqX, {
mobilePlatform,
externalPaymentGateway: PaymentGatewayToFriendlyName[a0.paymentGateway]
});
}
if (r12 === c4213_7.IN_WEB) {
L26: {
if (r6 != null && r6.shouldAllowExternalManagement) {
if (mobilePlatform !== "iOS" && !isMetaQuest()) {
break L26;
}
const status = a0?.status;
const r54 = status === SubscriptionStatusTypes.CANCELED || status === SubscriptionStatusTypes.PAUSE_PENDING || status === SubscriptionStatusTypes.PAST_DUE;
return r6.returnCtaAsComponent ? <LinkButton containerStyle={{
justifyContent: "flex-start"
}} onPress={() => c15788_0 != null ? goToStandaloneNitroManagementFromMobileApp("premium_external_management", {
loadId: c15788_0.loadId
}, c15788_0.onSuccessCallback != null ? c15788_0.onSuccessCallback : defaultMobileWebNitroManagementSuccessCallback, c15788_0.onFailureCallback != null ? c15788_0.onFailureCallback : defaultMobileWebNitroManagementFailureCallback) : void 0} text={intl.string(r54 ? t.tqSSSA : t["olSp/D"])} variant="text-sm/semibold" /> : intl.format(t.IERwUb, {
manageExternalNitroSubscription: function manageExternalNitroSubscription() {
if (c15788_0 != null) {
return goToStandaloneNitroManagementFromMobileApp("premium_external_management", {
loadId: c15788_0.loadId
}, c15788_0.onSuccessCallback != null ? c15788_0.onSuccessCallback : defaultMobileWebNitroManagementSuccessCallback, c15788_0.onFailureCallback != null ? c15788_0.onFailureCallback : defaultMobileWebNitroManagementFailureCallback);
}
}
});
}
}
return intl.formatToPlainString(t.CnoyAN, {
mobilePlatform
});
}
return null;
}
return null;
}
@@ -0,0 +1,5 @@
// Metro module 9699 (f9700).
import ModalActionCreators from "../../../../actions/ModalActionCreators";
export function openGiftModal({ navigationParams, ...rest }) {
ModalActionCreators.pushLazy(import("../gifting/PremiumGiftModal"), rest, "gift_modal_key", navigationParams);
}